import { useState as c, useEffect as i } from "react";
const f = () => document.querySelector(".module-content > .scrollbar-view"), d = (e) => {
  const [n, l] = c(null), [u, o] = c(0);
  i(() => {
    let t = null;
    return e ? e && t ? clearInterval(t) : e instanceof Object && "current" in e && e.current ? l(e.current) : l(e) : t = setInterval(() => {
      const s = f();
      s && l(s);
    }, 300), () => {
      t && clearInterval(t);
    };
  }, [e]);
  const r = () => {
    requestAnimationFrame(() => {
      o(n === window ? window.scrollY : n.scrollTop);
    });
  };
  return i(() => (n instanceof EventTarget && n.addEventListener("scroll", r), () => {
    n instanceof EventTarget && n.removeEventListener("scroll", r);
  }), [n]), u;
};
export {
  d as default
};
//# sourceMappingURL=useScrollPosition.js.map
