import { useRef as a, useCallback as f, useEffect as m } from "react";
import c from "../useMemoizedFn/index.mjs";
import { isNumber as l } from "../utils/index.mjs";
var v = function(n, r, e) {
  e === void 0 && (e = {});
  var u = c(n), t = a(null), i = f(function() {
    t.current && clearInterval(t.current);
  }, []);
  return m(function() {
    if (!(!l(r) || r < 0))
      return e.immediate && u(), t.current = setInterval(u, r), i;
  }, [r, e.immediate]), i;
};
const b = v;
export {
  b as default
};
