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.

599 lines (598 loc) 27.4 kB
function w(r, u, t, n) { return new (t || (t = Promise))(function(i, a) { function e(c) { try { d(n.next(c)); } catch (o) { a(o); } } function s(c) { try { d(n.throw(c)); } catch (o) { a(o); } } function d(c) { var o; c.done ? i(c.value) : (o = c.value, o instanceof t ? o : new t(function(m) { m(o); })).then(e, s); } d((n = n.apply(r, [])).next()); }); } function y(r, u) { var t, n, i, a, e = { label: 0, sent: function() { if (1 & i[0]) throw i[1]; return i[1]; }, trys: [], ops: [] }; return a = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function s(d) { return function(c) { return function(o) { if (t) throw new TypeError("Generator is already executing."); for (; a && (a = 0, o[0] && (e = 0)), e; ) try { if (t = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i; switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) { case 0: case 1: i = o; break; case 4: return e.label++, { value: o[1], done: !1 }; case 5: e.label++, n = o[1], o = [0]; continue; case 7: o = e.ops.pop(), e.trys.pop(); continue; default: if (i = e.trys, !((i = i.length > 0 && i[i.length - 1]) || o[0] !== 6 && o[0] !== 2)) { e = 0; continue; } if (o[0] === 3 && (!i || o[1] > i[0] && o[1] < i[3])) { e.label = o[1]; break; } if (o[0] === 6 && e.label < i[1]) { e.label = i[1], i = o; break; } if (i && e.label < i[2]) { e.label = i[2], e.ops.push(o); break; } i[2] && e.ops.pop(), e.trys.pop(); continue; } o = u.call(r, e); } catch (m) { o = [6, m], n = 0; } finally { t = i = 0; } if (5 & o[0]) throw o[1]; return { value: o[0] ? o[1] : void 0, done: !0 }; }([d, c]); }; } } var f = { exclude: [], include: [], logging: !0, timeout: 1e3 }; function Q(r, u) { if (!["include", "exclude", "permissions_to_check", "retries", "timeout", "logging"].includes(r)) throw new Error("Unknown option " + r); if (["include", "exclude", "permissions_to_check"].includes(r) && (!Array.isArray(u) || !u.every(function(t) { return typeof t == "string"; }))) throw new Error("The value of the include, exclude and permissions_to_check must be an array of strings"); if (["retries", "timeout"].includes(r) && typeof u != "number") throw new Error("The value of retries must be a number"); f[r] = u; } var I = {}, R = { timeout: "true" }, p = function(r, u) { typeof window < "u" && (I[r] = u); }, O = function() { return Object.fromEntries(Object.entries(I).filter(function(r) { var u, t = r[0]; return !(!((u = f?.exclude) === null || u === void 0) && u.includes(t)); }).filter(function(r) { var u, t, n, i, a = r[0]; return !((u = f?.include) === null || u === void 0) && u.some(function(e) { return e.includes("."); }) ? (t = f?.include) === null || t === void 0 ? void 0 : t.some(function(e) { return e.startsWith(a); }) : ((n = f?.include) === null || n === void 0 ? void 0 : n.length) === 0 || ((i = f?.include) === null || i === void 0 ? void 0 : i.includes(a)); }).map(function(r) { return [r[0], (0, r[1])()]; })); }; function A(r) { return r ^= r >>> 16, r = Math.imul(r, 2246822507), r ^= r >>> 13, r = Math.imul(r, 3266489909), (r ^= r >>> 16) >>> 0; } var h = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]); function g(r, u) { return r << u | r >>> 32 - u; } function T(r, u) { var t; if (u === void 0 && (u = 0), u = u ? 0 | u : 0, typeof r == "string" && (t = r, r = new TextEncoder().encode(t).buffer), !(r instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string"); var n = new Uint32Array([u, u, u, u]); (function(a, e) { for (var s = a.byteLength / 16 | 0, d = new Uint32Array(a, 0, 4 * s), c = 0; c < s; c++) { var o = d.subarray(4 * c, 4 * (c + 1)); o[0] = Math.imul(o[0], h[0]), o[0] = g(o[0], 15), o[0] = Math.imul(o[0], h[1]), e[0] = e[0] ^ o[0], e[0] = g(e[0], 19), e[0] = e[0] + e[1], e[0] = Math.imul(e[0], 5) + 1444728091, o[1] = Math.imul(o[1], h[1]), o[1] = g(o[1], 16), o[1] = Math.imul(o[1], h[2]), e[1] = e[1] ^ o[1], e[1] = g(e[1], 17), e[1] = e[1] + e[2], e[1] = Math.imul(e[1], 5) + 197830471, o[2] = Math.imul(o[2], h[2]), o[2] = g(o[2], 17), o[2] = Math.imul(o[2], h[3]), e[2] = e[2] ^ o[2], e[2] = g(e[2], 15), e[2] = e[2] + e[3], e[2] = Math.imul(e[2], 5) + 2530024501, o[3] = Math.imul(o[3], h[3]), o[3] = g(o[3], 18), o[3] = Math.imul(o[3], h[0]), e[3] = e[3] ^ o[3], e[3] = g(e[3], 13), e[3] = e[3] + e[0], e[3] = Math.imul(e[3], 5) + 850148119; } })(r, n), function(a, e) { var s = a.byteLength / 16 | 0, d = a.byteLength % 16, c = new Uint32Array(4), o = new Uint8Array(a, 16 * s, d); switch (d) { case 15: c[3] = c[3] ^ o[14] << 16; case 14: c[3] = c[3] ^ o[13] << 8; case 13: c[3] = c[3] ^ o[12], c[3] = Math.imul(c[3], h[3]), c[3] = g(c[3], 18), c[3] = Math.imul(c[3], h[0]), e[3] = e[3] ^ c[3]; case 12: c[2] = c[2] ^ o[11] << 24; case 11: c[2] = c[2] ^ o[10] << 16; case 10: c[2] = c[2] ^ o[9] << 8; case 9: c[2] = c[2] ^ o[8], c[2] = Math.imul(c[2], h[2]), c[2] = g(c[2], 17), c[2] = Math.imul(c[2], h[3]), e[2] = e[2] ^ c[2]; case 8: c[1] = c[1] ^ o[7] << 24; case 7: c[1] = c[1] ^ o[6] << 16; case 6: c[1] = c[1] ^ o[5] << 8; case 5: c[1] = c[1] ^ o[4], c[1] = Math.imul(c[1], h[1]), c[1] = g(c[1], 16), c[1] = Math.imul(c[1], h[2]), e[1] = e[1] ^ c[1]; case 4: c[0] = c[0] ^ o[3] << 24; case 3: c[0] = c[0] ^ o[2] << 16; case 2: c[0] = c[0] ^ o[1] << 8; case 1: c[0] = c[0] ^ o[0], c[0] = Math.imul(c[0], h[0]), c[0] = g(c[0], 15), c[0] = Math.imul(c[0], h[1]), e[0] = e[0] ^ c[0]; } }(r, n), function(a, e) { e[0] = e[0] ^ a.byteLength, e[1] = e[1] ^ a.byteLength, e[2] = e[2] ^ a.byteLength, e[3] = e[3] ^ a.byteLength, e[0] = e[0] + e[1] | 0, e[0] = e[0] + e[2] | 0, e[0] = e[0] + e[3] | 0, e[1] = e[1] + e[0] | 0, e[2] = e[2] + e[0] | 0, e[3] = e[3] + e[0] | 0, e[0] = A(e[0]), e[1] = A(e[1]), e[2] = A(e[2]), e[3] = A(e[3]), e[0] = e[0] + e[1] | 0, e[0] = e[0] + e[2] | 0, e[0] = e[0] + e[3] | 0, e[1] = e[1] + e[0] | 0, e[2] = e[2] + e[0] | 0, e[3] = e[3] + e[0] | 0; }(r, n); var i = new Uint8Array(n.buffer); return Array.from(i).map(function(a) { return a.toString(16).padStart(2, "0"); }).join(""); } function _(r, u) { return new Promise(function(t) { setTimeout(function() { return t(u); }, r); }); } function D(r, u, t) { return Promise.all(r.map(function(n) { var i = performance.now(); return Promise.race([n.then(function(a) { return { value: a, elapsed: performance.now() - i }; }), _(u, t).then(function(a) { return { value: a, elapsed: performance.now() - i }; })]); })); } function F(r, u, t) { return Promise.all(r.map(function(n) { return Promise.race([n, _(u, t)]); })); } function X() { return "0.20.2"; } function U() { return w(this, void 0, void 0, function() { var r, u, t, n, i; return y(this, function(a) { switch (a.label) { case 0: return a.trys.push([0, 2, , 3]), r = O(), u = Object.keys(r), [4, F(Object.values(r), f?.timeout || 1e3, R)]; case 1: return t = a.sent(), n = t.filter(function(e) { return e !== void 0; }), i = {}, n.forEach(function(e, s) { i[u[s]] = e; }), [2, L(i, f.exclude || [], f.include || [], "")]; case 2: throw a.sent(); case 3: return [2]; } }); }); } function L(r, u, t, n) { n === void 0 && (n = ""); for (var i = {}, a = function(c, o) { var m = n + c + "."; if (typeof o != "object" || Array.isArray(o)) { var C = u.some(function(P) { return m.startsWith(P); }), E = t.some(function(P) { return m.startsWith(P); }); C && !E || (i[c] = o); } else { var M = L(o, u, t, m); Object.keys(M).length > 0 && (i[c] = M); } }, e = 0, s = Object.entries(r); e < s.length; e++) { var d = s[e]; a(d[0], d[1]); } return i; } function $(r) { return w(this, void 0, void 0, function() { var u, t; return y(this, function(n) { switch (n.label) { case 0: return n.trys.push([0, 2, , 3]), [4, U()]; case 1: return u = n.sent(), t = T(JSON.stringify(u)), Math.random() < 1e-4 && f.logging && function(i, a) { w(this, void 0, void 0, function() { var e, s; return y(this, function(d) { switch (d.label) { case 0: if (e = "https://logging.thumbmarkjs.com/v1/log", s = { thumbmark: i, components: a, version: "0.20.2" }, sessionStorage.getItem("_tmjs_l")) return [3, 4]; sessionStorage.setItem("_tmjs_l", "1"), d.label = 1; case 1: return d.trys.push([1, 3, , 4]), [4, fetch(e, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(s) })]; case 2: case 3: return d.sent(), [3, 4]; case 4: return [2]; } }); }); }(t, u), r ? [2, { hash: t.toString(), data: u }] : [2, t.toString()]; case 2: throw n.sent(); case 3: return [2]; } }); }); } function ee() { return w(this, void 0, void 0, function() { var r, u, t, n; return y(this, function(i) { switch (i.label) { case 0: return i.trys.push([0, 2, , 3]), r = O(), u = Object.keys(r), [4, D(Object.values(r), f?.timeout || 1e3, R)]; case 1: return t = i.sent(), n = { elapsed: {} }, t.forEach(function(a, e) { n[u[e]] = a.value, n.elapsed[u[e]] = a.elapsed; }), [2, n]; case 2: throw i.sent(); case 3: return [2]; } }); }); } function S() { if (typeof navigator > "u") return { name: "unknown", version: "unknown" }; for (var r = navigator.userAgent, u = { edg: "Edge", opr: "Opera", samsung: "SamsungBrowser" }, t = 0, n = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>samsung).*Version\/(?<version>\d+(?:\.\d+)?)/i]; t < n.length; t++) { var i = n[t], a = r.match(i); if (a && a.groups) return { name: u[a.groups.name.toLowerCase()] || a.groups.name, version: a.groups.version }; } return { name: "unknown", version: "unknown" }; } function N(r) { for (var u = 0, t = 0; t < r.length; ++t) u += Math.abs(r[t]); return u; } var j = S(); function B(r, u, t) { for (var n = [], i = 0; i < r[0].data.length; i++) { for (var a = [], e = 0; e < r.length; e++) a.push(r[e].data[i]); n.push(G(a)); } var s = new Uint8ClampedArray(n); return new ImageData(s, u, t); } function G(r) { if (r.length === 0) return 0; for (var u = {}, t = 0, n = r; t < n.length; t++) u[a = n[t]] = (u[a] || 0) + 1; var i = r[0]; for (var a in u) u[a] > u[i] && (i = parseInt(a, 10)); return i; } ["SamsungBrowser", "Safari"].includes(j.name) || p("audio", function() { return w(this, void 0, void 0, function() { return y(this, function(r) { return [2, new Promise(function(u, t) { try { var n = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), i = n.createBufferSource(), a = n.createOscillator(); a.frequency.value = 1e3; var e, s = n.createDynamicsCompressor(); s.threshold.value = -50, s.knee.value = 40, s.ratio.value = 12, s.attack.value = 0, s.release.value = 0.2, a.connect(s), s.connect(n.destination), a.start(), n.oncomplete = function(d) { e = d.renderedBuffer.getChannelData(0), u({ sampleHash: N(e), oscillator: a.type, maxChannels: n.destination.maxChannelCount, channelCountMode: i.channelCountMode }); }, n.startRendering(); } catch (d) { console.error("Error creating audio fingerprint:", d), t(d); } })]; }); }); }); var W = S().name !== "SamsungBrowser" ? 1 : 3; S().name != "Firefox" && p("canvas", function() { return document.createElement("canvas").getContext("2d"), new Promise(function(r) { var u = Array.from({ length: W }, function() { return function() { var t = document.createElement("canvas"), n = t.getContext("2d"); if (!n) return new ImageData(1, 1); t.width = 280, t.height = 20; var i = n.createLinearGradient(0, 0, t.width, t.height); i.addColorStop(0, "red"), i.addColorStop(0.16666666666666666, "orange"), i.addColorStop(0.3333333333333333, "yellow"), i.addColorStop(0.5, "green"), i.addColorStop(0.6666666666666666, "blue"), i.addColorStop(0.8333333333333334, "indigo"), i.addColorStop(1, "violet"), n.fillStyle = i, n.fillRect(0, 0, t.width, t.height); var a = "Random Text WMwmil10Oo"; n.font = "23.123px Arial", n.fillStyle = "black", n.fillText(a, -5, 15), n.fillStyle = "rgba(0, 0, 255, 0.5)", n.fillText(a, -3.3, 17.7), n.beginPath(), n.moveTo(0, 0), n.lineTo(2 * t.width / 7, t.height), n.strokeStyle = "white", n.lineWidth = 2, n.stroke(); var e = n.getImageData(0, 0, t.width, t.height); return e; }(); }); r({ commonImageDataHash: T(B(u, 280, 20).data.toString()).toString() }); }); }); var x, V = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], H = ["monospace", "sans-serif", "serif"]; function k(r, u) { if (!r) throw new Error("Canvas context not supported"); return r.font, r.font = "72px ".concat(u), r.measureText("WwMmLli0Oo").width; } function q() { var r, u = document.createElement("canvas"), t = (r = u.getContext("webgl")) !== null && r !== void 0 ? r : u.getContext("experimental-webgl"); if (t && "getParameter" in t) try { var n = (t.getParameter(t.VENDOR) || "").toString(), i = (t.getParameter(t.RENDERER) || "").toString(), a = { vendor: n, renderer: i, version: (t.getParameter(t.VERSION) || "").toString(), shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString() }; if (!i.length || !n.length) { var e = t.getExtension("WEBGL_debug_renderer_info"); if (e) { var s = (t.getParameter(e.UNMASKED_VENDOR_WEBGL) || "").toString(), d = (t.getParameter(e.UNMASKED_RENDERER_WEBGL) || "").toString(); s && (a.vendorUnmasked = s), d && (a.rendererUnmasked = d); } } return a; } catch { } return "undefined"; } function z() { var r = new Float32Array(1), u = new Uint8Array(r.buffer); return r[0] = 1 / 0, r[0] = r[0] - r[0], u[3]; } function K(r, u) { var t = {}; return u.forEach(function(n) { var i = function(a) { if (a.length === 0) return null; var e = {}; a.forEach(function(c) { var o = String(c); e[o] = (e[o] || 0) + 1; }); var s = a[0], d = 1; return Object.keys(e).forEach(function(c) { e[c] > d && (s = c, d = e[c]); }), s; }(r.map(function(a) { return n in a ? a[n] : void 0; }).filter(function(a) { return a !== void 0; })); i && (t[n] = i); }), t; } function Y() { var r = [], u = { "prefers-contrast": ["high", "more", "low", "less", "forced", "no-preference"], "any-hover": ["hover", "none"], "any-pointer": ["none", "coarse", "fine"], pointer: ["none", "coarse", "fine"], hover: ["hover", "none"], update: ["fast", "slow"], "inverted-colors": ["inverted", "none"], "prefers-reduced-motion": ["reduce", "no-preference"], "prefers-reduced-transparency": ["reduce", "no-preference"], scripting: ["none", "initial-only", "enabled"], "forced-colors": ["active", "none"] }; return Object.keys(u).forEach(function(t) { u[t].forEach(function(n) { matchMedia("(".concat(t, ": ").concat(n, ")")).matches && r.push("".concat(t, ": ").concat(n)); }); }), r; } function J() { if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try { for (var r = window.ApplePaySession.supportsVersion, u = 15; u > 0; u--) if (r(u)) return u; } catch { return 0; } return 0; } S().name != "Firefox" && p("fonts", function() { var r = this; return new Promise(function(u, t) { try { (function(n) { var i; w(this, void 0, void 0, function() { var a, e, s; return y(this, function(d) { switch (d.label) { case 0: return document.body ? [3, 2] : [4, (c = 50, new Promise(function(m) { return setTimeout(m, c, o); }))]; case 1: return d.sent(), [3, 0]; case 2: if ((a = document.createElement("iframe")).setAttribute("frameBorder", "0"), (e = a.style).setProperty("position", "fixed"), e.setProperty("display", "block", "important"), e.setProperty("visibility", "visible"), e.setProperty("border", "0"), e.setProperty("opacity", "0"), a.src = "about:blank", document.body.appendChild(a), !(s = a.contentDocument || ((i = a.contentWindow) === null || i === void 0 ? void 0 : i.document))) throw new Error("Iframe document is not accessible"); return n({ iframe: s }), setTimeout(function() { document.body.removeChild(a); }, 0), [2]; } var c, o; }); }); })(function(n) { var i = n.iframe; return w(r, void 0, void 0, function() { var a, e, s, d; return y(this, function(c) { return a = i.createElement("canvas"), e = a.getContext("2d"), s = H.map(function(o) { return k(e, o); }), d = {}, V.forEach(function(o) { var m = k(e, o); s.includes(m) || (d[o] = m); }), u(d), [2]; }); }); }); } catch { t({ error: "unsupported" }); } }); }), p("hardware", function() { return new Promise(function(r, u) { var t = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, n = window.performance && window.performance.memory ? window.performance.memory : 0; r({ videocard: q(), architecture: z(), deviceMemory: t.toString() || "undefined", jsHeapSizeLimit: n.jsHeapSizeLimit || 0 }); }); }), p("locales", function() { return new Promise(function(r) { r({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone }); }); }), p("permissions", function() { return w(this, void 0, void 0, function() { var r; return y(this, function(u) { return x = f?.permissions_to_check || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], r = Array.from({ length: f?.retries || 3 }, function() { return function() { return w(this, void 0, void 0, function() { var t, n, i, a, e; return y(this, function(s) { switch (s.label) { case 0: t = {}, n = 0, i = x, s.label = 1; case 1: if (!(n < i.length)) return [3, 6]; a = i[n], s.label = 2; case 2: return s.trys.push([2, 4, , 5]), [4, navigator.permissions.query({ name: a })]; case 3: return e = s.sent(), t[a] = e.state.toString(), [3, 5]; case 4: return s.sent(), [3, 5]; case 5: return n++, [3, 1]; case 6: return [2, t]; } }); }); }(); }), [2, Promise.all(r).then(function(t) { return K(t, x); })]; }); }); }), p("plugins", function() { var r = []; if (navigator.plugins) for (var u = 0; u < navigator.plugins.length; u++) { var t = navigator.plugins[u]; r.push([t.name, t.filename, t.description].join("|")); } return new Promise(function(n) { n({ plugins: r }); }); }), p("screen", function() { return new Promise(function(r) { r({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: Y() }); }); }), p("system", function() { return new Promise(function(r) { var u = S(); r({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: u.name, version: u.version }, applePayVersion: J() }); }); }); var v, Z = S().name !== "SamsungBrowser" ? 1 : 3, l = null; p("webgl", function() { return w(this, void 0, void 0, function() { var r; return y(this, function(u) { typeof document < "u" && ((v = document.createElement("canvas")).width = 200, v.height = 100, l = v.getContext("webgl")); try { if (!l) throw new Error("WebGL not supported"); return r = Array.from({ length: Z }, function() { return function() { try { if (!l) throw new Error("WebGL not supported"); var t = ` attribute vec2 position; void main() { gl_Position = vec4(position, 0.0, 1.0); } `, n = ` precision mediump float; void main() { gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color } `, i = l.createShader(l.VERTEX_SHADER), a = l.createShader(l.FRAGMENT_SHADER); if (!i || !a) throw new Error("Failed to create shaders"); if (l.shaderSource(i, t), l.shaderSource(a, n), l.compileShader(i), !l.getShaderParameter(i, l.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + l.getShaderInfoLog(i)); if (l.compileShader(a), !l.getShaderParameter(a, l.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + l.getShaderInfoLog(a)); var e = l.createProgram(); if (!e) throw new Error("Failed to create shader program"); if (l.attachShader(e, i), l.attachShader(e, a), l.linkProgram(e), !l.getProgramParameter(e, l.LINK_STATUS)) throw new Error("Shader program linking failed: " + l.getProgramInfoLog(e)); l.useProgram(e); for (var s = 137, d = new Float32Array(4 * s), c = 2 * Math.PI / s, o = 0; o < s; o++) { var m = o * c; d[4 * o] = 0, d[4 * o + 1] = 0, d[4 * o + 2] = Math.cos(m) * (v.width / 2), d[4 * o + 3] = Math.sin(m) * (v.height / 2); } var C = l.createBuffer(); l.bindBuffer(l.ARRAY_BUFFER, C), l.bufferData(l.ARRAY_BUFFER, d, l.STATIC_DRAW); var E = l.getAttribLocation(e, "position"); l.enableVertexAttribArray(E), l.vertexAttribPointer(E, 2, l.FLOAT, !1, 0, 0), l.viewport(0, 0, v.width, v.height), l.clearColor(0, 0, 0, 1), l.clear(l.COLOR_BUFFER_BIT), l.drawArrays(l.LINES, 0, 2 * s); var M = new Uint8ClampedArray(v.width * v.height * 4); return l.readPixels(0, 0, v.width, v.height, l.RGBA, l.UNSIGNED_BYTE, M), new ImageData(M, v.width, v.height); } catch { return new ImageData(1, 1); } finally { l && (l.bindBuffer(l.ARRAY_BUFFER, null), l.useProgram(null), l.viewport(0, 0, l.drawingBufferWidth, l.drawingBufferHeight), l.clearColor(0, 0, 0, 0)); } }(); }), [2, { commonImageHash: T(B(r, v.width, v.height).data.toString()).toString() }]; } catch { return [2, { webgl: "unsupported" }]; } return [2]; }); }); }); var b = function(r, u, t, n) { for (var i = (t - u) / n, a = 0, e = 0; e < n; e++) a += r(u + (e + 0.5) * i); return a * i; }; p("math", function() { return w(void 0, void 0, void 0, function() { return y(this, function(r) { return [2, { acos: Math.acos(0.5), asin: b(Math.asin, -1, 1, 97), atan: b(Math.atan, -1, 1, 97), cos: b(Math.cos, 0, Math.PI, 97), cosh: Math.cosh(9 / 7), e: Math.E, largeCos: Math.cos(1e20), largeSin: Math.sin(1e20), largeTan: Math.tan(1e20), log: Math.log(1e3), pi: Math.PI, sin: b(Math.sin, -Math.PI, Math.PI, 97), sinh: b(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: b(Math.tan, 0, 2 * Math.PI, 97), tanh: b(Math.tanh, -9 / 7, 7 / 9, 97) }]; }); }); }); export { $ as getFingerprint, U as getFingerprintData, ee as getFingerprintPerformance, X as getVersion, p as includeComponent, Q as setOption }; //# sourceMappingURL=thumbmark.esm-C63R1HKv.js.map