@quickcheck/device-intel-sdk 1.0.1 → 1.0.2

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.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var P=Object.create;var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var L=(n,e)=>{for(var t in e)g(n,t,{get:e[t],enumerable:!0})},v=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!G.call(n,o)&&o!==t&&g(n,o,{get:()=>e[o],enumerable:!(i=R(e,o))||i.enumerable});return n};var M=(n,e,t)=>(t=n!=null?P(D(n)):{},v(e||!n||!n.__esModule?g(t,"default",{value:n,enumerable:!0}):t,n)),T=n=>v(g({},"__esModule",{value:!0}),n);var j={};L(j,{QCApiClient:()=>d,QuickCheckDeviceIntel:()=>m,QuickCheckError:()=>c,SDK_VERSION:()=>y});module.exports=T(j);var c=class extends Error{constructor(t,i,o,r){super(t);this.code=i;this.status=o;this.details=r;this.name="QuickCheckError"}};var U="https://api.quickcheck.com.pa",N="/api/v1/sdk/device-intel/assess",d=class{constructor(e){if(!e.apiKey)throw new c("apiKey is required","MISSING_API_KEY");this.apiKey=e.apiKey,this.apiUrl=(e.apiUrl??U).replace(/\/$/,""),this.timeout=e.timeout??5e3}async assess(e){let t=`${this.apiUrl}${N}`,i=new AbortController,o=setTimeout(()=>i.abort(),this.timeout),r;try{r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-QC-SDK-Key":this.apiKey,"X-QC-SDK-Platform":e.platform},body:JSON.stringify(e),signal:i.signal})}catch(a){throw clearTimeout(o),a.name==="AbortError"?new c(`Request timed out after ${this.timeout}ms`,"TIMEOUT"):new c(`Network error: ${a.message}`,"NETWORK_ERROR",void 0,a)}clearTimeout(o);let s;try{s=await r.json()}catch{throw new c(`Invalid JSON response (status ${r.status})`,"INVALID_RESPONSE",r.status)}if(!r.ok){let a=typeof s=="object"&&s!==null&&"detail"in s?String(s.detail):`HTTP ${r.status}`,u=r.status===401?"UNAUTHORIZED":r.status===403?"FORBIDDEN":r.status===429?"RATE_LIMITED":"HTTP_ERROR";throw new c(a,u,r.status,s)}return s}};function _(){let n=typeof navigator<"u"?navigator:{},e=typeof window<"u"?window.screen:null,t=e?`${e.width}x${e.height}`:null,i=null,o=null;try{i=new Date().getTimezoneOffset(),o=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}let r=(n.userAgent||"").toLowerCase(),s="desktop";/mobi|iphone|ipod|android/.test(r)?s="mobile":/ipad|tablet/.test(r)&&(s="tablet");let a="Unknown",u=null;if(/windows nt/.test(r)){a="Windows";let l=r.match(/windows nt ([\d.]+)/);u=l?l[1]:null}else if(/mac os x/.test(r)){a="macOS";let l=r.match(/mac os x ([\d_.]+)/);u=l?l[1].replace(/_/g,"."):null}else if(/android/.test(r)){a="Android";let l=r.match(/android ([\d.]+)/);u=l?l[1]:null}else if(/iphone|ipad|ipod/.test(r)){a="iOS";let l=r.match(/os ([\d_]+) like mac/);u=l?l[1].replace(/_/g,"."):null}else/linux/.test(r)&&(a="Linux");let f=n.deviceMemory??null;return{type:s,os_name:a,os_version:u,screen_resolution:t,language:n.language??null,languages:n.languages?Array.from(n.languages):[],timezone_offset:i,timezone_name:o,hardware_concurrency:n.hardwareConcurrency??null,device_memory_gb:f,touch_support:typeof window<"u"&&("ontouchstart"in window||(n.maxTouchPoints??0)>0)}}async function w(){try{let e=await(await import("@thumbmarkjs/thumbmarkjs")).getFingerprint();return typeof e=="string"?e:e&&typeof e.thumbmark=="string"?e.thumbmark:b()}catch{return b()}}function b(){let e=[typeof navigator<"u"?navigator.userAgent:"",typeof navigator<"u"?navigator.language:"",typeof screen<"u"?`${screen.width}x${screen.height}`:"",typeof screen<"u"?String(screen.colorDepth):"",String(new Date().getTimezoneOffset()),typeof navigator<"u"?String(navigator.hardwareConcurrency??""):""].join("|"),t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return"qc_fb_"+Math.abs(t).toString(16).padStart(8,"0")}async function I(n=1e4){return typeof navigator>"u"||!navigator.geolocation?null:new Promise(e=>{let t=setTimeout(()=>e(null),n);navigator.geolocation.getCurrentPosition(i=>{clearTimeout(t),e({latitude:i.coords.latitude,longitude:i.coords.longitude,accuracy_m:Math.round(i.coords.accuracy),source:"gps"})},()=>{clearTimeout(t),e(null)},{enableHighAccuracy:!1,timeout:n,maximumAge:6e4})})}function S(){let e=navigator.connection;return{connection_type:e?.type??null,effective_type:e?.effectiveType??null}}async function p(n=2e3){return typeof RTCPeerConnection>"u"?[]:new Promise(e=>{let t=new Set;try{let i=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});i.createDataChannel(""),i.onicecandidate=o=>{if(!o.candidate||!o.candidate.candidate)return;let r=o.candidate.candidate.match(/(\d{1,3}(\.\d{1,3}){3})|([a-f0-9:]+:+[a-f0-9]+)/);r&&r[0]&&t.add(r[0])},i.createOffer().then(o=>i.setLocalDescription(o)).catch(()=>{}),setTimeout(()=>{try{i.close()}catch{}e(Array.from(t))},n)}catch{e([])}})}async function x(){let n=O(),e=H(),t=await K(),i=await p(1500);return{is_incognito:t,webgl_renderer:n,canvas_hash:e,local_ips:i}}function O(){try{let n=document.createElement("canvas"),e=n.getContext("webgl")||n.getContext("experimental-webgl");if(!e)return null;let t=e.getExtension("WEBGL_debug_renderer_info");return t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):null}catch{return null}}function H(){try{let n=document.createElement("canvas");n.width=220,n.height=60;let e=n.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("QuickCheck Device Intelligence",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("QuickCheck Device Intelligence",4,17);let t=n.toDataURL(),i=0;for(let o=0;o<t.length;o++){let r=t.charCodeAt(o);i=(i<<5)-i+r,i|=0}return i.toString(16)}catch{return null}}async function K(){try{let n=navigator;if(n.storage?.estimate){let{quota:e}=await n.storage.estimate();if(typeof e=="number")return e<120*1024*1024}}catch{}return null}function $(){try{return{acos04:Math.acos(.4),asin04:Math.asin(.4),atan04:Math.atan(.4),atanh04:Math.atanh(.4),cbrt100:Math.cbrt(100),cosh1:Math.cosh(1),expm11:Math.expm1(1),log1p10:Math.log1p(10),sinh1:Math.sinh(1),tanh1:Math.tanh(1),pow1_1e100:Math.pow(1.1,100)}}catch{return{}}}async function z(){try{let n=document.createElement("canvas");n.width=200,n.height=40;let e=n.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="18px sans-serif",e.fillText("\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}\u{1F1F5}\u{1F1E6}\u{1F44D}\u{1F3FD}\u{1FAE1}",2,2);let t=n.toDataURL();return V(t)}catch{return null}}function F(){try{if(!("speechSynthesis"in window))return{count:0,fingerprint:null};let n=window.speechSynthesis.getVoices();if(!n||n.length===0)return{count:0,fingerprint:null};let e=n.map(t=>`${t.name}|${t.lang}|${t.localService?"L":"R"}`).sort().join(",");return{count:n.length,fingerprint:h(e)}}catch{return{count:0,fingerprint:null}}}async function W(){let n={audioinput:0,audiooutput:0,videoinput:0};try{if(!navigator.mediaDevices?.enumerateDevices)return n;let e=await navigator.mediaDevices.enumerateDevices();for(let t of e)t.kind==="audioinput"?n.audioinput++:t.kind==="audiooutput"?n.audiooutput++:t.kind==="videoinput"&&n.videoinput++}catch{}return n}function Q(){try{let n=new Intl.DateTimeFormat().resolvedOptions();return`${n.locale}|${n.calendar}|${n.numberingSystem}|${n.hourCycle??"-"}|${n.timeZone}`}catch{return null}}async function q(){try{let n=navigator.keyboard;if(!n?.getLayoutMap)return null;let e=await n.getLayoutMap(),t=[];for(let[i,o]of e.entries())t.push(`${i}=${o}`);return h(t.sort().join("|"))}catch{return null}}function B(){let n={vendor:null,renderer:null,extensions:[],shaderPrecision:null};try{let e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return n;let i=t.getExtension("WEBGL_debug_renderer_info");i&&(n.vendor=t.getParameter(i.UNMASKED_VENDOR_WEBGL),n.renderer=t.getParameter(i.UNMASKED_RENDERER_WEBGL)),n.extensions=t.getSupportedExtensions()??[];let o=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT),r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);o&&r&&(n.shaderPrecision=`v:${o.rangeMin}/${o.rangeMax}/${o.precision};f:${r.rangeMin}/${r.rangeMax}/${r.precision}`)}catch{}return n}function h(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}async function V(n){try{let e=new TextEncoder().encode(n),t=await crypto.subtle.digest("SHA-256",e),i=new Uint8Array(t),o="";for(let r=0;r<16;r++)o+=i[r].toString(16).padStart(2,"0");return o}catch{return h(n)}}async function E(){let[n,e,t]=await Promise.all([z(),W(),q()]);return{math_constants:$(),emoji_hash:n,speech_voices:F(),media_devices:e,intl_signature:Q(),keyboard_layout_hash:t,webgl_advanced:B()}}var y="1.0.0",C="qcdi_session_uuid",k="qcdi_previous_page",m=class{constructor(e){this.deviceSignals=null;this.privacySignals=null;this.advancedSignals=null;this.initialized=!1;this.sessionUuid="";this.geoWatchId=null;this.geoHistory=[];this.lastGeoLat=null;this.lastGeoLon=null;this.clientIpv4=null;this.clientIpv6=null;this.config={apiKey:e.apiKey,apiUrl:e.apiUrl??"https://api.quickcheck.com.pa",autoCollect:e.autoCollect??!0,requestGeolocation:e.requestGeolocation??!1,continuousGeolocation:e.continuousGeolocation??!1,timeout:e.timeout??5e3,onError:e.onError??(t=>console.error("[QCDI]",t)),debug:e.debug??!1},this.client=new d({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,timeout:this.config.timeout}),this.sessionUuid=this.resolveSessionUuid(),this.config.autoCollect&&this.initialize()}resolveSessionUuid(){try{let e=sessionStorage.getItem(C);if(e)return e;let t=this.generateUuid();return sessionStorage.setItem(C,t),t}catch{return this.generateUuid()}}generateUuid(){let e="0123456789abcdef",t="qcdis-";for(let i=0;i<32;i++)t+=e[Math.floor(Math.random()*16)],(i===7||i===11||i===15||i===19)&&(t+="-");return t}async initialize(){if(!this.initialized){this.config.debug&&console.log("[QCDI] Initializing...");try{let e=await w(),t=_();this.deviceSignals={fingerprint_hash:e,visitor_id:null,...t},this.privacySignals=await x(),this.advancedSignals=await E();let i=await p(1500);for(let o of i)o.includes(":")?this.clientIpv6||(this.clientIpv6=o):this.clientIpv4||(this.clientIpv4=o);this.initialized=!0,this.config.continuousGeolocation&&this.config.requestGeolocation&&this.startContinuousGeolocation(),this.config.debug&&console.log("[QCDI] Initialized",{fingerprint:e,session_uuid:this.sessionUuid,ipv4:this.clientIpv4,ipv6:this.clientIpv6})}catch(e){this.config.onError(e)}}}startContinuousGeolocation(){typeof navigator>"u"||!navigator.geolocation||this.geoWatchId===null&&(this.geoWatchId=navigator.geolocation.watchPosition(e=>{let{latitude:t,longitude:i,accuracy:o}=e.coords;this.lastGeoLat!==null&&this.lastGeoLon!==null&&this.haversineMeters(this.lastGeoLat,this.lastGeoLon,t,i)<50||(this.lastGeoLat=t,this.lastGeoLon=i,this.geoHistory.push({latitude:t,longitude:i,accuracy_m:Math.round(o),timestamp:new Date().toISOString()}),this.geoHistory.length>100&&(this.geoHistory=this.geoHistory.slice(-100)))},e=>{this.config.debug&&console.warn("[QCDI] Geo watch error:",e)},{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e4}))}haversineMeters(e,t,i,o){let s=l=>l*Math.PI/180,a=s(i-e),u=s(o-t),f=Math.sin(a/2)**2+Math.cos(s(e))*Math.cos(s(i))*Math.sin(u/2)**2;return 2*6371e3*Math.asin(Math.sqrt(f))}getPreviousPageUrl(){try{if(typeof document<"u"&&document.referrer)return document.referrer.slice(0,500)}catch{}return null}getFlowFromUrl(){try{let e=sessionStorage.getItem(k);return typeof window<"u"&&sessionStorage.setItem(k,window.location.href.slice(0,500)),e}catch{return null}}async assess(e){if(await this.initialize(),!this.deviceSignals)throw new Error("Device signals not collected. Call initialize() first.");let t=null;this.config.continuousGeolocation&&this.lastGeoLat!==null?t={latitude:this.lastGeoLat,longitude:this.lastGeoLon,accuracy_m:null,source:"gps"}:this.config.requestGeolocation&&(t=await I());let i={sdk_version:y,platform:"web",session_type:e.sessionType,device:this.deviceSignals,network:S(),privacy:this.privacySignals,geolocation:t,advanced:this.advancedSignals,context:{external_user_id:e.externalUserId??null,external_session_id:e.externalSessionId??null,declared_country:e.declaredCountry??null,person_name:e.personName??null,person_document_id:e.personDocumentId??null,custom_fields:e.customFields??{},previous_page_url:this.getPreviousPageUrl(),flow_from_url:this.getFlowFromUrl(),session_uuid:this.sessionUuid,geolocation_history:this.geoHistory.slice(),client_ipv4:this.clientIpv4,client_ipv6:this.clientIpv6,app_session_id:e.appSessionId??null}};this.config.debug&&console.log("[QCDI] Assessing",i);try{let o=await this.client.assess(i);return this.config.debug&&console.log("[QCDI] Result",o),o}catch(o){throw this.config.onError(o),o}}async refresh(){this.initialized=!1,await this.initialize()}destroy(){this.geoWatchId!==null&&typeof navigator<"u"&&navigator.geolocation.clearWatch(this.geoWatchId),this.geoWatchId=null,this.geoHistory=[],this.deviceSignals=null,this.privacySignals=null,this.initialized=!1}};0&&(module.exports={QCApiClient,QuickCheckDeviceIntel,QuickCheckError,SDK_VERSION});
1
+ "use strict";var P=Object.create;var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var n in e)p(t,n,{get:e[n],enumerable:!0})},v=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of D(e))!G.call(t,i)&&i!==n&&p(t,i,{get:()=>e[i],enumerable:!(o=R(e,i))||o.enumerable});return t};var L=(t,e,n)=>(n=t!=null?P(A(t)):{},v(e||!t||!t.__esModule?p(n,"default",{value:t,enumerable:!0}):n,t)),U=t=>v(p({},"__esModule",{value:!0}),t);var X={};M(X,{QCApiClient:()=>g,QuickCheckDeviceIntel:()=>f,QuickCheckError:()=>u,SDK_VERSION:()=>y});module.exports=U(X);var u=class extends Error{constructor(n,o,i,r){super(n);this.code=o;this.status=i;this.details=r;this.name="QuickCheckError"}};var T="https://api.quickcheck.com.pa",N="/api/v1/sdk/device-intel/assess";function O(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let t=Math.random().toString(36).slice(2);return`${Date.now().toString(36)}-${t}`}var g=class{constructor(e){if(!e.apiKey)throw new u("apiKey is required","MISSING_API_KEY");this.apiKey=e.apiKey,this.apiUrl=(e.apiUrl??T).replace(/\/$/,""),this.timeout=e.timeout??5e3}async assess(e){let n=`${this.apiUrl}${N}`,o=new AbortController,i=setTimeout(()=>o.abort(),this.timeout),r=O(),c=new Date().toISOString(),s;try{s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-QC-SDK-Key":this.apiKey,"X-QC-SDK-Platform":e.platform,"X-QC-Nonce":r,"X-QC-Timestamp":c},body:JSON.stringify(e),signal:o.signal})}catch(d){throw clearTimeout(i),d.name==="AbortError"?new u(`Request timed out after ${this.timeout}ms`,"TIMEOUT"):new u(`Network error: ${d.message}`,"NETWORK_ERROR",void 0,d)}clearTimeout(i);let a;try{a=await s.json()}catch{throw new u(`Invalid JSON response (status ${s.status})`,"INVALID_RESPONSE",s.status)}if(!s.ok){let d=typeof a=="object"&&a!==null&&"detail"in a?String(a.detail):`HTTP ${s.status}`,l=s.status===401?"UNAUTHORIZED":s.status===403?"FORBIDDEN":s.status===429?"RATE_LIMITED":"HTTP_ERROR";throw new u(d,l,s.status,a)}return a}};function _(){let t=typeof navigator<"u"?navigator:{},e=typeof window<"u"?window.screen:null,n=e?`${e.width}x${e.height}`:null,o=null,i=null;try{o=new Date().getTimezoneOffset(),i=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}let r=(t.userAgent||"").toLowerCase(),c="desktop";/mobi|iphone|ipod|android/.test(r)?c="mobile":/ipad|tablet/.test(r)&&(c="tablet");let s="Unknown",a=null;if(/windows nt/.test(r)){s="Windows";let l=r.match(/windows nt ([\d.]+)/);a=l?l[1]:null}else if(/mac os x/.test(r)){s="macOS";let l=r.match(/mac os x ([\d_.]+)/);a=l?l[1].replace(/_/g,"."):null}else if(/android/.test(r)){s="Android";let l=r.match(/android ([\d.]+)/);a=l?l[1]:null}else if(/iphone|ipad|ipod/.test(r)){s="iOS";let l=r.match(/os ([\d_]+) like mac/);a=l?l[1].replace(/_/g,"."):null}else/linux/.test(r)&&(s="Linux");let d=t.deviceMemory??null;return{type:c,os_name:s,os_version:a,screen_resolution:n,language:t.language??null,languages:t.languages?Array.from(t.languages):[],timezone_offset:o,timezone_name:i,hardware_concurrency:t.hardwareConcurrency??null,device_memory_gb:d,touch_support:typeof window<"u"&&("ontouchstart"in window||(t.maxTouchPoints??0)>0)}}async function w(){try{let e=await(await import("@thumbmarkjs/thumbmarkjs")).getFingerprint();return typeof e=="string"?e:e&&typeof e.thumbmark=="string"?e.thumbmark:b()}catch{return b()}}function b(){let e=[typeof navigator<"u"?navigator.userAgent:"",typeof navigator<"u"?navigator.language:"",typeof screen<"u"?`${screen.width}x${screen.height}`:"",typeof screen<"u"?String(screen.colorDepth):"",String(new Date().getTimezoneOffset()),typeof navigator<"u"?String(navigator.hardwareConcurrency??""):""].join("|"),n=0;for(let o=0;o<e.length;o++)n=(n<<5)-n+e.charCodeAt(o),n|=0;return"qc_fb_"+Math.abs(n).toString(16).padStart(8,"0")}async function I(t=1e4){return typeof navigator>"u"||!navigator.geolocation?null:new Promise(e=>{let n=setTimeout(()=>e(null),t);navigator.geolocation.getCurrentPosition(o=>{clearTimeout(n),e({latitude:o.coords.latitude,longitude:o.coords.longitude,accuracy_m:Math.round(o.coords.accuracy),source:"gps"})},()=>{clearTimeout(n),e(null)},{enableHighAccuracy:!1,timeout:t,maximumAge:6e4})})}function S(){let e=navigator.connection;return{connection_type:e?.type??null,effective_type:e?.effectiveType??null}}async function m(t=2e3){return typeof RTCPeerConnection>"u"?[]:new Promise(e=>{let n=new Set;try{let o=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});o.createDataChannel(""),o.onicecandidate=i=>{if(!i.candidate||!i.candidate.candidate)return;let r=i.candidate.candidate.match(/(\d{1,3}(\.\d{1,3}){3})|([a-f0-9:]+:+[a-f0-9]+)/);r&&r[0]&&n.add(r[0])},o.createOffer().then(i=>o.setLocalDescription(i)).catch(()=>{}),setTimeout(()=>{try{o.close()}catch{}e(Array.from(n))},t)}catch{e([])}})}async function x(){let t=$(),e=H(),n=await K(),o=await m(1500);return{is_incognito:n,webgl_renderer:t,canvas_hash:e,local_ips:o}}function $(){try{let t=document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");if(!e)return null;let n=e.getExtension("WEBGL_debug_renderer_info");return n?e.getParameter(n.UNMASKED_RENDERER_WEBGL):null}catch{return null}}function H(){try{let t=document.createElement("canvas");t.width=220,t.height=60;let e=t.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("QuickCheck Device Intelligence",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("QuickCheck Device Intelligence",4,17);let n=t.toDataURL(),o=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);o=(o<<5)-o+r,o|=0}return o.toString(16)}catch{return null}}async function K(){try{let t=navigator;if(t.storage?.estimate){let{quota:e}=await t.storage.estimate();if(typeof e=="number")return e<120*1024*1024}}catch{}return null}function z(){try{return{acos04:Math.acos(.4),asin04:Math.asin(.4),atan04:Math.atan(.4),atanh04:Math.atanh(.4),cbrt100:Math.cbrt(100),cosh1:Math.cosh(1),expm11:Math.expm1(1),log1p10:Math.log1p(10),sinh1:Math.sinh(1),tanh1:Math.tanh(1),pow1_1e100:Math.pow(1.1,100)}}catch{return{}}}async function F(){try{let t=document.createElement("canvas");t.width=200,t.height=40;let e=t.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="18px sans-serif",e.fillText("\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}\u{1F1F5}\u{1F1E6}\u{1F44D}\u{1F3FD}\u{1FAE1}",2,2);let n=t.toDataURL();return j(n)}catch{return null}}function W(){try{if(!("speechSynthesis"in window))return{count:0,fingerprint:null};let t=window.speechSynthesis.getVoices();if(!t||t.length===0)return{count:0,fingerprint:null};let e=t.map(n=>`${n.name}|${n.lang}|${n.localService?"L":"R"}`).sort().join(",");return{count:t.length,fingerprint:h(e)}}catch{return{count:0,fingerprint:null}}}async function Q(){let t={audioinput:0,audiooutput:0,videoinput:0};try{if(!navigator.mediaDevices?.enumerateDevices)return t;let e=await navigator.mediaDevices.enumerateDevices();for(let n of e)n.kind==="audioinput"?t.audioinput++:n.kind==="audiooutput"?t.audiooutput++:n.kind==="videoinput"&&t.videoinput++}catch{}return t}function q(){try{let t=new Intl.DateTimeFormat().resolvedOptions();return`${t.locale}|${t.calendar}|${t.numberingSystem}|${t.hourCycle??"-"}|${t.timeZone}`}catch{return null}}async function B(){try{let t=navigator.keyboard;if(!t?.getLayoutMap)return null;let e=await t.getLayoutMap(),n=[];for(let[o,i]of e.entries())n.push(`${o}=${i}`);return h(n.sort().join("|"))}catch{return null}}function V(){let t={vendor:null,renderer:null,extensions:[],shaderPrecision:null};try{let e=document.createElement("canvas"),n=e.getContext("webgl")||e.getContext("experimental-webgl");if(!n)return t;let o=n.getExtension("WEBGL_debug_renderer_info");o&&(t.vendor=n.getParameter(o.UNMASKED_VENDOR_WEBGL),t.renderer=n.getParameter(o.UNMASKED_RENDERER_WEBGL)),t.extensions=n.getSupportedExtensions()??[];let i=n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT),r=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT);i&&r&&(t.shaderPrecision=`v:${i.rangeMin}/${i.rangeMax}/${i.precision};f:${r.rangeMin}/${r.rangeMax}/${r.precision}`)}catch{}return t}function h(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}async function j(t){try{let e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e),o=new Uint8Array(n),i="";for(let r=0;r<16;r++)i+=o[r].toString(16).padStart(2,"0");return i}catch{return h(t)}}async function E(){let[t,e,n]=await Promise.all([F(),Q(),B()]);return{math_constants:z(),emoji_hash:t,speech_voices:W(),media_devices:e,intl_signature:q(),keyboard_layout_hash:n,webgl_advanced:V()}}var y="1.0.0",C="qcdi_session_uuid",k="qcdi_previous_page",f=class{constructor(e){this.deviceSignals=null;this.privacySignals=null;this.advancedSignals=null;this.initialized=!1;this.sessionUuid="";this.geoWatchId=null;this.geoHistory=[];this.lastGeoLat=null;this.lastGeoLon=null;this.clientIpv4=null;this.clientIpv6=null;this.config={apiKey:e.apiKey,apiUrl:e.apiUrl??"https://api.quickcheck.com.pa",autoCollect:e.autoCollect??!0,requestGeolocation:e.requestGeolocation??!1,continuousGeolocation:e.continuousGeolocation??!1,timeout:e.timeout??5e3,onError:e.onError??(n=>console.error("[QCDI]",n)),debug:e.debug??!1},this.client=new g({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,timeout:this.config.timeout}),this.sessionUuid=this.resolveSessionUuid(),this.config.autoCollect&&this.initialize()}resolveSessionUuid(){try{let e=sessionStorage.getItem(C);if(e)return e;let n=this.generateUuid();return sessionStorage.setItem(C,n),n}catch{return this.generateUuid()}}generateUuid(){let e="0123456789abcdef",n="qcdis-";for(let o=0;o<32;o++)n+=e[Math.floor(Math.random()*16)],(o===7||o===11||o===15||o===19)&&(n+="-");return n}async initialize(){if(!this.initialized){this.config.debug&&console.log("[QCDI] Initializing...");try{let e=await w(),n=_();this.deviceSignals={fingerprint_hash:e,visitor_id:null,...n},this.privacySignals=await x(),this.advancedSignals=await E();let o=await m(1500);for(let i of o)i.includes(":")?this.clientIpv6||(this.clientIpv6=i):this.clientIpv4||(this.clientIpv4=i);this.initialized=!0,this.config.continuousGeolocation&&this.config.requestGeolocation&&this.startContinuousGeolocation(),this.config.debug&&console.log("[QCDI] Initialized",{fingerprint:e,session_uuid:this.sessionUuid,ipv4:this.clientIpv4,ipv6:this.clientIpv6})}catch(e){this.config.onError(e)}}}startContinuousGeolocation(){typeof navigator>"u"||!navigator.geolocation||this.geoWatchId===null&&(this.geoWatchId=navigator.geolocation.watchPosition(e=>{let{latitude:n,longitude:o,accuracy:i}=e.coords;this.lastGeoLat!==null&&this.lastGeoLon!==null&&this.haversineMeters(this.lastGeoLat,this.lastGeoLon,n,o)<50||(this.lastGeoLat=n,this.lastGeoLon=o,this.geoHistory.push({latitude:n,longitude:o,accuracy_m:Math.round(i),timestamp:new Date().toISOString()}),this.geoHistory.length>100&&(this.geoHistory=this.geoHistory.slice(-100)))},e=>{this.config.debug&&console.warn("[QCDI] Geo watch error:",e)},{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e4}))}haversineMeters(e,n,o,i){let c=l=>l*Math.PI/180,s=c(o-e),a=c(i-n),d=Math.sin(s/2)**2+Math.cos(c(e))*Math.cos(c(o))*Math.sin(a/2)**2;return 2*6371e3*Math.asin(Math.sqrt(d))}getPreviousPageUrl(){try{if(typeof document<"u"&&document.referrer)return document.referrer.slice(0,500)}catch{}return null}getFlowFromUrl(){try{let e=sessionStorage.getItem(k);return typeof window<"u"&&sessionStorage.setItem(k,window.location.href.slice(0,500)),e}catch{return null}}async assess(e){if(await this.initialize(),!this.deviceSignals)throw new Error("Device signals not collected. Call initialize() first.");let n=null;this.config.continuousGeolocation&&this.lastGeoLat!==null?n={latitude:this.lastGeoLat,longitude:this.lastGeoLon,accuracy_m:null,source:"gps"}:this.config.requestGeolocation&&(n=await I());let o={sdk_version:y,platform:"web",session_type:e.sessionType,device:this.deviceSignals,network:S(),privacy:this.privacySignals,geolocation:n,advanced:this.advancedSignals,context:{external_user_id:e.externalUserId??null,external_session_id:e.externalSessionId??null,declared_country:e.declaredCountry??null,person_name:e.personName??null,person_document_id:e.personDocumentId??null,custom_fields:e.customFields??{},previous_page_url:this.getPreviousPageUrl(),flow_from_url:this.getFlowFromUrl(),session_uuid:this.sessionUuid,geolocation_history:this.geoHistory.slice(),client_ipv4:this.clientIpv4,client_ipv6:this.clientIpv6,app_session_id:e.appSessionId??null}};this.config.debug&&console.log("[QCDI] Assessing",o);try{let i=await this.client.assess(o);return this.config.debug&&console.log("[QCDI] Result",i),i}catch(i){throw this.config.onError(i),i}}async refresh(){this.initialized=!1,await this.initialize()}destroy(){this.geoWatchId!==null&&typeof navigator<"u"&&navigator.geolocation.clearWatch(this.geoWatchId),this.geoWatchId=null,this.geoHistory=[],this.deviceSignals=null,this.privacySignals=null,this.initialized=!1}};0&&(module.exports={QCApiClient,QuickCheckDeviceIntel,QuickCheckError,SDK_VERSION});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var u=class extends Error{constructor(t,i,o,r){super(t);this.code=i;this.status=o;this.details=r;this.name="QuickCheckError"}};var C="https://api.quickcheck.com.pa",k="/api/v1/sdk/device-intel/assess",d=class{constructor(e){if(!e.apiKey)throw new u("apiKey is required","MISSING_API_KEY");this.apiKey=e.apiKey,this.apiUrl=(e.apiUrl??C).replace(/\/$/,""),this.timeout=e.timeout??5e3}async assess(e){let t=`${this.apiUrl}${k}`,i=new AbortController,o=setTimeout(()=>i.abort(),this.timeout),r;try{r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-QC-SDK-Key":this.apiKey,"X-QC-SDK-Platform":e.platform},body:JSON.stringify(e),signal:i.signal})}catch(a){throw clearTimeout(o),a.name==="AbortError"?new u(`Request timed out after ${this.timeout}ms`,"TIMEOUT"):new u(`Network error: ${a.message}`,"NETWORK_ERROR",void 0,a)}clearTimeout(o);let s;try{s=await r.json()}catch{throw new u(`Invalid JSON response (status ${r.status})`,"INVALID_RESPONSE",r.status)}if(!r.ok){let a=typeof s=="object"&&s!==null&&"detail"in s?String(s.detail):`HTTP ${r.status}`,c=r.status===401?"UNAUTHORIZED":r.status===403?"FORBIDDEN":r.status===429?"RATE_LIMITED":"HTTP_ERROR";throw new u(a,c,r.status,s)}return s}};function h(){let n=typeof navigator<"u"?navigator:{},e=typeof window<"u"?window.screen:null,t=e?`${e.width}x${e.height}`:null,i=null,o=null;try{i=new Date().getTimezoneOffset(),o=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}let r=(n.userAgent||"").toLowerCase(),s="desktop";/mobi|iphone|ipod|android/.test(r)?s="mobile":/ipad|tablet/.test(r)&&(s="tablet");let a="Unknown",c=null;if(/windows nt/.test(r)){a="Windows";let l=r.match(/windows nt ([\d.]+)/);c=l?l[1]:null}else if(/mac os x/.test(r)){a="macOS";let l=r.match(/mac os x ([\d_.]+)/);c=l?l[1].replace(/_/g,"."):null}else if(/android/.test(r)){a="Android";let l=r.match(/android ([\d.]+)/);c=l?l[1]:null}else if(/iphone|ipad|ipod/.test(r)){a="iOS";let l=r.match(/os ([\d_]+) like mac/);c=l?l[1].replace(/_/g,"."):null}else/linux/.test(r)&&(a="Linux");let p=n.deviceMemory??null;return{type:s,os_name:a,os_version:c,screen_resolution:t,language:n.language??null,languages:n.languages?Array.from(n.languages):[],timezone_offset:i,timezone_name:o,hardware_concurrency:n.hardwareConcurrency??null,device_memory_gb:p,touch_support:typeof window<"u"&&("ontouchstart"in window||(n.maxTouchPoints??0)>0)}}async function v(){try{let e=await(await import("@thumbmarkjs/thumbmarkjs")).getFingerprint();return typeof e=="string"?e:e&&typeof e.thumbmark=="string"?e.thumbmark:y()}catch{return y()}}function y(){let e=[typeof navigator<"u"?navigator.userAgent:"",typeof navigator<"u"?navigator.language:"",typeof screen<"u"?`${screen.width}x${screen.height}`:"",typeof screen<"u"?String(screen.colorDepth):"",String(new Date().getTimezoneOffset()),typeof navigator<"u"?String(navigator.hardwareConcurrency??""):""].join("|"),t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return"qc_fb_"+Math.abs(t).toString(16).padStart(8,"0")}async function _(n=1e4){return typeof navigator>"u"||!navigator.geolocation?null:new Promise(e=>{let t=setTimeout(()=>e(null),n);navigator.geolocation.getCurrentPosition(i=>{clearTimeout(t),e({latitude:i.coords.latitude,longitude:i.coords.longitude,accuracy_m:Math.round(i.coords.accuracy),source:"gps"})},()=>{clearTimeout(t),e(null)},{enableHighAccuracy:!1,timeout:n,maximumAge:6e4})})}function b(){let e=navigator.connection;return{connection_type:e?.type??null,effective_type:e?.effectiveType??null}}async function g(n=2e3){return typeof RTCPeerConnection>"u"?[]:new Promise(e=>{let t=new Set;try{let i=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});i.createDataChannel(""),i.onicecandidate=o=>{if(!o.candidate||!o.candidate.candidate)return;let r=o.candidate.candidate.match(/(\d{1,3}(\.\d{1,3}){3})|([a-f0-9:]+:+[a-f0-9]+)/);r&&r[0]&&t.add(r[0])},i.createOffer().then(o=>i.setLocalDescription(o)).catch(()=>{}),setTimeout(()=>{try{i.close()}catch{}e(Array.from(t))},n)}catch{e([])}})}async function w(){let n=P(),e=R(),t=await A(),i=await g(1500);return{is_incognito:t,webgl_renderer:n,canvas_hash:e,local_ips:i}}function P(){try{let n=document.createElement("canvas"),e=n.getContext("webgl")||n.getContext("experimental-webgl");if(!e)return null;let t=e.getExtension("WEBGL_debug_renderer_info");return t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):null}catch{return null}}function R(){try{let n=document.createElement("canvas");n.width=220,n.height=60;let e=n.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("QuickCheck Device Intelligence",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("QuickCheck Device Intelligence",4,17);let t=n.toDataURL(),i=0;for(let o=0;o<t.length;o++){let r=t.charCodeAt(o);i=(i<<5)-i+r,i|=0}return i.toString(16)}catch{return null}}async function A(){try{let n=navigator;if(n.storage?.estimate){let{quota:e}=await n.storage.estimate();if(typeof e=="number")return e<120*1024*1024}}catch{}return null}function D(){try{return{acos04:Math.acos(.4),asin04:Math.asin(.4),atan04:Math.atan(.4),atanh04:Math.atanh(.4),cbrt100:Math.cbrt(100),cosh1:Math.cosh(1),expm11:Math.expm1(1),log1p10:Math.log1p(10),sinh1:Math.sinh(1),tanh1:Math.tanh(1),pow1_1e100:Math.pow(1.1,100)}}catch{return{}}}async function G(){try{let n=document.createElement("canvas");n.width=200,n.height=40;let e=n.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="18px sans-serif",e.fillText("\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}\u{1F1F5}\u{1F1E6}\u{1F44D}\u{1F3FD}\u{1FAE1}",2,2);let t=n.toDataURL();return O(t)}catch{return null}}function L(){try{if(!("speechSynthesis"in window))return{count:0,fingerprint:null};let n=window.speechSynthesis.getVoices();if(!n||n.length===0)return{count:0,fingerprint:null};let e=n.map(t=>`${t.name}|${t.lang}|${t.localService?"L":"R"}`).sort().join(",");return{count:n.length,fingerprint:m(e)}}catch{return{count:0,fingerprint:null}}}async function M(){let n={audioinput:0,audiooutput:0,videoinput:0};try{if(!navigator.mediaDevices?.enumerateDevices)return n;let e=await navigator.mediaDevices.enumerateDevices();for(let t of e)t.kind==="audioinput"?n.audioinput++:t.kind==="audiooutput"?n.audiooutput++:t.kind==="videoinput"&&n.videoinput++}catch{}return n}function T(){try{let n=new Intl.DateTimeFormat().resolvedOptions();return`${n.locale}|${n.calendar}|${n.numberingSystem}|${n.hourCycle??"-"}|${n.timeZone}`}catch{return null}}async function U(){try{let n=navigator.keyboard;if(!n?.getLayoutMap)return null;let e=await n.getLayoutMap(),t=[];for(let[i,o]of e.entries())t.push(`${i}=${o}`);return m(t.sort().join("|"))}catch{return null}}function N(){let n={vendor:null,renderer:null,extensions:[],shaderPrecision:null};try{let e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return n;let i=t.getExtension("WEBGL_debug_renderer_info");i&&(n.vendor=t.getParameter(i.UNMASKED_VENDOR_WEBGL),n.renderer=t.getParameter(i.UNMASKED_RENDERER_WEBGL)),n.extensions=t.getSupportedExtensions()??[];let o=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT),r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);o&&r&&(n.shaderPrecision=`v:${o.rangeMin}/${o.rangeMax}/${o.precision};f:${r.rangeMin}/${r.rangeMax}/${r.precision}`)}catch{}return n}function m(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}async function O(n){try{let e=new TextEncoder().encode(n),t=await crypto.subtle.digest("SHA-256",e),i=new Uint8Array(t),o="";for(let r=0;r<16;r++)o+=i[r].toString(16).padStart(2,"0");return o}catch{return m(n)}}async function I(){let[n,e,t]=await Promise.all([G(),M(),U()]);return{math_constants:D(),emoji_hash:n,speech_voices:L(),media_devices:e,intl_signature:T(),keyboard_layout_hash:t,webgl_advanced:N()}}var E="1.0.0",S="qcdi_session_uuid",x="qcdi_previous_page",f=class{constructor(e){this.deviceSignals=null;this.privacySignals=null;this.advancedSignals=null;this.initialized=!1;this.sessionUuid="";this.geoWatchId=null;this.geoHistory=[];this.lastGeoLat=null;this.lastGeoLon=null;this.clientIpv4=null;this.clientIpv6=null;this.config={apiKey:e.apiKey,apiUrl:e.apiUrl??"https://api.quickcheck.com.pa",autoCollect:e.autoCollect??!0,requestGeolocation:e.requestGeolocation??!1,continuousGeolocation:e.continuousGeolocation??!1,timeout:e.timeout??5e3,onError:e.onError??(t=>console.error("[QCDI]",t)),debug:e.debug??!1},this.client=new d({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,timeout:this.config.timeout}),this.sessionUuid=this.resolveSessionUuid(),this.config.autoCollect&&this.initialize()}resolveSessionUuid(){try{let e=sessionStorage.getItem(S);if(e)return e;let t=this.generateUuid();return sessionStorage.setItem(S,t),t}catch{return this.generateUuid()}}generateUuid(){let e="0123456789abcdef",t="qcdis-";for(let i=0;i<32;i++)t+=e[Math.floor(Math.random()*16)],(i===7||i===11||i===15||i===19)&&(t+="-");return t}async initialize(){if(!this.initialized){this.config.debug&&console.log("[QCDI] Initializing...");try{let e=await v(),t=h();this.deviceSignals={fingerprint_hash:e,visitor_id:null,...t},this.privacySignals=await w(),this.advancedSignals=await I();let i=await g(1500);for(let o of i)o.includes(":")?this.clientIpv6||(this.clientIpv6=o):this.clientIpv4||(this.clientIpv4=o);this.initialized=!0,this.config.continuousGeolocation&&this.config.requestGeolocation&&this.startContinuousGeolocation(),this.config.debug&&console.log("[QCDI] Initialized",{fingerprint:e,session_uuid:this.sessionUuid,ipv4:this.clientIpv4,ipv6:this.clientIpv6})}catch(e){this.config.onError(e)}}}startContinuousGeolocation(){typeof navigator>"u"||!navigator.geolocation||this.geoWatchId===null&&(this.geoWatchId=navigator.geolocation.watchPosition(e=>{let{latitude:t,longitude:i,accuracy:o}=e.coords;this.lastGeoLat!==null&&this.lastGeoLon!==null&&this.haversineMeters(this.lastGeoLat,this.lastGeoLon,t,i)<50||(this.lastGeoLat=t,this.lastGeoLon=i,this.geoHistory.push({latitude:t,longitude:i,accuracy_m:Math.round(o),timestamp:new Date().toISOString()}),this.geoHistory.length>100&&(this.geoHistory=this.geoHistory.slice(-100)))},e=>{this.config.debug&&console.warn("[QCDI] Geo watch error:",e)},{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e4}))}haversineMeters(e,t,i,o){let s=l=>l*Math.PI/180,a=s(i-e),c=s(o-t),p=Math.sin(a/2)**2+Math.cos(s(e))*Math.cos(s(i))*Math.sin(c/2)**2;return 2*6371e3*Math.asin(Math.sqrt(p))}getPreviousPageUrl(){try{if(typeof document<"u"&&document.referrer)return document.referrer.slice(0,500)}catch{}return null}getFlowFromUrl(){try{let e=sessionStorage.getItem(x);return typeof window<"u"&&sessionStorage.setItem(x,window.location.href.slice(0,500)),e}catch{return null}}async assess(e){if(await this.initialize(),!this.deviceSignals)throw new Error("Device signals not collected. Call initialize() first.");let t=null;this.config.continuousGeolocation&&this.lastGeoLat!==null?t={latitude:this.lastGeoLat,longitude:this.lastGeoLon,accuracy_m:null,source:"gps"}:this.config.requestGeolocation&&(t=await _());let i={sdk_version:E,platform:"web",session_type:e.sessionType,device:this.deviceSignals,network:b(),privacy:this.privacySignals,geolocation:t,advanced:this.advancedSignals,context:{external_user_id:e.externalUserId??null,external_session_id:e.externalSessionId??null,declared_country:e.declaredCountry??null,person_name:e.personName??null,person_document_id:e.personDocumentId??null,custom_fields:e.customFields??{},previous_page_url:this.getPreviousPageUrl(),flow_from_url:this.getFlowFromUrl(),session_uuid:this.sessionUuid,geolocation_history:this.geoHistory.slice(),client_ipv4:this.clientIpv4,client_ipv6:this.clientIpv6,app_session_id:e.appSessionId??null}};this.config.debug&&console.log("[QCDI] Assessing",i);try{let o=await this.client.assess(i);return this.config.debug&&console.log("[QCDI] Result",o),o}catch(o){throw this.config.onError(o),o}}async refresh(){this.initialized=!1,await this.initialize()}destroy(){this.geoWatchId!==null&&typeof navigator<"u"&&navigator.geolocation.clearWatch(this.geoWatchId),this.geoWatchId=null,this.geoHistory=[],this.deviceSignals=null,this.privacySignals=null,this.initialized=!1}};export{d as QCApiClient,f as QuickCheckDeviceIntel,u as QuickCheckError,E as SDK_VERSION};
1
+ var d=class extends Error{constructor(t,o,i,r){super(t);this.code=o;this.status=i;this.details=r;this.name="QuickCheckError"}};var C="https://api.quickcheck.com.pa",k="/api/v1/sdk/device-intel/assess";function P(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let n=Math.random().toString(36).slice(2);return`${Date.now().toString(36)}-${n}`}var g=class{constructor(e){if(!e.apiKey)throw new d("apiKey is required","MISSING_API_KEY");this.apiKey=e.apiKey,this.apiUrl=(e.apiUrl??C).replace(/\/$/,""),this.timeout=e.timeout??5e3}async assess(e){let t=`${this.apiUrl}${k}`,o=new AbortController,i=setTimeout(()=>o.abort(),this.timeout),r=P(),c=new Date().toISOString(),s;try{s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-QC-SDK-Key":this.apiKey,"X-QC-SDK-Platform":e.platform,"X-QC-Nonce":r,"X-QC-Timestamp":c},body:JSON.stringify(e),signal:o.signal})}catch(u){throw clearTimeout(i),u.name==="AbortError"?new d(`Request timed out after ${this.timeout}ms`,"TIMEOUT"):new d(`Network error: ${u.message}`,"NETWORK_ERROR",void 0,u)}clearTimeout(i);let a;try{a=await s.json()}catch{throw new d(`Invalid JSON response (status ${s.status})`,"INVALID_RESPONSE",s.status)}if(!s.ok){let u=typeof a=="object"&&a!==null&&"detail"in a?String(a.detail):`HTTP ${s.status}`,l=s.status===401?"UNAUTHORIZED":s.status===403?"FORBIDDEN":s.status===429?"RATE_LIMITED":"HTTP_ERROR";throw new d(u,l,s.status,a)}return a}};function h(){let n=typeof navigator<"u"?navigator:{},e=typeof window<"u"?window.screen:null,t=e?`${e.width}x${e.height}`:null,o=null,i=null;try{o=new Date().getTimezoneOffset(),i=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}let r=(n.userAgent||"").toLowerCase(),c="desktop";/mobi|iphone|ipod|android/.test(r)?c="mobile":/ipad|tablet/.test(r)&&(c="tablet");let s="Unknown",a=null;if(/windows nt/.test(r)){s="Windows";let l=r.match(/windows nt ([\d.]+)/);a=l?l[1]:null}else if(/mac os x/.test(r)){s="macOS";let l=r.match(/mac os x ([\d_.]+)/);a=l?l[1].replace(/_/g,"."):null}else if(/android/.test(r)){s="Android";let l=r.match(/android ([\d.]+)/);a=l?l[1]:null}else if(/iphone|ipad|ipod/.test(r)){s="iOS";let l=r.match(/os ([\d_]+) like mac/);a=l?l[1].replace(/_/g,"."):null}else/linux/.test(r)&&(s="Linux");let u=n.deviceMemory??null;return{type:c,os_name:s,os_version:a,screen_resolution:t,language:n.language??null,languages:n.languages?Array.from(n.languages):[],timezone_offset:o,timezone_name:i,hardware_concurrency:n.hardwareConcurrency??null,device_memory_gb:u,touch_support:typeof window<"u"&&("ontouchstart"in window||(n.maxTouchPoints??0)>0)}}async function v(){try{let e=await(await import("@thumbmarkjs/thumbmarkjs")).getFingerprint();return typeof e=="string"?e:e&&typeof e.thumbmark=="string"?e.thumbmark:y()}catch{return y()}}function y(){let e=[typeof navigator<"u"?navigator.userAgent:"",typeof navigator<"u"?navigator.language:"",typeof screen<"u"?`${screen.width}x${screen.height}`:"",typeof screen<"u"?String(screen.colorDepth):"",String(new Date().getTimezoneOffset()),typeof navigator<"u"?String(navigator.hardwareConcurrency??""):""].join("|"),t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o),t|=0;return"qc_fb_"+Math.abs(t).toString(16).padStart(8,"0")}async function _(n=1e4){return typeof navigator>"u"||!navigator.geolocation?null:new Promise(e=>{let t=setTimeout(()=>e(null),n);navigator.geolocation.getCurrentPosition(o=>{clearTimeout(t),e({latitude:o.coords.latitude,longitude:o.coords.longitude,accuracy_m:Math.round(o.coords.accuracy),source:"gps"})},()=>{clearTimeout(t),e(null)},{enableHighAccuracy:!1,timeout:n,maximumAge:6e4})})}function b(){let e=navigator.connection;return{connection_type:e?.type??null,effective_type:e?.effectiveType??null}}async function p(n=2e3){return typeof RTCPeerConnection>"u"?[]:new Promise(e=>{let t=new Set;try{let o=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});o.createDataChannel(""),o.onicecandidate=i=>{if(!i.candidate||!i.candidate.candidate)return;let r=i.candidate.candidate.match(/(\d{1,3}(\.\d{1,3}){3})|([a-f0-9:]+:+[a-f0-9]+)/);r&&r[0]&&t.add(r[0])},o.createOffer().then(i=>o.setLocalDescription(i)).catch(()=>{}),setTimeout(()=>{try{o.close()}catch{}e(Array.from(t))},n)}catch{e([])}})}async function w(){let n=R(),e=D(),t=await A(),o=await p(1500);return{is_incognito:t,webgl_renderer:n,canvas_hash:e,local_ips:o}}function R(){try{let n=document.createElement("canvas"),e=n.getContext("webgl")||n.getContext("experimental-webgl");if(!e)return null;let t=e.getExtension("WEBGL_debug_renderer_info");return t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):null}catch{return null}}function D(){try{let n=document.createElement("canvas");n.width=220,n.height=60;let e=n.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("QuickCheck Device Intelligence",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("QuickCheck Device Intelligence",4,17);let t=n.toDataURL(),o=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);o=(o<<5)-o+r,o|=0}return o.toString(16)}catch{return null}}async function A(){try{let n=navigator;if(n.storage?.estimate){let{quota:e}=await n.storage.estimate();if(typeof e=="number")return e<120*1024*1024}}catch{}return null}function G(){try{return{acos04:Math.acos(.4),asin04:Math.asin(.4),atan04:Math.atan(.4),atanh04:Math.atanh(.4),cbrt100:Math.cbrt(100),cosh1:Math.cosh(1),expm11:Math.expm1(1),log1p10:Math.log1p(10),sinh1:Math.sinh(1),tanh1:Math.tanh(1),pow1_1e100:Math.pow(1.1,100)}}catch{return{}}}async function M(){try{let n=document.createElement("canvas");n.width=200,n.height=40;let e=n.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="18px sans-serif",e.fillText("\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}\u{1F1F5}\u{1F1E6}\u{1F44D}\u{1F3FD}\u{1FAE1}",2,2);let t=n.toDataURL();return $(t)}catch{return null}}function L(){try{if(!("speechSynthesis"in window))return{count:0,fingerprint:null};let n=window.speechSynthesis.getVoices();if(!n||n.length===0)return{count:0,fingerprint:null};let e=n.map(t=>`${t.name}|${t.lang}|${t.localService?"L":"R"}`).sort().join(",");return{count:n.length,fingerprint:m(e)}}catch{return{count:0,fingerprint:null}}}async function U(){let n={audioinput:0,audiooutput:0,videoinput:0};try{if(!navigator.mediaDevices?.enumerateDevices)return n;let e=await navigator.mediaDevices.enumerateDevices();for(let t of e)t.kind==="audioinput"?n.audioinput++:t.kind==="audiooutput"?n.audiooutput++:t.kind==="videoinput"&&n.videoinput++}catch{}return n}function T(){try{let n=new Intl.DateTimeFormat().resolvedOptions();return`${n.locale}|${n.calendar}|${n.numberingSystem}|${n.hourCycle??"-"}|${n.timeZone}`}catch{return null}}async function N(){try{let n=navigator.keyboard;if(!n?.getLayoutMap)return null;let e=await n.getLayoutMap(),t=[];for(let[o,i]of e.entries())t.push(`${o}=${i}`);return m(t.sort().join("|"))}catch{return null}}function O(){let n={vendor:null,renderer:null,extensions:[],shaderPrecision:null};try{let e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return n;let o=t.getExtension("WEBGL_debug_renderer_info");o&&(n.vendor=t.getParameter(o.UNMASKED_VENDOR_WEBGL),n.renderer=t.getParameter(o.UNMASKED_RENDERER_WEBGL)),n.extensions=t.getSupportedExtensions()??[];let i=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT),r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);i&&r&&(n.shaderPrecision=`v:${i.rangeMin}/${i.rangeMax}/${i.precision};f:${r.rangeMin}/${r.rangeMax}/${r.precision}`)}catch{}return n}function m(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}async function $(n){try{let e=new TextEncoder().encode(n),t=await crypto.subtle.digest("SHA-256",e),o=new Uint8Array(t),i="";for(let r=0;r<16;r++)i+=o[r].toString(16).padStart(2,"0");return i}catch{return m(n)}}async function I(){let[n,e,t]=await Promise.all([M(),U(),N()]);return{math_constants:G(),emoji_hash:n,speech_voices:L(),media_devices:e,intl_signature:T(),keyboard_layout_hash:t,webgl_advanced:O()}}var E="1.0.0",S="qcdi_session_uuid",x="qcdi_previous_page",f=class{constructor(e){this.deviceSignals=null;this.privacySignals=null;this.advancedSignals=null;this.initialized=!1;this.sessionUuid="";this.geoWatchId=null;this.geoHistory=[];this.lastGeoLat=null;this.lastGeoLon=null;this.clientIpv4=null;this.clientIpv6=null;this.config={apiKey:e.apiKey,apiUrl:e.apiUrl??"https://api.quickcheck.com.pa",autoCollect:e.autoCollect??!0,requestGeolocation:e.requestGeolocation??!1,continuousGeolocation:e.continuousGeolocation??!1,timeout:e.timeout??5e3,onError:e.onError??(t=>console.error("[QCDI]",t)),debug:e.debug??!1},this.client=new g({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,timeout:this.config.timeout}),this.sessionUuid=this.resolveSessionUuid(),this.config.autoCollect&&this.initialize()}resolveSessionUuid(){try{let e=sessionStorage.getItem(S);if(e)return e;let t=this.generateUuid();return sessionStorage.setItem(S,t),t}catch{return this.generateUuid()}}generateUuid(){let e="0123456789abcdef",t="qcdis-";for(let o=0;o<32;o++)t+=e[Math.floor(Math.random()*16)],(o===7||o===11||o===15||o===19)&&(t+="-");return t}async initialize(){if(!this.initialized){this.config.debug&&console.log("[QCDI] Initializing...");try{let e=await v(),t=h();this.deviceSignals={fingerprint_hash:e,visitor_id:null,...t},this.privacySignals=await w(),this.advancedSignals=await I();let o=await p(1500);for(let i of o)i.includes(":")?this.clientIpv6||(this.clientIpv6=i):this.clientIpv4||(this.clientIpv4=i);this.initialized=!0,this.config.continuousGeolocation&&this.config.requestGeolocation&&this.startContinuousGeolocation(),this.config.debug&&console.log("[QCDI] Initialized",{fingerprint:e,session_uuid:this.sessionUuid,ipv4:this.clientIpv4,ipv6:this.clientIpv6})}catch(e){this.config.onError(e)}}}startContinuousGeolocation(){typeof navigator>"u"||!navigator.geolocation||this.geoWatchId===null&&(this.geoWatchId=navigator.geolocation.watchPosition(e=>{let{latitude:t,longitude:o,accuracy:i}=e.coords;this.lastGeoLat!==null&&this.lastGeoLon!==null&&this.haversineMeters(this.lastGeoLat,this.lastGeoLon,t,o)<50||(this.lastGeoLat=t,this.lastGeoLon=o,this.geoHistory.push({latitude:t,longitude:o,accuracy_m:Math.round(i),timestamp:new Date().toISOString()}),this.geoHistory.length>100&&(this.geoHistory=this.geoHistory.slice(-100)))},e=>{this.config.debug&&console.warn("[QCDI] Geo watch error:",e)},{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e4}))}haversineMeters(e,t,o,i){let c=l=>l*Math.PI/180,s=c(o-e),a=c(i-t),u=Math.sin(s/2)**2+Math.cos(c(e))*Math.cos(c(o))*Math.sin(a/2)**2;return 2*6371e3*Math.asin(Math.sqrt(u))}getPreviousPageUrl(){try{if(typeof document<"u"&&document.referrer)return document.referrer.slice(0,500)}catch{}return null}getFlowFromUrl(){try{let e=sessionStorage.getItem(x);return typeof window<"u"&&sessionStorage.setItem(x,window.location.href.slice(0,500)),e}catch{return null}}async assess(e){if(await this.initialize(),!this.deviceSignals)throw new Error("Device signals not collected. Call initialize() first.");let t=null;this.config.continuousGeolocation&&this.lastGeoLat!==null?t={latitude:this.lastGeoLat,longitude:this.lastGeoLon,accuracy_m:null,source:"gps"}:this.config.requestGeolocation&&(t=await _());let o={sdk_version:E,platform:"web",session_type:e.sessionType,device:this.deviceSignals,network:b(),privacy:this.privacySignals,geolocation:t,advanced:this.advancedSignals,context:{external_user_id:e.externalUserId??null,external_session_id:e.externalSessionId??null,declared_country:e.declaredCountry??null,person_name:e.personName??null,person_document_id:e.personDocumentId??null,custom_fields:e.customFields??{},previous_page_url:this.getPreviousPageUrl(),flow_from_url:this.getFlowFromUrl(),session_uuid:this.sessionUuid,geolocation_history:this.geoHistory.slice(),client_ipv4:this.clientIpv4,client_ipv6:this.clientIpv6,app_session_id:e.appSessionId??null}};this.config.debug&&console.log("[QCDI] Assessing",o);try{let i=await this.client.assess(o);return this.config.debug&&console.log("[QCDI] Result",i),i}catch(i){throw this.config.onError(i),i}}async refresh(){this.initialized=!1,await this.initialize()}destroy(){this.geoWatchId!==null&&typeof navigator<"u"&&navigator.geolocation.clearWatch(this.geoWatchId),this.geoWatchId=null,this.geoHistory=[],this.deviceSignals=null,this.privacySignals=null,this.initialized=!1}};export{g as QCApiClient,f as QuickCheckDeviceIntel,d as QuickCheckError,E as SDK_VERSION};
@@ -1,4 +1,4 @@
1
- "use strict";var QuickCheck=(()=>{var R=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var ae=(t,e)=>()=>(t&&(e=t(t=0)),e);var G=(t,e)=>{for(var r in e)R(t,r,{get:e[r],enumerable:!0})},se=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oe(e))!ie.call(t,i)&&i!==r&&R(t,i,{get:()=>e[i],enumerable:!(o=re(e,i))||o.enumerable});return t};var le=t=>se(R({},"__esModule",{value:!0}),t);var V={};G(V,{getFingerprint:()=>he,getFingerprintData:()=>j,getFingerprintPerformance:()=>pe,getVersion:()=>me,includeComponent:()=>v,setOption:()=>de});function y(t,e,r,o){return new(r||(r=Promise))((function(i,a){function n(l){try{u(o.next(l))}catch(s){a(s)}}function c(l){try{u(o.throw(l))}catch(s){a(s)}}function u(l){var s;l.done?i(l.value):(s=l.value,s instanceof r?s:new r((function(m){m(s)}))).then(n,c)}u((o=o.apply(t,e||[])).next())}))}function w(t,e){var r,o,i,a,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(l){return(function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(n=0)),n;)try{if(r=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,o=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!((i=i.length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1],i=s;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(s);break}i[2]&&n.ops.pop(),n.trys.pop();continue}s=e.call(t,n)}catch(m){s=[6,m],o=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}})([u,l])}}}function de(t,e){if(!["include","exclude","permissions_to_check","retries","timeout","logging"].includes(t))throw new Error("Unknown option "+t);if(["include","exclude","permissions_to_check"].includes(t)&&(!Array.isArray(e)||!e.every((function(r){return typeof r=="string"}))))throw new Error("The value of the include, exclude and permissions_to_check must be an array of strings");if(["retries","timeout"].includes(t)&&typeof e!="number")throw new Error("The value of retries must be a number");g[t]=e}function A(t){return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),(t^=t>>>16)>>>0}function p(t,e){return t<<e|t>>>32-e}function T(t,e){var r;if(e===void 0&&(e=0),e=e?0|e:0,typeof t=="string"&&(r=t,t=new TextEncoder().encode(r).buffer),!(t instanceof ArrayBuffer))throw new TypeError("Expected key to be ArrayBuffer or string");var o=new Uint32Array([e,e,e,e]);(function(a,n){for(var c=a.byteLength/16|0,u=new Uint32Array(a,0,4*c),l=0;l<c;l++){var s=u.subarray(4*l,4*(l+1));s[0]=Math.imul(s[0],f[0]),s[0]=p(s[0],15),s[0]=Math.imul(s[0],f[1]),n[0]=n[0]^s[0],n[0]=p(n[0],19),n[0]=n[0]+n[1],n[0]=Math.imul(n[0],5)+1444728091,s[1]=Math.imul(s[1],f[1]),s[1]=p(s[1],16),s[1]=Math.imul(s[1],f[2]),n[1]=n[1]^s[1],n[1]=p(n[1],17),n[1]=n[1]+n[2],n[1]=Math.imul(n[1],5)+197830471,s[2]=Math.imul(s[2],f[2]),s[2]=p(s[2],17),s[2]=Math.imul(s[2],f[3]),n[2]=n[2]^s[2],n[2]=p(n[2],15),n[2]=n[2]+n[3],n[2]=Math.imul(n[2],5)+2530024501,s[3]=Math.imul(s[3],f[3]),s[3]=p(s[3],18),s[3]=Math.imul(s[3],f[0]),n[3]=n[3]^s[3],n[3]=p(n[3],13),n[3]=n[3]+n[0],n[3]=Math.imul(n[3],5)+850148119}})(t,o),(function(a,n){var c=a.byteLength/16|0,u=a.byteLength%16,l=new Uint32Array(4),s=new Uint8Array(a,16*c,u);switch(u){case 15:l[3]=l[3]^s[14]<<16;case 14:l[3]=l[3]^s[13]<<8;case 13:l[3]=l[3]^s[12],l[3]=Math.imul(l[3],f[3]),l[3]=p(l[3],18),l[3]=Math.imul(l[3],f[0]),n[3]=n[3]^l[3];case 12:l[2]=l[2]^s[11]<<24;case 11:l[2]=l[2]^s[10]<<16;case 10:l[2]=l[2]^s[9]<<8;case 9:l[2]=l[2]^s[8],l[2]=Math.imul(l[2],f[2]),l[2]=p(l[2],17),l[2]=Math.imul(l[2],f[3]),n[2]=n[2]^l[2];case 8:l[1]=l[1]^s[7]<<24;case 7:l[1]=l[1]^s[6]<<16;case 6:l[1]=l[1]^s[5]<<8;case 5:l[1]=l[1]^s[4],l[1]=Math.imul(l[1],f[1]),l[1]=p(l[1],16),l[1]=Math.imul(l[1],f[2]),n[1]=n[1]^l[1];case 4:l[0]=l[0]^s[3]<<24;case 3:l[0]=l[0]^s[2]<<16;case 2:l[0]=l[0]^s[1]<<8;case 1:l[0]=l[0]^s[0],l[0]=Math.imul(l[0],f[0]),l[0]=p(l[0],15),l[0]=Math.imul(l[0],f[1]),n[0]=n[0]^l[0]}})(t,o),(function(a,n){n[0]=n[0]^a.byteLength,n[1]=n[1]^a.byteLength,n[2]=n[2]^a.byteLength,n[3]=n[3]^a.byteLength,n[0]=n[0]+n[1]|0,n[0]=n[0]+n[2]|0,n[0]=n[0]+n[3]|0,n[1]=n[1]+n[0]|0,n[2]=n[2]+n[0]|0,n[3]=n[3]+n[0]|0,n[0]=A(n[0]),n[1]=A(n[1]),n[2]=A(n[2]),n[3]=A(n[3]),n[0]=n[0]+n[1]|0,n[0]=n[0]+n[2]|0,n[0]=n[0]+n[3]|0,n[1]=n[1]+n[0]|0,n[2]=n[2]+n[0]|0,n[3]=n[3]+n[0]|0})(t,o);var i=new Uint8Array(o.buffer);return Array.from(i).map((function(a){return a.toString(16).padStart(2,"0")})).join("")}function H(t,e){return new Promise((function(r){setTimeout((function(){return r(e)}),t)}))}function ge(t,e,r){return Promise.all(t.map((function(o){var i=performance.now();return Promise.race([o.then((function(a){return{value:a,elapsed:performance.now()-i}})),H(e,r).then((function(a){return{value:a,elapsed:performance.now()-i}}))])})))}function fe(t,e,r){return Promise.all(t.map((function(o){return Promise.race([o,H(e,r)])})))}function me(){return"0.20.5"}function j(){return y(this,void 0,void 0,(function(){var t,e,r,o,i;return w(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=W(),e=Object.keys(t),[4,fe(Object.values(t),g?.timeout||1e3,B)];case 1:return r=a.sent(),o=r.filter((function(n){return n!==void 0})),i={},o.forEach((function(n,c){i[e[c]]=n})),[2,K(i,g.exclude||[],g.include||[],"")];case 2:throw a.sent();case 3:return[2]}}))}))}function K(t,e,r,o){o===void 0&&(o="");for(var i={},a=function(l,s){var m=o+l+".";if(typeof s!="object"||Array.isArray(s)){var k=e.some((function(P){return m.startsWith(P)})),I=r.some((function(P){return m.startsWith(P)}));k&&!I||(i[l]=s)}else{var S=K(s,e,r,m);Object.keys(S).length>0&&(i[l]=S)}},n=0,c=Object.entries(t);n<c.length;n++){var u=c[n];a(u[0],u[1])}return i}function he(t){return y(this,void 0,void 0,(function(){var e,r;return w(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,j()];case 1:return e=o.sent(),r=T(JSON.stringify(e)),Math.random()<1e-5&&g.logging&&(function(i,a){y(this,void 0,void 0,(function(){var n,c;return w(this,(function(u){switch(u.label){case 0:if(n="https://logging.thumbmarkjs.com/v1/log",c={thumbmark:i,components:a,version:"0.20.5"},sessionStorage.getItem("_tmjs_l"))return[3,4];sessionStorage.setItem("_tmjs_l","1"),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})];case 2:case 3:return u.sent(),[3,4];case 4:return[2]}}))}))})(r,e),t?[2,{hash:r.toString(),data:e}]:[2,r.toString()];case 2:throw o.sent();case 3:return[2]}}))}))}function pe(){return y(this,void 0,void 0,(function(){var t,e,r,o;return w(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=W(),e=Object.keys(t),[4,ge(Object.values(t),g?.timeout||1e3,B)];case 1:return r=i.sent(),o={elapsed:{}},r.forEach((function(a,n){o[e[n]]=a.value,o.elapsed[e[n]]=a.elapsed})),[2,o];case 2:throw i.sent();case 3:return[2]}}))}))}function x(){if(typeof navigator>"u")return{name:"unknown",version:"unknown"};for(var t=navigator.userAgent,e={edg:"Edge",opr:"Opera",samsung:"SamsungBrowser"},r=0,o=[/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/,/(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/,/(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/,/(?<name>samsung).*Version\/(?<version>\d+(?:\.\d+)?)/i,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/];r<o.length;r++){var i=o[r],a=t.match(i);if(a&&a.groups)return{name:e[a.groups.name.toLowerCase()]||a.groups.name,version:a.groups.version}}return{name:"unknown",version:"unknown"}}function ve(t){for(var e=0,r=0;r<t.length;++r)e+=Math.abs(t[r]);return e}function $(t,e,r){for(var o=[],i=0;i<t[0].data.length;i++){for(var a=[],n=0;n<t.length;n++)a.push(t[n].data[i]);o.push(we(a))}var c=new Uint8ClampedArray(o);return new ImageData(c,e,r)}function we(t){if(t.length===0)return 0;for(var e={},r=0,o=t;r<o.length;r++)e[a=o[r]]=(e[a]||0)+1;var i=t[0];for(var a in e)e[a]>e[i]&&(i=parseInt(a,10));return i}function N(t,e){if(!t)throw new Error("Canvas context not supported");return t.font,t.font="72px ".concat(e),t.measureText("WwMmLli0Oo").width}function Ee(){var t,e=document.createElement("canvas"),r=(t=e.getContext("webgl"))!==null&&t!==void 0?t:e.getContext("experimental-webgl");if(r&&"getParameter"in r)try{var o=(r.getParameter(r.VENDOR)||"").toString(),i=(r.getParameter(r.RENDERER)||"").toString(),a={vendor:o,renderer:i,version:(r.getParameter(r.VERSION)||"").toString(),shadingLanguageVersion:(r.getParameter(r.SHADING_LANGUAGE_VERSION)||"").toString()};if(!i.length||!o.length){var n=r.getExtension("WEBGL_debug_renderer_info");if(n){var c=(r.getParameter(n.UNMASKED_VENDOR_WEBGL)||"").toString(),u=(r.getParameter(n.UNMASKED_RENDERER_WEBGL)||"").toString();c&&(a.vendorUnmasked=c),u&&(a.rendererUnmasked=u)}}return a}catch{}return"undefined"}function Ie(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=1/0,t[0]=t[0]-t[0],e[3]}function Pe(t,e){var r={};return e.forEach((function(o){var i=(function(a){if(a.length===0)return null;var n={};a.forEach((function(l){var s=String(l);n[s]=(n[s]||0)+1}));var c=a[0],u=1;return Object.keys(n).forEach((function(l){n[l]>u&&(c=l,u=n[l])})),c})(t.map((function(a){return o in a?a[o]:void 0})).filter((function(a){return a!==void 0})));i&&(r[o]=i)})),r}function Me(){var t=[],e={"prefers-contrast":["high","more","low","less","forced","no-preference"],"any-hover":["hover","none"],"any-pointer":["none","coarse","fine"],pointer:["none","coarse","fine"],hover:["hover","none"],update:["fast","slow"],"inverted-colors":["inverted","none"],"prefers-reduced-motion":["reduce","no-preference"],"prefers-reduced-transparency":["reduce","no-preference"],scripting:["none","initial-only","enabled"],"forced-colors":["active","none"]};return Object.keys(e).forEach((function(r){e[r].forEach((function(o){matchMedia("(".concat(r,": ").concat(o,")")).matches&&t.push("".concat(r,": ").concat(o))}))})),t}function Ae(){if(window.location.protocol==="https:"&&typeof window.ApplePaySession=="function")try{for(var t=window.ApplePaySession.supportsVersion,e=15;e>0;e--)if(t(e))return e}catch{return 0}return 0}var g,F,B,v,W,f,ye,z,O,be,_e,D,Se,xe,h,Ce,d,_,q=ae(()=>{"use strict";g={exclude:[],include:[],logging:!0,timeout:1e3};F={},B={timeout:"true"},v=function(t,e){typeof window<"u"&&(F[t]=e)},W=function(){return Object.fromEntries(Object.entries(F).filter((function(t){var e,r=t[0];return!(!((e=g?.exclude)===null||e===void 0)&&e.includes(r))})).filter((function(t){var e,r,o,i,a=t[0];return!((e=g?.include)===null||e===void 0)&&e.some((function(n){return n.includes(".")}))?(r=g?.include)===null||r===void 0?void 0:r.some((function(n){return n.startsWith(a)})):((o=g?.include)===null||o===void 0?void 0:o.length)===0||((i=g?.include)===null||i===void 0?void 0:i.includes(a))})).map((function(t){return[t[0],(0,t[1])()]})))};f=new Uint32Array([597399067,2869860233,951274213,2716044179]);ye=x();["SamsungBrowser","Safari"].includes(ye.name)||v("audio",(function(){return y(this,void 0,void 0,(function(){return w(this,(function(t){return[2,new Promise((function(e,r){try{var o=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,5e3,44100),i=o.createBufferSource(),a=o.createOscillator();a.frequency.value=1e3;var n,c=o.createDynamicsCompressor();c.threshold.value=-50,c.knee.value=40,c.ratio.value=12,c.attack.value=0,c.release.value=.2,a.connect(c),c.connect(o.destination),a.start(),o.oncomplete=function(u){n=u.renderedBuffer.getChannelData(0),e({sampleHash:ve(n),oscillator:a.type,maxChannels:o.destination.maxChannelCount,channelCountMode:i.channelCountMode})},o.startRendering()}catch(u){console.error("Error creating audio fingerprint:",u),r(u)}}))]}))}))}));z=x(),O=z.name.toLowerCase(),be=z.version.split(".")[0]||"0",_e=parseInt(be,10);O==="firefox"||O==="safari"&&_e===17||v("canvas",(function(){return document.createElement("canvas").getContext("2d"),new Promise((function(t){var e=Array.from({length:3},(function(){return(function(){var r=document.createElement("canvas"),o=r.getContext("2d");if(!o)return new ImageData(1,1);r.width=280,r.height=20;var i=o.createLinearGradient(0,0,r.width,r.height);i.addColorStop(0,"red"),i.addColorStop(.16666666666666666,"orange"),i.addColorStop(.3333333333333333,"yellow"),i.addColorStop(.5,"green"),i.addColorStop(.6666666666666666,"blue"),i.addColorStop(.8333333333333334,"indigo"),i.addColorStop(1,"violet"),o.fillStyle=i,o.fillRect(0,0,r.width,r.height);var a="Random Text WMwmil10Oo";return o.font="23.123px Arial",o.fillStyle="black",o.fillText(a,-5,15),o.fillStyle="rgba(0, 0, 255, 0.5)",o.fillText(a,-3.3,17.7),o.beginPath(),o.moveTo(0,0),o.lineTo(2*r.width/7,r.height),o.strokeStyle="white",o.lineWidth=2,o.stroke(),o.getImageData(0,0,r.width,r.height)})()}));t({commonImageDataHash:T($(e,280,20).data.toString()).toString()})}))}));Se=["Arial","Arial Black","Arial Narrow","Arial Rounded MT","Arimo","Archivo","Barlow","Bebas Neue","Bitter","Bookman","Calibri","Cabin","Candara","Century","Century Gothic","Comic Sans MS","Constantia","Courier","Courier New","Crimson Text","DM Mono","DM Sans","DM Serif Display","DM Serif Text","Dosis","Droid Sans","Exo","Fira Code","Fira Sans","Franklin Gothic Medium","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Impact","Inconsolata","Indie Flower","Inter","Josefin Sans","Karla","Lato","Lexend","Lucida Bright","Lucida Console","Lucida Sans Unicode","Manrope","Merriweather","Merriweather Sans","Montserrat","Myriad","Noto Sans","Nunito","Nunito Sans","Open Sans","Optima","Orbitron","Oswald","Pacifico","Palatino","Perpetua","PT Sans","PT Serif","Poppins","Prompt","Public Sans","Quicksand","Rajdhani","Recursive","Roboto","Roboto Condensed","Rockwell","Rubik","Segoe Print","Segoe Script","Segoe UI","Sora","Source Sans Pro","Space Mono","Tahoma","Taviraj","Times","Times New Roman","Titillium Web","Trebuchet MS","Ubuntu","Varela Round","Verdana","Work Sans"],xe=["monospace","sans-serif","serif"];x().name!="Firefox"&&v("fonts",(function(){var t=this;return new Promise((function(e,r){try{(function(o){var i;y(this,void 0,void 0,(function(){var a,n,c;return w(this,(function(u){switch(u.label){case 0:return document.body?[3,2]:[4,(l=50,new Promise((function(m){return setTimeout(m,l,s)})))];case 1:return u.sent(),[3,0];case 2:if((a=document.createElement("iframe")).setAttribute("frameBorder","0"),(n=a.style).setProperty("position","fixed"),n.setProperty("display","block","important"),n.setProperty("visibility","visible"),n.setProperty("border","0"),n.setProperty("opacity","0"),a.src="about:blank",document.body.appendChild(a),!(c=a.contentDocument||((i=a.contentWindow)===null||i===void 0?void 0:i.document)))throw new Error("Iframe document is not accessible");return o({iframe:c}),setTimeout((function(){document.body.removeChild(a)}),0),[2]}var l,s}))}))})((function(o){var i=o.iframe;return y(t,void 0,void 0,(function(){var a,n,c,u;return w(this,(function(l){return a=i.createElement("canvas"),n=a.getContext("2d"),c=xe.map((function(s){return N(n,s)})),u={},Se.forEach((function(s){var m=N(n,s);c.includes(m)||(u[s]=m)})),e(u),[2]}))}))}))}catch{r({error:"unsupported"})}}))})),v("hardware",(function(){return new Promise((function(t,e){var r=navigator.deviceMemory!==void 0?navigator.deviceMemory:0,o=window.performance&&window.performance.memory?window.performance.memory:0;t({videocard:Ee(),architecture:Ie(),deviceMemory:r.toString()||"undefined",jsHeapSizeLimit:o.jsHeapSizeLimit||0})}))})),v("locales",(function(){return new Promise((function(t){t({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}))})),v("permissions",(function(){return y(this,void 0,void 0,(function(){var t;return w(this,(function(e){return D=g?.permissions_to_check||["accelerometer","accessibility","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","device-info","display-capture","gyroscope","geolocation","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","speaker","storage-access","top-level-storage-access","window-management","query"],t=Array.from({length:g?.retries||3},(function(){return(function(){return y(this,void 0,void 0,(function(){var r,o,i,a,n;return w(this,(function(c){switch(c.label){case 0:r={},o=0,i=D,c.label=1;case 1:if(!(o<i.length))return[3,6];a=i[o],c.label=2;case 2:return c.trys.push([2,4,,5]),[4,navigator.permissions.query({name:a})];case 3:return n=c.sent(),r[a]=n.state.toString(),[3,5];case 4:return c.sent(),[3,5];case 5:return o++,[3,1];case 6:return[2,r]}}))}))})()})),[2,Promise.all(t).then((function(r){return Pe(r,D)}))]}))}))})),v("plugins",(function(){var t=[];if(navigator.plugins)for(var e=0;e<navigator.plugins.length;e++){var r=navigator.plugins[e];t.push([r.name,r.filename,r.description].join("|"))}return new Promise((function(o){o({plugins:t})}))})),v("screen",(function(){return new Promise((function(t){t({is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:Me()})}))})),v("system",(function(){return new Promise((function(t){var e=x();t({platform:window.navigator.platform,cookieEnabled:window.navigator.cookieEnabled,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:e.name,version:e.version},applePayVersion:Ae()})}))}));Ce=x().name!=="SamsungBrowser"?1:3,d=null;v("webgl",(function(){return y(this,void 0,void 0,(function(){var t;return w(this,(function(e){typeof document<"u"&&((h=document.createElement("canvas")).width=200,h.height=100,d=h.getContext("webgl"));try{if(!d)throw new Error("WebGL not supported");return t=Array.from({length:Ce},(function(){return(function(){try{if(!d)throw new Error("WebGL not supported");var r=`
1
+ "use strict";var QuickCheck=(()=>{var R=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var ae=(t,e)=>()=>(t&&(e=t(t=0)),e);var G=(t,e)=>{for(var n in e)R(t,n,{get:e[n],enumerable:!0})},se=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oe(e))!ie.call(t,i)&&i!==n&&R(t,i,{get:()=>e[i],enumerable:!(o=re(e,i))||o.enumerable});return t};var le=t=>se(R({},"__esModule",{value:!0}),t);var V={};G(V,{getFingerprint:()=>pe,getFingerprintData:()=>j,getFingerprintPerformance:()=>ve,getVersion:()=>he,includeComponent:()=>v,setOption:()=>ge});function y(t,e,n,o){return new(n||(n=Promise))((function(i,a){function r(l){try{u(o.next(l))}catch(s){a(s)}}function c(l){try{u(o.throw(l))}catch(s){a(s)}}function u(l){var s;l.done?i(l.value):(s=l.value,s instanceof n?s:new n((function(m){m(s)}))).then(r,c)}u((o=o.apply(t,e||[])).next())}))}function w(t,e){var n,o,i,a,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(l){return(function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!((i=i.length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(m){s=[6,m],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}})([u,l])}}}function ge(t,e){if(!["include","exclude","permissions_to_check","retries","timeout","logging"].includes(t))throw new Error("Unknown option "+t);if(["include","exclude","permissions_to_check"].includes(t)&&(!Array.isArray(e)||!e.every((function(n){return typeof n=="string"}))))throw new Error("The value of the include, exclude and permissions_to_check must be an array of strings");if(["retries","timeout"].includes(t)&&typeof e!="number")throw new Error("The value of retries must be a number");g[t]=e}function C(t){return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),(t^=t>>>16)>>>0}function p(t,e){return t<<e|t>>>32-e}function T(t,e){var n;if(e===void 0&&(e=0),e=e?0|e:0,typeof t=="string"&&(n=t,t=new TextEncoder().encode(n).buffer),!(t instanceof ArrayBuffer))throw new TypeError("Expected key to be ArrayBuffer or string");var o=new Uint32Array([e,e,e,e]);(function(a,r){for(var c=a.byteLength/16|0,u=new Uint32Array(a,0,4*c),l=0;l<c;l++){var s=u.subarray(4*l,4*(l+1));s[0]=Math.imul(s[0],f[0]),s[0]=p(s[0],15),s[0]=Math.imul(s[0],f[1]),r[0]=r[0]^s[0],r[0]=p(r[0],19),r[0]=r[0]+r[1],r[0]=Math.imul(r[0],5)+1444728091,s[1]=Math.imul(s[1],f[1]),s[1]=p(s[1],16),s[1]=Math.imul(s[1],f[2]),r[1]=r[1]^s[1],r[1]=p(r[1],17),r[1]=r[1]+r[2],r[1]=Math.imul(r[1],5)+197830471,s[2]=Math.imul(s[2],f[2]),s[2]=p(s[2],17),s[2]=Math.imul(s[2],f[3]),r[2]=r[2]^s[2],r[2]=p(r[2],15),r[2]=r[2]+r[3],r[2]=Math.imul(r[2],5)+2530024501,s[3]=Math.imul(s[3],f[3]),s[3]=p(s[3],18),s[3]=Math.imul(s[3],f[0]),r[3]=r[3]^s[3],r[3]=p(r[3],13),r[3]=r[3]+r[0],r[3]=Math.imul(r[3],5)+850148119}})(t,o),(function(a,r){var c=a.byteLength/16|0,u=a.byteLength%16,l=new Uint32Array(4),s=new Uint8Array(a,16*c,u);switch(u){case 15:l[3]=l[3]^s[14]<<16;case 14:l[3]=l[3]^s[13]<<8;case 13:l[3]=l[3]^s[12],l[3]=Math.imul(l[3],f[3]),l[3]=p(l[3],18),l[3]=Math.imul(l[3],f[0]),r[3]=r[3]^l[3];case 12:l[2]=l[2]^s[11]<<24;case 11:l[2]=l[2]^s[10]<<16;case 10:l[2]=l[2]^s[9]<<8;case 9:l[2]=l[2]^s[8],l[2]=Math.imul(l[2],f[2]),l[2]=p(l[2],17),l[2]=Math.imul(l[2],f[3]),r[2]=r[2]^l[2];case 8:l[1]=l[1]^s[7]<<24;case 7:l[1]=l[1]^s[6]<<16;case 6:l[1]=l[1]^s[5]<<8;case 5:l[1]=l[1]^s[4],l[1]=Math.imul(l[1],f[1]),l[1]=p(l[1],16),l[1]=Math.imul(l[1],f[2]),r[1]=r[1]^l[1];case 4:l[0]=l[0]^s[3]<<24;case 3:l[0]=l[0]^s[2]<<16;case 2:l[0]=l[0]^s[1]<<8;case 1:l[0]=l[0]^s[0],l[0]=Math.imul(l[0],f[0]),l[0]=p(l[0],15),l[0]=Math.imul(l[0],f[1]),r[0]=r[0]^l[0]}})(t,o),(function(a,r){r[0]=r[0]^a.byteLength,r[1]=r[1]^a.byteLength,r[2]=r[2]^a.byteLength,r[3]=r[3]^a.byteLength,r[0]=r[0]+r[1]|0,r[0]=r[0]+r[2]|0,r[0]=r[0]+r[3]|0,r[1]=r[1]+r[0]|0,r[2]=r[2]+r[0]|0,r[3]=r[3]+r[0]|0,r[0]=C(r[0]),r[1]=C(r[1]),r[2]=C(r[2]),r[3]=C(r[3]),r[0]=r[0]+r[1]|0,r[0]=r[0]+r[2]|0,r[0]=r[0]+r[3]|0,r[1]=r[1]+r[0]|0,r[2]=r[2]+r[0]|0,r[3]=r[3]+r[0]|0})(t,o);var i=new Uint8Array(o.buffer);return Array.from(i).map((function(a){return a.toString(16).padStart(2,"0")})).join("")}function H(t,e){return new Promise((function(n){setTimeout((function(){return n(e)}),t)}))}function fe(t,e,n){return Promise.all(t.map((function(o){var i=performance.now();return Promise.race([o.then((function(a){return{value:a,elapsed:performance.now()-i}})),H(e,n).then((function(a){return{value:a,elapsed:performance.now()-i}}))])})))}function me(t,e,n){return Promise.all(t.map((function(o){return Promise.race([o,H(e,n)])})))}function he(){return"0.20.5"}function j(){return y(this,void 0,void 0,(function(){var t,e,n,o,i;return w(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=W(),e=Object.keys(t),[4,me(Object.values(t),g?.timeout||1e3,B)];case 1:return n=a.sent(),o=n.filter((function(r){return r!==void 0})),i={},o.forEach((function(r,c){i[e[c]]=r})),[2,K(i,g.exclude||[],g.include||[],"")];case 2:throw a.sent();case 3:return[2]}}))}))}function K(t,e,n,o){o===void 0&&(o="");for(var i={},a=function(l,s){var m=o+l+".";if(typeof s!="object"||Array.isArray(s)){var k=e.some((function(P){return m.startsWith(P)})),I=n.some((function(P){return m.startsWith(P)}));k&&!I||(i[l]=s)}else{var S=K(s,e,n,m);Object.keys(S).length>0&&(i[l]=S)}},r=0,c=Object.entries(t);r<c.length;r++){var u=c[r];a(u[0],u[1])}return i}function pe(t){return y(this,void 0,void 0,(function(){var e,n;return w(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,j()];case 1:return e=o.sent(),n=T(JSON.stringify(e)),Math.random()<1e-5&&g.logging&&(function(i,a){y(this,void 0,void 0,(function(){var r,c;return w(this,(function(u){switch(u.label){case 0:if(r="https://logging.thumbmarkjs.com/v1/log",c={thumbmark:i,components:a,version:"0.20.5"},sessionStorage.getItem("_tmjs_l"))return[3,4];sessionStorage.setItem("_tmjs_l","1"),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})];case 2:case 3:return u.sent(),[3,4];case 4:return[2]}}))}))})(n,e),t?[2,{hash:n.toString(),data:e}]:[2,n.toString()];case 2:throw o.sent();case 3:return[2]}}))}))}function ve(){return y(this,void 0,void 0,(function(){var t,e,n,o;return w(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=W(),e=Object.keys(t),[4,fe(Object.values(t),g?.timeout||1e3,B)];case 1:return n=i.sent(),o={elapsed:{}},n.forEach((function(a,r){o[e[r]]=a.value,o.elapsed[e[r]]=a.elapsed})),[2,o];case 2:throw i.sent();case 3:return[2]}}))}))}function x(){if(typeof navigator>"u")return{name:"unknown",version:"unknown"};for(var t=navigator.userAgent,e={edg:"Edge",opr:"Opera",samsung:"SamsungBrowser"},n=0,o=[/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/,/(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/,/(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/,/(?<name>samsung).*Version\/(?<version>\d+(?:\.\d+)?)/i,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/];n<o.length;n++){var i=o[n],a=t.match(i);if(a&&a.groups)return{name:e[a.groups.name.toLowerCase()]||a.groups.name,version:a.groups.version}}return{name:"unknown",version:"unknown"}}function ye(t){for(var e=0,n=0;n<t.length;++n)e+=Math.abs(t[n]);return e}function $(t,e,n){for(var o=[],i=0;i<t[0].data.length;i++){for(var a=[],r=0;r<t.length;r++)a.push(t[r].data[i]);o.push(be(a))}var c=new Uint8ClampedArray(o);return new ImageData(c,e,n)}function be(t){if(t.length===0)return 0;for(var e={},n=0,o=t;n<o.length;n++)e[a=o[n]]=(e[a]||0)+1;var i=t[0];for(var a in e)e[a]>e[i]&&(i=parseInt(a,10));return i}function N(t,e){if(!t)throw new Error("Canvas context not supported");return t.font,t.font="72px ".concat(e),t.measureText("WwMmLli0Oo").width}function Ie(){var t,e=document.createElement("canvas"),n=(t=e.getContext("webgl"))!==null&&t!==void 0?t:e.getContext("experimental-webgl");if(n&&"getParameter"in n)try{var o=(n.getParameter(n.VENDOR)||"").toString(),i=(n.getParameter(n.RENDERER)||"").toString(),a={vendor:o,renderer:i,version:(n.getParameter(n.VERSION)||"").toString(),shadingLanguageVersion:(n.getParameter(n.SHADING_LANGUAGE_VERSION)||"").toString()};if(!i.length||!o.length){var r=n.getExtension("WEBGL_debug_renderer_info");if(r){var c=(n.getParameter(r.UNMASKED_VENDOR_WEBGL)||"").toString(),u=(n.getParameter(r.UNMASKED_RENDERER_WEBGL)||"").toString();c&&(a.vendorUnmasked=c),u&&(a.rendererUnmasked=u)}}return a}catch{}return"undefined"}function Pe(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=1/0,t[0]=t[0]-t[0],e[3]}function Me(t,e){var n={};return e.forEach((function(o){var i=(function(a){if(a.length===0)return null;var r={};a.forEach((function(l){var s=String(l);r[s]=(r[s]||0)+1}));var c=a[0],u=1;return Object.keys(r).forEach((function(l){r[l]>u&&(c=l,u=r[l])})),c})(t.map((function(a){return o in a?a[o]:void 0})).filter((function(a){return a!==void 0})));i&&(n[o]=i)})),n}function Ce(){var t=[],e={"prefers-contrast":["high","more","low","less","forced","no-preference"],"any-hover":["hover","none"],"any-pointer":["none","coarse","fine"],pointer:["none","coarse","fine"],hover:["hover","none"],update:["fast","slow"],"inverted-colors":["inverted","none"],"prefers-reduced-motion":["reduce","no-preference"],"prefers-reduced-transparency":["reduce","no-preference"],scripting:["none","initial-only","enabled"],"forced-colors":["active","none"]};return Object.keys(e).forEach((function(n){e[n].forEach((function(o){matchMedia("(".concat(n,": ").concat(o,")")).matches&&t.push("".concat(n,": ").concat(o))}))})),t}function Ae(){if(window.location.protocol==="https:"&&typeof window.ApplePaySession=="function")try{for(var t=window.ApplePaySession.supportsVersion,e=15;e>0;e--)if(t(e))return e}catch{return 0}return 0}var g,F,B,v,W,f,we,z,O,_e,Se,D,xe,Ee,h,ke,d,_,q=ae(()=>{"use strict";g={exclude:[],include:[],logging:!0,timeout:1e3};F={},B={timeout:"true"},v=function(t,e){typeof window<"u"&&(F[t]=e)},W=function(){return Object.fromEntries(Object.entries(F).filter((function(t){var e,n=t[0];return!(!((e=g?.exclude)===null||e===void 0)&&e.includes(n))})).filter((function(t){var e,n,o,i,a=t[0];return!((e=g?.include)===null||e===void 0)&&e.some((function(r){return r.includes(".")}))?(n=g?.include)===null||n===void 0?void 0:n.some((function(r){return r.startsWith(a)})):((o=g?.include)===null||o===void 0?void 0:o.length)===0||((i=g?.include)===null||i===void 0?void 0:i.includes(a))})).map((function(t){return[t[0],(0,t[1])()]})))};f=new Uint32Array([597399067,2869860233,951274213,2716044179]);we=x();["SamsungBrowser","Safari"].includes(we.name)||v("audio",(function(){return y(this,void 0,void 0,(function(){return w(this,(function(t){return[2,new Promise((function(e,n){try{var o=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,5e3,44100),i=o.createBufferSource(),a=o.createOscillator();a.frequency.value=1e3;var r,c=o.createDynamicsCompressor();c.threshold.value=-50,c.knee.value=40,c.ratio.value=12,c.attack.value=0,c.release.value=.2,a.connect(c),c.connect(o.destination),a.start(),o.oncomplete=function(u){r=u.renderedBuffer.getChannelData(0),e({sampleHash:ye(r),oscillator:a.type,maxChannels:o.destination.maxChannelCount,channelCountMode:i.channelCountMode})},o.startRendering()}catch(u){console.error("Error creating audio fingerprint:",u),n(u)}}))]}))}))}));z=x(),O=z.name.toLowerCase(),_e=z.version.split(".")[0]||"0",Se=parseInt(_e,10);O==="firefox"||O==="safari"&&Se===17||v("canvas",(function(){return document.createElement("canvas").getContext("2d"),new Promise((function(t){var e=Array.from({length:3},(function(){return(function(){var n=document.createElement("canvas"),o=n.getContext("2d");if(!o)return new ImageData(1,1);n.width=280,n.height=20;var i=o.createLinearGradient(0,0,n.width,n.height);i.addColorStop(0,"red"),i.addColorStop(.16666666666666666,"orange"),i.addColorStop(.3333333333333333,"yellow"),i.addColorStop(.5,"green"),i.addColorStop(.6666666666666666,"blue"),i.addColorStop(.8333333333333334,"indigo"),i.addColorStop(1,"violet"),o.fillStyle=i,o.fillRect(0,0,n.width,n.height);var a="Random Text WMwmil10Oo";return o.font="23.123px Arial",o.fillStyle="black",o.fillText(a,-5,15),o.fillStyle="rgba(0, 0, 255, 0.5)",o.fillText(a,-3.3,17.7),o.beginPath(),o.moveTo(0,0),o.lineTo(2*n.width/7,n.height),o.strokeStyle="white",o.lineWidth=2,o.stroke(),o.getImageData(0,0,n.width,n.height)})()}));t({commonImageDataHash:T($(e,280,20).data.toString()).toString()})}))}));xe=["Arial","Arial Black","Arial Narrow","Arial Rounded MT","Arimo","Archivo","Barlow","Bebas Neue","Bitter","Bookman","Calibri","Cabin","Candara","Century","Century Gothic","Comic Sans MS","Constantia","Courier","Courier New","Crimson Text","DM Mono","DM Sans","DM Serif Display","DM Serif Text","Dosis","Droid Sans","Exo","Fira Code","Fira Sans","Franklin Gothic Medium","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Impact","Inconsolata","Indie Flower","Inter","Josefin Sans","Karla","Lato","Lexend","Lucida Bright","Lucida Console","Lucida Sans Unicode","Manrope","Merriweather","Merriweather Sans","Montserrat","Myriad","Noto Sans","Nunito","Nunito Sans","Open Sans","Optima","Orbitron","Oswald","Pacifico","Palatino","Perpetua","PT Sans","PT Serif","Poppins","Prompt","Public Sans","Quicksand","Rajdhani","Recursive","Roboto","Roboto Condensed","Rockwell","Rubik","Segoe Print","Segoe Script","Segoe UI","Sora","Source Sans Pro","Space Mono","Tahoma","Taviraj","Times","Times New Roman","Titillium Web","Trebuchet MS","Ubuntu","Varela Round","Verdana","Work Sans"],Ee=["monospace","sans-serif","serif"];x().name!="Firefox"&&v("fonts",(function(){var t=this;return new Promise((function(e,n){try{(function(o){var i;y(this,void 0,void 0,(function(){var a,r,c;return w(this,(function(u){switch(u.label){case 0:return document.body?[3,2]:[4,(l=50,new Promise((function(m){return setTimeout(m,l,s)})))];case 1:return u.sent(),[3,0];case 2:if((a=document.createElement("iframe")).setAttribute("frameBorder","0"),(r=a.style).setProperty("position","fixed"),r.setProperty("display","block","important"),r.setProperty("visibility","visible"),r.setProperty("border","0"),r.setProperty("opacity","0"),a.src="about:blank",document.body.appendChild(a),!(c=a.contentDocument||((i=a.contentWindow)===null||i===void 0?void 0:i.document)))throw new Error("Iframe document is not accessible");return o({iframe:c}),setTimeout((function(){document.body.removeChild(a)}),0),[2]}var l,s}))}))})((function(o){var i=o.iframe;return y(t,void 0,void 0,(function(){var a,r,c,u;return w(this,(function(l){return a=i.createElement("canvas"),r=a.getContext("2d"),c=Ee.map((function(s){return N(r,s)})),u={},xe.forEach((function(s){var m=N(r,s);c.includes(m)||(u[s]=m)})),e(u),[2]}))}))}))}catch{n({error:"unsupported"})}}))})),v("hardware",(function(){return new Promise((function(t,e){var n=navigator.deviceMemory!==void 0?navigator.deviceMemory:0,o=window.performance&&window.performance.memory?window.performance.memory:0;t({videocard:Ie(),architecture:Pe(),deviceMemory:n.toString()||"undefined",jsHeapSizeLimit:o.jsHeapSizeLimit||0})}))})),v("locales",(function(){return new Promise((function(t){t({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}))})),v("permissions",(function(){return y(this,void 0,void 0,(function(){var t;return w(this,(function(e){return D=g?.permissions_to_check||["accelerometer","accessibility","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","device-info","display-capture","gyroscope","geolocation","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","speaker","storage-access","top-level-storage-access","window-management","query"],t=Array.from({length:g?.retries||3},(function(){return(function(){return y(this,void 0,void 0,(function(){var n,o,i,a,r;return w(this,(function(c){switch(c.label){case 0:n={},o=0,i=D,c.label=1;case 1:if(!(o<i.length))return[3,6];a=i[o],c.label=2;case 2:return c.trys.push([2,4,,5]),[4,navigator.permissions.query({name:a})];case 3:return r=c.sent(),n[a]=r.state.toString(),[3,5];case 4:return c.sent(),[3,5];case 5:return o++,[3,1];case 6:return[2,n]}}))}))})()})),[2,Promise.all(t).then((function(n){return Me(n,D)}))]}))}))})),v("plugins",(function(){var t=[];if(navigator.plugins)for(var e=0;e<navigator.plugins.length;e++){var n=navigator.plugins[e];t.push([n.name,n.filename,n.description].join("|"))}return new Promise((function(o){o({plugins:t})}))})),v("screen",(function(){return new Promise((function(t){t({is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:Ce()})}))})),v("system",(function(){return new Promise((function(t){var e=x();t({platform:window.navigator.platform,cookieEnabled:window.navigator.cookieEnabled,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:e.name,version:e.version},applePayVersion:Ae()})}))}));ke=x().name!=="SamsungBrowser"?1:3,d=null;v("webgl",(function(){return y(this,void 0,void 0,(function(){var t;return w(this,(function(e){typeof document<"u"&&((h=document.createElement("canvas")).width=200,h.height=100,d=h.getContext("webgl"));try{if(!d)throw new Error("WebGL not supported");return t=Array.from({length:ke},(function(){return(function(){try{if(!d)throw new Error("WebGL not supported");var n=`
2
2
  attribute vec2 position;
3
3
  void main() {
4
4
  gl_Position = vec4(position, 0.0, 1.0);
@@ -8,4 +8,4 @@
8
8
  void main() {
9
9
  gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
10
10
  }
11
- `,i=d.createShader(d.VERTEX_SHADER),a=d.createShader(d.FRAGMENT_SHADER);if(!i||!a)throw new Error("Failed to create shaders");if(d.shaderSource(i,r),d.shaderSource(a,o),d.compileShader(i),!d.getShaderParameter(i,d.COMPILE_STATUS))throw new Error("Vertex shader compilation failed: "+d.getShaderInfoLog(i));if(d.compileShader(a),!d.getShaderParameter(a,d.COMPILE_STATUS))throw new Error("Fragment shader compilation failed: "+d.getShaderInfoLog(a));var n=d.createProgram();if(!n)throw new Error("Failed to create shader program");if(d.attachShader(n,i),d.attachShader(n,a),d.linkProgram(n),!d.getProgramParameter(n,d.LINK_STATUS))throw new Error("Shader program linking failed: "+d.getProgramInfoLog(n));d.useProgram(n);for(var c=137,u=new Float32Array(4*c),l=2*Math.PI/c,s=0;s<c;s++){var m=s*l;u[4*s]=0,u[4*s+1]=0,u[4*s+2]=Math.cos(m)*(h.width/2),u[4*s+3]=Math.sin(m)*(h.height/2)}var k=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,k),d.bufferData(d.ARRAY_BUFFER,u,d.STATIC_DRAW);var I=d.getAttribLocation(n,"position");d.enableVertexAttribArray(I),d.vertexAttribPointer(I,2,d.FLOAT,!1,0,0),d.viewport(0,0,h.width,h.height),d.clearColor(0,0,0,1),d.clear(d.COLOR_BUFFER_BIT),d.drawArrays(d.LINES,0,2*c);var S=new Uint8ClampedArray(h.width*h.height*4);return d.readPixels(0,0,h.width,h.height,d.RGBA,d.UNSIGNED_BYTE,S),new ImageData(S,h.width,h.height)}catch{return new ImageData(1,1)}finally{d&&(d.bindBuffer(d.ARRAY_BUFFER,null),d.useProgram(null),d.viewport(0,0,d.drawingBufferWidth,d.drawingBufferHeight),d.clearColor(0,0,0,0))}})()})),[2,{commonImageHash:T($(t,h.width,h.height).data.toString()).toString()}]}catch{return[2,{webgl:"unsupported"}]}return[2]}))}))}));_=function(t,e,r,o){for(var i=(r-e)/o,a=0,n=0;n<o;n++)a+=t(e+(n+.5)*i);return a*i};v("math",(function(){return y(void 0,void 0,void 0,(function(){return w(this,(function(t){return[2,{acos:Math.acos(.5),asin:_(Math.asin,-1,1,97),atan:_(Math.atan,-1,1,97),cos:_(Math.cos,0,Math.PI,97),cosh:Math.cosh(9/7),e:Math.E,largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),log:Math.log(1e3),pi:Math.PI,sin:_(Math.sin,-Math.PI,Math.PI,97),sinh:_(Math.sinh,-9/7,7/9,97),sqrt:Math.sqrt(2),tan:_(Math.tan,0,2*Math.PI,97),tanh:_(Math.tanh,-9/7,7/9,97)}]}))}))}))});var je={};G(je,{QuickCheckDeviceIntel:()=>E,default:()=>He});var b=class extends Error{constructor(r,o,i,a){super(r);this.code=o;this.status=i;this.details=a;this.name="QuickCheckError"}};var ce="https://api.quickcheck.com.pa",ue="/api/v1/sdk/device-intel/assess",M=class{constructor(e){if(!e.apiKey)throw new b("apiKey is required","MISSING_API_KEY");this.apiKey=e.apiKey,this.apiUrl=(e.apiUrl??ce).replace(/\/$/,""),this.timeout=e.timeout??5e3}async assess(e){let r=`${this.apiUrl}${ue}`,o=new AbortController,i=setTimeout(()=>o.abort(),this.timeout),a;try{a=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-QC-SDK-Key":this.apiKey,"X-QC-SDK-Platform":e.platform},body:JSON.stringify(e),signal:o.signal})}catch(c){throw clearTimeout(i),c.name==="AbortError"?new b(`Request timed out after ${this.timeout}ms`,"TIMEOUT"):new b(`Network error: ${c.message}`,"NETWORK_ERROR",void 0,c)}clearTimeout(i);let n;try{n=await a.json()}catch{throw new b(`Invalid JSON response (status ${a.status})`,"INVALID_RESPONSE",a.status)}if(!a.ok){let c=typeof n=="object"&&n!==null&&"detail"in n?String(n.detail):`HTTP ${a.status}`,u=a.status===401?"UNAUTHORIZED":a.status===403?"FORBIDDEN":a.status===429?"RATE_LIMITED":"HTTP_ERROR";throw new b(c,u,a.status,n)}return n}};function U(){let t=typeof navigator<"u"?navigator:{},e=typeof window<"u"?window.screen:null,r=e?`${e.width}x${e.height}`:null,o=null,i=null;try{o=new Date().getTimezoneOffset(),i=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}let a=(t.userAgent||"").toLowerCase(),n="desktop";/mobi|iphone|ipod|android/.test(a)?n="mobile":/ipad|tablet/.test(a)&&(n="tablet");let c="Unknown",u=null;if(/windows nt/.test(a)){c="Windows";let s=a.match(/windows nt ([\d.]+)/);u=s?s[1]:null}else if(/mac os x/.test(a)){c="macOS";let s=a.match(/mac os x ([\d_.]+)/);u=s?s[1].replace(/_/g,"."):null}else if(/android/.test(a)){c="Android";let s=a.match(/android ([\d.]+)/);u=s?s[1]:null}else if(/iphone|ipad|ipod/.test(a)){c="iOS";let s=a.match(/os ([\d_]+) like mac/);u=s?s[1].replace(/_/g,"."):null}else/linux/.test(a)&&(c="Linux");let l=t.deviceMemory??null;return{type:n,os_name:c,os_version:u,screen_resolution:r,language:t.language??null,languages:t.languages?Array.from(t.languages):[],timezone_offset:o,timezone_name:i,hardware_concurrency:t.hardwareConcurrency??null,device_memory_gb:l,touch_support:typeof window<"u"&&("ontouchstart"in window||(t.maxTouchPoints??0)>0)}}async function Y(){try{let e=await(await Promise.resolve().then(()=>(q(),V))).getFingerprint();return typeof e=="string"?e:e&&typeof e.thumbmark=="string"?e.thumbmark:Q()}catch{return Q()}}function Q(){let e=[typeof navigator<"u"?navigator.userAgent:"",typeof navigator<"u"?navigator.language:"",typeof screen<"u"?`${screen.width}x${screen.height}`:"",typeof screen<"u"?String(screen.colorDepth):"",String(new Date().getTimezoneOffset()),typeof navigator<"u"?String(navigator.hardwareConcurrency??""):""].join("|"),r=0;for(let o=0;o<e.length;o++)r=(r<<5)-r+e.charCodeAt(o),r|=0;return"qc_fb_"+Math.abs(r).toString(16).padStart(8,"0")}async function J(t=1e4){return typeof navigator>"u"||!navigator.geolocation?null:new Promise(e=>{let r=setTimeout(()=>e(null),t);navigator.geolocation.getCurrentPosition(o=>{clearTimeout(r),e({latitude:o.coords.latitude,longitude:o.coords.longitude,accuracy_m:Math.round(o.coords.accuracy),source:"gps"})},()=>{clearTimeout(r),e(null)},{enableHighAccuracy:!1,timeout:t,maximumAge:6e4})})}function Z(){let e=navigator.connection;return{connection_type:e?.type??null,effective_type:e?.effectiveType??null}}async function C(t=2e3){return typeof RTCPeerConnection>"u"?[]:new Promise(e=>{let r=new Set;try{let o=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});o.createDataChannel(""),o.onicecandidate=i=>{if(!i.candidate||!i.candidate.candidate)return;let a=i.candidate.candidate.match(/(\d{1,3}(\.\d{1,3}){3})|([a-f0-9:]+:+[a-f0-9]+)/);a&&a[0]&&r.add(a[0])},o.createOffer().then(i=>o.setLocalDescription(i)).catch(()=>{}),setTimeout(()=>{try{o.close()}catch{}e(Array.from(r))},t)}catch{e([])}})}async function X(){let t=ke(),e=Re(),r=await De(),o=await C(1500);return{is_incognito:r,webgl_renderer:t,canvas_hash:e,local_ips:o}}function ke(){try{let t=document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");if(!e)return null;let r=e.getExtension("WEBGL_debug_renderer_info");return r?e.getParameter(r.UNMASKED_RENDERER_WEBGL):null}catch{return null}}function Re(){try{let t=document.createElement("canvas");t.width=220,t.height=60;let e=t.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("QuickCheck Device Intelligence",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("QuickCheck Device Intelligence",4,17);let r=t.toDataURL(),o=0;for(let i=0;i<r.length;i++){let a=r.charCodeAt(i);o=(o<<5)-o+a,o|=0}return o.toString(16)}catch{return null}}async function De(){try{let t=navigator;if(t.storage?.estimate){let{quota:e}=await t.storage.estimate();if(typeof e=="number")return e<120*1024*1024}}catch{}return null}function Te(){try{return{acos04:Math.acos(.4),asin04:Math.asin(.4),atan04:Math.atan(.4),atanh04:Math.atanh(.4),cbrt100:Math.cbrt(100),cosh1:Math.cosh(1),expm11:Math.expm1(1),log1p10:Math.log1p(10),sinh1:Math.sinh(1),tanh1:Math.tanh(1),pow1_1e100:Math.pow(1.1,100)}}catch{return{}}}async function Le(){try{let t=document.createElement("canvas");t.width=200,t.height=40;let e=t.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="18px sans-serif",e.fillText("\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}\u{1F1F5}\u{1F1E6}\u{1F44D}\u{1F3FD}\u{1FAE1}",2,2);let r=t.toDataURL();return Be(r)}catch{return null}}function Ge(){try{if(!("speechSynthesis"in window))return{count:0,fingerprint:null};let t=window.speechSynthesis.getVoices();if(!t||t.length===0)return{count:0,fingerprint:null};let e=t.map(r=>`${r.name}|${r.lang}|${r.localService?"L":"R"}`).sort().join(",");return{count:t.length,fingerprint:L(e)}}catch{return{count:0,fingerprint:null}}}async function Ue(){let t={audioinput:0,audiooutput:0,videoinput:0};try{if(!navigator.mediaDevices?.enumerateDevices)return t;let e=await navigator.mediaDevices.enumerateDevices();for(let r of e)r.kind==="audioinput"?t.audioinput++:r.kind==="audiooutput"?t.audiooutput++:r.kind==="videoinput"&&t.videoinput++}catch{}return t}function Oe(){try{let t=new Intl.DateTimeFormat().resolvedOptions();return`${t.locale}|${t.calendar}|${t.numberingSystem}|${t.hourCycle??"-"}|${t.timeZone}`}catch{return null}}async function Ne(){try{let t=navigator.keyboard;if(!t?.getLayoutMap)return null;let e=await t.getLayoutMap(),r=[];for(let[o,i]of e.entries())r.push(`${o}=${i}`);return L(r.sort().join("|"))}catch{return null}}function Fe(){let t={vendor:null,renderer:null,extensions:[],shaderPrecision:null};try{let e=document.createElement("canvas"),r=e.getContext("webgl")||e.getContext("experimental-webgl");if(!r)return t;let o=r.getExtension("WEBGL_debug_renderer_info");o&&(t.vendor=r.getParameter(o.UNMASKED_VENDOR_WEBGL),t.renderer=r.getParameter(o.UNMASKED_RENDERER_WEBGL)),t.extensions=r.getSupportedExtensions()??[];let i=r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT),a=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);i&&a&&(t.shaderPrecision=`v:${i.rangeMin}/${i.rangeMax}/${i.precision};f:${a.rangeMin}/${a.rangeMax}/${a.precision}`)}catch{}return t}function L(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}async function Be(t){try{let e=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",e),o=new Uint8Array(r),i="";for(let a=0;a<16;a++)i+=o[a].toString(16).padStart(2,"0");return i}catch{return L(t)}}async function ee(){let[t,e,r]=await Promise.all([Le(),Ue(),Ne()]);return{math_constants:Te(),emoji_hash:t,speech_voices:Ge(),media_devices:e,intl_signature:Oe(),keyboard_layout_hash:r,webgl_advanced:Fe()}}var We="1.0.0",te="qcdi_session_uuid",ne="qcdi_previous_page",E=class{constructor(e){this.deviceSignals=null;this.privacySignals=null;this.advancedSignals=null;this.initialized=!1;this.sessionUuid="";this.geoWatchId=null;this.geoHistory=[];this.lastGeoLat=null;this.lastGeoLon=null;this.clientIpv4=null;this.clientIpv6=null;this.config={apiKey:e.apiKey,apiUrl:e.apiUrl??"https://api.quickcheck.com.pa",autoCollect:e.autoCollect??!0,requestGeolocation:e.requestGeolocation??!1,continuousGeolocation:e.continuousGeolocation??!1,timeout:e.timeout??5e3,onError:e.onError??(r=>console.error("[QCDI]",r)),debug:e.debug??!1},this.client=new M({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,timeout:this.config.timeout}),this.sessionUuid=this.resolveSessionUuid(),this.config.autoCollect&&this.initialize()}resolveSessionUuid(){try{let e=sessionStorage.getItem(te);if(e)return e;let r=this.generateUuid();return sessionStorage.setItem(te,r),r}catch{return this.generateUuid()}}generateUuid(){let e="0123456789abcdef",r="qcdis-";for(let o=0;o<32;o++)r+=e[Math.floor(Math.random()*16)],(o===7||o===11||o===15||o===19)&&(r+="-");return r}async initialize(){if(!this.initialized){this.config.debug&&console.log("[QCDI] Initializing...");try{let e=await Y(),r=U();this.deviceSignals={fingerprint_hash:e,visitor_id:null,...r},this.privacySignals=await X(),this.advancedSignals=await ee();let o=await C(1500);for(let i of o)i.includes(":")?this.clientIpv6||(this.clientIpv6=i):this.clientIpv4||(this.clientIpv4=i);this.initialized=!0,this.config.continuousGeolocation&&this.config.requestGeolocation&&this.startContinuousGeolocation(),this.config.debug&&console.log("[QCDI] Initialized",{fingerprint:e,session_uuid:this.sessionUuid,ipv4:this.clientIpv4,ipv6:this.clientIpv6})}catch(e){this.config.onError(e)}}}startContinuousGeolocation(){typeof navigator>"u"||!navigator.geolocation||this.geoWatchId===null&&(this.geoWatchId=navigator.geolocation.watchPosition(e=>{let{latitude:r,longitude:o,accuracy:i}=e.coords;this.lastGeoLat!==null&&this.lastGeoLon!==null&&this.haversineMeters(this.lastGeoLat,this.lastGeoLon,r,o)<50||(this.lastGeoLat=r,this.lastGeoLon=o,this.geoHistory.push({latitude:r,longitude:o,accuracy_m:Math.round(i),timestamp:new Date().toISOString()}),this.geoHistory.length>100&&(this.geoHistory=this.geoHistory.slice(-100)))},e=>{this.config.debug&&console.warn("[QCDI] Geo watch error:",e)},{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e4}))}haversineMeters(e,r,o,i){let n=s=>s*Math.PI/180,c=n(o-e),u=n(i-r),l=Math.sin(c/2)**2+Math.cos(n(e))*Math.cos(n(o))*Math.sin(u/2)**2;return 2*6371e3*Math.asin(Math.sqrt(l))}getPreviousPageUrl(){try{if(typeof document<"u"&&document.referrer)return document.referrer.slice(0,500)}catch{}return null}getFlowFromUrl(){try{let e=sessionStorage.getItem(ne);return typeof window<"u"&&sessionStorage.setItem(ne,window.location.href.slice(0,500)),e}catch{return null}}async assess(e){if(await this.initialize(),!this.deviceSignals)throw new Error("Device signals not collected. Call initialize() first.");let r=null;this.config.continuousGeolocation&&this.lastGeoLat!==null?r={latitude:this.lastGeoLat,longitude:this.lastGeoLon,accuracy_m:null,source:"gps"}:this.config.requestGeolocation&&(r=await J());let o={sdk_version:We,platform:"web",session_type:e.sessionType,device:this.deviceSignals,network:Z(),privacy:this.privacySignals,geolocation:r,advanced:this.advancedSignals,context:{external_user_id:e.externalUserId??null,external_session_id:e.externalSessionId??null,declared_country:e.declaredCountry??null,person_name:e.personName??null,person_document_id:e.personDocumentId??null,custom_fields:e.customFields??{},previous_page_url:this.getPreviousPageUrl(),flow_from_url:this.getFlowFromUrl(),session_uuid:this.sessionUuid,geolocation_history:this.geoHistory.slice(),client_ipv4:this.clientIpv4,client_ipv6:this.clientIpv6,app_session_id:e.appSessionId??null}};this.config.debug&&console.log("[QCDI] Assessing",o);try{let i=await this.client.assess(o);return this.config.debug&&console.log("[QCDI] Result",i),i}catch(i){throw this.config.onError(i),i}}async refresh(){this.initialized=!1,await this.initialize()}destroy(){this.geoWatchId!==null&&typeof navigator<"u"&&navigator.geolocation.clearWatch(this.geoWatchId),this.geoWatchId=null,this.geoHistory=[],this.deviceSignals=null,this.privacySignals=null,this.initialized=!1}};var He=E;return le(je);})();
11
+ `,i=d.createShader(d.VERTEX_SHADER),a=d.createShader(d.FRAGMENT_SHADER);if(!i||!a)throw new Error("Failed to create shaders");if(d.shaderSource(i,n),d.shaderSource(a,o),d.compileShader(i),!d.getShaderParameter(i,d.COMPILE_STATUS))throw new Error("Vertex shader compilation failed: "+d.getShaderInfoLog(i));if(d.compileShader(a),!d.getShaderParameter(a,d.COMPILE_STATUS))throw new Error("Fragment shader compilation failed: "+d.getShaderInfoLog(a));var r=d.createProgram();if(!r)throw new Error("Failed to create shader program");if(d.attachShader(r,i),d.attachShader(r,a),d.linkProgram(r),!d.getProgramParameter(r,d.LINK_STATUS))throw new Error("Shader program linking failed: "+d.getProgramInfoLog(r));d.useProgram(r);for(var c=137,u=new Float32Array(4*c),l=2*Math.PI/c,s=0;s<c;s++){var m=s*l;u[4*s]=0,u[4*s+1]=0,u[4*s+2]=Math.cos(m)*(h.width/2),u[4*s+3]=Math.sin(m)*(h.height/2)}var k=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,k),d.bufferData(d.ARRAY_BUFFER,u,d.STATIC_DRAW);var I=d.getAttribLocation(r,"position");d.enableVertexAttribArray(I),d.vertexAttribPointer(I,2,d.FLOAT,!1,0,0),d.viewport(0,0,h.width,h.height),d.clearColor(0,0,0,1),d.clear(d.COLOR_BUFFER_BIT),d.drawArrays(d.LINES,0,2*c);var S=new Uint8ClampedArray(h.width*h.height*4);return d.readPixels(0,0,h.width,h.height,d.RGBA,d.UNSIGNED_BYTE,S),new ImageData(S,h.width,h.height)}catch{return new ImageData(1,1)}finally{d&&(d.bindBuffer(d.ARRAY_BUFFER,null),d.useProgram(null),d.viewport(0,0,d.drawingBufferWidth,d.drawingBufferHeight),d.clearColor(0,0,0,0))}})()})),[2,{commonImageHash:T($(t,h.width,h.height).data.toString()).toString()}]}catch{return[2,{webgl:"unsupported"}]}return[2]}))}))}));_=function(t,e,n,o){for(var i=(n-e)/o,a=0,r=0;r<o;r++)a+=t(e+(r+.5)*i);return a*i};v("math",(function(){return y(void 0,void 0,void 0,(function(){return w(this,(function(t){return[2,{acos:Math.acos(.5),asin:_(Math.asin,-1,1,97),atan:_(Math.atan,-1,1,97),cos:_(Math.cos,0,Math.PI,97),cosh:Math.cosh(9/7),e:Math.E,largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),log:Math.log(1e3),pi:Math.PI,sin:_(Math.sin,-Math.PI,Math.PI,97),sinh:_(Math.sinh,-9/7,7/9,97),sqrt:Math.sqrt(2),tan:_(Math.tan,0,2*Math.PI,97),tanh:_(Math.tanh,-9/7,7/9,97)}]}))}))}))});var Ke={};G(Ke,{QuickCheckDeviceIntel:()=>E,default:()=>je});var b=class extends Error{constructor(n,o,i,a){super(n);this.code=o;this.status=i;this.details=a;this.name="QuickCheckError"}};var ce="https://api.quickcheck.com.pa",ue="/api/v1/sdk/device-intel/assess";function de(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let t=Math.random().toString(36).slice(2);return`${Date.now().toString(36)}-${t}`}var M=class{constructor(e){if(!e.apiKey)throw new b("apiKey is required","MISSING_API_KEY");this.apiKey=e.apiKey,this.apiUrl=(e.apiUrl??ce).replace(/\/$/,""),this.timeout=e.timeout??5e3}async assess(e){let n=`${this.apiUrl}${ue}`,o=new AbortController,i=setTimeout(()=>o.abort(),this.timeout),a=de(),r=new Date().toISOString(),c;try{c=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-QC-SDK-Key":this.apiKey,"X-QC-SDK-Platform":e.platform,"X-QC-Nonce":a,"X-QC-Timestamp":r},body:JSON.stringify(e),signal:o.signal})}catch(l){throw clearTimeout(i),l.name==="AbortError"?new b(`Request timed out after ${this.timeout}ms`,"TIMEOUT"):new b(`Network error: ${l.message}`,"NETWORK_ERROR",void 0,l)}clearTimeout(i);let u;try{u=await c.json()}catch{throw new b(`Invalid JSON response (status ${c.status})`,"INVALID_RESPONSE",c.status)}if(!c.ok){let l=typeof u=="object"&&u!==null&&"detail"in u?String(u.detail):`HTTP ${c.status}`,s=c.status===401?"UNAUTHORIZED":c.status===403?"FORBIDDEN":c.status===429?"RATE_LIMITED":"HTTP_ERROR";throw new b(l,s,c.status,u)}return u}};function U(){let t=typeof navigator<"u"?navigator:{},e=typeof window<"u"?window.screen:null,n=e?`${e.width}x${e.height}`:null,o=null,i=null;try{o=new Date().getTimezoneOffset(),i=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}let a=(t.userAgent||"").toLowerCase(),r="desktop";/mobi|iphone|ipod|android/.test(a)?r="mobile":/ipad|tablet/.test(a)&&(r="tablet");let c="Unknown",u=null;if(/windows nt/.test(a)){c="Windows";let s=a.match(/windows nt ([\d.]+)/);u=s?s[1]:null}else if(/mac os x/.test(a)){c="macOS";let s=a.match(/mac os x ([\d_.]+)/);u=s?s[1].replace(/_/g,"."):null}else if(/android/.test(a)){c="Android";let s=a.match(/android ([\d.]+)/);u=s?s[1]:null}else if(/iphone|ipad|ipod/.test(a)){c="iOS";let s=a.match(/os ([\d_]+) like mac/);u=s?s[1].replace(/_/g,"."):null}else/linux/.test(a)&&(c="Linux");let l=t.deviceMemory??null;return{type:r,os_name:c,os_version:u,screen_resolution:n,language:t.language??null,languages:t.languages?Array.from(t.languages):[],timezone_offset:o,timezone_name:i,hardware_concurrency:t.hardwareConcurrency??null,device_memory_gb:l,touch_support:typeof window<"u"&&("ontouchstart"in window||(t.maxTouchPoints??0)>0)}}async function Y(){try{let e=await(await Promise.resolve().then(()=>(q(),V))).getFingerprint();return typeof e=="string"?e:e&&typeof e.thumbmark=="string"?e.thumbmark:Q()}catch{return Q()}}function Q(){let e=[typeof navigator<"u"?navigator.userAgent:"",typeof navigator<"u"?navigator.language:"",typeof screen<"u"?`${screen.width}x${screen.height}`:"",typeof screen<"u"?String(screen.colorDepth):"",String(new Date().getTimezoneOffset()),typeof navigator<"u"?String(navigator.hardwareConcurrency??""):""].join("|"),n=0;for(let o=0;o<e.length;o++)n=(n<<5)-n+e.charCodeAt(o),n|=0;return"qc_fb_"+Math.abs(n).toString(16).padStart(8,"0")}async function X(t=1e4){return typeof navigator>"u"||!navigator.geolocation?null:new Promise(e=>{let n=setTimeout(()=>e(null),t);navigator.geolocation.getCurrentPosition(o=>{clearTimeout(n),e({latitude:o.coords.latitude,longitude:o.coords.longitude,accuracy_m:Math.round(o.coords.accuracy),source:"gps"})},()=>{clearTimeout(n),e(null)},{enableHighAccuracy:!1,timeout:t,maximumAge:6e4})})}function J(){let e=navigator.connection;return{connection_type:e?.type??null,effective_type:e?.effectiveType??null}}async function A(t=2e3){return typeof RTCPeerConnection>"u"?[]:new Promise(e=>{let n=new Set;try{let o=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});o.createDataChannel(""),o.onicecandidate=i=>{if(!i.candidate||!i.candidate.candidate)return;let a=i.candidate.candidate.match(/(\d{1,3}(\.\d{1,3}){3})|([a-f0-9:]+:+[a-f0-9]+)/);a&&a[0]&&n.add(a[0])},o.createOffer().then(i=>o.setLocalDescription(i)).catch(()=>{}),setTimeout(()=>{try{o.close()}catch{}e(Array.from(n))},t)}catch{e([])}})}async function Z(){let t=Re(),e=De(),n=await Te(),o=await A(1500);return{is_incognito:n,webgl_renderer:t,canvas_hash:e,local_ips:o}}function Re(){try{let t=document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");if(!e)return null;let n=e.getExtension("WEBGL_debug_renderer_info");return n?e.getParameter(n.UNMASKED_RENDERER_WEBGL):null}catch{return null}}function De(){try{let t=document.createElement("canvas");t.width=220,t.height=60;let e=t.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("QuickCheck Device Intelligence",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("QuickCheck Device Intelligence",4,17);let n=t.toDataURL(),o=0;for(let i=0;i<n.length;i++){let a=n.charCodeAt(i);o=(o<<5)-o+a,o|=0}return o.toString(16)}catch{return null}}async function Te(){try{let t=navigator;if(t.storage?.estimate){let{quota:e}=await t.storage.estimate();if(typeof e=="number")return e<120*1024*1024}}catch{}return null}function Le(){try{return{acos04:Math.acos(.4),asin04:Math.asin(.4),atan04:Math.atan(.4),atanh04:Math.atanh(.4),cbrt100:Math.cbrt(100),cosh1:Math.cosh(1),expm11:Math.expm1(1),log1p10:Math.log1p(10),sinh1:Math.sinh(1),tanh1:Math.tanh(1),pow1_1e100:Math.pow(1.1,100)}}catch{return{}}}async function Ge(){try{let t=document.createElement("canvas");t.width=200,t.height=40;let e=t.getContext("2d");if(!e)return null;e.textBaseline="top",e.font="18px sans-serif",e.fillText("\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}\u{1F1F5}\u{1F1E6}\u{1F44D}\u{1F3FD}\u{1FAE1}",2,2);let n=t.toDataURL();return We(n)}catch{return null}}function Ue(){try{if(!("speechSynthesis"in window))return{count:0,fingerprint:null};let t=window.speechSynthesis.getVoices();if(!t||t.length===0)return{count:0,fingerprint:null};let e=t.map(n=>`${n.name}|${n.lang}|${n.localService?"L":"R"}`).sort().join(",");return{count:t.length,fingerprint:L(e)}}catch{return{count:0,fingerprint:null}}}async function Oe(){let t={audioinput:0,audiooutput:0,videoinput:0};try{if(!navigator.mediaDevices?.enumerateDevices)return t;let e=await navigator.mediaDevices.enumerateDevices();for(let n of e)n.kind==="audioinput"?t.audioinput++:n.kind==="audiooutput"?t.audiooutput++:n.kind==="videoinput"&&t.videoinput++}catch{}return t}function Ne(){try{let t=new Intl.DateTimeFormat().resolvedOptions();return`${t.locale}|${t.calendar}|${t.numberingSystem}|${t.hourCycle??"-"}|${t.timeZone}`}catch{return null}}async function Fe(){try{let t=navigator.keyboard;if(!t?.getLayoutMap)return null;let e=await t.getLayoutMap(),n=[];for(let[o,i]of e.entries())n.push(`${o}=${i}`);return L(n.sort().join("|"))}catch{return null}}function Be(){let t={vendor:null,renderer:null,extensions:[],shaderPrecision:null};try{let e=document.createElement("canvas"),n=e.getContext("webgl")||e.getContext("experimental-webgl");if(!n)return t;let o=n.getExtension("WEBGL_debug_renderer_info");o&&(t.vendor=n.getParameter(o.UNMASKED_VENDOR_WEBGL),t.renderer=n.getParameter(o.UNMASKED_RENDERER_WEBGL)),t.extensions=n.getSupportedExtensions()??[];let i=n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT),a=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT);i&&a&&(t.shaderPrecision=`v:${i.rangeMin}/${i.rangeMax}/${i.precision};f:${a.rangeMin}/${a.rangeMax}/${a.precision}`)}catch{}return t}function L(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}async function We(t){try{let e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e),o=new Uint8Array(n),i="";for(let a=0;a<16;a++)i+=o[a].toString(16).padStart(2,"0");return i}catch{return L(t)}}async function ee(){let[t,e,n]=await Promise.all([Ge(),Oe(),Fe()]);return{math_constants:Le(),emoji_hash:t,speech_voices:Ue(),media_devices:e,intl_signature:Ne(),keyboard_layout_hash:n,webgl_advanced:Be()}}var He="1.0.0",te="qcdi_session_uuid",ne="qcdi_previous_page",E=class{constructor(e){this.deviceSignals=null;this.privacySignals=null;this.advancedSignals=null;this.initialized=!1;this.sessionUuid="";this.geoWatchId=null;this.geoHistory=[];this.lastGeoLat=null;this.lastGeoLon=null;this.clientIpv4=null;this.clientIpv6=null;this.config={apiKey:e.apiKey,apiUrl:e.apiUrl??"https://api.quickcheck.com.pa",autoCollect:e.autoCollect??!0,requestGeolocation:e.requestGeolocation??!1,continuousGeolocation:e.continuousGeolocation??!1,timeout:e.timeout??5e3,onError:e.onError??(n=>console.error("[QCDI]",n)),debug:e.debug??!1},this.client=new M({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,timeout:this.config.timeout}),this.sessionUuid=this.resolveSessionUuid(),this.config.autoCollect&&this.initialize()}resolveSessionUuid(){try{let e=sessionStorage.getItem(te);if(e)return e;let n=this.generateUuid();return sessionStorage.setItem(te,n),n}catch{return this.generateUuid()}}generateUuid(){let e="0123456789abcdef",n="qcdis-";for(let o=0;o<32;o++)n+=e[Math.floor(Math.random()*16)],(o===7||o===11||o===15||o===19)&&(n+="-");return n}async initialize(){if(!this.initialized){this.config.debug&&console.log("[QCDI] Initializing...");try{let e=await Y(),n=U();this.deviceSignals={fingerprint_hash:e,visitor_id:null,...n},this.privacySignals=await Z(),this.advancedSignals=await ee();let o=await A(1500);for(let i of o)i.includes(":")?this.clientIpv6||(this.clientIpv6=i):this.clientIpv4||(this.clientIpv4=i);this.initialized=!0,this.config.continuousGeolocation&&this.config.requestGeolocation&&this.startContinuousGeolocation(),this.config.debug&&console.log("[QCDI] Initialized",{fingerprint:e,session_uuid:this.sessionUuid,ipv4:this.clientIpv4,ipv6:this.clientIpv6})}catch(e){this.config.onError(e)}}}startContinuousGeolocation(){typeof navigator>"u"||!navigator.geolocation||this.geoWatchId===null&&(this.geoWatchId=navigator.geolocation.watchPosition(e=>{let{latitude:n,longitude:o,accuracy:i}=e.coords;this.lastGeoLat!==null&&this.lastGeoLon!==null&&this.haversineMeters(this.lastGeoLat,this.lastGeoLon,n,o)<50||(this.lastGeoLat=n,this.lastGeoLon=o,this.geoHistory.push({latitude:n,longitude:o,accuracy_m:Math.round(i),timestamp:new Date().toISOString()}),this.geoHistory.length>100&&(this.geoHistory=this.geoHistory.slice(-100)))},e=>{this.config.debug&&console.warn("[QCDI] Geo watch error:",e)},{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e4}))}haversineMeters(e,n,o,i){let r=s=>s*Math.PI/180,c=r(o-e),u=r(i-n),l=Math.sin(c/2)**2+Math.cos(r(e))*Math.cos(r(o))*Math.sin(u/2)**2;return 2*6371e3*Math.asin(Math.sqrt(l))}getPreviousPageUrl(){try{if(typeof document<"u"&&document.referrer)return document.referrer.slice(0,500)}catch{}return null}getFlowFromUrl(){try{let e=sessionStorage.getItem(ne);return typeof window<"u"&&sessionStorage.setItem(ne,window.location.href.slice(0,500)),e}catch{return null}}async assess(e){if(await this.initialize(),!this.deviceSignals)throw new Error("Device signals not collected. Call initialize() first.");let n=null;this.config.continuousGeolocation&&this.lastGeoLat!==null?n={latitude:this.lastGeoLat,longitude:this.lastGeoLon,accuracy_m:null,source:"gps"}:this.config.requestGeolocation&&(n=await X());let o={sdk_version:He,platform:"web",session_type:e.sessionType,device:this.deviceSignals,network:J(),privacy:this.privacySignals,geolocation:n,advanced:this.advancedSignals,context:{external_user_id:e.externalUserId??null,external_session_id:e.externalSessionId??null,declared_country:e.declaredCountry??null,person_name:e.personName??null,person_document_id:e.personDocumentId??null,custom_fields:e.customFields??{},previous_page_url:this.getPreviousPageUrl(),flow_from_url:this.getFlowFromUrl(),session_uuid:this.sessionUuid,geolocation_history:this.geoHistory.slice(),client_ipv4:this.clientIpv4,client_ipv6:this.clientIpv6,app_session_id:e.appSessionId??null}};this.config.debug&&console.log("[QCDI] Assessing",o);try{let i=await this.client.assess(o);return this.config.debug&&console.log("[QCDI] Result",i),i}catch(i){throw this.config.onError(i),i}}async refresh(){this.initialized=!1,await this.initialize()}destroy(){this.geoWatchId!==null&&typeof navigator<"u"&&navigator.geolocation.clearWatch(this.geoWatchId),this.geoWatchId=null,this.geoHistory=[],this.deviceSignals=null,this.privacySignals=null,this.initialized=!1}};var je=E;return le(Ke);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quickcheck/device-intel-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "QuickCheck Device Intelligence SDK — Device fingerprinting, IP intelligence, and real-time risk scoring for AML/KYC compliance (Article 14).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "QuickCheck",