import { forwardRef as Ze, useState as et, useMemo as Q, useRef as xe, useEffect as tt } from "react";
import { jsxs as Ae, jsx as ne, Fragment as nt } from "react/jsx-runtime";
import { c as de } from "./bundle-mjs-lrpnyDSX.js";
import { I as re, E as ge, R as rt, T as it, t as st, F as N, a as at } from "./index-3rscXtm3.js";
var ie = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, lt = Object.getOwnPropertyNames, ct = Object.prototype.hasOwnProperty, ft = (e, t) => {
  let n = {};
  for (var r in e)
    ie(n, r, {
      get: e[r],
      enumerable: !0
    });
  return ie(n, Symbol.toStringTag, { value: "Module" }), n;
}, mt = (e, t, n, r) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (var i = lt(t), s = 0, o = i.length, a; s < o; s++)
      a = i[s], !ct.call(e, a) && a !== n && ie(e, a, {
        get: ((l) => t[l]).bind(null, a),
        enumerable: !(r = ot(t, a)) || r.enumerable
      });
  return e;
}, ut = (e, t, n) => (mt(e, t, "default"), n), w = class extends Error {
  constructor(t) {
    super(t), this.name = "ShikiError";
  }
};
function I(e, t) {
  const n = typeof e == "string" ? {} : { ...e.colorReplacements }, r = typeof e == "string" ? e : e.name;
  for (const [i, s] of Object.entries(t?.colorReplacements || {})) typeof s == "string" ? n[i] = s : i === r && Object.assign(n, s);
  return n;
}
function A(e, t) {
  return e && (t?.[e?.toLowerCase()] || e);
}
function ht(e) {
  return Array.isArray(e) ? e : [e];
}
async function Oe(e) {
  return Promise.resolve(typeof e == "function" ? e() : e).then((t) => t.default || t);
}
function R(e) {
  return !e || [
    "plaintext",
    "txt",
    "text",
    "plain"
  ].includes(e);
}
function oe(e) {
  return e === "ansi" || R(e);
}
function F(e) {
  return e === "none";
}
function Me(e) {
  return F(e);
}
function z(e, t = !1) {
  if (e.length === 0) return [["", 0]];
  const n = e.split(/(\r?\n)/g);
  let r = 0;
  const i = [];
  for (let s = 0; s < n.length; s += 2) {
    const o = t ? n[s] + (n[s + 1] || "") : n[s];
    i.push([o, r]), r += n[s].length, r += n[s + 1]?.length || 0;
  }
  return i;
}
const pe = {
  light: "#333333",
  dark: "#bbbbbb"
}, ye = {
  light: "#fffffe",
  dark: "#1e1e1e"
}, be = "__shiki_resolved";
function le(e) {
  if (e?.[be]) return e;
  const t = { ...e };
  t.tokenColors && !t.settings && (t.settings = t.tokenColors, delete t.tokenColors), t.type ||= "dark", t.colorReplacements = { ...t.colorReplacements }, t.settings ||= [];
  let { bg: n, fg: r } = t;
  if (!n || !r) {
    const a = t.settings ? t.settings.find((l) => !l.name && !l.scope) : void 0;
    a?.settings?.foreground && (r = a.settings.foreground), a?.settings?.background && (n = a.settings.background), !r && t?.colors?.["editor.foreground"] && (r = t.colors["editor.foreground"]), !n && t?.colors?.["editor.background"] && (n = t.colors["editor.background"]), r || (r = t.type === "light" ? pe.light : pe.dark), n || (n = t.type === "light" ? ye.light : ye.dark), t.fg = r, t.bg = n;
  }
  t.settings[0] && t.settings[0].settings && !t.settings[0].scope || t.settings.unshift({ settings: {
    foreground: t.fg,
    background: t.bg
  } });
  let i = 0;
  const s = /* @__PURE__ */ new Map();
  function o(a) {
    if (s.has(a)) return s.get(a);
    i += 1;
    const l = `#${i.toString(16).padStart(8, "0").toLowerCase()}`;
    return t.colorReplacements?.[`#${l}`] ? o(a) : (s.set(a, l), l);
  }
  t.settings = t.settings.map((a) => {
    const l = a.settings?.foreground && !a.settings.foreground.startsWith("#"), c = a.settings?.background && !a.settings.background.startsWith("#");
    if (!l && !c) return a;
    const m = {
      ...a,
      settings: { ...a.settings }
    };
    if (l) {
      const f = o(a.settings.foreground);
      t.colorReplacements[f] = a.settings.foreground, m.settings.foreground = f;
    }
    if (c) {
      const f = o(a.settings.background);
      t.colorReplacements[f] = a.settings.background, m.settings.background = f;
    }
    return m;
  });
  for (const a of Object.keys(t.colors || {})) if ((a === "editor.foreground" || a === "editor.background" || a.startsWith("terminal.ansi")) && !t.colors[a]?.startsWith("#")) {
    const l = o(t.colors[a]);
    t.colorReplacements[l] = t.colors[a], t.colors[a] = l;
  }
  return Object.defineProperty(t, be, {
    enumerable: !1,
    writable: !1,
    value: !0
  }), t;
}
async function Pe(e) {
  return Array.from(new Set((await Promise.all(e.filter((t) => !oe(t)).map(async (t) => await Oe(t).then((n) => Array.isArray(n) ? n : [n])))).flat()));
}
async function je(e) {
  return (await Promise.all(e.map(async (t) => Me(t) ? null : le(await Oe(t))))).filter((t) => !!t);
}
function Ee(e, t) {
  if (!t) return e;
  if (t[e]) {
    const n = /* @__PURE__ */ new Set([e]);
    for (; t[e]; ) {
      if (e = t[e], n.has(e)) throw new w(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);
      n.add(e);
    }
  }
  return e;
}
var dt = class extends rt {
  _resolvedThemes = /* @__PURE__ */ new Map();
  _resolvedGrammars = /* @__PURE__ */ new Map();
  _langMap = /* @__PURE__ */ new Map();
  _langGraph = /* @__PURE__ */ new Map();
  _textmateThemeCache = /* @__PURE__ */ new WeakMap();
  _loadedThemesCache = null;
  _loadedLanguagesCache = null;
  constructor(e, t, n, r = {}) {
    super(e), this._resolver = e, this._themes = t, this._langs = n, this._alias = r, this._themes.map((i) => this.loadTheme(i)), this.loadLanguages(this._langs);
  }
  getTheme(e) {
    return typeof e == "string" ? this._resolvedThemes.get(e) : this.loadTheme(e);
  }
  loadTheme(e) {
    const t = le(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;
  }
  setTheme(e) {
    let t = this._textmateThemeCache.get(e);
    t || (t = it.createFromRawTheme(e), this._textmateThemeCache.set(e, t)), this._syncRegistry.setTheme(t);
  }
  getGrammar(e) {
    return e = Ee(e, this._alias), this._resolvedGrammars.get(e);
  }
  loadLanguage(e) {
    if (this.getGrammar(e.name)) return;
    const t = new Set([...this._langMap.values()].filter((i) => i.embeddedLangsLazy?.includes(e.name)));
    this._resolver.addLanguage(e);
    const n = {
      balancedBracketSelectors: e.balancedBracketSelectors || ["*"],
      unbalancedBracketSelectors: e.unbalancedBracketSelectors || []
    };
    this._syncRegistry._rawGrammars.set(e.scopeName, e);
    const r = this.loadGrammarWithConfiguration(e.scopeName, 1, n);
    if (r.name = e.name, this._resolvedGrammars.set(e.name, r), e.aliases && e.aliases.forEach((i) => {
      this._alias[i] = e.name;
    }), this._loadedLanguagesCache = null, t.size) for (const i of t)
      this._resolvedGrammars.delete(i.name), this._loadedLanguagesCache = null, this._syncRegistry?._injectionGrammars?.delete(i.scopeName), this._syncRegistry?._grammars?.delete(i.scopeName), this.loadLanguage(this._langMap.get(i.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()), n = t.filter(([r, i]) => !i);
    if (n.length) {
      const r = t.filter(([i, s]) => s ? (s.embeddedLanguages || s.embeddedLangs)?.some((o) => n.map(([a]) => a).includes(o)) : !1).filter((i) => !n.includes(i));
      throw new w(`Missing languages ${n.map(([i]) => `\`${i}\``).join(", ")}, required by ${r.map(([i]) => `\`${i}\``).join(", ")}`);
    }
    for (const [r, i] of t) this._resolver.addLanguage(i);
    for (const [r, i] of t) this.loadLanguage(i);
  }
  getLoadedLanguages() {
    return this._loadedLanguagesCache || (this._loadedLanguagesCache = [.../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])]), this._loadedLanguagesCache;
  }
  resolveEmbeddedLanguages(e) {
    this._langMap.set(e.name, e), this._langGraph.set(e.name, e);
    const t = e.embeddedLanguages ?? e.embeddedLangs;
    if (t) for (const n of t) this._langGraph.set(n, this._langMap.get(n));
  }
}, gt = class {
  _langs = /* @__PURE__ */ new Map();
  _scopeToLang = /* @__PURE__ */ new Map();
  _injections = /* @__PURE__ */ new Map();
  _onigLib;
  constructor(e, t) {
    this._onigLib = {
      createOnigScanner: (n) => e.createScanner(n),
      createOnigString: (n) => e.createString(n)
    }, t.forEach((n) => this.addLanguage(n));
  }
  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 n = [];
    for (let r = 1; r <= t.length; r++) {
      const i = t.slice(0, r).join(".");
      n = [...n, ...this._injections.get(i) || []];
    }
    return n;
  }
};
let j = 0;
function pt(e) {
  j += 1, e.warnings !== !1 && j >= 10 && j % 10 === 0 && console.warn(`[Shiki] ${j} 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 t = !1;
  if (!e.engine) throw new w("`engine` option is required for synchronous mode");
  const n = (e.langs || []).flat(1), r = (e.themes || []).flat(1).map(le), i = new dt(new gt(e.engine, n), r, n, e.langAlias);
  let s;
  function o(g) {
    return Ee(g, e.langAlias);
  }
  function a(g) {
    b();
    const y = i.getGrammar(typeof g == "string" ? g : g.name);
    if (!y) throw new w(`Language \`${g}\` not found, you may need to load it first`);
    return y;
  }
  function l(g) {
    if (g === "none") return {
      bg: "",
      fg: "",
      name: "none",
      settings: [],
      type: "dark"
    };
    b();
    const y = i.getTheme(g);
    if (!y) throw new w(`Theme \`${g}\` not found, you may need to load it first`);
    return y;
  }
  function c(g) {
    b();
    const y = l(g);
    return s !== g && (i.setTheme(y), s = g), {
      theme: y,
      colorMap: i.getColorMap()
    };
  }
  function m() {
    return b(), i.getLoadedThemes();
  }
  function f() {
    return b(), i.getLoadedLanguages();
  }
  function u(...g) {
    b(), i.loadLanguages(g.flat(1));
  }
  async function h(...g) {
    return u(await Pe(g));
  }
  function d(...g) {
    b();
    for (const y of g.flat(1)) i.loadTheme(y);
  }
  async function T(...g) {
    return b(), d(await je(g));
  }
  function b() {
    if (t) throw new w("Shiki instance has been disposed");
  }
  function p() {
    t || (t = !0, i.dispose(), j -= 1);
  }
  return {
    setTheme: c,
    getTheme: l,
    getLanguage: a,
    getLoadedThemes: m,
    getLoadedLanguages: f,
    resolveLangAlias: o,
    loadLanguage: h,
    loadLanguageSync: u,
    loadTheme: T,
    loadThemeSync: d,
    dispose: p,
    [Symbol.dispose]: p
  };
}
async function yt(e) {
  e.engine || console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
  const [t, n, r] = await Promise.all([
    je(e.themes || []),
    Pe(e.langs || []),
    e.engine
  ]);
  return pt({
    ...e,
    themes: t,
    langs: n,
    engine: r
  });
}
const $e = /* @__PURE__ */ new WeakMap();
function V(e, t) {
  $e.set(e, t);
}
function $(e) {
  return $e.get(e);
}
var J = class He {
  /**
  * 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(t, n) {
    return new He(Object.fromEntries(ht(n).map((r) => [r, re])), t);
  }
  constructor(...t) {
    if (t.length === 2) {
      const [n, r] = t;
      this.lang = r, this._stacks = n;
    } else {
      const [n, r, i] = t;
      this.lang = r, this._stacks = { [i]: n };
    }
  }
  /**
  * Get the internal stack object.
  * @internal
  */
  getInternalStack(t = this.theme) {
    return this._stacks[t];
  }
  getScopes(t = this.theme) {
    return bt(this._stacks[t]);
  }
  toJSON() {
    return {
      lang: this.lang,
      theme: this.theme,
      themes: this.themes,
      scopes: this.getScopes()
    };
  }
};
function bt(e) {
  const t = [], n = /* @__PURE__ */ new Set();
  function r(i) {
    if (n.has(i)) return;
    n.add(i);
    const s = i?.nameScopesList?.scopeName;
    s && t.push(s), i.parent && r(i.parent);
  }
  return r(e), t;
}
function Tt(e, t) {
  if (!(e instanceof J)) throw new w("Invalid grammar state");
  return e.getInternalStack(t);
}
function Be(e, t, n = {}) {
  const { theme: r = e.getLoadedThemes()[0] } = n;
  if (R(e.resolveLangAlias(n.lang || "text")) || F(r)) return z(t).map((a) => [{
    content: a[0],
    offset: a[1]
  }]);
  const { theme: i, colorMap: s } = e.setTheme(r), o = e.getLanguage(n.lang || "text");
  if (n.grammarState) {
    if (n.grammarState.lang !== o.name) throw new w(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);
    if (!n.grammarState.themes.includes(i.name)) throw new w(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`);
  }
  return St(t, o, i, s, n);
}
function wt(...e) {
  if (e.length === 2) return $(e[1]);
  const [t, n, r = {}] = e, { lang: i = "text", theme: s = t.getLoadedThemes()[0] } = r;
  if (R(i) || F(s)) throw new w("Plain language does not have grammar state");
  if (i === "ansi") throw new w("ANSI language does not have grammar state");
  const { theme: o, colorMap: a } = t.setTheme(s), l = t.getLanguage(i);
  return new J(ce(n, l, o, a, r).stateStack, l.name, o.name);
}
function St(e, t, n, r, i) {
  const s = ce(e, t, n, r, i), o = new J(s.stateStack, t.name, n.name);
  return V(s.tokens, o), s.tokens;
}
function ce(e, t, n, r, i) {
  const s = I(n, i), { tokenizeMaxLineLength: o = 0, tokenizeTimeLimit: a = 500 } = i, l = z(e);
  let c = i.grammarState ? Tt(i.grammarState, n.name) ?? re : i.grammarContextCode != null ? ce(i.grammarContextCode, t, n, r, {
    ...i,
    grammarState: void 0,
    grammarContextCode: void 0
  }).stateStack : re, m = [];
  const f = [];
  for (let u = 0, h = l.length; u < h; u++) {
    const [d, T] = l[u];
    if (d === "") {
      m = [], f.push([]);
      continue;
    }
    if (o > 0 && d.length >= o) {
      m = [], f.push([{
        content: d,
        offset: T,
        color: "",
        fontStyle: 0
      }]);
      continue;
    }
    let b, p, g;
    i.includeExplanation && (b = t.tokenizeLine(d, c, a), p = b.tokens, g = 0);
    const y = t.tokenizeLine2(d, c, a), k = y.tokens.length / 2;
    for (let v = 0; v < k; v++) {
      const _ = y.tokens[2 * v], O = v + 1 < k ? y.tokens[2 * v + 2] : d.length;
      if (_ === O) continue;
      const H = y.tokens[2 * v + 1], Xe = A(r[ge.getForeground(H)], s), Qe = ge.getFontStyle(H), q = {
        content: d.substring(_, O),
        offset: T + _,
        color: Xe,
        fontStyle: Qe
      };
      if (i.includeExplanation) {
        const ue = [];
        if (i.includeExplanation !== "scopeName") for (const x of n.settings) {
          let P;
          switch (typeof x.scope) {
            case "string":
              P = x.scope.split(/,/).map((X) => X.trim());
              break;
            case "object":
              P = x.scope;
              break;
            default:
              continue;
          }
          ue.push({
            settings: x,
            selectors: P.map((X) => X.split(/ /))
          });
        }
        q.explanation = [];
        let he = 0;
        for (; _ + he < O; ) {
          const x = p[g], P = d.substring(x.startIndex, x.endIndex);
          he += P.length, q.explanation.push({
            content: P,
            scopes: i.includeExplanation === "scopeName" ? Lt(x.scopes) : kt(ue, x.scopes)
          }), g += 1;
        }
      }
      m.push(q);
    }
    f.push(m), m = [], c = y.ruleStack;
  }
  return {
    tokens: f,
    stateStack: c
  };
}
function Lt(e) {
  return e.map((t) => ({ scopeName: t }));
}
function kt(e, t) {
  const n = [];
  for (let r = 0, i = t.length; r < i; r++) {
    const s = t[r];
    n[r] = {
      scopeName: s,
      themeMatches: _t(e, s, t.slice(0, r))
    };
  }
  return n;
}
function Te(e, t) {
  return e === t || t.substring(0, e.length) === e && t[e.length] === ".";
}
function vt(e, t, n) {
  if (!Te(e[e.length - 1], t)) return !1;
  let r = e.length - 2, i = n.length - 1;
  for (; r >= 0 && i >= 0; )
    Te(e[r], n[i]) && (r -= 1), i -= 1;
  return r === -1;
}
function _t(e, t, n) {
  const r = [];
  for (const { selectors: i, settings: s } of e) for (const o of i) if (vt(o, t, n)) {
    r.push(s);
    break;
  }
  return r;
}
function Ie(e, t, n, r = Be) {
  const i = Object.entries(n.themes).filter((c) => c[1]).map((c) => ({
    color: c[0],
    theme: c[1]
  })), s = i.map((c) => {
    const m = r(e, t, {
      ...n,
      theme: c.theme
    });
    return {
      tokens: m,
      state: $(m),
      theme: typeof c.theme == "string" ? c.theme : c.theme.name
    };
  }), o = Nt(...s.map((c) => c.tokens)), a = o[0].map((c, m) => c.map((f, u) => {
    const h = {
      content: f.content,
      variants: {},
      offset: f.offset
    };
    return "includeExplanation" in n && n.includeExplanation && (h.explanation = f.explanation), o.forEach((d, T) => {
      const { content: b, explanation: p, offset: g, ...y } = d[m][u];
      h.variants[i[T].color] = y;
    }), h;
  })), l = s[0].state ? new J(Object.fromEntries(s.map((c) => [c.theme, c.state?.getInternalStack(c.theme)])), s[0].state.lang) : void 0;
  return l && V(a, l), a;
}
function Nt(...e) {
  const t = e.map(() => []), n = e.length;
  for (let r = 0; r < e[0].length; r++) {
    const i = e.map((l) => l[r]), s = t.map(() => []);
    t.forEach((l, c) => l.push(s[c]));
    const o = i.map(() => 0), a = i.map((l) => l[0]);
    for (; a.every((l) => l); ) {
      const l = Math.min(...a.map((c) => c.content.length));
      for (let c = 0; c < n; c++) {
        const m = a[c];
        m.content.length === l ? (s[c].push(m), o[c] += 1, a[c] = i[c][o[c]]) : (s[c].push({
          ...m,
          content: m.content.slice(0, l)
        }), a[c] = {
          ...m,
          content: m.content.slice(l),
          offset: m.offset + l
        });
      }
    }
  }
  return t;
}
function De(e, t) {
  if (!t) return e;
  e.properties ||= {}, e.properties.class ||= [], typeof e.properties.class == "string" && (e.properties.class = e.properties.class.split(/\s+/g)), Array.isArray(e.properties.class) || (e.properties.class = []);
  const n = Array.isArray(t) ? t : t.split(/\s+/g);
  for (const r of n) r && !e.properties.class.includes(r) && e.properties.class.push(r);
  return e;
}
function Ct(e) {
  const t = z(e, !0).map(([i]) => i);
  function n(i) {
    if (i === e.length) return {
      line: t.length - 1,
      character: t[t.length - 1].length
    };
    let s = i, o = 0;
    for (const a of t) {
      if (s < a.length) break;
      s -= a.length, o++;
    }
    return {
      line: o,
      character: s
    };
  }
  function r(i, s) {
    let o = 0;
    for (let a = 0; a < i; a++) o += t[a].length;
    return o += s, o;
  }
  return {
    lines: t,
    indexToPos: n,
    posToIndex: r
  };
}
function Ue(e, t, n) {
  const r = /* @__PURE__ */ new Set();
  for (const s of e.matchAll(/:?lang=["']([^"']+)["']/g)) {
    const o = s[1].toLowerCase().trim();
    o && r.add(o);
  }
  for (const s of e.matchAll(/(?:```|~~~)([\w-]+)/g)) {
    const o = s[1].toLowerCase().trim();
    o && r.add(o);
  }
  for (const s of e.matchAll(/\\begin\{([\w-]+)\}/g)) {
    const o = s[1].toLowerCase().trim();
    o && r.add(o);
  }
  for (const s of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)) {
    const o = s[1].toLowerCase().trim(), a = o.includes("/") ? o.split("/").pop() : o;
    a && r.add(a);
  }
  if (!n) return Array.from(r);
  const i = n.getBundledLanguages();
  return Array.from(r).filter((s) => s && i[s]);
}
const fe = "light-dark()", xt = ["color", "background-color"];
function At(e, t) {
  let n = 0;
  const r = [];
  for (const i of t)
    i > n && r.push({
      ...e,
      content: e.content.slice(n, i),
      offset: e.offset + n
    }), n = i;
  return n < e.content.length && r.push({
    ...e,
    content: e.content.slice(n),
    offset: e.offset + n
  }), r;
}
function Ot(e, t) {
  const n = Array.from(t instanceof Set ? t : new Set(t)).sort((r, i) => r - i);
  return n.length ? e.map((r) => r.flatMap((i) => {
    const s = n.filter((o) => i.offset < o && o < i.offset + i.content.length).map((o) => o - i.offset).sort((o, a) => o - a);
    return s.length ? At(i, s) : i;
  })) : e;
}
function Mt(e, t, n, r, i = "css-vars") {
  const s = {
    content: e.content,
    explanation: e.explanation,
    offset: e.offset
  }, o = t.map((m) => D(e.variants[m])), a = new Set(o.flatMap((m) => Object.keys(m))), l = {}, c = (m, f) => {
    const u = f === "color" ? "" : f === "background-color" ? "-bg" : `-${f}`;
    return n + t[m] + (f === "color" ? "" : u);
  };
  return o.forEach((m, f) => {
    for (const u of a) {
      const h = m[u] || "inherit";
      if (f === 0 && r && xt.includes(u)) if (r === fe && o.length > 1) {
        const d = t.findIndex((b) => b === "light"), T = t.findIndex((b) => b === "dark");
        if (d === -1 || T === -1) throw new w('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
        l[u] = `light-dark(${o[d][u] || "inherit"}, ${o[T][u] || "inherit"})`, i === "css-vars" && (l[c(f, u)] = h);
      } else l[u] = h;
      else i === "css-vars" && (l[c(f, u)] = h);
    }
  }), s.htmlStyle = l, s;
}
function D(e) {
  const t = {};
  if (e.color && (t.color = e.color), e.bgColor && (t["background-color"] = e.bgColor), e.fontStyle) {
    e.fontStyle & N.Italic && (t["font-style"] = "italic"), e.fontStyle & N.Bold && (t["font-weight"] = "bold");
    const n = [];
    e.fontStyle & N.Underline && n.push("underline"), e.fontStyle & N.Strikethrough && n.push("line-through"), n.length && (t["text-decoration"] = n.join(" "));
  }
  return t;
}
function se(e) {
  return typeof e == "string" ? e : Object.entries(e).map(([t, n]) => `${t}:${n}`).join(";");
}
function Pt() {
  const e = /* @__PURE__ */ new WeakMap();
  function t(n) {
    if (!e.has(n.meta)) {
      let i = function(o) {
        if (typeof o == "number") {
          if (o < 0 || o > n.source.length) throw new w(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);
          return {
            ...r.indexToPos(o),
            offset: o
          };
        } else {
          const a = r.lines[o.line];
          if (a === void 0) throw new w(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);
          let l = o.character;
          if (l < 0 && (l = a.length + l), l < 0 || l > a.length) throw new w(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);
          return {
            ...o,
            character: l,
            offset: r.posToIndex(o.line, l)
          };
        }
      };
      const r = Ct(n.source), s = (n.options.decorations || []).map((o) => ({
        ...o,
        start: i(o.start),
        end: i(o.end)
      }));
      jt(s), e.set(n.meta, {
        decorations: s,
        converter: r,
        source: n.source
      });
    }
    return e.get(n.meta);
  }
  return {
    name: "shiki:decorations",
    tokens(n) {
      if (this.options.decorations?.length)
        return Ot(n, t(this).decorations.flatMap((r) => [r.start.offset, r.end.offset]));
    },
    code(n) {
      if (!this.options.decorations?.length) return;
      const r = t(this), i = Array.from(n.children).filter((m) => m.type === "element" && m.tagName === "span");
      if (i.length !== r.converter.lines.length) throw new w(`Number of lines in code element (${i.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);
      function s(m, f, u, h) {
        const d = i[m];
        let T = "", b = -1, p = -1;
        if (f === 0 && (b = 0), u === 0 && (p = 0), u === Number.POSITIVE_INFINITY && (p = d.children.length), b === -1 || p === -1) for (let y = 0; y < d.children.length; y++)
          T += Ge(d.children[y]), b === -1 && T.length === f && (b = y + 1), p === -1 && T.length === u && (p = y + 1);
        if (b === -1) throw new w(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);
        if (p === -1) throw new w(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);
        const g = d.children.slice(b, p);
        if (!h.alwaysWrap && g.length === d.children.length) a(d, h, "line");
        else if (!h.alwaysWrap && g.length === 1 && g[0].type === "element") a(g[0], h, "token");
        else {
          const y = {
            type: "element",
            tagName: "span",
            properties: {},
            children: g
          };
          a(y, h, "wrapper"), d.children.splice(b, g.length, y);
        }
      }
      function o(m, f) {
        i[m] = a(i[m], f, "line");
      }
      function a(m, f, u) {
        const h = f.properties || {}, d = f.transform || ((T) => T);
        return m.tagName = f.tagName || "span", m.properties = {
          ...m.properties,
          ...h,
          class: m.properties.class
        }, f.properties?.class && De(m, f.properties.class), m = d(m, u) || m, m;
      }
      const l = [], c = r.decorations.sort((m, f) => f.start.offset - m.start.offset || m.end.offset - f.end.offset);
      for (const m of c) {
        const { start: f, end: u } = m;
        if (f.line === u.line) s(f.line, f.character, u.character, m);
        else if (f.line < u.line) {
          s(f.line, f.character, Number.POSITIVE_INFINITY, m);
          for (let h = f.line + 1; h < u.line; h++) l.unshift(() => o(h, m));
          s(u.line, 0, u.character, m);
        }
      }
      l.forEach((m) => m());
    }
  };
}
function jt(e) {
  for (let t = 0; t < e.length; t++) {
    const n = e[t];
    if (n.start.offset > n.end.offset) throw new w(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);
    for (let r = t + 1; r < e.length; r++) {
      const i = e[r], s = n.start.offset <= i.start.offset && i.start.offset < n.end.offset, o = n.start.offset < i.end.offset && i.end.offset <= n.end.offset, a = i.start.offset <= n.start.offset && n.start.offset < i.end.offset, l = i.start.offset < n.end.offset && n.end.offset <= i.end.offset;
      if (s || o || a || l) {
        if (s && o || a && l || a && n.start.offset === n.end.offset || o && i.start.offset === i.end.offset) continue;
        throw new w(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(i.start)} intersect.`);
      }
    }
  }
}
function Ge(e) {
  return e.type === "text" ? e.value : e.type === "element" ? e.children.map(Ge).join("") : "";
}
const Et = [/* @__PURE__ */ Pt()];
function U(e) {
  const t = $t(e.transformers || []);
  return [
    ...t.pre,
    ...t.normal,
    ...t.post,
    ...Et
  ];
}
function $t(e) {
  const t = [], n = [], r = [];
  for (const i of e) switch (i.enforce) {
    case "pre":
      t.push(i);
      break;
    case "post":
      n.push(i);
      break;
    default:
      r.push(i);
  }
  return {
    pre: t,
    post: n,
    normal: r
  };
}
var M = [
  "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 Ht(e, t) {
  const n = e.indexOf("\x1B", t);
  if (n !== -1 && e[n + 1] === "[") {
    const r = e.indexOf("m", n);
    if (r !== -1) return {
      sequence: e.substring(n + 2, r).split(";"),
      startPosition: n,
      position: r + 1
    };
  }
  return { position: e.length };
}
function we(e) {
  const t = e.shift();
  if (t === "2") {
    const n = e.splice(0, 3).map((r) => Number.parseInt(r));
    return n.length !== 3 || n.some((r) => Number.isNaN(r)) ? void 0 : {
      type: "rgb",
      rgb: n
    };
  } else if (t === "5") {
    const n = e.shift();
    if (n) return {
      type: "table",
      index: Number(n)
    };
  }
}
function Bt(e) {
  const t = [];
  for (; e.length > 0; ) {
    const n = e.shift();
    if (!n) continue;
    const r = Number.parseInt(n);
    if (!Number.isNaN(r))
      if (r === 0) t.push({ type: "resetAll" });
      else if (r <= 9)
        Z[r] && t.push({
          type: "setDecoration",
          value: Z[r]
        });
      else if (r <= 29) {
        const i = Z[r - 20];
        i && (t.push({
          type: "resetDecoration",
          value: i
        }), i === "dim" && t.push({
          type: "resetDecoration",
          value: "bold"
        }));
      } else if (r <= 37) t.push({
        type: "setForegroundColor",
        value: {
          type: "named",
          name: M[r - 30]
        }
      });
      else if (r === 38) {
        const i = we(e);
        i && t.push({
          type: "setForegroundColor",
          value: i
        });
      } else if (r === 39) t.push({ type: "resetForegroundColor" });
      else if (r <= 47) t.push({
        type: "setBackgroundColor",
        value: {
          type: "named",
          name: M[r - 40]
        }
      });
      else if (r === 48) {
        const i = we(e);
        i && t.push({
          type: "setBackgroundColor",
          value: i
        });
      } else r === 49 ? t.push({ type: "resetBackgroundColor" }) : r === 53 ? t.push({
        type: "setDecoration",
        value: "overline"
      }) : r === 55 ? t.push({
        type: "resetDecoration",
        value: "overline"
      }) : r >= 90 && r <= 97 ? t.push({
        type: "setForegroundColor",
        value: {
          type: "named",
          name: M[r - 90 + 8]
        }
      }) : r >= 100 && r <= 107 && t.push({
        type: "setBackgroundColor",
        value: {
          type: "named",
          name: M[r - 100 + 8]
        }
      });
  }
  return t;
}
function It() {
  let e = null, t = null, n = /* @__PURE__ */ new Set();
  return { parse(r) {
    const i = [];
    let s = 0;
    do {
      const o = Ht(r, s), a = o.sequence ? r.substring(s, o.startPosition) : r.substring(s);
      if (a.length > 0 && i.push({
        value: a,
        foreground: e,
        background: t,
        decorations: new Set(n)
      }), o.sequence) {
        const l = Bt(o.sequence);
        for (const c of l) c.type === "resetAll" ? (e = null, t = null, n.clear()) : c.type === "resetForegroundColor" ? e = null : c.type === "resetBackgroundColor" ? t = null : c.type === "resetDecoration" && n.delete(c.value);
        for (const c of l) c.type === "setForegroundColor" ? e = c.value : c.type === "setBackgroundColor" ? t = c.value : c.type === "setDecoration" && n.add(c.value);
      }
      s = o.position;
    } while (s < r.length);
    return i;
  } };
}
var Dt = {
  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 Ut(e = Dt) {
  function t(a) {
    return e[a];
  }
  function n(a) {
    return `#${a.map((l) => Math.max(0, Math.min(l, 255)).toString(16).padStart(2, "0")).join("")}`;
  }
  let r;
  function i() {
    if (r) return r;
    r = [];
    for (let c = 0; c < M.length; c++) r.push(t(M[c]));
    let a = [
      0,
      95,
      135,
      175,
      215,
      255
    ];
    for (let c = 0; c < 6; c++) for (let m = 0; m < 6; m++) for (let f = 0; f < 6; f++) r.push(n([
      a[c],
      a[m],
      a[f]
    ]));
    let l = 8;
    for (let c = 0; c < 24; c++, l += 10) r.push(n([
      l,
      l,
      l
    ]));
    return r;
  }
  function s(a) {
    return i()[a];
  }
  function o(a) {
    switch (a.type) {
      case "named":
        return t(a.name);
      case "rgb":
        return n(a.rgb);
      case "table":
        return s(a.index);
    }
  }
  return { value: o };
}
const Gt = {
  black: "#000000",
  red: "#cd3131",
  green: "#0DBC79",
  yellow: "#E5E510",
  blue: "#2472C8",
  magenta: "#BC3FBC",
  cyan: "#11A8CD",
  white: "#E5E5E5",
  brightBlack: "#666666",
  brightRed: "#F14C4C",
  brightGreen: "#23D18B",
  brightYellow: "#F5F543",
  brightBlue: "#3B8EEA",
  brightMagenta: "#D670D6",
  brightCyan: "#29B8DB",
  brightWhite: "#FFFFFF"
};
function Wt(e, t, n) {
  const r = I(e, n), i = z(t), s = Ut(Object.fromEntries(M.map((a) => {
    const l = `terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;
    return [a, e.colors?.[l] || Gt[a]];
  }))), o = It();
  return i.map((a) => o.parse(a[0]).map((l) => {
    let c, m;
    l.decorations.has("reverse") ? (c = l.background ? s.value(l.background) : e.bg, m = l.foreground ? s.value(l.foreground) : e.fg) : (c = l.foreground ? s.value(l.foreground) : e.fg, m = l.background ? s.value(l.background) : void 0), c = A(c, r), m = A(m, r), l.decorations.has("dim") && (c = Rt(c));
    let f = N.None;
    return l.decorations.has("bold") && (f |= N.Bold), l.decorations.has("italic") && (f |= N.Italic), l.decorations.has("underline") && (f |= N.Underline), l.decorations.has("strikethrough") && (f |= N.Strikethrough), {
      content: l.value,
      offset: a[1],
      color: c,
      bgColor: m,
      fontStyle: f
    };
  }));
}
function Rt(e) {
  const t = e.match(/#([0-9a-f]{3,8})/i);
  if (t) {
    const r = t[1];
    if (r.length === 8) {
      const i = Math.round(Number.parseInt(r.slice(6, 8), 16) / 2).toString(16).padStart(2, "0");
      return `#${r.slice(0, 6)}${i}`;
    } else {
      if (r.length === 6) return `#${r}80`;
      if (r.length === 4) {
        const i = r[0], s = r[1], o = r[2], a = r[3];
        return `#${i}${i}${s}${s}${o}${o}${Math.round(Number.parseInt(`${a}${a}`, 16) / 2).toString(16).padStart(2, "0")}`;
      } else if (r.length === 3) {
        const i = r[0], s = r[1], o = r[2];
        return `#${i}${i}${s}${s}${o}${o}80`;
      }
    }
  }
  const n = e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
  return n ? `var(${n[1]}-dim)` : e;
}
function ae(e, t, n = {}) {
  const r = e.resolveLangAlias(n.lang || "text"), { theme: i = e.getLoadedThemes()[0] } = n;
  if (!R(r) && !F(i) && r === "ansi") {
    const { theme: s } = e.setTheme(i);
    return Wt(s, t, n);
  }
  return Be(e, t, n);
}
function G(e, t, n) {
  let r, i, s, o, a, l;
  if ("themes" in n) {
    const { defaultColor: c = "light", cssVariablePrefix: m = "--shiki-", colorsRendering: f = "css-vars" } = n, u = Object.entries(n.themes).filter((p) => p[1]).map((p) => ({
      color: p[0],
      theme: p[1]
    })).sort((p, g) => p.color === c ? -1 : g.color === c ? 1 : 0);
    if (u.length === 0) throw new w("`themes` option must not be empty");
    const h = Ie(e, t, n, ae);
    if (l = $(h), c && fe !== c && !u.find((p) => p.color === c)) throw new w(`\`themes\` option must contain the defaultColor key \`${c}\``);
    const d = u.map((p) => e.getTheme(p.theme)), T = u.map((p) => p.color);
    s = h.map((p) => p.map((g) => Mt(g, T, m, c, f))), l && V(s, l);
    const b = u.map((p) => I(p.theme, n));
    i = Se(u, d, b, m, c, "fg", f), r = Se(u, d, b, m, c, "bg", f), o = `shiki-themes ${d.map((p) => p.name).join(" ")}`, a = c ? void 0 : [i, r].join(";");
  } else if ("theme" in n) {
    const c = I(n.theme, n);
    s = ae(e, t, n);
    const m = e.getTheme(n.theme);
    r = A(m.bg, c), i = A(m.fg, c), o = m.name, l = $(s);
  } else throw new w("Invalid options, either `theme` or `themes` must be provided");
  return {
    tokens: s,
    fg: i,
    bg: r,
    themeName: o,
    rootStyle: a,
    grammarState: l
  };
}
function Se(e, t, n, r, i, s, o) {
  return e.map((a, l) => {
    const c = A(t[l][s], n[l]) || "inherit", m = `${r + a.color}${s === "bg" ? "-bg" : ""}:${c}`;
    if (l === 0 && i) {
      if (i === fe && e.length > 1) {
        const f = e.findIndex((h) => h.color === "light"), u = e.findIndex((h) => h.color === "dark");
        if (f === -1 || u === -1) throw new w('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
        return `light-dark(${A(t[f][s], n[f]) || "inherit"}, ${A(t[u][s], n[u]) || "inherit"});${m}`;
      }
      return c;
    }
    return o === "css-vars" ? m : null;
  }).filter((a) => !!a).join(";");
}
function W(e, t, n, r = {
  meta: {},
  options: n,
  codeToHast: (i, s) => W(e, i, s),
  codeToTokens: (i, s) => G(e, i, s)
}) {
  let i = t;
  for (const d of U(n)) i = d.preprocess?.call(r, i, n) || i;
  let { tokens: s, fg: o, bg: a, themeName: l, rootStyle: c, grammarState: m } = G(e, i, n);
  const { mergeWhitespaces: f = !0, mergeSameStyleTokens: u = !1 } = n;
  f === !0 ? s = zt(s) : f === "never" && (s = Vt(s)), u && (s = Jt(s));
  const h = {
    ...r,
    get source() {
      return i;
    }
  };
  for (const d of U(n)) s = d.tokens?.call(h, s) || s;
  return Ft(s, {
    ...n,
    fg: o,
    bg: a,
    themeName: l,
    rootStyle: n.rootStyle === !1 ? !1 : n.rootStyle ?? c
  }, h, m);
}
function Ft(e, t, n, r = $(e)) {
  const i = U(t), s = [], o = {
    type: "root",
    children: []
  }, { structure: a = "classic", tabindex: l = "0" } = t, c = { class: `shiki ${t.themeName || ""}` };
  t.rootStyle !== !1 && (t.rootStyle != null ? c.style = t.rootStyle : c.style = `background-color:${t.bg};color:${t.fg}`), l !== !1 && l != null && (c.tabindex = l.toString());
  for (const [T, b] of Object.entries(t.meta || {})) T.startsWith("_") || (c[T] = b);
  let m = {
    type: "element",
    tagName: "pre",
    properties: c,
    children: [],
    data: t.data
  }, f = {
    type: "element",
    tagName: "code",
    properties: {},
    children: s
  };
  const u = [], h = {
    ...n,
    structure: a,
    addClassToHast: De,
    get source() {
      return n.source;
    },
    get tokens() {
      return e;
    },
    get options() {
      return t;
    },
    get root() {
      return o;
    },
    get pre() {
      return m;
    },
    get code() {
      return f;
    },
    get lines() {
      return u;
    }
  };
  if (e.forEach((T, b) => {
    b && (a === "inline" ? o.children.push({
      type: "element",
      tagName: "br",
      properties: {},
      children: []
    }) : a === "classic" && s.push({
      type: "text",
      value: `
`
    }));
    let p = {
      type: "element",
      tagName: "span",
      properties: { class: "line" },
      children: []
    }, g = 0;
    for (const y of T) {
      let k = {
        type: "element",
        tagName: "span",
        properties: { ...y.htmlAttrs },
        children: [{
          type: "text",
          value: y.content
        }]
      };
      const v = se(y.htmlStyle || D(y));
      v && (k.properties.style = v);
      for (const _ of i) k = _?.span?.call(h, k, b + 1, g, p, y) || k;
      a === "inline" ? o.children.push(k) : a === "classic" && p.children.push(k), g += y.content.length;
    }
    if (a === "classic") {
      for (const y of i) p = y?.line?.call(h, p, b + 1) || p;
      u.push(p), s.push(p);
    } else a === "inline" && u.push(p);
  }), a === "classic") {
    for (const T of i) f = T?.code?.call(h, f) || f;
    m.children.push(f);
    for (const T of i) m = T?.pre?.call(h, m) || m;
    o.children.push(m);
  } else if (a === "inline") {
    const T = [];
    let b = {
      type: "element",
      tagName: "span",
      properties: { class: "line" },
      children: []
    };
    for (const g of o.children) g.type === "element" && g.tagName === "br" ? (T.push(b), b = {
      type: "element",
      tagName: "span",
      properties: { class: "line" },
      children: []
    }) : (g.type === "element" || g.type === "text") && b.children.push(g);
    T.push(b);
    let p = {
      type: "element",
      tagName: "code",
      properties: {},
      children: T
    };
    for (const g of i) p = g?.code?.call(h, p) || p;
    o.children = [];
    for (let g = 0; g < p.children.length; g++) {
      g > 0 && o.children.push({
        type: "element",
        tagName: "br",
        properties: {},
        children: []
      });
      const y = p.children[g];
      y.type === "element" && o.children.push(...y.children);
    }
  }
  let d = o;
  for (const T of i) d = T?.root?.call(h, d) || d;
  return r && V(d, r), d;
}
function zt(e) {
  return e.map((t) => {
    const n = [];
    let r = "", i;
    return t.forEach((s, o) => {
      const a = !(s.fontStyle && (s.fontStyle & N.Underline || s.fontStyle & N.Strikethrough));
      a && s.content.match(/^\s+$/) && t[o + 1] ? (i === void 0 && (i = s.offset), r += s.content) : r ? (a ? n.push({
        ...s,
        offset: i,
        content: r + s.content
      }) : n.push({
        content: r,
        offset: i
      }, s), i = void 0, r = "") : n.push(s);
    }), n;
  });
}
function Vt(e) {
  return e.map((t) => t.flatMap((n) => {
    if (n.content.match(/^\s+$/)) return n;
    const r = n.content.match(/^(\s*)(.*?)(\s*)$/);
    if (!r) return n;
    const [, i, s, o] = r;
    if (!i && !o) return n;
    const a = [{
      ...n,
      offset: n.offset + i.length,
      content: s
    }];
    return i && a.unshift({
      content: i,
      offset: n.offset
    }), o && a.push({
      content: o,
      offset: n.offset + i.length + s.length
    }), a;
  }));
}
function Jt(e) {
  return e.map((t) => {
    const n = [];
    for (const r of t) {
      if (n.length === 0) {
        n.push({ ...r });
        continue;
      }
      const i = n[n.length - 1], s = se(i.htmlStyle || D(i)), o = se(r.htmlStyle || D(r)), a = i.fontStyle && (i.fontStyle & N.Underline || i.fontStyle & N.Strikethrough), l = r.fontStyle && (r.fontStyle & N.Underline || r.fontStyle & N.Strikethrough);
      !a && !l && s === o ? i.content += r.content : n.push({ ...r });
    }
    return n;
  });
}
const Kt = st;
function Yt(e, t, n) {
  const r = {
    meta: {},
    options: n,
    codeToHast: (s, o) => W(e, s, o),
    codeToTokens: (s, o) => G(e, s, o)
  };
  let i = Kt(W(e, t, n, r));
  for (const s of U(n)) i = s.postprocess?.call(r, i, n) || i;
  return i;
}
async function qt(e) {
  const t = await yt(e);
  return {
    getLastGrammarState: (...n) => wt(t, ...n),
    codeToTokensBase: (n, r) => ae(t, n, r),
    codeToTokensWithThemes: (n, r) => Ie(t, n, r),
    codeToTokens: (n, r) => G(t, n, r),
    codeToHast: (n, r) => W(t, n, r),
    codeToHtml: (n, r) => Yt(t, n, r),
    getBundledLanguages: () => ({}),
    getBundledThemes: () => ({}),
    ...t,
    getInternalContext: () => t
  };
}
function Xt(e) {
  const t = e.langs, n = e.themes, r = e.engine;
  async function i(s) {
    function o(f) {
      if (typeof f == "string") {
        if (f = s.langAlias?.[f] || f, oe(f)) return [];
        const u = t[f];
        if (!u) throw new w(`Language \`${f}\` is not included in this bundle. You may want to load it from external source.`);
        return u;
      }
      return f;
    }
    function a(f) {
      if (Me(f)) return "none";
      if (typeof f == "string") {
        const u = n[f];
        if (!u) throw new w(`Theme \`${f}\` is not included in this bundle. You may want to load it from external source.`);
        return u;
      }
      return f;
    }
    const l = (s.themes ?? []).map((f) => a(f)), c = (s.langs ?? []).map((f) => o(f)), m = await qt({
      engine: s.engine ?? r(),
      ...s,
      themes: l,
      langs: c
    });
    return {
      ...m,
      loadLanguage(...f) {
        return m.loadLanguage(...f.map(o));
      },
      loadTheme(...f) {
        return m.loadTheme(...f.map(a));
      },
      getBundledLanguages() {
        return t;
      },
      getBundledThemes() {
        return n;
      }
    };
  }
  return i;
}
function Qt(e) {
  let t;
  async function n(r = {}) {
    if (t) {
      const i = await t;
      return await Promise.all([i.loadTheme(...r.themes || []), i.loadLanguage(...r.langs || [])]), i;
    } else {
      t = e({
        ...r,
        themes: [],
        langs: []
      });
      const i = await t;
      return await Promise.all([i.loadTheme(...r.themes || []), i.loadLanguage(...r.langs || [])]), i;
    }
  }
  return n;
}
function Zt(e, t) {
  const n = Qt(e);
  async function r(i, s) {
    const o = await n({
      langs: [s.lang],
      themes: "theme" in s ? [s.theme] : Object.values(s.themes)
    }), a = await t?.guessEmbeddedLanguages?.(i, s.lang, o);
    return a && await o.loadLanguage(...a), o;
  }
  return {
    getSingletonHighlighter(i) {
      return n(i);
    },
    async codeToHtml(i, s) {
      return (await r(i, s)).codeToHtml(i, s);
    },
    async codeToHast(i, s) {
      return (await r(i, s)).codeToHast(i, s);
    },
    async codeToTokens(i, s) {
      return (await r(i, s)).codeToTokens(i, s);
    },
    async codeToTokensBase(i, s) {
      return (await r(i, s)).codeToTokensBase(i, s);
    },
    async codeToTokensWithThemes(i, s) {
      return (await r(i, s)).codeToTokensWithThemes(i, s);
    },
    async getLastGrammarState(i, s) {
      return (await n({
        langs: [s.lang],
        themes: [s.theme]
      })).getLastGrammarState(i, s);
    }
  };
}
var Le = Object.prototype.hasOwnProperty;
function ke(e, t, n) {
  for (n of e.keys())
    if (E(n, t)) return n;
}
function E(e, t) {
  var n, r, i;
  if (e === t) return !0;
  if (e && t && (n = e.constructor) === t.constructor) {
    if (n === Date) return e.getTime() === t.getTime();
    if (n === RegExp) return e.toString() === t.toString();
    if (n === Array) {
      if ((r = e.length) === t.length)
        for (; r-- && E(e[r], t[r]); ) ;
      return r === -1;
    }
    if (n === Set) {
      if (e.size !== t.size)
        return !1;
      for (r of e)
        if (i = r, i && typeof i == "object" && (i = ke(t, i), !i) || !t.has(i)) return !1;
      return !0;
    }
    if (n === Map) {
      if (e.size !== t.size)
        return !1;
      for (r of e)
        if (i = r[0], i && typeof i == "object" && (i = ke(t, i), !i) || !E(r[1], t.get(i)))
          return !1;
      return !0;
    }
    if (n === ArrayBuffer)
      e = new Uint8Array(e), t = new Uint8Array(t);
    else if (n === DataView) {
      if ((r = e.byteLength) === t.byteLength)
        for (; r-- && e.getInt8(r) === t.getInt8(r); ) ;
      return r === -1;
    }
    if (ArrayBuffer.isView(e)) {
      if ((r = e.byteLength) === t.byteLength)
        for (; r-- && e[r] === t[r]; ) ;
      return r === -1;
    }
    if (!n || typeof e == "object") {
      r = 0;
      for (n in e)
        if (Le.call(e, n) && ++r && !Le.call(t, n) || !(n in t) || !E(e[n], t[n])) return !1;
      return Object.keys(t).length === r;
    }
  }
  return e !== e && t !== t;
}
var ee = (e) => {
  const t = xe(e);
  return e !== t.current && !E(e, t.current) && (t.current = e), t.current;
}, en = (e, t, n) => {
  const r = Date.now();
  clearTimeout(t.current.timeoutId);
  const i = Math.max(0, t.current.nextAllowedTime - r);
  t.current.timeoutId = setTimeout(() => {
    e().catch(console.error), t.current.nextAllowedTime = r + n;
  }, i);
}, We = "plaintext", ve = (e) => e == null ? [] : Array.isArray(e) ? e : [e], tn = (e) => e == null ? null : typeof e == "string" ? `s:${e}` : `o:${e.name}::${e.scopeName}`, _e = (e) => {
  const t = /* @__PURE__ */ new Set(), n = [];
  for (const r of e) {
    const i = tn(r);
    i == null || t.has(i) || (t.add(i), n.push(r));
  }
  return n;
}, nn = (e, t) => e == null ? !1 : typeof e == "string" ? e in t : typeof e.name == "string" && typeof e.scopeName == "string", rn = (e, t) => oe(e) || t.includes(e) ? e : We, sn = (e, t, n, r) => {
  const i = ve(t), s = ve(r), o = [...i, ...s];
  let a = We, l;
  if (e == null || typeof e == "string" && !e.trim())
    return {
      languageId: a,
      langsToLoad: _e([...s, ...i])
    };
  if (typeof e == "object")
    a = e.name, l = e;
  else {
    const c = e.toLowerCase(), m = (u) => u?.toLowerCase() === c, f = o.find(
      (u) => typeof u == "object" && u != null && !!(m(u.name) || m(u.scopeName) || m(u.scopeName?.split(".").pop()) || u.aliases?.some(m) || u.fileTypes?.some(m))
    );
    f ? (a = f.name || e, l = f) : n?.[e] ? (a = n[e], l = n[e]) : (a = e, l = e);
  }
  return {
    languageId: a,
    langsToLoad: _e([
      l,
      ...s,
      ...i
    ])
  };
}, Ne = (e) => typeof e == "object" && e !== null && "tokenColors" in e && Array.isArray(e.tokenColors);
function an(e) {
  const t = Ne(e), n = typeof e == "object" && e !== null && !t, r = typeof e == "object" && e !== null && !t && Object.entries(e).some(
    ([i, s]) => i.trim() !== "" && (typeof s == "string" && s.trim() !== "" || Ne(s))
  );
  return n ? {
    isMultiTheme: !0,
    themeId: r ? `multi-${Object.values(e).map(
      (s) => (typeof s == "string" ? s : s?.name) || "custom"
    ).sort().join("-")}` : "multi-default",
    multiTheme: r ? e : null,
    themesToLoad: r ? Object.values(e) : []
  } : {
    isMultiTheme: !1,
    themeId: typeof e == "string" ? e : e?.name || "custom",
    singleTheme: e,
    themesToLoad: [e]
  };
}
function on(e = 1) {
  return {
    name: "react-shiki:line-numbers",
    code(t) {
      if (this.addClassToHast(t, "has-line-numbers"), this.addClassToHast(t, "rs-has-line-numbers"), e !== 1) {
        const n = t.properties?.style || "", r = n ? `${n}; --line-start: ${e}` : `--line-start: ${e}`;
        t.properties = {
          ...t.properties,
          style: r
        };
      }
    },
    line(t) {
      return this.addClassToHast(t, "line-numbers"), this.addClassToHast(t, "rs-line-number"), t;
    }
  };
}
var Ce = {
  light: "github-light",
  dark: "github-dark"
}, ln = (e, t) => e.isMultiTheme ? {
  themes: e.multiTheme ?? Ce,
  defaultColor: t.defaultColor,
  cssVariablePrefix: t.cssVariablePrefix
} : {
  theme: e.singleTheme ?? Ce.dark
}, cn = (e) => {
  const t = [...e.transformers || []];
  return e.showLineNumbers && t.push(on(e.startingLineNumber)), t;
}, fn = ({
  languageId: e,
  resolvedTheme: t,
  options: n
}) => {
  const {
    defaultColor: r,
    cssVariablePrefix: i,
    showLineNumbers: s,
    startingLineNumber: o,
    transformers: a,
    ...l
  } = n;
  return {
    lang: e,
    ...ln(t, n),
    ...l,
    transformers: cn(n)
  };
}, mn = (e, t, n) => {
  const r = n.getBundledLanguages();
  return Ue(e).flatMap(
    (i) => r[i] ?? []
  );
}, un = (e, t, n, r = {}, i) => {
  const [s, o] = et(null), a = ee(t), l = ee(n), c = ee(r), { languageId: m, langsToLoad: f } = Q(
    () => sn(
      a,
      c.customLanguages,
      c.langAlias,
      c.preloadLanguages
    ),
    [
      a,
      c.customLanguages,
      c.preloadLanguages,
      c.langAlias
    ]
  ), u = Q(
    () => an(l),
    [l]
  ), { themesToLoad: h } = u, d = xe({
    nextAllowedTime: 0,
    timeoutId: void 0
  }), T = Q(
    () => fn({
      languageId: m,
      resolvedTheme: u,
      options: c
    }),
    [m, u, c]
  );
  return tt(() => {
    let b = !0;
    const p = async () => {
      if (!m) return;
      const y = c.highlighter ? c.highlighter : await i(
        f,
        h,
        c.engine
      );
      if (!c.highlighter) {
        const _ = mn(
          e,
          m,
          y
        );
        _.length > 0 && await y.loadLanguage(..._);
      }
      const k = rn(
        m,
        y.getLoadedLanguages()
      ), v = { ...T, lang: k };
      if (b) {
        const _ = c.outputFormat === "html" ? y.codeToHtml(e, v) : at(y.codeToHast(e, v), {
          jsx: ne,
          jsxs: Ae,
          Fragment: nt
        });
        o(_);
      }
    }, { delay: g } = c;
    return g ? en(p, d, g) : p().catch(console.error), () => {
      b = !1, clearTimeout(d.current.timeoutId);
    };
  }, [
    e,
    T,
    c.delay,
    c.highlighter,
    f,
    h
  ]), s;
};
function Re(e, { insertAt: t } = {}) {
  if (!e || typeof document > "u") return;
  const n = document.head || document.getElementsByTagName("head")[0], r = document.createElement("style");
  r.type = "text/css", t === "top" && n.firstChild ? n.insertBefore(r, n.firstChild) : n.appendChild(r), r.styleSheet ? r.styleSheet.cssText = e : r.appendChild(document.createTextNode(e));
}
Re(`@layer base {
  .rs-root {
    position: relative;
  }
  .rs-default-styles pre {
    overflow: auto;
    border-radius: 0.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
  }
  .rs-language-label {
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    letter-spacing: -0.05em;
    color: rgba(107, 114, 128, 0.85);
  }
}
`);
Re(`@layer base {
  .line-numbers::before,
  .rs-line-number::before {
    counter-increment: line-number;
    content: counter(line-number);
    display: inline-flex;
    justify-content: flex-end;
    align-items: flex-start;
    box-sizing: content-box;
    min-width: var(--rs-line-numbers-width, 2ch);
    padding-left: var(--rs-line-numbers-padding-left, 2ch);
    padding-right: var(--rs-line-numbers-padding-right, 2ch);
    color: var(--rs-line-numbers-foreground, rgba(107, 114, 128, 0.6));
    font-size: var(--rs-line-numbers-font-size, inherit);
    font-weight: var(--rs-line-numbers-font-weight, inherit);
    line-height: var(--rs-line-numbers-line-height, inherit);
    font-family: var(--rs-line-numbers-font-family, inherit);
    opacity: var(--rs-line-numbers-opacity, 1);
    user-select: none;
    pointer-events: none;
  }
  .has-line-numbers,
  .rs-has-line-numbers {
    counter-reset: line-number calc(var(--line-start, 1) - 1);
    --rs-line-numbers-foreground: var(--line-numbers-foreground, rgba(107, 114, 128, 0.5));
    --rs-line-numbers-width: var(--line-numbers-width, 2ch);
    --rs-line-numbers-padding-left: var(--line-numbers-padding-left, 0ch);
    --rs-line-numbers-padding-right: var(--line-numbers-padding-right, 2ch);
    --rs-line-numbers-font-size: var(--line-numbers-font-size, inherit);
    --rs-line-numbers-font-weight: var(--line-numbers-font-weight, inherit);
    --rs-line-numbers-line-height: var(--line-numbers-line-height, inherit);
    --rs-line-numbers-font-family: var(--line-numbers-font-family, inherit);
    --rs-line-numbers-opacity: var(--line-numbers-opacity, 1);
  }
}
`);
var hn = (e) => Ze(
  ({
    language: t,
    theme: n,
    delay: r,
    transformers: i,
    defaultColor: s,
    cssVariablePrefix: o,
    addDefaultStyles: a = !0,
    style: l,
    langStyle: c,
    className: m,
    langClassName: f,
    showLanguage: u = !0,
    showLineNumbers: h = !1,
    startingLineNumber: d = 1,
    children: T,
    as: b = "pre",
    customLanguages: p,
    preloadLanguages: g,
    ...y
  }, k) => {
    const v = {
      delay: r,
      transformers: i,
      customLanguages: p,
      preloadLanguages: g,
      showLineNumbers: h,
      defaultColor: s,
      cssVariablePrefix: o,
      startingLineNumber: d,
      ...y
    }, _ = typeof t == "object" ? t.name || null : t?.trim() || null, O = e(
      T,
      t,
      n,
      v
    ), H = typeof O == "string";
    return /* @__PURE__ */ Ae(
      b,
      {
        ref: k,
        "data-testid": "shiki-container",
        className: de(
          "rs-root",
          "not-prose",
          a && "rs-default-styles",
          m
        ),
        style: l,
        id: "shiki-container",
        children: [
          u && _ ? /* @__PURE__ */ ne(
            "span",
            {
              className: de(
                "rs-language-label",
                f
              ),
              style: c,
              id: "language-label",
              children: _
            }
          ) : null,
          H ? /* @__PURE__ */ ne("div", { dangerouslySetInnerHTML: { __html: O } }) : O
        ]
      }
    );
  }
), me = class extends Error {
  constructor(e) {
    super(e), this.name = "ShikiError";
  }
};
function dn() {
  return 2147483648;
}
function gn() {
  return typeof performance < "u" ? performance.now() : Date.now();
}
const pn = (e, t) => e + (t - e % t) % t;
async function yn(e) {
  let t, n;
  const r = {};
  function i(h) {
    n = h, r.HEAPU8 = new Uint8Array(h), r.HEAPU32 = new Uint32Array(h);
  }
  function s(h, d, T) {
    r.HEAPU8.copyWithin(h, d, d + T);
  }
  function o(h) {
    try {
      return t.grow(h - n.byteLength + 65535 >>> 16), i(t.buffer), 1;
    } catch {
    }
  }
  function a(h) {
    const d = r.HEAPU8.length;
    h = h >>> 0;
    const T = dn();
    if (h > T)
      return !1;
    for (let b = 1; b <= 4; b *= 2) {
      let p = d * (1 + 0.2 / b);
      p = Math.min(p, h + 100663296);
      const g = Math.min(T, pn(Math.max(h, p), 65536));
      if (o(g))
        return !0;
    }
    return !1;
  }
  const l = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
  function c(h, d, T = 1024) {
    const b = d + T;
    let p = d;
    for (; h[p] && !(p >= b); ) ++p;
    if (p - d > 16 && h.buffer && l)
      return l.decode(h.subarray(d, p));
    let g = "";
    for (; d < p; ) {
      let y = h[d++];
      if (!(y & 128)) {
        g += String.fromCharCode(y);
        continue;
      }
      const k = h[d++] & 63;
      if ((y & 224) === 192) {
        g += String.fromCharCode((y & 31) << 6 | k);
        continue;
      }
      const v = h[d++] & 63;
      if ((y & 240) === 224 ? y = (y & 15) << 12 | k << 6 | v : y = (y & 7) << 18 | k << 12 | v << 6 | h[d++] & 63, y < 65536)
        g += String.fromCharCode(y);
      else {
        const _ = y - 65536;
        g += String.fromCharCode(55296 | _ >> 10, 56320 | _ & 1023);
      }
    }
    return g;
  }
  function m(h, d) {
    return h ? c(r.HEAPU8, h, d) : "";
  }
  const f = {
    emscripten_get_now: gn,
    emscripten_memcpy_big: s,
    emscripten_resize_heap: a,
    fd_write: () => 0
  };
  async function u() {
    const d = await e({
      env: f,
      wasi_snapshot_preview1: f
    });
    t = d.memory, i(t.buffer), Object.assign(r, d), r.UTF8ToString = m;
  }
  return await u(), r;
}
var bn = Object.defineProperty, Tn = (e, t, n) => t in e ? bn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t, n) => Tn(e, typeof t != "symbol" ? t + "" : t, n);
let L = null;
function wn(e) {
  throw new me(e.UTF8ToString(e.getLastOnigError()));
}
class K {
  constructor(t) {
    S(this, "utf16Length"), S(this, "utf8Length"), S(this, "utf16Value"), S(this, "utf8Value"), S(this, "utf16OffsetToUtf8"), S(this, "utf8OffsetToUtf16");
    const n = t.length, r = K._utf8ByteLength(t), i = r !== n, s = i ? new Uint32Array(n + 1) : null;
    i && (s[n] = r);
    const o = i ? new Uint32Array(r + 1) : null;
    i && (o[r] = n);
    const a = new Uint8Array(r);
    let l = 0;
    for (let c = 0; c < n; c++) {
      const m = t.charCodeAt(c);
      let f = m, u = !1;
      if (m >= 55296 && m <= 56319 && c + 1 < n) {
        const h = t.charCodeAt(c + 1);
        h >= 56320 && h <= 57343 && (f = (m - 55296 << 10) + 65536 | h - 56320, u = !0);
      }
      i && (s[c] = l, u && (s[c + 1] = l), f <= 127 ? o[l + 0] = c : f <= 2047 ? (o[l + 0] = c, o[l + 1] = c) : f <= 65535 ? (o[l + 0] = c, o[l + 1] = c, o[l + 2] = c) : (o[l + 0] = c, o[l + 1] = c, o[l + 2] = c, o[l + 3] = c)), f <= 127 ? a[l++] = f : f <= 2047 ? (a[l++] = 192 | (f & 1984) >>> 6, a[l++] = 128 | (f & 63) >>> 0) : f <= 65535 ? (a[l++] = 224 | (f & 61440) >>> 12, a[l++] = 128 | (f & 4032) >>> 6, a[l++] = 128 | (f & 63) >>> 0) : (a[l++] = 240 | (f & 1835008) >>> 18, a[l++] = 128 | (f & 258048) >>> 12, a[l++] = 128 | (f & 4032) >>> 6, a[l++] = 128 | (f & 63) >>> 0), u && c++;
    }
    this.utf16Length = n, this.utf8Length = r, this.utf16Value = t, this.utf8Value = a, this.utf16OffsetToUtf8 = s, this.utf8OffsetToUtf16 = o;
  }
  static _utf8ByteLength(t) {
    let n = 0;
    for (let r = 0, i = t.length; r < i; r++) {
      const s = t.charCodeAt(r);
      let o = s, a = !1;
      if (s >= 55296 && s <= 56319 && r + 1 < i) {
        const l = t.charCodeAt(r + 1);
        l >= 56320 && l <= 57343 && (o = (s - 55296 << 10) + 65536 | l - 56320, a = !0);
      }
      o <= 127 ? n += 1 : o <= 2047 ? n += 2 : o <= 65535 ? n += 3 : n += 4, a && r++;
    }
    return n;
  }
  createString(t) {
    const n = t.omalloc(this.utf8Length);
    return t.HEAPU8.set(this.utf8Value, n), n;
  }
}
const Y = class C {
  constructor(t) {
    if (S(this, "id", ++C.LAST_ID), S(this, "_onigBinding"), S(this, "content"), S(this, "utf16Length"), S(this, "utf8Length"), S(this, "utf16OffsetToUtf8"), S(this, "utf8OffsetToUtf16"), S(this, "ptr"), !L)
      throw new me("Must invoke loadWasm first.");
    this._onigBinding = L, this.content = t;
    const n = new K(t);
    this.utf16Length = n.utf16Length, this.utf8Length = n.utf8Length, this.utf16OffsetToUtf8 = n.utf16OffsetToUtf8, this.utf8OffsetToUtf16 = n.utf8OffsetToUtf16, this.utf8Length < 1e4 && !C._sharedPtrInUse ? (C._sharedPtr || (C._sharedPtr = L.omalloc(1e4)), C._sharedPtrInUse = !0, L.HEAPU8.set(n.utf8Value, C._sharedPtr), this.ptr = C._sharedPtr) : this.ptr = n.createString(L);
  }
  convertUtf8OffsetToUtf16(t) {
    return this.utf8OffsetToUtf16 ? t < 0 ? 0 : t > this.utf8Length ? this.utf16Length : this.utf8OffsetToUtf16[t] : t;
  }
  convertUtf16OffsetToUtf8(t) {
    return this.utf16OffsetToUtf8 ? t < 0 ? 0 : t > this.utf16Length ? this.utf8Length : this.utf16OffsetToUtf8[t] : t;
  }
  dispose() {
    this.ptr === C._sharedPtr ? C._sharedPtrInUse = !1 : this._onigBinding.ofree(this.ptr);
  }
};
S(Y, "LAST_ID", 0);
S(Y, "_sharedPtr", 0);
S(Y, "_sharedPtrInUse", !1);
let Fe = Y;
class Sn {
  constructor(t) {
    if (S(this, "_onigBinding"), S(this, "_ptr"), !L)
      throw new me("Must invoke loadWasm first.");
    const n = [], r = [];
    for (let a = 0, l = t.length; a < l; a++) {
      const c = new K(t[a]);
      n[a] = c.createString(L), r[a] = c.utf8Length;
    }
    const i = L.omalloc(4 * t.length);
    L.HEAPU32.set(n, i / 4);
    const s = L.omalloc(4 * t.length);
    L.HEAPU32.set(r, s / 4);
    const o = L.createOnigScanner(i, s, t.length);
    for (let a = 0, l = t.length; a < l; a++)
      L.ofree(n[a]);
    L.ofree(s), L.ofree(i), o === 0 && wn(L), this._onigBinding = L, this._ptr = o;
  }
  dispose() {
    this._onigBinding.freeOnigScanner(this._ptr);
  }
  findNextMatchSync(t, n, r) {
    let i = 0;
    if (typeof r == "number" && (i = r), typeof t == "string") {
      t = new Fe(t);
      const s = this._findNextMatchSync(t, n, !1, i);
      return t.dispose(), s;
    }
    return this._findNextMatchSync(t, n, !1, i);
  }
  _findNextMatchSync(t, n, r, i) {
    const s = this._onigBinding, o = s.findNextOnigScannerMatch(this._ptr, t.id, t.ptr, t.utf8Length, t.convertUtf16OffsetToUtf8(n), i);
    if (o === 0)
      return null;
    const a = s.HEAPU32;
    let l = o / 4;
    const c = a[l++], m = a[l++], f = [];
    for (let u = 0; u < m; u++) {
      const h = t.convertUtf8OffsetToUtf16(a[l++]), d = t.convertUtf8OffsetToUtf16(a[l++]);
      f[u] = {
        start: h,
        end: d,
        length: d - h
      };
    }
    return {
      index: c,
      captureIndices: f
    };
  }
}
function Ln(e) {
  return typeof e.instantiator == "function";
}
function kn(e) {
  return typeof e.default == "function";
}
function vn(e) {
  return typeof e.data < "u";
}
function _n(e) {
  return typeof Response < "u" && e instanceof Response;
}
function Nn(e) {
  return typeof ArrayBuffer < "u" && (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) || typeof Buffer < "u" && Buffer.isBuffer?.(e) || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer || typeof Uint32Array < "u" && e instanceof Uint32Array;
}
let B;
function ze(e) {
  if (B)
    return B;
  async function t() {
    L = await yn(async (n) => {
      let r = e;
      return r = await r, typeof r == "function" && (r = await r(n)), typeof r == "function" && (r = await r(n)), Ln(r) ? r = await r.instantiator(n) : kn(r) ? r = await r.default(n) : (vn(r) && (r = r.data), _n(r) ? typeof WebAssembly.instantiateStreaming == "function" ? r = await Cn(r)(n) : r = await xn(r)(n) : Nn(r) ? r = await te(r)(n) : r instanceof WebAssembly.Module ? r = await te(r)(n) : "default" in r && r.default instanceof WebAssembly.Module && (r = await te(r.default)(n))), "instance" in r && (r = r.instance), "exports" in r && (r = r.exports), r;
    });
  }
  return B = t(), B;
}
function te(e) {
  return (t) => WebAssembly.instantiate(e, t);
}
function Cn(e) {
  return (t) => WebAssembly.instantiateStreaming(e, t);
}
function xn(e) {
  return async (t) => {
    const n = await e.arrayBuffer();
    return WebAssembly.instantiate(n, t);
  };
}
let Ve;
function An(e) {
  Ve = e;
}
function On() {
  return Ve;
}
async function Je(e) {
  return e && await ze(e), {
    createScanner(t) {
      return new Sn(t.map((n) => typeof n == "string" ? n : n.source));
    },
    createString(t) {
      return new Fe(t);
    }
  };
}
const Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  createOnigurumaEngine: Je,
  getDefaultWasmLoader: On,
  loadWasm: ze,
  setDefaultWasmLoader: An
}, Symbol.toStringTag, { value: "Module" }));
var Ke = /* @__PURE__ */ ft({});
ut(Ke, Mn);
const Pn = [
  {
    id: "andromeeda",
    displayName: "Andromeeda",
    type: "dark",
    import: (() => import("./andromeeda-BbmzSJq1.js"))
  },
  {
    id: "aurora-x",
    displayName: "Aurora X",
    type: "dark",
    import: (() => import("./aurora-x-BwoVEUWZ.js"))
  },
  {
    id: "ayu-dark",
    displayName: "Ayu Dark",
    type: "dark",
    import: (() => import("./ayu-dark-DJoqd4M9.js"))
  },
  {
    id: "ayu-light",
    displayName: "Ayu Light",
    type: "light",
    import: (() => import("./ayu-light-BzXEJRJ-.js"))
  },
  {
    id: "ayu-mirage",
    displayName: "Ayu Mirage",
    type: "dark",
    import: (() => import("./ayu-mirage-BJ2oZGzi.js"))
  },
  {
    id: "catppuccin-frappe",
    displayName: "Catppuccin Frappé",
    type: "dark",
    import: (() => import("./catppuccin-frappe-D3cH2rXe.js"))
  },
  {
    id: "catppuccin-latte",
    displayName: "Catppuccin Latte",
    type: "light",
    import: (() => import("./catppuccin-latte-C0LRGUW4.js"))
  },
  {
    id: "catppuccin-macchiato",
    displayName: "Catppuccin Macchiato",
    type: "dark",
    import: (() => import("./catppuccin-macchiato-c5wQ11TT.js"))
  },
  {
    id: "catppuccin-mocha",
    displayName: "Catppuccin Mocha",
    type: "dark",
    import: (() => import("./catppuccin-mocha-WMD6Qvya.js"))
  },
  {
    id: "dark-plus",
    displayName: "Dark Plus",
    type: "dark",
    import: (() => import("./dark-plus-pUHDTVV0.js"))
  },
  {
    id: "dracula",
    displayName: "Dracula Theme",
    type: "dark",
    import: (() => import("./dracula-BtZx2Kac.js"))
  },
  {
    id: "dracula-soft",
    displayName: "Dracula Theme Soft",
    type: "dark",
    import: (() => import("./dracula-soft-BKa-aqBv.js"))
  },
  {
    id: "everforest-dark",
    displayName: "Everforest Dark",
    type: "dark",
    import: (() => import("./everforest-dark-DMCBqXCK.js"))
  },
  {
    id: "everforest-light",
    displayName: "Everforest Light",
    type: "light",
    import: (() => import("./everforest-light-BbXl82Em.js"))
  },
  {
    id: "github-dark",
    displayName: "GitHub Dark",
    type: "dark",
    import: (() => import("./github-dark-DenFmJkN.js"))
  },
  {
    id: "github-dark-default",
    displayName: "GitHub Dark Default",
    type: "dark",
    import: (() => import("./github-dark-default-BJPUVz4H.js"))
  },
  {
    id: "github-dark-dimmed",
    displayName: "GitHub Dark Dimmed",
    type: "dark",
    import: (() => import("./github-dark-dimmed-DUshB20C.js"))
  },
  {
    id: "github-dark-high-contrast",
    displayName: "GitHub Dark High Contrast",
    type: "dark",
    import: (() => import("./github-dark-high-contrast-D3aGCnF8.js"))
  },
  {
    id: "github-light",
    displayName: "GitHub Light",
    type: "light",
    import: (() => import("./github-light-JYsPkUQd.js"))
  },
  {
    id: "github-light-default",
    displayName: "GitHub Light Default",
    type: "light",
    import: (() => import("./github-light-default-D99KPAby.js"))
  },
  {
    id: "github-light-high-contrast",
    displayName: "GitHub Light High Contrast",
    type: "light",
    import: (() => import("./github-light-high-contrast-BbmZE-Mp.js"))
  },
  {
    id: "gruvbox-dark-hard",
    displayName: "Gruvbox Dark Hard",
    type: "dark",
    import: (() => import("./gruvbox-dark-hard-C5HOtKIh.js"))
  },
  {
    id: "gruvbox-dark-medium",
    displayName: "Gruvbox Dark Medium",
    type: "dark",
    import: (() => import("./gruvbox-dark-medium-FVgwJHuz.js"))
  },
  {
    id: "gruvbox-dark-soft",
    displayName: "Gruvbox Dark Soft",
    type: "dark",
    import: (() => import("./gruvbox-dark-soft-B46F314v.js"))
  },
  {
    id: "gruvbox-light-hard",
    displayName: "Gruvbox Light Hard",
    type: "light",
    import: (() => import("./gruvbox-light-hard-CJD38wDZ.js"))
  },
  {
    id: "gruvbox-light-medium",
    displayName: "Gruvbox Light Medium",
    type: "light",
    import: (() => import("./gruvbox-light-medium-BlIhMYTA.js"))
  },
  {
    id: "gruvbox-light-soft",
    displayName: "Gruvbox Light Soft",
    type: "light",
    import: (() => import("./gruvbox-light-soft-DoPHyLVZ.js"))
  },
  {
    id: "horizon",
    displayName: "Horizon",
    type: "dark",
    import: (() => import("./horizon-CJQ10nlf.js"))
  },
  {
    id: "horizon-bright",
    displayName: "Horizon Bright",
    type: "light",
    import: (() => import("./horizon-bright-2WzHy-Vo.js"))
  },
  {
    id: "houston",
    displayName: "Houston",
    type: "dark",
    import: (() => import("./houston-BDYrDoDW.js"))
  },
  {
    id: "kanagawa-dragon",
    displayName: "Kanagawa Dragon",
    type: "dark",
    import: (() => import("./kanagawa-dragon-CiKur4Hl.js"))
  },
  {
    id: "kanagawa-lotus",
    displayName: "Kanagawa Lotus",
    type: "light",
    import: (() => import("./kanagawa-lotus-BKu-smKu.js"))
  },
  {
    id: "kanagawa-wave",
    displayName: "Kanagawa Wave",
    type: "dark",
    import: (() => import("./kanagawa-wave-CQwozSzG.js"))
  },
  {
    id: "laserwave",
    displayName: "LaserWave",
    type: "dark",
    import: (() => import("./laserwave-6a00oqik.js"))
  },
  {
    id: "light-plus",
    displayName: "Light Plus",
    type: "light",
    import: (() => import("./light-plus-CZuVqSLX.js"))
  },
  {
    id: "material-theme",
    displayName: "Material Theme",
    type: "dark",
    import: (() => import("./material-theme-D6KBX41T.js"))
  },
  {
    id: "material-theme-darker",
    displayName: "Material Theme Darker",
    type: "dark",
    import: (() => import("./material-theme-darker-CkRroheE.js"))
  },
  {
    id: "material-theme-lighter",
    displayName: "Material Theme Lighter",
    type: "light",
    import: (() => import("./material-theme-lighter-BUBw43Yz.js"))
  },
  {
    id: "material-theme-ocean",
    displayName: "Material Theme Ocean",
    type: "dark",
    import: (() => import("./material-theme-ocean-ClGX14Ja.js"))
  },
  {
    id: "material-theme-palenight",
    displayName: "Material Theme Palenight",
    type: "dark",
    import: (() => import("./material-theme-palenight-C1RVm8K1.js"))
  },
  {
    id: "min-dark",
    displayName: "Min Dark",
    type: "dark",
    import: (() => import("./min-dark-C7ak0t6c.js"))
  },
  {
    id: "min-light",
    displayName: "Min Light",
    type: "light",
    import: (() => import("./min-light-CKFxVcPp.js"))
  },
  {
    id: "monokai",
    displayName: "Monokai",
    type: "dark",
    import: (() => import("./monokai-C1KBYcO0.js"))
  },
  {
    id: "night-owl",
    displayName: "Night Owl",
    type: "dark",
    import: (() => import("./night-owl-Bm2rzalh.js"))
  },
  {
    id: "night-owl-light",
    displayName: "Night Owl Light",
    type: "light",
    import: (() => import("./night-owl-light-CBI5u5kw.js"))
  },
  {
    id: "nord",
    displayName: "Nord",
    type: "dark",
    import: (() => import("./nord-CC5OiUXg.js"))
  },
  {
    id: "one-dark-pro",
    displayName: "One Dark Pro",
    type: "dark",
    import: (() => import("./one-dark-pro-DTA3VF0_.js"))
  },
  {
    id: "one-light",
    displayName: "One Light",
    type: "light",
    import: (() => import("./one-light-LkMrt1Cf.js"))
  },
  {
    id: "plastic",
    displayName: "Plastic",
    type: "dark",
    import: (() => import("./plastic-CSTz3KZp.js"))
  },
  {
    id: "poimandres",
    displayName: "Poimandres",
    type: "dark",
    import: (() => import("./poimandres-C-VADXHD.js"))
  },
  {
    id: "red",
    displayName: "Red",
    type: "dark",
    import: (() => import("./red-7y8PH7HH.js"))
  },
  {
    id: "rose-pine",
    displayName: "Rosé Pine",
    type: "dark",
    import: (() => import("./rose-pine-BKc3yVeu.js"))
  },
  {
    id: "rose-pine-dawn",
    displayName: "Rosé Pine Dawn",
    type: "light",
    import: (() => import("./rose-pine-dawn-BulJcPZT.js"))
  },
  {
    id: "rose-pine-moon",
    displayName: "Rosé Pine Moon",
    type: "dark",
    import: (() => import("./rose-pine-moon-j6jiXKV8.js"))
  },
  {
    id: "slack-dark",
    displayName: "Slack Dark",
    type: "dark",
    import: (() => import("./slack-dark-i7wN4OET.js"))
  },
  {
    id: "slack-ochin",
    displayName: "Slack Ochin",
    type: "light",
    import: (() => import("./slack-ochin-ndHf0LoP.js"))
  },
  {
    id: "snazzy-light",
    displayName: "Snazzy Light",
    type: "light",
    import: (() => import("./snazzy-light-BlSJXAu4.js"))
  },
  {
    id: "solarized-dark",
    displayName: "Solarized Dark",
    type: "dark",
    import: (() => import("./solarized-dark-UTmkh7lw.js"))
  },
  {
    id: "solarized-light",
    displayName: "Solarized Light",
    type: "light",
    import: (() => import("./solarized-light-BheCkDPT.js"))
  },
  {
    id: "synthwave-84",
    displayName: "Synthwave '84",
    type: "dark",
    import: (() => import("./synthwave-84-NU3C_KFZ.js"))
  },
  {
    id: "tokyo-night",
    displayName: "Tokyo Night",
    type: "dark",
    import: (() => import("./tokyo-night-DP4TmcQl.js"))
  },
  {
    id: "vesper",
    displayName: "Vesper",
    type: "dark",
    import: (() => import("./vesper-BckBta1U.js"))
  },
  {
    id: "vitesse-black",
    displayName: "Vitesse Black",
    type: "dark",
    import: (() => import("./vitesse-black-BoGvW84i.js"))
  },
  {
    id: "vitesse-dark",
    displayName: "Vitesse Dark",
    type: "dark",
    import: (() => import("./vitesse-dark-Cym-eLtO.js"))
  },
  {
    id: "vitesse-light",
    displayName: "Vitesse Light",
    type: "light",
    import: (() => import("./vitesse-light-CcmG315c.js"))
  }
], jn = Object.fromEntries(Pn.map((e) => [e.id, e.import])), Ye = [
  {
    id: "angular-html",
    name: "Angular HTML",
    import: (() => import("./angular-html-dA1qUKRV.js").then((e) => e.f))
  },
  {
    id: "angular-ts",
    name: "Angular TypeScript",
    import: (() => import("./angular-ts-CXyBC0vY.js"))
  },
  {
    id: "astro",
    name: "Astro",
    import: (() => import("./astro--3ZkKqYU.js"))
  },
  {
    id: "blade",
    name: "Blade",
    import: (() => import("./blade-BoRuQEEj.js"))
  },
  {
    id: "c",
    name: "C",
    import: (() => import("./c-eeMepfLm.js"))
  },
  {
    id: "coffee",
    name: "CoffeeScript",
    aliases: ["coffeescript"],
    import: (() => import("./coffee-DGBR_nr_.js"))
  },
  {
    id: "cpp",
    name: "C++",
    aliases: ["c++"],
    import: (() => import("./cpp-Cj177cuW.js"))
  },
  {
    id: "css",
    name: "CSS",
    import: (() => import("./css-M7EaDHN_.js"))
  },
  {
    id: "csv",
    name: "CSV",
    import: (() => import("./csv-CmYOceLb.js"))
  },
  {
    id: "glsl",
    name: "GLSL",
    import: (() => import("./glsl-CkUcVZNK.js"))
  },
  {
    id: "graphql",
    name: "GraphQL",
    aliases: ["gql"],
    import: (() => import("./graphql-CBu2ehBn.js"))
  },
  {
    id: "haml",
    name: "Ruby Haml",
    import: (() => import("./haml-B1t5q1Sv.js"))
  },
  {
    id: "handlebars",
    name: "Handlebars",
    aliases: ["hbs"],
    import: (() => import("./handlebars-B2fb61mr.js"))
  },
  {
    id: "html",
    name: "HTML",
    import: (() => import("./html-CPZ3oZQ7.js"))
  },
  {
    id: "html-derivative",
    name: "HTML (Derivative)",
    import: (() => import("./html-derivative-B2qv7eyt.js"))
  },
  {
    id: "http",
    name: "HTTP",
    import: (() => import("./http-DLvAkeD-.js"))
  },
  {
    id: "hurl",
    name: "Hurl",
    import: (() => import("./hurl-CgkFN90t.js"))
  },
  {
    id: "imba",
    name: "Imba",
    import: (() => import("./imba-CimUv-Uh.js"))
  },
  {
    id: "java",
    name: "Java",
    import: (() => import("./java-DY6VlHhP.js"))
  },
  {
    id: "javascript",
    name: "JavaScript",
    aliases: [
      "js",
      "cjs",
      "mjs"
    ],
    import: (() => import("./javascript-C25yR2R2.js"))
  },
  {
    id: "jinja",
    name: "Jinja",
    import: (() => import("./jinja-DFCUirAg.js"))
  },
  {
    id: "jison",
    name: "Jison",
    import: (() => import("./jison-DdreslRX.js"))
  },
  {
    id: "json",
    name: "JSON",
    import: (() => import("./json-DxJze_jm.js"))
  },
  {
    id: "json5",
    name: "JSON5",
    import: (() => import("./json5-BT4Fjg39.js"))
  },
  {
    id: "jsonc",
    name: "JSON with Comments",
    import: (() => import("./jsonc-CHjZD8gR.js"))
  },
  {
    id: "jsonl",
    name: "JSON Lines",
    import: (() => import("./jsonl-BGuvDmy9.js"))
  },
  {
    id: "jsx",
    name: "JSX",
    import: (() => import("./jsx-BtKADgXT.js"))
  },
  {
    id: "julia",
    name: "Julia",
    aliases: ["jl"],
    import: (() => import("./julia-CZiKXNNP.js"))
  },
  {
    id: "less",
    name: "Less",
    import: (() => import("./less-B1GLI2Di.js"))
  },
  {
    id: "markdown",
    name: "Markdown",
    aliases: ["md"],
    import: (() => import("./markdown-CrScaQ96.js"))
  },
  {
    id: "marko",
    name: "Marko",
    import: (() => import("./marko-BlmC3dqW.js"))
  },
  {
    id: "mdc",
    name: "MDC",
    import: (() => import("./mdc-CLNk3q28.js"))
  },
  {
    id: "mdx",
    name: "MDX",
    import: (() => import("./mdx-BOhZZUJ8.js"))
  },
  {
    id: "php",
    name: "PHP",
    import: (() => import("./php-Kn-vgdBD.js"))
  },
  {
    id: "postcss",
    name: "PostCSS",
    import: (() => import("./postcss-05aHdL-n.js"))
  },
  {
    id: "pug",
    name: "Pug",
    aliases: ["jade"],
    import: (() => import("./pug-CTOOvSEH.js"))
  },
  {
    id: "python",
    name: "Python",
    aliases: ["py"],
    import: (() => import("./python-BFNSHbwJ.js"))
  },
  {
    id: "r",
    name: "R",
    import: (() => import("./r-CSmzDPi7.js"))
  },
  {
    id: "regexp",
    name: "RegExp",
    aliases: ["regex"],
    import: (() => import("./regexp-BazyLpPg.js"))
  },
  {
    id: "sass",
    name: "Sass",
    import: (() => import("./sass-DxHp5rTx.js"))
  },
  {
    id: "scss",
    name: "SCSS",
    import: (() => import("./scss-BZYVIVaN.js"))
  },
  {
    id: "shellscript",
    name: "Shell",
    aliases: [
      "bash",
      "sh",
      "shell",
      "zsh"
    ],
    import: (() => import("./shellscript-InADTalH.js"))
  },
  {
    id: "sql",
    name: "SQL",
    import: (() => import("./sql-Cn_v3PB0.js"))
  },
  {
    id: "stylus",
    name: "Stylus",
    aliases: ["styl"],
    import: (() => import("./stylus-CyKEU1Ej.js"))
  },
  {
    id: "svelte",
    name: "Svelte",
    import: (() => import("./svelte-b9PAcyUe.js"))
  },
  {
    id: "ts-tags",
    name: "TypeScript with Tags",
    aliases: ["lit"],
    import: (() => import("./ts-tags-CP1b-4Z2.js"))
  },
  {
    id: "tsx",
    name: "TSX",
    import: (() => import("./tsx-B8rCNbgL.js"))
  },
  {
    id: "typescript",
    name: "TypeScript",
    aliases: [
      "ts",
      "cts",
      "mts"
    ],
    import: (() => import("./typescript-RycA9KXf.js"))
  },
  {
    id: "vue",
    name: "Vue",
    import: (() => import("./vue-CY6W2ID0.js"))
  },
  {
    id: "vue-html",
    name: "Vue HTML",
    import: (() => import("./vue-html-j9xNEdu3.js"))
  },
  {
    id: "vue-vine",
    name: "Vue Vine",
    import: (() => import("./vue-vine-DiWTpMwZ.js"))
  },
  {
    id: "wasm",
    name: "WebAssembly",
    import: (() => import("./wasm-BBXxrAl7.js"))
  },
  {
    id: "wgsl",
    name: "WGSL",
    import: (() => import("./wgsl-DY4iK1q1.js"))
  },
  {
    id: "wit",
    name: "WebAssembly Interface Types",
    import: (() => import("./wit-CQMQOlTg.js"))
  },
  {
    id: "xml",
    name: "XML",
    import: (() => import("./xml-C2J0sS9M.js"))
  },
  {
    id: "yaml",
    name: "YAML",
    aliases: ["yml"],
    import: (() => import("./yaml-DaO7k5B1.js"))
  }
], En = Object.fromEntries(Ye.map((e) => [e.id, e.import])), $n = Object.fromEntries(Ye.flatMap((e) => e.aliases?.map((t) => [t, e.import]) || [])), qe = {
  ...En,
  ...$n
}, Hn = /* @__PURE__ */ Xt({
  langs: qe,
  themes: jn,
  engine: () => (0, Ke.createOnigurumaEngine)(import("./wasm-DQxwEHae.js"))
}), { getSingletonHighlighter: Bn } = /* @__PURE__ */ Zt(Hn, { guessEmbeddedLanguages: Ue });
async function In(e, t, n) {
  const r = e.filter(
    (i) => nn(i, qe)
  );
  return await Bn({
    langs: r,
    themes: t,
    engine: n ?? Je(import("./wasm-DQxwEHae.js"))
  });
}
var Dn = (e, t, n, r = {}) => un(
  e,
  t,
  n,
  r,
  In
), Un = hn(
  Dn
), Vn = Un;
export {
  Vn as w
};
