import { useEffect } from "react";
//#region src/hooks/useWindowSize.ts
const useWindowSize = (options = {}) => {
	const { debounceMs = 100 } = options;
	useEffect(() => {
		let timeoutId;
		const setRealVH = () => {
			let height = window.innerHeight;
			if (new URLSearchParams(window.location.search).has("fromTabbar")) height = height - 54;
			const vh = height * .01;
			document.documentElement.style.setProperty("--vh", `${vh}px`);
		};
		const debouncedHandleResize = () => {
			clearTimeout(timeoutId);
			timeoutId = setTimeout(setRealVH, debounceMs);
		};
		debouncedHandleResize();
		window.addEventListener("resize", debouncedHandleResize);
		return () => {
			window.removeEventListener("resize", debouncedHandleResize);
			clearTimeout(timeoutId);
		};
	}, [debounceMs]);
};
//#endregion
export { useWindowSize as default };
