diff --git a/dist/file.js b/dist/file.js new file mode 100644 index 0000000000..ed9d86f047 --- /dev/null +++ b/dist/file.js @@ -0,0 +1,12 @@ +'use strict' + +const pino = require('./pino') +const { once } = require('events') + +module.exports = async function (opts = {}) { + const destOpts = Object.assign({}, opts, { dest: opts.destination || 1, sync: false }) + delete destOpts.destination + const destination = pino.destination(destOpts) + await once(destination, 'ready') + return destination +} diff --git a/dist/index.js b/dist/index.js index f961794351..24f81ed348 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9067,7 +9067,7 @@ exports.emitterEventNames = emitterEventNames; /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const ProbotExports = __nccwpck_require__(58930); -const pino = __nccwpck_require__(79608); +const pino = __nccwpck_require__(77708); const { transport } = __nccwpck_require__(96645); @@ -9126,992 +9126,730 @@ async function run(app) { /***/ }), -/***/ 18915: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 7764: +/***/ ((module, __unused_webpack_exports, __nccwpck_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.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(__nccwpck_require__(22037)); -const utils_1 = __nccwpck_require__(53322); -/** - * Commands - * - * Command Format: - * ::name key=value,key=value::message - * - * Examples: - * ::warning::This is the message - * ::set-env name=MY_VAR::some value - */ -function issueCommand(command, properties, message) { - const cmd = new Command(command, properties, message); - process.stdout.write(cmd.toString() + os.EOL); -} -exports.issueCommand = issueCommand; -function issue(name, message = '') { - issueCommand(name, {}, message); -} -exports.issue = issue; -const CMD_STRING = '::'; -class Command { - constructor(command, properties, message) { - if (!command) { - command = 'missing.command'; - } - this.command = command; - this.properties = properties; - this.message = message; - } - toString() { - let cmdStr = CMD_STRING + this.command; - if (this.properties && Object.keys(this.properties).length > 0) { - cmdStr += ' '; - let first = true; - for (const key in this.properties) { - if (this.properties.hasOwnProperty(key)) { - const val = this.properties[key]; - if (val) { - if (first) { - first = false; - } - else { - cmdStr += ','; - } - cmdStr += `${key}=${escapeProperty(val)}`; - } - } - } - } - cmdStr += `${CMD_STRING}${escapeData(this.message)}`; - return cmdStr; - } -} -function escapeData(s) { - return utils_1.toCommandValue(s) - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A'); -} -function escapeProperty(s) { - return utils_1.toCommandValue(s) - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A') - .replace(/:/g, '%3A') - .replace(/,/g, '%2C'); + +const validator = __nccwpck_require__(83026) +const parse = __nccwpck_require__(996) +const redactor = __nccwpck_require__(46073) +const restorer = __nccwpck_require__(66461) +const { groupRedact, nestedRedact } = __nccwpck_require__(1005) +const state = __nccwpck_require__(91093) +const rx = __nccwpck_require__(25757) +const validate = validator() +const noop = (o) => o +noop.restore = noop + +const DEFAULT_CENSOR = '[REDACTED]' +fastRedact.rx = rx +fastRedact.validator = validator + +module.exports = fastRedact + +function fastRedact (opts = {}) { + const paths = Array.from(new Set(opts.paths || [])) + const serialize = 'serialize' in opts ? ( + opts.serialize === false ? opts.serialize + : (typeof opts.serialize === 'function' ? opts.serialize : JSON.stringify) + ) : JSON.stringify + const remove = opts.remove + if (remove === true && serialize !== JSON.stringify) { + throw Error('fast-redact – remove option may only be set when serializer is JSON.stringify') + } + const censor = remove === true + ? undefined + : 'censor' in opts ? opts.censor : DEFAULT_CENSOR + + const isCensorFct = typeof censor === 'function' + const censorFctTakesPath = isCensorFct && censor.length > 1 + + if (paths.length === 0) return serialize || noop + + validate({ paths, serialize, censor }) + + const { wildcards, wcLen, secret } = parse({ paths, censor }) + + const compileRestore = restorer({ secret, wcLen }) + const strict = 'strict' in opts ? opts.strict : true + + return redactor({ secret, wcLen, serialize, strict, isCensorFct, censorFctTakesPath }, state({ + secret, + censor, + compileRestore, + serialize, + groupRedact, + nestedRedact, + wildcards, + wcLen + })) } -//# sourceMappingURL=command.js.map + /***/ }), -/***/ 68648: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 1005: +/***/ ((module) => { "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) { - 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()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(18915); -const file_command_1 = __nccwpck_require__(20); -const utils_1 = __nccwpck_require__(53322); -const os = __importStar(__nccwpck_require__(22037)); -const path = __importStar(__nccwpck_require__(71017)); -const oidc_utils_1 = __nccwpck_require__(46882); -/** - * The code to exit an action - */ -var ExitCode; -(function (ExitCode) { - /** - * A code indicating that the action was successful - */ - ExitCode[ExitCode["Success"] = 0] = "Success"; - /** - * A code indicating that the action was a failure - */ - ExitCode[ExitCode["Failure"] = 1] = "Failure"; -})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); -//----------------------------------------------------------------------- -// Variables -//----------------------------------------------------------------------- -/** - * Sets env variable for this action and future actions in the job - * @param name the name of the variable to set - * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function exportVariable(name, val) { - const convertedVal = utils_1.toCommandValue(val); - process.env[name] = convertedVal; - const filePath = process.env['GITHUB_ENV'] || ''; - if (filePath) { - const delimiter = '_GitHubActionsFileCommandDelimeter_'; - const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; - file_command_1.issueCommand('ENV', commandValue); - } - else { - command_1.issueCommand('set-env', { name }, convertedVal); - } + +module.exports = { + groupRedact, + groupRestore, + nestedRedact, + nestedRestore } -exports.exportVariable = exportVariable; -/** - * Registers a secret which will get masked from logs - * @param secret value of the secret - */ -function setSecret(secret) { - command_1.issueCommand('add-mask', {}, secret); + +function groupRestore ({ keys, values, target }) { + if (target == null) return + const length = keys.length + for (var i = 0; i < length; i++) { + const k = keys[i] + target[k] = values[i] + } } -exports.setSecret = setSecret; -/** - * Prepends inputPath to the PATH (for this action and future actions) - * @param inputPath - */ -function addPath(inputPath) { - const filePath = process.env['GITHUB_PATH'] || ''; - if (filePath) { - file_command_1.issueCommand('PATH', inputPath); - } - else { - command_1.issueCommand('add-path', {}, inputPath); + +function groupRedact (o, path, censor, isCensorFct, censorFctTakesPath) { + const target = get(o, path) + if (target == null) return { keys: null, values: null, target: null, flat: true } + const keys = Object.keys(target) + const keysLength = keys.length + const pathLength = path.length + const pathWithKey = censorFctTakesPath ? [...path] : undefined + const values = new Array(keysLength) + + for (var i = 0; i < keysLength; i++) { + const key = keys[i] + values[i] = target[key] + + if (censorFctTakesPath) { + pathWithKey[pathLength] = key + target[key] = censor(target[key], pathWithKey) + } else if (isCensorFct) { + target[key] = censor(target[key]) + } else { + target[key] = censor } - process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; + } + return { keys, values, target, flat: true } } -exports.addPath = addPath; + /** - * 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. - * @returns string + * @param {RestoreInstruction[]} instructions a set of instructions for restoring values to objects */ -function getInput(name, options) { - const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; - if (options && options.required && !val) { - throw new Error(`Input required and not supplied: ${name}`); - } - if (options && options.trimWhitespace === false) { - return val; +function nestedRestore (instructions) { + for (let i = 0; i < instructions.length; i++) { + const { target, path, value } = instructions[i] + let current = target + for (let i = path.length - 1; i > 0; i--) { + current = current[path[i]] } - return val.trim(); -} -exports.getInput = getInput; -/** - * Gets the values of an multiline input. Each value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string[] - * - */ -function getMultilineInput(name, options) { - const inputs = getInput(name, options) - .split('\n') - .filter(x => x !== ''); - return inputs; -} -exports.getMultilineInput = getMultilineInput; -/** - * 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. - * - * @param name name of the output to set - * @param value value to store. Non-string values will be converted to a string via JSON.stringify - */ -// 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; -/** - * Enables or disables the echoing of commands into stdout for the rest of the step. - * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. - * - */ -function setCommandEcho(enabled) { - command_1.issue('echo', enabled ? 'on' : 'off'); -} -exports.setCommandEcho = setCommandEcho; -//----------------------------------------------------------------------- -// Results -//----------------------------------------------------------------------- -/** - * Sets the action status to failed. - * When the action exits it will be with an exit code of 1 - * @param message add error issue message - */ -function setFailed(message) { - process.exitCode = ExitCode.Failure; - error(message); -} -exports.setFailed = setFailed; -//----------------------------------------------------------------------- -// Logging Commands -//----------------------------------------------------------------------- -/** - * Gets whether Actions Step Debug is on or not - */ -function isDebug() { - return process.env['RUNNER_DEBUG'] === '1'; + current[path[0]] = value + } } -exports.isDebug = isDebug; -/** - * Writes debug message to user log - * @param message debug message - */ -function debug(message) { - command_1.issueCommand('debug', {}, message); + +function nestedRedact (store, o, path, ns, censor, isCensorFct, censorFctTakesPath) { + const target = get(o, path) + if (target == null) return + const keys = Object.keys(target) + const keysLength = keys.length + for (var i = 0; i < keysLength; i++) { + const key = keys[i] + specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath) + } + return store } -exports.debug = debug; -/** - * Adds an error issue - * @param message error issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -function error(message, properties = {}) { - command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + +function has (obj, prop) { + return obj !== undefined && obj !== null + ? ('hasOwn' in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop)) + : false } -exports.error = error; -/** - * Adds a warning issue - * @param message warning issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -function warning(message, properties = {}) { - command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + +function specialSet (store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) { + const afterPathLen = afterPath.length + const lastPathIndex = afterPathLen - 1 + const originalKey = k + var i = -1 + var n + var nv + var ov + var oov = null + var wc = null + var kIsWc + var wcov + var consecutive = false + var level = 0 + // need to track depth of the `redactPath` tree + var depth = 0 + var redactPathCurrent = tree() + ov = n = o[k] + if (typeof n !== 'object') return + while (n != null && ++i < afterPathLen) { + depth += 1 + k = afterPath[i] + oov = ov + if (k !== '*' && !wc && !(typeof n === 'object' && k in n)) { + break + } + if (k === '*') { + if (wc === '*') { + consecutive = true + } + wc = k + if (i !== lastPathIndex) { + continue + } + } + if (wc) { + const wcKeys = Object.keys(n) + for (var j = 0; j < wcKeys.length; j++) { + const wck = wcKeys[j] + wcov = n[wck] + kIsWc = k === '*' + if (consecutive) { + redactPathCurrent = node(redactPathCurrent, wck, depth) + level = i + ov = iterateNthLevel(wcov, level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, o[originalKey], depth + 1) + } else { + if (kIsWc || (typeof wcov === 'object' && wcov !== null && k in wcov)) { + if (kIsWc) { + ov = wcov + } else { + ov = wcov[k] + } + nv = (i !== lastPathIndex) + ? ov + : (isCensorFct + ? (censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov)) + : censor) + if (kIsWc) { + const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]) + store.push(rv) + n[wck] = nv + } else { + if (wcov[k] === nv) { + // pass + } else if ((nv === undefined && censor !== undefined) || (has(wcov, k) && nv === ov)) { + redactPathCurrent = node(redactPathCurrent, wck, depth) + } else { + redactPathCurrent = node(redactPathCurrent, wck, depth) + const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]) + store.push(rv) + wcov[k] = nv + } + } + } + } + } + wc = null + } else { + ov = n[k] + redactPathCurrent = node(redactPathCurrent, k, depth) + nv = (i !== lastPathIndex) + ? ov + : (isCensorFct + ? (censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov)) + : censor) + if ((has(n, k) && nv === ov) || (nv === undefined && censor !== undefined)) { + // pass + } else { + const rv = restoreInstr(redactPathCurrent, ov, o[originalKey]) + store.push(rv) + n[k] = nv + } + n = n[k] + } + if (typeof n !== 'object') break + // prevent circular structure, see https://github.com/pinojs/pino/issues/1513 + if (ov === oov || typeof ov === 'undefined') { + // pass + } + } } -exports.warning = warning; -/** - * Adds a notice issue - * @param message notice issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -function notice(message, properties = {}) { - command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + +function get (o, p) { + var i = -1 + var l = p.length + var n = o + while (n != null && ++i < l) { + n = n[p[i]] + } + return n } -exports.notice = notice; -/** - * Writes info to log with console.log. - * @param message info message - */ -function info(message) { - process.stdout.write(message + os.EOL); + +function iterateNthLevel (wcov, level, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth) { + if (level === 0) { + if (kIsWc || (typeof wcov === 'object' && wcov !== null && k in wcov)) { + if (kIsWc) { + ov = wcov + } else { + ov = wcov[k] + } + nv = (i !== lastPathIndex) + ? ov + : (isCensorFct + ? (censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov)) + : censor) + if (kIsWc) { + const rv = restoreInstr(redactPathCurrent, ov, parent) + store.push(rv) + n[wck] = nv + } else { + if (wcov[k] === nv) { + // pass + } else if ((nv === undefined && censor !== undefined) || (has(wcov, k) && nv === ov)) { + // pass + } else { + const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, parent) + store.push(rv) + wcov[k] = nv + } + } + } + } + for (const key in wcov) { + if (typeof wcov[key] === 'object') { + redactPathCurrent = node(redactPathCurrent, key, depth) + iterateNthLevel(wcov[key], level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth + 1) + } + } } -exports.info = info; + /** - * Begin an output group. - * - * Output until the next `groupEnd` will be foldable in this group - * - * @param name The name of the output group + * @typedef {object} TreeNode + * @prop {TreeNode} [parent] reference to the parent of this node in the tree, or `null` if there is no parent + * @prop {string} key the key that this node represents (key here being part of the path being redacted + * @prop {TreeNode[]} children the child nodes of this node + * @prop {number} depth the depth of this node in the tree */ -function startGroup(name) { - command_1.issue('group', name); -} -exports.startGroup = startGroup; + /** - * End an output group. + * instantiate a new, empty tree + * @returns {TreeNode} */ -function endGroup() { - command_1.issue('endgroup'); +function tree () { + return { parent: null, key: null, children: [], depth: 0 } } -exports.endGroup = endGroup; + /** - * Wrap an asynchronous function call in a group. - * - * Returns the same type as the function itself. - * - * @param name The name of the group - * @param fn The function to wrap in the group + * creates a new node in the tree, attaching it as a child of the provided parent node + * if the specified depth matches the parent depth, adds the new node as a _sibling_ of the parent instead + * @param {TreeNode} parent the parent node to add a new node to (if the parent depth matches the provided `depth` value, will instead add as a sibling of this + * @param {string} key the key that the new node represents (key here being part of the path being redacted) + * @param {number} depth the depth of the new node in the tree - used to determing whether to add the new node as a child or sibling of the provided `parent` node + * @returns {TreeNode} a reference to the newly created node in the tree */ -function group(name, fn) { - return __awaiter(this, void 0, void 0, function* () { - startGroup(name); - let result; - try { - result = yield fn(); - } - finally { - endGroup(); - } - return result; - }); +function node (parent, key, depth) { + if (parent.depth === depth) { + return node(parent.parent, key, depth) + } + + var child = { + parent, + key, + depth, + children: [] + } + + parent.children.push(child) + + return child } -exports.group = group; -//----------------------------------------------------------------------- -// Wrapper action state -//----------------------------------------------------------------------- + /** - * Saves state for current action, the state can only be retrieved by this action's post job execution. - * - * @param name name of the state to store - * @param value value to store. Non-string values will be converted to a string via JSON.stringify + * @typedef {object} RestoreInstruction + * @prop {string[]} path a reverse-order path that can be used to find the correct insertion point to restore a `value` for the given `parent` object + * @prop {*} value the value to restore + * @prop {object} target the object to restore the `value` in */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function saveState(name, value) { - command_1.issueCommand('save-state', { name }, value); -} -exports.saveState = saveState; + /** - * Gets the value of an state set by this action's main execution. - * - * @param name name of the state to get - * @returns string + * create a restore instruction for the given redactPath node + * generates a path in reverse order by walking up the redactPath tree + * @param {TreeNode} node a tree node that should be at the bottom of the redact path (i.e. have no children) - this will be used to walk up the redact path tree to construct the path needed to restore + * @param {*} value the value to restore + * @param {object} target a reference to the parent object to apply the restore instruction to + * @returns {RestoreInstruction} an instruction used to restore a nested value for a specific object */ -function getState(name) { - return process.env[`STATE_${name}`] || ''; -} -exports.getState = getState; -function getIDToken(aud) { - return __awaiter(this, void 0, void 0, function* () { - return yield oidc_utils_1.OidcClient.getIDToken(aud); - }); +function restoreInstr (node, value, target) { + let current = node + const path = [] + do { + path.push(current.key) + current = current.parent + } while (current.parent != null) + + return { path, value, target } } -exports.getIDToken = getIDToken; -/** - * Summary exports - */ -var summary_1 = __nccwpck_require__(39789); -Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); -/** - * @deprecated use core.summary - */ -var summary_2 = __nccwpck_require__(39789); -Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); -/** - * Path exports - */ -var path_utils_1 = __nccwpck_require__(82554); -Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); -Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); -Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); -//# sourceMappingURL=core.js.map + /***/ }), -/***/ 20: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 996: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "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 (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(__nccwpck_require__(57147)); -const os = __importStar(__nccwpck_require__(22037)); -const utils_1 = __nccwpck_require__(53322); -function issueCommand(command, message) { - const filePath = process.env[`GITHUB_${command}`]; - if (!filePath) { - throw new Error(`Unable to find environment variable for file command ${command}`); - } - if (!fs.existsSync(filePath)) { - throw new Error(`Missing file at path: ${filePath}`); + +const rx = __nccwpck_require__(25757) + +module.exports = parse + +function parse ({ paths }) { + const wildcards = [] + var wcLen = 0 + const secret = paths.reduce(function (o, strPath, ix) { + var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, '')) + const leadingBracket = strPath[0] === '[' + path = path.map((p) => { + if (p[0] === '[') return p.substr(1, p.length - 2) + else return p + }) + const star = path.indexOf('*') + if (star > -1) { + const before = path.slice(0, star) + const beforeStr = before.join('.') + const after = path.slice(star + 1, path.length) + const nested = after.length > 0 + wcLen++ + wildcards.push({ + before, + beforeStr, + after, + nested + }) + } else { + o[strPath] = { + path: path, + val: undefined, + precensored: false, + circle: '', + escPath: JSON.stringify(strPath), + leadingBracket: leadingBracket + } } - fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { - encoding: 'utf8' - }); + return o + }, {}) + + return { wildcards, wcLen, secret } } -exports.issueCommand = issueCommand; -//# sourceMappingURL=file-command.js.map + /***/ }), -/***/ 46882: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 46073: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -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()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(96255); -const auth_1 = __nccwpck_require__(35526); -const core_1 = __nccwpck_require__(68648); -class OidcClient { - static createHttpClient(allowRetry = true, maxRetry = 10) { - const requestOptions = { - allowRetries: allowRetry, - maxRetries: maxRetry - }; - return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); + +const rx = __nccwpck_require__(25757) + +module.exports = redactor + +function redactor ({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) { + /* eslint-disable-next-line */ + const redact = Function('o', ` + if (typeof o !== 'object' || o == null) { + ${strictImpl(strict, serialize)} } - static getRequestToken() { - const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; - if (!token) { - throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); - } - return token; + const { censor, secret } = this + ${redactTmpl(secret, isCensorFct, censorFctTakesPath)} + this.compileRestore() + ${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)} + ${resultTmpl(serialize)} + `).bind(state) + + if (serialize === false) { + redact.restore = (o) => state.restore(o) + } + + return redact +} + +function redactTmpl (secret, isCensorFct, censorFctTakesPath) { + return Object.keys(secret).map((path) => { + const { escPath, leadingBracket, path: arrPath } = secret[path] + const skip = leadingBracket ? 1 : 0 + const delim = leadingBracket ? '' : '.' + const hops = [] + var match + while ((match = rx.exec(path)) !== null) { + const [ , ix ] = match + const { index, input } = match + if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1))) } - static getIDTokenUrl() { - const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; - if (!runtimeUrl) { - throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); + var existence = hops.map((p) => `o${delim}${p}`).join(' && ') + if (existence.length === 0) existence += `o${delim}${path} != null` + else existence += ` && o${delim}${path} != null` + + const circularDetection = ` + switch (true) { + ${hops.reverse().map((p) => ` + case o${delim}${p} === censor: + secret[${escPath}].circle = ${JSON.stringify(p)} + break + `).join('\n')} + } + ` + + const censorArgs = censorFctTakesPath + ? `val, ${JSON.stringify(arrPath)}` + : `val` + + return ` + if (${existence}) { + const val = o${delim}${path} + if (val === censor) { + secret[${escPath}].precensored = true + } else { + secret[${escPath}].val = val + o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : 'censor'} + ${circularDetection} } - return runtimeUrl; - } - static getCall(id_token_url) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - const httpclient = OidcClient.createHttpClient(); - const res = yield httpclient - .getJson(id_token_url) - .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n - Error Message: ${error.result.message}`); - }); - const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; - if (!id_token) { - throw new Error('Response json body do not have ID Token field'); - } - return id_token; - }); - } - static getIDToken(audience) { - return __awaiter(this, void 0, void 0, function* () { - try { - // New ID Token is requested from action service - let id_token_url = OidcClient.getIDTokenUrl(); - if (audience) { - const encodedAudience = encodeURIComponent(audience); - id_token_url = `${id_token_url}&audience=${encodedAudience}`; - } - core_1.debug(`ID token url is ${id_token_url}`); - const id_token = yield OidcClient.getCall(id_token_url); - core_1.setSecret(id_token); - return id_token; - } - catch (error) { - throw new Error(`Error message: ${error.message}`); - } - }); + } + ` + }).join('\n') +} + +function dynamicRedactTmpl (hasWildcards, isCensorFct, censorFctTakesPath) { + return hasWildcards === true ? ` + { + const { wildcards, wcLen, groupRedact, nestedRedact } = this + for (var i = 0; i < wcLen; i++) { + const { before, beforeStr, after, nested } = wildcards[i] + if (nested === true) { + secret[beforeStr] = secret[beforeStr] || [] + nestedRedact(secret[beforeStr], o, before, after, censor, ${isCensorFct}, ${censorFctTakesPath}) + } else secret[beforeStr] = groupRedact(o, before, censor, ${isCensorFct}, ${censorFctTakesPath}) + } } + ` : '' } -exports.OidcClient = OidcClient; -//# sourceMappingURL=oidc-utils.js.map + +function resultTmpl (serialize) { + return serialize === false ? `return o` : ` + var s = this.serialize(o) + this.restore(o) + return s + ` +} + +function strictImpl (strict, serialize) { + return strict === true + ? `throw Error('fast-redact: primitives cannot be redacted')` + : serialize === false ? `return o` : `return this.serialize(o)` +} + /***/ }), -/***/ 82554: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 66461: +/***/ ((module, __unused_webpack_exports, __nccwpck_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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; -const path = __importStar(__nccwpck_require__(71017)); -/** - * toPosixPath converts the given path to the posix form. On Windows, \\ will be - * replaced with /. - * - * @param pth. Path to transform. - * @return string Posix path. - */ -function toPosixPath(pth) { - return pth.replace(/[\\]/g, '/'); + +const { groupRestore, nestedRestore } = __nccwpck_require__(1005) + +module.exports = restorer + +function restorer ({ secret, wcLen }) { + return function compileRestore () { + if (this.restore) return + const paths = Object.keys(secret) + const resetters = resetTmpl(secret, paths) + const hasWildcards = wcLen > 0 + const state = hasWildcards ? { secret, groupRestore, nestedRestore } : { secret } + /* eslint-disable-next-line */ + this.restore = Function( + 'o', + restoreTmpl(resetters, paths, hasWildcards) + ).bind(state) + } } -exports.toPosixPath = toPosixPath; + /** - * toWin32Path converts the given path to the win32 form. On Linux, / will be - * replaced with \\. + * Mutates the original object to be censored by restoring its original values + * prior to censoring. * - * @param pth. Path to transform. - * @return string Win32 path. + * @param {object} secret Compiled object describing which target fields should + * be censored and the field states. + * @param {string[]} paths The list of paths to censor as provided at + * initialization time. + * + * @returns {string} String of JavaScript to be used by `Function()`. The + * string compiles to the function that does the work in the description. */ -function toWin32Path(pth) { - return pth.replace(/[/]/g, '\\'); +function resetTmpl (secret, paths) { + return paths.map((path) => { + const { circle, escPath, leadingBracket } = secret[path] + const delim = leadingBracket ? '' : '.' + const reset = circle + ? `o.${circle} = secret[${escPath}].val` + : `o${delim}${path} = secret[${escPath}].val` + const clear = `secret[${escPath}].val = undefined` + return ` + if (secret[${escPath}].val !== undefined) { + try { ${reset} } catch (e) {} + ${clear} + } + ` + }).join('') } -exports.toWin32Path = toWin32Path; + /** - * toPlatformPath converts the given path to a platform-specific path. It does - * this by replacing instances of / and \ with the platform-specific path - * separator. + * Creates the body of the restore function * - * @param pth The path to platformize. - * @return string The platform-specific path. + * Restoration of the redacted object happens + * backwards, in reverse order of redactions, + * so that repeated redactions on the same object + * property can be eventually rolled back to the + * original value. + * + * This way dynamic redactions are restored first, + * starting from the last one working backwards and + * followed by the static ones. + * + * @returns {string} the body of the restore function */ -function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path.sep); +function restoreTmpl (resetters, paths, hasWildcards) { + const dynamicReset = hasWildcards === true ? ` + const keys = Object.keys(secret) + const len = keys.length + for (var i = len - 1; i >= ${paths.length}; i--) { + const k = keys[i] + const o = secret[k] + if (o.flat === true) this.groupRestore(o) + else this.nestedRestore(o) + secret[k] = null + } + ` : '' + + return ` + const secret = this.secret + ${dynamicReset} + ${resetters} + return o + ` } -exports.toPlatformPath = toPlatformPath; -//# sourceMappingURL=path-utils.js.map + /***/ }), -/***/ 39789: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 25757: +/***/ ((module) => { "use strict"; -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()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; -const os_1 = __nccwpck_require__(22037); -const fs_1 = __nccwpck_require__(57147); -const { access, appendFile, writeFile } = fs_1.promises; -exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; -exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; -class Summary { - constructor() { - this._buffer = ''; - } - /** - * Finds the summary file path from the environment, rejects if env var is not found or file does not exist - * Also checks r/w permissions. - * - * @returns step summary file path - */ - filePath() { - return __awaiter(this, void 0, void 0, function* () { - if (this._filePath) { - return this._filePath; - } - const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; - if (!pathFromEnv) { - throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); - } - try { - yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); - } - catch (_a) { - throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); - } - this._filePath = pathFromEnv; - return this._filePath; - }); - } - /** - * Wraps content in an HTML tag, adding any HTML attributes - * - * @param {string} tag HTML tag to wrap - * @param {string | null} content content within the tag - * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add - * - * @returns {string} content wrapped in HTML element - */ - wrap(tag, content, attrs = {}) { - const htmlAttrs = Object.entries(attrs) - .map(([key, value]) => ` ${key}="${value}"`) - .join(''); - if (!content) { - return `<${tag}${htmlAttrs}>`; - } - return `<${tag}${htmlAttrs}>${content}`; - } - /** - * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. - * - * @param {SummaryWriteOptions} [options] (optional) options for write operation - * - * @returns {Promise} summary instance - */ - write(options) { - return __awaiter(this, void 0, void 0, function* () { - const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); - const filePath = yield this.filePath(); - const writeFunc = overwrite ? writeFile : appendFile; - yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); - return this.emptyBuffer(); - }); - } - /** - * Clears the summary buffer and wipes the summary file - * - * @returns {Summary} summary instance - */ - clear() { - return __awaiter(this, void 0, void 0, function* () { - return this.emptyBuffer().write({ overwrite: true }); - }); - } - /** - * Returns the current summary buffer as a string - * - * @returns {string} string of summary buffer - */ - stringify() { - return this._buffer; - } - /** - * If the summary buffer is empty - * - * @returns {boolen} true if the buffer is empty - */ - isEmptyBuffer() { - return this._buffer.length === 0; - } - /** - * Resets the summary buffer without writing to summary file - * - * @returns {Summary} summary instance - */ - emptyBuffer() { - this._buffer = ''; - return this; - } - /** - * Adds raw text to the summary buffer - * - * @param {string} text content to add - * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) - * - * @returns {Summary} summary instance - */ - addRaw(text, addEOL = false) { - this._buffer += text; - return addEOL ? this.addEOL() : this; - } - /** - * Adds the operating system-specific end-of-line marker to the buffer - * - * @returns {Summary} summary instance - */ - addEOL() { - return this.addRaw(os_1.EOL); - } - /** - * Adds an HTML codeblock to the summary buffer - * - * @param {string} code content to render within fenced code block - * @param {string} lang (optional) language to syntax highlight code - * - * @returns {Summary} summary instance - */ - addCodeBlock(code, lang) { - const attrs = Object.assign({}, (lang && { lang })); - const element = this.wrap('pre', this.wrap('code', code), attrs); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML list to the summary buffer - * - * @param {string[]} items list of items to render - * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) - * - * @returns {Summary} summary instance - */ - addList(items, ordered = false) { - const tag = ordered ? 'ol' : 'ul'; - const listItems = items.map(item => this.wrap('li', item)).join(''); - const element = this.wrap(tag, listItems); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML table to the summary buffer - * - * @param {SummaryTableCell[]} rows table rows - * - * @returns {Summary} summary instance - */ - addTable(rows) { - const tableBody = rows - .map(row => { - const cells = row - .map(cell => { - if (typeof cell === 'string') { - return this.wrap('td', cell); - } - const { header, data, colspan, rowspan } = cell; - const tag = header ? 'th' : 'td'; - const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); - return this.wrap(tag, data, attrs); - }) - .join(''); - return this.wrap('tr', cells); - }) - .join(''); - const element = this.wrap('table', tableBody); - return this.addRaw(element).addEOL(); - } - /** - * Adds a collapsable HTML details element to the summary buffer - * - * @param {string} label text for the closed state - * @param {string} content collapsable content - * - * @returns {Summary} summary instance - */ - addDetails(label, content) { - const element = this.wrap('details', this.wrap('summary', label) + content); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML image tag to the summary buffer - * - * @param {string} src path to the image you to embed - * @param {string} alt text description of the image - * @param {SummaryImageOptions} options (optional) addition image attributes - * - * @returns {Summary} summary instance - */ - addImage(src, alt, options) { - const { width, height } = options || {}; - const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); - const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML section heading element - * - * @param {string} text heading text - * @param {number | string} [level=1] (optional) the heading level, default: 1 - * - * @returns {Summary} summary instance - */ - addHeading(text, level) { - const tag = `h${level}`; - const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) - ? tag - : 'h1'; - const element = this.wrap(allowedTag, text); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML thematic break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addSeparator() { - const element = this.wrap('hr', null); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML line break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addBreak() { - const element = this.wrap('br', null); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML blockquote to the summary buffer - * - * @param {string} text quote text - * @param {string} cite (optional) citation url - * - * @returns {Summary} summary instance - */ - addQuote(text, cite) { - const attrs = Object.assign({}, (cite && { cite })); - const element = this.wrap('blockquote', text, attrs); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML anchor tag to the summary buffer - * - * @param {string} text link text/content - * @param {string} href hyperlink - * - * @returns {Summary} summary instance - */ - addLink(text, href) { - const element = this.wrap('a', text, { href }); - return this.addRaw(element).addEOL(); - } -} -const _summary = new Summary(); -/** - * @deprecated use `core.summary` - */ -exports.markdownSummary = _summary; -exports.summary = _summary; -//# sourceMappingURL=summary.js.map - -/***/ }), - -/***/ 53322: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// We use any as a valid input type -/* eslint-disable @typescript-eslint/no-explicit-any */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.toCommandProperties = 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 - */ -function toCommandValue(input) { - if (input === null || input === undefined) { - return ''; - } - else if (typeof input === 'string' || input instanceof String) { - return input; - } - return JSON.stringify(input); -} -exports.toCommandValue = toCommandValue; -/** - * - * @param annotationProperties - * @returns The command properties to send with the actual annotation command - * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 - */ -function toCommandProperties(annotationProperties) { - if (!Object.keys(annotationProperties).length) { - return {}; - } - return { - title: annotationProperties.title, - file: annotationProperties.file, - line: annotationProperties.startLine, - endLine: annotationProperties.endLine, - col: annotationProperties.startColumn, - endColumn: annotationProperties.endColumn - }; -} -exports.toCommandProperties = toCommandProperties; -//# sourceMappingURL=utils.js.map - -/***/ }), - -/***/ 96645: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -const { inspect } = __nccwpck_require__(73837); - -const through = __nccwpck_require__(18180); -const core = __nccwpck_require__(68648); -const pino = __nccwpck_require__(79608); - -const LEVEL_TO_ACTIONS_CORE_LOG_METHOD = { - trace: "debug", - debug: "debug", - info: "info", - warn: "warning", - error: "error", - fatal: "error", + +module.exports = /[^.[\]]+|\[((?:.)*?)\]/g + +/* +Regular expression explanation: + +Alt 1: /[^.[\]]+/ - Match one or more characters that are *not* a dot (.) + opening square bracket ([) or closing square bracket (]) + +Alt 2: /\[((?:.)*?)\]/ - If the char IS dot or square bracket, then create a capture + group (which will be capture group $1) that matches anything + within square brackets. Expansion is lazy so it will + stop matching as soon as the first closing bracket is met `]` + (rather than continuing to match until the final closing bracket). +*/ + + +/***/ }), + +/***/ 91093: +/***/ ((module) => { + +"use strict"; + + +module.exports = state + +function state (o) { + const { + secret, + censor, + compileRestore, + serialize, + groupRedact, + nestedRedact, + wildcards, + wcLen + } = o + const builder = [{ secret, censor, compileRestore }] + if (serialize !== false) builder.push({ serialize }) + if (wcLen > 0) builder.push({ groupRedact, nestedRedact, wildcards, wcLen }) + return Object.assign(...builder) +} + + +/***/ }), + +/***/ 83026: +/***/ ((module) => { + +"use strict"; + + +module.exports = validator + +function validator (opts = {}) { + const { + ERR_PATHS_MUST_BE_STRINGS = () => 'fast-redact - Paths must be (non-empty) strings', + ERR_INVALID_PATH = (s) => `fast-redact – Invalid path (${s})` + } = opts + + return function validate ({ paths }) { + paths.forEach((s) => { + if (typeof s !== 'string') { + throw Error(ERR_PATHS_MUST_BE_STRINGS()) + } + try { + if (/〇/.test(s)) throw Error() + const expr = (s[0] === '[' ? '' : '.') + s.replace(/^\*/, '〇').replace(/\.\*/g, '.〇').replace(/\[\*\]/g, '[〇]') + if (/\n|\r|;/.test(expr)) throw Error() + if (/\/\*/.test(expr)) throw Error() + /* eslint-disable-next-line */ + Function(` + 'use strict' + const o = new Proxy({}, { get: () => o, set: () => { throw Error() } }); + const 〇 = null; + o${expr} + if ([o${expr}].length !== 1) throw Error()`)() + } catch (e) { + throw Error(ERR_INVALID_PATH(s)) + } + }) + } +} + + +/***/ }), + +/***/ 96645: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const { inspect } = __nccwpck_require__(73837); + +const through = __nccwpck_require__(18180); +const core = __nccwpck_require__(42186); +const pino = __nccwpck_require__(77708); + +const LEVEL_TO_ACTIONS_CORE_LOG_METHOD = { + trace: "debug", + debug: "debug", + info: "info", + warn: "warning", + error: "error", + fatal: "error", }; const transport = through.obj(function (chunk, enc, cb) { @@ -112536,6 +112274,107 @@ exports.createProbotAuth = createProbotAuth; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 39660: +/***/ ((module) => { + +"use strict"; + + +const refs = { + exit: [], + beforeExit: [] +} +const functions = { + exit: onExit, + beforeExit: onBeforeExit +} +const registry = new FinalizationRegistry(clear) + +function install (event) { + if (refs[event].length > 0) { + return + } + + process.on(event, functions[event]) +} + +function uninstall (event) { + if (refs[event].length > 0) { + return + } + process.removeListener(event, functions[event]) +} + +function onExit () { + callRefs('exit') +} + +function onBeforeExit () { + callRefs('beforeExit') +} + +function callRefs (event) { + for (const ref of refs[event]) { + const obj = ref.deref() + const fn = ref.fn + + // This should always happen, however GC is + // undeterministic so it might not happen. + /* istanbul ignore else */ + if (obj !== undefined) { + fn(obj, event) + } + } +} + +function clear (ref) { + for (const event of ['exit', 'beforeExit']) { + const index = refs[event].indexOf(ref) + refs[event].splice(index, index + 1) + uninstall(event) + } +} + +function _register (event, obj, fn) { + if (obj === undefined) { + throw new Error('the object can\'t be undefined') + } + install(event) + const ref = new WeakRef(obj) + ref.fn = fn + + registry.register(obj, ref) + refs[event].push(ref) +} + +function register (obj, fn) { + _register('exit', obj, fn) +} + +function registerBeforeExit (obj, fn) { + _register('beforeExit', obj, fn) +} + +function unregister (obj) { + registry.unregister(obj) + for (const event of ['exit', 'beforeExit']) { + refs[event] = refs[event].filter((ref) => { + const _obj = ref.deref() + return _obj && _obj !== obj + }) + uninstall(event) + } +} + +module.exports = { + register, + registerBeforeExit, + unregister +} + + /***/ }), /***/ 24694: @@ -128221,6 +128060,626 @@ SafeBuffer.allocUnsafeSlow = function (size) { } +/***/ }), + +/***/ 37560: +/***/ ((module, exports) => { + +"use strict"; + + +const { hasOwnProperty } = Object.prototype + +const stringify = configure() + +// @ts-expect-error +stringify.configure = configure +// @ts-expect-error +stringify.stringify = stringify + +// @ts-expect-error +stringify.default = stringify + +// @ts-expect-error used for named export +exports.stringify = stringify +// @ts-expect-error used for named export +exports.configure = configure + +module.exports = stringify + +// eslint-disable-next-line no-control-regex +const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/ + +// Escape C0 control characters, double quotes, the backslash and every code +// unit with a numeric value in the inclusive range 0xD800 to 0xDFFF. +function strEscape (str) { + // Some magic numbers that worked out fine while benchmarking with v8 8.0 + if (str.length < 5000 && !strEscapeSequencesRegExp.test(str)) { + return `"${str}"` + } + return JSON.stringify(str) +} + +function insertSort (array) { + // Insertion sort is very efficient for small input sizes but it has a bad + // worst case complexity. Thus, use native array sort for bigger values. + if (array.length > 2e2) { + return array.sort() + } + for (let i = 1; i < array.length; i++) { + const currentValue = array[i] + let position = i + while (position !== 0 && array[position - 1] > currentValue) { + array[position] = array[position - 1] + position-- + } + array[position] = currentValue + } + return array +} + +const typedArrayPrototypeGetSymbolToStringTag = + Object.getOwnPropertyDescriptor( + Object.getPrototypeOf( + Object.getPrototypeOf( + new Int8Array() + ) + ), + Symbol.toStringTag + ).get + +function isTypedArrayWithEntries (value) { + return typedArrayPrototypeGetSymbolToStringTag.call(value) !== undefined && value.length !== 0 +} + +function stringifyTypedArray (array, separator, maximumBreadth) { + if (array.length < maximumBreadth) { + maximumBreadth = array.length + } + const whitespace = separator === ',' ? '' : ' ' + let res = `"0":${whitespace}${array[0]}` + for (let i = 1; i < maximumBreadth; i++) { + res += `${separator}"${i}":${whitespace}${array[i]}` + } + return res +} + +function getCircularValueOption (options) { + if (hasOwnProperty.call(options, 'circularValue')) { + const circularValue = options.circularValue + if (typeof circularValue === 'string') { + return `"${circularValue}"` + } + if (circularValue == null) { + return circularValue + } + if (circularValue === Error || circularValue === TypeError) { + return { + toString () { + throw new TypeError('Converting circular structure to JSON') + } + } + } + throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined') + } + return '"[Circular]"' +} + +function getBooleanOption (options, key) { + let value + if (hasOwnProperty.call(options, key)) { + value = options[key] + if (typeof value !== 'boolean') { + throw new TypeError(`The "${key}" argument must be of type boolean`) + } + } + return value === undefined ? true : value +} + +function getPositiveIntegerOption (options, key) { + let value + if (hasOwnProperty.call(options, key)) { + value = options[key] + if (typeof value !== 'number') { + throw new TypeError(`The "${key}" argument must be of type number`) + } + if (!Number.isInteger(value)) { + throw new TypeError(`The "${key}" argument must be an integer`) + } + if (value < 1) { + throw new RangeError(`The "${key}" argument must be >= 1`) + } + } + return value === undefined ? Infinity : value +} + +function getItemCount (number) { + if (number === 1) { + return '1 item' + } + return `${number} items` +} + +function getUniqueReplacerSet (replacerArray) { + const replacerSet = new Set() + for (const value of replacerArray) { + if (typeof value === 'string' || typeof value === 'number') { + replacerSet.add(String(value)) + } + } + return replacerSet +} + +function getStrictOption (options) { + if (hasOwnProperty.call(options, 'strict')) { + const value = options.strict + if (typeof value !== 'boolean') { + throw new TypeError('The "strict" argument must be of type boolean') + } + if (value) { + return (value) => { + let message = `Object can not safely be stringified. Received type ${typeof value}` + if (typeof value !== 'function') message += ` (${value.toString()})` + throw new Error(message) + } + } + } +} + +function configure (options) { + options = { ...options } + const fail = getStrictOption(options) + if (fail) { + if (options.bigint === undefined) { + options.bigint = false + } + if (!('circularValue' in options)) { + options.circularValue = Error + } + } + const circularValue = getCircularValueOption(options) + const bigint = getBooleanOption(options, 'bigint') + const deterministic = getBooleanOption(options, 'deterministic') + const maximumDepth = getPositiveIntegerOption(options, 'maximumDepth') + const maximumBreadth = getPositiveIntegerOption(options, 'maximumBreadth') + + function stringifyFnReplacer (key, parent, stack, replacer, spacer, indentation) { + let value = parent[key] + + if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') { + value = value.toJSON(key) + } + value = replacer.call(parent, key, value) + + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + + let res = '' + let join = ',' + const originalIndentation = indentation + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + if (spacer !== '') { + indentation += spacer + res += `\n${indentation}` + join = `,\n${indentation}` + } + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + res += join + } + const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `${join}"... ${getItemCount(removedKeys)} not stringified"` + } + if (spacer !== '') { + res += `\n${originalIndentation}` + } + stack.pop() + return `[${res}]` + } + + let keys = Object.keys(value) + const keyLength = keys.length + if (keyLength === 0) { + return '{}' + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"' + } + let whitespace = '' + let separator = '' + if (spacer !== '') { + indentation += spacer + join = `,\n${indentation}` + whitespace = ' ' + } + const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth) + if (deterministic && !isTypedArrayWithEntries(value)) { + keys = insertSort(keys) + } + stack.push(value) + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key = keys[i] + const tmp = stringifyFnReplacer(key, value, stack, replacer, spacer, indentation) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}:${whitespace}${tmp}` + separator = join + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth + res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"` + separator = join + } + if (spacer !== '' && separator.length > 1) { + res = `\n${indentation}${res}\n${originalIndentation}` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringifyArrayReplacer (key, value, stack, replacer, spacer, indentation) { + if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') { + value = value.toJSON(key) + } + + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + + const originalIndentation = indentation + let res = '' + let join = ',' + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + if (spacer !== '') { + indentation += spacer + res += `\n${indentation}` + join = `,\n${indentation}` + } + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + res += join + } + const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `${join}"... ${getItemCount(removedKeys)} not stringified"` + } + if (spacer !== '') { + res += `\n${originalIndentation}` + } + stack.pop() + return `[${res}]` + } + stack.push(value) + let whitespace = '' + if (spacer !== '') { + indentation += spacer + join = `,\n${indentation}` + whitespace = ' ' + } + let separator = '' + for (const key of replacer) { + const tmp = stringifyArrayReplacer(key, value[key], stack, replacer, spacer, indentation) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}:${whitespace}${tmp}` + separator = join + } + } + if (spacer !== '' && separator.length > 1) { + res = `\n${indentation}${res}\n${originalIndentation}` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringifyIndent (key, value, stack, spacer, indentation) { + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (typeof value.toJSON === 'function') { + value = value.toJSON(key) + // Prevent calling `toJSON` again. + if (typeof value !== 'object') { + return stringifyIndent(key, value, stack, spacer, indentation) + } + if (value === null) { + return 'null' + } + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + const originalIndentation = indentation + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + indentation += spacer + let res = `\n${indentation}` + const join = `,\n${indentation}` + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + res += join + } + const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `${join}"... ${getItemCount(removedKeys)} not stringified"` + } + res += `\n${originalIndentation}` + stack.pop() + return `[${res}]` + } + + let keys = Object.keys(value) + const keyLength = keys.length + if (keyLength === 0) { + return '{}' + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"' + } + indentation += spacer + const join = `,\n${indentation}` + let res = '' + let separator = '' + let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth) + if (isTypedArrayWithEntries(value)) { + res += stringifyTypedArray(value, join, maximumBreadth) + keys = keys.slice(value.length) + maximumPropertiesToStringify -= value.length + separator = join + } + if (deterministic) { + keys = insertSort(keys) + } + stack.push(value) + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key = keys[i] + const tmp = stringifyIndent(key, value[key], stack, spacer, indentation) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}: ${tmp}` + separator = join + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth + res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"` + separator = join + } + if (separator !== '') { + res = `\n${indentation}${res}\n${originalIndentation}` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringifySimple (key, value, stack) { + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (typeof value.toJSON === 'function') { + value = value.toJSON(key) + // Prevent calling `toJSON` again + if (typeof value !== 'object') { + return stringifySimple(key, value, stack) + } + if (value === null) { + return 'null' + } + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + + let res = '' + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifySimple(String(i), value[i], stack) + res += tmp !== undefined ? tmp : 'null' + res += ',' + } + const tmp = stringifySimple(String(i), value[i], stack) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `,"... ${getItemCount(removedKeys)} not stringified"` + } + stack.pop() + return `[${res}]` + } + + let keys = Object.keys(value) + const keyLength = keys.length + if (keyLength === 0) { + return '{}' + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"' + } + let separator = '' + let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth) + if (isTypedArrayWithEntries(value)) { + res += stringifyTypedArray(value, ',', maximumBreadth) + keys = keys.slice(value.length) + maximumPropertiesToStringify -= value.length + separator = ',' + } + if (deterministic) { + keys = insertSort(keys) + } + stack.push(value) + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key = keys[i] + const tmp = stringifySimple(key, value[key], stack) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}:${tmp}` + separator = ',' + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth + res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringify (value, replacer, space) { + if (arguments.length > 1) { + let spacer = '' + if (typeof space === 'number') { + spacer = ' '.repeat(Math.min(space, 10)) + } else if (typeof space === 'string') { + spacer = space.slice(0, 10) + } + if (replacer != null) { + if (typeof replacer === 'function') { + return stringifyFnReplacer('', { '': value }, [], replacer, spacer, '') + } + if (Array.isArray(replacer)) { + return stringifyArrayReplacer('', value, [], getUniqueReplacerSet(replacer), spacer, '') + } + } + if (spacer.length !== 0) { + return stringifyIndent('', value, [], spacer, '') + } + } + return stringifySimple('', value, []) + } + + return stringify +} + + /***/ }), /***/ 15118: @@ -136294,382 +136753,2565 @@ function relative(aRoot, aPath) { return aPath; } - ++level; - } + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; + + +/***/ }), + +/***/ 56594: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +exports.SourceMapGenerator = __nccwpck_require__(69425).SourceMapGenerator; +exports.SourceMapConsumer = __nccwpck_require__(75155).SourceMapConsumer; +exports.SourceNode = __nccwpck_require__(92616).SourceNode; + + +/***/ }), + +/***/ 91543: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils_1 = __nccwpck_require__(81074); +function throwLater(e) { + setTimeout(function () { + throw e; + }, 0); +} +function asCallback(promise, nodeback, options) { + if (typeof nodeback === "function") { + promise.then((val) => { + let ret; + if (options !== undefined && + Object(options).spread && + Array.isArray(val)) { + ret = utils_1.tryCatch(nodeback).apply(undefined, [null].concat(val)); + } + else { + ret = + val === undefined + ? utils_1.tryCatch(nodeback)(null) + : utils_1.tryCatch(nodeback)(null, val); + } + if (ret === utils_1.errorObj) { + throwLater(ret.e); + } + }, (cause) => { + if (!cause) { + const newReason = new Error(cause + ""); + Object.assign(newReason, { cause }); + cause = newReason; + } + const ret = utils_1.tryCatch(nodeback)(cause); + if (ret === utils_1.errorObj) { + throwLater(ret.e); + } + }); + } + return promise; +} +exports["default"] = asCallback; + + +/***/ }), + +/***/ 81074: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.tryCatch = exports.errorObj = void 0; +//Try catch is not supported in optimizing +//compiler, so it is isolated +exports.errorObj = { e: {} }; +let tryCatchTarget; +function tryCatcher(err, val) { + try { + const target = tryCatchTarget; + tryCatchTarget = null; + return target.apply(this, arguments); + } + catch (e) { + exports.errorObj.e = e; + return exports.errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} +exports.tryCatch = tryCatch; + + +/***/ }), + +/***/ 57415: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/*! + * statuses + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var codes = __nccwpck_require__(50855) + +/** + * Module exports. + * @public + */ + +module.exports = status + +// status code to message map +status.STATUS_CODES = codes + +// array of status codes +status.codes = populateStatusesMap(status, codes) + +// status codes for redirects +status.redirect = { + 300: true, + 301: true, + 302: true, + 303: true, + 305: true, + 307: true, + 308: true +} + +// status codes for empty bodies +status.empty = { + 204: true, + 205: true, + 304: true +} + +// status codes for when you should retry the request +status.retry = { + 502: true, + 503: true, + 504: true +} + +/** + * Populate the statuses map for given codes. + * @private + */ + +function populateStatusesMap (statuses, codes) { + var arr = [] + + Object.keys(codes).forEach(function forEachCode (code) { + var message = codes[code] + var status = Number(code) + + // Populate properties + statuses[status] = message + statuses[message] = status + statuses[message.toLowerCase()] = status + + // Add to array + arr.push(status) + }) + + return arr +} + +/** + * Get the status code. + * + * Given a number, this will throw if it is not a known status + * code, otherwise the code will be returned. Given a string, + * the string will be parsed for a number and return the code + * if valid, otherwise will lookup the code assuming this is + * the status message. + * + * @param {string|number} code + * @returns {number} + * @public + */ + +function status (code) { + if (typeof code === 'number') { + if (!status[code]) throw new Error('invalid status code: ' + code) + return code + } + + if (typeof code !== 'string') { + throw new TypeError('code must be a number or string') + } + + // '403' + var n = parseInt(code, 10) + if (!isNaN(n)) { + if (!status[n]) throw new Error('invalid status code: ' + n) + return n + } + + n = status[code.toLowerCase()] + if (!n) throw new Error('invalid status message: "' + code + '"') + return n +} + + +/***/ }), + +/***/ 42577: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const stripAnsi = __nccwpck_require__(45591); +const isFullwidthCodePoint = __nccwpck_require__(64882); +const emojiRegex = __nccwpck_require__(18212); + +const stringWidth = string => { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + let width = 0; + + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports["default"] = stringWidth; + + +/***/ }), + +/***/ 94841: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// 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 Buffer = (__nccwpck_require__(21867).Buffer); +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.s = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ 45591: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const ansiRegex = __nccwpck_require__(65063); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; + + +/***/ }), + +/***/ 88551: +/***/ ((module) => { + +"use strict"; + +module.exports = x => { + if (typeof x !== 'string') { + throw new TypeError('Expected a string, got ' + typeof x); + } + + // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string + // conversion translates it to FEFF (UTF-16 BOM) + if (x.charCodeAt(0) === 0xFEFF) { + return x.slice(1); + } + + return x; +}; + + +/***/ }), + +/***/ 59318: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const os = __nccwpck_require__(22037); +const tty = __nccwpck_require__(76224); +const hasFlag = __nccwpck_require__(31621); + +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))) +}; + + +/***/ }), + +/***/ 78366: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { version } = __nccwpck_require__(82954) +const { EventEmitter } = __nccwpck_require__(82361) +const { Worker } = __nccwpck_require__(71267) +const { join } = __nccwpck_require__(71017) +const { pathToFileURL } = __nccwpck_require__(57310) +const { wait } = __nccwpck_require__(33916) +const { + WRITE_INDEX, + READ_INDEX +} = __nccwpck_require__(4212) +const buffer = __nccwpck_require__(14300) +const assert = __nccwpck_require__(39491) + +const kImpl = Symbol('kImpl') + +// V8 limit for string size +const MAX_STRING = buffer.constants.MAX_STRING_LENGTH + +class FakeWeakRef { + constructor (value) { + this._value = value + } + + deref () { + return this._value + } +} + +const FinalizationRegistry = global.FinalizationRegistry || class FakeFinalizationRegistry { + register () {} + + unregister () {} +} + +const WeakRef = global.WeakRef || FakeWeakRef + +const registry = new FinalizationRegistry((worker) => { + if (worker.exited) { + return + } + worker.terminate() +}) + +function createWorker (stream, opts) { + const { filename, workerData } = opts + + const bundlerOverrides = '__bundlerPathsOverrides' in globalThis ? globalThis.__bundlerPathsOverrides : {} + const toExecute = bundlerOverrides['thread-stream-worker'] || __nccwpck_require__.ab + "worker1.js" + + const worker = new Worker(toExecute, { + ...opts.workerOpts, + trackUnmanagedFds: false, + workerData: { + filename: filename.indexOf('file://') === 0 + ? filename + : pathToFileURL(filename).href, + dataBuf: stream[kImpl].dataBuf, + stateBuf: stream[kImpl].stateBuf, + workerData: { + $context: { + threadStreamVersion: version + }, + ...workerData + } + } + }) + + // We keep a strong reference for now, + // we need to start writing first + worker.stream = new FakeWeakRef(stream) + + worker.on('message', onWorkerMessage) + worker.on('exit', onWorkerExit) + registry.register(stream, worker) + + return worker +} + +function drain (stream) { + assert(!stream[kImpl].sync) + if (stream[kImpl].needDrain) { + stream[kImpl].needDrain = false + stream.emit('drain') + } +} + +function nextFlush (stream) { + const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX) + let leftover = stream[kImpl].data.length - writeIndex + + if (leftover > 0) { + if (stream[kImpl].buf.length === 0) { + stream[kImpl].flushing = false + + if (stream[kImpl].ending) { + end(stream) + } else if (stream[kImpl].needDrain) { + process.nextTick(drain, stream) + } + + return + } + + let toWrite = stream[kImpl].buf.slice(0, leftover) + let toWriteBytes = Buffer.byteLength(toWrite) + if (toWriteBytes <= leftover) { + stream[kImpl].buf = stream[kImpl].buf.slice(leftover) + // process._rawDebug('writing ' + toWrite.length) + write(stream, toWrite, nextFlush.bind(null, stream)) + } else { + // multi-byte utf-8 + stream.flush(() => { + // err is already handled in flush() + if (stream.destroyed) { + return + } + + Atomics.store(stream[kImpl].state, READ_INDEX, 0) + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0) + + // Find a toWrite length that fits the buffer + // it must exists as the buffer is at least 4 bytes length + // and the max utf-8 length for a char is 4 bytes. + while (toWriteBytes > stream[kImpl].data.length) { + leftover = leftover / 2 + toWrite = stream[kImpl].buf.slice(0, leftover) + toWriteBytes = Buffer.byteLength(toWrite) + } + stream[kImpl].buf = stream[kImpl].buf.slice(leftover) + write(stream, toWrite, nextFlush.bind(null, stream)) + }) + } + } else if (leftover === 0) { + if (writeIndex === 0 && stream[kImpl].buf.length === 0) { + // we had a flushSync in the meanwhile + return + } + stream.flush(() => { + Atomics.store(stream[kImpl].state, READ_INDEX, 0) + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0) + nextFlush(stream) + }) + } else { + // This should never happen + destroy(stream, new Error('overwritten')) + } +} + +function onWorkerMessage (msg) { + const stream = this.stream.deref() + if (stream === undefined) { + this.exited = true + // Terminate the worker. + this.terminate() + return + } + + switch (msg.code) { + case 'READY': + // Replace the FakeWeakRef with a + // proper one. + this.stream = new WeakRef(stream) + + stream.flush(() => { + stream[kImpl].ready = true + stream.emit('ready') + }) + break + case 'ERROR': + destroy(stream, msg.err) + break + case 'EVENT': + if (Array.isArray(msg.args)) { + stream.emit(msg.name, ...msg.args) + } else { + stream.emit(msg.name, msg.args) + } + break + case 'WARNING': + process.emitWarning(msg.err) + break + default: + destroy(stream, new Error('this should not happen: ' + msg.code)) + } +} + +function onWorkerExit (code) { + const stream = this.stream.deref() + if (stream === undefined) { + // Nothing to do, the worker already exit + return + } + registry.unregister(stream) + stream.worker.exited = true + stream.worker.off('exit', onWorkerExit) + destroy(stream, code !== 0 ? new Error('the worker thread exited') : null) +} + +class ThreadStream extends EventEmitter { + constructor (opts = {}) { + super() + + if (opts.bufferSize < 4) { + throw new Error('bufferSize must at least fit a 4-byte utf-8 char') + } + + this[kImpl] = {} + this[kImpl].stateBuf = new SharedArrayBuffer(128) + this[kImpl].state = new Int32Array(this[kImpl].stateBuf) + this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024) + this[kImpl].data = Buffer.from(this[kImpl].dataBuf) + this[kImpl].sync = opts.sync || false + this[kImpl].ending = false + this[kImpl].ended = false + this[kImpl].needDrain = false + this[kImpl].destroyed = false + this[kImpl].flushing = false + this[kImpl].ready = false + this[kImpl].finished = false + this[kImpl].errored = null + this[kImpl].closed = false + this[kImpl].buf = '' + + // TODO (fix): Make private? + this.worker = createWorker(this, opts) // TODO (fix): make private + } + + write (data) { + if (this[kImpl].destroyed) { + error(this, new Error('the worker has exited')) + return false + } + + if (this[kImpl].ending) { + error(this, new Error('the worker is ending')) + return false + } + + if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) { + try { + writeSync(this) + this[kImpl].flushing = true + } catch (err) { + destroy(this, err) + return false + } + } + + this[kImpl].buf += data + + if (this[kImpl].sync) { + try { + writeSync(this) + return true + } catch (err) { + destroy(this, err) + return false + } + } + + if (!this[kImpl].flushing) { + this[kImpl].flushing = true + setImmediate(nextFlush, this) + } + + this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0 + return !this[kImpl].needDrain + } + + end () { + if (this[kImpl].destroyed) { + return + } + + this[kImpl].ending = true + end(this) + } + + flush (cb) { + if (this[kImpl].destroyed) { + if (typeof cb === 'function') { + process.nextTick(cb, new Error('the worker has exited')) + } + return + } + + // TODO write all .buf + const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX) + // process._rawDebug(`(flush) readIndex (${Atomics.load(this.state, READ_INDEX)}) writeIndex (${Atomics.load(this.state, WRITE_INDEX)})`) + wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => { + if (err) { + destroy(this, err) + process.nextTick(cb, err) + return + } + if (res === 'not-equal') { + // TODO handle deadlock + this.flush(cb) + return + } + process.nextTick(cb) + }) + } + + flushSync () { + if (this[kImpl].destroyed) { + return + } + + writeSync(this) + flushSync(this) + } + + unref () { + this.worker.unref() + } + + ref () { + this.worker.ref() + } + + get ready () { + return this[kImpl].ready + } + + get destroyed () { + return this[kImpl].destroyed + } + + get closed () { + return this[kImpl].closed + } + + get writable () { + return !this[kImpl].destroyed && !this[kImpl].ending + } + + get writableEnded () { + return this[kImpl].ending + } + + get writableFinished () { + return this[kImpl].finished + } + + get writableNeedDrain () { + return this[kImpl].needDrain + } + + get writableObjectMode () { + return false + } + + get writableErrored () { + return this[kImpl].errored + } +} + +function error (stream, err) { + setImmediate(() => { + stream.emit('error', err) + }) +} + +function destroy (stream, err) { + if (stream[kImpl].destroyed) { + return + } + stream[kImpl].destroyed = true + + if (err) { + stream[kImpl].errored = err + error(stream, err) + } + + if (!stream.worker.exited) { + stream.worker.terminate() + .catch(() => {}) + .then(() => { + stream[kImpl].closed = true + stream.emit('close') + }) + } else { + setImmediate(() => { + stream[kImpl].closed = true + stream.emit('close') + }) + } +} + +function write (stream, data, cb) { + // data is smaller than the shared buffer length + const current = Atomics.load(stream[kImpl].state, WRITE_INDEX) + const length = Buffer.byteLength(data) + stream[kImpl].data.write(data, current) + Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length) + Atomics.notify(stream[kImpl].state, WRITE_INDEX) + cb() + return true +} + +function end (stream) { + if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) { + return + } + stream[kImpl].ended = true + + try { + stream.flushSync() + + let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX) + + // process._rawDebug('writing index') + Atomics.store(stream[kImpl].state, WRITE_INDEX, -1) + // process._rawDebug(`(end) readIndex (${Atomics.load(stream.state, READ_INDEX)}) writeIndex (${Atomics.load(stream.state, WRITE_INDEX)})`) + Atomics.notify(stream[kImpl].state, WRITE_INDEX) + + // Wait for the process to complete + let spins = 0 + while (readIndex !== -1) { + // process._rawDebug(`read = ${read}`) + Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1000) + readIndex = Atomics.load(stream[kImpl].state, READ_INDEX) + + if (readIndex === -2) { + destroy(stream, new Error('end() failed')) + return + } + + if (++spins === 10) { + destroy(stream, new Error('end() took too long (10s)')) + return + } + } + + process.nextTick(() => { + stream[kImpl].finished = true + stream.emit('finish') + }) + } catch (err) { + destroy(stream, err) + } + // process._rawDebug('end finished...') +} + +function writeSync (stream) { + const cb = () => { + if (stream[kImpl].ending) { + end(stream) + } else if (stream[kImpl].needDrain) { + process.nextTick(drain, stream) + } + } + stream[kImpl].flushing = false + + while (stream[kImpl].buf.length !== 0) { + const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX) + let leftover = stream[kImpl].data.length - writeIndex + if (leftover === 0) { + flushSync(stream) + Atomics.store(stream[kImpl].state, READ_INDEX, 0) + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0) + continue + } else if (leftover < 0) { + // stream should never happen + throw new Error('overwritten') + } + + let toWrite = stream[kImpl].buf.slice(0, leftover) + let toWriteBytes = Buffer.byteLength(toWrite) + if (toWriteBytes <= leftover) { + stream[kImpl].buf = stream[kImpl].buf.slice(leftover) + // process._rawDebug('writing ' + toWrite.length) + write(stream, toWrite, cb) + } else { + // multi-byte utf-8 + flushSync(stream) + Atomics.store(stream[kImpl].state, READ_INDEX, 0) + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0) + + // Find a toWrite length that fits the buffer + // it must exists as the buffer is at least 4 bytes length + // and the max utf-8 length for a char is 4 bytes. + while (toWriteBytes > stream[kImpl].buf.length) { + leftover = leftover / 2 + toWrite = stream[kImpl].buf.slice(0, leftover) + toWriteBytes = Buffer.byteLength(toWrite) + } + stream[kImpl].buf = stream[kImpl].buf.slice(leftover) + write(stream, toWrite, cb) + } + } +} + +function flushSync (stream) { + if (stream[kImpl].flushing) { + throw new Error('unable to flush while flushing') + } + + // process._rawDebug('flushSync started') + + const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX) + + let spins = 0 + + // TODO handle deadlock + while (true) { + const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX) + + if (readIndex === -2) { + throw Error('_flushSync failed') + } + + // process._rawDebug(`(flushSync) readIndex (${readIndex}) writeIndex (${writeIndex})`) + if (readIndex !== writeIndex) { + // TODO stream timeouts for some reason. + Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1000) + } else { + break + } + + if (++spins === 10) { + throw new Error('_flushSync took too long (10s)') + } + } + // process._rawDebug('flushSync finished') +} + +module.exports = ThreadStream + + +/***/ }), + +/***/ 4212: +/***/ ((module) => { + +"use strict"; + + +const WRITE_INDEX = 4 +const READ_INDEX = 8 + +module.exports = { + WRITE_INDEX, + READ_INDEX +} + + +/***/ }), + +/***/ 33916: +/***/ ((module) => { + +"use strict"; + + +const MAX_TIMEOUT = 1000 + +function wait (state, index, expected, timeout, done) { + const max = Date.now() + timeout + let current = Atomics.load(state, index) + if (current === expected) { + done(null, 'ok') + return + } + let prior = current + const check = (backoff) => { + if (Date.now() > max) { + done(null, 'timed-out') + } else { + setTimeout(() => { + prior = current + current = Atomics.load(state, index) + if (current === prior) { + check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2) + } else { + if (current === expected) done(null, 'ok') + else done(null, 'not-equal') + } + }, backoff) + } + } + check(1) +} + +// let waitDiffCount = 0 +function waitDiff (state, index, expected, timeout, done) { + // const id = waitDiffCount++ + // process._rawDebug(`>>> waitDiff ${id}`) + const max = Date.now() + timeout + let current = Atomics.load(state, index) + if (current !== expected) { + done(null, 'ok') + return + } + const check = (backoff) => { + // process._rawDebug(`${id} ${index} current ${current} expected ${expected}`) + // process._rawDebug('' + backoff) + if (Date.now() > max) { + done(null, 'timed-out') + } else { + setTimeout(() => { + current = Atomics.load(state, index) + if (current !== expected) { + done(null, 'ok') + } else { + check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2) + } + }, backoff) + } + } + check(1) +} + +module.exports = { wait, waitDiff } + + +/***/ }), + +/***/ 18180: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const { Transform } = __nccwpck_require__(51642) + +function inherits (fn, sup) { + fn.super_ = sup + fn.prototype = Object.create(sup.prototype, { + constructor: { value: fn, enumerable: false, writable: true, configurable: true } + }) +} + +// create a new export function, used by both the main export and +// the .ctor export, contains common logic for dealing with arguments +function through2 (construct) { + return (options, transform, flush) => { + if (typeof options === 'function') { + flush = transform + transform = options + options = {} + } + + if (typeof transform !== 'function') { + // noop + transform = (chunk, enc, cb) => cb(null, chunk) + } + + if (typeof flush !== 'function') { + flush = null + } + + return construct(options, transform, flush) + } +} + +// main export, just make me a transform stream! +const make = through2((options, transform, flush) => { + const t2 = new Transform(options) + + t2._transform = transform + + if (flush) { + t2._flush = flush + } + + return t2 +}) + +// make me a reusable prototype that I can `new`, or implicitly `new` +// with a constructor call +const ctor = through2((options, transform, flush) => { + function Through2 (override) { + if (!(this instanceof Through2)) { + return new Through2(override) + } + + this.options = Object.assign({}, options, override) + + Transform.call(this, this.options) + + this._transform = transform + if (flush) { + this._flush = flush + } + } + + inherits(Through2, Transform) + + return Through2 +}) + +const obj = through2(function (options, transform, flush) { + const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options)) + + t2._transform = transform + + if (flush) { + t2._flush = flush + } + + return t2 +}) + +module.exports = make +module.exports.ctor = ctor +module.exports.obj = obj + + +/***/ }), + +/***/ 46399: +/***/ ((module) => { + +"use strict"; +/*! + * toidentifier + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +module.exports = toIdentifier + +/** + * Trasform the given string into a JavaScript identifier + * + * @param {string} str + * @returns {string} + * @public + */ + +function toIdentifier (str) { + return str + .split(' ') + .map(function (token) { + return token.slice(0, 1).toUpperCase() + token.slice(1) + }) + .join('') + .replace(/[^ _0-9a-z]/gi, '') +} + + +/***/ }), + +/***/ 84256: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var punycode = __nccwpck_require__(85477); +var mappingTable = __nccwpck_require__(72020); + +var PROCESSING_OPTIONS = { + TRANSITIONAL: 0, + NONTRANSITIONAL: 1 +}; + +function normalize(str) { // fix bug in v8 + return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); +} + +function findStatus(val) { + var start = 0; + var end = mappingTable.length - 1; + + while (start <= end) { + var mid = Math.floor((start + end) / 2); + + var target = mappingTable[mid]; + if (target[0][0] <= val && target[0][1] >= val) { + return target; + } else if (target[0][0] > val) { + end = mid - 1; + } else { + start = mid + 1; + } + } + + return null; +} + +var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + +function countSymbols(string) { + return string + // replace every surrogate pair with a BMP symbol + .replace(regexAstralSymbols, '_') + // then get the length + .length; +} + +function mapChars(domain_name, useSTD3, processing_option) { + var hasError = false; + var processed = ""; + + var len = countSymbols(domain_name); + for (var i = 0; i < len; ++i) { + var codePoint = domain_name.codePointAt(i); + var status = findStatus(codePoint); + + switch (status[1]) { + case "disallowed": + hasError = true; + processed += String.fromCodePoint(codePoint); + break; + case "ignored": + break; + case "mapped": + processed += String.fromCodePoint.apply(String, status[2]); + break; + case "deviation": + if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { + processed += String.fromCodePoint.apply(String, status[2]); + } else { + processed += String.fromCodePoint(codePoint); + } + break; + case "valid": + processed += String.fromCodePoint(codePoint); + break; + case "disallowed_STD3_mapped": + if (useSTD3) { + hasError = true; + processed += String.fromCodePoint(codePoint); + } else { + processed += String.fromCodePoint.apply(String, status[2]); + } + break; + case "disallowed_STD3_valid": + if (useSTD3) { + hasError = true; + } + + processed += String.fromCodePoint(codePoint); + break; + } + } + + return { + string: processed, + error: hasError + }; +} + +var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; + +function validateLabel(label, processing_option) { + if (label.substr(0, 4) === "xn--") { + label = punycode.toUnicode(label); + processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; + } + + var error = false; + + if (normalize(label) !== label || + (label[3] === "-" && label[4] === "-") || + label[0] === "-" || label[label.length - 1] === "-" || + label.indexOf(".") !== -1 || + label.search(combiningMarksRegex) === 0) { + error = true; + } + + var len = countSymbols(label); + for (var i = 0; i < len; ++i) { + var status = findStatus(label.codePointAt(i)); + if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || + (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && + status[1] !== "valid" && status[1] !== "deviation")) { + error = true; + break; + } + } + + return { + label: label, + error: error + }; +} + +function processing(domain_name, useSTD3, processing_option) { + var result = mapChars(domain_name, useSTD3, processing_option); + result.string = normalize(result.string); + + var labels = result.string.split("."); + for (var i = 0; i < labels.length; ++i) { + try { + var validation = validateLabel(labels[i]); + labels[i] = validation.label; + result.error = result.error || validation.error; + } catch(e) { + result.error = true; + } + } + + return { + string: labels.join("."), + error: result.error + }; +} + +module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { + var result = processing(domain_name, useSTD3, processing_option); + var labels = result.string.split("."); + labels = labels.map(function(l) { + try { + return punycode.toASCII(l); + } catch(e) { + result.error = true; + return l; + } + }); + + if (verifyDnsLength) { + var total = labels.slice(0, labels.length - 1).join(".").length; + if (total.length > 253 || total.length === 0) { + result.error = true; + } + + for (var i=0; i < labels.length; ++i) { + if (labels.length > 63 || labels.length === 0) { + result.error = true; + break; + } + } + } + + if (result.error) return null; + return labels.join("."); +}; + +module.exports.toUnicode = function(domain_name, useSTD3) { + var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); + + return { + domain: result.string, + error: result.error + }; +}; + +module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; + + +/***/ }), + +/***/ 4351: +/***/ ((module) => { + +/*! ***************************************************************************** +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 global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var 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]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (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; + }; + + __rest = function (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; + }; + + __decorate = function (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; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __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()); + }); + }; + + __generator = function (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 }; + } + }; + + __createBinding = function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }; + + __exportStar = function (m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; + }; + + __values = function (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."); + }; + + __read = function (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; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __spreadArrays = function () { + 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; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (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]); } + }; + + __asyncDelegator = function (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; } + }; + + __asyncValues = function (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); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + __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; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); + - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); -} -exports.relative = relative; +/***/ }), -var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); -}()); +/***/ 74294: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function identity (s) { - return s; -} +module.exports = __nccwpck_require__(54219); -/** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ -function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - return aStr; -} -exports.toSetString = supportsNullProto ? identity : toSetString; +/***/ }), -function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } +/***/ 54219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - return aStr; -} -exports.fromSetString = supportsNullProto ? identity : fromSetString; +"use strict"; -function isProtoString(s) { - if (!s) { - return false; - } - var length = s.length; +var net = __nccwpck_require__(41808); +var tls = __nccwpck_require__(24404); +var http = __nccwpck_require__(13685); +var https = __nccwpck_require__(95687); +var events = __nccwpck_require__(82361); +var assert = __nccwpck_require__(39491); +var util = __nccwpck_require__(73837); - if (length < 9 /* "__proto__".length */) { - return false; - } - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } +exports.httpOverHttp = httpOverHttp; +exports.httpsOverHttp = httpsOverHttp; +exports.httpOverHttps = httpOverHttps; +exports.httpsOverHttps = httpsOverHttps; - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - return true; +function httpOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + return agent; } -/** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ -function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } +function httpOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + return agent; +} - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } +function TunnelingAgent(options) { + var self = this; + self.options = options || {}; + self.proxyOptions = self.options.proxy || {}; + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; + self.requests = []; + self.sockets = []; - return strcmp(mappingA.name, mappingB.name); + self.on('free', function onFree(socket, host, port, localAddress) { + var options = toOptions(host, port, localAddress); + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i]; + if (pending.host === options.host && pending.port === options.port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1); + pending.request.onSocket(socket); + return; + } + } + socket.destroy(); + self.removeSocket(socket); + }); } -exports.compareByOriginalPositions = compareByOriginalPositions; +util.inherits(TunnelingAgent, events.EventEmitter); -/** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ -function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { + var self = this; + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push(options); + return; } - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } + // If we are under maxSockets create a new one. + self.createSocket(options, function(socket) { + socket.on('free', onFree); + socket.on('close', onCloseOrRemove); + socket.on('agentRemove', onCloseOrRemove); + req.onSocket(socket); - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } + function onFree() { + self.emit('free', socket, options); + } - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } + function onCloseOrRemove(err) { + self.removeSocket(socket); + socket.removeListener('free', onFree); + socket.removeListener('close', onCloseOrRemove); + socket.removeListener('agentRemove', onCloseOrRemove); + } + }); +}; - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this; + var placeholder = {}; + self.sockets.push(placeholder); -function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; + var connectOptions = mergeOptions({}, self.proxyOptions, { + method: 'CONNECT', + path: options.host + ':' + options.port, + agent: false, + headers: { + host: options.host + ':' + options.port + } + }); + if (options.localAddress) { + connectOptions.localAddress = options.localAddress; } - - if (aStr1 === null) { - return 1; // aStr2 !== null + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {}; + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64'); } - if (aStr2 === null) { - return -1; // aStr1 !== null + debug('making CONNECT request'); + var connectReq = self.request(connectOptions); + connectReq.useChunkedEncodingByDefault = false; // for v0.6 + connectReq.once('response', onResponse); // for v0.6 + connectReq.once('upgrade', onUpgrade); // for v0.6 + connectReq.once('connect', onConnect); // for v0.7 or later + connectReq.once('error', onError); + connectReq.end(); + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true; } - if (aStr1 > aStr2) { - return 1; + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head); + }); } - return -1; -} + function onConnect(res, socket, head) { + connectReq.removeAllListeners(); + socket.removeAllListeners(); -/** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ -function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; + if (res.statusCode !== 200) { + debug('tunneling socket could not be established, statusCode=%d', + res.statusCode); + socket.destroy(); + var error = new Error('tunneling socket could not be established, ' + + 'statusCode=' + res.statusCode); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + if (head.length > 0) { + debug('got illegal response body from proxy'); + socket.destroy(); + var error = new Error('got illegal response body from proxy'); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + debug('tunneling connection has established'); + self.sockets[self.sockets.indexOf(placeholder)] = socket; + return cb(socket); } - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } + function onError(cause) { + connectReq.removeAllListeners(); - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; + debug('tunneling socket could not be established, cause=%s\n', + cause.message, cause.stack); + var error = new Error('tunneling socket could not be established, ' + + 'cause=' + cause.message); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); } +}; - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) { + return; } + this.sockets.splice(pos, 1); - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; + var pending = this.requests.shift(); + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket); + }); } +}; - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; +function createSecureSocket(options, cb) { + var self = this; + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + var hostHeader = options.request.getHeader('host'); + var tlsOptions = mergeOptions({}, self.options, { + socket: socket, + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host + }); -/** - * Strip any JSON XSSI avoidance prefix from the string (as documented - * in the source maps specification), and then parse the string as - * JSON. - */ -function parseSourceMapInput(str) { - return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, tlsOptions); + self.sockets[self.sockets.indexOf(socket)] = secureSocket; + cb(secureSocket); + }); } -exports.parseSourceMapInput = parseSourceMapInput; -/** - * Compute the URL of a source given the the source root, the source's - * URL, and the source map's URL. - */ -function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { - sourceURL = sourceURL || ''; - if (sourceRoot) { - // This follows what Chrome does. - if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { - sourceRoot += '/'; - } - // The spec says: - // Line 4: An optional source root, useful for relocating source - // files on a server or removing repeated values in the - // “sources” entry. This value is prepended to the individual - // entries in the “source” field. - sourceURL = sourceRoot + sourceURL; +function toOptions(host, port, localAddress) { + if (typeof host === 'string') { // since v0.10 + return { + host: host, + port: port, + localAddress: localAddress + }; } + return host; // for v0.11 or later +} - // Historically, SourceMapConsumer did not take the sourceMapURL as - // a parameter. This mode is still somewhat supported, which is why - // this code block is conditional. However, it's preferable to pass - // the source map URL to SourceMapConsumer, so that this function - // can implement the source URL resolution algorithm as outlined in - // the spec. This block is basically the equivalent of: - // new URL(sourceURL, sourceMapURL).toString() - // ... except it avoids using URL, which wasn't available in the - // older releases of node still supported by this library. - // - // The spec says: - // If the sources are not absolute URLs after prepending of the - // “sourceRoot”, the sources are resolved relative to the - // SourceMap (like resolving script src in a html document). - if (sourceMapURL) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var index = parsed.path.lastIndexOf('/'); - if (index >= 0) { - parsed.path = parsed.path.substring(0, index + 1); +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i]; + if (typeof overrides === 'object') { + var keys = Object.keys(overrides); + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j]; + if (overrides[k] !== undefined) { + target[k] = overrides[k]; + } } } - sourceURL = join(urlGenerate(parsed), sourceURL); } - - return normalize(sourceURL); -} -exports.computeSourceURL = computeSourceURL; - - -/***/ }), - -/***/ 56594: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = __nccwpck_require__(69425).SourceMapGenerator; -exports.SourceMapConsumer = __nccwpck_require__(75155).SourceMapConsumer; -exports.SourceNode = __nccwpck_require__(92616).SourceNode; - - -/***/ }), - -/***/ 91543: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -const utils_1 = __nccwpck_require__(81074); -function throwLater(e) { - setTimeout(function () { - throw e; - }, 0); -} -function asCallback(promise, nodeback, options) { - if (typeof nodeback === "function") { - promise.then((val) => { - let ret; - if (options !== undefined && - Object(options).spread && - Array.isArray(val)) { - ret = utils_1.tryCatch(nodeback).apply(undefined, [null].concat(val)); - } - else { - ret = - val === undefined - ? utils_1.tryCatch(nodeback)(null) - : utils_1.tryCatch(nodeback)(null, val); - } - if (ret === utils_1.errorObj) { - throwLater(ret.e); - } - }, (cause) => { - if (!cause) { - const newReason = new Error(cause + ""); - Object.assign(newReason, { cause }); - cause = newReason; - } - const ret = utils_1.tryCatch(nodeback)(cause); - if (ret === utils_1.errorObj) { - throwLater(ret.e); - } - }); - } - return promise; + return target; } -exports["default"] = asCallback; - - -/***/ }), -/***/ 81074: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.tryCatch = exports.errorObj = void 0; -//Try catch is not supported in optimizing -//compiler, so it is isolated -exports.errorObj = { e: {} }; -let tryCatchTarget; -function tryCatcher(err, val) { - try { - const target = tryCatchTarget; - tryCatchTarget = null; - return target.apply(this, arguments); - } - catch (e) { - exports.errorObj.e = e; - return exports.errorObj; +var debug; +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0]; + } else { + args.unshift('TUNNEL:'); } + console.error.apply(console, args); + } +} else { + debug = function() {}; } -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} -exports.tryCatch = tryCatch; +exports.debug = debug; // for test /***/ }), -/***/ 57415: +/***/ 71159: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; /*! - * statuses + * type-is * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2016 Douglas Christopher Wilson + * Copyright(c) 2014-2015 Douglas Christopher Wilson * MIT Licensed */ @@ -136680,7304 +139322,8400 @@ exports.tryCatch = tryCatch; * @private */ -var codes = __nccwpck_require__(50855) +var typer = __nccwpck_require__(19955) +var mime = __nccwpck_require__(43583) /** * Module exports. * @public */ -module.exports = status +module.exports = typeofrequest +module.exports.is = typeis +module.exports.hasBody = hasbody +module.exports.normalize = normalize +module.exports.match = mimeMatch -// status code to message map -status.STATUS_CODES = codes +/** + * Compare a `value` content-type with `types`. + * Each `type` can be an extension like `html`, + * a special shortcut like `multipart` or `urlencoded`, + * or a mime type. + * + * If no types match, `false` is returned. + * Otherwise, the first `type` that matches is returned. + * + * @param {String} value + * @param {Array} types + * @public + */ -// array of status codes -status.codes = populateStatusesMap(status, codes) +function typeis (value, types_) { + var i + var types = types_ -// status codes for redirects -status.redirect = { - 300: true, - 301: true, - 302: true, - 303: true, - 305: true, - 307: true, - 308: true -} + // remove parameters and normalize + var val = tryNormalizeType(value) -// status codes for empty bodies -status.empty = { - 204: true, - 205: true, - 304: true + // no type or invalid + if (!val) { + return false + } + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length - 1) + for (i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } + + // no types, return the content type + if (!types || !types.length) { + return val + } + + var type + for (i = 0; i < types.length; i++) { + if (mimeMatch(normalize(type = types[i]), val)) { + return type[0] === '+' || type.indexOf('*') !== -1 + ? val + : type + } + } + + // no matches + return false } -// status codes for when you should retry the request -status.retry = { - 502: true, - 503: true, - 504: true +/** + * Check if a request has a request body. + * A request with a body __must__ either have `transfer-encoding` + * or `content-length` headers set. + * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 + * + * @param {Object} request + * @return {Boolean} + * @public + */ + +function hasbody (req) { + return req.headers['transfer-encoding'] !== undefined || + !isNaN(req.headers['content-length']) } /** - * Populate the statuses map for given codes. - * @private + * Check if the incoming request contains the "Content-Type" + * header field, and it contains any of the give mime `type`s. + * If there is no request body, `null` is returned. + * If there is no content type, `false` is returned. + * Otherwise, it returns the first `type` that matches. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * this.is('html'); // => 'html' + * this.is('text/html'); // => 'text/html' + * this.is('text/*', 'application/json'); // => 'text/html' + * + * // When Content-Type is application/json + * this.is('json', 'urlencoded'); // => 'json' + * this.is('application/json'); // => 'application/json' + * this.is('html', 'application/*'); // => 'application/json' + * + * this.is('html'); // => false + * + * @param {String|Array} types... + * @return {String|false|null} + * @public */ -function populateStatusesMap (statuses, codes) { - var arr = [] +function typeofrequest (req, types_) { + var types = types_ - Object.keys(codes).forEach(function forEachCode (code) { - var message = codes[code] - var status = Number(code) + // no body + if (!hasbody(req)) { + return null + } - // Populate properties - statuses[status] = message - statuses[message] = status - statuses[message.toLowerCase()] = status + // support flattened arguments + if (arguments.length > 2) { + types = new Array(arguments.length - 1) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } - // Add to array - arr.push(status) - }) + // request content type + var value = req.headers['content-type'] - return arr + return typeis(value, types) } /** - * Get the status code. + * Normalize a mime type. + * If it's a shorthand, expand it to a valid mime type. * - * Given a number, this will throw if it is not a known status - * code, otherwise the code will be returned. Given a string, - * the string will be parsed for a number and return the code - * if valid, otherwise will lookup the code assuming this is - * the status message. + * In general, you probably want: * - * @param {string|number} code - * @returns {number} - * @public + * var type = is(req, ['urlencoded', 'json', 'multipart']); + * + * Then use the appropriate body parsers. + * These three are the most common request body types + * and are thus ensured to work. + * + * @param {String} type + * @private */ -function status (code) { - if (typeof code === 'number') { - if (!status[code]) throw new Error('invalid status code: ' + code) - return code +function normalize (type) { + if (typeof type !== 'string') { + // invalid type + return false } - if (typeof code !== 'string') { - throw new TypeError('code must be a number or string') + switch (type) { + case 'urlencoded': + return 'application/x-www-form-urlencoded' + case 'multipart': + return 'multipart/*' } - // '403' - var n = parseInt(code, 10) - if (!isNaN(n)) { - if (!status[n]) throw new Error('invalid status code: ' + n) - return n + if (type[0] === '+') { + // "+json" -> "*/*+json" expando + return '*/*' + type } - n = status[code.toLowerCase()] - if (!n) throw new Error('invalid status message: "' + code + '"') - return n + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type } +/** + * Check if `expected` mime type + * matches `actual` mime type with + * wildcard and +suffix support. + * + * @param {String} expected + * @param {String} actual + * @return {Boolean} + * @private + */ -/***/ }), - -/***/ 42577: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; +function mimeMatch (expected, actual) { + // invalid type + if (expected === false) { + return false + } -const stripAnsi = __nccwpck_require__(45591); -const isFullwidthCodePoint = __nccwpck_require__(64882); -const emojiRegex = __nccwpck_require__(18212); + // split types + var actualParts = actual.split('/') + var expectedParts = expected.split('/') -const stringWidth = string => { - if (typeof string !== 'string' || string.length === 0) { - return 0; - } + // invalid format + if (actualParts.length !== 2 || expectedParts.length !== 2) { + return false + } - string = stripAnsi(string); + // validate type + if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) { + return false + } - if (string.length === 0) { - return 0; - } + // validate suffix wildcard + if (expectedParts[1].substr(0, 2) === '*+') { + return expectedParts[1].length <= actualParts[1].length + 1 && + expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length) + } - string = string.replace(emojiRegex(), ' '); + // validate subtype + if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) { + return false + } - let width = 0; + return true +} - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); +/** + * Normalize a type and remove parameters. + * + * @param {string} value + * @return {string} + * @private + */ - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } +function normalizeType (value) { + // parse the type + var type = typer.parse(value) - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } + // remove the parameters + type.parameters = undefined - // Surrogates - if (code > 0xFFFF) { - i++; - } + // reformat it + return typer.format(type) +} - width += isFullwidthCodePoint(code) ? 2 : 1; - } +/** + * Try to normalize a type and remove parameters. + * + * @param {string} value + * @return {string} + * @private + */ - return width; -}; +function tryNormalizeType (value) { + if (!value) { + return null + } -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports["default"] = stringWidth; + try { + return normalizeType(value) + } catch (err) { + return null + } +} /***/ }), -/***/ 94841: +/***/ 84419: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. +Object.defineProperty(exports, "__esModule", ({ value: true })); -/**/ +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var Buffer = (__nccwpck_require__(21867).Buffer); -/**/ +var jsonwebtoken = _interopDefault(__nccwpck_require__(77486)); -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; +async function getToken({ + privateKey, + payload +}) { + return jsonwebtoken.sign(payload, privateKey, { + algorithm: "RS256" + }); +} -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; +async function githubAppJwt({ + id, + privateKey, + now = Math.floor(Date.now() / 1000) +}) { + // When creating a JSON Web Token, it sets the "issued at time" (iat) to 30s + // in the past as we have seen people running situations where the GitHub API + // claimed the iat would be in future. It turned out the clocks on the + // different machine were not in sync. + const nowWithSafetyMargin = now - 30; + const expiration = nowWithSafetyMargin + 60 * 10; // JWT expiration time (10 minute maximum) -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; + const payload = { + iat: nowWithSafetyMargin, + exp: expiration, + iss: id + }; + const token = await getToken({ + privateKey, + payload + }); + return { + appId: id, + expiration, + token + }; } -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.s = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; +exports.githubAppJwt = githubAppJwt; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 45030: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function getUserAgent() { + if (typeof navigator === "object" && "userAgent" in navigator) { + return navigator.userAgent; } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; + if (typeof process === "object" && "version" in process) { + return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; -StringDecoder.prototype.end = utf8End; + return ""; +} + +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3124: +/***/ ((module) => { + +"use strict"; +/*! + * unpipe + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; +module.exports = unpipe -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; +/** + * Determine if there are Node.js pipe-like data listeners. + * @private + */ -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} +function hasPipeDataListeners(stream) { + var listeners = stream.listeners('data') -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].name === 'ondata') { + return true } - return nb; } - return 0; + + return false } -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; +/** + * Unpipe a stream from all destinations. + * + * @param {object} stream + * @public + */ + +function unpipe(stream) { + if (!stream) { + throw new TypeError('argument stream is required') } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } + + if (typeof stream.unpipe === 'function') { + // new-style + stream.unpipe() + return } -} -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); + // Node.js 0.8 hack + if (!hasPipeDataListeners(stream)) { + return } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} + var listener + var listeners = stream.listeners('close') -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} + for (var i = 0; i < listeners.length; i++) { + listener = listeners[i] -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } + if (listener.name !== 'cleanup' && listener.name !== 'onclose') { + continue } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); + // invoke the listener + listener.call(stream) } - return r; } -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; +/***/ }), + +/***/ 51023: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const dotenv = __nccwpck_require__(12437) +const fs = __nccwpck_require__(57147) +const path = __nccwpck_require__(71017) +const { promisify } = __nccwpck_require__(73837) + +function escapeNewlines (str) { + return str.replace(/\n/g, '\\n') } -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); +function format (key, value) { + return `${key}=${escapeNewlines(value)}` } -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; +module.exports = async function updateDotenv (env) { + const filename = path.join(process.cwd(), '.env') + + // Merge with existing values + try { + const existing = dotenv.parse(await promisify(fs.readFile)(filename, 'utf-8')) + env = Object.assign(existing, env) + } catch (err) { + if (err.code !== 'ENOENT') { + throw err + } + } + + const contents = Object.keys(env).map(key => format(key, env[key])).join('\n') + await promisify(fs.writeFile)(filename, contents) + + // Update current env with new values + Object.assign(process.env, env) + + return env } + /***/ }), -/***/ 45591: +/***/ 65278: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; -const ansiRegex = __nccwpck_require__(65063); +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; +module.exports = __nccwpck_require__(73837).deprecate; /***/ }), -/***/ 88551: -/***/ ((module) => { +/***/ 44429: +/***/ ((module, exports) => { + +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api public + */ + +exports = module.exports = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; + + +/***/ }), + +/***/ 75840: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = x => { - if (typeof x !== 'string') { - throw new TypeError('Expected a string, got ' + typeof x); - } - // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string - // conversion translates it to FEFF (UTF-16 BOM) - if (x.charCodeAt(0) === 0xFEFF) { - return x.slice(1); - } +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "v1", ({ + enumerable: true, + get: function () { + return _v.default; + } +})); +Object.defineProperty(exports, "v3", ({ + enumerable: true, + get: function () { + return _v2.default; + } +})); +Object.defineProperty(exports, "v4", ({ + enumerable: true, + get: function () { + return _v3.default; + } +})); +Object.defineProperty(exports, "v5", ({ + enumerable: true, + get: function () { + return _v4.default; + } +})); +Object.defineProperty(exports, "NIL", ({ + enumerable: true, + get: function () { + return _nil.default; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _version.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "stringify", ({ + enumerable: true, + get: function () { + return _stringify.default; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function () { + return _parse.default; + } +})); - return x; -}; +var _v = _interopRequireDefault(__nccwpck_require__(78628)); + +var _v2 = _interopRequireDefault(__nccwpck_require__(86409)); + +var _v3 = _interopRequireDefault(__nccwpck_require__(85122)); + +var _v4 = _interopRequireDefault(__nccwpck_require__(79120)); + +var _nil = _interopRequireDefault(__nccwpck_require__(25332)); + +var _version = _interopRequireDefault(__nccwpck_require__(81595)); + +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(62746)); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 59318: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 4569: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -const os = __nccwpck_require__(22037); -const tty = __nccwpck_require__(76224); -const hasFlag = __nccwpck_require__(31621); -const {env} = process; +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; -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; -} +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); -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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function translateLevel(level) { - if (level === 0) { - return false; - } +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; + return _crypto.default.createHash('md5').update(bytes).digest(); } -function supportsColor(haveStream, streamIsTTY) { - if (forceColor === 0) { - return 0; - } +var _default = md5; +exports["default"] = _default; - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } +/***/ }), - if (hasFlag('color=256')) { - return 2; - } +/***/ 25332: +/***/ ((__unused_webpack_module, exports) => { - if (haveStream && !streamIsTTY && forceColor === undefined) { - return 0; - } +"use strict"; - const min = forceColor || 0; - if (env.TERM === 'dumb') { - return min; - } +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports["default"] = _default; - 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; - } +/***/ 62746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } +"use strict"; - return min; - } - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; - if (env.COLORTERM === 'truecolor') { - return 3; - } +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ - if ('COLORTERM' in env) { - return 1; - } + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ - return min; -} + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ -function getSupportLevel(stream) { - const level = supportsColor(stream, stream && stream.isTTY); - return translateLevel(level); -} + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) -module.exports = { - supportsColor: getSupportLevel, - stdout: translateLevel(supportsColor(true, tty.isatty(1))), - stderr: translateLevel(supportsColor(true, tty.isatty(2))) -}; + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} +var _default = parse; +exports["default"] = _default; /***/ }), -/***/ 18180: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 40814: +/***/ ((__unused_webpack_module, exports) => { -const { Transform } = __nccwpck_require__(51642) +"use strict"; -function inherits (fn, sup) { - fn.super_ = sup - fn.prototype = Object.create(sup.prototype, { - constructor: { value: fn, enumerable: false, writable: true, configurable: true } - }) -} -// create a new export function, used by both the main export and -// the .ctor export, contains common logic for dealing with arguments -function through2 (construct) { - return (options, transform, flush) => { - if (typeof options === 'function') { - flush = transform - transform = options - options = {} - } +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports["default"] = _default; - if (typeof transform !== 'function') { - // noop - transform = (chunk, enc, cb) => cb(null, chunk) - } +/***/ }), - if (typeof flush !== 'function') { - flush = null - } +/***/ 50807: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - return construct(options, transform, flush) - } -} +"use strict"; -// main export, just make me a transform stream! -const make = through2((options, transform, flush) => { - const t2 = new Transform(options) - t2._transform = transform +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = rng; - if (flush) { - t2._flush = flush - } +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); - return t2 -}) +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -// make me a reusable prototype that I can `new`, or implicitly `new` -// with a constructor call -const ctor = through2((options, transform, flush) => { - function Through2 (override) { - if (!(this instanceof Through2)) { - return new Through2(override) - } +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate - this.options = Object.assign({}, options, override) +let poolPtr = rnds8Pool.length; - Transform.call(this, this.options) +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); - this._transform = transform - if (flush) { - this._flush = flush - } + poolPtr = 0; } - inherits(Through2, Transform) + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} - return Through2 -}) +/***/ }), -const obj = through2(function (options, transform, flush) { - const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options)) +/***/ 85274: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - t2._transform = transform +"use strict"; - if (flush) { - t2._flush = flush - } - return t2 -}) +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; -module.exports = make -module.exports.ctor = ctor -module.exports.obj = obj +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} +var _default = sha1; +exports["default"] = _default; /***/ }), -/***/ 46399: -/***/ ((module) => { +/***/ 18950: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/*! - * toidentifier - * Copyright(c) 2016 Douglas Christopher Wilson - * MIT Licensed - */ +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; -/** - * Module exports. - * @public - */ +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); -module.exports = toIdentifier +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** - * Trasform the given string into a JavaScript identifier - * - * @param {string} str - * @returns {string} - * @public + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ +const byteToHex = []; -function toIdentifier (str) { - return str - .split(' ') - .map(function (token) { - return token.slice(0, 1).toUpperCase() + token.slice(1) - }) - .join('') - .replace(/[^ _0-9a-z]/gi, '') +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; } +var _default = stringify; +exports["default"] = _default; /***/ }), -/***/ 84256: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 78628: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var punycode = __nccwpck_require__(85477); -var mappingTable = __nccwpck_require__(72020); - -var PROCESSING_OPTIONS = { - TRANSITIONAL: 0, - NONTRANSITIONAL: 1 -}; +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; -function normalize(str) { // fix bug in v8 - return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); -} +var _rng = _interopRequireDefault(__nccwpck_require__(50807)); -function findStatus(val) { - var start = 0; - var end = mappingTable.length - 1; +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); - while (start <= end) { - var mid = Math.floor((start + end) / 2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var target = mappingTable[mid]; - if (target[0][0] <= val && target[0][1] >= val) { - return target; - } else if (target[0][0] > val) { - end = mid - 1; - } else { - start = mid + 1; - } - } +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; - return null; -} +let _clockseq; // Previous uuid creation time -var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; -function countSymbols(string) { - return string - // replace every surrogate pair with a BMP symbol - .replace(regexAstralSymbols, '_') - // then get the length - .length; -} +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details -function mapChars(domain_name, useSTD3, processing_option) { - var hasError = false; - var processed = ""; +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 - var len = countSymbols(domain_name); - for (var i = 0; i < len; ++i) { - var codePoint = domain_name.codePointAt(i); - var status = findStatus(codePoint); + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); - switch (status[1]) { - case "disallowed": - hasError = true; - processed += String.fromCodePoint(codePoint); - break; - case "ignored": - break; - case "mapped": - processed += String.fromCodePoint.apply(String, status[2]); - break; - case "deviation": - if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { - processed += String.fromCodePoint.apply(String, status[2]); - } else { - processed += String.fromCodePoint(codePoint); - } - break; - case "valid": - processed += String.fromCodePoint(codePoint); - break; - case "disallowed_STD3_mapped": - if (useSTD3) { - hasError = true; - processed += String.fromCodePoint(codePoint); - } else { - processed += String.fromCodePoint.apply(String, status[2]); - } - break; - case "disallowed_STD3_valid": - if (useSTD3) { - hasError = true; - } + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } - processed += String.fromCodePoint(codePoint); - break; + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; } - } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - return { - string: processed, - error: hasError - }; -} -var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock -function validateLabel(label, processing_option) { - if (label.substr(0, 4) === "xn--") { - label = punycode.toUnicode(label); - processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; - } + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - var error = false; + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - if (normalize(label) !== label || - (label[3] === "-" && label[4] === "-") || - label[0] === "-" || label[label.length - 1] === "-" || - label.indexOf(".") !== -1 || - label.search(combiningMarksRegex) === 0) { - error = true; - } + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval - var len = countSymbols(label); - for (var i = 0; i < len; ++i) { - var status = findStatus(label.codePointAt(i)); - if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || - (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && - status[1] !== "valid" && status[1] !== "deviation")) { - error = true; - break; - } - } - return { - label: label, - error: error - }; -} + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested -function processing(domain_name, useSTD3, processing_option) { - var result = mapChars(domain_name, useSTD3, processing_option); - result.string = normalize(result.string); - var labels = result.string.split("."); - for (var i = 0; i < labels.length; ++i) { - try { - var validation = validateLabel(labels[i]); - labels[i] = validation.label; - result.error = result.error || validation.error; - } catch(e) { - result.error = true; - } + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); } - return { - string: labels.join("."), - error: result.error - }; -} + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch -module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { - var result = processing(domain_name, useSTD3, processing_option); - var labels = result.string.split("."); - labels = labels.map(function(l) { - try { - return punycode.toASCII(l); - } catch(e) { - result.error = true; - return l; - } - }); + msecs += 12219292800000; // `time_low` - if (verifyDnsLength) { - var total = labels.slice(0, labels.length - 1).join(".").length; - if (total.length > 253 || total.length === 0) { - result.error = true; - } + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` - for (var i=0; i < labels.length; ++i) { - if (labels.length > 63 || labels.length === 0) { - result.error = true; - break; - } - } - } + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` - if (result.error) return null; - return labels.join("."); -}; + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version -module.exports.toUnicode = function(domain_name, useSTD3) { - var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - return { - domain: result.string, - error: result.error - }; -}; + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` -module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; + b[i++] = clockseq & 0xff; // `node` + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } -/***/ }), + return buf || (0, _stringify.default)(b); +} -/***/ 4351: -/***/ ((module) => { +var _default = v1; +exports["default"] = _default; -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. +/***/ }), -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. +/***/ 86409: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -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. -***************************************************************************** */ +"use strict"; -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var 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]; }; - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; - __assign = Object.assign || function (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; - }; +var _v = _interopRequireDefault(__nccwpck_require__(65998)); + +var _md = _interopRequireDefault(__nccwpck_require__(4569)); - __rest = function (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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - __decorate = function (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; - }; +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports["default"] = _default; - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; +/***/ }), - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; +/***/ 65998: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - __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()); - }); - }; +"use strict"; - __generator = function (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 }; - } - }; - __createBinding = function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }; +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = _default; +exports.URL = exports.DNS = void 0; - __exportStar = function (m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; - }; +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); - __values = function (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."); - }; +var _parse = _interopRequireDefault(__nccwpck_require__(62746)); - __read = function (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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape - __spreadArrays = function () { - 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; - }; + const bytes = []; - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } - __asyncGenerator = function (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]); } - }; + return bytes; +} - __asyncDelegator = function (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; } - }; +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; - __asyncValues = function (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 _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === 'string') { + value = stringToBytes(value); + } - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } - __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; - }; + if (namespace.length !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; + if (buf) { + offset = offset || 0; - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + return buf; + } -/***/ }), + return (0, _stringify.default)(bytes); + } // Function#name is not settable on some platforms (#270) -/***/ 74294: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(54219); + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} /***/ }), -/***/ 54219: +/***/ 85122: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var net = __nccwpck_require__(41808); -var tls = __nccwpck_require__(24404); -var http = __nccwpck_require__(13685); -var https = __nccwpck_require__(95687); -var events = __nccwpck_require__(82361); -var assert = __nccwpck_require__(39491); -var util = __nccwpck_require__(73837); - +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; +var _rng = _interopRequireDefault(__nccwpck_require__(50807)); +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} +function v4(options, buf, offset) { + options = options || {}; -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; + if (buf) { + offset = offset || 0; - self.on('free', function onFree(socket, host, port, localAddress) { - var options = toOptions(host, port, localAddress); - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === options.host && pending.port === options.port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; } - socket.destroy(); - self.removeSocket(socket); - }); + + return buf; + } + + return (0, _stringify.default)(rnds); } -util.inherits(TunnelingAgent, events.EventEmitter); -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { - var self = this; - var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); +var _default = v4; +exports["default"] = _default; - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push(options); - return; - } +/***/ }), - // If we are under maxSockets create a new one. - self.createSocket(options, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); +/***/ 79120: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - function onFree() { - self.emit('free', socket, options); - } +"use strict"; - function onCloseOrRemove(err) { - self.removeSocket(socket); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false, - headers: { - host: options.host + ':' + options.port - } - }); - if (options.localAddress) { - connectOptions.localAddress = options.localAddress; - } - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } +var _v = _interopRequireDefault(__nccwpck_require__(65998)); - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); +var _sha = _interopRequireDefault(__nccwpck_require__(85274)); - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports["default"] = _default; - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); +/***/ }), - if (res.statusCode !== 200) { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - socket.destroy(); - var error = new Error('tunneling socket could not be established, ' + - 'statusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; - } - if (head.length > 0) { - debug('got illegal response body from proxy'); - socket.destroy(); - var error = new Error('got illegal response body from proxy'); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; - } - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - return cb(socket); - } +/***/ 66900: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - function onError(cause) { - connectReq.removeAllListeners(); +"use strict"; - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; +var _regex = _interopRequireDefault(__nccwpck_require__(40814)); -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - var hostHeader = options.request.getHeader('host'); - var tlsOptions = mergeOptions({}, self.options, { - socket: socket, - servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host - }); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, tlsOptions); - self.sockets[self.sockets.indexOf(socket)] = secureSocket; - cb(secureSocket); - }); +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); } +var _default = validate; +exports["default"] = _default; -function toOptions(host, port, localAddress) { - if (typeof host === 'string') { // since v0.10 - return { - host: host, - port: port, - localAddress: localAddress - }; - } - return host; // for v0.11 or later -} +/***/ }), -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} +/***/ 81595: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +"use strict"; -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); } -} else { - debug = function() {}; + + return parseInt(uuid.substr(14, 1), 16); } -exports.debug = debug; // for test +var _default = version; +exports["default"] = _default; /***/ }), -/***/ 71159: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 85931: +/***/ ((module) => { "use strict"; /*! - * type-is - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2014-2015 Douglas Christopher Wilson + * vary + * Copyright(c) 2014-2017 Douglas Christopher Wilson * MIT Licensed */ /** - * Module dependencies. - * @private + * Module exports. */ -var typer = __nccwpck_require__(19955) -var mime = __nccwpck_require__(43583) +module.exports = vary +module.exports.append = append /** - * Module exports. - * @public + * RegExp to match field-name in RFC 7230 sec 3.2 + * + * field-name = token + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters */ -module.exports = typeofrequest -module.exports.is = typeis -module.exports.hasBody = hasbody -module.exports.normalize = normalize -module.exports.match = mimeMatch +var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/ /** - * Compare a `value` content-type with `types`. - * Each `type` can be an extension like `html`, - * a special shortcut like `multipart` or `urlencoded`, - * or a mime type. - * - * If no types match, `false` is returned. - * Otherwise, the first `type` that matches is returned. + * Append a field to a vary header. * - * @param {String} value - * @param {Array} types + * @param {String} header + * @param {String|Array} field + * @return {String} * @public */ -function typeis (value, types_) { - var i - var types = types_ - - // remove parameters and normalize - var val = tryNormalizeType(value) +function append (header, field) { + if (typeof header !== 'string') { + throw new TypeError('header argument is required') + } - // no type or invalid - if (!val) { - return false + if (!field) { + throw new TypeError('field argument is required') } - // support flattened arguments - if (types && !Array.isArray(types)) { - types = new Array(arguments.length - 1) - for (i = 0; i < types.length; i++) { - types[i] = arguments[i + 1] + // get fields array + var fields = !Array.isArray(field) + ? parse(String(field)) + : field + + // assert on invalid field names + for (var j = 0; j < fields.length; j++) { + if (!FIELD_NAME_REGEXP.test(fields[j])) { + throw new TypeError('field argument contains an invalid header name') } } - // no types, return the content type - if (!types || !types.length) { - return val + // existing, unspecified vary + if (header === '*') { + return header } - var type - for (i = 0; i < types.length; i++) { - if (mimeMatch(normalize(type = types[i]), val)) { - return type[0] === '+' || type.indexOf('*') !== -1 - ? val - : type - } + // enumerate current values + var val = header + var vals = parse(header.toLowerCase()) + + // unspecified vary + if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) { + return '*' } - // no matches - return false -} + for (var i = 0; i < fields.length; i++) { + var fld = fields[i].toLowerCase() -/** - * Check if a request has a request body. - * A request with a body __must__ either have `transfer-encoding` - * or `content-length` headers set. - * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 - * - * @param {Object} request - * @return {Boolean} - * @public - */ + // append value (case-preserving) + if (vals.indexOf(fld) === -1) { + vals.push(fld) + val = val + ? val + ', ' + fields[i] + : fields[i] + } + } -function hasbody (req) { - return req.headers['transfer-encoding'] !== undefined || - !isNaN(req.headers['content-length']) + return val } /** - * Check if the incoming request contains the "Content-Type" - * header field, and it contains any of the give mime `type`s. - * If there is no request body, `null` is returned. - * If there is no content type, `false` is returned. - * Otherwise, it returns the first `type` that matches. - * - * Examples: - * - * // With Content-Type: text/html; charset=utf-8 - * this.is('html'); // => 'html' - * this.is('text/html'); // => 'text/html' - * this.is('text/*', 'application/json'); // => 'text/html' - * - * // When Content-Type is application/json - * this.is('json', 'urlencoded'); // => 'json' - * this.is('application/json'); // => 'application/json' - * this.is('html', 'application/*'); // => 'application/json' - * - * this.is('html'); // => false + * Parse a vary header into an array. * - * @param {String|Array} types... - * @return {String|false|null} - * @public + * @param {String} header + * @return {Array} + * @private */ -function typeofrequest (req, types_) { - var types = types_ - - // no body - if (!hasbody(req)) { - return null - } +function parse (header) { + var end = 0 + var list = [] + var start = 0 - // support flattened arguments - if (arguments.length > 2) { - types = new Array(arguments.length - 1) - for (var i = 0; i < types.length; i++) { - types[i] = arguments[i + 1] + // gather tokens + for (var i = 0, len = header.length; i < len; i++) { + switch (header.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + 1 + } + break + case 0x2c: /* , */ + list.push(header.substring(start, end)) + start = end = i + 1 + break + default: + end = i + 1 + break } } - // request content type - var value = req.headers['content-type'] + // final token + list.push(header.substring(start, end)) - return typeis(value, types) + return list } /** - * Normalize a mime type. - * If it's a shorthand, expand it to a valid mime type. - * - * In general, you probably want: - * - * var type = is(req, ['urlencoded', 'json', 'multipart']); - * - * Then use the appropriate body parsers. - * These three are the most common request body types - * and are thus ensured to work. + * Mark that a request is varied on a header field. * - * @param {String} type - * @private + * @param {Object} res + * @param {String|Array} field + * @public */ -function normalize (type) { - if (typeof type !== 'string') { - // invalid type - return false +function vary (res, field) { + if (!res || !res.getHeader || !res.setHeader) { + // quack quack + throw new TypeError('res argument is required') } - switch (type) { - case 'urlencoded': - return 'application/x-www-form-urlencoded' - case 'multipart': - return 'multipart/*' - } + // get existing header + var val = res.getHeader('Vary') || '' + var header = Array.isArray(val) + ? val.join(', ') + : String(val) - if (type[0] === '+') { - // "+json" -> "*/*+json" expando - return '*/*' + type + // set new header + if ((val = append(header, field))) { + res.setHeader('Vary', val) } - - return type.indexOf('/') === -1 - ? mime.lookup(type) - : type } -/** - * Check if `expected` mime type - * matches `actual` mime type with - * wildcard and +suffix support. - * - * @param {String} expected - * @param {String} actual - * @return {Boolean} - * @private - */ -function mimeMatch (expected, actual) { - // invalid type - if (expected === false) { - return false - } +/***/ }), - // split types - var actualParts = actual.split('/') - var expectedParts = expected.split('/') +/***/ 54886: +/***/ ((module) => { - // invalid format - if (actualParts.length !== 2 || expectedParts.length !== 2) { - return false - } +"use strict"; - // validate type - if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) { - return false - } - // validate suffix wildcard - if (expectedParts[1].substr(0, 2) === '*+') { - return expectedParts[1].length <= actualParts[1].length + 1 && - expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length) - } +var conversions = {}; +module.exports = conversions; - // validate subtype - if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) { - return false - } +function sign(x) { + return x < 0 ? -1 : 1; +} - return true +function evenRound(x) { + // Round x to the nearest integer, choosing the even integer if it lies halfway between two. + if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) + return Math.floor(x); + } else { + return Math.round(x); + } } -/** - * Normalize a type and remove parameters. - * - * @param {string} value - * @return {string} - * @private - */ +function createNumberConversion(bitLength, typeOpts) { + if (!typeOpts.unsigned) { + --bitLength; + } + const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); + const upperBound = Math.pow(2, bitLength) - 1; -function normalizeType (value) { - // parse the type - var type = typer.parse(value) + const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); + const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); - // remove the parameters - type.parameters = undefined + return function(V, opts) { + if (!opts) opts = {}; - // reformat it - return typer.format(type) -} + let x = +V; -/** - * Try to normalize a type and remove parameters. - * - * @param {string} value - * @return {string} - * @private - */ + if (opts.enforceRange) { + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite number"); + } -function tryNormalizeType (value) { - if (!value) { - return null - } + x = sign(x) * Math.floor(Math.abs(x)); + if (x < lowerBound || x > upperBound) { + throw new TypeError("Argument is not in byte range"); + } - try { - return normalizeType(value) - } catch (err) { - return null - } + return x; + } + + if (!isNaN(x) && opts.clamp) { + x = evenRound(x); + + if (x < lowerBound) x = lowerBound; + if (x > upperBound) x = upperBound; + return x; + } + + if (!Number.isFinite(x) || x === 0) { + return 0; + } + + x = sign(x) * Math.floor(Math.abs(x)); + x = x % moduloVal; + + if (!typeOpts.unsigned && x >= moduloBound) { + return x - moduloVal; + } else if (typeOpts.unsigned) { + if (x < 0) { + x += moduloVal; + } else if (x === -0) { // don't return negative zero + return 0; + } + } + + return x; + } } +conversions["void"] = function () { + return undefined; +}; -/***/ }), +conversions["boolean"] = function (val) { + return !!val; +}; -/***/ 84419: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +conversions["byte"] = createNumberConversion(8, { unsigned: false }); +conversions["octet"] = createNumberConversion(8, { unsigned: true }); -"use strict"; +conversions["short"] = createNumberConversion(16, { unsigned: false }); +conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); +conversions["long"] = createNumberConversion(32, { unsigned: false }); +conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); -Object.defineProperty(exports, "__esModule", ({ value: true })); +conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); +conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } +conversions["double"] = function (V) { + const x = +V; -var jsonwebtoken = _interopDefault(__nccwpck_require__(77486)); + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite floating-point value"); + } -async function getToken({ - privateKey, - payload -}) { - return jsonwebtoken.sign(payload, privateKey, { - algorithm: "RS256" - }); -} + return x; +}; -async function githubAppJwt({ - id, - privateKey, - now = Math.floor(Date.now() / 1000) -}) { - // When creating a JSON Web Token, it sets the "issued at time" (iat) to 30s - // in the past as we have seen people running situations where the GitHub API - // claimed the iat would be in future. It turned out the clocks on the - // different machine were not in sync. - const nowWithSafetyMargin = now - 30; - const expiration = nowWithSafetyMargin + 60 * 10; // JWT expiration time (10 minute maximum) +conversions["unrestricted double"] = function (V) { + const x = +V; - const payload = { - iat: nowWithSafetyMargin, - exp: expiration, - iss: id - }; - const token = await getToken({ - privateKey, - payload - }); - return { - appId: id, - expiration, - token - }; -} + if (isNaN(x)) { + throw new TypeError("Argument is NaN"); + } -exports.githubAppJwt = githubAppJwt; -//# sourceMappingURL=index.js.map + return x; +}; + +// not quite valid, but good enough for JS +conversions["float"] = conversions["double"]; +conversions["unrestricted float"] = conversions["unrestricted double"]; + +conversions["DOMString"] = function (V, opts) { + if (!opts) opts = {}; + + if (opts.treatNullAsEmptyString && V === null) { + return ""; + } + + return String(V); +}; + +conversions["ByteString"] = function (V, opts) { + const x = String(V); + let c = undefined; + for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { + if (c > 255) { + throw new TypeError("Argument is not a valid bytestring"); + } + } + + return x; +}; + +conversions["USVString"] = function (V) { + const S = String(V); + const n = S.length; + const U = []; + for (let i = 0; i < n; ++i) { + const c = S.charCodeAt(i); + if (c < 0xD800 || c > 0xDFFF) { + U.push(String.fromCodePoint(c)); + } else if (0xDC00 <= c && c <= 0xDFFF) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + if (i === n - 1) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + const d = S.charCodeAt(i + 1); + if (0xDC00 <= d && d <= 0xDFFF) { + const a = c & 0x3FF; + const b = d & 0x3FF; + U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); + ++i; + } else { + U.push(String.fromCodePoint(0xFFFD)); + } + } + } + } + return U.join(''); +}; -/***/ }), +conversions["Date"] = function (V, opts) { + if (!(V instanceof Date)) { + throw new TypeError("Argument is not a Date object"); + } + if (isNaN(V)) { + return undefined; + } -/***/ 45030: -/***/ ((__unused_webpack_module, exports) => { + return V; +}; -"use strict"; +conversions["RegExp"] = function (V, opts) { + if (!(V instanceof RegExp)) { + V = new RegExp(V); + } + return V; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -function getUserAgent() { - if (typeof navigator === "object" && "userAgent" in navigator) { - return navigator.userAgent; - } +/***/ }), - if (typeof process === "object" && "version" in process) { - return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; - } +/***/ 97537: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - return ""; -} +"use strict"; -exports.getUserAgent = getUserAgent; -//# sourceMappingURL=index.js.map +const usm = __nccwpck_require__(2158); +exports.implementation = class URLImpl { + constructor(constructorArgs) { + const url = constructorArgs[0]; + const base = constructorArgs[1]; -/***/ }), + let parsedBase = null; + if (base !== undefined) { + parsedBase = usm.basicURLParse(base); + if (parsedBase === "failure") { + throw new TypeError("Invalid base URL"); + } + } -/***/ 3124: -/***/ ((module) => { + const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } -"use strict"; -/*! - * unpipe - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ + this._url = parsedURL; + // TODO: query stuff + } + get href() { + return usm.serializeURL(this._url); + } -/** - * Module exports. - * @public - */ + set href(v) { + const parsedURL = usm.basicURLParse(v); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } -module.exports = unpipe + this._url = parsedURL; + } -/** - * Determine if there are Node.js pipe-like data listeners. - * @private - */ + get origin() { + return usm.serializeURLOrigin(this._url); + } -function hasPipeDataListeners(stream) { - var listeners = stream.listeners('data') + get protocol() { + return this._url.scheme + ":"; + } - for (var i = 0; i < listeners.length; i++) { - if (listeners[i].name === 'ondata') { - return true - } + set protocol(v) { + usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); } - return false -} + get username() { + return this._url.username; + } -/** - * Unpipe a stream from all destinations. - * - * @param {object} stream - * @public - */ + set username(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } -function unpipe(stream) { - if (!stream) { - throw new TypeError('argument stream is required') + usm.setTheUsername(this._url, v); } - if (typeof stream.unpipe === 'function') { - // new-style - stream.unpipe() - return + get password() { + return this._url.password; } - // Node.js 0.8 hack - if (!hasPipeDataListeners(stream)) { - return + set password(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setThePassword(this._url, v); } - var listener - var listeners = stream.listeners('close') + get host() { + const url = this._url; - for (var i = 0; i < listeners.length; i++) { - listener = listeners[i] + if (url.host === null) { + return ""; + } - if (listener.name !== 'cleanup' && listener.name !== 'onclose') { - continue + if (url.port === null) { + return usm.serializeHost(url.host); } - // invoke the listener - listener.call(stream) + return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); } -} + set host(v) { + if (this._url.cannotBeABaseURL) { + return; + } -/***/ }), + usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); + } -/***/ 51023: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get hostname() { + if (this._url.host === null) { + return ""; + } -const dotenv = __nccwpck_require__(12437) -const fs = __nccwpck_require__(57147) -const path = __nccwpck_require__(71017) -const { promisify } = __nccwpck_require__(73837) + return usm.serializeHost(this._url.host); + } -function escapeNewlines (str) { - return str.replace(/\n/g, '\\n') -} + set hostname(v) { + if (this._url.cannotBeABaseURL) { + return; + } -function format (key, value) { - return `${key}=${escapeNewlines(value)}` -} + usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); + } -module.exports = async function updateDotenv (env) { - const filename = path.join(process.cwd(), '.env') + get port() { + if (this._url.port === null) { + return ""; + } - // Merge with existing values - try { - const existing = dotenv.parse(await promisify(fs.readFile)(filename, 'utf-8')) - env = Object.assign(existing, env) - } catch (err) { - if (err.code !== 'ENOENT') { - throw err + return usm.serializeInteger(this._url.port); + } + + set port(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + if (v === "") { + this._url.port = null; + } else { + usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); } } - const contents = Object.keys(env).map(key => format(key, env[key])).join('\n') - await promisify(fs.writeFile)(filename, contents) + get pathname() { + if (this._url.cannotBeABaseURL) { + return this._url.path[0]; + } - // Update current env with new values - Object.assign(process.env, env) + if (this._url.path.length === 0) { + return ""; + } - return env -} + return "/" + this._url.path.join("/"); + } + set pathname(v) { + if (this._url.cannotBeABaseURL) { + return; + } -/***/ }), + this._url.path = []; + usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); + } -/***/ 65278: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get search() { + if (this._url.query === null || this._url.query === "") { + return ""; + } + return "?" + this._url.query; + } -/** - * For Node.js, simply re-export the core `util.deprecate` function. - */ + set search(v) { + // TODO: query stuff -module.exports = __nccwpck_require__(73837).deprecate; + const url = this._url; + if (v === "") { + url.query = null; + return; + } -/***/ }), + const input = v[0] === "?" ? v.substring(1) : v; + url.query = ""; + usm.basicURLParse(input, { url, stateOverride: "query" }); + } -/***/ 44429: -/***/ ((module, exports) => { + get hash() { + if (this._url.fragment === null || this._url.fragment === "") { + return ""; + } -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ + return "#" + this._url.fragment; + } -exports = module.exports = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; + set hash(v) { + if (v === "") { + this._url.fragment = null; + return; } + + const input = v[0] === "#" ? v.substring(1) : v; + this._url.fragment = ""; + usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); + } + + toJSON() { + return this.href; } - return a; }; /***/ }), -/***/ 75840: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 63394: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -Object.defineProperty(exports, "v1", ({ - enumerable: true, - get: function () { - return _v.default; - } -})); -Object.defineProperty(exports, "v3", ({ - enumerable: true, - get: function () { - return _v2.default; - } -})); -Object.defineProperty(exports, "v4", ({ - enumerable: true, - get: function () { - return _v3.default; +const conversions = __nccwpck_require__(54886); +const utils = __nccwpck_require__(83185); +const Impl = __nccwpck_require__(97537); + +const impl = utils.implSymbol; + +function URL(url) { + if (!this || this[impl] || !(this instanceof URL)) { + throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); } -})); -Object.defineProperty(exports, "v5", ({ - enumerable: true, - get: function () { - return _v4.default; + if (arguments.length < 1) { + throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); } -})); -Object.defineProperty(exports, "NIL", ({ - enumerable: true, - get: function () { - return _nil.default; + const args = []; + for (let i = 0; i < arguments.length && i < 2; ++i) { + args[i] = arguments[i]; } -})); -Object.defineProperty(exports, "version", ({ - enumerable: true, - get: function () { - return _version.default; + args[0] = conversions["USVString"](args[0]); + if (args[1] !== undefined) { + args[1] = conversions["USVString"](args[1]); } -})); -Object.defineProperty(exports, "validate", ({ - enumerable: true, - get: function () { - return _validate.default; + + module.exports.setup(this, args); +} + +URL.prototype.toJSON = function toJSON() { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); } -})); -Object.defineProperty(exports, "stringify", ({ - enumerable: true, - get: function () { - return _stringify.default; + const args = []; + for (let i = 0; i < arguments.length && i < 0; ++i) { + args[i] = arguments[i]; } -})); -Object.defineProperty(exports, "parse", ({ + return this[impl].toJSON.apply(this[impl], args); +}; +Object.defineProperty(URL.prototype, "href", { + get() { + return this[impl].href; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].href = V; + }, enumerable: true, - get: function () { - return _parse.default; - } -})); - -var _v = _interopRequireDefault(__nccwpck_require__(78628)); - -var _v2 = _interopRequireDefault(__nccwpck_require__(86409)); - -var _v3 = _interopRequireDefault(__nccwpck_require__(85122)); - -var _v4 = _interopRequireDefault(__nccwpck_require__(79120)); + configurable: true +}); -var _nil = _interopRequireDefault(__nccwpck_require__(25332)); +URL.prototype.toString = function () { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + return this.href; +}; -var _version = _interopRequireDefault(__nccwpck_require__(81595)); +Object.defineProperty(URL.prototype, "origin", { + get() { + return this[impl].origin; + }, + enumerable: true, + configurable: true +}); -var _validate = _interopRequireDefault(__nccwpck_require__(66900)); +Object.defineProperty(URL.prototype, "protocol", { + get() { + return this[impl].protocol; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].protocol = V; + }, + enumerable: true, + configurable: true +}); -var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); +Object.defineProperty(URL.prototype, "username", { + get() { + return this[impl].username; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].username = V; + }, + enumerable: true, + configurable: true +}); -var _parse = _interopRequireDefault(__nccwpck_require__(62746)); +Object.defineProperty(URL.prototype, "password", { + get() { + return this[impl].password; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].password = V; + }, + enumerable: true, + configurable: true +}); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +Object.defineProperty(URL.prototype, "host", { + get() { + return this[impl].host; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].host = V; + }, + enumerable: true, + configurable: true +}); -/***/ }), +Object.defineProperty(URL.prototype, "hostname", { + get() { + return this[impl].hostname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hostname = V; + }, + enumerable: true, + configurable: true +}); -/***/ 4569: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +Object.defineProperty(URL.prototype, "port", { + get() { + return this[impl].port; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].port = V; + }, + enumerable: true, + configurable: true +}); -"use strict"; +Object.defineProperty(URL.prototype, "pathname", { + get() { + return this[impl].pathname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].pathname = V; + }, + enumerable: true, + configurable: true +}); +Object.defineProperty(URL.prototype, "search", { + get() { + return this[impl].search; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].search = V; + }, + enumerable: true, + configurable: true +}); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; +Object.defineProperty(URL.prototype, "hash", { + get() { + return this[impl].hash; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hash = V; + }, + enumerable: true, + configurable: true +}); -var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +module.exports = { + is(obj) { + return !!obj && obj[impl] instanceof Impl.implementation; + }, + create(constructorArgs, privateData) { + let obj = Object.create(URL.prototype); + this.setup(obj, constructorArgs, privateData); + return obj; + }, + setup(obj, constructorArgs, privateData) { + if (!privateData) privateData = {}; + privateData.wrapper = obj; -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); + obj[impl] = new Impl.implementation(constructorArgs, privateData); + obj[impl][utils.wrapperSymbol] = obj; + }, + interface: URL, + expose: { + Window: { URL: URL }, + Worker: { URL: URL } } +}; - return _crypto.default.createHash('md5').update(bytes).digest(); -} -var _default = md5; -exports["default"] = _default; /***/ }), -/***/ 25332: -/***/ ((__unused_webpack_module, exports) => { +/***/ 28665: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _default = '00000000-0000-0000-0000-000000000000'; -exports["default"] = _default; +exports.URL = __nccwpck_require__(63394)["interface"]; +exports.serializeURL = __nccwpck_require__(2158).serializeURL; +exports.serializeURLOrigin = __nccwpck_require__(2158).serializeURLOrigin; +exports.basicURLParse = __nccwpck_require__(2158).basicURLParse; +exports.setTheUsername = __nccwpck_require__(2158).setTheUsername; +exports.setThePassword = __nccwpck_require__(2158).setThePassword; +exports.serializeHost = __nccwpck_require__(2158).serializeHost; +exports.serializeInteger = __nccwpck_require__(2158).serializeInteger; +exports.parseURL = __nccwpck_require__(2158).parseURL; + /***/ }), -/***/ 62746: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 2158: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const punycode = __nccwpck_require__(85477); +const tr46 = __nccwpck_require__(84256); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _validate = _interopRequireDefault(__nccwpck_require__(66900)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; -function parse(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } +const failure = Symbol("failure"); - let v; - const arr = new Uint8Array(16); // Parse ########-....-....-....-............ +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 0xff; - arr[2] = v >>> 8 & 0xff; - arr[3] = v & 0xff; // Parse ........-####-....-....-............ +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 0xff; // Parse ........-....-####-....-............ +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 0xff; // Parse ........-....-....-####-............ +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 0xff; // Parse ........-....-....-....-############ - // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; - arr[11] = v / 0x100000000 & 0xff; - arr[12] = v >>> 24 & 0xff; - arr[13] = v >>> 16 & 0xff; - arr[14] = v >>> 8 & 0xff; - arr[15] = v & 0xff; - return arr; +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); } -var _default = parse; -exports["default"] = _default; +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} -/***/ }), +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} -/***/ 40814: -/***/ ((__unused_webpack_module, exports) => { +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} -"use strict"; +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; -exports["default"] = _default; +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} -/***/ }), +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} -/***/ 50807: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} -"use strict"; +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} +function defaultPort(scheme) { + return specialSchemes[scheme]; +} -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = rng; +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } -var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + return "%" + hex; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function utf8PercentEncode(c) { + const buf = new Buffer(c); -const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + let str = ""; -let poolPtr = rnds8Pool.length; + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - _crypto.default.randomFillSync(rnds8Pool); + return str; +} - poolPtr = 0; +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } } - - return rnds8Pool.slice(poolPtr, poolPtr += 16); + return new Buffer(output).toString(); } -/***/ }), +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} -/***/ 85274: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} -"use strict"; +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } -var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + return cStr; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function parseIPv4Number(input) { + let R = 10; -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; } - return _crypto.default.createHash('sha1').update(bytes).digest(); -} + if (input === "") { + return 0; + } -var _default = sha1; -exports["default"] = _default; + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } -/***/ }), + return parseInt(input, R); +} -/***/ 18950: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } -"use strict"; + if (parts.length > 4) { + return input; + } + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; + numbers.push(n); + } -var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + let ipv4 = numbers.pop(); + let counter = 0; -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -const byteToHex = []; + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } -for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).substr(1)); + return ipv4; } -function stringify(arr, offset = 0) { - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields +function serializeIPv4(address) { + let output = ""; + let n = address; - if (!(0, _validate.default)(uuid)) { - throw TypeError('Stringified UUID is invalid'); + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); } - return uuid; + return output; } -var _default = stringify; -exports["default"] = _default; +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; -/***/ }), + input = punycode.ucs2.decode(input); -/***/ 78628: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } -"use strict"; + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } -var _rng = _interopRequireDefault(__nccwpck_require__(50807)); + let value = 0; + let length = 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html -let _nodeId; + pointer -= length; -let _clockseq; // Previous uuid creation time + if (pieceIndex > 6) { + return failure; + } + let numbersSeen = 0; -let _lastMSecs = 0; -let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + while (input[pointer] !== undefined) { + let ipv4Piece = null; -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || _rng.default)(); + if (!isASCIIDigit(input[pointer])) { + return failure; + } - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + ++numbersSeen; - let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } - let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + if (numbersSeen !== 4) { + return failure; + } - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + output += address[pieceIndex].toString(16); - if (nsecs >= 10000) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + if (pieceIndex !== 7) { + output += ":"; + } } - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + return output; +} - msecs += 12219292800000; // `time_low` +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } - const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` + return parseIPv6(input.substring(1, input.length - 1)); + } - const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` + if (!isSpecialArg) { + return parseOpaqueHost(input); + } - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } - b[i++] = clockseq & 0xff; // `node` + return asciiDomain; +} - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; } - return buf || (0, _stringify.default)(b); + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; } -var _default = v1; -exports["default"] = _default; - -/***/ }), +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; -/***/ 86409: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } -"use strict"; + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; + return { + idx: maxIdx, + len: maxLen + }; +} -var _v = _interopRequireDefault(__nccwpck_require__(65998)); +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } -var _md = _interopRequireDefault(__nccwpck_require__(4569)); + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + return host; +} -const v3 = (0, _v.default)('v3', 0x30, _md.default); -var _default = v3; -exports["default"] = _default; +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} -/***/ }), +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} -/***/ 65998: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } -"use strict"; + path.pop(); +} +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = _default; -exports.URL = exports.DNS = void 0; +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} -var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} -var _parse = _interopRequireDefault(__nccwpck_require__(62746)); +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); // UTF8 escape + cannotBeABaseURL: false + }; - const bytes = []; + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; } + this.input = res; - return bytes; -} + this.state = stateOverride || "scheme start"; -const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; -exports.DNS = DNS; -const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; -exports.URL = URL; + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; -function _default(name, version, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === 'string') { - value = stringToBytes(value); - } + this.input = punycode.ucs2.decode(this.input); - if (typeof namespace === 'string') { - namespace = (0, _parse.default)(namespace); + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; } + } +} - if (namespace.length !== 16) { - throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); - } // Compute hash of namespace and value, Per 4.3 - // Future: Use spread syntax when supported on all platforms, e.g. `bytes = - // hashfunc([...namespace, ... value])` +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + return true; +}; - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 0x0f | version; - bytes[8] = bytes[8] & 0x3f | 0x80; +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } - if (buf) { - offset = offset || 0; + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; } - return buf; + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } - return (0, _stringify.default)(bytes); - } // Function#name is not settable on some platforms (#270) + return true; +}; +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } - try { - generateUUID.name = name; // eslint-disable-next-line no-empty - } catch (err) {} // For CommonJS default export support + return true; +}; +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } - generateUUID.DNS = DNS; - generateUUID.URL = URL; - return generateUUID; -} + return true; +}; -/***/ }), +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } -/***/ 85122: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + return true; +}; -"use strict"; +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + this.state = "path"; + --this.pointer; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; + return true; +}; -var _rng = _interopRequireDefault(__nccwpck_require__(50807)); +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } -var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + return true; +}; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } -function v4(options, buf, offset) { - options = options || {}; + return true; +}; - const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + return true; +}; - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; - if (buf) { - offset = offset || 0; + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } } - - return buf; + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; } - return (0, _stringify.default)(rnds); -} - -var _default = v4; -exports["default"] = _default; + return true; +}; -/***/ }), +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } -/***/ 79120: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } -"use strict"; + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } -var _v = _interopRequireDefault(__nccwpck_require__(65998)); + return true; +}; -var _sha = _interopRequireDefault(__nccwpck_require__(85274)); +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + return true; +}; -const v5 = (0, _v.default)('v5', 0x50, _sha.default); -var _default = v5; -exports["default"] = _default; +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); -/***/ }), +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; -/***/ 66900: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } -"use strict"; + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + return true; +}; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } -var _regex = _interopRequireDefault(__nccwpck_require__(40814)); + return true; +}; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; -function validate(uuid) { - return typeof uuid === 'string' && _regex.default.test(uuid); -} + if (this.stateOverride) { + return false; + } -var _default = validate; -exports["default"] = _default; + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } -/***/ }), + return true; +}; -/***/ 81595: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; -"use strict"; + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + return true; +}; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } -var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } -function version(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); + this.buffer += percentEncodeChar(c, isPathPercentEncode); } - return parseInt(uuid.substr(14, 1), 16); -} - -var _default = version; -exports["default"] = _default; + return true; +}; -/***/ }), +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } -/***/ 85931: -/***/ ((module) => { + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } -"use strict"; -/*! - * vary - * Copyright(c) 2014-2017 Douglas Christopher Wilson - * MIT Licensed - */ + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + return true; +}; +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } -/** - * Module exports. - */ + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } -module.exports = vary -module.exports.append = append + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } -/** - * RegExp to match field-name in RFC 7230 sec 3.2 - * - * field-name = token - * token = 1*tchar - * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" - * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" - * / DIGIT / ALPHA - * ; any VCHAR, except delimiters - */ + this.buffer += cStr; + } -var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/ + return true; +}; -/** - * Append a field to a vary header. - * - * @param {String} header - * @param {String|Array} field - * @return {String} - * @public - */ +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } -function append (header, field) { - if (typeof header !== 'string') { - throw new TypeError('header argument is required') + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); } - if (!field) { - throw new TypeError('field argument is required') - } + return true; +}; - // get fields array - var fields = !Array.isArray(field) - ? parse(String(field)) - : field +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; - // assert on invalid field names - for (var j = 0; j < fields.length; j++) { - if (!FIELD_NAME_REGEXP.test(fields[j])) { - throw new TypeError('field argument contains an invalid header name') + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; } + } else if (url.host === null && url.scheme === "file") { + output += "//"; } - // existing, unspecified vary - if (header === '*') { - return header + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } } - // enumerate current values - var val = header - var vals = parse(header.toLowerCase()) + if (url.query !== null) { + output += "?" + url.query; + } - // unspecified vary - if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) { - return '*' + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; } - for (var i = 0; i < fields.length; i++) { - var fld = fields[i].toLowerCase() + return output; +} - // append value (case-preserving) - if (vals.indexOf(fld) === -1) { - vals.push(fld) - val = val - ? val + ', ' + fields[i] - : fields[i] - } +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; } - return val + return result; } -/** - * Parse a vary header into an array. - * - * @param {String} header - * @return {Array} - * @private - */ - -function parse (header) { - var end = 0 - var list = [] - var start = 0 +module.exports.serializeURL = serializeURL; - // gather tokens - for (var i = 0, len = header.length; i < len; i++) { - switch (header.charCodeAt(i)) { - case 0x20: /* */ - if (start === end) { - start = end = i + 1 - } - break - case 0x2c: /* , */ - list.push(header.substring(start, end)) - start = end = i + 1 - break - default: - end = i + 1 - break - } +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; } +}; - // final token - list.push(header.substring(start, end)) +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } - return list -} + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } -/** - * Mark that a request is varied on a header field. - * - * @param {Object} res - * @param {String|Array} field - * @public - */ + return usm.url; +}; -function vary (res, field) { - if (!res || !res.getHeader || !res.setHeader) { - // quack quack - throw new TypeError('res argument is required') +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); } +}; - // get existing header - var val = res.getHeader('Vary') || '' - var header = Array.isArray(val) - ? val.join(', ') - : String(val) +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; - // set new header - if ((val = append(header, field))) { - res.setHeader('Vary', val) +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; } -} + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; /***/ }), -/***/ 54886: +/***/ 83185: /***/ ((module) => { "use strict"; -var conversions = {}; -module.exports = conversions; - -function sign(x) { - return x < 0 ? -1 : 1; -} - -function evenRound(x) { - // Round x to the nearest integer, choosing the even integer if it lies halfway between two. - if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) - return Math.floor(x); - } else { - return Math.round(x); - } -} - -function createNumberConversion(bitLength, typeOpts) { - if (!typeOpts.unsigned) { - --bitLength; - } - const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); - const upperBound = Math.pow(2, bitLength) - 1; +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); + } +}; - const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); - const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); - return function(V, opts) { - if (!opts) opts = {}; +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; +}; - let x = +V; +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; - if (opts.enforceRange) { - if (!Number.isFinite(x)) { - throw new TypeError("Argument is not a finite number"); - } - x = sign(x) * Math.floor(Math.abs(x)); - if (x < lowerBound || x > upperBound) { - throw new TypeError("Argument is not in byte range"); - } - return x; - } +/***/ }), - if (!isNaN(x) && opts.clamp) { - x = evenRound(x); +/***/ 62940: +/***/ ((module) => { - if (x < lowerBound) x = lowerBound; - if (x > upperBound) x = upperBound; - return x; - } +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) - if (!Number.isFinite(x) || x === 0) { - return 0; - } + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') - x = sign(x) * Math.floor(Math.abs(x)); - x = x % moduloVal; + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) - if (!typeOpts.unsigned && x >= moduloBound) { - return x - moduloVal; - } else if (typeOpts.unsigned) { - if (x < 0) { - x += moduloVal; - } else if (x === -0) { // don't return negative zero - return 0; - } - } + return wrapper - return x; + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) } + return ret + } } -conversions["void"] = function () { - return undefined; -}; - -conversions["boolean"] = function (val) { - return !!val; -}; -conversions["byte"] = createNumberConversion(8, { unsigned: false }); -conversions["octet"] = createNumberConversion(8, { unsigned: true }); +/***/ }), -conversions["short"] = createNumberConversion(16, { unsigned: false }); -conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); +/***/ 4091: +/***/ ((module) => { -conversions["long"] = createNumberConversion(32, { unsigned: false }); -conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); +"use strict"; -conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); -conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); +module.exports = function (Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value + } + } +} -conversions["double"] = function (V) { - const x = +V; - if (!Number.isFinite(x)) { - throw new TypeError("Argument is not a finite floating-point value"); - } +/***/ }), - return x; -}; +/***/ 40665: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -conversions["unrestricted double"] = function (V) { - const x = +V; +"use strict"; - if (isNaN(x)) { - throw new TypeError("Argument is NaN"); - } +module.exports = Yallist - return x; -}; +Yallist.Node = Node +Yallist.create = Yallist -// not quite valid, but good enough for JS -conversions["float"] = conversions["double"]; -conversions["unrestricted float"] = conversions["unrestricted double"]; +function Yallist (list) { + var self = this + if (!(self instanceof Yallist)) { + self = new Yallist() + } -conversions["DOMString"] = function (V, opts) { - if (!opts) opts = {}; + self.tail = null + self.head = null + self.length = 0 - if (opts.treatNullAsEmptyString && V === null) { - return ""; + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item) + }) + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]) } + } - return String(V); -}; + return self +} -conversions["ByteString"] = function (V, opts) { - const x = String(V); - let c = undefined; - for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { - if (c > 255) { - throw new TypeError("Argument is not a valid bytestring"); - } - } +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } - return x; -}; + var next = node.next + var prev = node.prev -conversions["USVString"] = function (V) { - const S = String(V); - const n = S.length; - const U = []; - for (let i = 0; i < n; ++i) { - const c = S.charCodeAt(i); - if (c < 0xD800 || c > 0xDFFF) { - U.push(String.fromCodePoint(c)); - } else if (0xDC00 <= c && c <= 0xDFFF) { - U.push(String.fromCodePoint(0xFFFD)); - } else { - if (i === n - 1) { - U.push(String.fromCodePoint(0xFFFD)); - } else { - const d = S.charCodeAt(i + 1); - if (0xDC00 <= d && d <= 0xDFFF) { - const a = c & 0x3FF; - const b = d & 0x3FF; - U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); - ++i; - } else { - U.push(String.fromCodePoint(0xFFFD)); - } - } - } - } + if (next) { + next.prev = prev + } - return U.join(''); -}; + if (prev) { + prev.next = next + } -conversions["Date"] = function (V, opts) { - if (!(V instanceof Date)) { - throw new TypeError("Argument is not a Date object"); - } - if (isNaN(V)) { - return undefined; - } + if (node === this.head) { + this.head = next + } + if (node === this.tail) { + this.tail = prev + } - return V; -}; + node.list.length-- + node.next = null + node.prev = null + node.list = null -conversions["RegExp"] = function (V, opts) { - if (!(V instanceof RegExp)) { - V = new RegExp(V); - } + return next +} - return V; -}; +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + if (node.list) { + node.list.removeNode(node) + } -/***/ }), + var head = this.head + node.list = this + node.next = head + if (head) { + head.prev = node + } -/***/ 97537: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + this.head = node + if (!this.tail) { + this.tail = node + } + this.length++ +} -"use strict"; +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } -const usm = __nccwpck_require__(2158); + if (node.list) { + node.list.removeNode(node) + } -exports.implementation = class URLImpl { - constructor(constructorArgs) { - const url = constructorArgs[0]; - const base = constructorArgs[1]; + var tail = this.tail + node.list = this + node.prev = tail + if (tail) { + tail.next = node + } - let parsedBase = null; - if (base !== undefined) { - parsedBase = usm.basicURLParse(base); - if (parsedBase === "failure") { - throw new TypeError("Invalid base URL"); - } - } + this.tail = node + if (!this.head) { + this.head = node + } + this.length++ +} - const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); - if (parsedURL === "failure") { - throw new TypeError("Invalid URL"); - } +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]) + } + return this.length +} - this._url = parsedURL; +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]) + } + return this.length +} - // TODO: query stuff +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined } - get href() { - return usm.serializeURL(this._url); + var res = this.tail.value + this.tail = this.tail.prev + if (this.tail) { + this.tail.next = null + } else { + this.head = null } + this.length-- + return res +} - set href(v) { - const parsedURL = usm.basicURLParse(v); - if (parsedURL === "failure") { - throw new TypeError("Invalid URL"); - } +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined + } - this._url = parsedURL; + var res = this.head.value + this.head = this.head.next + if (this.head) { + this.head.prev = null + } else { + this.tail = null } + this.length-- + return res +} - get origin() { - return usm.serializeURLOrigin(this._url); +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this) + walker = walker.next } +} - get protocol() { - return this._url.scheme + ":"; +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this) + walker = walker.prev } +} - set protocol(v) { - usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next + } + if (i === n && walker !== null) { + return walker.value } +} - get username() { - return this._url.username; +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev } + if (i === n && walker !== null) { + return walker.value + } +} - set username(v) { - if (usm.cannotHaveAUsernamePasswordPort(this._url)) { - return; - } +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.next + } + return res +} - usm.setTheUsername(this._url, v); +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.prev } + return res +} - get password() { - return this._url.password; +Yallist.prototype.reduce = function (fn, initial) { + var acc + var walker = this.head + if (arguments.length > 1) { + acc = initial + } else if (this.head) { + walker = this.head.next + acc = this.head.value + } else { + throw new TypeError('Reduce of empty list with no initial value') } - set password(v) { - if (usm.cannotHaveAUsernamePasswordPort(this._url)) { - return; - } + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i) + walker = walker.next + } - usm.setThePassword(this._url, v); + return acc +} + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc + var walker = this.tail + if (arguments.length > 1) { + acc = initial + } else if (this.tail) { + walker = this.tail.prev + acc = this.tail.value + } else { + throw new TypeError('Reduce of empty list with no initial value') } - get host() { - const url = this._url; + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i) + walker = walker.prev + } - if (url.host === null) { - return ""; - } + return acc +} - if (url.port === null) { - return usm.serializeHost(url.host); - } +Yallist.prototype.toArray = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value + walker = walker.next + } + return arr +} - return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value + walker = walker.prev } + return arr +} - set host(v) { - if (this._url.cannotBeABaseURL) { - return; - } +Yallist.prototype.slice = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value) + } + return ret +} - usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value) } + return ret +} - get hostname() { - if (this._url.host === null) { - return ""; - } +Yallist.prototype.splice = function (start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1 + } + if (start < 0) { + start = this.length + start; + } - return usm.serializeHost(this._url.host); + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next } - set hostname(v) { - if (this._url.cannotBeABaseURL) { - return; - } + var ret = [] + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value) + walker = this.removeNode(walker) + } + if (walker === null) { + walker = this.tail + } - usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev } - get port() { - if (this._url.port === null) { - return ""; - } + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]) + } + return ret; +} - return usm.serializeInteger(this._url.port); +Yallist.prototype.reverse = function () { + var head = this.head + var tail = this.tail + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev + walker.prev = walker.next + walker.next = p } + this.head = tail + this.tail = head + return this +} - set port(v) { - if (usm.cannotHaveAUsernamePasswordPort(this._url)) { - return; - } +function insert (self, node, value) { + var inserted = node === self.head ? + new Node(value, null, node, self) : + new Node(value, node, node.next, self) - if (v === "") { - this._url.port = null; - } else { - usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); - } + if (inserted.next === null) { + self.tail = inserted + } + if (inserted.prev === null) { + self.head = inserted } - get pathname() { - if (this._url.cannotBeABaseURL) { - return this._url.path[0]; - } + self.length++ - if (this._url.path.length === 0) { - return ""; - } + return inserted +} - return "/" + this._url.path.join("/"); +function push (self, item) { + self.tail = new Node(item, self.tail, null, self) + if (!self.head) { + self.head = self.tail } + self.length++ +} - set pathname(v) { - if (this._url.cannotBeABaseURL) { - return; - } +function unshift (self, item) { + self.head = new Node(item, null, self.head, self) + if (!self.tail) { + self.tail = self.head + } + self.length++ +} - this._url.path = []; - usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) } - get search() { - if (this._url.query === null || this._url.query === "") { - return ""; - } + this.list = list + this.value = value - return "?" + this._url.query; + if (prev) { + prev.next = this + this.prev = prev + } else { + this.prev = null } - set search(v) { - // TODO: query stuff + if (next) { + next.prev = this + this.next = next + } else { + this.next = null + } +} - const url = this._url; +try { + // add if support for Symbol.iterator is present + __nccwpck_require__(4091)(Yallist) +} catch (er) {} - if (v === "") { - url.query = null; - return; - } - const input = v[0] === "?" ? v.substring(1) : v; - url.query = ""; - usm.basicURLParse(input, { url, stateOverride: "query" }); - } +/***/ }), - get hash() { - if (this._url.fragment === null || this._url.fragment === "") { - return ""; - } +/***/ 22877: +/***/ ((module) => { - return "#" + this._url.fragment; - } +module.exports = eval("require")("encoding"); - set hash(v) { - if (v === "") { - this._url.fragment = null; - return; - } - const input = v[0] === "#" ? v.substring(1) : v; - this._url.fragment = ""; - usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); - } +/***/ }), - toJSON() { - return this.href; - } -}; +/***/ 24807: +/***/ ((module) => { + +module.exports = eval("require")("smee-client"); /***/ }), -/***/ 63394: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 39491: +/***/ ((module) => { "use strict"; +module.exports = require("assert"); +/***/ }), -const conversions = __nccwpck_require__(54886); -const utils = __nccwpck_require__(83185); -const Impl = __nccwpck_require__(97537); +/***/ 14300: +/***/ ((module) => { -const impl = utils.implSymbol; +"use strict"; +module.exports = require("buffer"); -function URL(url) { - if (!this || this[impl] || !(this instanceof URL)) { - throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); - } - if (arguments.length < 1) { - throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); - } - const args = []; - for (let i = 0; i < arguments.length && i < 2; ++i) { - args[i] = arguments[i]; - } - args[0] = conversions["USVString"](args[0]); - if (args[1] !== undefined) { - args[1] = conversions["USVString"](args[1]); - } +/***/ }), - module.exports.setup(this, args); -} +/***/ 32081: +/***/ ((module) => { -URL.prototype.toJSON = function toJSON() { - if (!this || !module.exports.is(this)) { - throw new TypeError("Illegal invocation"); - } - const args = []; - for (let i = 0; i < arguments.length && i < 0; ++i) { - args[i] = arguments[i]; - } - return this[impl].toJSON.apply(this[impl], args); -}; -Object.defineProperty(URL.prototype, "href", { - get() { - return this[impl].href; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].href = V; - }, - enumerable: true, - configurable: true -}); +"use strict"; +module.exports = require("child_process"); -URL.prototype.toString = function () { - if (!this || !module.exports.is(this)) { - throw new TypeError("Illegal invocation"); - } - return this.href; -}; +/***/ }), -Object.defineProperty(URL.prototype, "origin", { - get() { - return this[impl].origin; - }, - enumerable: true, - configurable: true -}); +/***/ 22057: +/***/ ((module) => { -Object.defineProperty(URL.prototype, "protocol", { - get() { - return this[impl].protocol; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].protocol = V; - }, - enumerable: true, - configurable: true -}); +"use strict"; +module.exports = require("constants"); -Object.defineProperty(URL.prototype, "username", { - get() { - return this[impl].username; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].username = V; - }, - enumerable: true, - configurable: true -}); +/***/ }), -Object.defineProperty(URL.prototype, "password", { - get() { - return this[impl].password; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].password = V; - }, - enumerable: true, - configurable: true -}); +/***/ 6113: +/***/ ((module) => { -Object.defineProperty(URL.prototype, "host", { - get() { - return this[impl].host; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].host = V; - }, - enumerable: true, - configurable: true -}); +"use strict"; +module.exports = require("crypto"); -Object.defineProperty(URL.prototype, "hostname", { - get() { - return this[impl].hostname; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].hostname = V; - }, - enumerable: true, - configurable: true -}); +/***/ }), -Object.defineProperty(URL.prototype, "port", { - get() { - return this[impl].port; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].port = V; - }, - enumerable: true, - configurable: true -}); +/***/ 9523: +/***/ ((module) => { -Object.defineProperty(URL.prototype, "pathname", { - get() { - return this[impl].pathname; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].pathname = V; - }, - enumerable: true, - configurable: true -}); +"use strict"; +module.exports = require("dns"); -Object.defineProperty(URL.prototype, "search", { - get() { - return this[impl].search; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].search = V; - }, - enumerable: true, - configurable: true -}); +/***/ }), -Object.defineProperty(URL.prototype, "hash", { - get() { - return this[impl].hash; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].hash = V; - }, - enumerable: true, - configurable: true -}); +/***/ 13639: +/***/ ((module) => { +"use strict"; +module.exports = require("domain"); -module.exports = { - is(obj) { - return !!obj && obj[impl] instanceof Impl.implementation; - }, - create(constructorArgs, privateData) { - let obj = Object.create(URL.prototype); - this.setup(obj, constructorArgs, privateData); - return obj; - }, - setup(obj, constructorArgs, privateData) { - if (!privateData) privateData = {}; - privateData.wrapper = obj; +/***/ }), - obj[impl] = new Impl.implementation(constructorArgs, privateData); - obj[impl][utils.wrapperSymbol] = obj; - }, - interface: URL, - expose: { - Window: { URL: URL }, - Worker: { URL: URL } - } -}; +/***/ 82361: +/***/ ((module) => { + +"use strict"; +module.exports = require("events"); + +/***/ }), + +/***/ 57147: +/***/ ((module) => { + +"use strict"; +module.exports = require("fs"); + +/***/ }), + +/***/ 13685: +/***/ ((module) => { + +"use strict"; +module.exports = require("http"); + +/***/ }), + +/***/ 95687: +/***/ ((module) => { + +"use strict"; +module.exports = require("https"); + +/***/ }), + +/***/ 98188: +/***/ ((module) => { + +"use strict"; +module.exports = require("module"); + +/***/ }), + +/***/ 41808: +/***/ ((module) => { + +"use strict"; +module.exports = require("net"); + +/***/ }), + +/***/ 22037: +/***/ ((module) => { + +"use strict"; +module.exports = require("os"); + +/***/ }), +/***/ 71017: +/***/ ((module) => { +"use strict"; +module.exports = require("path"); /***/ }), -/***/ 28665: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 85477: +/***/ ((module) => { "use strict"; +module.exports = require("punycode"); +/***/ }), -exports.URL = __nccwpck_require__(63394)["interface"]; -exports.serializeURL = __nccwpck_require__(2158).serializeURL; -exports.serializeURLOrigin = __nccwpck_require__(2158).serializeURLOrigin; -exports.basicURLParse = __nccwpck_require__(2158).basicURLParse; -exports.setTheUsername = __nccwpck_require__(2158).setTheUsername; -exports.setThePassword = __nccwpck_require__(2158).setThePassword; -exports.serializeHost = __nccwpck_require__(2158).serializeHost; -exports.serializeInteger = __nccwpck_require__(2158).serializeInteger; -exports.parseURL = __nccwpck_require__(2158).parseURL; +/***/ 63477: +/***/ ((module) => { +"use strict"; +module.exports = require("querystring"); /***/ }), -/***/ 2158: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 12781: +/***/ ((module) => { "use strict"; +module.exports = require("stream"); -const punycode = __nccwpck_require__(85477); -const tr46 = __nccwpck_require__(84256); +/***/ }), -const specialSchemes = { - ftp: 21, - file: null, - gopher: 70, - http: 80, - https: 443, - ws: 80, - wss: 443 -}; +/***/ 71576: +/***/ ((module) => { -const failure = Symbol("failure"); +"use strict"; +module.exports = require("string_decoder"); -function countSymbols(str) { - return punycode.ucs2.decode(str).length; -} +/***/ }), -function at(input, idx) { - const c = input[idx]; - return isNaN(c) ? undefined : String.fromCodePoint(c); -} +/***/ 24404: +/***/ ((module) => { -function isASCIIDigit(c) { - return c >= 0x30 && c <= 0x39; -} +"use strict"; +module.exports = require("tls"); -function isASCIIAlpha(c) { - return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); -} +/***/ }), -function isASCIIAlphanumeric(c) { - return isASCIIAlpha(c) || isASCIIDigit(c); -} +/***/ 76224: +/***/ ((module) => { -function isASCIIHex(c) { - return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); -} +"use strict"; +module.exports = require("tty"); -function isSingleDot(buffer) { - return buffer === "." || buffer.toLowerCase() === "%2e"; -} +/***/ }), -function isDoubleDot(buffer) { - buffer = buffer.toLowerCase(); - return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; -} +/***/ 57310: +/***/ ((module) => { -function isWindowsDriveLetterCodePoints(cp1, cp2) { - return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); -} +"use strict"; +module.exports = require("url"); -function isWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); -} +/***/ }), -function isNormalizedWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; -} +/***/ 73837: +/***/ ((module) => { -function containsForbiddenHostCodePoint(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; -} +"use strict"; +module.exports = require("util"); -function containsForbiddenHostCodePointExcludingPercent(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; -} +/***/ }), -function isSpecialScheme(scheme) { - return specialSchemes[scheme] !== undefined; -} +/***/ 26144: +/***/ ((module) => { -function isSpecial(url) { - return isSpecialScheme(url.scheme); -} +"use strict"; +module.exports = require("vm"); -function defaultPort(scheme) { - return specialSchemes[scheme]; -} +/***/ }), -function percentEncode(c) { - let hex = c.toString(16).toUpperCase(); - if (hex.length === 1) { - hex = "0" + hex; - } +/***/ 71267: +/***/ ((module) => { - return "%" + hex; -} +"use strict"; +module.exports = require("worker_threads"); -function utf8PercentEncode(c) { - const buf = new Buffer(c); +/***/ }), - let str = ""; +/***/ 59796: +/***/ ((module) => { - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); - } +"use strict"; +module.exports = require("zlib"); - return str; -} +/***/ }), -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } +/***/ 24566: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const { getConfig } = __nccwpck_require__(35378) +const { isTriggerableReference } = __nccwpck_require__(49) +const { + findReleases, + generateReleaseInfo, + createRelease, + updateRelease, +} = __nccwpck_require__(96402) +const { findCommitsWithAssociatedPullRequests } = __nccwpck_require__(47245) +const { sortPullRequests } = __nccwpck_require__(11940) +const { log } = __nccwpck_require__(71911) +const core = __nccwpck_require__(42186) +const { runnerIsActions } = __nccwpck_require__(98281) +const ignore = __nccwpck_require__(91230) + +module.exports = (app, { getRouter }) => { + if (!runnerIsActions() && typeof getRouter === 'function') { + getRouter().get('/healthz', (request, response) => { + response.status(200).json({ status: 'pass' }) + }) } - return new Buffer(output).toString(); -} -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; -} + app.on( + [ + 'pull_request.opened', + 'pull_request.reopened', + 'pull_request.synchronize', + 'pull_request.edited', + 'pull_request_target.opened', + 'pull_request_target.reopened', + 'pull_request_target.synchronize', + 'pull_request_target.edited', + ], + async (context) => { + const { disableAutolabeler } = getInput() -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); -} + const config = await getConfig({ + context, + configName: core.getInput('config-name'), + }) -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} + if (config === null || disableAutolabeler) return -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); + let issue = { + ...context.issue({ pull_number: context.payload.pull_request.number }), + } + const changedFiles = await context.octokit.paginate( + context.octokit.pulls.listFiles.endpoint.merge(issue), + (response) => response.data.map((file) => file.filename) + ) + const labels = new Set() - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); - } + for (const autolabel of config['autolabeler']) { + let found = false + // check modified files + if (!found && autolabel.files.length > 0) { + const matcher = ignore().add(autolabel.files) + if (changedFiles.some((file) => matcher.ignores(file))) { + labels.add(autolabel.label) + found = true + log({ + context, + message: `Found label for files: '${autolabel.label}'`, + }) + } + } + // check branch names + if (!found && autolabel.branch.length > 0) { + for (const matcher of autolabel.branch) { + if (matcher.test(context.payload.pull_request.head.ref)) { + labels.add(autolabel.label) + found = true + log({ + context, + message: `Found label for branch: '${autolabel.label}'`, + }) + break + } + } + } + // check pr title + if (!found && autolabel.title.length > 0) { + for (const matcher of autolabel.title) { + if (matcher.test(context.payload.pull_request.title)) { + labels.add(autolabel.label) + found = true + log({ + context, + message: `Found label for title: '${autolabel.label}'`, + }) + break + } + } + } + // check pr body + if ( + !found && + context.payload.pull_request.body != null && + autolabel.body.length > 0 + ) { + for (const matcher of autolabel.body) { + if (matcher.test(context.payload.pull_request.body)) { + labels.add(autolabel.label) + found = true + log({ + context, + message: `Found label for body: '${autolabel.label}'`, + }) + break + } + } + } + } - return cStr; -} + const labelsToAdd = [...labels] + if (labelsToAdd.length > 0) { + let labelIssue = { + ...context.issue({ + issue_number: context.payload.pull_request.number, + labels: labelsToAdd, + }), + } + await context.octokit.issues.addLabels(labelIssue) + if (runnerIsActions()) { + core.setOutput('number', context.payload.pull_request.number) + core.setOutput('labels', labelsToAdd.join(',')) + } + return + } + } + ) -function parseIPv4Number(input) { - let R = 10; + const drafter = async (context) => { + const { + shouldDraft, + configName, + version, + tag, + name, + disableReleaser, + commitish, + } = getInput() - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } + const config = await getConfig({ + context, + configName, + }) - if (input === "") { - return 0; - } + const { isPreRelease, latest } = getInput({ config }) - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { - return failure; - } + if (config === null || disableReleaser) return - return parseInt(input, R); -} + // GitHub Actions merge payloads slightly differ, in that their ref points + // to the PR branch instead of refs/heads/master + const ref = process.env['GITHUB_REF'] || context.payload.ref -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); + if (!isTriggerableReference({ ref, context, config })) { + return } - } - if (parts.length > 4) { - return input; - } + const targetCommitish = commitish || config['commitish'] || ref + const { + 'filter-by-commitish': filterByCommitish, + 'include-pre-releases': includePreReleases, + 'tag-prefix': tagPrefix, + } = config - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; + // override header and footer when passed as input + const header = core.getInput('header') + const footer = core.getInput('footer') + if (header) { + config['header'] = header } - const n = parseIPv4Number(part); - if (n === failure) { - return input; + if (footer) { + config['footer'] = footer } - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; - } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { - return failure; - } + const { draftRelease, lastRelease } = await findReleases({ + context, + targetCommitish, + filterByCommitish, + includePreReleases, + tagPrefix, + }) - let ipv4 = numbers.pop(); - let counter = 0; + const { commits, pullRequests: mergedPullRequests } = + await findCommitsWithAssociatedPullRequests({ + context, + targetCommitish, + lastRelease, + config, + }) - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; - } + const sortedMergedPullRequests = sortPullRequests( + mergedPullRequests, + config['sort-by'], + config['sort-direction'] + ) - return ipv4; -} + const releaseInfo = generateReleaseInfo({ + context, + commits, + config, + lastRelease, + mergedPullRequests: sortedMergedPullRequests, + version, + tag, + name, + isPreRelease, + latest, + shouldDraft, + targetCommitish, + }) -function serializeIPv4(address) { - let output = ""; - let n = address; + let createOrUpdateReleaseResponse + if (!draftRelease) { + log({ context, message: 'Creating new release' }) + createOrUpdateReleaseResponse = await createRelease({ + context, + releaseInfo, + config, + }) + } else { + log({ context, message: 'Updating existing release' }) + createOrUpdateReleaseResponse = await updateRelease({ + context, + draftRelease, + releaseInfo, + config, + }) + } - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; + if (runnerIsActions()) { + setActionOutput(createOrUpdateReleaseResponse, releaseInfo) } - n = Math.floor(n / 256); } - return output; + if (runnerIsActions()) { + app.onAny(drafter) + } else { + app.on('push', drafter) + } } -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; - - input = punycode.ucs2.decode(input); - - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; +function getInput({ config } = {}) { + // Returns all the inputs that doesn't need a merge with the config file + if (!config) { + return { + shouldDraft: core.getInput('publish').toLowerCase() !== 'true', + configName: core.getInput('config-name'), + version: core.getInput('version') || undefined, + tag: core.getInput('tag') || undefined, + name: core.getInput('name') || undefined, + disableReleaser: + core.getInput('disable-releaser').toLowerCase() === 'true', + disableAutolabeler: + core.getInput('disable-autolabeler').toLowerCase() === 'true', + commitish: core.getInput('commitish') || undefined, } - - pointer += 2; - ++pieceIndex; - compress = pieceIndex; } - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } + // Merges the config file with the input + // the input takes precedence, because it's more easy to change at runtime + const preRelease = core.getInput('prerelease').toLowerCase() - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; - } + const isPreRelease = + preRelease === 'true' || (!preRelease && config.prerelease) - let value = 0; - let length = 0; + const latestInput = core.getInput('latest').toLowerCase() - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } + const latest = isPreRelease + ? 'false' + : (!latestInput && config.latest) || latestInput || undefined - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } + return { + isPreRelease, + latest, + } +} - pointer -= length; +function setActionOutput( + releaseResponse, + { body, resolvedVersion, majorVersion, minorVersion, patchVersion } +) { + const { + data: { + id: releaseId, + html_url: htmlUrl, + upload_url: uploadUrl, + tag_name: tagName, + name: name, + }, + } = releaseResponse + if (releaseId && Number.isInteger(releaseId)) + core.setOutput('id', releaseId.toString()) + if (htmlUrl) core.setOutput('html_url', htmlUrl) + if (uploadUrl) core.setOutput('upload_url', uploadUrl) + if (tagName) core.setOutput('tag_name', tagName) + if (name) core.setOutput('name', name) + if (resolvedVersion) core.setOutput('resolved_version', resolvedVersion) + if (majorVersion) core.setOutput('major_version', majorVersion) + if (minorVersion) core.setOutput('minor_version', minorVersion) + if (patchVersion) core.setOutput('patch_version', patchVersion) + core.setOutput('body', body) +} - if (pieceIndex > 6) { - return failure; - } - let numbersSeen = 0; +/***/ }), - while (input[pointer] !== undefined) { - let ipv4Piece = null; +/***/ 47245: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } +const _ = __nccwpck_require__(90250) +const { log } = __nccwpck_require__(71911) +const { paginate } = __nccwpck_require__(46418) - if (!isASCIIDigit(input[pointer])) { - return failure; +const findCommitsWithPathChangesQuery = /* GraphQL */ ` + query findCommitsWithPathChangesQuery( + $name: String! + $owner: String! + $targetCommitish: String! + $since: GitTimestamp + $after: String + $path: String + ) { + repository(name: $name, owner: $owner) { + object(expression: $targetCommitish) { + ... on Commit { + history(path: $path, since: $since, after: $after) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + } + } } + } + } + } +` - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; +const findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ ` + query findCommitsWithAssociatedPullRequests( + $name: String! + $owner: String! + $targetCommitish: String! + $withPullRequestBody: Boolean! + $withPullRequestURL: Boolean! + $since: GitTimestamp + $after: String + $withBaseRefName: Boolean! + $withHeadRefName: Boolean! + ) { + repository(name: $name, owner: $owner) { + object(expression: $targetCommitish) { + ... on Commit { + history(first: 100, since: $since, after: $after) { + totalCount + pageInfo { + hasNextPage + endCursor + } + nodes { + id + committedDate + message + author { + name + user { + login + } + } + associatedPullRequests(first: 5) { + nodes { + title + number + url @include(if: $withPullRequestURL) + body @include(if: $withPullRequestBody) + author { + login + } + baseRepository { + nameWithOwner + } + mergedAt + isCrossRepository + labels(first: 100) { + nodes { + name + } + } + merged + baseRefName @include(if: $withBaseRefName) + headRefName @include(if: $withHeadRefName) + } + } + } } - ++pointer; } + } + } + } +` - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; - - ++numbersSeen; +const findCommitsWithAssociatedPullRequests = async ({ + context, + targetCommitish, + lastRelease, + config, +}) => { + const { owner, repo } = context.repo() + const variables = { + name: repo, + owner, + targetCommitish, + withPullRequestBody: config['change-template'].includes('$BODY'), + withPullRequestURL: config['change-template'].includes('$URL'), + withBaseRefName: config['change-template'].includes('$BASE_REF_NAME'), + withHeadRefName: config['change-template'].includes('$HEAD_REF_NAME'), + } + const includePaths = config['include-paths'] + const dataPath = ['repository', 'object', 'history'] + const repoNameWithOwner = `${owner}/${repo}` - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } + let data, + allCommits, + includedIds = {} - if (numbersSeen !== 4) { - return failure; - } + if (includePaths.length > 0) { + var anyChanges = false + for (const path of includePaths) { + const pathData = await paginate( + context.octokit.graphql, + findCommitsWithPathChangesQuery, + lastRelease + ? { ...variables, since: lastRelease.created_at, path } + : { ...variables, path }, + dataPath + ) + const commitsWithPathChanges = _.get(pathData, [...dataPath, 'nodes']) - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { - return failure; + includedIds[path] = includedIds[path] || new Set([]) + for (const { id } of commitsWithPathChanges) { + anyChanges = true + includedIds[path].add(id) } - } else if (input[pointer] !== undefined) { - return failure; } - address[pieceIndex] = value; - ++pieceIndex; + if (!anyChanges) { + // Short circuit to avoid blowing GraphQL budget + return { commits: [], pullRequests: [] } + } } - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; - } - } else if (compress === null && pieceIndex !== 8) { - return failure; + if (lastRelease) { + log({ + context, + message: `Fetching parent commits of ${targetCommitish} since ${lastRelease.created_at}`, + }) + + data = await paginate( + context.octokit.graphql, + findCommitsWithAssociatedPullRequestsQuery, + { ...variables, since: lastRelease.created_at }, + dataPath + ) + // GraphQL call is inclusive of commits from the specified dates. This means the final + // commit from the last tag is included, so we remove this here. + allCommits = _.get(data, [...dataPath, 'nodes']).filter( + (commit) => commit.committedDate != lastRelease.created_at + ) + } else { + log({ context, message: `Fetching parent commits of ${targetCommitish}` }) + + data = await paginate( + context.octokit.graphql, + findCommitsWithAssociatedPullRequestsQuery, + variables, + dataPath + ) + allCommits = _.get(data, [...dataPath, 'nodes']) } - return address; + const commits = + includePaths.length > 0 + ? allCommits.filter((commit) => + includePaths.some((path) => includedIds[path].has(commit.id)) + ) + : allCommits + + const pullRequests = _.uniqBy( + commits.flatMap((commit) => commit.associatedPullRequests.nodes), + 'number' + ).filter( + (pr) => pr.baseRepository.nameWithOwner === repoNameWithOwner && pr.merged + ) + + return { commits, pullRequests } } -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; +exports.findCommitsWithAssociatedPullRequestsQuery = + findCommitsWithAssociatedPullRequestsQuery - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } +exports.findCommitsWithPathChangesQuery = findCommitsWithPathChangesQuery - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; - } +exports.findCommitsWithAssociatedPullRequests = + findCommitsWithAssociatedPullRequests - output += address[pieceIndex].toString(16); - if (pieceIndex !== 7) { - output += ":"; +/***/ }), + +/***/ 35378: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +const core = __nccwpck_require__(42186) +const Table = __nccwpck_require__(2101) +const { validateSchema } = __nccwpck_require__(72118) +const { log } = __nccwpck_require__(71911) +const { runnerIsActions } = __nccwpck_require__(98281) + +const DEFAULT_CONFIG_NAME = 'release-drafter.yml' + +async function getConfig({ context, configName }) { + try { + const repoConfig = await context.config( + configName || DEFAULT_CONFIG_NAME, + null + ) + if (repoConfig == null) { + const name = configName || DEFAULT_CONFIG_NAME + // noinspection ExceptionCaughtLocallyJS + throw new Error( + `Configuration file .github/${name} is not found. The configuration file must reside in your default branch.` + ) } - } - return output; -} + const config = validateSchema(context, repoConfig) -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; + return config + } catch (error) { + log({ context, error, message: 'Invalid config file' }) + + if (error.isJoi) { + log({ + context, + message: + 'Config validation errors, please fix the following issues in ' + + (configName || DEFAULT_CONFIG_NAME) + + ':\n' + + joiValidationErrorsAsTable(error), + }) } - return parseIPv6(input.substring(1, input.length - 1)); + if (runnerIsActions()) { + core.setFailed('Invalid config file') + } + return null } +} - if (!isSpecialArg) { - return parseOpaqueHost(input); +function joiValidationErrorsAsTable(error) { + const table = new Table({ head: ['Property', 'Error'] }) + for (const { path, message } of error.details) { + const prettyPath = path + .map((pathPart) => + Number.isInteger(pathPart) ? `[${pathPart}]` : pathPart + ) + .join('.') + table.push([prettyPath, message]) } + return table.toString() +} - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } +exports.getConfig = getConfig - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; - } +/***/ }), - return asciiDomain; -} +/***/ 85869: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } +const { SORT_BY, SORT_DIRECTIONS } = __nccwpck_require__(11940) - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); - } - return output; -} +const DEFAULT_CONFIG = Object.freeze({ + 'name-template': '', + 'tag-template': '', + 'tag-prefix': '', + 'change-template': `* $TITLE (#$NUMBER) @$AUTHOR`, + 'change-title-escapes': '', + 'no-changes-template': `* No changes`, + 'version-template': `$MAJOR.$MINOR.$PATCH`, + 'version-resolver': { + major: { labels: [] }, + minor: { labels: [] }, + patch: { labels: [] }, + default: 'patch', + }, + categories: [], + 'exclude-labels': [], + 'include-labels': [], + 'include-paths': [], + 'exclude-contributors': [], + 'no-contributors-template': 'No contributors', + replacers: [], + autolabeler: [], + 'sort-by': SORT_BY.mergedAt, + 'sort-direction': SORT_DIRECTIONS.descending, + prerelease: false, + latest: 'true', + 'filter-by-commitish': false, + 'include-pre-releases': false, + commitish: '', + 'category-template': `## $TITLE`, + header: '', + footer: '', +}) -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; +exports.DEFAULT_CONFIG = DEFAULT_CONFIG - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; - } - ++currLen; - } - } +/***/ }), - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } +/***/ 71911: +/***/ ((__unused_webpack_module, exports) => { - return { - idx: maxIdx, - len: maxLen - }; +const log = ({ context, message, error }) => { + const repo = context.payload.repository + const prefix = repo ? `${repo.full_name}: ` : '' + const logString = `${prefix}${message}` + if (error) { + context.log.warn(error, logString) + } else { + context.log.info(logString) + } } -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } +exports.log = log - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; - } - return host; -} +/***/ }), -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} +/***/ 46418: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} +const _ = __nccwpck_require__(90250) + +/** + * Utility function to paginate a GraphQL function using Relay-style cursor pagination. + * + * @param {Function} queryFn - function used to query the GraphQL API + * @param {string} query - GraphQL query, must include `nodes` and `pageInfo` fields for the field that will be paginated + * @param {Object} variables + * @param {string[]} paginatePath - path to field to paginate + */ +async function paginate(queryFunction, query, variables, paginatePath) { + const nodesPath = [...paginatePath, 'nodes'] + const pageInfoPath = [...paginatePath, 'pageInfo'] + const endCursorPath = [...pageInfoPath, 'endCursor'] + const hasNextPagePath = [...pageInfoPath, 'hasNextPage'] + const hasNextPage = (data) => _.get(data, hasNextPagePath) + + let data = await queryFunction(query, variables) -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; + if (!_.has(data, nodesPath)) { + throw new Error( + "Data doesn't contain `nodes` field. Make sure the `paginatePath` is set to the field you wish to paginate and that the query includes the `nodes` field." + ) } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; + + if ( + !_.has(data, pageInfoPath) || + !_.has(data, endCursorPath) || + !_.has(data, hasNextPagePath) + ) { + throw new Error( + "Data doesn't contain `pageInfo` field with `endCursor` and `hasNextPage` fields. Make sure the `paginatePath` is set to the field you wish to paginate and that the query includes the `pageInfo` field." + ) } - path.pop(); -} + while (hasNextPage(data)) { + const newData = await queryFunction(query, { + ...variables, + after: _.get(data, [...pageInfoPath, 'endCursor']), + }) + const newNodes = _.get(newData, nodesPath) + const newPageInfo = _.get(newData, pageInfoPath) -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} + _.set(data, pageInfoPath, newPageInfo) + _.update(data, nodesPath, (d) => [...d, ...newNodes]) + } -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; + return data } -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} +exports.paginate = paginate -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, +/***/ }), - cannotBeABaseURL: false - }; +/***/ 96402: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - const res = trimControlChars(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - } +const compareVersions = __nccwpck_require__(89296) +const regexEscape = __nccwpck_require__(98691) - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; +const { getVersionInfo } = __nccwpck_require__(49914) +const { template } = __nccwpck_require__(47282) +const { log } = __nccwpck_require__(71911) + +const sortReleases = (releases, tagPrefix) => { + // For semver, we find the greatest release number + // For non-semver, we use the most recently merged + try { + const tagPrefixRexExp = new RegExp(`^${regexEscape(tagPrefix)}`) + return releases.sort((r1, r2) => + compareVersions( + r1.tag_name.replace(tagPrefixRexExp, ''), + r2.tag_name.replace(tagPrefixRexExp, '') + ) + ) + } catch { + return releases.sort( + (r1, r2) => new Date(r1.created_at) - new Date(r2.created_at) + ) } - this.input = res; +} - this.state = stateOverride || "scheme start"; +// GitHub API currently returns a 500 HTTP response if you attempt to fetch over 1000 releases. +const RELEASE_COUNT_LIMIT = 1000 - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; +const findReleases = async ({ + context, + targetCommitish, + filterByCommitish, + includePreReleases, + tagPrefix, +}) => { + let releaseCount = 0 + let releases = await context.octokit.paginate( + context.octokit.repos.listReleases.endpoint.merge( + context.repo({ + per_page: 100, + }) + ), + (response, done) => { + releaseCount += response.data.length + if (releaseCount >= RELEASE_COUNT_LIMIT) { + done() + } + return response.data + } + ) - this.input = punycode.ucs2.decode(this.input); + log({ context, message: `Found ${releases.length} releases` }) - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + // `refs/heads/branch` and `branch` are the same thing in this context + const headRefRegex = /^refs\/heads\// + const targetCommitishName = targetCommitish.replace(headRefRegex, '') + const commitishFilteredReleases = filterByCommitish + ? releases.filter( + (r) => + targetCommitishName === r.target_commitish.replace(headRefRegex, '') + ) + : releases + const filteredReleases = tagPrefix + ? commitishFilteredReleases.filter((r) => r.tag_name.startsWith(tagPrefix)) + : commitishFilteredReleases + const sortedSelectedReleases = sortReleases( + filteredReleases.filter( + (r) => !r.draft && (!r.prerelease || includePreReleases) + ), + tagPrefix + ) + const draftRelease = filteredReleases.find((r) => r.draft) + const lastRelease = sortedSelectedReleases[sortedSelectedReleases.length - 1] - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; - } + if (draftRelease) { + log({ context, message: `Draft release: ${draftRelease.tag_name}` }) + } else { + log({ context, message: `No draft release found` }) } -} -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; + if (lastRelease) { + log({ context, message: `Last release: ${lastRelease.tag_name}` }) } else { - this.parseError = true; - return failure; + log({ context, message: `No last release found` }) } - return true; -}; - -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } + return { draftRelease, lastRelease } +} - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } +const contributorsSentence = ({ commits, pullRequests, config }) => { + const { 'exclude-contributors': excludeContributors } = config - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } + const contributors = new Set() - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; + for (const commit of commits) { + if (commit.author.user) { + if (!excludeContributors.includes(commit.author.user.login)) { + contributors.add(`@${commit.author.user.login}`) } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; + contributors.add(commit.author.name) } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; } - return true; -}; - -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; + for (const pullRequest of pullRequests) { + if ( + pullRequest.author && + !excludeContributors.includes(pullRequest.author.login) + ) { + contributors.add(`@${pullRequest.author.login}`) + } } - return true; -}; - -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; + const sortedContributors = [...contributors].sort() + if (sortedContributors.length > 1) { + return ( + sortedContributors.slice(0, -1).join(', ') + + ' and ' + + sortedContributors.slice(-1) + ) + } else if (sortedContributors.length === 1) { + return sortedContributors[0] } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; + return config['no-contributors-template'] } +} - return true; -}; - -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; +const getFilterExcludedPullRequests = (excludeLabels) => { + return (pullRequest) => { + const labels = pullRequest.labels.nodes + if (labels.some((label) => excludeLabels.includes(label.name))) { + return false + } + return true } +} - return true; -}; +const getFilterIncludedPullRequests = (includeLabels) => { + return (pullRequest) => { + const labels = pullRequest.labels.nodes + if ( + includeLabels.length === 0 || + labels.some((label) => includeLabels.includes(label.name)) + ) { + return true + } + return false + } +} -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); +const categorizePullRequests = (pullRequests, config) => { + const { + 'exclude-labels': excludeLabels, + 'include-labels': includeLabels, + categories, + } = config + const allCategoryLabels = new Set( + categories.flatMap((category) => category.labels) + ) + const uncategorizedPullRequests = [] + const categorizedPullRequests = [...categories].map((category) => { + return { ...category, pullRequests: [] } + }) - this.state = "path"; - --this.pointer; - } + const uncategorizedCategoryIndex = categories.findIndex( + (category) => category.labels.length === 0 + ) - return true; -}; + const filterUncategorizedPullRequests = (pullRequest) => { + const labels = pullRequest.labels.nodes -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; + if ( + labels.length === 0 || + !labels.some((label) => allCategoryLabels.has(label.name)) + ) { + if (uncategorizedCategoryIndex === -1) { + uncategorizedPullRequests.push(pullRequest) + } else { + categorizedPullRequests[uncategorizedCategoryIndex].pullRequests.push( + pullRequest + ) + } + return false } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; + return true } - return true; -}; + // we only want pull requests that have yet to be categorized + const filteredPullRequests = pullRequests + .filter(getFilterExcludedPullRequests(excludeLabels)) + .filter(getFilterIncludedPullRequests(includeLabels)) + .filter((pullRequest) => filterUncategorizedPullRequests(pullRequest)) -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; + for (const category of categorizedPullRequests) { + for (const pullRequest of filteredPullRequests) { + // lets categorize some pull request based on labels + // note that having the same label in multiple categories + // then it is intended to "duplicate" the pull request into each category + const labels = pullRequest.labels.nodes + if (labels.some((label) => category.labels.includes(label.name))) { + category.pullRequests.push(pullRequest) + } + } } - return true; -}; + return [uncategorizedPullRequests, categorizedPullRequests] +} -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; +const generateChangeLog = (mergedPullRequests, config) => { + if (mergedPullRequests.length === 0) { + return config['no-changes-template'] } - return true; -}; + const [uncategorizedPullRequests, categorizedPullRequests] = + categorizePullRequests(mergedPullRequests, config) -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; - } - this.atFlag = true; + const escapeTitle = (title) => + // If config['change-title-escapes'] contains backticks, then they will be escaped along with content contained inside backticks + // If not, the entire backtick block is matched so that it will become a markdown code block without escaping any of its content + title.replace( + new RegExp( + `[${regexEscape(config['change-title-escapes'])}]|\`.*?\``, + 'g' + ), + (match) => { + if (match.length > 1) return match + if (match == '@' || match == '#') return `${match}` + return `\\${match}` + } + ) - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); + const pullRequestToString = (pullRequests) => + pullRequests + .map((pullRequest) => + template(config['change-template'], { + $TITLE: escapeTitle(pullRequest.title), + $NUMBER: pullRequest.number, + $AUTHOR: pullRequest.author ? pullRequest.author.login : 'ghost', + $BODY: pullRequest.body, + $URL: pullRequest.url, + $BASE_REF_NAME: pullRequest.baseRefName, + $HEAD_REF_NAME: pullRequest.headRefName, + }) + ) + .join('\n') - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; - } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; - } - } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } + const changeLog = [] - return true; -}; + if (uncategorizedPullRequests.length > 0) { + changeLog.push(pullRequestToString(uncategorizedPullRequests), '\n\n') + } -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; + for (const [index, category] of categorizedPullRequests.entries()) { + if (category.pullRequests.length === 0) { + continue } - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } + // Add the category title to the changelog. + changeLog.push( + template(config['category-template'], { $TITLE: category.title }), + '\n\n' + ) - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } + // Define the pull requests into a single string. + const pullRequestString = pullRequestToString(category.pullRequests) - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } + // Determine the collapse status. + const shouldCollapse = + category['collapse-after'] !== 0 && + category.pullRequests.length > category['collapse-after'] - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; + // Add the pull requests to the changelog. + if (shouldCollapse) { + changeLog.push( + '
', + '\n', + `${category.pullRequests.length} changes`, + '\n\n', + pullRequestString, + '\n', + '
' + ) + } else { + changeLog.push(pullRequestString) } - this.buffer += cStr; + + if (index + 1 !== categorizedPullRequests.length) changeLog.push('\n\n') } - return true; -}; + return changeLog.join('').trim() +} -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; +const resolveVersionKeyIncrement = (mergedPullRequests, config) => { + const priorityMap = { + patch: 1, + minor: 2, + major: 3, } + const labelToKeyMap = Object.fromEntries( + Object.keys(priorityMap) + .flatMap((key) => [ + config['version-resolver'][key].labels.map((label) => [label, key]), + ]) + .flat() + ) + const keys = mergedPullRequests + .filter(getFilterExcludedPullRequests(config['exclude-labels'])) + .filter(getFilterIncludedPullRequests(config['include-labels'])) + .flatMap((pr) => pr.labels.nodes.map((node) => labelToKeyMap[node.name])) + .filter(Boolean) + const keyPriorities = keys.map((key) => priorityMap[key]) + const priority = Math.max(...keyPriorities) + const versionKey = Object.keys(priorityMap).find( + (key) => priorityMap[key] === priority + ) + return versionKey || config['version-resolver'].default +} - return true; -}; +const generateReleaseInfo = ({ + context, + commits, + config, + lastRelease, + mergedPullRequests, + version, + tag, + name, + isPreRelease, + latest, + shouldDraft, + targetCommitish, +}) => { + const { owner, repo } = context.repo() -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + let body = config['header'] + config.template + config['footer'] + body = template( + body, + { + $PREVIOUS_TAG: lastRelease ? lastRelease.tag_name : '', + $CHANGES: generateChangeLog(mergedPullRequests, config), + $CONTRIBUTORS: contributorsSentence({ + commits, + pullRequests: mergedPullRequests, + config, + }), + $OWNER: owner, + $REPOSITORY: repo, + }, + config.replacers + ) -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; + const versionInfo = getVersionInfo( + lastRelease, + config['version-template'], + // Use the first override parameter to identify + // a version, from the most accurate to the least + version || tag || name, + resolveVersionKeyIncrement(mergedPullRequests, config), + config['tag-prefix'] + ) - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } + if (versionInfo) { + body = template(body, versionInfo) + } - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; + if (tag === undefined) { + tag = versionInfo ? template(config['tag-template'] || '', versionInfo) : '' + } else if (versionInfo) { + tag = template(tag, versionInfo) } - return true; -}; + if (name === undefined) { + name = versionInfo + ? template(config['name-template'] || '', versionInfo) + : '' + } else if (versionInfo) { + name = template(name, versionInfo) + } -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } - } - this.state = "path"; - --this.pointer; + // Tags are not supported as `target_commitish` by Github API. + // GITHUB_REF or the ref from webhook start with `refs/tags/`, so we handle + // those here. If it doesn't but is still a tag - it must have been set + // explicitly by the user, so it's fair to just let the API respond with an error. + if (targetCommitish.startsWith('refs/tags/')) { + log({ + context, + message: `${targetCommitish} is not supported as release target, falling back to default branch`, + }) + targetCommitish = '' } - return true; -}; + let resolvedVersion = versionInfo.$RESOLVED_VERSION.version + let majorVersion = versionInfo.$RESOLVED_VERSION.$MAJOR + let minorVersion = versionInfo.$RESOLVED_VERSION.$MINOR + let patchVersion = versionInfo.$RESOLVED_VERSION.$PATCH -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; - } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - if (host === "localhost") { - host = ""; - } - this.url.host = host; + return { + name, + tag, + body, + targetCommitish, + prerelease: isPreRelease, + make_latest: latest, + draft: shouldDraft, + resolvedVersion, + majorVersion, + minorVersion, + patchVersion, + } +} - if (this.stateOverride) { - return false; - } +const createRelease = ({ context, releaseInfo }) => { + return context.octokit.repos.createRelease( + context.repo({ + target_commitish: releaseInfo.targetCommitish, + name: releaseInfo.name, + tag_name: releaseInfo.tag, + body: releaseInfo.body, + draft: releaseInfo.draft, + prerelease: releaseInfo.prerelease, + make_latest: releaseInfo.make_latest, + }) + ) +} - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } +const updateRelease = ({ context, draftRelease, releaseInfo }) => { + const updateReleaseParameters = updateDraftReleaseParameters({ + name: releaseInfo.name || draftRelease.name, + tag_name: releaseInfo.tag || draftRelease.tag_name, + target_commitish: releaseInfo.targetCommitish, + }) - return true; -}; + return context.octokit.repos.updateRelease( + context.repo({ + release_id: draftRelease.id, + body: releaseInfo.body, + draft: releaseInfo.draft, + prerelease: releaseInfo.prerelease, + make_latest: releaseInfo.make_latest, + ...updateReleaseParameters, + }) + ) +} -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; +function updateDraftReleaseParameters(parameters) { + const updateReleaseParameters = { ...parameters } - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } + // Let GitHub figure out `name` and `tag_name` if undefined + if (!updateReleaseParameters.name) { + delete updateReleaseParameters.name + } + if (!updateReleaseParameters.tag_name) { + delete updateReleaseParameters.tag_name } - return true; -}; + // Keep existing `target_commitish` if not overriden + // (sending `null` resets it to the default branch) + if (!updateReleaseParameters.target_commitish) { + delete updateReleaseParameters.target_commitish + } -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } + return updateReleaseParameters +} - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; - } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); - } - } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. +exports.findReleases = findReleases +exports.generateChangeLog = generateChangeLog +exports.generateReleaseInfo = generateReleaseInfo +exports.createRelease = createRelease +exports.updateRelease = updateRelease - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } +/***/ }), - return true; -}; +/***/ 72118: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } +const _ = __nccwpck_require__(90250) +const Joi = __nccwpck_require__(20918) +const { SORT_BY, SORT_DIRECTIONS } = __nccwpck_require__(11940) +const { DEFAULT_CONFIG } = __nccwpck_require__(85869) +const { + validateReplacers, + validateAutolabeler, + validateCategories, +} = __nccwpck_require__(47282) +const merge = __nccwpck_require__(56323) - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } +const schema = (context) => { + const defaultBranch = _.get( + context, + 'payload.repository.default_branch', + 'master' + ) + return Joi.object() + .keys({ + references: Joi.array().items(Joi.string()).default([defaultBranch]), - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } + 'change-template': Joi.string().default( + DEFAULT_CONFIG['change-template'] + ), - return true; -}; + 'change-title-escapes': Joi.string() + .allow('') + .default(DEFAULT_CONFIG['change-title-escapes']), -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } + 'no-changes-template': Joi.string().default( + DEFAULT_CONFIG['no-changes-template'] + ), - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } + 'version-template': Joi.string().default( + DEFAULT_CONFIG['version-template'] + ), + + 'name-template': Joi.string() + .allow('') + .default(DEFAULT_CONFIG['name-template']), + + 'tag-prefix': Joi.string() + .allow('') + .default(DEFAULT_CONFIG['tag-prefix']), + + 'tag-template': Joi.string() + .allow('') + .default(DEFAULT_CONFIG['tag-template']), + + 'exclude-labels': Joi.array() + .items(Joi.string()) + .default(DEFAULT_CONFIG['exclude-labels']), + + 'include-labels': Joi.array() + .items(Joi.string()) + .default(DEFAULT_CONFIG['include-labels']), - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } + 'include-paths': Joi.array() + .items(Joi.string()) + .default(DEFAULT_CONFIG['include-paths']), - this.buffer += cStr; - } + 'exclude-contributors': Joi.array() + .items(Joi.string()) + .default(DEFAULT_CONFIG['exclude-contributors']), - return true; -}; + 'no-contributors-template': Joi.string().default( + DEFAULT_CONFIG['no-contributors-template'] + ), -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } + 'sort-by': Joi.string() + .valid(SORT_BY.mergedAt, SORT_BY.title) + .default(DEFAULT_CONFIG['sort-by']), - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } + 'sort-direction': Joi.string() + .valid(SORT_DIRECTIONS.ascending, SORT_DIRECTIONS.descending) + .default(DEFAULT_CONFIG['sort-direction']), - return true; -}; + prerelease: Joi.boolean().default(DEFAULT_CONFIG.prerelease), -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; + latest: Joi.string() + .allow('', 'true', 'false', 'legacy') + .default(DEFAULT_CONFIG.latest), - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } + 'filter-by-commitish': Joi.boolean().default( + DEFAULT_CONFIG['filter-by-commitish'] + ), - output += serializeHost(url.host); + 'include-pre-releases': Joi.boolean().default( + DEFAULT_CONFIG['include-pre-releases'] + ), - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } + commitish: Joi.string().allow('').default(DEFAULT_CONFIG['commitish']), - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } + replacers: Joi.array() + .items( + Joi.object().keys({ + search: Joi.string() + .required() + .error( + new Error( + '"search" is required and must be a regexp or a string' + ) + ), + replace: Joi.string().allow('').required(), + }) + ) + .default(DEFAULT_CONFIG.replacers), - if (url.query !== null) { - output += "?" + url.query; - } + autolabeler: Joi.array() + .items( + Joi.object().keys({ + label: Joi.string().required(), + files: Joi.array().items(Joi.string()).single().default([]), + branch: Joi.array().items(Joi.string()).single().default([]), + title: Joi.array().items(Joi.string()).single().default([]), + body: Joi.array().items(Joi.string()).single().default([]), + }) + ) + .default(DEFAULT_CONFIG.autolabeler), - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } + categories: Joi.array() + .items( + Joi.object() + .keys({ + title: Joi.string().required(), + 'collapse-after': Joi.number().integer().min(0).default(0), + label: Joi.string(), + labels: Joi.array().items(Joi.string()).single().default([]), + }) + .rename('label', 'labels', { + ignoreUndefined: true, + override: true, + }) + ) + .default(DEFAULT_CONFIG.categories), - return output; -} + 'version-resolver': Joi.object() + .keys({ + major: Joi.object({ + labels: Joi.array() + .items(Joi.string()) + .single() + .default(DEFAULT_CONFIG['version-resolver']['major']['labels']), + }), + minor: Joi.object({ + labels: Joi.array() + .items(Joi.string()) + .single() + .default(DEFAULT_CONFIG['version-resolver']['minor']['labels']), + }), + patch: Joi.object({ + labels: Joi.array() + .items(Joi.string()) + .single() + .default(DEFAULT_CONFIG['version-resolver']['patch']['labels']), + }), + default: Joi.string() + .valid('major', 'minor', 'patch') + .default('patch'), + }) + .default(DEFAULT_CONFIG['version-resolver']), -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); + 'category-template': Joi.string() + .allow('') + .default(DEFAULT_CONFIG['category-template']), - if (tuple.port !== null) { - result += ":" + tuple.port; - } + header: Joi.string().allow('').default(DEFAULT_CONFIG.header), - return result; -} + template: Joi.string().required(), -module.exports.serializeURL = serializeURL; + footer: Joi.string().allow('').default(DEFAULT_CONFIG.footer), -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; + _extends: Joi.string(), + }) + .rename('branches', 'references', { + ignoreUndefined: true, + override: true, + }) +} -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } +const validateSchema = (context, repoConfig) => { + const mergedRepoConfig = merge.all([DEFAULT_CONFIG, repoConfig]) + const { error, value: config } = schema(context).validate(mergedRepoConfig, { + abortEarly: false, + allowUnknown: true, + }) - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } + if (error) throw error - return usm.url; -}; + validateCategories({ categories: config.categories }) -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + try { + config.replacers = validateReplacers({ + context, + replacers: config.replacers, + }) + } catch { + config.replacers = [] } -}; -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + try { + config.autolabeler = validateAutolabeler({ + context, + autolabeler: config.autolabeler, + }) + } catch { + config.autolabeler = [] } -}; -module.exports.serializeHost = serializeHost; + return config +} -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; +exports.schema = schema +exports.validateSchema = validateSchema -module.exports.serializeInteger = function (integer) { - return String(integer); -}; -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } +/***/ }), - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; +/***/ 11940: +/***/ ((__unused_webpack_module, exports) => { +const SORT_BY = { + mergedAt: 'merged_at', + title: 'title', +} -/***/ }), +const SORT_DIRECTIONS = { + ascending: 'ascending', + descending: 'descending', +} -/***/ 83185: -/***/ ((module) => { +const sortPullRequests = (pullRequests, sortBy, sortDirection) => { + const getSortField = sortBy === SORT_BY.title ? getTitle : getMergedAt -"use strict"; + const sort = + sortDirection === SORT_DIRECTIONS.ascending + ? dateSortAscending + : dateSortDescending + return [...pullRequests].sort((a, b) => + sort(getSortField(a), getSortField(b)) + ) +} -module.exports.mixin = function mixin(target, source) { - const keys = Object.getOwnPropertyNames(source); - for (let i = 0; i < keys.length; ++i) { - Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); - } -}; +function getMergedAt(pullRequest) { + return new Date(pullRequest.mergedAt) +} -module.exports.wrapperSymbol = Symbol("wrapper"); -module.exports.implSymbol = Symbol("impl"); +function getTitle(pullRequest) { + return pullRequest.title +} -module.exports.wrapperForImpl = function (impl) { - return impl[module.exports.wrapperSymbol]; -}; +function dateSortAscending(date1, date2) { + if (date1 > date2) return 1 + if (date1 < date2) return -1 + return 0 +} -module.exports.implForWrapper = function (wrapper) { - return wrapper[module.exports.implSymbol]; -}; +function dateSortDescending(date1, date2) { + if (date1 > date2) return -1 + if (date1 < date2) return 1 + return 0 +} +exports.SORT_BY = SORT_BY +exports.SORT_DIRECTIONS = SORT_DIRECTIONS +exports.sortPullRequests = sortPullRequests /***/ }), -/***/ 62940: -/***/ ((module) => { +/***/ 47282: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) +const { log } = __nccwpck_require__(71911) +const regexParser = __nccwpck_require__(14542) +const regexEscape = __nccwpck_require__(98691) - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') +/** + * replaces all uppercase dollar templates with their string representation from object + * if replacement is undefined in object the dollar template string is left untouched + */ - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] +const template = (string, object, customReplacers) => { + let input = string.replace(/(\$[A-Z_]+)/g, (_, k) => { + let result + if (object[k] === undefined || object[k] === null) { + result = k + } else if (typeof object[k] === 'object') { + result = template(object[k].template, object[k]) + } else { + result = `${object[k]}` + } + return result }) + if (customReplacers) { + for (const { search, replace } of customReplacers) { + input = input.replace(search, replace) + } + } + return input +} - return wrapper +function toRegex(search) { + return /^\/.+\/[AJUXgimsux]*$/.test(search) + ? regexParser(search) + : new RegExp(regexEscape(search), 'g') +} - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret +function validateReplacers({ context, replacers }) { + return replacers + .map((replacer) => { + try { + return { ...replacer, search: toRegex(replacer.search) } + } catch { + log({ + context, + message: `Bad replacer regex: '${replacer.search}'`, + }) + return false + } + }) + .filter(Boolean) +} + +function validateAutolabeler({ context, autolabeler }) { + return autolabeler + .map((autolabel) => { + try { + return { + ...autolabel, + branch: autolabel.branch.map((reg) => { + return toRegex(reg) + }), + title: autolabel.title.map((reg) => { + return toRegex(reg) + }), + body: autolabel.body.map((reg) => { + return toRegex(reg) + }), + } + } catch { + log({ + context, + message: `Bad autolabeler regex: '${autolabel.branch}', '${autolabel.title}' or '${autolabel.body}'`, + }) + return false + } + }) + .filter(Boolean) +} + +function validateCategories({ categories }) { + if ( + categories.filter((category) => category.labels.length === 0).length > 1 + ) { + throw new Error( + 'Multiple categories detected with no labels.\nOnly one category with no labels is supported for uncategorized pull requests.' + ) } } +exports.template = template +exports.validateReplacers = validateReplacers +exports.validateAutolabeler = validateAutolabeler +exports.validateCategories = validateCategories + /***/ }), -/***/ 4091: -/***/ ((module) => { +/***/ 49: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -"use strict"; +const { log } = __nccwpck_require__(71911) -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } +const isTriggerableReference = ({ context, ref, config }) => { + const { GITHUB_ACTIONS } = process.env + if (GITHUB_ACTIONS) { + // Let GitHub Action determine when to run the action based on the workflow's on syntax + // See https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on + return true + } + const referenceRegex = /^refs\/(?:heads|tags)\// + const refernces = config.references.map((r) => r.replace(referenceRegex, '')) + const shortReference = ref.replace(referenceRegex, '') + const validReference = new RegExp(refernces.join('|')) + const relevant = validReference.test(shortReference) + if (!relevant) { + log({ + context, + message: `Ignoring push. ${shortReference} does not match: ${refernces.join( + ', ' + )}`, + }) } + return relevant } +exports.isTriggerableReference = isTriggerableReference + /***/ }), -/***/ 40665: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 98281: +/***/ ((__unused_webpack_module, exports) => { -"use strict"; +function runnerIsActions() { + return process.env['GITHUB_ACTIONS'] !== undefined +} -module.exports = Yallist +exports.runnerIsActions = runnerIsActions -Yallist.Node = Node -Yallist.create = Yallist -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } +/***/ }), - self.tail = null - self.head = null - self.length = 0 +/***/ 49914: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } +const semver = __nccwpck_require__(11383) + +const splitSemVersion = (input, versionKey = 'version') => { + if (!input[versionKey]) { + return } - return self -} + const version = input.inc + ? semver.inc(input[versionKey], input.inc, true) + : input[versionKey].version -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') + return { + ...input, + version, + $MAJOR: semver.major(version), + $MINOR: semver.minor(version), + $PATCH: semver.patch(version), + $COMPLETE: version, } +} - var next = node.next - var prev = node.prev +const defaultVersionInfo = { + $NEXT_MAJOR_VERSION: { + version: '1.0.0', + template: '$MAJOR.$MINOR.$PATCH', + inputVersion: null, + versionKeyIncrement: 'patch', + inc: 'major', + $MAJOR: 1, + $MINOR: 0, + $PATCH: 0, + }, + $NEXT_MINOR_VERSION: { + version: '0.1.0', + template: '$MAJOR.$MINOR.$PATCH', + inputVersion: null, + versionKeyIncrement: 'patch', + inc: 'minor', + $MAJOR: 0, + $MINOR: 1, + $PATCH: 0, + }, + $NEXT_PATCH_VERSION: { + version: '0.1.0', + template: '$MAJOR.$MINOR.$PATCH', + inputVersion: null, + versionKeyIncrement: 'patch', + inc: 'patch', + $MAJOR: 0, + $MINOR: 1, + $PATCH: 0, + }, + $INPUT_VERSION: null, + $RESOLVED_VERSION: { + version: '0.1.0', + template: '$MAJOR.$MINOR.$PATCH', + inputVersion: null, + versionKeyIncrement: 'patch', + inc: 'patch', + $MAJOR: 0, + $MINOR: 1, + $PATCH: 0, + }, +} - if (next) { - next.prev = prev +const getTemplatableVersion = (input) => { + const templatableVersion = { + $NEXT_MAJOR_VERSION: splitSemVersion({ ...input, inc: 'major' }), + $NEXT_MAJOR_VERSION_MAJOR: splitSemVersion({ + ...input, + inc: 'major', + template: '$MAJOR', + }), + $NEXT_MAJOR_VERSION_MINOR: splitSemVersion({ + ...input, + inc: 'major', + template: '$MINOR', + }), + $NEXT_MAJOR_VERSION_PATCH: splitSemVersion({ + ...input, + inc: 'major', + template: '$PATCH', + }), + $NEXT_MINOR_VERSION: splitSemVersion({ ...input, inc: 'minor' }), + $NEXT_MINOR_VERSION_MAJOR: splitSemVersion({ + ...input, + inc: 'minor', + template: '$MAJOR', + }), + $NEXT_MINOR_VERSION_MINOR: splitSemVersion({ + ...input, + inc: 'minor', + template: '$MINOR', + }), + $NEXT_MINOR_VERSION_PATCH: splitSemVersion({ + ...input, + inc: 'minor', + template: '$PATCH', + }), + $NEXT_PATCH_VERSION: splitSemVersion({ ...input, inc: 'patch' }), + $NEXT_PATCH_VERSION_MAJOR: splitSemVersion({ + ...input, + inc: 'patch', + template: '$MAJOR', + }), + $NEXT_PATCH_VERSION_MINOR: splitSemVersion({ + ...input, + inc: 'patch', + template: '$MINOR', + }), + $NEXT_PATCH_VERSION_PATCH: splitSemVersion({ + ...input, + inc: 'patch', + template: '$PATCH', + }), + $INPUT_VERSION: splitSemVersion(input, 'inputVersion'), + $RESOLVED_VERSION: splitSemVersion({ + ...input, + inc: input.versionKeyIncrement || 'patch', + }), } - if (prev) { - prev.next = next - } + templatableVersion.$RESOLVED_VERSION = + templatableVersion.$INPUT_VERSION || templatableVersion.$RESOLVED_VERSION - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } + return templatableVersion +} - node.list.length-- - node.next = null - node.prev = null - node.list = null +const toSemver = (version) => { + const result = semver.parse(version) + if (result) { + return result + } - return next + // doesn't handle prerelease + return semver.coerce(version) } -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { +const coerceVersion = (input, tagPrefix) => { + if (!input) { return } - if (node.list) { - node.list.removeNode(node) - } + const stripTag = (input) => + tagPrefix && input.startsWith(tagPrefix) + ? input.slice(tagPrefix.length) + : input - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node + return typeof input === 'object' + ? toSemver(stripTag(input.tag_name)) || toSemver(stripTag(input.name)) + : toSemver(stripTag(input)) +} + +const getVersionInfo = ( + release, + template, + inputVersion, + versionKeyIncrement, + tagPrefix +) => { + const version = coerceVersion(release, tagPrefix) + inputVersion = coerceVersion(inputVersion, tagPrefix) + + if (!version && !inputVersion) { + return defaultVersionInfo } - this.head = node - if (!this.tail) { - this.tail = node + return { + ...getTemplatableVersion({ + version, + template, + inputVersion, + versionKeyIncrement, + }), } - this.length++ } -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } +exports.getVersionInfo = getVersionInfo +exports.defaultVersionInfo = defaultVersionInfo - if (node.list) { - node.list.removeNode(node) - } - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } +/***/ }), - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} +/***/ 39761: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} +"use strict"; -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } +const errSerializer = __nccwpck_require__(64951) +const errWithCauseSerializer = __nccwpck_require__(69628) +const reqSerializers = __nccwpck_require__(74454) +const resSerializers = __nccwpck_require__(11521) - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} +module.exports = { + err: errSerializer, + errWithCause: errWithCauseSerializer, + mapHttpRequest: reqSerializers.mapHttpRequest, + mapHttpResponse: resSerializers.mapHttpResponse, + req: reqSerializers.reqSerializer, + res: resSerializers.resSerializer, -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } + wrapErrorSerializer: function wrapErrorSerializer (customSerializer) { + if (customSerializer === errSerializer) return customSerializer + return function wrapErrSerializer (err) { + return customSerializer(errSerializer(err)) + } + }, - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} + wrapRequestSerializer: function wrapRequestSerializer (customSerializer) { + if (customSerializer === reqSerializers.reqSerializer) return customSerializer + return function wrappedReqSerializer (req) { + return customSerializer(reqSerializers.reqSerializer(req)) + } + }, -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next + wrapResponseSerializer: function wrapResponseSerializer (customSerializer) { + if (customSerializer === resSerializers.resSerializer) return customSerializer + return function wrappedResSerializer (res) { + return customSerializer(resSerializers.resSerializer(res)) + } } } -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} +/***/ }), -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} +/***/ 28579: +/***/ ((module) => { -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} +"use strict"; -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res + +// ************************************************************** +// * Code initially copied/adapted from "pony-cause" npm module * +// * Please upstream improvements there * +// ************************************************************** + +const isErrorLike = (err) => { + return err && typeof err.message === 'string' } -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } +/** + * @param {Error|{ cause?: unknown|(()=>err)}} err + * @returns {Error|Object|undefined} + */ +const getErrorCause = (err) => { + if (!err) return - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } + /** @type {unknown} */ + // @ts-ignore + const cause = err.cause - return acc -} + // VError / NError style causes + if (typeof cause === 'function') { + // @ts-ignore + const causeResult = err.cause() -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value + return isErrorLike(causeResult) + ? causeResult + : undefined } else { - throw new TypeError('Reduce of empty list with no initial value') + return isErrorLike(cause) + ? cause + : undefined } +} - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } +/** + * Internal method that keeps a track of which error we have already added, to avoid circular recursion + * + * @private + * @param {Error} err + * @param {Set} seen + * @returns {string} + */ +const _stackWithCauses = (err, seen) => { + if (!isErrorLike(err)) return '' - return acc -} + const stack = err.stack || '' -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next + // Ensure we don't go circular or crazily deep + if (seen.has(err)) { + return stack + '\ncauses have become circular...' } - return arr -} -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev + const cause = getErrorCause(err) + + if (cause) { + seen.add(err) + return (stack + '\ncaused by: ' + _stackWithCauses(cause, seen)) + } else { + return stack } - return arr } -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next +/** + * @param {Error} err + * @returns {string} + */ +const stackWithCauses = (err) => _stackWithCauses(err, new Set()) + +/** + * Internal method that keeps a track of which error we have already added, to avoid circular recursion + * + * @private + * @param {Error} err + * @param {Set} seen + * @param {boolean} [skip] + * @returns {string} + */ +const _messageWithCauses = (err, seen, skip) => { + if (!isErrorLike(err)) return '' + + const message = skip ? '' : (err.message || '') + + // Ensure we don't go circular or crazily deep + if (seen.has(err)) { + return message + ': ...' } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) + + const cause = getErrorCause(err) + + if (cause) { + seen.add(err) + + // @ts-ignore + const skipIfVErrorStyleCause = typeof err.cause === 'function' + + return (message + + (skipIfVErrorStyleCause ? '' : ': ') + + _messageWithCauses(cause, seen, skipIfVErrorStyleCause)) + } else { + return message } - return ret } -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret +/** + * @param {Error} err + * @returns {string} + */ +const messageWithCauses = (err) => _messageWithCauses(err, new Set()) + +module.exports = { + isErrorLike, + getErrorCause, + stackWithCauses, + messageWithCauses } -Yallist.prototype.splice = function (start, deleteCount, ...nodes) { - if (start > this.length) { - start = this.length - 1 - } - if (start < 0) { - start = this.length + start; - } - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next - } +/***/ }), - var ret = [] - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value) - walker = this.removeNode(walker) - } - if (walker === null) { - walker = this.tail - } +/***/ 1143: +/***/ ((module) => { - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev +"use strict"; + + +const seen = Symbol('circular-ref-tag') +const rawSymbol = Symbol('pino-raw-err-ref') + +const pinoErrProto = Object.create({}, { + type: { + enumerable: true, + writable: true, + value: undefined + }, + message: { + enumerable: true, + writable: true, + value: undefined + }, + stack: { + enumerable: true, + writable: true, + value: undefined + }, + aggregateErrors: { + enumerable: true, + writable: true, + value: undefined + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } } +}) +Object.defineProperty(pinoErrProto, rawSymbol, { + writable: true, + value: {} +}) - for (var i = 0; i < nodes.length; i++) { - walker = insert(this, walker, nodes[i]) +module.exports = { + pinoErrProto, + pinoErrorSymbols: { + seen, + rawSymbol } - return ret; } -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} -function insert (self, node, value) { - var inserted = node === self.head ? - new Node(value, null, node, self) : - new Node(value, node, node.next, self) +/***/ }), - if (inserted.next === null) { - self.tail = inserted - } - if (inserted.prev === null) { - self.head = inserted - } +/***/ 69628: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - self.length++ +"use strict"; - return inserted -} -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} +module.exports = errWithCauseSerializer -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} +const { isErrorLike } = __nccwpck_require__(28579) +const { pinoErrProto, pinoErrorSymbols } = __nccwpck_require__(1143) +const { seen } = pinoErrorSymbols -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) +const { toString } = Object.prototype + +function errWithCauseSerializer (err) { + if (!isErrorLike(err)) { + return err } - this.list = list - this.value = value + err[seen] = undefined // tag to prevent re-looking at this + const _err = Object.create(pinoErrProto) + _err.type = toString.call(err.constructor) === '[object Function]' + ? err.constructor.name + : err.name + _err.message = err.message + _err.stack = err.stack - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null + if (Array.isArray(err.errors)) { + _err.aggregateErrors = err.errors.map(err => errWithCauseSerializer(err)) } - if (next) { - next.prev = this - this.next = next - } else { - this.next = null + if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) { + _err.cause = errWithCauseSerializer(err.cause) } -} - -try { - // add if support for Symbol.iterator is present - __nccwpck_require__(4091)(Yallist) -} catch (er) {} - -/***/ }), - -/***/ 22877: -/***/ ((module) => { + for (const key in err) { + if (_err[key] === undefined) { + const val = err[key] + if (isErrorLike(val)) { + if (!Object.prototype.hasOwnProperty.call(val, seen)) { + _err[key] = errWithCauseSerializer(val) + } + } else { + _err[key] = val + } + } + } -module.exports = eval("require")("encoding"); + delete err[seen] // clean up tag in case err is serialized again later + _err.raw = err + return _err +} /***/ }), -/***/ 24807: -/***/ ((module) => { +/***/ 64951: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = eval("require")("smee-client"); +"use strict"; -/***/ }), +module.exports = errSerializer -/***/ 39491: -/***/ ((module) => { +const { messageWithCauses, stackWithCauses, isErrorLike } = __nccwpck_require__(28579) +const { pinoErrProto, pinoErrorSymbols } = __nccwpck_require__(1143) +const { seen } = pinoErrorSymbols -"use strict"; -module.exports = require("assert"); +const { toString } = Object.prototype -/***/ }), +function errSerializer (err) { + if (!isErrorLike(err)) { + return err + } -/***/ 14300: -/***/ ((module) => { + err[seen] = undefined // tag to prevent re-looking at this + const _err = Object.create(pinoErrProto) + _err.type = toString.call(err.constructor) === '[object Function]' + ? err.constructor.name + : err.name + _err.message = messageWithCauses(err) + _err.stack = stackWithCauses(err) -"use strict"; -module.exports = require("buffer"); + if (Array.isArray(err.errors)) { + _err.aggregateErrors = err.errors.map(err => errSerializer(err)) + } -/***/ }), + for (const key in err) { + if (_err[key] === undefined) { + const val = err[key] + if (isErrorLike(val)) { + // We append cause messages and stacks to _err, therefore skipping causes here + if (key !== 'cause' && !Object.prototype.hasOwnProperty.call(val, seen)) { + _err[key] = errSerializer(val) + } + } else { + _err[key] = val + } + } + } -/***/ 32081: -/***/ ((module) => { + delete err[seen] // clean up tag in case err is serialized again later + _err.raw = err + return _err +} -"use strict"; -module.exports = require("child_process"); /***/ }), -/***/ 22057: +/***/ 74454: /***/ ((module) => { "use strict"; -module.exports = require("constants"); -/***/ }), -/***/ 6113: -/***/ ((module) => { +module.exports = { + mapHttpRequest, + reqSerializer +} -"use strict"; -module.exports = require("crypto"); +const rawSymbol = Symbol('pino-raw-req-ref') +const pinoReqProto = Object.create({}, { + id: { + enumerable: true, + writable: true, + value: '' + }, + method: { + enumerable: true, + writable: true, + value: '' + }, + url: { + enumerable: true, + writable: true, + value: '' + }, + query: { + enumerable: true, + writable: true, + value: '' + }, + params: { + enumerable: true, + writable: true, + value: '' + }, + headers: { + enumerable: true, + writable: true, + value: {} + }, + remoteAddress: { + enumerable: true, + writable: true, + value: '' + }, + remotePort: { + enumerable: true, + writable: true, + value: '' + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } + } +}) +Object.defineProperty(pinoReqProto, rawSymbol, { + writable: true, + value: {} +}) -/***/ }), +function reqSerializer (req) { + // req.info is for hapi compat. + const connection = req.info || req.socket + const _req = Object.create(pinoReqProto) + _req.id = (typeof req.id === 'function' ? req.id() : (req.id || (req.info ? req.info.id : undefined))) + _req.method = req.method + // req.originalUrl is for expressjs compat. + if (req.originalUrl) { + _req.url = req.originalUrl + } else { + const path = req.path + // path for safe hapi compat. + _req.url = typeof path === 'string' ? path : (req.url ? req.url.path || req.url : undefined) + } -/***/ 9523: -/***/ ((module) => { + if (req.query) { + _req.query = req.query + } -"use strict"; -module.exports = require("dns"); + if (req.params) { + _req.params = req.params + } -/***/ }), + _req.headers = req.headers + _req.remoteAddress = connection && connection.remoteAddress + _req.remotePort = connection && connection.remotePort + // req.raw is for hapi compat/equivalence + _req.raw = req.raw || req + return _req +} -/***/ 13639: -/***/ ((module) => { +function mapHttpRequest (req) { + return { + req: reqSerializer(req) + } +} -"use strict"; -module.exports = require("domain"); /***/ }), -/***/ 82361: +/***/ 11521: /***/ ((module) => { "use strict"; -module.exports = require("events"); -/***/ }), -/***/ 57147: -/***/ ((module) => { +module.exports = { + mapHttpResponse, + resSerializer +} -"use strict"; -module.exports = require("fs"); +const rawSymbol = Symbol('pino-raw-res-ref') +const pinoResProto = Object.create({}, { + statusCode: { + enumerable: true, + writable: true, + value: 0 + }, + headers: { + enumerable: true, + writable: true, + value: '' + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } + } +}) +Object.defineProperty(pinoResProto, rawSymbol, { + writable: true, + value: {} +}) -/***/ }), +function resSerializer (res) { + const _res = Object.create(pinoResProto) + _res.statusCode = res.headersSent ? res.statusCode : null + _res.headers = res.getHeaders ? res.getHeaders() : res._headers + _res.raw = res + return _res +} -/***/ 13685: -/***/ ((module) => { +function mapHttpResponse (res) { + return { + res: resSerializer(res) + } +} -"use strict"; -module.exports = require("http"); /***/ }), -/***/ 95687: +/***/ 50023: /***/ ((module) => { "use strict"; -module.exports = require("https"); -/***/ }), -/***/ 41808: -/***/ ((module) => { +function noOpPrepareStackTrace (_, stack) { + return stack +} -"use strict"; -module.exports = require("net"); +module.exports = function getCallers () { + const originalPrepare = Error.prepareStackTrace + Error.prepareStackTrace = noOpPrepareStackTrace + const stack = new Error().stack + Error.prepareStackTrace = originalPrepare -/***/ }), + if (!Array.isArray(stack)) { + return undefined + } -/***/ 22037: -/***/ ((module) => { + const entries = stack.slice(2) -"use strict"; -module.exports = require("os"); + const fileNames = [] -/***/ }), + for (const entry of entries) { + if (!entry) { + continue + } -/***/ 71017: -/***/ ((module) => { + fileNames.push(entry.getFileName()) + } + + return fileNames +} -"use strict"; -module.exports = require("path"); /***/ }), -/***/ 85477: -/***/ ((module) => { +/***/ 35662: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -module.exports = require("punycode"); -/***/ }), +/* eslint no-prototype-builtins: 0 */ +const { + lsCacheSym, + levelValSym, + useOnlyCustomLevelsSym, + streamSym, + formattersSym, + hooksSym +} = __nccwpck_require__(23689) +const { noop, genLog } = __nccwpck_require__(73047) -/***/ 63477: -/***/ ((module) => { +const levels = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60 +} +const levelMethods = { + fatal: (hook) => { + const logFatal = genLog(levels.fatal, hook) + return function (...args) { + const stream = this[streamSym] + logFatal.call(this, ...args) + if (typeof stream.flushSync === 'function') { + try { + stream.flushSync() + } catch (e) { + // https://github.com/pinojs/pino/pull/740#discussion_r346788313 + } + } + } + }, + error: (hook) => genLog(levels.error, hook), + warn: (hook) => genLog(levels.warn, hook), + info: (hook) => genLog(levels.info, hook), + debug: (hook) => genLog(levels.debug, hook), + trace: (hook) => genLog(levels.trace, hook) +} -"use strict"; -module.exports = require("querystring"); +const nums = Object.keys(levels).reduce((o, k) => { + o[levels[k]] = k + return o +}, {}) -/***/ }), +const initialLsCache = Object.keys(nums).reduce((o, k) => { + o[k] = '{"level":' + Number(k) + return o +}, {}) -/***/ 12781: -/***/ ((module) => { +function genLsCache (instance) { + const formatter = instance[formattersSym].level + const { labels } = instance.levels + const cache = {} + for (const label in labels) { + const level = formatter(labels[label], Number(label)) + cache[label] = JSON.stringify(level).slice(0, -1) + } + instance[lsCacheSym] = cache + return instance +} -"use strict"; -module.exports = require("stream"); +function isStandardLevel (level, useOnlyCustomLevels) { + if (useOnlyCustomLevels) { + return false + } -/***/ }), + switch (level) { + case 'fatal': + case 'error': + case 'warn': + case 'info': + case 'debug': + case 'trace': + return true + default: + return false + } +} -/***/ 71576: -/***/ ((module) => { +function setLevel (level) { + const { labels, values } = this.levels + if (typeof level === 'number') { + if (labels[level] === undefined) throw Error('unknown level value' + level) + level = labels[level] + } + if (values[level] === undefined) throw Error('unknown level ' + level) + const preLevelVal = this[levelValSym] + const levelVal = this[levelValSym] = values[level] + const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym] + const hook = this[hooksSym].logMethod -"use strict"; -module.exports = require("string_decoder"); + for (const key in values) { + if (levelVal > values[key]) { + this[key] = noop + continue + } + this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook) + } -/***/ }), + this.emit( + 'level-change', + level, + levelVal, + labels[preLevelVal], + preLevelVal, + this + ) +} -/***/ 24404: -/***/ ((module) => { +function getLevel (level) { + const { levels, levelVal } = this + // protection against potential loss of Pino scope from serializers (edge case with circular refs - https://github.com/pinojs/pino/issues/833) + return (levels && levels.labels) ? levels.labels[levelVal] : '' +} -"use strict"; -module.exports = require("tls"); +function isLevelEnabled (logLevel) { + const { values } = this.levels + const logLevelVal = values[logLevel] + return logLevelVal !== undefined && (logLevelVal >= this[levelValSym]) +} -/***/ }), +function mappings (customLevels = null, useOnlyCustomLevels = false) { + const customNums = customLevels + /* eslint-disable */ + ? Object.keys(customLevels).reduce((o, k) => { + o[customLevels[k]] = k + return o + }, {}) + : null + /* eslint-enable */ -/***/ 76224: -/***/ ((module) => { + const labels = Object.assign( + Object.create(Object.prototype, { Infinity: { value: 'silent' } }), + useOnlyCustomLevels ? null : nums, + customNums + ) + const values = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : levels, + customLevels + ) + return { labels, values } +} -"use strict"; -module.exports = require("tty"); +function assertDefaultLevelFound (defaultLevel, customLevels, useOnlyCustomLevels) { + if (typeof defaultLevel === 'number') { + const values = [].concat( + Object.keys(customLevels || {}).map(key => customLevels[key]), + useOnlyCustomLevels ? [] : Object.keys(nums).map(level => +level), + Infinity + ) + if (!values.includes(defaultLevel)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`) + } + return + } -/***/ }), + const labels = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : levels, + customLevels + ) + if (!(defaultLevel in labels)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`) + } +} -/***/ 57310: -/***/ ((module) => { +function assertNoLevelCollisions (levels, customLevels) { + const { labels, values } = levels + for (const k in customLevels) { + if (k in values) { + throw Error('levels cannot be overridden') + } + if (customLevels[k] in labels) { + throw Error('pre-existing level values cannot be used for new levels') + } + } +} + +module.exports = { + initialLsCache, + genLsCache, + levelMethods, + getLevel, + setLevel, + isLevelEnabled, + mappings, + levels, + assertNoLevelCollisions, + assertDefaultLevelFound +} -"use strict"; -module.exports = require("url"); /***/ }), -/***/ 73837: +/***/ 935: /***/ ((module) => { "use strict"; -module.exports = require("util"); -/***/ }), -/***/ 26144: -/***/ ((module) => { +module.exports = { version: '8.15.1' } -"use strict"; -module.exports = require("vm"); /***/ }), -/***/ 59796: -/***/ ((module) => { +/***/ 98048: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -module.exports = require("zlib"); -/***/ }), -/***/ 24566: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const metadata = Symbol.for('pino.metadata') +const { levels } = __nccwpck_require__(35662) -const { getConfig } = __nccwpck_require__(35378) -const { isTriggerableReference } = __nccwpck_require__(49) -const { - findReleases, - generateReleaseInfo, - createRelease, - updateRelease, -} = __nccwpck_require__(96402) -const { findCommitsWithAssociatedPullRequests } = __nccwpck_require__(47245) -const { sortPullRequests } = __nccwpck_require__(11940) -const { log } = __nccwpck_require__(71911) -const core = __nccwpck_require__(42186) -const { runnerIsActions } = __nccwpck_require__(98281) -const ignore = __nccwpck_require__(91230) +const DEFAULT_INFO_LEVEL = levels.info -module.exports = (app, { getRouter }) => { - if (!runnerIsActions() && typeof getRouter === 'function') { - getRouter().get('/healthz', (request, response) => { - response.status(200).json({ status: 'pass' }) +function multistream (streamsArray, opts) { + let counter = 0 + streamsArray = streamsArray || [] + opts = opts || { dedupe: false } + + const streamLevels = Object.create(levels) + streamLevels.silent = Infinity + if (opts.levels && typeof opts.levels === 'object') { + Object.keys(opts.levels).forEach(i => { + streamLevels[i] = opts.levels[i] }) } - app.on( - [ - 'pull_request.opened', - 'pull_request.reopened', - 'pull_request.synchronize', - 'pull_request.edited', - 'pull_request_target.opened', - 'pull_request_target.reopened', - 'pull_request_target.synchronize', - 'pull_request_target.edited', - ], - async (context) => { - const { disableAutolabeler } = getInput() + const res = { + write, + add, + flushSync, + end, + minLevel: 0, + streams: [], + clone, + [metadata]: true, + streamLevels + } - const config = await getConfig({ - context, - configName: core.getInput('config-name'), - }) + if (Array.isArray(streamsArray)) { + streamsArray.forEach(add, res) + } else { + add.call(res, streamsArray) + } - if (config === null || disableAutolabeler) return + // clean this object up + // or it will stay allocated forever + // as it is closed on the following closures + streamsArray = null - let issue = { - ...context.issue({ pull_number: context.payload.pull_request.number }), - } - const changedFiles = await context.octokit.paginate( - context.octokit.pulls.listFiles.endpoint.merge(issue), - (response) => response.data.map((file) => file.filename) - ) - const labels = new Set() + return res - for (const autolabel of config['autolabeler']) { - let found = false - // check modified files - if (!found && autolabel.files.length > 0) { - const matcher = ignore().add(autolabel.files) - if (changedFiles.some((file) => matcher.ignores(file))) { - labels.add(autolabel.label) - found = true - log({ - context, - message: `Found label for files: '${autolabel.label}'`, - }) - } - } - // check branch names - if (!found && autolabel.branch.length > 0) { - for (const matcher of autolabel.branch) { - if (matcher.test(context.payload.pull_request.head.ref)) { - labels.add(autolabel.label) - found = true - log({ - context, - message: `Found label for branch: '${autolabel.label}'`, - }) - break - } - } + // we can exit early because the streams are ordered by level + function write (data) { + let dest + const level = this.lastLevel + const { streams } = this + // for handling situation when several streams has the same level + let recordedLevel = 0 + let stream + + // if dedupe set to true we send logs to the stream with the highest level + // therefore, we have to change sorting order + for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) { + dest = streams[i] + if (dest.level <= level) { + if (recordedLevel !== 0 && recordedLevel !== dest.level) { + break } - // check pr title - if (!found && autolabel.title.length > 0) { - for (const matcher of autolabel.title) { - if (matcher.test(context.payload.pull_request.title)) { - labels.add(autolabel.label) - found = true - log({ - context, - message: `Found label for title: '${autolabel.label}'`, - }) - break - } - } + stream = dest.stream + if (stream[metadata]) { + const { lastTime, lastMsg, lastObj, lastLogger } = this + stream.lastLevel = level + stream.lastTime = lastTime + stream.lastMsg = lastMsg + stream.lastObj = lastObj + stream.lastLogger = lastLogger } - // check pr body - if ( - !found && - context.payload.pull_request.body != null && - autolabel.body.length > 0 - ) { - for (const matcher of autolabel.body) { - if (matcher.test(context.payload.pull_request.body)) { - labels.add(autolabel.label) - found = true - log({ - context, - message: `Found label for body: '${autolabel.label}'`, - }) - break - } - } + stream.write(data) + if (opts.dedupe) { + recordedLevel = dest.level } + } else if (!opts.dedupe) { + break } + } + } - const labelsToAdd = [...labels] - if (labelsToAdd.length > 0) { - let labelIssue = { - ...context.issue({ - issue_number: context.payload.pull_request.number, - labels: labelsToAdd, - }), - } - await context.octokit.issues.addLabels(labelIssue) - if (runnerIsActions()) { - core.setOutput('number', context.payload.pull_request.number) - core.setOutput('labels', labelsToAdd.join(',')) - } - return + function flushSync () { + for (const { stream } of this.streams) { + if (typeof stream.flushSync === 'function') { + stream.flushSync() } } - ) - - const drafter = async (context) => { - const { - shouldDraft, - configName, - version, - tag, - name, - disableReleaser, - commitish, - } = getInput() - - const config = await getConfig({ - context, - configName, - }) - - const { isPreRelease, latest } = getInput({ config }) - - if (config === null || disableReleaser) return + } - // GitHub Actions merge payloads slightly differ, in that their ref points - // to the PR branch instead of refs/heads/master - const ref = process.env['GITHUB_REF'] || context.payload.ref + function add (dest) { + if (!dest) { + return res + } - if (!isTriggerableReference({ ref, context, config })) { - return + // Check that dest implements either StreamEntry or DestinationStream + const isStream = typeof dest.write === 'function' || dest.stream + const stream_ = dest.write ? dest : dest.stream + // This is necessary to provide a meaningful error message, otherwise it throws somewhere inside write() + if (!isStream) { + throw Error('stream object needs to implement either StreamEntry or DestinationStream interface') } - const targetCommitish = commitish || config['commitish'] || ref - const { - 'filter-by-commitish': filterByCommitish, - 'include-pre-releases': includePreReleases, - 'tag-prefix': tagPrefix, - } = config + const { streams, streamLevels } = this - // override header and footer when passed as input - const header = core.getInput('header') - const footer = core.getInput('footer') - if (header) { - config['header'] = header + let level + if (typeof dest.levelVal === 'number') { + level = dest.levelVal + } else if (typeof dest.level === 'string') { + level = streamLevels[dest.level] + } else if (typeof dest.level === 'number') { + level = dest.level + } else { + level = DEFAULT_INFO_LEVEL } - if (footer) { - config['footer'] = footer + + const dest_ = { + stream: stream_, + level, + levelVal: undefined, + id: counter++ } - const { draftRelease, lastRelease } = await findReleases({ - context, - targetCommitish, - filterByCommitish, - includePreReleases, - tagPrefix, - }) + streams.unshift(dest_) + streams.sort(compareByLevel) - const { commits, pullRequests: mergedPullRequests } = - await findCommitsWithAssociatedPullRequests({ - context, - targetCommitish, - lastRelease, - config, - }) + this.minLevel = streams[0].level - const sortedMergedPullRequests = sortPullRequests( - mergedPullRequests, - config['sort-by'], - config['sort-direction'] - ) + return res + } - const releaseInfo = generateReleaseInfo({ - context, - commits, - config, - lastRelease, - mergedPullRequests: sortedMergedPullRequests, - version, - tag, - name, - isPreRelease, - latest, - shouldDraft, - targetCommitish, - }) + function end () { + for (const { stream } of this.streams) { + if (typeof stream.flushSync === 'function') { + stream.flushSync() + } + stream.end() + } + } - let createOrUpdateReleaseResponse - if (!draftRelease) { - log({ context, message: 'Creating new release' }) - createOrUpdateReleaseResponse = await createRelease({ - context, - releaseInfo, - config, - }) - } else { - log({ context, message: 'Updating existing release' }) - createOrUpdateReleaseResponse = await updateRelease({ - context, - draftRelease, - releaseInfo, - config, - }) + function clone (level) { + const streams = new Array(this.streams.length) + + for (let i = 0; i < streams.length; i++) { + streams[i] = { + level, + stream: this.streams[i].stream + } } - if (runnerIsActions()) { - setActionOutput(createOrUpdateReleaseResponse, releaseInfo) + return { + write, + add, + minLevel: level, + streams, + clone, + flushSync, + [metadata]: true } } +} - if (runnerIsActions()) { - app.onAny(drafter) - } else { - app.on('push', drafter) - } +function compareByLevel (a, b) { + return a.level - b.level } -function getInput({ config } = {}) { - // Returns all the inputs that doesn't need a merge with the config file - if (!config) { - return { - shouldDraft: core.getInput('publish').toLowerCase() !== 'true', - configName: core.getInput('config-name'), - version: core.getInput('version') || undefined, - tag: core.getInput('tag') || undefined, - name: core.getInput('name') || undefined, - disableReleaser: - core.getInput('disable-releaser').toLowerCase() === 'true', - disableAutolabeler: - core.getInput('disable-autolabeler').toLowerCase() === 'true', - commitish: core.getInput('commitish') || undefined, - } - } +function initLoopVar (length, dedupe) { + return dedupe ? length - 1 : 0 +} - // Merges the config file with the input - // the input takes precedence, because it's more easy to change at runtime - const preRelease = core.getInput('prerelease').toLowerCase() +function adjustLoopVar (i, dedupe) { + return dedupe ? i - 1 : i + 1 +} - const isPreRelease = - preRelease === 'true' || (!preRelease && config.prerelease) +function checkLoopVar (i, length, dedupe) { + return dedupe ? i >= 0 : i < length +} - const latestInput = core.getInput('latest').toLowerCase() +module.exports = multistream - const latest = isPreRelease - ? 'false' - : (!latestInput && config.latest) || latestInput || undefined - return { - isPreRelease, - latest, - } -} +/***/ }), -function setActionOutput( - releaseResponse, - { body, resolvedVersion, majorVersion, minorVersion, patchVersion } -) { - const { - data: { - id: releaseId, - html_url: htmlUrl, - upload_url: uploadUrl, - tag_name: tagName, - name: name, - }, - } = releaseResponse - if (releaseId && Number.isInteger(releaseId)) - core.setOutput('id', releaseId.toString()) - if (htmlUrl) core.setOutput('html_url', htmlUrl) - if (uploadUrl) core.setOutput('upload_url', uploadUrl) - if (tagName) core.setOutput('tag_name', tagName) - if (name) core.setOutput('name', name) - if (resolvedVersion) core.setOutput('resolved_version', resolvedVersion) - if (majorVersion) core.setOutput('major_version', majorVersion) - if (minorVersion) core.setOutput('minor_version', minorVersion) - if (patchVersion) core.setOutput('patch_version', patchVersion) - core.setOutput('body', body) +/***/ 2732: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/* eslint no-prototype-builtins: 0 */ + +const { EventEmitter } = __nccwpck_require__(82361) +const { + lsCacheSym, + levelValSym, + setLevelSym, + getLevelSym, + chindingsSym, + parsedChindingsSym, + mixinSym, + asJsonSym, + writeSym, + mixinMergeStrategySym, + timeSym, + timeSliceIndexSym, + streamSym, + serializersSym, + formattersSym, + errorKeySym, + messageKeySym, + useOnlyCustomLevelsSym, + needsMetadataGsym, + redactFmtSym, + stringifySym, + formatOptsSym, + stringifiersSym, + msgPrefixSym +} = __nccwpck_require__(23689) +const { + getLevel, + setLevel, + isLevelEnabled, + mappings, + initialLsCache, + genLsCache, + assertNoLevelCollisions +} = __nccwpck_require__(35662) +const { + asChindings, + asJson, + buildFormatters, + stringify +} = __nccwpck_require__(73047) +const { + version +} = __nccwpck_require__(935) +const redaction = __nccwpck_require__(69565) + +// note: use of class is satirical +// https://github.com/pinojs/pino/pull/433#pullrequestreview-127703127 +const constructor = class Pino {} +const prototype = { + constructor, + child, + bindings, + setBindings, + flush, + isLevelEnabled, + version, + get level () { return this[getLevelSym]() }, + set level (lvl) { this[setLevelSym](lvl) }, + get levelVal () { return this[levelValSym] }, + set levelVal (n) { throw Error('levelVal is read-only') }, + [lsCacheSym]: initialLsCache, + [writeSym]: write, + [asJsonSym]: asJson, + [getLevelSym]: getLevel, + [setLevelSym]: setLevel } +Object.setPrototypeOf(prototype, EventEmitter.prototype) -/***/ }), +// exporting and consuming the prototype object using factory pattern fixes scoping issues with getters when serializing +module.exports = function () { + return Object.create(prototype) +} -/***/ 47245: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const resetChildingsFormatter = bindings => bindings +function child (bindings, options) { + if (!bindings) { + throw Error('missing bindings for child Pino') + } + options = options || {} // default options to empty object + const serializers = this[serializersSym] + const formatters = this[formattersSym] + const instance = Object.create(this) -const _ = __nccwpck_require__(90250) -const { log } = __nccwpck_require__(71911) -const { paginate } = __nccwpck_require__(46418) + if (options.hasOwnProperty('serializers') === true) { + instance[serializersSym] = Object.create(null) -const findCommitsWithPathChangesQuery = /* GraphQL */ ` - query findCommitsWithPathChangesQuery( - $name: String! - $owner: String! - $targetCommitish: String! - $since: GitTimestamp - $after: String - $path: String - ) { - repository(name: $name, owner: $owner) { - object(expression: $targetCommitish) { - ... on Commit { - history(path: $path, since: $since, after: $after) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - } - } - } - } + for (const k in serializers) { + instance[serializersSym][k] = serializers[k] + } + const parentSymbols = Object.getOwnPropertySymbols(serializers) + /* eslint no-var: off */ + for (var i = 0; i < parentSymbols.length; i++) { + const ks = parentSymbols[i] + instance[serializersSym][ks] = serializers[ks] } - } -` -const findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ ` - query findCommitsWithAssociatedPullRequests( - $name: String! - $owner: String! - $targetCommitish: String! - $withPullRequestBody: Boolean! - $withPullRequestURL: Boolean! - $since: GitTimestamp - $after: String - $withBaseRefName: Boolean! - $withHeadRefName: Boolean! - ) { - repository(name: $name, owner: $owner) { - object(expression: $targetCommitish) { - ... on Commit { - history(first: 100, since: $since, after: $after) { - totalCount - pageInfo { - hasNextPage - endCursor - } - nodes { - id - committedDate - message - author { - name - user { - login - } - } - associatedPullRequests(first: 5) { - nodes { - title - number - url @include(if: $withPullRequestURL) - body @include(if: $withPullRequestBody) - author { - login - } - baseRepository { - nameWithOwner - } - mergedAt - isCrossRepository - labels(first: 100) { - nodes { - name - } - } - merged - baseRefName @include(if: $withBaseRefName) - headRefName @include(if: $withHeadRefName) - } - } - } - } - } - } + for (const bk in options.serializers) { + instance[serializersSym][bk] = options.serializers[bk] + } + const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers) + for (var bi = 0; bi < bindingsSymbols.length; bi++) { + const bks = bindingsSymbols[bi] + instance[serializersSym][bks] = options.serializers[bks] } + } else instance[serializersSym] = serializers + if (options.hasOwnProperty('formatters')) { + const { level, bindings: chindings, log } = options.formatters + instance[formattersSym] = buildFormatters( + level || formatters.level, + chindings || resetChildingsFormatter, + log || formatters.log + ) + } else { + instance[formattersSym] = buildFormatters( + formatters.level, + resetChildingsFormatter, + formatters.log + ) + } + if (options.hasOwnProperty('customLevels') === true) { + assertNoLevelCollisions(this.levels, options.customLevels) + instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]) + genLsCache(instance) } -` -const findCommitsWithAssociatedPullRequests = async ({ - context, - targetCommitish, - lastRelease, - config, -}) => { - const { owner, repo } = context.repo() - const variables = { - name: repo, - owner, - targetCommitish, - withPullRequestBody: config['change-template'].includes('$BODY'), - withPullRequestURL: config['change-template'].includes('$URL'), - withBaseRefName: config['change-template'].includes('$BASE_REF_NAME'), - withHeadRefName: config['change-template'].includes('$HEAD_REF_NAME'), + // redact must place before asChindings and only replace if exist + if ((typeof options.redact === 'object' && options.redact !== null) || Array.isArray(options.redact)) { + instance.redact = options.redact // replace redact directly + const stringifiers = redaction(instance.redact, stringify) + const formatOpts = { stringify: stringifiers[redactFmtSym] } + instance[stringifySym] = stringify + instance[stringifiersSym] = stringifiers + instance[formatOptsSym] = formatOpts } - const includePaths = config['include-paths'] - const dataPath = ['repository', 'object', 'history'] - const repoNameWithOwner = `${owner}/${repo}` - let data, - allCommits, - includedIds = {} + if (typeof options.msgPrefix === 'string') { + instance[msgPrefixSym] = (this[msgPrefixSym] || '') + options.msgPrefix + } - if (includePaths.length > 0) { - var anyChanges = false - for (const path of includePaths) { - const pathData = await paginate( - context.octokit.graphql, - findCommitsWithPathChangesQuery, - lastRelease - ? { ...variables, since: lastRelease.created_at, path } - : { ...variables, path }, - dataPath - ) - const commitsWithPathChanges = _.get(pathData, [...dataPath, 'nodes']) + instance[chindingsSym] = asChindings(instance, bindings) + const childLevel = options.level || this.level + instance[setLevelSym](childLevel) + this.onChild(instance) + return instance +} - includedIds[path] = includedIds[path] || new Set([]) - for (const { id } of commitsWithPathChanges) { - anyChanges = true - includedIds[path].add(id) - } - } +function bindings () { + const chindings = this[chindingsSym] + const chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" + const bindingsFromJson = JSON.parse(chindingsJson) + delete bindingsFromJson.pid + delete bindingsFromJson.hostname + return bindingsFromJson +} - if (!anyChanges) { - // Short circuit to avoid blowing GraphQL budget - return { commits: [], pullRequests: [] } - } - } +function setBindings (newBindings) { + const chindings = asChindings(this, newBindings) + this[chindingsSym] = chindings + delete this[parsedChindingsSym] +} - if (lastRelease) { - log({ - context, - message: `Fetching parent commits of ${targetCommitish} since ${lastRelease.created_at}`, - }) +/** + * Default strategy for creating `mergeObject` from arguments and the result from `mixin()`. + * Fields from `mergeObject` have higher priority in this strategy. + * + * @param {Object} mergeObject The object a user has supplied to the logging function. + * @param {Object} mixinObject The result of the `mixin` method. + * @return {Object} + */ +function defaultMixinMergeStrategy (mergeObject, mixinObject) { + return Object.assign(mixinObject, mergeObject) +} - data = await paginate( - context.octokit.graphql, - findCommitsWithAssociatedPullRequestsQuery, - { ...variables, since: lastRelease.created_at }, - dataPath - ) - // GraphQL call is inclusive of commits from the specified dates. This means the final - // commit from the last tag is included, so we remove this here. - allCommits = _.get(data, [...dataPath, 'nodes']).filter( - (commit) => commit.committedDate != lastRelease.created_at - ) +function write (_obj, msg, num) { + const t = this[timeSym]() + const mixin = this[mixinSym] + const errorKey = this[errorKeySym] + const messageKey = this[messageKeySym] + const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy + let obj + + if (_obj === undefined || _obj === null) { + obj = {} + } else if (_obj instanceof Error) { + obj = { [errorKey]: _obj } + if (msg === undefined) { + msg = _obj.message + } } else { - log({ context, message: `Fetching parent commits of ${targetCommitish}` }) + obj = _obj + if (msg === undefined && _obj[messageKey] === undefined && _obj[errorKey]) { + msg = _obj[errorKey].message + } + } - data = await paginate( - context.octokit.graphql, - findCommitsWithAssociatedPullRequestsQuery, - variables, - dataPath - ) - allCommits = _.get(data, [...dataPath, 'nodes']) + if (mixin) { + obj = mixinMergeStrategy(obj, mixin(obj, num, this)) } - const commits = - includePaths.length > 0 - ? allCommits.filter((commit) => - includePaths.some((path) => includedIds[path].has(commit.id)) - ) - : allCommits + const s = this[asJsonSym](obj, msg, num, t) - const pullRequests = _.uniqBy( - commits.flatMap((commit) => commit.associatedPullRequests.nodes), - 'number' - ).filter( - (pr) => pr.baseRepository.nameWithOwner === repoNameWithOwner && pr.merged - ) + const stream = this[streamSym] + if (stream[needsMetadataGsym] === true) { + stream.lastLevel = num + stream.lastObj = obj + stream.lastMsg = msg + stream.lastTime = t.slice(this[timeSliceIndexSym]) + stream.lastLogger = this // for child loggers + } + stream.write(s) +} - return { commits, pullRequests } +function noop () {} + +function flush () { + const stream = this[streamSym] + if ('flush' in stream) stream.flush(noop) } -exports.findCommitsWithAssociatedPullRequestsQuery = - findCommitsWithAssociatedPullRequestsQuery -exports.findCommitsWithPathChangesQuery = findCommitsWithPathChangesQuery +/***/ }), -exports.findCommitsWithAssociatedPullRequests = - findCommitsWithAssociatedPullRequests +/***/ 69565: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; -/***/ }), -/***/ 35378: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const fastRedact = __nccwpck_require__(7764) +const { redactFmtSym, wildcardFirstSym } = __nccwpck_require__(23689) +const { rx, validator } = fastRedact -const core = __nccwpck_require__(42186) -const Table = __nccwpck_require__(2101) -const { validateSchema } = __nccwpck_require__(72118) -const { log } = __nccwpck_require__(71911) -const { runnerIsActions } = __nccwpck_require__(98281) +const validate = validator({ + ERR_PATHS_MUST_BE_STRINGS: () => 'pino – redacted paths must be strings', + ERR_INVALID_PATH: (s) => `pino – redact paths array contains an invalid path (${s})` +}) -const DEFAULT_CONFIG_NAME = 'release-drafter.yml' +const CENSOR = '[Redacted]' +const strict = false // TODO should this be configurable? -async function getConfig({ context, configName }) { - try { - const repoConfig = await context.config( - configName || DEFAULT_CONFIG_NAME, - null - ) - if (repoConfig == null) { - const name = configName || DEFAULT_CONFIG_NAME - // noinspection ExceptionCaughtLocallyJS - throw new Error( - `Configuration file .github/${name} is not found. The configuration file must reside in your default branch.` - ) +function redaction (opts, serialize) { + const { paths, censor } = handle(opts) + + const shape = paths.reduce((o, str) => { + rx.lastIndex = 0 + const first = rx.exec(str) + const next = rx.exec(str) + + // ns is the top-level path segment, brackets + quoting removed. + let ns = first[1] !== undefined + ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, '$1') + : first[0] + + if (ns === '*') { + ns = wildcardFirstSym } - const config = validateSchema(context, repoConfig) + // top level key: + if (next === null) { + o[ns] = null + return o + } - return config - } catch (error) { - log({ context, error, message: 'Invalid config file' }) + // path with at least two segments: + // if ns is already redacted at the top level, ignore lower level redactions + if (o[ns] === null) { + return o + } - if (error.isJoi) { - log({ - context, - message: - 'Config validation errors, please fix the following issues in ' + - (configName || DEFAULT_CONFIG_NAME) + - ':\n' + - joiValidationErrorsAsTable(error), - }) + const { index } = next + const nextPath = `${str.substr(index, str.length - 1)}` + + o[ns] = o[ns] || [] + + // shape is a mix of paths beginning with literal values and wildcard + // paths [ "a.b.c", "*.b.z" ] should reduce to a shape of + // { "a": [ "b.c", "b.z" ], *: [ "b.z" ] } + // note: "b.z" is in both "a" and * arrays because "a" matches the wildcard. + // (* entry has wildcardFirstSym as key) + if (ns !== wildcardFirstSym && o[ns].length === 0) { + // first time ns's get all '*' redactions so far + o[ns].push(...(o[wildcardFirstSym] || [])) } - if (runnerIsActions()) { - core.setFailed('Invalid config file') + if (ns === wildcardFirstSym) { + // new * path gets added to all previously registered literal ns's. + Object.keys(o).forEach(function (k) { + if (o[k]) { + o[k].push(nextPath) + } + }) } - return null + + o[ns].push(nextPath) + return o + }, {}) + + // the redactor assigned to the format symbol key + // provides top level redaction for instances where + // an object is interpolated into the msg string + const result = { + [redactFmtSym]: fastRedact({ paths, censor, serialize, strict }) } + + const topCensor = (...args) => { + return typeof censor === 'function' ? serialize(censor(...args)) : serialize(censor) + } + + return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => { + // top level key: + if (shape[k] === null) { + o[k] = (value) => topCensor(value, [k]) + } else { + const wrappedCensor = typeof censor === 'function' + ? (value, path) => { + return censor(value, [k, ...path]) + } + : censor + o[k] = fastRedact({ + paths: shape[k], + censor: wrappedCensor, + serialize, + strict + }) + } + return o + }, result) } -function joiValidationErrorsAsTable(error) { - const table = new Table({ head: ['Property', 'Error'] }) - for (const { path, message } of error.details) { - const prettyPath = path - .map((pathPart) => - Number.isInteger(pathPart) ? `[${pathPart}]` : pathPart - ) - .join('.') - table.push([prettyPath, message]) +function handle (opts) { + if (Array.isArray(opts)) { + opts = { paths: opts, censor: CENSOR } + validate(opts) + return opts } - return table.toString() + let { paths, censor = CENSOR, remove } = opts + if (Array.isArray(paths) === false) { throw Error('pino – redact must contain an array of strings') } + if (remove === true) censor = undefined + validate({ paths, censor }) + + return { paths, censor } } -exports.getConfig = getConfig +module.exports = redaction /***/ }), -/***/ 85869: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 23689: +/***/ ((module) => { -const { SORT_BY, SORT_DIRECTIONS } = __nccwpck_require__(11940) +"use strict"; -const DEFAULT_CONFIG = Object.freeze({ - 'name-template': '', - 'tag-template': '', - 'tag-prefix': '', - 'change-template': `* $TITLE (#$NUMBER) @$AUTHOR`, - 'change-title-escapes': '', - 'no-changes-template': `* No changes`, - 'version-template': `$MAJOR.$MINOR.$PATCH`, - 'version-resolver': { - major: { labels: [] }, - minor: { labels: [] }, - patch: { labels: [] }, - default: 'patch', - }, - categories: [], - 'exclude-labels': [], - 'include-labels': [], - 'include-paths': [], - 'exclude-contributors': [], - 'no-contributors-template': 'No contributors', - replacers: [], - autolabeler: [], - 'sort-by': SORT_BY.mergedAt, - 'sort-direction': SORT_DIRECTIONS.descending, - prerelease: false, - latest: 'true', - 'filter-by-commitish': false, - 'include-pre-releases': false, - commitish: '', - 'category-template': `## $TITLE`, - header: '', - footer: '', -}) -exports.DEFAULT_CONFIG = DEFAULT_CONFIG +const setLevelSym = Symbol('pino.setLevel') +const getLevelSym = Symbol('pino.getLevel') +const levelValSym = Symbol('pino.levelVal') +const useLevelLabelsSym = Symbol('pino.useLevelLabels') +const useOnlyCustomLevelsSym = Symbol('pino.useOnlyCustomLevels') +const mixinSym = Symbol('pino.mixin') +const lsCacheSym = Symbol('pino.lsCache') +const chindingsSym = Symbol('pino.chindings') -/***/ }), +const asJsonSym = Symbol('pino.asJson') +const writeSym = Symbol('pino.write') +const redactFmtSym = Symbol('pino.redactFmt') -/***/ 71911: -/***/ ((__unused_webpack_module, exports) => { +const timeSym = Symbol('pino.time') +const timeSliceIndexSym = Symbol('pino.timeSliceIndex') +const streamSym = Symbol('pino.stream') +const stringifySym = Symbol('pino.stringify') +const stringifySafeSym = Symbol('pino.stringifySafe') +const stringifiersSym = Symbol('pino.stringifiers') +const endSym = Symbol('pino.end') +const formatOptsSym = Symbol('pino.formatOpts') +const messageKeySym = Symbol('pino.messageKey') +const errorKeySym = Symbol('pino.errorKey') +const nestedKeySym = Symbol('pino.nestedKey') +const nestedKeyStrSym = Symbol('pino.nestedKeyStr') +const mixinMergeStrategySym = Symbol('pino.mixinMergeStrategy') +const msgPrefixSym = Symbol('pino.msgPrefix') -const log = ({ context, message, error }) => { - const repo = context.payload.repository - const prefix = repo ? `${repo.full_name}: ` : '' - const logString = `${prefix}${message}` - if (error) { - context.log.warn(error, logString) - } else { - context.log.info(logString) - } -} +const wildcardFirstSym = Symbol('pino.wildcardFirst') -exports.log = log +// public symbols, no need to use the same pino +// version for these +const serializersSym = Symbol.for('pino.serializers') +const formattersSym = Symbol.for('pino.formatters') +const hooksSym = Symbol.for('pino.hooks') +const needsMetadataGsym = Symbol.for('pino.metadata') + +module.exports = { + setLevelSym, + getLevelSym, + levelValSym, + useLevelLabelsSym, + mixinSym, + lsCacheSym, + chindingsSym, + asJsonSym, + writeSym, + serializersSym, + redactFmtSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifySafeSym, + stringifiersSym, + endSym, + formatOptsSym, + messageKeySym, + errorKeySym, + nestedKeySym, + wildcardFirstSym, + needsMetadataGsym, + useOnlyCustomLevelsSym, + formattersSym, + hooksSym, + nestedKeyStrSym, + mixinMergeStrategySym, + msgPrefixSym +} /***/ }), -/***/ 46418: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 97040: +/***/ ((module) => { -const _ = __nccwpck_require__(90250) +"use strict"; -/** - * Utility function to paginate a GraphQL function using Relay-style cursor pagination. - * - * @param {Function} queryFn - function used to query the GraphQL API - * @param {string} query - GraphQL query, must include `nodes` and `pageInfo` fields for the field that will be paginated - * @param {Object} variables - * @param {string[]} paginatePath - path to field to paginate - */ -async function paginate(queryFunction, query, variables, paginatePath) { - const nodesPath = [...paginatePath, 'nodes'] - const pageInfoPath = [...paginatePath, 'pageInfo'] - const endCursorPath = [...pageInfoPath, 'endCursor'] - const hasNextPagePath = [...pageInfoPath, 'hasNextPage'] - const hasNextPage = (data) => _.get(data, hasNextPagePath) - let data = await queryFunction(query, variables) +const nullTime = () => '' - if (!_.has(data, nodesPath)) { - throw new Error( - "Data doesn't contain `nodes` field. Make sure the `paginatePath` is set to the field you wish to paginate and that the query includes the `nodes` field." - ) - } +const epochTime = () => `,"time":${Date.now()}` - if ( - !_.has(data, pageInfoPath) || - !_.has(data, endCursorPath) || - !_.has(data, hasNextPagePath) - ) { - throw new Error( - "Data doesn't contain `pageInfo` field with `endCursor` and `hasNextPage` fields. Make sure the `paginatePath` is set to the field you wish to paginate and that the query includes the `pageInfo` field." - ) - } +const unixTime = () => `,"time":${Math.round(Date.now() / 1000.0)}` - while (hasNextPage(data)) { - const newData = await queryFunction(query, { - ...variables, - after: _.get(data, [...pageInfoPath, 'endCursor']), - }) - const newNodes = _.get(newData, nodesPath) - const newPageInfo = _.get(newData, pageInfoPath) +const isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"` // using Date.now() for testability - _.set(data, pageInfoPath, newPageInfo) - _.update(data, nodesPath, (d) => [...d, ...newNodes]) - } +module.exports = { nullTime, epochTime, unixTime, isoTime } - return data -} -exports.paginate = paginate +/***/ }), +/***/ 73047: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -/***/ }), +"use strict"; -/***/ 96402: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -const compareVersions = __nccwpck_require__(89296) -const regexEscape = __nccwpck_require__(98691) +/* eslint no-prototype-builtins: 0 */ -const { getVersionInfo } = __nccwpck_require__(49914) -const { template } = __nccwpck_require__(47282) -const { log } = __nccwpck_require__(71911) +const format = __nccwpck_require__(5933) +const { mapHttpRequest, mapHttpResponse } = __nccwpck_require__(39761) +const SonicBoom = __nccwpck_require__(27412) +const onExit = __nccwpck_require__(39660) +const { + lsCacheSym, + chindingsSym, + writeSym, + serializersSym, + formatOptsSym, + endSym, + stringifiersSym, + stringifySym, + stringifySafeSym, + wildcardFirstSym, + nestedKeySym, + formattersSym, + messageKeySym, + errorKeySym, + nestedKeyStrSym, + msgPrefixSym +} = __nccwpck_require__(23689) +const { isMainThread } = __nccwpck_require__(71267) +const transport = __nccwpck_require__(56846) -const sortReleases = (releases, tagPrefix) => { - // For semver, we find the greatest release number - // For non-semver, we use the most recently merged - try { - const tagPrefixRexExp = new RegExp(`^${regexEscape(tagPrefix)}`) - return releases.sort((r1, r2) => - compareVersions( - r1.tag_name.replace(tagPrefixRexExp, ''), - r2.tag_name.replace(tagPrefixRexExp, '') - ) - ) - } catch { - return releases.sort( - (r1, r2) => new Date(r1.created_at) - new Date(r2.created_at) - ) - } +function noop () { } -// GitHub API currently returns a 500 HTTP response if you attempt to fetch over 1000 releases. -const RELEASE_COUNT_LIMIT = 1000 - -const findReleases = async ({ - context, - targetCommitish, - filterByCommitish, - includePreReleases, - tagPrefix, -}) => { - let releaseCount = 0 - let releases = await context.octokit.paginate( - context.octokit.repos.listReleases.endpoint.merge( - context.repo({ - per_page: 100, - }) - ), - (response, done) => { - releaseCount += response.data.length - if (releaseCount >= RELEASE_COUNT_LIMIT) { - done() - } - return response.data - } - ) +function genLog (level, hook) { + if (!hook) return LOG - log({ context, message: `Found ${releases.length} releases` }) + return function hookWrappedLog (...args) { + hook.call(this, args, LOG, level) + } - // `refs/heads/branch` and `branch` are the same thing in this context - const headRefRegex = /^refs\/heads\// - const targetCommitishName = targetCommitish.replace(headRefRegex, '') - const commitishFilteredReleases = filterByCommitish - ? releases.filter( - (r) => - targetCommitishName === r.target_commitish.replace(headRefRegex, '') - ) - : releases - const filteredReleases = tagPrefix - ? commitishFilteredReleases.filter((r) => r.tag_name.startsWith(tagPrefix)) - : commitishFilteredReleases - const sortedSelectedReleases = sortReleases( - filteredReleases.filter( - (r) => !r.draft && (!r.prerelease || includePreReleases) - ), - tagPrefix - ) - const draftRelease = filteredReleases.find((r) => r.draft) - const lastRelease = sortedSelectedReleases[sortedSelectedReleases.length - 1] + function LOG (o, ...n) { + if (typeof o === 'object') { + let msg = o + if (o !== null) { + if (o.method && o.headers && o.socket) { + o = mapHttpRequest(o) + } else if (typeof o.setHeader === 'function') { + o = mapHttpResponse(o) + } + } + let formatParams + if (msg === null && n.length === 0) { + formatParams = [null] + } else { + msg = n.shift() + formatParams = n + } + // We do not use a coercive check for `msg` as it is + // measurably slower than the explicit checks. + if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { + msg = this[msgPrefixSym] + msg + } + this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level) + } else { + let msg = o === undefined ? n.shift() : o - if (draftRelease) { - log({ context, message: `Draft release: ${draftRelease.tag_name}` }) - } else { - log({ context, message: `No draft release found` }) + // We do not use a coercive check for `msg` as it is + // measurably slower than the explicit checks. + if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { + msg = this[msgPrefixSym] + msg + } + this[writeSym](null, format(msg, n, this[formatOptsSym]), level) + } } +} - if (lastRelease) { - log({ context, message: `Last release: ${lastRelease.tag_name}` }) +// magically escape strings for json +// relying on their charCodeAt +// everything below 32 needs JSON.stringify() +// 34 and 92 happens all the time, so we +// have a fast case for them +function asString (str) { + let result = '' + let last = 0 + let found = false + let point = 255 + const l = str.length + if (l > 100) { + return JSON.stringify(str) + } + for (var i = 0; i < l && point >= 32; i++) { + point = str.charCodeAt(i) + if (point === 34 || point === 92) { + result += str.slice(last, i) + '\\' + last = i + found = true + } + } + if (!found) { + result = str } else { - log({ context, message: `No last release found` }) + result += str.slice(last) } - - return { draftRelease, lastRelease } + return point < 32 ? JSON.stringify(str) : '"' + result + '"' } -const contributorsSentence = ({ commits, pullRequests, config }) => { - const { 'exclude-contributors': excludeContributors } = config +function asJson (obj, msg, num, time) { + const stringify = this[stringifySym] + const stringifySafe = this[stringifySafeSym] + const stringifiers = this[stringifiersSym] + const end = this[endSym] + const chindings = this[chindingsSym] + const serializers = this[serializersSym] + const formatters = this[formattersSym] + const messageKey = this[messageKeySym] + const errorKey = this[errorKeySym] + let data = this[lsCacheSym][num] + time - const contributors = new Set() + // we need the child bindings added to the output first so instance logged + // objects can take precedence when JSON.parse-ing the resulting log line + data = data + chindings - for (const commit of commits) { - if (commit.author.user) { - if (!excludeContributors.includes(commit.author.user.login)) { - contributors.add(`@${commit.author.user.login}`) + let value + if (formatters.log) { + obj = formatters.log(obj) + } + const wildcardStringifier = stringifiers[wildcardFirstSym] + let propStr = '' + for (const key in obj) { + value = obj[key] + if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) { + if (serializers[key]) { + value = serializers[key](value) + } else if (key === errorKey && serializers.err) { + value = serializers.err(value) } - } else { - contributors.add(commit.author.name) + + const stringifier = stringifiers[key] || wildcardStringifier + + switch (typeof value) { + case 'undefined': + case 'function': + continue + case 'number': + /* eslint no-fallthrough: "off" */ + if (Number.isFinite(value) === false) { + value = null + } + // this case explicitly falls through to the next one + case 'boolean': + if (stringifier) value = stringifier(value) + break + case 'string': + value = (stringifier || asString)(value) + break + default: + value = (stringifier || stringify)(value, stringifySafe) + } + if (value === undefined) continue + const strKey = asString(key) + propStr += ',' + strKey + ':' + value } } - for (const pullRequest of pullRequests) { - if ( - pullRequest.author && - !excludeContributors.includes(pullRequest.author.login) - ) { - contributors.add(`@${pullRequest.author.login}`) + let msgStr = '' + if (msg !== undefined) { + value = serializers[messageKey] ? serializers[messageKey](msg) : msg + const stringifier = stringifiers[messageKey] || wildcardStringifier + + switch (typeof value) { + case 'function': + break + case 'number': + /* eslint no-fallthrough: "off" */ + if (Number.isFinite(value) === false) { + value = null + } + // this case explicitly falls through to the next one + case 'boolean': + if (stringifier) value = stringifier(value) + msgStr = ',"' + messageKey + '":' + value + break + case 'string': + value = (stringifier || asString)(value) + msgStr = ',"' + messageKey + '":' + value + break + default: + value = (stringifier || stringify)(value, stringifySafe) + msgStr = ',"' + messageKey + '":' + value } } - const sortedContributors = [...contributors].sort() - if (sortedContributors.length > 1) { - return ( - sortedContributors.slice(0, -1).join(', ') + - ' and ' + - sortedContributors.slice(-1) - ) - } else if (sortedContributors.length === 1) { - return sortedContributors[0] + if (this[nestedKeySym] && propStr) { + // place all the obj properties under the specified key + // the nested key is already formatted from the constructor + return data + this[nestedKeyStrSym] + propStr.slice(1) + '}' + msgStr + end } else { - return config['no-contributors-template'] + return data + propStr + msgStr + end } } -const getFilterExcludedPullRequests = (excludeLabels) => { - return (pullRequest) => { - const labels = pullRequest.labels.nodes - if (labels.some((label) => excludeLabels.includes(label.name))) { - return false - } - return true - } -} +function asChindings (instance, bindings) { + let value + let data = instance[chindingsSym] + const stringify = instance[stringifySym] + const stringifySafe = instance[stringifySafeSym] + const stringifiers = instance[stringifiersSym] + const wildcardStringifier = stringifiers[wildcardFirstSym] + const serializers = instance[serializersSym] + const formatter = instance[formattersSym].bindings + bindings = formatter(bindings) -const getFilterIncludedPullRequests = (includeLabels) => { - return (pullRequest) => { - const labels = pullRequest.labels.nodes - if ( - includeLabels.length === 0 || - labels.some((label) => includeLabels.includes(label.name)) - ) { - return true + for (const key in bindings) { + value = bindings[key] + const valid = key !== 'level' && + key !== 'serializers' && + key !== 'formatters' && + key !== 'customLevels' && + bindings.hasOwnProperty(key) && + value !== undefined + if (valid === true) { + value = serializers[key] ? serializers[key](value) : value + value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe) + if (value === undefined) continue + data += ',"' + key + '":' + value } - return false } + return data } -const categorizePullRequests = (pullRequests, config) => { - const { - 'exclude-labels': excludeLabels, - 'include-labels': includeLabels, - categories, - } = config - const allCategoryLabels = new Set( - categories.flatMap((category) => category.labels) - ) - const uncategorizedPullRequests = [] - const categorizedPullRequests = [...categories].map((category) => { - return { ...category, pullRequests: [] } - }) - - const uncategorizedCategoryIndex = categories.findIndex( - (category) => category.labels.length === 0 - ) +function hasBeenTampered (stream) { + return stream.write !== stream.constructor.prototype.write +} - const filterUncategorizedPullRequests = (pullRequest) => { - const labels = pullRequest.labels.nodes +function buildSafeSonicBoom (opts) { + const stream = new SonicBoom(opts) + stream.on('error', filterBrokenPipe) + // if we are sync: false, we must flush on exit + if (!opts.sync && isMainThread) { + onExit.register(stream, autoEnd) - if ( - labels.length === 0 || - !labels.some((label) => allCategoryLabels.has(label.name)) - ) { - if (uncategorizedCategoryIndex === -1) { - uncategorizedPullRequests.push(pullRequest) - } else { - categorizedPullRequests[uncategorizedCategoryIndex].pullRequests.push( - pullRequest - ) - } - return false - } - return true + stream.on('close', function () { + onExit.unregister(stream) + }) } + return stream - // we only want pull requests that have yet to be categorized - const filteredPullRequests = pullRequests - .filter(getFilterExcludedPullRequests(excludeLabels)) - .filter(getFilterIncludedPullRequests(includeLabels)) - .filter((pullRequest) => filterUncategorizedPullRequests(pullRequest)) - - for (const category of categorizedPullRequests) { - for (const pullRequest of filteredPullRequests) { - // lets categorize some pull request based on labels - // note that having the same label in multiple categories - // then it is intended to "duplicate" the pull request into each category - const labels = pullRequest.labels.nodes - if (labels.some((label) => category.labels.includes(label.name))) { - category.pullRequests.push(pullRequest) - } + function filterBrokenPipe (err) { + // Impossible to replicate across all operating systems + /* istanbul ignore next */ + if (err.code === 'EPIPE') { + // If we get EPIPE, we should stop logging here + // however we have no control to the consumer of + // SonicBoom, so we just overwrite the write method + stream.write = noop + stream.end = noop + stream.flushSync = noop + stream.destroy = noop + return } + stream.removeListener('error', filterBrokenPipe) + stream.emit('error', err) } - - return [uncategorizedPullRequests, categorizedPullRequests] } -const generateChangeLog = (mergedPullRequests, config) => { - if (mergedPullRequests.length === 0) { - return config['no-changes-template'] +function autoEnd (stream, eventName) { + // This check is needed only on some platforms + /* istanbul ignore next */ + if (stream.destroyed) { + return } - const [uncategorizedPullRequests, categorizedPullRequests] = - categorizePullRequests(mergedPullRequests, config) + if (eventName === 'beforeExit') { + // We still have an event loop, let's use it + stream.flush() + stream.on('drain', function () { + stream.end() + }) + } else { + // For some reason istanbul is not detecting this, but it's there + /* istanbul ignore next */ + // We do not have an event loop, so flush synchronously + stream.flushSync() + } +} - const escapeTitle = (title) => - // If config['change-title-escapes'] contains backticks, then they will be escaped along with content contained inside backticks - // If not, the entire backtick block is matched so that it will become a markdown code block without escaping any of its content - title.replace( - new RegExp( - `[${regexEscape(config['change-title-escapes'])}]|\`.*?\``, - 'g' - ), - (match) => { - if (match.length > 1) return match - if (match == '@' || match == '#') return `${match}` - return `\\${match}` +function createArgsNormalizer (defaultOptions) { + return function normalizeArgs (instance, caller, opts = {}, stream) { + // support stream as a string + if (typeof opts === 'string') { + stream = buildSafeSonicBoom({ dest: opts }) + opts = {} + } else if (typeof stream === 'string') { + if (opts && opts.transport) { + throw Error('only one of option.transport or stream can be specified') + } + stream = buildSafeSonicBoom({ dest: stream }) + } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { + stream = opts + opts = {} + } else if (opts.transport) { + if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) { + throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') + } + if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') { + throw Error('option.transport.targets do not allow custom level formatters') } - ) - const pullRequestToString = (pullRequests) => - pullRequests - .map((pullRequest) => - template(config['change-template'], { - $TITLE: escapeTitle(pullRequest.title), - $NUMBER: pullRequest.number, - $AUTHOR: pullRequest.author ? pullRequest.author.login : 'ghost', - $BODY: pullRequest.body, - $URL: pullRequest.url, - $BASE_REF_NAME: pullRequest.baseRefName, - $HEAD_REF_NAME: pullRequest.headRefName, - }) - ) - .join('\n') + let customLevels + if (opts.customLevels) { + customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels) + } + stream = transport({ caller, ...opts.transport, levels: customLevels }) + } + opts = Object.assign({}, defaultOptions, opts) + opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers) + opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters) - const changeLog = [] + if (opts.prettyPrint) { + throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)') + } - if (uncategorizedPullRequests.length > 0) { - changeLog.push(pullRequestToString(uncategorizedPullRequests), '\n\n') + const { enabled, onChild } = opts + if (enabled === false) opts.level = 'silent' + if (!onChild) opts.onChild = noop + if (!stream) { + if (!hasBeenTampered(process.stdout)) { + // If process.stdout.fd is undefined, it means that we are running + // in a worker thread. Let's assume we are logging to file descriptor 1. + stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 }) + } else { + stream = process.stdout + } + } + return { opts, stream } } +} - for (const [index, category] of categorizedPullRequests.entries()) { - if (category.pullRequests.length === 0) { - continue +function stringify (obj, stringifySafeFn) { + try { + return JSON.stringify(obj) + } catch (_) { + try { + const stringify = stringifySafeFn || this[stringifySafeSym] + return stringify(obj) + } catch (_) { + return '"[unable to serialize, circular reference is too complex to analyze]"' } + } +} - // Add the category title to the changelog. - changeLog.push( - template(config['category-template'], { $TITLE: category.title }), - '\n\n' - ) +function buildFormatters (level, bindings, log) { + return { + level, + bindings, + log + } +} - // Define the pull requests into a single string. - const pullRequestString = pullRequestToString(category.pullRequests) +/** + * Convert a string integer file descriptor to a proper native integer + * file descriptor. + * + * @param {string} destination The file descriptor string to attempt to convert. + * + * @returns {Number} + */ +function normalizeDestFileDescriptor (destination) { + const fd = Number(destination) + if (typeof destination === 'string' && Number.isFinite(fd)) { + return fd + } + // destination could be undefined if we are in a worker + if (destination === undefined) { + // This is stdout in UNIX systems + return 1 + } + return destination +} - // Determine the collapse status. - const shouldCollapse = - category['collapse-after'] !== 0 && - category.pullRequests.length > category['collapse-after'] +module.exports = { + noop, + buildSafeSonicBoom, + asChindings, + asJson, + genLog, + createArgsNormalizer, + stringify, + buildFormatters, + normalizeDestFileDescriptor +} - // Add the pull requests to the changelog. - if (shouldCollapse) { - changeLog.push( - '
', - '\n', - `${category.pullRequests.length} changes`, - '\n\n', - pullRequestString, - '\n', - '
' - ) - } else { - changeLog.push(pullRequestString) - } - if (index + 1 !== categorizedPullRequests.length) changeLog.push('\n\n') - } +/***/ }), - return changeLog.join('').trim() -} +/***/ 56846: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const resolveVersionKeyIncrement = (mergedPullRequests, config) => { - const priorityMap = { - patch: 1, - minor: 2, - major: 3, - } - const labelToKeyMap = Object.fromEntries( - Object.keys(priorityMap) - .flatMap((key) => [ - config['version-resolver'][key].labels.map((label) => [label, key]), - ]) - .flat() - ) - const keys = mergedPullRequests - .filter(getFilterExcludedPullRequests(config['exclude-labels'])) - .filter(getFilterIncludedPullRequests(config['include-labels'])) - .flatMap((pr) => pr.labels.nodes.map((node) => labelToKeyMap[node.name])) - .filter(Boolean) - const keyPriorities = keys.map((key) => priorityMap[key]) - const priority = Math.max(...keyPriorities) - const versionKey = Object.keys(priorityMap).find( - (key) => priorityMap[key] === priority - ) - return versionKey || config['version-resolver'].default -} +"use strict"; -const generateReleaseInfo = ({ - context, - commits, - config, - lastRelease, - mergedPullRequests, - version, - tag, - name, - isPreRelease, - latest, - shouldDraft, - targetCommitish, -}) => { - const { owner, repo } = context.repo() - let body = config['header'] + config.template + config['footer'] - body = template( - body, - { - $PREVIOUS_TAG: lastRelease ? lastRelease.tag_name : '', - $CHANGES: generateChangeLog(mergedPullRequests, config), - $CONTRIBUTORS: contributorsSentence({ - commits, - pullRequests: mergedPullRequests, - config, - }), - $OWNER: owner, - $REPOSITORY: repo, - }, - config.replacers - ) +const { createRequire } = __nccwpck_require__(98188) +const getCallers = __nccwpck_require__(50023) +const { join, isAbsolute, sep } = __nccwpck_require__(71017) +const sleep = __nccwpck_require__(86950) +const onExit = __nccwpck_require__(39660) +const ThreadStream = __nccwpck_require__(78366) - const versionInfo = getVersionInfo( - lastRelease, - config['version-template'], - // Use the first override parameter to identify - // a version, from the most accurate to the least - version || tag || name, - resolveVersionKeyIncrement(mergedPullRequests, config), - config['tag-prefix'] - ) +function setupOnExit (stream) { + // This is leak free, it does not leave event handlers + onExit.register(stream, autoEnd) + onExit.registerBeforeExit(stream, flush) - if (versionInfo) { - body = template(body, versionInfo) - } + stream.on('close', function () { + onExit.unregister(stream) + }) +} - if (tag === undefined) { - tag = versionInfo ? template(config['tag-template'] || '', versionInfo) : '' - } else if (versionInfo) { - tag = template(tag, versionInfo) - } +function buildStream (filename, workerData, workerOpts) { + const stream = new ThreadStream({ + filename, + workerData, + workerOpts + }) + + stream.on('ready', onReady) + stream.on('close', function () { + process.removeListener('exit', onExit) + }) - if (name === undefined) { - name = versionInfo - ? template(config['name-template'] || '', versionInfo) - : '' - } else if (versionInfo) { - name = template(name, versionInfo) - } + process.on('exit', onExit) - // Tags are not supported as `target_commitish` by Github API. - // GITHUB_REF or the ref from webhook start with `refs/tags/`, so we handle - // those here. If it doesn't but is still a tag - it must have been set - // explicitly by the user, so it's fair to just let the API respond with an error. - if (targetCommitish.startsWith('refs/tags/')) { - log({ - context, - message: `${targetCommitish} is not supported as release target, falling back to default branch`, - }) - targetCommitish = '' - } + function onReady () { + process.removeListener('exit', onExit) + stream.unref() - let resolvedVersion = versionInfo.$RESOLVED_VERSION.version - let majorVersion = versionInfo.$RESOLVED_VERSION.$MAJOR - let minorVersion = versionInfo.$RESOLVED_VERSION.$MINOR - let patchVersion = versionInfo.$RESOLVED_VERSION.$PATCH + if (workerOpts.autoEnd !== false) { + setupOnExit(stream) + } + } - return { - name, - tag, - body, - targetCommitish, - prerelease: isPreRelease, - make_latest: latest, - draft: shouldDraft, - resolvedVersion, - majorVersion, - minorVersion, - patchVersion, + function onExit () { + /* istanbul ignore next */ + if (stream.closed) { + return + } + stream.flushSync() + // Apparently there is a very sporadic race condition + // that in certain OS would prevent the messages to be flushed + // because the thread might not have been created still. + // Unfortunately we need to sleep(100) in this case. + sleep(100) + stream.end() } -} -const createRelease = ({ context, releaseInfo }) => { - return context.octokit.repos.createRelease( - context.repo({ - target_commitish: releaseInfo.targetCommitish, - name: releaseInfo.name, - tag_name: releaseInfo.tag, - body: releaseInfo.body, - draft: releaseInfo.draft, - prerelease: releaseInfo.prerelease, - make_latest: releaseInfo.make_latest, - }) - ) + return stream } -const updateRelease = ({ context, draftRelease, releaseInfo }) => { - const updateReleaseParameters = updateDraftReleaseParameters({ - name: releaseInfo.name || draftRelease.name, - tag_name: releaseInfo.tag || draftRelease.tag_name, - target_commitish: releaseInfo.targetCommitish, +function autoEnd (stream) { + stream.ref() + stream.flushSync() + stream.end() + stream.once('close', function () { + stream.unref() }) +} - return context.octokit.repos.updateRelease( - context.repo({ - release_id: draftRelease.id, - body: releaseInfo.body, - draft: releaseInfo.draft, - prerelease: releaseInfo.prerelease, - make_latest: releaseInfo.make_latest, - ...updateReleaseParameters, - }) - ) +function flush (stream) { + stream.flushSync() } -function updateDraftReleaseParameters(parameters) { - const updateReleaseParameters = { ...parameters } +function transport (fullOptions) { + const { pipeline, targets, levels, dedupe, options = {}, worker = {}, caller = getCallers() } = fullOptions - // Let GitHub figure out `name` and `tag_name` if undefined - if (!updateReleaseParameters.name) { - delete updateReleaseParameters.name + // Backwards compatibility + const callers = typeof caller === 'string' ? [caller] : caller + + // This will be eventually modified by bundlers + const bundlerOverrides = '__bundlerPathsOverrides' in globalThis ? globalThis.__bundlerPathsOverrides : {} + + let target = fullOptions.target + + if (target && targets) { + throw new Error('only one of target or targets can be specified') } - if (!updateReleaseParameters.tag_name) { - delete updateReleaseParameters.tag_name + + if (targets) { + target = bundlerOverrides['pino-worker'] || __nccwpck_require__.ab + "worker.js" + options.targets = targets.map((dest) => { + return { + ...dest, + target: fixTarget(dest.target) + } + }) + } else if (pipeline) { + target = bundlerOverrides['pino-pipeline-worker'] || __nccwpck_require__.ab + "worker-pipeline.js" + options.targets = pipeline.map((dest) => { + return { + ...dest, + target: fixTarget(dest.target) + } + }) } - // Keep existing `target_commitish` if not overriden - // (sending `null` resets it to the default branch) - if (!updateReleaseParameters.target_commitish) { - delete updateReleaseParameters.target_commitish + if (levels) { + options.levels = levels } - return updateReleaseParameters -} + if (dedupe) { + options.dedupe = dedupe + } -exports.findReleases = findReleases -exports.generateChangeLog = generateChangeLog -exports.generateReleaseInfo = generateReleaseInfo -exports.createRelease = createRelease -exports.updateRelease = updateRelease + return buildStream(fixTarget(target), options, worker) + function fixTarget (origin) { + origin = bundlerOverrides[origin] || origin -/***/ }), + if (isAbsolute(origin) || origin.indexOf('file://') === 0) { + return origin + } -/***/ 72118: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (origin === 'pino/file') { + return __nccwpck_require__.ab + "file.js" + } -const _ = __nccwpck_require__(90250) -const Joi = __nccwpck_require__(20918) -const { SORT_BY, SORT_DIRECTIONS } = __nccwpck_require__(11940) -const { DEFAULT_CONFIG } = __nccwpck_require__(85869) -const { - validateReplacers, - validateAutolabeler, - validateCategories, -} = __nccwpck_require__(47282) -const merge = __nccwpck_require__(56323) + let fixTarget -const schema = (context) => { - const defaultBranch = _.get( - context, - 'payload.repository.default_branch', - 'master' - ) - return Joi.object() - .keys({ - references: Joi.array().items(Joi.string()).default([defaultBranch]), + for (const filePath of callers) { + try { + const context = filePath === 'node:repl' + ? process.cwd() + sep + : filePath - 'change-template': Joi.string().default( - DEFAULT_CONFIG['change-template'] - ), + fixTarget = createRequire(context).resolve(origin) + break + } catch (err) { + // Silent catch + continue + } + } - 'change-title-escapes': Joi.string() - .allow('') - .default(DEFAULT_CONFIG['change-title-escapes']), + if (!fixTarget) { + throw new Error(`unable to determine transport target for "${origin}"`) + } - 'no-changes-template': Joi.string().default( - DEFAULT_CONFIG['no-changes-template'] - ), + return fixTarget + } +} - 'version-template': Joi.string().default( - DEFAULT_CONFIG['version-template'] - ), +module.exports = transport - 'name-template': Joi.string() - .allow('') - .default(DEFAULT_CONFIG['name-template']), - 'tag-prefix': Joi.string() - .allow('') - .default(DEFAULT_CONFIG['tag-prefix']), +/***/ }), - 'tag-template': Joi.string() - .allow('') - .default(DEFAULT_CONFIG['tag-template']), +/***/ 77708: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - 'exclude-labels': Joi.array() - .items(Joi.string()) - .default(DEFAULT_CONFIG['exclude-labels']), +"use strict"; - 'include-labels': Joi.array() - .items(Joi.string()) - .default(DEFAULT_CONFIG['include-labels']), +/* eslint no-prototype-builtins: 0 */ +const os = __nccwpck_require__(22037) +const stdSerializers = __nccwpck_require__(39761) +const caller = __nccwpck_require__(50023) +const redaction = __nccwpck_require__(69565) +const time = __nccwpck_require__(97040) +const proto = __nccwpck_require__(2732) +const symbols = __nccwpck_require__(23689) +const { configure } = __nccwpck_require__(37560) +const { assertDefaultLevelFound, mappings, genLsCache, levels } = __nccwpck_require__(35662) +const { + createArgsNormalizer, + asChindings, + buildSafeSonicBoom, + buildFormatters, + stringify, + normalizeDestFileDescriptor, + noop +} = __nccwpck_require__(73047) +const { version } = __nccwpck_require__(935) +const { + chindingsSym, + redactFmtSym, + serializersSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifySafeSym, + stringifiersSym, + setLevelSym, + endSym, + formatOptsSym, + messageKeySym, + errorKeySym, + nestedKeySym, + mixinSym, + useOnlyCustomLevelsSym, + formattersSym, + hooksSym, + nestedKeyStrSym, + mixinMergeStrategySym, + msgPrefixSym +} = symbols +const { epochTime, nullTime } = time +const { pid } = process +const hostname = os.hostname() +const defaultErrorSerializer = stdSerializers.err +const defaultOptions = { + level: 'info', + levels, + messageKey: 'msg', + errorKey: 'err', + nestedKey: null, + enabled: true, + base: { pid, hostname }, + serializers: Object.assign(Object.create(null), { + err: defaultErrorSerializer + }), + formatters: Object.assign(Object.create(null), { + bindings (bindings) { + return bindings + }, + level (label, number) { + return { level: number } + } + }), + hooks: { + logMethod: undefined + }, + timestamp: epochTime, + name: undefined, + redact: null, + customLevels: null, + useOnlyCustomLevels: false, + depthLimit: 5, + edgeLimit: 100 +} - 'include-paths': Joi.array() - .items(Joi.string()) - .default(DEFAULT_CONFIG['include-paths']), +const normalize = createArgsNormalizer(defaultOptions) - 'exclude-contributors': Joi.array() - .items(Joi.string()) - .default(DEFAULT_CONFIG['exclude-contributors']), +const serializers = Object.assign(Object.create(null), stdSerializers) - 'no-contributors-template': Joi.string().default( - DEFAULT_CONFIG['no-contributors-template'] - ), +function pino (...args) { + const instance = {} + const { opts, stream } = normalize(instance, caller(), ...args) + const { + redact, + crlf, + serializers, + timestamp, + messageKey, + errorKey, + nestedKey, + base, + name, + level, + customLevels, + mixin, + mixinMergeStrategy, + useOnlyCustomLevels, + formatters, + hooks, + depthLimit, + edgeLimit, + onChild, + msgPrefix + } = opts - 'sort-by': Joi.string() - .valid(SORT_BY.mergedAt, SORT_BY.title) - .default(DEFAULT_CONFIG['sort-by']), + const stringifySafe = configure({ + maximumDepth: depthLimit, + maximumBreadth: edgeLimit + }) - 'sort-direction': Joi.string() - .valid(SORT_DIRECTIONS.ascending, SORT_DIRECTIONS.descending) - .default(DEFAULT_CONFIG['sort-direction']), + const allFormatters = buildFormatters( + formatters.level, + formatters.bindings, + formatters.log + ) - prerelease: Joi.boolean().default(DEFAULT_CONFIG.prerelease), + const stringifyFn = stringify.bind({ + [stringifySafeSym]: stringifySafe + }) + const stringifiers = redact ? redaction(redact, stringifyFn) : {} + const formatOpts = redact + ? { stringify: stringifiers[redactFmtSym] } + : { stringify: stringifyFn } + const end = '}' + (crlf ? '\r\n' : '\n') + const coreChindings = asChindings.bind(null, { + [chindingsSym]: '', + [serializersSym]: serializers, + [stringifiersSym]: stringifiers, + [stringifySym]: stringify, + [stringifySafeSym]: stringifySafe, + [formattersSym]: allFormatters + }) - latest: Joi.string() - .allow('', 'true', 'false', 'legacy') - .default(DEFAULT_CONFIG.latest), + let chindings = '' + if (base !== null) { + if (name === undefined) { + chindings = coreChindings(base) + } else { + chindings = coreChindings(Object.assign({}, base, { name })) + } + } - 'filter-by-commitish': Joi.boolean().default( - DEFAULT_CONFIG['filter-by-commitish'] - ), + const time = (timestamp instanceof Function) + ? timestamp + : (timestamp ? epochTime : nullTime) + const timeSliceIndex = time().indexOf(':') + 1 - 'include-pre-releases': Joi.boolean().default( - DEFAULT_CONFIG['include-pre-releases'] - ), + if (useOnlyCustomLevels && !customLevels) throw Error('customLevels is required if useOnlyCustomLevels is set true') + if (mixin && typeof mixin !== 'function') throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`) + if (msgPrefix && typeof msgPrefix !== 'string') throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`) - commitish: Joi.string().allow('').default(DEFAULT_CONFIG['commitish']), + assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels) + const levels = mappings(customLevels, useOnlyCustomLevels) - replacers: Joi.array() - .items( - Joi.object().keys({ - search: Joi.string() - .required() - .error( - new Error( - '"search" is required and must be a regexp or a string' - ) - ), - replace: Joi.string().allow('').required(), - }) - ) - .default(DEFAULT_CONFIG.replacers), + Object.assign(instance, { + levels, + [useOnlyCustomLevelsSym]: useOnlyCustomLevels, + [streamSym]: stream, + [timeSym]: time, + [timeSliceIndexSym]: timeSliceIndex, + [stringifySym]: stringify, + [stringifySafeSym]: stringifySafe, + [stringifiersSym]: stringifiers, + [endSym]: end, + [formatOptsSym]: formatOpts, + [messageKeySym]: messageKey, + [errorKeySym]: errorKey, + [nestedKeySym]: nestedKey, + // protect against injection + [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : '', + [serializersSym]: serializers, + [mixinSym]: mixin, + [mixinMergeStrategySym]: mixinMergeStrategy, + [chindingsSym]: chindings, + [formattersSym]: allFormatters, + [hooksSym]: hooks, + silent: noop, + onChild, + [msgPrefixSym]: msgPrefix + }) - autolabeler: Joi.array() - .items( - Joi.object().keys({ - label: Joi.string().required(), - files: Joi.array().items(Joi.string()).single().default([]), - branch: Joi.array().items(Joi.string()).single().default([]), - title: Joi.array().items(Joi.string()).single().default([]), - body: Joi.array().items(Joi.string()).single().default([]), - }) - ) - .default(DEFAULT_CONFIG.autolabeler), + Object.setPrototypeOf(instance, proto()) - categories: Joi.array() - .items( - Joi.object() - .keys({ - title: Joi.string().required(), - 'collapse-after': Joi.number().integer().min(0).default(0), - label: Joi.string(), - labels: Joi.array().items(Joi.string()).single().default([]), - }) - .rename('label', 'labels', { - ignoreUndefined: true, - override: true, - }) - ) - .default(DEFAULT_CONFIG.categories), + genLsCache(instance) - 'version-resolver': Joi.object() - .keys({ - major: Joi.object({ - labels: Joi.array() - .items(Joi.string()) - .single() - .default(DEFAULT_CONFIG['version-resolver']['major']['labels']), - }), - minor: Joi.object({ - labels: Joi.array() - .items(Joi.string()) - .single() - .default(DEFAULT_CONFIG['version-resolver']['minor']['labels']), - }), - patch: Joi.object({ - labels: Joi.array() - .items(Joi.string()) - .single() - .default(DEFAULT_CONFIG['version-resolver']['patch']['labels']), - }), - default: Joi.string() - .valid('major', 'minor', 'patch') - .default('patch'), - }) - .default(DEFAULT_CONFIG['version-resolver']), + instance[setLevelSym](level) - 'category-template': Joi.string() - .allow('') - .default(DEFAULT_CONFIG['category-template']), + return instance +} - header: Joi.string().allow('').default(DEFAULT_CONFIG.header), +module.exports = pino - template: Joi.string().required(), +module.exports.destination = (dest = process.stdout.fd) => { + if (typeof dest === 'object') { + dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd) + return buildSafeSonicBoom(dest) + } else { + return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0 }) + } +} - footer: Joi.string().allow('').default(DEFAULT_CONFIG.footer), +module.exports.transport = __nccwpck_require__(56846) +module.exports.multistream = __nccwpck_require__(98048) - _extends: Joi.string(), - }) - .rename('branches', 'references', { - ignoreUndefined: true, - override: true, - }) -} +module.exports.levels = mappings() +module.exports.stdSerializers = serializers +module.exports.stdTimeFunctions = Object.assign({}, time) +module.exports.symbols = symbols +module.exports.version = version -const validateSchema = (context, repoConfig) => { - const mergedRepoConfig = merge.all([DEFAULT_CONFIG, repoConfig]) - const { error, value: config } = schema(context).validate(mergedRepoConfig, { - abortEarly: false, - allowUnknown: true, - }) +// Enables default and name export with TypeScript and Babel +module.exports["default"] = pino +module.exports.pino = pino - if (error) throw error - validateCategories({ categories: config.categories }) +/***/ }), - try { - config.replacers = validateReplacers({ - context, - replacers: config.replacers, - }) - } catch { - config.replacers = [] - } +/***/ 27412: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - try { - config.autolabeler = validateAutolabeler({ - context, - autolabeler: config.autolabeler, - }) - } catch { - config.autolabeler = [] - } +"use strict"; - return config -} -exports.schema = schema -exports.validateSchema = validateSchema +const fs = __nccwpck_require__(57147) +const EventEmitter = __nccwpck_require__(82361) +const inherits = (__nccwpck_require__(73837).inherits) +const path = __nccwpck_require__(71017) +const sleep = __nccwpck_require__(86950) +const BUSY_WRITE_TIMEOUT = 100 -/***/ }), +// 16 KB. Don't write more than docker buffer size. +// https://github.com/moby/moby/blob/513ec73831269947d38a644c278ce3cac36783b2/daemon/logger/copier.go#L13 +const MAX_WRITE = 16 * 1024 -/***/ 11940: -/***/ ((__unused_webpack_module, exports) => { +function openFile (file, sonic) { + sonic._opening = true + sonic._writing = true + sonic._asyncDrainScheduled = false -const SORT_BY = { - mergedAt: 'merged_at', - title: 'title', -} + // NOTE: 'error' and 'ready' events emitted below only relevant when sonic.sync===false + // for sync mode, there is no way to add a listener that will receive these -const SORT_DIRECTIONS = { - ascending: 'ascending', - descending: 'descending', -} + function fileOpened (err, fd) { + if (err) { + sonic._reopening = false + sonic._writing = false + sonic._opening = false -const sortPullRequests = (pullRequests, sortBy, sortDirection) => { - const getSortField = sortBy === SORT_BY.title ? getTitle : getMergedAt + if (sonic.sync) { + process.nextTick(() => { + if (sonic.listenerCount('error') > 0) { + sonic.emit('error', err) + } + }) + } else { + sonic.emit('error', err) + } + return + } - const sort = - sortDirection === SORT_DIRECTIONS.ascending - ? dateSortAscending - : dateSortDescending + sonic.fd = fd + sonic.file = file + sonic._reopening = false + sonic._opening = false + sonic._writing = false - return [...pullRequests].sort((a, b) => - sort(getSortField(a), getSortField(b)) - ) -} + if (sonic.sync) { + process.nextTick(() => sonic.emit('ready')) + } else { + sonic.emit('ready') + } -function getMergedAt(pullRequest) { - return new Date(pullRequest.mergedAt) -} + if (sonic._reopening) { + return + } -function getTitle(pullRequest) { - return pullRequest.title -} + // start + if (!sonic._writing && sonic._len > sonic.minLength && !sonic.destroyed) { + actualWrite(sonic) + } + } -function dateSortAscending(date1, date2) { - if (date1 > date2) return 1 - if (date1 < date2) return -1 - return 0 -} + const flags = sonic.append ? 'a' : 'w' + const mode = sonic.mode -function dateSortDescending(date1, date2) { - if (date1 > date2) return -1 - if (date1 < date2) return 1 - return 0 + if (sonic.sync) { + try { + if (sonic.mkdir) fs.mkdirSync(path.dirname(file), { recursive: true }) + const fd = fs.openSync(file, flags, mode) + fileOpened(null, fd) + } catch (err) { + fileOpened(err) + throw err + } + } else if (sonic.mkdir) { + fs.mkdir(path.dirname(file), { recursive: true }, (err) => { + if (err) return fileOpened(err) + fs.open(file, flags, mode, fileOpened) + }) + } else { + fs.open(file, flags, mode, fileOpened) + } } -exports.SORT_BY = SORT_BY -exports.SORT_DIRECTIONS = SORT_DIRECTIONS -exports.sortPullRequests = sortPullRequests +function SonicBoom (opts) { + if (!(this instanceof SonicBoom)) { + return new SonicBoom(opts) + } + let { fd, dest, minLength, maxLength, maxWrite, sync, append = true, mode, mkdir, retryEAGAIN, fsync } = opts || {} -/***/ }), + fd = fd || dest -/***/ 47282: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + this._bufs = [] + this._len = 0 + this.fd = -1 + this._writing = false + this._writingBuf = '' + this._ending = false + this._reopening = false + this._asyncDrainScheduled = false + this._hwm = Math.max(minLength || 0, 16387) + this.file = null + this.destroyed = false + this.minLength = minLength || 0 + this.maxLength = maxLength || 0 + this.maxWrite = maxWrite || MAX_WRITE + this.sync = sync || false + this._fsync = fsync || false + this.append = append || false + this.mode = mode + this.retryEAGAIN = retryEAGAIN || (() => true) + this.mkdir = mkdir || false -const { log } = __nccwpck_require__(71911) -const regexParser = __nccwpck_require__(14542) -const regexEscape = __nccwpck_require__(98691) + if (typeof fd === 'number') { + this.fd = fd + process.nextTick(() => this.emit('ready')) + } else if (typeof fd === 'string') { + openFile(fd, this) + } else { + throw new Error('SonicBoom supports only file descriptors and files') + } + if (this.minLength >= this.maxWrite) { + throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`) + } -/** - * replaces all uppercase dollar templates with their string representation from object - * if replacement is undefined in object the dollar template string is left untouched - */ + this.release = (err, n) => { + if (err) { + if ((err.code === 'EAGAIN' || err.code === 'EBUSY') && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) { + if (this.sync) { + // This error code should not happen in sync mode, because it is + // not using the underlining operating system asynchronous functions. + // However it happens, and so we handle it. + // Ref: https://github.com/pinojs/pino/issues/783 + try { + sleep(BUSY_WRITE_TIMEOUT) + this.release(undefined, 0) + } catch (err) { + this.release(err) + } + } else { + // Let's give the destination some time to process the chunk. + setTimeout(() => { + fs.write(this.fd, this._writingBuf, 'utf8', this.release) + }, BUSY_WRITE_TIMEOUT) + } + } else { + this._writing = false -const template = (string, object, customReplacers) => { - let input = string.replace(/(\$[A-Z_]+)/g, (_, k) => { - let result - if (object[k] === undefined || object[k] === null) { - result = k - } else if (typeof object[k] === 'object') { - result = template(object[k].template, object[k]) - } else { - result = `${object[k]}` + this.emit('error', err) + } + return } - return result - }) - if (customReplacers) { - for (const { search, replace } of customReplacers) { - input = input.replace(search, replace) + + this.emit('write', n) + + this._len -= n + // In case of multi-byte characters, the length of the written buffer + // may be different from the length of the string. Let's make sure + // we do not have an accumulated string with a negative length. + // This also mean that ._len is not precise, but it's not a problem as some + // writes might be triggered earlier than ._minLength. + if (this._len < 0) { + this._len = 0 } - } - return input -} -function toRegex(search) { - return /^\/.+\/[AJUXgimsux]*$/.test(search) - ? regexParser(search) - : new RegExp(regexEscape(search), 'g') -} + // TODO if we have a multi-byte character in the buffer, we need to + // n might not be the same as this._writingBuf.length, so we might loose + // characters here. The solution to this problem is to use a Buffer for _writingBuf. + this._writingBuf = this._writingBuf.slice(n) -function validateReplacers({ context, replacers }) { - return replacers - .map((replacer) => { - try { - return { ...replacer, search: toRegex(replacer.search) } - } catch { - log({ - context, - message: `Bad replacer regex: '${replacer.search}'`, - }) - return false + if (this._writingBuf.length) { + if (!this.sync) { + fs.write(this.fd, this._writingBuf, 'utf8', this.release) + return } - }) - .filter(Boolean) -} -function validateAutolabeler({ context, autolabeler }) { - return autolabeler - .map((autolabel) => { try { - return { - ...autolabel, - branch: autolabel.branch.map((reg) => { - return toRegex(reg) - }), - title: autolabel.title.map((reg) => { - return toRegex(reg) - }), - body: autolabel.body.map((reg) => { - return toRegex(reg) - }), + do { + const n = fs.writeSync(this.fd, this._writingBuf, 'utf8') + this._len -= n + this._writingBuf = this._writingBuf.slice(n) + } while (this._writingBuf) + } catch (err) { + this.release(err) + return + } + } + + if (this._fsync) { + fs.fsyncSync(this.fd) + } + + const len = this._len + if (this._reopening) { + this._writing = false + this._reopening = false + this.reopen() + } else if (len > this.minLength) { + actualWrite(this) + } else if (this._ending) { + if (len > 0) { + actualWrite(this) + } else { + this._writing = false + actualClose(this) + } + } else { + this._writing = false + if (this.sync) { + if (!this._asyncDrainScheduled) { + this._asyncDrainScheduled = true + process.nextTick(emitDrain, this) } - } catch { - log({ - context, - message: `Bad autolabeler regex: '${autolabel.branch}', '${autolabel.title}' or '${autolabel.body}'`, - }) - return false + } else { + this.emit('drain') } - }) - .filter(Boolean) + } + } + + this.on('newListener', function (name) { + if (name === 'drain') { + this._asyncDrainScheduled = false + } + }) } -function validateCategories({ categories }) { +function emitDrain (sonic) { + const hasListeners = sonic.listenerCount('drain') > 0 + if (!hasListeners) return + sonic._asyncDrainScheduled = false + sonic.emit('drain') +} + +inherits(SonicBoom, EventEmitter) + +SonicBoom.prototype.write = function (data) { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + + const len = this._len + data.length + const bufs = this._bufs + + if (this.maxLength && len > this.maxLength) { + this.emit('drop', data) + return this._len < this._hwm + } + if ( - categories.filter((category) => category.labels.length === 0).length > 1 + bufs.length === 0 || + bufs[bufs.length - 1].length + data.length > this.maxWrite ) { - throw new Error( - 'Multiple categories detected with no labels.\nOnly one category with no labels is supported for uncategorized pull requests.' - ) + bufs.push('' + data) + } else { + bufs[bufs.length - 1] += data } -} - -exports.template = template -exports.validateReplacers = validateReplacers -exports.validateAutolabeler = validateAutolabeler -exports.validateCategories = validateCategories + this._len = len -/***/ }), + if (!this._writing && this._len >= this.minLength) { + actualWrite(this) + } -/***/ 49: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + return this._len < this._hwm +} -const { log } = __nccwpck_require__(71911) +SonicBoom.prototype.flush = function () { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } -const isTriggerableReference = ({ context, ref, config }) => { - const { GITHUB_ACTIONS } = process.env - if (GITHUB_ACTIONS) { - // Let GitHub Action determine when to run the action based on the workflow's on syntax - // See https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on - return true + if (this._writing || this.minLength <= 0) { + return } - const referenceRegex = /^refs\/(?:heads|tags)\// - const refernces = config.references.map((r) => r.replace(referenceRegex, '')) - const shortReference = ref.replace(referenceRegex, '') - const validReference = new RegExp(refernces.join('|')) - const relevant = validReference.test(shortReference) - if (!relevant) { - log({ - context, - message: `Ignoring push. ${shortReference} does not match: ${refernces.join( - ', ' - )}`, - }) + + if (this._bufs.length === 0) { + this._bufs.push('') } - return relevant + + actualWrite(this) } -exports.isTriggerableReference = isTriggerableReference +SonicBoom.prototype.reopen = function (file) { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + if (this._opening) { + this.once('ready', () => { + this.reopen(file) + }) + return + } -/***/ }), + if (this._ending) { + return + } -/***/ 98281: -/***/ ((__unused_webpack_module, exports) => { + if (!this.file) { + throw new Error('Unable to reopen a file descriptor, you must pass a file to SonicBoom') + } -function runnerIsActions() { - return process.env['GITHUB_ACTIONS'] !== undefined -} + this._reopening = true -exports.runnerIsActions = runnerIsActions + if (this._writing) { + return + } + const fd = this.fd + this.once('ready', () => { + if (fd !== this.fd) { + fs.close(fd, (err) => { + if (err) { + return this.emit('error', err) + } + }) + } + }) -/***/ }), + openFile(file || this.file, this) +} -/***/ 49914: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +SonicBoom.prototype.end = function () { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } -const semver = __nccwpck_require__(11383) + if (this._opening) { + this.once('ready', () => { + this.end() + }) + return + } -const splitSemVersion = (input, versionKey = 'version') => { - if (!input[versionKey]) { + if (this._ending) { return } - const version = input.inc - ? semver.inc(input[versionKey], input.inc, true) - : input[versionKey].version + this._ending = true - return { - ...input, - version, - $MAJOR: semver.major(version), - $MINOR: semver.minor(version), - $PATCH: semver.patch(version), - $COMPLETE: version, + if (this._writing) { + return } -} -const defaultVersionInfo = { - $NEXT_MAJOR_VERSION: { - version: '1.0.0', - template: '$MAJOR.$MINOR.$PATCH', - inputVersion: null, - versionKeyIncrement: 'patch', - inc: 'major', - $MAJOR: 1, - $MINOR: 0, - $PATCH: 0, - }, - $NEXT_MINOR_VERSION: { - version: '0.1.0', - template: '$MAJOR.$MINOR.$PATCH', - inputVersion: null, - versionKeyIncrement: 'patch', - inc: 'minor', - $MAJOR: 0, - $MINOR: 1, - $PATCH: 0, - }, - $NEXT_PATCH_VERSION: { - version: '0.1.0', - template: '$MAJOR.$MINOR.$PATCH', - inputVersion: null, - versionKeyIncrement: 'patch', - inc: 'patch', - $MAJOR: 0, - $MINOR: 1, - $PATCH: 0, - }, - $INPUT_VERSION: null, - $RESOLVED_VERSION: { - version: '0.1.0', - template: '$MAJOR.$MINOR.$PATCH', - inputVersion: null, - versionKeyIncrement: 'patch', - inc: 'patch', - $MAJOR: 0, - $MINOR: 1, - $PATCH: 0, - }, + if (this._len > 0 && this.fd >= 0) { + actualWrite(this) + } else { + actualClose(this) + } } -const getTemplatableVersion = (input) => { - const templatableVersion = { - $NEXT_MAJOR_VERSION: splitSemVersion({ ...input, inc: 'major' }), - $NEXT_MAJOR_VERSION_MAJOR: splitSemVersion({ - ...input, - inc: 'major', - template: '$MAJOR', - }), - $NEXT_MAJOR_VERSION_MINOR: splitSemVersion({ - ...input, - inc: 'major', - template: '$MINOR', - }), - $NEXT_MAJOR_VERSION_PATCH: splitSemVersion({ - ...input, - inc: 'major', - template: '$PATCH', - }), - $NEXT_MINOR_VERSION: splitSemVersion({ ...input, inc: 'minor' }), - $NEXT_MINOR_VERSION_MAJOR: splitSemVersion({ - ...input, - inc: 'minor', - template: '$MAJOR', - }), - $NEXT_MINOR_VERSION_MINOR: splitSemVersion({ - ...input, - inc: 'minor', - template: '$MINOR', - }), - $NEXT_MINOR_VERSION_PATCH: splitSemVersion({ - ...input, - inc: 'minor', - template: '$PATCH', - }), - $NEXT_PATCH_VERSION: splitSemVersion({ ...input, inc: 'patch' }), - $NEXT_PATCH_VERSION_MAJOR: splitSemVersion({ - ...input, - inc: 'patch', - template: '$MAJOR', - }), - $NEXT_PATCH_VERSION_MINOR: splitSemVersion({ - ...input, - inc: 'patch', - template: '$MINOR', - }), - $NEXT_PATCH_VERSION_PATCH: splitSemVersion({ - ...input, - inc: 'patch', - template: '$PATCH', - }), - $INPUT_VERSION: splitSemVersion(input, 'inputVersion'), - $RESOLVED_VERSION: splitSemVersion({ - ...input, - inc: input.versionKeyIncrement || 'patch', - }), +SonicBoom.prototype.flushSync = function () { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') } - templatableVersion.$RESOLVED_VERSION = - templatableVersion.$INPUT_VERSION || templatableVersion.$RESOLVED_VERSION - - return templatableVersion -} + if (this.fd < 0) { + throw new Error('sonic boom is not ready yet') + } -const toSemver = (version) => { - const result = semver.parse(version) - if (result) { - return result + if (!this._writing && this._writingBuf.length > 0) { + this._bufs.unshift(this._writingBuf) + this._writingBuf = '' } - // doesn't handle prerelease - return semver.coerce(version) + let buf = '' + while (this._bufs.length || buf.length) { + if (buf.length <= 0) { + buf = this._bufs[0] + } + try { + const n = fs.writeSync(this.fd, buf, 'utf8') + buf = buf.slice(n) + this._len = Math.max(this._len - n, 0) + if (buf.length <= 0) { + this._bufs.shift() + } + } catch (err) { + const shouldRetry = err.code === 'EAGAIN' || err.code === 'EBUSY' + if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) { + throw err + } + + sleep(BUSY_WRITE_TIMEOUT) + } + } } -const coerceVersion = (input, tagPrefix) => { - if (!input) { +SonicBoom.prototype.destroy = function () { + if (this.destroyed) { return } + actualClose(this) +} - const stripTag = (input) => - tagPrefix && input.startsWith(tagPrefix) - ? input.slice(tagPrefix.length) - : input +function actualWrite (sonic) { + const release = sonic.release + sonic._writing = true + sonic._writingBuf = sonic._writingBuf || sonic._bufs.shift() || '' - return typeof input === 'object' - ? toSemver(stripTag(input.tag_name)) || toSemver(stripTag(input.name)) - : toSemver(stripTag(input)) + if (sonic.sync) { + try { + const written = fs.writeSync(sonic.fd, sonic._writingBuf, 'utf8') + release(null, written) + } catch (err) { + release(err) + } + } else { + fs.write(sonic.fd, sonic._writingBuf, 'utf8', release) + } } -const getVersionInfo = ( - release, - template, - inputVersion, - versionKeyIncrement, - tagPrefix -) => { - const version = coerceVersion(release, tagPrefix) - inputVersion = coerceVersion(inputVersion, tagPrefix) +function actualClose (sonic) { + if (sonic.fd === -1) { + sonic.once('ready', actualClose.bind(null, sonic)) + return + } - if (!version && !inputVersion) { - return defaultVersionInfo + sonic.destroyed = true + sonic._bufs = [] + + if (sonic.fd !== 1 && sonic.fd !== 2) { + fs.close(sonic.fd, done) + } else { + setImmediate(done) } - return { - ...getTemplatableVersion({ - version, - template, - inputVersion, - versionKeyIncrement, - }), + function done (err) { + if (err) { + sonic.emit('error', err) + return + } + + if (sonic._ending && !sonic._writing) { + sonic.emit('finish') + } + sonic.emit('close') } } -exports.getVersionInfo = getVersionInfo -exports.defaultVersionInfo = defaultVersionInfo +/** + * These export configurations enable JS and TS developers + * to consumer SonicBoom in whatever way best suits their needs. + * Some examples of supported import syntax includes: + * - `const SonicBoom = require('SonicBoom')` + * - `const { SonicBoom } = require('SonicBoom')` + * - `import * as SonicBoom from 'SonicBoom'` + * - `import { SonicBoom } from 'SonicBoom'` + * - `import SonicBoom from 'SonicBoom'` + */ +SonicBoom.SonicBoom = SonicBoom +SonicBoom.default = SonicBoom +module.exports = SonicBoom /***/ }), @@ -145371,6 +149109,14 @@ module.exports = JSON.parse('{"100":"Continue","101":"Switching Protocols","102" /***/ }), +/***/ 82954: +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"name":"thread-stream","version":"2.4.0","description":"A streaming way to send data to a Node.js Worker Thread","main":"index.js","types":"index.d.ts","dependencies":{"real-require":"^0.2.0"},"devDependencies":{"@types/node":"^20.1.0","@types/tap":"^15.0.0","desm":"^1.3.0","fastbench":"^1.0.1","husky":"^8.0.1","pino-elasticsearch":"^6.0.0","sonic-boom":"^3.0.0","standard":"^17.0.0","tap":"^16.2.0","ts-node":"^10.8.0","typescript":"^4.7.2","why-is-node-running":"^2.2.2"},"scripts":{"test":"standard && npm run transpile && tap test/*.test.*js && tap --ts test/*.test.*ts","test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":"tap --no-check-coverage --coverage-report=lcovonly \\"test/**/*.test.*js\\"","test:ci:ts":"tap --ts --no-check-coverage --coverage-report=lcovonly \\"test/**/*.test.*ts\\"","test:yarn":"npm run transpile && tap \\"test/**/*.test.js\\" --no-check-coverage","transpile":"sh ./test/ts/transpile.sh","prepare":"husky install"},"standard":{"ignore":["test/ts/**/*"]},"repository":{"type":"git","url":"git+https://github.com/mcollina/thread-stream.git"},"keywords":["worker","thread","threads","stream"],"author":"Matteo Collina ","license":"MIT","bugs":{"url":"https://github.com/mcollina/thread-stream/issues"},"homepage":"https://github.com/mcollina/thread-stream#readme"}'); + +/***/ }), + /***/ 72020: /***/ ((module) => { diff --git a/dist/worker-pipeline.js b/dist/worker-pipeline.js new file mode 100644 index 0000000000..76cb3b888d --- /dev/null +++ b/dist/worker-pipeline.js @@ -0,0 +1,38 @@ +'use strict' + +const EE = require('events') +const loadTransportStreamBuilder = require('./transport-stream') +const { pipeline, PassThrough } = require('stream') + +// This file is not checked by the code coverage tool, +// as it is not reliable. + +/* istanbul ignore file */ + +module.exports = async function ({ targets }) { + const streams = await Promise.all(targets.map(async (t) => { + const fn = await loadTransportStreamBuilder(t.target) + const stream = await fn(t.options) + return stream + })) + const ee = new EE() + + const stream = new PassThrough({ + autoDestroy: true, + destroy (_, cb) { + ee.on('error', cb) + ee.on('closed', cb) + } + }) + + pipeline(stream, ...streams, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + ee.emit('error', err) + return + } + + ee.emit('closed') + }) + + return stream +} diff --git a/dist/worker.js b/dist/worker.js new file mode 100644 index 0000000000..c20c19add8 --- /dev/null +++ b/dist/worker.js @@ -0,0 +1,54 @@ +'use strict' + +const pino = require('../pino.js') +const build = require('pino-abstract-transport') +const loadTransportStreamBuilder = require('./transport-stream') + +// This file is not checked by the code coverage tool, +// as it is not reliable. + +/* istanbul ignore file */ + +module.exports = async function ({ targets, levels, dedupe }) { + targets = await Promise.all(targets.map(async (t) => { + const fn = await loadTransportStreamBuilder(t.target) + const stream = await fn(t.options) + return { + level: t.level, + stream + } + })) + return build(process, { + parse: 'lines', + metadata: true, + close (err, cb) { + let expected = 0 + for (const transport of targets) { + expected++ + transport.stream.on('close', closeCb) + transport.stream.end() + } + + function closeCb () { + if (--expected === 0) { + cb(err) + } + } + } + }) + + function process (stream) { + const multi = pino.multistream(targets, { levels, dedupe }) + // TODO manage backpressure + stream.on('data', function (chunk) { + const { lastTime, lastMsg, lastObj, lastLevel } = this + multi.lastLevel = lastLevel + multi.lastTime = lastTime + multi.lastMsg = lastMsg + multi.lastObj = lastObj + + // TODO handle backpressure + multi.write(chunk + '\n') + }) + } +} diff --git a/dist/worker1.js b/dist/worker1.js new file mode 100644 index 0000000000..03d02d18bb --- /dev/null +++ b/dist/worker1.js @@ -0,0 +1,169 @@ +'use strict' + +const { realImport, realRequire } = require('real-require') +const { workerData, parentPort } = require('worker_threads') +const { WRITE_INDEX, READ_INDEX } = require('./indexes') +const { waitDiff } = require('./wait') + +const { + dataBuf, + filename, + stateBuf +} = workerData + +let destination + +const state = new Int32Array(stateBuf) +const data = Buffer.from(dataBuf) + +async function start () { + let worker + try { + if (filename.endsWith('.ts') || filename.endsWith('.cts')) { + // TODO: add support for the TSM modules loader ( https://github.com/lukeed/tsm ). + if (!process[Symbol.for('ts-node.register.instance')]) { + realRequire('ts-node/register') + } else if (process.env.TS_NODE_DEV) { + realRequire('ts-node-dev') + } + // TODO: Support ES imports once tsc, tap & ts-node provide better compatibility guarantees. + // Remove extra forwardslash on Windows + worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', ''))) + } else { + worker = (await realImport(filename)) + } + } catch (error) { + // A yarn user that tries to start a ThreadStream for an external module + // provides a filename pointing to a zip file. + // eg. require.resolve('pino-elasticsearch') // returns /foo/pino-elasticsearch-npm-6.1.0-0c03079478-6915435172.zip/bar.js + // The `import` will fail to try to load it. + // This catch block executes the `require` fallback to load the module correctly. + // In fact, yarn modifies the `require` function to manage the zipped path. + // More details at https://github.com/pinojs/pino/pull/1113 + // The error codes may change based on the node.js version (ENOTDIR > 12, ERR_MODULE_NOT_FOUND <= 12 ) + if ((error.code === 'ENOTDIR' || error.code === 'ERR_MODULE_NOT_FOUND') && + filename.startsWith('file://')) { + worker = realRequire(decodeURIComponent(filename.replace('file://', ''))) + } else if (error.code === undefined) { + // When bundled with pkg, an undefined error is thrown when called with realImport + worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', ''))) + } else { + throw error + } + } + + // Depending on how the default export is performed, and on how the code is + // transpiled, we may find cases of two nested "default" objects. + // See https://github.com/pinojs/pino/issues/1243#issuecomment-982774762 + if (typeof worker === 'object') worker = worker.default + if (typeof worker === 'object') worker = worker.default + + destination = await worker(workerData.workerData) + + destination.on('error', function (err) { + Atomics.store(state, WRITE_INDEX, -2) + Atomics.notify(state, WRITE_INDEX) + + Atomics.store(state, READ_INDEX, -2) + Atomics.notify(state, READ_INDEX) + + parentPort.postMessage({ + code: 'ERROR', + err + }) + }) + + destination.on('close', function () { + // process._rawDebug('worker close emitted') + const end = Atomics.load(state, WRITE_INDEX) + Atomics.store(state, READ_INDEX, end) + Atomics.notify(state, READ_INDEX) + setImmediate(() => { + process.exit(0) + }) + }) +} + +// No .catch() handler, +// in case there is an error it goes +// to unhandledRejection +start().then(function () { + parentPort.postMessage({ + code: 'READY' + }) + + process.nextTick(run) +}) + +function run () { + const current = Atomics.load(state, READ_INDEX) + const end = Atomics.load(state, WRITE_INDEX) + + // process._rawDebug(`pre state ${current} ${end}`) + + if (end === current) { + if (end === data.length) { + waitDiff(state, READ_INDEX, end, Infinity, run) + } else { + waitDiff(state, WRITE_INDEX, end, Infinity, run) + } + return + } + + // process._rawDebug(`post state ${current} ${end}`) + + if (end === -1) { + // process._rawDebug('end') + destination.end() + return + } + + const toWrite = data.toString('utf8', current, end) + // process._rawDebug('worker writing: ' + toWrite) + + const res = destination.write(toWrite) + + if (res) { + Atomics.store(state, READ_INDEX, end) + Atomics.notify(state, READ_INDEX) + setImmediate(run) + } else { + destination.once('drain', function () { + Atomics.store(state, READ_INDEX, end) + Atomics.notify(state, READ_INDEX) + run() + }) + } +} + +process.on('unhandledRejection', function (err) { + parentPort.postMessage({ + code: 'ERROR', + err + }) + process.exit(1) +}) + +process.on('uncaughtException', function (err) { + parentPort.postMessage({ + code: 'ERROR', + err + }) + process.exit(1) +}) + +process.once('exit', exitCode => { + if (exitCode !== 0) { + process.exit(exitCode) + return + } + + if (destination?.writableNeedDrain && !destination?.writableEnded) { + parentPort.postMessage({ + code: 'WARNING', + err: new Error('ThreadStream: process exited before destination stream was drained. this may indicate that the destination stream try to write to a another missing stream') + }) + } + + process.exit(0) +}) diff --git a/package.json b/package.json index 1f838742fb..ed157ebc1f 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@actions/core": "1.10.0", - "@probot/adapter-github-actions": "3.1.1", + "@probot/adapter-github-actions": "3.1.3", "cli-table3": "0.6.2", "compare-versions": "4.1.3", "deepmerge": "4.2.2", diff --git a/yarn.lock b/yarn.lock index 209821bfb5..85c58081fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@actions/core@1.10.0": +"@actions/core@1.10.0", "@actions/core@^1.2.6": version "1.10.0" resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug== @@ -10,13 +10,6 @@ "@actions/http-client" "^2.0.1" uuid "^8.3.2" -"@actions/core@^1.2.6": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.9.0.tgz#20c1baac5d4bd2508ba1fc3e5f3fc4b8a80d4082" - integrity sha512-5pbM693Ih59ZdUhgk+fts+bUWTnIdHV3kwOSr+QIoFHMLg7Gzhwm0cifDY/AG68ekEJAkHnQVpcy4f6GjmzBCA== - dependencies: - "@actions/http-client" "^2.0.1" - "@actions/http-client@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.1.tgz#873f4ca98fe32f6839462a6f046332677322f99c" @@ -939,13 +932,13 @@ "@octokit/webhooks-types" "5.2.0" aggregate-error "^3.1.0" -"@probot/adapter-github-actions@3.1.1": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@probot/adapter-github-actions/-/adapter-github-actions-3.1.1.tgz#5bb6933e8c6b6c9e5e9c8bf0a3cca2725f8d08e1" - integrity sha512-Lqka0ZxYZcgzC9vZY/H9b9/s9niBAzb9xfSTiV5GHvQbe5U3sChxo+GW4Csw473jSF+W+pOLhKLy6rRWSs6i/g== +"@probot/adapter-github-actions@3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@probot/adapter-github-actions/-/adapter-github-actions-3.1.3.tgz#133024a50b91d6ffe8d54623dc51a945b450c5aa" + integrity sha512-mQ0YZrurH1Xvo+2KxZBi2eE8vwywoPveg370aIxY22g47xP5lpGR46ahL4TChZN5RpL82Rp7wEl8+Ue2PUrZsw== dependencies: "@actions/core" "^1.2.6" - pino "^6.11.0" + pino "^8.5.0" probot "^12.2.1" through2 "^4.0.2" @@ -1299,6 +1292,13 @@ resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.34.0.tgz#d0139528320e46670d949c82967044a8f66db054" integrity sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A== +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + accepts@~1.3.7: version "1.3.7" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" @@ -1493,6 +1493,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + before-after-hook@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" @@ -1578,6 +1583,14 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + builtin-modules@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" @@ -2125,6 +2138,16 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + eventsource@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-2.0.2.tgz#76dfcc02930fb2ff339520b6d290da573a9e8508" @@ -2246,6 +2269,11 @@ fast-redact@^3.0.0: resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.0.2.tgz#c940ba7162dde3aeeefc522926ae8c5231412904" integrity sha512-YN+CYfCVRVMUZOUPeinHNKgytM1wPI/C/UCLEi56EsY2dwwvI00kIJHJoI7pMVqGoMew8SMZ2SSfHKHULHXDsg== +fast-redact@^3.1.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.3.0.tgz#7c83ce3a7be4898241a46560d51de10f653f7634" + integrity sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ== + fast-safe-stringify@^2.0.7, fast-safe-stringify@^2.0.8: version "2.1.1" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" @@ -2491,6 +2519,11 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + ignore@5.2.0, ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" @@ -3528,6 +3561,11 @@ octokit-auth-probot@^1.2.2: "@octokit/auth-unauthenticated" "^2.0.2" "@octokit/types" "^6.1.1" +on-exit-leak-free@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.0.tgz#5c703c968f7e7f851885f6459bf8a8a57edc9cc4" + integrity sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w== + on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" @@ -3698,6 +3736,14 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== +pino-abstract-transport@v1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.1.0.tgz#083d98f966262164504afb989bccd05f665937a8" + integrity sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA== + dependencies: + readable-stream "^4.0.0" + split2 "^4.0.0" + pino-http@^5.3.0: version "5.8.0" resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-5.8.0.tgz#6e688fd5f965c5b6991f340eb660ea2927be9aa7" @@ -3735,7 +3781,12 @@ pino-std-serializers@^4.0.0: resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== -pino@^6.11.0, pino@^6.13.0, pino@^6.7.0: +pino-std-serializers@^6.0.0: + version "6.2.2" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz#d9a9b5f2b9a402486a5fc4db0a737570a860aab3" + integrity sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA== + +pino@^6.13.0, pino@^6.7.0: version "6.13.4" resolved "https://registry.yarnpkg.com/pino/-/pino-6.13.4.tgz#e7bd5e8292019609c841c37a3f1d73ee10bb80f7" integrity sha512-g4tHSISmQJYUEKEMVdaZ+ZokWwFnTwZL5JPn+lnBVZ1BuBbrSchrXwQINknkM5+Q4fF6U9NjiI8PWwwMDHt9zA== @@ -3748,6 +3799,23 @@ pino@^6.11.0, pino@^6.13.0, pino@^6.7.0: quick-format-unescaped "^4.0.3" sonic-boom "^1.0.2" +pino@^8.5.0: + version "8.15.1" + resolved "https://registry.yarnpkg.com/pino/-/pino-8.15.1.tgz#04b815ff7aa4e46b1bbab88d8010aaa2b17eaba4" + integrity sha512-Cp4QzUQrvWCRJaQ8Lzv0mJzXVk4z2jlq8JNKMGaixC2Pz5L4l2p95TkuRvYbrEbe85NQsDKrAd4zalf7Ml6WiA== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.1.1" + on-exit-leak-free "^2.1.0" + pino-abstract-transport v1.1.0 + pino-std-serializers "^6.0.0" + process-warning "^2.0.0" + quick-format-unescaped "^4.0.3" + real-require "^0.2.0" + safe-stable-stringify "^2.3.1" + sonic-boom "^3.1.0" + thread-stream "^2.0.0" + pirates@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.4.tgz#07df81e61028e402735cdd49db701e4885b4e6e6" @@ -3844,6 +3912,16 @@ process-warning@^1.0.0: resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== +process-warning@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-2.2.0.tgz#008ec76b579820a8e5c35d81960525ca64feb626" + integrity sha512-/1WZ8+VQjR6avWOgHeEPd7SDQmFQ1B5mC1eRXsCm5TarlNmx/wCsa5GEaxGm05BORRtyG/Ex/3xq3TuRvq57qg== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -3946,6 +4024,22 @@ readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@^4.0.0: + version "4.4.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.4.2.tgz#e6aced27ad3b9d726d8308515b9a1b98dc1b9d13" + integrity sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA== + dependencies: + abort-controller "^3.0.0" + buffer "^6.0.3" + events "^3.3.0" + process "^0.11.10" + string_decoder "^1.3.0" + +real-require@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.2.0.tgz#209632dea1810be2ae063a6ac084fee7e33fba78" + integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg== + redis-commands@1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.7.0.tgz#15a6fea2d58281e27b1cd1acfb4b293e278c3a89" @@ -4058,6 +4152,11 @@ safe-regex@^2.1.1: dependencies: regexp-tree "~0.1.1" +safe-stable-stringify@^2.3.1: + version "2.4.3" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" + integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== + "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -4187,6 +4286,13 @@ sonic-boom@^2.1.0: dependencies: atomic-sleep "^1.0.0" +sonic-boom@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.3.0.tgz#cffab6dafee3b2bcb88d08d589394198bee1838c" + integrity sha512-LYxp34KlZ1a2Jb8ZQgFCK3niIHzibdwtwNUWKg0qQRzsDoJ3Gfgkf8KdBTFU3SkejDEIlWwnSnpVdOZIhFMl/g== + dependencies: + atomic-sleep "^1.0.0" + source-map-support@0.5.13: version "0.5.13" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" @@ -4296,7 +4402,7 @@ string-width@^5.0.0: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -string_decoder@^1.1.1: +string_decoder@^1.1.1, string_decoder@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== @@ -4405,6 +4511,13 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +thread-stream@^2.0.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.4.0.tgz#5def29598d1d4171ba3bace7e023a71d87d99c07" + integrity sha512-xZYtOtmnA63zj04Q+F9bdEay5r47bvpo1CaNqsKi7TpoJHcotUez8Fkfo2RJWpW91lnnaApdpRbVwCWsy+ifcw== + dependencies: + real-require "^0.2.0" + through2@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764"