import { useEffect as u } from "react";
const r = (e, t) => {
  u(() => {
    function n(o) {
      e.current && !e.current.contains(o.target) && t && typeof t == "function" && t(o);
    }
    return document.addEventListener("mousedown", n), () => {
      document.removeEventListener("mousedown", n);
    };
  }, [e]);
};
export {
  r as useOutsideCallback
};
