import { defineComponent, inject, ref, toRef, createBlock, openBlock, unref, normalizeClass, withCtx, renderSlot } from "vue";
import { TOOLTIP_INJECTION_KEY as o } from "./constants.mjs";
import { useTooltipTriggerProps as s } from "./trigger.mjs";
import { whenTrigger as m } from "./utils.mjs";
import c from "../../../_virtual/plugin-vue_export-helper.mjs";
import { useNamespace as q } from "../../../hooks/use-namespace/index.mjs";
import { composeEventHandlers as u } from "../../../utils/dom/event.mjs";
import Y from "../../popper/src/trigger2.mjs";
const H = defineComponent({
  name: "ElTooltipTrigger"
}), J = /* @__PURE__ */ defineComponent({
  ...H,
  props: s,
  setup(a, { expose: f }) {
    const s2 = a, m$1 = q("tooltip"), { controlled: d, id: v, open: T, onOpen: u$1, onClose: c2, onToggle: l } = inject(o, void 0), C = ref(null), n = () => {
      if (unref(d) || s2.disabled)
        return true;
    }, t = toRef(s2, "trigger"), _ = u(n, m(t, "hover", u$1)), M = u(n, m(t, "hover", c2)), h = u(n, m(t, "click", (o2) => {
      o2.button === 0 && l(o2);
    })), k = u(n, m(t, "focus", u$1)), E = u(n, m(t, "focus", c2)), w = u(n, m(t, "contextmenu", (o2) => {
      o2.preventDefault(), l(o2);
    })), x = u(n, (o2) => {
      const { code: g } = o2;
      s2.triggerKeys.includes(g) && (o2.preventDefault(), l(o2));
    });
    return f({
      triggerRef: C
    }), (o2, g) => (openBlock(), createBlock(unref(Y), {
      id: unref(v),
      "virtual-ref": o2.virtualRef,
      open: unref(T),
      "virtual-triggering": o2.virtualTriggering,
      class: normalizeClass(unref(m$1).e("trigger")),
      onBlur: unref(E),
      onClick: unref(h),
      onContextmenu: unref(w),
      onFocus: unref(k),
      onMouseenter: unref(_),
      onMouseleave: unref(M),
      onKeydown: unref(x)
    }, {
      default: withCtx(() => [
        renderSlot(o2.$slots, "default")
      ]),
      _: 3
    }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
  }
});
var Q = /* @__PURE__ */ c(J, [["__file", "trigger.vue"]]);
export {
  Q as default
};
