import { defineComponent, computed, ref, unref, createBlock, openBlock, mergeProps, withCtx, renderSlot, createCommentVNode, createElementBlock, normalizeClass, toDisplayString, createTextVNode } from "vue";
import { ElTooltip as p } from "../../tooltip/index.mjs";
import { popoverEmits as d, popoverProps as f } from "./popover.mjs";
import c from "../../../_virtual/plugin-vue_export-helper.mjs";
import { useNamespace as q } from "../../../hooks/use-namespace/index.mjs";
import { addUnit as u } from "../../../utils/dom/style.mjs";
const D = "onUpdate:visible", K = defineComponent({
  name: "ElPopover"
}), O = /* @__PURE__ */ defineComponent({
  ...K,
  props: f,
  emits: d,
  setup(u$1, { expose: v, emit: r }) {
    const t = u$1, m = computed(() => t[D]), p$1 = q("popover"), s = ref(), b = computed(() => {
      var e;
      return (e = unref(s)) == null ? void 0 : e.popperRef;
    }), h = computed(() => [
      {
        width: u(t.width)
      },
      t.popperStyle
    ]), w = computed(() => [p$1.b(), t.popperClass, { [p$1.m("plain")]: !!t.content }]), g = computed(() => t.transition === `${p$1.namespace.value}-fade-in-linear`), y = () => {
      var e;
      (e = s.value) == null || e.hide();
    }, k = () => {
      r("before-enter");
    }, E = () => {
      r("before-leave");
    }, C = () => {
      r("after-enter");
    }, B = () => {
      r("update:visible", false), r("after-leave");
    };
    return v({
      popperRef: b,
      hide: y
    }), (e, j) => (openBlock(), createBlock(unref(p), mergeProps({
      ref_key: "tooltipRef",
      ref: s
    }, e.$attrs, {
      trigger: e.trigger,
      placement: e.placement,
      disabled: e.disabled,
      visible: e.visible,
      transition: e.transition,
      "popper-options": e.popperOptions,
      tabindex: e.tabindex,
      content: e.content,
      offset: e.offset,
      "show-after": e.showAfter,
      "hide-after": e.hideAfter,
      "auto-close": e.autoClose,
      "show-arrow": e.showArrow,
      "aria-label": e.title,
      effect: e.effect,
      enterable: e.enterable,
      "popper-class": unref(w),
      "popper-style": unref(h),
      teleported: e.teleported,
      persistent: e.persistent,
      "gpu-acceleration": unref(g),
      "onUpdate:visible": unref(m),
      onBeforeShow: k,
      onBeforeHide: E,
      onShow: C,
      onHide: B
    }), {
      content: withCtx(() => [
        e.title ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: normalizeClass(unref(p$1).e("title")),
          role: "title"
        }, toDisplayString(e.title), 3)) : createCommentVNode("v-if", true),
        renderSlot(e.$slots, "default", {}, () => [
          createTextVNode(toDisplayString(e.content), 1)
        ])
      ]),
      default: withCtx(() => [
        e.$slots.reference ? renderSlot(e.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
      ]),
      _: 3
    }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]));
  }
});
var Q = /* @__PURE__ */ c(O, [["__file", "popover.vue"]]);
export {
  Q as default
};
