import { useState as r, useEffect as o } from "react";
const w = (e = 0) => {
  const [i, t] = r(window.innerWidth);
  return o(() => {
    const n = e ? d(() => t(window.innerWidth), e) : () => t(window.innerWidth);
    return window.addEventListener("resize", n), () => {
      window.removeEventListener("resize", n);
    };
  }, [e]), i;
};
function d(e, i = 300) {
  let t;
  return function(...n) {
    clearTimeout(t), t = setTimeout(() => {
      e.apply(this, n);
    }, i);
  };
}
export {
  w as useWindowResize
};
