function getUserAgent() {
    var _a;
    return typeof navigator === 'undefined' ? '' : ((_a = navigator.userAgent) !== null && _a !== void 0 ? _a : '');
}
function getPlatform() {
    var _a, _b, _c;
    if (typeof navigator === 'undefined') {
        return '';
    }
    return ((_c = (_b = (_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.platform) !== null && _b !== void 0 ? _b : navigator.platform) !== null && _c !== void 0 ? _c : '');
}
/**
 *
 */
function isIOSDevice() {
    const userAgent = getUserAgent();
    return /iPad|iPhone|iPod/i.test(userAgent) && !globalThis.MSStream;
}
/**
 *
 */
function isAndroidDevice() {
    const userAgent = getUserAgent();
    return /Android/i.test(userAgent);
}
/**
 *
 */
function isMobileDevice() {
    return isAndroidDevice() || isIOSDevice();
}
/**
 * Detects whether the user is on an Apple device (iOS/iPadOS/macOS).
 */
function isAppleDevice() {
    const ua = getUserAgent();
    const platform = getPlatform();
    const isIPadIPhoneIPod = /iPad|iPhone|iPod/i.test(ua);
    // Note: iPadOS 13+ reports itself as Mac, so isMacLike covers both
    // macOS and iPadOS.
    const isMacLike = /Mac/i.test(platform);
    return isIPadIPhoneIPod || isMacLike;
}

export { isAndroidDevice as a, isMobileDevice as b, isAppleDevice as c, isIOSDevice as i };
