'use strict';

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

var vue = require('vue');
require('../../slot/index.js');
var props = require('./props.js');
var utils = require('./utils.js');
var main = require('./main.js');
var onlyChild = require('../../slot/src/only-child.js');

const Tooltip = vue.defineComponent({
  name: "ElTooltip",
  props: props.useTooltipProps,
  emits: props.tooltipEmits,
  setup(props$1, ctx) {
    const groupData = vue.inject(utils.groupToolTipInjectKey, null);
    const instance = vue.getCurrentInstance();
    const computedData = vue.computed(() => {
      return {
        ...instance.vnode.props || {},
        ...props$1,
        content: ctx.slots.content ? ctx.slots.content : props$1.content,
        __provides__: instance == null ? void 0 : instance.provides
      };
    });
    const main$1 = vue.ref();
    const exposeValue = new Proxy({}, {
      get(target, key) {
        var _a;
        return (_a = main$1.value) == null ? void 0 : _a[key];
      },
      has(target, p) {
        return main$1.value ? Reflect.has(main$1.value, p) : false;
      }
    });
    ctx.expose(exposeValue);
    if (groupData && !props$1.boolGroupTooltipUncontrolled) {
      vue.onMounted(() => {
        groupData.instanceData.set(instance.proxy.$el, computedData);
      });
      return () => {
        return vue.createVNode(onlyChild.OnlyChild, {
          "class": groupData.key
        }, {
          default: () => [ctx.slots.default()[0]]
        });
      };
    } else {
      const emits = props.tooltipEmits.reduce((em, item) => {
        em[`on-${item}`.replace(/-(\w)/g, (_, c) => c.toUpperCase())] = (...args) => ctx.emit(item, ...args);
        return em;
      }, {});
      return () => {
        return vue.createVNode(main["default"], vue.mergeProps({
          "ref": main$1
        }, props$1, emits), ctx.slots);
      };
    }
  }
});

exports.Tooltip = Tooltip;
//# sourceMappingURL=render.js.map
