import { createVNode, defineComponent, inject, computed } from 'vue';
import '../../../utils/index.mjs';
import LocaleReceiver from '../../locale-provider/src/LocaleReceiver.mjs';
import '../../config-provider/src/context/index.mjs';
import useStyle from '../style/index.mjs';
import DefaultEmptyImg from './DefaultEmptyImg.mjs';
import SimpleEmptyImg from './SimpleEmptyImg.mjs';
import { emptyProps } from './props.mjs';
import { configProviderKey, defaultConfigProvider } from '../../config-provider/src/context/context.mjs';
import { classNames } from '../../../utils/dom/class.mjs';
import { filterEmpty } from '../../../utils/vue/props.mjs';

const defaultEmptyImg = createVNode(DefaultEmptyImg, null, null);
const simpleEmptyImg = createVNode(SimpleEmptyImg, null, null);
var AEmpty = /* @__PURE__ */ defineComponent({
  name: "AEmpty",
  compatConfig: {
    MODE: 3
  },
  inheritAttrs: false,
  props: emptyProps(),
  PRESENTED_IMAGE_DEFAULT: defaultEmptyImg,
  PRESENTED_IMAGE_SIMPLE: simpleEmptyImg,
  setup(props, {
    slots = {},
    attrs
  }) {
    const configProvider = inject(configProviderKey, defaultConfigProvider);
    const prefixClsRef = computed(() => configProvider.getPrefixCls("empty", props.prefixCls));
    const direction = computed(() => {
      var _a;
      return (_a = configProvider.direction) == null ? void 0 : _a.value;
    });
    const [wrapSSR, hashId] = useStyle(prefixClsRef);
    return () => {
      var _a, _b;
      const prefixCls = prefixClsRef.value;
      const {
        image = ((_a = slots.image) == null ? void 0 : _a.call(slots)) || defaultEmptyImg,
        description = ((_b = slots.description) == null ? void 0 : _b.call(slots)) || void 0,
        imageStyle,
        class: className = "",
        ...restProps
      } = {
        ...props,
        ...attrs
      };
      return wrapSSR(createVNode(LocaleReceiver, {
        "componentName": "Empty",
        "children": (locale) => {
          const des = typeof description !== "undefined" ? description : locale.description;
          const alt = typeof des === "string" ? des : "empty";
          let imageNode = null;
          if (typeof image === "string")
            imageNode = createVNode("img", {
              "alt": alt,
              "src": image
            }, null);
          else
            imageNode = image;
          return createVNode("div", {
            "class": classNames(prefixCls, className, hashId.value, {
              [`${prefixCls}-normal`]: image === simpleEmptyImg,
              [`${prefixCls}-rtl`]: direction.value === "rtl"
            }),
            ...restProps
          }, [createVNode("div", {
            "class": `${prefixCls}-image`,
            "style": imageStyle
          }, [imageNode]), des && createVNode("p", {
            "class": `${prefixCls}-description`
          }, [des]), slots.default && createVNode("div", {
            "class": `${prefixCls}-footer`
          }, [filterEmpty(slots.default())])]);
        }
      }, null));
    };
  }
});

export { AEmpty as default };
//# sourceMappingURL=Empty.mjs.map
