Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.prod.Device.js.map Maven / Gradle / Ivy
{
"version": 3,
"sources": ["../../src/Device.ts"],
"sourcesContent": ["const isSSR = typeof document === \"undefined\";\n\nconst internals = {\n\tget userAgent() {\n\t\tif (isSSR) {\n\t\t\treturn \"\";\n\t\t}\n\t\treturn navigator.userAgent;\n\t},\n\tget touch() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn \"ontouchstart\" in window || navigator.maxTouchPoints > 0;\n\t},\n\n\tget chrome() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn /(Chrome|CriOS)/.test(internals.userAgent);\n\t},\n\tget firefox() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn /Firefox/.test(internals.userAgent);\n\t},\n\tget safari() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn !internals.chrome && /(Version|PhantomJS)\\/(\\d+\\.\\d+).*Safari/.test(internals.userAgent);\n\t},\n\tget webkit() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn /webkit/.test(internals.userAgent);\n\t},\n\tget windows() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn navigator.platform.indexOf(\"Win\") !== -1;\n\t},\n\tget macOS() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn !!navigator.userAgent.match(/Macintosh|Mac OS X/i);\n\t},\n\tget iOS() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn !!(navigator.platform.match(/iPhone|iPad|iPod/)) || !!(internals.userAgent.match(/Mac/) && \"ontouchend\" in document);\n\t},\n\tget android() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn !internals.windows && /Android/.test(internals.userAgent);\n\t},\n\tget androidPhone() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\treturn internals.android && /(?=android)(?=.*mobile)/i.test(internals.userAgent);\n\t},\n\tget ipad() {\n\t\tif (isSSR) {\n\t\t\treturn false;\n\t\t}\n\t\t// With iOS 13 the string 'iPad' was removed from the user agent string through a browser setting, which is applied on all sites by default:\n\t\t// \"Request Desktop Website -> All websites\" (for more infos see: https://forums.developer.apple.com/thread/119186).\n\t\t// Therefore the OS is detected as MACINTOSH instead of iOS and the device is a tablet if the Device.support.touch is true.\n\t\treturn /ipad/i.test(internals.userAgent) || (/Macintosh/i.test(internals.userAgent) && \"ontouchend\" in document);\n\t},\n};\n\nlet windowsVersion: number;\nlet webkitVersion: number;\nlet tablet: boolean;\n\nconst isWindows8OrAbove = () => {\n\tif (isSSR) {\n\t\treturn false;\n\t}\n\n\tif (!internals.windows) {\n\t\treturn false;\n\t}\n\n\tif (windowsVersion === undefined) {\n\t\tconst matches = internals.userAgent.match(/Windows NT (\\d+).(\\d)/);\n\t\twindowsVersion = matches ? parseFloat(matches[1]) : 0;\n\t}\n\n\treturn windowsVersion >= 8;\n};\n\nconst isWebkit537OrAbove = () => {\n\tif (isSSR) {\n\t\treturn false;\n\t}\n\n\tif (!internals.webkit) {\n\t\treturn false;\n\t}\n\n\tif (webkitVersion === undefined) {\n\t\tconst matches = internals.userAgent.match(/(webkit)[ /]([\\w.]+)/);\n\t\twebkitVersion = matches ? parseFloat(matches[1]) : 0;\n\t}\n\n\treturn webkitVersion >= 537.10;\n};\n\nconst detectTablet = () => {\n\tif (isSSR) {\n\t\treturn false;\n\t}\n\n\tif (tablet !== undefined) {\n\t\treturn;\n\t}\n\n\tif (internals.ipad) {\n\t\ttablet = true;\n\t\treturn;\n\t}\n\n\tif (internals.touch) {\n\t\tif (isWindows8OrAbove()) {\n\t\t\ttablet = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif (internals.chrome && internals.android) {\n\t\t\ttablet = !/Mobile Safari\\/[.0-9]+/.test(internals.userAgent);\n\t\t\treturn;\n\t\t}\n\n\t\tlet densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; // may be undefined in Windows Phone devices\n\t\tif (internals.android && isWebkit537OrAbove()) {\n\t\t\tdensityFactor = 1;\n\t\t}\n\n\t\ttablet = (Math.min(window.screen.width / densityFactor, window.screen.height / densityFactor) >= 600);\n\t\treturn;\n\t}\n\n\ttablet = internals.userAgent.indexOf(\"Touch\") !== -1 || (internals.android && !internals.androidPhone);\n};\n\nconst supportsTouch = (): boolean => internals.touch;\nconst isSafari = (): boolean => internals.safari;\nconst isChrome = (): boolean => internals.chrome;\nconst isFirefox = (): boolean => internals.firefox;\n\nconst isTablet = (): boolean => {\n\tdetectTablet();\n\treturn (internals.touch || isWindows8OrAbove()) && tablet;\n};\n\nconst isPhone = (): boolean => {\n\tdetectTablet();\n\treturn internals.touch && !tablet;\n};\n\nconst isDesktop = (): boolean => {\n\tif (isSSR) {\n\t\treturn false;\n\t}\n\treturn (!isTablet() && !isPhone()) || isWindows8OrAbove();\n};\n\nconst isCombi = (): boolean => {\n\treturn isTablet() && isDesktop();\n};\n\nconst isIOS = (): boolean => {\n\treturn internals.iOS;\n};\n\nconst isMac = (): boolean => {\n\treturn internals.macOS;\n};\n\nconst isAndroid = (): boolean => {\n\treturn internals.android || internals.androidPhone;\n};\n\nexport {\n\tsupportsTouch,\n\tisSafari,\n\tisChrome,\n\tisFirefox,\n\tisPhone,\n\tisTablet,\n\tisDesktop,\n\tisCombi,\n\tisIOS,\n\tisAndroid,\n\tisMac,\n};\n"],
"mappings": "aAAA,MAAMA,EAAQ,OAAO,SAAa,IAE5BC,EAAY,CACjB,IAAI,WAAY,CACf,OAAID,EACI,GAED,UAAU,SAClB,EACA,IAAI,OAAQ,CACX,OAAIA,EACI,GAED,iBAAkB,QAAU,UAAU,eAAiB,CAC/D,EAEA,IAAI,QAAS,CACZ,OAAIA,EACI,GAED,iBAAiB,KAAKC,EAAU,SAAS,CACjD,EACA,IAAI,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"isWindows8OrAbove", "matches", "isWebkit537OrAbove", "detectTablet", "densityFactor", "supportsTouch", "isSafari", "isChrome", "isFirefox", "isTablet", "isPhone", "isDesktop", "isCombi", "isIOS", "isMac", "isAndroid"]
}