diff --git a/dist/index.js b/dist/index.js index 0d3fbcbb..e2638aa4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -67,74 +67,47 @@ module.exports = JSON.parse("{\"name\":\"@oclif/config\",\"description\":\"base /***/ }), /***/ 3109: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__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; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__webpack_require__(42186)); -const preview_1 = __importDefault(__webpack_require__(5363)); -const deploy_1 = __importDefault(__webpack_require__(77402)); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - const file = core.getInput('file'); - const doc = core.getInput('doc'); - const token = core.getInput('token'); - const command = core.getInput('command') || 'deploy'; - const cliParams = [file]; - const deployCliParams = ['--doc', doc, '--token', token]; - // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true - core.debug(`Waiting for bump ${command} ...`); - core.debug(new Date().toTimeString()); - switch (command) { - case 'preview': - yield preview_1.default.run(cliParams); - break; - case 'validate': - yield deploy_1.default.run(cliParams.concat(deployCliParams).concat(['--dry-run'])); - break; - case 'deploy': - yield deploy_1.default.run(cliParams.concat(deployCliParams)); - break; - } - core.debug(new Date().toTimeString()); - } - catch (error) { - core.setFailed(error.message); +const tslib_1 = __webpack_require__(75636); +const core = tslib_1.__importStar(__webpack_require__(42186)); +const preview_1 = tslib_1.__importDefault(__webpack_require__(5363)); +const deploy_1 = tslib_1.__importDefault(__webpack_require__(77402)); +async function run() { + try { + const file = core.getInput('file'); + const doc = core.getInput('doc'); + const hub = core.getInput('hub'); + const token = core.getInput('token'); + const command = core.getInput('command') || 'deploy'; + const cliParams = [file]; + let deployCliParams = ['--doc', doc, '--token', token]; + if (hub) { + deployCliParams = deployCliParams.concat(['--hub', hub]); + } + // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true + core.debug(`Waiting for bump ${command} ...`); + core.debug(new Date().toTimeString()); + switch (command) { + case 'preview': + await preview_1.default.run(cliParams); + break; + case 'dry-run': + case 'validate': + await deploy_1.default.run(cliParams.concat(deployCliParams).concat(['--dry-run'])); + break; + case 'deploy': + await deploy_1.default.run(cliParams.concat(deployCliParams)); + break; } - }); + core.debug(new Date().toTimeString()); + } + catch (error) { + core.setFailed(error.message); + } } exports.default = run; run(); @@ -147,14 +120,27 @@ run(); "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.issue = exports.issueCommand = void 0; const os = __importStar(__webpack_require__(12087)); const utils_1 = __webpack_require__(5278); /** @@ -233,6 +219,25 @@ function escapeProperty(s) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -242,14 +247,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; const command_1 = __webpack_require__(87351); const file_command_1 = __webpack_require__(717); const utils_1 = __webpack_require__(5278); @@ -316,7 +315,9 @@ function addPath(inputPath) { } exports.addPath = addPath; /** - * Gets the value of an input. The value is also trimmed. + * Gets the value of an input. + * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. + * Returns an empty string if the value is not defined. * * @param name name of the input to get * @param options optional. See InputOptions. @@ -327,9 +328,34 @@ function getInput(name, options) { if (options && options.required && !val) { throw new Error(`Input required and not supplied: ${name}`); } + if (options && options.trimWhitespace === false) { + return val; + } return val.trim(); } exports.getInput = getInput; +/** + * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. + * Support boolean input list: `true | True | TRUE | false | False | FALSE` . + * The return value is also in boolean type. + * ref: https://yaml.org/spec/1.2/spec.html#id2804923 + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns boolean + */ +function getBooleanInput(name, options) { + const trueValue = ['true', 'True', 'TRUE']; + const falseValue = ['false', 'False', 'FALSE']; + const val = getInput(name, options); + if (trueValue.includes(val)) + return true; + if (falseValue.includes(val)) + return false; + throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + + `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); +} +exports.getBooleanInput = getBooleanInput; /** * Sets the value of an output. * @@ -338,6 +364,7 @@ exports.getInput = getInput; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { + process.stdout.write(os.EOL); command_1.issueCommand('set-output', { name }, value); } exports.setOutput = setOutput; @@ -479,14 +506,27 @@ exports.getState = getState; "use strict"; // For internal use, subject to change. +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.issueCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__webpack_require__(35747)); @@ -517,6 +557,7 @@ exports.issueCommand = issueCommand; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toCommandValue = void 0; /** * Sanitizes an input into a string so it can be passed into issueCommand safely * @param input input to sanitize into a string @@ -4450,7 +4491,7 @@ exports.help = (opts = {}) => { Object.defineProperty(exports, "__esModule", ({ value: true })); const path = __webpack_require__(85622); -const semver = __webpack_require__(49708); +const semver = __webpack_require__(11383); function checkCWD() { try { process.cwd(); @@ -4588,3788 +4629,4080 @@ exports.sortBy = sortBy; /***/ }), -/***/ 71418: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 24499: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - static get ANY () { - return ANY - } - constructor (comp, options) { - options = parseOptions(options) +"use strict"; - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +const util_1 = __webpack_require__(54103); +var Command; +(function (Command) { + // eslint-disable-next-line no-inner-declarations + function toCached(c, plugin) { + return { + id: c.id, + description: c.description, + usage: c.usage, + pluginName: plugin && plugin.name, + pluginType: plugin && plugin.type, + hidden: c.hidden, + aliases: c.aliases || [], + examples: c.examples || c.example, + flags: util_1.mapValues(c.flags || {}, (flag, name) => { + if (flag.type === 'boolean') { + return { + name, + type: flag.type, + char: flag.char, + description: flag.description, + hidden: flag.hidden, + required: flag.required, + helpLabel: flag.helpLabel, + allowNo: flag.allowNo, + }; + } + return { + name, + type: flag.type, + char: flag.char, + description: flag.description, + hidden: flag.hidden, + required: flag.required, + helpLabel: flag.helpLabel, + helpValue: flag.helpValue, + options: flag.options, + default: typeof flag.default === 'function' ? flag.default({ options: {}, flags: {} }) : flag.default, + }; + }), + args: c.args ? c.args.map(a => ({ + name: a.name, + description: a.description, + required: a.required, + options: a.options, + default: typeof a.default === 'function' ? a.default({}) : a.default, + hidden: a.hidden, + })) : [], + }; } + Command.toCached = toCached; +})(Command = exports.Command || (exports.Command = {})); - 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) +/***/ 53969: +/***/ ((module, exports, __webpack_require__) => { - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`) - } +"use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' +Object.defineProperty(exports, "__esModule", ({ value: true })); +const errors_1 = __webpack_require__(52564); +const os = __webpack_require__(12087); +const path = __webpack_require__(85622); +const url_1 = __webpack_require__(78835); +const util_1 = __webpack_require__(31669); +const debug_1 = __webpack_require__(40673); +const Plugin = __webpack_require__(25082); +const ts_node_1 = __webpack_require__(39584); +const util_2 = __webpack_require__(54103); +// eslint-disable-next-line new-cap +const debug = debug_1.default(); +const _pjson = __webpack_require__(63309); +function channelFromVersion(version) { + const m = version.match(/[^-]+(?:-([^.]+))?/); + return (m && m[1]) || 'stable'; +} +function hasManifest(p) { + try { + require(p); + return true; } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) + catch (_a) { + return false; } - } - - toString () { - return this.value - } - - test (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true +} +const WSL = __webpack_require__(52559); +class Config { + // eslint-disable-next-line no-useless-constructor + constructor(options) { + this.options = options; + this._base = `${_pjson.name}@${_pjson.version}`; + this.debug = 0; + this.plugins = []; + this.warned = false; } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } + // eslint-disable-next-line complexity + async load() { + const plugin = new Plugin.Plugin({ root: this.options.root }); + await plugin.load(); + this.plugins.push(plugin); + this.root = plugin.root; + this.pjson = plugin.pjson; + this.name = this.pjson.name; + this.version = this.options.version || this.pjson.version || '0.0.0'; + this.channel = this.options.channel || channelFromVersion(this.version); + this.valid = plugin.valid; + this.arch = (os.arch() === 'ia32' ? 'x86' : os.arch()); + this.platform = WSL ? 'wsl' : os.platform(); + this.windows = this.platform === 'win32'; + this.bin = this.pjson.oclif.bin || this.name; + this.dirname = this.pjson.oclif.dirname || this.name; + if (this.platform === 'win32') + this.dirname = this.dirname.replace('/', '\\'); + this.userAgent = `${this.name}/${this.version} ${this.platform}-${this.arch} node-${process.version}`; + this.shell = this._shell(); + this.debug = this._debug(); + this.home = process.env.HOME || (this.windows && this.windowsHome()) || os.homedir() || os.tmpdir(); + this.cacheDir = this.scopedEnvVar('CACHE_DIR') || this.macosCacheDir() || this.dir('cache'); + this.configDir = this.scopedEnvVar('CONFIG_DIR') || this.dir('config'); + this.dataDir = this.scopedEnvVar('DATA_DIR') || this.dir('data'); + this.errlog = path.join(this.cacheDir, 'error.log'); + this.binPath = this.scopedEnvVar('BINPATH'); + this.npmRegistry = this.scopedEnvVar('NPM_REGISTRY') || this.pjson.oclif.npmRegistry; + this.pjson.oclif.update = this.pjson.oclif.update || {}; + this.pjson.oclif.update.node = this.pjson.oclif.update.node || {}; + const s3 = this.pjson.oclif.update.s3 || {}; + this.pjson.oclif.update.s3 = s3; + s3.bucket = this.scopedEnvVar('S3_BUCKET') || s3.bucket; + if (s3.bucket && !s3.host) + s3.host = `https://${s3.bucket}.s3.amazonaws.com`; + s3.templates = Object.assign(Object.assign({}, s3.templates), { target: Object.assign({ baseDir: '<%- bin %>', unversioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>", versioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>", manifest: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>" }, s3.templates && s3.templates.target), vanilla: Object.assign({ unversioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %><%- ext %>", versioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %><%- ext %>", baseDir: '<%- bin %>', manifest: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %>version" }, s3.templates && s3.templates.vanilla) }); + await this.loadUserPlugins(); + await this.loadDevPlugins(); + await this.loadCorePlugins(); + debug('config done'); } - - return cmp(version, this.operator, this.semver, this.options) - } - - intersects (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') + async loadCorePlugins() { + if (this.pjson.oclif.plugins) { + await this.loadPlugins(this.root, 'core', this.pjson.oclif.plugins); + } } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } + async loadDevPlugins() { + if (this.options.devPlugins !== false) { + // do not load oclif.devPlugins in production + if (hasManifest(path.join(this.root, 'oclif.manifest.json'))) + return; + try { + const devPlugins = this.pjson.oclif.devPlugins; + if (devPlugins) + await this.loadPlugins(this.root, 'dev', devPlugins); + } + catch (error) { + process.emitWarning(error); + } + } } - - 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) + async loadUserPlugins() { + if (this.options.userPlugins !== false) { + try { + const userPJSONPath = path.join(this.dataDir, 'package.json'); + debug('reading user plugins pjson %s', userPJSONPath); + const pjson = await util_2.loadJSON(userPJSONPath); + this.userPJSON = pjson; + if (!pjson.oclif) + pjson.oclif = { schema: 1 }; + if (!pjson.oclif.plugins) + pjson.oclif.plugins = []; + await this.loadPlugins(userPJSONPath, 'user', pjson.oclif.plugins.filter((p) => p.type === 'user')); + await this.loadPlugins(userPJSONPath, 'link', pjson.oclif.plugins.filter((p) => p.type === 'link')); + } + catch (error) { + if (error.code !== 'ENOENT') + process.emitWarning(error); + } + } } - - 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 - ) - } -} - -module.exports = Comparator - -const parseOptions = __webpack_require__(41318) -const {re, t} = __webpack_require__(55736) -const cmp = __webpack_require__(46541) -const debug = __webpack_require__(12079) -const SemVer = __webpack_require__(58725) -const Range = __webpack_require__(3890) - - -/***/ }), - -/***/ 3890: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// hoisted class for cyclic dependency -class Range { - 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) - } + async runHook(event, opts) { + debug('start %s hook', event); + const promises = this.plugins.map(p => { + const debug = __webpack_require__(38237)([this.bin, p.name, 'hooks', event].join(':')); + const context = { + config: this, + debug, + exit(code = 0) { + errors_1.exit(code); + }, + log(message, ...args) { + process.stdout.write(util_1.format(message, ...args) + '\n'); + }, + error(message, options = {}) { + errors_1.error(message, options); + }, + warn(message) { + errors_1.warn(message); + }, + }; + return Promise.all((p.hooks[event] || []) + .map(async (hook) => { + try { + const f = ts_node_1.tsPath(p.root, hook); + debug('start', f); + const search = (m) => { + if (typeof m === 'function') + return m; + if (m.default && typeof m.default === 'function') + return m.default; + return Object.values(m).find((m) => typeof m === 'function'); + }; + await search(require(f)).call(context, Object.assign(Object.assign({}, opts), { config: this })); + debug('done'); + } + catch (error) { + if (error && error.oclif && error.oclif.exit !== undefined) + throw error; + this.warn(error, `runHook ${event}`); + } + })); + }); + await Promise.all(promises); + debug('%s hook done', event); } - - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.format() - return this + async runCommand(id, argv = []) { + debug('runCommand %s %o', id, argv); + const c = this.findCommand(id); + if (!c) { + await this.runHook('command_not_found', { id }); + throw new errors_1.CLIError(`command ${id} not found`); + } + const command = c.load(); + await this.runHook('prerun', { Command: command, argv }); + const result = await command.run(argv, this); + await this.runHook('postrun', { Command: command, result: result, argv }); } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First, split based on boolean or || - this.raw = range - this.set = range - .split(/\s*\|\|\s*/) - // map the range to a 2d array of comparators - .map(range => this.parseRange(range.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) - - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${range}`) + scopedEnvVar(k) { + return process.env[this.scopedEnvVarKey(k)]; } - - // if we have any that are not the null set, throw out null sets. - if (this.set.length > 1) { - // keep the first one, in case they're all null sets - 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) { - // if we have any that are *, then the range is just * - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c] - break - } - } - } + scopedEnvVarTrue(k) { + const v = process.env[this.scopedEnvVarKey(k)]; + return v === '1' || v === 'true'; } - - 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() - - // memoize range parsing for performance. - // this is a very hot path, and fully deterministic. - 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 - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const rangeList = range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - // >=0.0.0 is equivalent to * - .map(comp => replaceGTE0(comp, this.options)) - // in loose mode, throw out any that are not valid comparators - .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) - .map(comp => new Comparator(comp, this.options)) - - // if any comparators are the null set, then replace with JUST null set - // if more than one comparator, remove any * comparators - // also, don't include the same comparator more than once - const l = rangeList.length - const rangeMap = new Map() - for (const comp of rangeList) { - if (isNullSet(comp)) - return [comp] - rangeMap.set(comp.value, comp) + scopedEnvVarKey(k) { + return [this.bin, k] + // eslint-disable-next-line no-useless-escape + .map(p => p.replace(/@/g, '').replace(/[-\/]/g, '_')) + .join('_') + .toUpperCase(); } - 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') + findCommand(id, opts = {}) { + const command = this.commands.find(c => c.id === id || c.aliases.includes(id)); + if (command) + return command; + if (opts.must) + errors_1.error(`command ${id} not found`); } - - 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) - }) - }) - ) - }) - ) - }) - } - - // if ANY of the sets match ALL of its comparators, then pass - test (version) { - if (!version) { - return false + findTopic(name, opts = {}) { + const topic = this.topics.find(t => t.name === name); + if (topic) + return topic; + if (opts.must) + throw new Error(`topic ${name} not found`); } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } + get commands() { + return util_2.flatMap(this.plugins, p => p.commands); } - - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } + get commandIDs() { + return util_2.uniq(this.commands.map(c => c.id)); + } + get topics() { + const topics = []; + for (const plugin of this.plugins) { + for (const topic of util_2.compact(plugin.topics)) { + const existing = topics.find(t => t.name === topic.name); + if (existing) { + existing.description = topic.description || existing.description; + existing.hidden = existing.hidden || topic.hidden; + } + else + topics.push(topic); + } + } + // add missing topics + for (const c of this.commands.filter(c => !c.hidden)) { + const parts = c.id.split(':'); + while (parts.length) { + const name = parts.join(':'); + if (name && !topics.find(t => t.name === name)) { + topics.push({ name, description: c.description }); + } + parts.pop(); + } + } + return topics; + } + s3Key(type, ext, options = {}) { + if (typeof ext === 'object') + options = ext; + else if (ext) + options.ext = ext; + const _ = __webpack_require__(90250); + return _.template(this.pjson.oclif.update.s3.templates[options.platform ? 'target' : 'vanilla'][type])(Object.assign(Object.assign({}, this), options)); + } + s3Url(key) { + const host = this.pjson.oclif.update.s3.host; + if (!host) + throw new Error('no s3 host is set'); + const url = new url_1.URL(host); + url.pathname = path.join(url.pathname, key); + return url.toString(); + } + dir(category) { + const base = process.env[`XDG_${category.toUpperCase()}_HOME`] || + (this.windows && process.env.LOCALAPPDATA) || + path.join(this.home, category === 'data' ? '.local/share' : '.' + category); + return path.join(base, this.dirname); + } + windowsHome() { + return this.windowsHomedriveHome() || this.windowsUserprofileHome(); + } + windowsHomedriveHome() { + return (process.env.HOMEDRIVE && process.env.HOMEPATH && path.join(process.env.HOMEDRIVE, process.env.HOMEPATH)); + } + windowsUserprofileHome() { + return process.env.USERPROFILE; + } + macosCacheDir() { + return (this.platform === 'darwin' && path.join(this.home, 'Library', 'Caches', this.dirname)) || undefined; + } + _shell() { + let shellPath; + const { SHELL, COMSPEC } = process.env; + if (SHELL) { + shellPath = SHELL.split('/'); + } + else if (this.windows && COMSPEC) { + shellPath = COMSPEC.split(/\\|\//); + } + else { + shellPath = ['unknown']; + } + return shellPath[shellPath.length - 1]; + } + _debug() { + if (this.scopedEnvVarTrue('DEBUG')) + return 1; + try { + const { enabled } = __webpack_require__(38237)(this.bin); + if (enabled) + return 1; + } + catch (_a) { } + return 0; + } + async loadPlugins(root, type, plugins, parent) { + if (!plugins || plugins.length === 0) + return; + debug('loading plugins', plugins); + await Promise.all((plugins || []).map(async (plugin) => { + try { + const opts = { type, root }; + if (typeof plugin === 'string') { + opts.name = plugin; + } + else { + opts.name = plugin.name || opts.name; + opts.tag = plugin.tag || opts.tag; + opts.root = plugin.root || opts.root; + } + const instance = new Plugin.Plugin(opts); + await instance.load(); + if (this.plugins.find(p => p.name === instance.name)) + return; + this.plugins.push(instance); + if (parent) { + // eslint-disable-next-line require-atomic-updates + instance.parent = parent; + if (!parent.children) + parent.children = []; + parent.children.push(instance); + } + await this.loadPlugins(instance.root, type, instance.pjson.oclif.plugins || [], instance); + } + catch (error) { + this.warn(error, 'loadPlugins'); + } + })); + } + warn(err, scope) { + if (this.warned) + return; + if (typeof err === 'string') { + process.emitWarning(err); + return; + } + if (err instanceof Error) { + const modifiedErr = err; + modifiedErr.name = `${err.name} Plugin: ${this.name}`; + modifiedErr.detail = util_2.compact([ + err.detail, + `module: ${this._base}`, + scope && `task: ${scope}`, + `plugin: ${this.name}`, + `root: ${this.root}`, + 'See more details with DEBUG=*', + ]).join('\n'); + process.emitWarning(err); + return; + } + // err is an object + process.emitWarning('Config.warn expected either a string or Error, but instead received an object'); + err.name = `${err.name} Plugin: ${this.name}`; + err.detail = util_2.compact([ + err.detail, + `module: ${this._base}`, + scope && `task: ${scope}`, + `plugin: ${this.name}`, + `root: ${this.root}`, + 'See more details with DEBUG=*', + ]).join('\n'); + process.emitWarning(JSON.stringify(err)); } - return false - } } -module.exports = Range - -const LRU = __webpack_require__(7129) -const cache = new LRU({ max: 1000 }) - -const parseOptions = __webpack_require__(41318) -const Comparator = __webpack_require__(71418) -const debug = __webpack_require__(12079) -const SemVer = __webpack_require__(58725) -const { - re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace -} = __webpack_require__(55736) - -const isNullSet = c => c.value === '<0.0.0-0' -const isAny = c => c.value === '' - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const 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 +exports.Config = Config; +function isConfig(o) { + return o && Boolean(o._base); } - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const 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 +async function load(opts = (module.parent && module.parent && module.parent.parent && module.parent.parent.filename) || __dirname) { + if (typeof opts === 'string') + opts = { root: opts }; + if (isConfig(opts)) + return opts; + const config = new Config(opts); + await config.load(); + return config; } +exports.load = load; -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -const replaceTildes = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceTilde(comp, options) - }).join(' ') +/***/ }), -const 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 +/***/ 40673: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0` - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - 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 { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` - } +"use strict"; - debug('tilde return', ret) - return ret - }) +Object.defineProperty(exports, "__esModule", ({ value: true })); +// tslint:disable no-console +let debug; +try { + debug = __webpack_require__(38237); +} +catch (_a) { } +function displayWarnings() { + if (process.listenerCount('warning') > 1) + return; + process.on('warning', (warning) => { + console.error(warning.stack); + if (warning.detail) + console.error(warning.detail); + }); } +exports.default = (...scope) => { + if (!debug) + return (..._) => { }; + const d = debug(['@oclif/config', ...scope].join(':')); + if (d.enabled) + displayWarnings(); + return (...args) => d(...args); +}; -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -const replaceCarets = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceCaret(comp, options) - }).join(' ') -const 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` - } - } +/***/ 54412: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - debug('caret return', ret) - return ret - }) -} +"use strict"; -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map((comp) => { - return replaceXRange(comp, options) - }).join(' ') +Object.defineProperty(exports, "__esModule", ({ value: true })); +try { + // eslint-disable-next-line node/no-missing-require + __webpack_require__(8387); } +catch (_a) { } +var config_1 = __webpack_require__(53969); +exports.Config = config_1.Config; +exports.load = config_1.load; +var command_1 = __webpack_require__(24499); +exports.Command = command_1.Command; +var plugin_1 = __webpack_require__(25082); +exports.Plugin = plugin_1.Plugin; -const 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 = '' - } +/***/ }), - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' +/***/ 25082: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - if (gtlt === '<') - pr = '-0' +"use strict"; - 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` +Object.defineProperty(exports, "__esModule", ({ value: true })); +const errors_1 = __webpack_require__(52564); +const path = __webpack_require__(85622); +const util_1 = __webpack_require__(31669); +const command_1 = __webpack_require__(24499); +const debug_1 = __webpack_require__(40673); +const ts_node_1 = __webpack_require__(39584); +const util_2 = __webpack_require__(54103); +const ROOT_INDEX_CMD_ID = ''; +const _pjson = __webpack_require__(63309); +const hasManifest = function (p) { + try { + require(p); + return true; } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') -} - -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp.trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') -} - -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -const 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() + catch (_a) { + return false; + } +}; +function topicsToArray(input, base) { + if (!input) + return []; + base = base ? `${base}:` : ''; + if (Array.isArray(input)) { + return input.concat(util_2.flatMap(input, t => topicsToArray(t.subtopics, `${base}${t.name}`))); + } + return util_2.flatMap(Object.keys(input), k => { + input[k].name = k; + return [Object.assign(Object.assign({}, input[k]), { name: `${base}${k}` })].concat(topicsToArray(input[k].subtopics, `${base}${input[k].name}`)); + }); } - -const testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false +// eslint-disable-next-line valid-jsdoc +/** + * find package root + * for packages installed into node_modules this will go up directories until + * it finds a node_modules directory with the plugin installed into it + * + * This is needed because of the deduping npm does + */ +async function findRoot(name, root) { + // essentially just "cd .." + function* up(from) { + while (path.dirname(from) !== from) { + yield from; + from = path.dirname(from); + } + yield from; } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - 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 + for (const next of up(root)) { + let cur; + if (name) { + cur = path.join(next, 'node_modules', name, 'package.json'); + // eslint-disable-next-line no-await-in-loop + if (await util_2.exists(cur)) + return path.dirname(cur); + try { + // eslint-disable-next-line no-await-in-loop + const pkg = await util_2.loadJSON(path.join(next, 'package.json')); + if (pkg.name === name) + return next; + } + catch (_a) { } + } + else { + cur = path.join(next, 'package.json'); + // eslint-disable-next-line no-await-in-loop + if (await util_2.exists(cur)) + return path.dirname(cur); } - } } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true } - - -/***/ }), - -/***/ 58725: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const debug = __webpack_require__(12079) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(60371) -const { re, t } = __webpack_require__(55736) - -const parseOptions = __webpack_require__(41318) -const { compareIdentifiers } = __webpack_require__(86723) -class SemVer { - 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}`) +class Plugin { + // eslint-disable-next-line no-useless-constructor + constructor(options) { + this.options = options; + // static loadedPlugins: {[name: string]: Plugin} = {} + this._base = `${_pjson.name}@${_pjson.version}`; + this.valid = false; + this.alreadyLoaded = false; + this.children = []; + // eslint-disable-next-line new-cap + this._debug = debug_1.default(); + this.warned = false; } - - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ) + async load() { + this.type = this.options.type || 'core'; + this.tag = this.options.tag; + const root = await findRoot(this.options.name, this.options.root); + if (!root) + throw new Error(`could not find package.json with ${util_1.inspect(this.options)}`); + this.root = root; + this._debug('reading %s plugin %s', this.type, root); + this.pjson = await util_2.loadJSON(path.join(root, 'package.json')); + this.name = this.pjson.name; + const pjsonPath = path.join(root, 'package.json'); + if (!this.name) + throw new Error(`no name in ${pjsonPath}`); + const isProd = hasManifest(path.join(root, 'oclif.manifest.json')); + if (!isProd && !this.pjson.files) + this.warn(`files attribute must be specified in ${pjsonPath}`); + // eslint-disable-next-line new-cap + this._debug = debug_1.default(this.name); + this.version = this.pjson.version; + if (this.pjson.oclif) { + this.valid = true; + } + else { + this.pjson.oclif = this.pjson['cli-engine'] || {}; + } + this.hooks = util_2.mapValues(this.pjson.oclif.hooks || {}, i => Array.isArray(i) ? i : [i]); + this.manifest = await this._manifest(Boolean(this.options.ignoreManifest), Boolean(this.options.errorOnManifestCreate)); + this.commands = Object.entries(this.manifest.commands) + .map(([id, c]) => (Object.assign(Object.assign({}, c), { load: () => this.findCommand(id, { must: true }) }))); + this.commands.sort((a, b) => { + if (a.id < b.id) + return -1; + if (a.id > b.id) + return 1; + return 0; + }); } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - 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}`) + get topics() { + return topicsToArray(this.pjson.oclif.topics || {}); } - - this.raw = version - - // these are actually numbers - 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') + get commandsDir() { + return ts_node_1.tsPath(this.root, this.pjson.oclif.commands); } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') + get commandIDs() { + if (!this.commandsDir) + return []; + let globby; + try { + const globbyPath = require.resolve('globby', { paths: [this.root, __dirname] }); + globby = require(globbyPath); + } + catch (error) { + this.warn(error, 'not loading commands, globby not found'); + return []; + } + this._debug(`loading IDs from ${this.commandsDir}`); + const patterns = [ + '**/*.+(js|ts|tsx)', + '!**/*.+(d.ts|test.ts|test.js|spec.ts|spec.js)?(x)', + ]; + const ids = globby.sync(patterns, { cwd: this.commandsDir }) + .map(file => { + const p = path.parse(file); + const topics = p.dir.split('/'); + const command = p.name !== 'index' && p.name; + // support src/commands/index as a "root" command + if (!command && this.type === 'core' && p.dir.length === 0 && p.name === 'index') + return ROOT_INDEX_CMD_ID; + return [...topics, command].filter(f => f).join(':'); + }); + this._debug('found commands', ids); + return ids; } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') + findCommand(id, opts = {}) { + const fetch = () => { + if (!this.commandsDir) + return; + const search = (cmd) => { + if (typeof cmd.run === 'function') + return cmd; + if (cmd.default && cmd.default.run) + return cmd.default; + return Object.values(cmd).find((cmd) => typeof cmd.run === 'function'); + }; + const p = require.resolve(path.join(this.commandsDir, ...id.split(':'))); + this._debug('require', p); + let m; + try { + m = require(p); + } + catch (error) { + if (!opts.must && error.code === 'MODULE_NOT_FOUND') + return; + throw error; + } + const cmd = search(m); + if (!cmd) + return; + cmd.id = id; + cmd.plugin = this; + return cmd; + }; + const cmd = fetch(); + if (!cmd && opts.must) + errors_1.error(`command ${id} not found`); + return cmd; } - - // numberify any prerelease numeric ids - 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 - } + async _manifest(ignoreManifest, errorOnManifestCreate = false) { + const readManifest = async (dotfile = false) => { + try { + const p = path.join(this.root, `${dotfile ? '.' : ''}oclif.manifest.json`); + const manifest = await util_2.loadJSON(p); + if (!process.env.OCLIF_NEXT_VERSION && manifest.version.split('-')[0] !== this.version.split('-')[0]) { + process.emitWarning(`Mismatched version in ${this.name} plugin manifest. Expected: ${this.version} Received: ${manifest.version}\nThis usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.`); + } + else { + this._debug('using manifest from', p); + return manifest; + } + } + catch (error) { + if (error.code === 'ENOENT') { + if (!dotfile) + return readManifest(true); + } + else { + this.warn(error, 'readManifest'); + } + } + }; + if (!ignoreManifest) { + const manifest = await readManifest(); + if (manifest) + return manifest; } - return id - }) + return { + version: this.version, + // eslint-disable-next-line array-callback-return + commands: this.commandIDs.map(id => { + try { + return [id, command_1.Command.toCached(this.findCommand(id, { must: true }), this)]; + } + catch (error) { + const scope = 'toCached'; + if (Boolean(errorOnManifestCreate) === false) + this.warn(error, scope); + else + throw this.addErrorScope(error, scope); + } + }) + .filter((f) => Boolean(f)) + .reduce((commands, [id, c]) => { + commands[id] = c; + return commands; + }, {}), + }; } - - 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('.')}` + warn(err, scope) { + if (this.warned) + return; + if (typeof err === 'string') + err = new Error(err); + process.emitWarning(this.addErrorScope(err, scope)); } - 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) + addErrorScope(err, scope) { + err.name = `${err.name} Plugin: ${this.name}`; + err.detail = util_2.compact([err.detail, `module: ${this._base}`, scope && `task: ${scope}`, `plugin: ${this.name}`, `root: ${this.root}`, 'See more details with DEBUG=*']).join('\n'); + return err; } +} +exports.Plugin = Plugin; - 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) - } +/***/ 39584: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) - } +"use strict"; - comparePre (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs = __webpack_require__(35747); +const path = __webpack_require__(85622); +const debug_1 = __webpack_require__(40673); +// eslint-disable-next-line new-cap +const debug = debug_1.default(); +const tsconfigs = {}; +const rootDirs = []; +const typeRoots = [`${__dirname}/../node_modules/@types`]; +function loadTSConfig(root) { + const tsconfigPath = path.join(root, 'tsconfig.json'); + let typescript; + try { + typescript = __webpack_require__(75034); } - - // NOT having a prerelease is > having one - 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 + catch (_a) { + try { + typescript = require(root + '/node_modules/typescript'); + } + catch (_b) { } } - - let i = 0 - do { - const a = this.prerelease[i] - const b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - 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 === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - 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': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - 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 is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - 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) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } + if (fs.existsSync(tsconfigPath) && typescript) { + const tsconfig = typescript.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, 'utf8')).config; + if (!tsconfig || !tsconfig.compilerOptions) { + throw new Error(`Could not read and parse tsconfig.json at ${tsconfigPath}, or it ` + + 'did not contain a "compilerOptions" section.'); } - break - - default: - throw new Error(`invalid increment argument: ${release}`) + return tsconfig; } - this.format() - this.raw = this.version - return this - } } - -module.exports = SemVer - - -/***/ }), - -/***/ 95512: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(84283) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null +function registerTSNode(root) { + if (process.env.OCLIF_TS_NODE === '0') + return; + if (tsconfigs[root]) + return; + const tsconfig = loadTSConfig(root); + if (!tsconfig) + return; + debug('registering ts-node at', root); + const tsNodePath = require.resolve('ts-node', { paths: [root, __dirname] }); + const tsNode = require(tsNodePath); + tsconfigs[root] = tsconfig; + typeRoots.push(`${root}/node_modules/@types`); + if (tsconfig.compilerOptions.rootDirs) { + rootDirs.push(...tsconfig.compilerOptions.rootDirs.map(r => path.join(root, r))); + } + else { + rootDirs.push(`${root}/src`); + } + const cwd = process.cwd(); + try { + process.chdir(root); + tsNode.register({ + skipProject: true, + transpileOnly: true, + // cache: false, + // typeCheck: true, + compilerOptions: { + esModuleInterop: tsconfig.compilerOptions.esModuleInterop, + target: tsconfig.compilerOptions.target || 'es2017', + experimentalDecorators: tsconfig.compilerOptions.experimentalDecorators || false, + emitDecoratorMetadata: tsconfig.compilerOptions.emitDecoratorMetadata || false, + module: 'commonjs', + sourceMap: true, + rootDirs, + typeRoots, + jsx: 'react', + }, + }); + } + finally { + process.chdir(cwd); + } } -module.exports = clean +function tsPath(root, orig) { + if (!orig) + return orig; + orig = path.join(root, orig); + try { + registerTSNode(root); + const tsconfig = tsconfigs[root]; + if (!tsconfig) + return orig; + const { rootDir, rootDirs, outDir } = tsconfig.compilerOptions; + const rootDirPath = rootDir || (rootDirs || [])[0]; + if (!rootDirPath || !outDir) + return orig; + // rewrite path from ./lib/foo to ./src/foo + const lib = path.join(root, outDir); // ./lib + const src = path.join(root, rootDirPath); // ./src + const relative = path.relative(lib, orig); // ./commands + const out = path.join(src, relative); // ./src/commands + // this can be a directory of commands or point to a hook file + // if it's a directory, we check if the path exists. If so, return the path to the directory. + // For hooks, it might point to a module, not a file. Something like "./hooks/myhook" + // That file doesn't exist, and the real file is "./hooks/myhook.ts" + // In that case we attempt to resolve to the filename. If it fails it will revert back to the lib path + if (fs.existsSync(out) || fs.existsSync(out + '.ts')) + return out; + return orig; + } + catch (error) { + debug(error); + return orig; + } +} +exports.tsPath = tsPath; /***/ }), -/***/ 46541: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const eq = __webpack_require__(91258) -const neq = __webpack_require__(73287) -const gt = __webpack_require__(10330) -const gte = __webpack_require__(75717) -const lt = __webpack_require__(16980) -const lte = __webpack_require__(51916) - -const 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 +/***/ 54103: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - case '': - case '=': - case '==': - return eq(a, b, loose) +"use strict"; - case '!=': - return neq(a, b, loose) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs = __webpack_require__(35747); +const debug = __webpack_require__(38237)('@oclif/config'); +function flatMap(arr, fn) { + return arr.reduce((arr, i) => arr.concat(fn(i)), []); +} +exports.flatMap = flatMap; +function mapValues(obj, fn) { + return Object.entries(obj) + .reduce((o, [k, v]) => { + o[k] = fn(v, k); + return o; + }, {}); +} +exports.mapValues = mapValues; +function exists(path) { + return new Promise(resolve => resolve(fs.existsSync(path))); +} +exports.exists = exists; +function loadJSON(path) { + debug('loadJSON %s', path); + // let loadJSON + // try { loadJSON = require('load-json-file') } catch {} + // if (loadJSON) return loadJSON.sync(path) + return new Promise((resolve, reject) => { + fs.readFile(path, 'utf8', (err, d) => { + try { + if (err) + reject(err); + else + resolve(JSON.parse(d)); + } + catch (error) { + reject(error); + } + }); + }); +} +exports.loadJSON = loadJSON; +function compact(a) { + return a.filter((a) => Boolean(a)); +} +exports.compact = compact; +function uniq(arr) { + return arr.filter((a, i) => { + return !arr.find((b, j) => j > i && b === a); + }); +} +exports.uniq = uniq; - case '>': - return gt(a, b, loose) - case '>=': - return gte(a, b, loose) +/***/ }), - case '<': - return lt(a, b, loose) +/***/ 46418: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - case '<=': - return lte(a, b, loose) +"use strict"; - default: - throw new TypeError(`Invalid operator: ${op}`) - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +const logger_1 = __webpack_require__(41434); +// eslint-disable-next-line no-multi-assign +const g = global.oclif = global.oclif || {}; +function displayWarnings() { + if (process.listenerCount('warning') > 1) + return; + process.on('warning', (warning) => { + console.error(warning.stack); + if (warning.detail) + console.error(warning.detail); + }); } -module.exports = cmp +exports.config = { + errorLogger: undefined, + get debug() { + return Boolean(g.debug); + }, + set debug(enabled) { + g.debug = enabled; + if (enabled) + displayWarnings(); + }, + get errlog() { + return g.errlog; + }, + set errlog(errlog) { + g.errlog = errlog; + if (errlog) + this.errorLogger = new logger_1.Logger(errlog); + else + delete this.errorLogger; + }, +}; /***/ }), -/***/ 72493: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(58725) -const parse = __webpack_require__(84283) -const {re, t} = __webpack_require__(55736) - -const coerce = (version, options) => { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } +/***/ 68954: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - options = options || {} +"use strict"; - let match = null - if (!options.rtl) { - match = version.match(re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - 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 +// tslint:disable no-implicit-dependencies +Object.defineProperty(exports, "__esModule", ({ value: true })); +const config_1 = __webpack_require__(46418); +function addOclifExitCode(error, options) { + if (!('oclif' in error)) { + error.oclif = {}; } - // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 - } - - if (match === null) - return null - - return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) + error.oclif.exit = (options === null || options === void 0 ? void 0 : options.exit) === undefined ? 2 : options.exit; + return error; } -module.exports = coerce +exports.addOclifExitCode = addOclifExitCode; +class CLIError extends Error { + constructor(error, options = {}) { + super(error instanceof Error ? error.message : error); + this.oclif = {}; + addOclifExitCode(this, options); + this.code = options.code; + } + get stack() { + const clean = __webpack_require__(27972); + return clean(super.stack, { pretty: true }); + } + /** + * @deprecated `render` Errors display should be handled by display function, like pretty-print + * @return {string} returns a string representing the dispay of the error + */ + render() { + if (config_1.config.debug) { + return this.stack; + } + const wrap = __webpack_require__(59824); + const indent = __webpack_require__(98043); + let output = `${this.name}: ${this.message}`; + // eslint-disable-next-line node/no-missing-require + output = wrap(output, __webpack_require__(13176).errtermwidth - 6, { trim: false, hard: true }); + output = indent(output, 3); + output = indent(output, 1, { indent: this.bang, includeEmptyLines: true }); + output = indent(output, 1); + return output; + } + get bang() { + let red = ((s) => s); + try { + red = __webpack_require__(38707).red; + } + catch (_a) { } + return red(process.platform === 'win32' ? '»' : '›'); + } +} +exports.CLIError = CLIError; +(function (CLIError) { + class Warn extends CLIError { + constructor(err) { + super(err instanceof Error ? err.message : err); + this.name = 'Warning'; + } + get bang() { + let yellow = ((s) => s); + try { + yellow = __webpack_require__(38707).yellow; + } + catch (_a) { } + return yellow(process.platform === 'win32' ? '»' : '›'); + } + } + CLIError.Warn = Warn; +})(CLIError = exports.CLIError || (exports.CLIError = {})); /***/ }), -/***/ 11729: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 7711: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const SemVer = __webpack_require__(58725) -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const cli_1 = __webpack_require__(68954); +class ExitError extends cli_1.CLIError { + constructor(exitCode = 0) { + super(`EEXIT: ${exitCode}`, { exit: exitCode }); + this.code = 'EEXIT'; + } + render() { + return ''; + } } -module.exports = compareBuild +exports.ExitError = ExitError; /***/ }), -/***/ 40716: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(2518) -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose - +/***/ 10444: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/***/ }), +"use strict"; -/***/ 2518: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(58725) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) - -module.exports = compare - - -/***/ }), - -/***/ 52672: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(84283) -const eq = __webpack_require__(91258) - -const 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 +Object.defineProperty(exports, "__esModule", ({ value: true })); +const wrap = __webpack_require__(59824); +const indent = __webpack_require__(98043); +const screen = __webpack_require__(13176); +const config_1 = __webpack_require__(46418); +function applyPrettyPrintOptions(error, options) { + const prettyErrorKeys = ['message', 'code', 'ref', 'suggestions']; + prettyErrorKeys.forEach(key => { + const applyOptionsKey = !(key in error) && options[key]; + if (applyOptionsKey) { + error[key] = options[key]; } - } + }); + return error; +} +exports.applyPrettyPrintOptions = applyPrettyPrintOptions; +const formatSuggestions = (suggestions) => { + const label = 'Try this:'; + if (!suggestions || suggestions.length === 0) + return undefined; + if (suggestions.length === 1) + return `${label} ${suggestions[0]}`; + const multiple = suggestions.map(suggestion => `* ${suggestion}`).join('\n'); + return `${label}\n${indent(multiple, 2)}`; +}; +function prettyPrint(error) { + if (config_1.config.debug) { + return error.stack; } - return defaultResult // may be undefined - } + const { message, code, suggestions, ref, name: errorSuffix, bang } = error; + // errorSuffix is pulled from the 'name' property on CLIError + // and is like either Error or Warning + const formattedHeader = message ? `${errorSuffix || 'Error'}: ${message}` : undefined; + const formattedCode = code ? `Code: ${code}` : undefined; + const formattedSuggestions = formatSuggestions(suggestions); + const formattedReference = ref ? `Reference: ${ref}` : undefined; + const formatted = [formattedHeader, formattedCode, formattedSuggestions, formattedReference] + .filter(Boolean) + .join('\n'); + let output = wrap(formatted, screen.errtermwidth - 6, { trim: false, hard: true }); + output = indent(output, 3); + output = indent(output, 1, { indent: bang || '', includeEmptyLines: true }); + output = indent(output, 1); + return output; } -module.exports = diff +exports.default = prettyPrint; /***/ }), -/***/ 91258: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(2518) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq - - -/***/ }), +/***/ 30690: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/***/ 10330: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +"use strict"; -const compare = __webpack_require__(2518) -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* eslint-disable no-process-exit */ +/* eslint-disable unicorn/no-process-exit */ +const config_1 = __webpack_require__(46418); +const pretty_print_1 = __webpack_require__(10444); +const _1 = __webpack_require__(52564); +const clean = __webpack_require__(27972); +const cli_1 = __webpack_require__(68954); +exports.handle = (err) => { + var _a, _b, _c; + try { + if (!err) + err = new cli_1.CLIError('no error?'); + if (err.message === 'SIGINT') + process.exit(1); + const shouldPrint = !(err instanceof _1.ExitError); + const pretty = pretty_print_1.default(err); + const stack = clean(err.stack || '', { pretty: true }); + if (shouldPrint) { + console.error(pretty ? pretty : stack); + } + const exitCode = ((_a = err.oclif) === null || _a === void 0 ? void 0 : _a.exit) !== undefined && ((_b = err.oclif) === null || _b === void 0 ? void 0 : _b.exit) !== false ? (_c = err.oclif) === null || _c === void 0 ? void 0 : _c.exit : 1; + if (config_1.config.errorLogger && err.code !== 'EEXIT') { + if (stack) { + config_1.config.errorLogger.log(stack); + } + config_1.config.errorLogger.flush() + .then(() => process.exit(exitCode)) + .catch(console.error); + } + else + process.exit(exitCode); + } + catch (error) { + console.error(err.stack); + console.error(error.stack); + process.exit(1); + } +}; /***/ }), -/***/ 75717: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 52564: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const compare = __webpack_require__(2518) -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte +"use strict"; +// tslint:disable no-console +Object.defineProperty(exports, "__esModule", ({ value: true })); +var handle_1 = __webpack_require__(30690); +exports.handle = handle_1.handle; +var exit_1 = __webpack_require__(7711); +exports.ExitError = exit_1.ExitError; +var cli_1 = __webpack_require__(68954); +exports.CLIError = cli_1.CLIError; +var logger_1 = __webpack_require__(41434); +exports.Logger = logger_1.Logger; +var config_1 = __webpack_require__(46418); +exports.config = config_1.config; +const config_2 = __webpack_require__(46418); +const cli_2 = __webpack_require__(68954); +const exit_2 = __webpack_require__(7711); +const pretty_print_1 = __webpack_require__(10444); +function exit(code = 0) { + throw new exit_2.ExitError(code); +} +exports.exit = exit; +function error(input, options = {}) { + var _a; + let err; + if (typeof input === 'string') { + err = new cli_2.CLIError(input, options); + } + else if (input instanceof Error) { + err = cli_2.addOclifExitCode(input, options); + } + else { + throw new TypeError('first argument must be a string or instance of Error'); + } + err = pretty_print_1.applyPrettyPrintOptions(err, options); + if (options.exit === false) { + const message = pretty_print_1.default(err); + console.error(message); + if (config_2.config.errorLogger) + config_2.config.errorLogger.log((_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : ''); + } + else + throw err; +} +exports.error = error; +function warn(input) { + var _a; + let err; + if (typeof input === 'string') { + err = new cli_2.CLIError.Warn(input); + } + else if (input instanceof Error) { + err = cli_2.addOclifExitCode(input); + } + else { + throw new TypeError('first argument must be a string or instance of Error'); + } + const message = pretty_print_1.default(err); + console.error(message); + if (config_2.config.errorLogger) + config_2.config.errorLogger.log((_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : ''); +} +exports.warn = warn; -/***/ }), -/***/ 85474: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ }), -const SemVer = __webpack_require__(58725) +/***/ 41434: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const inc = (version, release, options, identifier) => { - if (typeof (options) === 'string') { - identifier = options - options = undefined - } +"use strict"; - try { - return new SemVer(version, options).inc(release, identifier).version - } catch (er) { - return null - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __webpack_require__(85622); +const timestamp = () => new Date().toISOString(); +let timer; +const wait = (ms) => new Promise(resolve => { + if (timer) + timer.unref(); + timer = setTimeout(() => resolve(), ms); +}); +function chomp(s) { + if (s.endsWith('\n')) + return s.replace(/\n$/, ''); + return s; } -module.exports = inc +class Logger { + // eslint-disable-next-line no-useless-constructor + constructor(file) { + this.file = file; + this.flushing = Promise.resolve(); + this.buffer = []; + } + log(msg) { + const stripAnsi = __webpack_require__(45591); + msg = stripAnsi(chomp(msg)); + const lines = msg.split('\n').map(l => `${timestamp()} ${l}`.trimRight()); + this.buffer.push(...lines); + // tslint:disable-next-line no-console + this.flush(50).catch(console.error); + } + async flush(waitForMs = 0) { + await wait(waitForMs); + this.flushing = this.flushing.then(async () => { + if (this.buffer.length === 0) + return; + const mylines = this.buffer; + this.buffer = []; + const fs = __webpack_require__(5630); + await fs.mkdirp(path.dirname(this.file)); + await fs.appendFile(this.file, mylines.join('\n') + '\n'); + }); + await this.flushing; + } +} +exports.Logger = Logger; /***/ }), -/***/ 16980: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(2518) -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt - - -/***/ }), +/***/ 13176: +/***/ ((__unused_webpack_module, exports) => { -/***/ 51916: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +"use strict"; -const compare = __webpack_require__(2518) -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte +Object.defineProperty(exports, "__esModule", ({ value: true })); +function termwidth(stream) { + if (!stream.isTTY) { + return 80; + } + const width = stream.getWindowSize()[0]; + if (width < 1) { + return 80; + } + if (width < 40) { + return 40; + } + return width; +} +const columns = global.columns; +exports.stdtermwidth = columns || termwidth(process.stdout); +exports.errtermwidth = columns || termwidth(process.stderr); /***/ }), -/***/ 94702: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 49094: +/***/ ((module) => { -const SemVer = __webpack_require__(58725) -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major +// code is originally from https://github.com/AnAppAMonth/linewrap +// Presets +var presetMap = { + 'html': { + skipScheme: 'html', + lineBreakScheme: 'html', + whitespace: 'collapse' + } +} -/***/ }), +// lineBreak Schemes +var brPat = /<\s*br(?:[\s/]*|\s[^>]*)>/gi +var lineBreakSchemeMap = { + 'unix': [/\n/g, '\n'], + 'dos': [/\r\n/g, '\r\n'], + 'mac': [/\r/g, '\r'], + 'html': [brPat, '
'], + 'xhtml': [brPat, '
'] +} -/***/ 41039: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +// skip Schemes +var skipSchemeMap = { + 'ansi-color': /\x1B\[[^m]*m/g, + 'html': /<[^>]*>/g, + 'bbcode': /\[[^]]*\]/g +} -const SemVer = __webpack_require__(58725) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor +var modeMap = { + 'soft': 1, + 'hard': 1 +} +var wsMap = { + 'collapse': 1, + 'default': 1, + 'line': 1, + 'all': 1 +} -/***/ }), +var rlbMap = { + 'all': 1, + 'multi': 1, + 'none': 1 +} +var rlbSMPat = /([sm])(\d+)/ -/***/ 73287: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +var escapePat = /[-/\\^$*+?.()|[\]{}]/g +function escapeRegExp (s) { + return s.replace(escapePat, '\\$&') +} -const compare = __webpack_require__(2518) -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq +var linewrap = module.exports = function (start, stop, params) { + if (typeof start === 'object') { + params = start + start = params.start + stop = params.stop + } + if (typeof stop === 'object') { + params = stop + start = start || params.start + stop = undefined + } -/***/ }), + if (!stop) { + stop = start + start = 0 + } -/***/ 84283: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + if (!params) { params = {}; } + // Supported options and default values. + var preset, + mode = 'soft', + whitespace = 'default', + tabWidth = 4, + skip, skipScheme, lineBreak, lineBreakScheme, + respectLineBreaks = 'all', + respectNum, + preservedLineIndent, + wrapLineIndent, wrapLineIndentBase -const {MAX_LENGTH} = __webpack_require__(60371) -const { re, t } = __webpack_require__(55736) -const SemVer = __webpack_require__(58725) + var skipPat + var lineBreakPat, lineBreakStr + var multiLineBreakPat + var preservedLinePrefix = '' + var wrapLineIndentPat, wrapLineInitPrefix = '' + var tabRepl + var item, flags + var i -const parseOptions = __webpack_require__(41318) -const parse = (version, options) => { - options = parseOptions(options) + // First process presets, because these settings can be overwritten later. + preset = params.preset + if (preset) { + if (!(preset instanceof Array)) { + preset = [preset] + } + for (i = 0; i < preset.length; i++) { + item = presetMap[preset[i]] + if (item) { + if (item.mode) { + mode = item.mode + } + if (item.whitespace) { + whitespace = item.whitespace + } + if (item.tabWidth !== undefined) { + tabWidth = item.tabWidth + } + if (item.skip) { + skip = item.skip + } + if (item.skipScheme) { + skipScheme = item.skipScheme + } + if (item.lineBreak) { + lineBreak = item.lineBreak + } + if (item.lineBreakScheme) { + lineBreakScheme = item.lineBreakScheme + } + if (item.respectLineBreaks) { + respectLineBreaks = item.respectLineBreaks + } + if (item.preservedLineIndent !== undefined) { + preservedLineIndent = item.preservedLineIndent + } + if (item.wrapLineIndent !== undefined) { + wrapLineIndent = item.wrapLineIndent + } + if (item.wrapLineIndentBase) { + wrapLineIndentBase = item.wrapLineIndentBase + } + } else { + throw new TypeError('preset must be one of "' + Object.keys(presetMap).join('", "') + '"') + } + } + } - if (version instanceof SemVer) { - return version + if (params.mode) { + if (modeMap[params.mode]) { + mode = params.mode + } else { + throw new TypeError('mode must be one of "' + Object.keys(modeMap).join('", "') + '"') + } + } + // Available options: 'collapse', 'default', 'line', and 'all' + if (params.whitespace) { + if (wsMap[params.whitespace]) { + whitespace = params.whitespace + } else { + throw new TypeError('whitespace must be one of "' + Object.keys(wsMap).join('", "') + '"') + } } - if (typeof version !== 'string') { - return null + if (params.tabWidth !== undefined) { + if (parseInt(params.tabWidth, 10) >= 0) { + tabWidth = parseInt(params.tabWidth, 10) + } else { + throw new TypeError('tabWidth must be a non-negative integer') + } } + tabRepl = new Array(tabWidth + 1).join(' ') - if (version.length > MAX_LENGTH) { - return null + // Available options: 'all', 'multi', 'm\d+', 's\d+', 'none' + if (params.respectLineBreaks) { + if (rlbMap[params.respectLineBreaks] || rlbSMPat.test(params.respectLineBreaks)) { + respectLineBreaks = params.respectLineBreaks + } else { + throw new TypeError('respectLineBreaks must be one of "' + Object.keys(rlbMap).join('", "') + + '", "m", "s"') + } + } + // After these conversions, now we have 4 options in `respectLineBreaks`: + // 'all', 'none', 'm' and 's'. + // `respectNum` is applicable iff `respectLineBreaks` is either 'm' or 's'. + if (respectLineBreaks === 'multi') { + respectLineBreaks = 'm' + respectNum = 2 + } else if (!rlbMap[respectLineBreaks]) { + var match = rlbSMPat.exec(respectLineBreaks) + respectLineBreaks = match[1] + respectNum = parseInt(match[2], 10) } - const r = options.loose ? re[t.LOOSE] : re[t.FULL] - if (!r.test(version)) { - return null + if (params.preservedLineIndent !== undefined) { + if (parseInt(params.preservedLineIndent, 10) >= 0) { + preservedLineIndent = parseInt(params.preservedLineIndent, 10) + } else { + throw new TypeError('preservedLineIndent must be a non-negative integer') + } } - try { - return new SemVer(version, options) - } catch (er) { - return null + if (preservedLineIndent > 0) { + preservedLinePrefix = new Array(preservedLineIndent + 1).join(' ') } -} -module.exports = parse + if (params.wrapLineIndent !== undefined) { + if (!isNaN(parseInt(params.wrapLineIndent, 10))) { + wrapLineIndent = parseInt(params.wrapLineIndent, 10) + } else { + throw new TypeError('wrapLineIndent must be an integer') + } + } + if (params.wrapLineIndentBase) { + wrapLineIndentBase = params.wrapLineIndentBase + } + if (wrapLineIndentBase) { + if (wrapLineIndent === undefined) { + throw new TypeError('wrapLineIndent must be specified when wrapLineIndentBase is specified') + } + if (wrapLineIndentBase instanceof RegExp) { + wrapLineIndentPat = wrapLineIndentBase + } else if (typeof wrapLineIndentBase === 'string') { + wrapLineIndentPat = new RegExp(escapeRegExp(wrapLineIndentBase)) + } else { + throw new TypeError('wrapLineIndentBase must be either a RegExp object or a string') + } + } else if (wrapLineIndent > 0) { + wrapLineInitPrefix = new Array(wrapLineIndent + 1).join(' ') + } else if (wrapLineIndent < 0) { + throw new TypeError('wrapLineIndent must be non-negative when a base is not specified') + } -/***/ }), + // NOTE: For the two RegExps `skipPat` and `lineBreakPat` that can be specified + // by the user: + // 1. We require them to be "global", so we have to convert them to global + // if the user specifies a non-global regex. + // 2. We cannot call `split()` on them, because they may or may not contain + // capturing parentheses which affect the output of `split()`. -/***/ 79211: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // Precedence: Regex = Str > Scheme + if (params.skipScheme) { + if (skipSchemeMap[params.skipScheme]) { + skipScheme = params.skipScheme + } else { + throw new TypeError('skipScheme must be one of "' + Object.keys(skipSchemeMap).join('", "') + '"') + } + } + if (params.skip) { + skip = params.skip + } -const SemVer = __webpack_require__(58725) -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch + if (skip) { + if (skip instanceof RegExp) { + skipPat = skip + if (!skipPat.global) { + flags = 'g' + if (skipPat.ignoreCase) { flags += 'i'; } + if (skipPat.multiline) { flags += 'm'; } + skipPat = new RegExp(skipPat.source, flags) + } + } else if (typeof skip === 'string') { + skipPat = new RegExp(escapeRegExp(skip), 'g') + } else { + throw new TypeError('skip must be either a RegExp object or a string') + } + } + if (!skipPat && skipScheme) { + skipPat = skipSchemeMap[skipScheme] + } + // Precedence: + // - for lineBreakPat: Regex > Scheme > Str + // - for lineBreakStr: Str > Scheme > Regex + if (params.lineBreakScheme) { + if (lineBreakSchemeMap[params.lineBreakScheme]) { + lineBreakScheme = params.lineBreakScheme + } else { + throw new TypeError('lineBreakScheme must be one of "' + Object.keys(lineBreakSchemeMap).join('", "') + '"') + } + } + if (params.lineBreak) { + lineBreak = params.lineBreak + } -/***/ }), + if (lineBreakScheme) { + // Supported schemes: 'unix', 'dos', 'mac', 'html', 'xhtml' + item = lineBreakSchemeMap[lineBreakScheme] + if (item) { + lineBreakPat = item[0] + lineBreakStr = item[1] + } + } + if (lineBreak) { + if (lineBreak instanceof Array) { + if (lineBreak.length === 1) { + lineBreak = lineBreak[0] + } else if (lineBreak.length >= 2) { + if (lineBreak[0] instanceof RegExp) { + lineBreakPat = lineBreak[0] + if (typeof lineBreak[1] === 'string') { + lineBreakStr = lineBreak[1] + } + } else if (lineBreak[1] instanceof RegExp) { + lineBreakPat = lineBreak[1] + if (typeof lineBreak[0] === 'string') { + lineBreakStr = lineBreak[0] + } + } else if (typeof lineBreak[0] === 'string' && typeof lineBreak[1] === 'string') { + lineBreakPat = new RegExp(escapeRegExp(lineBreak[0]), 'g') + lineBreakStr = lineBreak[1] + } else { + lineBreak = lineBreak[0] + } + } + } + if (typeof lineBreak === 'string') { + lineBreakStr = lineBreak + if (!lineBreakPat) { + lineBreakPat = new RegExp(escapeRegExp(lineBreak), 'g') + } + } else if (lineBreak instanceof RegExp) { + lineBreakPat = lineBreak + } else if (!(lineBreak instanceof Array)) { + throw new TypeError('lineBreak must be a RegExp object, a string, or an array consisted of a RegExp object and a string') + } + } + // Only assign defaults when `lineBreakPat` is not assigned. + // So if `params.lineBreak` is a RegExp, we don't have a value in `lineBreakStr` + // yet. We will try to get the value from the input string, and if failed, we + // will throw an exception. + if (!lineBreakPat) { + lineBreakPat = /\n/g + lineBreakStr = '\n' + } -/***/ 3827: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // Create `multiLineBreakPat` based on `lineBreakPat`, that matches strings + // consisted of one or more line breaks and zero or more whitespaces. + // Also convert `lineBreakPat` to global if not already so. + flags = 'g' + if (lineBreakPat.ignoreCase) { flags += 'i'; } + if (lineBreakPat.multiline) { flags += 'm'; } + multiLineBreakPat = new RegExp('\\s*(?:' + lineBreakPat.source + ')(?:' + + lineBreakPat.source + '|\\s)*', flags) + if (!lineBreakPat.global) { + lineBreakPat = new RegExp(lineBreakPat.source, flags) + } -const parse = __webpack_require__(84283) -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} -module.exports = prerelease + // Initialize other useful variables. + var re = mode === 'hard' ? /\b/ : /(\S+\s+)/ + var prefix = new Array(start + 1).join(' ') + var wsStrip = (whitespace === 'default' || whitespace === 'collapse'), + wsCollapse = (whitespace === 'collapse'), + wsLine = (whitespace === 'line'), + wsAll = (whitespace === 'all') + var tabPat = /\t/g, + collapsePat = / +/g, + pPat = /^\s+/, + tPat = /\s+$/, + nonWsPat = /\S/, + wsPat = /\s/ + var wrapLen = stop - start + return function (text) { + text = text.toString().replace(tabPat, tabRepl) -/***/ }), + var match + if (!lineBreakStr) { + // Try to get lineBreakStr from `text` + lineBreakPat.lastIndex = 0 + match = lineBreakPat.exec(text) + if (match) { + lineBreakStr = match[0] + } else { + throw new TypeError('Line break string for the output not specified') + } + } -/***/ 34602: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // text -> blocks; each bloc -> segments; each segment -> chunks + var blocks, base = 0 + var mo, arr, b, res + // Split `text` by line breaks. + blocks = [] + multiLineBreakPat.lastIndex = 0 + match = multiLineBreakPat.exec(text) + while(match) { + blocks.push(text.substring(base, match.index)) -const compare = __webpack_require__(2518) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare + if (respectLineBreaks !== 'none') { + arr = [] + b = 0 + lineBreakPat.lastIndex = 0 + mo = lineBreakPat.exec(match[0]) + while(mo) { + arr.push(match[0].substring(b, mo.index)) + b = mo.index + mo[0].length + mo = lineBreakPat.exec(match[0]) + } + arr.push(match[0].substring(b)) + blocks.push({type: 'break', breaks: arr}) + } else { + // Strip line breaks and insert spaces when necessary. + if (wsCollapse) { + res = ' ' + } else { + res = match[0].replace(lineBreakPat, '') + } + blocks.push({type: 'break', remaining: res}) + } + base = match.index + match[0].length + match = multiLineBreakPat.exec(text) + } + blocks.push(text.substring(base)) -/***/ }), + var i, j, k + var segments + if (skipPat) { + segments = [] + for (i = 0; i < blocks.length; i++) { + var bloc = blocks[i] + if (typeof bloc !== 'string') { + // This is an object. + segments.push(bloc) + } else { + base = 0 + skipPat.lastIndex = 0 + match = skipPat.exec(bloc) + while(match) { + segments.push(bloc.substring(base, match.index)) + segments.push({type: 'skip', value: match[0]}) + base = match.index + match[0].length + match = skipPat.exec(bloc) + } + segments.push(bloc.substring(base)) + } + } + } else { + segments = blocks + } -/***/ 77316: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + var chunks = [] + for (i = 0; i < segments.length; i++) { + var segment = segments[i] + if (typeof segment !== 'string') { + // This is an object. + chunks.push(segment) + } else { + if (wsCollapse) { + segment = segment.replace(collapsePat, ' ') + } -const compareBuild = __webpack_require__(11729) -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort + var parts = segment.split(re), + acc = [] + for (j = 0; j < parts.length; j++) { + var x = parts[j] + if (mode === 'hard') { + for (k = 0; k < x.length; k += wrapLen) { + acc.push(x.slice(k, k + wrapLen)) + } + } else { acc.push(x); } + } + chunks = chunks.concat(acc) + } + } -/***/ }), + var curLine = 0, + curLineLength = start + preservedLinePrefix.length, + lines = [ prefix + preservedLinePrefix ], + // Holds the "real length" (excluding trailing whitespaces) of the + // current line if it exceeds `stop`, otherwise 0. + // ONLY USED when `wsAll` is true, in `finishOffCurLine()`. + bulge = 0, + // `cleanLine` is true iff we are at the beginning of an output line. By + // "beginning" we mean it doesn't contain any non-whitespace char yet. + // But its `curLineLength` can be greater than `start`, or even possibly + // be greater than `stop`, if `wsStrip` is false. + // + // Note that a "clean" line can still contain skip strings, in addition + // to whitespaces. + // + // This variable is used to allow us strip preceding whitespaces when + // `wsStrip` is true, or `wsLine` is true and `preservedLine` is false. + cleanLine = true, + // `preservedLine` is true iff we are in a preserved input line. + // + // It's used when `wsLine` is true to (combined with `cleanLine`) decide + // whether a whitespace is at the beginning of a preserved input line and + // should not be stripped. + preservedLine = true, + // The current indent prefix for wrapped lines. + wrapLinePrefix = wrapLineInitPrefix, + remnant -/***/ 40946: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // Always returns '' if `beforeHardBreak` is true. + // + // Assumption: Each call of this function is always followed by a `lines.push()` call. + // + // This function can change the status of `cleanLine`, but we don't modify the value of + // `cleanLine` in this function. It's fine because `cleanLine` will be set to the correct + // value after the `lines.push()` call following this function call. We also don't update + // `curLineLength` when pushing a new line and it's safe for the same reason. + function finishOffCurLine (beforeHardBreak) { + var str = lines[curLine], + idx, ln, rBase -const Range = __webpack_require__(3890) -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} -module.exports = satisfies + if (!wsAll) { + // Strip all trailing whitespaces past `start`. + idx = str.length - 1 + while (idx >= start && str[idx] === ' ') { idx--; } + while (idx >= start && wsPat.test(str[idx])) { idx--; } + idx++ + if (idx !== str.length) { + lines[curLine] = str.substring(0, idx) + } -/***/ }), + if (preservedLine && cleanLine && wsLine && curLineLength > stop) { + // Add the remnants to the next line, just like when `wsAll` is true. + rBase = str.length - (curLineLength - stop) + if (rBase < idx) { + // We didn't reach `stop` when stripping due to a bulge. + rBase = idx + } + } + } else { + // Strip trailing whitespaces exceeding stop. + if (curLineLength > stop) { + bulge = bulge || stop + rBase = str.length - (curLineLength - bulge) + lines[curLine] = str.substring(0, rBase) + } + bulge = 0 + } -/***/ 91707: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // Bug: the current implementation of `wrapLineIndent` is buggy: we are not + // taking the extra space occupied by the additional indentation into account + // when wrapping the line. For example, in "hard" mode, we should hard-wrap + // long words at `wrapLen - wrapLinePrefix.length` instead of `wrapLen` + // and remnants should also be wrapped at `wrapLen - wrapLinePrefix.length`. + if (preservedLine) { + // This is a preserved line, and the next output line isn't a + // preserved line. + preservedLine = false + if (wrapLineIndentPat) { + idx = lines[curLine].substring(start).search(wrapLineIndentPat) + if (idx >= 0 && idx + wrapLineIndent > 0) { + wrapLinePrefix = new Array(idx + wrapLineIndent + 1).join(' ') + } else { + wrapLinePrefix = '' + } + } + } -const compareBuild = __webpack_require__(11729) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort + // Some remnants are left to the next line. + if (rBase) { + while (rBase + wrapLen < str.length) { + if (wsAll) { + ln = str.substring(rBase, rBase + wrapLen) + lines.push(prefix + wrapLinePrefix + ln) + } else { + lines.push(prefix + wrapLinePrefix) + } + rBase += wrapLen + curLine++ + } + if (beforeHardBreak) { + if (wsAll) { + ln = str.substring(rBase) + lines.push(prefix + wrapLinePrefix + ln) + } else { + lines.push(prefix + wrapLinePrefix) + } + curLine++ + } else { + ln = str.substring(rBase) + return wrapLinePrefix + ln + } + } + return '' + } -/***/ }), + for (i = 0; i < chunks.length; i++) { + var chunk = chunks[i] -/***/ 39759: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + if (chunk === '') { continue; } -const parse = __webpack_require__(84283) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid + if (typeof chunk !== 'string') { + if (chunk.type === 'break') { + // This is one or more line breaks. + // Each entry in `breaks` is just zero or more whitespaces. + if (respectLineBreaks !== 'none') { + // Note that if `whitespace` is "collapse", we still need + // to collapse whitespaces in entries of `breaks`. + var breaks = chunk.breaks + var num = breaks.length - 1 + if (respectLineBreaks === 's') { + // This is the most complex scenario. We have to check + // the line breaks one by one. + for (j = 0; j < num; j++) { + if (breaks[j + 1].length < respectNum) { + // This line break should be stripped. + if (wsCollapse) { + breaks[j + 1] = ' ' + } else { + breaks[j + 1] = breaks[j] + breaks[j + 1] + } + } else { + // This line break should be preserved. + // First finish off the current line. + if (wsAll) { + lines[curLine] += breaks[j] + curLineLength += breaks[j].length + } + finishOffCurLine(true) -/***/ }), + lines.push(prefix + preservedLinePrefix) + curLine++ + curLineLength = start + preservedLinePrefix.length -/***/ 49708: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + preservedLine = cleanLine = true + } + } + // We are adding to either the existing line (if no line break + // is qualified for preservance) or a "new" line. + if (!cleanLine || wsAll || (wsLine && preservedLine)) { + if (wsCollapse || (!cleanLine && breaks[num] === '')) { + breaks[num] = ' ' + } + lines[curLine] += breaks[num] + curLineLength += breaks[num].length + } + } else if (respectLineBreaks === 'm' && num < respectNum) { + // These line breaks should be stripped. + if (!cleanLine || wsAll || (wsLine && preservedLine)) { + if (wsCollapse) { + chunk = ' ' + } else { + chunk = breaks.join('') + if (!cleanLine && chunk === '') { + chunk = ' ' + } + } + lines[curLine] += chunk + curLineLength += chunk.length + } + } else { // 'all' || ('m' && num >= respectNum) + // These line breaks should be preserved. + if (wsStrip) { + // Finish off the current line. + finishOffCurLine(true) -// just pre-load all the stuff that index.js lazily exports -const internalRe = __webpack_require__(55736) -module.exports = { - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: __webpack_require__(60371).SEMVER_SPEC_VERSION, - SemVer: __webpack_require__(58725), - compareIdentifiers: __webpack_require__(86723).compareIdentifiers, - rcompareIdentifiers: __webpack_require__(86723).rcompareIdentifiers, - parse: __webpack_require__(84283), - valid: __webpack_require__(39759), - clean: __webpack_require__(95512), - inc: __webpack_require__(85474), - diff: __webpack_require__(52672), - major: __webpack_require__(94702), - minor: __webpack_require__(41039), - patch: __webpack_require__(79211), - prerelease: __webpack_require__(3827), - compare: __webpack_require__(2518), - rcompare: __webpack_require__(34602), - compareLoose: __webpack_require__(40716), - compareBuild: __webpack_require__(11729), - sort: __webpack_require__(91707), - rsort: __webpack_require__(77316), - gt: __webpack_require__(10330), - lt: __webpack_require__(16980), - eq: __webpack_require__(91258), - neq: __webpack_require__(73287), - gte: __webpack_require__(75717), - lte: __webpack_require__(51916), - cmp: __webpack_require__(46541), - coerce: __webpack_require__(72493), - Comparator: __webpack_require__(71418), - Range: __webpack_require__(3890), - satisfies: __webpack_require__(40946), - toComparators: __webpack_require__(3521), - maxSatisfying: __webpack_require__(23538), - minSatisfying: __webpack_require__(64), - minVersion: __webpack_require__(14592), - validRange: __webpack_require__(54162), - outside: __webpack_require__(7833), - gtr: __webpack_require__(1389), - ltr: __webpack_require__(46072), - intersects: __webpack_require__(86512), - simplifyRange: __webpack_require__(42716), - subset: __webpack_require__(44629), -} - - -/***/ }), - -/***/ 60371: -/***/ ((module) => { + for (j = 0; j < num; j++) { + lines.push(prefix + preservedLinePrefix) + curLine++ + } -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' + curLineLength = start + preservedLinePrefix.length + preservedLine = cleanLine = true + } else { + if (wsAll || (preservedLine && cleanLine)) { + lines[curLine] += breaks[0] + curLineLength += breaks[0].length + } -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 + for (j = 0; j < num; j++) { + // Finish off the current line. + finishOffCurLine(true) -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 + lines.push(prefix + preservedLinePrefix + breaks[j + 1]) + curLine++ + curLineLength = start + preservedLinePrefix.length + breaks[j + 1].length -module.exports = { - SEMVER_SPEC_VERSION, - MAX_LENGTH, - MAX_SAFE_INTEGER, - MAX_SAFE_COMPONENT_LENGTH -} + preservedLine = cleanLine = true + } + } + } + } else { + // These line breaks should be stripped. + if (!cleanLine || wsAll || (wsLine && preservedLine)) { + chunk = chunk.remaining + // Bug: If `wsAll` is true, `cleanLine` is false, and `chunk` + // is '', we insert a space to replace the line break. This + // space will be preserved even if we are at the end of an + // output line, which is wrong behavior. However, I'm not + // sure it's worth it to fix this edge case. + if (wsCollapse || (!cleanLine && chunk === '')) { + chunk = ' ' + } + lines[curLine] += chunk + curLineLength += chunk.length + } + } + } else if (chunk.type === 'skip') { + // This is a skip string. + // Assumption: skip strings don't end with whitespaces. + if (curLineLength > stop) { + remnant = finishOffCurLine(false) -/***/ }), + lines.push(prefix + wrapLinePrefix) + curLine++ + curLineLength = start + wrapLinePrefix.length -/***/ 12079: -/***/ ((module) => { - -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} - -module.exports = debug + if (remnant) { + lines[curLine] += remnant + curLineLength += remnant.length + } + cleanLine = true + } + lines[curLine] += chunk.value + } + continue + } -/***/ }), + var chunk2 + while (1) { + chunk2 = undefined + if (curLineLength + chunk.length > stop && + curLineLength + (chunk2 = chunk.replace(tPat, '')).length > stop && + chunk2 !== '' && + curLineLength > start) { + // This line is full, add `chunk` to the next line + remnant = finishOffCurLine(false) -/***/ 86723: -/***/ ((module) => { + lines.push(prefix + wrapLinePrefix) + curLine++ + curLineLength = start + wrapLinePrefix.length -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) + if (remnant) { + lines[curLine] += remnant + curLineLength += remnant.length + cleanLine = true + continue + } - if (anum && bnum) { - a = +a - b = +b + if (wsStrip || (wsLine && !(preservedLine && cleanLine))) { + chunk = chunk.replace(pPat, '') + } + cleanLine = false + } else { + // Add `chunk` to this line + if (cleanLine) { + if (wsStrip || (wsLine && !(preservedLine && cleanLine))) { + chunk = chunk.replace(pPat, '') + if (chunk !== '') { + cleanLine = false + } + } else { + if (nonWsPat.test(chunk)) { + cleanLine = false + } + } + } + } + break + } + if (wsAll && chunk2 && curLineLength + chunk2.length > stop) { + bulge = curLineLength + chunk2.length + } + lines[curLine] += chunk + curLineLength += chunk.length + } + // Finally, finish off the last line. + finishOffCurLine(true) + return lines.join(lineBreakStr) } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 } -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) +linewrap.soft = linewrap -module.exports = { - compareIdentifiers, - rcompareIdentifiers +linewrap.hard = function ( /*start, stop, params*/) { + var args = [].slice.call(arguments) + var last = args.length - 1 + if (typeof args[last] === 'object') { + args[last].mode = 'hard' + } else { + args.push({ mode: 'hard' }) + } + return linewrap.apply(null, args) } +linewrap.wrap = function (text /*, start, stop, params*/) { + var args = [].slice.call(arguments) + args.shift() + return linewrap.apply(null, args)(text) +} -/***/ }), - -/***/ 41318: -/***/ ((module) => { - -// parse out just the options we care about so we always get a consistent -// obj with keys in a consistent order. -const opts = ['includePrerelease', 'loose', 'rtl'] -const parseOptions = options => - !options ? {} - : typeof options !== 'object' ? { loose: true } - : opts.filter(k => options[k]).reduce((options, k) => { - options[k] = true - return options - }, {}) -module.exports = parseOptions /***/ }), -/***/ 55736: -/***/ ((module, exports, __webpack_require__) => { - -const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(60371) -const debug = __webpack_require__(12079) -exports = module.exports = {} +/***/ 18791: +/***/ ((__unused_webpack_module, exports) => { -// The actual regexps go on exports.re -const re = exports.re = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 +"use strict"; -const createToken = (name, value, isGlobal) => { - const index = R++ - debug(index, value) - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) +Object.defineProperty(exports, "__esModule", ({ value: true })); +function newArg(arg) { + return Object.assign({ parse: (i) => i }, arg, { required: Boolean(arg.required) }); } +exports.newArg = newArg; -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) +/***/ }), -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) +/***/ 17195: +/***/ ((__unused_webpack_module, exports) => { -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. +"use strict"; -createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.default = () => { + const cache = {}; + return { + add(name, fn) { + Object.defineProperty(this, name, { + enumerable: true, + get: () => { + cache[name] = cache[name] || fn(); + return cache[name]; + }, + }); + return this; + }, + }; +}; -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) +/***/ }), -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. +/***/ 33925: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. +"use strict"; -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const errors_1 = __webpack_require__(52564); +const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); +var errors_2 = __webpack_require__(52564); +exports.CLIError = errors_2.CLIError; +// eslint-disable-next-line new-cap +const m = deps_1.default() + // eslint-disable-next-line node/no-missing-require + .add('help', () => __webpack_require__(50283)) + // eslint-disable-next-line node/no-missing-require + .add('list', () => __webpack_require__(25119)); +class CLIParseError extends errors_1.CLIError { + constructor(options) { + options.message += '\nSee more help with --help'; + super(options.message); + this.parse = options.parse; + } +} +exports.CLIParseError = CLIParseError; +class InvalidArgsSpecError extends CLIParseError { + constructor({ args, parse }) { + let message = 'Invalid argument spec'; + const namedArgs = args.filter(a => a.name); + if (namedArgs.length > 0) { + const list = m.list.renderList(namedArgs.map(a => [`${a.name} (${a.required ? 'required' : 'optional'})`, a.description])); + message += `:\n${list}`; + } + super({ parse, message }); + this.args = args; + } +} +exports.InvalidArgsSpecError = InvalidArgsSpecError; +class RequiredArgsError extends CLIParseError { + constructor({ args, parse }) { + let message = `Missing ${args.length} required arg${args.length === 1 ? '' : 's'}`; + const namedArgs = args.filter(a => a.name); + if (namedArgs.length > 0) { + const list = m.list.renderList(namedArgs.map(a => [a.name, a.description])); + message += `:\n${list}`; + } + super({ parse, message }); + this.args = args; + } +} +exports.RequiredArgsError = RequiredArgsError; +class RequiredFlagError extends CLIParseError { + constructor({ flag, parse }) { + const usage = m.list.renderList(m.help.flagUsages([flag], { displayRequired: false })); + const message = `Missing required flag:\n${usage}`; + super({ parse, message }); + this.flag = flag; + } +} +exports.RequiredFlagError = RequiredFlagError; +class UnexpectedArgsError extends CLIParseError { + constructor({ parse, args }) { + const message = `Unexpected argument${args.length === 1 ? '' : 's'}: ${args.join(', ')}`; + super({ parse, message }); + this.args = args; + } +} +exports.UnexpectedArgsError = UnexpectedArgsError; +class FlagInvalidOptionError extends CLIParseError { + constructor(flag, input) { + const message = `Expected --${flag.name}=${input} to be one of: ${flag.options.join(', ')}`; + super({ parse: {}, message }); + } +} +exports.FlagInvalidOptionError = FlagInvalidOptionError; +class ArgInvalidOptionError extends CLIParseError { + constructor(arg, input) { + const message = `Expected ${input} to be one of: ${arg.options.join(', ')}`; + super({ parse: {}, message }); + } +} +exports.ArgInvalidOptionError = ArgInvalidOptionError; -createToken('FULL', `^${src[t.FULLPLAIN]}$`) -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) +/***/ }), -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) +/***/ 40331: +/***/ ((__unused_webpack_module, exports) => { -createToken('GTLT', '((?:<|>)?=?)') +"use strict"; -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) +// tslint:disable interface-over-type-literal +Object.defineProperty(exports, "__esModule", ({ value: true })); +function build(defaults) { + return (options = {}) => { + return Object.assign({ parse: (i, _) => i }, defaults, options, { input: [], multiple: Boolean(options.multiple), type: 'option' }); + }; +} +exports.build = build; +function boolean(options = {}) { + return Object.assign({ parse: (b, _) => b }, options, { allowNo: Boolean(options.allowNo), type: 'boolean' }); +} +exports.boolean = boolean; +exports.integer = build({ + parse: input => { + if (!/^-?\d+$/.test(input)) + throw new Error(`Expected an integer but received: ${input}`); + return parseInt(input, 10); + }, +}); +function option(options) { + return build(options)(); +} +exports.option = option; +const stringFlag = build({}); +exports.string = stringFlag; +exports.defaultFlags = { + color: boolean({ allowNo: true }), +}; -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]}$`) +/***/ 50283: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -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) +"use strict"; -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); +// eslint-disable-next-line new-cap +const m = deps_1.default() + .add('chalk', () => __webpack_require__(38707)) + // eslint-disable-next-line node/no-missing-require + .add('util', () => __webpack_require__(78120)); +function flagUsage(flag, options = {}) { + const label = []; + if (flag.helpLabel) { + label.push(flag.helpLabel); + } + else { + if (flag.char) + label.push(`-${flag.char}`); + if (flag.name) + label.push(` --${flag.name}`); + } + const usage = flag.type === 'option' ? ` ${flag.name.toUpperCase()}` : ''; + let description = flag.description || ''; + if (options.displayRequired && flag.required) + description = `(required) ${description}`; + description = description ? m.chalk.dim(description) : undefined; + return [` ${label.join(',').trim()}${usage}`, description]; +} +exports.flagUsage = flagUsage; +function flagUsages(flags, options = {}) { + if (flags.length === 0) + return []; + const { sortBy } = m.util; + return sortBy(flags, f => [f.char ? -1 : 1, f.char, f.name]) + .map(f => flagUsage(f, options)); +} +exports.flagUsages = flagUsages; -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) +/***/ }), -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') +/***/ 41150: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' +"use strict"; -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) +// tslint:disable interface-over-type-literal +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const args = tslib_1.__importStar(__webpack_require__(18791)); +exports.args = args; +const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); +const flags = tslib_1.__importStar(__webpack_require__(40331)); +exports.flags = flags; +const parse_1 = __webpack_require__(72546); +var help_1 = __webpack_require__(50283); +exports.flagUsages = help_1.flagUsages; +// eslint-disable-next-line new-cap +const m = deps_1.default() + // eslint-disable-next-line node/no-missing-require + .add('validate', () => __webpack_require__(67385)/* .validate */ .G); +function parse(argv, options) { + const input = { + argv, + context: options.context, + args: (options.args || []).map((a) => args.newArg(a)), + '--': options['--'], + flags: Object.assign({ color: flags.defaultFlags.color }, ((options.flags || {}))), + strict: options.strict !== false, + }; + const parser = new parse_1.Parser(input); + const output = parser.parse(); + m.validate({ input, output }); + return output; +} +exports.parse = parse; -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' +/***/ }), -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) +/***/ 25119: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) +"use strict"; -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') +Object.defineProperty(exports, "__esModule", ({ value: true })); +const screen_1 = __webpack_require__(85767); +const util_1 = __webpack_require__(78120); +function linewrap(length, s) { + const lw = __webpack_require__(49094); + return lw(length, screen_1.stdtermwidth, { + skipScheme: 'ansi-color', + })(s).trim(); +} +function renderList(items) { + if (items.length === 0) { + return ''; + } + const maxLength = (util_1.maxBy(items, i => i[0].length))[0].length; + const lines = items.map(i => { + let left = i[0]; + let right = i[1]; + if (!right) { + return left; + } + left = left.padEnd(maxLength); + right = linewrap(maxLength + 2, right); + return `${left} ${right}`; + }); + return lines.join('\n'); +} +exports.renderList = renderList; /***/ }), -/***/ 1389: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// Determine if version is greater than all the versions possible in the range. -const outside = __webpack_require__(7833) -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr - - -/***/ }), +/***/ 72546: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/***/ 86512: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +"use strict"; -const Range = __webpack_require__(3890) -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) +// tslint:disable interface-over-type-literal +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); +// eslint-disable-next-line new-cap +const m = deps_1.default() + // eslint-disable-next-line node/no-missing-require + .add('errors', () => __webpack_require__(33925)) + // eslint-disable-next-line node/no-missing-require + .add('util', () => __webpack_require__(78120)); +let debug; +try { + // eslint-disable-next-line no-negated-condition + if (process.env.CLI_FLAGS_DEBUG !== '1') + debug = () => { }; + else + // eslint-disable-next-line node/no-extraneous-require + debug = __webpack_require__(38237)('@oclif/parser'); } -module.exports = intersects - - -/***/ }), - -/***/ 46072: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const outside = __webpack_require__(7833) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr +catch (_a) { + debug = () => { }; +} +class Parser { + constructor(input) { + this.input = input; + this.raw = []; + const { pickBy } = m.util; + this.context = input.context || {}; + this.argv = input.argv.slice(0); + this._setNames(); + this.booleanFlags = pickBy(input.flags, f => f.type === 'boolean'); + this.metaData = {}; + } + parse() { + this._debugInput(); + const findLongFlag = (arg) => { + const name = arg.slice(2); + if (this.input.flags[name]) { + return name; + } + if (arg.startsWith('--no-')) { + const flag = this.booleanFlags[arg.slice(5)]; + if (flag && flag.allowNo) + return flag.name; + } + }; + const findShortFlag = (arg) => { + return Object.keys(this.input.flags).find(k => this.input.flags[k].char === arg[1]); + }; + const parseFlag = (arg) => { + const long = arg.startsWith('--'); + const name = long ? findLongFlag(arg) : findShortFlag(arg); + if (!name) { + const i = arg.indexOf('='); + if (i !== -1) { + const sliced = arg.slice(i + 1); + this.argv.unshift(sliced); + const equalsParsed = parseFlag(arg.slice(0, i)); + if (!equalsParsed) { + this.argv.shift(); + } + return equalsParsed; + } + return false; + } + const flag = this.input.flags[name]; + if (flag.type === 'option') { + this.currentFlag = flag; + let input; + if (long || arg.length < 3) { + input = this.argv.shift(); + } + else { + input = arg.slice(arg[2] === '=' ? 3 : 2); + } + if (typeof input !== 'string') { + throw new m.errors.CLIError(`Flag --${name} expects a value`); + } + this.raw.push({ type: 'flag', flag: flag.name, input }); + } + else { + this.raw.push({ type: 'flag', flag: flag.name, input: arg }); + // push the rest of the short characters back on the stack + if (!long && arg.length > 2) { + this.argv.unshift(`-${arg.slice(2)}`); + } + } + return true; + }; + let parsingFlags = true; + while (this.argv.length) { + const input = this.argv.shift(); + if (parsingFlags && input.startsWith('-') && input !== '-') { + // attempt to parse as arg + if (this.input['--'] !== false && input === '--') { + parsingFlags = false; + continue; + } + if (parseFlag(input)) { + continue; + } + // not actually a flag if it reaches here so parse as an arg + } + if (parsingFlags && this.currentFlag && this.currentFlag.multiple) { + this.raw.push({ type: 'flag', flag: this.currentFlag.name, input }); + continue; + } + // not a flag, parse as arg + const arg = this.input.args[this._argTokens.length]; + if (arg) + arg.input = input; + this.raw.push({ type: 'arg', input }); + } + const argv = this._argv(); + const args = this._args(argv); + const flags = this._flags(); + this._debugOutput(argv, args, flags); + return { + args, + argv, + flags, + raw: this.raw, + metadata: this.metaData, + }; + } + _args(argv) { + const args = {}; + for (let i = 0; i < this.input.args.length; i++) { + const arg = this.input.args[i]; + args[arg.name] = argv[i]; + } + return args; + } + _flags() { + const flags = {}; + this.metaData.flags = {}; + for (const token of this._flagTokens) { + const flag = this.input.flags[token.flag]; + if (!flag) + throw new m.errors.CLIError(`Unexpected flag ${token.flag}`); + if (flag.type === 'boolean') { + if (token.input === `--no-${flag.name}`) { + flags[token.flag] = false; + } + else { + flags[token.flag] = true; + } + flags[token.flag] = flag.parse(flags[token.flag], this.context); + } + else { + const input = token.input; + if (flag.options && !flag.options.includes(input)) { + throw new m.errors.FlagInvalidOptionError(flag, input); + } + const value = flag.parse ? flag.parse(input, this.context) : input; + if (flag.multiple) { + flags[token.flag] = flags[token.flag] || []; + flags[token.flag].push(value); + } + else { + flags[token.flag] = value; + } + } + } + for (const k of Object.keys(this.input.flags)) { + const flag = this.input.flags[k]; + if (flags[k]) + continue; + if (flag.type === 'option' && flag.env) { + const input = process.env[flag.env]; + if (input) + flags[k] = flag.parse(input, this.context); + } + if (!(k in flags) && flag.default !== undefined) { + this.metaData.flags[k] = { setFromDefault: true }; + if (typeof flag.default === 'function') { + flags[k] = flag.default(Object.assign({ options: flag, flags }, this.context)); + } + else { + flags[k] = flag.default; + } + } + } + return flags; + } + _argv() { + const args = []; + const tokens = this._argTokens; + for (let i = 0; i < Math.max(this.input.args.length, tokens.length); i++) { + const token = tokens[i]; + const arg = this.input.args[i]; + if (token) { + if (arg) { + if (arg.options && !arg.options.includes(token.input)) { + throw new m.errors.ArgInvalidOptionError(arg, token.input); + } + args[i] = arg.parse(token.input); + } + else { + args[i] = token.input; + } + } + else if ('default' in arg) { + if (typeof arg.default === 'function') { + args[i] = arg.default(); + } + else { + args[i] = arg.default; + } + } + } + return args; + } + _debugOutput(args, flags, argv) { + if (argv.length > 0) { + debug('argv: %o', argv); + } + if (Object.keys(args).length > 0) { + debug('args: %o', args); + } + if (Object.keys(flags).length > 0) { + debug('flags: %o', flags); + } + } + _debugInput() { + debug('input: %s', this.argv.join(' ')); + if (this.input.args.length > 0) { + debug('available args: %s', this.input.args.map(a => a.name).join(' ')); + } + if (Object.keys(this.input.flags).length === 0) + return; + debug('available flags: %s', Object.keys(this.input.flags) + .map(f => `--${f}`) + .join(' ')); + } + get _argTokens() { + return this.raw.filter(o => o.type === 'arg'); + } + get _flagTokens() { + return this.raw.filter(o => o.type === 'flag'); + } + _setNames() { + for (const k of Object.keys(this.input.flags)) { + this.input.flags[k].name = k; + } + } +} +exports.Parser = Parser; /***/ }), -/***/ 23538: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 85767: +/***/ ((__unused_webpack_module, exports) => { -const SemVer = __webpack_require__(58725) -const Range = __webpack_require__(3890) +"use strict"; -const 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)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +function termwidth(stream) { + if (!stream.isTTY) { + return 80; } - }) - return max + const width = stream.getWindowSize()[0]; + if (width < 1) { + return 80; + } + if (width < 40) { + return 40; + } + return width; } -module.exports = maxSatisfying +const columns = global.columns; +exports.stdtermwidth = columns || termwidth(process.stdout); +exports.errtermwidth = columns || termwidth(process.stderr); /***/ }), -/***/ 64: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 78120: +/***/ ((__unused_webpack_module, exports) => { -const SemVer = __webpack_require__(58725) -const Range = __webpack_require__(3890) -const 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)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function pickBy(obj, fn) { + return Object.entries(obj) + .reduce((o, [k, v]) => { + if (fn(v)) + o[k] = v; + return o; + }, {}); +} +exports.pickBy = pickBy; +function maxBy(arr, fn) { + let max; + for (const cur of arr) { + const i = fn(cur); + if (!max || i > max.i) { + max = { i, element: cur }; + } } - }) - return min + return max && max.element; } -module.exports = minSatisfying +exports.maxBy = maxBy; +function sortBy(arr, fn) { + // function castType(t: SortTypes | SortTypes[]): string | number | SortTypes[] { + // if (t === undefined) return 0 + // if (t === false) return 1 + // if (t === true) return -1 + // return t + // } + function compare(a, b) { + a = a === undefined ? 0 : a; + b = b === undefined ? 0 : b; + if (Array.isArray(a) && Array.isArray(b)) { + if (a.length === 0 && b.length === 0) + return 0; + const diff = compare(a[0], b[0]); + if (diff !== 0) + return diff; + return compare(a.slice(1), b.slice(1)); + } + if (a < b) + return -1; + if (a > b) + return 1; + return 0; + } + return arr.sort((a, b) => compare(fn(a), fn(b))); +} +exports.sortBy = sortBy; /***/ }), -/***/ 14592: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(58725) -const Range = __webpack_require__(3890) -const gt = __webpack_require__(10330) - -const 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) => { - // Clone to avoid manipulating the comparator's semver object. - 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() - /* fallthrough */ - case '': - case '>=': - if (!setMin || gt(compver, setMin)) { - setMin = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`) - } - }) - if (setMin && (!minver || gt(minver, setMin))) - minver = setMin - } +/***/ 67385: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - if (minver && range.test(minver)) { - return minver - } +"use strict"; +var __webpack_unused_export__; - return null +__webpack_unused_export__ = ({ value: true }); +const errors_1 = __webpack_require__(52564); +const errors_2 = __webpack_require__(33925); +function validate(parse) { + function validateArgs() { + const maxArgs = parse.input.args.length; + if (parse.input.strict && parse.output.argv.length > maxArgs) { + const extras = parse.output.argv.slice(maxArgs); + throw new errors_2.UnexpectedArgsError({ parse, args: extras }); + } + const missingRequiredArgs = []; + let hasOptional = false; + parse.input.args.forEach((arg, index) => { + if (!arg.required) { + hasOptional = true; + } + else if (hasOptional) { // (required arg) check whether an optional has occured before + // optionals should follow required, not before + throw new errors_2.InvalidArgsSpecError({ parse, args: parse.input.args }); + } + if (arg.required) { + if (!parse.output.argv[index]) { + missingRequiredArgs.push(arg); + } + } + }); + if (missingRequiredArgs.length > 0) { + throw new errors_2.RequiredArgsError({ parse, args: missingRequiredArgs }); + } + } + function validateFlags() { + for (const [name, flag] of Object.entries(parse.input.flags)) { + if (parse.output.flags[name] !== undefined) { + for (const also of flag.dependsOn || []) { + if (!parse.output.flags[also]) { + throw new errors_1.CLIError(`--${also}= must also be provided when using --${name}=`); + } + } + for (const also of flag.exclusive || []) { + // do not enforce exclusivity for flags that were defaulted + if (parse.output.metadata.flags[also] && parse.output.metadata.flags[also].setFromDefault) + continue; + if (parse.output.metadata.flags[name] && parse.output.metadata.flags[name].setFromDefault) + continue; + if (parse.output.flags[also]) { + throw new errors_1.CLIError(`--${also}= cannot also be provided when using --${name}=`); + } + } + } + else if (flag.required) + throw new errors_2.RequiredFlagError({ parse, flag }); + } + } + validateArgs(); + validateFlags(); } -module.exports = minVersion +exports.G = validate; /***/ }), -/***/ 7833: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(58725) -const Comparator = __webpack_require__(71418) -const {ANY} = Comparator -const Range = __webpack_require__(3890) -const satisfies = __webpack_require__(40946) -const gt = __webpack_require__(10330) -const lt = __webpack_require__(16980) -const lte = __webpack_require__(51916) -const gte = __webpack_require__(75717) - -const outside = (version, range, hilo, options) => { - version = new SemVer(version, options) - range = new Range(range, options) +/***/ 33770: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - 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 ">"') - } +"use strict"; - // If it satisfies the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - 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 the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false +Object.defineProperty(exports, "__esModule", ({ value: true })); +const chalk = __webpack_require__(94294); +const indent = __webpack_require__(98043); +const stripAnsi = __webpack_require__(45591); +const list_1 = __webpack_require__(99847); +const util_1 = __webpack_require__(89977); +const { underline, bold, } = chalk; +let { dim, } = chalk; +if (process.env.ConEmuANSI === 'ON') { + dim = chalk.gray; +} +const wrap = __webpack_require__(57915); +class CommandHelp { + constructor(command, config, opts) { + this.command = command; + this.config = config; + this.opts = opts; + this.render = util_1.template(this); } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false + generate() { + const cmd = this.command; + const flags = util_1.sortBy(Object.entries(cmd.flags || {}) + .filter(([, v]) => !v.hidden) + .map(([k, v]) => { + v.name = k; + return v; + }), f => [!f.char, f.char, f.name]); + const args = (cmd.args || []).filter(a => !a.hidden); + let output = util_1.compact([ + this.usage(flags), + this.args(args), + this.flags(flags), + this.description(), + this.aliases(cmd.aliases), + this.examples(cmd.examples || cmd.example), + ]).join('\n\n'); + if (this.opts.stripAnsi) + output = stripAnsi(output); + return output; } - } - return true -} - -module.exports = outside - - -/***/ }), - -/***/ 42716: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = __webpack_require__(40946) -const compare = __webpack_require__(2518) -module.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 + usage(flags) { + const usage = this.command.usage; + const body = (usage ? util_1.castArray(usage) : [this.defaultUsage(flags)]) + .map(u => `$ ${this.config.bin} ${u}`.trim()) + .join('\n'); + return [ + bold('USAGE'), + indent(wrap(this.render(body), this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); } - } - if (min) - set.push([min, null]) - - const ranges = [] - for (const [min, max] of set) { - if (min === max) - ranges.push(min) - else if (!max && min === v[0]) - ranges.push('*') - else if (!max) - ranges.push(`>=${min}`) - else if (min === v[0]) - ranges.push(`<=${max}`) - else - ranges.push(`${min} - ${max}`) - } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range -} - - -/***/ }), - -/***/ 44629: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(3890) -const Comparator = __webpack_require__(71418) -const { ANY } = Comparator -const satisfies = __webpack_require__(40946) -const compare = __webpack_require__(2518) - -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a null set, OR -// - Every simple range `r1, r2, ...` which is not a null set is a subset of -// some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else if in prerelease mode, return false -// - else replace c with `[>=0.0.0]` -// - If C is only the ANY comparator -// - if in prerelease mode, return true -// - else replace C with `[>=0.0.0]` -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If any C is a = range, and GT or LT are set, return false -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT.semver is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the GT.semver tuple, return false -// - If LT -// - If LT.semver is greater than any < or <= comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the LT.semver tuple, return false -// - Else return true - -const 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 + defaultUsage(_) { + return util_1.compact([ + this.command.id, + this.command.args.filter(a => !a.hidden).map(a => this.arg(a)).join(' '), + ]).join(' '); } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) - return false - } - return true -} - -const 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 - } - - // will iterate one or zero times - 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 + description() { + const cmd = this.command; + const description = cmd.description && this.render(cmd.description).split('\n').slice(1).join('\n'); + if (!description) + return; + return [ + bold('DESCRIPTION'), + indent(wrap(description.trim(), this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); } - - return true - } - - let higher, lower - let hasDomLT, hasDomGT - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - 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 + aliases(aliases) { + if (!aliases || aliases.length === 0) + return; + const body = aliases.map(a => ['$', this.config.bin, a].join(' ')).join('\n'); + return [ + bold('ALIASES'), + indent(wrap(body, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); } - 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 + examples(examples) { + if (!examples || examples.length === 0) + return; + const body = util_1.castArray(examples).map(a => this.render(a)).join('\n'); + return [ + bold('EXAMPLE' + (examples.length > 1 ? 'S' : '')), + indent(wrap(body, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); + } + args(args) { + if (args.filter(a => a.description).length === 0) + return; + const body = list_1.renderList(args.map(a => { + const name = a.name.toUpperCase(); + let description = a.description || ''; + if (a.default) + description = `[default: ${a.default}] ${description}`; + if (a.options) + description = `(${a.options.join('|')}) ${description}`; + return [name, description ? dim(description) : undefined]; + }), { stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2 }); + return [ + bold('ARGUMENTS'), + indent(body, 2), + ].join('\n'); + } + arg(arg) { + const name = arg.name.toUpperCase(); + if (arg.required) + return `${name}`; + return `[${name}]`; + } + flags(flags) { + if (flags.length === 0) + return; + const body = list_1.renderList(flags.map(flag => { + let left = flag.helpLabel; + if (!left) { + const label = []; + if (flag.char) + label.push(`-${flag.char[0]}`); + if (flag.name) { + if (flag.type === 'boolean' && flag.allowNo) { + label.push(`--[no-]${flag.name.trim()}`); + } + else { + label.push(`--${flag.name.trim()}`); + } + } + left = label.join(', '); + } + if (flag.type === 'option') { + let value = flag.helpValue || flag.name; + if (!flag.helpValue && flag.options) { + value = flag.options.join('|'); + } + if (!value.includes('|')) + value = underline(value); + left += `=${value}`; + } + let right = flag.description || ''; + if (flag.type === 'option' && flag.default) { + right = `[default: ${flag.default}] ${right}`; + } + if (flag.required) + right = `(required) ${right}`; + return [left, dim(right.trim())]; + }), { stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2 }); + return [ + bold('OPTIONS'), + indent(body, 2), + ].join('\n'); } - if (!c.operator && (lt || gt) && gtltComp !== 0) - return false - } - - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) - return false - - if (lt && hasDomGT && !gt && gtltComp !== 0) - return false - - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) - return false - - return true -} - -// >=1.2.3 is lower than >1.2.3 -const 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 -} - -// <=1.2.3 is higher than <1.2.3 -const 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 -} - -module.exports = subset - - -/***/ }), - -/***/ 3521: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(3890) - -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) - -module.exports = toComparators - - -/***/ }), - -/***/ 54162: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(3890) -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } } -module.exports = validRange +exports.default = CommandHelp; /***/ }), -/***/ 24499: +/***/ 46765: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const util_1 = __webpack_require__(54103); -var Command; -(function (Command) { - // eslint-disable-next-line no-inner-declarations - function toCached(c, plugin) { - return { - id: c.id, - description: c.description, - usage: c.usage, - pluginName: plugin && plugin.name, - pluginType: plugin && plugin.type, - hidden: c.hidden, - aliases: c.aliases || [], - examples: c.examples || c.example, - flags: util_1.mapValues(c.flags || {}, (flag, name) => { - if (flag.type === 'boolean') { - return { - name, - type: flag.type, - char: flag.char, - description: flag.description, - hidden: flag.hidden, - required: flag.required, - helpLabel: flag.helpLabel, - allowNo: flag.allowNo, - }; - } - return { - name, - type: flag.type, - char: flag.char, - description: flag.description, - hidden: flag.hidden, - required: flag.required, - helpLabel: flag.helpLabel, - helpValue: flag.helpValue, - options: flag.options, - default: typeof flag.default === 'function' ? flag.default({ options: {}, flags: {} }) : flag.default, - }; - }), - args: c.args ? c.args.map(a => ({ - name: a.name, - description: a.description, - required: a.required, - options: a.options, - default: typeof a.default === 'function' ? a.default({}) : a.default, - hidden: a.hidden, - })) : [], - }; - } - Command.toCached = toCached; -})(Command = exports.Command || (exports.Command = {})); - - -/***/ }), - -/***/ 53969: -/***/ ((module, exports, __webpack_require__) => { - -"use strict"; -/* module decorator */ module = __webpack_require__.nmd(module); - Object.defineProperty(exports, "__esModule", ({ value: true })); const errors_1 = __webpack_require__(52564); -const os = __webpack_require__(12087); -const path = __webpack_require__(85622); -const url_1 = __webpack_require__(78835); -const util_1 = __webpack_require__(31669); -const debug_1 = __webpack_require__(40673); -const Plugin = __webpack_require__(25082); -const ts_node_1 = __webpack_require__(39584); -const util_2 = __webpack_require__(54103); -// eslint-disable-next-line new-cap -const debug = debug_1.default(); -const _pjson = __webpack_require__(63309); -function channelFromVersion(version) { - const m = version.match(/[^-]+(?:-([^.]+))?/); - return (m && m[1]) || 'stable'; -} -function hasManifest(p) { - try { - require(p); - return true; +const chalk = __webpack_require__(94294); +const indent = __webpack_require__(98043); +const stripAnsi = __webpack_require__(45591); +const command_1 = __webpack_require__(33770); +const list_1 = __webpack_require__(99847); +const root_1 = __webpack_require__(2178); +const screen_1 = __webpack_require__(60789); +const util_1 = __webpack_require__(89977); +const util_2 = __webpack_require__(89977); +exports.getHelpClass = util_2.getHelpClass; +const wrap = __webpack_require__(57915); +const { bold, } = chalk; +const ROOT_INDEX_CMD_ID = ''; +function getHelpSubject(args) { + for (const arg of args) { + if (arg === '--') + return; + if (arg === 'help' || arg === '--help' || arg === '-h') + continue; + if (arg.startsWith('-')) + return; + return arg; } - catch (_a) { - return false; +} +class HelpBase { + constructor(config, opts = {}) { + this.config = config; + this.opts = Object.assign({ maxWidth: screen_1.stdtermwidth }, opts); } } -const WSL = __webpack_require__(52559); -class Config { - // eslint-disable-next-line no-useless-constructor - constructor(options) { - this.options = options; - this._base = `${_pjson.name}@${_pjson.version}`; - this.debug = 0; - this.plugins = []; - this.warned = false; +exports.HelpBase = HelpBase; +class Help extends HelpBase { + constructor(config, opts = {}) { + super(config, opts); + this.render = util_1.template(this); } - // eslint-disable-next-line complexity - async load() { - const plugin = new Plugin.Plugin({ root: this.options.root }); - await plugin.load(); - this.plugins.push(plugin); - this.root = plugin.root; - this.pjson = plugin.pjson; - this.name = this.pjson.name; - this.version = this.options.version || this.pjson.version || '0.0.0'; - this.channel = this.options.channel || channelFromVersion(this.version); - this.valid = plugin.valid; - this.arch = (os.arch() === 'ia32' ? 'x86' : os.arch()); - this.platform = WSL ? 'wsl' : os.platform(); - this.windows = this.platform === 'win32'; - this.bin = this.pjson.oclif.bin || this.name; - this.dirname = this.pjson.oclif.dirname || this.name; - if (this.platform === 'win32') - this.dirname = this.dirname.replace('/', '\\'); - this.userAgent = `${this.name}/${this.version} ${this.platform}-${this.arch} node-${process.version}`; - this.shell = this._shell(); - this.debug = this._debug(); - this.home = process.env.HOME || (this.windows && this.windowsHome()) || os.homedir() || os.tmpdir(); - this.cacheDir = this.scopedEnvVar('CACHE_DIR') || this.macosCacheDir() || this.dir('cache'); - this.configDir = this.scopedEnvVar('CONFIG_DIR') || this.dir('config'); - this.dataDir = this.scopedEnvVar('DATA_DIR') || this.dir('data'); - this.errlog = path.join(this.cacheDir, 'error.log'); - this.binPath = this.scopedEnvVar('BINPATH'); - this.npmRegistry = this.scopedEnvVar('NPM_REGISTRY') || this.pjson.oclif.npmRegistry; - this.pjson.oclif.update = this.pjson.oclif.update || {}; - this.pjson.oclif.update.node = this.pjson.oclif.update.node || {}; - const s3 = this.pjson.oclif.update.s3 || {}; - this.pjson.oclif.update.s3 = s3; - s3.bucket = this.scopedEnvVar('S3_BUCKET') || s3.bucket; - if (s3.bucket && !s3.host) - s3.host = `https://${s3.bucket}.s3.amazonaws.com`; - s3.templates = Object.assign(Object.assign({}, s3.templates), { target: Object.assign({ baseDir: '<%- bin %>', unversioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>", versioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>", manifest: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>" }, s3.templates && s3.templates.target), vanilla: Object.assign({ unversioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %><%- ext %>", versioned: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %><%- ext %>", baseDir: '<%- bin %>', manifest: "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %>version" }, s3.templates && s3.templates.vanilla) }); - await this.loadUserPlugins(); - await this.loadDevPlugins(); - await this.loadCorePlugins(); - debug('config done'); + /* + * _topics is to work around Config.topics mistakenly including commands that do + * not have children, as well as topics. A topic has children, either commands or other topics. When + * this is fixed upstream config.topics should return *only* topics with children, + * and this can be removed. + */ + get _topics() { + // since this.config.topics is a getter that does non-trivial work, cache it outside the filter loop for + // performance benefits in the presence of large numbers of topics + const topics = this.config.topics; + return topics.filter((topic) => { + // it is assumed a topic has a child if it has children + const hasChild = topics.some(subTopic => subTopic.name.includes(`${topic.name}:`)); + return hasChild; + }); } - async loadCorePlugins() { - if (this.pjson.oclif.plugins) { - await this.loadPlugins(this.root, 'core', this.pjson.oclif.plugins); - } + get sortedCommands() { + let commands = this.config.commands; + commands = commands.filter(c => this.opts.all || !c.hidden); + commands = util_1.sortBy(commands, c => c.id); + commands = util_1.uniqBy(commands, c => c.id); + return commands; } - async loadDevPlugins() { - if (this.options.devPlugins !== false) { - // do not load oclif.devPlugins in production - if (hasManifest(path.join(this.root, 'oclif.manifest.json'))) - return; - try { - const devPlugins = this.pjson.oclif.devPlugins; - if (devPlugins) - await this.loadPlugins(this.root, 'dev', devPlugins); - } - catch (error) { - process.emitWarning(error); - } + get sortedTopics() { + let topics = this._topics; + topics = topics.filter(t => this.opts.all || !t.hidden); + topics = util_1.sortBy(topics, t => t.name); + topics = util_1.uniqBy(topics, t => t.name); + return topics; + } + showHelp(argv) { + const subject = getHelpSubject(argv); + if (!subject) { + const rootCmd = this.config.findCommand(ROOT_INDEX_CMD_ID); + if (rootCmd) + this.showCommandHelp(rootCmd); + this.showRootHelp(); + return; + } + const command = this.config.findCommand(subject); + if (command) { + this.showCommandHelp(command); + return; + } + const topic = this.config.findTopic(subject); + if (topic) { + this.showTopicHelp(topic); + return; } + errors_1.error(`command ${subject} not found`); } - async loadUserPlugins() { - if (this.options.userPlugins !== false) { - try { - const userPJSONPath = path.join(this.dataDir, 'package.json'); - debug('reading user plugins pjson %s', userPJSONPath); - const pjson = await util_2.loadJSON(userPJSONPath); - this.userPJSON = pjson; - if (!pjson.oclif) - pjson.oclif = { schema: 1 }; - if (!pjson.oclif.plugins) - pjson.oclif.plugins = []; - await this.loadPlugins(userPJSONPath, 'user', pjson.oclif.plugins.filter((p) => p.type === 'user')); - await this.loadPlugins(userPJSONPath, 'link', pjson.oclif.plugins.filter((p) => p.type === 'link')); - } - catch (error) { - if (error.code !== 'ENOENT') - process.emitWarning(error); - } + showCommandHelp(command) { + const name = command.id; + const depth = name.split(':').length; + const subTopics = this.sortedTopics.filter(t => t.name.startsWith(name + ':') && t.name.split(':').length === depth + 1); + const subCommands = this.sortedCommands.filter(c => c.id.startsWith(name + ':') && c.id.split(':').length === depth + 1); + const title = command.description && this.render(command.description).split('\n')[0]; + if (title) + console.log(title + '\n'); + console.log(this.formatCommand(command)); + console.log(''); + if (subTopics.length > 0) { + console.log(this.formatTopics(subTopics)); + console.log(''); + } + if (subCommands.length > 0) { + console.log(this.formatCommands(subCommands)); + console.log(''); } } - async runHook(event, opts) { - debug('start %s hook', event); - const promises = this.plugins.map(p => { - const debug = __webpack_require__(38237)([this.bin, p.name, 'hooks', event].join(':')); - const context = { - config: this, - debug, - exit(code = 0) { - errors_1.exit(code); - }, - log(message, ...args) { - process.stdout.write(util_1.format(message, ...args) + '\n'); - }, - error(message, options = {}) { - errors_1.error(message, options); - }, - warn(message) { - errors_1.warn(message); - }, - }; - return Promise.all((p.hooks[event] || []) - .map(async (hook) => { - try { - const f = ts_node_1.tsPath(p.root, hook); - debug('start', f); - const search = (m) => { - if (typeof m === 'function') - return m; - if (m.default && typeof m.default === 'function') - return m.default; - return Object.values(m).find((m) => typeof m === 'function'); - }; - await search(require(f)).call(context, Object.assign(Object.assign({}, opts), { config: this })); - debug('done'); - } - catch (error) { - if (error && error.oclif && error.oclif.exit !== undefined) - throw error; - this.warn(error, `runHook ${event}`); - } - })); - }); - await Promise.all(promises); - debug('%s hook done', event); + showRootHelp() { + let rootTopics = this.sortedTopics; + let rootCommands = this.sortedCommands; + console.log(this.formatRoot()); + console.log(''); + if (!this.opts.all) { + rootTopics = rootTopics.filter(t => !t.name.includes(':')); + rootCommands = rootCommands.filter(c => !c.id.includes(':')); + } + if (rootTopics.length > 0) { + console.log(this.formatTopics(rootTopics)); + console.log(''); + } + if (rootCommands.length > 0) { + rootCommands = rootCommands.filter(c => c.id); + console.log(this.formatCommands(rootCommands)); + console.log(''); + } } - async runCommand(id, argv = []) { - debug('runCommand %s %o', id, argv); - const c = this.findCommand(id); - if (!c) { - await this.runHook('command_not_found', { id }); - throw new errors_1.CLIError(`command ${id} not found`); + showTopicHelp(topic) { + const name = topic.name; + const depth = name.split(':').length; + const subTopics = this.sortedTopics.filter(t => t.name.startsWith(name + ':') && t.name.split(':').length === depth + 1); + const commands = this.sortedCommands.filter(c => c.id.startsWith(name + ':') && c.id.split(':').length === depth + 1); + console.log(this.formatTopic(topic)); + if (subTopics.length > 0) { + console.log(this.formatTopics(subTopics)); + console.log(''); + } + if (commands.length > 0) { + console.log(this.formatCommands(commands)); + console.log(''); } - const command = c.load(); - await this.runHook('prerun', { Command: command, argv }); - const result = await command.run(argv, this); - await this.runHook('postrun', { Command: command, result: result, argv }); } - scopedEnvVar(k) { - return process.env[this.scopedEnvVarKey(k)]; + formatRoot() { + const help = new root_1.default(this.config, this.opts); + return help.root(); } - scopedEnvVarTrue(k) { - const v = process.env[this.scopedEnvVarKey(k)]; - return v === '1' || v === 'true'; + formatCommand(command) { + const help = new command_1.default(command, this.config, this.opts); + return help.generate(); } - scopedEnvVarKey(k) { - return [this.bin, k] - // eslint-disable-next-line no-useless-escape - .map(p => p.replace(/@/g, '').replace(/[-\/]/g, '_')) - .join('_') - .toUpperCase(); + formatCommands(commands) { + if (commands.length === 0) + return ''; + const body = list_1.renderList(commands.map(c => [ + c.id, + c.description && this.render(c.description.split('\n')[0]), + ]), { + spacer: '\n', + stripAnsi: this.opts.stripAnsi, + maxWidth: this.opts.maxWidth - 2, + }); + return [ + bold('COMMANDS'), + indent(body, 2), + ].join('\n'); } - findCommand(id, opts = {}) { - const command = this.commands.find(c => c.id === id || c.aliases.includes(id)); - if (command) - return command; - if (opts.must) - errors_1.error(`command ${id} not found`); + formatTopic(topic) { + let description = this.render(topic.description || ''); + const title = description.split('\n')[0]; + description = description.split('\n').slice(1).join('\n'); + let output = util_1.compact([ + title, + [ + bold('USAGE'), + indent(wrap(`$ ${this.config.bin} ${topic.name}:COMMAND`, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'), + description && ([ + bold('DESCRIPTION'), + indent(wrap(description, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n')), + ]).join('\n\n'); + if (this.opts.stripAnsi) + output = stripAnsi(output); + return output + '\n'; } - findTopic(name, opts = {}) { - const topic = this.topics.find(t => t.name === name); - if (topic) - return topic; - if (opts.must) - throw new Error(`topic ${name} not found`); + formatTopics(topics) { + if (topics.length === 0) + return ''; + const body = list_1.renderList(topics.map(c => [ + c.name, + c.description && this.render(c.description.split('\n')[0]), + ]), { + spacer: '\n', + stripAnsi: this.opts.stripAnsi, + maxWidth: this.opts.maxWidth - 2, + }); + return [ + bold('TOPICS'), + indent(body, 2), + ].join('\n'); } - get commands() { - return util_2.flatMap(this.plugins, p => p.commands); + /** + * @deprecated used for readme generation + * @param {object} command The command to generate readme help for + * @return {string} the readme help string for the given command + */ + command(command) { + return this.formatCommand(command); } - get commandIDs() { - return util_2.uniq(this.commands.map(c => c.id)); +} +exports.default = Help; +exports.Help = Help; + + +/***/ }), + +/***/ 99847: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const indent = __webpack_require__(98043); +const stripAnsi = __webpack_require__(45591); +const width = __webpack_require__(42577); +const wrap = __webpack_require__(57915); +const widestLine = __webpack_require__(60866); +function renderList(input, opts) { + if (input.length === 0) { + return ''; } - get topics() { - const topics = []; - for (const plugin of this.plugins) { - for (const topic of util_2.compact(plugin.topics)) { - const existing = topics.find(t => t.name === topic.name); - if (existing) { - existing.description = topic.description || existing.description; - existing.hidden = existing.hidden || topic.hidden; - } - else - topics.push(topic); + const renderMultiline = () => { + let output = ''; + for (let [left, right] of input) { + if (!left && !right) + continue; + if (left) { + if (opts.stripAnsi) + left = stripAnsi(left); + output += wrap(left.trim(), opts.maxWidth, { hard: true, trim: false }); } - } - // add missing topics - for (const c of this.commands.filter(c => !c.hidden)) { - const parts = c.id.split(':'); - while (parts.length) { - const name = parts.join(':'); - if (name && !topics.find(t => t.name === name)) { - topics.push({ name, description: c.description }); - } - parts.pop(); + if (right) { + if (opts.stripAnsi) + right = stripAnsi(right); + output += '\n'; + output += indent(wrap(right.trim(), opts.maxWidth - 2, { hard: true, trim: false }), 4); } + output += '\n\n'; } - return topics; + return output.trim(); + }; + if (opts.multiline) + return renderMultiline(); + const maxLength = widestLine(input.map(i => i[0]).join('\n')); + let output = ''; + let spacer = opts.spacer || '\n'; + let cur = ''; + for (const [left, r] of input) { + let right = r; + if (cur) { + output += spacer; + output += cur; + } + cur = left || ''; + if (opts.stripAnsi) + cur = stripAnsi(cur); + if (!right) { + cur = cur.trim(); + continue; + } + if (opts.stripAnsi) + right = stripAnsi(right); + right = wrap(right.trim(), opts.maxWidth - (maxLength + 2), { hard: true, trim: false }); + // right = wrap(right.trim(), screen.stdtermwidth - (maxLength + 4), {hard: true, trim: false}) + const [first, ...lines] = right.split('\n').map(s => s.trim()); + cur += ' '.repeat(maxLength - width(cur) + 2); + cur += first; + if (lines.length === 0) { + continue; + } + // if we start putting too many lines down, render in multiline format + if (lines.length > 4) + return renderMultiline(); + // if spacer is not defined, separate all rows with extra newline + if (!opts.spacer) + spacer = '\n\n'; + cur += '\n'; + cur += indent(lines.join('\n'), maxLength + 2); } - s3Key(type, ext, options = {}) { - if (typeof ext === 'object') - options = ext; - else if (ext) - options.ext = ext; - const _ = __webpack_require__(90250); - return _.template(this.pjson.oclif.update.s3.templates[options.platform ? 'target' : 'vanilla'][type])(Object.assign(Object.assign({}, this), options)); - } - s3Url(key) { - const host = this.pjson.oclif.update.s3.host; - if (!host) - throw new Error('no s3 host is set'); - const url = new url_1.URL(host); - url.pathname = path.join(url.pathname, key); - return url.toString(); - } - dir(category) { - const base = process.env[`XDG_${category.toUpperCase()}_HOME`] || - (this.windows && process.env.LOCALAPPDATA) || - path.join(this.home, category === 'data' ? '.local/share' : '.' + category); - return path.join(base, this.dirname); - } - windowsHome() { - return this.windowsHomedriveHome() || this.windowsUserprofileHome(); - } - windowsHomedriveHome() { - return (process.env.HOMEDRIVE && process.env.HOMEPATH && path.join(process.env.HOMEDRIVE, process.env.HOMEPATH)); - } - windowsUserprofileHome() { - return process.env.USERPROFILE; - } - macosCacheDir() { - return (this.platform === 'darwin' && path.join(this.home, 'Library', 'Caches', this.dirname)) || undefined; - } - _shell() { - let shellPath; - const { SHELL, COMSPEC } = process.env; - if (SHELL) { - shellPath = SHELL.split('/'); - } - else if (this.windows && COMSPEC) { - shellPath = COMSPEC.split(/\\|\//); - } - else { - shellPath = ['unknown']; - } - return shellPath[shellPath.length - 1]; - } - _debug() { - if (this.scopedEnvVarTrue('DEBUG')) - return 1; - try { - const { enabled } = __webpack_require__(38237)(this.bin); - if (enabled) - return 1; - } - catch (_a) { } - return 0; - } - async loadPlugins(root, type, plugins, parent) { - if (!plugins || plugins.length === 0) - return; - debug('loading plugins', plugins); - await Promise.all((plugins || []).map(async (plugin) => { - try { - const opts = { type, root }; - if (typeof plugin === 'string') { - opts.name = plugin; - } - else { - opts.name = plugin.name || opts.name; - opts.tag = plugin.tag || opts.tag; - opts.root = plugin.root || opts.root; - } - const instance = new Plugin.Plugin(opts); - await instance.load(); - if (this.plugins.find(p => p.name === instance.name)) - return; - this.plugins.push(instance); - if (parent) { - // eslint-disable-next-line require-atomic-updates - instance.parent = parent; - if (!parent.children) - parent.children = []; - parent.children.push(instance); - } - await this.loadPlugins(instance.root, type, instance.pjson.oclif.plugins || [], instance); - } - catch (error) { - this.warn(error, 'loadPlugins'); - } - })); - } - warn(err, scope) { - if (this.warned) - return; - if (typeof err === 'string') { - process.emitWarning(err); - return; - } - if (err instanceof Error) { - const modifiedErr = err; - modifiedErr.name = `${err.name} Plugin: ${this.name}`; - modifiedErr.detail = util_2.compact([ - err.detail, - `module: ${this._base}`, - scope && `task: ${scope}`, - `plugin: ${this.name}`, - `root: ${this.root}`, - 'See more details with DEBUG=*', - ]).join('\n'); - process.emitWarning(err); - return; - } - // err is an object - process.emitWarning('Config.warn expected either a string or Error, but instead received an object'); - err.name = `${err.name} Plugin: ${this.name}`; - err.detail = util_2.compact([ - err.detail, - `module: ${this._base}`, - scope && `task: ${scope}`, - `plugin: ${this.name}`, - `root: ${this.root}`, - 'See more details with DEBUG=*', - ]).join('\n'); - process.emitWarning(JSON.stringify(err)); + if (cur) { + output += spacer; + output += cur; } + return output.trim(); } -exports.Config = Config; -function isConfig(o) { - return o && Boolean(o._base); -} -async function load(opts = (module.parent && module.parent && module.parent.parent && module.parent.parent.filename) || __dirname) { - if (typeof opts === 'string') - opts = { root: opts }; - if (isConfig(opts)) - return opts; - const config = new Config(opts); - await config.load(); - return config; -} -exports.load = load; +exports.renderList = renderList; /***/ }), -/***/ 40673: +/***/ 2178: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -// tslint:disable no-console -let debug; -try { - debug = __webpack_require__(38237); -} -catch (_a) { } -function displayWarnings() { - if (process.listenerCount('warning') > 1) - return; - process.on('warning', (warning) => { - console.error(warning.stack); - if (warning.detail) - console.error(warning.detail); - }); +const chalk = __webpack_require__(94294); +const indent = __webpack_require__(98043); +const stripAnsi = __webpack_require__(45591); +const util_1 = __webpack_require__(89977); +const wrap = __webpack_require__(57915); +const { bold, } = chalk; +class RootHelp { + constructor(config, opts) { + this.config = config; + this.opts = opts; + this.render = util_1.template(this); + } + root() { + let description = this.config.pjson.oclif.description || this.config.pjson.description || ''; + description = this.render(description); + description = description.split('\n')[0]; + let output = util_1.compact([ + description, + this.version(), + this.usage(), + this.description(), + ]).join('\n\n'); + if (this.opts.stripAnsi) + output = stripAnsi(output); + return output; + } + usage() { + return [ + bold('USAGE'), + indent(wrap(`$ ${this.config.bin} [COMMAND]`, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); + } + description() { + let description = this.config.pjson.oclif.description || this.config.pjson.description || ''; + description = this.render(description); + description = description.split('\n').slice(1).join('\n'); + if (!description) + return; + return [ + bold('DESCRIPTION'), + indent(wrap(description, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); + } + version() { + return [ + bold('VERSION'), + indent(wrap(this.config.userAgent, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), + ].join('\n'); + } } -exports.default = (...scope) => { - if (!debug) - return (..._) => { }; - const d = debug(['@oclif/config', ...scope].join(':')); - if (d.enabled) - displayWarnings(); - return (...args) => d(...args); -}; +exports.default = RootHelp; /***/ }), -/***/ 54412: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 60789: +/***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -try { - // eslint-disable-next-line node/no-missing-require - __webpack_require__(8387); +function termwidth(stream) { + if (!stream.isTTY) { + return 80; + } + const width = stream.getWindowSize()[0]; + if (width < 1) { + return 80; + } + if (width < 40) { + return 40; + } + return width; } -catch (_a) { } -var config_1 = __webpack_require__(53969); -exports.Config = config_1.Config; -exports.load = config_1.load; -var command_1 = __webpack_require__(24499); -exports.Command = command_1.Command; -var plugin_1 = __webpack_require__(25082); -exports.Plugin = plugin_1.Plugin; +const columns = parseInt(process.env.COLUMNS, 10) || global.columns; +exports.stdtermwidth = columns || termwidth(process.stdout); +exports.errtermwidth = columns || termwidth(process.stderr); /***/ }), -/***/ 25082: +/***/ 89977: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const errors_1 = __webpack_require__(52564); -const path = __webpack_require__(85622); -const util_1 = __webpack_require__(31669); -const command_1 = __webpack_require__(24499); -const debug_1 = __webpack_require__(40673); const ts_node_1 = __webpack_require__(39584); -const util_2 = __webpack_require__(54103); -const ROOT_INDEX_CMD_ID = ''; -const _pjson = __webpack_require__(63309); -const hasManifest = function (p) { - try { - require(p); - return true; - } - catch (_a) { - return false; - } -}; -function topicsToArray(input, base) { - if (!input) - return []; - base = base ? `${base}:` : ''; - if (Array.isArray(input)) { - return input.concat(util_2.flatMap(input, t => topicsToArray(t.subtopics, `${base}${t.name}`))); - } - return util_2.flatMap(Object.keys(input), k => { - input[k].name = k; - return [Object.assign(Object.assign({}, input[k]), { name: `${base}${k}` })].concat(topicsToArray(input[k].subtopics, `${base}${input[k].name}`)); +const lodashTemplate = __webpack_require__(60417); +function uniqBy(arr, fn) { + return arr.filter((a, i) => { + const aVal = fn(a); + return !arr.find((b, j) => j > i && fn(b) === aVal); }); } -// eslint-disable-next-line valid-jsdoc -/** - * find package root - * for packages installed into node_modules this will go up directories until - * it finds a node_modules directory with the plugin installed into it - * - * This is needed because of the deduping npm does - */ -async function findRoot(name, root) { - // essentially just "cd .." - function* up(from) { - while (path.dirname(from) !== from) { - yield from; - from = path.dirname(from); - } - yield from; - } - for (const next of up(root)) { - let cur; - if (name) { - cur = path.join(next, 'node_modules', name, 'package.json'); - // eslint-disable-next-line no-await-in-loop - if (await util_2.exists(cur)) - return path.dirname(cur); - try { - // eslint-disable-next-line no-await-in-loop - const pkg = await util_2.loadJSON(path.join(next, 'package.json')); - if (pkg.name === name) - return next; - } - catch (_a) { } - } - else { - cur = path.join(next, 'package.json'); - // eslint-disable-next-line no-await-in-loop - if (await util_2.exists(cur)) - return path.dirname(cur); - } - } +exports.uniqBy = uniqBy; +function compact(a) { + return a.filter((a) => Boolean(a)); } -class Plugin { - // eslint-disable-next-line no-useless-constructor - constructor(options) { - this.options = options; - // static loadedPlugins: {[name: string]: Plugin} = {} - this._base = `${_pjson.name}@${_pjson.version}`; - this.valid = false; - this.alreadyLoaded = false; - this.children = []; - // eslint-disable-next-line new-cap - this._debug = debug_1.default(); - this.warned = false; - } - async load() { - this.type = this.options.type || 'core'; - this.tag = this.options.tag; - const root = await findRoot(this.options.name, this.options.root); - if (!root) - throw new Error(`could not find package.json with ${util_1.inspect(this.options)}`); - this.root = root; - this._debug('reading %s plugin %s', this.type, root); - this.pjson = await util_2.loadJSON(path.join(root, 'package.json')); - this.name = this.pjson.name; - const pjsonPath = path.join(root, 'package.json'); - if (!this.name) - throw new Error(`no name in ${pjsonPath}`); - const isProd = hasManifest(path.join(root, 'oclif.manifest.json')); - if (!isProd && !this.pjson.files) - this.warn(`files attribute must be specified in ${pjsonPath}`); - // eslint-disable-next-line new-cap - this._debug = debug_1.default(this.name); - this.version = this.pjson.version; - if (this.pjson.oclif) { - this.valid = true; - } - else { - this.pjson.oclif = this.pjson['cli-engine'] || {}; +exports.compact = compact; +function castArray(input) { + if (input === undefined) + return []; + return Array.isArray(input) ? input : [input]; +} +exports.castArray = castArray; +function sortBy(arr, fn) { + function compare(a, b) { + a = a === undefined ? 0 : a; + b = b === undefined ? 0 : b; + if (Array.isArray(a) && Array.isArray(b)) { + if (a.length === 0 && b.length === 0) + return 0; + const diff = compare(a[0], b[0]); + if (diff !== 0) + return diff; + return compare(a.slice(1), b.slice(1)); } - this.hooks = util_2.mapValues(this.pjson.oclif.hooks || {}, i => Array.isArray(i) ? i : [i]); - this.manifest = await this._manifest(Boolean(this.options.ignoreManifest), Boolean(this.options.errorOnManifestCreate)); - this.commands = Object.entries(this.manifest.commands) - .map(([id, c]) => (Object.assign(Object.assign({}, c), { load: () => this.findCommand(id, { must: true }) }))); - this.commands.sort((a, b) => { - if (a.id < b.id) - return -1; - if (a.id > b.id) - return 1; - return 0; - }); - } - get topics() { - return topicsToArray(this.pjson.oclif.topics || {}); + if (a < b) + return -1; + if (a > b) + return 1; + return 0; } - get commandsDir() { - return ts_node_1.tsPath(this.root, this.pjson.oclif.commands); + return arr.sort((a, b) => compare(fn(a), fn(b))); +} +exports.sortBy = sortBy; +function template(context) { + function render(t) { + return lodashTemplate(t)(context); } - get commandIDs() { - if (!this.commandsDir) - return []; - let globby; + return render; +} +exports.template = template; +function extractExport(config, classPath) { + const helpClassPath = ts_node_1.tsPath(config.root, classPath); + return require(helpClassPath); +} +function extractClass(exported) { + return exported && exported.default ? exported.default : exported; +} +function getHelpClass(config, defaultClass = '@oclif/plugin-help') { + const pjson = config.pjson; + const configuredClass = pjson && pjson.oclif && pjson.oclif.helpClass; + if (configuredClass) { try { - const globbyPath = require.resolve('globby', { paths: [this.root, __dirname] }); - globby = require(globbyPath); + const exported = extractExport(config, configuredClass); + return extractClass(exported); } catch (error) { - this.warn(error, 'not loading commands, globby not found'); - return []; + throw new Error(`Unable to load configured help class "${configuredClass}", failed with message:\n${error.message}`); } - this._debug(`loading IDs from ${this.commandsDir}`); - const patterns = [ - '**/*.+(js|ts|tsx)', - '!**/*.+(d.ts|test.ts|test.js|spec.ts|spec.js)?(x)', - ]; - const ids = globby.sync(patterns, { cwd: this.commandsDir }) - .map(file => { - const p = path.parse(file); - const topics = p.dir.split('/'); - const command = p.name !== 'index' && p.name; - // support src/commands/index as a "root" command - if (!command && this.type === 'core' && p.dir.length === 0 && p.name === 'index') - return ROOT_INDEX_CMD_ID; - return [...topics, command].filter(f => f).join(':'); - }); - this._debug('found commands', ids); - return ids; } - findCommand(id, opts = {}) { - const fetch = () => { - if (!this.commandsDir) - return; - const search = (cmd) => { - if (typeof cmd.run === 'function') - return cmd; - if (cmd.default && cmd.default.run) - return cmd.default; - return Object.values(cmd).find((cmd) => typeof cmd.run === 'function'); - }; - const p = require.resolve(path.join(this.commandsDir, ...id.split(':'))); - this._debug('require', p); - let m; - try { - m = require(p); - } - catch (error) { - if (!opts.must && error.code === 'MODULE_NOT_FOUND') - return; - throw error; - } - const cmd = search(m); - if (!cmd) - return; - cmd.id = id; - cmd.plugin = this; - return cmd; - }; - const cmd = fetch(); - if (!cmd && opts.must) - errors_1.error(`command ${id} not found`); - return cmd; + try { + const defaultModulePath = require.resolve(defaultClass, { paths: [config.root] }); + const exported = require(defaultModulePath); + return extractClass(exported); } - async _manifest(ignoreManifest, errorOnManifestCreate = false) { - const readManifest = async (dotfile = false) => { - try { - const p = path.join(this.root, `${dotfile ? '.' : ''}oclif.manifest.json`); - const manifest = await util_2.loadJSON(p); - if (!process.env.OCLIF_NEXT_VERSION && manifest.version.split('-')[0] !== this.version.split('-')[0]) { - process.emitWarning(`Mismatched version in ${this.name} plugin manifest. Expected: ${this.version} Received: ${manifest.version}\nThis usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.`); - } - else { - this._debug('using manifest from', p); - return manifest; - } - } - catch (error) { - if (error.code === 'ENOENT') { - if (!dotfile) - return readManifest(true); - } - else { - this.warn(error, 'readManifest'); - } - } - }; - if (!ignoreManifest) { - const manifest = await readManifest(); - if (manifest) - return manifest; - } - return { - version: this.version, - // eslint-disable-next-line array-callback-return - commands: this.commandIDs.map(id => { - try { - return [id, command_1.Command.toCached(this.findCommand(id, { must: true }), this)]; - } - catch (error) { - const scope = 'toCached'; - if (Boolean(errorOnManifestCreate) === false) - this.warn(error, scope); - else - throw this.addErrorScope(error, scope); - } - }) - .filter((f) => Boolean(f)) - .reduce((commands, [id, c]) => { - commands[id] = c; - return commands; - }, {}), - }; - } - warn(err, scope) { - if (this.warned) - return; - if (typeof err === 'string') - err = new Error(err); - process.emitWarning(this.addErrorScope(err, scope)); - } - addErrorScope(err, scope) { - err.name = `${err.name} Plugin: ${this.name}`; - err.detail = util_2.compact([err.detail, `module: ${this._base}`, scope && `task: ${scope}`, `plugin: ${this.name}`, `root: ${this.root}`, 'See more details with DEBUG=*']).join('\n'); - return err; + catch (error) { + throw new Error(`Could not load a help class, consider installing the @oclif/plugin-help package, failed with message:\n${error.message}`); } } -exports.Plugin = Plugin; +exports.getHelpClass = getHelpClass; /***/ }), -/***/ 39584: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 97546: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const fs = __webpack_require__(35747); -const path = __webpack_require__(85622); -const debug_1 = __webpack_require__(40673); -// eslint-disable-next-line new-cap -const debug = debug_1.default(); -const tsconfigs = {}; -const rootDirs = []; -const typeRoots = [`${__dirname}/../node_modules/@types`]; -function loadTSConfig(root) { - const tsconfigPath = path.join(root, 'tsconfig.json'); - let typescript; - try { - typescript = __webpack_require__(75034); - } - catch (_a) { - try { - typescript = require(root + '/node_modules/typescript'); - } - catch (_b) { } - } - if (fs.existsSync(tsconfigPath) && typescript) { - const tsconfig = typescript.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, 'utf8')).config; - if (!tsconfig || !tsconfig.compilerOptions) { - throw new Error(`Could not read and parse tsconfig.json at ${tsconfigPath}, or it ` + - 'did not contain a "compilerOptions" section.'); - } - return tsconfig; - } -} -function registerTSNode(root) { - if (process.env.OCLIF_TS_NODE === '0') - return; - if (tsconfigs[root]) - return; - const tsconfig = loadTSConfig(root); - if (!tsconfig) - return; - debug('registering ts-node at', root); - const tsNodePath = require.resolve('ts-node', { paths: [root, __dirname] }); - const tsNode = require(tsNodePath); - tsconfigs[root] = tsconfig; - typeRoots.push(`${root}/node_modules/@types`); - if (tsconfig.compilerOptions.rootDirs) { - rootDirs.push(...tsconfig.compilerOptions.rootDirs.map(r => path.join(root, r))); - } - else { - rootDirs.push(`${root}/src`); - } - const cwd = process.cwd(); - try { - process.chdir(root); - tsNode.register({ - skipProject: true, - transpileOnly: true, - // cache: false, - // typeCheck: true, - compilerOptions: { - esModuleInterop: tsconfig.compilerOptions.esModuleInterop, - target: tsconfig.compilerOptions.target || 'es2017', - experimentalDecorators: tsconfig.compilerOptions.experimentalDecorators || false, - emitDecoratorMetadata: tsconfig.compilerOptions.emitDecoratorMetadata || false, - module: 'commonjs', - sourceMap: true, - rootDirs, - typeRoots, - jsx: 'react', - }, - }); - } - finally { - process.chdir(cwd); - } -} -function tsPath(root, orig) { - if (!orig) - return orig; - orig = path.join(root, orig); - try { - registerTSNode(root); - const tsconfig = tsconfigs[root]; - if (!tsconfig) - return orig; - const { rootDir, rootDirs, outDir } = tsconfig.compilerOptions; - const rootDirPath = rootDir || (rootDirs || [])[0]; - if (!rootDirPath || !outDir) - return orig; - // rewrite path from ./lib/foo to ./src/foo - const lib = path.join(root, outDir); // ./lib - const src = path.join(root, rootDirPath); // ./src - const relative = path.relative(lib, orig); // ./commands - const out = path.join(src, relative); // ./src/commands - // this can be a directory of commands or point to a hook file - // if it's a directory, we check if the path exists. If so, return the path to the directory. - // For hooks, it might point to a module, not a file. Something like "./hooks/myhook" - // That file doesn't exist, and the real file is "./hooks/myhook.ts" - // In that case we attempt to resolve to the filename. If it fails it will revert back to the lib path - if (fs.existsSync(out) || fs.existsSync(out + '.ts')) - return out; - return orig; - } - catch (error) { - debug(error); - return orig; - } -} -exports.tsPath = tsPath; + +module.exports = () => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, 'g'); +}; /***/ }), -/***/ 54103: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 87236: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); -Object.defineProperty(exports, "__esModule", ({ value: true })); -const fs = __webpack_require__(35747); -const debug = __webpack_require__(38237)('@oclif/config'); -function flatMap(arr, fn) { - return arr.reduce((arr, i) => arr.concat(fn(i)), []); -} -exports.flatMap = flatMap; -function mapValues(obj, fn) { - return Object.entries(obj) - .reduce((o, [k, v]) => { - o[k] = fn(v, k); - return o; - }, {}); -} -exports.mapValues = mapValues; -function exists(path) { - return new Promise(resolve => resolve(fs.existsSync(path))); -} -exports.exists = exists; -function loadJSON(path) { - debug('loadJSON %s', path); - // let loadJSON - // try { loadJSON = require('load-json-file') } catch {} - // if (loadJSON) return loadJSON.sync(path) - return new Promise((resolve, reject) => { - fs.readFile(path, 'utf8', (err, d) => { - try { - if (err) - reject(err); - else - resolve(JSON.parse(d)); - } - catch (error) { - reject(error); - } - }); - }); -} -exports.loadJSON = loadJSON; -function compact(a) { - return a.filter((a) => Boolean(a)); -} -exports.compact = compact; -function uniq(arr) { - return arr.filter((a, i) => { - return !arr.find((b, j) => j > i && b === a); - }); -} -exports.uniq = uniq; +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; -/***/ }), +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; -/***/ 46418: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; -"use strict"; +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const logger_1 = __webpack_require__(41434); -// eslint-disable-next-line no-multi-assign -const g = global.oclif = global.oclif || {}; -function displayWarnings() { - if (process.listenerCount('warning') > 1) - return; - process.on('warning', (warning) => { - console.error(warning.stack); - if (warning.detail) - console.error(warning.detail); - }); -} -exports.config = { - errorLogger: undefined, - get debug() { - return Boolean(g.debug); - }, - set debug(enabled) { - g.debug = enabled; - if (enabled) - displayWarnings(); - }, - get errlog() { - return g.errlog; - }, - set errlog(errlog) { - g.errlog = errlog; - if (errlog) - this.errorLogger = new logger_1.Logger(errlog); - else - delete this.errorLogger; - }, +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); }; +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __webpack_require__(93130); + } -/***/ }), + const offset = isBackground ? 10 : 0; + const styles = {}; -/***/ 68954: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } -"use strict"; + return styles; +}; -// tslint:disable no-implicit-dependencies -Object.defineProperty(exports, "__esModule", ({ value: true })); -const config_1 = __webpack_require__(46418); -function addOclifExitCode(error, options) { - if (!('oclif' in error)) { - error.oclif = {}; - } - error.oclif.exit = (options === null || options === void 0 ? void 0 : options.exit) === undefined ? 2 : options.exit; - return error; -} -exports.addOclifExitCode = addOclifExitCode; -class CLIError extends Error { - constructor(error, options = {}) { - super(error instanceof Error ? error.message : error); - this.oclif = {}; - addOclifExitCode(this, options); - this.code = options.code; - } - get stack() { - const clean = __webpack_require__(27972); - return clean(super.stack, { pretty: true }); - } - /** - * @deprecated `render` Errors display should be handled by display function, like pretty-print - * @return {string} returns a string representing the dispay of the error - */ - render() { - if (config_1.config.debug) { - return this.stack; - } - const wrap = __webpack_require__(91800); - const indent = __webpack_require__(98043); - let output = `${this.name}: ${this.message}`; - // eslint-disable-next-line node/no-missing-require - output = wrap(output, __webpack_require__(13176).errtermwidth - 6, { trim: false, hard: true }); - output = indent(output, 3); - output = indent(output, 1, { indent: this.bang, includeEmptyLines: true }); - output = indent(output, 1); - return output; - } - get bang() { - let red = ((s) => s); - try { - red = __webpack_require__(38707).red; - } - catch (_a) { } - return red(process.platform === 'win32' ? '»' : '›'); - } -} -exports.CLIError = CLIError; -(function (CLIError) { - class Warn extends CLIError { - constructor(err) { - super(err instanceof Error ? err.message : err); - this.name = 'Warning'; - } - get bang() { - let yellow = ((s) => s); - try { - yellow = __webpack_require__(38707).yellow; - } - catch (_a) { } - return yellow(process.platform === 'win32' ? '»' : '›'); - } - } - CLIError.Warn = Warn; -})(CLIError = exports.CLIError || (exports.CLIError = {})); +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; -/***/ }), + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; -/***/ 7711: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; -"use strict"; + group[styleName] = styles[styleName]; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const cli_1 = __webpack_require__(68954); -class ExitError extends cli_1.CLIError { - constructor(exitCode = 0) { - super(`EEXIT: ${exitCode}`, { exit: exitCode }); - this.code = 'EEXIT'; - } - render() { - return ''; - } + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; } -exports.ExitError = ExitError; + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); /***/ }), -/***/ 10444: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 94294: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const wrap = __webpack_require__(91800); -const indent = __webpack_require__(98043); -const screen = __webpack_require__(13176); -const config_1 = __webpack_require__(46418); -function applyPrettyPrintOptions(error, options) { - const prettyErrorKeys = ['message', 'code', 'ref', 'suggestions']; - prettyErrorKeys.forEach(key => { - const applyOptionsKey = !(key in error) && options[key]; - if (applyOptionsKey) { - error[key] = options[key]; - } - }); - return error; -} -exports.applyPrettyPrintOptions = applyPrettyPrintOptions; -const formatSuggestions = (suggestions) => { - const label = 'Try this:'; - if (!suggestions || suggestions.length === 0) - return undefined; - if (suggestions.length === 1) - return `${label} ${suggestions[0]}`; - const multiple = suggestions.map(suggestion => `* ${suggestion}`).join('\n'); - return `${label}\n${indent(multiple, 2)}`; -}; -function prettyPrint(error) { - if (config_1.config.debug) { - return error.stack; - } - const { message, code, suggestions, ref, name: errorSuffix, bang } = error; - // errorSuffix is pulled from the 'name' property on CLIError - // and is like either Error or Warning - const formattedHeader = message ? `${errorSuffix || 'Error'}: ${message}` : undefined; - const formattedCode = code ? `Code: ${code}` : undefined; - const formattedSuggestions = formatSuggestions(suggestions); - const formattedReference = ref ? `Reference: ${ref}` : undefined; - const formatted = [formattedHeader, formattedCode, formattedSuggestions, formattedReference] - .filter(Boolean) - .join('\n'); - let output = wrap(formatted, screen.errtermwidth - 6, { trim: false, hard: true }); - output = indent(output, 3); - output = indent(output, 1, { indent: bang || '', includeEmptyLines: true }); - output = indent(output, 1); - return output; -} -exports.default = prettyPrint; +const ansiStyles = __webpack_require__(87236); +const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(70976); +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = __webpack_require__(93715); +const {isArray} = Array; -/***/ }), +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; -/***/ 30690: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +const styles = Object.create(null); -"use strict"; +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable no-process-exit */ -/* eslint-disable unicorn/no-process-exit */ -const config_1 = __webpack_require__(46418); -const pretty_print_1 = __webpack_require__(10444); -const _1 = __webpack_require__(52564); -const clean = __webpack_require__(27972); -const cli_1 = __webpack_require__(68954); -exports.handle = (err) => { - var _a, _b, _c; - try { - if (!err) - err = new cli_1.CLIError('no error?'); - if (err.message === 'SIGINT') - process.exit(1); - const shouldPrint = !(err instanceof _1.ExitError); - const pretty = pretty_print_1.default(err); - const stack = clean(err.stack || '', { pretty: true }); - if (shouldPrint) { - console.error(pretty ? pretty : stack); - } - const exitCode = ((_a = err.oclif) === null || _a === void 0 ? void 0 : _a.exit) !== undefined && ((_b = err.oclif) === null || _b === void 0 ? void 0 : _b.exit) !== false ? (_c = err.oclif) === null || _c === void 0 ? void 0 : _c.exit : 1; - if (config_1.config.errorLogger && err.code !== 'EEXIT') { - if (stack) { - config_1.config.errorLogger.log(stack); - } - config_1.config.errorLogger.flush() - .then(() => process.exit(exitCode)) - .catch(console.error); - } - else - process.exit(exitCode); - } - catch (error) { - console.error(err.stack); - console.error(error.stack); - process.exit(1); - } + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; }; - -/***/ }), - -/***/ 52564: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -// tslint:disable no-console -Object.defineProperty(exports, "__esModule", ({ value: true })); -var handle_1 = __webpack_require__(30690); -exports.handle = handle_1.handle; -var exit_1 = __webpack_require__(7711); -exports.ExitError = exit_1.ExitError; -var cli_1 = __webpack_require__(68954); -exports.CLIError = cli_1.CLIError; -var logger_1 = __webpack_require__(41434); -exports.Logger = logger_1.Logger; -var config_1 = __webpack_require__(46418); -exports.config = config_1.config; -const config_2 = __webpack_require__(46418); -const cli_2 = __webpack_require__(68954); -const exit_2 = __webpack_require__(7711); -const pretty_print_1 = __webpack_require__(10444); -function exit(code = 0) { - throw new exit_2.ExitError(code); -} -exports.exit = exit; -function error(input, options = {}) { - var _a; - let err; - if (typeof input === 'string') { - err = new cli_2.CLIError(input, options); - } - else if (input instanceof Error) { - err = cli_2.addOclifExitCode(input, options); - } - else { - throw new TypeError('first argument must be a string or instance of Error'); - } - err = pretty_print_1.applyPrettyPrintOptions(err, options); - if (options.exit === false) { - const message = pretty_print_1.default(err); - console.error(message); - if (config_2.config.errorLogger) - config_2.config.errorLogger.log((_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : ''); - } - else - throw err; -} -exports.error = error; -function warn(input) { - var _a; - let err; - if (typeof input === 'string') { - err = new cli_2.CLIError.Warn(input); - } - else if (input instanceof Error) { - err = cli_2.addOclifExitCode(input); - } - else { - throw new TypeError('first argument must be a string or instance of Error'); - } - const message = pretty_print_1.default(err); - console.error(message); - if (config_2.config.errorLogger) - config_2.config.errorLogger.log((_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : ''); +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } } -exports.warn = warn; - - -/***/ }), -/***/ 41434: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); -"use strict"; + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); -Object.defineProperty(exports, "__esModule", ({ value: true })); -const path = __webpack_require__(85622); -const timestamp = () => new Date().toISOString(); -let timer; -const wait = (ms) => new Promise(resolve => { - if (timer) - timer.unref(); - timer = setTimeout(() => resolve(), ms); -}); -function chomp(s) { - if (s.endsWith('\n')) - return s.replace(/\n$/, ''); - return s; -} -class Logger { - // eslint-disable-next-line no-useless-constructor - constructor(file) { - this.file = file; - this.flushing = Promise.resolve(); - this.buffer = []; - } - log(msg) { - const stripAnsi = __webpack_require__(45591); - msg = stripAnsi(chomp(msg)); - const lines = msg.split('\n').map(l => `${timestamp()} ${l}`.trimRight()); - this.buffer.push(...lines); - // tslint:disable-next-line no-console - this.flush(50).catch(console.error); - } - async flush(waitForMs = 0) { - await wait(waitForMs); - this.flushing = this.flushing.then(async () => { - if (this.buffer.length === 0) - return; - const mylines = this.buffer; - this.buffer = []; - const fs = __webpack_require__(5630); - await fs.mkdirp(path.dirname(this.file)); - await fs.appendFile(this.file, mylines.join('\n') + '\n'); - }); - await this.flushing; - } -} -exports.Logger = Logger; + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; -/***/ }), + chalk.template.Instance = ChalkClass; -/***/ 13176: -/***/ ((__unused_webpack_module, exports) => { + return chalk.template; +}; -"use strict"; +function Chalk(options) { + return chalkFactory(options); +} -Object.defineProperty(exports, "__esModule", ({ value: true })); -function termwidth(stream) { - if (!stream.isTTY) { - return 80; - } - const width = stream.getWindowSize()[0]; - if (width < 1) { - return 80; - } - if (width < 40) { - return 40; - } - return width; +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + } + }; } -const columns = global.columns; -exports.stdtermwidth = columns || termwidth(process.stdout); -exports.errtermwidth = columns || termwidth(process.stderr); +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + } +}; -/***/ }), +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; -/***/ 74001: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} -"use strict"; -/* module decorator */ module = __webpack_require__.nmd(module); +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this._generator.level; + }, + set(level) { + this._generator.level = level; + } + } +}); -const wrapAnsi16 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${code + offset}m`; -}; +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } -const wrapAnsi256 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${38 + offset};5;${code}m`; + return { + open, + close, + openAll, + closeAll, + parent + }; }; -const wrapAnsi16m = (fn, offset) => (...args) => { - const rgb = fn(...args); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { + // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` + return applyStyle(builder, chalkTag(builder, ...arguments_)); + } -const ansi2ansi = n => n; -const rgb2rgb = (r, g, b) => [r, g, b]; + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; -const setLazyProperty = (object, property, get) => { - Object.defineProperty(object, property, { - get: () => { - const value = get(); + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); - Object.defineProperty(object, property, { - value, - enumerable: true, - configurable: true - }); + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; - return value; - }, - enumerable: true, - configurable: true - }); + return builder; }; -/** @type {typeof import('color-convert')} */ -let colorConvert; -const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { - if (colorConvert === undefined) { - colorConvert = __webpack_require__(88761); +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; } - const offset = isBackground ? 10 : 0; - const styles = {}; + let styler = self._styler; - for (const [sourceSpace, suite] of Object.entries(colorConvert)) { - const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; - if (sourceSpace === targetSpace) { - styles[name] = wrap(identity, offset); - } else if (typeof suite === 'object') { - styles[name] = wrap(suite[targetSpace], offset); - } + if (styler === undefined) { + return string; } - return styles; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] + styler = styler.parent; } - }; + } - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; + return openAll + string + closeAll; +}; - group[styleName] = styles[styleName]; +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; - codes.set(style[0], style[1]); - } + if (!isArray(firstString) || !isArray(firstString.raw)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; + + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); } - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); + if (template === undefined) { + template = __webpack_require__(39160); + } - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; + return template(chalk, parts.join('')); +}; - setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); - setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); +Object.defineProperties(Chalk.prototype, styles); - return styles; -} +const chalk = Chalk(); // eslint-disable-line new-cap +chalk.supportsColor = stdoutColor; +chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk.stderr.supportsColor = stderrColor; -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); +module.exports = chalk; /***/ }), -/***/ 84447: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 39160: +/***/ ((module) => { -/* MIT license */ -/* eslint-disable no-mixed-operators */ -const cssKeywords = __webpack_require__(98041); +"use strict"; -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). +const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; + +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); + +function unescape(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; + + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + + return ESCAPES.get(c) || c; +} + +function parseArguments(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; + + const results = []; + let matches; + + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } + + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } + + return current; +} + +module.exports = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; + + // eslint-disable-next-line max-params + temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); + + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } + + return chunks.join(''); +}; + + +/***/ }), + +/***/ 93715: +/***/ ((module) => { + +"use strict"; + + +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } + + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +module.exports = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; + + +/***/ }), + +/***/ 71406: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = __webpack_require__(98660); + +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). // do not use box values types (i.e. Number(), String(), etc.) const reverseKeywords = {}; @@ -9207,11 +9540,11 @@ convert.rgb.gray = function (rgb) { /***/ }), -/***/ 88761: +/***/ 93130: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const conversions = __webpack_require__(84447); -const route = __webpack_require__(89349); +const conversions = __webpack_require__(71406); +const route = __webpack_require__(57845); const convert = {}; @@ -9295,10 +9628,10 @@ module.exports = convert; /***/ }), -/***/ 89349: +/***/ 57845: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const conversions = __webpack_require__(84447); +const conversions = __webpack_require__(71406); /* This function routes a model to all other models. @@ -9399,7 +9732,7 @@ module.exports = function (fromModel) { /***/ }), -/***/ 98041: +/***/ 98660: /***/ ((module) => { "use strict"; @@ -9559,14 +9892,227 @@ module.exports = { /***/ }), -/***/ 91800: +/***/ 85815: +/***/ ((module) => { + +"use strict"; + + +module.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); +}; + + +/***/ }), + +/***/ 35565: +/***/ ((module) => { + +"use strict"; + +/* eslint-disable yoda */ +module.exports = x => { + if (Number.isNaN(x)) { + return false; + } + + // code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + x >= 0x1100 && ( + x <= 0x115f || // Hangul Jamo + x === 0x2329 || // LEFT-POINTING ANGLE BRACKET + x === 0x232a || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= x && x <= 0x4dbf) || + // CJK Unified Ideographs .. Yi Radicals + (0x4e00 <= x && x <= 0xa4c6) || + // Hangul Jamo Extended-A + (0xa960 <= x && x <= 0xa97c) || + // Hangul Syllables + (0xac00 <= x && x <= 0xd7a3) || + // CJK Compatibility Ideographs + (0xf900 <= x && x <= 0xfaff) || + // Vertical Forms + (0xfe10 <= x && x <= 0xfe19) || + // CJK Compatibility Forms .. Small Form Variants + (0xfe30 <= x && x <= 0xfe6b) || + // Halfwidth and Fullwidth Forms + (0xff01 <= x && x <= 0xff60) || + (0xffe0 <= x && x <= 0xffe6) || + // Kana Supplement + (0x1b000 <= x && x <= 0x1b001) || + // Enclosed Ideographic Supplement + (0x1f200 <= x && x <= 0x1f251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= x && x <= 0x3fffd) + ) + ) { + return true; + } + + return false; +}; + + +/***/ }), + +/***/ 70976: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const stringWidth = __webpack_require__(42577); -const stripAnsi = __webpack_require__(45591); -const ansiStyles = __webpack_require__(74001); +const os = __webpack_require__(12087); +const tty = __webpack_require__(33867); +const hasFlag = __webpack_require__(85815); + +const {env} = process; + +let 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 === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + 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; + // No default + } + } + + 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(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; + + +/***/ }), + +/***/ 57915: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const stringWidth = __webpack_require__(64537); +const stripAnsi = __webpack_require__(59284); +const ansiStyles = __webpack_require__(52068); const ESCAPES = new Set([ '\u001B', @@ -9575,14 +10121,7 @@ const ESCAPES = new Set([ const END_CODE = 39; -const ANSI_ESCAPE_BELL = '\u0007'; -const ANSI_CSI = '['; -const ANSI_OSC = ']'; -const ANSI_SGR_TERMINATOR = 'm'; -const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`; - -const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`; -const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`; +const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`; // Calculate the length of words split on ' ', ignoring // the extra characters added by ansi escape codes @@ -9593,8 +10132,7 @@ const wordLengths = string => string.split(' ').map(character => stringWidth(cha const wrapWord = (rows, word, columns) => { const characters = [...word]; - let isInsideEscape = false; - let isInsideLinkEscape = false; + let insideEscape = false; let visible = stringWidth(stripAnsi(rows[rows.length - 1])); for (const [index, character] of characters.entries()) { @@ -9608,20 +10146,13 @@ const wrapWord = (rows, word, columns) => { } if (ESCAPES.has(character)) { - isInsideEscape = true; - isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK); + insideEscape = true; + } else if (insideEscape && character === 'm') { + insideEscape = false; + continue; } - if (isInsideEscape) { - if (isInsideLinkEscape) { - if (character === ANSI_ESCAPE_BELL) { - isInsideEscape = false; - isInsideLinkEscape = false; - } - } else if (character === ANSI_SGR_TERMINATOR) { - isInsideEscape = false; - } - + if (insideEscape) { continue; } @@ -9640,77 +10171,51 @@ const wrapWord = (rows, word, columns) => { } }; -// Trims spaces from a string ignoring invisible sequences -const stringVisibleTrimSpacesRight = string => { - const words = string.split(' '); - let last = words.length; - - while (last > 0) { - if (stringWidth(words[last - 1]) > 0) { - break; - } - - last--; - } - - if (last === words.length) { - return string; - } - - return words.slice(0, last).join(' ') + words.slice(last).join(''); -}; - -// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode +// The wrap-ansi module can be invoked +// in either 'hard' or 'soft' wrap mode // -// 'hard' will never allow a string to take up more than columns characters +// 'hard' will never allow a string to take up more +// than columns characters // // 'soft' allows long words to expand past the column length const exec = (string, columns, options = {}) => { - if (options.trim !== false && string.trim() === '') { - return ''; + if (string.trim() === '') { + return options.trim === false ? string : string.trim(); } - let returnValue = ''; + let pre = ''; + let ret = ''; let escapeCode; - let escapeUrl; const lengths = wordLengths(string); - let rows = ['']; + const rows = ['']; for (const [index, word] of string.split(' ').entries()) { - if (options.trim !== false) { - rows[rows.length - 1] = rows[rows.length - 1].trimStart(); - } - + rows[rows.length - 1] = options.trim === false ? rows[rows.length - 1] : rows[rows.length - 1].trim(); let rowLength = stringWidth(rows[rows.length - 1]); - if (index !== 0) { - if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { + if (rowLength || word === '') { + if (rowLength === columns && options.wordWrap === false) { // If we start with a new word but the current row length equals the length of the columns, add a new row rows.push(''); rowLength = 0; } - if (rowLength > 0 || options.trim === false) { - rows[rows.length - 1] += ' '; - rowLength++; - } + rows[rows.length - 1] += ' '; + rowLength++; } - // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' - if (options.hard && lengths[index] > columns) { - const remainingColumns = (columns - rowLength); - const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); - const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); - if (breaksStartingNextLine < breaksStartingThisLine) { + // In 'hard' wrap mode, the length of a line is + // never allowed to extend past 'columns' + if (lengths[index] > columns && options.hard) { + if (rowLength) { rows.push(''); } - wrapWord(rows, word, columns); continue; } - if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { + if (rowLength + lengths[index] > columns && rowLength > 0) { if (options.wordWrap === false && rowLength < columns) { wrapWord(rows, word, columns); continue; @@ -9727,54 +10232,34 @@ const exec = (string, columns, options = {}) => { rows[rows.length - 1] += word; } - if (options.trim !== false) { - rows = rows.map(stringVisibleTrimSpacesRight); - } - - const pre = [...rows.join('\n')]; + pre = rows.map(row => options.trim === false ? row : row.trim()).join('\n'); - for (const [index, character] of pre.entries()) { - returnValue += character; + for (const [index, character] of [...pre].entries()) { + ret += character; if (ESCAPES.has(character)) { - const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?\\d+)m|\\${ANSI_ESCAPE_LINK}(?.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}}; - if (groups.code !== undefined) { - const code = Number.parseFloat(groups.code); - escapeCode = code === END_CODE ? undefined : code; - } else if (groups.uri !== undefined) { - escapeUrl = groups.uri.length === 0 ? undefined : groups.uri; - } + const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4))); + escapeCode = code === END_CODE ? null : code; } const code = ansiStyles.codes.get(Number(escapeCode)); - if (pre[index + 1] === '\n') { - if (escapeUrl) { - returnValue += wrapAnsiHyperlink(''); - } - - if (escapeCode && code) { - returnValue += wrapAnsi(code); - } - } else if (character === '\n') { - if (escapeCode && code) { - returnValue += wrapAnsi(escapeCode); - } - - if (escapeUrl) { - returnValue += wrapAnsiHyperlink(escapeUrl); + if (escapeCode && code) { + if (pre[index + 1] === '\n') { + ret += wrapAnsi(code); + } else if (character === '\n') { + ret += wrapAnsi(escapeCode); } } } - return returnValue; + return ret; }; // For each newline, invoke the method separately module.exports = (string, columns, options) => { return String(string) .normalize() - .replace(/\r\n/g, '\n') .split('\n') .map(line => exec(line, columns, options)) .join('\n'); @@ -9783,21487 +10268,12789 @@ module.exports = (string, columns, options) => { /***/ }), -/***/ 49094: -/***/ ((module) => { +/***/ 64537: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// code is originally from https://github.com/AnAppAMonth/linewrap +"use strict"; -// Presets -var presetMap = { - 'html': { - skipScheme: 'html', - lineBreakScheme: 'html', - whitespace: 'collapse' - } -} +const stripAnsi = __webpack_require__(59284); +const isFullwidthCodePoint = __webpack_require__(35565); -// lineBreak Schemes -var brPat = /<\s*br(?:[\s/]*|\s[^>]*)>/gi -var lineBreakSchemeMap = { - 'unix': [/\n/g, '\n'], - 'dos': [/\r\n/g, '\r\n'], - 'mac': [/\r/g, '\r'], - 'html': [brPat, '
'], - 'xhtml': [brPat, '
'] -} +module.exports = str => { + if (typeof str !== 'string' || str.length === 0) { + return 0; + } -// skip Schemes -var skipSchemeMap = { - 'ansi-color': /\x1B\[[^m]*m/g, - 'html': /<[^>]*>/g, - 'bbcode': /\[[^]]*\]/g -} + str = stripAnsi(str); -var modeMap = { - 'soft': 1, - 'hard': 1 -} + let width = 0; -var wsMap = { - 'collapse': 1, - 'default': 1, - 'line': 1, - 'all': 1 -} + for (let i = 0; i < str.length; i++) { + const code = str.codePointAt(i); -var rlbMap = { - 'all': 1, - 'multi': 1, - 'none': 1 -} -var rlbSMPat = /([sm])(\d+)/ + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } -var escapePat = /[-/\\^$*+?.()|[\]{}]/g -function escapeRegExp (s) { - return s.replace(escapePat, '\\$&') -} + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } -var linewrap = module.exports = function (start, stop, params) { - if (typeof start === 'object') { - params = start - start = params.start - stop = params.stop - } + // Surrogates + if (code > 0xFFFF) { + i++; + } - if (typeof stop === 'object') { - params = stop - start = start || params.start - stop = undefined - } + width += isFullwidthCodePoint(code) ? 2 : 1; + } - if (!stop) { - stop = start - start = 0 - } + return width; +}; - if (!params) { params = {}; } - // Supported options and default values. - var preset, - mode = 'soft', - whitespace = 'default', - tabWidth = 4, - skip, skipScheme, lineBreak, lineBreakScheme, - respectLineBreaks = 'all', - respectNum, - preservedLineIndent, - wrapLineIndent, wrapLineIndentBase - var skipPat - var lineBreakPat, lineBreakStr - var multiLineBreakPat - var preservedLinePrefix = '' - var wrapLineIndentPat, wrapLineInitPrefix = '' - var tabRepl - var item, flags - var i +/***/ }), - // First process presets, because these settings can be overwritten later. - preset = params.preset - if (preset) { - if (!(preset instanceof Array)) { - preset = [preset] - } - for (i = 0; i < preset.length; i++) { - item = presetMap[preset[i]] - if (item) { - if (item.mode) { - mode = item.mode - } - if (item.whitespace) { - whitespace = item.whitespace - } - if (item.tabWidth !== undefined) { - tabWidth = item.tabWidth - } - if (item.skip) { - skip = item.skip - } - if (item.skipScheme) { - skipScheme = item.skipScheme - } - if (item.lineBreak) { - lineBreak = item.lineBreak - } - if (item.lineBreakScheme) { - lineBreakScheme = item.lineBreakScheme - } - if (item.respectLineBreaks) { - respectLineBreaks = item.respectLineBreaks - } - if (item.preservedLineIndent !== undefined) { - preservedLineIndent = item.preservedLineIndent - } - if (item.wrapLineIndent !== undefined) { - wrapLineIndent = item.wrapLineIndent - } - if (item.wrapLineIndentBase) { - wrapLineIndentBase = item.wrapLineIndentBase - } - } else { - throw new TypeError('preset must be one of "' + Object.keys(presetMap).join('", "') + '"') - } - } - } +/***/ 59284: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (params.mode) { - if (modeMap[params.mode]) { - mode = params.mode - } else { - throw new TypeError('mode must be one of "' + Object.keys(modeMap).join('", "') + '"') - } - } - // Available options: 'collapse', 'default', 'line', and 'all' - if (params.whitespace) { - if (wsMap[params.whitespace]) { - whitespace = params.whitespace - } else { - throw new TypeError('whitespace must be one of "' + Object.keys(wsMap).join('", "') + '"') - } - } +"use strict"; - if (params.tabWidth !== undefined) { - if (parseInt(params.tabWidth, 10) >= 0) { - tabWidth = parseInt(params.tabWidth, 10) - } else { - throw new TypeError('tabWidth must be a non-negative integer') - } - } - tabRepl = new Array(tabWidth + 1).join(' ') +const ansiRegex = __webpack_require__(97546); - // Available options: 'all', 'multi', 'm\d+', 's\d+', 'none' - if (params.respectLineBreaks) { - if (rlbMap[params.respectLineBreaks] || rlbSMPat.test(params.respectLineBreaks)) { - respectLineBreaks = params.respectLineBreaks - } else { - throw new TypeError('respectLineBreaks must be one of "' + Object.keys(rlbMap).join('", "') + - '", "m", "s"') - } - } - // After these conversions, now we have 4 options in `respectLineBreaks`: - // 'all', 'none', 'm' and 's'. - // `respectNum` is applicable iff `respectLineBreaks` is either 'm' or 's'. - if (respectLineBreaks === 'multi') { - respectLineBreaks = 'm' - respectNum = 2 - } else if (!rlbMap[respectLineBreaks]) { - var match = rlbSMPat.exec(respectLineBreaks) - respectLineBreaks = match[1] - respectNum = parseInt(match[2], 10) - } +module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; - if (params.preservedLineIndent !== undefined) { - if (parseInt(params.preservedLineIndent, 10) >= 0) { - preservedLineIndent = parseInt(params.preservedLineIndent, 10) - } else { - throw new TypeError('preservedLineIndent must be a non-negative integer') - } - } - if (preservedLineIndent > 0) { - preservedLinePrefix = new Array(preservedLineIndent + 1).join(' ') - } +/***/ }), - if (params.wrapLineIndent !== undefined) { - if (!isNaN(parseInt(params.wrapLineIndent, 10))) { - wrapLineIndent = parseInt(params.wrapLineIndent, 10) - } else { - throw new TypeError('wrapLineIndent must be an integer') - } - } - if (params.wrapLineIndentBase) { - wrapLineIndentBase = params.wrapLineIndentBase - } +/***/ 6493: +/***/ ((__unused_webpack_module, exports) => { - if (wrapLineIndentBase) { - if (wrapLineIndent === undefined) { - throw new TypeError('wrapLineIndent must be specified when wrapLineIndentBase is specified') +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function termwidth(stream) { + if (!stream.isTTY) { + return 80; } - if (wrapLineIndentBase instanceof RegExp) { - wrapLineIndentPat = wrapLineIndentBase - } else if (typeof wrapLineIndentBase === 'string') { - wrapLineIndentPat = new RegExp(escapeRegExp(wrapLineIndentBase)) - } else { - throw new TypeError('wrapLineIndentBase must be either a RegExp object or a string') + const width = stream.getWindowSize()[0]; + if (width < 1) { + return 80; } - } else if (wrapLineIndent > 0) { - wrapLineInitPrefix = new Array(wrapLineIndent + 1).join(' ') - } else if (wrapLineIndent < 0) { - throw new TypeError('wrapLineIndent must be non-negative when a base is not specified') - } + if (width < 40) { + return 40; + } + return width; +} +const columns = global.columns; +exports.stdtermwidth = columns || termwidth(process.stdout); +exports.errtermwidth = columns || termwidth(process.stderr); +process.stdout.on('resize', () => { + exports.stdtermwidth = columns || termwidth(process.stdout); +}); +process.stderr.on('resize', () => { + exports.errtermwidth = columns || termwidth(process.stderr); +}); - // NOTE: For the two RegExps `skipPat` and `lineBreakPat` that can be specified - // by the user: - // 1. We require them to be "global", so we have to convert them to global - // if the user specifies a non-global regex. - // 2. We cannot call `split()` on them, because they may or may not contain - // capturing parentheses which affect the output of `split()`. - // Precedence: Regex = Str > Scheme - if (params.skipScheme) { - if (skipSchemeMap[params.skipScheme]) { - skipScheme = params.skipScheme - } else { - throw new TypeError('skipScheme must be one of "' + Object.keys(skipSchemeMap).join('", "') + '"') - } - } - if (params.skip) { - skip = params.skip - } +/***/ }), - if (skip) { - if (skip instanceof RegExp) { - skipPat = skip - if (!skipPat.global) { - flags = 'g' - if (skipPat.ignoreCase) { flags += 'i'; } - if (skipPat.multiline) { flags += 'm'; } - skipPat = new RegExp(skipPat.source, flags) - } - } else if (typeof skip === 'string') { - skipPat = new RegExp(escapeRegExp(skip), 'g') - } else { - throw new TypeError('skip must be either a RegExp object or a string') - } - } - if (!skipPat && skipScheme) { - skipPat = skipSchemeMap[skipScheme] - } +/***/ 18512: +/***/ ((module) => { - // Precedence: - // - for lineBreakPat: Regex > Scheme > Str - // - for lineBreakStr: Str > Scheme > Regex - if (params.lineBreakScheme) { - if (lineBreakSchemeMap[params.lineBreakScheme]) { - lineBreakScheme = params.lineBreakScheme - } else { - throw new TypeError('lineBreakScheme must be one of "' + Object.keys(lineBreakSchemeMap).join('", "') + '"') - } - } - if (params.lineBreak) { - lineBreak = params.lineBreak - } +"use strict"; - if (lineBreakScheme) { - // Supported schemes: 'unix', 'dos', 'mac', 'html', 'xhtml' - item = lineBreakSchemeMap[lineBreakScheme] - if (item) { - lineBreakPat = item[0] - lineBreakStr = item[1] - } - } - if (lineBreak) { - if (lineBreak instanceof Array) { - if (lineBreak.length === 1) { - lineBreak = lineBreak[0] - } else if (lineBreak.length >= 2) { - if (lineBreak[0] instanceof RegExp) { - lineBreakPat = lineBreak[0] - if (typeof lineBreak[1] === 'string') { - lineBreakStr = lineBreak[1] - } - } else if (lineBreak[1] instanceof RegExp) { - lineBreakPat = lineBreak[1] - if (typeof lineBreak[0] === 'string') { - lineBreakStr = lineBreak[0] - } - } else if (typeof lineBreak[0] === 'string' && typeof lineBreak[1] === 'string') { - lineBreakPat = new RegExp(escapeRegExp(lineBreak[0]), 'g') - lineBreakStr = lineBreak[1] - } else { - lineBreak = lineBreak[0] - } - } - } - if (typeof lineBreak === 'string') { - lineBreakStr = lineBreak - if (!lineBreakPat) { - lineBreakPat = new RegExp(escapeRegExp(lineBreak), 'g') - } - } else if (lineBreak instanceof RegExp) { - lineBreakPat = lineBreak - } else if (!(lineBreak instanceof Array)) { - throw new TypeError('lineBreak must be a RegExp object, a string, or an array consisted of a RegExp object and a string') - } - } - // Only assign defaults when `lineBreakPat` is not assigned. - // So if `params.lineBreak` is a RegExp, we don't have a value in `lineBreakStr` - // yet. We will try to get the value from the input string, and if failed, we - // will throw an exception. - if (!lineBreakPat) { - lineBreakPat = /\n/g - lineBreakStr = '\n' - } +const ansiEscapes = module.exports; +// TODO: remove this in the next major version +module.exports.default = ansiEscapes; - // Create `multiLineBreakPat` based on `lineBreakPat`, that matches strings - // consisted of one or more line breaks and zero or more whitespaces. - // Also convert `lineBreakPat` to global if not already so. - flags = 'g' - if (lineBreakPat.ignoreCase) { flags += 'i'; } - if (lineBreakPat.multiline) { flags += 'm'; } - multiLineBreakPat = new RegExp('\\s*(?:' + lineBreakPat.source + ')(?:' + - lineBreakPat.source + '|\\s)*', flags) - if (!lineBreakPat.global) { - lineBreakPat = new RegExp(lineBreakPat.source, flags) - } +const ESC = '\u001B['; +const OSC = '\u001B]'; +const BEL = '\u0007'; +const SEP = ';'; +const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; - // Initialize other useful variables. - var re = mode === 'hard' ? /\b/ : /(\S+\s+)/ - var prefix = new Array(start + 1).join(' ') - var wsStrip = (whitespace === 'default' || whitespace === 'collapse'), - wsCollapse = (whitespace === 'collapse'), - wsLine = (whitespace === 'line'), - wsAll = (whitespace === 'all') - var tabPat = /\t/g, - collapsePat = / +/g, - pPat = /^\s+/, - tPat = /\s+$/, - nonWsPat = /\S/, - wsPat = /\s/ - var wrapLen = stop - start +ansiEscapes.cursorTo = (x, y) => { + if (typeof x !== 'number') { + throw new TypeError('The `x` argument is required'); + } - return function (text) { - text = text.toString().replace(tabPat, tabRepl) + if (typeof y !== 'number') { + return ESC + (x + 1) + 'G'; + } - var match - if (!lineBreakStr) { - // Try to get lineBreakStr from `text` - lineBreakPat.lastIndex = 0 - match = lineBreakPat.exec(text) - if (match) { - lineBreakStr = match[0] - } else { - throw new TypeError('Line break string for the output not specified') - } - } + return ESC + (y + 1) + ';' + (x + 1) + 'H'; +}; - // text -> blocks; each bloc -> segments; each segment -> chunks - var blocks, base = 0 - var mo, arr, b, res - // Split `text` by line breaks. - blocks = [] - multiLineBreakPat.lastIndex = 0 - match = multiLineBreakPat.exec(text) - while(match) { - blocks.push(text.substring(base, match.index)) +ansiEscapes.cursorMove = (x, y) => { + if (typeof x !== 'number') { + throw new TypeError('The `x` argument is required'); + } - if (respectLineBreaks !== 'none') { - arr = [] - b = 0 - lineBreakPat.lastIndex = 0 - mo = lineBreakPat.exec(match[0]) - while(mo) { - arr.push(match[0].substring(b, mo.index)) - b = mo.index + mo[0].length - mo = lineBreakPat.exec(match[0]) - } - arr.push(match[0].substring(b)) - blocks.push({type: 'break', breaks: arr}) - } else { - // Strip line breaks and insert spaces when necessary. - if (wsCollapse) { - res = ' ' - } else { - res = match[0].replace(lineBreakPat, '') - } - blocks.push({type: 'break', remaining: res}) - } + let ret = ''; - base = match.index + match[0].length - match = multiLineBreakPat.exec(text) - } - blocks.push(text.substring(base)) + if (x < 0) { + ret += ESC + (-x) + 'D'; + } else if (x > 0) { + ret += ESC + x + 'C'; + } - var i, j, k - var segments - if (skipPat) { - segments = [] - for (i = 0; i < blocks.length; i++) { - var bloc = blocks[i] - if (typeof bloc !== 'string') { - // This is an object. - segments.push(bloc) - } else { - base = 0 - skipPat.lastIndex = 0 - match = skipPat.exec(bloc) - while(match) { - segments.push(bloc.substring(base, match.index)) - segments.push({type: 'skip', value: match[0]}) - base = match.index + match[0].length - match = skipPat.exec(bloc) - } - segments.push(bloc.substring(base)) - } - } - } else { - segments = blocks - } - - var chunks = [] - for (i = 0; i < segments.length; i++) { - var segment = segments[i] - if (typeof segment !== 'string') { - // This is an object. - chunks.push(segment) - } else { - if (wsCollapse) { - segment = segment.replace(collapsePat, ' ') - } - - var parts = segment.split(re), - acc = [] - - for (j = 0; j < parts.length; j++) { - var x = parts[j] - if (mode === 'hard') { - for (k = 0; k < x.length; k += wrapLen) { - acc.push(x.slice(k, k + wrapLen)) - } - } else { acc.push(x); } - } - chunks = chunks.concat(acc) - } - } + if (y < 0) { + ret += ESC + (-y) + 'A'; + } else if (y > 0) { + ret += ESC + y + 'B'; + } - var curLine = 0, - curLineLength = start + preservedLinePrefix.length, - lines = [ prefix + preservedLinePrefix ], - // Holds the "real length" (excluding trailing whitespaces) of the - // current line if it exceeds `stop`, otherwise 0. - // ONLY USED when `wsAll` is true, in `finishOffCurLine()`. - bulge = 0, - // `cleanLine` is true iff we are at the beginning of an output line. By - // "beginning" we mean it doesn't contain any non-whitespace char yet. - // But its `curLineLength` can be greater than `start`, or even possibly - // be greater than `stop`, if `wsStrip` is false. - // - // Note that a "clean" line can still contain skip strings, in addition - // to whitespaces. - // - // This variable is used to allow us strip preceding whitespaces when - // `wsStrip` is true, or `wsLine` is true and `preservedLine` is false. - cleanLine = true, - // `preservedLine` is true iff we are in a preserved input line. - // - // It's used when `wsLine` is true to (combined with `cleanLine`) decide - // whether a whitespace is at the beginning of a preserved input line and - // should not be stripped. - preservedLine = true, - // The current indent prefix for wrapped lines. - wrapLinePrefix = wrapLineInitPrefix, - remnant + return ret; +}; - // Always returns '' if `beforeHardBreak` is true. - // - // Assumption: Each call of this function is always followed by a `lines.push()` call. - // - // This function can change the status of `cleanLine`, but we don't modify the value of - // `cleanLine` in this function. It's fine because `cleanLine` will be set to the correct - // value after the `lines.push()` call following this function call. We also don't update - // `curLineLength` when pushing a new line and it's safe for the same reason. - function finishOffCurLine (beforeHardBreak) { - var str = lines[curLine], - idx, ln, rBase +ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'; +ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'; +ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'; +ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'; - if (!wsAll) { - // Strip all trailing whitespaces past `start`. - idx = str.length - 1 - while (idx >= start && str[idx] === ' ') { idx--; } - while (idx >= start && wsPat.test(str[idx])) { idx--; } - idx++ +ansiEscapes.cursorLeft = ESC + 'G'; +ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'; +ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'; +ansiEscapes.cursorGetPosition = ESC + '6n'; +ansiEscapes.cursorNextLine = ESC + 'E'; +ansiEscapes.cursorPrevLine = ESC + 'F'; +ansiEscapes.cursorHide = ESC + '?25l'; +ansiEscapes.cursorShow = ESC + '?25h'; - if (idx !== str.length) { - lines[curLine] = str.substring(0, idx) - } +ansiEscapes.eraseLines = count => { + let clear = ''; - if (preservedLine && cleanLine && wsLine && curLineLength > stop) { - // Add the remnants to the next line, just like when `wsAll` is true. - rBase = str.length - (curLineLength - stop) - if (rBase < idx) { - // We didn't reach `stop` when stripping due to a bulge. - rBase = idx - } - } - } else { - // Strip trailing whitespaces exceeding stop. - if (curLineLength > stop) { - bulge = bulge || stop - rBase = str.length - (curLineLength - bulge) - lines[curLine] = str.substring(0, rBase) - } - bulge = 0 - } + for (let i = 0; i < count; i++) { + clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : ''); + } - // Bug: the current implementation of `wrapLineIndent` is buggy: we are not - // taking the extra space occupied by the additional indentation into account - // when wrapping the line. For example, in "hard" mode, we should hard-wrap - // long words at `wrapLen - wrapLinePrefix.length` instead of `wrapLen` - // and remnants should also be wrapped at `wrapLen - wrapLinePrefix.length`. - if (preservedLine) { - // This is a preserved line, and the next output line isn't a - // preserved line. - preservedLine = false - if (wrapLineIndentPat) { - idx = lines[curLine].substring(start).search(wrapLineIndentPat) - if (idx >= 0 && idx + wrapLineIndent > 0) { - wrapLinePrefix = new Array(idx + wrapLineIndent + 1).join(' ') - } else { - wrapLinePrefix = '' - } - } - } + if (count) { + clear += ansiEscapes.cursorLeft; + } - // Some remnants are left to the next line. - if (rBase) { - while (rBase + wrapLen < str.length) { - if (wsAll) { - ln = str.substring(rBase, rBase + wrapLen) - lines.push(prefix + wrapLinePrefix + ln) - } else { - lines.push(prefix + wrapLinePrefix) - } - rBase += wrapLen - curLine++ - } - if (beforeHardBreak) { - if (wsAll) { - ln = str.substring(rBase) - lines.push(prefix + wrapLinePrefix + ln) - } else { - lines.push(prefix + wrapLinePrefix) - } - curLine++ - } else { - ln = str.substring(rBase) - return wrapLinePrefix + ln - } - } + return clear; +}; - return '' - } +ansiEscapes.eraseEndLine = ESC + 'K'; +ansiEscapes.eraseStartLine = ESC + '1K'; +ansiEscapes.eraseLine = ESC + '2K'; +ansiEscapes.eraseDown = ESC + 'J'; +ansiEscapes.eraseUp = ESC + '1J'; +ansiEscapes.eraseScreen = ESC + '2J'; +ansiEscapes.scrollUp = ESC + 'S'; +ansiEscapes.scrollDown = ESC + 'T'; - for (i = 0; i < chunks.length; i++) { - var chunk = chunks[i] +ansiEscapes.clearScreen = '\u001Bc'; - if (chunk === '') { continue; } +ansiEscapes.clearTerminal = process.platform === 'win32' ? + `${ansiEscapes.eraseScreen}${ESC}0f` : + // 1. Erases the screen (Only done in case `2` is not supported) + // 2. Erases the whole screen including scrollback buffer + // 3. Moves cursor to the top-left position + // More info: https://www.real-world-systems.com/docs/ANSIcode.html + `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`; - if (typeof chunk !== 'string') { - if (chunk.type === 'break') { - // This is one or more line breaks. - // Each entry in `breaks` is just zero or more whitespaces. - if (respectLineBreaks !== 'none') { - // Note that if `whitespace` is "collapse", we still need - // to collapse whitespaces in entries of `breaks`. - var breaks = chunk.breaks - var num = breaks.length - 1 +ansiEscapes.beep = BEL; - if (respectLineBreaks === 's') { - // This is the most complex scenario. We have to check - // the line breaks one by one. - for (j = 0; j < num; j++) { - if (breaks[j + 1].length < respectNum) { - // This line break should be stripped. - if (wsCollapse) { - breaks[j + 1] = ' ' - } else { - breaks[j + 1] = breaks[j] + breaks[j + 1] - } - } else { - // This line break should be preserved. - // First finish off the current line. - if (wsAll) { - lines[curLine] += breaks[j] - curLineLength += breaks[j].length - } - finishOffCurLine(true) +ansiEscapes.link = (text, url) => { + return [ + OSC, + '8', + SEP, + SEP, + url, + BEL, + text, + OSC, + '8', + SEP, + SEP, + BEL + ].join(''); +}; - lines.push(prefix + preservedLinePrefix) - curLine++ - curLineLength = start + preservedLinePrefix.length +ansiEscapes.image = (buffer, options = {}) => { + let ret = `${OSC}1337;File=inline=1`; - preservedLine = cleanLine = true - } - } - // We are adding to either the existing line (if no line break - // is qualified for preservance) or a "new" line. - if (!cleanLine || wsAll || (wsLine && preservedLine)) { - if (wsCollapse || (!cleanLine && breaks[num] === '')) { - breaks[num] = ' ' - } - lines[curLine] += breaks[num] - curLineLength += breaks[num].length - } - } else if (respectLineBreaks === 'm' && num < respectNum) { - // These line breaks should be stripped. - if (!cleanLine || wsAll || (wsLine && preservedLine)) { - if (wsCollapse) { - chunk = ' ' - } else { - chunk = breaks.join('') - if (!cleanLine && chunk === '') { - chunk = ' ' - } - } - lines[curLine] += chunk - curLineLength += chunk.length - } - } else { // 'all' || ('m' && num >= respectNum) - // These line breaks should be preserved. - if (wsStrip) { - // Finish off the current line. - finishOffCurLine(true) + if (options.width) { + ret += `;width=${options.width}`; + } - for (j = 0; j < num; j++) { - lines.push(prefix + preservedLinePrefix) - curLine++ - } + if (options.height) { + ret += `;height=${options.height}`; + } - curLineLength = start + preservedLinePrefix.length - preservedLine = cleanLine = true - } else { - if (wsAll || (preservedLine && cleanLine)) { - lines[curLine] += breaks[0] - curLineLength += breaks[0].length - } + if (options.preserveAspectRatio === false) { + ret += ';preserveAspectRatio=0'; + } - for (j = 0; j < num; j++) { - // Finish off the current line. - finishOffCurLine(true) + return ret + ':' + buffer.toString('base64') + BEL; +}; - lines.push(prefix + preservedLinePrefix + breaks[j + 1]) - curLine++ - curLineLength = start + preservedLinePrefix.length + breaks[j + 1].length +ansiEscapes.iTerm = { + setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`, - preservedLine = cleanLine = true - } - } - } - } else { - // These line breaks should be stripped. - if (!cleanLine || wsAll || (wsLine && preservedLine)) { - chunk = chunk.remaining + annotation: (message, options = {}) => { + let ret = `${OSC}1337;`; - // Bug: If `wsAll` is true, `cleanLine` is false, and `chunk` - // is '', we insert a space to replace the line break. This - // space will be preserved even if we are at the end of an - // output line, which is wrong behavior. However, I'm not - // sure it's worth it to fix this edge case. - if (wsCollapse || (!cleanLine && chunk === '')) { - chunk = ' ' - } - lines[curLine] += chunk - curLineLength += chunk.length - } - } - } else if (chunk.type === 'skip') { - // This is a skip string. - // Assumption: skip strings don't end with whitespaces. - if (curLineLength > stop) { - remnant = finishOffCurLine(false) + const hasX = typeof options.x !== 'undefined'; + const hasY = typeof options.y !== 'undefined'; + if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) { + throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined'); + } - lines.push(prefix + wrapLinePrefix) - curLine++ - curLineLength = start + wrapLinePrefix.length + message = message.replace(/\|/g, ''); - if (remnant) { - lines[curLine] += remnant - curLineLength += remnant.length - } + ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='; - cleanLine = true - } - lines[curLine] += chunk.value - } - continue - } + if (options.length > 0) { + ret += + (hasX ? + [message, options.length, options.x, options.y] : + [options.length, message]).join('|'); + } else { + ret += message; + } - var chunk2 - while (1) { - chunk2 = undefined - if (curLineLength + chunk.length > stop && - curLineLength + (chunk2 = chunk.replace(tPat, '')).length > stop && - chunk2 !== '' && - curLineLength > start) { - // This line is full, add `chunk` to the next line - remnant = finishOffCurLine(false) + return ret + BEL; + } +}; - lines.push(prefix + wrapLinePrefix) - curLine++ - curLineLength = start + wrapLinePrefix.length - if (remnant) { - lines[curLine] += remnant - curLineLength += remnant.length - cleanLine = true - continue - } +/***/ }), - if (wsStrip || (wsLine && !(preservedLine && cleanLine))) { - chunk = chunk.replace(pPat, '') - } - cleanLine = false - } else { - // Add `chunk` to this line - if (cleanLine) { - if (wsStrip || (wsLine && !(preservedLine && cleanLine))) { - chunk = chunk.replace(pPat, '') - if (chunk !== '') { - cleanLine = false - } - } else { - if (nonWsPat.test(chunk)) { - cleanLine = false - } - } - } - } - break - } - if (wsAll && chunk2 && curLineLength + chunk2.length > stop) { - bulge = curLineLength + chunk2.length - } - lines[curLine] += chunk - curLineLength += chunk.length - } - // Finally, finish off the last line. - finishOffCurLine(true) - return lines.join(lineBreakStr) - } -} +/***/ 65063: +/***/ ((module) => { -linewrap.soft = linewrap +"use strict"; -linewrap.hard = function ( /*start, stop, params*/) { - var args = [].slice.call(arguments) - var last = args.length - 1 - if (typeof args[last] === 'object') { - args[last].mode = 'hard' - } else { - args.push({ mode: 'hard' }) - } - return linewrap.apply(null, args) -} -linewrap.wrap = function (text /*, start, stop, params*/) { - var args = [].slice.call(arguments) - args.shift() - return linewrap.apply(null, args)(text) -} +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; /***/ }), -/***/ 18791: -/***/ ((__unused_webpack_module, exports) => { +/***/ 52068: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); -Object.defineProperty(exports, "__esModule", ({ value: true })); -function newArg(arg) { - return Object.assign({ parse: (i) => i }, arg, { required: Boolean(arg.required) }); -} -exports.newArg = newArg; - - -/***/ }), - -/***/ 17195: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; +const colorConvert = __webpack_require__(86931); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.default = () => { - const cache = {}; - return { - add(name, fn) { - Object.defineProperty(this, name, { - enumerable: true, - get: () => { - cache[name] = cache[name] || fn(); - return cache[name]; - }, - }); - return this; - }, - }; +const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; }; +const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; +}; -/***/ }), - -/***/ 33925: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; +const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(4351); -const errors_1 = __webpack_require__(52564); -const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); -var errors_2 = __webpack_require__(52564); -exports.CLIError = errors_2.CLIError; -// eslint-disable-next-line new-cap -const m = deps_1.default() - // eslint-disable-next-line node/no-missing-require - .add('help', () => __webpack_require__(50283)) - // eslint-disable-next-line node/no-missing-require - .add('list', () => __webpack_require__(25119)); -class CLIParseError extends errors_1.CLIError { - constructor(options) { - options.message += '\nSee more help with --help'; - super(options.message); - this.parse = options.parse; - } -} -exports.CLIParseError = CLIParseError; -class InvalidArgsSpecError extends CLIParseError { - constructor({ args, parse }) { - let message = 'Invalid argument spec'; - const namedArgs = args.filter(a => a.name); - if (namedArgs.length > 0) { - const list = m.list.renderList(namedArgs.map(a => [`${a.name} (${a.required ? 'required' : 'optional'})`, a.description])); - message += `:\n${list}`; - } - super({ parse, message }); - this.args = args; - } -} -exports.InvalidArgsSpecError = InvalidArgsSpecError; -class RequiredArgsError extends CLIParseError { - constructor({ args, parse }) { - let message = `Missing ${args.length} required arg${args.length === 1 ? '' : 's'}`; - const namedArgs = args.filter(a => a.name); - if (namedArgs.length > 0) { - const list = m.list.renderList(namedArgs.map(a => [a.name, a.description])); - message += `:\n${list}`; - } - super({ parse, message }); - this.args = args; - } -} -exports.RequiredArgsError = RequiredArgsError; -class RequiredFlagError extends CLIParseError { - constructor({ flag, parse }) { - const usage = m.list.renderList(m.help.flagUsages([flag], { displayRequired: false })); - const message = `Missing required flag:\n${usage}`; - super({ parse, message }); - this.flag = flag; - } -} -exports.RequiredFlagError = RequiredFlagError; -class UnexpectedArgsError extends CLIParseError { - constructor({ parse, args }) { - const message = `Unexpected argument${args.length === 1 ? '' : 's'}: ${args.join(', ')}`; - super({ parse, message }); - this.args = args; - } -} -exports.UnexpectedArgsError = UnexpectedArgsError; -class FlagInvalidOptionError extends CLIParseError { - constructor(flag, input) { - const message = `Expected --${flag.name}=${input} to be one of: ${flag.options.join(', ')}`; - super({ parse: {}, message }); - } -} -exports.FlagInvalidOptionError = FlagInvalidOptionError; -class ArgInvalidOptionError extends CLIParseError { - constructor(arg, input) { - const message = `Expected ${input} to be one of: ${arg.options.join(', ')}`; - super({ parse: {}, message }); - } -} -exports.ArgInvalidOptionError = ArgInvalidOptionError; +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], -/***/ }), + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; -/***/ 40331: -/***/ ((__unused_webpack_module, exports) => { + // Fix humans + styles.color.grey = styles.color.gray; -"use strict"; + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; -// tslint:disable interface-over-type-literal -Object.defineProperty(exports, "__esModule", ({ value: true })); -function build(defaults) { - return (options = {}) => { - return Object.assign({ parse: (i, _) => i }, defaults, options, { input: [], multiple: Boolean(options.multiple), type: 'option' }); - }; -} -exports.build = build; -function boolean(options = {}) { - return Object.assign({ parse: (b, _) => b }, options, { allowNo: Boolean(options.allowNo), type: 'boolean' }); + for (const styleName of Object.keys(group)) { + const style = group[styleName]; + + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const ansi2ansi = n => n; + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (let key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } + + const suite = colorConvert[key]; + + if (key === 'ansi16') { + key = 'ansi'; + } + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } + + return styles; } -exports.boolean = boolean; -exports.integer = build({ - parse: input => { - if (!/^-?\d+$/.test(input)) - throw new Error(`Expected an integer but received: ${input}`); - return parseInt(input, 10); - }, + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles }); -function option(options) { - return build(options)(); -} -exports.option = option; -const stringFlag = build({}); -exports.string = stringFlag; -exports.defaultFlags = { - color: boolean({ allowNo: true }), -}; /***/ }), -/***/ 50283: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 26218: +/***/ ((module) => { "use strict"; +// ColorCodes explained: http://www.termsys.demon.co.uk/vtansi.htm -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(4351); -const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); -// eslint-disable-next-line new-cap -const m = deps_1.default() - .add('chalk', () => __webpack_require__(38707)) - // eslint-disable-next-line node/no-missing-require - .add('util', () => __webpack_require__(78120)); -function flagUsage(flag, options = {}) { - const label = []; - if (flag.helpLabel) { - label.push(flag.helpLabel); - } - else { - if (flag.char) - label.push(`-${flag.char}`); - if (flag.name) - label.push(` --${flag.name}`); + +var colorNums = { + white : 37 + , black : 30 + , blue : 34 + , cyan : 36 + , green : 32 + , magenta : 35 + , red : 31 + , yellow : 33 + , brightBlack : 90 + , brightRed : 91 + , brightGreen : 92 + , brightYellow : 93 + , brightBlue : 94 + , brightMagenta : 95 + , brightCyan : 96 + , brightWhite : 97 } - const usage = flag.type === 'option' ? ` ${flag.name.toUpperCase()}` : ''; - let description = flag.description || ''; - if (options.displayRequired && flag.required) - description = `(required) ${description}`; - description = description ? m.chalk.dim(description) : undefined; - return [` ${label.join(',').trim()}${usage}`, description]; -} -exports.flagUsage = flagUsage; -function flagUsages(flags, options = {}) { - if (flags.length === 0) - return []; - const { sortBy } = m.util; - return sortBy(flags, f => [f.char ? -1 : 1, f.char, f.name]) - .map(f => flagUsage(f, options)); -} -exports.flagUsages = flagUsages; + , backgroundColorNums = { + bgBlack : 40 + , bgRed : 41 + , bgGreen : 42 + , bgYellow : 43 + , bgBlue : 44 + , bgMagenta : 45 + , bgCyan : 46 + , bgWhite : 47 + , bgBrightBlack : 100 + , bgBrightRed : 101 + , bgBrightGreen : 102 + , bgBrightYellow : 103 + , bgBrightBlue : 104 + , bgBrightMagenta : 105 + , bgBrightCyan : 106 + , bgBrightWhite : 107 + } + , open = {} + , close = {} + , colors = {} + ; +Object.keys(colorNums).forEach(function (k) { + var o = open[k] = '\u001b[' + colorNums[k] + 'm'; + var c = close[k] = '\u001b[39m'; -/***/ }), + colors[k] = function (s) { + return o + s + c; + }; +}); -/***/ 41150: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +Object.keys(backgroundColorNums).forEach(function (k) { + var o = open[k] = '\u001b[' + backgroundColorNums[k] + 'm'; + var c = close[k] = '\u001b[49m'; -"use strict"; + colors[k] = function (s) { + return o + s + c; + }; +}); -// tslint:disable interface-over-type-literal -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(4351); -const args = tslib_1.__importStar(__webpack_require__(18791)); -exports.args = args; -const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); -const flags = tslib_1.__importStar(__webpack_require__(40331)); -exports.flags = flags; -const parse_1 = __webpack_require__(72546); -var help_1 = __webpack_require__(50283); -exports.flagUsages = help_1.flagUsages; -// eslint-disable-next-line new-cap -const m = deps_1.default() - // eslint-disable-next-line node/no-missing-require - .add('validate', () => __webpack_require__(67385)/* .validate */ .G); -function parse(argv, options) { - const input = { - argv, - context: options.context, - args: (options.args || []).map((a) => args.newArg(a)), - '--': options['--'], - flags: Object.assign({ color: flags.defaultFlags.color }, ((options.flags || {}))), - strict: options.strict !== false, - }; - const parser = new parse_1.Parser(input); - const output = parser.parse(); - m.validate({ input, output }); - return output; -} -exports.parse = parse; +module.exports = colors; +colors.open = open; +colors.close = close; /***/ }), -/***/ 25119: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 96545: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = __webpack_require__(52618); + +/***/ }), + +/***/ 68104: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const screen_1 = __webpack_require__(85767); -const util_1 = __webpack_require__(78120); -function linewrap(length, s) { - const lw = __webpack_require__(49094); - return lw(length, screen_1.stdtermwidth, { - skipScheme: 'ansi-color', - })(s).trim(); -} -function renderList(items) { - if (items.length === 0) { - return ''; - } - const maxLength = (util_1.maxBy(items, i => i[0].length))[0].length; - const lines = items.map(i => { - let left = i[0]; - let right = i[1]; - if (!right) { - return left; - } - left = left.padEnd(maxLength); - right = linewrap(maxLength + 2, right); - return `${left} ${right}`; - }); - return lines.join('\n'); -} -exports.renderList = renderList; +var utils = __webpack_require__(20328); +var settle = __webpack_require__(13211); +var buildFullPath = __webpack_require__(41934); +var buildURL = __webpack_require__(30646); +var http = __webpack_require__(15876); +var https = __webpack_require__(57211); +var httpFollow = __webpack_require__(67707).http; +var httpsFollow = __webpack_require__(67707).https; +var url = __webpack_require__(78835); +var zlib = __webpack_require__(78761); +var pkg = __webpack_require__(20696); +var createError = __webpack_require__(15226); +var enhanceError = __webpack_require__(21516); -/***/ }), +var isHttps = /https:?/; -/***/ 72546: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/** + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} proxy + * @param {string} location + */ +function setProxy(options, proxy, location) { + options.hostname = proxy.host; + options.host = proxy.host; + options.port = proxy.port; + options.path = location; -"use strict"; + // Basic proxy authorization + if (proxy.auth) { + var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } -// tslint:disable interface-over-type-literal -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(4351); -const deps_1 = tslib_1.__importDefault(__webpack_require__(17195)); -// eslint-disable-next-line new-cap -const m = deps_1.default() - // eslint-disable-next-line node/no-missing-require - .add('errors', () => __webpack_require__(33925)) - // eslint-disable-next-line node/no-missing-require - .add('util', () => __webpack_require__(78120)); -let debug; -try { - // eslint-disable-next-line no-negated-condition - if (process.env.CLI_FLAGS_DEBUG !== '1') - debug = () => { }; - else - // eslint-disable-next-line node/no-extraneous-require - debug = __webpack_require__(38237)('@oclif/parser'); -} -catch (_a) { - debug = () => { }; + // If a proxy is used, any redirects must also pass through the proxy + options.beforeRedirect = function beforeRedirect(redirection) { + redirection.headers.host = redirection.host; + setProxy(redirection, proxy, redirection.href); + }; } -class Parser { - constructor(input) { - this.input = input; - this.raw = []; - const { pickBy } = m.util; - this.context = input.context || {}; - this.argv = input.argv.slice(0); - this._setNames(); - this.booleanFlags = pickBy(input.flags, f => f.type === 'boolean'); - this.metaData = {}; + +/*eslint consistent-return:0*/ +module.exports = function httpAdapter(config) { + return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { + var resolve = function resolve(value) { + resolvePromise(value); + }; + var reject = function reject(value) { + rejectPromise(value); + }; + var data = config.data; + var headers = config.headers; + + // Set User-Agent (required by some servers) + // Only set header if it hasn't been set in config + // See https://github.com/axios/axios/issues/69 + if (!headers['User-Agent'] && !headers['user-agent']) { + headers['User-Agent'] = 'axios/' + pkg.version; } - parse() { - this._debugInput(); - const findLongFlag = (arg) => { - const name = arg.slice(2); - if (this.input.flags[name]) { - return name; - } - if (arg.startsWith('--no-')) { - const flag = this.booleanFlags[arg.slice(5)]; - if (flag && flag.allowNo) - return flag.name; - } - }; - const findShortFlag = (arg) => { - return Object.keys(this.input.flags).find(k => this.input.flags[k].char === arg[1]); - }; - const parseFlag = (arg) => { - const long = arg.startsWith('--'); - const name = long ? findLongFlag(arg) : findShortFlag(arg); - if (!name) { - const i = arg.indexOf('='); - if (i !== -1) { - const sliced = arg.slice(i + 1); - this.argv.unshift(sliced); - const equalsParsed = parseFlag(arg.slice(0, i)); - if (!equalsParsed) { - this.argv.shift(); - } - return equalsParsed; - } - return false; - } - const flag = this.input.flags[name]; - if (flag.type === 'option') { - this.currentFlag = flag; - let input; - if (long || arg.length < 3) { - input = this.argv.shift(); - } - else { - input = arg.slice(arg[2] === '=' ? 3 : 2); - } - if (typeof input !== 'string') { - throw new m.errors.CLIError(`Flag --${name} expects a value`); - } - this.raw.push({ type: 'flag', flag: flag.name, input }); - } - else { - this.raw.push({ type: 'flag', flag: flag.name, input: arg }); - // push the rest of the short characters back on the stack - if (!long && arg.length > 2) { - this.argv.unshift(`-${arg.slice(2)}`); - } - } - return true; - }; - let parsingFlags = true; - while (this.argv.length) { - const input = this.argv.shift(); - if (parsingFlags && input.startsWith('-') && input !== '-') { - // attempt to parse as arg - if (this.input['--'] !== false && input === '--') { - parsingFlags = false; - continue; - } - if (parseFlag(input)) { - continue; - } - // not actually a flag if it reaches here so parse as an arg - } - if (parsingFlags && this.currentFlag && this.currentFlag.multiple) { - this.raw.push({ type: 'flag', flag: this.currentFlag.name, input }); - continue; - } - // not a flag, parse as arg - const arg = this.input.args[this._argTokens.length]; - if (arg) - arg.input = input; - this.raw.push({ type: 'arg', input }); - } - const argv = this._argv(); - const args = this._args(argv); - const flags = this._flags(); - this._debugOutput(argv, args, flags); - return { - args, - argv, - flags, - raw: this.raw, - metadata: this.metaData, - }; + + if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) { + // Nothing to do... + } else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(createError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + config + )); + } + + // Add Content-Length header if data exists + headers['Content-Length'] = data.length; } - _args(argv) { - const args = {}; - for (let i = 0; i < this.input.args.length; i++) { - const arg = this.input.args[i]; - args[arg.name] = argv[i]; - } - return args; + + // HTTP basic authentication + var auth = undefined; + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password || ''; + auth = username + ':' + password; } - _flags() { - const flags = {}; - this.metaData.flags = {}; - for (const token of this._flagTokens) { - const flag = this.input.flags[token.flag]; - if (!flag) - throw new m.errors.CLIError(`Unexpected flag ${token.flag}`); - if (flag.type === 'boolean') { - if (token.input === `--no-${flag.name}`) { - flags[token.flag] = false; - } - else { - flags[token.flag] = true; - } - flags[token.flag] = flag.parse(flags[token.flag], this.context); - } - else { - const input = token.input; - if (flag.options && !flag.options.includes(input)) { - throw new m.errors.FlagInvalidOptionError(flag, input); - } - const value = flag.parse ? flag.parse(input, this.context) : input; - if (flag.multiple) { - flags[token.flag] = flags[token.flag] || []; - flags[token.flag].push(value); - } - else { - flags[token.flag] = value; - } - } - } - for (const k of Object.keys(this.input.flags)) { - const flag = this.input.flags[k]; - if (flags[k]) - continue; - if (flag.type === 'option' && flag.env) { - const input = process.env[flag.env]; - if (input) - flags[k] = flag.parse(input, this.context); - } - if (!(k in flags) && flag.default !== undefined) { - this.metaData.flags[k] = { setFromDefault: true }; - if (typeof flag.default === 'function') { - flags[k] = flag.default(Object.assign({ options: flag, flags }, this.context)); - } - else { - flags[k] = flag.default; - } - } - } - return flags; + + // Parse url + var fullPath = buildFullPath(config.baseURL, config.url); + var parsed = url.parse(fullPath); + var protocol = parsed.protocol || 'http:'; + + if (!auth && parsed.auth) { + var urlAuth = parsed.auth.split(':'); + var urlUsername = urlAuth[0] || ''; + var urlPassword = urlAuth[1] || ''; + auth = urlUsername + ':' + urlPassword; } - _argv() { - const args = []; - const tokens = this._argTokens; - for (let i = 0; i < Math.max(this.input.args.length, tokens.length); i++) { - const token = tokens[i]; - const arg = this.input.args[i]; - if (token) { - if (arg) { - if (arg.options && !arg.options.includes(token.input)) { - throw new m.errors.ArgInvalidOptionError(arg, token.input); - } - args[i] = arg.parse(token.input); - } - else { - args[i] = token.input; - } + + if (auth) { + delete headers.Authorization; + } + + var isHttpsRequest = isHttps.test(protocol); + var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + + var options = { + path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), + method: config.method.toUpperCase(), + headers: headers, + agent: agent, + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth: auth + }; + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + } + + var proxy = config.proxy; + if (!proxy && proxy !== false) { + var proxyEnv = protocol.slice(0, -1) + '_proxy'; + var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; + if (proxyUrl) { + var parsedProxyUrl = url.parse(proxyUrl); + var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; + var shouldProxy = true; + + if (noProxyEnv) { + var noProxy = noProxyEnv.split(',').map(function trim(s) { + return s.trim(); + }); + + shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { + if (!proxyElement) { + return false; } - else if ('default' in arg) { - if (typeof arg.default === 'function') { - args[i] = arg.default(); - } - else { - args[i] = arg.default; - } + if (proxyElement === '*') { + return true; } + if (proxyElement[0] === '.' && + parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { + return true; + } + + return parsed.hostname === proxyElement; + }); } - return args; - } - _debugOutput(args, flags, argv) { - if (argv.length > 0) { - debug('argv: %o', argv); - } - if (Object.keys(args).length > 0) { - debug('args: %o', args); - } - if (Object.keys(flags).length > 0) { - debug('flags: %o', flags); + + if (shouldProxy) { + proxy = { + host: parsedProxyUrl.hostname, + port: parsedProxyUrl.port, + protocol: parsedProxyUrl.protocol + }; + + if (parsedProxyUrl.auth) { + var proxyUrlAuth = parsedProxyUrl.auth.split(':'); + proxy.auth = { + username: proxyUrlAuth[0], + password: proxyUrlAuth[1] + }; + } } + } } - _debugInput() { - debug('input: %s', this.argv.join(' ')); - if (this.input.args.length > 0) { - debug('available args: %s', this.input.args.map(a => a.name).join(' ')); - } - if (Object.keys(this.input.flags).length === 0) - return; - debug('available flags: %s', Object.keys(this.input.flags) - .map(f => `--${f}`) - .join(' ')); + + if (proxy) { + options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); + setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); } - get _argTokens() { - return this.raw.filter(o => o.type === 'arg'); + + var transport; + var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsProxy ? https : http; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + transport = isHttpsProxy ? httpsFollow : httpFollow; } - get _flagTokens() { - return this.raw.filter(o => o.type === 'flag'); + + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; } - _setNames() { - for (const k of Object.keys(this.input.flags)) { - this.input.flags[k].name = k; + + // Create the request + var req = transport.request(options, function handleResponse(res) { + if (req.aborted) return; + + // uncompress the response body transparently if required + var stream = res; + + // return the last request in case of redirects + var lastRequest = res.req || req; + + + // if no content, is HEAD request or decompress disabled we should not decompress + if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) { + switch (res.headers['content-encoding']) { + /*eslint default-case:0*/ + case 'gzip': + case 'compress': + case 'deflate': + // add the unzipper to the body stream processing pipeline + stream = stream.pipe(zlib.createUnzip()); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; } - } -} -exports.Parser = Parser; + } + var response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: res.headers, + config: config, + request: lastRequest + }; -/***/ }), + if (config.responseType === 'stream') { + response.data = stream; + settle(resolve, reject, response); + } else { + var responseBuffer = []; + stream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); -/***/ 85767: -/***/ ((__unused_webpack_module, exports) => { + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { + stream.destroy(); + reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + config, null, lastRequest)); + } + }); -"use strict"; + stream.on('error', function handleStreamError(err) { + if (req.aborted) return; + reject(enhanceError(err, config, null, lastRequest)); + }); -Object.defineProperty(exports, "__esModule", ({ value: true })); -function termwidth(stream) { - if (!stream.isTTY) { - return 80; + stream.on('end', function handleStreamEnd() { + var responseData = Buffer.concat(responseBuffer); + if (config.responseType !== 'arraybuffer') { + responseData = responseData.toString(config.responseEncoding); + if (!config.responseEncoding || config.responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); + } + } + + response.data = responseData; + settle(resolve, reject, response); + }); + } + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return; + reject(enhanceError(err, config, null, req)); + }); + + // Handle request timeout + if (config.timeout) { + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devoring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(config.timeout, function handleRequestTimeout() { + req.abort(); + reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); + }); } - const width = stream.getWindowSize()[0]; - if (width < 1) { - return 80; + + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (req.aborted) return; + + req.abort(); + reject(cancel); + }); } - if (width < 40) { - return 40; + + // Send the request + if (utils.isStream(data)) { + data.on('error', function handleStreamError(err) { + reject(enhanceError(err, config, null, req)); + }).pipe(req); + } else { + req.end(data); } - return width; -} -const columns = global.columns; -exports.stdtermwidth = columns || termwidth(process.stdout); -exports.errtermwidth = columns || termwidth(process.stderr); + }); +}; /***/ }), -/***/ 78120: -/***/ ((__unused_webpack_module, exports) => { +/***/ 3454: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -function pickBy(obj, fn) { - return Object.entries(obj) - .reduce((o, [k, v]) => { - if (fn(v)) - o[k] = v; - return o; - }, {}); -} -exports.pickBy = pickBy; -function maxBy(arr, fn) { - let max; - for (const cur of arr) { - const i = fn(cur); - if (!max || i > max.i) { - max = { i, element: cur }; - } - } - return max && max.element; -} -exports.maxBy = maxBy; -function sortBy(arr, fn) { - // function castType(t: SortTypes | SortTypes[]): string | number | SortTypes[] { - // if (t === undefined) return 0 - // if (t === false) return 1 - // if (t === true) return -1 - // return t - // } - function compare(a, b) { - a = a === undefined ? 0 : a; - b = b === undefined ? 0 : b; - if (Array.isArray(a) && Array.isArray(b)) { - if (a.length === 0 && b.length === 0) - return 0; - const diff = compare(a[0], b[0]); - if (diff !== 0) - return diff; - return compare(a.slice(1), b.slice(1)); - } - if (a < b) - return -1; - if (a > b) - return 1; - return 0; + +var utils = __webpack_require__(20328); +var settle = __webpack_require__(13211); +var cookies = __webpack_require__(21545); +var buildURL = __webpack_require__(30646); +var buildFullPath = __webpack_require__(41934); +var parseHeaders = __webpack_require__(86455); +var isURLSameOrigin = __webpack_require__(33608); +var createError = __webpack_require__(15226); + +module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + + if (utils.isFormData(requestData)) { + delete requestHeaders['Content-Type']; // Let the browser set it } - return arr.sort((a, b) => compare(fn(a), fn(b))); -} -exports.sortBy = sortBy; + var request = new XMLHttpRequest(); -/***/ }), + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); + } -/***/ 67385: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); -"use strict"; -var __webpack_unused_export__; + // Set the request timeout in MS + request.timeout = config.timeout; -__webpack_unused_export__ = ({ value: true }); -const errors_1 = __webpack_require__(52564); -const errors_2 = __webpack_require__(33925); -function validate(parse) { - function validateArgs() { - const maxArgs = parse.input.args.length; - if (parse.input.strict && parse.output.argv.length > maxArgs) { - const extras = parse.output.argv.slice(maxArgs); - throw new errors_2.UnexpectedArgsError({ parse, args: extras }); - } - const missingRequiredArgs = []; - let hasOptional = false; - parse.input.args.forEach((arg, index) => { - if (!arg.required) { - hasOptional = true; - } - else if (hasOptional) { // (required arg) check whether an optional has occured before - // optionals should follow required, not before - throw new errors_2.InvalidArgsSpecError({ parse, args: parse.input.args }); - } - if (arg.required) { - if (!parse.output.argv[index]) { - missingRequiredArgs.push(arg); - } - } - }); - if (missingRequiredArgs.length > 0) { - throw new errors_2.RequiredArgsError({ parse, args: missingRequiredArgs }); - } - } - function validateFlags() { - for (const [name, flag] of Object.entries(parse.input.flags)) { - if (parse.output.flags[name] !== undefined) { - for (const also of flag.dependsOn || []) { - if (!parse.output.flags[also]) { - throw new errors_1.CLIError(`--${also}= must also be provided when using --${name}=`); - } - } - for (const also of flag.exclusive || []) { - // do not enforce exclusivity for flags that were defaulted - if (parse.output.metadata.flags[also] && parse.output.metadata.flags[also].setFromDefault) - continue; - if (parse.output.metadata.flags[name] && parse.output.metadata.flags[name].setFromDefault) - continue; - if (parse.output.flags[also]) { - throw new errors_1.CLIError(`--${also}= cannot also be provided when using --${name}=`); - } - } - } - else if (flag.required) - throw new errors_2.RequiredFlagError({ parse, flag }); - } - } - validateArgs(); - validateFlags(); -} -exports.G = validate; + // Listen for ready state + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } -/***/ }), + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; -/***/ 33770: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + settle(resolve, reject, response); -"use strict"; + // Clean up request + request = null; + }; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const chalk = __webpack_require__(94294); -const indent = __webpack_require__(98043); -const stripAnsi = __webpack_require__(45591); -const list_1 = __webpack_require__(99847); -const util_1 = __webpack_require__(89977); -const { underline, bold, } = chalk; -let { dim, } = chalk; -if (process.env.ConEmuANSI === 'ON') { - dim = chalk.gray; -} -const wrap = __webpack_require__(57915); -class CommandHelp { - constructor(command, config, opts) { - this.command = command; - this.config = config; - this.opts = opts; - this.render = util_1.template(this); - } - generate() { - const cmd = this.command; - const flags = util_1.sortBy(Object.entries(cmd.flags || {}) - .filter(([, v]) => !v.hidden) - .map(([k, v]) => { - v.name = k; - return v; - }), f => [!f.char, f.char, f.name]); - const args = (cmd.args || []).filter(a => !a.hidden); - let output = util_1.compact([ - this.usage(flags), - this.args(args), - this.flags(flags), - this.description(), - this.aliases(cmd.aliases), - this.examples(cmd.examples || cmd.example), - ]).join('\n\n'); - if (this.opts.stripAnsi) - output = stripAnsi(output); - return output; - } - usage(flags) { - const usage = this.command.usage; - const body = (usage ? util_1.castArray(usage) : [this.defaultUsage(flags)]) - .map(u => `$ ${this.config.bin} ${u}`.trim()) - .join('\n'); - return [ - bold('USAGE'), - indent(wrap(this.render(body), this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(createError('Request aborted', config, 'ECONNABORTED', request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(createError('Network Error', config, null, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', + request)); + + // Clean up request + request = null; + }; + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; + + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } } - defaultUsage(_) { - return util_1.compact([ - this.command.id, - this.command.args.filter(a => !a.hidden).map(a => this.arg(a)).join(' '), - ]).join(' '); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); } - description() { - const cmd = this.command; - const description = cmd.description && this.render(cmd.description).split('\n').slice(1).join('\n'); - if (!description) - return; - return [ - bold('DESCRIPTION'), - indent(wrap(description.trim(), this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); + + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; } - aliases(aliases) { - if (!aliases || aliases.length === 0) - return; - const body = aliases.map(a => ['$', this.config.bin, a].join(' ')).join('\n'); - return [ - bold('ALIASES'), - indent(wrap(body, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); + + // Add responseType to request if needed + if (config.responseType) { + try { + request.responseType = config.responseType; + } catch (e) { + // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. + // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. + if (config.responseType !== 'json') { + throw e; + } + } } - examples(examples) { - if (!examples || examples.length === 0) - return; - const body = util_1.castArray(examples).map(a => this.render(a)).join('\n'); - return [ - bold('EXAMPLE' + (examples.length > 1 ? 'S' : '')), - indent(wrap(body, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); + + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); } - args(args) { - if (args.filter(a => a.description).length === 0) - return; - const body = list_1.renderList(args.map(a => { - const name = a.name.toUpperCase(); - let description = a.description || ''; - if (a.default) - description = `[default: ${a.default}] ${description}`; - if (a.options) - description = `(${a.options.join('|')}) ${description}`; - return [name, description ? dim(description) : undefined]; - }), { stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2 }); - return [ - bold('ARGUMENTS'), - indent(body, 2), - ].join('\n'); + + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); } - arg(arg) { - const name = arg.name.toUpperCase(); - if (arg.required) - return `${name}`; - return `[${name}]`; + + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (!request) { + return; + } + + request.abort(); + reject(cancel); + // Clean up request + request = null; + }); } - flags(flags) { - if (flags.length === 0) - return; - const body = list_1.renderList(flags.map(flag => { - let left = flag.helpLabel; - if (!left) { - const label = []; - if (flag.char) - label.push(`-${flag.char[0]}`); - if (flag.name) { - if (flag.type === 'boolean' && flag.allowNo) { - label.push(`--[no-]${flag.name.trim()}`); - } - else { - label.push(`--${flag.name.trim()}`); - } - } - left = label.join(', '); - } - if (flag.type === 'option') { - let value = flag.helpValue || flag.name; - if (!flag.helpValue && flag.options) { - value = flag.options.join('|'); - } - if (!value.includes('|')) - value = underline(value); - left += `=${value}`; - } - let right = flag.description || ''; - if (flag.type === 'option' && flag.default) { - right = `[default: ${flag.default}] ${right}`; - } - if (flag.required) - right = `(required) ${right}`; - return [left, dim(right.trim())]; - }), { stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2 }); - return [ - bold('OPTIONS'), - indent(body, 2), - ].join('\n'); + + if (!requestData) { + requestData = null; } + + // Send the request + request.send(requestData); + }); +}; + + +/***/ }), + +/***/ 52618: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(20328); +var bind = __webpack_require__(77065); +var Axios = __webpack_require__(98178); +var mergeConfig = __webpack_require__(74831); +var defaults = __webpack_require__(98190); + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + return instance; } -exports.default = CommandHelp; + +// Create the default instance to be exported +var axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Factory for creating new instances +axios.create = function create(instanceConfig) { + return createInstance(mergeConfig(axios.defaults, instanceConfig)); +}; + +// Expose Cancel & CancelToken +axios.Cancel = __webpack_require__(98875); +axios.CancelToken = __webpack_require__(71587); +axios.isCancel = __webpack_require__(64057); + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; +axios.spread = __webpack_require__(74850); + +// Expose isAxiosError +axios.isAxiosError = __webpack_require__(60650); + +module.exports = axios; + +// Allow use of default import syntax in TypeScript +module.exports.default = axios; /***/ }), -/***/ 46765: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 98875: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const errors_1 = __webpack_require__(52564); -const chalk = __webpack_require__(94294); -const indent = __webpack_require__(98043); -const stripAnsi = __webpack_require__(45591); -const command_1 = __webpack_require__(33770); -const list_1 = __webpack_require__(99847); -const root_1 = __webpack_require__(2178); -const screen_1 = __webpack_require__(60789); -const util_1 = __webpack_require__(89977); -const util_2 = __webpack_require__(89977); -exports.getHelpClass = util_2.getHelpClass; -const wrap = __webpack_require__(57915); -const { bold, } = chalk; -const ROOT_INDEX_CMD_ID = ''; -function getHelpSubject(args) { - for (const arg of args) { - if (arg === '--') - return; - if (arg === 'help' || arg === '--help' || arg === '-h') - continue; - if (arg.startsWith('-')) - return; - return arg; - } + +/** + * A `Cancel` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ +function Cancel(message) { + this.message = message; } -class HelpBase { - constructor(config, opts = {}) { - this.config = config; - this.opts = Object.assign({ maxWidth: screen_1.stdtermwidth }, opts); + +Cancel.prototype.toString = function toString() { + return 'Cancel' + (this.message ? ': ' + this.message : ''); +}; + +Cancel.prototype.__CANCEL__ = true; + +module.exports = Cancel; + + +/***/ }), + +/***/ 71587: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Cancel = __webpack_require__(98875); + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ +function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + var token = this; + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; } + + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); } -exports.HelpBase = HelpBase; -class Help extends HelpBase { - constructor(config, opts = {}) { - super(config, opts); - this.render = util_1.template(this); - } - /* - * _topics is to work around Config.topics mistakenly including commands that do - * not have children, as well as topics. A topic has children, either commands or other topics. When - * this is fixed upstream config.topics should return *only* topics with children, - * and this can be removed. - */ - get _topics() { - // since this.config.topics is a getter that does non-trivial work, cache it outside the filter loop for - // performance benefits in the presence of large numbers of topics - const topics = this.config.topics; - return topics.filter((topic) => { - // it is assumed a topic has a child if it has children - const hasChild = topics.some(subTopic => subTopic.name.includes(`${topic.name}:`)); - return hasChild; - }); - } - get sortedCommands() { - let commands = this.config.commands; - commands = commands.filter(c => this.opts.all || !c.hidden); - commands = util_1.sortBy(commands, c => c.id); - commands = util_1.uniqBy(commands, c => c.id); - return commands; - } - get sortedTopics() { - let topics = this._topics; - topics = topics.filter(t => this.opts.all || !t.hidden); - topics = util_1.sortBy(topics, t => t.name); - topics = util_1.uniqBy(topics, t => t.name); - return topics; - } - showHelp(argv) { - const subject = getHelpSubject(argv); - if (!subject) { - const rootCmd = this.config.findCommand(ROOT_INDEX_CMD_ID); - if (rootCmd) - this.showCommandHelp(rootCmd); - this.showRootHelp(); - return; - } - const command = this.config.findCommand(subject); - if (command) { - this.showCommandHelp(command); - return; - } - const topic = this.config.findTopic(subject); - if (topic) { - this.showTopicHelp(topic); - return; - } - errors_1.error(`command ${subject} not found`); - } - showCommandHelp(command) { - const name = command.id; - const depth = name.split(':').length; - const subTopics = this.sortedTopics.filter(t => t.name.startsWith(name + ':') && t.name.split(':').length === depth + 1); - const subCommands = this.sortedCommands.filter(c => c.id.startsWith(name + ':') && c.id.split(':').length === depth + 1); - const title = command.description && this.render(command.description).split('\n')[0]; - if (title) - console.log(title + '\n'); - console.log(this.formatCommand(command)); - console.log(''); - if (subTopics.length > 0) { - console.log(this.formatTopics(subTopics)); - console.log(''); - } - if (subCommands.length > 0) { - console.log(this.formatCommands(subCommands)); - console.log(''); - } - } - showRootHelp() { - let rootTopics = this.sortedTopics; - let rootCommands = this.sortedCommands; - console.log(this.formatRoot()); - console.log(''); - if (!this.opts.all) { - rootTopics = rootTopics.filter(t => !t.name.includes(':')); - rootCommands = rootCommands.filter(c => !c.id.includes(':')); - } - if (rootTopics.length > 0) { - console.log(this.formatTopics(rootTopics)); - console.log(''); - } - if (rootCommands.length > 0) { - rootCommands = rootCommands.filter(c => c.id); - console.log(this.formatCommands(rootCommands)); - console.log(''); - } - } - showTopicHelp(topic) { - const name = topic.name; - const depth = name.split(':').length; - const subTopics = this.sortedTopics.filter(t => t.name.startsWith(name + ':') && t.name.split(':').length === depth + 1); - const commands = this.sortedCommands.filter(c => c.id.startsWith(name + ':') && c.id.split(':').length === depth + 1); - console.log(this.formatTopic(topic)); - if (subTopics.length > 0) { - console.log(this.formatTopics(subTopics)); - console.log(''); - } - if (commands.length > 0) { - console.log(this.formatCommands(commands)); - console.log(''); - } - } - formatRoot() { - const help = new root_1.default(this.config, this.opts); - return help.root(); - } - formatCommand(command) { - const help = new command_1.default(command, this.config, this.opts); - return help.generate(); - } - formatCommands(commands) { - if (commands.length === 0) - return ''; - const body = list_1.renderList(commands.map(c => [ - c.id, - c.description && this.render(c.description.split('\n')[0]), - ]), { - spacer: '\n', - stripAnsi: this.opts.stripAnsi, - maxWidth: this.opts.maxWidth - 2, - }); - return [ - bold('COMMANDS'), - indent(body, 2), - ].join('\n'); - } - formatTopic(topic) { - let description = this.render(topic.description || ''); - const title = description.split('\n')[0]; - description = description.split('\n').slice(1).join('\n'); - let output = util_1.compact([ - title, - [ - bold('USAGE'), - indent(wrap(`$ ${this.config.bin} ${topic.name}:COMMAND`, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'), - description && ([ - bold('DESCRIPTION'), - indent(wrap(description, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n')), - ]).join('\n\n'); - if (this.opts.stripAnsi) - output = stripAnsi(output); - return output + '\n'; - } - formatTopics(topics) { - if (topics.length === 0) - return ''; - const body = list_1.renderList(topics.map(c => [ - c.name, - c.description && this.render(c.description.split('\n')[0]), - ]), { - spacer: '\n', - stripAnsi: this.opts.stripAnsi, - maxWidth: this.opts.maxWidth - 2, - }); - return [ - bold('TOPICS'), - indent(body, 2), - ].join('\n'); - } - /** - * @deprecated used for readme generation - * @param {object} command The command to generate readme help for - * @return {string} the readme help string for the given command - */ - command(command) { - return this.formatCommand(command); - } -} -exports.default = Help; -exports.Help = Help; + +/** + * Throws a `Cancel` if cancellation has been requested. + */ +CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } +}; + +/** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ +CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; +}; + +module.exports = CancelToken; /***/ }), -/***/ 99847: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 64057: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const indent = __webpack_require__(98043); -const stripAnsi = __webpack_require__(45591); -const width = __webpack_require__(42577); -const wrap = __webpack_require__(57915); -const widestLine = __webpack_require__(60866); -function renderList(input, opts) { - if (input.length === 0) { - return ''; - } - const renderMultiline = () => { - let output = ''; - for (let [left, right] of input) { - if (!left && !right) - continue; - if (left) { - if (opts.stripAnsi) - left = stripAnsi(left); - output += wrap(left.trim(), opts.maxWidth, { hard: true, trim: false }); - } - if (right) { - if (opts.stripAnsi) - right = stripAnsi(right); - output += '\n'; - output += indent(wrap(right.trim(), opts.maxWidth - 2, { hard: true, trim: false }), 4); - } - output += '\n\n'; - } - return output.trim(); - }; - if (opts.multiline) - return renderMultiline(); - const maxLength = widestLine(input.map(i => i[0]).join('\n')); - let output = ''; - let spacer = opts.spacer || '\n'; - let cur = ''; - for (const [left, r] of input) { - let right = r; - if (cur) { - output += spacer; - output += cur; - } - cur = left || ''; - if (opts.stripAnsi) - cur = stripAnsi(cur); - if (!right) { - cur = cur.trim(); - continue; - } - if (opts.stripAnsi) - right = stripAnsi(right); - right = wrap(right.trim(), opts.maxWidth - (maxLength + 2), { hard: true, trim: false }); - // right = wrap(right.trim(), screen.stdtermwidth - (maxLength + 4), {hard: true, trim: false}) - const [first, ...lines] = right.split('\n').map(s => s.trim()); - cur += ' '.repeat(maxLength - width(cur) + 2); - cur += first; - if (lines.length === 0) { - continue; - } - // if we start putting too many lines down, render in multiline format - if (lines.length > 4) - return renderMultiline(); - // if spacer is not defined, separate all rows with extra newline - if (!opts.spacer) - spacer = '\n\n'; - cur += '\n'; - cur += indent(lines.join('\n'), maxLength + 2); - } - if (cur) { - output += spacer; - output += cur; - } - return output.trim(); -} -exports.renderList = renderList; + +module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); +}; /***/ }), -/***/ 2178: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 98178: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const chalk = __webpack_require__(94294); -const indent = __webpack_require__(98043); -const stripAnsi = __webpack_require__(45591); -const util_1 = __webpack_require__(89977); -const wrap = __webpack_require__(57915); -const { bold, } = chalk; -class RootHelp { - constructor(config, opts) { - this.config = config; - this.opts = opts; - this.render = util_1.template(this); - } - root() { - let description = this.config.pjson.oclif.description || this.config.pjson.description || ''; - description = this.render(description); - description = description.split('\n')[0]; - let output = util_1.compact([ - description, - this.version(), - this.usage(), - this.description(), - ]).join('\n\n'); - if (this.opts.stripAnsi) - output = stripAnsi(output); - return output; - } - usage() { - return [ - bold('USAGE'), - indent(wrap(`$ ${this.config.bin} [COMMAND]`, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); - } - description() { - let description = this.config.pjson.oclif.description || this.config.pjson.description || ''; - description = this.render(description); - description = description.split('\n').slice(1).join('\n'); - if (!description) - return; - return [ - bold('DESCRIPTION'), - indent(wrap(description, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); - } - version() { - return [ - bold('VERSION'), - indent(wrap(this.config.userAgent, this.opts.maxWidth - 2, { trim: false, hard: true }), 2), - ].join('\n'); - } + +var utils = __webpack_require__(20328); +var buildURL = __webpack_require__(30646); +var InterceptorManager = __webpack_require__(3214); +var dispatchRequest = __webpack_require__(85062); +var mergeConfig = __webpack_require__(74831); + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ +function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; } -exports.default = RootHelp; +/** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ +Axios.prototype.request = function request(config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; + } -/***/ }), + config = mergeConfig(this.defaults, config); -/***/ 60789: -/***/ ((__unused_webpack_module, exports) => { + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } -"use strict"; + // Hook up interceptors middleware + var chain = [dispatchRequest, undefined]; + var promise = Promise.resolve(config); -Object.defineProperty(exports, "__esModule", ({ value: true })); -function termwidth(stream) { - if (!stream.isTTY) { - return 80; - } - const width = stream.getWindowSize()[0]; - if (width < 1) { - return 80; - } - if (width < 40) { - return 40; - } - return width; -} -const columns = parseInt(process.env.COLUMNS, 10) || global.columns; -exports.stdtermwidth = columns || termwidth(process.stdout); -exports.errtermwidth = columns || termwidth(process.stderr); + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + chain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + chain.push(interceptor.fulfilled, interceptor.rejected); + }); -/***/ }), + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } -/***/ 89977: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + return promise; +}; -"use strict"; +Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const ts_node_1 = __webpack_require__(39584); -const lodashTemplate = __webpack_require__(60417); -function uniqBy(arr, fn) { - return arr.filter((a, i) => { - const aVal = fn(a); - return !arr.find((b, j) => j > i && fn(b) === aVal); - }); -} -exports.uniqBy = uniqBy; -function compact(a) { - return a.filter((a) => Boolean(a)); -} -exports.compact = compact; -function castArray(input) { - if (input === undefined) - return []; - return Array.isArray(input) ? input : [input]; -} -exports.castArray = castArray; -function sortBy(arr, fn) { - function compare(a, b) { - a = a === undefined ? 0 : a; - b = b === undefined ? 0 : b; - if (Array.isArray(a) && Array.isArray(b)) { - if (a.length === 0 && b.length === 0) - return 0; - const diff = compare(a[0], b[0]); - if (diff !== 0) - return diff; - return compare(a.slice(1), b.slice(1)); - } - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - return arr.sort((a, b) => compare(fn(a), fn(b))); -} -exports.sortBy = sortBy; -function template(context) { - function render(t) { - return lodashTemplate(t)(context); - } - return render; -} -exports.template = template; -function extractExport(config, classPath) { - const helpClassPath = ts_node_1.tsPath(config.root, classPath); - return require(helpClassPath); -} -function extractClass(exported) { - return exported && exported.default ? exported.default : exported; -} -function getHelpClass(config, defaultClass = '@oclif/plugin-help') { - const pjson = config.pjson; - const configuredClass = pjson && pjson.oclif && pjson.oclif.helpClass; - if (configuredClass) { - try { - const exported = extractExport(config, configuredClass); - return extractClass(exported); - } - catch (error) { - throw new Error(`Unable to load configured help class "${configuredClass}", failed with message:\n${error.message}`); - } - } - try { - const defaultModulePath = require.resolve(defaultClass, { paths: [config.root] }); - const exported = require(defaultModulePath); - return extractClass(exported); - } - catch (error) { - throw new Error(`Could not load a help class, consider installing the @oclif/plugin-help package, failed with message:\n${error.message}`); - } -} -exports.getHelpClass = getHelpClass; +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: data + })); + }; +}); + +module.exports = Axios; /***/ }), -/***/ 87236: +/***/ 3214: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* module decorator */ module = __webpack_require__.nmd(module); - - -const wrapAnsi16 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${code + offset}m`; -}; -const wrapAnsi256 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${38 + offset};5;${code}m`; -}; -const wrapAnsi16m = (fn, offset) => (...args) => { - const rgb = fn(...args); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; +var utils = __webpack_require__(20328); -const ansi2ansi = n => n; -const rgb2rgb = (r, g, b) => [r, g, b]; +function InterceptorManager() { + this.handlers = []; +} -const setLazyProperty = (object, property, get) => { - Object.defineProperty(object, property, { - get: () => { - const value = get(); - - Object.defineProperty(object, property, { - value, - enumerable: true, - configurable: true - }); - - return value; - }, - enumerable: true, - configurable: true - }); +/** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ +InterceptorManager.prototype.use = function use(fulfilled, rejected) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected + }); + return this.handlers.length - 1; }; -/** @type {typeof import('color-convert')} */ -let colorConvert; -const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { - if (colorConvert === undefined) { - colorConvert = __webpack_require__(93130); - } +/** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ +InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } +}; - const offset = isBackground ? 10 : 0; - const styles = {}; +/** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ +InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); +}; - for (const [sourceSpace, suite] of Object.entries(colorConvert)) { - const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; - if (sourceSpace === targetSpace) { - styles[name] = wrap(identity, offset); - } else if (typeof suite === 'object') { - styles[name] = wrap(suite[targetSpace], offset); - } - } +module.exports = InterceptorManager; - return styles; -}; -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], +/***/ }), - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], +/***/ 41934: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; +"use strict"; - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; +var isAbsoluteURL = __webpack_require__(41301); +var combineURLs = __webpack_require__(57189); - group[styleName] = styles[styleName]; +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ +module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +}; - codes.set(style[0], style[1]); - } - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - } +/***/ }), - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); +/***/ 15226: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; +"use strict"; - setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); - setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); - return styles; -} +var enhanceError = __webpack_require__(21516); -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ +module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); +}; /***/ }), -/***/ 94294: +/***/ 85062: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const ansiStyles = __webpack_require__(87236); -const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(70976); -const { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -} = __webpack_require__(93715); -const {isArray} = Array; +var utils = __webpack_require__(20328); +var transformData = __webpack_require__(19812); +var isCancel = __webpack_require__(64057); +var defaults = __webpack_require__(98190); -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = [ - 'ansi', - 'ansi', - 'ansi256', - 'ansi16m' -]; +/** + * Throws a `Cancel` if cancellation has been requested. + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } +} -const styles = Object.create(null); +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ +module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); -const applyOptions = (object, options = {}) => { - if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { - throw new Error('The `level` option should be an integer from 0 to 3'); - } + // Ensure headers exist + config.headers = config.headers || {}; - // Detect level if not set manually - const colorLevel = stdoutColor ? stdoutColor.level : 0; - object.level = options.level === undefined ? colorLevel : options.level; -}; + // Transform request data + config.data = transformData( + config.data, + config.headers, + config.transformRequest + ); -class ChalkClass { - constructor(options) { - // eslint-disable-next-line no-constructor-return - return chalkFactory(options); - } -} + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); -const chalkFactory = options => { - const chalk = {}; - applyOptions(chalk, options); + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); - chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); + var adapter = config.adapter || defaults.adapter; - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); - chalk.template.constructor = () => { - throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); - }; + // Transform response data + response.data = transformData( + response.data, + response.headers, + config.transformResponse + ); - chalk.template.Instance = ChalkClass; + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); - return chalk.template; -}; + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData( + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } -function Chalk(options) { - return chalkFactory(options); -} + return Promise.reject(reason); + }); +}; -for (const [styleName, style] of Object.entries(ansiStyles)) { - styles[styleName] = { - get() { - const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); - Object.defineProperty(this, styleName, {value: builder}); - return builder; - } - }; -} -styles.visible = { - get() { - const builder = createBuilder(this, this._styler, true); - Object.defineProperty(this, 'visible', {value: builder}); - return builder; - } -}; +/***/ }), -const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; +/***/ 21516: +/***/ ((module) => { -for (const model of usedModels) { - styles[model] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} +"use strict"; -for (const model of usedModels) { - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} -const proto = Object.defineProperties(() => {}, { - ...styles, - level: { - enumerable: true, - get() { - return this._generator.level; - }, - set(level) { - this._generator.level = level; - } - } -}); +/** + * Update an Error with the specified config, error code, and response. + * + * @param {Error} error The error to update. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The error. + */ +module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; + } -const createStyler = (open, close, parent) => { - let openAll; - let closeAll; - if (parent === undefined) { - openAll = open; - closeAll = close; - } else { - openAll = parent.openAll + open; - closeAll = close + parent.closeAll; - } + error.request = request; + error.response = response; + error.isAxiosError = true; - return { - open, - close, - openAll, - closeAll, - parent - }; + error.toJSON = function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code + }; + }; + return error; }; -const createBuilder = (self, _styler, _isEmpty) => { - const builder = (...arguments_) => { - if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { - // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` - return applyStyle(builder, chalkTag(builder, ...arguments_)); - } - // Single argument is hot path, implicit coercion is faster than anything - // eslint-disable-next-line no-implicit-coercion - return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); - }; +/***/ }), - // We alter the prototype because we must return a function, but there is - // no way to create a function with a different prototype - Object.setPrototypeOf(builder, proto); +/***/ 74831: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - builder._generator = self; - builder._styler = _styler; - builder._isEmpty = _isEmpty; +"use strict"; - return builder; -}; -const applyStyle = (self, string) => { - if (self.level <= 0 || !string) { - return self._isEmpty ? '' : string; - } +var utils = __webpack_require__(20328); - let styler = self._styler; +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ +module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; - if (styler === undefined) { - return string; - } + var valueFromConfig2Keys = ['url', 'method', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; + var defaultToConfig2Keys = [ + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', + 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' + ]; + var directMergeKeys = ['validateStatus']; - const {openAll, closeAll} = styler; - if (string.indexOf('\u001B') !== -1) { - while (styler !== undefined) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - string = stringReplaceAll(string, styler.close, styler.open); + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } - styler = styler.parent; - } - } + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + } - // We can move both next actions out of loop, because remaining actions in loop won't have - // any/visible effect on parts we add here. Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 - const lfIndex = string.indexOf('\n'); - if (lfIndex !== -1) { - string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); - } + utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } + }); - return openAll + string + closeAll; -}; + utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); -let template; -const chalkTag = (chalk, ...strings) => { - const [firstString] = strings; + utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); - if (!isArray(firstString) || !isArray(firstString.raw)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return strings.join(' '); - } + utils.forEach(directMergeKeys, function merge(prop) { + if (prop in config2) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); - const arguments_ = strings.slice(1); - const parts = [firstString.raw[0]]; + var axiosKeys = valueFromConfig2Keys + .concat(mergeDeepPropertiesKeys) + .concat(defaultToConfig2Keys) + .concat(directMergeKeys); - for (let i = 1; i < firstString.length; i++) { - parts.push( - String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), - String(firstString.raw[i]) - ); - } + var otherKeys = Object + .keys(config1) + .concat(Object.keys(config2)) + .filter(function filterAxiosKeys(key) { + return axiosKeys.indexOf(key) === -1; + }); - if (template === undefined) { - template = __webpack_require__(39160); - } + utils.forEach(otherKeys, mergeDeepProperties); - return template(chalk, parts.join('')); + return config; }; -Object.defineProperties(Chalk.prototype, styles); - -const chalk = Chalk(); // eslint-disable-line new-cap -chalk.supportsColor = stdoutColor; -chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap -chalk.stderr.supportsColor = stderrColor; - -module.exports = chalk; - /***/ }), -/***/ 39160: -/***/ ((module) => { +/***/ 13211: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); +var createError = __webpack_require__(15226); -function unescape(c) { - const u = c[0] === 'u'; - const bracket = c[1] === '{'; +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ +module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + 'Request failed with status code ' + response.status, + response.config, + null, + response.request, + response + )); + } +}; - if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); - } - if (u && bracket) { - return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); - } +/***/ }), - return ESCAPES.get(c) || c; -} +/***/ 19812: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function parseArguments(name, arguments_) { - const results = []; - const chunks = arguments_.trim().split(/\s*,\s*/g); - let matches; +"use strict"; - for (const chunk of chunks) { - const number = Number(chunk); - if (!Number.isNaN(number)) { - results.push(number); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); - } - } - return results; -} +var utils = __webpack_require__(20328); -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; +/** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ +module.exports = function transformData(data, headers, fns) { + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn(data, headers); + }); - const results = []; - let matches; + return data; +}; - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); - } - } +/***/ }), - return results; -} +/***/ 98190: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function buildStyle(chalk, styles) { - const enabled = {}; +"use strict"; - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); - } - } - let current = chalk; - for (const [styleName, styles] of Object.entries(enabled)) { - if (!Array.isArray(styles)) { - continue; - } +var utils = __webpack_require__(20328); +var normalizeHeaderName = __webpack_require__(36240); - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } +var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' +}; - current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; - } +function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } +} - return current; +function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = __webpack_require__(3454); + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = __webpack_require__(68104); + } + return adapter; } -module.exports = (chalk, temporary) => { - const styles = []; - const chunks = []; - let chunk = []; +var defaults = { + adapter: getDefaultAdapter(), - // eslint-disable-next-line max-params - temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { - if (escapeCharacter) { - chunk.push(unescape(escapeCharacter)); - } else if (style) { - const string = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + if (utils.isObject(data)) { + setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); + return JSON.stringify(data); + } + return data; + }], - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(character); - } - }); + transformResponse: [function transformResponse(data) { + /*eslint no-param-reassign:0*/ + if (typeof data === 'string') { + try { + data = JSON.parse(data); + } catch (e) { /* Ignore */ } + } + return data; + }], - chunks.push(chunk.join('')); + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, - if (styles.length > 0) { - const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMessage); - } + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', - return chunks.join(''); -}; + maxContentLength: -1, + maxBodyLength: -1, + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + } +}; -/***/ }), +defaults.headers = { + common: { + 'Accept': 'application/json, text/plain, */*' + } +}; -/***/ 93715: -/***/ ((module) => { +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); -"use strict"; +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); +module.exports = defaults; -const stringReplaceAll = (string, substring, replacer) => { - let index = string.indexOf(substring); - if (index === -1) { - return string; - } - const substringLength = substring.length; - let endIndex = 0; - let returnValue = ''; - do { - returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; - endIndex = index + substringLength; - index = string.indexOf(substring, endIndex); - } while (index !== -1); +/***/ }), - returnValue += string.substr(endIndex); - return returnValue; -}; +/***/ 77065: +/***/ ((module) => { -const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { - let endIndex = 0; - let returnValue = ''; - do { - const gotCR = string[index - 1] === '\r'; - returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; - endIndex = index + 1; - index = string.indexOf('\n', endIndex); - } while (index !== -1); +"use strict"; - returnValue += string.substr(endIndex); - return returnValue; -}; -module.exports = { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex +module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; }; /***/ }), -/***/ 71406: +/***/ 30646: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* MIT license */ -/* eslint-disable no-mixed-operators */ -const cssKeywords = __webpack_require__(98660); +"use strict"; -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). -// do not use box values types (i.e. Number(), String(), etc.) -const reverseKeywords = {}; -for (const key of Object.keys(cssKeywords)) { - reverseKeywords[cssKeywords[key]] = key; +var utils = __webpack_require__(20328); + +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); } -const convert = { - rgb: {channels: 3, labels: 'rgb'}, - hsl: {channels: 3, labels: 'hsl'}, - hsv: {channels: 3, labels: 'hsv'}, - hwb: {channels: 3, labels: 'hwb'}, - cmyk: {channels: 4, labels: 'cmyk'}, - xyz: {channels: 3, labels: 'xyz'}, - lab: {channels: 3, labels: 'lab'}, - lch: {channels: 3, labels: 'lch'}, - hex: {channels: 1, labels: ['hex']}, - keyword: {channels: 1, labels: ['keyword']}, - ansi16: {channels: 1, labels: ['ansi16']}, - ansi256: {channels: 1, labels: ['ansi256']}, - hcg: {channels: 3, labels: ['h', 'c', 'g']}, - apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, - gray: {channels: 1, labels: ['gray']} -}; +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ +module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } -module.exports = convert; + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; -// Hide .channels and .labels properties -for (const model of Object.keys(convert)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); - const {channels, labels} = convert[model]; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); -} + serializedParams = parts.join('&'); + } -convert.rgb.hsl = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const min = Math.min(r, g, b); - const max = Math.max(r, g, b); - const delta = max - min; - let h; - let s; + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } - h = Math.min(h * 60, 360); + return url; +}; - if (h < 0) { - h += 360; - } - const l = (min + max) / 2; +/***/ }), - if (max === min) { - s = 0; - } else if (l <= 0.5) { - s = delta / (max + min); - } else { - s = delta / (2 - max - min); - } +/***/ 57189: +/***/ ((module) => { - return [h, s * 100, l * 100]; +"use strict"; + + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL + */ +module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; }; -convert.rgb.hsv = function (rgb) { - let rdif; - let gdif; - let bdif; - let h; - let s; - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const v = Math.max(r, g, b); - const diff = v - Math.min(r, g, b); - const diffc = function (c) { - return (v - c) / 6 / diff + 1 / 2; - }; - - if (diff === 0) { - h = 0; - s = 0; - } else { - s = diff / v; - rdif = diffc(r); - gdif = diffc(g); - bdif = diffc(b); - - if (r === v) { - h = bdif - gdif; - } else if (g === v) { - h = (1 / 3) + rdif - bdif; - } else if (b === v) { - h = (2 / 3) + gdif - rdif; - } - - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - } - - return [ - h * 360, - s * 100, - v * 100 - ]; -}; - -convert.rgb.hwb = function (rgb) { - const r = rgb[0]; - const g = rgb[1]; - let b = rgb[2]; - const h = convert.rgb.hsl(rgb)[0]; - const w = 1 / 255 * Math.min(r, Math.min(g, b)); - - b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -}; +/***/ }), -convert.rgb.cmyk = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; +/***/ 21545: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - const k = Math.min(1 - r, 1 - g, 1 - b); - const c = (1 - r - k) / (1 - k) || 0; - const m = (1 - g - k) / (1 - k) || 0; - const y = (1 - b - k) / (1 - k) || 0; +"use strict"; - return [c * 100, m * 100, y * 100, k * 100]; -}; -function comparativeDistance(x, y) { - /* - See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - */ - return ( - ((x[0] - y[0]) ** 2) + - ((x[1] - y[1]) ** 2) + - ((x[2] - y[2]) ** 2) - ); -} +var utils = __webpack_require__(20328); -convert.rgb.keyword = function (rgb) { - const reversed = reverseKeywords[rgb]; - if (reversed) { - return reversed; - } +module.exports = ( + utils.isStandardBrowserEnv() ? - let currentClosestDistance = Infinity; - let currentClosestKeyword; + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); - for (const keyword of Object.keys(cssKeywords)) { - const value = cssKeywords[keyword]; + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } - // Compute comparative distance - const distance = comparativeDistance(rgb, value); + if (utils.isString(path)) { + cookie.push('path=' + path); + } - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } - } + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } - return currentClosestKeyword; -}; + if (secure === true) { + cookie.push('secure'); + } -convert.keyword.rgb = function (keyword) { - return cssKeywords[keyword]; -}; + document.cookie = cookie.join('; '); + }, -convert.rgb.xyz = function (rgb) { - let r = rgb[0] / 255; - let g = rgb[1] / 255; - let b = rgb[2] / 255; + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, - // Assume sRGB - r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); - g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); - b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : - const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() +); - return [x * 100, y * 100, z * 100]; -}; -convert.rgb.lab = function (rgb) { - const xyz = convert.rgb.xyz(rgb); - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; +/***/ }), - x /= 95.047; - y /= 100; - z /= 108.883; +/***/ 41301: +/***/ ((module) => { - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); +"use strict"; - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); - return [l, a, b]; +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); }; -convert.hsl.rgb = function (hsl) { - const h = hsl[0] / 360; - const s = hsl[1] / 100; - const l = hsl[2] / 100; - let t2; - let t3; - let val; - if (s === 0) { - val = l * 255; - return [val, val, val]; - } +/***/ }), - if (l < 0.5) { - t2 = l * (1 + s); - } else { - t2 = l + s - l * s; - } +/***/ 60650: +/***/ ((module) => { - const t1 = 2 * l - t2; +"use strict"; - const rgb = [0, 0, 0]; - for (let i = 0; i < 3; i++) { - t3 = h + 1 / 3 * -(i - 1); - if (t3 < 0) { - t3++; - } - if (t3 > 1) { - t3--; - } +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +module.exports = function isAxiosError(payload) { + return (typeof payload === 'object') && (payload.isAxiosError === true); +}; - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } else if (2 * t3 < 1) { - val = t2; - } else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } else { - val = t1; - } - rgb[i] = val * 255; - } +/***/ }), - return rgb; -}; +/***/ 33608: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -convert.hsl.hsv = function (hsl) { - const h = hsl[0]; - let s = hsl[1] / 100; - let l = hsl[2] / 100; - let smin = s; - const lmin = Math.max(l, 0.01); +"use strict"; - l *= 2; - s *= (l <= 1) ? l : 2 - l; - smin *= lmin <= 1 ? lmin : 2 - lmin; - const v = (l + s) / 2; - const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - return [h, sv * 100, v * 100]; -}; +var utils = __webpack_require__(20328); -convert.hsv.rgb = function (hsv) { - const h = hsv[0] / 60; - const s = hsv[1] / 100; - let v = hsv[2] / 100; - const hi = Math.floor(h) % 6; +module.exports = ( + utils.isStandardBrowserEnv() ? - const f = h - Math.floor(h); - const p = 255 * v * (1 - s); - const q = 255 * v * (1 - (s * f)); - const t = 255 * v * (1 - (s * (1 - f))); - v *= 255; + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; - switch (hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -}; + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; -convert.hsv.hsl = function (hsv) { - const h = hsv[0]; - const s = hsv[1] / 100; - const v = hsv[2] / 100; - const vmin = Math.max(v, 0.01); - let sl; - let l; + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } - l = (2 - s) * v; - const lmin = (2 - s) * vmin; - sl = s * vmin; - sl /= (lmin <= 1) ? lmin : 2 - lmin; - sl = sl || 0; - l /= 2; + urlParsingNode.setAttribute('href', href); - return [h, sl * 100, l * 100]; -}; + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert.hwb.rgb = function (hwb) { - const h = hwb[0] / 360; - let wh = hwb[1] / 100; - let bl = hwb[2] / 100; - const ratio = wh + bl; - let f; + originURL = resolveURL(window.location.href); - // Wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : - const i = Math.floor(6 * h); - const v = 1 - bl; - f = 6 * h - i; + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() +); - if ((i & 0x01) !== 0) { - f = 1 - f; - } - const n = wh + f * (v - wh); // Linear interpolation +/***/ }), - let r; - let g; - let b; - /* eslint-disable max-statements-per-line,no-multi-spaces */ - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - /* eslint-enable max-statements-per-line,no-multi-spaces */ +/***/ 36240: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return [r * 255, g * 255, b * 255]; -}; +"use strict"; -convert.cmyk.rgb = function (cmyk) { - const c = cmyk[0] / 100; - const m = cmyk[1] / 100; - const y = cmyk[2] / 100; - const k = cmyk[3] / 100; - const r = 1 - Math.min(1, c * (1 - k) + k); - const g = 1 - Math.min(1, m * (1 - k) + k); - const b = 1 - Math.min(1, y * (1 - k) + k); +var utils = __webpack_require__(20328); - return [r * 255, g * 255, b * 255]; +module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); }; -convert.xyz.rgb = function (xyz) { - const x = xyz[0] / 100; - const y = xyz[1] / 100; - const z = xyz[2] / 100; - let r; - let g; - let b; - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); +/***/ }), - // Assume sRGB - r = r > 0.0031308 - ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) - : r * 12.92; +/***/ 86455: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - g = g > 0.0031308 - ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) - : g * 12.92; +"use strict"; - b = b > 0.0031308 - ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) - : b * 12.92; - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); +var utils = __webpack_require__(20328); - return [r * 255, g * 255, b * 255]; -}; +// Headers whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]; -convert.xyz.lab = function (xyz) { - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ +module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; - x /= 95.047; - y /= 100; - z /= 108.883; + if (!headers) { return parsed; } - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); - return [l, a, b]; + return parsed; }; -convert.lab.xyz = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let x; - let y; - let z; - y = (l + 16) / 116; - x = a / 500 + y; - z = y - b / 200; +/***/ }), - const y2 = y ** 3; - const x2 = x ** 3; - const z2 = z ** 3; - y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; - x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; - z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; +/***/ 74850: +/***/ ((module) => { - x *= 95.047; - y *= 100; - z *= 108.883; +"use strict"; - return [x, y, z]; -}; -convert.lab.lch = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let h; - - const hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - - if (h < 0) { - h += 360; - } - - const c = Math.sqrt(a * a + b * b); - - return [l, c, h]; +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ +module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; }; -convert.lch.lab = function (lch) { - const l = lch[0]; - const c = lch[1]; - const h = lch[2]; - - const hr = h / 360 * 2 * Math.PI; - const a = c * Math.cos(hr); - const b = c * Math.sin(hr); - - return [l, a, b]; -}; -convert.rgb.ansi16 = function (args, saturation = null) { - const [r, g, b] = args; - let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization +/***/ }), - value = Math.round(value / 50); +/***/ 20328: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (value === 0) { - return 30; - } +"use strict"; - let ansi = 30 - + ((Math.round(b / 255) << 2) - | (Math.round(g / 255) << 1) - | Math.round(r / 255)); - if (value === 2) { - ansi += 60; - } +var bind = __webpack_require__(77065); - return ansi; -}; +/*global toString:true*/ -convert.hsv.ansi16 = function (args) { - // Optimization here; we already know the value and don't need to get - // it converted for us. - return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); -}; +// utils is a library of generic helper functions non-specific to axios -convert.rgb.ansi256 = function (args) { - const r = args[0]; - const g = args[1]; - const b = args[2]; +var toString = Object.prototype.toString; - // We use the extended greyscale palette here, with the exception of - // black and white. normal palette only has 4 greyscale shades. - if (r === g && g === b) { - if (r < 8) { - return 16; - } +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ +function isArray(val) { + return toString.call(val) === '[object Array]'; +} - if (r > 248) { - return 231; - } +/** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ +function isUndefined(val) { + return typeof val === 'undefined'; +} - return Math.round(((r - 8) / 247) * 24) + 232; - } +/** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); +} - const ansi = 16 - + (36 * Math.round(r / 255 * 5)) - + (6 * Math.round(g / 255 * 5)) - + Math.round(b / 255 * 5); +/** + * Determine if a value is an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +function isArrayBuffer(val) { + return toString.call(val) === '[object ArrayBuffer]'; +} - return ansi; -}; +/** + * Determine if a value is a FormData + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ +function isFormData(val) { + return (typeof FormData !== 'undefined') && (val instanceof FormData); +} -convert.ansi16.rgb = function (args) { - let color = args % 10; +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); + } + return result; +} - // Handle greyscale - if (color === 0 || color === 7) { - if (args > 50) { - color += 3.5; - } +/** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ +function isString(val) { + return typeof val === 'string'; +} - color = color / 10.5 * 255; +/** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ +function isNumber(val) { + return typeof val === 'number'; +} - return [color, color, color]; - } +/** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ +function isObject(val) { + return val !== null && typeof val === 'object'; +} - const mult = (~~(args > 50) + 1) * 0.5; - const r = ((color & 1) * mult) * 255; - const g = (((color >> 1) & 1) * mult) * 255; - const b = (((color >> 2) & 1) * mult) * 255; +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (toString.call(val) !== '[object Object]') { + return false; + } - return [r, g, b]; -}; + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; +} -convert.ansi256.rgb = function (args) { - // Handle greyscale - if (args >= 232) { - const c = (args - 232) * 10 + 8; - return [c, c, c]; - } +/** + * Determine if a value is a Date + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ +function isDate(val) { + return toString.call(val) === '[object Date]'; +} - args -= 16; +/** + * Determine if a value is a File + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +function isFile(val) { + return toString.call(val) === '[object File]'; +} - let rem; - const r = Math.floor(args / 36) / 5 * 255; - const g = Math.floor((rem = args % 36) / 6) / 5 * 255; - const b = (rem % 6) / 5 * 255; +/** + * Determine if a value is a Blob + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ +function isBlob(val) { + return toString.call(val) === '[object Blob]'; +} - return [r, g, b]; -}; +/** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +function isFunction(val) { + return toString.call(val) === '[object Function]'; +} -convert.rgb.hex = function (args) { - const integer = ((Math.round(args[0]) & 0xFF) << 16) - + ((Math.round(args[1]) & 0xFF) << 8) - + (Math.round(args[2]) & 0xFF); +/** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ +function isStream(val) { + return isObject(val) && isFunction(val.pipe); +} - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; +/** + * Determine if a value is a URLSearchParams object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +function isURLSearchParams(val) { + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; +} -convert.hex.rgb = function (args) { - const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); - if (!match) { - return [0, 0, 0]; - } +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ +function trim(str) { + return str.replace(/^\s*/, '').replace(/\s*$/, ''); +} - let colorString = match[0]; +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ +function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); +} - if (match[0].length === 3) { - colorString = colorString.split('').map(char => { - return char + char; - }).join(''); - } +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ +function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } - const integer = parseInt(colorString, 16); - const r = (integer >> 16) & 0xFF; - const g = (integer >> 8) & 0xFF; - const b = integer & 0xFF; + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } - return [r, g, b]; -}; + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } +} -convert.rgb.hcg = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const max = Math.max(Math.max(r, g), b); - const min = Math.min(Math.min(r, g), b); - const chroma = (max - min); - let grayscale; - let hue; +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; +} - if (chroma <= 0) { - hue = 0; - } else - if (max === r) { - hue = ((g - b) / chroma) % 6; - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma; - } +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ +function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; +} - hue /= 6; - hue %= 1; +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} - return [hue * 360, chroma * 100, grayscale * 100]; +module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isPlainObject: isPlainObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM }; -convert.hsl.hcg = function (hsl) { - const s = hsl[1] / 100; - const l = hsl[2] / 100; - const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); +/***/ }), - let f = 0; - if (c < 1.0) { - f = (l - 0.5 * c) / (1.0 - c); - } +/***/ 68959: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - return [hsl[0], c * 100, f * 100]; -}; +"use strict"; -convert.hsv.hcg = function (hsv) { - const s = hsv[1] / 100; - const v = hsv[2] / 100; - - const c = s * v; - let f = 0; - - if (c < 1.0) { - f = (v - c) / (1 - c); - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const errors_1 = __webpack_require__(52564); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(38707)); +const debug_1 = tslib_1.__importDefault(__webpack_require__(38237)); +const debug = debug_1.default('bump-cli:api-client'); +class APIError extends errors_1.CLIError { + constructor(httpError, info = [], exit = 100) { + var _a, _b; + const status = (_a = httpError === null || httpError === void 0 ? void 0 : httpError.response) === null || _a === void 0 ? void 0 : _a.status; + debug(httpError); + switch ((_b = httpError === null || httpError === void 0 ? void 0 : httpError.response) === null || _b === void 0 ? void 0 : _b.status) { + case 422: + [info, exit] = APIError.invalidDefinition(httpError.response.data); + break; + case 401: + [info, exit] = APIError.unauthenticated(); + break; + case 404: + case 400: + [info, exit] = APIError.notFound(httpError.response.data); + break; + } + if (info.length) { + super(info.join('\n')); + } + else { + super(`Unhandled API error (status: ${status})`); + } + this.exitCode = exit; + this.http = httpError; + } + static is(error) { + return error instanceof errors_1.CLIError && 'http' in error; + } + static notFound(error) { + const genericMessage = error.message || "It seems the documentation provided doesn't exist."; + return [ + [ + genericMessage, + `Please check the given ${chalk_1.default.underline('--documentation')}, ${chalk_1.default.underline('--token')} or ${chalk_1.default.underline('--hub')} flags`, + ], + 104, + ]; + } + static invalidDefinition(error) { + let info = []; + const genericMessage = error.message || 'Invalid definition file'; + const exit = 122; + if (error && 'errors' in error) { + for (const [attr, message] of Object.entries(error.errors)) { + info = info.concat(APIError.humanAttributeError(attr, message)); + } + } + else { + info.push(genericMessage); + } + return [info, exit]; + } + static humanAttributeError(attribute, messages) { + let info = []; + if (messages instanceof Array) { + const allMessages = messages + .map((message, idx) => { + if (message instanceof Object) { + return this.humanAttributeError(idx.toString(), message); + } + else { + return message; + } + }) + .join(', '); + info.push(`${chalk_1.default.underline(attribute)} ${allMessages}`); + } + else if (messages instanceof Object) { + for (const [child, child_messages] of Object.entries(messages)) { + info = info.concat(this.humanAttributeError(`${attribute}.${child}`, child_messages)); + } + } + else if (messages) { + info.push(`${chalk_1.default.underline(attribute)} ${messages}`); + } + return info; + } + static unauthenticated() { + return [ + [ + 'You are not allowed to deploy to this documentation.', + 'please check your --token flag or BUMP_TOKEN variable', + ], + 101, + ]; + } +} +exports.default = APIError; - return [hsv[0], c * 100, f * 100]; -}; -convert.hcg.rgb = function (hcg) { - const h = hcg[0] / 360; - const c = hcg[1] / 100; - const g = hcg[2] / 100; +/***/ }), - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } +/***/ 32035: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - const pure = [0, 0, 0]; - const hi = (h % 1) * 6; - const v = hi % 1; - const w = 1 - v; - let mg = 0; +"use strict"; - /* eslint-disable max-statements-per-line */ - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; - } - /* eslint-enable max-statements-per-line */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.APIError = exports.BumpApi = void 0; +const tslib_1 = __webpack_require__(75636); +const axios_1 = tslib_1.__importDefault(__webpack_require__(96545)); +const vars_1 = __webpack_require__(52784); +const error_1 = tslib_1.__importDefault(__webpack_require__(68959)); +exports.APIError = error_1.default; +class BumpApi { + // Check https://oclif.io/docs/config for details about Config.IConfig + constructor(config) { + this.config = config; + this.getPing = () => { + return this.client.get('/ping'); + }; + this.postPreview = (body) => { + return this.client.post('/previews', body); + }; + this.postVersion = (body, token) => { + return this.client.post('/versions', body, { + headers: this.authorizationHeader(token), + }); + }; + this.postValidation = (body, token) => { + return this.client.post('/validations', body, { + headers: this.authorizationHeader(token), + }); + }; + this.initializeResponseInterceptor = () => { + this.client.interceptors.response.use((data) => data, this.handleError); + }; + this.handleError = (error) => Promise.reject(new error_1.default(error)); + this.authorizationHeader = (token) => { + return { Authorization: `Basic ${Buffer.from(token).toString('base64')}` }; + }; + const baseURL = `${vars_1.vars.apiUrl}${vars_1.vars.apiBasePath}`; + const headers = { + 'User-Agent': vars_1.vars.apiUserAgent(config.userAgent), + }; + this.client = axios_1.default.create({ + baseURL, + headers, + }); + this.initializeResponseInterceptor(); + } +} +exports.BumpApi = BumpApi; +tslib_1.__exportStar(__webpack_require__(44437), exports); - mg = (1.0 - c) * g; - return [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; -}; +/***/ }), -convert.hcg.hsv = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; +/***/ 44437: +/***/ ((__unused_webpack_module, exports) => { - const v = c + g * (1.0 - c); - let f = 0; +"use strict"; - if (v > 0.0) { - f = c / v; - } +Object.defineProperty(exports, "__esModule", ({ value: true })); - return [hcg[0], f * 100, v * 100]; -}; -convert.hcg.hsl = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; +/***/ }), - const l = g * (1.0 - c) + 0.5 * c; - let s = 0; +/***/ 52784: +/***/ ((__unused_webpack_module, exports) => { - if (l > 0.0 && l < 0.5) { - s = c / (2 * l); - } else - if (l >= 0.5 && l < 1.0) { - s = c / (2 * (1 - l)); - } +"use strict"; - return [hcg[0], s * 100, l * 100]; -}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.vars = exports.Vars = void 0; +class Vars { + get host() { + return this.envHost || 'bump.sh'; + } + get envHost() { + return process.env.BUMP_HOST; + } + apiUserAgent(base) { + const content = [base, process.env.BUMP_USER_AGENT].filter(Boolean); + return content.join(' '); + } + get apiUrl() { + return this.host.startsWith('http') ? this.host : `https://${this.host}`; + } + get apiBasePath() { + return '/api/v1'; + } +} +exports.Vars = Vars; +exports.vars = new Vars(); -convert.hcg.hwb = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - const v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; -}; -convert.hwb.hcg = function (hwb) { - const w = hwb[1] / 100; - const b = hwb[2] / 100; - const v = 1 - b; - const c = v - w; - let g = 0; +/***/ }), - if (c < 1) { - g = (v - c) / (1 - c); - } +/***/ 12364: +/***/ ((__unused_webpack_module, exports) => { - return [hwb[0], c * 100, g * 100]; -}; +"use strict"; -convert.apple.rgb = function (apple) { - return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fileArg = void 0; +const fileArg = { + name: 'FILE', + required: true, + description: 'Path or URL to your API documentation file. OpenAPI (2.0 to 3.1.0) and AsyncAPI (2.0) specifications are currently supported.', }; +exports.fileArg = fileArg; -convert.rgb.apple = function (rgb) { - return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; -}; -convert.gray.rgb = function (args) { - return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; -}; +/***/ }), -convert.gray.hsl = function (args) { - return [0, 0, args[0]]; -}; +/***/ 70740: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -convert.gray.hsv = convert.gray.hsl; +"use strict"; -convert.gray.hwb = function (gray) { - return [0, 100, gray[0]]; -}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.cli = void 0; +const tslib_1 = __webpack_require__(75636); +const cli_ux_1 = tslib_1.__importDefault(__webpack_require__(81982)); +const success_1 = tslib_1.__importDefault(__webpack_require__(98087)); +if (process.env.BUMP_LOG_LEVEL) { + const logLevel = process.env.BUMP_LOG_LEVEL; + cli_ux_1.default.config['outputLevel'] = logLevel; +} +const cli = Object.assign(Object.assign({}, cli_ux_1.default), { get styledSuccess() { + return success_1.default; + } }); +exports.cli = cli; -convert.gray.cmyk = function (gray) { - return [0, 0, 0, gray[0]]; -}; -convert.gray.lab = function (gray) { - return [gray[0], 0, 0]; -}; +/***/ }), -convert.gray.hex = function (gray) { - const val = Math.round(gray[0] / 100 * 255) & 0xFF; - const integer = (val << 16) + (val << 8) + val; +/***/ 98087: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; +"use strict"; -convert.rgb.gray = function (rgb) { - const val = (rgb[0] + rgb[1] + rgb[2]) / 3; - return [val / 255 * 100]; -}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(38707)); +function styledSuccess(message) { + const lines = message.split('\n'); + for (let i = 0; i < lines.length; i++) { + process.stdout.write(chalk_1.default.green(`* ${lines[i]}\n`)); + } +} +exports.default = styledSuccess; /***/ }), -/***/ 93130: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const conversions = __webpack_require__(71406); -const route = __webpack_require__(57845); +/***/ 268: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const convert = {}; +"use strict"; -const models = Object.keys(conversions); +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const command_1 = __webpack_require__(82708); +const debug_1 = tslib_1.__importDefault(__webpack_require__(38237)); +const definition_1 = __webpack_require__(53524); +const api_1 = __webpack_require__(32035); +const package_json_1 = tslib_1.__importDefault(__webpack_require__(68051)); +class Command extends command_1.Command { + constructor() { + super(...arguments); + this.base = `${package_json_1.default.name}@${package_json_1.default.version}`; + } + get bump() { + if (!this._bump) + this._bump = new api_1.BumpApi(this.config); + return this._bump; + } + async catch(error) { + if (error && api_1.APIError.is(error)) { + this.error(error.message, { exit: error.exitCode }); + } + throw error; + } + d(message) { + return debug_1.default(`bump-cli:command:${this.constructor.name.toLowerCase()}`)(message); + } + async prepareDefinition(filepath) { + const api = await definition_1.API.loadAPI(filepath); + const references = []; + this.d(`${filepath} looks like an ${api.specName} spec version ${api.version}`); + for (let i = 0; i < api.references.length; i++) { + const reference = api.references[i]; + references.push({ + location: reference.location, + content: reference.content, + }); + } + return [api.rawDefinition, references]; + } +} +exports.default = Command; -function wrapRaw(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - if (arg0 === undefined || arg0 === null) { - return arg0; - } - if (arg0.length > 1) { - args = arg0; - } +/***/ }), - return fn(args); - }; +/***/ 77402: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } +"use strict"; - return wrappedFn; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const command_1 = tslib_1.__importDefault(__webpack_require__(268)); +const flags = tslib_1.__importStar(__webpack_require__(63594)); +const args_1 = __webpack_require__(12364); +const cli_1 = __webpack_require__(70740); +class Deploy extends command_1.default { + /* + Oclif doesn't type parsed args & flags correctly and especially + required-ness which is not known by the compiler, thus the use of + the non-null assertion '!' in this command. + See https://github.com/oclif/oclif/issues/301 for details + */ + async run() { + const { args, flags } = this.parse(Deploy); + const [definition, references] = await this.prepareDefinition(args.FILE); + const action = flags['dry-run'] ? 'validate' : 'deploy'; + /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */ + const [documentation, token] = [flags.doc, flags.token]; + cli_1.cli.action.start(`* Let's ${action} a new documentation version on Bump`); + const request = { + documentation, + hub: flags.hub, + documentation_name: flags['doc-name'], + auto_create_documentation: flags['auto-create'] && !flags['dry-run'], + definition, + references, + }; + const response = flags['dry-run'] + ? await this.bump.postValidation(request, token) + : await this.bump.postVersion(request, token); + cli_1.cli.action.stop(); + switch (response.status) { + case 200: + cli_1.cli.styledSuccess('Definition is valid'); + break; + case 201: + const version = response.data + ? response.data + : { doc_public_url: 'https://bump.sh' }; + cli_1.cli.styledSuccess(`Your new documentation version will soon be ready at ${version.doc_public_url}`); + break; + case 204: + this.warn('Your documentation has not changed!'); + break; + } + return; + } } +exports.default = Deploy; +Deploy.description = 'create a new version of your documentation from the given file or URL'; +Deploy.examples = [ + `Deploy a new version of an existing documentation -function wrapRounded(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - - if (arg0 === undefined || arg0 === null) { - return arg0; - } - - if (arg0.length > 1) { - args = arg0; - } +$ bump deploy FILE --doc --token +* Let's deploy a new documentation version on Bump... done +* Your new documentation version will soon be ready +`, + `Deploy a new version of an existing documentation attached to a hub - const result = fn(args); +$ bump deploy FILE --doc --hub --token +* Let's deploy a new documentation version on Bump... done +* Your new documentation version will soon be ready +`, + `Validate a new documentation version before deploying it - // We're assuming the result is an array here. - // see notice in conversions.js; don't use box types - // in conversion functions. - if (typeof result === 'object') { - for (let len = result.length, i = 0; i < len; i++) { - result[i] = Math.round(result[i]); - } - } +$ bump deploy FILE --dry-run --doc --token +* Let's validate a new documentation version on Bump... done +* Definition is valid +`, +]; +Deploy.flags = { + help: flags.help({ char: 'h' }), + doc: flags.doc(), + 'doc-name': flags.docName(), + hub: flags.hub(), + token: flags.token(), + 'auto-create': flags.autoCreate(), + 'dry-run': flags.dryRun(), +}; +Deploy.args = [args_1.fileArg]; - return result; - }; - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } +/***/ }), - return wrappedFn; -} +/***/ 5363: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -models.forEach(fromModel => { - convert[fromModel] = {}; +"use strict"; - Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(75636); +const command_1 = tslib_1.__importDefault(__webpack_require__(268)); +const flags = tslib_1.__importStar(__webpack_require__(63594)); +const args_1 = __webpack_require__(12364); +const cli_1 = __webpack_require__(70740); +class Preview extends command_1.default { + async run() { + const { args } = this.parse(Preview); + const [definition, references] = await this.prepareDefinition(args.FILE); + cli_1.cli.action.start("* Let's render a preview on Bump"); + const request = { + definition, + references, + }; + const response = await this.bump.postPreview(request); + cli_1.cli.action.stop(); + cli_1.cli.styledSuccess(`Your preview is visible at: ${response.data.public_url} (Expires at ${response.data.expires_at})`); + return; + } +} +exports.default = Preview; +Preview.description = 'create a documentation preview from the given file or URL'; +Preview.examples = [ + `$ bump preview FILE +* Your preview is visible at: https://bump.sh/preview/45807371-9a32-48a7-b6e4-1cb7088b5b9b +`, +]; +Preview.flags = { + help: flags.help({ char: 'h' }), +}; +Preview.args = [args_1.fileArg]; - const routes = route(fromModel); - const routeModels = Object.keys(routes); - routeModels.forEach(toModel => { - const fn = routes[toModel]; +/***/ }), - convert[fromModel][toModel] = wrapRounded(fn); - convert[fromModel][toModel].raw = wrapRaw(fn); - }); +/***/ 53524: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.API = void 0; +const tslib_1 = __webpack_require__(75636); +const errors_1 = __webpack_require__(52564); +const json_schema_ref_parser_1 = tslib_1.__importDefault(__webpack_require__(85862)); +const options_1 = __webpack_require__(36608); +const specs_1 = tslib_1.__importDefault(__webpack_require__(78100)); +const path_1 = tslib_1.__importDefault(__webpack_require__(85622)); +class SupportedFormat { +} +SupportedFormat.openapi = { + '2.0.x': __webpack_require__(65359), + '3.0.x': __webpack_require__(3486), + '3.1.x': __webpack_require__(393), +}; +SupportedFormat.asyncapi = { + '2.0.0': specs_1.default['2.0.0'], +}; +class UnsupportedFormat extends errors_1.CLIError { + constructor(message = '') { + const compatOpenAPI = Object.keys(SupportedFormat.openapi).join(', '); + const compatAsyncAPI = Object.keys(SupportedFormat.asyncapi).join(', '); + const errorMsgs = [ + `Unsupported API specification (${message})`, + `Please try again with an OpenAPI ${compatOpenAPI} or AsyncAPI ${compatAsyncAPI} format.`, + ]; + super(errorMsgs.join('\n')); + } +} +class API { + constructor(location, $refs) { + this.location = location; + this.references = []; + const [raw, parsed] = this.resolveContent($refs); + this.rawDefinition = raw; + this.definition = parsed; + this.specName = this.getSpecName(parsed); + this.version = this.getVersion(parsed); + this.spec = this.getSpec(parsed); + if (this.spec === undefined) { + throw new UnsupportedFormat(`${this.specName} ${this.version}`); + } + } + getSpec(definition) { + if (API.isAsyncAPI(definition)) { + return SupportedFormat.asyncapi[this.version]; + } + else { + return SupportedFormat.openapi[this.versionWithoutPatch()]; + } + } + getSpecName(definition) { + if (API.isAsyncAPI(definition)) { + return 'AsyncAPI'; + } + else { + return 'OpenAPI'; + } + } + getVersion(definition) { + if (API.isAsyncAPI(definition)) { + return definition.asyncapi; + } + else { + return (definition.openapi || definition.swagger); + } + } + versionWithoutPatch() { + const [major, minor] = this.version.split('.', 3); + return `${major}.${minor}.x`; + } + /* Resolve reference absolute paths to the main api location when possible */ + resolveRelativeLocation(absPath) { + const url = (location) => { + try { + return new URL(location); + } + catch (_a) { + return { hostname: '' }; + } + }; + const definitionUrl = url(this.location); + const refUrl = url(absPath); + if (absPath.match(/^\//) || + (absPath.match(/^https?:\/\//) && definitionUrl.hostname === refUrl.hostname)) { + return path_1.default.relative(path_1.default.dirname(this.location), absPath); + } + else { + return absPath; + } + } + resolveContent($refs) { + const values = $refs.values(); + let mainReference = { parsed: {}, raw: '' }; + for (const [absPath, reference] of Object.entries(values)) { + if (absPath === this.location || absPath === path_1.default.resolve(this.location)) { + // $refs.values is not properly typed so we need to force it + // with the resulting type of our custom defined parser + mainReference = reference; + } + else { + // $refs.values is not properly typed so we need to force it + // with the resulting type of our custom defined parser + const { raw } = reference; + if (!raw) { + throw new UnsupportedFormat('Reference ${absPath} is empty'); + } + this.references.push({ + location: this.resolveRelativeLocation(absPath), + content: raw, + }); + } + } + const { raw, parsed } = mainReference; + if (!parsed || !(parsed instanceof Object) || !('info' in parsed)) { + throw new UnsupportedFormat("Definition needs to be an object with at least an 'info' key"); + } + if (!API.isOpenAPI(parsed) && !API.isAsyncAPI(parsed)) { + throw new UnsupportedFormat(); + } + return [raw, parsed]; + } + static isOpenAPI(definition) { + return (typeof definition.openapi === 'string' || typeof definition.swagger === 'string'); + } + static isAsyncAPI(definition) { + return 'asyncapi' in definition; + } + static async loadAPI(path) { + const JSONParser = options_1.defaults.parse.json; + const YAMLParser = options_1.defaults.parse.yaml; + // We override the default parsers from $RefParser to be able + // to keep the raw content of the files parsed + const withRawTextParser = (parser) => { + return Object.assign(Object.assign({}, parser), { parse: async (file) => { + const parsed = (await parser.parse(file)); + return { parsed, raw: options_1.defaults.parse.text.parse(file) }; + } }); + }; + return json_schema_ref_parser_1.default + .resolve(path, { + parse: { + json: withRawTextParser(JSONParser), + yaml: withRawTextParser(YAMLParser), + }, + dereference: { circular: false }, + }) + .then(($refs) => { + return new API(path, $refs); + }) + .catch((err) => { + throw new errors_1.CLIError(err); + }); + } +} +exports.API = API; + + +/***/ }), + +/***/ 63594: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dryRun = exports.autoCreate = exports.token = exports.hub = exports.docName = exports.doc = void 0; +const tslib_1 = __webpack_require__(75636); +const command_1 = __webpack_require__(82708); +// Re-export oclif flags https://oclif.io/docs/flags +tslib_1.__exportStar(__webpack_require__(25754), exports); +// Custom flags for bum-cli +const doc = command_1.flags.build({ + char: 'd', + required: true, + description: 'Documentation public id or slug. Can be provided via BUMP_ID environment variable', + default: () => { + const envDoc = process.env.BUMP_ID; + if (envDoc) + return envDoc; + // Search doc id in .bump/config.json file? + }, +}); +exports.doc = doc; +const docName = command_1.flags.build({ + char: 'n', + description: 'Documentation name. Used with --auto-create flag.', + dependsOn: ['auto-create'], +}); +exports.docName = docName; +const hub = command_1.flags.build({ + char: 'b', + description: 'Hub id or slug. Can be provided via BUMP_HUB_ID environment variable', + default: () => { + const envHub = process.env.BUMP_HUB_ID; + if (envHub) + return envHub; + // Search hub id in .bump/config.json file? + }, +}); +exports.hub = hub; +const token = command_1.flags.build({ + char: 't', + required: true, + description: 'Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable', + default: () => { + const envToken = process.env.BUMP_TOKEN; + if (envToken) + return envToken; + }, }); +exports.token = token; +const autoCreate = (options = {}) => { + return command_1.flags.boolean(Object.assign({ description: 'Automatically create the documentation if needed (only available with a --hub flag). Documentation name can be provided with --doc-name flag. Default: false', dependsOn: ['hub'] }, options)); +}; +exports.autoCreate = autoCreate; +const dryRun = (options = {}) => { + return command_1.flags.boolean(Object.assign({ description: 'Validate a new documentation version. Does everything a normal deploy would do except publishing the new version. Useful in automated environments such as test platforms or continuous integration. Default: false' }, options)); +}; +exports.dryRun = dryRun; -module.exports = convert; + +/***/ }), + +/***/ 59581: +/***/ ((module) => { + +"use strict"; + + +var next = (global.process && process.nextTick) || global.setImmediate || function (f) { + setTimeout(f, 0) +} + +module.exports = function maybe (cb, promise) { + if (cb) { + promise + .then(function (result) { + next(function () { cb(null, result) }) + }, function (err) { + next(function () { cb(err) }) + }) + return undefined + } + else { + return promise + } +} /***/ }), -/***/ 57845: +/***/ 76021: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const conversions = __webpack_require__(71406); +"use strict"; -/* - This function routes a model to all other models. - all functions that are routed have a property `.conversion` attached - to the returned synthetic function. This property is an array - of strings, each with the steps in between the 'from' and 'to' - color models (inclusive). +module.exports = { + highlight: __webpack_require__(4621) + , highlightFile: __webpack_require__(41189) + , highlightFileSync: __webpack_require__(22611) +} - conversions that are not possible simply are not included. -*/ -function buildGraph() { - const graph = {}; - // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - const models = Object.keys(conversions); +/***/ }), - for (let len = models.length, i = 0; i < len; i++) { - graph[models[i]] = { - // http://jsperf.com/1-vs-infinity - // micro-opt, but this is simple. - distance: -1, - parent: null - }; - } +/***/ 4621: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return graph; +"use strict"; + + +var redeyed = __webpack_require__(6818) +var theme = __webpack_require__(9867) +var colors = __webpack_require__(26218) + +var colorSurround = colors.brightBlack +var surroundClose = '\u001b[39m' + +function trimEmptyLines(lines) { + // remove lines from the end until we find a non-empy one + var line = lines.pop() + while (!line || !line.length) { + line = lines.pop() } -// https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - const graph = buildGraph(); - const queue = [fromModel]; // Unshift -> queue -> pop + // put the non-empty line back + if (line) lines.push(line) +} - graph[fromModel].distance = 0; +function addLinenos(highlightedCode, firstline) { + var highlightedLines = highlightedCode.split('\n') - while (queue.length) { - const current = queue.pop(); - const adjacents = Object.keys(conversions[current]); + trimEmptyLines(highlightedLines) - for (let len = adjacents.length, i = 0; i < len; i++) { - const adjacent = adjacents[i]; - const node = graph[adjacent]; + var linesLen = highlightedLines.length + var lines = [] + var totalDigits + var lineno - if (node.distance === -1) { - node.distance = graph[current].distance + 1; - node.parent = current; - queue.unshift(adjacent); - } - } - } + function getDigits(n) { + if (n < 10) return 1 + if (n < 100) return 2 + if (n < 1000) return 3 + if (n < 10000) return 4 + // this works for up to 99,999 lines - any questions? + return 5 + } - return graph; + function pad(n, totalDigits) { + // not pretty, but simple and should perform quite well + var padDigits = totalDigits - getDigits(n) + switch (padDigits) { + case 0: return '' + n + case 1: return ' ' + n + case 2: return ' ' + n + case 3: return ' ' + n + case 4: return ' ' + n + case 5: return ' ' + n + } + } + + totalDigits = getDigits(linesLen + firstline - 1) + + for (var i = 0; i < linesLen; i++) { + // Don't close the escape sequence here in order to not break multi line code highlights like block comments + lineno = colorSurround(pad(i + firstline, totalDigits) + ': ').replace(surroundClose, '') + lines.push(lineno + highlightedLines[i]) + } + + return lines.join('\n') } -function link(from, to) { - return function (args) { - return to(from(args)); - }; +module.exports = function highlight(code, opts) { + opts = opts || { } + try { + var result = redeyed(code, opts.theme || theme, { jsx: !!opts.jsx }) + var firstline = opts.firstline && !isNaN(opts.firstline) ? opts.firstline : 1 + + return opts.linenos ? addLinenos(result.code, firstline) : result.code + } catch (e) { + e.message = 'Unable to perform highlight. The code contained syntax errors: ' + e.message + throw e + } } -function wrapConversion(toModel, graph) { - const path = [graph[toModel].parent, toModel]; - let fn = conversions[graph[toModel].parent][toModel]; - let cur = graph[toModel].parent; - while (graph[cur].parent) { - path.unshift(graph[cur].parent); - fn = link(conversions[graph[cur].parent][cur], fn); - cur = graph[cur].parent; - } +/***/ }), - fn.conversion = path; - return fn; -} +/***/ 41189: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function (fromModel) { - const graph = deriveBFS(fromModel); - const conversion = {}; +"use strict"; - const models = Object.keys(graph); - for (let len = models.length, i = 0; i < len; i++) { - const toModel = models[i]; - const node = graph[toModel]; - if (node.parent === null) { - // No possible conversion, or this node is the source model. - continue; - } +var fs = __webpack_require__(35747) +var highlight = __webpack_require__(4621) - conversion[toModel] = wrapConversion(toModel, graph); - } +function isFunction(obj) { + return toString.call(obj) === '[object Function]' +} - return conversion; -}; +module.exports = function highlightFile(fullPath, opts, cb) { + if (isFunction(opts)) { + cb = opts + opts = { } + } + opts = opts || { } + fs.readFile(fullPath, 'utf-8', function(err, code) { + if (err) return cb(err) + try { + cb(null, highlight(code, opts)) + } catch (e) { + cb(e) + } + }) +} /***/ }), -/***/ 98660: -/***/ ((module) => { +/***/ 22611: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; - - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; - - -/***/ }), - -/***/ 85815: -/***/ ((module) => { -"use strict"; +var fs = __webpack_require__(35747) +var highlight = __webpack_require__(4621) -module.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); -}; +module.exports = function highlightFileSync(fullPath, opts) { + var code = fs.readFileSync(fullPath, 'utf-8') + opts = opts || { } + return highlight(code, opts) +} /***/ }), -/***/ 35565: -/***/ ((module) => { - -"use strict"; +/***/ 9867: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* eslint-disable yoda */ -module.exports = x => { - if (Number.isNaN(x)) { - return false; - } +var colors = __webpack_require__(26218) - // code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - x >= 0x1100 && ( - x <= 0x115f || // Hangul Jamo - x === 0x2329 || // LEFT-POINTING ANGLE BRACKET - x === 0x232a || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= x && x <= 0x4dbf) || - // CJK Unified Ideographs .. Yi Radicals - (0x4e00 <= x && x <= 0xa4c6) || - // Hangul Jamo Extended-A - (0xa960 <= x && x <= 0xa97c) || - // Hangul Syllables - (0xac00 <= x && x <= 0xd7a3) || - // CJK Compatibility Ideographs - (0xf900 <= x && x <= 0xfaff) || - // Vertical Forms - (0xfe10 <= x && x <= 0xfe19) || - // CJK Compatibility Forms .. Small Form Variants - (0xfe30 <= x && x <= 0xfe6b) || - // Halfwidth and Fullwidth Forms - (0xff01 <= x && x <= 0xff60) || - (0xffe0 <= x && x <= 0xffe6) || - // Kana Supplement - (0x1b000 <= x && x <= 0x1b001) || - // Enclosed Ideographic Supplement - (0x1f200 <= x && x <= 0x1f251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= x && x <= 0x3fffd) - ) - ) { - return true; - } +// Change the below definitions in order to tweak the color theme. +module.exports = { - return false; -}; + 'Boolean': { + 'true' : undefined + , 'false' : undefined + , _default : colors.brightRed + } + , 'Identifier': { + 'undefined' : colors.brightBlack + , 'self' : colors.brightRed + , 'console' : colors.blue + , 'log' : colors.blue + , 'warn' : colors.red + , 'error' : colors.brightRed + , _default : colors.white + } -/***/ }), + , 'Null': { + _default: colors.brightBlack + } -/***/ 70976: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + , 'Numeric': { + _default: colors.blue + } -"use strict"; + , 'String': { + _default: function(s, info) { + var nextToken = info.tokens[info.tokenIndex + 1] -const os = __webpack_require__(12087); -const tty = __webpack_require__(33867); -const hasFlag = __webpack_require__(85815); + // show keys of object literals and json in different color + return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':') + ? colors.green(s) + : colors.brightGreen(s) + } + } -const {env} = process; + , 'Keyword': { + 'break' : undefined -let 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; -} + , 'case' : undefined + , 'catch' : colors.cyan + , 'class' : undefined + , 'const' : undefined + , 'continue' : undefined -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); - } -} + , 'debugger' : undefined + , 'default' : undefined + , 'delete' : colors.red + , 'do' : undefined -function translateLevel(level) { - if (level === 0) { - return false; - } + , 'else' : undefined + , 'enum' : undefined + , 'export' : undefined + , 'extends' : undefined - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} + , 'finally' : colors.cyan + , 'for' : undefined + , 'function' : undefined -function supportsColor(haveStream, streamIsTTY) { - if (forceColor === 0) { - return 0; - } + , 'if' : undefined + , 'implements' : undefined + , 'import' : undefined + , 'in' : undefined + , 'instanceof' : undefined + , 'let' : undefined + , 'new' : colors.red + , 'package' : undefined + , 'private' : undefined + , 'protected' : undefined + , 'public' : undefined + , 'return' : colors.red + , 'static' : undefined + , 'super' : undefined + , 'switch' : undefined - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } + , 'this' : colors.brightRed + , 'throw' : undefined + , 'try' : colors.cyan + , 'typeof' : undefined - if (hasFlag('color=256')) { - return 2; - } + , 'var' : colors.green + , 'void' : undefined - if (haveStream && !streamIsTTY && forceColor === undefined) { - return 0; - } + , 'while' : undefined + , 'with' : undefined + , 'yield' : undefined + , _default : colors.brightBlue + } + , 'Punctuator': { + ';': colors.brightBlack + , '.': colors.green + , ',': colors.green - const min = forceColor || 0; + , '{': colors.yellow + , '}': colors.yellow + , '(': colors.brightBlack + , ')': colors.brightBlack + , '[': colors.yellow + , ']': colors.yellow - if (env.TERM === 'dumb') { - return min; - } + , '<': undefined + , '>': undefined + , '+': undefined + , '-': undefined + , '*': undefined + , '%': undefined + , '&': undefined + , '|': undefined + , '^': undefined + , '!': undefined + , '~': undefined + , '?': undefined + , ':': undefined + , '=': undefined - if (process.platform === 'win32') { - // Windows 10 build 10586 is the first Windows release that supports 256 colors. - // Windows 10 build 14931 is the first release that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } + , '<=': undefined + , '>=': undefined + , '==': undefined + , '!=': undefined + , '++': undefined + , '--': undefined + , '<<': undefined + , '>>': undefined + , '&&': undefined + , '||': undefined + , '+=': undefined + , '-=': undefined + , '*=': undefined + , '%=': undefined + , '&=': undefined + , '|=': undefined + , '^=': undefined + , '/=': undefined + , '=>': undefined + , '**': undefined - return 1; - } + , '===': undefined + , '!==': undefined + , '>>>': undefined + , '<<=': undefined + , '>>=': undefined + , '...': undefined + , '**=': undefined - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } + , '>>>=': undefined - return min; - } + , _default: colors.brightYellow + } - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } + // line comment + , Line: { + _default: colors.brightBlack + } - if (env.COLORTERM === 'truecolor') { - return 3; - } + /* block comment */ + , Block: { + _default: colors.brightBlack + } - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + // JSX + , JSXAttribute: { + _default: colors.magenta + } + , JSXClosingElement: { + _default: colors.magenta + } + , JSXElement: { + _default: colors.magenta + } + , JSXEmptyExpression: { + _default: colors.magenta + } + , JSXExpressionContainer: { + _default: colors.magenta + } + , JSXIdentifier: { + className: colors.blue + , _default: colors.magenta + } + , JSXMemberExpression: { + _default: colors.magenta + } + , JSXNamespacedName: { + _default: colors.magenta + } + , JSXOpeningElement: { + _default: colors.magenta + } + , JSXSpreadAttribute: { + _default: colors.magenta + } + , JSXText: { + _default: colors.brightGreen + } - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } + , _default: undefined +} - 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; - } +/***/ 14054: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return min; -} +var colors = __webpack_require__(26218) -function getSupportLevel(stream) { - const level = supportsColor(stream, stream && stream.isTTY); - return translateLevel(level); -} +// mimics [jq](https://stedolan.github.io/jq/) highlighting for json files +// mainly in the fact that the keys are a clearly different color than the strings +// However improvements to this theme are highly welcome! :) +// Change the below definitions in order to tweak the color theme. module.exports = { - supportsColor: getSupportLevel, - stdout: translateLevel(supportsColor(true, tty.isatty(1))), - stderr: translateLevel(supportsColor(true, tty.isatty(2))) -}; + 'Boolean': { + 'true' : undefined + , 'false' : undefined + , _default : colors.brightRed + } -/***/ }), + , 'Identifier': { + 'undefined' : colors.brightBlack + , 'self' : colors.brightRed + , 'console' : colors.blue + , 'log' : colors.blue + , 'warn' : colors.red + , 'error' : colors.brightRed + , _default : colors.white + } -/***/ 57915: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + , 'Null': { + _default: colors.brightBlack + } -"use strict"; + , 'Numeric': { + _default: colors.blue + } -const stringWidth = __webpack_require__(64537); -const stripAnsi = __webpack_require__(59284); -const ansiStyles = __webpack_require__(52068); + , 'String': { + _default: function(s, info) { + var nextToken = info.tokens[info.tokenIndex + 1] -const ESCAPES = new Set([ - '\u001B', - '\u009B' -]); + // show keys of object literals and json in different color + return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':') + ? colors.brightBlue(s) + : colors.brightGreen(s) + } + } -const END_CODE = 39; + , 'Keyword': { + 'break' : undefined -const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`; + , 'case' : undefined + , 'catch' : colors.cyan + , 'class' : undefined + , 'const' : undefined + , 'continue' : undefined -// Calculate the length of words split on ' ', ignoring -// the extra characters added by ansi escape codes -const wordLengths = string => string.split(' ').map(character => stringWidth(character)); - -// Wrap a long word across multiple rows -// Ansi escape codes do not count towards length -const wrapWord = (rows, word, columns) => { - const characters = [...word]; + , 'debugger' : undefined + , 'default' : undefined + , 'delete' : colors.red + , 'do' : undefined - let insideEscape = false; - let visible = stringWidth(stripAnsi(rows[rows.length - 1])); + , 'else' : undefined + , 'enum' : undefined + , 'export' : undefined + , 'extends' : undefined - for (const [index, character] of characters.entries()) { - const characterLength = stringWidth(character); + , 'finally' : colors.cyan + , 'for' : undefined + , 'function' : undefined - if (visible + characterLength <= columns) { - rows[rows.length - 1] += character; - } else { - rows.push(character); - visible = 0; - } + , 'if' : undefined + , 'implements' : undefined + , 'import' : undefined + , 'in' : undefined + , 'instanceof' : undefined + , 'let' : undefined + , 'new' : colors.red + , 'package' : undefined + , 'private' : undefined + , 'protected' : undefined + , 'public' : undefined + , 'return' : colors.red + , 'static' : undefined + , 'super' : undefined + , 'switch' : undefined - if (ESCAPES.has(character)) { - insideEscape = true; - } else if (insideEscape && character === 'm') { - insideEscape = false; - continue; - } + , 'this' : colors.brightRed + , 'throw' : undefined + , 'try' : colors.cyan + , 'typeof' : undefined - if (insideEscape) { - continue; - } + , 'var' : colors.green + , 'void' : undefined - visible += characterLength; + , 'while' : undefined + , 'with' : undefined + , 'yield' : undefined + , _default : colors.brightBlue + } + , 'Punctuator': { + ';': colors.brightBlack + , '.': colors.green + , ',': colors.green - if (visible === columns && index < characters.length - 1) { - rows.push(''); - visible = 0; - } - } + , '{': colors.brightWhite + , '}': colors.brightWhite + , '(': colors.brightBlack + , ')': colors.brightBlack + , '[': colors.brightWhite + , ']': colors.brightWhite - // It's possible that the last row we copy over is only - // ansi escape characters, handle this edge-case - if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { - rows[rows.length - 2] += rows.pop(); - } -}; + , '<': undefined + , '>': undefined + , '+': undefined + , '-': undefined + , '*': undefined + , '%': undefined + , '&': undefined + , '|': undefined + , '^': undefined + , '!': undefined + , '~': undefined + , '?': undefined + , ':': undefined + , '=': undefined -// The wrap-ansi module can be invoked -// in either 'hard' or 'soft' wrap mode -// -// 'hard' will never allow a string to take up more -// than columns characters -// -// 'soft' allows long words to expand past the column length -const exec = (string, columns, options = {}) => { - if (string.trim() === '') { - return options.trim === false ? string : string.trim(); - } + , '<=': undefined + , '>=': undefined + , '==': undefined + , '!=': undefined + , '++': undefined + , '--': undefined + , '<<': undefined + , '>>': undefined + , '&&': undefined + , '||': undefined + , '+=': undefined + , '-=': undefined + , '*=': undefined + , '%=': undefined + , '&=': undefined + , '|=': undefined + , '^=': undefined + , '/=': undefined + , '=>': undefined + , '**': undefined - let pre = ''; - let ret = ''; - let escapeCode; + , '===': undefined + , '!==': undefined + , '>>>': undefined + , '<<=': undefined + , '>>=': undefined + , '...': undefined + , '**=': undefined - const lengths = wordLengths(string); - const rows = ['']; + , '>>>=': undefined - for (const [index, word] of string.split(' ').entries()) { - rows[rows.length - 1] = options.trim === false ? rows[rows.length - 1] : rows[rows.length - 1].trim(); - let rowLength = stringWidth(rows[rows.length - 1]); + , _default: colors.brightYellow + } - if (rowLength || word === '') { - if (rowLength === columns && options.wordWrap === false) { - // If we start with a new word but the current row length equals the length of the columns, add a new row - rows.push(''); - rowLength = 0; - } + // line comment + , Line: { + _default: colors.brightBlack + } - rows[rows.length - 1] += ' '; - rowLength++; - } + /* block comment */ + , Block: { + _default: colors.brightBlack + } - // In 'hard' wrap mode, the length of a line is - // never allowed to extend past 'columns' - if (lengths[index] > columns && options.hard) { - if (rowLength) { - rows.push(''); - } - wrapWord(rows, word, columns); - continue; - } + , _default: undefined +} - if (rowLength + lengths[index] > columns && rowLength > 0) { - if (options.wordWrap === false && rowLength < columns) { - wrapWord(rows, word, columns); - continue; - } - rows.push(''); - } +/***/ }), - if (rowLength + lengths[index] > columns && options.wordWrap === false) { - wrapWord(rows, word, columns); - continue; - } +/***/ 38707: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - rows[rows.length - 1] += word; - } +"use strict"; - pre = rows.map(row => options.trim === false ? row : row.trim()).join('\n'); +const escapeStringRegexp = __webpack_require__(98691); +const ansiStyles = __webpack_require__(52068); +const stdoutColor = __webpack_require__(59318).stdout; - for (const [index, character] of [...pre].entries()) { - ret += character; +const template = __webpack_require__(52138); - if (ESCAPES.has(character)) { - const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4))); - escapeCode = code === END_CODE ? null : code; - } +const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); - const code = ansiStyles.codes.get(Number(escapeCode)); +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - if (escapeCode && code) { - if (pre[index + 1] === '\n') { - ret += wrapAnsi(code); - } else if (character === '\n') { - ret += wrapAnsi(escapeCode); - } - } - } +// `color-convert` models to exclude from the Chalk API due to conflicts and such +const skipModels = new Set(['gray']); - return ret; -}; +const styles = Object.create(null); -// For each newline, invoke the method separately -module.exports = (string, columns, options) => { - return String(string) - .normalize() - .split('\n') - .map(line => exec(line, columns, options)) - .join('\n'); -}; +function applyOptions(obj, options) { + options = options || {}; + // Detect level if not set manually + const scLevel = stdoutColor ? stdoutColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; +} -/***/ }), +function Chalk(options) { + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); -/***/ 64537: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; -"use strict"; + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); -const stripAnsi = __webpack_require__(59284); -const isFullwidthCodePoint = __webpack_require__(35565); + chalk.template.constructor = Chalk; -module.exports = str => { - if (typeof str !== 'string' || str.length === 0) { - return 0; + return chalk.template; } - str = stripAnsi(str); - - let width = 0; + applyOptions(this, options); +} - for (let i = 0; i < str.length; i++) { - const code = str.codePointAt(i); +// Use bright blue on Windows as the normal blue color is illegible +if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001B[94m'; +} - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } +for (const key of Object.keys(ansiStyles)) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; + styles[key] = { + get() { + const codes = ansiStyles[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); } + }; +} - // Surrogates - if (code > 0xFFFF) { - i++; - } +styles.visible = { + get() { + return build.call(this, this._styles || [], true, 'visible'); + } +}; - width += isFullwidthCodePoint(code) ? 2 : 1; +ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); +for (const model of Object.keys(ansiStyles.color.ansi)) { + if (skipModels.has(model)) { + continue; } - return width; -}; + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.color.close, + closeRe: ansiStyles.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} +ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); +for (const model of Object.keys(ansiStyles.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } -/***/ }), + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.bgColor.close, + closeRe: ansiStyles.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} -/***/ 59284: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const proto = Object.defineProperties(() => {}, styles); -"use strict"; +function build(_styles, _empty, key) { + const builder = function () { + return applyStyle.apply(builder, arguments); + }; -const ansiRegex = __webpack_require__(65063); + builder._styles = _styles; + builder._empty = _empty; -module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; + const self = this; + Object.defineProperty(builder, 'level', { + enumerable: true, + get() { + return self.level; + }, + set(level) { + self.level = level; + } + }); -/***/ }), + Object.defineProperty(builder, 'enabled', { + enumerable: true, + get() { + return self.enabled; + }, + set(enabled) { + self.enabled = enabled; + } + }); -/***/ 6493: -/***/ ((__unused_webpack_module, exports) => { + // See below for fix regarding invisible grey/dim combination on Windows + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; -"use strict"; + // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + builder.__proto__ = proto; // eslint-disable-line no-proto -Object.defineProperty(exports, "__esModule", ({ value: true })); -function termwidth(stream) { - if (!stream.isTTY) { - return 80; - } - const width = stream.getWindowSize()[0]; - if (width < 1) { - return 80; - } - if (width < 40) { - return 40; - } - return width; + return builder; } -const columns = global.columns; -exports.stdtermwidth = columns || termwidth(process.stdout); -exports.errtermwidth = columns || termwidth(process.stderr); -process.stdout.on('resize', () => { - exports.stdtermwidth = columns || termwidth(process.stdout); -}); -process.stderr.on('resize', () => { - exports.errtermwidth = columns || termwidth(process.stderr); -}); +function applyStyle() { + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); -/***/ }), + if (argsLen === 0) { + return ''; + } -/***/ 18512: -/***/ ((module) => { + if (argsLen > 1) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } -"use strict"; + if (!this.enabled || this.level <= 0 || !str) { + return this._empty ? '' : str; + } -const ansiEscapes = module.exports; -// TODO: remove this in the next major version -module.exports.default = ansiEscapes; + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + const originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && this.hasGrey) { + ansiStyles.dim.open = ''; + } -const ESC = '\u001B['; -const OSC = '\u001B]'; -const BEL = '\u0007'; -const SEP = ';'; -const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; + for (const code of this._styles.slice().reverse()) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; -ansiEscapes.cursorTo = (x, y) => { - if (typeof x !== 'number') { - throw new TypeError('The `x` argument is required'); + // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); } - if (typeof y !== 'number') { - return ESC + (x + 1) + 'G'; - } + // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue + ansiStyles.dim.open = originalDim; - return ESC + (y + 1) + ';' + (x + 1) + 'H'; -}; + return str; +} -ansiEscapes.cursorMove = (x, y) => { - if (typeof x !== 'number') { - throw new TypeError('The `x` argument is required'); +function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); } - let ret = ''; + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; - if (x < 0) { - ret += ESC + (-x) + 'D'; - } else if (x > 0) { - ret += ESC + x + 'C'; + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); } - if (y < 0) { - ret += ESC + (-y) + 'A'; - } else if (y > 0) { - ret += ESC + y + 'B'; - } + return template(chalk, parts.join('')); +} - return ret; -}; +Object.defineProperties(Chalk.prototype, styles); -ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'; -ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'; -ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'; -ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'; +module.exports = Chalk(); // eslint-disable-line new-cap +module.exports.supportsColor = stdoutColor; +module.exports.default = module.exports; // For TypeScript -ansiEscapes.cursorLeft = ESC + 'G'; -ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'; -ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'; -ansiEscapes.cursorGetPosition = ESC + '6n'; -ansiEscapes.cursorNextLine = ESC + 'E'; -ansiEscapes.cursorPrevLine = ESC + 'F'; -ansiEscapes.cursorHide = ESC + '?25l'; -ansiEscapes.cursorShow = ESC + '?25h'; -ansiEscapes.eraseLines = count => { - let clear = ''; +/***/ }), - for (let i = 0; i < count; i++) { - clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : ''); - } +/***/ 52138: +/***/ ((module) => { - if (count) { - clear += ansiEscapes.cursorLeft; - } +"use strict"; - return clear; -}; +const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; -ansiEscapes.eraseEndLine = ESC + 'K'; -ansiEscapes.eraseStartLine = ESC + '1K'; -ansiEscapes.eraseLine = ESC + '2K'; -ansiEscapes.eraseDown = ESC + 'J'; -ansiEscapes.eraseUp = ESC + '1J'; -ansiEscapes.eraseScreen = ESC + '2J'; -ansiEscapes.scrollUp = ESC + 'S'; -ansiEscapes.scrollDown = ESC + 'T'; +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); -ansiEscapes.clearScreen = '\u001Bc'; +function unescape(c) { + if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } -ansiEscapes.clearTerminal = process.platform === 'win32' ? - `${ansiEscapes.eraseScreen}${ESC}0f` : - // 1. Erases the screen (Only done in case `2` is not supported) - // 2. Erases the whole screen including scrollback buffer - // 3. Moves cursor to the top-left position - // More info: https://www.real-world-systems.com/docs/ANSIcode.html - `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`; + return ESCAPES.get(c) || c; +} -ansiEscapes.beep = BEL; +function parseArguments(name, args) { + const results = []; + const chunks = args.trim().split(/\s*,\s*/g); + let matches; -ansiEscapes.link = (text, url) => { - return [ - OSC, - '8', - SEP, - SEP, - url, - BEL, - text, - OSC, - '8', - SEP, - SEP, - BEL - ].join(''); -}; + for (const chunk of chunks) { + if (!isNaN(chunk)) { + results.push(Number(chunk)); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } -ansiEscapes.image = (buffer, options = {}) => { - let ret = `${OSC}1337;File=inline=1`; + return results; +} - if (options.width) { - ret += `;width=${options.width}`; - } +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; - if (options.height) { - ret += `;height=${options.height}`; - } + const results = []; + let matches; - if (options.preserveAspectRatio === false) { - ret += ';preserveAspectRatio=0'; + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } } - return ret + ':' + buffer.toString('base64') + BEL; -}; + return results; +} -ansiEscapes.iTerm = { - setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`, +function buildStyle(chalk, styles) { + const enabled = {}; - annotation: (message, options = {}) => { - let ret = `${OSC}1337;`; + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } - const hasX = typeof options.x !== 'undefined'; - const hasY = typeof options.y !== 'undefined'; - if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) { - throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined'); + let current = chalk; + for (const styleName of Object.keys(enabled)) { + if (Array.isArray(enabled[styleName])) { + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + if (enabled[styleName].length > 0) { + current = current[styleName].apply(current, enabled[styleName]); + } else { + current = current[styleName]; + } } + } - message = message.replace(/\|/g, ''); + return current; +} - ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='; +module.exports = (chalk, tmp) => { + const styles = []; + const chunks = []; + let chunk = []; - if (options.length > 0) { - ret += - (hasX ? - [message, options.length, options.x, options.y] : - [options.length, message]).join('|'); + // eslint-disable-next-line max-params + tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { + if (escapeChar) { + chunk.push(unescape(escapeChar)); + } else if (style) { + const str = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); } else { - ret += message; + chunk.push(chr); } + }); - return ret + BEL; + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMsg); } + + return chunks.join(''); }; /***/ }), -/***/ 65063: -/***/ ((module) => { +/***/ 27972: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +const os = __webpack_require__(12087); +const escapeStringRegexp = __webpack_require__(51240); + +const extractPathRegex = /\s+at.*[(\s](.*)\)?/; +const pathRegex = /^(?:(?:(?:node|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/; +const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir(); -module.exports = () => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' - ].join('|'); +module.exports = (stack, {pretty = false, basePath} = {}) => { + const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath)}`, 'g'); - return new RegExp(pattern, 'g'); + return stack.replace(/\\/g, '/') + .split('\n') + .filter(line => { + const pathMatches = line.match(extractPathRegex); + if (pathMatches === null || !pathMatches[1]) { + return true; + } + + const match = pathMatches[1]; + + // Electron + if ( + match.includes('.app/Contents/Resources/electron.asar') || + match.includes('.app/Contents/Resources/default_app.asar') + ) { + return false; + } + + return !pathRegex.test(match); + }) + .filter(line => line.trim() !== '') + .map(line => { + if (basePathRegex) { + line = line.replace(basePathRegex, '$1'); + } + + if (pretty) { + line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~'))); + } + + return line; + }) + .join('\n'); }; /***/ }), -/***/ 52068: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 51240: +/***/ ((module) => { "use strict"; -/* module decorator */ module = __webpack_require__.nmd(module); -const colorConvert = __webpack_require__(86931); -const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${code + offset}m`; -}; +module.exports = string => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } -const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};5;${code}m`; + // Escape characters with special meaning either inside or outside character sets. + // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. + return string + .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') + .replace(/-/g, '\\x2d'); }; -const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], +/***/ }), - // Bright color - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], +/***/ 17348: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; +const _SingleBar = __webpack_require__(37561); +const _MultiBar = __webpack_require__(2013); +const _Presets = __webpack_require__(35040); +const _Formatter = __webpack_require__(18115); +const _defaultFormatValue = __webpack_require__(56404); +const _defaultFormatBar = __webpack_require__(76174); +const _defaultFormatTime = __webpack_require__(53900); - // Fix humans - styles.color.grey = styles.color.gray; +// sub-module access +module.exports = { + Bar: _SingleBar, + SingleBar: _SingleBar, + MultiBar: _MultiBar, + Presets: _Presets, + Format: { + Formatter: _Formatter, + BarFormat: _defaultFormatBar, + ValueFormat: _defaultFormatValue, + TimeFormat: _defaultFormatTime + } +}; - for (const groupName of Object.keys(styles)) { - const group = styles[groupName]; +/***/ }), - for (const styleName of Object.keys(group)) { - const style = group[styleName]; +/***/ 37954: +/***/ ((module) => { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - group[styleName] = styles[styleName]; +// ETA calculation +class ETA{ - codes.set(style[0], style[1]); - } + constructor(length, initTime, initValue){ + // size of eta buffer + this.etaBufferLength = length || 100; - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); + // eta buffer with initial values + this.valueBuffer = [initValue]; + this.timeBuffer = [initTime]; - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); - } + // eta time value + this.eta = '0'; + } - const ansi2ansi = n => n; - const rgb2rgb = (r, g, b) => [r, g, b]; + // add new values to calculation buffer + update(time, value, total){ + this.valueBuffer.push(value); + this.timeBuffer.push(time); - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; + // trigger recalculation + this.calculate(total-value); + } - styles.color.ansi = { - ansi: wrapAnsi16(ansi2ansi, 0) - }; - styles.color.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 0) - }; - styles.color.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 0) - }; + // fetch estimated time + getTime(){ + return this.eta; + } - styles.bgColor.ansi = { - ansi: wrapAnsi16(ansi2ansi, 10) - }; - styles.bgColor.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 10) - }; - styles.bgColor.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 10) - }; + // eta calculation - request number of remaining events + calculate(remaining){ + // get number of samples in eta buffer + const currentBufferSize = this.valueBuffer.length; + const buffer = Math.min(this.etaBufferLength, currentBufferSize); - for (let key of Object.keys(colorConvert)) { - if (typeof colorConvert[key] !== 'object') { - continue; - } + const v_diff = this.valueBuffer[currentBufferSize - 1] - this.valueBuffer[currentBufferSize - buffer]; + const t_diff = this.timeBuffer[currentBufferSize - 1] - this.timeBuffer[currentBufferSize - buffer]; - const suite = colorConvert[key]; + // get progress per ms + const vt_rate = v_diff/t_diff; - if (key === 'ansi16') { - key = 'ansi'; - } + // strip past elements + this.valueBuffer = this.valueBuffer.slice(-this.etaBufferLength); + this.timeBuffer = this.timeBuffer.slice(-this.etaBufferLength); - if ('ansi16' in suite) { - styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); - styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); - } + // eq: vt_rate *x = total + const eta = Math.ceil(remaining/vt_rate/1000); - if ('ansi256' in suite) { - styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); - styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); - } + // check values + if (isNaN(eta)){ + this.eta = 'NULL'; - if ('rgb' in suite) { - styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); - styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); - } - } + // +/- Infinity --- NaN already handled + }else if (!isFinite(eta)){ + this.eta = 'INF'; - return styles; + // > 10M s ? - set upper display limit ~115days (1e7/60/60/24) + }else if (eta > 1e7){ + this.eta = 'INF'; + + // negative ? + }else if (eta < 0){ + this.eta = 0; + + }else{ + // assign + this.eta = eta; + } + } } -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); +module.exports = ETA; + +/***/ }), + +/***/ 76174: +/***/ ((module) => { + +// format bar +module.exports = function formatBar(progress, options){ + // calculate barsize + const completeSize = Math.round(progress*options.barsize); + const incompleteSize = options.barsize-completeSize; + // generate bar string by stripping the pre-rendered strings + return options.barCompleteString.substr(0, completeSize) + + options.barGlue + + options.barIncompleteString.substr(0, incompleteSize); +} /***/ }), -/***/ 26218: +/***/ 53900: /***/ ((module) => { -"use strict"; -// ColorCodes explained: http://www.termsys.demon.co.uk/vtansi.htm +// default time format +// format a number of seconds into hours and minutes as appropriate +module.exports = function formatTime(t, options, roundToMultipleOf){ + function round(input) { + if (roundToMultipleOf) { + return roundToMultipleOf * Math.round(input / roundToMultipleOf); + } else { + return input + } + } -var colorNums = { - white : 37 - , black : 30 - , blue : 34 - , cyan : 36 - , green : 32 - , magenta : 35 - , red : 31 - , yellow : 33 - , brightBlack : 90 - , brightRed : 91 - , brightGreen : 92 - , brightYellow : 93 - , brightBlue : 94 - , brightMagenta : 95 - , brightCyan : 96 - , brightWhite : 97 + // leading zero padding + function autopadding(v){ + return (options.autopaddingChar + v).slice(-2); } - , backgroundColorNums = { - bgBlack : 40 - , bgRed : 41 - , bgGreen : 42 - , bgYellow : 43 - , bgBlue : 44 - , bgMagenta : 45 - , bgCyan : 46 - , bgWhite : 47 - , bgBrightBlack : 100 - , bgBrightRed : 101 - , bgBrightGreen : 102 - , bgBrightYellow : 103 - , bgBrightBlue : 104 - , bgBrightMagenta : 105 - , bgBrightCyan : 106 - , bgBrightWhite : 107 - } - , open = {} - , close = {} - , colors = {} - ; -Object.keys(colorNums).forEach(function (k) { - var o = open[k] = '\u001b[' + colorNums[k] + 'm'; - var c = close[k] = '\u001b[39m'; + // > 1h ? + if (t > 3600) { + return autopadding(Math.floor(t / 3600)) + 'h' + autopadding(round((t % 3600) / 60)) + 'm'; - colors[k] = function (s) { - return o + s + c; - }; -}); + // > 60s ? + } else if (t > 60) { + return autopadding(Math.floor(t / 60)) + 'm' + autopadding(round((t % 60))) + 's'; -Object.keys(backgroundColorNums).forEach(function (k) { - var o = open[k] = '\u001b[' + backgroundColorNums[k] + 'm'; - var c = close[k] = '\u001b[49m'; + // > 10s ? + } else if (t > 10) { + return autopadding(round(t)) + 's'; - colors[k] = function (s) { - return o + s + c; - }; -}); + // default: don't apply round to multiple + }else{ + return autopadding(t) + 's'; + } +} -module.exports = colors; -colors.open = open; -colors.close = close; +/***/ }), +/***/ 56404: +/***/ ((module) => { -/***/ }), +// default value format (apply autopadding) -/***/ 96545: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +// format valueset +module.exports = function formatValue(v, options, type){ + // no autopadding ? passthrough + if (options.autopadding !== true){ + return v; + } -module.exports = __webpack_require__(52618); + // padding + function autopadding(value, length){ + return (options.autopaddingChar + value).slice(-length); + } + + switch (type){ + case 'percentage': + return autopadding(v, 3); + + default: + return v; + } +} /***/ }), -/***/ 68104: +/***/ 18115: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +const _stringWidth = __webpack_require__(42577); +const _defaultFormatValue = __webpack_require__(56404); +const _defaultFormatBar = __webpack_require__(76174); +const _defaultFormatTime = __webpack_require__(53900); +// generic formatter +module.exports = function defaultFormatter(options, params, payload){ -var utils = __webpack_require__(20328); -var settle = __webpack_require__(13211); -var buildFullPath = __webpack_require__(41934); -var buildURL = __webpack_require__(30646); -var http = __webpack_require__(15876); -var https = __webpack_require__(57211); -var httpFollow = __webpack_require__(67707).http; -var httpsFollow = __webpack_require__(67707).https; -var url = __webpack_require__(78835); -var zlib = __webpack_require__(78761); -var pkg = __webpack_require__(20696); -var createError = __webpack_require__(15226); -var enhanceError = __webpack_require__(21516); + // copy format string + let s = options.format; -var isHttps = /https:?/; + // custom time format set ? + const formatTime = options.formatTime || _defaultFormatTime; + + // custom value format set ? + const formatValue = options.formatValue || _defaultFormatValue; -/** - * - * @param {http.ClientRequestArgs} options - * @param {AxiosProxyConfig} proxy - * @param {string} location - */ -function setProxy(options, proxy, location) { - options.hostname = proxy.host; - options.host = proxy.host; - options.port = proxy.port; - options.path = location; + // custom bar format set ? + const formatBar = options.formatBar || _defaultFormatBar; - // Basic proxy authorization - if (proxy.auth) { - var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); - options.headers['Proxy-Authorization'] = 'Basic ' + base64; - } + // calculate progress in percent + const percentage = Math.floor(params.progress*100) + ''; - // If a proxy is used, any redirects must also pass through the proxy - options.beforeRedirect = function beforeRedirect(redirection) { - redirection.headers.host = redirection.host; - setProxy(redirection, proxy, redirection.href); - }; -} + // bar stopped and stopTime set ? + const stopTime = params.stopTime || Date.now(); -/*eslint consistent-return:0*/ -module.exports = function httpAdapter(config) { - return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { - var resolve = function resolve(value) { - resolvePromise(value); - }; - var reject = function reject(value) { - rejectPromise(value); - }; - var data = config.data; - var headers = config.headers; + // calculate elapsed time + const elapsedTime = Math.round((stopTime - params.startTime)/1000); - // Set User-Agent (required by some servers) - // Only set header if it hasn't been set in config - // See https://github.com/axios/axios/issues/69 - if (!headers['User-Agent'] && !headers['user-agent']) { - headers['User-Agent'] = 'axios/' + pkg.version; - } + // merges data from payload and calculated + const context = Object.assign({}, payload, { + bar: formatBar(params.progress, options), - if (data && !utils.isStream(data)) { - if (Buffer.isBuffer(data)) { - // Nothing to do... - } else if (utils.isArrayBuffer(data)) { - data = Buffer.from(new Uint8Array(data)); - } else if (utils.isString(data)) { - data = Buffer.from(data, 'utf-8'); - } else { - return reject(createError( - 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', - config - )); - } + percentage: formatValue(percentage, options, 'percentage'), + total: formatValue(params.total, options, 'total'), + value: formatValue(params.value, options, 'value'), - // Add Content-Length header if data exists - headers['Content-Length'] = data.length; - } + eta: formatValue(params.eta, options, 'eta'), + eta_formatted: formatTime(params.eta, options, 5), + + duration: formatValue(elapsedTime, options, 'duration'), + duration_formatted: formatTime(elapsedTime, options, 1) + }); - // HTTP basic authentication - var auth = undefined; - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password || ''; - auth = username + ':' + password; - } + // assign placeholder tokens + s = s.replace(/\{(\w+)\}/g, function(match, key){ + // key exists within payload/context + if (typeof context[key] !== 'undefined') { + return context[key]; + } - // Parse url - var fullPath = buildFullPath(config.baseURL, config.url); - var parsed = url.parse(fullPath); - var protocol = parsed.protocol || 'http:'; + // no changes to unknown values + return match; + }); - if (!auth && parsed.auth) { - var urlAuth = parsed.auth.split(':'); - var urlUsername = urlAuth[0] || ''; - var urlPassword = urlAuth[1] || ''; - auth = urlUsername + ':' + urlPassword; - } + // calculate available whitespace (2 characters margin of error) + const fullMargin = Math.max(0, params.maxWidth - _stringWidth(s) -2); + const halfMargin = Math.floor(fullMargin / 2); - if (auth) { - delete headers.Authorization; - } + // distribute available whitespace according to position + switch (options.align) { - var isHttpsRequest = isHttps.test(protocol); - var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + // fill start-of-line with whitespaces + case 'right': + s = (fullMargin > 0) ? ' '.repeat(fullMargin) + s : s; + break; - var options = { - path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), - method: config.method.toUpperCase(), - headers: headers, - agent: agent, - agents: { http: config.httpAgent, https: config.httpsAgent }, - auth: auth - }; + // distribute whitespaces to left+right + case 'center': + s = (halfMargin > 0) ? ' '.repeat(halfMargin) + s : s; + break; - if (config.socketPath) { - options.socketPath = config.socketPath; - } else { - options.hostname = parsed.hostname; - options.port = parsed.port; + // default: left align, no additional whitespaces + case 'left': + default: + break; } - var proxy = config.proxy; - if (!proxy && proxy !== false) { - var proxyEnv = protocol.slice(0, -1) + '_proxy'; - var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; - if (proxyUrl) { - var parsedProxyUrl = url.parse(proxyUrl); - var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; - var shouldProxy = true; - - if (noProxyEnv) { - var noProxy = noProxyEnv.split(',').map(function trim(s) { - return s.trim(); - }); + return s; +} - shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { - if (!proxyElement) { - return false; - } - if (proxyElement === '*') { - return true; - } - if (proxyElement[0] === '.' && - parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { - return true; - } - return parsed.hostname === proxyElement; - }); - } +/***/ }), - if (shouldProxy) { - proxy = { - host: parsedProxyUrl.hostname, - port: parsedProxyUrl.port, - protocol: parsedProxyUrl.protocol - }; +/***/ 93455: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (parsedProxyUrl.auth) { - var proxyUrlAuth = parsedProxyUrl.auth.split(':'); - proxy.auth = { - username: proxyUrlAuth[0], - password: proxyUrlAuth[1] - }; - } - } - } - } +const _ETA = __webpack_require__(37954); +const _Terminal = __webpack_require__(44411); +const _formatter = __webpack_require__(18115); +const _EventEmitter = __webpack_require__(28614); - if (proxy) { - options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); - setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); - } +// Progress-Bar constructor +module.exports = class GenericBar extends _EventEmitter{ - var transport; - var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); - if (config.transport) { - transport = config.transport; - } else if (config.maxRedirects === 0) { - transport = isHttpsProxy ? https : http; - } else { - if (config.maxRedirects) { - options.maxRedirects = config.maxRedirects; - } - transport = isHttpsProxy ? httpsFollow : httpFollow; - } + constructor(options){ + super(); - if (config.maxBodyLength > -1) { - options.maxBodyLength = config.maxBodyLength; - } + // store options + this.options = options; - // Create the request - var req = transport.request(options, function handleResponse(res) { - if (req.aborted) return; + // store terminal instance + this.terminal = (this.options.terminal) ? this.options.terminal : new _Terminal(this.options.stream); - // uncompress the response body transparently if required - var stream = res; + // the current bar value + this.value = 0; - // return the last request in case of redirects - var lastRequest = res.req || req; + // the end value of the bar + this.total = 100; + // last drawn string - only render on change! + this.lastDrawnString = null; - // if no content, is HEAD request or decompress disabled we should not decompress - if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) { - switch (res.headers['content-encoding']) { - /*eslint default-case:0*/ - case 'gzip': - case 'compress': - case 'deflate': - // add the unzipper to the body stream processing pipeline - stream = stream.pipe(zlib.createUnzip()); + // start time (used for eta calculation) + this.startTime = null; - // remove the content-encoding in order to not confuse downstream operations - delete res.headers['content-encoding']; - break; - } - } + // stop time (used for duration calculation) + this.stopTime = null; - var response = { - status: res.statusCode, - statusText: res.statusMessage, - headers: res.headers, - config: config, - request: lastRequest - }; + // last update time + this.lastRedraw = Date.now(); - if (config.responseType === 'stream') { - response.data = stream; - settle(resolve, reject, response); - } else { - var responseBuffer = []; - stream.on('data', function handleStreamData(chunk) { - responseBuffer.push(chunk); + // default eta calculator (will be re-create on start) + this.eta = new _ETA(this.options.etaBufferLength, 0, 0); - // make sure the content length is not over the maxContentLength if specified - if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { - stream.destroy(); - reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', - config, null, lastRequest)); - } - }); + // payload data + this.payload = {}; - stream.on('error', function handleStreamError(err) { - if (req.aborted) return; - reject(enhanceError(err, config, null, lastRequest)); - }); + // progress bar active ? + this.isActive = false; - stream.on('end', function handleStreamEnd() { - var responseData = Buffer.concat(responseBuffer); - if (config.responseType !== 'arraybuffer') { - responseData = responseData.toString(config.responseEncoding); - if (!config.responseEncoding || config.responseEncoding === 'utf8') { - responseData = utils.stripBOM(responseData); - } - } + // use default formatter or custom one ? + this.formatter = (typeof this.options.format === 'function') ? this.options.format : _formatter; + } - response.data = responseData; - settle(resolve, reject, response); - }); - } - }); + // internal render function + render(){ + // calculate the normalized current progress + let progress = (this.value/this.total); - // Handle errors - req.on('error', function handleRequestError(err) { - if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return; - reject(enhanceError(err, config, null, req)); - }); + // handle NaN Errors caused by total=0. Set to complete in this case + if (isNaN(progress)){ + progress = (this.options && this.options.emptyOnZero) ? 0.0 : 1.0; + } - // Handle request timeout - if (config.timeout) { - // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. - // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. - // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. - // And then these socket which be hang up will devoring CPU little by little. - // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. - req.setTimeout(config.timeout, function handleRequestTimeout() { - req.abort(); - reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); - }); - } + // limiter + progress = Math.min(Math.max(progress, 0.0), 1.0); - if (config.cancelToken) { - // Handle cancellation - config.cancelToken.promise.then(function onCanceled(cancel) { - if (req.aborted) return; + // formatter params + const params = { + progress: progress, + eta: this.eta.getTime(), + startTime: this.startTime, + stopTime: this.stopTime, + total: this.total, + value: this.value, + maxWidth: this.terminal.getWidth() + }; - req.abort(); - reject(cancel); - }); - } + // automatic eta update ? (long running processes) + if (this.options.etaAsynchronousUpdate){ + this.updateETA(); + } - // Send the request - if (utils.isStream(data)) { - data.on('error', function handleStreamError(err) { - reject(enhanceError(err, config, null, req)); - }).pipe(req); - } else { - req.end(data); - } - }); -}; + // format string + const s = this.formatter(this.options, params, this.payload); + const forceRedraw = this.options.forceRedraw + // force redraw in notty-mode! + || (this.options.noTTYOutput && !this.terminal.isTTY()); -/***/ }), + // string changed ? only trigger redraw on change! + if (forceRedraw || this.lastDrawnString != s){ + // trigger event + this.emit('redraw-pre'); -/***/ 3454: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // set cursor to start of line + this.terminal.cursorTo(0, null); -"use strict"; + // write output + this.terminal.write(s); + // clear to the right from cursor + this.terminal.clearRight(); -var utils = __webpack_require__(20328); -var settle = __webpack_require__(13211); -var cookies = __webpack_require__(21545); -var buildURL = __webpack_require__(30646); -var buildFullPath = __webpack_require__(41934); -var parseHeaders = __webpack_require__(86455); -var isURLSameOrigin = __webpack_require__(33608); -var createError = __webpack_require__(15226); + // store string + this.lastDrawnString = s; -module.exports = function xhrAdapter(config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - var requestData = config.data; - var requestHeaders = config.headers; + // set last redraw time + this.lastRedraw = Date.now(); - if (utils.isFormData(requestData)) { - delete requestHeaders['Content-Type']; // Let the browser set it + // trigger event + this.emit('redraw-post'); + } } - var request = new XMLHttpRequest(); - - // HTTP basic authentication - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; - requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); - } + // start the progress bar + start(total, startValue, payload){ + // set initial values + this.value = startValue || 0; + this.total = (typeof total !== 'undefined' && total >= 0) ? total : 100; - var fullPath = buildFullPath(config.baseURL, config.url); - request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + // store payload (optional) + this.payload = payload || {}; - // Set the request timeout in MS - request.timeout = config.timeout; - - // Listen for ready state - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; - } - - // The request errored out and we didn't get a response, this will be - // handled by onerror instead - // With one exception: request that using file: protocol, most browsers - // will return status as 0 even though it's a successful request - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { - return; - } + // store start time for duration+eta calculation + this.startTime = Date.now(); - // Prepare the response - var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; - var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; - var response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config: config, - request: request - }; + // reset string line buffer (redraw detection) + this.lastDrawnString = ''; - settle(resolve, reject, response); + // initialize eta buffer + this.eta = new _ETA(this.options.etaBufferLength, this.startTime, this.value); - // Clean up request - request = null; - }; + // set flag + this.isActive = true; - // Handle browser request cancellation (as opposed to a manual cancellation) - request.onabort = function handleAbort() { - if (!request) { - return; - } + // start event + this.emit('start', total, startValue); + } - reject(createError('Request aborted', config, 'ECONNABORTED', request)); + // stop the bar + stop(){ + // set flag + this.isActive = false; + + // store stop timestamp to get total duration + this.stopTime = new Date(); - // Clean up request - request = null; - }; + // stop event + this.emit('stop', this.total, this.value); + } - // Handle low level network errors - request.onerror = function handleError() { - // Real errors are hidden from us by the browser - // onerror should only fire if it's a network error - reject(createError('Network Error', config, null, request)); + // update the bar value + // update(value, payload) + // update(payload) + update(arg0, arg1 = {}){ + // value set ? + // update(value, [payload]); + if (typeof arg0 === 'number') { + // update value + this.value = arg0; - // Clean up request - request = null; - }; + // add new value; recalculate eta + this.eta.update(Date.now(), arg0, this.total); + } - // Handle timeout - request.ontimeout = function handleTimeout() { - var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } - reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', - request)); + // extract payload + // update(value, payload) + // update(payload) + const payloadData = ((typeof arg0 === 'object') ? arg0 : arg1) || {}; - // Clean up request - request = null; - }; + // update event (before stop() is called) + this.emit('update', this.total, this.value); - // Add xsrf header - // This is only done if running in a standard browser environment. - // Specifically not if we're in a web worker, or react-native. - if (utils.isStandardBrowserEnv()) { - // Add xsrf header - var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? - cookies.read(config.xsrfCookieName) : - undefined; + // merge payload + for (const key in payloadData){ + this.payload[key] = payloadData[key]; + } - if (xsrfValue) { - requestHeaders[config.xsrfHeaderName] = xsrfValue; - } + // limit reached ? autostop set ? + if (this.value >= this.getTotal() && this.options.stopOnComplete) { + this.stop(); + } } - // Add headers to the request - if ('setRequestHeader' in request) { - utils.forEach(requestHeaders, function setRequestHeader(val, key) { - if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { - // Remove Content-Type if data is undefined - delete requestHeaders[key]; - } else { - // Otherwise add header to the request - request.setRequestHeader(key, val); + // update the bar value + // increment(delta, payload) + // increment(payload) + increment(arg0 = 1, arg1 = {}){ + // increment([payload]) => step=1 + // handle the use case when `step` is omitted but payload is passed + if (typeof arg0 === 'object') { + this.update(this.value + 1, arg0); + + // increment([step=1], [payload={}]) + }else{ + this.update(this.value + arg0, arg1); } - }); } - // Add withCredentials to request if needed - if (!utils.isUndefined(config.withCredentials)) { - request.withCredentials = !!config.withCredentials; + // get the total (limit) value + getTotal(){ + return this.total; } - // Add responseType to request if needed - if (config.responseType) { - try { - request.responseType = config.responseType; - } catch (e) { - // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. - // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. - if (config.responseType !== 'json') { - throw e; + // set the total (limit) value + setTotal(total){ + if (typeof total !== 'undefined' && total >= 0){ + this.total = total; } - } } - // Handle progress if needed - if (typeof config.onDownloadProgress === 'function') { - request.addEventListener('progress', config.onDownloadProgress); + // force eta calculation update (long running processes) + updateETA(){ + // add new value; recalculate eta + this.eta.update(Date.now(), this.value, this.total); } +} - // Not all browsers support upload events - if (typeof config.onUploadProgress === 'function' && request.upload) { - request.upload.addEventListener('progress', config.onUploadProgress); - } - if (config.cancelToken) { - // Handle cancellation - config.cancelToken.promise.then(function onCanceled(cancel) { - if (!request) { - return; - } +/***/ }), - request.abort(); - reject(cancel); - // Clean up request - request = null; - }); - } +/***/ 2013: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!requestData) { - requestData = null; - } +const _Terminal = __webpack_require__(44411); +const _BarElement = __webpack_require__(93455); +const _options = __webpack_require__(98322); +const _EventEmitter = __webpack_require__(28614); - // Send the request - request.send(requestData); - }); -}; +// Progress-Bar constructor +module.exports = class MultiBar extends _EventEmitter{ + constructor(options, preset){ + super(); -/***/ }), + // list of bars + this.bars = []; -/***/ 52618: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // parse+store options + this.options = _options.parse(options, preset); -"use strict"; + // disable synchronous updates + this.options.synchronousUpdate = false; + // store terminal instance + this.terminal = (this.options.terminal) ? this.options.terminal : new _Terminal(this.options.stream); -var utils = __webpack_require__(20328); -var bind = __webpack_require__(77065); -var Axios = __webpack_require__(98178); -var mergeConfig = __webpack_require__(74831); -var defaults = __webpack_require__(98190); + // the update timer + this.timer = null; -/** - * Create an instance of Axios - * - * @param {Object} defaultConfig The default config for the instance - * @return {Axios} A new instance of Axios - */ -function createInstance(defaultConfig) { - var context = new Axios(defaultConfig); - var instance = bind(Axios.prototype.request, context); + // progress bar active ? + this.isActive = false; - // Copy axios.prototype to instance - utils.extend(instance, Axios.prototype, context); + // update interval + this.schedulingRate = (this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule); + } - // Copy context to instance - utils.extend(instance, context); + // add a new bar to the stack + create(total, startValue, payload){ + // progress updates are only visible in TTY mode! + if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){ + return; + } + + // create new bar element + const bar = new _BarElement(this.options); - return instance; -} + // store bar + this.bars.push(bar); -// Create the default instance to be exported -var axios = createInstance(defaults); + // multiprogress already active ? + if (!this.isActive){ + // hide the cursor ? + if (this.options.hideCursor === true){ + this.terminal.cursor(false); + } -// Expose Axios class to allow class inheritance -axios.Axios = Axios; + // disable line wrapping ? + if (this.options.linewrap === false){ + this.terminal.lineWrapping(false); + } + + // initialize update timer + this.timer = setTimeout(this.update.bind(this), this.schedulingRate); + } -// Factory for creating new instances -axios.create = function create(instanceConfig) { - return createInstance(mergeConfig(axios.defaults, instanceConfig)); -}; + // set flag + this.isActive = true; -// Expose Cancel & CancelToken -axios.Cancel = __webpack_require__(98875); -axios.CancelToken = __webpack_require__(71587); -axios.isCancel = __webpack_require__(64057); + // start progress bar + bar.start(total, startValue, payload); -// Expose all/spread -axios.all = function all(promises) { - return Promise.all(promises); -}; -axios.spread = __webpack_require__(74850); + // trigger event + this.emit('start'); -// Expose isAxiosError -axios.isAxiosError = __webpack_require__(60650); + // return new instance + return bar; + } -module.exports = axios; + // remove a bar from the stack + remove(bar){ + // find element + const index = this.bars.indexOf(bar); -// Allow use of default import syntax in TypeScript -module.exports.default = axios; + // element found ? + if (index < 0){ + return false; + } + // remove element + this.bars.splice(index, 1); -/***/ }), + // force update + this.update(); -/***/ 98875: -/***/ ((module) => { + // clear bottom + this.terminal.newline(); + this.terminal.clearBottom(); -"use strict"; + return true; + } + // internal update routine + update(){ + // stop timer + if (this.timer){ + clearTimeout(this.timer); + this.timer = null; + } -/** - * A `Cancel` is an object that is thrown when an operation is canceled. - * - * @class - * @param {string=} message The message. - */ -function Cancel(message) { - this.message = message; -} + // trigger event + this.emit('update-pre'); + + // reset cursor + this.terminal.cursorRelativeReset(); -Cancel.prototype.toString = function toString() { - return 'Cancel' + (this.message ? ': ' + this.message : ''); -}; + // trigger event + this.emit('redraw-pre'); -Cancel.prototype.__CANCEL__ = true; + // update each bar + for (let i=0; i< this.bars.length; i++){ + // add new line ? + if (i > 0){ + this.terminal.newline(); + } -module.exports = Cancel; + // render + this.bars[i].render(); + } + // trigger event + this.emit('redraw-post'); -/***/ }), + // add new line in notty mode! + if (this.options.noTTYOutput && this.terminal.isTTY() === false){ + this.terminal.newline(); + this.terminal.newline(); + } -/***/ 71587: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // next update + this.timer = setTimeout(this.update.bind(this), this.schedulingRate); -"use strict"; + // trigger event + this.emit('update-post'); + // stop if stopOnComplete and all bars stopped + if (this.options.stopOnComplete && !this.bars.find(bar => bar.isActive)) { + this.stop(); + } + } -var Cancel = __webpack_require__(98875); + stop(){ -/** - * A `CancelToken` is an object that can be used to request cancellation of an operation. - * - * @class - * @param {Function} executor The executor function. - */ -function CancelToken(executor) { - if (typeof executor !== 'function') { - throw new TypeError('executor must be a function.'); - } + // stop timer + clearTimeout(this.timer); + this.timer = null; - var resolvePromise; - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); + // set flag + this.isActive = false; - var token = this; - executor(function cancel(message) { - if (token.reason) { - // Cancellation has already been requested - return; - } + // cursor hidden ? + if (this.options.hideCursor === true){ + this.terminal.cursor(true); + } - token.reason = new Cancel(message); - resolvePromise(token.reason); - }); -} + // re-enable line wrpaping ? + if (this.options.linewrap === false){ + this.terminal.lineWrapping(true); + } -/** - * Throws a `Cancel` if cancellation has been requested. - */ -CancelToken.prototype.throwIfRequested = function throwIfRequested() { - if (this.reason) { - throw this.reason; - } -}; + // reset cursor + this.terminal.cursorRelativeReset(); -/** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. - */ -CancelToken.source = function source() { - var cancel; - var token = new CancelToken(function executor(c) { - cancel = c; - }); - return { - token: token, - cancel: cancel - }; -}; + // trigger event + this.emit('stop-pre-clear'); -module.exports = CancelToken; + // clear line on complete ? + if (this.options.clearOnComplete){ + // clear all bars + this.terminal.clearBottom(); + + // or show final progress ? + }else{ + // update each bar + for (let i=0; i< this.bars.length; i++){ + // add new line ? + if (i > 0){ + this.terminal.newline(); + } + + // trigger final rendering + this.bars[i].render(); + + // stop + this.bars[i].stop(); + } + + // new line on complete + this.terminal.newline(); + } + + // trigger event + this.emit('stop'); + } +} /***/ }), -/***/ 64057: +/***/ 98322: /***/ ((module) => { -"use strict"; +// utility to merge defaults +function mergeOption(v, defaultValue){ + if (typeof v === 'undefined' || v === null){ + return defaultValue; + }else{ + return v; + } +} +module.exports = { + // set global options + parse: function parse(rawOptions, preset){ -module.exports = function isCancel(value) { - return !!(value && value.__CANCEL__); -}; + // options storage + const options = {}; + // merge preset + const opt = Object.assign({}, preset, rawOptions); -/***/ }), + // the max update rate in fps (redraw will only triggered on value change) + options.throttleTime = 1000 / (mergeOption(opt.fps, 10)); -/***/ 98178: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // the output stream to write on + options.stream = mergeOption(opt.stream, process.stderr); -"use strict"; + // external terminal provided ? + options.terminal = mergeOption(opt.terminal, null); + // clear on finish ? + options.clearOnComplete = mergeOption(opt.clearOnComplete, false); -var utils = __webpack_require__(20328); -var buildURL = __webpack_require__(30646); -var InterceptorManager = __webpack_require__(3214); -var dispatchRequest = __webpack_require__(85062); -var mergeConfig = __webpack_require__(74831); + // stop on finish ? + options.stopOnComplete = mergeOption(opt.stopOnComplete, false); -/** - * Create a new instance of Axios - * - * @param {Object} instanceConfig The default config for the instance - */ -function Axios(instanceConfig) { - this.defaults = instanceConfig; - this.interceptors = { - request: new InterceptorManager(), - response: new InterceptorManager() - }; -} + // size of the progressbar in chars + options.barsize = mergeOption(opt.barsize, 40); -/** - * Dispatch a request - * - * @param {Object} config The config specific for this request (merged with this.defaults) - */ -Axios.prototype.request = function request(config) { - /*eslint no-param-reassign:0*/ - // Allow for axios('example/url'[, config]) a la fetch API - if (typeof config === 'string') { - config = arguments[1] || {}; - config.url = arguments[0]; - } else { - config = config || {}; - } + // position of the progress bar - 'left' (default), 'right' or 'center' + options.align = mergeOption(opt.align, 'left'); - config = mergeConfig(this.defaults, config); + // hide the cursor ? + options.hideCursor = mergeOption(opt.hideCursor, false); - // Set config.method - if (config.method) { - config.method = config.method.toLowerCase(); - } else if (this.defaults.method) { - config.method = this.defaults.method.toLowerCase(); - } else { - config.method = 'get'; - } + // disable linewrapping ? + options.linewrap = mergeOption(opt.linewrap, false); - // Hook up interceptors middleware - var chain = [dispatchRequest, undefined]; - var promise = Promise.resolve(config); + // pre-render bar strings (performance) + options.barCompleteString = (new Array(options.barsize + 1 ).join(opt.barCompleteChar || '=')); + options.barIncompleteString = (new Array(options.barsize + 1 ).join(opt.barIncompleteChar || '-')); - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - chain.unshift(interceptor.fulfilled, interceptor.rejected); - }); + // glue sequence (control chars) between bar elements ? + options.barGlue = mergeOption(opt.barGlue, ''); - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - chain.push(interceptor.fulfilled, interceptor.rejected); - }); + // the bar format + options.format = mergeOption(opt.format, 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'); - while (chain.length) { - promise = promise.then(chain.shift(), chain.shift()); - } + // external time-format provided ? + options.formatTime = mergeOption(opt.formatTime, null); - return promise; -}; + // external value-format provided ? + options.formatValue = mergeOption(opt.formatValue, null); -Axios.prototype.getUri = function getUri(config) { - config = mergeConfig(this.defaults, config); - return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); -}; + // external bar-format provided ? + options.formatBar = mergeOption(opt.formatBar, null); -// Provide aliases for supported request methods -utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: (config || {}).data - })); - }; -}); + // the number of results to average ETA over + options.etaBufferLength = mergeOption(opt.etaBuffer, 10); -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, data, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: data - })); - }; -}); + // automatic eta updates based on fps + options.etaAsynchronousUpdate = mergeOption(opt.etaAsynchronousUpdate, false); -module.exports = Axios; + // allow synchronous updates ? + options.synchronousUpdate = mergeOption(opt.synchronousUpdate, true); + + // notty mode + options.noTTYOutput = mergeOption(opt.noTTYOutput, false); + + // schedule - 2s + options.notTTYSchedule = mergeOption(opt.notTTYSchedule, 2000); + + // emptyOnZero - false + options.emptyOnZero = mergeOption(opt.emptyOnZero, false); + + // force bar redraw even if progress did not change + options.forceRedraw = mergeOption(opt.forceRedraw, false); + + // automated padding to fixed width ? + options.autopadding = mergeOption(opt.autopadding, false); + + // autopadding character - empty in case autopadding is disabled + options.autopaddingChar = options.autopadding ? mergeOption(opt.autopaddingChar, ' ') : ''; + return options; + } +}; /***/ }), -/***/ 3214: +/***/ 37561: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; - +const _GenericBar = __webpack_require__(93455); +const _options = __webpack_require__(98322); -var utils = __webpack_require__(20328); +// Progress-Bar constructor +module.exports = class SingleBar extends _GenericBar{ -function InterceptorManager() { - this.handlers = []; -} + constructor(options, preset){ + super(_options.parse(options, preset)); -/** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * - * @return {Number} An ID used to remove interceptor later - */ -InterceptorManager.prototype.use = function use(fulfilled, rejected) { - this.handlers.push({ - fulfilled: fulfilled, - rejected: rejected - }); - return this.handlers.length - 1; -}; + // the update timer + this.timer = null; -/** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - */ -InterceptorManager.prototype.eject = function eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } -}; + // disable synchronous updates in notty mode + if (this.options.noTTYOutput && this.terminal.isTTY() === false){ + this.options.synchronousUpdate = false; + } -/** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - */ -InterceptorManager.prototype.forEach = function forEach(fn) { - utils.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); + // update interval + this.schedulingRate = (this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule); } - }); -}; - -module.exports = InterceptorManager; + // internal render function + render(){ + // stop timer + if (this.timer){ + clearTimeout(this.timer); + this.timer = null; + } -/***/ }), + // run internal rendering + super.render(); -/***/ 41934: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // add new line in notty mode! + if (this.options.noTTYOutput && this.terminal.isTTY() === false){ + this.terminal.newline(); + } -"use strict"; + // next update + this.timer = setTimeout(this.render.bind(this), this.schedulingRate); + } + update(current, payload){ + // timer inactive ? + if (!this.timer) { + return; + } -var isAbsoluteURL = __webpack_require__(41301); -var combineURLs = __webpack_require__(57189); + super.update(current, payload); -/** - * Creates a new URL by combining the baseURL with the requestedURL, - * only when the requestedURL is not already an absolute URL. - * If the requestURL is absolute, this function returns the requestedURL untouched. - * - * @param {string} baseURL The base URL - * @param {string} requestedURL Absolute or relative URL to combine - * @returns {string} The combined full path - */ -module.exports = function buildFullPath(baseURL, requestedURL) { - if (baseURL && !isAbsoluteURL(requestedURL)) { - return combineURLs(baseURL, requestedURL); - } - return requestedURL; -}; + // trigger synchronous update ? + // check for throttle time + if (this.options.synchronousUpdate && (this.lastRedraw + this.options.throttleTime*2) < Date.now()){ + // force update + this.render(); + } + } + // start the progress bar + start(total, startValue, payload){ + // progress updates are only visible in TTY mode! + if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){ + return; + } -/***/ }), + // save current cursor settings + this.terminal.cursorSave(); -/***/ 15226: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // hide the cursor ? + if (this.options.hideCursor === true){ + this.terminal.cursor(false); + } -"use strict"; + // disable line wrapping ? + if (this.options.linewrap === false){ + this.terminal.lineWrapping(false); + } + // initialize bar + super.start(total, startValue, payload); -var enhanceError = __webpack_require__(21516); + // redraw on start! + this.render(); + } -/** - * Create an Error with the specified message, config, error code, request and response. - * - * @param {string} message The error message. - * @param {Object} config The config. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The created error. - */ -module.exports = function createError(message, config, code, request, response) { - var error = new Error(message); - return enhanceError(error, config, code, request, response); -}; + // stop the bar + stop(){ + // timer inactive ? + if (!this.timer) { + return; + } + // trigger final rendering + this.render(); -/***/ }), + // restore state + super.stop(); -/***/ 85062: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // stop timer + clearTimeout(this.timer); + this.timer = null; -"use strict"; + // cursor hidden ? + if (this.options.hideCursor === true){ + this.terminal.cursor(true); + } + // re-enable line wrapping ? + if (this.options.linewrap === false){ + this.terminal.lineWrapping(true); + } -var utils = __webpack_require__(20328); -var transformData = __webpack_require__(19812); -var isCancel = __webpack_require__(64057); -var defaults = __webpack_require__(98190); + // restore cursor on complete (position + settings) + this.terminal.cursorRestore(); -/** - * Throws a `Cancel` if cancellation has been requested. - */ -function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } + // clear line on complete ? + if (this.options.clearOnComplete){ + this.terminal.cursorTo(0, null); + this.terminal.clearLine(); + }else{ + // new line on complete + this.terminal.newline(); + } + } } -/** - * Dispatch a request to the server using the configured adapter. - * - * @param {object} config The config that is to be used for the request - * @returns {Promise} The Promise to be fulfilled - */ -module.exports = function dispatchRequest(config) { - throwIfCancellationRequested(config); +/***/ }), - // Ensure headers exist - config.headers = config.headers || {}; +/***/ 44411: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Transform request data - config.data = transformData( - config.data, - config.headers, - config.transformRequest - ); +const _readline = __webpack_require__(51058); - // Flatten headers - config.headers = utils.merge( - config.headers.common || {}, - config.headers[config.method] || {}, - config.headers - ); +// low-level terminal interactions +class Terminal{ - utils.forEach( - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], - function cleanHeaderConfig(method) { - delete config.headers[method]; - } - ); + constructor(outputStream){ + this.stream = outputStream; - var adapter = config.adapter || defaults.adapter; + // default: line wrapping enabled + this.linewrap = true; - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); + // current, relative y position + this.dy = 0; + } - // Transform response data - response.data = transformData( - response.data, - response.headers, - config.transformResponse - ); + // save cursor position + settings + cursorSave(){ + if (!this.stream.isTTY){ + return; + } - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); + // save position + this.stream.write('\x1B7'); + } - // Transform response data - if (reason && reason.response) { - reason.response.data = transformData( - reason.response.data, - reason.response.headers, - config.transformResponse - ); - } + // restore last cursor position + settings + cursorRestore(){ + if (!this.stream.isTTY){ + return; + } + + // restore cursor + this.stream.write('\x1B8'); } - return Promise.reject(reason); - }); -}; + // show/hide cursor + cursor(enabled){ + if (!this.stream.isTTY){ + return; + } + if (enabled){ + this.stream.write('\x1B[?25h'); + }else{ + this.stream.write('\x1B[?25l'); + } + } -/***/ }), + // change cursor positionn + cursorTo(x=null, y=null){ + if (!this.stream.isTTY){ + return; + } -/***/ 21516: -/***/ ((module) => { + // move cursor absolute + _readline.cursorTo(this.stream, x, y); + } -"use strict"; + // change relative cursor position + cursorRelative(dx=null, dy=null){ + if (!this.stream.isTTY){ + return; + } + // store current position + this.dy = this.dy + dy; + + // move cursor relative + _readline.moveCursor(this.stream, dx, dy); + } -/** - * Update an Error with the specified config, error code, and response. - * - * @param {Error} error The error to update. - * @param {Object} config The config. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The error. - */ -module.exports = function enhanceError(error, config, code, request, response) { - error.config = config; - if (code) { - error.code = code; - } + // relative reset + cursorRelativeReset(){ + if (!this.stream.isTTY){ + return; + } - error.request = request; - error.response = response; - error.isAxiosError = true; + // move cursor to initial line + _readline.moveCursor(this.stream, 0, -this.dy); - error.toJSON = function toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: this.config, - code: this.code - }; - }; - return error; -}; + // first char + _readline.cursorTo(this.stream, 0, null); + // reset counter + this.dy = 0; + } -/***/ }), + // clear to the right from cursor + clearRight(){ + if (!this.stream.isTTY){ + return; + } -/***/ 74831: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + _readline.clearLine(this.stream, 1); + } -"use strict"; + // clear the full line + clearLine(){ + if (!this.stream.isTTY){ + return; + } + _readline.clearLine(this.stream, 0); + } -var utils = __webpack_require__(20328); + // clear everyting beyond the current line + clearBottom(){ + if (!this.stream.isTTY){ + return; + } -/** - * Config-specific merge-function which creates a new config-object - * by merging two configuration objects together. - * - * @param {Object} config1 - * @param {Object} config2 - * @returns {Object} New object resulting from merging config2 to config1 - */ -module.exports = function mergeConfig(config1, config2) { - // eslint-disable-next-line no-param-reassign - config2 = config2 || {}; - var config = {}; - - var valueFromConfig2Keys = ['url', 'method', 'data']; - var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; - var defaultToConfig2Keys = [ - 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', - 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', - 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', - 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' - ]; - var directMergeKeys = ['validateStatus']; - - function getMergedValue(target, source) { - if (utils.isPlainObject(target) && utils.isPlainObject(source)) { - return utils.merge(target, source); - } else if (utils.isPlainObject(source)) { - return utils.merge({}, source); - } else if (utils.isArray(source)) { - return source.slice(); + _readline.clearScreenDown(this.stream); } - return source; - } - function mergeDeepProperties(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(config1[prop], config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - config[prop] = getMergedValue(undefined, config1[prop]); + // add new line; increment counter + newline(){ + this.stream.write('\n'); + this.dy++; } - } - utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(undefined, config2[prop]); + // write content to output stream + // @TODO use string-width to strip length + write(s){ + // line wrapping enabled ? trim output + if (this.linewrap === true){ + this.stream.write(s.substr(0, this.getWidth())); + }else{ + this.stream.write(s); + } } - }); - utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); + // control line wrapping + lineWrapping(enabled){ + if (!this.stream.isTTY){ + return; + } - utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(undefined, config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - config[prop] = getMergedValue(undefined, config1[prop]); + // store state + this.linewrap = enabled; + if (enabled){ + this.stream.write('\x1B[?7h'); + }else{ + this.stream.write('\x1B[?7l'); + } } - }); - utils.forEach(directMergeKeys, function merge(prop) { - if (prop in config2) { - config[prop] = getMergedValue(config1[prop], config2[prop]); - } else if (prop in config1) { - config[prop] = getMergedValue(undefined, config1[prop]); + // tty environment ? + isTTY(){ + return (this.stream.isTTY === true); } - }); - - var axiosKeys = valueFromConfig2Keys - .concat(mergeDeepPropertiesKeys) - .concat(defaultToConfig2Keys) - .concat(directMergeKeys); - - var otherKeys = Object - .keys(config1) - .concat(Object.keys(config2)) - .filter(function filterAxiosKeys(key) { - return axiosKeys.indexOf(key) === -1; - }); - utils.forEach(otherKeys, mergeDeepProperties); + // get terminal width + getWidth(){ + // set max width to 80 in tty-mode and 200 in notty-mode + return this.stream.columns || (this.stream.isTTY ? 80 : 200); + } +} - return config; -}; +module.exports = Terminal; /***/ }), -/***/ 13211: +/***/ 35040: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +const _legacy = __webpack_require__(62594); +const _shades_classic = __webpack_require__(18373); +const _shades_grey = __webpack_require__(21106); +const _rect = __webpack_require__(50441); +module.exports = { + legacy: _legacy, + shades_classic: _shades_classic, + shades_grey: _shades_grey, + rect: _rect +}; -var createError = __webpack_require__(15226); +/***/ }), -/** - * Resolve or reject a Promise based on response status. - * - * @param {Function} resolve A function that resolves the promise. - * @param {Function} reject A function that rejects the promise. - * @param {object} response The response. - */ -module.exports = function settle(resolve, reject, response) { - var validateStatus = response.config.validateStatus; - if (!response.status || !validateStatus || validateStatus(response.status)) { - resolve(response); - } else { - reject(createError( - 'Request failed with status code ' + response.status, - response.config, - null, - response.request, - response - )); - } -}; +/***/ 62594: +/***/ ((module) => { +// cli-progress legacy style as of 1.x +module.exports = { + format: 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}', + barCompleteChar: '=', + barIncompleteChar: '-' +}; /***/ }), -/***/ 19812: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; +/***/ 50441: +/***/ ((module) => { +module.exports = { + format: ' {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}', + barCompleteChar: '\u25A0', + barIncompleteChar: ' ' +}; -var utils = __webpack_require__(20328); +/***/ }), -/** - * Transform the data for a request or a response - * - * @param {Object|String} data The data to be transformed - * @param {Array} headers The headers for the request or response - * @param {Array|Function} fns A single function or Array of functions - * @returns {*} The resulting transformed data - */ -module.exports = function transformData(data, headers, fns) { - /*eslint no-param-reassign:0*/ - utils.forEach(fns, function transform(fn) { - data = fn(data, headers); - }); +/***/ 18373: +/***/ ((module) => { - return data; +// cli-progress legacy style as of 1.x +module.exports = { + format: ' {bar} {percentage}% | ETA: {eta}s | {value}/{total}', + barCompleteChar: '\u2588', + barIncompleteChar: '\u2591' }; - /***/ }), -/***/ 98190: +/***/ 21106: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; - - -var utils = __webpack_require__(20328); -var normalizeHeaderName = __webpack_require__(36240); +const _colors = __webpack_require__(83045); -var DEFAULT_CONTENT_TYPE = { - 'Content-Type': 'application/x-www-form-urlencoded' +// cli-progress legacy style as of 1.x +module.exports = { + format: _colors.grey(' {bar}') + ' {percentage}% | ETA: {eta}s | {value}/{total}', + barCompleteChar: '\u2588', + barIncompleteChar: '\u2591' }; -function setContentTypeIfUnset(headers, value) { - if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { - headers['Content-Type'] = value; - } -} +/***/ }), -function getDefaultAdapter() { - var adapter; - if (typeof XMLHttpRequest !== 'undefined') { - // For browsers use XHR adapter - adapter = __webpack_require__(3454); - } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { - // For node use HTTP adapter - adapter = __webpack_require__(68104); - } - return adapter; -} +/***/ 52397: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -var defaults = { - adapter: getDefaultAdapter(), +"use strict"; - transformRequest: [function transformRequest(data, headers) { - normalizeHeaderName(headers, 'Accept'); - normalizeHeaderName(headers, 'Content-Type'); - if (utils.isFormData(data) || - utils.isArrayBuffer(data) || - utils.isBuffer(data) || - utils.isStream(data) || - utils.isFile(data) || - utils.isBlob(data) - ) { - return data; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(22116); +const castArray_1 = tslib_1.__importDefault(__webpack_require__(55996)); +const util_1 = __webpack_require__(31669); +class ActionBase { + constructor() { + this.std = 'stderr'; + this.stdmockOrigs = { + stdout: process.stdout.write, + stderr: process.stderr.write, + }; } - if (utils.isArrayBufferView(data)) { - return data.buffer; + start(action, status, opts = {}) { + this.std = opts.stdout ? 'stdout' : 'stderr'; + const task = { action, status, active: Boolean(this.task && this.task.active) }; + this.task = task; + this._start(); + task.active = true; + this._stdout(true); } - if (utils.isURLSearchParams(data)) { - setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); - return data.toString(); + stop(msg = 'done') { + const task = this.task; + if (!task) { + return; + } + this._stop(msg); + task.active = false; + this.task = undefined; + this._stdout(false); } - if (utils.isObject(data)) { - setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); - return JSON.stringify(data); + get globals() { + global['cli-ux'] = global['cli-ux'] || {}; + const globals = global['cli-ux']; + globals.action = globals.action || {}; + return globals; } - return data; - }], - - transformResponse: [function transformResponse(data) { - /*eslint no-param-reassign:0*/ - if (typeof data === 'string') { - try { - data = JSON.parse(data); - } catch (e) { /* Ignore */ } + get task() { + return this.globals.action.task; } - return data; - }], - - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, - - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', - - maxContentLength: -1, - maxBodyLength: -1, - - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; - } -}; - -defaults.headers = { - common: { - 'Accept': 'application/json, text/plain, */*' - } -}; - -utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { - defaults.headers[method] = {}; -}); - -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); -}); - -module.exports = defaults; + set task(task) { + this.globals.action.task = task; + } + get output() { + return this.globals.output; + } + set output(output) { + this.globals.output = output; + } + get running() { + return Boolean(this.task); + } + get status() { + return this.task ? this.task.status : undefined; + } + set status(status) { + const task = this.task; + if (!task) { + return; + } + if (task.status === status) { + return; + } + this._updateStatus(status, task.status); + task.status = status; + } + async pauseAsync(fn, icon) { + const task = this.task; + const active = task && task.active; + if (task && active) { + this._pause(icon); + this._stdout(false); + task.active = false; + } + const ret = await fn(); + if (task && active) { + this._resume(); + } + return ret; + } + pause(fn, icon) { + const task = this.task; + const active = task && task.active; + if (task && active) { + this._pause(icon); + this._stdout(false); + task.active = false; + } + const ret = fn(); + if (task && active) { + this._resume(); + } + return ret; + } + _start() { + throw new Error('not implemented'); + } + _stop(_) { + throw new Error('not implemented'); + } + _resume() { + if (this.task) + this.start(this.task.action, this.task.status); + } + _pause(_) { + throw new Error('not implemented'); + } + // eslint-disable-next-line @typescript-eslint/no-empty-function + _updateStatus(_, __) { } + /** + * mock out stdout/stderr so it doesn't screw up the rendering + */ + _stdout(toggle) { + try { + const outputs = ['stdout', 'stderr']; + if (toggle) { + if (this.stdmocks) + return; + this.stdmockOrigs = { + stdout: process.stdout.write, + stderr: process.stderr.write, + }; + this.stdmocks = []; + for (const std of outputs) { + process[std].write = (...args) => { + this.stdmocks.push([std, args]); + }; + } + } + else { + if (!this.stdmocks) + return; + // this._write('stderr', '\nresetstdmock\n\n\n') + delete this.stdmocks; + for (const std of outputs) + process[std].write = this.stdmockOrigs[std]; + } + } + catch (error) { + this._write('stderr', util_1.inspect(error)); + } + } + /** + * flush mocked stdout/stderr + */ + _flushStdout() { + try { + let output = ''; + let std; + while (this.stdmocks && this.stdmocks.length) { + const cur = this.stdmocks.shift(); + std = cur[0]; + this._write(std, cur[1]); + output += cur[1][0].toString('utf8'); + } + // add newline if there isn't one already + // otherwise we'll just overwrite it when we render + if (output && std && output[output.length - 1] !== '\n') { + this._write(std, '\n'); + } + } + catch (error) { + this._write('stderr', util_1.inspect(error)); + } + } + /** + * write to the real stdout/stderr + */ + _write(std, s) { + this.stdmockOrigs[std].apply(process[std], castArray_1.default(s)); + } +} +exports.ActionBase = ActionBase; /***/ }), -/***/ 77065: -/***/ ((module) => { +/***/ 91525: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; - -module.exports = function bind(fn, thisArg) { - return function wrap() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; +// tslint:disable restrict-plus-operands +__webpack_unused_export__ = ({ value: true }); +const tslib_1 = __webpack_require__(22116); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +const supportsColor = tslib_1.__importStar(__webpack_require__(91691)); +const spinner_1 = tslib_1.__importDefault(__webpack_require__(60062)); +function color(s, frameIndex) { + const prideColors = [ + chalk_1.default.keyword('pink'), + chalk_1.default.red, + chalk_1.default.keyword('orange'), + chalk_1.default.yellow, + chalk_1.default.green, + chalk_1.default.cyan, + chalk_1.default.blue, + chalk_1.default.magenta, + ]; + if (!supportsColor) + return s; + const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').indexOf('256') !== -1; + const prideColor = prideColors[frameIndex] || prideColors[0]; + return has256 ? prideColor(s) : chalk_1.default.magenta(s); +} +class PrideSpinnerAction extends spinner_1.default { + _frame() { + const frame = this.frames[this.frameIndex]; + this.frameIndex = ++this.frameIndex % this.frames.length; + return color(frame, this.frameIndex); } - return fn.apply(thisArg, args); - }; -}; +} +exports.Z = PrideSpinnerAction; /***/ }), -/***/ 30646: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 96419: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; - -var utils = __webpack_require__(20328); - -function encode(val) { - return encodeURIComponent(val). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%20/g, '+'). - replace(/%5B/gi, '['). - replace(/%5D/gi, ']'); -} - -/** - * Build a URL by appending params to the end - * - * @param {string} url The base of the url (e.g., http://www.google.com) - * @param {object} [params] The params to be appended - * @returns {string} The formatted url - */ -module.exports = function buildURL(url, params, paramsSerializer) { - /*eslint no-param-reassign:0*/ - if (!params) { - return url; - } - - var serializedParams; - if (paramsSerializer) { - serializedParams = paramsSerializer(params); - } else if (utils.isURLSearchParams(params)) { - serializedParams = params.toString(); - } else { - var parts = []; - - utils.forEach(params, function serialize(val, key) { - if (val === null || typeof val === 'undefined') { - return; - } - - if (utils.isArray(val)) { - key = key + '[]'; - } else { - val = [val]; - } - - utils.forEach(val, function parseValue(v) { - if (utils.isDate(v)) { - v = v.toISOString(); - } else if (utils.isObject(v)) { - v = JSON.stringify(v); - } - parts.push(encode(key) + '=' + encode(v)); - }); - }); - - serializedParams = parts.join('&'); - } - - if (serializedParams) { - var hashmarkIndex = url.indexOf('#'); - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); +__webpack_unused_export__ = ({ value: true }); +const base_1 = __webpack_require__(52397); +class SimpleAction extends base_1.ActionBase { + constructor() { + super(...arguments); + this.type = 'simple'; } - - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; - } - - return url; -}; - - -/***/ }), - -/***/ 57189: -/***/ ((module) => { - -"use strict"; - - -/** - * Creates a new URL by combining the specified URLs - * - * @param {string} baseURL The base URL - * @param {string} relativeURL The relative URL - * @returns {string} The combined URL - */ -module.exports = function combineURLs(baseURL, relativeURL) { - return relativeURL - ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') - : baseURL; -}; - - -/***/ }), - -/***/ 21545: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var utils = __webpack_require__(20328); - -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs support document.cookie - (function standardBrowserEnv() { - return { - write: function write(name, value, expires, path, domain, secure) { - var cookie = []; - cookie.push(name + '=' + encodeURIComponent(value)); - - if (utils.isNumber(expires)) { - cookie.push('expires=' + new Date(expires).toGMTString()); - } - - if (utils.isString(path)) { - cookie.push('path=' + path); - } - - if (utils.isString(domain)) { - cookie.push('domain=' + domain); - } - - if (secure === true) { - cookie.push('secure'); - } - - document.cookie = cookie.join('; '); - }, - - read: function read(name) { - var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); - return (match ? decodeURIComponent(match[3]) : null); - }, - - remove: function remove(name) { - this.write(name, '', Date.now() - 86400000); - } - }; - })() : - - // Non standard browser env (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return { - write: function write() {}, - read: function read() { return null; }, - remove: function remove() {} - }; - })() -); - - -/***/ }), - -/***/ 41301: -/***/ ((module) => { - -"use strict"; - - -/** - * Determines whether the specified URL is absolute - * - * @param {string} url The URL to test - * @returns {boolean} True if the specified URL is absolute, otherwise false - */ -module.exports = function isAbsoluteURL(url) { - // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). - // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed - // by any combination of letters, digits, plus, period, or hyphen. - return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); -}; - - -/***/ }), - -/***/ 60650: -/***/ ((module) => { - -"use strict"; - - -/** - * Determines whether the payload is an error thrown by Axios - * - * @param {*} payload The value to test - * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false - */ -module.exports = function isAxiosError(payload) { - return (typeof payload === 'object') && (payload.isAxiosError === true); -}; - - -/***/ }), - -/***/ 33608: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var utils = __webpack_require__(20328); - -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs have full support of the APIs needed to test - // whether the request URL is of the same origin as current location. - (function standardBrowserEnv() { - var msie = /(msie|trident)/i.test(navigator.userAgent); - var urlParsingNode = document.createElement('a'); - var originURL; - - /** - * Parse a URL to discover it's components - * - * @param {String} url The URL to be parsed - * @returns {Object} - */ - function resolveURL(url) { - var href = url; - - if (msie) { - // IE needs attribute set twice to normalize properties - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } - - urlParsingNode.setAttribute('href', href); - - // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: urlParsingNode.hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') ? - urlParsingNode.pathname : - '/' + urlParsingNode.pathname - }; - } - - originURL = resolveURL(window.location.href); - - /** - * Determine if a URL shares the same origin as the current location - * - * @param {String} requestURL The URL to test - * @returns {boolean} True if URL shares the same origin, otherwise false - */ - return function isURLSameOrigin(requestURL) { - var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; - return (parsed.protocol === originURL.protocol && - parsed.host === originURL.host); - }; - })() : - - // Non standard browser envs (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return function isURLSameOrigin() { - return true; - }; - })() -); - - -/***/ }), - -/***/ 36240: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var utils = __webpack_require__(20328); - -module.exports = function normalizeHeaderName(headers, normalizedName) { - utils.forEach(headers, function processHeader(value, name) { - if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { - headers[normalizedName] = value; - delete headers[name]; + _start() { + const task = this.task; + if (!task) + return; + this._render(task.action, task.status); } - }); -}; + _pause(icon) { + if (icon) + this._updateStatus(icon); + else + this._flush(); + } + // eslint-disable-next-line @typescript-eslint/no-empty-function + _resume() { } + _updateStatus(status, prevStatus, newline = false) { + const task = this.task; + if (!task) + return; + if (task.active && !prevStatus) + this._write(this.std, ` ${status}`); + else + this._write(this.std, `${task.action}... ${status}`); + if (newline || !prevStatus) + this._flush(); + } + _stop(status) { + const task = this.task; + if (!task) + return; + this._updateStatus(status, task.status, true); + } + _render(action, status) { + const task = this.task; + if (!task) + return; + if (task.active) + this._flush(); + this._write(this.std, status ? `${action}... ${status}` : `${action}...`); + } + _flush() { + this._write(this.std, '\n'); + this._flushStdout(); + } +} +exports.Z = SimpleAction; /***/ }), -/***/ 86455: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 60062: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; - -var utils = __webpack_require__(20328); - -// Headers whose duplicates are ignored by node -// c.f. https://nodejs.org/api/http.html#http_message_headers -var ignoreDuplicateOf = [ - 'age', 'authorization', 'content-length', 'content-type', 'etag', - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', - 'last-modified', 'location', 'max-forwards', 'proxy-authorization', - 'referer', 'retry-after', 'user-agent' -]; - -/** - * Parse headers into an object - * - * ``` - * Date: Wed, 27 Aug 2014 08:58:49 GMT - * Content-Type: application/json - * Connection: keep-alive - * Transfer-Encoding: chunked - * ``` - * - * @param {String} headers Headers needing to be parsed - * @returns {Object} Headers parsed into an object - */ -module.exports = function parseHeaders(headers) { - var parsed = {}; - var key; - var val; - var i; - - if (!headers) { return parsed; } - - utils.forEach(headers.split('\n'), function parser(line) { - i = line.indexOf(':'); - key = utils.trim(line.substr(0, i)).toLowerCase(); - val = utils.trim(line.substr(i + 1)); - - if (key) { - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { - return; - } - if (key === 'set-cookie') { - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); - } else { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } +// tslint:disable restrict-plus-operands +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(22116); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +const supportsColor = tslib_1.__importStar(__webpack_require__(91691)); +const deps_1 = tslib_1.__importDefault(__webpack_require__(74560)); +const base_1 = __webpack_require__(52397); +/* eslint-disable-next-line node/no-missing-require */ +const spinners = __webpack_require__(9001); +function color(s) { + if (!supportsColor) + return s; + const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').indexOf('256') !== -1; + return has256 ? `\u001B[38;5;104m${s}${deps_1.default.ansiStyles.reset.open}` : chalk_1.default.magenta(s); +} +class SpinnerAction extends base_1.ActionBase { + constructor() { + super(); + this.type = 'spinner'; + this.frames = spinners[process.platform === 'win32' ? 'line' : 'dots2'].frames; + this.frameIndex = 0; } - }); - - return parsed; -}; + _start() { + this._reset(); + if (this.spinner) + clearInterval(this.spinner); + this._render(); + this.spinner = setInterval(icon => this._render.bind(this)(icon), process.platform === 'win32' ? 500 : 100, 'spinner'); + const interval = this.spinner; + interval.unref(); + } + _stop(status) { + if (this.task) + this.task.status = status; + if (this.spinner) + clearInterval(this.spinner); + this._render(); + this.output = undefined; + } + _pause(icon) { + if (this.spinner) + clearInterval(this.spinner); + this._reset(); + if (icon) + this._render(` ${icon}`); + this.output = undefined; + } + _frame() { + const frame = this.frames[this.frameIndex]; + this.frameIndex = ++this.frameIndex % this.frames.length; + return color(frame); + } + _render(icon) { + const task = this.task; + if (!task) + return; + this._reset(); + this._flushStdout(); + const frame = icon === 'spinner' ? ` ${this._frame()}` : icon || ''; + const status = task.status ? ` ${task.status}` : ''; + this.output = `${task.action}...${frame}${status}\n`; + this._write(this.std, this.output); + } + _reset() { + if (!this.output) + return; + const lines = this._lines(this.output); + this._write(this.std, deps_1.default.ansiEscapes.cursorLeft + deps_1.default.ansiEscapes.cursorUp(lines) + deps_1.default.ansiEscapes.eraseDown); + this.output = undefined; + } + _lines(s) { + return deps_1.default + .stripAnsi(s) + .split('\n') + .map(l => Math.ceil(l.length / deps_1.default.screen.errtermwidth)) + .reduce((c, i) => c + i, 0); + } +} +exports.default = SpinnerAction; /***/ }), -/***/ 74850: +/***/ 9001: /***/ ((module) => { "use strict"; +module.exports = { + hexagon: { + interval: 400, + frames: ['⬡', '⬢'], + }, + dots: { + interval: 80, + frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'], + }, + dots2: { + interval: 80, + frames: ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'], + }, + dots3: { + interval: 80, + frames: ['⠋', '⠙', '⠚', '⠞', '⠖', '⠦', '⠴', '⠲', '⠳', '⠓'], + }, + dots4: { + interval: 80, + frames: ['⠄', '⠆', '⠇', '⠋', '⠙', '⠸', '⠰', '⠠', '⠰', '⠸', '⠙', '⠋', '⠇', '⠆'], + }, + dots5: { + interval: 80, + frames: ['⠋', '⠙', '⠚', '⠒', '⠂', '⠂', '⠒', '⠲', '⠴', '⠦', '⠖', '⠒', '⠐', '⠐', '⠒', '⠓', '⠋'], + }, + dots6: { + interval: 80, + frames: [ + '⠁', + '⠉', + '⠙', + '⠚', + '⠒', + '⠂', + '⠂', + '⠒', + '⠲', + '⠴', + '⠤', + '⠄', + '⠄', + '⠤', + '⠴', + '⠲', + '⠒', + '⠂', + '⠂', + '⠒', + '⠚', + '⠙', + '⠉', + '⠁', + ], + }, + dots7: { + interval: 80, + frames: [ + '⠈', + '⠉', + '⠋', + '⠓', + '⠒', + '⠐', + '⠐', + '⠒', + '⠖', + '⠦', + '⠤', + '⠠', + '⠠', + '⠤', + '⠦', + '⠖', + '⠒', + '⠐', + '⠐', + '⠒', + '⠓', + '⠋', + '⠉', + '⠈', + ], + }, + dots8: { + interval: 80, + frames: [ + '⠁', + '⠁', + '⠉', + '⠙', + '⠚', + '⠒', + '⠂', + '⠂', + '⠒', + '⠲', + '⠴', + '⠤', + '⠄', + '⠄', + '⠤', + '⠠', + '⠠', + '⠤', + '⠦', + '⠖', + '⠒', + '⠐', + '⠐', + '⠒', + '⠓', + '⠋', + '⠉', + '⠈', + '⠈', + ], + }, + dots9: { + interval: 80, + frames: ['⢹', '⢺', '⢼', '⣸', '⣇', '⡧', '⡗', '⡏'], + }, + dots10: { + interval: 80, + frames: ['⢄', '⢂', '⢁', '⡁', '⡈', '⡐', '⡠'], + }, + dots11: { + interval: 100, + frames: ['⠁', '⠂', '⠄', '⡀', '⢀', '⠠', '⠐', '⠈'], + }, + line: { + interval: 130, + frames: ['-', '\\', '|', '/'], + }, + line2: { + interval: 100, + frames: ['⠂', '-', '–', '—', '–', '-'], + }, + pipe: { + interval: 100, + frames: ['┤', '┘', '┴', '└', '├', '┌', '┬', '┐'], + }, + simpleDots: { + interval: 400, + frames: ['. ', '.. ', '...', ' '], + }, + simpleDotsScrolling: { + interval: 200, + frames: ['. ', '.. ', '...', ' ..', ' .', ' '], + }, + star: { + interval: 70, + frames: ['✶', '✸', '✹', '✺', '✹', '✷'], + }, + star2: { + interval: 80, + frames: ['+', 'x', '*'], + }, + flip: { + interval: 70, + frames: ['_', '_', '_', '-', '`', '`', '\'', '´', '-', '_', '_', '_'], + }, + hamburger: { + interval: 100, + frames: ['☱', '☲', '☴'], + }, + growVertical: { + interval: 120, + frames: ['▁', '▃', '▄', '▅', '▆', '▇', '▆', '▅', '▄', '▃'], + }, + growHorizontal: { + interval: 120, + frames: ['▏', '▎', '▍', '▌', '▋', '▊', '▉', '▊', '▋', '▌', '▍', '▎'], + }, + balloon: { + interval: 140, + frames: [' ', '.', 'o', 'O', '@', '*', ' '], + }, + balloon2: { + interval: 120, + frames: ['.', 'o', 'O', '°', 'O', 'o', '.'], + }, + noise: { + interval: 100, + frames: ['▓', '▒', '░'], + }, + bounce: { + interval: 120, + frames: ['⠁', '⠂', '⠄', '⠂'], + }, + boxBounce: { + interval: 120, + frames: ['▖', '▘', '▝', '▗'], + }, + boxBounce2: { + interval: 100, + frames: ['▌', '▀', '▐', '▄'], + }, + triangle: { + interval: 50, + frames: ['◢', '◣', '◤', '◥'], + }, + arc: { + interval: 100, + frames: ['◜', '◠', '◝', '◞', '◡', '◟'], + }, + circle: { + interval: 120, + frames: ['◡', '⊙', '◠'], + }, + squareCorners: { + interval: 180, + frames: ['◰', '◳', '◲', '◱'], + }, + circleQuarters: { + interval: 120, + frames: ['◴', '◷', '◶', '◵'], + }, + circleHalves: { + interval: 50, + frames: ['◐', '◓', '◑', '◒'], + }, + squish: { + interval: 100, + frames: ['╫', '╪'], + }, + toggle: { + interval: 250, + frames: ['⊶', '⊷'], + }, + toggle2: { + interval: 80, + frames: ['▫', '▪'], + }, + toggle3: { + interval: 120, + frames: ['□', '■'], + }, + toggle4: { + interval: 100, + frames: ['■', '□', '▪', '▫'], + }, + toggle5: { + interval: 100, + frames: ['▮', '▯'], + }, + toggle6: { + interval: 300, + frames: ['ဝ', '၀'], + }, + toggle7: { + interval: 80, + frames: ['⦾', '⦿'], + }, + toggle8: { + interval: 100, + frames: ['◍', '◌'], + }, + toggle9: { + interval: 100, + frames: ['◉', '◎'], + }, + toggle10: { + interval: 100, + frames: ['㊂', '㊀', '㊁'], + }, + toggle11: { + interval: 50, + frames: ['⧇', '⧆'], + }, + toggle12: { + interval: 120, + frames: ['☗', '☖'], + }, + toggle13: { + interval: 80, + frames: ['=', '*', '-'], + }, + arrow: { + interval: 100, + frames: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'], + }, + arrow2: { + interval: 80, + frames: ['⬆️ ', '↗️ ', '➡️ ', '↘️ ', '⬇️ ', '↙️ ', '⬅️ ', '↖️ '], + }, + arrow3: { + interval: 120, + frames: ['▹▹▹▹▹', '▸▹▹▹▹', '▹▸▹▹▹', '▹▹▸▹▹', '▹▹▹▸▹', '▹▹▹▹▸'], + }, + bouncingBar: { + interval: 80, + frames: ['[ ]', '[ =]', '[ ==]', '[ ===]', '[====]', '[=== ]', '[== ]', '[= ]'], + }, + bouncingBall: { + interval: 80, + frames: [ + '( ● )', + '( ● )', + '( ● )', + '( ● )', + '( ●)', + '( ● )', + '( ● )', + '( ● )', + '( ● )', + '(● )', + ], + }, + smiley: { + interval: 200, + frames: ['😄 ', '😝 '], + }, + monkey: { + interval: 300, + frames: ['🙈 ', '🙈 ', '🙉 ', '🙊 '], + }, + hearts: { + interval: 100, + frames: ['💛 ', '💙 ', '💜 ', '💚 ', '❤️ '], + }, + clock: { + interval: 100, + frames: ['🕐 ', '🕑 ', '🕒 ', '🕓 ', '🕔 ', '🕕 ', '🕖 ', '🕗 ', '🕘 ', '🕙 ', '🕚 '], + }, + earth: { + interval: 180, + frames: ['🌍 ', '🌎 ', '🌏 '], + }, + moon: { + interval: 80, + frames: ['🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 '], + }, + runner: { + interval: 140, + frames: ['🚶 ', '🏃 '], + }, + pong: { + interval: 80, + frames: [ + '▐⠂ ▌', + '▐⠈ ▌', + '▐ ⠂ ▌', + '▐ ⠠ ▌', + '▐ ⡀ ▌', + '▐ ⠠ ▌', + '▐ ⠂ ▌', + '▐ ⠈ ▌', + '▐ ⠂ ▌', + '▐ ⠠ ▌', + '▐ ⡀ ▌', + '▐ ⠠ ▌', + '▐ ⠂ ▌', + '▐ ⠈ ▌', + '▐ ⠂▌', + '▐ ⠠▌', + '▐ ⡀▌', + '▐ ⠠ ▌', + '▐ ⠂ ▌', + '▐ ⠈ ▌', + '▐ ⠂ ▌', + '▐ ⠠ ▌', + '▐ ⡀ ▌', + '▐ ⠠ ▌', + '▐ ⠂ ▌', + '▐ ⠈ ▌', + '▐ ⠂ ▌', + '▐ ⠠ ▌', + '▐ ⡀ ▌', + '▐⠠ ▌', + ], + }, +}; -/** - * Syntactic sugar for invoking a function and expanding an array for arguments. - * - * Common use case would be to use `Function.prototype.apply`. - * - * ```js - * function f(x, y, z) {} - * var args = [1, 2, 3]; - * f.apply(null, args); - * ``` - * - * With `spread` this example can be re-written. - * - * ```js - * spread(function(x, y, z) {})([1, 2, 3]); - * ``` - * - * @param {Function} callback - * @returns {Function} - */ -module.exports = function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; -}; - - -/***/ }), - -/***/ 20328: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(77065); - -/*global toString:true*/ - -// utils is a library of generic helper functions non-specific to axios - -var toString = Object.prototype.toString; - -/** - * Determine if a value is an Array - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Array, otherwise false - */ -function isArray(val) { - return toString.call(val) === '[object Array]'; -} - -/** - * Determine if a value is undefined - * - * @param {Object} val The value to test - * @returns {boolean} True if the value is undefined, otherwise false - */ -function isUndefined(val) { - return typeof val === 'undefined'; -} -/** - * Determine if a value is a Buffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Buffer, otherwise false - */ -function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) - && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); -} +/***/ }), -/** - * Determine if a value is an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an ArrayBuffer, otherwise false - */ -function isArrayBuffer(val) { - return toString.call(val) === '[object ArrayBuffer]'; -} +/***/ 25155: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/** - * Determine if a value is a FormData - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an FormData, otherwise false - */ -function isFormData(val) { - return (typeof FormData !== 'undefined') && (val instanceof FormData); -} +"use strict"; -/** - * Determine if a value is a view on an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false - */ -function isArrayBufferView(val) { - var result; - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { - result = ArrayBuffer.isView(val); - } else { - result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); - } - return result; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __webpack_require__(22116); +const semver = tslib_1.__importStar(__webpack_require__(11383)); +const version = semver.parse(__webpack_require__(14062)/* .version */ .i8); +const g = global; +const globals = g['cli-ux'] || (g['cli-ux'] = {}); +const actionType = (Boolean(process.stderr.isTTY) && + !process.env.CI && + !['dumb', 'emacs-color'].includes(process.env.TERM) && + 'spinner') || 'simple'; +/* eslint-disable node/no-missing-require */ +const Action = actionType === 'spinner' ? __webpack_require__(60062).default : __webpack_require__(96419)/* .default */ .Z; +const PrideAction = actionType === 'spinner' ? __webpack_require__(91525)/* .default */ .Z : __webpack_require__(96419)/* .default */ .Z; +/* eslint-enable node/no-missing-require */ +class Config { + constructor() { + this.outputLevel = 'info'; + this.action = new Action(); + this.prideAction = new PrideAction(); + this.errorsHandled = false; + this.showStackTrace = true; + } + get debug() { + return globals.debug || process.env.DEBUG === '*'; + } + set debug(v) { + globals.debug = v; + } + get context() { + return globals.context || {}; + } + set context(v) { + globals.context = v; + } } - -/** - * Determine if a value is a String - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a String, otherwise false - */ -function isString(val) { - return typeof val === 'string'; +exports.Config = Config; +function fetch() { + if (globals[version.major]) + return globals[version.major]; + globals[version.major] = new Config(); + return globals[version.major]; } +exports.config = fetch(); +exports.default = exports.config; -/** - * Determine if a value is a Number - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Number, otherwise false - */ -function isNumber(val) { - return typeof val === 'number'; -} -/** - * Determine if a value is an Object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Object, otherwise false - */ -function isObject(val) { - return val !== null && typeof val === 'object'; -} +/***/ }), -/** - * Determine if a value is a plain Object - * - * @param {Object} val The value to test - * @return {boolean} True if value is a plain Object, otherwise false - */ -function isPlainObject(val) { - if (toString.call(val) !== '[object Object]') { - return false; - } +/***/ 74560: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - var prototype = Object.getPrototypeOf(val); - return prototype === null || prototype === Object.prototype; -} +"use strict"; -/** - * Determine if a value is a Date - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Date, otherwise false - */ -function isDate(val) { - return toString.call(val) === '[object Date]'; -} - -/** - * Determine if a value is a File - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a File, otherwise false - */ -function isFile(val) { - return toString.call(val) === '[object File]'; -} - -/** - * Determine if a value is a Blob - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Blob, otherwise false - */ -function isBlob(val) { - return toString.call(val) === '[object Blob]'; -} - -/** - * Determine if a value is a Function - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Function, otherwise false - */ -function isFunction(val) { - return toString.call(val) === '[object Function]'; -} - -/** - * Determine if a value is a Stream - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Stream, otherwise false - */ -function isStream(val) { - return isObject(val) && isFunction(val.pipe); -} - -/** - * Determine if a value is a URLSearchParams object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a URLSearchParams object, otherwise false - */ -function isURLSearchParams(val) { - return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; -} - -/** - * Trim excess whitespace off the beginning and end of a string - * - * @param {String} str The String to trim - * @returns {String} The String freed of excess whitespace - */ -function trim(str) { - return str.replace(/^\s*/, '').replace(/\s*$/, ''); -} - -/** - * Determine if we're running in a standard browser environment - * - * This allows axios to run in a web worker, and react-native. - * Both environments support XMLHttpRequest, but not fully standard globals. - * - * web workers: - * typeof window -> undefined - * typeof document -> undefined - * - * react-native: - * navigator.product -> 'ReactNative' - * nativescript - * navigator.product -> 'NativeScript' or 'NS' - */ -function isStandardBrowserEnv() { - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || - navigator.product === 'NativeScript' || - navigator.product === 'NS')) { - return false; - } - return ( - typeof window !== 'undefined' && - typeof document !== 'undefined' - ); -} - -/** - * Iterate over an Array or an Object invoking a function for each item. - * - * If `obj` is an Array callback will be called passing - * the value, index, and complete array for each item. - * - * If 'obj' is an Object callback will be called passing - * the value, key, and complete object for each property. - * - * @param {Object|Array} obj The object to iterate - * @param {Function} fn The callback to invoke for each item - */ -function forEach(obj, fn) { - // Don't bother if no value provided - if (obj === null || typeof obj === 'undefined') { - return; - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* eslint-disable node/no-missing-require */ +exports.default = { + get stripAnsi() { + return __webpack_require__(45591); + }, + get ansiStyles() { + return __webpack_require__(76869); + }, + get ansiEscapes() { + return __webpack_require__(18512); + }, + get passwordPrompt() { + return __webpack_require__(71719); + }, + get screen() { + return __webpack_require__(6493); + }, + get open() { + return __webpack_require__(46099)/* .default */ .Z; + }, + get prompt() { + return __webpack_require__(46858); + }, + get styledObject() { + return __webpack_require__(20028)/* .default */ .Z; + }, + get styledHeader() { + return __webpack_require__(63272)/* .default */ .Z; + }, + get styledJSON() { + return __webpack_require__(7842)/* .default */ .Z; + }, + get table() { + return __webpack_require__(5402).table; + }, + get tree() { + return __webpack_require__(56673)/* .default */ .ZP; + }, + get wait() { + return __webpack_require__(59477)/* .default */ .Z; + }, + get progress() { + return __webpack_require__(57867)/* .default */ .Z; + }, +}; - // Force an array if not already something iterable - if (typeof obj !== 'object') { - /*eslint no-param-reassign:0*/ - obj = [obj]; - } - if (isArray(obj)) { - // Iterate over array values - for (var i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - // Iterate over object keys - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - fn.call(null, obj[key], key, obj); - } - } - } -} +/***/ }), -/** - * Accepts varargs expecting each argument to be an object, then - * immutably merges the properties of each object and returns result. - * - * When multiple objects contain the same key the later object in - * the arguments list will take precedence. - * - * Example: - * - * ```js - * var result = merge({foo: 123}, {foo: 456}); - * console.log(result.foo); // outputs 456 - * ``` - * - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function merge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (isPlainObject(result[key]) && isPlainObject(val)) { - result[key] = merge(result[key], val); - } else if (isPlainObject(val)) { - result[key] = merge({}, val); - } else if (isArray(val)) { - result[key] = val.slice(); - } else { - result[key] = val; - } - } +/***/ 29089: +/***/ ((__unused_webpack_module, exports) => { - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} +"use strict"; -/** - * Extends object a by mutably adding to it the properties of object b. - * - * @param {Object} a The object to be extended - * @param {Object} b The object to copy properties from - * @param {Object} thisArg The object to bind function to - * @return {Object} The resulting value of object a - */ -function extend(a, b, thisArg) { - forEach(b, function assignValue(val, key) { - if (thisArg && typeof val === 'function') { - a[key] = bind(val, thisArg); - } else { - a[key] = val; +Object.defineProperty(exports, "__esModule", ({ value: true })); +class ExitError extends Error { + constructor(status, error) { + const code = 'EEXIT'; + super(error ? error.message : `${code}: ${status}`); + this.error = error; + this['cli-ux'] = { exit: status }; + this.code = code; } - }); - return a; -} - -/** - * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) - * - * @param {string} content with BOM - * @return {string} content value without BOM - */ -function stripBOM(content) { - if (content.charCodeAt(0) === 0xFEFF) { - content = content.slice(1); - } - return content; } - -module.exports = { - isArray: isArray, - isArrayBuffer: isArrayBuffer, - isBuffer: isBuffer, - isFormData: isFormData, - isArrayBufferView: isArrayBufferView, - isString: isString, - isNumber: isNumber, - isObject: isObject, - isPlainObject: isPlainObject, - isUndefined: isUndefined, - isDate: isDate, - isFile: isFile, - isBlob: isBlob, - isFunction: isFunction, - isStream: isStream, - isURLSearchParams: isURLSearchParams, - isStandardBrowserEnv: isStandardBrowserEnv, - forEach: forEach, - merge: merge, - extend: extend, - trim: trim, - stripBOM: stripBOM -}; +exports.ExitError = ExitError; /***/ }), -/***/ 68959: +/***/ 81982: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(64707); -const errors_1 = __webpack_require__(52564); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(38707)); -const debug_1 = tslib_1.__importDefault(__webpack_require__(38237)); -const debug = debug_1.default('bump-cli:api-client'); -class APIError extends errors_1.CLIError { - constructor(httpError, info = [], exit = 100) { - var _a, _b; - const status = (_a = httpError === null || httpError === void 0 ? void 0 : httpError.response) === null || _a === void 0 ? void 0 : _a.status; - debug(httpError); - switch ((_b = httpError === null || httpError === void 0 ? void 0 : httpError.response) === null || _b === void 0 ? void 0 : _b.status) { - case 422: - [info, exit] = APIError.invalidDefinition(httpError.response.data); - break; - case 401: - [info, exit] = APIError.unauthenticated(); - break; - case 404: - case 400: - [info, exit] = APIError.notFound(httpError.response.data); - break; +const tslib_1 = __webpack_require__(22116); +const Errors = tslib_1.__importStar(__webpack_require__(52564)); +const util = tslib_1.__importStar(__webpack_require__(31669)); +const base_1 = __webpack_require__(52397); +exports.ActionBase = base_1.ActionBase; +const config_1 = __webpack_require__(25155); +exports.config = config_1.config; +exports.Config = config_1.Config; +const deps_1 = tslib_1.__importDefault(__webpack_require__(74560)); +const exit_1 = __webpack_require__(29089); +exports.ExitError = exit_1.ExitError; +const Table = tslib_1.__importStar(__webpack_require__(5402)); +exports.Table = Table; +exports.ux = { + config: config_1.config, + warn: Errors.warn, + error: Errors.error, + exit: Errors.exit, + get prompt() { + return deps_1.default.prompt.prompt; + }, + /** + * "press anykey to continue" + */ + get anykey() { + return deps_1.default.prompt.anykey; + }, + get confirm() { + return deps_1.default.prompt.confirm; + }, + get action() { + return config_1.config.action; + }, + get prideAction() { + return config_1.config.prideAction; + }, + styledObject(obj, keys) { + exports.ux.info(deps_1.default.styledObject(obj, keys)); + }, + get styledHeader() { + return deps_1.default.styledHeader; + }, + get styledJSON() { + return deps_1.default.styledJSON; + }, + get table() { + return deps_1.default.table; + }, + get tree() { + return deps_1.default.tree; + }, + get open() { + return deps_1.default.open; + }, + get wait() { + return deps_1.default.wait; + }, + get progress() { + return deps_1.default.progress; + }, + async done() { + config_1.config.action.stop(); + // await flushStdout() + }, + trace(format, ...args) { + if (this.config.outputLevel === 'trace') { + process.stdout.write(util.format(format, ...args) + '\n'); } - if (info.length) { - super(info.join('\n')); + }, + debug(format, ...args) { + if (['trace', 'debug'].includes(this.config.outputLevel)) { + process.stdout.write(util.format(format, ...args) + '\n'); + } + }, + info(format, ...args) { + process.stdout.write(util.format(format, ...args) + '\n'); + }, + log(format, ...args) { + this.info(format || '', ...args); + }, + url(text, uri, params = {}) { + const supports = __webpack_require__(18824); + if (supports.stdout) { + const hyperlinker = __webpack_require__(59584); + this.log(hyperlinker(text, uri, params)); } else { - super(`Unhandled API error (status: ${status})`); + this.log(uri); } - this.exitCode = exit; - this.http = httpError; - } - static is(error) { - return error instanceof errors_1.CLIError && 'http' in error; - } - static notFound(error) { - const genericMessage = error.message || "It seems the documentation provided doesn't exist."; - return [ - [ - genericMessage, - `Please check the given ${chalk_1.default.underline('--documentation')}, ${chalk_1.default.underline('--token')} or ${chalk_1.default.underline('--hub')} flags`, - ], - 104, - ]; - } - static invalidDefinition(error) { - let info = []; - const genericMessage = error.message || 'Invalid definition file'; - const exit = 122; - if (error && 'errors' in error) { - for (const [attr, message] of Object.entries(error.errors)) { - info = info.concat(APIError.humanAttributeError(attr, message)); - } + }, + annotation(text, annotation) { + const supports = __webpack_require__(18824); + if (supports.stdout) { + // \u001b]8;;https://google.com\u0007sometext\u001b]8;;\u0007 + this.log(`\u001B]1337;AddAnnotation=${text.length}|${annotation}\u0007${text}`); } else { - info.push(genericMessage); - } - return [info, exit]; - } - static humanAttributeError(attribute, messages) { - let info = []; - if (messages instanceof Array) { - const allMessages = messages - .map((message, idx) => { - if (message instanceof Object) { - return this.humanAttributeError(idx.toString(), message); - } - else { - return message; - } - }) - .join(', '); - info.push(`${chalk_1.default.underline(attribute)} ${allMessages}`); + this.log(text); } - else if (messages instanceof Object) { - for (const [child, child_messages] of Object.entries(messages)) { - info = info.concat(this.humanAttributeError(`${attribute}.${child}`, child_messages)); + }, + async flush() { + function timeout(p, ms) { + function wait(ms, unref = false) { + return new Promise(resolve => { + const t = setTimeout(() => resolve(), ms); + if (unref) + t.unref(); + }); } + return Promise.race([p, wait(ms, true).then(() => exports.ux.error('timed out'))]); } - else if (messages) { - info.push(`${chalk_1.default.underline(attribute)} ${messages}`); + async function flush() { + const p = new Promise(resolve => process.stdout.once('drain', () => resolve())); + process.stdout.write(''); + return p; } - return info; + await timeout(flush(), 10000); + }, +}; +exports.default = exports.ux; +exports.cli = exports.ux; +const cliuxProcessExitHandler = async () => { + try { + await exports.ux.done(); } - static unauthenticated() { - return [ - [ - 'You are not allowed to deploy to this documentation.', - 'please check your --token flag or BUMP_TOKEN variable', - ], - 101, - ]; + catch (error) { + // tslint:disable no-console + console.error(error); + process.exitCode = 1; } +}; +// to avoid MaxListenersExceededWarning +// only attach named listener once +const cliuxListener = process.listeners('exit').find(fn => fn.name === cliuxProcessExitHandler.name); +if (!cliuxListener) { + process.once('exit', cliuxProcessExitHandler); } -exports.default = APIError; /***/ }), -/***/ 32035: +/***/ 46099: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.APIError = exports.BumpApi = void 0; -const tslib_1 = __webpack_require__(64707); -const axios_1 = tslib_1.__importDefault(__webpack_require__(96545)); -const vars_1 = __webpack_require__(52784); -const error_1 = tslib_1.__importDefault(__webpack_require__(68959)); -exports.APIError = error_1.default; -class BumpApi { - // Check https://oclif.io/docs/config for details about Config.IConfig - constructor(config) { - this.config = config; - this.getPing = () => { - return this.client.get('/ping'); - }; - this.postPreview = (body) => { - return this.client.post('/previews', body); - }; - this.postVersion = (body, token) => { - return this.client.post('/versions', body, { - headers: this.authorizationHeader(token), - }); - }; - this.postValidation = (body, token) => { - return this.client.post('/validations', body, { - headers: this.authorizationHeader(token), - }); - }; - this.initializeResponseInterceptor = () => { - this.client.interceptors.response.use((data) => data, this.handleError); - }; - this.handleError = (error) => Promise.reject(new error_1.default(error)); - this.authorizationHeader = (token) => { - return { Authorization: `Basic ${Buffer.from(token).toString('base64')}` }; - }; - const baseURL = `${vars_1.vars.apiUrl}${vars_1.vars.apiBasePath}`; - const headers = { - 'User-Agent': vars_1.vars.apiUserAgent(config.userAgent), - }; - this.client = axios_1.default.create({ - baseURL, - headers, - }); - this.initializeResponseInterceptor(); - } -} -exports.BumpApi = BumpApi; -tslib_1.__exportStar(__webpack_require__(44437), exports); - - -/***/ }), - -/***/ 44437: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); - - -/***/ }), - -/***/ 52784: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.vars = exports.Vars = void 0; -class Vars { - get host() { - return this.envHost || 'bump.sh'; +__webpack_unused_export__ = ({ value: true }); +const tslib_1 = __webpack_require__(22116); +// this code is largely taken from opn +const childProcess = tslib_1.__importStar(__webpack_require__(63129)); +const isWsl = __webpack_require__(52559); +function open(target, opts = {}) { + // opts = {wait: true, ...opts} + let cmd; + let appArgs = []; + let args = []; + const cpOpts = {}; + if (Array.isArray(opts.app)) { + appArgs = opts.app.slice(1); + opts.app = opts.app[0]; } - get envHost() { - return process.env.BUMP_HOST; + if (process.platform === 'darwin') { + cmd = 'open'; + // if (opts.wait) { + // args.push('-W') + // } + if (opts.app) { + args.push('-a', opts.app); + } } - apiUserAgent(base) { - const content = [base, process.env.BUMP_USER_AGENT].filter(Boolean); - return content.join(' '); + else if (process.platform === 'win32' || isWsl) { + cmd = 'cmd' + (isWsl ? '.exe' : ''); + args.push('/c', 'start', '""', '/b'); + target = target.replace(/&/g, '^&'); + // if (opts.wait) { + // args.push('/wait') + // } + if (opts.app) { + args.push(opts.app); + } + if (appArgs.length > 0) { + args = args.concat(appArgs); + } } - get apiUrl() { - return this.host.startsWith('http') ? this.host : `https://${this.host}`; + else { + if (opts.app) { + cmd = opts.app; + } + else { + // try local xdg-open + cmd = 'xdg-open'; + } + if (appArgs.length > 0) { + args = args.concat(appArgs); + } + // if (!opts.wait) { + // `xdg-open` will block the process unless + // stdio is ignored and it's detached from the parent + // even if it's unref'd + cpOpts.stdio = 'ignore'; + cpOpts.detached = true; + // } } - get apiBasePath() { - return '/api/v1'; + args.push(target); + if (process.platform === 'darwin' && appArgs.length > 0) { + args.push('--args'); + args = args.concat(appArgs); } + const cp = childProcess.spawn(cmd, args, cpOpts); + return new Promise((resolve, reject) => { + cp.once('error', reject); + cp.once('close', code => { + if (code > 0) { + reject(new Error('Exited with code ' + code)); + return; + } + resolve(cp); + }); + }); } -exports.Vars = Vars; -exports.vars = new Vars(); +exports.Z = open; /***/ }), -/***/ 12364: -/***/ ((__unused_webpack_module, exports) => { +/***/ 46858: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.fileArg = void 0; -const fileArg = { - name: 'FILE', - required: true, - description: 'Path or URL to your API documentation file. OpenAPI (2.0 to 3.1.0) and AsyncAPI (2.0) specifications are currently supported.', -}; -exports.fileArg = fileArg; +const tslib_1 = __webpack_require__(22116); +const errors_1 = __webpack_require__(52564); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +const config_1 = tslib_1.__importDefault(__webpack_require__(25155)); +const deps_1 = tslib_1.__importDefault(__webpack_require__(74560)); +function normal(options, retries = 100) { + if (retries < 0) + throw new Error('no input'); + return new Promise((resolve, reject) => { + let timer; + if (options.timeout) { + timer = setTimeout(() => { + process.stdin.pause(); + reject(new Error('Prompt timeout')); + }, options.timeout); + timer.unref(); + } + process.stdin.setEncoding('utf8'); + process.stderr.write(options.prompt); + process.stdin.resume(); + process.stdin.once('data', data => { + if (timer) + clearTimeout(timer); + process.stdin.pause(); + data = data.trim(); + if (!options.default && options.required && data === '') { + resolve(normal(options, retries - 1)); + } + else { + resolve(data || options.default); + } + }); + }); +} +function getPrompt(name, type, defaultValue) { + let prompt = '> '; + if (defaultValue && type === 'hide') { + defaultValue = '*'.repeat(defaultValue.length); + } + if (name && defaultValue) + prompt = name + ' ' + chalk_1.default.yellow('[' + defaultValue + ']') + ': '; + else if (name) + prompt = `${name}: `; + return prompt; +} +async function single(options) { + var _a; + const raw = process.stdin.isRaw; + if (process.stdin.setRawMode) + process.stdin.setRawMode(true); + options.required = (_a = options.required) !== null && _a !== void 0 ? _a : false; + const response = await normal(options); + if (process.stdin.setRawMode) + process.stdin.setRawMode(Boolean(raw)); + return response; +} +function replacePrompt(prompt) { + process.stderr.write(deps_1.default.ansiEscapes.cursorHide + deps_1.default.ansiEscapes.cursorUp(1) + deps_1.default.ansiEscapes.cursorLeft + prompt + + deps_1.default.ansiEscapes.cursorDown(1) + deps_1.default.ansiEscapes.cursorLeft + deps_1.default.ansiEscapes.cursorShow); +} +function _prompt(name, inputOptions = {}) { + const prompt = getPrompt(name, inputOptions.type, inputOptions.default); + const options = Object.assign({ isTTY: Boolean(process.env.TERM !== 'dumb' && process.stdin.isTTY), name, + prompt, type: 'normal', required: true, default: '' }, inputOptions); + switch (options.type) { + case 'normal': + return normal(options); + case 'single': + return single(options); + case 'mask': + return deps_1.default.passwordPrompt(options.prompt, { + method: options.type, + required: options.required, + default: options.default, + }).then((value) => { + replacePrompt(getPrompt(name, 'hide', inputOptions.default)); + return value; + }); + case 'hide': + return deps_1.default.passwordPrompt(options.prompt, { + method: options.type, + required: options.required, + default: options.default, + }); + default: + throw new Error(`unexpected type ${options.type}`); + } +} +/** + * prompt for input + */ +function prompt(name, options = {}) { + return config_1.default.action.pauseAsync(() => { + return _prompt(name, options); + }, chalk_1.default.cyan('?')); +} +exports.prompt = prompt; +/** + * confirmation prompt (yes/no) + */ +function confirm(message) { + return config_1.default.action.pauseAsync(async () => { + const confirm = async () => { + const response = (await _prompt(message)).toLowerCase(); + if (['n', 'no'].includes(response)) + return false; + if (['y', 'yes'].includes(response)) + return true; + return confirm(); + }; + return confirm(); + }, chalk_1.default.cyan('?')); +} +exports.confirm = confirm; +/** + * "press anykey to continue" + */ +async function anykey(message) { + const tty = Boolean(process.stdin.setRawMode); + if (!message) { + message = tty ? + `Press any key to continue or ${chalk_1.default.yellow('q')} to exit` : + `Press enter to continue or ${chalk_1.default.yellow('q')} to exit`; + } + const char = await prompt(message, { type: 'single', required: false }); + if (tty) + process.stderr.write('\n'); + if (char === 'q') + errors_1.error('quit'); + if (char === '\u0003') + errors_1.error('ctrl-c'); + return char; +} +exports.anykey = anykey; /***/ }), -/***/ 70740: +/***/ 63272: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.cli = void 0; -const tslib_1 = __webpack_require__(64707); -const cli_ux_1 = tslib_1.__importDefault(__webpack_require__(81982)); -const success_1 = tslib_1.__importDefault(__webpack_require__(98087)); -if (process.env.BUMP_LOG_LEVEL) { - const logLevel = process.env.BUMP_LOG_LEVEL; - cli_ux_1.default.config['outputLevel'] = logLevel; +// tslint:disable restrict-plus-operands +__webpack_unused_export__ = ({ value: true }); +const tslib_1 = __webpack_require__(22116); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +function styledHeader(header) { + process.stdout.write(chalk_1.default.dim('=== ') + chalk_1.default.bold(header) + '\n'); } -const cli = Object.assign(Object.assign({}, cli_ux_1.default), { get styledSuccess() { - return success_1.default; - } }); -exports.cli = cli; +exports.Z = styledHeader; /***/ }), -/***/ 98087: +/***/ 7842: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(64707); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(38707)); -function styledSuccess(message) { - const lines = message.split('\n'); - for (let i = 0; i < lines.length; i++) { - process.stdout.write(chalk_1.default.green(`* ${lines[i]}\n`)); +// tslint:disable restrict-plus-operands +__webpack_unused_export__ = ({ value: true }); +const tslib_1 = __webpack_require__(22116); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +const __1 = tslib_1.__importDefault(__webpack_require__(81982)); +function styledJSON(obj) { + const json = JSON.stringify(obj, null, 2); + if (!chalk_1.default.level) { + __1.default.info(json); + return; } + const cardinal = __webpack_require__(76021); + const theme = __webpack_require__(14054); + __1.default.info(cardinal.highlight(json, { json: true, theme })); } -exports.default = styledSuccess; +exports.Z = styledJSON; /***/ }), -/***/ 268: +/***/ 20028: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(64707); -const command_1 = __webpack_require__(82708); -const debug_1 = tslib_1.__importDefault(__webpack_require__(38237)); -const definition_1 = __webpack_require__(53524); -const api_1 = __webpack_require__(32035); -const package_json_1 = tslib_1.__importDefault(__webpack_require__(68051)); -class Command extends command_1.Command { - constructor() { - super(...arguments); - this.base = `${package_json_1.default.name}@${package_json_1.default.version}`; - } - get bump() { - if (!this._bump) - this._bump = new api_1.BumpApi(this.config); - return this._bump; - } - async catch(error) { - if (error && api_1.APIError.is(error)) { - this.error(error.message, { exit: error.exitCode }); +// tslint:disable +__webpack_unused_export__ = ({ value: true }); +const tslib_1 = __webpack_require__(22116); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +const util = tslib_1.__importStar(__webpack_require__(31669)); +function styledObject(obj, keys) { + const output = []; + const keyLengths = Object.keys(obj).map(key => key.toString().length); + const maxKeyLength = Math.max(...keyLengths) + 2; + function pp(obj) { + if (typeof obj === 'string' || typeof obj === 'number') + return obj; + if (typeof obj === 'object') { + return Object.keys(obj) + .map(k => k + ': ' + util.inspect(obj[k])) + .join(', '); } - throw error; - } - d(message) { - return debug_1.default(`bump-cli:command:${this.constructor.name.toLowerCase()}`)(message); + return util.inspect(obj); } - async prepareDefinition(filepath) { - const api = await definition_1.API.loadAPI(filepath); - const references = []; - this.d(`${filepath} looks like an ${api.specName} spec version ${api.version}`); - for (let i = 0; i < api.references.length; i++) { - const reference = api.references[i]; - references.push({ - location: reference.location, - content: reference.content, - }); + const logKeyValue = (key, value) => { + return `${chalk_1.default.blue(key)}:` + ' '.repeat(maxKeyLength - key.length - 1) + pp(value); + }; + for (const key of keys || Object.keys(obj).sort()) { + const value = obj[key]; + if (Array.isArray(value)) { + if (value.length > 0) { + output.push(logKeyValue(key, value[0])); + for (const e of value.slice(1)) { + output.push(' '.repeat(maxKeyLength) + pp(e)); + } + } + } + else if (value !== null && value !== undefined) { + output.push(logKeyValue(key, value)); } - return [api.rawDefinition, references]; } + return output.join('\n'); } -exports.default = Command; +exports.Z = styledObject; /***/ }), -/***/ 77402: +/***/ 57867: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(64707); -const command_1 = tslib_1.__importDefault(__webpack_require__(268)); -const flags = tslib_1.__importStar(__webpack_require__(63594)); -const args_1 = __webpack_require__(12364); -const cli_1 = __webpack_require__(70740); -class Deploy extends command_1.default { - /* - Oclif doesn't type parsed args & flags correctly and especially - required-ness which is not known by the compiler, thus the use of - the non-null assertion '!' in this command. - See https://github.com/oclif/oclif/issues/301 for details - */ - async run() { - const { args, flags } = this.parse(Deploy); - const [definition, references] = await this.prepareDefinition(args.FILE); - const action = flags['dry-run'] ? 'validate' : 'deploy'; - /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */ - const [documentation, token] = [flags.doc, flags.token]; - cli_1.cli.action.start(`* Let's ${action} a new documentation version on Bump`); - const request = { - documentation, - hub: flags.hub, - documentation_name: flags['doc-name'], - auto_create_documentation: flags['auto-create'] && !flags['dry-run'], - definition, - references, - }; - const response = flags['dry-run'] - ? await this.bump.postValidation(request, token) - : await this.bump.postVersion(request, token); - cli_1.cli.action.stop(); - switch (response.status) { - case 200: - cli_1.cli.styledSuccess('Definition is valid'); - break; - case 201: - const version = response.data - ? response.data - : { doc_public_url: 'https://bump.sh' }; - cli_1.cli.styledSuccess(`Your new documentation version will soon be ready at ${version.doc_public_url}`); - break; - case 204: - this.warn('Your documentation has not changed!'); - break; - } - return; +__webpack_unused_export__ = ({ value: true }); +// 3pp +const cliProgress = __webpack_require__(17348); +function progress(options) { + // if no options passed, create empty options + if (!options) { + options = {}; } + // set noTTYOutput for options + options.noTTYOutput = Boolean(process.env.TERM === 'dumb' || !process.stdin.isTTY); + return new cliProgress.SingleBar(options); } -exports.default = Deploy; -Deploy.description = 'create a new version of your documentation from the given file or URL'; -Deploy.examples = [ - `Deploy a new version of an existing documentation - -$ bump deploy FILE --doc --token -* Let's deploy a new documentation version on Bump... done -* Your new documentation version will soon be ready -`, - `Deploy a new version of an existing documentation attached to a hub - -$ bump deploy FILE --doc --hub --token -* Let's deploy a new documentation version on Bump... done -* Your new documentation version will soon be ready -`, - `Validate a new documentation version before deploying it - -$ bump deploy FILE --dry-run --doc --token -* Let's validate a new documentation version on Bump... done -* Definition is valid -`, -]; -Deploy.flags = { - help: flags.help({ char: 'h' }), - doc: flags.doc(), - 'doc-name': flags.docName(), - hub: flags.hub(), - token: flags.token(), - 'auto-create': flags.autoCreate(), - 'dry-run': flags.dryRun(), -}; -Deploy.args = [args_1.fileArg]; +exports.Z = progress; /***/ }), -/***/ 5363: +/***/ 5402: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(64707); -const command_1 = tslib_1.__importDefault(__webpack_require__(268)); -const flags = tslib_1.__importStar(__webpack_require__(63594)); -const args_1 = __webpack_require__(12364); -const cli_1 = __webpack_require__(70740); -class Preview extends command_1.default { - async run() { - const { args } = this.parse(Preview); - const [definition, references] = await this.prepareDefinition(args.FILE); - cli_1.cli.action.start("* Let's render a preview on Bump"); - const request = { - definition, - references, - }; - const response = await this.bump.postPreview(request); - cli_1.cli.action.stop(); - cli_1.cli.styledSuccess(`Your preview is visible at: ${response.data.public_url} (Expires at ${response.data.expires_at})`); - return; - } -} -exports.default = Preview; -Preview.description = 'create a documentation preview from the given file or URL'; -Preview.examples = [ - `$ bump preview FILE -* Your preview is visible at: https://bump.sh/preview/45807371-9a32-48a7-b6e4-1cb7088b5b9b -`, -]; -Preview.flags = { - help: flags.help({ char: 'h' }), -}; -Preview.args = [args_1.fileArg]; - - -/***/ }), - -/***/ 53524: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.API = void 0; -const tslib_1 = __webpack_require__(64707); -const errors_1 = __webpack_require__(52564); -const json_schema_ref_parser_1 = tslib_1.__importDefault(__webpack_require__(85862)); -const options_1 = __webpack_require__(36608); -const specs_1 = tslib_1.__importDefault(__webpack_require__(78100)); -const path_1 = tslib_1.__importDefault(__webpack_require__(85622)); -class SupportedFormat { -} -SupportedFormat.openapi = { - '2.0.x': __webpack_require__(65359), - '3.0.x': __webpack_require__(3486), - '3.1.x': __webpack_require__(393), -}; -SupportedFormat.asyncapi = { - '2.0.0': specs_1.default['2.0.0'], -}; -class UnsupportedFormat extends errors_1.CLIError { - constructor(message = '') { - const compatOpenAPI = Object.keys(SupportedFormat.openapi).join(', '); - const compatAsyncAPI = Object.keys(SupportedFormat.asyncapi).join(', '); - const errorMsgs = [ - `Unsupported API specification (${message})`, - `Please try again with an OpenAPI ${compatOpenAPI} or AsyncAPI ${compatAsyncAPI} format.`, - ]; - super(errorMsgs.join('\n')); +const tslib_1 = __webpack_require__(22116); +const command_1 = __webpack_require__(82708); +const screen_1 = __webpack_require__(6493); +const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); +const capitalize_1 = tslib_1.__importDefault(__webpack_require__(33622)); +const sumBy_1 = tslib_1.__importDefault(__webpack_require__(93702)); +const js_yaml_1 = __webpack_require__(21917); +const util_1 = __webpack_require__(31669); +const sw = __webpack_require__(42577); +const { orderBy } = __webpack_require__(56445); +class Table { + constructor(data, columns, options = {}) { + this.data = data; + // assign columns + this.columns = Object.keys(columns).map((key) => { + const col = columns[key]; + const extended = col.extended || false; + const get = col.get || ((row) => row[key]); + const header = typeof col.header === 'string' ? col.header : capitalize_1.default(key.replace(/_/g, ' ')); + const minWidth = Math.max(col.minWidth || 0, sw(header) + 1); + return { + extended, + get, + header, + key, + minWidth, + }; + }); + // assign options + const { columns: cols, filter, csv, output, extended, sort, printLine } = options; + this.options = { + columns: cols, + output: csv ? 'csv' : output, + extended, + filter, + 'no-header': options['no-header'] || false, + 'no-truncate': options['no-truncate'] || false, + printLine: printLine || ((s) => process.stdout.write(s + '\n')), + sort, + }; } -} -class API { - constructor(location, $refs) { - this.location = location; - this.references = []; - const [raw, parsed] = this.resolveContent($refs); - this.rawDefinition = raw; - this.definition = parsed; - this.specName = this.getSpecName(parsed); - this.version = this.getVersion(parsed); - this.spec = this.getSpec(parsed); - if (this.spec === undefined) { - throw new UnsupportedFormat(`${this.specName} ${this.version}`); + display() { + // build table rows from input array data + let rows = this.data.map(d => { + const row = {}; + for (const col of this.columns) { + let val = col.get(d); + if (typeof val !== 'string') + val = util_1.inspect(val, { breakLength: Infinity }); + row[col.key] = val; + } + return row; + }); + // filter rows + if (this.options.filter) { + /* eslint-disable-next-line prefer-const */ + let [header, regex] = this.options.filter.split('='); + const isNot = header[0] === '-'; + if (isNot) + header = header.substr(1); + const col = this.findColumnFromHeader(header); + if (!col || !regex) + throw new Error('Filter flag has an invalid value'); + rows = rows.filter((d) => { + const re = new RegExp(regex); + const val = d[col.key]; + const match = val.match(re); + return isNot ? !match : match; + }); } - } - getSpec(definition) { - if (API.isAsyncAPI(definition)) { - return SupportedFormat.asyncapi[this.version]; + // sort rows + if (this.options.sort) { + const sorters = this.options.sort.split(','); + const sortHeaders = sorters.map(k => k[0] === '-' ? k.substr(1) : k); + const sortKeys = this.filterColumnsFromHeaders(sortHeaders).map(c => { + return ((v) => v[c.key]); + }); + const sortKeysOrder = sorters.map(k => k[0] === '-' ? 'desc' : 'asc'); + rows = orderBy(rows, sortKeys, sortKeysOrder); } - else { - return SupportedFormat.openapi[this.versionWithoutPatch()]; + // and filter columns + if (this.options.columns) { + const filters = this.options.columns.split(','); + this.columns = this.filterColumnsFromHeaders(filters); } - } - getSpecName(definition) { - if (API.isAsyncAPI(definition)) { - return 'AsyncAPI'; + else if (!this.options.extended) { + // show extented columns/properties + this.columns = this.columns.filter(c => !c.extended); } - else { - return 'OpenAPI'; + this.data = rows; + switch (this.options.output) { + case 'csv': + this.outputCSV(); + break; + case 'json': + this.outputJSON(); + break; + case 'yaml': + this.outputYAML(); + break; + default: + this.outputTable(); } } - getVersion(definition) { - if (API.isAsyncAPI(definition)) { - return definition.asyncapi; - } - else { - return (definition.openapi || definition.swagger); - } + findColumnFromHeader(header) { + return this.columns.find(c => c.header.toLowerCase() === header.toLowerCase()); } - versionWithoutPatch() { - const [major, minor] = this.version.split('.', 3); - return `${major}.${minor}.x`; + filterColumnsFromHeaders(filters) { + // unique + filters = [...(new Set(filters))]; + const cols = []; + filters.forEach(f => { + const c = this.columns.find(c => c.header.toLowerCase() === f.toLowerCase()); + if (c) + cols.push(c); + }); + return cols; } - /* Resolve reference absolute paths to the main api location when possible */ - resolveRelativeLocation(absPath) { - const url = (location) => { - try { - return new URL(location); - } - catch (_a) { - return { hostname: '' }; - } + getCSVRow(d) { + const values = this.columns.map(col => d[col.key] || ''); + const needToBeEscapedForCsv = (e) => { + // CSV entries containing line breaks, comma or double quotes + // as specified in https://tools.ietf.org/html/rfc4180#section-2 + return e.includes('"') || e.includes('\n') || e.includes('\r\n') || e.includes('\r') || e.includes(','); }; - const definitionUrl = url(this.location); - const refUrl = url(absPath); - if (absPath.match(/^\//) || - (absPath.match(/^https?:\/\//) && definitionUrl.hostname === refUrl.hostname)) { - return path_1.default.relative(path_1.default.dirname(this.location), absPath); - } - else { - return absPath; + const lineToBeEscaped = values.find(needToBeEscapedForCsv); + return values.map(e => lineToBeEscaped ? `"${e.replace('"', '""')}"` : e); + } + resolveColumnsToObjectArray() { + // tslint:disable-next-line:no-this-assignment + const { data, columns } = this; + return data.map((d) => { + return columns.reduce((obj, col) => { + return Object.assign(Object.assign({}, obj), { [col.key]: d[col.key] || '' }); + }, {}); + }); + } + outputJSON() { + this.options.printLine(JSON.stringify(this.resolveColumnsToObjectArray(), undefined, 2)); + } + outputYAML() { + this.options.printLine(js_yaml_1.safeDump(this.resolveColumnsToObjectArray())); + } + outputCSV() { + // tslint:disable-next-line:no-this-assignment + const { data, columns, options } = this; + if (!options['no-header']) { + options.printLine(columns.map(c => c.header).join(',')); } + data.forEach((d) => { + const row = this.getCSVRow(d); + options.printLine(row.join(',')); + }); } - resolveContent($refs) { - const paths = $refs.paths(); - let mainReference; - let absPath = paths.shift(); - while (typeof absPath !== 'undefined') { - if (absPath === this.location || absPath === path_1.default.resolve(this.location)) { - mainReference = absPath; + outputTable() { + // tslint:disable-next-line:no-this-assignment + const { data, columns, options } = this; + // column truncation + // + // find max width for each column + for (const col of columns) { + // convert multi-line cell to single longest line + // for width calculations + const widthData = data.map((row) => { + const d = row[col.key]; + const manyLines = d.split('\n'); + if (manyLines.length > 1) { + return '*'.repeat(Math.max(...manyLines.map((r) => sw(r)))); + } + return d; + }); + const widths = ['.'.padEnd(col.minWidth - 1), col.header, ...widthData.map((row) => row)].map(r => sw(r)); + col.maxWidth = Math.max(...widths) + 1; + col.width = col.maxWidth; + } + // terminal width + const maxWidth = screen_1.stdtermwidth; + // truncation logic + const shouldShorten = () => { + // don't shorten if full mode + if (options['no-truncate'] || (!process.stdout.isTTY && !process.env.CLI_UX_SKIP_TTY_CHECK)) + return; + // don't shorten if there is enough screen width + const dataMaxWidth = sumBy_1.default(columns, c => c.width); + const overWidth = dataMaxWidth - maxWidth; + if (overWidth <= 0) + return; + // not enough room, short all columns to minWidth + for (const col of columns) { + col.width = col.minWidth; } - else { - // $refs.get is not properly typed so we need to force it - // with the resulting type of our custom defined parser - const { raw } = $refs.get(absPath); - if (!raw) { - throw new UnsupportedFormat('Reference ${absPath} is empty'); + // if sum(minWidth's) is greater than term width + // nothing can be done so + // display all as minWidth + const dataMinWidth = sumBy_1.default(columns, c => c.minWidth); + if (dataMinWidth >= maxWidth) + return; + // some wiggle room left, add it back to "needy" columns + let wiggleRoom = maxWidth - dataMinWidth; + const needyCols = columns.map(c => ({ key: c.key, needs: c.maxWidth - c.width })).sort((a, b) => a.needs - b.needs); + for (const { key, needs } of needyCols) { + if (!needs) + continue; + const col = columns.find(c => key === c.key); + if (!col) + continue; + if (wiggleRoom > needs) { + col.width = col.width + needs; + wiggleRoom -= needs; + } + else if (wiggleRoom) { + col.width = col.width + wiggleRoom; + wiggleRoom = 0; } - this.references.push({ - location: this.resolveRelativeLocation(absPath), - content: raw, - }); } - absPath = paths.shift(); - } - if (typeof mainReference === 'undefined') { - throw new UnsupportedFormat("JSON Schema $ref parser couldn't parse the main definition"); + }; + shouldShorten(); + // print headers + if (!options['no-header']) { + let headers = ''; + for (const col of columns) { + const header = col.header; + headers += header.padEnd(col.width); + } + options.printLine(chalk_1.default.bold(headers)); } - // $refs.get is not properly typed so we need to force it - // with the resulting type of our custom defined parser - const { raw, parsed } = $refs.get(mainReference); - if (!parsed || !(parsed instanceof Object) || !('info' in parsed)) { - throw new UnsupportedFormat("Definition needs to be an object with at least an 'info' key"); + // print rows + for (const row of data) { + // find max number of lines + // for all cells in a row + // with multi-line strings + let numOfLines = 1; + for (const col of columns) { + const d = row[col.key]; + const lines = d.split('\n').length; + if (lines > numOfLines) + numOfLines = lines; + } + const linesIndexess = [...new Array(numOfLines).keys()]; + // print row + // including multi-lines + linesIndexess.forEach((i) => { + let l = ''; + for (const col of columns) { + const width = col.width; + let d = row[col.key]; + d = d.split('\n')[i] || ''; + const visualWidth = sw(d); + const colorWidth = (d.length - visualWidth); + let cell = d.padEnd(width + colorWidth); + if ((cell.length - colorWidth) > width || visualWidth === width) { + cell = cell.slice(0, width - 2) + '… '; + } + l += cell; + } + options.printLine(l); + }); } - if (!API.isOpenAPI(parsed) && !API.isAsyncAPI(parsed)) { - throw new UnsupportedFormat(); + } +} +function table(data, columns, options = {}) { + new Table(data, columns, options).display(); +} +exports.table = table; +(function (table) { + table.Flags = { + columns: command_1.flags.string({ exclusive: ['extended'], description: 'only show provided columns (comma-separated)' }), + sort: command_1.flags.string({ description: 'property to sort by (prepend \'-\' for descending)' }), + filter: command_1.flags.string({ description: 'filter property by partial string matching, ex: name=foo' }), + csv: command_1.flags.boolean({ exclusive: ['no-truncate'], description: 'output is csv format [alias: --output=csv]' }), + output: command_1.flags.string({ + exclusive: ['no-truncate', 'csv'], + description: 'output in a more machine friendly format', + options: ['csv', 'json', 'yaml'], + }), + extended: command_1.flags.boolean({ exclusive: ['columns'], char: 'x', description: 'show extra columns' }), + 'no-truncate': command_1.flags.boolean({ exclusive: ['csv'], description: 'do not truncate output to fit screen' }), + 'no-header': command_1.flags.boolean({ exclusive: ['csv'], description: 'hide table header from output' }), + }; + // eslint-disable-next-line no-inner-declarations + function flags(opts) { + if (opts) { + const f = {}; + const o = (opts.only && typeof opts.only === 'string' ? [opts.only] : opts.only) || Object.keys(table.Flags); + const e = (opts.except && typeof opts.except === 'string' ? [opts.except] : opts.except) || []; + o.forEach((key) => { + if (e.includes(key)) + return; + f[key] = table.Flags[key]; + }); + return f; } - return [raw, parsed]; + return table.Flags; } - static isOpenAPI(definition) { - return (typeof definition.openapi === 'string' || typeof definition.swagger === 'string'); + table.flags = flags; +})(table = exports.table || (exports.table = {})); + + +/***/ }), + +/***/ 56673: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +var __webpack_unused_export__; + +__webpack_unused_export__ = ({ value: true }); +const treeify = __webpack_require__(87817); +class Tree { + constructor() { + this.nodes = {}; } - static isAsyncAPI(definition) { - return 'asyncapi' in definition; + insert(child, value = new Tree()) { + this.nodes[child] = value; + return this; } - static async loadAPI(path) { - const JSONParser = options_1.defaults.parse.json; - const YAMLParser = options_1.defaults.parse.yaml; - // We override the default parsers from $RefParser to be able - // to keep the raw content of the files parsed - const withRawTextParser = (parser) => { - return Object.assign(Object.assign({}, parser), { parse: async (file) => { - const parsed = (await parser.parse(file)); - return { parsed, raw: options_1.defaults.parse.text.parse(file) }; - } }); + search(key) { + for (const child of Object.keys(this.nodes)) { + if (child === key) { + return this.nodes[child]; + } + const c = this.nodes[child].search(key); + if (c) + return c; + } + } + // tslint:disable-next-line:no-console + display(logger = console.log) { + const addNodes = function (nodes) { + const tree = {}; + for (const p of Object.keys(nodes)) { + tree[p] = addNodes(nodes[p].nodes); + } + return tree; }; - return json_schema_ref_parser_1.default - .resolve(path, { - parse: { - json: withRawTextParser(JSONParser), - yaml: withRawTextParser(YAMLParser), - }, - dereference: { circular: false }, - }) - .then(($refs) => { - return new API(path, $refs); - }) - .catch((err) => { - throw new errors_1.CLIError(err); - }); + const tree = addNodes(this.nodes); + logger(treeify(tree)); } } -exports.API = API; +__webpack_unused_export__ = Tree; +function tree() { + return new Tree(); +} +exports.ZP = tree; /***/ }), -/***/ 63594: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 59477: +/***/ ((__unused_webpack_module, exports) => { "use strict"; +var __webpack_unused_export__; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.dryRun = exports.autoCreate = exports.token = exports.hub = exports.docName = exports.doc = void 0; -const tslib_1 = __webpack_require__(64707); -const command_1 = __webpack_require__(82708); -// Re-export oclif flags https://oclif.io/docs/flags -tslib_1.__exportStar(__webpack_require__(25754), exports); -// Custom flags for bum-cli -const doc = command_1.flags.build({ - char: 'd', - required: true, - description: 'Documentation public id or slug. Can be provided via BUMP_ID environment variable', - default: () => { - const envDoc = process.env.BUMP_ID; - if (envDoc) - return envDoc; - // Search doc id in .bump/config.json file? - }, -}); -exports.doc = doc; -const docName = command_1.flags.build({ - char: 'n', - description: 'Documentation name. Used with --auto-create flag.', - dependsOn: ['auto-create'], -}); -exports.docName = docName; -const hub = command_1.flags.build({ - char: 'b', - description: 'Hub id or slug. Can be provided via BUMP_HUB_ID environment variable', - default: () => { - const envHub = process.env.BUMP_HUB_ID; - if (envHub) - return envHub; - // Search hub id in .bump/config.json file? - }, -}); -exports.hub = hub; -const token = command_1.flags.build({ - char: 't', - required: true, - description: 'Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable', - default: () => { - const envToken = process.env.BUMP_TOKEN; - if (envToken) - return envToken; - }, -}); -exports.token = token; -const autoCreate = (options = {}) => { - return command_1.flags.boolean(Object.assign({ description: 'Automatically create the documentation if needed (only available with a --hub flag). Documentation name can be provided with --doc-name flag. Default: false', dependsOn: ['hub'] }, options)); +__webpack_unused_export__ = ({ value: true }); +// tslint:disable no-string-based-set-timeout +exports.Z = (ms = 1000) => { + return new Promise(resolve => setTimeout(resolve, ms)); }; -exports.autoCreate = autoCreate; -const dryRun = (options = {}) => { - return command_1.flags.boolean(Object.assign({ description: 'Validate a new documentation version. Does everything a normal deploy would do except publishing the new version. Useful in automated environments such as test platforms or continuous integration. Default: false' }, options)); -}; -exports.dryRun = dryRun; - - -/***/ }), - -/***/ 64707: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "__extends": () => /* binding */ __extends, -/* harmony export */ "__assign": () => /* binding */ __assign, -/* harmony export */ "__rest": () => /* binding */ __rest, -/* harmony export */ "__decorate": () => /* binding */ __decorate, -/* harmony export */ "__param": () => /* binding */ __param, -/* harmony export */ "__metadata": () => /* binding */ __metadata, -/* harmony export */ "__awaiter": () => /* binding */ __awaiter, -/* harmony export */ "__generator": () => /* binding */ __generator, -/* harmony export */ "__createBinding": () => /* binding */ __createBinding, -/* harmony export */ "__exportStar": () => /* binding */ __exportStar, -/* harmony export */ "__values": () => /* binding */ __values, -/* harmony export */ "__read": () => /* binding */ __read, -/* harmony export */ "__spread": () => /* binding */ __spread, -/* harmony export */ "__spreadArrays": () => /* binding */ __spreadArrays, -/* harmony export */ "__await": () => /* binding */ __await, -/* harmony export */ "__asyncGenerator": () => /* binding */ __asyncGenerator, -/* harmony export */ "__asyncDelegator": () => /* binding */ __asyncDelegator, -/* harmony export */ "__asyncValues": () => /* binding */ __asyncValues, -/* harmony export */ "__makeTemplateObject": () => /* binding */ __makeTemplateObject, -/* harmony export */ "__importStar": () => /* binding */ __importStar, -/* harmony export */ "__importDefault": () => /* binding */ __importDefault, -/* harmony export */ "__classPrivateFieldGet": () => /* binding */ __classPrivateFieldGet, -/* harmony export */ "__classPrivateFieldSet": () => /* binding */ __classPrivateFieldSet -/* harmony export */ }); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -function __createBinding(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -} - -function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -} /***/ }), -/***/ 59581: -/***/ ((module) => { +/***/ 76869: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); -var next = (global.process && process.nextTick) || global.setImmediate || function (f) { - setTimeout(f, 0) -} - -module.exports = function maybe (cb, promise) { - if (cb) { - promise - .then(function (result) { - next(function () { cb(null, result) }) - }, function (err) { - next(function () { cb(err) }) - }) - return undefined - } - else { - return promise - } -} - +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; -/***/ }), +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; -/***/ 76021: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; -"use strict"; +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); -module.exports = { - highlight: __webpack_require__(4621) - , highlightFile: __webpack_require__(41189) - , highlightFileSync: __webpack_require__(22611) -} + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + return value; + }, + enumerable: true, + configurable: true + }); +}; -/***/ }), +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __webpack_require__(18461); + } -/***/ 4621: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + const offset = isBackground ? 10 : 0; + const styles = {}; -"use strict"; + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + return styles; +}; -var redeyed = __webpack_require__(6818) -var theme = __webpack_require__(9867) -var colors = __webpack_require__(26218) +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], -var colorSurround = colors.brightBlack -var surroundClose = '\u001b[39m' + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], -function trimEmptyLines(lines) { - // remove lines from the end until we find a non-empy one - var line = lines.pop() - while (!line || !line.length) { - line = lines.pop() -} + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; - // put the non-empty line back - if (line) lines.push(line) -} + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; -function addLinenos(highlightedCode, firstline) { - var highlightedLines = highlightedCode.split('\n') + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; - trimEmptyLines(highlightedLines) + group[styleName] = styles[styleName]; - var linesLen = highlightedLines.length - var lines = [] - var totalDigits - var lineno + codes.set(style[0], style[1]); + } - function getDigits(n) { - if (n < 10) return 1 - if (n < 100) return 2 - if (n < 1000) return 3 - if (n < 10000) return 4 - // this works for up to 99,999 lines - any questions? - return 5 - } + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } - function pad(n, totalDigits) { - // not pretty, but simple and should perform quite well - var padDigits = totalDigits - getDigits(n) - switch (padDigits) { - case 0: return '' + n - case 1: return ' ' + n - case 2: return ' ' + n - case 3: return ' ' + n - case 4: return ' ' + n - case 5: return ' ' + n - } - } + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); - totalDigits = getDigits(linesLen + firstline - 1) + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; - for (var i = 0; i < linesLen; i++) { - // Don't close the escape sequence here in order to not break multi line code highlights like block comments - lineno = colorSurround(pad(i + firstline, totalDigits) + ': ').replace(surroundClose, '') - lines.push(lineno + highlightedLines[i]) - } + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); - return lines.join('\n') + return styles; } -module.exports = function highlight(code, opts) { - opts = opts || { } - try { - var result = redeyed(code, opts.theme || theme, { jsx: !!opts.jsx }) - var firstline = opts.firstline && !isNaN(opts.firstline) ? opts.firstline : 1 - - return opts.linenos ? addLinenos(result.code, firstline) : result.code - } catch (e) { - e.message = 'Unable to perform highlight. The code contained syntax errors: ' + e.message - throw e - } -} +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); /***/ }), -/***/ 41189: +/***/ 91152: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +const ansiStyles = __webpack_require__(76869); +const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(91691); +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = __webpack_require__(44088); -var fs = __webpack_require__(35747) -var highlight = __webpack_require__(4621) +const {isArray} = Array; -function isFunction(obj) { - return toString.call(obj) === '[object Function]' -} +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; -module.exports = function highlightFile(fullPath, opts, cb) { - if (isFunction(opts)) { - cb = opts - opts = { } - } - opts = opts || { } +const styles = Object.create(null); - fs.readFile(fullPath, 'utf-8', function(err, code) { - if (err) return cb(err) - try { - cb(null, highlight(code, opts)) - } catch (e) { - cb(e) - } - }) +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } + + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } } +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); -/***/ }), + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); -/***/ 22611: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); -"use strict"; + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; + chalk.template.Instance = ChalkClass; -var fs = __webpack_require__(35747) -var highlight = __webpack_require__(4621) + return chalk.template; +}; -module.exports = function highlightFileSync(fullPath, opts) { - var code = fs.readFileSync(fullPath, 'utf-8') - opts = opts || { } - return highlight(code, opts) +function Chalk(options) { + return chalkFactory(options); } +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + } + }; +} -/***/ }), - -/***/ 9867: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + } +}; -var colors = __webpack_require__(26218) +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; -// Change the below definitions in order to tweak the color theme. -module.exports = { +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} - 'Boolean': { - 'true' : undefined - , 'false' : undefined - , _default : colors.brightRed - } +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} - , 'Identifier': { - 'undefined' : colors.brightBlack - , 'self' : colors.brightRed - , 'console' : colors.blue - , 'log' : colors.blue - , 'warn' : colors.red - , 'error' : colors.brightRed - , _default : colors.white - } +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this._generator.level; + }, + set(level) { + this._generator.level = level; + } + } +}); - , 'Null': { - _default: colors.brightBlack - } +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } - , 'Numeric': { - _default: colors.blue - } + return { + open, + close, + openAll, + closeAll, + parent + }; +}; - , 'String': { - _default: function(s, info) { - var nextToken = info.tokens[info.tokenIndex + 1] +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { + // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` + return applyStyle(builder, chalkTag(builder, ...arguments_)); + } - // show keys of object literals and json in different color - return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':') - ? colors.green(s) - : colors.brightGreen(s) - } - } + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; - , 'Keyword': { - 'break' : undefined + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); - , 'case' : undefined - , 'catch' : colors.cyan - , 'class' : undefined - , 'const' : undefined - , 'continue' : undefined + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; - , 'debugger' : undefined - , 'default' : undefined - , 'delete' : colors.red - , 'do' : undefined + return builder; +}; - , 'else' : undefined - , 'enum' : undefined - , 'export' : undefined - , 'extends' : undefined +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; + } - , 'finally' : colors.cyan - , 'for' : undefined - , 'function' : undefined + let styler = self._styler; - , 'if' : undefined - , 'implements' : undefined - , 'import' : undefined - , 'in' : undefined - , 'instanceof' : undefined - , 'let' : undefined - , 'new' : colors.red - , 'package' : undefined - , 'private' : undefined - , 'protected' : undefined - , 'public' : undefined - , 'return' : colors.red - , 'static' : undefined - , 'super' : undefined - , 'switch' : undefined + if (styler === undefined) { + return string; + } - , 'this' : colors.brightRed - , 'throw' : undefined - , 'try' : colors.cyan - , 'typeof' : undefined + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); - , 'var' : colors.green - , 'void' : undefined + styler = styler.parent; + } + } - , 'while' : undefined - , 'with' : undefined - , 'yield' : undefined - , _default : colors.brightBlue - } - , 'Punctuator': { - ';': colors.brightBlack - , '.': colors.green - , ',': colors.green + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } - , '{': colors.yellow - , '}': colors.yellow - , '(': colors.brightBlack - , ')': colors.brightBlack - , '[': colors.yellow - , ']': colors.yellow + return openAll + string + closeAll; +}; - , '<': undefined - , '>': undefined - , '+': undefined - , '-': undefined - , '*': undefined - , '%': undefined - , '&': undefined - , '|': undefined - , '^': undefined - , '!': undefined - , '~': undefined - , '?': undefined - , ':': undefined - , '=': undefined +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; - , '<=': undefined - , '>=': undefined - , '==': undefined - , '!=': undefined - , '++': undefined - , '--': undefined - , '<<': undefined - , '>>': undefined - , '&&': undefined - , '||': undefined - , '+=': undefined - , '-=': undefined - , '*=': undefined - , '%=': undefined - , '&=': undefined - , '|=': undefined - , '^=': undefined - , '/=': undefined - , '=>': undefined - , '**': undefined + if (!isArray(firstString) || !isArray(firstString.raw)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } - , '===': undefined - , '!==': undefined - , '>>>': undefined - , '<<=': undefined - , '>>=': undefined - , '...': undefined - , '**=': undefined + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; - , '>>>=': undefined + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); + } - , _default: colors.brightYellow - } + if (template === undefined) { + template = __webpack_require__(18590); + } - // line comment - , Line: { - _default: colors.brightBlack - } + return template(chalk, parts.join('')); +}; - /* block comment */ - , Block: { - _default: colors.brightBlack - } +Object.defineProperties(Chalk.prototype, styles); - // JSX - , JSXAttribute: { - _default: colors.magenta - } - , JSXClosingElement: { - _default: colors.magenta - } - , JSXElement: { - _default: colors.magenta - } - , JSXEmptyExpression: { - _default: colors.magenta - } - , JSXExpressionContainer: { - _default: colors.magenta - } - , JSXIdentifier: { - className: colors.blue - , _default: colors.magenta - } - , JSXMemberExpression: { - _default: colors.magenta - } - , JSXNamespacedName: { - _default: colors.magenta - } - , JSXOpeningElement: { - _default: colors.magenta - } - , JSXSpreadAttribute: { - _default: colors.magenta - } - , JSXText: { - _default: colors.brightGreen - } +const chalk = Chalk(); // eslint-disable-line new-cap +chalk.supportsColor = stdoutColor; +chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk.stderr.supportsColor = stderrColor; - , _default: undefined -} +module.exports = chalk; /***/ }), -/***/ 14054: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 18590: +/***/ ((module) => { -var colors = __webpack_require__(26218) +"use strict"; -// mimics [jq](https://stedolan.github.io/jq/) highlighting for json files -// mainly in the fact that the keys are a clearly different color than the strings -// However improvements to this theme are highly welcome! :) +const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; -// Change the below definitions in order to tweak the color theme. -module.exports = { +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); - 'Boolean': { - 'true' : undefined - , 'false' : undefined - , _default : colors.brightRed - } +function unescape(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; - , 'Identifier': { - 'undefined' : colors.brightBlack - , 'self' : colors.brightRed - , 'console' : colors.blue - , 'log' : colors.blue - , 'warn' : colors.red - , 'error' : colors.brightRed - , _default : colors.white - } + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } - , 'Null': { - _default: colors.brightBlack - } + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } - , 'Numeric': { - _default: colors.blue - } + return ESCAPES.get(c) || c; +} - , 'String': { - _default: function(s, info) { - var nextToken = info.tokens[info.tokenIndex + 1] +function parseArguments(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; - // show keys of object literals and json in different color - return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':') - ? colors.brightBlue(s) - : colors.brightGreen(s) - } - } + for (const chunk of chunks) { + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } - , 'Keyword': { - 'break' : undefined + return results; +} - , 'case' : undefined - , 'catch' : colors.cyan - , 'class' : undefined - , 'const' : undefined - , 'continue' : undefined +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; - , 'debugger' : undefined - , 'default' : undefined - , 'delete' : colors.red - , 'do' : undefined + const results = []; + let matches; - , 'else' : undefined - , 'enum' : undefined - , 'export' : undefined - , 'extends' : undefined + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; - , 'finally' : colors.cyan - , 'for' : undefined - , 'function' : undefined + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } - , 'if' : undefined - , 'implements' : undefined - , 'import' : undefined - , 'in' : undefined - , 'instanceof' : undefined - , 'let' : undefined - , 'new' : colors.red - , 'package' : undefined - , 'private' : undefined - , 'protected' : undefined - , 'public' : undefined - , 'return' : colors.red - , 'static' : undefined - , 'super' : undefined - , 'switch' : undefined + return results; +} - , 'this' : colors.brightRed - , 'throw' : undefined - , 'try' : colors.cyan - , 'typeof' : undefined +function buildStyle(chalk, styles) { + const enabled = {}; - , 'var' : colors.green - , 'void' : undefined + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } - , 'while' : undefined - , 'with' : undefined - , 'yield' : undefined - , _default : colors.brightBlue - } - , 'Punctuator': { - ';': colors.brightBlack - , '.': colors.green - , ',': colors.green + let current = chalk; + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } - , '{': colors.brightWhite - , '}': colors.brightWhite - , '(': colors.brightBlack - , ')': colors.brightBlack - , '[': colors.brightWhite - , ']': colors.brightWhite + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } - , '<': undefined - , '>': undefined - , '+': undefined - , '-': undefined - , '*': undefined - , '%': undefined - , '&': undefined - , '|': undefined - , '^': undefined - , '!': undefined - , '~': undefined - , '?': undefined - , ':': undefined - , '=': undefined + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } - , '<=': undefined - , '>=': undefined - , '==': undefined - , '!=': undefined - , '++': undefined - , '--': undefined - , '<<': undefined - , '>>': undefined - , '&&': undefined - , '||': undefined - , '+=': undefined - , '-=': undefined - , '*=': undefined - , '%=': undefined - , '&=': undefined - , '|=': undefined - , '^=': undefined - , '/=': undefined - , '=>': undefined - , '**': undefined + return current; +} - , '===': undefined - , '!==': undefined - , '>>>': undefined - , '<<=': undefined - , '>>=': undefined - , '...': undefined - , '**=': undefined +module.exports = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; - , '>>>=': undefined + // eslint-disable-next-line max-params + temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } - , _default: colors.brightYellow - } + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); - // line comment - , Line: { - _default: colors.brightBlack - } + chunks.push(chunk.join('')); - /* block comment */ - , Block: { - _default: colors.brightBlack - } + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } - , _default: undefined -} + return chunks.join(''); +}; /***/ }), -/***/ 38707: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 44088: +/***/ ((module) => { "use strict"; -const escapeStringRegexp = __webpack_require__(98691); -const ansiStyles = __webpack_require__(52068); -const stdoutColor = __webpack_require__(59318).stdout; - -const template = __webpack_require__(52138); - -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); -const styles = Object.create(null); + returnValue += string.substr(endIndex); + return returnValue; +}; -function applyOptions(obj, options) { - options = options || {}; +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); - // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; -} + returnValue += string.substr(endIndex); + return returnValue; +}; -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); +module.exports = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); +/***/ }), - chalk.template.constructor = Chalk; +/***/ 87379: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return chalk.template; - } +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = __webpack_require__(79903); - applyOptions(this, options); -} +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; } -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); +const convert = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; - styles[key] = { - get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); - } - }; -} +module.exports = convert; -styles.visible = { - get() { - return build.call(this, this._styles || [], true, 'visible'); +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); } -}; -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); } - styles[model] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); } - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); } -const proto = Object.defineProperties(() => {}, styles); +convert.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } - builder._styles = _styles; - builder._empty = _empty; + h = Math.min(h * 60, 360); - const self = this; + if (h < 0) { + h += 360; + } - Object.defineProperty(builder, 'level', { - enumerable: true, - get() { - return self.level; - }, - set(level) { - self.level = level; - } - }); + const l = (min + max) / 2; - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; - } - }); + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + return [h, s * 100, l * 100]; +}; - // `__proto__` is used because we must return a function, but there is - // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto +convert.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; - return builder; -} + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); - if (argsLen === 0) { - return ''; - } + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; } } - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; - } + return [ + h * 360, + s * 100, + v * 100 + ]; +}; - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } +convert.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); - for (const code of this._styles.slice().reverse()) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); - } + return [h, w * 100, b * 100]; +}; - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; +convert.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; - return str; -} + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); - } + return [c * 100, m * 100, y * 100, k * 100]; +}; - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); +} - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); +convert.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; } - return template(chalk, parts.join('')); -} + let currentClosestDistance = Infinity; + let currentClosestKeyword; -Object.defineProperties(Chalk.prototype, styles); + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript + // Compute comparative distance + const distance = comparativeDistance(rgb, value); + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } -/***/ }), + return currentClosestKeyword; +}; -/***/ 52138: -/***/ ((module) => { +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; -"use strict"; +convert.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; -const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); - -function unescape(c) { - if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); - } + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - return ESCAPES.get(c) || c; -} + return [x * 100, y * 100, z * 100]; +}; -function parseArguments(name, args) { - const results = []; - const chunks = args.trim().split(/\s*,\s*/g); - let matches; +convert.rgb.lab = function (rgb) { + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; - for (const chunk of chunks) { - if (!isNaN(chunk)) { - results.push(Number(chunk)); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); - } - } + x /= 95.047; + y /= 100; + z /= 108.883; - return results; -} + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); - const results = []; - let matches; + return [l, a, b]; +}; - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; +convert.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); - } + if (s === 0) { + val = l * 255; + return [val, val, val]; } - return results; -} + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } -function buildStyle(chalk, styles) { - const enabled = {}; + const t1 = 2 * l - t2; - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; } - } - let current = chalk; - for (const styleName of Object.keys(enabled)) { - if (Array.isArray(enabled[styleName])) { - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } + if (t3 > 1) { + t3--; + } - if (enabled[styleName].length > 0) { - current = current[styleName].apply(current, enabled[styleName]); - } else { - current = current[styleName]; - } + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; } + + rgb[i] = val * 255; } - return current; -} + return rgb; +}; -module.exports = (chalk, tmp) => { - const styles = []; - const chunks = []; - let chunk = []; +convert.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); - // eslint-disable-next-line max-params - tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { - if (escapeChar) { - chunk.push(unescape(escapeChar)); - } else if (style) { - const str = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(chr); - } - }); + return [h, sv * 100, v * 100]; +}; - chunks.push(chunk.join('')); +convert.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; - if (styles.length > 0) { - const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMsg); - } + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; - return chunks.join(''); + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } }; +convert.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; -/***/ }), + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; -/***/ 27972: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + return [h, sl * 100, l * 100]; +}; -"use strict"; +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; -const os = __webpack_require__(12087); -const escapeStringRegexp = __webpack_require__(51240); + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } -const extractPathRegex = /\s+at.*[(\s](.*)\)?/; -const pathRegex = /^(?:(?:(?:node|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/; -const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir(); + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; -module.exports = (stack, {pretty = false, basePath} = {}) => { - const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath)}`, 'g'); + if ((i & 0x01) !== 0) { + f = 1 - f; + } - return stack.replace(/\\/g, '/') - .split('\n') - .filter(line => { - const pathMatches = line.match(extractPathRegex); - if (pathMatches === null || !pathMatches[1]) { - return true; - } + const n = wh + f * (v - wh); // Linear interpolation - const match = pathMatches[1]; + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ - // Electron - if ( - match.includes('.app/Contents/Resources/electron.asar') || - match.includes('.app/Contents/Resources/default_app.asar') - ) { - return false; - } + return [r * 255, g * 255, b * 255]; +}; - return !pathRegex.test(match); - }) - .filter(line => line.trim() !== '') - .map(line => { - if (basePathRegex) { - line = line.replace(basePathRegex, '$1'); - } +convert.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; - if (pretty) { - line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~'))); - } + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); - return line; - }) - .join('\n'); + return [r * 255, g * 255, b * 255]; }; +convert.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; -/***/ }), + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); -/***/ 51240: -/***/ ((module) => { + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; -"use strict"; + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; -module.exports = string => { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); - // Escape characters with special meaning either inside or outside character sets. - // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. - return string - .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') - .replace(/-/g, '\\x2d'); + return [r * 255, g * 255, b * 255]; }; +convert.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; -/***/ }), + x /= 95.047; + y /= 100; + z /= 108.883; -/***/ 17348: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); -const _SingleBar = __webpack_require__(37561); -const _MultiBar = __webpack_require__(2013); -const _Presets = __webpack_require__(35040); -const _Formatter = __webpack_require__(18115); -const _defaultFormatValue = __webpack_require__(56404); -const _defaultFormatBar = __webpack_require__(76174); -const _defaultFormatTime = __webpack_require__(53900); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); -// sub-module access -module.exports = { - Bar: _SingleBar, - SingleBar: _SingleBar, - MultiBar: _MultiBar, - Presets: _Presets, - Format: { - Formatter: _Formatter, - BarFormat: _defaultFormatBar, - ValueFormat: _defaultFormatValue, - TimeFormat: _defaultFormatTime - } + return [l, a, b]; }; -/***/ }), - -/***/ 37954: -/***/ ((module) => { +convert.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; -// ETA calculation -class ETA{ + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; - constructor(length, initTime, initValue){ - // size of eta buffer - this.etaBufferLength = length || 100; + x *= 95.047; + y *= 100; + z *= 108.883; - // eta buffer with initial values - this.valueBuffer = [initValue]; - this.timeBuffer = [initTime]; + return [x, y, z]; +}; - // eta time value - this.eta = '0'; - } +convert.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; - // add new values to calculation buffer - update(time, value, total){ - this.valueBuffer.push(value); - this.timeBuffer.push(time); + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; - // trigger recalculation - this.calculate(total-value); - } + if (h < 0) { + h += 360; + } - // fetch estimated time - getTime(){ - return this.eta; - } + const c = Math.sqrt(a * a + b * b); - // eta calculation - request number of remaining events - calculate(remaining){ - // get number of samples in eta buffer - const currentBufferSize = this.valueBuffer.length; - const buffer = Math.min(this.etaBufferLength, currentBufferSize); + return [l, c, h]; +}; - const v_diff = this.valueBuffer[currentBufferSize - 1] - this.valueBuffer[currentBufferSize - buffer]; - const t_diff = this.timeBuffer[currentBufferSize - 1] - this.timeBuffer[currentBufferSize - buffer]; +convert.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; - // get progress per ms - const vt_rate = v_diff/t_diff; + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); - // strip past elements - this.valueBuffer = this.valueBuffer.slice(-this.etaBufferLength); - this.timeBuffer = this.timeBuffer.slice(-this.etaBufferLength); + return [l, a, b]; +}; - // eq: vt_rate *x = total - const eta = Math.ceil(remaining/vt_rate/1000); +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization - // check values - if (isNaN(eta)){ - this.eta = 'NULL'; + value = Math.round(value / 50); - // +/- Infinity --- NaN already handled - }else if (!isFinite(eta)){ - this.eta = 'INF'; + if (value === 0) { + return 30; + } - // > 10M s ? - set upper display limit ~115days (1e7/60/60/24) - }else if (eta > 1e7){ - this.eta = 'INF'; + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); - // negative ? - }else if (eta < 0){ - this.eta = 0; + if (value === 2) { + ansi += 60; + } - }else{ - // assign - this.eta = eta; - } - } -} + return ansi; +}; -module.exports = ETA; +convert.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; -/***/ }), +convert.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; -/***/ 76174: -/***/ ((module) => { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } -// format bar -module.exports = function formatBar(progress, options){ - // calculate barsize - const completeSize = Math.round(progress*options.barsize); - const incompleteSize = options.barsize-completeSize; + if (r > 248) { + return 231; + } - // generate bar string by stripping the pre-rendered strings - return options.barCompleteString.substr(0, completeSize) + - options.barGlue + - options.barIncompleteString.substr(0, incompleteSize); -} + return Math.round(((r - 8) / 247) * 24) + 232; + } -/***/ }), + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); -/***/ 53900: -/***/ ((module) => { + return ansi; +}; -// default time format +convert.ansi16.rgb = function (args) { + let color = args % 10; -// format a number of seconds into hours and minutes as appropriate -module.exports = function formatTime(t, options, roundToMultipleOf){ - function round(input) { - if (roundToMultipleOf) { - return roundToMultipleOf * Math.round(input / roundToMultipleOf); - } else { - return input - } - } + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } - // leading zero padding - function autopadding(v){ - return (options.autopaddingChar + v).slice(-2); - } + color = color / 10.5 * 255; - // > 1h ? - if (t > 3600) { - return autopadding(Math.floor(t / 3600)) + 'h' + autopadding(round((t % 3600) / 60)) + 'm'; + return [color, color, color]; + } - // > 60s ? - } else if (t > 60) { - return autopadding(Math.floor(t / 60)) + 'm' + autopadding(round((t % 60))) + 's'; + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; - // > 10s ? - } else if (t > 10) { - return autopadding(round(t)) + 's'; + return [r, g, b]; +}; - // default: don't apply round to multiple - }else{ - return autopadding(t) + 's'; - } -} +convert.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } -/***/ }), + args -= 16; -/***/ 56404: -/***/ ((module) => { + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; -// default value format (apply autopadding) + return [r, g, b]; +}; -// format valueset -module.exports = function formatValue(v, options, type){ - // no autopadding ? passthrough - if (options.autopadding !== true){ - return v; - } +convert.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); - // padding - function autopadding(value, length){ - return (options.autopaddingChar + value).slice(-length); - } + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; - switch (type){ - case 'percentage': - return autopadding(v, 3); +convert.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } - default: - return v; - } -} + let colorString = match[0]; -/***/ }), + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } -/***/ 18115: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; -const _stringWidth = __webpack_require__(42577); -const _defaultFormatValue = __webpack_require__(56404); -const _defaultFormatBar = __webpack_require__(76174); -const _defaultFormatTime = __webpack_require__(53900); + return [r, g, b]; +}; -// generic formatter -module.exports = function defaultFormatter(options, params, payload){ +convert.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; - // copy format string - let s = options.format; + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } - // custom time format set ? - const formatTime = options.formatTime || _defaultFormatTime; - - // custom value format set ? - const formatValue = options.formatValue || _defaultFormatValue; + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } - // custom bar format set ? - const formatBar = options.formatBar || _defaultFormatBar; + hue /= 6; + hue %= 1; - // calculate progress in percent - const percentage = Math.floor(params.progress*100) + ''; + return [hue * 360, chroma * 100, grayscale * 100]; +}; - // bar stopped and stopTime set ? - const stopTime = params.stopTime || Date.now(); +convert.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; - // calculate elapsed time - const elapsedTime = Math.round((stopTime - params.startTime)/1000); + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); - // merges data from payload and calculated - const context = Object.assign({}, payload, { - bar: formatBar(params.progress, options), + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } - percentage: formatValue(percentage, options, 'percentage'), - total: formatValue(params.total, options, 'total'), - value: formatValue(params.value, options, 'value'), + return [hsl[0], c * 100, f * 100]; +}; - eta: formatValue(params.eta, options, 'eta'), - eta_formatted: formatTime(params.eta, options, 5), - - duration: formatValue(elapsedTime, options, 'duration'), - duration_formatted: formatTime(elapsedTime, options, 1) - }); +convert.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; - // assign placeholder tokens - s = s.replace(/\{(\w+)\}/g, function(match, key){ - // key exists within payload/context - if (typeof context[key] !== 'undefined') { - return context[key]; - } + const c = s * v; + let f = 0; - // no changes to unknown values - return match; - }); + if (c < 1.0) { + f = (v - c) / (1 - c); + } - // calculate available whitespace (2 characters margin of error) - const fullMargin = Math.max(0, params.maxWidth - _stringWidth(s) -2); - const halfMargin = Math.floor(fullMargin / 2); + return [hsv[0], c * 100, f * 100]; +}; - // distribute available whitespace according to position - switch (options.align) { +convert.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; - // fill start-of-line with whitespaces - case 'right': - s = (fullMargin > 0) ? ' '.repeat(fullMargin) + s : s; - break; + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } - // distribute whitespaces to left+right - case 'center': - s = (halfMargin > 0) ? ' '.repeat(halfMargin) + s : s; - break; + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; - // default: left align, no additional whitespaces - case 'left': - default: - break; - } + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + /* eslint-enable max-statements-per-line */ - return s; -} + mg = (1.0 - c) * g; + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; -/***/ }), +convert.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; -/***/ 93455: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + const v = c + g * (1.0 - c); + let f = 0; -const _ETA = __webpack_require__(37954); -const _Terminal = __webpack_require__(44411); -const _formatter = __webpack_require__(18115); -const _EventEmitter = __webpack_require__(28614); + if (v > 0.0) { + f = c / v; + } -// Progress-Bar constructor -module.exports = class GenericBar extends _EventEmitter{ + return [hcg[0], f * 100, v * 100]; +}; - constructor(options){ - super(); +convert.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - // store options - this.options = options; + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; - // store terminal instance - this.terminal = (this.options.terminal) ? this.options.terminal : new _Terminal(this.options.stream); + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } - // the current bar value - this.value = 0; + return [hcg[0], s * 100, l * 100]; +}; - // the end value of the bar - this.total = 100; +convert.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; - // last drawn string - only render on change! - this.lastDrawnString = null; +convert.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; - // start time (used for eta calculation) - this.startTime = null; + if (c < 1) { + g = (v - c) / (1 - c); + } - // stop time (used for duration calculation) - this.stopTime = null; + return [hwb[0], c * 100, g * 100]; +}; - // last update time - this.lastRedraw = Date.now(); +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; - // default eta calculator (will be re-create on start) - this.eta = new _ETA(this.options.etaBufferLength, 0, 0); +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; - // payload data - this.payload = {}; +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; - // progress bar active ? - this.isActive = false; +convert.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; - // use default formatter or custom one ? - this.formatter = (typeof this.options.format === 'function') ? this.options.format : _formatter; - } +convert.gray.hsv = convert.gray.hsl; - // internal render function - render(){ - // calculate the normalized current progress - let progress = (this.value/this.total); +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; - // handle NaN Errors caused by total=0. Set to complete in this case - if (isNaN(progress)){ - progress = (this.options && this.options.emptyOnZero) ? 0.0 : 1.0; - } +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; - // limiter - progress = Math.min(Math.max(progress, 0.0), 1.0); +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; - // formatter params - const params = { - progress: progress, - eta: this.eta.getTime(), - startTime: this.startTime, - stopTime: this.stopTime, - total: this.total, - value: this.value, - maxWidth: this.terminal.getWidth() - }; +convert.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; - // automatic eta update ? (long running processes) - if (this.options.etaAsynchronousUpdate){ - this.updateETA(); - } + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; - // format string - const s = this.formatter(this.options, params, this.payload); +convert.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; - const forceRedraw = this.options.forceRedraw - // force redraw in notty-mode! - || (this.options.noTTYOutput && !this.terminal.isTTY()); - // string changed ? only trigger redraw on change! - if (forceRedraw || this.lastDrawnString != s){ - // trigger event - this.emit('redraw-pre'); +/***/ }), - // set cursor to start of line - this.terminal.cursorTo(0, null); +/***/ 18461: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // write output - this.terminal.write(s); +const conversions = __webpack_require__(87379); +const route = __webpack_require__(63152); - // clear to the right from cursor - this.terminal.clearRight(); +const convert = {}; - // store string - this.lastDrawnString = s; +const models = Object.keys(conversions); - // set last redraw time - this.lastRedraw = Date.now(); +function wrapRaw(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } - // trigger event - this.emit('redraw-post'); - } - } + if (arg0.length > 1) { + args = arg0; + } - // start the progress bar - start(total, startValue, payload){ - // set initial values - this.value = startValue || 0; - this.total = (typeof total !== 'undefined' && total >= 0) ? total : 100; + return fn(args); + }; - // store payload (optional) - this.payload = payload || {}; + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } - // store start time for duration+eta calculation - this.startTime = Date.now(); + return wrappedFn; +} - // reset string line buffer (redraw detection) - this.lastDrawnString = ''; +function wrapRounded(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; - // initialize eta buffer - this.eta = new _ETA(this.options.etaBufferLength, this.startTime, this.value); + if (arg0 === undefined || arg0 === null) { + return arg0; + } - // set flag - this.isActive = true; + if (arg0.length > 1) { + args = arg0; + } - // start event - this.emit('start', total, startValue); - } + const result = fn(args); - // stop the bar - stop(){ - // set flag - this.isActive = false; - - // store stop timestamp to get total duration - this.stopTime = new Date(); + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } - // stop event - this.emit('stop', this.total, this.value); - } + return result; + }; - // update the bar value - // update(value, payload) - // update(payload) - update(arg0, arg1 = {}){ - // value set ? - // update(value, [payload]); - if (typeof arg0 === 'number') { - // update value - this.value = arg0; + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } - // add new value; recalculate eta - this.eta.update(Date.now(), arg0, this.total); - } + return wrappedFn; +} - // extract payload - // update(value, payload) - // update(payload) - const payloadData = ((typeof arg0 === 'object') ? arg0 : arg1) || {}; +models.forEach(fromModel => { + convert[fromModel] = {}; - // update event (before stop() is called) - this.emit('update', this.total, this.value); - - // merge payload - for (const key in payloadData){ - this.payload[key] = payloadData[key]; - } - - // limit reached ? autostop set ? - if (this.value >= this.getTotal() && this.options.stopOnComplete) { - this.stop(); - } - } + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - // update the bar value - // increment(delta, payload) - // increment(payload) - increment(arg0 = 1, arg1 = {}){ - // increment([payload]) => step=1 - // handle the use case when `step` is omitted but payload is passed - if (typeof arg0 === 'object') { - this.update(this.value + 1, arg0); - - // increment([step=1], [payload={}]) - }else{ - this.update(this.value + arg0, arg1); - } - } + const routes = route(fromModel); + const routeModels = Object.keys(routes); - // get the total (limit) value - getTotal(){ - return this.total; - } + routeModels.forEach(toModel => { + const fn = routes[toModel]; - // set the total (limit) value - setTotal(total){ - if (typeof total !== 'undefined' && total >= 0){ - this.total = total; - } - } + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); - // force eta calculation update (long running processes) - updateETA(){ - // add new value; recalculate eta - this.eta.update(Date.now(), this.value, this.total); - } -} +module.exports = convert; /***/ }), -/***/ 2013: +/***/ 63152: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const _Terminal = __webpack_require__(44411); -const _BarElement = __webpack_require__(93455); -const _options = __webpack_require__(98322); -const _EventEmitter = __webpack_require__(28614); - -// Progress-Bar constructor -module.exports = class MultiBar extends _EventEmitter{ +const conversions = __webpack_require__(87379); - constructor(options, preset){ - super(); +/* + This function routes a model to all other models. - // list of bars - this.bars = []; + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). - // parse+store options - this.options = _options.parse(options, preset); + conversions that are not possible simply are not included. +*/ - // disable synchronous updates - this.options.synchronousUpdate = false; +function buildGraph() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions); - // store terminal instance - this.terminal = (this.options.terminal) ? this.options.terminal : new _Terminal(this.options.stream); + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } - // the update timer - this.timer = null; + return graph; +} - // progress bar active ? - this.isActive = false; +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop - // update interval - this.schedulingRate = (this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule); - } + graph[fromModel].distance = 0; - // add a new bar to the stack - create(total, startValue, payload){ - // progress updates are only visible in TTY mode! - if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){ - return; - } - - // create new bar element - const bar = new _BarElement(this.options); + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); - // store bar - this.bars.push(bar); + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; - // multiprogress already active ? - if (!this.isActive){ - // hide the cursor ? - if (this.options.hideCursor === true){ - this.terminal.cursor(false); - } + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } - // disable line wrapping ? - if (this.options.linewrap === false){ - this.terminal.lineWrapping(false); - } - - // initialize update timer - this.timer = setTimeout(this.update.bind(this), this.schedulingRate); - } + return graph; +} - // set flag - this.isActive = true; +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} - // start progress bar - bar.start(total, startValue, payload); +function wrapConversion(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; - // trigger event - this.emit('start'); + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } - // return new instance - return bar; - } + fn.conversion = path; + return fn; +} - // remove a bar from the stack - remove(bar){ - // find element - const index = this.bars.indexOf(bar); +module.exports = function (fromModel) { + const graph = deriveBFS(fromModel); + const conversion = {}; - // element found ? - if (index < 0){ - return false; - } + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; - // remove element - this.bars.splice(index, 1); + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } - // force update - this.update(); + conversion[toModel] = wrapConversion(toModel, graph); + } - // clear bottom - this.terminal.newline(); - this.terminal.clearBottom(); + return conversion; +}; - return true; - } - // internal update routine - update(){ - // stop timer - if (this.timer){ - clearTimeout(this.timer); - this.timer = null; - } - // trigger event - this.emit('update-pre'); - - // reset cursor - this.terminal.cursorRelativeReset(); +/***/ }), - // trigger event - this.emit('redraw-pre'); +/***/ 79903: +/***/ ((module) => { - // update each bar - for (let i=0; i< this.bars.length; i++){ - // add new line ? - if (i > 0){ - this.terminal.newline(); - } +"use strict"; + + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; - // render - this.bars[i].render(); - } - // trigger event - this.emit('redraw-post'); +/***/ }), - // add new line in notty mode! - if (this.options.noTTYOutput && this.terminal.isTTY() === false){ - this.terminal.newline(); - this.terminal.newline(); - } +/***/ 25779: +/***/ ((module) => { - // next update - this.timer = setTimeout(this.update.bind(this), this.schedulingRate); +"use strict"; - // trigger event - this.emit('update-post'); - // stop if stopOnComplete and all bars stopped - if (this.options.stopOnComplete && !this.bars.find(bar => bar.isActive)) { - this.stop(); - } - } +module.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); +}; - stop(){ - // stop timer - clearTimeout(this.timer); - this.timer = null; +/***/ }), - // set flag - this.isActive = false; +/***/ 91691: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // cursor hidden ? - if (this.options.hideCursor === true){ - this.terminal.cursor(true); - } +"use strict"; - // re-enable line wrpaping ? - if (this.options.linewrap === false){ - this.terminal.lineWrapping(true); - } +const os = __webpack_require__(12087); +const tty = __webpack_require__(33867); +const hasFlag = __webpack_require__(25779); - // reset cursor - this.terminal.cursorRelativeReset(); +const {env} = process; - // trigger event - this.emit('stop-pre-clear'); +let 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; +} - // clear line on complete ? - if (this.options.clearOnComplete){ - // clear all bars - this.terminal.clearBottom(); - - // or show final progress ? - }else{ - // update each bar - for (let i=0; i< this.bars.length; i++){ - // add new line ? - if (i > 0){ - this.terminal.newline(); - } +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); + } +} - // trigger final rendering - this.bars[i].render(); +function translateLevel(level) { + if (level === 0) { + return false; + } - // stop - this.bars[i].stop(); - } + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} - // new line on complete - this.terminal.newline(); - } +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } - // trigger event - this.emit('stop'); - } -} + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + if (hasFlag('color=256')) { + return 2; + } -/***/ }), + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } -/***/ 98322: -/***/ ((module) => { + const min = forceColor || 0; -// utility to merge defaults -function mergeOption(v, defaultValue){ - if (typeof v === 'undefined' || v === null){ - return defaultValue; - }else{ - return v; - } -} - -module.exports = { - // set global options - parse: function parse(rawOptions, preset){ - - // options storage - const options = {}; + if (env.TERM === 'dumb') { + return min; + } - // merge preset - const opt = Object.assign({}, preset, rawOptions); + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } - // the max update rate in fps (redraw will only triggered on value change) - options.throttleTime = 1000 / (mergeOption(opt.fps, 10)); + return 1; + } - // the output stream to write on - options.stream = mergeOption(opt.stream, process.stderr); + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } - // external terminal provided ? - options.terminal = mergeOption(opt.terminal, null); + return min; + } - // clear on finish ? - options.clearOnComplete = mergeOption(opt.clearOnComplete, false); + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } - // stop on finish ? - options.stopOnComplete = mergeOption(opt.stopOnComplete, false); + if (env.COLORTERM === 'truecolor') { + return 3; + } - // size of the progressbar in chars - options.barsize = mergeOption(opt.barsize, 40); + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - // position of the progress bar - 'left' (default), 'right' or 'center' - options.align = mergeOption(opt.align, 'left'); + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } - // hide the cursor ? - options.hideCursor = mergeOption(opt.hideCursor, false); + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } - // disable linewrapping ? - options.linewrap = mergeOption(opt.linewrap, false); + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } - // pre-render bar strings (performance) - options.barCompleteString = (new Array(options.barsize + 1 ).join(opt.barCompleteChar || '=')); - options.barIncompleteString = (new Array(options.barsize + 1 ).join(opt.barIncompleteChar || '-')); + if ('COLORTERM' in env) { + return 1; + } - // glue sequence (control chars) between bar elements ? - options.barGlue = mergeOption(opt.barGlue, ''); + return min; +} - // the bar format - options.format = mergeOption(opt.format, 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'); +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} - // external time-format provided ? - options.formatTime = mergeOption(opt.formatTime, null); +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; - // external value-format provided ? - options.formatValue = mergeOption(opt.formatValue, null); - // external bar-format provided ? - options.formatBar = mergeOption(opt.formatBar, null); +/***/ }), - // the number of results to average ETA over - options.etaBufferLength = mergeOption(opt.etaBuffer, 10); +/***/ 22116: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - // automatic eta updates based on fps - options.etaAsynchronousUpdate = mergeOption(opt.etaAsynchronousUpdate, false); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "__extends": () => /* binding */ __extends, +/* harmony export */ "__assign": () => /* binding */ __assign, +/* harmony export */ "__rest": () => /* binding */ __rest, +/* harmony export */ "__decorate": () => /* binding */ __decorate, +/* harmony export */ "__param": () => /* binding */ __param, +/* harmony export */ "__metadata": () => /* binding */ __metadata, +/* harmony export */ "__awaiter": () => /* binding */ __awaiter, +/* harmony export */ "__generator": () => /* binding */ __generator, +/* harmony export */ "__createBinding": () => /* binding */ __createBinding, +/* harmony export */ "__exportStar": () => /* binding */ __exportStar, +/* harmony export */ "__values": () => /* binding */ __values, +/* harmony export */ "__read": () => /* binding */ __read, +/* harmony export */ "__spread": () => /* binding */ __spread, +/* harmony export */ "__spreadArrays": () => /* binding */ __spreadArrays, +/* harmony export */ "__spreadArray": () => /* binding */ __spreadArray, +/* harmony export */ "__await": () => /* binding */ __await, +/* harmony export */ "__asyncGenerator": () => /* binding */ __asyncGenerator, +/* harmony export */ "__asyncDelegator": () => /* binding */ __asyncDelegator, +/* harmony export */ "__asyncValues": () => /* binding */ __asyncValues, +/* harmony export */ "__makeTemplateObject": () => /* binding */ __makeTemplateObject, +/* harmony export */ "__importStar": () => /* binding */ __importStar, +/* harmony export */ "__importDefault": () => /* binding */ __importDefault, +/* harmony export */ "__classPrivateFieldGet": () => /* binding */ __classPrivateFieldGet, +/* harmony export */ "__classPrivateFieldSet": () => /* binding */ __classPrivateFieldSet +/* harmony export */ }); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +function __spreadArray(to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +function __importStar(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; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} - // allow synchronous updates ? - options.synchronousUpdate = mergeOption(opt.synchronousUpdate, true); - // notty mode - options.noTTYOutput = mergeOption(opt.noTTYOutput, false); +/***/ }), - // schedule - 2s - options.notTTYSchedule = mergeOption(opt.notTTYSchedule, 2000); - - // emptyOnZero - false - options.emptyOnZero = mergeOption(opt.emptyOnZero, false); +/***/ 97391: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // force bar redraw even if progress did not change - options.forceRedraw = mergeOption(opt.forceRedraw, false); +/* MIT license */ +var cssKeywords = __webpack_require__(78510); - // automated padding to fixed width ? - options.autopadding = mergeOption(opt.autopadding, false); +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) - // autopadding character - empty in case autopadding is disabled - options.autopaddingChar = options.autopadding ? mergeOption(opt.autopaddingChar, ' ') : ''; +var reverseKeywords = {}; +for (var key in cssKeywords) { + if (cssKeywords.hasOwnProperty(key)) { + reverseKeywords[cssKeywords[key]] = key; + } +} - return options; - } +var convert = module.exports = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} }; -/***/ }), - -/***/ 37561: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +// hide .channels and .labels properties +for (var model in convert) { + if (convert.hasOwnProperty(model)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } -const _GenericBar = __webpack_require__(93455); -const _options = __webpack_require__(98322); + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } -// Progress-Bar constructor -module.exports = class SingleBar extends _GenericBar{ + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } - constructor(options, preset){ - super(_options.parse(options, preset)); + var channels = convert[model].channels; + var labels = convert[model].labels; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); + } +} - // the update timer - this.timer = null; +convert.rgb.hsl = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var l; - // disable synchronous updates in notty mode - if (this.options.noTTYOutput && this.terminal.isTTY() === false){ - this.options.synchronousUpdate = false; - } + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } - // update interval - this.schedulingRate = (this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule); - } + h = Math.min(h * 60, 360); - // internal render function - render(){ - // stop timer - if (this.timer){ - clearTimeout(this.timer); - this.timer = null; - } + if (h < 0) { + h += 360; + } - // run internal rendering - super.render(); + l = (min + max) / 2; - // add new line in notty mode! - if (this.options.noTTYOutput && this.terminal.isTTY() === false){ - this.terminal.newline(); - } + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } - // next update - this.timer = setTimeout(this.render.bind(this), this.schedulingRate); - } + return [h, s * 100, l * 100]; +}; - update(current, payload){ - // timer inactive ? - if (!this.timer) { - return; - } - - super.update(current, payload); +convert.rgb.hsv = function (rgb) { + var rdif; + var gdif; + var bdif; + var h; + var s; - // trigger synchronous update ? - // check for throttle time - if (this.options.synchronousUpdate && (this.lastRedraw + this.options.throttleTime*2) < Date.now()){ - // force update - this.render(); - } - } + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var v = Math.max(r, g, b); + var diff = v - Math.min(r, g, b); + var diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; - // start the progress bar - start(total, startValue, payload){ - // progress updates are only visible in TTY mode! - if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){ - return; - } + if (diff === 0) { + h = s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); - // save current cursor settings - this.terminal.cursorSave(); + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } - // hide the cursor ? - if (this.options.hideCursor === true){ - this.terminal.cursor(false); - } + return [ + h * 360, + s * 100, + v * 100 + ]; +}; - // disable line wrapping ? - if (this.options.linewrap === false){ - this.terminal.lineWrapping(false); - } +convert.rgb.hwb = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var h = convert.rgb.hsl(rgb)[0]; + var w = 1 / 255 * Math.min(r, Math.min(g, b)); - // initialize bar - super.start(total, startValue, payload); + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - // redraw on start! - this.render(); - } + return [h, w * 100, b * 100]; +}; - // stop the bar - stop(){ - // timer inactive ? - if (!this.timer) { - return; - } +convert.rgb.cmyk = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var c; + var m; + var y; + var k; - // trigger final rendering - this.render(); + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; - // restore state - super.stop(); + return [c * 100, m * 100, y * 100, k * 100]; +}; - // stop timer - clearTimeout(this.timer); - this.timer = null; +/** + * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + * */ +function comparativeDistance(x, y) { + return ( + Math.pow(x[0] - y[0], 2) + + Math.pow(x[1] - y[1], 2) + + Math.pow(x[2] - y[2], 2) + ); +} - // cursor hidden ? - if (this.options.hideCursor === true){ - this.terminal.cursor(true); - } +convert.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } - // re-enable line wrapping ? - if (this.options.linewrap === false){ - this.terminal.lineWrapping(true); - } + var currentClosestDistance = Infinity; + var currentClosestKeyword; - // restore cursor on complete (position + settings) - this.terminal.cursorRestore(); + for (var keyword in cssKeywords) { + if (cssKeywords.hasOwnProperty(keyword)) { + var value = cssKeywords[keyword]; - // clear line on complete ? - if (this.options.clearOnComplete){ - this.terminal.cursorTo(0, null); - this.terminal.clearLine(); - }else{ - // new line on complete - this.terminal.newline(); - } - } -} + // Compute comparative distance + var distance = comparativeDistance(rgb, value); -/***/ }), + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + } -/***/ 44411: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + return currentClosestKeyword; +}; -const _readline = __webpack_require__(51058); +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; -// low-level terminal interactions -class Terminal{ +convert.rgb.xyz = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; - constructor(outputStream){ - this.stream = outputStream; + // assume sRGB + r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); + g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); + b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - // default: line wrapping enabled - this.linewrap = true; + var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - // current, relative y position - this.dy = 0; - } + return [x * 100, y * 100, z * 100]; +}; - // save cursor position + settings - cursorSave(){ - if (!this.stream.isTTY){ - return; - } +convert.rgb.lab = function (rgb) { + var xyz = convert.rgb.xyz(rgb); + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; - // save position - this.stream.write('\x1B7'); - } + x /= 95.047; + y /= 100; + z /= 108.883; - // restore last cursor position + settings - cursorRestore(){ - if (!this.stream.isTTY){ - return; - } + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); - // restore cursor - this.stream.write('\x1B8'); - } + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); - // show/hide cursor - cursor(enabled){ - if (!this.stream.isTTY){ - return; - } + return [l, a, b]; +}; - if (enabled){ - this.stream.write('\x1B[?25h'); - }else{ - this.stream.write('\x1B[?25l'); - } - } +convert.hsl.rgb = function (hsl) { + var h = hsl[0] / 360; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var t1; + var t2; + var t3; + var rgb; + var val; - // change cursor positionn - cursorTo(x=null, y=null){ - if (!this.stream.isTTY){ - return; - } + if (s === 0) { + val = l * 255; + return [val, val, val]; + } - // move cursor absolute - _readline.cursorTo(this.stream, x, y); - } + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } - // change relative cursor position - cursorRelative(dx=null, dy=null){ - if (!this.stream.isTTY){ - return; - } + t1 = 2 * l - t2; - // store current position - this.dy = this.dy + dy; - - // move cursor relative - _readline.moveCursor(this.stream, dx, dy); - } + rgb = [0, 0, 0]; + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + if (t3 > 1) { + t3--; + } - // relative reset - cursorRelativeReset(){ - if (!this.stream.isTTY){ - return; - } + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } - // move cursor to initial line - _readline.moveCursor(this.stream, 0, -this.dy); + rgb[i] = val * 255; + } - // first char - _readline.cursorTo(this.stream, 0, null); + return rgb; +}; - // reset counter - this.dy = 0; - } +convert.hsl.hsv = function (hsl) { + var h = hsl[0]; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var smin = s; + var lmin = Math.max(l, 0.01); + var sv; + var v; - // clear to the right from cursor - clearRight(){ - if (!this.stream.isTTY){ - return; - } + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + v = (l + s) / 2; + sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - _readline.clearLine(this.stream, 1); - } + return [h, sv * 100, v * 100]; +}; - // clear the full line - clearLine(){ - if (!this.stream.isTTY){ - return; - } +convert.hsv.rgb = function (hsv) { + var h = hsv[0] / 60; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var hi = Math.floor(h) % 6; - _readline.clearLine(this.stream, 0); - } + var f = h - Math.floor(h); + var p = 255 * v * (1 - s); + var q = 255 * v * (1 - (s * f)); + var t = 255 * v * (1 - (s * (1 - f))); + v *= 255; - // clear everyting beyond the current line - clearBottom(){ - if (!this.stream.isTTY){ - return; - } + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; - _readline.clearScreenDown(this.stream); - } +convert.hsv.hsl = function (hsv) { + var h = hsv[0]; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var vmin = Math.max(v, 0.01); + var lmin; + var sl; + var l; - // add new line; increment counter - newline(){ - this.stream.write('\n'); - this.dy++; - } + l = (2 - s) * v; + lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; - // write content to output stream - // @TODO use string-width to strip length - write(s){ - // line wrapping enabled ? trim output - if (this.linewrap === true){ - this.stream.write(s.substr(0, this.getWidth())); - }else{ - this.stream.write(s); - } - } + return [h, sl * 100, l * 100]; +}; - // control line wrapping - lineWrapping(enabled){ - if (!this.stream.isTTY){ - return; - } +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + var h = hwb[0] / 360; + var wh = hwb[1] / 100; + var bl = hwb[2] / 100; + var ratio = wh + bl; + var i; + var v; + var f; + var n; - // store state - this.linewrap = enabled; - if (enabled){ - this.stream.write('\x1B[?7h'); - }else{ - this.stream.write('\x1B[?7l'); - } - } + // wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } - // tty environment ? - isTTY(){ - return (this.stream.isTTY === true); - } + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; - // get terminal width - getWidth(){ - // set max width to 80 in tty-mode and 200 in notty-mode - return this.stream.columns || (this.stream.isTTY ? 80 : 200); - } -} + if ((i & 0x01) !== 0) { + f = 1 - f; + } -module.exports = Terminal; + n = wh + f * (v - wh); // linear interpolation + var r; + var g; + var b; + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } -/***/ }), + return [r * 255, g * 255, b * 255]; +}; -/***/ 35040: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +convert.cmyk.rgb = function (cmyk) { + var c = cmyk[0] / 100; + var m = cmyk[1] / 100; + var y = cmyk[2] / 100; + var k = cmyk[3] / 100; + var r; + var g; + var b; -const _legacy = __webpack_require__(62594); -const _shades_classic = __webpack_require__(18373); -const _shades_grey = __webpack_require__(21106); -const _rect = __webpack_require__(50441); + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); -module.exports = { - legacy: _legacy, - shades_classic: _shades_classic, - shades_grey: _shades_grey, - rect: _rect + return [r * 255, g * 255, b * 255]; }; -/***/ }), +convert.xyz.rgb = function (xyz) { + var x = xyz[0] / 100; + var y = xyz[1] / 100; + var z = xyz[2] / 100; + var r; + var g; + var b; -/***/ 62594: -/***/ ((module) => { + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); -// cli-progress legacy style as of 1.x -module.exports = { - format: 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}', - barCompleteChar: '=', - barIncompleteChar: '-' -}; + // assume sRGB + r = r > 0.0031308 + ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + : r * 12.92; -/***/ }), + g = g > 0.0031308 + ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + : g * 12.92; -/***/ 50441: -/***/ ((module) => { + b = b > 0.0031308 + ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + : b * 12.92; -module.exports = { - format: ' {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}', - barCompleteChar: '\u25A0', - barIncompleteChar: ' ' + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; }; -/***/ }), +convert.xyz.lab = function (xyz) { + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; -/***/ 18373: -/***/ ((module) => { + x /= 95.047; + y /= 100; + z /= 108.883; -// cli-progress legacy style as of 1.x -module.exports = { - format: ' {bar} {percentage}% | ETA: {eta}s | {value}/{total}', - barCompleteChar: '\u2588', - barIncompleteChar: '\u2591' + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); + + return [l, a, b]; }; -/***/ }), +convert.lab.xyz = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var x; + var y; + var z; -/***/ 21106: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; -const _colors = __webpack_require__(83045); + var y2 = Math.pow(y, 3); + var x2 = Math.pow(x, 3); + var z2 = Math.pow(z, 3); + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; -// cli-progress legacy style as of 1.x -module.exports = { - format: _colors.grey(' {bar}') + ' {percentage}% | ETA: {eta}s | {value}/{total}', - barCompleteChar: '\u2588', - barIncompleteChar: '\u2591' + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; }; -/***/ }), +convert.lab.lch = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var hr; + var h; + var c; -/***/ 52397: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; -"use strict"; + if (h < 0) { + h += 360; + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(22116); -const castArray_1 = tslib_1.__importDefault(__webpack_require__(55996)); -const util_1 = __webpack_require__(31669); -class ActionBase { - constructor() { - this.std = 'stderr'; - this.stdmockOrigs = { - stdout: process.stdout.write, - stderr: process.stderr.write, - }; - } - start(action, status, opts = {}) { - this.std = opts.stdout ? 'stdout' : 'stderr'; - const task = { action, status, active: Boolean(this.task && this.task.active) }; - this.task = task; - this._start(); - task.active = true; - this._stdout(true); - } - stop(msg = 'done') { - const task = this.task; - if (!task) { - return; - } - this._stop(msg); - task.active = false; - this.task = undefined; - this._stdout(false); - } - get globals() { - global['cli-ux'] = global['cli-ux'] || {}; - const globals = global['cli-ux']; - globals.action = globals.action || {}; - return globals; - } - get task() { - return this.globals.action.task; - } - set task(task) { - this.globals.action.task = task; - } - get output() { - return this.globals.output; - } - set output(output) { - this.globals.output = output; - } - get running() { - return Boolean(this.task); - } - get status() { - return this.task ? this.task.status : undefined; - } - set status(status) { - const task = this.task; - if (!task) { - return; - } - if (task.status === status) { - return; - } - this._updateStatus(status, task.status); - task.status = status; - } - async pauseAsync(fn, icon) { - const task = this.task; - const active = task && task.active; - if (task && active) { - this._pause(icon); - this._stdout(false); - task.active = false; - } - const ret = await fn(); - if (task && active) { - this._resume(); - } - return ret; - } - pause(fn, icon) { - const task = this.task; - const active = task && task.active; - if (task && active) { - this._pause(icon); - this._stdout(false); - task.active = false; - } - const ret = fn(); - if (task && active) { - this._resume(); - } - return ret; - } - _start() { - throw new Error('not implemented'); - } - _stop(_) { - throw new Error('not implemented'); - } - _resume() { - if (this.task) - this.start(this.task.action, this.task.status); - } - _pause(_) { - throw new Error('not implemented'); - } - // eslint-disable-next-line @typescript-eslint/no-empty-function - _updateStatus(_, __) { } - /** - * mock out stdout/stderr so it doesn't screw up the rendering - */ - _stdout(toggle) { - try { - const outputs = ['stdout', 'stderr']; - if (toggle) { - if (this.stdmocks) - return; - this.stdmockOrigs = { - stdout: process.stdout.write, - stderr: process.stderr.write, - }; - this.stdmocks = []; - for (const std of outputs) { - process[std].write = (...args) => { - this.stdmocks.push([std, args]); - }; - } - } - else { - if (!this.stdmocks) - return; - // this._write('stderr', '\nresetstdmock\n\n\n') - delete this.stdmocks; - for (const std of outputs) - process[std].write = this.stdmockOrigs[std]; - } - } - catch (error) { - this._write('stderr', util_1.inspect(error)); - } - } - /** - * flush mocked stdout/stderr - */ - _flushStdout() { - try { - let output = ''; - let std; - while (this.stdmocks && this.stdmocks.length) { - const cur = this.stdmocks.shift(); - std = cur[0]; - this._write(std, cur[1]); - output += cur[1][0].toString('utf8'); - } - // add newline if there isn't one already - // otherwise we'll just overwrite it when we render - if (output && std && output[output.length - 1] !== '\n') { - this._write(std, '\n'); - } - } - catch (error) { - this._write('stderr', util_1.inspect(error)); - } - } - /** - * write to the real stdout/stderr - */ - _write(std, s) { - this.stdmockOrigs[std].apply(process[std], castArray_1.default(s)); - } -} -exports.ActionBase = ActionBase; + c = Math.sqrt(a * a + b * b); + return [l, c, h]; +}; -/***/ }), +convert.lch.lab = function (lch) { + var l = lch[0]; + var c = lch[1]; + var h = lch[2]; + var a; + var b; + var hr; -/***/ 91525: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); -"use strict"; -var __webpack_unused_export__; + return [l, a, b]; +}; -// tslint:disable restrict-plus-operands -__webpack_unused_export__ = ({ value: true }); -const tslib_1 = __webpack_require__(22116); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -const supportsColor = tslib_1.__importStar(__webpack_require__(91691)); -const spinner_1 = tslib_1.__importDefault(__webpack_require__(60062)); -function color(s, frameIndex) { - const prideColors = [ - chalk_1.default.keyword('pink'), - chalk_1.default.red, - chalk_1.default.keyword('orange'), - chalk_1.default.yellow, - chalk_1.default.green, - chalk_1.default.cyan, - chalk_1.default.blue, - chalk_1.default.magenta, - ]; - if (!supportsColor) - return s; - const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').indexOf('256') !== -1; - const prideColor = prideColors[frameIndex] || prideColors[0]; - return has256 ? prideColor(s) : chalk_1.default.magenta(s); -} -class PrideSpinnerAction extends spinner_1.default { - _frame() { - const frame = this.frames[this.frameIndex]; - this.frameIndex = ++this.frameIndex % this.frames.length; - return color(frame, this.frameIndex); - } -} -exports.Z = PrideSpinnerAction; +convert.rgb.ansi16 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization + value = Math.round(value / 50); -/***/ }), + if (value === 0) { + return 30; + } -/***/ 96419: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + var ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); -"use strict"; -var __webpack_unused_export__; + if (value === 2) { + ansi += 60; + } -__webpack_unused_export__ = ({ value: true }); -const base_1 = __webpack_require__(52397); -class SimpleAction extends base_1.ActionBase { - constructor() { - super(...arguments); - this.type = 'simple'; - } - _start() { - const task = this.task; - if (!task) - return; - this._render(task.action, task.status); - } - _pause(icon) { - if (icon) - this._updateStatus(icon); - else - this._flush(); - } - // eslint-disable-next-line @typescript-eslint/no-empty-function - _resume() { } - _updateStatus(status, prevStatus, newline = false) { - const task = this.task; - if (!task) - return; - if (task.active && !prevStatus) - this._write(this.std, ` ${status}`); - else - this._write(this.std, `${task.action}... ${status}`); - if (newline || !prevStatus) - this._flush(); - } - _stop(status) { - const task = this.task; - if (!task) - return; - this._updateStatus(status, task.status, true); - } - _render(action, status) { - const task = this.task; - if (!task) - return; - if (task.active) - this._flush(); - this._write(this.std, status ? `${action}... ${status}` : `${action}...`); - } - _flush() { - this._write(this.std, '\n'); - this._flushStdout(); - } -} -exports.Z = SimpleAction; + return ansi; +}; +convert.hsv.ansi16 = function (args) { + // optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; -/***/ }), +convert.rgb.ansi256 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; -/***/ 60062: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + // we use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } -"use strict"; + if (r > 248) { + return 231; + } -// tslint:disable restrict-plus-operands -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(22116); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -const supportsColor = tslib_1.__importStar(__webpack_require__(91691)); -const deps_1 = tslib_1.__importDefault(__webpack_require__(74560)); -const base_1 = __webpack_require__(52397); -/* eslint-disable-next-line node/no-missing-require */ -const spinners = __webpack_require__(9001); -function color(s) { - if (!supportsColor) - return s; - const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').indexOf('256') !== -1; - return has256 ? `\u001B[38;5;104m${s}${deps_1.default.ansiStyles.reset.open}` : chalk_1.default.magenta(s); -} -class SpinnerAction extends base_1.ActionBase { - constructor() { - super(); - this.type = 'spinner'; - this.frames = spinners[process.platform === 'win32' ? 'line' : 'dots2'].frames; - this.frameIndex = 0; - } - _start() { - this._reset(); - if (this.spinner) - clearInterval(this.spinner); - this._render(); - this.spinner = setInterval(icon => this._render.bind(this)(icon), process.platform === 'win32' ? 500 : 100, 'spinner'); - const interval = this.spinner; - interval.unref(); - } - _stop(status) { - if (this.task) - this.task.status = status; - if (this.spinner) - clearInterval(this.spinner); - this._render(); - this.output = undefined; - } - _pause(icon) { - if (this.spinner) - clearInterval(this.spinner); - this._reset(); - if (icon) - this._render(` ${icon}`); - this.output = undefined; - } - _frame() { - const frame = this.frames[this.frameIndex]; - this.frameIndex = ++this.frameIndex % this.frames.length; - return color(frame); - } - _render(icon) { - const task = this.task; - if (!task) - return; - this._reset(); - this._flushStdout(); - const frame = icon === 'spinner' ? ` ${this._frame()}` : icon || ''; - const status = task.status ? ` ${task.status}` : ''; - this.output = `${task.action}...${frame}${status}\n`; - this._write(this.std, this.output); - } - _reset() { - if (!this.output) - return; - const lines = this._lines(this.output); - this._write(this.std, deps_1.default.ansiEscapes.cursorLeft + deps_1.default.ansiEscapes.cursorUp(lines) + deps_1.default.ansiEscapes.eraseDown); - this.output = undefined; - } - _lines(s) { - return deps_1.default - .stripAnsi(s) - .split('\n') - .map(l => Math.ceil(l.length / deps_1.default.screen.errtermwidth)) - .reduce((c, i) => c + i, 0); - } -} -exports.default = SpinnerAction; + return Math.round(((r - 8) / 247) * 24) + 232; + } + var ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); -/***/ }), + return ansi; +}; -/***/ 9001: -/***/ ((module) => { +convert.ansi16.rgb = function (args) { + var color = args % 10; -"use strict"; - -module.exports = { - hexagon: { - interval: 400, - frames: ['⬡', '⬢'], - }, - dots: { - interval: 80, - frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'], - }, - dots2: { - interval: 80, - frames: ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'], - }, - dots3: { - interval: 80, - frames: ['⠋', '⠙', '⠚', '⠞', '⠖', '⠦', '⠴', '⠲', '⠳', '⠓'], - }, - dots4: { - interval: 80, - frames: ['⠄', '⠆', '⠇', '⠋', '⠙', '⠸', '⠰', '⠠', '⠰', '⠸', '⠙', '⠋', '⠇', '⠆'], - }, - dots5: { - interval: 80, - frames: ['⠋', '⠙', '⠚', '⠒', '⠂', '⠂', '⠒', '⠲', '⠴', '⠦', '⠖', '⠒', '⠐', '⠐', '⠒', '⠓', '⠋'], - }, - dots6: { - interval: 80, - frames: [ - '⠁', - '⠉', - '⠙', - '⠚', - '⠒', - '⠂', - '⠂', - '⠒', - '⠲', - '⠴', - '⠤', - '⠄', - '⠄', - '⠤', - '⠴', - '⠲', - '⠒', - '⠂', - '⠂', - '⠒', - '⠚', - '⠙', - '⠉', - '⠁', - ], - }, - dots7: { - interval: 80, - frames: [ - '⠈', - '⠉', - '⠋', - '⠓', - '⠒', - '⠐', - '⠐', - '⠒', - '⠖', - '⠦', - '⠤', - '⠠', - '⠠', - '⠤', - '⠦', - '⠖', - '⠒', - '⠐', - '⠐', - '⠒', - '⠓', - '⠋', - '⠉', - '⠈', - ], - }, - dots8: { - interval: 80, - frames: [ - '⠁', - '⠁', - '⠉', - '⠙', - '⠚', - '⠒', - '⠂', - '⠂', - '⠒', - '⠲', - '⠴', - '⠤', - '⠄', - '⠄', - '⠤', - '⠠', - '⠠', - '⠤', - '⠦', - '⠖', - '⠒', - '⠐', - '⠐', - '⠒', - '⠓', - '⠋', - '⠉', - '⠈', - '⠈', - ], - }, - dots9: { - interval: 80, - frames: ['⢹', '⢺', '⢼', '⣸', '⣇', '⡧', '⡗', '⡏'], - }, - dots10: { - interval: 80, - frames: ['⢄', '⢂', '⢁', '⡁', '⡈', '⡐', '⡠'], - }, - dots11: { - interval: 100, - frames: ['⠁', '⠂', '⠄', '⡀', '⢀', '⠠', '⠐', '⠈'], - }, - line: { - interval: 130, - frames: ['-', '\\', '|', '/'], - }, - line2: { - interval: 100, - frames: ['⠂', '-', '–', '—', '–', '-'], - }, - pipe: { - interval: 100, - frames: ['┤', '┘', '┴', '└', '├', '┌', '┬', '┐'], - }, - simpleDots: { - interval: 400, - frames: ['. ', '.. ', '...', ' '], - }, - simpleDotsScrolling: { - interval: 200, - frames: ['. ', '.. ', '...', ' ..', ' .', ' '], - }, - star: { - interval: 70, - frames: ['✶', '✸', '✹', '✺', '✹', '✷'], - }, - star2: { - interval: 80, - frames: ['+', 'x', '*'], - }, - flip: { - interval: 70, - frames: ['_', '_', '_', '-', '`', '`', '\'', '´', '-', '_', '_', '_'], - }, - hamburger: { - interval: 100, - frames: ['☱', '☲', '☴'], - }, - growVertical: { - interval: 120, - frames: ['▁', '▃', '▄', '▅', '▆', '▇', '▆', '▅', '▄', '▃'], - }, - growHorizontal: { - interval: 120, - frames: ['▏', '▎', '▍', '▌', '▋', '▊', '▉', '▊', '▋', '▌', '▍', '▎'], - }, - balloon: { - interval: 140, - frames: [' ', '.', 'o', 'O', '@', '*', ' '], - }, - balloon2: { - interval: 120, - frames: ['.', 'o', 'O', '°', 'O', 'o', '.'], - }, - noise: { - interval: 100, - frames: ['▓', '▒', '░'], - }, - bounce: { - interval: 120, - frames: ['⠁', '⠂', '⠄', '⠂'], - }, - boxBounce: { - interval: 120, - frames: ['▖', '▘', '▝', '▗'], - }, - boxBounce2: { - interval: 100, - frames: ['▌', '▀', '▐', '▄'], - }, - triangle: { - interval: 50, - frames: ['◢', '◣', '◤', '◥'], - }, - arc: { - interval: 100, - frames: ['◜', '◠', '◝', '◞', '◡', '◟'], - }, - circle: { - interval: 120, - frames: ['◡', '⊙', '◠'], - }, - squareCorners: { - interval: 180, - frames: ['◰', '◳', '◲', '◱'], - }, - circleQuarters: { - interval: 120, - frames: ['◴', '◷', '◶', '◵'], - }, - circleHalves: { - interval: 50, - frames: ['◐', '◓', '◑', '◒'], - }, - squish: { - interval: 100, - frames: ['╫', '╪'], - }, - toggle: { - interval: 250, - frames: ['⊶', '⊷'], - }, - toggle2: { - interval: 80, - frames: ['▫', '▪'], - }, - toggle3: { - interval: 120, - frames: ['□', '■'], - }, - toggle4: { - interval: 100, - frames: ['■', '□', '▪', '▫'], - }, - toggle5: { - interval: 100, - frames: ['▮', '▯'], - }, - toggle6: { - interval: 300, - frames: ['ဝ', '၀'], - }, - toggle7: { - interval: 80, - frames: ['⦾', '⦿'], - }, - toggle8: { - interval: 100, - frames: ['◍', '◌'], - }, - toggle9: { - interval: 100, - frames: ['◉', '◎'], - }, - toggle10: { - interval: 100, - frames: ['㊂', '㊀', '㊁'], - }, - toggle11: { - interval: 50, - frames: ['⧇', '⧆'], - }, - toggle12: { - interval: 120, - frames: ['☗', '☖'], - }, - toggle13: { - interval: 80, - frames: ['=', '*', '-'], - }, - arrow: { - interval: 100, - frames: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'], - }, - arrow2: { - interval: 80, - frames: ['⬆️ ', '↗️ ', '➡️ ', '↘️ ', '⬇️ ', '↙️ ', '⬅️ ', '↖️ '], - }, - arrow3: { - interval: 120, - frames: ['▹▹▹▹▹', '▸▹▹▹▹', '▹▸▹▹▹', '▹▹▸▹▹', '▹▹▹▸▹', '▹▹▹▹▸'], - }, - bouncingBar: { - interval: 80, - frames: ['[ ]', '[ =]', '[ ==]', '[ ===]', '[====]', '[=== ]', '[== ]', '[= ]'], - }, - bouncingBall: { - interval: 80, - frames: [ - '( ● )', - '( ● )', - '( ● )', - '( ● )', - '( ●)', - '( ● )', - '( ● )', - '( ● )', - '( ● )', - '(● )', - ], - }, - smiley: { - interval: 200, - frames: ['😄 ', '😝 '], - }, - monkey: { - interval: 300, - frames: ['🙈 ', '🙈 ', '🙉 ', '🙊 '], - }, - hearts: { - interval: 100, - frames: ['💛 ', '💙 ', '💜 ', '💚 ', '❤️ '], - }, - clock: { - interval: 100, - frames: ['🕐 ', '🕑 ', '🕒 ', '🕓 ', '🕔 ', '🕕 ', '🕖 ', '🕗 ', '🕘 ', '🕙 ', '🕚 '], - }, - earth: { - interval: 180, - frames: ['🌍 ', '🌎 ', '🌏 '], - }, - moon: { - interval: 80, - frames: ['🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 '], - }, - runner: { - interval: 140, - frames: ['🚶 ', '🏃 '], - }, - pong: { - interval: 80, - frames: [ - '▐⠂ ▌', - '▐⠈ ▌', - '▐ ⠂ ▌', - '▐ ⠠ ▌', - '▐ ⡀ ▌', - '▐ ⠠ ▌', - '▐ ⠂ ▌', - '▐ ⠈ ▌', - '▐ ⠂ ▌', - '▐ ⠠ ▌', - '▐ ⡀ ▌', - '▐ ⠠ ▌', - '▐ ⠂ ▌', - '▐ ⠈ ▌', - '▐ ⠂▌', - '▐ ⠠▌', - '▐ ⡀▌', - '▐ ⠠ ▌', - '▐ ⠂ ▌', - '▐ ⠈ ▌', - '▐ ⠂ ▌', - '▐ ⠠ ▌', - '▐ ⡀ ▌', - '▐ ⠠ ▌', - '▐ ⠂ ▌', - '▐ ⠈ ▌', - '▐ ⠂ ▌', - '▐ ⠠ ▌', - '▐ ⡀ ▌', - '▐⠠ ▌', - ], - }, -}; + // handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + color = color / 10.5 * 255; -/***/ }), + return [color, color, color]; + } -/***/ 25155: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + var mult = (~~(args > 50) + 1) * 0.5; + var r = ((color & 1) * mult) * 255; + var g = (((color >> 1) & 1) * mult) * 255; + var b = (((color >> 2) & 1) * mult) * 255; -"use strict"; + return [r, g, b]; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(22116); -const semver = tslib_1.__importStar(__webpack_require__(40089)); -const version = semver.parse(__webpack_require__(14062)/* .version */ .i8); -const g = global; -const globals = g['cli-ux'] || (g['cli-ux'] = {}); -const actionType = (Boolean(process.stderr.isTTY) && - !process.env.CI && - !['dumb', 'emacs-color'].includes(process.env.TERM) && - 'spinner') || 'simple'; -/* eslint-disable node/no-missing-require */ -const Action = actionType === 'spinner' ? __webpack_require__(60062).default : __webpack_require__(96419)/* .default */ .Z; -const PrideAction = actionType === 'spinner' ? __webpack_require__(91525)/* .default */ .Z : __webpack_require__(96419)/* .default */ .Z; -/* eslint-enable node/no-missing-require */ -class Config { - constructor() { - this.outputLevel = 'info'; - this.action = new Action(); - this.prideAction = new PrideAction(); - this.errorsHandled = false; - this.showStackTrace = true; - } - get debug() { - return globals.debug || process.env.DEBUG === '*'; - } - set debug(v) { - globals.debug = v; - } - get context() { - return globals.context || {}; - } - set context(v) { - globals.context = v; - } -} -exports.Config = Config; -function fetch() { - if (globals[version.major]) - return globals[version.major]; - globals[version.major] = new Config(); - return globals[version.major]; -} -exports.config = fetch(); -exports.default = exports.config; +convert.ansi256.rgb = function (args) { + // handle greyscale + if (args >= 232) { + var c = (args - 232) * 10 + 8; + return [c, c, c]; + } + args -= 16; -/***/ }), + var rem; + var r = Math.floor(args / 36) / 5 * 255; + var g = Math.floor((rem = args % 36) / 6) / 5 * 255; + var b = (rem % 6) / 5 * 255; -/***/ 74560: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + return [r, g, b]; +}; -"use strict"; +convert.rgb.hex = function (args) { + var integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); -Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable node/no-missing-require */ -exports.default = { - get stripAnsi() { - return __webpack_require__(45591); - }, - get ansiStyles() { - return __webpack_require__(76869); - }, - get ansiEscapes() { - return __webpack_require__(18512); - }, - get passwordPrompt() { - return __webpack_require__(71719); - }, - get screen() { - return __webpack_require__(6493); - }, - get open() { - return __webpack_require__(46099)/* .default */ .Z; - }, - get prompt() { - return __webpack_require__(46858); - }, - get styledObject() { - return __webpack_require__(20028)/* .default */ .Z; - }, - get styledHeader() { - return __webpack_require__(63272)/* .default */ .Z; - }, - get styledJSON() { - return __webpack_require__(7842)/* .default */ .Z; - }, - get table() { - return __webpack_require__(5402).table; - }, - get tree() { - return __webpack_require__(56673)/* .default */ .ZP; - }, - get wait() { - return __webpack_require__(59477)/* .default */ .Z; - }, - get progress() { - return __webpack_require__(57867)/* .default */ .Z; - }, + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; }; +convert.hex.rgb = function (args) { + var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } -/***/ }), + var colorString = match[0]; -/***/ 29089: -/***/ ((__unused_webpack_module, exports) => { + if (match[0].length === 3) { + colorString = colorString.split('').map(function (char) { + return char + char; + }).join(''); + } -"use strict"; + var integer = parseInt(colorString, 16); + var r = (integer >> 16) & 0xFF; + var g = (integer >> 8) & 0xFF; + var b = integer & 0xFF; -Object.defineProperty(exports, "__esModule", ({ value: true })); -class ExitError extends Error { - constructor(status, error) { - const code = 'EEXIT'; - super(error ? error.message : `${code}: ${status}`); - this.error = error; - this['cli-ux'] = { exit: status }; - this.code = code; - } -} -exports.ExitError = ExitError; + return [r, g, b]; +}; +convert.rgb.hcg = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var max = Math.max(Math.max(r, g), b); + var min = Math.min(Math.min(r, g), b); + var chroma = (max - min); + var grayscale; + var hue; -/***/ }), + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } -/***/ 81982: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma + 4; + } -"use strict"; + hue /= 6; + hue %= 1; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(22116); -const Errors = tslib_1.__importStar(__webpack_require__(52564)); -const util = tslib_1.__importStar(__webpack_require__(31669)); -const base_1 = __webpack_require__(52397); -exports.ActionBase = base_1.ActionBase; -const config_1 = __webpack_require__(25155); -exports.config = config_1.config; -exports.Config = config_1.Config; -const deps_1 = tslib_1.__importDefault(__webpack_require__(74560)); -const exit_1 = __webpack_require__(29089); -exports.ExitError = exit_1.ExitError; -const Table = tslib_1.__importStar(__webpack_require__(5402)); -exports.Table = Table; -exports.ux = { - config: config_1.config, - warn: Errors.warn, - error: Errors.error, - exit: Errors.exit, - get prompt() { - return deps_1.default.prompt.prompt; - }, - /** - * "press anykey to continue" - */ - get anykey() { - return deps_1.default.prompt.anykey; - }, - get confirm() { - return deps_1.default.prompt.confirm; - }, - get action() { - return config_1.config.action; - }, - get prideAction() { - return config_1.config.prideAction; - }, - styledObject(obj, keys) { - exports.ux.info(deps_1.default.styledObject(obj, keys)); - }, - get styledHeader() { - return deps_1.default.styledHeader; - }, - get styledJSON() { - return deps_1.default.styledJSON; - }, - get table() { - return deps_1.default.table; - }, - get tree() { - return deps_1.default.tree; - }, - get open() { - return deps_1.default.open; - }, - get wait() { - return deps_1.default.wait; - }, - get progress() { - return deps_1.default.progress; - }, - async done() { - config_1.config.action.stop(); - // await flushStdout() - }, - trace(format, ...args) { - if (this.config.outputLevel === 'trace') { - process.stdout.write(util.format(format, ...args) + '\n'); - } - }, - debug(format, ...args) { - if (['trace', 'debug'].includes(this.config.outputLevel)) { - process.stdout.write(util.format(format, ...args) + '\n'); - } - }, - info(format, ...args) { - process.stdout.write(util.format(format, ...args) + '\n'); - }, - log(format, ...args) { - this.info(format || '', ...args); - }, - url(text, uri, params = {}) { - const supports = __webpack_require__(18824); - if (supports.stdout) { - const hyperlinker = __webpack_require__(59584); - this.log(hyperlinker(text, uri, params)); - } - else { - this.log(uri); - } - }, - annotation(text, annotation) { - const supports = __webpack_require__(18824); - if (supports.stdout) { - // \u001b]8;;https://google.com\u0007sometext\u001b]8;;\u0007 - this.log(`\u001B]1337;AddAnnotation=${text.length}|${annotation}\u0007${text}`); - } - else { - this.log(text); - } - }, - async flush() { - function timeout(p, ms) { - function wait(ms, unref = false) { - return new Promise(resolve => { - const t = setTimeout(() => resolve(), ms); - if (unref) - t.unref(); - }); - } - return Promise.race([p, wait(ms, true).then(() => exports.ux.error('timed out'))]); - } - async function flush() { - const p = new Promise(resolve => process.stdout.once('drain', () => resolve())); - process.stdout.write(''); - return p; - } - await timeout(flush(), 10000); - }, -}; -exports.default = exports.ux; -exports.cli = exports.ux; -const cliuxProcessExitHandler = async () => { - try { - await exports.ux.done(); - } - catch (error) { - // tslint:disable no-console - console.error(error); - process.exitCode = 1; - } + return [hue * 360, chroma * 100, grayscale * 100]; }; -// to avoid MaxListenersExceededWarning -// only attach named listener once -const cliuxListener = process.listeners('exit').find(fn => fn.name === cliuxProcessExitHandler.name); -if (!cliuxListener) { - process.once('exit', cliuxProcessExitHandler); -} +convert.hsl.hcg = function (hsl) { + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var c = 1; + var f = 0; -/***/ }), - -/***/ 46099: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + if (l < 0.5) { + c = 2.0 * s * l; + } else { + c = 2.0 * s * (1.0 - l); + } -"use strict"; -var __webpack_unused_export__; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } -__webpack_unused_export__ = ({ value: true }); -const tslib_1 = __webpack_require__(22116); -// this code is largely taken from opn -const childProcess = tslib_1.__importStar(__webpack_require__(63129)); -const isWsl = __webpack_require__(52559); -function open(target, opts = {}) { - // opts = {wait: true, ...opts} - let cmd; - let appArgs = []; - let args = []; - const cpOpts = {}; - if (Array.isArray(opts.app)) { - appArgs = opts.app.slice(1); - opts.app = opts.app[0]; - } - if (process.platform === 'darwin') { - cmd = 'open'; - // if (opts.wait) { - // args.push('-W') - // } - if (opts.app) { - args.push('-a', opts.app); - } - } - else if (process.platform === 'win32' || isWsl) { - cmd = 'cmd' + (isWsl ? '.exe' : ''); - args.push('/c', 'start', '""', '/b'); - target = target.replace(/&/g, '^&'); - // if (opts.wait) { - // args.push('/wait') - // } - if (opts.app) { - args.push(opts.app); - } - if (appArgs.length > 0) { - args = args.concat(appArgs); - } - } - else { - if (opts.app) { - cmd = opts.app; - } - else { - // try local xdg-open - cmd = 'xdg-open'; - } - if (appArgs.length > 0) { - args = args.concat(appArgs); - } - // if (!opts.wait) { - // `xdg-open` will block the process unless - // stdio is ignored and it's detached from the parent - // even if it's unref'd - cpOpts.stdio = 'ignore'; - cpOpts.detached = true; - // } - } - args.push(target); - if (process.platform === 'darwin' && appArgs.length > 0) { - args.push('--args'); - args = args.concat(appArgs); - } - const cp = childProcess.spawn(cmd, args, cpOpts); - return new Promise((resolve, reject) => { - cp.once('error', reject); - cp.once('close', code => { - if (code > 0) { - reject(new Error('Exited with code ' + code)); - return; - } - resolve(cp); - }); - }); -} -exports.Z = open; + return [hsl[0], c * 100, f * 100]; +}; +convert.hsv.hcg = function (hsv) { + var s = hsv[1] / 100; + var v = hsv[2] / 100; -/***/ }), + var c = s * v; + var f = 0; -/***/ 46858: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + if (c < 1.0) { + f = (v - c) / (1 - c); + } -"use strict"; + return [hsv[0], c * 100, f * 100]; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(22116); -const errors_1 = __webpack_require__(52564); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -const config_1 = tslib_1.__importDefault(__webpack_require__(25155)); -const deps_1 = tslib_1.__importDefault(__webpack_require__(74560)); -function normal(options, retries = 100) { - if (retries < 0) - throw new Error('no input'); - return new Promise((resolve, reject) => { - let timer; - if (options.timeout) { - timer = setTimeout(() => { - process.stdin.pause(); - reject(new Error('Prompt timeout')); - }, options.timeout); - timer.unref(); - } - process.stdin.setEncoding('utf8'); - process.stderr.write(options.prompt); - process.stdin.resume(); - process.stdin.once('data', data => { - if (timer) - clearTimeout(timer); - process.stdin.pause(); - data = data.trim(); - if (!options.default && options.required && data === '') { - resolve(normal(options, retries - 1)); - } - else { - resolve(data || options.default); - } - }); - }); -} -function getPrompt(name, type, defaultValue) { - let prompt = '> '; - if (defaultValue && type === 'hide') { - defaultValue = '*'.repeat(defaultValue.length); - } - if (name && defaultValue) - prompt = name + ' ' + chalk_1.default.yellow('[' + defaultValue + ']') + ': '; - else if (name) - prompt = `${name}: `; - return prompt; -} -async function single(options) { - var _a; - const raw = process.stdin.isRaw; - if (process.stdin.setRawMode) - process.stdin.setRawMode(true); - options.required = (_a = options.required) !== null && _a !== void 0 ? _a : false; - const response = await normal(options); - if (process.stdin.setRawMode) - process.stdin.setRawMode(Boolean(raw)); - return response; -} -function replacePrompt(prompt) { - process.stderr.write(deps_1.default.ansiEscapes.cursorHide + deps_1.default.ansiEscapes.cursorUp(1) + deps_1.default.ansiEscapes.cursorLeft + prompt + - deps_1.default.ansiEscapes.cursorDown(1) + deps_1.default.ansiEscapes.cursorLeft + deps_1.default.ansiEscapes.cursorShow); -} -function _prompt(name, inputOptions = {}) { - const prompt = getPrompt(name, inputOptions.type, inputOptions.default); - const options = Object.assign({ isTTY: Boolean(process.env.TERM !== 'dumb' && process.stdin.isTTY), name, - prompt, type: 'normal', required: true, default: '' }, inputOptions); - switch (options.type) { - case 'normal': - return normal(options); - case 'single': - return single(options); - case 'mask': - return deps_1.default.passwordPrompt(options.prompt, { - method: options.type, - required: options.required, - default: options.default, - }).then((value) => { - replacePrompt(getPrompt(name, 'hide', inputOptions.default)); - return value; - }); - case 'hide': - return deps_1.default.passwordPrompt(options.prompt, { - method: options.type, - required: options.required, - default: options.default, - }); - default: - throw new Error(`unexpected type ${options.type}`); - } -} -/** - * prompt for input - */ -function prompt(name, options = {}) { - return config_1.default.action.pauseAsync(() => { - return _prompt(name, options); - }, chalk_1.default.cyan('?')); -} -exports.prompt = prompt; -/** - * confirmation prompt (yes/no) - */ -function confirm(message) { - return config_1.default.action.pauseAsync(async () => { - const confirm = async () => { - const response = (await _prompt(message)).toLowerCase(); - if (['n', 'no'].includes(response)) - return false; - if (['y', 'yes'].includes(response)) - return true; - return confirm(); - }; - return confirm(); - }, chalk_1.default.cyan('?')); -} -exports.confirm = confirm; -/** - * "press anykey to continue" - */ -async function anykey(message) { - const tty = Boolean(process.stdin.setRawMode); - if (!message) { - message = tty ? - `Press any key to continue or ${chalk_1.default.yellow('q')} to exit` : - `Press enter to continue or ${chalk_1.default.yellow('q')} to exit`; - } - const char = await prompt(message, { type: 'single', required: false }); - if (tty) - process.stderr.write('\n'); - if (char === 'q') - errors_1.error('quit'); - if (char === '\u0003') - errors_1.error('ctrl-c'); - return char; -} -exports.anykey = anykey; +convert.hcg.rgb = function (hcg) { + var h = hcg[0] / 360; + var c = hcg[1] / 100; + var g = hcg[2] / 100; + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } -/***/ }), + var pure = [0, 0, 0]; + var hi = (h % 1) * 6; + var v = hi % 1; + var w = 1 - v; + var mg = 0; -/***/ 63272: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } -"use strict"; -var __webpack_unused_export__; + mg = (1.0 - c) * g; -// tslint:disable restrict-plus-operands -__webpack_unused_export__ = ({ value: true }); -const tslib_1 = __webpack_require__(22116); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -function styledHeader(header) { - process.stdout.write(chalk_1.default.dim('=== ') + chalk_1.default.bold(header) + '\n'); -} -exports.Z = styledHeader; + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; +convert.hcg.hsv = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; -/***/ }), + var v = c + g * (1.0 - c); + var f = 0; -/***/ 7842: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + if (v > 0.0) { + f = c / v; + } -"use strict"; -var __webpack_unused_export__; + return [hcg[0], f * 100, v * 100]; +}; -// tslint:disable restrict-plus-operands -__webpack_unused_export__ = ({ value: true }); -const tslib_1 = __webpack_require__(22116); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -const __1 = tslib_1.__importDefault(__webpack_require__(81982)); -function styledJSON(obj) { - const json = JSON.stringify(obj, null, 2); - if (!chalk_1.default.level) { - __1.default.info(json); - return; - } - const cardinal = __webpack_require__(76021); - const theme = __webpack_require__(14054); - __1.default.info(cardinal.highlight(json, { json: true, theme })); -} -exports.Z = styledJSON; +convert.hcg.hsl = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var l = g * (1.0 - c) + 0.5 * c; + var s = 0; -/***/ }), + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } -/***/ 20028: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -var __webpack_unused_export__; + return [hcg[0], s * 100, l * 100]; +}; -// tslint:disable -__webpack_unused_export__ = ({ value: true }); -const tslib_1 = __webpack_require__(22116); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -const util = tslib_1.__importStar(__webpack_require__(31669)); -function styledObject(obj, keys) { - const output = []; - const keyLengths = Object.keys(obj).map(key => key.toString().length); - const maxKeyLength = Math.max(...keyLengths) + 2; - function pp(obj) { - if (typeof obj === 'string' || typeof obj === 'number') - return obj; - if (typeof obj === 'object') { - return Object.keys(obj) - .map(k => k + ': ' + util.inspect(obj[k])) - .join(', '); - } - return util.inspect(obj); - } - const logKeyValue = (key, value) => { - return `${chalk_1.default.blue(key)}:` + ' '.repeat(maxKeyLength - key.length - 1) + pp(value); - }; - for (const key of keys || Object.keys(obj).sort()) { - const value = obj[key]; - if (Array.isArray(value)) { - if (value.length > 0) { - output.push(logKeyValue(key, value[0])); - for (const e of value.slice(1)) { - output.push(' '.repeat(maxKeyLength) + pp(e)); - } - } - } - else if (value !== null && value !== undefined) { - output.push(logKeyValue(key, value)); - } - } - return output.join('\n'); -} -exports.Z = styledObject; +convert.hcg.hwb = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; +convert.hwb.hcg = function (hwb) { + var w = hwb[1] / 100; + var b = hwb[2] / 100; + var v = 1 - b; + var c = v - w; + var g = 0; -/***/ }), + if (c < 1) { + g = (v - c) / (1 - c); + } -/***/ 57867: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + return [hwb[0], c * 100, g * 100]; +}; -"use strict"; -var __webpack_unused_export__; +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; -__webpack_unused_export__ = ({ value: true }); -// 3pp -const cliProgress = __webpack_require__(17348); -function progress(options) { - // if no options passed, create empty options - if (!options) { - options = {}; - } - // set noTTYOutput for options - options.noTTYOutput = Boolean(process.env.TERM === 'dumb' || !process.stdin.isTTY); - return new cliProgress.SingleBar(options); -} -exports.Z = progress; +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; -/***/ }), +convert.gray.hsl = convert.gray.hsv = function (args) { + return [0, 0, args[0]]; +}; -/***/ 5402: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; -"use strict"; +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __webpack_require__(22116); -const command_1 = __webpack_require__(82708); -const screen_1 = __webpack_require__(6493); -const chalk_1 = tslib_1.__importDefault(__webpack_require__(91152)); -const capitalize_1 = tslib_1.__importDefault(__webpack_require__(33622)); -const sumBy_1 = tslib_1.__importDefault(__webpack_require__(93702)); -const js_yaml_1 = __webpack_require__(21917); -const util_1 = __webpack_require__(31669); -const sw = __webpack_require__(42577); -const { orderBy } = __webpack_require__(56445); -class Table { - constructor(data, columns, options = {}) { - this.data = data; - // assign columns - this.columns = Object.keys(columns).map((key) => { - const col = columns[key]; - const extended = col.extended || false; - const get = col.get || ((row) => row[key]); - const header = typeof col.header === 'string' ? col.header : capitalize_1.default(key.replace(/_/g, ' ')); - const minWidth = Math.max(col.minWidth || 0, sw(header) + 1); - return { - extended, - get, - header, - key, - minWidth, - }; - }); - // assign options - const { columns: cols, filter, csv, output, extended, sort, printLine } = options; - this.options = { - columns: cols, - output: csv ? 'csv' : output, - extended, - filter, - 'no-header': options['no-header'] || false, - 'no-truncate': options['no-truncate'] || false, - printLine: printLine || ((s) => process.stdout.write(s + '\n')), - sort, - }; - } - display() { - // build table rows from input array data - let rows = this.data.map(d => { - const row = {}; - for (const col of this.columns) { - let val = col.get(d); - if (typeof val !== 'string') - val = util_1.inspect(val, { breakLength: Infinity }); - row[col.key] = val; - } - return row; - }); - // filter rows - if (this.options.filter) { - /* eslint-disable-next-line prefer-const */ - let [header, regex] = this.options.filter.split('='); - const isNot = header[0] === '-'; - if (isNot) - header = header.substr(1); - const col = this.findColumnFromHeader(header); - if (!col || !regex) - throw new Error('Filter flag has an invalid value'); - rows = rows.filter((d) => { - const re = new RegExp(regex); - const val = d[col.key]; - const match = val.match(re); - return isNot ? !match : match; - }); - } - // sort rows - if (this.options.sort) { - const sorters = this.options.sort.split(','); - const sortHeaders = sorters.map(k => k[0] === '-' ? k.substr(1) : k); - const sortKeys = this.filterColumnsFromHeaders(sortHeaders).map(c => { - return ((v) => v[c.key]); - }); - const sortKeysOrder = sorters.map(k => k[0] === '-' ? 'desc' : 'asc'); - rows = orderBy(rows, sortKeys, sortKeysOrder); - } - // and filter columns - if (this.options.columns) { - const filters = this.options.columns.split(','); - this.columns = this.filterColumnsFromHeaders(filters); - } - else if (!this.options.extended) { - // show extented columns/properties - this.columns = this.columns.filter(c => !c.extended); - } - this.data = rows; - switch (this.options.output) { - case 'csv': - this.outputCSV(); - break; - case 'json': - this.outputJSON(); - break; - case 'yaml': - this.outputYAML(); - break; - default: - this.outputTable(); - } - } - findColumnFromHeader(header) { - return this.columns.find(c => c.header.toLowerCase() === header.toLowerCase()); - } - filterColumnsFromHeaders(filters) { - // unique - filters = [...(new Set(filters))]; - const cols = []; - filters.forEach(f => { - const c = this.columns.find(c => c.header.toLowerCase() === f.toLowerCase()); - if (c) - cols.push(c); - }); - return cols; - } - getCSVRow(d) { - const values = this.columns.map(col => d[col.key] || ''); - const needToBeEscapedForCsv = (e) => { - // CSV entries containing line breaks, comma or double quotes - // as specified in https://tools.ietf.org/html/rfc4180#section-2 - return e.includes('"') || e.includes('\n') || e.includes('\r\n') || e.includes('\r') || e.includes(','); - }; - const lineToBeEscaped = values.find(needToBeEscapedForCsv); - return values.map(e => lineToBeEscaped ? `"${e.replace('"', '""')}"` : e); - } - resolveColumnsToObjectArray() { - // tslint:disable-next-line:no-this-assignment - const { data, columns } = this; - return data.map((d) => { - return columns.reduce((obj, col) => { - return Object.assign(Object.assign({}, obj), { [col.key]: d[col.key] || '' }); - }, {}); - }); - } - outputJSON() { - this.options.printLine(JSON.stringify(this.resolveColumnsToObjectArray(), undefined, 2)); - } - outputYAML() { - this.options.printLine(js_yaml_1.safeDump(this.resolveColumnsToObjectArray())); - } - outputCSV() { - // tslint:disable-next-line:no-this-assignment - const { data, columns, options } = this; - if (!options['no-header']) { - options.printLine(columns.map(c => c.header).join(',')); - } - data.forEach((d) => { - const row = this.getCSVRow(d); - options.printLine(row.join(',')); - }); - } - outputTable() { - // tslint:disable-next-line:no-this-assignment - const { data, columns, options } = this; - // column truncation - // - // find max width for each column - for (const col of columns) { - // convert multi-line cell to single longest line - // for width calculations - const widthData = data.map((row) => { - const d = row[col.key]; - const manyLines = d.split('\n'); - if (manyLines.length > 1) { - return '*'.repeat(Math.max(...manyLines.map((r) => sw(r)))); - } - return d; - }); - const widths = ['.'.padEnd(col.minWidth - 1), col.header, ...widthData.map((row) => row)].map(r => sw(r)); - col.maxWidth = Math.max(...widths) + 1; - col.width = col.maxWidth; - } - // terminal width - const maxWidth = screen_1.stdtermwidth; - // truncation logic - const shouldShorten = () => { - // don't shorten if full mode - if (options['no-truncate'] || (!process.stdout.isTTY && !process.env.CLI_UX_SKIP_TTY_CHECK)) - return; - // don't shorten if there is enough screen width - const dataMaxWidth = sumBy_1.default(columns, c => c.width); - const overWidth = dataMaxWidth - maxWidth; - if (overWidth <= 0) - return; - // not enough room, short all columns to minWidth - for (const col of columns) { - col.width = col.minWidth; - } - // if sum(minWidth's) is greater than term width - // nothing can be done so - // display all as minWidth - const dataMinWidth = sumBy_1.default(columns, c => c.minWidth); - if (dataMinWidth >= maxWidth) - return; - // some wiggle room left, add it back to "needy" columns - let wiggleRoom = maxWidth - dataMinWidth; - const needyCols = columns.map(c => ({ key: c.key, needs: c.maxWidth - c.width })).sort((a, b) => a.needs - b.needs); - for (const { key, needs } of needyCols) { - if (!needs) - continue; - const col = columns.find(c => key === c.key); - if (!col) - continue; - if (wiggleRoom > needs) { - col.width = col.width + needs; - wiggleRoom -= needs; - } - else if (wiggleRoom) { - col.width = col.width + wiggleRoom; - wiggleRoom = 0; - } - } - }; - shouldShorten(); - // print headers - if (!options['no-header']) { - let headers = ''; - for (const col of columns) { - const header = col.header; - headers += header.padEnd(col.width); - } - options.printLine(chalk_1.default.bold(headers)); - } - // print rows - for (const row of data) { - // find max number of lines - // for all cells in a row - // with multi-line strings - let numOfLines = 1; - for (const col of columns) { - const d = row[col.key]; - const lines = d.split('\n').length; - if (lines > numOfLines) - numOfLines = lines; - } - const linesIndexess = [...new Array(numOfLines).keys()]; - // print row - // including multi-lines - linesIndexess.forEach((i) => { - let l = ''; - for (const col of columns) { - const width = col.width; - let d = row[col.key]; - d = d.split('\n')[i] || ''; - const visualWidth = sw(d); - const colorWidth = (d.length - visualWidth); - let cell = d.padEnd(width + colorWidth); - if ((cell.length - colorWidth) > width || visualWidth === width) { - cell = cell.slice(0, width - 2) + '… '; - } - l += cell; - } - options.printLine(l); - }); - } - } -} -function table(data, columns, options = {}) { - new Table(data, columns, options).display(); -} -exports.table = table; -(function (table) { - table.Flags = { - columns: command_1.flags.string({ exclusive: ['extended'], description: 'only show provided columns (comma-separated)' }), - sort: command_1.flags.string({ description: 'property to sort by (prepend \'-\' for descending)' }), - filter: command_1.flags.string({ description: 'filter property by partial string matching, ex: name=foo' }), - csv: command_1.flags.boolean({ exclusive: ['no-truncate'], description: 'output is csv format [alias: --output=csv]' }), - output: command_1.flags.string({ - exclusive: ['no-truncate', 'csv'], - description: 'output in a more machine friendly format', - options: ['csv', 'json', 'yaml'], - }), - extended: command_1.flags.boolean({ exclusive: ['columns'], char: 'x', description: 'show extra columns' }), - 'no-truncate': command_1.flags.boolean({ exclusive: ['csv'], description: 'do not truncate output to fit screen' }), - 'no-header': command_1.flags.boolean({ exclusive: ['csv'], description: 'hide table header from output' }), - }; - // eslint-disable-next-line no-inner-declarations - function flags(opts) { - if (opts) { - const f = {}; - const o = (opts.only && typeof opts.only === 'string' ? [opts.only] : opts.only) || Object.keys(table.Flags); - const e = (opts.except && typeof opts.except === 'string' ? [opts.except] : opts.except) || []; - o.forEach((key) => { - if (e.includes(key)) - return; - f[key] = table.Flags[key]; - }); - return f; - } - return table.Flags; - } - table.flags = flags; -})(table = exports.table || (exports.table = {})); +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; +convert.gray.hex = function (gray) { + var val = Math.round(gray[0] / 100 * 255) & 0xFF; + var integer = (val << 16) + (val << 8) + val; -/***/ }), + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; -/***/ 56673: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +convert.rgb.gray = function (rgb) { + var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; -"use strict"; -var __webpack_unused_export__; -__webpack_unused_export__ = ({ value: true }); -const treeify = __webpack_require__(87817); -class Tree { - constructor() { - this.nodes = {}; - } - insert(child, value = new Tree()) { - this.nodes[child] = value; - return this; - } - search(key) { - for (const child of Object.keys(this.nodes)) { - if (child === key) { - return this.nodes[child]; - } - const c = this.nodes[child].search(key); - if (c) - return c; - } - } - // tslint:disable-next-line:no-console - display(logger = console.log) { - const addNodes = function (nodes) { - const tree = {}; - for (const p of Object.keys(nodes)) { - tree[p] = addNodes(nodes[p].nodes); - } - return tree; - }; - const tree = addNodes(this.nodes); - logger(treeify(tree)); - } -} -__webpack_unused_export__ = Tree; -function tree() { - return new Tree(); -} -exports.ZP = tree; +/***/ }), +/***/ 86931: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/***/ }), +var conversions = __webpack_require__(97391); +var route = __webpack_require__(30880); -/***/ 59477: -/***/ ((__unused_webpack_module, exports) => { +var convert = {}; -"use strict"; -var __webpack_unused_export__; +var models = Object.keys(conversions); -__webpack_unused_export__ = ({ value: true }); -// tslint:disable no-string-based-set-timeout -exports.Z = (ms = 1000) => { - return new Promise(resolve => setTimeout(resolve, ms)); -}; +function wrapRaw(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } -/***/ }), + return fn(args); + }; -/***/ 76869: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } -"use strict"; -/* module decorator */ module = __webpack_require__.nmd(module); + return wrappedFn; +} +function wrapRounded(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } -const wrapAnsi16 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${code + offset}m`; -}; + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } -const wrapAnsi256 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${38 + offset};5;${code}m`; -}; + var result = fn(args); -const wrapAnsi16m = (fn, offset) => (...args) => { - const rgb = fn(...args); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; - -const ansi2ansi = n => n; -const rgb2rgb = (r, g, b) => [r, g, b]; - -const setLazyProperty = (object, property, get) => { - Object.defineProperty(object, property, { - get: () => { - const value = get(); - - Object.defineProperty(object, property, { - value, - enumerable: true, - configurable: true - }); - - return value; - }, - enumerable: true, - configurable: true - }); -}; - -/** @type {typeof import('color-convert')} */ -let colorConvert; -const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { - if (colorConvert === undefined) { - colorConvert = __webpack_require__(18461); - } - - const offset = isBackground ? 10 : 0; - const styles = {}; - - for (const [sourceSpace, suite] of Object.entries(colorConvert)) { - const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; - if (sourceSpace === targetSpace) { - styles[name] = wrap(identity, offset); - } else if (typeof suite === 'object') { - styles[name] = wrap(suite[targetSpace], offset); + // we're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (var len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } } - } - - return styles; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } + return result; }; - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; - - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - - group[styleName] = styles[styleName]; - - codes.set(style[0], style[1]); - } - - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; } - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); + return wrappedFn; +} - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; +models.forEach(function (fromModel) { + convert[fromModel] = {}; - setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); - setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - return styles; -} + var routes = route(fromModel); + var routeModels = Object.keys(routes); -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles + routeModels.forEach(function (toModel) { + var fn = routes[toModel]; + + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); }); +module.exports = convert; + /***/ }), -/***/ 91152: +/***/ 30880: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +var conversions = __webpack_require__(97391); -const ansiStyles = __webpack_require__(76869); -const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(91691); -const { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -} = __webpack_require__(44088); +/* + this function routes a model to all other models. -const {isArray} = Array; + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = [ - 'ansi', - 'ansi', - 'ansi256', - 'ansi16m' -]; + conversions that are not possible simply are not included. +*/ -const styles = Object.create(null); +function buildGraph() { + var graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + var models = Object.keys(conversions); -const applyOptions = (object, options = {}) => { - if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { - throw new Error('The `level` option should be an integer from 0 to 3'); + for (var len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; } - // Detect level if not set manually - const colorLevel = stdoutColor ? stdoutColor.level : 0; - object.level = options.level === undefined ? colorLevel : options.level; -}; - -class ChalkClass { - constructor(options) { - // eslint-disable-next-line no-constructor-return - return chalkFactory(options); - } + return graph; } -const chalkFactory = options => { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = () => { - throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); - }; +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + var graph = buildGraph(); + var queue = [fromModel]; // unshift -> queue -> pop - chalk.template.Instance = ChalkClass; + graph[fromModel].distance = 0; - return chalk.template; -}; + while (queue.length) { + var current = queue.pop(); + var adjacents = Object.keys(conversions[current]); -function Chalk(options) { - return chalkFactory(options); -} + for (var len = adjacents.length, i = 0; i < len; i++) { + var adjacent = adjacents[i]; + var node = graph[adjacent]; -for (const [styleName, style] of Object.entries(ansiStyles)) { - styles[styleName] = { - get() { - const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); - Object.defineProperty(this, styleName, {value: builder}); - return builder; + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } } - }; -} - -styles.visible = { - get() { - const builder = createBuilder(this, this._styler, true); - Object.defineProperty(this, 'visible', {value: builder}); - return builder; } -}; - -const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; -for (const model of usedModels) { - styles[model] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; + return graph; } -for (const model of usedModels) { - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } +function link(from, to) { + return function (args) { + return to(from(args)); }; } -const proto = Object.defineProperties(() => {}, { - ...styles, - level: { - enumerable: true, - get() { - return this._generator.level; - }, - set(level) { - this._generator.level = level; - } - } -}); - -const createStyler = (open, close, parent) => { - let openAll; - let closeAll; - if (parent === undefined) { - openAll = open; - closeAll = close; - } else { - openAll = parent.openAll + open; - closeAll = close + parent.closeAll; - } - - return { - open, - close, - openAll, - closeAll, - parent - }; -}; - -const createBuilder = (self, _styler, _isEmpty) => { - const builder = (...arguments_) => { - if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { - // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` - return applyStyle(builder, chalkTag(builder, ...arguments_)); - } - - // Single argument is hot path, implicit coercion is faster than anything - // eslint-disable-next-line no-implicit-coercion - return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); - }; - - // We alter the prototype because we must return a function, but there is - // no way to create a function with a different prototype - Object.setPrototypeOf(builder, proto); - - builder._generator = self; - builder._styler = _styler; - builder._isEmpty = _isEmpty; - - return builder; -}; +function wrapConversion(toModel, graph) { + var path = [graph[toModel].parent, toModel]; + var fn = conversions[graph[toModel].parent][toModel]; -const applyStyle = (self, string) => { - if (self.level <= 0 || !string) { - return self._isEmpty ? '' : string; + var cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; } - let styler = self._styler; + fn.conversion = path; + return fn; +} - if (styler === undefined) { - return string; - } +module.exports = function (fromModel) { + var graph = deriveBFS(fromModel); + var conversion = {}; - const {openAll, closeAll} = styler; - if (string.indexOf('\u001B') !== -1) { - while (styler !== undefined) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - string = stringReplaceAll(string, styler.close, styler.open); + var models = Object.keys(graph); + for (var len = models.length, i = 0; i < len; i++) { + var toModel = models[i]; + var node = graph[toModel]; - styler = styler.parent; + if (node.parent === null) { + // no possible conversion, or this node is the source model. + continue; } - } - - // We can move both next actions out of loop, because remaining actions in loop won't have - // any/visible effect on parts we add here. Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 - const lfIndex = string.indexOf('\n'); - if (lfIndex !== -1) { - string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); - } - - return openAll + string + closeAll; -}; - -let template; -const chalkTag = (chalk, ...strings) => { - const [firstString] = strings; - - if (!isArray(firstString) || !isArray(firstString.raw)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return strings.join(' '); - } - - const arguments_ = strings.slice(1); - const parts = [firstString.raw[0]]; - - for (let i = 1; i < firstString.length; i++) { - parts.push( - String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), - String(firstString.raw[i]) - ); - } - if (template === undefined) { - template = __webpack_require__(18590); + conversion[toModel] = wrapConversion(toModel, graph); } - return template(chalk, parts.join('')); + return conversion; }; -Object.defineProperties(Chalk.prototype, styles); - -const chalk = Chalk(); // eslint-disable-line new-cap -chalk.supportsColor = stdoutColor; -chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap -chalk.stderr.supportsColor = stderrColor; - -module.exports = chalk; /***/ }), -/***/ 18590: +/***/ 78510: /***/ ((module) => { "use strict"; + + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; -const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; - -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); - -function unescape(c) { - const u = c[0] === 'u'; - const bracket = c[1] === '{'; - - if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); - } - - if (u && bracket) { - return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); - } - - return ESCAPES.get(c) || c; -} - -function parseArguments(name, arguments_) { - const results = []; - const chunks = arguments_.trim().split(/\s*,\s*/g); - let matches; - - for (const chunk of chunks) { - const number = Number(chunk); - if (!Number.isNaN(number)) { - results.push(number); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); - } - } - - return results; -} - -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; - - const results = []; - let matches; - - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; - - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); - } - } - - return results; -} - -function buildStyle(chalk, styles) { - const enabled = {}; - - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); - } - } - - let current = chalk; - for (const [styleName, styles] of Object.entries(enabled)) { - if (!Array.isArray(styles)) { - continue; - } - - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } - current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; - } +/***/ }), - return current; -} +/***/ 43595: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (chalk, temporary) => { - const styles = []; - const chunks = []; - let chunk = []; +/* - // eslint-disable-next-line max-params - temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { - if (escapeCharacter) { - chunk.push(unescape(escapeCharacter)); - } else if (style) { - const string = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } +The MIT License (MIT) - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(character); - } - }); +Original Library + - Copyright (c) Marak Squires - chunks.push(chunk.join('')); +Additional functionality + - Copyright (c) Sindre Sorhus (sindresorhus.com) - if (styles.length > 0) { - const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMessage); - } +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - return chunks.join(''); -}; +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. -/***/ }), +*/ -/***/ 44088: -/***/ ((module) => { +var colors = {}; +module['exports'] = colors; -"use strict"; +colors.themes = {}; +var util = __webpack_require__(31669); +var ansiStyles = colors.styles = __webpack_require__(73104); +var defineProps = Object.defineProperties; +var newLineRegex = new RegExp(/[\r\n]+/g); -const stringReplaceAll = (string, substring, replacer) => { - let index = string.indexOf(substring); - if (index === -1) { - return string; - } +colors.supportsColor = __webpack_require__(10662).supportsColor; - const substringLength = substring.length; - let endIndex = 0; - let returnValue = ''; - do { - returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; - endIndex = index + substringLength; - index = string.indexOf(substring, endIndex); - } while (index !== -1); +if (typeof colors.enabled === 'undefined') { + colors.enabled = colors.supportsColor() !== false; +} - returnValue += string.substr(endIndex); - return returnValue; +colors.enable = function() { + colors.enabled = true; }; -const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { - let endIndex = 0; - let returnValue = ''; - do { - const gotCR = string[index - 1] === '\r'; - returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; - endIndex = index + 1; - index = string.indexOf('\n', endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; +colors.disable = function() { + colors.enabled = false; }; -module.exports = { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex +colors.stripColors = colors.strip = function(str) { + return ('' + str).replace(/\x1B\[\d+m/g, ''); }; +// eslint-disable-next-line no-unused-vars +var stylize = colors.stylize = function stylize(str, style) { + if (!colors.enabled) { + return str+''; + } -/***/ }), + var styleMap = ansiStyles[style]; -/***/ 87379: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // Stylize should work for non-ANSI styles, too + if(!styleMap && style in colors){ + // Style maps like trap operate as functions on strings; + // they don't have properties like open or close. + return colors[style](str); + } -/* MIT license */ -/* eslint-disable no-mixed-operators */ -const cssKeywords = __webpack_require__(79903); + return styleMap.open + str + styleMap.close; +}; -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). -// do not use box values types (i.e. Number(), String(), etc.) +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +var escapeStringRegexp = function(str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + return str.replace(matchOperatorsRe, '\\$&'); +}; -const reverseKeywords = {}; -for (const key of Object.keys(cssKeywords)) { - reverseKeywords[cssKeywords[key]] = key; +function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + builder.__proto__ = proto; + return builder; } -const convert = { - rgb: {channels: 3, labels: 'rgb'}, - hsl: {channels: 3, labels: 'hsl'}, - hsv: {channels: 3, labels: 'hsv'}, - hwb: {channels: 3, labels: 'hwb'}, - cmyk: {channels: 4, labels: 'cmyk'}, - xyz: {channels: 3, labels: 'xyz'}, - lab: {channels: 3, labels: 'lab'}, - lch: {channels: 3, labels: 'lch'}, - hex: {channels: 1, labels: ['hex']}, - keyword: {channels: 1, labels: ['keyword']}, - ansi16: {channels: 1, labels: ['ansi16']}, - ansi256: {channels: 1, labels: ['ansi256']}, - hcg: {channels: 3, labels: ['h', 'c', 'g']}, - apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, - gray: {channels: 1, labels: ['gray']} -}; - -module.exports = convert; +var styles = (function() { + var ret = {}; + ansiStyles.grey = ansiStyles.gray; + Object.keys(ansiStyles).forEach(function(key) { + ansiStyles[key].closeRe = + new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + ret[key] = { + get: function() { + return build(this._styles.concat(key)); + }, + }; + }); + return ret; +})(); -// Hide .channels and .labels properties -for (const model of Object.keys(convert)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } +var proto = defineProps(function colors() {}, styles); - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } +function applyStyle() { + var args = Array.prototype.slice.call(arguments); - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } + var str = args.map(function(arg) { + // Use weak equality check so we can colorize null/undefined in safe mode + if (arg != null && arg.constructor === String) { + return arg; + } else { + return util.inspect(arg); + } + }).join(' '); - const {channels, labels} = convert[model]; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); -} + if (!colors.enabled || !str) { + return str; + } -convert.rgb.hsl = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const min = Math.min(r, g, b); - const max = Math.max(r, g, b); - const delta = max - min; - let h; - let s; + var newLinesPresent = str.indexOf('\n') != -1; - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } + var nestedStyles = this._styles; - h = Math.min(h * 60, 360); + var i = nestedStyles.length; + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + str = code.open + str.replace(code.closeRe, code.open) + code.close; + if (newLinesPresent) { + str = str.replace(newLineRegex, function(match) { + return code.close + match + code.open; + }); + } + } - if (h < 0) { - h += 360; - } + return str; +} - const l = (min + max) / 2; +colors.setTheme = function(theme) { + if (typeof theme === 'string') { + console.log('colors.setTheme now only accepts an object, not a string. ' + + 'If you are trying to set a theme from a file, it is now your (the ' + + 'caller\'s) responsibility to require the file. The old syntax ' + + 'looked like colors.setTheme(__dirname + ' + + '\'/../themes/generic-logging.js\'); The new syntax looks like '+ + 'colors.setTheme(require(__dirname + ' + + '\'/../themes/generic-logging.js\'));'); + return; + } + for (var style in theme) { + (function(style) { + colors[style] = function(str) { + if (typeof theme[style] === 'object') { + var out = str; + for (var i in theme[style]) { + out = colors[theme[style][i]](out); + } + return out; + } + return colors[theme[style]](str); + }; + })(style); + } +}; - if (max === min) { - s = 0; - } else if (l <= 0.5) { - s = delta / (max + min); - } else { - s = delta / (2 - max - min); - } +function init() { + var ret = {}; + Object.keys(styles).forEach(function(name) { + ret[name] = { + get: function() { + return build([name]); + }, + }; + }); + return ret; +} - return [h, s * 100, l * 100]; +var sequencer = function sequencer(map, str) { + var exploded = str.split(''); + exploded = exploded.map(map); + return exploded.join(''); }; -convert.rgb.hsv = function (rgb) { - let rdif; - let gdif; - let bdif; - let h; - let s; +// custom formatter methods +colors.trap = __webpack_require__(31302); +colors.zalgo = __webpack_require__(97743); - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const v = Math.max(r, g, b); - const diff = v - Math.min(r, g, b); - const diffc = function (c) { - return (v - c) / 6 / diff + 1 / 2; - }; +// maps +colors.maps = {}; +colors.maps.america = __webpack_require__(76936)(colors); +colors.maps.zebra = __webpack_require__(12989)(colors); +colors.maps.rainbow = __webpack_require__(75210)(colors); +colors.maps.random = __webpack_require__(13441)(colors); - if (diff === 0) { - h = 0; - s = 0; - } else { - s = diff / v; - rdif = diffc(r); - gdif = diffc(g); - bdif = diffc(b); +for (var map in colors.maps) { + (function(map) { + colors[map] = function(str) { + return sequencer(colors.maps[map], str); + }; + })(map); +} - if (r === v) { - h = bdif - gdif; - } else if (g === v) { - h = (1 / 3) + rdif - bdif; - } else if (b === v) { - h = (2 / 3) + gdif - rdif; - } +defineProps(colors, init()); - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - } - return [ - h * 360, - s * 100, - v * 100 - ]; +/***/ }), + +/***/ 31302: +/***/ ((module) => { + +module['exports'] = function runTheTrap(text, options) { + var result = ''; + text = text || 'Run the trap, drop the bass'; + text = text.split(''); + var trap = { + a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], + b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], + c: ['\u00a9', '\u023b', '\u03fe'], + d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], + e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', + '\u0a6c'], + f: ['\u04fa'], + g: ['\u0262'], + h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], + i: ['\u0f0f'], + j: ['\u0134'], + k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], + l: ['\u0139'], + m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], + n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], + o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', + '\u06dd', '\u0e4f'], + p: ['\u01f7', '\u048e'], + q: ['\u09cd'], + r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], + s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], + t: ['\u0141', '\u0166', '\u0373'], + u: ['\u01b1', '\u054d'], + v: ['\u05d8'], + w: ['\u0428', '\u0460', '\u047c', '\u0d70'], + x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], + y: ['\u00a5', '\u04b0', '\u04cb'], + z: ['\u01b5', '\u0240'], + }; + text.forEach(function(c) { + c = c.toLowerCase(); + var chars = trap[c] || [' ']; + var rand = Math.floor(Math.random() * chars.length); + if (typeof trap[c] !== 'undefined') { + result += trap[c][rand]; + } else { + result += c; + } + }); + return result; }; -convert.rgb.hwb = function (rgb) { - const r = rgb[0]; - const g = rgb[1]; - let b = rgb[2]; - const h = convert.rgb.hsl(rgb)[0]; - const w = 1 / 255 * Math.min(r, Math.min(g, b)); - b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); +/***/ }), - return [h, w * 100, b * 100]; -}; +/***/ 97743: +/***/ ((module) => { -convert.rgb.cmyk = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; +// please no +module['exports'] = function zalgo(text, options) { + text = text || ' he is here '; + var soul = { + 'up': [ + '̍', '̎', '̄', '̅', + '̿', '̑', '̆', '̐', + '͒', '͗', '͑', '̇', + '̈', '̊', '͂', '̓', + '̈', '͊', '͋', '͌', + '̃', '̂', '̌', '͐', + '̀', '́', '̋', '̏', + '̒', '̓', '̔', '̽', + '̉', 'ͣ', 'ͤ', 'ͥ', + 'ͦ', 'ͧ', 'ͨ', 'ͩ', + 'ͪ', 'ͫ', 'ͬ', 'ͭ', + 'ͮ', 'ͯ', '̾', '͛', + '͆', '̚', + ], + 'down': [ + '̖', '̗', '̘', '̙', + '̜', '̝', '̞', '̟', + '̠', '̤', '̥', '̦', + '̩', '̪', '̫', '̬', + '̭', '̮', '̯', '̰', + '̱', '̲', '̳', '̹', + '̺', '̻', '̼', 'ͅ', + '͇', '͈', '͉', '͍', + '͎', '͓', '͔', '͕', + '͖', '͙', '͚', '̣', + ], + 'mid': [ + '̕', '̛', '̀', '́', + '͘', '̡', '̢', '̧', + '̨', '̴', '̵', '̶', + '͜', '͝', '͞', + '͟', '͠', '͢', '̸', + '̷', '͡', ' ҉', + ], + }; + var all = [].concat(soul.up, soul.down, soul.mid); - const k = Math.min(1 - r, 1 - g, 1 - b); - const c = (1 - r - k) / (1 - k) || 0; - const m = (1 - g - k) / (1 - k) || 0; - const y = (1 - b - k) / (1 - k) || 0; + function randomNumber(range) { + var r = Math.floor(Math.random() * range); + return r; + } - return [c * 100, m * 100, y * 100, k * 100]; + function isChar(character) { + var bool = false; + all.filter(function(i) { + bool = (i === character); + }); + return bool; + } + + + function heComes(text, options) { + var result = ''; + var counts; + var l; + options = options || {}; + options['up'] = + typeof options['up'] !== 'undefined' ? options['up'] : true; + options['mid'] = + typeof options['mid'] !== 'undefined' ? options['mid'] : true; + options['down'] = + typeof options['down'] !== 'undefined' ? options['down'] : true; + options['size'] = + typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; + text = text.split(''); + for (l in text) { + if (isChar(l)) { + continue; + } + result = result + text[l]; + counts = {'up': 0, 'down': 0, 'mid': 0}; + switch (options.size) { + case 'mini': + counts.up = randomNumber(8); + counts.mid = randomNumber(2); + counts.down = randomNumber(8); + break; + case 'maxi': + counts.up = randomNumber(16) + 3; + counts.mid = randomNumber(4) + 1; + counts.down = randomNumber(64) + 3; + break; + default: + counts.up = randomNumber(8) + 1; + counts.mid = randomNumber(6) / 2; + counts.down = randomNumber(8) + 1; + break; + } + + var arr = ['up', 'mid', 'down']; + for (var d in arr) { + var index = arr[d]; + for (var i = 0; i <= counts[index]; i++) { + if (options[index]) { + result = result + soul[index][randomNumber(soul[index].length)]; + } + } + } + } + return result; + } + // don't summon him + return heComes(text, options); }; -function comparativeDistance(x, y) { - /* - See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - */ - return ( - ((x[0] - y[0]) ** 2) + - ((x[1] - y[1]) ** 2) + - ((x[2] - y[2]) ** 2) - ); -} -convert.rgb.keyword = function (rgb) { - const reversed = reverseKeywords[rgb]; - if (reversed) { - return reversed; - } - let currentClosestDistance = Infinity; - let currentClosestKeyword; +/***/ }), - for (const keyword of Object.keys(cssKeywords)) { - const value = cssKeywords[keyword]; +/***/ 2857: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Compute comparative distance - const distance = comparativeDistance(rgb, value); +var colors = __webpack_require__(43595); - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } - } +module['exports'] = function() { + // + // Extends prototype of native string object to allow for "foo".red syntax + // + var addProperty = function(color, func) { + String.prototype.__defineGetter__(color, func); + }; - return currentClosestKeyword; -}; + addProperty('strip', function() { + return colors.strip(this); + }); -convert.keyword.rgb = function (keyword) { - return cssKeywords[keyword]; -}; + addProperty('stripColors', function() { + return colors.strip(this); + }); -convert.rgb.xyz = function (rgb) { - let r = rgb[0] / 255; - let g = rgb[1] / 255; - let b = rgb[2] / 255; + addProperty('trap', function() { + return colors.trap(this); + }); - // Assume sRGB - r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); - g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); - b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + addProperty('zalgo', function() { + return colors.zalgo(this); + }); - const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + addProperty('zebra', function() { + return colors.zebra(this); + }); - return [x * 100, y * 100, z * 100]; -}; + addProperty('rainbow', function() { + return colors.rainbow(this); + }); -convert.rgb.lab = function (rgb) { - const xyz = convert.rgb.xyz(rgb); - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; + addProperty('random', function() { + return colors.random(this); + }); - x /= 95.047; - y /= 100; - z /= 108.883; + addProperty('america', function() { + return colors.america(this); + }); - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + // + // Iterate through all default styles and colors + // + var x = Object.keys(colors.styles); + x.forEach(function(style) { + addProperty(style, function() { + return colors.stylize(this, style); + }); + }); - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); + function applyTheme(theme) { + // + // Remark: This is a list of methods that exist + // on String that you should not overwrite. + // + var stringPrototypeBlacklist = [ + '__defineGetter__', '__defineSetter__', '__lookupGetter__', + '__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty', + 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', + 'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length', + 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice', + 'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase', + 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', + ]; - return [l, a, b]; + Object.keys(theme).forEach(function(prop) { + if (stringPrototypeBlacklist.indexOf(prop) !== -1) { + console.log('warn: '.red + ('String.prototype' + prop).magenta + + ' is probably something you don\'t want to override. ' + + 'Ignoring style name'); + } else { + if (typeof(theme[prop]) === 'string') { + colors[prop] = colors[theme[prop]]; + addProperty(prop, function() { + return colors[prop](this); + }); + } else { + var themePropApplicator = function(str) { + var ret = str || this; + for (var t = 0; t < theme[prop].length; t++) { + ret = colors[theme[prop][t]](ret); + } + return ret; + }; + addProperty(prop, themePropApplicator); + colors[prop] = function(str) { + return themePropApplicator(str); + }; + } + } + }); + } + + colors.setTheme = function(theme) { + if (typeof theme === 'string') { + console.log('colors.setTheme now only accepts an object, not a string. ' + + 'If you are trying to set a theme from a file, it is now your (the ' + + 'caller\'s) responsibility to require the file. The old syntax ' + + 'looked like colors.setTheme(__dirname + ' + + '\'/../themes/generic-logging.js\'); The new syntax looks like '+ + 'colors.setTheme(require(__dirname + ' + + '\'/../themes/generic-logging.js\'));'); + return; + } else { + applyTheme(theme); + } + }; }; -convert.hsl.rgb = function (hsl) { - const h = hsl[0] / 360; - const s = hsl[1] / 100; - const l = hsl[2] / 100; - let t2; - let t3; - let val; - if (s === 0) { - val = l * 255; - return [val, val, val]; - } +/***/ }), - if (l < 0.5) { - t2 = l * (1 + s); - } else { - t2 = l + s - l * s; - } +/***/ 83045: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - const t1 = 2 * l - t2; +var colors = __webpack_require__(43595); +module['exports'] = colors; - const rgb = [0, 0, 0]; - for (let i = 0; i < 3; i++) { - t3 = h + 1 / 3 * -(i - 1); - if (t3 < 0) { - t3++; - } +// Remark: By default, colors will add style properties to String.prototype. +// +// If you don't wish to extend String.prototype, you can do this instead and +// native String will not be touched: +// +// var colors = require('colors/safe); +// colors.red("foo") +// +// +__webpack_require__(2857)(); - if (t3 > 1) { - t3--; - } - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } else if (2 * t3 < 1) { - val = t2; - } else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } else { - val = t1; - } +/***/ }), - rgb[i] = val * 255; - } +/***/ 76936: +/***/ ((module) => { - return rgb; +module['exports'] = function(colors) { + return function(letter, i, exploded) { + if (letter === ' ') return letter; + switch (i%3) { + case 0: return colors.red(letter); + case 1: return colors.white(letter); + case 2: return colors.blue(letter); + } + }; }; -convert.hsl.hsv = function (hsl) { - const h = hsl[0]; - let s = hsl[1] / 100; - let l = hsl[2] / 100; - let smin = s; - const lmin = Math.max(l, 0.01); - l *= 2; - s *= (l <= 1) ? l : 2 - l; - smin *= lmin <= 1 ? lmin : 2 - lmin; - const v = (l + s) / 2; - const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); +/***/ }), - return [h, sv * 100, v * 100]; +/***/ 75210: +/***/ ((module) => { + +module['exports'] = function(colors) { + // RoY G BiV + var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; + return function(letter, i, exploded) { + if (letter === ' ') { + return letter; + } else { + return colors[rainbowColors[i++ % rainbowColors.length]](letter); + } + }; }; -convert.hsv.rgb = function (hsv) { - const h = hsv[0] / 60; - const s = hsv[1] / 100; - let v = hsv[2] / 100; - const hi = Math.floor(h) % 6; - const f = h - Math.floor(h); - const p = 255 * v * (1 - s); - const q = 255 * v * (1 - (s * f)); - const t = 255 * v * (1 - (s * (1 - f))); - v *= 255; - switch (hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } +/***/ }), + +/***/ 13441: +/***/ ((module) => { + +module['exports'] = function(colors) { + var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', + 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', + 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; + return function(letter, i, exploded) { + return letter === ' ' ? letter : + colors[ + available[Math.round(Math.random() * (available.length - 2))] + ](letter); + }; }; -convert.hsv.hsl = function (hsv) { - const h = hsv[0]; - const s = hsv[1] / 100; - const v = hsv[2] / 100; - const vmin = Math.max(v, 0.01); - let sl; - let l; - l = (2 - s) * v; - const lmin = (2 - s) * vmin; - sl = s * vmin; - sl /= (lmin <= 1) ? lmin : 2 - lmin; - sl = sl || 0; - l /= 2; +/***/ }), - return [h, sl * 100, l * 100]; +/***/ 12989: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + return i % 2 === 0 ? letter : colors.inverse(letter); + }; }; -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert.hwb.rgb = function (hwb) { - const h = hwb[0] / 360; - let wh = hwb[1] / 100; - let bl = hwb[2] / 100; - const ratio = wh + bl; - let f; - // Wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } +/***/ }), - const i = Math.floor(6 * h); - const v = 1 - bl; - f = 6 * h - i; +/***/ 73104: +/***/ ((module) => { - if ((i & 0x01) !== 0) { - f = 1 - f; - } +/* +The MIT License (MIT) - const n = wh + f * (v - wh); // Linear interpolation +Copyright (c) Sindre Sorhus (sindresorhus.com) - let r; - let g; - let b; - /* eslint-disable max-statements-per-line,no-multi-spaces */ - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - /* eslint-enable max-statements-per-line,no-multi-spaces */ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - return [r * 255, g * 255, b * 255]; -}; +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. -convert.cmyk.rgb = function (cmyk) { - const c = cmyk[0] / 100; - const m = cmyk[1] / 100; - const y = cmyk[2] / 100; - const k = cmyk[3] / 100; +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. - const r = 1 - Math.min(1, c * (1 - k) + k); - const g = 1 - Math.min(1, m * (1 - k) + k); - const b = 1 - Math.min(1, y * (1 - k) + k); +*/ - return [r * 255, g * 255, b * 255]; -}; +var styles = {}; +module['exports'] = styles; -convert.xyz.rgb = function (xyz) { - const x = xyz[0] / 100; - const y = xyz[1] / 100; - const z = xyz[2] / 100; - let r; - let g; - let b; +var codes = { + reset: [0, 0], - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], - // Assume sRGB - r = r > 0.0031308 - ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) - : r * 12.92; + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + grey: [90, 39], - g = g > 0.0031308 - ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) - : g * 12.92; + brightRed: [91, 39], + brightGreen: [92, 39], + brightYellow: [93, 39], + brightBlue: [94, 39], + brightMagenta: [95, 39], + brightCyan: [96, 39], + brightWhite: [97, 39], - b = b > 0.0031308 - ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) - : b * 12.92; + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + bgGray: [100, 49], + bgGrey: [100, 49], - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); + bgBrightRed: [101, 49], + bgBrightGreen: [102, 49], + bgBrightYellow: [103, 49], + bgBrightBlue: [104, 49], + bgBrightMagenta: [105, 49], + bgBrightCyan: [106, 49], + bgBrightWhite: [107, 49], - return [r * 255, g * 255, b * 255]; -}; + // legacy styles for colors pre v1.0.0 + blackBG: [40, 49], + redBG: [41, 49], + greenBG: [42, 49], + yellowBG: [43, 49], + blueBG: [44, 49], + magentaBG: [45, 49], + cyanBG: [46, 49], + whiteBG: [47, 49], -convert.xyz.lab = function (xyz) { - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; +}; - x /= 95.047; - y /= 100; - z /= 108.883; +Object.keys(codes).forEach(function(key) { + var val = codes[key]; + var style = styles[key] = []; + style.open = '\u001b[' + val[0] + 'm'; + style.close = '\u001b[' + val[1] + 'm'; +}); - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); +/***/ }), - return [l, a, b]; -}; +/***/ 10223: +/***/ ((module) => { -convert.lab.xyz = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let x; - let y; - let z; +"use strict"; +/* +MIT License - y = (l + 16) / 116; - x = a / 500 + y; - z = y - b / 200; +Copyright (c) Sindre Sorhus (sindresorhus.com) - const y2 = y ** 3; - const x2 = x ** 3; - const z2 = z ** 3; - y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; - x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; - z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: - x *= 95.047; - y *= 100; - z *= 108.883; +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - return [x, y, z]; -}; +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ -convert.lab.lch = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let h; - const hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - if (h < 0) { - h += 360; - } +module.exports = function(flag, argv) { + argv = argv || process.argv; - const c = Math.sqrt(a * a + b * b); + var terminatorPos = argv.indexOf('--'); + var prefix = /^-{1,2}/.test(flag) ? '' : '--'; + var pos = argv.indexOf(prefix + flag); - return [l, c, h]; + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); }; -convert.lch.lab = function (lch) { - const l = lch[0]; - const c = lch[1]; - const h = lch[2]; - const hr = h / 360 * 2 * Math.PI; - const a = c * Math.cos(hr); - const b = c * Math.sin(hr); +/***/ }), - return [l, a, b]; -}; +/***/ 10662: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -convert.rgb.ansi16 = function (args, saturation = null) { - const [r, g, b] = args; - let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization +"use strict"; +/* +The MIT License (MIT) - value = Math.round(value / 50); +Copyright (c) Sindre Sorhus (sindresorhus.com) - if (value === 0) { - return 30; - } +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - let ansi = 30 - + ((Math.round(b / 255) << 2) - | (Math.round(g / 255) << 1) - | Math.round(r / 255)); +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. - if (value === 2) { - ansi += 60; - } +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. - return ansi; -}; +*/ -convert.hsv.ansi16 = function (args) { - // Optimization here; we already know the value and don't need to get - // it converted for us. - return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); -}; -convert.rgb.ansi256 = function (args) { - const r = args[0]; - const g = args[1]; - const b = args[2]; - // We use the extended greyscale palette here, with the exception of - // black and white. normal palette only has 4 greyscale shades. - if (r === g && g === b) { - if (r < 8) { - return 16; - } +var os = __webpack_require__(12087); +var hasFlag = __webpack_require__(10223); - if (r > 248) { - return 231; - } +var env = process.env; - return Math.round(((r - 8) / 247) * 24) + 232; - } +var forceColor = void 0; +if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') + || hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 + || parseInt(env.FORCE_COLOR, 10) !== 0; +} - const ansi = 16 - + (36 * Math.round(r / 255 * 5)) - + (6 * Math.round(g / 255 * 5)) - + Math.round(b / 255 * 5); +function translateLevel(level) { + if (level === 0) { + return false; + } - return ansi; -}; + return { + level: level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} -convert.ansi16.rgb = function (args) { - let color = args % 10; +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } - // Handle greyscale - if (color === 0 || color === 7) { - if (args > 50) { - color += 3.5; - } + if (hasFlag('color=16m') || hasFlag('color=full') + || hasFlag('color=truecolor')) { + return 3; + } - color = color / 10.5 * 255; + if (hasFlag('color=256')) { + return 2; + } - return [color, color, color]; - } + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } - const mult = (~~(args > 50) + 1) * 0.5; - const r = ((color & 1) * mult) * 255; - const g = (((color >> 1) & 1) * mult) * 255; - const b = (((color >> 2) & 1) * mult) * 255; + var min = forceColor ? 1 : 0; - return [r, g, b]; -}; + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first + // Windows release that supports 256 colors. Windows 10 build 14931 is the + // first release that supports 16m/TrueColor. + var osRelease = os.release().split('.'); + if (Number(process.versions.node.split('.')[0]) >= 8 + && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } -convert.ansi256.rgb = function (args) { - // Handle greyscale - if (args >= 232) { - const c = (args - 232) * 10 + 8; - return [c, c, c]; - } + return 1; + } - args -= 16; + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) { + return sign in env; + }) || env.CI_NAME === 'codeship') { + return 1; + } - let rem; - const r = Math.floor(args / 36) / 5 * 255; - const g = Math.floor((rem = args % 36) / 6) / 5 * 255; - const b = (rem % 6) / 5 * 255; + return min; + } - return [r, g, b]; -}; + if ('TEAMCITY_VERSION' in env) { + return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 + ); + } -convert.rgb.hex = function (args) { - const integer = ((Math.round(args[0]) & 0xFF) << 16) - + ((Math.round(args[1]) & 0xFF) << 8) - + (Math.round(args[2]) & 0xFF); + if ('TERM_PROGRAM' in env) { + var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } -convert.hex.rgb = function (args) { - const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); - if (!match) { - return [0, 0, 0]; - } + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } - let colorString = match[0]; + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } - if (match[0].length === 3) { - colorString = colorString.split('').map(char => { - return char + char; - }).join(''); - } + if ('COLORTERM' in env) { + return 1; + } - const integer = parseInt(colorString, 16); - const r = (integer >> 16) & 0xFF; - const g = (integer >> 8) & 0xFF; - const b = integer & 0xFF; + if (env.TERM === 'dumb') { + return min; + } - return [r, g, b]; -}; + return min; +} -convert.rgb.hcg = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const max = Math.max(Math.max(r, g), b); - const min = Math.min(Math.min(r, g), b); - const chroma = (max - min); - let grayscale; - let hue; +function getSupportLevel(stream) { + var level = supportsColor(stream); + return translateLevel(level); +} - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr), +}; - if (chroma <= 0) { - hue = 0; - } else - if (max === r) { - hue = ((g - b) / chroma) % 6; - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma; - } - hue /= 6; - hue %= 1; +/***/ }), - return [hue * 360, chroma * 100, grayscale * 100]; -}; +/***/ 28222: +/***/ ((module, exports, __webpack_require__) => { -convert.hsl.hcg = function (hsl) { - const s = hsl[1] / 100; - const l = hsl[2] / 100; +/* eslint-env browser */ - const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); +/** + * This is the web browser implementation of `debug()`. + */ - let f = 0; - if (c < 1.0) { - f = (l - 0.5 * c) / (1.0 - c); - } +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; - return [hsl[0], c * 100, f * 100]; -}; + return () => { + if (!warned) { + warned = 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`.'); + } + }; +})(); -convert.hsv.hcg = function (hsv) { - const s = hsv[1] / 100; - const v = hsv[2] / 100; +/** + * Colors. + */ - const c = s * v; - let f = 0; +exports.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' +]; - if (c < 1.0) { - f = (v - c) / (1 - c); +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; } - return [hsv[0], c * 100, f * 100]; -}; + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } -convert.hcg.rgb = function (hcg) { - const h = hcg[0] / 360; - const c = hcg[1] / 100; - const g = hcg[2] / 100; + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + 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 && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$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+)/)); +} - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } +/** + * Colorize log arguments if enabled. + * + * @api public + */ - const pure = [0, 0, 0]; - const hi = (h % 1) * 6; - const v = hi % 1; - const w = 1 - v; - let mg = 0; +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); - /* eslint-disable max-statements-per-line */ - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; + if (!this.useColors) { + return; } - /* eslint-enable max-statements-per-line */ - mg = (1.0 - c) * g; + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); - return [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; -}; + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); -convert.hcg.hsv = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; + args.splice(lastC, 0, c); +} - const v = c + g * (1.0 - c); - let f = 0; +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); - if (v > 0.0) { - f = c / v; +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? } +} - return [hcg[0], f * 100, v * 100]; -}; - -convert.hcg.hsl = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - const l = g * (1.0 - c) + 0.5 * c; - let s = 0; - - if (l > 0.0 && l < 0.5) { - s = c / (2 * l); - } else - if (l >= 0.5 && l < 1.0) { - s = c / (2 * (1 - l)); +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? } - return [hcg[0], s * 100, l * 100]; -}; + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } -convert.hcg.hwb = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - const v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; -}; + return r; +} -convert.hwb.hcg = function (hwb) { - const w = hwb[1] / 100; - const b = hwb[2] / 100; - const v = 1 - b; - const c = v - w; - let g = 0; +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ - if (c < 1) { - g = (v - c) / (1 - c); +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? } +} - return [hwb[0], c * 100, g * 100]; -}; +module.exports = __webpack_require__(46243)(exports); -convert.apple.rgb = function (apple) { - return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; -}; +const {formatters} = module.exports; -convert.rgb.apple = function (rgb) { - return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; -}; +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ -convert.gray.rgb = function (args) { - return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } }; -convert.gray.hsl = function (args) { - return [0, 0, args[0]]; -}; -convert.gray.hsv = convert.gray.hsl; +/***/ }), -convert.gray.hwb = function (gray) { - return [0, 100, gray[0]]; -}; +/***/ 46243: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -convert.gray.cmyk = function (gray) { - return [0, 0, 0, gray[0]]; -}; -convert.gray.lab = function (gray) { - return [gray[0], 0, 0]; -}; +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ -convert.gray.hex = function (gray) { - const val = Math.round(gray[0] / 100 * 255) & 0xFF; - const integer = (val << 16) + (val << 8) + val; +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __webpack_require__(80900); + createDebug.destroy = destroy; - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); -convert.rgb.gray = function (rgb) { - const val = (rgb[0] + rgb[1] + rgb[2]) / 3; - return [val / 255 * 100]; -}; + /** + * The currently active debug mode names, and names to skip. + */ + createDebug.names = []; + createDebug.skips = []; -/***/ }), + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; -/***/ 18461: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; -const conversions = __webpack_require__(87379); -const route = __webpack_require__(63152); + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } -const convert = {}; + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; -const models = Object.keys(conversions); + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; -function wrapRaw(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - if (arg0 === undefined || arg0 === null) { - return arg0; - } + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } - if (arg0.length > 1) { - args = arg0; - } + const self = debug; - return fn(args); - }; + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } + args[0] = createDebug.coerce(args[0]); - return wrappedFn; -} + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } -function wrapRounded(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); - if (arg0 === undefined || arg0 === null) { - return arg0; - } + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); - if (arg0.length > 1) { - args = arg0; + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); } - const result = fn(args); + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. - // We're assuming the result is an array here. - // see notice in conversions.js; don't use box types - // in conversion functions. - if (typeof result === 'object') { - for (let len = result.length, i = 0; i < len; i++) { - result[i] = Math.round(result[i]); + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + set: v => { + enableOverride = v; } - } + }); - return result; - }; + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; + return debug; } - return wrappedFn; -} + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } -models.forEach(fromModel => { - convert[fromModel] = {}; + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); - Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); + createDebug.names = []; + createDebug.skips = []; - const routes = route(fromModel); - const routeModels = Object.keys(routes); + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; - routeModels.forEach(toModel => { - const fn = routes[toModel]; + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } - convert[fromModel][toModel] = wrapRounded(fn); - convert[fromModel][toModel].raw = wrapRaw(fn); - }); -}); + namespaces = split[i].replace(/\*/g, '.*?'); -module.exports = convert; + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + 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; +} + +module.exports = setup; /***/ }), -/***/ 63152: +/***/ 38237: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const conversions = __webpack_require__(87379); +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ -/* - This function routes a model to all other models. +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __webpack_require__(28222); +} else { + module.exports = __webpack_require__(35332); +} - all functions that are routed have a property `.conversion` attached - to the returned synthetic function. This property is an array - of strings, each with the steps in between the 'from' and 'to' - color models (inclusive). - conversions that are not possible simply are not included. -*/ +/***/ }), -function buildGraph() { - const graph = {}; - // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - const models = Object.keys(conversions); +/***/ 35332: +/***/ ((module, exports, __webpack_require__) => { - for (let len = models.length, i = 0; i < len; i++) { - graph[models[i]] = { - // http://jsperf.com/1-vs-infinity - // micro-opt, but this is simple. - distance: -1, - parent: null - }; +/** + * Module dependencies. + */ + +const tty = __webpack_require__(33867); +const util = __webpack_require__(31669); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __webpack_require__(59318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.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) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + 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); } - return graph; + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); } -// https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - const graph = buildGraph(); - const queue = [fromModel]; // Unshift -> queue -> pop +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ - graph[fromModel].distance = 0; +function formatArgs(args) { + const {namespace: name, useColors} = this; - while (queue.length) { - const current = queue.pop(); - const adjacents = Object.keys(conversions[current]); + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; - for (let len = adjacents.length, i = 0; i < len; i++) { - const adjacent = adjacents[i]; - const node = graph[adjacent]; + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} - if (node.distance === -1) { - node.distance = graph[current].distance + 1; - node.parent = current; - queue.unshift(adjacent); - } - } +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; } + return new Date().toISOString() + ' '; +} - return graph; +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); } -function link(from, to) { - return function (args) { - return to(from(args)); - }; +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } } -function wrapConversion(toModel, graph) { - const path = [graph[toModel].parent, toModel]; - let fn = conversions[graph[toModel].parent][toModel]; +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ - let cur = graph[toModel].parent; - while (graph[cur].parent) { - path.unshift(graph[cur].parent); - fn = link(conversions[graph[cur].parent][cur], fn); - cur = graph[cur].parent; - } +function load() { + return process.env.DEBUG; +} - fn.conversion = path; - return fn; +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } } -module.exports = function (fromModel) { - const graph = deriveBFS(fromModel); - const conversion = {}; +module.exports = __webpack_require__(46243)(exports); - const models = Object.keys(graph); - for (let len = models.length, i = 0; i < len; i++) { - const toModel = models[i]; - const node = graph[toModel]; +const {formatters} = module.exports; - if (node.parent === null) { - // No possible conversion, or this node is the source model. - continue; - } +/** + * Map %o to `util.inspect()`, all on a single line. + */ - conversion[toModel] = wrapConversion(toModel, graph); - } +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; - return conversion; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); }; +/***/ }), + +/***/ 18212: +/***/ ((module) => { + +"use strict"; + + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; + /***/ }), -/***/ 79903: +/***/ 98691: /***/ ((module) => { "use strict"; - - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; -/***/ }), - -/***/ 25779: -/***/ ((module) => { - -"use strict"; +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } -module.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); + return str.replace(matchOperatorsRe, '\\$&'); }; /***/ }), -/***/ 70899: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - 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] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - 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 - ) - } -} - -module.exports = Comparator - -const parseOptions = __webpack_require__(76909) -const {re, t} = __webpack_require__(248) -const cmp = __webpack_require__(6819) -const debug = __webpack_require__(15376) -const SemVer = __webpack_require__(31517) -const Range = __webpack_require__(93338) - - -/***/ }), - -/***/ 93338: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 78823: +/***/ (function(module) { -// hoisted class for cyclic dependency -class Range { - constructor (range, options) { - options = parseOptions(options) +(function webpackUniversalModuleDefinition(root, factory) { +/* istanbul ignore next */ + if(true) + module.exports = factory(); + else {} +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; - if (range instanceof Range) { - if ( - range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease - ) { - return range - } else { - return new Range(range.raw, options) - } - } +/******/ // The require function +/******/ function __nested_webpack_require_583__(moduleId) { - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.format() - return this - } +/******/ // Check if module is in cache +/* istanbul ignore if */ +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; - // First, split based on boolean or || - this.raw = range - this.set = range - .split(/\s*\|\|\s*/) - // map the range to a 2d array of comparators - .map(range => this.parseRange(range.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_583__); - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${range}`) - } +/******/ // Flag the module as loaded +/******/ module.loaded = true; - // if we have any that are not the null set, throw out null sets. - if (this.set.length > 1) { - // keep the first one, in case they're all null sets - 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) { - // if we have any that are *, then the range is just * - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c] - break - } - } - } - } +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } - this.format() - } - format () { - this.range = this.set - .map((comps) => { - return comps.join(' ').trim() - }) - .join('||') - .trim() - return this.range - } +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_583__.m = modules; - toString () { - return this.range - } +/******/ // expose the module cache +/******/ __nested_webpack_require_583__.c = installedModules; - parseRange (range) { - range = range.trim() +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_583__.p = ""; - // memoize range parsing for performance. - // this is a very hot path, and fully deterministic. - const memoOpts = Object.keys(this.options).join(',') - const memoKey = `parseRange:${memoOpts}:${range}` - const cached = cache.get(memoKey) - if (cached) - return cached +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_583__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __nested_webpack_require_1808__) { - const loose = this.options.loose - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + "use strict"; + /* + Copyright JS Foundation and other contributors, https://js.foundation/ - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - // normalize spaces - range = range.split(/\s+/).join(' ') + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + Object.defineProperty(exports, "__esModule", { value: true }); + var comment_handler_1 = __nested_webpack_require_1808__(1); + var jsx_parser_1 = __nested_webpack_require_1808__(3); + var parser_1 = __nested_webpack_require_1808__(8); + var tokenizer_1 = __nested_webpack_require_1808__(15); + function parse(code, options, delegate) { + var commentHandler = null; + var proxyDelegate = function (node, metadata) { + if (delegate) { + delegate(node, metadata); + } + if (commentHandler) { + commentHandler.visit(node, metadata); + } + }; + var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; + var collectComment = false; + if (options) { + collectComment = (typeof options.comment === 'boolean' && options.comment); + var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); + if (collectComment || attachComment) { + commentHandler = new comment_handler_1.CommentHandler(); + commentHandler.attach = attachComment; + options.comment = true; + parserDelegate = proxyDelegate; + } + } + var isModule = false; + if (options && typeof options.sourceType === 'string') { + isModule = (options.sourceType === 'module'); + } + var parser; + if (options && typeof options.jsx === 'boolean' && options.jsx) { + parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); + } + else { + parser = new parser_1.Parser(code, options, parserDelegate); + } + var program = isModule ? parser.parseModule() : parser.parseScript(); + var ast = program; + if (collectComment && commentHandler) { + ast.comments = commentHandler.comments; + } + if (parser.config.tokens) { + ast.tokens = parser.tokens; + } + if (parser.config.tolerant) { + ast.errors = parser.errorHandler.errors; + } + return ast; + } + exports.parse = parse; + function parseModule(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'module'; + return parse(code, parsingOptions, delegate); + } + exports.parseModule = parseModule; + function parseScript(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'script'; + return parse(code, parsingOptions, delegate); + } + exports.parseScript = parseScript; + function tokenize(code, options, delegate) { + var tokenizer = new tokenizer_1.Tokenizer(code, options); + var tokens; + tokens = []; + try { + while (true) { + var token = tokenizer.getNextToken(); + if (!token) { + break; + } + if (delegate) { + token = delegate(token); + } + tokens.push(token); + } + } + catch (e) { + tokenizer.errorHandler.tolerate(e); + } + if (tokenizer.errorHandler.tolerant) { + tokens.errors = tokenizer.errors(); + } + return tokens; + } + exports.tokenize = tokenize; + var syntax_1 = __nested_webpack_require_1808__(2); + exports.Syntax = syntax_1.Syntax; + // Sync with *.json manifests. + exports.version = '4.0.1'; - // At this point, the range is completely trimmed and - // ready to be split into comparators. - const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const rangeList = range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - // >=0.0.0 is equivalent to * - .map(comp => replaceGTE0(comp, this.options)) - // in loose mode, throw out any that are not valid comparators - .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) - .map(comp => new Comparator(comp, this.options)) +/***/ }, +/* 1 */ +/***/ function(module, exports, __nested_webpack_require_6456__) { - // if any comparators are the null set, then replace with JUST null set - // if more than one comparator, remove any * comparators - // also, don't include the same comparator more than once - 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) - }) - }) - ) - }) - ) - }) - } - - // if ANY of the sets match ALL of its comparators, then pass - 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 - } -} -module.exports = Range - -const LRU = __webpack_require__(7129) -const cache = new LRU({ max: 1000 }) - -const parseOptions = __webpack_require__(76909) -const Comparator = __webpack_require__(70899) -const debug = __webpack_require__(15376) -const SemVer = __webpack_require__(31517) -const { - re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace -} = __webpack_require__(248) - -const isNullSet = c => c.value === '<0.0.0-0' -const isAny = c => c.value === '' - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const 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 -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const 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 -} - -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -const replaceTildes = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceTilde(comp, options) - }).join(' ') - -const 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)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - 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 { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -const replaceCarets = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceCaret(comp, options) - }).join(' ') - -const 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 - }) -} - -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map((comp) => { - return replaceXRange(comp, options) - }).join(' ') -} - -const 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 = '' - } - - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __nested_webpack_require_6456__(2); + var CommentHandler = (function () { + function CommentHandler() { + this.attach = false; + this.comments = []; + this.stack = []; + this.leading = []; + this.trailing = []; + } + CommentHandler.prototype.insertInnerComments = function (node, metadata) { + // innnerComments for properties empty block + // `function a() {/** comments **\/}` + if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { + var innerComments = []; + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (metadata.end.offset >= entry.start) { + innerComments.unshift(entry.comment); + this.leading.splice(i, 1); + this.trailing.splice(i, 1); + } + } + if (innerComments.length) { + node.innerComments = innerComments; + } + } + }; + CommentHandler.prototype.findTrailingComments = function (metadata) { + var trailingComments = []; + if (this.trailing.length > 0) { + for (var i = this.trailing.length - 1; i >= 0; --i) { + var entry_1 = this.trailing[i]; + if (entry_1.start >= metadata.end.offset) { + trailingComments.unshift(entry_1.comment); + } + } + this.trailing.length = 0; + return trailingComments; + } + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.node.trailingComments) { + var firstComment = entry.node.trailingComments[0]; + if (firstComment && firstComment.range[0] >= metadata.end.offset) { + trailingComments = entry.node.trailingComments; + delete entry.node.trailingComments; + } + } + return trailingComments; + }; + CommentHandler.prototype.findLeadingComments = function (metadata) { + var leadingComments = []; + var target; + while (this.stack.length > 0) { + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.start >= metadata.start.offset) { + target = entry.node; + this.stack.pop(); + } + else { + break; + } + } + if (target) { + var count = target.leadingComments ? target.leadingComments.length : 0; + for (var i = count - 1; i >= 0; --i) { + var comment = target.leadingComments[i]; + if (comment.range[1] <= metadata.start.offset) { + leadingComments.unshift(comment); + target.leadingComments.splice(i, 1); + } + } + if (target.leadingComments && target.leadingComments.length === 0) { + delete target.leadingComments; + } + return leadingComments; + } + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (entry.start <= metadata.start.offset) { + leadingComments.unshift(entry.comment); + this.leading.splice(i, 1); + } + } + return leadingComments; + }; + CommentHandler.prototype.visitNode = function (node, metadata) { + if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { + return; + } + this.insertInnerComments(node, metadata); + var trailingComments = this.findTrailingComments(metadata); + var leadingComments = this.findLeadingComments(metadata); + if (leadingComments.length > 0) { + node.leadingComments = leadingComments; + } + if (trailingComments.length > 0) { + node.trailingComments = trailingComments; + } + this.stack.push({ + node: node, + start: metadata.start.offset + }); + }; + CommentHandler.prototype.visitComment = function (node, metadata) { + var type = (node.type[0] === 'L') ? 'Line' : 'Block'; + var comment = { + type: type, + value: node.value + }; + if (node.range) { + comment.range = node.range; + } + if (node.loc) { + comment.loc = node.loc; + } + this.comments.push(comment); + if (this.attach) { + var entry = { + comment: { + type: type, + value: node.value, + range: [metadata.start.offset, metadata.end.offset] + }, + start: metadata.start.offset + }; + if (node.loc) { + entry.comment.loc = node.loc; + } + node.type = type; + this.leading.push(entry); + this.trailing.push(entry); + } + }; + CommentHandler.prototype.visit = function (node, metadata) { + if (node.type === 'LineComment') { + this.visitComment(node, metadata); + } + else if (node.type === 'BlockComment') { + this.visitComment(node, metadata); + } + else if (this.attach) { + this.visitNode(node, metadata); + } + }; + return CommentHandler; + }()); + exports.CommentHandler = CommentHandler; - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - if (gtlt === '<') - pr = '-0' +/***/ }, +/* 2 */ +/***/ function(module, exports) { - 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` - } + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; - debug('xRange return', ret) - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') -} - -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp.trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') -} - -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -const 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() -} - -const 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) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - 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 - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - - -/***/ }), - -/***/ 31517: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const debug = __webpack_require__(15376) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(38622) -const { re, t } = __webpack_require__(248) - -const parseOptions = __webpack_require__(76909) -const { compareIdentifiers } = __webpack_require__(93582) -class SemVer { - 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 isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - 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 - - // these are actually numbers - 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') - } - - // numberify any prerelease numeric ids - 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) - } - - // NOT having a prerelease is > having one - 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 === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - 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 === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - 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': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - 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 is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - 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) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - 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 - } -} - -module.exports = SemVer - - -/***/ }), - -/***/ 33469: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(7175) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} -module.exports = clean - - -/***/ }), - -/***/ 6819: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const eq = __webpack_require__(7086) -const neq = __webpack_require__(49322) -const gt = __webpack_require__(29842) -const gte = __webpack_require__(10658) -const lt = __webpack_require__(19277) -const lte = __webpack_require__(1682) - -const 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}`) - } -} -module.exports = cmp - - -/***/ }), - -/***/ 32867: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const parse = __webpack_require__(7175) -const {re, t} = __webpack_require__(248) - -const 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 { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - 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 - } - // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 - } - - if (match === null) - return null - - return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) -} -module.exports = coerce - - -/***/ }), - -/***/ 92900: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} -module.exports = compareBuild - - -/***/ }), - -/***/ 61895: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose - - -/***/ }), - -/***/ 76854: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) - -module.exports = compare - - -/***/ }), - -/***/ 90075: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(7175) -const eq = __webpack_require__(7086) - -const 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 // may be undefined - } -} -module.exports = diff - - -/***/ }), - -/***/ 7086: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq - - -/***/ }), - -/***/ 29842: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt - - -/***/ }), - -/***/ 10658: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte - - -/***/ }), - -/***/ 25003: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) - -const inc = (version, release, options, identifier) => { - if (typeof (options) === 'string') { - identifier = options - options = undefined - } - - try { - return new SemVer(version, options).inc(release, identifier).version - } catch (er) { - return null - } -} -module.exports = inc - - -/***/ }), - -/***/ 19277: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt - - -/***/ }), - -/***/ 1682: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte - - -/***/ }), - -/***/ 87170: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major - - -/***/ }), - -/***/ 2548: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor - - -/***/ }), - -/***/ 49322: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq - - -/***/ }), - -/***/ 7175: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const {MAX_LENGTH} = __webpack_require__(38622) -const { re, t } = __webpack_require__(248) -const SemVer = __webpack_require__(31517) - -const parseOptions = __webpack_require__(76909) -const 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 - } -} - -module.exports = parse - - -/***/ }), - -/***/ 34206: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch - - -/***/ }), - -/***/ 94743: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(7175) -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} -module.exports = prerelease - - -/***/ }), - -/***/ 45541: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(76854) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare - - -/***/ }), - -/***/ 90666: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compareBuild = __webpack_require__(92900) -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort - - -/***/ }), - -/***/ 17994: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(93338) -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} -module.exports = satisfies - - -/***/ }), - -/***/ 43820: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compareBuild = __webpack_require__(92900) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort - - -/***/ }), - -/***/ 55336: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(7175) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid - - -/***/ }), - -/***/ 40089: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// just pre-load all the stuff that index.js lazily exports -const internalRe = __webpack_require__(248) -module.exports = { - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: __webpack_require__(38622).SEMVER_SPEC_VERSION, - SemVer: __webpack_require__(31517), - compareIdentifiers: __webpack_require__(93582).compareIdentifiers, - rcompareIdentifiers: __webpack_require__(93582).rcompareIdentifiers, - parse: __webpack_require__(7175), - valid: __webpack_require__(55336), - clean: __webpack_require__(33469), - inc: __webpack_require__(25003), - diff: __webpack_require__(90075), - major: __webpack_require__(87170), - minor: __webpack_require__(2548), - patch: __webpack_require__(34206), - prerelease: __webpack_require__(94743), - compare: __webpack_require__(76854), - rcompare: __webpack_require__(45541), - compareLoose: __webpack_require__(61895), - compareBuild: __webpack_require__(92900), - sort: __webpack_require__(43820), - rsort: __webpack_require__(90666), - gt: __webpack_require__(29842), - lt: __webpack_require__(19277), - eq: __webpack_require__(7086), - neq: __webpack_require__(49322), - gte: __webpack_require__(10658), - lte: __webpack_require__(1682), - cmp: __webpack_require__(6819), - coerce: __webpack_require__(32867), - Comparator: __webpack_require__(70899), - Range: __webpack_require__(93338), - satisfies: __webpack_require__(17994), - toComparators: __webpack_require__(74311), - maxSatisfying: __webpack_require__(19404), - minSatisfying: __webpack_require__(62843), - minVersion: __webpack_require__(38274), - validRange: __webpack_require__(69623), - outside: __webpack_require__(98798), - gtr: __webpack_require__(64099), - ltr: __webpack_require__(67239), - intersects: __webpack_require__(81720), - simplifyRange: __webpack_require__(16333), - subset: __webpack_require__(93029), -} - - -/***/ }), - -/***/ 38622: -/***/ ((module) => { - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' - -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 - -module.exports = { - SEMVER_SPEC_VERSION, - MAX_LENGTH, - MAX_SAFE_INTEGER, - MAX_SAFE_COMPONENT_LENGTH -} - - -/***/ }), - -/***/ 15376: -/***/ ((module) => { - -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} - -module.exports = debug - - -/***/ }), - -/***/ 93582: -/***/ ((module) => { - -const numeric = /^[0-9]+$/ -const 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 -} - -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) - -module.exports = { - compareIdentifiers, - rcompareIdentifiers -} - - -/***/ }), - -/***/ 76909: -/***/ ((module) => { - -// parse out just the options we care about so we always get a consistent -// obj with keys in a consistent order. -const opts = ['includePrerelease', 'loose', 'rtl'] -const parseOptions = options => - !options ? {} - : typeof options !== 'object' ? { loose: true } - : opts.filter(k => options[k]).reduce((options, k) => { - options[k] = true - return options - }, {}) -module.exports = parseOptions - - -/***/ }), - -/***/ 248: -/***/ ((module, exports, __webpack_require__) => { - -const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(38622) -const debug = __webpack_require__(15376) -exports = module.exports = {} - -// The actual regexps go on exports.re -const re = exports.re = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 - -const createToken = (name, value, isGlobal) => { - const index = R++ - debug(index, value) - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) - -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) - -createToken('FULL', `^${src[t.FULLPLAIN]}$`) - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) - -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - -createToken('GTLT', '((?:<|>)?=?)') - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -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]}$`) - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -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) - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') - -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' - -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') - -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' - -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) - -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) - -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') - - -/***/ }), - -/***/ 64099: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// Determine if version is greater than all the versions possible in the range. -const outside = __webpack_require__(98798) -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr - - -/***/ }), - -/***/ 81720: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(93338) -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} -module.exports = intersects - - -/***/ }), - -/***/ 67239: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const outside = __webpack_require__(98798) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr - - -/***/ }), - -/***/ 19404: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const Range = __webpack_require__(93338) - -const 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)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} -module.exports = maxSatisfying - - -/***/ }), - -/***/ 62843: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const Range = __webpack_require__(93338) -const 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)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} -module.exports = minSatisfying - - -/***/ }), - -/***/ 38274: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const Range = __webpack_require__(93338) -const gt = __webpack_require__(29842) - -const 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) => { - // Clone to avoid manipulating the comparator's semver object. - 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() - /* fallthrough */ - case '': - case '>=': - if (!setMin || gt(compver, setMin)) { - setMin = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - 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 -} -module.exports = minVersion - - -/***/ }), - -/***/ 98798: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(31517) -const Comparator = __webpack_require__(70899) -const {ANY} = Comparator -const Range = __webpack_require__(93338) -const satisfies = __webpack_require__(17994) -const gt = __webpack_require__(29842) -const lt = __webpack_require__(19277) -const lte = __webpack_require__(1682) -const gte = __webpack_require__(10658) - -const 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 it satisfies the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - 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 the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - 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 -} - -module.exports = outside - - -/***/ }), - -/***/ 16333: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = __webpack_require__(17994) -const compare = __webpack_require__(76854) -module.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 [min, max] of set) { - if (min === max) - ranges.push(min) - else if (!max && min === v[0]) - ranges.push('*') - else if (!max) - ranges.push(`>=${min}`) - else if (min === v[0]) - ranges.push(`<=${max}`) - else - ranges.push(`${min} - ${max}`) - } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range -} - - -/***/ }), - -/***/ 93029: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(93338) -const Comparator = __webpack_require__(70899) -const { ANY } = Comparator -const satisfies = __webpack_require__(17994) -const compare = __webpack_require__(76854) - -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a null set, OR -// - Every simple range `r1, r2, ...` which is not a null set is a subset of -// some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else if in prerelease mode, return false -// - else replace c with `[>=0.0.0]` -// - If C is only the ANY comparator -// - if in prerelease mode, return true -// - else replace C with `[>=0.0.0]` -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If any C is a = range, and GT or LT are set, return false -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT.semver is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the GT.semver tuple, return false -// - If LT -// - If LT.semver is greater than any < or <= comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the LT.semver tuple, return false -// - Else return true - -const 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 - } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) - return false - } - return true -} - -const 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 - } - - // will iterate one or zero times - 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 - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - 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 there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) - return false - - if (lt && hasDomGT && !gt && gtltComp !== 0) - return false - - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) - return false - - return true -} - -// >=1.2.3 is lower than >1.2.3 -const 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 -} - -// <=1.2.3 is higher than <1.2.3 -const 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 -} - -module.exports = subset - - -/***/ }), - -/***/ 74311: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(93338) - -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) - -module.exports = toComparators - - -/***/ }), - -/***/ 69623: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(93338) -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} -module.exports = validRange - - -/***/ }), - -/***/ 91691: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -const os = __webpack_require__(12087); -const tty = __webpack_require__(33867); -const hasFlag = __webpack_require__(25779); - -const {env} = process; - -let 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 === undefined) { - return 0; - } - - const min = forceColor || 0; - - if (env.TERM === 'dumb') { - return min; - } - - if (process.platform === 'win32') { - // Windows 10 build 10586 is the first Windows release that supports 256 colors. - // Windows 10 build 14931 is the first release that supports 16m/TrueColor. - 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; - // No default - } - } - - 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(stream) { - const level = supportsColor(stream, stream && stream.isTTY); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: translateLevel(supportsColor(true, tty.isatty(1))), - stderr: translateLevel(supportsColor(true, tty.isatty(2))) -}; - - -/***/ }), - -/***/ 22116: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "__extends": () => /* binding */ __extends, -/* harmony export */ "__assign": () => /* binding */ __assign, -/* harmony export */ "__rest": () => /* binding */ __rest, -/* harmony export */ "__decorate": () => /* binding */ __decorate, -/* harmony export */ "__param": () => /* binding */ __param, -/* harmony export */ "__metadata": () => /* binding */ __metadata, -/* harmony export */ "__awaiter": () => /* binding */ __awaiter, -/* harmony export */ "__generator": () => /* binding */ __generator, -/* harmony export */ "__createBinding": () => /* binding */ __createBinding, -/* harmony export */ "__exportStar": () => /* binding */ __exportStar, -/* harmony export */ "__values": () => /* binding */ __values, -/* harmony export */ "__read": () => /* binding */ __read, -/* harmony export */ "__spread": () => /* binding */ __spread, -/* harmony export */ "__spreadArrays": () => /* binding */ __spreadArrays, -/* harmony export */ "__spreadArray": () => /* binding */ __spreadArray, -/* harmony export */ "__await": () => /* binding */ __await, -/* harmony export */ "__asyncGenerator": () => /* binding */ __asyncGenerator, -/* harmony export */ "__asyncDelegator": () => /* binding */ __asyncDelegator, -/* harmony export */ "__asyncValues": () => /* binding */ __asyncValues, -/* harmony export */ "__makeTemplateObject": () => /* binding */ __makeTemplateObject, -/* harmony export */ "__importStar": () => /* binding */ __importStar, -/* harmony export */ "__importDefault": () => /* binding */ __importDefault, -/* harmony export */ "__classPrivateFieldGet": () => /* binding */ __classPrivateFieldGet, -/* harmony export */ "__classPrivateFieldSet": () => /* binding */ __classPrivateFieldSet -/* harmony export */ }); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} - -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -/** @deprecated */ -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -/** @deprecated */ -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} - -function __spreadArray(to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -} - -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -function __importStar(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; -} - -function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - - -/***/ }), - -/***/ 97391: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* MIT license */ -var cssKeywords = __webpack_require__(78510); - -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). -// do not use box values types (i.e. Number(), String(), etc.) - -var reverseKeywords = {}; -for (var key in cssKeywords) { - if (cssKeywords.hasOwnProperty(key)) { - reverseKeywords[cssKeywords[key]] = key; - } -} - -var convert = module.exports = { - rgb: {channels: 3, labels: 'rgb'}, - hsl: {channels: 3, labels: 'hsl'}, - hsv: {channels: 3, labels: 'hsv'}, - hwb: {channels: 3, labels: 'hwb'}, - cmyk: {channels: 4, labels: 'cmyk'}, - xyz: {channels: 3, labels: 'xyz'}, - lab: {channels: 3, labels: 'lab'}, - lch: {channels: 3, labels: 'lch'}, - hex: {channels: 1, labels: ['hex']}, - keyword: {channels: 1, labels: ['keyword']}, - ansi16: {channels: 1, labels: ['ansi16']}, - ansi256: {channels: 1, labels: ['ansi256']}, - hcg: {channels: 3, labels: ['h', 'c', 'g']}, - apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, - gray: {channels: 1, labels: ['gray']} -}; - -// hide .channels and .labels properties -for (var model in convert) { - if (convert.hasOwnProperty(model)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } - - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } - - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } - - var channels = convert[model].channels; - var labels = convert[model].labels; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); - } -} - -convert.rgb.hsl = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var delta = max - min; - var h; - var s; - var l; - - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } - - h = Math.min(h * 60, 360); - - if (h < 0) { - h += 360; - } - - l = (min + max) / 2; - - if (max === min) { - s = 0; - } else if (l <= 0.5) { - s = delta / (max + min); - } else { - s = delta / (2 - max - min); - } - - return [h, s * 100, l * 100]; -}; - -convert.rgb.hsv = function (rgb) { - var rdif; - var gdif; - var bdif; - var h; - var s; - - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var v = Math.max(r, g, b); - var diff = v - Math.min(r, g, b); - var diffc = function (c) { - return (v - c) / 6 / diff + 1 / 2; - }; - - if (diff === 0) { - h = s = 0; - } else { - s = diff / v; - rdif = diffc(r); - gdif = diffc(g); - bdif = diffc(b); - - if (r === v) { - h = bdif - gdif; - } else if (g === v) { - h = (1 / 3) + rdif - bdif; - } else if (b === v) { - h = (2 / 3) + gdif - rdif; - } - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - } - - return [ - h * 360, - s * 100, - v * 100 - ]; -}; - -convert.rgb.hwb = function (rgb) { - var r = rgb[0]; - var g = rgb[1]; - var b = rgb[2]; - var h = convert.rgb.hsl(rgb)[0]; - var w = 1 / 255 * Math.min(r, Math.min(g, b)); - - b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -}; - -convert.rgb.cmyk = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var c; - var m; - var y; - var k; - - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; - - return [c * 100, m * 100, y * 100, k * 100]; -}; - -/** - * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - * */ -function comparativeDistance(x, y) { - return ( - Math.pow(x[0] - y[0], 2) + - Math.pow(x[1] - y[1], 2) + - Math.pow(x[2] - y[2], 2) - ); -} - -convert.rgb.keyword = function (rgb) { - var reversed = reverseKeywords[rgb]; - if (reversed) { - return reversed; - } - - var currentClosestDistance = Infinity; - var currentClosestKeyword; - - for (var keyword in cssKeywords) { - if (cssKeywords.hasOwnProperty(keyword)) { - var value = cssKeywords[keyword]; - - // Compute comparative distance - var distance = comparativeDistance(rgb, value); - - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } - } - } - - return currentClosestKeyword; -}; - -convert.keyword.rgb = function (keyword) { - return cssKeywords[keyword]; -}; - -convert.rgb.xyz = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - - var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - - return [x * 100, y * 100, z * 100]; -}; - -convert.rgb.lab = function (rgb) { - var xyz = convert.rgb.xyz(rgb); - var x = xyz[0]; - var y = xyz[1]; - var z = xyz[2]; - var l; - var a; - var b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -}; - -convert.hsl.rgb = function (hsl) { - var h = hsl[0] / 360; - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var t1; - var t2; - var t3; - var rgb; - var val; - - if (s === 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) { - t2 = l * (1 + s); - } else { - t2 = l + s - l * s; - } - - t1 = 2 * l - t2; - - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { - t3 = h + 1 / 3 * -(i - 1); - if (t3 < 0) { - t3++; - } - if (t3 > 1) { - t3--; - } - - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } else if (2 * t3 < 1) { - val = t2; - } else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } else { - val = t1; - } - - rgb[i] = val * 255; - } - - return rgb; -}; - -convert.hsl.hsv = function (hsl) { - var h = hsl[0]; - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var smin = s; - var lmin = Math.max(l, 0.01); - var sv; - var v; - - l *= 2; - s *= (l <= 1) ? l : 2 - l; - smin *= lmin <= 1 ? lmin : 2 - lmin; - v = (l + s) / 2; - sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - - return [h, sv * 100, v * 100]; -}; - -convert.hsv.rgb = function (hsv) { - var h = hsv[0] / 60; - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var hi = Math.floor(h) % 6; - - var f = h - Math.floor(h); - var p = 255 * v * (1 - s); - var q = 255 * v * (1 - (s * f)); - var t = 255 * v * (1 - (s * (1 - f))); - v *= 255; - - switch (hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -}; - -convert.hsv.hsl = function (hsv) { - var h = hsv[0]; - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var vmin = Math.max(v, 0.01); - var lmin; - var sl; - var l; - - l = (2 - s) * v; - lmin = (2 - s) * vmin; - sl = s * vmin; - sl /= (lmin <= 1) ? lmin : 2 - lmin; - sl = sl || 0; - l /= 2; - - return [h, sl * 100, l * 100]; -}; - -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert.hwb.rgb = function (hwb) { - var h = hwb[0] / 360; - var wh = hwb[1] / 100; - var bl = hwb[2] / 100; - var ratio = wh + bl; - var i; - var v; - var f; - var n; - - // wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - i = Math.floor(6 * h); - v = 1 - bl; - f = 6 * h - i; - - if ((i & 0x01) !== 0) { - f = 1 - f; - } - - n = wh + f * (v - wh); // linear interpolation - - var r; - var g; - var b; - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - - return [r * 255, g * 255, b * 255]; -}; - -convert.cmyk.rgb = function (cmyk) { - var c = cmyk[0] / 100; - var m = cmyk[1] / 100; - var y = cmyk[2] / 100; - var k = cmyk[3] / 100; - var r; - var g; - var b; - - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); - - return [r * 255, g * 255, b * 255]; -}; - -convert.xyz.rgb = function (xyz) { - var x = xyz[0] / 100; - var y = xyz[1] / 100; - var z = xyz[2] / 100; - var r; - var g; - var b; - - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - - // assume sRGB - r = r > 0.0031308 - ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) - : r * 12.92; - - g = g > 0.0031308 - ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) - : g * 12.92; - - b = b > 0.0031308 - ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) - : b * 12.92; - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -}; - -convert.xyz.lab = function (xyz) { - var x = xyz[0]; - var y = xyz[1]; - var z = xyz[2]; - var l; - var a; - var b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -}; - -convert.lab.xyz = function (lab) { - var l = lab[0]; - var a = lab[1]; - var b = lab[2]; - var x; - var y; - var z; - - y = (l + 16) / 116; - x = a / 500 + y; - z = y - b / 200; - - var y2 = Math.pow(y, 3); - var x2 = Math.pow(x, 3); - var z2 = Math.pow(z, 3); - y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; - x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; - z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; - - x *= 95.047; - y *= 100; - z *= 108.883; - - return [x, y, z]; -}; - -convert.lab.lch = function (lab) { - var l = lab[0]; - var a = lab[1]; - var b = lab[2]; - var hr; - var h; - var c; - - hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - - if (h < 0) { - h += 360; - } - - c = Math.sqrt(a * a + b * b); - - return [l, c, h]; -}; - -convert.lch.lab = function (lch) { - var l = lch[0]; - var c = lch[1]; - var h = lch[2]; - var a; - var b; - var hr; - - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); - - return [l, a, b]; -}; - -convert.rgb.ansi16 = function (args) { - var r = args[0]; - var g = args[1]; - var b = args[2]; - var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization - - value = Math.round(value / 50); - - if (value === 0) { - return 30; - } - - var ansi = 30 - + ((Math.round(b / 255) << 2) - | (Math.round(g / 255) << 1) - | Math.round(r / 255)); - - if (value === 2) { - ansi += 60; - } - - return ansi; -}; - -convert.hsv.ansi16 = function (args) { - // optimization here; we already know the value and don't need to get - // it converted for us. - return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); -}; - -convert.rgb.ansi256 = function (args) { - var r = args[0]; - var g = args[1]; - var b = args[2]; - - // we use the extended greyscale palette here, with the exception of - // black and white. normal palette only has 4 greyscale shades. - if (r === g && g === b) { - if (r < 8) { - return 16; - } - - if (r > 248) { - return 231; - } - - return Math.round(((r - 8) / 247) * 24) + 232; - } - - var ansi = 16 - + (36 * Math.round(r / 255 * 5)) - + (6 * Math.round(g / 255 * 5)) - + Math.round(b / 255 * 5); - - return ansi; -}; - -convert.ansi16.rgb = function (args) { - var color = args % 10; - - // handle greyscale - if (color === 0 || color === 7) { - if (args > 50) { - color += 3.5; - } - - color = color / 10.5 * 255; - - return [color, color, color]; - } - - var mult = (~~(args > 50) + 1) * 0.5; - var r = ((color & 1) * mult) * 255; - var g = (((color >> 1) & 1) * mult) * 255; - var b = (((color >> 2) & 1) * mult) * 255; - - return [r, g, b]; -}; - -convert.ansi256.rgb = function (args) { - // handle greyscale - if (args >= 232) { - var c = (args - 232) * 10 + 8; - return [c, c, c]; - } - - args -= 16; - - var rem; - var r = Math.floor(args / 36) / 5 * 255; - var g = Math.floor((rem = args % 36) / 6) / 5 * 255; - var b = (rem % 6) / 5 * 255; - - return [r, g, b]; -}; - -convert.rgb.hex = function (args) { - var integer = ((Math.round(args[0]) & 0xFF) << 16) - + ((Math.round(args[1]) & 0xFF) << 8) - + (Math.round(args[2]) & 0xFF); - - var string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert.hex.rgb = function (args) { - var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); - if (!match) { - return [0, 0, 0]; - } - - var colorString = match[0]; - - if (match[0].length === 3) { - colorString = colorString.split('').map(function (char) { - return char + char; - }).join(''); - } - - var integer = parseInt(colorString, 16); - var r = (integer >> 16) & 0xFF; - var g = (integer >> 8) & 0xFF; - var b = integer & 0xFF; - - return [r, g, b]; -}; - -convert.rgb.hcg = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var max = Math.max(Math.max(r, g), b); - var min = Math.min(Math.min(r, g), b); - var chroma = (max - min); - var grayscale; - var hue; - - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } - - if (chroma <= 0) { - hue = 0; - } else - if (max === r) { - hue = ((g - b) / chroma) % 6; - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma + 4; - } - - hue /= 6; - hue %= 1; - - return [hue * 360, chroma * 100, grayscale * 100]; -}; - -convert.hsl.hcg = function (hsl) { - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var c = 1; - var f = 0; - - if (l < 0.5) { - c = 2.0 * s * l; - } else { - c = 2.0 * s * (1.0 - l); - } - - if (c < 1.0) { - f = (l - 0.5 * c) / (1.0 - c); - } - - return [hsl[0], c * 100, f * 100]; -}; - -convert.hsv.hcg = function (hsv) { - var s = hsv[1] / 100; - var v = hsv[2] / 100; - - var c = s * v; - var f = 0; - - if (c < 1.0) { - f = (v - c) / (1 - c); - } - - return [hsv[0], c * 100, f * 100]; -}; - -convert.hcg.rgb = function (hcg) { - var h = hcg[0] / 360; - var c = hcg[1] / 100; - var g = hcg[2] / 100; - - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } - - var pure = [0, 0, 0]; - var hi = (h % 1) * 6; - var v = hi % 1; - var w = 1 - v; - var mg = 0; - - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; - } - - mg = (1.0 - c) * g; - - return [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; -}; - -convert.hcg.hsv = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; - - var v = c + g * (1.0 - c); - var f = 0; - - if (v > 0.0) { - f = c / v; - } - - return [hcg[0], f * 100, v * 100]; -}; - -convert.hcg.hsl = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; - - var l = g * (1.0 - c) + 0.5 * c; - var s = 0; - - if (l > 0.0 && l < 0.5) { - s = c / (2 * l); - } else - if (l >= 0.5 && l < 1.0) { - s = c / (2 * (1 - l)); - } - - return [hcg[0], s * 100, l * 100]; -}; - -convert.hcg.hwb = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; - var v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; -}; - -convert.hwb.hcg = function (hwb) { - var w = hwb[1] / 100; - var b = hwb[2] / 100; - var v = 1 - b; - var c = v - w; - var g = 0; - - if (c < 1) { - g = (v - c) / (1 - c); - } - - return [hwb[0], c * 100, g * 100]; -}; - -convert.apple.rgb = function (apple) { - return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; -}; - -convert.rgb.apple = function (rgb) { - return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; -}; - -convert.gray.rgb = function (args) { - return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; -}; - -convert.gray.hsl = convert.gray.hsv = function (args) { - return [0, 0, args[0]]; -}; - -convert.gray.hwb = function (gray) { - return [0, 100, gray[0]]; -}; - -convert.gray.cmyk = function (gray) { - return [0, 0, 0, gray[0]]; -}; - -convert.gray.lab = function (gray) { - return [gray[0], 0, 0]; -}; - -convert.gray.hex = function (gray) { - var val = Math.round(gray[0] / 100 * 255) & 0xFF; - var integer = (val << 16) + (val << 8) + val; - - var string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert.rgb.gray = function (rgb) { - var val = (rgb[0] + rgb[1] + rgb[2]) / 3; - return [val / 255 * 100]; -}; - - -/***/ }), - -/***/ 86931: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var conversions = __webpack_require__(97391); -var route = __webpack_require__(30880); - -var convert = {}; - -var models = Object.keys(conversions); - -function wrapRaw(fn) { - var wrappedFn = function (args) { - if (args === undefined || args === null) { - return args; - } - - if (arguments.length > 1) { - args = Array.prototype.slice.call(arguments); - } - - return fn(args); - }; - - // preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } - - return wrappedFn; -} - -function wrapRounded(fn) { - var wrappedFn = function (args) { - if (args === undefined || args === null) { - return args; - } - - if (arguments.length > 1) { - args = Array.prototype.slice.call(arguments); - } - - var result = fn(args); - - // we're assuming the result is an array here. - // see notice in conversions.js; don't use box types - // in conversion functions. - if (typeof result === 'object') { - for (var len = result.length, i = 0; i < len; i++) { - result[i] = Math.round(result[i]); - } - } - - return result; - }; - - // preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } - - return wrappedFn; -} - -models.forEach(function (fromModel) { - convert[fromModel] = {}; - - Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - - var routes = route(fromModel); - var routeModels = Object.keys(routes); - - routeModels.forEach(function (toModel) { - var fn = routes[toModel]; - - convert[fromModel][toModel] = wrapRounded(fn); - convert[fromModel][toModel].raw = wrapRaw(fn); - }); -}); - -module.exports = convert; - - -/***/ }), - -/***/ 30880: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var conversions = __webpack_require__(97391); - -/* - this function routes a model to all other models. - - all functions that are routed have a property `.conversion` attached - to the returned synthetic function. This property is an array - of strings, each with the steps in between the 'from' and 'to' - color models (inclusive). - - conversions that are not possible simply are not included. -*/ - -function buildGraph() { - var graph = {}; - // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - var models = Object.keys(conversions); - - for (var len = models.length, i = 0; i < len; i++) { - graph[models[i]] = { - // http://jsperf.com/1-vs-infinity - // micro-opt, but this is simple. - distance: -1, - parent: null - }; - } - - return graph; -} - -// https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - var graph = buildGraph(); - var queue = [fromModel]; // unshift -> queue -> pop - - graph[fromModel].distance = 0; - - while (queue.length) { - var current = queue.pop(); - var adjacents = Object.keys(conversions[current]); - - for (var len = adjacents.length, i = 0; i < len; i++) { - var adjacent = adjacents[i]; - var node = graph[adjacent]; - - if (node.distance === -1) { - node.distance = graph[current].distance + 1; - node.parent = current; - queue.unshift(adjacent); - } - } - } - - return graph; -} - -function link(from, to) { - return function (args) { - return to(from(args)); - }; -} - -function wrapConversion(toModel, graph) { - var path = [graph[toModel].parent, toModel]; - var fn = conversions[graph[toModel].parent][toModel]; - - var cur = graph[toModel].parent; - while (graph[cur].parent) { - path.unshift(graph[cur].parent); - fn = link(conversions[graph[cur].parent][cur], fn); - cur = graph[cur].parent; - } - - fn.conversion = path; - return fn; -} - -module.exports = function (fromModel) { - var graph = deriveBFS(fromModel); - var conversion = {}; - - var models = Object.keys(graph); - for (var len = models.length, i = 0; i < len; i++) { - var toModel = models[i]; - var node = graph[toModel]; - - if (node.parent === null) { - // no possible conversion, or this node is the source model. - continue; - } - - conversion[toModel] = wrapConversion(toModel, graph); - } - - return conversion; -}; - - - -/***/ }), - -/***/ 78510: -/***/ ((module) => { - -"use strict"; - - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; - - -/***/ }), - -/***/ 43595: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - -The MIT License (MIT) - -Original Library - - Copyright (c) Marak Squires - -Additional functionality - - Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var colors = {}; -module['exports'] = colors; - -colors.themes = {}; - -var util = __webpack_require__(31669); -var ansiStyles = colors.styles = __webpack_require__(73104); -var defineProps = Object.defineProperties; -var newLineRegex = new RegExp(/[\r\n]+/g); - -colors.supportsColor = __webpack_require__(10662).supportsColor; - -if (typeof colors.enabled === 'undefined') { - colors.enabled = colors.supportsColor() !== false; -} - -colors.enable = function() { - colors.enabled = true; -}; - -colors.disable = function() { - colors.enabled = false; -}; - -colors.stripColors = colors.strip = function(str) { - return ('' + str).replace(/\x1B\[\d+m/g, ''); -}; - -// eslint-disable-next-line no-unused-vars -var stylize = colors.stylize = function stylize(str, style) { - if (!colors.enabled) { - return str+''; - } - - var styleMap = ansiStyles[style]; - - // Stylize should work for non-ANSI styles, too - if(!styleMap && style in colors){ - // Style maps like trap operate as functions on strings; - // they don't have properties like open or close. - return colors[style](str); - } - - return styleMap.open + str + styleMap.close; -}; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; -var escapeStringRegexp = function(str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - return str.replace(matchOperatorsRe, '\\$&'); -}; - -function build(_styles) { - var builder = function builder() { - return applyStyle.apply(builder, arguments); - }; - builder._styles = _styles; - // __proto__ is used because we must return a function, but there is - // no way to create a function with a different prototype. - builder.__proto__ = proto; - return builder; -} - -var styles = (function() { - var ret = {}; - ansiStyles.grey = ansiStyles.gray; - Object.keys(ansiStyles).forEach(function(key) { - ansiStyles[key].closeRe = - new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - ret[key] = { - get: function() { - return build(this._styles.concat(key)); - }, - }; - }); - return ret; -})(); - -var proto = defineProps(function colors() {}, styles); - -function applyStyle() { - var args = Array.prototype.slice.call(arguments); - - var str = args.map(function(arg) { - // Use weak equality check so we can colorize null/undefined in safe mode - if (arg != null && arg.constructor === String) { - return arg; - } else { - return util.inspect(arg); - } - }).join(' '); - - if (!colors.enabled || !str) { - return str; - } - - var newLinesPresent = str.indexOf('\n') != -1; - - var nestedStyles = this._styles; - - var i = nestedStyles.length; - while (i--) { - var code = ansiStyles[nestedStyles[i]]; - str = code.open + str.replace(code.closeRe, code.open) + code.close; - if (newLinesPresent) { - str = str.replace(newLineRegex, function(match) { - return code.close + match + code.open; - }); - } - } - - return str; -} - -colors.setTheme = function(theme) { - if (typeof theme === 'string') { - console.log('colors.setTheme now only accepts an object, not a string. ' + - 'If you are trying to set a theme from a file, it is now your (the ' + - 'caller\'s) responsibility to require the file. The old syntax ' + - 'looked like colors.setTheme(__dirname + ' + - '\'/../themes/generic-logging.js\'); The new syntax looks like '+ - 'colors.setTheme(require(__dirname + ' + - '\'/../themes/generic-logging.js\'));'); - return; - } - for (var style in theme) { - (function(style) { - colors[style] = function(str) { - if (typeof theme[style] === 'object') { - var out = str; - for (var i in theme[style]) { - out = colors[theme[style][i]](out); - } - return out; - } - return colors[theme[style]](str); - }; - })(style); - } -}; - -function init() { - var ret = {}; - Object.keys(styles).forEach(function(name) { - ret[name] = { - get: function() { - return build([name]); - }, - }; - }); - return ret; -} - -var sequencer = function sequencer(map, str) { - var exploded = str.split(''); - exploded = exploded.map(map); - return exploded.join(''); -}; - -// custom formatter methods -colors.trap = __webpack_require__(31302); -colors.zalgo = __webpack_require__(97743); - -// maps -colors.maps = {}; -colors.maps.america = __webpack_require__(76936)(colors); -colors.maps.zebra = __webpack_require__(12989)(colors); -colors.maps.rainbow = __webpack_require__(75210)(colors); -colors.maps.random = __webpack_require__(13441)(colors); - -for (var map in colors.maps) { - (function(map) { - colors[map] = function(str) { - return sequencer(colors.maps[map], str); - }; - })(map); -} - -defineProps(colors, init()); - - -/***/ }), - -/***/ 31302: -/***/ ((module) => { - -module['exports'] = function runTheTrap(text, options) { - var result = ''; - text = text || 'Run the trap, drop the bass'; - text = text.split(''); - var trap = { - a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], - b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], - c: ['\u00a9', '\u023b', '\u03fe'], - d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], - e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', - '\u0a6c'], - f: ['\u04fa'], - g: ['\u0262'], - h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], - i: ['\u0f0f'], - j: ['\u0134'], - k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], - l: ['\u0139'], - m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], - n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], - o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', - '\u06dd', '\u0e4f'], - p: ['\u01f7', '\u048e'], - q: ['\u09cd'], - r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], - s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], - t: ['\u0141', '\u0166', '\u0373'], - u: ['\u01b1', '\u054d'], - v: ['\u05d8'], - w: ['\u0428', '\u0460', '\u047c', '\u0d70'], - x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], - y: ['\u00a5', '\u04b0', '\u04cb'], - z: ['\u01b5', '\u0240'], - }; - text.forEach(function(c) { - c = c.toLowerCase(); - var chars = trap[c] || [' ']; - var rand = Math.floor(Math.random() * chars.length); - if (typeof trap[c] !== 'undefined') { - result += trap[c][rand]; - } else { - result += c; - } - }); - return result; -}; - - -/***/ }), - -/***/ 97743: -/***/ ((module) => { - -// please no -module['exports'] = function zalgo(text, options) { - text = text || ' he is here '; - var soul = { - 'up': [ - '̍', '̎', '̄', '̅', - '̿', '̑', '̆', '̐', - '͒', '͗', '͑', '̇', - '̈', '̊', '͂', '̓', - '̈', '͊', '͋', '͌', - '̃', '̂', '̌', '͐', - '̀', '́', '̋', '̏', - '̒', '̓', '̔', '̽', - '̉', 'ͣ', 'ͤ', 'ͥ', - 'ͦ', 'ͧ', 'ͨ', 'ͩ', - 'ͪ', 'ͫ', 'ͬ', 'ͭ', - 'ͮ', 'ͯ', '̾', '͛', - '͆', '̚', - ], - 'down': [ - '̖', '̗', '̘', '̙', - '̜', '̝', '̞', '̟', - '̠', '̤', '̥', '̦', - '̩', '̪', '̫', '̬', - '̭', '̮', '̯', '̰', - '̱', '̲', '̳', '̹', - '̺', '̻', '̼', 'ͅ', - '͇', '͈', '͉', '͍', - '͎', '͓', '͔', '͕', - '͖', '͙', '͚', '̣', - ], - 'mid': [ - '̕', '̛', '̀', '́', - '͘', '̡', '̢', '̧', - '̨', '̴', '̵', '̶', - '͜', '͝', '͞', - '͟', '͠', '͢', '̸', - '̷', '͡', ' ҉', - ], - }; - var all = [].concat(soul.up, soul.down, soul.mid); - - function randomNumber(range) { - var r = Math.floor(Math.random() * range); - return r; - } - - function isChar(character) { - var bool = false; - all.filter(function(i) { - bool = (i === character); - }); - return bool; - } - - - function heComes(text, options) { - var result = ''; - var counts; - var l; - options = options || {}; - options['up'] = - typeof options['up'] !== 'undefined' ? options['up'] : true; - options['mid'] = - typeof options['mid'] !== 'undefined' ? options['mid'] : true; - options['down'] = - typeof options['down'] !== 'undefined' ? options['down'] : true; - options['size'] = - typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; - text = text.split(''); - for (l in text) { - if (isChar(l)) { - continue; - } - result = result + text[l]; - counts = {'up': 0, 'down': 0, 'mid': 0}; - switch (options.size) { - case 'mini': - counts.up = randomNumber(8); - counts.mid = randomNumber(2); - counts.down = randomNumber(8); - break; - case 'maxi': - counts.up = randomNumber(16) + 3; - counts.mid = randomNumber(4) + 1; - counts.down = randomNumber(64) + 3; - break; - default: - counts.up = randomNumber(8) + 1; - counts.mid = randomNumber(6) / 2; - counts.down = randomNumber(8) + 1; - break; - } - - var arr = ['up', 'mid', 'down']; - for (var d in arr) { - var index = arr[d]; - for (var i = 0; i <= counts[index]; i++) { - if (options[index]) { - result = result + soul[index][randomNumber(soul[index].length)]; - } - } - } - } - return result; - } - // don't summon him - return heComes(text, options); -}; - - - -/***/ }), - -/***/ 2857: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var colors = __webpack_require__(43595); - -module['exports'] = function() { - // - // Extends prototype of native string object to allow for "foo".red syntax - // - var addProperty = function(color, func) { - String.prototype.__defineGetter__(color, func); - }; - - addProperty('strip', function() { - return colors.strip(this); - }); - - addProperty('stripColors', function() { - return colors.strip(this); - }); - - addProperty('trap', function() { - return colors.trap(this); - }); - - addProperty('zalgo', function() { - return colors.zalgo(this); - }); - - addProperty('zebra', function() { - return colors.zebra(this); - }); - - addProperty('rainbow', function() { - return colors.rainbow(this); - }); - - addProperty('random', function() { - return colors.random(this); - }); - - addProperty('america', function() { - return colors.america(this); - }); - - // - // Iterate through all default styles and colors - // - var x = Object.keys(colors.styles); - x.forEach(function(style) { - addProperty(style, function() { - return colors.stylize(this, style); - }); - }); - - function applyTheme(theme) { - // - // Remark: This is a list of methods that exist - // on String that you should not overwrite. - // - var stringPrototypeBlacklist = [ - '__defineGetter__', '__defineSetter__', '__lookupGetter__', - '__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty', - 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', - 'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length', - 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice', - 'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase', - 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', - ]; - - Object.keys(theme).forEach(function(prop) { - if (stringPrototypeBlacklist.indexOf(prop) !== -1) { - console.log('warn: '.red + ('String.prototype' + prop).magenta + - ' is probably something you don\'t want to override. ' + - 'Ignoring style name'); - } else { - if (typeof(theme[prop]) === 'string') { - colors[prop] = colors[theme[prop]]; - addProperty(prop, function() { - return colors[prop](this); - }); - } else { - var themePropApplicator = function(str) { - var ret = str || this; - for (var t = 0; t < theme[prop].length; t++) { - ret = colors[theme[prop][t]](ret); - } - return ret; - }; - addProperty(prop, themePropApplicator); - colors[prop] = function(str) { - return themePropApplicator(str); - }; - } - } - }); - } - - colors.setTheme = function(theme) { - if (typeof theme === 'string') { - console.log('colors.setTheme now only accepts an object, not a string. ' + - 'If you are trying to set a theme from a file, it is now your (the ' + - 'caller\'s) responsibility to require the file. The old syntax ' + - 'looked like colors.setTheme(__dirname + ' + - '\'/../themes/generic-logging.js\'); The new syntax looks like '+ - 'colors.setTheme(require(__dirname + ' + - '\'/../themes/generic-logging.js\'));'); - return; - } else { - applyTheme(theme); - } - }; -}; - - -/***/ }), - -/***/ 83045: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var colors = __webpack_require__(43595); -module['exports'] = colors; - -// Remark: By default, colors will add style properties to String.prototype. -// -// If you don't wish to extend String.prototype, you can do this instead and -// native String will not be touched: -// -// var colors = require('colors/safe); -// colors.red("foo") -// -// -__webpack_require__(2857)(); - - -/***/ }), - -/***/ 76936: -/***/ ((module) => { - -module['exports'] = function(colors) { - return function(letter, i, exploded) { - if (letter === ' ') return letter; - switch (i%3) { - case 0: return colors.red(letter); - case 1: return colors.white(letter); - case 2: return colors.blue(letter); - } - }; -}; - - -/***/ }), - -/***/ 75210: -/***/ ((module) => { - -module['exports'] = function(colors) { - // RoY G BiV - var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; - return function(letter, i, exploded) { - if (letter === ' ') { - return letter; - } else { - return colors[rainbowColors[i++ % rainbowColors.length]](letter); - } - }; -}; - - - -/***/ }), - -/***/ 13441: -/***/ ((module) => { - -module['exports'] = function(colors) { - var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', - 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', - 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; - return function(letter, i, exploded) { - return letter === ' ' ? letter : - colors[ - available[Math.round(Math.random() * (available.length - 2))] - ](letter); - }; -}; - - -/***/ }), - -/***/ 12989: -/***/ ((module) => { - -module['exports'] = function(colors) { - return function(letter, i, exploded) { - return i % 2 === 0 ? letter : colors.inverse(letter); - }; -}; - - -/***/ }), - -/***/ 73104: -/***/ ((module) => { - -/* -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var styles = {}; -module['exports'] = styles; - -var codes = { - reset: [0, 0], - - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], - - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], - grey: [90, 39], - - brightRed: [91, 39], - brightGreen: [92, 39], - brightYellow: [93, 39], - brightBlue: [94, 39], - brightMagenta: [95, 39], - brightCyan: [96, 39], - brightWhite: [97, 39], - - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - bgGray: [100, 49], - bgGrey: [100, 49], - - bgBrightRed: [101, 49], - bgBrightGreen: [102, 49], - bgBrightYellow: [103, 49], - bgBrightBlue: [104, 49], - bgBrightMagenta: [105, 49], - bgBrightCyan: [106, 49], - bgBrightWhite: [107, 49], - - // legacy styles for colors pre v1.0.0 - blackBG: [40, 49], - redBG: [41, 49], - greenBG: [42, 49], - yellowBG: [43, 49], - blueBG: [44, 49], - magentaBG: [45, 49], - cyanBG: [46, 49], - whiteBG: [47, 49], - -}; - -Object.keys(codes).forEach(function(key) { - var val = codes[key]; - var style = styles[key] = []; - style.open = '\u001b[' + val[0] + 'm'; - style.close = '\u001b[' + val[1] + 'm'; -}); - - -/***/ }), - -/***/ 10223: -/***/ ((module) => { - -"use strict"; -/* -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - - - -module.exports = function(flag, argv) { - argv = argv || process.argv; - - var terminatorPos = argv.indexOf('--'); - var prefix = /^-{1,2}/.test(flag) ? '' : '--'; - var pos = argv.indexOf(prefix + flag); - - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); -}; - - -/***/ }), - -/***/ 10662: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - - - -var os = __webpack_require__(12087); -var hasFlag = __webpack_require__(10223); - -var env = process.env; - -var forceColor = void 0; -if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') - || hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 - || parseInt(env.FORCE_COLOR, 10) !== 0; -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level: level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3, - }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - - if (hasFlag('color=16m') || hasFlag('color=full') - || hasFlag('color=truecolor')) { - return 3; - } - - if (hasFlag('color=256')) { - return 2; - } - - if (stream && !stream.isTTY && forceColor !== true) { - return 0; - } - - var min = forceColor ? 1 : 0; - - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first - // Windows release that supports 256 colors. Windows 10 build 14931 is the - // first release that supports 16m/TrueColor. - var osRelease = os.release().split('.'); - if (Number(process.versions.node.split('.')[0]) >= 8 - && 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'].some(function(sign) { - return 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 ('TERM_PROGRAM' in env) { - var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Hyper': - return 3; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - if (env.TERM === 'dumb') { - return min; - } - - return min; -} - -function getSupportLevel(stream) { - var level = supportsColor(stream); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr), -}; - - -/***/ }), - -/***/ 72746: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -const cp = __webpack_require__(63129); -const parse = __webpack_require__(66855); -const enoent = __webpack_require__(44101); - -function spawn(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); - - // Spawn the child process - const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); - - // Hook into child process "exit" event to emit an error if the command - // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - enoent.hookChildProcess(spawned, parsed); - - return spawned; -} - -function spawnSync(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); - - // Spawn the child process - const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); - - // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); - - return result; -} - -module.exports = spawn; -module.exports.spawn = spawn; -module.exports.sync = spawnSync; - -module.exports._parse = parse; -module.exports._enoent = enoent; - - -/***/ }), - -/***/ 44101: -/***/ ((module) => { - -"use strict"; - - -const isWin = process.platform === 'win32'; - -function notFoundError(original, syscall) { - return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { - code: 'ENOENT', - errno: 'ENOENT', - syscall: `${syscall} ${original.command}`, - path: original.command, - spawnargs: original.args, - }); -} - -function hookChildProcess(cp, parsed) { - if (!isWin) { - return; - } - - const originalEmit = cp.emit; - - cp.emit = function (name, arg1) { - // If emitting "exit" event and exit code is 1, we need to check if - // the command exists and emit an "error" instead - // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 - if (name === 'exit') { - const err = verifyENOENT(arg1, parsed, 'spawn'); - - if (err) { - return originalEmit.call(cp, 'error', err); - } - } - - return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params - }; -} - -function verifyENOENT(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawn'); - } - - return null; -} - -function verifyENOENTSync(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawnSync'); - } - - return null; -} - -module.exports = { - hookChildProcess, - verifyENOENT, - verifyENOENTSync, - notFoundError, -}; - - -/***/ }), - -/***/ 66855: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -const path = __webpack_require__(85622); -const niceTry = __webpack_require__(38560); -const resolveCommand = __webpack_require__(87274); -const escape = __webpack_require__(34274); -const readShebang = __webpack_require__(41252); -const semver = __webpack_require__(21129); - -const isWin = process.platform === 'win32'; -const isExecutableRegExp = /\.(?:com|exe)$/i; -const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; - -// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0 -const supportsShellOption = niceTry(() => semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true)) || false; - -function detectShebang(parsed) { - parsed.file = resolveCommand(parsed); - - const shebang = parsed.file && readShebang(parsed.file); - - if (shebang) { - parsed.args.unshift(parsed.file); - parsed.command = shebang; - - return resolveCommand(parsed); - } - - return parsed.file; -} - -function parseNonShell(parsed) { - if (!isWin) { - return parsed; - } - - // Detect & add support for shebangs - const commandFile = detectShebang(parsed); - - // We don't need a shell if the command filename is an executable - const needsShell = !isExecutableRegExp.test(commandFile); - - // If a shell is required, use cmd.exe and take care of escaping everything correctly - // Note that `forceShell` is an hidden option used only in tests - if (parsed.options.forceShell || needsShell) { - // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` - // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument - // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, - // we need to double escape them - const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); - - // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) - // This is necessary otherwise it will always fail with ENOENT in those cases - parsed.command = path.normalize(parsed.command); - - // Escape command & arguments - parsed.command = escape.command(parsed.command); - parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); - - const shellCommand = [parsed.command].concat(parsed.args).join(' '); - - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.command = process.env.comspec || 'cmd.exe'; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } - - return parsed; -} - -function parseShell(parsed) { - // If node supports the shell option, there's no need to mimic its behavior - if (supportsShellOption) { - return parsed; - } - - // Mimic node shell option - // See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335 - const shellCommand = [parsed.command].concat(parsed.args).join(' '); - - if (isWin) { - parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe'; - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } else { - if (typeof parsed.options.shell === 'string') { - parsed.command = parsed.options.shell; - } else if (process.platform === 'android') { - parsed.command = '/system/bin/sh'; - } else { - parsed.command = '/bin/sh'; - } - - parsed.args = ['-c', shellCommand]; - } - - return parsed; -} - -function parse(command, args, options) { - // Normalize arguments, similar to nodejs - if (args && !Array.isArray(args)) { - options = args; - args = null; - } - - args = args ? args.slice(0) : []; // Clone array to avoid changing the original - options = Object.assign({}, options); // Clone object to avoid changing the original - - // Build our parsed object - const parsed = { - command, - args, - options, - file: undefined, - original: { - command, - args, - }, - }; - - // Delegate further parsing to shell or non-shell - return options.shell ? parseShell(parsed) : parseNonShell(parsed); -} - -module.exports = parse; - - -/***/ }), - -/***/ 34274: -/***/ ((module) => { - -"use strict"; - - -// See http://www.robvanderwoude.com/escapechars.php -const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; - -function escapeCommand(arg) { - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); - - return arg; -} - -function escapeArgument(arg, doubleEscapeMetaChars) { - // Convert to string - arg = `${arg}`; - - // Algorithm below is based on https://qntm.org/cmd - - // Sequence of backslashes followed by a double quote: - // double up all the backslashes and escape the double quote - arg = arg.replace(/(\\*)"/g, '$1$1\\"'); - - // Sequence of backslashes followed by the end of the string - // (which will become a double quote later): - // double up all the backslashes - arg = arg.replace(/(\\*)$/, '$1$1'); - - // All other backslashes occur literally - - // Quote the whole thing: - arg = `"${arg}"`; - - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); - - // Double escape meta chars if necessary - if (doubleEscapeMetaChars) { - arg = arg.replace(metaCharsRegExp, '^$1'); - } - - return arg; -} - -module.exports.command = escapeCommand; -module.exports.argument = escapeArgument; - - -/***/ }), - -/***/ 41252: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -const fs = __webpack_require__(35747); -const shebangCommand = __webpack_require__(67032); - -function readShebang(command) { - // Read the first 150 bytes from the file - const size = 150; - let buffer; - - if (Buffer.alloc) { - // Node.js v4.5+ / v5.10+ - buffer = Buffer.alloc(size); - } else { - // Old Node.js API - buffer = new Buffer(size); - buffer.fill(0); // zero-fill - } - - let fd; - - try { - fd = fs.openSync(command, 'r'); - fs.readSync(fd, buffer, 0, size, 0); - fs.closeSync(fd); - } catch (e) { /* Empty */ } - - // Attempt to extract shebang (null is returned if not a shebang) - return shebangCommand(buffer.toString()); -} - -module.exports = readShebang; - - -/***/ }), - -/***/ 87274: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -const path = __webpack_require__(85622); -const which = __webpack_require__(34207); -const pathKey = __webpack_require__(20539)(); - -function resolveCommandAttempt(parsed, withoutPathExt) { - const cwd = process.cwd(); - const hasCustomCwd = parsed.options.cwd != null; - - // If a custom `cwd` was specified, we need to change the process cwd - // because `which` will do stat calls but does not support a custom cwd - if (hasCustomCwd) { - try { - process.chdir(parsed.options.cwd); - } catch (err) { - /* Empty */ - } - } - - let resolved; - - try { - resolved = which.sync(parsed.command, { - path: (parsed.options.env || process.env)[pathKey], - pathExt: withoutPathExt ? path.delimiter : undefined, - }); - } catch (e) { - /* Empty */ - } finally { - process.chdir(cwd); - } - - // If we successfully resolved, ensure that an absolute path is returned - // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it - if (resolved) { - resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); - } - - return resolved; -} - -function resolveCommand(parsed) { - return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); -} - -module.exports = resolveCommand; - - -/***/ }), - -/***/ 21129: -/***/ ((module, exports) => { - -exports = module.exports = SemVer - -var debug -/* istanbul ignore next */ -if (typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0) - args.unshift('SEMVER') - console.log.apply(console, args) - } -} else { - debug = function () {} -} - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0' - -var MAX_LENGTH = 256 -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16 - -// The actual regexps go on exports.re -var re = exports.re = [] -var src = exports.src = [] -var R = 0 - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -var NUMERICIDENTIFIER = R++ -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' -var NUMERICIDENTIFIERLOOSE = R++ -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -var NONNUMERICIDENTIFIER = R++ -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' - -// ## Main Version -// Three dot-separated numeric identifiers. - -var MAINVERSION = R++ -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')' - -var MAINVERSIONLOOSE = R++ -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')' - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -var PRERELEASEIDENTIFIER = R++ -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')' - -var PRERELEASEIDENTIFIERLOOSE = R++ -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')' - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -var PRERELEASE = R++ -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' - -var PRERELEASELOOSE = R++ -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -var BUILDIDENTIFIER = R++ -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -var BUILD = R++ -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -var FULL = R++ -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?' - -src[FULL] = '^' + FULLPLAIN + '$' - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?' - -var LOOSE = R++ -src[LOOSE] = '^' + LOOSEPLAIN + '$' - -var GTLT = R++ -src[GTLT] = '((?:<|>)?=?)' - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++ -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' -var XRANGEIDENTIFIER = R++ -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' - -var XRANGEPLAIN = R++ -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?' - -var XRANGEPLAINLOOSE = R++ -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?' - -var XRANGE = R++ -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' -var XRANGELOOSE = R++ -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++ -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])' - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++ -src[LONETILDE] = '(?:~>?)' - -var TILDETRIM = R++ -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') -var tildeTrimReplace = '$1~' - -var TILDE = R++ -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' -var TILDELOOSE = R++ -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++ -src[LONECARET] = '(?:\\^)' - -var CARETTRIM = R++ -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') -var caretTrimReplace = '$1^' - -var CARET = R++ -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' -var CARETLOOSE = R++ -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++ -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' -var COMPARATOR = R++ -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++ -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' - -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') -var comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++ -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$' - -var HYPHENRANGELOOSE = R++ -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$' - -// Star ranges basically just allow anything at all. -var STAR = R++ -src[STAR] = '(<|>)?=?\\s*\\*' - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]) - if (!re[i]) { - re[i] = new RegExp(src[i]) - } -} - -exports.parse = parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - var r = options.loose ? re[LOOSE] : re[FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -exports.valid = valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} - -exports.clean = clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -exports.SemVer = SemVer - -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - 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') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - - var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) - - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } - - this.raw = version - - // these are actually numbers - 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') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() -} - -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.') - } - return this.version -} - -SemVer.prototype.toString = function () { - return this.version -} - -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return this.compareMain(other) || this.comparePre(other) -} - -SemVer.prototype.compareMain = function (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) -} - -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - 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 - } - - var i = 0 - do { - var a = this.prerelease[i] - var b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function (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': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - 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 is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - var i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - 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 -} - -exports.inc = inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } - - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} - -exports.diff = diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} - -exports.compareIdentifiers = compareIdentifiers - -var numeric = /^[0-9]+$/ -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var 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 -} - -exports.rcompareIdentifiers = rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} - -exports.major = major -function major (a, loose) { - return new SemVer(a, loose).major -} - -exports.minor = minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} - -exports.patch = patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} - -exports.compare = compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} - -exports.compareLoose = compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} - -exports.rcompare = rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} - -exports.sort = sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compare(a, b, loose) - }) -} - -exports.rsort = rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.rcompare(a, b, loose) - }) -} - -exports.gt = gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} - -exports.lt = lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} - -exports.eq = eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} - -exports.neq = neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} - -exports.gte = gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} - -exports.lte = lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} - -exports.cmp = cmp -function 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) - } -} - -exports.Comparator = Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } - - 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) -} - -var ANY = {} -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var m = comp.match(r) - - if (!m) { - throw new TypeError('Invalid comparator: ' + comp) - } - - this.operator = m[1] - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } -} - -Comparator.prototype.toString = function () { - return this.value -} - -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY) { - return true - } - - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } - - return cmp(version, this.operator, this.semver, this.options) -} - -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - var rangeTmp - - if (this.operator === '') { - rangeTmp = new Range(comp.value, options) - return satisfies(this.value, rangeTmp, options) - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, options) - return satisfies(comp.semver, rangeTmp, options) - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - var sameSemVer = this.semver.version === comp.semver.version - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')) - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')) - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan -} - -exports.Range = Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - 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) { - return new Range(range.value, options) - } - - if (!(this instanceof Range)) { - return new Range(range, options) - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First, split based on boolean or || - this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) - } - - this.format() -} - -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim() - }).join('||').trim() - return this.range -} - -Range.prototype.toString = function () { - return this.range -} - -Range.prototype.parseRange = function (range) { - var loose = this.options.loose - range = range.trim() - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] - range = range.replace(hr, hyphenReplace) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options) - }, this).join(' ').split(/\s+/) - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe) - }) - } - set = set.map(function (comp) { - return new Comparator(comp, this.options) - }, this) - - return set -} - -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some(function (thisComparators) { - return thisComparators.every(function (thisComparator) { - return range.set.some(function (rangeComparators) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options) - }) - }) - }) - }) -} - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function 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 -} - -function isX (id) { - return !id || id.toLowerCase() === 'x' || id === '*' -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options) - }).join(' ') -} - -function replaceTilde (comp, options) { - var r = options.loose ? re[TILDELOOSE] : re[TILDE] - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else if (pr) { - debug('replaceTilde pr', pr) - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options) - }).join(' ') -} - -function replaceCaret (comp, options) { - debug('caret', comp, options) - var r = options.loose ? re[CARETLOOSE] : re[CARET] - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + (+M + 1) + '.0.0' - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0' - } - } - - debug('caret return', ret) - return ret - }) -} - -function replaceXRanges (comp, options) { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options) - }).join(' ') -} - -function replaceXRange (comp, options) { - comp = comp.trim() - var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - var xM = isX(M) - var xm = xM || isX(m) - var xp = xm || isX(p) - var anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - ret = gtlt + M + '.' + m + '.' + p - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars (comp, options) { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], '') -} - -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace ($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' - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0' - } else { - from = '>=' + from - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0' - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0' - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr - } else { - to = '<=' + to - } - - return (from + ' ' + to).trim() -} - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false -} - -function testSet (set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - -exports.satisfies = satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} - -exports.maxSatisfying = maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} - -exports.minSatisfying = minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} - -exports.minVersion = minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - - var 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 (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var 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() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} - -exports.validRange = validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} - -exports.outside = outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) - - var 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 it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - var high = null - var low = null - - comparators.forEach(function (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 the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - 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 -} - -exports.prerelease = prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} - -exports.intersects = intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -exports.coerce = coerce -function coerce (version) { - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - var match = version.match(re[COERCE]) - - if (match == null) { - return null - } - - return parse(match[1] + - '.' + (match[2] || '0') + - '.' + (match[3] || '0')) -} - - -/***/ }), - -/***/ 28222: -/***/ ((module, exports, __webpack_require__) => { - -/* eslint-env browser */ - -/** - * This is the web browser implementation of `debug()`. - */ - -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); -exports.destroy = (() => { - let warned = false; - - return () => { - if (!warned) { - warned = 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`.'); - } - }; -})(); - -/** - * Colors. - */ - -exports.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' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -// eslint-disable-next-line complexity -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } - - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - - // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - 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 && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$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+)/)); -} - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + - this.namespace + - (this.useColors ? ' %c' : ' ') + - args[0] + - (this.useColors ? '%c ' : ' ') + - '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - const c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); - - // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, match => { - if (match === '%%') { - return; - } - index++; - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); -} - -/** - * Invokes `console.debug()` when available. - * No-op when `console.debug` is not a "function". - * If `console.debug` is not available, falls back - * to `console.log`. - * - * @api public - */ -exports.log = console.debug || console.log || (() => {}); - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ -function load() { - let r; - try { - r = exports.storage.getItem('debug'); - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } - - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} - -module.exports = __webpack_require__(46243)(exports); - -const {formatters} = module.exports; - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -}; - - -/***/ }), - -/***/ 46243: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = __webpack_require__(80900); - createDebug.destroy = destroy; - - Object.keys(env).forEach(key => { - createDebug[key] = env[key]; - }); - - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - createDebug.formatters = {}; - - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - function selectColor(namespace) { - let hash = 0; - - for (let i = 0; i < namespace.length; i++) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - - function debug(...args) { - // Disabled? - if (!debug.enabled) { - return; - } - - const self = debug; - - // Set `diff` timestamp - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } - - // Apply any `formatters` transformations - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return '%'; - } - index++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === 'function') { - const val = args[index]; - match = formatter.call(self, val); - - // Now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // Apply env-specific formatting (colors, etc.) - createDebug.formatArgs.call(self, args); - - const logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.extend = extend; - debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. - - Object.defineProperty(debug, 'enabled', { - enumerable: true, - configurable: false, - get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, - set: v => { - enableOverride = v; - } - }); - - // Env-specific initialization logic for debug instances - 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; - } - - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - function enable(namespaces) { - createDebug.save(namespaces); - - createDebug.names = []; - createDebug.skips = []; - - let i; - const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - const len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - } - - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) - ].join(','); - createDebug.enable(''); - return namespaces; - } - - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - let i; - let len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - function toNamespace(regexp) { - return regexp.toString() - .substring(2, regexp.toString().length - 2) - .replace(/\.\*\?$/, '*'); - } - - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - - /** - * XXX DO NOT USE. This is a temporary stub function. - * XXX It WILL be removed in the next major release. - */ - 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; -} - -module.exports = setup; - - -/***/ }), - -/***/ 38237: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/** - * Detect Electron renderer / nwjs process, which is node, but we should - * treat as a browser. - */ - -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = __webpack_require__(28222); -} else { - module.exports = __webpack_require__(35332); -} - - -/***/ }), - -/***/ 35332: -/***/ ((module, exports, __webpack_require__) => { - -/** - * Module dependencies. - */ - -const tty = __webpack_require__(33867); -const util = __webpack_require__(31669); - -/** - * This is the Node.js implementation of `debug()`. - */ - -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.destroy = util.deprecate( - () => {}, - 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' -); - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = __webpack_require__(59318); - - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.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) { - // Swallow - we only care if `supports-color` is available; it doesn't have to be. -} - -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ - -exports.inspectOpts = Object.keys(process.env).filter(key => { - return /^debug_/i.test(key); -}).reduce((obj, key) => { - // Camel-case - const prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, (_, k) => { - return k.toUpperCase(); - }); - - // Coerce string value into JS value - 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; -}, {}); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - return 'colors' in exports.inspectOpts ? - Boolean(exports.inspectOpts.colors) : - tty.isatty(process.stderr.fd); -} - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs(args) { - const {namespace: name, useColors} = this; - - if (useColors) { - const c = this.color; - const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); - const prefix = ` ${colorCode};1m${name} \u001B[0m`; - - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - return new Date().toISOString() + ' '; -} - -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ - -function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ - -function init(debug) { - debug.inspectOpts = {}; - - const keys = Object.keys(exports.inspectOpts); - for (let i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } -} - -module.exports = __webpack_require__(46243)(exports); - -const {formatters} = module.exports; - -/** - * Map %o to `util.inspect()`, all on a single line. - */ - -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .split('\n') - .map(str => str.trim()) - .join(' '); -}; - -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ - -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; - - -/***/ }), - -/***/ 18212: -/***/ ((module) => { - -"use strict"; - - -module.exports = function () { - // https://mths.be/emoji - return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; -}; - - -/***/ }), - -/***/ 98691: -/***/ ((module) => { - -"use strict"; - - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - return str.replace(matchOperatorsRe, '\\$&'); -}; - - -/***/ }), - -/***/ 78823: -/***/ (function(module) { - -(function webpackUniversalModuleDefinition(root, factory) { -/* istanbul ignore next */ - if(true) - module.exports = factory(); - else {} -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __nested_webpack_require_583__(moduleId) { - -/******/ // Check if module is in cache -/* istanbul ignore if */ -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_583__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __nested_webpack_require_583__.m = modules; - -/******/ // expose the module cache -/******/ __nested_webpack_require_583__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __nested_webpack_require_583__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __nested_webpack_require_583__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __nested_webpack_require_1808__) { - - "use strict"; - /* - Copyright JS Foundation and other contributors, https://js.foundation/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - Object.defineProperty(exports, "__esModule", { value: true }); - var comment_handler_1 = __nested_webpack_require_1808__(1); - var jsx_parser_1 = __nested_webpack_require_1808__(3); - var parser_1 = __nested_webpack_require_1808__(8); - var tokenizer_1 = __nested_webpack_require_1808__(15); - function parse(code, options, delegate) { - var commentHandler = null; - var proxyDelegate = function (node, metadata) { - if (delegate) { - delegate(node, metadata); - } - if (commentHandler) { - commentHandler.visit(node, metadata); - } - }; - var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; - var collectComment = false; - if (options) { - collectComment = (typeof options.comment === 'boolean' && options.comment); - var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); - if (collectComment || attachComment) { - commentHandler = new comment_handler_1.CommentHandler(); - commentHandler.attach = attachComment; - options.comment = true; - parserDelegate = proxyDelegate; - } - } - var isModule = false; - if (options && typeof options.sourceType === 'string') { - isModule = (options.sourceType === 'module'); - } - var parser; - if (options && typeof options.jsx === 'boolean' && options.jsx) { - parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); - } - else { - parser = new parser_1.Parser(code, options, parserDelegate); - } - var program = isModule ? parser.parseModule() : parser.parseScript(); - var ast = program; - if (collectComment && commentHandler) { - ast.comments = commentHandler.comments; - } - if (parser.config.tokens) { - ast.tokens = parser.tokens; - } - if (parser.config.tolerant) { - ast.errors = parser.errorHandler.errors; - } - return ast; - } - exports.parse = parse; - function parseModule(code, options, delegate) { - var parsingOptions = options || {}; - parsingOptions.sourceType = 'module'; - return parse(code, parsingOptions, delegate); - } - exports.parseModule = parseModule; - function parseScript(code, options, delegate) { - var parsingOptions = options || {}; - parsingOptions.sourceType = 'script'; - return parse(code, parsingOptions, delegate); - } - exports.parseScript = parseScript; - function tokenize(code, options, delegate) { - var tokenizer = new tokenizer_1.Tokenizer(code, options); - var tokens; - tokens = []; - try { - while (true) { - var token = tokenizer.getNextToken(); - if (!token) { - break; - } - if (delegate) { - token = delegate(token); - } - tokens.push(token); - } - } - catch (e) { - tokenizer.errorHandler.tolerate(e); - } - if (tokenizer.errorHandler.tolerant) { - tokens.errors = tokenizer.errors(); - } - return tokens; - } - exports.tokenize = tokenize; - var syntax_1 = __nested_webpack_require_1808__(2); - exports.Syntax = syntax_1.Syntax; - // Sync with *.json manifests. - exports.version = '4.0.1'; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __nested_webpack_require_6456__) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var syntax_1 = __nested_webpack_require_6456__(2); - var CommentHandler = (function () { - function CommentHandler() { - this.attach = false; - this.comments = []; - this.stack = []; - this.leading = []; - this.trailing = []; - } - CommentHandler.prototype.insertInnerComments = function (node, metadata) { - // innnerComments for properties empty block - // `function a() {/** comments **\/}` - if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { - var innerComments = []; - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this.leading[i]; - if (metadata.end.offset >= entry.start) { - innerComments.unshift(entry.comment); - this.leading.splice(i, 1); - this.trailing.splice(i, 1); - } - } - if (innerComments.length) { - node.innerComments = innerComments; - } - } - }; - CommentHandler.prototype.findTrailingComments = function (metadata) { - var trailingComments = []; - if (this.trailing.length > 0) { - for (var i = this.trailing.length - 1; i >= 0; --i) { - var entry_1 = this.trailing[i]; - if (entry_1.start >= metadata.end.offset) { - trailingComments.unshift(entry_1.comment); - } - } - this.trailing.length = 0; - return trailingComments; - } - var entry = this.stack[this.stack.length - 1]; - if (entry && entry.node.trailingComments) { - var firstComment = entry.node.trailingComments[0]; - if (firstComment && firstComment.range[0] >= metadata.end.offset) { - trailingComments = entry.node.trailingComments; - delete entry.node.trailingComments; - } - } - return trailingComments; - }; - CommentHandler.prototype.findLeadingComments = function (metadata) { - var leadingComments = []; - var target; - while (this.stack.length > 0) { - var entry = this.stack[this.stack.length - 1]; - if (entry && entry.start >= metadata.start.offset) { - target = entry.node; - this.stack.pop(); - } - else { - break; - } - } - if (target) { - var count = target.leadingComments ? target.leadingComments.length : 0; - for (var i = count - 1; i >= 0; --i) { - var comment = target.leadingComments[i]; - if (comment.range[1] <= metadata.start.offset) { - leadingComments.unshift(comment); - target.leadingComments.splice(i, 1); - } - } - if (target.leadingComments && target.leadingComments.length === 0) { - delete target.leadingComments; - } - return leadingComments; - } - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this.leading[i]; - if (entry.start <= metadata.start.offset) { - leadingComments.unshift(entry.comment); - this.leading.splice(i, 1); - } - } - return leadingComments; - }; - CommentHandler.prototype.visitNode = function (node, metadata) { - if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { - return; - } - this.insertInnerComments(node, metadata); - var trailingComments = this.findTrailingComments(metadata); - var leadingComments = this.findLeadingComments(metadata); - if (leadingComments.length > 0) { - node.leadingComments = leadingComments; - } - if (trailingComments.length > 0) { - node.trailingComments = trailingComments; - } - this.stack.push({ - node: node, - start: metadata.start.offset - }); - }; - CommentHandler.prototype.visitComment = function (node, metadata) { - var type = (node.type[0] === 'L') ? 'Line' : 'Block'; - var comment = { - type: type, - value: node.value - }; - if (node.range) { - comment.range = node.range; - } - if (node.loc) { - comment.loc = node.loc; - } - this.comments.push(comment); - if (this.attach) { - var entry = { - comment: { - type: type, - value: node.value, - range: [metadata.start.offset, metadata.end.offset] - }, - start: metadata.start.offset - }; - if (node.loc) { - entry.comment.loc = node.loc; - } - node.type = type; - this.leading.push(entry); - this.trailing.push(entry); - } - }; - CommentHandler.prototype.visit = function (node, metadata) { - if (node.type === 'LineComment') { - this.visitComment(node, metadata); - } - else if (node.type === 'BlockComment') { - this.visitComment(node, metadata); - } - else if (this.attach) { - this.visitNode(node, metadata); - } - }; - return CommentHandler; - }()); - exports.CommentHandler = CommentHandler; - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DoWhileStatement: 'DoWhileStatement', - DebuggerStatement: 'DebuggerStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForOfStatement: 'ForOfStatement', - ForInStatement: 'ForInStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchCase: 'SwitchCase', - SwitchStatement: 'SwitchStatement', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - - -/***/ }, -/* 3 */ -/***/ function(module, exports, __nested_webpack_require_15019__) { +/***/ }, +/* 3 */ +/***/ function(module, exports, __nested_webpack_require_15019__) { "use strict"; /* istanbul ignore next */ @@ -36987,1143 +28774,2678 @@ return /******/ (function(modules) { // webpackBootstrap if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); } - str += ch; - } - else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { - this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); - } - else if (classMarker) { - if (ch === ']') { - classMarker = false; + str += ch; + } + else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { + this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); + } + else if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } + else { + if (ch === '/') { + terminated = true; + break; + } + else if (ch === '[') { + classMarker = true; + } + } + } + if (!terminated) { + this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); + } + // Exclude leading and trailing slash. + return str.substr(1, str.length - 2); + }; + Scanner.prototype.scanRegExpFlags = function () { + var str = ''; + var flags = ''; + while (!this.eof()) { + var ch = this.source[this.index]; + if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) { + break; + } + ++this.index; + if (ch === '\\' && !this.eof()) { + ch = this.source[this.index]; + if (ch === 'u') { + ++this.index; + var restore = this.index; + var char = this.scanHexEscape('u'); + if (char !== null) { + flags += char; + for (str += '\\u'; restore < this.index; ++restore) { + str += this.source[restore]; + } + } + else { + this.index = restore; + flags += 'u'; + str += '\\u'; + } + this.tolerateUnexpectedToken(); + } + else { + str += '\\'; + this.tolerateUnexpectedToken(); + } + } + else { + flags += ch; + str += ch; + } + } + return flags; + }; + Scanner.prototype.scanRegExp = function () { + var start = this.index; + var pattern = this.scanRegExpBody(); + var flags = this.scanRegExpFlags(); + var value = this.testRegExp(pattern, flags); + return { + type: 9 /* RegularExpression */, + value: '', + pattern: pattern, + flags: flags, + regex: value, + lineNumber: this.lineNumber, + lineStart: this.lineStart, + start: start, + end: this.index + }; + }; + Scanner.prototype.lex = function () { + if (this.eof()) { + return { + type: 2 /* EOF */, + value: '', + lineNumber: this.lineNumber, + lineStart: this.lineStart, + start: this.index, + end: this.index + }; + } + var cp = this.source.charCodeAt(this.index); + if (character_1.Character.isIdentifierStart(cp)) { + return this.scanIdentifier(); + } + // Very common: ( and ) and ; + if (cp === 0x28 || cp === 0x29 || cp === 0x3B) { + return this.scanPunctuator(); + } + // String literal starts with single quote (U+0027) or double quote (U+0022). + if (cp === 0x27 || cp === 0x22) { + return this.scanStringLiteral(); + } + // Dot (.) U+002E can also start a floating-point number, hence the need + // to check the next character. + if (cp === 0x2E) { + if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) { + return this.scanNumericLiteral(); + } + return this.scanPunctuator(); + } + if (character_1.Character.isDecimalDigit(cp)) { + return this.scanNumericLiteral(); + } + // Template literals start with ` (U+0060) for template head + // or } (U+007D) for template middle or template tail. + if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) { + return this.scanTemplate(); + } + // Possible identifier start in a surrogate pair. + if (cp >= 0xD800 && cp < 0xDFFF) { + if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) { + return this.scanIdentifier(); + } + } + return this.scanPunctuator(); + }; + return Scanner; + }()); + exports.Scanner = Scanner; + + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TokenName = {}; + exports.TokenName[1 /* BooleanLiteral */] = 'Boolean'; + exports.TokenName[2 /* EOF */] = ''; + exports.TokenName[3 /* Identifier */] = 'Identifier'; + exports.TokenName[4 /* Keyword */] = 'Keyword'; + exports.TokenName[5 /* NullLiteral */] = 'Null'; + exports.TokenName[6 /* NumericLiteral */] = 'Numeric'; + exports.TokenName[7 /* Punctuator */] = 'Punctuator'; + exports.TokenName[8 /* StringLiteral */] = 'String'; + exports.TokenName[9 /* RegularExpression */] = 'RegularExpression'; + exports.TokenName[10 /* Template */] = 'Template'; + + +/***/ }, +/* 14 */ +/***/ function(module, exports) { + + "use strict"; + // Generated by generate-xhtml-entities.js. DO NOT MODIFY! + Object.defineProperty(exports, "__esModule", { value: true }); + exports.XHTMLEntities = { + quot: '\u0022', + amp: '\u0026', + apos: '\u0027', + gt: '\u003E', + nbsp: '\u00A0', + iexcl: '\u00A1', + cent: '\u00A2', + pound: '\u00A3', + curren: '\u00A4', + yen: '\u00A5', + brvbar: '\u00A6', + sect: '\u00A7', + uml: '\u00A8', + copy: '\u00A9', + ordf: '\u00AA', + laquo: '\u00AB', + not: '\u00AC', + shy: '\u00AD', + reg: '\u00AE', + macr: '\u00AF', + deg: '\u00B0', + plusmn: '\u00B1', + sup2: '\u00B2', + sup3: '\u00B3', + acute: '\u00B4', + micro: '\u00B5', + para: '\u00B6', + middot: '\u00B7', + cedil: '\u00B8', + sup1: '\u00B9', + ordm: '\u00BA', + raquo: '\u00BB', + frac14: '\u00BC', + frac12: '\u00BD', + frac34: '\u00BE', + iquest: '\u00BF', + Agrave: '\u00C0', + Aacute: '\u00C1', + Acirc: '\u00C2', + Atilde: '\u00C3', + Auml: '\u00C4', + Aring: '\u00C5', + AElig: '\u00C6', + Ccedil: '\u00C7', + Egrave: '\u00C8', + Eacute: '\u00C9', + Ecirc: '\u00CA', + Euml: '\u00CB', + Igrave: '\u00CC', + Iacute: '\u00CD', + Icirc: '\u00CE', + Iuml: '\u00CF', + ETH: '\u00D0', + Ntilde: '\u00D1', + Ograve: '\u00D2', + Oacute: '\u00D3', + Ocirc: '\u00D4', + Otilde: '\u00D5', + Ouml: '\u00D6', + times: '\u00D7', + Oslash: '\u00D8', + Ugrave: '\u00D9', + Uacute: '\u00DA', + Ucirc: '\u00DB', + Uuml: '\u00DC', + Yacute: '\u00DD', + THORN: '\u00DE', + szlig: '\u00DF', + agrave: '\u00E0', + aacute: '\u00E1', + acirc: '\u00E2', + atilde: '\u00E3', + auml: '\u00E4', + aring: '\u00E5', + aelig: '\u00E6', + ccedil: '\u00E7', + egrave: '\u00E8', + eacute: '\u00E9', + ecirc: '\u00EA', + euml: '\u00EB', + igrave: '\u00EC', + iacute: '\u00ED', + icirc: '\u00EE', + iuml: '\u00EF', + eth: '\u00F0', + ntilde: '\u00F1', + ograve: '\u00F2', + oacute: '\u00F3', + ocirc: '\u00F4', + otilde: '\u00F5', + ouml: '\u00F6', + divide: '\u00F7', + oslash: '\u00F8', + ugrave: '\u00F9', + uacute: '\u00FA', + ucirc: '\u00FB', + uuml: '\u00FC', + yacute: '\u00FD', + thorn: '\u00FE', + yuml: '\u00FF', + OElig: '\u0152', + oelig: '\u0153', + Scaron: '\u0160', + scaron: '\u0161', + Yuml: '\u0178', + fnof: '\u0192', + circ: '\u02C6', + tilde: '\u02DC', + Alpha: '\u0391', + Beta: '\u0392', + Gamma: '\u0393', + Delta: '\u0394', + Epsilon: '\u0395', + Zeta: '\u0396', + Eta: '\u0397', + Theta: '\u0398', + Iota: '\u0399', + Kappa: '\u039A', + Lambda: '\u039B', + Mu: '\u039C', + Nu: '\u039D', + Xi: '\u039E', + Omicron: '\u039F', + Pi: '\u03A0', + Rho: '\u03A1', + Sigma: '\u03A3', + Tau: '\u03A4', + Upsilon: '\u03A5', + Phi: '\u03A6', + Chi: '\u03A7', + Psi: '\u03A8', + Omega: '\u03A9', + alpha: '\u03B1', + beta: '\u03B2', + gamma: '\u03B3', + delta: '\u03B4', + epsilon: '\u03B5', + zeta: '\u03B6', + eta: '\u03B7', + theta: '\u03B8', + iota: '\u03B9', + kappa: '\u03BA', + lambda: '\u03BB', + mu: '\u03BC', + nu: '\u03BD', + xi: '\u03BE', + omicron: '\u03BF', + pi: '\u03C0', + rho: '\u03C1', + sigmaf: '\u03C2', + sigma: '\u03C3', + tau: '\u03C4', + upsilon: '\u03C5', + phi: '\u03C6', + chi: '\u03C7', + psi: '\u03C8', + omega: '\u03C9', + thetasym: '\u03D1', + upsih: '\u03D2', + piv: '\u03D6', + ensp: '\u2002', + emsp: '\u2003', + thinsp: '\u2009', + zwnj: '\u200C', + zwj: '\u200D', + lrm: '\u200E', + rlm: '\u200F', + ndash: '\u2013', + mdash: '\u2014', + lsquo: '\u2018', + rsquo: '\u2019', + sbquo: '\u201A', + ldquo: '\u201C', + rdquo: '\u201D', + bdquo: '\u201E', + dagger: '\u2020', + Dagger: '\u2021', + bull: '\u2022', + hellip: '\u2026', + permil: '\u2030', + prime: '\u2032', + Prime: '\u2033', + lsaquo: '\u2039', + rsaquo: '\u203A', + oline: '\u203E', + frasl: '\u2044', + euro: '\u20AC', + image: '\u2111', + weierp: '\u2118', + real: '\u211C', + trade: '\u2122', + alefsym: '\u2135', + larr: '\u2190', + uarr: '\u2191', + rarr: '\u2192', + darr: '\u2193', + harr: '\u2194', + crarr: '\u21B5', + lArr: '\u21D0', + uArr: '\u21D1', + rArr: '\u21D2', + dArr: '\u21D3', + hArr: '\u21D4', + forall: '\u2200', + part: '\u2202', + exist: '\u2203', + empty: '\u2205', + nabla: '\u2207', + isin: '\u2208', + notin: '\u2209', + ni: '\u220B', + prod: '\u220F', + sum: '\u2211', + minus: '\u2212', + lowast: '\u2217', + radic: '\u221A', + prop: '\u221D', + infin: '\u221E', + ang: '\u2220', + and: '\u2227', + or: '\u2228', + cap: '\u2229', + cup: '\u222A', + int: '\u222B', + there4: '\u2234', + sim: '\u223C', + cong: '\u2245', + asymp: '\u2248', + ne: '\u2260', + equiv: '\u2261', + le: '\u2264', + ge: '\u2265', + sub: '\u2282', + sup: '\u2283', + nsub: '\u2284', + sube: '\u2286', + supe: '\u2287', + oplus: '\u2295', + otimes: '\u2297', + perp: '\u22A5', + sdot: '\u22C5', + lceil: '\u2308', + rceil: '\u2309', + lfloor: '\u230A', + rfloor: '\u230B', + loz: '\u25CA', + spades: '\u2660', + clubs: '\u2663', + hearts: '\u2665', + diams: '\u2666', + lang: '\u27E8', + rang: '\u27E9' + }; + + +/***/ }, +/* 15 */ +/***/ function(module, exports, __nested_webpack_require_277122__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var error_handler_1 = __nested_webpack_require_277122__(10); + var scanner_1 = __nested_webpack_require_277122__(12); + var token_1 = __nested_webpack_require_277122__(13); + var Reader = (function () { + function Reader() { + this.values = []; + this.curly = this.paren = -1; + } + // A function following one of those tokens is an expression. + Reader.prototype.beforeFunctionExpression = function (t) { + return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new', + 'return', 'case', 'delete', 'throw', 'void', + // assignment operators + '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', + '&=', '|=', '^=', ',', + // binary/unary operators + '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&', + '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=', + '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0; + }; + // Determine if forward slash (/) is an operator or part of a regular expression + // https://github.com/mozilla/sweet.js/wiki/design + Reader.prototype.isRegexStart = function () { + var previous = this.values[this.values.length - 1]; + var regex = (previous !== null); + switch (previous) { + case 'this': + case ']': + regex = false; + break; + case ')': + var keyword = this.values[this.paren - 1]; + regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with'); + break; + case '}': + // Dividing a function by anything makes little sense, + // but we have to check for that. + regex = false; + if (this.values[this.curly - 3] === 'function') { + // Anonymous function, e.g. function(){} /42 + var check = this.values[this.curly - 4]; + regex = check ? !this.beforeFunctionExpression(check) : false; + } + else if (this.values[this.curly - 4] === 'function') { + // Named function, e.g. function f(){} /42/ + var check = this.values[this.curly - 5]; + regex = check ? !this.beforeFunctionExpression(check) : true; } + break; + default: + break; + } + return regex; + }; + Reader.prototype.push = function (token) { + if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) { + if (token.value === '{') { + this.curly = this.values.length; } - else { - if (ch === '/') { - terminated = true; - break; - } - else if (ch === '[') { - classMarker = true; - } + else if (token.value === '(') { + this.paren = this.values.length; } + this.values.push(token.value); } - if (!terminated) { - this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); + else { + this.values.push(null); } - // Exclude leading and trailing slash. - return str.substr(1, str.length - 2); }; - Scanner.prototype.scanRegExpFlags = function () { - var str = ''; - var flags = ''; - while (!this.eof()) { - var ch = this.source[this.index]; - if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) { - break; - } - ++this.index; - if (ch === '\\' && !this.eof()) { - ch = this.source[this.index]; - if (ch === 'u') { - ++this.index; - var restore = this.index; - var char = this.scanHexEscape('u'); - if (char !== null) { - flags += char; - for (str += '\\u'; restore < this.index; ++restore) { - str += this.source[restore]; - } + return Reader; + }()); + var Tokenizer = (function () { + function Tokenizer(code, config) { + this.errorHandler = new error_handler_1.ErrorHandler(); + this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false; + this.scanner = new scanner_1.Scanner(code, this.errorHandler); + this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false; + this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false; + this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false; + this.buffer = []; + this.reader = new Reader(); + } + Tokenizer.prototype.errors = function () { + return this.errorHandler.errors; + }; + Tokenizer.prototype.getNextToken = function () { + if (this.buffer.length === 0) { + var comments = this.scanner.scanComments(); + if (this.scanner.trackComment) { + for (var i = 0; i < comments.length; ++i) { + var e = comments[i]; + var value = this.scanner.source.slice(e.slice[0], e.slice[1]); + var comment = { + type: e.multiLine ? 'BlockComment' : 'LineComment', + value: value + }; + if (this.trackRange) { + comment.range = e.range; } - else { - this.index = restore; - flags += 'u'; - str += '\\u'; + if (this.trackLoc) { + comment.loc = e.loc; } - this.tolerateUnexpectedToken(); - } - else { - str += '\\'; - this.tolerateUnexpectedToken(); + this.buffer.push(comment); } } - else { - flags += ch; - str += ch; - } - } - return flags; - }; - Scanner.prototype.scanRegExp = function () { - var start = this.index; - var pattern = this.scanRegExpBody(); - var flags = this.scanRegExpFlags(); - var value = this.testRegExp(pattern, flags); - return { - type: 9 /* RegularExpression */, - value: '', - pattern: pattern, - flags: flags, - regex: value, - lineNumber: this.lineNumber, - lineStart: this.lineStart, - start: start, - end: this.index - }; - }; - Scanner.prototype.lex = function () { - if (this.eof()) { - return { - type: 2 /* EOF */, - value: '', - lineNumber: this.lineNumber, - lineStart: this.lineStart, - start: this.index, - end: this.index - }; - } - var cp = this.source.charCodeAt(this.index); - if (character_1.Character.isIdentifierStart(cp)) { - return this.scanIdentifier(); - } - // Very common: ( and ) and ; - if (cp === 0x28 || cp === 0x29 || cp === 0x3B) { - return this.scanPunctuator(); - } - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (cp === 0x27 || cp === 0x22) { - return this.scanStringLiteral(); - } - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (cp === 0x2E) { - if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) { - return this.scanNumericLiteral(); - } - return this.scanPunctuator(); - } - if (character_1.Character.isDecimalDigit(cp)) { - return this.scanNumericLiteral(); - } - // Template literals start with ` (U+0060) for template head - // or } (U+007D) for template middle or template tail. - if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) { - return this.scanTemplate(); - } - // Possible identifier start in a surrogate pair. - if (cp >= 0xD800 && cp < 0xDFFF) { - if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) { - return this.scanIdentifier(); + if (!this.scanner.eof()) { + var loc = void 0; + if (this.trackLoc) { + loc = { + start: { + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }, + end: {} + }; + } + var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart(); + var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex(); + this.reader.push(token); + var entry = { + type: token_1.TokenName[token.type], + value: this.scanner.source.slice(token.start, token.end) + }; + if (this.trackRange) { + entry.range = [token.start, token.end]; + } + if (this.trackLoc) { + loc.end = { + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + entry.loc = loc; + } + if (token.type === 9 /* RegularExpression */) { + var pattern = token.pattern; + var flags = token.flags; + entry.regex = { pattern: pattern, flags: flags }; + } + this.buffer.push(entry); } } - return this.scanPunctuator(); + return this.buffer.shift(); }; - return Scanner; + return Tokenizer; }()); - exports.Scanner = Scanner; + exports.Tokenizer = Tokenizer; + + +/***/ } +/******/ ]) +}); +; + +/***/ }), + +/***/ 31133: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var debug; + +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = __webpack_require__(38237)("follow-redirects"); + } + catch (error) { + debug = function () { /* */ }; + } + } + debug.apply(null, arguments); +}; + + +/***/ }), + +/***/ 67707: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var url = __webpack_require__(78835); +var URL = url.URL; +var http = __webpack_require__(15876); +var https = __webpack_require__(57211); +var Writable = __webpack_require__(92413).Writable; +var assert = __webpack_require__(42357); +var debug = __webpack_require__(31133); + +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); + +// Error types with codes +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded" +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + self._processResponse(response); + }; + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +RedirectableRequest.prototype.abort = function () { + abortRequest(this._currentRequest); + this.emit("abort"); +}; + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } + + // Validate input and shift parameters if necessary + if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (typeof encoding === "function") { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (typeof data === "function") { + callback = data; + data = encoding = null; + } + else if (typeof encoding === "function") { + callback = encoding; + encoding = null; + } + + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + if (callback) { + this.on("timeout", callback); + } + + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + + // Prevent a timeout from triggering + function clearTimer() { + clearTimeout(this._timeout); + if (callback) { + self.removeListener("timeout", callback); + } + if (!this.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } + + // Start the timer when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } + + this.on("socket", destroyOnTimeout); + this.once("response", clearTimer); + this.once("error", clearTimer); + + return this; +}; + +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } +}; + + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + this.emit("error", new TypeError("Unsupported protocol " + protocol)); + return; + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.substr(0, protocol.length - 1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + this._currentUrl = url.format(this._options); + + // Set up event handlers + request._redirectable = this; + for (var e = 0; e < events.length; e++) { + request.on(events[e], eventHandlers[events[e]]); + } + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end. + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + var location = response.headers.location; + if (location && this._options.followRedirects !== false && + statusCode >= 300 && statusCode < 400) { + // Abort the current request + abortRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + this.emit("error", new TooManyRedirectsError()); + return; + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + + // Drop the Host header, as the redirect might lead to a different host + var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || + url.parse(this._currentUrl).hostname; + + // Create the redirected request + var redirectUrl = url.resolve(this._currentUrl, location); + debug("redirecting to", redirectUrl); + this._isRedirect = true; + var redirectUrlParts = url.parse(redirectUrl); + Object.assign(this._options, redirectUrlParts); + + // Drop the Authorization header if redirecting to another host + if (redirectUrlParts.hostname !== previousHostName) { + removeMatchingHeaders(/^authorization$/i, this._options.headers); + } + + // Evaluate the beforeRedirect callback + if (typeof this._options.beforeRedirect === "function") { + var responseDetails = { headers: response.headers }; + try { + this._options.beforeRedirect.call(null, this._options, responseDetails); + } + catch (err) { + this.emit("error", err); + return; + } + this._sanitizeOptions(this._options); + } + + // Perform the redirected request + try { + this._performRequest(); + } + catch (cause) { + var error = new RedirectionError("Redirected request failed: " + cause.message); + error.cause = cause; + this.emit("error", error); + } + } + else { + // The response is not a redirect; return it as-is + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + } +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters + if (typeof input === "string") { + var urlStr = input; + try { + input = urlToOptions(new URL(urlStr)); + } + catch (err) { + /* istanbul ignore next */ + input = url.parse(urlStr); + } + } + else if (URL && (input instanceof URL)) { + input = urlToOptions(input); + } + else { + callback = options; + options = input; + input = { protocol: protocol }; + } + if (typeof options === "function") { + callback = options; + options = null; + } + + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; + + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } + + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; +} + +/* istanbul ignore next */ +function noop() { /* empty */ } + +// from https://github.com/nodejs/node/blob/master/lib/internal/url.js +function urlToOptions(urlObject) { + var options = { + protocol: urlObject.protocol, + hostname: urlObject.hostname.startsWith("[") ? + /* istanbul ignore next */ + urlObject.hostname.slice(1, -1) : + urlObject.hostname, + hash: urlObject.hash, + search: urlObject.search, + pathname: urlObject.pathname, + path: urlObject.pathname + urlObject.search, + href: urlObject.href, + }; + if (urlObject.port !== "") { + options.port = Number(urlObject.port); + } + return options; +} + +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return lastValue; +} + +function createErrorType(code, defaultMessage) { + function CustomError(message) { + Error.captureStackTrace(this, this.constructor); + this.message = message || defaultMessage; + } + CustomError.prototype = new Error(); + CustomError.prototype.constructor = CustomError; + CustomError.prototype.name = "Error [" + code + "]"; + CustomError.prototype.code = code; + return CustomError; +} + +function abortRequest(request) { + for (var e = 0; e < events.length; e++) { + request.removeListener(events[e], eventHandlers[events[e]]); + } + request.on("error", noop); + request.abort(); +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; + + +/***/ }), + +/***/ 43338: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const mkdirpSync = __webpack_require__(98605).mkdirsSync +const utimesSync = __webpack_require__(52548).utimesMillisSync +const stat = __webpack_require__(73901) + +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) +} + +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirpSync(destParent) + return startCopy(destStat, src, dest, opts) +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} + +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} + +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +function copyFile (srcStat, src, dest, opts) { + if (typeof fs.copyFileSync === 'function') { + fs.copyFileSync(src, dest) + fs.chmodSync(dest, srcStat.mode) + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime) + } + return + } + return copyFileFallback(srcStat, src, dest, opts) +} + +function copyFileFallback (srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024 + const _buff = __webpack_require__(47696)(BUF_LENGTH) + + const fdr = fs.openSync(src, 'r') + const fdw = fs.openSync(dest, 'w', srcStat.mode) + let pos = 0 + + while (pos < srcStat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } + + if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + + fs.closeSync(fdr) + fs.closeSync(fdw) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) +} + +function mkDirAndCopy (srcStat, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return fs.chmodSync(dest, srcStat.mode) +} + +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} + +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') + return startCopy(destStat, srcItem, destItem, opts) +} + +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} + +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} + +module.exports = copySync + + +/***/ }), + +/***/ 11135: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +module.exports = { + copySync: __webpack_require__(43338) +} + + +/***/ }), + +/***/ 38834: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const mkdirp = __webpack_require__(98605).mkdirs +const pathExists = __webpack_require__(43835).pathExists +const utimes = __webpack_require__(52548).utimesMillis +const stat = __webpack_require__(73901) + +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } + } + + cb = cb || function () {} + opts = opts || {} + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + stat.checkPaths(src, dest, 'copy', (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) +} + +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirp(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) +} + +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) +} + +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} + +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) + }) +} + +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} + +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} + +function copyFile (srcStat, src, dest, opts, cb) { + if (typeof fs.copyFile === 'function') { + return fs.copyFile(src, dest, err => { + if (err) return cb(err) + return setDestModeAndTimestamps(srcStat, dest, opts, cb) + }) + } + return copyFileFallback(srcStat, src, dest, opts, cb) +} + +function copyFileFallback (srcStat, src, dest, opts, cb) { + const rs = fs.createReadStream(src) + rs.on('error', err => cb(err)).once('open', () => { + const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) + ws.on('error', err => cb(err)) + .on('open', () => rs.pipe(ws)) + .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) + }) +} + +function setDestModeAndTimestamps (srcStat, dest, opts, cb) { + fs.chmod(dest, srcStat.mode, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb) + } + return cb() + }) +} + +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) + } + return copyDir(src, dest, opts, cb) +} + +function mkDirAndCopy (srcStat, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return fs.chmod(dest, srcStat.mode, cb) + }) + }) +} + +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} + +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} + +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} + +function onLink (destStat, src, dest, opts, cb) { + fs.readlink(src, (err, resolvedSrc) => { + if (err) return cb(err) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) + } + + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) +} + +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} + +module.exports = copy + + +/***/ }), + +/***/ 61335: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const u = __webpack_require__(9046)/* .fromCallback */ .E +module.exports = { + copy: u(__webpack_require__(38834)) +} + + +/***/ }), + +/***/ 96970: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const mkdir = __webpack_require__(98605) +const remove = __webpack_require__(47357) + +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) + + items = items.map(item => path.join(dir, item)) + + deleteItem() + + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) + } + }) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch (err) { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} + +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} + + +/***/ }), + +/***/ 2164: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const path = __webpack_require__(85622) +const fs = __webpack_require__(77758) +const mkdir = __webpack_require__(98605) +const pathExists = __webpack_require__(43835).pathExists + +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) + } + + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeFile() + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + }) + }) +} + +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch (e) {} + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + fs.writeFileSync(file, '') +} + +module.exports = { + createFile: u(createFile), + createFileSync +} + + +/***/ }), + +/***/ 40055: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const file = __webpack_require__(2164) +const link = __webpack_require__(53797) +const symlink = __webpack_require__(72549) + +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync +} + + +/***/ }), + +/***/ 53797: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const path = __webpack_require__(85622) +const fs = __webpack_require__(77758) +const mkdir = __webpack_require__(98605) +const pathExists = __webpack_require__(43835).pathExists + +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } + + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} + +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) +} + +module.exports = { + createLink: u(createLink), + createLinkSync +} + + +/***/ }), + +/***/ 53727: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const path = __webpack_require__(85622) +const fs = __webpack_require__(77758) +const pathExists = __webpack_require__(43835).pathExists + +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + 'toCwd': relativeToDst, + 'toDst': srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + }) + }) + } + }) + } +} + +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': srcpath + } + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + exists = fs.existsSync(relativeToDst) + if (exists) { + return { + 'toCwd': relativeToDst, + 'toDst': srcpath + } + } else { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('relative srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + } + } + } +} + +module.exports = { + symlinkPaths, + symlinkPathsSync +} + + +/***/ }), + +/***/ 18254: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(77758) + +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} + +function symlinkTypeSync (srcpath, type) { + let stats + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch (e) { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} -/***/ }, -/* 13 */ -/***/ function(module, exports) { +module.exports = { + symlinkType, + symlinkTypeSync +} - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TokenName = {}; - exports.TokenName[1 /* BooleanLiteral */] = 'Boolean'; - exports.TokenName[2 /* EOF */] = ''; - exports.TokenName[3 /* Identifier */] = 'Identifier'; - exports.TokenName[4 /* Keyword */] = 'Keyword'; - exports.TokenName[5 /* NullLiteral */] = 'Null'; - exports.TokenName[6 /* NumericLiteral */] = 'Numeric'; - exports.TokenName[7 /* Punctuator */] = 'Punctuator'; - exports.TokenName[8 /* StringLiteral */] = 'String'; - exports.TokenName[9 /* RegularExpression */] = 'RegularExpression'; - exports.TokenName[10 /* Template */] = 'Template'; +/***/ }), -/***/ }, -/* 14 */ -/***/ function(module, exports) { +/***/ 72549: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - "use strict"; - // Generated by generate-xhtml-entities.js. DO NOT MODIFY! - Object.defineProperty(exports, "__esModule", { value: true }); - exports.XHTMLEntities = { - quot: '\u0022', - amp: '\u0026', - apos: '\u0027', - gt: '\u003E', - nbsp: '\u00A0', - iexcl: '\u00A1', - cent: '\u00A2', - pound: '\u00A3', - curren: '\u00A4', - yen: '\u00A5', - brvbar: '\u00A6', - sect: '\u00A7', - uml: '\u00A8', - copy: '\u00A9', - ordf: '\u00AA', - laquo: '\u00AB', - not: '\u00AC', - shy: '\u00AD', - reg: '\u00AE', - macr: '\u00AF', - deg: '\u00B0', - plusmn: '\u00B1', - sup2: '\u00B2', - sup3: '\u00B3', - acute: '\u00B4', - micro: '\u00B5', - para: '\u00B6', - middot: '\u00B7', - cedil: '\u00B8', - sup1: '\u00B9', - ordm: '\u00BA', - raquo: '\u00BB', - frac14: '\u00BC', - frac12: '\u00BD', - frac34: '\u00BE', - iquest: '\u00BF', - Agrave: '\u00C0', - Aacute: '\u00C1', - Acirc: '\u00C2', - Atilde: '\u00C3', - Auml: '\u00C4', - Aring: '\u00C5', - AElig: '\u00C6', - Ccedil: '\u00C7', - Egrave: '\u00C8', - Eacute: '\u00C9', - Ecirc: '\u00CA', - Euml: '\u00CB', - Igrave: '\u00CC', - Iacute: '\u00CD', - Icirc: '\u00CE', - Iuml: '\u00CF', - ETH: '\u00D0', - Ntilde: '\u00D1', - Ograve: '\u00D2', - Oacute: '\u00D3', - Ocirc: '\u00D4', - Otilde: '\u00D5', - Ouml: '\u00D6', - times: '\u00D7', - Oslash: '\u00D8', - Ugrave: '\u00D9', - Uacute: '\u00DA', - Ucirc: '\u00DB', - Uuml: '\u00DC', - Yacute: '\u00DD', - THORN: '\u00DE', - szlig: '\u00DF', - agrave: '\u00E0', - aacute: '\u00E1', - acirc: '\u00E2', - atilde: '\u00E3', - auml: '\u00E4', - aring: '\u00E5', - aelig: '\u00E6', - ccedil: '\u00E7', - egrave: '\u00E8', - eacute: '\u00E9', - ecirc: '\u00EA', - euml: '\u00EB', - igrave: '\u00EC', - iacute: '\u00ED', - icirc: '\u00EE', - iuml: '\u00EF', - eth: '\u00F0', - ntilde: '\u00F1', - ograve: '\u00F2', - oacute: '\u00F3', - ocirc: '\u00F4', - otilde: '\u00F5', - ouml: '\u00F6', - divide: '\u00F7', - oslash: '\u00F8', - ugrave: '\u00F9', - uacute: '\u00FA', - ucirc: '\u00FB', - uuml: '\u00FC', - yacute: '\u00FD', - thorn: '\u00FE', - yuml: '\u00FF', - OElig: '\u0152', - oelig: '\u0153', - Scaron: '\u0160', - scaron: '\u0161', - Yuml: '\u0178', - fnof: '\u0192', - circ: '\u02C6', - tilde: '\u02DC', - Alpha: '\u0391', - Beta: '\u0392', - Gamma: '\u0393', - Delta: '\u0394', - Epsilon: '\u0395', - Zeta: '\u0396', - Eta: '\u0397', - Theta: '\u0398', - Iota: '\u0399', - Kappa: '\u039A', - Lambda: '\u039B', - Mu: '\u039C', - Nu: '\u039D', - Xi: '\u039E', - Omicron: '\u039F', - Pi: '\u03A0', - Rho: '\u03A1', - Sigma: '\u03A3', - Tau: '\u03A4', - Upsilon: '\u03A5', - Phi: '\u03A6', - Chi: '\u03A7', - Psi: '\u03A8', - Omega: '\u03A9', - alpha: '\u03B1', - beta: '\u03B2', - gamma: '\u03B3', - delta: '\u03B4', - epsilon: '\u03B5', - zeta: '\u03B6', - eta: '\u03B7', - theta: '\u03B8', - iota: '\u03B9', - kappa: '\u03BA', - lambda: '\u03BB', - mu: '\u03BC', - nu: '\u03BD', - xi: '\u03BE', - omicron: '\u03BF', - pi: '\u03C0', - rho: '\u03C1', - sigmaf: '\u03C2', - sigma: '\u03C3', - tau: '\u03C4', - upsilon: '\u03C5', - phi: '\u03C6', - chi: '\u03C7', - psi: '\u03C8', - omega: '\u03C9', - thetasym: '\u03D1', - upsih: '\u03D2', - piv: '\u03D6', - ensp: '\u2002', - emsp: '\u2003', - thinsp: '\u2009', - zwnj: '\u200C', - zwj: '\u200D', - lrm: '\u200E', - rlm: '\u200F', - ndash: '\u2013', - mdash: '\u2014', - lsquo: '\u2018', - rsquo: '\u2019', - sbquo: '\u201A', - ldquo: '\u201C', - rdquo: '\u201D', - bdquo: '\u201E', - dagger: '\u2020', - Dagger: '\u2021', - bull: '\u2022', - hellip: '\u2026', - permil: '\u2030', - prime: '\u2032', - Prime: '\u2033', - lsaquo: '\u2039', - rsaquo: '\u203A', - oline: '\u203E', - frasl: '\u2044', - euro: '\u20AC', - image: '\u2111', - weierp: '\u2118', - real: '\u211C', - trade: '\u2122', - alefsym: '\u2135', - larr: '\u2190', - uarr: '\u2191', - rarr: '\u2192', - darr: '\u2193', - harr: '\u2194', - crarr: '\u21B5', - lArr: '\u21D0', - uArr: '\u21D1', - rArr: '\u21D2', - dArr: '\u21D3', - hArr: '\u21D4', - forall: '\u2200', - part: '\u2202', - exist: '\u2203', - empty: '\u2205', - nabla: '\u2207', - isin: '\u2208', - notin: '\u2209', - ni: '\u220B', - prod: '\u220F', - sum: '\u2211', - minus: '\u2212', - lowast: '\u2217', - radic: '\u221A', - prop: '\u221D', - infin: '\u221E', - ang: '\u2220', - and: '\u2227', - or: '\u2228', - cap: '\u2229', - cup: '\u222A', - int: '\u222B', - there4: '\u2234', - sim: '\u223C', - cong: '\u2245', - asymp: '\u2248', - ne: '\u2260', - equiv: '\u2261', - le: '\u2264', - ge: '\u2265', - sub: '\u2282', - sup: '\u2283', - nsub: '\u2284', - sube: '\u2286', - supe: '\u2287', - oplus: '\u2295', - otimes: '\u2297', - perp: '\u22A5', - sdot: '\u22C5', - lceil: '\u2308', - rceil: '\u2309', - lfloor: '\u230A', - rfloor: '\u230B', - loz: '\u25CA', - spades: '\u2660', - clubs: '\u2663', - hearts: '\u2665', - diams: '\u2666', - lang: '\u27E8', - rang: '\u27E9' - }; +"use strict"; + + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const path = __webpack_require__(85622) +const fs = __webpack_require__(77758) +const _mkdirs = __webpack_require__(98605) +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync + +const _symlinkPaths = __webpack_require__(53727) +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + +const _symlinkType = __webpack_require__(18254) +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync + +const pathExists = __webpack_require__(43835).pathExists + +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} + +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} + +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} + + +/***/ }), + +/***/ 61176: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = __webpack_require__(9046)/* .fromCallback */ .E +const fs = __webpack_require__(77758) + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'lchmod', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.copyFile was added in Node.js v8.5.0 + // fs.mkdtemp was added in Node.js v5.10.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return + } + exports[key] = fs[key] +}) + +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) + +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} + +// fs.read() & fs.write need special treatment due to multiple callback args + +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} + +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } + + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} + +// fs.realpath.native only available in Node v9.2+ +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} + + +/***/ }), + +/***/ 5630: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +module.exports = Object.assign( + {}, + // Export promiseified graceful-fs: + __webpack_require__(61176), + // Export extra methods: + __webpack_require__(11135), + __webpack_require__(61335), + __webpack_require__(96970), + __webpack_require__(40055), + __webpack_require__(40213), + __webpack_require__(98605), + __webpack_require__(69665), + __webpack_require__(41497), + __webpack_require__(16570), + __webpack_require__(43835), + __webpack_require__(47357) +) + +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = __webpack_require__(35747) +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, "promises", ({ + get () { return fs.promises } + })) +} + + +/***/ }), +/***/ 40213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/***/ }, -/* 15 */ -/***/ function(module, exports, __nested_webpack_require_277122__) { +"use strict"; - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var error_handler_1 = __nested_webpack_require_277122__(10); - var scanner_1 = __nested_webpack_require_277122__(12); - var token_1 = __nested_webpack_require_277122__(13); - var Reader = (function () { - function Reader() { - this.values = []; - this.curly = this.paren = -1; - } - // A function following one of those tokens is an expression. - Reader.prototype.beforeFunctionExpression = function (t) { - return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new', - 'return', 'case', 'delete', 'throw', 'void', - // assignment operators - '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', - '&=', '|=', '^=', ',', - // binary/unary operators - '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&', - '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=', - '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0; - }; - // Determine if forward slash (/) is an operator or part of a regular expression - // https://github.com/mozilla/sweet.js/wiki/design - Reader.prototype.isRegexStart = function () { - var previous = this.values[this.values.length - 1]; - var regex = (previous !== null); - switch (previous) { - case 'this': - case ']': - regex = false; - break; - case ')': - var keyword = this.values[this.paren - 1]; - regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with'); - break; - case '}': - // Dividing a function by anything makes little sense, - // but we have to check for that. - regex = false; - if (this.values[this.curly - 3] === 'function') { - // Anonymous function, e.g. function(){} /42 - var check = this.values[this.curly - 4]; - regex = check ? !this.beforeFunctionExpression(check) : false; - } - else if (this.values[this.curly - 4] === 'function') { - // Named function, e.g. function f(){} /42/ - var check = this.values[this.curly - 5]; - regex = check ? !this.beforeFunctionExpression(check) : true; - } - break; - default: - break; - } - return regex; - }; - Reader.prototype.push = function (token) { - if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) { - if (token.value === '{') { - this.curly = this.values.length; - } - else if (token.value === '(') { - this.paren = this.values.length; - } - this.values.push(token.value); - } - else { - this.values.push(null); - } - }; - return Reader; - }()); - var Tokenizer = (function () { - function Tokenizer(code, config) { - this.errorHandler = new error_handler_1.ErrorHandler(); - this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false; - this.scanner = new scanner_1.Scanner(code, this.errorHandler); - this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false; - this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false; - this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false; - this.buffer = []; - this.reader = new Reader(); - } - Tokenizer.prototype.errors = function () { - return this.errorHandler.errors; - }; - Tokenizer.prototype.getNextToken = function () { - if (this.buffer.length === 0) { - var comments = this.scanner.scanComments(); - if (this.scanner.trackComment) { - for (var i = 0; i < comments.length; ++i) { - var e = comments[i]; - var value = this.scanner.source.slice(e.slice[0], e.slice[1]); - var comment = { - type: e.multiLine ? 'BlockComment' : 'LineComment', - value: value - }; - if (this.trackRange) { - comment.range = e.range; - } - if (this.trackLoc) { - comment.loc = e.loc; - } - this.buffer.push(comment); - } - } - if (!this.scanner.eof()) { - var loc = void 0; - if (this.trackLoc) { - loc = { - start: { - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }, - end: {} - }; - } - var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart(); - var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex(); - this.reader.push(token); - var entry = { - type: token_1.TokenName[token.type], - value: this.scanner.source.slice(token.start, token.end) - }; - if (this.trackRange) { - entry.range = [token.start, token.end]; - } - if (this.trackLoc) { - loc.end = { - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - entry.loc = loc; - } - if (token.type === 9 /* RegularExpression */) { - var pattern = token.pattern; - var flags = token.flags; - entry.regex = { pattern: pattern, flags: flags }; - } - this.buffer.push(entry); - } - } - return this.buffer.shift(); - }; - return Tokenizer; - }()); - exports.Tokenizer = Tokenizer; +const u = __webpack_require__(9046)/* .fromCallback */ .E +const jsonFile = __webpack_require__(18970) + +jsonFile.outputJson = u(__webpack_require__(60531)) +jsonFile.outputJsonSync = __webpack_require__(19421) +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile -/***/ } -/******/ ]) -}); -; /***/ }), -/***/ 31133: +/***/ 18970: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var debug; +"use strict"; -module.exports = function () { - if (!debug) { - try { - /* eslint global-require: off */ - debug = __webpack_require__(38237)("follow-redirects"); - } - catch (error) { - debug = function () { /* */ }; - } + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const jsonFile = __webpack_require__(26160) + +module.exports = { + // jsonfile exports + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync +} + + +/***/ }), + +/***/ 19421: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const mkdir = __webpack_require__(98605) +const jsonFile = __webpack_require__(18970) + +function outputJsonSync (file, data, options) { + const dir = path.dirname(file) + + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) } - debug.apply(null, arguments); -}; + + jsonFile.writeJsonSync(file, data, options) +} + +module.exports = outputJsonSync /***/ }), -/***/ 67707: +/***/ 60531: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var url = __webpack_require__(78835); -var URL = url.URL; -var http = __webpack_require__(15876); -var https = __webpack_require__(57211); -var Writable = __webpack_require__(92413).Writable; -var assert = __webpack_require__(42357); -var debug = __webpack_require__(31133); +"use strict"; -// Create handlers that pass events from native requests -var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; -var eventHandlers = Object.create(null); -events.forEach(function (event) { - eventHandlers[event] = function (arg1, arg2, arg3) { - this._redirectable.emit(event, arg1, arg2, arg3); - }; -}); -// Error types with codes -var RedirectionError = createErrorType( - "ERR_FR_REDIRECTION_FAILURE", - "" -); -var TooManyRedirectsError = createErrorType( - "ERR_FR_TOO_MANY_REDIRECTS", - "Maximum number of redirects exceeded" -); -var MaxBodyLengthExceededError = createErrorType( - "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", - "Request body larger than maxBodyLength limit" -); -var WriteAfterEndError = createErrorType( - "ERR_STREAM_WRITE_AFTER_END", - "write after end" -); +const path = __webpack_require__(85622) +const mkdir = __webpack_require__(98605) +const pathExists = __webpack_require__(43835).pathExists +const jsonFile = __webpack_require__(18970) -// An HTTP(S) request that can be redirected -function RedirectableRequest(options, responseCallback) { - // Initialize the request - Writable.call(this); - this._sanitizeOptions(options); - this._options = options; - this._ended = false; - this._ending = false; - this._redirectCount = 0; - this._redirects = []; - this._requestBodyLength = 0; - this._requestBodyBuffers = []; +function outputJson (file, data, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } - // Attach a callback if passed - if (responseCallback) { - this.on("response", responseCallback); + const dir = path.dirname(file) + + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return jsonFile.writeJson(file, data, options, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + jsonFile.writeJson(file, data, options, callback) + }) + }) +} + +module.exports = outputJson + + +/***/ }), + +/***/ 98605: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const mkdirs = u(__webpack_require__(59677)) +const mkdirsSync = __webpack_require__(30684) + +module.exports = { + mkdirs, + mkdirsSync, + // alias + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync +} + + +/***/ }), + +/***/ 30684: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const invalidWin32Path = __webpack_require__(71590).invalidWin32Path + +const o777 = parseInt('0777', 8) + +function mkdirsSync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts } } - // React to responses of native requests - var self = this; - this._onNativeResponse = function (response) { - self._processResponse(response); - }; + let mode = opts.mode + const xfs = opts.fs || fs - // Perform the first request - this._performRequest(); + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + throw errInval + } + + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null + + p = path.resolve(p) + + try { + xfs.mkdirSync(p, mode) + made = made || p + } catch (err0) { + if (err0.code === 'ENOENT') { + if (path.dirname(p) === p) throw err0 + made = mkdirsSync(path.dirname(p), opts, made) + mkdirsSync(p, opts, made) + } else { + // In the case of any other error, just see if there's a dir there + // already. If so, then hooray! If not, then something is borked. + let stat + try { + stat = xfs.statSync(p) + } catch (err1) { + throw err0 + } + if (!stat.isDirectory()) throw err0 + } + } + + return made } -RedirectableRequest.prototype = Object.create(Writable.prototype); -RedirectableRequest.prototype.abort = function () { - abortRequest(this._currentRequest); - this.emit("abort"); -}; +module.exports = mkdirsSync -// Writes buffered data to the current native request -RedirectableRequest.prototype.write = function (data, encoding, callback) { - // Writing is not allowed if end has been called - if (this._ending) { - throw new WriteAfterEndError(); + +/***/ }), + +/***/ 59677: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const invalidWin32Path = __webpack_require__(71590).invalidWin32Path + +const o777 = parseInt('0777', 8) + +function mkdirs (p, opts, callback, made) { + if (typeof opts === 'function') { + callback = opts + opts = {} + } else if (!opts || typeof opts !== 'object') { + opts = { mode: opts } } - // Validate input and shift parameters if necessary - if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { - throw new TypeError("data should be a string, Buffer or Uint8Array"); + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + return callback(errInval) } - if (typeof encoding === "function") { - callback = encoding; - encoding = null; + + let mode = opts.mode + const xfs = opts.fs || fs + + if (mode === undefined) { + mode = o777 & (~process.umask()) } + if (!made) made = null + + callback = callback || function () {} + p = path.resolve(p) + + xfs.mkdir(p, mode, er => { + if (!er) { + made = made || p + return callback(null, made) + } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return callback(er) + mkdirs(path.dirname(p), opts, (er, made) => { + if (er) callback(er, made) + else mkdirs(p, opts, callback, made) + }) + break + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, (er2, stat) => { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) callback(er, made) + else callback(null, made) + }) + break + } + }) +} + +module.exports = mkdirs + + +/***/ }), + +/***/ 71590: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const path = __webpack_require__(85622) + +// get drive on windows +function getRootPath (p) { + p = path.normalize(path.resolve(p)).split(path.sep) + if (p.length > 0) return p[0] + return null +} + +// http://stackoverflow.com/a/62888/10333 contains more accurate +// TODO: expand to include the rest +const INVALID_PATH_CHARS = /[<>:"|?*]/ + +function invalidWin32Path (p) { + const rp = getRootPath(p) + p = p.replace(rp, '') + return INVALID_PATH_CHARS.test(p) +} + +module.exports = { + getRootPath, + invalidWin32Path +} + + +/***/ }), + +/***/ 69665: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +module.exports = { + moveSync: __webpack_require__(96445) +} + + +/***/ }), - // Ignore empty buffers, since writing them doesn't invoke the callback - // https://github.com/nodejs/node/issues/22066 - if (data.length === 0) { - if (callback) { - callback(); - } - return; - } - // Only write when we don't exceed the maximum body length - if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { - this._requestBodyLength += data.length; - this._requestBodyBuffers.push({ data: data, encoding: encoding }); - this._currentRequest.write(data, encoding, callback); - } - // Error when we exceed the maximum body length - else { - this.emit("error", new MaxBodyLengthExceededError()); - this.abort(); - } -}; +/***/ 96445: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// Ends the current native request -RedirectableRequest.prototype.end = function (data, encoding, callback) { - // Shift parameters if necessary - if (typeof data === "function") { - callback = data; - data = encoding = null; - } - else if (typeof encoding === "function") { - callback = encoding; - encoding = null; - } +"use strict"; - // Write data if needed and end - if (!data) { - this._ended = this._ending = true; - this._currentRequest.end(null, null, callback); - } - else { - var self = this; - var currentRequest = this._currentRequest; - this.write(data, encoding, function () { - self._ended = true; - currentRequest.end(null, null, callback); - }); - this._ending = true; - } -}; -// Sets a header value on the current native request -RedirectableRequest.prototype.setHeader = function (name, value) { - this._options.headers[name] = value; - this._currentRequest.setHeader(name, value); -}; +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const copySync = __webpack_require__(11135).copySync +const removeSync = __webpack_require__(47357).removeSync +const mkdirpSync = __webpack_require__(98605).mkdirpSync +const stat = __webpack_require__(73901) -// Clears a header value on the current native request -RedirectableRequest.prototype.removeHeader = function (name) { - delete this._options.headers[name]; - this._currentRequest.removeHeader(name); -}; +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false -// Global timeout for all underlying requests -RedirectableRequest.prototype.setTimeout = function (msecs, callback) { - var self = this; - if (callback) { - this.on("timeout", callback); - } + const { srcStat } = stat.checkPathsSync(src, dest, 'move') + stat.checkParentPathsSync(src, srcStat, dest, 'move') + mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite) +} - function destroyOnTimeout(socket) { - socket.setTimeout(msecs); - socket.removeListener("timeout", socket.destroy); - socket.addListener("timeout", socket.destroy); +function doRename (src, dest, overwrite) { + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} - // Sets up a timer to trigger a timeout event - function startTimer(socket) { - if (self._timeout) { - clearTimeout(self._timeout); - } - self._timeout = setTimeout(function () { - self.emit("timeout"); - clearTimer(); - }, msecs); - destroyOnTimeout(socket); +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) } +} - // Prevent a timeout from triggering - function clearTimer() { - clearTimeout(this._timeout); - if (callback) { - self.removeListener("timeout", callback); - } - if (!this.socket) { - self._currentRequest.removeListener("socket", startTimer); - } +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true } + copySync(src, dest, opts) + return removeSync(src) +} - // Start the timer when the socket is opened - if (this.socket) { - startTimer(this.socket); - } - else { - this._currentRequest.once("socket", startTimer); - } +module.exports = moveSync - this.on("socket", destroyOnTimeout); - this.once("response", clearTimer); - this.once("error", clearTimer); - return this; -}; +/***/ }), -// Proxy all other public ClientRequest methods -[ - "flushHeaders", "getHeader", - "setNoDelay", "setSocketKeepAlive", -].forEach(function (method) { - RedirectableRequest.prototype[method] = function (a, b) { - return this._currentRequest[method](a, b); - }; -}); +/***/ 41497: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// Proxy all public ClientRequest properties -["aborted", "connection", "socket"].forEach(function (property) { - Object.defineProperty(RedirectableRequest.prototype, property, { - get: function () { return this._currentRequest[property]; }, - }); -}); +"use strict"; -RedirectableRequest.prototype._sanitizeOptions = function (options) { - // Ensure headers are always present - if (!options.headers) { - options.headers = {}; - } - // Since http.request treats host as an alias of hostname, - // but the url module interprets host as hostname plus port, - // eliminate the host property to avoid confusion. - if (options.host) { - // Use hostname if set, because it has precedence - if (!options.hostname) { - options.hostname = options.host; - } - delete options.host; - } +const u = __webpack_require__(9046)/* .fromCallback */ .E +module.exports = { + move: u(__webpack_require__(72231)) +} - // Complete the URL object when necessary - if (!options.pathname && options.path) { - var searchPos = options.path.indexOf("?"); - if (searchPos < 0) { - options.pathname = options.path; - } - else { - options.pathname = options.path.substring(0, searchPos); - options.search = options.path.substring(searchPos); - } - } -}; +/***/ }), -// Executes the next native request (initial or redirect) -RedirectableRequest.prototype._performRequest = function () { - // Load the native protocol - var protocol = this._options.protocol; - var nativeProtocol = this._options.nativeProtocols[protocol]; - if (!nativeProtocol) { - this.emit("error", new TypeError("Unsupported protocol " + protocol)); - return; - } +/***/ 72231: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // If specified, use the agent corresponding to the protocol - // (HTTP and HTTPS use different types of agents) - if (this._options.agents) { - var scheme = protocol.substr(0, protocol.length - 1); - this._options.agent = this._options.agents[scheme]; - } +"use strict"; - // Create the native request - var request = this._currentRequest = - nativeProtocol.request(this._options, this._onNativeResponse); - this._currentUrl = url.format(this._options); - // Set up event handlers - request._redirectable = this; - for (var e = 0; e < events.length; e++) { - request.on(events[e], eventHandlers[events[e]]); +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const copy = __webpack_require__(61335).copy +const remove = __webpack_require__(47357).remove +const mkdirp = __webpack_require__(98605).mkdirp +const pathExists = __webpack_require__(43835).pathExists +const stat = __webpack_require__(73901) + +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} } - // End a redirected request - // (The first request must be ended explicitly with RedirectableRequest#end) - if (this._isRedirect) { - // Write the request entity and end. - var i = 0; - var self = this; - var buffers = this._requestBodyBuffers; - (function writeNext(error) { - // Only write if this request has not been redirected yet - /* istanbul ignore else */ - if (request === self._currentRequest) { - // Report any write errors - /* istanbul ignore if */ - if (error) { - self.emit("error", error); - } - // Write the next buffer if there are still left - else if (i < buffers.length) { - var buffer = buffers[i++]; - /* istanbul ignore else */ - if (!request.finished) { - request.write(buffer.data, buffer.encoding, writeNext); - } - } - // End the request if `end` has been called on us - else if (self._ended) { - request.end(); - } - } - }()); + const overwrite = opts.overwrite || opts.clobber || false + + stat.checkPaths(src, dest, 'move', (err, stats) => { + if (err) return cb(err) + const { srcStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) + }) +} + +function doRename (src, dest, overwrite, cb) { + if (overwrite) { + return remove(dest, err => { + if (err) return cb(err) + return rename(src, dest, overwrite, cb) + }) } -}; + pathExists(dest, (err, destExists) => { + if (err) return cb(err) + if (destExists) return cb(new Error('dest already exists.')) + return rename(src, dest, overwrite, cb) + }) +} -// Processes a response from the current native request -RedirectableRequest.prototype._processResponse = function (response) { - // Store the redirected response - var statusCode = response.statusCode; - if (this._options.trackRedirects) { - this._redirects.push({ - url: this._currentUrl, - headers: response.headers, - statusCode: statusCode, - }); +function rename (src, dest, overwrite, cb) { + fs.rename(src, dest, err => { + if (!err) return cb() + if (err.code !== 'EXDEV') return cb(err) + return moveAcrossDevice(src, dest, overwrite, cb) + }) +} + +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} - // RFC7231§6.4: The 3xx (Redirection) class of status code indicates - // that further action needs to be taken by the user agent in order to - // fulfill the request. If a Location header field is provided, - // the user agent MAY automatically redirect its request to the URI - // referenced by the Location field value, - // even if the specific status code is not understood. - var location = response.headers.location; - if (location && this._options.followRedirects !== false && - statusCode >= 300 && statusCode < 400) { - // Abort the current request - abortRequest(this._currentRequest); - // Discard the remainder of the response to avoid waiting for data - response.destroy(); +module.exports = move - // RFC7231§6.4: A client SHOULD detect and intervene - // in cyclical redirections (i.e., "infinite" redirection loops). - if (++this._redirectCount > this._options.maxRedirects) { - this.emit("error", new TooManyRedirectsError()); - return; - } - // RFC7231§6.4: Automatic redirection needs to done with - // care for methods not known to be safe, […] - // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change - // the request method from POST to GET for the subsequent request. - if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || - // RFC7231§6.4.4: The 303 (See Other) status code indicates that - // the server is redirecting the user agent to a different resource […] - // A user agent can perform a retrieval request targeting that URI - // (a GET or HEAD request if using HTTP) […] - (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { - this._options.method = "GET"; - // Drop a possible entity and headers related to it - this._requestBodyBuffers = []; - removeMatchingHeaders(/^content-/i, this._options.headers); - } +/***/ }), - // Drop the Host header, as the redirect might lead to a different host - var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || - url.parse(this._currentUrl).hostname; +/***/ 16570: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Create the redirected request - var redirectUrl = url.resolve(this._currentUrl, location); - debug("redirecting to", redirectUrl); - this._isRedirect = true; - var redirectUrlParts = url.parse(redirectUrl); - Object.assign(this._options, redirectUrlParts); +"use strict"; - // Drop the Authorization header if redirecting to another host - if (redirectUrlParts.hostname !== previousHostName) { - removeMatchingHeaders(/^authorization$/i, this._options.headers); - } - // Evaluate the beforeRedirect callback - if (typeof this._options.beforeRedirect === "function") { - var responseDetails = { headers: response.headers }; - try { - this._options.beforeRedirect.call(null, this._options, responseDetails); - } - catch (err) { - this.emit("error", err); - return; - } - this._sanitizeOptions(this._options); - } +const u = __webpack_require__(9046)/* .fromCallback */ .E +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) +const mkdir = __webpack_require__(98605) +const pathExists = __webpack_require__(43835).pathExists - // Perform the redirected request - try { - this._performRequest(); - } - catch (cause) { - var error = new RedirectionError("Redirected request failed: " + cause.message); - error.cause = cause; - this.emit("error", error); - } +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' } - else { - // The response is not a redirect; return it as-is - response.responseUrl = this._currentUrl; - response.redirects = this._redirects; - this.emit("response", response); - // Clean up - this._requestBodyBuffers = []; - } -}; + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) -// Wraps the key/value object of protocols with redirect functionality -function wrap(protocols) { - // Default settings - var exports = { - maxRedirects: 21, - maxBodyLength: 10 * 1024 * 1024, - }; + mkdir.mkdirs(dir, err => { + if (err) return callback(err) - // Wrap each protocol - var nativeProtocols = {}; - Object.keys(protocols).forEach(function (scheme) { - var protocol = scheme + ":"; - var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; - var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + fs.writeFile(file, data, encoding, callback) + }) + }) +} - // Executes a request, following redirects - function request(input, options, callback) { - // Parse parameters - if (typeof input === "string") { - var urlStr = input; - try { - input = urlToOptions(new URL(urlStr)); - } - catch (err) { - /* istanbul ignore next */ - input = url.parse(urlStr); - } - } - else if (URL && (input instanceof URL)) { - input = urlToOptions(input); - } - else { - callback = options; - options = input; - input = { protocol: protocol }; - } - if (typeof options === "function") { - callback = options; - options = null; - } +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} - // Set defaults - options = Object.assign({ - maxRedirects: exports.maxRedirects, - maxBodyLength: exports.maxBodyLength, - }, input, options); - options.nativeProtocols = nativeProtocols; +module.exports = { + outputFile: u(outputFile), + outputFileSync +} - assert.equal(options.protocol, protocol, "protocol mismatch"); - debug("options", options); - return new RedirectableRequest(options, callback); - } - // Executes a GET request, following redirects - function get(input, options, callback) { - var wrappedRequest = wrappedProtocol.request(input, options, callback); - wrappedRequest.end(); - return wrappedRequest; - } +/***/ }), - // Expose the properties on the wrapped protocol - Object.defineProperties(wrappedProtocol, { - request: { value: request, configurable: true, enumerable: true, writable: true }, - get: { value: get, configurable: true, enumerable: true, writable: true }, - }); - }); - return exports; -} +/***/ 43835: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* istanbul ignore next */ -function noop() { /* empty */ } +"use strict"; -// from https://github.com/nodejs/node/blob/master/lib/internal/url.js -function urlToOptions(urlObject) { - var options = { - protocol: urlObject.protocol, - hostname: urlObject.hostname.startsWith("[") ? - /* istanbul ignore next */ - urlObject.hostname.slice(1, -1) : - urlObject.hostname, - hash: urlObject.hash, - search: urlObject.search, - pathname: urlObject.pathname, - path: urlObject.pathname + urlObject.search, - href: urlObject.href, - }; - if (urlObject.port !== "") { - options.port = Number(urlObject.port); - } - return options; -} +const u = __webpack_require__(9046)/* .fromPromise */ .p +const fs = __webpack_require__(61176) -function removeMatchingHeaders(regex, headers) { - var lastValue; - for (var header in headers) { - if (regex.test(header)) { - lastValue = headers[header]; - delete headers[header]; - } - } - return lastValue; +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) } -function createErrorType(code, defaultMessage) { - function CustomError(message) { - Error.captureStackTrace(this, this.constructor); - this.message = message || defaultMessage; - } - CustomError.prototype = new Error(); - CustomError.prototype.constructor = CustomError; - CustomError.prototype.name = "Error [" + code + "]"; - CustomError.prototype.code = code; - return CustomError; +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync } -function abortRequest(request) { - for (var e = 0; e < events.length; e++) { - request.removeListener(events[e], eventHandlers[events[e]]); - } - request.on("error", noop); - request.abort(); -} -// Exports -module.exports = wrap({ http: http, https: https }); -module.exports.wrap = wrap; +/***/ }), + +/***/ 47357: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const u = __webpack_require__(9046)/* .fromCallback */ .E +const rimraf = __webpack_require__(38761) + +module.exports = { + remove: u(rimraf), + removeSync: rimraf.sync +} /***/ }), -/***/ 43338: +/***/ 38761: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -38131,7803 +31453,9184 @@ module.exports.wrap = wrap; const fs = __webpack_require__(77758) const path = __webpack_require__(85622) -const mkdirpSync = __webpack_require__(98605).mkdirsSync -const utimesSync = __webpack_require__(52548).utimesMillisSync -const stat = __webpack_require__(73901) +const assert = __webpack_require__(42357) -function copySync (src, dest, opts) { - if (typeof opts === 'function') { - opts = { filter: opts } - } +const isWindows = (process.platform === 'win32') - opts = opts || {} - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) + options.maxBusyTries = options.maxBusyTries || 3 +} + +function rimraf (p, options, cb) { + let busyTries = 0 + + if (typeof options === 'function') { + cb = options + options = {} } - const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') - stat.checkParentPathsSync(src, srcStat, dest, 'copy') - return handleFilterAndCopy(destStat, src, dest, opts) -} + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') -function handleFilterAndCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - const destParent = path.dirname(dest) - if (!fs.existsSync(destParent)) mkdirpSync(destParent) - return startCopy(destStat, src, dest, opts) -} + defaults(options) -function startCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - return getStats(destStat, src, dest, opts) -} + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } -function getStats (destStat, src, dest, opts) { - const statSync = opts.dereference ? fs.statSync : fs.lstatSync - const srcStat = statSync(src) + // already gone + if (er.code === 'ENOENT') er = null + } - if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) - else if (srcStat.isFile() || - srcStat.isCharacterDevice() || - srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) - else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) + cb(er) + }) } -function onFile (srcStat, destStat, src, dest, opts) { - if (!destStat) return copyFile(srcStat, src, dest, opts) - return mayCopyFile(srcStat, src, dest, opts) +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } + + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } + + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) } -function mayCopyFile (srcStat, src, dest, opts) { - if (opts.overwrite) { - fs.unlinkSync(dest) - return copyFile(srcStat, src, dest, opts) - } else if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`) +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) { + assert(er instanceof Error) } -} -function copyFile (srcStat, src, dest, opts) { - if (typeof fs.copyFileSync === 'function') { - fs.copyFileSync(src, dest) - fs.chmodSync(dest, srcStat.mode) - if (opts.preserveTimestamps) { - return utimesSync(dest, srcStat.atime, srcStat.mtime) + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) } - return - } - return copyFileFallback(srcStat, src, dest, opts) + }) } -function copyFileFallback (srcStat, src, dest, opts) { - const BUF_LENGTH = 64 * 1024 - const _buff = __webpack_require__(47696)(BUF_LENGTH) +function fixWinEPERMSync (p, options, er) { + let stats - const fdr = fs.openSync(src, 'r') - const fdw = fs.openSync(dest, 'w', srcStat.mode) - let pos = 0 + assert(p) + assert(options) + if (er) { + assert(er instanceof Error) + } - while (pos < srcStat.size) { - const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) - fs.writeSync(fdw, _buff, 0, bytesRead) - pos += bytesRead + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } } - if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } + } - fs.closeSync(fdr) - fs.closeSync(fdw) + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } } -function onDir (srcStat, destStat, src, dest, opts) { - if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) - if (destStat && !destStat.isDirectory()) { - throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) } - return copyDir(src, dest, opts) -} + assert(typeof cb === 'function') -function mkDirAndCopy (srcStat, src, dest, opts) { - fs.mkdirSync(dest) - copyDir(src, dest, opts) - return fs.chmodSync(dest, srcStat.mode) + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) } -function copyDir (src, dest, opts) { - fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) -} +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') -function copyDirItem (item, src, dest, opts) { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') - return startCopy(destStat, srcItem, destItem, opts) + options.readdir(p, (er, files) => { + if (er) return cb(er) + + let n = files.length + let errState + + if (n === 0) return options.rmdir(p, cb) + + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) } -function onLink (destStat, src, dest, opts) { - let resolvedSrc = fs.readlinkSync(src) - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) - } +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st - if (!destStat) { - return fs.symlinkSync(resolvedSrc, dest) - } else { - let resolvedDest - try { - resolvedDest = fs.readlinkSync(dest) - } catch (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) - throw err + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest) + + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er } + rmdirSync(p, options, er) + } +} - // prevent copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er } - return copyLink(resolvedSrc, dest) } } -function copyLink (resolvedSrc, dest) { - fs.unlinkSync(dest) - return fs.symlinkSync(resolvedSrc, dest) +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch (er) { } + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } } -module.exports = copySync +module.exports = rimraf +rimraf.sync = rimrafSync /***/ }), -/***/ 11135: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 47696: +/***/ ((module) => { "use strict"; - -module.exports = { - copySync: __webpack_require__(43338) +/* eslint-disable node/no-deprecated-api */ +module.exports = function (size) { + if (typeof Buffer.allocUnsafe === 'function') { + try { + return Buffer.allocUnsafe(size) + } catch (e) { + return new Buffer(size) + } + } + return new Buffer(size) } /***/ }), -/***/ 38834: +/***/ 73901: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const mkdirp = __webpack_require__(98605).mkdirs -const pathExists = __webpack_require__(43835).pathExists -const utimes = __webpack_require__(52548).utimesMillis -const stat = __webpack_require__(73901) - -function copy (src, dest, opts, cb) { - if (typeof opts === 'function' && !cb) { - cb = opts - opts = {} - } else if (typeof opts === 'function') { - opts = { filter: opts } - } - - cb = cb || function () {} - opts = opts || {} - - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber - - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) - } - - stat.checkPaths(src, dest, 'copy', (err, stats) => { - if (err) return cb(err) - const { srcStat, destStat } = stats - stat.checkParentPaths(src, srcStat, dest, 'copy', err => { - if (err) return cb(err) - if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) - return checkParentDir(destStat, src, dest, opts, cb) - }) - }) -} - -function checkParentDir (destStat, src, dest, opts, cb) { - const destParent = path.dirname(dest) - pathExists(destParent, (err, dirExists) => { - if (err) return cb(err) - if (dirExists) return startCopy(destStat, src, dest, opts, cb) - mkdirp(destParent, err => { - if (err) return cb(err) - return startCopy(destStat, src, dest, opts, cb) - }) - }) -} - -function handleFilter (onInclude, destStat, src, dest, opts, cb) { - Promise.resolve(opts.filter(src, dest)).then(include => { - if (include) return onInclude(destStat, src, dest, opts, cb) - return cb() - }, error => cb(error)) -} - -function startCopy (destStat, src, dest, opts, cb) { - if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) - return getStats(destStat, src, dest, opts, cb) -} - -function getStats (destStat, src, dest, opts, cb) { - const stat = opts.dereference ? fs.stat : fs.lstat - stat(src, (err, srcStat) => { - if (err) return cb(err) +const fs = __webpack_require__(77758) +const path = __webpack_require__(85622) - if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb) - else if (srcStat.isFile() || - srcStat.isCharacterDevice() || - srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) - else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) - }) -} +const NODE_VERSION_MAJOR_WITH_BIGINT = 10 +const NODE_VERSION_MINOR_WITH_BIGINT = 5 +const NODE_VERSION_PATCH_WITH_BIGINT = 0 +const nodeVersion = process.versions.node.split('.') +const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) +const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) +const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) -function onFile (srcStat, destStat, src, dest, opts, cb) { - if (!destStat) return copyFile(srcStat, src, dest, opts, cb) - return mayCopyFile(srcStat, src, dest, opts, cb) +function nodeSupportsBigInt () { + if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { + return true + } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { + if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { + return true + } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { + if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { + return true + } + } + } + return false } -function mayCopyFile (srcStat, src, dest, opts, cb) { - if (opts.overwrite) { - fs.unlink(dest, err => { +function getStats (src, dest, cb) { + if (nodeSupportsBigInt()) { + fs.stat(src, { bigint: true }, (err, srcStat) => { if (err) return cb(err) - return copyFile(srcStat, src, dest, opts, cb) + fs.stat(dest, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) }) - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)) - } else return cb() -} - -function copyFile (srcStat, src, dest, opts, cb) { - if (typeof fs.copyFile === 'function') { - return fs.copyFile(src, dest, err => { + } else { + fs.stat(src, (err, srcStat) => { if (err) return cb(err) - return setDestModeAndTimestamps(srcStat, dest, opts, cb) + fs.stat(dest, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) }) } - return copyFileFallback(srcStat, src, dest, opts, cb) } -function copyFileFallback (srcStat, src, dest, opts, cb) { - const rs = fs.createReadStream(src) - rs.on('error', err => cb(err)).once('open', () => { - const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) - ws.on('error', err => cb(err)) - .on('open', () => rs.pipe(ws)) - .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) - }) +function getStatsSync (src, dest) { + let srcStat, destStat + if (nodeSupportsBigInt()) { + srcStat = fs.statSync(src, { bigint: true }) + } else { + srcStat = fs.statSync(src) + } + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(dest, { bigint: true }) + } else { + destStat = fs.statSync(dest) + } + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } } -function setDestModeAndTimestamps (srcStat, dest, opts, cb) { - fs.chmod(dest, srcStat.mode, err => { +function checkPaths (src, dest, funcName, cb) { + getStats(src, dest, (err, stats) => { if (err) return cb(err) - if (opts.preserveTimestamps) { - return utimes(dest, srcStat.atime, srcStat.mtime, cb) + const { srcStat, destStat } = stats + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error('Source and destination must not be the same.')) } - return cb() + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) }) } -function onDir (srcStat, destStat, src, dest, opts, cb) { - if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) - if (destStat && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) +function checkPathsSync (src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest) + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error('Source and destination must not be the same.') } - return copyDir(src, dest, opts, cb) + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } } -function mkDirAndCopy (srcStat, src, dest, opts, cb) { - fs.mkdir(dest, err => { - if (err) return cb(err) - copyDir(src, dest, opts, err => { - if (err) return cb(err) - return fs.chmod(dest, srcStat.mode, cb) +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +function checkParentPaths (src, srcStat, dest, funcName, cb) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return cb() + if (nodeSupportsBigInt()) { + fs.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) }) - }) -} - -function copyDir (src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) return cb(err) - return copyDirItems(items, src, dest, opts, cb) - }) -} - -function copyDirItems (items, src, dest, opts, cb) { - const item = items.pop() - if (!item) return cb() - return copyDirItem(items, item, src, dest, opts, cb) -} - -function copyDirItem (items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { - if (err) return cb(err) - const { destStat } = stats - startCopy(destStat, srcItem, destItem, opts, err => { - if (err) return cb(err) - return copyDirItems(items, src, dest, opts, cb) + } else { + fs.stat(destParent, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) }) - }) + } } -function onLink (destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) return cb(err) - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) - } - - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb) +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(destParent, { bigint: true }) } else { - fs.readlink(dest, (err, resolvedDest) => { - if (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) - return cb(err) - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest) - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) - } - - // do not copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) - } - return copyLink(resolvedSrc, dest, cb) - }) + destStat = fs.statSync(destParent) } - }) + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) } -function copyLink (resolvedSrc, dest, cb) { - fs.unlink(dest, err => { - if (err) return cb(err) - return fs.symlink(resolvedSrc, dest, cb) - }) +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) } -module.exports = copy - - -/***/ }), - -/***/ 61335: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} -const u = __webpack_require__(9046)/* .fromCallback */ .E module.exports = { - copy: u(__webpack_require__(38834)) + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir } /***/ }), -/***/ 96970: +/***/ 52548: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const u = __webpack_require__(9046)/* .fromCallback */ .E const fs = __webpack_require__(77758) +const os = __webpack_require__(12087) const path = __webpack_require__(85622) -const mkdir = __webpack_require__(98605) -const remove = __webpack_require__(47357) -const emptyDir = u(function emptyDir (dir, callback) { - callback = callback || function () {} - fs.readdir(dir, (err, items) => { - if (err) return mkdir.mkdirs(dir, callback) +// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not +function hasMillisResSync () { + let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) - items = items.map(item => path.join(dir, item)) + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') + const fd = fs.openSync(tmpfile, 'r+') + fs.futimesSync(fd, d, d) + fs.closeSync(fd) + return fs.statSync(tmpfile).mtime > 1435410243000 +} - deleteItem() +function hasMillisRes (callback) { + let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) - function deleteItem () { - const item = items.pop() - if (!item) return callback() - remove.remove(item, err => { + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { + if (err) return callback(err) + fs.open(tmpfile, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, d, d, err => { if (err) return callback(err) - deleteItem() + fs.close(fd, err => { + if (err) return callback(err) + fs.stat(tmpfile, (err, stats) => { + if (err) return callback(err) + callback(null, stats.mtime > 1435410243000) + }) + }) }) - } + }) }) -}) +} -function emptyDirSync (dir) { - let items - try { - items = fs.readdirSync(dir) - } catch (err) { - return mkdir.mkdirsSync(dir) +function timeRemoveMillis (timestamp) { + if (typeof timestamp === 'number') { + return Math.floor(timestamp / 1000) * 1000 + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + } else { + throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') } +} - items.forEach(item => { - item = path.join(dir, item) - remove.removeSync(item) +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) + fs.open(path, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, atime, mtime, futimesErr => { + fs.close(fd, closeErr => { + if (callback) callback(futimesErr || closeErr) + }) + }) }) } +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + module.exports = { - emptyDirSync, - emptydirSync: emptyDirSync, - emptyDir, - emptydir: emptyDir + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync } /***/ }), -/***/ 2164: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 67356: +/***/ ((module) => { "use strict"; -const u = __webpack_require__(9046)/* .fromCallback */ .E -const path = __webpack_require__(85622) -const fs = __webpack_require__(77758) -const mkdir = __webpack_require__(98605) -const pathExists = __webpack_require__(43835).pathExists +module.exports = clone -function createFile (file, callback) { - function makeFile () { - fs.writeFile(file, '', err => { - if (err) return callback(err) - callback() - }) - } +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} - fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err - if (!err && stats.isFile()) return callback() - const dir = path.dirname(file) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeFile() - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeFile() - }) - }) +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 } -function createFileSync (file) { - let stats - try { - stats = fs.statSync(file) - } catch (e) {} - if (stats && stats.isFile()) return - const dir = path.dirname(file) - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) - } +/***/ }), - fs.writeFileSync(file, '') +/***/ 77758: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var fs = __webpack_require__(35747) +var polyfills = __webpack_require__(20263) +var legacy = __webpack_require__(73086) +var clone = __webpack_require__(67356) + +var util = __webpack_require__(31669) + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' } -module.exports = { - createFile: u(createFile), - createFileSync +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) } +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) + } -/***/ }), +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) -/***/ 40055: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + retry() + } -"use strict"; + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) -const file = __webpack_require__(2164) -const link = __webpack_require__(53797) -const symlink = __webpack_require__(72549) + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + 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]) + __webpack_require__(42357).equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} -module.exports = { - // file - createFile: file.createFile, - createFileSync: file.createFileSync, - ensureFile: file.createFile, - ensureFileSync: file.createFileSync, - // link - createLink: link.createLink, - createLinkSync: link.createLinkSync, - ensureLink: link.createLink, - ensureLinkSync: link.createLinkSync, - // symlink - createSymlink: symlink.createSymlink, - createSymlinkSync: symlink.createSymlinkSync, - ensureSymlink: symlink.createSymlink, - ensureSymlinkSync: symlink.createSymlinkSync +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; } +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch -/***/ }), + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null -/***/ 53797: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + return go$readFile(path, options, cb) -"use strict"; + function go$readFile (path, options, cb) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null -const u = __webpack_require__(9046)/* .fromCallback */ .E -const path = __webpack_require__(85622) -const fs = __webpack_require__(77758) -const mkdir = __webpack_require__(98605) -const pathExists = __webpack_require__(43835).pathExists + return go$writeFile(path, data, options, cb) -function createLink (srcpath, dstpath, callback) { - function makeLink (srcpath, dstpath) { - fs.link(srcpath, dstpath, err => { - if (err) return callback(err) - callback(null) - }) + function go$writeFile (path, data, options, cb) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } } - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureLink') - return callback(err) - } + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeLink(srcpath, dstpath) - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeLink(srcpath, dstpath) - }) + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.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() + } }) - }) -} + } -function createLinkSync (srcpath, dstpath) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined + var fs$readdir = fs.readdir + fs.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) - try { - fs.lstatSync(srcpath) - } catch (err) { - err.message = err.message.replace('lstat', 'ensureLink') - throw err - } + return go$readdir(args) - const dir = path.dirname(dstpath) - const dirExists = fs.existsSync(dir) - if (dirExists) return fs.linkSync(srcpath, dstpath) - mkdir.mkdirsSync(dir) + function go$readdir$cb (err, files) { + if (files && files.sort) + files.sort() - return fs.linkSync(srcpath, dstpath) -} + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [args]]) -module.exports = { - createLink: u(createLink), - createLinkSync -} + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + } + } + function go$readdir (args) { + return fs$readdir.apply(fs, args) + } -/***/ }), + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } -/***/ 53727: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } -"use strict"; + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) -const path = __webpack_require__(85622) -const fs = __webpack_require__(77758) -const pathExists = __webpack_require__(43835).pathExists + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) -/** - * Function that returns two types of paths, one relative to symlink, and one - * relative to the current working directory. Checks if path is absolute or - * relative. If the path is relative, this function checks if the path is - * relative to symlink or relative to current working directory. This is an - * initiative to find a smarter `srcpath` to supply when building symlinks. - * This allows you to determine which path to use out of one of three possible - * types of source paths. The first is an absolute path. This is detected by - * `path.isAbsolute()`. When an absolute path is provided, it is checked to - * see if it exists. If it does it's used, if not an error is returned - * (callback)/ thrown (sync). The other two options for `srcpath` are a - * relative url. By default Node's `fs.symlink` works by creating a symlink - * using `dstpath` and expects the `srcpath` to be relative to the newly - * created symlink. If you provide a `srcpath` that does not exist on the file - * system it results in a broken symlink. To minimize this, the function - * checks to see if the 'relative to symlink' source file exists, and if it - * does it will use it. If it does not, it checks if there's a file that - * exists that is relative to the current working directory, if does its used. - * This preserves the expectations of the original fs.symlink spec and adds - * the ability to pass in `relative to current working direcotry` paths. - */ + 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 symlinkPaths (srcpath, dstpath, callback) { - if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() } - return callback(null, { - 'toCwd': srcpath, - 'toDst': srcpath - }) }) - } else { - const dstdir = path.dirname(dstpath) - const relativeToDst = path.join(dstdir, srcpath) - return pathExists(relativeToDst, (err, exists) => { - if (err) return callback(err) - if (exists) { - return callback(null, { - 'toCwd': relativeToDst, - 'toDst': srcpath - }) + } + + 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 { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': path.relative(dstdir, srcpath) - }) - }) + that.fd = fd + that.emit('open', fd) } }) } -} -function symlinkPathsSync (srcpath, dstpath) { - let exists - if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath) - if (!exists) throw new Error('absolute srcpath does not exist') - return { - 'toCwd': srcpath, - 'toDst': srcpath - } - } else { - const dstdir = path.dirname(dstpath) - const relativeToDst = path.join(dstdir, srcpath) - exists = fs.existsSync(relativeToDst) - if (exists) { - return { - 'toCwd': relativeToDst, - 'toDst': srcpath - } - } else { - exists = fs.existsSync(srcpath) - if (!exists) throw new Error('relative srcpath does not exist') - return { - 'toCwd': srcpath, - 'toDst': path.relative(dstdir, srcpath) - } + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.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 (path, flags, mode, cb) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) } } + + return fs } -module.exports = { - symlinkPaths, - symlinkPathsSync +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]) + } } /***/ }), -/***/ 18254: +/***/ 73086: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; - - -const fs = __webpack_require__(77758) - -function symlinkType (srcpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type - if (type) return callback(null, type) - fs.lstat(srcpath, (err, stats) => { - if (err) return callback(null, 'file') - type = (stats && stats.isDirectory()) ? 'dir' : 'file' - callback(null, type) - }) -} +var Stream = __webpack_require__(92413).Stream -function symlinkTypeSync (srcpath, type) { - let stats +module.exports = legacy - if (type) return type - try { - stats = fs.lstatSync(srcpath) - } catch (e) { - return 'file' +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream } - return (stats && stats.isDirectory()) ? 'dir' : 'file' -} -module.exports = { - symlinkType, - symlinkTypeSync -} + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + Stream.call(this); -/***/ }), + var self = this; -/***/ 72549: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; -"use strict"; + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + options = options || {}; -const u = __webpack_require__(9046)/* .fromCallback */ .E -const path = __webpack_require__(85622) -const fs = __webpack_require__(77758) -const _mkdirs = __webpack_require__(98605) -const mkdirs = _mkdirs.mkdirs -const mkdirsSync = _mkdirs.mkdirsSync + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } -const _symlinkPaths = __webpack_require__(53727) -const symlinkPaths = _symlinkPaths.symlinkPaths -const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + if (this.encoding) this.setEncoding(this.encoding); -const _symlinkType = __webpack_require__(18254) -const symlinkType = _symlinkType.symlinkType -const symlinkTypeSync = _symlinkType.symlinkTypeSync + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } -const pathExists = __webpack_require__(43835).pathExists + if (this.start > this.end) { + throw new Error('start must be <= end'); + } -function createSymlink (srcpath, dstpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type + this.pos = this.start; + } - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) return callback(err) - srcpath = relative.toDst - symlinkType(relative.toCwd, type, (err, type) => { - if (err) return callback(err) - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) - mkdirs(dir, err => { - if (err) return callback(err) - fs.symlink(srcpath, dstpath, type, callback) - }) - }) - }) + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); }) - }) -} + } -function createSymlinkSync (srcpath, dstpath, type) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); - const relative = symlinkPathsSync(srcpath, dstpath) - srcpath = relative.toDst - type = symlinkTypeSync(relative.toCwd, type) - const dir = path.dirname(dstpath) - const exists = fs.existsSync(dir) - if (exists) return fs.symlinkSync(srcpath, dstpath, type) - mkdirsSync(dir) - return fs.symlinkSync(srcpath, dstpath, type) -} + Stream.call(this); -module.exports = { - createSymlink: u(createSymlink), - createSymlinkSync -} + this.path = path; + this.fd = null; + this.writable = true; + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; -/***/ }), + options = options || {}; -/***/ 61176: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } -"use strict"; + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } -// This is adapted from https://github.com/normalize/mz -// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors -const u = __webpack_require__(9046)/* .fromCallback */ .E -const fs = __webpack_require__(77758) + this.pos = this.start; + } -const api = [ - 'access', - 'appendFile', - 'chmod', - 'chown', - 'close', - 'copyFile', - 'fchmod', - 'fchown', - 'fdatasync', - 'fstat', - 'fsync', - 'ftruncate', - 'futimes', - 'lchown', - 'lchmod', - 'link', - 'lstat', - 'mkdir', - 'mkdtemp', - 'open', - 'readFile', - 'readdir', - 'readlink', - 'realpath', - 'rename', - 'rmdir', - 'stat', - 'symlink', - 'truncate', - 'unlink', - 'utimes', - 'writeFile' -].filter(key => { - // Some commands are not available on some systems. Ex: - // fs.copyFile was added in Node.js v8.5.0 - // fs.mkdtemp was added in Node.js v5.10.0 - // fs.lchown is not available on at least some Linux - return typeof fs[key] === 'function' -}) + this.busy = false; + this._queue = []; -// Export all keys: -Object.keys(fs).forEach(key => { - if (key === 'promises') { - // fs.promises is a getter property that triggers ExperimentalWarning - // Don't re-export it here, the getter is defined in "lib/index.js" - return + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } } - exports[key] = fs[key] -}) +} -// Universalify async methods: -api.forEach(method => { - exports[method] = u(fs[method]) -}) -// We differ from mz/fs in that we still ship the old, broken, fs.exists() -// since we are a drop-in replacement for the native module -exports.exists = function (filename, callback) { - if (typeof callback === 'function') { - return fs.exists(filename, callback) - } - return new Promise(resolve => { - return fs.exists(filename, resolve) - }) -} +/***/ }), -// fs.read() & fs.write need special treatment due to multiple callback args +/***/ 20263: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -exports.read = function (fd, buffer, offset, length, position, callback) { - if (typeof callback === 'function') { - return fs.read(fd, buffer, offset, length, position, callback) - } - return new Promise((resolve, reject) => { - fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { - if (err) return reject(err) - resolve({ bytesRead, buffer }) - }) - }) -} +var constants = __webpack_require__(27619) -// Function signature can be -// fs.write(fd, buffer[, offset[, length[, position]]], callback) -// OR -// fs.write(fd, string[, position[, encoding]], callback) -// We need to handle both cases, so we use ...args -exports.write = function (fd, buffer, ...args) { - if (typeof args[args.length - 1] === 'function') { - return fs.write(fd, buffer, ...args) - } +var origCwd = process.cwd +var cwd = null - return new Promise((resolve, reject) => { - fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { - if (err) return reject(err) - resolve({ bytesWritten, buffer }) - }) - }) +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) {} -// fs.realpath.native only available in Node v9.2+ -if (typeof fs.realpath.native === 'function') { - exports.realpath.native = u(fs.realpath.native) +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) } +module.exports = patch -/***/ }), +function patch (fs) { + // (re-)implement some things that are known busted or missing. -/***/ 5630: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } -"use strict"; + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. -module.exports = Object.assign( - {}, - // Export promiseified graceful-fs: - __webpack_require__(61176), - // Export extra methods: - __webpack_require__(11135), - __webpack_require__(61335), - __webpack_require__(96970), - __webpack_require__(40055), - __webpack_require__(40213), - __webpack_require__(98605), - __webpack_require__(69665), - __webpack_require__(41497), - __webpack_require__(16570), - __webpack_require__(43835), - __webpack_require__(47357) -) + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) -// Export fs.promises as a getter property so that we don't trigger -// ExperimentalWarning before fs.promises is actually accessed. -const fs = __webpack_require__(35747) -if (Object.getOwnPropertyDescriptor(fs, 'promises')) { - Object.defineProperty(module.exports, "promises", ({ - get () { return fs.promises } - })) -} + 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) -/***/ 40213: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) -"use strict"; + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + // if lchmod/lchown do not exist, then make them no-ops + 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 () {} + } -const u = __webpack_require__(9046)/* .fromCallback */ .E -const jsonFile = __webpack_require__(18970) + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. -jsonFile.outputJson = u(__webpack_require__(60531)) -jsonFile.outputJsonSync = __webpack_require__(19421) -// aliases -jsonFile.outputJSON = jsonFile.outputJson -jsonFile.outputJSONSync = jsonFile.outputJsonSync -jsonFile.writeJSON = jsonFile.writeJson -jsonFile.writeJSONSync = jsonFile.writeJsonSync -jsonFile.readJSON = jsonFile.readJson -jsonFile.readJSONSync = jsonFile.readJsonSync + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + 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 < 60000) { + 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) + } -module.exports = jsonFile + // if read() returns EAGAIN, then just try it again. + 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) + } + // This ensures `util.promisify` works as it does for native `fs.read`. + 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) -/***/ 18970: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } -"use strict"; + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } -const u = __webpack_require__(9046)/* .fromCallback */ .E -const jsonFile = __webpack_require__(26160) + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } -module.exports = { - // jsonfile exports - readJson: u(jsonFile.readFile), - readJsonSync: jsonFile.readFileSync, - writeJson: u(jsonFile.writeFile), - writeJsonSync: jsonFile.writeFileSync -} + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.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) + }) + } + } -/***/ 19421: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + 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 + } + } + } -"use strict"; + 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) + }) + } + } -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const mkdir = __webpack_require__(98605) -const jsonFile = __webpack_require__(18970) + 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 outputJsonSync (file, data, options) { - const dir = path.dirname(file) + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + 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 += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + return stats; + } } - jsonFile.writeJsonSync(file, data, options) -} - -module.exports = outputJsonSync - - -/***/ }), - -/***/ 60531: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + if (er.code === "ENOSYS") + return true -const path = __webpack_require__(85622) -const mkdir = __webpack_require__(98605) -const pathExists = __webpack_require__(43835).pathExists -const jsonFile = __webpack_require__(18970) + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } -function outputJson (file, data, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} + return false } - - const dir = path.dirname(file) - - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return jsonFile.writeJson(file, data, options, callback) - - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - jsonFile.writeJson(file, data, options, callback) - }) - }) } -module.exports = outputJson - /***/ }), -/***/ 98605: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 31621: +/***/ ((module) => { "use strict"; -const u = __webpack_require__(9046)/* .fromCallback */ .E -const mkdirs = u(__webpack_require__(59677)) -const mkdirsSync = __webpack_require__(30684) - -module.exports = { - mkdirs, - mkdirsSync, - // alias - mkdirp: mkdirs, - mkdirpSync: mkdirsSync, - ensureDir: mkdirs, - ensureDirSync: mkdirsSync -} +module.exports = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; /***/ }), -/***/ 30684: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 59584: +/***/ ((module) => { "use strict"; -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const invalidWin32Path = __webpack_require__(71590).invalidWin32Path - -const o777 = parseInt('0777', 8) - -function mkdirsSync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } +/* +A hyperlink is opened upon encountering an OSC 8 escape sequence with the target URI. The syntax is - let mode = opts.mode - const xfs = opts.fs || fs +OSC 8 ; params ; URI BEL|ST - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - throw errInval - } +Following this, all subsequent cells that are painted are hyperlinks to this target. A hyperlink is closed with the same escape sequence, omitting the parameters and the URI but keeping the separators: - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null +OSC 8 ; ; BEL|ST - p = path.resolve(p) +const ST = '\u001B\\'; + */ +const OSC = '\u001B]'; +const BEL = '\u0007'; +const SEP = ';'; - try { - xfs.mkdirSync(p, mode) - made = made || p - } catch (err0) { - if (err0.code === 'ENOENT') { - if (path.dirname(p) === p) throw err0 - made = mkdirsSync(path.dirname(p), opts, made) - mkdirsSync(p, opts, made) - } else { - // In the case of any other error, just see if there's a dir there - // already. If so, then hooray! If not, then something is borked. - let stat - try { - stat = xfs.statSync(p) - } catch (err1) { - throw err0 - } - if (!stat.isDirectory()) throw err0 - } - } +const PARAM_SEP = ':'; +const EQ = '='; - return made -} +module.exports = (text, uri, params) => { + params = params || {}; -module.exports = mkdirsSync + return [ + OSC, + '8', + SEP, + Object.keys(params).map(key => key + EQ + params[key]).join(PARAM_SEP), + SEP, + uri, + BEL, + text, + OSC, + '8', + SEP, + SEP, + BEL + ].join(''); +}; /***/ }), -/***/ 59677: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 98043: +/***/ ((module) => { "use strict"; -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const invalidWin32Path = __webpack_require__(71590).invalidWin32Path - -const o777 = parseInt('0777', 8) - -function mkdirs (p, opts, callback, made) { - if (typeof opts === 'function') { - callback = opts - opts = {} - } else if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } - - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - return callback(errInval) - } +module.exports = (string, count = 1, options) => { + options = { + indent: ' ', + includeEmptyLines: false, + ...options + }; - let mode = opts.mode - const xfs = opts.fs || fs + if (typeof string !== 'string') { + throw new TypeError( + `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` + ); + } - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null + if (typeof count !== 'number') { + throw new TypeError( + `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` + ); + } - callback = callback || function () {} - p = path.resolve(p) + if (typeof options.indent !== 'string') { + throw new TypeError( + `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` + ); + } - xfs.mkdir(p, mode, er => { - if (!er) { - made = made || p - return callback(null, made) - } - switch (er.code) { - case 'ENOENT': - if (path.dirname(p) === p) return callback(er) - mkdirs(path.dirname(p), opts, (er, made) => { - if (er) callback(er, made) - else mkdirs(p, opts, callback, made) - }) - break + if (count === 0) { + return string; + } - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, (er2, stat) => { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) callback(er, made) - else callback(null, made) - }) - break - } - }) -} + const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; -module.exports = mkdirs + return string.replace(regex, options.indent.repeat(count)); +}; /***/ }), -/***/ 71590: +/***/ 98768: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +const fs = __webpack_require__(35747); -const path = __webpack_require__(85622) +let isDocker; -// get drive on windows -function getRootPath (p) { - p = path.normalize(path.resolve(p)).split(path.sep) - if (p.length > 0) return p[0] - return null +function hasDockerEnv() { + try { + fs.statSync('/.dockerenv'); + return true; + } catch (_) { + return false; + } } -// http://stackoverflow.com/a/62888/10333 contains more accurate -// TODO: expand to include the rest -const INVALID_PATH_CHARS = /[<>:"|?*]/ - -function invalidWin32Path (p) { - const rp = getRootPath(p) - p = p.replace(rp, '') - return INVALID_PATH_CHARS.test(p) +function hasDockerCGroup() { + try { + return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker'); + } catch (_) { + return false; + } } -module.exports = { - getRootPath, - invalidWin32Path -} +module.exports = () => { + if (isDocker === undefined) { + isDocker = hasDockerEnv() || hasDockerCGroup(); + } + + return isDocker; +}; /***/ }), -/***/ 69665: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 64882: +/***/ ((module) => { "use strict"; +/* eslint-disable yoda */ -module.exports = { - moveSync: __webpack_require__(96445) -} +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { + return false; + } + + // Code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= codePoint && codePoint <= 0x4DBF) || + // CJK Unified Ideographs .. Yi Radicals + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || + // Hangul Jamo Extended-A + (0xA960 <= codePoint && codePoint <= 0xA97C) || + // Hangul Syllables + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + // CJK Compatibility Ideographs + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + // Vertical Forms + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + // CJK Compatibility Forms .. Small Form Variants + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || + // Halfwidth and Fullwidth Forms + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || + // Kana Supplement + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + // Enclosed Ideographic Supplement + (0x1F200 <= codePoint && codePoint <= 0x1F251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= codePoint && codePoint <= 0x3FFFD) + ) + ) { + return true; + } + + return false; +}; + +module.exports = isFullwidthCodePoint; +module.exports.default = isFullwidthCodePoint; /***/ }), -/***/ 96445: +/***/ 52559: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +const os = __webpack_require__(12087); +const fs = __webpack_require__(35747); +const isDocker = __webpack_require__(98768); -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const copySync = __webpack_require__(11135).copySync -const removeSync = __webpack_require__(47357).removeSync -const mkdirpSync = __webpack_require__(98605).mkdirpSync -const stat = __webpack_require__(73901) - -function moveSync (src, dest, opts) { - opts = opts || {} - const overwrite = opts.overwrite || opts.clobber || false +const isWsl = () => { + if (process.platform !== 'linux') { + return false; + } - const { srcStat } = stat.checkPathsSync(src, dest, 'move') - stat.checkParentPathsSync(src, srcStat, dest, 'move') - mkdirpSync(path.dirname(dest)) - return doRename(src, dest, overwrite) -} + if (os.release().toLowerCase().includes('microsoft')) { + if (isDocker()) { + return false; + } -function doRename (src, dest, overwrite) { - if (overwrite) { - removeSync(dest) - return rename(src, dest, overwrite) - } - if (fs.existsSync(dest)) throw new Error('dest already exists.') - return rename(src, dest, overwrite) -} + return true; + } -function rename (src, dest, overwrite) { - try { - fs.renameSync(src, dest) - } catch (err) { - if (err.code !== 'EXDEV') throw err - return moveAcrossDevice(src, dest, overwrite) - } -} + try { + return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ? + !isDocker() : false; + } catch (_) { + return false; + } +}; -function moveAcrossDevice (src, dest, overwrite) { - const opts = { - overwrite, - errorOnExist: true - } - copySync(src, dest, opts) - return removeSync(src) +if (process.env.__IS_WSL_TEST__) { + module.exports = isWsl; +} else { + module.exports = isWsl(); } -module.exports = moveSync - /***/ }), -/***/ 41497: +/***/ 97126: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; - - -const u = __webpack_require__(9046)/* .fromCallback */ .E -module.exports = { - move: u(__webpack_require__(72231)) +var fs = __webpack_require__(35747) +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = __webpack_require__(42001) +} else { + core = __webpack_require__(9728) } +module.exports = isexe +isexe.sync = sync -/***/ }), - -/***/ 72231: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const copy = __webpack_require__(61335).copy -const remove = __webpack_require__(47357).remove -const mkdirp = __webpack_require__(98605).mkdirp -const pathExists = __webpack_require__(43835).pathExists -const stat = __webpack_require__(73901) - -function move (src, dest, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = {} +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} } - const overwrite = opts.overwrite || opts.clobber || false + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } - stat.checkPaths(src, dest, 'move', (err, stats) => { - if (err) return cb(err) - const { srcStat } = stats - stat.checkParentPaths(src, srcStat, dest, 'move', err => { - if (err) return cb(err) - mkdirp(path.dirname(dest), err => { - if (err) return cb(err) - return doRename(src, dest, overwrite, cb) + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } }) }) - }) -} - -function doRename (src, dest, overwrite, cb) { - if (overwrite) { - return remove(dest, err => { - if (err) return cb(err) - return rename(src, dest, overwrite, cb) - }) } - pathExists(dest, (err, destExists) => { - if (err) return cb(err) - if (destExists) return cb(new Error('dest already exists.')) - return rename(src, dest, overwrite, cb) - }) -} -function rename (src, dest, overwrite, cb) { - fs.rename(src, dest, err => { - if (!err) return cb() - if (err.code !== 'EXDEV') return cb(err) - return moveAcrossDevice(src, dest, overwrite, cb) + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) }) } -function moveAcrossDevice (src, dest, overwrite, cb) { - const opts = { - overwrite, - errorOnExist: true +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } } - copy(src, dest, opts, err => { - if (err) return cb(err) - return remove(src, cb) - }) } -module.exports = move - /***/ }), -/***/ 16570: +/***/ 9728: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +module.exports = isexe +isexe.sync = sync +var fs = __webpack_require__(35747) -const u = __webpack_require__(9046)/* .fromCallback */ .E -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const mkdir = __webpack_require__(98605) -const pathExists = __webpack_require__(43835).pathExists +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} -function outputFile (file, data, encoding, callback) { - if (typeof encoding === 'function') { - callback = encoding - encoding = 'utf8' - } +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} - const dir = path.dirname(file) - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return fs.writeFile(file, data, encoding, callback) +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} - mkdir.mkdirs(dir, err => { - if (err) return callback(err) +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid - fs.writeFile(file, data, encoding, callback) - }) - }) -} + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() -function outputFileSync (file, ...args) { - const dir = path.dirname(file) - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args) - } - mkdir.mkdirsSync(dir) - fs.writeFileSync(file, ...args) -} + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g -module.exports = { - outputFile: u(outputFile), - outputFileSync + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret } /***/ }), -/***/ 43835: +/***/ 42001: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +module.exports = isexe +isexe.sync = sync -const u = __webpack_require__(9046)/* .fromPromise */ .p -const fs = __webpack_require__(61176) +var fs = __webpack_require__(35747) -function pathExists (path) { - return fs.access(path).then(() => true).catch(() => false) +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false } -module.exports = { - pathExists: u(pathExists), - pathExistsSync: fs.existsSync +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) } /***/ }), -/***/ 47357: +/***/ 21917: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const u = __webpack_require__(9046)/* .fromCallback */ .E -const rimraf = __webpack_require__(38761) -module.exports = { - remove: u(rimraf), - removeSync: rimraf.sync -} +var yaml = __webpack_require__(40916); + + +module.exports = yaml; /***/ }), -/***/ 38761: +/***/ 40916: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) -const assert = __webpack_require__(42357) -const isWindows = (process.platform === 'win32') +var loader = __webpack_require__(45190); +var dumper = __webpack_require__(73034); -function defaults (options) { - const methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(m => { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) - options.maxBusyTries = options.maxBusyTries || 3 +function deprecated(name) { + return function () { + throw new Error('Function ' + name + ' is deprecated and cannot be used.'); + }; } -function rimraf (p, options, cb) { - let busyTries = 0 - if (typeof options === 'function') { - cb = options - options = {} - } +module.exports.Type = __webpack_require__(30967); +module.exports.Schema = __webpack_require__(66514); +module.exports.FAILSAFE_SCHEMA = __webpack_require__(66037); +module.exports.JSON_SCHEMA = __webpack_require__(1571); +module.exports.CORE_SCHEMA = __webpack_require__(92183); +module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(48949); +module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(56874); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.safeLoad = loader.safeLoad; +module.exports.safeLoadAll = loader.safeLoadAll; +module.exports.dump = dumper.dump; +module.exports.safeDump = dumper.safeDump; +module.exports.YAMLException = __webpack_require__(65199); - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') +// Deprecated schema names from JS-YAML 2.0.x +module.exports.MINIMAL_SCHEMA = __webpack_require__(66037); +module.exports.SAFE_SCHEMA = __webpack_require__(48949); +module.exports.DEFAULT_SCHEMA = __webpack_require__(56874); - defaults(options) +// Deprecated functions from JS-YAML 1.x.x +module.exports.scan = deprecated('scan'); +module.exports.parse = deprecated('parse'); +module.exports.compose = deprecated('compose'); +module.exports.addConstructor = deprecated('addConstructor'); - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && - busyTries < options.maxBusyTries) { - busyTries++ - const time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(() => rimraf_(p, options, CB), time) - } - // already gone - if (er.code === 'ENOENT') er = null - } +/***/ }), - cb(er) - }) -} +/***/ 59136: +/***/ ((module) => { -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') +"use strict"; - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, (er, st) => { - if (er && er.code === 'ENOENT') { - return cb(null) - } - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === 'EPERM' && isWindows) { - return fixWinEPERM(p, options, er, cb) - } - if (st && st.isDirectory()) { - return rmdir(p, options, er, cb) - } +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); +} - options.unlink(p, er => { - if (er) { - if (er.code === 'ENOENT') { - return cb(null) - } - if (er.code === 'EPERM') { - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - } - if (er.code === 'EISDIR') { - return rmdir(p, options, er, cb) - } - } - return cb(er) - }) - }) + +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); } -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) { - assert(er instanceof Error) - } - options.chmod(p, 0o666, er2 => { - if (er2) { - cb(er2.code === 'ENOENT' ? null : er) - } else { - options.stat(p, (er3, stats) => { - if (er3) { - cb(er3.code === 'ENOENT' ? null : er) - } else if (stats.isDirectory()) { - rmdir(p, options, er, cb) - } else { - options.unlink(p, cb) - } - }) - } - }) +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; } -function fixWinEPERMSync (p, options, er) { - let stats - assert(p) - assert(options) - if (er) { - assert(er instanceof Error) - } +function extend(target, source) { + var index, length, key, sourceKeys; - try { - options.chmodSync(p, 0o666) - } catch (er2) { - if (er2.code === 'ENOENT') { - return - } else { - throw er - } - } + if (source) { + sourceKeys = Object.keys(source); - try { - stats = options.statSync(p) - } catch (er3) { - if (er3.code === 'ENOENT') { - return - } else { - throw er + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; } } - if (stats.isDirectory()) { - rmdirSync(p, options, er) - } else { - options.unlinkSync(p) - } + return target; } -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) + +function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; } - assert(typeof cb === 'function') - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, er => { - if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { - rmkids(p, options, cb) - } else if (er && er.code === 'ENOTDIR') { - cb(originalEr) - } else { - cb(er) - } - }) + return result; } -function rmkids (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - options.readdir(p, (er, files) => { - if (er) return cb(er) +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +} - let n = files.length - let errState - if (n === 0) return options.rmdir(p, cb) +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; - files.forEach(f => { - rimraf(path.join(p, f), options, er => { - if (errState) { - return - } - if (er) return cb(errState = er) - if (--n === 0) { - options.rmdir(p, cb) - } - }) - }) - }) -} -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - let st +/***/ }), - options = options || {} - defaults(options) +/***/ 73034: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') +"use strict"; - try { - st = options.lstatSync(p) - } catch (er) { - if (er.code === 'ENOENT') { - return - } - // Windows can EPERM on stat. Life is suffering. - if (er.code === 'EPERM' && isWindows) { - fixWinEPERMSync(p, options, er) - } - } +/*eslint-disable no-use-before-define*/ - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) { - rmdirSync(p, options, null) - } else { - options.unlinkSync(p) - } - } catch (er) { - if (er.code === 'ENOENT') { - return - } else if (er.code === 'EPERM') { - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - } else if (er.code !== 'EISDIR') { - throw er - } - rmdirSync(p, options, er) - } -} +var common = __webpack_require__(59136); +var YAMLException = __webpack_require__(65199); +var DEFAULT_FULL_SCHEMA = __webpack_require__(56874); +var DEFAULT_SAFE_SCHEMA = __webpack_require__(48949); -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === 'ENOTDIR') { - throw originalEr - } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { - rmkidsSync(p, options) - } else if (er.code !== 'ENOENT') { - throw er - } - } -} +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) +var ESCAPE_SEQUENCES = {}; - if (isWindows) { - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - const startTime = Date.now() - do { - try { - const ret = options.rmdirSync(p, options) - return ret - } catch (er) { } - } while (Date.now() - startTime < 500) // give up after 500ms - } else { - const ret = options.rmdirSync(p, options) - return ret - } -} +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; -module.exports = rimraf -rimraf.sync = rimrafSync +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 {}; -/***/ 47696: -/***/ ((module) => { + result = {}; + keys = Object.keys(map); -"use strict"; + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); -/* eslint-disable node/no-deprecated-api */ -module.exports = function (size) { - if (typeof Buffer.allocUnsafe === 'function') { - try { - return Buffer.allocUnsafe(size) - } catch (e) { - return new Buffer(size) + 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 new Buffer(size) + + return result; } +function encodeHex(character) { + var string, handle, length; -/***/ }), + string = character.toString(16).toUpperCase(); -/***/ 73901: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } -"use strict"; + 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; -const fs = __webpack_require__(77758) -const path = __webpack_require__(85622) + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; -const NODE_VERSION_MAJOR_WITH_BIGINT = 10 -const NODE_VERSION_MINOR_WITH_BIGINT = 5 -const NODE_VERSION_PATCH_WITH_BIGINT = 0 -const nodeVersion = process.versions.node.split('.') -const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) -const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) -const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) + this.tag = null; + this.result = ''; -function nodeSupportsBigInt () { - if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { - return true - } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { - if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { - return true - } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { - if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { - return true - } - } - } - return false + this.duplicates = []; + this.usedDuplicates = null; } -function getStats (src, dest, cb) { - if (nodeSupportsBigInt()) { - fs.stat(src, { bigint: true }, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) - return cb(err) - } - return cb(null, { srcStat, destStat }) - }) - }) - } else { - fs.stat(src, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) - return cb(err) - } - return cb(null, { srcStat, destStat }) - }) - }) - } -} +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; -function getStatsSync (src, dest) { - let srcStat, destStat - if (nodeSupportsBigInt()) { - srcStat = fs.statSync(src, { bigint: true }) - } else { - srcStat = fs.statSync(src) - } - try { - if (nodeSupportsBigInt()) { - destStat = fs.statSync(dest, { bigint: true }) + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; } else { - destStat = fs.statSync(dest) + line = string.slice(position, next + 1); + position = next + 1; } - } catch (err) { - if (err.code === 'ENOENT') return { srcStat, destStat: null } - throw err - } - return { srcStat, destStat } -} -function checkPaths (src, dest, funcName, cb) { - getStats(src, dest, (err, stats) => { - if (err) return cb(err) - const { srcStat, destStat } = stats - if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error('Source and destination must not be the same.')) - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))) - } - return cb(null, { srcStat, destStat }) - }) -} + if (line.length && line !== '\n') result += ind; -function checkPathsSync (src, dest, funcName) { - const { srcStat, destStat } = getStatsSync(src, dest) - if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - throw new Error('Source and destination must not be the same.') - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)) + result += line; } - return { srcStat, destStat } + + return result; } -// recursively check if dest parent is a subdirectory of src. -// It works for all file types including symlinks since it -// checks the src and dest inodes. It starts from the deepest -// parent and stops once it reaches the src parent or the root path. -function checkParentPaths (src, srcStat, dest, funcName, cb) { - const srcParent = path.resolve(path.dirname(src)) - const destParent = path.resolve(path.dirname(dest)) - if (destParent === srcParent || destParent === path.parse(destParent).root) return cb() - if (nodeSupportsBigInt()) { - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb() - return cb(err) - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error(errMsg(src, dest, funcName))) - } - return checkParentPaths(src, srcStat, destParent, funcName, cb) - }) - } else { - fs.stat(destParent, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb() - return cb(err) - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error(errMsg(src, dest, funcName))) - } - return checkParentPaths(src, srcStat, destParent, funcName, cb) - }) - } +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); } -function checkParentPathsSync (src, srcStat, dest, funcName) { - const srcParent = path.resolve(path.dirname(src)) - const destParent = path.resolve(path.dirname(dest)) - if (destParent === srcParent || destParent === path.parse(destParent).root) return - let destStat - try { - if (nodeSupportsBigInt()) { - destStat = fs.statSync(destParent, { bigint: true }) - } else { - destStat = fs.statSync(destParent) +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; } - } catch (err) { - if (err.code === 'ENOENT') return - throw err - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - throw new Error(errMsg(src, dest, funcName)) } - return checkParentPathsSync(src, srcStat, destParent, funcName) -} -// return true if dest is a subdir of src, otherwise false. -// It only checks the path strings. -function isSrcSubdir (src, dest) { - const srcArr = path.resolve(src).split(path.sep).filter(i => i) - const destArr = path.resolve(dest).split(path.sep).filter(i => i) - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) + return false; } -function errMsg (src, dest, funcName) { - return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; } -module.exports = { - checkPaths, - checkPathsSync, - checkParentPaths, - checkParentPathsSync, - isSrcSubdir +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || (0x10000 <= c && c <= 0x10FFFF); } +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// [24] b-line-feed ::= #xA /* LF */ +// [25] b-carriage-return ::= #xD /* CR */ +// [3] c-byte-order-mark ::= #xFEFF +function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) + // byte-order-mark + && c !== 0xFEFF + // b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} -/***/ }), - -/***/ 52548: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -const fs = __webpack_require__(77758) -const os = __webpack_require__(12087) -const path = __webpack_require__(85622) +// Simplified test for values allowed after the first character in plain style. +function isPlainSafe(c, prev) { + // Uses a subset of nb-char - c-flow-indicator - ":" - "#" + // where nb-char ::= c-printable - b-char - c-byte-order-mark. + return isPrintable(c) && c !== 0xFEFF + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // - ":" - "#" + // /* An ns-char preceding */ "#" + && c !== CHAR_COLON + && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); +} -// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not -function hasMillisResSync () { - let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + return isPrintable(c) && c !== 0xFEFF + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && 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; +} - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') - const fd = fs.openSync(tmpfile, 'r+') - fs.futimesSync(fd, d, d) - fs.closeSync(fd) - return fs.statSync(tmpfile).mtime > 1435410243000 +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); } -function hasMillisRes (callback) { - let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { - if (err) return callback(err) - fs.open(tmpfile, 'r+', (err, fd) => { - if (err) return callback(err) - fs.futimes(fd, d, d, err => { - if (err) return callback(err) - fs.close(fd, err => { - if (err) return callback(err) - fs.stat(tmpfile, (err, stats) => { - if (err) return callback(err) - callback(null, stats.mtime > 1435410243000) - }) - }) - }) - }) - }) -} +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(string.charCodeAt(0)) + && !isWhitespace(string.charCodeAt(string.length - 1)); -function timeRemoveMillis (timestamp) { - if (typeof timestamp === 'number') { - return Math.floor(timestamp / 1000) * 1000 - } else if (timestamp instanceof Date) { - return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + if (singleLineOnly) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + 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 { - throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') + // Case: block styles permitted. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (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); + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + return plain && !testAmbiguousType(string) + ? STYLE_PLAIN : STYLE_SINGLE; } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; } -function utimesMillis (path, atime, mtime, callback) { - // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) - fs.open(path, 'r+', (err, fd) => { - if (err) return callback(err) - fs.futimes(fd, atime, mtime, futimesErr => { - fs.close(fd, closeErr => { - if (callback) callback(futimesErr || closeErr) - }) - }) - }) +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +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); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + 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 utimesMillisSync (path, atime, mtime) { - const fd = fs.openSync(path, 'r+') - fs.futimesSync(fd, atime, mtime) - return fs.closeSync(fd) +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + 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'; } -module.exports = { - hasMillisRes, - hasMillisResSync, - timeRemoveMillis, - utimesMillis, - utimesMillisSync +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; } +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; -/***/ }), + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; -/***/ 67356: -/***/ ((module) => { + // rest of the lines + 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; + } -"use strict"; + return result; +} +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; -module.exports = clone + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) + return result.slice(1); // drop extra \n joiner +} - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; - return copy + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). + if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { + // Combine the surrogate pair and store it escaped. + result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); + // Advance index one extra since we already used that char here. + 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) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } -/***/ 77758: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + state.tag = _tag; + state.dump = '[' + _result + ']'; +} -var fs = __webpack_require__(35747) -var polyfills = __webpack_require__(20263) -var legacy = __webpack_require__(73086) -var clone = __webpack_require__(67356) +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; -var util = __webpack_require__(31669) + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. } -function noop () {} +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} + for (index = 0, length = objectKeyList.length; index < length; index += 1) { -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) - } + pairBuffer = ''; + if (index !== 0) pairBuffer += ', '; -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) + if (state.condenseFlow) pairBuffer += '"'; - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - retry() - } + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; - if (typeof cb === 'function') - cb.apply(this, arguments) - }) + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; } - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) + if (state.dump.length > 1024) pairBuffer += '? '; - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - retry() + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. } - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) + pairBuffer += state.dump; - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - __webpack_require__(42357).equal(fs[gracefulQueue].length, 0) - }) + // Both key and value are valid. + _result += pairBuffer; } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; + state.tag = _tag; + state.dump = '{' + _result + '}'; } -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } - return go$readFile(path, options, cb) + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; - function go$readFile (path, options, cb) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); } - } - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; - function go$writeFile (path, data, options, cb) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. } - } - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); - return go$appendFile(path, data, options, cb) + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } - function go$appendFile (path, data, options, cb) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); } - } - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. } - 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 = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - var args = [path] - if (typeof options !== 'function') { - args.push(options) + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; } else { - cb = options + pairBuffer += ': '; } - args.push(go$readdir$cb) - return go$readdir(args) + pairBuffer += state.dump; - function go$readdir$cb (err, files) { - if (files && files.sort) - files.sort() + // Both key and value are valid. + _result += pairBuffer; + } - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [args]]) + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - } - } +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; - function go$readdir (args) { - return fs$readdir.apply(fs, args) - } + typeList = explicit ? state.explicitTypes : state.implicitTypes; - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open + 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; + } } - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) + var type = _toString.call(state.dump); - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); } - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; } - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; } - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) + 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 { - that.fd = fd - that.emit('open', fd) + 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); + } - function createReadStream (path, options) { - return new fs.ReadStream(path, options) + if (state.tag !== null && state.tag !== '?') { + state.dump = '!<' + state.tag + '> ' + state.dump; + } } - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) + 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); +} - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; - return go$open(path, flags, mode, cb) + 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); - function go$open (path, flags, mode, cb) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() + 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); + } + } } } +} - return fs +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 enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); } -function retry () { - var elem = fs[gracefulQueue].shift() - if (elem) { - debug('RETRY', elem[0].name, elem[1]) - elem[0].apply(null, elem[1]) +module.exports.dump = dump; +module.exports.safeDump = safeDump; + + +/***/ }), + +/***/ 65199: +/***/ ((module) => { + +"use strict"; +// YAML error class. http://stackoverflow.com/questions/8458984 +// + + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; } } -/***/ }), +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; -/***/ 73086: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var Stream = __webpack_require__(92413).Stream +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; -module.exports = legacy + result += this.reason || '(unknown reason)'; -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); } - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); + return result; +}; - Stream.call(this); - var self = this; +module.exports = YAMLException; - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; +/***/ }), - options = options || {}; +/***/ 45190: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +"use strict"; - if (this.encoding) this.setEncoding(this.encoding); - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } +/*eslint-disable max-len,no-use-before-define*/ - if (this.start > this.end) { - throw new Error('start must be <= end'); - } +var common = __webpack_require__(59136); +var YAMLException = __webpack_require__(65199); +var Mark = __webpack_require__(55426); +var DEFAULT_SAFE_SCHEMA = __webpack_require__(48949); +var DEFAULT_FULL_SCHEMA = __webpack_require__(56874); - this.pos = this.start; - } - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } +var _hasOwnProperty = Object.prototype.hasOwnProperty; - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - Stream.call(this); +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; - this.path = path; - this.fd = null; - this.writable = true; - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; +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; - options = options || {}; - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +function _class(obj) { return Object.prototype.toString.call(obj); } - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} - this.pos = this.start; - } +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} - this.busy = false; - this._queue = []; +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; } +function fromHexCode(c) { + var lc; -/***/ }), + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } -/***/ 20263: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /*eslint-disable no-bitwise*/ + lc = c | 0x20; -var constants = __webpack_require__(27619) + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } -var origCwd = process.cwd -var cwd = null + return -1; +} -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; } -try { - process.cwd() -} catch (er) {} -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); } -module.exports = patch +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} -function patch (fs) { - // (re-)implement some things that are known busted or missing. - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } +function State(input, options) { + this.input = input; - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } + 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; - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +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)); + } +} - 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) +var directiveHandlers = { - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) + YAML: function handleYamlDirective(state, name, args) { - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) + var match, major, minor; - // if lchmod/lchown do not exist, then make them no-ops - 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) + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); } - fs.lchownSync = function () {} - } - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - 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 < 60000) { - 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) - } + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - // if read() returns EAGAIN, then just try it again. - 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 (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); } - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); - 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 - } + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); } - }})(fs.readSync) - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); } + }, - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + TAG: function handleTagDirective(state, name, args) { - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); } - } - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } + handle = args[0]; + prefix = args[1]; - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); } - } - 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) - }) + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); } + + state.tagMap[handle] = prefix; } +}; - 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 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 === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + 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; - 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) - }) - } + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); } - 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 - } + 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 statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + 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'); } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) } } - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; - } + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; } - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - if (er.code === "ENOSYS") - return true + keyNode = String(keyNode); - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } + if (_result === null) { + _result = {}; + } - return false + 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); -/***/ 31621: -/***/ ((module) => { + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } -"use strict"; + state.line += 1; + state.lineStart = state.position; +} -module.exports = (flag, argv) => { - argv = argv || process.argv; - const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const pos = argv.indexOf(prefix + flag); - const terminatorPos = argv.indexOf('--'); - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); -}; +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 === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } -/***/ 59584: -/***/ ((module) => { + if (is_EOL(ch)) { + readLineBreak(state); -"use strict"; + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } -/* -A hyperlink is opened upon encountering an OSC 8 escape sequence with the target URI. The syntax is + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } -OSC 8 ; params ; URI BEL|ST + return lineBreaks; +} -Following this, all subsequent cells that are painted are hyperlinks to this target. A hyperlink is closed with the same escape sequence, omitting the parameters and the URI but keeping the separators: +function testDocumentSeparator(state) { + var _position = state.position, + ch; -OSC 8 ; ; BEL|ST + ch = state.input.charCodeAt(_position); -const ST = '\u001B\\'; - */ -const OSC = '\u001B]'; -const BEL = '\u0007'; -const SEP = ';'; + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { -const PARAM_SEP = ':'; -const EQ = '='; + _position += 3; -module.exports = (text, uri, params) => { - params = params || {}; + ch = state.input.charCodeAt(_position); - return [ - OSC, - '8', - SEP, - Object.keys(params).map(key => key + EQ + params[key]).join(PARAM_SEP), - SEP, - uri, - BEL, - text, - OSC, - '8', - SEP, - SEP, - BEL - ].join(''); -}; + 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); + } +} -/***/ 98043: -/***/ ((module) => { -"use strict"; +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); -module.exports = (string, count = 1, options) => { - options = { - indent: ' ', - includeEmptyLines: false, - ...options - }; + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } - if (typeof string !== 'string') { - throw new TypeError( - `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` - ); - } + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); - if (typeof count !== 'number') { - throw new TypeError( - `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` - ); - } + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } - if (typeof options.indent !== 'string') { - throw new TypeError( - `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` - ); - } + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; - if (count === 0) { - return string; - } + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); - const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } - return string.replace(regex, options.indent.repeat(count)); -}; + } else if (ch === 0x23/* # */) { + 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; -/***/ 98768: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); -"use strict"; + 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; + } + } -const fs = __webpack_require__(35747); + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } -let isDocker; + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } -function hasDockerEnv() { - try { - fs.statSync('/.dockerenv'); - return true; - } catch (_) { - return false; - } -} + ch = state.input.charCodeAt(++state.position); + } -function hasDockerCGroup() { - try { - return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker'); - } catch (_) { - return false; - } -} + captureSegment(state, captureStart, captureEnd, false); -module.exports = () => { - if (isDocker === undefined) { - isDocker = hasDockerEnv() || hasDockerCGroup(); - } + if (state.result) { + return true; + } - return isDocker; -}; + state.kind = _kind; + state.result = _result; + return false; +} +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; -/***/ }), + ch = state.input.charCodeAt(state.position); -/***/ 64882: -/***/ ((module) => { + if (ch !== 0x27/* ' */) { + return false; + } -"use strict"; -/* eslint-disable yoda */ + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; - return false; -}; + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; + } 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; -/***/ 52559: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + ch = state.input.charCodeAt(state.position); -"use strict"; + if (ch !== 0x22/* " */) { + return false; + } -const os = __webpack_require__(12087); -const fs = __webpack_require__(35747); -const isDocker = __webpack_require__(98768); + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; -const isWsl = () => { - if (process.platform !== 'linux') { - return false; - } + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; - if (os.release().toLowerCase().includes('microsoft')) { - if (isDocker()) { - return false; - } + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); - return true; - } + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); - try { - return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ? - !isDocker() : false; - } catch (_) { - return false; - } -}; + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; -if (process.env.__IS_WSL_TEST__) { - module.exports = isWsl; -} else { - module.exports = isWsl(); -} + } 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; -/***/ 97126: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + } else { + throwError(state, 'expected hexadecimal character'); + } + } -var fs = __webpack_require__(35747) -var core -if (process.platform === 'win32' || global.TESTING_WINDOWS) { - core = __webpack_require__(42001) -} else { - core = __webpack_require__(9728) -} + state.result += charFromCodepoint(hexResult); -module.exports = isexe -isexe.sync = sync + state.position++; -function isexe (path, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } + } else { + throwError(state, 'unknown escape sequence'); + } - if (!cb) { - if (typeof Promise !== 'function') { - throw new TypeError('callback not provided') - } + captureStart = captureEnd = state.position; - return new Promise(function (resolve, reject) { - isexe(path, options || {}, function (er, is) { - if (er) { - reject(er) - } else { - resolve(is) - } - }) - }) - } + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; - core(path, options || {}, function (er, is) { - // ignore EACCES because that just means we aren't allowed to run it - if (er) { - if (er.code === 'EACCES' || options && options.ignoreErrors) { - er = null - is = false - } - } - cb(er, is) - }) -} + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); -function sync (path, options) { - // my kingdom for a filtered catch - try { - return core.sync(path, options || {}) - } catch (er) { - if (options && options.ignoreErrors || er.code === 'EACCES') { - return false } else { - throw er + state.position++; + captureEnd = state.position; } } -} + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} -/***/ }), - -/***/ 9728: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -module.exports = isexe -isexe.sync = sync +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; -var fs = __webpack_require__(35747) + ch = state.input.charCodeAt(state.position); -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, options)) - }) -} + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } -function sync (path, options) { - return checkStat(fs.statSync(path), options) -} + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } -function checkStat (stat, options) { - return stat.isFile() && checkMode(stat, options) -} + ch = state.input.charCodeAt(++state.position); -function checkMode (stat, options) { - var mod = stat.mode - var uid = stat.uid - var gid = stat.gid + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); - var myUid = options.uid !== undefined ? - options.uid : process.getuid && process.getuid() - var myGid = options.gid !== undefined ? - options.gid : process.getgid && process.getgid() + ch = state.input.charCodeAt(state.position); - var u = parseInt('100', 8) - var g = parseInt('010', 8) - var o = parseInt('001', 8) - var ug = u | g + 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'); + } - var ret = (mod & o) || - (mod & g) && gid === myGid || - (mod & u) && uid === myUid || - (mod & ug) && myUid === 0 + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; - return ret -} + if (ch === 0x3F/* ? */) { + 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); -/***/ 42001: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + ch = state.input.charCodeAt(state.position); -module.exports = isexe -isexe.sync = sync + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } -var fs = __webpack_require__(35747) + 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); + } -function checkPathExt (path, options) { - var pathext = options.pathExt !== undefined ? - options.pathExt : process.env.PATHEXT + skipSeparationSpace(state, true, nodeIndent); - if (!pathext) { - return true - } + ch = state.input.charCodeAt(state.position); - pathext = pathext.split(';') - if (pathext.indexOf('') !== -1) { - return true - } - for (var i = 0; i < pathext.length; i++) { - var p = pathext[i].toLowerCase() - if (p && path.substr(-p.length).toLowerCase() === p) { - return true + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; } } - return false -} -function checkStat (stat, path, options) { - if (!stat.isSymbolicLink() && !stat.isFile()) { - return false - } - return checkPathExt(path, options) + throwError(state, 'unexpected end of the stream within a flow collection'); } -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, path, options)) - }) -} +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; -function sync (path, options) { - return checkStat(fs.statSync(path), path, options) -} + ch = state.input.charCodeAt(state.position); + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } -/***/ }), + state.kind = 'scalar'; + state.result = ''; -/***/ 21917: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); -"use strict"; + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? 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; + } + } -var yaml = __webpack_require__(40916); + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } -module.exports = yaml; + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + ch = state.input.charCodeAt(state.position); -/***/ }), + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } -/***/ 40916: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } -"use strict"; + if (is_EOL(ch)) { + emptyLines++; + continue; + } + // End of the scalar. + if (state.lineIndent < textIndent) { + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } -var loader = __webpack_require__(45190); -var dumper = __webpack_require__(73034); + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + // Folded style: use fancy rules to handle line breaks. + if (folding) { -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; -} + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); -module.exports.Type = __webpack_require__(30967); -module.exports.Schema = __webpack_require__(66514); -module.exports.FAILSAFE_SCHEMA = __webpack_require__(66037); -module.exports.JSON_SCHEMA = __webpack_require__(1571); -module.exports.CORE_SCHEMA = __webpack_require__(92183); -module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(48949); -module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(56874); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.safeLoad = loader.safeLoad; -module.exports.safeLoadAll = loader.safeLoadAll; -module.exports.dump = dumper.dump; -module.exports.safeDump = dumper.safeDump; -module.exports.YAMLException = __webpack_require__(65199); + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } -// Deprecated schema names from JS-YAML 2.0.x -module.exports.MINIMAL_SCHEMA = __webpack_require__(66037); -module.exports.SAFE_SCHEMA = __webpack_require__(48949); -module.exports.DEFAULT_SCHEMA = __webpack_require__(56874); + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } -// Deprecated functions from JS-YAML 1.x.x -module.exports.scan = deprecated('scan'); -module.exports.parse = deprecated('parse'); -module.exports.compose = deprecated('compose'); -module.exports.addConstructor = deprecated('addConstructor'); + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + 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); + } -/***/ 59136: -/***/ ((module) => { + captureSegment(state, captureStart, state.position, false); + } -"use strict"; + 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; + } -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); -} + ch = state.input.charCodeAt(state.position); + while (ch !== 0) { -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); -} + if (ch !== 0x2D/* - */) { + break; + } + following = state.input.charCodeAt(state.position + 1); -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; + if (!is_WS_OR_EOL(following)) { + break; + } - return [ sequence ]; -} + detected = true; + state.position++; + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } -function extend(target, source) { - var index, length, key, sourceKeys; + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); - if (source) { - sourceKeys = Object.keys(source); + ch = state.input.charCodeAt(state.position); - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; } } - return target; + 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; -function repeat(string, count) { - var result = '', cycle; - - for (cycle = 0; cycle < count; cycle += 1) { - result += string; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; } - return result; -} + ch = state.input.charCodeAt(state.position); + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); -} + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } -module.exports.isNothing = isNothing; -module.exports.isObject = isObject; -module.exports.toArray = toArray; -module.exports.repeat = repeat; -module.exports.isNegativeZero = isNegativeZero; -module.exports.extend = extend; + detected = true; + atExplicitKey = true; + allowCompact = true; + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; -/***/ }), + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } -/***/ 73034: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + state.position += 1; + ch = following; -"use strict"; + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); -/*eslint-disable no-use-before-define*/ + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } -var common = __webpack_require__(59136); -var YAMLException = __webpack_require__(65199); -var DEFAULT_FULL_SCHEMA = __webpack_require__(56874); -var DEFAULT_SAFE_SCHEMA = __webpack_require__(48949); + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_EQUALS = 0x3D; /* = */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } -var ESCAPE_SEQUENCES = {}; + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - if (map === null) return {}; + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } - result = {}; - keys = Object.keys(map); + } else { + break; // Reading is done. Go to the epilogue. + } - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); + // + // Common reading code for both explicit and implicit notations. + // + 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 (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); + 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); } - type = schema.compiledTypeMap['fallback'][tag]; - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; } + } - result[tag] = style; + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); } - return result; + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; } -function encodeHex(character) { - var string, handle, length; +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; - string = character.toString(16).toUpperCase(); + ch = state.input.charCodeAt(state.position); - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); } - return '\\' + handle + common.repeat('0', length - string.length) + string; -} + ch = state.input.charCodeAt(++state.position); -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; + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); - this.tag = null; - this.result = ''; + } else { + tagHandle = '!'; + } - this.duplicates = []; - this.usedDuplicates = null; -} + _position = state.position; -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); } else { - line = string.slice(position, next + 1); - position = next + 1; + throwError(state, 'unexpected end of the stream within a verbatim tag'); } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { - if (line.length && line !== '\n') result += ind; - - result += line; - } + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); - return result; -} + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } -function testImplicitResolving(state, str) { - var index, length, type; + ch = state.input.charCodeAt(++state.position); + } - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; + tagName = state.input.slice(_position, state.position); - if (type.resolve(str)) { - return true; + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); } } - return false; -} + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} + if (isVerbatim) { + state.tag = tagName; -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) - || (0x10000 <= c && c <= 0x10FFFF); -} + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// [24] b-line-feed ::= #xA /* LF */ -// [25] b-carriage-return ::= #xD /* CR */ -// [3] c-byte-order-mark ::= #xFEFF -function isNsChar(c) { - return isPrintable(c) && !isWhitespace(c) - // byte-order-mark - && c !== 0xFEFF - // b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} + } else if (tagHandle === '!') { + state.tag = '!' + tagName; -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c, prev) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // - ":" - "#" - // /* An ns-char preceding */ "#" - && c !== CHAR_COLON - && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); -} + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return isPrintable(c) && c !== 0xFEFF - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && 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; -} + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); + return true; } -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; +function readAnchorProperty(state) { + var _position, + ch; -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { - var i; - var char, prev_char; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(string.charCodeAt(0)) - && !isWhitespace(string.charCodeAt(string.length - 1)); + ch = state.input.charCodeAt(state.position); - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - 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 { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (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); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN : STYLE_SINGLE; + + 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); } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + + state.anchor = state.input.slice(_position, state.position); + return true; } -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -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 + "'"; - } +function readAlias(state) { + var _position, alias, + ch; - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + ch = state.input.charCodeAt(state.position); - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } + if (ch !== 0x2A/* * */) return false; - 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'); - } - }()); -} + ch = state.input.charCodeAt(++state.position); + _position = state.position; -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } - return indentIndicator + chomp + '\n'; -} + alias = state.input.slice(_position, state.position); -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - 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); // drop extra \n joiner -} - -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char, nextChar; - var escapeSeq; + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; } } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); } - return result; -} + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; + 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) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); } } - state.tag = _tag; - state.dump = '[' + _result + ']'; -} + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + 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 (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); } else { - _result += '- '; + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } } - - _result += state.dump; + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); } } - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; } -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) { +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; - pairBuffer = ''; - if (index !== 0) pairBuffer += ', '; + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; - if (state.condenseFlow) pairBuffer += '"'; + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + ch = state.input.charCodeAt(state.position); - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; } - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); } - pairBuffer += state.dump; - - // Both key and value are valid. - _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; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); - } - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); } - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); + if (is_EOL(ch)) break; - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } + _position = state.position; - pairBuffer += state.dump; + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } - if (explicitPair) { - pairBuffer += generateNextLine(state, level); + directiveArgs.push(state.input.slice(_position, state.position)); } - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } + if (ch !== 0) readLineBreak(state); - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); } else { - pairBuffer += ': '; + throwWarning(state, 'unknown document directive "' + directiveName + '"'); } + } - pairBuffer += state.dump; + skipSeparationSpace(state, true, -1); - // Both key and value are valid. - _result += pairBuffer; + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); } - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; + 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'); + } - typeList = explicit ? state.explicitTypes : state.implicitTypes; + state.documents.push(state.result); - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; + if (state.position === state.lineStart && testDocumentSeparator(state)) { - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } - state.tag = explicit ? type.tag : '?'; + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} - 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'); - } +function loadDocuments(input, options) { + input = String(input); + options = options || {}; - state.dump = _result; - } + if (input.length !== 0) { - return true; + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); } } - return false; -} + var state = new State(input, options); -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; + var nullpos = input.indexOf('\0'); - if (!detectType(state, object, false)) { - detectType(state, object, true); + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); } - var type = _toString.call(state.dump); + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; } - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; + while (state.position < (state.length - 1)) { + readDocument(state); } - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } + return state.documents; +} - 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; - } +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; } - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; + var documents = loadDocuments(input, options); - inspectNode(object, objects, duplicatesIndexes); + if (typeof iterator !== 'function') { + return documents; + } - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[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); +function load(input, options) { + var documents = loadDocuments(input, options); - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; } + throw new YAMLException('expected a single document in the stream, but found more'); } -function dump(input, options) { - options = options || {}; - var state = new State(options); +function safeLoadAll(input, iterator, options) { + if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { + options = iterator; + iterator = null; + } - if (!state.noRefs) getDuplicateReferences(input, state); + return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; - return ''; +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); } -function safeDump(input, options) { - return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} -module.exports.dump = dump; -module.exports.safeDump = safeDump; +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; /***/ }), -/***/ 65199: -/***/ ((module) => { +/***/ 55426: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -// YAML error class. http://stackoverflow.com/questions/8458984 -// -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); +var common = __webpack_require__(59136); - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; } -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + if (!this.buffer) return null; -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; + indent = indent || 4; + maxLength = maxLength || 75; - result += this.reason || '(unknown reason)'; + head = ''; + start = this.position; - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); + while (start > 0 && '\x00\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; + } } - return result; + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\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) + '^'; }; -module.exports = YAMLException; +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); -/***/ 45190: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + if (!compact) { + snippet = this.getSnippet(); -"use strict"; + if (snippet) { + where += ':\n' + snippet; + } + } + return where; +}; -/*eslint-disable max-len,no-use-before-define*/ -var common = __webpack_require__(59136); -var YAMLException = __webpack_require__(65199); -var Mark = __webpack_require__(55426); -var DEFAULT_SAFE_SCHEMA = __webpack_require__(48949); -var DEFAULT_FULL_SCHEMA = __webpack_require__(56874); +module.exports = Mark; -var _hasOwnProperty = Object.prototype.hasOwnProperty; +/***/ }), +/***/ 66514: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; +"use strict"; -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; +/*eslint-disable max-len*/ +var common = __webpack_require__(59136); +var YAMLException = __webpack_require__(65199); +var Type = __webpack_require__(30967); -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 compileList(schema, name, result) { + var exclude = []; -function _class(obj) { return Object.prototype.toString.call(obj); } + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} + result.push(currentType); + }); -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); } -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} -function fromHexCode(c) { - var lc; +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; } - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); } - - return -1; + return result; } -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; - return -1; -} + 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.'); + } + }); -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); } -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} +Schema.DEFAULT = null; -function State(input, options) { - this.input = input; +Schema.create = function createSchema() { + var schemas, types; - 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; + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } - this.documents = []; + schemas = common.toArray(schemas); + types = common.toArray(types); - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ + 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 + }); +}; -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); -} +module.exports = Schema; -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} +/***/ }), -var directiveHandlers = { +/***/ 92183: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - YAML: function handleYamlDirective(state, name, args) { +"use strict"; +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. - 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'); - } +var Schema = __webpack_require__(66514); - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } +module.exports = new Schema({ + include: [ + __webpack_require__(1571) + ] +}); - 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) { +/***/ 56874: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var handle, prefix; +"use strict"; +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. - 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'); - } +var Schema = __webpack_require__(66514); - state.tagMap[handle] = prefix; - } -}; +module.exports = Schema.DEFAULT = new Schema({ + include: [ + __webpack_require__(48949) + ], + explicit: [ + __webpack_require__(25914), + __webpack_require__(69242), + __webpack_require__(27278) + ] +}); -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 === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } +/***/ 48949: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - state.result += _result; - } -} +"use strict"; +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) -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; - } - } -} +var Schema = __webpack_require__(66514); -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); +module.exports = new Schema({ + include: [ + __webpack_require__(92183) + ], + implicit: [ + __webpack_require__(83714), + __webpack_require__(81393) + ], + explicit: [ + __webpack_require__(32551), + __webpack_require__(96668), + __webpack_require__(76039), + __webpack_require__(69237) + ] +}); - 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]'; - } - } - } +/***/ }), - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } +/***/ 66037: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +"use strict"; +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 - 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; +var Schema = __webpack_require__(66514); - ch = state.input.charCodeAt(state.position); - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } +module.exports = new Schema({ + explicit: [ + __webpack_require__(52672), + __webpack_require__(5490), + __webpack_require__(31173) + ] +}); - 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); - } +/***/ 1571: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } +"use strict"; +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - if (is_EOL(ch)) { - readLineBreak(state); - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - return lineBreaks; -} +var Schema = __webpack_require__(66514); -function testDocumentSeparator(state) { - var _position = state.position, - ch; - ch = state.input.charCodeAt(_position); +module.exports = new Schema({ + include: [ + __webpack_require__(66037) + ], + implicit: [ + __webpack_require__(22671), + __webpack_require__(94675), + __webpack_require__(89963), + __webpack_require__(15564) + ] +}); - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - _position += 3; +/***/ }), - ch = state.input.charCodeAt(_position); +/***/ 30967: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } +"use strict"; - return false; -} -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} +var YAMLException = __webpack_require__(65199); +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; - ch = state.input.charCodeAt(state.position); +function compileStyleAliases(map) { + var result = {}; - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); } - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } + return result; +} - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; +function Type(tag, options) { + options = options || {}; - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); + 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.'); + } + }); - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } + // TODO: Add tag format check. + 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); - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} - if (is_WS_OR_EOL(preceding)) { - break; - } +module.exports = Type; - } 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; - } - } +/***/ 32551: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } +"use strict"; - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - ch = state.input.charCodeAt(++state.position); - } +/*eslint-disable no-bitwise*/ - captureSegment(state, captureStart, captureEnd, false); +var NodeBuffer; - if (state.result) { - return true; - } +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} - state.kind = _kind; - state.result = _result; - return false; -} +var Type = __webpack_require__(30967); -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - ch = state.input.charCodeAt(state.position); +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - if (ch !== 0x27/* ' */) { - return false; - } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; +function resolveYamlBinary(data) { + if (data === null) return false; - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; + // Skip CR/LF + if (code > 64) continue; - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); + // Fail on illegal characters + if (code < 0) return false; - } else { - state.position++; - captureEnd = state.position; - } + bitlen += 6; } - throwError(state, 'unexpected end of the stream within a single quoted scalar'); + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; } -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; - ch = state.input.charCodeAt(state.position); + // Collect by 6*4 bits (3 bytes) - if (ch !== 0x22/* " */) { - return false; + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + // Dump tail - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; + tailbits = (max % 4) * 6; - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; + return result; +} - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); + // Convert every three bytes to 4 ASCII characters. - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } - } else { - throwError(state, 'expected hexadecimal character'); - } - } + bits = (bits << 8) + object[idx]; + } - state.result += charFromCodepoint(hexResult); + // Dump tail - state.position++; + tail = max % 3; - } else { - throwError(state, 'unknown escape sequence'); - } + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } - captureStart = captureEnd = state.position; + return result; +} - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); - } 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; +/***/ 94675: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - ch = state.input.charCodeAt(state.position); +"use strict"; - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } +var Type = __webpack_require__(30967); - ch = state.input.charCodeAt(++state.position); +function resolveYamlBoolean(data) { + if (data === null) return false; - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); + var max = data.length; - ch = state.input.charCodeAt(state.position); + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} - 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'); - } +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); +module.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' +}); - 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); +/***/ 15564: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } +"use strict"; - 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); +var common = __webpack_require__(59136); +var Type = __webpack_require__(30967); - ch = state.input.charCodeAt(state.position); +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; } - throwError(state, 'unexpected end of the stream within a flow collection'); + return true; } -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; +function constructYamlFloat(data) { + var value, sign, base, digits; - ch = state.input.charCodeAt(state.position); + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); } - state.kind = 'scalar'; - state.result = ''; + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); + } else if (value === '.nan') { + return NaN; - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); - } 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'); - } + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; - } else { - break; - } } + return sign * parseFloat(value, 10); +} - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); +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'; } - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); + res = object.toString(10); - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} - if (is_EOL(ch)) { - emptyLines++; - continue; - } +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} - // End of the scalar. - if (state.lineIndent < textIndent) { +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - // Break this `while` cycle and go to the funciton's epilogue. - break; - } +/***/ }), - // Folded style: use fancy rules to handle line breaks. - if (folding) { +/***/ 89963: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); +"use strict"; - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } +var common = __webpack_require__(59136); +var Type = __webpack_require__(30967); - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } +function resolveYamlInteger(data) { + if (data === null) return false; - captureSegment(state, captureStart, state.position, false); - } + var max = data.length, + index = 0, + hasDigits = false, + ch; - return true; -} + if (!max) return false; -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; + ch = data[index]; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; } - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; - if (ch !== 0x2D/* - */) { - break; - } + // base 2, base 8, base 16 - following = state.input.charCodeAt(state.position + 1); + if (ch === 'b') { + // base 2 + index++; - if (!is_WS_OR_EOL(following)) { - break; + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; } - detected = true; - state.position++; - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; } + return hasDigits && ch !== '_'; } - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } - ch = state.input.charCodeAt(state.position); + // base 10 (except 0) or base 60 - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; + // value should not start with `_`; + 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 (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); } -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; +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); } - ch = state.input.charCodeAt(state.position); + ch = value[0]; - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - _pos = state.position; + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + if (value === '0') return 0; - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } + 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); + } - detected = true; - atExplicitKey = true; - allowCompact = true; + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; + value = 0; + base = 1; - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); - state.position += 1; - ch = following; + return sign * value; - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + } - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); + return sign * parseInt(value, 10); +} - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); +module.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); }, + /* eslint-disable max-len */ + 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' ] + } +}); - 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; +/***/ 27278: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); +"use strict"; - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); +var esprima; - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = _require('esprima'); +} catch (_) { + /* eslint-disable no-redeclare */ + /* global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} - } else { - break; // Reading is done. Go to the epilogue. - } +var Type = __webpack_require__(30967); - // - // Common reading code for both explicit and implicit notations. - // - 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; - } - } +function resolveJavascriptFunction(data) { + if (data === null) return false; - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; - } + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); + 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; } - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } + return true; + } catch (err) { + return false; } +} - // - // Epilogue. - // +function constructJavascriptFunction(data) { + /*jslint evil:true*/ - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + 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'); } - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} - return detected; +function representJavascriptFunction(object /*, style*/) { + return object.toString(); } -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} - ch = state.input.charCodeAt(state.position); +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); - if (ch !== 0x21/* ! */) return false; - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } +/***/ }), - ch = state.input.charCodeAt(++state.position); +/***/ 69242: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); +"use strict"; - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - } else { - tagHandle = '!'; +var Type = __webpack_require__(30967); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); } - _position = state.position; + return new RegExp(regexp, modifiers); +} - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; - 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 (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); + return result; +} - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); - 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'); - } - } +/***/ 25914: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } +"use strict"; - if (isVerbatim) { - state.tag = tagName; - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; +var Type = __webpack_require__(30967); - } else if (tagHandle === '!') { - state.tag = '!' + tagName; +function resolveJavascriptUndefined() { + return true; +} - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } +function representJavascriptUndefined() { + return ''; +} - return true; +function isUndefined(object) { + return typeof object === 'undefined'; } -function readAnchorProperty(state) { - var _position, - ch; +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); - ch = state.input.charCodeAt(state.position); - if (ch !== 0x26/* & */) return false; +/***/ }), - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } +/***/ 31173: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - ch = state.input.charCodeAt(++state.position); - _position = state.position; +"use strict"; - 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'); - } +var Type = __webpack_require__(30967); - state.anchor = state.input.slice(_position, state.position); - return true; -} +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); -function readAlias(state) { - var _position, alias, - ch; - ch = state.input.charCodeAt(state.position); +/***/ }), - if (ch !== 0x2A/* * */) return false; +/***/ 81393: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - ch = state.input.charCodeAt(++state.position); - _position = state.position; +"use strict"; - 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'); - } +var Type = __webpack_require__(30967); - alias = state.input.slice(_position, state.position); +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} - if (!state.anchorMap.hasOwnProperty(alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this { - state.tag = null; - state.anchor = null; - state.kind = null; - state.result = null; +"use strict"; - allowBlockStyles = allowBlockScalars = allowBlockCollections = - CONTEXT_BLOCK_OUT === nodeContext || - CONTEXT_BLOCK_IN === nodeContext; - if (allowToSeek) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; +var Type = __webpack_require__(30967); - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } +function resolveYamlNull(data) { + if (data === null) return true; - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; + var max = data.length; - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } +function constructYamlNull() { + return null; +} - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } +function isNull(object) { + return object === null; +} - blockIndent = state.position - state.lineStart; +module.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' +}); - 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'); - } +/***/ 96668: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; +"use strict"; - if (state.tag === null) { - state.tag = '?'; - } - } - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } +var Type = __webpack_require__(30967); - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; +function resolveYamlOmap(data) { + if (data === null) return true; - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - 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]; + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; - 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 + '"'); - } + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - 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; - } + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); } - } - if (state.listener !== null) { - state.listener('close', state); + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; } - return state.tag !== null || state.anchor !== null || hasContent; + + return true; } -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; +function constructYamlOmap(data) { + return data !== null ? data : []; +} - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); +/***/ }), - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } +/***/ 76039: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; +"use strict"; - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; +var Type = __webpack_require__(30967); - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } +var _toString = Object.prototype.toString; - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } +function resolveYamlPairs(data) { + if (data === null) return true; - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } + var index, length, pair, keys, result, + object = data; - if (is_EOL(ch)) break; + result = new Array(object.length); - _position = state.position; + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } + if (_toString.call(pair) !== '[object Object]') return false; - directiveArgs.push(state.input.slice(_position, state.position)); - } + keys = Object.keys(pair); - if (ch !== 0) readLineBreak(state); + if (keys.length !== 1) return false; - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } + result[index] = [ keys[0], pair[keys[0]] ]; } - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); + return true; +} - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } +function constructYamlPairs(data) { + if (data === null) return []; - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); + var index, length, pair, keys, result, + object = data; - 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'); - } + result = new Array(object.length); - state.documents.push(state.result); + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; - if (state.position === state.lineStart && testDocumentSeparator(state)) { + keys = Object.keys(pair); - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; + result[index] = [ keys[0], pair[keys[0]] ]; } - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } + return result; } +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - if (input.length !== 0) { +/***/ }), - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } +/***/ 5490: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } +"use strict"; - var state = new State(input, options); - var nullpos = input.indexOf('\0'); +var Type = __webpack_require__(30967); - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } +/***/ }), - while (state.position < (state.length - 1)) { - readDocument(state); - } +/***/ 69237: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return state.documents; -} +"use strict"; + + +var Type = __webpack_require__(30967); +var _hasOwnProperty = Object.prototype.hasOwnProperty; -function loadAll(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } +function resolveYamlSet(data) { + if (data === null) return true; - var documents = loadDocuments(input, options); + var key, object = data; - if (typeof iterator !== 'function') { - return documents; + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } } - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } + return true; } - -function load(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new YAMLException('expected a single document in the stream, but found more'); +function constructYamlSet(data) { + return data !== null ? data : {}; } +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); -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)); -} +/***/ }), + +/***/ 52672: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +"use strict"; -function safeLoad(input, options) { - return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} +var Type = __webpack_require__(30967); -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); /***/ }), -/***/ 55426: +/***/ 83714: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +var Type = __webpack_require__(30967); -var common = __webpack_require__(59136); +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; +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; -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - if (!this.buffer) return null; + if (match === null) throw new Error('Date resolve error'); - indent = indent || 4; - maxLength = maxLength || 75; + // match: [1] year [2] month [3] day - head = ''; - start = this.position; + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); - while (start > 0 && '\x00\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; - } + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); } - tail = ''; - end = this.position; + // match: [4] hour [5] minute [6] second [7] fraction - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; } + fraction = +fraction; } - 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 = ''; + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - if (this.name) { - where += 'in "' + this.name + '" '; + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; } - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); - - if (!compact) { - snippet = this.getSnippet(); + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - if (snippet) { - where += ':\n' + snippet; - } - } + if (delta) date.setTime(date.getTime() - delta); - return where; -}; + return date; +} +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} -module.exports = Mark; +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); /***/ }), -/***/ 66514: +/***/ 26160: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +var _fs +try { + _fs = __webpack_require__(77758) +} catch (_) { + _fs = __webpack_require__(35747) +} +function readFile (file, options, callback) { + if (callback == null) { + callback = options + options = {} + } -/*eslint-disable max-len*/ + if (typeof options === 'string') { + options = {encoding: options} + } -var common = __webpack_require__(59136); -var YAMLException = __webpack_require__(65199); -var Type = __webpack_require__(30967); + options = options || {} + var fs = options.fs || _fs + var shouldThrow = true + if ('throws' in options) { + shouldThrow = options.throws + } -function compileList(schema, name, result) { - var exclude = []; + fs.readFile(file, options, function (err, data) { + if (err) return callback(err) - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); + data = stripBom(data) - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); + var obj + try { + obj = JSON.parse(data, options ? options.reviver : null) + } catch (err2) { + if (shouldThrow) { + err2.message = file + ': ' + err2.message + return callback(err2) + } else { + return callback(null, null) } - }); - - result.push(currentType); - }); + } - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); + callback(null, obj) + }) } +function readFileSync (file, options) { + options = options || {} + if (typeof options === 'string') { + options = {encoding: options} + } -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; + var fs = options.fs || _fs - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; + var shouldThrow = true + if ('throws' in options) { + shouldThrow = options.throws } - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); + try { + var content = fs.readFileSync(file, options) + content = stripBom(content) + return JSON.parse(content, options.reviver) + } catch (err) { + if (shouldThrow) { + err.message = file + ': ' + err.message + throw err + } else { + return null + } } - 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.'); +function stringify (obj, options) { + var spaces + var EOL = '\n' + if (typeof options === 'object' && options !== null) { + if (options.spaces) { + spaces = options.spaces } - }); - - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} - - -Schema.DEFAULT = null; - + if (options.EOL) { + EOL = options.EOL + } + } -Schema.create = function createSchema() { - var schemas, types; + var str = JSON.stringify(obj, options ? options.replacer : null, spaces) - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; + return str.replace(/\n/g, EOL) + EOL +} - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; +function writeFile (file, obj, options, callback) { + if (callback == null) { + callback = options + options = {} + } + options = options || {} + var fs = options.fs || _fs - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); + var str = '' + try { + str = stringify(obj, options) + } catch (err) { + // Need to return whether a callback was passed or not + if (callback) callback(err, null) + return } - schemas = common.toArray(schemas); - types = common.toArray(types); + fs.writeFile(file, str, options, callback) +} - 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.'); - } +function writeFileSync (file, obj, options) { + options = options || {} + var fs = options.fs || _fs - 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.'); - } + var str = stringify(obj, options) + // not sure if fs.writeFileSync returns anything, but just in case + return fs.writeFileSync(file, str, options) +} - return new Schema({ - include: schemas, - explicit: types - }); -}; +function stripBom (content) { + // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified + if (Buffer.isBuffer(content)) content = content.toString('utf8') + content = content.replace(/^\uFEFF/, '') + return content +} +var jsonfile = { + readFile: readFile, + readFileSync: readFileSync, + writeFile: writeFile, + writeFileSync: writeFileSync +} -module.exports = Schema; +module.exports = jsonfile /***/ }), -/***/ 92183: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 96008: +/***/ ((module) => { -"use strict"; -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. +/** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used to match template delimiters. */ +var reInterpolate = /<%=([\s\S]+?)%>/g; +module.exports = reInterpolate; +/***/ }), +/***/ 60417: +/***/ ((module, exports, __webpack_require__) => { -var Schema = __webpack_require__(66514); +/* module decorator */ module = __webpack_require__.nmd(module); +/** + * Lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +var reInterpolate = __webpack_require__(96008), + templateSettings = __webpack_require__(25477); +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 800, + HOT_SPAN = 16; -module.exports = new Schema({ - include: [ - __webpack_require__(1571) - ] -}); +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991; +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]'; -/***/ }), +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; -/***/ 56874: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** Used to match empty string literals in compiled template source. */ +var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; -"use strict"; -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ +var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; +/** Used to ensure capturing order of template delimiters. */ +var reNoMatch = /($^)/; -var Schema = __webpack_require__(66514); +/** Used to match unescaped characters in compiled string literals. */ +var reUnescapedString = /['\n\r\u2028\u2029\\]/g; +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; -module.exports = Schema.DEFAULT = new Schema({ - include: [ - __webpack_require__(48949) - ], - explicit: [ - __webpack_require__(25914), - __webpack_require__(69242), - __webpack_require__(27278) - ] -}); +/** Used to escape characters for inclusion in compiled string literals. */ +var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' +}; +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; -/***/ }), +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; -/***/ 48949: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); -"use strict"; -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) +/** Detect free variable `exports`. */ +var freeExports = true && exports && !exports.nodeType && exports; +/** Detect free variable `module`. */ +var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; -var Schema = __webpack_require__(66514); + if (types) { + return types; + } + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); -module.exports = new Schema({ - include: [ - __webpack_require__(92183) - ], - implicit: [ - __webpack_require__(83714), - __webpack_require__(81393) - ], - explicit: [ - __webpack_require__(32551), - __webpack_require__(96668), - __webpack_require__(76039), - __webpack_require__(69237) - ] -}); +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} -/***/ }), +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); -/***/ 66037: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} -"use strict"; -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} +/** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ +function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); +} +/** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ +function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; +} -var Schema = __webpack_require__(66514); +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} -module.exports = new Schema({ - explicit: [ - __webpack_require__(93955), - __webpack_require__(5490), - __webpack_require__(31173) - ] -}); +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; -/***/ }), +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; -/***/ 1571: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; -"use strict"; -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined, + Symbol = root.Symbol, + getPrototype = overArg(Object.getPrototypeOf, Object), + propertyIsEnumerable = objectProto.propertyIsEnumerable, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; -var Schema = __webpack_require__(66514); +var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeNow = Date.now; -module.exports = new Schema({ - include: [ - __webpack_require__(66037) - ], - implicit: [ - __webpack_require__(22671), - __webpack_require__(94675), - __webpack_require__(89963), - __webpack_require__(15564) - ] -}); +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; -/***/ }), + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} -/***/ 30967: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} -"use strict"; +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} -var YAMLException = __webpack_require__(65199); +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} -function compileStyleAliases(map) { - var result = {}; +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); +/** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); } + var isProto = isPrototype(object), + result = []; + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } return result; } -function Type(tag, options) { - options = options || {}; +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} - 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.'); - } +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true }); +}; - // TODO: Add tag format check. - 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.'); +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } -module.exports = Type; +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + while (++index < length) { + var key = props[index]; -/***/ }), + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; -/***/ 32551: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; +} -"use strict"; +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; -/*eslint-disable no-bitwise*/ + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} -var NodeBuffer; +/** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ +function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; +} -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = require; - NodeBuffer = _require('buffer').Buffer; -} catch (__) {} +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} -var Type = __webpack_require__(30967); +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; -function resolveYamlBinary(data) { - if (data === null) return false; + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} - // Skip CR/LF - if (code > 64) continue; +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - // Fail on illegal characters - if (code < 0) return false; + return value === proto; +} - bitlen += 6; +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } } - - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; + return result; } -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} - // Collect by 6*4 bits (3 bytes) +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); - // Dump tail +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; - tailbits = (max % 4) * 6; + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} } - - return result; + return ''; } -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; - bits = (bits << 8) + object[idx]; - } +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; - // Dump tail +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} - tail = max % 3; +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; +/** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ +function isError(value) { + if (!isObjectLike(value)) { + return false; } - - return result; + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); } -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); - - -/***/ }), - -/***/ 94675: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(30967); - -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')); +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); } -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; } -module.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' -}); - +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ +function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; +} -/***/ }), +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} -/***/ 15564: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; -"use strict"; +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} +/** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ +var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); +}); -var common = __webpack_require__(59136); -var Type = __webpack_require__(30967); +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); +} -function resolveYamlFloat(data) { - if (data === null) return false; +/** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': '