import { ref, watch, createElementBlock, openBlock, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
import { loadVueComponent } from "./vue3sfc.mjs";
/* empty css                */
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
const _hoisted_1 = { class: "vue-render-container" };
const _sfc_main = {
  __name: "VueRender",
  props: {
    code: { type: String, default: "" },
    params: { type: Object, default: {} }
  },
  setup(__props) {
    const props = __props;
    const dynamicComponent = ref(null);
    watch(
      () => props.code,
      async (val) => {
        if (!val) return;
        try {
          dynamicComponent.value = await loadVueComponent(val);
        } catch (e) {
          console.error("渲染失败", e);
        }
      },
      { immediate: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        (openBlock(), createBlock(resolveDynamicComponent(dynamicComponent.value), normalizeProps(guardReactiveProps(__props.params)), null, 16))
      ]);
    };
  }
};
const VueRender = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-91bc8b03"]]);
export {
  VueRender as default
};
