import { a as _, b as I, m as k, u as E, c as K, d as st, s as N, n as T, e as ht, f as F, g as P, r as gt, h as X, i as L, j as x, k as mt, l as ft } from "./index-BI5w0jSz.js";
const bt = {
  tokenize: Ct,
  partial: !0
}, v = {
  tokenize: yt,
  partial: !0
}, tt = {
  tokenize: Ft,
  partial: !0
}, et = {
  tokenize: At,
  partial: !0
}, pt = {
  tokenize: xt,
  partial: !0
}, nt = {
  name: "wwwAutolink",
  tokenize: ct,
  previous: rt
}, it = {
  name: "protocolAutolink",
  tokenize: wt,
  previous: lt
}, C = {
  name: "emailAutolink",
  tokenize: Dt,
  previous: at
}, c = {};
function kt() {
  return {
    text: c
  };
}
let A = 48;
for (; A < 123; )
  c[A] = C, A++, A === 58 ? A = 65 : A === 91 && (A = 97);
c[43] = C;
c[45] = C;
c[46] = C;
c[95] = C;
c[72] = [C, it];
c[104] = [C, it];
c[87] = [C, nt];
c[119] = [C, nt];
function Dt(t, i, e) {
  const r = this;
  let s, h;
  return n;
  function n(l) {
    return !B(l) || !at.call(r, r.previous) || W(r.events) ? e(l) : (t.enter("literalAutolink"), t.enter("literalAutolinkEmail"), u(l));
  }
  function u(l) {
    return B(l) ? (t.consume(l), u) : l === 64 ? (t.consume(l), o) : e(l);
  }
  function o(l) {
    return l === 46 ? t.check(pt, f, m)(l) : l === 45 || l === 95 || _(l) ? (h = !0, t.consume(l), o) : f(l);
  }
  function m(l) {
    return t.consume(l), s = !0, o;
  }
  function f(l) {
    return h && s && I(r.previous) ? (t.exit("literalAutolinkEmail"), t.exit("literalAutolink"), i(l)) : e(l);
  }
}
function ct(t, i, e) {
  const r = this;
  return s;
  function s(n) {
    return n !== 87 && n !== 119 || !rt.call(r, r.previous) || W(r.events) ? e(n) : (t.enter("literalAutolink"), t.enter("literalAutolinkWww"), t.check(bt, t.attempt(v, t.attempt(tt, h), e), e)(n));
  }
  function h(n) {
    return t.exit("literalAutolinkWww"), t.exit("literalAutolink"), i(n);
  }
}
function wt(t, i, e) {
  const r = this;
  let s = "", h = !1;
  return n;
  function n(l) {
    return (l === 72 || l === 104) && lt.call(r, r.previous) && !W(r.events) ? (t.enter("literalAutolink"), t.enter("literalAutolinkHttp"), s += String.fromCodePoint(l), t.consume(l), u) : e(l);
  }
  function u(l) {
    if (I(l) && s.length < 5)
      return s += String.fromCodePoint(l), t.consume(l), u;
    if (l === 58) {
      const b = s.toLowerCase();
      if (b === "http" || b === "https")
        return t.consume(l), o;
    }
    return e(l);
  }
  function o(l) {
    return l === 47 ? (t.consume(l), h ? m : (h = !0, o)) : e(l);
  }
  function m(l) {
    return l === null || st(l) || k(l) || E(l) || K(l) ? e(l) : t.attempt(v, t.attempt(tt, f), e)(l);
  }
  function f(l) {
    return t.exit("literalAutolinkHttp"), t.exit("literalAutolink"), i(l);
  }
}
function Ct(t, i, e) {
  let r = 0;
  return s;
  function s(n) {
    return (n === 87 || n === 119) && r < 3 ? (r++, t.consume(n), s) : n === 46 && r === 3 ? (t.consume(n), h) : e(n);
  }
  function h(n) {
    return n === null ? e(n) : i(n);
  }
}
function yt(t, i, e) {
  let r, s, h;
  return n;
  function n(m) {
    return m === 46 || m === 95 ? t.check(et, o, u)(m) : m === null || k(m) || E(m) || m !== 45 && K(m) ? o(m) : (h = !0, t.consume(m), n);
  }
  function u(m) {
    return m === 95 ? r = !0 : (s = r, r = void 0), t.consume(m), n;
  }
  function o(m) {
    return s || r || !h ? e(m) : i(m);
  }
}
function Ft(t, i) {
  let e = 0, r = 0;
  return s;
  function s(n) {
    return n === 40 ? (e++, t.consume(n), s) : n === 41 && r < e ? h(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? t.check(et, i, h)(n) : n === null || k(n) || E(n) ? i(n) : (t.consume(n), s);
  }
  function h(n) {
    return n === 41 && r++, t.consume(n), s;
  }
}
function At(t, i, e) {
  return r;
  function r(u) {
    return u === 33 || u === 34 || u === 39 || u === 41 || u === 42 || u === 44 || u === 46 || u === 58 || u === 59 || u === 63 || u === 95 || u === 126 ? (t.consume(u), r) : u === 38 ? (t.consume(u), h) : u === 93 ? (t.consume(u), s) : (
      // `<` is an end.
      u === 60 || // So is whitespace.
      u === null || k(u) || E(u) ? i(u) : e(u)
    );
  }
  function s(u) {
    return u === null || u === 40 || u === 91 || k(u) || E(u) ? i(u) : r(u);
  }
  function h(u) {
    return I(u) ? n(u) : e(u);
  }
  function n(u) {
    return u === 59 ? (t.consume(u), r) : I(u) ? (t.consume(u), n) : e(u);
  }
}
function xt(t, i, e) {
  return r;
  function r(h) {
    return t.consume(h), s;
  }
  function s(h) {
    return _(h) ? e(h) : i(h);
  }
}
function rt(t) {
  return t === null || t === 40 || t === 42 || t === 95 || t === 91 || t === 93 || t === 126 || k(t);
}
function lt(t) {
  return !I(t);
}
function at(t) {
  return !(t === 47 || B(t));
}
function B(t) {
  return t === 43 || t === 45 || t === 46 || t === 95 || _(t);
}
function W(t) {
  let i = t.length, e = !1;
  for (; i--; ) {
    const r = t[i][1];
    if ((r.type === "labelLink" || r.type === "labelImage") && !r._balanced) {
      e = !0;
      break;
    }
    if (r._gfmAutolinkLiteralWalkedInto) {
      e = !1;
      break;
    }
  }
  return t.length > 0 && !e && (t[t.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), e;
}
function St() {
  return {
    exit: {
      literalAutolinkEmail: zt,
      literalAutolinkHttp: Lt,
      literalAutolinkWww: dt
    }
  };
}
function dt(t) {
  q.call(this, t, "http://");
}
function zt(t) {
  q.call(this, t, "mailto:");
}
function Lt(t) {
  q.call(this, t);
}
function q(t, i) {
  const e = this.sliceSerialize(t);
  this.tag('<a href="' + N((i || "") + e) + '">'), this.raw(this.encode(e)), this.tag("</a>");
}
const It = {
  tokenize: Ht,
  partial: !0
};
function Et() {
  return {
    document: {
      91: {
        name: "gfmFootnoteDefinition",
        tokenize: Mt,
        continuation: {
          tokenize: jt
        },
        exit: Pt
      }
    },
    text: {
      91: {
        name: "gfmFootnoteCall",
        tokenize: Rt
      },
      93: {
        name: "gfmPotentialFootnoteCall",
        add: "after",
        tokenize: Tt,
        resolveTo: Ot
      }
    }
  };
}
function Tt(t, i, e) {
  const r = this;
  let s = r.events.length;
  const h = r.parser.gfmFootnotes || (r.parser.gfmFootnotes = []);
  let n;
  for (; s--; ) {
    const o = r.events[s][1];
    if (o.type === "labelImage") {
      n = o;
      break;
    }
    if (o.type === "gfmFootnoteCall" || o.type === "labelLink" || o.type === "label" || o.type === "image" || o.type === "link")
      break;
  }
  return u;
  function u(o) {
    if (!n || !n._balanced)
      return e(o);
    const m = T(r.sliceSerialize({
      start: n.end,
      end: r.now()
    }));
    return m.codePointAt(0) !== 94 || !h.includes(m.slice(1)) ? e(o) : (t.enter("gfmFootnoteCallLabelMarker"), t.consume(o), t.exit("gfmFootnoteCallLabelMarker"), i(o));
  }
}
function Ot(t, i) {
  let e = t.length;
  for (; e--; )
    if (t[e][1].type === "labelImage" && t[e][0] === "enter") {
      t[e][1];
      break;
    }
  t[e + 1][1].type = "data", t[e + 3][1].type = "gfmFootnoteCallLabelMarker";
  const r = {
    type: "gfmFootnoteCall",
    start: Object.assign({}, t[e + 3][1].start),
    end: Object.assign({}, t[t.length - 1][1].end)
  }, s = {
    type: "gfmFootnoteCallMarker",
    start: Object.assign({}, t[e + 3][1].end),
    end: Object.assign({}, t[e + 3][1].end)
  };
  s.end.column++, s.end.offset++, s.end._bufferIndex++;
  const h = {
    type: "gfmFootnoteCallString",
    start: Object.assign({}, s.end),
    end: Object.assign({}, t[t.length - 1][1].start)
  }, n = {
    type: "chunkString",
    contentType: "string",
    start: Object.assign({}, h.start),
    end: Object.assign({}, h.end)
  }, u = [
    // Take the `labelImageMarker` (now `data`, the `!`)
    t[e + 1],
    t[e + 2],
    ["enter", r, i],
    // The `[`
    t[e + 3],
    t[e + 4],
    // The `^`.
    ["enter", s, i],
    ["exit", s, i],
    // Everything in between.
    ["enter", h, i],
    ["enter", n, i],
    ["exit", n, i],
    ["exit", h, i],
    // The ending (`]`, properly parsed and labelled).
    t[t.length - 2],
    t[t.length - 1],
    ["exit", r, i]
  ];
  return t.splice(e, t.length - e + 1, ...u), t;
}
function Rt(t, i, e) {
  const r = this, s = r.parser.gfmFootnotes || (r.parser.gfmFootnotes = []);
  let h = 0, n;
  return u;
  function u(l) {
    return t.enter("gfmFootnoteCall"), t.enter("gfmFootnoteCallLabelMarker"), t.consume(l), t.exit("gfmFootnoteCallLabelMarker"), o;
  }
  function o(l) {
    return l !== 94 ? e(l) : (t.enter("gfmFootnoteCallMarker"), t.consume(l), t.exit("gfmFootnoteCallMarker"), t.enter("gfmFootnoteCallString"), t.enter("chunkString").contentType = "string", m);
  }
  function m(l) {
    if (
      // Too long.
      h > 999 || // Closing brace with nothing.
      l === 93 && !n || // Space or tab is not supported by GFM for some reason.
      // `\n` and `[` not being supported makes sense.
      l === null || l === 91 || k(l)
    )
      return e(l);
    if (l === 93) {
      t.exit("chunkString");
      const b = t.exit("gfmFootnoteCallString");
      return s.includes(T(r.sliceSerialize(b))) ? (t.enter("gfmFootnoteCallLabelMarker"), t.consume(l), t.exit("gfmFootnoteCallLabelMarker"), t.exit("gfmFootnoteCall"), i) : e(l);
    }
    return k(l) || (n = !0), h++, t.consume(l), l === 92 ? f : m;
  }
  function f(l) {
    return l === 91 || l === 92 || l === 93 ? (t.consume(l), h++, m) : m(l);
  }
}
function Mt(t, i, e) {
  const r = this, s = r.parser.gfmFootnotes || (r.parser.gfmFootnotes = []);
  let h, n = 0, u;
  return o;
  function o(g) {
    return t.enter("gfmFootnoteDefinition")._container = !0, t.enter("gfmFootnoteDefinitionLabel"), t.enter("gfmFootnoteDefinitionLabelMarker"), t.consume(g), t.exit("gfmFootnoteDefinitionLabelMarker"), m;
  }
  function m(g) {
    return g === 94 ? (t.enter("gfmFootnoteDefinitionMarker"), t.consume(g), t.exit("gfmFootnoteDefinitionMarker"), t.enter("gfmFootnoteDefinitionLabelString"), t.enter("chunkString").contentType = "string", f) : e(g);
  }
  function f(g) {
    if (
      // Too long.
      n > 999 || // Closing brace with nothing.
      g === 93 && !u || // Space or tab is not supported by GFM for some reason.
      // `\n` and `[` not being supported makes sense.
      g === null || g === 91 || k(g)
    )
      return e(g);
    if (g === 93) {
      t.exit("chunkString");
      const D = t.exit("gfmFootnoteDefinitionLabelString");
      return h = T(r.sliceSerialize(D)), t.enter("gfmFootnoteDefinitionLabelMarker"), t.consume(g), t.exit("gfmFootnoteDefinitionLabelMarker"), t.exit("gfmFootnoteDefinitionLabel"), b;
    }
    return k(g) || (u = !0), n++, t.consume(g), g === 92 ? l : f;
  }
  function l(g) {
    return g === 91 || g === 92 || g === 93 ? (t.consume(g), n++, f) : f(g);
  }
  function b(g) {
    return g === 58 ? (t.enter("definitionMarker"), t.consume(g), t.exit("definitionMarker"), s.includes(h) || s.push(h), F(t, p, "gfmFootnoteDefinitionWhitespace")) : e(g);
  }
  function p(g) {
    return i(g);
  }
}
function jt(t, i, e) {
  return t.check(ht, i, t.attempt(It, i, e));
}
function Pt(t) {
  t.exit("gfmFootnoteDefinition");
}
function Ht(t, i, e) {
  const r = this;
  return F(t, s, "gfmFootnoteDefinitionIndent", 5);
  function s(h) {
    const n = r.events[r.events.length - 1];
    return n && n[1].type === "gfmFootnoteDefinitionIndent" && n[2].sliceSerialize(n[1], !0).length === 4 ? i(h) : e(h);
  }
}
const Nt = {}.hasOwnProperty, Bt = {};
function _t(t, i) {
  return "Back to reference " + (t + 1) + (i > 1 ? "-" + i : "");
}
function Wt(t) {
  const i = t || Bt, e = i.label || "Footnotes", r = i.labelTagName || "h2", s = i.labelAttributes === null || i.labelAttributes === void 0 ? 'class="sr-only"' : i.labelAttributes, h = i.backLabel || _t, n = i.clobberPrefix === null || i.clobberPrefix === void 0 ? "user-content-" : i.clobberPrefix;
  return {
    enter: {
      gfmFootnoteDefinition() {
        this.getData("tightStack").push(!1);
      },
      gfmFootnoteDefinitionLabelString() {
        this.buffer();
      },
      gfmFootnoteCallString() {
        this.buffer();
      }
    },
    exit: {
      gfmFootnoteDefinition() {
        let u = this.getData("gfmFootnoteDefinitions");
        const o = this.getData("gfmFootnoteDefinitionStack"), m = this.getData("tightStack"), f = o.pop(), l = this.resume();
        u || this.setData("gfmFootnoteDefinitions", u = {}), Nt.call(u, f) || (u[f] = l), m.pop(), this.setData("slurpOneLineEnding", !0), this.setData("lastWasTag");
      },
      gfmFootnoteDefinitionLabelString(u) {
        let o = this.getData("gfmFootnoteDefinitionStack");
        o || this.setData("gfmFootnoteDefinitionStack", o = []), o.push(T(this.sliceSerialize(u))), this.resume(), this.buffer();
      },
      gfmFootnoteCallString(u) {
        let o = this.getData("gfmFootnoteCallOrder"), m = this.getData("gfmFootnoteCallCounts");
        const f = T(this.sliceSerialize(u));
        let l;
        this.resume(), o || this.setData("gfmFootnoteCallOrder", o = []), m || this.setData("gfmFootnoteCallCounts", m = {});
        const b = o.indexOf(f), p = N(f.toLowerCase());
        b === -1 ? (o.push(f), m[f] = 1, l = o.length) : (m[f]++, l = b + 1);
        const g = m[f];
        this.tag('<sup><a href="#' + n + "fn-" + p + '" id="' + n + "fnref-" + p + (g > 1 ? "-" + g : "") + '" data-footnote-ref="" aria-describedby="footnote-label">' + String(l) + "</a></sup>");
      },
      null() {
        const u = this.getData("gfmFootnoteCallOrder") || [], o = this.getData("gfmFootnoteCallCounts") || {}, m = this.getData("gfmFootnoteDefinitions") || {};
        let f = -1;
        for (u.length > 0 && (this.lineEndingIfNeeded(), this.tag('<section data-footnotes="" class="footnotes"><' + r + ' id="footnote-label"' + (s ? " " + s : "") + ">"), this.raw(this.encode(e)), this.tag("</" + r + ">"), this.lineEndingIfNeeded(), this.tag("<ol>")); ++f < u.length; ) {
          const l = u[f], b = N(l.toLowerCase());
          let p = 0;
          const g = [];
          for (; ++p <= o[l]; )
            g.push('<a href="#' + n + "fnref-" + b + (p > 1 ? "-" + p : "") + '" data-footnote-backref="" aria-label="' + this.encode(typeof h == "string" ? h : h(f, p)) + '" class="data-footnote-backref">↩' + (p > 1 ? "<sup>" + p + "</sup>" : "") + "</a>");
          const D = g.join(" ");
          let w = !1;
          this.lineEndingIfNeeded(), this.tag('<li id="' + n + "fn-" + b + '">'), this.lineEndingIfNeeded(), this.tag(m[l].replace(/<\/p>(?:\r?\n|\r)?$/, function(y) {
            return w = !0, " " + D + y;
          })), w || (this.lineEndingIfNeeded(), this.tag(D)), this.lineEndingIfNeeded(), this.tag("</li>");
        }
        u.length > 0 && (this.lineEndingIfNeeded(), this.tag("</ol>"), this.lineEndingIfNeeded(), this.tag("</section>"));
      }
    }
  };
}
function qt() {
  return {
    enter: {
      strikethrough() {
        this.tag("<del>");
      }
    },
    exit: {
      strikethrough() {
        this.tag("</del>");
      }
    }
  };
}
function Vt(t) {
  let e = (t || {}).singleTilde;
  const r = {
    name: "strikethrough",
    tokenize: h,
    resolveAll: s
  };
  return e == null && (e = !0), {
    text: {
      126: r
    },
    insideSpan: {
      null: [r]
    },
    attentionMarkers: {
      null: [126]
    }
  };
  function s(n, u) {
    let o = -1;
    for (; ++o < n.length; )
      if (n[o][0] === "enter" && n[o][1].type === "strikethroughSequenceTemporary" && n[o][1]._close) {
        let m = o;
        for (; m--; )
          if (n[m][0] === "exit" && n[m][1].type === "strikethroughSequenceTemporary" && n[m][1]._open && // If the sizes are the same:
          n[o][1].end.offset - n[o][1].start.offset === n[m][1].end.offset - n[m][1].start.offset) {
            n[o][1].type = "strikethroughSequence", n[m][1].type = "strikethroughSequence";
            const f = {
              type: "strikethrough",
              start: Object.assign({}, n[m][1].start),
              end: Object.assign({}, n[o][1].end)
            }, l = {
              type: "strikethroughText",
              start: Object.assign({}, n[m][1].end),
              end: Object.assign({}, n[o][1].start)
            }, b = [["enter", f, u], ["enter", n[m][1], u], ["exit", n[m][1], u], ["enter", l, u]], p = u.parser.constructs.insideSpan.null;
            p && P(b, b.length, 0, gt(p, n.slice(m + 1, o), u)), P(b, b.length, 0, [["exit", l, u], ["enter", n[o][1], u], ["exit", n[o][1], u], ["exit", f, u]]), P(n, m - 1, o - m + 3, b), o = m + b.length - 2;
            break;
          }
      }
    for (o = -1; ++o < n.length; )
      n[o][1].type === "strikethroughSequenceTemporary" && (n[o][1].type = "data");
    return n;
  }
  function h(n, u, o) {
    const m = this.previous, f = this.events;
    let l = 0;
    return b;
    function b(g) {
      return m === 126 && f[f.length - 1][1].type !== "characterEscape" ? o(g) : (n.enter("strikethroughSequenceTemporary"), p(g));
    }
    function p(g) {
      const D = X(m);
      if (g === 126)
        return l > 1 ? o(g) : (n.consume(g), l++, p);
      if (l < 2 && !e) return o(g);
      const w = n.exit("strikethroughSequenceTemporary"), y = X(g);
      return w._open = !y || y === 2 && !!D, w._close = !D || D === 2 && !!y, u(g);
    }
  }
}
const H = {
  none: "",
  left: ' align="left"',
  right: ' align="right"',
  center: ' align="center"'
};
function Ut() {
  return {
    enter: {
      table(t) {
        const i = t._align;
        this.lineEndingIfNeeded(), this.tag("<table>"), this.setData("tableAlign", i);
      },
      tableBody() {
        this.tag("<tbody>");
      },
      tableData() {
        const t = this.getData("tableAlign"), i = this.getData("tableColumn"), e = H[t[i]];
        e === void 0 ? this.buffer() : (this.lineEndingIfNeeded(), this.tag("<td" + e + ">"));
      },
      tableHead() {
        this.lineEndingIfNeeded(), this.tag("<thead>");
      },
      tableHeader() {
        const t = this.getData("tableAlign"), i = this.getData("tableColumn"), e = H[t[i]];
        this.lineEndingIfNeeded(), this.tag("<th" + e + ">");
      },
      tableRow() {
        this.setData("tableColumn", 0), this.lineEndingIfNeeded(), this.tag("<tr>");
      }
    },
    exit: {
      // Overwrite the default code text data handler to unescape escaped pipes when
      // they are in tables.
      codeTextData(t) {
        let i = this.sliceSerialize(t);
        this.getData("tableAlign") && (i = i.replace(/\\([\\|])/g, Gt)), this.raw(this.encode(i));
      },
      table() {
        this.setData("tableAlign"), this.setData("slurpAllLineEndings"), this.lineEndingIfNeeded(), this.tag("</table>");
      },
      tableBody() {
        this.lineEndingIfNeeded(), this.tag("</tbody>");
      },
      tableData() {
        const t = this.getData("tableAlign"), i = this.getData("tableColumn");
        i in t ? (this.tag("</td>"), this.setData("tableColumn", i + 1)) : this.resume();
      },
      tableHead() {
        this.lineEndingIfNeeded(), this.tag("</thead>");
      },
      tableHeader() {
        const t = this.getData("tableColumn");
        this.tag("</th>"), this.setData("tableColumn", t + 1);
      },
      tableRow() {
        const t = this.getData("tableAlign");
        let i = this.getData("tableColumn");
        for (; i < t.length; )
          this.lineEndingIfNeeded(), this.tag("<td" + H[t[i]] + "></td>"), i++;
        this.setData("tableColumn", i), this.lineEndingIfNeeded(), this.tag("</tr>");
      }
    }
  };
}
function Gt(t, i) {
  return i === "|" ? i : t;
}
class $t {
  /**
   * 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(i, e, r) {
    Jt(this, i, e, r);
  }
  // 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(i) {
    if (this.map.sort(function(h, n) {
      return h[0] - n[0];
    }), this.map.length === 0)
      return;
    let e = this.map.length;
    const r = [];
    for (; e > 0; )
      e -= 1, r.push(i.slice(this.map[e][0] + this.map[e][1]), this.map[e][2]), i.length = this.map[e][0];
    r.push(i.slice()), i.length = 0;
    let s = r.pop();
    for (; s; ) {
      for (const h of s)
        i.push(h);
      s = r.pop();
    }
    this.map.length = 0;
  }
}
function Jt(t, i, e, r) {
  let s = 0;
  if (!(e === 0 && r.length === 0)) {
    for (; s < t.map.length; ) {
      if (t.map[s][0] === i) {
        t.map[s][1] += e, t.map[s][2].push(...r);
        return;
      }
      s += 1;
    }
    t.map.push([i, e, r]);
  }
}
function Qt(t, i) {
  let e = !1;
  const r = [];
  for (; i < t.length; ) {
    const s = t[i];
    if (e) {
      if (s[0] === "enter")
        s[1].type === "tableContent" && r.push(t[i + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
      else if (s[1].type === "tableContent") {
        if (t[i - 1][1].type === "tableDelimiterMarker") {
          const h = r.length - 1;
          r[h] = r[h] === "left" ? "center" : "right";
        }
      } else if (s[1].type === "tableDelimiterRow")
        break;
    } else s[0] === "enter" && s[1].type === "tableDelimiterRow" && (e = !0);
    i += 1;
  }
  return r;
}
function Xt() {
  return {
    flow: {
      null: {
        name: "table",
        tokenize: Yt,
        resolveAll: Zt
      }
    }
  };
}
function Yt(t, i, e) {
  const r = this;
  let s = 0, h = 0, n;
  return u;
  function u(a) {
    let z = r.events.length - 1;
    for (; z > -1; ) {
      const Q = r.events[z][1].type;
      if (Q === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
      Q === "linePrefix") z--;
      else break;
    }
    const $ = z > -1 ? r.events[z][1].type : null, J = $ === "tableHead" || $ === "tableRow" ? G : o;
    return J === G && r.parser.lazy[r.now().line] ? e(a) : J(a);
  }
  function o(a) {
    return t.enter("tableHead"), t.enter("tableRow"), m(a);
  }
  function m(a) {
    return a === 124 || (n = !0, h += 1), f(a);
  }
  function f(a) {
    return a === null ? e(a) : L(a) ? h > 1 ? (h = 0, r.interrupt = !0, t.exit("tableRow"), t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), p) : e(a) : x(a) ? F(t, f, "whitespace")(a) : (h += 1, n && (n = !1, s += 1), a === 124 ? (t.enter("tableCellDivider"), t.consume(a), t.exit("tableCellDivider"), n = !0, f) : (t.enter("data"), l(a)));
  }
  function l(a) {
    return a === null || a === 124 || k(a) ? (t.exit("data"), f(a)) : (t.consume(a), a === 92 ? b : l);
  }
  function b(a) {
    return a === 92 || a === 124 ? (t.consume(a), l) : l(a);
  }
  function p(a) {
    return r.interrupt = !1, r.parser.lazy[r.now().line] ? e(a) : (t.enter("tableDelimiterRow"), n = !1, x(a) ? F(t, g, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(a) : g(a));
  }
  function g(a) {
    return a === 45 || a === 58 ? w(a) : a === 124 ? (n = !0, t.enter("tableCellDivider"), t.consume(a), t.exit("tableCellDivider"), D) : d(a);
  }
  function D(a) {
    return x(a) ? F(t, w, "whitespace")(a) : w(a);
  }
  function w(a) {
    return a === 58 ? (h += 1, n = !0, t.enter("tableDelimiterMarker"), t.consume(a), t.exit("tableDelimiterMarker"), y) : a === 45 ? (h += 1, y(a)) : a === null || L(a) ? j(a) : d(a);
  }
  function y(a) {
    return a === 45 ? (t.enter("tableDelimiterFiller"), V(a)) : d(a);
  }
  function V(a) {
    return a === 45 ? (t.consume(a), V) : a === 58 ? (n = !0, t.exit("tableDelimiterFiller"), t.enter("tableDelimiterMarker"), t.consume(a), t.exit("tableDelimiterMarker"), U) : (t.exit("tableDelimiterFiller"), U(a));
  }
  function U(a) {
    return x(a) ? F(t, j, "whitespace")(a) : j(a);
  }
  function j(a) {
    return a === 124 ? g(a) : a === null || L(a) ? !n || s !== h ? d(a) : (t.exit("tableDelimiterRow"), t.exit("tableHead"), i(a)) : d(a);
  }
  function d(a) {
    return e(a);
  }
  function G(a) {
    return t.enter("tableRow"), O(a);
  }
  function O(a) {
    return a === 124 ? (t.enter("tableCellDivider"), t.consume(a), t.exit("tableCellDivider"), O) : a === null || L(a) ? (t.exit("tableRow"), i(a)) : x(a) ? F(t, O, "whitespace")(a) : (t.enter("data"), R(a));
  }
  function R(a) {
    return a === null || a === 124 || k(a) ? (t.exit("data"), O(a)) : (t.consume(a), a === 92 ? ot : R);
  }
  function ot(a) {
    return a === 92 || a === 124 ? (t.consume(a), R) : R(a);
  }
}
function Zt(t, i) {
  let e = -1, r = !0, s = 0, h = [0, 0, 0, 0], n = [0, 0, 0, 0], u = !1, o = 0, m, f, l;
  const b = new $t();
  for (; ++e < t.length; ) {
    const p = t[e], g = p[1];
    p[0] === "enter" ? g.type === "tableHead" ? (u = !1, o !== 0 && (Y(b, i, o, m, f), f = void 0, o = 0), m = {
      type: "table",
      start: Object.assign({}, g.start),
      // Note: correct end is set later.
      end: Object.assign({}, g.end)
    }, b.add(e, 0, [["enter", m, i]])) : g.type === "tableRow" || g.type === "tableDelimiterRow" ? (r = !0, l = void 0, h = [0, 0, 0, 0], n = [0, e + 1, 0, 0], u && (u = !1, f = {
      type: "tableBody",
      start: Object.assign({}, g.start),
      // Note: correct end is set later.
      end: Object.assign({}, g.end)
    }, b.add(e, 0, [["enter", f, i]])), s = g.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : s && (g.type === "data" || g.type === "tableDelimiterMarker" || g.type === "tableDelimiterFiller") ? (r = !1, n[2] === 0 && (h[1] !== 0 && (n[0] = n[1], l = M(b, i, h, s, void 0, l), h = [0, 0, 0, 0]), n[2] = e)) : g.type === "tableCellDivider" && (r ? r = !1 : (h[1] !== 0 && (n[0] = n[1], l = M(b, i, h, s, void 0, l)), h = n, n = [h[1], e, 0, 0])) : g.type === "tableHead" ? (u = !0, o = e) : g.type === "tableRow" || g.type === "tableDelimiterRow" ? (o = e, h[1] !== 0 ? (n[0] = n[1], l = M(b, i, h, s, e, l)) : n[1] !== 0 && (l = M(b, i, n, s, e, l)), s = 0) : s && (g.type === "data" || g.type === "tableDelimiterMarker" || g.type === "tableDelimiterFiller") && (n[3] = e);
  }
  for (o !== 0 && Y(b, i, o, m, f), b.consume(i.events), e = -1; ++e < i.events.length; ) {
    const p = i.events[e];
    p[0] === "enter" && p[1].type === "table" && (p[1]._align = Qt(i.events, e));
  }
  return t;
}
function M(t, i, e, r, s, h) {
  const n = r === 1 ? "tableHeader" : r === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
  e[0] !== 0 && (h.end = Object.assign({}, S(i.events, e[0])), t.add(e[0], 0, [["exit", h, i]]));
  const o = S(i.events, e[1]);
  if (h = {
    type: n,
    start: Object.assign({}, o),
    // Note: correct end is set later.
    end: Object.assign({}, o)
  }, t.add(e[1], 0, [["enter", h, i]]), e[2] !== 0) {
    const m = S(i.events, e[2]), f = S(i.events, e[3]), l = {
      type: u,
      start: Object.assign({}, m),
      end: Object.assign({}, f)
    };
    if (t.add(e[2], 0, [["enter", l, i]]), r !== 2) {
      const b = i.events[e[2]], p = i.events[e[3]];
      if (b[1].end = Object.assign({}, p[1].end), b[1].type = "chunkText", b[1].contentType = "text", e[3] > e[2] + 1) {
        const g = e[2] + 1, D = e[3] - e[2] - 1;
        t.add(g, D, []);
      }
    }
    t.add(e[3] + 1, 0, [["exit", l, i]]);
  }
  return s !== void 0 && (h.end = Object.assign({}, S(i.events, s)), t.add(s, 0, [["exit", h, i]]), h = void 0), h;
}
function Y(t, i, e, r, s) {
  const h = [], n = S(i.events, e);
  s && (s.end = Object.assign({}, n), h.push(["exit", s, i])), r.end = Object.assign({}, n), h.push(["exit", r, i]), t.add(e + 1, 0, h);
}
function S(t, i) {
  const e = t[i], r = e[0] === "enter" ? "start" : "end";
  return e[1][r];
}
const ut = /<(\/?)(iframe|noembed|noframes|plaintext|script|style|title|textarea|xmp)(?=[\t\n\f\r />])/gi, Kt = new RegExp("^" + ut.source, "i");
function vt() {
  return {
    exit: {
      htmlFlowData(t) {
        Z.call(this, t, ut);
      },
      htmlTextData(t) {
        Z.call(this, t, Kt);
      }
    }
  };
}
function Z(t, i) {
  let e = this.sliceSerialize(t);
  this.options.allowDangerousHtml && (e = e.replace(i, "&lt;$1$2")), this.raw(this.encode(e));
}
function te() {
  return {
    enter: {
      taskListCheck() {
        this.tag('<input type="checkbox" disabled="" ');
      }
    },
    exit: {
      taskListCheck() {
        this.tag("/>");
      },
      taskListCheckValueChecked() {
        this.tag('checked="" ');
      }
    }
  };
}
const ee = {
  name: "tasklistCheck",
  tokenize: ie
};
function ne() {
  return {
    text: {
      91: ee
    }
  };
}
function ie(t, i, e) {
  const r = this;
  return s;
  function s(o) {
    return (
      // Exit if there’s stuff before.
      r.previous !== null || // Exit if not in the first content that is the first child of a list
      // item.
      !r._gfmTasklistFirstContentOfListItem ? e(o) : (t.enter("taskListCheck"), t.enter("taskListCheckMarker"), t.consume(o), t.exit("taskListCheckMarker"), h)
    );
  }
  function h(o) {
    return k(o) ? (t.enter("taskListCheckValueUnchecked"), t.consume(o), t.exit("taskListCheckValueUnchecked"), n) : o === 88 || o === 120 ? (t.enter("taskListCheckValueChecked"), t.consume(o), t.exit("taskListCheckValueChecked"), n) : e(o);
  }
  function n(o) {
    return o === 93 ? (t.enter("taskListCheckMarker"), t.consume(o), t.exit("taskListCheckMarker"), t.exit("taskListCheck"), u) : e(o);
  }
  function u(o) {
    return L(o) ? i(o) : x(o) ? t.check({
      tokenize: re
    }, i, e)(o) : e(o);
  }
}
function re(t, i, e) {
  return F(t, r, "whitespace");
  function r(s) {
    return s === null ? e(s) : i(s);
  }
}
function ae(t) {
  return mt([
    kt(),
    Et(),
    Vt(t),
    Xt(),
    ne()
  ]);
}
function ue(t) {
  return ft([
    St(),
    Wt(t),
    qt(),
    Ut(),
    vt(),
    te()
  ]);
}
export {
  ae as gfm,
  ue as gfmHtml
};
