import { PACKAGE_VERSION_EXPORT } from '../config/constants';
export const getNavigatorInfo = () => {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
    let browserInfo = 'Unknown';
    let deviceInfo = 'Unknown';
    let osInfo = 'Unknown';
    if (navigator.userAgent) {
        const userAgent = navigator.userAgent;
        // Detect device type
        if (/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
            deviceInfo = 'Mobile';
        }
        else if (/Tablet|iPad/i.test(userAgent)) {
            deviceInfo = 'Tablet';
        }
        else {
            // Default to desktop for other cases
            deviceInfo = 'Desktop';
        }
        // Detect browser and version
        if (userAgent.includes('Firefox')) {
            browserInfo = `Mozilla Firefox ${((_a = userAgent.match(/Firefox\/(\d+\.\d+)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''}`;
        }
        else if (userAgent.includes('Chrome') && !userAgent.includes('Edg')) {
            browserInfo = `Google Chrome ${((_b = userAgent.match(/Chrome\/(\d+\.\d+)/)) === null || _b === void 0 ? void 0 : _b[1]) || ''}`;
        }
        else if (userAgent.includes('Edg')) {
            browserInfo = `Microsoft Edge ${((_c = userAgent.match(/Edg\/(\d+\.\d+)/)) === null || _c === void 0 ? void 0 : _c[1]) || ''}`;
        }
        else if (userAgent.includes('Safari') && !userAgent.includes('Chrome')) {
            browserInfo = `Safari ${((_d = userAgent.match(/Version\/(\d+\.\d+)/)) === null || _d === void 0 ? void 0 : _d[1]) || ''}`;
        }
        else if (userAgent.includes('Opera') || userAgent.includes('OPR')) {
            browserInfo = `Opera ${((_e = userAgent.match(/(Opera|OPR)\/(\d+\.\d+)/)) === null || _e === void 0 ? void 0 : _e[2]) || ''}`;
        }
        else if (userAgent.includes('Trident')) {
            browserInfo = `Internet Explorer ${((_f = userAgent.match(/rv:(\d+\.\d+)/)) === null || _f === void 0 ? void 0 : _f[1]) || ''}`;
        }
        else {
            browserInfo = 'Unknown browser';
        }
        // Detect OS and version
        if (userAgent.includes('Win')) {
            osInfo = `Windows ${((_g = userAgent.match(/Windows NT (\d+\.\d+)/)) === null || _g === void 0 ? void 0 : _g[1]) || ''}`;
        }
        else if (userAgent.includes('Mac')) {
            osInfo = `MacOS ${((_h = userAgent.match(/Mac OS X (\d+_\d+)/)) === null || _h === void 0 ? void 0 : _h[1].replace('_', '.')) || ''}`;
        }
        else if (userAgent.includes('Linux')) {
            osInfo = 'Linux';
        }
        else if (userAgent.includes('Android')) {
            osInfo = `Android ${((_j = userAgent.match(/Android (\d+\.\d+)/)) === null || _j === void 0 ? void 0 : _j[1]) || ''}`;
        }
        else if (userAgent.includes('iPhone') || userAgent.includes('iPad')) {
            osInfo = `iOS ${((_k = userAgent.match(/OS (\d+_\d+)/)) === null || _k === void 0 ? void 0 : _k[1].replace('_', '.')) || ''}`;
        }
        else {
            osInfo = 'Unknown OS';
        }
    }
    const hardwareConcurrency = navigator.hardwareConcurrency || 1;
    const cookiesEnabled = navigator.cookieEnabled ? 'Yes' : 'No';
    const pixelRatio = window.devicePixelRatio || 1;
    const screenSize = `${window.screen.width}x${window.screen.height}`;
    // Get package version from constants
    const packageVersion = PACKAGE_VERSION_EXPORT;
    return {
        osInfo,
        screenSize,
        pixelRatio,
        deviceInfo,
        browserInfo,
        cookiesEnabled,
        hardwareConcurrency,
        packageVersion,
        // System type identifier (previously in system tags)
        systemType: 'web',
        // Platform identifier (previously in system tags)
        platform: osInfo,
    };
};
//# sourceMappingURL=navigator.js.map