"use strict"; // Pre-declare all internal globals as non-enumerable so they are invisible // to Object.keys(window) / for-in enumeration. Must run before any var // declarations or property assignments below: once a property is defined // with enumerable:false here, subsequent `var x = value` assignments will // find the property already exists and only update the value, leaving the // descriptor intact. Direct globalThis.x = value assignments also only // update the value without touching enumerable when the property is // writable:true and configurable:true. (function _preHideInternals() { var _names = [ // runtime-set by Rust (runtime.rs / page.rs) '__obscura_errors', '__obscura_init', '__obscura_hide_list', '__obscura_objects', '__obscura_oid', '__obscura_ua', '__obscura_platform', '__obscura_ua_platform', '__obscura_ua_platform_version', '__obscura_stealth', '__obscura_markTrusted', '__obscura_hw', '__obscura_mem', '__documentReadyState__', '__currentUrl', // internal helpers (var-declared throughout the file) '__processDynScriptQueue', '_decodeDataScriptUrl', '_markNative', '_fpRand', '_fpNoise', '_fpCache', '_getFp', '_fp', '_splitAsciiWhitespace', '_getElementsByClassName', '_docEncoding', '_docIsUtf8', '_isSpecialScheme', '_applyDocQueryEncoding', '_anchorBase', '_elemHrefURL', '_setElemHrefPart', '_pad', '_daysInMonth', '_isoWeek1Monday', '_inputParseNumber', '_inputFormatNumber', '_htmlAttrName', '_convertNodes', '_parseHTMLFragment', '_elementClassFor', '_wrap', '_wrapEl', '_resolveUrl', '_registerIframe', '_base64ToUint8Array', '_bodyToUint8Array', '_arrayBufferFromBytes', '_installWasmStreamingFallback', '_urlParseOp', '_urlSetOp', '_urlResolveOp', '_decodeBodyWithCharset', '_utf8DecodeBytes', '_selectionFor', '_isConstructorCE', '_isValidCustomElementName', '_blobPartToBytes', '_bytesToBinaryString', '_formEncode', '_hexv', '_commonFonts', '_isXMLDocument', '_isValidPITarget', '_isHTMLEl', '_nodeList', '_rngNodeLength', '_rngNodeIndex', '_rngSame', '_rngRoot', '_rngAncestors', '_rngOrder', '_rngCmp', '_rngCheckOffset', '_idbRequest', '_idbObjectStore', '_idbTransaction', '_idbDatabase', '_makeListenerBox', // WebIDL interfaces. A real browser exposes these on the global as // enumerable:false; here they were assigned with `globalThis.X = X`, which // defaults to enumerable:true and is detectable in one line: // Object.getOwnPropertyDescriptor(window, 'Node').enumerable // Pre-declaring them non-enumerable here is enough -- per the note above, // the later `globalThis.X = X` assignments only update the value. 'Node', 'Element', 'Document', 'DocumentFragment', 'DocumentType', 'Text', 'Comment', 'CDATASection', 'ProcessingInstruction', 'CharacterData', 'CSSStyleDeclaration', 'DOMTokenList', 'Screen', 'NetworkInformation', 'MessageChannel', 'MessagePort', 'CustomElementRegistry', 'XMLHttpRequestEventTarget', 'HTMLMediaElement', 'HTMLVideoElement', 'HTMLAudioElement', 'WebGL2RenderingContext', ]; var _desc = { value: undefined, writable: true, enumerable: false, configurable: true }; for (var _i = 0; _i < _names.length; _i++) { try { Object.defineProperty(globalThis, _names[_i], _desc); } catch (_e) {} } })(); globalThis.__obscura_errors = []; globalThis.addEventListener = globalThis.addEventListener || function(){}; globalThis.onunhandledrejection = function(e) { if (e?.preventDefault) e.preventDefault(); }; globalThis.onerror = function(msg, src, line, col, error) { globalThis.__obscura_errors.push({msg: String(msg), src: String(src||""), line, error: String(error||"")}); }; globalThis.__windowListeners = {}; globalThis.addEventListener = function(type, fn) { if (!globalThis.__windowListeners[type]) globalThis.__windowListeners[type] = []; globalThis.__windowListeners[type].push(fn); }; globalThis.removeEventListener = function(type, fn) { if (globalThis.__windowListeners[type]) { globalThis.__windowListeners[type] = globalThis.__windowListeners[type].filter(h => h !== fn); } }; globalThis.dispatchEvent = function(event) { if (!event) return true; const handlers = globalThis.__windowListeners[event.type] || []; for (const h of handlers) { try { h.call(globalThis, event); } catch(e) { console.error(e); } } return !event.defaultPrevented; }; const _dom = (cmd, a1, a2) => Deno.core.ops.op_dom(cmd, String(a1 ?? ""), String(a2 ?? "")); const _nativeFns = new Set(); // Exact toString override for members whose native form is not just // `function ()`, e.g. accessors (`function get x() { [native code] }`) // or functions whose `.name` does not match the real builtin. const _nativeStr = new Map(); const _origToString = Function.prototype.toString; Function.prototype.toString = function toString() { if (_nativeStr.has(this)) { return _nativeStr.get(this); } if (_nativeFns.has(this)) { return `function ${this.name || ''}() { [native code] }`; } return _origToString.call(this); }; function _markNative(fn) { if (typeof fn === 'function') _nativeFns.add(fn); return fn; } // Mark a function with an exact native-code toString (used for accessors). function _markNativeAs(fn, str) { if (typeof fn === 'function') _nativeStr.set(fn, str); return fn; } _nativeFns.add(Function.prototype.toString); // unusualWindowProperties: obscura's internal globals are made non-enumerable // (see _preHideInternals and __obscura_init), which hides them from // Object.keys / for-in. But fingerprinting scripts enumerate the global object // with Object.getOwnPropertyNames and Reflect.ownKeys, which return // non-enumerable properties too, so the internals still leak (pixelscan's // unusualWindowProperties check). Filter the engine's own globals out of the // reflection APIs when they target the global object. The canonical name set is // __obscura_hide_list, precomputed at snapshot-build time; referencing it lazily // means the list is already populated by the time any page calls these. (function _hideInternalsFromReflection() { var _cache = null, _cacheLen = -1; function _set() { var list = globalThis.__obscura_hide_list; if (!list) { return null; } if (_cache && _cacheLen === list.length) { return _cache; } _cache = new Set(list); _cache.add('__obscura_hide_list'); _cacheLen = list.length; return _cache; } function _isGlobal(t) { return t === globalThis; } function _filter(t, names) { if (!_isGlobal(t)) { return names; } var set = _set(); if (!set) { return names; } var out = []; for (var i = 0; i < names.length; i++) { if (!set.has(names[i])) { out.push(names[i]); } } return out; } var _oGOPN = Object.getOwnPropertyNames; var _oOwnKeys = Reflect.ownKeys; var _oKeys = Object.keys; var _oGOPDs = Object.getOwnPropertyDescriptors; function define(obj, prop, impl) { try { Object.defineProperty(obj, prop, { value: _markNative(impl), writable: true, enumerable: false, configurable: true }); } catch (e) {} } define(Object, 'getOwnPropertyNames', function getOwnPropertyNames(t) { return _filter(t, _oGOPN(t)); }); define(Reflect, 'ownKeys', function ownKeys(t) { return _filter(t, _oOwnKeys(t)); }); define(Object, 'keys', function keys(t) { return _filter(t, _oKeys(t)); }); define(Object, 'getOwnPropertyDescriptors', function getOwnPropertyDescriptors(t) { var all = _oGOPDs(t); if (_isGlobal(t)) { var set = _set(); if (set) { var ks = _oGOPN(all); for (var i = 0; i < ks.length; i++) { if (set.has(ks[i])) { delete all[ks[i]]; } } } } return all; }); })(); [Error, TypeError, ReferenceError, SyntaxError, RangeError, URIError, EvalError].forEach(E => { try { Object.defineProperty(E.prototype, 'name', { value: E.name, writable: true, enumerable: false, configurable: false, }); } catch(e) {} }); const _stackCache = new WeakMap(); const _origStackDesc = Object.getOwnPropertyDescriptor(Error.prototype, 'stack'); if (_origStackDesc && _origStackDesc.get) { Object.defineProperty(Error.prototype, 'stack', { configurable: false, enumerable: false, get: function() { if (!_stackCache.has(this)) _stackCache.set(this, _origStackDesc.get.call(this)); return _stackCache.get(this); } }); } let _fpSeed = 0; // Dynamic script import queue — serializes concurrent import() calls // to prevent re-entrant RefCell panic in deno_core's futures_unordered_driver // when SPAs dynamically insert multiple