1(function exposePushUtilities(root) { 2 "use strict"; 3 4 var DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000; 5 6 function base64UrlToUint8Array(value) { 7 if (typeof value !== "string" || value.length === 0) { 8 throw new TypeError("A Base64 URL string is required"); 9 } 10 11 if (!/^[A-Za-z0-9_-]+={0,2}$/.test(value) || value.length % 4 === 1) { 12 throw new TypeError("The Base64 URL string is invalid"); 13 } 14 15 var padding = "=".repeat((4 - (value.length % 4)) % 4); 16 var base64 = (value + padding) 17 .replace(/-/g, "+") 18 .replace(/_/g, "/"); 19 var binary = root.atob(base64); 20 var output = new Uint8Array(binary.length); 21 22 for (var index = 0; index < binary.length; index += 1) { 23 output[index] = binary.charCodeAt(index); 24 } 25 26 return output; 27 } 28 29 function isDismissalCooldownActive(dismissedAt, cooldownDays, now) { 30 var timestamp = Number(dismissedAt); 31 var days = Number(cooldownDays); 32 var currentTime = Number(now); 33 34 if ( 35 !Number.isFinite(timestamp) || 36 timestamp <= 0 || 37 !Number.isFinite(days) || 38 days <= 0 || 39 !Number.isFinite(currentTime) 40 ) { 41 return false; 42 } 43 44 return Math.max(0, currentTime - timestamp) < days * DAY_IN_MILLISECONDS; 45 } 46 47 function shouldShowPopup(options) { 48 return Boolean( 49 options && 50 options.enabled && 51 options.permission === "default" && 52 !isDismissalCooldownActive( 53 options.dismissedAt, 54 options.cooldownDays, 55 options.now, 56 ), 57 ); 58 } 59 60 function createVisitorId(cryptoObject) { 61 var cryptoApi = cryptoObject || root.crypto; 62 63 if (cryptoApi && typeof cryptoApi.randomUUID === "function") { 64 return cryptoApi.randomUUID(); 65 } 66 67 var bytes = new Uint8Array(16); 68 69 if (cryptoApi && typeof cryptoApi.getRandomValues === "function") { 70 cryptoApi.getRandomValues(bytes); 71 } else { 72 for (var index = 0; index < bytes.length; index += 1) { 73 bytes[index] = Math.floor(Math.random() * 256); 74 } 75 } 76 77 bytes[6] = (bytes[6] & 0x0f) | 0x40; 78 bytes[8] = (bytes[8] & 0x3f) | 0x80; 79 80 var hex = Array.from(bytes, function toHex(byte) { 81 return byte.toString(16).padStart(2, "0"); 82 }).join(""); 83 84 return [ 85 hex.slice(0, 8), 86 hex.slice(8, 12), 87 hex.slice(12, 16), 88 hex.slice(16, 20), 89 hex.slice(20), 90 ].join("-"); 91 } 92 93 root.EPSPushUtils = Object.freeze({ 94 base64UrlToUint8Array: base64UrlToUint8Array, 95 createVisitorId: createVisitorId, 96 isDismissalCooldownActive: isDismissalCooldownActive, 97 shouldShowPopup: shouldShowPopup, 98 }); 99})(typeof globalThis !== "undefined" ? globalThis : window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.