"use client";
import { ShikiError as T } from "../../types/dist/index.js";
import { FontStyle as w, INITIAL as V, EncodedTokenMetadata as te, Registry as Se, Theme as Te } from "../../vscode-textmate/dist/index.js";
import { toHtml as we } from "../../../hast-util-to-html/lib/index.js";
function j(n, e) {
  const t = typeof n == "string" ? {} : { ...n.colorReplacements }, s = typeof n == "string" ? n : n.name;
  for (const [r, o] of Object.entries(e?.colorReplacements || {}))
    typeof o == "string" ? t[r] = o : r === s && Object.assign(t, o);
  return t;
}
function L(n, e) {
  return n && (e?.[n?.toLowerCase()] || n);
}
function ke(n) {
  return Array.isArray(n) ? n : [n];
}
async function ce(n) {
  return Promise.resolve(typeof n == "function" ? n() : n).then((e) => e.default || e);
}
function K(n) {
  return !n || ["plaintext", "txt", "text", "plain"].includes(n);
}
function le(n) {
  return n === "ansi" || K(n);
}
function U(n) {
  return n === "none";
}
function fe(n) {
  return U(n);
}
function ue(n, e) {
  if (!e)
    return n;
  n.properties ||= {}, n.properties.class ||= [], typeof n.properties.class == "string" && (n.properties.class = n.properties.class.split(/\s+/g)), Array.isArray(n.properties.class) || (n.properties.class = []);
  const t = Array.isArray(e) ? e : e.split(/\s+/g);
  for (const s of t)
    s && !n.properties.class.includes(s) && n.properties.class.push(s);
  return n;
}
function W(n, e = !1) {
  const t = n.split(/(\r?\n)/g);
  let s = 0;
  const r = [];
  for (let o = 0; o < t.length; o += 2) {
    const i = e ? t[o] + (t[o + 1] || "") : t[o];
    r.push([i, s]), s += t[o].length, s += t[o + 1]?.length || 0;
  }
  return r;
}
function _e(n) {
  const e = W(n, !0).map(([r]) => r);
  function t(r) {
    if (r === n.length)
      return {
        line: e.length - 1,
        character: e[e.length - 1].length
      };
    let o = r, i = 0;
    for (const a of e) {
      if (o < a.length)
        break;
      o -= a.length, i++;
    }
    return { line: i, character: o };
  }
  function s(r, o) {
    let i = 0;
    for (let a = 0; a < r; a++)
      i += e[a].length;
    return i += o, i;
  }
  return {
    lines: e,
    indexToPos: t,
    posToIndex: s
  };
}
function ut(n, e, t) {
  const s = /* @__PURE__ */ new Set();
  for (const o of n.matchAll(/lang=["']([\w-]+)["']/g))
    s.add(o[1]);
  for (const o of n.matchAll(/(?:```|~~~)([\w-]+)/g))
    s.add(o[1]);
  for (const o of n.matchAll(/\\begin\{([\w-]+)\}/g))
    s.add(o[1]);
  if (!t)
    return Array.from(s);
  const r = t.getBundledLanguages();
  return Array.from(s).filter((o) => o && r[o]);
}
const Y = "light-dark()", Le = ["color", "background-color"];
function ve(n, e) {
  let t = 0;
  const s = [];
  for (const r of e)
    r > t && s.push({
      ...n,
      content: n.content.slice(t, r),
      offset: n.offset + t
    }), t = r;
  return t < n.content.length && s.push({
    ...n,
    content: n.content.slice(t),
    offset: n.offset + t
  }), s;
}
function xe(n, e) {
  const t = Array.from(e instanceof Set ? e : new Set(e)).sort((s, r) => s - r);
  return t.length ? n.map((s) => s.flatMap((r) => {
    const o = t.filter((i) => r.offset < i && i < r.offset + r.content.length).map((i) => i - r.offset).sort((i, a) => i - a);
    return o.length ? ve(r, o) : r;
  })) : n;
}
function Ce(n, e, t, s, r = "css-vars") {
  const o = {
    content: n.content,
    explanation: n.explanation,
    offset: n.offset
  }, i = e.map((l) => M(n.variants[l])), a = new Set(i.flatMap((l) => Object.keys(l))), c = {}, f = (l, u) => {
    const h = u === "color" ? "" : u === "background-color" ? "-bg" : `-${u}`;
    return t + e[l] + (u === "color" ? "" : h);
  };
  return i.forEach((l, u) => {
    for (const h of a) {
      const p = l[h] || "inherit";
      if (u === 0 && s && Le.includes(h))
        if (s === Y && i.length > 1) {
          const d = e.findIndex((g) => g === "light"), S = e.findIndex((g) => g === "dark");
          if (d === -1 || S === -1)
            throw new T('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
          const y = i[d][h] || "inherit", m = i[S][h] || "inherit";
          c[h] = `light-dark(${y}, ${m})`, r === "css-vars" && (c[f(u, h)] = p);
        } else
          c[h] = p;
      else
        r === "css-vars" && (c[f(u, h)] = p);
    }
  }), o.htmlStyle = c, o;
}
function M(n) {
  const e = {};
  if (n.color && (e.color = n.color), n.bgColor && (e["background-color"] = n.bgColor), n.fontStyle) {
    n.fontStyle & w.Italic && (e["font-style"] = "italic"), n.fontStyle & w.Bold && (e["font-weight"] = "bold");
    const t = [];
    n.fontStyle & w.Underline && t.push("underline"), n.fontStyle & w.Strikethrough && t.push("line-through"), t.length && (e["text-decoration"] = t.join(" "));
  }
  return e;
}
function J(n) {
  return typeof n == "string" ? n : Object.entries(n).map(([e, t]) => `${e}:${t}`).join(";");
}
const he = /* @__PURE__ */ new WeakMap();
function H(n, e) {
  he.set(n, e);
}
function E(n) {
  return he.get(n);
}
class N {
  /**
   * Theme to Stack mapping
   */
  _stacks = {};
  lang;
  get themes() {
    return Object.keys(this._stacks);
  }
  get theme() {
    return this.themes[0];
  }
  get _stack() {
    return this._stacks[this.theme];
  }
  /**
   * Static method to create a initial grammar state.
   */
  static initial(e, t) {
    return new N(
      Object.fromEntries(ke(t).map((s) => [s, V])),
      e
    );
  }
  constructor(...e) {
    if (e.length === 2) {
      const [t, s] = e;
      this.lang = s, this._stacks = t;
    } else {
      const [t, s, r] = e;
      this.lang = s, this._stacks = { [r]: t };
    }
  }
  /**
   * Get the internal stack object.
   * @internal
   */
  getInternalStack(e = this.theme) {
    return this._stacks[e];
  }
  getScopes(e = this.theme) {
    return $e(this._stacks[e]);
  }
  toJSON() {
    return {
      lang: this.lang,
      theme: this.theme,
      themes: this.themes,
      scopes: this.getScopes()
    };
  }
}
function $e(n) {
  const e = [], t = /* @__PURE__ */ new Set();
  function s(r) {
    if (t.has(r))
      return;
    t.add(r);
    const o = r?.nameScopesList?.scopeName;
    o && e.push(o), r.parent && s(r.parent);
  }
  return s(n), e;
}
function Ne(n, e) {
  if (!(n instanceof N))
    throw new T("Invalid grammar state");
  return n.getInternalStack(e);
}
function Ie() {
  const n = /* @__PURE__ */ new WeakMap();
  function e(t) {
    if (!n.has(t.meta)) {
      let s = function(i) {
        if (typeof i == "number") {
          if (i < 0 || i > t.source.length)
            throw new T(`Invalid decoration offset: ${i}. Code length: ${t.source.length}`);
          return {
            ...r.indexToPos(i),
            offset: i
          };
        } else {
          const a = r.lines[i.line];
          if (a === void 0)
            throw new T(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${r.lines.length}`);
          let c = i.character;
          if (c < 0 && (c = a.length + c), c < 0 || c > a.length)
            throw new T(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);
          return {
            ...i,
            character: c,
            offset: r.posToIndex(i.line, c)
          };
        }
      };
      const r = _e(t.source), o = (t.options.decorations || []).map((i) => ({
        ...i,
        start: s(i.start),
        end: s(i.end)
      }));
      Ee(o), n.set(t.meta, {
        decorations: o,
        converter: r,
        source: t.source
      });
    }
    return n.get(t.meta);
  }
  return {
    name: "shiki:decorations",
    tokens(t) {
      if (!this.options.decorations?.length)
        return;
      const r = e(this).decorations.flatMap((i) => [i.start.offset, i.end.offset]);
      return xe(t, r);
    },
    code(t) {
      if (!this.options.decorations?.length)
        return;
      const s = e(this), r = Array.from(t.children).filter((l) => l.type === "element" && l.tagName === "span");
      if (r.length !== s.converter.lines.length)
        throw new T(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);
      function o(l, u, h, p) {
        const d = r[l];
        let S = "", y = -1, m = -1;
        if (u === 0 && (y = 0), h === 0 && (m = 0), h === Number.POSITIVE_INFINITY && (m = d.children.length), y === -1 || m === -1)
          for (let b = 0; b < d.children.length; b++)
            S += ge(d.children[b]), y === -1 && S.length === u && (y = b + 1), m === -1 && S.length === h && (m = b + 1);
        if (y === -1)
          throw new T(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);
        if (m === -1)
          throw new T(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);
        const g = d.children.slice(y, m);
        if (!p.alwaysWrap && g.length === d.children.length)
          a(d, p, "line");
        else if (!p.alwaysWrap && g.length === 1 && g[0].type === "element")
          a(g[0], p, "token");
        else {
          const b = {
            type: "element",
            tagName: "span",
            properties: {},
            children: g
          };
          a(b, p, "wrapper"), d.children.splice(y, g.length, b);
        }
      }
      function i(l, u) {
        r[l] = a(r[l], u, "line");
      }
      function a(l, u, h) {
        const p = u.properties || {}, d = u.transform || ((S) => S);
        return l.tagName = u.tagName || "span", l.properties = {
          ...l.properties,
          ...p,
          class: l.properties.class
        }, u.properties?.class && ue(l, u.properties.class), l = d(l, h) || l, l;
      }
      const c = [], f = s.decorations.sort((l, u) => u.start.offset - l.start.offset || l.end.offset - u.end.offset);
      for (const l of f) {
        const { start: u, end: h } = l;
        if (u.line === h.line)
          o(u.line, u.character, h.character, l);
        else if (u.line < h.line) {
          o(u.line, u.character, Number.POSITIVE_INFINITY, l);
          for (let p = u.line + 1; p < h.line; p++)
            c.unshift(() => i(p, l));
          o(h.line, 0, h.character, l);
        }
      }
      c.forEach((l) => l());
    }
  };
}
function Ee(n) {
  for (let e = 0; e < n.length; e++) {
    const t = n[e];
    if (t.start.offset > t.end.offset)
      throw new T(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);
    for (let s = e + 1; s < n.length; s++) {
      const r = n[s], o = t.start.offset <= r.start.offset && r.start.offset < t.end.offset, i = t.start.offset < r.end.offset && r.end.offset <= t.end.offset, a = r.start.offset <= t.start.offset && t.start.offset < r.end.offset, c = r.start.offset < t.end.offset && t.end.offset <= r.end.offset;
      if (o || i || a || c) {
        if (o && i || a && c || a && t.start.offset === t.end.offset || i && r.start.offset === r.end.offset)
          continue;
        throw new T(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(r.start)} intersect.`);
      }
    }
  }
}
function ge(n) {
  return n.type === "text" ? n.value : n.type === "element" ? n.children.map(ge).join("") : "";
}
const Oe = [
  /* @__PURE__ */ Ie()
];
function A(n) {
  const e = je(n.transformers || []);
  return [
    ...e.pre,
    ...e.normal,
    ...e.post,
    ...Oe
  ];
}
function je(n) {
  const e = [], t = [], s = [];
  for (const r of n)
    switch (r.enforce) {
      case "pre":
        e.push(r);
        break;
      case "post":
        t.push(r);
        break;
      default:
        s.push(r);
    }
  return { pre: e, post: t, normal: s };
}
var x = [
  "black",
  "red",
  "green",
  "yellow",
  "blue",
  "magenta",
  "cyan",
  "white",
  "brightBlack",
  "brightRed",
  "brightGreen",
  "brightYellow",
  "brightBlue",
  "brightMagenta",
  "brightCyan",
  "brightWhite"
], z = {
  1: "bold",
  2: "dim",
  3: "italic",
  4: "underline",
  7: "reverse",
  8: "hidden",
  9: "strikethrough"
};
function Me(n, e) {
  const t = n.indexOf("\x1B", e);
  if (t !== -1 && n[t + 1] === "[") {
    const s = n.indexOf("m", t);
    if (s !== -1)
      return {
        sequence: n.substring(t + 2, s).split(";"),
        startPosition: t,
        position: s + 1
      };
  }
  return {
    position: n.length
  };
}
function ne(n) {
  const e = n.shift();
  if (e === "2") {
    const t = n.splice(0, 3).map((s) => Number.parseInt(s));
    return t.length !== 3 || t.some((s) => Number.isNaN(s)) ? void 0 : {
      type: "rgb",
      rgb: t
    };
  } else if (e === "5") {
    const t = n.shift();
    if (t)
      return { type: "table", index: Number(t) };
  }
}
function Ae(n) {
  const e = [];
  for (; n.length > 0; ) {
    const t = n.shift();
    if (!t)
      continue;
    const s = Number.parseInt(t);
    if (!Number.isNaN(s))
      if (s === 0)
        e.push({ type: "resetAll" });
      else if (s <= 9)
        z[s] && e.push({
          type: "setDecoration",
          value: z[s]
        });
      else if (s <= 29) {
        const r = z[s - 20];
        r && (e.push({
          type: "resetDecoration",
          value: r
        }), r === "dim" && e.push({
          type: "resetDecoration",
          value: "bold"
        }));
      } else if (s <= 37)
        e.push({
          type: "setForegroundColor",
          value: { type: "named", name: x[s - 30] }
        });
      else if (s === 38) {
        const r = ne(n);
        r && e.push({
          type: "setForegroundColor",
          value: r
        });
      } else if (s === 39)
        e.push({
          type: "resetForegroundColor"
        });
      else if (s <= 47)
        e.push({
          type: "setBackgroundColor",
          value: { type: "named", name: x[s - 40] }
        });
      else if (s === 48) {
        const r = ne(n);
        r && e.push({
          type: "setBackgroundColor",
          value: r
        });
      } else s === 49 ? e.push({
        type: "resetBackgroundColor"
      }) : s === 53 ? e.push({
        type: "setDecoration",
        value: "overline"
      }) : s === 55 ? e.push({
        type: "resetDecoration",
        value: "overline"
      }) : s >= 90 && s <= 97 ? e.push({
        type: "setForegroundColor",
        value: { type: "named", name: x[s - 90 + 8] }
      }) : s >= 100 && s <= 107 && e.push({
        type: "setBackgroundColor",
        value: { type: "named", name: x[s - 100 + 8] }
      });
  }
  return e;
}
function Be() {
  let n = null, e = null, t = /* @__PURE__ */ new Set();
  return {
    parse(s) {
      const r = [];
      let o = 0;
      do {
        const i = Me(s, o), a = i.sequence ? s.substring(o, i.startPosition) : s.substring(o);
        if (a.length > 0 && r.push({
          value: a,
          foreground: n,
          background: e,
          decorations: new Set(t)
        }), i.sequence) {
          const c = Ae(i.sequence);
          for (const f of c)
            f.type === "resetAll" ? (n = null, e = null, t.clear()) : f.type === "resetForegroundColor" ? n = null : f.type === "resetBackgroundColor" ? e = null : f.type === "resetDecoration" && t.delete(f.value);
          for (const f of c)
            f.type === "setForegroundColor" ? n = f.value : f.type === "setBackgroundColor" ? e = f.value : f.type === "setDecoration" && t.add(f.value);
        }
        o = i.position;
      } while (o < s.length);
      return r;
    }
  };
}
var Ge = {
  black: "#000000",
  red: "#bb0000",
  green: "#00bb00",
  yellow: "#bbbb00",
  blue: "#0000bb",
  magenta: "#ff00ff",
  cyan: "#00bbbb",
  white: "#eeeeee",
  brightBlack: "#555555",
  brightRed: "#ff5555",
  brightGreen: "#00ff00",
  brightYellow: "#ffff55",
  brightBlue: "#5555ff",
  brightMagenta: "#ff55ff",
  brightCyan: "#55ffff",
  brightWhite: "#ffffff"
};
function Re(n = Ge) {
  function e(a) {
    return n[a];
  }
  function t(a) {
    return `#${a.map((c) => Math.max(0, Math.min(c, 255)).toString(16).padStart(2, "0")).join("")}`;
  }
  let s;
  function r() {
    if (s)
      return s;
    s = [];
    for (let f = 0; f < x.length; f++)
      s.push(e(x[f]));
    let a = [0, 95, 135, 175, 215, 255];
    for (let f = 0; f < 6; f++)
      for (let l = 0; l < 6; l++)
        for (let u = 0; u < 6; u++)
          s.push(t([a[f], a[l], a[u]]));
    let c = 8;
    for (let f = 0; f < 24; f++, c += 10)
      s.push(t([c, c, c]));
    return s;
  }
  function o(a) {
    return r()[a];
  }
  function i(a) {
    switch (a.type) {
      case "named":
        return e(a.name);
      case "rgb":
        return t(a.rgb);
      case "table":
        return o(a.index);
    }
  }
  return {
    value: i
  };
}
function We(n, e, t) {
  const s = j(n, t), r = W(e), o = Re(
    Object.fromEntries(
      x.map((a) => [
        a,
        n.colors?.[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]
      ])
    )
  ), i = Be();
  return r.map(
    (a) => i.parse(a[0]).map((c) => {
      let f, l;
      c.decorations.has("reverse") ? (f = c.background ? o.value(c.background) : n.bg, l = c.foreground ? o.value(c.foreground) : n.fg) : (f = c.foreground ? o.value(c.foreground) : n.fg, l = c.background ? o.value(c.background) : void 0), f = L(f, s), l = L(l, s), c.decorations.has("dim") && (f = He(f));
      let u = w.None;
      return c.decorations.has("bold") && (u |= w.Bold), c.decorations.has("italic") && (u |= w.Italic), c.decorations.has("underline") && (u |= w.Underline), c.decorations.has("strikethrough") && (u |= w.Strikethrough), {
        content: c.value,
        offset: a[1],
        // TODO: more accurate offset? might need to fork ansi-sequence-parser
        color: f,
        bgColor: l,
        fontStyle: u
      };
    })
  );
}
function He(n) {
  const e = n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);
  if (e)
    if (e[3]) {
      const s = Math.round(Number.parseInt(e[3], 16) / 2).toString(16).padStart(2, "0");
      return `#${e[1]}${e[2]}${s}`;
    } else return e[2] ? `#${e[1]}${e[2]}80` : `#${Array.from(e[1]).map((s) => `${s}${s}`).join("")}80`;
  const t = n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
  return t ? `var(${t[1]}-dim)` : n;
}
function q(n, e, t = {}) {
  const {
    lang: s = "text",
    theme: r = n.getLoadedThemes()[0]
  } = t;
  if (K(s) || U(r))
    return W(e).map((c) => [{ content: c[0], offset: c[1] }]);
  const { theme: o, colorMap: i } = n.setTheme(r);
  if (s === "ansi")
    return We(o, e, t);
  const a = n.getLanguage(s);
  if (t.grammarState) {
    if (t.grammarState.lang !== a.name)
      throw new T(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${a.name}"`);
    if (!t.grammarState.themes.includes(o.name))
      throw new T(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${o.name}"`);
  }
  return Fe(e, a, o, i, t);
}
function De(...n) {
  if (n.length === 2)
    return E(n[1]);
  const [e, t, s = {}] = n, {
    lang: r = "text",
    theme: o = e.getLoadedThemes()[0]
  } = s;
  if (K(r) || U(o))
    throw new T("Plain language does not have grammar state");
  if (r === "ansi")
    throw new T("ANSI language does not have grammar state");
  const { theme: i, colorMap: a } = e.setTheme(o), c = e.getLanguage(r);
  return new N(
    B(t, c, i, a, s).stateStack,
    c.name,
    i.name
  );
}
function Fe(n, e, t, s, r) {
  const o = B(n, e, t, s, r), i = new N(
    B(n, e, t, s, r).stateStack,
    e.name,
    t.name
  );
  return H(o.tokens, i), o.tokens;
}
function B(n, e, t, s, r) {
  const o = j(t, r), {
    tokenizeMaxLineLength: i = 0,
    tokenizeTimeLimit: a = 500
  } = r, c = W(n);
  let f = r.grammarState ? Ne(r.grammarState, t.name) ?? V : r.grammarContextCode != null ? B(
    r.grammarContextCode,
    e,
    t,
    s,
    {
      ...r,
      grammarState: void 0,
      grammarContextCode: void 0
    }
  ).stateStack : V, l = [];
  const u = [];
  for (let h = 0, p = c.length; h < p; h++) {
    const [d, S] = c[h];
    if (d === "") {
      l = [], u.push([]);
      continue;
    }
    if (i > 0 && d.length >= i) {
      l = [], u.push([{
        content: d,
        offset: S,
        color: "",
        fontStyle: 0
      }]);
      continue;
    }
    let y, m, g;
    r.includeExplanation && (y = e.tokenizeLine(d, f, a), m = y.tokens, g = 0);
    const b = e.tokenizeLine2(d, f, a), v = b.tokens.length / 2;
    for (let _ = 0; _ < v; _++) {
      const O = b.tokens[2 * _], D = _ + 1 < v ? b.tokens[2 * _ + 2] : d.length;
      if (O === D)
        continue;
      const X = b.tokens[2 * _ + 1], ye = L(
        s[te.getForeground(X)],
        o
      ), be = te.getFontStyle(X), F = {
        content: d.substring(O, D),
        offset: S + O,
        color: ye,
        fontStyle: be
      };
      if (r.includeExplanation) {
        const Z = [];
        if (r.includeExplanation !== "scopeName")
          for (const k of t.settings) {
            let C;
            switch (typeof k.scope) {
              case "string":
                C = k.scope.split(/,/).map((P) => P.trim());
                break;
              case "object":
                C = k.scope;
                break;
              default:
                continue;
            }
            Z.push({
              settings: k,
              selectors: C.map((P) => P.split(/ /))
            });
          }
        F.explanation = [];
        let ee = 0;
        for (; O + ee < D; ) {
          const k = m[g], C = d.substring(
            k.startIndex,
            k.endIndex
          );
          ee += C.length, F.explanation.push({
            content: C,
            scopes: r.includeExplanation === "scopeName" ? Pe(
              k.scopes
            ) : ze(
              Z,
              k.scopes
            )
          }), g += 1;
        }
      }
      l.push(F);
    }
    u.push(l), l = [], f = b.ruleStack;
  }
  return {
    tokens: u,
    stateStack: f
  };
}
function Pe(n) {
  return n.map((e) => ({ scopeName: e }));
}
function ze(n, e) {
  const t = [];
  for (let s = 0, r = e.length; s < r; s++) {
    const o = e[s];
    t[s] = {
      scopeName: o,
      themeMatches: Je(n, o, e.slice(0, s))
    };
  }
  return t;
}
function se(n, e) {
  return n === e || e.substring(0, n.length) === n && e[n.length] === ".";
}
function Ve(n, e, t) {
  if (!se(n[n.length - 1], e))
    return !1;
  let s = n.length - 2, r = t.length - 1;
  for (; s >= 0 && r >= 0; )
    se(n[s], t[r]) && (s -= 1), r -= 1;
  return s === -1;
}
function Je(n, e, t) {
  const s = [];
  for (const { selectors: r, settings: o } of n)
    for (const i of r)
      if (Ve(i, e, t)) {
        s.push(o);
        break;
      }
  return s;
}
function de(n, e, t) {
  const s = Object.entries(t.themes).filter((c) => c[1]).map((c) => ({ color: c[0], theme: c[1] })), r = s.map((c) => {
    const f = q(n, e, {
      ...t,
      theme: c.theme
    }), l = E(f), u = typeof c.theme == "string" ? c.theme : c.theme.name;
    return {
      tokens: f,
      state: l,
      theme: u
    };
  }), o = Ke(
    ...r.map((c) => c.tokens)
  ), i = o[0].map(
    (c, f) => c.map((l, u) => {
      const h = {
        content: l.content,
        variants: {},
        offset: l.offset
      };
      return "includeExplanation" in t && t.includeExplanation && (h.explanation = l.explanation), o.forEach((p, d) => {
        const {
          content: S,
          explanation: y,
          offset: m,
          ...g
        } = p[f][u];
        h.variants[s[d].color] = g;
      }), h;
    })
  ), a = r[0].state ? new N(
    Object.fromEntries(r.map((c) => [c.theme, c.state?.getInternalStack(c.theme)])),
    r[0].state.lang
  ) : void 0;
  return a && H(i, a), i;
}
function Ke(...n) {
  const e = n.map(() => []), t = n.length;
  for (let s = 0; s < n[0].length; s++) {
    const r = n.map((c) => c[s]), o = e.map(() => []);
    e.forEach((c, f) => c.push(o[f]));
    const i = r.map(() => 0), a = r.map((c) => c[0]);
    for (; a.every((c) => c); ) {
      const c = Math.min(...a.map((f) => f.content.length));
      for (let f = 0; f < t; f++) {
        const l = a[f];
        l.content.length === c ? (o[f].push(l), i[f] += 1, a[f] = r[f][i[f]]) : (o[f].push({
          ...l,
          content: l.content.slice(0, c)
        }), a[f] = {
          ...l,
          content: l.content.slice(c),
          offset: l.offset + c
        });
      }
    }
  }
  return e;
}
function G(n, e, t) {
  let s, r, o, i, a, c;
  if ("themes" in t) {
    const {
      defaultColor: f = "light",
      cssVariablePrefix: l = "--shiki-",
      colorsRendering: u = "css-vars"
    } = t, h = Object.entries(t.themes).filter((m) => m[1]).map((m) => ({ color: m[0], theme: m[1] })).sort((m, g) => m.color === f ? -1 : g.color === f ? 1 : 0);
    if (h.length === 0)
      throw new T("`themes` option must not be empty");
    const p = de(
      n,
      e,
      t
    );
    if (c = E(p), f && Y !== f && !h.find((m) => m.color === f))
      throw new T(`\`themes\` option must contain the defaultColor key \`${f}\``);
    const d = h.map((m) => n.getTheme(m.theme)), S = h.map((m) => m.color);
    o = p.map((m) => m.map((g) => Ce(g, S, l, f, u))), c && H(o, c);
    const y = h.map((m) => j(m.theme, t));
    r = re(h, d, y, l, f, "fg", u), s = re(h, d, y, l, f, "bg", u), i = `shiki-themes ${d.map((m) => m.name).join(" ")}`, a = f ? void 0 : [r, s].join(";");
  } else if ("theme" in t) {
    const f = j(t.theme, t);
    o = q(
      n,
      e,
      t
    );
    const l = n.getTheme(t.theme);
    s = L(l.bg, f), r = L(l.fg, f), i = l.name, c = E(o);
  } else
    throw new T("Invalid options, either `theme` or `themes` must be provided");
  return {
    tokens: o,
    fg: r,
    bg: s,
    themeName: i,
    rootStyle: a,
    grammarState: c
  };
}
function re(n, e, t, s, r, o, i) {
  return n.map((a, c) => {
    const f = L(e[c][o], t[c]) || "inherit", l = `${s + a.color}${o === "bg" ? "-bg" : ""}:${f}`;
    if (c === 0 && r) {
      if (r === Y && n.length > 1) {
        const u = n.findIndex((S) => S.color === "light"), h = n.findIndex((S) => S.color === "dark");
        if (u === -1 || h === -1)
          throw new T('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
        const p = L(e[u][o], t[u]) || "inherit", d = L(e[h][o], t[h]) || "inherit";
        return `light-dark(${p}, ${d});${l}`;
      }
      return f;
    }
    return i === "css-vars" ? l : null;
  }).filter((a) => !!a).join(";");
}
function R(n, e, t, s = {
  meta: {},
  options: t,
  codeToHast: (r, o) => R(n, r, o),
  codeToTokens: (r, o) => G(n, r, o)
}) {
  let r = e;
  for (const d of A(t))
    r = d.preprocess?.call(s, r, t) || r;
  let {
    tokens: o,
    fg: i,
    bg: a,
    themeName: c,
    rootStyle: f,
    grammarState: l
  } = G(n, r, t);
  const {
    mergeWhitespaces: u = !0,
    mergeSameStyleTokens: h = !1
  } = t;
  u === !0 ? o = Ye(o) : u === "never" && (o = qe(o)), h && (o = Qe(o));
  const p = {
    ...s,
    get source() {
      return r;
    }
  };
  for (const d of A(t))
    o = d.tokens?.call(p, o) || o;
  return Ue(
    o,
    {
      ...t,
      fg: i,
      bg: a,
      themeName: c,
      rootStyle: f
    },
    p,
    l
  );
}
function Ue(n, e, t, s = E(n)) {
  const r = A(e), o = [], i = {
    type: "root",
    children: []
  }, {
    structure: a = "classic",
    tabindex: c = "0"
  } = e;
  let f = {
    type: "element",
    tagName: "pre",
    properties: {
      class: `shiki ${e.themeName || ""}`,
      style: e.rootStyle || `background-color:${e.bg};color:${e.fg}`,
      ...c !== !1 && c != null ? {
        tabindex: c.toString()
      } : {},
      ...Object.fromEntries(
        Array.from(
          Object.entries(e.meta || {})
        ).filter(([d]) => !d.startsWith("_"))
      )
    },
    children: []
  }, l = {
    type: "element",
    tagName: "code",
    properties: {},
    children: o
  };
  const u = [], h = {
    ...t,
    structure: a,
    addClassToHast: ue,
    get source() {
      return t.source;
    },
    get tokens() {
      return n;
    },
    get options() {
      return e;
    },
    get root() {
      return i;
    },
    get pre() {
      return f;
    },
    get code() {
      return l;
    },
    get lines() {
      return u;
    }
  };
  if (n.forEach((d, S) => {
    S && (a === "inline" ? i.children.push({ type: "element", tagName: "br", properties: {}, children: [] }) : a === "classic" && o.push({ type: "text", value: `
` }));
    let y = {
      type: "element",
      tagName: "span",
      properties: { class: "line" },
      children: []
    }, m = 0;
    for (const g of d) {
      let b = {
        type: "element",
        tagName: "span",
        properties: {
          ...g.htmlAttrs
        },
        children: [{ type: "text", value: g.content }]
      };
      const v = J(g.htmlStyle || M(g));
      v && (b.properties.style = v);
      for (const _ of r)
        b = _?.span?.call(h, b, S + 1, m, y, g) || b;
      a === "inline" ? i.children.push(b) : a === "classic" && y.children.push(b), m += g.content.length;
    }
    if (a === "classic") {
      for (const g of r)
        y = g?.line?.call(h, y, S + 1) || y;
      u.push(y), o.push(y);
    }
  }), a === "classic") {
    for (const d of r)
      l = d?.code?.call(h, l) || l;
    f.children.push(l);
    for (const d of r)
      f = d?.pre?.call(h, f) || f;
    i.children.push(f);
  }
  let p = i;
  for (const d of r)
    p = d?.root?.call(h, p) || p;
  return s && H(p, s), p;
}
function Ye(n) {
  return n.map((e) => {
    const t = [];
    let s = "", r = 0;
    return e.forEach((o, i) => {
      const c = !(o.fontStyle && (o.fontStyle & w.Underline || o.fontStyle & w.Strikethrough));
      c && o.content.match(/^\s+$/) && e[i + 1] ? (r || (r = o.offset), s += o.content) : s ? (c ? t.push({
        ...o,
        offset: r,
        content: s + o.content
      }) : t.push(
        {
          content: s,
          offset: r
        },
        o
      ), r = 0, s = "") : t.push(o);
    }), t;
  });
}
function qe(n) {
  return n.map((e) => e.flatMap((t) => {
    if (t.content.match(/^\s+$/))
      return t;
    const s = t.content.match(/^(\s*)(.*?)(\s*)$/);
    if (!s)
      return t;
    const [, r, o, i] = s;
    if (!r && !i)
      return t;
    const a = [{
      ...t,
      offset: t.offset + r.length,
      content: o
    }];
    return r && a.unshift({
      content: r,
      offset: t.offset
    }), i && a.push({
      content: i,
      offset: t.offset + r.length + o.length
    }), a;
  }));
}
function Qe(n) {
  return n.map((e) => {
    const t = [];
    for (const s of e) {
      if (t.length === 0) {
        t.push({ ...s });
        continue;
      }
      const r = t[t.length - 1], o = J(r.htmlStyle || M(r)), i = J(s.htmlStyle || M(s)), a = r.fontStyle && (r.fontStyle & w.Underline || r.fontStyle & w.Strikethrough), c = s.fontStyle && (s.fontStyle & w.Underline || s.fontStyle & w.Strikethrough);
      !a && !c && o === i ? r.content += s.content : t.push({ ...s });
    }
    return t;
  });
}
const Xe = we;
function Ze(n, e, t) {
  const s = {
    meta: {},
    options: t,
    codeToHast: (o, i) => R(n, o, i),
    codeToTokens: (o, i) => G(n, o, i)
  };
  let r = Xe(R(n, e, t, s));
  for (const o of A(t))
    r = o.postprocess?.call(s, r, t) || r;
  return r;
}
const oe = { light: "#333333", dark: "#bbbbbb" }, ae = { light: "#fffffe", dark: "#1e1e1e" }, ie = "__shiki_resolved";
function Q(n) {
  if (n?.[ie])
    return n;
  const e = {
    ...n
  };
  e.tokenColors && !e.settings && (e.settings = e.tokenColors, delete e.tokenColors), e.type ||= "dark", e.colorReplacements = { ...e.colorReplacements }, e.settings ||= [];
  let { bg: t, fg: s } = e;
  if (!t || !s) {
    const a = e.settings ? e.settings.find((c) => !c.name && !c.scope) : void 0;
    a?.settings?.foreground && (s = a.settings.foreground), a?.settings?.background && (t = a.settings.background), !s && e?.colors?.["editor.foreground"] && (s = e.colors["editor.foreground"]), !t && e?.colors?.["editor.background"] && (t = e.colors["editor.background"]), s || (s = e.type === "light" ? oe.light : oe.dark), t || (t = e.type === "light" ? ae.light : ae.dark), e.fg = s, e.bg = t;
  }
  e.settings[0] && e.settings[0].settings && !e.settings[0].scope || e.settings.unshift({
    settings: {
      foreground: e.fg,
      background: e.bg
    }
  });
  let r = 0;
  const o = /* @__PURE__ */ new Map();
  function i(a) {
    if (o.has(a))
      return o.get(a);
    r += 1;
    const c = `#${r.toString(16).padStart(8, "0").toLowerCase()}`;
    return e.colorReplacements?.[`#${c}`] ? i(a) : (o.set(a, c), c);
  }
  e.settings = e.settings.map((a) => {
    const c = a.settings?.foreground && !a.settings.foreground.startsWith("#"), f = a.settings?.background && !a.settings.background.startsWith("#");
    if (!c && !f)
      return a;
    const l = {
      ...a,
      settings: {
        ...a.settings
      }
    };
    if (c) {
      const u = i(a.settings.foreground);
      e.colorReplacements[u] = a.settings.foreground, l.settings.foreground = u;
    }
    if (f) {
      const u = i(a.settings.background);
      e.colorReplacements[u] = a.settings.background, l.settings.background = u;
    }
    return l;
  });
  for (const a of Object.keys(e.colors || {}))
    if ((a === "editor.foreground" || a === "editor.background" || a.startsWith("terminal.ansi")) && !e.colors[a]?.startsWith("#")) {
      const c = i(e.colors[a]);
      e.colorReplacements[c] = e.colors[a], e.colors[a] = c;
    }
  return Object.defineProperty(e, ie, {
    enumerable: !1,
    writable: !1,
    value: !0
  }), e;
}
async function me(n) {
  return Array.from(new Set((await Promise.all(
    n.filter((e) => !le(e)).map(async (e) => await ce(e).then((t) => Array.isArray(t) ? t : [t]))
  )).flat()));
}
async function pe(n) {
  return (await Promise.all(
    n.map(
      async (t) => fe(t) ? null : Q(await ce(t))
    )
  )).filter((t) => !!t);
}
let et = 3;
function tt(n, e = 3) {
  e > et || console.trace(`[SHIKI DEPRECATE]: ${n}`);
}
class $ extends Error {
  constructor(e) {
    super(e), this.name = "ShikiError";
  }
}
class nt extends Se {
  constructor(e, t, s, r = {}) {
    super(e), this._resolver = e, this._themes = t, this._langs = s, this._alias = r, this._themes.map((o) => this.loadTheme(o)), this.loadLanguages(this._langs);
  }
  _resolvedThemes = /* @__PURE__ */ new Map();
  _resolvedGrammars = /* @__PURE__ */ new Map();
  _langMap = /* @__PURE__ */ new Map();
  _langGraph = /* @__PURE__ */ new Map();
  _textmateThemeCache = /* @__PURE__ */ new WeakMap();
  _loadedThemesCache = null;
  _loadedLanguagesCache = null;
  getTheme(e) {
    return typeof e == "string" ? this._resolvedThemes.get(e) : this.loadTheme(e);
  }
  loadTheme(e) {
    const t = Q(e);
    return t.name && (this._resolvedThemes.set(t.name, t), this._loadedThemesCache = null), t;
  }
  getLoadedThemes() {
    return this._loadedThemesCache || (this._loadedThemesCache = [...this._resolvedThemes.keys()]), this._loadedThemesCache;
  }
  // Override and re-implement this method to cache the textmate themes as `TextMateTheme.createFromRawTheme`
  // is expensive. Themes can switch often especially for dual-theme support.
  //
  // The parent class also accepts `colorMap` as the second parameter, but since we don't use that,
  // we omit here so it's easier to cache the themes.
  setTheme(e) {
    let t = this._textmateThemeCache.get(e);
    t || (t = Te.createFromRawTheme(e), this._textmateThemeCache.set(e, t)), this._syncRegistry.setTheme(t);
  }
  getGrammar(e) {
    if (this._alias[e]) {
      const t = /* @__PURE__ */ new Set([e]);
      for (; this._alias[e]; ) {
        if (e = this._alias[e], t.has(e))
          throw new $(`Circular alias \`${Array.from(t).join(" -> ")} -> ${e}\``);
        t.add(e);
      }
    }
    return this._resolvedGrammars.get(e);
  }
  loadLanguage(e) {
    if (this.getGrammar(e.name))
      return;
    const t = new Set(
      [...this._langMap.values()].filter((o) => o.embeddedLangsLazy?.includes(e.name))
    );
    this._resolver.addLanguage(e);
    const s = {
      balancedBracketSelectors: e.balancedBracketSelectors || ["*"],
      unbalancedBracketSelectors: e.unbalancedBracketSelectors || []
    };
    this._syncRegistry._rawGrammars.set(e.scopeName, e);
    const r = this.loadGrammarWithConfiguration(e.scopeName, 1, s);
    if (r.name = e.name, this._resolvedGrammars.set(e.name, r), e.aliases && e.aliases.forEach((o) => {
      this._alias[o] = e.name;
    }), this._loadedLanguagesCache = null, t.size)
      for (const o of t)
        this._resolvedGrammars.delete(o.name), this._loadedLanguagesCache = null, this._syncRegistry?._injectionGrammars?.delete(o.scopeName), this._syncRegistry?._grammars?.delete(o.scopeName), this.loadLanguage(this._langMap.get(o.name));
  }
  dispose() {
    super.dispose(), this._resolvedThemes.clear(), this._resolvedGrammars.clear(), this._langMap.clear(), this._langGraph.clear(), this._loadedThemesCache = null;
  }
  loadLanguages(e) {
    for (const r of e)
      this.resolveEmbeddedLanguages(r);
    const t = Array.from(this._langGraph.entries()), s = t.filter(([r, o]) => !o);
    if (s.length) {
      const r = t.filter(([o, i]) => i && i.embeddedLangs?.some((a) => s.map(([c]) => c).includes(a))).filter((o) => !s.includes(o));
      throw new $(`Missing languages ${s.map(([o]) => `\`${o}\``).join(", ")}, required by ${r.map(([o]) => `\`${o}\``).join(", ")}`);
    }
    for (const [r, o] of t)
      this._resolver.addLanguage(o);
    for (const [r, o] of t)
      this.loadLanguage(o);
  }
  getLoadedLanguages() {
    return this._loadedLanguagesCache || (this._loadedLanguagesCache = [
      .../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])
    ]), this._loadedLanguagesCache;
  }
  resolveEmbeddedLanguages(e) {
    if (this._langMap.set(e.name, e), this._langGraph.set(e.name, e), e.embeddedLangs)
      for (const t of e.embeddedLangs)
        this._langGraph.set(t, this._langMap.get(t));
  }
}
class st {
  _langs = /* @__PURE__ */ new Map();
  _scopeToLang = /* @__PURE__ */ new Map();
  _injections = /* @__PURE__ */ new Map();
  _onigLib;
  constructor(e, t) {
    this._onigLib = {
      createOnigScanner: (s) => e.createScanner(s),
      createOnigString: (s) => e.createString(s)
    }, t.forEach((s) => this.addLanguage(s));
  }
  get onigLib() {
    return this._onigLib;
  }
  getLangRegistration(e) {
    return this._langs.get(e);
  }
  loadGrammar(e) {
    return this._scopeToLang.get(e);
  }
  addLanguage(e) {
    this._langs.set(e.name, e), e.aliases && e.aliases.forEach((t) => {
      this._langs.set(t, e);
    }), this._scopeToLang.set(e.scopeName, e), e.injectTo && e.injectTo.forEach((t) => {
      this._injections.get(t) || this._injections.set(t, []), this._injections.get(t).push(e.scopeName);
    });
  }
  getInjections(e) {
    const t = e.split(".");
    let s = [];
    for (let r = 1; r <= t.length; r++) {
      const o = t.slice(0, r).join(".");
      s = [...s, ...this._injections.get(o) || []];
    }
    return s;
  }
}
let I = 0;
function rt(n) {
  I += 1, n.warnings !== !1 && I >= 10 && I % 10 === 0 && console.warn(`[Shiki] ${I} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);
  let e = !1;
  if (!n.engine)
    throw new $("`engine` option is required for synchronous mode");
  const t = (n.langs || []).flat(1), s = (n.themes || []).flat(1).map(Q), r = new st(n.engine, t), o = new nt(r, s, t, n.langAlias);
  let i;
  function a(g) {
    y();
    const b = o.getGrammar(typeof g == "string" ? g : g.name);
    if (!b)
      throw new $(`Language \`${g}\` not found, you may need to load it first`);
    return b;
  }
  function c(g) {
    if (g === "none")
      return { bg: "", fg: "", name: "none", settings: [], type: "dark" };
    y();
    const b = o.getTheme(g);
    if (!b)
      throw new $(`Theme \`${g}\` not found, you may need to load it first`);
    return b;
  }
  function f(g) {
    y();
    const b = c(g);
    i !== g && (o.setTheme(b), i = g);
    const v = o.getColorMap();
    return {
      theme: b,
      colorMap: v
    };
  }
  function l() {
    return y(), o.getLoadedThemes();
  }
  function u() {
    return y(), o.getLoadedLanguages();
  }
  function h(...g) {
    y(), o.loadLanguages(g.flat(1));
  }
  async function p(...g) {
    return h(await me(g));
  }
  function d(...g) {
    y();
    for (const b of g.flat(1))
      o.loadTheme(b);
  }
  async function S(...g) {
    return y(), d(await pe(g));
  }
  function y() {
    if (e)
      throw new $("Shiki instance has been disposed");
  }
  function m() {
    e || (e = !0, o.dispose(), I -= 1);
  }
  return {
    setTheme: f,
    getTheme: c,
    getLanguage: a,
    getLoadedThemes: l,
    getLoadedLanguages: u,
    loadLanguage: p,
    loadLanguageSync: h,
    loadTheme: S,
    loadThemeSync: d,
    dispose: m,
    [Symbol.dispose]: m
  };
}
async function ot(n) {
  n.engine || tt("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
  const [
    e,
    t,
    s
  ] = await Promise.all([
    pe(n.themes || []),
    me(n.langs || []),
    n.engine
  ]);
  return rt({
    ...n,
    themes: e,
    langs: t,
    engine: s
  });
}
async function at(n) {
  const e = await ot(n);
  return {
    getLastGrammarState: (...t) => De(e, ...t),
    codeToTokensBase: (t, s) => q(e, t, s),
    codeToTokensWithThemes: (t, s) => de(e, t, s),
    codeToTokens: (t, s) => G(e, t, s),
    codeToHast: (t, s) => R(e, t, s),
    codeToHtml: (t, s) => Ze(e, t, s),
    getBundledLanguages: () => ({}),
    getBundledThemes: () => ({}),
    ...e,
    getInternalContext: () => e
  };
}
function ht(n) {
  const e = n.langs, t = n.themes, s = n.engine;
  async function r(o) {
    function i(u) {
      if (typeof u == "string") {
        if (le(u))
          return [];
        u = o.langAlias?.[u] || u;
        const h = e[u];
        if (!h)
          throw new T(`Language \`${u}\` is not included in this bundle. You may want to load it from external source.`);
        return h;
      }
      return u;
    }
    function a(u) {
      if (fe(u))
        return "none";
      if (typeof u == "string") {
        const h = t[u];
        if (!h)
          throw new T(`Theme \`${u}\` is not included in this bundle. You may want to load it from external source.`);
        return h;
      }
      return u;
    }
    const c = (o.themes ?? []).map((u) => a(u)), f = (o.langs ?? []).map((u) => i(u)), l = await at({
      engine: o.engine ?? s(),
      ...o,
      themes: c,
      langs: f
    });
    return {
      ...l,
      loadLanguage(...u) {
        return l.loadLanguage(...u.map(i));
      },
      loadTheme(...u) {
        return l.loadTheme(...u.map(a));
      },
      getBundledLanguages() {
        return e;
      },
      getBundledThemes() {
        return t;
      }
    };
  }
  return r;
}
function it(n) {
  let e;
  async function t(s = {}) {
    if (e) {
      const r = await e;
      return await Promise.all([
        r.loadTheme(...s.themes || []),
        r.loadLanguage(...s.langs || [])
      ]), r;
    } else
      return e = n({
        ...s,
        themes: s.themes || [],
        langs: s.langs || []
      }), e;
  }
  return t;
}
function gt(n, e) {
  const t = it(n);
  async function s(r, o) {
    const i = await t({
      langs: [o.lang],
      themes: "theme" in o ? [o.theme] : Object.values(o.themes)
    }), a = await e?.guessEmbeddedLanguages?.(r, o.lang, i);
    return a && await i.loadLanguage(...a), i;
  }
  return {
    getSingletonHighlighter(r) {
      return t(r);
    },
    async codeToHtml(r, o) {
      return (await s(r, o)).codeToHtml(r, o);
    },
    async codeToHast(r, o) {
      return (await s(r, o)).codeToHast(r, o);
    },
    async codeToTokens(r, o) {
      return (await s(r, o)).codeToTokens(r, o);
    },
    async codeToTokensBase(r, o) {
      return (await s(r, o)).codeToTokensBase(r, o);
    },
    async codeToTokensWithThemes(r, o) {
      return (await s(r, o)).codeToTokensWithThemes(r, o);
    },
    async getLastGrammarState(r, o) {
      return (await t({
        langs: [o.lang],
        themes: [o.theme]
      })).getLastGrammarState(r, o);
    }
  };
}
export {
  T as ShikiError,
  ue as addClassToHast,
  L as applyColorReplacements,
  R as codeToHast,
  Ze as codeToHtml,
  G as codeToTokens,
  q as codeToTokensBase,
  de as codeToTokensWithThemes,
  at as createHighlighterCore,
  _e as createPositionConverter,
  ot as createShikiInternal,
  rt as createShikiInternalSync,
  gt as createSingletonShorthands,
  ht as createdBundledHighlighter,
  Ce as flatTokenVariants,
  M as getTokenStyleObject,
  ut as guessEmbeddedLanguages,
  Xe as hastToHtml,
  U as isNoneTheme,
  K as isPlainLang,
  le as isSpecialLang,
  fe as isSpecialTheme,
  it as makeSingletonHighlighter,
  ce as normalizeGetter,
  Q as normalizeTheme,
  j as resolveColorReplacements,
  W as splitLines,
  ve as splitToken,
  xe as splitTokens,
  J as stringifyTokenStyle,
  ke as toArray,
  We as tokenizeAnsiWithTheme,
  Fe as tokenizeWithTheme,
  Ue as tokensToHast,
  Ie as transformerDecorations,
  tt as warnDeprecated
};
