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MzM,EAAU7C,KAAK6C,QAAQuM,EAAeC,EAAwBC,GAIpE,OAFAzM,EAAQgN,WAAQ/I,EAETjE,CACT,CA4DA,OAAAA,CAAQuM,EAAeC,EAAwBC,GAC7C,MAAMzM,EAAU,IAAI,IAElBuM,EACAC,EACAC,GAYF,OATItP,KAAKqQ,OACPxN,EAAQD,KAAO5C,KAAKqQ,KAAO,IAAMxN,EAAQD,KACzCC,EAAQ4G,KAAOzJ,KAAKqQ,MAGtBxN,EAAQgN,OAAQ,EAEhB7P,KAAK8S,SAAS7Q,KAAKY,GAEZA,CACT,CAeA,QAAAI,CAASqQ,GACP,QAAmBxM,IAAf9G,KAAKM,MACP,MAAO,GAGT,GAA0B,kBAAfN,KAAKM,MACd,OAAON,KAAKM,MAId,OADgB,IAAIiT,YAAYD,QAAYxM,GAC7B0M,OAAOxT,KAAKM,MAC7B,EAaF,SAAS4S,EAAWO,EAAM7Q,GACxB,GAAI6Q,GAAQA,EAAKlQ,SAAS4M,EAAQwB,KAChC,MAAM,IAAInK,MACR,IAAM5E,EAAO,uCAAyCuN,EAAQwB,IAAM,IAG1E,CAYA,SAASsB,EAAeQ,EAAM7Q,GAC5B,IAAK6Q,EACH,MAAM,IAAIjM,MAAM,IAAM5E,EAAO,oBAEjC,CAYA,SAAS,EAAWyN,EAAMzN,GACxB,IAAKyN,EACH,MAAM,IAAI7I,MAAM,YAAc5E,EAAO,kCAEzC,C","sources":["webpack://artfully-walls/./node_modules/style-to-object/cjs/index.js","webpack://artfully-walls/./node_modules/@ungap/structured-clone/esm/types.js","webpack://artfully-walls/./node_modules/@ungap/structured-clone/esm/deserialize.js","webpack://artfully-walls/./node_modules/@ungap/structured-clone/esm/serialize.js","webpack://artfully-walls/./node_modules/@ungap/structured-clone/esm/index.js","webpack://artfully-walls/./node_modules/space-separated-tokens/index.js","webpack://artfully-walls/./node_modules/style-to-object/esm/index.mjs","webpack://artfully-walls/./node_modules/trim-lines/index.js","webpack://artfully-walls/./node_modules/unified/node_modules/is-plain-obj/index.js","webpack://artfully-walls/./node_modules/trough/lib/index.js","webpack://artfully-walls/./node_modules/unified/lib/callable-instance.js","webpack://artfully-walls/./node_modules/unified/lib/index.js","webpack://artfully-walls/./node_modules/unist-util-position/lib/index.js","webpack://artfully-walls/./node_modules/unist-util-stringify-position/lib/index.js","webpack://artfully-walls/./node_modules/unist-util-is/lib/index.js","webpack://artfully-walls/./node_modules/unist-util-visit-parents/lib/index.js","webpack://artfully-walls/./node_modules/unist-util-visit/lib/index.js","webpack://artfully-walls/./node_modules/vfile-message/lib/index.js","webpack://artfully-walls/./node_modules/vfile/lib/minpath.browser.js","webpack://artfully-walls/./node_modules/vfile/lib/minproc.browser.js","webpack://artfully-walls/./node_modules/vfile/lib/minurl.shared.js","webpack://artfully-walls/./node_modules/vfile/lib/minurl.browser.js","webpack://artfully-walls/./node_modules/vfile/lib/index.js"],"sourcesContent":["\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = StyleToObject;\nvar inline_style_parser_1 = __importDefault(require(\"inline-style-parser\"));\n/**\n * Parses inline style to object.\n *\n * @param style - Inline style.\n * @param iterator - Iterator.\n * @returns - Style object or null.\n *\n * @example Parsing inline style to object:\n *\n * ```js\n * import parse from 'style-to-object';\n * parse('line-height: 42;'); // { 'line-height': '42' }\n * ```\n */\nfunction StyleToObject(style, iterator) {\n var styleObject = null;\n if (!style || typeof style !== 'string') {\n return styleObject;\n }\n var declarations = (0, inline_style_parser_1.default)(style);\n var hasIterator = typeof iterator === 'function';\n declarations.forEach(function (declaration) {\n if (declaration.type !== 'declaration') {\n return;\n }\n var property = declaration.property, value = declaration.value;\n if (hasIterator) {\n iterator(property, value, declaration);\n }\n else if (value) {\n styleObject = styleObject || {};\n styleObject[property] = value;\n }\n });\n return styleObject;\n}\n//# sourceMappingURL=index.js.map","export const VOID = -1;\nexport const PRIMITIVE = 0;\nexport const ARRAY = 1;\nexport const OBJECT = 2;\nexport const DATE = 3;\nexport const REGEXP = 4;\nexport const MAP = 5;\nexport const SET = 6;\nexport const ERROR = 7;\nexport const BIGINT = 8;\n// export const SYMBOL = 9;\n","import {\n VOID, PRIMITIVE,\n ARRAY, OBJECT,\n DATE, REGEXP, MAP, SET,\n ERROR, BIGINT\n} from './types.js';\n\nconst env = typeof self === 'object' ? self : globalThis;\n\nconst deserializer = ($, _) => {\n const as = (out, index) => {\n $.set(index, out);\n return out;\n };\n\n const unpair = index => {\n if ($.has(index))\n return $.get(index);\n\n const [type, value] = _[index];\n switch (type) {\n case PRIMITIVE:\n case VOID:\n return as(value, index);\n case ARRAY: {\n const arr = as([], index);\n for (const index of value)\n arr.push(unpair(index));\n return arr;\n }\n case OBJECT: {\n const object = as({}, index);\n for (const [key, index] of value)\n object[unpair(key)] = unpair(index);\n return object;\n }\n case DATE:\n return as(new Date(value), index);\n case REGEXP: {\n const {source, flags} = value;\n return as(new RegExp(source, flags), index);\n }\n case MAP: {\n const map = as(new Map, index);\n for (const [key, index] of value)\n map.set(unpair(key), unpair(index));\n return map;\n }\n case SET: {\n const set = as(new Set, index);\n for (const index of value)\n set.add(unpair(index));\n return set;\n }\n case ERROR: {\n const {name, message} = value;\n return as(new env[name](message), index);\n }\n case BIGINT:\n return as(BigInt(value), index);\n case 'BigInt':\n return as(Object(BigInt(value)), index);\n }\n return as(new env[type](value), index);\n };\n\n return unpair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns a deserialized value from a serialized array of Records.\n * @param {Record[]} serialized a previously serialized value.\n * @returns {any}\n */\nexport const deserialize = serialized => deserializer(new Map, serialized)(0);\n","import {\n VOID, PRIMITIVE,\n ARRAY, OBJECT,\n DATE, REGEXP, MAP, SET,\n ERROR, BIGINT\n} from './types.js';\n\nconst EMPTY = '';\n\nconst {toString} = {};\nconst {keys} = Object;\n\nconst typeOf = value => {\n const type = typeof value;\n if (type !== 'object' || !value)\n return [PRIMITIVE, type];\n\n const asString = toString.call(value).slice(8, -1);\n switch (asString) {\n case 'Array':\n return [ARRAY, EMPTY];\n case 'Object':\n return [OBJECT, EMPTY];\n case 'Date':\n return [DATE, EMPTY];\n case 'RegExp':\n return [REGEXP, EMPTY];\n case 'Map':\n return [MAP, EMPTY];\n case 'Set':\n return [SET, EMPTY];\n }\n\n if (asString.includes('Array'))\n return [ARRAY, asString];\n\n if (asString.includes('Error'))\n return [ERROR, asString];\n\n return [OBJECT, asString];\n};\n\nconst shouldSkip = ([TYPE, type]) => (\n TYPE === PRIMITIVE &&\n (type === 'function' || type === 'symbol')\n);\n\nconst serializer = (strict, json, $, _) => {\n\n const as = (out, value) => {\n const index = _.push(out) - 1;\n $.set(value, index);\n return index;\n };\n\n const pair = value => {\n if ($.has(value))\n return $.get(value);\n\n let [TYPE, type] = typeOf(value);\n switch (TYPE) {\n case PRIMITIVE: {\n let entry = value;\n switch (type) {\n case 'bigint':\n TYPE = BIGINT;\n entry = value.toString();\n break;\n case 'function':\n case 'symbol':\n if (strict)\n throw new TypeError('unable to serialize ' + type);\n entry = null;\n break;\n case 'undefined':\n return as([VOID], value);\n }\n return as([TYPE, entry], value);\n }\n case ARRAY: {\n if (type)\n return as([type, [...value]], value);\n \n const arr = [];\n const index = as([TYPE, arr], value);\n for (const entry of value)\n arr.push(pair(entry));\n return index;\n }\n case OBJECT: {\n if (type) {\n switch (type) {\n case 'BigInt':\n return as([type, value.toString()], value);\n case 'Boolean':\n case 'Number':\n case 'String':\n return as([type, value.valueOf()], value);\n }\n }\n\n if (json && ('toJSON' in value))\n return pair(value.toJSON());\n\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const key of keys(value)) {\n if (strict || !shouldSkip(typeOf(value[key])))\n entries.push([pair(key), pair(value[key])]);\n }\n return index;\n }\n case DATE:\n return as([TYPE, value.toISOString()], value);\n case REGEXP: {\n const {source, flags} = value;\n return as([TYPE, {source, flags}], value);\n }\n case MAP: {\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const [key, entry] of value) {\n if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))\n entries.push([pair(key), pair(entry)]);\n }\n return index;\n }\n case SET: {\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const entry of value) {\n if (strict || !shouldSkip(typeOf(entry)))\n entries.push(pair(entry));\n }\n return index;\n }\n }\n\n const {message} = value;\n return as([TYPE, {name: type, message}], value);\n };\n\n return pair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} value a serializable value.\n * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that,\n * if `true`, will not throw errors on incompatible types, and behave more\n * like JSON stringify would behave. Symbol and Function will be discarded.\n * @returns {Record[]}\n */\n export const serialize = (value, {json, lossy} = {}) => {\n const _ = [];\n return serializer(!(json || lossy), !!json, new Map, _)(value), _;\n};\n","import {deserialize} from './deserialize.js';\nimport {serialize} from './serialize.js';\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} any a serializable value.\n * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with\n * a transfer option (ignored when polyfilled) and/or non standard fields that\n * fallback to the polyfill if present.\n * @returns {Record[]}\n */\nexport default typeof structuredClone === \"function\" ?\n /* c8 ignore start */\n (any, options) => (\n options && ('json' in options || 'lossy' in options) ?\n deserialize(serialize(any, options)) : structuredClone(any)\n ) :\n (any, options) => deserialize(serialize(any, options));\n /* c8 ignore stop */\n\nexport {deserialize, serialize};\n","/**\n * Parse space-separated tokens to an array of strings.\n *\n * @param {string} value\n * Space-separated tokens.\n * @returns {Array}\n * List of tokens.\n */\nexport function parse(value) {\n const input = String(value || '').trim()\n return input ? input.split(/[ \\t\\n\\r\\f]+/g) : []\n}\n\n/**\n * Serialize an array of strings as space separated-tokens.\n *\n * @param {Array} values\n * List of tokens.\n * @returns {string}\n * Space-separated tokens.\n */\nexport function stringify(values) {\n return values.join(' ').trim()\n}\n","import StyleToObject from '../cjs/index.js';\n\n// ensure compatibility with rollup umd build\nexport default StyleToObject.default || StyleToObject;\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Trimmed value.\n */\nexport function trimLines(value) {\n const source = String(value)\n const search = /\\r?\\n|\\r/g\n let match = search.exec(source)\n let last = 0\n /** @type {Array} */\n const lines = []\n\n while (match) {\n lines.push(\n trimLine(source.slice(last, match.index), last > 0, true),\n match[0]\n )\n\n last = match.index + match[0].length\n match = search.exec(source)\n }\n\n lines.push(trimLine(source.slice(last), last > 0, false))\n\n return lines.join('')\n}\n\n/**\n * @param {string} value\n * Line to trim.\n * @param {boolean} start\n * Whether to trim the start of the line.\n * @param {boolean} end\n * Whether to trim the end of the line.\n * @returns {string}\n * Trimmed line.\n */\nfunction trimLine(value, start, end) {\n let startIndex = 0\n let endIndex = value.length\n\n if (start) {\n let code = value.codePointAt(startIndex)\n\n while (code === tab || code === space) {\n startIndex++\n code = value.codePointAt(startIndex)\n }\n }\n\n if (end) {\n let code = value.codePointAt(endIndex - 1)\n\n while (code === tab || code === space) {\n endIndex--\n code = value.codePointAt(endIndex - 1)\n }\n }\n\n return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","export const CallableInstance =\n /**\n * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin, any, any> |\n * PluginTuple, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// .\n/**\n * @template {Array} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback} next\n * Callback.\n * @returns {(\n * Promise |\n * Promise | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : // Unknown.\n * Processor\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback> | undefined} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor}\n *\n * @overload\n * @param {Plugin} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Get the ending point of `node`.\n *\n * @param node\n * Node.\n * @returns\n * Point.\n */\nexport const pointEnd = point('end')\n\n/**\n * Get the starting point of `node`.\n *\n * @param node\n * Node.\n * @returns\n * Point.\n */\nexport const pointStart = point('start')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'end' | 'start'} type\n * Side.\n * @returns\n * Getter.\n */\nfunction point(type) {\n return point\n\n /**\n * Get the point info of `node` at a bound side.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n * @returns {Point | undefined}\n */\n function point(node) {\n const point = (node && node.position && node.position[type]) || {}\n\n if (\n typeof point.line === 'number' &&\n point.line > 0 &&\n typeof point.column === 'number' &&\n point.column > 0\n ) {\n return {\n line: point.line,\n column: point.column,\n offset:\n typeof point.offset === 'number' && point.offset > -1\n ? point.offset\n : undefined\n }\n }\n }\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n * Node.\n * @returns {Position | undefined}\n * Position.\n */\nexport function position(node) {\n const start = pointStart(node)\n const end = pointEnd(node)\n\n if (start && end) {\n return {start, end}\n }\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]\n * Node, position, or point.\n * @returns {string}\n * Pretty printed positional info of a node (`string`).\n *\n * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n * or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n * column, `s` for `start`, and `e` for end.\n * An empty string (`''`) is returned if the given value is neither `node`,\n * `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n // Nothing.\n if (!value || typeof value !== 'object') {\n return ''\n }\n\n // Node.\n if ('position' in value || 'type' in value) {\n return position(value.position)\n }\n\n // Position.\n if ('start' in value || 'end' in value) {\n return position(value)\n }\n\n // Point.\n if ('line' in value || 'column' in value) {\n return point(value)\n }\n\n // ?\n return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propsFactory(check) {\n const checkAsRecord = /** @type {Record} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n */\n\n/**\n * @typedef {Exclude | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate extends Value\n * ? Predicate\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array\n * ? MatchesOne\n * : MatchesOne\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent\n * | InternalAncestor, Max, Increment>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor, Check>, Ancestor, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly} */\n let result = empty\n /** @type {Readonly} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * @typedef {Exclude | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate extends Value\n * ? Predicate\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array\n * ? MatchesOne\n * : MatchesOne\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent\n * | InternalAncestor, Max, Increment>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform `parent`.\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of `parent` still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n * Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n * Parent of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor>} BuildVisitorFromMatch\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n * Node type.\n * @template {UnistParent} Ancestor\n * Parent type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromMatch<\n * Matches,\n * Extract\n * >\n * )} BuildVisitorFromDescendants\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n * Node type.\n * @template {Test} Check\n * Test type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromDescendants<\n * InclusiveDescendant,\n * Check\n * >\n * )} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n * Node type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n * `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n * Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n /** @type {boolean | null | undefined} */\n let reverse\n /** @type {Test} */\n let test\n /** @type {Visitor} */\n let visitor\n\n if (\n typeof testOrVisitor === 'function' &&\n typeof visitorOrReverse !== 'function'\n ) {\n test = undefined\n visitor = testOrVisitor\n reverse = visitorOrReverse\n } else {\n // @ts-expect-error: assume the overload with test was given.\n test = testOrVisitor\n // @ts-expect-error: assume the overload with test was given.\n visitor = visitorOrReverse\n reverse = maybeReverse\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {UnistNode} node\n * @param {Array} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n const index = parent ? parent.children.indexOf(node) : undefined\n return visitor(node, index, parent)\n }\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n *\n * @typedef Options\n * Configuration.\n * @property {Array | null | undefined} [ancestors]\n * Stack of (inclusive) ancestor nodes surrounding the message (optional).\n * @property {Error | null | undefined} [cause]\n * Original error cause of the message (optional).\n * @property {Point | Position | null | undefined} [place]\n * Place of message (optional).\n * @property {string | null | undefined} [ruleId]\n * Category of message (optional, example: `'my-rule'`).\n * @property {string | null | undefined} [source]\n * Namespace of who sent the message (optional, example: `'my-package'`).\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\n/**\n * Message.\n */\nexport class VFileMessage extends Error {\n /**\n * Create a message for `reason`.\n *\n * > đŸȘŠ **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {Options | null | undefined} [options]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns\n * Instance of `VFileMessage`.\n */\n // eslint-disable-next-line complexity\n constructor(causeOrReason, optionsOrParentOrPlace, origin) {\n super()\n\n if (typeof optionsOrParentOrPlace === 'string') {\n origin = optionsOrParentOrPlace\n optionsOrParentOrPlace = undefined\n }\n\n /** @type {string} */\n let reason = ''\n /** @type {Options} */\n let options = {}\n let legacyCause = false\n\n if (optionsOrParentOrPlace) {\n // Point.\n if (\n 'line' in optionsOrParentOrPlace &&\n 'column' in optionsOrParentOrPlace\n ) {\n options = {place: optionsOrParentOrPlace}\n }\n // Position.\n else if (\n 'start' in optionsOrParentOrPlace &&\n 'end' in optionsOrParentOrPlace\n ) {\n options = {place: optionsOrParentOrPlace}\n }\n // Node.\n else if ('type' in optionsOrParentOrPlace) {\n options = {\n ancestors: [optionsOrParentOrPlace],\n place: optionsOrParentOrPlace.position\n }\n }\n // Options.\n else {\n options = {...optionsOrParentOrPlace}\n }\n }\n\n if (typeof causeOrReason === 'string') {\n reason = causeOrReason\n }\n // Error.\n else if (!options.cause && causeOrReason) {\n legacyCause = true\n reason = causeOrReason.message\n options.cause = causeOrReason\n }\n\n if (!options.ruleId && !options.source && typeof origin === 'string') {\n const index = origin.indexOf(':')\n\n if (index === -1) {\n options.ruleId = origin\n } else {\n options.source = origin.slice(0, index)\n options.ruleId = origin.slice(index + 1)\n }\n }\n\n if (!options.place && options.ancestors && options.ancestors) {\n const parent = options.ancestors[options.ancestors.length - 1]\n\n if (parent) {\n options.place = parent.position\n }\n }\n\n const start =\n options.place && 'start' in options.place\n ? options.place.start\n : options.place\n\n /* eslint-disable no-unused-expressions */\n /**\n * Stack of ancestor nodes surrounding the message.\n *\n * @type {Array | undefined}\n */\n this.ancestors = options.ancestors || undefined\n\n /**\n * Original error cause of the message.\n *\n * @type {Error | undefined}\n */\n this.cause = options.cause || undefined\n\n /**\n * Starting column of message.\n *\n * @type {number | undefined}\n */\n this.column = start ? start.column : undefined\n\n /**\n * State of problem.\n *\n * * `true` — error, file not usable\n * * `false` — warning, change may be needed\n * * `undefined` — change likely not needed\n *\n * @type {boolean | null | undefined}\n */\n this.fatal = undefined\n\n /**\n * Path of a file (used throughout the `VFile` ecosystem).\n *\n * @type {string | undefined}\n */\n this.file\n\n // Field from `Error`.\n /**\n * Reason for message.\n *\n * @type {string}\n */\n this.message = reason\n\n /**\n * Starting line of error.\n *\n * @type {number | undefined}\n */\n this.line = start ? start.line : undefined\n\n // Field from `Error`.\n /**\n * Serialized positional info of message.\n *\n * On normal errors, this would be something like `ParseError`, buit in\n * `VFile` messages we use this space to show where an error happened.\n */\n this.name = stringifyPosition(options.place) || '1:1'\n\n /**\n * Place of message.\n *\n * @type {Point | Position | undefined}\n */\n this.place = options.place || undefined\n\n /**\n * Reason for message, should use markdown.\n *\n * @type {string}\n */\n this.reason = this.message\n\n /**\n * Category of message (example: `'my-rule'`).\n *\n * @type {string | undefined}\n */\n this.ruleId = options.ruleId || undefined\n\n /**\n * Namespace of message (example: `'my-package'`).\n *\n * @type {string | undefined}\n */\n this.source = options.source || undefined\n\n // Field from `Error`.\n /**\n * Stack of message.\n *\n * This is used by normal errors to show where something happened in\n * programming code, irrelevant for `VFile` messages,\n *\n * @type {string}\n */\n this.stack =\n legacyCause && options.cause && typeof options.cause.stack === 'string'\n ? options.cause.stack\n : ''\n\n // The following fields are “well known”.\n // Not standard.\n // Feel free to add other non-standard fields to your messages.\n\n /**\n * Specify the source value that’s being reported, which is deemed\n * incorrect.\n *\n * @type {string | undefined}\n */\n this.actual\n\n /**\n * Suggest acceptable values that can be used instead of `actual`.\n *\n * @type {Array | undefined}\n */\n this.expected\n\n /**\n * Long form description of the message (you should use markdown).\n *\n * @type {string | undefined}\n */\n this.note\n\n /**\n * Link to docs for the message.\n *\n * > 👉 **Note**: this must be an absolute URL that can be passed as `x`\n * > to `new URL(x)`.\n *\n * @type {string | undefined}\n */\n this.url\n /* eslint-enable no-unused-expressions */\n }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.column = undefined\nVFileMessage.prototype.line = undefined\nVFileMessage.prototype.ancestors = undefined\nVFileMessage.prototype.cause = undefined\nVFileMessage.prototype.fatal = undefined\nVFileMessage.prototype.place = undefined\nVFileMessage.prototype.ruleId = undefined\nVFileMessage.prototype.source = undefined\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n * File path.\n * @param {string | null | undefined} [extname]\n * Extension to strip.\n * @returns {string}\n * Stem or basename.\n */\nfunction basename(path, extname) {\n if (extname !== undefined && typeof extname !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let seenNonSlash\n\n if (\n extname === undefined ||\n extname.length === 0 ||\n extname.length > path.length\n ) {\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (extname === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extnameIndex = extname.length - 1\n\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extnameIndex > -1) {\n // Try to match the explicit extension.\n if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n if (extnameIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extnameIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.codePointAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.codePointAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * Extname.\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.codePointAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array} segments\n * Path segments.\n * @returns {string}\n * File path.\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string | undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.codePointAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * File path.\n * @param {boolean} allowAboveRoot\n * Whether `..` can move above root.\n * @returns {string}\n * File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number | undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.codePointAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n result.codePointAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n * File path.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: \nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {URL | string} path\n * File URL.\n * @returns {string}\n * File URL.\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n * URL.\n * @returns {string}\n * File path.\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.codePointAt(index) === 37 /* `%` */ &&\n pathname.codePointAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.codePointAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > đŸȘŠ **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > đŸȘŠ **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > đŸȘŠ **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > .\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n"],"names":["__importDefault","this","mod","__esModule","Object","defineProperty","exports","value","style","iterator","styleObject","declarations","inline_style_parser_1","default","hasIterator","forEach","declaration","type","property","env","self","globalThis","deserialize","serialized","$","_","as","out","index","set","unpair","has","get","arr","push","object","key","Date","source","flags","RegExp","map","Map","Set","add","name","message","BigInt","deserializer","EMPTY","toString","keys","typeOf","asString","call","slice","includes","shouldSkip","TYPE","serialize","json","lossy","strict","pair","entry","TypeError","valueOf","toJSON","entries","toISOString","serializer","structuredClone","any","options","stringify","values","join","trim","tab","space","trimLines","String","search","match","exec","last","lines","trimLine","length","start","end","startIndex","endIndex","code","codePointAt","isPlainObject","prototype","getPrototypeOf","Symbol","toStringTag","trough","fns","pipeline","run","middlewareIndex","callback","pop","next","error","output","fn","undefined","middleware","called","wrapped","parameters","fnExpectsCallback","result","done","apply","then","Error","wrap","use","middelware","CallableInstance","proto","constructor","arguments","setPrototypeOf","own","hasOwnProperty","Processor","super","Compiler","Parser","attachers","compiler","freezeIndex","frozen","namespace","parser","transformers","copy","destination","attacher","data","extend","assertUnfrozen","freeze","transformer","Number","POSITIVE_INFINITY","parse","file","realFile","vfile","assertParser","process","assertCompiler","executor","Promise","resolve","reject","parseTree","realDone","tree","compileTree","compileResult","Boolean","isUint8Array","processSync","complete","bail","assertDone","assertNode","outputTree","resultingTree","runSync","addPlugin","Array","isArray","addList","addPreset","plugin","plugins","settings","entryIndex","primary","rest","currentPrimary","unified","node","asyncName","looksLikeAVFile","pointEnd","point","pointStart","position","line","column","offset","stringifyPosition","pos","convert","test","ok","castFactory","tests","checks","anyFactory","check","checkAsRecord","all","nodeAsRecord","propsFactory","typeFactory","testFunction","parent","looksLikeANode","empty","CONTINUE","EXIT","SKIP","visitParents","visitor","reverse","is","step","factory","parents","tagName","visit","subresult","grandparents","toResult","children","nodeAsParent","concat","child","testOrVisitor","visitorOrReverse","maybeReverse","indexOf","VFileMessage","causeOrReason","optionsOrParentOrPlace","origin","reason","legacyCause","place","ancestors","cause","ruleId","fatal","stack","actual","expected","note","url","minpath","basename","path","extname","assertPath","seenNonSlash","firstNonSlashEnd","extnameIndex","dirname","unmatchedSlash","startPart","startDot","preDotState","segments","joined","absolute","allowAboveRoot","lastSlashIndex","lastSegmentLength","lastSlash","dots","lastIndexOf","normalizeString","normalize","sep","JSON","minproc","cwd","isUrl","fileUrlOrPath","href","protocol","auth","urlToPath","URL","hostname","pathname","third","decodeURIComponent","getPathFromURLPosix","order","VFile","history","messages","stored","field","assertNonEmpty","assertPart","stem","fail","info","encoding","TextDecoder","decode","part"],"sourceRoot":""}