import { defineComponent, computed, createVNode } from 'vue';
import { CloseOutlined } from '@ant-design/icons-vue';
import '../../../utils/index.mjs';
import { getMotion } from '../../../vue-components/vc-trigger/src/utils/motionUtil.mjs';
import useNotification from '../../../vue-components/vc-notification/src/useNotification.mjs';
import useConfigInject from '../../config-provider/src/hooks/useConfigInject.mjs';
import useStyle from '../style/index.mjs';
import { classNames } from '../../../utils/dom/class.mjs';

const DEFAULT_OFFSET = 8;
const DEFAULT_DURATION = 3;
var Holder = /* @__PURE__ */ defineComponent({
  name: "Holder",
  inheritAttrs: false,
  props: ["top", "prefixCls", "getContainer", "maxCount", "duration", "rtl", "transitionName", "onAllRemoved"],
  setup(props, {
    expose
  }) {
    var _a, _b;
    const {
      getPrefixCls,
      getPopupContainer
    } = useConfigInject("message", props);
    const prefixCls = computed(() => getPrefixCls("message", props.prefixCls));
    const [, hashId] = useStyle(prefixCls);
    const getStyles = () => {
      var _a2;
      const top = (_a2 = props.top) != null ? _a2 : DEFAULT_OFFSET;
      return {
        left: "50%",
        transform: "translateX(-50%)",
        top: typeof top === "number" ? `${top}px` : top
      };
    };
    const getClassName = () => classNames(hashId.value, props.rtl ? `${prefixCls.value}-rtl` : "");
    const getNotificationMotion = () => {
      var _a2;
      return getMotion({
        prefixCls: prefixCls.value,
        animation: (_a2 = props.animation) != null ? _a2 : "move-up",
        transitionName: props.transitionName
      });
    };
    const mergedCloseIcon = createVNode("span", {
      "class": `${prefixCls.value}-close-x`
    }, [createVNode(CloseOutlined, {
      "class": `${prefixCls.value}-close-icon`
    }, null)]);
    const [api, holder] = useNotification({
      getStyles,
      prefixCls: prefixCls.value,
      getClassName,
      motion: getNotificationMotion,
      closable: false,
      closeIcon: mergedCloseIcon,
      duration: (_a = props.duration) != null ? _a : DEFAULT_DURATION,
      getContainer: (_b = props.staticGetContainer) != null ? _b : getPopupContainer.value,
      maxCount: props.maxCount,
      onAllRemoved: props.onAllRemoved
    });
    expose({
      ...api,
      prefixCls,
      hashId
    });
    return holder;
  }
});

export { Holder as default };
//# sourceMappingURL=holder.mjs.map
