import { useEffect, useState } from "react";
export function useMediaQuery(query) {
    const [matches, setMatches] = useState(false);
    useEffect(() => {
        if (typeof window === "undefined" || !("matchMedia" in window)) {
            setMatches(false);
            return;
        }
        const media = window.matchMedia(query);
        const updateMatch = () => setMatches(media.matches);
        updateMatch();
        media.addEventListener("change", updateMatch);
        return () => {
            media.removeEventListener("change", updateMatch);
        };
    }, [query]);
    return matches;
}
//# sourceMappingURL=useMediaQuery.js.map