@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
78 lines (76 loc) • 3.53 kB
JavaScript
/**
* VERSION: 2.130.0-alpha.4
* BUILD_TIMESTAMP: 1759000374473
* BUILD_DATE: Sat Sep 27 2025 19:12:54 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326
*/
const v = () => {
let m = window.hp_frame || null, d = window.tmx_frame || null, f = window.tmx_script || null;
var e = e || {};
return e.version = 3, e.create_url = function(t, r, c, o, i) {
function n() {
return Math.floor(2742745743359 * Math.random());
}
function l() {
return a(n());
}
function a(g) {
return (g + 78364164096).toString(36);
}
var u = n(), s = n(), p = 885187064159;
s = ((s = s - s % 256 + e.version) + u) % 2742745743359, p = (p + u) % 2742745743359;
var h = "https://" + t + "/" + (u = l() + a(u)) + r, _ = [(s = a(p) + a(s)) + "=" + c, l() + l() + "=" + o];
return i !== void 0 && i.length > 0 && _.push(l() + l() + "=" + i), h + "?" + _.join("&");
}, e.beacon = function(t, r, c, o) {
var i = "turn:aa.online-metrix.net?transport=", n = "1:" + r + ":" + c, l = {
iceServers: [
{ urls: i + "tcp", username: n, credential: c },
{ urls: i + "udp", username: n, credential: c }
]
};
try {
var a = new RTCPeerConnection(l);
a.createDataChannel(Math.random().toString());
var u = function() {
}, s = function(p) {
a.setLocalDescription(p, u, u);
};
typeof Promise > "u" || a.createOffer.length > 0 ? a.createOffer(s, u) : a.createOffer().then(s, u);
} catch {
}
}, e.load_tags = function(t, r, c, o) {
e.beacon(t, r, c, o);
var i = document.getElementsByTagName("head").item(0), n = document.createElement("script");
n.id = "tmx_tags_js", n.setAttribute("type", "text/javascript");
var l = e.create_url(t, ".js", r, c, o);
n.setAttribute("src", l), e.set_csp_nonce(n), i.appendChild(n);
}, e.load_iframe_tags = function(t, r, c, o) {
e.beacon(t, r, c, o);
var i = e.create_url(t, ".htm", r, c, o), n = document.createElement("iframe");
n.title = "empty", n.setAttribute("aria-disabled", "true"), n.width = "0", n.height = "0", n.setAttribute(
"style",
"color:rgba(0,0,0,0); float:left; position:absolute; top:-200; left:-200; border:0px"
), n.setAttribute("src", i), document.body.appendChild(n);
}, e.csp_nonce = null, e.register_csp_nonce = function(t) {
if (t.currentScript !== void 0 && t.currentScript !== null) {
var r = t.currentScript.getAttribute("nonce");
r != null && r !== "" ? e.csp_nonce = r : t.currentScript.nonce !== void 0 && t.currentScript.nonce !== null && t.currentScript.nonce !== "" && (e.csp_nonce = t.currentScript.nonce);
}
}, e.set_csp_nonce = function(t) {
e.csp_nonce !== null && (t.setAttribute("nonce", e.csp_nonce), t.getAttribute("nonce") !== e.csp_nonce && (t.nonce = e.csp_nonce));
}, e.cleanup = function() {
for (; (m = document.getElementById("tdz_ifrm")) !== null; )
m.parentElement.removeChild(m);
for (; (d = document.getElementById("tmx_tags_iframe")) !== null; )
d.parentElement.removeChild(d);
for (; (f = document.getElementById("tmx_tags_js")) !== null; )
f.parentElement.removeChild(f);
}, e.profile = function(t, r, c, o) {
e.cleanup(), e.register_csp_nonce(document), e.load_tags(t, r, c, o);
}, e.profile_iframe = function(t, r, c, o) {
e.cleanup(), e.register_csp_nonce(document), e.load_iframe_tags(t, r, c, o);
}, e;
}, b = v();
export {
b as ThreatMetrix
};