"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index$1 = require("../../../hooks/use-lockscreen/index.js");
const mask = require("./mask.js");
const helper = require("./helper.js");
const index = require("../../../../node_modules/@vueuse/core/index.js");
const Vue = require("vue");
const _hoisted_1 = { style: {
  width: "100%",
  height: "100%"
} };
const _hoisted_2 = ["d"];
var mask_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElTourMask",
  inheritAttrs: false,
  __name: "mask",
  props: mask.maskProps,
  setup(__props) {
    const props = __props;
    const { ns } = Vue.inject(helper.tourKey);
    const radius = Vue.computed(() => {
      var _a;
      return ((_a = props.pos) == null ? void 0 : _a.radius) ?? 2;
    });
    const roundInfo = Vue.computed(() => {
      const v = radius.value;
      const baseInfo = `a${v},${v} 0 0 1`;
      return {
        topRight: `${baseInfo} ${v},${v}`,
        bottomRight: `${baseInfo} ${-v},${v}`,
        bottomLeft: `${baseInfo} ${-v},${-v}`,
        topLeft: `${baseInfo} ${v},${-v}`
      };
    });
    const { width: windowWidth, height: windowHeight } = index.useWindowSize();
    const path = Vue.computed(() => {
      const width = windowWidth.value;
      const height = windowHeight.value;
      const info = roundInfo.value;
      const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
      const _radius = radius.value;
      return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
    });
    const maskStyle = Vue.computed(() => ({
      position: "fixed",
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
      zIndex: props.zIndex,
      pointerEvents: props.pos && props.targetAreaClickable ? "none" : "auto"
    }));
    const pathStyle = Vue.computed(() => ({
      fill: props.fill,
      pointerEvents: "auto",
      cursor: "auto"
    }));
    index$1.useLockscreen(Vue.toRef(props, "visible"), { ns });
    return (_ctx, _cache) => {
      return __props.visible ? (Vue.openBlock(), Vue.createElementBlock("div", Vue.mergeProps({
        key: 0,
        class: Vue.unref(ns).e("mask"),
        style: maskStyle.value
      }, _ctx.$attrs), [(Vue.openBlock(), Vue.createElementBlock("svg", _hoisted_1, [Vue.createElementVNode("path", {
        class: Vue.normalizeClass(Vue.unref(ns).e("hollow")),
        style: Vue.normalizeStyle(pathStyle.value),
        d: path.value
      }, null, 14, _hoisted_2)]))], 16)) : Vue.createCommentVNode("v-if", true);
    };
  }
});
exports.default = mask_vue_vue_type_script_setup_true_lang_default;
