import { trigger as e } from "./infiniteScrollTrigger.css.js";
import { useEffect as t, useRef as n } from "react";
import { jsx as r } from "react/jsx-runtime";
//#region src/components/infinite/InfiniteScrollTrigger.tsx
var i = ({ enabled: i, hasNext: a, isLoading: o, onTrigger: s, thresholdPx: c = 800, loadingLabel: l }) => {
	let u = n(null);
	return t(() => {
		if (!i || !a || o) return () => {};
		let e = u.current;
		if (e == null || typeof window > "u") return () => {};
		let t = new IntersectionObserver((e) => {
			e[0]?.isIntersecting === !0 && s();
		}, {
			root: null,
			rootMargin: `${c}px`
		});
		return t.observe(e), () => {
			t.disconnect();
		};
	}, [
		i,
		a,
		o,
		s,
		c
	]), !i || !a ? null : /* @__PURE__ */ r("div", {
		ref: u,
		className: e,
		"aria-hidden": "true",
		children: o && /* @__PURE__ */ r("span", {
			className: "_14q3b2q1 txvbqb8y txvbqbva1",
			children: l
		})
	});
};
//#endregion
export { i as InfiniteScrollTrigger, i as default };

//# sourceMappingURL=InfiniteScrollTrigger.js.map