import { inject, ref } from "vue";
import { createSymbol } from "../../utils";
import { prismjsHighlightCode } from "./prismjs";
import { shikiHighlightCode } from "./shiki";
const HighlighterKey = createSymbol("highlighter");
function createHighlighter(options) {
  return ref({
    highlight: async (code, language) => {
      const type = options?.type ?? "shiki";
      if (language === "text") {
        return code;
      } else if (type === "shiki" && options?.shiki) {
        return await shikiHighlightCode(options.shiki, code, language);
      } else if (type === "prismjs" && options?.prismjs) {
        return await prismjsHighlightCode(options.prismjs, code, language);
      } else {
        return code;
      }
    }
  });
}
function useHighlighter() {
  const highlighter = inject(HighlighterKey);
  if (!highlighter)
    throw new Error("[VenoUi] Could not find highlighter instance");
  return highlighter;
}
export {
  HighlighterKey,
  createHighlighter,
  useHighlighter
};
//# sourceMappingURL=index.mjs.map
