mongodb-chatbot-ui
Version:
UI React components for the MongoDB Chatbot Framework
1,543 lines • 492 kB
JavaScript
import { g as an, c as Wn, j as zn } from "./jsx-runtime.js";
import { P as oe, c as Ju } from "./Transition.js";
import { G as Is, c as ed, k as nd, s as td, _ as Hr, a as rd, E as id, j as ad, d as od, Q as Jn, e as rr, f as ld } from "./index4.js";
import * as ki from "react";
import C, { useState as We, useRef as _n, useEffect as un, isValidElement as sd, useCallback as Fe, createContext as Ms, useContext as jr, forwardRef as Rs, useMemo as tn } from "react";
import { u as cd } from "./index5.js";
import { r as ut, aj as ud, m as k, i as Gt, F as D, L as dt, h as Ln, b as le, M as qn, R as Rt, d as Ke, ak as Sr, x as dd, S as Ls, j as ft, o as ie, ac as Vn, e as ge, G as fd, H as pd, l as Pn, W as Et, p as Ue, w as Ci, B as Ai, J as gd, U as fn, E as hd, al as md, am as bd, an as Nr, C as kn, P as yd, A as Lt, t as Dt, ao as Ed, ap as Ds, aq as _d, ar as Ps, as as Bs, at as vd, au as Fs, av as $s, aw as xd, ax as zs, ay as Us, az as wd, aA as Sd, aB as Kr, n as Ti, aC as Nd, aD as Od } from "./index2.js";
import { P as kd } from "./index17.js";
import { f as Cd } from "./ChevronDown.js";
import { J as Ad, w as Td } from "./index9.js";
import { flushSync as Id } from "react-dom";
import { s as Pt } from "./index10.js";
import { k as et, b as Hs, a as js, z as Ks, L as qt, H as Sn } from "./index11.js";
import { s as Md, K as Rd, P as Ii } from "./index18.js";
import { R as Ld, r as Gs } from "./index15.js";
import { e as Dd, K as Pd } from "./index12.js";
import { x as Bd, I as qs, k as Mi } from "./index7.js";
import { i as Fd } from "./index16.js";
const Ri = ["http", "https", "mailto", "tel"];
function $d(e) {
const n = (e || "").trim(), t = n.charAt(0);
if (t === "#" || t === "/")
return n;
const r = n.indexOf(":");
if (r === -1)
return n;
let i = -1;
for (; ++i < Ri.length; ) {
const a = Ri[i];
if (r === a.length && n.slice(0, a.length).toLowerCase() === a)
return n;
}
return i = n.indexOf("?"), i !== -1 && r > i || (i = n.indexOf("#"), i !== -1 && r > i) ? n : "javascript:void(0)";
}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
var zd = function(n) {
return n != null && n.constructor != null && typeof n.constructor.isBuffer == "function" && n.constructor.isBuffer(n);
};
const Ws = /* @__PURE__ */ an(zd);
function rt(e) {
return !e || typeof e != "object" ? "" : "position" in e || "type" in e ? Li(e.position) : "start" in e || "end" in e ? Li(e) : "line" in e || "column" in e ? Or(e) : "";
}
function Or(e) {
return Di(e && e.line) + ":" + Di(e && e.column);
}
function Li(e) {
return Or(e && e.start) + "-" + Or(e && e.end);
}
function Di(e) {
return e && typeof e == "number" ? e : 1;
}
class sn extends Error {
/**
* Create a message for `reason` at `place` from `origin`.
*
* When an error is passed in as `reason`, the `stack` is copied.
*
* @param {string | Error | VFileMessage} reason
* Reason for message, uses the stack and message of the error if given.
*
* > 👉 **Note**: you should use markdown.
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
* Place in file where the message occurred.
* @param {string | null | undefined} [origin]
* Place in code where the message originates (example:
* `'my-package:my-rule'` or `'my-rule'`).
* @returns
* Instance of `VFileMessage`.
*/
// To do: next major: expose `undefined` everywhere instead of `null`.
constructor(n, t, r) {
const i = [null, null];
let a = {
// @ts-expect-error: we always follows the structure of `position`.
start: { line: null, column: null },
// @ts-expect-error: "
end: { line: null, column: null }
};
if (super(), typeof t == "string" && (r = t, t = void 0), typeof r == "string") {
const o = r.indexOf(":");
o === -1 ? i[1] = r : (i[0] = r.slice(0, o), i[1] = r.slice(o + 1));
}
t && ("type" in t || "position" in t ? t.position && (a = t.position) : "start" in t || "end" in t ? a = t : ("line" in t || "column" in t) && (a.start = t)), this.name = rt(t) || "1:1", this.message = typeof n == "object" ? n.message : n, this.stack = "", typeof n == "object" && n.stack && (this.stack = n.stack), this.reason = this.message, this.fatal, this.line = a.start.line, this.column = a.start.column, this.position = a, this.source = i[0], this.ruleId = i[1], this.file, this.actual, this.expected, this.url, this.note;
}
}
sn.prototype.file = "";
sn.prototype.name = "";
sn.prototype.reason = "";
sn.prototype.message = "";
sn.prototype.stack = "";
sn.prototype.fatal = null;
sn.prototype.column = null;
sn.prototype.line = null;
sn.prototype.source = null;
sn.prototype.ruleId = null;
sn.prototype.position = null;
const dn = { basename: Ud, dirname: Hd, extname: jd, join: Kd, sep: "/" };
function Ud(e, n) {
if (n !== void 0 && typeof n != "string")
throw new TypeError('"ext" argument must be a string');
pt(e);
let t = 0, r = -1, i = e.length, a;
if (n === void 0 || n.length === 0 || n.length > e.length) {
for (; i--; )
if (e.charCodeAt(i) === 47) {
if (a) {
t = i + 1;
break;
}
} else
r < 0 && (a = !0, r = i + 1);
return r < 0 ? "" : e.slice(t, r);
}
if (n === e)
return "";
let o = -1, l = n.length - 1;
for (; i--; )
if (e.charCodeAt(i) === 47) {
if (a) {
t = i + 1;
break;
}
} else
o < 0 && (a = !0, o = i + 1), l > -1 && (e.charCodeAt(i) === n.charCodeAt(l--) ? l < 0 && (r = i) : (l = -1, r = o));
return t === r ? r = o : r < 0 && (r = e.length), e.slice(t, r);
}
function Hd(e) {
if (pt(e), e.length === 0)
return ".";
let n = -1, t = e.length, r;
for (; --t; )
if (e.charCodeAt(t) === 47) {
if (r) {
n = t;
break;
}
} else
r || (r = !0);
return n < 0 ? e.charCodeAt(0) === 47 ? "/" : "." : n === 1 && e.charCodeAt(0) === 47 ? "//" : e.slice(0, n);
}
function jd(e) {
pt(e);
let n = e.length, t = -1, r = 0, i = -1, a = 0, o;
for (; n--; ) {
const l = e.charCodeAt(n);
if (l === 47) {
if (o) {
r = n + 1;
break;
}
continue;
}
t < 0 && (o = !0, t = n + 1), l === 46 ? i < 0 ? i = n : a !== 1 && (a = 1) : i > -1 && (a = -1);
}
return i < 0 || t < 0 || // We saw a non-dot character immediately before the dot.
a === 0 || // The (right-most) trimmed path component is exactly `..`.
a === 1 && i === t - 1 && i === r + 1 ? "" : e.slice(i, t);
}
function Kd(...e) {
let n = -1, t;
for (; ++n < e.length; )
pt(e[n]), e[n] && (t = t === void 0 ? e[n] : t + "/" + e[n]);
return t === void 0 ? "." : Gd(t);
}
function Gd(e) {
pt(e);
const n = e.charCodeAt(0) === 47;
let t = qd(e, !n);
return t.length === 0 && !n && (t = "."), t.length > 0 && e.charCodeAt(e.length - 1) === 47 && (t += "/"), n ? "/" + t : t;
}
function qd(e, n) {
let t = "", r = 0, i = -1, a = 0, o = -1, l, s;
for (; ++o <= e.length; ) {
if (o < e.length)
l = e.charCodeAt(o);
else {
if (l === 47)
break;
l = 47;
}
if (l === 47) {
if (!(i === o - 1 || a === 1))
if (i !== o - 1 && a === 2) {
if (t.length < 2 || r !== 2 || t.charCodeAt(t.length - 1) !== 46 || t.charCodeAt(t.length - 2) !== 46) {
if (t.length > 2) {
if (s = t.lastIndexOf("/"), s !== t.length - 1) {
s < 0 ? (t = "", r = 0) : (t = t.slice(0, s), r = t.length - 1 - t.lastIndexOf("/")), i = o, a = 0;
continue;
}
} else if (t.length > 0) {
t = "", r = 0, i = o, a = 0;
continue;
}
}
n && (t = t.length > 0 ? t + "/.." : "..", r = 2);
} else
t.length > 0 ? t += "/" + e.slice(i + 1, o) : t = e.slice(i + 1, o), r = o - i - 1;
i = o, a = 0;
} else
l === 46 && a > -1 ? a++ : a = -1;
}
return t;
}
function pt(e) {
if (typeof e != "string")
throw new TypeError(
"Path must be a string. Received " + JSON.stringify(e)
);
}
const Wd = { cwd: Vd };
function Vd() {
return "/";
}
function kr(e) {
return e !== null && typeof e == "object" && // @ts-expect-error: indexable.
e.href && // @ts-expect-error: indexable.
e.origin;
}
function Yd(e) {
if (typeof e == "string")
e = new URL(e);
else if (!kr(e)) {
const n = new TypeError(
'The "path" argument must be of type string or an instance of URL. Received `' + e + "`"
);
throw n.code = "ERR_INVALID_ARG_TYPE", n;
}
if (e.protocol !== "file:") {
const n = new TypeError("The URL must be of scheme file");
throw n.code = "ERR_INVALID_URL_SCHEME", n;
}
return Zd(e);
}
function Zd(e) {
if (e.hostname !== "") {
const r = new TypeError(
'File URL host must be "localhost" or empty on darwin'
);
throw r.code = "ERR_INVALID_FILE_URL_HOST", r;
}
const n = e.pathname;
let t = -1;
for (; ++t < n.length; )
if (n.charCodeAt(t) === 37 && n.charCodeAt(t + 1) === 50) {
const r = n.charCodeAt(t + 2);
if (r === 70 || r === 102) {
const i = new TypeError(
"File URL path must not include encoded / characters"
);
throw i.code = "ERR_INVALID_FILE_URL_PATH", i;
}
}
return decodeURIComponent(n);
}
const ir = ["history", "path", "basename", "stem", "extname", "dirname"];
class Vs {
/**
* Create a new virtual file.
*
* `options` is treated as:
*
* * `string` or `Buffer` — `{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(n) {
let t;
n ? typeof n == "string" || Xd(n) ? t = { value: n } : kr(n) ? t = { path: n } : t = n : t = {}, this.data = {}, this.messages = [], this.history = [], this.cwd = Wd.cwd(), this.value, this.stored, this.result, this.map;
let r = -1;
for (; ++r < ir.length; ) {
const a = ir[r];
a in t && t[a] !== void 0 && t[a] !== null && (this[a] = a === "history" ? [...t[a]] : t[a]);
}
let i;
for (i in t)
ir.includes(i) || (this[i] = t[i]);
}
/**
* Get the full path (example: `'~/index.min.js'`).
*
* @returns {string}
*/
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 {string | URL} path
*/
set path(n) {
kr(n) && (n = Yd(n)), or(n, "path"), this.path !== n && this.history.push(n);
}
/**
* Get the parent path (example: `'~'`).
*/
get dirname() {
return typeof this.path == "string" ? dn.dirname(this.path) : void 0;
}
/**
* Set the parent path (example: `'~'`).
*
* Cannot be set if there’s no `path` yet.
*/
set dirname(n) {
Pi(this.basename, "dirname"), this.path = dn.join(n || "", this.basename);
}
/**
* Get the basename (including extname) (example: `'index.min.js'`).
*/
get basename() {
return typeof this.path == "string" ? dn.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).
*/
set basename(n) {
or(n, "basename"), ar(n, "basename"), this.path = dn.join(this.dirname || "", n);
}
/**
* Get the extname (including dot) (example: `'.js'`).
*/
get extname() {
return typeof this.path == "string" ? dn.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.
*/
set extname(n) {
if (ar(n, "extname"), Pi(this.dirname, "extname"), n) {
if (n.charCodeAt(0) !== 46)
throw new Error("`extname` must start with `.`");
if (n.includes(".", 1))
throw new Error("`extname` cannot contain multiple dots");
}
this.path = dn.join(this.dirname, this.stem + (n || ""));
}
/**
* Get the stem (basename w/o extname) (example: `'index.min'`).
*/
get stem() {
return typeof this.path == "string" ? dn.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).
*/
set stem(n) {
or(n, "stem"), ar(n, "stem"), this.path = dn.join(this.dirname || "", n + (this.extname || ""));
}
/**
* Serialize the file.
*
* @param {BufferEncoding | null | undefined} [encoding='utf8']
* Character encoding to understand `value` as when it’s a `Buffer`
* (default: `'utf8'`).
* @returns {string}
* Serialized file.
*/
toString(n) {
return (this.value || "").toString(n || void 0);
}
/**
* Create a warning message associated with the file.
*
* Its `fatal` is set to `false` and `file` is set to the current file path.
* Its added to `file.messages`.
*
* @param {string | Error | VFileMessage} reason
* Reason for message, uses the stack and message of the error if given.
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
* Place in file where the message occurred.
* @param {string | null | undefined} [origin]
* Place in code where the message originates (example:
* `'my-package:my-rule'` or `'my-rule'`).
* @returns {VFileMessage}
* Message.
*/
message(n, t, r) {
const i = new sn(n, t, r);
return this.path && (i.name = this.path + ":" + i.name, i.file = this.path), i.fatal = !1, this.messages.push(i), i;
}
/**
* Create an info message associated with the file.
*
* Its `fatal` is set to `null` and `file` is set to the current file path.
* Its added to `file.messages`.
*
* @param {string | Error | VFileMessage} reason
* Reason for message, uses the stack and message of the error if given.
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
* Place in file where the message occurred.
* @param {string | null | undefined} [origin]
* Place in code where the message originates (example:
* `'my-package:my-rule'` or `'my-rule'`).
* @returns {VFileMessage}
* Message.
*/
info(n, t, r) {
const i = this.message(n, t, r);
return i.fatal = null, i;
}
/**
* Create a fatal error associated with the file.
*
* Its `fatal` is set to `true` and `file` is set to the current file path.
* Its added to `file.messages`.
*
* > 👉 **Note**: a fatal error means that a file is no longer processable.
*
* @param {string | Error | VFileMessage} reason
* Reason for message, uses the stack and message of the error if given.
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
* Place in file where the message occurred.
* @param {string | null | undefined} [origin]
* Place in code where the message originates (example:
* `'my-package:my-rule'` or `'my-rule'`).
* @returns {never}
* Message.
* @throws {VFileMessage}
* Message.
*/
fail(n, t, r) {
const i = this.message(n, t, r);
throw i.fatal = !0, i;
}
}
function ar(e, n) {
if (e && e.includes(dn.sep))
throw new Error(
"`" + n + "` cannot be a path: did not expect `" + dn.sep + "`"
);
}
function or(e, n) {
if (!e)
throw new Error("`" + n + "` cannot be empty");
}
function Pi(e, n) {
if (!e)
throw new Error("Setting `" + n + "` requires `path` to be set too");
}
function Xd(e) {
return Ws(e);
}
function Bi(e) {
if (e)
throw e;
}
var At = Object.prototype.hasOwnProperty, Ys = Object.prototype.toString, Fi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, zi = function(n) {
return typeof Array.isArray == "function" ? Array.isArray(n) : Ys.call(n) === "[object Array]";
}, Ui = function(n) {
if (!n || Ys.call(n) !== "[object Object]")
return !1;
var t = At.call(n, "constructor"), r = n.constructor && n.constructor.prototype && At.call(n.constructor.prototype, "isPrototypeOf");
if (n.constructor && !t && !r)
return !1;
var i;
for (i in n)
;
return typeof i > "u" || At.call(n, i);
}, Hi = function(n, t) {
Fi && t.name === "__proto__" ? Fi(n, t.name, {
enumerable: !0,
configurable: !0,
value: t.newValue,
writable: !0
}) : n[t.name] = t.newValue;
}, ji = function(n, t) {
if (t === "__proto__")
if (At.call(n, t)) {
if ($i)
return $i(n, t).value;
} else
return;
return n[t];
}, Qd = function e() {
var n, t, r, i, a, o, l = arguments[0], s = 1, c = arguments.length, u = !1;
for (typeof l == "boolean" && (u = l, l = arguments[1] || {}, s = 2), (l == null || typeof l != "object" && typeof l != "function") && (l = {}); s < c; ++s)
if (n = arguments[s], n != null)
for (t in n)
r = ji(l, t), i = ji(n, t), l !== i && (u && i && (Ui(i) || (a = zi(i))) ? (a ? (a = !1, o = r && zi(r) ? r : []) : o = r && Ui(r) ? r : {}, Hi(l, { name: t, newValue: e(u, o, i) })) : typeof i < "u" && Hi(l, { name: t, newValue: i }));
return l;
};
const Ki = /* @__PURE__ */ an(Qd);
function Cr(e) {
if (typeof e != "object" || e === null)
return !1;
const n = Object.getPrototypeOf(e);
return (n === null || n === Object.prototype || Object.getPrototypeOf(n) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
}
function Jd() {
const e = [], n = { run: t, use: r };
return n;
function t(...i) {
let a = -1;
const o = i.pop();
if (typeof o != "function")
throw new TypeError("Expected function as last argument, not " + o);
l(null, ...i);
function l(s, ...c) {
const u = e[++a];
let d = -1;
if (s) {
o(s);
return;
}
for (; ++d < i.length; )
(c[d] === null || c[d] === void 0) && (c[d] = i[d]);
i = c, u ? ef(u, l)(...c) : o(null, ...c);
}
}
function r(i) {
if (typeof i != "function")
throw new TypeError(
"Expected `middelware` to be a function, not " + i
);
return e.push(i), n;
}
}
function ef(e, n) {
let t;
return r;
function r(...o) {
const l = e.length > o.length;
let s;
l && o.push(i);
try {
s = e.apply(this, o);
} catch (c) {
const u = (
/** @type {Error} */
c
);
if (l && t)
throw u;
return i(u);
}
l || (s && s.then && typeof s.then == "function" ? s.then(a, i) : s instanceof Error ? i(s) : a(s));
}
function i(o, ...l) {
t || (t = !0, n(o, ...l));
}
function a(o) {
i(null, o);
}
}
const nf = Xs().freeze(), Zs = {}.hasOwnProperty;
function Xs() {
const e = Jd(), n = [];
let t = {}, r, i = -1;
return a.data = o, a.Parser = void 0, a.Compiler = void 0, a.freeze = l, a.attachers = n, a.use = s, a.parse = c, a.stringify = u, a.run = d, a.runSync = h, a.process = p, a.processSync = v, a;
function a() {
const y = Xs();
let f = -1;
for (; ++f < n.length; )
y.use(...n[f]);
return y.data(Ki(!0, {}, t)), y;
}
function o(y, f) {
return typeof y == "string" ? arguments.length === 2 ? (cr("data", r), t[y] = f, a) : Zs.call(t, y) && t[y] || null : y ? (cr("data", r), t = y, a) : t;
}
function l() {
if (r)
return a;
for (; ++i < n.length; ) {
const [y, ...f] = n[i];
if (f[0] === !1)
continue;
f[0] === !0 && (f[0] = void 0);
const g = y.call(a, ...f);
typeof g == "function" && e.use(g);
}
return r = !0, i = Number.POSITIVE_INFINITY, a;
}
function s(y, ...f) {
let g;
if (cr("use", r), y != null)
if (typeof y == "function")
A(y, ...f);
else if (typeof y == "object")
Array.isArray(y) ? N(y) : _(y);
else
throw new TypeError("Expected usable value, not `" + y + "`");
return g && (t.settings = Object.assign(t.settings || {}, g)), a;
function E(x) {
if (typeof x == "function")
A(x);
else if (typeof x == "object")
if (Array.isArray(x)) {
const [T, ...R] = x;
A(T, ...R);
} else
_(x);
else
throw new TypeError("Expected usable value, not `" + x + "`");
}
function _(x) {
N(x.plugins), x.settings && (g = Object.assign(g || {}, x.settings));
}
function N(x) {
let T = -1;
if (x != null)
if (Array.isArray(x))
for (; ++T < x.length; ) {
const R = x[T];
E(R);
}
else
throw new TypeError("Expected a list of plugins, not `" + x + "`");
}
function A(x, T) {
let R = -1, I;
for (; ++R < n.length; )
if (n[R][0] === x) {
I = n[R];
break;
}
I ? (Cr(I[1]) && Cr(T) && (T = Ki(!0, I[1], T)), I[1] = T) : n.push([...arguments]);
}
}
function c(y) {
a.freeze();
const f = Xn(y), g = a.Parser;
return lr("parse", g), Gi(g, "parse") ? new g(String(f), f).parse() : g(String(f), f);
}
function u(y, f) {
a.freeze();
const g = Xn(f), E = a.Compiler;
return sr("stringify", E), qi(y), Gi(E, "compile") ? new E(y, g).compile() : E(y, g);
}
function d(y, f, g) {
if (qi(y), a.freeze(), !g && typeof f == "function" && (g = f, f = void 0), !g)
return new Promise(E);
E(null, g);
function E(_, N) {
e.run(y, Xn(f), A);
function A(x, T, R) {
T = T || y, x ? N(x) : _ ? _(T) : g(null, T, R);
}
}
}
function h(y, f) {
let g, E;
return a.run(y, f, _), Wi("runSync", "run", E), g;
function _(N, A) {
Bi(N), g = A, E = !0;
}
}
function p(y, f) {
if (a.freeze(), lr("process", a.Parser), sr("process", a.Compiler), !f)
return new Promise(g);
g(null, f);
function g(E, _) {
const N = Xn(y);
a.run(a.parse(N), N, (x, T, R) => {
if (x || !T || !R)
A(x);
else {
const I = a.stringify(T, R);
I == null || (af(I) ? R.value = I : R.result = I), A(x, R);
}
});
function A(x, T) {
x || !T ? _(x) : E ? E(T) : f(null, T);
}
}
}
function v(y) {
let f;
a.freeze(), lr("processSync", a.Parser), sr("processSync", a.Compiler);
const g = Xn(y);
return a.process(g, E), Wi("processSync", "process", f), g;
function E(_) {
f = !0, Bi(_);
}
}
}
function Gi(e, n) {
return typeof e == "function" && // Prototypes do exist.
// type-coverage:ignore-next-line
e.prototype && // A function with keys in its prototype is probably a constructor.
// Classes’ prototype methods are not enumerable, so we check if some value
// exists in the prototype.
// type-coverage:ignore-next-line
(tf(e.prototype) || n in e.prototype);
}
function tf(e) {
let n;
for (n in e)
if (Zs.call(e, n))
return !0;
return !1;
}
function lr(e, n) {
if (typeof n != "function")
throw new TypeError("Cannot `" + e + "` without `Parser`");
}
function sr(e, n) {
if (typeof n != "function")
throw new TypeError("Cannot `" + e + "` without `Compiler`");
}
function cr(e, n) {
if (n)
throw new Error(
"Cannot call `" + e + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
);
}
function qi(e) {
if (!Cr(e) || typeof e.type != "string")
throw new TypeError("Expected node, got `" + e + "`");
}
function Wi(e, n, t) {
if (!t)
throw new Error(
"`" + e + "` finished async. Use `" + n + "` instead"
);
}
function Xn(e) {
return rf(e) ? e : new Vs(e);
}
function rf(e) {
return !!(e && typeof e == "object" && "message" in e && "messages" in e);
}
function af(e) {
return typeof e == "string" || Ws(e);
}
const of = {};
function lf(e, n) {
const t = n || of, r = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
return Qs(e, r, i);
}
function Qs(e, n, t) {
if (sf(e)) {
if ("value" in e)
return e.type === "html" && !t ? "" : e.value;
if (n && "alt" in e && e.alt)
return e.alt;
if ("children" in e)
return Vi(e.children, n, t);
}
return Array.isArray(e) ? Vi(e, n, t) : "";
}
function Vi(e, n, t) {
const r = [];
let i = -1;
for (; ++i < e.length; )
r[i] = Qs(e[i], n, t);
return r.join("");
}
function sf(e) {
return !!(e && typeof e == "object");
}
function mn(e, n, t, r) {
const i = e.length;
let a = 0, o;
if (n < 0 ? n = -n > i ? 0 : i + n : n = n > i ? i : n, t = t > 0 ? t : 0, r.length < 1e4)
o = Array.from(r), o.unshift(n, t), e.splice(...o);
else
for (t && e.splice(n, t); a < r.length; )
o = r.slice(a, a + 1e4), o.unshift(n, 0), e.splice(...o), a += 1e4, n += 1e4;
}
function on(e, n) {
return e.length > 0 ? (mn(e, e.length, 0, n), e) : n;
}
const Yi = {}.hasOwnProperty;
function cf(e) {
const n = {};
let t = -1;
for (; ++t < e.length; )
uf(n, e[t]);
return n;
}
function uf(e, n) {
let t;
for (t in n) {
const i = (Yi.call(e, t) ? e[t] : void 0) || (e[t] = {}), a = n[t];
let o;
if (a)
for (o in a) {
Yi.call(i, o) || (i[o] = []);
const l = a[o];
df(
// @ts-expect-error Looks like a list.
i[o],
Array.isArray(l) ? l : l ? [l] : []
);
}
}
}
function df(e, n) {
let t = -1;
const r = [];
for (; ++t < n.length; )
(n[t].add === "after" ? e : r).push(n[t]);
mn(e, 0, 0, r);
}
const ff = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\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-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\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]/, gn = In(/[A-Za-z]/), rn = In(/[\dA-Za-z]/), pf = In(/[#-'*+\--9=?A-Z^-~]/);
function Ar(e) {
return (
// Special whitespace codes (which have negative values), C0 and Control
// character DEL
e !== null && (e < 32 || e === 127)
);
}
const Tr = In(/\d/), gf = In(/[\dA-Fa-f]/), hf = In(/[!-/:-@[-`{-~]/);
function re(e) {
return e !== null && e < -2;
}
function Je(e) {
return e !== null && (e < 0 || e === 32);
}
function Ee(e) {
return e === -2 || e === -1 || e === 32;
}
const mf = In(ff), bf = In(/\s/);
function In(e) {
return n;
function n(t) {
return t !== null && e.test(String.fromCharCode(t));
}
}
function Ne(e, n, t, r) {
const i = r ? r - 1 : Number.POSITIVE_INFINITY;
let a = 0;
return o;
function o(s) {
return Ee(s) ? (e.enter(t), l(s)) : n(s);
}
function l(s) {
return Ee(s) && a++ < i ? (e.consume(s), l) : (e.exit(t), n(s));
}
}
const yf = {
tokenize: Ef
};
function Ef(e) {
const n = e.attempt(
this.parser.constructs.contentInitial,
r,
i
);
let t;
return n;
function r(l) {
if (l === null) {
e.consume(l);
return;
}
return e.enter("lineEnding"), e.consume(l), e.exit("lineEnding"), Ne(e, n, "linePrefix");
}
function i(l) {
return e.enter("paragraph"), a(l);
}
function a(l) {
const s = e.enter("chunkText", {
contentType: "text",
previous: t
});
return t && (t.next = s), t = s, o(l);
}
function o(l) {
if (l === null) {
e.exit("chunkText"), e.exit("paragraph"), e.consume(l);
return;
}
return re(l) ? (e.consume(l), e.exit("chunkText"), a) : (e.consume(l), o);
}
}
const _f = {
tokenize: vf
}, Zi = {
tokenize: xf
};
function vf(e) {
const n = this, t = [];
let r = 0, i, a, o;
return l;
function l(_) {
if (r < t.length) {
const N = t[r];
return n.containerState = N[1], e.attempt(
N[0].continuation,
s,
c
)(_);
}
return c(_);
}
function s(_) {
if (r++, n.containerState._closeFlow) {
n.containerState._closeFlow = void 0, i && E();
const N = n.events.length;
let A = N, x;
for (; A--; )
if (n.events[A][0] === "exit" && n.events[A][1].type === "chunkFlow") {
x = n.events[A][1].end;
break;
}
g(r);
let T = N;
for (; T < n.events.length; )
n.events[T][1].end = Object.assign({}, x), T++;
return mn(
n.events,
A + 1,
0,
n.events.slice(N)
), n.events.length = T, c(_);
}
return l(_);
}
function c(_) {
if (r === t.length) {
if (!i)
return h(_);
if (i.currentConstruct && i.currentConstruct.concrete)
return v(_);
n.interrupt = !!(i.currentConstruct && !i._gfmTableDynamicInterruptHack);
}
return n.containerState = {}, e.check(
Zi,
u,
d
)(_);
}
function u(_) {
return i && E(), g(r), h(_);
}
function d(_) {
return n.parser.lazy[n.now().line] = r !== t.length, o = n.now().offset, v(_);
}
function h(_) {
return n.containerState = {}, e.attempt(
Zi,
p,
v
)(_);
}
function p(_) {
return r++, t.push([n.currentConstruct, n.containerState]), h(_);
}
function v(_) {
if (_ === null) {
i && E(), g(0), e.consume(_);
return;
}
return i = i || n.parser.flow(n.now()), e.enter("chunkFlow", {
contentType: "flow",
previous: a,
_tokenizer: i
}), y(_);
}
function y(_) {
if (_ === null) {
f(e.exit("chunkFlow"), !0), g(0), e.consume(_);
return;
}
return re(_) ? (e.consume(_), f(e.exit("chunkFlow")), r = 0, n.interrupt = void 0, l) : (e.consume(_), y);
}
function f(_, N) {
const A = n.sliceStream(_);
if (N && A.push(null), _.previous = a, a && (a.next = _), a = _, i.defineSkip(_.start), i.write(A), n.parser.lazy[_.start.line]) {
let x = i.events.length;
for (; x--; )
if (
// The token starts before the line ending…
i.events[x][1].start.offset < o && // …and either is not ended yet…
(!i.events[x][1].end || // …or ends after it.
i.events[x][1].end.offset > o)
)
return;
const T = n.events.length;
let R = T, I, W;
for (; R--; )
if (n.events[R][0] === "exit" && n.events[R][1].type === "chunkFlow") {
if (I) {
W = n.events[R][1].end;
break;
}
I = !0;
}
for (g(r), x = T; x < n.events.length; )
n.events[x][1].end = Object.assign({}, W), x++;
mn(
n.events,
R + 1,
0,
n.events.slice(T)
), n.events.length = x;
}
}
function g(_) {
let N = t.length;
for (; N-- > _; ) {
const A = t[N];
n.containerState = A[1], A[0].exit.call(n, e);
}
t.length = _;
}
function E() {
i.write([null]), a = void 0, i = void 0, n.containerState._closeFlow = void 0;
}
}
function xf(e, n, t) {
return Ne(
e,
e.attempt(this.parser.constructs.document, n, t),
"linePrefix",
this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
);
}
function Xi(e) {
if (e === null || Je(e) || bf(e))
return 1;
if (mf(e))
return 2;
}
function Gr(e, n, t) {
const r = [];
let i = -1;
for (; ++i < e.length; ) {
const a = e[i].resolveAll;
a && !r.includes(a) && (n = a(n, t), r.push(a));
}
return n;
}
const Ir = {
name: "attention",
tokenize: Sf,
resolveAll: wf
};
function wf(e, n) {
let t = -1, r, i, a, o, l, s, c, u;
for (; ++t < e.length; )
if (e[t][0] === "enter" && e[t][1].type === "attentionSequence" && e[t][1]._close) {
for (r = t; r--; )
if (e[r][0] === "exit" && e[r][1].type === "attentionSequence" && e[r][1]._open && // If the markers are the same:
n.sliceSerialize(e[r][1]).charCodeAt(0) === n.sliceSerialize(e[t][1]).charCodeAt(0)) {
if ((e[r][1]._close || e[t][1]._open) && (e[t][1].end.offset - e[t][1].start.offset) % 3 && !((e[r][1].end.offset - e[r][1].start.offset + e[t][1].end.offset - e[t][1].start.offset) % 3))
continue;
s = e[r][1].end.offset - e[r][1].start.offset > 1 && e[t][1].end.offset - e[t][1].start.offset > 1 ? 2 : 1;
const d = Object.assign({}, e[r][1].end), h = Object.assign({}, e[t][1].start);
Qi(d, -s), Qi(h, s), o = {
type: s > 1 ? "strongSequence" : "emphasisSequence",
start: d,
end: Object.assign({}, e[r][1].end)
}, l = {
type: s > 1 ? "strongSequence" : "emphasisSequence",
start: Object.assign({}, e[t][1].start),
end: h
}, a = {
type: s > 1 ? "strongText" : "emphasisText",
start: Object.assign({}, e[r][1].end),
end: Object.assign({}, e[t][1].start)
}, i = {
type: s > 1 ? "strong" : "emphasis",
start: Object.assign({}, o.start),
end: Object.assign({}, l.end)
}, e[r][1].end = Object.assign({}, o.start), e[t][1].start = Object.assign({}, l.end), c = [], e[r][1].end.offset - e[r][1].start.offset && (c = on(c, [
["enter", e[r][1], n],
["exit", e[r][1], n]
])), c = on(c, [
["enter", i, n],
["enter", o, n],
["exit", o, n],
["enter", a, n]
]), c = on(
c,
Gr(
n.parser.constructs.insideSpan.null,
e.slice(r + 1, t),
n
)
), c = on(c, [
["exit", a, n],
["enter", l, n],
["exit", l, n],
["exit", i, n]
]), e[t][1].end.offset - e[t][1].start.offset ? (u = 2, c = on(c, [
["enter", e[t][1], n],
["exit", e[t][1], n]
])) : u = 0, mn(e, r - 1, t - r + 3, c), t = r + c.length - u - 2;
break;
}
}
for (t = -1; ++t < e.length; )
e[t][1].type === "attentionSequence" && (e[t][1].type = "data");
return e;
}
function Sf(e, n) {
const t = this.parser.constructs.attentionMarkers.null, r = this.previous, i = Xi(r);
let a;
return o;
function o(s) {
return a = s, e.enter("attentionSequence"), l(s);
}
function l(s) {
if (s === a)
return e.consume(s), l;
const c = e.exit("attentionSequence"), u = Xi(s), d = !u || u === 2 && i || t.includes(s), h = !i || i === 2 && u || t.includes(r);
return c._open = !!(a === 42 ? d : d && (i || !h)), c._close = !!(a === 42 ? h : h && (u || !d)), n(s);
}
}
function Qi(e, n) {
e.column += n, e.offset += n, e._bufferIndex += n;
}
const Nf = {
name: "autolink",
tokenize: Of
};
function Of(e, n, t) {
let r = 0;
return i;
function i(p) {
return e.enter("autolink"), e.enter("autolinkMarker"), e.consume(p), e.exit("autolinkMarker"), e.enter("autolinkProtocol"), a;
}
function a(p) {
return gn(p) ? (e.consume(p), o) : c(p);
}
function o(p) {
return p === 43 || p === 45 || p === 46 || rn(p) ? (r = 1, l(p)) : c(p);
}
function l(p) {
return p === 58 ? (e.consume(p), r = 0, s) : (p === 43 || p === 45 || p === 46 || rn(p)) && r++ < 32 ? (e.consume(p), l) : (r = 0, c(p));
}
function s(p) {
return p === 62 ? (e.exit("autolinkProtocol"), e.enter("autolinkMarker"), e.consume(p), e.exit("autolinkMarker"), e.exit("autolink"), n) : p === null || p === 32 || p === 60 || Ar(p) ? t(p) : (e.consume(p), s);
}
function c(p) {
return p === 64 ? (e.consume(p), u) : pf(p) ? (e.consume(p), c) : t(p);
}
function u(p) {
return rn(p) ? d(p) : t(p);
}
function d(p) {
return p === 46 ? (e.consume(p), r = 0, u) : p === 62 ? (e.exit("autolinkProtocol").type = "autolinkEmail", e.enter("autolinkMarker"), e.consume(p), e.exit("autolinkMarker"), e.exit("autolink"), n) : h(p);
}
function h(p) {
if ((p === 45 || rn(p)) && r++ < 63) {
const v = p === 45 ? h : d;
return e.consume(p), v;
}
return t(p);
}
}
const Wt = {
tokenize: kf,
partial: !0
};
function kf(e, n, t) {
return r;
function r(a) {
return Ee(a) ? Ne(e, i, "linePrefix")(a) : i(a);
}
function i(a) {
return a === null || re(a) ? n(a) : t(a);
}
}
const Js = {
name: "blockQuote",
tokenize: Cf,
continuation: {
tokenize: Af
},
exit: Tf
};
function Cf(e, n, t) {
const r = this;
return i;
function i(o) {
if (o === 62) {
const l = r.containerState;
return l.open || (e.enter("blockQuote", {
_container: !0
}), l.open = !0), e.enter("blockQuotePrefix"), e.enter("blockQuoteMarker"), e.consume(o), e.exit("blockQuoteMarker"), a;
}
return t(o);
}
function a(o) {
return Ee(o) ? (e.enter("blockQuotePrefixWhitespace"), e.consume(o), e.exit("blockQuotePrefixWhitespace"), e.exit("blockQuotePrefix"), n) : (e.exit("blockQuotePrefix"), n(o));
}
}
function Af(e, n, t) {
const r = this;
return i;
function i(o) {
return Ee(o) ? Ne(
e,
a,
"linePrefix",
r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
)(o) : a(o);
}
function a(o) {
return e.attempt(Js, n, t)(o);
}
}
function Tf(e) {
e.exit("blockQuote");
}
const ec = {
name: "characterEscape",
tokenize: If
};
function If(e, n, t) {
return r;
function r(a) {
return e.enter("characterEscape"), e.enter("escapeMarker"), e.consume(a), e.exit("escapeMarker"), i;
}
function i(a) {
return hf(a) ? (e.enter("characterEscapeValue"), e.consume(a), e.exit("characterEscapeValue"), e.exit("characterEscape"), n) : t(a);
}
}
const Ji = document.createElement("i");
function qr(e) {
const n = "&" + e + ";";
Ji.innerHTML = n;
const t = Ji.textContent;
return t.charCodeAt(t.length - 1) === 59 && e !== "semi" || t === n ? !1 : t;
}
const nc = {
name: "characterReference",
tokenize: Mf
};
function Mf(e, n, t) {
const r = this;
let i = 0, a, o;
return l;
function l(d) {
return e.enter("characterReference"), e.enter("characterReferenceMarker"), e.consume(d), e.exit("characterReferenceMarker"), s;
}
function s(d) {
return d === 35 ? (e.enter("characterReferenceMarkerNumeric"), e.consume(d), e.exit("characterReferenceMarkerNumeric"), c) : (e.enter("characterReferenceValue"), a = 31, o = rn, u(d));
}
function c(d) {
return d === 88 || d === 120 ? (e.enter("characterReferenceMarkerHexadecimal"), e.consume(d), e.exit("characterReferenceMarkerHexadecimal"), e.enter("characterReferenceValue"), a = 6, o = gf, u) : (e.enter("characterReferenceValue"), a = 7, o = Tr, u(d));
}
function u(d) {
if (d === 59 && i) {
const h = e.exit("characterReferenceValue");
return o === rn && !qr(r.sliceSerialize(h)) ? t(d) : (e.enter("characterReferenceMarker"), e.consume(d), e.exit("characterReferenceMarker"), e.exit("characterReference"), n);
}
return o(d) && i++ < a ? (e.consume(d), u) : t(d);
}
}
const ea = {
tokenize: Lf,
partial: !0
}, na = {
name: "codeFenced",
tokenize: Rf,
concrete: !0
};
function Rf(e, n, t) {
const r = this, i = {
tokenize: A,
partial: !0
};
let a = 0, o = 0, l;
return s;
function s(x) {
return c(x);
}
function c(x) {
const T = r.events[r.events.length - 1];
return a = T && T[1].type === "linePrefix" ? T[2].sliceSerialize(T[1], !0).length : 0, l = x, e.enter("codeFenced"), e.enter("codeFencedFence"), e.enter("codeFencedFenceSequence"), u(x);
}
function u(x) {
return x === l ? (o++, e.consume(x), u) : o < 3 ? t(x) : (e.exit("codeFencedFenceSequence"), Ee(x) ? Ne(e, d, "whitespace")(x) : d(x));
}
function d(x) {
return x === null || re(x) ? (e.exit("codeFencedFence"), r.interrupt ? n(x) : e.check(ea, y, N)(x)) : (e.enter("codeFencedFenceInfo"), e.enter("chunkString", {
contentType: "string"
}), h(x));
}
function h(x) {
return x === null || re(x) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), d(x)) : Ee(x) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), Ne(e, p, "whitespace")(x)) : x === 96 && x === l ? t(x) : (e.consume(x), h);
}
function p(x) {
return x === null || re(x) ? d(x) : (e.enter("codeFencedFenceMeta"), e.enter("chunkString", {
contentType: "string"
}), v(x));
}
function v(x) {
return x === null || re(x) ? (e.exit("chunkString"), e.exit("codeFencedFenceMeta"), d(x)) : x === 96 && x === l ? t(x) : (e.consume(x), v);
}
function y(x) {
return e.attempt(i, N, f)(x);
}
function f(x) {
return e.enter("lineEnding"), e.consume(x), e.exit("lineEnding"), g;
}
function g(x) {
return a > 0 && Ee(x) ? Ne(
e,
E,
"linePrefix",
a + 1
)(x) : E(x);
}
function E(x) {
return x === null || re(x) ? e.check(ea, y, N)(x) : (e.enter("codeFlowValue"), _(x));
}
function _(x) {
return x === null || re(x) ? (e.exit("codeFlowValue"), E(x)) : (e.consume(x), _);
}
function N(x) {
return e.exit("codeFenced"), n(x);
}
function A(x, T, R) {
let I = 0;
return W;
function W(K) {
return x.enter("lineEnding"), x.consume(K), x.exit("lineEnding"), L;
}
function L(K) {
return x.enter("codeFencedFence"), Ee(K) ? Ne(
x,
P,
"linePrefix",
r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
)(K) : P(K);
}
function P(K) {
return K === l ? (x.enter("codeFencedFenceSequence"), Y(K)) : R(K);
}
function Y(K) {
return K === l ? (I++, x.consume(K), Y) : I >= o ? (x.exit("codeFencedFenceSequence"), Ee(K) ? Ne(x, Z, "whitespace")(K) : Z(K)) : R(K);
}
function Z(K) {
return K === null || re(K) ? (x.exit("codeFencedFence"), T(K)) : R(K);
}
}
}
function Lf(e, n, t) {
const r = this;
return i;
function i(o) {
return o === null ? t(o) : (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), a);
}
function a(o) {
return r.parser.lazy[r.now().line] ? t(o) : n(o);
}
}
const ur = {
name: "codeIndented",
tokenize: Pf
}, Df = {
tokenize: Bf,
partial: !0
};
function Pf(e, n, t) {
const r = this;
return i;
function i(c) {
return e.enter("codeIndented"), Ne(e, a, "linePrefix", 4 + 1)(c);
}
function a(c) {
const u = r.events[r.events.length - 1];
return u && u[1].type === "linePrefix" && u[2].sliceSerialize(u[1], !0).length >= 4 ? o(c) : t(c);
}
function o(c) {
return c === null ? s(c) : re(c) ? e.attempt(Df, o, s)(c) : (e.enter("codeFlowValue"), l(c));
}
function l(c) {
return c === null || re(c) ? (e.exit("codeFlowValue"), o(c)) : (e.consume(c), l);
}
function s(c) {
return e.exit("codeIndented"), n(c);
}
}
function Bf(e, n, t) {
const r = this;
return i;
function i(o) {
return r.parser.lazy[r.now().line] ? t(o) : re(o) ? (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), i) : Ne(e, a, "linePrefix", 4 + 1)(o);
}
function a(o) {
const l = r.events[r.events.length - 1];
return l && l[1].type === "linePrefix" && l[2].sliceSerialize(l[1], !0).length >= 4 ? n(o) : re(o) ? i(o) : t(o);
}
}
const Ff = {
name: "codeText",
tokenize: Uf,
resolve: $f,
previous: zf
};
function $f(e) {
let n = e.length - 4, t = 3, r, i;
if ((e[t][1].type === "lineEnding" || e[t][1].type === "space") && (e[n][1].type === "lineEnding" || e[n][1].type === "space")) {
for (r = t; ++r < n; )
if (e[r][1].type === "codeTextData") {
e[t][1].type = "codeTextPadding", e[n][1].type = "codeTextPadding", t += 2, n -= 2;
break;
}
}
for (r = t - 1, n++; ++r <= n; )
i === void 0 ? r !== n && e[r][1].type !== "lineEnding" && (i = r) : (r === n || e[r][1].type === "lineEnding") && (e[i][1].type = "codeTextData", r !== i + 2 && (e[i][1].end = e[r - 1][1].end, e.splice(i + 2, r - i - 2), n -= r - i - 2, r = i + 2), i = void 0);
return e;
}
function zf(e) {
return e !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
}
function Uf(e, n, t) {
let r = 0, i, a;
return o;
function o(d) {
return e.enter("codeText"), e.enter("codeTextSequence"), l(d);
}
function l(d) {
return d === 96 ? (e.consume(d), r++, l) : (e.exit("codeTextSequence"), s(d));
}
function s(d) {
return d === null ? t(d) : d === 32 ? (e.enter("space"), e.consume(d), e.exit("space"), s) : d === 96 ? (a = e.enter("codeTextSequence"), i = 0, u(d)) : re(d) ? (e.enter("lineEnding"), e.consume(d), e.exit("lineEnding"), s) : (e.enter("codeTextData"), c(d));
}
function c(d) {
return d === null || d === 32 || d === 96 || re(d) ? (e.exit("codeTextData"), s(d)) : (e.consume(d), c);
}
function u(d) {
return d === 96 ? (e.consume(d), i++, u) : i === r ? (e.exit("codeTextSequence"), e.exit("codeText"), n(d)) : (a.type = "codeTextData", c(d));
}
}
function tc(e) {
const n = {};
let t = -1, r, i, a, o, l, s, c;
for (; ++t < e.length; ) {
for (; t in n; )
t = n[t];
if (r = e[t], t && r[1].type === "chunkFlow" && e[t - 1][1].type === "listItemPrefix" && (s = r[1]._tokenizer.events, a = 0, a < s.length && s[a][1].type === "lineEndingBlank" && (a += 2), a < s.length && s[a][1].type === "content"))
for (; ++a < s.length && s[a][1].type !== "content"; )
s[a][1].type === "chunkText" && (s[a][1]._isInFirstContentOfListItem = !0, a++);
if (r[0] === "enter")
r[1].contentType && (Object.assign(n, Hf(e, t)), t = n[t], c = !0);
else if (r[1]._container) {
for (a = t, i = void 0; a-- && (o = e[a], o[1].type === "lineEnding" || o[1].type === "lineEndingBlank"); )
o[0] === "enter" && (i && (e[i][1].type = "lineEndingBlank"), o[1].type = "lineEnding", i = a);
i && (r[1].end = Object.assign({}, e[i][1].start), l = e.slice(i, t), l.unshift(r), mn(e, i, t - i + 1, l));
}
}
return !c;
}
function Hf(e, n) {
const t = e[n][1], r = e[n][2];
let i = n - 1;
const a = [], o = t._tokenizer || r.parser[t.contentType](t.start), l = o.events, s = [], c = {};
let u, d, h = -1, p = t, v = 0, y = 0;
const f = [y];
for (; p; ) {
for (; e[++i][1] !== p; )
;
a.push(i), p._tokenizer || (u = r.sliceStream(p), p.next || u.push(null), d && o.defineSkip(p.start), p._isInFirstContentOfListItem && (o._gfmTasklistFirstContentOfListItem = !0), o.write(u), p._isInFirstContentOfListItem && (o._gfmTasklistFirstContentOfListItem = void 0)), d = p, p = p.next;
}
for (p = t; ++h < l.length; )
// Find a void token that includes a break.
l[h][0] === "exit" && l[h - 1][0] === "enter" && l[h][1].type === l[h - 1][1].type && l[h][1].start.line !== l[h][1].end.line && (y = h + 1, f.push(y), p._tokenizer = void 0, p.previous = void 0, p = p.next);
for (o.events = [], p ? (p._tokenizer = void 0, p.previous = void 0) : f.pop(), h = f.length; h--; ) {
const g = l.slice(f[h], f[h + 1]), E = a.pop();
s.unshift([E, E + g.length - 1]), mn(e, E, 2, g);
}
for (h = -1; ++h < s.length; )
c[v + s[h][0]] = v + s[h][1], v += s[h][1] - s[h][0] - 1;
return c;
}
const jf = {
tokenize: qf,
resolve: Gf
}, Kf = {
tokenize: Wf,
partial: !0
};
function Gf(e) {
return tc(e), e;
}
function qf(e, n) {
let t;
return r;
function r(l) {
return e.enter("content"), t = e.enter("chunkContent", {
contentType: "content"
}), i(l);
}
function i(l) {
return l === null ? a(l) : re(l) ? e.check(
Kf,
o,
a
)(l) : (e.consume(l), i);
}
function a(l) {
return e.exit("chunkContent"), e.exit("content"), n(l);
}
function o(l) {
return e.consume(l), e.exit("chunkContent"), t.next = e.enter("chunkContent", {
contentType: "content",
previous: t
}), t = t.next, i;
}
}
function Wf(e, n, t) {
const r = this;
return i;
function i(o) {
return e.exit("chunkContent"), e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), Ne(e, a, "linePrefix");
}
function a(o) {
if (o === null || re(o))
return t(o);
const l = r.events[r.events.length - 1];
return !r.parser.constructs.disable.null.incl