import { c } from "react/compiler-runtime";
import { useCallback, useEffect, useState } from "react";
function useScrollToBottom(i) {
	let a = c(7), o = i === void 0 ? 50 : i, [s, l] = useState(!1), u;
	a[0] === o ? u = a[1] : (u = () => {
		let e = document.documentElement;
		l(e.scrollHeight - e.scrollTop - e.clientHeight > o);
	}, a[0] = o, a[1] = u);
	let d = u, f = _temp, p, m;
	a[2] === d ? (p = a[3], m = a[4]) : (p = () => {
		window.addEventListener("scroll", d, { passive: !0 }), d();
		let e = setInterval(d, 500);
		return () => {
			window.removeEventListener("scroll", d), clearInterval(e);
		};
	}, m = [d], a[2] = d, a[3] = p, a[4] = m), useEffect(p, m);
	let h;
	return a[5] === s ? h = a[6] : (h = {
		canScrollDown: s,
		scrollToBottom: f
	}, a[5] = s, a[6] = h), h;
}
function _temp() {
	window.scrollTo({
		top: document.documentElement.scrollHeight,
		behavior: "smooth"
	});
}
export { useScrollToBottom };
