"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index_esm = require("../../../@vant/use/dist/index.esm.js");
const useLazyRender = require("../composables/use-lazy-render.js");
const format = require("../utils/format.js");
const props = require("../utils/props.js");
const create = require("../utils/create.js");
const dom = require("../utils/dom.js");
const basic = require("../utils/basic.js");
const [name, bem] = create.createNamespace("overlay");
const overlayProps = {
  show: Boolean,
  zIndex: props.numericProp,
  duration: props.numericProp,
  className: props.unknownProp,
  lockScroll: props.truthProp,
  lazyRender: props.truthProp,
  customStyle: Object,
  teleport: [String, Object]
};
var stdin_default = Vue.defineComponent({
  name,
  inheritAttrs: false,
  props: overlayProps,
  setup(props2, {
    attrs,
    slots
  }) {
    const root = Vue.ref();
    const lazyRender = useLazyRender.useLazyRender(() => props2.show || !props2.lazyRender);
    const onTouchMove = (event) => {
      if (props2.lockScroll) {
        dom.preventDefault(event, true);
      }
    };
    const renderOverlay = lazyRender(() => {
      var _a;
      const style = basic.extend(format.getZIndexStyle(props2.zIndex), props2.customStyle);
      if (basic.isDef(props2.duration)) {
        style.animationDuration = `${props2.duration}s`;
      }
      return Vue.withDirectives(Vue.createVNode("div", Vue.mergeProps({
        "ref": root,
        "style": style,
        "class": [bem(), props2.className]
      }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[Vue.vShow, props2.show]]);
    });
    index_esm.useEventListener("touchmove", onTouchMove, {
      target: root
    });
    return () => {
      const Content = Vue.createVNode(Vue.Transition, {
        "name": "van-fade",
        "appear": true
      }, {
        default: renderOverlay
      });
      if (props2.teleport) {
        return Vue.createVNode(Vue.Teleport, {
          "to": props2.teleport
        }, {
          default: () => [Content]
        });
      }
      return Content;
    };
  }
});
exports.default = stdin_default;
exports.overlayProps = overlayProps;
