"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue3SfcLoader_esm = require("../../../../../node_modules/vue3-sfc-loader/dist/vue3-sfc-loader.esm.js");
const Vue = require("vue");
function _interopNamespaceDefault(e) {
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
  if (e) {
    for (const k in e) {
      if (k !== "default") {
        const d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: () => e[k]
        });
      }
    }
  }
  n.default = e;
  return Object.freeze(n);
}
const Vue__namespace = /* @__PURE__ */ _interopNamespaceDefault(Vue);
const options = {
  moduleCache: {
    vue: Vue__namespace
  },
  getFile: (url) => {
    return fetch(url).then((response) => {
      if (!response.ok) throw new Error(`Failed to fetch ${url}`);
      return response.text();
    });
  },
  addStyle: (style) => {
    const styleElement = document.createElement("style");
    styleElement.textContent = style;
    document.head.appendChild(styleElement);
  },
  log: (level) => {
    console.log(`[vue3-sfc-loader] ${level}`);
  }
};
async function loadVueComponent(sfcCode) {
  const url = `virtual.vue?t=${Date.now()}`;
  return await vue3SfcLoader_esm.loadModule(url, {
    ...options,
    getFile: () => Promise.resolve(sfcCode)
  });
}
exports.loadVueComponent = loadVueComponent;
