'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var iconsVue = require('@ant-design/icons-vue');
require('../../../utils/index.cjs');
var motionUtil = require('../../../vue-components/vc-trigger/src/utils/motionUtil.cjs');
var useNotification = require('../../../vue-components/vc-notification/src/useNotification.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index = require('../style/index.cjs');
var _class = require('../../../utils/dom/class.cjs');

const DEFAULT_OFFSET = 8;
const DEFAULT_DURATION = 3;
var Holder = /* @__PURE__ */ vue.defineComponent({
  name: "Holder",
  inheritAttrs: false,
  props: ["top", "prefixCls", "getContainer", "maxCount", "duration", "rtl", "transitionName", "onAllRemoved"],
  setup(props, {
    expose
  }) {
    var _a, _b;
    const {
      getPrefixCls,
      getPopupContainer
    } = useConfigInject.default("message", props);
    const prefixCls = vue.computed(() => getPrefixCls("message", props.prefixCls));
    const [, hashId] = index.default(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 = () => _class.classNames(hashId.value, props.rtl ? `${prefixCls.value}-rtl` : "");
    const getNotificationMotion = () => {
      var _a2;
      return motionUtil.getMotion({
        prefixCls: prefixCls.value,
        animation: (_a2 = props.animation) != null ? _a2 : "move-up",
        transitionName: props.transitionName
      });
    };
    const mergedCloseIcon = vue.createVNode("span", {
      "class": `${prefixCls.value}-close-x`
    }, [vue.createVNode(iconsVue.CloseOutlined, {
      "class": `${prefixCls.value}-close-icon`
    }, null)]);
    const [api, holder] = useNotification.default({
      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;
  }
});

exports.default = Holder;
//# sourceMappingURL=holder.cjs.map
