"use strict";

require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useClickAnywhere = void 0;
var _react = require("react");
var _clickAnywhere = require("../utilities/click-anywhere");
var useClickAnywhere = exports.useClickAnywhere = function useClickAnywhere(cb, windowProxy) {
  var disposer = (0, _react.useRef)();
  return (0, _react.useCallback)(function (dom) {
    if (dom) {
      disposer.current && disposer.current();
      disposer.current = (0, _clickAnywhere.clickAnywhere)(dom, cb, windowProxy);
    }
  }, [cb]);
};