import { defineComponent as t, openBlock as f, createElementBlock as m, ref as u, onMounted as l, onBeforeUnmount as d } from "vue";
const p = ["src"], w = t({ name: "zv-scene-unity-iframe" }), I = /* @__PURE__ */ t({
  ...w,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {},
    isPreview: { type: Boolean },
    disableDrag: { type: Boolean }
  },
  emits: [
    "on-message"
  ],
  setup(s, { emit: o }) {
    const a = s, i = o, r = () => {
      const e = u();
      return l(() => {
        window.SHJSceneUnityIframeInstance = e.value;
      }), d(() => {
        window.SHJSceneUnityIframeInstance && (window.SHJSceneUnityIframeInstance = null);
      }), window.addEventListener("message", (n) => {
        i("on-message", n.data), window.SHJParseEvent(a.useEvents, "on-message", n.data);
      }, !1), { unityIframeRef: e };
    }, { unityIframeRef: c } = r();
    return (e, n) => (f(), m("iframe", {
      ref_key: "unityIframeRef",
      ref: c,
      src: e.basicOption.iframeUrl,
      sandbox: "allow-scripts allow-same-origin",
      style: { width: "100%", height: "100%", border: "0" }
    }, null, 8, p));
  }
});
export {
  I as default
};
