mirror of
https://github.com/quartz-community/github-flavored-markdown.git
synced 2026-07-22 02:50:28 +00:00
Move non-allowlisted packages from dependencies/peerDependencies to devDependencies so tsup bundles them into dist/ instead of leaving them as external imports that may not resolve at runtime.
6565 lines
No EOL
226 KiB
JavaScript
6565 lines
No EOL
226 KiB
JavaScript
import default2 from 'path';
|
||
import default3 from 'process';
|
||
import { fileURLToPath } from 'url';
|
||
|
||
var __create = Object.create;
|
||
var __defProp = Object.defineProperty;
|
||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||
var __getProtoOf = Object.getPrototypeOf;
|
||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||
var __commonJS = (cb, mod) => function __require() {
|
||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||
};
|
||
var __copyProps = (to, from, except, desc) => {
|
||
if (from && typeof from === "object" || typeof from === "function") {
|
||
for (let key of __getOwnPropNames(from))
|
||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||
}
|
||
return to;
|
||
};
|
||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||
// If the importer is in node compatibility mode or this is not an ESM
|
||
// file that has been converted to a CommonJS file using a Babel-
|
||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
||
mod
|
||
));
|
||
|
||
// node_modules/extend/index.js
|
||
var require_extend = __commonJS({
|
||
"node_modules/extend/index.js"(exports$1, module) {
|
||
var hasOwn = Object.prototype.hasOwnProperty;
|
||
var toStr = Object.prototype.toString;
|
||
var defineProperty = Object.defineProperty;
|
||
var gOPD = Object.getOwnPropertyDescriptor;
|
||
var isArray = function isArray2(arr) {
|
||
if (typeof Array.isArray === "function") {
|
||
return Array.isArray(arr);
|
||
}
|
||
return toStr.call(arr) === "[object Array]";
|
||
};
|
||
var isPlainObject2 = function isPlainObject3(obj) {
|
||
if (!obj || toStr.call(obj) !== "[object Object]") {
|
||
return false;
|
||
}
|
||
var hasOwnConstructor = hasOwn.call(obj, "constructor");
|
||
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
|
||
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
|
||
return false;
|
||
}
|
||
var key;
|
||
for (key in obj) {
|
||
}
|
||
return typeof key === "undefined" || hasOwn.call(obj, key);
|
||
};
|
||
var setProperty = function setProperty2(target, options) {
|
||
if (defineProperty && options.name === "__proto__") {
|
||
defineProperty(target, options.name, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
value: options.newValue,
|
||
writable: true
|
||
});
|
||
} else {
|
||
target[options.name] = options.newValue;
|
||
}
|
||
};
|
||
var getProperty = function getProperty2(obj, name) {
|
||
if (name === "__proto__") {
|
||
if (!hasOwn.call(obj, name)) {
|
||
return void 0;
|
||
} else if (gOPD) {
|
||
return gOPD(obj, name).value;
|
||
}
|
||
}
|
||
return obj[name];
|
||
};
|
||
module.exports = function extend2() {
|
||
var options, name, src, copy, copyIsArray, clone2;
|
||
var target = arguments[0];
|
||
var i = 1;
|
||
var length = arguments.length;
|
||
var deep = false;
|
||
if (typeof target === "boolean") {
|
||
deep = target;
|
||
target = arguments[1] || {};
|
||
i = 2;
|
||
}
|
||
if (target == null || typeof target !== "object" && typeof target !== "function") {
|
||
target = {};
|
||
}
|
||
for (; i < length; ++i) {
|
||
options = arguments[i];
|
||
if (options != null) {
|
||
for (name in options) {
|
||
src = getProperty(target, name);
|
||
copy = getProperty(options, name);
|
||
if (target !== copy) {
|
||
if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray(copy)))) {
|
||
if (copyIsArray) {
|
||
copyIsArray = false;
|
||
clone2 = src && isArray(src) ? src : [];
|
||
} else {
|
||
clone2 = src && isPlainObject2(src) ? src : {};
|
||
}
|
||
setProperty(target, { name, newValue: extend2(deep, clone2, copy) });
|
||
} else if (typeof copy !== "undefined") {
|
||
setProperty(target, { name, newValue: copy });
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return target;
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/ccount/index.js
|
||
function ccount(value, character) {
|
||
const source = String(value);
|
||
if (typeof character !== "string") {
|
||
throw new TypeError("Expected character");
|
||
}
|
||
let count = 0;
|
||
let index2 = source.indexOf(character);
|
||
while (index2 !== -1) {
|
||
count++;
|
||
index2 = source.indexOf(character, index2 + character.length);
|
||
}
|
||
return count;
|
||
}
|
||
|
||
// node_modules/devlop/lib/default.js
|
||
function ok() {
|
||
}
|
||
|
||
// node_modules/micromark-util-character/index.js
|
||
var asciiAlpha = regexCheck(/[A-Za-z]/);
|
||
var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
|
||
function asciiControl(code3) {
|
||
return (
|
||
// Special whitespace codes (which have negative values), C0 and Control
|
||
// character DEL
|
||
code3 !== null && (code3 < 32 || code3 === 127)
|
||
);
|
||
}
|
||
function markdownLineEnding(code3) {
|
||
return code3 !== null && code3 < -2;
|
||
}
|
||
function markdownLineEndingOrSpace(code3) {
|
||
return code3 !== null && (code3 < 0 || code3 === 32);
|
||
}
|
||
function markdownSpace(code3) {
|
||
return code3 === -2 || code3 === -1 || code3 === 32;
|
||
}
|
||
var unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
|
||
var unicodeWhitespace = regexCheck(/\s/);
|
||
function regexCheck(regex2) {
|
||
return check2;
|
||
function check2(code3) {
|
||
return code3 !== null && code3 > -1 && regex2.test(String.fromCharCode(code3));
|
||
}
|
||
}
|
||
|
||
// node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp/index.js
|
||
function escapeStringRegexp(string) {
|
||
if (typeof string !== "string") {
|
||
throw new TypeError("Expected a string");
|
||
}
|
||
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
||
}
|
||
|
||
// node_modules/unist-util-is/lib/index.js
|
||
var convert = (
|
||
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
||
/**
|
||
* @type {(
|
||
* (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
||
* (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
||
* (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
||
* ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
||
* ((test?: Test) => Check)
|
||
* )}
|
||
*/
|
||
/**
|
||
* @param {Test} [test]
|
||
* @returns {Check}
|
||
*/
|
||
(function(test) {
|
||
if (test === null || test === void 0) {
|
||
return ok2;
|
||
}
|
||
if (typeof test === "function") {
|
||
return castFactory(test);
|
||
}
|
||
if (typeof test === "object") {
|
||
return Array.isArray(test) ? anyFactory(test) : (
|
||
// Cast because `ReadonlyArray` goes into the above but `isArray`
|
||
// narrows to `Array`.
|
||
propertiesFactory(
|
||
/** @type {Props} */
|
||
test
|
||
)
|
||
);
|
||
}
|
||
if (typeof test === "string") {
|
||
return typeFactory(test);
|
||
}
|
||
throw new Error("Expected function, string, or object as test");
|
||
})
|
||
);
|
||
function anyFactory(tests) {
|
||
const checks = [];
|
||
let index2 = -1;
|
||
while (++index2 < tests.length) {
|
||
checks[index2] = convert(tests[index2]);
|
||
}
|
||
return castFactory(any);
|
||
function any(...parameters) {
|
||
let index3 = -1;
|
||
while (++index3 < checks.length) {
|
||
if (checks[index3].apply(this, parameters)) return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
function propertiesFactory(check2) {
|
||
const checkAsRecord = (
|
||
/** @type {Record<string, unknown>} */
|
||
check2
|
||
);
|
||
return castFactory(all3);
|
||
function all3(node2) {
|
||
const nodeAsRecord = (
|
||
/** @type {Record<string, unknown>} */
|
||
/** @type {unknown} */
|
||
node2
|
||
);
|
||
let key;
|
||
for (key in check2) {
|
||
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
function typeFactory(check2) {
|
||
return castFactory(type);
|
||
function type(node2) {
|
||
return node2 && node2.type === check2;
|
||
}
|
||
}
|
||
function castFactory(testFunction) {
|
||
return check2;
|
||
function check2(value, index2, parent) {
|
||
return Boolean(
|
||
looksLikeANode(value) && testFunction.call(
|
||
this,
|
||
value,
|
||
typeof index2 === "number" ? index2 : void 0,
|
||
parent || void 0
|
||
)
|
||
);
|
||
}
|
||
}
|
||
function ok2() {
|
||
return true;
|
||
}
|
||
function looksLikeANode(value) {
|
||
return value !== null && typeof value === "object" && "type" in value;
|
||
}
|
||
|
||
// node_modules/unist-util-visit-parents/lib/color.node.js
|
||
function color(d) {
|
||
return "\x1B[33m" + d + "\x1B[39m";
|
||
}
|
||
|
||
// node_modules/unist-util-visit-parents/lib/index.js
|
||
var empty = [];
|
||
var CONTINUE = true;
|
||
var EXIT = false;
|
||
var SKIP = "skip";
|
||
function visitParents(tree, test, visitor, reverse) {
|
||
let check2;
|
||
if (typeof test === "function" && typeof visitor !== "function") {
|
||
reverse = visitor;
|
||
visitor = test;
|
||
} else {
|
||
check2 = test;
|
||
}
|
||
const is2 = convert(check2);
|
||
const step = reverse ? -1 : 1;
|
||
factory(tree, void 0, [])();
|
||
function factory(node2, index2, parents) {
|
||
const value = (
|
||
/** @type {Record<string, unknown>} */
|
||
node2 && typeof node2 === "object" ? node2 : {}
|
||
);
|
||
if (typeof value.type === "string") {
|
||
const name = (
|
||
// `hast`
|
||
typeof value.tagName === "string" ? value.tagName : (
|
||
// `xast`
|
||
typeof value.name === "string" ? value.name : void 0
|
||
)
|
||
);
|
||
Object.defineProperty(visit2, "name", {
|
||
value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")"
|
||
});
|
||
}
|
||
return visit2;
|
||
function visit2() {
|
||
let result = empty;
|
||
let subresult;
|
||
let offset;
|
||
let grandparents;
|
||
if (!test || is2(node2, index2, parents[parents.length - 1] || void 0)) {
|
||
result = toResult(visitor(node2, parents));
|
||
if (result[0] === EXIT) {
|
||
return result;
|
||
}
|
||
}
|
||
if ("children" in node2 && node2.children) {
|
||
const nodeAsParent = (
|
||
/** @type {UnistParent} */
|
||
node2
|
||
);
|
||
if (nodeAsParent.children && result[0] !== SKIP) {
|
||
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
||
grandparents = parents.concat(nodeAsParent);
|
||
while (offset > -1 && offset < nodeAsParent.children.length) {
|
||
const child = nodeAsParent.children[offset];
|
||
subresult = factory(child, offset, grandparents)();
|
||
if (subresult[0] === EXIT) {
|
||
return subresult;
|
||
}
|
||
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
}
|
||
function toResult(value) {
|
||
if (Array.isArray(value)) {
|
||
return value;
|
||
}
|
||
if (typeof value === "number") {
|
||
return [CONTINUE, value];
|
||
}
|
||
return value === null || value === void 0 ? empty : [value];
|
||
}
|
||
|
||
// node_modules/mdast-util-find-and-replace/lib/index.js
|
||
function findAndReplace(tree, list2, options) {
|
||
const settings = options || {};
|
||
const ignored = convert(settings.ignore || []);
|
||
const pairs = toPairs(list2);
|
||
let pairIndex = -1;
|
||
while (++pairIndex < pairs.length) {
|
||
visitParents(tree, "text", visitor);
|
||
}
|
||
function visitor(node2, parents) {
|
||
let index2 = -1;
|
||
let grandparent;
|
||
while (++index2 < parents.length) {
|
||
const parent = parents[index2];
|
||
const siblings = grandparent ? grandparent.children : void 0;
|
||
if (ignored(
|
||
parent,
|
||
siblings ? siblings.indexOf(parent) : void 0,
|
||
grandparent
|
||
)) {
|
||
return;
|
||
}
|
||
grandparent = parent;
|
||
}
|
||
if (grandparent) {
|
||
return handler(node2, parents);
|
||
}
|
||
}
|
||
function handler(node2, parents) {
|
||
const parent = parents[parents.length - 1];
|
||
const find = pairs[pairIndex][0];
|
||
const replace2 = pairs[pairIndex][1];
|
||
let start = 0;
|
||
const siblings = parent.children;
|
||
const index2 = siblings.indexOf(node2);
|
||
let change = false;
|
||
let nodes = [];
|
||
find.lastIndex = 0;
|
||
let match = find.exec(node2.value);
|
||
while (match) {
|
||
const position2 = match.index;
|
||
const matchObject = {
|
||
index: match.index,
|
||
input: match.input,
|
||
stack: [...parents, node2]
|
||
};
|
||
let value = replace2(...match, matchObject);
|
||
if (typeof value === "string") {
|
||
value = value.length > 0 ? { type: "text", value } : void 0;
|
||
}
|
||
if (value === false) {
|
||
find.lastIndex = position2 + 1;
|
||
} else {
|
||
if (start !== position2) {
|
||
nodes.push({
|
||
type: "text",
|
||
value: node2.value.slice(start, position2)
|
||
});
|
||
}
|
||
if (Array.isArray(value)) {
|
||
nodes.push(...value);
|
||
} else if (value) {
|
||
nodes.push(value);
|
||
}
|
||
start = position2 + match[0].length;
|
||
change = true;
|
||
}
|
||
if (!find.global) {
|
||
break;
|
||
}
|
||
match = find.exec(node2.value);
|
||
}
|
||
if (change) {
|
||
if (start < node2.value.length) {
|
||
nodes.push({ type: "text", value: node2.value.slice(start) });
|
||
}
|
||
parent.children.splice(index2, 1, ...nodes);
|
||
} else {
|
||
nodes = [node2];
|
||
}
|
||
return index2 + nodes.length;
|
||
}
|
||
}
|
||
function toPairs(tupleOrList) {
|
||
const result = [];
|
||
if (!Array.isArray(tupleOrList)) {
|
||
throw new TypeError("Expected find and replace tuple or list of tuples");
|
||
}
|
||
const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
|
||
let index2 = -1;
|
||
while (++index2 < list2.length) {
|
||
const tuple = list2[index2];
|
||
result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
|
||
}
|
||
return result;
|
||
}
|
||
function toExpression(find) {
|
||
return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
|
||
}
|
||
function toFunction(replace2) {
|
||
return typeof replace2 === "function" ? replace2 : function() {
|
||
return replace2;
|
||
};
|
||
}
|
||
|
||
// node_modules/mdast-util-gfm-autolink-literal/lib/index.js
|
||
var inConstruct = "phrasing";
|
||
var notInConstruct = ["autolink", "link", "image", "label"];
|
||
function gfmAutolinkLiteralFromMarkdown() {
|
||
return {
|
||
transforms: [transformGfmAutolinkLiterals],
|
||
enter: {
|
||
literalAutolink: enterLiteralAutolink,
|
||
literalAutolinkEmail: enterLiteralAutolinkValue,
|
||
literalAutolinkHttp: enterLiteralAutolinkValue,
|
||
literalAutolinkWww: enterLiteralAutolinkValue
|
||
},
|
||
exit: {
|
||
literalAutolink: exitLiteralAutolink,
|
||
literalAutolinkEmail: exitLiteralAutolinkEmail,
|
||
literalAutolinkHttp: exitLiteralAutolinkHttp,
|
||
literalAutolinkWww: exitLiteralAutolinkWww
|
||
}
|
||
};
|
||
}
|
||
function gfmAutolinkLiteralToMarkdown() {
|
||
return {
|
||
unsafe: [
|
||
{
|
||
character: "@",
|
||
before: "[+\\-.\\w]",
|
||
after: "[\\-.\\w]",
|
||
inConstruct,
|
||
notInConstruct
|
||
},
|
||
{
|
||
character: ".",
|
||
before: "[Ww]",
|
||
after: "[\\-.\\w]",
|
||
inConstruct,
|
||
notInConstruct
|
||
},
|
||
{
|
||
character: ":",
|
||
before: "[ps]",
|
||
after: "\\/",
|
||
inConstruct,
|
||
notInConstruct
|
||
}
|
||
]
|
||
};
|
||
}
|
||
function enterLiteralAutolink(token) {
|
||
this.enter({ type: "link", title: null, url: "", children: [] }, token);
|
||
}
|
||
function enterLiteralAutolinkValue(token) {
|
||
this.config.enter.autolinkProtocol.call(this, token);
|
||
}
|
||
function exitLiteralAutolinkHttp(token) {
|
||
this.config.exit.autolinkProtocol.call(this, token);
|
||
}
|
||
function exitLiteralAutolinkWww(token) {
|
||
this.config.exit.data.call(this, token);
|
||
const node2 = this.stack[this.stack.length - 1];
|
||
ok(node2.type === "link");
|
||
node2.url = "http://" + this.sliceSerialize(token);
|
||
}
|
||
function exitLiteralAutolinkEmail(token) {
|
||
this.config.exit.autolinkEmail.call(this, token);
|
||
}
|
||
function exitLiteralAutolink(token) {
|
||
this.exit(token);
|
||
}
|
||
function transformGfmAutolinkLiterals(tree) {
|
||
findAndReplace(
|
||
tree,
|
||
[
|
||
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
|
||
[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, findEmail]
|
||
],
|
||
{ ignore: ["link", "linkReference"] }
|
||
);
|
||
}
|
||
function findUrl(_, protocol, domain2, path2, match) {
|
||
let prefix = "";
|
||
if (!previous(match)) {
|
||
return false;
|
||
}
|
||
if (/^w/i.test(protocol)) {
|
||
domain2 = protocol + domain2;
|
||
protocol = "";
|
||
prefix = "http://";
|
||
}
|
||
if (!isCorrectDomain(domain2)) {
|
||
return false;
|
||
}
|
||
const parts = splitUrl(domain2 + path2);
|
||
if (!parts[0]) return false;
|
||
const result = {
|
||
type: "link",
|
||
title: null,
|
||
url: prefix + protocol + parts[0],
|
||
children: [{ type: "text", value: protocol + parts[0] }]
|
||
};
|
||
if (parts[1]) {
|
||
return [result, { type: "text", value: parts[1] }];
|
||
}
|
||
return result;
|
||
}
|
||
function findEmail(_, atext, label, match) {
|
||
if (
|
||
// Not an expected previous character.
|
||
!previous(match, true) || // Label ends in not allowed character.
|
||
/[-\d_]$/.test(label)
|
||
) {
|
||
return false;
|
||
}
|
||
return {
|
||
type: "link",
|
||
title: null,
|
||
url: "mailto:" + atext + "@" + label,
|
||
children: [{ type: "text", value: atext + "@" + label }]
|
||
};
|
||
}
|
||
function isCorrectDomain(domain2) {
|
||
const parts = domain2.split(".");
|
||
if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
function splitUrl(url) {
|
||
const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
|
||
if (!trailExec) {
|
||
return [url, void 0];
|
||
}
|
||
url = url.slice(0, trailExec.index);
|
||
let trail2 = trailExec[0];
|
||
let closingParenIndex = trail2.indexOf(")");
|
||
const openingParens = ccount(url, "(");
|
||
let closingParens = ccount(url, ")");
|
||
while (closingParenIndex !== -1 && openingParens > closingParens) {
|
||
url += trail2.slice(0, closingParenIndex + 1);
|
||
trail2 = trail2.slice(closingParenIndex + 1);
|
||
closingParenIndex = trail2.indexOf(")");
|
||
closingParens++;
|
||
}
|
||
return [url, trail2];
|
||
}
|
||
function previous(match, email) {
|
||
const code3 = match.input.charCodeAt(match.index - 1);
|
||
return (match.index === 0 || unicodeWhitespace(code3) || unicodePunctuation(code3)) && // If it’s an email, the previous character should not be a slash.
|
||
(!email || code3 !== 47);
|
||
}
|
||
|
||
// node_modules/micromark-util-normalize-identifier/index.js
|
||
function normalizeIdentifier(value) {
|
||
return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
||
}
|
||
|
||
// node_modules/mdast-util-gfm-footnote/lib/index.js
|
||
footnoteReference.peek = footnoteReferencePeek;
|
||
function enterFootnoteCallString() {
|
||
this.buffer();
|
||
}
|
||
function enterFootnoteCall(token) {
|
||
this.enter({ type: "footnoteReference", identifier: "", label: "" }, token);
|
||
}
|
||
function enterFootnoteDefinitionLabelString() {
|
||
this.buffer();
|
||
}
|
||
function enterFootnoteDefinition(token) {
|
||
this.enter(
|
||
{ type: "footnoteDefinition", identifier: "", label: "", children: [] },
|
||
token
|
||
);
|
||
}
|
||
function exitFootnoteCallString(token) {
|
||
const label = this.resume();
|
||
const node2 = this.stack[this.stack.length - 1];
|
||
ok(node2.type === "footnoteReference");
|
||
node2.identifier = normalizeIdentifier(
|
||
this.sliceSerialize(token)
|
||
).toLowerCase();
|
||
node2.label = label;
|
||
}
|
||
function exitFootnoteCall(token) {
|
||
this.exit(token);
|
||
}
|
||
function exitFootnoteDefinitionLabelString(token) {
|
||
const label = this.resume();
|
||
const node2 = this.stack[this.stack.length - 1];
|
||
ok(node2.type === "footnoteDefinition");
|
||
node2.identifier = normalizeIdentifier(
|
||
this.sliceSerialize(token)
|
||
).toLowerCase();
|
||
node2.label = label;
|
||
}
|
||
function exitFootnoteDefinition(token) {
|
||
this.exit(token);
|
||
}
|
||
function footnoteReferencePeek() {
|
||
return "[";
|
||
}
|
||
function footnoteReference(node2, _, state, info) {
|
||
const tracker = state.createTracker(info);
|
||
let value = tracker.move("[^");
|
||
const exit2 = state.enter("footnoteReference");
|
||
const subexit = state.enter("reference");
|
||
value += tracker.move(
|
||
state.safe(state.associationId(node2), { after: "]", before: value })
|
||
);
|
||
subexit();
|
||
exit2();
|
||
value += tracker.move("]");
|
||
return value;
|
||
}
|
||
function gfmFootnoteFromMarkdown() {
|
||
return {
|
||
enter: {
|
||
gfmFootnoteCallString: enterFootnoteCallString,
|
||
gfmFootnoteCall: enterFootnoteCall,
|
||
gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
|
||
gfmFootnoteDefinition: enterFootnoteDefinition
|
||
},
|
||
exit: {
|
||
gfmFootnoteCallString: exitFootnoteCallString,
|
||
gfmFootnoteCall: exitFootnoteCall,
|
||
gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
|
||
gfmFootnoteDefinition: exitFootnoteDefinition
|
||
}
|
||
};
|
||
}
|
||
function gfmFootnoteToMarkdown(options) {
|
||
let firstLineBlank = false;
|
||
if (options && options.firstLineBlank) {
|
||
firstLineBlank = true;
|
||
}
|
||
return {
|
||
handlers: { footnoteDefinition, footnoteReference },
|
||
// This is on by default already.
|
||
unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
|
||
};
|
||
function footnoteDefinition(node2, _, state, info) {
|
||
const tracker = state.createTracker(info);
|
||
let value = tracker.move("[^");
|
||
const exit2 = state.enter("footnoteDefinition");
|
||
const subexit = state.enter("label");
|
||
value += tracker.move(
|
||
state.safe(state.associationId(node2), { before: value, after: "]" })
|
||
);
|
||
subexit();
|
||
value += tracker.move("]:");
|
||
if (node2.children && node2.children.length > 0) {
|
||
tracker.shift(4);
|
||
value += tracker.move(
|
||
(firstLineBlank ? "\n" : " ") + state.indentLines(
|
||
state.containerFlow(node2, tracker.current()),
|
||
firstLineBlank ? mapAll : mapExceptFirst
|
||
)
|
||
);
|
||
}
|
||
exit2();
|
||
return value;
|
||
}
|
||
}
|
||
function mapExceptFirst(line, index2, blank) {
|
||
return index2 === 0 ? line : mapAll(line, index2, blank);
|
||
}
|
||
function mapAll(line, index2, blank) {
|
||
return (blank ? "" : " ") + line;
|
||
}
|
||
|
||
// node_modules/mdast-util-gfm-strikethrough/lib/index.js
|
||
var constructsWithoutStrikethrough = [
|
||
"autolink",
|
||
"destinationLiteral",
|
||
"destinationRaw",
|
||
"reference",
|
||
"titleQuote",
|
||
"titleApostrophe"
|
||
];
|
||
handleDelete.peek = peekDelete;
|
||
function gfmStrikethroughFromMarkdown() {
|
||
return {
|
||
canContainEols: ["delete"],
|
||
enter: { strikethrough: enterStrikethrough },
|
||
exit: { strikethrough: exitStrikethrough }
|
||
};
|
||
}
|
||
function gfmStrikethroughToMarkdown() {
|
||
return {
|
||
unsafe: [
|
||
{
|
||
character: "~",
|
||
inConstruct: "phrasing",
|
||
notInConstruct: constructsWithoutStrikethrough
|
||
}
|
||
],
|
||
handlers: { delete: handleDelete }
|
||
};
|
||
}
|
||
function enterStrikethrough(token) {
|
||
this.enter({ type: "delete", children: [] }, token);
|
||
}
|
||
function exitStrikethrough(token) {
|
||
this.exit(token);
|
||
}
|
||
function handleDelete(node2, _, state, info) {
|
||
const tracker = state.createTracker(info);
|
||
const exit2 = state.enter("strikethrough");
|
||
let value = tracker.move("~~");
|
||
value += state.containerPhrasing(node2, {
|
||
...tracker.current(),
|
||
before: value,
|
||
after: "~"
|
||
});
|
||
value += tracker.move("~~");
|
||
exit2();
|
||
return value;
|
||
}
|
||
function peekDelete() {
|
||
return "~";
|
||
}
|
||
|
||
// node_modules/markdown-table/index.js
|
||
function defaultStringLength(value) {
|
||
return value.length;
|
||
}
|
||
function markdownTable(table, options) {
|
||
const settings = options || {};
|
||
const align = (settings.align || []).concat();
|
||
const stringLength = settings.stringLength || defaultStringLength;
|
||
const alignments = [];
|
||
const cellMatrix = [];
|
||
const sizeMatrix = [];
|
||
const longestCellByColumn = [];
|
||
let mostCellsPerRow = 0;
|
||
let rowIndex = -1;
|
||
while (++rowIndex < table.length) {
|
||
const row2 = [];
|
||
const sizes2 = [];
|
||
let columnIndex2 = -1;
|
||
if (table[rowIndex].length > mostCellsPerRow) {
|
||
mostCellsPerRow = table[rowIndex].length;
|
||
}
|
||
while (++columnIndex2 < table[rowIndex].length) {
|
||
const cell = serialize(table[rowIndex][columnIndex2]);
|
||
if (settings.alignDelimiters !== false) {
|
||
const size = stringLength(cell);
|
||
sizes2[columnIndex2] = size;
|
||
if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
|
||
longestCellByColumn[columnIndex2] = size;
|
||
}
|
||
}
|
||
row2.push(cell);
|
||
}
|
||
cellMatrix[rowIndex] = row2;
|
||
sizeMatrix[rowIndex] = sizes2;
|
||
}
|
||
let columnIndex = -1;
|
||
if (typeof align === "object" && "length" in align) {
|
||
while (++columnIndex < mostCellsPerRow) {
|
||
alignments[columnIndex] = toAlignment(align[columnIndex]);
|
||
}
|
||
} else {
|
||
const code3 = toAlignment(align);
|
||
while (++columnIndex < mostCellsPerRow) {
|
||
alignments[columnIndex] = code3;
|
||
}
|
||
}
|
||
columnIndex = -1;
|
||
const row = [];
|
||
const sizes = [];
|
||
while (++columnIndex < mostCellsPerRow) {
|
||
const code3 = alignments[columnIndex];
|
||
let before = "";
|
||
let after = "";
|
||
if (code3 === 99) {
|
||
before = ":";
|
||
after = ":";
|
||
} else if (code3 === 108) {
|
||
before = ":";
|
||
} else if (code3 === 114) {
|
||
after = ":";
|
||
}
|
||
let size = settings.alignDelimiters === false ? 1 : Math.max(
|
||
1,
|
||
longestCellByColumn[columnIndex] - before.length - after.length
|
||
);
|
||
const cell = before + "-".repeat(size) + after;
|
||
if (settings.alignDelimiters !== false) {
|
||
size = before.length + size + after.length;
|
||
if (size > longestCellByColumn[columnIndex]) {
|
||
longestCellByColumn[columnIndex] = size;
|
||
}
|
||
sizes[columnIndex] = size;
|
||
}
|
||
row[columnIndex] = cell;
|
||
}
|
||
cellMatrix.splice(1, 0, row);
|
||
sizeMatrix.splice(1, 0, sizes);
|
||
rowIndex = -1;
|
||
const lines = [];
|
||
while (++rowIndex < cellMatrix.length) {
|
||
const row2 = cellMatrix[rowIndex];
|
||
const sizes2 = sizeMatrix[rowIndex];
|
||
columnIndex = -1;
|
||
const line = [];
|
||
while (++columnIndex < mostCellsPerRow) {
|
||
const cell = row2[columnIndex] || "";
|
||
let before = "";
|
||
let after = "";
|
||
if (settings.alignDelimiters !== false) {
|
||
const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
|
||
const code3 = alignments[columnIndex];
|
||
if (code3 === 114) {
|
||
before = " ".repeat(size);
|
||
} else if (code3 === 99) {
|
||
if (size % 2) {
|
||
before = " ".repeat(size / 2 + 0.5);
|
||
after = " ".repeat(size / 2 - 0.5);
|
||
} else {
|
||
before = " ".repeat(size / 2);
|
||
after = before;
|
||
}
|
||
} else {
|
||
after = " ".repeat(size);
|
||
}
|
||
}
|
||
if (settings.delimiterStart !== false && !columnIndex) {
|
||
line.push("|");
|
||
}
|
||
if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is
|
||
// empty: there will be a closing space.
|
||
!(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
|
||
line.push(" ");
|
||
}
|
||
if (settings.alignDelimiters !== false) {
|
||
line.push(before);
|
||
}
|
||
line.push(cell);
|
||
if (settings.alignDelimiters !== false) {
|
||
line.push(after);
|
||
}
|
||
if (settings.padding !== false) {
|
||
line.push(" ");
|
||
}
|
||
if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
|
||
line.push("|");
|
||
}
|
||
}
|
||
lines.push(
|
||
settings.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("")
|
||
);
|
||
}
|
||
return lines.join("\n");
|
||
}
|
||
function serialize(value) {
|
||
return value === null || value === void 0 ? "" : String(value);
|
||
}
|
||
function toAlignment(value) {
|
||
const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
|
||
return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
|
||
function blockquote(node2, _, state, info) {
|
||
const exit2 = state.enter("blockquote");
|
||
const tracker = state.createTracker(info);
|
||
tracker.move("> ");
|
||
tracker.shift(2);
|
||
const value = state.indentLines(
|
||
state.containerFlow(node2, tracker.current()),
|
||
map
|
||
);
|
||
exit2();
|
||
return value;
|
||
}
|
||
function map(line, _, blank) {
|
||
return ">" + (blank ? "" : " ") + line;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
||
function patternInScope(stack, pattern) {
|
||
return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
|
||
}
|
||
function listInScope(stack, list2, none) {
|
||
if (typeof list2 === "string") {
|
||
list2 = [list2];
|
||
}
|
||
if (!list2 || list2.length === 0) {
|
||
return none;
|
||
}
|
||
let index2 = -1;
|
||
while (++index2 < list2.length) {
|
||
if (stack.includes(list2[index2])) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/break.js
|
||
function hardBreak(_, _1, state, info) {
|
||
let index2 = -1;
|
||
while (++index2 < state.unsafe.length) {
|
||
if (state.unsafe[index2].character === "\n" && patternInScope(state.stack, state.unsafe[index2])) {
|
||
return /[ \t]/.test(info.before) ? "" : " ";
|
||
}
|
||
}
|
||
return "\\\n";
|
||
}
|
||
|
||
// node_modules/longest-streak/index.js
|
||
function longestStreak(value, substring) {
|
||
const source = String(value);
|
||
let index2 = source.indexOf(substring);
|
||
let expected = index2;
|
||
let count = 0;
|
||
let max = 0;
|
||
if (typeof substring !== "string") {
|
||
throw new TypeError("Expected substring");
|
||
}
|
||
while (index2 !== -1) {
|
||
if (index2 === expected) {
|
||
if (++count > max) {
|
||
max = count;
|
||
}
|
||
} else {
|
||
count = 1;
|
||
}
|
||
expected = index2 + substring.length;
|
||
index2 = source.indexOf(substring, expected);
|
||
}
|
||
return max;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
|
||
function formatCodeAsIndented(node2, state) {
|
||
return Boolean(
|
||
state.options.fences === false && node2.value && // If there’s no info…
|
||
!node2.lang && // And there’s a non-whitespace character…
|
||
/[^ \r\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…
|
||
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
|
||
);
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-fence.js
|
||
function checkFence(state) {
|
||
const marker = state.options.fence || "`";
|
||
if (marker !== "`" && marker !== "~") {
|
||
throw new Error(
|
||
"Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/code.js
|
||
function code(node2, _, state, info) {
|
||
const marker = checkFence(state);
|
||
const raw = node2.value || "";
|
||
const suffix = marker === "`" ? "GraveAccent" : "Tilde";
|
||
if (formatCodeAsIndented(node2, state)) {
|
||
const exit3 = state.enter("codeIndented");
|
||
const value2 = state.indentLines(raw, map2);
|
||
exit3();
|
||
return value2;
|
||
}
|
||
const tracker = state.createTracker(info);
|
||
const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
|
||
const exit2 = state.enter("codeFenced");
|
||
let value = tracker.move(sequence);
|
||
if (node2.lang) {
|
||
const subexit = state.enter(`codeFencedLang${suffix}`);
|
||
value += tracker.move(
|
||
state.safe(node2.lang, {
|
||
before: value,
|
||
after: " ",
|
||
encode: ["`"],
|
||
...tracker.current()
|
||
})
|
||
);
|
||
subexit();
|
||
}
|
||
if (node2.lang && node2.meta) {
|
||
const subexit = state.enter(`codeFencedMeta${suffix}`);
|
||
value += tracker.move(" ");
|
||
value += tracker.move(
|
||
state.safe(node2.meta, {
|
||
before: value,
|
||
after: "\n",
|
||
encode: ["`"],
|
||
...tracker.current()
|
||
})
|
||
);
|
||
subexit();
|
||
}
|
||
value += tracker.move("\n");
|
||
if (raw) {
|
||
value += tracker.move(raw + "\n");
|
||
}
|
||
value += tracker.move(sequence);
|
||
exit2();
|
||
return value;
|
||
}
|
||
function map2(line, _, blank) {
|
||
return (blank ? "" : " ") + line;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-quote.js
|
||
function checkQuote(state) {
|
||
const marker = state.options.quote || '"';
|
||
if (marker !== '"' && marker !== "'") {
|
||
throw new Error(
|
||
"Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/definition.js
|
||
function definition(node2, _, state, info) {
|
||
const quote = checkQuote(state);
|
||
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
||
const exit2 = state.enter("definition");
|
||
let subexit = state.enter("label");
|
||
const tracker = state.createTracker(info);
|
||
let value = tracker.move("[");
|
||
value += tracker.move(
|
||
state.safe(state.associationId(node2), {
|
||
before: value,
|
||
after: "]",
|
||
...tracker.current()
|
||
})
|
||
);
|
||
value += tracker.move("]: ");
|
||
subexit();
|
||
if (
|
||
// If there’s no url, or…
|
||
!node2.url || // If there are control characters or whitespace.
|
||
/[\0- \u007F]/.test(node2.url)
|
||
) {
|
||
subexit = state.enter("destinationLiteral");
|
||
value += tracker.move("<");
|
||
value += tracker.move(
|
||
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
|
||
);
|
||
value += tracker.move(">");
|
||
} else {
|
||
subexit = state.enter("destinationRaw");
|
||
value += tracker.move(
|
||
state.safe(node2.url, {
|
||
before: value,
|
||
after: node2.title ? " " : "\n",
|
||
...tracker.current()
|
||
})
|
||
);
|
||
}
|
||
subexit();
|
||
if (node2.title) {
|
||
subexit = state.enter(`title${suffix}`);
|
||
value += tracker.move(" " + quote);
|
||
value += tracker.move(
|
||
state.safe(node2.title, {
|
||
before: value,
|
||
after: quote,
|
||
...tracker.current()
|
||
})
|
||
);
|
||
value += tracker.move(quote);
|
||
subexit();
|
||
}
|
||
exit2();
|
||
return value;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
|
||
function checkEmphasis(state) {
|
||
const marker = state.options.emphasis || "*";
|
||
if (marker !== "*" && marker !== "_") {
|
||
throw new Error(
|
||
"Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
|
||
function encodeCharacterReference(code3) {
|
||
return "&#x" + code3.toString(16).toUpperCase() + ";";
|
||
}
|
||
|
||
// node_modules/micromark-util-classify-character/index.js
|
||
function classifyCharacter(code3) {
|
||
if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
|
||
return 1;
|
||
}
|
||
if (unicodePunctuation(code3)) {
|
||
return 2;
|
||
}
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/encode-info.js
|
||
function encodeInfo(outside, inside, marker) {
|
||
const outsideKind = classifyCharacter(outside);
|
||
const insideKind = classifyCharacter(inside);
|
||
if (outsideKind === void 0) {
|
||
return insideKind === void 0 ? (
|
||
// Letter inside:
|
||
// we have to encode *both* letters for `_` as it is looser.
|
||
// it already forms for `*` (and GFMs `~`).
|
||
marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false }
|
||
) : insideKind === 1 ? (
|
||
// Whitespace inside: encode both (letter, whitespace).
|
||
{ inside: true, outside: true }
|
||
) : (
|
||
// Punctuation inside: encode outer (letter)
|
||
{ inside: false, outside: true }
|
||
);
|
||
}
|
||
if (outsideKind === 1) {
|
||
return insideKind === void 0 ? (
|
||
// Letter inside: already forms.
|
||
{ inside: false, outside: false }
|
||
) : insideKind === 1 ? (
|
||
// Whitespace inside: encode both (whitespace).
|
||
{ inside: true, outside: true }
|
||
) : (
|
||
// Punctuation inside: already forms.
|
||
{ inside: false, outside: false }
|
||
);
|
||
}
|
||
return insideKind === void 0 ? (
|
||
// Letter inside: already forms.
|
||
{ inside: false, outside: false }
|
||
) : insideKind === 1 ? (
|
||
// Whitespace inside: encode inner (whitespace).
|
||
{ inside: true, outside: false }
|
||
) : (
|
||
// Punctuation inside: already forms.
|
||
{ inside: false, outside: false }
|
||
);
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
|
||
emphasis.peek = emphasisPeek;
|
||
function emphasis(node2, _, state, info) {
|
||
const marker = checkEmphasis(state);
|
||
const exit2 = state.enter("emphasis");
|
||
const tracker = state.createTracker(info);
|
||
const before = tracker.move(marker);
|
||
let between = tracker.move(
|
||
state.containerPhrasing(node2, {
|
||
after: marker,
|
||
before,
|
||
...tracker.current()
|
||
})
|
||
);
|
||
const betweenHead = between.charCodeAt(0);
|
||
const open = encodeInfo(
|
||
info.before.charCodeAt(info.before.length - 1),
|
||
betweenHead,
|
||
marker
|
||
);
|
||
if (open.inside) {
|
||
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
||
}
|
||
const betweenTail = between.charCodeAt(between.length - 1);
|
||
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
||
if (close.inside) {
|
||
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
||
}
|
||
const after = tracker.move(marker);
|
||
exit2();
|
||
state.attentionEncodeSurroundingInfo = {
|
||
after: close.outside,
|
||
before: open.outside
|
||
};
|
||
return before + between + after;
|
||
}
|
||
function emphasisPeek(_, _1, state) {
|
||
return state.options.emphasis || "*";
|
||
}
|
||
|
||
// node_modules/unist-util-visit/lib/index.js
|
||
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
||
let reverse;
|
||
let test;
|
||
let visitor;
|
||
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
||
test = void 0;
|
||
visitor = testOrVisitor;
|
||
reverse = visitorOrReverse;
|
||
} else {
|
||
test = testOrVisitor;
|
||
visitor = visitorOrReverse;
|
||
reverse = maybeReverse;
|
||
}
|
||
visitParents(tree, test, overload, reverse);
|
||
function overload(node2, parents) {
|
||
const parent = parents[parents.length - 1];
|
||
const index2 = parent ? parent.children.indexOf(node2) : void 0;
|
||
return visitor(node2, index2, parent);
|
||
}
|
||
}
|
||
|
||
// node_modules/mdast-util-to-string/lib/index.js
|
||
var emptyOptions = {};
|
||
function toString(value, options) {
|
||
const settings = emptyOptions;
|
||
const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
|
||
const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
|
||
return one(value, includeImageAlt, includeHtml);
|
||
}
|
||
function one(value, includeImageAlt, includeHtml) {
|
||
if (node(value)) {
|
||
if ("value" in value) {
|
||
return value.type === "html" && !includeHtml ? "" : value.value;
|
||
}
|
||
if (includeImageAlt && "alt" in value && value.alt) {
|
||
return value.alt;
|
||
}
|
||
if ("children" in value) {
|
||
return all(value.children, includeImageAlt, includeHtml);
|
||
}
|
||
}
|
||
if (Array.isArray(value)) {
|
||
return all(value, includeImageAlt, includeHtml);
|
||
}
|
||
return "";
|
||
}
|
||
function all(values, includeImageAlt, includeHtml) {
|
||
const result = [];
|
||
let index2 = -1;
|
||
while (++index2 < values.length) {
|
||
result[index2] = one(values[index2], includeImageAlt, includeHtml);
|
||
}
|
||
return result.join("");
|
||
}
|
||
function node(value) {
|
||
return Boolean(value && typeof value === "object");
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
|
||
function formatHeadingAsSetext(node2, state) {
|
||
let literalWithBreak = false;
|
||
visit(node2, function(node3) {
|
||
if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
|
||
literalWithBreak = true;
|
||
return EXIT;
|
||
}
|
||
});
|
||
return Boolean(
|
||
(!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
|
||
);
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/heading.js
|
||
function heading(node2, _, state, info) {
|
||
const rank = Math.max(Math.min(6, node2.depth || 1), 1);
|
||
const tracker = state.createTracker(info);
|
||
if (formatHeadingAsSetext(node2, state)) {
|
||
const exit3 = state.enter("headingSetext");
|
||
const subexit2 = state.enter("phrasing");
|
||
const value2 = state.containerPhrasing(node2, {
|
||
...tracker.current(),
|
||
before: "\n",
|
||
after: "\n"
|
||
});
|
||
subexit2();
|
||
exit3();
|
||
return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
|
||
// The whole size…
|
||
value2.length - // Minus the position of the character after the last EOL (or
|
||
// 0 if there is none)…
|
||
(Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
|
||
);
|
||
}
|
||
const sequence = "#".repeat(rank);
|
||
const exit2 = state.enter("headingAtx");
|
||
const subexit = state.enter("phrasing");
|
||
tracker.move(sequence + " ");
|
||
let value = state.containerPhrasing(node2, {
|
||
before: "# ",
|
||
after: "\n",
|
||
...tracker.current()
|
||
});
|
||
if (/^[\t ]/.test(value)) {
|
||
value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
|
||
}
|
||
value = value ? sequence + " " + value : sequence;
|
||
if (state.options.closeAtx) {
|
||
value += " " + sequence;
|
||
}
|
||
subexit();
|
||
exit2();
|
||
return value;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/html.js
|
||
html.peek = htmlPeek;
|
||
function html(node2) {
|
||
return node2.value || "";
|
||
}
|
||
function htmlPeek() {
|
||
return "<";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/image.js
|
||
image.peek = imagePeek;
|
||
function image(node2, _, state, info) {
|
||
const quote = checkQuote(state);
|
||
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
||
const exit2 = state.enter("image");
|
||
let subexit = state.enter("label");
|
||
const tracker = state.createTracker(info);
|
||
let value = tracker.move("![");
|
||
value += tracker.move(
|
||
state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
|
||
);
|
||
value += tracker.move("](");
|
||
subexit();
|
||
if (
|
||
// If there’s no url but there is a title…
|
||
!node2.url && node2.title || // If there are control characters or whitespace.
|
||
/[\0- \u007F]/.test(node2.url)
|
||
) {
|
||
subexit = state.enter("destinationLiteral");
|
||
value += tracker.move("<");
|
||
value += tracker.move(
|
||
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
|
||
);
|
||
value += tracker.move(">");
|
||
} else {
|
||
subexit = state.enter("destinationRaw");
|
||
value += tracker.move(
|
||
state.safe(node2.url, {
|
||
before: value,
|
||
after: node2.title ? " " : ")",
|
||
...tracker.current()
|
||
})
|
||
);
|
||
}
|
||
subexit();
|
||
if (node2.title) {
|
||
subexit = state.enter(`title${suffix}`);
|
||
value += tracker.move(" " + quote);
|
||
value += tracker.move(
|
||
state.safe(node2.title, {
|
||
before: value,
|
||
after: quote,
|
||
...tracker.current()
|
||
})
|
||
);
|
||
value += tracker.move(quote);
|
||
subexit();
|
||
}
|
||
value += tracker.move(")");
|
||
exit2();
|
||
return value;
|
||
}
|
||
function imagePeek() {
|
||
return "!";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
|
||
imageReference.peek = imageReferencePeek;
|
||
function imageReference(node2, _, state, info) {
|
||
const type = node2.referenceType;
|
||
const exit2 = state.enter("imageReference");
|
||
let subexit = state.enter("label");
|
||
const tracker = state.createTracker(info);
|
||
let value = tracker.move("![");
|
||
const alt = state.safe(node2.alt, {
|
||
before: value,
|
||
after: "]",
|
||
...tracker.current()
|
||
});
|
||
value += tracker.move(alt + "][");
|
||
subexit();
|
||
const stack = state.stack;
|
||
state.stack = [];
|
||
subexit = state.enter("reference");
|
||
const reference = state.safe(state.associationId(node2), {
|
||
before: value,
|
||
after: "]",
|
||
...tracker.current()
|
||
});
|
||
subexit();
|
||
state.stack = stack;
|
||
exit2();
|
||
if (type === "full" || !alt || alt !== reference) {
|
||
value += tracker.move(reference + "]");
|
||
} else if (type === "shortcut") {
|
||
value = value.slice(0, -1);
|
||
} else {
|
||
value += tracker.move("]");
|
||
}
|
||
return value;
|
||
}
|
||
function imageReferencePeek() {
|
||
return "!";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
|
||
inlineCode.peek = inlineCodePeek;
|
||
function inlineCode(node2, _, state) {
|
||
let value = node2.value || "";
|
||
let sequence = "`";
|
||
let index2 = -1;
|
||
while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
|
||
sequence += "`";
|
||
}
|
||
if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
|
||
value = " " + value + " ";
|
||
}
|
||
while (++index2 < state.unsafe.length) {
|
||
const pattern = state.unsafe[index2];
|
||
const expression = state.compilePattern(pattern);
|
||
let match;
|
||
if (!pattern.atBreak) continue;
|
||
while (match = expression.exec(value)) {
|
||
let position2 = match.index;
|
||
if (value.charCodeAt(position2) === 10 && value.charCodeAt(position2 - 1) === 13) {
|
||
position2--;
|
||
}
|
||
value = value.slice(0, position2) + " " + value.slice(match.index + 1);
|
||
}
|
||
}
|
||
return sequence + value + sequence;
|
||
}
|
||
function inlineCodePeek() {
|
||
return "`";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
|
||
function formatLinkAsAutolink(node2, state) {
|
||
const raw = toString(node2);
|
||
return Boolean(
|
||
!state.options.resourceLink && // If there’s a url…
|
||
node2.url && // And there’s a no title…
|
||
!node2.title && // And the content of `node` is a single text node…
|
||
node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
|
||
(raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
|
||
/^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and
|
||
// references don’t work), space, or angle brackets…
|
||
!/[\0- <>\u007F]/.test(node2.url)
|
||
);
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/link.js
|
||
link.peek = linkPeek;
|
||
function link(node2, _, state, info) {
|
||
const quote = checkQuote(state);
|
||
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
||
const tracker = state.createTracker(info);
|
||
let exit2;
|
||
let subexit;
|
||
if (formatLinkAsAutolink(node2, state)) {
|
||
const stack = state.stack;
|
||
state.stack = [];
|
||
exit2 = state.enter("autolink");
|
||
let value2 = tracker.move("<");
|
||
value2 += tracker.move(
|
||
state.containerPhrasing(node2, {
|
||
before: value2,
|
||
after: ">",
|
||
...tracker.current()
|
||
})
|
||
);
|
||
value2 += tracker.move(">");
|
||
exit2();
|
||
state.stack = stack;
|
||
return value2;
|
||
}
|
||
exit2 = state.enter("link");
|
||
subexit = state.enter("label");
|
||
let value = tracker.move("[");
|
||
value += tracker.move(
|
||
state.containerPhrasing(node2, {
|
||
before: value,
|
||
after: "](",
|
||
...tracker.current()
|
||
})
|
||
);
|
||
value += tracker.move("](");
|
||
subexit();
|
||
if (
|
||
// If there’s no url but there is a title…
|
||
!node2.url && node2.title || // If there are control characters or whitespace.
|
||
/[\0- \u007F]/.test(node2.url)
|
||
) {
|
||
subexit = state.enter("destinationLiteral");
|
||
value += tracker.move("<");
|
||
value += tracker.move(
|
||
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
|
||
);
|
||
value += tracker.move(">");
|
||
} else {
|
||
subexit = state.enter("destinationRaw");
|
||
value += tracker.move(
|
||
state.safe(node2.url, {
|
||
before: value,
|
||
after: node2.title ? " " : ")",
|
||
...tracker.current()
|
||
})
|
||
);
|
||
}
|
||
subexit();
|
||
if (node2.title) {
|
||
subexit = state.enter(`title${suffix}`);
|
||
value += tracker.move(" " + quote);
|
||
value += tracker.move(
|
||
state.safe(node2.title, {
|
||
before: value,
|
||
after: quote,
|
||
...tracker.current()
|
||
})
|
||
);
|
||
value += tracker.move(quote);
|
||
subexit();
|
||
}
|
||
value += tracker.move(")");
|
||
exit2();
|
||
return value;
|
||
}
|
||
function linkPeek(node2, _, state) {
|
||
return formatLinkAsAutolink(node2, state) ? "<" : "[";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
|
||
linkReference.peek = linkReferencePeek;
|
||
function linkReference(node2, _, state, info) {
|
||
const type = node2.referenceType;
|
||
const exit2 = state.enter("linkReference");
|
||
let subexit = state.enter("label");
|
||
const tracker = state.createTracker(info);
|
||
let value = tracker.move("[");
|
||
const text3 = state.containerPhrasing(node2, {
|
||
before: value,
|
||
after: "]",
|
||
...tracker.current()
|
||
});
|
||
value += tracker.move(text3 + "][");
|
||
subexit();
|
||
const stack = state.stack;
|
||
state.stack = [];
|
||
subexit = state.enter("reference");
|
||
const reference = state.safe(state.associationId(node2), {
|
||
before: value,
|
||
after: "]",
|
||
...tracker.current()
|
||
});
|
||
subexit();
|
||
state.stack = stack;
|
||
exit2();
|
||
if (type === "full" || !text3 || text3 !== reference) {
|
||
value += tracker.move(reference + "]");
|
||
} else if (type === "shortcut") {
|
||
value = value.slice(0, -1);
|
||
} else {
|
||
value += tracker.move("]");
|
||
}
|
||
return value;
|
||
}
|
||
function linkReferencePeek() {
|
||
return "[";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
||
function checkBullet(state) {
|
||
const marker = state.options.bullet || "*";
|
||
if (marker !== "*" && marker !== "+" && marker !== "-") {
|
||
throw new Error(
|
||
"Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
|
||
function checkBulletOther(state) {
|
||
const bullet = checkBullet(state);
|
||
const bulletOther = state.options.bulletOther;
|
||
if (!bulletOther) {
|
||
return bullet === "*" ? "-" : "*";
|
||
}
|
||
if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
|
||
throw new Error(
|
||
"Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
|
||
);
|
||
}
|
||
if (bulletOther === bullet) {
|
||
throw new Error(
|
||
"Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
|
||
);
|
||
}
|
||
return bulletOther;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
|
||
function checkBulletOrdered(state) {
|
||
const marker = state.options.bulletOrdered || ".";
|
||
if (marker !== "." && marker !== ")") {
|
||
throw new Error(
|
||
"Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-rule.js
|
||
function checkRule(state) {
|
||
const marker = state.options.rule || "*";
|
||
if (marker !== "*" && marker !== "-" && marker !== "_") {
|
||
throw new Error(
|
||
"Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/list.js
|
||
function list(node2, parent, state, info) {
|
||
const exit2 = state.enter("list");
|
||
const bulletCurrent = state.bulletCurrent;
|
||
let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
|
||
const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
|
||
let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
|
||
if (!node2.ordered) {
|
||
const firstListItem = node2.children ? node2.children[0] : void 0;
|
||
if (
|
||
// Bullet could be used as a thematic break marker:
|
||
(bullet === "*" || bullet === "-") && // Empty first list item:
|
||
firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
|
||
state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
|
||
state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
|
||
) {
|
||
useDifferentMarker = true;
|
||
}
|
||
if (checkRule(state) === bullet && firstListItem) {
|
||
let index2 = -1;
|
||
while (++index2 < node2.children.length) {
|
||
const item = node2.children[index2];
|
||
if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
|
||
useDifferentMarker = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (useDifferentMarker) {
|
||
bullet = bulletOther;
|
||
}
|
||
state.bulletCurrent = bullet;
|
||
const value = state.containerFlow(node2, info);
|
||
state.bulletLastUsed = bullet;
|
||
state.bulletCurrent = bulletCurrent;
|
||
exit2();
|
||
return value;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
||
function checkListItemIndent(state) {
|
||
const style = state.options.listItemIndent || "one";
|
||
if (style !== "tab" && style !== "one" && style !== "mixed") {
|
||
throw new Error(
|
||
"Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
|
||
);
|
||
}
|
||
return style;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/list-item.js
|
||
function listItem(node2, parent, state, info) {
|
||
const listItemIndent = checkListItemIndent(state);
|
||
let bullet = state.bulletCurrent || checkBullet(state);
|
||
if (parent && parent.type === "list" && parent.ordered) {
|
||
bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
|
||
}
|
||
let size = bullet.length + 1;
|
||
if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
|
||
size = Math.ceil(size / 4) * 4;
|
||
}
|
||
const tracker = state.createTracker(info);
|
||
tracker.move(bullet + " ".repeat(size - bullet.length));
|
||
tracker.shift(size);
|
||
const exit2 = state.enter("listItem");
|
||
const value = state.indentLines(
|
||
state.containerFlow(node2, tracker.current()),
|
||
map3
|
||
);
|
||
exit2();
|
||
return value;
|
||
function map3(line, index2, blank) {
|
||
if (index2) {
|
||
return (blank ? "" : " ".repeat(size)) + line;
|
||
}
|
||
return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
|
||
}
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
|
||
function paragraph(node2, _, state, info) {
|
||
const exit2 = state.enter("paragraph");
|
||
const subexit = state.enter("phrasing");
|
||
const value = state.containerPhrasing(node2, info);
|
||
subexit();
|
||
exit2();
|
||
return value;
|
||
}
|
||
|
||
// node_modules/mdast-util-phrasing/lib/index.js
|
||
var phrasing = (
|
||
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
||
convert([
|
||
"break",
|
||
"delete",
|
||
"emphasis",
|
||
// To do: next major: removed since footnotes were added to GFM.
|
||
"footnote",
|
||
"footnoteReference",
|
||
"image",
|
||
"imageReference",
|
||
"inlineCode",
|
||
// Enabled by `mdast-util-math`:
|
||
"inlineMath",
|
||
"link",
|
||
"linkReference",
|
||
// Enabled by `mdast-util-mdx`:
|
||
"mdxJsxTextElement",
|
||
// Enabled by `mdast-util-mdx`:
|
||
"mdxTextExpression",
|
||
"strong",
|
||
"text",
|
||
// Enabled by `mdast-util-directive`:
|
||
"textDirective"
|
||
])
|
||
);
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/root.js
|
||
function root(node2, _, state, info) {
|
||
const hasPhrasing = node2.children.some(function(d) {
|
||
return phrasing(d);
|
||
});
|
||
const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
|
||
return container.call(state, node2, info);
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-strong.js
|
||
function checkStrong(state) {
|
||
const marker = state.options.strong || "*";
|
||
if (marker !== "*" && marker !== "_") {
|
||
throw new Error(
|
||
"Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
|
||
);
|
||
}
|
||
return marker;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/strong.js
|
||
strong.peek = strongPeek;
|
||
function strong(node2, _, state, info) {
|
||
const marker = checkStrong(state);
|
||
const exit2 = state.enter("strong");
|
||
const tracker = state.createTracker(info);
|
||
const before = tracker.move(marker + marker);
|
||
let between = tracker.move(
|
||
state.containerPhrasing(node2, {
|
||
after: marker,
|
||
before,
|
||
...tracker.current()
|
||
})
|
||
);
|
||
const betweenHead = between.charCodeAt(0);
|
||
const open = encodeInfo(
|
||
info.before.charCodeAt(info.before.length - 1),
|
||
betweenHead,
|
||
marker
|
||
);
|
||
if (open.inside) {
|
||
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
||
}
|
||
const betweenTail = between.charCodeAt(between.length - 1);
|
||
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
||
if (close.inside) {
|
||
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
||
}
|
||
const after = tracker.move(marker + marker);
|
||
exit2();
|
||
state.attentionEncodeSurroundingInfo = {
|
||
after: close.outside,
|
||
before: open.outside
|
||
};
|
||
return before + between + after;
|
||
}
|
||
function strongPeek(_, _1, state) {
|
||
return state.options.strong || "*";
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/text.js
|
||
function text(node2, _, state, info) {
|
||
return state.safe(node2.value, info);
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
|
||
function checkRuleRepetition(state) {
|
||
const repetition = state.options.ruleRepetition || 3;
|
||
if (repetition < 3) {
|
||
throw new Error(
|
||
"Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
|
||
);
|
||
}
|
||
return repetition;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
|
||
function thematicBreak(_, _1, state) {
|
||
const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
|
||
return state.options.ruleSpaces ? value.slice(0, -1) : value;
|
||
}
|
||
|
||
// node_modules/mdast-util-to-markdown/lib/handle/index.js
|
||
var handle = {
|
||
blockquote,
|
||
break: hardBreak,
|
||
code,
|
||
definition,
|
||
emphasis,
|
||
hardBreak,
|
||
heading,
|
||
html,
|
||
image,
|
||
imageReference,
|
||
inlineCode,
|
||
link,
|
||
linkReference,
|
||
list,
|
||
listItem,
|
||
paragraph,
|
||
root,
|
||
strong,
|
||
text,
|
||
thematicBreak
|
||
};
|
||
|
||
// node_modules/mdast-util-gfm-table/lib/index.js
|
||
function gfmTableFromMarkdown() {
|
||
return {
|
||
enter: {
|
||
table: enterTable,
|
||
tableData: enterCell,
|
||
tableHeader: enterCell,
|
||
tableRow: enterRow
|
||
},
|
||
exit: {
|
||
codeText: exitCodeText,
|
||
table: exitTable,
|
||
tableData: exit,
|
||
tableHeader: exit,
|
||
tableRow: exit
|
||
}
|
||
};
|
||
}
|
||
function enterTable(token) {
|
||
const align = token._align;
|
||
this.enter(
|
||
{
|
||
type: "table",
|
||
align: align.map(function(d) {
|
||
return d === "none" ? null : d;
|
||
}),
|
||
children: []
|
||
},
|
||
token
|
||
);
|
||
this.data.inTable = true;
|
||
}
|
||
function exitTable(token) {
|
||
this.exit(token);
|
||
this.data.inTable = void 0;
|
||
}
|
||
function enterRow(token) {
|
||
this.enter({ type: "tableRow", children: [] }, token);
|
||
}
|
||
function exit(token) {
|
||
this.exit(token);
|
||
}
|
||
function enterCell(token) {
|
||
this.enter({ type: "tableCell", children: [] }, token);
|
||
}
|
||
function exitCodeText(token) {
|
||
let value = this.resume();
|
||
if (this.data.inTable) {
|
||
value = value.replace(/\\([\\|])/g, replace);
|
||
}
|
||
const node2 = this.stack[this.stack.length - 1];
|
||
ok(node2.type === "inlineCode");
|
||
node2.value = value;
|
||
this.exit(token);
|
||
}
|
||
function replace($0, $1) {
|
||
return $1 === "|" ? $1 : $0;
|
||
}
|
||
function gfmTableToMarkdown(options) {
|
||
const settings = options || {};
|
||
const padding = settings.tableCellPadding;
|
||
const alignDelimiters = settings.tablePipeAlign;
|
||
const stringLength = settings.stringLength;
|
||
const around = padding ? " " : "|";
|
||
return {
|
||
unsafe: [
|
||
{ character: "\r", inConstruct: "tableCell" },
|
||
{ character: "\n", inConstruct: "tableCell" },
|
||
// A pipe, when followed by a tab or space (padding), or a dash or colon
|
||
// (unpadded delimiter row), could result in a table.
|
||
{ atBreak: true, character: "|", after: "[ :-]" },
|
||
// A pipe in a cell must be encoded.
|
||
{ character: "|", inConstruct: "tableCell" },
|
||
// A colon must be followed by a dash, in which case it could start a
|
||
// delimiter row.
|
||
{ atBreak: true, character: ":", after: "-" },
|
||
// A delimiter row can also start with a dash, when followed by more
|
||
// dashes, a colon, or a pipe.
|
||
// This is a stricter version than the built in check for lists, thematic
|
||
// breaks, and setex heading underlines though:
|
||
// <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
|
||
{ atBreak: true, character: "-", after: "[:|-]" }
|
||
],
|
||
handlers: {
|
||
inlineCode: inlineCodeWithTable,
|
||
table: handleTable,
|
||
tableCell: handleTableCell,
|
||
tableRow: handleTableRow
|
||
}
|
||
};
|
||
function handleTable(node2, _, state, info) {
|
||
return serializeData(handleTableAsData(node2, state, info), node2.align);
|
||
}
|
||
function handleTableRow(node2, _, state, info) {
|
||
const row = handleTableRowAsData(node2, state, info);
|
||
const value = serializeData([row]);
|
||
return value.slice(0, value.indexOf("\n"));
|
||
}
|
||
function handleTableCell(node2, _, state, info) {
|
||
const exit2 = state.enter("tableCell");
|
||
const subexit = state.enter("phrasing");
|
||
const value = state.containerPhrasing(node2, {
|
||
...info,
|
||
before: around,
|
||
after: around
|
||
});
|
||
subexit();
|
||
exit2();
|
||
return value;
|
||
}
|
||
function serializeData(matrix, align) {
|
||
return markdownTable(matrix, {
|
||
align,
|
||
// @ts-expect-error: `markdown-table` types should support `null`.
|
||
alignDelimiters,
|
||
// @ts-expect-error: `markdown-table` types should support `null`.
|
||
padding,
|
||
// @ts-expect-error: `markdown-table` types should support `null`.
|
||
stringLength
|
||
});
|
||
}
|
||
function handleTableAsData(node2, state, info) {
|
||
const children = node2.children;
|
||
let index2 = -1;
|
||
const result = [];
|
||
const subexit = state.enter("table");
|
||
while (++index2 < children.length) {
|
||
result[index2] = handleTableRowAsData(children[index2], state, info);
|
||
}
|
||
subexit();
|
||
return result;
|
||
}
|
||
function handleTableRowAsData(node2, state, info) {
|
||
const children = node2.children;
|
||
let index2 = -1;
|
||
const result = [];
|
||
const subexit = state.enter("tableRow");
|
||
while (++index2 < children.length) {
|
||
result[index2] = handleTableCell(children[index2], node2, state, info);
|
||
}
|
||
subexit();
|
||
return result;
|
||
}
|
||
function inlineCodeWithTable(node2, parent, state) {
|
||
let value = handle.inlineCode(node2, parent, state);
|
||
if (state.stack.includes("tableCell")) {
|
||
value = value.replace(/\|/g, "\\$&");
|
||
}
|
||
return value;
|
||
}
|
||
}
|
||
|
||
// node_modules/mdast-util-gfm-task-list-item/lib/index.js
|
||
function gfmTaskListItemFromMarkdown() {
|
||
return {
|
||
exit: {
|
||
taskListCheckValueChecked: exitCheck,
|
||
taskListCheckValueUnchecked: exitCheck,
|
||
paragraph: exitParagraphWithTaskListItem
|
||
}
|
||
};
|
||
}
|
||
function gfmTaskListItemToMarkdown() {
|
||
return {
|
||
unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
|
||
handlers: { listItem: listItemWithTaskListItem }
|
||
};
|
||
}
|
||
function exitCheck(token) {
|
||
const node2 = this.stack[this.stack.length - 2];
|
||
ok(node2.type === "listItem");
|
||
node2.checked = token.type === "taskListCheckValueChecked";
|
||
}
|
||
function exitParagraphWithTaskListItem(token) {
|
||
const parent = this.stack[this.stack.length - 2];
|
||
if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
|
||
const node2 = this.stack[this.stack.length - 1];
|
||
ok(node2.type === "paragraph");
|
||
const head = node2.children[0];
|
||
if (head && head.type === "text") {
|
||
const siblings = parent.children;
|
||
let index2 = -1;
|
||
let firstParaghraph;
|
||
while (++index2 < siblings.length) {
|
||
const sibling = siblings[index2];
|
||
if (sibling.type === "paragraph") {
|
||
firstParaghraph = sibling;
|
||
break;
|
||
}
|
||
}
|
||
if (firstParaghraph === node2) {
|
||
head.value = head.value.slice(1);
|
||
if (head.value.length === 0) {
|
||
node2.children.shift();
|
||
} else if (node2.position && head.position && typeof head.position.start.offset === "number") {
|
||
head.position.start.column++;
|
||
head.position.start.offset++;
|
||
node2.position.start = Object.assign({}, head.position.start);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
this.exit(token);
|
||
}
|
||
function listItemWithTaskListItem(node2, parent, state, info) {
|
||
const head = node2.children[0];
|
||
const checkable = typeof node2.checked === "boolean" && head && head.type === "paragraph";
|
||
const checkbox = "[" + (node2.checked ? "x" : " ") + "] ";
|
||
const tracker = state.createTracker(info);
|
||
if (checkable) {
|
||
tracker.move(checkbox);
|
||
}
|
||
let value = handle.listItem(node2, parent, state, {
|
||
...info,
|
||
...tracker.current()
|
||
});
|
||
if (checkable) {
|
||
value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check2);
|
||
}
|
||
return value;
|
||
function check2($0) {
|
||
return $0 + checkbox;
|
||
}
|
||
}
|
||
|
||
// node_modules/mdast-util-gfm/lib/index.js
|
||
function gfmFromMarkdown() {
|
||
return [
|
||
gfmAutolinkLiteralFromMarkdown(),
|
||
gfmFootnoteFromMarkdown(),
|
||
gfmStrikethroughFromMarkdown(),
|
||
gfmTableFromMarkdown(),
|
||
gfmTaskListItemFromMarkdown()
|
||
];
|
||
}
|
||
function gfmToMarkdown(options) {
|
||
return {
|
||
extensions: [
|
||
gfmAutolinkLiteralToMarkdown(),
|
||
gfmFootnoteToMarkdown(options),
|
||
gfmStrikethroughToMarkdown(),
|
||
gfmTableToMarkdown(options),
|
||
gfmTaskListItemToMarkdown()
|
||
]
|
||
};
|
||
}
|
||
|
||
// node_modules/micromark-util-chunked/index.js
|
||
function splice(list2, start, remove, items) {
|
||
const end = list2.length;
|
||
let chunkStart = 0;
|
||
let parameters;
|
||
if (start < 0) {
|
||
start = -start > end ? 0 : end + start;
|
||
} else {
|
||
start = start > end ? end : start;
|
||
}
|
||
remove = remove > 0 ? remove : 0;
|
||
if (items.length < 1e4) {
|
||
parameters = Array.from(items);
|
||
parameters.unshift(start, remove);
|
||
list2.splice(...parameters);
|
||
} else {
|
||
if (remove) list2.splice(start, remove);
|
||
while (chunkStart < items.length) {
|
||
parameters = items.slice(chunkStart, chunkStart + 1e4);
|
||
parameters.unshift(start, 0);
|
||
list2.splice(...parameters);
|
||
chunkStart += 1e4;
|
||
start += 1e4;
|
||
}
|
||
}
|
||
}
|
||
|
||
// node_modules/micromark-util-combine-extensions/index.js
|
||
var hasOwnProperty = {}.hasOwnProperty;
|
||
function combineExtensions(extensions) {
|
||
const all3 = {};
|
||
let index2 = -1;
|
||
while (++index2 < extensions.length) {
|
||
syntaxExtension(all3, extensions[index2]);
|
||
}
|
||
return all3;
|
||
}
|
||
function syntaxExtension(all3, extension) {
|
||
let hook;
|
||
for (hook in extension) {
|
||
const maybe = hasOwnProperty.call(all3, hook) ? all3[hook] : void 0;
|
||
const left = maybe || (all3[hook] = {});
|
||
const right = extension[hook];
|
||
let code3;
|
||
if (right) {
|
||
for (code3 in right) {
|
||
if (!hasOwnProperty.call(left, code3)) left[code3] = [];
|
||
const value = right[code3];
|
||
constructs(
|
||
// @ts-expect-error Looks like a list.
|
||
left[code3],
|
||
Array.isArray(value) ? value : value ? [value] : []
|
||
);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
function constructs(existing, list2) {
|
||
let index2 = -1;
|
||
const before = [];
|
||
while (++index2 < list2.length) {
|
||
(list2[index2].add === "after" ? existing : before).push(list2[index2]);
|
||
}
|
||
splice(existing, 0, 0, before);
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
|
||
var wwwPrefix = {
|
||
tokenize: tokenizeWwwPrefix,
|
||
partial: true
|
||
};
|
||
var domain = {
|
||
tokenize: tokenizeDomain,
|
||
partial: true
|
||
};
|
||
var path = {
|
||
tokenize: tokenizePath,
|
||
partial: true
|
||
};
|
||
var trail = {
|
||
tokenize: tokenizeTrail,
|
||
partial: true
|
||
};
|
||
var emailDomainDotTrail = {
|
||
tokenize: tokenizeEmailDomainDotTrail,
|
||
partial: true
|
||
};
|
||
var wwwAutolink = {
|
||
name: "wwwAutolink",
|
||
tokenize: tokenizeWwwAutolink,
|
||
previous: previousWww
|
||
};
|
||
var protocolAutolink = {
|
||
name: "protocolAutolink",
|
||
tokenize: tokenizeProtocolAutolink,
|
||
previous: previousProtocol
|
||
};
|
||
var emailAutolink = {
|
||
name: "emailAutolink",
|
||
tokenize: tokenizeEmailAutolink,
|
||
previous: previousEmail
|
||
};
|
||
var text2 = {};
|
||
function gfmAutolinkLiteral() {
|
||
return {
|
||
text: text2
|
||
};
|
||
}
|
||
var code2 = 48;
|
||
while (code2 < 123) {
|
||
text2[code2] = emailAutolink;
|
||
code2++;
|
||
if (code2 === 58) code2 = 65;
|
||
else if (code2 === 91) code2 = 97;
|
||
}
|
||
text2[43] = emailAutolink;
|
||
text2[45] = emailAutolink;
|
||
text2[46] = emailAutolink;
|
||
text2[95] = emailAutolink;
|
||
text2[72] = [emailAutolink, protocolAutolink];
|
||
text2[104] = [emailAutolink, protocolAutolink];
|
||
text2[87] = [emailAutolink, wwwAutolink];
|
||
text2[119] = [emailAutolink, wwwAutolink];
|
||
function tokenizeEmailAutolink(effects, ok3, nok) {
|
||
const self2 = this;
|
||
let dot;
|
||
let data;
|
||
return start;
|
||
function start(code3) {
|
||
if (!gfmAtext(code3) || !previousEmail.call(self2, self2.previous) || previousUnbalanced(self2.events)) {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("literalAutolink");
|
||
effects.enter("literalAutolinkEmail");
|
||
return atext(code3);
|
||
}
|
||
function atext(code3) {
|
||
if (gfmAtext(code3)) {
|
||
effects.consume(code3);
|
||
return atext;
|
||
}
|
||
if (code3 === 64) {
|
||
effects.consume(code3);
|
||
return emailDomain;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function emailDomain(code3) {
|
||
if (code3 === 46) {
|
||
return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code3);
|
||
}
|
||
if (code3 === 45 || code3 === 95 || asciiAlphanumeric(code3)) {
|
||
data = true;
|
||
effects.consume(code3);
|
||
return emailDomain;
|
||
}
|
||
return emailDomainAfter(code3);
|
||
}
|
||
function emailDomainDot(code3) {
|
||
effects.consume(code3);
|
||
dot = true;
|
||
return emailDomain;
|
||
}
|
||
function emailDomainAfter(code3) {
|
||
if (data && dot && asciiAlpha(self2.previous)) {
|
||
effects.exit("literalAutolinkEmail");
|
||
effects.exit("literalAutolink");
|
||
return ok3(code3);
|
||
}
|
||
return nok(code3);
|
||
}
|
||
}
|
||
function tokenizeWwwAutolink(effects, ok3, nok) {
|
||
const self2 = this;
|
||
return wwwStart;
|
||
function wwwStart(code3) {
|
||
if (code3 !== 87 && code3 !== 119 || !previousWww.call(self2, self2.previous) || previousUnbalanced(self2.events)) {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("literalAutolink");
|
||
effects.enter("literalAutolinkWww");
|
||
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code3);
|
||
}
|
||
function wwwAfter(code3) {
|
||
effects.exit("literalAutolinkWww");
|
||
effects.exit("literalAutolink");
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
function tokenizeProtocolAutolink(effects, ok3, nok) {
|
||
const self2 = this;
|
||
let buffer = "";
|
||
let seen = false;
|
||
return protocolStart;
|
||
function protocolStart(code3) {
|
||
if ((code3 === 72 || code3 === 104) && previousProtocol.call(self2, self2.previous) && !previousUnbalanced(self2.events)) {
|
||
effects.enter("literalAutolink");
|
||
effects.enter("literalAutolinkHttp");
|
||
buffer += String.fromCodePoint(code3);
|
||
effects.consume(code3);
|
||
return protocolPrefixInside;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function protocolPrefixInside(code3) {
|
||
if (asciiAlpha(code3) && buffer.length < 5) {
|
||
buffer += String.fromCodePoint(code3);
|
||
effects.consume(code3);
|
||
return protocolPrefixInside;
|
||
}
|
||
if (code3 === 58) {
|
||
const protocol = buffer.toLowerCase();
|
||
if (protocol === "http" || protocol === "https") {
|
||
effects.consume(code3);
|
||
return protocolSlashesInside;
|
||
}
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function protocolSlashesInside(code3) {
|
||
if (code3 === 47) {
|
||
effects.consume(code3);
|
||
if (seen) {
|
||
return afterProtocol;
|
||
}
|
||
seen = true;
|
||
return protocolSlashesInside;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function afterProtocol(code3) {
|
||
return code3 === null || asciiControl(code3) || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || unicodePunctuation(code3) ? nok(code3) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code3);
|
||
}
|
||
function protocolAfter(code3) {
|
||
effects.exit("literalAutolinkHttp");
|
||
effects.exit("literalAutolink");
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
function tokenizeWwwPrefix(effects, ok3, nok) {
|
||
let size = 0;
|
||
return wwwPrefixInside;
|
||
function wwwPrefixInside(code3) {
|
||
if ((code3 === 87 || code3 === 119) && size < 3) {
|
||
size++;
|
||
effects.consume(code3);
|
||
return wwwPrefixInside;
|
||
}
|
||
if (code3 === 46 && size === 3) {
|
||
effects.consume(code3);
|
||
return wwwPrefixAfter;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function wwwPrefixAfter(code3) {
|
||
return code3 === null ? nok(code3) : ok3(code3);
|
||
}
|
||
}
|
||
function tokenizeDomain(effects, ok3, nok) {
|
||
let underscoreInLastSegment;
|
||
let underscoreInLastLastSegment;
|
||
let seen;
|
||
return domainInside;
|
||
function domainInside(code3) {
|
||
if (code3 === 46 || code3 === 95) {
|
||
return effects.check(trail, domainAfter, domainAtPunctuation)(code3);
|
||
}
|
||
if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || code3 !== 45 && unicodePunctuation(code3)) {
|
||
return domainAfter(code3);
|
||
}
|
||
seen = true;
|
||
effects.consume(code3);
|
||
return domainInside;
|
||
}
|
||
function domainAtPunctuation(code3) {
|
||
if (code3 === 95) {
|
||
underscoreInLastSegment = true;
|
||
} else {
|
||
underscoreInLastLastSegment = underscoreInLastSegment;
|
||
underscoreInLastSegment = void 0;
|
||
}
|
||
effects.consume(code3);
|
||
return domainInside;
|
||
}
|
||
function domainAfter(code3) {
|
||
if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
|
||
return nok(code3);
|
||
}
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
function tokenizePath(effects, ok3) {
|
||
let sizeOpen = 0;
|
||
let sizeClose = 0;
|
||
return pathInside;
|
||
function pathInside(code3) {
|
||
if (code3 === 40) {
|
||
sizeOpen++;
|
||
effects.consume(code3);
|
||
return pathInside;
|
||
}
|
||
if (code3 === 41 && sizeClose < sizeOpen) {
|
||
return pathAtPunctuation(code3);
|
||
}
|
||
if (code3 === 33 || code3 === 34 || code3 === 38 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 60 || code3 === 63 || code3 === 93 || code3 === 95 || code3 === 126) {
|
||
return effects.check(trail, ok3, pathAtPunctuation)(code3);
|
||
}
|
||
if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
|
||
return ok3(code3);
|
||
}
|
||
effects.consume(code3);
|
||
return pathInside;
|
||
}
|
||
function pathAtPunctuation(code3) {
|
||
if (code3 === 41) {
|
||
sizeClose++;
|
||
}
|
||
effects.consume(code3);
|
||
return pathInside;
|
||
}
|
||
}
|
||
function tokenizeTrail(effects, ok3, nok) {
|
||
return trail2;
|
||
function trail2(code3) {
|
||
if (code3 === 33 || code3 === 34 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 63 || code3 === 95 || code3 === 126) {
|
||
effects.consume(code3);
|
||
return trail2;
|
||
}
|
||
if (code3 === 38) {
|
||
effects.consume(code3);
|
||
return trailCharacterReferenceStart;
|
||
}
|
||
if (code3 === 93) {
|
||
effects.consume(code3);
|
||
return trailBracketAfter;
|
||
}
|
||
if (
|
||
// `<` is an end.
|
||
code3 === 60 || // So is whitespace.
|
||
code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)
|
||
) {
|
||
return ok3(code3);
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function trailBracketAfter(code3) {
|
||
if (code3 === null || code3 === 40 || code3 === 91 || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
|
||
return ok3(code3);
|
||
}
|
||
return trail2(code3);
|
||
}
|
||
function trailCharacterReferenceStart(code3) {
|
||
return asciiAlpha(code3) ? trailCharacterReferenceInside(code3) : nok(code3);
|
||
}
|
||
function trailCharacterReferenceInside(code3) {
|
||
if (code3 === 59) {
|
||
effects.consume(code3);
|
||
return trail2;
|
||
}
|
||
if (asciiAlpha(code3)) {
|
||
effects.consume(code3);
|
||
return trailCharacterReferenceInside;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
}
|
||
function tokenizeEmailDomainDotTrail(effects, ok3, nok) {
|
||
return start;
|
||
function start(code3) {
|
||
effects.consume(code3);
|
||
return after;
|
||
}
|
||
function after(code3) {
|
||
return asciiAlphanumeric(code3) ? nok(code3) : ok3(code3);
|
||
}
|
||
}
|
||
function previousWww(code3) {
|
||
return code3 === null || code3 === 40 || code3 === 42 || code3 === 95 || code3 === 91 || code3 === 93 || code3 === 126 || markdownLineEndingOrSpace(code3);
|
||
}
|
||
function previousProtocol(code3) {
|
||
return !asciiAlpha(code3);
|
||
}
|
||
function previousEmail(code3) {
|
||
return !(code3 === 47 || gfmAtext(code3));
|
||
}
|
||
function gfmAtext(code3) {
|
||
return code3 === 43 || code3 === 45 || code3 === 46 || code3 === 95 || asciiAlphanumeric(code3);
|
||
}
|
||
function previousUnbalanced(events) {
|
||
let index2 = events.length;
|
||
let result = false;
|
||
while (index2--) {
|
||
const token = events[index2][1];
|
||
if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) {
|
||
result = true;
|
||
break;
|
||
}
|
||
if (token._gfmAutolinkLiteralWalkedInto) {
|
||
result = false;
|
||
break;
|
||
}
|
||
}
|
||
if (events.length > 0 && !result) {
|
||
events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;
|
||
}
|
||
return result;
|
||
}
|
||
|
||
// node_modules/micromark-util-resolve-all/index.js
|
||
function resolveAll(constructs2, events, context) {
|
||
const called = [];
|
||
let index2 = -1;
|
||
while (++index2 < constructs2.length) {
|
||
const resolve = constructs2[index2].resolveAll;
|
||
if (resolve && !called.includes(resolve)) {
|
||
events = resolve(events, context);
|
||
called.push(resolve);
|
||
}
|
||
}
|
||
return events;
|
||
}
|
||
|
||
// node_modules/micromark-factory-space/index.js
|
||
function factorySpace(effects, ok3, type, max) {
|
||
const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
|
||
let size = 0;
|
||
return start;
|
||
function start(code3) {
|
||
if (markdownSpace(code3)) {
|
||
effects.enter(type);
|
||
return prefix(code3);
|
||
}
|
||
return ok3(code3);
|
||
}
|
||
function prefix(code3) {
|
||
if (markdownSpace(code3) && size++ < limit) {
|
||
effects.consume(code3);
|
||
return prefix;
|
||
}
|
||
effects.exit(type);
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
|
||
// node_modules/micromark-core-commonmark/lib/blank-line.js
|
||
var blankLine = {
|
||
partial: true,
|
||
tokenize: tokenizeBlankLine
|
||
};
|
||
function tokenizeBlankLine(effects, ok3, nok) {
|
||
return start;
|
||
function start(code3) {
|
||
return markdownSpace(code3) ? factorySpace(effects, after, "linePrefix")(code3) : after(code3);
|
||
}
|
||
function after(code3) {
|
||
return code3 === null || markdownLineEnding(code3) ? ok3(code3) : nok(code3);
|
||
}
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-footnote/lib/syntax.js
|
||
var indent = {
|
||
tokenize: tokenizeIndent,
|
||
partial: true
|
||
};
|
||
function gfmFootnote() {
|
||
return {
|
||
document: {
|
||
[91]: {
|
||
name: "gfmFootnoteDefinition",
|
||
tokenize: tokenizeDefinitionStart,
|
||
continuation: {
|
||
tokenize: tokenizeDefinitionContinuation
|
||
},
|
||
exit: gfmFootnoteDefinitionEnd
|
||
}
|
||
},
|
||
text: {
|
||
[91]: {
|
||
name: "gfmFootnoteCall",
|
||
tokenize: tokenizeGfmFootnoteCall
|
||
},
|
||
[93]: {
|
||
name: "gfmPotentialFootnoteCall",
|
||
add: "after",
|
||
tokenize: tokenizePotentialGfmFootnoteCall,
|
||
resolveTo: resolveToPotentialGfmFootnoteCall
|
||
}
|
||
}
|
||
};
|
||
}
|
||
function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) {
|
||
const self2 = this;
|
||
let index2 = self2.events.length;
|
||
const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []);
|
||
let labelStart;
|
||
while (index2--) {
|
||
const token = self2.events[index2][1];
|
||
if (token.type === "labelImage") {
|
||
labelStart = token;
|
||
break;
|
||
}
|
||
if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") {
|
||
break;
|
||
}
|
||
}
|
||
return start;
|
||
function start(code3) {
|
||
if (!labelStart || !labelStart._balanced) {
|
||
return nok(code3);
|
||
}
|
||
const id = normalizeIdentifier(self2.sliceSerialize({
|
||
start: labelStart.end,
|
||
end: self2.now()
|
||
}));
|
||
if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("gfmFootnoteCallLabelMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteCallLabelMarker");
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
function resolveToPotentialGfmFootnoteCall(events, context) {
|
||
let index2 = events.length;
|
||
while (index2--) {
|
||
if (events[index2][1].type === "labelImage" && events[index2][0] === "enter") {
|
||
events[index2][1];
|
||
break;
|
||
}
|
||
}
|
||
events[index2 + 1][1].type = "data";
|
||
events[index2 + 3][1].type = "gfmFootnoteCallLabelMarker";
|
||
const call = {
|
||
type: "gfmFootnoteCall",
|
||
start: Object.assign({}, events[index2 + 3][1].start),
|
||
end: Object.assign({}, events[events.length - 1][1].end)
|
||
};
|
||
const marker = {
|
||
type: "gfmFootnoteCallMarker",
|
||
start: Object.assign({}, events[index2 + 3][1].end),
|
||
end: Object.assign({}, events[index2 + 3][1].end)
|
||
};
|
||
marker.end.column++;
|
||
marker.end.offset++;
|
||
marker.end._bufferIndex++;
|
||
const string = {
|
||
type: "gfmFootnoteCallString",
|
||
start: Object.assign({}, marker.end),
|
||
end: Object.assign({}, events[events.length - 1][1].start)
|
||
};
|
||
const chunk = {
|
||
type: "chunkString",
|
||
contentType: "string",
|
||
start: Object.assign({}, string.start),
|
||
end: Object.assign({}, string.end)
|
||
};
|
||
const replacement = [
|
||
// Take the `labelImageMarker` (now `data`, the `!`)
|
||
events[index2 + 1],
|
||
events[index2 + 2],
|
||
["enter", call, context],
|
||
// The `[`
|
||
events[index2 + 3],
|
||
events[index2 + 4],
|
||
// The `^`.
|
||
["enter", marker, context],
|
||
["exit", marker, context],
|
||
// Everything in between.
|
||
["enter", string, context],
|
||
["enter", chunk, context],
|
||
["exit", chunk, context],
|
||
["exit", string, context],
|
||
// The ending (`]`, properly parsed and labelled).
|
||
events[events.length - 2],
|
||
events[events.length - 1],
|
||
["exit", call, context]
|
||
];
|
||
events.splice(index2, events.length - index2 + 1, ...replacement);
|
||
return events;
|
||
}
|
||
function tokenizeGfmFootnoteCall(effects, ok3, nok) {
|
||
const self2 = this;
|
||
const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []);
|
||
let size = 0;
|
||
let data;
|
||
return start;
|
||
function start(code3) {
|
||
effects.enter("gfmFootnoteCall");
|
||
effects.enter("gfmFootnoteCallLabelMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteCallLabelMarker");
|
||
return callStart;
|
||
}
|
||
function callStart(code3) {
|
||
if (code3 !== 94) return nok(code3);
|
||
effects.enter("gfmFootnoteCallMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteCallMarker");
|
||
effects.enter("gfmFootnoteCallString");
|
||
effects.enter("chunkString").contentType = "string";
|
||
return callData;
|
||
}
|
||
function callData(code3) {
|
||
if (
|
||
// Too long.
|
||
size > 999 || // Closing brace with nothing.
|
||
code3 === 93 && !data || // Space or tab is not supported by GFM for some reason.
|
||
// `\n` and `[` not being supported makes sense.
|
||
code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3)
|
||
) {
|
||
return nok(code3);
|
||
}
|
||
if (code3 === 93) {
|
||
effects.exit("chunkString");
|
||
const token = effects.exit("gfmFootnoteCallString");
|
||
if (!defined.includes(normalizeIdentifier(self2.sliceSerialize(token)))) {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("gfmFootnoteCallLabelMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteCallLabelMarker");
|
||
effects.exit("gfmFootnoteCall");
|
||
return ok3;
|
||
}
|
||
if (!markdownLineEndingOrSpace(code3)) {
|
||
data = true;
|
||
}
|
||
size++;
|
||
effects.consume(code3);
|
||
return code3 === 92 ? callEscape : callData;
|
||
}
|
||
function callEscape(code3) {
|
||
if (code3 === 91 || code3 === 92 || code3 === 93) {
|
||
effects.consume(code3);
|
||
size++;
|
||
return callData;
|
||
}
|
||
return callData(code3);
|
||
}
|
||
}
|
||
function tokenizeDefinitionStart(effects, ok3, nok) {
|
||
const self2 = this;
|
||
const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []);
|
||
let identifier;
|
||
let size = 0;
|
||
let data;
|
||
return start;
|
||
function start(code3) {
|
||
effects.enter("gfmFootnoteDefinition")._container = true;
|
||
effects.enter("gfmFootnoteDefinitionLabel");
|
||
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
||
return labelAtMarker;
|
||
}
|
||
function labelAtMarker(code3) {
|
||
if (code3 === 94) {
|
||
effects.enter("gfmFootnoteDefinitionMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteDefinitionMarker");
|
||
effects.enter("gfmFootnoteDefinitionLabelString");
|
||
effects.enter("chunkString").contentType = "string";
|
||
return labelInside;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function labelInside(code3) {
|
||
if (
|
||
// Too long.
|
||
size > 999 || // Closing brace with nothing.
|
||
code3 === 93 && !data || // Space or tab is not supported by GFM for some reason.
|
||
// `\n` and `[` not being supported makes sense.
|
||
code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3)
|
||
) {
|
||
return nok(code3);
|
||
}
|
||
if (code3 === 93) {
|
||
effects.exit("chunkString");
|
||
const token = effects.exit("gfmFootnoteDefinitionLabelString");
|
||
identifier = normalizeIdentifier(self2.sliceSerialize(token));
|
||
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
||
effects.consume(code3);
|
||
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
||
effects.exit("gfmFootnoteDefinitionLabel");
|
||
return labelAfter;
|
||
}
|
||
if (!markdownLineEndingOrSpace(code3)) {
|
||
data = true;
|
||
}
|
||
size++;
|
||
effects.consume(code3);
|
||
return code3 === 92 ? labelEscape : labelInside;
|
||
}
|
||
function labelEscape(code3) {
|
||
if (code3 === 91 || code3 === 92 || code3 === 93) {
|
||
effects.consume(code3);
|
||
size++;
|
||
return labelInside;
|
||
}
|
||
return labelInside(code3);
|
||
}
|
||
function labelAfter(code3) {
|
||
if (code3 === 58) {
|
||
effects.enter("definitionMarker");
|
||
effects.consume(code3);
|
||
effects.exit("definitionMarker");
|
||
if (!defined.includes(identifier)) {
|
||
defined.push(identifier);
|
||
}
|
||
return factorySpace(effects, whitespaceAfter, "gfmFootnoteDefinitionWhitespace");
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function whitespaceAfter(code3) {
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
function tokenizeDefinitionContinuation(effects, ok3, nok) {
|
||
return effects.check(blankLine, ok3, effects.attempt(indent, ok3, nok));
|
||
}
|
||
function gfmFootnoteDefinitionEnd(effects) {
|
||
effects.exit("gfmFootnoteDefinition");
|
||
}
|
||
function tokenizeIndent(effects, ok3, nok) {
|
||
const self2 = this;
|
||
return factorySpace(effects, afterPrefix, "gfmFootnoteDefinitionIndent", 4 + 1);
|
||
function afterPrefix(code3) {
|
||
const tail = self2.events[self2.events.length - 1];
|
||
return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok3(code3) : nok(code3);
|
||
}
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
|
||
function gfmStrikethrough(options) {
|
||
const options_ = options || {};
|
||
let single = options_.singleTilde;
|
||
const tokenizer = {
|
||
name: "strikethrough",
|
||
tokenize: tokenizeStrikethrough,
|
||
resolveAll: resolveAllStrikethrough
|
||
};
|
||
if (single === null || single === void 0) {
|
||
single = true;
|
||
}
|
||
return {
|
||
text: {
|
||
[126]: tokenizer
|
||
},
|
||
insideSpan: {
|
||
null: [tokenizer]
|
||
},
|
||
attentionMarkers: {
|
||
null: [126]
|
||
}
|
||
};
|
||
function resolveAllStrikethrough(events, context) {
|
||
let index2 = -1;
|
||
while (++index2 < events.length) {
|
||
if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) {
|
||
let open = index2;
|
||
while (open--) {
|
||
if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && // If the sizes are the same:
|
||
events[index2][1].end.offset - events[index2][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
|
||
events[index2][1].type = "strikethroughSequence";
|
||
events[open][1].type = "strikethroughSequence";
|
||
const strikethrough = {
|
||
type: "strikethrough",
|
||
start: Object.assign({}, events[open][1].start),
|
||
end: Object.assign({}, events[index2][1].end)
|
||
};
|
||
const text3 = {
|
||
type: "strikethroughText",
|
||
start: Object.assign({}, events[open][1].end),
|
||
end: Object.assign({}, events[index2][1].start)
|
||
};
|
||
const nextEvents = [["enter", strikethrough, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter", text3, context]];
|
||
const insideSpan = context.parser.constructs.insideSpan.null;
|
||
if (insideSpan) {
|
||
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index2), context));
|
||
}
|
||
splice(nextEvents, nextEvents.length, 0, [["exit", text3, context], ["enter", events[index2][1], context], ["exit", events[index2][1], context], ["exit", strikethrough, context]]);
|
||
splice(events, open - 1, index2 - open + 3, nextEvents);
|
||
index2 = open + nextEvents.length - 2;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
index2 = -1;
|
||
while (++index2 < events.length) {
|
||
if (events[index2][1].type === "strikethroughSequenceTemporary") {
|
||
events[index2][1].type = "data";
|
||
}
|
||
}
|
||
return events;
|
||
}
|
||
function tokenizeStrikethrough(effects, ok3, nok) {
|
||
const previous2 = this.previous;
|
||
const events = this.events;
|
||
let size = 0;
|
||
return start;
|
||
function start(code3) {
|
||
if (previous2 === 126 && events[events.length - 1][1].type !== "characterEscape") {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("strikethroughSequenceTemporary");
|
||
return more(code3);
|
||
}
|
||
function more(code3) {
|
||
const before = classifyCharacter(previous2);
|
||
if (code3 === 126) {
|
||
if (size > 1) return nok(code3);
|
||
effects.consume(code3);
|
||
size++;
|
||
return more;
|
||
}
|
||
if (size < 2 && !single) return nok(code3);
|
||
const token = effects.exit("strikethroughSequenceTemporary");
|
||
const after = classifyCharacter(code3);
|
||
token._open = !after || after === 2 && Boolean(before);
|
||
token._close = !before || before === 2 && Boolean(after);
|
||
return ok3(code3);
|
||
}
|
||
}
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-table/lib/edit-map.js
|
||
var EditMap = class {
|
||
/**
|
||
* Create a new edit map.
|
||
*/
|
||
constructor() {
|
||
this.map = [];
|
||
}
|
||
/**
|
||
* Create an edit: a remove and/or add at a certain place.
|
||
*
|
||
* @param {number} index
|
||
* @param {number} remove
|
||
* @param {Array<Event>} add
|
||
* @returns {undefined}
|
||
*/
|
||
add(index2, remove, add2) {
|
||
addImplementation(this, index2, remove, add2);
|
||
}
|
||
// To do: add this when moving to `micromark`.
|
||
// /**
|
||
// * Create an edit: but insert `add` before existing additions.
|
||
// *
|
||
// * @param {number} index
|
||
// * @param {number} remove
|
||
// * @param {Array<Event>} add
|
||
// * @returns {undefined}
|
||
// */
|
||
// addBefore(index, remove, add) {
|
||
// addImplementation(this, index, remove, add, true)
|
||
// }
|
||
/**
|
||
* Done, change the events.
|
||
*
|
||
* @param {Array<Event>} events
|
||
* @returns {undefined}
|
||
*/
|
||
consume(events) {
|
||
this.map.sort(function(a, b) {
|
||
return a[0] - b[0];
|
||
});
|
||
if (this.map.length === 0) {
|
||
return;
|
||
}
|
||
let index2 = this.map.length;
|
||
const vecs = [];
|
||
while (index2 > 0) {
|
||
index2 -= 1;
|
||
vecs.push(events.slice(this.map[index2][0] + this.map[index2][1]), this.map[index2][2]);
|
||
events.length = this.map[index2][0];
|
||
}
|
||
vecs.push(events.slice());
|
||
events.length = 0;
|
||
let slice = vecs.pop();
|
||
while (slice) {
|
||
for (const element2 of slice) {
|
||
events.push(element2);
|
||
}
|
||
slice = vecs.pop();
|
||
}
|
||
this.map.length = 0;
|
||
}
|
||
};
|
||
function addImplementation(editMap, at, remove, add2) {
|
||
let index2 = 0;
|
||
if (remove === 0 && add2.length === 0) {
|
||
return;
|
||
}
|
||
while (index2 < editMap.map.length) {
|
||
if (editMap.map[index2][0] === at) {
|
||
editMap.map[index2][1] += remove;
|
||
editMap.map[index2][2].push(...add2);
|
||
return;
|
||
}
|
||
index2 += 1;
|
||
}
|
||
editMap.map.push([at, remove, add2]);
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-table/lib/infer.js
|
||
function gfmTableAlign(events, index2) {
|
||
let inDelimiterRow = false;
|
||
const align = [];
|
||
while (index2 < events.length) {
|
||
const event = events[index2];
|
||
if (inDelimiterRow) {
|
||
if (event[0] === "enter") {
|
||
if (event[1].type === "tableContent") {
|
||
align.push(events[index2 + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
|
||
}
|
||
} else if (event[1].type === "tableContent") {
|
||
if (events[index2 - 1][1].type === "tableDelimiterMarker") {
|
||
const alignIndex = align.length - 1;
|
||
align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
|
||
}
|
||
} else if (event[1].type === "tableDelimiterRow") {
|
||
break;
|
||
}
|
||
} else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") {
|
||
inDelimiterRow = true;
|
||
}
|
||
index2 += 1;
|
||
}
|
||
return align;
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-table/lib/syntax.js
|
||
function gfmTable() {
|
||
return {
|
||
flow: {
|
||
null: {
|
||
name: "table",
|
||
tokenize: tokenizeTable,
|
||
resolveAll: resolveTable
|
||
}
|
||
}
|
||
};
|
||
}
|
||
function tokenizeTable(effects, ok3, nok) {
|
||
const self2 = this;
|
||
let size = 0;
|
||
let sizeB = 0;
|
||
let seen;
|
||
return start;
|
||
function start(code3) {
|
||
let index2 = self2.events.length - 1;
|
||
while (index2 > -1) {
|
||
const type = self2.events[index2][1].type;
|
||
if (type === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
||
type === "linePrefix") index2--;
|
||
else break;
|
||
}
|
||
const tail = index2 > -1 ? self2.events[index2][1].type : null;
|
||
const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
|
||
if (next === bodyRowStart && self2.parser.lazy[self2.now().line]) {
|
||
return nok(code3);
|
||
}
|
||
return next(code3);
|
||
}
|
||
function headRowBefore(code3) {
|
||
effects.enter("tableHead");
|
||
effects.enter("tableRow");
|
||
return headRowStart(code3);
|
||
}
|
||
function headRowStart(code3) {
|
||
if (code3 === 124) {
|
||
return headRowBreak(code3);
|
||
}
|
||
seen = true;
|
||
sizeB += 1;
|
||
return headRowBreak(code3);
|
||
}
|
||
function headRowBreak(code3) {
|
||
if (code3 === null) {
|
||
return nok(code3);
|
||
}
|
||
if (markdownLineEnding(code3)) {
|
||
if (sizeB > 1) {
|
||
sizeB = 0;
|
||
self2.interrupt = true;
|
||
effects.exit("tableRow");
|
||
effects.enter("lineEnding");
|
||
effects.consume(code3);
|
||
effects.exit("lineEnding");
|
||
return headDelimiterStart;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
if (markdownSpace(code3)) {
|
||
return factorySpace(effects, headRowBreak, "whitespace")(code3);
|
||
}
|
||
sizeB += 1;
|
||
if (seen) {
|
||
seen = false;
|
||
size += 1;
|
||
}
|
||
if (code3 === 124) {
|
||
effects.enter("tableCellDivider");
|
||
effects.consume(code3);
|
||
effects.exit("tableCellDivider");
|
||
seen = true;
|
||
return headRowBreak;
|
||
}
|
||
effects.enter("data");
|
||
return headRowData(code3);
|
||
}
|
||
function headRowData(code3) {
|
||
if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) {
|
||
effects.exit("data");
|
||
return headRowBreak(code3);
|
||
}
|
||
effects.consume(code3);
|
||
return code3 === 92 ? headRowEscape : headRowData;
|
||
}
|
||
function headRowEscape(code3) {
|
||
if (code3 === 92 || code3 === 124) {
|
||
effects.consume(code3);
|
||
return headRowData;
|
||
}
|
||
return headRowData(code3);
|
||
}
|
||
function headDelimiterStart(code3) {
|
||
self2.interrupt = false;
|
||
if (self2.parser.lazy[self2.now().line]) {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("tableDelimiterRow");
|
||
seen = false;
|
||
if (markdownSpace(code3)) {
|
||
return factorySpace(effects, headDelimiterBefore, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3);
|
||
}
|
||
return headDelimiterBefore(code3);
|
||
}
|
||
function headDelimiterBefore(code3) {
|
||
if (code3 === 45 || code3 === 58) {
|
||
return headDelimiterValueBefore(code3);
|
||
}
|
||
if (code3 === 124) {
|
||
seen = true;
|
||
effects.enter("tableCellDivider");
|
||
effects.consume(code3);
|
||
effects.exit("tableCellDivider");
|
||
return headDelimiterCellBefore;
|
||
}
|
||
return headDelimiterNok(code3);
|
||
}
|
||
function headDelimiterCellBefore(code3) {
|
||
if (markdownSpace(code3)) {
|
||
return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code3);
|
||
}
|
||
return headDelimiterValueBefore(code3);
|
||
}
|
||
function headDelimiterValueBefore(code3) {
|
||
if (code3 === 58) {
|
||
sizeB += 1;
|
||
seen = true;
|
||
effects.enter("tableDelimiterMarker");
|
||
effects.consume(code3);
|
||
effects.exit("tableDelimiterMarker");
|
||
return headDelimiterLeftAlignmentAfter;
|
||
}
|
||
if (code3 === 45) {
|
||
sizeB += 1;
|
||
return headDelimiterLeftAlignmentAfter(code3);
|
||
}
|
||
if (code3 === null || markdownLineEnding(code3)) {
|
||
return headDelimiterCellAfter(code3);
|
||
}
|
||
return headDelimiterNok(code3);
|
||
}
|
||
function headDelimiterLeftAlignmentAfter(code3) {
|
||
if (code3 === 45) {
|
||
effects.enter("tableDelimiterFiller");
|
||
return headDelimiterFiller(code3);
|
||
}
|
||
return headDelimiterNok(code3);
|
||
}
|
||
function headDelimiterFiller(code3) {
|
||
if (code3 === 45) {
|
||
effects.consume(code3);
|
||
return headDelimiterFiller;
|
||
}
|
||
if (code3 === 58) {
|
||
seen = true;
|
||
effects.exit("tableDelimiterFiller");
|
||
effects.enter("tableDelimiterMarker");
|
||
effects.consume(code3);
|
||
effects.exit("tableDelimiterMarker");
|
||
return headDelimiterRightAlignmentAfter;
|
||
}
|
||
effects.exit("tableDelimiterFiller");
|
||
return headDelimiterRightAlignmentAfter(code3);
|
||
}
|
||
function headDelimiterRightAlignmentAfter(code3) {
|
||
if (markdownSpace(code3)) {
|
||
return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code3);
|
||
}
|
||
return headDelimiterCellAfter(code3);
|
||
}
|
||
function headDelimiterCellAfter(code3) {
|
||
if (code3 === 124) {
|
||
return headDelimiterBefore(code3);
|
||
}
|
||
if (code3 === null || markdownLineEnding(code3)) {
|
||
if (!seen || size !== sizeB) {
|
||
return headDelimiterNok(code3);
|
||
}
|
||
effects.exit("tableDelimiterRow");
|
||
effects.exit("tableHead");
|
||
return ok3(code3);
|
||
}
|
||
return headDelimiterNok(code3);
|
||
}
|
||
function headDelimiterNok(code3) {
|
||
return nok(code3);
|
||
}
|
||
function bodyRowStart(code3) {
|
||
effects.enter("tableRow");
|
||
return bodyRowBreak(code3);
|
||
}
|
||
function bodyRowBreak(code3) {
|
||
if (code3 === 124) {
|
||
effects.enter("tableCellDivider");
|
||
effects.consume(code3);
|
||
effects.exit("tableCellDivider");
|
||
return bodyRowBreak;
|
||
}
|
||
if (code3 === null || markdownLineEnding(code3)) {
|
||
effects.exit("tableRow");
|
||
return ok3(code3);
|
||
}
|
||
if (markdownSpace(code3)) {
|
||
return factorySpace(effects, bodyRowBreak, "whitespace")(code3);
|
||
}
|
||
effects.enter("data");
|
||
return bodyRowData(code3);
|
||
}
|
||
function bodyRowData(code3) {
|
||
if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) {
|
||
effects.exit("data");
|
||
return bodyRowBreak(code3);
|
||
}
|
||
effects.consume(code3);
|
||
return code3 === 92 ? bodyRowEscape : bodyRowData;
|
||
}
|
||
function bodyRowEscape(code3) {
|
||
if (code3 === 92 || code3 === 124) {
|
||
effects.consume(code3);
|
||
return bodyRowData;
|
||
}
|
||
return bodyRowData(code3);
|
||
}
|
||
}
|
||
function resolveTable(events, context) {
|
||
let index2 = -1;
|
||
let inFirstCellAwaitingPipe = true;
|
||
let rowKind = 0;
|
||
let lastCell = [0, 0, 0, 0];
|
||
let cell = [0, 0, 0, 0];
|
||
let afterHeadAwaitingFirstBodyRow = false;
|
||
let lastTableEnd = 0;
|
||
let currentTable;
|
||
let currentBody;
|
||
let currentCell;
|
||
const map3 = new EditMap();
|
||
while (++index2 < events.length) {
|
||
const event = events[index2];
|
||
const token = event[1];
|
||
if (event[0] === "enter") {
|
||
if (token.type === "tableHead") {
|
||
afterHeadAwaitingFirstBodyRow = false;
|
||
if (lastTableEnd !== 0) {
|
||
flushTableEnd(map3, context, lastTableEnd, currentTable, currentBody);
|
||
currentBody = void 0;
|
||
lastTableEnd = 0;
|
||
}
|
||
currentTable = {
|
||
type: "table",
|
||
start: Object.assign({}, token.start),
|
||
// Note: correct end is set later.
|
||
end: Object.assign({}, token.end)
|
||
};
|
||
map3.add(index2, 0, [["enter", currentTable, context]]);
|
||
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
||
inFirstCellAwaitingPipe = true;
|
||
currentCell = void 0;
|
||
lastCell = [0, 0, 0, 0];
|
||
cell = [0, index2 + 1, 0, 0];
|
||
if (afterHeadAwaitingFirstBodyRow) {
|
||
afterHeadAwaitingFirstBodyRow = false;
|
||
currentBody = {
|
||
type: "tableBody",
|
||
start: Object.assign({}, token.start),
|
||
// Note: correct end is set later.
|
||
end: Object.assign({}, token.end)
|
||
};
|
||
map3.add(index2, 0, [["enter", currentBody, context]]);
|
||
}
|
||
rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
|
||
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
||
inFirstCellAwaitingPipe = false;
|
||
if (cell[2] === 0) {
|
||
if (lastCell[1] !== 0) {
|
||
cell[0] = cell[1];
|
||
currentCell = flushCell(map3, context, lastCell, rowKind, void 0, currentCell);
|
||
lastCell = [0, 0, 0, 0];
|
||
}
|
||
cell[2] = index2;
|
||
}
|
||
} else if (token.type === "tableCellDivider") {
|
||
if (inFirstCellAwaitingPipe) {
|
||
inFirstCellAwaitingPipe = false;
|
||
} else {
|
||
if (lastCell[1] !== 0) {
|
||
cell[0] = cell[1];
|
||
currentCell = flushCell(map3, context, lastCell, rowKind, void 0, currentCell);
|
||
}
|
||
lastCell = cell;
|
||
cell = [lastCell[1], index2, 0, 0];
|
||
}
|
||
}
|
||
} else if (token.type === "tableHead") {
|
||
afterHeadAwaitingFirstBodyRow = true;
|
||
lastTableEnd = index2;
|
||
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
||
lastTableEnd = index2;
|
||
if (lastCell[1] !== 0) {
|
||
cell[0] = cell[1];
|
||
currentCell = flushCell(map3, context, lastCell, rowKind, index2, currentCell);
|
||
} else if (cell[1] !== 0) {
|
||
currentCell = flushCell(map3, context, cell, rowKind, index2, currentCell);
|
||
}
|
||
rowKind = 0;
|
||
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
||
cell[3] = index2;
|
||
}
|
||
}
|
||
if (lastTableEnd !== 0) {
|
||
flushTableEnd(map3, context, lastTableEnd, currentTable, currentBody);
|
||
}
|
||
map3.consume(context.events);
|
||
index2 = -1;
|
||
while (++index2 < context.events.length) {
|
||
const event = context.events[index2];
|
||
if (event[0] === "enter" && event[1].type === "table") {
|
||
event[1]._align = gfmTableAlign(context.events, index2);
|
||
}
|
||
}
|
||
return events;
|
||
}
|
||
function flushCell(map3, context, range, rowKind, rowEnd, previousCell) {
|
||
const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
|
||
const valueName = "tableContent";
|
||
if (range[0] !== 0) {
|
||
previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
|
||
map3.add(range[0], 0, [["exit", previousCell, context]]);
|
||
}
|
||
const now = getPoint(context.events, range[1]);
|
||
previousCell = {
|
||
type: groupName,
|
||
start: Object.assign({}, now),
|
||
// Note: correct end is set later.
|
||
end: Object.assign({}, now)
|
||
};
|
||
map3.add(range[1], 0, [["enter", previousCell, context]]);
|
||
if (range[2] !== 0) {
|
||
const relatedStart = getPoint(context.events, range[2]);
|
||
const relatedEnd = getPoint(context.events, range[3]);
|
||
const valueToken = {
|
||
type: valueName,
|
||
start: Object.assign({}, relatedStart),
|
||
end: Object.assign({}, relatedEnd)
|
||
};
|
||
map3.add(range[2], 0, [["enter", valueToken, context]]);
|
||
if (rowKind !== 2) {
|
||
const start = context.events[range[2]];
|
||
const end = context.events[range[3]];
|
||
start[1].end = Object.assign({}, end[1].end);
|
||
start[1].type = "chunkText";
|
||
start[1].contentType = "text";
|
||
if (range[3] > range[2] + 1) {
|
||
const a = range[2] + 1;
|
||
const b = range[3] - range[2] - 1;
|
||
map3.add(a, b, []);
|
||
}
|
||
}
|
||
map3.add(range[3] + 1, 0, [["exit", valueToken, context]]);
|
||
}
|
||
if (rowEnd !== void 0) {
|
||
previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
|
||
map3.add(rowEnd, 0, [["exit", previousCell, context]]);
|
||
previousCell = void 0;
|
||
}
|
||
return previousCell;
|
||
}
|
||
function flushTableEnd(map3, context, index2, table, tableBody) {
|
||
const exits = [];
|
||
const related = getPoint(context.events, index2);
|
||
if (tableBody) {
|
||
tableBody.end = Object.assign({}, related);
|
||
exits.push(["exit", tableBody, context]);
|
||
}
|
||
table.end = Object.assign({}, related);
|
||
exits.push(["exit", table, context]);
|
||
map3.add(index2 + 1, 0, exits);
|
||
}
|
||
function getPoint(events, index2) {
|
||
const event = events[index2];
|
||
const side = event[0] === "enter" ? "start" : "end";
|
||
return event[1][side];
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
|
||
var tasklistCheck = {
|
||
name: "tasklistCheck",
|
||
tokenize: tokenizeTasklistCheck
|
||
};
|
||
function gfmTaskListItem() {
|
||
return {
|
||
text: {
|
||
[91]: tasklistCheck
|
||
}
|
||
};
|
||
}
|
||
function tokenizeTasklistCheck(effects, ok3, nok) {
|
||
const self2 = this;
|
||
return open;
|
||
function open(code3) {
|
||
if (
|
||
// Exit if there’s stuff before.
|
||
self2.previous !== null || // Exit if not in the first content that is the first child of a list
|
||
// item.
|
||
!self2._gfmTasklistFirstContentOfListItem
|
||
) {
|
||
return nok(code3);
|
||
}
|
||
effects.enter("taskListCheck");
|
||
effects.enter("taskListCheckMarker");
|
||
effects.consume(code3);
|
||
effects.exit("taskListCheckMarker");
|
||
return inside;
|
||
}
|
||
function inside(code3) {
|
||
if (markdownLineEndingOrSpace(code3)) {
|
||
effects.enter("taskListCheckValueUnchecked");
|
||
effects.consume(code3);
|
||
effects.exit("taskListCheckValueUnchecked");
|
||
return close;
|
||
}
|
||
if (code3 === 88 || code3 === 120) {
|
||
effects.enter("taskListCheckValueChecked");
|
||
effects.consume(code3);
|
||
effects.exit("taskListCheckValueChecked");
|
||
return close;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function close(code3) {
|
||
if (code3 === 93) {
|
||
effects.enter("taskListCheckMarker");
|
||
effects.consume(code3);
|
||
effects.exit("taskListCheckMarker");
|
||
effects.exit("taskListCheck");
|
||
return after;
|
||
}
|
||
return nok(code3);
|
||
}
|
||
function after(code3) {
|
||
if (markdownLineEnding(code3)) {
|
||
return ok3(code3);
|
||
}
|
||
if (markdownSpace(code3)) {
|
||
return effects.check({
|
||
tokenize: spaceThenNonSpace
|
||
}, ok3, nok)(code3);
|
||
}
|
||
return nok(code3);
|
||
}
|
||
}
|
||
function spaceThenNonSpace(effects, ok3, nok) {
|
||
return factorySpace(effects, after, "whitespace");
|
||
function after(code3) {
|
||
return code3 === null ? nok(code3) : ok3(code3);
|
||
}
|
||
}
|
||
|
||
// node_modules/micromark-extension-gfm/index.js
|
||
function gfm(options) {
|
||
return combineExtensions([
|
||
gfmAutolinkLiteral(),
|
||
gfmFootnote(),
|
||
gfmStrikethrough(options),
|
||
gfmTable(),
|
||
gfmTaskListItem()
|
||
]);
|
||
}
|
||
|
||
// node_modules/remark-gfm/lib/index.js
|
||
var emptyOptions2 = {};
|
||
function remarkGfm(options) {
|
||
const self2 = (
|
||
/** @type {Processor<Root>} */
|
||
this
|
||
);
|
||
const settings = options || emptyOptions2;
|
||
const data = self2.data();
|
||
const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
|
||
const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
|
||
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
||
micromarkExtensions.push(gfm(settings));
|
||
fromMarkdownExtensions.push(gfmFromMarkdown());
|
||
toMarkdownExtensions.push(gfmToMarkdown(settings));
|
||
}
|
||
|
||
// node_modules/bail/index.js
|
||
function bail(error) {
|
||
if (error) {
|
||
throw error;
|
||
}
|
||
}
|
||
|
||
// node_modules/unified/lib/index.js
|
||
var import_extend = __toESM(require_extend());
|
||
|
||
// node_modules/is-plain-obj/index.js
|
||
function isPlainObject(value) {
|
||
if (typeof value !== "object" || value === null) {
|
||
return false;
|
||
}
|
||
const prototype = Object.getPrototypeOf(value);
|
||
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
||
}
|
||
|
||
// node_modules/trough/lib/index.js
|
||
function trough() {
|
||
const fns = [];
|
||
const pipeline = { run, use };
|
||
return pipeline;
|
||
function run(...values) {
|
||
let middlewareIndex = -1;
|
||
const callback = values.pop();
|
||
if (typeof callback !== "function") {
|
||
throw new TypeError("Expected function as last argument, not " + callback);
|
||
}
|
||
next(null, ...values);
|
||
function next(error, ...output) {
|
||
const fn = fns[++middlewareIndex];
|
||
let index2 = -1;
|
||
if (error) {
|
||
callback(error);
|
||
return;
|
||
}
|
||
while (++index2 < values.length) {
|
||
if (output[index2] === null || output[index2] === void 0) {
|
||
output[index2] = values[index2];
|
||
}
|
||
}
|
||
values = output;
|
||
if (fn) {
|
||
wrap(fn, next)(...output);
|
||
} else {
|
||
callback(null, ...output);
|
||
}
|
||
}
|
||
}
|
||
function use(middelware) {
|
||
if (typeof middelware !== "function") {
|
||
throw new TypeError(
|
||
"Expected `middelware` to be a function, not " + middelware
|
||
);
|
||
}
|
||
fns.push(middelware);
|
||
return pipeline;
|
||
}
|
||
}
|
||
function wrap(middleware, callback) {
|
||
let called;
|
||
return wrapped;
|
||
function wrapped(...parameters) {
|
||
const fnExpectsCallback = middleware.length > parameters.length;
|
||
let result;
|
||
if (fnExpectsCallback) {
|
||
parameters.push(done);
|
||
}
|
||
try {
|
||
result = middleware.apply(this, parameters);
|
||
} catch (error) {
|
||
const exception = (
|
||
/** @type {Error} */
|
||
error
|
||
);
|
||
if (fnExpectsCallback && called) {
|
||
throw exception;
|
||
}
|
||
return done(exception);
|
||
}
|
||
if (!fnExpectsCallback) {
|
||
if (result && result.then && typeof result.then === "function") {
|
||
result.then(then, done);
|
||
} else if (result instanceof Error) {
|
||
done(result);
|
||
} else {
|
||
then(result);
|
||
}
|
||
}
|
||
}
|
||
function done(error, ...output) {
|
||
if (!called) {
|
||
called = true;
|
||
callback(error, ...output);
|
||
}
|
||
}
|
||
function then(value) {
|
||
done(null, value);
|
||
}
|
||
}
|
||
|
||
// node_modules/unist-util-stringify-position/lib/index.js
|
||
function stringifyPosition(value) {
|
||
if (!value || typeof value !== "object") {
|
||
return "";
|
||
}
|
||
if ("position" in value || "type" in value) {
|
||
return position(value.position);
|
||
}
|
||
if ("start" in value || "end" in value) {
|
||
return position(value);
|
||
}
|
||
if ("line" in value || "column" in value) {
|
||
return point(value);
|
||
}
|
||
return "";
|
||
}
|
||
function point(point2) {
|
||
return index(point2 && point2.line) + ":" + index(point2 && point2.column);
|
||
}
|
||
function position(pos) {
|
||
return point(pos && pos.start) + "-" + point(pos && pos.end);
|
||
}
|
||
function index(value) {
|
||
return value && typeof value === "number" ? value : 1;
|
||
}
|
||
|
||
// node_modules/vfile-message/lib/index.js
|
||
var VFileMessage = class extends Error {
|
||
/**
|
||
* Create a message for `reason`.
|
||
*
|
||
* > 🪦 **Note**: also has obsolete signatures.
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Options | null | undefined} [options]
|
||
* @returns
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns
|
||
*
|
||
* @param {Error | VFileMessage | string} causeOrReason
|
||
* Reason for message, should use markdown.
|
||
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
||
* Configuration (optional).
|
||
* @param {string | null | undefined} [origin]
|
||
* Place in code where the message originates (example:
|
||
* `'my-package:my-rule'` or `'my-rule'`).
|
||
* @returns
|
||
* Instance of `VFileMessage`.
|
||
*/
|
||
// eslint-disable-next-line complexity
|
||
constructor(causeOrReason, optionsOrParentOrPlace, origin) {
|
||
super();
|
||
if (typeof optionsOrParentOrPlace === "string") {
|
||
origin = optionsOrParentOrPlace;
|
||
optionsOrParentOrPlace = void 0;
|
||
}
|
||
let reason = "";
|
||
let options = {};
|
||
let legacyCause = false;
|
||
if (optionsOrParentOrPlace) {
|
||
if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) {
|
||
options = { place: optionsOrParentOrPlace };
|
||
} else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) {
|
||
options = { place: optionsOrParentOrPlace };
|
||
} else if ("type" in optionsOrParentOrPlace) {
|
||
options = {
|
||
ancestors: [optionsOrParentOrPlace],
|
||
place: optionsOrParentOrPlace.position
|
||
};
|
||
} else {
|
||
options = { ...optionsOrParentOrPlace };
|
||
}
|
||
}
|
||
if (typeof causeOrReason === "string") {
|
||
reason = causeOrReason;
|
||
} else if (!options.cause && causeOrReason) {
|
||
legacyCause = true;
|
||
reason = causeOrReason.message;
|
||
options.cause = causeOrReason;
|
||
}
|
||
if (!options.ruleId && !options.source && typeof origin === "string") {
|
||
const index2 = origin.indexOf(":");
|
||
if (index2 === -1) {
|
||
options.ruleId = origin;
|
||
} else {
|
||
options.source = origin.slice(0, index2);
|
||
options.ruleId = origin.slice(index2 + 1);
|
||
}
|
||
}
|
||
if (!options.place && options.ancestors && options.ancestors) {
|
||
const parent = options.ancestors[options.ancestors.length - 1];
|
||
if (parent) {
|
||
options.place = parent.position;
|
||
}
|
||
}
|
||
const start = options.place && "start" in options.place ? options.place.start : options.place;
|
||
this.ancestors = options.ancestors || void 0;
|
||
this.cause = options.cause || void 0;
|
||
this.column = start ? start.column : void 0;
|
||
this.fatal = void 0;
|
||
this.file = "";
|
||
this.message = reason;
|
||
this.line = start ? start.line : void 0;
|
||
this.name = stringifyPosition(options.place) || "1:1";
|
||
this.place = options.place || void 0;
|
||
this.reason = this.message;
|
||
this.ruleId = options.ruleId || void 0;
|
||
this.source = options.source || void 0;
|
||
this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : "";
|
||
this.actual = void 0;
|
||
this.expected = void 0;
|
||
this.note = void 0;
|
||
this.url = void 0;
|
||
}
|
||
};
|
||
VFileMessage.prototype.file = "";
|
||
VFileMessage.prototype.name = "";
|
||
VFileMessage.prototype.reason = "";
|
||
VFileMessage.prototype.message = "";
|
||
VFileMessage.prototype.stack = "";
|
||
VFileMessage.prototype.column = void 0;
|
||
VFileMessage.prototype.line = void 0;
|
||
VFileMessage.prototype.ancestors = void 0;
|
||
VFileMessage.prototype.cause = void 0;
|
||
VFileMessage.prototype.fatal = void 0;
|
||
VFileMessage.prototype.place = void 0;
|
||
VFileMessage.prototype.ruleId = void 0;
|
||
VFileMessage.prototype.source = void 0;
|
||
|
||
// node_modules/vfile/lib/minurl.shared.js
|
||
function isUrl(fileUrlOrPath) {
|
||
return Boolean(
|
||
fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine.
|
||
fileUrlOrPath.auth === void 0
|
||
);
|
||
}
|
||
|
||
// node_modules/vfile/lib/index.js
|
||
var order = (
|
||
/** @type {const} */
|
||
[
|
||
"history",
|
||
"path",
|
||
"basename",
|
||
"stem",
|
||
"extname",
|
||
"dirname"
|
||
]
|
||
);
|
||
var VFile = class {
|
||
/**
|
||
* Create a new virtual file.
|
||
*
|
||
* `options` is treated as:
|
||
*
|
||
* * `string` or `Uint8Array` — `{value: options}`
|
||
* * `URL` — `{path: options}`
|
||
* * `VFile` — shallow copies its data over to the new file
|
||
* * `object` — all fields are shallow copied over to the new file
|
||
*
|
||
* Path related fields are set in the following order (least specific to
|
||
* most specific): `history`, `path`, `basename`, `stem`, `extname`,
|
||
* `dirname`.
|
||
*
|
||
* You cannot set `dirname` or `extname` without setting either `history`,
|
||
* `path`, `basename`, or `stem` too.
|
||
*
|
||
* @param {Compatible | null | undefined} [value]
|
||
* File value.
|
||
* @returns
|
||
* New instance.
|
||
*/
|
||
constructor(value) {
|
||
let options;
|
||
if (!value) {
|
||
options = {};
|
||
} else if (isUrl(value)) {
|
||
options = { path: value };
|
||
} else if (typeof value === "string" || isUint8Array(value)) {
|
||
options = { value };
|
||
} else {
|
||
options = value;
|
||
}
|
||
this.cwd = "cwd" in options ? "" : default3.cwd();
|
||
this.data = {};
|
||
this.history = [];
|
||
this.messages = [];
|
||
this.value;
|
||
this.map;
|
||
this.result;
|
||
this.stored;
|
||
let index2 = -1;
|
||
while (++index2 < order.length) {
|
||
const field2 = order[index2];
|
||
if (field2 in options && options[field2] !== void 0 && options[field2] !== null) {
|
||
this[field2] = field2 === "history" ? [...options[field2]] : options[field2];
|
||
}
|
||
}
|
||
let field;
|
||
for (field in options) {
|
||
if (!order.includes(field)) {
|
||
this[field] = options[field];
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* Get the basename (including extname) (example: `'index.min.js'`).
|
||
*
|
||
* @returns {string | undefined}
|
||
* Basename.
|
||
*/
|
||
get basename() {
|
||
return typeof this.path === "string" ? default2.basename(this.path) : void 0;
|
||
}
|
||
/**
|
||
* Set basename (including extname) (`'index.min.js'`).
|
||
*
|
||
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
||
* on windows).
|
||
* Cannot be nullified (use `file.path = file.dirname` instead).
|
||
*
|
||
* @param {string} basename
|
||
* Basename.
|
||
* @returns {undefined}
|
||
* Nothing.
|
||
*/
|
||
set basename(basename) {
|
||
assertNonEmpty(basename, "basename");
|
||
assertPart(basename, "basename");
|
||
this.path = default2.join(this.dirname || "", basename);
|
||
}
|
||
/**
|
||
* Get the parent path (example: `'~'`).
|
||
*
|
||
* @returns {string | undefined}
|
||
* Dirname.
|
||
*/
|
||
get dirname() {
|
||
return typeof this.path === "string" ? default2.dirname(this.path) : void 0;
|
||
}
|
||
/**
|
||
* Set the parent path (example: `'~'`).
|
||
*
|
||
* Cannot be set if there’s no `path` yet.
|
||
*
|
||
* @param {string | undefined} dirname
|
||
* Dirname.
|
||
* @returns {undefined}
|
||
* Nothing.
|
||
*/
|
||
set dirname(dirname) {
|
||
assertPath(this.basename, "dirname");
|
||
this.path = default2.join(dirname || "", this.basename);
|
||
}
|
||
/**
|
||
* Get the extname (including dot) (example: `'.js'`).
|
||
*
|
||
* @returns {string | undefined}
|
||
* Extname.
|
||
*/
|
||
get extname() {
|
||
return typeof this.path === "string" ? default2.extname(this.path) : void 0;
|
||
}
|
||
/**
|
||
* Set the extname (including dot) (example: `'.js'`).
|
||
*
|
||
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
||
* on windows).
|
||
* Cannot be set if there’s no `path` yet.
|
||
*
|
||
* @param {string | undefined} extname
|
||
* Extname.
|
||
* @returns {undefined}
|
||
* Nothing.
|
||
*/
|
||
set extname(extname) {
|
||
assertPart(extname, "extname");
|
||
assertPath(this.dirname, "extname");
|
||
if (extname) {
|
||
if (extname.codePointAt(0) !== 46) {
|
||
throw new Error("`extname` must start with `.`");
|
||
}
|
||
if (extname.includes(".", 1)) {
|
||
throw new Error("`extname` cannot contain multiple dots");
|
||
}
|
||
}
|
||
this.path = default2.join(this.dirname, this.stem + (extname || ""));
|
||
}
|
||
/**
|
||
* Get the full path (example: `'~/index.min.js'`).
|
||
*
|
||
* @returns {string}
|
||
* Path.
|
||
*/
|
||
get path() {
|
||
return this.history[this.history.length - 1];
|
||
}
|
||
/**
|
||
* Set the full path (example: `'~/index.min.js'`).
|
||
*
|
||
* Cannot be nullified.
|
||
* You can set a file URL (a `URL` object with a `file:` protocol) which will
|
||
* be turned into a path with `url.fileURLToPath`.
|
||
*
|
||
* @param {URL | string} path
|
||
* Path.
|
||
* @returns {undefined}
|
||
* Nothing.
|
||
*/
|
||
set path(path2) {
|
||
if (isUrl(path2)) {
|
||
path2 = fileURLToPath(path2);
|
||
}
|
||
assertNonEmpty(path2, "path");
|
||
if (this.path !== path2) {
|
||
this.history.push(path2);
|
||
}
|
||
}
|
||
/**
|
||
* Get the stem (basename w/o extname) (example: `'index.min'`).
|
||
*
|
||
* @returns {string | undefined}
|
||
* Stem.
|
||
*/
|
||
get stem() {
|
||
return typeof this.path === "string" ? default2.basename(this.path, this.extname) : void 0;
|
||
}
|
||
/**
|
||
* Set the stem (basename w/o extname) (example: `'index.min'`).
|
||
*
|
||
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
||
* on windows).
|
||
* Cannot be nullified (use `file.path = file.dirname` instead).
|
||
*
|
||
* @param {string} stem
|
||
* Stem.
|
||
* @returns {undefined}
|
||
* Nothing.
|
||
*/
|
||
set stem(stem) {
|
||
assertNonEmpty(stem, "stem");
|
||
assertPart(stem, "stem");
|
||
this.path = default2.join(this.dirname || "", stem + (this.extname || ""));
|
||
}
|
||
// Normal prototypal methods.
|
||
/**
|
||
* Create a fatal message for `reason` associated with the file.
|
||
*
|
||
* The `fatal` field of the message is set to `true` (error; file not usable)
|
||
* and the `file` field is set to the current file path.
|
||
* The message is added to the `messages` field on `file`.
|
||
*
|
||
* > 🪦 **Note**: also has obsolete signatures.
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {MessageOptions | null | undefined} [options]
|
||
* @returns {never}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {never}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {never}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {never}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {never}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {never}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {never}
|
||
*
|
||
* @param {Error | VFileMessage | string} causeOrReason
|
||
* Reason for message, should use markdown.
|
||
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
||
* Configuration (optional).
|
||
* @param {string | null | undefined} [origin]
|
||
* Place in code where the message originates (example:
|
||
* `'my-package:my-rule'` or `'my-rule'`).
|
||
* @returns {never}
|
||
* Never.
|
||
* @throws {VFileMessage}
|
||
* Message.
|
||
*/
|
||
fail(causeOrReason, optionsOrParentOrPlace, origin) {
|
||
const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
|
||
message.fatal = true;
|
||
throw message;
|
||
}
|
||
/**
|
||
* Create an info message for `reason` associated with the file.
|
||
*
|
||
* The `fatal` field of the message is set to `undefined` (info; change
|
||
* likely not needed) and the `file` field is set to the current file path.
|
||
* The message is added to the `messages` field on `file`.
|
||
*
|
||
* > 🪦 **Note**: also has obsolete signatures.
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {MessageOptions | null | undefined} [options]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @param {Error | VFileMessage | string} causeOrReason
|
||
* Reason for message, should use markdown.
|
||
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
||
* Configuration (optional).
|
||
* @param {string | null | undefined} [origin]
|
||
* Place in code where the message originates (example:
|
||
* `'my-package:my-rule'` or `'my-rule'`).
|
||
* @returns {VFileMessage}
|
||
* Message.
|
||
*/
|
||
info(causeOrReason, optionsOrParentOrPlace, origin) {
|
||
const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
|
||
message.fatal = void 0;
|
||
return message;
|
||
}
|
||
/**
|
||
* Create a message for `reason` associated with the file.
|
||
*
|
||
* The `fatal` field of the message is set to `false` (warning; change may be
|
||
* needed) and the `file` field is set to the current file path.
|
||
* The message is added to the `messages` field on `file`.
|
||
*
|
||
* > 🪦 **Note**: also has obsolete signatures.
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {MessageOptions | null | undefined} [options]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {string} reason
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Node | NodeLike | null | undefined} parent
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {Point | Position | null | undefined} place
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @overload
|
||
* @param {Error | VFileMessage} cause
|
||
* @param {string | null | undefined} [origin]
|
||
* @returns {VFileMessage}
|
||
*
|
||
* @param {Error | VFileMessage | string} causeOrReason
|
||
* Reason for message, should use markdown.
|
||
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
||
* Configuration (optional).
|
||
* @param {string | null | undefined} [origin]
|
||
* Place in code where the message originates (example:
|
||
* `'my-package:my-rule'` or `'my-rule'`).
|
||
* @returns {VFileMessage}
|
||
* Message.
|
||
*/
|
||
message(causeOrReason, optionsOrParentOrPlace, origin) {
|
||
const message = new VFileMessage(
|
||
// @ts-expect-error: the overloads are fine.
|
||
causeOrReason,
|
||
optionsOrParentOrPlace,
|
||
origin
|
||
);
|
||
if (this.path) {
|
||
message.name = this.path + ":" + message.name;
|
||
message.file = this.path;
|
||
}
|
||
message.fatal = false;
|
||
this.messages.push(message);
|
||
return message;
|
||
}
|
||
/**
|
||
* Serialize the file.
|
||
*
|
||
* > **Note**: which encodings are supported depends on the engine.
|
||
* > For info on Node.js, see:
|
||
* > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
|
||
*
|
||
* @param {string | null | undefined} [encoding='utf8']
|
||
* Character encoding to understand `value` as when it’s a `Uint8Array`
|
||
* (default: `'utf-8'`).
|
||
* @returns {string}
|
||
* Serialized file.
|
||
*/
|
||
toString(encoding) {
|
||
if (this.value === void 0) {
|
||
return "";
|
||
}
|
||
if (typeof this.value === "string") {
|
||
return this.value;
|
||
}
|
||
const decoder = new TextDecoder(encoding || void 0);
|
||
return decoder.decode(this.value);
|
||
}
|
||
};
|
||
function assertPart(part, name) {
|
||
if (part && part.includes(default2.sep)) {
|
||
throw new Error(
|
||
"`" + name + "` cannot be a path: did not expect `" + default2.sep + "`"
|
||
);
|
||
}
|
||
}
|
||
function assertNonEmpty(part, name) {
|
||
if (!part) {
|
||
throw new Error("`" + name + "` cannot be empty");
|
||
}
|
||
}
|
||
function assertPath(path2, name) {
|
||
if (!path2) {
|
||
throw new Error("Setting `" + name + "` requires `path` to be set too");
|
||
}
|
||
}
|
||
function isUint8Array(value) {
|
||
return Boolean(
|
||
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
||
);
|
||
}
|
||
|
||
// node_modules/unified/lib/callable-instance.js
|
||
var CallableInstance = (
|
||
/**
|
||
* @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
|
||
*/
|
||
/** @type {unknown} */
|
||
/**
|
||
* @this {Function}
|
||
* @param {string | symbol} property
|
||
* @returns {(...parameters: Array<unknown>) => unknown}
|
||
*/
|
||
(function(property) {
|
||
const self2 = this;
|
||
const constr = self2.constructor;
|
||
const proto = (
|
||
/** @type {Record<string | symbol, Function>} */
|
||
// Prototypes do exist.
|
||
// type-coverage:ignore-next-line
|
||
constr.prototype
|
||
);
|
||
const value = proto[property];
|
||
const apply = function() {
|
||
return value.apply(apply, arguments);
|
||
};
|
||
Object.setPrototypeOf(apply, proto);
|
||
return apply;
|
||
})
|
||
);
|
||
|
||
// node_modules/unified/lib/index.js
|
||
var own = {}.hasOwnProperty;
|
||
var Processor = class _Processor extends CallableInstance {
|
||
/**
|
||
* Create a processor.
|
||
*/
|
||
constructor() {
|
||
super("copy");
|
||
this.Compiler = void 0;
|
||
this.Parser = void 0;
|
||
this.attachers = [];
|
||
this.compiler = void 0;
|
||
this.freezeIndex = -1;
|
||
this.frozen = void 0;
|
||
this.namespace = {};
|
||
this.parser = void 0;
|
||
this.transformers = trough();
|
||
}
|
||
/**
|
||
* Copy a processor.
|
||
*
|
||
* @deprecated
|
||
* This is a private internal method and should not be used.
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
* New *unfrozen* processor ({@linkcode Processor}) that is
|
||
* configured to work the same as its ancestor.
|
||
* When the descendant processor is configured in the future it does not
|
||
* affect the ancestral processor.
|
||
*/
|
||
copy() {
|
||
const destination = (
|
||
/** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */
|
||
new _Processor()
|
||
);
|
||
let index2 = -1;
|
||
while (++index2 < this.attachers.length) {
|
||
const attacher = this.attachers[index2];
|
||
destination.use(...attacher);
|
||
}
|
||
destination.data((0, import_extend.default)(true, {}, this.namespace));
|
||
return destination;
|
||
}
|
||
/**
|
||
* Configure the processor with info available to all plugins.
|
||
* Information is stored in an object.
|
||
*
|
||
* Typically, options can be given to a specific plugin, but sometimes it
|
||
* makes sense to have information shared with several plugins.
|
||
* For example, a list of HTML elements that are self-closing, which is
|
||
* needed during all phases.
|
||
*
|
||
* > **Note**: setting information cannot occur on *frozen* processors.
|
||
* > Call the processor first to create a new unfrozen processor.
|
||
*
|
||
* > **Note**: to register custom data in TypeScript, augment the
|
||
* > {@linkcode Data} interface.
|
||
*
|
||
* @example
|
||
* This example show how to get and set info:
|
||
*
|
||
* ```js
|
||
* import {unified} from 'unified'
|
||
*
|
||
* const processor = unified().data('alpha', 'bravo')
|
||
*
|
||
* processor.data('alpha') // => 'bravo'
|
||
*
|
||
* processor.data() // => {alpha: 'bravo'}
|
||
*
|
||
* processor.data({charlie: 'delta'})
|
||
*
|
||
* processor.data() // => {charlie: 'delta'}
|
||
* ```
|
||
*
|
||
* @template {keyof Data} Key
|
||
*
|
||
* @overload
|
||
* @returns {Data}
|
||
*
|
||
* @overload
|
||
* @param {Data} dataset
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
*
|
||
* @overload
|
||
* @param {Key} key
|
||
* @returns {Data[Key]}
|
||
*
|
||
* @overload
|
||
* @param {Key} key
|
||
* @param {Data[Key]} value
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
*
|
||
* @param {Data | Key} [key]
|
||
* Key to get or set, or entire dataset to set, or nothing to get the
|
||
* entire dataset (optional).
|
||
* @param {Data[Key]} [value]
|
||
* Value to set (optional).
|
||
* @returns {unknown}
|
||
* The current processor when setting, the value at `key` when getting, or
|
||
* the entire dataset when getting without key.
|
||
*/
|
||
data(key, value) {
|
||
if (typeof key === "string") {
|
||
if (arguments.length === 2) {
|
||
assertUnfrozen("data", this.frozen);
|
||
this.namespace[key] = value;
|
||
return this;
|
||
}
|
||
return own.call(this.namespace, key) && this.namespace[key] || void 0;
|
||
}
|
||
if (key) {
|
||
assertUnfrozen("data", this.frozen);
|
||
this.namespace = key;
|
||
return this;
|
||
}
|
||
return this.namespace;
|
||
}
|
||
/**
|
||
* Freeze a processor.
|
||
*
|
||
* Frozen processors are meant to be extended and not to be configured
|
||
* directly.
|
||
*
|
||
* When a processor is frozen it cannot be unfrozen.
|
||
* New processors working the same way can be created by calling the
|
||
* processor.
|
||
*
|
||
* It’s possible to freeze processors explicitly by calling `.freeze()`.
|
||
* Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
|
||
* `.stringify()`, `.process()`, or `.processSync()` are called.
|
||
*
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
* The current processor.
|
||
*/
|
||
freeze() {
|
||
if (this.frozen) {
|
||
return this;
|
||
}
|
||
const self2 = (
|
||
/** @type {Processor} */
|
||
/** @type {unknown} */
|
||
this
|
||
);
|
||
while (++this.freezeIndex < this.attachers.length) {
|
||
const [attacher, ...options] = this.attachers[this.freezeIndex];
|
||
if (options[0] === false) {
|
||
continue;
|
||
}
|
||
if (options[0] === true) {
|
||
options[0] = void 0;
|
||
}
|
||
const transformer = attacher.call(self2, ...options);
|
||
if (typeof transformer === "function") {
|
||
this.transformers.use(transformer);
|
||
}
|
||
}
|
||
this.frozen = true;
|
||
this.freezeIndex = Number.POSITIVE_INFINITY;
|
||
return this;
|
||
}
|
||
/**
|
||
* Parse text to a syntax tree.
|
||
*
|
||
* > **Note**: `parse` freezes the processor if not already *frozen*.
|
||
*
|
||
* > **Note**: `parse` performs the parse phase, not the run phase or other
|
||
* > phases.
|
||
*
|
||
* @param {Compatible | undefined} [file]
|
||
* file to parse (optional); typically `string` or `VFile`; any value
|
||
* accepted as `x` in `new VFile(x)`.
|
||
* @returns {ParseTree extends undefined ? Node : ParseTree}
|
||
* Syntax tree representing `file`.
|
||
*/
|
||
parse(file) {
|
||
this.freeze();
|
||
const realFile = vfile(file);
|
||
const parser = this.parser || this.Parser;
|
||
assertParser("parse", parser);
|
||
return parser(String(realFile), realFile);
|
||
}
|
||
/**
|
||
* Process the given file as configured on the processor.
|
||
*
|
||
* > **Note**: `process` freezes the processor if not already *frozen*.
|
||
*
|
||
* > **Note**: `process` performs the parse, run, and stringify phases.
|
||
*
|
||
* @overload
|
||
* @param {Compatible | undefined} file
|
||
* @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
|
||
* @returns {undefined}
|
||
*
|
||
* @overload
|
||
* @param {Compatible | undefined} [file]
|
||
* @returns {Promise<VFileWithOutput<CompileResult>>}
|
||
*
|
||
* @param {Compatible | undefined} [file]
|
||
* File (optional); typically `string` or `VFile`]; any value accepted as
|
||
* `x` in `new VFile(x)`.
|
||
* @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
|
||
* Callback (optional).
|
||
* @returns {Promise<VFile> | undefined}
|
||
* Nothing if `done` is given.
|
||
* Otherwise a promise, rejected with a fatal error or resolved with the
|
||
* processed file.
|
||
*
|
||
* The parsed, transformed, and compiled value is available at
|
||
* `file.value` (see note).
|
||
*
|
||
* > **Note**: unified typically compiles by serializing: most
|
||
* > compilers return `string` (or `Uint8Array`).
|
||
* > Some compilers, such as the one configured with
|
||
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
||
* > React tree).
|
||
* > If you’re using a compiler that doesn’t serialize, expect different
|
||
* > result values.
|
||
* >
|
||
* > To register custom results in TypeScript, add them to
|
||
* > {@linkcode CompileResultMap}.
|
||
*
|
||
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
||
*/
|
||
process(file, done) {
|
||
const self2 = this;
|
||
this.freeze();
|
||
assertParser("process", this.parser || this.Parser);
|
||
assertCompiler("process", this.compiler || this.Compiler);
|
||
return done ? executor(void 0, done) : new Promise(executor);
|
||
function executor(resolve, reject) {
|
||
const realFile = vfile(file);
|
||
const parseTree = (
|
||
/** @type {HeadTree extends undefined ? Node : HeadTree} */
|
||
/** @type {unknown} */
|
||
self2.parse(realFile)
|
||
);
|
||
self2.run(parseTree, realFile, function(error, tree, file2) {
|
||
if (error || !tree || !file2) {
|
||
return realDone(error);
|
||
}
|
||
const compileTree = (
|
||
/** @type {CompileTree extends undefined ? Node : CompileTree} */
|
||
/** @type {unknown} */
|
||
tree
|
||
);
|
||
const compileResult = self2.stringify(compileTree, file2);
|
||
if (looksLikeAValue(compileResult)) {
|
||
file2.value = compileResult;
|
||
} else {
|
||
file2.result = compileResult;
|
||
}
|
||
realDone(
|
||
error,
|
||
/** @type {VFileWithOutput<CompileResult>} */
|
||
file2
|
||
);
|
||
});
|
||
function realDone(error, file2) {
|
||
if (error || !file2) {
|
||
reject(error);
|
||
} else if (resolve) {
|
||
resolve(file2);
|
||
} else {
|
||
done(void 0, file2);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* Process the given file as configured on the processor.
|
||
*
|
||
* An error is thrown if asynchronous transforms are configured.
|
||
*
|
||
* > **Note**: `processSync` freezes the processor if not already *frozen*.
|
||
*
|
||
* > **Note**: `processSync` performs the parse, run, and stringify phases.
|
||
*
|
||
* @param {Compatible | undefined} [file]
|
||
* File (optional); typically `string` or `VFile`; any value accepted as
|
||
* `x` in `new VFile(x)`.
|
||
* @returns {VFileWithOutput<CompileResult>}
|
||
* The processed file.
|
||
*
|
||
* The parsed, transformed, and compiled value is available at
|
||
* `file.value` (see note).
|
||
*
|
||
* > **Note**: unified typically compiles by serializing: most
|
||
* > compilers return `string` (or `Uint8Array`).
|
||
* > Some compilers, such as the one configured with
|
||
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
||
* > React tree).
|
||
* > If you’re using a compiler that doesn’t serialize, expect different
|
||
* > result values.
|
||
* >
|
||
* > To register custom results in TypeScript, add them to
|
||
* > {@linkcode CompileResultMap}.
|
||
*
|
||
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
||
*/
|
||
processSync(file) {
|
||
let complete = false;
|
||
let result;
|
||
this.freeze();
|
||
assertParser("processSync", this.parser || this.Parser);
|
||
assertCompiler("processSync", this.compiler || this.Compiler);
|
||
this.process(file, realDone);
|
||
assertDone("processSync", "process", complete);
|
||
return result;
|
||
function realDone(error, file2) {
|
||
complete = true;
|
||
bail(error);
|
||
result = file2;
|
||
}
|
||
}
|
||
/**
|
||
* Run *transformers* on a syntax tree.
|
||
*
|
||
* > **Note**: `run` freezes the processor if not already *frozen*.
|
||
*
|
||
* > **Note**: `run` performs the run phase, not other phases.
|
||
*
|
||
* @overload
|
||
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
||
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
||
* @returns {undefined}
|
||
*
|
||
* @overload
|
||
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
||
* @param {Compatible | undefined} file
|
||
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
||
* @returns {undefined}
|
||
*
|
||
* @overload
|
||
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
||
* @param {Compatible | undefined} [file]
|
||
* @returns {Promise<TailTree extends undefined ? Node : TailTree>}
|
||
*
|
||
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
||
* Tree to transform and inspect.
|
||
* @param {(
|
||
* RunCallback<TailTree extends undefined ? Node : TailTree> |
|
||
* Compatible
|
||
* )} [file]
|
||
* File associated with `node` (optional); any value accepted as `x` in
|
||
* `new VFile(x)`.
|
||
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
|
||
* Callback (optional).
|
||
* @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
|
||
* Nothing if `done` is given.
|
||
* Otherwise, a promise rejected with a fatal error or resolved with the
|
||
* transformed tree.
|
||
*/
|
||
run(tree, file, done) {
|
||
assertNode(tree);
|
||
this.freeze();
|
||
const transformers = this.transformers;
|
||
if (!done && typeof file === "function") {
|
||
done = file;
|
||
file = void 0;
|
||
}
|
||
return done ? executor(void 0, done) : new Promise(executor);
|
||
function executor(resolve, reject) {
|
||
const realFile = vfile(file);
|
||
transformers.run(tree, realFile, realDone);
|
||
function realDone(error, outputTree, file2) {
|
||
const resultingTree = (
|
||
/** @type {TailTree extends undefined ? Node : TailTree} */
|
||
outputTree || tree
|
||
);
|
||
if (error) {
|
||
reject(error);
|
||
} else if (resolve) {
|
||
resolve(resultingTree);
|
||
} else {
|
||
done(void 0, resultingTree, file2);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* Run *transformers* on a syntax tree.
|
||
*
|
||
* An error is thrown if asynchronous transforms are configured.
|
||
*
|
||
* > **Note**: `runSync` freezes the processor if not already *frozen*.
|
||
*
|
||
* > **Note**: `runSync` performs the run phase, not other phases.
|
||
*
|
||
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
||
* Tree to transform and inspect.
|
||
* @param {Compatible | undefined} [file]
|
||
* File associated with `node` (optional); any value accepted as `x` in
|
||
* `new VFile(x)`.
|
||
* @returns {TailTree extends undefined ? Node : TailTree}
|
||
* Transformed tree.
|
||
*/
|
||
runSync(tree, file) {
|
||
let complete = false;
|
||
let result;
|
||
this.run(tree, file, realDone);
|
||
assertDone("runSync", "run", complete);
|
||
return result;
|
||
function realDone(error, tree2) {
|
||
bail(error);
|
||
result = tree2;
|
||
complete = true;
|
||
}
|
||
}
|
||
/**
|
||
* Compile a syntax tree.
|
||
*
|
||
* > **Note**: `stringify` freezes the processor if not already *frozen*.
|
||
*
|
||
* > **Note**: `stringify` performs the stringify phase, not the run phase
|
||
* > or other phases.
|
||
*
|
||
* @param {CompileTree extends undefined ? Node : CompileTree} tree
|
||
* Tree to compile.
|
||
* @param {Compatible | undefined} [file]
|
||
* File associated with `node` (optional); any value accepted as `x` in
|
||
* `new VFile(x)`.
|
||
* @returns {CompileResult extends undefined ? Value : CompileResult}
|
||
* Textual representation of the tree (see note).
|
||
*
|
||
* > **Note**: unified typically compiles by serializing: most compilers
|
||
* > return `string` (or `Uint8Array`).
|
||
* > Some compilers, such as the one configured with
|
||
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
||
* > React tree).
|
||
* > If you’re using a compiler that doesn’t serialize, expect different
|
||
* > result values.
|
||
* >
|
||
* > To register custom results in TypeScript, add them to
|
||
* > {@linkcode CompileResultMap}.
|
||
*
|
||
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
||
*/
|
||
stringify(tree, file) {
|
||
this.freeze();
|
||
const realFile = vfile(file);
|
||
const compiler2 = this.compiler || this.Compiler;
|
||
assertCompiler("stringify", compiler2);
|
||
assertNode(tree);
|
||
return compiler2(tree, realFile);
|
||
}
|
||
/**
|
||
* Configure the processor to use a plugin, a list of usable values, or a
|
||
* preset.
|
||
*
|
||
* If the processor is already using a plugin, the previous plugin
|
||
* configuration is changed based on the options that are passed in.
|
||
* In other words, the plugin is not added a second time.
|
||
*
|
||
* > **Note**: `use` cannot be called on *frozen* processors.
|
||
* > Call the processor first to create a new unfrozen processor.
|
||
*
|
||
* @example
|
||
* There are many ways to pass plugins to `.use()`.
|
||
* This example gives an overview:
|
||
*
|
||
* ```js
|
||
* import {unified} from 'unified'
|
||
*
|
||
* unified()
|
||
* // Plugin with options:
|
||
* .use(pluginA, {x: true, y: true})
|
||
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
||
* .use(pluginA, {y: false, z: true})
|
||
* // Plugins:
|
||
* .use([pluginB, pluginC])
|
||
* // Two plugins, the second with options:
|
||
* .use([pluginD, [pluginE, {}]])
|
||
* // Preset with plugins and settings:
|
||
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
||
* // Settings only:
|
||
* .use({settings: {position: false}})
|
||
* ```
|
||
*
|
||
* @template {Array<unknown>} [Parameters=[]]
|
||
* @template {Node | string | undefined} [Input=undefined]
|
||
* @template [Output=Input]
|
||
*
|
||
* @overload
|
||
* @param {Preset | null | undefined} [preset]
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
*
|
||
* @overload
|
||
* @param {PluggableList} list
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
*
|
||
* @overload
|
||
* @param {Plugin<Parameters, Input, Output>} plugin
|
||
* @param {...(Parameters | [boolean])} parameters
|
||
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
||
*
|
||
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
||
* Usable value.
|
||
* @param {...unknown} parameters
|
||
* Parameters, when a plugin is given as a usable value.
|
||
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
||
* Current processor.
|
||
*/
|
||
use(value, ...parameters) {
|
||
const attachers = this.attachers;
|
||
const namespace = this.namespace;
|
||
assertUnfrozen("use", this.frozen);
|
||
if (value === null || value === void 0) ; else if (typeof value === "function") {
|
||
addPlugin(value, parameters);
|
||
} else if (typeof value === "object") {
|
||
if (Array.isArray(value)) {
|
||
addList(value);
|
||
} else {
|
||
addPreset(value);
|
||
}
|
||
} else {
|
||
throw new TypeError("Expected usable value, not `" + value + "`");
|
||
}
|
||
return this;
|
||
function add2(value2) {
|
||
if (typeof value2 === "function") {
|
||
addPlugin(value2, []);
|
||
} else if (typeof value2 === "object") {
|
||
if (Array.isArray(value2)) {
|
||
const [plugin, ...parameters2] = (
|
||
/** @type {PluginTuple<Array<unknown>>} */
|
||
value2
|
||
);
|
||
addPlugin(plugin, parameters2);
|
||
} else {
|
||
addPreset(value2);
|
||
}
|
||
} else {
|
||
throw new TypeError("Expected usable value, not `" + value2 + "`");
|
||
}
|
||
}
|
||
function addPreset(result) {
|
||
if (!("plugins" in result) && !("settings" in result)) {
|
||
throw new Error(
|
||
"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"
|
||
);
|
||
}
|
||
addList(result.plugins);
|
||
if (result.settings) {
|
||
namespace.settings = (0, import_extend.default)(true, namespace.settings, result.settings);
|
||
}
|
||
}
|
||
function addList(plugins) {
|
||
let index2 = -1;
|
||
if (plugins === null || plugins === void 0) ; else if (Array.isArray(plugins)) {
|
||
while (++index2 < plugins.length) {
|
||
const thing = plugins[index2];
|
||
add2(thing);
|
||
}
|
||
} else {
|
||
throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
|
||
}
|
||
}
|
||
function addPlugin(plugin, parameters2) {
|
||
let index2 = -1;
|
||
let entryIndex = -1;
|
||
while (++index2 < attachers.length) {
|
||
if (attachers[index2][0] === plugin) {
|
||
entryIndex = index2;
|
||
break;
|
||
}
|
||
}
|
||
if (entryIndex === -1) {
|
||
attachers.push([plugin, ...parameters2]);
|
||
} else if (parameters2.length > 0) {
|
||
let [primary, ...rest] = parameters2;
|
||
const currentPrimary = attachers[entryIndex][1];
|
||
if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
|
||
primary = (0, import_extend.default)(true, currentPrimary, primary);
|
||
}
|
||
attachers[entryIndex] = [plugin, primary, ...rest];
|
||
}
|
||
}
|
||
}
|
||
};
|
||
var unified = new Processor().freeze();
|
||
function assertParser(name, value) {
|
||
if (typeof value !== "function") {
|
||
throw new TypeError("Cannot `" + name + "` without `parser`");
|
||
}
|
||
}
|
||
function assertCompiler(name, value) {
|
||
if (typeof value !== "function") {
|
||
throw new TypeError("Cannot `" + name + "` without `compiler`");
|
||
}
|
||
}
|
||
function assertUnfrozen(name, frozen) {
|
||
if (frozen) {
|
||
throw new Error(
|
||
"Cannot call `" + name + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
|
||
);
|
||
}
|
||
}
|
||
function assertNode(node2) {
|
||
if (!isPlainObject(node2) || typeof node2.type !== "string") {
|
||
throw new TypeError("Expected node, got `" + node2 + "`");
|
||
}
|
||
}
|
||
function assertDone(name, asyncName, complete) {
|
||
if (!complete) {
|
||
throw new Error(
|
||
"`" + name + "` finished async. Use `" + asyncName + "` instead"
|
||
);
|
||
}
|
||
}
|
||
function vfile(value) {
|
||
return looksLikeAVFile(value) ? value : new VFile(value);
|
||
}
|
||
function looksLikeAVFile(value) {
|
||
return Boolean(
|
||
value && typeof value === "object" && "message" in value && "messages" in value
|
||
);
|
||
}
|
||
function looksLikeAValue(value) {
|
||
return typeof value === "string" || isUint8Array2(value);
|
||
}
|
||
function isUint8Array2(value) {
|
||
return Boolean(
|
||
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
||
);
|
||
}
|
||
|
||
// node_modules/nlcst-to-string/lib/index.js
|
||
var emptyNodes = [];
|
||
function toString2(value) {
|
||
let index2 = -1;
|
||
if (!value || !Array.isArray(value) && !value.type) {
|
||
throw new Error("Expected node, not `" + value + "`");
|
||
}
|
||
if ("value" in value) return value.value;
|
||
const children = (Array.isArray(value) ? value : value.children) || emptyNodes;
|
||
const values = [];
|
||
while (++index2 < children.length) {
|
||
values[index2] = toString2(children[index2]);
|
||
}
|
||
return values.join("");
|
||
}
|
||
|
||
// node_modules/array-iterate/lib/index.js
|
||
var own2 = {}.hasOwnProperty;
|
||
function arrayIterate(values, callbackFn, thisArg) {
|
||
let index2 = -1;
|
||
if (!values) {
|
||
throw new Error("Iterate requires that |this| not be " + values);
|
||
}
|
||
if (!own2.call(values, "length")) {
|
||
throw new Error("Iterate requires that |this| has a `length`");
|
||
}
|
||
if (typeof callbackFn !== "function") {
|
||
throw new TypeError("`callback` must be a function");
|
||
}
|
||
while (++index2 < values.length) {
|
||
if (!(index2 in values)) {
|
||
continue;
|
||
}
|
||
const result = callbackFn.call(thisArg, values[index2], index2, values);
|
||
if (typeof result === "number") {
|
||
if (result < 0) {
|
||
index2 = 0;
|
||
}
|
||
index2 = result - 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
// node_modules/unist-util-modify-children/lib/index.js
|
||
function modifyChildren(modifier) {
|
||
return modify;
|
||
function modify(parent) {
|
||
if (!parent || !parent.children) {
|
||
throw new Error("Missing children in `parent` for `modifier`");
|
||
}
|
||
arrayIterate(parent.children, iteratee, parent);
|
||
}
|
||
function iteratee(node2, index2) {
|
||
return modifier(node2, index2, this);
|
||
}
|
||
}
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-affix-exceptions.js
|
||
var mergeAffixExceptions = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
const previous2 = parent.children[index2 - 1];
|
||
if (previous2 && "children" in previous2 && "children" in child && child.children.length > 0) {
|
||
let position2 = -1;
|
||
while (child.children[++position2]) {
|
||
const node2 = child.children[position2];
|
||
if (node2.type === "WordNode") {
|
||
return;
|
||
}
|
||
if (node2.type === "SymbolNode" || node2.type === "PunctuationNode") {
|
||
const value = toString2(node2);
|
||
if (value !== "," && value !== ";") {
|
||
return;
|
||
}
|
||
previous2.children.push(...child.children);
|
||
if (previous2.position && child.position) {
|
||
previous2.position.end = child.position.end;
|
||
}
|
||
parent.children.splice(index2, 1);
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/expressions.js
|
||
var affixSymbol = /^([!"').?\u0F3B\u0F3D\u169C\u2019\u201D\u2026\u203A\u203D\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21\u2E23\u2E25\u2E27\u2E29\u2E56\u2E58\u2E5A\u2E5C\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63\u00BB\]}])\1*$/;
|
||
var newLine = /^[ \t]*((\r?\n|\r)[\t ]*)+$/;
|
||
var terminalMarker = /^([!.?\u2026\u203D]+)$/;
|
||
var wordSymbolInner = /^([&'\-.:=?@\u00AD\u00B7\u2010\u2011\u2019\u2027]|_+)$/;
|
||
var numerical = /^(?:[\d\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])+$/;
|
||
var digitStart = /^\d/;
|
||
var lowerInitial = /^(?:[a-z\u00B5\u00DF-\u00F6\u00F8-\u00FF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5F\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C1\uA7C3\uA7C8\uA7CA\uA7D1\uA7D3\uA7D5\uA7D7\uA7D9\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]|\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E\uDF25-\uDF2A]|\uD83A[\uDD22-\uDD43])/;
|
||
var surrogates = /[\uD800-\uDFFF]/;
|
||
var punctuation = /[!"'-),-/:;?[-\]_{}\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u201F\u2022-\u2027\u2032-\u203A\u203C-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;
|
||
var word = /[\dA-Za-z\u00AA\u00B2\u00B3\u00B5\u00B9\u00BA\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u0870-\u0887\u0889-\u088E\u0898-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BF2\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7E\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D63\u0D66-\u0D78\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F33\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1715\u171F-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u17F0-\u17F9\u180B-\u180D\u180F-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ACE\u1B00-\u1B4C\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u20D0-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA827\uA82C\uA830-\uA835\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE6\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDEFD-\uDF27\uDF30-\uDF54\uDF70-\uDF85\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC52-\uDC75\uDC7F-\uDCBA\uDCC2\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE37\uDE3E-\uDE41\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDF00-\uDF10\uDF12-\uDF3A\uDF3E-\uDF42\uDF50-\uDF59\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC40-\uDC55]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC30-\uDC6D\uDC8F\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAE\uDEC0-\uDEF9]|\uD839[\uDCD0-\uDCF9\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF]|\uDB40[\uDD00-\uDDEF]/;
|
||
var whiteSpace = /[\t-\r \u0085\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-affix-symbol.js
|
||
var mergeAffixSymbol = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if ("children" in child && child.children.length > 0 && index2 > 0) {
|
||
const previous2 = parent.children[index2 - 1];
|
||
const first = child.children[0];
|
||
const second = child.children[1];
|
||
if (previous2 && previous2.type === "SentenceNode" && (first.type === "SymbolNode" || first.type === "PunctuationNode") && affixSymbol.test(toString2(first))) {
|
||
child.children.shift();
|
||
previous2.children.push(first);
|
||
if (first.position && previous2.position) {
|
||
previous2.position.end = first.position.end;
|
||
}
|
||
if (second && second.position && child.position) {
|
||
child.position.start = second.position.start;
|
||
}
|
||
return index2 - 1;
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/break-implicit-sentences.js
|
||
var breakImplicitSentences = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if (child.type !== "SentenceNode") {
|
||
return;
|
||
}
|
||
const children = child.children;
|
||
let position2 = 0;
|
||
while (++position2 < children.length - 1) {
|
||
const node2 = children[position2];
|
||
if (node2.type !== "WhiteSpaceNode" || toString2(node2).split(/\r\n|\r|\n/).length < 3) {
|
||
continue;
|
||
}
|
||
child.children = children.slice(0, position2);
|
||
const insertion = {
|
||
type: "SentenceNode",
|
||
children: children.slice(position2 + 1)
|
||
};
|
||
const tail = children[position2 - 1];
|
||
const head = children[position2 + 1];
|
||
parent.children.splice(index2 + 1, 0, node2, insertion);
|
||
if (child.position && tail.position && head.position) {
|
||
const end = child.position.end;
|
||
child.position.end = tail.position.end;
|
||
insertion.position = { start: head.position.start, end };
|
||
}
|
||
return index2 + 1;
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/make-final-white-space-siblings.js
|
||
var makeFinalWhiteSpaceSiblings = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph | Root>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if ("children" in child) {
|
||
const tail = child.children[child.children.length - 1];
|
||
if (tail && tail.type === "WhiteSpaceNode") {
|
||
child.children.pop();
|
||
parent.children.splice(index2 + 1, 0, tail);
|
||
const previous2 = child.children[child.children.length - 1];
|
||
if (previous2 && previous2.position && child.position) {
|
||
child.position.end = previous2.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/unist-util-visit-children/lib/index.js
|
||
function visitChildren(visitor) {
|
||
return visit2;
|
||
function visit2(parent) {
|
||
const children = parent && parent.children;
|
||
let index2 = -1;
|
||
if (!children) {
|
||
throw new Error("Missing children in `parent` for `visit`");
|
||
}
|
||
while (++index2 in children) {
|
||
visitor(children[index2], index2, parent);
|
||
}
|
||
}
|
||
}
|
||
|
||
// node_modules/parse-latin/lib/plugin/make-initial-white-space-siblings.js
|
||
var makeInitialWhiteSpaceSiblings = visitChildren(
|
||
/**
|
||
* @type {import('unist-util-visit-children').Visitor<Paragraph | Root>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if ("children" in child && child.children) {
|
||
const head = child.children[0];
|
||
if (head && head.type === "WhiteSpaceNode") {
|
||
child.children.shift();
|
||
parent.children.splice(index2, 0, head);
|
||
const next = child.children[0];
|
||
if (next && next.position && child.position) {
|
||
child.position.start = next.position.start;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-final-word-symbol.js
|
||
var mergeFinalWordSymbol = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Sentence>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if (index2 > 0 && (child.type === "SymbolNode" || child.type === "PunctuationNode") && toString2(child) === "-") {
|
||
const children = parent.children;
|
||
const previous2 = children[index2 - 1];
|
||
const next = children[index2 + 1];
|
||
if ((!next || next.type !== "WordNode") && previous2 && previous2.type === "WordNode") {
|
||
children.splice(index2, 1);
|
||
previous2.children.push(child);
|
||
if (previous2.position && child.position) {
|
||
previous2.position.end = child.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-initial-digit-sentences.js
|
||
var mergeInitialDigitSentences = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
const previous2 = parent.children[index2 - 1];
|
||
if (previous2 && previous2.type === "SentenceNode" && child.type === "SentenceNode") {
|
||
const head = child.children[0];
|
||
if (head && head.type === "WordNode" && digitStart.test(toString2(head))) {
|
||
previous2.children.push(...child.children);
|
||
parent.children.splice(index2, 1);
|
||
if (previous2.position && child.position) {
|
||
previous2.position.end = child.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-initial-lower-case-letter-sentences.js
|
||
var mergeInitialLowerCaseLetterSentences = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if (child.type === "SentenceNode" && index2 > 0) {
|
||
const previous2 = parent.children[index2 - 1];
|
||
const children = child.children;
|
||
if (children.length > 0 && previous2.type === "SentenceNode") {
|
||
let position2 = -1;
|
||
while (children[++position2]) {
|
||
const node2 = children[position2];
|
||
if (node2.type === "WordNode") {
|
||
if (!lowerInitial.test(toString2(node2))) {
|
||
return;
|
||
}
|
||
previous2.children.push(...children);
|
||
parent.children.splice(index2, 1);
|
||
if (previous2.position && child.position) {
|
||
previous2.position.end = child.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
if (node2.type === "SymbolNode" || node2.type === "PunctuationNode") {
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-initial-word-symbol.js
|
||
var mergeInitialWordSymbol = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Sentence>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if (child.type !== "SymbolNode" && child.type !== "PunctuationNode" || toString2(child) !== "&") {
|
||
return;
|
||
}
|
||
const children = parent.children;
|
||
const next = children[index2 + 1];
|
||
if (index2 > 0 && children[index2 - 1].type === "WordNode" || !(next && next.type === "WordNode")) {
|
||
return;
|
||
}
|
||
children.splice(index2, 1);
|
||
next.children.unshift(child);
|
||
if (next.position && child.position) {
|
||
next.position.start = child.position.start;
|
||
}
|
||
return index2 - 1;
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-initialisms.js
|
||
var mergeInitialisms = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Sentence>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if (index2 > 0 && child.type === "PunctuationNode" && toString2(child) === ".") {
|
||
const previous2 = parent.children[index2 - 1];
|
||
if (previous2.type === "WordNode" && previous2.children && previous2.children.length !== 1 && previous2.children.length % 2 !== 0) {
|
||
let position2 = previous2.children.length;
|
||
let isAllDigits = true;
|
||
while (previous2.children[--position2]) {
|
||
const otherChild = previous2.children[position2];
|
||
const value = toString2(otherChild);
|
||
if (position2 % 2 === 0) {
|
||
if (value.length > 1) {
|
||
return;
|
||
}
|
||
if (!numerical.test(value)) {
|
||
isAllDigits = false;
|
||
}
|
||
} else if (value !== ".") {
|
||
if (position2 < previous2.children.length - 2) {
|
||
break;
|
||
} else {
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
if (!isAllDigits) {
|
||
parent.children.splice(index2, 1);
|
||
previous2.children.push(child);
|
||
if (previous2.position && child.position) {
|
||
previous2.position.end = child.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-inner-word-symbol.js
|
||
var mergeInnerWordSymbol = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Sentence>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if (index2 > 0 && (child.type === "SymbolNode" || child.type === "PunctuationNode")) {
|
||
const siblings = parent.children;
|
||
const previous2 = siblings[index2 - 1];
|
||
if (previous2 && previous2.type === "WordNode") {
|
||
let position2 = index2 - 1;
|
||
const tokens = [];
|
||
let queue = [];
|
||
while (siblings[++position2]) {
|
||
const sibling = siblings[position2];
|
||
if (sibling.type === "WordNode") {
|
||
tokens.push(...queue, ...sibling.children);
|
||
queue = [];
|
||
} else if ((sibling.type === "SymbolNode" || sibling.type === "PunctuationNode") && wordSymbolInner.test(toString2(sibling))) {
|
||
queue.push(sibling);
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
if (tokens.length > 0) {
|
||
if (queue.length > 0) {
|
||
position2 -= queue.length;
|
||
}
|
||
siblings.splice(index2, position2 - index2);
|
||
previous2.children.push(...tokens);
|
||
const last = tokens[tokens.length - 1];
|
||
if (previous2.position && last.position) {
|
||
previous2.position.end = last.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-inner-word-slash.js
|
||
var mergeInnerWordSlash = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Sentence>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
const siblings = parent.children;
|
||
const previous2 = siblings[index2 - 1];
|
||
if (previous2 && previous2.type === "WordNode" && (child.type === "SymbolNode" || child.type === "PunctuationNode") && toString2(child) === "/") {
|
||
const previousValue = toString2(previous2);
|
||
let tail = child;
|
||
const queue = [child];
|
||
let count = 1;
|
||
let nextValue = "";
|
||
const next = siblings[index2 + 1];
|
||
if (next && next.type === "WordNode") {
|
||
nextValue = toString2(next);
|
||
tail = next;
|
||
queue.push(...next.children);
|
||
count++;
|
||
}
|
||
if (previousValue.length < 3 && (!nextValue || nextValue.length < 3)) {
|
||
previous2.children.push(...queue);
|
||
siblings.splice(index2, count);
|
||
if (previous2.position && tail.position) {
|
||
previous2.position.end = tail.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-non-word-sentences.js
|
||
var mergeNonWordSentences = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if ("children" in child) {
|
||
let position2 = -1;
|
||
while (child.children[++position2]) {
|
||
if (child.children[position2].type === "WordNode") {
|
||
return;
|
||
}
|
||
}
|
||
const previous2 = parent.children[index2 - 1];
|
||
if (previous2 && "children" in previous2) {
|
||
previous2.children.push(...child.children);
|
||
parent.children.splice(index2, 1);
|
||
if (previous2.position && child.position) {
|
||
previous2.position.end = child.position.end;
|
||
}
|
||
return index2;
|
||
}
|
||
const next = parent.children[index2 + 1];
|
||
if (next && "children" in next) {
|
||
next.children.unshift(...child.children);
|
||
if (next.position && child.position) {
|
||
next.position.start = child.position.start;
|
||
}
|
||
parent.children.splice(index2, 1);
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-prefix-exceptions.js
|
||
var abbreviationPrefix = new RegExp(
|
||
"^([0-9]{1,3}|[a-z]|al|ca|cap|cca|cent|cf|cit|con|cp|cwt|ead|etc|ff|fl|ibid|id|nem|op|pro|seq|sic|stat|tem|viz)$"
|
||
);
|
||
var mergePrefixExceptions = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if ("children" in child && child.children.length > 1) {
|
||
const period = child.children[child.children.length - 1];
|
||
if (period && (period.type === "PunctuationNode" || period.type === "SymbolNode") && toString2(period) === ".") {
|
||
const node2 = child.children[child.children.length - 2];
|
||
if (node2 && node2.type === "WordNode" && abbreviationPrefix.test(toString2(node2).toLowerCase())) {
|
||
node2.children.push(period);
|
||
child.children.pop();
|
||
if (period.position && node2.position) {
|
||
node2.position.end = period.position.end;
|
||
}
|
||
const next = parent.children[index2 + 1];
|
||
if (next && next.type === "SentenceNode") {
|
||
child.children.push(...next.children);
|
||
parent.children.splice(index2 + 1, 1);
|
||
if (next.position && child.position) {
|
||
child.position.end = next.position.end;
|
||
}
|
||
return index2 - 1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/merge-remaining-full-stops.js
|
||
var mergeRemainingFullStops = visitChildren(
|
||
/**
|
||
* @type {import('unist-util-visit-children').Visitor<Paragraph>}
|
||
*/
|
||
// eslint-disable-next-line complexity
|
||
function(child, _, _parent) {
|
||
if ("children" in child) {
|
||
let position2 = child.children.length;
|
||
let hasFoundDelimiter = false;
|
||
while (child.children[--position2]) {
|
||
const grandchild = child.children[position2];
|
||
if (grandchild.type !== "SymbolNode" && grandchild.type !== "PunctuationNode") {
|
||
if (grandchild.type === "WordNode") {
|
||
hasFoundDelimiter = true;
|
||
}
|
||
continue;
|
||
}
|
||
if (!terminalMarker.test(toString2(grandchild))) {
|
||
continue;
|
||
}
|
||
if (!hasFoundDelimiter) {
|
||
hasFoundDelimiter = true;
|
||
continue;
|
||
}
|
||
if (toString2(grandchild) !== ".") {
|
||
continue;
|
||
}
|
||
const previous2 = child.children[position2 - 1];
|
||
const next = child.children[position2 + 1];
|
||
if (previous2 && previous2.type === "WordNode") {
|
||
const nextNext = child.children[position2 + 2];
|
||
if (next && nextNext && next.type === "WhiteSpaceNode" && toString2(nextNext) === ".") {
|
||
continue;
|
||
}
|
||
child.children.splice(position2, 1);
|
||
previous2.children.push(grandchild);
|
||
if (grandchild.position && previous2.position) {
|
||
previous2.position.end = grandchild.position.end;
|
||
}
|
||
position2--;
|
||
} else if (next && next.type === "WordNode") {
|
||
child.children.splice(position2, 1);
|
||
next.children.unshift(grandchild);
|
||
if (grandchild.position && next.position) {
|
||
next.position.start = grandchild.position.start;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/remove-empty-nodes.js
|
||
var removeEmptyNodes = modifyChildren(
|
||
/**
|
||
* @type {import('unist-util-modify-children').Modifier<Paragraph | Root>}
|
||
*/
|
||
function(child, index2, parent) {
|
||
if ("children" in child && child.children.length === 0) {
|
||
parent.children.splice(index2, 1);
|
||
return index2;
|
||
}
|
||
}
|
||
);
|
||
|
||
// node_modules/parse-latin/lib/plugin/patch-position.js
|
||
var patchPosition = visitChildren(
|
||
/**
|
||
* @type {import('unist-util-visit-children').Visitor<Paragraph | Root | Sentence>}
|
||
*/
|
||
function(child, index2, node2) {
|
||
const siblings = node2.children;
|
||
if (child.position && index2 < 1 && /* c8 ignore next */
|
||
(!node2.position || !node2.position.start)) {
|
||
patch(node2);
|
||
node2.position.start = child.position.start;
|
||
}
|
||
if (child.position && index2 === siblings.length - 1 && (!node2.position || !node2.position.end)) {
|
||
patch(node2);
|
||
node2.position.end = child.position.end;
|
||
}
|
||
}
|
||
);
|
||
function patch(node2) {
|
||
if (!node2.position) {
|
||
node2.position = {};
|
||
}
|
||
}
|
||
|
||
// node_modules/parse-latin/lib/index.js
|
||
var ParseLatin = class {
|
||
/**
|
||
* Create a new parser.
|
||
*
|
||
* This additionally supports `retext`-like call: where an instance is
|
||
* created for each file, and the file is given on construction.
|
||
*
|
||
* @param {string | null | undefined} [doc]
|
||
* Value to parse (optional).
|
||
* @param {VFile | null | undefined} [file]
|
||
* Corresponding file (optional).
|
||
*/
|
||
constructor(doc, file) {
|
||
const value = file || doc;
|
||
this.doc = value ? String(value) : void 0;
|
||
this.tokenizeRootPlugins = [...this.tokenizeRootPlugins];
|
||
this.tokenizeParagraphPlugins = [...this.tokenizeParagraphPlugins];
|
||
this.tokenizeSentencePlugins = [...this.tokenizeSentencePlugins];
|
||
}
|
||
/**
|
||
* Turn natural language into a syntax tree.
|
||
*
|
||
* @param {string | null | undefined} [value]
|
||
* Value to parse (optional).
|
||
* @returns {Root}
|
||
* Tree.
|
||
*/
|
||
parse(value) {
|
||
return this.tokenizeRoot(value || this.doc);
|
||
}
|
||
/**
|
||
* Parse as a root.
|
||
*
|
||
* @param {string | null | undefined} [value]
|
||
* Value to parse (optional).
|
||
* @returns {Root}
|
||
* Built tree.
|
||
*/
|
||
tokenizeRoot(value) {
|
||
const paragraph2 = this.tokenizeParagraph(value);
|
||
const result = {
|
||
type: "RootNode",
|
||
children: splitNode(paragraph2, "WhiteSpaceNode", newLine)
|
||
};
|
||
let index2 = -1;
|
||
while (this.tokenizeRootPlugins[++index2]) {
|
||
this.tokenizeRootPlugins[index2](result);
|
||
}
|
||
return result;
|
||
}
|
||
/**
|
||
* Parse as a paragraph.
|
||
*
|
||
* @param {string | null | undefined} [value]
|
||
* Value to parse (optional).
|
||
* @returns {Paragraph}
|
||
* Built tree.
|
||
*/
|
||
tokenizeParagraph(value) {
|
||
const sentence = this.tokenizeSentence(value);
|
||
const result = {
|
||
type: "ParagraphNode",
|
||
children: splitNode(sentence, "PunctuationNode", terminalMarker)
|
||
};
|
||
let index2 = -1;
|
||
while (this.tokenizeParagraphPlugins[++index2]) {
|
||
this.tokenizeParagraphPlugins[index2](result);
|
||
}
|
||
return result;
|
||
}
|
||
/**
|
||
* Parse as a sentence.
|
||
*
|
||
* @param {string | null | undefined} [value]
|
||
* Value to parse (optional).
|
||
* @returns {Sentence}
|
||
* Built tree.
|
||
*/
|
||
tokenizeSentence(value) {
|
||
const children = this.tokenize(value);
|
||
const result = { type: "SentenceNode", children };
|
||
let index2 = -1;
|
||
while (this.tokenizeSentencePlugins[++index2]) {
|
||
this.tokenizeSentencePlugins[index2](result);
|
||
}
|
||
return result;
|
||
}
|
||
/**
|
||
* Transform a `value` into a list of nlcsts.
|
||
*
|
||
* @param {string | null | undefined} [value]
|
||
* Value to parse (optional).
|
||
* @returns {Array<SentenceContent>}
|
||
* Built sentence content.
|
||
*/
|
||
tokenize(value) {
|
||
const children = [];
|
||
if (!value) {
|
||
return children;
|
||
}
|
||
const currentPoint = { line: 1, column: 1, offset: 0 };
|
||
let from = 0;
|
||
let index2 = 0;
|
||
let start = { ...currentPoint };
|
||
let previousType;
|
||
let previous2;
|
||
while (index2 < value.length) {
|
||
const current = value.charAt(index2);
|
||
const currentType = whiteSpace.test(current) ? "WhiteSpaceNode" : punctuation.test(current) ? "PunctuationNode" : word.test(current) ? "WordNode" : "SymbolNode";
|
||
if (from < index2 && previousType && currentType && !(previousType === currentType && // Words or white space continue.
|
||
(previousType === "WordNode" || previousType === "WhiteSpaceNode" || // Same character of punctuation or symbol also continues.
|
||
current === previous2 || // Surrogates of punctuation or symbol also continue.
|
||
surrogates.test(current)))) {
|
||
children.push(createNode(previousType, value.slice(from, index2)));
|
||
from = index2;
|
||
start = { ...currentPoint };
|
||
}
|
||
if (current === "\r" || current === "\n" && previous2 !== "\r") {
|
||
currentPoint.line++;
|
||
currentPoint.column = 1;
|
||
} else if (current !== "\n") {
|
||
currentPoint.column++;
|
||
}
|
||
currentPoint.offset++;
|
||
previousType = currentType;
|
||
previous2 = current;
|
||
index2++;
|
||
}
|
||
if (previousType && from < index2) {
|
||
children.push(createNode(previousType, value.slice(from, index2)));
|
||
}
|
||
return children;
|
||
function createNode(type, value2) {
|
||
return type === "WordNode" ? {
|
||
type: "WordNode",
|
||
children: [
|
||
{
|
||
type: "TextNode",
|
||
value: value2,
|
||
position: { start, end: { ...currentPoint } }
|
||
}
|
||
],
|
||
position: { start, end: { ...currentPoint } }
|
||
} : { type, value: value2, position: { start, end: { ...currentPoint } } };
|
||
}
|
||
}
|
||
};
|
||
ParseLatin.prototype.tokenizeSentencePlugins = [
|
||
mergeInitialWordSymbol,
|
||
mergeFinalWordSymbol,
|
||
mergeInnerWordSymbol,
|
||
mergeInnerWordSlash,
|
||
mergeInitialisms,
|
||
patchPosition
|
||
];
|
||
ParseLatin.prototype.tokenizeParagraphPlugins = [
|
||
mergeNonWordSentences,
|
||
mergeAffixSymbol,
|
||
mergeInitialLowerCaseLetterSentences,
|
||
mergeInitialDigitSentences,
|
||
mergePrefixExceptions,
|
||
mergeAffixExceptions,
|
||
mergeRemainingFullStops,
|
||
makeInitialWhiteSpaceSiblings,
|
||
makeFinalWhiteSpaceSiblings,
|
||
breakImplicitSentences,
|
||
removeEmptyNodes,
|
||
patchPosition
|
||
];
|
||
ParseLatin.prototype.tokenizeRootPlugins = [
|
||
makeInitialWhiteSpaceSiblings,
|
||
makeFinalWhiteSpaceSiblings,
|
||
removeEmptyNodes,
|
||
patchPosition
|
||
];
|
||
function splitNode(node2, childType, expression) {
|
||
const result = [];
|
||
let index2 = -1;
|
||
let start = 0;
|
||
while (++index2 < node2.children.length) {
|
||
const token = node2.children[index2];
|
||
if (index2 === node2.children.length - 1 || token.type === childType && expression.test(toString2(token))) {
|
||
const parent = {
|
||
type: node2.type,
|
||
children: node2.children.slice(start, index2 + 1)
|
||
};
|
||
const first = node2.children[start];
|
||
const last = token;
|
||
if (first.position && last.position) {
|
||
parent.position = {
|
||
start: first.position.start,
|
||
end: last.position.end
|
||
};
|
||
}
|
||
result.push(parent);
|
||
start = index2 + 1;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
// node_modules/retext-latin/lib/index.js
|
||
function retextLatin() {
|
||
const self2 = (
|
||
/** @type {import('unified').Processor<Root>} */
|
||
this
|
||
);
|
||
self2.parser = parser;
|
||
function parser(value) {
|
||
const parser2 = new ParseLatin();
|
||
add(parser2.tokenizeParagraphPlugins, self2.data("nlcstParagraphExtensions"));
|
||
add(parser2.tokenizeRootPlugins, self2.data("nlcstRootExtensions"));
|
||
add(parser2.tokenizeSentencePlugins, self2.data("nlcstSentenceExtensions"));
|
||
return parser2.parse(value);
|
||
}
|
||
}
|
||
function add(list2, values) {
|
||
if (values) list2.unshift(...values);
|
||
}
|
||
|
||
// node_modules/retext-stringify/lib/index.js
|
||
function retextStringify() {
|
||
const self2 = (
|
||
/** @type {import('unified').Processor<undefined, undefined, undefined, Root, string>} */
|
||
// @ts-expect-error -- TS in JSDoc doesn’t understand `this`.
|
||
this
|
||
);
|
||
self2.compiler = compiler;
|
||
}
|
||
function compiler(tree) {
|
||
return toString2(tree);
|
||
}
|
||
|
||
// node_modules/retext/index.js
|
||
var retext = unified().use(retextLatin).use(retextStringify).freeze();
|
||
|
||
// node_modules/retext-smartypants/lib/index.js
|
||
var defaultClosingQuotes = ["\u201D", "\u2019"];
|
||
var defaultOpeningQuotes = ["\u201C", "\u2018"];
|
||
var emptyOptions3 = {};
|
||
function retextSmartypants(options) {
|
||
const settings = options || emptyOptions3;
|
||
const methods = [];
|
||
if (settings.quotes !== false) {
|
||
methods.push(quotesDefault);
|
||
}
|
||
if (settings.ellipses === "spaced") {
|
||
methods.push(ellipsesSpaced);
|
||
} else if (settings.ellipses === "unspaced") {
|
||
methods.push(ellipsesUnspaced);
|
||
} else if (settings.ellipses !== false) {
|
||
methods.push(ellipsesDefault);
|
||
}
|
||
if (settings.backticks === "all") {
|
||
if (settings.quotes !== false) {
|
||
throw new Error("Cannot accept `backticks: 'all'` with `quotes: true`");
|
||
}
|
||
methods.push(backticksAll);
|
||
} else if (settings.backticks !== false) {
|
||
methods.push(backticksDefault);
|
||
}
|
||
if (settings.dashes === "inverted") {
|
||
methods.push(dashesInverted);
|
||
} else if (settings.dashes === "oldschool") {
|
||
methods.push(dashesOldschool);
|
||
} else if (settings.dashes !== false) {
|
||
methods.push(dashesDefault);
|
||
}
|
||
const state = {
|
||
close: settings.closingQuotes ? [settings.closingQuotes.double, settings.closingQuotes.single] : defaultClosingQuotes,
|
||
open: settings.openingQuotes ? [settings.openingQuotes.double, settings.openingQuotes.single] : defaultOpeningQuotes
|
||
};
|
||
return function(tree) {
|
||
visit(tree, function(node2, position2, parent) {
|
||
let index2 = -1;
|
||
if (parent && position2 !== void 0 && (node2.type === "PunctuationNode" || node2.type === "SymbolNode")) {
|
||
while (++index2 < methods.length) {
|
||
const result = methods[index2](state, node2, position2, parent);
|
||
if (result === true) {
|
||
console.log("drop", node2);
|
||
parent.children.splice(position2, 1);
|
||
return position2;
|
||
}
|
||
}
|
||
}
|
||
});
|
||
};
|
||
}
|
||
function backticksAll(state, node2, index2, parent) {
|
||
backticksDefault(state, node2);
|
||
if (node2.value === "`") {
|
||
node2.value = "\u2018";
|
||
} else if (node2.value === "'") {
|
||
node2.value = "\u2019";
|
||
}
|
||
}
|
||
function backticksDefault(_, node2) {
|
||
if (node2.value === "``") {
|
||
node2.value = "\u201C";
|
||
} else if (node2.value === "''") {
|
||
node2.value = "\u201D";
|
||
}
|
||
}
|
||
function dashesDefault(_, node2) {
|
||
if (node2.value === "--") {
|
||
node2.value = "\u2014";
|
||
}
|
||
}
|
||
function dashesInverted(_, node2, index2, parent) {
|
||
const next = parent.children[index2 + 1];
|
||
if (node2.value === "\u2014" && next && next.type === "PunctuationNode" && next.value === "-") {
|
||
next.value = "\u2013";
|
||
return true;
|
||
}
|
||
if (node2.value === "---") {
|
||
node2.value = "\u2013";
|
||
} else if (node2.value === "--") {
|
||
node2.value = "\u2014";
|
||
}
|
||
}
|
||
function dashesOldschool(_, node2, index2, parent) {
|
||
const next = parent.children[index2 + 1];
|
||
if (node2.value === "\u2013" && next && next.type === "PunctuationNode" && next.value === "-") {
|
||
next.value = "\u2014";
|
||
return true;
|
||
}
|
||
if (node2.value === "---") {
|
||
node2.value = "\u2014";
|
||
} else if (node2.value === "--") {
|
||
node2.value = "\u2013";
|
||
}
|
||
}
|
||
function ellipsesDefault(_, node2, index2, parent) {
|
||
ellipsesSpaced(_, node2, index2, parent);
|
||
ellipsesUnspaced(_, node2);
|
||
}
|
||
function ellipsesSpaced(_, node2, index2, parent) {
|
||
const value = node2.value;
|
||
const siblings = parent.children;
|
||
if (!/^\.+$/.test(value)) {
|
||
return;
|
||
}
|
||
const nodes = [];
|
||
let position2 = index2;
|
||
let count = 1;
|
||
while (--position2 > 0) {
|
||
let sibling = siblings[position2];
|
||
if (sibling.type !== "WhiteSpaceNode") {
|
||
break;
|
||
}
|
||
const queue = sibling;
|
||
sibling = siblings[--position2];
|
||
if (sibling && (sibling.type === "PunctuationNode" || sibling.type === "SymbolNode") && /^\.+$/.test(sibling.value)) {
|
||
nodes.push(queue, sibling);
|
||
count++;
|
||
continue;
|
||
}
|
||
break;
|
||
}
|
||
if (count < 3) {
|
||
return;
|
||
}
|
||
siblings.splice(index2 - nodes.length, nodes.length);
|
||
node2.value = "\u2026";
|
||
}
|
||
function ellipsesUnspaced(_, node2) {
|
||
if (/^\.{3,}$/.test(node2.value)) {
|
||
node2.value = "\u2026";
|
||
}
|
||
}
|
||
function quotesDefault(state, node2, index2, parent) {
|
||
const siblings = parent.children;
|
||
const value = node2.value;
|
||
if (value !== '"' && value !== "'") {
|
||
return;
|
||
}
|
||
const quoteIndex = value === '"' ? 0 : 1;
|
||
const previous2 = siblings[index2 - 1];
|
||
const next = siblings[index2 + 1];
|
||
const nextNext = siblings[index2 + 2];
|
||
const nextValue = next ? toString2(next) : "";
|
||
if (next && (next.type === "PunctuationNode" || next.type === "SymbolNode") && (!nextNext || nextNext.type !== "WordNode")) {
|
||
node2.value = state.close[quoteIndex];
|
||
} else if (next && (next.type === "PunctuationNode" || next.type === "SymbolNode") && (nextValue === '"' || nextValue === "'") && nextNext && nextNext.type === "WordNode") {
|
||
node2.value = state.open[quoteIndex];
|
||
next.value = state.open[nextValue === '"' ? 0 : 1];
|
||
} else if (next && /^\d\ds$/.test(nextValue)) {
|
||
node2.value = state.close[quoteIndex];
|
||
} else if (previous2 && (previous2.type === "WhiteSpaceNode" || previous2.type === "PunctuationNode" || previous2.type === "SymbolNode") && next && next.type === "WordNode") {
|
||
node2.value = state.open[quoteIndex];
|
||
} else if (previous2 && previous2.type !== "WhiteSpaceNode" && previous2.type !== "SymbolNode" && previous2.type !== "PunctuationNode") {
|
||
node2.value = state.close[quoteIndex];
|
||
} else if (!next || next.type === "WhiteSpaceNode" || value === "'" && nextValue === "s") {
|
||
node2.value = state.close[quoteIndex];
|
||
} else {
|
||
node2.value = state.open[quoteIndex];
|
||
}
|
||
}
|
||
|
||
// node_modules/remark-smartypants/dist/plugin.js
|
||
var VISITED_NODES = /* @__PURE__ */ new Set(["text", "inlineCode", "paragraph"]);
|
||
var IGNORED_HTML_ELEMENTS = /* @__PURE__ */ new Set(["style", "script"]);
|
||
var check = (node2, index2, parent) => {
|
||
return parent && (parent.type !== "mdxJsxTextElement" || "name" in parent && typeof parent.name === "string" && !IGNORED_HTML_ELEMENTS.has(parent.name)) && VISITED_NODES.has(node2.type) && (isLiteral(node2) || isParagraph(node2));
|
||
};
|
||
var remarkSmartypants = (options) => {
|
||
const processor = retext().use(retextSmartypants, {
|
||
...options,
|
||
// Do not replace ellipses, dashes, backticks because they change string
|
||
// length, and we couldn't guarantee right splice of text in second visit of
|
||
// tree
|
||
ellipses: false,
|
||
dashes: false,
|
||
backticks: false
|
||
});
|
||
const processor2 = retext().use(retextSmartypants, {
|
||
...options,
|
||
// Do not replace quotes because they are already replaced in the first
|
||
// processor
|
||
quotes: false
|
||
});
|
||
return (tree) => {
|
||
let allText = "";
|
||
let startIndex = 0;
|
||
const nodes = [];
|
||
visit(tree, check, (node2) => {
|
||
if (isLiteral(node2)) {
|
||
allText += node2.type === "text" ? node2.value : "A".repeat(node2.value.length);
|
||
} else if (isParagraph(node2)) {
|
||
allText += " ";
|
||
}
|
||
nodes.push(node2);
|
||
});
|
||
allText = processor.processSync(allText).toString();
|
||
for (const node2 of nodes) {
|
||
if (isLiteral(node2)) {
|
||
const endIndex = startIndex + node2.value.length;
|
||
if (node2.type === "text") {
|
||
const processedText = allText.slice(startIndex, endIndex);
|
||
node2.value = processor2.processSync(processedText).toString();
|
||
}
|
||
startIndex = endIndex;
|
||
} else if (isParagraph(node2)) {
|
||
startIndex += 1;
|
||
}
|
||
}
|
||
};
|
||
};
|
||
function isLiteral(node2) {
|
||
return "value" in node2 && typeof node2.value === "string";
|
||
}
|
||
function isParagraph(node2) {
|
||
return node2.type === "paragraph";
|
||
}
|
||
var plugin_default = remarkSmartypants;
|
||
|
||
// node_modules/github-slugger/regex.js
|
||
var regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g;
|
||
|
||
// node_modules/github-slugger/index.js
|
||
var own3 = Object.hasOwnProperty;
|
||
var BananaSlug = class {
|
||
/**
|
||
* Create a new slug class.
|
||
*/
|
||
constructor() {
|
||
this.occurrences;
|
||
this.reset();
|
||
}
|
||
/**
|
||
* Generate a unique slug.
|
||
*
|
||
* Tracks previously generated slugs: repeated calls with the same value
|
||
* will result in different slugs.
|
||
* Use the `slug` function to get same slugs.
|
||
*
|
||
* @param {string} value
|
||
* String of text to slugify
|
||
* @param {boolean} [maintainCase=false]
|
||
* Keep the current case, otherwise make all lowercase
|
||
* @return {string}
|
||
* A unique slug string
|
||
*/
|
||
slug(value, maintainCase) {
|
||
const self2 = this;
|
||
let result = slug(value, maintainCase === true);
|
||
const originalSlug = result;
|
||
while (own3.call(self2.occurrences, result)) {
|
||
self2.occurrences[originalSlug]++;
|
||
result = originalSlug + "-" + self2.occurrences[originalSlug];
|
||
}
|
||
self2.occurrences[result] = 0;
|
||
return result;
|
||
}
|
||
/**
|
||
* Reset - Forget all previous slugs
|
||
*
|
||
* @return void
|
||
*/
|
||
reset() {
|
||
this.occurrences = /* @__PURE__ */ Object.create(null);
|
||
}
|
||
};
|
||
function slug(value, maintainCase) {
|
||
if (typeof value !== "string") return "";
|
||
if (!maintainCase) value = value.toLowerCase();
|
||
return value.replace(regex, "").replace(/ /g, "-");
|
||
}
|
||
|
||
// node_modules/hast-util-heading-rank/lib/index.js
|
||
function headingRank(node2) {
|
||
const name = node2.type === "element" ? node2.tagName.toLowerCase() : "";
|
||
const code3 = name.length === 2 && name.charCodeAt(0) === 104 ? name.charCodeAt(1) : 0;
|
||
return code3 > 48 && code3 < 55 ? code3 - 48 : void 0;
|
||
}
|
||
|
||
// node_modules/hast-util-to-string/lib/index.js
|
||
function toString3(node2) {
|
||
if ("children" in node2) {
|
||
return all2(node2);
|
||
}
|
||
return "value" in node2 ? node2.value : "";
|
||
}
|
||
function one2(node2) {
|
||
if (node2.type === "text") {
|
||
return node2.value;
|
||
}
|
||
return "children" in node2 ? all2(node2) : "";
|
||
}
|
||
function all2(node2) {
|
||
let index2 = -1;
|
||
const result = [];
|
||
while (++index2 < node2.children.length) {
|
||
result[index2] = one2(node2.children[index2]);
|
||
}
|
||
return result.join("");
|
||
}
|
||
|
||
// node_modules/rehype-slug/lib/index.js
|
||
var emptyOptions4 = {};
|
||
var slugs = new BananaSlug();
|
||
function rehypeSlug(options) {
|
||
const settings = options || emptyOptions4;
|
||
const prefix = settings.prefix || "";
|
||
return function(tree) {
|
||
slugs.reset();
|
||
visit(tree, "element", function(node2) {
|
||
if (headingRank(node2) && !node2.properties.id) {
|
||
node2.properties.id = prefix + slugs.slug(toString3(node2));
|
||
}
|
||
});
|
||
};
|
||
}
|
||
|
||
// node_modules/@ungap/structured-clone/esm/types.js
|
||
var VOID = -1;
|
||
var PRIMITIVE = 0;
|
||
var ARRAY = 1;
|
||
var OBJECT = 2;
|
||
var DATE = 3;
|
||
var REGEXP = 4;
|
||
var MAP = 5;
|
||
var SET = 6;
|
||
var ERROR = 7;
|
||
var BIGINT = 8;
|
||
|
||
// node_modules/@ungap/structured-clone/esm/deserialize.js
|
||
var env = typeof self === "object" ? self : globalThis;
|
||
var deserializer = ($, _) => {
|
||
const as = (out, index2) => {
|
||
$.set(index2, out);
|
||
return out;
|
||
};
|
||
const unpair = (index2) => {
|
||
if ($.has(index2))
|
||
return $.get(index2);
|
||
const [type, value] = _[index2];
|
||
switch (type) {
|
||
case PRIMITIVE:
|
||
case VOID:
|
||
return as(value, index2);
|
||
case ARRAY: {
|
||
const arr = as([], index2);
|
||
for (const index3 of value)
|
||
arr.push(unpair(index3));
|
||
return arr;
|
||
}
|
||
case OBJECT: {
|
||
const object = as({}, index2);
|
||
for (const [key, index3] of value)
|
||
object[unpair(key)] = unpair(index3);
|
||
return object;
|
||
}
|
||
case DATE:
|
||
return as(new Date(value), index2);
|
||
case REGEXP: {
|
||
const { source, flags } = value;
|
||
return as(new RegExp(source, flags), index2);
|
||
}
|
||
case MAP: {
|
||
const map3 = as(/* @__PURE__ */ new Map(), index2);
|
||
for (const [key, index3] of value)
|
||
map3.set(unpair(key), unpair(index3));
|
||
return map3;
|
||
}
|
||
case SET: {
|
||
const set = as(/* @__PURE__ */ new Set(), index2);
|
||
for (const index3 of value)
|
||
set.add(unpair(index3));
|
||
return set;
|
||
}
|
||
case ERROR: {
|
||
const { name, message } = value;
|
||
return as(new env[name](message), index2);
|
||
}
|
||
case BIGINT:
|
||
return as(BigInt(value), index2);
|
||
case "BigInt":
|
||
return as(Object(BigInt(value)), index2);
|
||
case "ArrayBuffer":
|
||
return as(new Uint8Array(value).buffer, value);
|
||
case "DataView": {
|
||
const { buffer } = new Uint8Array(value);
|
||
return as(new DataView(buffer), value);
|
||
}
|
||
}
|
||
return as(new env[type](value), index2);
|
||
};
|
||
return unpair;
|
||
};
|
||
var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
|
||
|
||
// node_modules/@ungap/structured-clone/esm/serialize.js
|
||
var EMPTY = "";
|
||
var { toString: toString4 } = {};
|
||
var { keys } = Object;
|
||
var typeOf = (value) => {
|
||
const type = typeof value;
|
||
if (type !== "object" || !value)
|
||
return [PRIMITIVE, type];
|
||
const asString = toString4.call(value).slice(8, -1);
|
||
switch (asString) {
|
||
case "Array":
|
||
return [ARRAY, EMPTY];
|
||
case "Object":
|
||
return [OBJECT, EMPTY];
|
||
case "Date":
|
||
return [DATE, EMPTY];
|
||
case "RegExp":
|
||
return [REGEXP, EMPTY];
|
||
case "Map":
|
||
return [MAP, EMPTY];
|
||
case "Set":
|
||
return [SET, EMPTY];
|
||
case "DataView":
|
||
return [ARRAY, asString];
|
||
}
|
||
if (asString.includes("Array"))
|
||
return [ARRAY, asString];
|
||
if (asString.includes("Error"))
|
||
return [ERROR, asString];
|
||
return [OBJECT, asString];
|
||
};
|
||
var shouldSkip = ([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol");
|
||
var serializer = (strict, json, $, _) => {
|
||
const as = (out, value) => {
|
||
const index2 = _.push(out) - 1;
|
||
$.set(value, index2);
|
||
return index2;
|
||
};
|
||
const pair = (value) => {
|
||
if ($.has(value))
|
||
return $.get(value);
|
||
let [TYPE, type] = typeOf(value);
|
||
switch (TYPE) {
|
||
case PRIMITIVE: {
|
||
let entry = value;
|
||
switch (type) {
|
||
case "bigint":
|
||
TYPE = BIGINT;
|
||
entry = value.toString();
|
||
break;
|
||
case "function":
|
||
case "symbol":
|
||
if (strict)
|
||
throw new TypeError("unable to serialize " + type);
|
||
entry = null;
|
||
break;
|
||
case "undefined":
|
||
return as([VOID], value);
|
||
}
|
||
return as([TYPE, entry], value);
|
||
}
|
||
case ARRAY: {
|
||
if (type) {
|
||
let spread = value;
|
||
if (type === "DataView") {
|
||
spread = new Uint8Array(value.buffer);
|
||
} else if (type === "ArrayBuffer") {
|
||
spread = new Uint8Array(value);
|
||
}
|
||
return as([type, [...spread]], value);
|
||
}
|
||
const arr = [];
|
||
const index2 = as([TYPE, arr], value);
|
||
for (const entry of value)
|
||
arr.push(pair(entry));
|
||
return index2;
|
||
}
|
||
case OBJECT: {
|
||
if (type) {
|
||
switch (type) {
|
||
case "BigInt":
|
||
return as([type, value.toString()], value);
|
||
case "Boolean":
|
||
case "Number":
|
||
case "String":
|
||
return as([type, value.valueOf()], value);
|
||
}
|
||
}
|
||
if (json && "toJSON" in value)
|
||
return pair(value.toJSON());
|
||
const entries = [];
|
||
const index2 = as([TYPE, entries], value);
|
||
for (const key of keys(value)) {
|
||
if (strict || !shouldSkip(typeOf(value[key])))
|
||
entries.push([pair(key), pair(value[key])]);
|
||
}
|
||
return index2;
|
||
}
|
||
case DATE:
|
||
return as([TYPE, value.toISOString()], value);
|
||
case REGEXP: {
|
||
const { source, flags } = value;
|
||
return as([TYPE, { source, flags }], value);
|
||
}
|
||
case MAP: {
|
||
const entries = [];
|
||
const index2 = as([TYPE, entries], value);
|
||
for (const [key, entry] of value) {
|
||
if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
|
||
entries.push([pair(key), pair(entry)]);
|
||
}
|
||
return index2;
|
||
}
|
||
case SET: {
|
||
const entries = [];
|
||
const index2 = as([TYPE, entries], value);
|
||
for (const entry of value) {
|
||
if (strict || !shouldSkip(typeOf(entry)))
|
||
entries.push(pair(entry));
|
||
}
|
||
return index2;
|
||
}
|
||
}
|
||
const { message } = value;
|
||
return as([TYPE, { name: type, message }], value);
|
||
};
|
||
return pair;
|
||
};
|
||
var serialize2 = (value, { json, lossy } = {}) => {
|
||
const _ = [];
|
||
return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
|
||
};
|
||
|
||
// node_modules/@ungap/structured-clone/esm/index.js
|
||
var esm_default = typeof structuredClone === "function" ? (
|
||
/* c8 ignore start */
|
||
(any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize2(any, options)) : structuredClone(any)
|
||
) : (any, options) => deserialize(serialize2(any, options));
|
||
|
||
// node_modules/hast-util-is-element/lib/index.js
|
||
var convertElement = (
|
||
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
||
/**
|
||
* @type {(
|
||
* (<Condition extends TestFunction>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) &
|
||
* (<Condition extends string>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &
|
||
* ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &
|
||
* ((test?: Test) => Check)
|
||
* )}
|
||
*/
|
||
/**
|
||
* @param {Test | null | undefined} [test]
|
||
* @returns {Check}
|
||
*/
|
||
(function(test) {
|
||
if (test === null || test === void 0) {
|
||
return element;
|
||
}
|
||
if (typeof test === "string") {
|
||
return tagNameFactory(test);
|
||
}
|
||
if (typeof test === "object") {
|
||
return anyFactory2(test);
|
||
}
|
||
if (typeof test === "function") {
|
||
return castFactory2(test);
|
||
}
|
||
throw new Error("Expected function, string, or array as `test`");
|
||
})
|
||
);
|
||
function anyFactory2(tests) {
|
||
const checks = [];
|
||
let index2 = -1;
|
||
while (++index2 < tests.length) {
|
||
checks[index2] = convertElement(tests[index2]);
|
||
}
|
||
return castFactory2(any);
|
||
function any(...parameters) {
|
||
let index3 = -1;
|
||
while (++index3 < checks.length) {
|
||
if (checks[index3].apply(this, parameters)) return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
function tagNameFactory(check2) {
|
||
return castFactory2(tagName);
|
||
function tagName(element2) {
|
||
return element2.tagName === check2;
|
||
}
|
||
}
|
||
function castFactory2(testFunction) {
|
||
return check2;
|
||
function check2(value, index2, parent) {
|
||
return Boolean(
|
||
looksLikeAnElement(value) && testFunction.call(
|
||
this,
|
||
value,
|
||
typeof index2 === "number" ? index2 : void 0,
|
||
parent || void 0
|
||
)
|
||
);
|
||
}
|
||
}
|
||
function element(element2) {
|
||
return Boolean(
|
||
element2 && typeof element2 === "object" && "type" in element2 && element2.type === "element" && "tagName" in element2 && typeof element2.tagName === "string"
|
||
);
|
||
}
|
||
function looksLikeAnElement(value) {
|
||
return value !== null && typeof value === "object" && "type" in value && "tagName" in value;
|
||
}
|
||
|
||
// node_modules/rehype-autolink-headings/lib/index.js
|
||
var contentDefaults = {
|
||
type: "element",
|
||
tagName: "span",
|
||
properties: { className: ["icon", "icon-link"] },
|
||
children: []
|
||
};
|
||
var emptyOptions5 = {};
|
||
function rehypeAutolinkHeadings(options) {
|
||
const settings = options || emptyOptions5;
|
||
let properties = settings.properties;
|
||
const headingOroperties = settings.headingProperties;
|
||
const behavior = settings.behavior || "prepend";
|
||
const content = settings.content;
|
||
const group = settings.group;
|
||
const is2 = convertElement(settings.test);
|
||
let method;
|
||
if (behavior === "after" || behavior === "before") {
|
||
method = around;
|
||
} else if (behavior === "wrap") {
|
||
method = wrap2;
|
||
} else {
|
||
method = inject;
|
||
if (!properties) {
|
||
properties = { ariaHidden: "true", tabIndex: -1 };
|
||
}
|
||
}
|
||
return function(tree) {
|
||
visit(tree, "element", function(node2, index2, parent) {
|
||
if (headingRank(node2) && node2.properties.id && is2(node2, index2, parent)) {
|
||
Object.assign(node2.properties, toProperties(headingOroperties, node2));
|
||
return method(node2, index2, parent);
|
||
}
|
||
});
|
||
};
|
||
function inject(node2) {
|
||
const children = toChildren(content || contentDefaults, node2);
|
||
node2.children[behavior === "prepend" ? "unshift" : "push"](
|
||
create(node2, toProperties(properties, node2), children)
|
||
);
|
||
return [SKIP];
|
||
}
|
||
function around(node2, index2, parent) {
|
||
if (typeof index2 !== "number" || !parent) return;
|
||
const children = toChildren(content || contentDefaults, node2);
|
||
const link2 = create(node2, toProperties(properties, node2), children);
|
||
let nodes = behavior === "before" ? [link2, node2] : [node2, link2];
|
||
if (group) {
|
||
const grouping = toNode(group, node2);
|
||
if (grouping && !Array.isArray(grouping) && grouping.type === "element") {
|
||
grouping.children = nodes;
|
||
nodes = [grouping];
|
||
}
|
||
}
|
||
parent.children.splice(index2, 1, ...nodes);
|
||
return [SKIP, index2 + nodes.length];
|
||
}
|
||
function wrap2(node2) {
|
||
let before = node2.children;
|
||
let after = [];
|
||
if (typeof content === "function") {
|
||
before = [];
|
||
after = content(node2);
|
||
} else if (content) {
|
||
after = clone(content);
|
||
}
|
||
node2.children = [
|
||
create(
|
||
node2,
|
||
toProperties(properties, node2),
|
||
Array.isArray(after) ? [...before, ...after] : [...before, after]
|
||
)
|
||
];
|
||
return [SKIP];
|
||
}
|
||
}
|
||
function clone(thing) {
|
||
return (
|
||
/** @type {Cloneable<T>} */
|
||
esm_default(thing)
|
||
);
|
||
}
|
||
function create(node2, properties, children) {
|
||
return {
|
||
type: "element",
|
||
tagName: "a",
|
||
properties: { ...properties, href: "#" + node2.properties.id },
|
||
children
|
||
};
|
||
}
|
||
function toChildren(value, node2) {
|
||
const result = toNode(value, node2);
|
||
return Array.isArray(result) ? result : [result];
|
||
}
|
||
function toNode(value, node2) {
|
||
if (typeof value === "function") return value(node2);
|
||
return clone(value);
|
||
}
|
||
function toProperties(value, node2) {
|
||
if (typeof value === "function") return value(node2);
|
||
return value ? clone(value) : {};
|
||
}
|
||
|
||
// src/transformer.ts
|
||
var defaultOptions = {
|
||
enableSmartyPants: true,
|
||
linkHeadings: true
|
||
};
|
||
var GitHubFlavoredMarkdown = (userOpts) => {
|
||
const opts = { ...defaultOptions, ...userOpts };
|
||
return {
|
||
name: "GitHubFlavoredMarkdown",
|
||
markdownPlugins() {
|
||
return opts.enableSmartyPants ? [remarkGfm, plugin_default] : [remarkGfm];
|
||
},
|
||
htmlPlugins() {
|
||
if (opts.linkHeadings) {
|
||
return [
|
||
rehypeSlug,
|
||
[
|
||
rehypeAutolinkHeadings,
|
||
{
|
||
behavior: "append",
|
||
properties: {
|
||
role: "anchor",
|
||
ariaHidden: true,
|
||
tabIndex: -1,
|
||
"data-no-popover": true
|
||
},
|
||
content: {
|
||
type: "element",
|
||
tagName: "svg",
|
||
properties: {
|
||
width: 18,
|
||
height: 18,
|
||
viewBox: "0 0 24 24",
|
||
fill: "none",
|
||
stroke: "currentColor",
|
||
"stroke-width": "2",
|
||
"stroke-linecap": "round",
|
||
"stroke-linejoin": "round"
|
||
},
|
||
children: [
|
||
{
|
||
type: "element",
|
||
tagName: "path",
|
||
properties: {
|
||
d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"
|
||
},
|
||
children: []
|
||
},
|
||
{
|
||
type: "element",
|
||
tagName: "path",
|
||
properties: {
|
||
d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
|
||
},
|
||
children: []
|
||
}
|
||
]
|
||
}
|
||
}
|
||
]
|
||
];
|
||
} else {
|
||
return [];
|
||
}
|
||
}
|
||
};
|
||
};
|
||
|
||
export { GitHubFlavoredMarkdown };
|
||
//# sourceMappingURL=index.js.map
|
||
//# sourceMappingURL=index.js.map
|