From e007c3ba2cf06939a47251e337709b8c5e2de761 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 16 Jan 2021 08:49:19 +0000 Subject: [PATCH] build(index.js): build --- index.js | 42031 +++++++++++++++++++++++++---------------------------- 1 file changed, 20184 insertions(+), 21847 deletions(-) diff --git a/index.js b/index.js index 7ffd9be..bfb3399 100644 --- a/index.js +++ b/index.js @@ -1,728 +1,604 @@ -module.exports = /******/ (() => { - // webpackBootstrap - /******/ var __webpack_modules__ = { - /***/ 7351: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; +module.exports = +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ - var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result['default'] = mod; - return result; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const os = __importStar(__nccwpck_require__(2087)); - const utils_1 = __nccwpck_require__(5278); - /** - * 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) { +/***/ 7351: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const os = __importStar(__nccwpck_require__(2087)); +const utils_1 = __nccwpck_require__(5278); +/** + * 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) { + 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)}`; + 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'); - } - //# sourceMappingURL=command.js.map + 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'); +} +//# sourceMappingURL=command.js.map - /***/ - }, +/***/ }), - /***/ 2186: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; +/***/ 2186: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done - ? resolve(result.value) - : adopt(result.value).then(fulfilled, rejected); - } - step( - (generator = generator.apply(thisArg, _arguments || [])).next() - ); - }); - }; - var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result['default'] = mod; - return result; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const command_1 = __nccwpck_require__(7351); - const file_command_1 = __nccwpck_require__(717); - const utils_1 = __nccwpck_require__(5278); - const os = __importStar(__nccwpck_require__(2087)); - const path = __importStar(__nccwpck_require__(5622)); - /** - * 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); - } - } - 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); - } - 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); - } - process.env[ - 'PATH' - ] = `${inputPath}${path.delimiter}${process.env['PATH']}`; - } - exports.addPath = addPath; - /** - * Gets the value of an input. The value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string - */ - 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}`); - } - return val.trim(); - } - exports.getInput = getInput; - /** - * 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) { - 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'; - } - exports.isDebug = isDebug; - /** - * Writes debug message to user log - * @param message debug message - */ - function debug(message) { - command_1.issueCommand('debug', {}, message); - } - exports.debug = debug; - /** - * Adds an error issue - * @param message error issue message. Errors will be converted to string via toString() - */ - function error(message) { - command_1.issue( - 'error', - message instanceof Error ? message.toString() : message - ); - } - exports.error = error; - /** - * Adds an warning issue - * @param message warning issue message. Errors will be converted to string via toString() - */ - function warning(message) { - command_1.issue( - 'warning', - message instanceof Error ? message.toString() : message - ); - } - exports.warning = warning; - /** - * Writes info to log with console.log. - * @param message info message - */ - function info(message) { - process.stdout.write(message + os.EOL); - } - 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 - */ - function startGroup(name) { - command_1.issue('group', name); - } - exports.startGroup = startGroup; - /** - * End an output group. - */ - function endGroup() { - command_1.issue('endgroup'); - } - 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 - */ - function group(name, fn) { - return __awaiter(this, void 0, void 0, function* () { - startGroup(name); - let result; - try { +"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()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const command_1 = __nccwpck_require__(7351); +const file_command_1 = __nccwpck_require__(717); +const utils_1 = __nccwpck_require__(5278); +const os = __importStar(__nccwpck_require__(2087)); +const path = __importStar(__nccwpck_require__(5622)); +/** + * 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); + } +} +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); +} +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); + } + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; +} +exports.addPath = addPath; +/** + * Gets the value of an input. The value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string + */ +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}`); + } + return val.trim(); +} +exports.getInput = getInput; +/** + * 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) { + 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'; +} +exports.isDebug = isDebug; +/** + * Writes debug message to user log + * @param message debug message + */ +function debug(message) { + command_1.issueCommand('debug', {}, message); +} +exports.debug = debug; +/** + * Adds an error issue + * @param message error issue message. Errors will be converted to string via toString() + */ +function error(message) { + command_1.issue('error', message instanceof Error ? message.toString() : message); +} +exports.error = error; +/** + * Adds an warning issue + * @param message warning issue message. Errors will be converted to string via toString() + */ +function warning(message) { + command_1.issue('warning', message instanceof Error ? message.toString() : message); +} +exports.warning = warning; +/** + * Writes info to log with console.log. + * @param message info message + */ +function info(message) { + process.stdout.write(message + os.EOL); +} +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 + */ +function startGroup(name) { + command_1.issue('group', name); +} +exports.startGroup = startGroup; +/** + * End an output group. + */ +function endGroup() { + command_1.issue('endgroup'); +} +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 + */ +function group(name, fn) { + return __awaiter(this, void 0, void 0, function* () { + startGroup(name); + let result; + try { result = yield fn(); - } finally { + } + finally { endGroup(); - } - return result; - }); - } - 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 - */ - // 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 - */ - function getState(name) { - return process.env[`STATE_${name}`] || ''; - } - exports.getState = getState; - //# sourceMappingURL=core.js.map - - /***/ - }, - - /***/ 717: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; - - // For internal use, subject to change. - var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result['default'] = mod; - return result; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - // We use any as a valid input type - /* eslint-disable @typescript-eslint/no-explicit-any */ - const fs = __importStar(__nccwpck_require__(5747)); - const os = __importStar(__nccwpck_require__(2087)); - const utils_1 = __nccwpck_require__(5278); - 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}`); - } - fs.appendFileSync( - filePath, - `${utils_1.toCommandValue(message)}${os.EOL}`, - { - encoding: 'utf8', - } - ); - } - exports.issueCommand = issueCommand; - //# sourceMappingURL=file-command.js.map + return result; + }); +} +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 + */ +// 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 + */ +function getState(name) { + return process.env[`STATE_${name}`] || ''; +} +exports.getState = getState; +//# sourceMappingURL=core.js.map - /***/ - }, +/***/ }), - /***/ 5278: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ 717: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - // We use any as a valid input type - /* eslint-disable @typescript-eslint/no-explicit-any */ - Object.defineProperty(exports, '__esModule', { value: true }); - /** - * 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; - //# sourceMappingURL=utils.js.map +"use strict"; - /***/ - }, +// For internal use, subject to change. +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar(__nccwpck_require__(5747)); +const os = __importStar(__nccwpck_require__(2087)); +const utils_1 = __nccwpck_require__(5278); +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}`); + } + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +exports.issueCommand = issueCommand; +//# sourceMappingURL=file-command.js.map - /***/ 1514: /***/ function ( - __unused_webpack_module, - 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() - ); - }); - }; - var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result['default'] = mod; - return result; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const tr = __importStar(__nccwpck_require__(8159)); - /** - * Exec a command. - * Output will be streamed to the live console. - * Returns promise with return code - * - * @param commandLine command to execute (can include additional args). Must be correctly escaped. - * @param args optional arguments for tool. Escaping is handled by the lib. - * @param options optional exec options. See ExecOptions - * @returns Promise exit code - */ - function exec(commandLine, args, options) { - return __awaiter(this, void 0, void 0, function* () { - const commandArgs = tr.argStringToArray(commandLine); - if (commandArgs.length === 0) { +/***/ 5278: +/***/ ((__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 })); +/** + * 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; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 1514: +/***/ (function(__unused_webpack_module, 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()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tr = __importStar(__nccwpck_require__(8159)); +/** + * Exec a command. + * Output will be streamed to the live console. + * Returns promise with return code + * + * @param commandLine command to execute (can include additional args). Must be correctly escaped. + * @param args optional arguments for tool. Escaping is handled by the lib. + * @param options optional exec options. See ExecOptions + * @returns Promise exit code + */ +function exec(commandLine, args, options) { + return __awaiter(this, void 0, void 0, function* () { + const commandArgs = tr.argStringToArray(commandLine); + if (commandArgs.length === 0) { throw new Error(`Parameter 'commandLine' cannot be null or empty.`); - } - // Path to tool to execute should be first arg - const toolPath = commandArgs[0]; - args = commandArgs.slice(1).concat(args || []); - const runner = new tr.ToolRunner(toolPath, args, options); - return runner.exec(); - }); - } - exports.exec = exec; - //# sourceMappingURL=exec.js.map + } + // Path to tool to execute should be first arg + const toolPath = commandArgs[0]; + args = commandArgs.slice(1).concat(args || []); + const runner = new tr.ToolRunner(toolPath, args, options); + return runner.exec(); + }); +} +exports.exec = exec; +//# sourceMappingURL=exec.js.map - /***/ - }, +/***/ }), - /***/ 8159: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; +/***/ 8159: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done - ? resolve(result.value) - : adopt(result.value).then(fulfilled, rejected); - } - step( - (generator = generator.apply(thisArg, _arguments || [])).next() - ); - }); - }; - var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result['default'] = mod; - return result; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const os = __importStar(__nccwpck_require__(2087)); - const events = __importStar(__nccwpck_require__(8614)); - const child = __importStar(__nccwpck_require__(3129)); - const path = __importStar(__nccwpck_require__(5622)); - const io = __importStar(__nccwpck_require__(7436)); - const ioUtil = __importStar(__nccwpck_require__(1962)); - /* eslint-disable @typescript-eslint/unbound-method */ - const IS_WINDOWS = process.platform === 'win32'; - /* - * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. - */ - class ToolRunner extends events.EventEmitter { - constructor(toolPath, args, options) { - super(); - if (!toolPath) { +"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()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const os = __importStar(__nccwpck_require__(2087)); +const events = __importStar(__nccwpck_require__(8614)); +const child = __importStar(__nccwpck_require__(3129)); +const path = __importStar(__nccwpck_require__(5622)); +const io = __importStar(__nccwpck_require__(7436)); +const ioUtil = __importStar(__nccwpck_require__(1962)); +/* eslint-disable @typescript-eslint/unbound-method */ +const IS_WINDOWS = process.platform === 'win32'; +/* + * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. + */ +class ToolRunner extends events.EventEmitter { + constructor(toolPath, args, options) { + super(); + if (!toolPath) { throw new Error("Parameter 'toolPath' cannot be null or empty."); - } - this.toolPath = toolPath; - this.args = args || []; - this.options = options || {}; } - _debug(message) { - if (this.options.listeners && this.options.listeners.debug) { + this.toolPath = toolPath; + this.args = args || []; + this.options = options || {}; + } + _debug(message) { + if (this.options.listeners && this.options.listeners.debug) { this.options.listeners.debug(message); - } } - _getCommandString(options, noPrefix) { - const toolPath = this._getSpawnFileName(); - const args = this._getSpawnArgs(options); - let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool - if (IS_WINDOWS) { + } + _getCommandString(options, noPrefix) { + const toolPath = this._getSpawnFileName(); + const args = this._getSpawnArgs(options); + let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool + if (IS_WINDOWS) { // Windows + cmd file if (this._isCmdFile()) { - cmd += toolPath; - for (const a of args) { - cmd += ` ${a}`; - } + cmd += toolPath; + for (const a of args) { + cmd += ` ${a}`; + } } // Windows + verbatim else if (options.windowsVerbatimArguments) { - cmd += `"${toolPath}"`; - for (const a of args) { - cmd += ` ${a}`; - } + cmd += `"${toolPath}"`; + for (const a of args) { + cmd += ` ${a}`; + } } // Windows (regular) else { - cmd += this._windowsQuoteCmdArg(toolPath); - for (const a of args) { - cmd += ` ${this._windowsQuoteCmdArg(a)}`; - } + cmd += this._windowsQuoteCmdArg(toolPath); + for (const a of args) { + cmd += ` ${this._windowsQuoteCmdArg(a)}`; + } } - } else { + } + else { // OSX/Linux - this can likely be improved with some form of quoting. // creating processes on Unix is fundamentally different than Windows. // on Unix, execvp() takes an arg array. cmd += toolPath; for (const a of args) { - cmd += ` ${a}`; + cmd += ` ${a}`; } - } - return cmd; } - _processLineBuffer(data, strBuffer, onLine) { - try { + return cmd; + } + _processLineBuffer(data, strBuffer, onLine) { + try { let s = strBuffer + data.toString(); let n = s.indexOf(os.EOL); while (n > -1) { - const line = s.substring(0, n); - onLine(line); - // the rest of the string ... - s = s.substring(n + os.EOL.length); - n = s.indexOf(os.EOL); + const line = s.substring(0, n); + onLine(line); + // the rest of the string ... + s = s.substring(n + os.EOL.length); + n = s.indexOf(os.EOL); } strBuffer = s; - } catch (err) { + } + catch (err) { // streaming lines to console is best effort. Don't fail a build. this._debug(`error processing line. Failed with error ${err}`); - } } - _getSpawnFileName() { - if (IS_WINDOWS) { + } + _getSpawnFileName() { + if (IS_WINDOWS) { if (this._isCmdFile()) { - return process.env['COMSPEC'] || 'cmd.exe'; + return process.env['COMSPEC'] || 'cmd.exe'; } - } - return this.toolPath; } - _getSpawnArgs(options) { - if (IS_WINDOWS) { + return this.toolPath; + } + _getSpawnArgs(options) { + if (IS_WINDOWS) { if (this._isCmdFile()) { - let argline = `/D /S /C "${this._windowsQuoteCmdArg( - this.toolPath - )}`; - for (const a of this.args) { - argline += ' '; - argline += options.windowsVerbatimArguments - ? a - : this._windowsQuoteCmdArg(a); - } - argline += '"'; - return [argline]; + let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; + for (const a of this.args) { + argline += ' '; + argline += options.windowsVerbatimArguments + ? a + : this._windowsQuoteCmdArg(a); + } + argline += '"'; + return [argline]; } - } - return this.args; } - _endsWith(str, end) { - return str.endsWith(end); - } - _isCmdFile() { - const upperToolPath = this.toolPath.toUpperCase(); - return ( - this._endsWith(upperToolPath, '.CMD') || - this._endsWith(upperToolPath, '.BAT') - ); - } - _windowsQuoteCmdArg(arg) { - // for .exe, apply the normal quoting rules that libuv applies - if (!this._isCmdFile()) { + return this.args; + } + _endsWith(str, end) { + return str.endsWith(end); + } + _isCmdFile() { + const upperToolPath = this.toolPath.toUpperCase(); + return (this._endsWith(upperToolPath, '.CMD') || + this._endsWith(upperToolPath, '.BAT')); + } + _windowsQuoteCmdArg(arg) { + // for .exe, apply the normal quoting rules that libuv applies + if (!this._isCmdFile()) { return this._uvQuoteCmdArg(arg); - } - // otherwise apply quoting rules specific to the cmd.exe command line parser. - // the libuv rules are generic and are not designed specifically for cmd.exe - // command line parser. - // - // for a detailed description of the cmd.exe command line parser, refer to - // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 - // need quotes for empty arg - if (!arg) { + } + // otherwise apply quoting rules specific to the cmd.exe command line parser. + // the libuv rules are generic and are not designed specifically for cmd.exe + // command line parser. + // + // for a detailed description of the cmd.exe command line parser, refer to + // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 + // need quotes for empty arg + if (!arg) { return '""'; - } - // determine whether the arg needs to be quoted - const cmdSpecialChars = [ + } + // determine whether the arg needs to be quoted + const cmdSpecialChars = [ ' ', '\t', '&', @@ -744,952 +620,849 @@ module.exports = /******/ (() => { '|', '<', '>', - '"', - ]; - let needsQuotes = false; - for (const char of arg) { - if (cmdSpecialChars.some((x) => x === char)) { - needsQuotes = true; - break; + '"' + ]; + let needsQuotes = false; + for (const char of arg) { + if (cmdSpecialChars.some(x => x === char)) { + needsQuotes = true; + break; } - } - // short-circuit if quotes not needed - if (!needsQuotes) { + } + // short-circuit if quotes not needed + if (!needsQuotes) { return arg; - } - // the following quoting rules are very similar to the rules that by libuv applies. - // - // 1) wrap the string in quotes - // - // 2) double-up quotes - i.e. " => "" - // - // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately - // doesn't work well with a cmd.exe command line. - // - // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. - // for example, the command line: - // foo.exe "myarg:""my val""" - // is parsed by a .NET console app into an arg array: - // [ "myarg:\"my val\"" ] - // which is the same end result when applying libuv quoting rules. although the actual - // command line from libuv quoting rules would look like: - // foo.exe "myarg:\"my val\"" - // - // 3) double-up slashes that precede a quote, - // e.g. hello \world => "hello \world" - // hello\"world => "hello\\""world" - // hello\\"world => "hello\\\\""world" - // hello world\ => "hello world\\" - // - // technically this is not required for a cmd.exe command line, or the batch argument parser. - // the reasons for including this as a .cmd quoting rule are: - // - // a) this is optimized for the scenario where the argument is passed from the .cmd file to an - // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. - // - // b) it's what we've been doing previously (by deferring to node default behavior) and we - // haven't heard any complaints about that aspect. - // - // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be - // escaped when used on the command line directly - even though within a .cmd file % can be escaped - // by using %%. - // - // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts - // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. - // - // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would - // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the - // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args - // to an external program. - // - // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. - // % can be escaped within a .cmd file. - let reverse = '"'; - let quoteHit = true; - for (let i = arg.length; i > 0; i--) { + } + // the following quoting rules are very similar to the rules that by libuv applies. + // + // 1) wrap the string in quotes + // + // 2) double-up quotes - i.e. " => "" + // + // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately + // doesn't work well with a cmd.exe command line. + // + // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. + // for example, the command line: + // foo.exe "myarg:""my val""" + // is parsed by a .NET console app into an arg array: + // [ "myarg:\"my val\"" ] + // which is the same end result when applying libuv quoting rules. although the actual + // command line from libuv quoting rules would look like: + // foo.exe "myarg:\"my val\"" + // + // 3) double-up slashes that precede a quote, + // e.g. hello \world => "hello \world" + // hello\"world => "hello\\""world" + // hello\\"world => "hello\\\\""world" + // hello world\ => "hello world\\" + // + // technically this is not required for a cmd.exe command line, or the batch argument parser. + // the reasons for including this as a .cmd quoting rule are: + // + // a) this is optimized for the scenario where the argument is passed from the .cmd file to an + // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. + // + // b) it's what we've been doing previously (by deferring to node default behavior) and we + // haven't heard any complaints about that aspect. + // + // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be + // escaped when used on the command line directly - even though within a .cmd file % can be escaped + // by using %%. + // + // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts + // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. + // + // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would + // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the + // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args + // to an external program. + // + // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. + // % can be escaped within a .cmd file. + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { // walk the string in reverse reverse += arg[i - 1]; if (quoteHit && arg[i - 1] === '\\') { - reverse += '\\'; // double the slash - } else if (arg[i - 1] === '"') { - quoteHit = true; - reverse += '"'; // double the quote - } else { - quoteHit = false; + reverse += '\\'; // double the slash + } + else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += '"'; // double the quote + } + else { + quoteHit = false; } - } - reverse += '"'; - return reverse.split('').reverse().join(''); } - _uvQuoteCmdArg(arg) { - // Tool runner wraps child_process.spawn() and needs to apply the same quoting as - // Node in certain cases where the undocumented spawn option windowsVerbatimArguments - // is used. - // - // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, - // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), - // pasting copyright notice from Node within this function: - // - // Copyright Joyent, Inc. and other Node contributors. All rights reserved. - // - // 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. - if (!arg) { + reverse += '"'; + return reverse + .split('') + .reverse() + .join(''); + } + _uvQuoteCmdArg(arg) { + // Tool runner wraps child_process.spawn() and needs to apply the same quoting as + // Node in certain cases where the undocumented spawn option windowsVerbatimArguments + // is used. + // + // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, + // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), + // pasting copyright notice from Node within this function: + // + // Copyright Joyent, Inc. and other Node contributors. All rights reserved. + // + // 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. + if (!arg) { // Need double quotation for empty argument return '""'; - } - if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { + } + if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { // No quotation needed return arg; - } - if (!arg.includes('"') && !arg.includes('\\')) { + } + if (!arg.includes('"') && !arg.includes('\\')) { // No embedded double quotes or backslashes, so I can just wrap // quote marks around the whole thing. return `"${arg}"`; - } - // Expected input/output: - // input : hello"world - // output: "hello\"world" - // input : hello""world - // output: "hello\"\"world" - // input : hello\world - // output: hello\world - // input : hello\\world - // output: hello\\world - // input : hello\"world - // output: "hello\\\"world" - // input : hello\\"world - // output: "hello\\\\\"world" - // input : hello world\ - // output: "hello world\\" - note the comment in libuv actually reads "hello world\" - // but it appears the comment is wrong, it should be "hello world\\" - let reverse = '"'; - let quoteHit = true; - for (let i = arg.length; i > 0; i--) { + } + // Expected input/output: + // input : hello"world + // output: "hello\"world" + // input : hello""world + // output: "hello\"\"world" + // input : hello\world + // output: hello\world + // input : hello\\world + // output: hello\\world + // input : hello\"world + // output: "hello\\\"world" + // input : hello\\"world + // output: "hello\\\\\"world" + // input : hello world\ + // output: "hello world\\" - note the comment in libuv actually reads "hello world\" + // but it appears the comment is wrong, it should be "hello world\\" + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { // walk the string in reverse reverse += arg[i - 1]; if (quoteHit && arg[i - 1] === '\\') { - reverse += '\\'; - } else if (arg[i - 1] === '"') { - quoteHit = true; - reverse += '\\'; - } else { - quoteHit = false; + reverse += '\\'; + } + else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += '\\'; + } + else { + quoteHit = false; } - } - reverse += '"'; - return reverse.split('').reverse().join(''); } - _cloneExecOptions(options) { - options = options || {}; - const result = { + reverse += '"'; + return reverse + .split('') + .reverse() + .join(''); + } + _cloneExecOptions(options) { + options = options || {}; + const result = { cwd: options.cwd || process.cwd(), env: options.env || process.env, silent: options.silent || false, windowsVerbatimArguments: options.windowsVerbatimArguments || false, failOnStdErr: options.failOnStdErr || false, ignoreReturnCode: options.ignoreReturnCode || false, - delay: options.delay || 10000, - }; - result.outStream = options.outStream || process.stdout; - result.errStream = options.errStream || process.stderr; - return result; - } - _getSpawnOptions(options, toolPath) { - options = options || {}; - const result = {}; - result.cwd = options.cwd; - result.env = options.env; - result['windowsVerbatimArguments'] = + delay: options.delay || 10000 + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; + } + _getSpawnOptions(options, toolPath) { + options = options || {}; + const result = {}; + result.cwd = options.cwd; + result.env = options.env; + result['windowsVerbatimArguments'] = options.windowsVerbatimArguments || this._isCmdFile(); - if (options.windowsVerbatimArguments) { + if (options.windowsVerbatimArguments) { result.argv0 = `"${toolPath}"`; - } - return result; } - /** - * Exec a tool. - * Output will be streamed to the live console. - * Returns promise with return code - * - * @param tool path to tool to exec - * @param options optional exec options. See ExecOptions - * @returns number - */ - exec() { - return __awaiter(this, void 0, void 0, function* () { + return result; + } + /** + * Exec a tool. + * Output will be streamed to the live console. + * Returns promise with return code + * + * @param tool path to tool to exec + * @param options optional exec options. See ExecOptions + * @returns number + */ + exec() { + return __awaiter(this, void 0, void 0, function* () { // root the tool path if it is unrooted and contains relative pathing - if ( - !ioUtil.isRooted(this.toolPath) && - (this.toolPath.includes('/') || - (IS_WINDOWS && this.toolPath.includes('\\'))) - ) { - // prefer options.cwd if it is specified, however options.cwd may also need to be rooted - this.toolPath = path.resolve( - process.cwd(), - this.options.cwd || process.cwd(), - this.toolPath - ); + if (!ioUtil.isRooted(this.toolPath) && + (this.toolPath.includes('/') || + (IS_WINDOWS && this.toolPath.includes('\\')))) { + // prefer options.cwd if it is specified, however options.cwd may also need to be rooted + this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); } // if the tool is only a file name, then resolve it from the PATH // otherwise verify it exists (add extension on Windows if necessary) this.toolPath = yield io.which(this.toolPath, true); return new Promise((resolve, reject) => { - this._debug(`exec tool: ${this.toolPath}`); - this._debug('arguments:'); - for (const arg of this.args) { - this._debug(` ${arg}`); - } - const optionsNonNull = this._cloneExecOptions(this.options); - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write( - this._getCommandString(optionsNonNull) + os.EOL - ); - } - const state = new ExecState(optionsNonNull, this.toolPath); - state.on('debug', (message) => { - this._debug(message); - }); - const fileName = this._getSpawnFileName(); - const cp = child.spawn( - fileName, - this._getSpawnArgs(optionsNonNull), - this._getSpawnOptions(this.options, fileName) - ); - const stdbuffer = ''; - if (cp.stdout) { - cp.stdout.on('data', (data) => { - if (this.options.listeners && this.options.listeners.stdout) { - this.options.listeners.stdout(data); - } - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write(data); - } - this._processLineBuffer(data, stdbuffer, (line) => { - if ( - this.options.listeners && - this.options.listeners.stdline - ) { - this.options.listeners.stdline(line); - } - }); + this._debug(`exec tool: ${this.toolPath}`); + this._debug('arguments:'); + for (const arg of this.args) { + this._debug(` ${arg}`); + } + const optionsNonNull = this._cloneExecOptions(this.options); + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + } + const state = new ExecState(optionsNonNull, this.toolPath); + state.on('debug', (message) => { + this._debug(message); }); - } - const errbuffer = ''; - if (cp.stderr) { - cp.stderr.on('data', (data) => { - state.processStderr = true; - if (this.options.listeners && this.options.listeners.stderr) { - this.options.listeners.stderr(data); - } - if ( - !optionsNonNull.silent && - optionsNonNull.errStream && - optionsNonNull.outStream - ) { - const s = optionsNonNull.failOnStdErr - ? optionsNonNull.errStream - : optionsNonNull.outStream; - s.write(data); - } - this._processLineBuffer(data, errbuffer, (line) => { - if ( - this.options.listeners && - this.options.listeners.errline - ) { - this.options.listeners.errline(line); - } - }); + const fileName = this._getSpawnFileName(); + const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); + const stdbuffer = ''; + if (cp.stdout) { + cp.stdout.on('data', (data) => { + if (this.options.listeners && this.options.listeners.stdout) { + this.options.listeners.stdout(data); + } + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(data); + } + this._processLineBuffer(data, stdbuffer, (line) => { + if (this.options.listeners && this.options.listeners.stdline) { + this.options.listeners.stdline(line); + } + }); + }); + } + const errbuffer = ''; + if (cp.stderr) { + cp.stderr.on('data', (data) => { + state.processStderr = true; + if (this.options.listeners && this.options.listeners.stderr) { + this.options.listeners.stderr(data); + } + if (!optionsNonNull.silent && + optionsNonNull.errStream && + optionsNonNull.outStream) { + const s = optionsNonNull.failOnStdErr + ? optionsNonNull.errStream + : optionsNonNull.outStream; + s.write(data); + } + this._processLineBuffer(data, errbuffer, (line) => { + if (this.options.listeners && this.options.listeners.errline) { + this.options.listeners.errline(line); + } + }); + }); + } + cp.on('error', (err) => { + state.processError = err.message; + state.processExited = true; + state.processClosed = true; + state.CheckComplete(); }); - } - cp.on('error', (err) => { - state.processError = err.message; - state.processExited = true; - state.processClosed = true; - state.CheckComplete(); - }); - cp.on('exit', (code) => { - state.processExitCode = code; - state.processExited = true; - this._debug( - `Exit code ${code} received from tool '${this.toolPath}'` - ); - state.CheckComplete(); - }); - cp.on('close', (code) => { - state.processExitCode = code; - state.processExited = true; - state.processClosed = true; - this._debug( - `STDIO streams have closed for tool '${this.toolPath}'` - ); - state.CheckComplete(); - }); - state.on('done', (error, exitCode) => { - if (stdbuffer.length > 0) { - this.emit('stdline', stdbuffer); + cp.on('exit', (code) => { + state.processExitCode = code; + state.processExited = true; + this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); + state.CheckComplete(); + }); + cp.on('close', (code) => { + state.processExitCode = code; + state.processExited = true; + state.processClosed = true; + this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); + state.CheckComplete(); + }); + state.on('done', (error, exitCode) => { + if (stdbuffer.length > 0) { + this.emit('stdline', stdbuffer); + } + if (errbuffer.length > 0) { + this.emit('errline', errbuffer); + } + cp.removeAllListeners(); + if (error) { + reject(error); + } + else { + resolve(exitCode); + } + }); + if (this.options.input) { + if (!cp.stdin) { + throw new Error('child process missing stdin'); + } + cp.stdin.end(this.options.input); } - if (errbuffer.length > 0) { - this.emit('errline', errbuffer); - } - cp.removeAllListeners(); - if (error) { - reject(error); - } else { - resolve(exitCode); - } - }); - if (this.options.input) { - if (!cp.stdin) { - throw new Error('child process missing stdin'); - } - cp.stdin.end(this.options.input); - } }); - }); - } - } - exports.ToolRunner = ToolRunner; - /** - * Convert an arg string to an array of args. Handles escaping - * - * @param argString string of arguments - * @returns string[] array of arguments - */ - function argStringToArray(argString) { - const args = []; - let inQuotes = false; - let escaped = false; - let arg = ''; - function append(c) { - // we only escape double quotes. - if (escaped && c !== '"') { + }); + } +} +exports.ToolRunner = ToolRunner; +/** + * Convert an arg string to an array of args. Handles escaping + * + * @param argString string of arguments + * @returns string[] array of arguments + */ +function argStringToArray(argString) { + const args = []; + let inQuotes = false; + let escaped = false; + let arg = ''; + function append(c) { + // we only escape double quotes. + if (escaped && c !== '"') { arg += '\\'; - } - arg += c; - escaped = false; } - for (let i = 0; i < argString.length; i++) { - const c = argString.charAt(i); - if (c === '"') { + arg += c; + escaped = false; + } + for (let i = 0; i < argString.length; i++) { + const c = argString.charAt(i); + if (c === '"') { if (!escaped) { - inQuotes = !inQuotes; - } else { - append(c); + inQuotes = !inQuotes; + } + else { + append(c); } continue; - } - if (c === '\\' && escaped) { + } + if (c === '\\' && escaped) { append(c); continue; - } - if (c === '\\' && inQuotes) { + } + if (c === '\\' && inQuotes) { escaped = true; continue; - } - if (c === ' ' && !inQuotes) { + } + if (c === ' ' && !inQuotes) { if (arg.length > 0) { - args.push(arg); - arg = ''; + args.push(arg); + arg = ''; } continue; - } - append(c); } - if (arg.length > 0) { - args.push(arg.trim()); - } - return args; - } - exports.argStringToArray = argStringToArray; - class ExecState extends events.EventEmitter { - constructor(options, toolPath) { - super(); - this.processClosed = false; // tracks whether the process has exited and stdio is closed - this.processError = ''; - this.processExitCode = 0; - this.processExited = false; // tracks whether the process has exited - this.processStderr = false; // tracks whether stderr was written to - this.delay = 10000; // 10 seconds - this.done = false; - this.timeout = null; - if (!toolPath) { + append(c); + } + if (arg.length > 0) { + args.push(arg.trim()); + } + return args; +} +exports.argStringToArray = argStringToArray; +class ExecState extends events.EventEmitter { + constructor(options, toolPath) { + super(); + this.processClosed = false; // tracks whether the process has exited and stdio is closed + this.processError = ''; + this.processExitCode = 0; + this.processExited = false; // tracks whether the process has exited + this.processStderr = false; // tracks whether stderr was written to + this.delay = 10000; // 10 seconds + this.done = false; + this.timeout = null; + if (!toolPath) { throw new Error('toolPath must not be empty'); - } - this.options = options; - this.toolPath = toolPath; - if (options.delay) { + } + this.options = options; + this.toolPath = toolPath; + if (options.delay) { this.delay = options.delay; - } } - CheckComplete() { - if (this.done) { + } + CheckComplete() { + if (this.done) { return; - } - if (this.processClosed) { + } + if (this.processClosed) { this._setResult(); - } else if (this.processExited) { - this.timeout = setTimeout( - ExecState.HandleTimeout, - this.delay, - this - ); - } } - _debug(message) { - this.emit('debug', message); + else if (this.processExited) { + this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this); } - _setResult() { - // determine whether there is an error - let error; - if (this.processExited) { + } + _debug(message) { + this.emit('debug', message); + } + _setResult() { + // determine whether there is an error + let error; + if (this.processExited) { if (this.processError) { - error = new Error( - `There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}` - ); - } else if ( - this.processExitCode !== 0 && - !this.options.ignoreReturnCode - ) { - error = new Error( - `The process '${this.toolPath}' failed with exit code ${this.processExitCode}` - ); - } else if (this.processStderr && this.options.failOnStdErr) { - error = new Error( - `The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream` - ); + error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); } - } - // clear the timeout - if (this.timeout) { + else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { + error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); + } + else if (this.processStderr && this.options.failOnStdErr) { + error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); + } + } + // clear the timeout + if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; - } - this.done = true; - this.emit('done', error, this.processExitCode); } - static HandleTimeout(state) { - if (state.done) { + this.done = true; + this.emit('done', error, this.processExitCode); + } + static HandleTimeout(state) { + if (state.done) { return; - } - if (!state.processClosed && state.processExited) { - const message = `The STDIO streams did not close within ${ - state.delay / 1000 - } seconds of the exit event from process '${ - state.toolPath - }'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; - state._debug(message); - } - state._setResult(); } - } - //# sourceMappingURL=toolrunner.js.map + if (!state.processClosed && state.processExited) { + const message = `The STDIO streams did not close within ${state.delay / + 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; + state._debug(message); + } + state._setResult(); + } +} +//# sourceMappingURL=toolrunner.js.map - /***/ - }, +/***/ }), - /***/ 1962: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; +/***/ 1962: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done - ? resolve(result.value) - : adopt(result.value).then(fulfilled, rejected); - } - step( - (generator = generator.apply(thisArg, _arguments || [])).next() - ); - }); - }; - var _a; - Object.defineProperty(exports, '__esModule', { value: true }); - const assert_1 = __nccwpck_require__(2357); - const fs = __nccwpck_require__(5747); - const path = __nccwpck_require__(5622); - (_a = fs.promises), - (exports.chmod = _a.chmod), - (exports.copyFile = _a.copyFile), - (exports.lstat = _a.lstat), - (exports.mkdir = _a.mkdir), - (exports.readdir = _a.readdir), - (exports.readlink = _a.readlink), - (exports.rename = _a.rename), - (exports.rmdir = _a.rmdir), - (exports.stat = _a.stat), - (exports.symlink = _a.symlink), - (exports.unlink = _a.unlink); - exports.IS_WINDOWS = process.platform === 'win32'; - function exists(fsPath) { - return __awaiter(this, void 0, void 0, function* () { - try { +"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()); + }); +}; +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const assert_1 = __nccwpck_require__(2357); +const fs = __nccwpck_require__(5747); +const path = __nccwpck_require__(5622); +_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; +exports.IS_WINDOWS = process.platform === 'win32'; +function exists(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + try { yield exports.stat(fsPath); - } catch (err) { + } + catch (err) { if (err.code === 'ENOENT') { - return false; + return false; } throw err; - } - return true; - }); - } - exports.exists = exists; - function isDirectory(fsPath, useStat = false) { - return __awaiter(this, void 0, void 0, function* () { - const stats = useStat - ? yield exports.stat(fsPath) - : yield exports.lstat(fsPath); - return stats.isDirectory(); - }); - } - exports.isDirectory = isDirectory; - /** - * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: - * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). - */ - function isRooted(p) { - p = normalizeSeparators(p); - if (!p) { - throw new Error('isRooted() parameter "p" cannot be empty'); } - if (exports.IS_WINDOWS) { - return ( - p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello - ); // e.g. C: or C:\hello - } - return p.startsWith('/'); - } - exports.isRooted = isRooted; - /** - * Recursively create a directory at `fsPath`. - * - * This implementation is optimistic, meaning it attempts to create the full - * path first, and backs up the path stack from there. - * - * @param fsPath The path to create - * @param maxDepth The maximum recursion depth - * @param depth The current recursion depth - */ - function mkdirP(fsPath, maxDepth = 1000, depth = 1) { - return __awaiter(this, void 0, void 0, function* () { - assert_1.ok(fsPath, 'a path argument must be provided'); - fsPath = path.resolve(fsPath); - if (depth >= maxDepth) return exports.mkdir(fsPath); - try { + return true; + }); +} +exports.exists = exists; +function isDirectory(fsPath, useStat = false) { + return __awaiter(this, void 0, void 0, function* () { + const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); + return stats.isDirectory(); + }); +} +exports.isDirectory = isDirectory; +/** + * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: + * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). + */ +function isRooted(p) { + p = normalizeSeparators(p); + if (!p) { + throw new Error('isRooted() parameter "p" cannot be empty'); + } + if (exports.IS_WINDOWS) { + return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello + ); // e.g. C: or C:\hello + } + return p.startsWith('/'); +} +exports.isRooted = isRooted; +/** + * Recursively create a directory at `fsPath`. + * + * This implementation is optimistic, meaning it attempts to create the full + * path first, and backs up the path stack from there. + * + * @param fsPath The path to create + * @param maxDepth The maximum recursion depth + * @param depth The current recursion depth + */ +function mkdirP(fsPath, maxDepth = 1000, depth = 1) { + return __awaiter(this, void 0, void 0, function* () { + assert_1.ok(fsPath, 'a path argument must be provided'); + fsPath = path.resolve(fsPath); + if (depth >= maxDepth) + return exports.mkdir(fsPath); + try { yield exports.mkdir(fsPath); return; - } catch (err) { + } + catch (err) { switch (err.code) { - case 'ENOENT': { - yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1); - yield exports.mkdir(fsPath); - return; - } - default: { - let stats; - try { - stats = yield exports.stat(fsPath); - } catch (err2) { - throw err; + case 'ENOENT': { + yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1); + yield exports.mkdir(fsPath); + return; + } + default: { + let stats; + try { + stats = yield exports.stat(fsPath); + } + catch (err2) { + throw err; + } + if (!stats.isDirectory()) + throw err; } - if (!stats.isDirectory()) throw err; - } } - } - }); - } - exports.mkdirP = mkdirP; - /** - * Best effort attempt to determine whether a file exists and is executable. - * @param filePath file path to check - * @param extensions additional file extensions to try - * @return if file exists and is executable, returns the file path. otherwise empty string. - */ - function tryGetExecutablePath(filePath, extensions) { - return __awaiter(this, void 0, void 0, function* () { - let stats = undefined; - try { + } + }); +} +exports.mkdirP = mkdirP; +/** + * Best effort attempt to determine whether a file exists and is executable. + * @param filePath file path to check + * @param extensions additional file extensions to try + * @return if file exists and is executable, returns the file path. otherwise empty string. + */ +function tryGetExecutablePath(filePath, extensions) { + return __awaiter(this, void 0, void 0, function* () { + let stats = undefined; + try { // test file exists stats = yield exports.stat(filePath); - } catch (err) { + } + catch (err) { if (err.code !== 'ENOENT') { - // eslint-disable-next-line no-console - console.log( - `Unexpected error attempting to determine if executable file exists '${filePath}': ${err}` - ); + // eslint-disable-next-line no-console + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); } - } - if (stats && stats.isFile()) { + } + if (stats && stats.isFile()) { if (exports.IS_WINDOWS) { - // on Windows, test for valid extension - const upperExt = path.extname(filePath).toUpperCase(); - if ( - extensions.some( - (validExt) => validExt.toUpperCase() === upperExt - ) - ) { - return filePath; - } - } else { - if (isUnixExecutable(stats)) { - return filePath; - } + // on Windows, test for valid extension + const upperExt = path.extname(filePath).toUpperCase(); + if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { + return filePath; + } } - } - // try each extension - const originalFilePath = filePath; - for (const extension of extensions) { + else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + // try each extension + const originalFilePath = filePath; + for (const extension of extensions) { filePath = originalFilePath + extension; stats = undefined; try { - stats = yield exports.stat(filePath); - } catch (err) { - if (err.code !== 'ENOENT') { - // eslint-disable-next-line no-console - console.log( - `Unexpected error attempting to determine if executable file exists '${filePath}': ${err}` - ); - } + stats = yield exports.stat(filePath); + } + catch (err) { + if (err.code !== 'ENOENT') { + // eslint-disable-next-line no-console + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } } if (stats && stats.isFile()) { - if (exports.IS_WINDOWS) { - // preserve the case of the actual file (since an extension was appended) - try { - const directory = path.dirname(filePath); - const upperName = path.basename(filePath).toUpperCase(); - for (const actualName of yield exports.readdir(directory)) { - if (upperName === actualName.toUpperCase()) { - filePath = path.join(directory, actualName); - break; + if (exports.IS_WINDOWS) { + // preserve the case of the actual file (since an extension was appended) + try { + const directory = path.dirname(filePath); + const upperName = path.basename(filePath).toUpperCase(); + for (const actualName of yield exports.readdir(directory)) { + if (upperName === actualName.toUpperCase()) { + filePath = path.join(directory, actualName); + break; + } + } } - } - } catch (err) { - // eslint-disable-next-line no-console - console.log( - `Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}` - ); + catch (err) { + // eslint-disable-next-line no-console + console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); + } + return filePath; } - return filePath; - } else { - if (isUnixExecutable(stats)) { - return filePath; + else { + if (isUnixExecutable(stats)) { + return filePath; + } } - } } - } - return ''; - }); - } - exports.tryGetExecutablePath = tryGetExecutablePath; - function normalizeSeparators(p) { - p = p || ''; - if (exports.IS_WINDOWS) { - // convert slashes on Windows - p = p.replace(/\//g, '\\'); - // remove redundant slashes - return p.replace(/\\\\+/g, '\\'); } + return ''; + }); +} +exports.tryGetExecutablePath = tryGetExecutablePath; +function normalizeSeparators(p) { + p = p || ''; + if (exports.IS_WINDOWS) { + // convert slashes on Windows + p = p.replace(/\//g, '\\'); // remove redundant slashes - return p.replace(/\/\/+/g, '/'); - } - // on Mac/Linux, test the execute bit - // R W X R W X R W X - // 256 128 64 32 16 8 4 2 1 - function isUnixExecutable(stats) { - return ( - (stats.mode & 1) > 0 || - ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || - ((stats.mode & 64) > 0 && stats.uid === process.getuid()) - ); - } - //# sourceMappingURL=io-util.js.map + return p.replace(/\\\\+/g, '\\'); + } + // remove redundant slashes + return p.replace(/\/\/+/g, '/'); +} +// on Mac/Linux, test the execute bit +// R W X R W X R W X +// 256 128 64 32 16 8 4 2 1 +function isUnixExecutable(stats) { + return ((stats.mode & 1) > 0 || + ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || + ((stats.mode & 64) > 0 && stats.uid === process.getuid())); +} +//# sourceMappingURL=io-util.js.map - /***/ - }, +/***/ }), - /***/ 7436: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; +/***/ 7436: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - 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 }); - const childProcess = __nccwpck_require__(3129); - const path = __nccwpck_require__(5622); - const util_1 = __nccwpck_require__(1669); - const ioUtil = __nccwpck_require__(1962); - const exec = util_1.promisify(childProcess.exec); - /** - * Copies a file or folder. - * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js - * - * @param source source path - * @param dest destination path - * @param options optional. See CopyOptions. - */ - function cp(source, dest, options = {}) { - return __awaiter(this, void 0, void 0, function* () { - const { force, recursive } = readCopyOptions(options); - const destStat = (yield ioUtil.exists(dest)) - ? yield ioUtil.stat(dest) - : null; - // Dest is an existing file, but not forcing - if (destStat && destStat.isFile() && !force) { +"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 })); +const childProcess = __nccwpck_require__(3129); +const path = __nccwpck_require__(5622); +const util_1 = __nccwpck_require__(1669); +const ioUtil = __nccwpck_require__(1962); +const exec = util_1.promisify(childProcess.exec); +/** + * Copies a file or folder. + * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js + * + * @param source source path + * @param dest destination path + * @param options optional. See CopyOptions. + */ +function cp(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const { force, recursive } = readCopyOptions(options); + const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; + // Dest is an existing file, but not forcing + if (destStat && destStat.isFile() && !force) { return; - } - // If dest is an existing directory, should copy inside. - const newDest = - destStat && destStat.isDirectory() - ? path.join(dest, path.basename(source)) - : dest; - if (!(yield ioUtil.exists(source))) { + } + // If dest is an existing directory, should copy inside. + const newDest = destStat && destStat.isDirectory() + ? path.join(dest, path.basename(source)) + : dest; + if (!(yield ioUtil.exists(source))) { throw new Error(`no such file or directory: ${source}`); - } - const sourceStat = yield ioUtil.stat(source); - if (sourceStat.isDirectory()) { + } + const sourceStat = yield ioUtil.stat(source); + if (sourceStat.isDirectory()) { if (!recursive) { - throw new Error( - `Failed to copy. ${source} is a directory, but tried to copy without recursive flag.` - ); - } else { - yield cpDirRecursive(source, newDest, 0, force); + throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); } - } else { + else { + yield cpDirRecursive(source, newDest, 0, force); + } + } + else { if (path.relative(source, newDest) === '') { - // a file cannot be copied to itself - throw new Error(`'${newDest}' and '${source}' are the same file`); + // a file cannot be copied to itself + throw new Error(`'${newDest}' and '${source}' are the same file`); } yield copyFile(source, newDest, force); - } - }); - } - exports.cp = cp; - /** - * Moves a path. - * - * @param source source path - * @param dest destination path - * @param options optional. See MoveOptions. - */ - function mv(source, dest, options = {}) { - return __awaiter(this, void 0, void 0, function* () { - if (yield ioUtil.exists(dest)) { + } + }); +} +exports.cp = cp; +/** + * Moves a path. + * + * @param source source path + * @param dest destination path + * @param options optional. See MoveOptions. + */ +function mv(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + if (yield ioUtil.exists(dest)) { let destExists = true; if (yield ioUtil.isDirectory(dest)) { - // If dest is directory copy src into dest - dest = path.join(dest, path.basename(source)); - destExists = yield ioUtil.exists(dest); + // If dest is directory copy src into dest + dest = path.join(dest, path.basename(source)); + destExists = yield ioUtil.exists(dest); } if (destExists) { - if (options.force == null || options.force) { - yield rmRF(dest); - } else { - throw new Error('Destination already exists'); - } + if (options.force == null || options.force) { + yield rmRF(dest); + } + else { + throw new Error('Destination already exists'); + } } - } - yield mkdirP(path.dirname(dest)); - yield ioUtil.rename(source, dest); - }); - } - exports.mv = mv; - /** - * Remove a path recursively with force - * - * @param inputPath path to remove - */ - function rmRF(inputPath) { - return __awaiter(this, void 0, void 0, function* () { - if (ioUtil.IS_WINDOWS) { + } + yield mkdirP(path.dirname(dest)); + yield ioUtil.rename(source, dest); + }); +} +exports.mv = mv; +/** + * Remove a path recursively with force + * + * @param inputPath path to remove + */ +function rmRF(inputPath) { + return __awaiter(this, void 0, void 0, function* () { + if (ioUtil.IS_WINDOWS) { // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. try { - if (yield ioUtil.isDirectory(inputPath, true)) { - yield exec(`rd /s /q "${inputPath}"`); - } else { - yield exec(`del /f /a "${inputPath}"`); - } - } catch (err) { - // if you try to delete a file that doesn't exist, desired result is achieved - // other errors are valid - if (err.code !== 'ENOENT') throw err; + if (yield ioUtil.isDirectory(inputPath, true)) { + yield exec(`rd /s /q "${inputPath}"`); + } + else { + yield exec(`del /f /a "${inputPath}"`); + } + } + catch (err) { + // if you try to delete a file that doesn't exist, desired result is achieved + // other errors are valid + if (err.code !== 'ENOENT') + throw err; } // Shelling out fails to remove a symlink folder with missing source, this unlink catches that try { - yield ioUtil.unlink(inputPath); - } catch (err) { - // if you try to delete a file that doesn't exist, desired result is achieved - // other errors are valid - if (err.code !== 'ENOENT') throw err; + yield ioUtil.unlink(inputPath); } - } else { + catch (err) { + // if you try to delete a file that doesn't exist, desired result is achieved + // other errors are valid + if (err.code !== 'ENOENT') + throw err; + } + } + else { let isDir = false; try { - isDir = yield ioUtil.isDirectory(inputPath); - } catch (err) { - // if you try to delete a file that doesn't exist, desired result is achieved - // other errors are valid - if (err.code !== 'ENOENT') throw err; - return; + isDir = yield ioUtil.isDirectory(inputPath); + } + catch (err) { + // if you try to delete a file that doesn't exist, desired result is achieved + // other errors are valid + if (err.code !== 'ENOENT') + throw err; + return; } if (isDir) { - yield exec(`rm -rf "${inputPath}"`); - } else { - yield ioUtil.unlink(inputPath); + yield exec(`rm -rf "${inputPath}"`); } - } - }); - } - exports.rmRF = rmRF; - /** - * Make a directory. Creates the full path with folders in between - * Will throw if it fails - * - * @param fsPath path to create - * @returns Promise - */ - function mkdirP(fsPath) { - return __awaiter(this, void 0, void 0, function* () { - yield ioUtil.mkdirP(fsPath); - }); - } - exports.mkdirP = mkdirP; - /** - * Returns path of a tool had the tool actually been invoked. Resolves via paths. - * If you check and the tool does not exist, it will throw. - * - * @param tool name of the tool - * @param check whether to check if tool exists - * @returns Promise path to tool - */ - function which(tool, check) { - return __awaiter(this, void 0, void 0, function* () { - if (!tool) { + else { + yield ioUtil.unlink(inputPath); + } + } + }); +} +exports.rmRF = rmRF; +/** + * Make a directory. Creates the full path with folders in between + * Will throw if it fails + * + * @param fsPath path to create + * @returns Promise + */ +function mkdirP(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + yield ioUtil.mkdirP(fsPath); + }); +} +exports.mkdirP = mkdirP; +/** + * Returns path of a tool had the tool actually been invoked. Resolves via paths. + * If you check and the tool does not exist, it will throw. + * + * @param tool name of the tool + * @param check whether to check if tool exists + * @returns Promise path to tool + */ +function which(tool, check) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { throw new Error("parameter 'tool' is required"); - } - // recursive when check=true - if (check) { + } + // recursive when check=true + if (check) { const result = yield which(tool, false); if (!result) { - if (ioUtil.IS_WINDOWS) { - throw new Error( - `Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.` - ); - } else { - throw new Error( - `Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.` - ); - } + if (ioUtil.IS_WINDOWS) { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); + } + else { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); + } } - } - try { + } + try { // build the list of extensions to try const extensions = []; if (ioUtil.IS_WINDOWS && process.env.PATHEXT) { - for (const extension of process.env.PATHEXT.split( - path.delimiter - )) { - if (extension) { - extensions.push(extension); + for (const extension of process.env.PATHEXT.split(path.delimiter)) { + if (extension) { + extensions.push(extension); + } } - } } // if it's rooted, return it if exists. otherwise return empty. if (ioUtil.isRooted(tool)) { - const filePath = yield ioUtil.tryGetExecutablePath( - tool, - extensions - ); - if (filePath) { - return filePath; - } - return ''; + const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); + if (filePath) { + return filePath; + } + return ''; } // if any path separators, return empty - if ( - tool.includes('/') || - (ioUtil.IS_WINDOWS && tool.includes('\\')) - ) { - return ''; + if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) { + return ''; } // build the list of directories // @@ -1699,769 +1472,525 @@ module.exports = /******/ (() => { // across platforms. const directories = []; if (process.env.PATH) { - for (const p of process.env.PATH.split(path.delimiter)) { - if (p) { - directories.push(p); + for (const p of process.env.PATH.split(path.delimiter)) { + if (p) { + directories.push(p); + } } - } } // return the first match for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath( - directory + path.sep + tool, - extensions - ); - if (filePath) { - return filePath; - } + const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions); + if (filePath) { + return filePath; + } } return ''; - } catch (err) { + } + catch (err) { throw new Error(`which failed with message ${err.message}`); - } - }); - } - exports.which = which; - function readCopyOptions(options) { - const force = options.force == null ? true : options.force; - const recursive = Boolean(options.recursive); - return { force, recursive }; - } - function cpDirRecursive(sourceDir, destDir, currentDepth, force) { - return __awaiter(this, void 0, void 0, function* () { - // Ensure there is not a run away recursive copy - if (currentDepth >= 255) return; - currentDepth++; - yield mkdirP(destDir); - const files = yield ioUtil.readdir(sourceDir); - for (const fileName of files) { + } + }); +} +exports.which = which; +function readCopyOptions(options) { + const force = options.force == null ? true : options.force; + const recursive = Boolean(options.recursive); + return { force, recursive }; +} +function cpDirRecursive(sourceDir, destDir, currentDepth, force) { + return __awaiter(this, void 0, void 0, function* () { + // Ensure there is not a run away recursive copy + if (currentDepth >= 255) + return; + currentDepth++; + yield mkdirP(destDir); + const files = yield ioUtil.readdir(sourceDir); + for (const fileName of files) { const srcFile = `${sourceDir}/${fileName}`; const destFile = `${destDir}/${fileName}`; const srcFileStat = yield ioUtil.lstat(srcFile); if (srcFileStat.isDirectory()) { - // Recurse - yield cpDirRecursive(srcFile, destFile, currentDepth, force); - } else { - yield copyFile(srcFile, destFile, force); + // Recurse + yield cpDirRecursive(srcFile, destFile, currentDepth, force); } - } - // Change the mode for the newly created directory - yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); - }); - } - // Buffered file copy - function copyFile(srcFile, destFile, force) { - return __awaiter(this, void 0, void 0, function* () { - if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { + else { + yield copyFile(srcFile, destFile, force); + } + } + // Change the mode for the newly created directory + yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); + }); +} +// Buffered file copy +function copyFile(srcFile, destFile, force) { + return __awaiter(this, void 0, void 0, function* () { + if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { // unlink/re-link it try { - yield ioUtil.lstat(destFile); - yield ioUtil.unlink(destFile); - } catch (e) { - // Try to override file permission - if (e.code === 'EPERM') { - yield ioUtil.chmod(destFile, '0666'); + yield ioUtil.lstat(destFile); yield ioUtil.unlink(destFile); - } - // other errors = it doesn't exist, no work to do + } + catch (e) { + // Try to override file permission + if (e.code === 'EPERM') { + yield ioUtil.chmod(destFile, '0666'); + yield ioUtil.unlink(destFile); + } + // other errors = it doesn't exist, no work to do } // Copy over symlink const symlinkFull = yield ioUtil.readlink(srcFile); - yield ioUtil.symlink( - symlinkFull, - destFile, - ioUtil.IS_WINDOWS ? 'junction' : null - ); - } else if (!(yield ioUtil.exists(destFile)) || force) { + yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null); + } + else if (!(yield ioUtil.exists(destFile)) || force) { yield ioUtil.copyFile(srcFile, destFile); - } - }); - } - //# sourceMappingURL=io.js.map - - /***/ - }, - - /***/ 7678: /***/ (module, exports) => { - 'use strict'; - - /// - /// - /// - Object.defineProperty(exports, '__esModule', { value: true }); - const typedArrayTypeNames = [ - 'Int8Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array', - 'BigInt64Array', - 'BigUint64Array', - ]; - function isTypedArrayName(name) { - return typedArrayTypeNames.includes(name); - } - const objectTypeNames = [ - 'Function', - 'Generator', - 'AsyncGenerator', - 'GeneratorFunction', - 'AsyncGeneratorFunction', - 'AsyncFunction', - 'Observable', - 'Array', - 'Buffer', - 'Object', - 'RegExp', - 'Date', - 'Error', - 'Map', - 'Set', - 'WeakMap', - 'WeakSet', - 'ArrayBuffer', - 'SharedArrayBuffer', - 'DataView', - 'Promise', - 'URL', - 'HTMLElement', - ...typedArrayTypeNames, - ]; - function isObjectTypeName(name) { - return objectTypeNames.includes(name); - } - const primitiveTypeNames = [ - 'null', - 'undefined', - 'string', - 'number', - 'bigint', - 'boolean', - 'symbol', - ]; - function isPrimitiveTypeName(name) { - return primitiveTypeNames.includes(name); - } - // eslint-disable-next-line @typescript-eslint/ban-types - function isOfType(type) { - return (value) => typeof value === type; - } - const { toString } = Object.prototype; - const getObjectType = (value) => { - const objectTypeName = toString.call(value).slice(8, -1); - if (/HTML\w+Element/.test(objectTypeName) && is.domElement(value)) { - return 'HTMLElement'; } - if (isObjectTypeName(objectTypeName)) { - return objectTypeName; - } - return undefined; - }; - const isObjectOfType = (type) => (value) => getObjectType(value) === type; - function is(value) { - if (value === null) { - return 'null'; - } - switch (typeof value) { - case 'undefined': + }); +} +//# sourceMappingURL=io.js.map + +/***/ }), + +/***/ 7678: +/***/ ((module, exports) => { + +"use strict"; + +/// +/// +/// +Object.defineProperty(exports, "__esModule", ({ value: true })); +const typedArrayTypeNames = [ + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array', + 'BigInt64Array', + 'BigUint64Array' +]; +function isTypedArrayName(name) { + return typedArrayTypeNames.includes(name); +} +const objectTypeNames = [ + 'Function', + 'Generator', + 'AsyncGenerator', + 'GeneratorFunction', + 'AsyncGeneratorFunction', + 'AsyncFunction', + 'Observable', + 'Array', + 'Buffer', + 'Object', + 'RegExp', + 'Date', + 'Error', + 'Map', + 'Set', + 'WeakMap', + 'WeakSet', + 'ArrayBuffer', + 'SharedArrayBuffer', + 'DataView', + 'Promise', + 'URL', + 'HTMLElement', + ...typedArrayTypeNames +]; +function isObjectTypeName(name) { + return objectTypeNames.includes(name); +} +const primitiveTypeNames = [ + 'null', + 'undefined', + 'string', + 'number', + 'bigint', + 'boolean', + 'symbol' +]; +function isPrimitiveTypeName(name) { + return primitiveTypeNames.includes(name); +} +// eslint-disable-next-line @typescript-eslint/ban-types +function isOfType(type) { + return (value) => typeof value === type; +} +const { toString } = Object.prototype; +const getObjectType = (value) => { + const objectTypeName = toString.call(value).slice(8, -1); + if (/HTML\w+Element/.test(objectTypeName) && is.domElement(value)) { + return 'HTMLElement'; + } + if (isObjectTypeName(objectTypeName)) { + return objectTypeName; + } + return undefined; +}; +const isObjectOfType = (type) => (value) => getObjectType(value) === type; +function is(value) { + if (value === null) { + return 'null'; + } + switch (typeof value) { + case 'undefined': return 'undefined'; - case 'string': + case 'string': return 'string'; - case 'number': + case 'number': return 'number'; - case 'boolean': + case 'boolean': return 'boolean'; - case 'function': + case 'function': return 'Function'; - case 'bigint': + case 'bigint': return 'bigint'; - case 'symbol': + case 'symbol': return 'symbol'; - default: - } - if (is.observable(value)) { - return 'Observable'; - } - if (is.array(value)) { - return 'Array'; - } - if (is.buffer(value)) { - return 'Buffer'; - } - const tagType = getObjectType(value); - if (tagType) { - return tagType; - } - if ( - value instanceof String || - value instanceof Boolean || - value instanceof Number - ) { - throw new TypeError( - "Please don't use object wrappers for primitive types" - ); - } - return 'Object'; - } - is.undefined = isOfType('undefined'); - is.string = isOfType('string'); - const isNumberType = isOfType('number'); - is.number = (value) => isNumberType(value) && !is.nan(value); - is.bigint = isOfType('bigint'); - // eslint-disable-next-line @typescript-eslint/ban-types - is.function_ = isOfType('function'); - is.null_ = (value) => value === null; - is.class_ = (value) => - is.function_(value) && value.toString().startsWith('class '); - is.boolean = (value) => value === true || value === false; - is.symbol = isOfType('symbol'); - is.numericString = (value) => - is.string(value) && - !is.emptyStringOrWhitespace(value) && - !Number.isNaN(Number(value)); - is.array = (value, assertion) => { - if (!Array.isArray(value)) { - return false; - } - if (!is.function_(assertion)) { - return true; - } - return value.every(assertion); - }; - is.buffer = (value) => { - var _a, _b, _c, _d; - return (_d = - (_c = - (_b = - (_a = value) === null || _a === void 0 - ? void 0 - : _a.constructor) === null || _b === void 0 - ? void 0 - : _b.isBuffer) === null || _c === void 0 - ? void 0 - : _c.call(_b, value)) !== null && _d !== void 0 - ? _d - : false; - }; - is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); - is.object = (value) => - !is.null_(value) && (typeof value === 'object' || is.function_(value)); - is.iterable = (value) => { - var _a; - return is.function_( - (_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.iterator] - ); - }; - is.asyncIterable = (value) => { - var _a; - return is.function_( - (_a = value) === null || _a === void 0 - ? void 0 - : _a[Symbol.asyncIterator] - ); - }; - is.generator = (value) => - is.iterable(value) && - is.function_(value.next) && - is.function_(value.throw); - is.asyncGenerator = (value) => - is.asyncIterable(value) && - is.function_(value.next) && - is.function_(value.throw); - is.nativePromise = (value) => isObjectOfType('Promise')(value); - const hasPromiseAPI = (value) => { - var _a, _b; - return ( - is.function_( - (_a = value) === null || _a === void 0 ? void 0 : _a.then - ) && - is.function_( - (_b = value) === null || _b === void 0 ? void 0 : _b.catch - ) - ); - }; - is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value); - is.generatorFunction = isObjectOfType('GeneratorFunction'); - is.asyncGeneratorFunction = (value) => - getObjectType(value) === 'AsyncGeneratorFunction'; - is.asyncFunction = (value) => getObjectType(value) === 'AsyncFunction'; - // eslint-disable-next-line no-prototype-builtins, @typescript-eslint/ban-types - is.boundFunction = (value) => - is.function_(value) && !value.hasOwnProperty('prototype'); - is.regExp = isObjectOfType('RegExp'); - is.date = isObjectOfType('Date'); - is.error = isObjectOfType('Error'); - is.map = (value) => isObjectOfType('Map')(value); - is.set = (value) => isObjectOfType('Set')(value); - is.weakMap = (value) => isObjectOfType('WeakMap')(value); - is.weakSet = (value) => isObjectOfType('WeakSet')(value); - is.int8Array = isObjectOfType('Int8Array'); - is.uint8Array = isObjectOfType('Uint8Array'); - is.uint8ClampedArray = isObjectOfType('Uint8ClampedArray'); - is.int16Array = isObjectOfType('Int16Array'); - is.uint16Array = isObjectOfType('Uint16Array'); - is.int32Array = isObjectOfType('Int32Array'); - is.uint32Array = isObjectOfType('Uint32Array'); - is.float32Array = isObjectOfType('Float32Array'); - is.float64Array = isObjectOfType('Float64Array'); - is.bigInt64Array = isObjectOfType('BigInt64Array'); - is.bigUint64Array = isObjectOfType('BigUint64Array'); - is.arrayBuffer = isObjectOfType('ArrayBuffer'); - is.sharedArrayBuffer = isObjectOfType('SharedArrayBuffer'); - is.dataView = isObjectOfType('DataView'); - is.directInstanceOf = (instance, class_) => - Object.getPrototypeOf(instance) === class_.prototype; - is.urlInstance = (value) => isObjectOfType('URL')(value); - is.urlString = (value) => { - if (!is.string(value)) { - return false; - } - try { - new URL(value); // eslint-disable-line no-new - return true; - } catch (_a) { - return false; - } - }; - // TODO: Use the `not` operator with a type guard here when it's available. - // Example: `is.truthy = (value: unknown): value is (not false | not 0 | not '' | not undefined | not null) => Boolean(value);` - is.truthy = (value) => Boolean(value); - // Example: `is.falsy = (value: unknown): value is (not true | 0 | '' | undefined | null) => Boolean(value);` - is.falsy = (value) => !value; - is.nan = (value) => Number.isNaN(value); - is.primitive = (value) => - is.null_(value) || isPrimitiveTypeName(typeof value); - is.integer = (value) => Number.isInteger(value); - is.safeInteger = (value) => Number.isSafeInteger(value); - is.plainObject = (value) => { - // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js - if (toString.call(value) !== '[object Object]') { - return false; - } - const prototype = Object.getPrototypeOf(value); - return prototype === null || prototype === Object.getPrototypeOf({}); - }; - is.typedArray = (value) => isTypedArrayName(getObjectType(value)); - const isValidLength = (value) => is.safeInteger(value) && value >= 0; - is.arrayLike = (value) => - !is.nullOrUndefined(value) && - !is.function_(value) && - isValidLength(value.length); - is.inRange = (value, range) => { - if (is.number(range)) { - return value >= Math.min(0, range) && value <= Math.max(range, 0); - } - if (is.array(range) && range.length === 2) { - return value >= Math.min(...range) && value <= Math.max(...range); - } - throw new TypeError(`Invalid range: ${JSON.stringify(range)}`); - }; - const NODE_TYPE_ELEMENT = 1; - const DOM_PROPERTIES_TO_CHECK = [ - 'innerHTML', - 'ownerDocument', - 'style', - 'attributes', - 'nodeValue', - ]; - is.domElement = (value) => { - return ( - is.object(value) && - value.nodeType === NODE_TYPE_ELEMENT && - is.string(value.nodeName) && - !is.plainObject(value) && - DOM_PROPERTIES_TO_CHECK.every((property) => property in value) - ); - }; - is.observable = (value) => { - var _a, _b, _c, _d; - if (!value) { - return false; - } - // eslint-disable-next-line no-use-extend-native/no-use-extend-native - if ( - value === - ((_b = (_a = value)[Symbol.observable]) === null || _b === void 0 - ? void 0 - : _b.call(_a)) - ) { - return true; - } - if ( - value === - ((_d = (_c = value)['@@observable']) === null || _d === void 0 - ? void 0 - : _d.call(_c)) - ) { - return true; - } + default: + } + if (is.observable(value)) { + return 'Observable'; + } + if (is.array(value)) { + return 'Array'; + } + if (is.buffer(value)) { + return 'Buffer'; + } + const tagType = getObjectType(value); + if (tagType) { + return tagType; + } + if (value instanceof String || value instanceof Boolean || value instanceof Number) { + throw new TypeError('Please don\'t use object wrappers for primitive types'); + } + return 'Object'; +} +is.undefined = isOfType('undefined'); +is.string = isOfType('string'); +const isNumberType = isOfType('number'); +is.number = (value) => isNumberType(value) && !is.nan(value); +is.bigint = isOfType('bigint'); +// eslint-disable-next-line @typescript-eslint/ban-types +is.function_ = isOfType('function'); +is.null_ = (value) => value === null; +is.class_ = (value) => is.function_(value) && value.toString().startsWith('class '); +is.boolean = (value) => value === true || value === false; +is.symbol = isOfType('symbol'); +is.numericString = (value) => is.string(value) && !is.emptyStringOrWhitespace(value) && !Number.isNaN(Number(value)); +is.array = (value, assertion) => { + if (!Array.isArray(value)) { return false; - }; - is.nodeStream = (value) => - is.object(value) && is.function_(value.pipe) && !is.observable(value); - is.infinite = (value) => value === Infinity || value === -Infinity; - const isAbsoluteMod2 = (remainder) => (value) => - is.integer(value) && Math.abs(value % 2) === remainder; - is.evenInteger = isAbsoluteMod2(0); - is.oddInteger = isAbsoluteMod2(1); - is.emptyArray = (value) => is.array(value) && value.length === 0; - is.nonEmptyArray = (value) => is.array(value) && value.length > 0; - is.emptyString = (value) => is.string(value) && value.length === 0; - // TODO: Use `not ''` when the `not` operator is available. - is.nonEmptyString = (value) => is.string(value) && value.length > 0; - const isWhiteSpaceString = (value) => - is.string(value) && !/\S/.test(value); - is.emptyStringOrWhitespace = (value) => - is.emptyString(value) || isWhiteSpaceString(value); - is.emptyObject = (value) => - is.object(value) && - !is.map(value) && - !is.set(value) && - Object.keys(value).length === 0; - // TODO: Use `not` operator here to remove `Map` and `Set` from type guard: - // - https://github.com/Microsoft/TypeScript/pull/29317 - is.nonEmptyObject = (value) => - is.object(value) && - !is.map(value) && - !is.set(value) && - Object.keys(value).length > 0; - is.emptySet = (value) => is.set(value) && value.size === 0; - is.nonEmptySet = (value) => is.set(value) && value.size > 0; - is.emptyMap = (value) => is.map(value) && value.size === 0; - is.nonEmptyMap = (value) => is.map(value) && value.size > 0; - const predicateOnArray = (method, predicate, values) => { - if (!is.function_(predicate)) { - throw new TypeError( - `Invalid predicate: ${JSON.stringify(predicate)}` - ); - } - if (values.length === 0) { - throw new TypeError('Invalid number of values'); - } - return method.call(values, predicate); - }; - is.any = (predicate, ...values) => { - const predicates = is.array(predicate) ? predicate : [predicate]; - return predicates.some((singlePredicate) => - predicateOnArray(Array.prototype.some, singlePredicate, values) - ); - }; - is.all = (predicate, ...values) => - predicateOnArray(Array.prototype.every, predicate, values); - const assertType = (condition, description, value) => { - if (!condition) { - throw new TypeError( - `Expected value which is \`${description}\`, received value of type \`${is( - value - )}\`.` - ); - } - }; - exports.assert = { - // Unknowns. - undefined: (value) => - assertType(is.undefined(value), 'undefined', value), - string: (value) => assertType(is.string(value), 'string', value), - number: (value) => assertType(is.number(value), 'number', value), - bigint: (value) => assertType(is.bigint(value), 'bigint', value), - // eslint-disable-next-line @typescript-eslint/ban-types - function_: (value) => - assertType(is.function_(value), 'Function', value), - null_: (value) => assertType(is.null_(value), 'null', value), - class_: (value) => - assertType(is.class_(value), 'Class' /* class_ */, value), - boolean: (value) => assertType(is.boolean(value), 'boolean', value), - symbol: (value) => assertType(is.symbol(value), 'symbol', value), - numericString: (value) => - assertType( - is.numericString(value), - 'string with a number' /* numericString */, - value - ), - array: (value, assertion) => { - const assert = assertType; - assert(is.array(value), 'Array', value); - if (assertion) { + } + if (!is.function_(assertion)) { + return true; + } + return value.every(assertion); +}; +is.buffer = (value) => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = value) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.isBuffer) === null || _c === void 0 ? void 0 : _c.call(_b, value)) !== null && _d !== void 0 ? _d : false; }; +is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); +is.object = (value) => !is.null_(value) && (typeof value === 'object' || is.function_(value)); +is.iterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.iterator]); }; +is.asyncIterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.asyncIterator]); }; +is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw); +is.asyncGenerator = (value) => is.asyncIterable(value) && is.function_(value.next) && is.function_(value.throw); +is.nativePromise = (value) => isObjectOfType('Promise')(value); +const hasPromiseAPI = (value) => { + var _a, _b; + return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a.then) && + is.function_((_b = value) === null || _b === void 0 ? void 0 : _b.catch); +}; +is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value); +is.generatorFunction = isObjectOfType('GeneratorFunction'); +is.asyncGeneratorFunction = (value) => getObjectType(value) === 'AsyncGeneratorFunction'; +is.asyncFunction = (value) => getObjectType(value) === 'AsyncFunction'; +// eslint-disable-next-line no-prototype-builtins, @typescript-eslint/ban-types +is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype'); +is.regExp = isObjectOfType('RegExp'); +is.date = isObjectOfType('Date'); +is.error = isObjectOfType('Error'); +is.map = (value) => isObjectOfType('Map')(value); +is.set = (value) => isObjectOfType('Set')(value); +is.weakMap = (value) => isObjectOfType('WeakMap')(value); +is.weakSet = (value) => isObjectOfType('WeakSet')(value); +is.int8Array = isObjectOfType('Int8Array'); +is.uint8Array = isObjectOfType('Uint8Array'); +is.uint8ClampedArray = isObjectOfType('Uint8ClampedArray'); +is.int16Array = isObjectOfType('Int16Array'); +is.uint16Array = isObjectOfType('Uint16Array'); +is.int32Array = isObjectOfType('Int32Array'); +is.uint32Array = isObjectOfType('Uint32Array'); +is.float32Array = isObjectOfType('Float32Array'); +is.float64Array = isObjectOfType('Float64Array'); +is.bigInt64Array = isObjectOfType('BigInt64Array'); +is.bigUint64Array = isObjectOfType('BigUint64Array'); +is.arrayBuffer = isObjectOfType('ArrayBuffer'); +is.sharedArrayBuffer = isObjectOfType('SharedArrayBuffer'); +is.dataView = isObjectOfType('DataView'); +is.directInstanceOf = (instance, class_) => Object.getPrototypeOf(instance) === class_.prototype; +is.urlInstance = (value) => isObjectOfType('URL')(value); +is.urlString = (value) => { + if (!is.string(value)) { + return false; + } + try { + new URL(value); // eslint-disable-line no-new + return true; + } + catch (_a) { + return false; + } +}; +// TODO: Use the `not` operator with a type guard here when it's available. +// Example: `is.truthy = (value: unknown): value is (not false | not 0 | not '' | not undefined | not null) => Boolean(value);` +is.truthy = (value) => Boolean(value); +// Example: `is.falsy = (value: unknown): value is (not true | 0 | '' | undefined | null) => Boolean(value);` +is.falsy = (value) => !value; +is.nan = (value) => Number.isNaN(value); +is.primitive = (value) => is.null_(value) || isPrimitiveTypeName(typeof value); +is.integer = (value) => Number.isInteger(value); +is.safeInteger = (value) => Number.isSafeInteger(value); +is.plainObject = (value) => { + // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js + if (toString.call(value) !== '[object Object]') { + return false; + } + const prototype = Object.getPrototypeOf(value); + return prototype === null || prototype === Object.getPrototypeOf({}); +}; +is.typedArray = (value) => isTypedArrayName(getObjectType(value)); +const isValidLength = (value) => is.safeInteger(value) && value >= 0; +is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length); +is.inRange = (value, range) => { + if (is.number(range)) { + return value >= Math.min(0, range) && value <= Math.max(range, 0); + } + if (is.array(range) && range.length === 2) { + return value >= Math.min(...range) && value <= Math.max(...range); + } + throw new TypeError(`Invalid range: ${JSON.stringify(range)}`); +}; +const NODE_TYPE_ELEMENT = 1; +const DOM_PROPERTIES_TO_CHECK = [ + 'innerHTML', + 'ownerDocument', + 'style', + 'attributes', + 'nodeValue' +]; +is.domElement = (value) => { + return is.object(value) && + value.nodeType === NODE_TYPE_ELEMENT && + is.string(value.nodeName) && + !is.plainObject(value) && + DOM_PROPERTIES_TO_CHECK.every(property => property in value); +}; +is.observable = (value) => { + var _a, _b, _c, _d; + if (!value) { + return false; + } + // eslint-disable-next-line no-use-extend-native/no-use-extend-native + if (value === ((_b = (_a = value)[Symbol.observable]) === null || _b === void 0 ? void 0 : _b.call(_a))) { + return true; + } + if (value === ((_d = (_c = value)['@@observable']) === null || _d === void 0 ? void 0 : _d.call(_c))) { + return true; + } + return false; +}; +is.nodeStream = (value) => is.object(value) && is.function_(value.pipe) && !is.observable(value); +is.infinite = (value) => value === Infinity || value === -Infinity; +const isAbsoluteMod2 = (remainder) => (value) => is.integer(value) && Math.abs(value % 2) === remainder; +is.evenInteger = isAbsoluteMod2(0); +is.oddInteger = isAbsoluteMod2(1); +is.emptyArray = (value) => is.array(value) && value.length === 0; +is.nonEmptyArray = (value) => is.array(value) && value.length > 0; +is.emptyString = (value) => is.string(value) && value.length === 0; +// TODO: Use `not ''` when the `not` operator is available. +is.nonEmptyString = (value) => is.string(value) && value.length > 0; +const isWhiteSpaceString = (value) => is.string(value) && !/\S/.test(value); +is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value); +is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0; +// TODO: Use `not` operator here to remove `Map` and `Set` from type guard: +// - https://github.com/Microsoft/TypeScript/pull/29317 +is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0; +is.emptySet = (value) => is.set(value) && value.size === 0; +is.nonEmptySet = (value) => is.set(value) && value.size > 0; +is.emptyMap = (value) => is.map(value) && value.size === 0; +is.nonEmptyMap = (value) => is.map(value) && value.size > 0; +const predicateOnArray = (method, predicate, values) => { + if (!is.function_(predicate)) { + throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`); + } + if (values.length === 0) { + throw new TypeError('Invalid number of values'); + } + return method.call(values, predicate); +}; +is.any = (predicate, ...values) => { + const predicates = is.array(predicate) ? predicate : [predicate]; + return predicates.some(singlePredicate => predicateOnArray(Array.prototype.some, singlePredicate, values)); +}; +is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values); +const assertType = (condition, description, value) => { + if (!condition) { + throw new TypeError(`Expected value which is \`${description}\`, received value of type \`${is(value)}\`.`); + } +}; +exports.assert = { + // Unknowns. + undefined: (value) => assertType(is.undefined(value), 'undefined', value), + string: (value) => assertType(is.string(value), 'string', value), + number: (value) => assertType(is.number(value), 'number', value), + bigint: (value) => assertType(is.bigint(value), 'bigint', value), + // eslint-disable-next-line @typescript-eslint/ban-types + function_: (value) => assertType(is.function_(value), 'Function', value), + null_: (value) => assertType(is.null_(value), 'null', value), + class_: (value) => assertType(is.class_(value), "Class" /* class_ */, value), + boolean: (value) => assertType(is.boolean(value), 'boolean', value), + symbol: (value) => assertType(is.symbol(value), 'symbol', value), + numericString: (value) => assertType(is.numericString(value), "string with a number" /* numericString */, value), + array: (value, assertion) => { + const assert = assertType; + assert(is.array(value), 'Array', value); + if (assertion) { value.forEach(assertion); - } - }, - buffer: (value) => assertType(is.buffer(value), 'Buffer', value), - nullOrUndefined: (value) => - assertType( - is.nullOrUndefined(value), - 'null or undefined' /* nullOrUndefined */, - value - ), - object: (value) => assertType(is.object(value), 'Object', value), - iterable: (value) => - assertType(is.iterable(value), 'Iterable' /* iterable */, value), - asyncIterable: (value) => - assertType( - is.asyncIterable(value), - 'AsyncIterable' /* asyncIterable */, - value - ), - generator: (value) => - assertType(is.generator(value), 'Generator', value), - asyncGenerator: (value) => - assertType(is.asyncGenerator(value), 'AsyncGenerator', value), - nativePromise: (value) => - assertType( - is.nativePromise(value), - 'native Promise' /* nativePromise */, - value - ), - promise: (value) => assertType(is.promise(value), 'Promise', value), - generatorFunction: (value) => - assertType(is.generatorFunction(value), 'GeneratorFunction', value), - asyncGeneratorFunction: (value) => - assertType( - is.asyncGeneratorFunction(value), - 'AsyncGeneratorFunction', - value - ), - // eslint-disable-next-line @typescript-eslint/ban-types - asyncFunction: (value) => - assertType(is.asyncFunction(value), 'AsyncFunction', value), - // eslint-disable-next-line @typescript-eslint/ban-types - boundFunction: (value) => - assertType(is.boundFunction(value), 'Function', value), - regExp: (value) => assertType(is.regExp(value), 'RegExp', value), - date: (value) => assertType(is.date(value), 'Date', value), - error: (value) => assertType(is.error(value), 'Error', value), - map: (value) => assertType(is.map(value), 'Map', value), - set: (value) => assertType(is.set(value), 'Set', value), - weakMap: (value) => assertType(is.weakMap(value), 'WeakMap', value), - weakSet: (value) => assertType(is.weakSet(value), 'WeakSet', value), - int8Array: (value) => - assertType(is.int8Array(value), 'Int8Array', value), - uint8Array: (value) => - assertType(is.uint8Array(value), 'Uint8Array', value), - uint8ClampedArray: (value) => - assertType(is.uint8ClampedArray(value), 'Uint8ClampedArray', value), - int16Array: (value) => - assertType(is.int16Array(value), 'Int16Array', value), - uint16Array: (value) => - assertType(is.uint16Array(value), 'Uint16Array', value), - int32Array: (value) => - assertType(is.int32Array(value), 'Int32Array', value), - uint32Array: (value) => - assertType(is.uint32Array(value), 'Uint32Array', value), - float32Array: (value) => - assertType(is.float32Array(value), 'Float32Array', value), - float64Array: (value) => - assertType(is.float64Array(value), 'Float64Array', value), - bigInt64Array: (value) => - assertType(is.bigInt64Array(value), 'BigInt64Array', value), - bigUint64Array: (value) => - assertType(is.bigUint64Array(value), 'BigUint64Array', value), - arrayBuffer: (value) => - assertType(is.arrayBuffer(value), 'ArrayBuffer', value), - sharedArrayBuffer: (value) => - assertType(is.sharedArrayBuffer(value), 'SharedArrayBuffer', value), - dataView: (value) => assertType(is.dataView(value), 'DataView', value), - urlInstance: (value) => assertType(is.urlInstance(value), 'URL', value), - urlString: (value) => - assertType( - is.urlString(value), - 'string with a URL' /* urlString */, - value - ), - truthy: (value) => - assertType(is.truthy(value), 'truthy' /* truthy */, value), - falsy: (value) => - assertType(is.falsy(value), 'falsy' /* falsy */, value), - nan: (value) => assertType(is.nan(value), 'NaN' /* nan */, value), - primitive: (value) => - assertType(is.primitive(value), 'primitive' /* primitive */, value), - integer: (value) => - assertType(is.integer(value), 'integer' /* integer */, value), - safeInteger: (value) => - assertType(is.safeInteger(value), 'integer' /* safeInteger */, value), - plainObject: (value) => - assertType( - is.plainObject(value), - 'plain object' /* plainObject */, - value - ), - typedArray: (value) => - assertType( - is.typedArray(value), - 'TypedArray' /* typedArray */, - value - ), - arrayLike: (value) => - assertType(is.arrayLike(value), 'array-like' /* arrayLike */, value), - domElement: (value) => - assertType( - is.domElement(value), - 'HTMLElement' /* domElement */, - value - ), - observable: (value) => - assertType(is.observable(value), 'Observable', value), - nodeStream: (value) => - assertType( - is.nodeStream(value), - 'Node.js Stream' /* nodeStream */, - value - ), - infinite: (value) => - assertType( - is.infinite(value), - 'infinite number' /* infinite */, - value - ), - emptyArray: (value) => - assertType( - is.emptyArray(value), - 'empty array' /* emptyArray */, - value - ), - nonEmptyArray: (value) => - assertType( - is.nonEmptyArray(value), - 'non-empty array' /* nonEmptyArray */, - value - ), - emptyString: (value) => - assertType( - is.emptyString(value), - 'empty string' /* emptyString */, - value - ), - nonEmptyString: (value) => - assertType( - is.nonEmptyString(value), - 'non-empty string' /* nonEmptyString */, - value - ), - emptyStringOrWhitespace: (value) => - assertType( - is.emptyStringOrWhitespace(value), - 'empty string or whitespace' /* emptyStringOrWhitespace */, - value - ), - emptyObject: (value) => - assertType( - is.emptyObject(value), - 'empty object' /* emptyObject */, - value - ), - nonEmptyObject: (value) => - assertType( - is.nonEmptyObject(value), - 'non-empty object' /* nonEmptyObject */, - value - ), - emptySet: (value) => - assertType(is.emptySet(value), 'empty set' /* emptySet */, value), - nonEmptySet: (value) => - assertType( - is.nonEmptySet(value), - 'non-empty set' /* nonEmptySet */, - value - ), - emptyMap: (value) => - assertType(is.emptyMap(value), 'empty map' /* emptyMap */, value), - nonEmptyMap: (value) => - assertType( - is.nonEmptyMap(value), - 'non-empty map' /* nonEmptyMap */, - value - ), - // Numbers. - evenInteger: (value) => - assertType( - is.evenInteger(value), - 'even integer' /* evenInteger */, - value - ), - oddInteger: (value) => - assertType( - is.oddInteger(value), - 'odd integer' /* oddInteger */, - value - ), - // Two arguments. - directInstanceOf: (instance, class_) => - assertType( - is.directInstanceOf(instance, class_), - 'T' /* directInstanceOf */, - instance - ), - inRange: (value, range) => - assertType(is.inRange(value, range), 'in range' /* inRange */, value), - // Variadic functions. - any: (predicate, ...values) => - assertType( - is.any(predicate, ...values), - 'predicate returns truthy for any value' /* any */, - values - ), - all: (predicate, ...values) => - assertType( - is.all(predicate, ...values), - 'predicate returns truthy for all values' /* all */, - values - ), - }; - // Some few keywords are reserved, but we'll populate them for Node.js users - // See https://github.com/Microsoft/TypeScript/issues/2536 - Object.defineProperties(is, { - class: { - value: is.class_, - }, - function: { - value: is.function_, - }, - null: { - value: is.null_, - }, - }); - Object.defineProperties(exports.assert, { - class: { - value: exports.assert.class_, - }, - function: { - value: exports.assert.function_, - }, - null: { - value: exports.assert.null_, - }, - }); - exports.default = is; - // For CommonJS default export support - module.exports = is; - module.exports.default = is; - module.exports.assert = exports.assert; - - /***/ + } }, + buffer: (value) => assertType(is.buffer(value), 'Buffer', value), + nullOrUndefined: (value) => assertType(is.nullOrUndefined(value), "null or undefined" /* nullOrUndefined */, value), + object: (value) => assertType(is.object(value), 'Object', value), + iterable: (value) => assertType(is.iterable(value), "Iterable" /* iterable */, value), + asyncIterable: (value) => assertType(is.asyncIterable(value), "AsyncIterable" /* asyncIterable */, value), + generator: (value) => assertType(is.generator(value), 'Generator', value), + asyncGenerator: (value) => assertType(is.asyncGenerator(value), 'AsyncGenerator', value), + nativePromise: (value) => assertType(is.nativePromise(value), "native Promise" /* nativePromise */, value), + promise: (value) => assertType(is.promise(value), 'Promise', value), + generatorFunction: (value) => assertType(is.generatorFunction(value), 'GeneratorFunction', value), + asyncGeneratorFunction: (value) => assertType(is.asyncGeneratorFunction(value), 'AsyncGeneratorFunction', value), + // eslint-disable-next-line @typescript-eslint/ban-types + asyncFunction: (value) => assertType(is.asyncFunction(value), 'AsyncFunction', value), + // eslint-disable-next-line @typescript-eslint/ban-types + boundFunction: (value) => assertType(is.boundFunction(value), 'Function', value), + regExp: (value) => assertType(is.regExp(value), 'RegExp', value), + date: (value) => assertType(is.date(value), 'Date', value), + error: (value) => assertType(is.error(value), 'Error', value), + map: (value) => assertType(is.map(value), 'Map', value), + set: (value) => assertType(is.set(value), 'Set', value), + weakMap: (value) => assertType(is.weakMap(value), 'WeakMap', value), + weakSet: (value) => assertType(is.weakSet(value), 'WeakSet', value), + int8Array: (value) => assertType(is.int8Array(value), 'Int8Array', value), + uint8Array: (value) => assertType(is.uint8Array(value), 'Uint8Array', value), + uint8ClampedArray: (value) => assertType(is.uint8ClampedArray(value), 'Uint8ClampedArray', value), + int16Array: (value) => assertType(is.int16Array(value), 'Int16Array', value), + uint16Array: (value) => assertType(is.uint16Array(value), 'Uint16Array', value), + int32Array: (value) => assertType(is.int32Array(value), 'Int32Array', value), + uint32Array: (value) => assertType(is.uint32Array(value), 'Uint32Array', value), + float32Array: (value) => assertType(is.float32Array(value), 'Float32Array', value), + float64Array: (value) => assertType(is.float64Array(value), 'Float64Array', value), + bigInt64Array: (value) => assertType(is.bigInt64Array(value), 'BigInt64Array', value), + bigUint64Array: (value) => assertType(is.bigUint64Array(value), 'BigUint64Array', value), + arrayBuffer: (value) => assertType(is.arrayBuffer(value), 'ArrayBuffer', value), + sharedArrayBuffer: (value) => assertType(is.sharedArrayBuffer(value), 'SharedArrayBuffer', value), + dataView: (value) => assertType(is.dataView(value), 'DataView', value), + urlInstance: (value) => assertType(is.urlInstance(value), 'URL', value), + urlString: (value) => assertType(is.urlString(value), "string with a URL" /* urlString */, value), + truthy: (value) => assertType(is.truthy(value), "truthy" /* truthy */, value), + falsy: (value) => assertType(is.falsy(value), "falsy" /* falsy */, value), + nan: (value) => assertType(is.nan(value), "NaN" /* nan */, value), + primitive: (value) => assertType(is.primitive(value), "primitive" /* primitive */, value), + integer: (value) => assertType(is.integer(value), "integer" /* integer */, value), + safeInteger: (value) => assertType(is.safeInteger(value), "integer" /* safeInteger */, value), + plainObject: (value) => assertType(is.plainObject(value), "plain object" /* plainObject */, value), + typedArray: (value) => assertType(is.typedArray(value), "TypedArray" /* typedArray */, value), + arrayLike: (value) => assertType(is.arrayLike(value), "array-like" /* arrayLike */, value), + domElement: (value) => assertType(is.domElement(value), "HTMLElement" /* domElement */, value), + observable: (value) => assertType(is.observable(value), 'Observable', value), + nodeStream: (value) => assertType(is.nodeStream(value), "Node.js Stream" /* nodeStream */, value), + infinite: (value) => assertType(is.infinite(value), "infinite number" /* infinite */, value), + emptyArray: (value) => assertType(is.emptyArray(value), "empty array" /* emptyArray */, value), + nonEmptyArray: (value) => assertType(is.nonEmptyArray(value), "non-empty array" /* nonEmptyArray */, value), + emptyString: (value) => assertType(is.emptyString(value), "empty string" /* emptyString */, value), + nonEmptyString: (value) => assertType(is.nonEmptyString(value), "non-empty string" /* nonEmptyString */, value), + emptyStringOrWhitespace: (value) => assertType(is.emptyStringOrWhitespace(value), "empty string or whitespace" /* emptyStringOrWhitespace */, value), + emptyObject: (value) => assertType(is.emptyObject(value), "empty object" /* emptyObject */, value), + nonEmptyObject: (value) => assertType(is.nonEmptyObject(value), "non-empty object" /* nonEmptyObject */, value), + emptySet: (value) => assertType(is.emptySet(value), "empty set" /* emptySet */, value), + nonEmptySet: (value) => assertType(is.nonEmptySet(value), "non-empty set" /* nonEmptySet */, value), + emptyMap: (value) => assertType(is.emptyMap(value), "empty map" /* emptyMap */, value), + nonEmptyMap: (value) => assertType(is.nonEmptyMap(value), "non-empty map" /* nonEmptyMap */, value), + // Numbers. + evenInteger: (value) => assertType(is.evenInteger(value), "even integer" /* evenInteger */, value), + oddInteger: (value) => assertType(is.oddInteger(value), "odd integer" /* oddInteger */, value), + // Two arguments. + directInstanceOf: (instance, class_) => assertType(is.directInstanceOf(instance, class_), "T" /* directInstanceOf */, instance), + inRange: (value, range) => assertType(is.inRange(value, range), "in range" /* inRange */, value), + // Variadic functions. + any: (predicate, ...values) => assertType(is.any(predicate, ...values), "predicate returns truthy for any value" /* any */, values), + all: (predicate, ...values) => assertType(is.all(predicate, ...values), "predicate returns truthy for all values" /* all */, values) +}; +// Some few keywords are reserved, but we'll populate them for Node.js users +// See https://github.com/Microsoft/TypeScript/issues/2536 +Object.defineProperties(is, { + class: { + value: is.class_ + }, + function: { + value: is.function_ + }, + null: { + value: is.null_ + } +}); +Object.defineProperties(exports.assert, { + class: { + value: exports.assert.class_ + }, + function: { + value: exports.assert.function_ + }, + null: { + value: exports.assert.null_ + } +}); +exports.default = is; +// For CommonJS default export support +module.exports = is; +module.exports.default = is; +module.exports.assert = exports.assert; - /***/ 8097: /***/ (module, exports, __nccwpck_require__) => { - 'use strict'; - Object.defineProperty(exports, '__esModule', { value: true }); - const defer_to_connect_1 = __nccwpck_require__(1800); - const nodejsMajorVersion = Number(process.versions.node.split('.')[0]); - const timer = (request) => { - const timings = { - start: Date.now(), - socket: undefined, - lookup: undefined, - connect: undefined, - secureConnect: undefined, - upload: undefined, - response: undefined, - end: undefined, - error: undefined, - abort: undefined, - phases: { +/***/ }), + +/***/ 8097: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const defer_to_connect_1 = __nccwpck_require__(1800); +const nodejsMajorVersion = Number(process.versions.node.split('.')[0]); +const timer = (request) => { + const timings = { + start: Date.now(), + socket: undefined, + lookup: undefined, + connect: undefined, + secureConnect: undefined, + upload: undefined, + response: undefined, + end: undefined, + error: undefined, + abort: undefined, + phases: { wait: undefined, dns: undefined, tcp: undefined, @@ -2469,1113 +1998,1057 @@ module.exports = /******/ (() => { request: undefined, firstByte: undefined, download: undefined, - total: undefined, - }, - }; - request.timings = timings; - const handleError = (origin) => { - const emit = origin.emit.bind(origin); - origin.emit = (event, ...args) => { + total: undefined + } + }; + request.timings = timings; + const handleError = (origin) => { + const emit = origin.emit.bind(origin); + origin.emit = (event, ...args) => { // Catches the `error` event if (event === 'error') { - timings.error = Date.now(); - timings.phases.total = timings.error - timings.start; - origin.emit = emit; + timings.error = Date.now(); + timings.phases.total = timings.error - timings.start; + origin.emit = emit; } // Saves the original behavior return emit(event, ...args); - }; }; - handleError(request); - request.prependOnceListener('abort', () => { - timings.abort = Date.now(); - // Let the `end` response event be responsible for setting the total phase, - // unless the Node.js major version is >= 13. - if (!timings.response || nodejsMajorVersion >= 13) { + }; + handleError(request); + request.prependOnceListener('abort', () => { + timings.abort = Date.now(); + // Let the `end` response event be responsible for setting the total phase, + // unless the Node.js major version is >= 13. + if (!timings.response || nodejsMajorVersion >= 13) { timings.phases.total = Date.now() - timings.start; - } - }); - const onSocket = (socket) => { - timings.socket = Date.now(); - timings.phases.wait = timings.socket - timings.start; - const lookupListener = () => { + } + }); + const onSocket = (socket) => { + timings.socket = Date.now(); + timings.phases.wait = timings.socket - timings.start; + const lookupListener = () => { timings.lookup = Date.now(); timings.phases.dns = timings.lookup - timings.socket; - }; - socket.prependOnceListener('lookup', lookupListener); - defer_to_connect_1.default(socket, { + }; + socket.prependOnceListener('lookup', lookupListener); + defer_to_connect_1.default(socket, { connect: () => { - timings.connect = Date.now(); - if (timings.lookup === undefined) { - socket.removeListener('lookup', lookupListener); - timings.lookup = timings.connect; - timings.phases.dns = timings.lookup - timings.socket; - } - timings.phases.tcp = timings.connect - timings.lookup; - // This callback is called before flushing any data, - // so we don't need to set `timings.phases.request` here. + timings.connect = Date.now(); + if (timings.lookup === undefined) { + socket.removeListener('lookup', lookupListener); + timings.lookup = timings.connect; + timings.phases.dns = timings.lookup - timings.socket; + } + timings.phases.tcp = timings.connect - timings.lookup; + // This callback is called before flushing any data, + // so we don't need to set `timings.phases.request` here. }, secureConnect: () => { - timings.secureConnect = Date.now(); - timings.phases.tls = timings.secureConnect - timings.connect; - }, - }); - }; - if (request.socket) { - onSocket(request.socket); - } else { - request.prependOnceListener('socket', onSocket); - } - const onUpload = () => { - var _a; - timings.upload = Date.now(); - timings.phases.request = - timings.upload - - ((_a = timings.secureConnect), - _a !== null && _a !== void 0 ? _a : timings.connect); - }; - const writableFinished = () => { - if (typeof request.writableFinished === 'boolean') { + timings.secureConnect = Date.now(); + timings.phases.tls = timings.secureConnect - timings.connect; + } + }); + }; + if (request.socket) { + onSocket(request.socket); + } + else { + request.prependOnceListener('socket', onSocket); + } + const onUpload = () => { + var _a; + timings.upload = Date.now(); + timings.phases.request = timings.upload - (_a = timings.secureConnect, (_a !== null && _a !== void 0 ? _a : timings.connect)); + }; + const writableFinished = () => { + if (typeof request.writableFinished === 'boolean') { return request.writableFinished; - } - // Node.js doesn't have `request.writableFinished` property - return ( - request.finished && - request.outputSize === 0 && - (!request.socket || request.socket.writableLength === 0) - ); - }; - if (writableFinished()) { - onUpload(); - } else { - request.prependOnceListener('finish', onUpload); } - request.prependOnceListener('response', (response) => { - timings.response = Date.now(); - timings.phases.firstByte = timings.response - timings.upload; - response.timings = timings; - handleError(response); - response.prependOnceListener('end', () => { + // Node.js doesn't have `request.writableFinished` property + return request.finished && request.outputSize === 0 && (!request.socket || request.socket.writableLength === 0); + }; + if (writableFinished()) { + onUpload(); + } + else { + request.prependOnceListener('finish', onUpload); + } + request.prependOnceListener('response', (response) => { + timings.response = Date.now(); + timings.phases.firstByte = timings.response - timings.upload; + response.timings = timings; + handleError(response); + response.prependOnceListener('end', () => { timings.end = Date.now(); timings.phases.download = timings.end - timings.response; timings.phases.total = timings.end - timings.start; - }); }); - return timings; - }; - exports.default = timer; - // For CommonJS default export support - module.exports = timer; - module.exports.default = timer; - - /***/ - }, - - /***/ 7240: /***/ (module) => { - 'use strict'; - - module.exports = bail; - - function bail(err) { - if (err) { - throw err; - } - } - - /***/ - }, - - /***/ 2286: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const { - V4MAPPED, - ADDRCONFIG, - ALL, - promises: { Resolver: AsyncResolver }, - lookup: dnsLookup, - } = __nccwpck_require__(881); - const { promisify } = __nccwpck_require__(1669); - const os = __nccwpck_require__(2087); - - const kCacheableLookupCreateConnection = Symbol( - 'cacheableLookupCreateConnection' - ); - const kCacheableLookupInstance = Symbol('cacheableLookupInstance'); - const kExpires = Symbol('expires'); - - const supportsALL = typeof ALL === 'number'; - - const verifyAgent = (agent) => { - if (!(agent && typeof agent.createConnection === 'function')) { - throw new Error('Expected an Agent instance as the first argument'); - } - }; - - const map4to6 = (entries) => { - for (const entry of entries) { - if (entry.family === 6) { - continue; - } - - entry.address = `::ffff:${entry.address}`; - entry.family = 6; - } - }; - - const getIfaceInfo = () => { - let has4 = false; - let has6 = false; - - for (const device of Object.values(os.networkInterfaces())) { - for (const iface of device) { - if (iface.internal) { - continue; - } - - if (iface.family === 'IPv6') { - has6 = true; - } else { - has4 = true; - } - - if (has4 && has6) { - return { has4, has6 }; - } - } - } - - return { has4, has6 }; - }; - - const isIterable = (map) => { - return Symbol.iterator in map; - }; - - const ttl = { ttl: true }; - const all = { all: true }; - - class CacheableLookup { - constructor({ - cache = new Map(), - maxTtl = Infinity, - fallbackDuration = 3600, - errorTtl = 0.15, - resolver = new AsyncResolver(), - lookup = dnsLookup, - } = {}) { - this.maxTtl = maxTtl; - this.errorTtl = errorTtl; - - this._cache = cache; - this._resolver = resolver; - this._dnsLookup = promisify(lookup); - - if (this._resolver instanceof AsyncResolver) { - this._resolve4 = this._resolver.resolve4.bind(this._resolver); - this._resolve6 = this._resolver.resolve6.bind(this._resolver); - } else { - this._resolve4 = promisify( - this._resolver.resolve4.bind(this._resolver) - ); - this._resolve6 = promisify( - this._resolver.resolve6.bind(this._resolver) - ); - } - - this._iface = getIfaceInfo(); - - this._pending = {}; - this._nextRemovalTime = false; - this._hostnamesToFallback = new Set(); - - if (fallbackDuration < 1) { - this._fallback = false; - } else { - this._fallback = true; - - const interval = setInterval(() => { - this._hostnamesToFallback.clear(); - }, fallbackDuration * 1000); - - /* istanbul ignore next: There is no `interval.unref()` when running inside an Electron renderer */ - if (interval.unref) { - interval.unref(); - } - } - - this.lookup = this.lookup.bind(this); - this.lookupAsync = this.lookupAsync.bind(this); - } - - set servers(servers) { - this.clear(); - - this._resolver.setServers(servers); - } - - get servers() { - return this._resolver.getServers(); - } - - lookup(hostname, options, callback) { - if (typeof options === 'function') { - callback = options; - options = {}; - } else if (typeof options === 'number') { - options = { - family: options, - }; - } - - if (!callback) { - throw new Error('Callback must be a function.'); - } - - // eslint-disable-next-line promise/prefer-await-to-then - this.lookupAsync(hostname, options).then((result) => { - if (options.all) { - callback(null, result); - } else { - callback( - null, - result.address, - result.family, - result.expires, - result.ttl - ); - } - }, callback); - } - - async lookupAsync(hostname, options = {}) { - if (typeof options === 'number') { - options = { - family: options, - }; - } - - let cached = await this.query(hostname); - - if (options.family === 6) { - const filtered = cached.filter((entry) => entry.family === 6); - - if (options.hints & V4MAPPED) { - if ( - (supportsALL && options.hints & ALL) || - filtered.length === 0 - ) { - map4to6(cached); - } else { - cached = filtered; - } - } else { - cached = filtered; - } - } else if (options.family === 4) { - cached = cached.filter((entry) => entry.family === 4); - } - - if (options.hints & ADDRCONFIG) { - const { _iface } = this; - cached = cached.filter((entry) => - entry.family === 6 ? _iface.has6 : _iface.has4 - ); - } - - if (cached.length === 0) { - const error = new Error(`cacheableLookup ENOTFOUND ${hostname}`); - error.code = 'ENOTFOUND'; - error.hostname = hostname; - - throw error; - } - - if (options.all) { - return cached; - } - - return cached[0]; - } - - async query(hostname) { - let cached = await this._cache.get(hostname); - - if (!cached) { - const pending = this._pending[hostname]; - - if (pending) { - cached = await pending; - } else { - const newPromise = this.queryAndCache(hostname); - this._pending[hostname] = newPromise; - - try { - cached = await newPromise; - } finally { - delete this._pending[hostname]; - } - } - } - - cached = cached.map((entry) => { - return { ...entry }; - }); - - return cached; - } - - async _resolve(hostname) { - const wrap = async (promise) => { - try { - return await promise; - } catch (error) { - if (error.code === 'ENODATA' || error.code === 'ENOTFOUND') { - return []; - } - - throw error; - } - }; - - // ANY is unsafe as it doesn't trigger new queries in the underlying server. - const [A, AAAA] = await Promise.all( - [ - this._resolve4(hostname, ttl), - this._resolve6(hostname, ttl), - ].map((promise) => wrap(promise)) - ); - - let aTtl = 0; - let aaaaTtl = 0; - let cacheTtl = 0; - - const now = Date.now(); - - for (const entry of A) { - entry.family = 4; - entry.expires = now + entry.ttl * 1000; - - aTtl = Math.max(aTtl, entry.ttl); - } - - for (const entry of AAAA) { - entry.family = 6; - entry.expires = now + entry.ttl * 1000; - - aaaaTtl = Math.max(aaaaTtl, entry.ttl); - } - - if (A.length > 0) { - if (AAAA.length > 0) { - cacheTtl = Math.min(aTtl, aaaaTtl); - } else { - cacheTtl = aTtl; - } - } else { - cacheTtl = aaaaTtl; - } - - return { - entries: [...A, ...AAAA], - cacheTtl, - }; - } - - async _lookup(hostname) { - try { - const entries = await this._dnsLookup(hostname, { - all: true, - }); - - return { - entries, - cacheTtl: 0, - }; - } catch (_) { - return { - entries: [], - cacheTtl: 0, - }; - } - } - - async _set(hostname, data, cacheTtl) { - if (this.maxTtl > 0 && cacheTtl > 0) { - cacheTtl = Math.min(cacheTtl, this.maxTtl) * 1000; - data[kExpires] = Date.now() + cacheTtl; - - try { - await this._cache.set(hostname, data, cacheTtl); - } catch (error) { - this.lookupAsync = async () => { - const cacheError = new Error( - 'Cache Error. Please recreate the CacheableLookup instance.' - ); - cacheError.cause = error; - - throw cacheError; - }; - } - - if (isIterable(this._cache)) { - this._tick(cacheTtl); - } - } - } - - async queryAndCache(hostname) { - if (this._hostnamesToFallback.has(hostname)) { - return this._dnsLookup(hostname, all); - } - - let query = await this._resolve(hostname); - - if (query.entries.length === 0 && this._fallback) { - query = await this._lookup(hostname); - - if (query.entries.length !== 0) { - // Use `dns.lookup(...)` for that particular hostname - this._hostnamesToFallback.add(hostname); - } - } - - const cacheTtl = - query.entries.length === 0 ? this.errorTtl : query.cacheTtl; - await this._set(hostname, query.entries, cacheTtl); - - return query.entries; - } - - _tick(ms) { - const nextRemovalTime = this._nextRemovalTime; - - if (!nextRemovalTime || ms < nextRemovalTime) { - clearTimeout(this._removalTimeout); - - this._nextRemovalTime = ms; - - this._removalTimeout = setTimeout(() => { - this._nextRemovalTime = false; - - let nextExpiry = Infinity; - - const now = Date.now(); - - for (const [hostname, entries] of this._cache) { - const expires = entries[kExpires]; - - if (now >= expires) { - this._cache.delete(hostname); - } else if (expires < nextExpiry) { - nextExpiry = expires; - } - } - - if (nextExpiry !== Infinity) { - this._tick(nextExpiry - now); - } - }, ms); - - /* istanbul ignore next: There is no `timeout.unref()` when running inside an Electron renderer */ - if (this._removalTimeout.unref) { - this._removalTimeout.unref(); - } - } - } - - install(agent) { - verifyAgent(agent); - - if (kCacheableLookupCreateConnection in agent) { - throw new Error('CacheableLookup has been already installed'); - } - - agent[kCacheableLookupCreateConnection] = agent.createConnection; - agent[kCacheableLookupInstance] = this; - - agent.createConnection = (options, callback) => { - if (!('lookup' in options)) { - options.lookup = this.lookup; - } - - return agent[kCacheableLookupCreateConnection](options, callback); - }; - } - - uninstall(agent) { - verifyAgent(agent); - - if (agent[kCacheableLookupCreateConnection]) { - if (agent[kCacheableLookupInstance] !== this) { - throw new Error( - 'The agent is not owned by this CacheableLookup instance' - ); - } - - agent.createConnection = agent[kCacheableLookupCreateConnection]; - - delete agent[kCacheableLookupCreateConnection]; - delete agent[kCacheableLookupInstance]; - } - } - - updateInterfaceInfo() { - const { _iface } = this; - - this._iface = getIfaceInfo(); - - if ( - (_iface.has4 && !this._iface.has4) || - (_iface.has6 && !this._iface.has6) - ) { - this._cache.clear(); - } - } - - clear(hostname) { - if (hostname) { - this._cache.delete(hostname); - return; - } - - this._cache.clear(); - } - } - - module.exports = CacheableLookup; - module.exports.default = CacheableLookup; - - /***/ - }, - - /***/ 8116: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const EventEmitter = __nccwpck_require__(8614); - const urlLib = __nccwpck_require__(8835); - const normalizeUrl = __nccwpck_require__(7952); - const getStream = __nccwpck_require__(1766); - const CachePolicy = __nccwpck_require__(1002); - const Response = __nccwpck_require__(9004); - const lowercaseKeys = __nccwpck_require__(9662); - const cloneResponse = __nccwpck_require__(1312); - const Keyv = __nccwpck_require__(1531); - - class CacheableRequest { - constructor(request, cacheAdapter) { - if (typeof request !== 'function') { - throw new TypeError('Parameter `request` must be a function'); - } - - this.cache = new Keyv({ - uri: typeof cacheAdapter === 'string' && cacheAdapter, - store: typeof cacheAdapter !== 'string' && cacheAdapter, - namespace: 'cacheable-request', - }); - - return this.createCacheableRequest(request); - } - - createCacheableRequest(request) { - return (opts, cb) => { - let url; - if (typeof opts === 'string') { - url = normalizeUrlObject(urlLib.parse(opts)); - opts = {}; - } else if (opts instanceof urlLib.URL) { - url = normalizeUrlObject(urlLib.parse(opts.toString())); - opts = {}; - } else { - const [pathname, ...searchParts] = (opts.path || '').split('?'); - const search = - searchParts.length > 0 ? `?${searchParts.join('?')}` : ''; - url = normalizeUrlObject({ ...opts, pathname, search }); - } - - opts = { - headers: {}, - method: 'GET', - cache: true, - strictTtl: false, - automaticFailover: false, - ...opts, - ...urlObjectToRequestOptions(url), - }; - opts.headers = lowercaseKeys(opts.headers); - - const ee = new EventEmitter(); - const normalizedUrlString = normalizeUrl(urlLib.format(url), { - stripWWW: false, - removeTrailingSlash: false, - stripAuthentication: false, - }); - const key = `${opts.method}:${normalizedUrlString}`; - let revalidate = false; - let madeRequest = false; - - const makeRequest = (opts) => { - madeRequest = true; - let requestErrored = false; - let requestErrorCallback; - - const requestErrorPromise = new Promise((resolve) => { - requestErrorCallback = () => { - if (!requestErrored) { - requestErrored = true; - resolve(); - } - }; - }); - - const handler = (response) => { - if (revalidate && !opts.forceRefresh) { - response.status = response.statusCode; - const revalidatedPolicy = CachePolicy.fromObject( - revalidate.cachePolicy - ).revalidatedPolicy(opts, response); - if (!revalidatedPolicy.modified) { - const headers = revalidatedPolicy.policy.responseHeaders(); - response = new Response( - revalidate.statusCode, - headers, - revalidate.body, - revalidate.url - ); - response.cachePolicy = revalidatedPolicy.policy; - response.fromCache = true; - } - } - - if (!response.fromCache) { - response.cachePolicy = new CachePolicy(opts, response, opts); - response.fromCache = false; - } - - let clonedResponse; - if (opts.cache && response.cachePolicy.storable()) { - clonedResponse = cloneResponse(response); - - (async () => { - try { - const bodyPromise = getStream.buffer(response); - - await Promise.race([ - requestErrorPromise, - new Promise((resolve) => response.once('end', resolve)), - ]); - - if (requestErrored) { - return; - } - - const body = await bodyPromise; - - const value = { - cachePolicy: response.cachePolicy.toObject(), - url: response.url, - statusCode: response.fromCache - ? revalidate.statusCode - : response.statusCode, - body, - }; - - let ttl = opts.strictTtl - ? response.cachePolicy.timeToLive() - : undefined; - if (opts.maxTtl) { - ttl = ttl ? Math.min(ttl, opts.maxTtl) : opts.maxTtl; - } - - await this.cache.set(key, value, ttl); - } catch (error) { - ee.emit('error', new CacheableRequest.CacheError(error)); - } - })(); - } else if (opts.cache && revalidate) { - (async () => { - try { - await this.cache.delete(key); - } catch (error) { - ee.emit('error', new CacheableRequest.CacheError(error)); - } - })(); - } - - ee.emit('response', clonedResponse || response); - if (typeof cb === 'function') { - cb(clonedResponse || response); - } - }; - - try { - const req = request(opts, handler); - req.once('error', requestErrorCallback); - req.once('abort', requestErrorCallback); - ee.emit('request', req); - } catch (error) { - ee.emit('error', new CacheableRequest.RequestError(error)); - } - }; - - (async () => { - const get = async (opts) => { - await Promise.resolve(); - - const cacheEntry = opts.cache - ? await this.cache.get(key) - : undefined; - if (typeof cacheEntry === 'undefined') { - return makeRequest(opts); - } - - const policy = CachePolicy.fromObject(cacheEntry.cachePolicy); - if ( - policy.satisfiesWithoutRevalidation(opts) && - !opts.forceRefresh - ) { - const headers = policy.responseHeaders(); - const response = new Response( - cacheEntry.statusCode, - headers, - cacheEntry.body, - cacheEntry.url - ); - response.cachePolicy = policy; - response.fromCache = true; - - ee.emit('response', response); - if (typeof cb === 'function') { - cb(response); - } - } else { - revalidate = cacheEntry; - opts.headers = policy.revalidationHeaders(opts); - makeRequest(opts); - } - }; - - const errorHandler = (error) => - ee.emit('error', new CacheableRequest.CacheError(error)); - this.cache.once('error', errorHandler); - ee.on('response', () => - this.cache.removeListener('error', errorHandler) - ); - - try { - await get(opts); - } catch (error) { - if (opts.automaticFailover && !madeRequest) { - makeRequest(opts); - } - - ee.emit('error', new CacheableRequest.CacheError(error)); - } - })(); - - return ee; - }; - } - } - - function urlObjectToRequestOptions(url) { - const options = { ...url }; - options.path = `${url.pathname || '/'}${url.search || ''}`; - delete options.pathname; - delete options.search; - return options; - } - - function normalizeUrlObject(url) { - // If url was parsed by url.parse or new URL: - // - hostname will be set - // - host will be hostname[:port] - // - port will be set if it was explicit in the parsed string - // Otherwise, url was from request options: - // - hostname or host may be set - // - host shall not have port encoded - return { - protocol: url.protocol, - auth: url.auth, - hostname: url.hostname || url.host || 'localhost', - port: url.port, - pathname: url.pathname, - search: url.search, - }; - } - - CacheableRequest.RequestError = class extends Error { - constructor(error) { - super(error.message); - this.name = 'RequestError'; - Object.assign(this, error); - } - }; - - CacheableRequest.CacheError = class extends Error { - constructor(error) { - super(error.message); - this.name = 'CacheError'; - Object.assign(this, error); - } - }; - - module.exports = CacheableRequest; - - /***/ - }, - - /***/ 1312: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const PassThrough = __nccwpck_require__(2413).PassThrough; - const mimicResponse = __nccwpck_require__(2610); - - const cloneResponse = (response) => { - if (!(response && response.pipe)) { - throw new TypeError( - 'Parameter `response` must be a response stream.' - ); - } - - const clone = new PassThrough(); - mimicResponse(response, clone); - - return response.pipe(clone); - }; - - module.exports = cloneResponse; - - /***/ - }, - - /***/ 2391: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const { Transform, PassThrough } = __nccwpck_require__(2413); - const zlib = __nccwpck_require__(8761); - const mimicResponse = __nccwpck_require__(3877); - - module.exports = (response) => { - const contentEncoding = ( - response.headers['content-encoding'] || '' - ).toLowerCase(); - - if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) { - return response; - } - - // TODO: Remove this when targeting Node.js 12. - const isBrotli = contentEncoding === 'br'; - if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') { - response.destroy( - new Error('Brotli is not supported on Node.js < 12') - ); - return response; - } - - let isEmpty = true; - - const checker = new Transform({ - transform(data, _encoding, callback) { - isEmpty = false; - - callback(null, data); - }, - - flush(callback) { - callback(); - }, - }); - - const finalStream = new PassThrough({ - autoDestroy: false, - destroy(error, callback) { - response.destroy(); - - callback(error); - }, - }); - - const decompressStream = isBrotli - ? zlib.createBrotliDecompress() - : zlib.createUnzip(); - - decompressStream.once('error', (error) => { - if (isEmpty && !response.readable) { - finalStream.end(); - return; - } - - finalStream.destroy(error); - }); - - mimicResponse(response, finalStream); - response.pipe(checker).pipe(decompressStream).pipe(finalStream); - - return finalStream; - }; - - /***/ - }, - - /***/ 3877: /***/ (module) => { - 'use strict'; - - // We define these manually to ensure they're always copied - // even if they would move up the prototype chain - // https://nodejs.org/api/http.html#http_class_http_incomingmessage - const knownProperties = [ - 'aborted', - 'complete', - 'headers', - 'httpVersion', - 'httpVersionMinor', - 'httpVersionMajor', - 'method', - 'rawHeaders', - 'rawTrailers', - 'setTimeout', - 'socket', - 'statusCode', - 'statusMessage', - 'trailers', - 'url', - ]; - - module.exports = (fromStream, toStream) => { - if (toStream._readableState.autoDestroy) { - throw new Error( - 'The second stream must have the `autoDestroy` option set to `false`' - ); - } - - const fromProperties = new Set( - Object.keys(fromStream).concat(knownProperties) - ); - - const properties = {}; - - for (const property of fromProperties) { - // Don't overwrite existing properties. - if (property in toStream) { - continue; - } - - properties[property] = { - get() { - const value = fromStream[property]; - const isFunction = typeof value === 'function'; - - return isFunction ? value.bind(fromStream) : value; - }, - set(value) { - fromStream[property] = value; - }, - enumerable: true, - configurable: false, - }; - } - - Object.defineProperties(toStream, properties); - - fromStream.once('aborted', () => { - toStream.destroy(); - - toStream.emit('aborted'); - }); - - fromStream.once('close', () => { - if (fromStream.complete) { - if (toStream.readable) { - toStream.once('end', () => { - toStream.emit('close'); - }); - } else { - toStream.emit('close'); - } - } else { - toStream.emit('close'); - } - }); - - return toStream; - }; - - /***/ - }, - - /***/ 1800: /***/ (module, exports, __nccwpck_require__) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - const tls_1 = __nccwpck_require__(4016); - const deferToConnect = (socket, fn) => { - let listeners; - if (typeof fn === 'function') { - const connect = fn; - listeners = { connect }; - } else { - listeners = fn; - } - const hasConnectListener = typeof listeners.connect === 'function'; - const hasSecureConnectListener = - typeof listeners.secureConnect === 'function'; - const hasCloseListener = typeof listeners.close === 'function'; - const onConnect = () => { - if (hasConnectListener) { + }); + return timings; +}; +exports.default = timer; +// For CommonJS default export support +module.exports = timer; +module.exports.default = timer; + + +/***/ }), + +/***/ 7240: +/***/ ((module) => { + +"use strict"; + + +module.exports = bail + +function bail(err) { + if (err) { + throw err + } +} + + +/***/ }), + +/***/ 2286: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const { + V4MAPPED, + ADDRCONFIG, + ALL, + promises: { + Resolver: AsyncResolver + }, + lookup: dnsLookup +} = __nccwpck_require__(881); +const {promisify} = __nccwpck_require__(1669); +const os = __nccwpck_require__(2087); + +const kCacheableLookupCreateConnection = Symbol('cacheableLookupCreateConnection'); +const kCacheableLookupInstance = Symbol('cacheableLookupInstance'); +const kExpires = Symbol('expires'); + +const supportsALL = typeof ALL === 'number'; + +const verifyAgent = agent => { + if (!(agent && typeof agent.createConnection === 'function')) { + throw new Error('Expected an Agent instance as the first argument'); + } +}; + +const map4to6 = entries => { + for (const entry of entries) { + if (entry.family === 6) { + continue; + } + + entry.address = `::ffff:${entry.address}`; + entry.family = 6; + } +}; + +const getIfaceInfo = () => { + let has4 = false; + let has6 = false; + + for (const device of Object.values(os.networkInterfaces())) { + for (const iface of device) { + if (iface.internal) { + continue; + } + + if (iface.family === 'IPv6') { + has6 = true; + } else { + has4 = true; + } + + if (has4 && has6) { + return {has4, has6}; + } + } + } + + return {has4, has6}; +}; + +const isIterable = map => { + return Symbol.iterator in map; +}; + +const ttl = {ttl: true}; +const all = {all: true}; + +class CacheableLookup { + constructor({ + cache = new Map(), + maxTtl = Infinity, + fallbackDuration = 3600, + errorTtl = 0.15, + resolver = new AsyncResolver(), + lookup = dnsLookup + } = {}) { + this.maxTtl = maxTtl; + this.errorTtl = errorTtl; + + this._cache = cache; + this._resolver = resolver; + this._dnsLookup = promisify(lookup); + + if (this._resolver instanceof AsyncResolver) { + this._resolve4 = this._resolver.resolve4.bind(this._resolver); + this._resolve6 = this._resolver.resolve6.bind(this._resolver); + } else { + this._resolve4 = promisify(this._resolver.resolve4.bind(this._resolver)); + this._resolve6 = promisify(this._resolver.resolve6.bind(this._resolver)); + } + + this._iface = getIfaceInfo(); + + this._pending = {}; + this._nextRemovalTime = false; + this._hostnamesToFallback = new Set(); + + if (fallbackDuration < 1) { + this._fallback = false; + } else { + this._fallback = true; + + const interval = setInterval(() => { + this._hostnamesToFallback.clear(); + }, fallbackDuration * 1000); + + /* istanbul ignore next: There is no `interval.unref()` when running inside an Electron renderer */ + if (interval.unref) { + interval.unref(); + } + } + + this.lookup = this.lookup.bind(this); + this.lookupAsync = this.lookupAsync.bind(this); + } + + set servers(servers) { + this.clear(); + + this._resolver.setServers(servers); + } + + get servers() { + return this._resolver.getServers(); + } + + lookup(hostname, options, callback) { + if (typeof options === 'function') { + callback = options; + options = {}; + } else if (typeof options === 'number') { + options = { + family: options + }; + } + + if (!callback) { + throw new Error('Callback must be a function.'); + } + + // eslint-disable-next-line promise/prefer-await-to-then + this.lookupAsync(hostname, options).then(result => { + if (options.all) { + callback(null, result); + } else { + callback(null, result.address, result.family, result.expires, result.ttl); + } + }, callback); + } + + async lookupAsync(hostname, options = {}) { + if (typeof options === 'number') { + options = { + family: options + }; + } + + let cached = await this.query(hostname); + + if (options.family === 6) { + const filtered = cached.filter(entry => entry.family === 6); + + if (options.hints & V4MAPPED) { + if ((supportsALL && options.hints & ALL) || filtered.length === 0) { + map4to6(cached); + } else { + cached = filtered; + } + } else { + cached = filtered; + } + } else if (options.family === 4) { + cached = cached.filter(entry => entry.family === 4); + } + + if (options.hints & ADDRCONFIG) { + const {_iface} = this; + cached = cached.filter(entry => entry.family === 6 ? _iface.has6 : _iface.has4); + } + + if (cached.length === 0) { + const error = new Error(`cacheableLookup ENOTFOUND ${hostname}`); + error.code = 'ENOTFOUND'; + error.hostname = hostname; + + throw error; + } + + if (options.all) { + return cached; + } + + return cached[0]; + } + + async query(hostname) { + let cached = await this._cache.get(hostname); + + if (!cached) { + const pending = this._pending[hostname]; + + if (pending) { + cached = await pending; + } else { + const newPromise = this.queryAndCache(hostname); + this._pending[hostname] = newPromise; + + try { + cached = await newPromise; + } finally { + delete this._pending[hostname]; + } + } + } + + cached = cached.map(entry => { + return {...entry}; + }); + + return cached; + } + + async _resolve(hostname) { + const wrap = async promise => { + try { + return await promise; + } catch (error) { + if (error.code === 'ENODATA' || error.code === 'ENOTFOUND') { + return []; + } + + throw error; + } + }; + + // ANY is unsafe as it doesn't trigger new queries in the underlying server. + const [A, AAAA] = await Promise.all([ + this._resolve4(hostname, ttl), + this._resolve6(hostname, ttl) + ].map(promise => wrap(promise))); + + let aTtl = 0; + let aaaaTtl = 0; + let cacheTtl = 0; + + const now = Date.now(); + + for (const entry of A) { + entry.family = 4; + entry.expires = now + (entry.ttl * 1000); + + aTtl = Math.max(aTtl, entry.ttl); + } + + for (const entry of AAAA) { + entry.family = 6; + entry.expires = now + (entry.ttl * 1000); + + aaaaTtl = Math.max(aaaaTtl, entry.ttl); + } + + if (A.length > 0) { + if (AAAA.length > 0) { + cacheTtl = Math.min(aTtl, aaaaTtl); + } else { + cacheTtl = aTtl; + } + } else { + cacheTtl = aaaaTtl; + } + + return { + entries: [ + ...A, + ...AAAA + ], + cacheTtl + }; + } + + async _lookup(hostname) { + try { + const entries = await this._dnsLookup(hostname, { + all: true + }); + + return { + entries, + cacheTtl: 0 + }; + } catch (_) { + return { + entries: [], + cacheTtl: 0 + }; + } + } + + async _set(hostname, data, cacheTtl) { + if (this.maxTtl > 0 && cacheTtl > 0) { + cacheTtl = Math.min(cacheTtl, this.maxTtl) * 1000; + data[kExpires] = Date.now() + cacheTtl; + + try { + await this._cache.set(hostname, data, cacheTtl); + } catch (error) { + this.lookupAsync = async () => { + const cacheError = new Error('Cache Error. Please recreate the CacheableLookup instance.'); + cacheError.cause = error; + + throw cacheError; + }; + } + + if (isIterable(this._cache)) { + this._tick(cacheTtl); + } + } + } + + async queryAndCache(hostname) { + if (this._hostnamesToFallback.has(hostname)) { + return this._dnsLookup(hostname, all); + } + + let query = await this._resolve(hostname); + + if (query.entries.length === 0 && this._fallback) { + query = await this._lookup(hostname); + + if (query.entries.length !== 0) { + // Use `dns.lookup(...)` for that particular hostname + this._hostnamesToFallback.add(hostname); + } + } + + const cacheTtl = query.entries.length === 0 ? this.errorTtl : query.cacheTtl; + await this._set(hostname, query.entries, cacheTtl); + + return query.entries; + } + + _tick(ms) { + const nextRemovalTime = this._nextRemovalTime; + + if (!nextRemovalTime || ms < nextRemovalTime) { + clearTimeout(this._removalTimeout); + + this._nextRemovalTime = ms; + + this._removalTimeout = setTimeout(() => { + this._nextRemovalTime = false; + + let nextExpiry = Infinity; + + const now = Date.now(); + + for (const [hostname, entries] of this._cache) { + const expires = entries[kExpires]; + + if (now >= expires) { + this._cache.delete(hostname); + } else if (expires < nextExpiry) { + nextExpiry = expires; + } + } + + if (nextExpiry !== Infinity) { + this._tick(nextExpiry - now); + } + }, ms); + + /* istanbul ignore next: There is no `timeout.unref()` when running inside an Electron renderer */ + if (this._removalTimeout.unref) { + this._removalTimeout.unref(); + } + } + } + + install(agent) { + verifyAgent(agent); + + if (kCacheableLookupCreateConnection in agent) { + throw new Error('CacheableLookup has been already installed'); + } + + agent[kCacheableLookupCreateConnection] = agent.createConnection; + agent[kCacheableLookupInstance] = this; + + agent.createConnection = (options, callback) => { + if (!('lookup' in options)) { + options.lookup = this.lookup; + } + + return agent[kCacheableLookupCreateConnection](options, callback); + }; + } + + uninstall(agent) { + verifyAgent(agent); + + if (agent[kCacheableLookupCreateConnection]) { + if (agent[kCacheableLookupInstance] !== this) { + throw new Error('The agent is not owned by this CacheableLookup instance'); + } + + agent.createConnection = agent[kCacheableLookupCreateConnection]; + + delete agent[kCacheableLookupCreateConnection]; + delete agent[kCacheableLookupInstance]; + } + } + + updateInterfaceInfo() { + const {_iface} = this; + + this._iface = getIfaceInfo(); + + if ((_iface.has4 && !this._iface.has4) || (_iface.has6 && !this._iface.has6)) { + this._cache.clear(); + } + } + + clear(hostname) { + if (hostname) { + this._cache.delete(hostname); + return; + } + + this._cache.clear(); + } +} + +module.exports = CacheableLookup; +module.exports.default = CacheableLookup; + + +/***/ }), + +/***/ 8116: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const EventEmitter = __nccwpck_require__(8614); +const urlLib = __nccwpck_require__(8835); +const normalizeUrl = __nccwpck_require__(7952); +const getStream = __nccwpck_require__(1766); +const CachePolicy = __nccwpck_require__(1002); +const Response = __nccwpck_require__(9004); +const lowercaseKeys = __nccwpck_require__(9662); +const cloneResponse = __nccwpck_require__(1312); +const Keyv = __nccwpck_require__(1531); + +class CacheableRequest { + constructor(request, cacheAdapter) { + if (typeof request !== 'function') { + throw new TypeError('Parameter `request` must be a function'); + } + + this.cache = new Keyv({ + uri: typeof cacheAdapter === 'string' && cacheAdapter, + store: typeof cacheAdapter !== 'string' && cacheAdapter, + namespace: 'cacheable-request' + }); + + return this.createCacheableRequest(request); + } + + createCacheableRequest(request) { + return (opts, cb) => { + let url; + if (typeof opts === 'string') { + url = normalizeUrlObject(urlLib.parse(opts)); + opts = {}; + } else if (opts instanceof urlLib.URL) { + url = normalizeUrlObject(urlLib.parse(opts.toString())); + opts = {}; + } else { + const [pathname, ...searchParts] = (opts.path || '').split('?'); + const search = searchParts.length > 0 ? + `?${searchParts.join('?')}` : + ''; + url = normalizeUrlObject({ ...opts, pathname, search }); + } + + opts = { + headers: {}, + method: 'GET', + cache: true, + strictTtl: false, + automaticFailover: false, + ...opts, + ...urlObjectToRequestOptions(url) + }; + opts.headers = lowercaseKeys(opts.headers); + + const ee = new EventEmitter(); + const normalizedUrlString = normalizeUrl( + urlLib.format(url), + { + stripWWW: false, + removeTrailingSlash: false, + stripAuthentication: false + } + ); + const key = `${opts.method}:${normalizedUrlString}`; + let revalidate = false; + let madeRequest = false; + + const makeRequest = opts => { + madeRequest = true; + let requestErrored = false; + let requestErrorCallback; + + const requestErrorPromise = new Promise(resolve => { + requestErrorCallback = () => { + if (!requestErrored) { + requestErrored = true; + resolve(); + } + }; + }); + + const handler = response => { + if (revalidate && !opts.forceRefresh) { + response.status = response.statusCode; + const revalidatedPolicy = CachePolicy.fromObject(revalidate.cachePolicy).revalidatedPolicy(opts, response); + if (!revalidatedPolicy.modified) { + const headers = revalidatedPolicy.policy.responseHeaders(); + response = new Response(revalidate.statusCode, headers, revalidate.body, revalidate.url); + response.cachePolicy = revalidatedPolicy.policy; + response.fromCache = true; + } + } + + if (!response.fromCache) { + response.cachePolicy = new CachePolicy(opts, response, opts); + response.fromCache = false; + } + + let clonedResponse; + if (opts.cache && response.cachePolicy.storable()) { + clonedResponse = cloneResponse(response); + + (async () => { + try { + const bodyPromise = getStream.buffer(response); + + await Promise.race([ + requestErrorPromise, + new Promise(resolve => response.once('end', resolve)) + ]); + + if (requestErrored) { + return; + } + + const body = await bodyPromise; + + const value = { + cachePolicy: response.cachePolicy.toObject(), + url: response.url, + statusCode: response.fromCache ? revalidate.statusCode : response.statusCode, + body + }; + + let ttl = opts.strictTtl ? response.cachePolicy.timeToLive() : undefined; + if (opts.maxTtl) { + ttl = ttl ? Math.min(ttl, opts.maxTtl) : opts.maxTtl; + } + + await this.cache.set(key, value, ttl); + } catch (error) { + ee.emit('error', new CacheableRequest.CacheError(error)); + } + })(); + } else if (opts.cache && revalidate) { + (async () => { + try { + await this.cache.delete(key); + } catch (error) { + ee.emit('error', new CacheableRequest.CacheError(error)); + } + })(); + } + + ee.emit('response', clonedResponse || response); + if (typeof cb === 'function') { + cb(clonedResponse || response); + } + }; + + try { + const req = request(opts, handler); + req.once('error', requestErrorCallback); + req.once('abort', requestErrorCallback); + ee.emit('request', req); + } catch (error) { + ee.emit('error', new CacheableRequest.RequestError(error)); + } + }; + + (async () => { + const get = async opts => { + await Promise.resolve(); + + const cacheEntry = opts.cache ? await this.cache.get(key) : undefined; + if (typeof cacheEntry === 'undefined') { + return makeRequest(opts); + } + + const policy = CachePolicy.fromObject(cacheEntry.cachePolicy); + if (policy.satisfiesWithoutRevalidation(opts) && !opts.forceRefresh) { + const headers = policy.responseHeaders(); + const response = new Response(cacheEntry.statusCode, headers, cacheEntry.body, cacheEntry.url); + response.cachePolicy = policy; + response.fromCache = true; + + ee.emit('response', response); + if (typeof cb === 'function') { + cb(response); + } + } else { + revalidate = cacheEntry; + opts.headers = policy.revalidationHeaders(opts); + makeRequest(opts); + } + }; + + const errorHandler = error => ee.emit('error', new CacheableRequest.CacheError(error)); + this.cache.once('error', errorHandler); + ee.on('response', () => this.cache.removeListener('error', errorHandler)); + + try { + await get(opts); + } catch (error) { + if (opts.automaticFailover && !madeRequest) { + makeRequest(opts); + } + + ee.emit('error', new CacheableRequest.CacheError(error)); + } + })(); + + return ee; + }; + } +} + +function urlObjectToRequestOptions(url) { + const options = { ...url }; + options.path = `${url.pathname || '/'}${url.search || ''}`; + delete options.pathname; + delete options.search; + return options; +} + +function normalizeUrlObject(url) { + // If url was parsed by url.parse or new URL: + // - hostname will be set + // - host will be hostname[:port] + // - port will be set if it was explicit in the parsed string + // Otherwise, url was from request options: + // - hostname or host may be set + // - host shall not have port encoded + return { + protocol: url.protocol, + auth: url.auth, + hostname: url.hostname || url.host || 'localhost', + port: url.port, + pathname: url.pathname, + search: url.search + }; +} + +CacheableRequest.RequestError = class extends Error { + constructor(error) { + super(error.message); + this.name = 'RequestError'; + Object.assign(this, error); + } +}; + +CacheableRequest.CacheError = class extends Error { + constructor(error) { + super(error.message); + this.name = 'CacheError'; + Object.assign(this, error); + } +}; + +module.exports = CacheableRequest; + + +/***/ }), + +/***/ 1312: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const PassThrough = __nccwpck_require__(2413).PassThrough; +const mimicResponse = __nccwpck_require__(2610); + +const cloneResponse = response => { + if (!(response && response.pipe)) { + throw new TypeError('Parameter `response` must be a response stream.'); + } + + const clone = new PassThrough(); + mimicResponse(response, clone); + + return response.pipe(clone); +}; + +module.exports = cloneResponse; + + +/***/ }), + +/***/ 2391: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const {Transform, PassThrough} = __nccwpck_require__(2413); +const zlib = __nccwpck_require__(8761); +const mimicResponse = __nccwpck_require__(3877); + +module.exports = response => { + const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase(); + + if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) { + return response; + } + + // TODO: Remove this when targeting Node.js 12. + const isBrotli = contentEncoding === 'br'; + if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') { + response.destroy(new Error('Brotli is not supported on Node.js < 12')); + return response; + } + + let isEmpty = true; + + const checker = new Transform({ + transform(data, _encoding, callback) { + isEmpty = false; + + callback(null, data); + }, + + flush(callback) { + callback(); + } + }); + + const finalStream = new PassThrough({ + autoDestroy: false, + destroy(error, callback) { + response.destroy(); + + callback(error); + } + }); + + const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip(); + + decompressStream.once('error', error => { + if (isEmpty && !response.readable) { + finalStream.end(); + return; + } + + finalStream.destroy(error); + }); + + mimicResponse(response, finalStream); + response.pipe(checker).pipe(decompressStream).pipe(finalStream); + + return finalStream; +}; + + +/***/ }), + +/***/ 3877: +/***/ ((module) => { + +"use strict"; + + +// We define these manually to ensure they're always copied +// even if they would move up the prototype chain +// https://nodejs.org/api/http.html#http_class_http_incomingmessage +const knownProperties = [ + 'aborted', + 'complete', + 'headers', + 'httpVersion', + 'httpVersionMinor', + 'httpVersionMajor', + 'method', + 'rawHeaders', + 'rawTrailers', + 'setTimeout', + 'socket', + 'statusCode', + 'statusMessage', + 'trailers', + 'url' +]; + +module.exports = (fromStream, toStream) => { + if (toStream._readableState.autoDestroy) { + throw new Error('The second stream must have the `autoDestroy` option set to `false`'); + } + + const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties)); + + const properties = {}; + + for (const property of fromProperties) { + // Don't overwrite existing properties. + if (property in toStream) { + continue; + } + + properties[property] = { + get() { + const value = fromStream[property]; + const isFunction = typeof value === 'function'; + + return isFunction ? value.bind(fromStream) : value; + }, + set(value) { + fromStream[property] = value; + }, + enumerable: true, + configurable: false + }; + } + + Object.defineProperties(toStream, properties); + + fromStream.once('aborted', () => { + toStream.destroy(); + + toStream.emit('aborted'); + }); + + fromStream.once('close', () => { + if (fromStream.complete) { + if (toStream.readable) { + toStream.once('end', () => { + toStream.emit('close'); + }); + } else { + toStream.emit('close'); + } + } else { + toStream.emit('close'); + } + }); + + return toStream; +}; + + +/***/ }), + +/***/ 1800: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tls_1 = __nccwpck_require__(4016); +const deferToConnect = (socket, fn) => { + let listeners; + if (typeof fn === 'function') { + const connect = fn; + listeners = { connect }; + } + else { + listeners = fn; + } + const hasConnectListener = typeof listeners.connect === 'function'; + const hasSecureConnectListener = typeof listeners.secureConnect === 'function'; + const hasCloseListener = typeof listeners.close === 'function'; + const onConnect = () => { + if (hasConnectListener) { listeners.connect(); - } - if (socket instanceof tls_1.TLSSocket && hasSecureConnectListener) { - if (socket.authorized) { - listeners.secureConnect(); - } else if (!socket.authorizationError) { - socket.once('secureConnect', listeners.secureConnect); - } - } - if (hasCloseListener) { - socket.once('close', listeners.close); - } - }; - if (socket.writable && !socket.connecting) { - onConnect(); - } else if (socket.connecting) { - socket.once('connect', onConnect); - } else if (socket.destroyed && hasCloseListener) { - listeners.close(socket._hadError); } - }; - exports.default = deferToConnect; - // For CommonJS default export support - module.exports = deferToConnect; - module.exports.default = deferToConnect; + if (socket instanceof tls_1.TLSSocket && hasSecureConnectListener) { + if (socket.authorized) { + listeners.secureConnect(); + } + else if (!socket.authorizationError) { + socket.once('secureConnect', listeners.secureConnect); + } + } + if (hasCloseListener) { + socket.once('close', listeners.close); + } + }; + if (socket.writable && !socket.connecting) { + onConnect(); + } + else if (socket.connecting) { + socket.once('connect', onConnect); + } + else if (socket.destroyed && hasCloseListener) { + listeners.close(socket._hadError); + } +}; +exports.default = deferToConnect; +// For CommonJS default export support +module.exports = deferToConnect; +module.exports.default = deferToConnect; - /***/ - }, - /***/ 2437: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - /* @flow */ - /*:: +/***/ }), + +/***/ 2437: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/* @flow */ +/*:: type DotenvParseOptions = { debug?: boolean @@ -3597,1899 +3070,1736 @@ type DotenvConfigOutput = { */ - const fs = __nccwpck_require__(5747); - const path = __nccwpck_require__(5622); +const fs = __nccwpck_require__(5747) +const path = __nccwpck_require__(5622) - function log(message /*: string */) { - console.log(`[dotenv][DEBUG] ${message}`); - } +function log (message /*: string */) { + console.log(`[dotenv][DEBUG] ${message}`) +} - const NEWLINE = '\n'; - const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/; - const RE_NEWLINES = /\\n/g; - const NEWLINES_MATCH = /\n|\r|\r\n/; +const NEWLINE = '\n' +const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/ +const RE_NEWLINES = /\\n/g +const NEWLINES_MATCH = /\n|\r|\r\n/ - // Parses src into an Object - function parse( - src /*: string | Buffer */, - options /*: ?DotenvParseOptions */ - ) /*: DotenvParseOutput */ { - const debug = Boolean(options && options.debug); - const obj = {}; +// Parses src into an Object +function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ { + const debug = Boolean(options && options.debug) + const obj = {} - // convert Buffers before splitting into lines and processing - src - .toString() - .split(NEWLINES_MATCH) - .forEach(function (line, idx) { - // matching "KEY' and 'VAL' in 'KEY=VAL' - const keyValueArr = line.match(RE_INI_KEY_VAL); - // matched? - if (keyValueArr != null) { - const key = keyValueArr[1]; - // default undefined or missing values to empty string - let val = keyValueArr[2] || ''; - const end = val.length - 1; - const isDoubleQuoted = val[0] === '"' && val[end] === '"'; - const isSingleQuoted = val[0] === "'" && val[end] === "'"; + // convert Buffers before splitting into lines and processing + src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) { + // matching "KEY' and 'VAL' in 'KEY=VAL' + const keyValueArr = line.match(RE_INI_KEY_VAL) + // matched? + if (keyValueArr != null) { + const key = keyValueArr[1] + // default undefined or missing values to empty string + let val = (keyValueArr[2] || '') + const end = val.length - 1 + const isDoubleQuoted = val[0] === '"' && val[end] === '"' + const isSingleQuoted = val[0] === "'" && val[end] === "'" - // if single or double quoted, remove quotes - if (isSingleQuoted || isDoubleQuoted) { - val = val.substring(1, end); + // if single or double quoted, remove quotes + if (isSingleQuoted || isDoubleQuoted) { + val = val.substring(1, end) - // if double quoted, expand newlines - if (isDoubleQuoted) { - val = val.replace(RE_NEWLINES, NEWLINE); - } - } else { - // remove surrounding whitespace - val = val.trim(); - } - - obj[key] = val; - } else if (debug) { - log( - `did not match key and value when parsing line ${ - idx + 1 - }: ${line}` - ); - } - }); - - return obj; - } - - // Populates process.env from .env file - function config( - options /*: ?DotenvConfigOptions */ - ) /*: DotenvConfigOutput */ { - let dotenvPath = path.resolve(process.cwd(), '.env'); - let encoding /*: string */ = 'utf8'; - let debug = false; - - if (options) { - if (options.path != null) { - dotenvPath = options.path; - } - if (options.encoding != null) { - encoding = options.encoding; - } - if (options.debug != null) { - debug = true; - } + // if double quoted, expand newlines + if (isDoubleQuoted) { + val = val.replace(RE_NEWLINES, NEWLINE) } + } else { + // remove surrounding whitespace + val = val.trim() + } + obj[key] = val + } else if (debug) { + log(`did not match key and value when parsing line ${idx + 1}: ${line}`) + } + }) + + return obj +} + +// Populates process.env from .env file +function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ { + let dotenvPath = path.resolve(process.cwd(), '.env') + let encoding /*: string */ = 'utf8' + let debug = false + + if (options) { + if (options.path != null) { + dotenvPath = options.path + } + if (options.encoding != null) { + encoding = options.encoding + } + if (options.debug != null) { + debug = true + } + } + + try { + // specifying an encoding returns a string instead of a buffer + const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug }) + + Object.keys(parsed).forEach(function (key) { + if (!Object.prototype.hasOwnProperty.call(process.env, key)) { + process.env[key] = parsed[key] + } else if (debug) { + log(`"${key}" is already defined in \`process.env\` and will not be overwritten`) + } + }) + + return { parsed } + } catch (e) { + return { error: e } + } +} + +module.exports.config = config +module.exports.parse = parse + + +/***/ }), + +/***/ 8431: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + + +/** + * @file Embedded JavaScript templating engine. {@link http://ejs.co} + * @author Matthew Eernisse + * @author Tiancheng "Timothy" Gu + * @project EJS + * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} + */ + +/** + * EJS internal functions. + * + * Technically this "module" lies in the same file as {@link module:ejs}, for + * the sake of organization all the private functions re grouped into this + * module. + * + * @module ejs-internal + * @private + */ + +/** + * Embedded JavaScript templating engine. + * + * @module ejs + * @public + */ + +var fs = __nccwpck_require__(5747); +var path = __nccwpck_require__(5622); +var utils = __nccwpck_require__(356); + +var scopeOptionWarned = false; +/** @type {string} */ +var _VERSION_STRING = __nccwpck_require__(9499)/* .version */ .i8; +var _DEFAULT_OPEN_DELIMITER = '<'; +var _DEFAULT_CLOSE_DELIMITER = '>'; +var _DEFAULT_DELIMITER = '%'; +var _DEFAULT_LOCALS_NAME = 'locals'; +var _NAME = 'ejs'; +var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)'; +var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compileDebug', + 'client', '_with', 'rmWhitespace', 'strict', 'filename', 'async']; +// We don't allow 'cache' option to be passed in the data obj for +// the normal `render` call, but this is where Express 2 & 3 put it +// so we make an exception for `renderFile` +var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache'); +var _BOM = /^\uFEFF/; + +/** + * EJS template function cache. This can be a LRU object from lru-cache NPM + * module. By default, it is {@link module:utils.cache}, a simple in-process + * cache that grows continuously. + * + * @type {Cache} + */ + +exports.cache = utils.cache; + +/** + * Custom file loader. Useful for template preprocessing or restricting access + * to a certain part of the filesystem. + * + * @type {fileLoader} + */ + +exports.fileLoader = fs.readFileSync; + +/** + * Name of the object containing the locals. + * + * This variable is overridden by {@link Options}`.localsName` if it is not + * `undefined`. + * + * @type {String} + * @public + */ + +exports.localsName = _DEFAULT_LOCALS_NAME; + +/** + * Promise implementation -- defaults to the native implementation if available + * This is mostly just for testability + * + * @type {PromiseConstructorLike} + * @public + */ + +exports.promiseImpl = (new Function('return this;'))().Promise; + +/** + * Get the path to the included file from the parent file path and the + * specified path. + * + * @param {String} name specified path + * @param {String} filename parent file path + * @param {Boolean} [isDir=false] whether the parent file path is a directory + * @return {String} + */ +exports.resolveInclude = function(name, filename, isDir) { + var dirname = path.dirname; + var extname = path.extname; + var resolve = path.resolve; + var includePath = resolve(isDir ? filename : dirname(filename), name); + var ext = extname(name); + if (!ext) { + includePath += '.ejs'; + } + return includePath; +}; + +/** + * Try to resolve file path on multiple directories + * + * @param {String} name specified path + * @param {Array} paths list of possible parent directory paths + * @return {String} + */ +function resolvePaths(name, paths) { + var filePath; + if (paths.some(function (v) { + filePath = exports.resolveInclude(name, v, true); + return fs.existsSync(filePath); + })) { + return filePath; + } +} + +/** + * Get the path to the included file by Options + * + * @param {String} path specified path + * @param {Options} options compilation options + * @return {String} + */ +function getIncludePath(path, options) { + var includePath; + var filePath; + var views = options.views; + var match = /^[A-Za-z]+:\\|^\//.exec(path); + + // Abs path + if (match && match.length) { + path = path.replace(/^\/*/, ''); + if (Array.isArray(options.root)) { + includePath = resolvePaths(path, options.root); + } else { + includePath = exports.resolveInclude(path, options.root || '/', true); + } + } + // Relative paths + else { + // Look relative to a passed filename first + if (options.filename) { + filePath = exports.resolveInclude(path, options.filename); + if (fs.existsSync(filePath)) { + includePath = filePath; + } + } + // Then look in any views directories + if (!includePath && Array.isArray(views)) { + includePath = resolvePaths(path, views); + } + if (!includePath && typeof options.includer !== 'function') { + throw new Error('Could not find the include file "' + + options.escapeFunction(path) + '"'); + } + } + return includePath; +} + +/** + * Get the template from a string or a file, either compiled on-the-fly or + * read from cache (if enabled), and cache the template if needed. + * + * If `template` is not set, the file specified in `options.filename` will be + * read. + * + * If `options.cache` is true, this function reads the file from + * `options.filename` so it must be set prior to calling this function. + * + * @memberof module:ejs-internal + * @param {Options} options compilation options + * @param {String} [template] template source + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `options.client`, either type might be returned. + * @static + */ + +function handleCache(options, template) { + var func; + var filename = options.filename; + var hasTemplate = arguments.length > 1; + + if (options.cache) { + if (!filename) { + throw new Error('cache option requires a filename'); + } + func = exports.cache.get(filename); + if (func) { + return func; + } + if (!hasTemplate) { + template = fileLoader(filename).toString().replace(_BOM, ''); + } + } + else if (!hasTemplate) { + // istanbul ignore if: should not happen at all + if (!filename) { + throw new Error('Internal EJS error: no file name or template ' + + 'provided'); + } + template = fileLoader(filename).toString().replace(_BOM, ''); + } + func = exports.compile(template, options); + if (options.cache) { + exports.cache.set(filename, func); + } + return func; +} + +/** + * Try calling handleCache with the given options and data and call the + * callback with the result. If an error occurs, call the callback with + * the error. Used by renderFile(). + * + * @memberof module:ejs-internal + * @param {Options} options compilation options + * @param {Object} data template data + * @param {RenderFileCallback} cb callback + * @static + */ + +function tryHandleCache(options, data, cb) { + var result; + if (!cb) { + if (typeof exports.promiseImpl == 'function') { + return new exports.promiseImpl(function (resolve, reject) { try { - // specifying an encoding returns a string instead of a buffer - const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { - debug, - }); + result = handleCache(options)(data); + resolve(result); + } + catch (err) { + reject(err); + } + }); + } + else { + throw new Error('Please provide a callback function'); + } + } + else { + try { + result = handleCache(options)(data); + } + catch (err) { + return cb(err); + } - Object.keys(parsed).forEach(function (key) { - if (!Object.prototype.hasOwnProperty.call(process.env, key)) { - process.env[key] = parsed[key]; - } else if (debug) { - log( - `"${key}" is already defined in \`process.env\` and will not be overwritten` - ); - } - }); + cb(null, result); + } +} - return { parsed }; - } catch (e) { - return { error: e }; +/** + * fileLoader is independent + * + * @param {String} filePath ejs file path. + * @return {String} The contents of the specified file. + * @static + */ + +function fileLoader(filePath){ + return exports.fileLoader(filePath); +} + +/** + * Get the template function. + * + * If `options.cache` is `true`, then the template is cached. + * + * @memberof module:ejs-internal + * @param {String} path path for the specified file + * @param {Options} options compilation options + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `options.client`, either type might be returned + * @static + */ + +function includeFile(path, options) { + var opts = utils.shallowCopy({}, options); + opts.filename = getIncludePath(path, opts); + if (typeof options.includer === 'function') { + var includerResult = options.includer(path, opts.filename); + if (includerResult) { + if (includerResult.filename) { + opts.filename = includerResult.filename; + } + if (includerResult.template) { + return handleCache(opts, includerResult.template); + } + } + } + return handleCache(opts); +} + +/** + * Re-throw the given `err` in context to the `str` of ejs, `filename`, and + * `lineno`. + * + * @implements {RethrowCallback} + * @memberof module:ejs-internal + * @param {Error} err Error object + * @param {String} str EJS source + * @param {String} flnm file name of the EJS file + * @param {Number} lineno line number of the error + * @param {EscapeCallback} esc + * @static + */ + +function rethrow(err, str, flnm, lineno, esc) { + var lines = str.split('\n'); + var start = Math.max(lineno - 3, 0); + var end = Math.min(lines.length, lineno + 3); + var filename = esc(flnm); + // Error context + var context = lines.slice(start, end).map(function (line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +function stripSemi(str){ + return str.replace(/;(\s*$)/, '$1'); +} + +/** + * Compile the given `str` of ejs into a template function. + * + * @param {String} template EJS template + * + * @param {Options} [opts] compilation options + * + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `opts.client`, either type might be returned. + * Note that the return type of the function also depends on the value of `opts.async`. + * @public + */ + +exports.compile = function compile(template, opts) { + var templ; + + // v1 compat + // 'scope' is 'context' + // FIXME: Remove this in a future version + if (opts && opts.scope) { + if (!scopeOptionWarned){ + console.warn('`scope` option is deprecated and will be removed in EJS 3'); + scopeOptionWarned = true; + } + if (!opts.context) { + opts.context = opts.scope; + } + delete opts.scope; + } + templ = new Template(template, opts); + return templ.compile(); +}; + +/** + * Render the given `template` of ejs. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + * + * @param {String} template EJS template + * @param {Object} [data={}] template data + * @param {Options} [opts={}] compilation and rendering options + * @return {(String|Promise)} + * Return value type depends on `opts.async`. + * @public + */ + +exports.render = function (template, d, o) { + var data = d || {}; + var opts = o || {}; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 2) { + utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA); + } + + return handleCache(opts, template)(data); +}; + +/** + * Render an EJS file at the given `path` and callback `cb(err, str)`. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + * + * @param {String} path path to the EJS file + * @param {Object} [data={}] template data + * @param {Options} [opts={}] compilation and rendering options + * @param {RenderFileCallback} cb callback + * @public + */ + +exports.renderFile = function () { + var args = Array.prototype.slice.call(arguments); + var filename = args.shift(); + var cb; + var opts = {filename: filename}; + var data; + var viewOpts; + + // Do we have a callback? + if (typeof arguments[arguments.length - 1] == 'function') { + cb = args.pop(); + } + // Do we have data/opts? + if (args.length) { + // Should always have data obj + data = args.shift(); + // Normal passed opts (data obj + opts obj) + if (args.length) { + // Use shallowCopy so we don't pollute passed in opts obj with new vals + utils.shallowCopy(opts, args.pop()); + } + // Special casing for Express (settings + opts-in-data) + else { + // Express 3 and 4 + if (data.settings) { + // Pull a few things from known locations + if (data.settings.views) { + opts.views = data.settings.views; + } + if (data.settings['view cache']) { + opts.cache = true; + } + // Undocumented after Express 2, but still usable, esp. for + // items that are unsafe to be passed along with data, like `root` + viewOpts = data.settings['view options']; + if (viewOpts) { + utils.shallowCopy(opts, viewOpts); } } + // Express 2 and lower, values set in app.locals, or people who just + // want to pass options in their data. NOTE: These values will override + // anything previously set in settings or settings['view options'] + utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS); + } + opts.filename = filename; + } + else { + data = {}; + } - module.exports.config = config; - module.exports.parse = parse; + return tryHandleCache(opts, data, cb); +}; - /***/ - }, +/** + * Clear intermediate JavaScript cache. Calls {@link Cache#reset}. + * @public + */ - /***/ 8431: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - /* - * EJS Embedded JavaScript templates - * Copyright 2112 Matthew Eernisse (mde@fleegix.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ +/** + * EJS template class + * @public + */ +exports.Template = Template; - /** - * @file Embedded JavaScript templating engine. {@link http://ejs.co} - * @author Matthew Eernisse - * @author Tiancheng "Timothy" Gu - * @project EJS - * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} - */ +exports.clearCache = function () { + exports.cache.reset(); +}; - /** - * EJS internal functions. - * - * Technically this "module" lies in the same file as {@link module:ejs}, for - * the sake of organization all the private functions re grouped into this - * module. - * - * @module ejs-internal - * @private - */ +function Template(text, opts) { + opts = opts || {}; + var options = {}; + this.templateText = text; + /** @type {string | null} */ + this.mode = null; + this.truncate = false; + this.currentLine = 1; + this.source = ''; + options.client = opts.client || false; + options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML; + options.compileDebug = opts.compileDebug !== false; + options.debug = !!opts.debug; + options.filename = opts.filename; + options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER; + options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER; + options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER; + options.strict = opts.strict || false; + options.context = opts.context; + options.cache = opts.cache || false; + options.rmWhitespace = opts.rmWhitespace; + options.root = opts.root; + options.includer = opts.includer; + options.outputFunctionName = opts.outputFunctionName; + options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME; + options.views = opts.views; + options.async = opts.async; + options.destructuredLocals = opts.destructuredLocals; + options.legacyInclude = typeof opts.legacyInclude != 'undefined' ? !!opts.legacyInclude : true; - /** - * Embedded JavaScript templating engine. - * - * @module ejs - * @public - */ + if (options.strict) { + options._with = false; + } + else { + options._with = typeof opts._with != 'undefined' ? opts._with : true; + } - var fs = __nccwpck_require__(5747); - var path = __nccwpck_require__(5622); - var utils = __nccwpck_require__(356); + this.opts = options; - var scopeOptionWarned = false; - /** @type {string} */ - var _VERSION_STRING = __nccwpck_require__(9499) /* .version */.i8; - var _DEFAULT_OPEN_DELIMITER = '<'; - var _DEFAULT_CLOSE_DELIMITER = '>'; - var _DEFAULT_DELIMITER = '%'; - var _DEFAULT_LOCALS_NAME = 'locals'; - var _NAME = 'ejs'; - var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)'; - var _OPTS_PASSABLE_WITH_DATA = [ - 'delimiter', - 'scope', - 'context', - 'debug', - 'compileDebug', - 'client', - '_with', - 'rmWhitespace', - 'strict', - 'filename', - 'async', - ]; - // We don't allow 'cache' option to be passed in the data obj for - // the normal `render` call, but this is where Express 2 & 3 put it - // so we make an exception for `renderFile` - var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat( - 'cache' - ); - var _BOM = /^\uFEFF/; + this.regex = this.createRegex(); +} - /** - * EJS template function cache. This can be a LRU object from lru-cache NPM - * module. By default, it is {@link module:utils.cache}, a simple in-process - * cache that grows continuously. - * - * @type {Cache} - */ +Template.modes = { + EVAL: 'eval', + ESCAPED: 'escaped', + RAW: 'raw', + COMMENT: 'comment', + LITERAL: 'literal' +}; - exports.cache = utils.cache; +Template.prototype = { + createRegex: function () { + var str = _REGEX_STRING; + var delim = utils.escapeRegExpChars(this.opts.delimiter); + var open = utils.escapeRegExpChars(this.opts.openDelimiter); + var close = utils.escapeRegExpChars(this.opts.closeDelimiter); + str = str.replace(/%/g, delim) + .replace(//g, close); + return new RegExp(str); + }, - /** - * Custom file loader. Useful for template preprocessing or restricting access - * to a certain part of the filesystem. - * - * @type {fileLoader} - */ + compile: function () { + /** @type {string} */ + var src; + /** @type {ClientFunction} */ + var fn; + var opts = this.opts; + var prepended = ''; + var appended = ''; + /** @type {EscapeCallback} */ + var escapeFn = opts.escapeFunction; + /** @type {FunctionConstructor} */ + var ctor; - exports.fileLoader = fs.readFileSync; - - /** - * Name of the object containing the locals. - * - * This variable is overridden by {@link Options}`.localsName` if it is not - * `undefined`. - * - * @type {String} - * @public - */ - - exports.localsName = _DEFAULT_LOCALS_NAME; - - /** - * Promise implementation -- defaults to the native implementation if available - * This is mostly just for testability - * - * @type {PromiseConstructorLike} - * @public - */ - - exports.promiseImpl = new Function('return this;')().Promise; - - /** - * Get the path to the included file from the parent file path and the - * specified path. - * - * @param {String} name specified path - * @param {String} filename parent file path - * @param {Boolean} [isDir=false] whether the parent file path is a directory - * @return {String} - */ - exports.resolveInclude = function (name, filename, isDir) { - var dirname = path.dirname; - var extname = path.extname; - var resolve = path.resolve; - var includePath = resolve(isDir ? filename : dirname(filename), name); - var ext = extname(name); - if (!ext) { - includePath += '.ejs'; - } - return includePath; - }; - - /** - * Try to resolve file path on multiple directories - * - * @param {String} name specified path - * @param {Array} paths list of possible parent directory paths - * @return {String} - */ - function resolvePaths(name, paths) { - var filePath; - if ( - paths.some(function (v) { - filePath = exports.resolveInclude(name, v, true); - return fs.existsSync(filePath); - }) - ) { - return filePath; - } + if (!this.source) { + this.generateSource(); + prepended += + ' var __output = "";\n' + + ' function __append(s) { if (s !== undefined && s !== null) __output += s }\n'; + if (opts.outputFunctionName) { + prepended += ' var ' + opts.outputFunctionName + ' = __append;' + '\n'; } - - /** - * Get the path to the included file by Options - * - * @param {String} path specified path - * @param {Options} options compilation options - * @return {String} - */ - function getIncludePath(path, options) { - var includePath; - var filePath; - var views = options.views; - var match = /^[A-Za-z]+:\\|^\//.exec(path); - - // Abs path - if (match && match.length) { - path = path.replace(/^\/*/, ''); - if (Array.isArray(options.root)) { - includePath = resolvePaths(path, options.root); - } else { - includePath = exports.resolveInclude( - path, - options.root || '/', - true - ); + if (opts.destructuredLocals && opts.destructuredLocals.length) { + var destructuring = ' var __locals = (' + opts.localsName + ' || {}),\n'; + for (var i = 0; i < opts.destructuredLocals.length; i++) { + var name = opts.destructuredLocals[i]; + if (i > 0) { + destructuring += ',\n '; } + destructuring += name + ' = __locals.' + name; } - // Relative paths - else { - // Look relative to a passed filename first - if (options.filename) { - filePath = exports.resolveInclude(path, options.filename); - if (fs.existsSync(filePath)) { - includePath = filePath; - } - } - // Then look in any views directories - if (!includePath && Array.isArray(views)) { - includePath = resolvePaths(path, views); - } - if (!includePath && typeof options.includer !== 'function') { - throw new Error( - 'Could not find the include file "' + - options.escapeFunction(path) + - '"' - ); - } - } - return includePath; + prepended += destructuring + ';\n'; } - - /** - * Get the template from a string or a file, either compiled on-the-fly or - * read from cache (if enabled), and cache the template if needed. - * - * If `template` is not set, the file specified in `options.filename` will be - * read. - * - * If `options.cache` is true, this function reads the file from - * `options.filename` so it must be set prior to calling this function. - * - * @memberof module:ejs-internal - * @param {Options} options compilation options - * @param {String} [template] template source - * @return {(TemplateFunction|ClientFunction)} - * Depending on the value of `options.client`, either type might be returned. - * @static - */ - - function handleCache(options, template) { - var func; - var filename = options.filename; - var hasTemplate = arguments.length > 1; - - if (options.cache) { - if (!filename) { - throw new Error('cache option requires a filename'); - } - func = exports.cache.get(filename); - if (func) { - return func; - } - if (!hasTemplate) { - template = fileLoader(filename).toString().replace(_BOM, ''); - } - } else if (!hasTemplate) { - // istanbul ignore if: should not happen at all - if (!filename) { - throw new Error( - 'Internal EJS error: no file name or template ' + 'provided' - ); - } - template = fileLoader(filename).toString().replace(_BOM, ''); - } - func = exports.compile(template, options); - if (options.cache) { - exports.cache.set(filename, func); - } - return func; + if (opts._with !== false) { + prepended += ' with (' + opts.localsName + ' || {}) {' + '\n'; + appended += ' }' + '\n'; } + appended += ' return __output;' + '\n'; + this.source = prepended + this.source + appended; + } - /** - * Try calling handleCache with the given options and data and call the - * callback with the result. If an error occurs, call the callback with - * the error. Used by renderFile(). - * - * @memberof module:ejs-internal - * @param {Options} options compilation options - * @param {Object} data template data - * @param {RenderFileCallback} cb callback - * @static - */ + if (opts.compileDebug) { + src = 'var __line = 1' + '\n' + + ' , __lines = ' + JSON.stringify(this.templateText) + '\n' + + ' , __filename = ' + (opts.filename ? + JSON.stringify(opts.filename) : 'undefined') + ';' + '\n' + + 'try {' + '\n' + + this.source + + '} catch (e) {' + '\n' + + ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n' + + '}' + '\n'; + } + else { + src = this.source; + } - function tryHandleCache(options, data, cb) { - var result; - if (!cb) { - if (typeof exports.promiseImpl == 'function') { - return new exports.promiseImpl(function (resolve, reject) { - try { - result = handleCache(options)(data); - resolve(result); - } catch (err) { - reject(err); - } - }); - } else { - throw new Error('Please provide a callback function'); - } - } else { - try { - result = handleCache(options)(data); - } catch (err) { - return cb(err); - } - - cb(null, result); - } + if (opts.client) { + src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src; + if (opts.compileDebug) { + src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src; } + } - /** - * fileLoader is independent - * - * @param {String} filePath ejs file path. - * @return {String} The contents of the specified file. - * @static - */ + if (opts.strict) { + src = '"use strict";\n' + src; + } + if (opts.debug) { + console.log(src); + } + if (opts.compileDebug && opts.filename) { + src = src + '\n' + + '//# sourceURL=' + opts.filename + '\n'; + } - function fileLoader(filePath) { - return exports.fileLoader(filePath); - } - - /** - * Get the template function. - * - * If `options.cache` is `true`, then the template is cached. - * - * @memberof module:ejs-internal - * @param {String} path path for the specified file - * @param {Options} options compilation options - * @return {(TemplateFunction|ClientFunction)} - * Depending on the value of `options.client`, either type might be returned - * @static - */ - - function includeFile(path, options) { - var opts = utils.shallowCopy({}, options); - opts.filename = getIncludePath(path, opts); - if (typeof options.includer === 'function') { - var includerResult = options.includer(path, opts.filename); - if (includerResult) { - if (includerResult.filename) { - opts.filename = includerResult.filename; - } - if (includerResult.template) { - return handleCache(opts, includerResult.template); - } - } + try { + if (opts.async) { + // Have to use generated function for this, since in envs without support, + // it breaks in parsing + try { + ctor = (new Function('return (async function(){}).constructor;'))(); } - return handleCache(opts); - } - - /** - * Re-throw the given `err` in context to the `str` of ejs, `filename`, and - * `lineno`. - * - * @implements {RethrowCallback} - * @memberof module:ejs-internal - * @param {Error} err Error object - * @param {String} str EJS source - * @param {String} flnm file name of the EJS file - * @param {Number} lineno line number of the error - * @param {EscapeCallback} esc - * @static - */ - - function rethrow(err, str, flnm, lineno, esc) { - var lines = str.split('\n'); - var start = Math.max(lineno - 3, 0); - var end = Math.min(lines.length, lineno + 3); - var filename = esc(flnm); - // Error context - var context = lines - .slice(start, end) - .map(function (line, i) { - var curr = i + start + 1; - return (curr == lineno ? ' >> ' : ' ') + curr + '| ' + line; - }) - .join('\n'); - - // Alter exception message - err.path = filename; - err.message = - (filename || 'ejs') + - ':' + - lineno + - '\n' + - context + - '\n\n' + - err.message; - - throw err; - } - - function stripSemi(str) { - return str.replace(/;(\s*$)/, '$1'); - } - - /** - * Compile the given `str` of ejs into a template function. - * - * @param {String} template EJS template - * - * @param {Options} [opts] compilation options - * - * @return {(TemplateFunction|ClientFunction)} - * Depending on the value of `opts.client`, either type might be returned. - * Note that the return type of the function also depends on the value of `opts.async`. - * @public - */ - - exports.compile = function compile(template, opts) { - var templ; - - // v1 compat - // 'scope' is 'context' - // FIXME: Remove this in a future version - if (opts && opts.scope) { - if (!scopeOptionWarned) { - console.warn( - '`scope` option is deprecated and will be removed in EJS 3' - ); - scopeOptionWarned = true; + catch(e) { + if (e instanceof SyntaxError) { + throw new Error('This environment does not support async/await'); } - if (!opts.context) { - opts.context = opts.scope; - } - delete opts.scope; - } - templ = new Template(template, opts); - return templ.compile(); - }; - - /** - * Render the given `template` of ejs. - * - * If you would like to include options but not data, you need to explicitly - * call this function with `data` being an empty object or `null`. - * - * @param {String} template EJS template - * @param {Object} [data={}] template data - * @param {Options} [opts={}] compilation and rendering options - * @return {(String|Promise)} - * Return value type depends on `opts.async`. - * @public - */ - - exports.render = function (template, d, o) { - var data = d || {}; - var opts = o || {}; - - // No options object -- if there are optiony names - // in the data, copy them to options - if (arguments.length == 2) { - utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA); - } - - return handleCache(opts, template)(data); - }; - - /** - * Render an EJS file at the given `path` and callback `cb(err, str)`. - * - * If you would like to include options but not data, you need to explicitly - * call this function with `data` being an empty object or `null`. - * - * @param {String} path path to the EJS file - * @param {Object} [data={}] template data - * @param {Options} [opts={}] compilation and rendering options - * @param {RenderFileCallback} cb callback - * @public - */ - - exports.renderFile = function () { - var args = Array.prototype.slice.call(arguments); - var filename = args.shift(); - var cb; - var opts = { filename: filename }; - var data; - var viewOpts; - - // Do we have a callback? - if (typeof arguments[arguments.length - 1] == 'function') { - cb = args.pop(); - } - // Do we have data/opts? - if (args.length) { - // Should always have data obj - data = args.shift(); - // Normal passed opts (data obj + opts obj) - if (args.length) { - // Use shallowCopy so we don't pollute passed in opts obj with new vals - utils.shallowCopy(opts, args.pop()); - } - // Special casing for Express (settings + opts-in-data) else { - // Express 3 and 4 - if (data.settings) { - // Pull a few things from known locations - if (data.settings.views) { - opts.views = data.settings.views; - } - if (data.settings['view cache']) { - opts.cache = true; - } - // Undocumented after Express 2, but still usable, esp. for - // items that are unsafe to be passed along with data, like `root` - viewOpts = data.settings['view options']; - if (viewOpts) { - utils.shallowCopy(opts, viewOpts); - } - } - // Express 2 and lower, values set in app.locals, or people who just - // want to pass options in their data. NOTE: These values will override - // anything previously set in settings or settings['view options'] - utils.shallowCopyFromList( - opts, - data, - _OPTS_PASSABLE_WITH_DATA_EXPRESS - ); - } - opts.filename = filename; - } else { - data = {}; - } - - return tryHandleCache(opts, data, cb); - }; - - /** - * Clear intermediate JavaScript cache. Calls {@link Cache#reset}. - * @public - */ - - /** - * EJS template class - * @public - */ - exports.Template = Template; - - exports.clearCache = function () { - exports.cache.reset(); - }; - - function Template(text, opts) { - opts = opts || {}; - var options = {}; - this.templateText = text; - /** @type {string | null} */ - this.mode = null; - this.truncate = false; - this.currentLine = 1; - this.source = ''; - options.client = opts.client || false; - options.escapeFunction = - opts.escape || opts.escapeFunction || utils.escapeXML; - options.compileDebug = opts.compileDebug !== false; - options.debug = !!opts.debug; - options.filename = opts.filename; - options.openDelimiter = - opts.openDelimiter || - exports.openDelimiter || - _DEFAULT_OPEN_DELIMITER; - options.closeDelimiter = - opts.closeDelimiter || - exports.closeDelimiter || - _DEFAULT_CLOSE_DELIMITER; - options.delimiter = - opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER; - options.strict = opts.strict || false; - options.context = opts.context; - options.cache = opts.cache || false; - options.rmWhitespace = opts.rmWhitespace; - options.root = opts.root; - options.includer = opts.includer; - options.outputFunctionName = opts.outputFunctionName; - options.localsName = - opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME; - options.views = opts.views; - options.async = opts.async; - options.destructuredLocals = opts.destructuredLocals; - options.legacyInclude = - typeof opts.legacyInclude != 'undefined' - ? !!opts.legacyInclude - : true; - - if (options.strict) { - options._with = false; - } else { - options._with = typeof opts._with != 'undefined' ? opts._with : true; - } - - this.opts = options; - - this.regex = this.createRegex(); - } - - Template.modes = { - EVAL: 'eval', - ESCAPED: 'escaped', - RAW: 'raw', - COMMENT: 'comment', - LITERAL: 'literal', - }; - - Template.prototype = { - createRegex: function () { - var str = _REGEX_STRING; - var delim = utils.escapeRegExpChars(this.opts.delimiter); - var open = utils.escapeRegExpChars(this.opts.openDelimiter); - var close = utils.escapeRegExpChars(this.opts.closeDelimiter); - str = str - .replace(/%/g, delim) - .replace(//g, close); - return new RegExp(str); - }, - - compile: function () { - /** @type {string} */ - var src; - /** @type {ClientFunction} */ - var fn; - var opts = this.opts; - var prepended = ''; - var appended = ''; - /** @type {EscapeCallback} */ - var escapeFn = opts.escapeFunction; - /** @type {FunctionConstructor} */ - var ctor; - - if (!this.source) { - this.generateSource(); - prepended += - ' var __output = "";\n' + - ' function __append(s) { if (s !== undefined && s !== null) __output += s }\n'; - if (opts.outputFunctionName) { - prepended += - ' var ' + opts.outputFunctionName + ' = __append;' + '\n'; - } - if (opts.destructuredLocals && opts.destructuredLocals.length) { - var destructuring = - ' var __locals = (' + opts.localsName + ' || {}),\n'; - for (var i = 0; i < opts.destructuredLocals.length; i++) { - var name = opts.destructuredLocals[i]; - if (i > 0) { - destructuring += ',\n '; - } - destructuring += name + ' = __locals.' + name; - } - prepended += destructuring + ';\n'; - } - if (opts._with !== false) { - prepended += ' with (' + opts.localsName + ' || {}) {' + '\n'; - appended += ' }' + '\n'; - } - appended += ' return __output;' + '\n'; - this.source = prepended + this.source + appended; - } - - if (opts.compileDebug) { - src = - 'var __line = 1' + - '\n' + - ' , __lines = ' + - JSON.stringify(this.templateText) + - '\n' + - ' , __filename = ' + - (opts.filename ? JSON.stringify(opts.filename) : 'undefined') + - ';' + - '\n' + - 'try {' + - '\n' + - this.source + - '} catch (e) {' + - '\n' + - ' rethrow(e, __lines, __filename, __line, escapeFn);' + - '\n' + - '}' + - '\n'; - } else { - src = this.source; - } - - if (opts.client) { - src = - 'escapeFn = escapeFn || ' + - escapeFn.toString() + - ';' + - '\n' + - src; - if (opts.compileDebug) { - src = - 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src; - } - } - - if (opts.strict) { - src = '"use strict";\n' + src; - } - if (opts.debug) { - console.log(src); - } - if (opts.compileDebug && opts.filename) { - src = src + '\n' + '//# sourceURL=' + opts.filename + '\n'; - } - - try { - if (opts.async) { - // Have to use generated function for this, since in envs without support, - // it breaks in parsing - try { - ctor = new Function( - 'return (async function(){}).constructor;' - )(); - } catch (e) { - if (e instanceof SyntaxError) { - throw new Error( - 'This environment does not support async/await' - ); - } else { - throw e; - } - } - } else { - ctor = Function; - } - fn = new ctor( - opts.localsName + ', escapeFn, include, rethrow', - src - ); - } catch (e) { - // istanbul ignore else - if (e instanceof SyntaxError) { - if (opts.filename) { - e.message += ' in ' + opts.filename; - } - e.message += ' while compiling ejs\n\n'; - e.message += - 'If the above error is not helpful, you may want to try EJS-Lint:\n'; - e.message += 'https://github.com/RyanZim/EJS-Lint'; - if (!opts.async) { - e.message += '\n'; - e.message += - 'Or, if you meant to create an async function, pass `async: true` as an option.'; - } - } throw e; } + } + } + else { + ctor = Function; + } + fn = new ctor(opts.localsName + ', escapeFn, include, rethrow', src); + } + catch(e) { + // istanbul ignore else + if (e instanceof SyntaxError) { + if (opts.filename) { + e.message += ' in ' + opts.filename; + } + e.message += ' while compiling ejs\n\n'; + e.message += 'If the above error is not helpful, you may want to try EJS-Lint:\n'; + e.message += 'https://github.com/RyanZim/EJS-Lint'; + if (!opts.async) { + e.message += '\n'; + e.message += 'Or, if you meant to create an async function, pass `async: true` as an option.'; + } + } + throw e; + } - // Return a callable function which will execute the function - // created by the source-code, with the passed data as locals - // Adds a local `include` function which allows full recursive include - var returnedFn = opts.client - ? fn - : function anonymous(data) { - var include = function (path, includeData) { - var d = utils.shallowCopy({}, data); - if (includeData) { - d = utils.shallowCopy(d, includeData); - } - return includeFile(path, opts)(d); - }; - return fn.apply(opts.context, [ - data || {}, - escapeFn, - include, - rethrow, - ]); - }; - if (opts.filename && typeof Object.defineProperty === 'function') { - var filename = opts.filename; - var basename = path.basename(filename, path.extname(filename)); + // Return a callable function which will execute the function + // created by the source-code, with the passed data as locals + // Adds a local `include` function which allows full recursive include + var returnedFn = opts.client ? fn : function anonymous(data) { + var include = function (path, includeData) { + var d = utils.shallowCopy({}, data); + if (includeData) { + d = utils.shallowCopy(d, includeData); + } + return includeFile(path, opts)(d); + }; + return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]); + }; + if (opts.filename && typeof Object.defineProperty === 'function') { + var filename = opts.filename; + var basename = path.basename(filename, path.extname(filename)); + try { + Object.defineProperty(returnedFn, 'name', { + value: basename, + writable: false, + enumerable: false, + configurable: true + }); + } catch (e) {/* ignore */} + } + return returnedFn; + }, + + generateSource: function () { + var opts = this.opts; + + if (opts.rmWhitespace) { + // Have to use two separate replace here as `^` and `$` operators don't + // work well with `\r` and empty lines don't work well with the `m` flag. + this.templateText = + this.templateText.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, ''); + } + + // Slurp spaces and tabs before <%_ and after _%> + this.templateText = + this.templateText.replace(/[ \t]*<%_/gm, '<%_').replace(/_%>[ \t]*/gm, '_%>'); + + var self = this; + var matches = this.parseTemplateText(); + var d = this.opts.delimiter; + var o = this.opts.openDelimiter; + var c = this.opts.closeDelimiter; + + if (matches && matches.length) { + matches.forEach(function (line, index) { + var closing; + // If this is an opening tag, check for closing tags + // FIXME: May end up with some false positives here + // Better to store modes as k/v with openDelimiter + delimiter as key + // Then this can simply check against the map + if ( line.indexOf(o + d) === 0 // If it is a tag + && line.indexOf(o + d + d) !== 0) { // and is not escaped + closing = matches[index + 2]; + if (!(closing == d + c || closing == '-' + d + c || closing == '_' + d + c)) { + throw new Error('Could not find matching close tag for "' + line + '".'); + } + } + self.scanLine(line); + }); + } + + }, + + parseTemplateText: function () { + var str = this.templateText; + var pat = this.regex; + var result = pat.exec(str); + var arr = []; + var firstPos; + + while (result) { + firstPos = result.index; + + if (firstPos !== 0) { + arr.push(str.substring(0, firstPos)); + str = str.slice(firstPos); + } + + arr.push(result[0]); + str = str.slice(result[0].length); + result = pat.exec(str); + } + + if (str) { + arr.push(str); + } + + return arr; + }, + + _addOutput: function (line) { + if (this.truncate) { + // Only replace single leading linebreak in the line after + // -%> tag -- this is the single, trailing linebreak + // after the tag that the truncation mode replaces + // Handle Win / Unix / old Mac linebreaks -- do the \r\n + // combo first in the regex-or + line = line.replace(/^(?:\r\n|\r|\n)/, ''); + this.truncate = false; + } + if (!line) { + return line; + } + + // Preserve literal slashes + line = line.replace(/\\/g, '\\\\'); + + // Convert linebreaks + line = line.replace(/\n/g, '\\n'); + line = line.replace(/\r/g, '\\r'); + + // Escape double-quotes + // - this will be the delimiter during execution + line = line.replace(/"/g, '\\"'); + this.source += ' ; __append("' + line + '")' + '\n'; + }, + + scanLine: function (line) { + var self = this; + var d = this.opts.delimiter; + var o = this.opts.openDelimiter; + var c = this.opts.closeDelimiter; + var newLineCount = 0; + + newLineCount = (line.split('\n').length - 1); + + switch (line) { + case o + d: + case o + d + '_': + this.mode = Template.modes.EVAL; + break; + case o + d + '=': + this.mode = Template.modes.ESCAPED; + break; + case o + d + '-': + this.mode = Template.modes.RAW; + break; + case o + d + '#': + this.mode = Template.modes.COMMENT; + break; + case o + d + d: + this.mode = Template.modes.LITERAL; + this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")' + '\n'; + break; + case d + d + c: + this.mode = Template.modes.LITERAL; + this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")' + '\n'; + break; + case d + c: + case '-' + d + c: + case '_' + d + c: + if (this.mode == Template.modes.LITERAL) { + this._addOutput(line); + } + + this.mode = null; + this.truncate = line.indexOf('-') === 0 || line.indexOf('_') === 0; + break; + default: + // In script mode, depends on type of tag + if (this.mode) { + // If '//' is found without a line break, add a line break. + switch (this.mode) { + case Template.modes.EVAL: + case Template.modes.ESCAPED: + case Template.modes.RAW: + if (line.lastIndexOf('//') > line.lastIndexOf('\n')) { + line += '\n'; + } + } + switch (this.mode) { + // Just executing code + case Template.modes.EVAL: + this.source += ' ; ' + line + '\n'; + break; + // Exec, esc, and output + case Template.modes.ESCAPED: + this.source += ' ; __append(escapeFn(' + stripSemi(line) + '))' + '\n'; + break; + // Exec and output + case Template.modes.RAW: + this.source += ' ; __append(' + stripSemi(line) + ')' + '\n'; + break; + case Template.modes.COMMENT: + // Do nothing + break; + // Literal <%% mode, append as raw output + case Template.modes.LITERAL: + this._addOutput(line); + break; + } + } + // In string mode, just add the output + else { + this._addOutput(line); + } + } + + if (self.opts.compileDebug && newLineCount) { + this.currentLine += newLineCount; + this.source += ' ; __line = ' + this.currentLine + '\n'; + } + } +}; + +/** + * Escape characters reserved in XML. + * + * This is simply an export of {@link module:utils.escapeXML}. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + * + * @param {String} markup Input string + * @return {String} Escaped string + * @public + * @func + * */ +exports.escapeXML = utils.escapeXML; + +/** + * Express.js support. + * + * This is an alias for {@link module:ejs.renderFile}, in order to support + * Express.js out-of-the-box. + * + * @func + */ + +exports.__express = exports.renderFile; + +/** + * Version of EJS. + * + * @readonly + * @type {String} + * @public + */ + +exports.VERSION = _VERSION_STRING; + +/** + * Name for detection of EJS. + * + * @readonly + * @type {String} + * @public + */ + +exports.name = _NAME; + +/* istanbul ignore if */ +if (typeof window != 'undefined') { + window.ejs = exports; +} + + +/***/ }), + +/***/ 356: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +/** + * Private utility functions + * @module utils + * @private + */ + + + +var regExpChars = /[|\\{}()[\]^$+*?.]/g; + +/** + * Escape characters reserved in regular expressions. + * + * If `string` is `undefined` or `null`, the empty string is returned. + * + * @param {String} string Input string + * @return {String} Escaped string + * @static + * @private + */ +exports.escapeRegExpChars = function (string) { + // istanbul ignore if + if (!string) { + return ''; + } + return String(string).replace(regExpChars, '\\$&'); +}; + +var _ENCODE_HTML_RULES = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; +var _MATCH_HTML = /[&<>'"]/g; + +function encode_char(c) { + return _ENCODE_HTML_RULES[c] || c; +} + +/** + * Stringified version of constants used by {@link module:utils.escapeXML}. + * + * It is used in the process of generating {@link ClientFunction}s. + * + * @readonly + * @type {String} + */ + +var escapeFuncStr = + 'var _ENCODE_HTML_RULES = {\n' ++ ' "&": "&"\n' ++ ' , "<": "<"\n' ++ ' , ">": ">"\n' ++ ' , \'"\': """\n' ++ ' , "\'": "'"\n' ++ ' }\n' ++ ' , _MATCH_HTML = /[&<>\'"]/g;\n' ++ 'function encode_char(c) {\n' ++ ' return _ENCODE_HTML_RULES[c] || c;\n' ++ '};\n'; + +/** + * Escape characters reserved in XML. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + * + * @implements {EscapeCallback} + * @param {String} markup Input string + * @return {String} Escaped string + * @static + * @private + */ + +exports.escapeXML = function (markup) { + return markup == undefined + ? '' + : String(markup) + .replace(_MATCH_HTML, encode_char); +}; +exports.escapeXML.toString = function () { + return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr; +}; + +/** + * Naive copy of properties from one object to another. + * Does not recurse into non-scalar properties + * Does not check to see if the property has a value before copying + * + * @param {Object} to Destination object + * @param {Object} from Source object + * @return {Object} Destination object + * @static + * @private + */ +exports.shallowCopy = function (to, from) { + from = from || {}; + for (var p in from) { + to[p] = from[p]; + } + return to; +}; + +/** + * Naive copy of a list of key names, from one object to another. + * Only copies property if it is actually defined + * Does not recurse into non-scalar properties + * + * @param {Object} to Destination object + * @param {Object} from Source object + * @param {Array} list List of properties to copy + * @return {Object} Destination object + * @static + * @private + */ +exports.shallowCopyFromList = function (to, from, list) { + for (var i = 0; i < list.length; i++) { + var p = list[i]; + if (typeof from[p] != 'undefined') { + to[p] = from[p]; + } + } + return to; +}; + +/** + * Simple in-process cache implementation. Does not implement limits of any + * sort. + * + * @implements {Cache} + * @static + * @private + */ +exports.cache = { + _data: {}, + set: function (key, val) { + this._data[key] = val; + }, + get: function (key) { + return this._data[key]; + }, + remove: function (key) { + delete this._data[key]; + }, + reset: function () { + this._data = {}; + } +}; + +/** + * Transforms hyphen case variable into camel case. + * + * @param {String} string Hyphen case string + * @return {String} Camel case string + * @static + * @private + */ +exports.hyphenToCamel = function (str) { + return str.replace(/-[a-z]/g, function (match) { return match[1].toUpperCase(); }); +}; + + +/***/ }), + +/***/ 1205: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var once = __nccwpck_require__(1223); + +var noop = function() {}; + +var isRequest = function(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +}; + +var isChildProcess = function(stream) { + return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3 +}; + +var eos = function(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + + callback = once(callback || noop); + + var ws = stream._writableState; + var rs = stream._readableState; + var readable = opts.readable || (opts.readable !== false && stream.readable); + var writable = opts.writable || (opts.writable !== false && stream.writable); + var cancelled = false; + + var onlegacyfinish = function() { + if (!stream.writable) onfinish(); + }; + + var onfinish = function() { + writable = false; + if (!readable) callback.call(stream); + }; + + var onend = function() { + readable = false; + if (!writable) callback.call(stream); + }; + + var onexit = function(exitCode) { + callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); + }; + + var onerror = function(err) { + callback.call(stream, err); + }; + + var onclose = function() { + process.nextTick(onclosenexttick); + }; + + var onclosenexttick = function() { + if (cancelled) return; + if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close')); + if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close')); + }; + + var onrequest = function() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest(); + else stream.on('request', onrequest); + } else if (writable && !ws) { // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + + if (isChildProcess(stream)) stream.on('exit', onexit); + + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + + return function() { + cancelled = true; + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('exit', onexit); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +}; + +module.exports = eos; + + +/***/ }), + +/***/ 8171: +/***/ ((module) => { + +"use strict"; + + +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; +var defineProperty = Object.defineProperty; +var gOPD = Object.getOwnPropertyDescriptor; + +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } + + return toStr.call(arr) === '[object Array]'; +}; + +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } + + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } + + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; + +// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target +var setProperty = function setProperty(target, options) { + if (defineProperty && options.name === '__proto__') { + defineProperty(target, options.name, { + enumerable: true, + configurable: true, + value: options.newValue, + writable: true + }); + } else { + target[options.name] = options.newValue; + } +}; + +// Return undefined instead of __proto__ if '__proto__' is not an own property +var getProperty = function getProperty(obj, name) { + if (name === '__proto__') { + if (!hasOwn.call(obj, name)) { + return void 0; + } else if (gOPD) { + // In early versions of node, obj['__proto__'] is buggy when obj has + // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. + return gOPD(obj, name).value; + } + } + + return obj[name]; +}; + +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = getProperty(target, name); + copy = getProperty(options, name); + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + setProperty(target, { name: name, newValue: copy }); + } + } + } + } + } + + // Return the modified object + return target; +}; + + +/***/ }), + +/***/ 1585: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const {PassThrough: PassThroughStream} = __nccwpck_require__(2413); + +module.exports = options => { + options = {...options}; + + const {array} = options; + let {encoding} = options; + const isBuffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || isBuffer); + } else { + encoding = encoding || 'utf8'; + } + + if (isBuffer) { + encoding = null; + } + + const stream = new PassThroughStream({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + let length = 0; + const chunks = []; + + stream.on('data', chunk => { + chunks.push(chunk); + + if (objectMode) { + length = chunks.length; + } else { + length += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return chunks; + } + + return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); + }; + + stream.getBufferedLength = () => length; + + return stream; +}; + + +/***/ }), + +/***/ 1766: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const {constants: BufferConstants} = __nccwpck_require__(4293); +const pump = __nccwpck_require__(8341); +const bufferStream = __nccwpck_require__(1585); + +class MaxBufferError extends Error { + constructor() { + super('maxBuffer exceeded'); + this.name = 'MaxBufferError'; + } +} + +async function getStream(inputStream, options) { + if (!inputStream) { + return Promise.reject(new Error('Expected a stream')); + } + + options = { + maxBuffer: Infinity, + ...options + }; + + const {maxBuffer} = options; + + let stream; + await new Promise((resolve, reject) => { + const rejectPromise = error => { + // Don't retrieve an oversized buffer. + if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { + error.bufferedData = stream.getBufferedValue(); + } + + reject(error); + }; + + stream = pump(inputStream, bufferStream(options), error => { + if (error) { + rejectPromise(error); + return; + } + + resolve(); + }); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + rejectPromise(new MaxBufferError()); + } + }); + }); + + return stream.getBufferedValue(); +} + +module.exports = getStream; +// TODO: Remove this for the next major release +module.exports.default = getStream; +module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'}); +module.exports.array = (stream, options) => getStream(stream, {...options, array: true}); +module.exports.MaxBufferError = MaxBufferError; + + +/***/ }), + +/***/ 237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var emoji = __nccwpck_require__(5464) + +module.exports = BananaSlug + +var own = Object.hasOwnProperty +var whitespace = /\s/g +var specials = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~’]/g + +function BananaSlug () { + var self = this + + if (!(self instanceof BananaSlug)) return new BananaSlug() + + self.reset() +} + +/** + * Generate a unique slug. + * @param {string} value String of text to slugify + * @param {boolean} [false] Keep the current case, otherwise make all lowercase + * @return {string} A unique slug string + */ +BananaSlug.prototype.slug = function (value, maintainCase) { + var self = this + var slug = slugger(value, maintainCase === true) + var originalSlug = slug + + while (own.call(self.occurrences, slug)) { + self.occurrences[originalSlug]++ + slug = originalSlug + '-' + self.occurrences[originalSlug] + } + + self.occurrences[slug] = 0 + + return slug +} + +/** + * Reset - Forget all previous slugs + * @return void + */ +BananaSlug.prototype.reset = function () { + this.occurrences = Object.create(null) +} + +function slugger (string, maintainCase) { + if (typeof string !== 'string') return '' + if (!maintainCase) string = string.toLowerCase() + + return string.trim() + .replace(specials, '') + .replace(emoji(), '') + .replace(whitespace, '-') +} + +BananaSlug.slug = slugger + + +/***/ }), + +/***/ 5464: +/***/ ((module) => { + +module.exports = function() { + return /[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2694\u2696\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD79\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED0\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3]|\uD83E[\uDD10-\uDD18\uDD80-\uDD84\uDDC0]|\uD83C\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uD83C\uDDFE\uD83C[\uDDEA\uDDF9]|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDFC\uD83C[\uDDEB\uDDF8]|\uD83C\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uD83C\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF8\uDDFE\uDDFF]|\uD83C\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uD83C\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uD83C\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uD83C\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uD83C\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uD83C\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uD83C\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uD83C\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uD83C\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uD83C\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uD83C\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uD83C\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uD83C\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uD83C\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uD83C\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uD83C\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|[#\*0-9]\u20E3/g; +}; + + +/***/ }), + +/***/ 6457: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const types_1 = __nccwpck_require__(4597); +function createRejection(error, ...beforeErrorGroups) { + const promise = (async () => { + if (error instanceof types_1.RequestError) { try { - Object.defineProperty(returnedFn, 'name', { - value: basename, - writable: false, - enumerable: false, - configurable: true, - }); - } catch (e) { - /* ignore */ - } - } - return returnedFn; - }, - - generateSource: function () { - var opts = this.opts; - - if (opts.rmWhitespace) { - // Have to use two separate replace here as `^` and `$` operators don't - // work well with `\r` and empty lines don't work well with the `m` flag. - this.templateText = this.templateText - .replace(/[\r\n]+/g, '\n') - .replace(/^\s+|\s+$/gm, ''); - } - - // Slurp spaces and tabs before <%_ and after _%> - this.templateText = this.templateText - .replace(/[ \t]*<%_/gm, '<%_') - .replace(/_%>[ \t]*/gm, '_%>'); - - var self = this; - var matches = this.parseTemplateText(); - var d = this.opts.delimiter; - var o = this.opts.openDelimiter; - var c = this.opts.closeDelimiter; - - if (matches && matches.length) { - matches.forEach(function (line, index) { - var closing; - // If this is an opening tag, check for closing tags - // FIXME: May end up with some false positives here - // Better to store modes as k/v with openDelimiter + delimiter as key - // Then this can simply check against the map - if ( - line.indexOf(o + d) === 0 && // If it is a tag - line.indexOf(o + d + d) !== 0 - ) { - // and is not escaped - closing = matches[index + 2]; - if ( - !( - closing == d + c || - closing == '-' + d + c || - closing == '_' + d + c - ) - ) { - throw new Error( - 'Could not find matching close tag for "' + line + '".' - ); - } - } - self.scanLine(line); - }); - } - }, - - parseTemplateText: function () { - var str = this.templateText; - var pat = this.regex; - var result = pat.exec(str); - var arr = []; - var firstPos; - - while (result) { - firstPos = result.index; - - if (firstPos !== 0) { - arr.push(str.substring(0, firstPos)); - str = str.slice(firstPos); - } - - arr.push(result[0]); - str = str.slice(result[0].length); - result = pat.exec(str); - } - - if (str) { - arr.push(str); - } - - return arr; - }, - - _addOutput: function (line) { - if (this.truncate) { - // Only replace single leading linebreak in the line after - // -%> tag -- this is the single, trailing linebreak - // after the tag that the truncation mode replaces - // Handle Win / Unix / old Mac linebreaks -- do the \r\n - // combo first in the regex-or - line = line.replace(/^(?:\r\n|\r|\n)/, ''); - this.truncate = false; - } - if (!line) { - return line; - } - - // Preserve literal slashes - line = line.replace(/\\/g, '\\\\'); - - // Convert linebreaks - line = line.replace(/\n/g, '\\n'); - line = line.replace(/\r/g, '\\r'); - - // Escape double-quotes - // - this will be the delimiter during execution - line = line.replace(/"/g, '\\"'); - this.source += ' ; __append("' + line + '")' + '\n'; - }, - - scanLine: function (line) { - var self = this; - var d = this.opts.delimiter; - var o = this.opts.openDelimiter; - var c = this.opts.closeDelimiter; - var newLineCount = 0; - - newLineCount = line.split('\n').length - 1; - - switch (line) { - case o + d: - case o + d + '_': - this.mode = Template.modes.EVAL; - break; - case o + d + '=': - this.mode = Template.modes.ESCAPED; - break; - case o + d + '-': - this.mode = Template.modes.RAW; - break; - case o + d + '#': - this.mode = Template.modes.COMMENT; - break; - case o + d + d: - this.mode = Template.modes.LITERAL; - this.source += - ' ; __append("' + - line.replace(o + d + d, o + d) + - '")' + - '\n'; - break; - case d + d + c: - this.mode = Template.modes.LITERAL; - this.source += - ' ; __append("' + - line.replace(d + d + c, d + c) + - '")' + - '\n'; - break; - case d + c: - case '-' + d + c: - case '_' + d + c: - if (this.mode == Template.modes.LITERAL) { - this._addOutput(line); - } - - this.mode = null; - this.truncate = - line.indexOf('-') === 0 || line.indexOf('_') === 0; - break; - default: - // In script mode, depends on type of tag - if (this.mode) { - // If '//' is found without a line break, add a line break. - switch (this.mode) { - case Template.modes.EVAL: - case Template.modes.ESCAPED: - case Template.modes.RAW: - if (line.lastIndexOf('//') > line.lastIndexOf('\n')) { - line += '\n'; + for (const hooks of beforeErrorGroups) { + if (hooks) { + for (const hook of hooks) { + // eslint-disable-next-line no-await-in-loop + error = await hook(error); + } } } - switch (this.mode) { - // Just executing code - case Template.modes.EVAL: - this.source += ' ; ' + line + '\n'; - break; - // Exec, esc, and output - case Template.modes.ESCAPED: - this.source += - ' ; __append(escapeFn(' + - stripSemi(line) + - '))' + - '\n'; - break; - // Exec and output - case Template.modes.RAW: - this.source += - ' ; __append(' + stripSemi(line) + ')' + '\n'; - break; - case Template.modes.COMMENT: - // Do nothing - break; - // Literal <%% mode, append as raw output - case Template.modes.LITERAL: - this._addOutput(line); - break; - } - } - // In string mode, just add the output - else { - this._addOutput(line); - } - } - - if (self.opts.compileDebug && newLineCount) { - this.currentLine += newLineCount; - this.source += ' ; __line = ' + this.currentLine + '\n'; - } - }, - }; - - /** - * Escape characters reserved in XML. - * - * This is simply an export of {@link module:utils.escapeXML}. - * - * If `markup` is `undefined` or `null`, the empty string is returned. - * - * @param {String} markup Input string - * @return {String} Escaped string - * @public - * @func - * */ - exports.escapeXML = utils.escapeXML; - - /** - * Express.js support. - * - * This is an alias for {@link module:ejs.renderFile}, in order to support - * Express.js out-of-the-box. - * - * @func - */ - - exports.__express = exports.renderFile; - - /** - * Version of EJS. - * - * @readonly - * @type {String} - * @public - */ - - exports.VERSION = _VERSION_STRING; - - /** - * Name for detection of EJS. - * - * @readonly - * @type {String} - * @public - */ - - exports.name = _NAME; - - /* istanbul ignore if */ - if (typeof window != 'undefined') { - window.ejs = exports; - } - - /***/ - }, - - /***/ 356: /***/ (__unused_webpack_module, exports) => { - 'use strict'; - /* - * EJS Embedded JavaScript templates - * Copyright 2112 Matthew Eernisse (mde@fleegix.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - /** - * Private utility functions - * @module utils - * @private - */ - - var regExpChars = /[|\\{}()[\]^$+*?.]/g; - - /** - * Escape characters reserved in regular expressions. - * - * If `string` is `undefined` or `null`, the empty string is returned. - * - * @param {String} string Input string - * @return {String} Escaped string - * @static - * @private - */ - exports.escapeRegExpChars = function (string) { - // istanbul ignore if - if (!string) { - return ''; - } - return String(string).replace(regExpChars, '\\$&'); - }; - - var _ENCODE_HTML_RULES = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - }; - var _MATCH_HTML = /[&<>'"]/g; - - function encode_char(c) { - return _ENCODE_HTML_RULES[c] || c; - } - - /** - * Stringified version of constants used by {@link module:utils.escapeXML}. - * - * It is used in the process of generating {@link ClientFunction}s. - * - * @readonly - * @type {String} - */ - - var escapeFuncStr = - 'var _ENCODE_HTML_RULES = {\n' + - ' "&": "&"\n' + - ' , "<": "<"\n' + - ' , ">": ">"\n' + - ' , \'"\': """\n' + - ' , "\'": "'"\n' + - ' }\n' + - ' , _MATCH_HTML = /[&<>\'"]/g;\n' + - 'function encode_char(c) {\n' + - ' return _ENCODE_HTML_RULES[c] || c;\n' + - '};\n'; - - /** - * Escape characters reserved in XML. - * - * If `markup` is `undefined` or `null`, the empty string is returned. - * - * @implements {EscapeCallback} - * @param {String} markup Input string - * @return {String} Escaped string - * @static - * @private - */ - - exports.escapeXML = function (markup) { - return markup == undefined - ? '' - : String(markup).replace(_MATCH_HTML, encode_char); - }; - exports.escapeXML.toString = function () { - return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr; - }; - - /** - * Naive copy of properties from one object to another. - * Does not recurse into non-scalar properties - * Does not check to see if the property has a value before copying - * - * @param {Object} to Destination object - * @param {Object} from Source object - * @return {Object} Destination object - * @static - * @private - */ - exports.shallowCopy = function (to, from) { - from = from || {}; - for (var p in from) { - to[p] = from[p]; - } - return to; - }; - - /** - * Naive copy of a list of key names, from one object to another. - * Only copies property if it is actually defined - * Does not recurse into non-scalar properties - * - * @param {Object} to Destination object - * @param {Object} from Source object - * @param {Array} list List of properties to copy - * @return {Object} Destination object - * @static - * @private - */ - exports.shallowCopyFromList = function (to, from, list) { - for (var i = 0; i < list.length; i++) { - var p = list[i]; - if (typeof from[p] != 'undefined') { - to[p] = from[p]; - } - } - return to; - }; - - /** - * Simple in-process cache implementation. Does not implement limits of any - * sort. - * - * @implements {Cache} - * @static - * @private - */ - exports.cache = { - _data: {}, - set: function (key, val) { - this._data[key] = val; - }, - get: function (key) { - return this._data[key]; - }, - remove: function (key) { - delete this._data[key]; - }, - reset: function () { - this._data = {}; - }, - }; - - /** - * Transforms hyphen case variable into camel case. - * - * @param {String} string Hyphen case string - * @return {String} Camel case string - * @static - * @private - */ - exports.hyphenToCamel = function (str) { - return str.replace(/-[a-z]/g, function (match) { - return match[1].toUpperCase(); - }); - }; - - /***/ - }, - - /***/ 1205: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - var once = __nccwpck_require__(1223); - - var noop = function () {}; - - var isRequest = function (stream) { - return stream.setHeader && typeof stream.abort === 'function'; - }; - - var isChildProcess = function (stream) { - return ( - stream.stdio && - Array.isArray(stream.stdio) && - stream.stdio.length === 3 - ); - }; - - var eos = function (stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - - callback = once(callback || noop); - - var ws = stream._writableState; - var rs = stream._readableState; - var readable = - opts.readable || (opts.readable !== false && stream.readable); - var writable = - opts.writable || (opts.writable !== false && stream.writable); - var cancelled = false; - - var onlegacyfinish = function () { - if (!stream.writable) onfinish(); - }; - - var onfinish = function () { - writable = false; - if (!readable) callback.call(stream); - }; - - var onend = function () { - readable = false; - if (!writable) callback.call(stream); - }; - - var onexit = function (exitCode) { - callback.call( - stream, - exitCode ? new Error('exited with error code: ' + exitCode) : null - ); - }; - - var onerror = function (err) { - callback.call(stream, err); - }; - - var onclose = function () { - process.nextTick(onclosenexttick); - }; - - var onclosenexttick = function () { - if (cancelled) return; - if (readable && !(rs && rs.ended && !rs.destroyed)) - return callback.call(stream, new Error('premature close')); - if (writable && !(ws && ws.ended && !ws.destroyed)) - return callback.call(stream, new Error('premature close')); - }; - - var onrequest = function () { - stream.req.on('finish', onfinish); - }; - - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest(); - else stream.on('request', onrequest); - } else if (writable && !ws) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } - - if (isChildProcess(stream)) stream.on('exit', onexit); - - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - - return function () { - cancelled = true; - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('exit', onexit); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; - }; - - module.exports = eos; - - /***/ - }, - - /***/ 8171: /***/ (module) => { - 'use strict'; - - var hasOwn = Object.prototype.hasOwnProperty; - var toStr = Object.prototype.toString; - var defineProperty = Object.defineProperty; - var gOPD = Object.getOwnPropertyDescriptor; - - var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - - return toStr.call(arr) === '[object Array]'; - }; - - var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = - obj.constructor && - obj.constructor.prototype && - hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) { - /**/ - } - - return typeof key === 'undefined' || hasOwn.call(obj, key); - }; - - // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target - var setProperty = function setProperty(target, options) { - if (defineProperty && options.name === '__proto__') { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true, - }); - } else { - target[options.name] = options.newValue; - } - }; - - // Return undefined instead of __proto__ if '__proto__' is not an own property - var getProperty = function getProperty(obj, name) { - if (name === '__proto__') { - if (!hasOwn.call(obj, name)) { - return void 0; - } else if (gOPD) { - // In early versions of node, obj['__proto__'] is buggy when obj has - // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. - return gOPD(obj, name).value; - } - } - - return obj[name]; - }; - - module.exports = function extend() { - var options, name, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; - - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - if ( - target == null || - (typeof target !== 'object' && typeof target !== 'function') - ) { - target = {}; - } - - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = getProperty(target, name); - copy = getProperty(options, name); - - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if ( - deep && - copy && - (isPlainObject(copy) || (copyIsArray = isArray(copy))) - ) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - setProperty(target, { - name: name, - newValue: extend(deep, clone, copy), - }); - - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - setProperty(target, { name: name, newValue: copy }); - } - } } - } - } - - // Return the modified object - return target; - }; - - /***/ - }, - - /***/ 1585: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const { PassThrough: PassThroughStream } = __nccwpck_require__(2413); - - module.exports = (options) => { - options = { ...options }; - - const { array } = options; - let { encoding } = options; - const isBuffer = encoding === 'buffer'; - let objectMode = false; - - if (array) { - objectMode = !(encoding || isBuffer); - } else { - encoding = encoding || 'utf8'; - } - - if (isBuffer) { - encoding = null; - } - - const stream = new PassThroughStream({ objectMode }); - - if (encoding) { - stream.setEncoding(encoding); - } - - let length = 0; - const chunks = []; - - stream.on('data', (chunk) => { - chunks.push(chunk); - - if (objectMode) { - length = chunks.length; - } else { - length += chunk.length; - } - }); - - stream.getBufferedValue = () => { - if (array) { - return chunks; - } - - return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); - }; - - stream.getBufferedLength = () => length; - - return stream; - }; - - /***/ - }, - - /***/ 1766: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const { constants: BufferConstants } = __nccwpck_require__(4293); - const pump = __nccwpck_require__(8341); - const bufferStream = __nccwpck_require__(1585); - - class MaxBufferError extends Error { - constructor() { - super('maxBuffer exceeded'); - this.name = 'MaxBufferError'; - } - } - - async function getStream(inputStream, options) { - if (!inputStream) { - return Promise.reject(new Error('Expected a stream')); - } - - options = { - maxBuffer: Infinity, - ...options, - }; - - const { maxBuffer } = options; - - let stream; - await new Promise((resolve, reject) => { - const rejectPromise = (error) => { - // Don't retrieve an oversized buffer. - if ( - error && - stream.getBufferedLength() <= BufferConstants.MAX_LENGTH - ) { - error.bufferedData = stream.getBufferedValue(); + catch (error_) { + error = error_; } - - reject(error); - }; - - stream = pump(inputStream, bufferStream(options), (error) => { - if (error) { - rejectPromise(error); - return; - } - - resolve(); - }); - - stream.on('data', () => { - if (stream.getBufferedLength() > maxBuffer) { - rejectPromise(new MaxBufferError()); - } - }); - }); - - return stream.getBufferedValue(); - } - - module.exports = getStream; - // TODO: Remove this for the next major release - module.exports.default = getStream; - module.exports.buffer = (stream, options) => - getStream(stream, { ...options, encoding: 'buffer' }); - module.exports.array = (stream, options) => - getStream(stream, { ...options, array: true }); - module.exports.MaxBufferError = MaxBufferError; - - /***/ - }, - - /***/ 237: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - var emoji = __nccwpck_require__(5464); - - module.exports = BananaSlug; - - var own = Object.hasOwnProperty; - var whitespace = /\s/g; - var specials = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~’]/g; - - function BananaSlug() { - var self = this; - - if (!(self instanceof BananaSlug)) return new BananaSlug(); - - self.reset(); - } - - /** - * Generate a unique slug. - * @param {string} value String of text to slugify - * @param {boolean} [false] Keep the current case, otherwise make all lowercase - * @return {string} A unique slug string - */ - BananaSlug.prototype.slug = function (value, maintainCase) { - var self = this; - var slug = slugger(value, maintainCase === true); - var originalSlug = slug; - - while (own.call(self.occurrences, slug)) { - self.occurrences[originalSlug]++; - slug = originalSlug + '-' + self.occurrences[originalSlug]; } + throw error; + })(); + const returnPromise = () => promise; + promise.json = returnPromise; + promise.text = returnPromise; + promise.buffer = returnPromise; + promise.on = returnPromise; + return promise; +} +exports.default = createRejection; - self.occurrences[slug] = 0; - return slug; - }; +/***/ }), - /** - * Reset - Forget all previous slugs - * @return void - */ - BananaSlug.prototype.reset = function () { - this.occurrences = Object.create(null); - }; +/***/ 6056: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - function slugger(string, maintainCase) { - if (typeof string !== 'string') return ''; - if (!maintainCase) string = string.toLowerCase(); +"use strict"; - return string - .trim() - .replace(specials, '') - .replace(emoji(), '') - .replace(whitespace, '-'); - } - - BananaSlug.slug = slugger; - - /***/ - }, - - /***/ 5464: /***/ (module) => { - module.exports = function () { - return /[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2694\u2696\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD79\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED0\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3]|\uD83E[\uDD10-\uDD18\uDD80-\uDD84\uDDC0]|\uD83C\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uD83C\uDDFE\uD83C[\uDDEA\uDDF9]|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDFC\uD83C[\uDDEB\uDDF8]|\uD83C\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uD83C\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF8\uDDFE\uDDFF]|\uD83C\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uD83C\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uD83C\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uD83C\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uD83C\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uD83C\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uD83C\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uD83C\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uD83C\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uD83C\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uD83C\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uD83C\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uD83C\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uD83C\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uD83C\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uD83C\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|[#\*0-9]\u20E3/g; - }; - - /***/ - }, - - /***/ 6457: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - const types_1 = __nccwpck_require__(4597); - function createRejection(error, ...beforeErrorGroups) { - const promise = (async () => { - if (error instanceof types_1.RequestError) { - try { - for (const hooks of beforeErrorGroups) { - if (hooks) { - for (const hook of hooks) { - // eslint-disable-next-line no-await-in-loop - error = await hook(error); - } - } - } - } catch (error_) { - error = error_; - } - } - throw error; - })(); - const returnPromise = () => promise; - promise.json = returnPromise; - promise.text = returnPromise; - promise.buffer = returnPromise; - promise.on = returnPromise; - return promise; - } - exports.default = createRejection; - - /***/ - }, - - /***/ 6056: /***/ function ( - __unused_webpack_module, - 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 __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if ( - p !== 'default' && - !Object.prototype.hasOwnProperty.call(exports, p) - ) - __createBinding(exports, m, p); - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const events_1 = __nccwpck_require__(8614); - const is_1 = __nccwpck_require__(7678); - const PCancelable = __nccwpck_require__(9072); - const types_1 = __nccwpck_require__(4597); - const parse_body_1 = __nccwpck_require__(8220); - const core_1 = __nccwpck_require__(94); - const proxy_events_1 = __nccwpck_require__(3021); - const get_buffer_1 = __nccwpck_require__(4500); - const is_response_ok_1 = __nccwpck_require__(9298); - const proxiedRequestEvents = [ - 'request', - 'response', - 'redirect', - 'uploadProgress', - 'downloadProgress', - ]; - function asPromise(normalizedOptions) { - let globalRequest; - let globalResponse; - const emitter = new events_1.EventEmitter(); - const promise = new PCancelable((resolve, reject, onCancel) => { - const makeRequest = (retryCount) => { +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const events_1 = __nccwpck_require__(8614); +const is_1 = __nccwpck_require__(7678); +const PCancelable = __nccwpck_require__(9072); +const types_1 = __nccwpck_require__(4597); +const parse_body_1 = __nccwpck_require__(8220); +const core_1 = __nccwpck_require__(94); +const proxy_events_1 = __nccwpck_require__(3021); +const get_buffer_1 = __nccwpck_require__(4500); +const is_response_ok_1 = __nccwpck_require__(9298); +const proxiedRequestEvents = [ + 'request', + 'response', + 'redirect', + 'uploadProgress', + 'downloadProgress' +]; +function asPromise(normalizedOptions) { + let globalRequest; + let globalResponse; + const emitter = new events_1.EventEmitter(); + const promise = new PCancelable((resolve, reject, onCancel) => { + const makeRequest = (retryCount) => { const request = new core_1.default(undefined, normalizedOptions); request.retryCount = retryCount; request._noPipe = true; @@ -5498,1732 +4808,1334 @@ type DotenvConfigOutput = { onCancel(() => reject(new types_1.CancelError(request))); globalRequest = request; request.once('response', async (response) => { - var _a; - response.retryCount = retryCount; - if (response.request.aborted) { - // Canceled while downloading - will throw a `CancelError` or `TimeoutError` error - return; - } - // Download body - let rawBody; - try { - rawBody = await get_buffer_1.default(request); - response.rawBody = rawBody; - } catch (_b) { - // The same error is caught below. - // See request.once('error') - return; - } - if (request._isAboutToError) { - return; - } - // Parse body - const contentEncoding = ((_a = - response.headers['content-encoding']) !== null && _a !== void 0 - ? _a - : '' - ).toLowerCase(); - const isCompressed = ['gzip', 'deflate', 'br'].includes( - contentEncoding - ); - const { options } = request; - if (isCompressed && !options.decompress) { - response.body = rawBody; - } else { - try { - response.body = parse_body_1.default( - response, - options.responseType, - options.parseJson, - options.encoding - ); - } catch (error) { - // Fallback to `utf8` - response.body = rawBody.toString(); - if (is_response_ok_1.isResponseOk(response)) { - request._beforeError(error); + var _a; + response.retryCount = retryCount; + if (response.request.aborted) { + // Canceled while downloading - will throw a `CancelError` or `TimeoutError` error return; - } } - } - try { - for (const [ - index, - hook, - ] of options.hooks.afterResponse.entries()) { - // @ts-expect-error TS doesn't notice that CancelableRequest is a Promise - // eslint-disable-next-line no-await-in-loop - response = await hook(response, async (updatedOptions) => { - const typedOptions = core_1.default.normalizeArguments( - undefined, - { - ...updatedOptions, - retry: { - calculateDelay: () => 0, - }, - throwHttpErrors: false, - resolveBodyOnly: false, - }, - options - ); - // Remove any further hooks for that request, because we'll call them anyway. - // The loop continues. We don't want duplicates (asPromise recursion). - typedOptions.hooks.afterResponse = typedOptions.hooks.afterResponse.slice( - 0, - index - ); - for (const hook of typedOptions.hooks.beforeRetry) { - // eslint-disable-next-line no-await-in-loop - await hook(typedOptions); + // Download body + let rawBody; + try { + rawBody = await get_buffer_1.default(request); + response.rawBody = rawBody; + } + catch (_b) { + // The same error is caught below. + // See request.once('error') + return; + } + if (request._isAboutToError) { + return; + } + // Parse body + const contentEncoding = ((_a = response.headers['content-encoding']) !== null && _a !== void 0 ? _a : '').toLowerCase(); + const isCompressed = ['gzip', 'deflate', 'br'].includes(contentEncoding); + const { options } = request; + if (isCompressed && !options.decompress) { + response.body = rawBody; + } + else { + try { + response.body = parse_body_1.default(response, options.responseType, options.parseJson, options.encoding); + } + catch (error) { + // Fallback to `utf8` + response.body = rawBody.toString(); + if (is_response_ok_1.isResponseOk(response)) { + request._beforeError(error); + return; + } } - const promise = asPromise(typedOptions); - onCancel(() => { - promise.catch(() => {}); - promise.cancel(); - }); - return promise; - }); } - } catch (error) { - request._beforeError( - new types_1.RequestError(error.message, error, request) - ); - return; - } - if (!is_response_ok_1.isResponseOk(response)) { - request._beforeError(new types_1.HTTPError(response)); - return; - } - globalResponse = response; - resolve( - request.options.resolveBodyOnly ? response.body : response - ); + try { + for (const [index, hook] of options.hooks.afterResponse.entries()) { + // @ts-expect-error TS doesn't notice that CancelableRequest is a Promise + // eslint-disable-next-line no-await-in-loop + response = await hook(response, async (updatedOptions) => { + const typedOptions = core_1.default.normalizeArguments(undefined, { + ...updatedOptions, + retry: { + calculateDelay: () => 0 + }, + throwHttpErrors: false, + resolveBodyOnly: false + }, options); + // Remove any further hooks for that request, because we'll call them anyway. + // The loop continues. We don't want duplicates (asPromise recursion). + typedOptions.hooks.afterResponse = typedOptions.hooks.afterResponse.slice(0, index); + for (const hook of typedOptions.hooks.beforeRetry) { + // eslint-disable-next-line no-await-in-loop + await hook(typedOptions); + } + const promise = asPromise(typedOptions); + onCancel(() => { + promise.catch(() => { }); + promise.cancel(); + }); + return promise; + }); + } + } + catch (error) { + request._beforeError(new types_1.RequestError(error.message, error, request)); + return; + } + if (!is_response_ok_1.isResponseOk(response)) { + request._beforeError(new types_1.HTTPError(response)); + return; + } + globalResponse = response; + resolve(request.options.resolveBodyOnly ? response.body : response); }); const onError = (error) => { - if (promise.isCanceled) { - return; - } - const { options } = request; - if ( - error instanceof types_1.HTTPError && - !options.throwHttpErrors - ) { - const { response } = error; - resolve( - request.options.resolveBodyOnly ? response.body : response - ); - return; - } - reject(error); + if (promise.isCanceled) { + return; + } + const { options } = request; + if (error instanceof types_1.HTTPError && !options.throwHttpErrors) { + const { response } = error; + resolve(request.options.resolveBodyOnly ? response.body : response); + return; + } + reject(error); }; request.once('error', onError); const previousBody = request.options.body; request.once('retry', (newRetryCount, error) => { - var _a, _b; - if ( - previousBody === - ((_a = error.request) === null || _a === void 0 - ? void 0 - : _a.options.body) && - is_1.default.nodeStream( - (_b = error.request) === null || _b === void 0 - ? void 0 - : _b.options.body - ) - ) { - onError(error); - return; - } - makeRequest(newRetryCount); + var _a, _b; + if (previousBody === ((_a = error.request) === null || _a === void 0 ? void 0 : _a.options.body) && is_1.default.nodeStream((_b = error.request) === null || _b === void 0 ? void 0 : _b.options.body)) { + onError(error); + return; + } + makeRequest(newRetryCount); }); proxy_events_1.default(request, emitter, proxiedRequestEvents); - }; - makeRequest(0); - }); - promise.on = (event, fn) => { - emitter.on(event, fn); - return promise; }; - const shortcut = (responseType) => { - const newPromise = (async () => { + makeRequest(0); + }); + promise.on = (event, fn) => { + emitter.on(event, fn); + return promise; + }; + const shortcut = (responseType) => { + const newPromise = (async () => { // Wait until downloading has ended await promise; const { options } = globalResponse.request; - return parse_body_1.default( - globalResponse, - responseType, - options.parseJson, - options.encoding - ); - })(); - Object.defineProperties( - newPromise, - Object.getOwnPropertyDescriptors(promise) - ); - return newPromise; - }; - promise.json = () => { - const { headers } = globalRequest.options; - if (!globalRequest.writableFinished && headers.accept === undefined) { + return parse_body_1.default(globalResponse, responseType, options.parseJson, options.encoding); + })(); + Object.defineProperties(newPromise, Object.getOwnPropertyDescriptors(promise)); + return newPromise; + }; + promise.json = () => { + const { headers } = globalRequest.options; + if (!globalRequest.writableFinished && headers.accept === undefined) { headers.accept = 'application/json'; - } - return shortcut('json'); - }; - promise.buffer = () => shortcut('buffer'); - promise.text = () => shortcut('text'); - return promise; - } - exports.default = asPromise; - __exportStar(__nccwpck_require__(4597), exports); - - /***/ - }, - - /***/ 1048: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - const is_1 = __nccwpck_require__(7678); - const normalizeArguments = (options, defaults) => { - if (is_1.default.null_(options.encoding)) { - throw new TypeError( - 'To get a Buffer, set `options.responseType` to `buffer` instead' - ); } - is_1.assert.any( - [is_1.default.string, is_1.default.undefined], - options.encoding - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.resolveBodyOnly - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.methodRewriting - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.isStream - ); - is_1.assert.any( - [is_1.default.string, is_1.default.undefined], - options.responseType - ); - // `options.responseType` - if (options.responseType === undefined) { - options.responseType = 'text'; - } - // `options.retry` - const { retry } = options; - if (defaults) { - options.retry = { ...defaults.retry }; - } else { - options.retry = { - calculateDelay: (retryObject) => retryObject.computedValue, + return shortcut('json'); + }; + promise.buffer = () => shortcut('buffer'); + promise.text = () => shortcut('text'); + return promise; +} +exports.default = asPromise; +__exportStar(__nccwpck_require__(4597), exports); + + +/***/ }), + +/***/ 1048: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const is_1 = __nccwpck_require__(7678); +const normalizeArguments = (options, defaults) => { + if (is_1.default.null_(options.encoding)) { + throw new TypeError('To get a Buffer, set `options.responseType` to `buffer` instead'); + } + is_1.assert.any([is_1.default.string, is_1.default.undefined], options.encoding); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.resolveBodyOnly); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.methodRewriting); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.isStream); + is_1.assert.any([is_1.default.string, is_1.default.undefined], options.responseType); + // `options.responseType` + if (options.responseType === undefined) { + options.responseType = 'text'; + } + // `options.retry` + const { retry } = options; + if (defaults) { + options.retry = { ...defaults.retry }; + } + else { + options.retry = { + calculateDelay: retryObject => retryObject.computedValue, limit: 0, methods: [], statusCodes: [], errorCodes: [], - maxRetryAfter: undefined, - }; - } - if (is_1.default.object(retry)) { - options.retry = { - ...options.retry, - ...retry, - }; - options.retry.methods = [ - ...new Set( - options.retry.methods.map((method) => method.toUpperCase()) - ), - ]; - options.retry.statusCodes = [...new Set(options.retry.statusCodes)]; - options.retry.errorCodes = [...new Set(options.retry.errorCodes)]; - } else if (is_1.default.number(retry)) { - options.retry.limit = retry; - } - if (is_1.default.undefined(options.retry.maxRetryAfter)) { - options.retry.maxRetryAfter = Math.min( - // TypeScript is not smart enough to handle `.filter(x => is.number(x))`. - // eslint-disable-next-line unicorn/no-fn-reference-in-iterator - ...[options.timeout.request, options.timeout.connect].filter( - is_1.default.number - ) - ); - } - // `options.pagination` - if (is_1.default.object(options.pagination)) { - if (defaults) { - options.pagination = { - ...defaults.pagination, - ...options.pagination, - }; - } - const { pagination } = options; - if (!is_1.default.function_(pagination.transform)) { - throw new Error( - '`options.pagination.transform` must be implemented' - ); - } - if (!is_1.default.function_(pagination.shouldContinue)) { - throw new Error( - '`options.pagination.shouldContinue` must be implemented' - ); - } - if (!is_1.default.function_(pagination.filter)) { - throw new TypeError( - '`options.pagination.filter` must be implemented' - ); - } - if (!is_1.default.function_(pagination.paginate)) { - throw new Error( - '`options.pagination.paginate` must be implemented' - ); - } - } - // JSON mode - if ( - options.responseType === 'json' && - options.headers.accept === undefined - ) { - options.headers.accept = 'application/json'; - } - return options; - }; - exports.default = normalizeArguments; - - /***/ - }, - - /***/ 8220: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - const types_1 = __nccwpck_require__(4597); - const parseBody = (response, responseType, parseJson, encoding) => { - const { rawBody } = response; - try { - if (responseType === 'text') { - return rawBody.toString(encoding); - } - if (responseType === 'json') { - return rawBody.length === 0 ? '' : parseJson(rawBody.toString()); - } - if (responseType === 'buffer') { - return rawBody; - } - throw new types_1.ParseError( - { - message: `Unknown body type '${responseType}'`, - name: 'Error', - }, - response - ); - } catch (error) { - throw new types_1.ParseError(error, response); - } - }; - exports.default = parseBody; - - /***/ - }, - - /***/ 4597: /***/ function ( - __unused_webpack_module, - 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 __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if ( - p !== 'default' && - !Object.prototype.hasOwnProperty.call(exports, p) - ) - __createBinding(exports, m, p); + maxRetryAfter: undefined }; - Object.defineProperty(exports, '__esModule', { value: true }); - exports.CancelError = exports.ParseError = void 0; - const core_1 = __nccwpck_require__(94); - /** + } + if (is_1.default.object(retry)) { + options.retry = { + ...options.retry, + ...retry + }; + options.retry.methods = [...new Set(options.retry.methods.map(method => method.toUpperCase()))]; + options.retry.statusCodes = [...new Set(options.retry.statusCodes)]; + options.retry.errorCodes = [...new Set(options.retry.errorCodes)]; + } + else if (is_1.default.number(retry)) { + options.retry.limit = retry; + } + if (is_1.default.undefined(options.retry.maxRetryAfter)) { + options.retry.maxRetryAfter = Math.min( + // TypeScript is not smart enough to handle `.filter(x => is.number(x))`. + // eslint-disable-next-line unicorn/no-fn-reference-in-iterator + ...[options.timeout.request, options.timeout.connect].filter(is_1.default.number)); + } + // `options.pagination` + if (is_1.default.object(options.pagination)) { + if (defaults) { + options.pagination = { + ...defaults.pagination, + ...options.pagination + }; + } + const { pagination } = options; + if (!is_1.default.function_(pagination.transform)) { + throw new Error('`options.pagination.transform` must be implemented'); + } + if (!is_1.default.function_(pagination.shouldContinue)) { + throw new Error('`options.pagination.shouldContinue` must be implemented'); + } + if (!is_1.default.function_(pagination.filter)) { + throw new TypeError('`options.pagination.filter` must be implemented'); + } + if (!is_1.default.function_(pagination.paginate)) { + throw new Error('`options.pagination.paginate` must be implemented'); + } + } + // JSON mode + if (options.responseType === 'json' && options.headers.accept === undefined) { + options.headers.accept = 'application/json'; + } + return options; +}; +exports.default = normalizeArguments; + + +/***/ }), + +/***/ 8220: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const types_1 = __nccwpck_require__(4597); +const parseBody = (response, responseType, parseJson, encoding) => { + const { rawBody } = response; + try { + if (responseType === 'text') { + return rawBody.toString(encoding); + } + if (responseType === 'json') { + return rawBody.length === 0 ? '' : parseJson(rawBody.toString()); + } + if (responseType === 'buffer') { + return rawBody; + } + throw new types_1.ParseError({ + message: `Unknown body type '${responseType}'`, + name: 'Error' + }, response); + } + catch (error) { + throw new types_1.ParseError(error, response); + } +}; +exports.default = parseBody; + + +/***/ }), + +/***/ 4597: +/***/ (function(__unused_webpack_module, 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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CancelError = exports.ParseError = void 0; +const core_1 = __nccwpck_require__(94); +/** An error to be thrown when server response code is 2xx, and parsing body fails. Includes a `response` property. */ - class ParseError extends core_1.RequestError { - constructor(error, response) { - const { options } = response.request; - super( - `${error.message} in "${options.url.toString()}"`, - error, - response.request - ); - this.name = 'ParseError'; - } - } - exports.ParseError = ParseError; - /** +class ParseError extends core_1.RequestError { + constructor(error, response) { + const { options } = response.request; + super(`${error.message} in "${options.url.toString()}"`, error, response.request); + this.name = 'ParseError'; + } +} +exports.ParseError = ParseError; +/** An error to be thrown when the request is aborted with `.cancel()`. */ - class CancelError extends core_1.RequestError { - constructor(request) { - super('Promise was canceled', {}, request); - this.name = 'CancelError'; - } - get isCanceled() { - return true; - } - } - exports.CancelError = CancelError; - __exportStar(__nccwpck_require__(94), exports); +class CancelError extends core_1.RequestError { + constructor(request) { + super('Promise was canceled', {}, request); + this.name = 'CancelError'; + } + get isCanceled() { + return true; + } +} +exports.CancelError = CancelError; +__exportStar(__nccwpck_require__(94), exports); - /***/ - }, - /***/ 3462: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - exports.retryAfterStatusCodes = void 0; - exports.retryAfterStatusCodes = new Set([413, 429, 503]); - const calculateRetryDelay = ({ - attemptCount, - retryOptions, - error, - retryAfter, - }) => { - if (attemptCount > retryOptions.limit) { - return 0; - } - const hasMethod = retryOptions.methods.includes(error.options.method); - const hasErrorCode = retryOptions.errorCodes.includes(error.code); - const hasStatusCode = - error.response && - retryOptions.statusCodes.includes(error.response.statusCode); - if (!hasMethod || (!hasErrorCode && !hasStatusCode)) { - return 0; - } - if (error.response) { - if (retryAfter) { - if ( - retryOptions.maxRetryAfter === undefined || - retryAfter > retryOptions.maxRetryAfter - ) { - return 0; +/***/ 3462: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.retryAfterStatusCodes = void 0; +exports.retryAfterStatusCodes = new Set([413, 429, 503]); +const calculateRetryDelay = ({ attemptCount, retryOptions, error, retryAfter }) => { + if (attemptCount > retryOptions.limit) { + return 0; + } + const hasMethod = retryOptions.methods.includes(error.options.method); + const hasErrorCode = retryOptions.errorCodes.includes(error.code); + const hasStatusCode = error.response && retryOptions.statusCodes.includes(error.response.statusCode); + if (!hasMethod || (!hasErrorCode && !hasStatusCode)) { + return 0; + } + if (error.response) { + if (retryAfter) { + if (retryOptions.maxRetryAfter === undefined || retryAfter > retryOptions.maxRetryAfter) { + return 0; } return retryAfter; - } - if (error.response.statusCode === 413) { + } + if (error.response.statusCode === 413) { return 0; - } } - const noise = Math.random() * 100; - return 2 ** (attemptCount - 1) * 1000 + noise; - }; - exports.default = calculateRetryDelay; + } + const noise = Math.random() * 100; + return ((2 ** (attemptCount - 1)) * 1000) + noise; +}; +exports.default = calculateRetryDelay; - /***/ - }, - /***/ 94: /***/ (__unused_webpack_module, exports, __nccwpck_require__) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - exports.UnsupportedProtocolError = exports.ReadError = exports.TimeoutError = exports.UploadError = exports.CacheError = exports.HTTPError = exports.MaxRedirectsError = exports.RequestError = exports.setNonEnumerableProperties = exports.knownHookEvents = exports.withoutBody = exports.kIsNormalizedAlready = void 0; - const util_1 = __nccwpck_require__(1669); - const stream_1 = __nccwpck_require__(2413); - const fs_1 = __nccwpck_require__(5747); - const url_1 = __nccwpck_require__(8835); - const http = __nccwpck_require__(8605); - const http_1 = __nccwpck_require__(8605); - const https = __nccwpck_require__(7211); - const http_timer_1 = __nccwpck_require__(8097); - const cacheable_lookup_1 = __nccwpck_require__(2286); - const CacheableRequest = __nccwpck_require__(8116); - const decompressResponse = __nccwpck_require__(2391); - // @ts-expect-error Missing types - const http2wrapper = __nccwpck_require__(4645); - const lowercaseKeys = __nccwpck_require__(9662); - const is_1 = __nccwpck_require__(7678); - const get_body_size_1 = __nccwpck_require__(4564); - const is_form_data_1 = __nccwpck_require__(40); - const proxy_events_1 = __nccwpck_require__(3021); - const timed_out_1 = __nccwpck_require__(2454); - const url_to_options_1 = __nccwpck_require__(8026); - const options_to_url_1 = __nccwpck_require__(9219); - const weakable_map_1 = __nccwpck_require__(7288); - const get_buffer_1 = __nccwpck_require__(4500); - const dns_ip_version_1 = __nccwpck_require__(4993); - const is_response_ok_1 = __nccwpck_require__(9298); - const deprecation_warning_1 = __nccwpck_require__(397); - const normalize_arguments_1 = __nccwpck_require__(1048); - const calculate_retry_delay_1 = __nccwpck_require__(3462); - const globalDnsCache = new cacheable_lookup_1.default(); - const kRequest = Symbol('request'); - const kResponse = Symbol('response'); - const kResponseSize = Symbol('responseSize'); - const kDownloadedSize = Symbol('downloadedSize'); - const kBodySize = Symbol('bodySize'); - const kUploadedSize = Symbol('uploadedSize'); - const kServerResponsesPiped = Symbol('serverResponsesPiped'); - const kUnproxyEvents = Symbol('unproxyEvents'); - const kIsFromCache = Symbol('isFromCache'); - const kCancelTimeouts = Symbol('cancelTimeouts'); - const kStartedReading = Symbol('startedReading'); - const kStopReading = Symbol('stopReading'); - const kTriggerRead = Symbol('triggerRead'); - const kBody = Symbol('body'); - const kJobs = Symbol('jobs'); - const kOriginalResponse = Symbol('originalResponse'); - const kRetryTimeout = Symbol('retryTimeout'); - exports.kIsNormalizedAlready = Symbol('isNormalizedAlready'); - const supportsBrotli = is_1.default.string(process.versions.brotli); - exports.withoutBody = new Set(['GET', 'HEAD']); - exports.knownHookEvents = [ - 'init', - 'beforeRequest', - 'beforeRedirect', - 'beforeError', - 'beforeRetry', - // Promise-Only - 'afterResponse', - ]; - function validateSearchParameters(searchParameters) { - // eslint-disable-next-line guard-for-in - for (const key in searchParameters) { - const value = searchParameters[key]; - if ( - !is_1.default.string(value) && - !is_1.default.number(value) && - !is_1.default.boolean(value) && - !is_1.default.null_(value) && - !is_1.default.undefined(value) - ) { - throw new TypeError( - `The \`searchParams\` value '${String( - value - )}' must be a string, number, boolean or null` - ); - } +/***/ 94: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.UnsupportedProtocolError = exports.ReadError = exports.TimeoutError = exports.UploadError = exports.CacheError = exports.HTTPError = exports.MaxRedirectsError = exports.RequestError = exports.setNonEnumerableProperties = exports.knownHookEvents = exports.withoutBody = exports.kIsNormalizedAlready = void 0; +const util_1 = __nccwpck_require__(1669); +const stream_1 = __nccwpck_require__(2413); +const fs_1 = __nccwpck_require__(5747); +const url_1 = __nccwpck_require__(8835); +const http = __nccwpck_require__(8605); +const http_1 = __nccwpck_require__(8605); +const https = __nccwpck_require__(7211); +const http_timer_1 = __nccwpck_require__(8097); +const cacheable_lookup_1 = __nccwpck_require__(2286); +const CacheableRequest = __nccwpck_require__(8116); +const decompressResponse = __nccwpck_require__(2391); +// @ts-expect-error Missing types +const http2wrapper = __nccwpck_require__(4645); +const lowercaseKeys = __nccwpck_require__(9662); +const is_1 = __nccwpck_require__(7678); +const get_body_size_1 = __nccwpck_require__(4564); +const is_form_data_1 = __nccwpck_require__(40); +const proxy_events_1 = __nccwpck_require__(3021); +const timed_out_1 = __nccwpck_require__(2454); +const url_to_options_1 = __nccwpck_require__(8026); +const options_to_url_1 = __nccwpck_require__(9219); +const weakable_map_1 = __nccwpck_require__(7288); +const get_buffer_1 = __nccwpck_require__(4500); +const dns_ip_version_1 = __nccwpck_require__(4993); +const is_response_ok_1 = __nccwpck_require__(9298); +const deprecation_warning_1 = __nccwpck_require__(397); +const normalize_arguments_1 = __nccwpck_require__(1048); +const calculate_retry_delay_1 = __nccwpck_require__(3462); +const globalDnsCache = new cacheable_lookup_1.default(); +const kRequest = Symbol('request'); +const kResponse = Symbol('response'); +const kResponseSize = Symbol('responseSize'); +const kDownloadedSize = Symbol('downloadedSize'); +const kBodySize = Symbol('bodySize'); +const kUploadedSize = Symbol('uploadedSize'); +const kServerResponsesPiped = Symbol('serverResponsesPiped'); +const kUnproxyEvents = Symbol('unproxyEvents'); +const kIsFromCache = Symbol('isFromCache'); +const kCancelTimeouts = Symbol('cancelTimeouts'); +const kStartedReading = Symbol('startedReading'); +const kStopReading = Symbol('stopReading'); +const kTriggerRead = Symbol('triggerRead'); +const kBody = Symbol('body'); +const kJobs = Symbol('jobs'); +const kOriginalResponse = Symbol('originalResponse'); +const kRetryTimeout = Symbol('retryTimeout'); +exports.kIsNormalizedAlready = Symbol('isNormalizedAlready'); +const supportsBrotli = is_1.default.string(process.versions.brotli); +exports.withoutBody = new Set(['GET', 'HEAD']); +exports.knownHookEvents = [ + 'init', + 'beforeRequest', + 'beforeRedirect', + 'beforeError', + 'beforeRetry', + // Promise-Only + 'afterResponse' +]; +function validateSearchParameters(searchParameters) { + // eslint-disable-next-line guard-for-in + for (const key in searchParameters) { + const value = searchParameters[key]; + if (!is_1.default.string(value) && !is_1.default.number(value) && !is_1.default.boolean(value) && !is_1.default.null_(value) && !is_1.default.undefined(value)) { + throw new TypeError(`The \`searchParams\` value '${String(value)}' must be a string, number, boolean or null`); } - } - function isClientRequest(clientRequest) { - return ( - is_1.default.object(clientRequest) && !('statusCode' in clientRequest) - ); - } - const cacheableStore = new weakable_map_1.default(); - const waitForOpenFile = async (file) => - new Promise((resolve, reject) => { - const onError = (error) => { - reject(error); - }; - // Node.js 12 has incomplete types - if (!file.pending) { - resolve(); - } - file.once('error', onError); - file.once('ready', () => { - file.off('error', onError); - resolve(); - }); - }); - const redirectCodes = new Set([300, 301, 302, 303, 304, 307, 308]); - const nonEnumerableProperties = ['context', 'body', 'json', 'form']; - exports.setNonEnumerableProperties = (sources, to) => { - // Non enumerable properties shall not be merged - const properties = {}; - for (const source of sources) { - if (!source) { + } +} +function isClientRequest(clientRequest) { + return is_1.default.object(clientRequest) && !('statusCode' in clientRequest); +} +const cacheableStore = new weakable_map_1.default(); +const waitForOpenFile = async (file) => new Promise((resolve, reject) => { + const onError = (error) => { + reject(error); + }; + // Node.js 12 has incomplete types + if (!file.pending) { + resolve(); + } + file.once('error', onError); + file.once('ready', () => { + file.off('error', onError); + resolve(); + }); +}); +const redirectCodes = new Set([300, 301, 302, 303, 304, 307, 308]); +const nonEnumerableProperties = [ + 'context', + 'body', + 'json', + 'form' +]; +exports.setNonEnumerableProperties = (sources, to) => { + // Non enumerable properties shall not be merged + const properties = {}; + for (const source of sources) { + if (!source) { continue; - } - for (const name of nonEnumerableProperties) { + } + for (const name of nonEnumerableProperties) { if (!(name in source)) { - continue; + continue; } properties[name] = { - writable: true, - configurable: true, - enumerable: false, - // @ts-expect-error TS doesn't see the check above - value: source[name], + writable: true, + configurable: true, + enumerable: false, + // @ts-expect-error TS doesn't see the check above + value: source[name] }; - } } - Object.defineProperties(to, properties); - }; - /** + } + Object.defineProperties(to, properties); +}; +/** An error to be thrown when a request fails. Contains a `code` property with error class code, like `ECONNREFUSED`. */ - class RequestError extends Error { - constructor(message, error, self) { - var _a; - super(message); - Error.captureStackTrace(this, this.constructor); - this.name = 'RequestError'; - this.code = error.code; - if (self instanceof Request) { +class RequestError extends Error { + constructor(message, error, self) { + var _a; + super(message); + Error.captureStackTrace(this, this.constructor); + this.name = 'RequestError'; + this.code = error.code; + if (self instanceof Request) { Object.defineProperty(this, 'request', { - enumerable: false, - value: self, + enumerable: false, + value: self }); Object.defineProperty(this, 'response', { - enumerable: false, - value: self[kResponse], + enumerable: false, + value: self[kResponse] }); Object.defineProperty(this, 'options', { - // This fails because of TS 3.7.2 useDefineForClassFields - // Ref: https://github.com/microsoft/TypeScript/issues/34972 - enumerable: false, - value: self.options, + // This fails because of TS 3.7.2 useDefineForClassFields + // Ref: https://github.com/microsoft/TypeScript/issues/34972 + enumerable: false, + value: self.options }); - } else { - Object.defineProperty(this, 'options', { - // This fails because of TS 3.7.2 useDefineForClassFields - // Ref: https://github.com/microsoft/TypeScript/issues/34972 - enumerable: false, - value: self, - }); - } - this.timings = - (_a = this.request) === null || _a === void 0 ? void 0 : _a.timings; - // Recover the original stacktrace - if ( - is_1.default.string(error.stack) && - is_1.default.string(this.stack) - ) { - const indexOfMessage = - this.stack.indexOf(this.message) + this.message.length; - const thisStackTrace = this.stack - .slice(indexOfMessage) - .split('\n') - .reverse(); - const errorStackTrace = error.stack - .slice(error.stack.indexOf(error.message) + error.message.length) - .split('\n') - .reverse(); - // Remove duplicated traces - while ( - errorStackTrace.length !== 0 && - errorStackTrace[0] === thisStackTrace[0] - ) { - thisStackTrace.shift(); - } - this.stack = `${this.stack.slice( - 0, - indexOfMessage - )}${thisStackTrace - .reverse() - .join('\n')}${errorStackTrace.reverse().join('\n')}`; - } } - } - exports.RequestError = RequestError; - /** + else { + Object.defineProperty(this, 'options', { + // This fails because of TS 3.7.2 useDefineForClassFields + // Ref: https://github.com/microsoft/TypeScript/issues/34972 + enumerable: false, + value: self + }); + } + this.timings = (_a = this.request) === null || _a === void 0 ? void 0 : _a.timings; + // Recover the original stacktrace + if (is_1.default.string(error.stack) && is_1.default.string(this.stack)) { + const indexOfMessage = this.stack.indexOf(this.message) + this.message.length; + const thisStackTrace = this.stack.slice(indexOfMessage).split('\n').reverse(); + const errorStackTrace = error.stack.slice(error.stack.indexOf(error.message) + error.message.length).split('\n').reverse(); + // Remove duplicated traces + while (errorStackTrace.length !== 0 && errorStackTrace[0] === thisStackTrace[0]) { + thisStackTrace.shift(); + } + this.stack = `${this.stack.slice(0, indexOfMessage)}${thisStackTrace.reverse().join('\n')}${errorStackTrace.reverse().join('\n')}`; + } + } +} +exports.RequestError = RequestError; +/** An error to be thrown when the server redirects you more than ten times. Includes a `response` property. */ - class MaxRedirectsError extends RequestError { - constructor(request) { - super( - `Redirected ${request.options.maxRedirects} times. Aborting.`, - {}, - request - ); - this.name = 'MaxRedirectsError'; - } - } - exports.MaxRedirectsError = MaxRedirectsError; - /** +class MaxRedirectsError extends RequestError { + constructor(request) { + super(`Redirected ${request.options.maxRedirects} times. Aborting.`, {}, request); + this.name = 'MaxRedirectsError'; + } +} +exports.MaxRedirectsError = MaxRedirectsError; +/** An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304. Includes a `response` property. */ - class HTTPError extends RequestError { - constructor(response) { - super( - `Response code ${response.statusCode} (${response.statusMessage})`, - {}, - response.request - ); - this.name = 'HTTPError'; - } - } - exports.HTTPError = HTTPError; - /** +class HTTPError extends RequestError { + constructor(response) { + super(`Response code ${response.statusCode} (${response.statusMessage})`, {}, response.request); + this.name = 'HTTPError'; + } +} +exports.HTTPError = HTTPError; +/** An error to be thrown when a cache method fails. For example, if the database goes down or there's a filesystem error. */ - class CacheError extends RequestError { - constructor(error, request) { - super(error.message, error, request); - this.name = 'CacheError'; - } - } - exports.CacheError = CacheError; - /** +class CacheError extends RequestError { + constructor(error, request) { + super(error.message, error, request); + this.name = 'CacheError'; + } +} +exports.CacheError = CacheError; +/** An error to be thrown when the request body is a stream and an error occurs while reading from that stream. */ - class UploadError extends RequestError { - constructor(error, request) { - super(error.message, error, request); - this.name = 'UploadError'; - } - } - exports.UploadError = UploadError; - /** +class UploadError extends RequestError { + constructor(error, request) { + super(error.message, error, request); + this.name = 'UploadError'; + } +} +exports.UploadError = UploadError; +/** An error to be thrown when the request is aborted due to a timeout. Includes an `event` and `timings` property. */ - class TimeoutError extends RequestError { - constructor(error, timings, request) { - super(error.message, error, request); - this.name = 'TimeoutError'; - this.event = error.event; - this.timings = timings; - } - } - exports.TimeoutError = TimeoutError; - /** +class TimeoutError extends RequestError { + constructor(error, timings, request) { + super(error.message, error, request); + this.name = 'TimeoutError'; + this.event = error.event; + this.timings = timings; + } +} +exports.TimeoutError = TimeoutError; +/** An error to be thrown when reading from response stream fails. */ - class ReadError extends RequestError { - constructor(error, request) { - super(error.message, error, request); - this.name = 'ReadError'; - } - } - exports.ReadError = ReadError; - /** +class ReadError extends RequestError { + constructor(error, request) { + super(error.message, error, request); + this.name = 'ReadError'; + } +} +exports.ReadError = ReadError; +/** An error to be thrown when given an unsupported protocol. */ - class UnsupportedProtocolError extends RequestError { - constructor(options) { - super(`Unsupported protocol "${options.url.protocol}"`, {}, options); - this.name = 'UnsupportedProtocolError'; - } - } - exports.UnsupportedProtocolError = UnsupportedProtocolError; - const proxiedRequestEvents = [ - 'socket', - 'connect', - 'continue', - 'information', - 'upgrade', - 'timeout', - ]; - class Request extends stream_1.Duplex { - constructor(url, options = {}, defaults) { - super({ +class UnsupportedProtocolError extends RequestError { + constructor(options) { + super(`Unsupported protocol "${options.url.protocol}"`, {}, options); + this.name = 'UnsupportedProtocolError'; + } +} +exports.UnsupportedProtocolError = UnsupportedProtocolError; +const proxiedRequestEvents = [ + 'socket', + 'connect', + 'continue', + 'information', + 'upgrade', + 'timeout' +]; +class Request extends stream_1.Duplex { + constructor(url, options = {}, defaults) { + super({ // This must be false, to enable throwing after destroy // It is used for retry logic in Promise API autoDestroy: false, // It needs to be zero because we're just proxying the data to another stream - highWaterMark: 0, - }); - this[kDownloadedSize] = 0; - this[kUploadedSize] = 0; - this.requestInitialized = false; - this[kServerResponsesPiped] = new Set(); - this.redirects = []; - this[kStopReading] = false; - this[kTriggerRead] = false; - this[kJobs] = []; - this.retryCount = 0; - // TODO: Remove this when targeting Node.js >= 12 - this._progressCallbacks = []; - const unlockWrite = () => this._unlockWrite(); - const lockWrite = () => this._lockWrite(); - this.on('pipe', (source) => { + highWaterMark: 0 + }); + this[kDownloadedSize] = 0; + this[kUploadedSize] = 0; + this.requestInitialized = false; + this[kServerResponsesPiped] = new Set(); + this.redirects = []; + this[kStopReading] = false; + this[kTriggerRead] = false; + this[kJobs] = []; + this.retryCount = 0; + // TODO: Remove this when targeting Node.js >= 12 + this._progressCallbacks = []; + const unlockWrite = () => this._unlockWrite(); + const lockWrite = () => this._lockWrite(); + this.on('pipe', (source) => { source.prependListener('data', unlockWrite); source.on('data', lockWrite); source.prependListener('end', unlockWrite); source.on('end', lockWrite); - }); - this.on('unpipe', (source) => { + }); + this.on('unpipe', (source) => { source.off('data', unlockWrite); source.off('data', lockWrite); source.off('end', unlockWrite); source.off('end', lockWrite); - }); - this.on('pipe', (source) => { + }); + this.on('pipe', source => { if (source instanceof http_1.IncomingMessage) { - this.options.headers = { - ...source.headers, - ...this.options.headers, - }; + this.options.headers = { + ...source.headers, + ...this.options.headers + }; } - }); - const { json, body, form } = options; - if (json || body || form) { + }); + const { json, body, form } = options; + if (json || body || form) { this._lockWrite(); - } - if (exports.kIsNormalizedAlready in options) { + } + if (exports.kIsNormalizedAlready in options) { this.options = options; - } else { + } + else { try { - // @ts-expect-error Common TypeScript bug saying that `this.constructor` is not accessible - this.options = this.constructor.normalizeArguments( - url, - options, - defaults - ); - } catch (error) { - // TODO: Move this to `_destroy()` - if (is_1.default.nodeStream(options.body)) { - options.body.destroy(); - } - this.destroy(error); - return; + // @ts-expect-error Common TypeScript bug saying that `this.constructor` is not accessible + this.options = this.constructor.normalizeArguments(url, options, defaults); } - } - (async () => { + catch (error) { + // TODO: Move this to `_destroy()` + if (is_1.default.nodeStream(options.body)) { + options.body.destroy(); + } + this.destroy(error); + return; + } + } + (async () => { var _a; try { - if (this.options.body instanceof fs_1.ReadStream) { - await waitForOpenFile(this.options.body); - } - const { url: normalizedURL } = this.options; - if (!normalizedURL) { - throw new TypeError('Missing `url` property'); - } - this.requestUrl = normalizedURL.toString(); - decodeURI(this.requestUrl); - await this._finalizeBody(); - await this._makeRequest(); - if (this.destroyed) { - (_a = this[kRequest]) === null || _a === void 0 - ? void 0 - : _a.destroy(); - return; - } - // Queued writes etc. - for (const job of this[kJobs]) { - job(); - } - // Prevent memory leak - this[kJobs].length = 0; - this.requestInitialized = true; - } catch (error) { - if (error instanceof RequestError) { - this._beforeError(error); - return; - } - // This is a workaround for https://github.com/nodejs/node/issues/33335 - if (!this.destroyed) { - this.destroy(error); - } + if (this.options.body instanceof fs_1.ReadStream) { + await waitForOpenFile(this.options.body); + } + const { url: normalizedURL } = this.options; + if (!normalizedURL) { + throw new TypeError('Missing `url` property'); + } + this.requestUrl = normalizedURL.toString(); + decodeURI(this.requestUrl); + await this._finalizeBody(); + await this._makeRequest(); + if (this.destroyed) { + (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroy(); + return; + } + // Queued writes etc. + for (const job of this[kJobs]) { + job(); + } + // Prevent memory leak + this[kJobs].length = 0; + this.requestInitialized = true; } - })(); - } - static normalizeArguments(url, options, defaults) { - var _a, _b, _c, _d, _e; - const rawOptions = options; - if (is_1.default.object(url) && !is_1.default.urlInstance(url)) { + catch (error) { + if (error instanceof RequestError) { + this._beforeError(error); + return; + } + // This is a workaround for https://github.com/nodejs/node/issues/33335 + if (!this.destroyed) { + this.destroy(error); + } + } + })(); + } + static normalizeArguments(url, options, defaults) { + var _a, _b, _c, _d, _e; + const rawOptions = options; + if (is_1.default.object(url) && !is_1.default.urlInstance(url)) { options = { ...defaults, ...url, ...options }; - } else { + } + else { if (url && options && options.url !== undefined) { - throw new TypeError( - 'The `url` option is mutually exclusive with the `input` argument' - ); + throw new TypeError('The `url` option is mutually exclusive with the `input` argument'); } options = { ...defaults, ...options }; if (url !== undefined) { - options.url = url; + options.url = url; } if (is_1.default.urlInstance(options.url)) { - options.url = new url_1.URL(options.url.toString()); + options.url = new url_1.URL(options.url.toString()); } - } - // TODO: Deprecate URL options in Got 12. - // Support extend-specific options - if (options.cache === false) { + } + // TODO: Deprecate URL options in Got 12. + // Support extend-specific options + if (options.cache === false) { options.cache = undefined; - } - if (options.dnsCache === false) { + } + if (options.dnsCache === false) { options.dnsCache = undefined; - } - // Nice type assertions - is_1.assert.any( - [is_1.default.string, is_1.default.undefined], - options.method - ); - is_1.assert.any( - [is_1.default.object, is_1.default.undefined], - options.headers - ); - is_1.assert.any( - [ - is_1.default.string, - is_1.default.urlInstance, - is_1.default.undefined, - ], - options.prefixUrl - ); - is_1.assert.any( - [is_1.default.object, is_1.default.undefined], - options.cookieJar - ); - is_1.assert.any( - [is_1.default.object, is_1.default.string, is_1.default.undefined], - options.searchParams - ); - is_1.assert.any( - [is_1.default.object, is_1.default.string, is_1.default.undefined], - options.cache - ); - is_1.assert.any( - [is_1.default.object, is_1.default.number, is_1.default.undefined], - options.timeout - ); - is_1.assert.any( - [is_1.default.object, is_1.default.undefined], - options.context - ); - is_1.assert.any( - [is_1.default.object, is_1.default.undefined], - options.hooks - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.decompress - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.ignoreInvalidCookies - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.followRedirect - ); - is_1.assert.any( - [is_1.default.number, is_1.default.undefined], - options.maxRedirects - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.throwHttpErrors - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.http2 - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.allowGetBody - ); - is_1.assert.any( - [is_1.default.string, is_1.default.undefined], - options.localAddress - ); - is_1.assert.any( - [dns_ip_version_1.isDnsLookupIpVersion, is_1.default.undefined], - options.dnsLookupIpVersion - ); - is_1.assert.any( - [is_1.default.object, is_1.default.undefined], - options.https - ); - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.rejectUnauthorized - ); - if (options.https) { - is_1.assert.any( - [is_1.default.boolean, is_1.default.undefined], - options.https.rejectUnauthorized - ); - is_1.assert.any( - [is_1.default.function_, is_1.default.undefined], - options.https.checkServerIdentity - ); - is_1.assert.any( - [ - is_1.default.string, - is_1.default.object, - is_1.default.array, - is_1.default.undefined, - ], - options.https.certificateAuthority - ); - is_1.assert.any( - [ - is_1.default.string, - is_1.default.object, - is_1.default.array, - is_1.default.undefined, - ], - options.https.key - ); - is_1.assert.any( - [ - is_1.default.string, - is_1.default.object, - is_1.default.array, - is_1.default.undefined, - ], - options.https.certificate - ); - is_1.assert.any( - [is_1.default.string, is_1.default.undefined], - options.https.passphrase - ); - is_1.assert.any( - [ - is_1.default.string, - is_1.default.buffer, - is_1.default.array, - is_1.default.undefined, - ], - options.https.pfx - ); - } - is_1.assert.any( - [is_1.default.object, is_1.default.undefined], - options.cacheOptions - ); - // `options.method` - if (is_1.default.string(options.method)) { + } + // Nice type assertions + is_1.assert.any([is_1.default.string, is_1.default.undefined], options.method); + is_1.assert.any([is_1.default.object, is_1.default.undefined], options.headers); + is_1.assert.any([is_1.default.string, is_1.default.urlInstance, is_1.default.undefined], options.prefixUrl); + is_1.assert.any([is_1.default.object, is_1.default.undefined], options.cookieJar); + is_1.assert.any([is_1.default.object, is_1.default.string, is_1.default.undefined], options.searchParams); + is_1.assert.any([is_1.default.object, is_1.default.string, is_1.default.undefined], options.cache); + is_1.assert.any([is_1.default.object, is_1.default.number, is_1.default.undefined], options.timeout); + is_1.assert.any([is_1.default.object, is_1.default.undefined], options.context); + is_1.assert.any([is_1.default.object, is_1.default.undefined], options.hooks); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.decompress); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.ignoreInvalidCookies); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.followRedirect); + is_1.assert.any([is_1.default.number, is_1.default.undefined], options.maxRedirects); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.throwHttpErrors); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.http2); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.allowGetBody); + is_1.assert.any([is_1.default.string, is_1.default.undefined], options.localAddress); + is_1.assert.any([dns_ip_version_1.isDnsLookupIpVersion, is_1.default.undefined], options.dnsLookupIpVersion); + is_1.assert.any([is_1.default.object, is_1.default.undefined], options.https); + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.rejectUnauthorized); + if (options.https) { + is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.https.rejectUnauthorized); + is_1.assert.any([is_1.default.function_, is_1.default.undefined], options.https.checkServerIdentity); + is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.certificateAuthority); + is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.key); + is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.certificate); + is_1.assert.any([is_1.default.string, is_1.default.undefined], options.https.passphrase); + is_1.assert.any([is_1.default.string, is_1.default.buffer, is_1.default.array, is_1.default.undefined], options.https.pfx); + } + is_1.assert.any([is_1.default.object, is_1.default.undefined], options.cacheOptions); + // `options.method` + if (is_1.default.string(options.method)) { options.method = options.method.toUpperCase(); - } else { + } + else { options.method = 'GET'; - } - // `options.headers` - if ( - options.headers === - (defaults === null || defaults === void 0 - ? void 0 - : defaults.headers) - ) { + } + // `options.headers` + if (options.headers === (defaults === null || defaults === void 0 ? void 0 : defaults.headers)) { options.headers = { ...options.headers }; - } else { - options.headers = lowercaseKeys({ - ...(defaults === null || defaults === void 0 - ? void 0 - : defaults.headers), - ...options.headers, - }); - } - // Disallow legacy `url.Url` - if ('slashes' in options) { - throw new TypeError( - 'The legacy `url.Url` has been deprecated. Use `URL` instead.' - ); - } - // `options.auth` - if ('auth' in options) { - throw new TypeError( - 'Parameter `auth` is deprecated. Use `username` / `password` instead.' - ); - } - // `options.searchParams` - if ('searchParams' in options) { - if ( - options.searchParams && - options.searchParams !== - (defaults === null || defaults === void 0 - ? void 0 - : defaults.searchParams) - ) { - let searchParameters; - if ( - is_1.default.string(options.searchParams) || - options.searchParams instanceof url_1.URLSearchParams - ) { - searchParameters = new url_1.URLSearchParams( - options.searchParams - ); - } else { - validateSearchParameters(options.searchParams); - searchParameters = new url_1.URLSearchParams(); - // eslint-disable-next-line guard-for-in - for (const key in options.searchParams) { - const value = options.searchParams[key]; - if (value === null) { - searchParameters.append(key, ''); - } else if (value !== undefined) { - searchParameters.append(key, value); - } + } + else { + options.headers = lowercaseKeys({ ...(defaults === null || defaults === void 0 ? void 0 : defaults.headers), ...options.headers }); + } + // Disallow legacy `url.Url` + if ('slashes' in options) { + throw new TypeError('The legacy `url.Url` has been deprecated. Use `URL` instead.'); + } + // `options.auth` + if ('auth' in options) { + throw new TypeError('Parameter `auth` is deprecated. Use `username` / `password` instead.'); + } + // `options.searchParams` + if ('searchParams' in options) { + if (options.searchParams && options.searchParams !== (defaults === null || defaults === void 0 ? void 0 : defaults.searchParams)) { + let searchParameters; + if (is_1.default.string(options.searchParams) || (options.searchParams instanceof url_1.URLSearchParams)) { + searchParameters = new url_1.URLSearchParams(options.searchParams); } - } - // `normalizeArguments()` is also used to merge options - (_a = - defaults === null || defaults === void 0 - ? void 0 - : defaults.searchParams) === null || _a === void 0 - ? void 0 - : _a.forEach((value, key) => { + else { + validateSearchParameters(options.searchParams); + searchParameters = new url_1.URLSearchParams(); + // eslint-disable-next-line guard-for-in + for (const key in options.searchParams) { + const value = options.searchParams[key]; + if (value === null) { + searchParameters.append(key, ''); + } + else if (value !== undefined) { + searchParameters.append(key, value); + } + } + } + // `normalizeArguments()` is also used to merge options + (_a = defaults === null || defaults === void 0 ? void 0 : defaults.searchParams) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => { // Only use default if one isn't already defined if (!searchParameters.has(key)) { - searchParameters.append(key, value); + searchParameters.append(key, value); } - }); - options.searchParams = searchParameters; + }); + options.searchParams = searchParameters; } - } - // `options.username` & `options.password` - options.username = - (_b = options.username) !== null && _b !== void 0 ? _b : ''; - options.password = - (_c = options.password) !== null && _c !== void 0 ? _c : ''; - // `options.prefixUrl` & `options.url` - if (is_1.default.undefined(options.prefixUrl)) { - options.prefixUrl = - (_d = - defaults === null || defaults === void 0 - ? void 0 - : defaults.prefixUrl) !== null && _d !== void 0 - ? _d - : ''; - } else { + } + // `options.username` & `options.password` + options.username = (_b = options.username) !== null && _b !== void 0 ? _b : ''; + options.password = (_c = options.password) !== null && _c !== void 0 ? _c : ''; + // `options.prefixUrl` & `options.url` + if (is_1.default.undefined(options.prefixUrl)) { + options.prefixUrl = (_d = defaults === null || defaults === void 0 ? void 0 : defaults.prefixUrl) !== null && _d !== void 0 ? _d : ''; + } + else { options.prefixUrl = options.prefixUrl.toString(); if (options.prefixUrl !== '' && !options.prefixUrl.endsWith('/')) { - options.prefixUrl += '/'; + options.prefixUrl += '/'; } - } - if (is_1.default.string(options.url)) { + } + if (is_1.default.string(options.url)) { if (options.url.startsWith('/')) { - throw new Error( - '`input` must not start with a slash when using `prefixUrl`' - ); + throw new Error('`input` must not start with a slash when using `prefixUrl`'); } - options.url = options_to_url_1.default( - options.prefixUrl + options.url, - options - ); - } else if ( - (is_1.default.undefined(options.url) && options.prefixUrl !== '') || - options.protocol - ) { + options.url = options_to_url_1.default(options.prefixUrl + options.url, options); + } + else if ((is_1.default.undefined(options.url) && options.prefixUrl !== '') || options.protocol) { options.url = options_to_url_1.default(options.prefixUrl, options); - } - if (options.url) { + } + if (options.url) { if ('port' in options) { - delete options.port; + delete options.port; } // Make it possible to change `options.prefixUrl` let { prefixUrl } = options; Object.defineProperty(options, 'prefixUrl', { - set: (value) => { - const url = options.url; - if (!url.href.startsWith(value)) { - throw new Error( - `Cannot change \`prefixUrl\` from ${prefixUrl} to ${value}: ${url.href}` - ); - } - options.url = new url_1.URL( - value + url.href.slice(prefixUrl.length) - ); - prefixUrl = value; - }, - get: () => prefixUrl, + set: (value) => { + const url = options.url; + if (!url.href.startsWith(value)) { + throw new Error(`Cannot change \`prefixUrl\` from ${prefixUrl} to ${value}: ${url.href}`); + } + options.url = new url_1.URL(value + url.href.slice(prefixUrl.length)); + prefixUrl = value; + }, + get: () => prefixUrl }); // Support UNIX sockets let { protocol } = options.url; if (protocol === 'unix:') { - protocol = 'http:'; - options.url = new url_1.URL( - `http://unix${options.url.pathname}${options.url.search}` - ); + protocol = 'http:'; + options.url = new url_1.URL(`http://unix${options.url.pathname}${options.url.search}`); } // Set search params if (options.searchParams) { - // eslint-disable-next-line @typescript-eslint/no-base-to-string - options.url.search = options.searchParams.toString(); + // eslint-disable-next-line @typescript-eslint/no-base-to-string + options.url.search = options.searchParams.toString(); } // Protocol check if (protocol !== 'http:' && protocol !== 'https:') { - throw new UnsupportedProtocolError(options); + throw new UnsupportedProtocolError(options); } // Update `username` if (options.username === '') { - options.username = options.url.username; - } else { - options.url.username = options.username; + options.username = options.url.username; + } + else { + options.url.username = options.username; } // Update `password` if (options.password === '') { - options.password = options.url.password; - } else { - options.url.password = options.password; + options.password = options.url.password; } - } - // `options.cookieJar` - const { cookieJar } = options; - if (cookieJar) { + else { + options.url.password = options.password; + } + } + // `options.cookieJar` + const { cookieJar } = options; + if (cookieJar) { let { setCookie, getCookieString } = cookieJar; is_1.assert.function_(setCookie); is_1.assert.function_(getCookieString); /* istanbul ignore next: Horrible `tough-cookie` v3 check */ if (setCookie.length === 4 && getCookieString.length === 0) { - setCookie = util_1.promisify(setCookie.bind(options.cookieJar)); - getCookieString = util_1.promisify( - getCookieString.bind(options.cookieJar) - ); - options.cookieJar = { - setCookie, - getCookieString: getCookieString, - }; + setCookie = util_1.promisify(setCookie.bind(options.cookieJar)); + getCookieString = util_1.promisify(getCookieString.bind(options.cookieJar)); + options.cookieJar = { + setCookie, + getCookieString: getCookieString + }; } - } - // `options.cache` - const { cache } = options; - if (cache) { + } + // `options.cache` + const { cache } = options; + if (cache) { if (!cacheableStore.has(cache)) { - cacheableStore.set( - cache, - new CacheableRequest((requestOptions, handler) => { - const result = requestOptions[kRequest]( - requestOptions, - handler - ); - // TODO: remove this when `cacheable-request` supports async request functions. - if (is_1.default.promise(result)) { - // @ts-expect-error - // We only need to implement the error handler in order to support HTTP2 caching. - // The result will be a promise anyway. - result.once = (event, handler) => { - if (event === 'error') { - result.catch(handler); - } else if (event === 'abort') { - // The empty catch is needed here in case when - // it rejects before it's `await`ed in `_makeRequest`. - (async () => { - try { - const request = await result; - request.once('abort', handler); - } catch (_a) {} - })(); - } else { - /* istanbul ignore next: safety check */ - throw new Error( - `Unknown HTTP2 promise event: ${event}` - ); - } - return result; - }; - } - return result; - }, cache) - ); + cacheableStore.set(cache, new CacheableRequest(((requestOptions, handler) => { + const result = requestOptions[kRequest](requestOptions, handler); + // TODO: remove this when `cacheable-request` supports async request functions. + if (is_1.default.promise(result)) { + // @ts-expect-error + // We only need to implement the error handler in order to support HTTP2 caching. + // The result will be a promise anyway. + result.once = (event, handler) => { + if (event === 'error') { + result.catch(handler); + } + else if (event === 'abort') { + // The empty catch is needed here in case when + // it rejects before it's `await`ed in `_makeRequest`. + (async () => { + try { + const request = (await result); + request.once('abort', handler); + } + catch (_a) { } + })(); + } + else { + /* istanbul ignore next: safety check */ + throw new Error(`Unknown HTTP2 promise event: ${event}`); + } + return result; + }; + } + return result; + }), cache)); } - } - // `options.cacheOptions` - options.cacheOptions = { ...options.cacheOptions }; - // `options.dnsCache` - if (options.dnsCache === true) { + } + // `options.cacheOptions` + options.cacheOptions = { ...options.cacheOptions }; + // `options.dnsCache` + if (options.dnsCache === true) { options.dnsCache = globalDnsCache; - } else if ( - !is_1.default.undefined(options.dnsCache) && - !options.dnsCache.lookup - ) { - throw new TypeError( - `Parameter \`dnsCache\` must be a CacheableLookup instance or a boolean, got ${is_1.default( - options.dnsCache - )}` - ); - } - // `options.timeout` - if (is_1.default.number(options.timeout)) { + } + else if (!is_1.default.undefined(options.dnsCache) && !options.dnsCache.lookup) { + throw new TypeError(`Parameter \`dnsCache\` must be a CacheableLookup instance or a boolean, got ${is_1.default(options.dnsCache)}`); + } + // `options.timeout` + if (is_1.default.number(options.timeout)) { options.timeout = { request: options.timeout }; - } else if (defaults && options.timeout !== defaults.timeout) { + } + else if (defaults && options.timeout !== defaults.timeout) { options.timeout = { - ...defaults.timeout, - ...options.timeout, + ...defaults.timeout, + ...options.timeout }; - } else { + } + else { options.timeout = { ...options.timeout }; - } - // `options.context` - if (!options.context) { + } + // `options.context` + if (!options.context) { options.context = {}; - } - // `options.hooks` - const areHooksDefault = - options.hooks === - (defaults === null || defaults === void 0 - ? void 0 - : defaults.hooks); - options.hooks = { ...options.hooks }; - for (const event of exports.knownHookEvents) { + } + // `options.hooks` + const areHooksDefault = options.hooks === (defaults === null || defaults === void 0 ? void 0 : defaults.hooks); + options.hooks = { ...options.hooks }; + for (const event of exports.knownHookEvents) { if (event in options.hooks) { - if (is_1.default.array(options.hooks[event])) { - // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044 - options.hooks[event] = [...options.hooks[event]]; - } else { - throw new TypeError( - `Parameter \`${event}\` must be an Array, got ${is_1.default( - options.hooks[event] - )}` - ); - } - } else { - options.hooks[event] = []; + if (is_1.default.array(options.hooks[event])) { + // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044 + options.hooks[event] = [...options.hooks[event]]; + } + else { + throw new TypeError(`Parameter \`${event}\` must be an Array, got ${is_1.default(options.hooks[event])}`); + } } - } - if (defaults && !areHooksDefault) { + else { + options.hooks[event] = []; + } + } + if (defaults && !areHooksDefault) { for (const event of exports.knownHookEvents) { - const defaultHooks = defaults.hooks[event]; - if (defaultHooks.length > 0) { - // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044 - options.hooks[event] = [ - ...defaults.hooks[event], - ...options.hooks[event], - ]; - } + const defaultHooks = defaults.hooks[event]; + if (defaultHooks.length > 0) { + // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044 + options.hooks[event] = [ + ...defaults.hooks[event], + ...options.hooks[event] + ]; + } } - } - // DNS options - if ('family' in options) { - deprecation_warning_1.default( - '"options.family" was never documented, please use "options.dnsLookupIpVersion"' - ); - } - // HTTPS options - if ( - defaults === null || defaults === void 0 ? void 0 : defaults.https - ) { + } + // DNS options + if ('family' in options) { + deprecation_warning_1.default('"options.family" was never documented, please use "options.dnsLookupIpVersion"'); + } + // HTTPS options + if (defaults === null || defaults === void 0 ? void 0 : defaults.https) { options.https = { ...defaults.https, ...options.https }; - } - if ('rejectUnauthorized' in options) { - deprecation_warning_1.default( - '"options.rejectUnauthorized" is now deprecated, please use "options.https.rejectUnauthorized"' - ); - } - if ('checkServerIdentity' in options) { - deprecation_warning_1.default( - '"options.checkServerIdentity" was never documented, please use "options.https.checkServerIdentity"' - ); - } - if ('ca' in options) { - deprecation_warning_1.default( - '"options.ca" was never documented, please use "options.https.certificateAuthority"' - ); - } - if ('key' in options) { - deprecation_warning_1.default( - '"options.key" was never documented, please use "options.https.key"' - ); - } - if ('cert' in options) { - deprecation_warning_1.default( - '"options.cert" was never documented, please use "options.https.certificate"' - ); - } - if ('passphrase' in options) { - deprecation_warning_1.default( - '"options.passphrase" was never documented, please use "options.https.passphrase"' - ); - } - if ('pfx' in options) { - deprecation_warning_1.default( - '"options.pfx" was never documented, please use "options.https.pfx"' - ); - } - // Other options - if ('followRedirects' in options) { - throw new TypeError( - 'The `followRedirects` option does not exist. Use `followRedirect` instead.' - ); - } - if (options.agent) { + } + if ('rejectUnauthorized' in options) { + deprecation_warning_1.default('"options.rejectUnauthorized" is now deprecated, please use "options.https.rejectUnauthorized"'); + } + if ('checkServerIdentity' in options) { + deprecation_warning_1.default('"options.checkServerIdentity" was never documented, please use "options.https.checkServerIdentity"'); + } + if ('ca' in options) { + deprecation_warning_1.default('"options.ca" was never documented, please use "options.https.certificateAuthority"'); + } + if ('key' in options) { + deprecation_warning_1.default('"options.key" was never documented, please use "options.https.key"'); + } + if ('cert' in options) { + deprecation_warning_1.default('"options.cert" was never documented, please use "options.https.certificate"'); + } + if ('passphrase' in options) { + deprecation_warning_1.default('"options.passphrase" was never documented, please use "options.https.passphrase"'); + } + if ('pfx' in options) { + deprecation_warning_1.default('"options.pfx" was never documented, please use "options.https.pfx"'); + } + // Other options + if ('followRedirects' in options) { + throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.'); + } + if (options.agent) { for (const key in options.agent) { - if (key !== 'http' && key !== 'https' && key !== 'http2') { - throw new TypeError( - `Expected the \`options.agent\` properties to be \`http\`, \`https\` or \`http2\`, got \`${key}\`` - ); - } + if (key !== 'http' && key !== 'https' && key !== 'http2') { + throw new TypeError(`Expected the \`options.agent\` properties to be \`http\`, \`https\` or \`http2\`, got \`${key}\``); + } } - } - options.maxRedirects = - (_e = options.maxRedirects) !== null && _e !== void 0 ? _e : 0; - // Set non-enumerable properties - exports.setNonEnumerableProperties([defaults, rawOptions], options); - return normalize_arguments_1.default(options, defaults); } - _lockWrite() { - const onLockedWrite = () => { + options.maxRedirects = (_e = options.maxRedirects) !== null && _e !== void 0 ? _e : 0; + // Set non-enumerable properties + exports.setNonEnumerableProperties([defaults, rawOptions], options); + return normalize_arguments_1.default(options, defaults); + } + _lockWrite() { + const onLockedWrite = () => { throw new TypeError('The payload has been already provided'); - }; - this.write = onLockedWrite; - this.end = onLockedWrite; - } - _unlockWrite() { - this.write = super.write; - this.end = super.end; - } - async _finalizeBody() { - const { options } = this; - const { headers } = options; - const isForm = !is_1.default.undefined(options.form); - const isJSON = !is_1.default.undefined(options.json); - const isBody = !is_1.default.undefined(options.body); - const hasPayload = isForm || isJSON || isBody; - const cannotHaveBody = - exports.withoutBody.has(options.method) && - !(options.method === 'GET' && options.allowGetBody); - this._cannotHaveBody = cannotHaveBody; - if (hasPayload) { + }; + this.write = onLockedWrite; + this.end = onLockedWrite; + } + _unlockWrite() { + this.write = super.write; + this.end = super.end; + } + async _finalizeBody() { + const { options } = this; + const { headers } = options; + const isForm = !is_1.default.undefined(options.form); + const isJSON = !is_1.default.undefined(options.json); + const isBody = !is_1.default.undefined(options.body); + const hasPayload = isForm || isJSON || isBody; + const cannotHaveBody = exports.withoutBody.has(options.method) && !(options.method === 'GET' && options.allowGetBody); + this._cannotHaveBody = cannotHaveBody; + if (hasPayload) { if (cannotHaveBody) { - throw new TypeError( - `The \`${options.method}\` method cannot be used with a body` - ); + throw new TypeError(`The \`${options.method}\` method cannot be used with a body`); } - if ( - [isBody, isForm, isJSON].filter((isTrue) => isTrue).length > 1 - ) { - throw new TypeError( - 'The `body`, `json` and `form` options are mutually exclusive' - ); + if ([isBody, isForm, isJSON].filter(isTrue => isTrue).length > 1) { + throw new TypeError('The `body`, `json` and `form` options are mutually exclusive'); } - if ( - isBody && - !(options.body instanceof stream_1.Readable) && - !is_1.default.string(options.body) && - !is_1.default.buffer(options.body) && - !is_form_data_1.default(options.body) - ) { - throw new TypeError( - 'The `body` option must be a stream.Readable, string or Buffer' - ); + if (isBody && + !(options.body instanceof stream_1.Readable) && + !is_1.default.string(options.body) && + !is_1.default.buffer(options.body) && + !is_form_data_1.default(options.body)) { + throw new TypeError('The `body` option must be a stream.Readable, string or Buffer'); } if (isForm && !is_1.default.object(options.form)) { - throw new TypeError('The `form` option must be an Object'); + throw new TypeError('The `form` option must be an Object'); } { - // Serialize body - const noContentType = !is_1.default.string( - headers['content-type'] - ); - if (isBody) { - // Special case for https://github.com/form-data/form-data - if (is_form_data_1.default(options.body) && noContentType) { - headers[ - 'content-type' - ] = `multipart/form-data; boundary=${options.body.getBoundary()}`; + // Serialize body + const noContentType = !is_1.default.string(headers['content-type']); + if (isBody) { + // Special case for https://github.com/form-data/form-data + if (is_form_data_1.default(options.body) && noContentType) { + headers['content-type'] = `multipart/form-data; boundary=${options.body.getBoundary()}`; + } + this[kBody] = options.body; } - this[kBody] = options.body; - } else if (isForm) { - if (noContentType) { - headers['content-type'] = 'application/x-www-form-urlencoded'; + else if (isForm) { + if (noContentType) { + headers['content-type'] = 'application/x-www-form-urlencoded'; + } + this[kBody] = (new url_1.URLSearchParams(options.form)).toString(); } - this[kBody] = new url_1.URLSearchParams( - options.form - ).toString(); - } else { - if (noContentType) { - headers['content-type'] = 'application/json'; + else { + if (noContentType) { + headers['content-type'] = 'application/json'; + } + this[kBody] = options.stringifyJson(options.json); } - this[kBody] = options.stringifyJson(options.json); - } - const uploadBodySize = await get_body_size_1.default( - this[kBody], - options.headers - ); - // See https://tools.ietf.org/html/rfc7230#section-3.3.2 - // A user agent SHOULD send a Content-Length in a request message when - // no Transfer-Encoding is sent and the request method defines a meaning - // for an enclosed payload body. For example, a Content-Length header - // field is normally sent in a POST request even when the value is 0 - // (indicating an empty payload body). A user agent SHOULD NOT send a - // Content-Length header field when the request message does not contain - // a payload body and the method semantics do not anticipate such a - // body. - if ( - is_1.default.undefined(headers['content-length']) && - is_1.default.undefined(headers['transfer-encoding']) - ) { - if ( - !cannotHaveBody && - !is_1.default.undefined(uploadBodySize) - ) { - headers['content-length'] = String(uploadBodySize); + const uploadBodySize = await get_body_size_1.default(this[kBody], options.headers); + // See https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD send a Content-Length in a request message when + // no Transfer-Encoding is sent and the request method defines a meaning + // for an enclosed payload body. For example, a Content-Length header + // field is normally sent in a POST request even when the value is 0 + // (indicating an empty payload body). A user agent SHOULD NOT send a + // Content-Length header field when the request message does not contain + // a payload body and the method semantics do not anticipate such a + // body. + if (is_1.default.undefined(headers['content-length']) && is_1.default.undefined(headers['transfer-encoding'])) { + if (!cannotHaveBody && !is_1.default.undefined(uploadBodySize)) { + headers['content-length'] = String(uploadBodySize); + } } - } } - } else if (cannotHaveBody) { - this._lockWrite(); - } else { - this._unlockWrite(); - } - this[kBodySize] = Number(headers['content-length']) || undefined; } - async _onResponseBase(response) { - const { options } = this; - const { url } = options; - this[kOriginalResponse] = response; - if (options.decompress) { + else if (cannotHaveBody) { + this._lockWrite(); + } + else { + this._unlockWrite(); + } + this[kBodySize] = Number(headers['content-length']) || undefined; + } + async _onResponseBase(response) { + const { options } = this; + const { url } = options; + this[kOriginalResponse] = response; + if (options.decompress) { response = decompressResponse(response); - } - const statusCode = response.statusCode; - const typedResponse = response; - typedResponse.statusMessage = typedResponse.statusMessage - ? typedResponse.statusMessage - : http.STATUS_CODES[statusCode]; - typedResponse.url = options.url.toString(); - typedResponse.requestUrl = this.requestUrl; - typedResponse.redirectUrls = this.redirects; - typedResponse.request = this; - typedResponse.isFromCache = response.fromCache || false; - typedResponse.ip = this.ip; - typedResponse.retryCount = this.retryCount; - this[kIsFromCache] = typedResponse.isFromCache; - this[kResponseSize] = - Number(response.headers['content-length']) || undefined; - this[kResponse] = response; - response.once('end', () => { + } + const statusCode = response.statusCode; + const typedResponse = response; + typedResponse.statusMessage = typedResponse.statusMessage ? typedResponse.statusMessage : http.STATUS_CODES[statusCode]; + typedResponse.url = options.url.toString(); + typedResponse.requestUrl = this.requestUrl; + typedResponse.redirectUrls = this.redirects; + typedResponse.request = this; + typedResponse.isFromCache = response.fromCache || false; + typedResponse.ip = this.ip; + typedResponse.retryCount = this.retryCount; + this[kIsFromCache] = typedResponse.isFromCache; + this[kResponseSize] = Number(response.headers['content-length']) || undefined; + this[kResponse] = response; + response.once('end', () => { this[kResponseSize] = this[kDownloadedSize]; this.emit('downloadProgress', this.downloadProgress); - }); - response.once('error', (error) => { + }); + response.once('error', (error) => { // Force clean-up, because some packages don't do this. // TODO: Fix decompress-response response.destroy(); this._beforeError(new ReadError(error, this)); - }); - response.once('aborted', () => { - this._beforeError( - new ReadError( - { - name: 'Error', - message: 'The server aborted pending request', - code: 'ECONNRESET', - }, - this - ) - ); - }); - this.emit('downloadProgress', this.downloadProgress); - const rawCookies = response.headers['set-cookie']; - if (is_1.default.object(options.cookieJar) && rawCookies) { - let promises = rawCookies.map(async (rawCookie) => - options.cookieJar.setCookie(rawCookie, url.toString()) - ); + }); + response.once('aborted', () => { + this._beforeError(new ReadError({ + name: 'Error', + message: 'The server aborted pending request', + code: 'ECONNRESET' + }, this)); + }); + this.emit('downloadProgress', this.downloadProgress); + const rawCookies = response.headers['set-cookie']; + if (is_1.default.object(options.cookieJar) && rawCookies) { + let promises = rawCookies.map(async (rawCookie) => options.cookieJar.setCookie(rawCookie, url.toString())); if (options.ignoreInvalidCookies) { - promises = promises.map(async (p) => p.catch(() => {})); + promises = promises.map(async (p) => p.catch(() => { })); } try { - await Promise.all(promises); - } catch (error) { - this._beforeError(error); - return; + await Promise.all(promises); } - } - if ( - options.followRedirect && - response.headers.location && - redirectCodes.has(statusCode) - ) { + catch (error) { + this._beforeError(error); + return; + } + } + if (options.followRedirect && response.headers.location && redirectCodes.has(statusCode)) { // We're being redirected, we don't care about the response. // It'd be best to abort the request, but we can't because // we would have to sacrifice the TCP connection. We don't want that. response.resume(); if (this[kRequest]) { - this[kCancelTimeouts](); - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete this[kRequest]; - this[kUnproxyEvents](); + this[kCancelTimeouts](); + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete this[kRequest]; + this[kUnproxyEvents](); } - const shouldBeGet = - statusCode === 303 && - options.method !== 'GET' && - options.method !== 'HEAD'; + const shouldBeGet = statusCode === 303 && options.method !== 'GET' && options.method !== 'HEAD'; if (shouldBeGet || !options.methodRewriting) { - // Server responded with "see other", indicating that the resource exists at another location, - // and the client should request it from that location via GET or HEAD. - options.method = 'GET'; - if ('body' in options) { - delete options.body; - } - if ('json' in options) { - delete options.json; - } - if ('form' in options) { - delete options.form; - } - this[kBody] = undefined; - delete options.headers['content-length']; + // Server responded with "see other", indicating that the resource exists at another location, + // and the client should request it from that location via GET or HEAD. + options.method = 'GET'; + if ('body' in options) { + delete options.body; + } + if ('json' in options) { + delete options.json; + } + if ('form' in options) { + delete options.form; + } + this[kBody] = undefined; + delete options.headers['content-length']; } if (this.redirects.length >= options.maxRedirects) { - this._beforeError(new MaxRedirectsError(this)); - return; + this._beforeError(new MaxRedirectsError(this)); + return; } try { - // Do not remove. See https://github.com/sindresorhus/got/pull/214 - const redirectBuffer = Buffer.from( - response.headers.location, - 'binary' - ).toString(); - // Handles invalid URLs. See https://github.com/sindresorhus/got/issues/604 - const redirectUrl = new url_1.URL(redirectBuffer, url); - const redirectString = redirectUrl.toString(); - decodeURI(redirectString); - // Redirecting to a different site, clear sensitive data. - if ( - redirectUrl.hostname !== url.hostname || - redirectUrl.port !== url.port - ) { - if ('host' in options.headers) { - delete options.headers.host; + // Do not remove. See https://github.com/sindresorhus/got/pull/214 + const redirectBuffer = Buffer.from(response.headers.location, 'binary').toString(); + // Handles invalid URLs. See https://github.com/sindresorhus/got/issues/604 + const redirectUrl = new url_1.URL(redirectBuffer, url); + const redirectString = redirectUrl.toString(); + decodeURI(redirectString); + // Redirecting to a different site, clear sensitive data. + if (redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port) { + if ('host' in options.headers) { + delete options.headers.host; + } + if ('cookie' in options.headers) { + delete options.headers.cookie; + } + if ('authorization' in options.headers) { + delete options.headers.authorization; + } + if (options.username || options.password) { + options.username = ''; + options.password = ''; + } } - if ('cookie' in options.headers) { - delete options.headers.cookie; + else { + redirectUrl.username = options.username; + redirectUrl.password = options.password; } - if ('authorization' in options.headers) { - delete options.headers.authorization; + this.redirects.push(redirectString); + options.url = redirectUrl; + for (const hook of options.hooks.beforeRedirect) { + // eslint-disable-next-line no-await-in-loop + await hook(options, typedResponse); } - if (options.username || options.password) { - options.username = ''; - options.password = ''; - } - } else { - redirectUrl.username = options.username; - redirectUrl.password = options.password; - } - this.redirects.push(redirectString); - options.url = redirectUrl; - for (const hook of options.hooks.beforeRedirect) { - // eslint-disable-next-line no-await-in-loop - await hook(options, typedResponse); - } - this.emit('redirect', typedResponse, options); - await this._makeRequest(); - } catch (error) { - this._beforeError(error); - return; + this.emit('redirect', typedResponse, options); + await this._makeRequest(); + } + catch (error) { + this._beforeError(error); + return; } return; - } - if ( - options.isStream && - options.throwHttpErrors && - !is_response_ok_1.isResponseOk(typedResponse) - ) { + } + if (options.isStream && options.throwHttpErrors && !is_response_ok_1.isResponseOk(typedResponse)) { this._beforeError(new HTTPError(typedResponse)); return; - } - response.on('readable', () => { + } + response.on('readable', () => { if (this[kTriggerRead]) { - this._read(); + this._read(); } - }); - this.on('resume', () => { + }); + this.on('resume', () => { response.resume(); - }); - this.on('pause', () => { + }); + this.on('pause', () => { response.pause(); - }); - response.once('end', () => { + }); + response.once('end', () => { this.push(null); - }); - this.emit('response', response); - for (const destination of this[kServerResponsesPiped]) { + }); + this.emit('response', response); + for (const destination of this[kServerResponsesPiped]) { if (destination.headersSent) { - continue; + continue; } // eslint-disable-next-line guard-for-in for (const key in response.headers) { - const isAllowed = options.decompress - ? key !== 'content-encoding' - : true; - const value = response.headers[key]; - if (isAllowed) { - destination.setHeader(key, value); - } + const isAllowed = options.decompress ? key !== 'content-encoding' : true; + const value = response.headers[key]; + if (isAllowed) { + destination.setHeader(key, value); + } } destination.statusCode = statusCode; - } } - async _onResponse(response) { - try { + } + async _onResponse(response) { + try { await this._onResponseBase(response); - } catch (error) { + } + catch (error) { /* istanbul ignore next: better safe than sorry */ this._beforeError(error); - } } - _onRequest(request) { - const { options } = this; - const { timeout, url } = options; - http_timer_1.default(request); - this[kCancelTimeouts] = timed_out_1.default(request, timeout, url); - const responseEventName = options.cache - ? 'cacheableResponse' - : 'response'; - request.once(responseEventName, (response) => { + } + _onRequest(request) { + const { options } = this; + const { timeout, url } = options; + http_timer_1.default(request); + this[kCancelTimeouts] = timed_out_1.default(request, timeout, url); + const responseEventName = options.cache ? 'cacheableResponse' : 'response'; + request.once(responseEventName, (response) => { void this._onResponse(response); - }); - request.once('error', (error) => { + }); + request.once('error', (error) => { var _a; // Force clean-up, because some packages (e.g. nock) don't do this. request.destroy(); // Node.js <= 12.18.2 mistakenly emits the response `end` first. - (_a = request.res) === null || _a === void 0 - ? void 0 - : _a.removeAllListeners('end'); - error = - error instanceof timed_out_1.TimeoutError - ? new TimeoutError(error, this.timings, this) - : new RequestError(error.message, error, this); + (_a = request.res) === null || _a === void 0 ? void 0 : _a.removeAllListeners('end'); + error = error instanceof timed_out_1.TimeoutError ? new TimeoutError(error, this.timings, this) : new RequestError(error.message, error, this); this._beforeError(error); - }); - this[kUnproxyEvents] = proxy_events_1.default( - request, - this, - proxiedRequestEvents - ); - this[kRequest] = request; - this.emit('uploadProgress', this.uploadProgress); - // Send body - const body = this[kBody]; - const currentRequest = this.redirects.length === 0 ? this : request; - if (is_1.default.nodeStream(body)) { + }); + this[kUnproxyEvents] = proxy_events_1.default(request, this, proxiedRequestEvents); + this[kRequest] = request; + this.emit('uploadProgress', this.uploadProgress); + // Send body + const body = this[kBody]; + const currentRequest = this.redirects.length === 0 ? this : request; + if (is_1.default.nodeStream(body)) { body.pipe(currentRequest); body.once('error', (error) => { - this._beforeError(new UploadError(error, this)); + this._beforeError(new UploadError(error, this)); }); - } else { + } + else { this._unlockWrite(); if (!is_1.default.undefined(body)) { - this._writeRequest(body, undefined, () => {}); - currentRequest.end(); - this._lockWrite(); - } else if (this._cannotHaveBody || this._noPipe) { - currentRequest.end(); - this._lockWrite(); + this._writeRequest(body, undefined, () => { }); + currentRequest.end(); + this._lockWrite(); + } + else if (this._cannotHaveBody || this._noPipe) { + currentRequest.end(); + this._lockWrite(); } - } - this.emit('request', request); } - async _createCacheableRequest(url, options) { - return new Promise((resolve, reject) => { + this.emit('request', request); + } + async _createCacheableRequest(url, options) { + return new Promise((resolve, reject) => { // TODO: Remove `utils/url-to-options.ts` when `cacheable-request` is fixed Object.assign(options, url_to_options_1.default(url)); // `http-cache-semantics` checks this @@ -7232,168 +6144,138 @@ An error to be thrown when given an unsupported protocol. delete options.url; let request; // This is ugly - const cacheRequest = cacheableStore.get(options.cache)( - options, - async (response) => { + const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => { // TODO: Fix `cacheable-response` response._readableState.autoDestroy = false; if (request) { - (await request).emit('cacheableResponse', response); + (await request).emit('cacheableResponse', response); } resolve(response); - } - ); + }); // Restore options options.url = url; cacheRequest.once('error', reject); cacheRequest.once('request', async (requestOrPromise) => { - request = requestOrPromise; - resolve(request); + request = requestOrPromise; + resolve(request); }); - }); - } - async _makeRequest() { - var _a, _b, _c, _d, _e; - const { options } = this; - const { headers } = options; - for (const key in headers) { + }); + } + async _makeRequest() { + var _a, _b, _c, _d, _e; + const { options } = this; + const { headers } = options; + for (const key in headers) { if (is_1.default.undefined(headers[key])) { - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete headers[key]; - } else if (is_1.default.null_(headers[key])) { - throw new TypeError( - `Use \`undefined\` instead of \`null\` to delete the \`${key}\` header` - ); + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete headers[key]; } - } - if ( - options.decompress && - is_1.default.undefined(headers['accept-encoding']) - ) { - headers['accept-encoding'] = supportsBrotli - ? 'gzip, deflate, br' - : 'gzip, deflate'; - } - // Set cookies - if (options.cookieJar) { - const cookieString = await options.cookieJar.getCookieString( - options.url.toString() - ); + else if (is_1.default.null_(headers[key])) { + throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${key}\` header`); + } + } + if (options.decompress && is_1.default.undefined(headers['accept-encoding'])) { + headers['accept-encoding'] = supportsBrotli ? 'gzip, deflate, br' : 'gzip, deflate'; + } + // Set cookies + if (options.cookieJar) { + const cookieString = await options.cookieJar.getCookieString(options.url.toString()); if (is_1.default.nonEmptyString(cookieString)) { - options.headers.cookie = cookieString; + options.headers.cookie = cookieString; } - } - for (const hook of options.hooks.beforeRequest) { + } + for (const hook of options.hooks.beforeRequest) { // eslint-disable-next-line no-await-in-loop const result = await hook(options); if (!is_1.default.undefined(result)) { - // @ts-expect-error Skip the type mismatch to support abstract responses - options.request = () => result; - break; + // @ts-expect-error Skip the type mismatch to support abstract responses + options.request = () => result; + break; } - } - if (options.body && this[kBody] !== options.body) { + } + if (options.body && this[kBody] !== options.body) { this[kBody] = options.body; - } - const { agent, request, timeout, url } = options; - if (options.dnsCache && !('lookup' in options)) { + } + const { agent, request, timeout, url } = options; + if (options.dnsCache && !('lookup' in options)) { options.lookup = options.dnsCache.lookup; - } - // UNIX sockets - if (url.hostname === 'unix') { - const matches = /(?.+?):(?.+)/.exec( - `${url.pathname}${url.search}` - ); - if ( - matches === null || matches === void 0 ? void 0 : matches.groups - ) { - const { socketPath, path } = matches.groups; - Object.assign(options, { - socketPath, - path, - host: '', - }); + } + // UNIX sockets + if (url.hostname === 'unix') { + const matches = /(?.+?):(?.+)/.exec(`${url.pathname}${url.search}`); + if (matches === null || matches === void 0 ? void 0 : matches.groups) { + const { socketPath, path } = matches.groups; + Object.assign(options, { + socketPath, + path, + host: '' + }); } - } - const isHttps = url.protocol === 'https:'; - // Fallback function - let fallbackFn; - if (options.http2) { + } + const isHttps = url.protocol === 'https:'; + // Fallback function + let fallbackFn; + if (options.http2) { fallbackFn = http2wrapper.auto; - } else { + } + else { fallbackFn = isHttps ? https.request : http.request; - } - const realFn = - (_a = options.request) !== null && _a !== void 0 ? _a : fallbackFn; - // Cache support - const fn = options.cache ? this._createCacheableRequest : realFn; - // Pass an agent directly when HTTP2 is disabled - if (agent && !options.http2) { + } + const realFn = (_a = options.request) !== null && _a !== void 0 ? _a : fallbackFn; + // Cache support + const fn = options.cache ? this._createCacheableRequest : realFn; + // Pass an agent directly when HTTP2 is disabled + if (agent && !options.http2) { options.agent = agent[isHttps ? 'https' : 'http']; - } - // Prepare plain HTTP request options - options[kRequest] = realFn; - delete options.request; - // TODO: Fix this ignore. - // @ts-expect-error - delete options.timeout; - const requestOptions = options; - requestOptions.shared = - (_b = options.cacheOptions) === null || _b === void 0 - ? void 0 - : _b.shared; - requestOptions.cacheHeuristic = - (_c = options.cacheOptions) === null || _c === void 0 - ? void 0 - : _c.cacheHeuristic; - requestOptions.immutableMinTimeToLive = - (_d = options.cacheOptions) === null || _d === void 0 - ? void 0 - : _d.immutableMinTimeToLive; - requestOptions.ignoreCargoCult = - (_e = options.cacheOptions) === null || _e === void 0 - ? void 0 - : _e.ignoreCargoCult; - // If `dnsLookupIpVersion` is not present do not override `family` - if (options.dnsLookupIpVersion !== undefined) { + } + // Prepare plain HTTP request options + options[kRequest] = realFn; + delete options.request; + // TODO: Fix this ignore. + // @ts-expect-error + delete options.timeout; + const requestOptions = options; + requestOptions.shared = (_b = options.cacheOptions) === null || _b === void 0 ? void 0 : _b.shared; + requestOptions.cacheHeuristic = (_c = options.cacheOptions) === null || _c === void 0 ? void 0 : _c.cacheHeuristic; + requestOptions.immutableMinTimeToLive = (_d = options.cacheOptions) === null || _d === void 0 ? void 0 : _d.immutableMinTimeToLive; + requestOptions.ignoreCargoCult = (_e = options.cacheOptions) === null || _e === void 0 ? void 0 : _e.ignoreCargoCult; + // If `dnsLookupIpVersion` is not present do not override `family` + if (options.dnsLookupIpVersion !== undefined) { try { - requestOptions.family = dns_ip_version_1.dnsLookupIpVersionToFamily( - options.dnsLookupIpVersion - ); - } catch (_f) { - throw new Error('Invalid `dnsLookupIpVersion` option value'); + requestOptions.family = dns_ip_version_1.dnsLookupIpVersionToFamily(options.dnsLookupIpVersion); } - } - // HTTPS options remapping - if (options.https) { + catch (_f) { + throw new Error('Invalid `dnsLookupIpVersion` option value'); + } + } + // HTTPS options remapping + if (options.https) { if ('rejectUnauthorized' in options.https) { - requestOptions.rejectUnauthorized = - options.https.rejectUnauthorized; + requestOptions.rejectUnauthorized = options.https.rejectUnauthorized; } if (options.https.checkServerIdentity) { - requestOptions.checkServerIdentity = - options.https.checkServerIdentity; + requestOptions.checkServerIdentity = options.https.checkServerIdentity; } if (options.https.certificateAuthority) { - requestOptions.ca = options.https.certificateAuthority; + requestOptions.ca = options.https.certificateAuthority; } if (options.https.certificate) { - requestOptions.cert = options.https.certificate; + requestOptions.cert = options.https.certificate; } if (options.https.key) { - requestOptions.key = options.https.key; + requestOptions.key = options.https.key; } if (options.https.passphrase) { - requestOptions.passphrase = options.https.passphrase; + requestOptions.passphrase = options.https.passphrase; } if (options.https.pfx) { - requestOptions.pfx = options.https.pfx; + requestOptions.pfx = options.https.pfx; } - } - try { + } + try { let requestOrResponse = await fn(url, requestOptions); if (is_1.default.undefined(requestOrResponse)) { - requestOrResponse = fallbackFn(url, requestOptions); + requestOrResponse = fallbackFn(url, requestOptions); } // Restore options options.request = request; @@ -7401,326 +6283,310 @@ An error to be thrown when given an unsupported protocol. options.agent = agent; // HTTPS options restore if (options.https) { - if ('rejectUnauthorized' in options.https) { - delete requestOptions.rejectUnauthorized; - } - if (options.https.checkServerIdentity) { - // @ts-expect-error - This one will be removed when we remove the alias. - delete requestOptions.checkServerIdentity; - } - if (options.https.certificateAuthority) { - delete requestOptions.ca; - } - if (options.https.certificate) { - delete requestOptions.cert; - } - if (options.https.key) { - delete requestOptions.key; - } - if (options.https.passphrase) { - delete requestOptions.passphrase; - } - if (options.https.pfx) { - delete requestOptions.pfx; - } + if ('rejectUnauthorized' in options.https) { + delete requestOptions.rejectUnauthorized; + } + if (options.https.checkServerIdentity) { + // @ts-expect-error - This one will be removed when we remove the alias. + delete requestOptions.checkServerIdentity; + } + if (options.https.certificateAuthority) { + delete requestOptions.ca; + } + if (options.https.certificate) { + delete requestOptions.cert; + } + if (options.https.key) { + delete requestOptions.key; + } + if (options.https.passphrase) { + delete requestOptions.passphrase; + } + if (options.https.pfx) { + delete requestOptions.pfx; + } } if (isClientRequest(requestOrResponse)) { - this._onRequest(requestOrResponse); - // Emit the response after the stream has been ended - } else if (this.writable) { - this.once('finish', () => { - void this._onResponse(requestOrResponse); - }); - this._unlockWrite(); - this.end(); - this._lockWrite(); - } else { - void this._onResponse(requestOrResponse); + this._onRequest(requestOrResponse); + // Emit the response after the stream has been ended } - } catch (error) { + else if (this.writable) { + this.once('finish', () => { + void this._onResponse(requestOrResponse); + }); + this._unlockWrite(); + this.end(); + this._lockWrite(); + } + else { + void this._onResponse(requestOrResponse); + } + } + catch (error) { if (error instanceof CacheableRequest.CacheError) { - throw new CacheError(error, this); + throw new CacheError(error, this); } throw new RequestError(error.message, error, this); - } } - async _error(error) { - try { + } + async _error(error) { + try { for (const hook of this.options.hooks.beforeError) { - // eslint-disable-next-line no-await-in-loop - error = await hook(error); + // eslint-disable-next-line no-await-in-loop + error = await hook(error); } - } catch (error_) { - error = new RequestError(error_.message, error_, this); - } - this.destroy(error); } - _beforeError(error) { - if (this[kStopReading]) { + catch (error_) { + error = new RequestError(error_.message, error_, this); + } + this.destroy(error); + } + _beforeError(error) { + if (this[kStopReading]) { return; - } - const { options } = this; - const retryCount = this.retryCount + 1; - this[kStopReading] = true; - if (!(error instanceof RequestError)) { + } + const { options } = this; + const retryCount = this.retryCount + 1; + this[kStopReading] = true; + if (!(error instanceof RequestError)) { error = new RequestError(error.message, error, this); - } - const typedError = error; - const { response } = typedError; - void (async () => { + } + const typedError = error; + const { response } = typedError; + void (async () => { if (response && !response.body) { - response.setEncoding(this._readableState.encoding); - try { - response.rawBody = await get_buffer_1.default(response); - response.body = response.rawBody.toString(); - } catch (_a) {} + response.setEncoding(this._readableState.encoding); + try { + response.rawBody = await get_buffer_1.default(response); + response.body = response.rawBody.toString(); + } + catch (_a) { } } if (this.listenerCount('retry') !== 0) { - let backoff; - try { - let retryAfter; - if (response && 'retry-after' in response.headers) { - retryAfter = Number(response.headers['retry-after']); - if (Number.isNaN(retryAfter)) { - retryAfter = - Date.parse(response.headers['retry-after']) - Date.now(); - if (retryAfter <= 0) { - retryAfter = 1; + let backoff; + try { + let retryAfter; + if (response && 'retry-after' in response.headers) { + retryAfter = Number(response.headers['retry-after']); + if (Number.isNaN(retryAfter)) { + retryAfter = Date.parse(response.headers['retry-after']) - Date.now(); + if (retryAfter <= 0) { + retryAfter = 1; + } + } + else { + retryAfter *= 1000; + } } - } else { - retryAfter *= 1000; - } + backoff = await options.retry.calculateDelay({ + attemptCount: retryCount, + retryOptions: options.retry, + error: typedError, + retryAfter, + computedValue: calculate_retry_delay_1.default({ + attemptCount: retryCount, + retryOptions: options.retry, + error: typedError, + retryAfter, + computedValue: 0 + }) + }); } - backoff = await options.retry.calculateDelay({ - attemptCount: retryCount, - retryOptions: options.retry, - error: typedError, - retryAfter, - computedValue: calculate_retry_delay_1.default({ - attemptCount: retryCount, - retryOptions: options.retry, - error: typedError, - retryAfter, - computedValue: 0, - }), - }); - } catch (error_) { - void this._error( - new RequestError(error_.message, error_, this) - ); - return; - } - if (backoff) { - const retry = async () => { - try { - for (const hook of this.options.hooks.beforeRetry) { - // eslint-disable-next-line no-await-in-loop - await hook(this.options, typedError, retryCount); - } - } catch (error_) { - void this._error( - new RequestError(error_.message, error, this) - ); + catch (error_) { + void this._error(new RequestError(error_.message, error_, this)); return; - } - // Something forced us to abort the retry - if (this.destroyed) { + } + if (backoff) { + const retry = async () => { + try { + for (const hook of this.options.hooks.beforeRetry) { + // eslint-disable-next-line no-await-in-loop + await hook(this.options, typedError, retryCount); + } + } + catch (error_) { + void this._error(new RequestError(error_.message, error, this)); + return; + } + // Something forced us to abort the retry + if (this.destroyed) { + return; + } + this.destroy(); + this.emit('retry', retryCount, error); + }; + this[kRetryTimeout] = setTimeout(retry, backoff); return; - } - this.destroy(); - this.emit('retry', retryCount, error); - }; - this[kRetryTimeout] = setTimeout(retry, backoff); - return; - } + } } void this._error(typedError); - })(); - } - _read() { - this[kTriggerRead] = true; - const response = this[kResponse]; - if (response && !this[kStopReading]) { + })(); + } + _read() { + this[kTriggerRead] = true; + const response = this[kResponse]; + if (response && !this[kStopReading]) { // We cannot put this in the `if` above // because `.read()` also triggers the `end` event if (response.readableLength) { - this[kTriggerRead] = false; + this[kTriggerRead] = false; } let data; while ((data = response.read()) !== null) { - this[kDownloadedSize] += data.length; - this[kStartedReading] = true; - const progress = this.downloadProgress; - if (progress.percent < 1) { - this.emit('downloadProgress', progress); - } - this.push(data); + this[kDownloadedSize] += data.length; + this[kStartedReading] = true; + const progress = this.downloadProgress; + if (progress.percent < 1) { + this.emit('downloadProgress', progress); + } + this.push(data); } - } } - // Node.js 12 has incorrect types, so the encoding must be a string - _write(chunk, encoding, callback) { - const write = () => { + } + // Node.js 12 has incorrect types, so the encoding must be a string + _write(chunk, encoding, callback) { + const write = () => { this._writeRequest(chunk, encoding, callback); - }; - if (this.requestInitialized) { + }; + if (this.requestInitialized) { write(); - } else { - this[kJobs].push(write); - } } - _writeRequest(chunk, encoding, callback) { - if (this[kRequest].destroyed) { + else { + this[kJobs].push(write); + } + } + _writeRequest(chunk, encoding, callback) { + if (this[kRequest].destroyed) { // Probably the `ClientRequest` instance will throw return; - } - this._progressCallbacks.push(() => { + } + this._progressCallbacks.push(() => { this[kUploadedSize] += Buffer.byteLength(chunk, encoding); const progress = this.uploadProgress; if (progress.percent < 1) { - this.emit('uploadProgress', progress); + this.emit('uploadProgress', progress); } - }); - // TODO: What happens if it's from cache? Then this[kRequest] won't be defined. - this[kRequest].write(chunk, encoding, (error) => { + }); + // TODO: What happens if it's from cache? Then this[kRequest] won't be defined. + this[kRequest].write(chunk, encoding, (error) => { if (!error && this._progressCallbacks.length > 0) { - this._progressCallbacks.shift()(); + this._progressCallbacks.shift()(); } callback(error); - }); - } - _final(callback) { - const endRequest = () => { + }); + } + _final(callback) { + const endRequest = () => { // FIX: Node.js 10 calls the write callback AFTER the end callback! while (this._progressCallbacks.length !== 0) { - this._progressCallbacks.shift()(); + this._progressCallbacks.shift()(); } // We need to check if `this[kRequest]` is present, // because it isn't when we use cache. if (!(kRequest in this)) { - callback(); - return; + callback(); + return; } if (this[kRequest].destroyed) { - callback(); - return; + callback(); + return; } this[kRequest].end((error) => { - if (!error) { - this[kBodySize] = this[kUploadedSize]; - this.emit('uploadProgress', this.uploadProgress); - this[kRequest].emit('upload-complete'); - } - callback(error); + if (!error) { + this[kBodySize] = this[kUploadedSize]; + this.emit('uploadProgress', this.uploadProgress); + this[kRequest].emit('upload-complete'); + } + callback(error); }); - }; - if (this.requestInitialized) { + }; + if (this.requestInitialized) { endRequest(); - } else { - this[kJobs].push(endRequest); - } } - _destroy(error, callback) { - var _a; - this[kStopReading] = true; - // Prevent further retries - clearTimeout(this[kRetryTimeout]); - if (kRequest in this) { + else { + this[kJobs].push(endRequest); + } + } + _destroy(error, callback) { + var _a; + this[kStopReading] = true; + // Prevent further retries + clearTimeout(this[kRetryTimeout]); + if (kRequest in this) { this[kCancelTimeouts](); // TODO: Remove the next `if` when these get fixed: // - https://github.com/nodejs/node/issues/32851 - if ( - !((_a = this[kResponse]) === null || _a === void 0 - ? void 0 - : _a.complete) - ) { - this[kRequest].destroy(); + if (!((_a = this[kResponse]) === null || _a === void 0 ? void 0 : _a.complete)) { + this[kRequest].destroy(); } - } - if ( - error !== null && - !is_1.default.undefined(error) && - !(error instanceof RequestError) - ) { + } + if (error !== null && !is_1.default.undefined(error) && !(error instanceof RequestError)) { error = new RequestError(error.message, error, this); - } - callback(error); } - get _isAboutToError() { - return this[kStopReading]; - } - /** + callback(error); + } + get _isAboutToError() { + return this[kStopReading]; + } + /** The remote IP address. */ - get ip() { - var _a; - return (_a = this.socket) === null || _a === void 0 - ? void 0 - : _a.remoteAddress; - } - /** + get ip() { + var _a; + return (_a = this.socket) === null || _a === void 0 ? void 0 : _a.remoteAddress; + } + /** Indicates whether the request has been aborted or not. */ - get aborted() { - var _a, _b, _c; - return ( - ((_b = - (_a = this[kRequest]) === null || _a === void 0 - ? void 0 - : _a.destroyed) !== null && _b !== void 0 - ? _b - : this.destroyed) && - !((_c = this[kOriginalResponse]) === null || _c === void 0 - ? void 0 - : _c.complete) - ); - } - get socket() { - var _a, _b; - return (_b = - (_a = this[kRequest]) === null || _a === void 0 - ? void 0 - : _a.socket) !== null && _b !== void 0 - ? _b - : undefined; - } - /** + get aborted() { + var _a, _b, _c; + return ((_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroyed) !== null && _b !== void 0 ? _b : this.destroyed) && !((_c = this[kOriginalResponse]) === null || _c === void 0 ? void 0 : _c.complete); + } + get socket() { + var _a, _b; + return (_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.socket) !== null && _b !== void 0 ? _b : undefined; + } + /** Progress event for downloading (receiving a response). */ - get downloadProgress() { - let percent; - if (this[kResponseSize]) { + get downloadProgress() { + let percent; + if (this[kResponseSize]) { percent = this[kDownloadedSize] / this[kResponseSize]; - } else if (this[kResponseSize] === this[kDownloadedSize]) { + } + else if (this[kResponseSize] === this[kDownloadedSize]) { percent = 1; - } else { + } + else { percent = 0; - } - return { + } + return { percent, transferred: this[kDownloadedSize], - total: this[kResponseSize], - }; - } - /** + total: this[kResponseSize] + }; + } + /** Progress event for uploading (sending a request). */ - get uploadProgress() { - let percent; - if (this[kBodySize]) { + get uploadProgress() { + let percent; + if (this[kBodySize]) { percent = this[kUploadedSize] / this[kBodySize]; - } else if (this[kBodySize] === this[kUploadedSize]) { + } + else if (this[kBodySize] === this[kUploadedSize]) { percent = 1; - } else { + } + else { percent = 0; - } - return { + } + return { percent, transferred: this[kUploadedSize], - total: this[kBodySize], - }; - } - /** + total: this[kBodySize] + }; + } + /** The object contains the following properties: - `start` - Time when the request started. @@ -7747,1193 +6613,1097 @@ An error to be thrown when given an unsupported protocol. __Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch. */ - get timings() { - var _a; - return (_a = this[kRequest]) === null || _a === void 0 - ? void 0 - : _a.timings; - } - /** + get timings() { + var _a; + return (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.timings; + } + /** Whether the response was retrieved from the cache. */ - get isFromCache() { - return this[kIsFromCache]; + get isFromCache() { + return this[kIsFromCache]; + } + pipe(destination, options) { + if (this[kStartedReading]) { + throw new Error('Failed to pipe. The response has been emitted already.'); } - pipe(destination, options) { - if (this[kStartedReading]) { - throw new Error( - 'Failed to pipe. The response has been emitted already.' - ); - } - if (destination instanceof http_1.ServerResponse) { + if (destination instanceof http_1.ServerResponse) { this[kServerResponsesPiped].add(destination); - } - return super.pipe(destination, options); } - unpipe(destination) { - if (destination instanceof http_1.ServerResponse) { + return super.pipe(destination, options); + } + unpipe(destination) { + if (destination instanceof http_1.ServerResponse) { this[kServerResponsesPiped].delete(destination); - } - super.unpipe(destination); - return this; } - } - exports.default = Request; + super.unpipe(destination); + return this; + } +} +exports.default = Request; - /***/ - }, - /***/ 4993: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - exports.dnsLookupIpVersionToFamily = exports.isDnsLookupIpVersion = void 0; - const conversionTable = { - auto: 0, - ipv4: 4, - ipv6: 6, - }; - exports.isDnsLookupIpVersion = (value) => { - return value in conversionTable; - }; - exports.dnsLookupIpVersionToFamily = (dnsLookupIpVersion) => { - if (exports.isDnsLookupIpVersion(dnsLookupIpVersion)) { - return conversionTable[dnsLookupIpVersion]; - } - throw new Error('Invalid DNS lookup IP version'); - }; +/***/ 4993: +/***/ ((__unused_webpack_module, exports) => { - /***/ - }, +"use strict"; - /***/ 4564: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dnsLookupIpVersionToFamily = exports.isDnsLookupIpVersion = void 0; +const conversionTable = { + auto: 0, + ipv4: 4, + ipv6: 6 +}; +exports.isDnsLookupIpVersion = (value) => { + return value in conversionTable; +}; +exports.dnsLookupIpVersionToFamily = (dnsLookupIpVersion) => { + if (exports.isDnsLookupIpVersion(dnsLookupIpVersion)) { + return conversionTable[dnsLookupIpVersion]; + } + throw new Error('Invalid DNS lookup IP version'); +}; - Object.defineProperty(exports, '__esModule', { value: true }); - const fs_1 = __nccwpck_require__(5747); - const util_1 = __nccwpck_require__(1669); - const is_1 = __nccwpck_require__(7678); - const is_form_data_1 = __nccwpck_require__(40); - const statAsync = util_1.promisify(fs_1.stat); - exports.default = async (body, headers) => { - if (headers && 'content-length' in headers) { - return Number(headers['content-length']); - } - if (!body) { - return 0; - } - if (is_1.default.string(body)) { - return Buffer.byteLength(body); - } - if (is_1.default.buffer(body)) { - return body.length; - } - if (is_form_data_1.default(body)) { - return util_1.promisify(body.getLength.bind(body))(); - } - if (body instanceof fs_1.ReadStream) { - const { size } = await statAsync(body.path); - if (size === 0) { + +/***/ }), + +/***/ 4564: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs_1 = __nccwpck_require__(5747); +const util_1 = __nccwpck_require__(1669); +const is_1 = __nccwpck_require__(7678); +const is_form_data_1 = __nccwpck_require__(40); +const statAsync = util_1.promisify(fs_1.stat); +exports.default = async (body, headers) => { + if (headers && 'content-length' in headers) { + return Number(headers['content-length']); + } + if (!body) { + return 0; + } + if (is_1.default.string(body)) { + return Buffer.byteLength(body); + } + if (is_1.default.buffer(body)) { + return body.length; + } + if (is_form_data_1.default(body)) { + return util_1.promisify(body.getLength.bind(body))(); + } + if (body instanceof fs_1.ReadStream) { + const { size } = await statAsync(body.path); + if (size === 0) { return undefined; - } - return size; } - return undefined; - }; + return size; + } + return undefined; +}; - /***/ - }, - /***/ 4500: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - // TODO: Update https://github.com/sindresorhus/get-stream - const getBuffer = async (stream) => { - const chunks = []; - let length = 0; - for await (const chunk of stream) { - chunks.push(chunk); - length += Buffer.byteLength(chunk); +/***/ 4500: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +// TODO: Update https://github.com/sindresorhus/get-stream +const getBuffer = async (stream) => { + const chunks = []; + let length = 0; + for await (const chunk of stream) { + chunks.push(chunk); + length += Buffer.byteLength(chunk); + } + if (Buffer.isBuffer(chunks[0])) { + return Buffer.concat(chunks, length); + } + return Buffer.from(chunks.join('')); +}; +exports.default = getBuffer; + + +/***/ }), + +/***/ 40: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const is_1 = __nccwpck_require__(7678); +exports.default = (body) => is_1.default.nodeStream(body) && is_1.default.function_(body.getBoundary); + + +/***/ }), + +/***/ 9298: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isResponseOk = void 0; +exports.isResponseOk = (response) => { + const { statusCode } = response; + const limitStatusCode = response.request.options.followRedirect ? 299 : 399; + return (statusCode >= 200 && statusCode <= limitStatusCode) || statusCode === 304; +}; + + +/***/ }), + +/***/ 9219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* istanbul ignore file: deprecated */ +const url_1 = __nccwpck_require__(8835); +const keys = [ + 'protocol', + 'host', + 'hostname', + 'port', + 'pathname', + 'search' +]; +exports.default = (origin, options) => { + var _a, _b; + if (options.path) { + if (options.pathname) { + throw new TypeError('Parameters `path` and `pathname` are mutually exclusive.'); } - if (Buffer.isBuffer(chunks[0])) { - return Buffer.concat(chunks, length); + if (options.search) { + throw new TypeError('Parameters `path` and `search` are mutually exclusive.'); } - return Buffer.from(chunks.join('')); - }; - exports.default = getBuffer; - - /***/ - }, - - /***/ 40: /***/ (__unused_webpack_module, exports, __nccwpck_require__) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - const is_1 = __nccwpck_require__(7678); - exports.default = (body) => - is_1.default.nodeStream(body) && - is_1.default.function_(body.getBoundary); - - /***/ - }, - - /***/ 9298: /***/ (__unused_webpack_module, exports) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - exports.isResponseOk = void 0; - exports.isResponseOk = (response) => { - const { statusCode } = response; - const limitStatusCode = response.request.options.followRedirect - ? 299 - : 399; - return ( - (statusCode >= 200 && statusCode <= limitStatusCode) || - statusCode === 304 - ); - }; - - /***/ - }, - - /***/ 9219: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - /* istanbul ignore file: deprecated */ - const url_1 = __nccwpck_require__(8835); - const keys = [ - 'protocol', - 'host', - 'hostname', - 'port', - 'pathname', - 'search', - ]; - exports.default = (origin, options) => { - var _a, _b; - if (options.path) { - if (options.pathname) { - throw new TypeError( - 'Parameters `path` and `pathname` are mutually exclusive.' - ); - } - if (options.search) { - throw new TypeError( - 'Parameters `path` and `search` are mutually exclusive.' - ); - } - if (options.searchParams) { - throw new TypeError( - 'Parameters `path` and `searchParams` are mutually exclusive.' - ); - } + if (options.searchParams) { + throw new TypeError('Parameters `path` and `searchParams` are mutually exclusive.'); } - if (options.search && options.searchParams) { - throw new TypeError( - 'Parameters `search` and `searchParams` are mutually exclusive.' - ); - } - if (!origin) { - if (!options.protocol) { + } + if (options.search && options.searchParams) { + throw new TypeError('Parameters `search` and `searchParams` are mutually exclusive.'); + } + if (!origin) { + if (!options.protocol) { throw new TypeError('No URL protocol specified'); - } - origin = `${options.protocol}//${ - (_b = - (_a = options.hostname) !== null && _a !== void 0 - ? _a - : options.host) !== null && _b !== void 0 - ? _b - : '' - }`; } - const url = new url_1.URL(origin); - if (options.path) { - const searchIndex = options.path.indexOf('?'); - if (searchIndex === -1) { + origin = `${options.protocol}//${(_b = (_a = options.hostname) !== null && _a !== void 0 ? _a : options.host) !== null && _b !== void 0 ? _b : ''}`; + } + const url = new url_1.URL(origin); + if (options.path) { + const searchIndex = options.path.indexOf('?'); + if (searchIndex === -1) { options.pathname = options.path; - } else { + } + else { options.pathname = options.path.slice(0, searchIndex); options.search = options.path.slice(searchIndex + 1); - } - delete options.path; } - for (const key of keys) { - if (options[key]) { + delete options.path; + } + for (const key of keys) { + if (options[key]) { url[key] = options[key].toString(); - } } - return url; - }; + } + return url; +}; - /***/ - }, - /***/ 3021: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - function default_1(from, to, events) { - const fns = {}; - for (const event of events) { - fns[event] = (...args) => { +/***/ 3021: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function default_1(from, to, events) { + const fns = {}; + for (const event of events) { + fns[event] = (...args) => { to.emit(event, ...args); - }; - from.on(event, fns[event]); - } - return () => { - for (const event of events) { + }; + from.on(event, fns[event]); + } + return () => { + for (const event of events) { from.off(event, fns[event]); - } - }; - } - exports.default = default_1; - - /***/ - }, - - /***/ 2454: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - exports.TimeoutError = void 0; - const net = __nccwpck_require__(1631); - const unhandle_1 = __nccwpck_require__(1593); - const reentry = Symbol('reentry'); - const noop = () => {}; - class TimeoutError extends Error { - constructor(threshold, event) { - super(`Timeout awaiting '${event}' for ${threshold}ms`); - this.event = event; - this.name = 'TimeoutError'; - this.code = 'ETIMEDOUT'; } - } - exports.TimeoutError = TimeoutError; - exports.default = (request, delays, options) => { - if (reentry in request) { - return noop; - } - request[reentry] = true; - const cancelers = []; - const { once, unhandleAll } = unhandle_1.default(); - const addTimeout = (delay, callback, event) => { - var _a; - const timeout = setTimeout(callback, delay, delay, event); - (_a = timeout.unref) === null || _a === void 0 - ? void 0 - : _a.call(timeout); - const cancel = () => { + }; +} +exports.default = default_1; + + +/***/ }), + +/***/ 2454: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TimeoutError = void 0; +const net = __nccwpck_require__(1631); +const unhandle_1 = __nccwpck_require__(1593); +const reentry = Symbol('reentry'); +const noop = () => { }; +class TimeoutError extends Error { + constructor(threshold, event) { + super(`Timeout awaiting '${event}' for ${threshold}ms`); + this.event = event; + this.name = 'TimeoutError'; + this.code = 'ETIMEDOUT'; + } +} +exports.TimeoutError = TimeoutError; +exports.default = (request, delays, options) => { + if (reentry in request) { + return noop; + } + request[reentry] = true; + const cancelers = []; + const { once, unhandleAll } = unhandle_1.default(); + const addTimeout = (delay, callback, event) => { + var _a; + const timeout = setTimeout(callback, delay, delay, event); + (_a = timeout.unref) === null || _a === void 0 ? void 0 : _a.call(timeout); + const cancel = () => { clearTimeout(timeout); - }; - cancelers.push(cancel); - return cancel; }; - const { host, hostname } = options; - const timeoutHandler = (delay, event) => { - request.destroy(new TimeoutError(delay, event)); - }; - const cancelTimeouts = () => { - for (const cancel of cancelers) { + cancelers.push(cancel); + return cancel; + }; + const { host, hostname } = options; + const timeoutHandler = (delay, event) => { + request.destroy(new TimeoutError(delay, event)); + }; + const cancelTimeouts = () => { + for (const cancel of cancelers) { cancel(); - } - unhandleAll(); - }; - request.once('error', (error) => { - cancelTimeouts(); - // Save original behavior - /* istanbul ignore next */ - if (request.listenerCount('error') === 0) { + } + unhandleAll(); + }; + request.once('error', error => { + cancelTimeouts(); + // Save original behavior + /* istanbul ignore next */ + if (request.listenerCount('error') === 0) { throw error; - } - }); - request.once('close', cancelTimeouts); - once(request, 'response', (response) => { - once(response, 'end', cancelTimeouts); - }); - if (typeof delays.request !== 'undefined') { - addTimeout(delays.request, timeoutHandler, 'request'); } - if (typeof delays.socket !== 'undefined') { - const socketTimeoutHandler = () => { + }); + request.once('close', cancelTimeouts); + once(request, 'response', (response) => { + once(response, 'end', cancelTimeouts); + }); + if (typeof delays.request !== 'undefined') { + addTimeout(delays.request, timeoutHandler, 'request'); + } + if (typeof delays.socket !== 'undefined') { + const socketTimeoutHandler = () => { timeoutHandler(delays.socket, 'socket'); - }; - request.setTimeout(delays.socket, socketTimeoutHandler); - // `request.setTimeout(0)` causes a memory leak. - // We can just remove the listener and forget about the timer - it's unreffed. - // See https://github.com/sindresorhus/got/issues/690 - cancelers.push(() => { + }; + request.setTimeout(delays.socket, socketTimeoutHandler); + // `request.setTimeout(0)` causes a memory leak. + // We can just remove the listener and forget about the timer - it's unreffed. + // See https://github.com/sindresorhus/got/issues/690 + cancelers.push(() => { request.removeListener('timeout', socketTimeoutHandler); - }); - } - once(request, 'socket', (socket) => { - var _a; - const { socketPath } = request; - /* istanbul ignore next: hard to test */ - if (socket.connecting) { - const hasPath = Boolean( - socketPath !== null && socketPath !== void 0 - ? socketPath - : net.isIP( - (_a = - hostname !== null && hostname !== void 0 - ? hostname - : host) !== null && _a !== void 0 - ? _a - : '' - ) !== 0 - ); - if ( - typeof delays.lookup !== 'undefined' && - !hasPath && - typeof socket.address().address === 'undefined' - ) { - const cancelTimeout = addTimeout( - delays.lookup, - timeoutHandler, - 'lookup' - ); - once(socket, 'lookup', cancelTimeout); + }); + } + once(request, 'socket', (socket) => { + var _a; + const { socketPath } = request; + /* istanbul ignore next: hard to test */ + if (socket.connecting) { + const hasPath = Boolean(socketPath !== null && socketPath !== void 0 ? socketPath : net.isIP((_a = hostname !== null && hostname !== void 0 ? hostname : host) !== null && _a !== void 0 ? _a : '') !== 0); + if (typeof delays.lookup !== 'undefined' && !hasPath && typeof socket.address().address === 'undefined') { + const cancelTimeout = addTimeout(delays.lookup, timeoutHandler, 'lookup'); + once(socket, 'lookup', cancelTimeout); } if (typeof delays.connect !== 'undefined') { - const timeConnect = () => - addTimeout(delays.connect, timeoutHandler, 'connect'); - if (hasPath) { - once(socket, 'connect', timeConnect()); - } else { - once(socket, 'lookup', (error) => { - if (error === null) { + const timeConnect = () => addTimeout(delays.connect, timeoutHandler, 'connect'); + if (hasPath) { once(socket, 'connect', timeConnect()); - } + } + else { + once(socket, 'lookup', (error) => { + if (error === null) { + once(socket, 'connect', timeConnect()); + } + }); + } + } + if (typeof delays.secureConnect !== 'undefined' && options.protocol === 'https:') { + once(socket, 'connect', () => { + const cancelTimeout = addTimeout(delays.secureConnect, timeoutHandler, 'secureConnect'); + once(socket, 'secureConnect', cancelTimeout); }); - } } - if ( - typeof delays.secureConnect !== 'undefined' && - options.protocol === 'https:' - ) { - once(socket, 'connect', () => { - const cancelTimeout = addTimeout( - delays.secureConnect, - timeoutHandler, - 'secureConnect' - ); - once(socket, 'secureConnect', cancelTimeout); - }); - } - } - if (typeof delays.send !== 'undefined') { - const timeRequest = () => - addTimeout(delays.send, timeoutHandler, 'send'); + } + if (typeof delays.send !== 'undefined') { + const timeRequest = () => addTimeout(delays.send, timeoutHandler, 'send'); /* istanbul ignore next: hard to test */ if (socket.connecting) { - once(socket, 'connect', () => { - once(request, 'upload-complete', timeRequest()); - }); - } else { - once(request, 'upload-complete', timeRequest()); + once(socket, 'connect', () => { + once(request, 'upload-complete', timeRequest()); + }); + } + else { + once(request, 'upload-complete', timeRequest()); } - } - }); - if (typeof delays.response !== 'undefined') { - once(request, 'upload-complete', () => { - const cancelTimeout = addTimeout( - delays.response, - timeoutHandler, - 'response' - ); - once(request, 'response', cancelTimeout); - }); } - return cancelTimeouts; - }; + }); + if (typeof delays.response !== 'undefined') { + once(request, 'upload-complete', () => { + const cancelTimeout = addTimeout(delays.response, timeoutHandler, 'response'); + once(request, 'response', cancelTimeout); + }); + } + return cancelTimeouts; +}; - /***/ - }, - /***/ 1593: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - // When attaching listeners, it's very easy to forget about them. - // Especially if you do error handling and set timeouts. - // So instead of checking if it's proper to throw an error on every timeout ever, - // use this simple tool which will remove all listeners you have attached. - exports.default = () => { - const handlers = []; - return { - once(origin, event, fn) { +/***/ 1593: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +// When attaching listeners, it's very easy to forget about them. +// Especially if you do error handling and set timeouts. +// So instead of checking if it's proper to throw an error on every timeout ever, +// use this simple tool which will remove all listeners you have attached. +exports.default = () => { + const handlers = []; + return { + once(origin, event, fn) { origin.once(event, fn); handlers.push({ origin, event, fn }); - }, - unhandleAll() { + }, + unhandleAll() { for (const handler of handlers) { - const { origin, event, fn } = handler; - origin.removeListener(event, fn); + const { origin, event, fn } = handler; + origin.removeListener(event, fn); } handlers.length = 0; - }, - }; - }; - - /***/ - }, - - /***/ 8026: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - const is_1 = __nccwpck_require__(7678); - exports.default = (url) => { - // Cast to URL - url = url; - const options = { - protocol: url.protocol, - hostname: - is_1.default.string(url.hostname) && url.hostname.startsWith('[') - ? url.hostname.slice(1, -1) - : url.hostname, - host: url.host, - hash: url.hash, - search: url.search, - pathname: url.pathname, - href: url.href, - path: `${url.pathname || ''}${url.search || ''}`, - }; - if (is_1.default.string(url.port) && url.port.length > 0) { - options.port = Number(url.port); } - if (url.username || url.password) { - options.auth = `${url.username || ''}:${url.password || ''}`; - } - return options; - }; + }; +}; - /***/ - }, - /***/ 7288: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - class WeakableMap { - constructor() { - this.weakMap = new WeakMap(); - this.map = new Map(); - } - set(key, value) { - if (typeof key === 'object') { +/***/ 8026: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const is_1 = __nccwpck_require__(7678); +exports.default = (url) => { + // Cast to URL + url = url; + const options = { + protocol: url.protocol, + hostname: is_1.default.string(url.hostname) && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, + host: url.host, + hash: url.hash, + search: url.search, + pathname: url.pathname, + href: url.href, + path: `${url.pathname || ''}${url.search || ''}` + }; + if (is_1.default.string(url.port) && url.port.length > 0) { + options.port = Number(url.port); + } + if (url.username || url.password) { + options.auth = `${url.username || ''}:${url.password || ''}`; + } + return options; +}; + + +/***/ }), + +/***/ 7288: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +class WeakableMap { + constructor() { + this.weakMap = new WeakMap(); + this.map = new Map(); + } + set(key, value) { + if (typeof key === 'object') { this.weakMap.set(key, value); - } else { + } + else { this.map.set(key, value); - } } - get(key) { - if (typeof key === 'object') { + } + get(key) { + if (typeof key === 'object') { return this.weakMap.get(key); - } - return this.map.get(key); } - has(key) { - if (typeof key === 'object') { + return this.map.get(key); + } + has(key) { + if (typeof key === 'object') { return this.weakMap.has(key); - } - return this.map.has(key); } - } - exports.default = WeakableMap; + return this.map.has(key); + } +} +exports.default = WeakableMap; - /***/ - }, - /***/ 4337: /***/ function ( - __unused_webpack_module, - 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 __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if ( - p !== 'default' && - !Object.prototype.hasOwnProperty.call(exports, p) - ) - __createBinding(exports, m, p); - }; - Object.defineProperty(exports, '__esModule', { value: true }); - exports.defaultHandler = void 0; - const is_1 = __nccwpck_require__(7678); - const as_promise_1 = __nccwpck_require__(6056); - const create_rejection_1 = __nccwpck_require__(6457); - const core_1 = __nccwpck_require__(94); - const deep_freeze_1 = __nccwpck_require__(285); - const errors = { - RequestError: as_promise_1.RequestError, - CacheError: as_promise_1.CacheError, - ReadError: as_promise_1.ReadError, - HTTPError: as_promise_1.HTTPError, - MaxRedirectsError: as_promise_1.MaxRedirectsError, - TimeoutError: as_promise_1.TimeoutError, - ParseError: as_promise_1.ParseError, - CancelError: as_promise_1.CancelError, - UnsupportedProtocolError: as_promise_1.UnsupportedProtocolError, - UploadError: as_promise_1.UploadError, - }; - // The `delay` package weighs 10KB (!) - const delay = async (ms) => - new Promise((resolve) => { - setTimeout(resolve, ms); - }); - const { normalizeArguments } = core_1.default; - const mergeOptions = (...sources) => { - let mergedOptions; - for (const source of sources) { - mergedOptions = normalizeArguments(undefined, source, mergedOptions); - } - return mergedOptions; - }; - const getPromiseOrStream = (options) => - options.isStream - ? new core_1.default(undefined, options) - : as_promise_1.default(options); - const isGotInstance = (value) => - 'defaults' in value && 'options' in value.defaults; - const aliases = ['get', 'post', 'put', 'patch', 'head', 'delete']; - exports.defaultHandler = (options, next) => next(options); - const callInitHooks = (hooks, options) => { - if (hooks) { - for (const hook of hooks) { +/***/ 4337: +/***/ (function(__unused_webpack_module, 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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.defaultHandler = void 0; +const is_1 = __nccwpck_require__(7678); +const as_promise_1 = __nccwpck_require__(6056); +const create_rejection_1 = __nccwpck_require__(6457); +const core_1 = __nccwpck_require__(94); +const deep_freeze_1 = __nccwpck_require__(285); +const errors = { + RequestError: as_promise_1.RequestError, + CacheError: as_promise_1.CacheError, + ReadError: as_promise_1.ReadError, + HTTPError: as_promise_1.HTTPError, + MaxRedirectsError: as_promise_1.MaxRedirectsError, + TimeoutError: as_promise_1.TimeoutError, + ParseError: as_promise_1.ParseError, + CancelError: as_promise_1.CancelError, + UnsupportedProtocolError: as_promise_1.UnsupportedProtocolError, + UploadError: as_promise_1.UploadError +}; +// The `delay` package weighs 10KB (!) +const delay = async (ms) => new Promise(resolve => { + setTimeout(resolve, ms); +}); +const { normalizeArguments } = core_1.default; +const mergeOptions = (...sources) => { + let mergedOptions; + for (const source of sources) { + mergedOptions = normalizeArguments(undefined, source, mergedOptions); + } + return mergedOptions; +}; +const getPromiseOrStream = (options) => options.isStream ? new core_1.default(undefined, options) : as_promise_1.default(options); +const isGotInstance = (value) => ('defaults' in value && 'options' in value.defaults); +const aliases = [ + 'get', + 'post', + 'put', + 'patch', + 'head', + 'delete' +]; +exports.defaultHandler = (options, next) => next(options); +const callInitHooks = (hooks, options) => { + if (hooks) { + for (const hook of hooks) { hook(options); - } } - }; - const create = (defaults) => { - // Proxy properties from next handlers - defaults._rawHandlers = defaults.handlers; - defaults.handlers = defaults.handlers.map((fn) => (options, next) => { - // This will be assigned by assigning result - let root; - const result = fn(options, (newOptions) => { + } +}; +const create = (defaults) => { + // Proxy properties from next handlers + defaults._rawHandlers = defaults.handlers; + defaults.handlers = defaults.handlers.map(fn => ((options, next) => { + // This will be assigned by assigning result + let root; + const result = fn(options, newOptions => { root = next(newOptions); return root; - }); - if (result !== root && !options.isStream && root) { + }); + if (result !== root && !options.isStream && root) { const typedResult = result; - const { - then: promiseThen, - catch: promiseCatch, - finally: promiseFianlly, - } = typedResult; + const { then: promiseThen, catch: promiseCatch, finally: promiseFianlly } = typedResult; Object.setPrototypeOf(typedResult, Object.getPrototypeOf(root)); - Object.defineProperties( - typedResult, - Object.getOwnPropertyDescriptors(root) - ); + Object.defineProperties(typedResult, Object.getOwnPropertyDescriptors(root)); // These should point to the new promise // eslint-disable-next-line promise/prefer-await-to-then typedResult.then = promiseThen; typedResult.catch = promiseCatch; typedResult.finally = promiseFianlly; - } - return result; - }); - // Got interface - const got = (url, options = {}, _defaults) => { - var _a, _b; - let iteration = 0; - const iterateHandlers = (newOptions) => { - return defaults.handlers[iteration++]( - newOptions, - iteration === defaults.handlers.length - ? getPromiseOrStream - : iterateHandlers - ); - }; - // TODO: Remove this in Got 12. - if (is_1.default.plainObject(url)) { + } + return result; + })); + // Got interface + const got = ((url, options = {}, _defaults) => { + var _a, _b; + let iteration = 0; + const iterateHandlers = (newOptions) => { + return defaults.handlers[iteration++](newOptions, iteration === defaults.handlers.length ? getPromiseOrStream : iterateHandlers); + }; + // TODO: Remove this in Got 12. + if (is_1.default.plainObject(url)) { const mergedOptions = { - ...url, - ...options, + ...url, + ...options }; core_1.setNonEnumerableProperties([url, options], mergedOptions); options = mergedOptions; url = undefined; - } - try { + } + try { // Call `init` hooks let initHookError; try { - callInitHooks(defaults.options.hooks.init, options); - callInitHooks( - (_a = options.hooks) === null || _a === void 0 - ? void 0 - : _a.init, - options - ); - } catch (error) { - initHookError = error; + callInitHooks(defaults.options.hooks.init, options); + callInitHooks((_a = options.hooks) === null || _a === void 0 ? void 0 : _a.init, options); + } + catch (error) { + initHookError = error; } // Normalize options & call handlers - const normalizedOptions = normalizeArguments( - url, - options, - _defaults !== null && _defaults !== void 0 - ? _defaults - : defaults.options - ); + const normalizedOptions = normalizeArguments(url, options, _defaults !== null && _defaults !== void 0 ? _defaults : defaults.options); normalizedOptions[core_1.kIsNormalizedAlready] = true; if (initHookError) { - throw new as_promise_1.RequestError( - initHookError.message, - initHookError, - normalizedOptions - ); + throw new as_promise_1.RequestError(initHookError.message, initHookError, normalizedOptions); } return iterateHandlers(normalizedOptions); - } catch (error) { + } + catch (error) { if (options.isStream) { - throw error; - } else { - return create_rejection_1.default( - error, - defaults.options.hooks.beforeError, - (_b = options.hooks) === null || _b === void 0 - ? void 0 - : _b.beforeError - ); + throw error; } - } - }; - got.extend = (...instancesOrOptions) => { - const optionsArray = [defaults.options]; - let handlers = [...defaults._rawHandlers]; - let isMutableDefaults; - for (const value of instancesOrOptions) { + else { + return create_rejection_1.default(error, defaults.options.hooks.beforeError, (_b = options.hooks) === null || _b === void 0 ? void 0 : _b.beforeError); + } + } + }); + got.extend = (...instancesOrOptions) => { + const optionsArray = [defaults.options]; + let handlers = [...defaults._rawHandlers]; + let isMutableDefaults; + for (const value of instancesOrOptions) { if (isGotInstance(value)) { - optionsArray.push(value.defaults.options); - handlers.push(...value.defaults._rawHandlers); - isMutableDefaults = value.defaults.mutableDefaults; - } else { - optionsArray.push(value); - if ('handlers' in value) { - handlers.push(...value.handlers); - } - isMutableDefaults = value.mutableDefaults; + optionsArray.push(value.defaults.options); + handlers.push(...value.defaults._rawHandlers); + isMutableDefaults = value.defaults.mutableDefaults; } - } - handlers = handlers.filter( - (handler) => handler !== exports.defaultHandler - ); - if (handlers.length === 0) { + else { + optionsArray.push(value); + if ('handlers' in value) { + handlers.push(...value.handlers); + } + isMutableDefaults = value.mutableDefaults; + } + } + handlers = handlers.filter(handler => handler !== exports.defaultHandler); + if (handlers.length === 0) { handlers.push(exports.defaultHandler); - } - return create({ + } + return create({ options: mergeOptions(...optionsArray), handlers, - mutableDefaults: Boolean(isMutableDefaults), - }); - }; - // Pagination - const paginateEach = async function* (url, options) { - // TODO: Remove this `@ts-expect-error` when upgrading to TypeScript 4. - // Error: Argument of type 'Merge> | undefined' is not assignable to parameter of type 'Options | undefined'. - // @ts-expect-error - let normalizedOptions = normalizeArguments( - url, - options, - defaults.options - ); - normalizedOptions.resolveBodyOnly = false; - const pagination = normalizedOptions.pagination; - if (!is_1.default.object(pagination)) { + mutableDefaults: Boolean(isMutableDefaults) + }); + }; + // Pagination + const paginateEach = (async function* (url, options) { + // TODO: Remove this `@ts-expect-error` when upgrading to TypeScript 4. + // Error: Argument of type 'Merge> | undefined' is not assignable to parameter of type 'Options | undefined'. + // @ts-expect-error + let normalizedOptions = normalizeArguments(url, options, defaults.options); + normalizedOptions.resolveBodyOnly = false; + const pagination = normalizedOptions.pagination; + if (!is_1.default.object(pagination)) { throw new TypeError('`options.pagination` must be implemented'); - } - const all = []; - let { countLimit } = pagination; - let numberOfRequests = 0; - while (numberOfRequests < pagination.requestLimit) { + } + const all = []; + let { countLimit } = pagination; + let numberOfRequests = 0; + while (numberOfRequests < pagination.requestLimit) { if (numberOfRequests !== 0) { - // eslint-disable-next-line no-await-in-loop - await delay(pagination.backoff); + // eslint-disable-next-line no-await-in-loop + await delay(pagination.backoff); } // @ts-expect-error FIXME! // TODO: Throw when result is not an instance of Response // eslint-disable-next-line no-await-in-loop - const result = await got(undefined, undefined, normalizedOptions); + const result = (await got(undefined, undefined, normalizedOptions)); // eslint-disable-next-line no-await-in-loop const parsed = await pagination.transform(result); const current = []; for (const item of parsed) { - if (pagination.filter(item, all, current)) { - if (!pagination.shouldContinue(item, all, current)) { - return; + if (pagination.filter(item, all, current)) { + if (!pagination.shouldContinue(item, all, current)) { + return; + } + yield item; + if (pagination.stackAllItems) { + all.push(item); + } + current.push(item); + if (--countLimit <= 0) { + return; + } } - yield item; - if (pagination.stackAllItems) { - all.push(item); - } - current.push(item); - if (--countLimit <= 0) { - return; - } - } } const optionsToMerge = pagination.paginate(result, all, current); if (optionsToMerge === false) { - return; + return; } if (optionsToMerge === result.request.options) { - normalizedOptions = result.request.options; - } else if (optionsToMerge !== undefined) { - normalizedOptions = normalizeArguments( - undefined, - optionsToMerge, - normalizedOptions - ); + normalizedOptions = result.request.options; + } + else if (optionsToMerge !== undefined) { + normalizedOptions = normalizeArguments(undefined, optionsToMerge, normalizedOptions); } numberOfRequests++; - } - }; - got.paginate = paginateEach; - got.paginate.all = async (url, options) => { - const results = []; - for await (const item of paginateEach(url, options)) { - results.push(item); - } - return results; - }; - // For those who like very descriptive names - got.paginate.each = paginateEach; - // Stream API - got.stream = (url, options) => got(url, { ...options, isStream: true }); - // Shortcuts - for (const method of aliases) { - got[method] = (url, options) => got(url, { ...options, method }); - got.stream[method] = (url, options) => { - return got(url, { ...options, method, isStream: true }); - }; } - Object.assign(got, errors); - Object.defineProperty(got, 'defaults', { - value: defaults.mutableDefaults - ? defaults - : deep_freeze_1.default(defaults), - writable: defaults.mutableDefaults, - configurable: defaults.mutableDefaults, - enumerable: true, + }); + got.paginate = paginateEach; + got.paginate.all = (async (url, options) => { + const results = []; + for await (const item of paginateEach(url, options)) { + results.push(item); + } + return results; + }); + // For those who like very descriptive names + got.paginate.each = paginateEach; + // Stream API + got.stream = ((url, options) => got(url, { ...options, isStream: true })); + // Shortcuts + for (const method of aliases) { + got[method] = ((url, options) => got(url, { ...options, method })); + got.stream[method] = ((url, options) => { + return got(url, { ...options, method, isStream: true }); }); - got.mergeOptions = mergeOptions; - return got; - }; - exports.default = create; - __exportStar(__nccwpck_require__(2613), exports); + } + Object.assign(got, errors); + Object.defineProperty(got, 'defaults', { + value: defaults.mutableDefaults ? defaults : deep_freeze_1.default(defaults), + writable: defaults.mutableDefaults, + configurable: defaults.mutableDefaults, + enumerable: true + }); + got.mergeOptions = mergeOptions; + return got; +}; +exports.default = create; +__exportStar(__nccwpck_require__(2613), exports); - /***/ - }, - /***/ 3061: /***/ function (module, 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 __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if ( - p !== 'default' && - !Object.prototype.hasOwnProperty.call(exports, p) - ) - __createBinding(exports, m, p); - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const url_1 = __nccwpck_require__(8835); - const create_1 = __nccwpck_require__(4337); - const defaults = { - options: { - method: 'GET', - retry: { +/***/ 3061: +/***/ (function(module, 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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const url_1 = __nccwpck_require__(8835); +const create_1 = __nccwpck_require__(4337); +const defaults = { + options: { + method: 'GET', + retry: { limit: 2, - methods: ['GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE'], - statusCodes: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], + methods: [ + 'GET', + 'PUT', + 'HEAD', + 'DELETE', + 'OPTIONS', + 'TRACE' + ], + statusCodes: [ + 408, + 413, + 429, + 500, + 502, + 503, + 504, + 521, + 522, + 524 + ], errorCodes: [ - 'ETIMEDOUT', - 'ECONNRESET', - 'EADDRINUSE', - 'ECONNREFUSED', - 'EPIPE', - 'ENOTFOUND', - 'ENETUNREACH', - 'EAI_AGAIN', + 'ETIMEDOUT', + 'ECONNRESET', + 'EADDRINUSE', + 'ECONNREFUSED', + 'EPIPE', + 'ENOTFOUND', + 'ENETUNREACH', + 'EAI_AGAIN' ], maxRetryAfter: undefined, - calculateDelay: ({ computedValue }) => computedValue, - }, - timeout: {}, - headers: { - 'user-agent': 'got (https://github.com/sindresorhus/got)', - }, - hooks: { + calculateDelay: ({ computedValue }) => computedValue + }, + timeout: {}, + headers: { + 'user-agent': 'got (https://github.com/sindresorhus/got)' + }, + hooks: { init: [], beforeRequest: [], beforeRedirect: [], beforeRetry: [], beforeError: [], - afterResponse: [], - }, - cache: undefined, - dnsCache: undefined, - decompress: true, - throwHttpErrors: true, - followRedirect: true, - isStream: false, - responseType: 'text', - resolveBodyOnly: false, - maxRedirects: 10, - prefixUrl: '', - methodRewriting: true, - ignoreInvalidCookies: false, - context: {}, - // TODO: Set this to `true` when Got 12 gets released - http2: false, - allowGetBody: false, - https: undefined, - pagination: { + afterResponse: [] + }, + cache: undefined, + dnsCache: undefined, + decompress: true, + throwHttpErrors: true, + followRedirect: true, + isStream: false, + responseType: 'text', + resolveBodyOnly: false, + maxRedirects: 10, + prefixUrl: '', + methodRewriting: true, + ignoreInvalidCookies: false, + context: {}, + // TODO: Set this to `true` when Got 12 gets released + http2: false, + allowGetBody: false, + https: undefined, + pagination: { transform: (response) => { - if (response.request.options.responseType === 'json') { - return response.body; - } - return JSON.parse(response.body); - }, - paginate: (response) => { - if (!Reflect.has(response.headers, 'link')) { - return false; - } - const items = response.headers.link.split(','); - let next; - for (const item of items) { - const parsed = item.split(';'); - if (parsed[1].includes('next')) { - next = parsed[0].trimStart().trim(); - next = next.slice(1, -1); - break; + if (response.request.options.responseType === 'json') { + return response.body; } - } - if (next) { - const options = { - url: new url_1.URL(next), - }; - return options; - } - return false; + return JSON.parse(response.body); + }, + paginate: response => { + if (!Reflect.has(response.headers, 'link')) { + return false; + } + const items = response.headers.link.split(','); + let next; + for (const item of items) { + const parsed = item.split(';'); + if (parsed[1].includes('next')) { + next = parsed[0].trimStart().trim(); + next = next.slice(1, -1); + break; + } + } + if (next) { + const options = { + url: new url_1.URL(next) + }; + return options; + } + return false; }, filter: () => true, shouldContinue: () => true, countLimit: Infinity, backoff: 0, requestLimit: 10000, - stackAllItems: true, - }, - parseJson: (text) => JSON.parse(text), - stringifyJson: (object) => JSON.stringify(object), - cacheOptions: {}, + stackAllItems: true }, - handlers: [create_1.defaultHandler], - mutableDefaults: false, - }; - const got = create_1.default(defaults); - exports.default = got; - // For CommonJS default export support - module.exports = got; - module.exports.default = got; - module.exports.__esModule = true; // Workaround for TS issue: https://github.com/sindresorhus/got/pull/1267 - __exportStar(__nccwpck_require__(4337), exports); - __exportStar(__nccwpck_require__(6056), exports); - - /***/ + parseJson: (text) => JSON.parse(text), + stringifyJson: (object) => JSON.stringify(object), + cacheOptions: {} }, + handlers: [create_1.defaultHandler], + mutableDefaults: false +}; +const got = create_1.default(defaults); +exports.default = got; +// For CommonJS default export support +module.exports = got; +module.exports.default = got; +module.exports.__esModule = true; // Workaround for TS issue: https://github.com/sindresorhus/got/pull/1267 +__exportStar(__nccwpck_require__(4337), exports); +__exportStar(__nccwpck_require__(6056), exports); - /***/ 2613: /***/ (__unused_webpack_module, exports) => { - 'use strict'; - Object.defineProperty(exports, '__esModule', { value: true }); +/***/ }), - /***/ - }, +/***/ 2613: +/***/ ((__unused_webpack_module, exports) => { - /***/ 285: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; +"use strict"; - Object.defineProperty(exports, '__esModule', { value: true }); - const is_1 = __nccwpck_require__(7678); - function deepFreeze(object) { - for (const value of Object.values(object)) { - if (is_1.default.plainObject(value) || is_1.default.array(value)) { +Object.defineProperty(exports, "__esModule", ({ value: true })); + + +/***/ }), + +/***/ 285: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const is_1 = __nccwpck_require__(7678); +function deepFreeze(object) { + for (const value of Object.values(object)) { + if (is_1.default.plainObject(value) || is_1.default.array(value)) { deepFreeze(value); - } } - return Object.freeze(object); - } - exports.default = deepFreeze; + } + return Object.freeze(object); +} +exports.default = deepFreeze; - /***/ - }, - /***/ 397: /***/ (__unused_webpack_module, exports) => { - 'use strict'; +/***/ }), - Object.defineProperty(exports, '__esModule', { value: true }); - const alreadyWarned = new Set(); - exports.default = (message) => { - if (alreadyWarned.has(message)) { - return; - } - alreadyWarned.add(message); - // @ts-expect-error Missing types. - process.emitWarning(`Got: ${message}`, { - type: 'DeprecationWarning', - }); - }; +/***/ 397: +/***/ ((__unused_webpack_module, exports) => { - /***/ - }, +"use strict"; - /***/ 1002: /***/ (module) => { - 'use strict'; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const alreadyWarned = new Set(); +exports.default = (message) => { + if (alreadyWarned.has(message)) { + return; + } + alreadyWarned.add(message); + // @ts-expect-error Missing types. + process.emitWarning(`Got: ${message}`, { + type: 'DeprecationWarning' + }); +}; - // rfc7231 6.1 - const statusCodeCacheableByDefault = new Set([ - 200, - 203, - 204, - 206, - 300, - 301, - 404, - 405, - 410, - 414, - 501, - ]); - // This implementation does not understand partial responses (206) - const understoodStatuses = new Set([ - 200, - 203, - 204, - 300, - 301, - 302, - 303, - 307, - 308, - 404, - 405, - 410, - 414, - 501, - ]); +/***/ }), - const errorStatusCodes = new Set([500, 502, 503, 504]); +/***/ 1002: +/***/ ((module) => { - const hopByHopHeaders = { - date: true, // included, because we add Age update Date - connection: true, - 'keep-alive': true, - 'proxy-authenticate': true, - 'proxy-authorization': true, - te: true, - trailer: true, - 'transfer-encoding': true, - upgrade: true, - }; +"use strict"; - const excludedFromRevalidationUpdate = { - // Since the old body is reused, it doesn't make sense to change properties of the body - 'content-length': true, - 'content-encoding': true, - 'transfer-encoding': true, - 'content-range': true, - }; +// rfc7231 6.1 +const statusCodeCacheableByDefault = new Set([ + 200, + 203, + 204, + 206, + 300, + 301, + 404, + 405, + 410, + 414, + 501, +]); - function toNumberOrZero(s) { - const n = parseInt(s, 10); - return isFinite(n) ? n : 0; - } +// This implementation does not understand partial responses (206) +const understoodStatuses = new Set([ + 200, + 203, + 204, + 300, + 301, + 302, + 303, + 307, + 308, + 404, + 405, + 410, + 414, + 501, +]); - // RFC 5861 - function isErrorResponse(response) { - // consider undefined response as faulty - if (!response) { - return true; - } - return errorStatusCodes.has(response.status); - } +const errorStatusCodes = new Set([ + 500, + 502, + 503, + 504, +]); - function parseCacheControl(header) { - const cc = {}; - if (!header) return cc; +const hopByHopHeaders = { + date: true, // included, because we add Age update Date + connection: true, + 'keep-alive': true, + 'proxy-authenticate': true, + 'proxy-authorization': true, + te: true, + trailer: true, + 'transfer-encoding': true, + upgrade: true, +}; - // TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives), - // the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale - const parts = header.trim().split(/\s*,\s*/); // TODO: lame parsing - for (const part of parts) { - const [k, v] = part.split(/\s*=\s*/, 2); - cc[k] = v === undefined ? true : v.replace(/^"|"$/g, ''); // TODO: lame unquoting - } +const excludedFromRevalidationUpdate = { + // Since the old body is reused, it doesn't make sense to change properties of the body + 'content-length': true, + 'content-encoding': true, + 'transfer-encoding': true, + 'content-range': true, +}; - return cc; - } +function toNumberOrZero(s) { + const n = parseInt(s, 10); + return isFinite(n) ? n : 0; +} - function formatCacheControl(cc) { - let parts = []; - for (const k in cc) { - const v = cc[k]; - parts.push(v === true ? k : k + '=' + v); - } - if (!parts.length) { - return undefined; - } - return parts.join(', '); - } +// RFC 5861 +function isErrorResponse(response) { + // consider undefined response as faulty + if(!response) { + return true + } + return errorStatusCodes.has(response.status); +} - module.exports = class CachePolicy { - constructor( - req, - res, - { +function parseCacheControl(header) { + const cc = {}; + if (!header) return cc; + + // TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives), + // the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale + const parts = header.trim().split(/\s*,\s*/); // TODO: lame parsing + for (const part of parts) { + const [k, v] = part.split(/\s*=\s*/, 2); + cc[k] = v === undefined ? true : v.replace(/^"|"$/g, ''); // TODO: lame unquoting + } + + return cc; +} + +function formatCacheControl(cc) { + let parts = []; + for (const k in cc) { + const v = cc[k]; + parts.push(v === true ? k : k + '=' + v); + } + if (!parts.length) { + return undefined; + } + return parts.join(', '); +} + +module.exports = class CachePolicy { + constructor( + req, + res, + { shared, cacheHeuristic, immutableMinTimeToLive, ignoreCargoCult, _fromObject, - } = {} - ) { - if (_fromObject) { + } = {} + ) { + if (_fromObject) { this._fromObject(_fromObject); return; - } + } - if (!res || !res.headers) { + if (!res || !res.headers) { throw Error('Response headers missing'); - } - this._assertRequestHasHeaders(req); + } + this._assertRequestHasHeaders(req); - this._responseTime = this.now(); - this._isShared = shared !== false; - this._cacheHeuristic = + this._responseTime = this.now(); + this._isShared = shared !== false; + this._cacheHeuristic = undefined !== cacheHeuristic ? cacheHeuristic : 0.1; // 10% matches IE - this._immutableMinTtl = + this._immutableMinTtl = undefined !== immutableMinTimeToLive - ? immutableMinTimeToLive - : 24 * 3600 * 1000; + ? immutableMinTimeToLive + : 24 * 3600 * 1000; - this._status = 'status' in res ? res.status : 200; - this._resHeaders = res.headers; - this._rescc = parseCacheControl(res.headers['cache-control']); - this._method = 'method' in req ? req.method : 'GET'; - this._url = req.url; - this._host = req.headers.host; - this._noAuthorization = !req.headers.authorization; - this._reqHeaders = res.headers.vary ? req.headers : null; // Don't keep all request headers if they won't be used - this._reqcc = parseCacheControl(req.headers['cache-control']); + this._status = 'status' in res ? res.status : 200; + this._resHeaders = res.headers; + this._rescc = parseCacheControl(res.headers['cache-control']); + this._method = 'method' in req ? req.method : 'GET'; + this._url = req.url; + this._host = req.headers.host; + this._noAuthorization = !req.headers.authorization; + this._reqHeaders = res.headers.vary ? req.headers : null; // Don't keep all request headers if they won't be used + this._reqcc = parseCacheControl(req.headers['cache-control']); - // Assume that if someone uses legacy, non-standard uncecessary options they don't understand caching, - // so there's no point stricly adhering to the blindly copy&pasted directives. - if ( + // Assume that if someone uses legacy, non-standard uncecessary options they don't understand caching, + // so there's no point stricly adhering to the blindly copy&pasted directives. + if ( ignoreCargoCult && 'pre-check' in this._rescc && 'post-check' in this._rescc - ) { + ) { delete this._rescc['pre-check']; delete this._rescc['post-check']; delete this._rescc['no-cache']; delete this._rescc['no-store']; delete this._rescc['must-revalidate']; this._resHeaders = Object.assign({}, this._resHeaders, { - 'cache-control': formatCacheControl(this._rescc), + 'cache-control': formatCacheControl(this._rescc), }); delete this._resHeaders.expires; delete this._resHeaders.pragma; - } + } - // When the Cache-Control header field is not present in a request, caches MUST consider the no-cache request pragma-directive - // as having the same effect as if "Cache-Control: no-cache" were present (see Section 5.2.1). - if ( + // When the Cache-Control header field is not present in a request, caches MUST consider the no-cache request pragma-directive + // as having the same effect as if "Cache-Control: no-cache" were present (see Section 5.2.1). + if ( res.headers['cache-control'] == null && /no-cache/.test(res.headers.pragma) - ) { + ) { this._rescc['no-cache'] = true; - } } + } - now() { - return Date.now(); - } + now() { + return Date.now(); + } - storable() { - // The "no-store" request directive indicates that a cache MUST NOT store any part of either this request or any response to it. - return !!( + storable() { + // The "no-store" request directive indicates that a cache MUST NOT store any part of either this request or any response to it. + return !!( !this._reqcc['no-store'] && // A cache MUST NOT store a response to any request, unless: // The request method is understood by the cache and defined as being cacheable, and ('GET' === this._method || - 'HEAD' === this._method || - ('POST' === this._method && this._hasExplicitExpiration())) && + 'HEAD' === this._method || + ('POST' === this._method && this._hasExplicitExpiration())) && // the response status code is understood by the cache, and understoodStatuses.has(this._status) && // the "no-store" cache directive does not appear in request or response header fields, and @@ -8942,318 +7712,305 @@ An error to be thrown when given an unsupported protocol. (!this._isShared || !this._rescc.private) && // the Authorization header field does not appear in the request, if the cache is shared, (!this._isShared || - this._noAuthorization || - this._allowsStoringAuthenticated()) && + this._noAuthorization || + this._allowsStoringAuthenticated()) && // the response either: // contains an Expires header field, or (this._resHeaders.expires || - // contains a max-age response directive, or - // contains a s-maxage response directive and the cache is shared, or - // contains a public response directive. - this._rescc['max-age'] || - (this._isShared && this._rescc['s-maxage']) || - this._rescc.public || - // has a status code that is defined as cacheable by default - statusCodeCacheableByDefault.has(this._status)) - ); - } + // contains a max-age response directive, or + // contains a s-maxage response directive and the cache is shared, or + // contains a public response directive. + this._rescc['max-age'] || + (this._isShared && this._rescc['s-maxage']) || + this._rescc.public || + // has a status code that is defined as cacheable by default + statusCodeCacheableByDefault.has(this._status)) + ); + } - _hasExplicitExpiration() { - // 4.2.1 Calculating Freshness Lifetime - return ( + _hasExplicitExpiration() { + // 4.2.1 Calculating Freshness Lifetime + return ( (this._isShared && this._rescc['s-maxage']) || this._rescc['max-age'] || this._resHeaders.expires - ); - } + ); + } - _assertRequestHasHeaders(req) { - if (!req || !req.headers) { + _assertRequestHasHeaders(req) { + if (!req || !req.headers) { throw Error('Request headers missing'); - } + } + } + + satisfiesWithoutRevalidation(req) { + this._assertRequestHasHeaders(req); + + // When presented with a request, a cache MUST NOT reuse a stored response, unless: + // the presented request does not contain the no-cache pragma (Section 5.4), nor the no-cache cache directive, + // unless the stored response is successfully validated (Section 4.3), and + const requestCC = parseCacheControl(req.headers['cache-control']); + if (requestCC['no-cache'] || /no-cache/.test(req.headers.pragma)) { + return false; } - satisfiesWithoutRevalidation(req) { - this._assertRequestHasHeaders(req); - - // When presented with a request, a cache MUST NOT reuse a stored response, unless: - // the presented request does not contain the no-cache pragma (Section 5.4), nor the no-cache cache directive, - // unless the stored response is successfully validated (Section 4.3), and - const requestCC = parseCacheControl(req.headers['cache-control']); - if (requestCC['no-cache'] || /no-cache/.test(req.headers.pragma)) { + if (requestCC['max-age'] && this.age() > requestCC['max-age']) { return false; - } + } - if (requestCC['max-age'] && this.age() > requestCC['max-age']) { - return false; - } - - if ( + if ( requestCC['min-fresh'] && this.timeToLive() < 1000 * requestCC['min-fresh'] - ) { + ) { return false; - } - - // the stored response is either: - // fresh, or allowed to be served stale - if (this.stale()) { - const allowsStale = - requestCC['max-stale'] && - !this._rescc['must-revalidate'] && - (true === requestCC['max-stale'] || - requestCC['max-stale'] > this.age() - this.maxAge()); - if (!allowsStale) { - return false; - } - } - - return this._requestMatches(req, false); } - _requestMatches(req, allowHeadMethod) { - // The presented effective request URI and that of the stored response match, and - return ( + // the stored response is either: + // fresh, or allowed to be served stale + if (this.stale()) { + const allowsStale = + requestCC['max-stale'] && + !this._rescc['must-revalidate'] && + (true === requestCC['max-stale'] || + requestCC['max-stale'] > this.age() - this.maxAge()); + if (!allowsStale) { + return false; + } + } + + return this._requestMatches(req, false); + } + + _requestMatches(req, allowHeadMethod) { + // The presented effective request URI and that of the stored response match, and + return ( (!this._url || this._url === req.url) && this._host === req.headers.host && // the request method associated with the stored response allows it to be used for the presented request, and (!req.method || - this._method === req.method || - (allowHeadMethod && 'HEAD' === req.method)) && + this._method === req.method || + (allowHeadMethod && 'HEAD' === req.method)) && // selecting header fields nominated by the stored response (if any) match those presented, and this._varyMatches(req) - ); - } + ); + } - _allowsStoringAuthenticated() { - // following Cache-Control response directives (Section 5.2.2) have such an effect: must-revalidate, public, and s-maxage. - return ( + _allowsStoringAuthenticated() { + // following Cache-Control response directives (Section 5.2.2) have such an effect: must-revalidate, public, and s-maxage. + return ( this._rescc['must-revalidate'] || this._rescc.public || this._rescc['s-maxage'] - ); + ); + } + + _varyMatches(req) { + if (!this._resHeaders.vary) { + return true; } - _varyMatches(req) { - if (!this._resHeaders.vary) { - return true; - } - - // A Vary header field-value of "*" always fails to match - if (this._resHeaders.vary === '*') { + // A Vary header field-value of "*" always fails to match + if (this._resHeaders.vary === '*') { return false; - } + } - const fields = this._resHeaders.vary + const fields = this._resHeaders.vary .trim() .toLowerCase() .split(/\s*,\s*/); - for (const name of fields) { + for (const name of fields) { if (req.headers[name] !== this._reqHeaders[name]) return false; - } - return true; } + return true; + } - _copyWithoutHopByHopHeaders(inHeaders) { - const headers = {}; - for (const name in inHeaders) { + _copyWithoutHopByHopHeaders(inHeaders) { + const headers = {}; + for (const name in inHeaders) { if (hopByHopHeaders[name]) continue; headers[name] = inHeaders[name]; - } - // 9.1. Connection - if (inHeaders.connection) { + } + // 9.1. Connection + if (inHeaders.connection) { const tokens = inHeaders.connection.trim().split(/\s*,\s*/); for (const name of tokens) { - delete headers[name]; + delete headers[name]; } - } - if (headers.warning) { - const warnings = headers.warning.split(/,/).filter((warning) => { - return !/^\s*1[0-9][0-9]/.test(warning); + } + if (headers.warning) { + const warnings = headers.warning.split(/,/).filter(warning => { + return !/^\s*1[0-9][0-9]/.test(warning); }); if (!warnings.length) { - delete headers.warning; + delete headers.warning; } else { - headers.warning = warnings.join(',').trim(); + headers.warning = warnings.join(',').trim(); } - } - return headers; } + return headers; + } - responseHeaders() { - const headers = this._copyWithoutHopByHopHeaders(this._resHeaders); - const age = this.age(); + responseHeaders() { + const headers = this._copyWithoutHopByHopHeaders(this._resHeaders); + const age = this.age(); - // A cache SHOULD generate 113 warning if it heuristically chose a freshness - // lifetime greater than 24 hours and the response's age is greater than 24 hours. - if ( + // A cache SHOULD generate 113 warning if it heuristically chose a freshness + // lifetime greater than 24 hours and the response's age is greater than 24 hours. + if ( age > 3600 * 24 && !this._hasExplicitExpiration() && this.maxAge() > 3600 * 24 - ) { + ) { headers.warning = - (headers.warning ? `${headers.warning}, ` : '') + - '113 - "rfc7234 5.5.4"'; - } - headers.age = `${Math.round(age)}`; - headers.date = new Date(this.now()).toUTCString(); - return headers; + (headers.warning ? `${headers.warning}, ` : '') + + '113 - "rfc7234 5.5.4"'; } + headers.age = `${Math.round(age)}`; + headers.date = new Date(this.now()).toUTCString(); + return headers; + } - /** - * Value of the Date response header or current time if Date was invalid - * @return timestamp - */ - date() { - const serverDate = Date.parse(this._resHeaders.date); - if (isFinite(serverDate)) { + /** + * Value of the Date response header or current time if Date was invalid + * @return timestamp + */ + date() { + const serverDate = Date.parse(this._resHeaders.date); + if (isFinite(serverDate)) { return serverDate; - } - return this._responseTime; } + return this._responseTime; + } - /** - * Value of the Age header, in seconds, updated for the current time. - * May be fractional. - * - * @return Number - */ - age() { - let age = this._ageValue(); + /** + * Value of the Age header, in seconds, updated for the current time. + * May be fractional. + * + * @return Number + */ + age() { + let age = this._ageValue(); - const residentTime = (this.now() - this._responseTime) / 1000; - return age + residentTime; - } + const residentTime = (this.now() - this._responseTime) / 1000; + return age + residentTime; + } - _ageValue() { - return toNumberOrZero(this._resHeaders.age); - } + _ageValue() { + return toNumberOrZero(this._resHeaders.age); + } - /** - * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. - * - * For an up-to-date value, see `timeToLive()`. - * - * @return Number - */ - maxAge() { - if (!this.storable() || this._rescc['no-cache']) { + /** + * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. + * + * For an up-to-date value, see `timeToLive()`. + * + * @return Number + */ + maxAge() { + if (!this.storable() || this._rescc['no-cache']) { return 0; - } + } - // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default - // so this implementation requires explicit opt-in via public header - if ( + // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default + // so this implementation requires explicit opt-in via public header + if ( this._isShared && - this._resHeaders['set-cookie'] && - !this._rescc.public && - !this._rescc.immutable - ) { + (this._resHeaders['set-cookie'] && + !this._rescc.public && + !this._rescc.immutable) + ) { return 0; - } + } - if (this._resHeaders.vary === '*') { + if (this._resHeaders.vary === '*') { return 0; - } + } - if (this._isShared) { + if (this._isShared) { if (this._rescc['proxy-revalidate']) { - return 0; + return 0; } // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field. if (this._rescc['s-maxage']) { - return toNumberOrZero(this._rescc['s-maxage']); + return toNumberOrZero(this._rescc['s-maxage']); } - } + } - // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field. - if (this._rescc['max-age']) { + // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field. + if (this._rescc['max-age']) { return toNumberOrZero(this._rescc['max-age']); - } + } - const defaultMinTtl = this._rescc.immutable - ? this._immutableMinTtl - : 0; + const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0; - const serverDate = this.date(); - if (this._resHeaders.expires) { + const serverDate = this.date(); + if (this._resHeaders.expires) { const expires = Date.parse(this._resHeaders.expires); // A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired"). if (Number.isNaN(expires) || expires < serverDate) { - return 0; + return 0; } return Math.max(defaultMinTtl, (expires - serverDate) / 1000); - } + } - if (this._resHeaders['last-modified']) { + if (this._resHeaders['last-modified']) { const lastModified = Date.parse(this._resHeaders['last-modified']); if (isFinite(lastModified) && serverDate > lastModified) { - return Math.max( - defaultMinTtl, - ((serverDate - lastModified) / 1000) * this._cacheHeuristic - ); + return Math.max( + defaultMinTtl, + ((serverDate - lastModified) / 1000) * this._cacheHeuristic + ); } - } - - return defaultMinTtl; } - timeToLive() { - const age = this.maxAge() - this.age(); - const staleIfErrorAge = - age + toNumberOrZero(this._rescc['stale-if-error']); - const staleWhileRevalidateAge = - age + toNumberOrZero(this._rescc['stale-while-revalidate']); - return ( - Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1000 - ); - } + return defaultMinTtl; + } - stale() { - return this.maxAge() <= this.age(); - } + timeToLive() { + const age = this.maxAge() - this.age(); + const staleIfErrorAge = age + toNumberOrZero(this._rescc['stale-if-error']); + const staleWhileRevalidateAge = age + toNumberOrZero(this._rescc['stale-while-revalidate']); + return Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1000; + } - _useStaleIfError() { - return ( - this.maxAge() + toNumberOrZero(this._rescc['stale-if-error']) > - this.age() - ); - } + stale() { + return this.maxAge() <= this.age(); + } - useStaleWhileRevalidate() { - return ( - this.maxAge() + - toNumberOrZero(this._rescc['stale-while-revalidate']) > - this.age() - ); - } + _useStaleIfError() { + return this.maxAge() + toNumberOrZero(this._rescc['stale-if-error']) > this.age(); + } - static fromObject(obj) { - return new this(undefined, undefined, { _fromObject: obj }); - } + useStaleWhileRevalidate() { + return this.maxAge() + toNumberOrZero(this._rescc['stale-while-revalidate']) > this.age(); + } - _fromObject(obj) { - if (this._responseTime) throw Error('Reinitialized'); - if (!obj || obj.v !== 1) throw Error('Invalid serialization'); + static fromObject(obj) { + return new this(undefined, undefined, { _fromObject: obj }); + } - this._responseTime = obj.t; - this._isShared = obj.sh; - this._cacheHeuristic = obj.ch; - this._immutableMinTtl = + _fromObject(obj) { + if (this._responseTime) throw Error('Reinitialized'); + if (!obj || obj.v !== 1) throw Error('Invalid serialization'); + + this._responseTime = obj.t; + this._isShared = obj.sh; + this._cacheHeuristic = obj.ch; + this._immutableMinTtl = obj.imm !== undefined ? obj.imm : 24 * 3600 * 1000; - this._status = obj.st; - this._resHeaders = obj.resh; - this._rescc = obj.rescc; - this._method = obj.m; - this._url = obj.u; - this._host = obj.h; - this._noAuthorization = obj.a; - this._reqHeaders = obj.reqh; - this._reqcc = obj.reqcc; - } + this._status = obj.st; + this._resHeaders = obj.resh; + this._rescc = obj.rescc; + this._method = obj.m; + this._url = obj.u; + this._host = obj.h; + this._noAuthorization = obj.a; + this._reqHeaders = obj.reqh; + this._reqcc = obj.reqcc; + } - toObject() { - return { + toObject() { + return { v: 1, t: this._responseTime, sh: this._isShared, @@ -9268,14155 +8025,13735 @@ An error to be thrown when given an unsupported protocol. a: this._noAuthorization, reqh: this._reqHeaders, reqcc: this._reqcc, - }; - } + }; + } - /** - * Headers for sending to the origin server to revalidate stale response. - * Allows server to return 304 to allow reuse of the previous response. - * - * Hop by hop headers are always stripped. - * Revalidation headers may be added or removed, depending on request. - */ - revalidationHeaders(incomingReq) { - this._assertRequestHasHeaders(incomingReq); - const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers); + /** + * Headers for sending to the origin server to revalidate stale response. + * Allows server to return 304 to allow reuse of the previous response. + * + * Hop by hop headers are always stripped. + * Revalidation headers may be added or removed, depending on request. + */ + revalidationHeaders(incomingReq) { + this._assertRequestHasHeaders(incomingReq); + const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers); - // This implementation does not understand range requests - delete headers['if-range']; + // This implementation does not understand range requests + delete headers['if-range']; - if (!this._requestMatches(incomingReq, true) || !this.storable()) { + if (!this._requestMatches(incomingReq, true) || !this.storable()) { // revalidation allowed via HEAD // not for the same resource, or wasn't allowed to be cached anyway delete headers['if-none-match']; delete headers['if-modified-since']; return headers; - } + } - /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */ - if (this._resHeaders.etag) { + /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */ + if (this._resHeaders.etag) { headers['if-none-match'] = headers['if-none-match'] - ? `${headers['if-none-match']}, ${this._resHeaders.etag}` - : this._resHeaders.etag; - } + ? `${headers['if-none-match']}, ${this._resHeaders.etag}` + : this._resHeaders.etag; + } - // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request. - const forbidsWeakValidators = + // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request. + const forbidsWeakValidators = headers['accept-ranges'] || headers['if-match'] || headers['if-unmodified-since'] || (this._method && this._method != 'GET'); - /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server. + /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server. Note: This implementation does not understand partial responses (206) */ - if (forbidsWeakValidators) { + if (forbidsWeakValidators) { delete headers['if-modified-since']; if (headers['if-none-match']) { - const etags = headers['if-none-match'] - .split(/,/) - .filter((etag) => { - return !/^\s*W\//.test(etag); - }); - if (!etags.length) { - delete headers['if-none-match']; - } else { - headers['if-none-match'] = etags.join(',').trim(); - } + const etags = headers['if-none-match'] + .split(/,/) + .filter(etag => { + return !/^\s*W\//.test(etag); + }); + if (!etags.length) { + delete headers['if-none-match']; + } else { + headers['if-none-match'] = etags.join(',').trim(); + } } - } else if ( + } else if ( this._resHeaders['last-modified'] && !headers['if-modified-since'] - ) { + ) { headers['if-modified-since'] = this._resHeaders['last-modified']; - } - - return headers; } - /** - * Creates new CachePolicy with information combined from the previews response, - * and the new revalidation response. - * - * Returns {policy, modified} where modified is a boolean indicating - * whether the response body has been modified, and old cached body can't be used. - * - * @return {Object} {policy: CachePolicy, modified: Boolean} - */ - revalidatedPolicy(request, response) { - this._assertRequestHasHeaders(request); - if (this._useStaleIfError() && isErrorResponse(response)) { - // I consider the revalidation request unsuccessful - return { - modified: false, - matches: false, - policy: this, - }; - } - if (!response || !response.headers) { - throw Error('Response headers missing'); - } + return headers; + } - // These aren't going to be supported exactly, since one CachePolicy object - // doesn't know about all the other cached objects. - let matches = false; - if (response.status !== undefined && response.status != 304) { + /** + * Creates new CachePolicy with information combined from the previews response, + * and the new revalidation response. + * + * Returns {policy, modified} where modified is a boolean indicating + * whether the response body has been modified, and old cached body can't be used. + * + * @return {Object} {policy: CachePolicy, modified: Boolean} + */ + revalidatedPolicy(request, response) { + this._assertRequestHasHeaders(request); + if(this._useStaleIfError() && isErrorResponse(response)) { // I consider the revalidation request unsuccessful + return { + modified: false, + matches: false, + policy: this, + }; + } + if (!response || !response.headers) { + throw Error('Response headers missing'); + } + + // These aren't going to be supported exactly, since one CachePolicy object + // doesn't know about all the other cached objects. + let matches = false; + if (response.status !== undefined && response.status != 304) { matches = false; - } else if ( + } else if ( response.headers.etag && !/^\s*W\//.test(response.headers.etag) - ) { + ) { // "All of the stored responses with the same strong validator are selected. // If none of the stored responses contain the same strong validator, // then the cache MUST NOT use the new response to update any stored responses." matches = - this._resHeaders.etag && - this._resHeaders.etag.replace(/^\s*W\//, '') === - response.headers.etag; - } else if (this._resHeaders.etag && response.headers.etag) { + this._resHeaders.etag && + this._resHeaders.etag.replace(/^\s*W\//, '') === + response.headers.etag; + } else if (this._resHeaders.etag && response.headers.etag) { // "If the new response contains a weak validator and that validator corresponds // to one of the cache's stored responses, // then the most recent of those matching stored responses is selected for update." matches = - this._resHeaders.etag.replace(/^\s*W\//, '') === - response.headers.etag.replace(/^\s*W\//, ''); - } else if (this._resHeaders['last-modified']) { + this._resHeaders.etag.replace(/^\s*W\//, '') === + response.headers.etag.replace(/^\s*W\//, ''); + } else if (this._resHeaders['last-modified']) { matches = - this._resHeaders['last-modified'] === - response.headers['last-modified']; - } else { + this._resHeaders['last-modified'] === + response.headers['last-modified']; + } else { // If the new response does not include any form of validator (such as in the case where // a client generates an If-Modified-Since request from a source other than the Last-Modified // response header field), and there is only one stored response, and that stored response also // lacks a validator, then that stored response is selected for update. if ( - !this._resHeaders.etag && - !this._resHeaders['last-modified'] && - !response.headers.etag && - !response.headers['last-modified'] + !this._resHeaders.etag && + !this._resHeaders['last-modified'] && + !response.headers.etag && + !response.headers['last-modified'] ) { - matches = true; + matches = true; } - } + } - if (!matches) { + if (!matches) { return { - policy: new this.constructor(request, response), - // Client receiving 304 without body, even if it's invalid/mismatched has no option - // but to reuse a cached body. We don't have a good way to tell clients to do - // error recovery in such case. - modified: response.status != 304, - matches: false, + policy: new this.constructor(request, response), + // Client receiving 304 without body, even if it's invalid/mismatched has no option + // but to reuse a cached body. We don't have a good way to tell clients to do + // error recovery in such case. + modified: response.status != 304, + matches: false, }; - } + } - // use other header fields provided in the 304 (Not Modified) response to replace all instances - // of the corresponding header fields in the stored response. - const headers = {}; - for (const k in this._resHeaders) { + // use other header fields provided in the 304 (Not Modified) response to replace all instances + // of the corresponding header fields in the stored response. + const headers = {}; + for (const k in this._resHeaders) { headers[k] = - k in response.headers && !excludedFromRevalidationUpdate[k] - ? response.headers[k] - : this._resHeaders[k]; - } + k in response.headers && !excludedFromRevalidationUpdate[k] + ? response.headers[k] + : this._resHeaders[k]; + } - const newResponse = Object.assign({}, response, { + const newResponse = Object.assign({}, response, { status: this._status, method: this._method, headers, - }); - return { + }); + return { policy: new this.constructor(request, newResponse, { - shared: this._isShared, - cacheHeuristic: this._cacheHeuristic, - immutableMinTimeToLive: this._immutableMinTtl, + shared: this._isShared, + cacheHeuristic: this._cacheHeuristic, + immutableMinTimeToLive: this._immutableMinTtl, }), modified: false, matches: true, - }; - } - }; - - /***/ - }, - - /***/ 9898: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const EventEmitter = __nccwpck_require__(8614); - const tls = __nccwpck_require__(4016); - const http2 = __nccwpck_require__(7565); - const QuickLRU = __nccwpck_require__(9273); - - const kCurrentStreamsCount = Symbol('currentStreamsCount'); - const kRequest = Symbol('request'); - const kOriginSet = Symbol('cachedOriginSet'); - const kGracefullyClosing = Symbol('gracefullyClosing'); - - const nameKeys = [ - // `http2.connect()` options - 'maxDeflateDynamicTableSize', - 'maxSessionMemory', - 'maxHeaderListPairs', - 'maxOutstandingPings', - 'maxReservedRemoteStreams', - 'maxSendHeaderBlockLength', - 'paddingStrategy', - - // `tls.connect()` options - 'localAddress', - 'path', - 'rejectUnauthorized', - 'minDHSize', - - // `tls.createSecureContext()` options - 'ca', - 'cert', - 'clientCertEngine', - 'ciphers', - 'key', - 'pfx', - 'servername', - 'minVersion', - 'maxVersion', - 'secureProtocol', - 'crl', - 'honorCipherOrder', - 'ecdhCurve', - 'dhparam', - 'secureOptions', - 'sessionIdContext', - ]; - - const getSortedIndex = (array, value, compare) => { - let low = 0; - let high = array.length; - - while (low < high) { - const mid = (low + high) >>> 1; - - /* istanbul ignore next */ - if (compare(array[mid], value)) { - // This never gets called because we use descending sort. Better to have this anyway. - low = mid + 1; - } else { - high = mid; - } - } - - return low; - }; - - const compareSessions = (a, b) => { - return ( - a.remoteSettings.maxConcurrentStreams > - b.remoteSettings.maxConcurrentStreams - ); - }; - - // See https://tools.ietf.org/html/rfc8336 - const closeCoveredSessions = (where, session) => { - // Clients SHOULD NOT emit new requests on any connection whose Origin - // Set is a proper subset of another connection's Origin Set, and they - // SHOULD close it once all outstanding requests are satisfied. - for (const coveredSession of where) { - if ( - // The set is a proper subset when its length is less than the other set. - coveredSession[kOriginSet].length < session[kOriginSet].length && - // And the other set includes all elements of the subset. - coveredSession[kOriginSet].every((origin) => - session[kOriginSet].includes(origin) - ) && - // Makes sure that the session can handle all requests from the covered session. - coveredSession[kCurrentStreamsCount] + - session[kCurrentStreamsCount] <= - session.remoteSettings.maxConcurrentStreams - ) { - // This allows pending requests to finish and prevents making new requests. - gracefullyClose(coveredSession); - } - } - }; - - // This is basically inverted `closeCoveredSessions(...)`. - const closeSessionIfCovered = (where, coveredSession) => { - for (const session of where) { - if ( - coveredSession[kOriginSet].length < session[kOriginSet].length && - coveredSession[kOriginSet].every((origin) => - session[kOriginSet].includes(origin) - ) && - coveredSession[kCurrentStreamsCount] + - session[kCurrentStreamsCount] <= - session.remoteSettings.maxConcurrentStreams - ) { - gracefullyClose(coveredSession); - } - } - }; - - const getSessions = ({ agent, isFree }) => { - const result = {}; - - // eslint-disable-next-line guard-for-in - for (const normalizedOptions in agent.sessions) { - const sessions = agent.sessions[normalizedOptions]; - - const filtered = sessions.filter((session) => { - const result = - session[Agent.kCurrentStreamsCount] < - session.remoteSettings.maxConcurrentStreams; - - return isFree ? result : !result; - }); - - if (filtered.length !== 0) { - result[normalizedOptions] = filtered; - } - } - - return result; - }; - - const gracefullyClose = (session) => { - session[kGracefullyClosing] = true; - - if (session[kCurrentStreamsCount] === 0) { - session.close(); - } - }; - - class Agent extends EventEmitter { - constructor({ - timeout = 60000, - maxSessions = Infinity, - maxFreeSessions = 10, - maxCachedTlsSessions = 100, - } = {}) { - super(); - - // A session is considered busy when its current streams count - // is equal to or greater than the `maxConcurrentStreams` value. - - // A session is considered free when its current streams count - // is less than the `maxConcurrentStreams` value. - - // SESSIONS[NORMALIZED_OPTIONS] = []; - this.sessions = {}; - - // The queue for creating new sessions. It looks like this: - // QUEUE[NORMALIZED_OPTIONS][NORMALIZED_ORIGIN] = ENTRY_FUNCTION - // - // The entry function has `listeners`, `completed` and `destroyed` properties. - // `listeners` is an array of objects containing `resolve` and `reject` functions. - // `completed` is a boolean. It's set to true after ENTRY_FUNCTION is executed. - // `destroyed` is a boolean. If it's set to true, the session will be destroyed if hasn't connected yet. - this.queue = {}; - - // Each session will use this timeout value. - this.timeout = timeout; - - // Max sessions in total - this.maxSessions = maxSessions; - - // Max free sessions in total - // TODO: decreasing `maxFreeSessions` should close some sessions - this.maxFreeSessions = maxFreeSessions; - - this._freeSessionsCount = 0; - this._sessionsCount = 0; - - // We don't support push streams by default. - this.settings = { - enablePush: false, - }; - - // Reusing TLS sessions increases performance. - this.tlsSessionCache = new QuickLRU({ - maxSize: maxCachedTlsSessions, - }); - } - - static normalizeOrigin(url, servername) { - if (typeof url === 'string') { - url = new URL(url); - } - - if (servername && url.hostname !== servername) { - url.hostname = servername; - } - - return url.origin; - } - - normalizeOptions(options) { - let normalized = ''; - - if (options) { - for (const key of nameKeys) { - if (options[key]) { - normalized += `:${options[key]}`; - } - } - } - - return normalized; - } - - _tryToCreateNewSession(normalizedOptions, normalizedOrigin) { - if ( - !(normalizedOptions in this.queue) || - !(normalizedOrigin in this.queue[normalizedOptions]) - ) { - return; - } - - const item = this.queue[normalizedOptions][normalizedOrigin]; - - // The entry function can be run only once. - // BUG: The session may be never created when: - // - the first condition is false AND - // - this function is never called with the same arguments in the future. - if (this._sessionsCount < this.maxSessions && !item.completed) { - item.completed = true; - - item(); - } - } - - getSession(origin, options, listeners) { - return new Promise((resolve, reject) => { - if (Array.isArray(listeners)) { - listeners = [...listeners]; - - // Resolve the current promise ASAP, we're just moving the listeners. - // They will be executed at a different time. - resolve(); - } else { - listeners = [{ resolve, reject }]; - } - - const normalizedOptions = this.normalizeOptions(options); - const normalizedOrigin = Agent.normalizeOrigin( - origin, - options && options.servername - ); - - if (normalizedOrigin === undefined) { - for (const { reject } of listeners) { - reject( - new TypeError( - 'The `origin` argument needs to be a string or an URL object' - ) - ); - } - - return; - } - - if (normalizedOptions in this.sessions) { - const sessions = this.sessions[normalizedOptions]; - - let maxConcurrentStreams = -1; - let currentStreamsCount = -1; - let optimalSession; - - // We could just do this.sessions[normalizedOptions].find(...) but that isn't optimal. - // Additionally, we are looking for session which has biggest current pending streams count. - for (const session of sessions) { - const sessionMaxConcurrentStreams = - session.remoteSettings.maxConcurrentStreams; - - if (sessionMaxConcurrentStreams < maxConcurrentStreams) { - break; - } - - if (session[kOriginSet].includes(normalizedOrigin)) { - const sessionCurrentStreamsCount = - session[kCurrentStreamsCount]; - - if ( - sessionCurrentStreamsCount >= sessionMaxConcurrentStreams || - session[kGracefullyClosing] || - // Unfortunately the `close` event isn't called immediately, - // so `session.destroyed` is `true`, but `session.closed` is `false`. - session.destroyed - ) { - continue; - } - - // We only need set this once. - if (!optimalSession) { - maxConcurrentStreams = sessionMaxConcurrentStreams; - } - - // We're looking for the session which has biggest current pending stream count, - // in order to minimalize the amount of active sessions. - if (sessionCurrentStreamsCount > currentStreamsCount) { - optimalSession = session; - currentStreamsCount = sessionCurrentStreamsCount; - } - } - } - - if (optimalSession) { - /* istanbul ignore next: safety check */ - if (listeners.length !== 1) { - for (const { reject } of listeners) { - const error = new Error( - `Expected the length of listeners to be 1, got ${listeners.length}.\n` + - 'Please report this to https://github.com/szmarczak/http2-wrapper/' - ); - - reject(error); - } - - return; - } - - listeners[0].resolve(optimalSession); - return; - } - } - - if (normalizedOptions in this.queue) { - if (normalizedOrigin in this.queue[normalizedOptions]) { - // There's already an item in the queue, just attach ourselves to it. - this.queue[normalizedOptions][normalizedOrigin].listeners.push( - ...listeners - ); - - // This shouldn't be executed here. - // See the comment inside _tryToCreateNewSession. - this._tryToCreateNewSession( - normalizedOptions, - normalizedOrigin - ); - return; - } - } else { - this.queue[normalizedOptions] = {}; - } - - // The entry must be removed from the queue IMMEDIATELY when: - // 1. the session connects successfully, - // 2. an error occurs. - const removeFromQueue = () => { - // Our entry can be replaced. We cannot remove the new one. - if ( - normalizedOptions in this.queue && - this.queue[normalizedOptions][normalizedOrigin] === entry - ) { - delete this.queue[normalizedOptions][normalizedOrigin]; - - if (Object.keys(this.queue[normalizedOptions]).length === 0) { - delete this.queue[normalizedOptions]; - } - } - }; - - // The main logic is here - const entry = () => { - const name = `${normalizedOrigin}:${normalizedOptions}`; - let receivedSettings = false; - - try { - const session = http2.connect(origin, { - createConnection: this.createConnection, - settings: this.settings, - session: this.tlsSessionCache.get(name), - ...options, - }); - session[kCurrentStreamsCount] = 0; - session[kGracefullyClosing] = false; - - const isFree = () => - session[kCurrentStreamsCount] < - session.remoteSettings.maxConcurrentStreams; - let wasFree = true; - - session.socket.once('session', (tlsSession) => { - this.tlsSessionCache.set(name, tlsSession); - }); - - session.once('error', (error) => { - // Listeners are empty when the session successfully connected. - for (const { reject } of listeners) { - reject(error); - } - - // The connection got broken, purge the cache. - this.tlsSessionCache.delete(name); - }); - - session.setTimeout(this.timeout, () => { - // Terminates all streams owned by this session. - // TODO: Maybe the streams should have a "Session timed out" error? - session.destroy(); - }); - - session.once('close', () => { - if (receivedSettings) { - // 1. If it wasn't free then no need to decrease because - // it has been decreased already in session.request(). - // 2. `stream.once('close')` won't increment the count - // because the session is already closed. - if (wasFree) { - this._freeSessionsCount--; - } - - this._sessionsCount--; - - // This cannot be moved to the stream logic, - // because there may be a session that hadn't made a single request. - const where = this.sessions[normalizedOptions]; - where.splice(where.indexOf(session), 1); - - if (where.length === 0) { - delete this.sessions[normalizedOptions]; - } - } else { - // Broken connection - const error = new Error( - 'Session closed without receiving a SETTINGS frame' - ); - error.code = 'HTTP2WRAPPER_NOSETTINGS'; - - for (const { reject } of listeners) { - reject(error); - } - - removeFromQueue(); - } - - // There may be another session awaiting. - this._tryToCreateNewSession( - normalizedOptions, - normalizedOrigin - ); - }); - - // Iterates over the queue and processes listeners. - const processListeners = () => { - if (!(normalizedOptions in this.queue) || !isFree()) { - return; - } - - for (const origin of session[kOriginSet]) { - if (origin in this.queue[normalizedOptions]) { - const { listeners } = this.queue[normalizedOptions][ - origin - ]; - - // Prevents session overloading. - while (listeners.length !== 0 && isFree()) { - // We assume `resolve(...)` calls `request(...)` *directly*, - // otherwise the session will get overloaded. - listeners.shift().resolve(session); - } - - const where = this.queue[normalizedOptions]; - if (where[origin].listeners.length === 0) { - delete where[origin]; - - if (Object.keys(where).length === 0) { - delete this.queue[normalizedOptions]; - break; - } - } - - // We're no longer free, no point in continuing. - if (!isFree()) { - break; - } - } - } - }; - - // The Origin Set cannot shrink. No need to check if it suddenly became covered by another one. - session.on('origin', () => { - session[kOriginSet] = session.originSet; - - if (!isFree()) { - // The session is full. - return; - } - - processListeners(); - - // Close covered sessions (if possible). - closeCoveredSessions( - this.sessions[normalizedOptions], - session - ); - }); - - session.once('remoteSettings', () => { - // Fix Node.js bug preventing the process from exiting - session.ref(); - session.unref(); - - this._sessionsCount++; - - // The Agent could have been destroyed already. - if (entry.destroyed) { - const error = new Error('Agent has been destroyed'); - - for (const listener of listeners) { - listener.reject(error); - } - - session.destroy(); - return; - } - - session[kOriginSet] = session.originSet; - - { - const where = this.sessions; - - if (normalizedOptions in where) { - const sessions = where[normalizedOptions]; - sessions.splice( - getSortedIndex(sessions, session, compareSessions), - 0, - session - ); - } else { - where[normalizedOptions] = [session]; - } - } - - this._freeSessionsCount += 1; - receivedSettings = true; - - this.emit('session', session); - - processListeners(); - removeFromQueue(); - - // TODO: Close last recently used (or least used?) session - if ( - session[kCurrentStreamsCount] === 0 && - this._freeSessionsCount > this.maxFreeSessions - ) { - session.close(); - } - - // Check if we haven't managed to execute all listeners. - if (listeners.length !== 0) { - // Request for a new session with predefined listeners. - this.getSession(normalizedOrigin, options, listeners); - listeners.length = 0; - } - - // `session.remoteSettings.maxConcurrentStreams` might get increased - session.on('remoteSettings', () => { - processListeners(); - - // In case the Origin Set changes - closeCoveredSessions( - this.sessions[normalizedOptions], - session - ); - }); - }); - - // Shim `session.request()` in order to catch all streams - session[kRequest] = session.request; - session.request = (headers, streamOptions) => { - if (session[kGracefullyClosing]) { - throw new Error( - 'The session is gracefully closing. No new streams are allowed.' - ); - } - - const stream = session[kRequest](headers, streamOptions); - - // The process won't exit until the session is closed or all requests are gone. - session.ref(); - - ++session[kCurrentStreamsCount]; - - if ( - session[kCurrentStreamsCount] === - session.remoteSettings.maxConcurrentStreams - ) { - this._freeSessionsCount--; - } - - stream.once('close', () => { - wasFree = isFree(); - - --session[kCurrentStreamsCount]; - - if (!session.destroyed && !session.closed) { - closeSessionIfCovered( - this.sessions[normalizedOptions], - session - ); - - if (isFree() && !session.closed) { - if (!wasFree) { - this._freeSessionsCount++; - - wasFree = true; - } - - const isEmpty = session[kCurrentStreamsCount] === 0; - - if (isEmpty) { - session.unref(); - } - - if ( - isEmpty && - (this._freeSessionsCount > this.maxFreeSessions || - session[kGracefullyClosing]) - ) { - session.close(); - } else { - closeCoveredSessions( - this.sessions[normalizedOptions], - session - ); - processListeners(); - } - } - } - }); - - return stream; - }; - } catch (error) { - for (const listener of listeners) { - listener.reject(error); - } - - removeFromQueue(); - } - }; - - entry.listeners = listeners; - entry.completed = false; - entry.destroyed = false; - - this.queue[normalizedOptions][normalizedOrigin] = entry; - this._tryToCreateNewSession(normalizedOptions, normalizedOrigin); - }); - } - - request(origin, options, headers, streamOptions) { - return new Promise((resolve, reject) => { - this.getSession(origin, options, [ - { - reject, - resolve: (session) => { - try { - resolve(session.request(headers, streamOptions)); - } catch (error) { - reject(error); - } - }, - }, - ]); - }); - } - - createConnection(origin, options) { - return Agent.connect(origin, options); - } - - static connect(origin, options) { - options.ALPNProtocols = ['h2']; - - const port = origin.port || 443; - const host = origin.hostname || origin.host; - - if (typeof options.servername === 'undefined') { - options.servername = host; - } - - return tls.connect(port, host, options); - } - - closeFreeSessions() { - for (const sessions of Object.values(this.sessions)) { - for (const session of sessions) { - if (session[kCurrentStreamsCount] === 0) { - session.close(); - } - } - } - } - - destroy(reason) { - for (const sessions of Object.values(this.sessions)) { - for (const session of sessions) { - session.destroy(reason); - } - } - - for (const entriesOfAuthority of Object.values(this.queue)) { - for (const entry of Object.values(entriesOfAuthority)) { - entry.destroyed = true; - } - } - - // New requests should NOT attach to destroyed sessions - this.queue = {}; - } - - get freeSessions() { - return getSessions({ agent: this, isFree: true }); - } - - get busySessions() { - return getSessions({ agent: this, isFree: false }); - } - } - - Agent.kCurrentStreamsCount = kCurrentStreamsCount; - Agent.kGracefullyClosing = kGracefullyClosing; - - module.exports = { - Agent, - globalAgent: new Agent(), - }; - - /***/ - }, - - /***/ 7167: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const http = __nccwpck_require__(8605); - const https = __nccwpck_require__(7211); - const resolveALPN = __nccwpck_require__(6624); - const QuickLRU = __nccwpck_require__(9273); - const Http2ClientRequest = __nccwpck_require__(9632); - const calculateServerName = __nccwpck_require__(1982); - const urlToOptions = __nccwpck_require__(2686); - - const cache = new QuickLRU({ maxSize: 100 }); - const queue = new Map(); - - const installSocket = (agent, socket, options) => { - socket._httpMessage = { shouldKeepAlive: true }; - - const onFree = () => { - agent.emit('free', socket, options); }; + } +}; + + +/***/ }), + +/***/ 9898: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const EventEmitter = __nccwpck_require__(8614); +const tls = __nccwpck_require__(4016); +const http2 = __nccwpck_require__(7565); +const QuickLRU = __nccwpck_require__(9273); + +const kCurrentStreamsCount = Symbol('currentStreamsCount'); +const kRequest = Symbol('request'); +const kOriginSet = Symbol('cachedOriginSet'); +const kGracefullyClosing = Symbol('gracefullyClosing'); + +const nameKeys = [ + // `http2.connect()` options + 'maxDeflateDynamicTableSize', + 'maxSessionMemory', + 'maxHeaderListPairs', + 'maxOutstandingPings', + 'maxReservedRemoteStreams', + 'maxSendHeaderBlockLength', + 'paddingStrategy', + + // `tls.connect()` options + 'localAddress', + 'path', + 'rejectUnauthorized', + 'minDHSize', + + // `tls.createSecureContext()` options + 'ca', + 'cert', + 'clientCertEngine', + 'ciphers', + 'key', + 'pfx', + 'servername', + 'minVersion', + 'maxVersion', + 'secureProtocol', + 'crl', + 'honorCipherOrder', + 'ecdhCurve', + 'dhparam', + 'secureOptions', + 'sessionIdContext' +]; + +const getSortedIndex = (array, value, compare) => { + let low = 0; + let high = array.length; + + while (low < high) { + const mid = (low + high) >>> 1; + + /* istanbul ignore next */ + if (compare(array[mid], value)) { + // This never gets called because we use descending sort. Better to have this anyway. + low = mid + 1; + } else { + high = mid; + } + } + + return low; +}; + +const compareSessions = (a, b) => { + return a.remoteSettings.maxConcurrentStreams > b.remoteSettings.maxConcurrentStreams; +}; + +// See https://tools.ietf.org/html/rfc8336 +const closeCoveredSessions = (where, session) => { + // Clients SHOULD NOT emit new requests on any connection whose Origin + // Set is a proper subset of another connection's Origin Set, and they + // SHOULD close it once all outstanding requests are satisfied. + for (const coveredSession of where) { + if ( + // The set is a proper subset when its length is less than the other set. + coveredSession[kOriginSet].length < session[kOriginSet].length && + + // And the other set includes all elements of the subset. + coveredSession[kOriginSet].every(origin => session[kOriginSet].includes(origin)) && + + // Makes sure that the session can handle all requests from the covered session. + coveredSession[kCurrentStreamsCount] + session[kCurrentStreamsCount] <= session.remoteSettings.maxConcurrentStreams + ) { + // This allows pending requests to finish and prevents making new requests. + gracefullyClose(coveredSession); + } + } +}; + +// This is basically inverted `closeCoveredSessions(...)`. +const closeSessionIfCovered = (where, coveredSession) => { + for (const session of where) { + if ( + coveredSession[kOriginSet].length < session[kOriginSet].length && + coveredSession[kOriginSet].every(origin => session[kOriginSet].includes(origin)) && + coveredSession[kCurrentStreamsCount] + session[kCurrentStreamsCount] <= session.remoteSettings.maxConcurrentStreams + ) { + gracefullyClose(coveredSession); + } + } +}; + +const getSessions = ({agent, isFree}) => { + const result = {}; + + // eslint-disable-next-line guard-for-in + for (const normalizedOptions in agent.sessions) { + const sessions = agent.sessions[normalizedOptions]; + + const filtered = sessions.filter(session => { + const result = session[Agent.kCurrentStreamsCount] < session.remoteSettings.maxConcurrentStreams; + + return isFree ? result : !result; + }); + + if (filtered.length !== 0) { + result[normalizedOptions] = filtered; + } + } + + return result; +}; + +const gracefullyClose = session => { + session[kGracefullyClosing] = true; + + if (session[kCurrentStreamsCount] === 0) { + session.close(); + } +}; + +class Agent extends EventEmitter { + constructor({timeout = 60000, maxSessions = Infinity, maxFreeSessions = 10, maxCachedTlsSessions = 100} = {}) { + super(); + + // A session is considered busy when its current streams count + // is equal to or greater than the `maxConcurrentStreams` value. + + // A session is considered free when its current streams count + // is less than the `maxConcurrentStreams` value. + + // SESSIONS[NORMALIZED_OPTIONS] = []; + this.sessions = {}; + + // The queue for creating new sessions. It looks like this: + // QUEUE[NORMALIZED_OPTIONS][NORMALIZED_ORIGIN] = ENTRY_FUNCTION + // + // The entry function has `listeners`, `completed` and `destroyed` properties. + // `listeners` is an array of objects containing `resolve` and `reject` functions. + // `completed` is a boolean. It's set to true after ENTRY_FUNCTION is executed. + // `destroyed` is a boolean. If it's set to true, the session will be destroyed if hasn't connected yet. + this.queue = {}; + + // Each session will use this timeout value. + this.timeout = timeout; + + // Max sessions in total + this.maxSessions = maxSessions; + + // Max free sessions in total + // TODO: decreasing `maxFreeSessions` should close some sessions + this.maxFreeSessions = maxFreeSessions; + + this._freeSessionsCount = 0; + this._sessionsCount = 0; + + // We don't support push streams by default. + this.settings = { + enablePush: false + }; + + // Reusing TLS sessions increases performance. + this.tlsSessionCache = new QuickLRU({maxSize: maxCachedTlsSessions}); + } + + static normalizeOrigin(url, servername) { + if (typeof url === 'string') { + url = new URL(url); + } + + if (servername && url.hostname !== servername) { + url.hostname = servername; + } + + return url.origin; + } + + normalizeOptions(options) { + let normalized = ''; + + if (options) { + for (const key of nameKeys) { + if (options[key]) { + normalized += `:${options[key]}`; + } + } + } + + return normalized; + } + + _tryToCreateNewSession(normalizedOptions, normalizedOrigin) { + if (!(normalizedOptions in this.queue) || !(normalizedOrigin in this.queue[normalizedOptions])) { + return; + } + + const item = this.queue[normalizedOptions][normalizedOrigin]; + + // The entry function can be run only once. + // BUG: The session may be never created when: + // - the first condition is false AND + // - this function is never called with the same arguments in the future. + if (this._sessionsCount < this.maxSessions && !item.completed) { + item.completed = true; + + item(); + } + } + + getSession(origin, options, listeners) { + return new Promise((resolve, reject) => { + if (Array.isArray(listeners)) { + listeners = [...listeners]; + + // Resolve the current promise ASAP, we're just moving the listeners. + // They will be executed at a different time. + resolve(); + } else { + listeners = [{resolve, reject}]; + } + + const normalizedOptions = this.normalizeOptions(options); + const normalizedOrigin = Agent.normalizeOrigin(origin, options && options.servername); + + if (normalizedOrigin === undefined) { + for (const {reject} of listeners) { + reject(new TypeError('The `origin` argument needs to be a string or an URL object')); + } + + return; + } + + if (normalizedOptions in this.sessions) { + const sessions = this.sessions[normalizedOptions]; + + let maxConcurrentStreams = -1; + let currentStreamsCount = -1; + let optimalSession; + + // We could just do this.sessions[normalizedOptions].find(...) but that isn't optimal. + // Additionally, we are looking for session which has biggest current pending streams count. + for (const session of sessions) { + const sessionMaxConcurrentStreams = session.remoteSettings.maxConcurrentStreams; + + if (sessionMaxConcurrentStreams < maxConcurrentStreams) { + break; + } + + if (session[kOriginSet].includes(normalizedOrigin)) { + const sessionCurrentStreamsCount = session[kCurrentStreamsCount]; + + if ( + sessionCurrentStreamsCount >= sessionMaxConcurrentStreams || + session[kGracefullyClosing] || + // Unfortunately the `close` event isn't called immediately, + // so `session.destroyed` is `true`, but `session.closed` is `false`. + session.destroyed + ) { + continue; + } + + // We only need set this once. + if (!optimalSession) { + maxConcurrentStreams = sessionMaxConcurrentStreams; + } + + // We're looking for the session which has biggest current pending stream count, + // in order to minimalize the amount of active sessions. + if (sessionCurrentStreamsCount > currentStreamsCount) { + optimalSession = session; + currentStreamsCount = sessionCurrentStreamsCount; + } + } + } + + if (optimalSession) { + /* istanbul ignore next: safety check */ + if (listeners.length !== 1) { + for (const {reject} of listeners) { + const error = new Error( + `Expected the length of listeners to be 1, got ${listeners.length}.\n` + + 'Please report this to https://github.com/szmarczak/http2-wrapper/' + ); + + reject(error); + } + + return; + } + + listeners[0].resolve(optimalSession); + return; + } + } + + if (normalizedOptions in this.queue) { + if (normalizedOrigin in this.queue[normalizedOptions]) { + // There's already an item in the queue, just attach ourselves to it. + this.queue[normalizedOptions][normalizedOrigin].listeners.push(...listeners); + + // This shouldn't be executed here. + // See the comment inside _tryToCreateNewSession. + this._tryToCreateNewSession(normalizedOptions, normalizedOrigin); + return; + } + } else { + this.queue[normalizedOptions] = {}; + } + + // The entry must be removed from the queue IMMEDIATELY when: + // 1. the session connects successfully, + // 2. an error occurs. + const removeFromQueue = () => { + // Our entry can be replaced. We cannot remove the new one. + if (normalizedOptions in this.queue && this.queue[normalizedOptions][normalizedOrigin] === entry) { + delete this.queue[normalizedOptions][normalizedOrigin]; + + if (Object.keys(this.queue[normalizedOptions]).length === 0) { + delete this.queue[normalizedOptions]; + } + } + }; + + // The main logic is here + const entry = () => { + const name = `${normalizedOrigin}:${normalizedOptions}`; + let receivedSettings = false; + + try { + const session = http2.connect(origin, { + createConnection: this.createConnection, + settings: this.settings, + session: this.tlsSessionCache.get(name), + ...options + }); + session[kCurrentStreamsCount] = 0; + session[kGracefullyClosing] = false; + + const isFree = () => session[kCurrentStreamsCount] < session.remoteSettings.maxConcurrentStreams; + let wasFree = true; + + session.socket.once('session', tlsSession => { + this.tlsSessionCache.set(name, tlsSession); + }); + + session.once('error', error => { + // Listeners are empty when the session successfully connected. + for (const {reject} of listeners) { + reject(error); + } + + // The connection got broken, purge the cache. + this.tlsSessionCache.delete(name); + }); + + session.setTimeout(this.timeout, () => { + // Terminates all streams owned by this session. + // TODO: Maybe the streams should have a "Session timed out" error? + session.destroy(); + }); + + session.once('close', () => { + if (receivedSettings) { + // 1. If it wasn't free then no need to decrease because + // it has been decreased already in session.request(). + // 2. `stream.once('close')` won't increment the count + // because the session is already closed. + if (wasFree) { + this._freeSessionsCount--; + } + + this._sessionsCount--; + + // This cannot be moved to the stream logic, + // because there may be a session that hadn't made a single request. + const where = this.sessions[normalizedOptions]; + where.splice(where.indexOf(session), 1); + + if (where.length === 0) { + delete this.sessions[normalizedOptions]; + } + } else { + // Broken connection + const error = new Error('Session closed without receiving a SETTINGS frame'); + error.code = 'HTTP2WRAPPER_NOSETTINGS'; + + for (const {reject} of listeners) { + reject(error); + } + + removeFromQueue(); + } + + // There may be another session awaiting. + this._tryToCreateNewSession(normalizedOptions, normalizedOrigin); + }); + + // Iterates over the queue and processes listeners. + const processListeners = () => { + if (!(normalizedOptions in this.queue) || !isFree()) { + return; + } + + for (const origin of session[kOriginSet]) { + if (origin in this.queue[normalizedOptions]) { + const {listeners} = this.queue[normalizedOptions][origin]; + + // Prevents session overloading. + while (listeners.length !== 0 && isFree()) { + // We assume `resolve(...)` calls `request(...)` *directly*, + // otherwise the session will get overloaded. + listeners.shift().resolve(session); + } + + const where = this.queue[normalizedOptions]; + if (where[origin].listeners.length === 0) { + delete where[origin]; + + if (Object.keys(where).length === 0) { + delete this.queue[normalizedOptions]; + break; + } + } + + // We're no longer free, no point in continuing. + if (!isFree()) { + break; + } + } + } + }; + + // The Origin Set cannot shrink. No need to check if it suddenly became covered by another one. + session.on('origin', () => { + session[kOriginSet] = session.originSet; + + if (!isFree()) { + // The session is full. + return; + } + + processListeners(); + + // Close covered sessions (if possible). + closeCoveredSessions(this.sessions[normalizedOptions], session); + }); + + session.once('remoteSettings', () => { + // Fix Node.js bug preventing the process from exiting + session.ref(); + session.unref(); + + this._sessionsCount++; + + // The Agent could have been destroyed already. + if (entry.destroyed) { + const error = new Error('Agent has been destroyed'); + + for (const listener of listeners) { + listener.reject(error); + } + + session.destroy(); + return; + } + + session[kOriginSet] = session.originSet; + + { + const where = this.sessions; + + if (normalizedOptions in where) { + const sessions = where[normalizedOptions]; + sessions.splice(getSortedIndex(sessions, session, compareSessions), 0, session); + } else { + where[normalizedOptions] = [session]; + } + } + + this._freeSessionsCount += 1; + receivedSettings = true; + + this.emit('session', session); + + processListeners(); + removeFromQueue(); + + // TODO: Close last recently used (or least used?) session + if (session[kCurrentStreamsCount] === 0 && this._freeSessionsCount > this.maxFreeSessions) { + session.close(); + } + + // Check if we haven't managed to execute all listeners. + if (listeners.length !== 0) { + // Request for a new session with predefined listeners. + this.getSession(normalizedOrigin, options, listeners); + listeners.length = 0; + } + + // `session.remoteSettings.maxConcurrentStreams` might get increased + session.on('remoteSettings', () => { + processListeners(); + + // In case the Origin Set changes + closeCoveredSessions(this.sessions[normalizedOptions], session); + }); + }); + + // Shim `session.request()` in order to catch all streams + session[kRequest] = session.request; + session.request = (headers, streamOptions) => { + if (session[kGracefullyClosing]) { + throw new Error('The session is gracefully closing. No new streams are allowed.'); + } + + const stream = session[kRequest](headers, streamOptions); + + // The process won't exit until the session is closed or all requests are gone. + session.ref(); + + ++session[kCurrentStreamsCount]; + + if (session[kCurrentStreamsCount] === session.remoteSettings.maxConcurrentStreams) { + this._freeSessionsCount--; + } + + stream.once('close', () => { + wasFree = isFree(); + + --session[kCurrentStreamsCount]; + + if (!session.destroyed && !session.closed) { + closeSessionIfCovered(this.sessions[normalizedOptions], session); + + if (isFree() && !session.closed) { + if (!wasFree) { + this._freeSessionsCount++; + + wasFree = true; + } + + const isEmpty = session[kCurrentStreamsCount] === 0; + + if (isEmpty) { + session.unref(); + } + + if ( + isEmpty && + ( + this._freeSessionsCount > this.maxFreeSessions || + session[kGracefullyClosing] + ) + ) { + session.close(); + } else { + closeCoveredSessions(this.sessions[normalizedOptions], session); + processListeners(); + } + } + } + }); + + return stream; + }; + } catch (error) { + for (const listener of listeners) { + listener.reject(error); + } + + removeFromQueue(); + } + }; + + entry.listeners = listeners; + entry.completed = false; + entry.destroyed = false; + + this.queue[normalizedOptions][normalizedOrigin] = entry; + this._tryToCreateNewSession(normalizedOptions, normalizedOrigin); + }); + } + + request(origin, options, headers, streamOptions) { + return new Promise((resolve, reject) => { + this.getSession(origin, options, [{ + reject, + resolve: session => { + try { + resolve(session.request(headers, streamOptions)); + } catch (error) { + reject(error); + } + } + }]); + }); + } + + createConnection(origin, options) { + return Agent.connect(origin, options); + } + + static connect(origin, options) { + options.ALPNProtocols = ['h2']; + + const port = origin.port || 443; + const host = origin.hostname || origin.host; + + if (typeof options.servername === 'undefined') { + options.servername = host; + } + + return tls.connect(port, host, options); + } + + closeFreeSessions() { + for (const sessions of Object.values(this.sessions)) { + for (const session of sessions) { + if (session[kCurrentStreamsCount] === 0) { + session.close(); + } + } + } + } + + destroy(reason) { + for (const sessions of Object.values(this.sessions)) { + for (const session of sessions) { + session.destroy(reason); + } + } + + for (const entriesOfAuthority of Object.values(this.queue)) { + for (const entry of Object.values(entriesOfAuthority)) { + entry.destroyed = true; + } + } + + // New requests should NOT attach to destroyed sessions + this.queue = {}; + } + + get freeSessions() { + return getSessions({agent: this, isFree: true}); + } + + get busySessions() { + return getSessions({agent: this, isFree: false}); + } +} + +Agent.kCurrentStreamsCount = kCurrentStreamsCount; +Agent.kGracefullyClosing = kGracefullyClosing; + +module.exports = { + Agent, + globalAgent: new Agent() +}; + + +/***/ }), + +/***/ 7167: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const http = __nccwpck_require__(8605); +const https = __nccwpck_require__(7211); +const resolveALPN = __nccwpck_require__(6624); +const QuickLRU = __nccwpck_require__(9273); +const Http2ClientRequest = __nccwpck_require__(9632); +const calculateServerName = __nccwpck_require__(1982); +const urlToOptions = __nccwpck_require__(2686); + +const cache = new QuickLRU({maxSize: 100}); +const queue = new Map(); + +const installSocket = (agent, socket, options) => { + socket._httpMessage = {shouldKeepAlive: true}; + + const onFree = () => { + agent.emit('free', socket, options); + }; + + socket.on('free', onFree); + + const onClose = () => { + agent.removeSocket(socket, options); + }; + + socket.on('close', onClose); + + const onRemove = () => { + agent.removeSocket(socket, options); + socket.off('close', onClose); + socket.off('free', onFree); + socket.off('agentRemove', onRemove); + }; + + socket.on('agentRemove', onRemove); + + agent.emit('free', socket, options); +}; + +const resolveProtocol = async options => { + const name = `${options.host}:${options.port}:${options.ALPNProtocols.sort()}`; + + if (!cache.has(name)) { + if (queue.has(name)) { + const result = await queue.get(name); + return result.alpnProtocol; + } + + const {path, agent} = options; + options.path = options.socketPath; + + const resultPromise = resolveALPN(options); + queue.set(name, resultPromise); - socket.on('free', onFree); - - const onClose = () => { - agent.removeSocket(socket, options); - }; - - socket.on('close', onClose); - - const onRemove = () => { - agent.removeSocket(socket, options); - socket.off('close', onClose); - socket.off('free', onFree); - socket.off('agentRemove', onRemove); - }; - - socket.on('agentRemove', onRemove); - - agent.emit('free', socket, options); - }; - - const resolveProtocol = async (options) => { - const name = `${options.host}:${ - options.port - }:${options.ALPNProtocols.sort()}`; - - if (!cache.has(name)) { - if (queue.has(name)) { - const result = await queue.get(name); - return result.alpnProtocol; - } - - const { path, agent } = options; - options.path = options.socketPath; - - const resultPromise = resolveALPN(options); - queue.set(name, resultPromise); - - try { - const { socket, alpnProtocol } = await resultPromise; - cache.set(name, alpnProtocol); - - options.path = path; - - if (alpnProtocol === 'h2') { - // https://github.com/nodejs/node/issues/33343 - socket.destroy(); - } else { - const { globalAgent } = https; - const defaultCreateConnection = - https.Agent.prototype.createConnection; - - if (agent) { - if (agent.createConnection === defaultCreateConnection) { - installSocket(agent, socket, options); - } else { - socket.destroy(); - } - } else if ( - globalAgent.createConnection === defaultCreateConnection - ) { - installSocket(globalAgent, socket, options); - } else { - socket.destroy(); - } - } - - queue.delete(name); - - return alpnProtocol; - } catch (error) { - queue.delete(name); - - throw error; - } - } - - return cache.get(name); - }; - - module.exports = async (input, options, callback) => { - if (typeof input === 'string' || input instanceof URL) { - input = urlToOptions(new URL(input)); - } - - if (typeof options === 'function') { - callback = options; - options = undefined; - } - - options = { - ALPNProtocols: ['h2', 'http/1.1'], - ...input, - ...options, - resolveSocket: true, - }; - - if ( - !Array.isArray(options.ALPNProtocols) || - options.ALPNProtocols.length === 0 - ) { - throw new Error( - 'The `ALPNProtocols` option must be an Array with at least one entry' - ); - } - - options.protocol = options.protocol || 'https:'; - const isHttps = options.protocol === 'https:'; - - options.host = options.hostname || options.host || 'localhost'; - options.session = options.tlsSession; - options.servername = options.servername || calculateServerName(options); - options.port = options.port || (isHttps ? 443 : 80); - options._defaultAgent = isHttps ? https.globalAgent : http.globalAgent; - - const agents = options.agent; - - if (agents) { - if (agents.addRequest) { - throw new Error( - 'The `options.agent` object can contain only `http`, `https` or `http2` properties' - ); - } - - options.agent = agents[isHttps ? 'https' : 'http']; - } - - if (isHttps) { - const protocol = await resolveProtocol(options); - - if (protocol === 'h2') { - if (agents) { - options.agent = agents.http2; - } - - return new Http2ClientRequest(options, callback); - } - } - - return http.request(options, callback); - }; - - module.exports.protocolCache = cache; - - /***/ - }, - - /***/ 9632: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const http2 = __nccwpck_require__(7565); - const { Writable } = __nccwpck_require__(2413); - const { Agent, globalAgent } = __nccwpck_require__(9898); - const IncomingMessage = __nccwpck_require__(2575); - const urlToOptions = __nccwpck_require__(2686); - const proxyEvents = __nccwpck_require__(1818); - const isRequestPseudoHeader = __nccwpck_require__(1199); - const { - ERR_INVALID_ARG_TYPE, - ERR_INVALID_PROTOCOL, - ERR_HTTP_HEADERS_SENT, - ERR_INVALID_HTTP_TOKEN, - ERR_HTTP_INVALID_HEADER_VALUE, - ERR_INVALID_CHAR, - } = __nccwpck_require__(7087); - - const { - HTTP2_HEADER_STATUS, - HTTP2_HEADER_METHOD, - HTTP2_HEADER_PATH, - HTTP2_METHOD_CONNECT, - } = http2.constants; - - const kHeaders = Symbol('headers'); - const kOrigin = Symbol('origin'); - const kSession = Symbol('session'); - const kOptions = Symbol('options'); - const kFlushedHeaders = Symbol('flushedHeaders'); - const kJobs = Symbol('jobs'); - - const isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/; - const isInvalidHeaderValue = /[^\t\u0020-\u007E\u0080-\u00FF]/; - - class ClientRequest extends Writable { - constructor(input, options, callback) { - super({ - autoDestroy: false, - }); - - const hasInput = typeof input === 'string' || input instanceof URL; - if (hasInput) { - input = urlToOptions(input instanceof URL ? input : new URL(input)); - } - - if (typeof options === 'function' || options === undefined) { - // (options, callback) - callback = options; - options = hasInput ? input : { ...input }; - } else { - // (input, options, callback) - options = { ...input, ...options }; - } - - if (options.h2session) { - this[kSession] = options.h2session; - } else if (options.agent === false) { - this.agent = new Agent({ maxFreeSessions: 0 }); - } else if ( - typeof options.agent === 'undefined' || - options.agent === null - ) { - if (typeof options.createConnection === 'function') { - // This is a workaround - we don't have to create the session on our own. - this.agent = new Agent({ maxFreeSessions: 0 }); - this.agent.createConnection = options.createConnection; - } else { - this.agent = globalAgent; - } - } else if (typeof options.agent.request === 'function') { - this.agent = options.agent; - } else { - throw new ERR_INVALID_ARG_TYPE( - 'options.agent', - ['Agent-like Object', 'undefined', 'false'], - options.agent - ); - } - - if (options.protocol && options.protocol !== 'https:') { - throw new ERR_INVALID_PROTOCOL(options.protocol, 'https:'); - } - - const port = - options.port || - options.defaultPort || - (this.agent && this.agent.defaultPort) || - 443; - const host = options.hostname || options.host || 'localhost'; - - // Don't enforce the origin via options. It may be changed in an Agent. - delete options.hostname; - delete options.host; - delete options.port; - - const { timeout } = options; - options.timeout = undefined; - - this[kHeaders] = Object.create(null); - this[kJobs] = []; - - this.socket = null; - this.connection = null; - - this.method = options.method || 'GET'; - this.path = options.path; - - this.res = null; - this.aborted = false; - this.reusedSocket = false; - - if (options.headers) { - for (const [header, value] of Object.entries(options.headers)) { - this.setHeader(header, value); - } - } - - if (options.auth && !('authorization' in this[kHeaders])) { - this[kHeaders].authorization = - 'Basic ' + Buffer.from(options.auth).toString('base64'); - } - - options.session = options.tlsSession; - options.path = options.socketPath; - - this[kOptions] = options; - - // Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field. - if (port === 443) { - this[kOrigin] = `https://${host}`; - - if (!(':authority' in this[kHeaders])) { - this[kHeaders][':authority'] = host; - } - } else { - this[kOrigin] = `https://${host}:${port}`; - - if (!(':authority' in this[kHeaders])) { - this[kHeaders][':authority'] = `${host}:${port}`; - } - } - - if (timeout) { - this.setTimeout(timeout); - } - - if (callback) { - this.once('response', callback); - } - - this[kFlushedHeaders] = false; - } - - get method() { - return this[kHeaders][HTTP2_HEADER_METHOD]; - } - - set method(value) { - if (value) { - this[kHeaders][HTTP2_HEADER_METHOD] = value.toUpperCase(); - } - } - - get path() { - return this[kHeaders][HTTP2_HEADER_PATH]; - } - - set path(value) { - if (value) { - this[kHeaders][HTTP2_HEADER_PATH] = value; - } - } - - get _mustNotHaveABody() { - return ( - this.method === 'GET' || - this.method === 'HEAD' || - this.method === 'DELETE' - ); - } - - _write(chunk, encoding, callback) { - // https://github.com/nodejs/node/blob/654df09ae0c5e17d1b52a900a545f0664d8c7627/lib/internal/http2/util.js#L148-L156 - if (this._mustNotHaveABody) { - callback( - new Error('The GET, HEAD and DELETE methods must NOT have a body') - ); - /* istanbul ignore next: Node.js 12 throws directly */ - return; - } - - this.flushHeaders(); - - const callWrite = () => - this._request.write(chunk, encoding, callback); - if (this._request) { - callWrite(); - } else { - this[kJobs].push(callWrite); - } - } - - _final(callback) { - if (this.destroyed) { - return; - } - - this.flushHeaders(); - - const callEnd = () => { - // For GET, HEAD and DELETE - if (this._mustNotHaveABody) { - callback(); - return; - } - - this._request.end(callback); - }; - - if (this._request) { - callEnd(); - } else { - this[kJobs].push(callEnd); - } - } - - abort() { - if (this.res && this.res.complete) { - return; - } - - if (!this.aborted) { - process.nextTick(() => this.emit('abort')); - } - - this.aborted = true; - - this.destroy(); - } - - _destroy(error, callback) { - if (this.res) { - this.res._dump(); - } - - if (this._request) { - this._request.destroy(); - } - - callback(error); - } - - async flushHeaders() { - if (this[kFlushedHeaders] || this.destroyed) { - return; - } - - this[kFlushedHeaders] = true; - - const isConnectMethod = this.method === HTTP2_METHOD_CONNECT; - - // The real magic is here - const onStream = (stream) => { - this._request = stream; - - if (this.destroyed) { - stream.destroy(); - return; - } - - // Forwards `timeout`, `continue`, `close` and `error` events to this instance. - if (!isConnectMethod) { - proxyEvents(stream, this, [ - 'timeout', - 'continue', - 'close', - 'error', - ]); - } - - // Wait for the `finish` event. We don't want to emit the `response` event - // before `request.end()` is called. - const waitForEnd = (fn) => { - return (...args) => { - if (!this.writable && !this.destroyed) { - fn(...args); - } else { - this.once('finish', () => { - fn(...args); - }); - } - }; - }; - - // This event tells we are ready to listen for the data. - stream.once( - 'response', - waitForEnd((headers, flags, rawHeaders) => { - // If we were to emit raw request stream, it would be as fast as the native approach. - // Note that wrapping the raw stream in a Proxy instance won't improve the performance (already tested it). - const response = new IncomingMessage( - this.socket, - stream.readableHighWaterMark - ); - this.res = response; - - response.req = this; - response.statusCode = headers[HTTP2_HEADER_STATUS]; - response.headers = headers; - response.rawHeaders = rawHeaders; - - response.once('end', () => { - if (this.aborted) { - response.aborted = true; - response.emit('aborted'); - } else { - response.complete = true; - - // Has no effect, just be consistent with the Node.js behavior - response.socket = null; - response.connection = null; - } - }); - - if (isConnectMethod) { - response.upgrade = true; - - // The HTTP1 API says the socket is detached here, - // but we can't do that so we pass the original HTTP2 request. - if (this.emit('connect', response, stream, Buffer.alloc(0))) { - this.emit('close'); - } else { - // No listeners attached, destroy the original request. - stream.destroy(); - } - } else { - // Forwards data - stream.on('data', (chunk) => { - if (!response._dumped && !response.push(chunk)) { - stream.pause(); - } - }); - - stream.once('end', () => { - response.push(null); - }); - - if (!this.emit('response', response)) { - // No listeners attached, dump the response. - response._dump(); - } - } - }) - ); - - // Emits `information` event - stream.once( - 'headers', - waitForEnd((headers) => - this.emit('information', { - statusCode: headers[HTTP2_HEADER_STATUS], - }) - ) - ); - - stream.once( - 'trailers', - waitForEnd((trailers, flags, rawTrailers) => { - const { res } = this; - - // Assigns trailers to the response object. - res.trailers = trailers; - res.rawTrailers = rawTrailers; - }) - ); - - const { socket } = stream.session; - this.socket = socket; - this.connection = socket; - - for (const job of this[kJobs]) { - job(); - } - - this.emit('socket', this.socket); - }; - - // Makes a HTTP2 request - if (this[kSession]) { - try { - onStream(this[kSession].request(this[kHeaders])); - } catch (error) { - this.emit('error', error); - } - } else { - this.reusedSocket = true; - - try { - onStream( - await this.agent.request( - this[kOrigin], - this[kOptions], - this[kHeaders] - ) - ); - } catch (error) { - this.emit('error', error); - } - } - } - - getHeader(name) { - if (typeof name !== 'string') { - throw new ERR_INVALID_ARG_TYPE('name', 'string', name); - } - - return this[kHeaders][name.toLowerCase()]; - } - - get headersSent() { - return this[kFlushedHeaders]; - } - - removeHeader(name) { - if (typeof name !== 'string') { - throw new ERR_INVALID_ARG_TYPE('name', 'string', name); - } - - if (this.headersSent) { - throw new ERR_HTTP_HEADERS_SENT('remove'); - } - - delete this[kHeaders][name.toLowerCase()]; - } - - setHeader(name, value) { - if (this.headersSent) { - throw new ERR_HTTP_HEADERS_SENT('set'); - } - - if ( - typeof name !== 'string' || - (!isValidHttpToken.test(name) && !isRequestPseudoHeader(name)) - ) { - throw new ERR_INVALID_HTTP_TOKEN('Header name', name); - } - - if (typeof value === 'undefined') { - throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name); - } - - if (isInvalidHeaderValue.test(value)) { - throw new ERR_INVALID_CHAR('header content', name); - } - - this[kHeaders][name.toLowerCase()] = value; - } - - setNoDelay() { - // HTTP2 sockets cannot be malformed, do nothing. - } - - setSocketKeepAlive() { - // HTTP2 sockets cannot be malformed, do nothing. - } - - setTimeout(ms, callback) { - const applyTimeout = () => this._request.setTimeout(ms, callback); - - if (this._request) { - applyTimeout(); - } else { - this[kJobs].push(applyTimeout); - } - - return this; - } - - get maxHeadersCount() { - if (!this.destroyed && this._request) { - return this._request.session.localSettings.maxHeaderListSize; - } - - return undefined; - } - - set maxHeadersCount(_value) { - // Updating HTTP2 settings would affect all requests, do nothing. - } - } - - module.exports = ClientRequest; - - /***/ - }, - - /***/ 2575: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const { Readable } = __nccwpck_require__(2413); - - class IncomingMessage extends Readable { - constructor(socket, highWaterMark) { - super({ - highWaterMark, - autoDestroy: false, - }); - - this.statusCode = null; - this.statusMessage = ''; - this.httpVersion = '2.0'; - this.httpVersionMajor = 2; - this.httpVersionMinor = 0; - this.headers = {}; - this.trailers = {}; - this.req = null; - - this.aborted = false; - this.complete = false; - this.upgrade = null; - - this.rawHeaders = []; - this.rawTrailers = []; - - this.socket = socket; - this.connection = socket; - - this._dumped = false; - } - - _destroy(error) { - this.req._request.destroy(error); - } - - setTimeout(ms, callback) { - this.req.setTimeout(ms, callback); - return this; - } - - _dump() { - if (!this._dumped) { - this._dumped = true; - - this.removeAllListeners('data'); - this.resume(); - } - } - - _read() { - if (this.req) { - this.req._request.resume(); - } - } - } - - module.exports = IncomingMessage; - - /***/ - }, - - /***/ 4645: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const http2 = __nccwpck_require__(7565); - const agent = __nccwpck_require__(9898); - const ClientRequest = __nccwpck_require__(9632); - const IncomingMessage = __nccwpck_require__(2575); - const auto = __nccwpck_require__(7167); - - const request = (url, options, callback) => { - return new ClientRequest(url, options, callback); - }; - - const get = (url, options, callback) => { - // eslint-disable-next-line unicorn/prevent-abbreviations - const req = new ClientRequest(url, options, callback); - req.end(); - - return req; - }; - - module.exports = { - ...http2, - ClientRequest, - IncomingMessage, - ...agent, - request, - get, - auto, - }; - - /***/ - }, - - /***/ 1982: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const net = __nccwpck_require__(1631); - /* istanbul ignore file: https://github.com/nodejs/node/blob/v13.0.1/lib/_http_agent.js */ - - module.exports = (options) => { - let servername = options.host; - const hostHeader = options.headers && options.headers.host; - - if (hostHeader) { - if (hostHeader.startsWith('[')) { - const index = hostHeader.indexOf(']'); - if (index === -1) { - servername = hostHeader; - } else { - servername = hostHeader.slice(1, -1); - } - } else { - servername = hostHeader.split(':', 1)[0]; - } - } - - if (net.isIP(servername)) { - return ''; - } - - return servername; - }; - - /***/ - }, - - /***/ 7087: /***/ (module) => { - 'use strict'; - - /* istanbul ignore file: https://github.com/nodejs/node/blob/master/lib/internal/errors.js */ - - const makeError = (Base, key, getMessage) => { - module.exports[key] = class NodeError extends Base { - constructor(...args) { - super( - typeof getMessage === 'string' ? getMessage : getMessage(args) - ); - this.name = `${super.name} [${key}]`; - this.code = key; - } - }; - }; - - makeError(TypeError, 'ERR_INVALID_ARG_TYPE', (args) => { - const type = args[0].includes('.') ? 'property' : 'argument'; - - let valid = args[1]; - const isManyTypes = Array.isArray(valid); - - if (isManyTypes) { - valid = `${valid.slice(0, -1).join(', ')} or ${valid.slice(-1)}`; - } - - return `The "${args[0]}" ${type} must be ${ - isManyTypes ? 'one of' : 'of' - } type ${valid}. Received ${typeof args[2]}`; - }); - - makeError(TypeError, 'ERR_INVALID_PROTOCOL', (args) => { - return `Protocol "${args[0]}" not supported. Expected "${args[1]}"`; - }); - - makeError(Error, 'ERR_HTTP_HEADERS_SENT', (args) => { - return `Cannot ${args[0]} headers after they are sent to the client`; - }); - - makeError(TypeError, 'ERR_INVALID_HTTP_TOKEN', (args) => { - return `${args[0]} must be a valid HTTP token [${args[1]}]`; - }); - - makeError(TypeError, 'ERR_HTTP_INVALID_HEADER_VALUE', (args) => { - return `Invalid value "${args[0]} for header "${args[1]}"`; - }); - - makeError(TypeError, 'ERR_INVALID_CHAR', (args) => { - return `Invalid character in ${args[0]} [${args[1]}]`; - }); - - /***/ - }, - - /***/ 1199: /***/ (module) => { - 'use strict'; - - module.exports = (header) => { - switch (header) { - case ':method': - case ':scheme': - case ':authority': - case ':path': - return true; - default: - return false; - } - }; - - /***/ - }, - - /***/ 1818: /***/ (module) => { - 'use strict'; - - module.exports = (from, to, events) => { - for (const event of events) { - from.on(event, (...args) => to.emit(event, ...args)); - } - }; - - /***/ - }, - - /***/ 2686: /***/ (module) => { - 'use strict'; - - /* istanbul ignore file: https://github.com/nodejs/node/blob/a91293d4d9ab403046ab5eb022332e4e3d249bd3/lib/internal/url.js#L1257 */ - - module.exports = (url) => { - const options = { - protocol: url.protocol, - hostname: - typeof url.hostname === 'string' && url.hostname.startsWith('[') - ? url.hostname.slice(1, -1) - : url.hostname, - host: url.host, - hash: url.hash, - search: url.search, - pathname: url.pathname, - href: url.href, - path: `${url.pathname || ''}${url.search || ''}`, - }; - - if (typeof url.port === 'string' && url.port.length !== 0) { - options.port = Number(url.port); - } - - if (url.username || url.password) { - options.auth = `${url.username || ''}:${url.password || ''}`; - } - - return options; - }; - - /***/ - }, - - /***/ 2820: /***/ (__unused_webpack_module, exports) => { - //TODO: handle reviver/dehydrate function like normal - //and handle indentation, like normal. - //if anyone needs this... please send pull request. - - exports.stringify = function stringify(o) { - if ('undefined' == typeof o) return o; - - if (o && Buffer.isBuffer(o)) - return JSON.stringify(':base64:' + o.toString('base64')); - - if (o && o.toJSON) o = o.toJSON(); - - if (o && 'object' === typeof o) { - var s = ''; - var array = Array.isArray(o); - s = array ? '[' : '{'; - var first = true; - - for (var k in o) { - var ignore = - 'function' == typeof o[k] || - (!array && 'undefined' === typeof o[k]); - if (Object.hasOwnProperty.call(o, k) && !ignore) { - if (!first) s += ','; - first = false; - if (array) { - if (o[k] == undefined) s += 'null'; - else s += stringify(o[k]); - } else if (o[k] !== void 0) { - s += stringify(k) + ':' + stringify(o[k]); - } - } - } - - s += array ? ']' : '}'; - - return s; - } else if ('string' === typeof o) { - return JSON.stringify(/^:/.test(o) ? ':' + o : o); - } else if ('undefined' === typeof o) { - return 'null'; - } else return JSON.stringify(o); - }; - - exports.parse = function (s) { - return JSON.parse(s, function (key, value) { - if ('string' === typeof value) { - if (/^:base64:/.test(value)) - return Buffer.from(value.substring(8), 'base64'); - else return /^:/.test(value) ? value.substring(1) : value; - } - return value; - }); - }; - - /***/ - }, - - /***/ 1531: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const EventEmitter = __nccwpck_require__(8614); - const JSONB = __nccwpck_require__(2820); - - const loadStore = (opts) => { - const adapters = { - redis: '@keyv/redis', - mongodb: '@keyv/mongo', - mongo: '@keyv/mongo', - sqlite: '@keyv/sqlite', - postgresql: '@keyv/postgres', - postgres: '@keyv/postgres', - mysql: '@keyv/mysql', - }; - if (opts.adapter || opts.uri) { - const adapter = opts.adapter || /^[^:]*/.exec(opts.uri)[0]; - return new (require(adapters[adapter]))(opts); - } - - return new Map(); - }; - - class Keyv extends EventEmitter { - constructor(uri, opts) { - super(); - this.opts = Object.assign( - { - namespace: 'keyv', - serialize: JSONB.stringify, - deserialize: JSONB.parse, - }, - typeof uri === 'string' ? { uri } : uri, - opts - ); - - if (!this.opts.store) { - const adapterOpts = Object.assign({}, this.opts); - this.opts.store = loadStore(adapterOpts); - } - - if (typeof this.opts.store.on === 'function') { - this.opts.store.on('error', (err) => this.emit('error', err)); - } - - this.opts.store.namespace = this.opts.namespace; - } - - _getKeyPrefix(key) { - return `${this.opts.namespace}:${key}`; - } - - get(key, opts) { - const keyPrefixed = this._getKeyPrefix(key); - const { store } = this.opts; - return Promise.resolve() - .then(() => store.get(keyPrefixed)) - .then((data) => { - return typeof data === 'string' - ? this.opts.deserialize(data) - : data; - }) - .then((data) => { - if (data === undefined) { - return undefined; - } - - if ( - typeof data.expires === 'number' && - Date.now() > data.expires - ) { - this.delete(key); - return undefined; - } - - return opts && opts.raw ? data : data.value; - }); - } - - set(key, value, ttl) { - const keyPrefixed = this._getKeyPrefix(key); - if (typeof ttl === 'undefined') { - ttl = this.opts.ttl; - } - - if (ttl === 0) { - ttl = undefined; - } - - const { store } = this.opts; - - return Promise.resolve() - .then(() => { - const expires = typeof ttl === 'number' ? Date.now() + ttl : null; - value = { value, expires }; - return this.opts.serialize(value); - }) - .then((value) => store.set(keyPrefixed, value, ttl)) - .then(() => true); - } - - delete(key) { - const keyPrefixed = this._getKeyPrefix(key); - const { store } = this.opts; - return Promise.resolve().then(() => store.delete(keyPrefixed)); - } - - clear() { - const { store } = this.opts; - return Promise.resolve().then(() => store.clear()); - } - } - - module.exports = Keyv; - - /***/ - }, - - /***/ 4232: /***/ (module) => { - 'use strict'; - - module.exports = longestStreak; - - // Get the count of the longest repeating streak of `character` in `value`. - function longestStreak(value, character) { - var count = 0; - var maximum = 0; - var expected; - var index; - - if (typeof character !== 'string' || character.length !== 1) { - throw new Error('Expected character'); - } - - value = String(value); - index = value.indexOf(character); - expected = index; - - while (index !== -1) { - count++; - - if (index === expected) { - if (count > maximum) { - maximum = count; - } - } else { - count = 1; - } - - expected = index + 1; - index = value.indexOf(character, expected); - } - - return maximum; - } - - /***/ - }, - - /***/ 9662: /***/ (module) => { - 'use strict'; - - module.exports = (object) => { - const result = {}; - - for (const [key, value] of Object.entries(object)) { - result[key.toLowerCase()] = value; - } - - return result; - }; - - /***/ - }, - - /***/ 6869: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = fromMarkdown; - - // These three are compiled away in the `dist/` - - var toString = __nccwpck_require__(5789); - var assign = __nccwpck_require__(3512); - var own = __nccwpck_require__(3500); - var normalizeIdentifier = __nccwpck_require__(712); - var safeFromInt = __nccwpck_require__(6214); - var parser = __nccwpck_require__(488); - var preprocessor = __nccwpck_require__(5603); - var postprocess = __nccwpck_require__(6948); - var decode = __nccwpck_require__(3485); - var stringifyPosition = __nccwpck_require__(1957); - - function fromMarkdown(value, encoding, options) { - if (typeof encoding !== 'string') { - options = encoding; - encoding = undefined; - } - - return compiler(options)( - postprocess( - parser(options) - .document() - .write(preprocessor()(value, encoding, true)) - ) - ); - } - - // Note this compiler only understand complete buffering, not streaming. - function compiler(options) { - var settings = options || {}; - var config = configure( - { - canContainEols: [ - 'emphasis', - 'fragment', - 'heading', - 'paragraph', - 'strong', - ], - - enter: { - autolink: opener(link), - autolinkProtocol: onenterdata, - autolinkEmail: onenterdata, - atxHeading: opener(heading), - blockQuote: opener(blockQuote), - characterEscape: onenterdata, - characterReference: onenterdata, - codeFenced: opener(codeFlow), - codeFencedFenceInfo: buffer, - codeFencedFenceMeta: buffer, - codeIndented: opener(codeFlow, buffer), - codeText: opener(codeText, buffer), - codeTextData: onenterdata, - data: onenterdata, - codeFlowValue: onenterdata, - definition: opener(definition), - definitionDestinationString: buffer, - definitionLabelString: buffer, - definitionTitleString: buffer, - emphasis: opener(emphasis), - hardBreakEscape: opener(hardBreak), - hardBreakTrailing: opener(hardBreak), - htmlFlow: opener(html, buffer), - htmlFlowData: onenterdata, - htmlText: opener(html, buffer), - htmlTextData: onenterdata, - image: opener(image), - label: buffer, - link: opener(link), - listItem: opener(listItem), - listItemValue: onenterlistitemvalue, - listOrdered: opener(list, onenterlistordered), - listUnordered: opener(list), - paragraph: opener(paragraph), - reference: onenterreference, - referenceString: buffer, - resourceDestinationString: buffer, - resourceTitleString: buffer, - setextHeading: opener(heading), - strong: opener(strong), - thematicBreak: opener(thematicBreak), - }, - - exit: { - atxHeading: closer(), - atxHeadingSequence: onexitatxheadingsequence, - autolink: closer(), - autolinkEmail: onexitautolinkemail, - autolinkProtocol: onexitautolinkprotocol, - blockQuote: closer(), - characterEscapeValue: onexitdata, - characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, - characterReferenceMarkerNumeric: onexitcharacterreferencemarker, - characterReferenceValue: onexitcharacterreferencevalue, - codeFenced: closer(onexitcodefenced), - codeFencedFence: onexitcodefencedfence, - codeFencedFenceInfo: onexitcodefencedfenceinfo, - codeFencedFenceMeta: onexitcodefencedfencemeta, - codeFlowValue: onexitdata, - codeIndented: closer(onexitcodeindented), - codeText: closer(onexitcodetext), - codeTextData: onexitdata, - data: onexitdata, - definition: closer(), - definitionDestinationString: onexitdefinitiondestinationstring, - definitionLabelString: onexitdefinitionlabelstring, - definitionTitleString: onexitdefinitiontitlestring, - emphasis: closer(), - hardBreakEscape: closer(onexithardbreak), - hardBreakTrailing: closer(onexithardbreak), - htmlFlow: closer(onexithtmlflow), - htmlFlowData: onexitdata, - htmlText: closer(onexithtmltext), - htmlTextData: onexitdata, - image: closer(onexitimage), - label: onexitlabel, - labelText: onexitlabeltext, - lineEnding: onexitlineending, - link: closer(onexitlink), - listItem: closer(), - listOrdered: closer(), - listUnordered: closer(), - paragraph: closer(), - referenceString: onexitreferencestring, - resourceDestinationString: onexitresourcedestinationstring, - resourceTitleString: onexitresourcetitlestring, - resource: onexitresource, - setextHeading: closer(onexitsetextheading), - setextHeadingLineSequence: onexitsetextheadinglinesequence, - setextHeadingText: onexitsetextheadingtext, - strong: closer(), - thematicBreak: closer(), - }, - }, - - settings.mdastExtensions || [] - ); - - var data = {}; - - return compile; - - function compile(events) { - var stack = [{ type: 'root', children: [] }]; - var tokenStack = []; - var listStack = []; - var index = -1; - var handler; - var listStart; - - var context = { - stack: stack, - tokenStack: tokenStack, - config: config, - enter: enter, - exit: exit, - buffer: buffer, - resume: resume, - setData: setData, - getData: getData, - }; - - while (++index < events.length) { - // We preprocess lists to add `listItem` tokens, and to infer whether - // items the list itself are spread out. - if ( - events[index][1].type === 'listOrdered' || - events[index][1].type === 'listUnordered' - ) { - if (events[index][0] === 'enter') { - listStack.push(index); - } else { - listStart = listStack.pop(index); - index = prepareList(events, listStart, index); - } - } - } - - index = -1; - - while (++index < events.length) { - handler = config[events[index][0]]; - - if (own.call(handler, events[index][1].type)) { - handler[events[index][1].type].call( - assign( - { sliceSerialize: events[index][2].sliceSerialize }, - context - ), - events[index][1] - ); - } - } - - if (tokenStack.length) { - throw new Error( - 'Cannot close document, a token (`' + - tokenStack[tokenStack.length - 1].type + - '`, ' + - stringifyPosition({ - start: tokenStack[tokenStack.length - 1].start, - end: tokenStack[tokenStack.length - 1].end, - }) + - ') is still open' - ); - } - - // Figure out `root` position. - stack[0].position = { - start: point( - events.length - ? events[0][1].start - : { line: 1, column: 1, offset: 0 } - ), - - end: point( - events.length - ? events[events.length - 2][1].end - : { line: 1, column: 1, offset: 0 } - ), - }; - - return stack[0]; - } - - function prepareList(events, start, length) { - var index = start - 1; - var containerBalance = -1; - var listSpread = false; - var listItem; - var tailIndex; - var lineIndex; - var tailEvent; - var event; - var firstBlankLineIndex; - var atMarker; - - while (++index <= length) { - event = events[index]; - - if ( - event[1].type === 'listUnordered' || - event[1].type === 'listOrdered' || - event[1].type === 'blockQuote' - ) { - if (event[0] === 'enter') { - containerBalance++; - } else { - containerBalance--; - } - - atMarker = undefined; - } else if (event[1].type === 'lineEndingBlank') { - if (event[0] === 'enter') { - if ( - listItem && - !atMarker && - !containerBalance && - !firstBlankLineIndex - ) { - firstBlankLineIndex = index; - } - - atMarker = undefined; - } - } else if ( - event[1].type === 'linePrefix' || - event[1].type === 'listItemValue' || - event[1].type === 'listItemMarker' || - event[1].type === 'listItemPrefix' || - event[1].type === 'listItemPrefixWhitespace' - ) { - // Empty. - } else { - atMarker = undefined; - } - - if ( - (!containerBalance && - event[0] === 'enter' && - event[1].type === 'listItemPrefix') || - (containerBalance === -1 && - event[0] === 'exit' && - (event[1].type === 'listUnordered' || - event[1].type === 'listOrdered')) - ) { - if (listItem) { - tailIndex = index; - lineIndex = undefined; - - while (tailIndex--) { - tailEvent = events[tailIndex]; - - if ( - tailEvent[1].type === 'lineEnding' || - tailEvent[1].type === 'lineEndingBlank' - ) { - if (tailEvent[0] === 'exit') continue; - - if (lineIndex) { - events[lineIndex][1].type = 'lineEndingBlank'; - listSpread = true; - } - - tailEvent[1].type = 'lineEnding'; - lineIndex = tailIndex; - } else if ( - tailEvent[1].type === 'linePrefix' || - tailEvent[1].type === 'blockQuotePrefix' || - tailEvent[1].type === 'blockQuotePrefixWhitespace' || - tailEvent[1].type === 'blockQuoteMarker' || - tailEvent[1].type === 'listItemIndent' - ) { - // Empty - } else { - break; - } - } - - if ( - firstBlankLineIndex && - (!lineIndex || firstBlankLineIndex < lineIndex) - ) { - listItem._spread = true; - } - - // Fix position. - listItem.end = point( - lineIndex ? events[lineIndex][1].start : event[1].end - ); - - events.splice(lineIndex || index, 0, [ - 'exit', - listItem, - event[2], - ]); - index++; - length++; - } - - // Create a new list item. - if (event[1].type === 'listItemPrefix') { - listItem = { - type: 'listItem', - _spread: false, - start: point(event[1].start), - }; - - events.splice(index, 0, ['enter', listItem, event[2]]); - index++; - length++; - firstBlankLineIndex = undefined; - atMarker = true; - } - } - } - - events[start][1]._spread = listSpread; - return length; - } - - function setData(key, value) { - data[key] = value; - } - - function getData(key) { - return data[key]; - } - - function point(d) { - return { line: d.line, column: d.column, offset: d.offset }; - } - - function opener(create, and) { - return open; - - function open(token) { - enter.call(this, create(token), token); - if (and) and.call(this, token); - } - } - - function buffer() { - this.stack.push({ type: 'fragment', children: [] }); - } - - function enter(node, token) { - this.stack[this.stack.length - 1].children.push(node); - this.stack.push(node); - this.tokenStack.push(token); - node.position = { start: point(token.start) }; - return node; - } - - function closer(and) { - return close; - - function close(token) { - if (and) and.call(this, token); - exit.call(this, token); - } - } - - function exit(token) { - var node = this.stack.pop(); - var open = this.tokenStack.pop(); - - if (!open) { - throw new Error( - 'Cannot close `' + - token.type + - '` (' + - stringifyPosition({ start: token.start, end: token.end }) + - '): it’s not open' - ); - } else if (open.type !== token.type) { - throw new Error( - 'Cannot close `' + - token.type + - '` (' + - stringifyPosition({ start: token.start, end: token.end }) + - '): a different token (`' + - open.type + - '`, ' + - stringifyPosition({ start: open.start, end: open.end }) + - ') is open' - ); - } - - node.position.end = point(token.end); - return node; - } - - function resume() { - return toString(this.stack.pop()); - } - - // - // Handlers. - // - - function onenterlistordered() { - setData('expectingFirstListItemValue', true); - } - - function onenterlistitemvalue(token) { - if (getData('expectingFirstListItemValue')) { - this.stack[this.stack.length - 2].start = parseInt( - this.sliceSerialize(token), - 10 - ); - - setData('expectingFirstListItemValue'); - } - } - - function onexitcodefencedfenceinfo() { - var data = this.resume(); - this.stack[this.stack.length - 1].lang = data; - } - - function onexitcodefencedfencemeta() { - var data = this.resume(); - this.stack[this.stack.length - 1].meta = data; - } - - function onexitcodefencedfence() { - // Exit if this is the closing fence. - if (getData('flowCodeInside')) return; - this.buffer(); - setData('flowCodeInside', true); - } - - function onexitcodefenced() { - var data = this.resume(); - this.stack[this.stack.length - 1].value = data.replace( - /^(\r?\n|\r)|(\r?\n|\r)$/g, - '' - ); - - setData('flowCodeInside'); - } - - function onexitcodeindented() { - var data = this.resume(); - this.stack[this.stack.length - 1].value = data; - } - - function onexitdefinitionlabelstring(token) { - // Discard label, use the source content instead. - var label = this.resume(); - this.stack[this.stack.length - 1].label = label; - this.stack[this.stack.length - 1].identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase(); - } - - function onexitdefinitiontitlestring() { - var data = this.resume(); - this.stack[this.stack.length - 1].title = data; - } - - function onexitdefinitiondestinationstring() { - var data = this.resume(); - this.stack[this.stack.length - 1].url = data; - } - - function onexitatxheadingsequence(token) { - if (!this.stack[this.stack.length - 1].depth) { - this.stack[this.stack.length - 1].depth = this.sliceSerialize( - token - ).length; - } - } - - function onexitsetextheadingtext() { - setData('setextHeadingSlurpLineEnding', true); - } - - function onexitsetextheadinglinesequence(token) { - this.stack[this.stack.length - 1].depth = - this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2; - } - - function onexitsetextheading() { - setData('setextHeadingSlurpLineEnding'); - } - - function onenterdata(token) { - var siblings = this.stack[this.stack.length - 1].children; - var tail = siblings[siblings.length - 1]; - - if (!tail || tail.type !== 'text') { - // Add a new text node. - tail = text(); - tail.position = { start: point(token.start) }; - this.stack[this.stack.length - 1].children.push(tail); - } - - this.stack.push(tail); - } - - function onexitdata(token) { - var tail = this.stack.pop(); - tail.value += this.sliceSerialize(token); - tail.position.end = point(token.end); - } - - function onexitlineending(token) { - var context = this.stack[this.stack.length - 1]; - - // If we’re at a hard break, include the line ending in there. - if (getData('atHardBreak')) { - context.children[context.children.length - 1].position.end = point( - token.end - ); - - setData('atHardBreak'); - return; - } - - if ( - !getData('setextHeadingSlurpLineEnding') && - config.canContainEols.indexOf(context.type) > -1 - ) { - onenterdata.call(this, token); - onexitdata.call(this, token); - } - } - - function onexithardbreak() { - setData('atHardBreak', true); - } - - function onexithtmlflow() { - var data = this.resume(); - this.stack[this.stack.length - 1].value = data; - } - - function onexithtmltext() { - var data = this.resume(); - this.stack[this.stack.length - 1].value = data; - } - - function onexitcodetext() { - var data = this.resume(); - this.stack[this.stack.length - 1].value = data; - } - - function onexitlink() { - var context = this.stack[this.stack.length - 1]; - - // To do: clean. - if (getData('inReference')) { - context.type += 'Reference'; - context.referenceType = getData('referenceType') || 'shortcut'; - delete context.url; - delete context.title; - } else { - delete context.identifier; - delete context.label; - delete context.referenceType; - } - - setData('referenceType'); - } - - function onexitimage() { - var context = this.stack[this.stack.length - 1]; - - // To do: clean. - if (getData('inReference')) { - context.type += 'Reference'; - context.referenceType = getData('referenceType') || 'shortcut'; - delete context.url; - delete context.title; - } else { - delete context.identifier; - delete context.label; - delete context.referenceType; - } - - setData('referenceType'); - } - - function onexitlabeltext(token) { - this.stack[this.stack.length - 2].identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase(); - } - - function onexitlabel() { - var fragment = this.stack[this.stack.length - 1]; - var value = this.resume(); - - this.stack[this.stack.length - 1].label = value; - - // Assume a reference. - setData('inReference', true); - - if (this.stack[this.stack.length - 1].type === 'link') { - this.stack[this.stack.length - 1].children = fragment.children; - } else { - this.stack[this.stack.length - 1].alt = value; - } - } - - function onexitresourcedestinationstring() { - var data = this.resume(); - this.stack[this.stack.length - 1].url = data; - } - - function onexitresourcetitlestring() { - var data = this.resume(); - this.stack[this.stack.length - 1].title = data; - } - - function onexitresource() { - setData('inReference'); - } - - function onenterreference() { - setData('referenceType', 'collapsed'); - } - - function onexitreferencestring(token) { - var label = this.resume(); - this.stack[this.stack.length - 1].label = label; - this.stack[this.stack.length - 1].identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase(); - setData('referenceType', 'full'); - } - - function onexitcharacterreferencemarker(token) { - setData('characterReferenceType', token.type); - } - - function onexitcharacterreferencevalue(token) { - var data = this.sliceSerialize(token); - var type = getData('characterReferenceType'); - var value; - var tail; - - if (type) { - value = safeFromInt( - data, - type === 'characterReferenceMarkerNumeric' ? 10 : 16 - ); - - setData('characterReferenceType'); - } else { - value = decode(data); - } - - tail = this.stack.pop(); - tail.value += value; - tail.position.end = point(token.end); - } - - function onexitautolinkprotocol(token) { - onexitdata.call(this, token); - this.stack[this.stack.length - 1].url = this.sliceSerialize(token); - } - - function onexitautolinkemail(token) { - onexitdata.call(this, token); - this.stack[this.stack.length - 1].url = - 'mailto:' + this.sliceSerialize(token); - } - - // - // Creaters. - // - - function blockQuote() { - return { type: 'blockquote', children: [] }; - } - - function codeFlow() { - return { type: 'code', lang: null, meta: null, value: '' }; - } - - function codeText() { - return { type: 'inlineCode', value: '' }; - } - - function definition() { - return { - type: 'definition', - identifier: '', - label: null, - title: null, - url: '', - }; - } - - function emphasis() { - return { type: 'emphasis', children: [] }; - } - - function heading() { - return { type: 'heading', depth: undefined, children: [] }; - } - - function hardBreak() { - return { type: 'break' }; - } - - function html() { - return { type: 'html', value: '' }; - } - - function image() { - return { type: 'image', title: null, url: '', alt: null }; - } - - function link() { - return { type: 'link', title: null, url: '', children: [] }; - } - - function list(token) { - return { - type: 'list', - ordered: token.type === 'listOrdered', - start: null, - spread: token._spread, - children: [], - }; - } - - function listItem(token) { - return { - type: 'listItem', - spread: token._spread, - checked: null, - children: [], - }; - } - - function paragraph() { - return { type: 'paragraph', children: [] }; - } - - function strong() { - return { type: 'strong', children: [] }; - } - - function text() { - return { type: 'text', value: '' }; - } - - function thematicBreak() { - return { type: 'thematicBreak' }; - } - } - - function configure(config, extensions) { - var index = -1; - - while (++index < extensions.length) { - extension(config, extensions[index]); - } - - return config; - } - - function extension(config, extension) { - var key; - var left; - - for (key in extension) { - left = own.call(config, key) ? config[key] : (config[key] = {}); - - if (key === 'canContainEols') { - config[key] = [].concat(left, extension[key]); - } else { - Object.assign(left, extension[key]); - } - } - } - - /***/ - }, - - /***/ 3068: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = __nccwpck_require__(6869); - - /***/ - }, - - /***/ 219: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = __nccwpck_require__(3683); - - /***/ - }, - - /***/ 9363: /***/ (module) => { - module.exports = configure; - - function configure(base, extension) { - var index = -1; - var key; - - // First do subextensions. - if (extension.extensions) { - while (++index < extension.extensions.length) { - configure(base, extension.extensions[index]); - } - } - - for (key in extension) { - if (key === 'extensions') { - // Empty. - } else if (key === 'unsafe' || key === 'join') { - base[key] = base[key].concat(extension[key] || []); - } else if (key === 'handlers') { - base[key] = Object.assign(base[key], extension[key] || {}); - } else { - base.options[key] = extension[key]; - } - } - - return base; - } - - /***/ - }, - - /***/ 3920: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = blockquote; - - var flow = __nccwpck_require__(7530); - var indentLines = __nccwpck_require__(6887); - - function blockquote(node, _, context) { - var exit = context.enter('blockquote'); - var value = indentLines(flow(node, context), map); - exit(); - return value; - } - - function map(line, index, blank) { - return '>' + (blank ? '' : ' ') + line; - } - - /***/ - }, - - /***/ 229: /***/ (module) => { - module.exports = hardBreak; - - function hardBreak() { - return '\\\n'; - } - - /***/ - }, - - /***/ 5268: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = code; - - var repeat = __nccwpck_require__(6976); - var streak = __nccwpck_require__(4232); - var formatCodeAsIndented = __nccwpck_require__(8446); - var checkFence = __nccwpck_require__(158); - var indentLines = __nccwpck_require__(6887); - var safe = __nccwpck_require__(3906); - - function code(node, _, context) { - var marker = checkFence(context); - var raw = node.value || ''; - var suffix = marker === '`' ? 'GraveAccent' : 'Tilde'; - var value; - var sequence; - var exit; - var subexit; - - if (formatCodeAsIndented(node, context)) { - exit = context.enter('codeIndented'); - value = indentLines(raw, map); - } else { - sequence = repeat(marker, Math.max(streak(raw, marker) + 1, 3)); - exit = context.enter('codeFenced'); - value = sequence; - - if (node.lang) { - subexit = context.enter('codeFencedLang' + suffix); - value += safe(context, node.lang, { - before: '`', - after: ' ', - encode: ['`'], - }); - subexit(); - } - - if (node.lang && node.meta) { - subexit = context.enter('codeFencedMeta' + suffix); - value += - ' ' + - safe(context, node.meta, { - before: ' ', - after: '\n', - encode: ['`'], - }); - subexit(); - } - - value += '\n'; - - if (raw) { - value += raw + '\n'; - } - - value += sequence; - } - - exit(); - return value; - } - - function map(line, _, blank) { - return (blank ? '' : ' ') + line; - } - - /***/ - }, - - /***/ 7385: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = definition; - - var association = __nccwpck_require__(9211); - var checkQuote = __nccwpck_require__(3366); - var safe = __nccwpck_require__(3906); - - function definition(node, _, context) { - var marker = checkQuote(context); - var suffix = marker === '"' ? 'Quote' : 'Apostrophe'; - var exit = context.enter('definition'); - var subexit = context.enter('label'); - var value = - '[' + - safe(context, association(node), { before: '[', after: ']' }) + - ']: '; - - subexit(); - - if ( - // If there’s no url, or… - !node.url || - // If there’s whitespace, enclosed is prettier. - /[ \t\r\n]/.test(node.url) - ) { - subexit = context.enter('destinationLiteral'); - value += - '<' + safe(context, node.url, { before: '<', after: '>' }) + '>'; - } else { - // No whitespace, raw is prettier. - subexit = context.enter('destinationRaw'); - value += safe(context, node.url, { before: ' ', after: ' ' }); - } - - subexit(); - - if (node.title) { - subexit = context.enter('title' + suffix); - value += - ' ' + - marker + - safe(context, node.title, { before: marker, after: marker }) + - marker; - subexit(); - } - - exit(); - - return value; - } - - /***/ - }, - - /***/ 8909: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = emphasis; - emphasis.peek = emphasisPeek; - - var checkEmphasis = __nccwpck_require__(6452); - var phrasing = __nccwpck_require__(7489); - - // To do: there are cases where emphasis cannot “form” depending on the - // previous or next character of sequences. - // There’s no way around that though, except for injecting zero-width stuff. - // Do we need to safeguard against that? - function emphasis(node, _, context) { - var marker = checkEmphasis(context); - var exit = context.enter('emphasis'); - var value = phrasing(node, context, { before: marker, after: marker }); - exit(); - return marker + value + marker; - } - - function emphasisPeek(node, _, context) { - return context.options.emphasis || '*'; - } - - /***/ - }, - - /***/ 2568: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = heading; - - var repeat = __nccwpck_require__(6976); - var formatHeadingAsSetext = __nccwpck_require__(4954); - var phrasing = __nccwpck_require__(7489); - - function heading(node, _, context) { - var rank = Math.max(Math.min(6, node.depth || 1), 1); - var exit; - var subexit; - var value; - var sequence; - - if (formatHeadingAsSetext(node, context)) { - exit = context.enter('headingSetext'); - subexit = context.enter('phrasing'); - value = phrasing(node, context, { before: '\n', after: '\n' }); - subexit(); - exit(); - - return ( - value + - '\n' + - repeat( - rank === 1 ? '=' : '-', - // The whole size… - value.length - - // Minus the position of the character after the last EOL (or - // 0 if there is none)… - (Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1) - ) - ); - } - - sequence = repeat('#', rank); - exit = context.enter('headingAtx'); - subexit = context.enter('phrasing'); - value = phrasing(node, context, { before: '# ', after: '\n' }); - value = value ? sequence + ' ' + value : sequence; - if (context.options.closeAtx) { - value += ' ' + sequence; - } - - subexit(); - exit(); - - return value; - } - - /***/ - }, - - /***/ 5538: /***/ (module) => { - module.exports = html; - - function html(node) { - return node.value || ''; - } - - /***/ - }, - - /***/ 3885: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = imageReference; - imageReference.peek = imageReferencePeek; - - var association = __nccwpck_require__(9211); - var safe = __nccwpck_require__(3906); - - function imageReference(node, _, context) { - var type = node.referenceType; - var exit = context.enter('imageReference'); - var subexit = context.enter('label'); - var alt = safe(context, node.alt, { before: '[', after: ']' }); - var value = '![' + alt + ']'; - var reference; - var stack; - - subexit(); - // Hide the fact that we’re in phrasing, because escapes don’t work. - stack = context.stack; - context.stack = []; - subexit = context.enter('reference'); - reference = safe(context, association(node), { - before: '[', - after: ']', - }); - subexit(); - context.stack = stack; - exit(); - - if (type === 'full' || !alt || alt !== reference) { - value += '[' + reference + ']'; - } else if (type !== 'shortcut') { - value += '[]'; - } - - return value; - } - - function imageReferencePeek() { - return '!'; - } - - /***/ - }, - - /***/ 1591: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = image; - image.peek = imagePeek; - - var checkQuote = __nccwpck_require__(3366); - var safe = __nccwpck_require__(3906); - - function image(node, _, context) { - var quote = checkQuote(context); - var suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - var exit = context.enter('image'); - var subexit = context.enter('label'); - var value = - '![' + safe(context, node.alt, { before: '[', after: ']' }) + ']('; - - subexit(); - - if ( - // If there’s no url but there is a title… - (!node.url && node.title) || - // Or if there’s markdown whitespace or an eol, enclose. - /[ \t\r\n]/.test(node.url) - ) { - subexit = context.enter('destinationLiteral'); - value += - '<' + safe(context, node.url, { before: '<', after: '>' }) + '>'; - } else { - // No whitespace, raw is prettier. - subexit = context.enter('destinationRaw'); - value += safe(context, node.url, { - before: '(', - after: node.title ? ' ' : ')', - }); - } - - subexit(); - - if (node.title) { - subexit = context.enter('title' + suffix); - value += - ' ' + - quote + - safe(context, node.title, { before: quote, after: quote }) + - quote; - subexit(); - } - - value += ')'; - exit(); - - return value; - } - - function imagePeek() { - return '!'; - } - - /***/ - }, - - /***/ 3769: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - exports.blockquote = __nccwpck_require__(3920); - exports.break = __nccwpck_require__(229); - exports.code = __nccwpck_require__(5268); - exports.definition = __nccwpck_require__(7385); - exports.emphasis = __nccwpck_require__(8909); - exports.hardBreak = __nccwpck_require__(229); - exports.heading = __nccwpck_require__(2568); - exports.html = __nccwpck_require__(5538); - exports.image = __nccwpck_require__(1591); - exports.imageReference = __nccwpck_require__(3885); - exports.inlineCode = __nccwpck_require__(5645); - exports.link = __nccwpck_require__(7938); - exports.linkReference = __nccwpck_require__(9556); - exports.list = __nccwpck_require__(9323); - exports.listItem = __nccwpck_require__(7016); - exports.paragraph = __nccwpck_require__(5197); - exports.root = __nccwpck_require__(54); - exports.strong = __nccwpck_require__(2150); - exports.text = __nccwpck_require__(2124); - exports.thematicBreak = __nccwpck_require__(3960); - - /***/ - }, - - /***/ 5645: /***/ (module) => { - module.exports = inlineCode; - inlineCode.peek = inlineCodePeek; - - function inlineCode(node) { - var value = node.value || ''; - var sequence = '`'; - var pad = ''; - - // If there is a single grave accent on its own in the code, use a fence of - // two. - // If there are two in a row, use one. - while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) { - sequence += '`'; - } - - // If this is not just spaces or eols (tabs don’t count), and either the - // first or last character are a space, eol, or tick, then pad with spaces. - if ( - /[^ \r\n]/.test(value) && - (/[ \r\n`]/.test(value.charAt(0)) || - /[ \r\n`]/.test(value.charAt(value.length - 1))) - ) { - pad = ' '; - } - - return sequence + pad + value + pad + sequence; - } - - function inlineCodePeek() { - return '`'; - } - - /***/ - }, - - /***/ 9556: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = linkReference; - linkReference.peek = linkReferencePeek; - - var association = __nccwpck_require__(9211); - var phrasing = __nccwpck_require__(7489); - var safe = __nccwpck_require__(3906); - - function linkReference(node, _, context) { - var type = node.referenceType; - var exit = context.enter('linkReference'); - var subexit = context.enter('label'); - var text = phrasing(node, context, { before: '[', after: ']' }); - var value = '[' + text + ']'; - var reference; - var stack; - - subexit(); - // Hide the fact that we’re in phrasing, because escapes don’t work. - stack = context.stack; - context.stack = []; - subexit = context.enter('reference'); - reference = safe(context, association(node), { - before: '[', - after: ']', - }); - subexit(); - context.stack = stack; - exit(); - - if (type === 'full' || !text || text !== reference) { - value += '[' + reference + ']'; - } else if (type !== 'shortcut') { - value += '[]'; - } - - return value; - } - - function linkReferencePeek() { - return '['; - } - - /***/ - }, - - /***/ 7938: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = link; - link.peek = linkPeek; - - var checkQuote = __nccwpck_require__(3366); - var formatLinkAsAutolink = __nccwpck_require__(5358); - var phrasing = __nccwpck_require__(7489); - var safe = __nccwpck_require__(3906); - - function link(node, _, context) { - var quote = checkQuote(context); - var suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - var exit; - var subexit; - var value; - var stack; - - if (formatLinkAsAutolink(node, context)) { - // Hide the fact that we’re in phrasing, because escapes don’t work. - stack = context.stack; - context.stack = []; - exit = context.enter('autolink'); - value = - '<' + phrasing(node, context, { before: '<', after: '>' }) + '>'; - exit(); - context.stack = stack; - return value; - } - - exit = context.enter('link'); - subexit = context.enter('label'); - value = - '[' + phrasing(node, context, { before: '[', after: ']' }) + ']('; - subexit(); - - if ( - // If there’s no url but there is a title… - (!node.url && node.title) || - // Or if there’s markdown whitespace or an eol, enclose. - /[ \t\r\n]/.test(node.url) - ) { - subexit = context.enter('destinationLiteral'); - value += - '<' + safe(context, node.url, { before: '<', after: '>' }) + '>'; - } else { - // No whitespace, raw is prettier. - subexit = context.enter('destinationRaw'); - value += safe(context, node.url, { - before: '(', - after: node.title ? ' ' : ')', - }); - } - - subexit(); - - if (node.title) { - subexit = context.enter('title' + suffix); - value += - ' ' + - quote + - safe(context, node.title, { before: quote, after: quote }) + - quote; - subexit(); - } - - value += ')'; - - exit(); - return value; - } - - function linkPeek(node, _, context) { - return formatLinkAsAutolink(node, context) ? '<' : '['; - } - - /***/ - }, - - /***/ 7016: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = listItem; - - var repeat = __nccwpck_require__(6976); - var checkBullet = __nccwpck_require__(8599); - var checkListItemIndent = __nccwpck_require__(9009); - var flow = __nccwpck_require__(7530); - var indentLines = __nccwpck_require__(6887); - - function listItem(node, parent, context) { - var bullet = checkBullet(context); - var listItemIndent = checkListItemIndent(context); - var size; - var value; - var exit; - - if (parent && parent.ordered) { - bullet = - (parent.start > -1 ? parent.start : 1) + - (context.options.incrementListMarker === false - ? 0 - : parent.children.indexOf(node)) + - '.'; - } - - size = bullet.length + 1; - - if ( - listItemIndent === 'tab' || - (listItemIndent === 'mixed' && - ((parent && parent.spread) || node.spread)) - ) { - size = Math.ceil(size / 4) * 4; - } - - exit = context.enter('listItem'); - value = indentLines(flow(node, context), map); - exit(); - - return value; - - function map(line, index, blank) { - if (index) { - return (blank ? '' : repeat(' ', size)) + line; - } - - return ( - (blank ? bullet : bullet + repeat(' ', size - bullet.length)) + line - ); - } - } - - /***/ - }, - - /***/ 9323: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = list; - - var flow = __nccwpck_require__(7530); - - function list(node, _, context) { - var exit = context.enter('list'); - var value = flow(node, context); - exit(); - return value; - } - - /***/ - }, - - /***/ 5197: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = paragraph; - - var phrasing = __nccwpck_require__(7489); - - function paragraph(node, _, context) { - var exit = context.enter('paragraph'); - var subexit = context.enter('phrasing'); - var value = phrasing(node, context, { before: '\n', after: '\n' }); - subexit(); - exit(); - return value; - } - - /***/ - }, - - /***/ 54: /***/ (module, __unused_webpack_exports, __nccwpck_require__) => { - module.exports = root; - - var flow = __nccwpck_require__(7530); - - function root(node, _, context) { - return flow(node, context); - } - - /***/ - }, - - /***/ 2150: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = strong; - strong.peek = strongPeek; - - var checkStrong = __nccwpck_require__(3534); - var phrasing = __nccwpck_require__(7489); - - // To do: there are cases where emphasis cannot “form” depending on the - // previous or next character of sequences. - // There’s no way around that though, except for injecting zero-width stuff. - // Do we need to safeguard against that? - function strong(node, _, context) { - var marker = checkStrong(context); - var exit = context.enter('strong'); - var value = phrasing(node, context, { before: marker, after: marker }); - exit(); - return marker + marker + value + marker + marker; - } - - function strongPeek(node, _, context) { - return context.options.strong || '*'; - } - - /***/ - }, - - /***/ 2124: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = text; - - var safe = __nccwpck_require__(3906); - - function text(node, parent, context, safeOptions) { - return safe(context, node.value, safeOptions); - } - - /***/ - }, - - /***/ 3960: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = thematicBreak; - - var repeat = __nccwpck_require__(6976); - var checkRepeat = __nccwpck_require__(3680); - var checkRule = __nccwpck_require__(7253); - - function thematicBreak(node, parent, context) { - var value = repeat( - checkRule(context) + (context.options.ruleSpaces ? ' ' : ''), - checkRepeat(context) - ); - - return context.options.ruleSpaces ? value.slice(0, -1) : value; - } - - /***/ - }, - - /***/ 3683: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = toMarkdown; - - var zwitch = __nccwpck_require__(1067); - var configure = __nccwpck_require__(9363); - var defaultHandlers = __nccwpck_require__(3769); - var defaultJoin = __nccwpck_require__(3701); - var defaultUnsafe = __nccwpck_require__(6566); - - function toMarkdown(tree, options) { - var settings = options || {}; - var context = { - enter: enter, - stack: [], - unsafe: [], - join: [], - handlers: {}, - options: {}, - }; - var result; - - configure(context, { - unsafe: defaultUnsafe, - join: defaultJoin, - handlers: defaultHandlers, - }); - configure(context, settings); - - if (context.options.tightDefinitions) { - context.join = [joinDefinition].concat(context.join); - } - - context.handle = zwitch('type', { - invalid: invalid, - unknown: unknown, - handlers: context.handlers, - }); - - result = context.handle(tree, null, context, { - before: '\n', - after: '\n', - }); - - if ( - result && - result.charCodeAt(result.length - 1) !== 10 && - result.charCodeAt(result.length - 1) !== 13 - ) { - result += '\n'; - } - - return result; - - function enter(name) { - context.stack.push(name); - return exit; - - function exit() { - context.stack.pop(); - } - } - } - - function invalid(value) { - throw new Error('Cannot handle value `' + value + '`, expected node'); - } - - function unknown(node) { - throw new Error('Cannot handle unknown node `' + node.type + '`'); - } - - function joinDefinition(left, right) { - // No blank line between adjacent definitions. - if (left.type === 'definition' && left.type === right.type) { - return 0; - } - } - - /***/ - }, - - /***/ 3701: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = [joinDefaults]; - - var formatCodeAsIndented = __nccwpck_require__(8446); - var formatHeadingAsSetext = __nccwpck_require__(4954); - - function joinDefaults(left, right, parent, context) { - if ( - // Two lists with the same marker. - (right.type === 'list' && - right.type === left.type && - Boolean(left.ordered) === Boolean(right.ordered)) || - // Indented code after list or another indented code. - (right.type === 'code' && - formatCodeAsIndented(right, context) && - (left.type === 'list' || - (left.type === right.type && - formatCodeAsIndented(left, context)))) - ) { - return false; - } - - // Join children of a list or an item. - // In which case, `parent` has a `spread` field. - if (typeof parent.spread === 'boolean') { - if ( - left.type === 'paragraph' && - // Two paragraphs. - (left.type === right.type || - right.type === 'definition' || - // Paragraph followed by a setext heading. - (right.type === 'heading' && - formatHeadingAsSetext(right, context))) - ) { - return; - } - - return parent.spread ? 1 : 0; - } - } - - /***/ - }, - - /***/ 6566: /***/ (module) => { - module.exports = [ - { - character: '\t', - inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'], - }, - { - character: '\r', - inConstruct: [ - 'codeFencedLangGraveAccent', - 'codeFencedLangTilde', - 'codeFencedMetaGraveAccent', - 'codeFencedMetaTilde', - 'destinationLiteral', - 'headingAtx', - ], - }, - { - character: '\n', - inConstruct: [ - 'codeFencedLangGraveAccent', - 'codeFencedLangTilde', - 'codeFencedMetaGraveAccent', - 'codeFencedMetaTilde', - 'destinationLiteral', - 'headingAtx', - ], - }, - { - character: ' ', - inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'], - }, - // An exclamation mark can start an image, if it is followed by a link or - // a link reference. - { character: '!', after: '\\[', inConstruct: 'phrasing' }, - // A quote can break out of a title. - { character: '"', inConstruct: 'titleQuote' }, - // A number sign could start an ATX heading if it starts a line. - { atBreak: true, character: '#' }, - // Dollar sign and percentage are not used in markdown. - // An ampersand could start a character reference. - { character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing' }, - // An apostrophe can break out of a title. - { character: "'", inConstruct: 'titleApostrophe' }, - // A left paren could break out of a destination raw. - { character: '(', inConstruct: 'destinationRaw' }, - { before: '\\]', character: '(', inConstruct: 'phrasing' }, - // A right paren could start a list item or break out of a destination - // raw. - { atBreak: true, before: '\\d+', character: ')' }, - { character: ')', inConstruct: 'destinationRaw' }, - // An asterisk can start thematic breaks, list items, emphasis, strong. - { atBreak: true, character: '*' }, - { character: '*', inConstruct: 'phrasing' }, - // A plus sign could start a list item. - { atBreak: true, character: '+' }, - // A dash can start thematic breaks, list items, and setext heading - // underlines. - { atBreak: true, character: '-' }, - // A dot could start a list item. - { - atBreak: true, - before: '\\d+', - character: '.', - after: '(?:[ \t\r\n]|$)', - }, - // Slash, colon, and semicolon are not used in markdown for constructs. - // A less than can start html (flow or text) or an autolink. - // HTML could start with an exclamation mark (declaration, cdata, comment), - // slash (closing tag), question mark (instruction), or a letter (tag). - // An autolink also starts with a letter. - // Finally, it could break out of a destination literal. - { atBreak: true, character: '<', after: '[!/?A-Za-z]' }, - { character: '<', after: '[!/?A-Za-z]', inConstruct: 'phrasing' }, - { character: '<', inConstruct: 'destinationLiteral' }, - // An equals to can start setext heading underlines. - { atBreak: true, character: '=' }, - // A greater than can start block quotes and it can break out of a - // destination literal. - { atBreak: true, character: '>' }, - { character: '>', inConstruct: 'destinationLiteral' }, - // Question mark and at sign are not used in markdown for constructs. - // A left bracket can start definitions, references, labels, - { atBreak: true, character: '[' }, - { - character: '[', - inConstruct: ['phrasing', 'label', 'reference'], - }, - // A backslash can start an escape (when followed by punctuation) or a - // hard break (when followed by an eol). - { character: '\\', after: '[!-/:-@[-`{-~]' }, - { character: '\\', after: '[\\r\\n]', inConstruct: 'phrasing' }, - // A right bracket can exit labels. - { - character: ']', - inConstruct: ['label', 'reference'], - }, - // Caret is not used in markdown for constructs. - // An underscore can start emphasis, strong, or a thematic break. - { atBreak: true, character: '_' }, - { before: '[^A-Za-z]', character: '_', inConstruct: 'phrasing' }, - { character: '_', after: '[^A-Za-z]', inConstruct: 'phrasing' }, - // A grave accent can start code (fenced or text), or it can break out of - // a grave accent code fence. - { atBreak: true, character: '`' }, - { - character: '`', - inConstruct: [ - 'codeFencedLangGraveAccent', - 'codeFencedMetaGraveAccent', - 'phrasing', - ], - }, - // Left brace, vertical bar, right brace are not used in markdown for - // constructs. - // A tilde can start code (fenced). - { atBreak: true, character: '~' }, - ]; - - /***/ - }, - - /***/ 9211: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = association; - - var decode = __nccwpck_require__(3485); - - var characterEscape = /\\([!-/:-@[-`{-~])/g; - var characterReference = /&(#(\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; - - // The `label` of an association is the string value: character escapes and - // references work, and casing is intact. - // The `identifier` is used to match one association to another: controversially, - // character escapes and references don’t work in this matching: `©` does - // not match `©`, and `\+` does not match `+`. - // But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb` - // matches `a b`. - // So, we do prefer the label when figuring out how we’re going to serialize: - // it has whitespace, casing, and we can ignore most useless character escapes - // and all character references. - function association(node) { - if (node.label || !node.identifier) { - return node.label || ''; - } - - return node.identifier - .replace(characterEscape, '$1') - .replace(characterReference, decodeIfPossible); - } - - function decodeIfPossible($0, $1) { - return decode($1) || $0; - } - - /***/ - }, - - /***/ 8599: /***/ (module) => { - module.exports = checkBullet; - - function checkBullet(context) { - var marker = context.options.bullet || '*'; - - if (marker !== '*' && marker !== '+' && marker !== '-') { - throw new Error( - 'Cannot serialize items with `' + - marker + - '` for `options.bullet`, expected `*`, `+`, or `-`' - ); - } - - return marker; - } - - /***/ - }, - - /***/ 6452: /***/ (module) => { - module.exports = checkEmphasis; - - function checkEmphasis(context) { - var marker = context.options.emphasis || '*'; - - if (marker !== '*' && marker !== '_') { - throw new Error( - 'Cannot serialize emphasis with `' + - marker + - '` for `options.emphasis`, expected `*`, or `_`' - ); - } - - return marker; - } - - /***/ - }, - - /***/ 158: /***/ (module) => { - module.exports = checkFence; - - function checkFence(context) { - var marker = context.options.fence || '`'; - - if (marker !== '`' && marker !== '~') { - throw new Error( - 'Cannot serialize code with `' + - marker + - '` for `options.fence`, expected `` ` `` or `~`' - ); - } - - return marker; - } - - /***/ - }, - - /***/ 9009: /***/ (module) => { - module.exports = checkListItemIndent; - - function checkListItemIndent(context) { - var style = context.options.listItemIndent || 'tab'; - - if (style === 1 || style === '1') { - return 'one'; - } - - if (style !== 'tab' && style !== 'one' && style !== 'mixed') { - throw new Error( - 'Cannot serialize items with `' + - style + - '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`' - ); - } - - return style; - } - - /***/ - }, - - /***/ 3366: /***/ (module) => { - module.exports = checkQuote; - - function checkQuote(context) { - var marker = context.options.quote || '"'; - - if (marker !== '"' && marker !== "'") { - throw new Error( - 'Cannot serialize title with `' + - marker + - '` for `options.quote`, expected `"`, or `\'`' - ); - } - - return marker; - } - - /***/ - }, - - /***/ 3680: /***/ (module) => { - module.exports = checkRule; - - function checkRule(context) { - var repetition = context.options.ruleRepetition || 3; - - if (repetition < 3) { - throw new Error( - 'Cannot serialize rules with repetition `' + - repetition + - '` for `options.ruleRepetition`, expected `3` or more' - ); - } - - return repetition; - } - - /***/ - }, - - /***/ 7253: /***/ (module) => { - module.exports = checkRule; - - function checkRule(context) { - var marker = context.options.rule || '*'; - - if (marker !== '*' && marker !== '-' && marker !== '_') { - throw new Error( - 'Cannot serialize rules with `' + - marker + - '` for `options.rule`, expected `*`, `-`, or `_`' - ); - } - - return marker; - } - - /***/ - }, - - /***/ 3534: /***/ (module) => { - module.exports = checkStrong; - - function checkStrong(context) { - var marker = context.options.strong || '*'; - - if (marker !== '*' && marker !== '_') { - throw new Error( - 'Cannot serialize strong with `' + - marker + - '` for `options.strong`, expected `*`, or `_`' - ); - } - - return marker; - } - - /***/ - }, - - /***/ 7530: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = flow; - - var repeat = __nccwpck_require__(6976); - - function flow(parent, context) { - var children = parent.children || []; - var results = []; - var index = -1; - var child; - - while (++index < children.length) { - child = children[index]; - - results.push( - context.handle(child, parent, context, { - before: '\n', - after: '\n', - }) - ); - - if (index + 1 < children.length) { - results.push(between(child, children[index + 1])); - } - } - - return results.join(''); - - function between(left, right) { - var index = -1; - var result; - - while (++index < context.join.length) { - result = context.join[index](left, right, parent, context); - - if (result === true || result === 1) { - break; - } - - if (typeof result === 'number') { - return repeat('\n', 1 + Number(result)); - } - - if (result === false) { - return '\n\n\n\n'; - } - } - - return '\n\n'; - } - } - - /***/ - }, - - /***/ 7489: /***/ (module) => { - module.exports = phrasing; - - function phrasing(parent, context, safeOptions) { - var children = parent.children || []; - var results = []; - var index = -1; - var before = safeOptions.before; - var after; - var handle; - var child; - - while (++index < children.length) { - child = children[index]; - - if (index + 1 < children.length) { - handle = context.handle.handlers[children[index + 1].type]; - if (handle && handle.peek) handle = handle.peek; - after = handle - ? handle(children[index + 1], parent, context, { - before: '', - after: '', - }).charAt(0) - : ''; - } else { - after = safeOptions.after; - } - - results.push( - context.handle(child, parent, context, { - before: before, - after: after, - }) - ); - before = results[results.length - 1].slice(-1); - } - - return results.join(''); - } - - /***/ - }, - - /***/ 8446: /***/ (module) => { - module.exports = formatCodeAsIndented; - - function formatCodeAsIndented(node, context) { - return ( - !context.options.fences && - node.value && - // If there’s no info… - !node.lang && - // And there’s a non-whitespace character… - /[^ \r\n]/.test(node.value) && - // And the value doesn’t start or end in a blank… - !/^[\t ]*[\r\n]|[\r\n][\t ]*$/.test(node.value) - ); - } - - /***/ - }, - - /***/ 4954: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = formatHeadingAsSetext; - - var toString = __nccwpck_require__(5789); - - function formatHeadingAsSetext(node, context) { - return ( - context.options.setext && - (!node.depth || node.depth < 3) && - toString(node) - ); - } - - /***/ - }, - - /***/ 5358: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - module.exports = formatLinkAsAutolink; - - var toString = __nccwpck_require__(5789); - - function formatLinkAsAutolink(node, context) { - var raw = toString(node); - - return ( - !context.options.resourceLink && - // If there’s a url… - node.url && - // And there’s a no title… - !node.title && - // And the content of `node` is a single text node… - node.children && - node.children.length === 1 && - node.children[0].type === 'text' && - // And if the url is the same as the content… - (raw === node.url || 'mailto:' + raw === node.url) && - // And that starts w/ a protocol… - /^[a-z][a-z+.-]+:/i.test(node.url) && - // And that doesn’t contain ASCII control codes (character escapes and - // references don’t work) or angle brackets… - !/[\0- <>\u007F]/.test(node.url) - ); - } - - /***/ - }, - - /***/ 6887: /***/ (module) => { - module.exports = indentLines; - - var eol = /\r?\n|\r/g; - - function indentLines(value, map) { - var result = []; - var start = 0; - var line = 0; - var match; - - while ((match = eol.exec(value))) { - one(value.slice(start, match.index)); - result.push(match[0]); - start = match.index + match[0].length; - line++; - } - - one(value.slice(start)); - - return result.join(''); - - function one(value) { - result.push(map(value, line, !value)); - } - } - - /***/ - }, - - /***/ 3906: /***/ (module) => { - module.exports = safe; - - function safe(context, input, config) { - var value = - (config.before || '') + (input || '') + (config.after || ''); - var positions = []; - var result = []; - var infos = {}; - var index = -1; - var before; - var after; - var position; - var pattern; - var expression; - var match; - var start; - var end; - - while (++index < context.unsafe.length) { - pattern = context.unsafe[index]; - - if ( - !inScope(context.stack, pattern.inConstruct, true) || - inScope(context.stack, pattern.notInConstruct) - ) { - continue; - } - - expression = - pattern._compiled || (pattern._compiled = toExpression(pattern)); - - while ((match = expression.exec(value))) { - before = 'before' in pattern || pattern.atBreak; - after = 'after' in pattern; - position = match.index + (before ? match[1].length : 0); - - if (positions.indexOf(position) === -1) { - positions.push(position); - infos[position] = { before: before, after: after }; - } else { - if (infos[position].before && !before) { - infos[position].before = false; - } - - if (infos[position].after && !after) { - infos[position].after = false; - } - } - } - } - - positions.sort(numerical); - - start = config.before ? config.before.length : 0; - end = value.length - (config.after ? config.after.length : 0); - index = -1; - - while (++index < positions.length) { - position = positions[index]; - - if ( - // Character before or after matched: - position < start || - position >= end - ) { - continue; - } - - // If this character is supposed to be escaped because it has a condition on - // the next character, and the next character is definitly being escaped, - // then skip this escape. - if ( - position + 1 < end && - positions[index + 1] === position + 1 && - infos[position].after && - !infos[position + 1].before && - !infos[position + 1].after - ) { - continue; - } - - if (start !== position) { - result.push(value.slice(start, position)); - } - - start = position; - - if ( - /[!-/:-@[-`{-~]/.test(value.charAt(position)) && - (!config.encode || - config.encode.indexOf(value.charAt(position)) === -1) - ) { - // Character escape. - result.push('\\'); - } else { - // Character reference. - result.push( - '&#x' + - value.charCodeAt(position).toString(16).toUpperCase() + - ';' - ); - start++; - } - } - - result.push(value.slice(start, end)); - - return result.join(''); - } - - function inScope(stack, list, none) { - var index; - - if (!list) { - return none; - } - - if (typeof list === 'string') { - list = [list]; - } - - index = -1; - - while (++index < list.length) { - if (stack.indexOf(list[index]) !== -1) { - return true; - } - } - - return false; - } - - function toExpression(pattern) { - var before = pattern.before ? '(?:' + pattern.before + ')' : ''; - var after = pattern.after ? '(?:' + pattern.after + ')' : ''; - - if (pattern.atBreak) { - before = '[\\r\\n][\\t ]*' + before; - } - - return new RegExp( - (before ? '(' + before + ')' : '') + - (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + - pattern.character + - (after || ''), - 'g' - ); - } - - function numerical(a, b) { - return a - b; - } - - /***/ - }, - - /***/ 5789: /***/ (module) => { - 'use strict'; - - module.exports = toString; - - // Get the text content of a node. - // Prefer the node’s plain-text fields, otherwise serialize its children, - // and if the given value is an array, serialize the nodes in it. - function toString(node) { - return ( - (node && - (node.value || - node.alt || - node.title || - ('children' in node && all(node.children)) || - ('length' in node && all(node)))) || - '' - ); - } - - function all(values) { - var result = []; - var index = -1; - - while (++index < values.length) { - result[index] = toString(values[index]); - } - - return result.join(''); - } - - /***/ - }, - - /***/ 6184: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = __nccwpck_require__(3616); - - /***/ - }, - - /***/ 1254: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var extend = __nccwpck_require__(8171); - - module.exports = contents; - - // Transform a list of heading objects to a markdown list. - function contents(map, tight, prefix, ordered) { - var table = { - type: 'list', - ordered: ordered, - spread: false, - children: [], - }; - var minDepth = Infinity; - var index = -1; - - // Find minimum depth. - while (++index < map.length) { - if (map[index].depth < minDepth) { - minDepth = map[index].depth; - } - } - - // Normalize depth. - index = -1; - - while (++index < map.length) { - map[index].depth -= minDepth - 1; - } - - // Add TOC to list. - index = -1; - - while (++index < map.length) { - insert(map[index], table, tight, prefix, ordered); - } - - return table; - } - - // Insert an entry into `parent`. - function insert(entry, parent, tight, prefix, ordered) { - var siblings = parent.children; - var tail = siblings[siblings.length - 1]; - var index = -1; - var item; - - if (entry.depth === 1) { - siblings.push({ - type: 'listItem', - spread: false, - children: [ - { - type: 'paragraph', - children: [ - { - type: 'link', - title: null, - url: '#' + (prefix || '') + entry.id, - children: all(entry.children), - }, - ], - }, - ], - }); - } else if (tail && tail.type === 'listItem') { - insert(entry, siblings[siblings.length - 1], tight, prefix, ordered); - } else if (tail && tail.type === 'list') { - entry.depth--; - insert(entry, tail, tight, prefix, ordered); - } else if (parent.type === 'list') { - item = { type: 'listItem', spread: false, children: [] }; - siblings.push(item); - insert(entry, item, tight, prefix, ordered); - } else { - item = { - type: 'list', - ordered: ordered, - spread: false, - children: [], - }; - siblings.push(item); - entry.depth--; - insert(entry, item, tight, prefix, ordered); - } - - if (parent.type === 'list' && !tight) { - parent.spread = false; - - while (++index < siblings.length) { - if (siblings[index].children.length > 1) { - parent.spread = true; - break; - } - } - } else { - parent.spread = !tight; - } - } - - function all(children) { - var result = []; - var index = -1; - - if (children) { - while (++index < children.length) { - result = result.concat(one(children[index])); - } - } - - return result; - } - - function one(node) { - var copy; - - if ( - node.type === 'link' || - node.type === 'linkReference' || - node.type === 'footnote' || - node.type === 'footnoteReference' - ) { - return all(node.children); - } - - copy = extend({}, node); - - delete copy.children; - delete copy.position; - - copy = extend(true, {}, copy); - - if (node.children) { - copy.children = all(node.children); - } - - return copy; - } - - /***/ - }, - - /***/ 3616: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = toc; - - var search = __nccwpck_require__(6138); - var contents = __nccwpck_require__(1254); - var toExpression = __nccwpck_require__(2874); - - // Get a TOC representation of `node`. - function toc(node, options) { - var settings = options || {}; - var heading = settings.heading ? toExpression(settings.heading) : null; - var result = search(node, heading, settings); - - result.map = result.map.length - ? contents( - result.map, - settings.tight, - settings.prefix, - settings.ordered || false - ) - : null; - - // No given heading. - if (!heading) { - result.endIndex = result.index = null; - } - - return result; - } - - /***/ - }, - - /***/ 6138: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = search; - - var toString = __nccwpck_require__(5789); - var visit = __nccwpck_require__(199); - var convert = __nccwpck_require__(4070); - var slugs = __nccwpck_require__(237)(); - var toExpression = __nccwpck_require__(2874); - - // Search a node for a location. - function search(root, expression, settings) { - var skip = settings.skip && toExpression(settings.skip); - var parents = convert(settings.parents || root); - var map = []; - var index; - var endIndex; - var opening; - - slugs.reset(); - - // Visit all headings in `root`. We `slug` all headings (to account for - // duplicates), but only create a TOC from top-level headings. - visit(root, 'heading', onheading); - - return { - index: index || -1, - endIndex: index ? endIndex || root.children.length : -1, - map: map, - }; - - function onheading(node, position, parent) { - var value = toString(node); - /* istanbul ignore next - to do: remove this when `remark-attr` is up to - * date w/ micromark. */ - var id = - node.data && node.data.hProperties && node.data.hProperties.id; - var slug = slugs.slug(id || value); - - if (!parents(parent)) { - return; - } - - // Our opening heading. - if (expression && !index && expression.test(value)) { - index = position + 1; - opening = node; - return; - } - - // Our closing heading. - if (opening && !endIndex && node.depth <= opening.depth) { - endIndex = position; - } - - // A non-empty heading after the closing (if we were looking for one). - if ( - value && - (endIndex || !expression) && - (!settings.maxDepth || node.depth <= settings.maxDepth) && - (!skip || !skip.test(value)) - ) { - map.push({ depth: node.depth, children: node.children, id: slug }); - } - } - } - - /***/ - }, - - /***/ 2874: /***/ (module) => { - 'use strict'; - - module.exports = toExpression; - - // Transform a string into an applicable expression. - function toExpression(value) { - return new RegExp('^(' + value + ')$', 'i'); - } - - /***/ - }, - - /***/ 3847: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var asciiAlpha = regexCheck(/[A-Za-z]/); - - module.exports = asciiAlpha; - - /***/ - }, - - /***/ 598: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); - - module.exports = asciiAlphanumeric; - - /***/ - }, - - /***/ 245: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); - - module.exports = asciiAtext; - - /***/ - }, - - /***/ 1336: /***/ (module) => { - 'use strict'; - - // Note: EOF is seen as ASCII control here, because `null < 32 == true`. - function asciiControl(code) { - return ( - // Special whitespace codes (which have negative values), C0 and Control - // character DEL - code < 32 || code === 127 - ); - } - - module.exports = asciiControl; - - /***/ - }, - - /***/ 6996: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var asciiDigit = regexCheck(/\d/); - - module.exports = asciiDigit; - - /***/ - }, - - /***/ 6526: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var asciiHexDigit = regexCheck(/[\dA-Fa-f]/); - - module.exports = asciiHexDigit; - - /***/ - }, - - /***/ 7909: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); - - module.exports = asciiPunctuation; - - /***/ - }, - - /***/ 9180: /***/ (module) => { - 'use strict'; - - function markdownLineEndingOrSpace(code) { - return code < 0 || code === 32; - } - - module.exports = markdownLineEndingOrSpace; - - /***/ - }, - - /***/ 7506: /***/ (module) => { - 'use strict'; - - function markdownLineEnding(code) { - return code < -2; - } - - module.exports = markdownLineEnding; - - /***/ - }, - - /***/ 5989: /***/ (module) => { - 'use strict'; - - function markdownSpace(code) { - return code === -2 || code === -1 || code === 32; - } - - module.exports = markdownSpace; - - /***/ - }, - - /***/ 9372: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - var unicodePunctuationRegex = __nccwpck_require__(9994); - - // In fact adds to the bundle size. - - var unicodePunctuation = regexCheck(unicodePunctuationRegex); - - module.exports = unicodePunctuation; - - /***/ - }, - - /***/ 9968: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var regexCheck = __nccwpck_require__(1028); - - var unicodeWhitespace = regexCheck(/\s/); - - module.exports = unicodeWhitespace; - - /***/ - }, - - /***/ 3512: /***/ (module) => { - 'use strict'; - - var assign = Object.assign; - - module.exports = assign; - - /***/ - }, - - /***/ 3531: /***/ (module) => { - 'use strict'; - - var fromCharCode = String.fromCharCode; - - module.exports = fromCharCode; - - /***/ - }, - - /***/ 3500: /***/ (module) => { - 'use strict'; - - var own = {}.hasOwnProperty; - - module.exports = own; - - /***/ - }, - - /***/ 5159: /***/ (module) => { - 'use strict'; - - // This module is copied from . - var basics = [ - 'address', - 'article', - 'aside', - 'base', - 'basefont', - 'blockquote', - 'body', - 'caption', - 'center', - 'col', - 'colgroup', - 'dd', - 'details', - 'dialog', - 'dir', - 'div', - 'dl', - 'dt', - 'fieldset', - 'figcaption', - 'figure', - 'footer', - 'form', - 'frame', - 'frameset', - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'head', - 'header', - 'hr', - 'html', - 'iframe', - 'legend', - 'li', - 'link', - 'main', - 'menu', - 'menuitem', - 'nav', - 'noframes', - 'ol', - 'optgroup', - 'option', - 'p', - 'param', - 'section', - 'source', - 'summary', - 'table', - 'tbody', - 'td', - 'tfoot', - 'th', - 'thead', - 'title', - 'tr', - 'track', - 'ul', - ]; - - module.exports = basics; - - /***/ - }, - - /***/ 4677: /***/ (module) => { - 'use strict'; - - // This module is copied from . - var raws = ['pre', 'script', 'style', 'textarea']; - - module.exports = raws; - - /***/ - }, - - /***/ 2366: /***/ (module) => { - 'use strict'; - - var splice = [].splice; - - module.exports = splice; - - /***/ - }, - - /***/ 9994: /***/ (module) => { - 'use strict'; - - // This module is generated by `script/`. - // - // CommonMark handles attention (emphasis, strong) markers based on what comes - // before or after them. - // One such difference is if those characters are Unicode punctuation. - // This script is generated from the Unicode data. - var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; - - module.exports = unicodePunctuation; - - /***/ - }, - - /***/ 289: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - - var text$1 = __nccwpck_require__(7492); - var attention = __nccwpck_require__(2116); - var autolink = __nccwpck_require__(6681); - var blockQuote = __nccwpck_require__(9025); - var characterEscape = __nccwpck_require__(7128); - var characterReference = __nccwpck_require__(9500); - var codeFenced = __nccwpck_require__(3268); - var codeIndented = __nccwpck_require__(907); - var codeText = __nccwpck_require__(7033); - var definition = __nccwpck_require__(1193); - var hardBreakEscape = __nccwpck_require__(7608); - var headingAtx = __nccwpck_require__(4558); - var htmlFlow = __nccwpck_require__(6791); - var htmlText = __nccwpck_require__(7743); - var labelEnd = __nccwpck_require__(9797); - var labelStartImage = __nccwpck_require__(7860); - var labelStartLink = __nccwpck_require__(5908); - var lineEnding = __nccwpck_require__(5183); - var thematicBreak = __nccwpck_require__(5590); - var list = __nccwpck_require__(3107); - var setextUnderline = __nccwpck_require__(1196); - - var document = { - 42: list, - // Asterisk - 43: list, - // Plus sign - 45: list, - // Dash - 48: list, - // 0 - 49: list, - // 1 - 50: list, - // 2 - 51: list, - // 3 - 52: list, - // 4 - 53: list, - // 5 - 54: list, - // 6 - 55: list, - // 7 - 56: list, - // 8 - 57: list, - // 9 - 62: blockQuote, // Greater than - }; - var contentInitial = { - 91: definition, // Left square bracket - }; - var flowInitial = { - '-2': codeIndented, - // Horizontal tab - '-1': codeIndented, - // Virtual space - 32: codeIndented, // Space - }; - var flow = { - 35: headingAtx, - // Number sign - 42: thematicBreak, - // Asterisk - 45: [setextUnderline, thematicBreak], - // Dash - 60: htmlFlow, - // Less than - 61: setextUnderline, - // Equals to - 95: thematicBreak, - // Underscore - 96: codeFenced, - // Grave accent - 126: codeFenced, // Tilde - }; - var string = { - 38: characterReference, - // Ampersand - 92: characterEscape, // Backslash - }; - var text = { - '-5': lineEnding, - // Carriage return - '-4': lineEnding, - // Line feed - '-3': lineEnding, - // Carriage return + line feed - 33: labelStartImage, - // Exclamation mark - 38: characterReference, - // Ampersand - 42: attention, - // Asterisk - 60: [autolink, htmlText], - // Less than - 91: labelStartLink, - // Left square bracket - 92: [hardBreakEscape, characterEscape], - // Backslash - 93: labelEnd, - // Right square bracket - 95: attention, - // Underscore - 96: codeText, // Grave accent - }; - var insideSpan = { - null: [attention, text$1.resolver], - }; - var disable = { - null: [], - }; - - exports.contentInitial = contentInitial; - exports.disable = disable; - exports.document = document; - exports.flow = flow; - exports.flowInitial = flowInitial; - exports.insideSpan = insideSpan; - exports.string = string; - exports.text = text; - - /***/ - }, - - /***/ 5834: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - - var tokenize = initializeContent; - - function initializeContent(effects) { - var contentStart = effects.attempt( - this.parser.constructs.contentInitial, - afterContentStartConstruct, - paragraphInitial - ); - var previous; - return contentStart; - - function afterContentStartConstruct(code) { - if (code === null) { - effects.consume(code); - return; - } - - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, contentStart, 'linePrefix'); - } - - function paragraphInitial(code) { - effects.enter('paragraph'); - return lineStart(code); - } - - function lineStart(code) { - var token = effects.enter('chunkText', { - contentType: 'text', - previous: previous, - }); - - if (previous) { - previous.next = token; - } - - previous = token; - return data(code); - } - - function data(code) { - if (code === null) { - effects.exit('chunkText'); - effects.exit('paragraph'); - effects.consume(code); - return; - } - - if (markdownLineEnding(code)) { - effects.consume(code); - effects.exit('chunkText'); - return lineStart; - } // Data. - - effects.consume(code); - return data; - } - } - - exports.tokenize = tokenize; - - /***/ - }, - - /***/ 9517: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - var partialBlankLine = __nccwpck_require__(2244); - - var tokenize = initializeDocument; - var containerConstruct = { - tokenize: tokenizeContainer, - }; - var lazyFlowConstruct = { - tokenize: tokenizeLazyFlow, - }; - - function initializeDocument(effects) { - var self = this; - var stack = []; - var continued = 0; - var inspectConstruct = { - tokenize: tokenizeInspect, - partial: true, - }; - var inspectResult; - var childFlow; - var childToken; - return start; - - function start(code) { - if (continued < stack.length) { - self.containerState = stack[continued][1]; - return effects.attempt( - stack[continued][0].continuation, - documentContinue, - documentContinued - )(code); - } - - return documentContinued(code); - } - - function documentContinue(code) { - continued++; - return start(code); - } - - function documentContinued(code) { - // If we’re in a concrete construct (such as when expecting another line of - // HTML, or we resulted in lazy content), we can immediately start flow. - if (inspectResult && inspectResult.flowContinue) { - return flowStart(code); - } - - self.interrupt = - childFlow && - childFlow.currentConstruct && - childFlow.currentConstruct.interruptible; - self.containerState = {}; - return effects.attempt( - containerConstruct, - containerContinue, - flowStart - )(code); - } - - function containerContinue(code) { - stack.push([self.currentConstruct, self.containerState]); - self.containerState = undefined; - return documentContinued(code); - } - - function flowStart(code) { - if (code === null) { - exitContainers(0, true); - effects.consume(code); - return; - } - - childFlow = childFlow || self.parser.flow(self.now()); - effects.enter('chunkFlow', { - contentType: 'flow', - previous: childToken, - _tokenizer: childFlow, - }); - return flowContinue(code); - } - - function flowContinue(code) { - if (code === null) { - continueFlow(effects.exit('chunkFlow')); - return flowStart(code); - } - - if (markdownLineEnding(code)) { - effects.consume(code); - continueFlow(effects.exit('chunkFlow')); - return effects.check(inspectConstruct, documentAfterPeek); - } - - effects.consume(code); - return flowContinue; - } - - function documentAfterPeek(code) { - exitContainers( - inspectResult.continued, - inspectResult && inspectResult.flowEnd - ); - continued = 0; - return start(code); - } - - function continueFlow(token) { - if (childToken) childToken.next = token; - childToken = token; - childFlow.lazy = inspectResult && inspectResult.lazy; - childFlow.defineSkip(token.start); - childFlow.write(self.sliceStream(token)); - } - - function exitContainers(size, end) { - var index = stack.length; // Close the flow. - - if (childFlow && end) { - childFlow.write([null]); - childToken = childFlow = undefined; - } // Exit open containers. - - while (index-- > size) { - self.containerState = stack[index][1]; - stack[index][0].exit.call(self, effects); - } - - stack.length = size; - } - - function tokenizeInspect(effects, ok) { - var subcontinued = 0; - inspectResult = {}; - return inspectStart; - - function inspectStart(code) { - if (subcontinued < stack.length) { - self.containerState = stack[subcontinued][1]; - return effects.attempt( - stack[subcontinued][0].continuation, - inspectContinue, - inspectLess - )(code); - } // If we’re continued but in a concrete flow, we can’t have more - // containers. - - if ( - childFlow.currentConstruct && - childFlow.currentConstruct.concrete - ) { - inspectResult.flowContinue = true; - return inspectDone(code); - } - - self.interrupt = - childFlow.currentConstruct && - childFlow.currentConstruct.interruptible; - self.containerState = {}; - return effects.attempt( - containerConstruct, - inspectFlowEnd, - inspectDone - )(code); - } - - function inspectContinue(code) { - subcontinued++; - return self.containerState._closeFlow - ? inspectFlowEnd(code) - : inspectStart(code); - } - - function inspectLess(code) { - if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { - // Maybe another container? - self.containerState = {}; - return effects.attempt( - containerConstruct, - inspectFlowEnd, // Maybe flow, or a blank line? - effects.attempt( - lazyFlowConstruct, - inspectFlowEnd, - effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) - ) - )(code); - } // Otherwise we’re interrupting. - - return inspectFlowEnd(code); - } - - function inspectLazy(code) { - // Act as if all containers are continued. - subcontinued = stack.length; - inspectResult.lazy = true; - inspectResult.flowContinue = true; - return inspectDone(code); - } // We’re done with flow if we have more containers, or an interruption. - - function inspectFlowEnd(code) { - inspectResult.flowEnd = true; - return inspectDone(code); - } - - function inspectDone(code) { - inspectResult.continued = subcontinued; - self.interrupt = self.containerState = undefined; - return ok(code); - } - } - } - - function tokenizeContainer(effects, ok, nok) { - return factorySpace( - effects, - effects.attempt(this.parser.constructs.document, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ); - } - - function tokenizeLazyFlow(effects, ok, nok) { - return factorySpace( - effects, - effects.lazy(this.parser.constructs.flow, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ); - } - - exports.tokenize = tokenize; - - /***/ - }, - - /***/ 9670: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - - var factorySpace = __nccwpck_require__(8200); - var partialBlankLine = __nccwpck_require__(2244); - var content = __nccwpck_require__(1259); - - var tokenize = initializeFlow; - - function initializeFlow(effects) { - var self = this; - var initial = effects.attempt( - // Try to parse a blank line. - partialBlankLine, - atBlankEnding, // Try to parse initial flow (essentially, only code). - effects.attempt( - this.parser.constructs.flowInitial, - afterConstruct, - factorySpace( - effects, - effects.attempt( - this.parser.constructs.flow, - afterConstruct, - effects.attempt(content, afterConstruct) - ), - 'linePrefix' - ) - ) - ); - return initial; - - function atBlankEnding(code) { - if (code === null) { - effects.consume(code); - return; - } - - effects.enter('lineEndingBlank'); - effects.consume(code); - effects.exit('lineEndingBlank'); - self.currentConstruct = undefined; - return initial; - } - - function afterConstruct(code) { - if (code === null) { - effects.consume(code); - return; - } - - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - self.currentConstruct = undefined; - return initial; - } - } - - exports.tokenize = tokenize; - - /***/ - }, - - /***/ 7492: /***/ ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) => { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { value: true }); - - var assign = __nccwpck_require__(3512); - var shallow = __nccwpck_require__(1479); - - var text = initializeFactory('text'); - var string = initializeFactory('string'); - var resolver = { - resolveAll: createResolver(), - }; - - function initializeFactory(field) { - return { - tokenize: initializeText, - resolveAll: createResolver( - field === 'text' ? resolveAllLineSuffixes : undefined - ), - }; - - function initializeText(effects) { - var self = this; - var constructs = this.parser.constructs[field]; - var text = effects.attempt(constructs, start, notText); - return start; - - function start(code) { - return atBreak(code) ? text(code) : notText(code); - } - - function notText(code) { - if (code === null) { - effects.consume(code); - return; - } - - effects.enter('data'); - effects.consume(code); - return data; - } - - function data(code) { - if (atBreak(code)) { - effects.exit('data'); - return text(code); - } // Data. - - effects.consume(code); - return data; - } - - function atBreak(code) { - var list = constructs[code]; - var index = -1; - - if (code === null) { - return true; - } - - if (list) { - while (++index < list.length) { - if ( - !list[index].previous || - list[index].previous.call(self, self.previous) - ) { - return true; - } - } - } - } - } - } - - function createResolver(extraResolver) { - return resolveAllText; - - function resolveAllText(events, context) { - var index = -1; - var enter; // A rather boring computation (to merge adjacent `data` events) which - // improves mm performance by 29%. - - while (++index <= events.length) { - if (enter === undefined) { - if (events[index] && events[index][1].type === 'data') { - enter = index; - index++; - } - } else if (!events[index] || events[index][1].type !== 'data') { - // Don’t do anything if there is one data token. - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end; - events.splice(enter + 2, index - enter - 2); - index = enter + 2; - } - - enter = undefined; - } - } - - return extraResolver ? extraResolver(events, context) : events; - } - } // A rather ugly set of instructions which again looks at chunks in the input - // stream. - // The reason to do this here is that it is *much* faster to parse in reverse. - // And that we can’t hook into `null` to split the line suffix before an EOF. - // To do: figure out if we can make this into a clean utility, or even in core. - // As it will be useful for GFMs literal autolink extension (and maybe even - // tables?) - - function resolveAllLineSuffixes(events, context) { - var eventIndex = -1; - var chunks; - var data; - var chunk; - var index; - var bufferIndex; - var size; - var tabs; - var token; - - while (++eventIndex <= events.length) { - if ( - (eventIndex === events.length || - events[eventIndex][1].type === 'lineEnding') && - events[eventIndex - 1][1].type === 'data' - ) { - data = events[eventIndex - 1][1]; - chunks = context.sliceStream(data); - index = chunks.length; - bufferIndex = -1; - size = 0; - tabs = undefined; - - while (index--) { - chunk = chunks[index]; - - if (typeof chunk === 'string') { - bufferIndex = chunk.length; - - while (chunk.charCodeAt(bufferIndex - 1) === 32) { - size++; - bufferIndex--; - } - - if (bufferIndex) break; - bufferIndex = -1; - } // Number - else if (chunk === -2) { - tabs = true; - size++; - } else if (chunk === -1); - else { - // Replacement character, exit. - index++; - break; - } - } - - if (size) { - token = { - type: - eventIndex === events.length || tabs || size < 2 - ? 'lineSuffix' - : 'hardBreakTrailing', - start: { - line: data.end.line, - column: data.end.column - size, - offset: data.end.offset - size, - _index: data.start._index + index, - _bufferIndex: index - ? bufferIndex - : data.start._bufferIndex + bufferIndex, - }, - end: shallow(data.end), - }; - data.end = shallow(token.start); - - if (data.start.offset === data.end.offset) { - assign(data, token); - } else { - events.splice( - eventIndex, - 0, - ['enter', token, context], - ['exit', token, context] - ); - eventIndex += 2; - } - } - - eventIndex++; - } - } - - return events; - } - - exports.resolver = resolver; - exports.string = string; - exports.text = text; - - /***/ - }, - - /***/ 488: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var miniflat = __nccwpck_require__(9042); - var content = __nccwpck_require__(5834); - var document = __nccwpck_require__(9517); - var flow = __nccwpck_require__(9670); - var text = __nccwpck_require__(7492); - var combineExtensions = __nccwpck_require__(8602); - var createTokenizer = __nccwpck_require__(4845); - var constructs = __nccwpck_require__(289); - - function parse(options) { - var settings = options || {}; - var parser = { - defined: [], - constructs: combineExtensions( - [constructs].concat(miniflat(settings.extensions)) - ), - content: create(content), - document: create(document), - flow: create(flow), - string: create(text.string), - text: create(text.text), - }; - return parser; - - function create(initializer) { - return creator; - - function creator(from) { - return createTokenizer(parser, initializer, from); - } - } - } - - module.exports = parse; - - /***/ - }, - - /***/ 6948: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var subtokenize = __nccwpck_require__(14); - - function postprocess(events) { - while (!subtokenize(events)) { - // Empty - } - - return events; - } - - module.exports = postprocess; - - /***/ - }, - - /***/ 5603: /***/ (module) => { - 'use strict'; - - var search = /[\0\t\n\r]/g; - - function preprocess() { - var start = true; - var column = 1; - var buffer = ''; - var atCarriageReturn; - return preprocessor; - - function preprocessor(value, encoding, end) { - var chunks = []; - var match; - var next; - var startPosition; - var endPosition; - var code; - value = buffer + value.toString(encoding); - startPosition = 0; - buffer = ''; - - if (start) { - if (value.charCodeAt(0) === 65279) { - startPosition++; - } - - start = undefined; - } - - while (startPosition < value.length) { - search.lastIndex = startPosition; - match = search.exec(value); - endPosition = match ? match.index : value.length; - code = value.charCodeAt(endPosition); - - if (!match) { - buffer = value.slice(startPosition); - break; - } - - if ( - code === 10 && - startPosition === endPosition && - atCarriageReturn - ) { - chunks.push(-3); - atCarriageReturn = undefined; - } else { - if (atCarriageReturn) { - chunks.push(-5); - atCarriageReturn = undefined; - } - - if (startPosition < endPosition) { - chunks.push(value.slice(startPosition, endPosition)); - column += endPosition - startPosition; - } - - if (code === 0) { - chunks.push(65533); - column++; - } else if (code === 9) { - next = Math.ceil(column / 4) * 4; - chunks.push(-2); - - while (column++ < next) chunks.push(-1); - } else if (code === 10) { - chunks.push(-4); - column = 1; - } // Must be carriage return. - else { - atCarriageReturn = true; - column = 1; - } - } - - startPosition = endPosition + 1; - } - - if (end) { - if (atCarriageReturn) chunks.push(-5); - if (buffer) chunks.push(buffer); - chunks.push(null); - } - - return chunks; - } - } - - module.exports = preprocess; - - /***/ - }, - - /***/ 2116: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var chunkedSplice = __nccwpck_require__(778); - var chunkedPush = __nccwpck_require__(4455); - var shallow = __nccwpck_require__(1479); - var resolveAll = __nccwpck_require__(2004); - var classifyCharacter = __nccwpck_require__(1324); - var movePoint = __nccwpck_require__(6985); - - var attention = { - name: 'attention', - tokenize: tokenizeAttention, - resolveAll: resolveAllAttention, - }; - - function resolveAllAttention(events, context) { - var index = -1; - var open; - var group; - var text; - var openingSequence; - var closingSequence; - var use; - var nextEvents; - var offset; // Walk through all events. - // - // Note: performance of this is fine on an mb of normal markdown, but it’s - // a bottleneck for malicious stuff. - - while (++index < events.length) { - // Find a token that can close. - if ( - events[index][0] === 'enter' && - events[index][1].type === 'attentionSequence' && - events[index][1]._close - ) { - open = index; // Now walk back to find an opener. - - while (open--) { - // Find a token that can open the closer. - if ( - events[open][0] === 'exit' && - events[open][1].type === 'attentionSequence' && - events[open][1]._open && // If the markers are the same: - context.sliceSerialize(events[open][1]).charCodeAt(0) === - context.sliceSerialize(events[index][1]).charCodeAt(0) - ) { - // If the opening can close or the closing can open, - // and the close size *is not* a multiple of three, - // but the sum of the opening and closing size *is* multiple of three, - // then don’t match. - if ( - (events[open][1]._close || events[index][1]._open) && - (events[index][1].end.offset - - events[index][1].start.offset) % - 3 && - !( - (events[open][1].end.offset - - events[open][1].start.offset + - events[index][1].end.offset - - events[index][1].start.offset) % - 3 - ) - ) { - continue; - } // Number of markers to use from the sequence. - - use = - events[open][1].end.offset - events[open][1].start.offset > - 1 && - events[index][1].end.offset - events[index][1].start.offset > - 1 - ? 2 - : 1; - openingSequence = { - type: use > 1 ? 'strongSequence' : 'emphasisSequence', - start: movePoint(shallow(events[open][1].end), -use), - end: shallow(events[open][1].end), - }; - closingSequence = { - type: use > 1 ? 'strongSequence' : 'emphasisSequence', - start: shallow(events[index][1].start), - end: movePoint(shallow(events[index][1].start), use), - }; - text = { - type: use > 1 ? 'strongText' : 'emphasisText', - start: shallow(events[open][1].end), - end: shallow(events[index][1].start), - }; - group = { - type: use > 1 ? 'strong' : 'emphasis', - start: shallow(openingSequence.start), - end: shallow(closingSequence.end), - }; - events[open][1].end = shallow(openingSequence.start); - events[index][1].start = shallow(closingSequence.end); - nextEvents = []; // If there are more markers in the opening, add them before. - - if (events[open][1].end.offset - events[open][1].start.offset) { - nextEvents = chunkedPush(nextEvents, [ - ['enter', events[open][1], context], - ['exit', events[open][1], context], - ]); - } // Opening. - - nextEvents = chunkedPush(nextEvents, [ - ['enter', group, context], - ['enter', openingSequence, context], - ['exit', openingSequence, context], - ['enter', text, context], - ]); // Between. - - nextEvents = chunkedPush( - nextEvents, - resolveAll( - context.parser.constructs.insideSpan.null, - events.slice(open + 1, index), - context - ) - ); // Closing. - - nextEvents = chunkedPush(nextEvents, [ - ['exit', text, context], - ['enter', closingSequence, context], - ['exit', closingSequence, context], - ['exit', group, context], - ]); // If there are more markers in the closing, add them after. - - if ( - events[index][1].end.offset - events[index][1].start.offset - ) { - offset = 2; - nextEvents = chunkedPush(nextEvents, [ - ['enter', events[index][1], context], - ['exit', events[index][1], context], - ]); - } else { - offset = 0; - } - - chunkedSplice(events, open - 1, index - open + 3, nextEvents); - index = open + nextEvents.length - offset - 2; - break; - } - } - } - } // Remove remaining sequences. - - index = -1; - - while (++index < events.length) { - if (events[index][1].type === 'attentionSequence') { - events[index][1].type = 'data'; - } - } - - return events; - } - - function tokenizeAttention(effects, ok) { - var before = classifyCharacter(this.previous); - var marker; - return start; - - function start(code) { - effects.enter('attentionSequence'); - marker = code; - return sequence(code); - } - - function sequence(code) { - var token; - var after; - var open; - var close; - - if (code === marker) { - effects.consume(code); - return sequence; - } - - token = effects.exit('attentionSequence'); - after = classifyCharacter(code); - open = !after || (after === 2 && before); - close = !before || (before === 2 && after); - token._open = marker === 42 ? open : open && (before || !close); - token._close = marker === 42 ? close : close && (after || !open); - return ok(code); - } - } + try { + const {socket, alpnProtocol} = await resultPromise; + cache.set(name, alpnProtocol); - module.exports = attention; + options.path = path; - /***/ - }, - - /***/ 6681: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var asciiAlphanumeric = __nccwpck_require__(598); - var asciiAlpha = __nccwpck_require__(3847); - var asciiAtext = __nccwpck_require__(245); - var asciiControl = __nccwpck_require__(1336); - - var autolink = { - name: 'autolink', - tokenize: tokenizeAutolink, - }; - - function tokenizeAutolink(effects, ok, nok) { - var size = 1; - return start; - - function start(code) { - effects.enter('autolink'); - effects.enter('autolinkMarker'); - effects.consume(code); - effects.exit('autolinkMarker'); - effects.enter('autolinkProtocol'); - return open; - } - - function open(code) { - if (asciiAlpha(code)) { - effects.consume(code); - return schemeOrEmailAtext; - } - - return asciiAtext(code) ? emailAtext(code) : nok(code); - } - - function schemeOrEmailAtext(code) { - return code === 43 || - code === 45 || - code === 46 || - asciiAlphanumeric(code) - ? schemeInsideOrEmailAtext(code) - : emailAtext(code); - } - - function schemeInsideOrEmailAtext(code) { - if (code === 58) { - effects.consume(code); - return urlInside; - } - - if ( - (code === 43 || - code === 45 || - code === 46 || - asciiAlphanumeric(code)) && - size++ < 32 - ) { - effects.consume(code); - return schemeInsideOrEmailAtext; - } - - return emailAtext(code); - } - - function urlInside(code) { - if (code === 62) { - effects.exit('autolinkProtocol'); - return end(code); - } - - if (code === 32 || code === 60 || asciiControl(code)) { - return nok(code); - } - - effects.consume(code); - return urlInside; - } - - function emailAtext(code) { - if (code === 64) { - effects.consume(code); - size = 0; - return emailAtSignOrDot; - } - - if (asciiAtext(code)) { - effects.consume(code); - return emailAtext; - } + if (alpnProtocol === 'h2') { + // https://github.com/nodejs/node/issues/33343 + socket.destroy(); + } else { + const {globalAgent} = https; + const defaultCreateConnection = https.Agent.prototype.createConnection; - return nok(code); - } - - function emailAtSignOrDot(code) { - return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); - } - - function emailLabel(code) { - if (code === 46) { - effects.consume(code); - size = 0; - return emailAtSignOrDot; - } - - if (code === 62) { - // Exit, then change the type. - effects.exit('autolinkProtocol').type = 'autolinkEmail'; - return end(code); - } - - return emailValue(code); - } - - function emailValue(code) { - if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { - effects.consume(code); - return code === 45 ? emailValue : emailLabel; - } - - return nok(code); - } - - function end(code) { - effects.enter('autolinkMarker'); - effects.consume(code); - effects.exit('autolinkMarker'); - effects.exit('autolink'); - return ok; - } - } - - module.exports = autolink; - - /***/ - }, + if (agent) { + if (agent.createConnection === defaultCreateConnection) { + installSocket(agent, socket, options); + } else { + socket.destroy(); + } + } else if (globalAgent.createConnection === defaultCreateConnection) { + installSocket(globalAgent, socket, options); + } else { + socket.destroy(); + } + } + + queue.delete(name); + + return alpnProtocol; + } catch (error) { + queue.delete(name); + + throw error; + } + } + + return cache.get(name); +}; + +module.exports = async (input, options, callback) => { + if (typeof input === 'string' || input instanceof URL) { + input = urlToOptions(new URL(input)); + } + + if (typeof options === 'function') { + callback = options; + options = undefined; + } + + options = { + ALPNProtocols: ['h2', 'http/1.1'], + ...input, + ...options, + resolveSocket: true + }; + + if (!Array.isArray(options.ALPNProtocols) || options.ALPNProtocols.length === 0) { + throw new Error('The `ALPNProtocols` option must be an Array with at least one entry'); + } + + options.protocol = options.protocol || 'https:'; + const isHttps = options.protocol === 'https:'; + + options.host = options.hostname || options.host || 'localhost'; + options.session = options.tlsSession; + options.servername = options.servername || calculateServerName(options); + options.port = options.port || (isHttps ? 443 : 80); + options._defaultAgent = isHttps ? https.globalAgent : http.globalAgent; + + const agents = options.agent; + + if (agents) { + if (agents.addRequest) { + throw new Error('The `options.agent` object can contain only `http`, `https` or `http2` properties'); + } + + options.agent = agents[isHttps ? 'https' : 'http']; + } + + if (isHttps) { + const protocol = await resolveProtocol(options); + + if (protocol === 'h2') { + if (agents) { + options.agent = agents.http2; + } + + return new Http2ClientRequest(options, callback); + } + } + + return http.request(options, callback); +}; + +module.exports.protocolCache = cache; + + +/***/ }), + +/***/ 9632: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const http2 = __nccwpck_require__(7565); +const {Writable} = __nccwpck_require__(2413); +const {Agent, globalAgent} = __nccwpck_require__(9898); +const IncomingMessage = __nccwpck_require__(2575); +const urlToOptions = __nccwpck_require__(2686); +const proxyEvents = __nccwpck_require__(1818); +const isRequestPseudoHeader = __nccwpck_require__(1199); +const { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_PROTOCOL, + ERR_HTTP_HEADERS_SENT, + ERR_INVALID_HTTP_TOKEN, + ERR_HTTP_INVALID_HEADER_VALUE, + ERR_INVALID_CHAR +} = __nccwpck_require__(7087); + +const { + HTTP2_HEADER_STATUS, + HTTP2_HEADER_METHOD, + HTTP2_HEADER_PATH, + HTTP2_METHOD_CONNECT +} = http2.constants; + +const kHeaders = Symbol('headers'); +const kOrigin = Symbol('origin'); +const kSession = Symbol('session'); +const kOptions = Symbol('options'); +const kFlushedHeaders = Symbol('flushedHeaders'); +const kJobs = Symbol('jobs'); + +const isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/; +const isInvalidHeaderValue = /[^\t\u0020-\u007E\u0080-\u00FF]/; + +class ClientRequest extends Writable { + constructor(input, options, callback) { + super({ + autoDestroy: false + }); + + const hasInput = typeof input === 'string' || input instanceof URL; + if (hasInput) { + input = urlToOptions(input instanceof URL ? input : new URL(input)); + } + + if (typeof options === 'function' || options === undefined) { + // (options, callback) + callback = options; + options = hasInput ? input : {...input}; + } else { + // (input, options, callback) + options = {...input, ...options}; + } + + if (options.h2session) { + this[kSession] = options.h2session; + } else if (options.agent === false) { + this.agent = new Agent({maxFreeSessions: 0}); + } else if (typeof options.agent === 'undefined' || options.agent === null) { + if (typeof options.createConnection === 'function') { + // This is a workaround - we don't have to create the session on our own. + this.agent = new Agent({maxFreeSessions: 0}); + this.agent.createConnection = options.createConnection; + } else { + this.agent = globalAgent; + } + } else if (typeof options.agent.request === 'function') { + this.agent = options.agent; + } else { + throw new ERR_INVALID_ARG_TYPE('options.agent', ['Agent-like Object', 'undefined', 'false'], options.agent); + } + + if (options.protocol && options.protocol !== 'https:') { + throw new ERR_INVALID_PROTOCOL(options.protocol, 'https:'); + } + + const port = options.port || options.defaultPort || (this.agent && this.agent.defaultPort) || 443; + const host = options.hostname || options.host || 'localhost'; + + // Don't enforce the origin via options. It may be changed in an Agent. + delete options.hostname; + delete options.host; + delete options.port; + + const {timeout} = options; + options.timeout = undefined; + + this[kHeaders] = Object.create(null); + this[kJobs] = []; + + this.socket = null; + this.connection = null; + + this.method = options.method || 'GET'; + this.path = options.path; + + this.res = null; + this.aborted = false; + this.reusedSocket = false; + + if (options.headers) { + for (const [header, value] of Object.entries(options.headers)) { + this.setHeader(header, value); + } + } + + if (options.auth && !('authorization' in this[kHeaders])) { + this[kHeaders].authorization = 'Basic ' + Buffer.from(options.auth).toString('base64'); + } + + options.session = options.tlsSession; + options.path = options.socketPath; + + this[kOptions] = options; + + // Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field. + if (port === 443) { + this[kOrigin] = `https://${host}`; + + if (!(':authority' in this[kHeaders])) { + this[kHeaders][':authority'] = host; + } + } else { + this[kOrigin] = `https://${host}:${port}`; + + if (!(':authority' in this[kHeaders])) { + this[kHeaders][':authority'] = `${host}:${port}`; + } + } + + if (timeout) { + this.setTimeout(timeout); + } + + if (callback) { + this.once('response', callback); + } + + this[kFlushedHeaders] = false; + } + + get method() { + return this[kHeaders][HTTP2_HEADER_METHOD]; + } + + set method(value) { + if (value) { + this[kHeaders][HTTP2_HEADER_METHOD] = value.toUpperCase(); + } + } + + get path() { + return this[kHeaders][HTTP2_HEADER_PATH]; + } + + set path(value) { + if (value) { + this[kHeaders][HTTP2_HEADER_PATH] = value; + } + } + + get _mustNotHaveABody() { + return this.method === 'GET' || this.method === 'HEAD' || this.method === 'DELETE'; + } + + _write(chunk, encoding, callback) { + // https://github.com/nodejs/node/blob/654df09ae0c5e17d1b52a900a545f0664d8c7627/lib/internal/http2/util.js#L148-L156 + if (this._mustNotHaveABody) { + callback(new Error('The GET, HEAD and DELETE methods must NOT have a body')); + /* istanbul ignore next: Node.js 12 throws directly */ + return; + } + + this.flushHeaders(); + + const callWrite = () => this._request.write(chunk, encoding, callback); + if (this._request) { + callWrite(); + } else { + this[kJobs].push(callWrite); + } + } + + _final(callback) { + if (this.destroyed) { + return; + } + + this.flushHeaders(); + + const callEnd = () => { + // For GET, HEAD and DELETE + if (this._mustNotHaveABody) { + callback(); + return; + } + + this._request.end(callback); + }; + + if (this._request) { + callEnd(); + } else { + this[kJobs].push(callEnd); + } + } + + abort() { + if (this.res && this.res.complete) { + return; + } + + if (!this.aborted) { + process.nextTick(() => this.emit('abort')); + } + + this.aborted = true; + + this.destroy(); + } + + _destroy(error, callback) { + if (this.res) { + this.res._dump(); + } + + if (this._request) { + this._request.destroy(); + } + + callback(error); + } + + async flushHeaders() { + if (this[kFlushedHeaders] || this.destroyed) { + return; + } + + this[kFlushedHeaders] = true; + + const isConnectMethod = this.method === HTTP2_METHOD_CONNECT; + + // The real magic is here + const onStream = stream => { + this._request = stream; + + if (this.destroyed) { + stream.destroy(); + return; + } + + // Forwards `timeout`, `continue`, `close` and `error` events to this instance. + if (!isConnectMethod) { + proxyEvents(stream, this, ['timeout', 'continue', 'close', 'error']); + } + + // Wait for the `finish` event. We don't want to emit the `response` event + // before `request.end()` is called. + const waitForEnd = fn => { + return (...args) => { + if (!this.writable && !this.destroyed) { + fn(...args); + } else { + this.once('finish', () => { + fn(...args); + }); + } + }; + }; + + // This event tells we are ready to listen for the data. + stream.once('response', waitForEnd((headers, flags, rawHeaders) => { + // If we were to emit raw request stream, it would be as fast as the native approach. + // Note that wrapping the raw stream in a Proxy instance won't improve the performance (already tested it). + const response = new IncomingMessage(this.socket, stream.readableHighWaterMark); + this.res = response; + + response.req = this; + response.statusCode = headers[HTTP2_HEADER_STATUS]; + response.headers = headers; + response.rawHeaders = rawHeaders; + + response.once('end', () => { + if (this.aborted) { + response.aborted = true; + response.emit('aborted'); + } else { + response.complete = true; + + // Has no effect, just be consistent with the Node.js behavior + response.socket = null; + response.connection = null; + } + }); + + if (isConnectMethod) { + response.upgrade = true; + + // The HTTP1 API says the socket is detached here, + // but we can't do that so we pass the original HTTP2 request. + if (this.emit('connect', response, stream, Buffer.alloc(0))) { + this.emit('close'); + } else { + // No listeners attached, destroy the original request. + stream.destroy(); + } + } else { + // Forwards data + stream.on('data', chunk => { + if (!response._dumped && !response.push(chunk)) { + stream.pause(); + } + }); + + stream.once('end', () => { + response.push(null); + }); + + if (!this.emit('response', response)) { + // No listeners attached, dump the response. + response._dump(); + } + } + })); + + // Emits `information` event + stream.once('headers', waitForEnd( + headers => this.emit('information', {statusCode: headers[HTTP2_HEADER_STATUS]}) + )); + + stream.once('trailers', waitForEnd((trailers, flags, rawTrailers) => { + const {res} = this; + + // Assigns trailers to the response object. + res.trailers = trailers; + res.rawTrailers = rawTrailers; + })); + + const {socket} = stream.session; + this.socket = socket; + this.connection = socket; + + for (const job of this[kJobs]) { + job(); + } + + this.emit('socket', this.socket); + }; + + // Makes a HTTP2 request + if (this[kSession]) { + try { + onStream(this[kSession].request(this[kHeaders])); + } catch (error) { + this.emit('error', error); + } + } else { + this.reusedSocket = true; + + try { + onStream(await this.agent.request(this[kOrigin], this[kOptions], this[kHeaders])); + } catch (error) { + this.emit('error', error); + } + } + } + + getHeader(name) { + if (typeof name !== 'string') { + throw new ERR_INVALID_ARG_TYPE('name', 'string', name); + } + + return this[kHeaders][name.toLowerCase()]; + } + + get headersSent() { + return this[kFlushedHeaders]; + } + + removeHeader(name) { + if (typeof name !== 'string') { + throw new ERR_INVALID_ARG_TYPE('name', 'string', name); + } + + if (this.headersSent) { + throw new ERR_HTTP_HEADERS_SENT('remove'); + } + + delete this[kHeaders][name.toLowerCase()]; + } + + setHeader(name, value) { + if (this.headersSent) { + throw new ERR_HTTP_HEADERS_SENT('set'); + } + + if (typeof name !== 'string' || (!isValidHttpToken.test(name) && !isRequestPseudoHeader(name))) { + throw new ERR_INVALID_HTTP_TOKEN('Header name', name); + } + + if (typeof value === 'undefined') { + throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name); + } + + if (isInvalidHeaderValue.test(value)) { + throw new ERR_INVALID_CHAR('header content', name); + } + + this[kHeaders][name.toLowerCase()] = value; + } + + setNoDelay() { + // HTTP2 sockets cannot be malformed, do nothing. + } + + setSocketKeepAlive() { + // HTTP2 sockets cannot be malformed, do nothing. + } + + setTimeout(ms, callback) { + const applyTimeout = () => this._request.setTimeout(ms, callback); - /***/ 9025: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownSpace = __nccwpck_require__(5989); - var factorySpace = __nccwpck_require__(8200); - - var blockQuote = { - name: 'blockQuote', - tokenize: tokenizeBlockQuoteStart, - continuation: { - tokenize: tokenizeBlockQuoteContinuation, - }, - exit: exit, - }; - - function tokenizeBlockQuoteStart(effects, ok, nok) { - var self = this; - return start; - - function start(code) { - if (code === 62) { - if (!self.containerState.open) { - effects.enter('blockQuote', { - _container: true, - }); - self.containerState.open = true; - } - - effects.enter('blockQuotePrefix'); - effects.enter('blockQuoteMarker'); - effects.consume(code); - effects.exit('blockQuoteMarker'); - return after; - } - - return nok(code); - } + if (this._request) { + applyTimeout(); + } else { + this[kJobs].push(applyTimeout); + } - function after(code) { - if (markdownSpace(code)) { - effects.enter('blockQuotePrefixWhitespace'); - effects.consume(code); - effects.exit('blockQuotePrefixWhitespace'); - effects.exit('blockQuotePrefix'); - return ok; - } - - effects.exit('blockQuotePrefix'); - return ok(code); - } - } + return this; + } - function tokenizeBlockQuoteContinuation(effects, ok, nok) { - return factorySpace( - effects, - effects.attempt(blockQuote, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ); - } + get maxHeadersCount() { + if (!this.destroyed && this._request) { + return this._request.session.localSettings.maxHeaderListSize; + } - function exit(effects) { - effects.exit('blockQuote'); - } + return undefined; + } - module.exports = blockQuote; + set maxHeadersCount(_value) { + // Updating HTTP2 settings would affect all requests, do nothing. + } +} + +module.exports = ClientRequest; + + +/***/ }), - /***/ - }, +/***/ 2575: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - /***/ 7128: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var asciiPunctuation = __nccwpck_require__(7909); - - var characterEscape = { - name: 'characterEscape', - tokenize: tokenizeCharacterEscape, - }; - - function tokenizeCharacterEscape(effects, ok, nok) { - return start; - - function start(code) { - effects.enter('characterEscape'); - effects.enter('escapeMarker'); - effects.consume(code); - effects.exit('escapeMarker'); - return open; - } +"use strict"; - function open(code) { - if (asciiPunctuation(code)) { - effects.enter('characterEscapeValue'); - effects.consume(code); - effects.exit('characterEscapeValue'); - effects.exit('characterEscape'); - return ok; - } +const {Readable} = __nccwpck_require__(2413); - return nok(code); - } - } +class IncomingMessage extends Readable { + constructor(socket, highWaterMark) { + super({ + highWaterMark, + autoDestroy: false + }); - module.exports = characterEscape; + this.statusCode = null; + this.statusMessage = ''; + this.httpVersion = '2.0'; + this.httpVersionMajor = 2; + this.httpVersionMinor = 0; + this.headers = {}; + this.trailers = {}; + this.req = null; - /***/ - }, + this.aborted = false; + this.complete = false; + this.upgrade = null; - /***/ 9500: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var decodeEntity = __nccwpck_require__(3485); - var asciiAlphanumeric = __nccwpck_require__(598); - var asciiDigit = __nccwpck_require__(6996); - var asciiHexDigit = __nccwpck_require__(6526); - - function _interopDefaultLegacy(e) { - return e && typeof e === 'object' && 'default' in e - ? e - : { default: e }; - } + this.rawHeaders = []; + this.rawTrailers = []; - var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy( - decodeEntity - ); - - var characterReference = { - name: 'characterReference', - tokenize: tokenizeCharacterReference, - }; - - function tokenizeCharacterReference(effects, ok, nok) { - var self = this; - var size = 0; - var max; - var test; - return start; - - function start(code) { - effects.enter('characterReference'); - effects.enter('characterReferenceMarker'); - effects.consume(code); - effects.exit('characterReferenceMarker'); - return open; - } + this.socket = socket; + this.connection = socket; - function open(code) { - if (code === 35) { - effects.enter('characterReferenceMarkerNumeric'); - effects.consume(code); - effects.exit('characterReferenceMarkerNumeric'); - return numeric; - } - - effects.enter('characterReferenceValue'); - max = 31; - test = asciiAlphanumeric; - return value(code); - } + this._dumped = false; + } - function numeric(code) { - if (code === 88 || code === 120) { - effects.enter('characterReferenceMarkerHexadecimal'); - effects.consume(code); - effects.exit('characterReferenceMarkerHexadecimal'); - effects.enter('characterReferenceValue'); - max = 6; - test = asciiHexDigit; - return value; - } - - effects.enter('characterReferenceValue'); - max = 7; - test = asciiDigit; - return value(code); - } + _destroy(error) { + this.req._request.destroy(error); + } - function value(code) { - var token; + setTimeout(ms, callback) { + this.req.setTimeout(ms, callback); + return this; + } - if (code === 59 && size) { - token = effects.exit('characterReferenceValue'); + _dump() { + if (!this._dumped) { + this._dumped = true; - if ( - test === asciiAlphanumeric && - !decodeEntity__default['default'](self.sliceSerialize(token)) - ) { - return nok(code); - } + this.removeAllListeners('data'); + this.resume(); + } + } - effects.enter('characterReferenceMarker'); - effects.consume(code); - effects.exit('characterReferenceMarker'); - effects.exit('characterReference'); - return ok; - } + _read() { + if (this.req) { + this.req._request.resume(); + } + } +} - if (test(code) && size++ < max) { - effects.consume(code); - return value; - } +module.exports = IncomingMessage; - return nok(code); - } - } - module.exports = characterReference; +/***/ }), - /***/ - }, +/***/ 4645: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - /***/ 3268: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - var prefixSize = __nccwpck_require__(3722); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - - var codeFenced = { - name: 'codeFenced', - tokenize: tokenizeCodeFenced, - concrete: true, - }; - - function tokenizeCodeFenced(effects, ok, nok) { - var self = this; - var closingFenceConstruct = { - tokenize: tokenizeClosingFence, - partial: true, - }; - var initialPrefix = prefixSize(this.events, 'linePrefix'); - var sizeOpen = 0; - var marker; - return start; - - function start(code) { - effects.enter('codeFenced'); - effects.enter('codeFencedFence'); - effects.enter('codeFencedFenceSequence'); - marker = code; - return sequenceOpen(code); - } +"use strict"; - function sequenceOpen(code) { - if (code === marker) { - effects.consume(code); - sizeOpen++; - return sequenceOpen; - } - - effects.exit('codeFencedFenceSequence'); - return sizeOpen < 3 - ? nok(code) - : factorySpace(effects, infoOpen, 'whitespace')(code); - } +const http2 = __nccwpck_require__(7565); +const agent = __nccwpck_require__(9898); +const ClientRequest = __nccwpck_require__(9632); +const IncomingMessage = __nccwpck_require__(2575); +const auto = __nccwpck_require__(7167); - function infoOpen(code) { - if (code === null || markdownLineEnding(code)) { - return openAfter(code); - } +const request = (url, options, callback) => { + return new ClientRequest(url, options, callback); +}; - effects.enter('codeFencedFenceInfo'); - effects.enter('chunkString', { - contentType: 'string', - }); - return info(code); - } +const get = (url, options, callback) => { + // eslint-disable-next-line unicorn/prevent-abbreviations + const req = new ClientRequest(url, options, callback); + req.end(); - function info(code) { - if (code === null || markdownLineEndingOrSpace(code)) { - effects.exit('chunkString'); - effects.exit('codeFencedFenceInfo'); - return factorySpace(effects, infoAfter, 'whitespace')(code); - } + return req; +}; - if (code === 96 && code === marker) return nok(code); - effects.consume(code); - return info; - } +module.exports = { + ...http2, + ClientRequest, + IncomingMessage, + ...agent, + request, + get, + auto +}; - function infoAfter(code) { - if (code === null || markdownLineEnding(code)) { - return openAfter(code); - } - effects.enter('codeFencedFenceMeta'); - effects.enter('chunkString', { - contentType: 'string', - }); - return meta(code); - } +/***/ }), - function meta(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('chunkString'); - effects.exit('codeFencedFenceMeta'); - return openAfter(code); - } +/***/ 1982: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (code === 96 && code === marker) return nok(code); - effects.consume(code); - return meta; - } +"use strict"; - function openAfter(code) { - effects.exit('codeFencedFence'); - return self.interrupt ? ok(code) : content(code); - } +const net = __nccwpck_require__(1631); +/* istanbul ignore file: https://github.com/nodejs/node/blob/v13.0.1/lib/_http_agent.js */ - function content(code) { - if (code === null) { - return after(code); - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return effects.attempt( - closingFenceConstruct, - after, - initialPrefix - ? factorySpace( - effects, - content, - 'linePrefix', - initialPrefix + 1 - ) - : content - ); - } - - effects.enter('codeFlowValue'); - return contentContinue(code); - } +module.exports = options => { + let servername = options.host; + const hostHeader = options.headers && options.headers.host; - function contentContinue(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('codeFlowValue'); - return content(code); - } + if (hostHeader) { + if (hostHeader.startsWith('[')) { + const index = hostHeader.indexOf(']'); + if (index === -1) { + servername = hostHeader; + } else { + servername = hostHeader.slice(1, -1); + } + } else { + servername = hostHeader.split(':', 1)[0]; + } + } - effects.consume(code); - return contentContinue; - } + if (net.isIP(servername)) { + return ''; + } - function after(code) { - effects.exit('codeFenced'); - return ok(code); - } + return servername; +}; - function tokenizeClosingFence(effects, ok, nok) { - var size = 0; - return factorySpace( - effects, - closingSequenceStart, - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ); - - function closingSequenceStart(code) { - effects.enter('codeFencedFence'); - effects.enter('codeFencedFenceSequence'); - return closingSequence(code); - } - - function closingSequence(code) { - if (code === marker) { - effects.consume(code); - size++; - return closingSequence; - } - - if (size < sizeOpen) return nok(code); - effects.exit('codeFencedFenceSequence'); - return factorySpace( - effects, - closingSequenceEnd, - 'whitespace' - )(code); - } - - function closingSequenceEnd(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('codeFencedFence'); - return ok(code); - } - - return nok(code); - } - } - } - module.exports = codeFenced; +/***/ }), - /***/ - }, +/***/ 7087: +/***/ ((module) => { - /***/ 907: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var chunkedSplice = __nccwpck_require__(778); - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - var prefixSize = __nccwpck_require__(3722); - - var codeIndented = { - name: 'codeIndented', - tokenize: tokenizeCodeIndented, - resolve: resolveCodeIndented, - }; - var indentedContentConstruct = { - tokenize: tokenizeIndentedContent, - partial: true, - }; - - function resolveCodeIndented(events, context) { - var code = { - type: 'codeIndented', - start: events[0][1].start, - end: events[events.length - 1][1].end, - }; - chunkedSplice(events, 0, 0, [['enter', code, context]]); - chunkedSplice(events, events.length, 0, [['exit', code, context]]); - return events; - } +"use strict"; - function tokenizeCodeIndented(effects, ok, nok) { - return effects.attempt(indentedContentConstruct, afterPrefix, nok); +/* istanbul ignore file: https://github.com/nodejs/node/blob/master/lib/internal/errors.js */ - function afterPrefix(code) { - if (code === null) { - return ok(code); - } +const makeError = (Base, key, getMessage) => { + module.exports[key] = class NodeError extends Base { + constructor(...args) { + super(typeof getMessage === 'string' ? getMessage : getMessage(args)); + this.name = `${super.name} [${key}]`; + this.code = key; + } + }; +}; - if (markdownLineEnding(code)) { - return effects.attempt( - indentedContentConstruct, - afterPrefix, - ok - )(code); - } +makeError(TypeError, 'ERR_INVALID_ARG_TYPE', args => { + const type = args[0].includes('.') ? 'property' : 'argument'; - effects.enter('codeFlowValue'); - return content(code); - } + let valid = args[1]; + const isManyTypes = Array.isArray(valid); - function content(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('codeFlowValue'); - return afterPrefix(code); - } + if (isManyTypes) { + valid = `${valid.slice(0, -1).join(', ')} or ${valid.slice(-1)}`; + } - effects.consume(code); - return content; - } - } + return `The "${args[0]}" ${type} must be ${isManyTypes ? 'one of' : 'of'} type ${valid}. Received ${typeof args[2]}`; +}); - function tokenizeIndentedContent(effects, ok, nok) { - var self = this; - return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1); - - function afterPrefix(code) { - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1); - } - - return prefixSize(self.events, 'linePrefix') < 4 - ? nok(code) - : ok(code); - } - } +makeError(TypeError, 'ERR_INVALID_PROTOCOL', args => { + return `Protocol "${args[0]}" not supported. Expected "${args[1]}"`; +}); - module.exports = codeIndented; +makeError(Error, 'ERR_HTTP_HEADERS_SENT', args => { + return `Cannot ${args[0]} headers after they are sent to the client`; +}); - /***/ - }, +makeError(TypeError, 'ERR_INVALID_HTTP_TOKEN', args => { + return `${args[0]} must be a valid HTTP token [${args[1]}]`; +}); - /***/ 7033: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - - var codeText = { - name: 'codeText', - tokenize: tokenizeCodeText, - resolve: resolveCodeText, - previous: previous, - }; - - function resolveCodeText(events) { - var tailExitIndex = events.length - 4; - var headEnterIndex = 3; - var index; - var enter; // If we start and end with an EOL or a space. - - if ( - (events[headEnterIndex][1].type === 'lineEnding' || - events[headEnterIndex][1].type === 'space') && - (events[tailExitIndex][1].type === 'lineEnding' || - events[tailExitIndex][1].type === 'space') - ) { - index = headEnterIndex; // And we have data. - - while (++index < tailExitIndex) { - if (events[index][1].type === 'codeTextData') { - // Then we have padding. - events[tailExitIndex][1].type = events[headEnterIndex][1].type = - 'codeTextPadding'; - headEnterIndex += 2; - tailExitIndex -= 2; - break; - } - } - } // Merge adjacent spaces and data. - - index = headEnterIndex - 1; - tailExitIndex++; - - while (++index <= tailExitIndex) { - if (enter === undefined) { - if ( - index !== tailExitIndex && - events[index][1].type !== 'lineEnding' - ) { - enter = index; - } - } else if ( - index === tailExitIndex || - events[index][1].type === 'lineEnding' - ) { - events[enter][1].type = 'codeTextData'; - - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end; - events.splice(enter + 2, index - enter - 2); - tailExitIndex -= index - enter - 2; - index = enter + 2; - } - - enter = undefined; - } - } +makeError(TypeError, 'ERR_HTTP_INVALID_HEADER_VALUE', args => { + return `Invalid value "${args[0]} for header "${args[1]}"`; +}); - return events; - } +makeError(TypeError, 'ERR_INVALID_CHAR', args => { + return `Invalid character in ${args[0]} [${args[1]}]`; +}); - function previous(code) { - // If there is a previous code, there will always be a tail. - return ( - code !== 96 || - this.events[this.events.length - 1][1].type === 'characterEscape' - ); - } - function tokenizeCodeText(effects, ok, nok) { - var sizeOpen = 0; - var size; - var token; - return start; +/***/ }), - function start(code) { - effects.enter('codeText'); - effects.enter('codeTextSequence'); - return openingSequence(code); - } +/***/ 1199: +/***/ ((module) => { - function openingSequence(code) { - if (code === 96) { - effects.consume(code); - sizeOpen++; - return openingSequence; - } +"use strict"; - effects.exit('codeTextSequence'); - return gap(code); - } - function gap(code) { - // EOF. - if (code === null) { - return nok(code); - } // Closing fence? - // Could also be data. - - if (code === 96) { - token = effects.enter('codeTextSequence'); - size = 0; - return closingSequence(code); - } // Tabs don’t work, and virtual spaces don’t make sense. - - if (code === 32) { - effects.enter('space'); - effects.consume(code); - effects.exit('space'); - return gap; - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return gap; - } // Data. - - effects.enter('codeTextData'); - return data(code); - } // In code. - - function data(code) { - if ( - code === null || - code === 32 || - code === 96 || - markdownLineEnding(code) - ) { - effects.exit('codeTextData'); - return gap(code); - } - - effects.consume(code); - return data; - } // Closing fence. - - function closingSequence(code) { - // More. - if (code === 96) { - effects.consume(code); - size++; - return closingSequence; - } // Done! - - if (size === sizeOpen) { - effects.exit('codeTextSequence'); - effects.exit('codeText'); - return ok(code); - } // More or less accents: mark as data. - - token.type = 'codeTextData'; - return data(code); - } - } +module.exports = header => { + switch (header) { + case ':method': + case ':scheme': + case ':authority': + case ':path': + return true; + default: + return false; + } +}; - module.exports = codeText; - /***/ - }, +/***/ }), - /***/ 1259: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - var prefixSize = __nccwpck_require__(3722); - var subtokenize = __nccwpck_require__(14); - - // No name because it must not be turned off. - var content = { - tokenize: tokenizeContent, - resolve: resolveContent, - interruptible: true, - lazy: true, - }; - var continuationConstruct = { - tokenize: tokenizeContinuation, - partial: true, - }; // Content is transparent: it’s parsed right now. That way, definitions are also - // parsed right now: before text in paragraphs (specifically, media) are parsed. - - function resolveContent(events) { - subtokenize(events); - return events; - } +/***/ 1818: +/***/ ((module) => { - function tokenizeContent(effects, ok) { - var previous; - return start; +"use strict"; - function start(code) { - effects.enter('content'); - previous = effects.enter('chunkContent', { - contentType: 'content', - }); - return data(code); - } - function data(code) { - if (code === null) { - return contentEnd(code); - } - - if (markdownLineEnding(code)) { - return effects.check( - continuationConstruct, - contentContinue, - contentEnd - )(code); - } // Data. - - effects.consume(code); - return data; - } +module.exports = (from, to, events) => { + for (const event of events) { + from.on(event, (...args) => to.emit(event, ...args)); + } +}; - function contentEnd(code) { - effects.exit('chunkContent'); - effects.exit('content'); - return ok(code); - } - function contentContinue(code) { - effects.consume(code); - effects.exit('chunkContent'); - previous = previous.next = effects.enter('chunkContent', { - contentType: 'content', - previous: previous, - }); - return data; - } - } +/***/ }), - function tokenizeContinuation(effects, ok, nok) { - var self = this; - return startLookahead; +/***/ 2686: +/***/ ((module) => { - function startLookahead(code) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, prefixed, 'linePrefix'); - } +"use strict"; - function prefixed(code) { - if (code === null || markdownLineEnding(code)) { - return nok(code); - } - - if ( - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || - prefixSize(self.events, 'linePrefix') < 4 - ) { - return effects.interrupt( - self.parser.constructs.flow, - nok, - ok - )(code); - } - - return ok(code); - } - } +/* istanbul ignore file: https://github.com/nodejs/node/blob/a91293d4d9ab403046ab5eb022332e4e3d249bd3/lib/internal/url.js#L1257 */ - module.exports = content; +module.exports = url => { + const options = { + protocol: url.protocol, + hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, + host: url.host, + hash: url.hash, + search: url.search, + pathname: url.pathname, + href: url.href, + path: `${url.pathname || ''}${url.search || ''}` + }; - /***/ - }, + if (typeof url.port === 'string' && url.port.length !== 0) { + options.port = Number(url.port); + } - /***/ 1193: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var normalizeIdentifier = __nccwpck_require__(712); - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - var factoryDestination = __nccwpck_require__(9851); - var factoryLabel = __nccwpck_require__(349); - var factoryWhitespace = __nccwpck_require__(3168); - var factoryTitle = __nccwpck_require__(9469); - - var definition = { - name: 'definition', - tokenize: tokenizeDefinition, - }; - var titleConstruct = { - tokenize: tokenizeTitle, - partial: true, - }; - - function tokenizeDefinition(effects, ok, nok) { - var self = this; - var identifier; - return start; - - function start(code) { - effects.enter('definition'); - return factoryLabel.call( - self, - effects, - labelAfter, - nok, - 'definitionLabel', - 'definitionLabelMarker', - 'definitionLabelString' - )(code); - } + if (url.username || url.password) { + options.auth = `${url.username || ''}:${url.password || ''}`; + } - function labelAfter(code) { - identifier = normalizeIdentifier( - self - .sliceSerialize(self.events[self.events.length - 1][1]) - .slice(1, -1) - ); - - if (code === 58) { - effects.enter('definitionMarker'); - effects.consume(code); - effects.exit('definitionMarker'); // Note: blank lines can’t exist in content. - - return factoryWhitespace( - effects, - factoryDestination( - effects, - effects.attempt( - titleConstruct, - factorySpace(effects, after, 'whitespace'), - factorySpace(effects, after, 'whitespace') - ), - nok, - 'definitionDestination', - 'definitionDestinationLiteral', - 'definitionDestinationLiteralMarker', - 'definitionDestinationRaw', - 'definitionDestinationString' - ) - ); - } - - return nok(code); - } + return options; +}; - function after(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('definition'); - if (self.parser.defined.indexOf(identifier) < 0) { - self.parser.defined.push(identifier); - } +/***/ }), - return ok(code); - } +/***/ 2820: +/***/ ((__unused_webpack_module, exports) => { - return nok(code); - } - } +//TODO: handle reviver/dehydrate function like normal +//and handle indentation, like normal. +//if anyone needs this... please send pull request. - function tokenizeTitle(effects, ok, nok) { - return start; +exports.stringify = function stringify (o) { + if('undefined' == typeof o) return o - function start(code) { - return markdownLineEndingOrSpace(code) - ? factoryWhitespace(effects, before)(code) - : nok(code); - } + if(o && Buffer.isBuffer(o)) + return JSON.stringify(':base64:' + o.toString('base64')) + + if(o && o.toJSON) + o = o.toJSON() - function before(code) { - if (code === 34 || code === 39 || code === 40) { - return factoryTitle( - effects, - factorySpace(effects, after, 'whitespace'), - nok, - 'definitionTitle', - 'definitionTitleMarker', - 'definitionTitleString' - )(code); - } - - return nok(code); - } + if(o && 'object' === typeof o) { + var s = '' + var array = Array.isArray(o) + s = array ? '[' : '{' + var first = true - function after(code) { - return code === null || markdownLineEnding(code) - ? ok(code) - : nok(code); - } - } + for(var k in o) { + var ignore = 'function' == typeof o[k] || (!array && 'undefined' === typeof o[k]) + if(Object.hasOwnProperty.call(o, k) && !ignore) { + if(!first) + s += ',' + first = false + if (array) { + if(o[k] == undefined) + s += 'null' + else + s += stringify(o[k]) + } else if (o[k] !== void(0)) { + s += stringify(k) + ':' + stringify(o[k]) + } + } + } + + s += array ? ']' : '}' + + return s + } else if ('string' === typeof o) { + return JSON.stringify(/^:/.test(o) ? ':' + o : o) + } else if ('undefined' === typeof o) { + return 'null'; + } else + return JSON.stringify(o) +} + +exports.parse = function (s) { + return JSON.parse(s, function (key, value) { + if('string' === typeof value) { + if(/^:base64:/.test(value)) + return Buffer.from(value.substring(8), 'base64') + else + return /^:/.test(value) ? value.substring(1) : value + } + return value + }) +} + + +/***/ }), + +/***/ 1531: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const EventEmitter = __nccwpck_require__(8614); +const JSONB = __nccwpck_require__(2820); + +const loadStore = opts => { + const adapters = { + redis: '@keyv/redis', + mongodb: '@keyv/mongo', + mongo: '@keyv/mongo', + sqlite: '@keyv/sqlite', + postgresql: '@keyv/postgres', + postgres: '@keyv/postgres', + mysql: '@keyv/mysql' + }; + if (opts.adapter || opts.uri) { + const adapter = opts.adapter || /^[^:]*/.exec(opts.uri)[0]; + return new (require(adapters[adapter]))(opts); + } + + return new Map(); +}; + +class Keyv extends EventEmitter { + constructor(uri, opts) { + super(); + this.opts = Object.assign( + { + namespace: 'keyv', + serialize: JSONB.stringify, + deserialize: JSONB.parse + }, + (typeof uri === 'string') ? { uri } : uri, + opts + ); + + if (!this.opts.store) { + const adapterOpts = Object.assign({}, this.opts); + this.opts.store = loadStore(adapterOpts); + } + + if (typeof this.opts.store.on === 'function') { + this.opts.store.on('error', err => this.emit('error', err)); + } + + this.opts.store.namespace = this.opts.namespace; + } + + _getKeyPrefix(key) { + return `${this.opts.namespace}:${key}`; + } + + get(key, opts) { + const keyPrefixed = this._getKeyPrefix(key); + const { store } = this.opts; + return Promise.resolve() + .then(() => store.get(keyPrefixed)) + .then(data => { + return (typeof data === 'string') ? this.opts.deserialize(data) : data; + }) + .then(data => { + if (data === undefined) { + return undefined; + } + + if (typeof data.expires === 'number' && Date.now() > data.expires) { + this.delete(key); + return undefined; + } + + return (opts && opts.raw) ? data : data.value; + }); + } + + set(key, value, ttl) { + const keyPrefixed = this._getKeyPrefix(key); + if (typeof ttl === 'undefined') { + ttl = this.opts.ttl; + } + + if (ttl === 0) { + ttl = undefined; + } - module.exports = definition; + const { store } = this.opts; - /***/ - }, + return Promise.resolve() + .then(() => { + const expires = (typeof ttl === 'number') ? (Date.now() + ttl) : null; + value = { value, expires }; + return this.opts.serialize(value); + }) + .then(value => store.set(keyPrefixed, value, ttl)) + .then(() => true); + } - /***/ 9851: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - var asciiControl = __nccwpck_require__(1336); - - // eslint-disable-next-line max-params - function destinationFactory( - effects, - ok, - nok, - type, - literalType, - literalMarkerType, - rawType, - stringType, - max + delete(key) { + const keyPrefixed = this._getKeyPrefix(key); + const { store } = this.opts; + return Promise.resolve() + .then(() => store.delete(keyPrefixed)); + } + + clear() { + const { store } = this.opts; + return Promise.resolve() + .then(() => store.clear()); + } +} + +module.exports = Keyv; + + +/***/ }), + +/***/ 4232: +/***/ ((module) => { + +"use strict"; + + +module.exports = longestStreak + +// Get the count of the longest repeating streak of `character` in `value`. +function longestStreak(value, character) { + var count = 0 + var maximum = 0 + var expected + var index + + if (typeof character !== 'string' || character.length !== 1) { + throw new Error('Expected character') + } + + value = String(value) + index = value.indexOf(character) + expected = index + + while (index !== -1) { + count++ + + if (index === expected) { + if (count > maximum) { + maximum = count + } + } else { + count = 1 + } + + expected = index + 1 + index = value.indexOf(character, expected) + } + + return maximum +} + + +/***/ }), + +/***/ 9662: +/***/ ((module) => { + +"use strict"; + +module.exports = object => { + const result = {}; + + for (const [key, value] of Object.entries(object)) { + result[key.toLowerCase()] = value; + } + + return result; +}; + + +/***/ }), + +/***/ 6869: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = fromMarkdown + +// These three are compiled away in the `dist/` + +var toString = __nccwpck_require__(5789) +var assign = __nccwpck_require__(3512) +var own = __nccwpck_require__(3500) +var normalizeIdentifier = __nccwpck_require__(712) +var safeFromInt = __nccwpck_require__(6214) +var parser = __nccwpck_require__(488) +var preprocessor = __nccwpck_require__(5603) +var postprocess = __nccwpck_require__(6948) +var decode = __nccwpck_require__(3485) +var stringifyPosition = __nccwpck_require__(1957) + +function fromMarkdown(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return compiler(options)( + postprocess( + parser(options).document().write(preprocessor()(value, encoding, true)) + ) + ) +} + +// Note this compiler only understand complete buffering, not streaming. +function compiler(options) { + var settings = options || {} + var config = configure( + { + canContainEols: [ + 'emphasis', + 'fragment', + 'heading', + 'paragraph', + 'strong' + ], + + enter: { + autolink: opener(link), + autolinkProtocol: onenterdata, + autolinkEmail: onenterdata, + atxHeading: opener(heading), + blockQuote: opener(blockQuote), + characterEscape: onenterdata, + characterReference: onenterdata, + codeFenced: opener(codeFlow), + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: opener(codeFlow, buffer), + codeText: opener(codeText, buffer), + codeTextData: onenterdata, + data: onenterdata, + codeFlowValue: onenterdata, + definition: opener(definition), + definitionDestinationString: buffer, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: opener(emphasis), + hardBreakEscape: opener(hardBreak), + hardBreakTrailing: opener(hardBreak), + htmlFlow: opener(html, buffer), + htmlFlowData: onenterdata, + htmlText: opener(html, buffer), + htmlTextData: onenterdata, + image: opener(image), + label: buffer, + link: opener(link), + listItem: opener(listItem), + listItemValue: onenterlistitemvalue, + listOrdered: opener(list, onenterlistordered), + listUnordered: opener(list), + paragraph: opener(paragraph), + reference: onenterreference, + referenceString: buffer, + resourceDestinationString: buffer, + resourceTitleString: buffer, + setextHeading: opener(heading), + strong: opener(strong), + thematicBreak: opener(thematicBreak) + }, + + exit: { + atxHeading: closer(), + atxHeadingSequence: onexitatxheadingsequence, + autolink: closer(), + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: closer(), + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: closer(onexitcodefenced), + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onexitcodefencedfencemeta, + codeFlowValue: onexitdata, + codeIndented: closer(onexitcodeindented), + codeText: closer(onexitcodetext), + codeTextData: onexitdata, + data: onexitdata, + definition: closer(), + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: closer(), + hardBreakEscape: closer(onexithardbreak), + hardBreakTrailing: closer(onexithardbreak), + htmlFlow: closer(onexithtmlflow), + htmlFlowData: onexitdata, + htmlText: closer(onexithtmltext), + htmlTextData: onexitdata, + image: closer(onexitimage), + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: closer(onexitlink), + listItem: closer(), + listOrdered: closer(), + listUnordered: closer(), + paragraph: closer(), + referenceString: onexitreferencestring, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + resource: onexitresource, + setextHeading: closer(onexitsetextheading), + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: closer(), + thematicBreak: closer() + } + }, + + settings.mdastExtensions || [] + ) + + var data = {} + + return compile + + function compile(events) { + var stack = [{type: 'root', children: []}] + var tokenStack = [] + var listStack = [] + var index = -1 + var handler + var listStart + + var context = { + stack: stack, + tokenStack: tokenStack, + config: config, + enter: enter, + exit: exit, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + } + + while (++index < events.length) { + // We preprocess lists to add `listItem` tokens, and to infer whether + // items the list itself are spread out. + if ( + events[index][1].type === 'listOrdered' || + events[index][1].type === 'listUnordered' ) { - var limit = max || Infinity; - var balance = 0; - return start; - - function start(code) { - if (code === 60) { - effects.enter(type); - effects.enter(literalType); - effects.enter(literalMarkerType); - effects.consume(code); - effects.exit(literalMarkerType); - return destinationEnclosedBefore; - } - - if (asciiControl(code)) { - return nok(code); - } - - effects.enter(type); - effects.enter(rawType); - effects.enter(stringType); - effects.enter('chunkString', { - contentType: 'string', - }); - return destinationRaw(code); - } - - function destinationEnclosedBefore(code) { - if (code === 62) { - effects.enter(literalMarkerType); - effects.consume(code); - effects.exit(literalMarkerType); - effects.exit(literalType); - effects.exit(type); - return ok; - } - - effects.enter(stringType); - effects.enter('chunkString', { - contentType: 'string', - }); - return destinationEnclosed(code); - } - - function destinationEnclosed(code) { - if (code === 62) { - effects.exit('chunkString'); - effects.exit(stringType); - return destinationEnclosedBefore(code); - } - - if (code === null || code === 60 || markdownLineEnding(code)) { - return nok(code); - } - - effects.consume(code); - return code === 92 ? destinationEnclosedEscape : destinationEnclosed; - } - - function destinationEnclosedEscape(code) { - if (code === 60 || code === 62 || code === 92) { - effects.consume(code); - return destinationEnclosed; - } - - return destinationEnclosed(code); - } - - function destinationRaw(code) { - if (code === 40) { - if (++balance > limit) return nok(code); - effects.consume(code); - return destinationRaw; - } - - if (code === 41) { - if (!balance--) { - effects.exit('chunkString'); - effects.exit(stringType); - effects.exit(rawType); - effects.exit(type); - return ok(code); - } - - effects.consume(code); - return destinationRaw; - } - - if (code === null || markdownLineEndingOrSpace(code)) { - if (balance) return nok(code); - effects.exit('chunkString'); - effects.exit(stringType); - effects.exit(rawType); - effects.exit(type); - return ok(code); - } - - if (asciiControl(code)) return nok(code); - effects.consume(code); - return code === 92 ? destinationRawEscape : destinationRaw; - } - - function destinationRawEscape(code) { - if (code === 40 || code === 41 || code === 92) { - effects.consume(code); - return destinationRaw; - } - - return destinationRaw(code); + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + listStart = listStack.pop(index) + index = prepareList(events, listStart, index) } } + } - module.exports = destinationFactory; + index = -1 - /***/ - }, + while (++index < events.length) { + handler = config[events[index][0]] - /***/ 349: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; + if (own.call(handler, events[index][1].type)) { + handler[events[index][1].type].call( + assign({sliceSerialize: events[index][2].sliceSerialize}, context), + events[index][1] + ) + } + } - var markdownLineEnding = __nccwpck_require__(7506); - var markdownSpace = __nccwpck_require__(5989); + if (tokenStack.length) { + throw new Error( + 'Cannot close document, a token (`' + + tokenStack[tokenStack.length - 1].type + + '`, ' + + stringifyPosition({ + start: tokenStack[tokenStack.length - 1].start, + end: tokenStack[tokenStack.length - 1].end + }) + + ') is still open' + ) + } - // eslint-disable-next-line max-params - function labelFactory(effects, ok, nok, type, markerType, stringType) { - var self = this; - var size = 0; - var data; - return start; + // Figure out `root` position. + stack[0].position = { + start: point( + events.length ? events[0][1].start : {line: 1, column: 1, offset: 0} + ), - function start(code) { - effects.enter(type); - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - effects.enter(stringType); - return atBreak; + end: point( + events.length + ? events[events.length - 2][1].end + : {line: 1, column: 1, offset: 0} + ) + } + + return stack[0] + } + + function prepareList(events, start, length) { + var index = start - 1 + var containerBalance = -1 + var listSpread = false + var listItem + var tailIndex + var lineIndex + var tailEvent + var event + var firstBlankLineIndex + var atMarker + + while (++index <= length) { + event = events[index] + + if ( + event[1].type === 'listUnordered' || + event[1].type === 'listOrdered' || + event[1].type === 'blockQuote' + ) { + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- } - function atBreak(code) { + atMarker = undefined + } else if (event[1].type === 'lineEndingBlank') { + if (event[0] === 'enter') { if ( - code === null || - code === 91 || - (code === 93 && !data) || - /* c8 ignore next */ - (code === 94 && - /* c8 ignore next */ - !size && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs) || - size > 999 + listItem && + !atMarker && + !containerBalance && + !firstBlankLineIndex ) { - return nok(code); + firstBlankLineIndex = index } - if (code === 93) { - effects.exit(stringType); - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - effects.exit(type); - return ok; - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return atBreak; - } - - effects.enter('chunkString', { - contentType: 'string', - }); - return label(code); - } - - function label(code) { - if ( - code === null || - code === 91 || - code === 93 || - markdownLineEnding(code) || - size++ > 999 - ) { - effects.exit('chunkString'); - return atBreak(code); - } - - effects.consume(code); - data = data || !markdownSpace(code); - return code === 92 ? labelEscape : label; - } - - function labelEscape(code) { - if (code === 91 || code === 92 || code === 93) { - effects.consume(code); - size++; - return label; - } - - return label(code); + atMarker = undefined } + } else if ( + event[1].type === 'linePrefix' || + event[1].type === 'listItemValue' || + event[1].type === 'listItemMarker' || + event[1].type === 'listItemPrefix' || + event[1].type === 'listItemPrefixWhitespace' + ) { + // Empty. + } else { + atMarker = undefined } - module.exports = labelFactory; + if ( + (!containerBalance && + event[0] === 'enter' && + event[1].type === 'listItemPrefix') || + (containerBalance === -1 && + event[0] === 'exit' && + (event[1].type === 'listUnordered' || + event[1].type === 'listOrdered')) + ) { + if (listItem) { + tailIndex = index + lineIndex = undefined + + while (tailIndex--) { + tailEvent = events[tailIndex] - /***/ - }, - - /***/ 8200: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownSpace = __nccwpck_require__(5989); - - function spaceFactory(effects, ok, type, max) { - var limit = max ? max - 1 : Infinity; - var size = 0; - return start; - - function start(code) { - if (markdownSpace(code)) { - effects.enter(type); - return prefix(code); - } - - return ok(code); - } - - function prefix(code) { - if (markdownSpace(code) && size++ < limit) { - effects.consume(code); - return prefix; - } - - effects.exit(type); - return ok(code); - } - } - - module.exports = spaceFactory; - - /***/ - }, - - /***/ 9469: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - - function titleFactory(effects, ok, nok, type, markerType, stringType) { - var marker; - return start; - - function start(code) { - effects.enter(type); - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - marker = code === 40 ? 41 : code; - return atFirstTitleBreak; - } - - function atFirstTitleBreak(code) { - if (code === marker) { - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - effects.exit(type); - return ok; - } - - effects.enter(stringType); - return atTitleBreak(code); - } - - function atTitleBreak(code) { - if (code === marker) { - effects.exit(stringType); - return atFirstTitleBreak(marker); - } - - if (code === null) { - return nok(code); - } // Note: blank lines can’t exist in content. - - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, atTitleBreak, 'linePrefix'); - } - - effects.enter('chunkString', { - contentType: 'string', - }); - return title(code); - } - - function title(code) { - if (code === marker || code === null || markdownLineEnding(code)) { - effects.exit('chunkString'); - return atTitleBreak(code); - } - - effects.consume(code); - return code === 92 ? titleEscape : title; - } - - function titleEscape(code) { - if (code === marker || code === 92) { - effects.consume(code); - return title; - } - - return title(code); - } - } - - module.exports = titleFactory; - - /***/ - }, - - /***/ 3168: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var markdownSpace = __nccwpck_require__(5989); - var factorySpace = __nccwpck_require__(8200); - - function whitespaceFactory(effects, ok) { - var seen; - return start; - - function start(code) { - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - seen = true; - return start; - } - - if (markdownSpace(code)) { - return factorySpace( - effects, - start, - seen ? 'linePrefix' : 'lineSuffix' - )(code); - } - - return ok(code); - } - } - - module.exports = whitespaceFactory; - - /***/ - }, - - /***/ 7608: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - - var hardBreakEscape = { - name: 'hardBreakEscape', - tokenize: tokenizeHardBreakEscape, - }; - - function tokenizeHardBreakEscape(effects, ok, nok) { - return start; - - function start(code) { - effects.enter('hardBreakEscape'); - effects.enter('escapeMarker'); - effects.consume(code); - return open; - } - - function open(code) { - if (markdownLineEnding(code)) { - effects.exit('escapeMarker'); - effects.exit('hardBreakEscape'); - return ok(code); - } - - return nok(code); - } - } - - module.exports = hardBreakEscape; - - /***/ - }, - - /***/ 4558: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var chunkedSplice = __nccwpck_require__(778); - var markdownLineEnding = __nccwpck_require__(7506); - var markdownSpace = __nccwpck_require__(5989); - var factorySpace = __nccwpck_require__(8200); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - - var headingAtx = { - name: 'headingAtx', - tokenize: tokenizeHeadingAtx, - resolve: resolveHeadingAtx, - }; - - function resolveHeadingAtx(events, context) { - var contentEnd = events.length - 2; - var contentStart = 3; - var content; - var text; // Prefix whitespace, part of the opening. - - if (events[contentStart][1].type === 'whitespace') { - contentStart += 2; - } // Suffix whitespace, part of the closing. - - if ( - contentEnd - 2 > contentStart && - events[contentEnd][1].type === 'whitespace' - ) { - contentEnd -= 2; - } - - if ( - events[contentEnd][1].type === 'atxHeadingSequence' && - (contentStart === contentEnd - 1 || - (contentEnd - 4 > contentStart && - events[contentEnd - 2][1].type === 'whitespace')) - ) { - contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; - } - - if (contentEnd > contentStart) { - content = { - type: 'atxHeadingText', - start: events[contentStart][1].start, - end: events[contentEnd][1].end, - }; - text = { - type: 'chunkText', - start: events[contentStart][1].start, - end: events[contentEnd][1].end, - contentType: 'text', - }; - chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [ - ['enter', content, context], - ['enter', text, context], - ['exit', text, context], - ['exit', content, context], - ]); - } - - return events; - } - - function tokenizeHeadingAtx(effects, ok, nok) { - var self = this; - var size = 0; - return start; - - function start(code) { - effects.enter('atxHeading'); - effects.enter('atxHeadingSequence'); - return fenceOpenInside(code); - } - - function fenceOpenInside(code) { - if (code === 35 && size++ < 6) { - effects.consume(code); - return fenceOpenInside; - } - - if (code === null || markdownLineEndingOrSpace(code)) { - effects.exit('atxHeadingSequence'); - return self.interrupt ? ok(code) : headingBreak(code); - } - - return nok(code); - } - - function headingBreak(code) { - if (code === 35) { - effects.enter('atxHeadingSequence'); - return sequence(code); - } - - if (code === null || markdownLineEnding(code)) { - effects.exit('atxHeading'); - return ok(code); - } - - if (markdownSpace(code)) { - return factorySpace(effects, headingBreak, 'whitespace')(code); - } - - effects.enter('atxHeadingText'); - return data(code); - } - - function sequence(code) { - if (code === 35) { - effects.consume(code); - return sequence; - } - - effects.exit('atxHeadingSequence'); - return headingBreak(code); - } - - function data(code) { - if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { - effects.exit('atxHeadingText'); - return headingBreak(code); - } - - effects.consume(code); - return data; - } - } - - module.exports = headingAtx; - - /***/ - }, - - /***/ 6791: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var fromCharCode = __nccwpck_require__(3531); - var asciiAlphanumeric = __nccwpck_require__(598); - var markdownLineEnding = __nccwpck_require__(7506); - var markdownSpace = __nccwpck_require__(5989); - var partialBlankLine = __nccwpck_require__(2244); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - var asciiAlpha = __nccwpck_require__(3847); - var htmlBlockNames = __nccwpck_require__(5159); - var htmlRawNames = __nccwpck_require__(4677); - - var htmlFlow = { - name: 'htmlFlow', - tokenize: tokenizeHtmlFlow, - resolveTo: resolveToHtmlFlow, - concrete: true, - }; - var nextBlankConstruct = { - tokenize: tokenizeNextBlank, - partial: true, - }; - - function resolveToHtmlFlow(events) { - var index = events.length; - - while (index--) { - if ( - events[index][0] === 'enter' && - events[index][1].type === 'htmlFlow' - ) { - break; - } - } - - if (index > 1 && events[index - 2][1].type === 'linePrefix') { - // Add the prefix start to the HTML token. - events[index][1].start = events[index - 2][1].start; // Add the prefix start to the HTML line token. - - events[index + 1][1].start = events[index - 2][1].start; // Remove the line prefix. - - events.splice(index - 2, 2); - } - - return events; - } - - function tokenizeHtmlFlow(effects, ok, nok) { - var self = this; - var kind; - var startTag; - var buffer; - var index; - var marker; - return start; - - function start(code) { - effects.enter('htmlFlow'); - effects.enter('htmlFlowData'); - effects.consume(code); - return open; - } - - function open(code) { - if (code === 33) { - effects.consume(code); - return declarationStart; - } - - if (code === 47) { - effects.consume(code); - return tagCloseStart; - } - - if (code === 63) { - effects.consume(code); - kind = 3; // While we’re in an instruction instead of a declaration, we’re on a `?` - // right now, so we do need to search for `>`, similar to declarations. - - return self.interrupt ? ok : continuationDeclarationInside; - } - - if (asciiAlpha(code)) { - effects.consume(code); - buffer = fromCharCode(code); - startTag = true; - return tagName; - } - - return nok(code); - } - - function declarationStart(code) { - if (code === 45) { - effects.consume(code); - kind = 2; - return commentOpenInside; - } - - if (code === 91) { - effects.consume(code); - kind = 5; - buffer = 'CDATA['; - index = 0; - return cdataOpenInside; - } - - if (asciiAlpha(code)) { - effects.consume(code); - kind = 4; - return self.interrupt ? ok : continuationDeclarationInside; - } - - return nok(code); - } - - function commentOpenInside(code) { - if (code === 45) { - effects.consume(code); - return self.interrupt ? ok : continuationDeclarationInside; - } - - return nok(code); - } - - function cdataOpenInside(code) { - if (code === buffer.charCodeAt(index++)) { - effects.consume(code); - return index === buffer.length - ? self.interrupt - ? ok - : continuation - : cdataOpenInside; - } - - return nok(code); - } - - function tagCloseStart(code) { - if (asciiAlpha(code)) { - effects.consume(code); - buffer = fromCharCode(code); - return tagName; - } - - return nok(code); - } - - function tagName(code) { - if ( - code === null || - code === 47 || - code === 62 || - markdownLineEndingOrSpace(code) - ) { if ( - code !== 47 && - startTag && - htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + tailEvent[1].type === 'lineEnding' || + tailEvent[1].type === 'lineEndingBlank' ) { - kind = 1; - return self.interrupt ? ok(code) : continuation(code); - } + if (tailEvent[0] === 'exit') continue - if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { - kind = 6; - - if (code === 47) { - effects.consume(code); - return basicSelfClosing; + if (lineIndex) { + events[lineIndex][1].type = 'lineEndingBlank' + listSpread = true } - return self.interrupt ? ok(code) : continuation(code); - } - - kind = 7; // Do not support complete HTML when interrupting. - - return self.interrupt - ? nok(code) - : startTag - ? completeAttributeNameBefore(code) - : completeClosingTagAfter(code); - } - - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code); - buffer += fromCharCode(code); - return tagName; - } - - return nok(code); - } - - function basicSelfClosing(code) { - if (code === 62) { - effects.consume(code); - return self.interrupt ? ok : continuation; - } - - return nok(code); - } - - function completeClosingTagAfter(code) { - if (markdownSpace(code)) { - effects.consume(code); - return completeClosingTagAfter; - } - - return completeEnd(code); - } - - function completeAttributeNameBefore(code) { - if (code === 47) { - effects.consume(code); - return completeEnd; - } - - if (code === 58 || code === 95 || asciiAlpha(code)) { - effects.consume(code); - return completeAttributeName; - } - - if (markdownSpace(code)) { - effects.consume(code); - return completeAttributeNameBefore; - } - - return completeEnd(code); - } - - function completeAttributeName(code) { - if ( - code === 45 || - code === 46 || - code === 58 || - code === 95 || - asciiAlphanumeric(code) - ) { - effects.consume(code); - return completeAttributeName; - } - - return completeAttributeNameAfter(code); - } - - function completeAttributeNameAfter(code) { - if (code === 61) { - effects.consume(code); - return completeAttributeValueBefore; - } - - if (markdownSpace(code)) { - effects.consume(code); - return completeAttributeNameAfter; - } - - return completeAttributeNameBefore(code); - } - - function completeAttributeValueBefore(code) { - if ( - code === null || - code === 60 || - code === 61 || - code === 62 || - code === 96 - ) { - return nok(code); - } - - if (code === 34 || code === 39) { - effects.consume(code); - marker = code; - return completeAttributeValueQuoted; - } - - if (markdownSpace(code)) { - effects.consume(code); - return completeAttributeValueBefore; - } - - marker = undefined; - return completeAttributeValueUnquoted(code); - } - - function completeAttributeValueQuoted(code) { - if (code === marker) { - effects.consume(code); - return completeAttributeValueQuotedAfter; - } - - if (code === null || markdownLineEnding(code)) { - return nok(code); - } - - effects.consume(code); - return completeAttributeValueQuoted; - } - - function completeAttributeValueUnquoted(code) { - if ( - code === null || - code === 34 || - code === 39 || - code === 60 || - code === 61 || - code === 62 || - code === 96 || - markdownLineEndingOrSpace(code) - ) { - return completeAttributeNameAfter(code); - } - - effects.consume(code); - return completeAttributeValueUnquoted; - } - - function completeAttributeValueQuotedAfter(code) { - if (code === 47 || code === 62 || markdownSpace(code)) { - return completeAttributeNameBefore(code); - } - - return nok(code); - } - - function completeEnd(code) { - if (code === 62) { - effects.consume(code); - return completeAfter; - } - - return nok(code); - } - - function completeAfter(code) { - if (markdownSpace(code)) { - effects.consume(code); - return completeAfter; - } - - return code === null || markdownLineEnding(code) - ? continuation(code) - : nok(code); - } - - function continuation(code) { - if (code === 45 && kind === 2) { - effects.consume(code); - return continuationCommentInside; - } - - if (code === 60 && kind === 1) { - effects.consume(code); - return continuationRawTagOpen; - } - - if (code === 62 && kind === 4) { - effects.consume(code); - return continuationClose; - } - - if (code === 63 && kind === 3) { - effects.consume(code); - return continuationDeclarationInside; - } - - if (code === 93 && kind === 5) { - effects.consume(code); - return continuationCharacterDataInside; - } - - if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { - return effects.check( - nextBlankConstruct, - continuationClose, - continuationAtLineEnding - )(code); - } - - if (code === null || markdownLineEnding(code)) { - return continuationAtLineEnding(code); - } - - effects.consume(code); - return continuation; - } - - function continuationAtLineEnding(code) { - effects.exit('htmlFlowData'); - return htmlContinueStart(code); - } - - function htmlContinueStart(code) { - if (code === null) { - return done(code); - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return htmlContinueStart; - } - - effects.enter('htmlFlowData'); - return continuation(code); - } - - function continuationCommentInside(code) { - if (code === 45) { - effects.consume(code); - return continuationDeclarationInside; - } - - return continuation(code); - } - - function continuationRawTagOpen(code) { - if (code === 47) { - effects.consume(code); - buffer = ''; - return continuationRawEndTag; - } - - return continuation(code); - } - - function continuationRawEndTag(code) { - if (code === 62 && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { - effects.consume(code); - return continuationClose; - } - - if (asciiAlpha(code) && buffer.length < 8) { - effects.consume(code); - buffer += fromCharCode(code); - return continuationRawEndTag; - } - - return continuation(code); - } - - function continuationCharacterDataInside(code) { - if (code === 93) { - effects.consume(code); - return continuationDeclarationInside; - } - - return continuation(code); - } - - function continuationDeclarationInside(code) { - if (code === 62) { - effects.consume(code); - return continuationClose; - } - - return continuation(code); - } - - function continuationClose(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('htmlFlowData'); - return done(code); - } - - effects.consume(code); - return continuationClose; - } - - function done(code) { - effects.exit('htmlFlow'); - return ok(code); - } - } - - function tokenizeNextBlank(effects, ok, nok) { - return start; - - function start(code) { - effects.exit('htmlFlowData'); - effects.enter('lineEndingBlank'); - effects.consume(code); - effects.exit('lineEndingBlank'); - return effects.attempt(partialBlankLine, ok, nok); - } - } - - module.exports = htmlFlow; - - /***/ - }, - - /***/ 7743: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var asciiAlphanumeric = __nccwpck_require__(598); - var markdownLineEnding = __nccwpck_require__(7506); - var markdownSpace = __nccwpck_require__(5989); - var factorySpace = __nccwpck_require__(8200); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - var asciiAlpha = __nccwpck_require__(3847); - - var htmlText = { - name: 'htmlText', - tokenize: tokenizeHtmlText, - }; - - function tokenizeHtmlText(effects, ok, nok) { - var self = this; - var marker; - var buffer; - var index; - var returnState; - return start; - - function start(code) { - effects.enter('htmlText'); - effects.enter('htmlTextData'); - effects.consume(code); - return open; - } - - function open(code) { - if (code === 33) { - effects.consume(code); - return declarationOpen; - } - - if (code === 47) { - effects.consume(code); - return tagCloseStart; - } - - if (code === 63) { - effects.consume(code); - return instruction; - } - - if (asciiAlpha(code)) { - effects.consume(code); - return tagOpen; - } - - return nok(code); - } - - function declarationOpen(code) { - if (code === 45) { - effects.consume(code); - return commentOpen; - } - - if (code === 91) { - effects.consume(code); - buffer = 'CDATA['; - index = 0; - return cdataOpen; - } - - if (asciiAlpha(code)) { - effects.consume(code); - return declaration; - } - - return nok(code); - } - - function commentOpen(code) { - if (code === 45) { - effects.consume(code); - return commentStart; - } - - return nok(code); - } - - function commentStart(code) { - if (code === null || code === 62) { - return nok(code); - } - - if (code === 45) { - effects.consume(code); - return commentStartDash; - } - - return comment(code); - } - - function commentStartDash(code) { - if (code === null || code === 62) { - return nok(code); - } - - return comment(code); - } - - function comment(code) { - if (code === null) { - return nok(code); - } - - if (code === 45) { - effects.consume(code); - return commentClose; - } - - if (markdownLineEnding(code)) { - returnState = comment; - return atLineEnding(code); - } - - effects.consume(code); - return comment; - } - - function commentClose(code) { - if (code === 45) { - effects.consume(code); - return end; - } - - return comment(code); - } - - function cdataOpen(code) { - if (code === buffer.charCodeAt(index++)) { - effects.consume(code); - return index === buffer.length ? cdata : cdataOpen; - } - - return nok(code); - } - - function cdata(code) { - if (code === null) { - return nok(code); - } - - if (code === 93) { - effects.consume(code); - return cdataClose; - } - - if (markdownLineEnding(code)) { - returnState = cdata; - return atLineEnding(code); - } - - effects.consume(code); - return cdata; - } - - function cdataClose(code) { - if (code === 93) { - effects.consume(code); - return cdataEnd; - } - - return cdata(code); - } - - function cdataEnd(code) { - if (code === 62) { - return end(code); - } - - if (code === 93) { - effects.consume(code); - return cdataEnd; - } - - return cdata(code); - } - - function declaration(code) { - if (code === null || code === 62) { - return end(code); - } - - if (markdownLineEnding(code)) { - returnState = declaration; - return atLineEnding(code); - } - - effects.consume(code); - return declaration; - } - - function instruction(code) { - if (code === null) { - return nok(code); - } - - if (code === 63) { - effects.consume(code); - return instructionClose; - } - - if (markdownLineEnding(code)) { - returnState = instruction; - return atLineEnding(code); - } - - effects.consume(code); - return instruction; - } - - function instructionClose(code) { - return code === 62 ? end(code) : instruction(code); - } - - function tagCloseStart(code) { - if (asciiAlpha(code)) { - effects.consume(code); - return tagClose; - } - - return nok(code); - } - - function tagClose(code) { - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code); - return tagClose; - } - - return tagCloseBetween(code); - } - - function tagCloseBetween(code) { - if (markdownLineEnding(code)) { - returnState = tagCloseBetween; - return atLineEnding(code); - } - - if (markdownSpace(code)) { - effects.consume(code); - return tagCloseBetween; - } - - return end(code); - } - - function tagOpen(code) { - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code); - return tagOpen; - } - - if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code); - } - - return nok(code); - } - - function tagOpenBetween(code) { - if (code === 47) { - effects.consume(code); - return end; - } - - if (code === 58 || code === 95 || asciiAlpha(code)) { - effects.consume(code); - return tagOpenAttributeName; - } - - if (markdownLineEnding(code)) { - returnState = tagOpenBetween; - return atLineEnding(code); - } - - if (markdownSpace(code)) { - effects.consume(code); - return tagOpenBetween; - } - - return end(code); - } - - function tagOpenAttributeName(code) { - if ( - code === 45 || - code === 46 || - code === 58 || - code === 95 || - asciiAlphanumeric(code) - ) { - effects.consume(code); - return tagOpenAttributeName; - } - - return tagOpenAttributeNameAfter(code); - } - - function tagOpenAttributeNameAfter(code) { - if (code === 61) { - effects.consume(code); - return tagOpenAttributeValueBefore; - } - - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeNameAfter; - return atLineEnding(code); - } - - if (markdownSpace(code)) { - effects.consume(code); - return tagOpenAttributeNameAfter; - } - - return tagOpenBetween(code); - } - - function tagOpenAttributeValueBefore(code) { - if ( - code === null || - code === 60 || - code === 61 || - code === 62 || - code === 96 - ) { - return nok(code); - } - - if (code === 34 || code === 39) { - effects.consume(code); - marker = code; - return tagOpenAttributeValueQuoted; - } - - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeValueBefore; - return atLineEnding(code); - } - - if (markdownSpace(code)) { - effects.consume(code); - return tagOpenAttributeValueBefore; - } - - effects.consume(code); - marker = undefined; - return tagOpenAttributeValueUnquoted; - } - - function tagOpenAttributeValueQuoted(code) { - if (code === marker) { - effects.consume(code); - return tagOpenAttributeValueQuotedAfter; - } - - if (code === null) { - return nok(code); - } - - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeValueQuoted; - return atLineEnding(code); - } - - effects.consume(code); - return tagOpenAttributeValueQuoted; - } - - function tagOpenAttributeValueQuotedAfter(code) { - if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code); - } - - return nok(code); - } - - function tagOpenAttributeValueUnquoted(code) { - if ( - code === null || - code === 34 || - code === 39 || - code === 60 || - code === 61 || - code === 96 - ) { - return nok(code); - } - - if (code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code); - } - - effects.consume(code); - return tagOpenAttributeValueUnquoted; - } // We can’t have blank lines in content, so no need to worry about empty - // tokens. - - function atLineEnding(code) { - effects.exit('htmlTextData'); - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace( - effects, - afterPrefix, - 'linePrefix', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ); - } - - function afterPrefix(code) { - effects.enter('htmlTextData'); - return returnState(code); - } - - function end(code) { - if (code === 62) { - effects.consume(code); - effects.exit('htmlTextData'); - effects.exit('htmlText'); - return ok; - } - - return nok(code); - } - } - - module.exports = htmlText; - - /***/ - }, - - /***/ 9797: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var chunkedSplice = __nccwpck_require__(778); - var chunkedPush = __nccwpck_require__(4455); - var normalizeIdentifier = __nccwpck_require__(712); - var shallow = __nccwpck_require__(1479); - var resolveAll = __nccwpck_require__(2004); - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - var factoryDestination = __nccwpck_require__(9851); - var factoryLabel = __nccwpck_require__(349); - var factoryWhitespace = __nccwpck_require__(3168); - var factoryTitle = __nccwpck_require__(9469); - - var labelEnd = { - name: 'labelEnd', - tokenize: tokenizeLabelEnd, - resolveTo: resolveToLabelEnd, - resolveAll: resolveAllLabelEnd, - }; - var resourceConstruct = { - tokenize: tokenizeResource, - }; - var fullReferenceConstruct = { - tokenize: tokenizeFullReference, - }; - var collapsedReferenceConstruct = { - tokenize: tokenizeCollapsedReference, - }; - - function resolveAllLabelEnd(events) { - var index = -1; - var token; - - while (++index < events.length) { - token = events[index][1]; - - if ( - !token._used && - (token.type === 'labelImage' || - token.type === 'labelLink' || - token.type === 'labelEnd') - ) { - // Remove the marker. - events.splice(index + 1, token.type === 'labelImage' ? 4 : 2); - token.type = 'data'; - index++; - } - } - - return events; - } - - function resolveToLabelEnd(events, context) { - var index = events.length; - var offset = 0; - var group; - var label; - var text; - var token; - var open; - var close; - var media; // Find an opening. - - while (index--) { - token = events[index][1]; - - if (open) { - // If we see another link, or inactive link label, we’ve been here before. - if ( - token.type === 'link' || - (token.type === 'labelLink' && token._inactive) + tailEvent[1].type = 'lineEnding' + lineIndex = tailIndex + } else if ( + tailEvent[1].type === 'linePrefix' || + tailEvent[1].type === 'blockQuotePrefix' || + tailEvent[1].type === 'blockQuotePrefixWhitespace' || + tailEvent[1].type === 'blockQuoteMarker' || + tailEvent[1].type === 'listItemIndent' ) { - break; - } // Mark other link openings as inactive, as we can’t have links in - // links. - - if (events[index][0] === 'enter' && token.type === 'labelLink') { - token._inactive = true; + // Empty + } else { + break } - } else if (close) { - if ( - events[index][0] === 'enter' && - (token.type === 'labelImage' || token.type === 'labelLink') && - !token._balanced - ) { - open = index; - - if (token.type !== 'labelLink') { - offset = 2; - break; - } - } - } else if (token.type === 'labelEnd') { - close = index; } - } - group = { - type: events[open][1].type === 'labelLink' ? 'link' : 'image', - start: shallow(events[open][1].start), - end: shallow(events[events.length - 1][1].end), - }; - label = { - type: 'label', - start: shallow(events[open][1].start), - end: shallow(events[close][1].end), - }; - text = { - type: 'labelText', - start: shallow(events[open + offset + 2][1].end), - end: shallow(events[close - 2][1].start), - }; - media = [ - ['enter', group, context], - ['enter', label, context], - ]; // Opening marker. + if ( + firstBlankLineIndex && + (!lineIndex || firstBlankLineIndex < lineIndex) + ) { + listItem._spread = true + } - media = chunkedPush(media, events.slice(open + 1, open + offset + 3)); // Text open. - - media = chunkedPush(media, [['enter', text, context]]); // Between. - - media = chunkedPush( - media, - resolveAll( - context.parser.constructs.insideSpan.null, - events.slice(open + offset + 4, close - 3), - context + // Fix position. + listItem.end = point( + lineIndex ? events[lineIndex][1].start : event[1].end ) - ); // Text close, marker close, label close. - media = chunkedPush(media, [ - ['exit', text, context], - events[close - 2], - events[close - 1], - ['exit', label, context], - ]); // Reference, resource, or so. - - media = chunkedPush(media, events.slice(close + 1)); // Media close. - - media = chunkedPush(media, [['exit', group, context]]); - chunkedSplice(events, open, events.length, media); - return events; - } - - function tokenizeLabelEnd(effects, ok, nok) { - var self = this; - var index = self.events.length; - var labelStart; - var defined; // Find an opening. - - while (index--) { - if ( - (self.events[index][1].type === 'labelImage' || - self.events[index][1].type === 'labelLink') && - !self.events[index][1]._balanced - ) { - labelStart = self.events[index][1]; - break; - } + events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]) + index++ + length++ } - return start; - - function start(code) { - if (!labelStart) { - return nok(code); - } // It’s a balanced bracket, but contains a link. - - if (labelStart._inactive) return balanced(code); - defined = - self.parser.defined.indexOf( - normalizeIdentifier( - self.sliceSerialize({ - start: labelStart.end, - end: self.now(), - }) - ) - ) > -1; - effects.enter('labelEnd'); - effects.enter('labelMarker'); - effects.consume(code); - effects.exit('labelMarker'); - effects.exit('labelEnd'); - return afterLabelEnd; - } - - function afterLabelEnd(code) { - // Resource: `[asd](fgh)`. - if (code === 40) { - return effects.attempt( - resourceConstruct, - ok, - defined ? ok : balanced - )(code); - } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? - - if (code === 91) { - return effects.attempt( - fullReferenceConstruct, - ok, - defined - ? effects.attempt(collapsedReferenceConstruct, ok, balanced) - : balanced - )(code); - } // Shortcut reference: `[asd]`? - - return defined ? ok(code) : balanced(code); - } - - function balanced(code) { - labelStart._balanced = true; - return nok(code); - } - } - - function tokenizeResource(effects, ok, nok) { - return start; - - function start(code) { - effects.enter('resource'); - effects.enter('resourceMarker'); - effects.consume(code); - effects.exit('resourceMarker'); - return factoryWhitespace(effects, open); - } - - function open(code) { - if (code === 41) { - return end(code); + // Create a new list item. + if (event[1].type === 'listItemPrefix') { + listItem = { + type: 'listItem', + _spread: false, + start: point(event[1].start) } - return factoryDestination( - effects, - destinationAfter, - nok, - 'resourceDestination', - 'resourceDestinationLiteral', - 'resourceDestinationLiteralMarker', - 'resourceDestinationRaw', - 'resourceDestinationString', - 3 - )(code); - } - - function destinationAfter(code) { - return markdownLineEndingOrSpace(code) - ? factoryWhitespace(effects, between)(code) - : end(code); - } - - function between(code) { - if (code === 34 || code === 39 || code === 40) { - return factoryTitle( - effects, - factoryWhitespace(effects, end), - nok, - 'resourceTitle', - 'resourceTitleMarker', - 'resourceTitleString' - )(code); - } - - return end(code); - } - - function end(code) { - if (code === 41) { - effects.enter('resourceMarker'); - effects.consume(code); - effects.exit('resourceMarker'); - effects.exit('resource'); - return ok; - } - - return nok(code); + events.splice(index, 0, ['enter', listItem, event[2]]) + index++ + length++ + firstBlankLineIndex = undefined + atMarker = true } } + } - function tokenizeFullReference(effects, ok, nok) { - var self = this; - return start; + events[start][1]._spread = listSpread + return length + } - function start(code) { - return factoryLabel.call( - self, - effects, - afterLabel, - nok, - 'reference', - 'referenceMarker', - 'referenceString' - )(code); - } + function setData(key, value) { + data[key] = value + } - function afterLabel(code) { - return self.parser.defined.indexOf( - normalizeIdentifier( - self - .sliceSerialize(self.events[self.events.length - 1][1]) - .slice(1, -1) - ) - ) < 0 - ? nok(code) - : ok(code); - } + function getData(key) { + return data[key] + } + + function point(d) { + return {line: d.line, column: d.column, offset: d.offset} + } + + function opener(create, and) { + return open + + function open(token) { + enter.call(this, create(token), token) + if (and) and.call(this, token) + } + } + + function buffer() { + this.stack.push({type: 'fragment', children: []}) + } + + function enter(node, token) { + this.stack[this.stack.length - 1].children.push(node) + this.stack.push(node) + this.tokenStack.push(token) + node.position = {start: point(token.start)} + return node + } + + function closer(and) { + return close + + function close(token) { + if (and) and.call(this, token) + exit.call(this, token) + } + } + + function exit(token) { + var node = this.stack.pop() + var open = this.tokenStack.pop() + + if (!open) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + stringifyPosition({start: token.start, end: token.end}) + + '): it’s not open' + ) + } else if (open.type !== token.type) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + stringifyPosition({start: token.start, end: token.end}) + + '): a different token (`' + + open.type + + '`, ' + + stringifyPosition({start: open.start, end: open.end}) + + ') is open' + ) + } + + node.position.end = point(token.end) + return node + } + + function resume() { + return toString(this.stack.pop()) + } + + // + // Handlers. + // + + function onenterlistordered() { + setData('expectingFirstListItemValue', true) + } + + function onenterlistitemvalue(token) { + if (getData('expectingFirstListItemValue')) { + this.stack[this.stack.length - 2].start = parseInt( + this.sliceSerialize(token), + 10 + ) + + setData('expectingFirstListItemValue') + } + } + + function onexitcodefencedfenceinfo() { + var data = this.resume() + this.stack[this.stack.length - 1].lang = data + } + + function onexitcodefencedfencemeta() { + var data = this.resume() + this.stack[this.stack.length - 1].meta = data + } + + function onexitcodefencedfence() { + // Exit if this is the closing fence. + if (getData('flowCodeInside')) return + this.buffer() + setData('flowCodeInside', true) + } + + function onexitcodefenced() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data.replace( + /^(\r?\n|\r)|(\r?\n|\r)$/g, + '' + ) + + setData('flowCodeInside') + } + + function onexitcodeindented() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + var label = this.resume() + this.stack[this.stack.length - 1].label = label + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + } + + function onexitdefinitiontitlestring() { + var data = this.resume() + this.stack[this.stack.length - 1].title = data + } + + function onexitdefinitiondestinationstring() { + var data = this.resume() + this.stack[this.stack.length - 1].url = data + } + + function onexitatxheadingsequence(token) { + if (!this.stack[this.stack.length - 1].depth) { + this.stack[this.stack.length - 1].depth = this.sliceSerialize( + token + ).length + } + } + + function onexitsetextheadingtext() { + setData('setextHeadingSlurpLineEnding', true) + } + + function onexitsetextheadinglinesequence(token) { + this.stack[this.stack.length - 1].depth = + this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2 + } + + function onexitsetextheading() { + setData('setextHeadingSlurpLineEnding') + } + + function onenterdata(token) { + var siblings = this.stack[this.stack.length - 1].children + var tail = siblings[siblings.length - 1] + + if (!tail || tail.type !== 'text') { + // Add a new text node. + tail = text() + tail.position = {start: point(token.start)} + this.stack[this.stack.length - 1].children.push(tail) + } + + this.stack.push(tail) + } + + function onexitdata(token) { + var tail = this.stack.pop() + tail.value += this.sliceSerialize(token) + tail.position.end = point(token.end) + } + + function onexitlineending(token) { + var context = this.stack[this.stack.length - 1] + + // If we’re at a hard break, include the line ending in there. + if (getData('atHardBreak')) { + context.children[context.children.length - 1].position.end = point( + token.end + ) + + setData('atHardBreak') + return + } + + if ( + !getData('setextHeadingSlurpLineEnding') && + config.canContainEols.indexOf(context.type) > -1 + ) { + onenterdata.call(this, token) + onexitdata.call(this, token) + } + } + + function onexithardbreak() { + setData('atHardBreak', true) + } + + function onexithtmlflow() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexithtmltext() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitcodetext() { + var data = this.resume() + this.stack[this.stack.length - 1].value = data + } + + function onexitlink() { + var context = this.stack[this.stack.length - 1] + + // To do: clean. + if (getData('inReference')) { + context.type += 'Reference' + context.referenceType = getData('referenceType') || 'shortcut' + delete context.url + delete context.title + } else { + delete context.identifier + delete context.label + delete context.referenceType + } + + setData('referenceType') + } + + function onexitimage() { + var context = this.stack[this.stack.length - 1] + + // To do: clean. + if (getData('inReference')) { + context.type += 'Reference' + context.referenceType = getData('referenceType') || 'shortcut' + delete context.url + delete context.title + } else { + delete context.identifier + delete context.label + delete context.referenceType + } + + setData('referenceType') + } + + function onexitlabeltext(token) { + this.stack[this.stack.length - 2].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + } + + function onexitlabel() { + var fragment = this.stack[this.stack.length - 1] + var value = this.resume() + + this.stack[this.stack.length - 1].label = value + + // Assume a reference. + setData('inReference', true) + + if (this.stack[this.stack.length - 1].type === 'link') { + this.stack[this.stack.length - 1].children = fragment.children + } else { + this.stack[this.stack.length - 1].alt = value + } + } + + function onexitresourcedestinationstring() { + var data = this.resume() + this.stack[this.stack.length - 1].url = data + } + + function onexitresourcetitlestring() { + var data = this.resume() + this.stack[this.stack.length - 1].title = data + } + + function onexitresource() { + setData('inReference') + } + + function onenterreference() { + setData('referenceType', 'collapsed') + } + + function onexitreferencestring(token) { + var label = this.resume() + this.stack[this.stack.length - 1].label = label + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase() + setData('referenceType', 'full') + } + + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + function onexitcharacterreferencevalue(token) { + var data = this.sliceSerialize(token) + var type = getData('characterReferenceType') + var value + var tail + + if (type) { + value = safeFromInt( + data, + type === 'characterReferenceMarkerNumeric' ? 10 : 16 + ) + + setData('characterReferenceType') + } else { + value = decode(data) + } + + tail = this.stack.pop() + tail.value += value + tail.position.end = point(token.end) + } + + function onexitautolinkprotocol(token) { + onexitdata.call(this, token) + this.stack[this.stack.length - 1].url = this.sliceSerialize(token) + } + + function onexitautolinkemail(token) { + onexitdata.call(this, token) + this.stack[this.stack.length - 1].url = + 'mailto:' + this.sliceSerialize(token) + } + + // + // Creaters. + // + + function blockQuote() { + return {type: 'blockquote', children: []} + } + + function codeFlow() { + return {type: 'code', lang: null, meta: null, value: ''} + } + + function codeText() { + return {type: 'inlineCode', value: ''} + } + + function definition() { + return { + type: 'definition', + identifier: '', + label: null, + title: null, + url: '' + } + } + + function emphasis() { + return {type: 'emphasis', children: []} + } + + function heading() { + return {type: 'heading', depth: undefined, children: []} + } + + function hardBreak() { + return {type: 'break'} + } + + function html() { + return {type: 'html', value: ''} + } + + function image() { + return {type: 'image', title: null, url: '', alt: null} + } + + function link() { + return {type: 'link', title: null, url: '', children: []} + } + + function list(token) { + return { + type: 'list', + ordered: token.type === 'listOrdered', + start: null, + spread: token._spread, + children: [] + } + } + + function listItem(token) { + return { + type: 'listItem', + spread: token._spread, + checked: null, + children: [] + } + } + + function paragraph() { + return {type: 'paragraph', children: []} + } + + function strong() { + return {type: 'strong', children: []} + } + + function text() { + return {type: 'text', value: ''} + } + + function thematicBreak() { + return {type: 'thematicBreak'} + } +} + +function configure(config, extensions) { + var index = -1 + + while (++index < extensions.length) { + extension(config, extensions[index]) + } + + return config +} + +function extension(config, extension) { + var key + var left + + for (key in extension) { + left = own.call(config, key) ? config[key] : (config[key] = {}) + + if (key === 'canContainEols') { + config[key] = [].concat(left, extension[key]) + } else { + Object.assign(left, extension[key]) + } + } +} + + +/***/ }), + +/***/ 3068: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = __nccwpck_require__(6869) + + +/***/ }), + +/***/ 219: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = __nccwpck_require__(3683) + + +/***/ }), + +/***/ 9363: +/***/ ((module) => { + +module.exports = configure + +function configure(base, extension) { + var index = -1 + var key + + // First do subextensions. + if (extension.extensions) { + while (++index < extension.extensions.length) { + configure(base, extension.extensions[index]) + } + } + + for (key in extension) { + if (key === 'extensions') { + // Empty. + } else if (key === 'unsafe' || key === 'join') { + base[key] = base[key].concat(extension[key] || []) + } else if (key === 'handlers') { + base[key] = Object.assign(base[key], extension[key] || {}) + } else { + base.options[key] = extension[key] + } + } + + return base +} + + +/***/ }), + +/***/ 3920: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = blockquote + +var flow = __nccwpck_require__(7530) +var indentLines = __nccwpck_require__(6887) + +function blockquote(node, _, context) { + var exit = context.enter('blockquote') + var value = indentLines(flow(node, context), map) + exit() + return value +} + +function map(line, index, blank) { + return '>' + (blank ? '' : ' ') + line +} + + +/***/ }), + +/***/ 229: +/***/ ((module) => { + +module.exports = hardBreak + +function hardBreak() { + return '\\\n' +} + + +/***/ }), + +/***/ 5268: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = code + +var repeat = __nccwpck_require__(6976) +var streak = __nccwpck_require__(4232) +var formatCodeAsIndented = __nccwpck_require__(8446) +var checkFence = __nccwpck_require__(158) +var indentLines = __nccwpck_require__(6887) +var safe = __nccwpck_require__(3906) + +function code(node, _, context) { + var marker = checkFence(context) + var raw = node.value || '' + var suffix = marker === '`' ? 'GraveAccent' : 'Tilde' + var value + var sequence + var exit + var subexit + + if (formatCodeAsIndented(node, context)) { + exit = context.enter('codeIndented') + value = indentLines(raw, map) + } else { + sequence = repeat(marker, Math.max(streak(raw, marker) + 1, 3)) + exit = context.enter('codeFenced') + value = sequence + + if (node.lang) { + subexit = context.enter('codeFencedLang' + suffix) + value += safe(context, node.lang, { + before: '`', + after: ' ', + encode: ['`'] + }) + subexit() + } + + if (node.lang && node.meta) { + subexit = context.enter('codeFencedMeta' + suffix) + value += + ' ' + + safe(context, node.meta, { + before: ' ', + after: '\n', + encode: ['`'] + }) + subexit() + } + + value += '\n' + + if (raw) { + value += raw + '\n' + } + + value += sequence + } + + exit() + return value +} + +function map(line, _, blank) { + return (blank ? '' : ' ') + line +} + + +/***/ }), + +/***/ 7385: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = definition + +var association = __nccwpck_require__(9211) +var checkQuote = __nccwpck_require__(3366) +var safe = __nccwpck_require__(3906) + +function definition(node, _, context) { + var marker = checkQuote(context) + var suffix = marker === '"' ? 'Quote' : 'Apostrophe' + var exit = context.enter('definition') + var subexit = context.enter('label') + var value = + '[' + safe(context, association(node), {before: '[', after: ']'}) + ']: ' + + subexit() + + if ( + // If there’s no url, or… + !node.url || + // If there’s whitespace, enclosed is prettier. + /[ \t\r\n]/.test(node.url) + ) { + subexit = context.enter('destinationLiteral') + value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>' + } else { + // No whitespace, raw is prettier. + subexit = context.enter('destinationRaw') + value += safe(context, node.url, {before: ' ', after: ' '}) + } + + subexit() + + if (node.title) { + subexit = context.enter('title' + suffix) + value += + ' ' + + marker + + safe(context, node.title, {before: marker, after: marker}) + + marker + subexit() + } + + exit() + + return value +} + + +/***/ }), + +/***/ 8909: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = emphasis +emphasis.peek = emphasisPeek + +var checkEmphasis = __nccwpck_require__(6452) +var phrasing = __nccwpck_require__(7489) + +// To do: there are cases where emphasis cannot “form” depending on the +// previous or next character of sequences. +// There’s no way around that though, except for injecting zero-width stuff. +// Do we need to safeguard against that? +function emphasis(node, _, context) { + var marker = checkEmphasis(context) + var exit = context.enter('emphasis') + var value = phrasing(node, context, {before: marker, after: marker}) + exit() + return marker + value + marker +} + +function emphasisPeek(node, _, context) { + return context.options.emphasis || '*' +} + + +/***/ }), + +/***/ 2568: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = heading + +var repeat = __nccwpck_require__(6976) +var formatHeadingAsSetext = __nccwpck_require__(4954) +var phrasing = __nccwpck_require__(7489) + +function heading(node, _, context) { + var rank = Math.max(Math.min(6, node.depth || 1), 1) + var exit + var subexit + var value + var sequence + + if (formatHeadingAsSetext(node, context)) { + exit = context.enter('headingSetext') + subexit = context.enter('phrasing') + value = phrasing(node, context, {before: '\n', after: '\n'}) + subexit() + exit() + + return ( + value + + '\n' + + repeat( + rank === 1 ? '=' : '-', + // The whole size… + value.length - + // Minus the position of the character after the last EOL (or + // 0 if there is none)… + (Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1) + ) + ) + } + + sequence = repeat('#', rank) + exit = context.enter('headingAtx') + subexit = context.enter('phrasing') + value = phrasing(node, context, {before: '# ', after: '\n'}) + value = value ? sequence + ' ' + value : sequence + if (context.options.closeAtx) { + value += ' ' + sequence + } + + subexit() + exit() + + return value +} + + +/***/ }), + +/***/ 5538: +/***/ ((module) => { + +module.exports = html + +function html(node) { + return node.value || '' +} + + +/***/ }), + +/***/ 3885: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = imageReference +imageReference.peek = imageReferencePeek + +var association = __nccwpck_require__(9211) +var safe = __nccwpck_require__(3906) + +function imageReference(node, _, context) { + var type = node.referenceType + var exit = context.enter('imageReference') + var subexit = context.enter('label') + var alt = safe(context, node.alt, {before: '[', after: ']'}) + var value = '![' + alt + ']' + var reference + var stack + + subexit() + // Hide the fact that we’re in phrasing, because escapes don’t work. + stack = context.stack + context.stack = [] + subexit = context.enter('reference') + reference = safe(context, association(node), {before: '[', after: ']'}) + subexit() + context.stack = stack + exit() + + if (type === 'full' || !alt || alt !== reference) { + value += '[' + reference + ']' + } else if (type !== 'shortcut') { + value += '[]' + } + + return value +} + +function imageReferencePeek() { + return '!' +} + + +/***/ }), + +/***/ 1591: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = image +image.peek = imagePeek + +var checkQuote = __nccwpck_require__(3366) +var safe = __nccwpck_require__(3906) + +function image(node, _, context) { + var quote = checkQuote(context) + var suffix = quote === '"' ? 'Quote' : 'Apostrophe' + var exit = context.enter('image') + var subexit = context.enter('label') + var value = '![' + safe(context, node.alt, {before: '[', after: ']'}) + '](' + + subexit() + + if ( + // If there’s no url but there is a title… + (!node.url && node.title) || + // Or if there’s markdown whitespace or an eol, enclose. + /[ \t\r\n]/.test(node.url) + ) { + subexit = context.enter('destinationLiteral') + value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>' + } else { + // No whitespace, raw is prettier. + subexit = context.enter('destinationRaw') + value += safe(context, node.url, { + before: '(', + after: node.title ? ' ' : ')' + }) + } + + subexit() + + if (node.title) { + subexit = context.enter('title' + suffix) + value += + ' ' + + quote + + safe(context, node.title, {before: quote, after: quote}) + + quote + subexit() + } + + value += ')' + exit() + + return value +} + +function imagePeek() { + return '!' +} + + +/***/ }), + +/***/ 3769: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +exports.blockquote = __nccwpck_require__(3920) +exports.break = __nccwpck_require__(229) +exports.code = __nccwpck_require__(5268) +exports.definition = __nccwpck_require__(7385) +exports.emphasis = __nccwpck_require__(8909) +exports.hardBreak = __nccwpck_require__(229) +exports.heading = __nccwpck_require__(2568) +exports.html = __nccwpck_require__(5538) +exports.image = __nccwpck_require__(1591) +exports.imageReference = __nccwpck_require__(3885) +exports.inlineCode = __nccwpck_require__(5645) +exports.link = __nccwpck_require__(7938) +exports.linkReference = __nccwpck_require__(9556) +exports.list = __nccwpck_require__(9323) +exports.listItem = __nccwpck_require__(7016) +exports.paragraph = __nccwpck_require__(5197) +exports.root = __nccwpck_require__(54) +exports.strong = __nccwpck_require__(2150) +exports.text = __nccwpck_require__(2124) +exports.thematicBreak = __nccwpck_require__(3960) + + +/***/ }), + +/***/ 5645: +/***/ ((module) => { + +module.exports = inlineCode +inlineCode.peek = inlineCodePeek + +function inlineCode(node) { + var value = node.value || '' + var sequence = '`' + var pad = '' + + // If there is a single grave accent on its own in the code, use a fence of + // two. + // If there are two in a row, use one. + while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) { + sequence += '`' + } + + // If this is not just spaces or eols (tabs don’t count), and either the + // first or last character are a space, eol, or tick, then pad with spaces. + if ( + /[^ \r\n]/.test(value) && + (/[ \r\n`]/.test(value.charAt(0)) || + /[ \r\n`]/.test(value.charAt(value.length - 1))) + ) { + pad = ' ' + } + + return sequence + pad + value + pad + sequence +} + +function inlineCodePeek() { + return '`' +} + + +/***/ }), + +/***/ 9556: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = linkReference +linkReference.peek = linkReferencePeek + +var association = __nccwpck_require__(9211) +var phrasing = __nccwpck_require__(7489) +var safe = __nccwpck_require__(3906) + +function linkReference(node, _, context) { + var type = node.referenceType + var exit = context.enter('linkReference') + var subexit = context.enter('label') + var text = phrasing(node, context, {before: '[', after: ']'}) + var value = '[' + text + ']' + var reference + var stack + + subexit() + // Hide the fact that we’re in phrasing, because escapes don’t work. + stack = context.stack + context.stack = [] + subexit = context.enter('reference') + reference = safe(context, association(node), {before: '[', after: ']'}) + subexit() + context.stack = stack + exit() + + if (type === 'full' || !text || text !== reference) { + value += '[' + reference + ']' + } else if (type !== 'shortcut') { + value += '[]' + } + + return value +} + +function linkReferencePeek() { + return '[' +} + + +/***/ }), + +/***/ 7938: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = link +link.peek = linkPeek + +var checkQuote = __nccwpck_require__(3366) +var formatLinkAsAutolink = __nccwpck_require__(5358) +var phrasing = __nccwpck_require__(7489) +var safe = __nccwpck_require__(3906) + +function link(node, _, context) { + var quote = checkQuote(context) + var suffix = quote === '"' ? 'Quote' : 'Apostrophe' + var exit + var subexit + var value + var stack + + if (formatLinkAsAutolink(node, context)) { + // Hide the fact that we’re in phrasing, because escapes don’t work. + stack = context.stack + context.stack = [] + exit = context.enter('autolink') + value = '<' + phrasing(node, context, {before: '<', after: '>'}) + '>' + exit() + context.stack = stack + return value + } + + exit = context.enter('link') + subexit = context.enter('label') + value = '[' + phrasing(node, context, {before: '[', after: ']'}) + '](' + subexit() + + if ( + // If there’s no url but there is a title… + (!node.url && node.title) || + // Or if there’s markdown whitespace or an eol, enclose. + /[ \t\r\n]/.test(node.url) + ) { + subexit = context.enter('destinationLiteral') + value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>' + } else { + // No whitespace, raw is prettier. + subexit = context.enter('destinationRaw') + value += safe(context, node.url, { + before: '(', + after: node.title ? ' ' : ')' + }) + } + + subexit() + + if (node.title) { + subexit = context.enter('title' + suffix) + value += + ' ' + + quote + + safe(context, node.title, {before: quote, after: quote}) + + quote + subexit() + } + + value += ')' + + exit() + return value +} + +function linkPeek(node, _, context) { + return formatLinkAsAutolink(node, context) ? '<' : '[' +} + + +/***/ }), + +/***/ 7016: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = listItem + +var repeat = __nccwpck_require__(6976) +var checkBullet = __nccwpck_require__(8599) +var checkListItemIndent = __nccwpck_require__(9009) +var flow = __nccwpck_require__(7530) +var indentLines = __nccwpck_require__(6887) + +function listItem(node, parent, context) { + var bullet = checkBullet(context) + var listItemIndent = checkListItemIndent(context) + var size + var value + var exit + + if (parent && parent.ordered) { + bullet = + (parent.start > -1 ? parent.start : 1) + + (context.options.incrementListMarker === false + ? 0 + : parent.children.indexOf(node)) + + '.' + } + + size = bullet.length + 1 + + if ( + listItemIndent === 'tab' || + (listItemIndent === 'mixed' && ((parent && parent.spread) || node.spread)) + ) { + size = Math.ceil(size / 4) * 4 + } + + exit = context.enter('listItem') + value = indentLines(flow(node, context), map) + exit() + + return value + + function map(line, index, blank) { + if (index) { + return (blank ? '' : repeat(' ', size)) + line + } + + return (blank ? bullet : bullet + repeat(' ', size - bullet.length)) + line + } +} + + +/***/ }), + +/***/ 9323: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = list + +var flow = __nccwpck_require__(7530) + +function list(node, _, context) { + var exit = context.enter('list') + var value = flow(node, context) + exit() + return value +} + + +/***/ }), + +/***/ 5197: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = paragraph + +var phrasing = __nccwpck_require__(7489) + +function paragraph(node, _, context) { + var exit = context.enter('paragraph') + var subexit = context.enter('phrasing') + var value = phrasing(node, context, {before: '\n', after: '\n'}) + subexit() + exit() + return value +} + + +/***/ }), + +/***/ 54: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = root + +var flow = __nccwpck_require__(7530) + +function root(node, _, context) { + return flow(node, context) +} + + +/***/ }), + +/***/ 2150: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = strong +strong.peek = strongPeek + +var checkStrong = __nccwpck_require__(3534) +var phrasing = __nccwpck_require__(7489) + +// To do: there are cases where emphasis cannot “form” depending on the +// previous or next character of sequences. +// There’s no way around that though, except for injecting zero-width stuff. +// Do we need to safeguard against that? +function strong(node, _, context) { + var marker = checkStrong(context) + var exit = context.enter('strong') + var value = phrasing(node, context, {before: marker, after: marker}) + exit() + return marker + marker + value + marker + marker +} + +function strongPeek(node, _, context) { + return context.options.strong || '*' +} + + +/***/ }), + +/***/ 2124: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = text + +var safe = __nccwpck_require__(3906) + +function text(node, parent, context, safeOptions) { + return safe(context, node.value, safeOptions) +} + + +/***/ }), + +/***/ 3960: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = thematicBreak + +var repeat = __nccwpck_require__(6976) +var checkRepeat = __nccwpck_require__(3680) +var checkRule = __nccwpck_require__(7253) + +function thematicBreak(node, parent, context) { + var value = repeat( + checkRule(context) + (context.options.ruleSpaces ? ' ' : ''), + checkRepeat(context) + ) + + return context.options.ruleSpaces ? value.slice(0, -1) : value +} + + +/***/ }), + +/***/ 3683: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = toMarkdown + +var zwitch = __nccwpck_require__(1067) +var configure = __nccwpck_require__(9363) +var defaultHandlers = __nccwpck_require__(3769) +var defaultJoin = __nccwpck_require__(3701) +var defaultUnsafe = __nccwpck_require__(6566) + +function toMarkdown(tree, options) { + var settings = options || {} + var context = { + enter: enter, + stack: [], + unsafe: [], + join: [], + handlers: {}, + options: {} + } + var result + + configure(context, { + unsafe: defaultUnsafe, + join: defaultJoin, + handlers: defaultHandlers + }) + configure(context, settings) + + if (context.options.tightDefinitions) { + context.join = [joinDefinition].concat(context.join) + } + + context.handle = zwitch('type', { + invalid: invalid, + unknown: unknown, + handlers: context.handlers + }) + + result = context.handle(tree, null, context, {before: '\n', after: '\n'}) + + if ( + result && + result.charCodeAt(result.length - 1) !== 10 && + result.charCodeAt(result.length - 1) !== 13 + ) { + result += '\n' + } + + return result + + function enter(name) { + context.stack.push(name) + return exit + + function exit() { + context.stack.pop() + } + } +} + +function invalid(value) { + throw new Error('Cannot handle value `' + value + '`, expected node') +} + +function unknown(node) { + throw new Error('Cannot handle unknown node `' + node.type + '`') +} + +function joinDefinition(left, right) { + // No blank line between adjacent definitions. + if (left.type === 'definition' && left.type === right.type) { + return 0 + } +} + + +/***/ }), + +/***/ 3701: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = [joinDefaults] + +var formatCodeAsIndented = __nccwpck_require__(8446) +var formatHeadingAsSetext = __nccwpck_require__(4954) + +function joinDefaults(left, right, parent, context) { + if ( + // Two lists with the same marker. + (right.type === 'list' && + right.type === left.type && + Boolean(left.ordered) === Boolean(right.ordered)) || + // Indented code after list or another indented code. + (right.type === 'code' && + formatCodeAsIndented(right, context) && + (left.type === 'list' || + (left.type === right.type && formatCodeAsIndented(left, context)))) + ) { + return false + } + + // Join children of a list or an item. + // In which case, `parent` has a `spread` field. + if (typeof parent.spread === 'boolean') { + if ( + left.type === 'paragraph' && + // Two paragraphs. + (left.type === right.type || + right.type === 'definition' || + // Paragraph followed by a setext heading. + (right.type === 'heading' && formatHeadingAsSetext(right, context))) + ) { + return + } + + return parent.spread ? 1 : 0 + } +} + + +/***/ }), + +/***/ 6566: +/***/ ((module) => { + +module.exports = [ + { + character: '\t', + inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'] + }, + { + character: '\r', + inConstruct: [ + 'codeFencedLangGraveAccent', + 'codeFencedLangTilde', + 'codeFencedMetaGraveAccent', + 'codeFencedMetaTilde', + 'destinationLiteral', + 'headingAtx' + ] + }, + { + character: '\n', + inConstruct: [ + 'codeFencedLangGraveAccent', + 'codeFencedLangTilde', + 'codeFencedMetaGraveAccent', + 'codeFencedMetaTilde', + 'destinationLiteral', + 'headingAtx' + ] + }, + { + character: ' ', + inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'] + }, + // An exclamation mark can start an image, if it is followed by a link or + // a link reference. + {character: '!', after: '\\[', inConstruct: 'phrasing'}, + // A quote can break out of a title. + {character: '"', inConstruct: 'titleQuote'}, + // A number sign could start an ATX heading if it starts a line. + {atBreak: true, character: '#'}, + // Dollar sign and percentage are not used in markdown. + // An ampersand could start a character reference. + {character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'}, + // An apostrophe can break out of a title. + {character: "'", inConstruct: 'titleApostrophe'}, + // A left paren could break out of a destination raw. + {character: '(', inConstruct: 'destinationRaw'}, + {before: '\\]', character: '(', inConstruct: 'phrasing'}, + // A right paren could start a list item or break out of a destination + // raw. + {atBreak: true, before: '\\d+', character: ')'}, + {character: ')', inConstruct: 'destinationRaw'}, + // An asterisk can start thematic breaks, list items, emphasis, strong. + {atBreak: true, character: '*'}, + {character: '*', inConstruct: 'phrasing'}, + // A plus sign could start a list item. + {atBreak: true, character: '+'}, + // A dash can start thematic breaks, list items, and setext heading + // underlines. + {atBreak: true, character: '-'}, + // A dot could start a list item. + {atBreak: true, before: '\\d+', character: '.', after: '(?:[ \t\r\n]|$)'}, + // Slash, colon, and semicolon are not used in markdown for constructs. + // A less than can start html (flow or text) or an autolink. + // HTML could start with an exclamation mark (declaration, cdata, comment), + // slash (closing tag), question mark (instruction), or a letter (tag). + // An autolink also starts with a letter. + // Finally, it could break out of a destination literal. + {atBreak: true, character: '<', after: '[!/?A-Za-z]'}, + {character: '<', after: '[!/?A-Za-z]', inConstruct: 'phrasing'}, + {character: '<', inConstruct: 'destinationLiteral'}, + // An equals to can start setext heading underlines. + {atBreak: true, character: '='}, + // A greater than can start block quotes and it can break out of a + // destination literal. + {atBreak: true, character: '>'}, + {character: '>', inConstruct: 'destinationLiteral'}, + // Question mark and at sign are not used in markdown for constructs. + // A left bracket can start definitions, references, labels, + {atBreak: true, character: '['}, + { + character: '[', + inConstruct: ['phrasing', 'label', 'reference'] + }, + // A backslash can start an escape (when followed by punctuation) or a + // hard break (when followed by an eol). + {character: '\\', after: '[!-/:-@[-`{-~]'}, + {character: '\\', after: '[\\r\\n]', inConstruct: 'phrasing'}, + // A right bracket can exit labels. + { + character: ']', + inConstruct: ['label', 'reference'] + }, + // Caret is not used in markdown for constructs. + // An underscore can start emphasis, strong, or a thematic break. + {atBreak: true, character: '_'}, + {before: '[^A-Za-z]', character: '_', inConstruct: 'phrasing'}, + {character: '_', after: '[^A-Za-z]', inConstruct: 'phrasing'}, + // A grave accent can start code (fenced or text), or it can break out of + // a grave accent code fence. + {atBreak: true, character: '`'}, + { + character: '`', + inConstruct: [ + 'codeFencedLangGraveAccent', + 'codeFencedMetaGraveAccent', + 'phrasing' + ] + }, + // Left brace, vertical bar, right brace are not used in markdown for + // constructs. + // A tilde can start code (fenced). + {atBreak: true, character: '~'} +] + + +/***/ }), + +/***/ 9211: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = association + +var decode = __nccwpck_require__(3485) + +var characterEscape = /\\([!-/:-@[-`{-~])/g +var characterReference = /&(#(\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi + +// The `label` of an association is the string value: character escapes and +// references work, and casing is intact. +// The `identifier` is used to match one association to another: controversially, +// character escapes and references don’t work in this matching: `©` does +// not match `©`, and `\+` does not match `+`. +// But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb` +// matches `a b`. +// So, we do prefer the label when figuring out how we’re going to serialize: +// it has whitespace, casing, and we can ignore most useless character escapes +// and all character references. +function association(node) { + if (node.label || !node.identifier) { + return node.label || '' + } + + return node.identifier + .replace(characterEscape, '$1') + .replace(characterReference, decodeIfPossible) +} + +function decodeIfPossible($0, $1) { + return decode($1) || $0 +} + + +/***/ }), + +/***/ 8599: +/***/ ((module) => { + +module.exports = checkBullet + +function checkBullet(context) { + var marker = context.options.bullet || '*' + + if (marker !== '*' && marker !== '+' && marker !== '-') { + throw new Error( + 'Cannot serialize items with `' + + marker + + '` for `options.bullet`, expected `*`, `+`, or `-`' + ) + } + + return marker +} + + +/***/ }), + +/***/ 6452: +/***/ ((module) => { + +module.exports = checkEmphasis + +function checkEmphasis(context) { + var marker = context.options.emphasis || '*' + + if (marker !== '*' && marker !== '_') { + throw new Error( + 'Cannot serialize emphasis with `' + + marker + + '` for `options.emphasis`, expected `*`, or `_`' + ) + } + + return marker +} + + +/***/ }), + +/***/ 158: +/***/ ((module) => { + +module.exports = checkFence + +function checkFence(context) { + var marker = context.options.fence || '`' + + if (marker !== '`' && marker !== '~') { + throw new Error( + 'Cannot serialize code with `' + + marker + + '` for `options.fence`, expected `` ` `` or `~`' + ) + } + + return marker +} + + +/***/ }), + +/***/ 9009: +/***/ ((module) => { + +module.exports = checkListItemIndent + +function checkListItemIndent(context) { + var style = context.options.listItemIndent || 'tab' + + if (style === 1 || style === '1') { + return 'one' + } + + if (style !== 'tab' && style !== 'one' && style !== 'mixed') { + throw new Error( + 'Cannot serialize items with `' + + style + + '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`' + ) + } + + return style +} + + +/***/ }), + +/***/ 3366: +/***/ ((module) => { + +module.exports = checkQuote + +function checkQuote(context) { + var marker = context.options.quote || '"' + + if (marker !== '"' && marker !== "'") { + throw new Error( + 'Cannot serialize title with `' + + marker + + '` for `options.quote`, expected `"`, or `\'`' + ) + } + + return marker +} + + +/***/ }), + +/***/ 3680: +/***/ ((module) => { + +module.exports = checkRule + +function checkRule(context) { + var repetition = context.options.ruleRepetition || 3 + + if (repetition < 3) { + throw new Error( + 'Cannot serialize rules with repetition `' + + repetition + + '` for `options.ruleRepetition`, expected `3` or more' + ) + } + + return repetition +} + + +/***/ }), + +/***/ 7253: +/***/ ((module) => { + +module.exports = checkRule + +function checkRule(context) { + var marker = context.options.rule || '*' + + if (marker !== '*' && marker !== '-' && marker !== '_') { + throw new Error( + 'Cannot serialize rules with `' + + marker + + '` for `options.rule`, expected `*`, `-`, or `_`' + ) + } + + return marker +} + + +/***/ }), + +/***/ 3534: +/***/ ((module) => { + +module.exports = checkStrong + +function checkStrong(context) { + var marker = context.options.strong || '*' + + if (marker !== '*' && marker !== '_') { + throw new Error( + 'Cannot serialize strong with `' + + marker + + '` for `options.strong`, expected `*`, or `_`' + ) + } + + return marker +} + + +/***/ }), + +/***/ 7530: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = flow + +var repeat = __nccwpck_require__(6976) + +function flow(parent, context) { + var children = parent.children || [] + var results = [] + var index = -1 + var child + + while (++index < children.length) { + child = children[index] + + results.push( + context.handle(child, parent, context, {before: '\n', after: '\n'}) + ) + + if (index + 1 < children.length) { + results.push(between(child, children[index + 1])) + } + } + + return results.join('') + + function between(left, right) { + var index = -1 + var result + + while (++index < context.join.length) { + result = context.join[index](left, right, parent, context) + + if (result === true || result === 1) { + break } - function tokenizeCollapsedReference(effects, ok, nok) { - return start; - - function start(code) { - effects.enter('reference'); - effects.enter('referenceMarker'); - effects.consume(code); - effects.exit('referenceMarker'); - return open; - } - - function open(code) { - if (code === 93) { - effects.enter('referenceMarker'); - effects.consume(code); - effects.exit('referenceMarker'); - effects.exit('reference'); - return ok; - } - - return nok(code); - } + if (typeof result === 'number') { + return repeat('\n', 1 + Number(result)) } - module.exports = labelEnd; + if (result === false) { + return '\n\n\n\n' + } + } - /***/ - }, + return '\n\n' + } +} - /***/ 7860: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - var labelEnd = __nccwpck_require__(9797); +/***/ }), - var labelStartImage = { - name: 'labelStartImage', - tokenize: tokenizeLabelStartImage, - resolveAll: labelEnd.resolveAll, - }; +/***/ 7489: +/***/ ((module) => { - function tokenizeLabelStartImage(effects, ok, nok) { - var self = this; - return start; +module.exports = phrasing - function start(code) { - effects.enter('labelImage'); - effects.enter('labelImageMarker'); - effects.consume(code); - effects.exit('labelImageMarker'); - return open; +function phrasing(parent, context, safeOptions) { + var children = parent.children || [] + var results = [] + var index = -1 + var before = safeOptions.before + var after + var handle + var child + + while (++index < children.length) { + child = children[index] + + if (index + 1 < children.length) { + handle = context.handle.handlers[children[index + 1].type] + if (handle && handle.peek) handle = handle.peek + after = handle + ? handle(children[index + 1], parent, context, { + before: '', + after: '' + }).charAt(0) + : '' + } else { + after = safeOptions.after + } + + results.push( + context.handle(child, parent, context, { + before: before, + after: after + }) + ) + before = results[results.length - 1].slice(-1) + } + + return results.join('') +} + + +/***/ }), + +/***/ 8446: +/***/ ((module) => { + +module.exports = formatCodeAsIndented + +function formatCodeAsIndented(node, context) { + return ( + !context.options.fences && + node.value && + // If there’s no info… + !node.lang && + // And there’s a non-whitespace character… + /[^ \r\n]/.test(node.value) && + // And the value doesn’t start or end in a blank… + !/^[\t ]*[\r\n]|[\r\n][\t ]*$/.test(node.value) + ) +} + + +/***/ }), + +/***/ 4954: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = formatHeadingAsSetext + +var toString = __nccwpck_require__(5789) + +function formatHeadingAsSetext(node, context) { + return ( + context.options.setext && (!node.depth || node.depth < 3) && toString(node) + ) +} + + +/***/ }), + +/***/ 5358: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = formatLinkAsAutolink + +var toString = __nccwpck_require__(5789) + +function formatLinkAsAutolink(node, context) { + var raw = toString(node) + + return ( + !context.options.resourceLink && + // If there’s a url… + node.url && + // And there’s a no title… + !node.title && + // And the content of `node` is a single text node… + node.children && + node.children.length === 1 && + node.children[0].type === 'text' && + // And if the url is the same as the content… + (raw === node.url || 'mailto:' + raw === node.url) && + // And that starts w/ a protocol… + /^[a-z][a-z+.-]+:/i.test(node.url) && + // And that doesn’t contain ASCII control codes (character escapes and + // references don’t work) or angle brackets… + !/[\0- <>\u007F]/.test(node.url) + ) +} + + +/***/ }), + +/***/ 6887: +/***/ ((module) => { + +module.exports = indentLines + +var eol = /\r?\n|\r/g + +function indentLines(value, map) { + var result = [] + var start = 0 + var line = 0 + var match + + while ((match = eol.exec(value))) { + one(value.slice(start, match.index)) + result.push(match[0]) + start = match.index + match[0].length + line++ + } + + one(value.slice(start)) + + return result.join('') + + function one(value) { + result.push(map(value, line, !value)) + } +} + + +/***/ }), + +/***/ 3906: +/***/ ((module) => { + +module.exports = safe + +function safe(context, input, config) { + var value = (config.before || '') + (input || '') + (config.after || '') + var positions = [] + var result = [] + var infos = {} + var index = -1 + var before + var after + var position + var pattern + var expression + var match + var start + var end + + while (++index < context.unsafe.length) { + pattern = context.unsafe[index] + + if ( + !inScope(context.stack, pattern.inConstruct, true) || + inScope(context.stack, pattern.notInConstruct) + ) { + continue + } + + expression = + pattern._compiled || (pattern._compiled = toExpression(pattern)) + + while ((match = expression.exec(value))) { + before = 'before' in pattern || pattern.atBreak + after = 'after' in pattern + position = match.index + (before ? match[1].length : 0) + + if (positions.indexOf(position) === -1) { + positions.push(position) + infos[position] = {before: before, after: after} + } else { + if (infos[position].before && !before) { + infos[position].before = false } - function open(code) { - if (code === 91) { - effects.enter('labelMarker'); - effects.consume(code); - effects.exit('labelMarker'); - effects.exit('labelImage'); - return after; - } - - return nok(code); - } - - function after(code) { - /* c8 ignore next */ - return code === 94 && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs - ? /* c8 ignore next */ - nok(code) - : ok(code); + if (infos[position].after && !after) { + infos[position].after = false } } + } + } - module.exports = labelStartImage; + positions.sort(numerical) - /***/ - }, + start = config.before ? config.before.length : 0 + end = value.length - (config.after ? config.after.length : 0) + index = -1 - /***/ 5908: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; + while (++index < positions.length) { + position = positions[index] - var labelEnd = __nccwpck_require__(9797); + if ( + // Character before or after matched: + position < start || + position >= end + ) { + continue + } - var labelStartLink = { - name: 'labelStartLink', - tokenize: tokenizeLabelStartLink, - resolveAll: labelEnd.resolveAll, - }; + // If this character is supposed to be escaped because it has a condition on + // the next character, and the next character is definitly being escaped, + // then skip this escape. + if ( + position + 1 < end && + positions[index + 1] === position + 1 && + infos[position].after && + !infos[position + 1].before && + !infos[position + 1].after + ) { + continue + } - function tokenizeLabelStartLink(effects, ok, nok) { - var self = this; - return start; + if (start !== position) { + result.push(value.slice(start, position)) + } - function start(code) { - effects.enter('labelLink'); - effects.enter('labelMarker'); - effects.consume(code); - effects.exit('labelMarker'); - effects.exit('labelLink'); - return after; - } + start = position - function after(code) { - /* c8 ignore next */ - return code === 94 && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs - ? /* c8 ignore next */ - nok(code) - : ok(code); - } - } + if ( + /[!-/:-@[-`{-~]/.test(value.charAt(position)) && + (!config.encode || config.encode.indexOf(value.charAt(position)) === -1) + ) { + // Character escape. + result.push('\\') + } else { + // Character reference. + result.push( + '&#x' + value.charCodeAt(position).toString(16).toUpperCase() + ';' + ) + start++ + } + } - module.exports = labelStartLink; + result.push(value.slice(start, end)) - /***/ - }, + return result.join('') +} - /***/ 5183: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; +function inScope(stack, list, none) { + var index - var factorySpace = __nccwpck_require__(8200); + if (!list) { + return none + } - var lineEnding = { - name: 'lineEnding', - tokenize: tokenizeLineEnding, - }; + if (typeof list === 'string') { + list = [list] + } - function tokenizeLineEnding(effects, ok) { - return start; + index = -1 - function start(code) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, ok, 'linePrefix'); - } - } + while (++index < list.length) { + if (stack.indexOf(list[index]) !== -1) { + return true + } + } - module.exports = lineEnding; + return false +} - /***/ - }, +function toExpression(pattern) { + var before = pattern.before ? '(?:' + pattern.before + ')' : '' + var after = pattern.after ? '(?:' + pattern.after + ')' : '' - /***/ 3107: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; + if (pattern.atBreak) { + before = '[\\r\\n][\\t ]*' + before + } - var markdownSpace = __nccwpck_require__(5989); - var factorySpace = __nccwpck_require__(8200); - var partialBlankLine = __nccwpck_require__(2244); - var sizeChunks = __nccwpck_require__(5041); - var prefixSize = __nccwpck_require__(3722); - var asciiDigit = __nccwpck_require__(6996); - var thematicBreak = __nccwpck_require__(5590); + return new RegExp( + (before ? '(' + before + ')' : '') + + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + + pattern.character + + (after || ''), + 'g' + ) +} - var list = { - name: 'list', - tokenize: tokenizeListStart, - continuation: { - tokenize: tokenizeListContinuation, - }, - exit: tokenizeListEnd, - }; - var listItemPrefixWhitespaceConstruct = { - tokenize: tokenizeListItemPrefixWhitespace, - partial: true, - }; - var indentConstruct = { - tokenize: tokenizeIndent, - partial: true, - }; +function numerical(a, b) { + return a - b +} - function tokenizeListStart(effects, ok, nok) { - var self = this; - var initialSize = prefixSize(self.events, 'linePrefix'); - var size = 0; - return start; - function start(code) { - var kind = - self.containerState.type || - (code === 42 || code === 43 || code === 45 - ? 'listUnordered' - : 'listOrdered'); +/***/ }), - if ( - kind === 'listUnordered' - ? !self.containerState.marker || - code === self.containerState.marker - : asciiDigit(code) - ) { - if (!self.containerState.type) { - self.containerState.type = kind; - effects.enter(kind, { - _container: true, - }); +/***/ 5789: +/***/ ((module) => { + +"use strict"; + + +module.exports = toString + +// Get the text content of a node. +// Prefer the node’s plain-text fields, otherwise serialize its children, +// and if the given value is an array, serialize the nodes in it. +function toString(node) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all(node.children)) || + ('length' in node && all(node)))) || + '' + ) +} + +function all(values) { + var result = [] + var index = -1 + + while (++index < values.length) { + result[index] = toString(values[index]) + } + + return result.join('') +} + + +/***/ }), + +/***/ 6184: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = __nccwpck_require__(3616) + + +/***/ }), + +/***/ 1254: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var extend = __nccwpck_require__(8171) + +module.exports = contents + +// Transform a list of heading objects to a markdown list. +function contents(map, tight, prefix, ordered) { + var table = {type: 'list', ordered: ordered, spread: false, children: []} + var minDepth = Infinity + var index = -1 + + // Find minimum depth. + while (++index < map.length) { + if (map[index].depth < minDepth) { + minDepth = map[index].depth + } + } + + // Normalize depth. + index = -1 + + while (++index < map.length) { + map[index].depth -= minDepth - 1 + } + + // Add TOC to list. + index = -1 + + while (++index < map.length) { + insert(map[index], table, tight, prefix, ordered) + } + + return table +} + +// Insert an entry into `parent`. +function insert(entry, parent, tight, prefix, ordered) { + var siblings = parent.children + var tail = siblings[siblings.length - 1] + var index = -1 + var item + + if (entry.depth === 1) { + siblings.push({ + type: 'listItem', + spread: false, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'link', + title: null, + url: '#' + (prefix || '') + entry.id, + children: all(entry.children) } - - if (kind === 'listUnordered') { - effects.enter('listItemPrefix'); - return code === 42 || code === 45 - ? effects.check(thematicBreak, nok, atMarker)(code) - : atMarker(code); - } - - if (!self.interrupt || code === 49) { - effects.enter('listItemPrefix'); - effects.enter('listItemValue'); - return inside(code); - } - } - - return nok(code); + ] } + ] + }) + } else if (tail && tail.type === 'listItem') { + insert(entry, siblings[siblings.length - 1], tight, prefix, ordered) + } else if (tail && tail.type === 'list') { + entry.depth-- + insert(entry, tail, tight, prefix, ordered) + } else if (parent.type === 'list') { + item = {type: 'listItem', spread: false, children: []} + siblings.push(item) + insert(entry, item, tight, prefix, ordered) + } else { + item = { + type: 'list', + ordered: ordered, + spread: false, + children: [] + } + siblings.push(item) + entry.depth-- + insert(entry, item, tight, prefix, ordered) + } - function inside(code) { - if (asciiDigit(code) && ++size < 10) { - effects.consume(code); - return inside; - } + if (parent.type === 'list' && !tight) { + parent.spread = false - if ( - (!self.interrupt || size < 2) && - (self.containerState.marker - ? code === self.containerState.marker - : code === 41 || code === 46) - ) { - effects.exit('listItemValue'); - return atMarker(code); - } + while (++index < siblings.length) { + if (siblings[index].children.length > 1) { + parent.spread = true + break + } + } + } else { + parent.spread = !tight + } +} - return nok(code); - } +function all(children) { + var result = [] + var index = -1 - function atMarker(code) { - effects.enter('listItemMarker'); - effects.consume(code); - effects.exit('listItemMarker'); - self.containerState.marker = self.containerState.marker || code; - return effects.check( - partialBlankLine, // Can’t be empty when interrupting. - self.interrupt ? nok : onBlank, - effects.attempt( - listItemPrefixWhitespaceConstruct, - endOfPrefix, - otherPrefix - ) - ); - } + if (children) { + while (++index < children.length) { + result = result.concat(one(children[index])) + } + } - function onBlank(code) { - self.containerState.initialBlankLine = true; - initialSize++; - return endOfPrefix(code); - } + return result +} - function otherPrefix(code) { - if (markdownSpace(code)) { - effects.enter('listItemPrefixWhitespace'); - effects.consume(code); - effects.exit('listItemPrefixWhitespace'); - return endOfPrefix; - } +function one(node) { + var copy - return nok(code); - } + if ( + node.type === 'link' || + node.type === 'linkReference' || + node.type === 'footnote' || + node.type === 'footnoteReference' + ) { + return all(node.children) + } - function endOfPrefix(code) { - self.containerState.size = - initialSize + - sizeChunks(self.sliceStream(effects.exit('listItemPrefix'))); - return ok(code); - } + copy = extend({}, node) + + delete copy.children + delete copy.position + + copy = extend(true, {}, copy) + + if (node.children) { + copy.children = all(node.children) + } + + return copy +} + + +/***/ }), + +/***/ 3616: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = toc + +var search = __nccwpck_require__(6138) +var contents = __nccwpck_require__(1254) +var toExpression = __nccwpck_require__(2874) + +// Get a TOC representation of `node`. +function toc(node, options) { + var settings = options || {} + var heading = settings.heading ? toExpression(settings.heading) : null + var result = search(node, heading, settings) + + result.map = result.map.length + ? contents( + result.map, + settings.tight, + settings.prefix, + settings.ordered || false + ) + : null + + // No given heading. + if (!heading) { + result.endIndex = result.index = null + } + + return result +} + + +/***/ }), + +/***/ 6138: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = search + +var toString = __nccwpck_require__(5789) +var visit = __nccwpck_require__(199) +var convert = __nccwpck_require__(4070) +var slugs = __nccwpck_require__(237)() +var toExpression = __nccwpck_require__(2874) + +// Search a node for a location. +function search(root, expression, settings) { + var skip = settings.skip && toExpression(settings.skip) + var parents = convert(settings.parents || root) + var map = [] + var index + var endIndex + var opening + + slugs.reset() + + // Visit all headings in `root`. We `slug` all headings (to account for + // duplicates), but only create a TOC from top-level headings. + visit(root, 'heading', onheading) + + return { + index: index || -1, + endIndex: index ? endIndex || root.children.length : -1, + map: map + } + + function onheading(node, position, parent) { + var value = toString(node) + /* istanbul ignore next - to do: remove this when `remark-attr` is up to + * date w/ micromark. */ + var id = node.data && node.data.hProperties && node.data.hProperties.id + var slug = slugs.slug(id || value) + + if (!parents(parent)) { + return + } + + // Our opening heading. + if (expression && !index && expression.test(value)) { + index = position + 1 + opening = node + return + } + + // Our closing heading. + if (opening && !endIndex && node.depth <= opening.depth) { + endIndex = position + } + + // A non-empty heading after the closing (if we were looking for one). + if ( + value && + (endIndex || !expression) && + (!settings.maxDepth || node.depth <= settings.maxDepth) && + (!skip || !skip.test(value)) + ) { + map.push({depth: node.depth, children: node.children, id: slug}) + } + } +} + + +/***/ }), + +/***/ 2874: +/***/ ((module) => { + +"use strict"; + + +module.exports = toExpression + +// Transform a string into an applicable expression. +function toExpression(value) { + return new RegExp('^(' + value + ')$', 'i') +} + + +/***/ }), + +/***/ 3847: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var asciiAlpha = regexCheck(/[A-Za-z]/) + +module.exports = asciiAlpha + + +/***/ }), + +/***/ 598: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) + +module.exports = asciiAlphanumeric + + +/***/ }), + +/***/ 245: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) + +module.exports = asciiAtext + + +/***/ }), + +/***/ 1336: +/***/ ((module) => { + +"use strict"; + + +// Note: EOF is seen as ASCII control here, because `null < 32 == true`. +function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code < 32 || code === 127 + ) +} + +module.exports = asciiControl + + +/***/ }), + +/***/ 6996: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var asciiDigit = regexCheck(/\d/) + +module.exports = asciiDigit + + +/***/ }), + +/***/ 6526: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var asciiHexDigit = regexCheck(/[\dA-Fa-f]/) + +module.exports = asciiHexDigit + + +/***/ }), + +/***/ 7909: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) + +module.exports = asciiPunctuation + + +/***/ }), + +/***/ 9180: +/***/ ((module) => { + +"use strict"; + + +function markdownLineEndingOrSpace(code) { + return code < 0 || code === 32 +} + +module.exports = markdownLineEndingOrSpace + + +/***/ }), + +/***/ 7506: +/***/ ((module) => { + +"use strict"; + + +function markdownLineEnding(code) { + return code < -2 +} + +module.exports = markdownLineEnding + + +/***/ }), + +/***/ 5989: +/***/ ((module) => { + +"use strict"; + + +function markdownSpace(code) { + return code === -2 || code === -1 || code === 32 +} + +module.exports = markdownSpace + + +/***/ }), + +/***/ 9372: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) +var unicodePunctuationRegex = __nccwpck_require__(9994) + +// In fact adds to the bundle size. + +var unicodePunctuation = regexCheck(unicodePunctuationRegex) + +module.exports = unicodePunctuation + + +/***/ }), + +/***/ 9968: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var regexCheck = __nccwpck_require__(1028) + +var unicodeWhitespace = regexCheck(/\s/) + +module.exports = unicodeWhitespace + + +/***/ }), + +/***/ 3512: +/***/ ((module) => { + +"use strict"; + + +var assign = Object.assign + +module.exports = assign + + +/***/ }), + +/***/ 3531: +/***/ ((module) => { + +"use strict"; + + +var fromCharCode = String.fromCharCode + +module.exports = fromCharCode + + +/***/ }), + +/***/ 3500: +/***/ ((module) => { + +"use strict"; + + +var own = {}.hasOwnProperty + +module.exports = own + + +/***/ }), + +/***/ 5159: +/***/ ((module) => { + +"use strict"; + + +// This module is copied from . +var basics = [ + 'address', + 'article', + 'aside', + 'base', + 'basefont', + 'blockquote', + 'body', + 'caption', + 'center', + 'col', + 'colgroup', + 'dd', + 'details', + 'dialog', + 'dir', + 'div', + 'dl', + 'dt', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'frame', + 'frameset', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hr', + 'html', + 'iframe', + 'legend', + 'li', + 'link', + 'main', + 'menu', + 'menuitem', + 'nav', + 'noframes', + 'ol', + 'optgroup', + 'option', + 'p', + 'param', + 'section', + 'source', + 'summary', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'title', + 'tr', + 'track', + 'ul' +] + +module.exports = basics + + +/***/ }), + +/***/ 4677: +/***/ ((module) => { + +"use strict"; + + +// This module is copied from . +var raws = ['pre', 'script', 'style', 'textarea'] + +module.exports = raws + + +/***/ }), + +/***/ 2366: +/***/ ((module) => { + +"use strict"; + + +var splice = [].splice + +module.exports = splice + + +/***/ }), + +/***/ 9994: +/***/ ((module) => { + +"use strict"; + + +// This module is generated by `script/`. +// +// CommonMark handles attention (emphasis, strong) markers based on what comes +// before or after them. +// One such difference is if those characters are Unicode punctuation. +// This script is generated from the Unicode data. +var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/ + +module.exports = unicodePunctuation + + +/***/ }), + +/***/ 289: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({value: true})) + +var text$1 = __nccwpck_require__(7492) +var attention = __nccwpck_require__(2116) +var autolink = __nccwpck_require__(6681) +var blockQuote = __nccwpck_require__(9025) +var characterEscape = __nccwpck_require__(7128) +var characterReference = __nccwpck_require__(9500) +var codeFenced = __nccwpck_require__(3268) +var codeIndented = __nccwpck_require__(907) +var codeText = __nccwpck_require__(7033) +var definition = __nccwpck_require__(1193) +var hardBreakEscape = __nccwpck_require__(7608) +var headingAtx = __nccwpck_require__(4558) +var htmlFlow = __nccwpck_require__(6791) +var htmlText = __nccwpck_require__(7743) +var labelEnd = __nccwpck_require__(9797) +var labelStartImage = __nccwpck_require__(7860) +var labelStartLink = __nccwpck_require__(5908) +var lineEnding = __nccwpck_require__(5183) +var thematicBreak = __nccwpck_require__(5590) +var list = __nccwpck_require__(3107) +var setextUnderline = __nccwpck_require__(1196) + +var document = { + 42: list, + // Asterisk + 43: list, + // Plus sign + 45: list, + // Dash + 48: list, + // 0 + 49: list, + // 1 + 50: list, + // 2 + 51: list, + // 3 + 52: list, + // 4 + 53: list, + // 5 + 54: list, + // 6 + 55: list, + // 7 + 56: list, + // 8 + 57: list, + // 9 + 62: blockQuote // Greater than +} +var contentInitial = { + 91: definition // Left square bracket +} +var flowInitial = { + '-2': codeIndented, + // Horizontal tab + '-1': codeIndented, + // Virtual space + 32: codeIndented // Space +} +var flow = { + 35: headingAtx, + // Number sign + 42: thematicBreak, + // Asterisk + 45: [setextUnderline, thematicBreak], + // Dash + 60: htmlFlow, + // Less than + 61: setextUnderline, + // Equals to + 95: thematicBreak, + // Underscore + 96: codeFenced, + // Grave accent + 126: codeFenced // Tilde +} +var string = { + 38: characterReference, + // Ampersand + 92: characterEscape // Backslash +} +var text = { + '-5': lineEnding, + // Carriage return + '-4': lineEnding, + // Line feed + '-3': lineEnding, + // Carriage return + line feed + 33: labelStartImage, + // Exclamation mark + 38: characterReference, + // Ampersand + 42: attention, + // Asterisk + 60: [autolink, htmlText], + // Less than + 91: labelStartLink, + // Left square bracket + 92: [hardBreakEscape, characterEscape], + // Backslash + 93: labelEnd, + // Right square bracket + 95: attention, + // Underscore + 96: codeText // Grave accent +} +var insideSpan = { + null: [attention, text$1.resolver] +} +var disable = { + null: [] +} + +exports.contentInitial = contentInitial +exports.disable = disable +exports.document = document +exports.flow = flow +exports.flowInitial = flowInitial +exports.insideSpan = insideSpan +exports.string = string +exports.text = text + + +/***/ }), + +/***/ 5834: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({value: true})) + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) + +var tokenize = initializeContent + +function initializeContent(effects) { + var contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ) + var previous + return contentStart + + function afterContentStartConstruct(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, contentStart, 'linePrefix') + } + + function paragraphInitial(code) { + effects.enter('paragraph') + return lineStart(code) + } + + function lineStart(code) { + var token = effects.enter('chunkText', { + contentType: 'text', + previous: previous + }) + + if (previous) { + previous.next = token + } + + previous = token + return data(code) + } + + function data(code) { + if (code === null) { + effects.exit('chunkText') + effects.exit('paragraph') + effects.consume(code) + return + } + + if (markdownLineEnding(code)) { + effects.consume(code) + effects.exit('chunkText') + return lineStart + } // Data. + + effects.consume(code) + return data + } +} + +exports.tokenize = tokenize + + +/***/ }), + +/***/ 9517: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({value: true})) + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) +var partialBlankLine = __nccwpck_require__(2244) + +var tokenize = initializeDocument +var containerConstruct = { + tokenize: tokenizeContainer +} +var lazyFlowConstruct = { + tokenize: tokenizeLazyFlow +} + +function initializeDocument(effects) { + var self = this + var stack = [] + var continued = 0 + var inspectConstruct = { + tokenize: tokenizeInspect, + partial: true + } + var inspectResult + var childFlow + var childToken + return start + + function start(code) { + if (continued < stack.length) { + self.containerState = stack[continued][1] + return effects.attempt( + stack[continued][0].continuation, + documentContinue, + documentContinued + )(code) + } + + return documentContinued(code) + } + + function documentContinue(code) { + continued++ + return start(code) + } + + function documentContinued(code) { + // If we’re in a concrete construct (such as when expecting another line of + // HTML, or we resulted in lazy content), we can immediately start flow. + if (inspectResult && inspectResult.flowContinue) { + return flowStart(code) + } + + self.interrupt = + childFlow && + childFlow.currentConstruct && + childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code) + } + + function containerContinue(code) { + stack.push([self.currentConstruct, self.containerState]) + self.containerState = undefined + return documentContinued(code) + } + + function flowStart(code) { + if (code === null) { + exitContainers(0, true) + effects.consume(code) + return + } + + childFlow = childFlow || self.parser.flow(self.now()) + effects.enter('chunkFlow', { + contentType: 'flow', + previous: childToken, + _tokenizer: childFlow + }) + return flowContinue(code) + } + + function flowContinue(code) { + if (code === null) { + continueFlow(effects.exit('chunkFlow')) + return flowStart(code) + } + + if (markdownLineEnding(code)) { + effects.consume(code) + continueFlow(effects.exit('chunkFlow')) + return effects.check(inspectConstruct, documentAfterPeek) + } + + effects.consume(code) + return flowContinue + } + + function documentAfterPeek(code) { + exitContainers( + inspectResult.continued, + inspectResult && inspectResult.flowEnd + ) + continued = 0 + return start(code) + } + + function continueFlow(token) { + if (childToken) childToken.next = token + childToken = token + childFlow.lazy = inspectResult && inspectResult.lazy + childFlow.defineSkip(token.start) + childFlow.write(self.sliceStream(token)) + } + + function exitContainers(size, end) { + var index = stack.length // Close the flow. + + if (childFlow && end) { + childFlow.write([null]) + childToken = childFlow = undefined + } // Exit open containers. + + while (index-- > size) { + self.containerState = stack[index][1] + stack[index][0].exit.call(self, effects) + } + + stack.length = size + } + + function tokenizeInspect(effects, ok) { + var subcontinued = 0 + inspectResult = {} + return inspectStart + + function inspectStart(code) { + if (subcontinued < stack.length) { + self.containerState = stack[subcontinued][1] + return effects.attempt( + stack[subcontinued][0].continuation, + inspectContinue, + inspectLess + )(code) + } // If we’re continued but in a concrete flow, we can’t have more + // containers. + + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + inspectResult.flowContinue = true + return inspectDone(code) } - function tokenizeListContinuation(effects, ok, nok) { - var self = this; - self.containerState._closeFlow = undefined; - return effects.check(partialBlankLine, onBlank, notBlank); + self.interrupt = + childFlow.currentConstruct && childFlow.currentConstruct.interruptible + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, + inspectDone + )(code) + } - function onBlank(code) { - self.containerState.furtherBlankLines = - self.containerState.furtherBlankLines || - self.containerState.initialBlankLine; - return ok(code); - } + function inspectContinue(code) { + subcontinued++ + return self.containerState._closeFlow + ? inspectFlowEnd(code) + : inspectStart(code) + } - function notBlank(code) { - if (self.containerState.furtherBlankLines || !markdownSpace(code)) { - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; - return notInCurrentItem(code); - } + function inspectLess(code) { + if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { + // Maybe another container? + self.containerState = {} + return effects.attempt( + containerConstruct, + inspectFlowEnd, // Maybe flow, or a blank line? + effects.attempt( + lazyFlowConstruct, + inspectFlowEnd, + effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) + ) + )(code) + } // Otherwise we’re interrupting. - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; - return effects.attempt(indentConstruct, ok, notInCurrentItem)(code); - } + return inspectFlowEnd(code) + } - function notInCurrentItem(code) { - // While we do continue, we signal that the flow should be closed. - self.containerState._closeFlow = true; // As we’re closing flow, we’re no longer interrupting. + function inspectLazy(code) { + // Act as if all containers are continued. + subcontinued = stack.length + inspectResult.lazy = true + inspectResult.flowContinue = true + return inspectDone(code) + } // We’re done with flow if we have more containers, or an interruption. - self.interrupt = undefined; - return factorySpace( - effects, - effects.attempt(list, ok, nok), - 'linePrefix', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - )(code); - } + function inspectFlowEnd(code) { + inspectResult.flowEnd = true + return inspectDone(code) + } + + function inspectDone(code) { + inspectResult.continued = subcontinued + self.interrupt = self.containerState = undefined + return ok(code) + } + } +} + +function tokenizeContainer(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +function tokenizeLazyFlow(effects, ok, nok) { + return factorySpace( + effects, + effects.lazy(this.parser.constructs.flow, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +exports.tokenize = tokenize + + +/***/ }), + +/***/ 9670: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({value: true})) + +var factorySpace = __nccwpck_require__(8200) +var partialBlankLine = __nccwpck_require__(2244) +var content = __nccwpck_require__(1259) + +var tokenize = initializeFlow + +function initializeFlow(effects) { + var self = this + var initial = effects.attempt( + // Try to parse a blank line. + partialBlankLine, + atBlankEnding, // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content, afterConstruct) + ), + 'linePrefix' + ) + ) + ) + return initial + + function atBlankEnding(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('lineEndingBlank') + effects.consume(code) + effects.exit('lineEndingBlank') + self.currentConstruct = undefined + return initial + } + + function afterConstruct(code) { + if (code === null) { + effects.consume(code) + return + } + + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + self.currentConstruct = undefined + return initial + } +} + +exports.tokenize = tokenize + + +/***/ }), + +/***/ 7492: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({value: true})) + +var assign = __nccwpck_require__(3512) +var shallow = __nccwpck_require__(1479) + +var text = initializeFactory('text') +var string = initializeFactory('string') +var resolver = { + resolveAll: createResolver() +} + +function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ) + } + + function initializeText(effects) { + var self = this + var constructs = this.parser.constructs[field] + var text = effects.attempt(constructs, start, notText) + return start + + function start(code) { + return atBreak(code) ? text(code) : notText(code) + } + + function notText(code) { + if (code === null) { + effects.consume(code) + return } - function tokenizeIndent(effects, ok, nok) { - var self = this; - return factorySpace( - effects, - afterPrefix, - 'listItemIndent', - self.containerState.size + 1 - ); + effects.enter('data') + effects.consume(code) + return data + } - function afterPrefix(code) { - return prefixSize(self.events, 'listItemIndent') === - self.containerState.size - ? ok(code) - : nok(code); - } + function data(code) { + if (atBreak(code)) { + effects.exit('data') + return text(code) + } // Data. + + effects.consume(code) + return data + } + + function atBreak(code) { + var list = constructs[code] + var index = -1 + + if (code === null) { + return true } - function tokenizeListEnd(effects) { - effects.exit(this.containerState.type); - } - - function tokenizeListItemPrefixWhitespace(effects, ok, nok) { - var self = this; - return factorySpace( - effects, - afterPrefix, - 'listItemPrefixWhitespace', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 + 1 - ); - - function afterPrefix(code) { - return markdownSpace(code) || - !prefixSize(self.events, 'listItemPrefixWhitespace') - ? nok(code) - : ok(code); - } - } - - module.exports = list; - - /***/ - }, - - /***/ 2244: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - - var partialBlankLine = { - tokenize: tokenizePartialBlankLine, - partial: true, - }; - - function tokenizePartialBlankLine(effects, ok, nok) { - return factorySpace(effects, afterWhitespace, 'linePrefix'); - - function afterWhitespace(code) { - return code === null || markdownLineEnding(code) - ? ok(code) - : nok(code); - } - } - - module.exports = partialBlankLine; - - /***/ - }, - - /***/ 1196: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var factorySpace = __nccwpck_require__(8200); - var shallow = __nccwpck_require__(1479); - - var setextUnderline = { - name: 'setextUnderline', - tokenize: tokenizeSetextUnderline, - resolveTo: resolveToSetextUnderline, - }; - - function resolveToSetextUnderline(events, context) { - var index = events.length; - var content; - var text; - var definition; - var heading; // Find the opening of the content. - // It’ll always exist: we don’t tokenize if it isn’t there. - - while (index--) { - if (events[index][0] === 'enter') { - if (events[index][1].type === 'content') { - content = index; - break; - } - - if (events[index][1].type === 'paragraph') { - text = index; - } - } // Exit - else { - if (events[index][1].type === 'content') { - // Remove the content end (if needed we’ll add it later) - events.splice(index, 1); - } - - if (!definition && events[index][1].type === 'definition') { - definition = index; - } - } - } - - heading = { - type: 'setextHeading', - start: shallow(events[text][1].start), - end: shallow(events[events.length - 1][1].end), - }; // Change the paragraph to setext heading text. - - events[text][1].type = 'setextHeadingText'; // If we have definitions in the content, we’ll keep on having content, - // but we need move it. - - if (definition) { - events.splice(text, 0, ['enter', heading, context]); - events.splice(definition + 1, 0, [ - 'exit', - events[content][1], - context, - ]); - events[content][1].end = shallow(events[definition][1].end); - } else { - events[content][1] = heading; - } // Add the heading exit at the end. - - events.push(['exit', heading, context]); - return events; - } - - function tokenizeSetextUnderline(effects, ok, nok) { - var self = this; - var index = self.events.length; - var marker; - var paragraph; // Find an opening. - - while (index--) { - // Skip enter/exit of line ending, line prefix, and content. - // We can now either have a definition or a paragraph. - if ( - self.events[index][1].type !== 'lineEnding' && - self.events[index][1].type !== 'linePrefix' && - self.events[index][1].type !== 'content' - ) { - paragraph = self.events[index][1].type === 'paragraph'; - break; - } - } - - return start; - - function start(code) { - if (!self.lazy && (self.interrupt || paragraph)) { - effects.enter('setextHeadingLine'); - effects.enter('setextHeadingLineSequence'); - marker = code; - return closingSequence(code); - } - - return nok(code); - } - - function closingSequence(code) { - if (code === marker) { - effects.consume(code); - return closingSequence; - } - - effects.exit('setextHeadingLineSequence'); - return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code); - } - - function closingSequenceEnd(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('setextHeadingLine'); - return ok(code); - } - - return nok(code); - } - } - - module.exports = setextUnderline; - - /***/ - }, - - /***/ 5590: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEnding = __nccwpck_require__(7506); - var markdownSpace = __nccwpck_require__(5989); - var factorySpace = __nccwpck_require__(8200); - - var thematicBreak = { - name: 'thematicBreak', - tokenize: tokenizeThematicBreak, - }; - - function tokenizeThematicBreak(effects, ok, nok) { - var size = 0; - var marker; - return start; - - function start(code) { - effects.enter('thematicBreak'); - marker = code; - return atBreak(code); - } - - function atBreak(code) { - if (code === marker) { - effects.enter('thematicBreakSequence'); - return sequence(code); - } - - if (markdownSpace(code)) { - return factorySpace(effects, atBreak, 'whitespace')(code); - } - - if (size < 3 || (code !== null && !markdownLineEnding(code))) { - return nok(code); - } - - effects.exit('thematicBreak'); - return ok(code); - } - - function sequence(code) { - if (code === marker) { - effects.consume(code); - size++; - return sequence; - } - - effects.exit('thematicBreakSequence'); - return atBreak(code); - } - } - - module.exports = thematicBreak; - - /***/ - }, - - /***/ 4455: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var chunkedSplice = __nccwpck_require__(778); - - function chunkedPush(list, items) { - if (list.length) { - chunkedSplice(list, list.length, 0, items); - return list; - } - - return items; - } - - module.exports = chunkedPush; - - /***/ - }, - - /***/ 778: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var splice = __nccwpck_require__(2366); - - // causes a stack overflow in V8 when trying to insert 100k items for instance. - - function chunkedSplice(list, start, remove, items) { - var end = list.length; - var chunkStart = 0; - var parameters; // Make start between zero and `end` (included). - - if (start < 0) { - start = -start > end ? 0 : end + start; - } else { - start = start > end ? end : start; - } - - remove = remove > 0 ? remove : 0; // No need to chunk the items if there’s only a couple (10k) items. - - if (items.length < 10000) { - parameters = Array.from(items); - parameters.unshift(start, remove); - splice.apply(list, parameters); - } else { - // Delete `remove` items starting from `start` - if (remove) splice.apply(list, [start, remove]); // Insert the items in chunks to not cause stack overflows. - - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + 10000); - parameters.unshift(start, 0); - splice.apply(list, parameters); - chunkStart += 10000; - start += 10000; - } - } - } - - module.exports = chunkedSplice; - - /***/ - }, - - /***/ 1324: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var markdownLineEndingOrSpace = __nccwpck_require__(9180); - var unicodePunctuation = __nccwpck_require__(9372); - var unicodeWhitespace = __nccwpck_require__(9968); - - // Classify whether a character is unicode whitespace, unicode punctuation, or - // anything else. - // Used for attention (emphasis, strong), whose sequences can open or close - // based on the class of surrounding characters. - function classifyCharacter(code) { - if ( - code === null || - markdownLineEndingOrSpace(code) || - unicodeWhitespace(code) - ) { - return 1; - } - - if (unicodePunctuation(code)) { - return 2; - } - } - - module.exports = classifyCharacter; - - /***/ - }, - - /***/ 8602: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var hasOwnProperty = __nccwpck_require__(3500); - var chunkedSplice = __nccwpck_require__(778); - var miniflat = __nccwpck_require__(9042); - - function combineExtensions(extensions) { - var all = {}; - var index = -1; - - while (++index < extensions.length) { - extension(all, extensions[index]); - } - - return all; - } - - function extension(all, extension) { - var hook; - var left; - var right; - var code; - - for (hook in extension) { - left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {}); - right = extension[hook]; - - for (code in right) { - left[code] = constructs( - miniflat(right[code]), - hasOwnProperty.call(left, code) ? left[code] : [] - ); - } - } - } - - function constructs(list, existing) { - var index = -1; - var before = []; - + if (list) { while (++index < list.length) { - (list[index].add === 'after' ? existing : before).push(list[index]); - } - - chunkedSplice(existing, 0, 0, before); - return existing; - } - - module.exports = combineExtensions; - - /***/ - }, - - /***/ 4845: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var assign = __nccwpck_require__(3512); - var chunkedSplice = __nccwpck_require__(778); - var chunkedPush = __nccwpck_require__(4455); - var miniflat = __nccwpck_require__(9042); - var markdownLineEnding = __nccwpck_require__(7506); - var shallow = __nccwpck_require__(1479); - var resolveAll = __nccwpck_require__(2004); - var serializeChunks = __nccwpck_require__(4363); - var sliceChunks = __nccwpck_require__(7271); - - // Create a tokenizer. - // Tokenizers deal with one type of data (e.g., containers, flow, text). - // The parser is the object dealing with it all. - // `initialize` works like other constructs, except that only its `tokenize` - // function is used, in which case it doesn’t receive an `ok` or `nok`. - // `from` can be given to set the point before the first character, although - // when further lines are indented, they must be set with `defineSkip`. - function createTokenizer(parser, initialize, from) { - var point = from - ? shallow(from) - : { - line: 1, - column: 1, - offset: 0, - }; - var columnStart = {}; - var resolveAllConstructs = []; - var chunks = []; - var stack = []; - - var effects = { - consume: consume, - enter: enter, - exit: exit, - attempt: constructFactory(onsuccessfulconstruct), - check: constructFactory(onsuccessfulcheck), - interrupt: constructFactory(onsuccessfulcheck, { - interrupt: true, - }), - lazy: constructFactory(onsuccessfulcheck, { - lazy: true, - }), - }; // State and tools for resolving and serializing. - - var context = { - previous: null, - events: [], - parser: parser, - sliceStream: sliceStream, - sliceSerialize: sliceSerialize, - now: now, - defineSkip: skip, - write: write, - }; // The state function. - - var state = initialize.tokenize.call(context, effects); // Track which character we expect to be consumed, to catch bugs. - - if (initialize.resolveAll) { - resolveAllConstructs.push(initialize); - } // Store where we are in the input stream. - - point._index = 0; - point._bufferIndex = -1; - return context; - - function write(slice) { - chunks = chunkedPush(chunks, slice); - main(); // Exit if we’re not done, resolve might change stuff. - - if (chunks[chunks.length - 1] !== null) { - return []; - } - - addResult(initialize, 0); // Otherwise, resolve, and exit. - - context.events = resolveAll( - resolveAllConstructs, - context.events, - context - ); - return context.events; - } // - // Tools. - // - - function sliceSerialize(token) { - return serializeChunks(sliceStream(token)); - } - - function sliceStream(token) { - return sliceChunks(chunks, token); - } - - function now() { - return shallow(point); - } - - function skip(value) { - columnStart[value.line] = value.column; - accountForPotentialSkip(); - } // - // State management. - // - // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by - // `consume`). - // Here is where we walk through the chunks, which either include strings of - // several characters, or numerical character codes. - // The reason to do this in a loop instead of a call is so the stack can - // drain. - - function main() { - var chunkIndex; - var chunk; - - while (point._index < chunks.length) { - chunk = chunks[point._index]; // If we’re in a buffer chunk, loop through it. - - if (typeof chunk === 'string') { - chunkIndex = point._index; - - if (point._bufferIndex < 0) { - point._bufferIndex = 0; - } - - while ( - point._index === chunkIndex && - point._bufferIndex < chunk.length - ) { - go(chunk.charCodeAt(point._bufferIndex)); - } - } else { - go(chunk); - } - } - } // Deal with one code. - - function go(code) { - state = state(code); - } // Move a character forward. - - function consume(code) { - if (markdownLineEnding(code)) { - point.line++; - point.column = 1; - point.offset += code === -3 ? 2 : 1; - accountForPotentialSkip(); - } else if (code !== -1) { - point.column++; - point.offset++; - } // Not in a string chunk. - - if (point._bufferIndex < 0) { - point._index++; - } else { - point._bufferIndex++; // At end of string chunk. - - if (point._bufferIndex === chunks[point._index].length) { - point._bufferIndex = -1; - point._index++; - } - } // Expose the previous character. - - context.previous = code; // Mark as consumed. - } // Start a token. - - function enter(type, fields) { - var token = fields || {}; - token.type = type; - token.start = now(); - context.events.push(['enter', token, context]); - stack.push(token); - return token; - } // Stop a token. - - function exit(type) { - var token = stack.pop(); - token.end = now(); - context.events.push(['exit', token, context]); - return token; - } // Use results. - - function onsuccessfulconstruct(construct, info) { - addResult(construct, info.from); - } // Discard results. - - function onsuccessfulcheck(construct, info) { - info.restore(); - } // Factory to attempt/check/interrupt. - - function constructFactory(onreturn, fields) { - return hook; // Handle either an object mapping codes to constructs, a list of - // constructs, or a single construct. - - function hook(constructs, returnState, bogusState) { - var listOfConstructs; - var constructIndex; - var currentConstruct; - var info; - return constructs.tokenize || 'length' in constructs - ? handleListOfConstructs(miniflat(constructs)) - : handleMapOfConstructs; - - function handleMapOfConstructs(code) { - if (code in constructs || null in constructs) { - return handleListOfConstructs( - constructs.null - ? /* c8 ignore next */ - miniflat(constructs[code]).concat( - miniflat(constructs.null) - ) - : constructs[code] - )(code); - } - - return bogusState(code); - } - - function handleListOfConstructs(list) { - listOfConstructs = list; - constructIndex = 0; - return handleConstruct(list[constructIndex]); - } - - function handleConstruct(construct) { - return start; - - function start(code) { - // To do: not nede to store if there is no bogus state, probably? - // Currently doesn’t work because `inspect` in document does a check - // w/o a bogus, which doesn’t make sense. But it does seem to help perf - // by not storing. - info = store(); - currentConstruct = construct; - - if (!construct.partial) { - context.currentConstruct = construct; - } - - if ( - construct.name && - context.parser.constructs.disable.null.indexOf( - construct.name - ) > -1 - ) { - return nok(); - } - - return construct.tokenize.call( - fields ? assign({}, context, fields) : context, - effects, - ok, - nok - )(code); - } - } - - function ok(code) { - onreturn(currentConstruct, info); - return returnState; - } - - function nok(code) { - info.restore(); - - if (++constructIndex < listOfConstructs.length) { - return handleConstruct(listOfConstructs[constructIndex]); - } - - return bogusState; - } - } - } - - function addResult(construct, from) { if ( - construct.resolveAll && - resolveAllConstructs.indexOf(construct) < 0 + !list[index].previous || + list[index].previous.call(self, self.previous) ) { - resolveAllConstructs.push(construct); - } - - if (construct.resolve) { - chunkedSplice( - context.events, - from, - context.events.length - from, - construct.resolve(context.events.slice(from), context) - ); - } - - if (construct.resolveTo) { - context.events = construct.resolveTo(context.events, context); - } - } - - function store() { - var startPoint = now(); - var startPrevious = context.previous; - var startCurrentConstruct = context.currentConstruct; - var startEventsIndex = context.events.length; - var startStack = Array.from(stack); - return { - restore: restore, - from: startEventsIndex, - }; - - function restore() { - point = startPoint; - context.previous = startPrevious; - context.currentConstruct = startCurrentConstruct; - context.events.length = startEventsIndex; - stack = startStack; - accountForPotentialSkip(); - } - } - - function accountForPotentialSkip() { - if (point.line in columnStart && point.column < 2) { - point.column = columnStart[point.line]; - point.offset += columnStart[point.line] - 1; + return true } } } + } + } +} - module.exports = createTokenizer; +function createResolver(extraResolver) { + return resolveAllText - /***/ - }, + function resolveAllText(events, context) { + var index = -1 + var enter // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. - /***/ 9042: /***/ (module) => { - 'use strict'; - - function miniflat(value) { - return value === null || value === undefined - ? [] - : 'length' in value - ? value - : [value]; - } - - module.exports = miniflat; - - /***/ - }, - - /***/ 6985: /***/ (module) => { - 'use strict'; - - // chunks (replacement characters, tabs, or line endings). - - function movePoint(point, offset) { - point.column += offset; - point.offset += offset; - point._bufferIndex += offset; - return point; - } - - module.exports = movePoint; - - /***/ - }, - - /***/ 712: /***/ (module) => { - 'use strict'; - - function normalizeIdentifier(value) { - return ( - value // Collapse Markdown whitespace. - .replace(/[\t\n\r ]+/g, ' ') // Trim. - .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase - // counterpart is uppercased will result in a different uppercase - // character. - // Hence, to get that form, we perform both lower- and uppercase. - // Upper case makes sure keys will not interact with default prototypal - // methods: no object method is uppercase. - .toLowerCase() - .toUpperCase() - ); - } - - module.exports = normalizeIdentifier; - - /***/ - }, - - /***/ 3722: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var sizeChunks = __nccwpck_require__(5041); - - function prefixSize(events, type) { - var tail = events[events.length - 1]; - if (!tail || tail[1].type !== type) return 0; - return sizeChunks(tail[2].sliceStream(tail[1])); - } - - module.exports = prefixSize; - - /***/ - }, - - /***/ 1028: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var fromCharCode = __nccwpck_require__(3531); - - function regexCheck(regex) { - return check; - - function check(code) { - return regex.test(fromCharCode(code)); + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === 'data') { + enter = index + index++ } - } - - module.exports = regexCheck; - - /***/ - }, - - /***/ 2004: /***/ (module) => { - 'use strict'; - - function resolveAll(constructs, events, context) { - var called = []; - var index = -1; - var resolve; - - while (++index < constructs.length) { - resolve = constructs[index].resolveAll; - - if (resolve && called.indexOf(resolve) < 0) { - events = resolve(events, context); - called.push(resolve); - } + } else if (!events[index] || events[index][1].type !== 'data') { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + index = enter + 2 } - return events; + enter = undefined } + } - module.exports = resolveAll; + return extraResolver ? extraResolver(events, context) : events + } +} // A rather ugly set of instructions which again looks at chunks in the input +// stream. +// The reason to do this here is that it is *much* faster to parse in reverse. +// And that we can’t hook into `null` to split the line suffix before an EOF. +// To do: figure out if we can make this into a clean utility, or even in core. +// As it will be useful for GFMs literal autolink extension (and maybe even +// tables?) - /***/ - }, +function resolveAllLineSuffixes(events, context) { + var eventIndex = -1 + var chunks + var data + var chunk + var index + var bufferIndex + var size + var tabs + var token - /***/ 6214: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; + while (++eventIndex <= events.length) { + if ( + (eventIndex === events.length || + events[eventIndex][1].type === 'lineEnding') && + events[eventIndex - 1][1].type === 'data' + ) { + data = events[eventIndex - 1][1] + chunks = context.sliceStream(data) + index = chunks.length + bufferIndex = -1 + size = 0 + tabs = undefined - var fromCharCode = __nccwpck_require__(3531); + while (index--) { + chunk = chunks[index] - function safeFromInt(value, base) { - var code = parseInt(value, base); + if (typeof chunk === 'string') { + bufferIndex = chunk.length - if ( - // C0 except for HT, LF, FF, CR, space - code < 9 || - code === 11 || - (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. - (code > 126 && code < 160) || // Lone high surrogates and low surrogates. - (code > 55295 && code < 57344) || // Noncharacters. - (code > 64975 && code < 65008) || - (code & 65535) === 65535 || - (code & 65535) === 65534 || // Out of range - code > 1114111 - ) { - return '\uFFFD'; - } - - return fromCharCode(code); - } - - module.exports = safeFromInt; - - /***/ - }, - - /***/ 4363: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var fromCharCode = __nccwpck_require__(3531); - - function serializeChunks(chunks) { - var index = -1; - var result = []; - var chunk; - var value; - var atTab; - - while (++index < chunks.length) { - chunk = chunks[index]; - - if (typeof chunk === 'string') { - value = chunk; - } else if (chunk === -5) { - value = '\r'; - } else if (chunk === -4) { - value = '\n'; - } else if (chunk === -3) { - value = '\r' + '\n'; - } else if (chunk === -2) { - value = '\t'; - } else if (chunk === -1) { - if (atTab) continue; - value = ' '; - } else { - // Currently only replacement character. - value = fromCharCode(chunk); + while (chunk.charCodeAt(bufferIndex - 1) === 32) { + size++ + bufferIndex-- } - atTab = chunk === -2; - result.push(value); + if (bufferIndex) break + bufferIndex = -1 + } // Number + else if (chunk === -2) { + tabs = true + size++ + } else if (chunk === -1); + else { + // Replacement character, exit. + index++ + break } - - return result.join(''); } - module.exports = serializeChunks; - - /***/ - }, - - /***/ 1479: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var assign = __nccwpck_require__(3512); - - function shallow(object) { - return assign({}, object); - } - - module.exports = shallow; - - /***/ - }, - - /***/ 5041: /***/ (module) => { - 'use strict'; - - // Counts tabs based on their expanded size, and CR+LF as one character. - - function sizeChunks(chunks) { - var index = -1; - var size = 0; - - while (++index < chunks.length) { - size += typeof chunks[index] === 'string' ? chunks[index].length : 1; + if (size) { + token = { + type: + eventIndex === events.length || tabs || size < 2 + ? 'lineSuffix' + : 'hardBreakTrailing', + start: { + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size, + _index: data.start._index + index, + _bufferIndex: index + ? bufferIndex + : data.start._bufferIndex + bufferIndex + }, + end: shallow(data.end) } + data.end = shallow(token.start) - return size; - } - - module.exports = sizeChunks; - - /***/ - }, - - /***/ 7271: /***/ (module) => { - 'use strict'; - - function sliceChunks(chunks, token) { - var startIndex = token.start._index; - var startBufferIndex = token.start._bufferIndex; - var endIndex = token.end._index; - var endBufferIndex = token.end._bufferIndex; - var view; - - if (startIndex === endIndex) { - view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; + if (data.start.offset === data.end.offset) { + assign(data, token) } else { - view = chunks.slice(startIndex, endIndex); - - if (startBufferIndex > -1) { - view[0] = view[0].slice(startBufferIndex); - } - - if (endBufferIndex > 0) { - view.push(chunks[endIndex].slice(0, endBufferIndex)); - } + events.splice( + eventIndex, + 0, + ['enter', token, context], + ['exit', token, context] + ) + eventIndex += 2 } - - return view; } - module.exports = sliceChunks; + eventIndex++ + } + } - /***/ - }, + return events +} - /***/ 14: /***/ (module, __unused_webpack_exports, __nccwpck_require__) => { - 'use strict'; +exports.resolver = resolver +exports.string = string +exports.text = text - var assign = __nccwpck_require__(3512); - var chunkedSplice = __nccwpck_require__(778); - var shallow = __nccwpck_require__(1479); - function subtokenize(events) { - var jumps = {}; - var index = -1; - var event; - var lineIndex; - var otherIndex; - var otherEvent; - var parameters; - var subevents; - var more; +/***/ }), - while (++index < events.length) { - while (index in jumps) { - index = jumps[index]; - } +/***/ 488: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - event = events[index]; // Add a hook for the GFM tasklist extension, which needs to know if text - // is in the first content of a list item. +"use strict"; + +var miniflat = __nccwpck_require__(9042) +var content = __nccwpck_require__(5834) +var document = __nccwpck_require__(9517) +var flow = __nccwpck_require__(9670) +var text = __nccwpck_require__(7492) +var combineExtensions = __nccwpck_require__(8602) +var createTokenizer = __nccwpck_require__(4845) +var constructs = __nccwpck_require__(289) + +function parse(options) { + var settings = options || {} + var parser = { + defined: [], + constructs: combineExtensions( + [constructs].concat(miniflat(settings.extensions)) + ), + content: create(content), + document: create(document), + flow: create(flow), + string: create(text.string), + text: create(text.text) + } + return parser + + function create(initializer) { + return creator + + function creator(from) { + return createTokenizer(parser, initializer, from) + } + } +} + +module.exports = parse + + +/***/ }), + +/***/ 6948: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var subtokenize = __nccwpck_require__(14) + +function postprocess(events) { + while (!subtokenize(events)) { + // Empty + } + + return events +} + +module.exports = postprocess + + +/***/ }), + +/***/ 5603: +/***/ ((module) => { + +"use strict"; + + +var search = /[\0\t\n\r]/g + +function preprocess() { + var start = true + var column = 1 + var buffer = '' + var atCarriageReturn + return preprocessor + + function preprocessor(value, encoding, end) { + var chunks = [] + var match + var next + var startPosition + var endPosition + var code + value = buffer + value.toString(encoding) + startPosition = 0 + buffer = '' + + if (start) { + if (value.charCodeAt(0) === 65279) { + startPosition++ + } + + start = undefined + } + + while (startPosition < value.length) { + search.lastIndex = startPosition + match = search.exec(value) + endPosition = match ? match.index : value.length + code = value.charCodeAt(endPosition) + + if (!match) { + buffer = value.slice(startPosition) + break + } + + if (code === 10 && startPosition === endPosition && atCarriageReturn) { + chunks.push(-3) + atCarriageReturn = undefined + } else { + if (atCarriageReturn) { + chunks.push(-5) + atCarriageReturn = undefined + } + + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)) + column += endPosition - startPosition + } + + if (code === 0) { + chunks.push(65533) + column++ + } else if (code === 9) { + next = Math.ceil(column / 4) * 4 + chunks.push(-2) + + while (column++ < next) chunks.push(-1) + } else if (code === 10) { + chunks.push(-4) + column = 1 + } // Must be carriage return. + else { + atCarriageReturn = true + column = 1 + } + } + + startPosition = endPosition + 1 + } + + if (end) { + if (atCarriageReturn) chunks.push(-5) + if (buffer) chunks.push(buffer) + chunks.push(null) + } + + return chunks + } +} + +module.exports = preprocess + + +/***/ }), + +/***/ 2116: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var chunkedSplice = __nccwpck_require__(778) +var chunkedPush = __nccwpck_require__(4455) +var shallow = __nccwpck_require__(1479) +var resolveAll = __nccwpck_require__(2004) +var classifyCharacter = __nccwpck_require__(1324) +var movePoint = __nccwpck_require__(6985) + +var attention = { + name: 'attention', + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +} + +function resolveAllAttention(events, context) { + var index = -1 + var open + var group + var text + var openingSequence + var closingSequence + var use + var nextEvents + var offset // Walk through all events. + // + // Note: performance of this is fine on an mb of normal markdown, but it’s + // a bottleneck for malicious stuff. + + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index // Now walk back to find an opener. + + while (open--) { + // Find a token that can open the closer. + if ( + events[open][0] === 'exit' && + events[open][1].type === 'attentionSequence' && + events[open][1]._open && // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === + context.sliceSerialize(events[index][1]).charCodeAt(0) + ) { + // If the opening can close or the closing can open, + // and the close size *is not* a multiple of three, + // but the sum of the opening and closing size *is* multiple of three, + // then don’t match. if ( - index && - event[1].type === 'chunkFlow' && - events[index - 1][1].type === 'listItemPrefix' + (events[open][1]._close || events[index][1]._open) && + (events[index][1].end.offset - events[index][1].start.offset) % 3 && + !( + (events[open][1].end.offset - + events[open][1].start.offset + + events[index][1].end.offset - + events[index][1].start.offset) % + 3 + ) ) { - subevents = event[1]._tokenizer.events; - otherIndex = 0; + continue + } // Number of markers to use from the sequence. - if ( - otherIndex < subevents.length && - subevents[otherIndex][1].type === 'lineEndingBlank' - ) { - otherIndex += 2; - } - - if ( - otherIndex < subevents.length && - subevents[otherIndex][1].type === 'content' - ) { - while (++otherIndex < subevents.length) { - if (subevents[otherIndex][1].type === 'content') { - break; - } - - if (subevents[otherIndex][1].type === 'chunkText') { - subevents[otherIndex][1].isInFirstContentOfListItem = true; - otherIndex++; - } - } - } - } // Enter. - - if (event[0] === 'enter') { - if (event[1].contentType) { - assign(jumps, subcontent(events, index)); - index = jumps[index]; - more = true; - } - } // Exit. - else if (event[1]._container || event[1]._movePreviousLineEndings) { - otherIndex = index; - lineIndex = undefined; - - while (otherIndex--) { - otherEvent = events[otherIndex]; - - if ( - otherEvent[1].type === 'lineEnding' || - otherEvent[1].type === 'lineEndingBlank' - ) { - if (otherEvent[0] === 'enter') { - if (lineIndex) { - events[lineIndex][1].type = 'lineEndingBlank'; - } - - otherEvent[1].type = 'lineEnding'; - lineIndex = otherIndex; - } - } else { - break; - } - } - - if (lineIndex) { - // Fix position. - event[1].end = shallow(events[lineIndex][1].start); // Switch container exit w/ line endings. - - parameters = events.slice(lineIndex, index); - parameters.unshift(event); - chunkedSplice( - events, - lineIndex, - index - lineIndex + 1, - parameters - ); - } + use = + events[open][1].end.offset - events[open][1].start.offset > 1 && + events[index][1].end.offset - events[index][1].start.offset > 1 + ? 2 + : 1 + openingSequence = { + type: use > 1 ? 'strongSequence' : 'emphasisSequence', + start: movePoint(shallow(events[open][1].end), -use), + end: shallow(events[open][1].end) } - } + closingSequence = { + type: use > 1 ? 'strongSequence' : 'emphasisSequence', + start: shallow(events[index][1].start), + end: movePoint(shallow(events[index][1].start), use) + } + text = { + type: use > 1 ? 'strongText' : 'emphasisText', + start: shallow(events[open][1].end), + end: shallow(events[index][1].start) + } + group = { + type: use > 1 ? 'strong' : 'emphasis', + start: shallow(openingSequence.start), + end: shallow(closingSequence.end) + } + events[open][1].end = shallow(openingSequence.start) + events[index][1].start = shallow(closingSequence.end) + nextEvents = [] // If there are more markers in the opening, add them before. - return !more; - } + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] + ]) + } // Opening. - function subcontent(events, eventIndex) { - var token = events[eventIndex][1]; - var context = events[eventIndex][2]; - var startPosition = eventIndex - 1; - var startPositions = []; - var tokenizer = - token._tokenizer || context.parser[token.contentType](token.start); - var childEvents = tokenizer.events; - var jumps = []; - var gaps = {}; - var stream; - var previous; - var index; - var entered; - var end; - var adjust; // Loop forward through the linked tokens to pass them in order to the - // subtokenizer. + nextEvents = chunkedPush(nextEvents, [ + ['enter', group, context], + ['enter', openingSequence, context], + ['exit', openingSequence, context], + ['enter', text, context] + ]) // Between. - while (token) { - // Find the position of the event for this token. - while (events[++startPosition][1] !== token) { - // Empty. + nextEvents = chunkedPush( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) // Closing. + + nextEvents = chunkedPush(nextEvents, [ + ['exit', text, context], + ['enter', closingSequence, context], + ['exit', closingSequence, context], + ['exit', group, context] + ]) // If there are more markers in the closing, add them after. + + if (events[index][1].end.offset - events[index][1].start.offset) { + offset = 2 + nextEvents = chunkedPush(nextEvents, [ + ['enter', events[index][1], context], + ['exit', events[index][1], context] + ]) + } else { + offset = 0 } - startPositions.push(startPosition); - - if (!token._tokenizer) { - stream = context.sliceStream(token); - - if (!token.next) { - stream.push(null); - } - - if (previous) { - tokenizer.defineSkip(token.start); - } - - if (token.isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = true; - } - - tokenizer.write(stream); - - if (token.isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = undefined; - } - } // Unravel the next token. - - previous = token; - token = token.next; - } // Now, loop back through all events (and linked tokens), to figure out which - // parts belong where. - - token = previous; - index = childEvents.length; - - while (index--) { - // Make sure we’ve at least seen something (final eol is part of the last - // token). - if (childEvents[index][0] === 'enter') { - entered = true; - } else if ( - // Find a void token that includes a break. - entered && - childEvents[index][1].type === childEvents[index - 1][1].type && - childEvents[index][1].start.line !== childEvents[index][1].end.line - ) { - add(childEvents.slice(index + 1, end)); - // Help GC. - token._tokenizer = token.next = undefined; - token = token.previous; - end = index + 1; - } - } - - // Help GC. - tokenizer.events = token._tokenizer = token.next = undefined; // Do head: - - add(childEvents.slice(0, end)); - index = -1; - adjust = 0; - - while (++index < jumps.length) { - gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; - adjust += jumps[index][1] - jumps[index][0] - 1; - } - - return gaps; - - function add(slice) { - var start = startPositions.pop(); - jumps.unshift([start, start + slice.length - 1]); - chunkedSplice(events, start, 2, slice); + chunkedSplice(events, open - 1, index - open + 3, nextEvents) + index = open + nextEvents.length - offset - 2 + break } } + } + } // Remove remaining sequences. - module.exports = subtokenize; + index = -1 - /***/ - }, + while (++index < events.length) { + if (events[index][1].type === 'attentionSequence') { + events[index][1].type = 'data' + } + } - /***/ 2610: /***/ (module) => { - 'use strict'; + return events +} - // We define these manually to ensure they're always copied - // even if they would move up the prototype chain - // https://nodejs.org/api/http.html#http_class_http_incomingmessage - const knownProps = [ - 'destroy', - 'setTimeout', - 'socket', - 'headers', - 'trailers', - 'rawHeaders', - 'statusCode', - 'httpVersion', - 'httpVersionMinor', - 'httpVersionMajor', - 'rawTrailers', - 'statusMessage', - ]; +function tokenizeAttention(effects, ok) { + var before = classifyCharacter(this.previous) + var marker + return start - module.exports = (fromStream, toStream) => { - const fromProps = new Set(Object.keys(fromStream).concat(knownProps)); + function start(code) { + effects.enter('attentionSequence') + marker = code + return sequence(code) + } - for (const prop of fromProps) { - // Don't overwrite existing properties - if (prop in toStream) { - continue; - } + function sequence(code) { + var token + var after + var open + var close - toStream[prop] = - typeof fromStream[prop] === 'function' - ? fromStream[prop].bind(fromStream) - : fromStream[prop]; - } - }; + if (code === marker) { + effects.consume(code) + return sequence + } - /***/ - }, + token = effects.exit('attentionSequence') + after = classifyCharacter(code) + open = !after || (after === 2 && before) + close = !before || (before === 2 && after) + token._open = marker === 42 ? open : open && (before || !close) + token._close = marker === 42 ? close : close && (after || !open) + return ok(code) + } +} - /***/ 7952: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; +module.exports = attention - // TODO: Use the `URL` global when targeting Node.js 10 - const URLParser = - typeof URL === 'undefined' ? __nccwpck_require__(8835).URL : URL; - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain'; - const DATA_URL_DEFAULT_CHARSET = 'us-ascii'; +/***/ }), - const testParameter = (name, filters) => { - return filters.some((filter) => - filter instanceof RegExp ? filter.test(name) : filter === name - ); - }; +/***/ 6681: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - const normalizeDataURL = (urlString, { stripHash }) => { - const parts = urlString.match(/^data:(.*?),(.*?)(?:#(.*))?$/); +"use strict"; - if (!parts) { - throw new Error(`Invalid URL: ${urlString}`); + +var asciiAlphanumeric = __nccwpck_require__(598) +var asciiAlpha = __nccwpck_require__(3847) +var asciiAtext = __nccwpck_require__(245) +var asciiControl = __nccwpck_require__(1336) + +var autolink = { + name: 'autolink', + tokenize: tokenizeAutolink +} + +function tokenizeAutolink(effects, ok, nok) { + var size = 1 + return start + + function start(code) { + effects.enter('autolink') + effects.enter('autolinkMarker') + effects.consume(code) + effects.exit('autolinkMarker') + effects.enter('autolinkProtocol') + return open + } + + function open(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return schemeOrEmailAtext + } + + return asciiAtext(code) ? emailAtext(code) : nok(code) + } + + function schemeOrEmailAtext(code) { + return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) + ? schemeInsideOrEmailAtext(code) + : emailAtext(code) + } + + function schemeInsideOrEmailAtext(code) { + if (code === 58) { + effects.consume(code) + return urlInside + } + + if ( + (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && + size++ < 32 + ) { + effects.consume(code) + return schemeInsideOrEmailAtext + } + + return emailAtext(code) + } + + function urlInside(code) { + if (code === 62) { + effects.exit('autolinkProtocol') + return end(code) + } + + if (code === 32 || code === 60 || asciiControl(code)) { + return nok(code) + } + + effects.consume(code) + return urlInside + } + + function emailAtext(code) { + if (code === 64) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (asciiAtext(code)) { + effects.consume(code) + return emailAtext + } + + return nok(code) + } + + function emailAtSignOrDot(code) { + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) + } + + function emailLabel(code) { + if (code === 46) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (code === 62) { + // Exit, then change the type. + effects.exit('autolinkProtocol').type = 'autolinkEmail' + return end(code) + } + + return emailValue(code) + } + + function emailValue(code) { + if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { + effects.consume(code) + return code === 45 ? emailValue : emailLabel + } + + return nok(code) + } + + function end(code) { + effects.enter('autolinkMarker') + effects.consume(code) + effects.exit('autolinkMarker') + effects.exit('autolink') + return ok + } +} + +module.exports = autolink + + +/***/ }), + +/***/ 9025: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownSpace = __nccwpck_require__(5989) +var factorySpace = __nccwpck_require__(8200) + +var blockQuote = { + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart, + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit: exit +} + +function tokenizeBlockQuoteStart(effects, ok, nok) { + var self = this + return start + + function start(code) { + if (code === 62) { + if (!self.containerState.open) { + effects.enter('blockQuote', { + _container: true + }) + self.containerState.open = true + } + + effects.enter('blockQuotePrefix') + effects.enter('blockQuoteMarker') + effects.consume(code) + effects.exit('blockQuoteMarker') + return after + } + + return nok(code) + } + + function after(code) { + if (markdownSpace(code)) { + effects.enter('blockQuotePrefixWhitespace') + effects.consume(code) + effects.exit('blockQuotePrefixWhitespace') + effects.exit('blockQuotePrefix') + return ok + } + + effects.exit('blockQuotePrefix') + return ok(code) + } +} + +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(blockQuote, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +function exit(effects) { + effects.exit('blockQuote') +} + +module.exports = blockQuote + + +/***/ }), + +/***/ 7128: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var asciiPunctuation = __nccwpck_require__(7909) + +var characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +} + +function tokenizeCharacterEscape(effects, ok, nok) { + return start + + function start(code) { + effects.enter('characterEscape') + effects.enter('escapeMarker') + effects.consume(code) + effects.exit('escapeMarker') + return open + } + + function open(code) { + if (asciiPunctuation(code)) { + effects.enter('characterEscapeValue') + effects.consume(code) + effects.exit('characterEscapeValue') + effects.exit('characterEscape') + return ok + } + + return nok(code) + } +} + +module.exports = characterEscape + + +/***/ }), + +/***/ 9500: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var decodeEntity = __nccwpck_require__(3485) +var asciiAlphanumeric = __nccwpck_require__(598) +var asciiDigit = __nccwpck_require__(6996) +var asciiHexDigit = __nccwpck_require__(6526) + +function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} +} + +var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy(decodeEntity) + +var characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference +} + +function tokenizeCharacterReference(effects, ok, nok) { + var self = this + var size = 0 + var max + var test + return start + + function start(code) { + effects.enter('characterReference') + effects.enter('characterReferenceMarker') + effects.consume(code) + effects.exit('characterReferenceMarker') + return open + } + + function open(code) { + if (code === 35) { + effects.enter('characterReferenceMarkerNumeric') + effects.consume(code) + effects.exit('characterReferenceMarkerNumeric') + return numeric + } + + effects.enter('characterReferenceValue') + max = 31 + test = asciiAlphanumeric + return value(code) + } + + function numeric(code) { + if (code === 88 || code === 120) { + effects.enter('characterReferenceMarkerHexadecimal') + effects.consume(code) + effects.exit('characterReferenceMarkerHexadecimal') + effects.enter('characterReferenceValue') + max = 6 + test = asciiHexDigit + return value + } + + effects.enter('characterReferenceValue') + max = 7 + test = asciiDigit + return value(code) + } + + function value(code) { + var token + + if (code === 59 && size) { + token = effects.exit('characterReferenceValue') + + if ( + test === asciiAlphanumeric && + !decodeEntity__default['default'](self.sliceSerialize(token)) + ) { + return nok(code) + } + + effects.enter('characterReferenceMarker') + effects.consume(code) + effects.exit('characterReferenceMarker') + effects.exit('characterReference') + return ok + } + + if (test(code) && size++ < max) { + effects.consume(code) + return value + } + + return nok(code) + } +} + +module.exports = characterReference + + +/***/ }), + +/***/ 3268: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) +var prefixSize = __nccwpck_require__(3722) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) + +var codeFenced = { + name: 'codeFenced', + tokenize: tokenizeCodeFenced, + concrete: true +} + +function tokenizeCodeFenced(effects, ok, nok) { + var self = this + var closingFenceConstruct = { + tokenize: tokenizeClosingFence, + partial: true + } + var initialPrefix = prefixSize(this.events, 'linePrefix') + var sizeOpen = 0 + var marker + return start + + function start(code) { + effects.enter('codeFenced') + effects.enter('codeFencedFence') + effects.enter('codeFencedFenceSequence') + marker = code + return sequenceOpen(code) + } + + function sequenceOpen(code) { + if (code === marker) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + effects.exit('codeFencedFenceSequence') + return sizeOpen < 3 + ? nok(code) + : factorySpace(effects, infoOpen, 'whitespace')(code) + } + + function infoOpen(code) { + if (code === null || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter('codeFencedFenceInfo') + effects.enter('chunkString', { + contentType: 'string' + }) + return info(code) + } + + function info(code) { + if (code === null || markdownLineEndingOrSpace(code)) { + effects.exit('chunkString') + effects.exit('codeFencedFenceInfo') + return factorySpace(effects, infoAfter, 'whitespace')(code) + } + + if (code === 96 && code === marker) return nok(code) + effects.consume(code) + return info + } + + function infoAfter(code) { + if (code === null || markdownLineEnding(code)) { + return openAfter(code) + } + + effects.enter('codeFencedFenceMeta') + effects.enter('chunkString', { + contentType: 'string' + }) + return meta(code) + } + + function meta(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('chunkString') + effects.exit('codeFencedFenceMeta') + return openAfter(code) + } + + if (code === 96 && code === marker) return nok(code) + effects.consume(code) + return meta + } + + function openAfter(code) { + effects.exit('codeFencedFence') + return self.interrupt ? ok(code) : content(code) + } + + function content(code) { + if (code === null) { + return after(code) + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return effects.attempt( + closingFenceConstruct, + after, + initialPrefix + ? factorySpace(effects, content, 'linePrefix', initialPrefix + 1) + : content + ) + } + + effects.enter('codeFlowValue') + return contentContinue(code) + } + + function contentContinue(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('codeFlowValue') + return content(code) + } + + effects.consume(code) + return contentContinue + } + + function after(code) { + effects.exit('codeFenced') + return ok(code) + } + + function tokenizeClosingFence(effects, ok, nok) { + var size = 0 + return factorySpace( + effects, + closingSequenceStart, + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) + + function closingSequenceStart(code) { + effects.enter('codeFencedFence') + effects.enter('codeFencedFenceSequence') + return closingSequence(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return closingSequence + } + + if (size < sizeOpen) return nok(code) + effects.exit('codeFencedFenceSequence') + return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) + } + + function closingSequenceEnd(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('codeFencedFence') + return ok(code) + } + + return nok(code) + } + } +} + +module.exports = codeFenced + + +/***/ }), + +/***/ 907: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var chunkedSplice = __nccwpck_require__(778) +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) +var prefixSize = __nccwpck_require__(3722) + +var codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented, + resolve: resolveCodeIndented +} +var indentedContentConstruct = { + tokenize: tokenizeIndentedContent, + partial: true +} + +function resolveCodeIndented(events, context) { + var code = { + type: 'codeIndented', + start: events[0][1].start, + end: events[events.length - 1][1].end + } + chunkedSplice(events, 0, 0, [['enter', code, context]]) + chunkedSplice(events, events.length, 0, [['exit', code, context]]) + return events +} + +function tokenizeCodeIndented(effects, ok, nok) { + return effects.attempt(indentedContentConstruct, afterPrefix, nok) + + function afterPrefix(code) { + if (code === null) { + return ok(code) + } + + if (markdownLineEnding(code)) { + return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) + } + + effects.enter('codeFlowValue') + return content(code) + } + + function content(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('codeFlowValue') + return afterPrefix(code) + } + + effects.consume(code) + return content + } +} + +function tokenizeIndentedContent(effects, ok, nok) { + var self = this + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) + + function afterPrefix(code) { + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) + } + + return prefixSize(self.events, 'linePrefix') < 4 ? nok(code) : ok(code) + } +} + +module.exports = codeIndented + + +/***/ }), + +/***/ 7033: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) + +var codeText = { + name: 'codeText', + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous: previous +} + +function resolveCodeText(events) { + var tailExitIndex = events.length - 4 + var headEnterIndex = 3 + var index + var enter // If we start and end with an EOL or a space. + + if ( + (events[headEnterIndex][1].type === 'lineEnding' || + events[headEnterIndex][1].type === 'space') && + (events[tailExitIndex][1].type === 'lineEnding' || + events[tailExitIndex][1].type === 'space') + ) { + index = headEnterIndex // And we have data. + + while (++index < tailExitIndex) { + if (events[index][1].type === 'codeTextData') { + // Then we have padding. + events[tailExitIndex][1].type = events[headEnterIndex][1].type = + 'codeTextPadding' + headEnterIndex += 2 + tailExitIndex -= 2 + break + } + } + } // Merge adjacent spaces and data. + + index = headEnterIndex - 1 + tailExitIndex++ + + while (++index <= tailExitIndex) { + if (enter === undefined) { + if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { + enter = index + } + } else if ( + index === tailExitIndex || + events[index][1].type === 'lineEnding' + ) { + events[enter][1].type = 'codeTextData' + + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + tailExitIndex -= index - enter - 2 + index = enter + 2 + } + + enter = undefined + } + } + + return events +} + +function previous(code) { + // If there is a previous code, there will always be a tail. + return ( + code !== 96 || + this.events[this.events.length - 1][1].type === 'characterEscape' + ) +} + +function tokenizeCodeText(effects, ok, nok) { + var sizeOpen = 0 + var size + var token + return start + + function start(code) { + effects.enter('codeText') + effects.enter('codeTextSequence') + return openingSequence(code) + } + + function openingSequence(code) { + if (code === 96) { + effects.consume(code) + sizeOpen++ + return openingSequence + } + + effects.exit('codeTextSequence') + return gap(code) + } + + function gap(code) { + // EOF. + if (code === null) { + return nok(code) + } // Closing fence? + // Could also be data. + + if (code === 96) { + token = effects.enter('codeTextSequence') + size = 0 + return closingSequence(code) + } // Tabs don’t work, and virtual spaces don’t make sense. + + if (code === 32) { + effects.enter('space') + effects.consume(code) + effects.exit('space') + return gap + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return gap + } // Data. + + effects.enter('codeTextData') + return data(code) + } // In code. + + function data(code) { + if ( + code === null || + code === 32 || + code === 96 || + markdownLineEnding(code) + ) { + effects.exit('codeTextData') + return gap(code) + } + + effects.consume(code) + return data + } // Closing fence. + + function closingSequence(code) { + // More. + if (code === 96) { + effects.consume(code) + size++ + return closingSequence + } // Done! + + if (size === sizeOpen) { + effects.exit('codeTextSequence') + effects.exit('codeText') + return ok(code) + } // More or less accents: mark as data. + + token.type = 'codeTextData' + return data(code) + } +} + +module.exports = codeText + + +/***/ }), + +/***/ 1259: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) +var prefixSize = __nccwpck_require__(3722) +var subtokenize = __nccwpck_require__(14) + +// No name because it must not be turned off. +var content = { + tokenize: tokenizeContent, + resolve: resolveContent, + interruptible: true, + lazy: true +} +var continuationConstruct = { + tokenize: tokenizeContinuation, + partial: true +} // Content is transparent: it’s parsed right now. That way, definitions are also +// parsed right now: before text in paragraphs (specifically, media) are parsed. + +function resolveContent(events) { + subtokenize(events) + return events +} + +function tokenizeContent(effects, ok) { + var previous + return start + + function start(code) { + effects.enter('content') + previous = effects.enter('chunkContent', { + contentType: 'content' + }) + return data(code) + } + + function data(code) { + if (code === null) { + return contentEnd(code) + } + + if (markdownLineEnding(code)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code) + } // Data. + + effects.consume(code) + return data + } + + function contentEnd(code) { + effects.exit('chunkContent') + effects.exit('content') + return ok(code) + } + + function contentContinue(code) { + effects.consume(code) + effects.exit('chunkContent') + previous = previous.next = effects.enter('chunkContent', { + contentType: 'content', + previous: previous + }) + return data + } +} + +function tokenizeContinuation(effects, ok, nok) { + var self = this + return startLookahead + + function startLookahead(code) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, prefixed, 'linePrefix') + } + + function prefixed(code) { + if (code === null || markdownLineEnding(code)) { + return nok(code) + } + + if ( + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || + prefixSize(self.events, 'linePrefix') < 4 + ) { + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) + } + + return ok(code) + } +} + +module.exports = content + + +/***/ }), + +/***/ 1193: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var normalizeIdentifier = __nccwpck_require__(712) +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) +var factoryDestination = __nccwpck_require__(9851) +var factoryLabel = __nccwpck_require__(349) +var factoryWhitespace = __nccwpck_require__(3168) +var factoryTitle = __nccwpck_require__(9469) + +var definition = { + name: 'definition', + tokenize: tokenizeDefinition +} +var titleConstruct = { + tokenize: tokenizeTitle, + partial: true +} + +function tokenizeDefinition(effects, ok, nok) { + var self = this + var identifier + return start + + function start(code) { + effects.enter('definition') + return factoryLabel.call( + self, + effects, + labelAfter, + nok, + 'definitionLabel', + 'definitionLabelMarker', + 'definitionLabelString' + )(code) + } + + function labelAfter(code) { + identifier = normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + + if (code === 58) { + effects.enter('definitionMarker') + effects.consume(code) + effects.exit('definitionMarker') // Note: blank lines can’t exist in content. + + return factoryWhitespace( + effects, + factoryDestination( + effects, + effects.attempt( + titleConstruct, + factorySpace(effects, after, 'whitespace'), + factorySpace(effects, after, 'whitespace') + ), + nok, + 'definitionDestination', + 'definitionDestinationLiteral', + 'definitionDestinationLiteralMarker', + 'definitionDestinationRaw', + 'definitionDestinationString' + ) + ) + } + + return nok(code) + } + + function after(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('definition') + + if (self.parser.defined.indexOf(identifier) < 0) { + self.parser.defined.push(identifier) + } + + return ok(code) + } + + return nok(code) + } +} + +function tokenizeTitle(effects, ok, nok) { + return start + + function start(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, before)(code) + : nok(code) + } + + function before(code) { + if (code === 34 || code === 39 || code === 40) { + return factoryTitle( + effects, + factorySpace(effects, after, 'whitespace'), + nok, + 'definitionTitle', + 'definitionTitleMarker', + 'definitionTitleString' + )(code) + } + + return nok(code) + } + + function after(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code) + } +} + +module.exports = definition + + +/***/ }), + +/***/ 9851: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) +var asciiControl = __nccwpck_require__(1336) + +// eslint-disable-next-line max-params +function destinationFactory( + effects, + ok, + nok, + type, + literalType, + literalMarkerType, + rawType, + stringType, + max +) { + var limit = max || Infinity + var balance = 0 + return start + + function start(code) { + if (code === 60) { + effects.enter(type) + effects.enter(literalType) + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + return destinationEnclosedBefore + } + + if (asciiControl(code)) { + return nok(code) + } + + effects.enter(type) + effects.enter(rawType) + effects.enter(stringType) + effects.enter('chunkString', { + contentType: 'string' + }) + return destinationRaw(code) + } + + function destinationEnclosedBefore(code) { + if (code === 62) { + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + effects.exit(literalType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + effects.enter('chunkString', { + contentType: 'string' + }) + return destinationEnclosed(code) + } + + function destinationEnclosed(code) { + if (code === 62) { + effects.exit('chunkString') + effects.exit(stringType) + return destinationEnclosedBefore(code) + } + + if (code === null || code === 60 || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return code === 92 ? destinationEnclosedEscape : destinationEnclosed + } + + function destinationEnclosedEscape(code) { + if (code === 60 || code === 62 || code === 92) { + effects.consume(code) + return destinationEnclosed + } + + return destinationEnclosed(code) + } + + function destinationRaw(code) { + if (code === 40) { + if (++balance > limit) return nok(code) + effects.consume(code) + return destinationRaw + } + + if (code === 41) { + if (!balance--) { + effects.exit('chunkString') + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + effects.consume(code) + return destinationRaw + } + + if (code === null || markdownLineEndingOrSpace(code)) { + if (balance) return nok(code) + effects.exit('chunkString') + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + if (asciiControl(code)) return nok(code) + effects.consume(code) + return code === 92 ? destinationRawEscape : destinationRaw + } + + function destinationRawEscape(code) { + if (code === 40 || code === 41 || code === 92) { + effects.consume(code) + return destinationRaw + } + + return destinationRaw(code) + } +} + +module.exports = destinationFactory + + +/***/ }), + +/***/ 349: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var markdownSpace = __nccwpck_require__(5989) + +// eslint-disable-next-line max-params +function labelFactory(effects, ok, nok, type, markerType, stringType) { + var self = this + var size = 0 + var data + return start + + function start(code) { + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.enter(stringType) + return atBreak + } + + function atBreak(code) { + if ( + code === null || + code === 91 || + (code === 93 && !data) || + /* c8 ignore next */ + (code === 94 && + /* c8 ignore next */ + !size && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs) || + size > 999 + ) { + return nok(code) + } + + if (code === 93) { + effects.exit(stringType) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return atBreak + } + + effects.enter('chunkString', { + contentType: 'string' + }) + return label(code) + } + + function label(code) { + if ( + code === null || + code === 91 || + code === 93 || + markdownLineEnding(code) || + size++ > 999 + ) { + effects.exit('chunkString') + return atBreak(code) + } + + effects.consume(code) + data = data || !markdownSpace(code) + return code === 92 ? labelEscape : label + } + + function labelEscape(code) { + if (code === 91 || code === 92 || code === 93) { + effects.consume(code) + size++ + return label + } + + return label(code) + } +} + +module.exports = labelFactory + + +/***/ }), + +/***/ 8200: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownSpace = __nccwpck_require__(5989) + +function spaceFactory(effects, ok, type, max) { + var limit = max ? max - 1 : Infinity + var size = 0 + return start + + function start(code) { + if (markdownSpace(code)) { + effects.enter(type) + return prefix(code) + } + + return ok(code) + } + + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code) + return prefix + } + + effects.exit(type) + return ok(code) + } +} + +module.exports = spaceFactory + + +/***/ }), + +/***/ 9469: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) + +function titleFactory(effects, ok, nok, type, markerType, stringType) { + var marker + return start + + function start(code) { + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + marker = code === 40 ? 41 : code + return atFirstTitleBreak + } + + function atFirstTitleBreak(code) { + if (code === marker) { + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + return atTitleBreak(code) + } + + function atTitleBreak(code) { + if (code === marker) { + effects.exit(stringType) + return atFirstTitleBreak(marker) + } + + if (code === null) { + return nok(code) + } // Note: blank lines can’t exist in content. + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, atTitleBreak, 'linePrefix') + } + + effects.enter('chunkString', { + contentType: 'string' + }) + return title(code) + } + + function title(code) { + if (code === marker || code === null || markdownLineEnding(code)) { + effects.exit('chunkString') + return atTitleBreak(code) + } + + effects.consume(code) + return code === 92 ? titleEscape : title + } + + function titleEscape(code) { + if (code === marker || code === 92) { + effects.consume(code) + return title + } + + return title(code) + } +} + +module.exports = titleFactory + + +/***/ }), + +/***/ 3168: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var markdownSpace = __nccwpck_require__(5989) +var factorySpace = __nccwpck_require__(8200) + +function whitespaceFactory(effects, ok) { + var seen + return start + + function start(code) { + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + seen = true + return start + } + + if (markdownSpace(code)) { + return factorySpace( + effects, + start, + seen ? 'linePrefix' : 'lineSuffix' + )(code) + } + + return ok(code) + } +} + +module.exports = whitespaceFactory + + +/***/ }), + +/***/ 7608: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) + +var hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +} + +function tokenizeHardBreakEscape(effects, ok, nok) { + return start + + function start(code) { + effects.enter('hardBreakEscape') + effects.enter('escapeMarker') + effects.consume(code) + return open + } + + function open(code) { + if (markdownLineEnding(code)) { + effects.exit('escapeMarker') + effects.exit('hardBreakEscape') + return ok(code) + } + + return nok(code) + } +} + +module.exports = hardBreakEscape + + +/***/ }), + +/***/ 4558: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var chunkedSplice = __nccwpck_require__(778) +var markdownLineEnding = __nccwpck_require__(7506) +var markdownSpace = __nccwpck_require__(5989) +var factorySpace = __nccwpck_require__(8200) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) + +var headingAtx = { + name: 'headingAtx', + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx +} + +function resolveHeadingAtx(events, context) { + var contentEnd = events.length - 2 + var contentStart = 3 + var content + var text // Prefix whitespace, part of the opening. + + if (events[contentStart][1].type === 'whitespace') { + contentStart += 2 + } // Suffix whitespace, part of the closing. + + if ( + contentEnd - 2 > contentStart && + events[contentEnd][1].type === 'whitespace' + ) { + contentEnd -= 2 + } + + if ( + events[contentEnd][1].type === 'atxHeadingSequence' && + (contentStart === contentEnd - 1 || + (contentEnd - 4 > contentStart && + events[contentEnd - 2][1].type === 'whitespace')) + ) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 + } + + if (contentEnd > contentStart) { + content = { + type: 'atxHeadingText', + start: events[contentStart][1].start, + end: events[contentEnd][1].end + } + text = { + type: 'chunkText', + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: 'text' + } + chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [ + ['enter', content, context], + ['enter', text, context], + ['exit', text, context], + ['exit', content, context] + ]) + } + + return events +} + +function tokenizeHeadingAtx(effects, ok, nok) { + var self = this + var size = 0 + return start + + function start(code) { + effects.enter('atxHeading') + effects.enter('atxHeadingSequence') + return fenceOpenInside(code) + } + + function fenceOpenInside(code) { + if (code === 35 && size++ < 6) { + effects.consume(code) + return fenceOpenInside + } + + if (code === null || markdownLineEndingOrSpace(code)) { + effects.exit('atxHeadingSequence') + return self.interrupt ? ok(code) : headingBreak(code) + } + + return nok(code) + } + + function headingBreak(code) { + if (code === 35) { + effects.enter('atxHeadingSequence') + return sequence(code) + } + + if (code === null || markdownLineEnding(code)) { + effects.exit('atxHeading') + return ok(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, headingBreak, 'whitespace')(code) + } + + effects.enter('atxHeadingText') + return data(code) + } + + function sequence(code) { + if (code === 35) { + effects.consume(code) + return sequence + } + + effects.exit('atxHeadingSequence') + return headingBreak(code) + } + + function data(code) { + if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { + effects.exit('atxHeadingText') + return headingBreak(code) + } + + effects.consume(code) + return data + } +} + +module.exports = headingAtx + + +/***/ }), + +/***/ 6791: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var fromCharCode = __nccwpck_require__(3531) +var asciiAlphanumeric = __nccwpck_require__(598) +var markdownLineEnding = __nccwpck_require__(7506) +var markdownSpace = __nccwpck_require__(5989) +var partialBlankLine = __nccwpck_require__(2244) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) +var asciiAlpha = __nccwpck_require__(3847) +var htmlBlockNames = __nccwpck_require__(5159) +var htmlRawNames = __nccwpck_require__(4677) + +var htmlFlow = { + name: 'htmlFlow', + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +} +var nextBlankConstruct = { + tokenize: tokenizeNextBlank, + partial: true +} + +function resolveToHtmlFlow(events) { + var index = events.length + + while (index--) { + if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { + break + } + } + + if (index > 1 && events[index - 2][1].type === 'linePrefix') { + // Add the prefix start to the HTML token. + events[index][1].start = events[index - 2][1].start // Add the prefix start to the HTML line token. + + events[index + 1][1].start = events[index - 2][1].start // Remove the line prefix. + + events.splice(index - 2, 2) + } + + return events +} + +function tokenizeHtmlFlow(effects, ok, nok) { + var self = this + var kind + var startTag + var buffer + var index + var marker + return start + + function start(code) { + effects.enter('htmlFlow') + effects.enter('htmlFlowData') + effects.consume(code) + return open + } + + function open(code) { + if (code === 33) { + effects.consume(code) + return declarationStart + } + + if (code === 47) { + effects.consume(code) + return tagCloseStart + } + + if (code === 63) { + effects.consume(code) + kind = 3 // While we’re in an instruction instead of a declaration, we’re on a `?` + // right now, so we do need to search for `>`, similar to declarations. + + return self.interrupt ? ok : continuationDeclarationInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + startTag = true + return tagName + } + + return nok(code) + } + + function declarationStart(code) { + if (code === 45) { + effects.consume(code) + kind = 2 + return commentOpenInside + } + + if (code === 91) { + effects.consume(code) + kind = 5 + buffer = 'CDATA[' + index = 0 + return cdataOpenInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + kind = 4 + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function commentOpenInside(code) { + if (code === 45) { + effects.consume(code) + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + function cdataOpenInside(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length + ? self.interrupt + ? ok + : continuation + : cdataOpenInside + } + + return nok(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + buffer = fromCharCode(code) + return tagName + } + + return nok(code) + } + + function tagName(code) { + if ( + code === null || + code === 47 || + code === 62 || + markdownLineEndingOrSpace(code) + ) { + if ( + code !== 47 && + startTag && + htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + ) { + kind = 1 + return self.interrupt ? ok(code) : continuation(code) + } + + if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { + kind = 6 + + if (code === 47) { + effects.consume(code) + return basicSelfClosing } - const mediaType = parts[1].split(';'); - const body = parts[2]; - const hash = stripHash ? '' : parts[3]; + return self.interrupt ? ok(code) : continuation(code) + } - let base64 = false; + kind = 7 // Do not support complete HTML when interrupting. - if (mediaType[mediaType.length - 1] === 'base64') { - mediaType.pop(); - base64 = true; + return self.interrupt + ? nok(code) + : startTag + ? completeAttributeNameBefore(code) + : completeClosingTagAfter(code) + } + + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code) + buffer += fromCharCode(code) + return tagName + } + + return nok(code) + } + + function basicSelfClosing(code) { + if (code === 62) { + effects.consume(code) + return self.interrupt ? ok : continuation + } + + return nok(code) + } + + function completeClosingTagAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeClosingTagAfter + } + + return completeEnd(code) + } + + function completeAttributeNameBefore(code) { + if (code === 47) { + effects.consume(code) + return completeEnd + } + + if (code === 58 || code === 95 || asciiAlpha(code)) { + effects.consume(code) + return completeAttributeName + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameBefore + } + + return completeEnd(code) + } + + function completeAttributeName(code) { + if ( + code === 45 || + code === 46 || + code === 58 || + code === 95 || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return completeAttributeName + } + + return completeAttributeNameAfter(code) + } + + function completeAttributeNameAfter(code) { + if (code === 61) { + effects.consume(code) + return completeAttributeValueBefore + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameAfter + } + + return completeAttributeNameBefore(code) + } + + function completeAttributeValueBefore(code) { + if ( + code === null || + code === 60 || + code === 61 || + code === 62 || + code === 96 + ) { + return nok(code) + } + + if (code === 34 || code === 39) { + effects.consume(code) + marker = code + return completeAttributeValueQuoted + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeValueBefore + } + + marker = undefined + return completeAttributeValueUnquoted(code) + } + + function completeAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return completeAttributeValueQuotedAfter + } + + if (code === null || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return completeAttributeValueQuoted + } + + function completeAttributeValueUnquoted(code) { + if ( + code === null || + code === 34 || + code === 39 || + code === 60 || + code === 61 || + code === 62 || + code === 96 || + markdownLineEndingOrSpace(code) + ) { + return completeAttributeNameAfter(code) + } + + effects.consume(code) + return completeAttributeValueUnquoted + } + + function completeAttributeValueQuotedAfter(code) { + if (code === 47 || code === 62 || markdownSpace(code)) { + return completeAttributeNameBefore(code) + } + + return nok(code) + } + + function completeEnd(code) { + if (code === 62) { + effects.consume(code) + return completeAfter + } + + return nok(code) + } + + function completeAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeAfter + } + + return code === null || markdownLineEnding(code) + ? continuation(code) + : nok(code) + } + + function continuation(code) { + if (code === 45 && kind === 2) { + effects.consume(code) + return continuationCommentInside + } + + if (code === 60 && kind === 1) { + effects.consume(code) + return continuationRawTagOpen + } + + if (code === 62 && kind === 4) { + effects.consume(code) + return continuationClose + } + + if (code === 63 && kind === 3) { + effects.consume(code) + return continuationDeclarationInside + } + + if (code === 93 && kind === 5) { + effects.consume(code) + return continuationCharacterDataInside + } + + if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { + return effects.check( + nextBlankConstruct, + continuationClose, + continuationAtLineEnding + )(code) + } + + if (code === null || markdownLineEnding(code)) { + return continuationAtLineEnding(code) + } + + effects.consume(code) + return continuation + } + + function continuationAtLineEnding(code) { + effects.exit('htmlFlowData') + return htmlContinueStart(code) + } + + function htmlContinueStart(code) { + if (code === null) { + return done(code) + } + + if (markdownLineEnding(code)) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return htmlContinueStart + } + + effects.enter('htmlFlowData') + return continuation(code) + } + + function continuationCommentInside(code) { + if (code === 45) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationRawTagOpen(code) { + if (code === 47) { + effects.consume(code) + buffer = '' + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationRawEndTag(code) { + if (code === 62 && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { + effects.consume(code) + return continuationClose + } + + if (asciiAlpha(code) && buffer.length < 8) { + effects.consume(code) + buffer += fromCharCode(code) + return continuationRawEndTag + } + + return continuation(code) + } + + function continuationCharacterDataInside(code) { + if (code === 93) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + function continuationDeclarationInside(code) { + if (code === 62) { + effects.consume(code) + return continuationClose + } + + return continuation(code) + } + + function continuationClose(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('htmlFlowData') + return done(code) + } + + effects.consume(code) + return continuationClose + } + + function done(code) { + effects.exit('htmlFlow') + return ok(code) + } +} + +function tokenizeNextBlank(effects, ok, nok) { + return start + + function start(code) { + effects.exit('htmlFlowData') + effects.enter('lineEndingBlank') + effects.consume(code) + effects.exit('lineEndingBlank') + return effects.attempt(partialBlankLine, ok, nok) + } +} + +module.exports = htmlFlow + + +/***/ }), + +/***/ 7743: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var asciiAlphanumeric = __nccwpck_require__(598) +var markdownLineEnding = __nccwpck_require__(7506) +var markdownSpace = __nccwpck_require__(5989) +var factorySpace = __nccwpck_require__(8200) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) +var asciiAlpha = __nccwpck_require__(3847) + +var htmlText = { + name: 'htmlText', + tokenize: tokenizeHtmlText +} + +function tokenizeHtmlText(effects, ok, nok) { + var self = this + var marker + var buffer + var index + var returnState + return start + + function start(code) { + effects.enter('htmlText') + effects.enter('htmlTextData') + effects.consume(code) + return open + } + + function open(code) { + if (code === 33) { + effects.consume(code) + return declarationOpen + } + + if (code === 47) { + effects.consume(code) + return tagCloseStart + } + + if (code === 63) { + effects.consume(code) + return instruction + } + + if (asciiAlpha(code)) { + effects.consume(code) + return tagOpen + } + + return nok(code) + } + + function declarationOpen(code) { + if (code === 45) { + effects.consume(code) + return commentOpen + } + + if (code === 91) { + effects.consume(code) + buffer = 'CDATA[' + index = 0 + return cdataOpen + } + + if (asciiAlpha(code)) { + effects.consume(code) + return declaration + } + + return nok(code) + } + + function commentOpen(code) { + if (code === 45) { + effects.consume(code) + return commentStart + } + + return nok(code) + } + + function commentStart(code) { + if (code === null || code === 62) { + return nok(code) + } + + if (code === 45) { + effects.consume(code) + return commentStartDash + } + + return comment(code) + } + + function commentStartDash(code) { + if (code === null || code === 62) { + return nok(code) + } + + return comment(code) + } + + function comment(code) { + if (code === null) { + return nok(code) + } + + if (code === 45) { + effects.consume(code) + return commentClose + } + + if (markdownLineEnding(code)) { + returnState = comment + return atLineEnding(code) + } + + effects.consume(code) + return comment + } + + function commentClose(code) { + if (code === 45) { + effects.consume(code) + return end + } + + return comment(code) + } + + function cdataOpen(code) { + if (code === buffer.charCodeAt(index++)) { + effects.consume(code) + return index === buffer.length ? cdata : cdataOpen + } + + return nok(code) + } + + function cdata(code) { + if (code === null) { + return nok(code) + } + + if (code === 93) { + effects.consume(code) + return cdataClose + } + + if (markdownLineEnding(code)) { + returnState = cdata + return atLineEnding(code) + } + + effects.consume(code) + return cdata + } + + function cdataClose(code) { + if (code === 93) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function cdataEnd(code) { + if (code === 62) { + return end(code) + } + + if (code === 93) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + function declaration(code) { + if (code === null || code === 62) { + return end(code) + } + + if (markdownLineEnding(code)) { + returnState = declaration + return atLineEnding(code) + } + + effects.consume(code) + return declaration + } + + function instruction(code) { + if (code === null) { + return nok(code) + } + + if (code === 63) { + effects.consume(code) + return instructionClose + } + + if (markdownLineEnding(code)) { + returnState = instruction + return atLineEnding(code) + } + + effects.consume(code) + return instruction + } + + function instructionClose(code) { + return code === 62 ? end(code) : instruction(code) + } + + function tagCloseStart(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return tagClose + } + + return nok(code) + } + + function tagClose(code) { + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code) + return tagClose + } + + return tagCloseBetween(code) + } + + function tagCloseBetween(code) { + if (markdownLineEnding(code)) { + returnState = tagCloseBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagCloseBetween + } + + return end(code) + } + + function tagOpen(code) { + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code) + return tagOpen + } + + if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenBetween(code) { + if (code === 47) { + effects.consume(code) + return end + } + + if (code === 58 || code === 95 || asciiAlpha(code)) { + effects.consume(code) + return tagOpenAttributeName + } + + if (markdownLineEnding(code)) { + returnState = tagOpenBetween + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenBetween + } + + return end(code) + } + + function tagOpenAttributeName(code) { + if ( + code === 45 || + code === 46 || + code === 58 || + code === 95 || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return tagOpenAttributeName + } + + return tagOpenAttributeNameAfter(code) + } + + function tagOpenAttributeNameAfter(code) { + if (code === 61) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeNameAfter + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeNameAfter + } + + return tagOpenBetween(code) + } + + function tagOpenAttributeValueBefore(code) { + if ( + code === null || + code === 60 || + code === 61 || + code === 62 || + code === 96 + ) { + return nok(code) + } + + if (code === 34 || code === 39) { + effects.consume(code) + marker = code + return tagOpenAttributeValueQuoted + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueBefore + return atLineEnding(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + effects.consume(code) + marker = undefined + return tagOpenAttributeValueUnquoted + } + + function tagOpenAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + return tagOpenAttributeValueQuotedAfter + } + + if (code === null) { + return nok(code) + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueQuoted + return atLineEnding(code) + } + + effects.consume(code) + return tagOpenAttributeValueQuoted + } + + function tagOpenAttributeValueQuotedAfter(code) { + if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + return nok(code) + } + + function tagOpenAttributeValueUnquoted(code) { + if ( + code === null || + code === 34 || + code === 39 || + code === 60 || + code === 61 || + code === 96 + ) { + return nok(code) + } + + if (code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code) + } + + effects.consume(code) + return tagOpenAttributeValueUnquoted + } // We can’t have blank lines in content, so no need to worry about empty + // tokens. + + function atLineEnding(code) { + effects.exit('htmlTextData') + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace( + effects, + afterPrefix, + 'linePrefix', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) + } + + function afterPrefix(code) { + effects.enter('htmlTextData') + return returnState(code) + } + + function end(code) { + if (code === 62) { + effects.consume(code) + effects.exit('htmlTextData') + effects.exit('htmlText') + return ok + } + + return nok(code) + } +} + +module.exports = htmlText + + +/***/ }), + +/***/ 9797: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var chunkedSplice = __nccwpck_require__(778) +var chunkedPush = __nccwpck_require__(4455) +var normalizeIdentifier = __nccwpck_require__(712) +var shallow = __nccwpck_require__(1479) +var resolveAll = __nccwpck_require__(2004) +var markdownLineEndingOrSpace = __nccwpck_require__(9180) +var factoryDestination = __nccwpck_require__(9851) +var factoryLabel = __nccwpck_require__(349) +var factoryWhitespace = __nccwpck_require__(3168) +var factoryTitle = __nccwpck_require__(9469) + +var labelEnd = { + name: 'labelEnd', + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd +} +var resourceConstruct = { + tokenize: tokenizeResource +} +var fullReferenceConstruct = { + tokenize: tokenizeFullReference +} +var collapsedReferenceConstruct = { + tokenize: tokenizeCollapsedReference +} + +function resolveAllLabelEnd(events) { + var index = -1 + var token + + while (++index < events.length) { + token = events[index][1] + + if ( + !token._used && + (token.type === 'labelImage' || + token.type === 'labelLink' || + token.type === 'labelEnd') + ) { + // Remove the marker. + events.splice(index + 1, token.type === 'labelImage' ? 4 : 2) + token.type = 'data' + index++ + } + } + + return events +} + +function resolveToLabelEnd(events, context) { + var index = events.length + var offset = 0 + var group + var label + var text + var token + var open + var close + var media // Find an opening. + + while (index--) { + token = events[index][1] + + if (open) { + // If we see another link, or inactive link label, we’ve been here before. + if ( + token.type === 'link' || + (token.type === 'labelLink' && token._inactive) + ) { + break + } // Mark other link openings as inactive, as we can’t have links in + // links. + + if (events[index][0] === 'enter' && token.type === 'labelLink') { + token._inactive = true + } + } else if (close) { + if ( + events[index][0] === 'enter' && + (token.type === 'labelImage' || token.type === 'labelLink') && + !token._balanced + ) { + open = index + + if (token.type !== 'labelLink') { + offset = 2 + break } + } + } else if (token.type === 'labelEnd') { + close = index + } + } - // Lowercase MIME type - const mimeType = (mediaType.shift() || '').toLowerCase(); - const attributes = mediaType - .map((attribute) => { - let [key, value = ''] = attribute - .split('=') - .map((string) => string.trim()); + group = { + type: events[open][1].type === 'labelLink' ? 'link' : 'image', + start: shallow(events[open][1].start), + end: shallow(events[events.length - 1][1].end) + } + label = { + type: 'label', + start: shallow(events[open][1].start), + end: shallow(events[close][1].end) + } + text = { + type: 'labelText', + start: shallow(events[open + offset + 2][1].end), + end: shallow(events[close - 2][1].start) + } + media = [ + ['enter', group, context], + ['enter', label, context] + ] // Opening marker. - // Lowercase `charset` - if (key === 'charset') { - value = value.toLowerCase(); + media = chunkedPush(media, events.slice(open + 1, open + offset + 3)) // Text open. - if (value === DATA_URL_DEFAULT_CHARSET) { - return ''; - } - } + media = chunkedPush(media, [['enter', text, context]]) // Between. - return `${key}${value ? `=${value}` : ''}`; + media = chunkedPush( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + offset + 4, close - 3), + context + ) + ) // Text close, marker close, label close. + + media = chunkedPush(media, [ + ['exit', text, context], + events[close - 2], + events[close - 1], + ['exit', label, context] + ]) // Reference, resource, or so. + + media = chunkedPush(media, events.slice(close + 1)) // Media close. + + media = chunkedPush(media, [['exit', group, context]]) + chunkedSplice(events, open, events.length, media) + return events +} + +function tokenizeLabelEnd(effects, ok, nok) { + var self = this + var index = self.events.length + var labelStart + var defined // Find an opening. + + while (index--) { + if ( + (self.events[index][1].type === 'labelImage' || + self.events[index][1].type === 'labelLink') && + !self.events[index][1]._balanced + ) { + labelStart = self.events[index][1] + break + } + } + + return start + + function start(code) { + if (!labelStart) { + return nok(code) + } // It’s a balanced bracket, but contains a link. + + if (labelStart._inactive) return balanced(code) + defined = + self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize({ + start: labelStart.end, + end: self.now() }) - .filter(Boolean); + ) + ) > -1 + effects.enter('labelEnd') + effects.enter('labelMarker') + effects.consume(code) + effects.exit('labelMarker') + effects.exit('labelEnd') + return afterLabelEnd + } - const normalizedMediaType = [...attributes]; + function afterLabelEnd(code) { + // Resource: `[asd](fgh)`. + if (code === 40) { + return effects.attempt( + resourceConstruct, + ok, + defined ? ok : balanced + )(code) + } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? - if (base64) { - normalizedMediaType.push('base64'); + if (code === 91) { + return effects.attempt( + fullReferenceConstruct, + ok, + defined + ? effects.attempt(collapsedReferenceConstruct, ok, balanced) + : balanced + )(code) + } // Shortcut reference: `[asd]`? + + return defined ? ok(code) : balanced(code) + } + + function balanced(code) { + labelStart._balanced = true + return nok(code) + } +} + +function tokenizeResource(effects, ok, nok) { + return start + + function start(code) { + effects.enter('resource') + effects.enter('resourceMarker') + effects.consume(code) + effects.exit('resourceMarker') + return factoryWhitespace(effects, open) + } + + function open(code) { + if (code === 41) { + return end(code) + } + + return factoryDestination( + effects, + destinationAfter, + nok, + 'resourceDestination', + 'resourceDestinationLiteral', + 'resourceDestinationLiteralMarker', + 'resourceDestinationRaw', + 'resourceDestinationString', + 3 + )(code) + } + + function destinationAfter(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, between)(code) + : end(code) + } + + function between(code) { + if (code === 34 || code === 39 || code === 40) { + return factoryTitle( + effects, + factoryWhitespace(effects, end), + nok, + 'resourceTitle', + 'resourceTitleMarker', + 'resourceTitleString' + )(code) + } + + return end(code) + } + + function end(code) { + if (code === 41) { + effects.enter('resourceMarker') + effects.consume(code) + effects.exit('resourceMarker') + effects.exit('resource') + return ok + } + + return nok(code) + } +} + +function tokenizeFullReference(effects, ok, nok) { + var self = this + return start + + function start(code) { + return factoryLabel.call( + self, + effects, + afterLabel, + nok, + 'reference', + 'referenceMarker', + 'referenceString' + )(code) + } + + function afterLabel(code) { + return self.parser.defined.indexOf( + normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + ) < 0 + ? nok(code) + : ok(code) + } +} + +function tokenizeCollapsedReference(effects, ok, nok) { + return start + + function start(code) { + effects.enter('reference') + effects.enter('referenceMarker') + effects.consume(code) + effects.exit('referenceMarker') + return open + } + + function open(code) { + if (code === 93) { + effects.enter('referenceMarker') + effects.consume(code) + effects.exit('referenceMarker') + effects.exit('reference') + return ok + } + + return nok(code) + } +} + +module.exports = labelEnd + + +/***/ }), + +/***/ 7860: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var labelEnd = __nccwpck_require__(9797) + +var labelStartImage = { + name: 'labelStartImage', + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll +} + +function tokenizeLabelStartImage(effects, ok, nok) { + var self = this + return start + + function start(code) { + effects.enter('labelImage') + effects.enter('labelImageMarker') + effects.consume(code) + effects.exit('labelImageMarker') + return open + } + + function open(code) { + if (code === 91) { + effects.enter('labelMarker') + effects.consume(code) + effects.exit('labelMarker') + effects.exit('labelImage') + return after + } + + return nok(code) + } + + function after(code) { + /* c8 ignore next */ + return code === 94 && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} + +module.exports = labelStartImage + + +/***/ }), + +/***/ 5908: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var labelEnd = __nccwpck_require__(9797) + +var labelStartLink = { + name: 'labelStartLink', + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll +} + +function tokenizeLabelStartLink(effects, ok, nok) { + var self = this + return start + + function start(code) { + effects.enter('labelLink') + effects.enter('labelMarker') + effects.consume(code) + effects.exit('labelMarker') + effects.exit('labelLink') + return after + } + + function after(code) { + /* c8 ignore next */ + return code === 94 && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} + +module.exports = labelStartLink + + +/***/ }), + +/***/ 5183: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var factorySpace = __nccwpck_require__(8200) + +var lineEnding = { + name: 'lineEnding', + tokenize: tokenizeLineEnding +} + +function tokenizeLineEnding(effects, ok) { + return start + + function start(code) { + effects.enter('lineEnding') + effects.consume(code) + effects.exit('lineEnding') + return factorySpace(effects, ok, 'linePrefix') + } +} + +module.exports = lineEnding + + +/***/ }), + +/***/ 3107: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownSpace = __nccwpck_require__(5989) +var factorySpace = __nccwpck_require__(8200) +var partialBlankLine = __nccwpck_require__(2244) +var sizeChunks = __nccwpck_require__(5041) +var prefixSize = __nccwpck_require__(3722) +var asciiDigit = __nccwpck_require__(6996) +var thematicBreak = __nccwpck_require__(5590) + +var list = { + name: 'list', + tokenize: tokenizeListStart, + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd +} +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +} +var indentConstruct = { + tokenize: tokenizeIndent, + partial: true +} + +function tokenizeListStart(effects, ok, nok) { + var self = this + var initialSize = prefixSize(self.events, 'linePrefix') + var size = 0 + return start + + function start(code) { + var kind = + self.containerState.type || + (code === 42 || code === 43 || code === 45 + ? 'listUnordered' + : 'listOrdered') + + if ( + kind === 'listUnordered' + ? !self.containerState.marker || code === self.containerState.marker + : asciiDigit(code) + ) { + if (!self.containerState.type) { + self.containerState.type = kind + effects.enter(kind, { + _container: true + }) + } + + if (kind === 'listUnordered') { + effects.enter('listItemPrefix') + return code === 42 || code === 45 + ? effects.check(thematicBreak, nok, atMarker)(code) + : atMarker(code) + } + + if (!self.interrupt || code === 49) { + effects.enter('listItemPrefix') + effects.enter('listItemValue') + return inside(code) + } + } + + return nok(code) + } + + function inside(code) { + if (asciiDigit(code) && ++size < 10) { + effects.consume(code) + return inside + } + + if ( + (!self.interrupt || size < 2) && + (self.containerState.marker + ? code === self.containerState.marker + : code === 41 || code === 46) + ) { + effects.exit('listItemValue') + return atMarker(code) + } + + return nok(code) + } + + function atMarker(code) { + effects.enter('listItemMarker') + effects.consume(code) + effects.exit('listItemMarker') + self.containerState.marker = self.containerState.marker || code + return effects.check( + partialBlankLine, // Can’t be empty when interrupting. + self.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ) + } + + function onBlank(code) { + self.containerState.initialBlankLine = true + initialSize++ + return endOfPrefix(code) + } + + function otherPrefix(code) { + if (markdownSpace(code)) { + effects.enter('listItemPrefixWhitespace') + effects.consume(code) + effects.exit('listItemPrefixWhitespace') + return endOfPrefix + } + + return nok(code) + } + + function endOfPrefix(code) { + self.containerState.size = + initialSize + sizeChunks(self.sliceStream(effects.exit('listItemPrefix'))) + return ok(code) + } +} + +function tokenizeListContinuation(effects, ok, nok) { + var self = this + self.containerState._closeFlow = undefined + return effects.check(partialBlankLine, onBlank, notBlank) + + function onBlank(code) { + self.containerState.furtherBlankLines = + self.containerState.furtherBlankLines || + self.containerState.initialBlankLine + return ok(code) + } + + function notBlank(code) { + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return notInCurrentItem(code) + } + + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) + } + + function notInCurrentItem(code) { + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true // As we’re closing flow, we’re no longer interrupting. + + self.interrupt = undefined + return factorySpace( + effects, + effects.attempt(list, ok, nok), + 'linePrefix', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + )(code) + } +} + +function tokenizeIndent(effects, ok, nok) { + var self = this + return factorySpace( + effects, + afterPrefix, + 'listItemIndent', + self.containerState.size + 1 + ) + + function afterPrefix(code) { + return prefixSize(self.events, 'listItemIndent') === + self.containerState.size + ? ok(code) + : nok(code) + } +} + +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type) +} + +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { + var self = this + return factorySpace( + effects, + afterPrefix, + 'listItemPrefixWhitespace', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + 1 + ) + + function afterPrefix(code) { + return markdownSpace(code) || + !prefixSize(self.events, 'listItemPrefixWhitespace') + ? nok(code) + : ok(code) + } +} + +module.exports = list + + +/***/ }), + +/***/ 2244: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) + +var partialBlankLine = { + tokenize: tokenizePartialBlankLine, + partial: true +} + +function tokenizePartialBlankLine(effects, ok, nok) { + return factorySpace(effects, afterWhitespace, 'linePrefix') + + function afterWhitespace(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code) + } +} + +module.exports = partialBlankLine + + +/***/ }), + +/***/ 1196: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var factorySpace = __nccwpck_require__(8200) +var shallow = __nccwpck_require__(1479) + +var setextUnderline = { + name: 'setextUnderline', + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +} + +function resolveToSetextUnderline(events, context) { + var index = events.length + var content + var text + var definition + var heading // Find the opening of the content. + // It’ll always exist: we don’t tokenize if it isn’t there. + + while (index--) { + if (events[index][0] === 'enter') { + if (events[index][1].type === 'content') { + content = index + break + } + + if (events[index][1].type === 'paragraph') { + text = index + } + } // Exit + else { + if (events[index][1].type === 'content') { + // Remove the content end (if needed we’ll add it later) + events.splice(index, 1) + } + + if (!definition && events[index][1].type === 'definition') { + definition = index + } + } + } + + heading = { + type: 'setextHeading', + start: shallow(events[text][1].start), + end: shallow(events[events.length - 1][1].end) + } // Change the paragraph to setext heading text. + + events[text][1].type = 'setextHeadingText' // If we have definitions in the content, we’ll keep on having content, + // but we need move it. + + if (definition) { + events.splice(text, 0, ['enter', heading, context]) + events.splice(definition + 1, 0, ['exit', events[content][1], context]) + events[content][1].end = shallow(events[definition][1].end) + } else { + events[content][1] = heading + } // Add the heading exit at the end. + + events.push(['exit', heading, context]) + return events +} + +function tokenizeSetextUnderline(effects, ok, nok) { + var self = this + var index = self.events.length + var marker + var paragraph // Find an opening. + + while (index--) { + // Skip enter/exit of line ending, line prefix, and content. + // We can now either have a definition or a paragraph. + if ( + self.events[index][1].type !== 'lineEnding' && + self.events[index][1].type !== 'linePrefix' && + self.events[index][1].type !== 'content' + ) { + paragraph = self.events[index][1].type === 'paragraph' + break + } + } + + return start + + function start(code) { + if (!self.lazy && (self.interrupt || paragraph)) { + effects.enter('setextHeadingLine') + effects.enter('setextHeadingLineSequence') + marker = code + return closingSequence(code) + } + + return nok(code) + } + + function closingSequence(code) { + if (code === marker) { + effects.consume(code) + return closingSequence + } + + effects.exit('setextHeadingLineSequence') + return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code) + } + + function closingSequenceEnd(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('setextHeadingLine') + return ok(code) + } + + return nok(code) + } +} + +module.exports = setextUnderline + + +/***/ }), + +/***/ 5590: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEnding = __nccwpck_require__(7506) +var markdownSpace = __nccwpck_require__(5989) +var factorySpace = __nccwpck_require__(8200) + +var thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +} + +function tokenizeThematicBreak(effects, ok, nok) { + var size = 0 + var marker + return start + + function start(code) { + effects.enter('thematicBreak') + marker = code + return atBreak(code) + } + + function atBreak(code) { + if (code === marker) { + effects.enter('thematicBreakSequence') + return sequence(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, atBreak, 'whitespace')(code) + } + + if (size < 3 || (code !== null && !markdownLineEnding(code))) { + return nok(code) + } + + effects.exit('thematicBreak') + return ok(code) + } + + function sequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return sequence + } + + effects.exit('thematicBreakSequence') + return atBreak(code) + } +} + +module.exports = thematicBreak + + +/***/ }), + +/***/ 4455: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var chunkedSplice = __nccwpck_require__(778) + +function chunkedPush(list, items) { + if (list.length) { + chunkedSplice(list, list.length, 0, items) + return list + } + + return items +} + +module.exports = chunkedPush + + +/***/ }), + +/***/ 778: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var splice = __nccwpck_require__(2366) + +// causes a stack overflow in V8 when trying to insert 100k items for instance. + +function chunkedSplice(list, start, remove, items) { + var end = list.length + var chunkStart = 0 + var parameters // Make start between zero and `end` (included). + + if (start < 0) { + start = -start > end ? 0 : end + start + } else { + start = start > end ? end : start + } + + remove = remove > 0 ? remove : 0 // No need to chunk the items if there’s only a couple (10k) items. + + if (items.length < 10000) { + parameters = Array.from(items) + parameters.unshift(start, remove) + splice.apply(list, parameters) + } else { + // Delete `remove` items starting from `start` + if (remove) splice.apply(list, [start, remove]) // Insert the items in chunks to not cause stack overflows. + + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 10000) + parameters.unshift(start, 0) + splice.apply(list, parameters) + chunkStart += 10000 + start += 10000 + } + } +} + +module.exports = chunkedSplice + + +/***/ }), + +/***/ 1324: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var markdownLineEndingOrSpace = __nccwpck_require__(9180) +var unicodePunctuation = __nccwpck_require__(9372) +var unicodeWhitespace = __nccwpck_require__(9968) + +// Classify whether a character is unicode whitespace, unicode punctuation, or +// anything else. +// Used for attention (emphasis, strong), whose sequences can open or close +// based on the class of surrounding characters. +function classifyCharacter(code) { + if ( + code === null || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return 1 + } + + if (unicodePunctuation(code)) { + return 2 + } +} + +module.exports = classifyCharacter + + +/***/ }), + +/***/ 8602: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var hasOwnProperty = __nccwpck_require__(3500) +var chunkedSplice = __nccwpck_require__(778) +var miniflat = __nccwpck_require__(9042) + +function combineExtensions(extensions) { + var all = {} + var index = -1 + + while (++index < extensions.length) { + extension(all, extensions[index]) + } + + return all +} + +function extension(all, extension) { + var hook + var left + var right + var code + + for (hook in extension) { + left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {}) + right = extension[hook] + + for (code in right) { + left[code] = constructs( + miniflat(right[code]), + hasOwnProperty.call(left, code) ? left[code] : [] + ) + } + } +} + +function constructs(list, existing) { + var index = -1 + var before = [] + + while (++index < list.length) { + ;(list[index].add === 'after' ? existing : before).push(list[index]) + } + + chunkedSplice(existing, 0, 0, before) + return existing +} + +module.exports = combineExtensions + + +/***/ }), + +/***/ 4845: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var assign = __nccwpck_require__(3512) +var chunkedSplice = __nccwpck_require__(778) +var chunkedPush = __nccwpck_require__(4455) +var miniflat = __nccwpck_require__(9042) +var markdownLineEnding = __nccwpck_require__(7506) +var shallow = __nccwpck_require__(1479) +var resolveAll = __nccwpck_require__(2004) +var serializeChunks = __nccwpck_require__(4363) +var sliceChunks = __nccwpck_require__(7271) + +// Create a tokenizer. +// Tokenizers deal with one type of data (e.g., containers, flow, text). +// The parser is the object dealing with it all. +// `initialize` works like other constructs, except that only its `tokenize` +// function is used, in which case it doesn’t receive an `ok` or `nok`. +// `from` can be given to set the point before the first character, although +// when further lines are indented, they must be set with `defineSkip`. +function createTokenizer(parser, initialize, from) { + var point = from + ? shallow(from) + : { + line: 1, + column: 1, + offset: 0 + } + var columnStart = {} + var resolveAllConstructs = [] + var chunks = [] + var stack = [] + + var effects = { + consume: consume, + enter: enter, + exit: exit, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }), + lazy: constructFactory(onsuccessfulcheck, { + lazy: true + }) + } // State and tools for resolving and serializing. + + var context = { + previous: null, + events: [], + parser: parser, + sliceStream: sliceStream, + sliceSerialize: sliceSerialize, + now: now, + defineSkip: skip, + write: write + } // The state function. + + var state = initialize.tokenize.call(context, effects) // Track which character we expect to be consumed, to catch bugs. + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize) + } // Store where we are in the input stream. + + point._index = 0 + point._bufferIndex = -1 + return context + + function write(slice) { + chunks = chunkedPush(chunks, slice) + main() // Exit if we’re not done, resolve might change stuff. + + if (chunks[chunks.length - 1] !== null) { + return [] + } + + addResult(initialize, 0) // Otherwise, resolve, and exit. + + context.events = resolveAll(resolveAllConstructs, context.events, context) + return context.events + } // + // Tools. + // + + function sliceSerialize(token) { + return serializeChunks(sliceStream(token)) + } + + function sliceStream(token) { + return sliceChunks(chunks, token) + } + + function now() { + return shallow(point) + } + + function skip(value) { + columnStart[value.line] = value.column + accountForPotentialSkip() + } // + // State management. + // + // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + // `consume`). + // Here is where we walk through the chunks, which either include strings of + // several characters, or numerical character codes. + // The reason to do this in a loop instead of a call is so the stack can + // drain. + + function main() { + var chunkIndex + var chunk + + while (point._index < chunks.length) { + chunk = chunks[point._index] // If we’re in a buffer chunk, loop through it. + + if (typeof chunk === 'string') { + chunkIndex = point._index + + if (point._bufferIndex < 0) { + point._bufferIndex = 0 } - if ( - normalizedMediaType.length !== 0 || - (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE) + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length ) { - normalizedMediaType.unshift(mimeType); + go(chunk.charCodeAt(point._bufferIndex)) + } + } else { + go(chunk) + } + } + } // Deal with one code. + + function go(code) { + state = state(code) + } // Move a character forward. + + function consume(code) { + if (markdownLineEnding(code)) { + point.line++ + point.column = 1 + point.offset += code === -3 ? 2 : 1 + accountForPotentialSkip() + } else if (code !== -1) { + point.column++ + point.offset++ + } // Not in a string chunk. + + if (point._bufferIndex < 0) { + point._index++ + } else { + point._bufferIndex++ // At end of string chunk. + + if (point._bufferIndex === chunks[point._index].length) { + point._bufferIndex = -1 + point._index++ + } + } // Expose the previous character. + + context.previous = code // Mark as consumed. + } // Start a token. + + function enter(type, fields) { + var token = fields || {} + token.type = type + token.start = now() + context.events.push(['enter', token, context]) + stack.push(token) + return token + } // Stop a token. + + function exit(type) { + var token = stack.pop() + token.end = now() + context.events.push(['exit', token, context]) + return token + } // Use results. + + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from) + } // Discard results. + + function onsuccessfulcheck(construct, info) { + info.restore() + } // Factory to attempt/check/interrupt. + + function constructFactory(onreturn, fields) { + return hook // Handle either an object mapping codes to constructs, a list of + // constructs, or a single construct. + + function hook(constructs, returnState, bogusState) { + var listOfConstructs + var constructIndex + var currentConstruct + var info + return constructs.tokenize || 'length' in constructs + ? handleListOfConstructs(miniflat(constructs)) + : handleMapOfConstructs + + function handleMapOfConstructs(code) { + if (code in constructs || null in constructs) { + return handleListOfConstructs( + constructs.null + ? /* c8 ignore next */ + miniflat(constructs[code]).concat(miniflat(constructs.null)) + : constructs[code] + )(code) } - return `data:${normalizedMediaType.join(';')},${ - base64 ? body.trim() : body - }${hash ? `#${hash}` : ''}`; - }; + return bogusState(code) + } - const normalizeUrl = (urlString, options) => { - options = { - defaultProtocol: 'http:', - normalizeProtocol: true, - forceHttp: false, - forceHttps: false, - stripAuthentication: true, - stripHash: false, - stripWWW: true, - removeQueryParameters: [/^utm_\w+/i], - removeTrailingSlash: true, - removeDirectoryIndex: false, - sortQueryParameters: true, - ...options, - }; + function handleListOfConstructs(list) { + listOfConstructs = list + constructIndex = 0 + return handleConstruct(list[constructIndex]) + } - // TODO: Remove this at some point in the future - if (Reflect.has(options, 'normalizeHttps')) { - throw new Error( - 'options.normalizeHttps is renamed to options.forceHttp' - ); - } + function handleConstruct(construct) { + return start - if (Reflect.has(options, 'normalizeHttp')) { - throw new Error( - 'options.normalizeHttp is renamed to options.forceHttps' - ); - } + function start(code) { + // To do: not nede to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store() + currentConstruct = construct - if (Reflect.has(options, 'stripFragment')) { - throw new Error( - 'options.stripFragment is renamed to options.stripHash' - ); - } - - urlString = urlString.trim(); - - // Data URL - if (/^data:/i.test(urlString)) { - return normalizeDataURL(urlString, options); - } - - const hasRelativeProtocol = urlString.startsWith('//'); - const isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(urlString); - - // Prepend protocol - if (!isRelativeUrl) { - urlString = urlString.replace( - /^(?!(?:\w+:)?\/\/)|^\/\//, - options.defaultProtocol - ); - } - - const urlObj = new URLParser(urlString); - - if (options.forceHttp && options.forceHttps) { - throw new Error( - 'The `forceHttp` and `forceHttps` options cannot be used together' - ); - } - - if (options.forceHttp && urlObj.protocol === 'https:') { - urlObj.protocol = 'http:'; - } - - if (options.forceHttps && urlObj.protocol === 'http:') { - urlObj.protocol = 'https:'; - } - - // Remove auth - if (options.stripAuthentication) { - urlObj.username = ''; - urlObj.password = ''; - } - - // Remove hash - if (options.stripHash) { - urlObj.hash = ''; - } - - // Remove duplicate slashes if not preceded by a protocol - if (urlObj.pathname) { - // TODO: Use the following instead when targeting Node.js 10 - // `urlObj.pathname = urlObj.pathname.replace(/(? { - if (/^(?!\/)/g.test(p1)) { - return `${p1}/`; - } - - return '/'; - } - ); - } - - // Decode URI octets - if (urlObj.pathname) { - urlObj.pathname = decodeURI(urlObj.pathname); - } - - // Remove directory index - if (options.removeDirectoryIndex === true) { - options.removeDirectoryIndex = [/^index\.[a-z]+$/]; - } - - if ( - Array.isArray(options.removeDirectoryIndex) && - options.removeDirectoryIndex.length > 0 - ) { - let pathComponents = urlObj.pathname.split('/'); - const lastComponent = pathComponents[pathComponents.length - 1]; - - if (testParameter(lastComponent, options.removeDirectoryIndex)) { - pathComponents = pathComponents.slice(0, pathComponents.length - 1); - urlObj.pathname = pathComponents.slice(1).join('/') + '/'; + if (!construct.partial) { + context.currentConstruct = construct } - } - if (urlObj.hostname) { - // Remove trailing dot - urlObj.hostname = urlObj.hostname.replace(/\.$/, ''); - - // Remove `www.` if ( - options.stripWWW && - /^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(urlObj.hostname) + construct.name && + context.parser.constructs.disable.null.indexOf(construct.name) > -1 ) { - // Each label should be max 63 at length (min: 2). - // The extension should be max 5 at length (min: 2). - // Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names - urlObj.hostname = urlObj.hostname.replace(/^www\./, ''); + return nok() + } + + return construct.tokenize.call( + fields ? assign({}, context, fields) : context, + effects, + ok, + nok + )(code) + } + } + + function ok(code) { + onreturn(currentConstruct, info) + return returnState + } + + function nok(code) { + info.restore() + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + + function addResult(construct, from) { + if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { + resolveAllConstructs.push(construct) + } + + if (construct.resolve) { + chunkedSplice( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ) + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context) + } + } + + function store() { + var startPoint = now() + var startPrevious = context.previous + var startCurrentConstruct = context.currentConstruct + var startEventsIndex = context.events.length + var startStack = Array.from(stack) + return { + restore: restore, + from: startEventsIndex + } + + function restore() { + point = startPoint + context.previous = startPrevious + context.currentConstruct = startCurrentConstruct + context.events.length = startEventsIndex + stack = startStack + accountForPotentialSkip() + } + } + + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line] + point.offset += columnStart[point.line] - 1 + } + } +} + +module.exports = createTokenizer + + +/***/ }), + +/***/ 9042: +/***/ ((module) => { + +"use strict"; + + +function miniflat(value) { + return value === null || value === undefined + ? [] + : 'length' in value + ? value + : [value] +} + +module.exports = miniflat + + +/***/ }), + +/***/ 6985: +/***/ ((module) => { + +"use strict"; + + +// chunks (replacement characters, tabs, or line endings). + +function movePoint(point, offset) { + point.column += offset + point.offset += offset + point._bufferIndex += offset + return point +} + +module.exports = movePoint + + +/***/ }), + +/***/ 712: +/***/ ((module) => { + +"use strict"; + + +function normalizeIdentifier(value) { + return ( + value // Collapse Markdown whitespace. + .replace(/[\t\n\r ]+/g, ' ') // Trim. + .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no object method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} + +module.exports = normalizeIdentifier + + +/***/ }), + +/***/ 3722: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var sizeChunks = __nccwpck_require__(5041) + +function prefixSize(events, type) { + var tail = events[events.length - 1] + if (!tail || tail[1].type !== type) return 0 + return sizeChunks(tail[2].sliceStream(tail[1])) +} + +module.exports = prefixSize + + +/***/ }), + +/***/ 1028: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var fromCharCode = __nccwpck_require__(3531) + +function regexCheck(regex) { + return check + + function check(code) { + return regex.test(fromCharCode(code)) + } +} + +module.exports = regexCheck + + +/***/ }), + +/***/ 2004: +/***/ ((module) => { + +"use strict"; + + +function resolveAll(constructs, events, context) { + var called = [] + var index = -1 + var resolve + + while (++index < constructs.length) { + resolve = constructs[index].resolveAll + + if (resolve && called.indexOf(resolve) < 0) { + events = resolve(events, context) + called.push(resolve) + } + } + + return events +} + +module.exports = resolveAll + + +/***/ }), + +/***/ 6214: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var fromCharCode = __nccwpck_require__(3531) + +function safeFromInt(value, base) { + var code = parseInt(value, base) + + if ( + // C0 except for HT, LF, FF, CR, space + code < 9 || + code === 11 || + (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. + (code > 126 && code < 160) || // Lone high surrogates and low surrogates. + (code > 55295 && code < 57344) || // Noncharacters. + (code > 64975 && code < 65008) || + (code & 65535) === 65535 || + (code & 65535) === 65534 || // Out of range + code > 1114111 + ) { + return '\uFFFD' + } + + return fromCharCode(code) +} + +module.exports = safeFromInt + + +/***/ }), + +/***/ 4363: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var fromCharCode = __nccwpck_require__(3531) + +function serializeChunks(chunks) { + var index = -1 + var result = [] + var chunk + var value + var atTab + + while (++index < chunks.length) { + chunk = chunks[index] + + if (typeof chunk === 'string') { + value = chunk + } else if (chunk === -5) { + value = '\r' + } else if (chunk === -4) { + value = '\n' + } else if (chunk === -3) { + value = '\r' + '\n' + } else if (chunk === -2) { + value = '\t' + } else if (chunk === -1) { + if (atTab) continue + value = ' ' + } else { + // Currently only replacement character. + value = fromCharCode(chunk) + } + + atTab = chunk === -2 + result.push(value) + } + + return result.join('') +} + +module.exports = serializeChunks + + +/***/ }), + +/***/ 1479: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var assign = __nccwpck_require__(3512) + +function shallow(object) { + return assign({}, object) +} + +module.exports = shallow + + +/***/ }), + +/***/ 5041: +/***/ ((module) => { + +"use strict"; + + +// Counts tabs based on their expanded size, and CR+LF as one character. + +function sizeChunks(chunks) { + var index = -1 + var size = 0 + + while (++index < chunks.length) { + size += typeof chunks[index] === 'string' ? chunks[index].length : 1 + } + + return size +} + +module.exports = sizeChunks + + +/***/ }), + +/***/ 7271: +/***/ ((module) => { + +"use strict"; + + +function sliceChunks(chunks, token) { + var startIndex = token.start._index + var startBufferIndex = token.start._bufferIndex + var endIndex = token.end._index + var endBufferIndex = token.end._bufferIndex + var view + + if (startIndex === endIndex) { + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] + } else { + view = chunks.slice(startIndex, endIndex) + + if (startBufferIndex > -1) { + view[0] = view[0].slice(startBufferIndex) + } + + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)) + } + } + + return view +} + +module.exports = sliceChunks + + +/***/ }), + +/***/ 14: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var assign = __nccwpck_require__(3512) +var chunkedSplice = __nccwpck_require__(778) +var shallow = __nccwpck_require__(1479) + +function subtokenize(events) { + var jumps = {} + var index = -1 + var event + var lineIndex + var otherIndex + var otherEvent + var parameters + var subevents + var more + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index] + } + + event = events[index] // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + + if ( + index && + event[1].type === 'chunkFlow' && + events[index - 1][1].type === 'listItemPrefix' + ) { + subevents = event[1]._tokenizer.events + otherIndex = 0 + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === 'lineEndingBlank' + ) { + otherIndex += 2 + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === 'content' + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === 'content') { + break + } + + if (subevents[otherIndex][1].type === 'chunkText') { + subevents[otherIndex][1].isInFirstContentOfListItem = true + otherIndex++ } } + } + } // Enter. - // Remove query unwanted parameters - if (Array.isArray(options.removeQueryParameters)) { - for (const key of [...urlObj.searchParams.keys()]) { - if (testParameter(key, options.removeQueryParameters)) { - urlObj.searchParams.delete(key); - } - } - } + if (event[0] === 'enter') { + if (event[1].contentType) { + assign(jumps, subcontent(events, index)) + index = jumps[index] + more = true + } + } // Exit. + else if (event[1]._container || event[1]._movePreviousLineEndings) { + otherIndex = index + lineIndex = undefined - // Sort query parameters - if (options.sortQueryParameters) { - urlObj.searchParams.sort(); - } + while (otherIndex--) { + otherEvent = events[otherIndex] - if (options.removeTrailingSlash) { - urlObj.pathname = urlObj.pathname.replace(/\/$/, ''); - } - - // Take advantage of many of the Node `url` normalizations - urlString = urlObj.toString(); - - // Remove ending `/` if ( - (options.removeTrailingSlash || urlObj.pathname === '/') && - urlObj.hash === '' + otherEvent[1].type === 'lineEnding' || + otherEvent[1].type === 'lineEndingBlank' ) { - urlString = urlString.replace(/\/$/, ''); - } - - // Restore relative protocol, if applicable - if (hasRelativeProtocol && !options.normalizeProtocol) { - urlString = urlString.replace(/^http:\/\//, '//'); - } - - // Remove http/https - if (options.stripProtocol) { - urlString = urlString.replace(/^(?:https?:)?\/\//, ''); - } - - return urlString; - }; - - module.exports = normalizeUrl; - // TODO: Remove this for the next major release - module.exports.default = normalizeUrl; - - /***/ - }, - - /***/ 1223: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - var wrappy = __nccwpck_require__(2940); - module.exports = wrappy(once); - module.exports.strict = wrappy(onceStrict); - - once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this); - }, - configurable: true, - }); - - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this); - }, - configurable: true, - }); - }); - - function once(fn) { - var f = function () { - if (f.called) return f.value; - f.called = true; - return (f.value = fn.apply(this, arguments)); - }; - f.called = false; - return f; - } - - function onceStrict(fn) { - var f = function () { - if (f.called) throw new Error(f.onceError); - f.called = true; - return (f.value = fn.apply(this, arguments)); - }; - var name = fn.name || 'Function wrapped with `once`'; - f.onceError = name + " shouldn't be called more than once"; - f.called = false; - return f; - } - - /***/ - }, - - /***/ 9072: /***/ (module) => { - 'use strict'; - - class CancelError extends Error { - constructor(reason) { - super(reason || 'Promise was canceled'); - this.name = 'CancelError'; - } - - get isCanceled() { - return true; - } - } - - class PCancelable { - static fn(userFn) { - return (...arguments_) => { - return new PCancelable((resolve, reject, onCancel) => { - arguments_.push(onCancel); - // eslint-disable-next-line promise/prefer-await-to-then - userFn(...arguments_).then(resolve, reject); - }); - }; - } - - constructor(executor) { - this._cancelHandlers = []; - this._isPending = true; - this._isCanceled = false; - this._rejectOnCancel = true; - - this._promise = new Promise((resolve, reject) => { - this._reject = reject; - - const onResolve = (value) => { - this._isPending = false; - resolve(value); - }; - - const onReject = (error) => { - this._isPending = false; - reject(error); - }; - - const onCancel = (handler) => { - if (!this._isPending) { - throw new Error( - 'The `onCancel` handler was attached after the promise settled.' - ); - } - - this._cancelHandlers.push(handler); - }; - - Object.defineProperties(onCancel, { - shouldReject: { - get: () => this._rejectOnCancel, - set: (boolean) => { - this._rejectOnCancel = boolean; - }, - }, - }); - - return executor(onResolve, onReject, onCancel); - }); - } - - then(onFulfilled, onRejected) { - // eslint-disable-next-line promise/prefer-await-to-then - return this._promise.then(onFulfilled, onRejected); - } - - catch(onRejected) { - return this._promise.catch(onRejected); - } - - finally(onFinally) { - return this._promise.finally(onFinally); - } - - cancel(reason) { - if (!this._isPending || this._isCanceled) { - return; - } - - if (this._cancelHandlers.length > 0) { - try { - for (const handler of this._cancelHandlers) { - handler(); - } - } catch (error) { - this._reject(error); - } - } - - this._isCanceled = true; - if (this._rejectOnCancel) { - this._reject(new CancelError(reason)); - } - } - - get isCanceled() { - return this._isCanceled; - } - } - - Object.setPrototypeOf(PCancelable.prototype, Promise.prototype); - - module.exports = PCancelable; - module.exports.CancelError = CancelError; - - /***/ - }, - - /***/ 3485: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var characterEntities = __nccwpck_require__(3407); - - module.exports = decodeEntity; - - var own = {}.hasOwnProperty; - - function decodeEntity(characters) { - return own.call(characterEntities, characters) - ? characterEntities[characters] - : false; - } - - /***/ - }, - - /***/ 8341: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - var once = __nccwpck_require__(1223); - var eos = __nccwpck_require__(1205); - var fs = __nccwpck_require__(5747); // we only need fs to get the ReadStream and WriteStream prototypes - - var noop = function () {}; - var ancient = /^v?\.0/.test(process.version); - - var isFn = function (fn) { - return typeof fn === 'function'; - }; - - var isFS = function (stream) { - if (!ancient) return false; // newer node version do not need to care about fs is a special way - if (!fs) return false; // browser - return ( - (stream instanceof (fs.ReadStream || noop) || - stream instanceof (fs.WriteStream || noop)) && - isFn(stream.close) - ); - }; - - var isRequest = function (stream) { - return stream.setHeader && isFn(stream.abort); - }; - - var destroyer = function (stream, reading, writing, callback) { - callback = once(callback); - - var closed = false; - stream.on('close', function () { - closed = true; - }); - - eos(stream, { readable: reading, writable: writing }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; - - if (isFS(stream)) return stream.close(noop); // use close for fs streams to avoid fd leaks - if (isRequest(stream)) return stream.abort(); // request.destroy just do .end - .abort is what we want - - if (isFn(stream.destroy)) return stream.destroy(); - - callback(err || new Error('stream was destroyed')); - }; - }; - - var call = function (fn) { - fn(); - }; - - var pipe = function (from, to) { - return from.pipe(to); - }; - - var pump = function () { - var streams = Array.prototype.slice.call(arguments); - var callback = - (isFn(streams[streams.length - 1] || noop) && streams.pop()) || noop; - - if (Array.isArray(streams[0])) streams = streams[0]; - if (streams.length < 2) - throw new Error('pump requires two streams per minimum'); - - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - - return streams.reduce(pipe); - }; - - module.exports = pump; - - /***/ - }, - - /***/ 9273: /***/ (module) => { - 'use strict'; - - class QuickLRU { - constructor(options = {}) { - if (!(options.maxSize && options.maxSize > 0)) { - throw new TypeError('`maxSize` must be a number greater than 0'); - } - - this.maxSize = options.maxSize; - this.onEviction = options.onEviction; - this.cache = new Map(); - this.oldCache = new Map(); - this._size = 0; - } - - _set(key, value) { - this.cache.set(key, value); - this._size++; - - if (this._size >= this.maxSize) { - this._size = 0; - - if (typeof this.onEviction === 'function') { - for (const [key, value] of this.oldCache.entries()) { - this.onEviction(key, value); - } + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events[lineIndex][1].type = 'lineEndingBlank' } - this.oldCache = this.cache; - this.cache = new Map(); + otherEvent[1].type = 'lineEnding' + lineIndex = otherIndex } - } - - get(key) { - if (this.cache.has(key)) { - return this.cache.get(key); - } - - if (this.oldCache.has(key)) { - const value = this.oldCache.get(key); - this.oldCache.delete(key); - this._set(key, value); - return value; - } - } - - set(key, value) { - if (this.cache.has(key)) { - this.cache.set(key, value); - } else { - this._set(key, value); - } - - return this; - } - - has(key) { - return this.cache.has(key) || this.oldCache.has(key); - } - - peek(key) { - if (this.cache.has(key)) { - return this.cache.get(key); - } - - if (this.oldCache.has(key)) { - return this.oldCache.get(key); - } - } - - delete(key) { - const deleted = this.cache.delete(key); - if (deleted) { - this._size--; - } - - return this.oldCache.delete(key) || deleted; - } - - clear() { - this.cache.clear(); - this.oldCache.clear(); - this._size = 0; - } - - *keys() { - for (const [key] of this) { - yield key; - } - } - - *values() { - for (const [, value] of this) { - yield value; - } - } - - *[Symbol.iterator]() { - for (const item of this.cache) { - yield item; - } - - for (const item of this.oldCache) { - const [key] = item; - if (!this.cache.has(key)) { - yield item; - } - } - } - - get size() { - let oldCacheSize = 0; - for (const key of this.oldCache.keys()) { - if (!this.cache.has(key)) { - oldCacheSize++; - } - } - - return Math.min(this._size + oldCacheSize, this.maxSize); - } - } - - module.exports = QuickLRU; - - /***/ - }, - - /***/ 4859: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = parse; - - var fromMarkdown = __nccwpck_require__(3068); - - function parse(options) { - var self = this; - - this.Parser = parse; - - function parse(doc) { - return fromMarkdown( - doc, - Object.assign({}, self.data('settings'), options, { - // Note: these options are not in the readme. - // The goal is for them to be set by plugins on `data` instead of being - // passed by users. - extensions: self.data('micromarkExtensions') || [], - mdastExtensions: self.data('fromMarkdownExtensions') || [], - }) - ); - } - } - - /***/ - }, - - /***/ 7114: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = stringify; - - var toMarkdown = __nccwpck_require__(219); - - function stringify(options) { - var self = this; - - this.Compiler = compile; - - function compile(tree) { - return toMarkdown( - tree, - Object.assign({}, self.data('settings'), options, { - // Note: this option is not in the readme. - // The goal is for it to be set by plugins on `data` instead of being - // passed by users. - extensions: self.data('toMarkdownExtensions') || [], - }) - ); - } - } - - /***/ - }, - - /***/ 5096: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var util = __nccwpck_require__(6184); - - module.exports = toc; - - var defaultHeading = 'toc|table[ -]of[ -]contents?'; - - function toc(options) { - var settings = options || {}; - var heading = settings.heading || defaultHeading; - var depth = settings.maxDepth || 6; - var tight = settings.tight; - var skip = settings.skip; - - return transformer; - - function transformer(node) { - var result = util(node, { - heading: heading, - maxDepth: depth, - tight: tight, - skip: skip, - }); - - if (result.index === null || result.index === -1 || !result.map) { - return; - } - - node.children = [].concat( - node.children.slice(0, result.index), - result.map, - node.children.slice(result.endIndex) - ); - } - } - - /***/ - }, - - /***/ 2081: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var unified = __nccwpck_require__(5075); - var parse = __nccwpck_require__(4859); - var stringify = __nccwpck_require__(7114); - - module.exports = unified().use(parse).use(stringify).freeze(); - - /***/ - }, - - /***/ 6976: /***/ (module) => { - 'use strict'; - /*! - * repeat-string - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - - /** - * Results cache - */ - - var res = ''; - var cache; - - /** - * Expose `repeat` - */ - - module.exports = repeat; - - /** - * Repeat the given `string` the specified `number` - * of times. - * - * **Example:** - * - * ```js - * var repeat = require('repeat-string'); - * repeat('A', 5); - * //=> AAAAA - * ``` - * - * @param {String} `string` The string to repeat - * @param {Number} `number` The number of times to repeat the string - * @return {String} Repeated string - * @api public - */ - - function repeat(str, num) { - if (typeof str !== 'string') { - throw new TypeError('expected a string'); - } - - // cover common, quick use cases - if (num === 1) return str; - if (num === 2) return str + str; - - var max = str.length * num; - if (cache !== str || typeof cache === 'undefined') { - cache = str; - res = ''; - } else if (res.length >= max) { - return res.substr(0, max); - } - - while (max > res.length && num > 1) { - if (num & 1) { - res += str; - } - - num >>= 1; - str += str; - } - - res += str; - res = res.substr(0, max); - return res; - } - - /***/ - }, - - /***/ 6624: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const tls = __nccwpck_require__(4016); - - module.exports = (options = {}) => - new Promise((resolve, reject) => { - const socket = tls.connect(options, () => { - if (options.resolveSocket) { - socket.off('error', reject); - resolve({ alpnProtocol: socket.alpnProtocol, socket }); - } else { - socket.destroy(); - resolve({ alpnProtocol: socket.alpnProtocol }); - } - }); - - socket.on('error', reject); - }); - - /***/ - }, - - /***/ 9004: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - const Readable = __nccwpck_require__(2413).Readable; - const lowercaseKeys = __nccwpck_require__(9662); - - class Response extends Readable { - constructor(statusCode, headers, body, url) { - if (typeof statusCode !== 'number') { - throw new TypeError('Argument `statusCode` should be a number'); - } - if (typeof headers !== 'object') { - throw new TypeError('Argument `headers` should be an object'); - } - if (!(body instanceof Buffer)) { - throw new TypeError('Argument `body` should be a buffer'); - } - if (typeof url !== 'string') { - throw new TypeError('Argument `url` should be a string'); - } - - super(); - this.statusCode = statusCode; - this.headers = lowercaseKeys(headers); - this.body = body; - this.url = url; - } - - _read() { - this.push(this.body); - this.push(null); - } - } - - module.exports = Response; - - /***/ - }, - - /***/ 3604: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var wrap = __nccwpck_require__(3458); - - module.exports = trough; - - trough.wrap = wrap; - - var slice = [].slice; - - // Create new middleware. - function trough() { - var fns = []; - var middleware = {}; - - middleware.run = run; - middleware.use = use; - - return middleware; - - // Run `fns`. Last argument must be a completion handler. - function run() { - var index = -1; - var input = slice.call(arguments, 0, -1); - var done = arguments[arguments.length - 1]; - - if (typeof done !== 'function') { - throw new Error('Expected function as last argument, not ' + done); - } - - next.apply(null, [null].concat(input)); - - // Run the next `fn`, if any. - function next(err) { - var fn = fns[++index]; - var params = slice.call(arguments, 0); - var values = params.slice(1); - var length = input.length; - var pos = -1; - - if (err) { - done(err); - return; - } - - // Copy non-nully input into values. - while (++pos < length) { - if (values[pos] === null || values[pos] === undefined) { - values[pos] = input[pos]; - } - } - - input = values; - - // Next or done. - if (fn) { - wrap(fn, next).apply(null, input); - } else { - done.apply(null, [null].concat(input)); - } - } - } - - // Add `fn` to the list. - function use(fn) { - if (typeof fn !== 'function') { - throw new Error('Expected `fn` to be a function, not ' + fn); - } - - fns.push(fn); - - return middleware; - } - } - - /***/ - }, - - /***/ 3458: /***/ (module) => { - 'use strict'; - - var slice = [].slice; - - module.exports = wrap; - - // Wrap `fn`. - // Can be sync or async; return a promise, receive a completion handler, return - // new values and errors. - function wrap(fn, callback) { - var invoked; - - return wrapped; - - function wrapped() { - var params = slice.call(arguments, 0); - var callback = fn.length > params.length; - var result; - - if (callback) { - params.push(done); - } - - try { - result = fn.apply(null, params); - } catch (error) { - // Well, this is quite the pickle. - // `fn` received a callback and invoked it (thus continuing the pipeline), - // but later also threw an error. - // We’re not about to restart the pipeline again, so the only thing left - // to do is to throw the thing instead. - if (callback && invoked) { - throw error; - } - - return done(error); - } - - if (!callback) { - if (result && typeof result.then === 'function') { - result.then(then, done); - } else if (result instanceof Error) { - done(result); - } else { - then(result); - } - } - } - - // Invoke `next`, only once. - function done() { - if (!invoked) { - invoked = true; - - callback.apply(null, arguments); - } - } - - // Invoke `done` with one value. - // Tracks if an error is passed, too. - function then(value) { - done(null, value); - } - } - - /***/ - }, - - /***/ 5075: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var bail = __nccwpck_require__(7240); - var buffer = __nccwpck_require__(8810); - var extend = __nccwpck_require__(8171); - var plain = __nccwpck_require__(4118); - var trough = __nccwpck_require__(3604); - var vfile = __nccwpck_require__(4860); - - // Expose a frozen processor. - module.exports = unified().freeze(); - - var slice = [].slice; - var own = {}.hasOwnProperty; - - // Process pipeline. - var pipeline = trough() - .use(pipelineParse) - .use(pipelineRun) - .use(pipelineStringify); - - function pipelineParse(p, ctx) { - ctx.tree = p.parse(ctx.file); - } - - function pipelineRun(p, ctx, next) { - p.run(ctx.tree, ctx.file, done); - - function done(err, tree, file) { - if (err) { - next(err); - } else { - ctx.tree = tree; - ctx.file = file; - next(); - } - } - } - - function pipelineStringify(p, ctx) { - var result = p.stringify(ctx.tree, ctx.file); - var file = ctx.file; - - if (result === undefined || result === null) { - // Empty. - } else if (typeof result === 'string' || buffer(result)) { - file.contents = result; } else { - file.result = result; + break } } - // Function to create the first processor. - function unified() { - var attachers = []; - var transformers = trough(); - var namespace = {}; - var frozen = false; - var freezeIndex = -1; - - // Data management. - processor.data = data; - - // Lock. - processor.freeze = freeze; - - // Plugins. - processor.attachers = attachers; - processor.use = use; - - // API. - processor.parse = parse; - processor.stringify = stringify; - processor.run = run; - processor.runSync = runSync; - processor.process = process; - processor.processSync = processSync; - - // Expose. - return processor; - - // Create a new processor based on the processor in the current scope. - function processor() { - var destination = unified(); - var length = attachers.length; - var index = -1; - - while (++index < length) { - destination.use.apply(null, attachers[index]); - } - - destination.data(extend(true, {}, namespace)); - - return destination; - } - - // Freeze: used to signal a processor that has finished configuration. - // - // For example, take unified itself: it’s frozen. - // Plugins should not be added to it. - // Rather, it should be extended, by invoking it, before modifying it. - // - // In essence, always invoke this when exporting a processor. - function freeze() { - var values; - var plugin; - var options; - var transformer; - - if (frozen) { - return processor; - } - - while (++freezeIndex < attachers.length) { - values = attachers[freezeIndex]; - plugin = values[0]; - options = values[1]; - transformer = null; - - if (options === false) { - continue; - } - - if (options === true) { - values[1] = undefined; - } - - transformer = plugin.apply(processor, values.slice(1)); - - if (typeof transformer === 'function') { - transformers.use(transformer); - } - } - - frozen = true; - freezeIndex = Infinity; - - return processor; - } - - // Data management. - // Getter / setter for processor-specific informtion. - function data(key, value) { - if (typeof key === 'string') { - // Set `key`. - if (arguments.length === 2) { - assertUnfrozen('data', frozen); - - namespace[key] = value; - - return processor; - } - - // Get `key`. - return (own.call(namespace, key) && namespace[key]) || null; - } - - // Set space. - if (key) { - assertUnfrozen('data', frozen); - namespace = key; - return processor; - } - - // Get space. - return namespace; - } - - // Plugin management. - // - // Pass it: - // * an attacher and options, - // * a preset, - // * a list of presets, attachers, and arguments (list of attachers and - // options). - function use(value) { - var settings; - - assertUnfrozen('use', frozen); - - if (value === null || value === undefined) { - // Empty. - } else if (typeof value === 'function') { - addPlugin.apply(null, arguments); - } else if (typeof value === 'object') { - if ('length' in value) { - addList(value); - } else { - addPreset(value); - } - } else { - throw new Error('Expected usable value, not `' + value + '`'); - } - - if (settings) { - namespace.settings = extend(namespace.settings || {}, settings); - } - - return processor; - - function addPreset(result) { - addList(result.plugins); - - if (result.settings) { - settings = extend(settings || {}, result.settings); - } - } - - function add(value) { - if (typeof value === 'function') { - addPlugin(value); - } else if (typeof value === 'object') { - if ('length' in value) { - addPlugin.apply(null, value); - } else { - addPreset(value); - } - } else { - throw new Error('Expected usable value, not `' + value + '`'); - } - } - - function addList(plugins) { - var length; - var index; - - if (plugins === null || plugins === undefined) { - // Empty. - } else if (typeof plugins === 'object' && 'length' in plugins) { - length = plugins.length; - index = -1; - - while (++index < length) { - add(plugins[index]); - } - } else { - throw new Error( - 'Expected a list of plugins, not `' + plugins + '`' - ); - } - } - - function addPlugin(plugin, value) { - var entry = find(plugin); - - if (entry) { - if (plain(entry[1]) && plain(value)) { - value = extend(entry[1], value); - } - - entry[1] = value; - } else { - attachers.push(slice.call(arguments)); - } - } - } - - function find(plugin) { - var length = attachers.length; - var index = -1; - var entry; - - while (++index < length) { - entry = attachers[index]; - - if (entry[0] === plugin) { - return entry; - } - } - } - - // Parse a file (in string or vfile representation) into a unist node using - // the `Parser` on the processor. - function parse(doc) { - var file = vfile(doc); - var Parser; - - freeze(); - Parser = processor.Parser; - assertParser('parse', Parser); - - if (newable(Parser, 'parse')) { - return new Parser(String(file), file).parse(); - } - - return Parser(String(file), file); // eslint-disable-line new-cap - } - - // Run transforms on a unist node representation of a file (in string or - // vfile representation), async. - function run(node, file, cb) { - assertNode(node); - freeze(); - - if (!cb && typeof file === 'function') { - cb = file; - file = null; - } - - if (!cb) { - return new Promise(executor); - } - - executor(null, cb); - - function executor(resolve, reject) { - transformers.run(node, vfile(file), done); - - function done(err, tree, file) { - tree = tree || node; - if (err) { - reject(err); - } else if (resolve) { - resolve(tree); - } else { - cb(null, tree, file); - } - } - } - } - - // Run transforms on a unist node representation of a file (in string or - // vfile representation), sync. - function runSync(node, file) { - var complete = false; - var result; - - run(node, file, done); - - assertDone('runSync', 'run', complete); - - return result; - - function done(err, tree) { - complete = true; - bail(err); - result = tree; - } - } - - // Stringify a unist node representation of a file (in string or vfile - // representation) into a string using the `Compiler` on the processor. - function stringify(node, doc) { - var file = vfile(doc); - var Compiler; - - freeze(); - Compiler = processor.Compiler; - assertCompiler('stringify', Compiler); - assertNode(node); - - if (newable(Compiler, 'compile')) { - return new Compiler(node, file).compile(); - } - - return Compiler(node, file); // eslint-disable-line new-cap - } - - // Parse a file (in string or vfile representation) into a unist node using - // the `Parser` on the processor, then run transforms on that node, and - // compile the resulting node using the `Compiler` on the processor, and - // store that result on the vfile. - function process(doc, cb) { - freeze(); - assertParser('process', processor.Parser); - assertCompiler('process', processor.Compiler); - - if (!cb) { - return new Promise(executor); - } - - executor(null, cb); - - function executor(resolve, reject) { - var file = vfile(doc); - - pipeline.run(processor, { file: file }, done); - - function done(err) { - if (err) { - reject(err); - } else if (resolve) { - resolve(file); - } else { - cb(null, file); - } - } - } - } - - // Process the given document (in string or vfile representation), sync. - function processSync(doc) { - var complete = false; - var file; - - freeze(); - assertParser('processSync', processor.Parser); - assertCompiler('processSync', processor.Compiler); - file = vfile(doc); - - process(file, done); - - assertDone('processSync', 'process', complete); - - return file; - - function done(err) { - complete = true; - bail(err); - } - } + if (lineIndex) { + // Fix position. + event[1].end = shallow(events[lineIndex][1].start) // Switch container exit w/ line endings. + + parameters = events.slice(lineIndex, index) + parameters.unshift(event) + chunkedSplice(events, lineIndex, index - lineIndex + 1, parameters) + } + } + } + + return !more +} + +function subcontent(events, eventIndex) { + var token = events[eventIndex][1] + var context = events[eventIndex][2] + var startPosition = eventIndex - 1 + var startPositions = [] + var tokenizer = + token._tokenizer || context.parser[token.contentType](token.start) + var childEvents = tokenizer.events + var jumps = [] + var gaps = {} + var stream + var previous + var index + var entered + var end + var adjust // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + + while (token) { + // Find the position of the event for this token. + while (events[++startPosition][1] !== token) { + // Empty. + } + + startPositions.push(startPosition) + + if (!token._tokenizer) { + stream = context.sliceStream(token) + + if (!token.next) { + stream.push(null) } - // Check if `value` is a constructor. - function newable(value, name) { - return ( - typeof value === 'function' && - value.prototype && - // A function with keys in its prototype is probably a constructor. - // Classes’ prototype methods are not enumerable, so we check if some value - // exists in the prototype. - (keys(value.prototype) || name in value.prototype) - ); + if (previous) { + tokenizer.defineSkip(token.start) } - // Check if `value` is an object with keys. - function keys(value) { - var key; - for (key in value) { - return true; - } - - return false; + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true } - // Assert a parser is available. - function assertParser(name, Parser) { - if (typeof Parser !== 'function') { - throw new Error('Cannot `' + name + '` without `Parser`'); - } - } + tokenizer.write(stream) - // Assert a compiler is available. - function assertCompiler(name, Compiler) { - if (typeof Compiler !== 'function') { - throw new Error('Cannot `' + name + '` without `Compiler`'); - } + if (token.isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined } + } // Unravel the next token. - // Assert the processor is not frozen. - function assertUnfrozen(name, frozen) { - if (frozen) { - throw new Error( - 'Cannot invoke `' + - name + - '` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.' - ); - } - } + previous = token + token = token.next + } // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. - // Assert `node` is a unist node. - function assertNode(node) { - if (!node || typeof node.type !== 'string') { - throw new Error('Expected node, got `' + node + '`'); - } - } + token = previous + index = childEvents.length - // Assert that `complete` is `true`. - function assertDone(name, asyncName, complete) { - if (!complete) { - throw new Error( - '`' + name + '` finished async. Use `' + asyncName + '` instead' - ); - } - } + while (index--) { + // Make sure we’ve at least seen something (final eol is part of the last + // token). + if (childEvents[index][0] === 'enter') { + entered = true + } else if ( + // Find a void token that includes a break. + entered && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + add(childEvents.slice(index + 1, end)) + // Help GC. + token._tokenizer = token.next = undefined + token = token.previous + end = index + 1 + } + } - /***/ + // Help GC. + tokenizer.events = token._tokenizer = token.next = undefined // Do head: + + add(childEvents.slice(0, end)) + index = -1 + adjust = 0 + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] + adjust += jumps[index][1] - jumps[index][0] - 1 + } + + return gaps + + function add(slice) { + var start = startPositions.pop() + jumps.unshift([start, start + slice.length - 1]) + chunkedSplice(events, start, 2, slice) + } +} + +module.exports = subtokenize + + +/***/ }), + +/***/ 2610: +/***/ ((module) => { + +"use strict"; + + +// We define these manually to ensure they're always copied +// even if they would move up the prototype chain +// https://nodejs.org/api/http.html#http_class_http_incomingmessage +const knownProps = [ + 'destroy', + 'setTimeout', + 'socket', + 'headers', + 'trailers', + 'rawHeaders', + 'statusCode', + 'httpVersion', + 'httpVersionMinor', + 'httpVersionMajor', + 'rawTrailers', + 'statusMessage' +]; + +module.exports = (fromStream, toStream) => { + const fromProps = new Set(Object.keys(fromStream).concat(knownProps)); + + for (const prop of fromProps) { + // Don't overwrite existing properties + if (prop in toStream) { + continue; + } + + toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop]; + } +}; + + +/***/ }), + +/***/ 7952: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +// TODO: Use the `URL` global when targeting Node.js 10 +const URLParser = typeof URL === 'undefined' ? __nccwpck_require__(8835).URL : URL; + +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs +const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain'; +const DATA_URL_DEFAULT_CHARSET = 'us-ascii'; + +const testParameter = (name, filters) => { + return filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name); +}; + +const normalizeDataURL = (urlString, {stripHash}) => { + const parts = urlString.match(/^data:(.*?),(.*?)(?:#(.*))?$/); + + if (!parts) { + throw new Error(`Invalid URL: ${urlString}`); + } + + const mediaType = parts[1].split(';'); + const body = parts[2]; + const hash = stripHash ? '' : parts[3]; + + let base64 = false; + + if (mediaType[mediaType.length - 1] === 'base64') { + mediaType.pop(); + base64 = true; + } + + // Lowercase MIME type + const mimeType = (mediaType.shift() || '').toLowerCase(); + const attributes = mediaType + .map(attribute => { + let [key, value = ''] = attribute.split('=').map(string => string.trim()); + + // Lowercase `charset` + if (key === 'charset') { + value = value.toLowerCase(); + + if (value === DATA_URL_DEFAULT_CHARSET) { + return ''; + } + } + + return `${key}${value ? `=${value}` : ''}`; + }) + .filter(Boolean); + + const normalizedMediaType = [ + ...attributes + ]; + + if (base64) { + normalizedMediaType.push('base64'); + } + + if (normalizedMediaType.length !== 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) { + normalizedMediaType.unshift(mimeType); + } + + return `data:${normalizedMediaType.join(';')},${base64 ? body.trim() : body}${hash ? `#${hash}` : ''}`; +}; + +const normalizeUrl = (urlString, options) => { + options = { + defaultProtocol: 'http:', + normalizeProtocol: true, + forceHttp: false, + forceHttps: false, + stripAuthentication: true, + stripHash: false, + stripWWW: true, + removeQueryParameters: [/^utm_\w+/i], + removeTrailingSlash: true, + removeDirectoryIndex: false, + sortQueryParameters: true, + ...options + }; + + // TODO: Remove this at some point in the future + if (Reflect.has(options, 'normalizeHttps')) { + throw new Error('options.normalizeHttps is renamed to options.forceHttp'); + } + + if (Reflect.has(options, 'normalizeHttp')) { + throw new Error('options.normalizeHttp is renamed to options.forceHttps'); + } + + if (Reflect.has(options, 'stripFragment')) { + throw new Error('options.stripFragment is renamed to options.stripHash'); + } + + urlString = urlString.trim(); + + // Data URL + if (/^data:/i.test(urlString)) { + return normalizeDataURL(urlString, options); + } + + const hasRelativeProtocol = urlString.startsWith('//'); + const isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(urlString); + + // Prepend protocol + if (!isRelativeUrl) { + urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, options.defaultProtocol); + } + + const urlObj = new URLParser(urlString); + + if (options.forceHttp && options.forceHttps) { + throw new Error('The `forceHttp` and `forceHttps` options cannot be used together'); + } + + if (options.forceHttp && urlObj.protocol === 'https:') { + urlObj.protocol = 'http:'; + } + + if (options.forceHttps && urlObj.protocol === 'http:') { + urlObj.protocol = 'https:'; + } + + // Remove auth + if (options.stripAuthentication) { + urlObj.username = ''; + urlObj.password = ''; + } + + // Remove hash + if (options.stripHash) { + urlObj.hash = ''; + } + + // Remove duplicate slashes if not preceded by a protocol + if (urlObj.pathname) { + // TODO: Use the following instead when targeting Node.js 10 + // `urlObj.pathname = urlObj.pathname.replace(/(? { + if (/^(?!\/)/g.test(p1)) { + return `${p1}/`; + } + + return '/'; + }); + } + + // Decode URI octets + if (urlObj.pathname) { + urlObj.pathname = decodeURI(urlObj.pathname); + } + + // Remove directory index + if (options.removeDirectoryIndex === true) { + options.removeDirectoryIndex = [/^index\.[a-z]+$/]; + } + + if (Array.isArray(options.removeDirectoryIndex) && options.removeDirectoryIndex.length > 0) { + let pathComponents = urlObj.pathname.split('/'); + const lastComponent = pathComponents[pathComponents.length - 1]; + + if (testParameter(lastComponent, options.removeDirectoryIndex)) { + pathComponents = pathComponents.slice(0, pathComponents.length - 1); + urlObj.pathname = pathComponents.slice(1).join('/') + '/'; + } + } + + if (urlObj.hostname) { + // Remove trailing dot + urlObj.hostname = urlObj.hostname.replace(/\.$/, ''); + + // Remove `www.` + if (options.stripWWW && /^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(urlObj.hostname)) { + // Each label should be max 63 at length (min: 2). + // The extension should be max 5 at length (min: 2). + // Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names + urlObj.hostname = urlObj.hostname.replace(/^www\./, ''); + } + } + + // Remove query unwanted parameters + if (Array.isArray(options.removeQueryParameters)) { + for (const key of [...urlObj.searchParams.keys()]) { + if (testParameter(key, options.removeQueryParameters)) { + urlObj.searchParams.delete(key); + } + } + } + + // Sort query parameters + if (options.sortQueryParameters) { + urlObj.searchParams.sort(); + } + + if (options.removeTrailingSlash) { + urlObj.pathname = urlObj.pathname.replace(/\/$/, ''); + } + + // Take advantage of many of the Node `url` normalizations + urlString = urlObj.toString(); + + // Remove ending `/` + if ((options.removeTrailingSlash || urlObj.pathname === '/') && urlObj.hash === '') { + urlString = urlString.replace(/\/$/, ''); + } + + // Restore relative protocol, if applicable + if (hasRelativeProtocol && !options.normalizeProtocol) { + urlString = urlString.replace(/^http:\/\//, '//'); + } + + // Remove http/https + if (options.stripProtocol) { + urlString = urlString.replace(/^(?:https?:)?\/\//, ''); + } + + return urlString; +}; + +module.exports = normalizeUrl; +// TODO: Remove this for the next major release +module.exports.default = normalizeUrl; + + +/***/ }), + +/***/ 1223: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var wrappy = __nccwpck_require__(2940) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) }, + configurable: true + }) - /***/ 8810: /***/ (module) => { - /*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - - module.exports = function isBuffer(obj) { - return ( - obj != null && - obj.constructor != null && - typeof obj.constructor.isBuffer === 'function' && - obj.constructor.isBuffer(obj) - ); - }; - - /***/ + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) }, + configurable: true + }) +}) - /***/ 4118: /***/ (module) => { - 'use strict'; +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} - module.exports = (value) => { - if (Object.prototype.toString.call(value) !== '[object Object]') { - return false; - } +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} - const prototype = Object.getPrototypeOf(value); - return prototype === null || prototype === Object.prototype; - }; - /***/ - }, +/***/ }), - /***/ 4070: /***/ (module) => { - 'use strict'; +/***/ 9072: +/***/ ((module) => { - module.exports = convert; +"use strict"; - function convert(test) { - if (test == null) { - return ok; - } - if (typeof test === 'string') { - return typeFactory(test); - } +class CancelError extends Error { + constructor(reason) { + super(reason || 'Promise was canceled'); + this.name = 'CancelError'; + } - if (typeof test === 'object') { - return 'length' in test ? anyFactory(test) : allFactory(test); - } + get isCanceled() { + return true; + } +} - if (typeof test === 'function') { - return test; - } +class PCancelable { + static fn(userFn) { + return (...arguments_) => { + return new PCancelable((resolve, reject, onCancel) => { + arguments_.push(onCancel); + // eslint-disable-next-line promise/prefer-await-to-then + userFn(...arguments_).then(resolve, reject); + }); + }; + } - throw new Error('Expected function, string, or object as test'); + constructor(executor) { + this._cancelHandlers = []; + this._isPending = true; + this._isCanceled = false; + this._rejectOnCancel = true; + + this._promise = new Promise((resolve, reject) => { + this._reject = reject; + + const onResolve = value => { + this._isPending = false; + resolve(value); + }; + + const onReject = error => { + this._isPending = false; + reject(error); + }; + + const onCancel = handler => { + if (!this._isPending) { + throw new Error('The `onCancel` handler was attached after the promise settled.'); + } + + this._cancelHandlers.push(handler); + }; + + Object.defineProperties(onCancel, { + shouldReject: { + get: () => this._rejectOnCancel, + set: boolean => { + this._rejectOnCancel = boolean; + } + } + }); + + return executor(onResolve, onReject, onCancel); + }); + } + + then(onFulfilled, onRejected) { + // eslint-disable-next-line promise/prefer-await-to-then + return this._promise.then(onFulfilled, onRejected); + } + + catch(onRejected) { + return this._promise.catch(onRejected); + } + + finally(onFinally) { + return this._promise.finally(onFinally); + } + + cancel(reason) { + if (!this._isPending || this._isCanceled) { + return; + } + + if (this._cancelHandlers.length > 0) { + try { + for (const handler of this._cancelHandlers) { + handler(); + } + } catch (error) { + this._reject(error); + } + } + + this._isCanceled = true; + if (this._rejectOnCancel) { + this._reject(new CancelError(reason)); + } + } + + get isCanceled() { + return this._isCanceled; + } +} + +Object.setPrototypeOf(PCancelable.prototype, Promise.prototype); + +module.exports = PCancelable; +module.exports.CancelError = CancelError; + + +/***/ }), + +/***/ 3485: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var characterEntities = __nccwpck_require__(3407) + +module.exports = decodeEntity + +var own = {}.hasOwnProperty + +function decodeEntity(characters) { + return own.call(characterEntities, characters) + ? characterEntities[characters] + : false +} + + +/***/ }), + +/***/ 8341: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var once = __nccwpck_require__(1223) +var eos = __nccwpck_require__(1205) +var fs = __nccwpck_require__(5747) // we only need fs to get the ReadStream and WriteStream prototypes + +var noop = function () {} +var ancient = /^v?\.0/.test(process.version) + +var isFn = function (fn) { + return typeof fn === 'function' +} + +var isFS = function (stream) { + if (!ancient) return false // newer node version do not need to care about fs is a special way + if (!fs) return false // browser + return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close) +} + +var isRequest = function (stream) { + return stream.setHeader && isFn(stream.abort) +} + +var destroyer = function (stream, reading, writing, callback) { + callback = once(callback) + + var closed = false + stream.on('close', function () { + closed = true + }) + + eos(stream, {readable: reading, writable: writing}, function (err) { + if (err) return callback(err) + closed = true + callback() + }) + + var destroyed = false + return function (err) { + if (closed) return + if (destroyed) return + destroyed = true + + if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks + if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want + + if (isFn(stream.destroy)) return stream.destroy() + + callback(err || new Error('stream was destroyed')) + } +} + +var call = function (fn) { + fn() +} + +var pipe = function (from, to) { + return from.pipe(to) +} + +var pump = function () { + var streams = Array.prototype.slice.call(arguments) + var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop + + if (Array.isArray(streams[0])) streams = streams[0] + if (streams.length < 2) throw new Error('pump requires two streams per minimum') + + var error + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1 + var writing = i > 0 + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err + if (err) destroys.forEach(call) + if (reading) return + destroys.forEach(call) + callback(error) + }) + }) + + return streams.reduce(pipe) +} + +module.exports = pump + + +/***/ }), + +/***/ 9273: +/***/ ((module) => { + +"use strict"; + + +class QuickLRU { + constructor(options = {}) { + if (!(options.maxSize && options.maxSize > 0)) { + throw new TypeError('`maxSize` must be a number greater than 0'); + } + + this.maxSize = options.maxSize; + this.onEviction = options.onEviction; + this.cache = new Map(); + this.oldCache = new Map(); + this._size = 0; + } + + _set(key, value) { + this.cache.set(key, value); + this._size++; + + if (this._size >= this.maxSize) { + this._size = 0; + + if (typeof this.onEviction === 'function') { + for (const [key, value] of this.oldCache.entries()) { + this.onEviction(key, value); + } + } + + this.oldCache = this.cache; + this.cache = new Map(); + } + } + + get(key) { + if (this.cache.has(key)) { + return this.cache.get(key); + } + + if (this.oldCache.has(key)) { + const value = this.oldCache.get(key); + this.oldCache.delete(key); + this._set(key, value); + return value; + } + } + + set(key, value) { + if (this.cache.has(key)) { + this.cache.set(key, value); + } else { + this._set(key, value); + } + + return this; + } + + has(key) { + return this.cache.has(key) || this.oldCache.has(key); + } + + peek(key) { + if (this.cache.has(key)) { + return this.cache.get(key); + } + + if (this.oldCache.has(key)) { + return this.oldCache.get(key); + } + } + + delete(key) { + const deleted = this.cache.delete(key); + if (deleted) { + this._size--; + } + + return this.oldCache.delete(key) || deleted; + } + + clear() { + this.cache.clear(); + this.oldCache.clear(); + this._size = 0; + } + + * keys() { + for (const [key] of this) { + yield key; + } + } + + * values() { + for (const [, value] of this) { + yield value; + } + } + + * [Symbol.iterator]() { + for (const item of this.cache) { + yield item; + } + + for (const item of this.oldCache) { + const [key] = item; + if (!this.cache.has(key)) { + yield item; + } + } + } + + get size() { + let oldCacheSize = 0; + for (const key of this.oldCache.keys()) { + if (!this.cache.has(key)) { + oldCacheSize++; + } + } + + return Math.min(this._size + oldCacheSize, this.maxSize); + } +} + +module.exports = QuickLRU; + + +/***/ }), + +/***/ 4859: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = parse + +var fromMarkdown = __nccwpck_require__(3068) + +function parse(options) { + var self = this + + this.Parser = parse + + function parse(doc) { + return fromMarkdown( + doc, + Object.assign({}, self.data('settings'), options, { + // Note: these options are not in the readme. + // The goal is for them to be set by plugins on `data` instead of being + // passed by users. + extensions: self.data('micromarkExtensions') || [], + mdastExtensions: self.data('fromMarkdownExtensions') || [] + }) + ) + } +} + + +/***/ }), + +/***/ 7114: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = stringify + +var toMarkdown = __nccwpck_require__(219) + +function stringify(options) { + var self = this + + this.Compiler = compile + + function compile(tree) { + return toMarkdown( + tree, + Object.assign({}, self.data('settings'), options, { + // Note: this option is not in the readme. + // The goal is for it to be set by plugins on `data` instead of being + // passed by users. + extensions: self.data('toMarkdownExtensions') || [] + }) + ) + } +} + + +/***/ }), + +/***/ 5096: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var util = __nccwpck_require__(6184) + +module.exports = toc + +var defaultHeading = 'toc|table[ -]of[ -]contents?' + +function toc(options) { + var settings = options || {} + var heading = settings.heading || defaultHeading + var depth = settings.maxDepth || 6 + var tight = settings.tight + var skip = settings.skip + + return transformer + + function transformer(node) { + var result = util(node, { + heading: heading, + maxDepth: depth, + tight: tight, + skip: skip + }) + + if (result.index === null || result.index === -1 || !result.map) { + return + } + + node.children = [].concat( + node.children.slice(0, result.index), + result.map, + node.children.slice(result.endIndex) + ) + } +} + + +/***/ }), + +/***/ 2081: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var unified = __nccwpck_require__(5075) +var parse = __nccwpck_require__(4859) +var stringify = __nccwpck_require__(7114) + +module.exports = unified().use(parse).use(stringify).freeze() + + +/***/ }), + +/***/ 6976: +/***/ ((module) => { + +"use strict"; +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +/** + * Results cache + */ + +var res = ''; +var cache; + +/** + * Expose `repeat` + */ + +module.exports = repeat; + +/** + * Repeat the given `string` the specified `number` + * of times. + * + * **Example:** + * + * ```js + * var repeat = require('repeat-string'); + * repeat('A', 5); + * //=> AAAAA + * ``` + * + * @param {String} `string` The string to repeat + * @param {Number} `number` The number of times to repeat the string + * @return {String} Repeated string + * @api public + */ + +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + // cover common, quick use cases + if (num === 1) return str; + if (num === 2) return str + str; + + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } else if (res.length >= max) { + return res.substr(0, max); + } + + while (max > res.length && num > 1) { + if (num & 1) { + res += str; + } + + num >>= 1; + str += str; + } + + res += str; + res = res.substr(0, max); + return res; +} + + +/***/ }), + +/***/ 6624: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const tls = __nccwpck_require__(4016); + +module.exports = (options = {}) => new Promise((resolve, reject) => { + const socket = tls.connect(options, () => { + if (options.resolveSocket) { + socket.off('error', reject); + resolve({alpnProtocol: socket.alpnProtocol, socket}); + } else { + socket.destroy(); + resolve({alpnProtocol: socket.alpnProtocol}); + } + }); + + socket.on('error', reject); +}); + + +/***/ }), + +/***/ 9004: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Readable = __nccwpck_require__(2413).Readable; +const lowercaseKeys = __nccwpck_require__(9662); + +class Response extends Readable { + constructor(statusCode, headers, body, url) { + if (typeof statusCode !== 'number') { + throw new TypeError('Argument `statusCode` should be a number'); + } + if (typeof headers !== 'object') { + throw new TypeError('Argument `headers` should be an object'); + } + if (!(body instanceof Buffer)) { + throw new TypeError('Argument `body` should be a buffer'); + } + if (typeof url !== 'string') { + throw new TypeError('Argument `url` should be a string'); + } + + super(); + this.statusCode = statusCode; + this.headers = lowercaseKeys(headers); + this.body = body; + this.url = url; + } + + _read() { + this.push(this.body); + this.push(null); + } +} + +module.exports = Response; + + +/***/ }), + +/***/ 3604: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var wrap = __nccwpck_require__(3458) + +module.exports = trough + +trough.wrap = wrap + +var slice = [].slice + +// Create new middleware. +function trough() { + var fns = [] + var middleware = {} + + middleware.run = run + middleware.use = use + + return middleware + + // Run `fns`. Last argument must be a completion handler. + function run() { + var index = -1 + var input = slice.call(arguments, 0, -1) + var done = arguments[arguments.length - 1] + + if (typeof done !== 'function') { + throw new Error('Expected function as last argument, not ' + done) + } + + next.apply(null, [null].concat(input)) + + // Run the next `fn`, if any. + function next(err) { + var fn = fns[++index] + var params = slice.call(arguments, 0) + var values = params.slice(1) + var length = input.length + var pos = -1 + + if (err) { + done(err) + return } - // Utility assert each property in `test` is represented in `node`, and each - // values are strictly equal. - function allFactory(test) { - return all; + // Copy non-nully input into values. + while (++pos < length) { + if (values[pos] === null || values[pos] === undefined) { + values[pos] = input[pos] + } + } - function all(node) { - var key; + input = values - for (key in test) { - if (node[key] !== test[key]) return false; + // Next or done. + if (fn) { + wrap(fn, next).apply(null, input) + } else { + done.apply(null, [null].concat(input)) + } + } + } + + // Add `fn` to the list. + function use(fn) { + if (typeof fn !== 'function') { + throw new Error('Expected `fn` to be a function, not ' + fn) + } + + fns.push(fn) + + return middleware + } +} + + +/***/ }), + +/***/ 3458: +/***/ ((module) => { + +"use strict"; + + +var slice = [].slice + +module.exports = wrap + +// Wrap `fn`. +// Can be sync or async; return a promise, receive a completion handler, return +// new values and errors. +function wrap(fn, callback) { + var invoked + + return wrapped + + function wrapped() { + var params = slice.call(arguments, 0) + var callback = fn.length > params.length + var result + + if (callback) { + params.push(done) + } + + try { + result = fn.apply(null, params) + } catch (error) { + // Well, this is quite the pickle. + // `fn` received a callback and invoked it (thus continuing the pipeline), + // but later also threw an error. + // We’re not about to restart the pipeline again, so the only thing left + // to do is to throw the thing instead. + if (callback && invoked) { + throw error + } + + return done(error) + } + + if (!callback) { + if (result && typeof result.then === 'function') { + result.then(then, done) + } else if (result instanceof Error) { + done(result) + } else { + then(result) + } + } + } + + // Invoke `next`, only once. + function done() { + if (!invoked) { + invoked = true + + callback.apply(null, arguments) + } + } + + // Invoke `done` with one value. + // Tracks if an error is passed, too. + function then(value) { + done(null, value) + } +} + + +/***/ }), + +/***/ 5075: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var bail = __nccwpck_require__(7240) +var buffer = __nccwpck_require__(8810) +var extend = __nccwpck_require__(8171) +var plain = __nccwpck_require__(4118) +var trough = __nccwpck_require__(3604) +var vfile = __nccwpck_require__(4860) + +// Expose a frozen processor. +module.exports = unified().freeze() + +var slice = [].slice +var own = {}.hasOwnProperty + +// Process pipeline. +var pipeline = trough() + .use(pipelineParse) + .use(pipelineRun) + .use(pipelineStringify) + +function pipelineParse(p, ctx) { + ctx.tree = p.parse(ctx.file) +} + +function pipelineRun(p, ctx, next) { + p.run(ctx.tree, ctx.file, done) + + function done(err, tree, file) { + if (err) { + next(err) + } else { + ctx.tree = tree + ctx.file = file + next() + } + } +} + +function pipelineStringify(p, ctx) { + var result = p.stringify(ctx.tree, ctx.file) + var file = ctx.file + + if (result === undefined || result === null) { + // Empty. + } else if (typeof result === 'string' || buffer(result)) { + file.contents = result + } else { + file.result = result + } +} + +// Function to create the first processor. +function unified() { + var attachers = [] + var transformers = trough() + var namespace = {} + var frozen = false + var freezeIndex = -1 + + // Data management. + processor.data = data + + // Lock. + processor.freeze = freeze + + // Plugins. + processor.attachers = attachers + processor.use = use + + // API. + processor.parse = parse + processor.stringify = stringify + processor.run = run + processor.runSync = runSync + processor.process = process + processor.processSync = processSync + + // Expose. + return processor + + // Create a new processor based on the processor in the current scope. + function processor() { + var destination = unified() + var length = attachers.length + var index = -1 + + while (++index < length) { + destination.use.apply(null, attachers[index]) + } + + destination.data(extend(true, {}, namespace)) + + return destination + } + + // Freeze: used to signal a processor that has finished configuration. + // + // For example, take unified itself: it’s frozen. + // Plugins should not be added to it. + // Rather, it should be extended, by invoking it, before modifying it. + // + // In essence, always invoke this when exporting a processor. + function freeze() { + var values + var plugin + var options + var transformer + + if (frozen) { + return processor + } + + while (++freezeIndex < attachers.length) { + values = attachers[freezeIndex] + plugin = values[0] + options = values[1] + transformer = null + + if (options === false) { + continue + } + + if (options === true) { + values[1] = undefined + } + + transformer = plugin.apply(processor, values.slice(1)) + + if (typeof transformer === 'function') { + transformers.use(transformer) + } + } + + frozen = true + freezeIndex = Infinity + + return processor + } + + // Data management. + // Getter / setter for processor-specific informtion. + function data(key, value) { + if (typeof key === 'string') { + // Set `key`. + if (arguments.length === 2) { + assertUnfrozen('data', frozen) + + namespace[key] = value + + return processor + } + + // Get `key`. + return (own.call(namespace, key) && namespace[key]) || null + } + + // Set space. + if (key) { + assertUnfrozen('data', frozen) + namespace = key + return processor + } + + // Get space. + return namespace + } + + // Plugin management. + // + // Pass it: + // * an attacher and options, + // * a preset, + // * a list of presets, attachers, and arguments (list of attachers and + // options). + function use(value) { + var settings + + assertUnfrozen('use', frozen) + + if (value === null || value === undefined) { + // Empty. + } else if (typeof value === 'function') { + addPlugin.apply(null, arguments) + } else if (typeof value === 'object') { + if ('length' in value) { + addList(value) + } else { + addPreset(value) + } + } else { + throw new Error('Expected usable value, not `' + value + '`') + } + + if (settings) { + namespace.settings = extend(namespace.settings || {}, settings) + } + + return processor + + function addPreset(result) { + addList(result.plugins) + + if (result.settings) { + settings = extend(settings || {}, result.settings) + } + } + + function add(value) { + if (typeof value === 'function') { + addPlugin(value) + } else if (typeof value === 'object') { + if ('length' in value) { + addPlugin.apply(null, value) + } else { + addPreset(value) + } + } else { + throw new Error('Expected usable value, not `' + value + '`') + } + } + + function addList(plugins) { + var length + var index + + if (plugins === null || plugins === undefined) { + // Empty. + } else if (typeof plugins === 'object' && 'length' in plugins) { + length = plugins.length + index = -1 + + while (++index < length) { + add(plugins[index]) + } + } else { + throw new Error('Expected a list of plugins, not `' + plugins + '`') + } + } + + function addPlugin(plugin, value) { + var entry = find(plugin) + + if (entry) { + if (plain(entry[1]) && plain(value)) { + value = extend(entry[1], value) + } + + entry[1] = value + } else { + attachers.push(slice.call(arguments)) + } + } + } + + function find(plugin) { + var length = attachers.length + var index = -1 + var entry + + while (++index < length) { + entry = attachers[index] + + if (entry[0] === plugin) { + return entry + } + } + } + + // Parse a file (in string or vfile representation) into a unist node using + // the `Parser` on the processor. + function parse(doc) { + var file = vfile(doc) + var Parser + + freeze() + Parser = processor.Parser + assertParser('parse', Parser) + + if (newable(Parser, 'parse')) { + return new Parser(String(file), file).parse() + } + + return Parser(String(file), file) // eslint-disable-line new-cap + } + + // Run transforms on a unist node representation of a file (in string or + // vfile representation), async. + function run(node, file, cb) { + assertNode(node) + freeze() + + if (!cb && typeof file === 'function') { + cb = file + file = null + } + + if (!cb) { + return new Promise(executor) + } + + executor(null, cb) + + function executor(resolve, reject) { + transformers.run(node, vfile(file), done) + + function done(err, tree, file) { + tree = tree || node + if (err) { + reject(err) + } else if (resolve) { + resolve(tree) + } else { + cb(null, tree, file) + } + } + } + } + + // Run transforms on a unist node representation of a file (in string or + // vfile representation), sync. + function runSync(node, file) { + var complete = false + var result + + run(node, file, done) + + assertDone('runSync', 'run', complete) + + return result + + function done(err, tree) { + complete = true + bail(err) + result = tree + } + } + + // Stringify a unist node representation of a file (in string or vfile + // representation) into a string using the `Compiler` on the processor. + function stringify(node, doc) { + var file = vfile(doc) + var Compiler + + freeze() + Compiler = processor.Compiler + assertCompiler('stringify', Compiler) + assertNode(node) + + if (newable(Compiler, 'compile')) { + return new Compiler(node, file).compile() + } + + return Compiler(node, file) // eslint-disable-line new-cap + } + + // Parse a file (in string or vfile representation) into a unist node using + // the `Parser` on the processor, then run transforms on that node, and + // compile the resulting node using the `Compiler` on the processor, and + // store that result on the vfile. + function process(doc, cb) { + freeze() + assertParser('process', processor.Parser) + assertCompiler('process', processor.Compiler) + + if (!cb) { + return new Promise(executor) + } + + executor(null, cb) + + function executor(resolve, reject) { + var file = vfile(doc) + + pipeline.run(processor, {file: file}, done) + + function done(err) { + if (err) { + reject(err) + } else if (resolve) { + resolve(file) + } else { + cb(null, file) + } + } + } + } + + // Process the given document (in string or vfile representation), sync. + function processSync(doc) { + var complete = false + var file + + freeze() + assertParser('processSync', processor.Parser) + assertCompiler('processSync', processor.Compiler) + file = vfile(doc) + + process(file, done) + + assertDone('processSync', 'process', complete) + + return file + + function done(err) { + complete = true + bail(err) + } + } +} + +// Check if `value` is a constructor. +function newable(value, name) { + return ( + typeof value === 'function' && + value.prototype && + // A function with keys in its prototype is probably a constructor. + // Classes’ prototype methods are not enumerable, so we check if some value + // exists in the prototype. + (keys(value.prototype) || name in value.prototype) + ) +} + +// Check if `value` is an object with keys. +function keys(value) { + var key + for (key in value) { + return true + } + + return false +} + +// Assert a parser is available. +function assertParser(name, Parser) { + if (typeof Parser !== 'function') { + throw new Error('Cannot `' + name + '` without `Parser`') + } +} + +// Assert a compiler is available. +function assertCompiler(name, Compiler) { + if (typeof Compiler !== 'function') { + throw new Error('Cannot `' + name + '` without `Compiler`') + } +} + +// Assert the processor is not frozen. +function assertUnfrozen(name, frozen) { + if (frozen) { + throw new Error( + 'Cannot invoke `' + + name + + '` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.' + ) + } +} + +// Assert `node` is a unist node. +function assertNode(node) { + if (!node || typeof node.type !== 'string') { + throw new Error('Expected node, got `' + node + '`') + } +} + +// Assert that `complete` is `true`. +function assertDone(name, asyncName, complete) { + if (!complete) { + throw new Error( + '`' + name + '` finished async. Use `' + asyncName + '` instead' + ) + } +} + + +/***/ }), + +/***/ 8810: +/***/ ((module) => { + +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +module.exports = function isBuffer (obj) { + return obj != null && obj.constructor != null && + typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + + +/***/ }), + +/***/ 4118: +/***/ ((module) => { + +"use strict"; + + +module.exports = value => { + if (Object.prototype.toString.call(value) !== '[object Object]') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === null || prototype === Object.prototype; +}; + + +/***/ }), + +/***/ 4070: +/***/ ((module) => { + +"use strict"; + + +module.exports = convert + +function convert(test) { + if (test == null) { + return ok + } + + if (typeof test === 'string') { + return typeFactory(test) + } + + if (typeof test === 'object') { + return 'length' in test ? anyFactory(test) : allFactory(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function allFactory(test) { + return all + + function all(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) return false + } + + return true + } +} + +function anyFactory(tests) { + var checks = [] + var index = -1 + + while (++index < tests.length) { + checks[index] = convert(tests[index]) + } + + return any + + function any() { + var index = -1 + + while (++index < checks.length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} + + +/***/ }), + +/***/ 1957: +/***/ ((module) => { + +"use strict"; + + +var own = {}.hasOwnProperty + +module.exports = stringify + +function stringify(value) { + // Nothing. + if (!value || typeof value !== 'object') { + return '' + } + + // Node. + if (own.call(value, 'position') || own.call(value, 'type')) { + return position(value.position) + } + + // Position. + if (own.call(value, 'start') || own.call(value, 'end')) { + return position(value) + } + + // Point. + if (own.call(value, 'line') || own.call(value, 'column')) { + return point(value) + } + + // ? + return '' +} + +function point(point) { + if (!point || typeof point !== 'object') { + point = {} + } + + return index(point.line) + ':' + index(point.column) +} + +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {} + } + + return point(pos.start) + '-' + point(pos.end) +} + +function index(value) { + return value && typeof value === 'number' ? value : 1 +} + + +/***/ }), + +/***/ 9906: +/***/ ((module) => { + +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} + + +/***/ }), + +/***/ 3246: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = visitParents + +var convert = __nccwpck_require__(4070) +var color = __nccwpck_require__(9906) + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var step + var is + + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + step = reverse ? -1 : 1 + + factory(tree, null, [])() + + function factory(node, index, parents) { + var value = typeof node === 'object' && node !== null ? node : {} + var name + + if (typeof value.type === 'string') { + name = + typeof value.tagName === 'string' + ? value.tagName + : typeof value.name === 'string' + ? value.name + : undefined + + visit.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return visit + + function visit() { + var grandparents = parents.concat(node) + var result = [] + var subresult + var offset + + if (!test || is(node, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(node, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (node.children && result[0] !== SKIP) { + offset = (reverse ? node.children.length : -1) + step + + while (offset > -1 && offset < node.children.length) { + subresult = factory(node.children[offset], offset, grandparents)() + + if (subresult[0] === EXIT) { + return subresult } - return true; + offset = + typeof subresult[1] === 'number' ? subresult[1] : offset + step } } - function anyFactory(tests) { - var checks = []; - var index = -1; + return result + } + } +} - while (++index < tests.length) { - checks[index] = convert(tests[index]); - } +function toResult(value) { + if (value !== null && typeof value === 'object' && 'length' in value) { + return value + } - return any; + if (typeof value === 'number') { + return [CONTINUE, value] + } - function any() { - var index = -1; + return [value] +} - while (++index < checks.length) { - if (checks[index].apply(this, arguments)) { - return true; - } - } - return false; - } +/***/ }), + +/***/ 199: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = visit + +var visitParents = __nccwpck_require__(3246) + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} + + +/***/ }), + +/***/ 4108: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var stringify = __nccwpck_require__(1957) + +module.exports = VMessage + +// Inherit from `Error#`. +function VMessagePrototype() {} +VMessagePrototype.prototype = Error.prototype +VMessage.prototype = new VMessagePrototype() + +// Message properties. +var proto = VMessage.prototype + +proto.file = '' +proto.name = '' +proto.reason = '' +proto.message = '' +proto.stack = '' +proto.fatal = null +proto.column = null +proto.line = null + +// Construct a new VMessage. +// +// Note: We cannot invoke `Error` on the created context, as that adds readonly +// `line` and `column` attributes on Safari 9, thus throwing and failing the +// data. +function VMessage(reason, position, origin) { + var parts + var range + var location + + if (typeof position === 'string') { + origin = position + position = null + } + + parts = parseOrigin(origin) + range = stringify(position) || '1:1' + + location = { + start: {line: null, column: null}, + end: {line: null, column: null} + } + + // Node. + if (position && position.position) { + position = position.position + } + + if (position) { + // Position. + if (position.start) { + location = position + position = position.start + } else { + // Point. + location.start = position + } + } + + if (reason.stack) { + this.stack = reason.stack + reason = reason.message + } + + this.message = reason + this.name = range + this.reason = reason + this.line = position ? position.line : null + this.column = position ? position.column : null + this.location = location + this.source = parts[0] + this.ruleId = parts[1] +} + +function parseOrigin(origin) { + var result = [null, null] + var index + + if (typeof origin === 'string') { + index = origin.indexOf(':') + + if (index === -1) { + result[1] = origin + } else { + result[0] = origin.slice(0, index) + result[1] = origin.slice(index + 1) + } + } + + return result +} + + +/***/ }), + +/***/ 4860: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = __nccwpck_require__(77) + + +/***/ }), + +/***/ 9523: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var p = __nccwpck_require__(9239) +var proc = __nccwpck_require__(6070) +var buffer = __nccwpck_require__(2157) + +module.exports = VFile + +var own = {}.hasOwnProperty + +// Order of setting (least specific to most), we need this because otherwise +// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a +// stem can be set. +var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname'] + +VFile.prototype.toString = toString + +// Access full path (`~/index.min.js`). +Object.defineProperty(VFile.prototype, 'path', {get: getPath, set: setPath}) + +// Access parent path (`~`). +Object.defineProperty(VFile.prototype, 'dirname', { + get: getDirname, + set: setDirname +}) + +// Access basename (`index.min.js`). +Object.defineProperty(VFile.prototype, 'basename', { + get: getBasename, + set: setBasename +}) + +// Access extname (`.js`). +Object.defineProperty(VFile.prototype, 'extname', { + get: getExtname, + set: setExtname +}) + +// Access stem (`index.min`). +Object.defineProperty(VFile.prototype, 'stem', {get: getStem, set: setStem}) + +// Construct a new file. +function VFile(options) { + var prop + var index + + if (!options) { + options = {} + } else if (typeof options === 'string' || buffer(options)) { + options = {contents: options} + } else if ('message' in options && 'messages' in options) { + return options + } + + if (!(this instanceof VFile)) { + return new VFile(options) + } + + this.data = {} + this.messages = [] + this.history = [] + this.cwd = proc.cwd() + + // Set path related properties in the correct order. + index = -1 + + while (++index < order.length) { + prop = order[index] + + if (own.call(options, prop)) { + this[prop] = options[prop] + } + } + + // Set non-path related properties. + for (prop in options) { + if (order.indexOf(prop) < 0) { + this[prop] = options[prop] + } + } +} + +function getPath() { + return this.history[this.history.length - 1] +} + +function setPath(path) { + assertNonEmpty(path, 'path') + + if (this.path !== path) { + this.history.push(path) + } +} + +function getDirname() { + return typeof this.path === 'string' ? p.dirname(this.path) : undefined +} + +function setDirname(dirname) { + assertPath(this.path, 'dirname') + this.path = p.join(dirname || '', this.basename) +} + +function getBasename() { + return typeof this.path === 'string' ? p.basename(this.path) : undefined +} + +function setBasename(basename) { + assertNonEmpty(basename, 'basename') + assertPart(basename, 'basename') + this.path = p.join(this.dirname || '', basename) +} + +function getExtname() { + return typeof this.path === 'string' ? p.extname(this.path) : undefined +} + +function setExtname(extname) { + assertPart(extname, 'extname') + assertPath(this.path, 'extname') + + if (extname) { + if (extname.charCodeAt(0) !== 46 /* `.` */) { + throw new Error('`extname` must start with `.`') + } + + if (extname.indexOf('.', 1) > -1) { + throw new Error('`extname` cannot contain multiple dots') + } + } + + this.path = p.join(this.dirname, this.stem + (extname || '')) +} + +function getStem() { + return typeof this.path === 'string' + ? p.basename(this.path, this.extname) + : undefined +} + +function setStem(stem) { + assertNonEmpty(stem, 'stem') + assertPart(stem, 'stem') + this.path = p.join(this.dirname || '', stem + (this.extname || '')) +} + +// Get the value of the file. +function toString(encoding) { + return (this.contents || '').toString(encoding) +} + +// Assert that `part` is not a path (i.e., does not contain `p.sep`). +function assertPart(part, name) { + if (part && part.indexOf(p.sep) > -1) { + throw new Error( + '`' + name + '` cannot be a path: did not expect `' + p.sep + '`' + ) + } +} + +// Assert that `part` is not empty. +function assertNonEmpty(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty') + } +} + +// Assert `path` exists. +function assertPath(path, name) { + if (!path) { + throw new Error('Setting `' + name + '` requires `path` to be set too') + } +} + + +/***/ }), + +/***/ 77: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var VMessage = __nccwpck_require__(4108) +var VFile = __nccwpck_require__(9523) + +module.exports = VFile + +VFile.prototype.message = message +VFile.prototype.info = info +VFile.prototype.fail = fail + +// Create a message with `reason` at `position`. +// When an error is passed in as `reason`, copies the stack. +function message(reason, position, origin) { + var message = new VMessage(reason, position, origin) + + if (this.path) { + message.name = this.path + ':' + message.name + message.file = this.path + } + + message.fatal = false + + this.messages.push(message) + + return message +} + +// Fail: creates a vmessage, associates it with the file, and throws it. +function fail() { + var message = this.message.apply(this, arguments) + + message.fatal = true + + throw message +} + +// Info: creates a vmessage, associates it with the file, and marks the fatality +// as null. +function info() { + var message = this.message.apply(this, arguments) + + message.fatal = null + + return message +} + + +/***/ }), + +/***/ 9239: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = __nccwpck_require__(5622) + + +/***/ }), + +/***/ 6070: +/***/ ((module) => { + +"use strict"; + + +module.exports = process + + +/***/ }), + +/***/ 2157: +/***/ ((module) => { + +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +module.exports = function isBuffer (obj) { + return obj != null && obj.constructor != null && + typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + + +/***/ }), + +/***/ 2940: +/***/ ((module) => { + +// 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 (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} + + +/***/ }), + +/***/ 1067: +/***/ ((module) => { + +"use strict"; + + +module.exports = factory + +var noop = Function.prototype +var own = {}.hasOwnProperty + +// Handle values based on a property. +function factory(key, options) { + var settings = options || {} + + function one(value) { + var fn = one.invalid + var handlers = one.handlers + + if (value && own.call(value, key)) { + fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown + } + + return (fn || noop).apply(this, arguments) + } + + one.handlers = settings.handlers || {} + one.invalid = settings.invalid + one.unknown = settings.unknown + + return one +} + + +/***/ }), + +/***/ 9338: +/***/ ((module) => { + +"use strict"; +/** + * Copyright (c) 2016 Jonas Hermsmeier + * https://github.com/jhermsmeier/node-http-link-header + */ + + + +var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i; +var WS_TRIM_PATTERN = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; +var WS_CHAR_PATTERN = /\s|\uFEFF|\xA0/; +var WS_FOLD_PATTERN = /\r?\n[\x20\x09]+/g; +var DELIMITER_PATTERN = /[;,"]/; +var WS_DELIMITER_PATTERN = /[;,"]|\s/; + +/** + * Token character pattern + * @type {RegExp} + * @see https://tools.ietf.org/html/rfc7230#section-3.2.6 + */ +var TOKEN_PATTERN = /^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/; + +var STATE = { + IDLE: 1 << 0, + URI: 1 << 1, + ATTR: 1 << 2, +}; + +function trim(value) { + return value.replace(WS_TRIM_PATTERN, ''); +} + +function hasWhitespace(value) { + return WS_CHAR_PATTERN.test(value); +} + +function skipWhitespace(value, offset) { + while (hasWhitespace(value[offset])) { + offset++; + } + return offset; +} + +function needsQuotes(value) { + return WS_DELIMITER_PATTERN.test(value) || !TOKEN_PATTERN.test(value); +} + +class Link { + /** + * Link + * @constructor + * @param {String} [value] + * @returns {Link} + */ + constructor(value) { + /** @type {Array} URI references */ + this.refs = []; + + if (value) { + this.parse(value); + } + } + + /** + * Get refs with given relation type + * @param {String} value + * @returns {Array} + */ + rel(value) { + var links = []; + var type = value.toLowerCase(); + + for (var i = 0; i < this.refs.length; i++) { + if (this.refs[i].rel.toLowerCase() === type) { + links.push(this.refs[i]); } + } - // Utility to convert a string into a function which checks a given node’s type - // for said string. - function typeFactory(test) { - return type; + return links; + } - function type(node) { - return Boolean(node && node.type === test); - } + /** + * Get refs where given attribute has a given value + * @param {String} attr + * @param {String} value + * @returns {Array} + */ + get(attr, value) { + attr = attr.toLowerCase(); + + var links = []; + + for (var i = 0; i < this.refs.length; i++) { + if (this.refs[i][attr] === value) { + links.push(this.refs[i]); } + } - // Utility to return true. - function ok() { + return links; + } + + set(link) { + this.refs.push(link); + return this; + } + + has(attr, value) { + attr = attr.toLowerCase(); + + for (var i = 0; i < this.refs.length; i++) { + if (this.refs[i][attr] === value) { return true; } + } - /***/ - }, + return false; + } - /***/ 1957: /***/ (module) => { - 'use strict'; + parse(value, offset) { + offset = offset || 0; + value = offset ? value.slice(offset) : value; - var own = {}.hasOwnProperty; + // Trim & unfold folded lines + value = trim(value).replace(WS_FOLD_PATTERN, ''); - module.exports = stringify; + var state = STATE.IDLE; + var length = value.length; + var offset = 0; + var ref = null; - function stringify(value) { - // Nothing. - if (!value || typeof value !== 'object') { - return ''; - } - - // Node. - if (own.call(value, 'position') || own.call(value, 'type')) { - return position(value.position); - } - - // Position. - if (own.call(value, 'start') || own.call(value, 'end')) { - return position(value); - } - - // Point. - if (own.call(value, 'line') || own.call(value, 'column')) { - return point(value); - } - - // ? - return ''; - } - - function point(point) { - if (!point || typeof point !== 'object') { - point = {}; - } - - return index(point.line) + ':' + index(point.column); - } - - function position(pos) { - if (!pos || typeof pos !== 'object') { - pos = {}; - } - - return point(pos.start) + '-' + point(pos.end); - } - - function index(value) { - return value && typeof value === 'number' ? value : 1; - } - - /***/ - }, - - /***/ 9906: /***/ (module) => { - module.exports = color; - function color(d) { - return '\u001B[33m' + d + '\u001B[39m'; - } - - /***/ - }, - - /***/ 3246: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = visitParents; - - var convert = __nccwpck_require__(4070); - var color = __nccwpck_require__(9906); - - var CONTINUE = true; - var SKIP = 'skip'; - var EXIT = false; - - visitParents.CONTINUE = CONTINUE; - visitParents.SKIP = SKIP; - visitParents.EXIT = EXIT; - - function visitParents(tree, test, visitor, reverse) { - var step; - var is; - - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - - is = convert(test); - step = reverse ? -1 : 1; - - factory(tree, null, [])(); - - function factory(node, index, parents) { - var value = typeof node === 'object' && node !== null ? node : {}; - var name; - - if (typeof value.type === 'string') { - name = - typeof value.tagName === 'string' - ? value.tagName - : typeof value.name === 'string' - ? value.name - : undefined; - - visit.displayName = - 'node (' + - color(value.type + (name ? '<' + name + '>' : '')) + - ')'; - } - - return visit; - - function visit() { - var grandparents = parents.concat(node); - var result = []; - var subresult; - var offset; - - if (!test || is(node, index, parents[parents.length - 1] || null)) { - result = toResult(visitor(node, parents)); - - if (result[0] === EXIT) { - return result; - } - } - - if (node.children && result[0] !== SKIP) { - offset = (reverse ? node.children.length : -1) + step; - - while (offset > -1 && offset < node.children.length) { - subresult = factory( - node.children[offset], - offset, - grandparents - )(); - - if (subresult[0] === EXIT) { - return subresult; - } - - offset = - typeof subresult[1] === 'number' - ? subresult[1] - : offset + step; - } - } - - return result; - } - } - } - - function toResult(value) { - if (value !== null && typeof value === 'object' && 'length' in value) { - return value; - } - - if (typeof value === 'number') { - return [CONTINUE, value]; - } - - return [value]; - } - - /***/ - }, - - /***/ 199: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = visit; - - var visitParents = __nccwpck_require__(3246); - - var CONTINUE = visitParents.CONTINUE; - var SKIP = visitParents.SKIP; - var EXIT = visitParents.EXIT; - - visit.CONTINUE = CONTINUE; - visit.SKIP = SKIP; - visit.EXIT = EXIT; - - function visit(tree, test, visitor, reverse) { - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - - visitParents(tree, test, overload, reverse); - - function overload(node, parents) { - var parent = parents[parents.length - 1]; - var index = parent ? parent.children.indexOf(node) : null; - return visitor(node, index, parent); - } - } - - /***/ - }, - - /***/ 4108: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var stringify = __nccwpck_require__(1957); - - module.exports = VMessage; - - // Inherit from `Error#`. - function VMessagePrototype() {} - VMessagePrototype.prototype = Error.prototype; - VMessage.prototype = new VMessagePrototype(); - - // Message properties. - var proto = VMessage.prototype; - - proto.file = ''; - proto.name = ''; - proto.reason = ''; - proto.message = ''; - proto.stack = ''; - proto.fatal = null; - proto.column = null; - proto.line = null; - - // Construct a new VMessage. - // - // Note: We cannot invoke `Error` on the created context, as that adds readonly - // `line` and `column` attributes on Safari 9, thus throwing and failing the - // data. - function VMessage(reason, position, origin) { - var parts; - var range; - var location; - - if (typeof position === 'string') { - origin = position; - position = null; - } - - parts = parseOrigin(origin); - range = stringify(position) || '1:1'; - - location = { - start: { line: null, column: null }, - end: { line: null, column: null }, - }; - - // Node. - if (position && position.position) { - position = position.position; - } - - if (position) { - // Position. - if (position.start) { - location = position; - position = position.start; - } else { - // Point. - location.start = position; - } - } - - if (reason.stack) { - this.stack = reason.stack; - reason = reason.message; - } - - this.message = reason; - this.name = range; - this.reason = reason; - this.line = position ? position.line : null; - this.column = position ? position.column : null; - this.location = location; - this.source = parts[0]; - this.ruleId = parts[1]; - } - - function parseOrigin(origin) { - var result = [null, null]; - var index; - - if (typeof origin === 'string') { - index = origin.indexOf(':'); - - if (index === -1) { - result[1] = origin; - } else { - result[0] = origin.slice(0, index); - result[1] = origin.slice(index + 1); - } - } - - return result; - } - - /***/ - }, - - /***/ 4860: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = __nccwpck_require__(77); - - /***/ - }, - - /***/ 9523: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - var p = __nccwpck_require__(9239); - var proc = __nccwpck_require__(6070); - var buffer = __nccwpck_require__(2157); - - module.exports = VFile; - - var own = {}.hasOwnProperty; - - // Order of setting (least specific to most), we need this because otherwise - // `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a - // stem can be set. - var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; - - VFile.prototype.toString = toString; - - // Access full path (`~/index.min.js`). - Object.defineProperty(VFile.prototype, 'path', { - get: getPath, - set: setPath, - }); - - // Access parent path (`~`). - Object.defineProperty(VFile.prototype, 'dirname', { - get: getDirname, - set: setDirname, - }); - - // Access basename (`index.min.js`). - Object.defineProperty(VFile.prototype, 'basename', { - get: getBasename, - set: setBasename, - }); - - // Access extname (`.js`). - Object.defineProperty(VFile.prototype, 'extname', { - get: getExtname, - set: setExtname, - }); - - // Access stem (`index.min`). - Object.defineProperty(VFile.prototype, 'stem', { - get: getStem, - set: setStem, - }); - - // Construct a new file. - function VFile(options) { - var prop; - var index; - - if (!options) { - options = {}; - } else if (typeof options === 'string' || buffer(options)) { - options = { contents: options }; - } else if ('message' in options && 'messages' in options) { - return options; - } - - if (!(this instanceof VFile)) { - return new VFile(options); - } - - this.data = {}; - this.messages = []; - this.history = []; - this.cwd = proc.cwd(); - - // Set path related properties in the correct order. - index = -1; - - while (++index < order.length) { - prop = order[index]; - - if (own.call(options, prop)) { - this[prop] = options[prop]; - } - } - - // Set non-path related properties. - for (prop in options) { - if (order.indexOf(prop) < 0) { - this[prop] = options[prop]; - } - } - } - - function getPath() { - return this.history[this.history.length - 1]; - } - - function setPath(path) { - assertNonEmpty(path, 'path'); - - if (this.path !== path) { - this.history.push(path); - } - } - - function getDirname() { - return typeof this.path === 'string' ? p.dirname(this.path) : undefined; - } - - function setDirname(dirname) { - assertPath(this.path, 'dirname'); - this.path = p.join(dirname || '', this.basename); - } - - function getBasename() { - return typeof this.path === 'string' - ? p.basename(this.path) - : undefined; - } - - function setBasename(basename) { - assertNonEmpty(basename, 'basename'); - assertPart(basename, 'basename'); - this.path = p.join(this.dirname || '', basename); - } - - function getExtname() { - return typeof this.path === 'string' ? p.extname(this.path) : undefined; - } - - function setExtname(extname) { - assertPart(extname, 'extname'); - assertPath(this.path, 'extname'); - - if (extname) { - if (extname.charCodeAt(0) !== 46 /* `.` */) { - throw new Error('`extname` must start with `.`'); - } - - if (extname.indexOf('.', 1) > -1) { - throw new Error('`extname` cannot contain multiple dots'); - } - } - - this.path = p.join(this.dirname, this.stem + (extname || '')); - } - - function getStem() { - return typeof this.path === 'string' - ? p.basename(this.path, this.extname) - : undefined; - } - - function setStem(stem) { - assertNonEmpty(stem, 'stem'); - assertPart(stem, 'stem'); - this.path = p.join(this.dirname || '', stem + (this.extname || '')); - } - - // Get the value of the file. - function toString(encoding) { - return (this.contents || '').toString(encoding); - } - - // Assert that `part` is not a path (i.e., does not contain `p.sep`). - function assertPart(part, name) { - if (part && part.indexOf(p.sep) > -1) { - throw new Error( - '`' + name + '` cannot be a path: did not expect `' + p.sep + '`' - ); - } - } - - // Assert that `part` is not empty. - function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty'); - } - } - - // Assert `path` exists. - function assertPath(path, name) { - if (!path) { - throw new Error( - 'Setting `' + name + '` requires `path` to be set too' - ); - } - } - - /***/ - }, - - /***/ 77: /***/ (module, __unused_webpack_exports, __nccwpck_require__) => { - 'use strict'; - - var VMessage = __nccwpck_require__(4108); - var VFile = __nccwpck_require__(9523); - - module.exports = VFile; - - VFile.prototype.message = message; - VFile.prototype.info = info; - VFile.prototype.fail = fail; - - // Create a message with `reason` at `position`. - // When an error is passed in as `reason`, copies the stack. - function message(reason, position, origin) { - var message = new VMessage(reason, position, origin); - - if (this.path) { - message.name = this.path + ':' + message.name; - message.file = this.path; - } - - message.fatal = false; - - this.messages.push(message); - - return message; - } - - // Fail: creates a vmessage, associates it with the file, and throws it. - function fail() { - var message = this.message.apply(this, arguments); - - message.fatal = true; - - throw message; - } - - // Info: creates a vmessage, associates it with the file, and marks the fatality - // as null. - function info() { - var message = this.message.apply(this, arguments); - - message.fatal = null; - - return message; - } - - /***/ - }, - - /***/ 9239: /***/ ( - module, - __unused_webpack_exports, - __nccwpck_require__ - ) => { - 'use strict'; - - module.exports = __nccwpck_require__(5622); - - /***/ - }, - - /***/ 6070: /***/ (module) => { - 'use strict'; - - module.exports = process; - - /***/ - }, - - /***/ 2157: /***/ (module) => { - /*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - - module.exports = function isBuffer(obj) { - return ( - obj != null && - obj.constructor != null && - typeof obj.constructor.isBuffer === 'function' && - obj.constructor.isBuffer(obj) - ); - }; - - /***/ - }, - - /***/ 2940: /***/ (module) => { - // 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 (typeof fn !== 'function') - throw new TypeError('need wrapper function'); - - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k]; - }); - - return wrapper; - - function wrapper() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - var ret = fn.apply(this, args); - var cb = args[args.length - 1]; - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k]; - }); - } - return ret; - } - } - - /***/ - }, - - /***/ 1067: /***/ (module) => { - 'use strict'; - - module.exports = factory; - - var noop = Function.prototype; - var own = {}.hasOwnProperty; - - // Handle values based on a property. - function factory(key, options) { - var settings = options || {}; - - function one(value) { - var fn = one.invalid; - var handlers = one.handlers; - - if (value && own.call(value, key)) { - fn = own.call(handlers, value[key]) - ? handlers[value[key]] - : one.unknown; - } - - return (fn || noop).apply(this, arguments); - } - - one.handlers = settings.handlers || {}; - one.invalid = settings.invalid; - one.unknown = settings.unknown; - - return one; - } - - /***/ - }, - - /***/ 9338: /***/ (module) => { - 'use strict'; - /** - * Copyright (c) 2016 Jonas Hermsmeier - * https://github.com/jhermsmeier/node-http-link-header - */ - - var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i; - var WS_TRIM_PATTERN = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; - var WS_CHAR_PATTERN = /\s|\uFEFF|\xA0/; - var WS_FOLD_PATTERN = /\r?\n[\x20\x09]+/g; - var DELIMITER_PATTERN = /[;,"]/; - var WS_DELIMITER_PATTERN = /[;,"]|\s/; - - /** - * Token character pattern - * @type {RegExp} - * @see https://tools.ietf.org/html/rfc7230#section-3.2.6 - */ - var TOKEN_PATTERN = /^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/; - - var STATE = { - IDLE: 1 << 0, - URI: 1 << 1, - ATTR: 1 << 2, - }; - - function trim(value) { - return value.replace(WS_TRIM_PATTERN, ''); - } - - function hasWhitespace(value) { - return WS_CHAR_PATTERN.test(value); - } - - function skipWhitespace(value, offset) { - while (hasWhitespace(value[offset])) { + while (offset < length) { + if (state === STATE.IDLE) { + if (hasWhitespace(value[offset])) { offset++; - } - return offset; - } - - function needsQuotes(value) { - return WS_DELIMITER_PATTERN.test(value) || !TOKEN_PATTERN.test(value); - } - - class Link { - /** - * Link - * @constructor - * @param {String} [value] - * @returns {Link} - */ - constructor(value) { - /** @type {Array} URI references */ - this.refs = []; - - if (value) { - this.parse(value); - } - } - - /** - * Get refs with given relation type - * @param {String} value - * @returns {Array} - */ - rel(value) { - var links = []; - var type = value.toLowerCase(); - - for (var i = 0; i < this.refs.length; i++) { - if (this.refs[i].rel.toLowerCase() === type) { - links.push(this.refs[i]); - } - } - - return links; - } - - /** - * Get refs where given attribute has a given value - * @param {String} attr - * @param {String} value - * @returns {Array} - */ - get(attr, value) { - attr = attr.toLowerCase(); - - var links = []; - - for (var i = 0; i < this.refs.length; i++) { - if (this.refs[i][attr] === value) { - links.push(this.refs[i]); - } - } - - return links; - } - - set(link) { - this.refs.push(link); - return this; - } - - has(attr, value) { - attr = attr.toLowerCase(); - - for (var i = 0; i < this.refs.length; i++) { - if (this.refs[i][attr] === value) { - return true; - } - } - - return false; - } - - parse(value, offset) { - offset = offset || 0; - value = offset ? value.slice(offset) : value; - - // Trim & unfold folded lines - value = trim(value).replace(WS_FOLD_PATTERN, ''); - - var state = STATE.IDLE; - var length = value.length; - var offset = 0; - var ref = null; - - while (offset < length) { - if (state === STATE.IDLE) { - if (hasWhitespace(value[offset])) { - offset++; - continue; - } else if (value[offset] === '<') { - if (ref != null) { - ref.rel != null - ? this.refs.push(...Link.expandRelations(ref)) - : this.refs.push(ref); - } - var end = value.indexOf('>', offset); - if (end === -1) - throw new Error( - 'Expected end of URI delimiter at offset ' + offset - ); - ref = { uri: value.slice(offset + 1, end) }; - // this.refs.push( ref ) - offset = end; - state = STATE.URI; - } else { - throw new Error( - 'Unexpected character "' + - value[offset] + - '" at offset ' + - offset - ); - } - offset++; - } else if (state === STATE.URI) { - if (hasWhitespace(value[offset])) { - offset++; - continue; - } else if (value[offset] === ';') { - state = STATE.ATTR; - offset++; - } else if (value[offset] === ',') { - state = STATE.IDLE; - offset++; - } else { - throw new Error( - 'Unexpected character "' + - value[offset] + - '" at offset ' + - offset - ); - } - } else if (state === STATE.ATTR) { - if (value[offset] === ';' || hasWhitespace(value[offset])) { - offset++; - continue; - } - var end = value.indexOf('=', offset); - if (end === -1) - throw new Error( - 'Expected attribute delimiter at offset ' + offset - ); - var attr = trim(value.slice(offset, end)).toLowerCase(); - var attrValue = ''; - offset = end + 1; - offset = skipWhitespace(value, offset); - if (value[offset] === '"') { - offset++; - while (offset < length) { - if (value[offset] === '"') { - offset++; - break; - } - if (value[offset] === '\\') { - offset++; - } - attrValue += value[offset]; - offset++; - } - } else { - var end = offset + 1; - while (!DELIMITER_PATTERN.test(value[end]) && end < length) { - end++; - } - attrValue = value.slice(offset, end); - offset = end; - } - if (ref[attr] && Link.isSingleOccurenceAttr(attr)) { - // Ignore multiples of attributes which may only appear once - } else if (attr[attr.length - 1] === '*') { - ref[attr] = Link.parseExtendedValue(attrValue); - } else { - attrValue = - attr === 'type' ? attrValue.toLowerCase() : attrValue; - if (ref[attr] != null) { - if (Array.isArray(ref[attr])) { - ref[attr].push(attrValue); - } else { - ref[attr] = [ref[attr], attrValue]; - } - } else { - ref[attr] = attrValue; - } - } - switch (value[offset]) { - case ',': - state = STATE.IDLE; - break; - case ';': - state = STATE.ATTR; - break; - } - offset++; - } else { - throw new Error('Unknown parser state "' + state + '"'); - } - } - + continue; + } else if (value[offset] === '<') { if (ref != null) { ref.rel != null ? this.refs.push(...Link.expandRelations(ref)) : this.refs.push(ref); } - - ref = null; - - return this; - } - - toString() { - var refs = []; - var link = ''; - var ref = null; - - for (var i = 0; i < this.refs.length; i++) { - ref = this.refs[i]; - link = Object.keys(this.refs[i]).reduce(function (link, attr) { - if (attr === 'uri') return link; - return link + '; ' + Link.formatAttribute(attr, ref[attr]); - }, '<' + ref.uri + '>'); - refs.push(link); - } - - return refs.join(', '); - } - } - - /** - * Determines whether an encoding can be - * natively handled with a `Buffer` - * @param {String} value - * @returns {Boolean} - */ - Link.isCompatibleEncoding = function (value) { - return COMPATIBLE_ENCODING_PATTERN.test(value); - }; - - Link.parse = function (value, offset) { - return new Link().parse(value, offset); - }; - - Link.isSingleOccurenceAttr = function (attr) { - return ( - attr === 'rel' || - attr === 'type' || - attr === 'media' || - attr === 'title' || - attr === 'title*' - ); - }; - - Link.isTokenAttr = function (attr) { - return attr === 'rel' || attr === 'type' || attr === 'anchor'; - }; - - Link.escapeQuotes = function (value) { - return value.replace(/"/g, '\\"'); - }; - - Link.expandRelations = function (ref) { - var rels = ref.rel.split(' '); - return rels.map(function (rel) { - var value = Object.assign({}, ref); - value.rel = rel; - return value; - }); - }; - - /** - * Parses an extended value and attempts to decode it - * @internal - * @param {String} value - * @return {Object} - */ - Link.parseExtendedValue = function (value) { - var parts = /([^']+)?(?:'([^']+)')?(.+)/.exec(value); - return { - language: parts[2].toLowerCase(), - encoding: Link.isCompatibleEncoding(parts[1]) - ? null - : parts[1].toLowerCase(), - value: Link.isCompatibleEncoding(parts[1]) - ? decodeURIComponent(parts[3]) - : parts[3], - }; - }; - - /** - * Format a given extended attribute and it's value - * @param {String} attr - * @param {Object} data - * @return {String} - */ - Link.formatExtendedAttribute = function (attr, data) { - var encoding = (data.encoding || 'utf-8').toUpperCase(); - var language = data.language || 'en'; - - var encodedValue = ''; - - if ( - Buffer.isBuffer(data.value) && - Link.isCompatibleEncoding(encoding) - ) { - encodedValue = data.value.toString(encoding); - } else if (Buffer.isBuffer(data.value)) { - encodedValue = data.value - .toString('hex') - .replace(/[0-9a-f]{2}/gi, '%$1'); - } else { - encodedValue = encodeURIComponent(data.value); - } - - return attr + '=' + encoding + "'" + language + "'" + encodedValue; - }; - - /** - * Format a given attribute and it's value - * @param {String} attr - * @param {String|Object} value - * @return {String} - */ - Link.formatAttribute = function (attr, value) { - if (Array.isArray(value)) { - return value - .map((item) => { - return Link.formatAttribute(attr, item); - }) - .join('; '); - } - - if (attr[attr.length - 1] === '*' || typeof value !== 'string') { - return Link.formatExtendedAttribute(attr, value); - } - - if (Link.isTokenAttr(attr)) { - value = needsQuotes(value) - ? '"' + Link.escapeQuotes(value) + '"' - : Link.escapeQuotes(value); - } else if (needsQuotes(value)) { - value = encodeURIComponent(value); - // We don't need to escape <,> <;> within quotes - value = value - .replace(/%20/g, ' ') - .replace(/%2C/g, ',') - .replace(/%3B/g, ';'); - - value = '"' + value + '"'; - } - - return attr + '=' + value; - }; - - module.exports = Link; - - /***/ - }, - - /***/ 8229: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; - - var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const got_1 = __importDefault(__nccwpck_require__(3061)); - const core_1 = __importDefault(__nccwpck_require__(2186)); - const GITHUB_TOKEN = core_1.default.getInput('githubToken', { - required: true, - }); - exports.default = got_1.default.extend({ - headers: { - Authorization: `token ${GITHUB_TOKEN}`, - }, - responseType: 'json', - }); - - /***/ - }, - - /***/ 6350: /***/ function ( - __unused_webpack_module, - exports, - __nccwpck_require__ - ) { - 'use strict'; - - // original content by: github.com/TriPSs/conventional-changelog-action/blob/master/src/helpers/git.js - var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done - ? resolve(result.value) - : adopt(result.value).then(fulfilled, rejected); - } - step( - (generator = generator.apply(thisArg, _arguments || [])).next() + var end = value.indexOf('>', offset); + if (end === -1) + throw new Error( + 'Expected end of URI delimiter at offset ' + offset ); - }); - }; - var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; - Object.defineProperty(exports, '__esModule', { value: true }); - const core_1 = __importDefault(__nccwpck_require__(2186)); - const exec_1 = __importDefault(__nccwpck_require__(1514)); - const { GITHUB_REPOSITORY, GITHUB_REF } = process.env; - const IS_TEST = process.env.NODE_ENV === 'test'; - const branch = - GITHUB_REF === null || GITHUB_REF === void 0 - ? void 0 - : GITHUB_REF.replace('refs/heads/', ''); - exports.default = new (class Git { - constructor() { - this.commandsRun = []; - this.exec = (command) => { - return new Promise((resolve, reject) => - __awaiter(this, void 0, void 0, function* () { + ref = { uri: value.slice(offset + 1, end) }; + // this.refs.push( ref ) + offset = end; + state = STATE.URI; + } else { + throw new Error( + 'Unexpected character "' + value[offset] + '" at offset ' + offset + ); + } + offset++; + } else if (state === STATE.URI) { + if (hasWhitespace(value[offset])) { + offset++; + continue; + } else if (value[offset] === ';') { + state = STATE.ATTR; + offset++; + } else if (value[offset] === ',') { + state = STATE.IDLE; + offset++; + } else { + throw new Error( + 'Unexpected character "' + value[offset] + '" at offset ' + offset + ); + } + } else if (state === STATE.ATTR) { + if (value[offset] === ';' || hasWhitespace(value[offset])) { + offset++; + continue; + } + var end = value.indexOf('=', offset); + if (end === -1) + throw new Error('Expected attribute delimiter at offset ' + offset); + var attr = trim(value.slice(offset, end)).toLowerCase(); + var attrValue = ''; + offset = end + 1; + offset = skipWhitespace(value, offset); + if (value[offset] === '"') { + offset++; + while (offset < length) { + if (value[offset] === '"') { + offset++; + break; + } + if (value[offset] === '\\') { + offset++; + } + attrValue += value[offset]; + offset++; + } + } else { + var end = offset + 1; + while (!DELIMITER_PATTERN.test(value[end]) && end < length) { + end++; + } + attrValue = value.slice(offset, end); + offset = end; + } + if (ref[attr] && Link.isSingleOccurenceAttr(attr)) { + // Ignore multiples of attributes which may only appear once + } else if (attr[attr.length - 1] === '*') { + ref[attr] = Link.parseExtendedValue(attrValue); + } else { + attrValue = attr === 'type' ? attrValue.toLowerCase() : attrValue; + if (ref[attr] != null) { + if (Array.isArray(ref[attr])) { + ref[attr].push(attrValue); + } else { + ref[attr] = [ref[attr], attrValue]; + } + } else { + ref[attr] = attrValue; + } + } + switch (value[offset]) { + case ',': + state = STATE.IDLE; + break; + case ';': + state = STATE.ATTR; + break; + } + offset++; + } else { + throw new Error('Unknown parser state "' + state + '"'); + } + } + + if (ref != null) { + ref.rel != null + ? this.refs.push(...Link.expandRelations(ref)) + : this.refs.push(ref); + } + + ref = null; + + return this; + } + + toString() { + var refs = []; + var link = ''; + var ref = null; + + for (var i = 0; i < this.refs.length; i++) { + ref = this.refs[i]; + link = Object.keys(this.refs[i]).reduce(function (link, attr) { + if (attr === 'uri') return link; + return link + '; ' + Link.formatAttribute(attr, ref[attr]); + }, '<' + ref.uri + '>'); + refs.push(link); + } + + return refs.join(', '); + } +} + +/** + * Determines whether an encoding can be + * natively handled with a `Buffer` + * @param {String} value + * @returns {Boolean} + */ +Link.isCompatibleEncoding = function (value) { + return COMPATIBLE_ENCODING_PATTERN.test(value); +}; + +Link.parse = function (value, offset) { + return new Link().parse(value, offset); +}; + +Link.isSingleOccurenceAttr = function (attr) { + return ( + attr === 'rel' || + attr === 'type' || + attr === 'media' || + attr === 'title' || + attr === 'title*' + ); +}; + +Link.isTokenAttr = function (attr) { + return attr === 'rel' || attr === 'type' || attr === 'anchor'; +}; + +Link.escapeQuotes = function (value) { + return value.replace(/"/g, '\\"'); +}; + +Link.expandRelations = function (ref) { + var rels = ref.rel.split(' '); + return rels.map(function (rel) { + var value = Object.assign({}, ref); + value.rel = rel; + return value; + }); +}; + +/** + * Parses an extended value and attempts to decode it + * @internal + * @param {String} value + * @return {Object} + */ +Link.parseExtendedValue = function (value) { + var parts = /([^']+)?(?:'([^']+)')?(.+)/.exec(value); + return { + language: parts[2].toLowerCase(), + encoding: Link.isCompatibleEncoding(parts[1]) + ? null + : parts[1].toLowerCase(), + value: Link.isCompatibleEncoding(parts[1]) + ? decodeURIComponent(parts[3]) + : parts[3], + }; +}; + +/** + * Format a given extended attribute and it's value + * @param {String} attr + * @param {Object} data + * @return {String} + */ +Link.formatExtendedAttribute = function (attr, data) { + var encoding = (data.encoding || 'utf-8').toUpperCase(); + var language = data.language || 'en'; + + var encodedValue = ''; + + if (Buffer.isBuffer(data.value) && Link.isCompatibleEncoding(encoding)) { + encodedValue = data.value.toString(encoding); + } else if (Buffer.isBuffer(data.value)) { + encodedValue = data.value.toString('hex').replace(/[0-9a-f]{2}/gi, '%$1'); + } else { + encodedValue = encodeURIComponent(data.value); + } + + return attr + '=' + encoding + "'" + language + "'" + encodedValue; +}; + +/** + * Format a given attribute and it's value + * @param {String} attr + * @param {String|Object} value + * @return {String} + */ +Link.formatAttribute = function (attr, value) { + if (Array.isArray(value)) { + return value + .map((item) => { + return Link.formatAttribute(attr, item); + }) + .join('; '); + } + + if (attr[attr.length - 1] === '*' || typeof value !== 'string') { + return Link.formatExtendedAttribute(attr, value); + } + + if (Link.isTokenAttr(attr)) { + value = needsQuotes(value) + ? '"' + Link.escapeQuotes(value) + '"' + : Link.escapeQuotes(value); + } else if (needsQuotes(value)) { + value = encodeURIComponent(value); + // We don't need to escape <,> <;> within quotes + value = value + .replace(/%20/g, ' ') + .replace(/%2C/g, ',') + .replace(/%3B/g, ';'); + + value = '"' + value + '"'; + } + + return attr + '=' + value; +}; + +module.exports = Link; + + +/***/ }), + +/***/ 8229: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const got_1 = __importDefault(__nccwpck_require__(3061)); +const core_1 = __importDefault(__nccwpck_require__(2186)); +const GITHUB_TOKEN = core_1.default.getInput('github-token', { required: true }); +exports.default = got_1.default.extend({ + headers: { + Authorization: `token ${GITHUB_TOKEN}`, + }, + responseType: 'json', +}); + + +/***/ }), + +/***/ 6350: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +// original content by: github.com/TriPSs/conventional-changelog-action/blob/master/src/helpers/git.js +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const core_1 = __importDefault(__nccwpck_require__(2186)); +const exec_1 = __importDefault(__nccwpck_require__(1514)); +const { GITHUB_REPOSITORY, GITHUB_REF } = process.env; +const IS_TEST = process.env.NODE_ENV === 'test'; +const branch = GITHUB_REF === null || GITHUB_REF === void 0 ? void 0 : GITHUB_REF.replace('refs/heads/', ''); +exports.default = new (class Git { + constructor() { + this.commandsRun = []; + this.exec = (command) => { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { if (IS_TEST) { - const fullCommand = `git ${command}`; - console.log(`Skipping "${fullCommand}" because of test env`); - if (!fullCommand.includes('git remote set-url origin')) { - this.commandsRun.push(fullCommand); - } - return resolve('done'); + const fullCommand = `git ${command}`; + console.log(`Skipping "${fullCommand}" because of test env`); + if (!fullCommand.includes('git remote set-url origin')) { + this.commandsRun.push(fullCommand); + } + return resolve('done'); } let execOutput = ''; const options = { - listeners: { - stdout: (data) => { - execOutput += data.toString(); + listeners: { + stdout: (data) => { + execOutput += data.toString(); + }, }, - }, }; - const exitCode = yield exec_1.default.exec( - `git ${command}`, - undefined, - options - ); + const exitCode = yield exec_1.default.exec(`git ${command}`, undefined, options); if (exitCode === 0) { - return resolve(execOutput); - } else { - return reject( - `Command "git ${command}" exited with code ${exitCode}.` - ); + return resolve(execOutput); } - }) - ); - }; - this.config = (prop, value) => this.exec(`config ${prop} "${value}"`); - this.add = (file) => this.exec(`add ${file}`); - this.commit = (message) => this.exec(`commit -m "${message}"`); - this.pull = () => - __awaiter(this, void 0, void 0, function* () { - const args = ['pull']; - // Check if the repo is unshallow - if (yield this.isShallow()) { + else { + return reject(`Command "git ${command}" exited with code ${exitCode}.`); + } + })); + }; + this.config = (prop, value) => this.exec(`config ${prop} "${value}"`); + this.add = (file) => this.exec(`add ${file}`); + this.commit = (message) => this.exec(`commit -m "${message}"`); + this.pull = () => __awaiter(this, void 0, void 0, function* () { + const args = ['pull']; + // Check if the repo is unshallow + if (yield this.isShallow()) { args.push('--unshallow'); - } - args.push('--tags'); - args.push(core_1.default.getInput('git-pull-method')); - return this.exec(args.join(' ')); - }); - this.push = () => this.exec(`push origin ${branch} --follow-tags`); - this.isShallow = () => - __awaiter(this, void 0, void 0, function* () { - if (IS_TEST) return false; - const isShallow = yield this.exec( - 'rev-parse --is-shallow-repository' - ); - return isShallow.trim().replace('\n', '') === 'true'; - }); - this.updateOrigin = (repo) => - this.exec(`remote set-url origin ${repo}`); - this.createTag = (tag) => this.exec(`tag -a ${tag} -m "${tag}"`); - const githubToken = core_1.default.getInput('github-token', { - required: true, - }); - core_1.default.setSecret(githubToken); - const gitUserName = core_1.default.getInput('git-user-name'); - const gitUserEmail = core_1.default.getInput('git-user-email'); - // Set config - this.config('user.name', gitUserName); - this.config('user.email', gitUserEmail); - // Update the origin - this.updateOrigin( - `https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git` - ); - } - })(); - - /***/ - }, - - /***/ 6144: /***/ function ( - __unused_webpack_module, - 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() - ); - }); - }; - var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; - var _a; - Object.defineProperty(exports, '__esModule', { value: true }); - exports.run = exports.main = exports.generateMd = void 0; - const dotenv_1 = __importDefault(__nccwpck_require__(2437)); - const promises_1 = __importDefault(__nccwpck_require__(9225)); - const ejs_1 = __importDefault(__nccwpck_require__(8431)); - const remark_1 = __importDefault(__nccwpck_require__(2081)); - const remark_toc_1 = __importDefault(__nccwpck_require__(5096)); - const api_1 = __importDefault(__nccwpck_require__(8229)); - const link_1 = __importDefault(__nccwpck_require__(9338)); - const git_1 = __importDefault(__nccwpck_require__(6350)); - const core_1 = __importDefault(__nccwpck_require__(2186)); - const REPO_USERNAME = - (_a = process.env.GITHUB_REPOSITORY) === null || _a === void 0 - ? void 0 - : _a.split('/')[0]; - const OUTPUT_FILENAME = - core_1.default.getInput('output-filename') || 'README.md'; - const IS_PROD = process.env.NODE_ENV === 'production'; - const USERNAME = process.env.GITHUB_ACTOR || 'simonecorsi'; - const API_STARRED_URL = `'https://api.github.com/users/${REPO_USERNAME}/starred'`; - const renderer = (data) => - __awaiter(void 0, void 0, void 0, function* () { - try { - const MD_TEMPLATE = yield promises_1.default.readFile( - 'fixtures/template.md.ejs', - 'utf-8' - ); - return ejs_1.default.render(MD_TEMPLATE, data); - } catch (error) { - core_1.default.error(error); - return ''; - } + args.push('--tags'); + args.push(core_1.default.getInput('git-pull-method')); + return this.exec(args.join(' ')); }); - if (!IS_PROD) { - dotenv_1.default.config(); - } - const wait = (time = 200) => - new Promise((resolve) => setTimeout(resolve, time)); - function apiGetStar(url) { - return __awaiter(this, void 0, void 0, function* () { - const { headers, body } = yield (() => - __awaiter(this, void 0, void 0, function* () { - if (!IS_PROD) - return JSON.parse( - yield promises_1.default.readFile( - 'fixtures/stars-response.json', - 'utf-8' - ) - ); - return api_1.default.get(url); - }))(); - return { + this.push = () => this.exec(`push origin ${branch} --follow-tags`); + this.isShallow = () => __awaiter(this, void 0, void 0, function* () { + if (IS_TEST) + return false; + const isShallow = yield this.exec('rev-parse --is-shallow-repository'); + return isShallow.trim().replace('\n', '') === 'true'; + }); + this.updateOrigin = (repo) => this.exec(`remote set-url origin ${repo}`); + this.createTag = (tag) => this.exec(`tag -a ${tag} -m "${tag}"`); + const githubToken = core_1.default.getInput('github-token', { required: true }); + core_1.default.setSecret(githubToken); + const gitUserName = core_1.default.getInput('git-user-name'); + const gitUserEmail = core_1.default.getInput('git-user-email'); + // Set config + this.config('user.name', gitUserName); + this.config('user.email', gitUserEmail); + // Update the origin + this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`); + } +})(); + + +/***/ }), + +/***/ 6144: +/***/ (function(__unused_webpack_module, 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()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.run = exports.main = exports.generateMd = void 0; +const dotenv_1 = __importDefault(__nccwpck_require__(2437)); +const promises_1 = __importDefault(__nccwpck_require__(9225)); +const ejs_1 = __importDefault(__nccwpck_require__(8431)); +const remark_1 = __importDefault(__nccwpck_require__(2081)); +const remark_toc_1 = __importDefault(__nccwpck_require__(5096)); +const api_1 = __importDefault(__nccwpck_require__(8229)); +const link_1 = __importDefault(__nccwpck_require__(9338)); +const git_1 = __importDefault(__nccwpck_require__(6350)); +const core_1 = __importDefault(__nccwpck_require__(2186)); +const REPO_USERNAME = (_a = process.env.GITHUB_REPOSITORY) === null || _a === void 0 ? void 0 : _a.split('/')[0]; +const OUTPUT_FILENAME = core_1.default.getInput('output-filename') || 'README.md'; +const IS_PROD = process.env.NODE_ENV === 'production'; +const USERNAME = process.env.GITHUB_ACTOR || 'simonecorsi'; +const API_STARRED_URL = `'https://api.github.com/users/${REPO_USERNAME}/starred'`; +const renderer = (data) => __awaiter(void 0, void 0, void 0, function* () { + try { + const MD_TEMPLATE = yield promises_1.default.readFile('fixtures/template.md.ejs', 'utf-8'); + return ejs_1.default.render(MD_TEMPLATE, data); + } + catch (error) { + core_1.default.error(error); + return ''; + } +}); +if (!IS_PROD) { + dotenv_1.default.config(); +} +const wait = (time = 200) => new Promise((resolve) => setTimeout(resolve, time)); +function apiGetStar(url) { + return __awaiter(this, void 0, void 0, function* () { + const { headers, body } = yield (() => __awaiter(this, void 0, void 0, function* () { + if (!IS_PROD) + return JSON.parse(yield promises_1.default.readFile('fixtures/stars-response.json', 'utf-8')); + return api_1.default.get(url); + }))(); + return { data: body, - links: link_1.default - .parse(headers.link) - .refs.reduce( - (acc, val) => - Object.assign(Object.assign({}, acc), { [val.rel]: val.uri }), - {} - ), - }; - }); - } - function isLastPage(links) { - return links.next === links.last; - } - function generateMd(data) { - return new Promise((resolve) => { - remark_1 - .default() + links: link_1.default.parse(headers.link).refs.reduce((acc, val) => (Object.assign(Object.assign({}, acc), { [val.rel]: val.uri })), {}), + }; + }); +} +function isLastPage(links) { + return links.next === links.last; +} +function generateMd(data) { + return new Promise((resolve) => { + remark_1.default() .use(remark_toc_1.default) .process(data, function (error, file) { - if (error) { + if (error) { core_1.default.error(error); return resolve(''); - } - return resolve(String(file)); - }); + } + return resolve(String(file)); }); - } - exports.generateMd = generateMd; - function main() { - return __awaiter(this, void 0, void 0, function* () { - let links = { + }); +} +exports.generateMd = generateMd; +function main() { + return __awaiter(this, void 0, void 0, function* () { + let links = { next: API_STARRED_URL, last: undefined, - }; - let results = []; - do { + }; + let results = []; + do { const r = yield apiGetStar(links.next); links = r.links; results = results.concat(r.data); - if (!IS_PROD) break; + if (!IS_PROD) + break; yield wait(); - } while (!isLastPage(links)); - const sortedByLanguages = results.reduce((acc, val) => { + } while (!isLastPage(links)); + const sortedByLanguages = results.reduce((acc, val) => { const language = val.language || 'generic'; if (!acc[language]) { - acc[language] = [val]; - } else { - acc[language].push(val); + acc[language] = [val]; + } + else { + acc[language].push(val); } return acc; - }, {}); - const rendered = yield renderer({ + }, {}); + const rendered = yield renderer({ username: USERNAME, stars: Object.entries(sortedByLanguages), updatedAt: Date.now(), - }); - const markdown = yield generateMd(rendered); - yield promises_1.default.writeFile(OUTPUT_FILENAME, markdown); - yield git_1.default.add(OUTPUT_FILENAME); - yield git_1.default.commit(`chore(${OUTPUT_FILENAME}): updated list`); - yield git_1.default.push(); }); - } - exports.main = main; - function run() { - return __awaiter(this, void 0, void 0, function* () { - try { + const markdown = yield generateMd(rendered); + yield promises_1.default.writeFile(OUTPUT_FILENAME, markdown); + yield git_1.default.add(OUTPUT_FILENAME); + yield git_1.default.commit(`chore(${OUTPUT_FILENAME}): updated list`); + yield git_1.default.push(); + }); +} +exports.main = main; +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { yield main(); process.exit(0); - } catch (error) { + } + catch (error) { process.stderr.write(error); process.exit(1); - } - }); - } - exports.run = run; - const catchAll = (info) => { - core_1.default.error(info); - process.exit(1); - }; - process.on('unhandledRejection', catchAll); - process.on('uncaughtException', catchAll); - run(); + } + }); +} +exports.run = run; +const catchAll = (info) => { + core_1.default.error(info); + process.exit(1); +}; +process.on('unhandledRejection', catchAll); +process.on('uncaughtException', catchAll); +run(); - /***/ - }, - /***/ 3407: /***/ (module) => { - 'use strict'; - module.exports = JSON.parse( - '{"AEli":"Æ","AElig":"Æ","AM":"&","AMP":"&","Aacut":"Á","Aacute":"Á","Abreve":"Ă","Acir":"Â","Acirc":"Â","Acy":"А","Afr":"𝔄","Agrav":"À","Agrave":"À","Alpha":"Α","Amacr":"Ā","And":"⩓","Aogon":"Ą","Aopf":"𝔸","ApplyFunction":"⁡","Arin":"Å","Aring":"Å","Ascr":"𝒜","Assign":"≔","Atild":"Ã","Atilde":"Ã","Aum":"Ä","Auml":"Ä","Backslash":"∖","Barv":"⫧","Barwed":"⌆","Bcy":"Б","Because":"∵","Bernoullis":"ℬ","Beta":"Β","Bfr":"𝔅","Bopf":"𝔹","Breve":"˘","Bscr":"ℬ","Bumpeq":"≎","CHcy":"Ч","COP":"©","COPY":"©","Cacute":"Ć","Cap":"⋒","CapitalDifferentialD":"ⅅ","Cayleys":"ℭ","Ccaron":"Č","Ccedi":"Ç","Ccedil":"Ç","Ccirc":"Ĉ","Cconint":"∰","Cdot":"Ċ","Cedilla":"¸","CenterDot":"·","Cfr":"ℭ","Chi":"Χ","CircleDot":"⊙","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","Colon":"∷","Colone":"⩴","Congruent":"≡","Conint":"∯","ContourIntegral":"∮","Copf":"ℂ","Coproduct":"∐","CounterClockwiseContourIntegral":"∳","Cross":"⨯","Cscr":"𝒞","Cup":"⋓","CupCap":"≍","DD":"ⅅ","DDotrahd":"⤑","DJcy":"Ђ","DScy":"Ѕ","DZcy":"Џ","Dagger":"‡","Darr":"↡","Dashv":"⫤","Dcaron":"Ď","Dcy":"Д","Del":"∇","Delta":"Δ","Dfr":"𝔇","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","Diamond":"⋄","DifferentialD":"ⅆ","Dopf":"𝔻","Dot":"¨","DotDot":"⃜","DotEqual":"≐","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrow":"↓","DownArrowBar":"⤓","DownArrowUpArrow":"⇵","DownBreve":"̑","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVector":"↽","DownLeftVectorBar":"⥖","DownRightTeeVector":"⥟","DownRightVector":"⇁","DownRightVectorBar":"⥗","DownTee":"⊤","DownTeeArrow":"↧","Downarrow":"⇓","Dscr":"𝒟","Dstrok":"Đ","ENG":"Ŋ","ET":"Ð","ETH":"Ð","Eacut":"É","Eacute":"É","Ecaron":"Ě","Ecir":"Ê","Ecirc":"Ê","Ecy":"Э","Edot":"Ė","Efr":"𝔈","Egrav":"È","Egrave":"È","Element":"∈","Emacr":"Ē","EmptySmallSquare":"◻","EmptyVerySmallSquare":"▫","Eogon":"Ę","Eopf":"𝔼","Epsilon":"Ε","Equal":"⩵","EqualTilde":"≂","Equilibrium":"⇌","Escr":"ℰ","Esim":"⩳","Eta":"Η","Eum":"Ë","Euml":"Ë","Exists":"∃","ExponentialE":"ⅇ","Fcy":"Ф","Ffr":"𝔉","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","Fopf":"𝔽","ForAll":"∀","Fouriertrf":"ℱ","Fscr":"ℱ","GJcy":"Ѓ","G":">","GT":">","Gamma":"Γ","Gammad":"Ϝ","Gbreve":"Ğ","Gcedil":"Ģ","Gcirc":"Ĝ","Gcy":"Г","Gdot":"Ġ","Gfr":"𝔊","Gg":"⋙","Gopf":"𝔾","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","Gt":"≫","HARDcy":"Ъ","Hacek":"ˇ","Hat":"^","Hcirc":"Ĥ","Hfr":"ℌ","HilbertSpace":"ℋ","Hopf":"ℍ","HorizontalLine":"─","Hscr":"ℋ","Hstrok":"Ħ","HumpDownHump":"≎","HumpEqual":"≏","IEcy":"Е","IJlig":"IJ","IOcy":"Ё","Iacut":"Í","Iacute":"Í","Icir":"Î","Icirc":"Î","Icy":"И","Idot":"İ","Ifr":"ℑ","Igrav":"Ì","Igrave":"Ì","Im":"ℑ","Imacr":"Ī","ImaginaryI":"ⅈ","Implies":"⇒","Int":"∬","Integral":"∫","Intersection":"⋂","InvisibleComma":"⁣","InvisibleTimes":"⁢","Iogon":"Į","Iopf":"𝕀","Iota":"Ι","Iscr":"ℐ","Itilde":"Ĩ","Iukcy":"І","Ium":"Ï","Iuml":"Ï","Jcirc":"Ĵ","Jcy":"Й","Jfr":"𝔍","Jopf":"𝕁","Jscr":"𝒥","Jsercy":"Ј","Jukcy":"Є","KHcy":"Х","KJcy":"Ќ","Kappa":"Κ","Kcedil":"Ķ","Kcy":"К","Kfr":"𝔎","Kopf":"𝕂","Kscr":"𝒦","LJcy":"Љ","L":"<","LT":"<","Lacute":"Ĺ","Lambda":"Λ","Lang":"⟪","Laplacetrf":"ℒ","Larr":"↞","Lcaron":"Ľ","Lcedil":"Ļ","Lcy":"Л","LeftAngleBracket":"⟨","LeftArrow":"←","LeftArrowBar":"⇤","LeftArrowRightArrow":"⇆","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVector":"⇃","LeftDownVectorBar":"⥙","LeftFloor":"⌊","LeftRightArrow":"↔","LeftRightVector":"⥎","LeftTee":"⊣","LeftTeeArrow":"↤","LeftTeeVector":"⥚","LeftTriangle":"⊲","LeftTriangleBar":"⧏","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVector":"↿","LeftUpVectorBar":"⥘","LeftVector":"↼","LeftVectorBar":"⥒","Leftarrow":"⇐","Leftrightarrow":"⇔","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","LessLess":"⪡","LessSlantEqual":"⩽","LessTilde":"≲","Lfr":"𝔏","Ll":"⋘","Lleftarrow":"⇚","Lmidot":"Ŀ","LongLeftArrow":"⟵","LongLeftRightArrow":"⟷","LongRightArrow":"⟶","Longleftarrow":"⟸","Longleftrightarrow":"⟺","Longrightarrow":"⟹","Lopf":"𝕃","LowerLeftArrow":"↙","LowerRightArrow":"↘","Lscr":"ℒ","Lsh":"↰","Lstrok":"Ł","Lt":"≪","Map":"⤅","Mcy":"М","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","MinusPlus":"∓","Mopf":"𝕄","Mscr":"ℳ","Mu":"Μ","NJcy":"Њ","Nacute":"Ń","Ncaron":"Ň","Ncedil":"Ņ","Ncy":"Н","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","Nfr":"𝔑","NoBreak":"⁠","NonBreakingSpace":" ","Nopf":"ℕ","Not":"⫬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","NotLeftTriangle":"⋪","NotLeftTriangleBar":"⧏̸","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangle":"⋫","NotRightTriangleBar":"⧐̸","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","Nscr":"𝒩","Ntild":"Ñ","Ntilde":"Ñ","Nu":"Ν","OElig":"Œ","Oacut":"Ó","Oacute":"Ó","Ocir":"Ô","Ocirc":"Ô","Ocy":"О","Odblac":"Ő","Ofr":"𝔒","Ograv":"Ò","Ograve":"Ò","Omacr":"Ō","Omega":"Ω","Omicron":"Ο","Oopf":"𝕆","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","Or":"⩔","Oscr":"𝒪","Oslas":"Ø","Oslash":"Ø","Otild":"Õ","Otilde":"Õ","Otimes":"⨷","Oum":"Ö","Ouml":"Ö","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","PartialD":"∂","Pcy":"П","Pfr":"𝔓","Phi":"Φ","Pi":"Π","PlusMinus":"±","Poincareplane":"ℌ","Popf":"ℙ","Pr":"⪻","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","Prime":"″","Product":"∏","Proportion":"∷","Proportional":"∝","Pscr":"𝒫","Psi":"Ψ","QUO":"\\"","QUOT":"\\"","Qfr":"𝔔","Qopf":"ℚ","Qscr":"𝒬","RBarr":"⤐","RE":"®","REG":"®","Racute":"Ŕ","Rang":"⟫","Rarr":"↠","Rarrtl":"⤖","Rcaron":"Ř","Rcedil":"Ŗ","Rcy":"Р","Re":"ℜ","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","Rfr":"ℜ","Rho":"Ρ","RightAngleBracket":"⟩","RightArrow":"→","RightArrowBar":"⇥","RightArrowLeftArrow":"⇄","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVector":"⇂","RightDownVectorBar":"⥕","RightFloor":"⌋","RightTee":"⊢","RightTeeArrow":"↦","RightTeeVector":"⥛","RightTriangle":"⊳","RightTriangleBar":"⧐","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVector":"↾","RightUpVectorBar":"⥔","RightVector":"⇀","RightVectorBar":"⥓","Rightarrow":"⇒","Ropf":"ℝ","RoundImplies":"⥰","Rrightarrow":"⇛","Rscr":"ℛ","Rsh":"↱","RuleDelayed":"⧴","SHCHcy":"Щ","SHcy":"Ш","SOFTcy":"Ь","Sacute":"Ś","Sc":"⪼","Scaron":"Š","Scedil":"Ş","Scirc":"Ŝ","Scy":"С","Sfr":"𝔖","ShortDownArrow":"↓","ShortLeftArrow":"←","ShortRightArrow":"→","ShortUpArrow":"↑","Sigma":"Σ","SmallCircle":"∘","Sopf":"𝕊","Sqrt":"√","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","Sscr":"𝒮","Star":"⋆","Sub":"⋐","Subset":"⋐","SubsetEqual":"⊆","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","SuchThat":"∋","Sum":"∑","Sup":"⋑","Superset":"⊃","SupersetEqual":"⊇","Supset":"⋑","THOR":"Þ","THORN":"Þ","TRADE":"™","TSHcy":"Ћ","TScy":"Ц","Tab":"\\t","Tau":"Τ","Tcaron":"Ť","Tcedil":"Ţ","Tcy":"Т","Tfr":"𝔗","Therefore":"∴","Theta":"Θ","ThickSpace":"  ","ThinSpace":" ","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","Topf":"𝕋","TripleDot":"⃛","Tscr":"𝒯","Tstrok":"Ŧ","Uacut":"Ú","Uacute":"Ú","Uarr":"↟","Uarrocir":"⥉","Ubrcy":"Ў","Ubreve":"Ŭ","Ucir":"Û","Ucirc":"Û","Ucy":"У","Udblac":"Ű","Ufr":"𝔘","Ugrav":"Ù","Ugrave":"Ù","Umacr":"Ū","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","Uopf":"𝕌","UpArrow":"↑","UpArrowBar":"⤒","UpArrowDownArrow":"⇅","UpDownArrow":"↕","UpEquilibrium":"⥮","UpTee":"⊥","UpTeeArrow":"↥","Uparrow":"⇑","Updownarrow":"⇕","UpperLeftArrow":"↖","UpperRightArrow":"↗","Upsi":"ϒ","Upsilon":"Υ","Uring":"Ů","Uscr":"𝒰","Utilde":"Ũ","Uum":"Ü","Uuml":"Ü","VDash":"⊫","Vbar":"⫫","Vcy":"В","Vdash":"⊩","Vdashl":"⫦","Vee":"⋁","Verbar":"‖","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","Vopf":"𝕍","Vscr":"𝒱","Vvdash":"⊪","Wcirc":"Ŵ","Wedge":"⋀","Wfr":"𝔚","Wopf":"𝕎","Wscr":"𝒲","Xfr":"𝔛","Xi":"Ξ","Xopf":"𝕏","Xscr":"𝒳","YAcy":"Я","YIcy":"Ї","YUcy":"Ю","Yacut":"Ý","Yacute":"Ý","Ycirc":"Ŷ","Ycy":"Ы","Yfr":"𝔜","Yopf":"𝕐","Yscr":"𝒴","Yuml":"Ÿ","ZHcy":"Ж","Zacute":"Ź","Zcaron":"Ž","Zcy":"З","Zdot":"Ż","ZeroWidthSpace":"​","Zeta":"Ζ","Zfr":"ℨ","Zopf":"ℤ","Zscr":"𝒵","aacut":"á","aacute":"á","abreve":"ă","ac":"∾","acE":"∾̳","acd":"∿","acir":"â","acirc":"â","acut":"´","acute":"´","acy":"а","aeli":"æ","aelig":"æ","af":"⁡","afr":"𝔞","agrav":"à","agrave":"à","alefsym":"ℵ","aleph":"ℵ","alpha":"α","amacr":"ā","amalg":"⨿","am":"&","amp":"&","and":"∧","andand":"⩕","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsd":"∡","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","aogon":"ą","aopf":"𝕒","ap":"≈","apE":"⩰","apacir":"⩯","ape":"≊","apid":"≋","apos":"\'","approx":"≈","approxeq":"≊","arin":"å","aring":"å","ascr":"𝒶","ast":"*","asymp":"≈","asympeq":"≍","atild":"ã","atilde":"ã","aum":"ä","auml":"ä","awconint":"∳","awint":"⨑","bNot":"⫭","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","barvee":"⊽","barwed":"⌅","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","beta":"β","beth":"ℶ","between":"≬","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bnot":"⌐","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxDL":"╗","boxDR":"╔","boxDl":"╖","boxDr":"╓","boxH":"═","boxHD":"╦","boxHU":"╩","boxHd":"╤","boxHu":"╧","boxUL":"╝","boxUR":"╚","boxUl":"╜","boxUr":"╙","boxV":"║","boxVH":"╬","boxVL":"╣","boxVR":"╠","boxVh":"╫","boxVl":"╢","boxVr":"╟","boxbox":"⧉","boxdL":"╕","boxdR":"╒","boxdl":"┐","boxdr":"┌","boxh":"─","boxhD":"╥","boxhU":"╨","boxhd":"┬","boxhu":"┴","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxuL":"╛","boxuR":"╘","boxul":"┘","boxur":"└","boxv":"│","boxvH":"╪","boxvL":"╡","boxvR":"╞","boxvh":"┼","boxvl":"┤","boxvr":"├","bprime":"‵","breve":"˘","brvba":"¦","brvbar":"¦","bscr":"𝒷","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsol":"\\\\","bsolb":"⧅","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","bumpeq":"≏","cacute":"ć","cap":"∩","capand":"⩄","capbrcup":"⩉","capcap":"⩋","capcup":"⩇","capdot":"⩀","caps":"∩︀","caret":"⁁","caron":"ˇ","ccaps":"⩍","ccaron":"č","ccedi":"ç","ccedil":"ç","ccirc":"ĉ","ccups":"⩌","ccupssm":"⩐","cdot":"ċ","cedi":"¸","cedil":"¸","cemptyv":"⦲","cen":"¢","cent":"¢","centerdot":"·","cfr":"𝔠","chcy":"ч","check":"✓","checkmark":"✓","chi":"χ","cir":"○","cirE":"⧃","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledR":"®","circledS":"Ⓢ","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","clubs":"♣","clubsuit":"♣","colon":":","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","conint":"∮","copf":"𝕔","coprod":"∐","cop":"©","copy":"©","copysr":"℗","crarr":"↵","cross":"✗","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cup":"∪","cupbrcap":"⩈","cupcap":"⩆","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curre":"¤","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dArr":"⇓","dHar":"⥥","dagger":"†","daleth":"ℸ","darr":"↓","dash":"‐","dashv":"⊣","dbkarow":"⤏","dblac":"˝","dcaron":"ď","dcy":"д","dd":"ⅆ","ddagger":"‡","ddarr":"⇊","ddotseq":"⩷","de":"°","deg":"°","delta":"δ","demptyv":"⦱","dfisht":"⥿","dfr":"𝔡","dharl":"⇃","dharr":"⇂","diam":"⋄","diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","digamma":"ϝ","disin":"⋲","div":"÷","divid":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","dopf":"𝕕","dot":"˙","doteq":"≐","doteqdot":"≑","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","downarrow":"↓","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","dscr":"𝒹","dscy":"ѕ","dsol":"⧶","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","dzcy":"џ","dzigrarr":"⟿","eDDot":"⩷","eDot":"≑","eacut":"é","eacute":"é","easter":"⩮","ecaron":"ě","ecir":"ê","ecirc":"ê","ecolon":"≕","ecy":"э","edot":"ė","ee":"ⅇ","efDot":"≒","efr":"𝔢","eg":"⪚","egrav":"è","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","emacr":"ē","empty":"∅","emptyset":"∅","emptyv":"∅","emsp13":" ","emsp14":" ","emsp":" ","eng":"ŋ","ensp":" ","eogon":"ę","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","equals":"=","equest":"≟","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erDot":"≓","erarr":"⥱","escr":"ℯ","esdot":"≐","esim":"≂","eta":"η","et":"ð","eth":"ð","eum":"ë","euml":"ë","euro":"€","excl":"!","exist":"∃","expectation":"ℰ","exponentiale":"ⅇ","fallingdotseq":"≒","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","ffr":"𝔣","filig":"fi","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","fopf":"𝕗","forall":"∀","fork":"⋔","forkv":"⫙","fpartint":"⨍","frac1":"¼","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac3":"¾","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","gE":"≧","gEl":"⪌","gacute":"ǵ","gamma":"γ","gammad":"ϝ","gap":"⪆","gbreve":"ğ","gcirc":"ĝ","gcy":"г","gdot":"ġ","ge":"≥","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","ges":"⩾","gescc":"⪩","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","gfr":"𝔤","gg":"≫","ggg":"⋙","gimel":"ℷ","gjcy":"ѓ","gl":"≷","glE":"⪒","gla":"⪥","glj":"⪤","gnE":"≩","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gneq":"⪈","gneqq":"≩","gnsim":"⋧","gopf":"𝕘","grave":"`","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","g":">","gt":">","gtcc":"⪧","gtcir":"⩺","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","hArr":"⇔","hairsp":" ","half":"½","hamilt":"ℋ","hardcy":"ъ","harr":"↔","harrcir":"⥈","harrw":"↭","hbar":"ℏ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","horbar":"―","hscr":"𝒽","hslash":"ℏ","hstrok":"ħ","hybull":"⁃","hyphen":"‐","iacut":"í","iacute":"í","ic":"⁣","icir":"î","icirc":"î","icy":"и","iecy":"е","iexc":"¡","iexcl":"¡","iff":"⇔","ifr":"𝔦","igrav":"ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","ijlig":"ij","imacr":"ī","image":"ℑ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","imof":"⊷","imped":"Ƶ","in":"∈","incare":"℅","infin":"∞","infintie":"⧝","inodot":"ı","int":"∫","intcal":"⊺","integers":"ℤ","intercal":"⊺","intlarhk":"⨗","intprod":"⨼","iocy":"ё","iogon":"į","iopf":"𝕚","iota":"ι","iprod":"⨼","iques":"¿","iquest":"¿","iscr":"𝒾","isin":"∈","isinE":"⋹","isindot":"⋵","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","itilde":"ĩ","iukcy":"і","ium":"ï","iuml":"ï","jcirc":"ĵ","jcy":"й","jfr":"𝔧","jmath":"ȷ","jopf":"𝕛","jscr":"𝒿","jsercy":"ј","jukcy":"є","kappa":"κ","kappav":"ϰ","kcedil":"ķ","kcy":"к","kfr":"𝔨","kgreen":"ĸ","khcy":"х","kjcy":"ќ","kopf":"𝕜","kscr":"𝓀","lAarr":"⇚","lArr":"⇐","lAtail":"⤛","lBarr":"⤎","lE":"≦","lEg":"⪋","lHar":"⥢","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","lambda":"λ","lang":"⟨","langd":"⦑","langle":"⟨","lap":"⪅","laqu":"«","laquo":"«","larr":"←","larrb":"⇤","larrbfs":"⤟","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","lat":"⪫","latail":"⤙","late":"⪭","lates":"⪭︀","lbarr":"⤌","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","lcaron":"ľ","lcedil":"ļ","lceil":"⌈","lcub":"{","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","leftarrow":"←","leftarrowtail":"↢","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","leftthreetimes":"⋋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","les":"⩽","lescc":"⪨","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","lessgtr":"≶","lesssim":"≲","lfisht":"⥼","lfloor":"⌊","lfr":"𝔩","lg":"≶","lgE":"⪑","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","ljcy":"љ","ll":"≪","llarr":"⇇","llcorner":"⌞","llhard":"⥫","lltri":"◺","lmidot":"ŀ","lmoust":"⎰","lmoustache":"⎰","lnE":"≨","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","longleftrightarrow":"⟷","longmapsto":"⟼","longrightarrow":"⟶","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","lstrok":"ł","l":"<","lt":"<","ltcc":"⪦","ltcir":"⩹","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltrPar":"⦖","ltri":"◃","ltrie":"⊴","ltrif":"◂","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","mDDot":"∺","mac":"¯","macr":"¯","male":"♂","malt":"✠","maltese":"✠","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","mcy":"м","mdash":"—","measuredangle":"∡","mfr":"𝔪","mho":"℧","micr":"µ","micro":"µ","mid":"∣","midast":"*","midcir":"⫰","middo":"·","middot":"·","minus":"−","minusb":"⊟","minusd":"∸","minusdu":"⨪","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","mopf":"𝕞","mp":"∓","mscr":"𝓂","mstpos":"∾","mu":"μ","multimap":"⊸","mumap":"⊸","nGg":"⋙̸","nGt":"≫⃒","nGtv":"≫̸","nLeftarrow":"⇍","nLeftrightarrow":"⇎","nLl":"⋘̸","nLt":"≪⃒","nLtv":"≪̸","nRightarrow":"⇏","nVDash":"⊯","nVdash":"⊮","nabla":"∇","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natur":"♮","natural":"♮","naturals":"ℕ","nbs":" ","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","ncaron":"ň","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","ncy":"н","ndash":"–","ne":"≠","neArr":"⇗","nearhk":"⤤","nearr":"↗","nearrow":"↗","nedot":"≐̸","nequiv":"≢","nesear":"⤨","nesim":"≂̸","nexist":"∄","nexists":"∄","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","ngsim":"≵","ngt":"≯","ngtr":"≯","nhArr":"⇎","nharr":"↮","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","njcy":"њ","nlArr":"⇍","nlE":"≦̸","nlarr":"↚","nldr":"‥","nle":"≰","nleftarrow":"↚","nleftrightarrow":"↮","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nlsim":"≴","nlt":"≮","nltri":"⋪","nltrie":"⋬","nmid":"∤","nopf":"𝕟","no":"¬","not":"¬","notin":"∉","notinE":"⋹̸","notindot":"⋵̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","npar":"∦","nparallel":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","npre":"⪯̸","nprec":"⊀","npreceq":"⪯̸","nrArr":"⇏","nrarr":"↛","nrarrc":"⤳̸","nrarrw":"↝̸","nrightarrow":"↛","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","ntild":"ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","nu":"ν","num":"#","numero":"№","numsp":" ","nvDash":"⊭","nvHarr":"⤄","nvap":"≍⃒","nvdash":"⊬","nvge":"≥⃒","nvgt":">⃒","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwArr":"⇖","nwarhk":"⤣","nwarr":"↖","nwarrow":"↖","nwnear":"⤧","oS":"Ⓢ","oacut":"ó","oacute":"ó","oast":"⊛","ocir":"ô","ocirc":"ô","ocy":"о","odash":"⊝","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","oelig":"œ","ofcir":"⦿","ofr":"𝔬","ogon":"˛","ograv":"ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","omacr":"ō","omega":"ω","omicron":"ο","omid":"⦶","ominus":"⊖","oopf":"𝕠","opar":"⦷","operp":"⦹","oplus":"⊕","or":"∨","orarr":"↻","ord":"º","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oscr":"ℴ","oslas":"ø","oslash":"ø","osol":"⊘","otild":"õ","otilde":"õ","otimes":"⊗","otimesas":"⨶","oum":"ö","ouml":"ö","ovbar":"⌽","par":"¶","para":"¶","parallel":"∥","parsim":"⫳","parsl":"⫽","part":"∂","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","pfr":"𝔭","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plus":"+","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plusdo":"∔","plusdu":"⨥","pluse":"⩲","plusm":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","pointint":"⨕","popf":"𝕡","poun":"£","pound":"£","pr":"≺","prE":"⪳","prap":"⪷","prcue":"≼","pre":"⪯","prec":"≺","precapprox":"⪷","preccurlyeq":"≼","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","precsim":"≾","prime":"′","primes":"ℙ","prnE":"⪵","prnap":"⪹","prnsim":"⋨","prod":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","propto":"∝","prsim":"≾","prurel":"⊰","pscr":"𝓅","psi":"ψ","puncsp":" ","qfr":"𝔮","qint":"⨌","qopf":"𝕢","qprime":"⁗","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quo":"\\"","quot":"\\"","rAarr":"⇛","rArr":"⇒","rAtail":"⤜","rBarr":"⤏","rHar":"⥤","race":"∽̱","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","rangd":"⦒","range":"⦥","rangle":"⟩","raqu":"»","raquo":"»","rarr":"→","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","rarrtl":"↣","rarrw":"↝","ratail":"⤚","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","rcaron":"ř","rcedil":"ŗ","rceil":"⌉","rcub":"}","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","rect":"▭","re":"®","reg":"®","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","rhard":"⇁","rharu":"⇀","rharul":"⥬","rho":"ρ","rhov":"ϱ","rightarrow":"→","rightarrowtail":"↣","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","rightthreetimes":"⋌","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoust":"⎱","rmoustache":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","roplus":"⨮","rotimes":"⨵","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","rsaquo":"›","rscr":"𝓇","rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","ruluhar":"⥨","rx":"℞","sacute":"ś","sbquo":"‚","sc":"≻","scE":"⪴","scap":"⪸","scaron":"š","sccue":"≽","sce":"⪰","scedil":"ş","scirc":"ŝ","scnE":"⪶","scnap":"⪺","scnsim":"⋩","scpolint":"⨓","scsim":"≿","scy":"с","sdot":"⋅","sdotb":"⊡","sdote":"⩦","seArr":"⇘","searhk":"⤥","searr":"↘","searrow":"↘","sec":"§","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","sfr":"𝔰","sfrown":"⌢","sharp":"♯","shchcy":"щ","shcy":"ш","shortmid":"∣","shortparallel":"∥","sh":"­","shy":"­","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","softcy":"ь","sol":"/","solb":"⧄","solbar":"⌿","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","squ":"□","square":"□","squarf":"▪","squf":"▪","srarr":"→","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","subE":"⫅","subdot":"⪽","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","subseteq":"⊆","subseteqq":"⫅","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succ":"≻","succapprox":"⪸","succcurlyeq":"≽","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","sum":"∑","sung":"♪","sup":"⊃","sup1":"¹","sup2":"²","sup3":"³","supE":"⫆","supdot":"⪾","supdsub":"⫘","supe":"⊇","supedot":"⫄","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swArr":"⇙","swarhk":"⤦","swarr":"↙","swarrow":"↙","swnwar":"⤪","szli":"ß","szlig":"ß","target":"⌖","tau":"τ","tbrk":"⎴","tcaron":"ť","tcedil":"ţ","tcy":"т","tdot":"⃛","telrec":"⌕","tfr":"𝔱","there4":"∴","therefore":"∴","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","thinsp":" ","thkap":"≈","thksim":"∼","thor":"þ","thorn":"þ","tilde":"˜","time":"×","times":"×","timesb":"⊠","timesbar":"⨱","timesd":"⨰","tint":"∭","toea":"⤨","top":"⊤","topbot":"⌶","topcir":"⫱","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","tscr":"𝓉","tscy":"ц","tshcy":"ћ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","uArr":"⇑","uHar":"⥣","uacut":"ú","uacute":"ú","uarr":"↑","ubrcy":"ў","ubreve":"ŭ","ucir":"û","ucirc":"û","ucy":"у","udarr":"⇅","udblac":"ű","udhar":"⥮","ufisht":"⥾","ufr":"𝔲","ugrav":"ù","ugrave":"ù","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","umacr":"ū","um":"¨","uml":"¨","uogon":"ų","uopf":"𝕦","uparrow":"↑","updownarrow":"↕","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","upsi":"υ","upsih":"ϒ","upsilon":"υ","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","uring":"ů","urtri":"◹","uscr":"𝓊","utdot":"⋰","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","uum":"ü","uuml":"ü","uwangle":"⦧","vArr":"⇕","vBar":"⫨","vBarv":"⫩","vDash":"⊨","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vcy":"в","vdash":"⊢","vee":"∨","veebar":"⊻","veeeq":"≚","vellip":"⋮","verbar":"|","vert":"|","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","vopf":"𝕧","vprop":"∝","vrtri":"⊳","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","vzigzag":"⦚","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","wedgeq":"≙","weierp":"℘","wfr":"𝔴","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","xfr":"𝔵","xhArr":"⟺","xharr":"⟷","xi":"ξ","xlArr":"⟸","xlarr":"⟵","xmap":"⟼","xnis":"⋻","xodot":"⨀","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrArr":"⟹","xrarr":"⟶","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","yacut":"ý","yacute":"ý","yacy":"я","ycirc":"ŷ","ycy":"ы","ye":"¥","yen":"¥","yfr":"𝔶","yicy":"ї","yopf":"𝕪","yscr":"𝓎","yucy":"ю","yum":"ÿ","yuml":"ÿ","zacute":"ź","zcaron":"ž","zcy":"з","zdot":"ż","zeetrf":"ℨ","zeta":"ζ","zfr":"𝔷","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","zscr":"𝓏","zwj":"‍","zwnj":"‌"}' - ); +/***/ }), - /***/ - }, +/***/ 3407: +/***/ ((module) => { - /***/ 9499: /***/ (module) => { - 'use strict'; - module.exports = { i8: '3.1.5' }; +"use strict"; +module.exports = JSON.parse("{\"AEli\":\"Æ\",\"AElig\":\"Æ\",\"AM\":\"&\",\"AMP\":\"&\",\"Aacut\":\"Á\",\"Aacute\":\"Á\",\"Abreve\":\"Ă\",\"Acir\":\"Â\",\"Acirc\":\"Â\",\"Acy\":\"А\",\"Afr\":\"𝔄\",\"Agrav\":\"À\",\"Agrave\":\"À\",\"Alpha\":\"Α\",\"Amacr\":\"Ā\",\"And\":\"⩓\",\"Aogon\":\"Ą\",\"Aopf\":\"𝔸\",\"ApplyFunction\":\"⁡\",\"Arin\":\"Å\",\"Aring\":\"Å\",\"Ascr\":\"𝒜\",\"Assign\":\"≔\",\"Atild\":\"Ã\",\"Atilde\":\"Ã\",\"Aum\":\"Ä\",\"Auml\":\"Ä\",\"Backslash\":\"∖\",\"Barv\":\"⫧\",\"Barwed\":\"⌆\",\"Bcy\":\"Б\",\"Because\":\"∵\",\"Bernoullis\":\"ℬ\",\"Beta\":\"Β\",\"Bfr\":\"𝔅\",\"Bopf\":\"𝔹\",\"Breve\":\"˘\",\"Bscr\":\"ℬ\",\"Bumpeq\":\"≎\",\"CHcy\":\"Ч\",\"COP\":\"©\",\"COPY\":\"©\",\"Cacute\":\"Ć\",\"Cap\":\"⋒\",\"CapitalDifferentialD\":\"ⅅ\",\"Cayleys\":\"ℭ\",\"Ccaron\":\"Č\",\"Ccedi\":\"Ç\",\"Ccedil\":\"Ç\",\"Ccirc\":\"Ĉ\",\"Cconint\":\"∰\",\"Cdot\":\"Ċ\",\"Cedilla\":\"¸\",\"CenterDot\":\"·\",\"Cfr\":\"ℭ\",\"Chi\":\"Χ\",\"CircleDot\":\"⊙\",\"CircleMinus\":\"⊖\",\"CirclePlus\":\"⊕\",\"CircleTimes\":\"⊗\",\"ClockwiseContourIntegral\":\"∲\",\"CloseCurlyDoubleQuote\":\"”\",\"CloseCurlyQuote\":\"’\",\"Colon\":\"∷\",\"Colone\":\"⩴\",\"Congruent\":\"≡\",\"Conint\":\"∯\",\"ContourIntegral\":\"∮\",\"Copf\":\"ℂ\",\"Coproduct\":\"∐\",\"CounterClockwiseContourIntegral\":\"∳\",\"Cross\":\"⨯\",\"Cscr\":\"𝒞\",\"Cup\":\"⋓\",\"CupCap\":\"≍\",\"DD\":\"ⅅ\",\"DDotrahd\":\"⤑\",\"DJcy\":\"Ђ\",\"DScy\":\"Ѕ\",\"DZcy\":\"Џ\",\"Dagger\":\"‡\",\"Darr\":\"↡\",\"Dashv\":\"⫤\",\"Dcaron\":\"Ď\",\"Dcy\":\"Д\",\"Del\":\"∇\",\"Delta\":\"Δ\",\"Dfr\":\"𝔇\",\"DiacriticalAcute\":\"´\",\"DiacriticalDot\":\"˙\",\"DiacriticalDoubleAcute\":\"˝\",\"DiacriticalGrave\":\"`\",\"DiacriticalTilde\":\"˜\",\"Diamond\":\"⋄\",\"DifferentialD\":\"ⅆ\",\"Dopf\":\"𝔻\",\"Dot\":\"¨\",\"DotDot\":\"⃜\",\"DotEqual\":\"≐\",\"DoubleContourIntegral\":\"∯\",\"DoubleDot\":\"¨\",\"DoubleDownArrow\":\"⇓\",\"DoubleLeftArrow\":\"⇐\",\"DoubleLeftRightArrow\":\"⇔\",\"DoubleLeftTee\":\"⫤\",\"DoubleLongLeftArrow\":\"⟸\",\"DoubleLongLeftRightArrow\":\"⟺\",\"DoubleLongRightArrow\":\"⟹\",\"DoubleRightArrow\":\"⇒\",\"DoubleRightTee\":\"⊨\",\"DoubleUpArrow\":\"⇑\",\"DoubleUpDownArrow\":\"⇕\",\"DoubleVerticalBar\":\"∥\",\"DownArrow\":\"↓\",\"DownArrowBar\":\"⤓\",\"DownArrowUpArrow\":\"⇵\",\"DownBreve\":\"̑\",\"DownLeftRightVector\":\"⥐\",\"DownLeftTeeVector\":\"⥞\",\"DownLeftVector\":\"↽\",\"DownLeftVectorBar\":\"⥖\",\"DownRightTeeVector\":\"⥟\",\"DownRightVector\":\"⇁\",\"DownRightVectorBar\":\"⥗\",\"DownTee\":\"⊤\",\"DownTeeArrow\":\"↧\",\"Downarrow\":\"⇓\",\"Dscr\":\"𝒟\",\"Dstrok\":\"Đ\",\"ENG\":\"Ŋ\",\"ET\":\"Ð\",\"ETH\":\"Ð\",\"Eacut\":\"É\",\"Eacute\":\"É\",\"Ecaron\":\"Ě\",\"Ecir\":\"Ê\",\"Ecirc\":\"Ê\",\"Ecy\":\"Э\",\"Edot\":\"Ė\",\"Efr\":\"𝔈\",\"Egrav\":\"È\",\"Egrave\":\"È\",\"Element\":\"∈\",\"Emacr\":\"Ē\",\"EmptySmallSquare\":\"◻\",\"EmptyVerySmallSquare\":\"▫\",\"Eogon\":\"Ę\",\"Eopf\":\"𝔼\",\"Epsilon\":\"Ε\",\"Equal\":\"⩵\",\"EqualTilde\":\"≂\",\"Equilibrium\":\"⇌\",\"Escr\":\"ℰ\",\"Esim\":\"⩳\",\"Eta\":\"Η\",\"Eum\":\"Ë\",\"Euml\":\"Ë\",\"Exists\":\"∃\",\"ExponentialE\":\"ⅇ\",\"Fcy\":\"Ф\",\"Ffr\":\"𝔉\",\"FilledSmallSquare\":\"◼\",\"FilledVerySmallSquare\":\"▪\",\"Fopf\":\"𝔽\",\"ForAll\":\"∀\",\"Fouriertrf\":\"ℱ\",\"Fscr\":\"ℱ\",\"GJcy\":\"Ѓ\",\"G\":\">\",\"GT\":\">\",\"Gamma\":\"Γ\",\"Gammad\":\"Ϝ\",\"Gbreve\":\"Ğ\",\"Gcedil\":\"Ģ\",\"Gcirc\":\"Ĝ\",\"Gcy\":\"Г\",\"Gdot\":\"Ġ\",\"Gfr\":\"𝔊\",\"Gg\":\"⋙\",\"Gopf\":\"𝔾\",\"GreaterEqual\":\"≥\",\"GreaterEqualLess\":\"⋛\",\"GreaterFullEqual\":\"≧\",\"GreaterGreater\":\"⪢\",\"GreaterLess\":\"≷\",\"GreaterSlantEqual\":\"⩾\",\"GreaterTilde\":\"≳\",\"Gscr\":\"𝒢\",\"Gt\":\"≫\",\"HARDcy\":\"Ъ\",\"Hacek\":\"ˇ\",\"Hat\":\"^\",\"Hcirc\":\"Ĥ\",\"Hfr\":\"ℌ\",\"HilbertSpace\":\"ℋ\",\"Hopf\":\"ℍ\",\"HorizontalLine\":\"─\",\"Hscr\":\"ℋ\",\"Hstrok\":\"Ħ\",\"HumpDownHump\":\"≎\",\"HumpEqual\":\"≏\",\"IEcy\":\"Е\",\"IJlig\":\"IJ\",\"IOcy\":\"Ё\",\"Iacut\":\"Í\",\"Iacute\":\"Í\",\"Icir\":\"Î\",\"Icirc\":\"Î\",\"Icy\":\"И\",\"Idot\":\"İ\",\"Ifr\":\"ℑ\",\"Igrav\":\"Ì\",\"Igrave\":\"Ì\",\"Im\":\"ℑ\",\"Imacr\":\"Ī\",\"ImaginaryI\":\"ⅈ\",\"Implies\":\"⇒\",\"Int\":\"∬\",\"Integral\":\"∫\",\"Intersection\":\"⋂\",\"InvisibleComma\":\"⁣\",\"InvisibleTimes\":\"⁢\",\"Iogon\":\"Į\",\"Iopf\":\"𝕀\",\"Iota\":\"Ι\",\"Iscr\":\"ℐ\",\"Itilde\":\"Ĩ\",\"Iukcy\":\"І\",\"Ium\":\"Ï\",\"Iuml\":\"Ï\",\"Jcirc\":\"Ĵ\",\"Jcy\":\"Й\",\"Jfr\":\"𝔍\",\"Jopf\":\"𝕁\",\"Jscr\":\"𝒥\",\"Jsercy\":\"Ј\",\"Jukcy\":\"Є\",\"KHcy\":\"Х\",\"KJcy\":\"Ќ\",\"Kappa\":\"Κ\",\"Kcedil\":\"Ķ\",\"Kcy\":\"К\",\"Kfr\":\"𝔎\",\"Kopf\":\"𝕂\",\"Kscr\":\"𝒦\",\"LJcy\":\"Љ\",\"L\":\"<\",\"LT\":\"<\",\"Lacute\":\"Ĺ\",\"Lambda\":\"Λ\",\"Lang\":\"⟪\",\"Laplacetrf\":\"ℒ\",\"Larr\":\"↞\",\"Lcaron\":\"Ľ\",\"Lcedil\":\"Ļ\",\"Lcy\":\"Л\",\"LeftAngleBracket\":\"⟨\",\"LeftArrow\":\"←\",\"LeftArrowBar\":\"⇤\",\"LeftArrowRightArrow\":\"⇆\",\"LeftCeiling\":\"⌈\",\"LeftDoubleBracket\":\"⟦\",\"LeftDownTeeVector\":\"⥡\",\"LeftDownVector\":\"⇃\",\"LeftDownVectorBar\":\"⥙\",\"LeftFloor\":\"⌊\",\"LeftRightArrow\":\"↔\",\"LeftRightVector\":\"⥎\",\"LeftTee\":\"⊣\",\"LeftTeeArrow\":\"↤\",\"LeftTeeVector\":\"⥚\",\"LeftTriangle\":\"⊲\",\"LeftTriangleBar\":\"⧏\",\"LeftTriangleEqual\":\"⊴\",\"LeftUpDownVector\":\"⥑\",\"LeftUpTeeVector\":\"⥠\",\"LeftUpVector\":\"↿\",\"LeftUpVectorBar\":\"⥘\",\"LeftVector\":\"↼\",\"LeftVectorBar\":\"⥒\",\"Leftarrow\":\"⇐\",\"Leftrightarrow\":\"⇔\",\"LessEqualGreater\":\"⋚\",\"LessFullEqual\":\"≦\",\"LessGreater\":\"≶\",\"LessLess\":\"⪡\",\"LessSlantEqual\":\"⩽\",\"LessTilde\":\"≲\",\"Lfr\":\"𝔏\",\"Ll\":\"⋘\",\"Lleftarrow\":\"⇚\",\"Lmidot\":\"Ŀ\",\"LongLeftArrow\":\"⟵\",\"LongLeftRightArrow\":\"⟷\",\"LongRightArrow\":\"⟶\",\"Longleftarrow\":\"⟸\",\"Longleftrightarrow\":\"⟺\",\"Longrightarrow\":\"⟹\",\"Lopf\":\"𝕃\",\"LowerLeftArrow\":\"↙\",\"LowerRightArrow\":\"↘\",\"Lscr\":\"ℒ\",\"Lsh\":\"↰\",\"Lstrok\":\"Ł\",\"Lt\":\"≪\",\"Map\":\"⤅\",\"Mcy\":\"М\",\"MediumSpace\":\" \",\"Mellintrf\":\"ℳ\",\"Mfr\":\"𝔐\",\"MinusPlus\":\"∓\",\"Mopf\":\"𝕄\",\"Mscr\":\"ℳ\",\"Mu\":\"Μ\",\"NJcy\":\"Њ\",\"Nacute\":\"Ń\",\"Ncaron\":\"Ň\",\"Ncedil\":\"Ņ\",\"Ncy\":\"Н\",\"NegativeMediumSpace\":\"​\",\"NegativeThickSpace\":\"​\",\"NegativeThinSpace\":\"​\",\"NegativeVeryThinSpace\":\"​\",\"NestedGreaterGreater\":\"≫\",\"NestedLessLess\":\"≪\",\"NewLine\":\"\\n\",\"Nfr\":\"𝔑\",\"NoBreak\":\"⁠\",\"NonBreakingSpace\":\" \",\"Nopf\":\"ℕ\",\"Not\":\"⫬\",\"NotCongruent\":\"≢\",\"NotCupCap\":\"≭\",\"NotDoubleVerticalBar\":\"∦\",\"NotElement\":\"∉\",\"NotEqual\":\"≠\",\"NotEqualTilde\":\"≂̸\",\"NotExists\":\"∄\",\"NotGreater\":\"≯\",\"NotGreaterEqual\":\"≱\",\"NotGreaterFullEqual\":\"≧̸\",\"NotGreaterGreater\":\"≫̸\",\"NotGreaterLess\":\"≹\",\"NotGreaterSlantEqual\":\"⩾̸\",\"NotGreaterTilde\":\"≵\",\"NotHumpDownHump\":\"≎̸\",\"NotHumpEqual\":\"≏̸\",\"NotLeftTriangle\":\"⋪\",\"NotLeftTriangleBar\":\"⧏̸\",\"NotLeftTriangleEqual\":\"⋬\",\"NotLess\":\"≮\",\"NotLessEqual\":\"≰\",\"NotLessGreater\":\"≸\",\"NotLessLess\":\"≪̸\",\"NotLessSlantEqual\":\"⩽̸\",\"NotLessTilde\":\"≴\",\"NotNestedGreaterGreater\":\"⪢̸\",\"NotNestedLessLess\":\"⪡̸\",\"NotPrecedes\":\"⊀\",\"NotPrecedesEqual\":\"⪯̸\",\"NotPrecedesSlantEqual\":\"⋠\",\"NotReverseElement\":\"∌\",\"NotRightTriangle\":\"⋫\",\"NotRightTriangleBar\":\"⧐̸\",\"NotRightTriangleEqual\":\"⋭\",\"NotSquareSubset\":\"⊏̸\",\"NotSquareSubsetEqual\":\"⋢\",\"NotSquareSuperset\":\"⊐̸\",\"NotSquareSupersetEqual\":\"⋣\",\"NotSubset\":\"⊂⃒\",\"NotSubsetEqual\":\"⊈\",\"NotSucceeds\":\"⊁\",\"NotSucceedsEqual\":\"⪰̸\",\"NotSucceedsSlantEqual\":\"⋡\",\"NotSucceedsTilde\":\"≿̸\",\"NotSuperset\":\"⊃⃒\",\"NotSupersetEqual\":\"⊉\",\"NotTilde\":\"≁\",\"NotTildeEqual\":\"≄\",\"NotTildeFullEqual\":\"≇\",\"NotTildeTilde\":\"≉\",\"NotVerticalBar\":\"∤\",\"Nscr\":\"𝒩\",\"Ntild\":\"Ñ\",\"Ntilde\":\"Ñ\",\"Nu\":\"Ν\",\"OElig\":\"Œ\",\"Oacut\":\"Ó\",\"Oacute\":\"Ó\",\"Ocir\":\"Ô\",\"Ocirc\":\"Ô\",\"Ocy\":\"О\",\"Odblac\":\"Ő\",\"Ofr\":\"𝔒\",\"Ograv\":\"Ò\",\"Ograve\":\"Ò\",\"Omacr\":\"Ō\",\"Omega\":\"Ω\",\"Omicron\":\"Ο\",\"Oopf\":\"𝕆\",\"OpenCurlyDoubleQuote\":\"“\",\"OpenCurlyQuote\":\"‘\",\"Or\":\"⩔\",\"Oscr\":\"𝒪\",\"Oslas\":\"Ø\",\"Oslash\":\"Ø\",\"Otild\":\"Õ\",\"Otilde\":\"Õ\",\"Otimes\":\"⨷\",\"Oum\":\"Ö\",\"Ouml\":\"Ö\",\"OverBar\":\"‾\",\"OverBrace\":\"⏞\",\"OverBracket\":\"⎴\",\"OverParenthesis\":\"⏜\",\"PartialD\":\"∂\",\"Pcy\":\"П\",\"Pfr\":\"𝔓\",\"Phi\":\"Φ\",\"Pi\":\"Π\",\"PlusMinus\":\"±\",\"Poincareplane\":\"ℌ\",\"Popf\":\"ℙ\",\"Pr\":\"⪻\",\"Precedes\":\"≺\",\"PrecedesEqual\":\"⪯\",\"PrecedesSlantEqual\":\"≼\",\"PrecedesTilde\":\"≾\",\"Prime\":\"″\",\"Product\":\"∏\",\"Proportion\":\"∷\",\"Proportional\":\"∝\",\"Pscr\":\"𝒫\",\"Psi\":\"Ψ\",\"QUO\":\"\\\"\",\"QUOT\":\"\\\"\",\"Qfr\":\"𝔔\",\"Qopf\":\"ℚ\",\"Qscr\":\"𝒬\",\"RBarr\":\"⤐\",\"RE\":\"®\",\"REG\":\"®\",\"Racute\":\"Ŕ\",\"Rang\":\"⟫\",\"Rarr\":\"↠\",\"Rarrtl\":\"⤖\",\"Rcaron\":\"Ř\",\"Rcedil\":\"Ŗ\",\"Rcy\":\"Р\",\"Re\":\"ℜ\",\"ReverseElement\":\"∋\",\"ReverseEquilibrium\":\"⇋\",\"ReverseUpEquilibrium\":\"⥯\",\"Rfr\":\"ℜ\",\"Rho\":\"Ρ\",\"RightAngleBracket\":\"⟩\",\"RightArrow\":\"→\",\"RightArrowBar\":\"⇥\",\"RightArrowLeftArrow\":\"⇄\",\"RightCeiling\":\"⌉\",\"RightDoubleBracket\":\"⟧\",\"RightDownTeeVector\":\"⥝\",\"RightDownVector\":\"⇂\",\"RightDownVectorBar\":\"⥕\",\"RightFloor\":\"⌋\",\"RightTee\":\"⊢\",\"RightTeeArrow\":\"↦\",\"RightTeeVector\":\"⥛\",\"RightTriangle\":\"⊳\",\"RightTriangleBar\":\"⧐\",\"RightTriangleEqual\":\"⊵\",\"RightUpDownVector\":\"⥏\",\"RightUpTeeVector\":\"⥜\",\"RightUpVector\":\"↾\",\"RightUpVectorBar\":\"⥔\",\"RightVector\":\"⇀\",\"RightVectorBar\":\"⥓\",\"Rightarrow\":\"⇒\",\"Ropf\":\"ℝ\",\"RoundImplies\":\"⥰\",\"Rrightarrow\":\"⇛\",\"Rscr\":\"ℛ\",\"Rsh\":\"↱\",\"RuleDelayed\":\"⧴\",\"SHCHcy\":\"Щ\",\"SHcy\":\"Ш\",\"SOFTcy\":\"Ь\",\"Sacute\":\"Ś\",\"Sc\":\"⪼\",\"Scaron\":\"Š\",\"Scedil\":\"Ş\",\"Scirc\":\"Ŝ\",\"Scy\":\"С\",\"Sfr\":\"𝔖\",\"ShortDownArrow\":\"↓\",\"ShortLeftArrow\":\"←\",\"ShortRightArrow\":\"→\",\"ShortUpArrow\":\"↑\",\"Sigma\":\"Σ\",\"SmallCircle\":\"∘\",\"Sopf\":\"𝕊\",\"Sqrt\":\"√\",\"Square\":\"□\",\"SquareIntersection\":\"⊓\",\"SquareSubset\":\"⊏\",\"SquareSubsetEqual\":\"⊑\",\"SquareSuperset\":\"⊐\",\"SquareSupersetEqual\":\"⊒\",\"SquareUnion\":\"⊔\",\"Sscr\":\"𝒮\",\"Star\":\"⋆\",\"Sub\":\"⋐\",\"Subset\":\"⋐\",\"SubsetEqual\":\"⊆\",\"Succeeds\":\"≻\",\"SucceedsEqual\":\"⪰\",\"SucceedsSlantEqual\":\"≽\",\"SucceedsTilde\":\"≿\",\"SuchThat\":\"∋\",\"Sum\":\"∑\",\"Sup\":\"⋑\",\"Superset\":\"⊃\",\"SupersetEqual\":\"⊇\",\"Supset\":\"⋑\",\"THOR\":\"Þ\",\"THORN\":\"Þ\",\"TRADE\":\"™\",\"TSHcy\":\"Ћ\",\"TScy\":\"Ц\",\"Tab\":\"\\t\",\"Tau\":\"Τ\",\"Tcaron\":\"Ť\",\"Tcedil\":\"Ţ\",\"Tcy\":\"Т\",\"Tfr\":\"𝔗\",\"Therefore\":\"∴\",\"Theta\":\"Θ\",\"ThickSpace\":\"  \",\"ThinSpace\":\" \",\"Tilde\":\"∼\",\"TildeEqual\":\"≃\",\"TildeFullEqual\":\"≅\",\"TildeTilde\":\"≈\",\"Topf\":\"𝕋\",\"TripleDot\":\"⃛\",\"Tscr\":\"𝒯\",\"Tstrok\":\"Ŧ\",\"Uacut\":\"Ú\",\"Uacute\":\"Ú\",\"Uarr\":\"↟\",\"Uarrocir\":\"⥉\",\"Ubrcy\":\"Ў\",\"Ubreve\":\"Ŭ\",\"Ucir\":\"Û\",\"Ucirc\":\"Û\",\"Ucy\":\"У\",\"Udblac\":\"Ű\",\"Ufr\":\"𝔘\",\"Ugrav\":\"Ù\",\"Ugrave\":\"Ù\",\"Umacr\":\"Ū\",\"UnderBar\":\"_\",\"UnderBrace\":\"⏟\",\"UnderBracket\":\"⎵\",\"UnderParenthesis\":\"⏝\",\"Union\":\"⋃\",\"UnionPlus\":\"⊎\",\"Uogon\":\"Ų\",\"Uopf\":\"𝕌\",\"UpArrow\":\"↑\",\"UpArrowBar\":\"⤒\",\"UpArrowDownArrow\":\"⇅\",\"UpDownArrow\":\"↕\",\"UpEquilibrium\":\"⥮\",\"UpTee\":\"⊥\",\"UpTeeArrow\":\"↥\",\"Uparrow\":\"⇑\",\"Updownarrow\":\"⇕\",\"UpperLeftArrow\":\"↖\",\"UpperRightArrow\":\"↗\",\"Upsi\":\"ϒ\",\"Upsilon\":\"Υ\",\"Uring\":\"Ů\",\"Uscr\":\"𝒰\",\"Utilde\":\"Ũ\",\"Uum\":\"Ü\",\"Uuml\":\"Ü\",\"VDash\":\"⊫\",\"Vbar\":\"⫫\",\"Vcy\":\"В\",\"Vdash\":\"⊩\",\"Vdashl\":\"⫦\",\"Vee\":\"⋁\",\"Verbar\":\"‖\",\"Vert\":\"‖\",\"VerticalBar\":\"∣\",\"VerticalLine\":\"|\",\"VerticalSeparator\":\"❘\",\"VerticalTilde\":\"≀\",\"VeryThinSpace\":\" \",\"Vfr\":\"𝔙\",\"Vopf\":\"𝕍\",\"Vscr\":\"𝒱\",\"Vvdash\":\"⊪\",\"Wcirc\":\"Ŵ\",\"Wedge\":\"⋀\",\"Wfr\":\"𝔚\",\"Wopf\":\"𝕎\",\"Wscr\":\"𝒲\",\"Xfr\":\"𝔛\",\"Xi\":\"Ξ\",\"Xopf\":\"𝕏\",\"Xscr\":\"𝒳\",\"YAcy\":\"Я\",\"YIcy\":\"Ї\",\"YUcy\":\"Ю\",\"Yacut\":\"Ý\",\"Yacute\":\"Ý\",\"Ycirc\":\"Ŷ\",\"Ycy\":\"Ы\",\"Yfr\":\"𝔜\",\"Yopf\":\"𝕐\",\"Yscr\":\"𝒴\",\"Yuml\":\"Ÿ\",\"ZHcy\":\"Ж\",\"Zacute\":\"Ź\",\"Zcaron\":\"Ž\",\"Zcy\":\"З\",\"Zdot\":\"Ż\",\"ZeroWidthSpace\":\"​\",\"Zeta\":\"Ζ\",\"Zfr\":\"ℨ\",\"Zopf\":\"ℤ\",\"Zscr\":\"𝒵\",\"aacut\":\"á\",\"aacute\":\"á\",\"abreve\":\"ă\",\"ac\":\"∾\",\"acE\":\"∾̳\",\"acd\":\"∿\",\"acir\":\"â\",\"acirc\":\"â\",\"acut\":\"´\",\"acute\":\"´\",\"acy\":\"а\",\"aeli\":\"æ\",\"aelig\":\"æ\",\"af\":\"⁡\",\"afr\":\"𝔞\",\"agrav\":\"à\",\"agrave\":\"à\",\"alefsym\":\"ℵ\",\"aleph\":\"ℵ\",\"alpha\":\"α\",\"amacr\":\"ā\",\"amalg\":\"⨿\",\"am\":\"&\",\"amp\":\"&\",\"and\":\"∧\",\"andand\":\"⩕\",\"andd\":\"⩜\",\"andslope\":\"⩘\",\"andv\":\"⩚\",\"ang\":\"∠\",\"ange\":\"⦤\",\"angle\":\"∠\",\"angmsd\":\"∡\",\"angmsdaa\":\"⦨\",\"angmsdab\":\"⦩\",\"angmsdac\":\"⦪\",\"angmsdad\":\"⦫\",\"angmsdae\":\"⦬\",\"angmsdaf\":\"⦭\",\"angmsdag\":\"⦮\",\"angmsdah\":\"⦯\",\"angrt\":\"∟\",\"angrtvb\":\"⊾\",\"angrtvbd\":\"⦝\",\"angsph\":\"∢\",\"angst\":\"Å\",\"angzarr\":\"⍼\",\"aogon\":\"ą\",\"aopf\":\"𝕒\",\"ap\":\"≈\",\"apE\":\"⩰\",\"apacir\":\"⩯\",\"ape\":\"≊\",\"apid\":\"≋\",\"apos\":\"'\",\"approx\":\"≈\",\"approxeq\":\"≊\",\"arin\":\"å\",\"aring\":\"å\",\"ascr\":\"𝒶\",\"ast\":\"*\",\"asymp\":\"≈\",\"asympeq\":\"≍\",\"atild\":\"ã\",\"atilde\":\"ã\",\"aum\":\"ä\",\"auml\":\"ä\",\"awconint\":\"∳\",\"awint\":\"⨑\",\"bNot\":\"⫭\",\"backcong\":\"≌\",\"backepsilon\":\"϶\",\"backprime\":\"‵\",\"backsim\":\"∽\",\"backsimeq\":\"⋍\",\"barvee\":\"⊽\",\"barwed\":\"⌅\",\"barwedge\":\"⌅\",\"bbrk\":\"⎵\",\"bbrktbrk\":\"⎶\",\"bcong\":\"≌\",\"bcy\":\"б\",\"bdquo\":\"„\",\"becaus\":\"∵\",\"because\":\"∵\",\"bemptyv\":\"⦰\",\"bepsi\":\"϶\",\"bernou\":\"ℬ\",\"beta\":\"β\",\"beth\":\"ℶ\",\"between\":\"≬\",\"bfr\":\"𝔟\",\"bigcap\":\"⋂\",\"bigcirc\":\"◯\",\"bigcup\":\"⋃\",\"bigodot\":\"⨀\",\"bigoplus\":\"⨁\",\"bigotimes\":\"⨂\",\"bigsqcup\":\"⨆\",\"bigstar\":\"★\",\"bigtriangledown\":\"▽\",\"bigtriangleup\":\"△\",\"biguplus\":\"⨄\",\"bigvee\":\"⋁\",\"bigwedge\":\"⋀\",\"bkarow\":\"⤍\",\"blacklozenge\":\"⧫\",\"blacksquare\":\"▪\",\"blacktriangle\":\"▴\",\"blacktriangledown\":\"▾\",\"blacktriangleleft\":\"◂\",\"blacktriangleright\":\"▸\",\"blank\":\"␣\",\"blk12\":\"▒\",\"blk14\":\"░\",\"blk34\":\"▓\",\"block\":\"█\",\"bne\":\"=⃥\",\"bnequiv\":\"≡⃥\",\"bnot\":\"⌐\",\"bopf\":\"𝕓\",\"bot\":\"⊥\",\"bottom\":\"⊥\",\"bowtie\":\"⋈\",\"boxDL\":\"╗\",\"boxDR\":\"╔\",\"boxDl\":\"╖\",\"boxDr\":\"╓\",\"boxH\":\"═\",\"boxHD\":\"╦\",\"boxHU\":\"╩\",\"boxHd\":\"╤\",\"boxHu\":\"╧\",\"boxUL\":\"╝\",\"boxUR\":\"╚\",\"boxUl\":\"╜\",\"boxUr\":\"╙\",\"boxV\":\"║\",\"boxVH\":\"╬\",\"boxVL\":\"╣\",\"boxVR\":\"╠\",\"boxVh\":\"╫\",\"boxVl\":\"╢\",\"boxVr\":\"╟\",\"boxbox\":\"⧉\",\"boxdL\":\"╕\",\"boxdR\":\"╒\",\"boxdl\":\"┐\",\"boxdr\":\"┌\",\"boxh\":\"─\",\"boxhD\":\"╥\",\"boxhU\":\"╨\",\"boxhd\":\"┬\",\"boxhu\":\"┴\",\"boxminus\":\"⊟\",\"boxplus\":\"⊞\",\"boxtimes\":\"⊠\",\"boxuL\":\"╛\",\"boxuR\":\"╘\",\"boxul\":\"┘\",\"boxur\":\"└\",\"boxv\":\"│\",\"boxvH\":\"╪\",\"boxvL\":\"╡\",\"boxvR\":\"╞\",\"boxvh\":\"┼\",\"boxvl\":\"┤\",\"boxvr\":\"├\",\"bprime\":\"‵\",\"breve\":\"˘\",\"brvba\":\"¦\",\"brvbar\":\"¦\",\"bscr\":\"𝒷\",\"bsemi\":\"⁏\",\"bsim\":\"∽\",\"bsime\":\"⋍\",\"bsol\":\"\\\\\",\"bsolb\":\"⧅\",\"bsolhsub\":\"⟈\",\"bull\":\"•\",\"bullet\":\"•\",\"bump\":\"≎\",\"bumpE\":\"⪮\",\"bumpe\":\"≏\",\"bumpeq\":\"≏\",\"cacute\":\"ć\",\"cap\":\"∩\",\"capand\":\"⩄\",\"capbrcup\":\"⩉\",\"capcap\":\"⩋\",\"capcup\":\"⩇\",\"capdot\":\"⩀\",\"caps\":\"∩︀\",\"caret\":\"⁁\",\"caron\":\"ˇ\",\"ccaps\":\"⩍\",\"ccaron\":\"č\",\"ccedi\":\"ç\",\"ccedil\":\"ç\",\"ccirc\":\"ĉ\",\"ccups\":\"⩌\",\"ccupssm\":\"⩐\",\"cdot\":\"ċ\",\"cedi\":\"¸\",\"cedil\":\"¸\",\"cemptyv\":\"⦲\",\"cen\":\"¢\",\"cent\":\"¢\",\"centerdot\":\"·\",\"cfr\":\"𝔠\",\"chcy\":\"ч\",\"check\":\"✓\",\"checkmark\":\"✓\",\"chi\":\"χ\",\"cir\":\"○\",\"cirE\":\"⧃\",\"circ\":\"ˆ\",\"circeq\":\"≗\",\"circlearrowleft\":\"↺\",\"circlearrowright\":\"↻\",\"circledR\":\"®\",\"circledS\":\"Ⓢ\",\"circledast\":\"⊛\",\"circledcirc\":\"⊚\",\"circleddash\":\"⊝\",\"cire\":\"≗\",\"cirfnint\":\"⨐\",\"cirmid\":\"⫯\",\"cirscir\":\"⧂\",\"clubs\":\"♣\",\"clubsuit\":\"♣\",\"colon\":\":\",\"colone\":\"≔\",\"coloneq\":\"≔\",\"comma\":\",\",\"commat\":\"@\",\"comp\":\"∁\",\"compfn\":\"∘\",\"complement\":\"∁\",\"complexes\":\"ℂ\",\"cong\":\"≅\",\"congdot\":\"⩭\",\"conint\":\"∮\",\"copf\":\"𝕔\",\"coprod\":\"∐\",\"cop\":\"©\",\"copy\":\"©\",\"copysr\":\"℗\",\"crarr\":\"↵\",\"cross\":\"✗\",\"cscr\":\"𝒸\",\"csub\":\"⫏\",\"csube\":\"⫑\",\"csup\":\"⫐\",\"csupe\":\"⫒\",\"ctdot\":\"⋯\",\"cudarrl\":\"⤸\",\"cudarrr\":\"⤵\",\"cuepr\":\"⋞\",\"cuesc\":\"⋟\",\"cularr\":\"↶\",\"cularrp\":\"⤽\",\"cup\":\"∪\",\"cupbrcap\":\"⩈\",\"cupcap\":\"⩆\",\"cupcup\":\"⩊\",\"cupdot\":\"⊍\",\"cupor\":\"⩅\",\"cups\":\"∪︀\",\"curarr\":\"↷\",\"curarrm\":\"⤼\",\"curlyeqprec\":\"⋞\",\"curlyeqsucc\":\"⋟\",\"curlyvee\":\"⋎\",\"curlywedge\":\"⋏\",\"curre\":\"¤\",\"curren\":\"¤\",\"curvearrowleft\":\"↶\",\"curvearrowright\":\"↷\",\"cuvee\":\"⋎\",\"cuwed\":\"⋏\",\"cwconint\":\"∲\",\"cwint\":\"∱\",\"cylcty\":\"⌭\",\"dArr\":\"⇓\",\"dHar\":\"⥥\",\"dagger\":\"†\",\"daleth\":\"ℸ\",\"darr\":\"↓\",\"dash\":\"‐\",\"dashv\":\"⊣\",\"dbkarow\":\"⤏\",\"dblac\":\"˝\",\"dcaron\":\"ď\",\"dcy\":\"д\",\"dd\":\"ⅆ\",\"ddagger\":\"‡\",\"ddarr\":\"⇊\",\"ddotseq\":\"⩷\",\"de\":\"°\",\"deg\":\"°\",\"delta\":\"δ\",\"demptyv\":\"⦱\",\"dfisht\":\"⥿\",\"dfr\":\"𝔡\",\"dharl\":\"⇃\",\"dharr\":\"⇂\",\"diam\":\"⋄\",\"diamond\":\"⋄\",\"diamondsuit\":\"♦\",\"diams\":\"♦\",\"die\":\"¨\",\"digamma\":\"ϝ\",\"disin\":\"⋲\",\"div\":\"÷\",\"divid\":\"÷\",\"divide\":\"÷\",\"divideontimes\":\"⋇\",\"divonx\":\"⋇\",\"djcy\":\"ђ\",\"dlcorn\":\"⌞\",\"dlcrop\":\"⌍\",\"dollar\":\"$\",\"dopf\":\"𝕕\",\"dot\":\"˙\",\"doteq\":\"≐\",\"doteqdot\":\"≑\",\"dotminus\":\"∸\",\"dotplus\":\"∔\",\"dotsquare\":\"⊡\",\"doublebarwedge\":\"⌆\",\"downarrow\":\"↓\",\"downdownarrows\":\"⇊\",\"downharpoonleft\":\"⇃\",\"downharpoonright\":\"⇂\",\"drbkarow\":\"⤐\",\"drcorn\":\"⌟\",\"drcrop\":\"⌌\",\"dscr\":\"𝒹\",\"dscy\":\"ѕ\",\"dsol\":\"⧶\",\"dstrok\":\"đ\",\"dtdot\":\"⋱\",\"dtri\":\"▿\",\"dtrif\":\"▾\",\"duarr\":\"⇵\",\"duhar\":\"⥯\",\"dwangle\":\"⦦\",\"dzcy\":\"џ\",\"dzigrarr\":\"⟿\",\"eDDot\":\"⩷\",\"eDot\":\"≑\",\"eacut\":\"é\",\"eacute\":\"é\",\"easter\":\"⩮\",\"ecaron\":\"ě\",\"ecir\":\"ê\",\"ecirc\":\"ê\",\"ecolon\":\"≕\",\"ecy\":\"э\",\"edot\":\"ė\",\"ee\":\"ⅇ\",\"efDot\":\"≒\",\"efr\":\"𝔢\",\"eg\":\"⪚\",\"egrav\":\"è\",\"egrave\":\"è\",\"egs\":\"⪖\",\"egsdot\":\"⪘\",\"el\":\"⪙\",\"elinters\":\"⏧\",\"ell\":\"ℓ\",\"els\":\"⪕\",\"elsdot\":\"⪗\",\"emacr\":\"ē\",\"empty\":\"∅\",\"emptyset\":\"∅\",\"emptyv\":\"∅\",\"emsp13\":\" \",\"emsp14\":\" \",\"emsp\":\" \",\"eng\":\"ŋ\",\"ensp\":\" \",\"eogon\":\"ę\",\"eopf\":\"𝕖\",\"epar\":\"⋕\",\"eparsl\":\"⧣\",\"eplus\":\"⩱\",\"epsi\":\"ε\",\"epsilon\":\"ε\",\"epsiv\":\"ϵ\",\"eqcirc\":\"≖\",\"eqcolon\":\"≕\",\"eqsim\":\"≂\",\"eqslantgtr\":\"⪖\",\"eqslantless\":\"⪕\",\"equals\":\"=\",\"equest\":\"≟\",\"equiv\":\"≡\",\"equivDD\":\"⩸\",\"eqvparsl\":\"⧥\",\"erDot\":\"≓\",\"erarr\":\"⥱\",\"escr\":\"ℯ\",\"esdot\":\"≐\",\"esim\":\"≂\",\"eta\":\"η\",\"et\":\"ð\",\"eth\":\"ð\",\"eum\":\"ë\",\"euml\":\"ë\",\"euro\":\"€\",\"excl\":\"!\",\"exist\":\"∃\",\"expectation\":\"ℰ\",\"exponentiale\":\"ⅇ\",\"fallingdotseq\":\"≒\",\"fcy\":\"ф\",\"female\":\"♀\",\"ffilig\":\"ffi\",\"fflig\":\"ff\",\"ffllig\":\"ffl\",\"ffr\":\"𝔣\",\"filig\":\"fi\",\"fjlig\":\"fj\",\"flat\":\"♭\",\"fllig\":\"fl\",\"fltns\":\"▱\",\"fnof\":\"ƒ\",\"fopf\":\"𝕗\",\"forall\":\"∀\",\"fork\":\"⋔\",\"forkv\":\"⫙\",\"fpartint\":\"⨍\",\"frac1\":\"¼\",\"frac12\":\"½\",\"frac13\":\"⅓\",\"frac14\":\"¼\",\"frac15\":\"⅕\",\"frac16\":\"⅙\",\"frac18\":\"⅛\",\"frac23\":\"⅔\",\"frac25\":\"⅖\",\"frac3\":\"¾\",\"frac34\":\"¾\",\"frac35\":\"⅗\",\"frac38\":\"⅜\",\"frac45\":\"⅘\",\"frac56\":\"⅚\",\"frac58\":\"⅝\",\"frac78\":\"⅞\",\"frasl\":\"⁄\",\"frown\":\"⌢\",\"fscr\":\"𝒻\",\"gE\":\"≧\",\"gEl\":\"⪌\",\"gacute\":\"ǵ\",\"gamma\":\"γ\",\"gammad\":\"ϝ\",\"gap\":\"⪆\",\"gbreve\":\"ğ\",\"gcirc\":\"ĝ\",\"gcy\":\"г\",\"gdot\":\"ġ\",\"ge\":\"≥\",\"gel\":\"⋛\",\"geq\":\"≥\",\"geqq\":\"≧\",\"geqslant\":\"⩾\",\"ges\":\"⩾\",\"gescc\":\"⪩\",\"gesdot\":\"⪀\",\"gesdoto\":\"⪂\",\"gesdotol\":\"⪄\",\"gesl\":\"⋛︀\",\"gesles\":\"⪔\",\"gfr\":\"𝔤\",\"gg\":\"≫\",\"ggg\":\"⋙\",\"gimel\":\"ℷ\",\"gjcy\":\"ѓ\",\"gl\":\"≷\",\"glE\":\"⪒\",\"gla\":\"⪥\",\"glj\":\"⪤\",\"gnE\":\"≩\",\"gnap\":\"⪊\",\"gnapprox\":\"⪊\",\"gne\":\"⪈\",\"gneq\":\"⪈\",\"gneqq\":\"≩\",\"gnsim\":\"⋧\",\"gopf\":\"𝕘\",\"grave\":\"`\",\"gscr\":\"ℊ\",\"gsim\":\"≳\",\"gsime\":\"⪎\",\"gsiml\":\"⪐\",\"g\":\">\",\"gt\":\">\",\"gtcc\":\"⪧\",\"gtcir\":\"⩺\",\"gtdot\":\"⋗\",\"gtlPar\":\"⦕\",\"gtquest\":\"⩼\",\"gtrapprox\":\"⪆\",\"gtrarr\":\"⥸\",\"gtrdot\":\"⋗\",\"gtreqless\":\"⋛\",\"gtreqqless\":\"⪌\",\"gtrless\":\"≷\",\"gtrsim\":\"≳\",\"gvertneqq\":\"≩︀\",\"gvnE\":\"≩︀\",\"hArr\":\"⇔\",\"hairsp\":\" \",\"half\":\"½\",\"hamilt\":\"ℋ\",\"hardcy\":\"ъ\",\"harr\":\"↔\",\"harrcir\":\"⥈\",\"harrw\":\"↭\",\"hbar\":\"ℏ\",\"hcirc\":\"ĥ\",\"hearts\":\"♥\",\"heartsuit\":\"♥\",\"hellip\":\"…\",\"hercon\":\"⊹\",\"hfr\":\"𝔥\",\"hksearow\":\"⤥\",\"hkswarow\":\"⤦\",\"hoarr\":\"⇿\",\"homtht\":\"∻\",\"hookleftarrow\":\"↩\",\"hookrightarrow\":\"↪\",\"hopf\":\"𝕙\",\"horbar\":\"―\",\"hscr\":\"𝒽\",\"hslash\":\"ℏ\",\"hstrok\":\"ħ\",\"hybull\":\"⁃\",\"hyphen\":\"‐\",\"iacut\":\"í\",\"iacute\":\"í\",\"ic\":\"⁣\",\"icir\":\"î\",\"icirc\":\"î\",\"icy\":\"и\",\"iecy\":\"е\",\"iexc\":\"¡\",\"iexcl\":\"¡\",\"iff\":\"⇔\",\"ifr\":\"𝔦\",\"igrav\":\"ì\",\"igrave\":\"ì\",\"ii\":\"ⅈ\",\"iiiint\":\"⨌\",\"iiint\":\"∭\",\"iinfin\":\"⧜\",\"iiota\":\"℩\",\"ijlig\":\"ij\",\"imacr\":\"ī\",\"image\":\"ℑ\",\"imagline\":\"ℐ\",\"imagpart\":\"ℑ\",\"imath\":\"ı\",\"imof\":\"⊷\",\"imped\":\"Ƶ\",\"in\":\"∈\",\"incare\":\"℅\",\"infin\":\"∞\",\"infintie\":\"⧝\",\"inodot\":\"ı\",\"int\":\"∫\",\"intcal\":\"⊺\",\"integers\":\"ℤ\",\"intercal\":\"⊺\",\"intlarhk\":\"⨗\",\"intprod\":\"⨼\",\"iocy\":\"ё\",\"iogon\":\"į\",\"iopf\":\"𝕚\",\"iota\":\"ι\",\"iprod\":\"⨼\",\"iques\":\"¿\",\"iquest\":\"¿\",\"iscr\":\"𝒾\",\"isin\":\"∈\",\"isinE\":\"⋹\",\"isindot\":\"⋵\",\"isins\":\"⋴\",\"isinsv\":\"⋳\",\"isinv\":\"∈\",\"it\":\"⁢\",\"itilde\":\"ĩ\",\"iukcy\":\"і\",\"ium\":\"ï\",\"iuml\":\"ï\",\"jcirc\":\"ĵ\",\"jcy\":\"й\",\"jfr\":\"𝔧\",\"jmath\":\"ȷ\",\"jopf\":\"𝕛\",\"jscr\":\"𝒿\",\"jsercy\":\"ј\",\"jukcy\":\"є\",\"kappa\":\"κ\",\"kappav\":\"ϰ\",\"kcedil\":\"ķ\",\"kcy\":\"к\",\"kfr\":\"𝔨\",\"kgreen\":\"ĸ\",\"khcy\":\"х\",\"kjcy\":\"ќ\",\"kopf\":\"𝕜\",\"kscr\":\"𝓀\",\"lAarr\":\"⇚\",\"lArr\":\"⇐\",\"lAtail\":\"⤛\",\"lBarr\":\"⤎\",\"lE\":\"≦\",\"lEg\":\"⪋\",\"lHar\":\"⥢\",\"lacute\":\"ĺ\",\"laemptyv\":\"⦴\",\"lagran\":\"ℒ\",\"lambda\":\"λ\",\"lang\":\"⟨\",\"langd\":\"⦑\",\"langle\":\"⟨\",\"lap\":\"⪅\",\"laqu\":\"«\",\"laquo\":\"«\",\"larr\":\"←\",\"larrb\":\"⇤\",\"larrbfs\":\"⤟\",\"larrfs\":\"⤝\",\"larrhk\":\"↩\",\"larrlp\":\"↫\",\"larrpl\":\"⤹\",\"larrsim\":\"⥳\",\"larrtl\":\"↢\",\"lat\":\"⪫\",\"latail\":\"⤙\",\"late\":\"⪭\",\"lates\":\"⪭︀\",\"lbarr\":\"⤌\",\"lbbrk\":\"❲\",\"lbrace\":\"{\",\"lbrack\":\"[\",\"lbrke\":\"⦋\",\"lbrksld\":\"⦏\",\"lbrkslu\":\"⦍\",\"lcaron\":\"ľ\",\"lcedil\":\"ļ\",\"lceil\":\"⌈\",\"lcub\":\"{\",\"lcy\":\"л\",\"ldca\":\"⤶\",\"ldquo\":\"“\",\"ldquor\":\"„\",\"ldrdhar\":\"⥧\",\"ldrushar\":\"⥋\",\"ldsh\":\"↲\",\"le\":\"≤\",\"leftarrow\":\"←\",\"leftarrowtail\":\"↢\",\"leftharpoondown\":\"↽\",\"leftharpoonup\":\"↼\",\"leftleftarrows\":\"⇇\",\"leftrightarrow\":\"↔\",\"leftrightarrows\":\"⇆\",\"leftrightharpoons\":\"⇋\",\"leftrightsquigarrow\":\"↭\",\"leftthreetimes\":\"⋋\",\"leg\":\"⋚\",\"leq\":\"≤\",\"leqq\":\"≦\",\"leqslant\":\"⩽\",\"les\":\"⩽\",\"lescc\":\"⪨\",\"lesdot\":\"⩿\",\"lesdoto\":\"⪁\",\"lesdotor\":\"⪃\",\"lesg\":\"⋚︀\",\"lesges\":\"⪓\",\"lessapprox\":\"⪅\",\"lessdot\":\"⋖\",\"lesseqgtr\":\"⋚\",\"lesseqqgtr\":\"⪋\",\"lessgtr\":\"≶\",\"lesssim\":\"≲\",\"lfisht\":\"⥼\",\"lfloor\":\"⌊\",\"lfr\":\"𝔩\",\"lg\":\"≶\",\"lgE\":\"⪑\",\"lhard\":\"↽\",\"lharu\":\"↼\",\"lharul\":\"⥪\",\"lhblk\":\"▄\",\"ljcy\":\"љ\",\"ll\":\"≪\",\"llarr\":\"⇇\",\"llcorner\":\"⌞\",\"llhard\":\"⥫\",\"lltri\":\"◺\",\"lmidot\":\"ŀ\",\"lmoust\":\"⎰\",\"lmoustache\":\"⎰\",\"lnE\":\"≨\",\"lnap\":\"⪉\",\"lnapprox\":\"⪉\",\"lne\":\"⪇\",\"lneq\":\"⪇\",\"lneqq\":\"≨\",\"lnsim\":\"⋦\",\"loang\":\"⟬\",\"loarr\":\"⇽\",\"lobrk\":\"⟦\",\"longleftarrow\":\"⟵\",\"longleftrightarrow\":\"⟷\",\"longmapsto\":\"⟼\",\"longrightarrow\":\"⟶\",\"looparrowleft\":\"↫\",\"looparrowright\":\"↬\",\"lopar\":\"⦅\",\"lopf\":\"𝕝\",\"loplus\":\"⨭\",\"lotimes\":\"⨴\",\"lowast\":\"∗\",\"lowbar\":\"_\",\"loz\":\"◊\",\"lozenge\":\"◊\",\"lozf\":\"⧫\",\"lpar\":\"(\",\"lparlt\":\"⦓\",\"lrarr\":\"⇆\",\"lrcorner\":\"⌟\",\"lrhar\":\"⇋\",\"lrhard\":\"⥭\",\"lrm\":\"‎\",\"lrtri\":\"⊿\",\"lsaquo\":\"‹\",\"lscr\":\"𝓁\",\"lsh\":\"↰\",\"lsim\":\"≲\",\"lsime\":\"⪍\",\"lsimg\":\"⪏\",\"lsqb\":\"[\",\"lsquo\":\"‘\",\"lsquor\":\"‚\",\"lstrok\":\"ł\",\"l\":\"<\",\"lt\":\"<\",\"ltcc\":\"⪦\",\"ltcir\":\"⩹\",\"ltdot\":\"⋖\",\"lthree\":\"⋋\",\"ltimes\":\"⋉\",\"ltlarr\":\"⥶\",\"ltquest\":\"⩻\",\"ltrPar\":\"⦖\",\"ltri\":\"◃\",\"ltrie\":\"⊴\",\"ltrif\":\"◂\",\"lurdshar\":\"⥊\",\"luruhar\":\"⥦\",\"lvertneqq\":\"≨︀\",\"lvnE\":\"≨︀\",\"mDDot\":\"∺\",\"mac\":\"¯\",\"macr\":\"¯\",\"male\":\"♂\",\"malt\":\"✠\",\"maltese\":\"✠\",\"map\":\"↦\",\"mapsto\":\"↦\",\"mapstodown\":\"↧\",\"mapstoleft\":\"↤\",\"mapstoup\":\"↥\",\"marker\":\"▮\",\"mcomma\":\"⨩\",\"mcy\":\"м\",\"mdash\":\"—\",\"measuredangle\":\"∡\",\"mfr\":\"𝔪\",\"mho\":\"℧\",\"micr\":\"µ\",\"micro\":\"µ\",\"mid\":\"∣\",\"midast\":\"*\",\"midcir\":\"⫰\",\"middo\":\"·\",\"middot\":\"·\",\"minus\":\"−\",\"minusb\":\"⊟\",\"minusd\":\"∸\",\"minusdu\":\"⨪\",\"mlcp\":\"⫛\",\"mldr\":\"…\",\"mnplus\":\"∓\",\"models\":\"⊧\",\"mopf\":\"𝕞\",\"mp\":\"∓\",\"mscr\":\"𝓂\",\"mstpos\":\"∾\",\"mu\":\"μ\",\"multimap\":\"⊸\",\"mumap\":\"⊸\",\"nGg\":\"⋙̸\",\"nGt\":\"≫⃒\",\"nGtv\":\"≫̸\",\"nLeftarrow\":\"⇍\",\"nLeftrightarrow\":\"⇎\",\"nLl\":\"⋘̸\",\"nLt\":\"≪⃒\",\"nLtv\":\"≪̸\",\"nRightarrow\":\"⇏\",\"nVDash\":\"⊯\",\"nVdash\":\"⊮\",\"nabla\":\"∇\",\"nacute\":\"ń\",\"nang\":\"∠⃒\",\"nap\":\"≉\",\"napE\":\"⩰̸\",\"napid\":\"≋̸\",\"napos\":\"ʼn\",\"napprox\":\"≉\",\"natur\":\"♮\",\"natural\":\"♮\",\"naturals\":\"ℕ\",\"nbs\":\" \",\"nbsp\":\" \",\"nbump\":\"≎̸\",\"nbumpe\":\"≏̸\",\"ncap\":\"⩃\",\"ncaron\":\"ň\",\"ncedil\":\"ņ\",\"ncong\":\"≇\",\"ncongdot\":\"⩭̸\",\"ncup\":\"⩂\",\"ncy\":\"н\",\"ndash\":\"–\",\"ne\":\"≠\",\"neArr\":\"⇗\",\"nearhk\":\"⤤\",\"nearr\":\"↗\",\"nearrow\":\"↗\",\"nedot\":\"≐̸\",\"nequiv\":\"≢\",\"nesear\":\"⤨\",\"nesim\":\"≂̸\",\"nexist\":\"∄\",\"nexists\":\"∄\",\"nfr\":\"𝔫\",\"ngE\":\"≧̸\",\"nge\":\"≱\",\"ngeq\":\"≱\",\"ngeqq\":\"≧̸\",\"ngeqslant\":\"⩾̸\",\"nges\":\"⩾̸\",\"ngsim\":\"≵\",\"ngt\":\"≯\",\"ngtr\":\"≯\",\"nhArr\":\"⇎\",\"nharr\":\"↮\",\"nhpar\":\"⫲\",\"ni\":\"∋\",\"nis\":\"⋼\",\"nisd\":\"⋺\",\"niv\":\"∋\",\"njcy\":\"њ\",\"nlArr\":\"⇍\",\"nlE\":\"≦̸\",\"nlarr\":\"↚\",\"nldr\":\"‥\",\"nle\":\"≰\",\"nleftarrow\":\"↚\",\"nleftrightarrow\":\"↮\",\"nleq\":\"≰\",\"nleqq\":\"≦̸\",\"nleqslant\":\"⩽̸\",\"nles\":\"⩽̸\",\"nless\":\"≮\",\"nlsim\":\"≴\",\"nlt\":\"≮\",\"nltri\":\"⋪\",\"nltrie\":\"⋬\",\"nmid\":\"∤\",\"nopf\":\"𝕟\",\"no\":\"¬\",\"not\":\"¬\",\"notin\":\"∉\",\"notinE\":\"⋹̸\",\"notindot\":\"⋵̸\",\"notinva\":\"∉\",\"notinvb\":\"⋷\",\"notinvc\":\"⋶\",\"notni\":\"∌\",\"notniva\":\"∌\",\"notnivb\":\"⋾\",\"notnivc\":\"⋽\",\"npar\":\"∦\",\"nparallel\":\"∦\",\"nparsl\":\"⫽⃥\",\"npart\":\"∂̸\",\"npolint\":\"⨔\",\"npr\":\"⊀\",\"nprcue\":\"⋠\",\"npre\":\"⪯̸\",\"nprec\":\"⊀\",\"npreceq\":\"⪯̸\",\"nrArr\":\"⇏\",\"nrarr\":\"↛\",\"nrarrc\":\"⤳̸\",\"nrarrw\":\"↝̸\",\"nrightarrow\":\"↛\",\"nrtri\":\"⋫\",\"nrtrie\":\"⋭\",\"nsc\":\"⊁\",\"nsccue\":\"⋡\",\"nsce\":\"⪰̸\",\"nscr\":\"𝓃\",\"nshortmid\":\"∤\",\"nshortparallel\":\"∦\",\"nsim\":\"≁\",\"nsime\":\"≄\",\"nsimeq\":\"≄\",\"nsmid\":\"∤\",\"nspar\":\"∦\",\"nsqsube\":\"⋢\",\"nsqsupe\":\"⋣\",\"nsub\":\"⊄\",\"nsubE\":\"⫅̸\",\"nsube\":\"⊈\",\"nsubset\":\"⊂⃒\",\"nsubseteq\":\"⊈\",\"nsubseteqq\":\"⫅̸\",\"nsucc\":\"⊁\",\"nsucceq\":\"⪰̸\",\"nsup\":\"⊅\",\"nsupE\":\"⫆̸\",\"nsupe\":\"⊉\",\"nsupset\":\"⊃⃒\",\"nsupseteq\":\"⊉\",\"nsupseteqq\":\"⫆̸\",\"ntgl\":\"≹\",\"ntild\":\"ñ\",\"ntilde\":\"ñ\",\"ntlg\":\"≸\",\"ntriangleleft\":\"⋪\",\"ntrianglelefteq\":\"⋬\",\"ntriangleright\":\"⋫\",\"ntrianglerighteq\":\"⋭\",\"nu\":\"ν\",\"num\":\"#\",\"numero\":\"№\",\"numsp\":\" \",\"nvDash\":\"⊭\",\"nvHarr\":\"⤄\",\"nvap\":\"≍⃒\",\"nvdash\":\"⊬\",\"nvge\":\"≥⃒\",\"nvgt\":\">⃒\",\"nvinfin\":\"⧞\",\"nvlArr\":\"⤂\",\"nvle\":\"≤⃒\",\"nvlt\":\"<⃒\",\"nvltrie\":\"⊴⃒\",\"nvrArr\":\"⤃\",\"nvrtrie\":\"⊵⃒\",\"nvsim\":\"∼⃒\",\"nwArr\":\"⇖\",\"nwarhk\":\"⤣\",\"nwarr\":\"↖\",\"nwarrow\":\"↖\",\"nwnear\":\"⤧\",\"oS\":\"Ⓢ\",\"oacut\":\"ó\",\"oacute\":\"ó\",\"oast\":\"⊛\",\"ocir\":\"ô\",\"ocirc\":\"ô\",\"ocy\":\"о\",\"odash\":\"⊝\",\"odblac\":\"ő\",\"odiv\":\"⨸\",\"odot\":\"⊙\",\"odsold\":\"⦼\",\"oelig\":\"œ\",\"ofcir\":\"⦿\",\"ofr\":\"𝔬\",\"ogon\":\"˛\",\"ograv\":\"ò\",\"ograve\":\"ò\",\"ogt\":\"⧁\",\"ohbar\":\"⦵\",\"ohm\":\"Ω\",\"oint\":\"∮\",\"olarr\":\"↺\",\"olcir\":\"⦾\",\"olcross\":\"⦻\",\"oline\":\"‾\",\"olt\":\"⧀\",\"omacr\":\"ō\",\"omega\":\"ω\",\"omicron\":\"ο\",\"omid\":\"⦶\",\"ominus\":\"⊖\",\"oopf\":\"𝕠\",\"opar\":\"⦷\",\"operp\":\"⦹\",\"oplus\":\"⊕\",\"or\":\"∨\",\"orarr\":\"↻\",\"ord\":\"º\",\"order\":\"ℴ\",\"orderof\":\"ℴ\",\"ordf\":\"ª\",\"ordm\":\"º\",\"origof\":\"⊶\",\"oror\":\"⩖\",\"orslope\":\"⩗\",\"orv\":\"⩛\",\"oscr\":\"ℴ\",\"oslas\":\"ø\",\"oslash\":\"ø\",\"osol\":\"⊘\",\"otild\":\"õ\",\"otilde\":\"õ\",\"otimes\":\"⊗\",\"otimesas\":\"⨶\",\"oum\":\"ö\",\"ouml\":\"ö\",\"ovbar\":\"⌽\",\"par\":\"¶\",\"para\":\"¶\",\"parallel\":\"∥\",\"parsim\":\"⫳\",\"parsl\":\"⫽\",\"part\":\"∂\",\"pcy\":\"п\",\"percnt\":\"%\",\"period\":\".\",\"permil\":\"‰\",\"perp\":\"⊥\",\"pertenk\":\"‱\",\"pfr\":\"𝔭\",\"phi\":\"φ\",\"phiv\":\"ϕ\",\"phmmat\":\"ℳ\",\"phone\":\"☎\",\"pi\":\"π\",\"pitchfork\":\"⋔\",\"piv\":\"ϖ\",\"planck\":\"ℏ\",\"planckh\":\"ℎ\",\"plankv\":\"ℏ\",\"plus\":\"+\",\"plusacir\":\"⨣\",\"plusb\":\"⊞\",\"pluscir\":\"⨢\",\"plusdo\":\"∔\",\"plusdu\":\"⨥\",\"pluse\":\"⩲\",\"plusm\":\"±\",\"plusmn\":\"±\",\"plussim\":\"⨦\",\"plustwo\":\"⨧\",\"pm\":\"±\",\"pointint\":\"⨕\",\"popf\":\"𝕡\",\"poun\":\"£\",\"pound\":\"£\",\"pr\":\"≺\",\"prE\":\"⪳\",\"prap\":\"⪷\",\"prcue\":\"≼\",\"pre\":\"⪯\",\"prec\":\"≺\",\"precapprox\":\"⪷\",\"preccurlyeq\":\"≼\",\"preceq\":\"⪯\",\"precnapprox\":\"⪹\",\"precneqq\":\"⪵\",\"precnsim\":\"⋨\",\"precsim\":\"≾\",\"prime\":\"′\",\"primes\":\"ℙ\",\"prnE\":\"⪵\",\"prnap\":\"⪹\",\"prnsim\":\"⋨\",\"prod\":\"∏\",\"profalar\":\"⌮\",\"profline\":\"⌒\",\"profsurf\":\"⌓\",\"prop\":\"∝\",\"propto\":\"∝\",\"prsim\":\"≾\",\"prurel\":\"⊰\",\"pscr\":\"𝓅\",\"psi\":\"ψ\",\"puncsp\":\" \",\"qfr\":\"𝔮\",\"qint\":\"⨌\",\"qopf\":\"𝕢\",\"qprime\":\"⁗\",\"qscr\":\"𝓆\",\"quaternions\":\"ℍ\",\"quatint\":\"⨖\",\"quest\":\"?\",\"questeq\":\"≟\",\"quo\":\"\\\"\",\"quot\":\"\\\"\",\"rAarr\":\"⇛\",\"rArr\":\"⇒\",\"rAtail\":\"⤜\",\"rBarr\":\"⤏\",\"rHar\":\"⥤\",\"race\":\"∽̱\",\"racute\":\"ŕ\",\"radic\":\"√\",\"raemptyv\":\"⦳\",\"rang\":\"⟩\",\"rangd\":\"⦒\",\"range\":\"⦥\",\"rangle\":\"⟩\",\"raqu\":\"»\",\"raquo\":\"»\",\"rarr\":\"→\",\"rarrap\":\"⥵\",\"rarrb\":\"⇥\",\"rarrbfs\":\"⤠\",\"rarrc\":\"⤳\",\"rarrfs\":\"⤞\",\"rarrhk\":\"↪\",\"rarrlp\":\"↬\",\"rarrpl\":\"⥅\",\"rarrsim\":\"⥴\",\"rarrtl\":\"↣\",\"rarrw\":\"↝\",\"ratail\":\"⤚\",\"ratio\":\"∶\",\"rationals\":\"ℚ\",\"rbarr\":\"⤍\",\"rbbrk\":\"❳\",\"rbrace\":\"}\",\"rbrack\":\"]\",\"rbrke\":\"⦌\",\"rbrksld\":\"⦎\",\"rbrkslu\":\"⦐\",\"rcaron\":\"ř\",\"rcedil\":\"ŗ\",\"rceil\":\"⌉\",\"rcub\":\"}\",\"rcy\":\"р\",\"rdca\":\"⤷\",\"rdldhar\":\"⥩\",\"rdquo\":\"”\",\"rdquor\":\"”\",\"rdsh\":\"↳\",\"real\":\"ℜ\",\"realine\":\"ℛ\",\"realpart\":\"ℜ\",\"reals\":\"ℝ\",\"rect\":\"▭\",\"re\":\"®\",\"reg\":\"®\",\"rfisht\":\"⥽\",\"rfloor\":\"⌋\",\"rfr\":\"𝔯\",\"rhard\":\"⇁\",\"rharu\":\"⇀\",\"rharul\":\"⥬\",\"rho\":\"ρ\",\"rhov\":\"ϱ\",\"rightarrow\":\"→\",\"rightarrowtail\":\"↣\",\"rightharpoondown\":\"⇁\",\"rightharpoonup\":\"⇀\",\"rightleftarrows\":\"⇄\",\"rightleftharpoons\":\"⇌\",\"rightrightarrows\":\"⇉\",\"rightsquigarrow\":\"↝\",\"rightthreetimes\":\"⋌\",\"ring\":\"˚\",\"risingdotseq\":\"≓\",\"rlarr\":\"⇄\",\"rlhar\":\"⇌\",\"rlm\":\"‏\",\"rmoust\":\"⎱\",\"rmoustache\":\"⎱\",\"rnmid\":\"⫮\",\"roang\":\"⟭\",\"roarr\":\"⇾\",\"robrk\":\"⟧\",\"ropar\":\"⦆\",\"ropf\":\"𝕣\",\"roplus\":\"⨮\",\"rotimes\":\"⨵\",\"rpar\":\")\",\"rpargt\":\"⦔\",\"rppolint\":\"⨒\",\"rrarr\":\"⇉\",\"rsaquo\":\"›\",\"rscr\":\"𝓇\",\"rsh\":\"↱\",\"rsqb\":\"]\",\"rsquo\":\"’\",\"rsquor\":\"’\",\"rthree\":\"⋌\",\"rtimes\":\"⋊\",\"rtri\":\"▹\",\"rtrie\":\"⊵\",\"rtrif\":\"▸\",\"rtriltri\":\"⧎\",\"ruluhar\":\"⥨\",\"rx\":\"℞\",\"sacute\":\"ś\",\"sbquo\":\"‚\",\"sc\":\"≻\",\"scE\":\"⪴\",\"scap\":\"⪸\",\"scaron\":\"š\",\"sccue\":\"≽\",\"sce\":\"⪰\",\"scedil\":\"ş\",\"scirc\":\"ŝ\",\"scnE\":\"⪶\",\"scnap\":\"⪺\",\"scnsim\":\"⋩\",\"scpolint\":\"⨓\",\"scsim\":\"≿\",\"scy\":\"с\",\"sdot\":\"⋅\",\"sdotb\":\"⊡\",\"sdote\":\"⩦\",\"seArr\":\"⇘\",\"searhk\":\"⤥\",\"searr\":\"↘\",\"searrow\":\"↘\",\"sec\":\"§\",\"sect\":\"§\",\"semi\":\";\",\"seswar\":\"⤩\",\"setminus\":\"∖\",\"setmn\":\"∖\",\"sext\":\"✶\",\"sfr\":\"𝔰\",\"sfrown\":\"⌢\",\"sharp\":\"♯\",\"shchcy\":\"щ\",\"shcy\":\"ш\",\"shortmid\":\"∣\",\"shortparallel\":\"∥\",\"sh\":\"­\",\"shy\":\"­\",\"sigma\":\"σ\",\"sigmaf\":\"ς\",\"sigmav\":\"ς\",\"sim\":\"∼\",\"simdot\":\"⩪\",\"sime\":\"≃\",\"simeq\":\"≃\",\"simg\":\"⪞\",\"simgE\":\"⪠\",\"siml\":\"⪝\",\"simlE\":\"⪟\",\"simne\":\"≆\",\"simplus\":\"⨤\",\"simrarr\":\"⥲\",\"slarr\":\"←\",\"smallsetminus\":\"∖\",\"smashp\":\"⨳\",\"smeparsl\":\"⧤\",\"smid\":\"∣\",\"smile\":\"⌣\",\"smt\":\"⪪\",\"smte\":\"⪬\",\"smtes\":\"⪬︀\",\"softcy\":\"ь\",\"sol\":\"/\",\"solb\":\"⧄\",\"solbar\":\"⌿\",\"sopf\":\"𝕤\",\"spades\":\"♠\",\"spadesuit\":\"♠\",\"spar\":\"∥\",\"sqcap\":\"⊓\",\"sqcaps\":\"⊓︀\",\"sqcup\":\"⊔\",\"sqcups\":\"⊔︀\",\"sqsub\":\"⊏\",\"sqsube\":\"⊑\",\"sqsubset\":\"⊏\",\"sqsubseteq\":\"⊑\",\"sqsup\":\"⊐\",\"sqsupe\":\"⊒\",\"sqsupset\":\"⊐\",\"sqsupseteq\":\"⊒\",\"squ\":\"□\",\"square\":\"□\",\"squarf\":\"▪\",\"squf\":\"▪\",\"srarr\":\"→\",\"sscr\":\"𝓈\",\"ssetmn\":\"∖\",\"ssmile\":\"⌣\",\"sstarf\":\"⋆\",\"star\":\"☆\",\"starf\":\"★\",\"straightepsilon\":\"ϵ\",\"straightphi\":\"ϕ\",\"strns\":\"¯\",\"sub\":\"⊂\",\"subE\":\"⫅\",\"subdot\":\"⪽\",\"sube\":\"⊆\",\"subedot\":\"⫃\",\"submult\":\"⫁\",\"subnE\":\"⫋\",\"subne\":\"⊊\",\"subplus\":\"⪿\",\"subrarr\":\"⥹\",\"subset\":\"⊂\",\"subseteq\":\"⊆\",\"subseteqq\":\"⫅\",\"subsetneq\":\"⊊\",\"subsetneqq\":\"⫋\",\"subsim\":\"⫇\",\"subsub\":\"⫕\",\"subsup\":\"⫓\",\"succ\":\"≻\",\"succapprox\":\"⪸\",\"succcurlyeq\":\"≽\",\"succeq\":\"⪰\",\"succnapprox\":\"⪺\",\"succneqq\":\"⪶\",\"succnsim\":\"⋩\",\"succsim\":\"≿\",\"sum\":\"∑\",\"sung\":\"♪\",\"sup\":\"⊃\",\"sup1\":\"¹\",\"sup2\":\"²\",\"sup3\":\"³\",\"supE\":\"⫆\",\"supdot\":\"⪾\",\"supdsub\":\"⫘\",\"supe\":\"⊇\",\"supedot\":\"⫄\",\"suphsol\":\"⟉\",\"suphsub\":\"⫗\",\"suplarr\":\"⥻\",\"supmult\":\"⫂\",\"supnE\":\"⫌\",\"supne\":\"⊋\",\"supplus\":\"⫀\",\"supset\":\"⊃\",\"supseteq\":\"⊇\",\"supseteqq\":\"⫆\",\"supsetneq\":\"⊋\",\"supsetneqq\":\"⫌\",\"supsim\":\"⫈\",\"supsub\":\"⫔\",\"supsup\":\"⫖\",\"swArr\":\"⇙\",\"swarhk\":\"⤦\",\"swarr\":\"↙\",\"swarrow\":\"↙\",\"swnwar\":\"⤪\",\"szli\":\"ß\",\"szlig\":\"ß\",\"target\":\"⌖\",\"tau\":\"τ\",\"tbrk\":\"⎴\",\"tcaron\":\"ť\",\"tcedil\":\"ţ\",\"tcy\":\"т\",\"tdot\":\"⃛\",\"telrec\":\"⌕\",\"tfr\":\"𝔱\",\"there4\":\"∴\",\"therefore\":\"∴\",\"theta\":\"θ\",\"thetasym\":\"ϑ\",\"thetav\":\"ϑ\",\"thickapprox\":\"≈\",\"thicksim\":\"∼\",\"thinsp\":\" \",\"thkap\":\"≈\",\"thksim\":\"∼\",\"thor\":\"þ\",\"thorn\":\"þ\",\"tilde\":\"˜\",\"time\":\"×\",\"times\":\"×\",\"timesb\":\"⊠\",\"timesbar\":\"⨱\",\"timesd\":\"⨰\",\"tint\":\"∭\",\"toea\":\"⤨\",\"top\":\"⊤\",\"topbot\":\"⌶\",\"topcir\":\"⫱\",\"topf\":\"𝕥\",\"topfork\":\"⫚\",\"tosa\":\"⤩\",\"tprime\":\"‴\",\"trade\":\"™\",\"triangle\":\"▵\",\"triangledown\":\"▿\",\"triangleleft\":\"◃\",\"trianglelefteq\":\"⊴\",\"triangleq\":\"≜\",\"triangleright\":\"▹\",\"trianglerighteq\":\"⊵\",\"tridot\":\"◬\",\"trie\":\"≜\",\"triminus\":\"⨺\",\"triplus\":\"⨹\",\"trisb\":\"⧍\",\"tritime\":\"⨻\",\"trpezium\":\"⏢\",\"tscr\":\"𝓉\",\"tscy\":\"ц\",\"tshcy\":\"ћ\",\"tstrok\":\"ŧ\",\"twixt\":\"≬\",\"twoheadleftarrow\":\"↞\",\"twoheadrightarrow\":\"↠\",\"uArr\":\"⇑\",\"uHar\":\"⥣\",\"uacut\":\"ú\",\"uacute\":\"ú\",\"uarr\":\"↑\",\"ubrcy\":\"ў\",\"ubreve\":\"ŭ\",\"ucir\":\"û\",\"ucirc\":\"û\",\"ucy\":\"у\",\"udarr\":\"⇅\",\"udblac\":\"ű\",\"udhar\":\"⥮\",\"ufisht\":\"⥾\",\"ufr\":\"𝔲\",\"ugrav\":\"ù\",\"ugrave\":\"ù\",\"uharl\":\"↿\",\"uharr\":\"↾\",\"uhblk\":\"▀\",\"ulcorn\":\"⌜\",\"ulcorner\":\"⌜\",\"ulcrop\":\"⌏\",\"ultri\":\"◸\",\"umacr\":\"ū\",\"um\":\"¨\",\"uml\":\"¨\",\"uogon\":\"ų\",\"uopf\":\"𝕦\",\"uparrow\":\"↑\",\"updownarrow\":\"↕\",\"upharpoonleft\":\"↿\",\"upharpoonright\":\"↾\",\"uplus\":\"⊎\",\"upsi\":\"υ\",\"upsih\":\"ϒ\",\"upsilon\":\"υ\",\"upuparrows\":\"⇈\",\"urcorn\":\"⌝\",\"urcorner\":\"⌝\",\"urcrop\":\"⌎\",\"uring\":\"ů\",\"urtri\":\"◹\",\"uscr\":\"𝓊\",\"utdot\":\"⋰\",\"utilde\":\"ũ\",\"utri\":\"▵\",\"utrif\":\"▴\",\"uuarr\":\"⇈\",\"uum\":\"ü\",\"uuml\":\"ü\",\"uwangle\":\"⦧\",\"vArr\":\"⇕\",\"vBar\":\"⫨\",\"vBarv\":\"⫩\",\"vDash\":\"⊨\",\"vangrt\":\"⦜\",\"varepsilon\":\"ϵ\",\"varkappa\":\"ϰ\",\"varnothing\":\"∅\",\"varphi\":\"ϕ\",\"varpi\":\"ϖ\",\"varpropto\":\"∝\",\"varr\":\"↕\",\"varrho\":\"ϱ\",\"varsigma\":\"ς\",\"varsubsetneq\":\"⊊︀\",\"varsubsetneqq\":\"⫋︀\",\"varsupsetneq\":\"⊋︀\",\"varsupsetneqq\":\"⫌︀\",\"vartheta\":\"ϑ\",\"vartriangleleft\":\"⊲\",\"vartriangleright\":\"⊳\",\"vcy\":\"в\",\"vdash\":\"⊢\",\"vee\":\"∨\",\"veebar\":\"⊻\",\"veeeq\":\"≚\",\"vellip\":\"⋮\",\"verbar\":\"|\",\"vert\":\"|\",\"vfr\":\"𝔳\",\"vltri\":\"⊲\",\"vnsub\":\"⊂⃒\",\"vnsup\":\"⊃⃒\",\"vopf\":\"𝕧\",\"vprop\":\"∝\",\"vrtri\":\"⊳\",\"vscr\":\"𝓋\",\"vsubnE\":\"⫋︀\",\"vsubne\":\"⊊︀\",\"vsupnE\":\"⫌︀\",\"vsupne\":\"⊋︀\",\"vzigzag\":\"⦚\",\"wcirc\":\"ŵ\",\"wedbar\":\"⩟\",\"wedge\":\"∧\",\"wedgeq\":\"≙\",\"weierp\":\"℘\",\"wfr\":\"𝔴\",\"wopf\":\"𝕨\",\"wp\":\"℘\",\"wr\":\"≀\",\"wreath\":\"≀\",\"wscr\":\"𝓌\",\"xcap\":\"⋂\",\"xcirc\":\"◯\",\"xcup\":\"⋃\",\"xdtri\":\"▽\",\"xfr\":\"𝔵\",\"xhArr\":\"⟺\",\"xharr\":\"⟷\",\"xi\":\"ξ\",\"xlArr\":\"⟸\",\"xlarr\":\"⟵\",\"xmap\":\"⟼\",\"xnis\":\"⋻\",\"xodot\":\"⨀\",\"xopf\":\"𝕩\",\"xoplus\":\"⨁\",\"xotime\":\"⨂\",\"xrArr\":\"⟹\",\"xrarr\":\"⟶\",\"xscr\":\"𝓍\",\"xsqcup\":\"⨆\",\"xuplus\":\"⨄\",\"xutri\":\"△\",\"xvee\":\"⋁\",\"xwedge\":\"⋀\",\"yacut\":\"ý\",\"yacute\":\"ý\",\"yacy\":\"я\",\"ycirc\":\"ŷ\",\"ycy\":\"ы\",\"ye\":\"¥\",\"yen\":\"¥\",\"yfr\":\"𝔶\",\"yicy\":\"ї\",\"yopf\":\"𝕪\",\"yscr\":\"𝓎\",\"yucy\":\"ю\",\"yum\":\"ÿ\",\"yuml\":\"ÿ\",\"zacute\":\"ź\",\"zcaron\":\"ž\",\"zcy\":\"з\",\"zdot\":\"ż\",\"zeetrf\":\"ℨ\",\"zeta\":\"ζ\",\"zfr\":\"𝔷\",\"zhcy\":\"ж\",\"zigrarr\":\"⇝\",\"zopf\":\"𝕫\",\"zscr\":\"𝓏\",\"zwj\":\"‍\",\"zwnj\":\"‌\"}"); - /***/ - }, +/***/ }), - /***/ 2357: /***/ (module) => { - 'use strict'; - module.exports = require('assert'); +/***/ 9499: +/***/ ((module) => { - /***/ - }, +"use strict"; +module.exports = {"i8":"3.1.5"}; - /***/ 4293: /***/ (module) => { - 'use strict'; - module.exports = require('buffer'); +/***/ }), - /***/ - }, +/***/ 2357: +/***/ ((module) => { - /***/ 3129: /***/ (module) => { - 'use strict'; - module.exports = require('child_process'); +"use strict"; +module.exports = require("assert");; - /***/ - }, +/***/ }), - /***/ 881: /***/ (module) => { - 'use strict'; - module.exports = require('dns'); +/***/ 4293: +/***/ ((module) => { - /***/ - }, +"use strict"; +module.exports = require("buffer");; - /***/ 8614: /***/ (module) => { - 'use strict'; - module.exports = require('events'); +/***/ }), - /***/ - }, +/***/ 3129: +/***/ ((module) => { - /***/ 5747: /***/ (module) => { - 'use strict'; - module.exports = require('fs'); +"use strict"; +module.exports = require("child_process");; - /***/ - }, +/***/ }), - /***/ 9225: /***/ (module) => { - 'use strict'; - module.exports = require('fs/promises'); +/***/ 881: +/***/ ((module) => { - /***/ - }, +"use strict"; +module.exports = require("dns");; - /***/ 8605: /***/ (module) => { - 'use strict'; - module.exports = require('http'); +/***/ }), - /***/ - }, +/***/ 8614: +/***/ ((module) => { - /***/ 7565: /***/ (module) => { - 'use strict'; - module.exports = require('http2'); +"use strict"; +module.exports = require("events");; - /***/ - }, +/***/ }), - /***/ 7211: /***/ (module) => { - 'use strict'; - module.exports = require('https'); +/***/ 5747: +/***/ ((module) => { - /***/ - }, +"use strict"; +module.exports = require("fs");; - /***/ 1631: /***/ (module) => { - 'use strict'; - module.exports = require('net'); +/***/ }), - /***/ - }, +/***/ 9225: +/***/ ((module) => { - /***/ 2087: /***/ (module) => { - 'use strict'; - module.exports = require('os'); +"use strict"; +module.exports = require("fs/promises");; - /***/ - }, +/***/ }), - /***/ 5622: /***/ (module) => { - 'use strict'; - module.exports = require('path'); +/***/ 8605: +/***/ ((module) => { - /***/ - }, +"use strict"; +module.exports = require("http");; - /***/ 2413: /***/ (module) => { - 'use strict'; - module.exports = require('stream'); +/***/ }), - /***/ - }, +/***/ 7565: +/***/ ((module) => { - /***/ 4016: /***/ (module) => { - 'use strict'; - module.exports = require('tls'); +"use strict"; +module.exports = require("http2");; - /***/ - }, +/***/ }), - /***/ 8835: /***/ (module) => { - 'use strict'; - module.exports = require('url'); +/***/ 7211: +/***/ ((module) => { - /***/ - }, +"use strict"; +module.exports = require("https");; - /***/ 1669: /***/ (module) => { - 'use strict'; - module.exports = require('util'); +/***/ }), - /***/ - }, +/***/ 1631: +/***/ ((module) => { - /***/ 8761: /***/ (module) => { - 'use strict'; - module.exports = require('zlib'); +"use strict"; +module.exports = require("net");; - /***/ - }, +/***/ }), - /******/ - }; // The module cache - /************************************************************************/ - /******/ /******/ var __webpack_module_cache__ = {}; // The require function - /******/ - /******/ /******/ function __nccwpck_require__(moduleId) { - /******/ // Check if module is in cache - /******/ if (__webpack_module_cache__[moduleId]) { - /******/ return __webpack_module_cache__[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (__webpack_module_cache__[moduleId] = { - /******/ // no module.id needed - /******/ // no module.loaded needed - /******/ exports: {}, - /******/ - }); // Execute the module function - /******/ - /******/ /******/ var threw = true; - /******/ try { - /******/ __webpack_modules__[moduleId].call( - module.exports, - module, - module.exports, - __nccwpck_require__ - ); - /******/ threw = false; - /******/ - } finally { - /******/ if (threw) delete __webpack_module_cache__[moduleId]; - /******/ - } // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } /* webpack/runtime/compat */ - /******/ - /************************************************************************/ - /******/ /******/ - /******/ __nccwpck_require__.ab = - __dirname + - '/'; /************************************************************************/ // module exports must be returned from runtime so entry inlining is disabled // startup // Load entry module and return exports - /******/ /******/ /******/ /******/ return __nccwpck_require__(6144); - /******/ -})(); +/***/ 2087: +/***/ ((module) => { + +"use strict"; +module.exports = require("os");; + +/***/ }), + +/***/ 5622: +/***/ ((module) => { + +"use strict"; +module.exports = require("path");; + +/***/ }), + +/***/ 2413: +/***/ ((module) => { + +"use strict"; +module.exports = require("stream");; + +/***/ }), + +/***/ 4016: +/***/ ((module) => { + +"use strict"; +module.exports = require("tls");; + +/***/ }), + +/***/ 8835: +/***/ ((module) => { + +"use strict"; +module.exports = require("url");; + +/***/ }), + +/***/ 1669: +/***/ ((module) => { + +"use strict"; +module.exports = require("util");; + +/***/ }), + +/***/ 8761: +/***/ ((module) => { + +"use strict"; +module.exports = require("zlib");; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ // startup +/******/ // Load entry module and return exports +/******/ return __nccwpck_require__(6144); +/******/ })() +; \ No newline at end of file