'use strict';

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

var vue = require('vue');
require('../../../utils/index.js');
var shared = require('@vue/shared');

const groupToolTipInjectKey = Symbol("groupToolTipKeys");
const isTriggerType = (trigger, type) => {
  if (shared.isArray(trigger)) {
    return trigger.includes(type);
  }
  return trigger === type;
};
const whenTrigger = (trigger, type, handler) => {
  return (e) => {
    isTriggerType(vue.unref(trigger), type) && handler(e);
  };
};
const seekParent = (e, className, root, parent) => {
  const curTarget = e.target;
  if (!(root == null ? void 0 : root.contains(curTarget))) {
    return null;
  }
  if (!parent && (curTarget == null ? void 0 : curTarget.classList.contains(className))) {
    return curTarget;
  }
  let nextParent = curTarget == null ? void 0 : curTarget.parentNode;
  let elementDom = null;
  while (!elementDom && nextParent) {
    if (nextParent == null ? void 0 : nextParent.classList.contains(className)) {
      elementDom = nextParent;
      break;
    }
    if (document.body === nextParent || nextParent === root) {
      elementDom = null;
      break;
    }
    nextParent = nextParent.parentNode;
  }
  return elementDom;
};

exports.groupToolTipInjectKey = groupToolTipInjectKey;
exports.isTriggerType = isTriggerType;
exports.seekParent = seekParent;
exports.whenTrigger = whenTrigger;
//# sourceMappingURL=utils.js.map
