UNPKG

@2l/ewa-analytics-web-sdk

Version:

A lightweight TypeScript SDK for tracking user events and analytics data in web applications. Provides real-time event tracking with support for both WebSocket and HTTP transport methods.

1,756 lines 143 kB
function $e(n, e) { return { ...n, ...e }; } class Xt { baseURL; headers; constructor(e = {}) { const { baseURL: t = "", headers: i = {} } = e; this.baseURL = t, this.headers = i; } buildUrl(e, t) { const i = new URL(`${this.baseURL}${e}`); if (t) { const s = new URLSearchParams(Object.entries(t)); i.search = `?${s.toString()}`; } return i.toString(); } isValidUrl(e) { try { return new URL(e), !0; } catch { return !1; } } buildRequestOptions(e, t) { const i = { method: e, headers: t.headers || this.headers }; return t.body && (i.body = t.body, i.headers["Content-Type"] = "application/json"), i; } async sendRequest(e, t) { if (!this.isValidUrl(e)) return Promise.reject(new Error("Invalid URL provided")); const i = await fetch(e, t); return i.ok ? i.json() : this.handleErrorResponse(i); } async handleErrorResponse(e) { try { const t = await e.text(), { error: i } = JSON.parse(t); return Promise.reject($e(e, i)); } catch (t) { return Promise.reject($e(e, t)); } } async fetch(e, t, i, s) { const o = this.buildUrl(t, i.queryParameters), r = this.buildRequestOptions(e, i); return s && (r.body = JSON.stringify(s), r.headers["Content-Type"] = "application/json"), this.sendRequest(o, r); } setHeaders(e, t) { this.headers = t ? e : $e(this.headers || {}, e); } async post(e, t, i = { method: "POST" }) { return this.fetch("POST", e, i, t); } } var P = []; for (var Ge = 0; Ge < 256; ++Ge) P.push((Ge + 256).toString(16).slice(1)); function Yt(n, e = 0) { return (P[n[e + 0]] + P[n[e + 1]] + P[n[e + 2]] + P[n[e + 3]] + "-" + P[n[e + 4]] + P[n[e + 5]] + "-" + P[n[e + 6]] + P[n[e + 7]] + "-" + P[n[e + 8]] + P[n[e + 9]] + "-" + P[n[e + 10]] + P[n[e + 11]] + P[n[e + 12]] + P[n[e + 13]] + P[n[e + 14]] + P[n[e + 15]]).toLowerCase(); } var Ce, Zt = new Uint8Array(16); function Qt() { if (!Ce && (Ce = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Ce)) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); return Ce(Zt); } var ei = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto); const pt = { randomUUID: ei }; function ti(n, e, t) { if (pt.randomUUID && !n) return pt.randomUUID(); n = n || {}; var i = n.random || (n.rng || Qt)(); return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Yt(i); } const lt = (n, e) => { const t = {}; for (const i of e) n[i] && (t[i] = n[i]); return t; }, ut = (n) => { const e = {}; for (const t of Object.keys(n)) n[t] && (e[t] = n[t]); return e; }; class Ut { random_user_id = ""; event_name = ""; app_id = ""; platform = ""; created_at_milli = Date.now(); event_subtype; web_uuid; session_id; customer_user_id; app_version; web_hwid; country; event_value; // user agent fields language; timezone; os_version; os_name; device_name; device_type; browser; browser_version; constructor(e) { const t = ["created_at_milli"]; for (const s of Object.keys(this)) t.includes(s) || (this[s] = e[s]); this.event_subtype = e?.subtype || e?.event_subtype, this.random_user_id = e?.randomUserId, this.app_id = e?.appId, this.app_version = e?.appVersion, this.platform = e?.platform, this.session_id = e?.sessionId; const i = lt(e, Object.keys(this)); this.setUserAgentFields(e.userAgent), t.forEach((s) => { i[s] = this[s]; }), Object.assign(this, i); } // Protected helper method to set user agent fields setUserAgentFields(e) { this.language = navigator.language.split("-")[0], this.timezone = e.getTimezone(), this.os_version = e.detectOSVersion(), this.os_name = e.detectOS(), this.device_name = e.detectDeviceName(), this.device_type = e.detectDeviceType(), this.browser = e.getBrowserName(), this.browser_version = e.getBrowserVersion(); } // Async method to set fingerprint after construction async setFingerprint(e) { this.web_hwid = await e.getFingerPrint(); } } class ii extends Ut { store; tracker; tracker_name; network_name; campaign_name; adgroup_name; creative_name; connection_type; adjust_tracker_id; user_agent; ip_address; environment; att_status; constructor(e) { super(e); const t = ["created_at_milli"], i = Object.keys(this); for (const o of Object.keys(this)) t.includes(o) || (this[o] = e[o]); const s = lt(e, i); this.setUserAgentFields(e.userAgent), Object.assign(this, s); } } class ni extends Ut { event_id = ""; event; event_type; native_language; learning_language; sdk_version; constructor(e) { super(e); function t(o) { const r = new Set(Object.keys({})), f = new Set(Object.keys({})), l = new Set(Object.keys({})), p = {}; for (const [g, S] of Object.entries(o)) !r.has(g) && !f.has(g) && !l.has(g) && (p[g] = S); return JSON.stringify(ut(p)); } this.event_value = t(e), this.event_id = ti(); const i = Object.keys(this), s = lt(e, i); Object.assign(this, s); } } async function si(n) { const e = new ii(n); return await e.setFingerprint(n.userAgent), ut(e); } async function ri(n) { const e = new ni(n); return await e.setFingerprint(n.userAgent), ut(e); } var oi = "2.0.4", rt = 500, _t = "user-agent", le = "", gt = "?", De = "function", Q = "undefined", ue = "object", ot = "string", D = "browser", V = "cpu", B = "device", N = "engine", W = "os", oe = "result", h = "name", a = "type", u = "vendor", d = "version", U = "architecture", Ee = "major", c = "model", ve = "console", _ = "mobile", v = "tablet", C = "smarttv", F = "wearable", xe = "xr", ye = "embedded", fe = "inapp", ht = "brands", ne = "formFactors", dt = "fullVersionList", ae = "platform", ft = "platformVersion", Fe = "bitness", ee = "sec-ch-ua", ai = ee + "-full-version-list", ci = ee + "-arch", li = ee + "-" + Fe, ui = ee + "-form-factors", hi = ee + "-" + _, di = ee + "-" + c, jt = ee + "-" + ae, fi = jt + "-version", Mt = [ht, dt, _, c, ae, ft, U, ne, Fe], Re = "Amazon", se = "Apple", mt = "ASUS", wt = "BlackBerry", te = "Google", vt = "Huawei", Ke = "Lenovo", yt = "Honor", Oe = "LG", Je = "Microsoft", Xe = "Motorola", Ye = "Nvidia", St = "OnePlus", Ze = "OPPO", be = "Samsung", kt = "Sharp", pe = "Sony", Qe = "Xiaomi", et = "Zebra", Et = "Chrome", Tt = "Chromium", X = "Chromecast", Ie = "Edge", _e = "Firefox", ge = "Opera", tt = "Facebook", Ct = "Sogou", re = "Mobile ", me = " Browser", at = "Windows", bi = typeof window !== Q, j = bi && window.navigator ? window.navigator : void 0, Y = j && j.userAgentData ? j.userAgentData : void 0, pi = function(n, e) { var t = {}, i = e; if (!Ue(e)) { i = {}; for (var s in e) for (var o in e[s]) i[o] = e[s][o].concat(i[o] ? i[o] : []); } for (var r in n) t[r] = i[r] && i[r].length % 2 === 0 ? i[r].concat(n[r]) : n[r]; return t; }, qe = function(n) { for (var e = {}, t = 0; t < n.length; t++) e[n[t].toUpperCase()] = n[t]; return e; }, ct = function(n, e) { if (typeof n === ue && n.length > 0) { for (var t in n) if ($(e) == $(n[t])) return !0; return !1; } return de(n) ? $(e) == $(n) : !1; }, Ue = function(n, e) { for (var t in n) return /^(browser|cpu|device|engine|os)$/.test(t) || (e ? Ue(n[t]) : !1); }, de = function(n) { return typeof n === ot; }, it = function(n) { if (n) { for (var e = [], t = he(/\\?\"/g, n).split(","), i = 0; i < t.length; i++) if (t[i].indexOf(";") > -1) { var s = je(t[i]).split(";v="); e[i] = { brand: s[0], version: s[1] }; } else e[i] = je(t[i]); return e; } }, $ = function(n) { return de(n) ? n.toLowerCase() : n; }, nt = function(n) { return de(n) ? he(/[^\d\.]/g, n).split(".")[0] : void 0; }, G = function(n) { for (var e in n) { var t = n[e]; typeof t == ue && t.length == 2 ? this[t[0]] = t[1] : this[t] = void 0; } return this; }, he = function(n, e) { return de(e) ? e.replace(n, le) : e; }, we = function(n) { return he(/\\?\"/g, n); }, je = function(n, e) { if (de(n)) return n = he(/^\s\s*/, n), typeof e === Q ? n : n.substring(0, rt); }, st = function(n, e) { if (!(!n || !e)) for (var t = 0, i, s, o, r, f, l; t < e.length && !f; ) { var p = e[t], g = e[t + 1]; for (i = s = 0; i < p.length && !f && p[i]; ) if (f = p[i++].exec(n), f) for (o = 0; o < g.length; o++) l = f[++s], r = g[o], typeof r === ue && r.length > 0 ? r.length === 2 ? typeof r[1] == De ? this[r[0]] = r[1].call(this, l) : this[r[0]] = r[1] : r.length >= 3 && (typeof r[1] === De && !(r[1].exec && r[1].test) ? r.length > 3 ? this[r[0]] = l ? r[1].apply(this, r.slice(2)) : void 0 : this[r[0]] = l ? r[1].call(this, l, r[2]) : void 0 : r.length == 3 ? this[r[0]] = l ? l.replace(r[1], r[2]) : void 0 : r.length == 4 ? this[r[0]] = l ? r[3].call(this, l.replace(r[1], r[2])) : void 0 : r.length > 4 && (this[r[0]] = l ? r[3].apply(this, [l.replace(r[1], r[2])].concat(r.slice(4))) : void 0)) : this[r] = l || void 0; t += 2; } }, q = function(n, e) { for (var t in e) if (typeof e[t] === ue && e[t].length > 0) { for (var i = 0; i < e[t].length; i++) if (ct(e[t][i], n)) return t === gt ? void 0 : t; } else if (ct(e[t], n)) return t === gt ? void 0 : t; return e.hasOwnProperty("*") ? e["*"] : n; }, xt = { ME: "4.90", "NT 3.51": "3.51", "NT 4.0": "4.0", 2e3: ["5.0", "5.01"], XP: ["5.1", "5.2"], Vista: "6.0", 7: "6.1", 8: "6.2", "8.1": "6.3", 10: ["6.4", "10.0"], NT: "" }, Rt = { embedded: "Automotive", mobile: "Mobile", tablet: ["Tablet", "EInk"], smarttv: "TV", wearable: "Watch", xr: ["VR", "XR"], "?": ["Desktop", "Unknown"], "*": void 0 }, _i = { Chrome: "Google Chrome", Edge: "Microsoft Edge", "Edge WebView2": "Microsoft Edge WebView2", "Chrome WebView": "Android WebView", "Chrome Headless": "HeadlessChrome", "Huawei Browser": "HuaweiBrowser", "MIUI Browser": "Miui Browser", "Opera Mobi": "OperaMobile", Yandex: "YaBrowser" }, Ot = { browser: [ [ // Most common regardless engine /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [d, [h, re + "Chrome"]], [ /webview.+edge\/([\w\.]+)/i // Microsoft Edge ], [d, [h, Ie + " WebView"]], [ /edg(?:e|ios|a)?\/([\w\.]+)/i ], [d, [h, "Edge"]], [ // Presto based /(opera mini)\/([-\w\.]+)/i, // Opera Mini /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera ], [h, d], [ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [d, [h, ge + " Mini"]], [ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX ], [d, [h, ge + " GX"]], [ /\bopr\/([\w\.]+)/i // Opera Webkit ], [d, [h, ge]], [ // Mixed /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu ], [d, [h, "Baidu"]], [ /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon ], [d, [h, "Maxthon"]], [ /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir // Trident based /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer // Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon/LG Browser/Otter/qutebrowser/Dooble /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i, // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon /(heytap|ovi|115|surf)browser\/([\d\.]+)/i, // HeyTap/Ovi/115/Surf /(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i // Ecosia/Weibo ], [h, d], [ /quark(?:pc)?\/([-\w\.]+)/i // Quark ], [d, [h, "Quark"]], [ /\bddg\/([\w\.]+)/i // DuckDuckGo ], [d, [h, "DuckDuckGo"]], [ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser ], [d, [h, "UCBrowser"]], [ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i // WeChat ], [d, [h, "WeChat"]], [ /konqueror\/([\w\.]+)/i // Konqueror ], [d, [h, "Konqueror"]], [ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 ], [d, [h, "IE"]], [ /ya(?:search)?browser\/([\w\.]+)/i // Yandex ], [d, [h, "Yandex"]], [ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser ], [d, [h, "Smart " + Ke + me]], [ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser ], [[h, /(.+)/, "$1 Secure" + me], d], [ /\bfocus\/([\w\.]+)/i // Firefox Focus ], [d, [h, _e + " Focus"]], [ /\bopt\/([\w\.]+)/i // Opera Touch ], [d, [h, ge + " Touch"]], [ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser ], [d, [h, "Coc Coc"]], [ /dolfin\/([\w\.]+)/i // Dolphin ], [d, [h, "Dolphin"]], [ /coast\/([\w\.]+)/i // Opera Coast ], [d, [h, ge + " Coast"]], [ /miuibrowser\/([\w\.]+)/i // MIUI Browser ], [d, [h, "MIUI" + me]], [ /fxios\/([\w\.-]+)/i // Firefox for iOS ], [d, [h, re + _e]], [ /\bqihoobrowser\/?([\w\.]*)/i // 360 ], [d, [h, "360"]], [ /\b(qq)\/([\w\.]+)/i // QQ ], [[h, /(.+)/, "$1Browser"], d], [ /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i ], [[h, /(.+)/, "$1" + me], d], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser /samsungbrowser\/([\w\.]+)/i // Samsung Internet ], [d, [h, be + " Internet"]], [ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer ], [d, [h, Ct + " Explorer"]], [ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile ], [[h, Ct + " Mobile"], d], [ /(electron)\/([\w\.]+) safari/i, // Electron-based App /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345 ], [h, d], [ /(lbbrowser|rekonq)/i // LieBao Browser/Rekonq ], [h], [ /ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron /ome\/([\w\.]+).+qihu (360)[es]e/i // 360 ], [d, h], [ // WebView /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android ], [[h, tt], d, [a, fe]], [ /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp /(daum)apps[\/ ]([\w\.]+)/i, // Daum App /safari (line)\/([\w\.]+)/i, // Line App for iOS /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android /(alipay)client\/([\w\.]+)/i, // Alipay /(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter /(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i // Instagram/Snapchat/Klarna ], [h, d, [a, fe]], [ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS ], [d, [h, "GSA"], [a, fe]], [ /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok ], [d, [h, "TikTok"], [a, fe]], [ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android ], [h, [a, fe]], [ /(chromium)[\/ ]([-\w\.]+)/i // Chromium ], [h, d], [ /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless ], [d, [h, Et + " Headless"]], [ /wv\).+chrome\/([\w\.]+).+edgw\//i // Edge WebView2 ], [d, [h, Ie + " WebView2"]], [ / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[h, Et + " WebView"], d], [ /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser ], [d, [h, "Android" + me]], [ /chrome\/([\w\.]+) mobile/i // Chrome Mobile ], [d, [h, re + "Chrome"]], [ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [h, d], [ /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile ], [d, [h, re + "Safari"]], [ /iphone .*mobile(?:\/\w+ | ?)safari/i ], [[h, re + "Safari"]], [ /version\/([\w\.\,]+) .*(safari)/i // Safari ], [d, h], [ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [h, [d, "1"]], [ /(webkit|khtml)\/([\w\.]+)/i ], [h, d], [ // Gecko based /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile ], [[h, re + _e], d], [ /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape ], [[h, "Netscape"], d], [ /(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf ], [h, d], [ /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality ], [d, [h, _e + " Reality"]], [ /ekiohf.+(flow)\/([\w\.]+)/i, // Flow /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(firefox)\/([\w\.]+)/i, // Other Firefox-based /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla // Other /(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser/Ladybird /\b(links) \(([\w\.]+)/i // Links ], [h, [d, /_/g, "."]], [ /(cobalt)\/([\w\.]+)/i // Cobalt ], [h, [d, /[^\d\.]+./, le]] ], cpu: [ [ /\b((amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64) ], [[U, "amd64"]], [ /(ia32(?=;))/i, // IA32 (quicktime) /\b((i[346]|x)86)(pc)?\b/i // IA32 (x86) ], [[U, "ia32"]], [ /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i // ARM64 ], [[U, "arm64"]], [ /\b(arm(v[67])?ht?n?[fl]p?)\b/i // ARMHF ], [[U, "armhf"]], [ // PocketPC mistakenly identified as PowerPC /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i ], [[U, "arm"]], [ /((ppc|powerpc)(64)?)( mac|;|\))/i // PowerPC ], [[U, /ower/, le, $]], [ / sun4\w[;\)]/i // SPARC ], [[U, "sparc"]], [ /\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC ], [[U, $]] ], device: [ [ ////////////////////////// // MOBILES & TABLETS ///////////////////////// // Samsung /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i ], [c, [u, be], [a, v]], [ /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, /samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i, /sec-(sgh\w+)/i ], [c, [u, be], [a, _]], [ // Apple /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone ], [c, [u, se], [a, _]], [ /\((ipad);[-\w\),; ]+apple/i, // iPad /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i ], [c, [u, se], [a, v]], [ /(macintosh);/i ], [c, [u, se]], [ // Sharp /\b(sh-?[altvz]?\d\d[a-ekm]?)/i ], [c, [u, kt], [a, _]], [ // Honor /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i ], [c, [u, yt], [a, v]], [ /honor([-\w ]+)[;\)]/i ], [c, [u, yt], [a, _]], [ // Huawei /\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i ], [c, [u, vt], [a, v]], [ /(?:huawei)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i ], [c, [u, vt], [a, _]], [ // Xiaomi /oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i, /\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i // Mi Pad tablets ], [[c, /_/g, " "], [u, Qe], [a, v]], [ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO /\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i, // Xiaomi Mi / ([\w ]+) miui\/v?\d/i ], [[c, /_/g, " "], [u, Qe], [a, _]], [ // OnePlus /droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i ], [c, [u, St], [a, _]], [ // OPPO /; (\w+) bui.+ oppo/i, /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i ], [c, [u, Ze], [a, _]], [ /\b(opd2(\d{3}a?))(?: bui|\))/i ], [c, [u, q, { OnePlus: ["203", "304", "403", "404", "413", "415"], "*": Ze }], [a, v]], [ // BLU /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i // Vivo series ], [c, [u, "BLU"], [a, _]], [ // Vivo /; vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i ], [c, [u, "Vivo"], [a, _]], [ // Realme /\b(rmx[1-3]\d{3})(?: bui|;|\))/i ], [c, [u, "Realme"], [a, _]], [ // Lenovo /(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i, /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i ], [c, [u, Ke], [a, v]], [ /lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i ], [c, [u, Ke], [a, _]], [ // Motorola /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, /\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i, /((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i ], [c, [u, Xe], [a, _]], [ /\b(mz60\d|xoom[2 ]{0,2}) build\//i ], [c, [u, Xe], [a, v]], [ // LG /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i ], [c, [u, Oe], [a, v]], [ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i, /\blg-?([\d\w]+) bui/i ], [c, [u, Oe], [a, _]], [ // Nokia /(nokia) (t[12][01])/i ], [u, c, [a, v]], [ /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i, /nokia[-_ ]?(([-\w\. ]*))/i ], [[c, /_/g, " "], [a, _], [u, "Nokia"]], [ // Google /(pixel (c|tablet))\b/i // Google Pixel C/Tablet ], [c, [u, te], [a, v]], [ // Google Pixel /droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i ], [c, [u, te], [a, _]], [ /(google) (pixelbook( go)?)/i ], [u, c], [ // Sony /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i ], [c, [u, pe], [a, _]], [ /sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i ], [[c, "Xperia Tablet"], [u, pe], [a, v]], [ // Amazon /(alexa)webm/i, /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, // Kindle Fire without Silk / Echo Show /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD ], [c, [u, Re], [a, v]], [ /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone ], [[c, /(.+)/g, "Fire Phone $1"], [u, Re], [a, _]], [ // BlackBerry /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook ], [c, u, [a, v]], [ /\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i // BlackBerry 10 ], [c, [u, wt], [a, _]], [ // Asus /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i ], [c, [u, mt], [a, v]], [ / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i ], [c, [u, mt], [a, _]], [ // HTC /(nexus 9)/i // HTC Nexus 9 ], [c, [u, "HTC"], [a, v]], [ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC // ZTE /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony ], [u, [c, /_/g, " "], [a, _]], [ // TCL /tcl (xess p17aa)/i, /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i ], [c, [u, "TCL"], [a, v]], [ /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i ], [c, [u, "TCL"], [a, _]], [ // itel /(itel) ((\w+))/i ], [[u, $], c, [a, q, { tablet: ["p10001l", "w7001"], "*": "mobile" }]], [ // Acer /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i ], [c, [u, "Acer"], [a, v]], [ // Meizu /droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i ], [c, [u, "Meizu"], [a, _]], [ // Ulefone /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i ], [c, [u, "Ulefone"], [a, _]], [ // Energizer /; (energy ?\w+)(?: bui|\))/i, /; energizer ([\w ]+)(?: bui|\))/i ], [c, [u, "Energizer"], [a, _]], [ // Cat /; cat (b35);/i, /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i ], [c, [u, "Cat"], [a, _]], [ // Smartfren /((?:new )?andromax[\w- ]+)(?: bui|\))/i ], [c, [u, "Smartfren"], [a, _]], [ // Nothing /droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i ], [c, [u, "Nothing"], [a, _]], [ // Archos /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i, /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i ], [c, [u, "Archos"], [a, v]], [ /archos ([\w ]+)( b|\))/i, /; (ac[3-6]\d\w{2,8})( b|\))/i ], [c, [u, "Archos"], [a, _]], [ // HMD /; (n159v)/i ], [c, [u, "HMD"], [a, _]], [ // MIXED /(imo) (tab \w+)/i, // IMO /(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i // Infinix XPad / Tecno ], [u, c, [a, v]], [ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i, // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Tecno/Micromax/Advan /; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i, // BLU/HMD/IMO/Infinix/Lava/OnePlus/TCL /(hp) ([\w ]+\w)/i, // HP iPAQ /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia /(oppo) ?([\w ]+) bui/i // OPPO ], [u, c, [a, _]], [ /(kobo)\s(ereader|touch)/i, // Kobo /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad /(kindle)\/([\w\.]+)/i // Kindle ], [u, c, [a, v]], [ /(surface duo)/i // Surface Duo ], [c, [u, Je], [a, v]], [ /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone ], [c, [u, "Fairphone"], [a, _]], [ /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i // Nvidia Tablets ], [c, [u, Ye], [a, v]], [ /(sprint) (\w+)/i // Sprint Phones ], [u, c, [a, _]], [ /(kin\.[onetw]{3})/i // Microsoft Kin ], [[c, /\./g, " "], [u, Je], [a, _]], [ /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra ], [c, [u, et], [a, v]], [ /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i ], [c, [u, et], [a, _]], [ /////////////////// // SMARTTVS /////////////////// /smart-tv.+(samsung)/i // Samsung ], [u, [a, C]], [ /hbbtv.+maple;(\d+)/i ], [[c, /^/, "SmartTV"], [u, be], [a, C]], [ /(vizio)(?: |.+model\/)(\w+-\w+)/i, // Vizio /tcast.+(lg)e?. ([-\w]+)/i // LG SmartTV ], [u, c, [a, C]], [ /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i ], [[u, Oe], [a, C]], [ /(apple) ?tv/i // Apple TV ], [u, [c, se + " TV"], [a, C]], [ /crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation ], [[c, X + " Third Generation"], [u, te], [a, C]], [ /crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type ], [[c, /^/, "Chromecast "], [u, te], [a, C]], [ /fuchsia.*crkey/i // Google Chromecast Nest Hub ], [[c, X + " Nest Hub"], [u, te], [a, C]], [ /crkey/i // Google Chromecast, Linux-based or unknown ], [[c, X], [u, te], [a, C]], [ /(portaltv)/i // Facebook Portal TV ], [c, [u, tt], [a, C]], [ /droid.+aft(\w+)( bui|\))/i // Fire TV ], [c, [u, Re], [a, C]], [ /(shield \w+ tv)/i // Nvidia Shield TV ], [c, [u, Ye], [a, C]], [ /\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp ], [c, [u, kt], [a, C]], [ /(bravia[\w ]+)( bui|\))/i // Sony ], [c, [u, pe], [a, C]], [ /(mi(tv|box)-?\w+) bui/i // Xiaomi ], [c, [u, Qe], [a, C]], [ /Hbbtv.*(technisat) (.*);/i // TechniSAT ], [u, c, [a, C]], [ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices ], [[u, /.+\/(\w+)/, "$1", q, { LG: "lge" }], [c, je], [a, C]], [ // SmartTV from Unidentified Vendors /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i ], [c, [a, C]], [ /\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i ], [[a, C]], [ /////////////////// // CONSOLES /////////////////// /(playstation \w+)/i // Playstation ], [c, [u, pe], [a, ve]], [ /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox ], [c, [u, Je], [a, ve]], [ /(ouya)/i, // Ouya /(nintendo) (\w+)/i, // Nintendo /(retroid) (pocket ([^\)]+))/i // Retroid Pocket ], [u, c, [a, ve]], [ /droid.+; (shield)( bui|\))/i // Nvidia Portable ], [c, [u, Ye], [a, ve]], [ /////////////////// // WEARABLES /////////////////// /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i // Samsung Galaxy Watch ], [c, [u, be], [a, F]], [ /((pebble))app/i, // Pebble /(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i // Asus ZenWatch / LG Watch / Pixel Watch ], [u, c, [a, F]], [ /(ow(?:19|20)?we?[1-3]{1,3})/i // Oppo Watch ], [c, [u, Ze], [a, F]], [ /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch ], [c, [u, se], [a, F]], [ /(opwwe\d{3})/i // OnePlus Watch ], [c, [u, St], [a, F]], [ /(moto 360)/i // Motorola 360 ], [c, [u, Xe], [a, F]], [ /(smartwatch 3)/i // Sony SmartWatch ], [c, [u, pe], [a, F]], [ /(g watch r)/i // LG G Watch R ], [c, [u, Oe], [a, F]], [ /droid.+; (wt63?0{2,3})\)/i ], [c, [u, et], [a, F]], [ /////////////////// // XR /////////////////// /droid.+; (glass) \d/i // Google Glass ], [c, [u, te], [a, xe]], [ /(pico) (4|neo3(?: link|pro)?)/i // Pico ], [u, c, [a, xe]], [ /(quest( \d| pro)?s?).+vr/i // Meta Quest ], [c, [u, tt], [a, xe]], [ /mobile vr; rv.+firefox/i // Unidentifiable VR device using Firefox Reality / Wolvic ], [[a, xe]], [ /////////////////// // EMBEDDED /////////////////// /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla ], [u, [a, ye]], [ /(aeobc)\b/i // Echo Dot ], [c, [u, Re], [a, ye]], [ /(homepod).+mac os/i // Apple HomePod ], [c, [u, se], [a, ye]], [ /windows iot/i // Unidentifiable embedded device using Windows IoT ], [[a, ye]], [ //////////////////// // MIXED (GENERIC) /////////////////// /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i ], [c, [a, q, { mobile: "Mobile", xr: "VR", "*": v }]], [ /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet ], [[a, v]], [ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile ], [[a, _]], [ /droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device ], [c, [u, "Generic"]] ], engine: [ [ /windows.+ edge\/([\w\.]+)/i // EdgeHTML ], [d, [h, Ie + "HTML"]], [ /(arkweb)\/([\w\.]+)/i // ArkWeb ], [h, d], [ /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink ], [d, [h, "Blink"]], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo /ekioh(flow)\/([\w\.]+)/i, // Flow /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab /\b(libweb)/i // LibWeb ], [h, d], [ /ladybird\//i ], [[h, "LibWeb"]], [ /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko ], [d, h] ], os: [ [ // Windows /(windows nt) (6\.[23]); arm/i // Windows RT ], [[h, /N/, "R"], [d, q, xt]], [ /(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i, // Windows IoT/Mobile/Phone // Windows NT/3.1/95/98/ME/2000/XP/Vista/7/8/8.1/10/11 /(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i ], [h, d], [ /windows nt ?([\d\.\)]*)(?!.+xbox)/i, /\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i ], [[d, /(;|\))/g, "", q, xt], [h, at]], [ /(windows ce)\/?([\d\.]*)/i // Windows CE ], [h, d], [ // iOS/macOS /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, /cfnetwork\/.+darwin/i ], [[d, /_/g, "."], [h, "iOS"]], [ /(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i // Mac OS ], [[h, "macOS"], [d, /_/g, "."]], [ // Google Chromecast /android ([\d\.]+).*crkey/i // Google Chromecast, Android-based ], [d, [h, X + " Android"]], [ /fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based ], [d, [h, X + " Fuchsia"]], [ /crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker ], [d, [h, X + " SmartSpeaker"]], [ /linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based ], [d, [h, X + " Linux"]], [ /crkey\/([\d\.]+)/i // Google Chromecast, unknown ], [d, [h, X]], [ // Mobile OSes /droid ([\w\.]+)\b.+(android[- ]x86)/i // Android-x86 ], [d, h], [ /(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch ], [[h, /(.+)/, "$1 Touch"], d], [ /(harmonyos)[\/ ]?([\d\.]*)/i, // HarmonyOS // Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen /(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i ], [h, d], [ /\(bb(10);/i // BlackBerry 10 ], [d, [h, wt]], [ /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian ], [d, [h, "Symbian"]], [ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS ], [d, [h, _e + " OS"]], [ /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i, // WebOS /webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i ], [d, [h, "webOS"]], [ /web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i // https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine ], [[d, q, { 25: "120", 24: "108", 23: "94", 22: "87", 6: "79", 5: "68", 4: "53", 3: "38", 2: "538", 1: "537", "*": "TV" }], [h, "webOS"]], [ /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS ], [d, [h, "watchOS"]], [ // Google ChromeOS /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS ], [[h, "Chrome OS"], d], [ // Smart TVs /panasonic;(viera)/i, // Panasonic Viera /(netrange)mmh/i, // Netrange /(nettv)\/(\d+\.[\w\.]+)/i, // NetTV // Console /(nintendo|playstation) (\w+)/i, // Nintendo/Playstation /(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S) /(pico) .+os([\w\.]+)/i, // Pico // Other /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm /linux.+(mint)[\/\(\) ]?([\w\.]*)/i, // Mint /(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i, // Mageia/VectorLinux/Fuchsia/ArcaOS/Arch /([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, // Ubuntu/Debian/SUSE/Gentoo/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire/Knoppix /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris /\b(aix)[; ]([1-9\.]{0,4})/i, // AIX /(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i, // Hurd/Linux/MorphOS /(gnu) ?([\w\.]*)/i, // GNU /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly /(haiku) ?(r\d)?/i // Haiku ], [h, d], [ /(sunos) ?([\d\.]*)/i // Solaris ], [[h, "Solaris"], d], [ /\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/OpenVMS/HP-UX/SerenityOS /(unix) ?([\w\.]*)/i // UNIX ], [h, d] ] }, Pe = function() { var n = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} }; return G.call(n.init, [ [D, [h, d, Ee, a]], [V, [U]], [B, [a, c, u]], [N, [h, d]], [W, [h, d]] ]), G.call(n.isIgnore, [ [D, [d, Ee]], [N, [d]], [W, [d]] ]), G.call(n.isIgnoreRgx, [ [D, / ?browser$/i], [W, / ?os$/i] ]), G.call(n.toString, [ [D, [h, d]], [V, [U]], [B, [u, c]], [N, [h, d]], [W, [h, d]] ]), n; }(), gi = function(n, e) { var t = Pe.init[e], i = Pe.isIgnore[e] || 0, s = Pe.isIgnoreRgx[e] || 0, o = Pe.toString[e] || 0; function r() { G.call(this, t); } return r.prototype.getItem = function() { return n; }, r.prototype.withClientHints = function() { return Y ? Y.getHighEntropyValues(Mt).then(function(f) { return n.setCH(new zt(f, !1)).parseCH().get(); }) : n.parseCH().get(); }, r.prototype.withFeatureCheck = function() { return n.detectFeature().get(); }, e != oe && (r.prototype.is = function(f) { var l = !1; for (var p in this) if (this.hasOwnProperty(p) && !ct(i, p) && $(s ? he(s, this[p]) : this[p]) == $(s ? he(s, f) : f)) { if (l = !0, f != Q) break; } else if (f == Q && l) { l = !l; break; } return l; }, r.prototype.toString = function() { var f = le; for (var l in o) typeof this[o[l]] !== Q && (f += (f ? " " : le) + this[o[l]]); return f || Q; }), Y || (r.prototype.then = function(f) { var l = this, p = function() { for (var S in l) l.hasOwnProperty(S) && (this[S] = l[S]); }; p.prototype = { is: r.prototype.is, toString: r.prototype.toString }; var g = new p(); return f(g), g; }), new r(); }; function zt(n, e) { if (n = n || {}, G.call(this, Mt), e) G.call(this, [ [ht, it(n[ee])], [dt, it(n[ai])], [_, /\?1/.test(n[hi])], [c, we(n[di])], [ae, we(n[jt])], [ft, we(n[fi])], [U, we(n[ci])], [ne, it(n[ui])], [Fe, we(n[li])] ]); else for (var t in n) this.hasOwnProperty(t) && typeof n[t] !== Q && (this[t] = n[t]); } function Pt(n, e, t, i) { return this.get = function(s) { return s ? this.data.hasOwnProperty(s) ? this.data[s] : void 0 : this.data; }, this.set = function(s, o) { return this.data[s] = o, this; }, this.setCH = function(s) { return this.uaCH = s, this; }, this.detectFeature = function() { if (j && j.userAgent == this.ua) switch (this.itemType) { case D: j.brave && typeof j.brave.isBrave == De && this.set(h, "Brave"); break; case B: !this.get(a) && Y && Y[_] && this.set(a, _), this.get(c) == "Macintosh" && j && typeof j.standalone !== Q && j.maxTouchPoints && j.maxTouchPoints > 2 && this.set(c, "iPad").set(a, v); break; case W: !this.get(h) && Y && Y[ae] && this.set(h, Y[ae]); break; case oe: var s = this.data, o = function(r) { return s[r].getItem().detectFeature().get(); }; this.set(D, o(D)).set(V, o(V)).set(B, o(B)).set(N, o(N)).set(W, o(W)); } return this; }, this.parseUA = function() { return this.itemType != oe && st.call(this.data, this.ua, this.rgxMap), this.itemType == D && this.set(Ee, nt(this.get(d))), this; }, this.parseCH = function() { var s = this.uaCH, o = this.rgxMap; switch (this.itemType) { case D: case N: var r = s[dt] || s[ht], f; if (r) for (var l in r) { var p = r[l].brand || r[l], g = r[l].version; this.itemType == D && !/not.a.brand/i.test(p) && (!f || /Chrom/.test(f) && p != Tt || f == Ie && /WebView2/.test(p)) && (p = q(p, _i), f = this.get(h), f && !/Chrom/.test(f) && /Chrom/.test(p) || this.set(h, p).set(d, g).set(Ee, nt(g)), f = p), this.itemType == N && p == Tt && this.set(d, g); } break; case V: var S = s[U]; S && (S && s[Fe] == "64" && (S += "64"), st.call(this.data, S + ";", o)); break; case B: if (s[_] && this.set(a, _), s[c] && (this.set(c, s[c]), !this.get(a) || !this.get(u))) { var R = {}; st.call(R, "droid 9; " + s[c] + ")", o), !this.get(a) && R.type && this.set(a, R.type), !this.get(u) && R.vendor && this.set(u, R.vendor); } if (s[ne]) { var w; if (typeof s[ne] != "string") for (var O = 0; !w && O < s[ne].length; ) w = q(s[ne][O++], Rt); else w = q(s[ne], Rt); this.set(a, w); } break; case W: var E = s[ae]; if (E) { var k = s[ft]; E == at && (k = parseInt(nt(k), 10) >= 13 ? "11" : "10"), this.set(h, E).set(d, k); } this.get(h) == at && s[c] == "Xbox" && this.set(h, "Xbox").set(d, void 0); break; case oe: var z = this.data, J = function(m) { return z[m].getItem().setCH(s).parseCH().get(); }; this.set(D, J(D)).set(V, J(V)).set(B, J(B)).set(N, J(N)).set(W, J(W)); } return this; }, G.call(this, [ ["itemType", n], ["ua", e], ["uaCH", i], ["rgxMap", t], ["data", gi(this, n)] ]), this; } function H(n, e, t) { if (typeof n === ue ? (Ue(n, !0) ? (typeof e === ue && (t = e), e = n) : (t = n, e = void 0), n = void 0) : typeof n === ot && !Ue(e, !0) && (t = e, e = void 0), t && typeof t.append === De) { var i = {}; t.forEach(function(l, p) { i[p] = l; }), t = i; } if (!(this instanceof H)) return new H(n, e, t).getResult(); var s = typeof n === ot ? n : ( // Passed user-agent string t && t[_t] ? t[_t] : ( // User-Agent from passed headers j && j.userAgent ? j.userAgent : ( // navigator.userAgent le ) ) ), o = new zt(t, !0), r = e ? pi(Ot, e) : Ot, f = function(l) { return l == oe ? function() { return new Pt(l, s, r, o).set("ua", s).set(D, this.getBrowser()).set(V, this.getCPU()).set(B, this.getDevice()).set(N, this.getEngine()).set(W, this.getOS()).get(); } : function() { return new Pt(l, s, r[l], o).parseUA().get(); }; }; return G.call(this, [ ["getBrowser", f(D)], ["getCPU", f(V)], ["getDevice", f(B)], ["getEngine", f(N)], ["getOS", f(W)], ["getResult", f(oe)], ["getUA", function() { return s; }], ["setUA", function(l) { return de(l) && (s = l.length > rt ? je(l, rt) : l), this; }] ]).setUA(s), this; } H.VERSION = oi; H.BROWSER = qe([h, d, Ee, a]); H.CPU = qe([U]); H.DEVICE = qe([c, u, a, ve, _, C, v, F, ye]); H.ENGINE = H.OS = qe([h, d]); var Ae = /* @__PURE__ */ ((n) => (n.PHONE = "phone", n.TABLET = "tablet", n.DESKTOP = "desktop", n))(Ae || {}), ie = /* @__PURE__ */ ((n) => (n.ANDROID = "android", n.IOS = "ios", n.MAC = "mac", n.WIN = "win", n.LINUX = "linux", n.UNKNOWN = "unknown", n))(ie || {}); function Wt(n) { const e = n.toLowerCase(); return { detectOS() { return /android/.test(e) ? ie.ANDROID : /iphone|ipad|ipod/.test(e) ? ie.IOS : /macintosh|mac os x/.test(e) ? ie.MAC : /windows/.test(e) ? ie.WIN : /linux/.test(e) ? ie.LINUX : ie.UNKNOWN; }, detectDeviceType() { const t = /iphone|ipod|android.*mobile|windows phone|blackberry|webos/.test( e ), i = /ipad|android(?!.*mobile)|tablet/.test(e); return t ? Ae.PHONE : i ? Ae.TABLET : Ae.DESKTOP; }, detectDeviceName() { const i = new H().getResult(); return i.device && i.device.model ? `${i.device.vendor} ${i.device.model}` : i.os && i.os.name ? `${i.os.name} ${i.os.version}` : "Unknown Device"; }, getTimezone() { const i = (/* @__PURE__ */ new Date()).toString().match(/GMT[+-]\d{4}/); return i ? i[0] : ""; }, getBrowserName() { return new H(n).getBrowser().name || ""; }, getBrowserVersion() { return new H(n).getBrowser().version || ""; }, async getFingerPrint() { try { return await (await import("./thumbmark.esm-C63R1HKv.js")).getFingerprint(); } catch (t) { return console.error("device fingerprint ERROR", t), ""; } }, async getExtendedFingerprint(t) { try { const i = await import("./thumbmark.esm-C63R1HKv.js"); let s = { web_hwid: await i.getFingerprint(!0), "web_hwid-rm__applepay--rm__browser-useragent": "", "web_hwid-rm__applepay--rm__browser-useragent__add-ip": "" }; return i.setOption("exclude", [ "applePayVersion", "system.browser.version", "system.browser.name", "system.useragent" ]), s["web_hwid-rm__applepay--rm__browser-useragent"] = await i.getFingerprint(), i.includeComponent("tcp", () => Promise.resolve({ ip: t })), s["web_hwid-rm__applepay--rm__browser-useragent__add-ip"] = await i.getFingerprint(),