"use client";
import { useIsomorphicEffect } from "../use-isomorphic-effect/use-isomorphic-effect.mjs";
import { useState } from "react";
//#region packages/@mantine/hooks/src/use-os/use-os.ts
function isMacOS(userAgent) {
	return /(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i.test(userAgent);
}
function isIOS(userAgent) {
	return /(iPhone)|(iPad)|(iPod)/i.test(userAgent);
}
function isWindows(userAgent) {
	return /(Win32)|(Win64)|(Windows)|(WinCE)/i.test(userAgent);
}
function isAndroid(userAgent) {
	return /Android/i.test(userAgent);
}
function isLinux(userAgent) {
	return /Linux/i.test(userAgent);
}
function isChromeOS(userAgent) {
	return /CrOS/i.test(userAgent);
}
function getOS() {
	if (typeof window === "undefined") return "undetermined";
	const { userAgent } = window.navigator;
	if (isIOS(userAgent) || isMacOS(userAgent) && "ontouchend" in document) return "ios";
	if (isMacOS(userAgent)) return "macos";
	if (isWindows(userAgent)) return "windows";
	if (isAndroid(userAgent)) return "android";
	if (isChromeOS(userAgent)) return "chromeos";
	if (isLinux(userAgent)) return "linux";
	return "undetermined";
}
function useOs(options = { getValueInEffect: true }) {
	const [value, setValue] = useState(options.getValueInEffect ? "undetermined" : getOS());
	useIsomorphicEffect(() => {
		if (options.getValueInEffect) setValue(getOS);
	}, []);
	return value;
}
//#endregion
export { useOs };

//# sourceMappingURL=use-os.mjs.map