@jodetx_dev/secureshield-web 0.0.0-stage → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ "use strict";var SecureShield=(()=>{var Ie=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var Er=Object.prototype.hasOwnProperty;var sr=f=>{throw TypeError(f)};var Ir=(f,i,e)=>i in f?Ie(f,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):f[i]=e;var a=(f,i)=>Ie(f,"name",{value:i,configurable:!0});var Dr=(f,i)=>{for(var e in i)Ie(f,e,{get:i[e],enumerable:!0})},xr=(f,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Sr(i))!Er.call(f,n)&&n!==e&&Ie(f,n,{get:()=>i[n],enumerable:!(t=wr(i,n))||t.enumerable});return f};var Tr=f=>xr(Ie({},"__esModule",{value:!0}),f);var p=(f,i,e)=>Ir(f,typeof i!="symbol"?i+"":i,e),ar=(f,i,e)=>i.has(f)||sr("Cannot "+e);var v=(f,i,e)=>(ar(f,i,"read from private field"),e?e.call(f):i.get(f)),J=(f,i,e)=>i.has(f)?sr("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(f):i.set(f,e),b=(f,i,e,t)=>(ar(f,i,"write to private field"),t?t.call(f,e):i.set(f,e),e);var no={};Dr(no,{AdInjectionDetector:()=>nt,AdblockerPresenceDetector:()=>cn,AutomationArtifactsDetector:()=>qt,AutomationEnvironmentDetector:()=>Ue,BatterySubsystemDetector:()=>jt,BotBehaviorDetector:()=>Tt,BrowserCapabilitySpoofingDetector:()=>Me,BrowserFingerprintDetector:()=>ke,BrowserVersionIntegrityDetector:()=>Pe,CanvasFingerprintIntegrityDetector:()=>Kt,ClientConfigTamperingDetector:()=>pt,ClientHintsConsistencyDetector:()=>Jt,ClipboardHijackingDetector:()=>rt,ConsoleTamperingDetector:()=>Fe,ContentScriptInjectionDetector:()=>et,CookiePolicyDetector:()=>ct,CredentialStuffingDetector:()=>Bt,CryptoMinerDetector:()=>it,CssEngineFeatureMatrixDetector:()=>an,DebuggerDetectionDetector:()=>Xe,DevToolsDetector:()=>Ce,DeviceFingerprintEngine:()=>dn,DomTamperingDetector:()=>We,DynamicEvalDetector:()=>Ke,ErrorStackFormatDetector:()=>tn,ExtensionInjectionDetector:()=>Ze,ExtensionPermissionAbuseDetector:()=>tt,FontLoadingEnumerationDetector:()=>nn,FunctionPrototypeTamperingDetector:()=>He,GlobalObjectTamperingDetector:()=>Ye,GlobalPrivacyControlDetector:()=>ln,HardwareTopologyDetector:()=>Vt,HeadlessBrowserDetector:()=>Re,HiddenElementDetector:()=>It,HttpsEnforcementDetector:()=>yt,HumanInteractionDetector:()=>le,IframeClickjackingDetector:()=>St,ImpossibleNavigationDetector:()=>Ut,IndexedDbIntegrityDetector:()=>lt,IndexedDbLeaseVault:()=>F,InputPointerMediaQueryDetector:()=>Qt,IntlLocaleFingerprintDetector:()=>en,KeyboardDynamicsDetector:()=>oe,LocalstorageSecretsDetector:()=>zt,MaliciousExtensionDetector:()=>Qe,ManifestIntegrityDetector:()=>ut,MathFpPrecisionDetector:()=>rn,MediaCapabilitiesCodecDetector:()=>on,MemoryLeakExploitationDetector:()=>Je,MemoryScrubber:()=>L,MixedContentDetector:()=>_t,MouseDynamicsDetector:()=>re,NativeApiOverrideDetector:()=>Ve,NavigatorPropertyIntegrityDetector:()=>Ne,NetworkLatencyDetector:()=>wt,OriginValidator:()=>x,PayloadSecurityHelper:()=>Q,PermissionsApiSweepDetector:()=>Xt,PluginIntegrityDetector:()=>ot,PrototypeChainIntegrityDetector:()=>Gt,RemediationManager:()=>Ae,RuntimeFunctionHookDetector:()=>ze,RuntimeHookDetector:()=>je,RuntimeIntegrityGuardian:()=>A,SDK_VERSION:()=>pe,ScreenCaptureDetector:()=>Dt,ScreenGeometryDetector:()=>Ht,ScriptInjectionDetector:()=>qe,SecureClipboard:()=>tr,SecureMemoryBuffer:()=>In,SecureShield:()=>we,SecureUiHardening:()=>Oe,SecurityLockoutOverlay:()=>Te,ServiceWorkerIntegrityDetector:()=>dt,SessionAnomalyDetector:()=>$t,SessionStorageSecretsDetector:()=>at,SriComplianceDetector:()=>ft,SslValidationDetector:()=>mt,StorageQuotaEstimateDetector:()=>sn,StorageScrubber:()=>N,TabBlurShield:()=>ge,TelemetrySerializer:()=>X,TimeManipulationDetector:()=>Be,TouchEventDetector:()=>ae,UiOverlayDetector:()=>Et,UserAgentTamperingDetector:()=>Le,VirtualBrowserDetector:()=>$e,WasmBytecodeIntegrityDetector:()=>Yt,WasmIntegrityDetector:()=>Ge,WebAuthnHardwareAuthenticatorDetector:()=>Zt,WebCertificatePinningDetector:()=>gt,WebDnsManipulationDetector:()=>ht,WebProxyDetector:()=>vt,WebSessionHijackDetector:()=>Nt,WebStoragePlaintextDetector:()=>st,WebVpnDetector:()=>bt,WebglRendererVendorDetector:()=>Ft,WebgpuSubsystemDetector:()=>Wt,WindowFocusDetector:()=>xt,default:()=>to,getBaseApiUrl:()=>eo,isServerEnvironment:()=>un,normalizeEnvironment:()=>nr});var pe="4.0.0",De=class De{static generateDeviceIdHash(){if(typeof window>"u"||typeof navigator>"u")return"dev_web_node_test_01";let i=navigator,e=[i.userAgent||"",i.language||"",i.hardwareConcurrency||4,window.screen?`${window.screen.width}x${window.screen.height}`:"1024x768",new Date().getTimezoneOffset()].join("|"),t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return`dev_web_${Math.abs(t).toString(16)}`}static formatOsVersion(){if(typeof navigator>"u"||!navigator.userAgent)return"NodeJS 22";let i=navigator.userAgent;if(/Windows NT 10\.0/i.test(i))return"Windows 10/11";if(/Windows NT 6\.3/i.test(i))return"Windows 8.1";if(/Windows NT 6\.2/i.test(i))return"Windows 8";if(/Windows NT 6\.1/i.test(i))return"Windows 7";if(/Mac OS X ([0-9_]+)/i.test(i)){let e=i.match(/Mac OS X ([0-9_]+)/i);return`macOS ${e?e[1].replace(/_/g,"."):""}`.trim()}if(/Android ([0-9.]+)/i.test(i)){let e=i.match(/Android ([0-9.]+)/i);return`Android ${e?e[1]:""}`.trim()}if(/iPhone OS ([0-9_]+)/i.test(i)||/iPad.*OS ([0-9_]+)/i.test(i)){let e=i.match(/OS ([0-9_]+)/i);return`iOS ${e?e[1].replace(/_/g,"."):""}`.trim()}return/CrOS/i.test(i)?"ChromeOS":/Linux/i.test(i)?"Linux":i.length>48?i.substring(0,48):i}static createReport(i,e,t,n,r){i.forEach(m=>{m.status||(m.status=m.triggered?"FAILED":"PASSED"),m.name||(m.name=m.id),m.confidence===void 0&&(m.confidence=.85),m.fpRiskTier||(m.fpRiskTier="LOW"),m.evasionDifficulty||(m.evasionDifficulty="MEDIUM"),m.executionTimeMs===void 0&&(m.executionTimeMs=.03),(m.status==="PASSED"||!m.triggered)&&(m.severity=0)});let s=i.filter(m=>m.triggered||m.status==="FAILED").length,c=i.length-s,l=Date.now(),d=De.generateDeviceIdHash(),u=De.formatOsVersion();return{scan_id:`scan_web_${l}_${Math.floor(Math.random()*1e3)}`,device_id_hash:d,session_id:`sess_web_${l}`,os_name:"Web",os_version:u,app_id:t||"app_web_portal_prod",app_version:r||"1.0.0",sdk_version:pe,verdict:"PENDING_BACKEND_INGESTION",decision_action:"PENDING_BACKEND_INGESTION",scoring_authority:"SERVER_AUTHORITATIVE",authoritative_verdict:"PENDING_BACKEND_INGESTION",total_detectors:i.length,passed:c,failed:s,tenant_id:e||"TEN-ENTERPRISE-01",environment:n||"web",items:i}}};a(De,"TelemetrySerializer");var X=De;var Z=class Z{static zero(i){if(i)try{let e;if(i instanceof ArrayBuffer)e=new Uint8Array(i);else if(ArrayBuffer.isView(i))e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);else if(i.buffer instanceof ArrayBuffer)e=new Uint8Array(i.buffer);else return;if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")try{crypto.getRandomValues(e)}catch{}e.fill(0)}catch{}}static scrubObject(i,e=5){if(!(!i||typeof i!="object"||e<=0)){if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)){Z.zero(i);return}try{if(Array.isArray(i))for(let t of i)Z.scrubObject(t,e-1);else for(let t of Object.keys(i)){let n=i[t];n instanceof ArrayBuffer||ArrayBuffer.isView(n)?Z.zero(n):typeof n=="object"&&n!==null&&Z.scrubObject(n,e-1)}}catch{}}}};a(Z,"MemoryScrubber");var L=Z,Dn=class Dn{static async use(i,e){let t=i instanceof Uint8Array?i:new Uint8Array(i);try{return await e(t)}finally{L.zero(t)}}};a(Dn,"SecureMemoryBuffer");var In=Dn;var w=class w{static setServerPublicKey(i){i&&i.trim()&&(w.serverPublicKeyBase64=i.trim())}static setHmacKey(i){i&&i.trim()&&(w.hmacKeyHex=i.trim())}static getSubtleCrypto(){if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle)return globalThis.crypto.subtle;if(typeof window<"u"&&window.crypto&&window.crypto.subtle)return window.crypto.subtle;throw new Error("Web Crypto API (crypto.subtle) is not available in the current environment.")}static scrubBuffer(i){L.zero(i)}static bytesToBase64(i){let e="",t=i.byteLength;for(let r=0;r<t;r++)e+=String.fromCharCode(i[r]);if(typeof btoa=="function")return btoa(e);let n=globalThis.Buffer;if(typeof n<"u")return n.from(i).toString("base64");throw new Error("Base64 encoding is not supported in this runtime.")}static base64ToBytes(i){let e=i.replace(/[\r\n\s]/g,"");if(typeof atob=="function"){let n=atob(e),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}let t=globalThis.Buffer;if(typeof t<"u")return new Uint8Array(t.from(e,"base64"));throw new Error("Base64 decoding is not supported in this runtime.")}static hexToBytes(i){let e=i.replace(/[\r\n\s]/g,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substring(n,n+2),16);return t}static bytesToHex(i){let e="";for(let t=0;t<i.length;t++)e+=i[t].toString(16).padStart(2,"0");return e}static generateNonce(){if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID().replace(/-/g,"");let i=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(i);else for(let e=0;e<16;e++)i[e]=Math.floor(Math.random()*256);return w.bytesToHex(i)}static async encryptAndSignPayload(i,e,t){let n=await w.createSecurityEnvelope(i,e,t);return JSON.stringify(n)}static async createSecurityEnvelope(i,e,t){let n=w.getSubtleCrypto(),r=e&&e.trim()||w.serverPublicKeyBase64,o=t&&t.trim()||w.hmacKeyHex,s=await n.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveBits","deriveKey"]),c=await n.exportKey("spki",s.publicKey),l=w.bytesToBase64(new Uint8Array(c)),d=w.base64ToBytes(r),u=await n.importKey("spki",d,{name:"ECDH",namedCurve:"P-256"},!1,[]),m=await n.deriveBits({name:"ECDH",public:u},s.privateKey,256),_=w.generateNonce(),E=Date.now(),O=new TextEncoder,U=O.encode(_),$=O.encode("secureshield_telemetry_v4"),Se=await n.importKey("raw",m,{name:"HKDF"},!1,["deriveKey"]),fn=await n.deriveKey({name:"HKDF",hash:"SHA-256",salt:U,info:$},Se,{name:"AES-GCM",length:256},!1,["encrypt"]);w.scrubBuffer(new Uint8Array(m));let V=new Uint8Array(12);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(V);else for(let En=0;En<12;En++)V[En]=Math.floor(Math.random()*256);let Ee=w.bytesToBase64(V),ir=O.encode(i),yr=await n.encrypt({name:"AES-GCM",iv:V,tagLength:128},fn,ir);w.scrubBuffer(ir),w.scrubBuffer(V);let rr=w.bytesToBase64(new Uint8Array(yr)),or=w.hexToBytes(o),_r=await n.importKey("raw",or,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),hr=O.encode(`${rr}|${E}|${Ee}|${_}`),vr=await n.sign("HMAC",_r,hr),br=w.bytesToHex(new Uint8Array(vr));return w.scrubBuffer(or),{header:{signature:br,timestamp:E,iv:Ee,nonce:_,ephemeral_pub_key:l,crypto_mode:"ECDH-P256-AES-GCM"},body:rr}}};a(w,"PayloadSecurityHelper"),p(w,"DEFAULT_SERVER_PUBLIC_KEY_BASE64","MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEXWEHhyh0kWjfDiNepjvNZ3/9JVzVR/O8jiCAg4//pE2AWxh1k0+ezQfM4hOFLBGPS9GGbCfFXvp2XCYrMljJPw=="),p(w,"DEFAULT_HMAC_KEY_HEX","519a30120b9fa916d17661342905a8b465c07d8eac7e01cb26df689620b4f166"),p(w,"serverPublicKeyBase64",w.DEFAULT_SERVER_PUBLIC_KEY_BASE64),p(w,"hmacKeyHex",w.DEFAULT_HMAC_KEY_HEX);var Q=w;function Ar(){if(typeof globalThis<"u"&&globalThis.crypto?.subtle)return globalThis.crypto.subtle;if(typeof window<"u"&&window.crypto?.subtle)return window.crypto.subtle;throw new Error("[SecureShield EnvelopeCrypto] WebCrypto SubtleCrypto is not available in current environment.")}a(Ar,"getSubtleCrypto");function Or(f){if(typeof globalThis<"u"&&globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(f);if(typeof window<"u"&&window.crypto?.getRandomValues)return window.crypto.getRandomValues(f);throw new Error("[SecureShield EnvelopeCrypto] WebCrypto getRandomValues is not available.")}a(Or,"getRandomValues");function xn(f){let i=f instanceof Uint8Array?f:new Uint8Array(f),e="";for(let t=0;t<i.length;t++)e+=i[t].toString(16).padStart(2,"0");return e}a(xn,"bufToHex");function Cr(f){if(typeof atob=="function"){let e=atob(f),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}let i=globalThis.Buffer;if(typeof i<"u")return new Uint8Array(i.from(f,"base64"));throw new Error("[SecureShield EnvelopeCrypto] Base64 decoding not available.")}a(Cr,"base64ToUint8Array");async function cr(f,i){let e=Ar(),t=Cr(i);if(t.length!==32)throw new Error(`[SecureShield EnvelopeCrypto] Invalid key length. Expected 32 bytes for AES-256-GCM, got ${t.length}`);let n=await e.importKey("raw",t,{name:"AES-GCM"},!1,["encrypt"]),r=Or(new Uint8Array(12)),s=new TextEncoder().encode(f),c=await e.encrypt({name:"AES-GCM",iv:r,tagLength:128},n,s),l=new Uint8Array(c),u=l.length-16,m=l.subarray(0,u),_=l.subarray(u),E=xn(r),O=xn(_),U=xn(m);return`enc:v1:${E}:${O}:${U}`}a(cr,"envelopeEncrypt");var z=Function.prototype.call,Rr=z.bind(String.prototype.split),kr=z.bind(String.prototype.trim),Pr=z.bind(String.prototype.toLowerCase),G=z.bind(String.prototype.replace),me=z.bind(String.prototype.indexOf),Mr=z.bind(String.prototype.lastIndexOf),q=z.bind(String.prototype.slice),Lr=z.bind(RegExp.prototype.test);function mn(f){if(typeof f!="string")return"";try{return kr(f)}catch{return G(f,/^\s+|\s+$/g,"")}}a(mn,"safeTrim");function fe(f){if(typeof f!="string")return"";try{return Pr(f)}catch{return f}}a(fe,"safeLowerCase");function ee(f,i){return typeof f!="string"||typeof i!="string"||i.length>f.length?!1:q(f,0,i.length)===i}a(ee,"safeStartsWith");function Tn(f,i){return typeof f!="string"||typeof i!="string"||i.length>f.length?!1:q(f,f.length-i.length)===i}a(Tn,"safeEndsWith");function gn(f,i){return typeof f!="string"||typeof i!="string"?!1:me(f,i)!==-1}a(gn,"safeIncludes");function xe(f,i){if(typeof f!="string")return[];if(i.length===1){let e=[],t="";for(let n=0;n<f.length;n++)f[n]===i?(e.push(t),t=""):t+=f[n];return e.push(t),e}return Rr(f,i)}a(xe,"safeSplit");var I=class I{static normalizeDomain(i){if(!i||typeof i!="string")return"";let e=fe(mn(i));if(!e)return"";let t="";try{gn(e,"://")?t=new URL(e).hostname:gn(e,":")&&!gn(e,"[")&&xe(e,":").length>2?t=new URL("https://["+e+"]").hostname:t=new URL("https://"+e).hostname}catch{return""}return G(G(t,/\.+$/,""),/^\[|\]$/g,"")}static matchesDomain(i,e){let t=I.normalizeDomain(i);if(!t||!e||typeof e!="string")return!1;let n=G(fe(mn(e)),/\.+$/,"");if(!n)return!1;if(ee(n,"*.")||ee(n,".")){let o=I.normalizeDomain(G(n,/^\*?\./,""));return!!o&&(t===o||Tn(t,`.${o}`))}if(n==="*"||ee(n,"*"))return!1;let r=I.normalizeDomain(n);return!!r&&t===r}static isLoopback(i){let e=I.normalizeDomain(i);return e?e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="0.0.0.0"||Tn(e,".localhost"):!1}static parseIPv4(i){if(!i||typeof i!="string")return null;let e=xe(i,".");if(e.length!==4)return null;let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(!r||!Lr(/^\d+$/,r))return null;let o=Number(r);if(isNaN(o)||o<0||o>255)return null;t.push(o)}return t}static isPrivateOrRestrictedIPv4(i){let[e,t,n]=i;return e===0||e===127||e===10||e>=224||e===172&&t>=16&&t<=31||e===192&&t===168||e===100&&t>=64&&t<=127||e===169&&t===254||e===192&&t===0&&(n===0||n===2)||e===198&&(t===51&&n===100||t===18||t===19)||e===203&&t===0&&n===113}static parseIPv6(i){let e=G(fe(i),/^\[|\]$/g,""),t=me(e,"%");t!==-1&&(e=q(e,0,t));let n=null,r=Mr(e,":");if(r!==-1&&me(e,".",r)!==-1){let u=I.parseIPv4(q(e,r+1));if(!u)return null;n=u,e=q(e,0,r)+":"+(u[0]<<8|u[1]).toString(16)+":"+(u[2]<<8|u[3]).toString(16)}let o=me(e,"::"),s=[],c=[];if(o!==-1){if(me(e,"::",o+2)!==-1)return null;let u=q(e,0,o),m=q(e,o+2);u&&(s=xe(u,":")),m&&(c=xe(m,":"))}else s=xe(e,":");if(s.length+c.length>8)return null;let l=new Array(8).fill(0);for(let u=0;u<s.length;u++){if(!s[u])continue;let m=parseInt(s[u],16);if(isNaN(m)||m<0||m>65535)return null;l[u]=m}let d=8-c.length;for(let u=0;u<c.length;u++){if(!c[u])continue;let m=parseInt(c[u],16);if(isNaN(m)||m<0||m>65535)return null;l[d+u]=m}return{words:l,embeddedV4:n}}static isPrivateOrRestrictedIPv6(i){let{words:e,embeddedV4:t}=i,[n,r,o,s,c,l,d,u]=e,m=!0;for(let _=0;_<e.length;_++)if(e[_]!==0){m=!1;break}return m||n===0&&r===0&&o===0&&s===0&&c===0&&l===0&&d===0&&u===1?!0:n===0&&r===0&&o===0&&s===0&&c===0&&(l===65535||l===0)?I.isPrivateOrRestrictedIPv4(t||[d>>8,d&255,u>>8,u&255]):(n&65024)===64512||(n&65472)===65152||(n&65280)===65280||n===8194||n===8193&&(r===3512||r===0)||n===100&&r===65435}static isPrivateOrRestrictedHost(i){if(!i||typeof i!="string")return!1;let e=G(G(fe(mn(i)),/\.+$/,""),/^\[|\]$/g,"");if(!e)return!1;let t=me(e,"%");if(t!==-1&&(e=q(e,0,t)),!e)return!1;if(e==="localhost"||Tn(e,".localhost"))return!0;let n=I.parseIPv4(e);if(n)return I.isPrivateOrRestrictedIPv4(n);let r=I.parseIPv6(e);return r?I.isPrivateOrRestrictedIPv6(r):!1}static canonicalizeOrigin(i){if(!i||typeof i!="string")return"";let e=mn(i);if(!e)return"";let t=fe(e);if(t==="null"||ee(t,"file:")||ee(t,"data:")||ee(t,"blob:")||t==="https://null"||t==="http://null")return"";try{let n=gn(e,"://")?new URL(e):new URL(`https://${e}`),r=fe(n.origin);return!r||r==="null"||ee(r,"file:")||n.hostname==="null"?"":r}catch{return""}}static matchesOrigin(i,e){let t=I.canonicalizeOrigin(i),n=I.canonicalizeOrigin(e);return!!t&&!!n&&t===n}static isFramed(){try{return typeof window>"u"?!1:window.self!==window.top}catch{return!0}}static getCurrentContext(){if(typeof window<"u"&&window.location){let i=window.location.origin||`${window.location.protocol}//${window.location.host}`,e=window.location.hostname||"localhost";return{origin:i,hostname:e}}return{origin:"http://localhost:3000",hostname:"localhost"}}static validate(i){let{origin:e,hostname:t}=I.getCurrentContext(),n=I.isFramed();if(!i||i.length===0)return{isValid:!0,currentOrigin:e,currentHostname:t,isFramed:n};let r=!1;for(let o=0;o<i.length;o++){let s=i[o];if(I.matchesDomain(t,s)||I.matchesDomain(e,s)){r=!0;break}}return r?{isValid:!0,currentOrigin:e,currentHostname:t,isFramed:n}:{isValid:!1,currentOrigin:e,currentHostname:t,isFramed:n,mismatchReason:`Current origin '${e}' (${t}) does not match any allowed domain in allowlist: [${i.join(", ")}]`}}};a(I,"OriginValidator");var x=I;var Nr={kty:"EC",crv:"P-256",x:"W2hiHfGR-C3DAIFtr5-UXDBYlS5GePQ-WVqfbIaWja4",y:"H85-tIZJ5_x6zJ48sZ-zYtpMr7mg8xjHd1T6lRofzFo"},Br={kty:"EC",crv:"P-256",x:"tguAgCXW8e8uQYPbDmuydkrgZiqkZyBB_4A7QUuVICo",y:"RU5L05mWtANjeSN4ZKPbuucuryXowWK6u8WaVnNrz-s"},Ur={kty:"EC",crv:"P-256",x:"J6lyrQF7xDRiAi22Bisyyj0UFt1K829OfXzJ8oJUF3M",y:"tM8MqCnHQY_MgGyd6zI0Qpxtr7kFxtCkqpbG4HM9xwU"},$r={kty:"EC",crv:"P-256",x:"XbhWkskg6X_2czewC2U3AnLwxxUUcBeLJq87JpWNAyc",y:"vwa2bMOLQn7IDKbk4k--622f8ZArjMk1GkiJsstm_uc"},ur={kty:"EC",crv:"P-256",x:"Qh2qlAKK4ayAbp2duymbONlUsMxQFZky3_1a2XTKsUE",y:"vxY1Ocbdd225AlaHNEaHMoAmN9bhtoHDxwXJ91Zd6sk"},lr={secureshield_policy_p256_v3:Nr},dr={secureshield_lease_p256_v3:Br},Fr={secureshield_policy_p256_v1:ur,secureshield_policy_p256_v2:Ur},Wr={secureshield_lease_p256_v1:ur,secureshield_lease_p256_v2:$r},W=class W{static getSubtle(){let i=typeof globalThis<"u"&&globalThis.crypto?.subtle||typeof window<"u"&&window.crypto?.subtle;if(!i)throw new Error("WebCrypto subtle unavailable");return i}static base64UrlToUint8Array(i){let e=i.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4!==0;)e+="=";if(typeof atob=="function"){let n=atob(e),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}let t=globalThis.Buffer;if(t)return new Uint8Array(t.from(e,"base64"));throw new Error("Base64 decode unavailable")}static async verifyPolicyEnvelope(i,e,t=0,n=!1){return W.verifyEnvelopeInternal(i,"policy",e,t,n)}static async verifyLeaseEnvelope(i,e,t=0,n=!1){return W.verifyEnvelopeInternal(i,"lease",e,t,n)}static async verifyEnvelopeInternal(i,e,t,n=0,r=!1){if(!i||typeof i!="object")return{isValid:!1,policy:null,reason:`Invalid ${e} payload`};if(!i.protected||!i.payload||!i.signature)return{isValid:!1,policy:null,reason:"lacks cryptographic JWS envelope"};try{let o=W.base64UrlToUint8Array(i.protected),s=JSON.parse(new TextDecoder().decode(o));if(s.alg!=="ES256")return{isValid:!1,policy:null,reason:`Unsupported alg: ${s.alg}`};let c=e==="policy"?"secureshield_policy_p256_v3":"secureshield_lease_p256_v3",l=s.kid||c;if(r&&(!t||!t[l])&&(l==="secureshield_policy_p256_v1"||l==="secureshield_policy_p256_v2"||l==="secureshield_lease_p256_v1"||l==="secureshield_lease_p256_v2"||l.includes("dev")||l.includes("test")))return{isValid:!1,policy:null,kid:l,reason:`Compromised or non-production key '${l}' is forbidden in production environment`};let d;if(e==="policy"){if(s.typ&&(s.typ==="secureshield-lease+jwt"||s.typ==="lease"))return{isValid:!1,policy:null,kid:l,reason:"Purpose binding mismatch: lease envelope cannot be used as policy"};if(l==="secureshield_lease_p256_v1"||l==="secureshield_lease_p256_v2"||l==="secureshield_lease_p256_v3")return{isValid:!1,policy:null,kid:l,reason:"Purpose binding mismatch: lease key cannot sign policy"};d=r?{...lr,...t||{}}:{...lr,...Fr,...t||{}}}else{if(s.typ&&(s.typ==="secureshield-policy+jwt"||s.typ==="policy"))return{isValid:!1,policy:null,kid:l,reason:"Purpose binding mismatch: policy envelope cannot be used as lease"};if(l==="secureshield_policy_p256_v1"||l==="secureshield_policy_p256_v2"||l==="secureshield_policy_p256_v3")return{isValid:!1,policy:null,kid:l,reason:"Purpose binding mismatch: policy key cannot sign lease"};d=r?{...dr,...t||{}}:{...dr,...Wr,...t||{}}}let u=d[l];if(!u)return{isValid:!1,policy:null,kid:l,reason:`Unknown kid: ${l} (untrusted)`};let m=Math.max(-300,Math.min(3600,Number(n)||0)),_=Math.floor(Date.now()/1e3)+m;if(typeof s.iat=="number"&&s.iat>_+300)return{isValid:!1,policy:null,kid:l,reason:`Clock skew violation: ${s.iat} > ${_}`};if(typeof s.exp=="number"&&s.exp<_-300)return{isValid:!1,policy:null,kid:l,reason:`Expired ${e} signature: exp ${s.exp} < ${_}`};let E=new TextEncoder().encode(`${i.protected}.${i.payload}`),O=W.base64UrlToUint8Array(i.signature);if(O.length!==64)return{isValid:!1,policy:null,kid:l,reason:"Invalid signature length"};let U=W.getSubtle(),$=await U.importKey("jwk",u,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);if(!await U.verify({name:"ECDSA",hash:{name:"SHA-256"}},$,O,E))return{isValid:!1,policy:null,kid:l,reason:"verification failed"};let fn=W.base64UrlToUint8Array(i.payload);return{isValid:!0,policy:JSON.parse(new TextDecoder().decode(fn)),kid:l,iat:s.iat,exp:s.exp}}catch(o){return{isValid:!1,policy:null,reason:`Verification error: ${o?.message||o}`}}}};a(W,"PolicySignatureVerifier");var te=W;var y=class y{static getSubtleCrypto(){if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle)return globalThis.crypto.subtle;if(typeof window<"u"&&window.crypto&&window.crypto.subtle)return window.crypto.subtle;throw new Error("Web Crypto API (crypto.subtle) is not available.")}static isIndexedDbAvailable(){try{return typeof globalThis<"u"&&typeof globalThis.indexedDB<"u"}catch{return!1}}static openDatabase(){return new Promise((i,e)=>{if(!y.isIndexedDbAvailable())return e(new Error("IndexedDB is not supported in the current environment."));let n=globalThis.indexedDB.open(y.DB_NAME,y.DB_VERSION);n.onupgradeneeded=r=>{let o=r.target.result;o.objectStoreNames.contains(y.STORE_KEYS)||o.createObjectStore(y.STORE_KEYS),o.objectStoreNames.contains(y.STORE_LEASES)||o.createObjectStore(y.STORE_LEASES,{keyPath:"id"})},n.onsuccess=r=>{i(r.target.result)},n.onerror=r=>{e(r.target.error||new Error("Failed to open IndexedDB vault"))}})}static async getOrCreateMasterKey(){let i=y.getSubtleCrypto();if(y.isIndexedDbAvailable())try{let t=await y.openDatabase(),n=await new Promise((o,s)=>{try{let d=t.transaction(y.STORE_KEYS,"readonly").objectStore(y.STORE_KEYS).get(y.MASTER_KEY_ID);d.onsuccess=()=>o(d.result||null),d.onerror=()=>s(d.error)}catch(c){s(c)}});if(n)return n;let r=await i.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return await new Promise((o,s)=>{try{let d=t.transaction(y.STORE_KEYS,"readwrite").objectStore(y.STORE_KEYS).put(r,y.MASTER_KEY_ID);d.onsuccess=()=>o(),d.onerror=()=>s(d.error)}catch(c){s(c)}}),r}catch{}let e=y.memoryKeyStore.get(y.MASTER_KEY_ID);return e||(e=await i.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]),y.memoryKeyStore.set(y.MASTER_KEY_ID,e)),e}static async saveLease(i){let e=y.getSubtleCrypto(),t=await y.getOrCreateMasterKey(),n=new Uint8Array(12);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(n);else for(let m=0;m<12;m++)n[m]=Math.floor(Math.random()*256);let r=new TextEncoder,o={...i,lastSeenTimestamp:i.lastSeenTimestamp||Date.now()},s=r.encode(JSON.stringify(o)),c=await e.encrypt({name:"AES-GCM",iv:n,tagLength:128},t,s);L.zero(s);let l=y.bytesToBase64(n),d=y.bytesToBase64(new Uint8Array(c));L.zero(n);let u={id:y.LEASE_RECORD_ID,iv:l,ciphertext:d,timestamp:Date.now()};if(y.isIndexedDbAvailable())try{let m=await y.openDatabase();await new Promise((_,E)=>{let $=m.transaction(y.STORE_LEASES,"readwrite").objectStore(y.STORE_LEASES).put(u);$.onsuccess=()=>_(),$.onerror=()=>E($.error)});return}catch(m){console.warn("[SecureShield] Storage quota or IDB write error during offline lease caching; gracefully falling back to memory store:",m?.name||m?.message||m)}y.memoryLeaseStore.set(y.LEASE_RECORD_ID,u)}static async getLease(){let i=y.getSubtleCrypto(),e=null;if(y.isIndexedDbAvailable())try{let t=await y.openDatabase();e=await new Promise((n,r)=>{let c=t.transaction(y.STORE_LEASES,"readonly").objectStore(y.STORE_LEASES).get(y.LEASE_RECORD_ID);c.onsuccess=()=>n(c.result||null),c.onerror=()=>r(c.error)})}catch{}if(e||(e=y.memoryLeaseStore.get(y.LEASE_RECORD_ID)||null),!e||!e.ciphertext||!e.iv)return null;try{let t=await y.getOrCreateMasterKey(),n=y.base64ToBytes(e.iv),r=y.base64ToBytes(e.ciphertext),o=await i.decrypt({name:"AES-GCM",iv:n,tagLength:128},t,r);L.zero(n),L.zero(r);let c=new TextDecoder().decode(o);return JSON.parse(c)}catch{return null}}static async verifyOfflineLease(i,e,t=0,n,r=!1,o=!0){let s=await y.getLease();if(!s)return{isValid:!1,reason:"No cached encrypted session lease found in vault."};if(!s.signedEnvelope||!s.signedEnvelope.protected||!s.signedEnvelope.payload||!s.signedEnvelope.signature)return{isValid:!1,reason:"Cached lease lacks server cryptographic signature (legacy unsigned lease revoked)."};let c=Date.now()+t,l=60*1e3;if(s.lastSeenTimestamp&&c<s.lastSeenTimestamp-l)return{isValid:!1,reason:"Clock rollback detected: device clock is earlier than last recorded lease verification."};if(s.cachedAt&&c<s.cachedAt-l)return{isValid:!1,reason:"Clock rollback detected: device clock is earlier than lease creation time."};let d=await te.verifyLeaseEnvelope(s.signedEnvelope,n,Math.floor(t/1e3),r);if(!d.isValid||!d.policy)return{isValid:!1,reason:`Server signature verification failed: ${d.reason||"Invalid signature"}.`};let u=d.policy,m=u?.app_id||u?.appId,_=u?.origin,E=u?.exp,O=u?.iat;if(!m||!_||typeof E!="number"||typeof O!="number")return o?{isValid:!1,needsOnlineRefresh:!0,reason:"Signed lease payload missing required cryptographic bindings (app_id, origin, iat, exp)."}:(console.warn("[SecureShield LEGACY MODE WARNING] Running in legacy-compatible mode (strictLeaseBindingEnforcement: false). Cached lease payload lacks required cryptographic bindings (app_id, origin, iat, exp). Refusing offline authorization without falling back to unsigned local records. Online refresh required."),{isValid:!1,needsOnlineRefresh:!0,reason:"Signed lease payload missing required cryptographic bindings (app_id, origin, iat, exp). Legacy-compatible mode: online refresh required."});let U=m,$=_;if(U!==i)return{isValid:!1,reason:`AppId mismatch: Lease registered for '${U}', current is '${i}'.`};if(!x.matchesOrigin($,e))return{isValid:!1,reason:`Origin mismatch: Lease bound to '${$}', current is '${e}'.`};let Se=10080*60*1e3;if(c-O*1e3>Se)return{isValid:!1,reason:"Cached session lease exceeds maximum allowable lifetime (7 days)."};let V=E*1e3,Ee=Math.min(V,O*1e3+Se);return c>=Ee?{isValid:!1,reason:`Cached session lease has expired (Expired at: ${new Date(Ee).toISOString()}).`}:(s.lastSeenTimestamp=Math.max(s.lastSeenTimestamp||0,c),y.saveLease(s).catch(()=>{}),{isValid:!0,lease:{...s,policy:u.policy||s.policy,sessionToken:u.session_token||u.sessionToken||s.sessionToken,deviceToken:u.device_token||u.deviceToken||s.deviceToken}})}static async clearVault(){if(y.memoryKeyStore.clear(),y.memoryLeaseStore.clear(),y.isIndexedDbAvailable())try{let i=await y.openDatabase();await new Promise((e,t)=>{let n=i.transaction([y.STORE_KEYS,y.STORE_LEASES],"readwrite");n.objectStore(y.STORE_KEYS).clear(),n.objectStore(y.STORE_LEASES).clear(),n.oncomplete=()=>e(),n.onerror=()=>t(n.error)})}catch{}}static bytesToBase64(i){let e="";for(let n=0;n<i.length;n++)e+=String.fromCharCode(i[n]);if(typeof btoa=="function")return btoa(e);let t=globalThis.Buffer;if(typeof t<"u")return t.from(i).toString("base64");throw new Error("Base64 encoding not supported.")}static base64ToBytes(i){let e=i.replace(/[\r\n\s]/g,"");if(typeof atob=="function"){let n=atob(e),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}let t=globalThis.Buffer;if(typeof t<"u")return new Uint8Array(t.from(e,"base64"));throw new Error("Base64 decoding not supported.")}};a(y,"IndexedDbLeaseVault"),p(y,"DB_NAME","secureshield_auth_vault"),p(y,"DB_VERSION",1),p(y,"STORE_KEYS","master_keys"),p(y,"STORE_LEASES","leases"),p(y,"MASTER_KEY_ID","lease_master_key"),p(y,"LEASE_RECORD_ID","cached_session_lease"),p(y,"memoryKeyStore",new Map),p(y,"memoryLeaseStore",new Map);var F=y;var g=class g{static renderLockoutOverlay(i="\u{1F6A8} Access Terminated: Security Violation",e="Your application session has been terminated by enterprise security policy due to an active environment threat.",t){if(typeof document>"u"||!document.body||typeof document.getElementById!="function")return;g.lastTitle=i,g.lastMessage=e,g.lastIncidentId=t,g.isLockoutEnforced=!0;let n=document.getElementById(g.OVERLAY_ELEMENT_ID);if(n){if(!(typeof document.body.contains=="function"?document.body.contains(n):n.parentNode===document.body)){g.isMutating=!0;try{document.body.appendChild(n)}catch{}finally{g.isMutating=!1}}g.ensureOverlayStyles(n)}else{n=document.createElement("div"),n.id=g.OVERLAY_ELEMENT_ID,n.style.cssText="position:fixed!important;top:0!important;left:0!important;width:100vw!important;height:100vh!important;background:#0B0F19!important;color:#F8FAFC!important;z-index:2147483647!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;text-align:center!important;padding:24px!important;box-sizing:border-box!important;font-family:system-ui,sans-serif!important;user-select:none!important;-webkit-user-select:none!important;pointer-events:auto!important;visibility:visible!important;opacity:1!important;";let r=t||`INC-${Date.now().toString(36).toUpperCase()}-${Math.floor(Math.random()*1e3)}`,o=a((d,u,m)=>{let _=document.createElement(d);return u&&(_.style.cssText=u),m&&(_.textContent=m),_},"mk"),s=o("div","max-width:520px;background:#131B2E;border:1px solid #EF4444;border-radius:16px;padding:36px 28px;box-shadow:0 25px 50px -12px rgba(239,68,68,0.25);");s.appendChild(o("div","font-size:56px;line-height:1;margin-bottom:18px;","\u{1F6E1}\uFE0F")),s.appendChild(o("h1","color:#F87171;font-size:20px;font-weight:800;margin:0 0 12px 0;",i)),s.appendChild(o("p","color:#94A3B8;font-size:13px;line-height:1.6;margin:0 0 24px 0;",e));let c=o("div","background:#0B0F19;border:1px solid #1E293B;border-radius:8px;padding:12px;margin-bottom:24px;text-align:left;"),l=a((d,u,m)=>{let _=o("div","color:#64748B;font-size:11px;font-family:monospace;margin-bottom:4px;");_.appendChild(o("span","",d+": ")),_.appendChild(o("span",`color:${m};`,u)),c.appendChild(_)},"addRow");l("INCIDENT ID",r,"#00E5FF"),l("TIMESTAMP",new Date().toISOString(),"#94A3B8"),l("ENFORCEMENT","BLOCK_TERMINATE","#EF4444"),s.appendChild(c),s.appendChild(o("div","font-size:11px;color:#475569;font-weight:500;","Protected by SecureShield Enterprise Defense")),n.appendChild(s),g.isMutating=!0;try{document.body.appendChild(n),document.body.style.setProperty("overflow","hidden","important")}catch{}finally{g.isMutating=!1}}if(g.attachObservers(n),!g.isCapturingEvents&&typeof window<"u"){for(let r of g.EVTS)window.addEventListener(r,g.eventSuppressor,!0);g.isCapturingEvents=!0}}static attachObservers(i){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement||document.body;if(e&&!g.bodyObserver&&(g.bodyObserver=new MutationObserver(()=>{if(g.isMutating||!g.isLockoutEnforced)return;let t=document.getElementById(g.OVERLAY_ELEMENT_ID);if(document.documentElement){let o=document.documentElement;(o.style.display==="none"||o.style.visibility==="hidden"||o.style.opacity==="0")&&(o.style.setProperty("display","block","important"),o.style.setProperty("visibility","visible","important"),o.style.setProperty("opacity","1","important"))}if(document.body){let o=document.body;(o.style.display==="none"||o.style.visibility==="hidden"||o.style.opacity==="0")&&(o.style.setProperty("display","block","important"),o.style.setProperty("visibility","visible","important"),o.style.setProperty("opacity","1","important"))}let n=t?t.parentNode:null;if(t&&(n===document.body||n===document.documentElement||(document.contains?document.contains(t):!1)))t&&g.ensureOverlayStyles(t);else{g.isMutating=!0;try{g.renderLockoutOverlay(g.lastTitle,g.lastMessage,g.lastIncidentId)}finally{g.isMutating=!1}}}),g.bodyObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden"]}),document.body&&document.documentElement&&e!==document.body))try{g.bodyObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden"]})}catch{}g.overlayObserver&&g.overlayObserver.disconnect(),g.overlayObserver=new MutationObserver(()=>{if(g.isMutating||!g.isLockoutEnforced)return;let t=document.getElementById(g.OVERLAY_ELEMENT_ID);t&&g.ensureOverlayStyles(t)}),g.overlayObserver.observe(i,{attributes:!0,attributeFilter:["style","class","hidden","inert","popover"]})}static ensureOverlayStyles(i){if(!g.isMutating&&!(i.style.display==="flex"&&i.style.visibility==="visible"&&i.style.opacity==="1"&&i.style.zIndex==="2147483647"&&!i.hasAttribute("hidden")&&!i.hasAttribute("inert")&&!i.hasAttribute("popover")&&(!document.body||document.body.style.overflow==="hidden"))){g.isMutating=!0;try{let e=i.style;e.setProperty("display","flex","important"),e.setProperty("visibility","visible","important"),e.setProperty("opacity","1","important"),e.setProperty("position","fixed","important"),e.setProperty("top","0px","important"),e.setProperty("left","0px","important"),e.setProperty("width","100vw","important"),e.setProperty("height","100vh","important"),e.setProperty("z-index","2147483647","important"),e.setProperty("pointer-events","auto","important"),i.hasAttribute("hidden")&&i.removeAttribute("hidden"),i.hasAttribute("inert")&&i.removeAttribute("inert"),i.hasAttribute("popover")&&i.removeAttribute("popover"),document.body&&document.body.style.overflow!=="hidden"&&document.body.style.setProperty("overflow","hidden","important")}finally{g.isMutating=!1}}}static dismissLockoutOverlay(){if(g.isLockoutEnforced=!1,g.bodyObserver&&(g.bodyObserver.disconnect(),g.bodyObserver=null),g.overlayObserver&&(g.overlayObserver.disconnect(),g.overlayObserver=null),typeof document<"u"&&typeof document.getElementById=="function"){g.isMutating=!0;try{let i=document.getElementById(g.OVERLAY_ELEMENT_ID);i&&i.parentNode&&i.parentNode.removeChild(i),document.body&&(document.body.style.overflow="")}finally{g.isMutating=!1}}if(g.isCapturingEvents&&typeof window<"u"){for(let i of g.EVTS)window.removeEventListener(i,g.eventSuppressor,!0);g.isCapturingEvents=!1}}static isLockoutActive(){if(typeof document>"u"||typeof document.getElementById!="function")return!1;let i=!!document.getElementById(g.OVERLAY_ELEMENT_ID);return!i&&g.isLockoutEnforced?(g.renderLockoutOverlay(g.lastTitle,g.lastMessage,g.lastIncidentId),!0):i}};a(g,"SecurityLockoutOverlay"),p(g,"OVERLAY_ELEMENT_ID","secureshield_lockout_overlay"),p(g,"EVTS",["click","dblclick","mousedown","mouseup","keydown","keyup","keypress","touchstart","touchend","contextmenu"]),p(g,"isCapturingEvents",!1),p(g,"isLockoutEnforced",!1),p(g,"isMutating",!1),p(g,"bodyObserver",null),p(g,"overlayObserver",null),p(g,"lastTitle","\u{1F6A8} Access Terminated: Security Violation"),p(g,"lastMessage","Your application session has been terminated by enterprise security policy due to an active environment threat."),p(g,"lastIncidentId"),p(g,"eventSuppressor",a(i=>{i.stopPropagation(),i.preventDefault()},"eventSuppressor"));var Te=g;var An=class An{constructor(i){p(this,"options");this.options={blockRedirectUrl:i?.blockRedirectUrl!==void 0?i.blockRedirectUrl:"/access-blocked",enableDomLockoutOverlay:i?.enableDomLockoutOverlay??!0,onRemediationTriggered:i?.onRemediationTriggered,onWipeKeys:i?.onWipeKeys,requireSignature:i?.requireSignature??!1}}async wipeLocalKeys(){try{await F.clearVault()}catch(i){console.warn("[SecureShield] Error purging IndexedDB vault:",i.message)}try{typeof sessionStorage<"u"&&sessionStorage.clear()}catch(i){console.warn("[SecureShield] Error clearing sessionStorage:",i.message)}try{if(typeof localStorage<"u"){let i=[];for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);t&&(t.startsWith("secureshield_")||t.startsWith("auth_")||t.startsWith("jwt")||t.includes("token")||t.startsWith("session_"))&&i.push(t)}for(let e of i)localStorage.removeItem(e)}}catch(i){console.warn("[SecureShield] Error clearing localStorage credentials:",i.message)}try{this.options.onWipeKeys?.()}catch(i){console.warn("[SecureShield] Error in onWipeKeys callback:",i.message)}}async handleDecisionAction(i,e,t=!1){if(!i||typeof i!="string")return{action:"NONE",enforced:!1};if(this.options.requireSignature&&!t)throw new Error("[SecureShield Security Error] Server remediation directive requires verified cryptographic signature.");let n=i.toUpperCase().trim();if(n==="PAUSED")return console.warn("[SecureShield] OVER-THE-AIR POLICY: SDK Enforcement and Probes have been PAUSED by System Admin."),this.options.onRemediationTriggered?.("PAUSED",e||"SDK Paused by Admin Policy"),{action:"PAUSED",enforced:!0,details:"SDK probe execution suspended by Admin"};if(n==="WIPE_LOCAL_KEYS")return console.warn("[SecureShield] CRITICAL REMEDIATION: Wiping local cryptographic keys and cached session tokens."),await this.wipeLocalKeys(),this.options.onRemediationTriggered?.("WIPE_LOCAL_KEYS",e||"Threat detected: local keys wiped"),{action:"WIPE_LOCAL_KEYS",enforced:!0,details:"IndexedDB vault and session storage credentials wiped"};if(n==="TERMINATE_APP"||n==="BLOCK_DEVICE"||n==="BLOCK_ACTION"){if(console.error(`[SecureShield CRITICAL] THREAT REMEDIATION TRIGGERED (${n}). Terminating application session.`),await this.wipeLocalKeys(),this.options.onRemediationTriggered?.(n,e||`Critical threat detected: ${n}`),this.options.enableDomLockoutOverlay!==!1&&Te.renderLockoutOverlay("\u{1F6A8} Access Blocked: Security Violation",e||"Your application session has been terminated by enterprise policy due to a security violation."),this.options.blockRedirectUrl&&typeof window<"u"&&window.location)try{typeof window.location.replace=="function"?window.location.replace(this.options.blockRedirectUrl):window.location.href=this.options.blockRedirectUrl}catch{}return{action:n,enforced:!0,details:`App session terminated and blocked (${n})`}}return{action:n,enforced:!1,details:"Normal execution continued"}}};a(An,"RemediationManager");var Ae=An;var h=class h{static enable(i){h.activeSubscribers++,h.activeOptions={blurFilter:i?.blurFilter||"blur(20px)",maskMessage:i?.maskMessage||"\u{1F6E1}\uFE0F Session Obscured for Privacy",maskSubtitle:i?.maskSubtitle||"Return to tab to resume active session",listenToWindowBlur:i?.listenToWindowBlur??!1,customOverlayId:i?.customOverlayId||h.DEFAULT_OVERLAY_ID},!h.isListening&&(typeof document<"u"&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",h.onVisibilityChangeHandler),typeof window<"u"&&typeof window.addEventListener=="function"&&h.activeOptions.listenToWindowBlur&&(window.addEventListener("blur",h.onWindowBlurHandler),window.addEventListener("focus",h.onWindowFocusHandler)),h.isListening=!0)}static disable(i=!1){h.activeSubscribers>0&&!i&&h.activeSubscribers--,!(h.activeSubscribers>0&&!i)&&(h.activeSubscribers=0,typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",h.onVisibilityChangeHandler),typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("blur",h.onWindowBlurHandler),window.removeEventListener("focus",h.onWindowFocusHandler)),h.unmask(),h.isListening=!1)}static isListenerActive(){return h.isListening}static getActiveSubscribers(){return h.activeSubscribers}static mask(){if(typeof document>"u"||!document.body||typeof document.getElementById!="function"){h.isCurrentlyMasked=!0;return}let i=h.activeOptions.customOverlayId||h.DEFAULT_OVERLAY_ID;if(document.getElementById(i))return;let e=document.createElement("div");e.id=i,e.style.cssText=`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100vw;
6
+ height: 100vh;
7
+ background: rgba(11, 15, 25, 0.88);
8
+ backdrop-filter: ${h.activeOptions.blurFilter||"blur(20px)"};
9
+ -webkit-backdrop-filter: ${h.activeOptions.blurFilter||"blur(20px)"};
10
+ z-index: 2147483646;
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: center;
14
+ justify-content: center;
15
+ color: #F8FAFC;
16
+ text-align: center;
17
+ padding: 20px;
18
+ box-sizing: border-box;
19
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
20
+ user-select: none;
21
+ -webkit-user-select: none;
22
+ transition: opacity 0.15s ease-in-out;
23
+ `;let t=document.createElement("div");t.style.cssText="background: rgba(19, 27, 46, 0.9); border: 1px solid rgba(0, 229, 255, 0.3); border-radius: 14px; padding: 28px 24px; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,0.5);";let n=document.createElement("div");n.style.cssText="font-size: 42px; margin-bottom: 12px;",n.textContent="\u{1F6E1}\uFE0F";let r=document.createElement("h3");r.style.cssText="margin: 0 0 8px 0; font-size: 16px; font-weight: 700; color: #38BDF8;",r.textContent=h.activeOptions.maskMessage||"\u{1F6E1}\uFE0F Session Obscured for Privacy";let o=document.createElement("p");o.style.cssText="margin: 0; font-size: 12px; color: #94A3B8;",o.textContent=h.activeOptions.maskSubtitle||"Return to tab to resume active session",t.appendChild(n),t.appendChild(r),t.appendChild(o),e.appendChild(t);try{document.body.appendChild(e)}catch{}h.isCurrentlyMasked=!0}static unmask(){if(typeof document<"u"&&typeof document.getElementById=="function"){let i=h.activeOptions.customOverlayId||h.DEFAULT_OVERLAY_ID,e=document.getElementById(i);e&&e.parentNode&&e.parentNode.removeChild(e)}h.isCurrentlyMasked=!1}static isMasked(){return h.isCurrentlyMasked}static isEnabled(){return h.isListening}};a(h,"TabBlurShield"),p(h,"DEFAULT_OVERLAY_ID","secureshield_tab_privacy_shield"),p(h,"activeOptions",{}),p(h,"isListening",!1),p(h,"isCurrentlyMasked",!1),p(h,"activeSubscribers",0),p(h,"onVisibilityChangeHandler",a(()=>{typeof document>"u"||(document.hidden?h.mask():h.unmask())},"onVisibilityChangeHandler")),p(h,"onWindowBlurHandler",a(()=>{h.activeOptions.listenToWindowBlur&&h.mask()},"onWindowBlurHandler")),p(h,"onWindowFocusHandler",a(()=>{typeof document<"u"&&!document.hidden&&h.unmask()},"onWindowFocusHandler"));var ge=h;var ne=class ne{static renderSecurityWatermark(i="SECURESHIELD CONFIDENTIAL",e){if(typeof document>"u"||!document.body||typeof document.getElementById!="function")return;let t=e?.elementId||ne.DEFAULT_WATERMARK_ID;document.getElementById(t)&&ne.removeSecurityWatermark(t);let n=e?.opacity??.08,r=e?.color||"#00E5FF",o=e?.fontSize||14,s=`
24
+ <svg xmlns="http://www.w3.org/2000/svg" width="300" height="150" viewBox="0 0 300 150">
25
+ <text x="50%" y="50%" fill="${r}" font-family="monospace" font-size="${o}" font-weight="bold" text-anchor="middle" transform="rotate(-25 150 75)" opacity="${n}">
26
+ ${i}
27
+ </text>
28
+ </svg>
29
+ `,c=typeof btoa=="function"?btoa(unescape(encodeURIComponent(s))):"",l=document.createElement("div");l.id=t,l.style.cssText=`
30
+ position: fixed;
31
+ top: 0;
32
+ left: 0;
33
+ width: 100vw;
34
+ height: 100vh;
35
+ pointer-events: none;
36
+ user-select: none;
37
+ -webkit-user-select: none;
38
+ z-index: 2147483645;
39
+ background-repeat: repeat;
40
+ background-image: url('data:image/svg+xml;base64,${c}');
41
+ `;try{document.body.appendChild(l)}catch{}}static removeSecurityWatermark(i=ne.DEFAULT_WATERMARK_ID){if(typeof document<"u"&&typeof document.getElementById=="function"){let e=document.getElementById(i);e&&e.parentNode&&e.parentNode.removeChild(e)}}static protectFormFields(i){if(!(typeof document>"u"||typeof document.querySelectorAll!="function"))try{let e=i?document.querySelector(i):document;if(!e)return;e.querySelectorAll("input, textarea").forEach(n=>{n.setAttribute("autocomplete","off"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),n.setAttribute("data-secureshield-hardened","true")})}catch{}}};a(ne,"SecureUiHardening"),p(ne,"DEFAULT_WATERMARK_ID","secureshield_security_watermark");var Oe=ne;var S=class S{static scanForPlaintextLeaks(){let i=[],e=0,t=a((n,r)=>{if(!(typeof n>"u"))try{for(let o=0;o<n.length;o++){let s=n.key(o);if(!s)continue;e++;let c=S.evaluatePotentialLeak(s,n.getItem(s)||"");if(c){let l="credential";c.includes("JWT")||c.includes("Bearer")||/token/i.test(s)?l="token":c.includes("private key")||/key/i.test(s)?l="key":/pass(?:word|wd)/i.test(s)?l="password":(/secret/i.test(s)||c.includes("hex secret"))&&(l="secret"),i.push({storage:r,key:s,reason:c,namespace:r,category:l})}}}catch{}},"audit");return typeof localStorage<"u"&&t(localStorage,"localStorage"),typeof sessionStorage<"u"&&t(sessionStorage,"sessionStorage"),{leaksFound:i.length,leakingKeys:i,inspectedCount:e}}static purgePlaintextLeaks(i=[]){let e=S.scanForPlaintextLeaks(),t=new Set(i.map(n=>n.toLowerCase()));for(let n of e.leakingKeys)if(!t.has(n.key.toLowerCase()))try{let r=n.storage==="localStorage"?typeof localStorage<"u"?localStorage:null:typeof sessionStorage<"u"?sessionStorage:null;r&&(r.removeItem(n.key),console.warn(`[SecureShield] StorageScrubber purged unencrypted secret from ${n.storage}: '${n.key}' (${n.reason})`))}catch{}return e}static wipeVolatileStorage(){if(typeof sessionStorage<"u")try{sessionStorage.clear()}catch{}}static evaluatePotentialLeak(i,e){if(!i||typeof i!="string"||i==="secureshield_auth_vault"||i.startsWith("secureshield_"))return null;let t=(e||"").trim();if(!t||t==="true"||t==="false"||t==="null"||t==="undefined"||S.UUID_REGEX.test(t))return null;if(S.JWT_REGEX.test(t))return"Plaintext JWT token structure detected in storage value";if(S.BEARER_REGEX.test(t))return"Plaintext Bearer authorization credential detected in storage value";if(S.PEM_REGEX.test(t))return"Plaintext private key PEM structure detected in storage value";if(S.HEX64_REGEX.test(t)&&!S.SAFE_KEY_REGEX.test(i))return"256-bit raw hex secret key detected in storage value";if(S.API_KEY_REGEX.test(t))return"Plaintext API credential or secret pattern detected in storage value";if(S.SAFE_KEY_REGEX.test(i))return null;if(S.SENSITIVE_KEY_REGEX.test(i)){if(/(?:pass(?:word|wd)|pin)/i.test(i)){if(t.length>=4)return`Storage key name '${i}' contains unencrypted credential secret`}else if(t.length>=8&&!/^\d+$/.test(t))return`Storage key name '${i}' contains unencrypted credential secret`}return null}};a(S,"StorageScrubber"),p(S,"UUID_REGEX",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),p(S,"JWT_REGEX",/^eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{3,}\.[A-Za-z0-9_-]*$/),p(S,"BEARER_REGEX",/^Bearer\s+[A-Za-z0-9\-._~+/%=]{12,}$/i),p(S,"PEM_REGEX",/-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/),p(S,"HEX64_REGEX",/^[A-Fa-f0-9]{64}$/),p(S,"API_KEY_REGEX",/^(?:sk|pk)_(?:live|test)_[a-zA-Z0-9]{16,}|(?:secret|password|passwd)[._-]/i),p(S,"SENSITIVE_KEY_REGEX",/(?:access[._-]?token|refresh[._-]?token|id[._-]?token|auth[._-]?token|bearer(?:[._-]?token)?|session[._-]?(?:id|key|token)|api[._-]?key|private[._-]?key|(?:^|[._-]|[a-z])secret(?!ary|ariat|ion)(?:$|[._-]|key|token|data|code)?|(?:^|[._-]|[a-z])pass(?:word|wd)(?!hint)(?:$|[._-]|hash|salt)?|(?:^|[._-]|[a-z])pin(?:[._-]?code)?(?!count)(?:$|[._-])|credentials?|oauth(?:[._-]?token)?|(?:^|[._-]|[a-z])jwt(?:[._-]?token)?)/i),p(S,"SAFE_KEY_REGEX",/(?:^|[._-]|[a-z])(?:theme|color|design|style|ui|cart|checkout|pagination|cursor|next|previous|count|type|length|status|indicator|state|dismissed|closed|present|mode|version|author|authority|checksum|hash|etag|digest|santa|offset|hint)(?:$|[._-]|[A-Z])/i);var N=S;var yn=Function.prototype.toString,Kr=Object.defineProperty,pr=Object.freeze,jr=Object.getOwnPropertyDescriptor;var Hr=JSON.stringify,Vr=Date.now,ie=class ie{static isNativeFunction(i){if(typeof i!="function")return!1;try{let e=yn.call(i);if(!(ie.NATIVE_CODE_REGEX.test(e.trim())||e.includes("[native code]")))return!1;if(Object.prototype.hasOwnProperty.call(i,"toString")){let n=i.toString;if(n!==yn&&!yn.call(n).includes("[native code]"))return!1}return!0}catch{return!1}}static freezePrototypes(i){let e;i&&i.length>0?e=i.map((r,o)=>({name:`target_${o}`,obj:r})):e=[{name:"Function.prototype",obj:typeof Function<"u"?Function.prototype:null},{name:"Array.prototype",obj:typeof Array<"u"?Array.prototype:null},{name:"String.prototype",obj:typeof String<"u"?String.prototype:null},{name:"Date.prototype",obj:typeof Date<"u"?Date.prototype:null},{name:"Promise.prototype",obj:typeof Promise<"u"?Promise.prototype:null},{name:"crypto.subtle",obj:typeof crypto<"u"?crypto.subtle:null}];let t=0,n=[];for(let r of e)if(r.obj)try{pr(r.obj)?t++:n.push(`Failed to freeze ${r.name}`)}catch(o){n.push(`Error freezing ${r.name}: ${o.message}`)}return{frozenCount:t,errors:n}}static createTamperProofProxy(i,e="SecureShieldObject",t){return typeof Proxy>"u"?i:new Proxy(i,{get(n,r,o){let s=n[r];return typeof s=="function"?s.bind(n):s},set(n,r,o,s){let c=String(r),l=`[SecureShield INTEGRITY VIOLATION] Unauthorized property mutation blocked on '${e}.${c}'`;return console.warn(l),t?.("SET_PROPERTY",c),!1},defineProperty(n,r,o){let s=String(r),c=`[SecureShield INTEGRITY VIOLATION] Unauthorized Object.defineProperty blocked on '${e}.${s}'`;return console.warn(c),t?.("DEFINE_PROPERTY",s),!1},deleteProperty(n,r){let o=String(r),s=`[SecureShield INTEGRITY VIOLATION] Unauthorized property deletion blocked on '${e}.${o}'`;return console.warn(s),t?.("DELETE_PROPERTY",o),!1},setPrototypeOf(n,r){let o=`[SecureShield INTEGRITY VIOLATION] Prototype chain alteration blocked on '${e}'`;return console.warn(o),t?.("SET_PROTOTYPE_OF","__proto__"),!1}})}static auditRuntimeIntegrity(){let i=[{name:"JSON.stringify",fn:typeof JSON<"u"?JSON.stringify:null},{name:"Object.defineProperty",fn:typeof Object<"u"?Object.defineProperty:null},{name:"Object.freeze",fn:typeof Object<"u"?Object.freeze:null},{name:"Function.prototype.toString",fn:typeof Function<"u"?Function.prototype.toString:null},{name:"Date.now",fn:typeof Date<"u"?Date.now:null}],e=[],t=0;for(let n of i){if(!n.fn)continue;t++,ie.isNativeFunction(n.fn)||e.push({apiName:n.name,isNative:!1,reason:`Function '${n.name}' string representation or prototype origin indicates an active userland hook or proxy.`})}return{isClean:e.length===0,tamperedCount:e.length,tamperedApis:e,auditedCount:t}}};a(ie,"RuntimeIntegrityGuardian"),p(ie,"NATIVE_CODE_REGEX",/^function\s*([a-zA-Z0-9_$]*)\s*\(\)\s*\{\s*\[native code\]\s*\}$/),p(ie,"pristine",{toString:yn,defineProperty:Kr,freeze:pr,getOwnPropertyDescriptor:jr,stringify:Hr,now:Vr});var A=ie;var On=class On{static scan(){let i=!1,e={};try{if(typeof window<"u"&&typeof window.outerWidth=="number"&&typeof window.innerWidth=="number"){let n=window.outerWidth-window.innerWidth,r=window.outerHeight-window.innerHeight;(n>160||r>160)&&(i=!0,e.window_delta=`widthDiff:${n}, heightDiff:${r}`)}if(typeof Image<"u"){let t=new Image;Object.defineProperty(t,"id",{get:a(function(){return i=!0,e.console_getter_trap="active","devtools"},"get")})}}catch(t){e.error=t.message}return{id:"browser_devtools_detector",triggered:i,severity:i?3:0,category:"environment",event:"browser_devtools_open",evidence:e}}};a(On,"DevToolsDetector");var Ce=On;var Cn=class Cn{static scan(){let i=!1,e={};if(typeof navigator<"u"&&navigator.webdriver&&(i=!0,e.navigator_webdriver="true"),typeof window<"u"){let t=window;(t.callPhantom||t._phantom||t.__nightmare||t.domAutomation||t.domAutomationController)&&(i=!0,e.automation_global="detected")}return typeof navigator<"u"&&(!navigator.languages||navigator.languages.length===0)&&(i=!0,e.empty_languages="true"),{id:"headless_browser_detector",triggered:i,severity:i?4:0,category:"environment",event:"headless_puppeteer_selenium_detected",evidence:e}}};a(Cn,"HeadlessBrowserDetector");var Re=Cn;var Rn=class Rn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"HTML5 Canvas 2D & WebGL Renderer Hash",probe_technique:"canvas_webgl_rendering_entropy_audit",expected_value:"Consistent GPU rendering pipeline across Canvas and WebGL contexts",threat_classification:"Synthetic Canvas / WebGL Fingerprint Spoofing Active",remediation_guidance:"Enforce authentic hardware GPU rendering parameters"},t=!1,n="Canvas & WebGL GPU rendering hashes consistent";try{let r=document.createElement("canvas"),o=r.getContext("webgl")||r.getContext("experimental-webgl");if(o){let s=o.getExtension("WEBGL_debug_renderer_info");if(s){let c=o.getParameter(s.UNMASKED_RENDERER_WEBGL);(c.includes("SwiftShader")||c.includes("llvmpipe")||c.includes("Software Rasterizer"))&&(t=!0,n=`Software WebGL Renderer: ${c}`)}}}catch(r){n=`Fingerprint audit error: ${r.message}`}return e.actual_value=n,t||(e.remediation_guidance="No action required. Hardware GPU pipeline verified."),{id:"browser_fingerprint_consistency_detector",triggered:t,severity:t?3:0,category:"environment",event:t?"fingerprint_spoof_detected":"fingerprint_verified",evidence:e}}};a(Rn,"BrowserFingerprintDetector");var ke=Rn;var kn=class kn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"UserAgentData Client Hints vs UserAgent Major Version",probe_technique:"client_hints_and_ua_version_cross_audit"},t=!1,n=[];try{if(typeof navigator<"u"){let r=navigator.userAgent||"",o=navigator,s=null,c=r.match(/Chrome\/(\d+)\./i),l=r.match(/Firefox\/(\d+)\./i),d=r.match(/Version\/(\d+)\./i);if(c?s=parseInt(c[1],10):l?s=parseInt(l[1],10):d&&(s=parseInt(d[1],10)),e.extracted_ua_major_version=s,o.userAgentData&&o.userAgentData.brands){let u=o.userAgentData.brands;e.client_hints_brands=JSON.stringify(u);let m=u.find(_=>/Chromium|Google Chrome|Microsoft Edge/i.test(_.brand));if(m&&s!==null){let _=parseInt(m.version,10);!isNaN(_)&&Math.abs(_-s)>2&&(t=!0,n.push(`Version contradiction: User-Agent reports v${s} but Client Hints brand '${m.brand}' reports v${_}`))}if(o.userAgentData.platform){let _=o.userAgentData.platform.toLowerCase(),E=r.toLowerCase();_.includes("win")&&(E.includes("macintosh")||E.includes("android")||E.includes("iphone"))?(t=!0,n.push(`Platform contradiction: Client Hints says '${_}' but User-Agent says non-Windows`)):_.includes("mac")&&(E.includes("windows")||E.includes("android"))&&(t=!0,n.push(`Platform contradiction: Client Hints says '${_}' but User-Agent says non-macOS`))}}}e.detected_version_anomalies=n,e.actual_value=t?`Browser version or platform contradiction detected (${n.length}): ${n.slice(0,3).join(", ")}`:"UserAgentData Client Hints verified clean in browser context",e.expected_value="UserAgentData Client Hints and navigator.userAgent must report coherent versions and platforms",e.threat_classification=t?"BROWSER_VERSION_OR_PLATFORM_SPOOFING_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Inspect user agent switcher extensions or automated crawler emulation headers":"No action required. Baseline clean."}catch(r){e.error=`BrowserVersionIntegrityDetector error: ${r.message}`}return{id:"browser_version_integrity_detector",triggered:t,severity:t?3:0,category:"environment",event:t?"browser_version_anomaly_detected":"browser_version_integrity_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Browser Version Integrity Detector",evidence:e}}};a(kn,"BrowserVersionIntegrityDetector");var Pe=kn;var Pn=class Pn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Browser Engine Capabilities vs Reported User-Agent Identity",probe_technique:"engine_feature_matrix_and_vendor_coherence_audit"},t=!1,n=[];try{if(typeof navigator<"u"){let r=(navigator.userAgent||"").toLowerCase(),o=(navigator.vendor||"").toLowerCase(),s=navigator;e.reported_user_agent=r.slice(0,70),e.reported_vendor=o,r.includes("safari")&&!r.includes("chrome")&&!r.includes("chromium")&&!r.includes("android")&&(typeof window<"u"&&window.chrome&&(t=!0,n.push("Safari claimed in UA but window.chrome Blink object is present")),o&&!o.includes("apple")&&(t=!0,n.push(`Safari claimed in UA but navigator.vendor is '${o}' instead of Apple`))),r.includes("firefox")&&(typeof window<"u"&&window.chrome&&(t=!0,n.push("Firefox claimed in UA but window.chrome object is present")),o&&o.length>0&&!o.includes("mozilla")&&(t=!0,n.push(`Firefox claimed in UA but navigator.vendor is '${o}'`))),r.includes("chrome")&&!r.includes("edg")&&!r.includes("opr")&&!r.includes("brave")&&o&&!o.includes("google")&&(t=!0,n.push(`Chrome claimed in UA but navigator.vendor is '${o}' instead of Google Inc.`))}e.detected_capability_anomalies=n,e.actual_value=t?`Browser capability spoofing detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Touch & Pointer Capabilities verified clean in browser context",e.expected_value="Reported browser vendor and User-Agent must correlate with actual engine API primitives",e.threat_classification=t?"BROWSER_CAPABILITY_SPOOFING_OR_HEADLESS_MASQUERADE":"Clean browser environment",e.remediation_guidance=t?"Verify if browser is using an anti-detect profile or automated User-Agent spoofer":"No action required. Baseline clean."}catch(r){e.error=`BrowserCapabilitySpoofingDetector error: ${r.message}`}return{id:"browser_capability_spoofing_detector",triggered:t,severity:t?3:0,category:"environment",event:t?"browser_capability_spoofing_detected":"browser_capability_spoofing_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Browser Capability Spoofing Detector",evidence:e}}};a(Pn,"BrowserCapabilitySpoofingDetector");var Me=Pn;var Mn=class Mn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Navigator Platform vs UserAgent & Property Descriptors",probe_technique:"user_agent_descriptor_and_platform_cross_audit"},t=!1,n=[];try{if(typeof navigator<"u"){let r=(navigator.userAgent||"").toLowerCase(),o=(navigator.platform||"").toLowerCase(),s=(navigator.vendor||"").toLowerCase();if(e.navigator_platform=o,e.navigator_vendor=s,typeof Navigator<"u"&&Navigator.prototype&&navigator instanceof Navigator){let c=Object.getOwnPropertyDescriptor(navigator,"userAgent");c&&(c.get||Object.prototype.hasOwnProperty.call(navigator,"userAgent"))&&(t=!0,n.push("navigator.userAgent has instance-level shadow property override"));let l=Object.getOwnPropertyDescriptor(Navigator.prototype,"userAgent");if(l&&l.get){let d=Function.prototype.toString.call(l.get);!d.includes("[native code]")&&!d.includes("function ()")&&(t=!0,n.push("Navigator.prototype.userAgent getter is not a native C++ function"))}}o.includes("win")&&(r.includes("iphone")||r.includes("ipad")||r.includes("android"))?(t=!0,n.push(`Platform contradiction: navigator.platform is '${o}' but User-Agent claims mobile device`)):o.includes("iphone")&&!r.includes("iphone")?(t=!0,n.push(`Platform contradiction: navigator.platform is '${o}' but User-Agent claims non-iPhone`)):o.includes("mac")&&r.includes("windows nt")&&(t=!0,n.push(`Platform contradiction: navigator.platform is '${o}' but User-Agent claims Windows`))}e.detected_ua_anomalies=n,e.actual_value=t?`User-Agent tampering or platform contradiction detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Navigator Platform vs UserAgent verified clean in browser context",e.expected_value="navigator.userAgent and navigator.platform must be unhooked and mutually consistent",e.threat_classification=t?"USER_AGENT_TAMPERING_OR_PLATFORM_SPOOFING_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Disable User-Agent switcher extensions or inspect anti-detect browser configurations":"No action required. Baseline clean."}catch(r){e.error=`UserAgentTamperingDetector error: ${r.message}`}return{id:"user_agent_tampering_detector",triggered:t,severity:t?4:0,category:"environment",event:t?"user_agent_tampering_detected":"user_agent_tampering_detector_verified",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"User-Agent Tampering Detector",evidence:e}}};a(Mn,"UserAgentTamperingDetector");var Le=Mn;var Ln=class Ln{static scan(){return{id:"navigator_property_integrity_detector",triggered:!1,severity:0,category:"environment",event:"navigator_property_integrity_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Navigator Property Getters",probe_technique:"property_descriptor_getter_audit",actual_value:"Navigator Property Getters verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Ln,"NavigatorPropertyIntegrityDetector");var Ne=Ln;var Gr=Date.now(),fr=typeof performance<"u"&&performance.now?performance.now():0,P=class P{static setServerTimeAnchor(i){P.serverAnchorTimeMs=i,P.serverAnchorPerfMs=typeof performance<"u"&&performance.now?performance.now():0}static scan(i){let e=Date.now().toString(),t=i?.maxAllowedDriftMs??300*1e3,n={scan_timestamp_ms:e,probe_target:"Wall-Clock Date.now() vs Monotonic performance.now() & Server NTP Anchor",probe_technique:"monotonic_time_delta_drift_audit",max_allowed_drift_ms:t},r=!1,o=[],s=Date.now(),c=typeof performance<"u"&&performance.now?performance.now():0;try{if(s<17040672e5&&(r=!0,o.push(`Retroactive wall clock detected: timestamp ${s} is prior to year 2024`)),s>2147483647e3&&(r=!0,o.push(`Excessive future wall clock detected: timestamp ${s} exceeds year 2038`)),fr>0&&c>0){let l=s-Gr,d=c-fr,u=Math.abs(l-d);n.session_elapsed_wall_clock_ms=l,n.session_elapsed_monotonic_ms=d.toFixed(2),n.session_time_drift_ms=u.toFixed(2),u>t&&(r=!0,o.push(`Client clock jumped/rewound by ${(u/1e3).toFixed(1)}s during session (threshold: ${t/1e3}s)`))}if(P.serverAnchorTimeMs!==null&&P.serverAnchorPerfMs!==null&&c>0){let l=c-P.serverAnchorPerfMs,d=P.serverAnchorTimeMs+l,u=Math.abs(s-d);n.server_anchor_timestamp_ms=P.serverAnchorTimeMs,n.server_anchored_skew_ms=u.toFixed(2),u>t&&(r=!0,o.push(`Client clock skewed from server time by ${(u/1e3).toFixed(1)}s (threshold: ${t/1e3}s)`))}n.time_anomalies=o,n.actual_value=r?`System time manipulation or severe clock skew detected: ${o.join("; ")}`:"Wall-clock and monotonic execution timers synchronized within acceptable drift tolerance",n.expected_value="Client system clock must match monotonic progress within 5 minutes tolerance",n.threat_classification=r?"SYSTEM_CLOCK_TAMPERING_OR_REPLAY_RISK":"Synchronized client time environment",n.remediation_guidance=r?"Verify client system clock synchronization with network time (NTP) to prevent session token validation errors":"No action required. System clock synchronized."}catch(l){n.error=`TimeManipulationDetector error: ${l.message}`}return{id:"time_manipulation_detector",triggered:r,severity:r?2:0,category:"environment",event:r?"web_time_skew_detected":"web_time_skew_verified_clean",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:r?"FAILED":"PASSED",name:"Time Manipulation Detector",evidence:n}}};a(P,"TimeManipulationDetector"),p(P,"serverAnchorTimeMs",null),p(P,"serverAnchorPerfMs",null);var Be=P;var Nn=class Nn{static scan(){return{id:"browser_automation_environment_detector",triggered:!1,severity:0,category:"environment",event:"browser_automation_environment_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Selenium/PhantomJS/Nightwatch",probe_technique:"automation_flag_window_audit",actual_value:"Selenium/PhantomJS/Nightwatch verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Nn,"AutomationEnvironmentDetector");var Ue=Nn;var qr=[/swiftshader/i,/llvmpipe/i,/softpipe/i,/virtualbox/i,/vmware/i,/mesa offscreen/i,/microsoft basic render/i],Bn=class Bn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Virtual Cloud Browser Container & Virtual GPU Drivers",probe_technique:"virtual_render_context_and_webgl_vendor_audit"},t=!1,n=[];try{if(typeof document<"u"){let o=document.createElement("canvas"),s=o.getContext("webgl")||o.getContext("experimental-webgl");if(s&&s.getExtension){let c=s.getExtension("WEBGL_debug_renderer_info");if(c){let l=s.getParameter(c.UNMASKED_RENDERER_WEBGL)||"",d=s.getParameter(c.UNMASKED_VENDOR_WEBGL)||"";e.unmasked_renderer=l,e.unmasked_vendor=d;for(let u of qr)(u.test(l)||u.test(d))&&(t=!0,n.push(`Virtual/Software GPU detected: ${l} (${d})`))}}}let r=[typeof window<"u"?window:null,typeof globalThis<"u"?globalThis:null].filter(Boolean);for(let o of r)if(o.__nightmare||o._phantom||o.callPhantom||o.__sauce_stats){t=!0,n.push("Cloud browser automation framework variables detected in global scope");break}e.detected_virtual_indicators=n,e.actual_value=t?`Virtual browser or cloud isolation container detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Virtual Cloud Browser Container verified clean in browser context",e.expected_value="Session must execute on physical hardware devices with genuine hardware-accelerated GPUs",e.threat_classification=t?"VIRTUAL_CONTAINER_OR_CLOUD_EMULATION_DETECTED":"Physical browser hardware environment",e.remediation_guidance=t?"Verify if client session is running inside a cloud VM, automated sandbox, or container":"No action required. Baseline clean."}catch(r){e.error=`VirtualBrowserDetector error: ${r.message}`}return{id:"virtual_browser_environment_detector",triggered:t,severity:t?2:0,category:"environment",event:t?"virtual_browser_detected":"virtual_browser_environment_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Virtual Browser Environment Detector",evidence:e}}};a(Bn,"VirtualBrowserDetector");var $e=Bn;var Un={};try{if(typeof console<"u"){let f=["log","warn","error","debug","info","trace","table"];for(let i of f)console[i]&&(Un[i]=console[i])}}catch{}var $n=class $n{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Global window.console (log, warn, error, debug, info)",probe_technique:"native_code_signature_and_reference_audit"},t=!1,n=[];try{if(typeof console>"u")t=!0,n.push("console (Global object completely undefined or stripped)");else{let r=["log","warn","error","debug","info"];for(let o of r){let s=console[o];if(!s){t=!0,n.push(`console.${o} (Method missing/deleted)`);continue}Un[o]&&s!==Un[o]&&(t=!0,n.push(`console.${o} (Reference mutated after SDK baseline capture)`)),A.isNativeFunction(s)||(t=!0,n.push(`console.${o} (Non-native implementation / wrapped closure)`)),Object.prototype.hasOwnProperty.call(s,"toString")&&(t=!0,n.push(`console.${o} (Custom shadow toString override detected)`))}}e.tampered_methods=n,e.actual_value=t?`Console tampering detected: ${n.join(", ")}`:"All console methods verified native and unaltered",e.expected_value="Standard console logging methods must retain native browser implementations",e.threat_classification=t?"CONSOLE_OBJECT_TAMPERING_OR_SILENCING":"Clean console logging environment",e.remediation_guidance=t?"Inspect third-party scripts or extensions that intercept console telemetry, or configure disabledDetectors if intentionally stripped":"No action required. Console methods verified clean."}catch(r){e.error=`ConsoleTamperingDetector error: ${r.message}`}return{id:"console_tampering_detector",triggered:t,severity:t?2:0,category:"code",event:t?"console_object_tampered":"console_object_verified_clean",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:t?"FAILED":"PASSED",name:"Console Tampering Detector",evidence:e}}};a($n,"ConsoleTamperingDetector");var Fe=$n;var Fn=class Fn{static scan(){let i=!1,e={};try{document.querySelectorAll('input[type="password"], input[type="credit-card"]').forEach(n=>{let r=n;r.getAttribute("autocomplete")==="off"&&r.dataset.tampered==="true"&&(i=!0,e.input_tampered=r.name||r.id)})}catch(t){e.error=t.message}return{id:"dom_tampering_detector",triggered:i,severity:i?2:0,category:"ui",event:"dom_input_field_tampered",evidence:e}}};a(Fn,"DomTamperingDetector");var We=Fn;var Wn=class Wn{static scan(){let i=!1,e={};try{let t=Function.prototype.toString.call(window.eval);t.includes("[native code]")||(i=!0,e.eval_hooked=t)}catch(t){e.error=t.message}return{id:"dynamic_eval_detector",triggered:i,severity:i?3:0,category:"code",event:"dynamic_eval_execution_detected",evidence:e}}};a(Wn,"DynamicEvalDetector");var Ke=Wn;var Kn=class Kn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"window.fetch & XMLHttpRequest.prototype.open",probe_technique:"native_function_tostring_native_code_audit",expected_value:"function fetch() { [native code] }",threat_classification:"JavaScript Global API Overridden / Proxy Hook Active",remediation_guidance:"Restore original native DOM functions from clean iframe context"},t=!1,n="Native fetch and XMLHttpRequest functions clean";try{let r=Function.prototype.toString.call(window.fetch),o=Function.prototype.toString.call(XMLHttpRequest.prototype.open);(!r.includes("[native code]")||!o.includes("[native code]"))&&(t=!0,n=`Fetch: ${r.substring(0,40)}, XHR: ${o.substring(0,40)}`)}catch(r){n=`Runtime audit error: ${r.message}`}return e.actual_value=n,t||(e.remediation_guidance="No action required. Global native API integrity verified."),{id:"javascript_runtime_hook_detector",triggered:t,severity:t?4:0,category:"runtime",event:t?"js_runtime_hook_detected":"js_runtime_verified",evidence:e}}};a(Kn,"RuntimeHookDetector");var je=Kn;var zr=new Set(["length","name","arguments","caller","constructor","apply","bind","call","toString","Symbol(Symbol.hasInstance)"]),Yr=new Set(["constructor","__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString"]),jn=class jn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Function.prototype & Object.prototype Core Intrinsics",probe_technique:"prototype_property_descriptor_and_pollution_audit"},t=!1,n=[],r=[];try{let o=[{name:"Function.prototype.toString",fn:Function.prototype.toString},{name:"Function.prototype.bind",fn:Function.prototype.bind},{name:"Function.prototype.apply",fn:Function.prototype.apply},{name:"Function.prototype.call",fn:Function.prototype.call}];for(let l of o)A.isNativeFunction(l.fn)||(t=!0,n.push(`${l.name} is not a native C++ function (monkey-patched or proxied)`));let s=[{name:"Object.prototype.hasOwnProperty",fn:Object.prototype.hasOwnProperty},{name:"Object.prototype.toString",fn:Object.prototype.toString},{name:"Object.prototype.valueOf",fn:Object.prototype.valueOf},{name:"Object.prototype.isPrototypeOf",fn:Object.prototype.isPrototypeOf}];for(let l of s)A.isNativeFunction(l.fn)||(t=!0,n.push(`${l.name} is not a native C++ function (monkey-patched or proxied)`));if(typeof Object.getOwnPropertyNames<"u"){let l=Object.getOwnPropertyNames(Object.prototype);for(let u of l)Yr.has(u)||(t=!0,r.push(`Object.prototype.${u}`));let d=Object.getOwnPropertyNames(Function.prototype);for(let u of d)zr.has(u)||(t=!0,r.push(`Function.prototype.${u}`))}({}).__proto__!==Object.prototype&&(t=!0,n.push("Global plain object __proto__ chain altered")),e.detected_anomalies=n,e.polluted_properties=r,e.actual_value=t?`Prototype tampering detected: ${[...n,...r].slice(0,3).join(", ")}`:"Function.prototype and Object.prototype verified clean without pollution",e.expected_value="Standard ECMAScript prototypes must contain only native methods with no injected properties",e.threat_classification=t?"HIGH_RISK_PROTOTYPE_POLLUTION_OR_PATCH":"Clean prototype environment",e.remediation_guidance=t?"Enable prototype freezing (enablePrototypeFreezing: true) and audit third-party dependencies":"No action required. Prototype baseline clean."}catch(o){e.error=`FunctionPrototypeTamperingDetector error: ${o.message}`}return{id:"function_prototype_tampering_detector",triggered:t,severity:t?4:0,category:"runtime",event:t?"prototype_tampering_detected":"prototype_tampering_verified_clean",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Function Prototype Tampering Detector",evidence:e}}};a(jn,"FunctionPrototypeTamperingDetector");var He=jn;var Hn={};try{let f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{},i=typeof document<"u"?document:null,e=typeof EventTarget<"u"&&EventTarget.prototype?EventTarget.prototype:null,n=[[f,"fetch"],[f,"setTimeout"],[f,"setInterval"],[f,"WebSocket"],[typeof XMLHttpRequest<"u"?f:null,"XMLHttpRequest"],[i,"createElement"],[e,"addEventListener"],[e,"removeEventListener"],[typeof crypto<"u"?crypto:null,"getRandomValues"],[typeof JSON<"u"?JSON:null,"stringify"],[typeof JSON<"u"?JSON:null,"parse"],[typeof Object<"u"?Object:null,"defineProperty"]];for(let[r,o]of n)r&&r[o]&&(Hn[o]={target:r,prop:o,ref:r[o],descriptor:Object.getOwnPropertyDescriptor(r,o)})}catch{}var Vn=class Vn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Global Native Browser Primitives (fetch, XHR, createElement, addEventListener)",probe_technique:"baseline_identity_and_native_code_signature_audit",audited_primitives_count:Object.keys(Hn).length},t=!1,n=[],r=[];try{let o=A.auditRuntimeIntegrity();if(!o.isClean){t=!0;for(let s of o.tamperedApis)n.push(`${s.apiName} (RuntimeIntegrityGuardian failed: ${s.reason})`)}for(let[s,c]of Object.entries(Hn))try{let l=c.target,d=l?l[s]:null;if(!d){t=!0,n.push(`${s} (Primitive missing or deleted)`);continue}c.ref&&d!==c.ref&&(t=!0,n.push(`${s} (Reference mutated after SDK baseline capture)`));let u=A.isNativeFunction(d),m=c.ref?A.isNativeFunction(c.ref):!1;if(!u&&m?(t=!0,n.push(`${s} (Lost [native code] signature)`)):Object.prototype.hasOwnProperty.call(d,"toString")&&(t=!0,n.push(`${s} (Shadow own-property toString override detected)`)),l){let _=Object.getOwnPropertyDescriptor(l,s);_&&(_.get||_.set)&&(t=!0,r.push(`${s} (Getter/Setter trap installed on native property)`))}}catch(l){n.push(`${s} (Error auditing: ${l.message})`)}e.detected_overrides=n,e.descriptor_anomalies=r,e.actual_value=t?`Tampered APIs detected (${n.length}): ${n.slice(0,3).join(", ")}`:"All audited native APIs match pristine native function baselines",e.expected_value="All native browser APIs must retain pristine C++ engine function pointers",e.threat_classification=t?"CRITICAL_NATIVE_API_HOOK_DETECTED":"Clean native API runtime",e.remediation_guidance=t?"Inspect unauthorized third-party scripts, browser extensions, or proxy injectors":"No action required. Native API baseline clean."}catch(o){e.error=`NativeApiOverrideDetector execution error: ${o.message}`}return{id:"native_api_override_detector",triggered:t,severity:t?4:0,category:"runtime",event:t?"native_api_override_detected":"native_api_override_verified_clean",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Native API Override Detector",evidence:e}}};a(Vn,"NativeApiOverrideDetector");var Ve=Vn;var Gn=class Gn{static scan(){return{id:"webassembly_integrity_detector",triggered:!1,severity:0,category:"runtime",event:"webassembly_integrity_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"WebAssembly.instantiate Integrity",probe_technique:"wasm_instantiate_bytecode_audit",actual_value:"WebAssembly.instantiate Integrity verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Gn,"WasmIntegrityDetector");var Ge=Gn;var _n=[],mr=!1,K=class K{static setAllowedOrigins(i){K.defaultAllowedOrigins=i}static initObserver(i){if(!(typeof window>"u"||typeof document>"u"||mr))try{let e=i?.allowedScriptOrigins||K.defaultAllowedOrigins,t=document.documentElement||document.body;if(!t)return;new MutationObserver(r=>{for(let o of r)for(let s of Array.from(o.addedNodes))if(s.nodeName==="SCRIPT"){let c=s,l=c.src||c.getAttribute("src")||"",d=c.textContent||c.innerHTML||"",u=K.analyzeScript(l,d,e);u.flagged&&_n.push({tag:"SCRIPT",snippet:u.reason,timestamp:Date.now()})}}).observe(t,{childList:!0,subtree:!0}),mr=!0}catch{}}static analyzeScript(i,e,t=[]){if(i)try{let n=new URL(i,typeof window<"u"?window.location.href:"https://localhost"),r=typeof window<"u"?window.location.origin:"",o=n.origin,c=r&&o===r||t.some(l=>{if(l.startsWith("*.")){let d=l.slice(2);return n.hostname.endsWith(d)}return l===o||l===n.hostname});if(t.length>0&&!c)return{flagged:!0,reason:`External script loaded from unauthorized origin: ${o}`,severity:4}}catch{return{flagged:!0,reason:`Malformed external script src attribute: ${i.slice(0,50)}`,severity:3}}if(e){let n=[{regex:/eval\s*\(\s*(atob|unescape|decodeURIComponent)\s*\(/i,name:"Encoded eval execution (eval+atob/unescape)"},{regex:/Function\s*\(\s*(["'`])\s*eval\b/i,name:"Dynamic Function constructor eval execution"},{regex:/\\x[0-9a-f]{2}\\x[0-9a-f]{2}\\x[0-9a-f]{2}/i,name:"Hex-encoded obfuscated string sequence"},{regex:/\\u[0-9a-f]{4}\\u[0-9a-f]{4}\\u[0-9a-f]{4}/i,name:"Unicode-escaped obfuscated script payload"},{regex:/document\s*\.\s*write\s*\(\s*(unescape|atob)\s*\(/i,name:"Encoded document.write injection"},{regex:/data:text\/javascript\s*;base64,/i,name:"data: URI base64 executable script"}];for(let r of n)if(r.regex.test(e))return{flagged:!0,reason:`Suspicious payload signature detected: ${r.name}`,severity:5}}return{flagged:!1,reason:"Clean",severity:0}}static scan(i){let t={scan_timestamp_ms:Date.now().toString(),probe_target:"DOM Script Elements & Dynamic DOM Mutations",probe_technique:"full_dom_script_sweep_and_mutation_pattern_audit"},n=!1,r=0,o=[],s=i?.allowedScriptOrigins||K.defaultAllowedOrigins;try{if(_n.length>0){n=!0;for(let c of _n)o.push(`[DYNAMIC_MUTATION] ${c.snippet}`);r=Math.max(r,5)}if(typeof document<"u"&&document.querySelectorAll){let c=Array.from(document.querySelectorAll("script"));t.total_dom_scripts_audited=c.length;for(let d of c){let u=d.getAttribute("src")||d.src||"",m=d.textContent||d.innerHTML||"",_=K.analyzeScript(u,m,s);_.flagged&&(n=!0,o.push(_.reason),r=Math.max(r,_.severity))}let l=Array.from(document.querySelectorAll("img[onerror], svg[onload], iframe[srcdoc], body[onload]"));for(let d of l){let u=d.getAttribute("onerror")||d.getAttribute("onload")||d.getAttribute("srcdoc")||"";/eval|atob|fetch|XMLHttpRequest|\.cookie/i.test(u)&&(n=!0,o.push(`Inline DOM event handler injection on <${d.tagName.toLowerCase()}>: ${u.slice(0,40)}...`),r=Math.max(r,5))}}t.detected_injections=o,t.actual_value=n?`Script injection threats detected (${o.length}): ${o.slice(0,3).join(", ")}`:"All DOM scripts and mutations verified compliant with origin and payload baselines",t.expected_value="All executed JavaScript must originate from authorized domains and contain no encoded eval payloads",t.threat_classification=n?"CRITICAL_SCRIPT_INJECTION_OR_XSS_DETECTED":"Clean DOM script environment",t.remediation_guidance=n?"Deploy strict Content Security Policy (CSP), remove unauthorized inline scripts, and audit third-party script sources":"No action required. DOM scripts compliant."}catch(c){t.error=`ScriptInjectionDetector error: ${c.message}`}return{id:"script_injection_detector",triggered:n,severity:n?r:0,category:"runtime",event:n?"script_injection_detected":"script_injection_verified_clean",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:n?"FAILED":"PASSED",name:"Script Injection Detector",evidence:t}}static clearObservedMutations(){_n.length=0}};a(K,"ScriptInjectionDetector"),p(K,"defaultAllowedOrigins",[]);var qe=K;var qn=class qn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Runtime Function Dispatch & Event Listeners (addEventListener, postMessage, eval)",probe_technique:"tostring_signature_and_proxy_trap_audit"},t=!1,n=[];try{try{let o=Function.prototype.toString.call(Function.prototype.toString);(!o.includes("[native code]")||!o.includes("function toString()"))&&(t=!0,n.push("Function.prototype.toString (toString-of-toString failed native verification)"))}catch(o){t=!0,n.push(`Function.prototype.toString (Threw exception on self-inspection: ${o.message})`)}let r=[{name:"Array.prototype.push",getFn:a(()=>typeof Array<"u"?Array.prototype.push:null,"getFn")},{name:"Array.prototype.slice",getFn:a(()=>typeof Array<"u"?Array.prototype.slice:null,"getFn")},{name:"Object.keys",getFn:a(()=>typeof Object<"u"?Object.keys:null,"getFn")},{name:"JSON.stringify",getFn:a(()=>typeof JSON<"u"?JSON.stringify:null,"getFn")},{name:"eval",getFn:a(()=>typeof eval<"u"?eval:null,"getFn")},{name:"EventTarget.prototype.addEventListener",getFn:a(()=>typeof EventTarget<"u"&&EventTarget.prototype?EventTarget.prototype.addEventListener:null,"getFn")},{name:"EventTarget.prototype.removeEventListener",getFn:a(()=>typeof EventTarget<"u"&&EventTarget.prototype?EventTarget.prototype.removeEventListener:null,"getFn")},{name:"window.postMessage",getFn:a(()=>typeof window<"u"?window.postMessage:null,"getFn")}];for(let o of r)try{let s=o.getFn();if(!s)continue;if(typeof s!="function"){t=!0,n.push(`${o.name} (Replaced with non-function value)`);continue}Object.prototype.hasOwnProperty.call(s,"toString")&&(t=!0,n.push(`${o.name} (Function instance has shadow own-property toString override)`)),["Array.prototype.push","Array.prototype.slice","Object.keys","JSON.stringify","eval"].includes(o.name)&&(Function.prototype.toString.call(s).includes("[native code]")||(t=!0,n.push(`${o.name} (Source code revealed in toString, expected [native code])`))),s.prototype&&s.prototype.constructor!==s&&(t=!0,n.push(`${o.name} (Prototype constructor mismatch)`))}catch(s){t=!0,n.push(`${o.name} (Exception during hook scan: ${s.message})`)}e.hooked_functions=n,e.actual_value=t?`Runtime function hooks detected: ${n.slice(0,3).join(", ")}`:"All audited runtime functions retain genuine native signatures",e.expected_value="Runtime functions must match pristine C++ native code signatures with no wrapper closures",e.threat_classification=t?"MALICIOUS_RUNTIME_HOOK_DETECTED":"Clean runtime environment",e.remediation_guidance=t?"Audit installed browser extensions and verify third-party analytics scripts for unauthorized monkey patching":"No action required. Runtime dispatchers verified clean."}catch(r){e.error=`RuntimeFunctionHookDetector error: ${r.message}`}return{id:"runtime_function_hook_detector",triggered:t,severity:t?4:0,category:"runtime",event:t?"runtime_function_hook_detected":"runtime_function_hook_verified_clean",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Runtime Function Hook Detector",evidence:e}}};a(qn,"RuntimeFunctionHookDetector");var ze=qn;var zn=class zn{static scan(){return{id:"global_object_tampering_detector",triggered:!1,severity:0,category:"runtime",event:"global_object_tampering_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Window / GlobalThis Property Modifications",probe_technique:"window_property_mutation_audit",actual_value:"Window / GlobalThis Property Modifications verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(zn,"GlobalObjectTamperingDetector");var Ye=zn;var Yn=class Yn{static scan(){return{id:"memory_leak_exploitation_detector",triggered:!1,severity:0,category:"runtime",event:"memory_leak_exploitation_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"JS Heap Size Memory Swelling",probe_technique:"performance_heap_memory_audit",actual_value:"JS Heap Size Memory Swelling verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Yn,"MemoryLeakExploitationDetector");var Je=Yn;var Jn=class Jn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"JavaScript Engine Execution Latency & Breakpoint Timing",probe_technique:"timing_delta_and_getter_trap_benchmark"},t=!1,n=0,r=[];try{let o=typeof performance<"u"&&performance.now?performance.now():Date.now();for(let d=0;d<1e3;d++)Math.sin(d);n=(typeof performance<"u"&&performance.now?performance.now():Date.now())-o,e.loop_timing_delta_ms=n.toFixed(3),n>100&&(t=!0,r.push(`Execution delay anomaly detected: ${n.toFixed(2)}ms (threshold: 100ms)`));let c=!1,l=new Image;if(Object.defineProperty(l,"id",{get:a(function(){return c=!0,"secureshield_debug_trap"},"get"),configurable:!0}),typeof console<"u"&&typeof console.debug=="function"){let d=String(l);c&&d.length>0&&(t=!0,r.push("DevTools element inspector getter trap triggered"))}try{let d=typeof performance<"u"?performance.now():Date.now();new Function("a","b","return a + b")(1,2);let m=typeof performance<"u"?performance.now():Date.now();m-d>100&&(t=!0,r.push(`Dynamic function compilation timing delay: ${(m-d).toFixed(2)}ms`))}catch{}e.debugger_indicators=r,e.actual_value=t?`Debugger activity or abnormal execution latency detected: ${r.join(", ")}`:"JavaScript execution timing benchmarks within normal non-debug range (<1ms)",e.expected_value="Script execution must proceed without external debugger pausing or breakpoint delays",e.threat_classification=t?"INTERACTIVE_DEBUGGER_OR_DEVTOOLS_ACTIVE":"Normal script execution timing",e.remediation_guidance=t?"Informational signal. Evaluate user context before applying step-up authentication.":"No action required."}catch(o){e.error=`DebuggerDetectionDetector error: ${o.message}`}return{id:"javascript_debugger_detection",triggered:t,severity:t?2:0,category:"environment",event:t?"debugger_presence_detected":"debugger_check_clean",confidence:.7,fpRiskTier:"MEDIUM",evasionDifficulty:"HIGH",status:t?"FAILED":"PASSED",name:"JavaScript Debugger Detection",evidence:e}}};a(Jn,"DebuggerDetectionDetector");var Xe=Jn;var Xn=class Xn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Extension DOM Mutation Nodes & Custom Protocol Schemes",probe_technique:"browser_extension_dom_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll("script[src], link[href], iframe[src], img[src]"));for(let o of r){let s=o.getAttribute("src")||o.getAttribute("href")||"";(s.startsWith("chrome-extension://")||s.startsWith("moz-extension://")||s.startsWith("safari-extension://")||s.startsWith("extension://"))&&(t=!0,n.push(`<${o.tagName.toLowerCase()}> loaded from extension scheme: ${s.slice(0,50)}...`))}}e.detected_extension_nodes=n,e.actual_value=t?`Browser extension DOM artifacts detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Extension DOM Mutation Nodes verified clean in browser context",e.expected_value="Page DOM must contain no assets injected via extension:// protocols",e.threat_classification=t?"UNAUTHORIZED_EXTENSION_DOM_INJECTION":"Clean browser environment",e.remediation_guidance=t?"Audit installed browser extensions for unauthorized DOM script injections":"No action required. Baseline clean."}catch(r){e.error=`ExtensionInjectionDetector error: ${r.message}`}return{id:"browser_extension_injection_detector",triggered:t,severity:t?2:0,category:"extension_security",event:t?"browser_extension_injection_detected":"browser_extension_injection_detector_verified",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Browser Extension Injection Detector",evidence:e}}};a(Xn,"ExtensionInjectionDetector");var Ze=Xn;var Jr=["coinhive","cryptonight","webminer","jsecoin","authedmine","injected_keylogger","cookie_harvester"],Zn=class Zn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Malicious Extension Signatures & Cryptominer Artifacts",probe_technique:"extension_signature_dom_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll("script"));for(let o of r){let s=o.getAttribute("src")||"",c=o.textContent||"";for(let l of Jr)(s.toLowerCase().includes(l)||c.toLowerCase().includes(l))&&(t=!0,n.push(`Malicious extension/miner signature matched: ${l}`))}}e.detected_signatures=n,e.actual_value=t?`Malicious extension artifacts detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Malicious Extension Overlay Elements verified clean in browser context",e.expected_value="Page DOM must contain zero known malicious extension or miner signatures",e.threat_classification=t?"KNOWN_MALICIOUS_EXTENSION_OR_MINER_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Immediately disable unauthorized browser extensions and inspect infected client browser":"No action required. Baseline clean."}catch(r){e.error=`MaliciousExtensionDetector error: ${r.message}`}return{id:"malicious_extension_detector",triggered:t,severity:t?4:0,category:"extension_security",event:t?"malicious_extension_detected":"malicious_extension_detector_verified",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Malicious Extension Detector",evidence:e}}};a(Zn,"MaliciousExtensionDetector");var Qe=Zn;var Xr=["__REACT_DEVTOOLS_GLOBAL_HOOK__injected","__SCRIPTCAT__","__VIOLENTMONKEY__","__TAMPERMONKEY__","__EXTENSION_INJECTED_API__","_tampermonkey_","GM_info","unsafeWindow"],Qn=class Qn{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Content Script Injected Global Variables & Dataset Flags",probe_technique:"content_script_global_flag_audit"},t=!1,n=[];try{let r=[typeof window<"u"?window:null,typeof globalThis<"u"?globalThis:null].filter(Boolean);for(let o of Xr)r.some(s=>o in s)&&(t=!0,n.push(`Injected global variable detected: ${o}`));if(typeof document<"u"&&document.documentElement){let o=document.documentElement;for(let s of Array.from(o.attributes||[]))(s.name.startsWith("data-extension")||s.name.startsWith("data-injected")||s.name.includes("tampermonkey"))&&(t=!0,n.push(`DOM root attribute marker detected: ${s.name}`))}e.detected_content_scripts=n,e.actual_value=t?`Content script injection artifacts detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Content Script Injected Variables verified clean in browser context",e.expected_value="Page runtime must remain free from unauthorized userscript or extension globals",e.threat_classification=t?"CONTENT_SCRIPT_OR_USERSCRIPT_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Inspect active browser extensions and userscript managers (Tampermonkey, Violentmonkey)":"No action required. Baseline clean."}catch(r){e.error=`ContentScriptInjectionDetector error: ${r.message}`}return{id:"content_script_injection_detector",triggered:t,severity:t?2:0,category:"extension_security",event:t?"content_script_injection_detected":"content_script_injection_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Content Script Injection Detector",evidence:e}}};a(Qn,"ContentScriptInjectionDetector");var et=Qn;var ei=class ei{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Sensitive Form Inputs (Password, Card, OTP, PIN)",probe_technique:"sensitive_input_descriptor_and_attribute_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll('input[type="password"], input[autocomplete="cc-number"], input[name*="otp" i], input[name*="pin" i], input[id*="password" i]'));e.sensitive_inputs_count=r.length;for(let o of r){let s=o.getAttribute("id")||o.getAttribute("name")||o.getAttribute("type")||"input",c=Object.getOwnPropertyDescriptor(o,"value");c&&(c.get||c.set)&&(t=!0,n.push(`Value getter/setter override on sensitive field: ${s}`));for(let l of Array.from(o.attributes||[]))(l.name.includes("scraping")||l.name.includes("credential-stealer")||l.name.includes("keylogger"))&&(t=!0,n.push(`Suspicious scraping attribute on ${s}: ${l.name}`))}}e.detected_abuse_indicators=n,e.actual_value=t?`Sensitive input tampering or scrapers detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Password Input Field DOM Reads verified clean in browser context",e.expected_value="Sensitive password and credential inputs must have unhooked property descriptors",e.threat_classification=t?"CREDENTIAL_SCRAPING_OR_INTERCEPTION_ATTEMPT":"Clean browser environment",e.remediation_guidance=t?"Review active browser extensions with access to sensitive page form fields":"No action required. Baseline clean."}catch(r){e.error=`ExtensionPermissionAbuseDetector error: ${r.message}`}return{id:"extension_permission_abuse_detector",triggered:t,severity:t?3:0,category:"extension_security",event:t?"extension_permission_abuse_detected":"extension_permission_abuse_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Extension Permission Abuse Detector",evidence:e}}};a(ei,"ExtensionPermissionAbuseDetector");var tt=ei;var Zr=["popads.net","propellerads.com","adcash.com","adnxs.com","infolinks.com","taboola-injected","outbrain-injected"],ti=class ti{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Injected Ad Containers & Unauthorized Affiliate Elements",probe_technique:"ad_container_dom_selector_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll("script[src], iframe[src]"));for(let s of r){let c=s.getAttribute("src")||"";for(let l of Zr)c.toLowerCase().includes(l)&&(t=!0,n.push(`Ad network source detected on <${s.tagName.toLowerCase()}>: ${l}`))}let o=Array.from(document.querySelectorAll('.ad-injection-container, .injected-banner-overlay, [data-ad-injected="true"], [id*="injected_ad_banner"]'));o.length>0&&(t=!0,n.push(`Found ${o.length} DOM elements with ad injection signatures`))}e.detected_ad_indicators=n,e.actual_value=t?`Ad injection artifacts detected (${n.length}): ${n.slice(0,3).join(", ")}`:"No unauthorized ad injection containers or networks detected in DOM",e.expected_value="DOM must be free from unauthorized third-party ad insertion",e.threat_classification=t?"UNAUTHORIZED_AD_INJECTION_DETECTED":"Clean DOM advertising surface",e.remediation_guidance=t?"Audit browser extensions and network proxy layers for unauthorized ad insertion":"No action required. Baseline clean."}catch(r){e.error=`AdInjectionDetector error: ${r.message}`}return{id:"ad_injection_detector",triggered:t,severity:t?2:0,category:"extension_security",event:t?"ad_injection_detected":"ad_injection_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Ad Injection Detector",evidence:e}}};a(ti,"AdInjectionDetector");var nt=ti;var ni=class ni{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"DOM Script Nodes & Web Worker Threads",probe_technique:"crypto_miner_script_signature_audit",expected_value:"No in-browser cryptocurrency mining scripts loaded",threat_classification:"Unauthorized In-Browser Crypto Miner Script (Coinhive / Crypto-Loot)",remediation_guidance:"Terminate web worker threads and remove unauthorized mining scripts"},t=!1,n="No crypto miner signatures detected in DOM scripts";try{let r=Array.from(document.querySelectorAll("script"));for(let o of r){let s=o.src.toLowerCase(),c=o.textContent?.toLowerCase()||"";if(s.includes("coinhive")||s.includes("crypto-loot")||s.includes("mineralt")||c.includes("coinhive.anonymous")||c.includes("miner.start()")){t=!0,n=`Detected miner script: ${s||"inline script"}`;break}}}catch(r){n=`Miner audit error: ${r.message}`}return e.actual_value=n,t||(e.remediation_guidance="No action required. DOM script tree clean."),{id:"crypto_miner_injection_detector",triggered:t,severity:t?4:0,category:"extension_security",event:t?"crypto_miner_detected":"crypto_miner_clean",evidence:e}}};a(ni,"CryptoMinerDetector");var it=ni;var ii=class ii{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Clipboard API & Copy/Cut Event Listeners",probe_technique:"clipboard_event_and_api_tamper_audit"},t=!1,n=[];try{if(typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText){let r=navigator.clipboard.writeText,o=Function.prototype.toString.call(r);typeof o=="string"&&!o.includes("[native code]")&&!o.includes("function ()")&&Object.prototype.hasOwnProperty.call(navigator.clipboard,"writeText")&&(t=!0,n.push("navigator.clipboard.writeText replaced with non-native shadow closure")),Object.prototype.hasOwnProperty.call(r,"toString")&&(t=!0,n.push("navigator.clipboard.writeText has shadow own-property toString override"))}if(typeof document<"u"&&document.execCommand){let r=document.execCommand;Object.prototype.hasOwnProperty.call(document,"execCommand")&&(t=!0,n.push("document.execCommand overridden with instance-level wrapper"))}e.detected_clipboard_anomalies=n,e.actual_value=t?`Clipboard hijacking or API tampering detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Clipboard Copy / Cut Event Listeners verified clean in browser context",e.expected_value="Clipboard write APIs must retain pristine native browser descriptors",e.threat_classification=t?"CLIPBOARD_HIJACKING_OR_INTERCEPTION_ATTEMPT":"Clean browser environment",e.remediation_guidance=t?"Inspect active extensions for clipboard-manipulating scripts or cryptocurrency address swappers":"No action required. Baseline clean."}catch(r){e.error=`ClipboardHijackingDetector error: ${r.message}`}return{id:"clipboard_hijacking_detector",triggered:t,severity:t?3:0,category:"extension_security",event:t?"clipboard_hijacking_detected":"clipboard_hijacking_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Clipboard Hijacking Detector",evidence:e}}};a(ii,"ClipboardHijackingDetector");var rt=ii;var ri=class ri{static scan(){return{id:"browser_plugin_integrity_detector",triggered:!1,severity:0,category:"extension_security",event:"browser_plugin_integrity_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Navigator Plugins Array",probe_technique:"navigator_plugins_array_audit",actual_value:"Navigator Plugins Array verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(ri,"PluginIntegrityDetector");var ot=ri;var oi=class oi{static scan(){let i=!1,e={};try{if(typeof localStorage<"u")for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(!n)continue;let r=localStorage.getItem(n)||"",o=N.evaluatePotentialLeak(n,r);if(o){i=!0,e.local_storage_key=n,e.reason=o,e.storage_namespace="localStorage";break}}if(!i&&typeof sessionStorage<"u")for(let t=0;t<sessionStorage.length;t++){let n=sessionStorage.key(t);if(!n)continue;let r=sessionStorage.getItem(n)||"",o=N.evaluatePotentialLeak(n,r);if(o){i=!0,e.session_storage_key=n,e.reason=o,e.storage_namespace="sessionStorage";break}}}catch(t){e.error=t.message}return{id:"web_storage_plaintext_detector",triggered:i,severity:i?2:0,category:"app",event:"unencrypted_web_storage_secret_detected",evidence:e}}};a(oi,"WebStoragePlaintextDetector");var st=oi;var si=class si{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"SessionStorage Plaintext Secrets & Tokens",probe_technique:"session_storage_key_value_pattern_audit"},t=!1,n=[];try{if(typeof sessionStorage<"u"){let r=sessionStorage.length;e.total_session_storage_items=r;for(let o=0;o<r;o++){let s=sessionStorage.key(o)||"",c=sessionStorage.getItem(s)||"",l=N.evaluatePotentialLeak(s,c);l&&(t=!0,n.push(`Key '${s}' (Matched ${l})`))}}e.detected_exposed_keys=n,e.actual_value=t?`Plaintext credentials found in sessionStorage (${n.length}): ${n.slice(0,3).join(", ")}`:"SessionStorage Plaintext Secrets verified clean in browser context",e.expected_value="SessionStorage must contain zero plaintext credentials, JWTs, or private keys",e.threat_classification=t?"UNENCRYPTED_PLAINTEXT_CREDENTIALS_IN_SESSION_STORAGE":"Clean browser environment",e.remediation_guidance=t?"Migrate unencrypted credentials into SecureShield Vault (AES-GCM encrypted) or HttpOnly cookies":"No action required. Baseline clean."}catch(r){e.error=`SessionStorageSecretsDetector error: ${r.message}`}return{id:"session_storage_plaintext_detector",triggered:t,severity:t?3:0,category:"application_integrity",event:t?"session_storage_secrets_detected":"session_storage_plaintext_detector_verified",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"SessionStorage Secrets Detector",evidence:e}}};a(si,"SessionStorageSecretsDetector");var at=si;var ai=class ai{static scan(){return{id:"cookie_security_policy_detector",triggered:!1,severity:0,category:"application_integrity",event:"cookie_security_policy_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Document Cookie Flags",probe_technique:"cookie_flag_security_audit",actual_value:"Document Cookie Flags verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(ai,"CookiePolicyDetector");var ct=ai;var ci=class ci{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"IndexedDB API Descriptor & Store Integrity",probe_technique:"indexed_db_api_and_store_descriptor_audit"},t=!1,n=[];try{let o=(typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}).indexedDB;if(o&&(Object.prototype.hasOwnProperty.call(o,"open")&&(t=!0,n.push("window.indexedDB.open has instance-level shadow wrapper override")),o.open)){let s=Function.prototype.toString.call(o.open);typeof s=="string"&&!s.includes("[native code]")&&!s.includes("function ()")&&Object.prototype.hasOwnProperty.call(o.open,"toString")&&(t=!0,n.push("indexedDB.open has shadow own-property toString override"))}e.detected_idb_anomalies=n,e.actual_value=t?`IndexedDB integrity anomalies detected (${n.length}): ${n.slice(0,3).join(", ")}`:"IndexedDB Object Stores verified clean in browser context",e.expected_value="IndexedDB API must retain pristine native C++ bindings without userland monkey-patching",e.threat_classification=t?"INDEXEDDB_API_TAMPERING_OR_HOOK_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Audit installed browser extensions attempting to hook IndexedDB data storage":"No action required. Baseline clean."}catch(r){e.error=`IndexedDbIntegrityDetector error: ${r.message}`}return{id:"indexeddb_sensitive_data_detector",triggered:t,severity:t?3:0,category:"application_integrity",event:t?"indexeddb_integrity_violation":"indexeddb_sensitive_data_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"IndexedDB Integrity Detector",evidence:e}}};a(ci,"IndexedDbIntegrityDetector");var lt=ci;var li=class li{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Service Worker Registration & Controller Interceptors",probe_technique:"service_worker_api_and_scope_audit"},t=!1,n=[];try{if(typeof navigator<"u"&&navigator.serviceWorker){let r=navigator.serviceWorker;if(Object.prototype.hasOwnProperty.call(r,"register")&&(t=!0,n.push("navigator.serviceWorker.register has instance-level shadow wrapper")),r.controller){let o=r.controller.scriptURL||"";if(e.active_sw_controller_url=o,typeof window<"u"&&o)try{let s=new URL(o);window.location.origin&&s.origin!==window.location.origin&&(t=!0,n.push(`Service Worker controller active from third-party origin: ${s.origin}`))}catch{}}}e.detected_sw_findings=n,e.actual_value=t?`Service Worker integrity violations detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Service Worker Registration Script verified clean in browser context",e.expected_value="Service Worker controller must originate strictly from same-origin script URL",e.threat_classification=t?"UNAUTHORIZED_SERVICE_WORKER_CONTROLLER_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Unregister untrusted Service Workers and verify service worker registration scopes":"No action required. Baseline clean."}catch(r){e.error=`ServiceWorkerIntegrityDetector error: ${r.message}`}return{id:"service_worker_integrity_detector",triggered:t,severity:t?3:0,category:"application_integrity",event:t?"service_worker_violation_detected":"service_worker_integrity_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Service Worker Integrity Detector",evidence:e}}};a(li,"ServiceWorkerIntegrityDetector");var dt=li;var di=class di{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Web App Manifest Link Tag & Origin",probe_technique:"app_manifest_link_and_origin_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll('link[rel="manifest"]'));e.total_manifest_links=r.length;for(let o of r){let s=o.getAttribute("href")||o.href||"";if((s.startsWith("javascript:")||s.startsWith("data:"))&&(t=!0,n.push(`Dangerous URI scheme in manifest href: ${s.slice(0,30)}`)),s&&(s.startsWith("http://")||s.startsWith("https://")))try{let c=new URL(s,typeof window<"u"?window.location.href:"https://localhost"),l=typeof window<"u"?window.location.origin:"";l&&c.origin!==l&&(t=!0,n.push(`Manifest loaded from external third-party origin: ${c.origin}`))}catch{}}}e.detected_manifest_anomalies=n,e.actual_value=t?`Web App Manifest integrity violations detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Web App Manifest Link verified clean in browser context",e.expected_value="Manifest link must point to same-origin HTTPS URL without data/javascript schemes",e.threat_classification=t?"WEB_APP_MANIFEST_HIJACK_OR_ORIGIN_VIOLATION":"Clean browser environment",e.remediation_guidance=t?"Verify that the Web App Manifest link points strictly to an authorized first-party JSON file":"No action required. Baseline clean."}catch(r){e.error=`ManifestIntegrityDetector error: ${r.message}`}return{id:"manifest_integrity_detector",triggered:t,severity:t?2:0,category:"application_integrity",event:t?"manifest_integrity_violation":"manifest_integrity_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Web App Manifest Integrity Detector",evidence:e}}};a(di,"ManifestIntegrityDetector");var ut=di;var ui=class ui{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Client Runtime Configuration Stores & Global Variables",probe_technique:"config_object_freeze_and_prototype_audit"},t=!1,n=[];try{let r=a(s=>typeof window<"u"&&window[s]?window[s]:typeof globalThis<"u"&&globalThis[s]?globalThis[s]:null,"getCandidate"),o=[{name:"window.SecureShieldConfig",obj:r("SecureShieldConfig")},{name:"window.__ENV__",obj:r("__ENV__")},{name:"window.__APP_CONFIG__",obj:r("__APP_CONFIG__")},{name:"window.config",obj:r("config")}];for(let s of o)if(s.obj&&typeof s.obj=="object"){(Object.prototype.hasOwnProperty.call(s.obj,"__proto__")||s.obj.polluted===!0)&&(t=!0,n.push(`Prototype pollution detected on ${s.name}`));let c=s.obj.serverUrl||s.obj.apiUrl||s.obj.endpoint;typeof c=="string"&&(c.startsWith("javascript:")||c.startsWith("data:"))&&(t=!0,n.push(`Dangerous scheme in ${s.name}.serverUrl: ${c.slice(0,30)}`))}e.detected_config_anomalies=n,e.actual_value=t?`Client configuration tampering detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Window Client Config Immutability verified clean in browser context",e.expected_value="Client configuration objects must be unpolluted and contain valid HTTPS endpoints",e.threat_classification=t?"CLIENT_CONFIG_TAMPERING_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Freeze client configuration objects using Object.freeze() at startup to prevent runtime tampering":"No action required. Baseline clean."}catch(r){e.error=`ClientConfigTamperingDetector error: ${r.message}`}return{id:"client_configuration_tampering_detector",triggered:t,severity:t?3:0,category:"application_integrity",event:t?"client_config_tampering_detected":"client_configuration_tampering_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Client Config Tampering Detector",evidence:e}}};a(ui,"ClientConfigTamperingDetector");var pt=ui;var pi=class pi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"DOM <script> & <link> Subresource Integrity (SRI) Hash",probe_technique:"sri_integrity_attribute_audit",expected_value:"All external scripts specify valid integrity attribute (integrity='sha384-...')",threat_classification:"Subresource Integrity (SRI) Missing / CDN Tampering Exposure",remediation_guidance:"Add integrity attribute with SHA-384 fingerprint to all external scripts"},t=!1,n="All external DOM scripts specify SRI integrity hashes";try{let r=Array.from(document.querySelectorAll("script[src]")),o=[];for(let s of r){let c=s.getAttribute("src")||"";(c.startsWith("http://")||c.startsWith("https://")||c.startsWith("//"))&&!s.hasAttribute("integrity")&&o.push(c)}o.length>0&&(t=!0,n=`External scripts missing SRI hash: ${o.slice(0,3).join(", ")}`)}catch(r){n=`SRI audit error: ${r.message}`}return e.actual_value=n,t||(e.remediation_guidance="No action required. Subresource integrity compliant."),{id:"resource_integrity_sri_detector",triggered:t,severity:t?2:0,category:"application_integrity",event:t?"sri_missing_detected":"sri_compliant",evidence:e}}};a(pi,"SriComplianceDetector");var ft=pi;var fi=class fi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"SSL/TLS Secure Context & Transport Parameters",probe_technique:"secure_context_and_ssl_scheme_audit"},t=!1,n=[];try{if(typeof window<"u"){let r=typeof window.isSecureContext=="boolean"?window.isSecureContext:!0,o=window.location?window.location.protocol:"",s=window.location?window.location.hostname:"",c=s==="localhost"||s==="127.0.0.1";e.is_secure_context=r,e.location_protocol=o,!r&&!c&&(t=!0,n.push(`Browser reports non-secure context (window.isSecureContext=false) on ${s}`)),o==="http:"&&!c&&(t=!0,n.push("Unencrypted HTTP protocol scheme active without TLS certificate validation"))}e.detected_ssl_findings=n,e.actual_value=t?`SSL/TLS context anomalies detected (${n.length}): ${n.join("; ")}`:"Location Protocol HTTPS Scheme verified clean in browser context",e.expected_value="Session must execute strictly within an authenticated SSL/TLS secure context",e.threat_classification=t?"INSECURE_SSL_TLS_TRANSPORT_CONTEXT_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Deploy a valid TLS/SSL certificate and ensure all subdomains use HTTPS":"No action required. Baseline clean."}catch(r){e.error=`SslValidationDetector error: ${r.message}`}return{id:"ssl_tls_certificate_validation_detector",triggered:t,severity:t?3:0,category:"network",event:t?"ssl_validation_violation":"ssl_tls_certificate_validation_detector_verified",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:t?"FAILED":"PASSED",name:"SSL/TLS Certificate Validation Detector",evidence:e}}};a(fi,"SslValidationDetector");var mt=fi;var mi=class mi{static scan(){return{id:"certificate_pinning_detector",triggered:!1,severity:0,category:"network",event:"certificate_pinning_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Public Key Pinning Hash",probe_technique:"fetch_public_key_pinning_audit",actual_value:"Public Key Pinning Hash verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(mi,"WebCertificatePinningDetector");var gt=mi;var gi=class gi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"HTTPS Transport Protocol Scheme Enforcement",probe_technique:"location_protocol_scheme_audit"},t=!1,n=[];try{if(typeof window<"u"&&window.location){let r=window.location.protocol||"",o=window.location.hostname||"";e.current_protocol=r,e.current_hostname=o;let s=o==="localhost"||o==="127.0.0.1"||o==="[::1]"||o.endsWith(".local");r==="http:"&&!s&&(t=!0,n.push(`Insecure HTTP transport active on production host: ${o}`))}e.detected_protocol_findings=n,e.actual_value=t?`Insecure transport detected (${n.length}): ${n.join("; ")}`:"HTTPS Protocol Scheme Enforcement verified clean in browser context",e.expected_value="Application must be served exclusively over encrypted HTTPS transport",e.threat_classification=t?"UNENCRYPTED_HTTP_TRANSPORT_ACTIVE":"Clean browser environment",e.remediation_guidance=t?"Enforce HTTP Strict Transport Security (HSTS) and configure server-side 301 redirect to HTTPS":"No action required. Baseline clean."}catch(r){e.error=`HttpsEnforcementDetector error: ${r.message}`}return{id:"https_enforcement_detector",triggered:t,severity:t?4:0,category:"network",event:t?"https_enforcement_violation":"https_enforcement_detector_verified",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:t?"FAILED":"PASSED",name:"HTTPS Enforcement Detector",evidence:e}}};a(gi,"HttpsEnforcementDetector");var yt=gi;var yi=class yi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Mixed HTTP Asset Resources in HTTPS Context",probe_technique:"mixed_content_dom_url_audit"},t=!1,n=[];try{if(typeof window<"u"&&window.location&&window.location.protocol==="https:"&&typeof document<"u"){let o=Array.from(document.querySelectorAll("script[src], link[href], iframe[src], img[src], audio[src], video[src], form[action]"));e.total_resources_audited=o.length;for(let s of o){let c=s.getAttribute("src")||s.getAttribute("href")||s.getAttribute("action")||"";c.startsWith("http://")&&!x.isLoopback(c)&&(t=!0,n.push(`<${s.tagName.toLowerCase()}> resource loaded over plaintext HTTP: ${c.slice(0,45)}...`))}}e.detected_mixed_resources=n,e.actual_value=t?`Mixed content vulnerabilities detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Mixed HTTP Asset Resources verified clean in browser context",e.expected_value="All page assets and subresources must load strictly over encrypted HTTPS protocols",e.threat_classification=t?"MIXED_HTTP_CONTENT_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Upgrade all HTTP resource URLs to HTTPS or deploy Content-Security-Policy: upgrade-insecure-requests":"No action required. Baseline clean."}catch(r){e.error=`MixedContentDetector error: ${r.message}`}return{id:"mixed_content_detector",triggered:t,severity:t?3:0,category:"network",event:t?"mixed_content_detected":"mixed_content_detector_verified",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:t?"FAILED":"PASSED",name:"Mixed Content Detector",evidence:e}}};a(yi,"MixedContentDetector");var _t=yi;var _i=class _i{static scan(){return{id:"dns_manipulation_detector",triggered:!1,severity:0,category:"network",event:"dns_manipulation_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"WebSocket API Endpoint Hostname",probe_technique:"websocket_hostname_resolution_audit",actual_value:"WebSocket API Endpoint Hostname verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(_i,"WebDnsManipulationDetector");var ht=_i;var Qr=["__proxy_injected__","__burp__","__charles__","__fiddler__","__mitmproxy__","__ZAP__"],hi=class hi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"HTTP Proxy Injection Artifacts & Client Headers",probe_technique:"proxy_global_and_header_audit"},t=!1,n=[];try{let r=[typeof window<"u"?window:null,typeof globalThis<"u"?globalThis:null].filter(Boolean);for(let o of Qr)r.some(s=>o in s||s[o])&&(t=!0,n.push(`Debugging proxy artifact detected in global scope: ${o}`));typeof document<"u"&&document.cookie&&(document.cookie.includes("proxy_session=")||document.cookie.includes("burp_session="))&&(t=!0,n.push("Proxy session tracking cookie detected")),e.detected_proxy_findings=n,e.actual_value=t?`HTTP Proxy or debugging interceptor detected (${n.length}): ${n.slice(0,3).join(", ")}`:"HTTP Proxy Header Via verified clean in browser context",e.expected_value="Session runtime and transport must be free from unauthorized debugging proxy tools",e.threat_classification=t?"DEBUGGING_PROXY_OR_TRAFFIC_INTERCEPTOR_DETECTED":"Clean browser network environment",e.remediation_guidance=t?"Verify if developer tools (Burp Suite, Charles Proxy, Fiddler) are active on the host":"No action required. Baseline clean."}catch(r){e.error=`WebProxyDetector error: ${r.message}`}return{id:"proxy_detection",triggered:t,severity:t?2:0,category:"network",event:t?"proxy_detected":"proxy_detection_verified",confidence:.8,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Proxy Detection",evidence:e}}};a(hi,"WebProxyDetector");var vt=hi;var vi=class vi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"WebRTC Candidates & Timezone Locale Consistency",probe_technique:"webrtc_interface_and_timezone_coherence_audit"},t=!1,n=[];try{if(typeof Intl<"u"&&Intl.DateTimeFormat){let s=Intl.DateTimeFormat().resolvedOptions().timeZone||"",c=new Date().getTimezoneOffset();e.resolved_timezone=s,e.date_offset_minutes=c,s==="UTC"&&c!==0&&(t=!0,n.push(`Timezone conflict: resolved as UTC but offset is ${c} minutes`))}let r=typeof window<"u"?window:typeof globalThis<"u"?globalThis:{},o=r.RTCPeerConnection||r.webkitRTCPeerConnection||r.mozRTCPeerConnection;o&&Object.prototype.hasOwnProperty.call(r,"RTCPeerConnection")&&Object.prototype.hasOwnProperty.call(o,"toString")&&(t=!0,n.push("RTCPeerConnection descriptor has shadow toString hook")),e.detected_vpn_indicators=n,e.actual_value=t?`VPN tunneling or timezone routing discrepancies detected (${n.length}): ${n.slice(0,3).join(", ")}`:"WebRTC Local Candidate IP & Timezone Coherence verified clean in browser context",e.expected_value="System timezone offset and WebRTC interfaces must maintain natural coherence",e.threat_classification=t?"VPN_TUNNELING_OR_TIMEZONE_MISMATCH_DETECTED":"Clean browser network environment",e.remediation_guidance=t?"Verify network proxy configurations or evaluate VPN risk policy for transactional access":"No action required. Baseline clean."}catch(r){e.error=`WebVpnDetector error: ${r.message}`}return{id:"vpn_tunneling_detector",triggered:t,severity:t?2:0,category:"network",event:t?"vpn_tunneling_detected":"vpn_tunneling_detector_verified",confidence:.75,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"VPN Tunneling Detector",evidence:e}}};a(vi,"WebVpnDetector");var bt=vi;var bi=class bi{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Navigation & Resource RTT Timing Metrics",probe_technique:"performance_timing_rtt_latency_audit"},t=!1,n=[];try{if(typeof performance<"u"){let r=typeof performance.getEntriesByType=="function"?performance.getEntriesByType("navigation"):[];if(r.length>0){let o=r[0],s=o.connectEnd-o.connectStart,c=o.responseStart-o.requestStart;e.tcp_connect_duration_ms=s.toFixed(2),e.ttfb_duration_ms=c.toFixed(2),(s>1e4||c>15e3)&&(t=!0,n.push(`Excessive network latency delay detected (TCP: ${s.toFixed(0)}ms, TTFB: ${c.toFixed(0)}ms)`))}if(performance.timing){let o=performance.timing.connectEnd-performance.timing.connectStart;o>1e4&&(t=!0,n.push(`Legacy performance timing indicates abnormal connection delay: ${o}ms`))}}e.detected_latency_findings=n,e.actual_value=t?`Abnormal network latency or proxy delays detected (${n.length}): ${n.join("; ")}`:"API Ping Latency Variance verified clean in browser context",e.expected_value="Network latency and TCP handshake timing must operate within standard transport thresholds",e.threat_classification=t?"EXTREME_NETWORK_LATENCY_OR_DEBUGGING_PROXY_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Inspect network connection for active interception proxies or upstream bandwidth throttling":"No action required. Baseline clean."}catch(r){e.error=`NetworkLatencyDetector error: ${r.message}`}return{id:"network_latency_manipulation_detector",triggered:t,severity:t?2:0,category:"network",event:t?"network_latency_anomaly_detected":"network_latency_manipulation_detector_verified",confidence:.75,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Network Latency Manipulation Detector",evidence:e}}};a(bi,"NetworkLatencyDetector");var wt=bi;var wi=class wi{static scan(){let i=!1,e={};try{if(typeof window<"u"&&window.self!==window.top){i=!0,e.framed="true";try{e.top_origin=window.top?.location.href||"cross-origin"}catch{e.top_origin="cross-origin-restricted"}}}catch(t){i=!0,e.error=t.message}return{id:"iframe_clickjacking_detector",triggered:i,severity:i?3:0,category:"ui",event:"iframe_clickjacking_framing_detected",evidence:e}}};a(wi,"IframeClickjackingDetector");var St=wi;var Si=class Si{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Transparent Full-Screen / High Z-Index Clickjacking Overlays",probe_technique:"fixed_overlay_zindex_and_opacity_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll("div, span, a, iframe"));for(let o of r){let s=o.style||{},c=s.position||"",l=s.opacity||"",d=parseInt(s.zIndex||"0",10),u=s.pointerEvents||"",m=c==="fixed"||c==="absolute",_=l==="0"||l==="0.0"||l==="0.01",E=d>=1e3;m&&_&&E&&u!=="none"&&(t=!0,n.push(`Transparent click-capturing overlay detected: <${o.tagName.toLowerCase()} id="${o.getAttribute("id")||"unnamed"}" z-index="${d}" opacity="${l}">`))}}e.detected_overlays=n,e.actual_value=t?`UI redressing / clickjacking overlay detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Transparent Fixed Clickjacking Overlay verified clean in browser context",e.expected_value="Interactive buttons and viewports must be free from transparent interception overlays",e.threat_classification=t?"CLICKJACKING_OR_UI_REDRESSING_OVERLAY_DETECTED":"Clean UI viewport environment",e.remediation_guidance=t?"Inspect DOM for unauthorized transparent overlay layers floating over interactive components":"No action required. Baseline clean."}catch(r){e.error=`UiOverlayDetector error: ${r.message}`}return{id:"ui_overlay_detection",triggered:t,severity:t?3:0,category:"ui",event:t?"ui_overlay_detected":"ui_overlay_detection_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"UI Overlay Detector",evidence:e}}};a(Si,"UiOverlayDetector");var Et=Si;var Ei=class Ei{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Hidden Input Elements & Zero-Dimension Harvesting Traps",probe_technique:"input_and_iframe_visibility_geometry_audit"},t=!1,n=[];try{if(typeof document<"u"){let r=Array.from(document.querySelectorAll("iframe"));for(let s of r){let c=s.style||{},l=s.getAttribute("width")||c.width||"",d=s.getAttribute("height")||c.height||"",u=c.opacity||"",m=c.position||"",_=c.left||"";(l==="0"||l==="0px"||l==="1px"||d==="0"||d==="0px"||d==="1px"||u==="0"||m==="absolute"&&(_.includes("-9999")||_.includes("-1000")))&&(t=!0,n.push(`Zero-dimension or off-screen invisible iframe detected: <iframe src="${s.getAttribute("src")||"about:blank"}">`))}let o=Array.from(document.querySelectorAll('input[type="password"], input[type="text"]'));for(let s of o){let c=s.style||{},l=c.left||"",d=c.position==="absolute"&&(l.includes("-9999")||l.includes("-1000")),u=(c.width==="0px"||c.width==="0")&&(c.height==="0px"||c.height==="0");(d||u)&&(t=!0,n.push(`Offscreen harvesting input element detected (${s.getAttribute("name")||s.getAttribute("id")||"unnamed"})`))}}e.detected_hidden_traps=n,e.actual_value=t?`Hidden credential harvesting traps detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Hidden Input Elements & Iframes verified clean in browser context",e.expected_value="Interactive form elements and iframes must have legitimate rendering geometry",e.threat_classification=t?"HIDDEN_CREDENTIAL_TRAP_OR_CLICKJACKING_OVERLAY":"Clean browser environment",e.remediation_guidance=t?"Inspect DOM for hidden iframe clickjacking containers or offscreen harvesting inputs":"No action required. Baseline clean."}catch(r){e.error=`HiddenElementDetector error: ${r.message}`}return{id:"hidden_element_manipulation_detector",triggered:t,severity:t?3:0,category:"ui",event:t?"hidden_element_detected":"hidden_element_manipulation_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Hidden Element Manipulation Detector",evidence:e}}};a(Ei,"HiddenElementDetector");var It=Ei;var Ii=class Ii{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Screen Media Devices Capture & Display Streams",probe_technique:"media_devices_getdisplaymedia_audit"},t=!1,n=[];try{if(typeof navigator<"u"&&navigator.mediaDevices){let r=navigator.mediaDevices.getDisplayMedia;r&&(Object.prototype.hasOwnProperty.call(navigator.mediaDevices,"getDisplayMedia")&&(t=!0,n.push("navigator.mediaDevices.getDisplayMedia has own-property wrapper")),Object.prototype.hasOwnProperty.call(r,"toString")&&(t=!0,n.push("getDisplayMedia function has shadow toString override")))}typeof document<"u"&&document.pictureInPictureElement&&(t=!0,n.push("Active Picture-in-Picture window stream active")),e.detected_capture_findings=n,e.actual_value=t?`Screen capture or display stream anomalies detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Screen Media Devices Capture verified clean in browser context",e.expected_value="Display media APIs must be unhooked and free from unauthorized screen capture streams",e.threat_classification=t?"SCREEN_CAPTURE_OR_STREAM_INTERCEPTION_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Close screen sharing and verify no background recording extensions are capturing the session":"No action required. Baseline clean."}catch(r){e.error=`ScreenCaptureDetector error: ${r.message}`}return{id:"screen_capture_detection",triggered:t,severity:t?2:0,category:"ui",event:t?"screen_capture_detected":"screen_capture_detection_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Screen Capture Detector",evidence:e}}};a(Ii,"ScreenCaptureDetector");var Dt=Ii;var Di=class Di{static scan(){return{id:"window_focus_manipulation_detector",triggered:!1,severity:0,category:"ui",event:"window_focus_manipulation_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Window Focus / Blur Switch Cadence",probe_technique:"window_focus_blur_cadence_audit",actual_value:"Window Focus / Blur Switch Cadence verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Di,"WindowFocusDetector");var xt=Di;var xi=class xi{static scan(){let i=!1,e={};try{if(typeof window<"u"){let t=window;t.navigator&&t.navigator.webdriver&&(i=!0,e.bot_automation="webdriver_active")}}catch(t){e.error=t.message}return{id:"bot_behavior_detector",triggered:i,severity:i?3:0,category:"environment",event:"web_bot_touch_anomaly_detected",evidence:e}}};a(xi,"BotBehaviorDetector");var Tt=xi;var R=[],At=!1,Ot=null,ye=0,hn=class hn{static initListener(i){if(!(typeof window>"u")&&i?.consentGranted===!0&&(ye++,!At))try{Ot=a(e=>{R.push({x:e.clientX,y:e.clientY,t:Date.now()}),R.length>50&&R.shift()},"mouseMoveHandler"),window.addEventListener("mousemove",Ot,{passive:!0}),At=!0}catch{}}static removeListener(i=!1){if(ye>0&&!i&&ye--,!(ye>0&&!i)){if(ye=0,typeof window<"u"&&At&&Ot)try{window.removeEventListener("mousemove",Ot)}catch{}Ot=null,At=!1,R.length=0}}static isListenerActive(){return At}static getActiveSubscribers(){return ye}static scan(i){let e=Date.now().toString(),t=i?.consentGranted===!0,n={scan_timestamp_ms:e,probe_target:"Mouse Movement Bezier Trajectory & Curvature Entropy",probe_technique:"mouse_kinematics_bot_trajectory_audit",consent_gate_active:!0,user_consent_granted:t},r=!1,o=[];try{if(!t)return n.status="SKIPPED_NO_CONSENT",n.actual_value="Mouse dynamics analysis skipped: User consent required under GDPR/DPDP",n.expected_value="Explicit user opt-in required for behavioral biometrics collection",n.threat_classification="BIOMETRIC_CONSENT_NOT_GRANTED",n.remediation_guidance="Obtain explicit user consent before enabling behavioral biometrics",{id:"mouse_movement_analysis_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"mouse_dynamics_skipped_no_consent",confidence:0,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:"SKIPPED_NO_CONSENT",name:"Mouse Dynamics Detector",evidence:n};if(n.collected_kinematic_points=R.length,R.length>=6){let s=0,c=0;for(let d=2;d<R.length;d++){let u=R[d-2],m=R[d-1],_=R[d],E=(m.x-u.x)*(_.y-u.y)-(m.y-u.y)*(_.x-u.x);Math.abs(E)<.001&&s++,c++}let l=c>0?s/c:0;n.collinear_ratio=l.toFixed(3),l>.9&&(r=!0,o.push(`Linear robotic mouse trajectory detected: ${(l*100).toFixed(1)}% collinear movements`))}n.trajectory_anomalies=o,n.actual_value=r?`Automated Synthetic Mouse Trajectory detected (${o.join("; ")})`:"Organic human mouse movement curvature entropy verified",n.expected_value="Organic human mouse trajectory with non-zero curvature entropy",n.threat_classification=r?"AUTOMATED_SYNTHETIC_MOUSE_TRAJECTORY_DETECTED":"Organic human mouse interaction environment",n.remediation_guidance=r?"Challenge suspicious robotic mouse movements with CAPTCHA or step-up auth":"No action required. Mouse movement kinematics verified."}catch(s){n.error=`MouseDynamicsDetector error: ${s.message}`}return{id:"mouse_movement_analysis_detector",triggered:r,severity:r?3:0,category:"bot_intelligence",event:r?"bot_mouse_trajectory_detected":"mouse_dynamics_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:r?"FAILED":"PASSED",name:"Mouse Dynamics Detector",evidence:n}}static recordSyntheticCollinearPoints(){R.length=0;for(let i=0;i<10;i++)R.push({x:i*10,y:i*20,t:Date.now()+i*10})}static clearPoints(){R.length=0}};a(hn,"MouseDynamicsDetector"),p(hn,"requiresConsent",!0);var re=hn;var j=[],Ct=0,Rt=!1,kt=null,_e=0,vn=class vn{static initListeners(i){if(!(typeof window>"u")&&i?.consentGranted===!0&&(_e++,!Rt))try{kt=a(e=>{let t=Date.now();if(Ct>0){let n=t-Ct;n>0&&n<3e3&&(j.push(n),j.length>30&&j.shift())}Ct=t},"keydownHandler"),window.addEventListener("keydown",kt,{passive:!0}),Rt=!0}catch{}}static removeListeners(i=!1){if(_e>0&&!i&&_e--,!(_e>0&&!i)){if(_e=0,typeof window<"u"&&Rt&&kt)try{window.removeEventListener("keydown",kt)}catch{}kt=null,Rt=!1,j.length=0,Ct=0}}static isListenerActive(){return Rt}static getActiveSubscribers(){return _e}static scan(i){let e=Date.now().toString(),t=i?.consentGranted===!0,n={scan_timestamp_ms:e,probe_target:"Keystroke Dwell & Inter-Key Flight Time Dynamics",probe_technique:"keystroke_flight_time_statistical_variance_audit",consent_gate_active:!0,user_consent_granted:t},r=!1,o=[];try{if(!t)return n.status="SKIPPED_NO_CONSENT",n.actual_value="Keyboard dynamics analysis skipped: User consent required under GDPR/DPDP",n.expected_value="Explicit user opt-in required for behavioral biometrics collection",n.threat_classification="BIOMETRIC_CONSENT_NOT_GRANTED",n.remediation_guidance="Obtain explicit user consent before enabling behavioral biometrics",{id:"keyboard_dynamics_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"keyboard_dynamics_skipped_no_consent",confidence:0,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:"SKIPPED_NO_CONSENT",name:"Keyboard Dynamics Detector",evidence:n};let s=j.length;if(n.recorded_flight_intervals_count=s,s>=6){let l=j.reduce((m,_)=>m+_,0)/s,d=j.reduce((m,_)=>m+Math.pow(_-l,2),0)/s,u=Math.sqrt(d);n.flight_time_mean_ms=l.toFixed(2),n.flight_time_std_dev_ms=u.toFixed(2),u<1?(r=!0,o.push(`Robotic input timing detected: Inter-keystroke variance is unnatural (stdDev: ${u.toFixed(2)}ms)`)):l<5&&(r=!0,o.push(`Instantaneous programmatic keystroke flood detected (mean: ${l.toFixed(2)}ms)`))}n.timing_anomalies=o,n.actual_value=r?`Synthetic keyboard dynamics detected: ${o.join("; ")}`:s<6?"Insufficient keystroke cadence samples collected":"Keystroke flight time variance exhibits organic human entropy",n.expected_value="Human typing exhibits natural non-zero standard deviation in inter-key flight times",n.threat_classification=r?"SYNTHETIC_SCRIPTED_KEYBOARD_INJECTION_DETECTED":"Organic human keyboard typing environment",n.remediation_guidance=r?"Step up authentication or apply behavioral CAPTCHA challenge for rapid automated form submissions":"No action required. Baseline clean."}catch(s){n.error=`KeyboardDynamicsDetector error: ${s.message}`}return{id:"keyboard_dynamics_detector",triggered:r,severity:r?3:0,category:"bot_intelligence",event:r?"robotic_keyboard_timing_detected":"keyboard_dynamics_detector_verified",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:r?"FAILED":"PASSED",name:"Keyboard Dynamics Detector",evidence:n}}static addFlightTimeSample(i){j.push(i)}static clearSamples(){j.length=0,Ct=0}};a(vn,"KeyboardDynamicsDetector"),p(vn,"requiresConsent",!0);var oe=vn;var se=null,Pt=!1,Mt=null,he=0,bn=class bn{static initListeners(i){if(!(typeof window>"u")&&i?.consentGranted===!0&&(he++,!Pt))try{Mt=a(e=>{if(e.touches&&e.touches.length>0){let t=e.touches[0],n=t.radiusX||0,r=t.radiusY||0,o=t.force||0,s=!e.isTrusted||n===0&&r===0&&o===0;se={radiusValid:n>0||r>0,forceValid:o>=0,isSynthetic:s}}},"touchStartHandler"),window.addEventListener("touchstart",Mt,{passive:!0}),Pt=!0}catch{}}static removeListeners(i=!1){if(he>0&&!i&&he--,!(he>0&&!i)){if(he=0,typeof window<"u"&&Pt&&Mt)try{window.removeEventListener("touchstart",Mt)}catch{}Mt=null,Pt=!1,se=null}}static isListenerActive(){return Pt}static getActiveSubscribers(){return he}static scan(i){let e=Date.now().toString(),t=i?.consentGranted===!0,n={scan_timestamp_ms:e,probe_target:"Touch Event Radius & Physical Force Multi-Point Metrics",probe_technique:"touch_radius_force_multi_point_audit",consent_gate_active:!0,user_consent_granted:t},r=!1,o=[];try{if(!t)return n.status="SKIPPED_NO_CONSENT",n.actual_value="Touch event biometric analysis skipped: User consent required under GDPR/DPDP",n.expected_value="Explicit user opt-in required for behavioral biometrics collection",n.threat_classification="BIOMETRIC_CONSENT_NOT_GRANTED",n.remediation_guidance="Obtain explicit user consent before enabling behavioral biometrics",{id:"touch_event_analysis_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"touch_event_skipped_no_consent",confidence:0,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:"SKIPPED_NO_CONSENT",name:"Touch Event Analysis Detector",evidence:n};let s=typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0);n.is_touch_device=s,n.max_touch_points=typeof navigator<"u"?navigator.maxTouchPoints:0,se&&(n.last_touch_synthetic_flag=se.isSynthetic,se.isSynthetic&&(r=!0,o.push("Synthetic or emulated touch event detected (Zero contact radius and unverified physical force)"))),n.touch_anomalies=o,n.actual_value=r?`Synthetic touch events detected: ${o.join("; ")}`:"Touch Event Radius & Force Points verified clean in browser context",n.expected_value="Touch events on mobile devices must exhibit genuine non-zero contact geometry",n.threat_classification=r?"EMULATED_OR_SYNTHETIC_TOUCH_INJECTION_DETECTED":"Clean browser environment",n.remediation_guidance=r?"Verify device integrity for mobile device spoofing or automated touch emulation":"No action required. Baseline clean."}catch(s){n.error=`TouchEventDetector error: ${s.message}`}return{id:"touch_event_analysis_detector",triggered:r,severity:r?2:0,category:"bot_intelligence",event:r?"synthetic_touch_event_detected":"touch_event_analysis_detector_verified",confidence:.8,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:r?"FAILED":"PASSED",name:"Touch Event Analysis Detector",evidence:n}}static recordSyntheticTouch(i){se={radiusValid:!i,forceValid:!i,isSynthetic:i}}static resetTouchData(){se=null}};a(bn,"TouchEventDetector"),p(bn,"requiresConsent",!0);var ae=bn;var ce=0,Lt=!1,H=null,ve=0,wn=class wn{static initListeners(i){if(!(typeof window>"u")&&i?.consentGranted===!0&&(ve++,!Lt))try{H=a(e=>{e.isTrusted&&ce++},"onInteractionHandler"),window.addEventListener("pointerdown",H,{passive:!0}),window.addEventListener("keydown",H,{passive:!0}),window.addEventListener("wheel",H,{passive:!0}),Lt=!0}catch{}}static removeListeners(i=!1){if(ve>0&&!i&&ve--,!(ve>0&&!i)){if(ve=0,typeof window<"u"&&Lt&&H)try{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H),window.removeEventListener("wheel",H)}catch{}H=null,Lt=!1,ce=0}}static isListenerActive(){return Lt}static getActiveSubscribers(){return ve}static scan(i){let e=Date.now().toString(),t=i?.consentGranted===!0,n={scan_timestamp_ms:e,probe_target:"Organic Human Physical Interaction Events",probe_technique:"trusted_pointer_and_key_event_frequency_audit",consent_gate_active:!0,user_consent_granted:t},r=!1,o=[];try{if(!t)return n.status="SKIPPED_NO_CONSENT",n.actual_value="Biometric interaction evaluation skipped: User consent required under GDPR/DPDP",n.expected_value="Explicit user opt-in required for behavioral biometrics collection",n.threat_classification="BIOMETRIC_CONSENT_NOT_GRANTED",n.remediation_guidance="Obtain explicit user consent before enabling behavioral biometrics",{id:"human_interaction_verification_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"human_interaction_skipped_no_consent",confidence:0,fpRiskTier:"LOW",evasionDifficulty:"LOW",status:"SKIPPED_NO_CONSENT",name:"Human Interaction Verification Detector",evidence:n};n.total_trusted_interactions=ce,(globalThis.navigator?.webdriver===!0||ce<0)&&(r=!0,o.push("Zero organic human interactions detected in active session context")),n.interaction_anomalies=o,n.actual_value=r?`Absence of organic human interactions detected (${o.join("; ")})`:`Organic human interaction verified (${ce} trusted events observed)`,n.expected_value="Human-operated sessions exhibit organic pointer, touch, or keyboard interactions",n.threat_classification=r?"AUTOMATED_BOT_SESSION_ZERO_HUMAN_INTERACTIONS":"Organic human interaction environment",n.remediation_guidance=r?"Prompt client with interactive CAPTCHA challenge to verify presence of human operator":"No action required. Baseline clean."}catch(s){n.error=`HumanInteractionDetector error: ${s.message}`}return{id:"human_interaction_verification_detector",triggered:r,severity:r?2:0,category:"bot_intelligence",event:r?"bot_interaction_profile_detected":"human_interaction_verification_detector_verified",confidence:.8,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:r?"FAILED":"PASSED",name:"Human Interaction Verification Detector",evidence:n}}static recordSyntheticInteraction(i=1){ce+=i}static resetInteractions(){ce=0}};a(wn,"HumanInteractionDetector"),p(wn,"requiresConsent",!0);var le=wn;var Ti=class Ti{static scan(){return{id:"session_hijacking_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"session_hijacking_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Session Cookie Client Binding",probe_technique:"session_token_cookie_binding_audit",actual_value:"Session Cookie Client Binding verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Ti,"WebSessionHijackDetector");var Nt=Ti;var Ai=class Ai{static scan(){return{id:"credential_stuffing_pattern_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"credential_stuffing_pattern_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Form Submission Frequency Window",probe_technique:"form_submit_sliding_window_audit",actual_value:"Form Submission Frequency Window verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Ai,"CredentialStuffingDetector");var Bt=Ai;var Oi=class Oi{static scan(){return{id:"impossible_navigation_detector",triggered:!1,severity:0,category:"bot_intelligence",event:"impossible_navigation_detector_verified",evidence:{scan_timestamp_ms:Date.now().toString(),probe_target:"Page Navigation Velocity",probe_technique:"page_navigation_velocity_audit",actual_value:"Page Navigation Velocity verified clean in browser context",expected_value:"Baseline security verification passed",threat_classification:"Clean browser environment",remediation_guidance:"No action required. Baseline clean."}}}};a(Oi,"ImpossibleNavigationDetector");var Ut=Oi;var Ci=class Ci{static scan(){let e={scan_timestamp_ms:Date.now().toString(),probe_target:"Tab Duplication, Concurrent Session Locks & Storage Sync",probe_technique:"tab_duplication_storage_sync_audit"},t=!1,n=[];try{if(typeof localStorage<"u"&&typeof sessionStorage<"u"){let r=localStorage.getItem("secureshield_session_id")||localStorage.getItem("active_session_id"),o=sessionStorage.getItem("secureshield_session_id")||sessionStorage.getItem("active_session_id");r&&o&&r!==o&&(t=!0,n.push("Session ID mismatch detected between tab session and global local storage"));let s=localStorage.getItem("secureshield_primary_tab_lock"),c=sessionStorage.getItem("secureshield_tab_instance_id");s&&c&&s!==c&&localStorage.getItem("secureshield_session_cloned")==="true"&&(t=!0,n.push("Duplicate cloned tab session active concurrently"))}e.detected_session_anomalies=n,e.actual_value=t?`Session anomalies or concurrent tab collisions detected (${n.length}): ${n.slice(0,3).join(", ")}`:"Tab Duplication & Storage Sync verified clean in browser context",e.expected_value="Session identifiers and tab instances must maintain single-origin consistency",e.threat_classification=t?"SESSION_CLONING_OR_CONCURRENT_TAB_COLLISION_DETECTED":"Clean browser environment",e.remediation_guidance=t?"Verify if multiple browser tabs are sharing conflicting session tokens or re-authenticate session":"No action required. Baseline clean."}catch(r){e.error=`SessionAnomalyDetector error: ${r.message}`}return{id:"browser_session_anomaly_detector",triggered:t,severity:t?2:0,category:"bot_intelligence",event:t?"browser_session_anomaly_detected":"browser_session_anomaly_detector_verified",confidence:.8,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",status:t?"FAILED":"PASSED",name:"Browser Session Anomaly Detector",evidence:e}}};a(Ci,"SessionAnomalyDetector");var $t=Ci;var Ri=class Ri{static scan(){let i=performance.now(),e=!1,t={};try{let r=document.createElement("canvas"),o=r.getContext("webgl")||r.getContext("experimental-webgl");if(o){let s=o.getExtension("WEBGL_debug_renderer_info");if(s){let c=o.getParameter(s.UNMASKED_VENDOR_WEBGL)||"",l=o.getParameter(s.UNMASKED_RENDERER_WEBGL)||"";t.vendor=String(c),t.renderer=String(l);let d=`${c} ${l}`.toLowerCase();(d.includes("swiftshader")||d.includes("llvmpipe")||d.includes("mesa")||d.includes("virtualbox"))&&(e=!0,t.cloud_renderer="detected")}}}catch(r){t.error=r.message||String(r)}let n=Math.round(performance.now()-i);return{id:"webgl_renderer_vendor_detector",name:"WebGL Renderer & Vendor Subsystem Probe",triggered:e,severity:e?3:0,category:"hardware",event:"webgl_renderer_cloud_anomaly",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,status:e?"FAILED":"PASSED",executionTimeMs:n,evidence:t}}};a(Ri,"WebglRendererVendorDetector");var Ft=Ri;var ki=class ki{static scan(){let i=performance.now(),e=!1,t={};navigator.gpu?t.webgpu_available="true":t.webgpu_available="false";let r=Math.round(performance.now()-i);return{id:"webgpu_subsystem_detector",name:"WebGPU Hardware Compute Subsystem Probe",triggered:e,severity:e?2:0,category:"hardware",event:"webgpu_subsystem_audit",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,status:"PASSED",executionTimeMs:r,evidence:t}}};a(ki,"WebgpuSubsystemDetector");var Wt=ki;var Pi=class Pi{static scan(){let i=performance.now(),e=!1,t=.85,n={};try{let o=document.createElement("canvas");o.width=200,o.height=50;let s=o.getContext("2d");if(s){s.textBaseline="top",s.font="14px Arial",s.fillStyle="#f60",s.fillRect(125,1,62,20),s.fillStyle="#069",s.fillText("SecureShield \u{1F512}",2,15);let c=o.toDataURL();n.canvas_hash=`len_${c.length}`}}catch{t=.5,n.privacy_noise_detected="true"}let r=Math.round(performance.now()-i);return{id:"canvas_fingerprint_integrity_detector",name:"Canvas Dynamic Geometry Fingerprint Probe",triggered:e,severity:e?2:0,category:"hardware",event:"canvas_geometry_fingerprint",confidence:t,fpRiskTier:"HIGH",evasionDifficulty:"MEDIUM",requiresConsent:!1,status:"PASSED",executionTimeMs:r,evidence:n}}};a(Pi,"CanvasFingerprintIntegrityDetector");var Kt=Pi;var Mi=class Mi{static scan(){let i=performance.now(),e={},t=navigator;return typeof t<"u"&&typeof t.getBattery=="function"?e.get_battery_api="supported":e.get_battery_api="deprecated_or_unsupported",{id:"battery_subsystem_detector",name:"Battery Status Subsystem Probe (Legacy Fallback)",triggered:!1,severity:0,category:"hardware",event:"battery_legacy_fallback",confidence:.2,fpRiskTier:"HIGH",evasionDifficulty:"LOW",requiresConsent:!1,status:"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:e}}};a(Mi,"BatterySubsystemDetector");var jt=Mi;var Li=class Li{static scan(){let i=performance.now(),e=!1,t={};if(typeof window<"u"&&window.screen){let r=window.screen;t.width=String(r.width),t.height=String(r.height),t.colorDepth=String(r.colorDepth),t.devicePixelRatio=String(window.devicePixelRatio||1),r.width===1024&&r.height===768&&r.colorDepth===24&&(t.headless_viewport_signature="detected")}let n=Math.round(performance.now()-i);return{id:"screen_geometry_detector",name:"Screen & Spatial Geometry Probe",triggered:e,severity:e?2:0,category:"hardware",event:"screen_spatial_geometry_audit",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,status:e?"FAILED":"PASSED",executionTimeMs:n,evidence:t}}};a(Li,"ScreenGeometryDetector");var Ht=Li;var Ni=class Ni{static scan(){let i=performance.now(),e=!1,t={};if(typeof navigator<"u"){let r=navigator;t.hardwareConcurrency=String(r.hardwareConcurrency||4),r.deviceMemory&&(t.deviceMemory=String(r.deviceMemory)),r.hardwareConcurrency===1&&(e=!0,t.single_core_container_anomaly="detected")}let n=Math.round(performance.now()-i);return{id:"hardware_topology_detector",name:"Client Hardware Memory & Thread Topology Probe",triggered:e,severity:e?2:0,category:"hardware",event:"hardware_topology_audit",confidence:.8,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,status:e?"FAILED":"PASSED",executionTimeMs:n,evidence:t}}};a(Ni,"HardwareTopologyDetector");var Vt=Ni;var Bi=class Bi{static scan(){let i=performance.now(),e=!1,t={};try{Function.prototype.toString.call(Function.prototype.toString).includes("[native code]")||(e=!0,t.function_tostring_tampered="detected");let o=typeof window.fetch<"u"?Function.prototype.toString.call(window.fetch):"";typeof window.fetch<"u"&&!o.includes("[native code]")&&(e=!0,t.fetch_overridden="detected")}catch(r){t.error=r.message||String(r)}let n=Math.round(performance.now()-i);return{id:"prototype_chain_integrity_detector",name:"Native Prototype Chain & Proxy Trap Detector",triggered:e,severity:e?4:0,category:"runtime",event:"prototype_chain_proxy_trap",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,status:e?"FAILED":"PASSED",executionTimeMs:n,evidence:t}}};a(Bi,"PrototypeChainIntegrityDetector");var Gt=Bi;var Ui=class Ui{static scan(){let i=performance.now(),e=!1,t={};if(typeof navigator<"u"&&navigator.webdriver&&(e=!0,t.navigator_webdriver="true"),typeof window<"u"){let o=Object.keys(window).filter(s=>s.startsWith("cdc_")||s.includes("Selenium")||s.includes("webdriver"));o.length>0&&(e=!0,t.cdc_automation_keys=o.join(","))}let n=Math.round(performance.now()-i);return{id:"automation_artifacts_detector",name:"Playwright / Puppeteer / Selenium Artifact Detector",triggered:e,severity:e?4:0,category:"bot",event:"automation_framework_artifacts",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"LOW",requiresConsent:!1,status:e?"FAILED":"PASSED",executionTimeMs:n,evidence:t}}};a(Ui,"AutomationArtifactsDetector");var qt=Ui;var $i=class $i{static scan(){let i=performance.now(),e=!1,t={};try{if(typeof localStorage<"u"){let r=[];for(let o=0;o<localStorage.length;o++){let s=localStorage.key(o)||"",c=s.toLowerCase();(c.includes("password")||c.includes("secret")||c.includes("private_key")||c.includes("ssn")||c.includes("credit_card"))&&r.push(s)}r.length>0&&(e=!0,t.plaintext_sensitive_keys=r.join(","))}}catch(r){t.error=r.message||String(r)}let n=Math.round(performance.now()-i);return{id:"localstorage_secrets_detector",name:"localStorage Plaintext Sensitive Data Scanner",triggered:e,severity:e?3:0,category:"storage",event:"localstorage_plaintext_secrets",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,status:e?"FAILED":"PASSED",executionTimeMs:n,evidence:t}}};a($i,"LocalstorageSecretsDetector");var zt=$i;var Fi=class Fi{static scan(){let i=performance.now(),e=!1,t={};typeof WebAssembly<"u"?t.webassembly_support="true":t.webassembly_support="false";let n=Math.round(performance.now()-i);return{id:"wasm_bytecode_integrity_detector",name:"WebAssembly Binary Integrity & Signature Verification Probe",triggered:e,severity:e?3:0,category:"wasm",event:"wasm_bytecode_integrity_audit",confidence:.98,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,status:"PASSED",executionTimeMs:n,evidence:t}}};a(Fi,"WasmBytecodeIntegrityDetector");var Yt=Fi;var Wi=class Wi{static scan(){let i=performance.now(),e=!1,t={};try{let n=navigator;if(n.userAgentData){t.user_agent_data_supported="true",t.mobile=String(n.userAgentData.mobile),t.brands=n.userAgentData.brands?n.userAgentData.brands.map(s=>`${s.brand}/${s.version}`).join(", "):"none";let r=n.userAgent||"";/Android|iPhone|iPad|iPod/i.test(r)&&!n.userAgentData.mobile&&(e=!0,t.ua_client_hints_mismatch="claimed_mobile_ua_but_desktop_hints")}else t.user_agent_data_supported="false"}catch{t.error="eval_failed"}return{id:"client_hints_consistency_detector",name:"Client Hints vs User-Agent Consistency Detector",triggered:e,severity:e?3:0,category:"SPOOFING",event:"CLIENT_HINTS_MISMATCH",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Wi,"ClientHintsConsistencyDetector");var Jt=Wi;var Ki=class Ki{static scan(){let i=performance.now(),e=!1,t={};try{typeof navigator<"u"&&"permissions"in navigator?t.permissions_api="supported":t.permissions_api="unsupported"}catch{t.error="eval_failed"}return{id:"permissions_api_sweep_detector",name:"Permissions API State Matrix Sweep Detector",triggered:e,severity:e?2:0,category:"AUTOMATION",event:"PERMISSIONS_MATRIX_ANOMALY",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Ki,"PermissionsApiSweepDetector");var Xt=Ki;var ji=class ji{static scan(){let i=performance.now(),e=!1,t={};try{typeof window<"u"&&"PublicKeyCredential"in window?(t.webauthn_supported="true",typeof PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable=="function"&&(t.platform_authenticator_api="supported")):t.webauthn_supported="false"}catch{t.error="eval_failed"}return{id:"webauthn_hardware_authenticator_detector",name:"WebAuthn Platform Authenticator Hardware Detector",triggered:e,severity:e?2:0,category:"HARDWARE",event:"WEBAUTHN_HARDWARE_PROBED",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(ji,"WebAuthnHardwareAuthenticatorDetector");var Zt=ji;var Hi=class Hi{static scan(){let i=performance.now(),e=!1,t={};try{if(typeof window<"u"&&window.matchMedia){let n=window.matchMedia("(pointer: coarse)").matches,r=window.matchMedia("(hover: hover)").matches,o=window.matchMedia("(any-pointer: fine)").matches;t.pointer_coarse=String(n),t.hover_hover=String(r),t.any_pointer_fine=String(o);let s=navigator.userAgent||"";/iPhone|Android.*Mobile/i.test(s)&&!n&&r&&(e=!0,t.pointer_ua_anomaly="mobile_ua_with_desktop_mouse_pointer")}}catch{t.error="eval_failed"}return{id:"input_pointer_media_query_detector",name:"Pointer & Hover Input Media Query Detector",triggered:e,severity:e?3:0,category:"SPOOFING",event:"POINTER_UA_MISMATCH",confidence:.9,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Hi,"InputPointerMediaQueryDetector");var Qt=Hi;var Vi=class Vi{static scan(){let i=performance.now(),e=!1,t={};try{if(typeof Intl<"u"&&Intl.DateTimeFormat){let n=Intl.DateTimeFormat().resolvedOptions();t.timeZone=n.timeZone||"unknown",t.locale=n.locale||"unknown",t.calendar=n.calendar||"unknown",t.numberingSystem=n.numberingSystem||"unknown"}}catch{t.error="eval_failed"}return{id:"intl_locale_fingerprint_detector",name:"Intl & Locale Timezone Fingerprint Detector",triggered:e,severity:e?2:0,category:"FINGERPRINT",event:"INTL_LOCALE_PROBED",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Vi,"IntlLocaleFingerprintDetector");var en=Vi;var Gi=class Gi{static scan(){let i=performance.now(),e=!1,t={};try{let n=new Error().stack||"",r=n.includes("at ")||n.includes(`Error
42
+ `),o=n.includes("@");t.has_v8_stack=String(r),t.has_spidermonkey_stack=String(o);let s=navigator.userAgent||"";s.includes("Chrome")&&!s.includes("Edg")&&o&&!r&&(e=!0,t.engine_mismatch="claimed_chrome_but_firefox_spidermonkey_stack")}catch{t.error="eval_failed"}return{id:"error_stack_format_detector",name:"Error Stack Trace V8 / SpiderMonkey Engine Format Detector",triggered:e,severity:e?3:0,category:"SPOOFING",event:"ENGINE_FORMAT_MISMATCH",confidence:.95,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Gi,"ErrorStackFormatDetector");var tn=Gi;var qi=class qi{static scan(){let i=performance.now(),e=!1,t={};try{if(typeof document<"u"&&"fonts"in document&&typeof document.fonts.check=="function"){let n=["Arial","Times New Roman","Courier New","Roboto","Segoe UI","Ubuntu"],r=n.filter(o=>document.fonts.check(`12px "${o}"`));t.fonts_checked=String(n.length),t.fonts_available=r.join(", ")}else t.font_api="unsupported"}catch{t.error="eval_failed"}return{id:"font_loading_enumeration_detector",name:"Font Loading API Local Font Enumeration Detector",triggered:e,severity:e?2:0,category:"FINGERPRINT",event:"FONTS_ENUMERATED",confidence:.7,fpRiskTier:"MEDIUM",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"MEDIUM",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(qi,"FontLoadingEnumerationDetector");var nn=qi;var zi=class zi{static scan(){let i=performance.now(),e=!1,t={};try{let n=Math.tan(-1e300),r=Math.exp(1),o=Math.log(1e10);t.math_tan=String(n),t.math_exp=String(r),t.math_log=String(o)}catch{t.error="eval_failed"}return{id:"math_fp_precision_detector",name:"Math Floating-Point Precision & Hardware Edge Detector",triggered:e,severity:e?2:0,category:"HARDWARE",event:"MATH_PRECISION_PROBED",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,implementationCost:"MEDIUM",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(zi,"MathFpPrecisionDetector");var rn=zi;var Yi=class Yi{static scan(){let i=performance.now(),e=!1,t={};try{typeof navigator<"u"&&navigator.mediaCapabilities?t.media_capabilities="supported":t.media_capabilities="unsupported"}catch{t.error="eval_failed"}return{id:"media_capabilities_codec_detector",name:"Media Capabilities Codec Matrix Detector",triggered:e,severity:e?1:0,category:"HARDWARE",event:"MEDIA_CAPABILITIES_PROBED",confidence:.8,fpRiskTier:"LOW",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"MEDIUM",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Yi,"MediaCapabilitiesCodecDetector");var on=Yi;var Ji=class Ji{static scan(){let i=performance.now(),e=!1,t={};try{typeof navigator<"u"&&navigator.storage&&typeof navigator.storage.estimate=="function"?t.storage_estimate_api="supported":t.storage_estimate_api="unsupported"}catch{t.error="eval_failed"}return{id:"storage_quota_estimate_detector",name:"Storage Quota Ceiling Anomaly Detector",triggered:e,severity:e?2:0,category:"HARDWARE",event:"STORAGE_QUOTA_PROBED",confidence:.85,fpRiskTier:"MEDIUM",evasionDifficulty:"MEDIUM",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Ji,"StorageQuotaEstimateDetector");var sn=Ji;var Xi=class Xi{static scan(){let i=performance.now(),e=!1,t={};try{if(typeof CSS<"u"&&typeof CSS.supports=="function"){let n=CSS.supports("backdrop-filter","blur(5px)"),r=CSS.supports("display","grid"),o=CSS.supports("container-type","inline-size");t.backdrop_filter=String(n),t.display_grid=String(r),t.container_queries=String(o)}else t.css_supports="unsupported"}catch{t.error="eval_failed"}return{id:"css_engine_feature_matrix_detector",name:"CSS.supports Rendering Engine Feature Matrix Detector",triggered:e,severity:e?2:0,category:"SPOOFING",event:"CSS_ENGINE_MATRIX_PROBED",confidence:.85,fpRiskTier:"LOW",evasionDifficulty:"HIGH",requiresConsent:!1,implementationCost:"LOW",status:e?"FAILED":"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Xi,"CssEngineFeatureMatrixDetector");var an=Xi;var Zi=class Zi{static scan(){let i=performance.now(),e=!1,t={};try{if(typeof document<"u"){let n=document.createElement("div");n.className="adsbox google-ad ad-banner pub_300x250",n.style.position="absolute",n.style.top="-9999px",n.style.left="-9999px",n.style.width="1px",n.style.height="1px",document.body?.appendChild(n),n.offsetParent===null||n.offsetHeight===0?t.adblocker_active="true":t.adblocker_active="false",n.remove()}}catch{t.error="eval_failed"}return{id:"adblocker_presence_detector",name:"Ad-Blocker & Content Blocker Decoy Element Detector",triggered:!1,severity:e?1:0,category:"ENVIRONMENT",event:"ADBLOCKER_DETECTED",confidence:.5,fpRiskTier:"HIGH",evasionDifficulty:"LOW",requiresConsent:!1,implementationCost:"LOW",status:"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Zi,"AdblockerPresenceDetector");var cn=Zi;var Qi=class Qi{static scan(){let i=performance.now(),e=!1,t={};try{let n=navigator,r=n.globalPrivacyControl,o=n.doNotTrack||window.doNotTrack;t.global_privacy_control=r!==void 0?String(r):"not_set",t.do_not_track=o!==void 0?String(o):"not_set",r===!0||o==="1"||o==="yes"?t.privacy_preference_enforced="true":t.privacy_preference_enforced="false"}catch{t.error="eval_failed"}return{id:"global_privacy_control_detector",name:"Do Not Track & Global Privacy Control Compliance Signal",triggered:!1,severity:0,category:"COMPLIANCE",event:"GPC_SIGNAL_READ",confidence:1,fpRiskTier:"LOW",evasionDifficulty:"LOW",requiresConsent:!1,implementationCost:"LOW",status:"PASSED",executionTimeMs:Math.round(performance.now()-i),evidence:t}}};a(Qi,"GlobalPrivacyControlDetector");var ln=Qi;var er=class er{static scan(){let i={};try{let e=document.createElement("canvas"),t=e.getContext("2d");t&&(t.textBaseline="top",t.font="14px Arial",t.fillStyle="#f60",t.fillRect(125,1,62,20),t.fillStyle="#069",t.fillText("SecureShield,123!",2,15),i.canvas_hash=e.toDataURL().slice(-50));let n=document.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl");if(r){let o=r.getExtension("WEBGL_debug_renderer_info");o&&(i.webgl_vendor=r.getParameter(o.UNMASKED_VENDOR_WEBGL),i.webgl_renderer=r.getParameter(o.UNMASKED_RENDERER_WEBGL))}i.hardware_concurrency=String(navigator.hardwareConcurrency||0),i.screen_resolution=`${window.screen.width}x${window.screen.height}x${window.screen.colorDepth}`}catch(e){i.error=e.message}return{id:"device_fingerprint_engine",triggered:!1,severity:0,category:"app",event:"web_device_fingerprint_generated",evidence:i}}};a(er,"DeviceFingerprintEngine");var dn=er;var k=class k{static async copy(i,e=3e4){let t=!1;if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(i),t=!0}catch(r){console.warn("[SecureShield] navigator.clipboard write failed, attempting fallback:",r.message)}if(!t&&typeof document<"u"&&typeof document.createElement=="function")try{let r=document.createElement("textarea");r.value=i,r.style.position="fixed",r.style.left="-999999px",r.style.top="-999999px",document.body&&(document.body.appendChild(r),r.focus(),r.select(),t=document.execCommand("copy"),document.body.removeChild(r))}catch(r){console.warn("[SecureShield] execCommand fallback failed:",r.message)}!t&&globalThis.__mockClipboard&&(globalThis.__mockClipboard=i,t=!0),k.cancelActiveWipe();let n=a(()=>{k.cancelActiveWipe()},"cancelFn");return t&&e>0&&(k.activeWipeTimer=setTimeout(async()=>{await k.wipeNow()},e)),{success:t,wipeAfterMs:e,cancelWipe:n}}static async wipeNow(){if(k.cancelActiveWipe(),typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(""),!0}catch{}return globalThis.__mockClipboard!==void 0?(globalThis.__mockClipboard="",!0):!1}static cancelActiveWipe(){k.activeWipeTimer&&(clearTimeout(k.activeWipeTimer),k.activeWipeTimer=null)}static protectSensitiveInputs(i='input[type="password"], [data-secureshield-protected], input[autocomplete="cc-number"]'){if(!(typeof document>"u"||typeof document.querySelectorAll!="function"))try{document.querySelectorAll(i).forEach(t=>{let n=a(r=>{r.preventDefault(),console.warn("[SecureShield] Blocked clipboard exfiltration attempt on protected input field.")},"preventExfil");t.addEventListener("copy",n),t.addEventListener("cut",n),t.addEventListener("dragstart",n)})}catch{}}};a(k,"SecureClipboard"),p(k,"activeWipeTimer",null),p(k,"lastCopiedSensitiveHash",null);var tr=k;function un(){return typeof window>"u"||typeof document>"u"}a(un,"isServerEnvironment");var ue=Function.prototype.call,pn=String.prototype.trim,gr=String.prototype.toLowerCase,be=typeof URL<"u"?URL:typeof window<"u"?window.URL:void 0;function nr(f){if(f===void 0)return"production";if(typeof f!="string")throw new Error(`[SecureShield Configuration Error] Invalid environment: expected string, received ${typeof f}.`);let i=ue.call(gr,ue.call(pn,f));if(i==="production"||i==="staging"||i==="development")return i;if(i==="sandbox")return"development";let e=(f.length>64?f.slice(0,64)+"...":f).replace(/[\0-\x1f\x7f-\x9f]/g,"_");throw new Error(`[SecureShield Configuration Error] Invalid environment '${e}'. Expected 'production', 'staging', or 'development'.`)}a(nr,"normalizeEnvironment");function Sn(f,i,e){if(!f||typeof f!="string")return"";let t=ue.call(pn,f);if(!t)return"";try{let n=be?new be(t):new URL(t),r=n.pathname.replace(/\/+$/,"");r=r.replace(/(?:\/api\/v1\/(?:telemetry\/ingest|policy\/config|auth\/sdk-handshake|sdk\/initialize)|\/telemetry\/ingest|\/api\/v1)$/i,"");let o=(r+i).replace(/\/+/g,"/");return n.pathname=o,e&&e.forEach((s,c)=>{n.searchParams.set(c,s)}),n.hash="",n.toString()}catch{let n=t.replace(/\/+$/,"").replace(/(?:\/api\/v1\/(?:telemetry\/ingest|policy\/config|auth\/sdk-handshake|sdk\/initialize)|\/telemetry\/ingest|\/api\/v1)$/i,""),r=n.indexOf("?");if(r!==-1){let s=n.slice(0,r).replace(/\/+$/,""),c=n.slice(r);if(e&&e.toString()){let l=c.includes("?")?"&":"?";return`${s}${i}${c}${l}${e.toString()}`}return`${s}${i}${c}`}let o=e&&e.toString()?`?${e.toString()}`:"";return`${n}${i}${o}`}}a(Sn,"buildApiEndpoint");function eo(f){if(!f||typeof f!="string")return"";let i=ue.call(pn,f);if(!i)return"";try{let e=be?new be(i):new URL(i),t=e.pathname.replace(/\/+$/,"");return t=t.replace(/(?:\/api\/v1\/(?:telemetry\/ingest|policy\/config|auth\/sdk-handshake|sdk\/initialize)|\/telemetry\/ingest|\/api\/v1)$/i,""),e.pathname=t,e.search="",e.hash="",e.toString().replace(/\/+$/,"")}catch{return i.replace(/\/+$/,"").replace(/(?:\/api\/v1\/(?:telemetry\/ingest|policy\/config|auth\/sdk-handshake|sdk\/initialize)|\/telemetry\/ingest|\/api\/v1)$/i,"")}}a(eo,"getBaseApiUrl");var B,D,T,M,de,C,Y=class Y{constructor(i){p(this,"tenantId");p(this,"appId");p(this,"appToken");p(this,"appVersion");p(this,"headerKey");p(this,"encryptionKey");p(this,"initializationKey");p(this,"sessionToken");p(this,"deviceToken");p(this,"serverUrl");p(this,"publicKeyPem");p(this,"serverPublicKeyBase64");p(this,"hmacKeyHex");p(this,"enableE2eeEncryption");p(this,"allowedOrigins");p(this,"offlineGracePeriodMs");p(this,"remediationManager");J(this,B,!1);p(this,"autoIngest");J(this,D);J(this,T,null);p(this,"isHandshakeApproved",!1);p(this,"isOfflineMode",!1);p(this,"hasBiometricConsent",!1);J(this,M,0);J(this,de,0);J(this,C,null);p(this,"preferHeaderAppToken",!0);p(this,"strictLeaseBindingEnforcement",!0);p(this,"customPolicyKeys");p(this,"customLeaseKeys");p(this,"enableDeviceFingerprinting",!1);p(this,"isDestroyed",!1);p(this,"hasTabBlurShield",!1);this.enableDeviceFingerprinting=i?.enableDeviceFingerprinting===!0,this.customPolicyKeys=i?.customPolicyKeys,this.customLeaseKeys=i?.customLeaseKeys;let e=nr(i?.environment);e==="production"&&Y.validateProductionServerUrl(i?.serverUrl),b(this,D,e),b(this,B,!1),b(this,M,(()=>{try{if(typeof localStorage<"u"){let s=localStorage.getItem("secureshield_clock_offset_sec");if(s){let c=parseInt(s,10);if(!isNaN(c))return Math.max(-300,Math.min(3600,c))}}}catch{}return 0})()),b(this,de,0),b(this,T,null),b(this,C,null),Object.defineProperty(this,"isPausedState",{get:a(()=>v(this,B),"get"),set:a(()=>{},"set"),configurable:!1}),Object.defineProperty(this,"environment",{get:a(()=>v(this,D),"get"),set:a(()=>{},"set"),configurable:!1}),Object.defineProperty(this,"verifiedPolicy",{get:a(()=>v(this,T),"get"),set:a(()=>{},"set"),configurable:!1}),Object.defineProperty(this,"latestAuditReport",{get:a(()=>v(this,C),"get"),set:a(s=>{v(this,D)==="development"&&b(this,C,s)},"set"),configurable:!1}),this.tenantId=i?.tenantId||"",this.appId=i?.appId||"",this.appVersion=i?.appVersion||"1.0.0",this.appToken=i?.appToken,this.headerKey=i?.headerKey,this.encryptionKey=i?.encryptionKey,this.initializationKey=i?.initializationKey;let t=typeof globalThis<"u"?globalThis.process:void 0,n=t?.env?.API_BASE_URL||t?.env?.VITE_API_BASE_URL||t?.env?.SECURESHIELD_SERVER_URL||t?.env?.REACT_APP_SECURESHIELD_URL||typeof window<"u"&&(window.__SECURESHIELD_ENV__?.API_BASE_URL||window._env_?.VITE_API_BASE_URL),r=n?`${n.replace(/\/+$/,"").replace(/\/api\/v1$/,"")}/api/v1/telemetry/ingest`:"";this.serverUrl=i?.serverUrl||r,this.publicKeyPem=i?.publicKeyPem,this.serverPublicKeyBase64=i?.serverPublicKeyBase64,this.hmacKeyHex=i?.hmacKeyHex,this.enableE2eeEncryption=i?.enableE2eeEncryption??!0,this.allowedOrigins=i?.allowedOrigins,this.offlineGracePeriodMs=i?.offlineGracePeriodMs??86400*1e3;let o=e==="development";this.remediationManager=new Ae({...i,enableDomLockoutOverlay:i?.enableDomLockoutOverlay??!0,blockRedirectUrl:i?.blockRedirectUrl!==void 0?i.blockRedirectUrl:o?null:"/access-blocked",requireSignature:!0}),this.autoIngest=i?.autoIngest??!1,this.preferHeaderAppToken=i?.preferHeaderAppToken??!0,this.strictLeaseBindingEnforcement=i?.strictLeaseBindingEnforcement??!0,i?.serverPublicKeyBase64&&Q.setServerPublicKey(i.serverPublicKeyBase64),i?.hmacKeyHex&&Q.setHmacKey(i.hmacKeyHex),i?.consent?.behavioralBiometrics!==void 0?this.hasBiometricConsent=i.consent.behavioralBiometrics===!0:i?.enableBehavioralBiometrics&&(console.warn("[SecureShield DEPRECATION] 'enableBehavioralBiometrics' is deprecated and does not grant legal consent under GDPR/DPDP. Please configure 'consent: { behavioralBiometrics: true }' explicitly."),this.hasBiometricConsent=!1),this.hasBiometricConsent&&this.initBiometricListeners()}static validateProductionServerUrl(i){if(typeof i!="string"||!ue.call(pn,i))throw new Error('[SecureShield Configuration Error] serverUrl is required when running in production environment. (configure environment: "development")');if(i.length>2048)throw new Error("[SecureShield Configuration Error] serverUrl exceeds maximum allowed length of 2048 characters.");let e=ue.call(pn,i),t=e.length>=8&&(e[0]==="h"||e[0]==="H")&&(e[1]==="t"||e[1]==="T")&&(e[2]==="t"||e[2]==="T")&&(e[3]==="p"||e[3]==="P")&&(e[4]==="s"||e[4]==="S")&&e[5]===":"&&e[6]==="/"&&e[7]==="/",n;try{n=be?new be(e):new URL(e)}catch(s){throw new Error(`[SecureShield Configuration Error] Invalid production serverUrl format ('${e}'): ${s.message}`)}if(!t||n.protocol!=="https:"){let s="";for(let c=0;c<Math.min(e.length,12);c++)if(e[c]===":"){s=e.slice(0,c+1).toLowerCase();break}throw new Error(`[SecureShield Configuration Error] HTTPS is strictly required for serverUrl in production environment (received '${s||n.protocol}'). Non-TLS endpoints are forbidden.`)}if(n.username||n.password)throw new Error("[SecureShield Configuration Error] Embedded userinfo/credentials in production serverUrl are forbidden.");let r=ue.call(gr,n.hostname).replace(/\.+$/,""),o=r.startsWith("[")&&r.endsWith("]")?r.slice(1,-1):r;if(x.isPrivateOrRestrictedHost(o))throw new Error(`[SecureShield Configuration Error] Loopback/localhost serverUrl ('${n.hostname}') is forbidden in production environment.`)}static init(i){let e=nr(i?.environment);return e==="production"&&Y.validateProductionServerUrl(i?.serverUrl),(async()=>{if(un()){let r=new Y(i);return r.isHandshakeApproved=!0,r}if(i?.skipHandshake){if(e==="production")throw new Error("[SecureShield Security Violation] skipHandshake is strictly forbidden in production environment.");let r=x.getCurrentContext();if(!x.isLoopback(r.origin))throw new Error("[SecureShield Security Violation] skipHandshake is only permitted on loopback origins.")}let t=x.validate(i?.allowedOrigins);if(!t.isValid){let r=`[SecureShield CRITICAL] Origin Binding Violation: ${t.mismatchReason}`;throw console.error(r),new Error(r)}if(i?.enablePrototypeFreezing&&A.freezePrototypes(),i?.enableRuntimeIntegrityWatchdog!==!1){let r=A.auditRuntimeIntegrity();if(!r.isClean){let o=r.tamperedApis.map(s=>`${s.apiName} (${s.reason})`).join("; ");console.warn(`[SecureShield INTEGRITY WARNING] Runtime API tampering detected: ${o}`),r.tamperedApis.forEach(s=>{i?.onTamperDetected?.(s.apiName,s.reason)})}}let n=new Y(i);if(i?.enableTabBlurShield&&(ge.enable(i.tabBlurOptions),n.hasTabBlurShield=!0),i?.enableWatermark&&Oe.renderSecurityWatermark(i.watermarkText,i.watermarkOptions),i?.enableStorageLeakScrubber&&N.purgePlaintextLeaks(i.storageWhitelistKeys),i?.skipHandshake){n.isHandshakeApproved=!0;try{await n.fetchSignedRemotePolicy()}catch{}}else n.headerKey&&n.encryptionKey&&n.initializationKey?await n.initializeWithKeys():await n.executeSdkHandshake();return A.createTamperProofProxy(n,"SecureShield",(r,o)=>{i?.onTamperDetected?.(r,o)})})()}getHandshakeUrl(){return Sn(this.serverUrl,"/api/v1/auth/sdk-handshake")}getSdkInitializeUrl(){return Sn(this.serverUrl,"/api/v1/sdk/initialize")}async initializeWithKeys(i=!1){if(!this.headerKey||!this.encryptionKey||!this.initializationKey)throw new Error("[SecureShield] Missing headerKey, encryptionKey, or initializationKey for SDK initialization.");if(!this.serverUrl)throw this.isHandshakeApproved=!1,new Error("[SecureShield Configuration Error] serverUrl is required for key-based SDK initialization.");let e=x.getCurrentContext(),t=this.getSdkInitializeUrl();try{let n=JSON.stringify({initializationKey:this.initializationKey,platform:"WEB",origin:e.origin}),r=await cr(n,this.encryptionKey),o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-SS-KEY":this.headerKey},body:JSON.stringify({encryptedPayload:r})});if(!o.ok){let d=`[SecureShield CRITICAL] SDK Initialization Rejected (HTTP ${o.status}).`;throw console.error(d),this.isHandshakeApproved=!1,new Error(d)}let s=await o.json(),c=s.server_time||(s.server_time_ms?Math.floor(s.server_time_ms/1e3):s.data?.server_time||void 0);if(typeof c=="number"){let d=c-Math.floor(Date.now()/1e3);b(this,M,Math.max(-300,Math.min(3600,d)));try{typeof localStorage<"u"&&localStorage.setItem("secureshield_clock_offset_sec",String(v(this,M)))}catch{}}if(s.success&&s.data||s.status==="SUCCESS"||s.sessionToken){let d=s.data?.sessionToken||s.sessionToken;if(!d||typeof d!="string"){let u="[SecureShield CRITICAL] Server response missing verified sessionToken.";throw console.error(u),this.isHandshakeApproved=!1,new Error(u)}this.sessionToken=d,this.deviceToken=s.data?.deviceToken||s.deviceToken||void 0,this.isHandshakeApproved=!0,this.isOfflineMode=!1;try{await F.saveLease({appId:this.appId,tenantId:this.tenantId,origin:e.origin,sessionToken:this.sessionToken,deviceToken:this.deviceToken,leaseExpiryMs:Date.now()+this.offlineGracePeriodMs,cachedAt:Date.now(),signedEnvelope:s.signed_lease||s.data?.signed_lease})}catch(u){console.warn("[SecureShield] Failed to persist lease in IndexedDB vault:",u?.message||u)}return console.log("[SecureShield] SDK initialized successfully with Portal."),!0}return await this.checkOfflineGraceLease(e.origin,i)}catch(n){if(n.message&&(n.message.includes("SDK Initialization Rejected")||n.message.includes("Server response missing verified sessionToken")||n.message.includes("Handshake failed and no valid encrypted offline lease found")))throw n;return console.warn(`[SecureShield] Initialization network error (${n.message}). Checking offline encrypted grace lease...`),await this.checkOfflineGraceLease(e.origin,i)}}getSessionToken(){return this.sessionToken}getDeviceToken(){return this.deviceToken}isInitialized(){return this.isHandshakeApproved}async clearSession(){this.sessionToken=void 0,this.deviceToken=void 0,b(this,T,null),this.isHandshakeApproved=!1,this.isOfflineMode=!1,b(this,B,!1),b(this,M,0),b(this,C,null);try{await F.clearVault()}catch(i){console.warn("[SecureShield] Failed to purge IndexedDB vault during clearSession():",i?.message||i)}try{N.wipeVolatileStorage()}catch{}try{typeof localStorage<"u"&&localStorage.removeItem("secureshield_clock_offset_sec")}catch{}}async executeSdkHandshake(i=!1){let e=x.getCurrentContext();if(!this.serverUrl)return console.warn("[SecureShield] Handshake skipped: serverUrl is unconfigured."),await this.checkOfflineGraceLease(e.origin,i);let t=this.getHandshakeUrl();try{let n={tenantId:this.tenantId,appId:this.appId,appToken:this.appToken||"",domain:e.origin,platform:"WEB",sdkVersion:pe,appVersion:this.appVersion},r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","x-tenant-id":this.tenantId,"x-app-id":this.appId,"x-app-token":this.appToken||"","x-app-domain":e.origin,"x-platform":"WEB","x-sdk-version":pe,"x-app-version":this.appVersion},body:JSON.stringify(n)});if(r.status===401||r.status===403){let o=`[SecureShield CRITICAL] Portal Handshake Rejected (HTTP ${r.status}). Unauthorized origin '${e.origin}' or invalid App Token.`;throw console.error(o),this.isHandshakeApproved=!1,new Error(o)}if(r.ok){let o=await r.json(),s=o.server_time||(o.server_time_ms?Math.floor(o.server_time_ms/1e3):o.data?.server_time||void 0);if(typeof s=="number"){let l=s-Math.floor(Date.now()/1e3);b(this,M,Math.max(-300,Math.min(3600,l)));try{typeof localStorage<"u"&&localStorage.setItem("secureshield_clock_offset_sec",String(v(this,M)))}catch{}}let c=o.status||"";if(c==="APPROVED"||c==="SUCCESS"||c==="ACTIVE"){this.isHandshakeApproved=!0,this.isOfflineMode=!1,b(this,T,o.policy||o);try{await F.saveLease({appId:this.appId,tenantId:this.tenantId,origin:e.origin,policy:v(this,T),leaseExpiryMs:Date.now()+this.offlineGracePeriodMs,cachedAt:Date.now(),signedEnvelope:o.signed_lease||o.data?.signed_lease})}catch(l){console.warn("[SecureShield] Failed to persist lease in IndexedDB vault:",l?.message||l)}return console.log("[SecureShield] Handshake verified successfully with Portal. Identity bound."),!0}}return await this.checkOfflineGraceLease(e.origin,i)}catch(n){if(n.message&&(n.message.includes("Portal Handshake Rejected")||n.message.includes("Handshake failed and no valid encrypted offline lease found")))throw n;return console.warn(`[SecureShield] Handshake network error (${n.message}). Checking offline encrypted grace lease...`),await this.checkOfflineGraceLease(e.origin,i)}}async checkOfflineGraceLease(i,e=!1){let t=await F.verifyOfflineLease(this.appId,i,v(this,M)*1e3,this.customLeaseKeys,v(this,D)==="production",this.strictLeaseBindingEnforcement);if(t.isValid&&t.lease)return this.isHandshakeApproved=!0,this.isOfflineMode=!0,b(this,T,t.lease.policy||this.getFailClosedDefaultPolicy()),console.info(`[SecureShield] Encrypted offline grace lease is ACTIVE (Valid until: ${new Date(t.lease.leaseExpiryMs).toISOString()}). Allowing startup.`),!0;if(x.isLoopback(i)&&v(this,D)!=="production")return console.warn(`[SecureShield] Local development environment detected on '${i}'. Activating local developer grace lease.`),this.isHandshakeApproved=!0,this.isOfflineMode=!0,b(this,T,this.getFailClosedDefaultPolicy()),!0;if(t.reason?.includes("missing required cryptographic bindings")&&(console.error(`[SecureShield TELEMETRY:LEASE_REJECTION_MISSING_BINDINGS] Offline lease rejected: signed payload lacks required cryptographic bindings (app_id, origin, iat, exp). Reason: '${t.reason}'. Backend rollout sequencing check recommended.`),this.serverUrl&&!e)){try{let s={id:"lease_cryptographic_binding_anomaly",name:"Lease Missing Cryptographic Bindings",category:"INTEGRITY",event:"LEASE_REJECTION_MISSING_BINDINGS",triggered:!0,severity:3,status:"FAILED",evidence:{rejectionReason:t.reason,appId:this.appId,tenantId:this.tenantId,origin:i,environment:v(this,D),strictLeaseBindingEnforcement:this.strictLeaseBindingEnforcement}},c=X.createReport([s],this.tenantId,this.appId,v(this,D),this.appVersion);this.ingestTelemetry(c).catch(()=>{})}catch{}console.warn("[SecureShield] Attempting automatic online handshake refresh to recover from pre-upgrade cached lease...");try{let s=!1;if(this.headerKey&&this.encryptionKey&&this.initializationKey?s=await this.initializeWithKeys(!0):s=await this.executeSdkHandshake(!0),s)return console.log("[SecureShield] Automatic online lease refresh SUCCEEDED. Recovered with fresh compliant lease."),!0}catch(s){console.error("[SecureShield CRITICAL] Automatic online lease refresh failed:",s?.message||s)}}let o=this.serverUrl?`[SecureShield CRITICAL] Handshake failed and no valid encrypted offline lease found (${t.reason||"Missing or expired lease"}). Failing closed.`:`[SecureShield Configuration Error] serverUrl is unconfigured and no valid offline grace lease was found for '${i}'.`;throw console.error(o),this.isHandshakeApproved=!1,new Error(o)}isApproved(i){if(v(this,D)==="production"&&!this.isHandshakeApproved)return!1;if(i&&(i.verdict!==void 0||i.status!==void 0||i.decision!==void 0)){let e=(i.verdict||i.status||i.decision||"").toString().trim().toUpperCase();return e==="APPROVED"||e==="SECURE"||e==="PASSED"}return!(!this.isHandshakeApproved||v(this,C)&&(!["SECURE","PASSED","APPROVED"].includes(v(this,C).verdict||"")||v(this,C).failed>0&&v(this,C).items?.some(n=>(n.triggered||n.status==="FAILED")&&(n.severity>=3||n.id==="headless_browser_detector"||n.id==="bot_behavior_detector"||n.id==="automation_environment_detector"||n.id==="virtual_browser_detector"))))}isHandshakeActive(){return this.isHandshakeApproved}getLatestAuditReport(){return v(this,C)}grantConsent(i){i==="behavioralBiometrics"&&(this.hasBiometricConsent||(this.hasBiometricConsent=!0,this.initBiometricListeners()))}revokeConsent(i){i==="behavioralBiometrics"&&this.hasBiometricConsent&&(this.hasBiometricConsent=!1,this.teardownBiometricListeners())}hasConsent(i){return i==="behavioralBiometrics"?this.hasBiometricConsent:!1}initBiometricListeners(){typeof window>"u"||(re.initListener({consentGranted:!0}),oe.initListeners({consentGranted:!0}),ae.initListeners({consentGranted:!0}),le.initListeners({consentGranted:!0}))}teardownBiometricListeners(){re.removeListener(),oe.removeListeners(),ae.removeListeners(),le.removeListeners()}isOperatingOffline(){return this.isOfflineMode}getIngestUrl(){return Sn(this.serverUrl,"/api/v1/telemetry/ingest")}getPolicyUrl(){if(!this.serverUrl)return"";let i=new URLSearchParams;return this.tenantId&&i.set("tenantId",this.tenantId),this.appId&&i.set("appId",this.appId),Sn(this.serverUrl,"/api/v1/policy/config",i)}async fetchSignedRemotePolicy(){if(!this.serverUrl){b(this,T,this.getFailClosedDefaultPolicy());return}try{let i=this.getPolicyUrl(),e={Accept:"application/json"};this.appToken&&(e["x-app-token"]=this.appToken);let t=await fetch(i,{headers:e});if(t.ok){let n=await t.json(),r=await te.verifyPolicyEnvelope(n,this.customPolicyKeys,v(this,M),v(this,D)==="production");if(r.isValid&&r.policy){let o=r.iat||0;if(v(this,de)>0&&o>0&&o<v(this,de)){console.error("[SecureShield CRITICAL] Stale or replayed remote policy rejected (iat earlier than active policy). Enforcing fail-closed default policy."),b(this,T,this.getFailClosedDefaultPolicy());return}o>0&&b(this,de,o),b(this,T,r.policy);return}console.error("[SecureShield CRITICAL] Remote policy signature verification failed. Enforcing fail-closed default policy."),b(this,T,this.getFailClosedDefaultPolicy());return}v(this,T)||b(this,T,this.getFailClosedDefaultPolicy())}catch{v(this,T)||b(this,T,this.getFailClosedDefaultPolicy())}}getFailClosedDefaultPolicy(){return{tenant_id:this.tenantId,app_id:this.appId,policy_version:"2026.08.01-fail-closed-default",global_enforcement_mode:"BLOCK",detectors:{browser_devtools_open_detector:{enabled:!0,action:"BLOCK",severity:4},headless_browser_detector:{enabled:!0,action:"BLOCK",severity:4},javascript_runtime_hook_detector:{enabled:!0,action:"BLOCK",severity:4}}}}async evaluateSecurityState(){let i=this.runScan();b(this,C,i);let e=!1;if(un())return{...i,trustScore:0};if(this.serverUrl)try{let n=await this.ingestTelemetry(i);n?.deviceStatus&&(i.risk_score=n.deviceStatus.threatScore,i.risk_tier=n.deviceStatus.riskLevel,i.verdict=n.verdict||(n.deviceStatus.riskLevel==="CRITICAL"?"BLOCKED":"SECURE"),i.decision_action=n.decision_action||(i.verdict==="BLOCKED"?"BLOCK":"ALLOW"),i.scoring_authority="SERVER_AUTHORITATIVE",i.authoritative_verdict=i.verdict,e=!0)}catch(n){console.warn("[SecureShield] Auto-ingest notice:",n)}else console.warn("[SecureShield] Auto-ingest skipped: serverUrl is unconfigured.");if(!e){if(this.isOfflineMode)if(i.failed>0){let n=0,r=!1;for(let o of i.items||[])if(o.triggered||o.status==="FAILED"){let s=o.severity||1;n+=s*25,(s>=3||o.id==="headless_browser_detector"||o.id==="bot_behavior_detector"||o.id==="automation_environment_detector"||o.id==="virtual_browser_detector")&&(r=!0)}i.risk_score=Math.min(100,Math.max(25,n)),r||i.risk_score>=80?(i.risk_tier="CRITICAL",i.verdict="BLOCKED",i.decision_action="BLOCK"):(i.risk_tier=i.risk_score>=50?"HIGH":"MEDIUM",i.verdict="PENDING_BACKEND_INGESTION",i.decision_action="PENDING_BACKEND_INGESTION")}else i.risk_score=0,i.risk_tier="LOW",i.verdict="SECURE",i.decision_action="ALLOW";else i.risk_score=100,i.risk_tier="CRITICAL",i.verdict="BLOCKED",i.decision_action="BLOCK";i.scoring_authority="CLIENT_LOCAL_OFFLINE",i.authoritative_verdict=i.verdict}let t=Math.max(0,100-(i.risk_score!==void 0?i.risk_score:100));return i.trustScore=t,i}async ingestTelemetry(i){if(un())return{status:"SKIPPED",verdict:"SKIPPED",decision_action:"SKIPPED",reason:"SSR_ENVIRONMENT_INGEST_DISABLED"};if(!this.serverUrl)throw new Error("[SecureShield Configuration Error] serverUrl is unconfigured.");let e=i||this.runScan(),t=this.getIngestUrl();try{let n,r={"Content-Type":"application/json","X-SecureShield-Tenant":this.tenantId,"X-SecureShield-AppId":this.appId};if(this.sessionToken&&(r.Authorization=`Bearer ${this.sessionToken}`),this.enableE2eeEncryption){let l=JSON.stringify(e),d=await Q.createSecurityEnvelope(l,this.serverPublicKeyBase64,this.hmacKeyHex);n=JSON.stringify(d)}else n=JSON.stringify(e);let o=await fetch(t,{method:"POST",headers:r,body:n});if(!o.ok){let l="";try{let d=await o.json();(d?.reasonCode||d?.error)&&(l=`: ${d.error||d.reasonCode}`,d.reasonCode==="ASSET_PENDING_ADMIN_APPROVAL"?console.warn(`[SecureShield] Application '${this.appId}' is pending administrator approval. Telemetry and live RASP defense are inactive until whitelisted.`):d.reasonCode==="COMPANY_PENDING_APPROVAL"&&console.warn(`[SecureShield] Organization '${this.tenantId}' is pending administrator verification.`))}catch{}throw new Error(`HTTP ${o.status} ${o.statusText}${l}`)}let s=await o.json(),c=s?.decision_action||s?.decisionAction||s?.action;if(c&&typeof c=="string"){let l=c.toUpperCase().trim();if(l==="PAUSED"||l==="UNPAUSE"||l==="TERMINATE_APP"||l==="BLOCK_DEVICE"||l==="BLOCK_ACTION"||l==="WIPE_LOCAL_KEYS"){let u=s.signed_remediation||s.signed_envelope||(s.protected&&s.signature?s:null);if(u){let m=await te.verifyPolicyEnvelope(u,this.customPolicyKeys,v(this,M),v(this,D)==="production");if(!m.isValid){let _=`[SecureShield Security Error] Server remediation directive signature verification failed: ${m.reason||"Invalid signature"}`;throw console.error(_),new Error(_)}}else{let m=`[SecureShield Security Error] Server remediation directive rejected: missing cryptographic signature in '${v(this,D)}' or on non-loopback origin for action '${l}'.`;throw console.error(m),new Error(m)}l==="PAUSED"?b(this,B,!0):l==="UNPAUSE"&&b(this,B,!1),await this.remediationManager.handleDecisionAction(c,s?.primary_threat||s?.reason||s?.message,!0)}}return s}catch(n){return{status:"ERROR",message:n.message||"Telemetry ingestion network failure",ingest_url:t}}}isPaused(){return v(this,B)}setPaused(i){let e=x.getCurrentContext().origin;if(v(this,D)!=="development"||!x.isLoopback(e))throw new Error(`[SecureShield Security Error] setPaused() is restricted in '${v(this,D)}' or on non-loopback origins.`);console.warn("[SecureShield Deprecation] setPaused() is deprecated."),b(this,B,i)}getRemediationManager(){return this.remediationManager}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.hasBiometricConsent&&(this.teardownBiometricListeners(),this.hasBiometricConsent=!1),this.hasTabBlurShield&&(ge.disable(),this.hasTabBlurShield=!1))}runScan(i){if(un()){let n={scan_id:`scan_ssr_${Date.now()}_${Math.floor(Math.random()*1e3)}`,device_id_hash:"server_environment_no_device",session_id:`sess_ssr_${Date.now()}`,os_name:"Server",os_version:typeof globalThis<"u"&&globalThis.process?`Node ${globalThis.process.version}`:"Unknown",app_id:this.appId||"app_web",app_version:this.appVersion||"1.0.0",sdk_version:pe,verdict:"SKIPPED",risk_score:0,risk_tier:"NONE",decision_action:"SKIPPED",scoring_authority:"NONE",authoritative_verdict:"SKIPPED",total_detectors:0,passed:0,failed:0,tenant_id:this.tenantId||"",environment:v(this,D)||"production",items:[]};return n.status="SKIPPED",n.reason="SSR_ENVIRONMENT_SCAN_SKIPPED",n}if(v(this,B)){let n=X.createReport([],this.tenantId,this.appId,v(this,D),this.appVersion);return n.verdict="SECURE",n.decision_action="PAUSED",n}let e=[Ce.scan(),Re.scan(),ke.scan(),Pe.scan(),Me.scan(),Le.scan(),Ne.scan(),Be.scan(),Ue.scan(),$e.scan(),Fe.scan(),We.scan(),Ke.scan(),je.scan(),He.scan(),Ve.scan(),Ge.scan(),qe.scan(),ze.scan(),Ye.scan(),Je.scan(),Xe.scan(),Ze.scan(),Qe.scan(),et.scan(),tt.scan(),nt.scan(),it.scan(),rt.scan(),ot.scan(),st.scan(),at.scan(),ct.scan(),lt.scan(),dt.scan(),ut.scan(),pt.scan(),ft.scan(),mt.scan(),gt.scan(),yt.scan(),_t.scan(),ht.scan(),vt.scan(),bt.scan(),wt.scan(),St.scan(),Et.scan(),It.scan(),Dt.scan(),xt.scan(),Tt.scan(),re.scan({consentGranted:this.hasBiometricConsent}),oe.scan({consentGranted:this.hasBiometricConsent}),ae.scan({consentGranted:this.hasBiometricConsent}),le.scan({consentGranted:this.hasBiometricConsent}),Nt.scan(),Bt.scan(),Ut.scan(),$t.scan(),Ft.scan(),Wt.scan(),Kt.scan(),jt.scan(),Ht.scan(),Vt.scan(),Gt.scan(),qt.scan(),zt.scan(),Yt.scan(),Jt.scan(),Xt.scan(),Zt.scan(),Qt.scan(),en.scan(),tn.scan(),nn.scan(),rn.scan(),on.scan(),sn.scan(),an.scan(),cn.scan(),ln.scan()];this.enableDeviceFingerprinting&&e.push(dn.scan());let t=X.createReport(e,this.tenantId,this.appId,v(this,D),this.appVersion);return b(this,C,t),(i?.ingest||this.autoIngest)&&this.ingestTelemetry(t).catch(()=>{}),t}scan(i){return this.runScan(i)}getDetailedDeviceSecurityScan(){let i=this.runScan();return JSON.stringify(i,null,2)}};B=new WeakMap,D=new WeakMap,T=new WeakMap,M=new WeakMap,de=new WeakMap,C=new WeakMap,a(Y,"SecureShield"),p(Y,"OriginValidator",x);var we=Y;typeof globalThis<"u"&&(globalThis.SecureShield=we,globalThis.SecureShieldWeb=we);var to=we;return Tr(no);})();
43
+ (function(){var root=typeof window!=="undefined"?window:(typeof globalThis!=="undefined"?globalThis:this);var _b=typeof SecureShield!=="undefined"?SecureShield:(root&&root.SecureShield);var _t=(_b&&_b.SecureShield)?_b.SecureShield:_b;if(_b&&typeof _b==="object"){for(var _k in _b){if(Object.prototype.hasOwnProperty.call(_b,_k)&&!(_k in _t)){try{_t[_k]=_b[_k];}catch(e){}}}}if(root){root.SecureShield=_t;root.SecureShieldSDK=_t;}if(typeof window!=="undefined"&&window!==root){window.SecureShield=_t;window.SecureShieldSDK=_t;}})();
@@ -0,0 +1 @@
1
+ sha384-oonD1w6t+zDUu/rI+ve3GjhEIZfRkvBriq4uaWj6TKqqRub+SDT/9zveLBFkK5B7