@capitol.ai/ui
Version:
Library of React components from Capitol AI
1,532 lines • 187 kB
JavaScript
import { d as wn, a as ee, c as jn, p as te, r as Sn, s as de, b as ue, e as pn, f as ur, m as j, g as V, h as sr, i as cr, j as hn, k as z, l as ne, n as Ee, o as Fe, q as Qe, t as Re, u as pr, v as hr, w as fr, x as mr, y as bt, z as dr } from "./index-Drx9K89Y.js";
import { jsxs as gr, jsx as yr, Fragment as xr } from "react/jsx-runtime";
import "react";
function wt(e, n) {
const t = Number.parseInt(e, n);
return (
// C0 except for HT, LF, FF, CR, space.
t < 9 || t === 11 || t > 13 && t < 32 || // Control character (DEL) of C0, and C1 controls.
t > 126 && t < 160 || // Lone high surrogates and low surrogates.
t > 55295 && t < 57344 || // Noncharacters.
t > 64975 && t < 65008 || /* eslint-disable no-bitwise */
(t & 65535) === 65535 || (t & 65535) === 65534 || /* eslint-enable no-bitwise */
// Out of range
t > 1114111 ? "�" : String.fromCodePoint(t)
);
}
const kr = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
function br(e) {
return e.replace(kr, wr);
}
function wr(e, n, t) {
if (n)
return n;
if (t.charCodeAt(0) === 35) {
const i = t.charCodeAt(1), l = i === 120 || i === 88;
return wt(t.slice(l ? 2 : 1), l ? 16 : 10);
}
return wn(t) || e;
}
function Te(e) {
const n = [];
let t = -1, r = 0, i = 0;
for (; ++t < e.length; ) {
const l = e.charCodeAt(t);
let o = "";
if (l === 37 && ee(e.charCodeAt(t + 1)) && ee(e.charCodeAt(t + 2)))
i = 2;
else if (l < 128)
/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l)) || (o = String.fromCharCode(l));
else if (l > 55295 && l < 57344) {
const a = e.charCodeAt(t + 1);
l < 56320 && a > 56319 && a < 57344 ? (o = String.fromCharCode(l, a), i = 1) : o = "�";
} else
o = String.fromCharCode(l);
o && (n.push(e.slice(r, t), encodeURIComponent(o)), r = t + i + 1, o = ""), i && (t += i, i = 0);
}
return n.join("") + e.slice(r);
}
const fn = {
name: "attention",
resolveAll: Sr,
tokenize: Cr
};
function Sr(e, n) {
let t = -1, r, i, l, o, a, c, u, s;
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;
c = 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 h = {
...e[r][1].end
}, d = {
...e[t][1].start
};
Hn(h, -c), Hn(d, c), o = {
type: c > 1 ? "strongSequence" : "emphasisSequence",
start: h,
end: {
...e[r][1].end
}
}, a = {
type: c > 1 ? "strongSequence" : "emphasisSequence",
start: {
...e[t][1].start
},
end: d
}, l = {
type: c > 1 ? "strongText" : "emphasisText",
start: {
...e[r][1].end
},
end: {
...e[t][1].start
}
}, i = {
type: c > 1 ? "strong" : "emphasis",
start: {
...o.start
},
end: {
...a.end
}
}, e[r][1].end = {
...o.start
}, e[t][1].start = {
...a.end
}, u = [], e[r][1].end.offset - e[r][1].start.offset && (u = te(u, [["enter", e[r][1], n], ["exit", e[r][1], n]])), u = te(u, [["enter", i, n], ["enter", o, n], ["exit", o, n], ["enter", l, n]]), u = te(u, Sn(n.parser.constructs.insideSpan.null, e.slice(r + 1, t), n)), u = te(u, [["exit", l, n], ["enter", a, n], ["exit", a, n], ["exit", i, n]]), e[t][1].end.offset - e[t][1].start.offset ? (s = 2, u = te(u, [["enter", e[t][1], n], ["exit", e[t][1], n]])) : s = 0, de(e, r - 1, t - r + 3, u), t = r + u.length - s - 2;
break;
}
}
for (t = -1; ++t < e.length; )
e[t][1].type === "attentionSequence" && (e[t][1].type = "data");
return e;
}
function Cr(e, n) {
const t = this.parser.constructs.attentionMarkers.null, r = this.previous, i = jn(r);
let l;
return o;
function o(c) {
return l = c, e.enter("attentionSequence"), a(c);
}
function a(c) {
if (c === l)
return e.consume(c), a;
const u = e.exit("attentionSequence"), s = jn(c), h = !s || s === 2 && i || t.includes(c), d = !i || i === 2 && s || t.includes(r);
return u._open = !!(l === 42 ? h : h && (i || !d)), u._close = !!(l === 42 ? d : d && (s || !h)), n(c);
}
}
function Hn(e, n) {
e.column += n, e.offset += n, e._bufferIndex += n;
}
const Er = {
name: "autolink",
tokenize: Ir
};
function Ir(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"), l;
}
function l(p) {
return ue(p) ? (e.consume(p), o) : p === 64 ? t(p) : u(p);
}
function o(p) {
return p === 43 || p === 45 || p === 46 || ee(p) ? (r = 1, a(p)) : u(p);
}
function a(p) {
return p === 58 ? (e.consume(p), r = 0, c) : (p === 43 || p === 45 || p === 46 || ee(p)) && r++ < 32 ? (e.consume(p), a) : (r = 0, u(p));
}
function c(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 || pn(p) ? t(p) : (e.consume(p), c);
}
function u(p) {
return p === 64 ? (e.consume(p), s) : ur(p) ? (e.consume(p), u) : t(p);
}
function s(p) {
return ee(p) ? h(p) : t(p);
}
function h(p) {
return p === 46 ? (e.consume(p), r = 0, s) : p === 62 ? (e.exit("autolinkProtocol").type = "autolinkEmail", e.enter("autolinkMarker"), e.consume(p), e.exit("autolinkMarker"), e.exit("autolink"), n) : d(p);
}
function d(p) {
if ((p === 45 || ee(p)) && r++ < 63) {
const S = p === 45 ? d : h;
return e.consume(p), S;
}
return t(p);
}
}
const St = {
continuation: {
tokenize: Pr
},
exit: vr,
name: "blockQuote",
tokenize: Tr
};
function Tr(e, n, t) {
const r = this;
return i;
function i(o) {
if (o === 62) {
const a = r.containerState;
return a.open || (e.enter("blockQuote", {
_container: !0
}), a.open = !0), e.enter("blockQuotePrefix"), e.enter("blockQuoteMarker"), e.consume(o), e.exit("blockQuoteMarker"), l;
}
return t(o);
}
function l(o) {
return j(o) ? (e.enter("blockQuotePrefixWhitespace"), e.consume(o), e.exit("blockQuotePrefixWhitespace"), e.exit("blockQuotePrefix"), n) : (e.exit("blockQuotePrefix"), n(o));
}
}
function Pr(e, n, t) {
const r = this;
return i;
function i(o) {
return j(o) ? V(e, l, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(o) : l(o);
}
function l(o) {
return e.attempt(St, n, t)(o);
}
}
function vr(e) {
e.exit("blockQuote");
}
const Ct = {
name: "characterEscape",
tokenize: Ar
};
function Ar(e, n, t) {
return r;
function r(l) {
return e.enter("characterEscape"), e.enter("escapeMarker"), e.consume(l), e.exit("escapeMarker"), i;
}
function i(l) {
return sr(l) ? (e.enter("characterEscapeValue"), e.consume(l), e.exit("characterEscapeValue"), e.exit("characterEscape"), n) : t(l);
}
}
const Et = {
name: "characterReference",
tokenize: zr
};
function zr(e, n, t) {
const r = this;
let i = 0, l, o;
return a;
function a(h) {
return e.enter("characterReference"), e.enter("characterReferenceMarker"), e.consume(h), e.exit("characterReferenceMarker"), c;
}
function c(h) {
return h === 35 ? (e.enter("characterReferenceMarkerNumeric"), e.consume(h), e.exit("characterReferenceMarkerNumeric"), u) : (e.enter("characterReferenceValue"), l = 31, o = ee, s(h));
}
function u(h) {
return h === 88 || h === 120 ? (e.enter("characterReferenceMarkerHexadecimal"), e.consume(h), e.exit("characterReferenceMarkerHexadecimal"), e.enter("characterReferenceValue"), l = 6, o = cr, s) : (e.enter("characterReferenceValue"), l = 7, o = hn, s(h));
}
function s(h) {
if (h === 59 && i) {
const d = e.exit("characterReferenceValue");
return o === ee && !wn(r.sliceSerialize(d)) ? t(h) : (e.enter("characterReferenceMarker"), e.consume(h), e.exit("characterReferenceMarker"), e.exit("characterReference"), n);
}
return o(h) && i++ < l ? (e.consume(h), s) : t(h);
}
}
const Un = {
partial: !0,
tokenize: Dr
}, Vn = {
concrete: !0,
name: "codeFenced",
tokenize: Lr
};
function Lr(e, n, t) {
const r = this, i = {
partial: !0,
tokenize: H
};
let l = 0, o = 0, a;
return c;
function c(y) {
return u(y);
}
function u(y) {
const R = r.events[r.events.length - 1];
return l = R && R[1].type === "linePrefix" ? R[2].sliceSerialize(R[1], !0).length : 0, a = y, e.enter("codeFenced"), e.enter("codeFencedFence"), e.enter("codeFencedFenceSequence"), s(y);
}
function s(y) {
return y === a ? (o++, e.consume(y), s) : o < 3 ? t(y) : (e.exit("codeFencedFenceSequence"), j(y) ? V(e, h, "whitespace")(y) : h(y));
}
function h(y) {
return y === null || z(y) ? (e.exit("codeFencedFence"), r.interrupt ? n(y) : e.check(Un, w, M)(y)) : (e.enter("codeFencedFenceInfo"), e.enter("chunkString", {
contentType: "string"
}), d(y));
}
function d(y) {
return y === null || z(y) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), h(y)) : j(y) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), V(e, p, "whitespace")(y)) : y === 96 && y === a ? t(y) : (e.consume(y), d);
}
function p(y) {
return y === null || z(y) ? h(y) : (e.enter("codeFencedFenceMeta"), e.enter("chunkString", {
contentType: "string"
}), S(y));
}
function S(y) {
return y === null || z(y) ? (e.exit("chunkString"), e.exit("codeFencedFenceMeta"), h(y)) : y === 96 && y === a ? t(y) : (e.consume(y), S);
}
function w(y) {
return e.attempt(i, M, L)(y);
}
function L(y) {
return e.enter("lineEnding"), e.consume(y), e.exit("lineEnding"), k;
}
function k(y) {
return l > 0 && j(y) ? V(e, v, "linePrefix", l + 1)(y) : v(y);
}
function v(y) {
return y === null || z(y) ? e.check(Un, w, M)(y) : (e.enter("codeFlowValue"), C(y));
}
function C(y) {
return y === null || z(y) ? (e.exit("codeFlowValue"), v(y)) : (e.consume(y), C);
}
function M(y) {
return e.exit("codeFenced"), n(y);
}
function H(y, R, q) {
let F = 0;
return N;
function N(A) {
return y.enter("lineEnding"), y.consume(A), y.exit("lineEnding"), P;
}
function P(A) {
return y.enter("codeFencedFence"), j(A) ? V(y, I, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(A) : I(A);
}
function I(A) {
return A === a ? (y.enter("codeFencedFenceSequence"), T(A)) : q(A);
}
function T(A) {
return A === a ? (F++, y.consume(A), T) : F >= o ? (y.exit("codeFencedFenceSequence"), j(A) ? V(y, E, "whitespace")(A) : E(A)) : q(A);
}
function E(A) {
return A === null || z(A) ? (y.exit("codeFencedFence"), R(A)) : q(A);
}
}
}
function Dr(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"), l);
}
function l(o) {
return r.parser.lazy[r.now().line] ? t(o) : n(o);
}
}
const Je = {
name: "codeIndented",
tokenize: _r
}, Or = {
partial: !0,
tokenize: Rr
};
function _r(e, n, t) {
const r = this;
return i;
function i(u) {
return e.enter("codeIndented"), V(e, l, "linePrefix", 5)(u);
}
function l(u) {
const s = r.events[r.events.length - 1];
return s && s[1].type === "linePrefix" && s[2].sliceSerialize(s[1], !0).length >= 4 ? o(u) : t(u);
}
function o(u) {
return u === null ? c(u) : z(u) ? e.attempt(Or, o, c)(u) : (e.enter("codeFlowValue"), a(u));
}
function a(u) {
return u === null || z(u) ? (e.exit("codeFlowValue"), o(u)) : (e.consume(u), a);
}
function c(u) {
return e.exit("codeIndented"), n(u);
}
}
function Rr(e, n, t) {
const r = this;
return i;
function i(o) {
return r.parser.lazy[r.now().line] ? t(o) : z(o) ? (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), i) : V(e, l, "linePrefix", 5)(o);
}
function l(o) {
const a = r.events[r.events.length - 1];
return a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? n(o) : z(o) ? i(o) : t(o);
}
}
const Fr = {
name: "codeText",
previous: Mr,
resolve: Nr,
tokenize: Br
};
function Nr(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 Mr(e) {
return e !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
}
function Br(e, n, t) {
let r = 0, i, l;
return o;
function o(h) {
return e.enter("codeText"), e.enter("codeTextSequence"), a(h);
}
function a(h) {
return h === 96 ? (e.consume(h), r++, a) : (e.exit("codeTextSequence"), c(h));
}
function c(h) {
return h === null ? t(h) : h === 32 ? (e.enter("space"), e.consume(h), e.exit("space"), c) : h === 96 ? (l = e.enter("codeTextSequence"), i = 0, s(h)) : z(h) ? (e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), c) : (e.enter("codeTextData"), u(h));
}
function u(h) {
return h === null || h === 32 || h === 96 || z(h) ? (e.exit("codeTextData"), c(h)) : (e.consume(h), u);
}
function s(h) {
return h === 96 ? (e.consume(h), i++, s) : i === r ? (e.exit("codeTextSequence"), e.exit("codeText"), n(h)) : (l.type = "codeTextData", u(h));
}
}
class jr {
/**
* @param {ReadonlyArray<T> | null | undefined} [initial]
* Initial items (optional).
* @returns
* Splice buffer.
*/
constructor(n) {
this.left = n ? [...n] : [], this.right = [];
}
/**
* Array access;
* does not move the cursor.
*
* @param {number} index
* Index.
* @return {T}
* Item.
*/
get(n) {
if (n < 0 || n >= this.left.length + this.right.length)
throw new RangeError("Cannot access index `" + n + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`");
return n < this.left.length ? this.left[n] : this.right[this.right.length - n + this.left.length - 1];
}
/**
* The length of the splice buffer, one greater than the largest index in the
* array.
*/
get length() {
return this.left.length + this.right.length;
}
/**
* Remove and return `list[0]`;
* moves the cursor to `0`.
*
* @returns {T | undefined}
* Item, optional.
*/
shift() {
return this.setCursor(0), this.right.pop();
}
/**
* Slice the buffer to get an array;
* does not move the cursor.
*
* @param {number} start
* Start.
* @param {number | null | undefined} [end]
* End (optional).
* @returns {Array<T>}
* Array of items.
*/
slice(n, t) {
const r = t ?? Number.POSITIVE_INFINITY;
return r < this.left.length ? this.left.slice(n, r) : n > this.left.length ? this.right.slice(this.right.length - r + this.left.length, this.right.length - n + this.left.length).reverse() : this.left.slice(n).concat(this.right.slice(this.right.length - r + this.left.length).reverse());
}
/**
* Mimics the behavior of Array.prototype.splice() except for the change of
* interface necessary to avoid segfaults when patching in very large arrays.
*
* This operation moves cursor is moved to `start` and results in the cursor
* placed after any inserted items.
*
* @param {number} start
* Start;
* zero-based index at which to start changing the array;
* negative numbers count backwards from the end of the array and values
* that are out-of bounds are clamped to the appropriate end of the array.
* @param {number | null | undefined} [deleteCount=0]
* Delete count (default: `0`);
* maximum number of elements to delete, starting from start.
* @param {Array<T> | null | undefined} [items=[]]
* Items to include in place of the deleted items (default: `[]`).
* @return {Array<T>}
* Any removed items.
*/
splice(n, t, r) {
const i = t || 0;
this.setCursor(Math.trunc(n));
const l = this.right.splice(this.right.length - i, Number.POSITIVE_INFINITY);
return r && Le(this.left, r), l.reverse();
}
/**
* Remove and return the highest-numbered item in the array, so
* `list[list.length - 1]`;
* Moves the cursor to `length`.
*
* @returns {T | undefined}
* Item, optional.
*/
pop() {
return this.setCursor(Number.POSITIVE_INFINITY), this.left.pop();
}
/**
* Inserts a single item to the high-numbered side of the array;
* moves the cursor to `length`.
*
* @param {T} item
* Item.
* @returns {undefined}
* Nothing.
*/
push(n) {
this.setCursor(Number.POSITIVE_INFINITY), this.left.push(n);
}
/**
* Inserts many items to the high-numbered side of the array.
* Moves the cursor to `length`.
*
* @param {Array<T>} items
* Items.
* @returns {undefined}
* Nothing.
*/
pushMany(n) {
this.setCursor(Number.POSITIVE_INFINITY), Le(this.left, n);
}
/**
* Inserts a single item to the low-numbered side of the array;
* Moves the cursor to `0`.
*
* @param {T} item
* Item.
* @returns {undefined}
* Nothing.
*/
unshift(n) {
this.setCursor(0), this.right.push(n);
}
/**
* Inserts many items to the low-numbered side of the array;
* moves the cursor to `0`.
*
* @param {Array<T>} items
* Items.
* @returns {undefined}
* Nothing.
*/
unshiftMany(n) {
this.setCursor(0), Le(this.right, n.reverse());
}
/**
* Move the cursor to a specific position in the array. Requires
* time proportional to the distance moved.
*
* If `n < 0`, the cursor will end up at the beginning.
* If `n > length`, the cursor will end up at the end.
*
* @param {number} n
* Position.
* @return {undefined}
* Nothing.
*/
setCursor(n) {
if (!(n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0))
if (n < this.left.length) {
const t = this.left.splice(n, Number.POSITIVE_INFINITY);
Le(this.right, t.reverse());
} else {
const t = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY);
Le(this.left, t.reverse());
}
}
}
function Le(e, n) {
let t = 0;
if (n.length < 1e4)
e.push(...n);
else
for (; t < n.length; )
e.push(...n.slice(t, t + 1e4)), t += 1e4;
}
function It(e) {
const n = {};
let t = -1, r, i, l, o, a, c, u;
const s = new jr(e);
for (; ++t < s.length; ) {
for (; t in n; )
t = n[t];
if (r = s.get(t), t && r[1].type === "chunkFlow" && s.get(t - 1)[1].type === "listItemPrefix" && (c = r[1]._tokenizer.events, l = 0, l < c.length && c[l][1].type === "lineEndingBlank" && (l += 2), l < c.length && c[l][1].type === "content"))
for (; ++l < c.length && c[l][1].type !== "content"; )
c[l][1].type === "chunkText" && (c[l][1]._isInFirstContentOfListItem = !0, l++);
if (r[0] === "enter")
r[1].contentType && (Object.assign(n, Hr(s, t)), t = n[t], u = !0);
else if (r[1]._container) {
for (l = t, i = void 0; l--; )
if (o = s.get(l), o[1].type === "lineEnding" || o[1].type === "lineEndingBlank")
o[0] === "enter" && (i && (s.get(i)[1].type = "lineEndingBlank"), o[1].type = "lineEnding", i = l);
else if (!(o[1].type === "linePrefix" || o[1].type === "listItemIndent")) break;
i && (r[1].end = {
...s.get(i)[1].start
}, a = s.slice(i, t), a.unshift(r), s.splice(i, t - i + 1, a));
}
}
return de(e, 0, Number.POSITIVE_INFINITY, s.slice(0)), !u;
}
function Hr(e, n) {
const t = e.get(n)[1], r = e.get(n)[2];
let i = n - 1;
const l = [];
let o = t._tokenizer;
o || (o = r.parser[t.contentType](t.start), t._contentTypeTextTrailing && (o._contentTypeTextTrailing = !0));
const a = o.events, c = [], u = {};
let s, h, d = -1, p = t, S = 0, w = 0;
const L = [w];
for (; p; ) {
for (; e.get(++i)[1] !== p; )
;
l.push(i), p._tokenizer || (s = r.sliceStream(p), p.next || s.push(null), h && o.defineSkip(p.start), p._isInFirstContentOfListItem && (o._gfmTasklistFirstContentOfListItem = !0), o.write(s), p._isInFirstContentOfListItem && (o._gfmTasklistFirstContentOfListItem = void 0)), h = p, p = p.next;
}
for (p = t; ++d < a.length; )
// Find a void token that includes a break.
a[d][0] === "exit" && a[d - 1][0] === "enter" && a[d][1].type === a[d - 1][1].type && a[d][1].start.line !== a[d][1].end.line && (w = d + 1, L.push(w), p._tokenizer = void 0, p.previous = void 0, p = p.next);
for (o.events = [], p ? (p._tokenizer = void 0, p.previous = void 0) : L.pop(), d = L.length; d--; ) {
const k = a.slice(L[d], L[d + 1]), v = l.pop();
c.push([v, v + k.length - 1]), e.splice(v, 2, k);
}
for (c.reverse(), d = -1; ++d < c.length; )
u[S + c[d][0]] = S + c[d][1], S += c[d][1] - c[d][0] - 1;
return u;
}
const Ur = {
resolve: qr,
tokenize: $r
}, Vr = {
partial: !0,
tokenize: Wr
};
function qr(e) {
return It(e), e;
}
function $r(e, n) {
let t;
return r;
function r(a) {
return e.enter("content"), t = e.enter("chunkContent", {
contentType: "content"
}), i(a);
}
function i(a) {
return a === null ? l(a) : z(a) ? e.check(Vr, o, l)(a) : (e.consume(a), i);
}
function l(a) {
return e.exit("chunkContent"), e.exit("content"), n(a);
}
function o(a) {
return e.consume(a), e.exit("chunkContent"), t.next = e.enter("chunkContent", {
contentType: "content",
previous: t
}), t = t.next, i;
}
}
function Wr(e, n, t) {
const r = this;
return i;
function i(o) {
return e.exit("chunkContent"), e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), V(e, l, "linePrefix");
}
function l(o) {
if (o === null || z(o))
return t(o);
const a = r.events[r.events.length - 1];
return !r.parser.constructs.disable.null.includes("codeIndented") && a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? n(o) : e.interrupt(r.parser.constructs.flow, t, n)(o);
}
}
function Tt(e, n, t, r, i, l, o, a, c) {
const u = c || Number.POSITIVE_INFINITY;
let s = 0;
return h;
function h(k) {
return k === 60 ? (e.enter(r), e.enter(i), e.enter(l), e.consume(k), e.exit(l), d) : k === null || k === 32 || k === 41 || pn(k) ? t(k) : (e.enter(r), e.enter(o), e.enter(a), e.enter("chunkString", {
contentType: "string"
}), w(k));
}
function d(k) {
return k === 62 ? (e.enter(l), e.consume(k), e.exit(l), e.exit(i), e.exit(r), n) : (e.enter(a), e.enter("chunkString", {
contentType: "string"
}), p(k));
}
function p(k) {
return k === 62 ? (e.exit("chunkString"), e.exit(a), d(k)) : k === null || k === 60 || z(k) ? t(k) : (e.consume(k), k === 92 ? S : p);
}
function S(k) {
return k === 60 || k === 62 || k === 92 ? (e.consume(k), p) : p(k);
}
function w(k) {
return !s && (k === null || k === 41 || ne(k)) ? (e.exit("chunkString"), e.exit(a), e.exit(o), e.exit(r), n(k)) : s < u && k === 40 ? (e.consume(k), s++, w) : k === 41 ? (e.consume(k), s--, w) : k === null || k === 32 || k === 40 || pn(k) ? t(k) : (e.consume(k), k === 92 ? L : w);
}
function L(k) {
return k === 40 || k === 41 || k === 92 ? (e.consume(k), w) : w(k);
}
}
function Pt(e, n, t, r, i, l) {
const o = this;
let a = 0, c;
return u;
function u(p) {
return e.enter(r), e.enter(i), e.consume(p), e.exit(i), e.enter(l), s;
}
function s(p) {
return a > 999 || p === null || p === 91 || p === 93 && !c || // To do: remove in the future once we’ve switched from
// `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
// which doesn’t need this.
// Hidden footnotes hook.
/* c8 ignore next 3 */
p === 94 && !a && "_hiddenFootnoteSupport" in o.parser.constructs ? t(p) : p === 93 ? (e.exit(l), e.enter(i), e.consume(p), e.exit(i), e.exit(r), n) : z(p) ? (e.enter("lineEnding"), e.consume(p), e.exit("lineEnding"), s) : (e.enter("chunkString", {
contentType: "string"
}), h(p));
}
function h(p) {
return p === null || p === 91 || p === 93 || z(p) || a++ > 999 ? (e.exit("chunkString"), s(p)) : (e.consume(p), c || (c = !j(p)), p === 92 ? d : h);
}
function d(p) {
return p === 91 || p === 92 || p === 93 ? (e.consume(p), a++, h) : h(p);
}
}
function vt(e, n, t, r, i, l) {
let o;
return a;
function a(d) {
return d === 34 || d === 39 || d === 40 ? (e.enter(r), e.enter(i), e.consume(d), e.exit(i), o = d === 40 ? 41 : d, c) : t(d);
}
function c(d) {
return d === o ? (e.enter(i), e.consume(d), e.exit(i), e.exit(r), n) : (e.enter(l), u(d));
}
function u(d) {
return d === o ? (e.exit(l), c(o)) : d === null ? t(d) : z(d) ? (e.enter("lineEnding"), e.consume(d), e.exit("lineEnding"), V(e, u, "linePrefix")) : (e.enter("chunkString", {
contentType: "string"
}), s(d));
}
function s(d) {
return d === o || d === null || z(d) ? (e.exit("chunkString"), u(d)) : (e.consume(d), d === 92 ? h : s);
}
function h(d) {
return d === o || d === 92 ? (e.consume(d), s) : s(d);
}
}
const Yr = {
name: "definition",
tokenize: Qr
}, Xr = {
partial: !0,
tokenize: Gr
};
function Qr(e, n, t) {
const r = this;
let i;
return l;
function l(p) {
return e.enter("definition"), o(p);
}
function o(p) {
return Pt.call(
r,
e,
a,
// Note: we don’t need to reset the way `markdown-rs` does.
t,
"definitionLabel",
"definitionLabelMarker",
"definitionLabelString"
)(p);
}
function a(p) {
return i = Ee(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1)), p === 58 ? (e.enter("definitionMarker"), e.consume(p), e.exit("definitionMarker"), c) : t(p);
}
function c(p) {
return ne(p) ? Fe(e, u)(p) : u(p);
}
function u(p) {
return Tt(
e,
s,
// Note: we don’t need to reset the way `markdown-rs` does.
t,
"definitionDestination",
"definitionDestinationLiteral",
"definitionDestinationLiteralMarker",
"definitionDestinationRaw",
"definitionDestinationString"
)(p);
}
function s(p) {
return e.attempt(Xr, h, h)(p);
}
function h(p) {
return j(p) ? V(e, d, "whitespace")(p) : d(p);
}
function d(p) {
return p === null || z(p) ? (e.exit("definition"), r.parser.defined.push(i), n(p)) : t(p);
}
}
function Gr(e, n, t) {
return r;
function r(a) {
return ne(a) ? Fe(e, i)(a) : t(a);
}
function i(a) {
return vt(e, l, t, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(a);
}
function l(a) {
return j(a) ? V(e, o, "whitespace")(a) : o(a);
}
function o(a) {
return a === null || z(a) ? n(a) : t(a);
}
}
const Jr = {
name: "hardBreakEscape",
tokenize: Kr
};
function Kr(e, n, t) {
return r;
function r(l) {
return e.enter("hardBreakEscape"), e.consume(l), i;
}
function i(l) {
return z(l) ? (e.exit("hardBreakEscape"), n(l)) : t(l);
}
}
const Zr = {
name: "headingAtx",
resolve: ei,
tokenize: ni
};
function ei(e, n) {
let t = e.length - 2, r = 3, i, l;
return e[r][1].type === "whitespace" && (r += 2), t - 2 > r && e[t][1].type === "whitespace" && (t -= 2), e[t][1].type === "atxHeadingSequence" && (r === t - 1 || t - 4 > r && e[t - 2][1].type === "whitespace") && (t -= r + 1 === t ? 2 : 4), t > r && (i = {
type: "atxHeadingText",
start: e[r][1].start,
end: e[t][1].end
}, l = {
type: "chunkText",
start: e[r][1].start,
end: e[t][1].end,
contentType: "text"
}, de(e, r, t - r + 1, [["enter", i, n], ["enter", l, n], ["exit", l, n], ["exit", i, n]])), e;
}
function ni(e, n, t) {
let r = 0;
return i;
function i(s) {
return e.enter("atxHeading"), l(s);
}
function l(s) {
return e.enter("atxHeadingSequence"), o(s);
}
function o(s) {
return s === 35 && r++ < 6 ? (e.consume(s), o) : s === null || ne(s) ? (e.exit("atxHeadingSequence"), a(s)) : t(s);
}
function a(s) {
return s === 35 ? (e.enter("atxHeadingSequence"), c(s)) : s === null || z(s) ? (e.exit("atxHeading"), n(s)) : j(s) ? V(e, a, "whitespace")(s) : (e.enter("atxHeadingText"), u(s));
}
function c(s) {
return s === 35 ? (e.consume(s), c) : (e.exit("atxHeadingSequence"), a(s));
}
function u(s) {
return s === null || s === 35 || ne(s) ? (e.exit("atxHeadingText"), a(s)) : (e.consume(s), u);
}
}
const ti = [
"address",
"article",
"aside",
"base",
"basefont",
"blockquote",
"body",
"caption",
"center",
"col",
"colgroup",
"dd",
"details",
"dialog",
"dir",
"div",
"dl",
"dt",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"frame",
"frameset",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hr",
"html",
"iframe",
"legend",
"li",
"link",
"main",
"menu",
"menuitem",
"nav",
"noframes",
"ol",
"optgroup",
"option",
"p",
"param",
"search",
"section",
"summary",
"table",
"tbody",
"td",
"tfoot",
"th",
"thead",
"title",
"tr",
"track",
"ul"
], qn = ["pre", "script", "style", "textarea"], ri = {
concrete: !0,
name: "htmlFlow",
resolveTo: oi,
tokenize: ai
}, ii = {
partial: !0,
tokenize: si
}, li = {
partial: !0,
tokenize: ui
};
function oi(e) {
let n = e.length;
for (; n-- && !(e[n][0] === "enter" && e[n][1].type === "htmlFlow"); )
;
return n > 1 && e[n - 2][1].type === "linePrefix" && (e[n][1].start = e[n - 2][1].start, e[n + 1][1].start = e[n - 2][1].start, e.splice(n - 2, 2)), e;
}
function ai(e, n, t) {
const r = this;
let i, l, o, a, c;
return u;
function u(m) {
return s(m);
}
function s(m) {
return e.enter("htmlFlow"), e.enter("htmlFlowData"), e.consume(m), h;
}
function h(m) {
return m === 33 ? (e.consume(m), d) : m === 47 ? (e.consume(m), l = !0, w) : m === 63 ? (e.consume(m), i = 3, r.interrupt ? n : f) : ue(m) ? (e.consume(m), o = String.fromCharCode(m), L) : t(m);
}
function d(m) {
return m === 45 ? (e.consume(m), i = 2, p) : m === 91 ? (e.consume(m), i = 5, a = 0, S) : ue(m) ? (e.consume(m), i = 4, r.interrupt ? n : f) : t(m);
}
function p(m) {
return m === 45 ? (e.consume(m), r.interrupt ? n : f) : t(m);
}
function S(m) {
const le = "CDATA[";
return m === le.charCodeAt(a++) ? (e.consume(m), a === le.length ? r.interrupt ? n : I : S) : t(m);
}
function w(m) {
return ue(m) ? (e.consume(m), o = String.fromCharCode(m), L) : t(m);
}
function L(m) {
if (m === null || m === 47 || m === 62 || ne(m)) {
const le = m === 47, ge = o.toLowerCase();
return !le && !l && qn.includes(ge) ? (i = 1, r.interrupt ? n(m) : I(m)) : ti.includes(o.toLowerCase()) ? (i = 6, le ? (e.consume(m), k) : r.interrupt ? n(m) : I(m)) : (i = 7, r.interrupt && !r.parser.lazy[r.now().line] ? t(m) : l ? v(m) : C(m));
}
return m === 45 || ee(m) ? (e.consume(m), o += String.fromCharCode(m), L) : t(m);
}
function k(m) {
return m === 62 ? (e.consume(m), r.interrupt ? n : I) : t(m);
}
function v(m) {
return j(m) ? (e.consume(m), v) : N(m);
}
function C(m) {
return m === 47 ? (e.consume(m), N) : m === 58 || m === 95 || ue(m) ? (e.consume(m), M) : j(m) ? (e.consume(m), C) : N(m);
}
function M(m) {
return m === 45 || m === 46 || m === 58 || m === 95 || ee(m) ? (e.consume(m), M) : H(m);
}
function H(m) {
return m === 61 ? (e.consume(m), y) : j(m) ? (e.consume(m), H) : C(m);
}
function y(m) {
return m === null || m === 60 || m === 61 || m === 62 || m === 96 ? t(m) : m === 34 || m === 39 ? (e.consume(m), c = m, R) : j(m) ? (e.consume(m), y) : q(m);
}
function R(m) {
return m === c ? (e.consume(m), c = null, F) : m === null || z(m) ? t(m) : (e.consume(m), R);
}
function q(m) {
return m === null || m === 34 || m === 39 || m === 47 || m === 60 || m === 61 || m === 62 || m === 96 || ne(m) ? H(m) : (e.consume(m), q);
}
function F(m) {
return m === 47 || m === 62 || j(m) ? C(m) : t(m);
}
function N(m) {
return m === 62 ? (e.consume(m), P) : t(m);
}
function P(m) {
return m === null || z(m) ? I(m) : j(m) ? (e.consume(m), P) : t(m);
}
function I(m) {
return m === 45 && i === 2 ? (e.consume(m), W) : m === 60 && i === 1 ? (e.consume(m), Y) : m === 62 && i === 4 ? (e.consume(m), ie) : m === 63 && i === 3 ? (e.consume(m), f) : m === 93 && i === 5 ? (e.consume(m), se) : z(m) && (i === 6 || i === 7) ? (e.exit("htmlFlowData"), e.check(ii, ce, T)(m)) : m === null || z(m) ? (e.exit("htmlFlowData"), T(m)) : (e.consume(m), I);
}
function T(m) {
return e.check(li, E, ce)(m);
}
function E(m) {
return e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), A;
}
function A(m) {
return m === null || z(m) ? T(m) : (e.enter("htmlFlowData"), I(m));
}
function W(m) {
return m === 45 ? (e.consume(m), f) : I(m);
}
function Y(m) {
return m === 47 ? (e.consume(m), o = "", re) : I(m);
}
function re(m) {
if (m === 62) {
const le = o.toLowerCase();
return qn.includes(le) ? (e.consume(m), ie) : I(m);
}
return ue(m) && o.length < 8 ? (e.consume(m), o += String.fromCharCode(m), re) : I(m);
}
function se(m) {
return m === 93 ? (e.consume(m), f) : I(m);
}
function f(m) {
return m === 62 ? (e.consume(m), ie) : m === 45 && i === 2 ? (e.consume(m), f) : I(m);
}
function ie(m) {
return m === null || z(m) ? (e.exit("htmlFlowData"), ce(m)) : (e.consume(m), ie);
}
function ce(m) {
return e.exit("htmlFlow"), n(m);
}
}
function ui(e, n, t) {
const r = this;
return i;
function i(o) {
return z(o) ? (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), l) : t(o);
}
function l(o) {
return r.parser.lazy[r.now().line] ? t(o) : n(o);
}
}
function si(e, n, t) {
return r;
function r(i) {
return e.enter("lineEnding"), e.consume(i), e.exit("lineEnding"), e.attempt(Qe, n, t);
}
}
const ci = {
name: "htmlText",
tokenize: pi
};
function pi(e, n, t) {
const r = this;
let i, l, o;
return a;
function a(f) {
return e.enter("htmlText"), e.enter("htmlTextData"), e.consume(f), c;
}
function c(f) {
return f === 33 ? (e.consume(f), u) : f === 47 ? (e.consume(f), H) : f === 63 ? (e.consume(f), C) : ue(f) ? (e.consume(f), q) : t(f);
}
function u(f) {
return f === 45 ? (e.consume(f), s) : f === 91 ? (e.consume(f), l = 0, S) : ue(f) ? (e.consume(f), v) : t(f);
}
function s(f) {
return f === 45 ? (e.consume(f), p) : t(f);
}
function h(f) {
return f === null ? t(f) : f === 45 ? (e.consume(f), d) : z(f) ? (o = h, Y(f)) : (e.consume(f), h);
}
function d(f) {
return f === 45 ? (e.consume(f), p) : h(f);
}
function p(f) {
return f === 62 ? W(f) : f === 45 ? d(f) : h(f);
}
function S(f) {
const ie = "CDATA[";
return f === ie.charCodeAt(l++) ? (e.consume(f), l === ie.length ? w : S) : t(f);
}
function w(f) {
return f === null ? t(f) : f === 93 ? (e.consume(f), L) : z(f) ? (o = w, Y(f)) : (e.consume(f), w);
}
function L(f) {
return f === 93 ? (e.consume(f), k) : w(f);
}
function k(f) {
return f === 62 ? W(f) : f === 93 ? (e.consume(f), k) : w(f);
}
function v(f) {
return f === null || f === 62 ? W(f) : z(f) ? (o = v, Y(f)) : (e.consume(f), v);
}
function C(f) {
return f === null ? t(f) : f === 63 ? (e.consume(f), M) : z(f) ? (o = C, Y(f)) : (e.consume(f), C);
}
function M(f) {
return f === 62 ? W(f) : C(f);
}
function H(f) {
return ue(f) ? (e.consume(f), y) : t(f);
}
function y(f) {
return f === 45 || ee(f) ? (e.consume(f), y) : R(f);
}
function R(f) {
return z(f) ? (o = R, Y(f)) : j(f) ? (e.consume(f), R) : W(f);
}
function q(f) {
return f === 45 || ee(f) ? (e.consume(f), q) : f === 47 || f === 62 || ne(f) ? F(f) : t(f);
}
function F(f) {
return f === 47 ? (e.consume(f), W) : f === 58 || f === 95 || ue(f) ? (e.consume(f), N) : z(f) ? (o = F, Y(f)) : j(f) ? (e.consume(f), F) : W(f);
}
function N(f) {
return f === 45 || f === 46 || f === 58 || f === 95 || ee(f) ? (e.consume(f), N) : P(f);
}
function P(f) {
return f === 61 ? (e.consume(f), I) : z(f) ? (o = P, Y(f)) : j(f) ? (e.consume(f), P) : F(f);
}
function I(f) {
return f === null || f === 60 || f === 61 || f === 62 || f === 96 ? t(f) : f === 34 || f === 39 ? (e.consume(f), i = f, T) : z(f) ? (o = I, Y(f)) : j(f) ? (e.consume(f), I) : (e.consume(f), E);
}
function T(f) {
return f === i ? (e.consume(f), i = void 0, A) : f === null ? t(f) : z(f) ? (o = T, Y(f)) : (e.consume(f), T);
}
function E(f) {
return f === null || f === 34 || f === 39 || f === 60 || f === 61 || f === 96 ? t(f) : f === 47 || f === 62 || ne(f) ? F(f) : (e.consume(f), E);
}
function A(f) {
return f === 47 || f === 62 || ne(f) ? F(f) : t(f);
}
function W(f) {
return f === 62 ? (e.consume(f), e.exit("htmlTextData"), e.exit("htmlText"), n) : t(f);
}
function Y(f) {
return e.exit("htmlTextData"), e.enter("lineEnding"), e.consume(f), e.exit("lineEnding"), re;
}
function re(f) {
return j(f) ? V(e, se, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(f) : se(f);
}
function se(f) {
return e.enter("htmlTextData"), o(f);
}
}
const Cn = {
name: "labelEnd",
resolveAll: di,
resolveTo: gi,
tokenize: yi
}, hi = {
tokenize: xi
}, fi = {
tokenize: ki
}, mi = {
tokenize: bi
};
function di(e) {
let n = -1;
const t = [];
for (; ++n < e.length; ) {
const r = e[n][1];
if (t.push(e[n]), r.type === "labelImage" || r.type === "labelLink" || r.type === "labelEnd") {
const i = r.type === "labelImage" ? 4 : 2;
r.type = "data", n += i;
}
}
return e.length !== t.length && de(e, 0, e.length, t), e;
}
function gi(e, n) {
let t = e.length, r = 0, i, l, o, a;
for (; t--; )
if (i = e[t][1], l) {
if (i.type === "link" || i.type === "labelLink" && i._inactive)
break;
e[t][0] === "enter" && i.type === "labelLink" && (i._inactive = !0);
} else if (o) {
if (e[t][0] === "enter" && (i.type === "labelImage" || i.type === "labelLink") && !i._balanced && (l = t, i.type !== "labelLink")) {
r = 2;
break;
}
} else i.type === "labelEnd" && (o = t);
const c = {
type: e[l][1].type === "labelLink" ? "link" : "image",
start: {
...e[l][1].start
},
end: {
...e[e.length - 1][1].end
}
}, u = {
type: "label",
start: {
...e[l][1].start
},
end: {
...e[o][1].end
}
}, s = {
type: "labelText",
start: {
...e[l + r + 2][1].end
},
end: {
...e[o - 2][1].start
}
};
return a = [["enter", c, n], ["enter", u, n]], a = te(a, e.slice(l + 1, l + r + 3)), a = te(a, [["enter", s, n]]), a = te(a, Sn(n.parser.constructs.insideSpan.null, e.slice(l + r + 4, o - 3), n)), a = te(a, [["exit", s, n], e[o - 2], e[o - 1], ["exit", u, n]]), a = te(a, e.slice(o + 1)), a = te(a, [["exit", c, n]]), de(e, l, e.length, a), e;
}
function yi(e, n, t) {
const r = this;
let i = r.events.length, l, o;
for (; i--; )
if ((r.events[i][1].type === "labelImage" || r.events[i][1].type === "labelLink") && !r.events[i][1]._balanced) {
l = r.events[i][1];
break;
}
return a;
function a(d) {
return l ? l._inactive ? h(d) : (o = r.parser.defined.includes(Ee(r.sliceSerialize({
start: l.end,
end: r.now()
}))), e.enter("labelEnd"), e.enter("labelMarker"), e.consume(d), e.exit("labelMarker"), e.exit("labelEnd"), c) : t(d);
}
function c(d) {
return d === 40 ? e.attempt(hi, s, o ? s : h)(d) : d === 91 ? e.attempt(fi, s, o ? u : h)(d) : o ? s(d) : h(d);
}
function u(d) {
return e.attempt(mi, s, h)(d);
}
function s(d) {
return n(d);
}
function h(d) {
return l._balanced = !0, t(d);
}
}
function xi(e, n, t) {
return r;
function r(h) {
return e.enter("resource"), e.enter("resourceMarker"), e.consume(h), e.exit("resourceMarker"), i;
}
function i(h) {
return ne(h) ? Fe(e, l)(h) : l(h);
}
function l(h) {
return h === 41 ? s(h) : Tt(e, o, a, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(h);
}
function o(h) {
return ne(h) ? Fe(e, c)(h) : s(h);
}
function a(h) {
return t(h);
}
function c(h) {
return h === 34 || h === 39 || h === 40 ? vt(e, u, t, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(h) : s(h);
}
function u(h) {
return ne(h) ? Fe(e, s)(h) : s(h);
}
function s(h) {
return h === 41 ? (e.enter("resourceMarker"), e.consume(h), e.exit("resourceMarker"), e.exit("resource"), n) : t(h);
}
}
function ki(e, n, t) {
const r = this;
return i;
function i(a) {
return Pt.call(r, e, l, o, "reference", "referenceMarker", "referenceString")(a);
}
function l(a) {
return r.parser.defined.includes(Ee(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1))) ? n(a) : t(a);
}
function o(a) {
return t(a);
}
}
function bi(e, n, t) {
return r;
function r(l) {
return e.enter("reference"), e.enter("referenceMarker"), e.consume(l), e.exit("referenceMarker"), i;
}
function i(l) {
return l === 93 ? (e.enter("referenceMarker"), e.consume(l), e.exit("referenceMarker"), e.exit("reference"), n) : t(l);
}
}
const wi = {
name: "labelStartImage",
resolveAll: Cn.resolveAll,
tokenize: Si
};
function Si(e, n, t) {
const r = this;
return i;
function i(a) {
return e.enter("labelImage"), e.enter("labelImageMarker"), e.consume(a), e.exit("labelImageMarker"), l;
}
function l(a) {
return a === 91 ? (e.enter("labelMarker"), e.consume(a), e.exit("labelMarker"), e.exit("labelImage"), o) : t(a);
}
function o(a) {
return a === 94 && "_hiddenFootnoteSupport" in r.parser.constructs ? t(a) : n(a);
}
}
const Ci = {
name: "labelStartLink",
resolveAll: Cn.resolveAll,
tokenize: Ei
};
function Ei(e, n, t) {
const r = this;
return i;
function i(o) {
return e.enter("labelLink"), e.enter("labelMarker"), e.consume(o), e.exit("labelMarker"), e.exit("labelLink"), l;
}
function l(o) {
return o === 94 && "_hiddenFootnoteSupport" in r.parser.constructs ? t(o) : n(o);
}
}
const Ke = {
name: "lineEnding",
tokenize: Ii
};
function Ii(e, n) {
return t;
function t(r) {
return e.enter("lineEnding"), e.consume(r), e.exit("lineEnding"), V(e, n, "linePrefix");
}
}
const We = {
name: "thematicBreak",
tokenize: Ti
};
function Ti(e, n, t) {
let r = 0, i;
return l;
function l(u) {
return e.enter("thematicBreak"), o(u);
}
function o(u) {
return i = u, a(u);
}
function a(u) {
return u === i ? (e.enter("thematicBreakSequence"), c(u)) : r >= 3 && (u === null || z(u)) ? (e.exit("thematicBreak"), n(u)) : t(u);
}
function c(u) {
return u === i ? (e.consume(u), r++, c) : (e.exit("thematicBreakSequence"), j(u) ? V(e, a, "whitespace")(u) : a(u));
}
}
const G = {
continuation: {
tokenize: zi
},
exit: Di,
name: "list",
tokenize: Ai
}, Pi = {
partial: !0,
tokenize: Oi
}, vi = {
partial: !0,
tokenize: Li
};
function Ai(e, n, t) {
const r = this, i = r.events[r.events.length - 1];
let l = i && i[1].type === "linePrefix" ? i[2].sliceSerialize(i[1], !0).length : 0, o = 0;
return a;
function a(p) {
const S = r.containerState.type || (p === 42 || p === 43 || p === 45 ? "listUnordered" : "listOrdered");
if (S === "listUnordered" ? !r.containerState.marker || p === r.containerState.marker : hn(p)) {
if (r.containerState.type || (r.containerState.type = S, e.enter(S, {
_container: !0
})), S === "listUnordered")
return e.enter("listItemPrefix"), p === 42 || p === 45 ? e.check(We, t, u)(p) : u(p);
if (!r.interrupt || p === 49)
return e.enter("listItemPrefix"), e.enter("listItemValue"), c(p);
}
return t(p);
}
function c(p) {
return hn(p) && ++o < 10 ? (e.consume(p), c) : (!r.interrupt || o < 2) && (r.containerState.marker ? p === r.containerState.marker : p === 41 || p === 46) ? (e.exit("listItemValue"), u(p)) : t(p);
}
function u(p) {
return e.enter("listItemMarker"), e.consume(p), e.exit("listItemMarker"), r.containerState.marker = r.containerState.marker || p, e.check(
Qe,
// Can’t be empty when interrupting.
r.interrupt ? t : s,
e.attempt(Pi, d, h)
);
}
function s(p) {
return r.containerState.initialBlankLine = !0, l++, d(p);
}
function h(p) {
return j(p) ? (e.enter("listItemPrefixWhitespace"), e.consume(p), e.exit("listItemPrefixWhitespace"), d) : t(p);
}
function d(p) {
return r.containerState.size = l + r.sliceSerialize(e.exit("listItemPrefix"), !0).length, n(p);
}
}
function zi(e, n, t) {
const r = this;
return r.containerState._closeFlow = void 0, e.check(Qe, i, l);
function i(a) {
return r.containerState.furtherBlankLines = r.containerState.furtherBlankLines || r.containerState.initialBlankLine, V(e, n, "listItemIndent", r.containerState.size + 1)(a);
}
function l(a) {
return r.containerState.furtherBlankLines || !j(a) ? (r.containerState.furtherBlankLines = void 0, r.containerState.initialBlankLine = void 0, o(a)) : (r.containerState.furtherBlankLines = void 0, r.containerState.initialBlankLine = void 0, e.attempt(vi, n, o)(a));
}
function o(a) {
return r.containerState._closeFlow = !0, r.interrupt = void 0, V(e, e.attempt(G, n, t), "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(a);
}
}
function Li(e, n, t) {
const r = this;
return V(e, i, "listItemIndent", r.containerState.size + 1);
function i(l) {
const o = r.events[r.events.length - 1];
return o && o[1].type === "listItemIndent" && o[2].sliceSerialize(o[1], !0).length === r.containerState.size ? n(l) : t(l);
}
}
function Di(e) {
e.exit(this.containerState.type);
}
function Oi(e, n, t) {
const r = this;
return V(e, i, "listItemPrefixWhitespace", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5);
function i(l) {
const o = r.events[r.events.length - 1];
return !j(l) && o && o[1].type === "listItemPrefixWhitespace" ? n(l) : t(l);
}
}
const $n = {
name: "setextUnderline",
resolveTo: _i,
tokenize: Ri
};
function _i(e, n) {
let t = e.length, r, i, l;
for (; t--; )
if (e[t][0] === "enter") {
if (e[t][1].type === "content") {
r = t;
break;
}
e[t][1].type === "paragraph" && (i = t);
} else
e[t][1].type === "content" && e.splice(t, 1), !l && e[t][1].type === "definition" && (l = t);
const o = {
type: "setextHeading",
start: {
...e[r][1].start
},
end: {
...e[e.length - 1][1].end
}
};
return e[i][1].type = "setextHeadingText", l ? (e.splice(i, 0, ["enter", o, n]), e.splice(l + 1, 0, ["exit", e[r][1], n]), e[r][1].end = {
...e[l][1].end
}) : e[r][1] = o, e.push(["exit", o, n]), e;
}
function Ri(e, n, t) {
const r = this;
let i;
return l;
function l(u) {
let s = r.events.length, h;
for (; s--; )
if (r.events[s][1].type !== "lineEnding" && r.events[s][1].type !== "linePrefix" && r.events[s][1].type !== "content") {
h = r.events[s][1].type === "paragraph";
break;
}
return !r.parser.lazy[r.now().line] && (r.interrupt || h) ? (e.enter("setextHeadingLine"), i = u, o(u)) : t(u);
}
function o(u) {
return e.enter("setextHeadingLineSequence"), a(u);
}
function a(u) {
return u === i ? (e.consume(u), a) : (e.exit("setextHeadingLineSequence"), j(u) ? V(e, c, "lineSuffix")(u) : c(u));
}
function c(u) {
return u === null || z(u) ? (e.exit("setextHeadingLine"), n(u)) : t(u);
}
}
const Fi = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u, Ni = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u, Mi = {};
function Wn(e, n) {
return (Mi.jsx ? Ni : Fi).test(e);
}
const Bi = /[ \t\n\f\r]/g;
function ji(e) {
return typeof e == "object" ? e.type === "text" ? Yn(e.value) : !1 : Yn(e);
}
function Yn(e) {
return e.replace(Bi, "") === "";
}
class je {
/**
* @param {SchemaType['property']} property
* Property.
* @param {SchemaType['normal']} normal
* Normal.
* @param {Space | undefined} [space]
* Space.
* @returns
* Schema.
*/
constructor(n, t, r) {
this.normal = t, this.property = n, r && (this.space = r);
}
}
je.prototype.normal = {};
je.prototy