/**
 * v-click-outside
 *
 * ```vue
 * <div v-click-outside="onClickOutside">
 * ```
 */
export default {
  inserted: function inserted(el, binding) {
    el._clickOutside = function (e) {
      if (!el.contains(e.target)) {
        binding.value(e);
      }
    };

    document.body.addEventListener('click', el._clickOutside, true);
  },
  unbind: function unbind(el) {
    /* istanbul ignore next */
    if (!el._clickOutside) {
      return;
    }

    document.body.removeEventListener('click', el._clickOutside, true);
    delete el._clickOutside;
  }
};
//# sourceMappingURL=click-outside.js.map