"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const style = require("../../../utils/dom/style.js");
const index = require("../../../hooks/use-namespace/index.js");
const index$1 = require("../../tooltip/index.js");
const popover = require("./popover.js");
const Vue = require("vue");
const updateEventKeyRaw = `onUpdate:visible`;
var popover_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElPopover",
  __name: "popover",
  props: popover.popoverProps,
  emits: popover.popoverEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const onUpdateVisible = Vue.computed(() => {
      return props[updateEventKeyRaw];
    });
    const ns = index.useNamespace("popover");
    const tooltipRef = Vue.ref();
    const popperRef = Vue.computed(() => {
      var _a;
      return (_a = Vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
    });
    const style$1 = Vue.computed(() => {
      return [{ width: style.addUnit(props.width) }, props.popperStyle];
    });
    const kls = Vue.computed(() => {
      return [
        ns.b(),
        props.popperClass,
        { [ns.m("plain")]: !!props.content }
      ];
    });
    const gpuAcceleration = Vue.computed(() => {
      return props.transition === `${ns.namespace.value}-fade-in-linear`;
    });
    const hide = () => {
      var _a;
      (_a = tooltipRef.value) == null ? void 0 : _a.hide();
    };
    const beforeEnter = () => {
      emit("before-enter");
    };
    const beforeLeave = () => {
      emit("before-leave");
    };
    const afterEnter = () => {
      emit("after-enter");
    };
    const afterLeave = () => {
      emit("update:visible", false);
      emit("after-leave");
    };
    __expose({
      popperRef,
      hide
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.ElTooltip), Vue.mergeProps({
        ref_key: "tooltipRef",
        ref: tooltipRef
      }, _ctx.$attrs, {
        trigger: __props.trigger,
        "trigger-keys": __props.triggerKeys,
        placement: __props.placement,
        disabled: __props.disabled,
        visible: __props.visible,
        transition: __props.transition,
        "popper-options": __props.popperOptions,
        tabindex: __props.tabindex,
        content: __props.content,
        offset: __props.offset,
        "show-after": __props.showAfter,
        "hide-after": __props.hideAfter,
        "auto-close": __props.autoClose,
        "show-arrow": __props.showArrow,
        "aria-label": __props.title,
        effect: __props.effect,
        enterable: __props.enterable,
        "popper-class": kls.value,
        "popper-style": style$1.value,
        teleported: __props.teleported,
        "append-to": __props.appendTo,
        persistent: __props.persistent,
        "gpu-acceleration": gpuAcceleration.value,
        "onUpdate:visible": onUpdateVisible.value,
        onBeforeShow: beforeEnter,
        onBeforeHide: beforeLeave,
        onShow: afterEnter,
        onHide: afterLeave
      }), {
        content: Vue.withCtx(() => [__props.title ? (Vue.openBlock(), Vue.createElementBlock("div", {
          key: 0,
          class: Vue.normalizeClass(Vue.unref(ns).e("title")),
          role: "title"
        }, Vue.toDisplayString(__props.title), 3)) : Vue.createCommentVNode("v-if", true), Vue.renderSlot(_ctx.$slots, "default", { hide }, () => [Vue.createTextVNode(Vue.toDisplayString(__props.content), 1)])]),
        default: Vue.withCtx(() => [_ctx.$slots.reference ? Vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : Vue.createCommentVNode("v-if", true)]),
        _: 3
      }, 16, [
        "trigger",
        "trigger-keys",
        "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",
        "append-to",
        "persistent",
        "gpu-acceleration",
        "onUpdate:visible"
      ]);
    };
  }
});
exports.default = popover_vue_vue_type_script_setup_true_lang_default;
