import { defineComponent, ref, watch, unref, openBlock, createElementBlock, normalizeStyle, normalizeClass, withModifiers, createCommentVNode, createElementVNode, renderSlot } from "vue";
import "../../../adapter-vue.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    visible: { type: Boolean, default: true },
    zIndex: { default: 9999 },
    useMask: { type: Boolean, default: true },
    maskColor: { default: "rgba(0, 0, 0, 0.6)" },
    isFullScreen: { type: Boolean, default: true },
    width: { default: "auto" },
    height: { default: "auto" }
  },
  emits: ["onOverlayClick"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const emits = __emit;
    const props = __props;
    const overlayDomRef = ref();
    const isOverlayShow = ref(props.visible);
    watch(() => props.visible, (visible) => {
      if (visible) {
        isOverlayShow.value = true;
      } else {
        setTimeout(() => {
          isOverlayShow.value = false;
        }, 150);
      }
    }, {
      immediate: true
    });
    function onOverlayClick() {
      emits("onOverlayClick");
    }
    __expose({
      overlayDomRef
    });
    return (_ctx, _cache) => {
      return unref(isOverlayShow) ? (openBlock(), createElementBlock("div", {
        key: 0,
        ref_key: "overlayDomRef",
        ref: overlayDomRef,
        class: "overlay-container",
        style: normalizeStyle({
          position: props.isFullScreen ? "fixed" : "absolute",
          zIndex: props.zIndex
        })
      }, [
        props.useMask ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: normalizeClass({
            "overlay-mask": true,
            "fade-in": props.visible
          }),
          style: normalizeStyle({
            backgroundColor: props.maskColor
          }),
          onClick: onOverlayClick,
          onTouchstart: withModifiers(onOverlayClick, ["prevent", "stop"])
        }, null, 38)) : createCommentVNode("", true),
        createElementVNode("div", {
          class: normalizeClass({
            "overlay-content": true,
            "full-screen": props.isFullScreen
          })
        }, [
          renderSlot(_ctx.$slots, "default", {}, void 0, true)
        ], 2)
      ], 4)) : createCommentVNode("", true);
    };
  }
});
export {
  _sfc_main as default
};
