import{useState as e,useEffect as t}from"react";function o(o={}){const{timeout:r=1e4,events:n=["mousemove","mousedown","resize","keydown","touchstart","wheel"]}=o,[s,i]=e(!1);return t(()=>{let e;const t=()=>{i(!0)},o=()=>{clearTimeout(e),e=setTimeout(t,r)};s||o();const u=()=>{s?i(!1):o()};return n.forEach(e=>{window.addEventListener(e,u,{passive:!0})}),()=>{clearTimeout(e),n.forEach(e=>{window.removeEventListener(e,u)})}},[r,n,s]),s}export{o as default};
