"use strict";
/**
 * Source for device info
 * Ported from https://github.com/optimizely/client-js/blob/363e9bfd8cf333d82c977789bcc58a00137cc412/src/plugins/feature_device/sources/device.js
 * Modified to accept device as an argument
 * @module
 */
/**
 * Get device info from userAgent
 * @returns {detectionResults.device|*}
 */
exports.getDevice = function (device) {
    if (device.model !== 'unknown') {
        return device.model;
    }
    if (device.type === 'tablet') {
        return 'tablet';
    }
    if (device.isMobile) {
        // Devices that aren't iPhone, iPad, or other tablet, but are running
        // an OS that is known to only be on phones and tablets.
        return 'mobile';
    }
    else {
        return 'desktop';
    }
};
