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