| 1 {"version":3,"names":[],"mappings":"","sources":["bowser.js"],"sourcesContent":[
"/*!\n * Bowser - a browser detector\n * https://github.com/ded/bowser\n * MIT L
icense | (c) Dustin Diaz 2015\n */\n\n!function (root, name, definition) {\n if
(typeof module != 'undefined' && module.exports) module.exports = definition()\
n else if (typeof define == 'function' && define.amd) define(name, definition)\
n else root[name] = definition()\n}(this, 'bowser', function () {\n /**\n *
See useragents.js for examples of navigator.userAgent\n */\n\n var t = true
\n\n function detect(ua) {\n\n function getFirstMatch(regex) {\n var ma
tch = ua.match(regex);\n return (match && match.length > 1 && match[1]) ||
'';\n }\n\n function getSecondMatch(regex) {\n var match = ua.match(r
egex);\n return (match && match.length > 1 && match[2]) || '';\n }\n\n
var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()\n , li
keAndroid = /like android/i.test(ua)\n , android = !likeAndroid && /android
/i.test(ua)\n , nexusMobile = /nexus\\s*[0-6]\\s*/i.test(ua)\n , nexus
Tablet = !nexusMobile && /nexus\\s*[0-9]+/i.test(ua)\n , chromeos = /CrOS/.
test(ua)\n , silk = /silk/i.test(ua)\n , sailfish = /sailfish/i.test(u
a)\n , tizen = /tizen/i.test(ua)\n , webos = /(web|hpw)os/i.test(ua)\n
, windowsphone = /windows phone/i.test(ua)\n , samsungBrowser = /Sams
ungBrowser/i.test(ua)\n , windows = !windowsphone && /windows/i.test(ua)\n
, mac = !iosdevice && !silk && /macintosh/i.test(ua)\n , linux = !andr
oid && !sailfish && !tizen && !webos && /linux/i.test(ua)\n , edgeVersion =
getFirstMatch(/edge\\/(\\d+(\\.\\d+)?)/i)\n , versionIdentifier = getFirst
Match(/version\\/(\\d+(\\.\\d+)?)/i)\n , tablet = /tablet/i.test(ua) && !/t
ablet pc/i.test(ua)\n , mobile = !tablet && /[^-]mobi/i.test(ua)\n , x
box = /xbox/i.test(ua)\n , result\n\n if (/opera/i.test(ua)) {\n //
an old Opera\n result = {\n name: 'Opera'\n , opera: t\n
, version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\\s\\/](\\d+
(\\.\\d+)?)/i)\n }\n } else if (/opr\\/|opios/i.test(ua)) {\n // a
new Opera\n result = {\n name: 'Opera'\n , opera: t\n
, version: getFirstMatch(/(?:opr|opios)[\\s\\/](\\d+(\\.\\d+)?)/i) || versionIde
ntifier\n }\n }\n else if (/SamsungBrowser/i.test(ua)) {\n resul
t = {\n name: 'Samsung Internet for Android'\n , samsungBrowser: t
\n , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\\s\
\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/coast/i.test(ua)) {\n
result = {\n name: 'Opera Coast'\n , coast: t\n , version:
versionIdentifier || getFirstMatch(/(?:coast)[\\s\\/](\\d+(\\.\\d+)?)/i)\n
}\n }\n else if (/yabrowser/i.test(ua)) {\n result = {\n name
: 'Yandex Browser'\n , yandexbrowser: t\n , version: versionIdentifier
|| getFirstMatch(/(?:yabrowser)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n
else if (/ucbrowser/i.test(ua)) {\n result = {\n name: 'UC Browse
r'\n , ucbrowser: t\n , version: getFirstMatch(/(?:ucbrowser)[\\s\
\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/mxios/i.test(ua)) {\n
result = {\n name: 'Maxthon'\n , maxthon: t\n , version:
getFirstMatch(/(?:mxios)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else
if (/epiphany/i.test(ua)) {\n result = {\n name: 'Epiphany'\n
, epiphany: t\n , version: getFirstMatch(/(?:epiphany)[\\s\\/](\\d+(?:\
\.\\d+)+)/i)\n }\n }\n else if (/puffin/i.test(ua)) {\n result =
{\n name: 'Puffin'\n , puffin: t\n , version: getFirstMatc
h(/(?:puffin)[\\s\\/](\\d+(?:\\.\\d+)?)/i)\n }\n }\n else if (/sleipn
ir/i.test(ua)) {\n result = {\n name: 'Sleipnir'\n , sleipnir
: t\n , version: getFirstMatch(/(?:sleipnir)[\\s\\/](\\d+(?:\\.\\d+)+)/i)
\n }\n }\n else if (/k-meleon/i.test(ua)) {\n result = {\n
name: 'K-Meleon'\n , kMeleon: t\n , version: getFirstMatch(/(?:k
-meleon)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (windowsphone
) {\n result = {\n name: 'Windows Phone'\n , windowsphone: t\n
}\n if (edgeVersion) {\n result.msedge = t\n result.vers
ion = edgeVersion\n }\n else {\n result.msie = t\n resul
t.version = getFirstMatch(/iemobile\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n e
lse if (/msie|trident/i.test(ua)) {\n result = {\n name: 'Internet E
xplorer'\n , msie: t\n , version: getFirstMatch(/(?:msie |rv:)(\\d+(\\
.\\d+)?)/i)\n }\n } else if (chromeos) {\n result = {\n name
: 'Chrome'\n , chromeos: t\n , chromeBook: t\n , chrome: t\n
, version: getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\
n } else if (/chrome.+? edge/i.test(ua)) {\n result = {\n name: '
Microsoft Edge'\n , msedge: t\n , version: edgeVersion\n }\n }
\n else if (/vivaldi/i.test(ua)) {\n result = {\n name: 'Vivaldi'
\n , vivaldi: t\n , version: getFirstMatch(/vivaldi\\/(\\d+(\\.\\d
+)?)/i) || versionIdentifier\n }\n }\n else if (sailfish) {\n re
sult = {\n name: 'Sailfish'\n , sailfish: t\n , version: getFir
stMatch(/sailfish\\s?browser\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if
(/seamonkey\\//i.test(ua)) {\n result = {\n name: 'SeaMonkey'\n
, seamonkey: t\n , version: getFirstMatch(/seamonkey\\/(\\d+(\\.\\d+)?)/i)
\n }\n }\n else if (/firefox|iceweasel|fxios/i.test(ua)) {\n res
ult = {\n name: 'Firefox'\n , firefox: t\n , version: getFirstM
atch(/(?:firefox|iceweasel|fxios)[ \\/](\\d+(\\.\\d+)?)/i)\n }\n if (/
\\((mobile|tablet);[^\\)]*rv:[\\d\\.]+\\)/i.test(ua)) {\n result.firefoxo
s = t\n }\n }\n else if (silk) {\n result = {\n name: 'A
mazon Silk'\n , silk: t\n , version : getFirstMatch(/silk\\/(\\d+(\\.\
\d+)?)/i)\n }\n }\n else if (/phantom/i.test(ua)) {\n result = {
\n name: 'PhantomJS'\n , phantom: t\n , version: getFirstMatch(
/phantomjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/slimerjs/i.test(
ua)) {\n result = {\n name: 'SlimerJS'\n , slimer: t\n
, version: getFirstMatch(/slimerjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n e
lse if (/blackberry|\\bbb\\d+/i.test(ua) || /rim\\stablet/i.test(ua)) {\n r
esult = {\n name: 'BlackBerry'\n , blackberry: t\n , version: v
ersionIdentifier || getFirstMatch(/blackberry[\\d]+\\/(\\d+(\\.\\d+)?)/i)\n
}\n }\n else if (webos) {\n result = {\n name: 'WebOS'\n
, webos: t\n , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrow
ser\\/(\\d+(\\.\\d+)?)/i)\n };\n /touchpad\\//i.test(ua) && (result.to
uchpad = t)\n }\n else if (/bada/i.test(ua)) {\n result = {\n
name: 'Bada'\n , bada: t\n , version: getFirstMatch(/dolfin\\/(\\d+(\\
.\\d+)?)/i)\n };\n }\n else if (tizen) {\n result = {\n n
ame: 'Tizen'\n , tizen: t\n , version: getFirstMatch(/(?:tizen\\s?)?br
owser\\/(\\d+(\\.\\d+)?)/i) || versionIdentifier\n };\n }\n else if (
/qupzilla/i.test(ua)) {\n result = {\n name: 'QupZilla'\n , q
upzilla: t\n , version: getFirstMatch(/(?:qupzilla)[\\s\\/](\\d+(?:\\.\\d
+)+)/i) || versionIdentifier\n }\n }\n else if (/chromium/i.test(ua))
{\n result = {\n name: 'Chromium'\n , chromium: t\n ,
version: getFirstMatch(/(?:chromium)[\\s\\/](\\d+(?:\\.\\d+)?)/i) || versionIde
ntifier\n }\n }\n else if (/chrome|crios|crmo/i.test(ua)) {\n re
sult = {\n name: 'Chrome'\n , chrome: t\n , version: getFir
stMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else i
f (android) {\n result = {\n name: 'Android'\n , version: ver
sionIdentifier\n }\n }\n else if (/safari|applewebkit/i.test(ua)) {\n
result = {\n name: 'Safari'\n , safari: t\n }\n if (
versionIdentifier) {\n result.version = versionIdentifier\n }\n }
\n else if (iosdevice) {\n result = {\n name : iosdevice == 'ipho
ne' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'\n }\n // WTF: v
ersion is not part of user agent in web apps\n if (versionIdentifier) {\n
result.version = versionIdentifier\n }\n }\n else if(/googlebot
/i.test(ua)) {\n result = {\n name: 'Googlebot'\n , googlebot:
t\n , version: getFirstMatch(/googlebot\\/(\\d+(\\.\\d+))/i) || versionIden
tifier\n }\n }\n else {\n result = {\n name: getFirstMatc
h(/^(.*)\\/(.*) /),\n version: getSecondMatch(/^(.*)\\/(.*) /)\n };\n
}\n\n // set webkit or gecko flag for browsers based on these engines\n
if (!result.msedge && /(apple)?webkit/i.test(ua)) {\n if (/(apple)?webkit\
\/537\\.36/i.test(ua)) {\n result.name = result.name || \"Blink\"\n
result.blink = t\n } else {\n result.name = result.name || \"Webki
t\"\n result.webkit = t\n }\n if (!result.version && versionIde
ntifier) {\n result.version = versionIdentifier\n }\n } else if (
!result.opera && /gecko\\//i.test(ua)) {\n result.name = result.name || \"G
ecko\"\n result.gecko = t\n result.version = result.version || getFirs
tMatch(/gecko\\/(\\d+(\\.\\d+)?)/i)\n }\n\n // set OS flags for platforms
that have multiple browsers\n if (!result.windowsphone && !result.msedge && (
android || result.silk)) {\n result.android = t\n } else if (!result.win
dowsphone && !result.msedge && iosdevice) {\n result[iosdevice] = t\n
result.ios = t\n } else if (mac) {\n result.mac = t\n } else if (xbox
) {\n result.xbox = t\n } else if (windows) {\n result.windows = t\
n } else if (linux) {\n result.linux = t\n }\n\n function getWindo
wsVersion (s) {\n switch (s) {\n case 'NT': return 'NT'\n cas
e 'XP': return 'XP'\n case 'NT 5.0': return '2000'\n case 'NT 5.1'
: return 'XP'\n case 'NT 5.2': return '2003'\n case 'NT 6.0': retu
rn 'Vista'\n case 'NT 6.1': return '7'\n case 'NT 6.2': return '8'
\n case 'NT 6.3': return '8.1'\n case 'NT 10.0': return '10'\n
default: return undefined\n }\n }\n\n // OS version extraction\n
var osVersion = '';\n if (result.windows) {\n osVersion = getWindowsV
ersion(getFirstMatch(/Windows ((NT|XP)( \\d\\d?.\\d)?)/i))\n } else if (resul
t.windowsphone) {\n osVersion = getFirstMatch(/windows phone (?:os)?\\s?(\\
d+(\\.\\d+)*)/i);\n } else if (result.mac) {\n osVersion = getFirstMatch
(/Mac OS X (\\d+([_\\.\\s]\\d+)*)/i);\n osVersion = osVersion.replace(/[_\\
s]/g, '.');\n } else if (iosdevice) {\n osVersion = getFirstMatch(/os (\
\d+([_\\s]\\d+)*) like mac os x/i);\n osVersion = osVersion.replace(/[_\\s]
/g, '.');\n } else if (android) {\n osVersion = getFirstMatch(/android[
\\/-](\\d+(\\.\\d+)*)/i);\n } else if (result.webos) {\n osVersion = get
FirstMatch(/(?:web|hpw)os\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.blackber
ry) {\n osVersion = getFirstMatch(/rim\\stablet\\sos\\s(\\d+(\\.\\d+)*)/i);
\n } else if (result.bada) {\n osVersion = getFirstMatch(/bada\\/(\\d+(\
\.\\d+)*)/i);\n } else if (result.tizen) {\n osVersion = getFirstMatch(/
tizen[\\/\\s](\\d+(\\.\\d+)*)/i);\n }\n if (osVersion) {\n result.osv
ersion = osVersion;\n }\n\n // device type extraction\n var osMajorVers
ion = !result.windows && osVersion.split('.')[0];\n if (\n tablet\n
|| nexusTablet\n || iosdevice == 'ipad'\n || (android && (osMajorV
ersion == 3 || (osMajorVersion >= 4 && !mobile)))\n || result.silk\n ) {
\n result.tablet = t\n } else if (\n mobile\n || iosdevice
== 'iphone'\n || iosdevice == 'ipod'\n || android\n || nexusMobil
e\n || result.blackberry\n || result.webos\n || result.bada\n
) {\n result.mobile = t\n }\n\n // Graded Browser Support\n // htt
p://developer.yahoo.com/yui/articles/gbs\n if (result.msedge ||\n (res
ult.msie && result.version >= 10) ||\n (result.yandexbrowser && result.ve
rsion >= 15) ||\n\t\t (result.vivaldi && result.version >= 1.0) ||\n (
result.chrome && result.version >= 20) ||\n (result.samsungBrowser && res
ult.version >= 4) ||\n (result.firefox && result.version >= 20.0) ||\n
(result.safari && result.version >= 6) ||\n (result.opera && result.
version >= 10.0) ||\n (result.ios && result.osversion && result.osversion
.split(\".\")[0] >= 6) ||\n (result.blackberry && result.version >= 10.1)
\n || (result.chromium && result.version >= 20)\n ) {\n resul
t.a = t;\n }\n else if ((result.msie && result.version < 10) ||\n (
result.chrome && result.version < 20) ||\n (result.firefox && result.vers
ion < 20.0) ||\n (result.safari && result.version < 6) ||\n (resul
t.opera && result.version < 10.0) ||\n (result.ios && result.osversion &&
result.osversion.split(\".\")[0] < 6)\n || (result.chromium && result.ve
rsion < 20)\n ) {\n result.c = t\n } else result.x = t\n\n ret
urn result\n }\n\n var bowser = detect(typeof navigator !== 'undefined' ? navi
gator.userAgent || '' : '')\n\n bowser.test = function (browserList) {\n for
(var i = 0; i < browserList.length; ++i) {\n var browserItem = browserList
[i];\n if (typeof browserItem=== 'string') {\n if (browserItem in bo
wser) {\n return true;\n }\n }\n }\n return false;\n
}\n\n /**\n * Get version precisions count\n *\n * @example\n * getV
ersionPrecision(\"1.10.3\") // 3\n *\n * @param {string} version\n * @ret
urn {number}\n */\n function getVersionPrecision(version) {\n return versi
on.split(\".\").length;\n }\n\n /**\n * Array::map polyfill\n *\n * @par
am {Array} arr\n * @param {Function} iterator\n * @return {Array}\n */\n
function map(arr, iterator) {\n var result = [], i;\n if (Array.prototyp
e.map) {\n return Array.prototype.map.call(arr, iterator);\n }\n for
(i = 0; i < arr.length; i++) {\n result.push(iterator(arr[i]));\n }\n
return result;\n }\n\n /**\n * Calculate browser version weight\n *\n *
@example\n * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1\n * c
ompareVersions(['1.010.2.1', '1.09.2.1.90']); // 1\n * compareVersions(['1.
10.2.1', '1.10.2.1']); // 0\n * compareVersions(['1.10.2.1', '1.0800.2
']); // -1\n *\n * @param {Array<String>} versions versions to compare\
n * @return {Number} comparison result\n */\n function compareVersions(vers
ions) {\n // 1) get common precision for both versions, for example for \"10.
0\" and \"9\" it should be 2\n var precision = Math.max(getVersionPrecision(v
ersions[0]), getVersionPrecision(versions[1]));\n var chunks = map(versions,
function (version) {\n var delta = precision - getVersionPrecision(version)
;\n\n // 2) \"9\" -> \"9.0\" (for precision = 2)\n version = version +
new Array(delta + 1).join(\".0\");\n\n // 3) \"9.0\" -> [\"000000000\"\",
\"000000009\"]\n return map(version.split(\".\"), function (chunk) {\n
return new Array(20 - chunk.length).join(\"0\") + chunk;\n }).reverse();
\n });\n\n // iterate in reverse order by reversed chunks array\n while
(--precision >= 0) {\n // 4) compare: \"000000009\" > \"000000010\" = fals
e (but \"9\" > \"10\" = true)\n if (chunks[0][precision] > chunks[1][precis
ion]) {\n return 1;\n }\n else if (chunks[0][precision] === chu
nks[1][precision]) {\n if (precision === 0) {\n // all version c
hunks are same\n return 0;\n }\n }\n else {\n r
eturn -1;\n }\n }\n }\n\n /**\n * Check if browser is unsupported\n
*\n * @example\n * bowser.isUnsupportedBrowser({\n * msie: \"10\",
\n * firefox: \"23\",\n * chrome: \"29\",\n * safari: \"5.1\",
\n * opera: \"16\",\n * phantom: \"534\"\n * });\n *\n * @pa
ram {Object} minVersions map of minimal version to browser\n * @param {Bool
ean} [strictMode = false] flag to return false if browser wasn't found in map\n
* @param {String} [ua] user agent string\n * @return {Boolean}\n */\n f
unction isUnsupportedBrowser(minVersions, strictMode, ua) {\n var _bowser = b
owser;\n\n // make strictMode param optional with ua param usage\n if (typ
eof strictMode === 'string') {\n ua = strictMode;\n strictMode = void(
0);\n }\n\n if (strictMode === void(0)) {\n strictMode = false;\n
}\n if (ua) {\n _bowser = detect(ua);\n }\n\n var version = \"\" +
_bowser.version;\n for (var browser in minVersions) {\n if (minVersions
.hasOwnProperty(browser)) {\n if (_bowser[browser]) {\n if (type
of minVersions[browser] !== 'string') {\n throw new Error('Browser ve
rsion in the minVersion map should be a string: ' + browser + ': ' + String(minV
ersions));\n }\n\n // browser version and min supported versio
n.\n return compareVersions([version, minVersions[browser]]) < 0;\n
}\n }\n }\n\n return strictMode; // not found\n }\n\n /**\n *
Check if browser is supported\n *\n * @param {Object} minVersions map of m
inimal version to browser\n * @param {Boolean} [strictMode = false] flag to r
eturn false if browser wasn't found in map\n * @param {String} [ua] user age
nt string\n * @return {Boolean}\n */\n function check(minVersions, strictMo
de, ua) {\n return !isUnsupportedBrowser(minVersions, strictMode, ua);\n }\n
\n bowser.isUnsupportedBrowser = isUnsupportedBrowser;\n bowser.compareVersion
s = compareVersions;\n bowser.check = check;\n\n /*\n * Set our detect metho
d to the main bowser object so we can\n * reuse it to test other user agents.\
n * This is needed to implement future tests.\n */\n bowser._detect = detec
t;\n\n return bowser\n});"],"file":"bowser.js"} |