'use strict';

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

var vue = require('vue');
require('../../../utils/index.cjs');
require('../../../vue-components/index.cjs');
var index$1 = require('../../tooltip/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index = require('../style/index.cjs');
var props = require('./props.cjs');
var initDefaultProps = require('../../../utils/vue/initDefaultProps.cjs');
var props$1 = require('../../tooltip/src/props.cjs');
var log = require('../../../utils/log.cjs');
var props$2 = require('../../../utils/vue/props.cjs');
var _class = require('../../../utils/dom/class.cjs');
var omit = require('../../../utils/lang/omit.cjs');
var transition = require('../../../vue-components/transition/src/transition.cjs');

var APopover = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "APopover",
  inheritAttrs: false,
  props: initDefaultProps.initDefaultProps(props.popoverProps(), {
    ...props$1.tooltipDefaultProps(),
    trigger: "hover",
    placement: "top",
    mouseEnterDelay: 0.1,
    mouseLeaveDelay: 0.1
  }),
  setup(props, {
    expose,
    slots,
    attrs
  }) {
    const tooltipRef = vue.ref();
    log.devWarning(props.visible === void 0, "popover", "`visible` will be removed in next major version, please use `open` instead.");
    expose({
      getPopupDomNode: () => {
        var _a, _b;
        return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.getPopupDomNode) == null ? void 0 : _b.call(_a);
      }
    });
    const {
      prefixCls,
      configProvider
    } = useConfigInject.default("popover", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const rootPrefixCls = vue.computed(() => configProvider.getPrefixCls());
    const getOverlay = () => {
      var _a, _b;
      const {
        title = props$2.filterEmpty((_a = slots.title) == null ? void 0 : _a.call(slots)),
        content = props$2.filterEmpty((_b = slots.content) == null ? void 0 : _b.call(slots))
      } = props;
      const hasTitle = !!(Array.isArray(title) ? title.length : title);
      const hasContent = !!(Array.isArray(content) ? content.length : title);
      if (!hasTitle && !hasContent)
        return null;
      return vue.createVNode(vue.Fragment, null, [hasTitle && vue.createVNode("div", {
        "class": `${prefixCls.value}-title`
      }, [title]), vue.createVNode("div", {
        "class": `${prefixCls.value}-inner-content`
      }, [content])]);
    };
    return () => {
      const overlayCls = _class.classNames(props.overlayClassName, hashId.value);
      return wrapSSR(vue.createVNode(index$1.Tooltip, {
        ...omit.omit(props, ["title", "content"]),
        ...attrs,
        "prefixCls": prefixCls.value,
        "ref": tooltipRef,
        "overlayClassName": overlayCls,
        "transitionName": transition.getTransitionName(rootPrefixCls.value, "zoom-big", props.transitionName),
        "data-popover-inject": true
      }, {
        title: getOverlay,
        default: slots.default
      }));
    };
  }
});

exports.default = APopover;
//# sourceMappingURL=Popover.cjs.map
