import { useState as r, useEffect as s } from "react";
function i(e, u) {
  const [o, t] = r(e);
  return s(() => {
    const n = setTimeout(() => {
      t(e);
    }, u);
    return () => {
      clearTimeout(n);
    };
  }, [e]), o;
}
const a = i;
function f(e, u, o) {
  let t;
  function n(...c) {
    t && clearTimeout(t), t = setTimeout(() => e(...c), u);
  }
  return n;
}
export {
  a as useDebounce,
  f as useDebouncedFn,
  i as useDebouncedValue
};
