import { defineComponent, ref, computed, onMounted, nextTick, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot, createElementVNode, createCommentVNode } from 'vue';
import '../../../utils/index.mjs';
import purify from '../../../../node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs';
import { defaultEmptyUrl, emptyProps } from './empty.mjs';
import { addUnit } from '../../../utils/add-unit.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
const _hoisted_1 = ["src"];
const _hoisted_2 = ["innerHTML"];
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlEmpty" },
  __name: "empty",
  props: emptyProps,
  setup(__props) {
    const props = __props;
    const empty = ref();
    const purifiedTitleHtml = computed(() => {
      return purify.sanitize(props.title || "");
    });
    const style = computed(() => {
      return {
        width: addUnit(props.width),
        height: addUnit(props.height)
      };
    });
    const imageWidth = computed(() => addUnit(props.imageWidth));
    const bem = createNamespace("empty");
    const bemInner = createNamespace("empty-inner");
    const bemTitle = createNamespace("empty-title");
    const disableSelection = (element) => {
      element.style.userSelect = "none";
      element.style.webkitUserSelect = "none";
      element.onselectstart = () => false;
      element.onmousedown = () => false;
    };
    onMounted(async () => {
      await nextTick();
      if (empty.value) {
        disableSelection(empty.value);
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          ref_key: "empty",
          ref: empty,
          class: normalizeClass(unref(bem).b()),
          style: normalizeStyle(style.value)
        },
        [
          renderSlot(_ctx.$slots, "image", {}, () => [
            createElementVNode("img", {
              style: normalizeStyle({ width: imageWidth.value }),
              src: _ctx.url || unref(defaultEmptyUrl),
              draggable: "false"
            }, null, 12, _hoisted_1)
          ]),
          createElementVNode(
            "div",
            {
              class: normalizeClass(unref(bemInner).b())
            },
            [
              _ctx.showTitle ? renderSlot(_ctx.$slots, "title", { key: 0 }, () => [
                createElementVNode("div", {
                  class: normalizeClass(unref(bemTitle).b()),
                  innerHTML: purifiedTitleHtml.value
                }, null, 10, _hoisted_2)
              ]) : createCommentVNode("v-if", true)
            ],
            2
            /* CLASS */
          ),
          createElementVNode(
            "div",
            {
              class: normalizeClass(unref(bem).e("operate-content"))
            },
            [
              renderSlot(_ctx.$slots, "operate")
            ],
            2
            /* CLASS */
          )
        ],
        6
        /* CLASS, STYLE */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=empty.vue2.mjs.map
