import { QUERIES as e } from "../../../types/Devices.js";
import { getInitialState as t, reducer as n } from "../reducers/reducer.js";
import { useEffect as r, useReducer as i } from "react";
//#region lib/ui/contexts/devices/hooks/useQueries.ts
function a({ device: a, direction: o }) {
	let [s, c] = i(n, {
		device: a,
		direction: o
	}, t);
	return r(() => {
		let t = window.matchMedia(e.SMALL), n = window.matchMedia(e.MEDIUM), r = window.matchMedia(e.LARGE), i = window.matchMedia(e.XLARGE), a = ({ matches: e }) => {
			c({
				type: "small",
				payload: e
			});
		}, o = ({ matches: e }) => {
			c({
				type: "medium",
				payload: e
			});
		}, s = ({ matches: e }) => {
			c({
				type: "large",
				payload: e
			});
		}, l = ({ matches: e }) => {
			c({
				type: "xlarge",
				payload: e
			});
		};
		return t.addEventListener("change", a, { passive: !0 }), n.addEventListener("change", o, { passive: !0 }), r.addEventListener("change", s, { passive: !0 }), i.addEventListener("change", l, { passive: !0 }), () => {
			t.removeEventListener("change", a), n.removeEventListener("change", o), r.removeEventListener("change", s), i.removeEventListener("change", l);
		};
	}, []), s;
}
//#endregion
export { a as useQueries };

//# sourceMappingURL=useQueries.js.map