@fingerly/web-js 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/browser.global.js +1 -1
- package/dist/index.cjs +70 -2
- package/dist/index.d.cts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +71 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ recognise returning visitors and spot automation, tampering and abuse.
|
|
|
8
8
|
npm install @fingerly/web-js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
**Not for apps.** Do not embed this SDK in an app's web view (iOS or macOS
|
|
12
|
+
`WKWebView`, Android `WebView`, Capacitor, Cordova, Ionic, React Native WebView,
|
|
13
|
+
Flutter, Electron). Inside an app it collects nothing and the server matches
|
|
14
|
+
nothing; use the Fingerly iOS or Android SDK there. See
|
|
15
|
+
[docs/privacy.md §3.3](../../../docs/privacy.md).
|
|
16
|
+
|
|
11
17
|
Using a framework? The bindings wrap this package:
|
|
12
18
|
[`@fingerly/react`](https://www.npmjs.com/package/@fingerly/react),
|
|
13
19
|
[`@fingerly/vue`](https://www.npmjs.com/package/@fingerly/vue),
|
|
@@ -26,7 +32,7 @@ import { load } from '@fingerly/web-js'
|
|
|
26
32
|
const fingerly = await load({ apiKey: 'fly_pk_production_…' })
|
|
27
33
|
|
|
28
34
|
// Later, from your consent tool, or pass consent: 'granted' to load() if you
|
|
29
|
-
// already have consent or
|
|
35
|
+
// already have consent or know none is required here (docs/privacy.md §4).
|
|
30
36
|
fingerly.setConsent('granted')
|
|
31
37
|
|
|
32
38
|
// When the visitor does something worth protecting: sign-up, login, checkout.
|
package/dist/browser.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Fingerly=(()=>{var G=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var bt=Object.prototype.hasOwnProperty;var _t=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},Et=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of wt(t))!bt.call(e,o)&&o!==n&&G(e,o,{get:()=>t[o],enumerable:!(r=vt(t,o))||r.enumerable});return e};var xt=e=>Et(G({},"__esModule",{value:!0}),e);var In={};_t(In,{ConsentError:()=>N,FingerlyClient:()=>P,SOURCE:()=>d,TransportError:()=>h,browserSources:()=>B,inspectIntegrity:()=>I,load:()=>St});var le=e=>{throw TypeError(e)},fe=(e,t,n)=>t.has(e)||le("Cannot "+n),x=(e,t,n)=>(fe(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?le("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),pe=(e,t,n,r)=>(fe(e,t,"write to private field"),t.set(e,n),n),Tt=["granted","pending","denied"];function J(e){if(!Tt.includes(e))throw new TypeError(`Fingerly consent must be 'granted', 'pending' or 'denied' (received ${JSON.stringify(e)})`)}var N=class extends Error{constructor(e){super(`Fingerly needs consent before it can identify this visitor (consent is ${e})`),this.state=e,this.name="ConsentError",this.code="consent_required"}},l=class extends Error{constructor(e){super(e??"unsupported"),this.reason=e,this.name="UnsupportedSignal"}},w=class extends Error{constructor(e){super(e??"blocked"),this.reason=e,this.name="BlockedSignal"}},R=class extends Error{constructor(e){super(e??"timeout"),this.reason=e,this.name="TimedOutSignal"}};function Mt(e){if(e instanceof l||e instanceof w||e instanceof R)return e.reason;if(e instanceof Error&&typeof e.name=="string"&&e.name!=="Error")return e.name}var T=typeof globalThis.performance?.now=="function"?()=>globalThis.performance.now():()=>Date.now(),H={budgetMs:1200,defaultSourceTimeoutMs:300,concurrency:6};function U(e){return Math.max(0,Math.round(e))}function kt(e){return e instanceof l?"unsupported":e instanceof w?"blocked":e instanceof R?"timeout":"error"}async function At(e,t,n,r,o){let i=T(),a=t-i;if(a<=0)return{status:"timeout",ms:0,reason:"budget-exhausted"};let c=Math.min(e.timeoutMs??n,a),u=new AbortController,m=()=>u.abort(new R("aborted"));r?.addEventListener("abort",m,{once:!0});let p=setTimeout(()=>u.abort(new R("source-timeout")),c),b={signal:u.signal,budgetRemainingMs:()=>Math.max(0,t-T()),completed:y=>o[y]};try{let y=await Promise.race([(async()=>e.run(b))(),new Promise((_,E)=>{u.signal.addEventListener("abort",()=>E(u.signal.reason??new R("source-timeout")),{once:!0})})]);return{status:"ok",ms:U(T()-i),value:y}}catch(y){let _=kt(y),E=Mt(y);return E===void 0?{status:_,ms:U(T()-i)}:{status:_,ms:U(T()-i),reason:E}}finally{clearTimeout(p),r?.removeEventListener("abort",m)}}async function Ct(e,t={}){let n=t.budgetMs??H.budgetMs,r=t.defaultSourceTimeoutMs??H.defaultSourceTimeoutMs,o=Math.max(1,t.concurrency??H.concurrency),i=t.tiers??["fast","deferred"],a=T(),c=a+n,u={},m={...t.completed??{}},p=!1;for(let b of i){let y=e.filter(M=>M.tier===b);if(y.length===0)continue;let _=0,E=async()=>{for(;_<y.length;){let M=y[_++];if(!M)continue;if(T()>=c||t.signal?.aborted){p=!0,u[M.id]={status:"timeout",ms:0,reason:"budget-exhausted"};continue}let V=await At(M,c,r,t.signal,m);V.status==="timeout"&&(p=!0),u[M.id]=V,m[M.id]=V}};await Promise.all(Array.from({length:Math.min(o,y.length)},E))}return{outcomes:u,elapsedMs:U(T()-a),truncated:p}}function Dt(e="v1"){if(!/^v[1-9]\d*$/.test(e)||e.trim()!==e)throw new TypeError('apiVersion must be a version such as "v1" or "v2"');return e}var Rt="https://api.fingerly.io",Y="x-api-key",ge="[redacted]",he=Symbol.for("nodejs.util.inspect.custom"),Ot="Idempotency-Key",h=class extends Error{constructor(e,t,n=!1,r,o){super(e),this.status=t,this.retryable=n,this.code=r,this.retryAfterMs=o,this.name="TransportError"}},Z=4*1024*1024,Nt=2e3;function Pt(e){let t=e.headers.get("retry-after")?.trim();if(!t)return;if(/^\d+$/.test(t))return Number(t)*1e3;let n=Date.parse(t);return Number.isFinite(n)?Math.max(0,n-Date.now()):void 0}async function ee(e){try{let n=(await e.json())?.error?.code;return typeof n=="string"&&n!==""?n:void 0}catch{return}}function te(e,t){return new h(`The server refused the submission (${e.status})`,e.status,Bt(e.status),t,Pt(e))}async function It(e){let t=()=>new h("The server answered with a response this SDK cannot read",e.status,!1);if(Number(e.headers.get("content-length"))>Z)throw e.body?.cancel().catch(()=>{}),t();let n=await e.text();if(n.length>Z)throw t();try{let r=JSON.parse(n);if(r===null||typeof r!="object")throw t();return r}catch{throw t()}}function Lt(e,t){let n=Wt(t,Math.random);return e.retryAfterMs===void 0?n:e.retryAfterMs>Nt?null:e.retryAfterMs+n}function Bt(e){return e===408||e===429||e>=500&&e<=599}function Ft(e){return e.status===404||e.status===405}function ye(e,t){return`${e}/api/${t}/ingest`}function $(e){return ye(Rt,e)}function Ut(e,t){let n=e.trim().replace(/\/+$/,"");if(n===""||n.includes("?")||n.includes("#"))throw new TypeError("A Fingerly endpoint must be a non-empty URL or path without a query or fragment");if(!(n.startsWith("/")||/^https?:\/\//i.test(n)))throw new TypeError("A Fingerly endpoint must be an absolute URL or a root-relative browser path");return/^https?:\/\/[^/]+$/i.test(n)?ye(n,t):n}function Wt(e,t){let n=Math.min(2e3,100*2**(e-1));return Math.floor(t()*n)}function ne(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},o=setTimeout(r,e);t?.addEventListener("abort",r,{once:!0})})}function qt(){let e=globalThis.crypto;if(typeof e?.randomUUID=="function")return e.randomUUID();if(typeof e?.getRandomValues=="function"){let t=e.getRandomValues(new Uint8Array(16));t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}return`fingerly-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`}var D,re=class{constructor(e){if(me(this,D),!e.apiKey)throw new h("An SDK key is required to submit a fingerprint");pe(this,D,e.apiKey);let t=Dt(e.apiVersion),n=e.endpoints,r=n===void 0?[$(t)]:Array.isArray(n)?[...n]:[n];if(r.length===0)throw new TypeError("The endpoints array must not be empty");let o=r.map(a=>Ut(a,t));n!==void 0&&e.fallbackToDefaultEndpoint&&(o.includes($(t))||o.push($(t))),this.urls=o,this.maxAttempts=Math.max(1,this.urls.length,e.maxAttempts??3),this.requestTimeoutMs=e.requestTimeoutMs??5e3;let i=e.fetchImpl??globalThis.fetch;if(typeof i!="function")throw new h("No fetch implementation is available; pass one as fetchImpl");this.fetchImpl=i.bind(globalThis)}toJSON(){return{apiKey:ge,urls:[...this.urls],maxAttempts:this.maxAttempts,requestTimeoutMs:this.requestTimeoutMs}}[he](){return this.toJSON()}async submit(e,t){let n,r=JSON.stringify(e),o=qt(),i=0;for(let a=1;a<=this.maxAttempts;a++){if(t?.aborted)throw new h("The submission was cancelled");try{return await this.attempt(this.urls[i],r,o,t)}catch(c){let u=c instanceof h?c:new h(c instanceof Error?c.message:"The submission could not be sent",void 0,!0),m=this.nextAttempt(u,a,i);if(m===null)throw u;n=u,i=Math.min(i+1,this.urls.length-1),await ne(m,t)}}throw n??new h("The submission could not be sent")}async submitSupplement(e,t,n){let r=JSON.stringify(t),o,i=0;for(let a=1;a<=this.maxAttempts;a++){if(n?.aborted)throw new h("The supplement was cancelled");try{await this.postJSON(this.urls[i],r,n);return}catch(c){let u=c instanceof h?c:new h(c instanceof Error?c.message:"The supplement could not be sent",void 0,!0),m=this.nextAttempt(u,a,i);if(m===null)throw u;o=u,i=Math.min(i+1,this.urls.length-1),await ne(m,n)}}throw o??new h("The supplement could not be sent")}nextAttempt(e,t,n){return t===this.maxAttempts?null:e.retryable?Lt(e,t):Ft(e)&&n<this.urls.length-1?0:null}async postJSON(e,t,n){let r=new AbortController,o=()=>r.abort();n?.addEventListener("abort",o,{once:!0});let i=setTimeout(o,this.requestTimeoutMs);try{let a=await this.fetchImpl(e,{method:"POST",headers:{"content-type":"application/json",[Y]:x(this,D)},body:t,credentials:"omit",signal:r.signal});if(!a.ok)throw te(a,await ee(a));return await a.arrayBuffer().catch(()=>{}),a}finally{clearTimeout(i),n?.removeEventListener("abort",o)}}async attempt(e,t,n,r){let o=new AbortController,i=()=>o.abort();r?.addEventListener("abort",i,{once:!0});let a=setTimeout(i,this.requestTimeoutMs);try{let c=await this.fetchImpl(e,{method:"POST",headers:{"content-type":"application/json",[Y]:x(this,D),[Ot]:n},body:t,credentials:"omit",signal:o.signal});if(!c.ok)throw te(c,await ee(c));let u=await It(c);if(typeof u?.request_id!="string"||u.request_id==="")throw new h("The server accepted the submission but returned no request_id");return u}finally{clearTimeout(a),r?.removeEventListener("abort",i)}}};D=new WeakMap;var oe="0.1.2",Vt=1;function ie(e){return e instanceof h&&e.code==="consent_required"?new N("pending"):e}var ae={patched_natives:[],lies:[],engine:{}},v,P=class{constructor(e){me(this,v),this.consentListeners=new Set;let t=e.consent??"pending";J(t),this.consentState=t,pe(this,v,e),this.platform=e.platform??"web",this.transport=e.transport??new re({...e.apiVersion===void 0?{}:{apiVersion:e.apiVersion},apiKey:e.apiKey,...e.endpoints===void 0?{}:{endpoints:e.endpoints},...e.fallbackToDefaultEndpoint===void 0?{}:{fallbackToDefaultEndpoint:e.fallbackToDefaultEndpoint}})}toJSON(){return{apiKey:ge,platform:this.platform,consent:this.consentState,transport:this.transport instanceof re?this.transport:"custom"}}[he](){return this.toJSON()}get consent(){return this.consentState}setConsent(e){if(J(e),e!==this.consentState){this.consentState=e;for(let t of[...this.consentListeners])try{t(e)}catch(n){setTimeout(()=>{throw n},0)}}}onConsentChange(e){return this.consentListeners.add(e),()=>{this.consentListeners.delete(e)}}requireConsent(){if(this.consentState!=="granted")throw new N(this.consentState)}consentScope(e){let t=new AbortController,n=()=>t.abort();e?.aborted?n():e?.addEventListener("abort",n,{once:!0});let r=this.onConsentChange(o=>{o!=="granted"&&n()});return{signal:t.signal,close:()=>{r(),e?.removeEventListener("abort",n)}}}async identify(e={}){this.requireConsent();let t=this.consentScope(e.signal);try{return await this.identifyWithConsent(e,t.signal)}finally{t.close()}}async identifyWithConsent(e,t){let n=e.submit!==!1&&e.tiers===void 0,r=await this.collectReport(n?["fast"]:e.tiers??["fast","deferred"],t,n?300:void 0);if(this.requireConsent(),e.submit===!1)return{requestId:"",visitorId:"",visitorIsNew:!1,visitorConfidence:0,identifiable:!1,duplicate:!1,state:"",suspectScore:null,suspectLevel:null,report:r,deferred:Promise.resolve({status:"skipped",reason:"not-submitted"})};let o={sdk:{platform:this.platform,version:oe},consent:this.consentState,signals:r,...e.tag===void 0?{}:{tag:e.tag}},i;try{i=await this.transport.submit(o,t)}catch(c){throw this.requireConsent(),ie(c)}let a={requestId:i.request_id,visitorId:i.visitor_id??"",visitorIsNew:i.visitor_is_new??!1,visitorConfidence:i.visitor_confidence??0,identifiable:i.identifiable??!1,duplicate:i.duplicate??!1,state:i.state??"",suspectScore:typeof i.suspect_score=="number"&&Number.isFinite(i.suspect_score)?i.suspect_score:null,suspectLevel:typeof i.suspect_level=="string"&&i.suspect_level!==""?i.suspect_level:null,report:r,deferred:Promise.resolve({status:"skipped",reason:"explicit-tiers"})};return n?i.duplicate||!i.deferred_token?(a.deferred=Promise.resolve({status:"skipped",reason:i.duplicate?"duplicate":"unsupported-transport"}),a):typeof this.transport.submitSupplement!="function"?(a.deferred=Promise.resolve({status:"skipped",reason:"unsupported-transport"}),a):(a.deferred=this.finishDeferred(r,i.request_id,i.deferred_token,e.signal),a):a}async finishDeferred(e,t,n,r){let o={status:"skipped",reason:"consent-withdrawn"};if(this.consentState!=="granted")return o;let i=this.consentScope(r),a,c;try{if(a=await this.collectReport(["deferred"],i.signal,1200,e.sources),this.consentState!=="granted")return o;c={schema:e.schema,budget_ms:e.budget_ms+a.budget_ms,elapsed_ms:e.elapsed_ms+a.elapsed_ms,tiers:["fast","deferred"],sources:{...e.sources,...a.sources},integrity:x(this,v).integrity?x(this,v).integrity({sources:{...e.sources,...a.sources}}):ae};let u={sdk:{platform:this.platform,version:oe},consent:this.consentState,signals:a,token:n};return await this.transport.submitSupplement(t,u,i.signal),{status:"submitted",report:a,combinedReport:c}}catch(u){if(this.consentState!=="granted")return o;let m=ie(u);return{status:"failed",error:m instanceof Error?m:new Error(String(m)),...a===void 0?{}:{report:a},...c===void 0?{}:{combinedReport:c}}}finally{i.close()}}async collect(e={}){this.requireConsent();let t=e.tiers??["fast","deferred"],n=this.consentScope(e.signal);try{let r=await this.collectReport(t,n.signal);return this.requireConsent(),r}finally{n.close()}}async collectReport(e,t,n,r){let o=x(this,v).sources??[],i={...x(this,v).schedule,tiers:e,...n===void 0?{}:{budgetMs:n},...t===void 0?{}:{signal:t},...r===void 0?{}:{completed:r}},a=await Ct(o,i),c=x(this,v).integrity?x(this,v).integrity({sources:a.outcomes}):ae;return{schema:Vt,budget_ms:i.budgetMs??1200,elapsed_ms:a.elapsedMs,tiers:e,sources:a.outcomes,integrity:c}}};v=new WeakMap;var O=2654435761,W=2246822519,se=3266489917,Gt=668265263,ce=374761393;function k(e,t){return e<<t|e>>>32-t}function F(e,t){return Math.imul(k(e+Math.imul(t,W)|0,13),O)}function C(e,t){return((e[t]??0)|(e[t+1]??0)<<8|(e[t+2]??0)<<16|(e[t+3]??0)<<24)>>>0}function Ht(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e);let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(r=(r-55296)*1024+(o-56320)+65536,n++)}r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r<65536?t.push(224|r>>12,128|r>>6&63,128|r&63):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return new Uint8Array(t)}function ue(e,t){let n=e.length,r=0,o;if(n>=16){let i=t+O+W|0,a=t+W|0,c=t|0,u=t-O|0,m=n-16;do i=F(i,C(e,r)),a=F(a,C(e,r+4)),c=F(c,C(e,r+8)),u=F(u,C(e,r+12)),r+=16;while(r<=m);o=k(i,1)+k(a,7)+k(c,12)+k(u,18)|0}else o=t+ce|0;for(o=o+n|0;r+4<=n;)o=Math.imul(k(o+Math.imul(C(e,r),se)|0,17),Gt),r+=4;for(;r<n;)o=Math.imul(k(o+Math.imul(e[r]??0,ce)|0,11),O),r++;return o^=o>>>15,o=Math.imul(o,W),o^=o>>>13,o=Math.imul(o,se),o^=o>>>16,o>>>0}function de(e){return e.toString(16).padStart(8,"0")}function A(e){let t=typeof e=="string"?Ht(e):e;return de(ue(t,0))+de(ue(t,O))}var d={navigator:"navigator",userAgentData:"user_agent_data",languages:"languages",plugins:"plugins",vendor:"vendor",engine:"engine",math:"math",errors:"errors",screen:"screen",screenFrame:"screen_frame",colorGamut:"color_gamut",mediaQueries:"media_queries",canvas:"canvas",webgl:"webgl",webglExtensions:"webgl_extensions",audio:"audio",audioLatency:"audio_latency",fonts:"fonts",fontPreferences:"font_preferences",intl:"intl",timezone:"timezone",storage:"storage",storageQuota:"storage_quota",storageDurability:"storage_durability",hardware:"hardware",touch:"touch",sensors:"sensors",battery:"battery",mediaDevices:"media_devices",network:"network",speech:"speech",timing:"timing",permissions:"permissions",automation:"automation",shields:"shields",domBlockers:"dom_blockers"};function Se(e,t){let n=e.sources[t];return n?.status==="ok"?n.value:void 0}function f(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function s(e){try{return e()}catch{return}}function j(){return typeof window>"u"?void 0:window}function g(){let e=j();if(!e)throw new l("no-window");return e}function ve(e){throw e instanceof Error&&(e.name==="SecurityError"||e.name==="NotAllowedError"||e.name==="NotSupportedError")?new w(e.name):e}var $t=/\{\s*\[native code\]\s*\}\s*$/,jt=[["navigator","webdriver"],["navigator","userAgent"],["navigator","platform"],["navigator","plugins"],["navigator","mimeTypes"],["navigator","languages"],["navigator","language"],["navigator","hardwareConcurrency"],["navigator","deviceMemory"],["navigator","maxTouchPoints"],["navigator","vendor"],["navigator","appVersion"],["navigator","productSub"],["screen","width"],["screen","height"],["screen","availWidth"],["screen","availHeight"],["screen","colorDepth"]];function we(e){let t=[];for(let[o,i]of jt){let a=o==="navigator"?e.navigator:e.screen;if(!a)continue;if(s(()=>Object.getOwnPropertyDescriptor(a,i))){t.push({id:`${o}.${i}`,kind:"descriptor",detail:"own-property-shadows-prototype"});continue}let u=s(()=>Object.getPrototypeOf(a));if(!u)continue;let m=s(()=>Object.getOwnPropertyDescriptor(u,i));if(!m?.get)continue;let p=s(()=>Function.prototype.toString.call(m.get));p!==void 0&&!$t.test(p)&&t.push({id:`${o}.${i}.getter`,kind:"descriptor",detail:"getter-is-not-native"})}let n=s(()=>Object.getPrototypeOf(e.navigator));e.Navigator&&n!==void 0&&n!==e.Navigator.prototype&&t.push({id:"navigator",kind:"prototype",detail:"not-Navigator.prototype"});let r=s(()=>Object.getPrototypeOf(e.screen));return e.Screen&&r!==void 0&&r!==e.Screen.prototype&&t.push({id:"screen",kind:"prototype",detail:"not-Screen.prototype"}),t}var be=/\{\s*\[native code\]\s*\}\s*$/,Xt=[["Function.prototype.toString",()=>Function.prototype.toString],["Function.prototype.bind",()=>Function.prototype.bind],["Object.getOwnPropertyDescriptor",()=>Object.getOwnPropertyDescriptor],["Object.defineProperty",()=>Object.defineProperty],["Date.prototype.getTimezoneOffset",()=>Date.prototype.getTimezoneOffset],["Number.prototype.toFixed",()=>Number.prototype.toFixed],["Error.prototype.toString",()=>Error.prototype.toString],["Intl.DateTimeFormat",()=>Intl?.DateTimeFormat],["Navigator.prototype.javaEnabled",e=>e.Navigator?.prototype?.javaEnabled],["Permissions.prototype.query",e=>e.Permissions?.prototype?.query],["MediaDevices.prototype.enumerateDevices",e=>e.MediaDevices?.prototype?.enumerateDevices],["HTMLCanvasElement.prototype.toDataURL",e=>e.HTMLCanvasElement?.prototype?.toDataURL],["CanvasRenderingContext2D.prototype.getImageData",e=>e.CanvasRenderingContext2D?.prototype?.getImageData],["WebGLRenderingContext.prototype.getParameter",e=>e.WebGLRenderingContext?.prototype?.getParameter],["WebGLRenderingContext.prototype.getExtension",e=>e.WebGLRenderingContext?.prototype?.getExtension],["AudioBuffer.prototype.getChannelData",e=>e.AudioBuffer?.prototype?.getChannelData],["Element.prototype.getBoundingClientRect",e=>e.Element?.prototype?.getBoundingClientRect],["Performance.prototype.now",e=>e.Performance?.prototype?.now],["Screen.prototype.constructor",e=>e.Screen]];function Kt(){let e=Function.prototype.toString;if(typeof document>"u"||!document.body)return{fn:e,clean:!1};let t=s(()=>{let n=document.createElement("iframe");return n.setAttribute("sandbox","allow-same-origin"),n.style.display="none",document.body.appendChild(n),n});if(!t)return{fn:e,clean:!1};try{let n=s(()=>t.contentWindow?.Function?.prototype?.toString);return n?{fn:n,clean:!0}:{fn:e,clean:!1}}finally{t.remove()}}function _e(e){let t=[],n=[],{fn:r,clean:o}=Kt(),i=a=>s(()=>r.call(a));for(let[a,c]of Xt){let u=s(()=>c(e));if(u==null){n.push({id:a,kind:"missing"});continue}if(typeof u!="function")continue;let m=i(u);m!==void 0&&(be.test(m)||(t.push(a),n.push({id:a,kind:"not-native"})))}if(o){let a=Function.prototype.toString,c=i(a);c!==void 0&&!be.test(c)&&(t.includes("Function.prototype.toString")||t.push("Function.prototype.toString"),n.push({id:"Function.prototype.toString",kind:"not-native",detail:"caught-via-fresh-realm"}))}return{patched:t,lies:n}}function I(e){let t=j(),n=Se({schema:1,budget_ms:0,elapsed_ms:0,tiers:[],sources:e,integrity:{patched_natives:[],lies:[],engine:{}}},d.engine),r={...n?.claimed===void 0?{}:{claimed:n.claimed},...n?.observed===void 0?{}:{observed:n.observed}};if(!t)return{patched_natives:[],lies:[],engine:r};let o=_e(t),i=we(t);return{patched_natives:o.patched,lies:[...o.lies,...i],engine:r}}function zt(){let e=globalThis,t=e.OfflineAudioContext??e.webkitOfflineAudioContext;if(!t)throw new l("no-offline-audio-context");return t}async function Ee(e){let t=zt(),n=new t(1,5e3,44100),r=n.createOscillator();r.type="triangle",r.frequency.value=1e4;let o=n.createDynamicsCompressor();o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.25,r.connect(o),o.connect(n.destination),r.start(0);let a=(await new Promise((u,m)=>{e.signal.addEventListener("abort",()=>m(e.signal.reason),{once:!0}),n.oncomplete=p=>u(p.renderedBuffer);try{let p=n.startRendering();p&&typeof p.then=="function"&&p.then(u,m)}catch(p){m(p)}})).getChannelData(0),c=0;for(let u=4500;u<a.length;u++)c+=Math.abs(a[u]??0);return c}var xe={id:d.audio,tier:"deferred",timeoutMs:500,async run(e){let t=await Ee(e);if(t===0)throw new w("audio-silent");let n=await Ee(e);return f({value:t,unstable:t!==n,sample_rate:44100})}},Te={id:d.audioLatency,tier:"deferred",timeoutMs:200,run(){let e=globalThis,t=e.AudioContext??e.webkitAudioContext;if(!t)throw new l("no-audio-context");let n=new t;try{return f({base_latency:s(()=>n.baseLatency),sample_rate:s(()=>n.sampleRate),state:s(()=>n.state)})}finally{s(()=>{n.close()})}}};var Me={id:d.hardware,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator;return f({hardware_concurrency:s(()=>e.hardwareConcurrency),device_memory:s(()=>e.deviceMemory)})}},ke={id:d.touch,tier:"fast",run(){let e=g();return f({max_touch_points:s(()=>navigator.maxTouchPoints),touch_event:s(()=>"ontouchstart"in e),touch_start:s(()=>(document.createEvent("TouchEvent"),!0)),pointer_coarse:s(()=>e.matchMedia?.("(pointer: coarse)").matches),any_hover:s(()=>e.matchMedia?.("(any-hover: hover)").matches),device_motion:s(()=>"DeviceMotionEvent"in e),device_orientation:s(()=>"DeviceOrientationEvent"in e)})}},Ae={id:d.sensors,tier:"deferred",timeoutMs:150,async run(e){let t=g(),n="DeviceMotionEvent"in t,r="DeviceOrientationEvent"in t;if(!n&&!r)return f({device_motion:!1,device_orientation:!1});if(typeof document<"u"&&document.visibilityState==="hidden")return f({device_motion:n,device_orientation:r});let o=await new Promise(i=>{let a=!1,c=p=>{a||(a=!0,t.removeEventListener("devicemotion",u),clearTimeout(m),i(p))},u=()=>c(!0),m=setTimeout(()=>c(!1),100);e.signal.addEventListener("abort",()=>c(!1),{once:!0}),t.addEventListener("devicemotion",u,{once:!0})});return f({device_motion:n,device_orientation:r,motion_observed:o})}},Ce={id:d.mediaDevices,tier:"fast",timeoutMs:120,async run(){if(typeof navigator>"u")throw new l("no-navigator");if(typeof navigator.mediaDevices?.enumerateDevices!="function")throw new l("no-media-devices");let e=await navigator.mediaDevices.enumerateDevices();return f({audio_input:e.filter(t=>t.kind==="audioinput").length,audio_output:e.filter(t=>t.kind==="audiooutput").length,video_input:e.filter(t=>t.kind==="videoinput").length,labels_hidden:e.length>0&&e.every(t=>t.label==="")})}},De={id:d.network,tier:"fast",run(){let e=navigator.connection;if(!e)throw new l("no-network-information");return f({effective_type:s(()=>e.effectiveType),downlink:s(()=>e.downlink),rtt:s(()=>e.rtt),save_data:s(()=>e.saveData)})}},Re={id:d.intl,tier:"fast",run(){if(typeof Intl>"u")throw new l("no-intl");let e=s(()=>new Intl.DateTimeFormat().resolvedOptions());return f({timezone:e?.timeZone,timezone_offset:s(()=>new Date().getTimezoneOffset()),locale:e?.locale,calendar:e?.calendar,numbering_system:e?.numberingSystem,formatted:s(()=>new Intl.DateTimeFormat(void 0,{dateStyle:"full",timeStyle:"full"}).format(new Date(0)))})}},Oe={id:d.timezone,tier:"fast",run(){if(typeof Intl>"u")throw new l("no-intl");return f({name:s(()=>new Intl.DateTimeFormat().resolvedOptions().timeZone),offset:s(()=>new Date().getTimezoneOffset())})}},Ne={id:d.battery,tier:"deferred",timeoutMs:250,async run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator.getBattery;if(typeof e!="function")throw new l("no-battery-api");let t=await e.call(navigator),n=r=>r===void 0?void 0:Number.isFinite(r)?r:null;return f({charging:t.charging,charging_time:n(t.chargingTime),discharging_time:n(t.dischargingTime),level:t.level})}},Pe={id:d.speech,tier:"deferred",timeoutMs:250,async run(e){if(typeof speechSynthesis>"u")throw new l("no-speech-synthesis");let t=speechSynthesis.getVoices();return t.length===0&&(t=await new Promise(n=>{let r=()=>{speechSynthesis.removeEventListener("voiceschanged",o),e.signal.removeEventListener("abort",i),n(speechSynthesis.getVoices())},o=()=>r(),i=()=>r();speechSynthesis.addEventListener("voiceschanged",o,{once:!0}),e.signal.addEventListener("abort",i,{once:!0}),setTimeout(r,Math.min(100,e.budgetRemainingMs()))})),{voices:t.map(n=>({name:n.name,language:n.lang,local_service:n.localService,default:n.default,uri:n.voiceURI}))}}};var Ie={id:d.screen,tier:"fast",run(){let e=g(),t=e.screen;return f({width:s(()=>t.width),height:s(()=>t.height),avail_width:s(()=>t.availWidth),avail_height:s(()=>t.availHeight),color_depth:s(()=>t.colorDepth),pixel_depth:s(()=>t.pixelDepth),device_pixel_ratio:s(()=>e.devicePixelRatio),orientation:s(()=>t.orientation?.type),inner_width:s(()=>e.innerWidth),inner_height:s(()=>e.innerHeight),frame:s(()=>[t.availTop??null,(t.width??0)-(t.availWidth??0)-(t.availLeft??0),(t.height??0)-(t.availHeight??0)-(t.availTop??0),t.availLeft??null])})}},X;function Qt(e){let t=e.screen;return[t.availTop??null,(t.width??0)-(t.availWidth??0)-(t.availLeft??0),(t.height??0)-(t.availHeight??0)-(t.availTop??0),t.availLeft??null]}var Le={id:d.screenFrame,tier:"fast",run(){let e=g(),t=Qt(e),n=e.document?.fullscreenElement!=null,r=t.every(o=>o===0||o===null);return!n&&!r&&(X=t),{frame:n&&X?[...X]:t}}};function Jt(e,t,n){if(typeof e.matchMedia=="function"){for(let r=0;r<=n;r++)if(e.matchMedia(`(${t}: ${r})`).matches)return r}}function K(e,t){if(typeof e.matchMedia=="function")return t.find(n=>e.matchMedia(n).matches)}var Be={id:d.mediaQueries,tier:"fast",run(){let e=g();if(typeof e.matchMedia!="function")throw new l("no-match-media");let t=K(e,["(color-gamut: rec2020)","(color-gamut: p3)","(color-gamut: srgb)"]),n=K(e,["(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-contrast: no-preference)"]);return f({color_gamut:t?.match(/color-gamut:\s*(\w+)/)?.[1],inverted_colors:s(()=>e.matchMedia("(inverted-colors: inverted)").matches),forced_colors:s(()=>e.matchMedia("(forced-colors: active)").matches),monochrome:Jt(e,"monochrome",10),contrast:n?.match(/prefers-contrast:\s*([\w-]+)/)?.[1],reduced_motion:s(()=>e.matchMedia("(prefers-reduced-motion: reduce)").matches),reduced_transparency:s(()=>e.matchMedia("(prefers-reduced-transparency: reduce)").matches),hdr:s(()=>e.matchMedia("(dynamic-range: high)").matches)})}},Fe={id:d.colorGamut,tier:"fast",run(){let e=g();if(typeof e.matchMedia!="function")throw new l("no-match-media");let n=K(e,["(color-gamut: rec2020)","(color-gamut: p3)","(color-gamut: srgb)"])?.match(/color-gamut:\s*(\w+)/)?.[1];return n==="srgb"||n==="p3"||n==="rec2020"?{gamut:n}:{}}};var Yt=16384,Zt=15,en=9;var tn=250,Ue=600;function nn(e){return new Promise((t,n)=>{let r=indexedDB.open(e,1);r.onupgradeneeded=()=>r.result.createObjectStore("s"),r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??new Error("indexeddb-open-failed")),r.onblocked=()=>n(new Error("indexeddb-open-blocked"))})}function rn(e){try{let t=e.transaction("s","readwrite",{durability:"strict"}),n=t.durability==="strict";return t.abort(),n}catch{return!1}}function q(e,t,n){return new Promise((r,o)=>{let i=performance.now(),a=0,c=()=>{if(a===Zt){r(performance.now()-i);return}let u=e.transaction("s","readwrite",{durability:t});u.objectStore("s").put(n,a),a+=1,u.oncomplete=c,u.onerror=u.onabort=()=>o(u.error??new Error("indexeddb-write-failed"))};c()})}var We={id:d.storageDurability,tier:"deferred",timeoutMs:Ue+400,async run(e){if(g(),typeof indexedDB!="object"||indexedDB===null)throw new l("no-indexeddb");let t=e.completed(d.engine);if((t?.status==="ok"?t.value.observed:void 0)!=="chromium")throw new l("not-chromium");let r=`__fingerly_durability_${Math.random().toString(36).slice(2)}`,o=new Uint8Array(Yt),i;try{if(i=await nn(r),!rn(i))return{honored:!1};await q(i,"relaxed",o),await q(i,"strict",o);let a=performance.now(),c=a+Math.min(Ue,Math.max(0,e.budgetRemainingMs()-tn)),u=[];for(;u.length<en&&!e.signal.aborted;){if(u.length>0){let b=(performance.now()-a)/u.length;if(performance.now()+b>c)break}let m=await q(i,"relaxed",o),p=await q(i,"strict",o);if(m>0)u.push(p/m);else break}return u.length===0?{honored:!0,rounds:0}:(u.sort((m,p)=>m-p),f({ratio:u[u.length>>1],rounds:u.length,honored:!0}))}finally{try{i?.close(),indexedDB.deleteDatabase(r)}catch{}}}};var qe=[["easylist",".ad_300x250",".textads"],["easylist_germany",".werbung1",".werbeblock"],["easylist_italy",".pubbl",".banner_pubblicita"],["easylist_dutch",".advertentie-container",".reclame"],["easyprivacy",".trackingpixel","#tracking-pixel"],["fanboy_annoyances","#newsletter-signup-modal",".cookie-consent-banner"],["fanboy_social",".social-share-buttons",".facebook-like-box"],["adguard_base","#adsense_widget",".adsbygoogle-container"],["adguard_annoyances",".push-notification-prompt","#app-install-banner"],["listekr","#ad_wrapper_top",".ad_zone"],["liste_fr",".pub_300x250","#pubfooter"],["ro_list",".reclama-mare","#reclama"]],on=60;function an(){return new Promise(e=>{let t=!1,n=()=>{t||(t=!0,e())};setTimeout(n,on),typeof requestAnimationFrame=="function"&&requestAnimationFrame(()=>setTimeout(n,0))})}function Ve(e){if(e.offsetParent===null||e.offsetHeight===0||e.offsetWidth===0)return!0;let t=getComputedStyle(e);return t.display==="none"||t.visibility==="hidden"}function Ge(e,t){let n=e.createElement("div");return t.startsWith("#")?n.id=t.slice(1):n.className=t.slice(1),n.style.position="absolute",n.style.top="-9999px",n.style.left="-9999px",n.style.width="1px",n.style.height="1px",n}var He={id:d.domBlockers,tier:"deferred",timeoutMs:300,async run(){if(g(),typeof document>"u"||!document.body)throw new l("no-document-body");let e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.style.width="1px",e.style.height="1px";let t=Ge(document,".fingerly-control-element");e.appendChild(t);let n=qe.map(([r,...o])=>({name:r,nodes:o.map(i=>{let a=Ge(document,i);return e.appendChild(a),a})}));document.body.appendChild(e);try{if(await an(),Ve(t))return{};let r=n.filter(({nodes:o})=>o.some(Ve)).map(({name:o})=>o);return f({blocked:r,probed:qe.length})}finally{e.remove()}}};function sn(){return s(()=>{try{(-1).toFixed(-1)}catch(e){return e instanceof Error?e.message.length:void 0}})}function cn(){return s(()=>eval.toString().length)}function un(){return s(()=>{let e=new Error("probe").stack;if(!(typeof e!="string"||e===""))return e.includes(" at ")?"v8":/^@|\n@|^\w*@/m.test(e)?e.includes("global code")?"javascriptcore":"spidermonkey":"unknown"})}function dn(e,t,n){let r=[];if(e===51?r.push("chromium"):e===43||e===44?r.push("webkit"):e===25&&r.push("gecko"),t===33&&r.push("chromium"),n==="v8"?r.push("chromium"):n==="javascriptcore"?r.push("webkit"):n==="spidermonkey"&&r.push("gecko"),r.length===0)return;let o=new Map;for(let c of r)o.set(c,(o.get(c)??0)+1);let i,a=0;for(let[c,u]of o)u>a&&(a=u,i=c);return i}function ln(e){if(e){if(/Firefox\//.test(e))return"gecko";if(/Edg\/|OPR\/|Chrome\/|Chromium\//.test(e))return"chromium";if(/Safari\//.test(e))return"webkit"}}var $e={id:d.engine,tier:"fast",run(){let e=sn(),t=cn(),n=un(),r=dn(e,t,n),o=ln(typeof navigator>"u"?void 0:navigator.userAgent);return f({to_fixed_error_length:e,eval_length:t,stack_style:n,observed:r,claimed:o})}},fn=[["acos",()=>Math.acos(.12312423423423424)],["acosh",()=>Math.acosh(1e308)],["asin",()=>Math.asin(.12312423423423424)],["asinh",()=>Math.asinh(1)],["atan",()=>Math.atan(.5)],["atanh",()=>Math.atanh(.5)],["cbrt",()=>Math.cbrt(100)],["cos",()=>Math.cos(10.000000000123)],["cosh",()=>Math.cosh(1)],["exp",()=>Math.exp(1)],["expm1",()=>Math.expm1(1)],["log",()=>Math.log(10)],["log1p",()=>Math.log1p(10)],["pow",()=>Math.pow(Math.PI,-100)],["sin",()=>Math.sin(1e300)],["sinh",()=>Math.sinh(1)],["sqrt",()=>Math.sqrt(2)],["tan",()=>Math.tan(-1e300)],["tanh",()=>Math.tanh(1)]];function mn(){return Object.is(Math.sin(0),0)&&Math.cos(0)===1&&Math.sqrt(4)===2&&Math.log(1)===0&&Math.pow(2,10)===1024}var je={id:d.math,tier:"fast",timeoutMs:50,run(){let e=[],t=0,n=new Map;for(let[r,o]of fn){let i=s(o);typeof i=="number"&&Number.isFinite(i)?(t+=1,n.set(r,i),e.push(`${r}:${i}`)):e.push(`${r}:`)}return f({hash:A(e.join("|")),probed:t,atanh_half:n.get("atanh"),expm1_1:n.get("expm1"),identities_hold:s(mn)})}};function L(e){return s(()=>{try{e()}catch(t){return t instanceof EvalError?void 0:t instanceof Error?t.message.length:void 0}})}function pn(){try{return new Function(""),!0}catch{return!1}}function gn(e){let t=[],n=e.own_properties;if(n!==void 0&&(n.includes("sourceURL")?t.push("webkit","webkit"):n.includes("lineNumber")?t.push("gecko","gecko"):n==="message,stack"&&t.push("chromium","chromium")),e.null_property_length===44?t.push("chromium"):e.null_property_length===33&&t.push("gecko"),e.syntax_length===20?t.push("chromium"):e.syntax_length===28&&t.push("gecko"),t.length===0)return;let r=new Map;for(let c of t)r.set(c,(r.get(c)??0)+1);let o,i=0,a=!1;for(let[c,u]of r)u>i?(i=u,o=c,a=!1):u===i&&(a=!0);return a?void 0:o}function hn(){return s(()=>{try{throw new Error("probe")}catch(e){return Object.getOwnPropertyNames(e).sort().join(",")}})}var Xe={id:d.errors,tier:"fast",timeoutMs:50,run(){let e=pn(),t=f({null_property_length:L(()=>null.x),syntax_length:e?L(()=>new Function("!")):void 0,json_parse_length:L(()=>JSON.parse("{")),invalid_array_length:L(()=>{let n=[];n.length=-1}),const_assign_length:e?L(()=>{new Function("const c = 1; c = 2")()}):void 0,own_properties:hn(),capture_stack_trace:s(()=>typeof Error.captureStackTrace=="function"),stack_trace_limit:s(()=>"stackTraceLimit"in Error)});return f({...t,observed:gn(t)})}};var Ke={id:d.navigator,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator;return f({user_agent:s(()=>e.userAgent),platform:s(()=>e.platform),vendor:s(()=>e.vendor),product_sub:s(()=>e.productSub),app_version:s(()=>e.appVersion),hardware_concurrency:s(()=>e.hardwareConcurrency),device_memory:s(()=>e.deviceMemory),max_touch_points:s(()=>e.maxTouchPoints),webdriver:s(()=>e.webdriver),cookie_enabled:s(()=>e.cookieEnabled),pdf_viewer_enabled:s(()=>e.pdfViewerEnabled),do_not_track:s(()=>e.doNotTrack),plugin_count:s(()=>e.plugins?.length),mime_type_count:s(()=>e.mimeTypes?.length),language:s(()=>e.language),languages:s(()=>e.languages?[...e.languages]:void 0)})}},ze={id:d.languages,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");return f({primary:s(()=>navigator.language),accepted:s(()=>navigator.languages?[...navigator.languages]:void 0)})}},Qe={id:d.vendor,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");return f({vendor:s(()=>navigator.vendor)})}},Je={id:d.plugins,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator.plugins;if(!e)throw new l("no-plugins");return{plugins:Array.from(e,t=>({name:t.name,filename:t.filename,description:t.description,mime_types:Array.from(t,n=>({type:n.type,suffixes:n.suffixes,description:n.description}))}))}}},Ye={id:d.userAgentData,tier:"deferred",timeoutMs:200,async run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator.userAgentData;if(!e)throw new l("no-user-agent-data");let t=f({brands:e.brands,mobile:e.mobile,platform:e.platform});if(typeof e.getHighEntropyValues!="function")return t;let n=await e.getHighEntropyValues(["architecture","bitness","model","platformVersion","fullVersionList","wow64"]);return{...t,...n}}};function z(e,t){let n=document.createElement("canvas");n.width=e,n.height=t;let r=n.getContext("2d");if(!r)throw new l("no-2d-context");return[n,r]}function Ze(){let[e,t]=z(240,60);t.globalCompositeOperation="multiply";for(let[n,r,o]of[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]])t.fillStyle=n,t.beginPath(),t.arc(r,o,40,0,Math.PI*2,!0),t.closePath(),t.fill();return t.fillStyle="#f9c",t.arc(100,50,50,0,Math.PI*2,!0),t.arc(100,50,20,0,Math.PI*2,!0),t.fill("evenodd"),e.toDataURL()}function et(){let[e,t]=z(300,60);return t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"',t.fillText("Fingerly <canvas> 1.0 \u{1F512}\u0416\u4E2D",2,15),t.font="18pt Arial",t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText("Fingerly <canvas> 1.0",4,45),e.toDataURL()}function yn(){let[,e]=z(1,1);return e.rect(0,0,10,10),e.rect(2,2,6,6),e.isPointInPath(5,5,"evenodd")===!1}function Sn(e){let t=e.completed(d.timing);if(t?.status!=="ok")return!1;let n=t.value?.now_resolution;return typeof n=="number"&&n>=16}var tt={id:d.canvas,tier:"deferred",timeoutMs:400,run(e){if(g(),typeof document>"u")throw new l("no-document");if(Sn(e))throw new w("rfp-canvas-prompt-avoided");try{let t=Ze(),n=Ze(),r=et(),o=et(),i=t!==n||r!==o;return f({geometry:A(t),text:A(r),winding:s(yn),unstable:i})}catch(t){ve(t)}}};function nt(){if(typeof document>"u")throw new l("no-document");let e=document.createElement("canvas"),t=e.getContext("webgl")??e.getContext("experimental-webgl");if(!t)throw new l("no-webgl-context");return t}var rt={id:d.webgl,tier:"fast",timeoutMs:400,run(){let e=nt(),t=s(()=>e.getExtension("WEBGL_debug_renderer_info")),n={};for(let o of["MAX_TEXTURE_SIZE","MAX_VIEWPORT_DIMS","MAX_VERTEX_ATTRIBS","MAX_VARYING_VECTORS","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_RENDERBUFFER_SIZE","MAX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS","ALIASED_LINE_WIDTH_RANGE","ALIASED_POINT_SIZE_RANGE","RED_BITS","GREEN_BITS","BLUE_BITS","ALPHA_BITS","DEPTH_BITS","STENCIL_BITS"]){let i=e[o];if(typeof i!="number")continue;let a=s(()=>e.getParameter(i));a!=null&&(n[o]=ArrayBuffer.isView(a)?Array.from(a):a)}let r=[];for(let o of[e.VERTEX_SHADER,e.FRAGMENT_SHADER])for(let i of[e.LOW_FLOAT,e.MEDIUM_FLOAT,e.HIGH_FLOAT]){let a=s(()=>e.getShaderPrecisionFormat(o,i));a&&r.push(a.rangeMin,a.rangeMax,a.precision)}return f({vendor:s(()=>e.getParameter(e.VENDOR)),renderer:s(()=>e.getParameter(e.RENDERER)),unmasked_vendor:t?s(()=>e.getParameter(t.UNMASKED_VENDOR_WEBGL)):void 0,unmasked_renderer:t?s(()=>e.getParameter(t.UNMASKED_RENDERER_WEBGL)):void 0,version:s(()=>e.getParameter(e.VERSION)),shading_language_version:s(()=>e.getParameter(e.SHADING_LANGUAGE_VERSION)),max_texture_size:s(()=>e.getParameter(e.MAX_TEXTURE_SIZE)),max_render_buffer_size:s(()=>e.getParameter(e.MAX_RENDERBUFFER_SIZE)),parameters_hash:Object.keys(n).length>0?A(JSON.stringify(n)):void 0,shader_precision_hash:r.length>0?A(r.join(",")):void 0})}},ot={id:d.webglExtensions,tier:"deferred",timeoutMs:200,run(){let t=nt().getSupportedExtensions();if(!t)throw new w("extensions-withheld");return[...t].sort()}};function vn(e){let t=[],n=Date.now()+12;for(;t.length<25&&Date.now()<n;){let r=e(),o=e(),i=0;for(;o===r&&i++<1e5&&Date.now()<n;)o=e();o!==r&&t.push(o-r)}return t.length===0?100:Math.round(Math.min(...t)*1e6)/1e6}var at={id:d.timing,tier:"fast",timeoutMs:150,run(){let t=g().performance;return typeof t?.now!="function"?f({has_performance:!1}):f({has_performance:!0,now_resolution:vn(()=>t.now())})}},it=new WeakMap;function wn(e,t){let n=it.get(e.navigator);n||(n=new Map,it.set(e.navigator,n));let r=n.get(t);return r||(r=e.navigator.permissions.query({name:t}),n.set(t,r)),r}var st={id:d.permissions,tier:"fast",timeoutMs:200,async run(){let e=g();if(!e.navigator.permissions?.query)throw new l("no-permissions-api");let t=async o=>{try{return(await wn(e,o)).state}catch{return}},n=await t("notifications"),r=s(()=>e.Notification?.permission);return f({notification:n,notification_legacy:r,geolocation:await t("geolocation")})}},bn=["__nightmare","_phantom","callPhantom","__phantomas","Buffer","emit","spawn","__selenium_evaluate","__selenium_unwrapped","__webdriver_evaluate","__webdriver_script_fn","__webdriver_script_func","__webdriver_unwrapped","__fxdriver_evaluate","__fxdriver_unwrapped","__driver_evaluate","__driver_unwrapped","_Selenium_IDE_Recorder","domAutomation","domAutomationController","__lastWatirAlert","__playwright","__puppeteer","__pw_manual"],ct={id:d.automation,tier:"fast",run(){let e=g(),t=bn.filter(r=>s(()=>r in e)===!0),n=s(()=>Object.getOwnPropertyNames(e).filter(r=>/^cdc_|^\$cdc_/.test(r)));return f({webdriver:s(()=>navigator.webdriver),cdp_artifacts:n&&n.length>0?n:void 0,distinctive_properties:t.length>0?[...t]:void 0,chrome_object:s(()=>"chrome"in e),window_external:s(()=>{let r=e.external;return r?String(r):void 0})})}};var _n=50,ut=Symbol("timed-out");async function En(e){if(typeof e.brave?.isBrave=="function")try{let t=await Promise.race([e.brave.isBrave(),new Promise(n=>setTimeout(()=>n(ut),_n))]);return t===ut?void 0:t===!0}catch{return}}function xn(e){let t=e.userAgentData?.brands;if(Array.isArray(t))return t.some(n=>n?.brand==="Brave")}var dt=[[30,60,90],[210,180,140]],S=8;function Tn(){if(!(typeof document>"u"))try{let e=document.createElement("canvas");e.width=S,e.height=S;let t=e.getContext("2d",{willReadFrequently:!0});if(!t)return;for(let r=0;r<S;r++)for(let o=0;o<S;o++){let[i,a,c]=dt[(o+r)%2];t.fillStyle=`rgb(${i}, ${a}, ${c})`,t.fillRect(o,r,1,1)}let n=t.getImageData(0,0,S,S).data;for(let r=0;r<S*S;r++){let o=r%S,i=Math.floor(r/S),[a,c,u]=dt[(o+i)%2],m=r*4;if(n[m]!==a||n[m+1]!==c||n[m+2]!==u||n[m+3]!==255)return!0}return!1}catch{return}}var lt={id:d.shields,tier:"fast",timeoutMs:100,async run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator;return f({brave:await En(e),brave_claimed:xn(e),canvas_noise:Tn()})}};function ft(e){try{let t=window[e];if(!t)return!1;let n="__fingerly_probe__";return t.setItem(n,"1"),t.removeItem(n),!0}catch{return!1}}function Mn(){try{return typeof window.indexedDB=="object"&&window.indexedDB!==null}catch{return!1}}function kn(e){let t=e instanceof Error?e.name:"",n=e instanceof Error?e.message:String(e);return n.includes("unknown transient reason")?"transient":t==="SecurityError"||n.includes("Security error")?"refused":"failed"}var An=200;async function Cn(){let e=navigator.storage;if(typeof e?.getDirectory=="function")return Promise.race([e.getDirectory().then(()=>"ok",t=>kn(t)),new Promise(t=>setTimeout(t,An))])}var Dn=150;function Rn(){let e=navigator.webkitTemporaryStorage;return typeof e?.queryUsageAndQuota!="function"?Promise.resolve(void 0):new Promise(t=>{let n=!1,r=o=>{n||(n=!0,t(o))};setTimeout(()=>r(void 0),Dn);try{e.queryUsageAndQuota((o,i)=>r(typeof i=="number"?i:void 0),()=>r(void 0))}catch{r(void 0)}})}function On(){if(window.isSecureContext)return"serviceWorker"in navigator}var mt={id:d.storage,tier:"fast",timeoutMs:250,async run(){g();let e=s(async()=>{if(typeof navigator.storage?.estimate!="function")return;let u=await navigator.storage.estimate();return{quota:u.quota,usage:u.usage}}),t=Rn(),n=Cn(),[r,o,i]=await Promise.all([e,t,n]),a=r?.quota,c=navigator.deviceMemory;return f({local_storage:ft("localStorage"),session_storage:ft("sessionStorage"),indexed_db:Mn(),quota:a,usage:r?.usage,legacy_quota:o,quota_ratio:typeof a=="number"&&typeof c=="number"&&c>0?a/(c*1024*1024*1024):void 0,origin_filesystem:i,service_worker:On()})}},pt={id:d.storageQuota,tier:"fast",run(){if(g(),typeof document>"u")throw new l("no-document");return{partitioned:typeof document.hasStorageAccess=="function"}}};var gt=["monospace","sans-serif","serif"],Nn="72px",Pn="mmmmmmmmmmlli WwMmIi 0123",Q=["Arial","Arial Black","Calibri","Cambria","Candara","Comic Sans MS","Consolas","Constantia","Corbel","Courier New","Ebrima","Franklin Gothic","Gabriola","Georgia","Impact","Lucida Console","Lucida Sans Unicode","Malgun Gothic","Marlett","Microsoft Himalaya","MS Gothic","MV Boli","Nirmala UI","Palatino Linotype","Segoe UI","Segoe UI Emoji","Sylfaen","Tahoma","Times New Roman","Trebuchet MS","Verdana","Webdings","Wingdings","American Typewriter","Andale Mono","Apple Chancery","Arial Hebrew","Avenir","Avenir Next","Baskerville","Big Caslon","Bodoni 72","Chalkboard","Cochin","Copperplate","Didot","Futura","Geneva","Gill Sans","Helvetica","Helvetica Neue","Herculanum","Hoefler Text","Lucida Grande","Luminari","Menlo","Monaco","Optima","Papyrus","Phosphate","Rockwell","SF Pro","Skia","Snell Roundhand","Trattatello","Zapfino","Cantarell","DejaVu Sans","DejaVu Serif","FreeSans","Liberation Sans","Liberation Serif","Nimbus Sans","Noto Sans","Ubuntu","Ubuntu Mono","Droid Sans","Roboto","Roboto Condensed","Bahnschrift","Bookshelf Symbol 7","Cascadia Code","Fira Code","HoloLens MDL2 Assets","Inter","JetBrains Mono","MT Extra","Source Code Pro","Wingdings 2","Wingdings 3"],ht={id:d.fonts,tier:"deferred",timeoutMs:700,run(){if(typeof document>"u")throw new l("no-document");let e=document.createElement("div");e.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden;width:auto;height:auto;margin:0;padding:0;white-space:nowrap;";let t=o=>{let i=document.createElement("span");return i.style.cssText=`position:absolute;font-size:${Nn};margin:0;padding:0;font-family:${o};`,i.textContent=Pn,e.appendChild(i),i},n=gt.map(o=>t(o)),r=Q.map(o=>gt.map(i=>t(`'${o}',${i}`)));document.body.appendChild(e);try{let o=n.map(c=>c.offsetWidth),i=n.map(c=>c.offsetHeight),a=[];return Q.forEach((c,u)=>{let m=r[u];if(!m)return;m.every((b,y)=>{let _=o[y],E=i[y];return b.offsetWidth!==_||b.offsetHeight!==E})&&a.push(c)}),f({available:a,probed:Q.length})}finally{e.remove()}}},yt={id:d.fontPreferences,tier:"deferred",timeoutMs:250,run(){if(typeof document>"u"||!document.body)throw new l("no-document-body");let e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;border:0",document.body.appendChild(e);try{let t=e.contentDocument;if(!t?.body)throw new l("no-frame-document");let n="mmMwWLliI0O&1",r={default:"",serif:"serif",sans:"sans-serif",mono:"monospace",system:"system-ui",apple:"-apple-system",min:"Arial, sans-serif"},o={};for(let[i,a]of Object.entries(r)){let c=t.createElement("span");c.textContent=n,c.style.cssText=`font:72px ${a||"initial"};white-space:nowrap;position:absolute`,t.body.appendChild(c),o[i]=Math.round(c.getBoundingClientRect().width*1e3)/1e3}return{widths:o}}finally{e.remove()}}};var B=[$e,Xe,je,Ke,ze,Je,Qe,Ie,Le,Be,Fe,Me,ke,De,Re,Oe,mt,pt,lt,at,st,ct,rt,Ce,tt,ot,xe,Te,ht,yt,Ne,Pe,Ae,Ye,He,We];function St(e){return new Promise(t=>t(new P({...e,platform:"web",sources:e.sources??B,integrity:n=>I(n.sources)})))}return xt(In);})();
|
|
1
|
+
"use strict";var Fingerly=(()=>{var H=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Et=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var Tt=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},Mt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Et(t))!xt.call(e,o)&&o!==n&&H(e,o,{get:()=>t[o],enumerable:!(r=_t(t,o))||r.enumerable});return e};var kt=e=>Mt(H({},"__esModule",{value:!0}),e);var Hn={};Tt(Hn,{ConsentError:()=>N,FingerlyClient:()=>P,SOURCE:()=>d,TransportError:()=>h,browserSources:()=>B,inspectIntegrity:()=>I,load:()=>vt});var me=e=>{throw TypeError(e)},ge=(e,t,n)=>t.has(e)||me("Cannot "+n),w=(e,t,n)=>(ge(e,t,"read from private field"),n?n.call(e):t.get(e)),he=(e,t,n)=>t.has(e)?me("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ye=(e,t,n,r)=>(ge(e,t,"write to private field"),t.set(e,n),n),At=["granted","pending","denied"];function Z(e){if(!At.includes(e))throw new TypeError(`Fingerly consent must be 'granted', 'pending' or 'denied' (received ${JSON.stringify(e)})`)}var N=class extends Error{constructor(e){super(`Fingerly needs consent before it can identify this visitor (consent is ${e})`),this.state=e,this.name="ConsentError",this.code="consent_required"}},l=class extends Error{constructor(e){super(e??"unsupported"),this.reason=e,this.name="UnsupportedSignal"}},v=class extends Error{constructor(e){super(e??"blocked"),this.reason=e,this.name="BlockedSignal"}},R=class extends Error{constructor(e){super(e??"timeout"),this.reason=e,this.name="TimedOutSignal"}};function Ct(e){if(e instanceof l||e instanceof v||e instanceof R)return e.reason;if(e instanceof Error&&typeof e.name=="string"&&e.name!=="Error")return e.name}var T=typeof globalThis.performance?.now=="function"?()=>globalThis.performance.now():()=>Date.now(),$={budgetMs:1200,defaultSourceTimeoutMs:300,concurrency:6};function U(e){return Math.max(0,Math.round(e))}function Dt(e){return e instanceof l?"unsupported":e instanceof v?"blocked":e instanceof R?"timeout":"error"}async function Rt(e,t,n,r,o){let a=T(),i=t-a;if(i<=0)return{status:"timeout",ms:0,reason:"budget-exhausted"};let c=Math.min(e.timeoutMs??n,i),u=new AbortController,p=()=>u.abort(new R("aborted"));r?.addEventListener("abort",p,{once:!0});let m=setTimeout(()=>u.abort(new R("source-timeout")),c),_={signal:u.signal,budgetRemainingMs:()=>Math.max(0,t-T()),completed:y=>o[y]};try{let y=await Promise.race([(async()=>e.run(_))(),new Promise((E,x)=>{u.signal.addEventListener("abort",()=>x(u.signal.reason??new R("source-timeout")),{once:!0})})]);return{status:"ok",ms:U(T()-a),value:y}}catch(y){let E=Dt(y),x=Ct(y);return x===void 0?{status:E,ms:U(T()-a)}:{status:E,ms:U(T()-a),reason:x}}finally{clearTimeout(m),r?.removeEventListener("abort",p)}}async function Ot(e,t={}){let n=t.budgetMs??$.budgetMs,r=t.defaultSourceTimeoutMs??$.defaultSourceTimeoutMs,o=Math.max(1,t.concurrency??$.concurrency),a=t.tiers??["fast","deferred"],i=T(),c=i+n,u={},p={...t.completed??{}},m=!1;for(let _ of a){let y=e.filter(M=>M.tier===_);if(y.length===0)continue;let E=0,x=async()=>{for(;E<y.length;){let M=y[E++];if(!M)continue;if(T()>=c||t.signal?.aborted){m=!0,u[M.id]={status:"timeout",ms:0,reason:"budget-exhausted"};continue}let G=await Rt(M,c,r,t.signal,p);G.status==="timeout"&&(m=!0),u[M.id]=G,p[M.id]=G}};await Promise.all(Array.from({length:Math.min(o,y.length)},x))}return{outcomes:u,elapsedMs:U(T()-i),truncated:m}}function Nt(e="v1"){if(!/^v[1-9]\d*$/.test(e)||e.trim()!==e)throw new TypeError('apiVersion must be a version such as "v1" or "v2"');return e}var Pt="https://api.fingerly.io",ee="x-api-key",Se="[redacted]",be=Symbol.for("nodejs.util.inspect.custom"),It="Idempotency-Key",h=class extends Error{constructor(e,t,n=!1,r,o){super(e),this.status=t,this.retryable=n,this.code=r,this.retryAfterMs=o,this.name="TransportError"}},te=4*1024*1024,Lt=2e3;function Bt(e){let t=e.headers.get("retry-after")?.trim();if(!t)return;if(/^\d+$/.test(t))return Number(t)*1e3;let n=Date.parse(t);return Number.isFinite(n)?Math.max(0,n-Date.now()):void 0}async function ne(e){try{let n=(await e.json())?.error?.code;return typeof n=="string"&&n!==""?n:void 0}catch{return}}function re(e,t){return new h(`The server refused the submission (${e.status})`,e.status,Wt(e.status),t,Bt(e))}async function Ft(e){let t=()=>new h("The server answered with a response this SDK cannot read",e.status,!1);if(Number(e.headers.get("content-length"))>te)throw e.body?.cancel().catch(()=>{}),t();let n=await e.text();if(n.length>te)throw t();try{let r=JSON.parse(n);if(r===null||typeof r!="object")throw t();return r}catch{throw t()}}function Ut(e,t){let n=Gt(t,Math.random);return e.retryAfterMs===void 0?n:e.retryAfterMs>Lt?null:e.retryAfterMs+n}function Wt(e){return e===408||e===429||e>=500&&e<=599}function qt(e){return e.status===404||e.status===405}function we(e,t){return`${e}/api/${t}/ingest`}function j(e){return we(Pt,e)}function Vt(e,t){let n=e.trim().replace(/\/+$/,"");if(n===""||n.includes("?")||n.includes("#"))throw new TypeError("A Fingerly endpoint must be a non-empty URL or path without a query or fragment");if(!(n.startsWith("/")||/^https?:\/\//i.test(n)))throw new TypeError("A Fingerly endpoint must be an absolute URL or a root-relative browser path");return/^https?:\/\/[^/]+$/i.test(n)?we(n,t):n}function Gt(e,t){let n=Math.min(2e3,100*2**(e-1));return Math.floor(t()*n)}function oe(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},o=setTimeout(r,e);t?.addEventListener("abort",r,{once:!0})})}function Ht(){let e=globalThis.crypto;if(typeof e?.randomUUID=="function")return e.randomUUID();if(typeof e?.getRandomValues=="function"){let t=e.getRandomValues(new Uint8Array(16));t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}return`fingerly-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`}var D,ie=class{constructor(e){if(he(this,D),!e.apiKey)throw new h("An SDK key is required to submit a fingerprint");ye(this,D,e.apiKey);let t=Nt(e.apiVersion),n=e.endpoints,r=n===void 0?[j(t)]:Array.isArray(n)?[...n]:[n];if(r.length===0)throw new TypeError("The endpoints array must not be empty");let o=r.map(i=>Vt(i,t));n!==void 0&&e.fallbackToDefaultEndpoint&&(o.includes(j(t))||o.push(j(t))),this.urls=o,this.maxAttempts=Math.max(1,this.urls.length,e.maxAttempts??3),this.requestTimeoutMs=e.requestTimeoutMs??5e3;let a=e.fetchImpl??globalThis.fetch;if(typeof a!="function")throw new h("No fetch implementation is available; pass one as fetchImpl");this.fetchImpl=a.bind(globalThis)}toJSON(){return{apiKey:Se,urls:[...this.urls],maxAttempts:this.maxAttempts,requestTimeoutMs:this.requestTimeoutMs}}[be](){return this.toJSON()}async submit(e,t){let n,r=JSON.stringify(e),o=Ht(),a=0;for(let i=1;i<=this.maxAttempts;i++){if(t?.aborted)throw new h("The submission was cancelled");try{return await this.attempt(this.urls[a],r,o,t)}catch(c){let u=c instanceof h?c:new h(c instanceof Error?c.message:"The submission could not be sent",void 0,!0),p=this.nextAttempt(u,i,a);if(p===null)throw u;n=u,a=Math.min(a+1,this.urls.length-1),await oe(p,t)}}throw n??new h("The submission could not be sent")}async submitSupplement(e,t,n){let r=JSON.stringify(t),o,a=0;for(let i=1;i<=this.maxAttempts;i++){if(n?.aborted)throw new h("The supplement was cancelled");try{await this.postJSON(this.urls[a],r,n);return}catch(c){let u=c instanceof h?c:new h(c instanceof Error?c.message:"The supplement could not be sent",void 0,!0),p=this.nextAttempt(u,i,a);if(p===null)throw u;o=u,a=Math.min(a+1,this.urls.length-1),await oe(p,n)}}throw o??new h("The supplement could not be sent")}nextAttempt(e,t,n){return t===this.maxAttempts?null:e.retryable?Ut(e,t):qt(e)&&n<this.urls.length-1?0:null}async postJSON(e,t,n){let r=new AbortController,o=()=>r.abort();n?.addEventListener("abort",o,{once:!0});let a=setTimeout(o,this.requestTimeoutMs);try{let i=await this.fetchImpl(e,{method:"POST",headers:{"content-type":"application/json",[ee]:w(this,D)},body:t,credentials:"omit",signal:r.signal});if(!i.ok)throw re(i,await ne(i));return await i.arrayBuffer().catch(()=>{}),i}finally{clearTimeout(a),n?.removeEventListener("abort",o)}}async attempt(e,t,n,r){let o=new AbortController,a=()=>o.abort();r?.addEventListener("abort",a,{once:!0});let i=setTimeout(a,this.requestTimeoutMs);try{let c=await this.fetchImpl(e,{method:"POST",headers:{"content-type":"application/json",[ee]:w(this,D),[It]:n},body:t,credentials:"omit",signal:o.signal});if(!c.ok)throw re(c,await ne(c));let u=await Ft(c);if(typeof u?.request_id!="string"||u.request_id==="")throw new h("The server accepted the submission but returned no request_id");return u}finally{clearTimeout(i),r?.removeEventListener("abort",a)}}};D=new WeakMap;var ae="0.2.0",d={navigator:"navigator",userAgentData:"user_agent_data",languages:"languages",plugins:"plugins",vendor:"vendor",engine:"engine",math:"math",errors:"errors",screen:"screen",screenFrame:"screen_frame",colorGamut:"color_gamut",mediaQueries:"media_queries",canvas:"canvas",webgl:"webgl",webglExtensions:"webgl_extensions",audio:"audio",audioLatency:"audio_latency",fonts:"fonts",fontPreferences:"font_preferences",intl:"intl",timezone:"timezone",storage:"storage",storageQuota:"storage_quota",storageDurability:"storage_durability",hardware:"hardware",touch:"touch",sensors:"sensors",battery:"battery",mediaDevices:"media_devices",network:"network",speech:"speech",timing:"timing",permissions:"permissions",automation:"automation",shields:"shields",domBlockers:"dom_blockers",embedding:"embedding"};function ve(e,t){let n=e.sources[t];return n?.status==="ok"?n.value:void 0}var se=1;function ce(e){return e instanceof h&&e.code==="consent_required"?new N("pending"):e}var ue=!1;function $t(e){ue||(ue=!0,console.warn(`Fingerly: this page is running inside an app (${e}), so the browser SDK collected nothing. Use the Fingerly iOS or Android SDK in apps.`))}var X={patched_natives:[],lies:[],engine:{}},S,P=class{constructor(e){he(this,S),this.consentListeners=new Set;let t=e.consent??"pending";Z(t),this.consentState=t,ye(this,S,e),this.platform=e.platform??"web",this.transport=e.transport??new ie({...e.apiVersion===void 0?{}:{apiVersion:e.apiVersion},apiKey:e.apiKey,...e.endpoints===void 0?{}:{endpoints:e.endpoints},...e.fallbackToDefaultEndpoint===void 0?{}:{fallbackToDefaultEndpoint:e.fallbackToDefaultEndpoint}})}toJSON(){return{apiKey:Se,platform:this.platform,consent:this.consentState,transport:this.transport instanceof ie?this.transport:"custom"}}[be](){return this.toJSON()}get consent(){return this.consentState}setConsent(e){if(Z(e),e!==this.consentState){this.consentState=e;for(let t of[...this.consentListeners])try{t(e)}catch(n){setTimeout(()=>{throw n},0)}}}onConsentChange(e){return this.consentListeners.add(e),()=>{this.consentListeners.delete(e)}}requireConsent(){if(this.consentState!=="granted")throw new N(this.consentState)}consentScope(e){let t=new AbortController,n=()=>t.abort();e?.aborted?n():e?.addEventListener("abort",n,{once:!0});let r=this.onConsentChange(o=>{o!=="granted"&&n()});return{signal:t.signal,close:()=>{r(),e?.removeEventListener("abort",n)}}}async identify(e={}){this.requireConsent();let t=this.consentScope(e.signal);try{return await this.identifyWithConsent(e,t.signal)}finally{t.close()}}async identifyWithConsent(e,t){let n=this.embeddedReport(),r=!n&&e.submit!==!1&&e.tiers===void 0,o=n??await this.collectReport(r?["fast"]:e.tiers??["fast","deferred"],t,r?300:void 0);if(this.requireConsent(),e.submit===!1)return{requestId:"",visitorId:"",visitorIsNew:!1,visitorConfidence:0,identifiable:!1,duplicate:!1,state:"",suspectScore:null,suspectLevel:null,report:o,deferred:Promise.resolve({status:"skipped",reason:"not-submitted"})};let a={sdk:{platform:this.platform,version:ae},consent:this.consentState,signals:o,...e.tag===void 0?{}:{tag:e.tag}},i;try{i=await this.transport.submit(a,t)}catch(u){throw this.requireConsent(),ce(u)}let c={requestId:i.request_id,visitorId:i.visitor_id??"",visitorIsNew:i.visitor_is_new??!1,visitorConfidence:i.visitor_confidence??0,identifiable:i.identifiable??!1,duplicate:i.duplicate??!1,state:i.state??"",suspectScore:typeof i.suspect_score=="number"&&Number.isFinite(i.suspect_score)?i.suspect_score:null,suspectLevel:typeof i.suspect_level=="string"&&i.suspect_level!==""?i.suspect_level:null,report:o,deferred:Promise.resolve({status:"skipped",reason:"explicit-tiers"})};return n?(c.deferred=Promise.resolve({status:"skipped",reason:"not-submitted"}),c):r?i.duplicate||!i.deferred_token?(c.deferred=Promise.resolve({status:"skipped",reason:i.duplicate?"duplicate":"unsupported-transport"}),c):typeof this.transport.submitSupplement!="function"?(c.deferred=Promise.resolve({status:"skipped",reason:"unsupported-transport"}),c):(c.deferred=this.finishDeferred(o,i.request_id,i.deferred_token,e.signal),c):c}async finishDeferred(e,t,n,r){let o={status:"skipped",reason:"consent-withdrawn"};if(this.consentState!=="granted")return o;let a=this.consentScope(r),i,c;try{if(i=await this.collectReport(["deferred"],a.signal,1200,e.sources),this.consentState!=="granted")return o;c={schema:e.schema,budget_ms:e.budget_ms+i.budget_ms,elapsed_ms:e.elapsed_ms+i.elapsed_ms,tiers:["fast","deferred"],sources:{...e.sources,...i.sources},integrity:w(this,S).integrity?w(this,S).integrity({sources:{...e.sources,...i.sources}}):X};let u={sdk:{platform:this.platform,version:ae},consent:this.consentState,signals:i,token:n};return await this.transport.submitSupplement(t,u,a.signal),{status:"submitted",report:i,combinedReport:c}}catch(u){if(this.consentState!=="granted")return o;let p=ce(u);return{status:"failed",error:p instanceof Error?p:new Error(String(p)),...i===void 0?{}:{report:i},...c===void 0?{}:{combinedReport:c}}}finally{a.close()}}async collect(e={}){this.requireConsent();let t=e.tiers??["fast","deferred"],n=this.embeddedReport();if(n)return n;let r=this.consentScope(e.signal);try{let o=await this.collectReport(t,r.signal);return this.requireConsent(),o}finally{r.close()}}embeddedReport(){let e=w(this,S).embedding?.();if(e)return $t(e),{schema:se,budget_ms:0,elapsed_ms:0,tiers:["fast"],sources:{[d.embedding]:{status:"ok",ms:0,value:{kind:e}}},integrity:X}}async collectReport(e,t,n,r){let o=w(this,S).sources??[],a={...w(this,S).schedule,tiers:e,...n===void 0?{}:{budgetMs:n},...t===void 0?{}:{signal:t},...r===void 0?{}:{completed:r}},i=await Ot(o,a),c=w(this,S).integrity?w(this,S).integrity({sources:i.outcomes}):X;return{schema:se,budget_ms:a.budgetMs??1200,elapsed_ms:i.elapsedMs,tiers:e,sources:i.outcomes,integrity:c}}};S=new WeakMap;var O=2654435761,W=2246822519,de=3266489917,jt=668265263,le=374761393;function k(e,t){return e<<t|e>>>32-t}function F(e,t){return Math.imul(k(e+Math.imul(t,W)|0,13),O)}function C(e,t){return((e[t]??0)|(e[t+1]??0)<<8|(e[t+2]??0)<<16|(e[t+3]??0)<<24)>>>0}function Xt(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e);let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(r=(r-55296)*1024+(o-56320)+65536,n++)}r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r<65536?t.push(224|r>>12,128|r>>6&63,128|r&63):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return new Uint8Array(t)}function fe(e,t){let n=e.length,r=0,o;if(n>=16){let a=t+O+W|0,i=t+W|0,c=t|0,u=t-O|0,p=n-16;do a=F(a,C(e,r)),i=F(i,C(e,r+4)),c=F(c,C(e,r+8)),u=F(u,C(e,r+12)),r+=16;while(r<=p);o=k(a,1)+k(i,7)+k(c,12)+k(u,18)|0}else o=t+le|0;for(o=o+n|0;r+4<=n;)o=Math.imul(k(o+Math.imul(C(e,r),de)|0,17),jt),r+=4;for(;r<n;)o=Math.imul(k(o+Math.imul(e[r]??0,le)|0,11),O),r++;return o^=o>>>15,o=Math.imul(o,W),o^=o>>>13,o=Math.imul(o,de),o^=o>>>16,o>>>0}function pe(e){return e.toString(16).padStart(8,"0")}function A(e){let t=typeof e=="string"?Xt(e):e;return pe(fe(t,0))+pe(fe(t,O))}var Kt=["fban/","fbav/","fb_iab","instagram","musical_ly","bytedancewebview","snapchat","linkedinapp","line/","micromessenger","pinterest/","gsa/"];function zt(){let e=globalThis;return{...typeof e.navigator?.userAgent=="string"?{userAgent:e.navigator.userAgent}:{},...typeof e.location?.protocol=="string"?{protocol:e.location.protocol}:{},window:globalThis}}function Qt(e){try{let t=e.Capacitor;if(t&&typeof t.isNativePlatform=="function"&&t.isNativePlatform()===!0)return"capacitor";if(e.cordova!==void 0||e._cordovaNative!==void 0)return"cordova";if(e.ReactNativeWebView!==void 0)return"react-native-webview";if(e.flutter_inappwebview!==void 0)return"flutter-webview"}catch{}}function Jt(e){let t=e.toLowerCase();if(t==="")return;if(t.includes("electron/"))return"electron";if(Kt.some(r=>t.includes(r)))return;if(t.includes("android")&&t.includes("; wv)"))return"android-webview";if(["iphone","ipad","ipod","macintosh"].some(r=>t.includes(r))&&t.includes("applewebkit/")&&!t.includes("safari/"))return"apple-webview"}function q(e=zt()){let t=(e.protocol??"").toLowerCase();if(t!==""&&!["http:","https:","about:","blob:"].includes(t))return"app-scheme";let n=e.window?Qt(e.window):void 0;return n||Jt(e.userAgent??"")}function f(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function s(e){try{return e()}catch{return}}function K(){return typeof window>"u"?void 0:window}function g(){let e=K();if(!e)throw new l("no-window");return e}function _e(e){throw e instanceof Error&&(e.name==="SecurityError"||e.name==="NotAllowedError"||e.name==="NotSupportedError")?new v(e.name):e}var Yt=/\{\s*\[native code\]\s*\}\s*$/,Zt=[["navigator","webdriver"],["navigator","userAgent"],["navigator","platform"],["navigator","plugins"],["navigator","mimeTypes"],["navigator","languages"],["navigator","language"],["navigator","hardwareConcurrency"],["navigator","deviceMemory"],["navigator","maxTouchPoints"],["navigator","vendor"],["navigator","appVersion"],["navigator","productSub"],["screen","width"],["screen","height"],["screen","availWidth"],["screen","availHeight"],["screen","colorDepth"]];function Ee(e){let t=[];for(let[o,a]of Zt){let i=o==="navigator"?e.navigator:e.screen;if(!i)continue;if(s(()=>Object.getOwnPropertyDescriptor(i,a))){t.push({id:`${o}.${a}`,kind:"descriptor",detail:"own-property-shadows-prototype"});continue}let u=s(()=>Object.getPrototypeOf(i));if(!u)continue;let p=s(()=>Object.getOwnPropertyDescriptor(u,a));if(!p?.get)continue;let m=s(()=>Function.prototype.toString.call(p.get));m!==void 0&&!Yt.test(m)&&t.push({id:`${o}.${a}.getter`,kind:"descriptor",detail:"getter-is-not-native"})}let n=s(()=>Object.getPrototypeOf(e.navigator));e.Navigator&&n!==void 0&&n!==e.Navigator.prototype&&t.push({id:"navigator",kind:"prototype",detail:"not-Navigator.prototype"});let r=s(()=>Object.getPrototypeOf(e.screen));return e.Screen&&r!==void 0&&r!==e.Screen.prototype&&t.push({id:"screen",kind:"prototype",detail:"not-Screen.prototype"}),t}var xe=/\{\s*\[native code\]\s*\}\s*$/,en=[["Function.prototype.toString",()=>Function.prototype.toString],["Function.prototype.bind",()=>Function.prototype.bind],["Object.getOwnPropertyDescriptor",()=>Object.getOwnPropertyDescriptor],["Object.defineProperty",()=>Object.defineProperty],["Date.prototype.getTimezoneOffset",()=>Date.prototype.getTimezoneOffset],["Number.prototype.toFixed",()=>Number.prototype.toFixed],["Error.prototype.toString",()=>Error.prototype.toString],["Intl.DateTimeFormat",()=>Intl?.DateTimeFormat],["Navigator.prototype.javaEnabled",e=>e.Navigator?.prototype?.javaEnabled],["Permissions.prototype.query",e=>e.Permissions?.prototype?.query],["MediaDevices.prototype.enumerateDevices",e=>e.MediaDevices?.prototype?.enumerateDevices],["HTMLCanvasElement.prototype.toDataURL",e=>e.HTMLCanvasElement?.prototype?.toDataURL],["CanvasRenderingContext2D.prototype.getImageData",e=>e.CanvasRenderingContext2D?.prototype?.getImageData],["WebGLRenderingContext.prototype.getParameter",e=>e.WebGLRenderingContext?.prototype?.getParameter],["WebGLRenderingContext.prototype.getExtension",e=>e.WebGLRenderingContext?.prototype?.getExtension],["AudioBuffer.prototype.getChannelData",e=>e.AudioBuffer?.prototype?.getChannelData],["Element.prototype.getBoundingClientRect",e=>e.Element?.prototype?.getBoundingClientRect],["Performance.prototype.now",e=>e.Performance?.prototype?.now],["Screen.prototype.constructor",e=>e.Screen]];function tn(){let e=Function.prototype.toString;if(typeof document>"u"||!document.body)return{fn:e,clean:!1};let t=s(()=>{let n=document.createElement("iframe");return n.setAttribute("sandbox","allow-same-origin"),n.style.display="none",document.body.appendChild(n),n});if(!t)return{fn:e,clean:!1};try{let n=s(()=>t.contentWindow?.Function?.prototype?.toString);return n?{fn:n,clean:!0}:{fn:e,clean:!1}}finally{t.remove()}}function Te(e){let t=[],n=[],{fn:r,clean:o}=tn(),a=i=>s(()=>r.call(i));for(let[i,c]of en){let u=s(()=>c(e));if(u==null){n.push({id:i,kind:"missing"});continue}if(typeof u!="function")continue;let p=a(u);p!==void 0&&(xe.test(p)||(t.push(i),n.push({id:i,kind:"not-native"})))}if(o){let i=Function.prototype.toString,c=a(i);c!==void 0&&!xe.test(c)&&(t.includes("Function.prototype.toString")||t.push("Function.prototype.toString"),n.push({id:"Function.prototype.toString",kind:"not-native",detail:"caught-via-fresh-realm"}))}return{patched:t,lies:n}}function I(e){let t=K(),n=ve({schema:1,budget_ms:0,elapsed_ms:0,tiers:[],sources:e,integrity:{patched_natives:[],lies:[],engine:{}}},d.engine),r={...n?.claimed===void 0?{}:{claimed:n.claimed},...n?.observed===void 0?{}:{observed:n.observed}};if(!t)return{patched_natives:[],lies:[],engine:r};let o=Te(t),a=Ee(t);return{patched_natives:o.patched,lies:[...o.lies,...a],engine:r}}function nn(){let e=globalThis,t=e.OfflineAudioContext??e.webkitOfflineAudioContext;if(!t)throw new l("no-offline-audio-context");return t}async function Me(e){let t=nn(),n=new t(1,5e3,44100),r=n.createOscillator();r.type="triangle",r.frequency.value=1e4;let o=n.createDynamicsCompressor();o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.25,r.connect(o),o.connect(n.destination),r.start(0);let i=(await new Promise((u,p)=>{e.signal.addEventListener("abort",()=>p(e.signal.reason),{once:!0}),n.oncomplete=m=>u(m.renderedBuffer);try{let m=n.startRendering();m&&typeof m.then=="function"&&m.then(u,p)}catch(m){p(m)}})).getChannelData(0),c=0;for(let u=4500;u<i.length;u++)c+=Math.abs(i[u]??0);return c}var ke={id:d.audio,tier:"deferred",timeoutMs:500,async run(e){let t=await Me(e);if(t===0)throw new v("audio-silent");let n=await Me(e);return f({value:t,unstable:t!==n,sample_rate:44100})}},Ae={id:d.audioLatency,tier:"deferred",timeoutMs:200,run(){let e=globalThis,t=e.AudioContext??e.webkitAudioContext;if(!t)throw new l("no-audio-context");let n=new t;try{return f({base_latency:s(()=>n.baseLatency),sample_rate:s(()=>n.sampleRate),state:s(()=>n.state)})}finally{s(()=>{n.close()})}}};var Ce={id:d.hardware,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator;return f({hardware_concurrency:s(()=>e.hardwareConcurrency),device_memory:s(()=>e.deviceMemory)})}},De={id:d.touch,tier:"fast",run(){let e=g();return f({max_touch_points:s(()=>navigator.maxTouchPoints),touch_event:s(()=>"ontouchstart"in e),touch_start:s(()=>(document.createEvent("TouchEvent"),!0)),pointer_coarse:s(()=>e.matchMedia?.("(pointer: coarse)").matches),any_hover:s(()=>e.matchMedia?.("(any-hover: hover)").matches),device_motion:s(()=>"DeviceMotionEvent"in e),device_orientation:s(()=>"DeviceOrientationEvent"in e)})}},Re={id:d.sensors,tier:"deferred",timeoutMs:150,async run(e){let t=g(),n="DeviceMotionEvent"in t,r="DeviceOrientationEvent"in t;if(!n&&!r)return f({device_motion:!1,device_orientation:!1});if(typeof document<"u"&&document.visibilityState==="hidden")return f({device_motion:n,device_orientation:r});let o=await new Promise(a=>{let i=!1,c=m=>{i||(i=!0,t.removeEventListener("devicemotion",u),clearTimeout(p),a(m))},u=()=>c(!0),p=setTimeout(()=>c(!1),100);e.signal.addEventListener("abort",()=>c(!1),{once:!0}),t.addEventListener("devicemotion",u,{once:!0})});return f({device_motion:n,device_orientation:r,motion_observed:o})}},Oe={id:d.mediaDevices,tier:"fast",timeoutMs:120,async run(){if(typeof navigator>"u")throw new l("no-navigator");if(typeof navigator.mediaDevices?.enumerateDevices!="function")throw new l("no-media-devices");let e=await navigator.mediaDevices.enumerateDevices();return f({audio_input:e.filter(t=>t.kind==="audioinput").length,audio_output:e.filter(t=>t.kind==="audiooutput").length,video_input:e.filter(t=>t.kind==="videoinput").length,labels_hidden:e.length>0&&e.every(t=>t.label==="")})}},Ne={id:d.network,tier:"fast",run(){let e=navigator.connection;if(!e)throw new l("no-network-information");return f({effective_type:s(()=>e.effectiveType),downlink:s(()=>e.downlink),rtt:s(()=>e.rtt),save_data:s(()=>e.saveData)})}},Pe={id:d.intl,tier:"fast",run(){if(typeof Intl>"u")throw new l("no-intl");let e=s(()=>new Intl.DateTimeFormat().resolvedOptions());return f({timezone:e?.timeZone,timezone_offset:s(()=>new Date().getTimezoneOffset()),locale:e?.locale,calendar:e?.calendar,numbering_system:e?.numberingSystem,formatted:s(()=>new Intl.DateTimeFormat(void 0,{dateStyle:"full",timeStyle:"full"}).format(new Date(0)))})}},Ie={id:d.timezone,tier:"fast",run(){if(typeof Intl>"u")throw new l("no-intl");return f({name:s(()=>new Intl.DateTimeFormat().resolvedOptions().timeZone),offset:s(()=>new Date().getTimezoneOffset())})}},Le={id:d.battery,tier:"deferred",timeoutMs:250,async run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator.getBattery;if(typeof e!="function")throw new l("no-battery-api");let t=await e.call(navigator),n=r=>r===void 0?void 0:Number.isFinite(r)?r:null;return f({charging:t.charging,charging_time:n(t.chargingTime),discharging_time:n(t.dischargingTime),level:t.level})}},Be={id:d.speech,tier:"deferred",timeoutMs:250,async run(e){if(typeof speechSynthesis>"u")throw new l("no-speech-synthesis");let t=speechSynthesis.getVoices();return t.length===0&&(t=await new Promise(n=>{let r=()=>{speechSynthesis.removeEventListener("voiceschanged",o),e.signal.removeEventListener("abort",a),n(speechSynthesis.getVoices())},o=()=>r(),a=()=>r();speechSynthesis.addEventListener("voiceschanged",o,{once:!0}),e.signal.addEventListener("abort",a,{once:!0}),setTimeout(r,Math.min(100,e.budgetRemainingMs()))})),{voices:t.map(n=>({name:n.name,language:n.lang,local_service:n.localService,default:n.default,uri:n.voiceURI}))}}};var Fe={id:d.screen,tier:"fast",run(){let e=g(),t=e.screen;return f({width:s(()=>t.width),height:s(()=>t.height),avail_width:s(()=>t.availWidth),avail_height:s(()=>t.availHeight),color_depth:s(()=>t.colorDepth),pixel_depth:s(()=>t.pixelDepth),device_pixel_ratio:s(()=>e.devicePixelRatio),orientation:s(()=>t.orientation?.type),inner_width:s(()=>e.innerWidth),inner_height:s(()=>e.innerHeight),frame:s(()=>[t.availTop??null,(t.width??0)-(t.availWidth??0)-(t.availLeft??0),(t.height??0)-(t.availHeight??0)-(t.availTop??0),t.availLeft??null])})}},z;function rn(e){let t=e.screen;return[t.availTop??null,(t.width??0)-(t.availWidth??0)-(t.availLeft??0),(t.height??0)-(t.availHeight??0)-(t.availTop??0),t.availLeft??null]}var Ue={id:d.screenFrame,tier:"fast",run(){let e=g(),t=rn(e),n=e.document?.fullscreenElement!=null,r=t.every(o=>o===0||o===null);return!n&&!r&&(z=t),{frame:n&&z?[...z]:t}}};function on(e,t,n){if(typeof e.matchMedia=="function"){for(let r=0;r<=n;r++)if(e.matchMedia(`(${t}: ${r})`).matches)return r}}function Q(e,t){if(typeof e.matchMedia=="function")return t.find(n=>e.matchMedia(n).matches)}var We={id:d.mediaQueries,tier:"fast",run(){let e=g();if(typeof e.matchMedia!="function")throw new l("no-match-media");let t=Q(e,["(color-gamut: rec2020)","(color-gamut: p3)","(color-gamut: srgb)"]),n=Q(e,["(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-contrast: no-preference)"]);return f({color_gamut:t?.match(/color-gamut:\s*(\w+)/)?.[1],inverted_colors:s(()=>e.matchMedia("(inverted-colors: inverted)").matches),forced_colors:s(()=>e.matchMedia("(forced-colors: active)").matches),monochrome:on(e,"monochrome",10),contrast:n?.match(/prefers-contrast:\s*([\w-]+)/)?.[1],reduced_motion:s(()=>e.matchMedia("(prefers-reduced-motion: reduce)").matches),reduced_transparency:s(()=>e.matchMedia("(prefers-reduced-transparency: reduce)").matches),hdr:s(()=>e.matchMedia("(dynamic-range: high)").matches)})}},qe={id:d.colorGamut,tier:"fast",run(){let e=g();if(typeof e.matchMedia!="function")throw new l("no-match-media");let n=Q(e,["(color-gamut: rec2020)","(color-gamut: p3)","(color-gamut: srgb)"])?.match(/color-gamut:\s*(\w+)/)?.[1];return n==="srgb"||n==="p3"||n==="rec2020"?{gamut:n}:{}}};var an=16384,sn=15,cn=9;var un=250,Ve=600;function dn(e){return new Promise((t,n)=>{let r=indexedDB.open(e,1);r.onupgradeneeded=()=>r.result.createObjectStore("s"),r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??new Error("indexeddb-open-failed")),r.onblocked=()=>n(new Error("indexeddb-open-blocked"))})}function ln(e){try{let t=e.transaction("s","readwrite",{durability:"strict"}),n=t.durability==="strict";return t.abort(),n}catch{return!1}}function V(e,t,n){return new Promise((r,o)=>{let a=performance.now(),i=0,c=()=>{if(i===sn){r(performance.now()-a);return}let u=e.transaction("s","readwrite",{durability:t});u.objectStore("s").put(n,i),i+=1,u.oncomplete=c,u.onerror=u.onabort=()=>o(u.error??new Error("indexeddb-write-failed"))};c()})}var Ge={id:d.storageDurability,tier:"deferred",timeoutMs:Ve+400,async run(e){if(g(),typeof indexedDB!="object"||indexedDB===null)throw new l("no-indexeddb");let t=e.completed(d.engine);if((t?.status==="ok"?t.value.observed:void 0)!=="chromium")throw new l("not-chromium");let r=`__fingerly_durability_${Math.random().toString(36).slice(2)}`,o=new Uint8Array(an),a;try{if(a=await dn(r),!ln(a))return{honored:!1};await V(a,"relaxed",o),await V(a,"strict",o);let i=performance.now(),c=i+Math.min(Ve,Math.max(0,e.budgetRemainingMs()-un)),u=[];for(;u.length<cn&&!e.signal.aborted;){if(u.length>0){let _=(performance.now()-i)/u.length;if(performance.now()+_>c)break}let p=await V(a,"relaxed",o),m=await V(a,"strict",o);if(p>0)u.push(m/p);else break}return u.length===0?{honored:!0,rounds:0}:(u.sort((p,m)=>p-m),f({ratio:u[u.length>>1],rounds:u.length,honored:!0}))}finally{try{a?.close(),indexedDB.deleteDatabase(r)}catch{}}}};var He=[["easylist",".ad_300x250",".textads"],["easylist_germany",".werbung1",".werbeblock"],["easylist_italy",".pubbl",".banner_pubblicita"],["easylist_dutch",".advertentie-container",".reclame"],["easyprivacy",".trackingpixel","#tracking-pixel"],["fanboy_annoyances","#newsletter-signup-modal",".cookie-consent-banner"],["fanboy_social",".social-share-buttons",".facebook-like-box"],["adguard_base","#adsense_widget",".adsbygoogle-container"],["adguard_annoyances",".push-notification-prompt","#app-install-banner"],["listekr","#ad_wrapper_top",".ad_zone"],["liste_fr",".pub_300x250","#pubfooter"],["ro_list",".reclama-mare","#reclama"]],fn=60;function pn(){return new Promise(e=>{let t=!1,n=()=>{t||(t=!0,e())};setTimeout(n,fn),typeof requestAnimationFrame=="function"&&requestAnimationFrame(()=>setTimeout(n,0))})}function $e(e){if(e.offsetParent===null||e.offsetHeight===0||e.offsetWidth===0)return!0;let t=getComputedStyle(e);return t.display==="none"||t.visibility==="hidden"}function je(e,t){let n=e.createElement("div");return t.startsWith("#")?n.id=t.slice(1):n.className=t.slice(1),n.style.position="absolute",n.style.top="-9999px",n.style.left="-9999px",n.style.width="1px",n.style.height="1px",n}var Xe={id:d.domBlockers,tier:"deferred",timeoutMs:300,async run(){if(g(),typeof document>"u"||!document.body)throw new l("no-document-body");let e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.style.width="1px",e.style.height="1px";let t=je(document,".fingerly-control-element");e.appendChild(t);let n=He.map(([r,...o])=>({name:r,nodes:o.map(a=>{let i=je(document,a);return e.appendChild(i),i})}));document.body.appendChild(e);try{if(await pn(),$e(t))return{};let r=n.filter(({nodes:o})=>o.some($e)).map(({name:o})=>o);return f({blocked:r,probed:He.length})}finally{e.remove()}}};function mn(){return s(()=>{try{(-1).toFixed(-1)}catch(e){return e instanceof Error?e.message.length:void 0}})}function gn(){return s(()=>eval.toString().length)}function hn(){return s(()=>{let e=new Error("probe").stack;if(!(typeof e!="string"||e===""))return e.includes(" at ")?"v8":/^@|\n@|^\w*@/m.test(e)?e.includes("global code")?"javascriptcore":"spidermonkey":"unknown"})}function yn(e,t,n){let r=[];if(e===51?r.push("chromium"):e===43||e===44?r.push("webkit"):e===25&&r.push("gecko"),t===33&&r.push("chromium"),n==="v8"?r.push("chromium"):n==="javascriptcore"?r.push("webkit"):n==="spidermonkey"&&r.push("gecko"),r.length===0)return;let o=new Map;for(let c of r)o.set(c,(o.get(c)??0)+1);let a,i=0;for(let[c,u]of o)u>i&&(i=u,a=c);return a}function Sn(e){if(e){if(/Firefox\//.test(e))return"gecko";if(/Edg\/|OPR\/|Chrome\/|Chromium\//.test(e))return"chromium";if(/Safari\//.test(e))return"webkit"}}var Ke={id:d.engine,tier:"fast",run(){let e=mn(),t=gn(),n=hn(),r=yn(e,t,n),o=Sn(typeof navigator>"u"?void 0:navigator.userAgent);return f({to_fixed_error_length:e,eval_length:t,stack_style:n,observed:r,claimed:o})}},bn=[["acos",()=>Math.acos(.12312423423423424)],["acosh",()=>Math.acosh(1e308)],["asin",()=>Math.asin(.12312423423423424)],["asinh",()=>Math.asinh(1)],["atan",()=>Math.atan(.5)],["atanh",()=>Math.atanh(.5)],["cbrt",()=>Math.cbrt(100)],["cos",()=>Math.cos(10.000000000123)],["cosh",()=>Math.cosh(1)],["exp",()=>Math.exp(1)],["expm1",()=>Math.expm1(1)],["log",()=>Math.log(10)],["log1p",()=>Math.log1p(10)],["pow",()=>Math.pow(Math.PI,-100)],["sin",()=>Math.sin(1e300)],["sinh",()=>Math.sinh(1)],["sqrt",()=>Math.sqrt(2)],["tan",()=>Math.tan(-1e300)],["tanh",()=>Math.tanh(1)]];function wn(){return Object.is(Math.sin(0),0)&&Math.cos(0)===1&&Math.sqrt(4)===2&&Math.log(1)===0&&Math.pow(2,10)===1024}var ze={id:d.math,tier:"fast",timeoutMs:50,run(){let e=[],t=0,n=new Map;for(let[r,o]of bn){let a=s(o);typeof a=="number"&&Number.isFinite(a)?(t+=1,n.set(r,a),e.push(`${r}:${a}`)):e.push(`${r}:`)}return f({hash:A(e.join("|")),probed:t,atanh_half:n.get("atanh"),expm1_1:n.get("expm1"),identities_hold:s(wn)})}};function L(e){return s(()=>{try{e()}catch(t){return t instanceof EvalError?void 0:t instanceof Error?t.message.length:void 0}})}function vn(){try{return new Function(""),!0}catch{return!1}}function _n(e){let t=[],n=e.own_properties;if(n!==void 0&&(n.includes("sourceURL")?t.push("webkit","webkit"):n.includes("lineNumber")?t.push("gecko","gecko"):n==="message,stack"&&t.push("chromium","chromium")),e.null_property_length===44?t.push("chromium"):e.null_property_length===33&&t.push("gecko"),e.syntax_length===20?t.push("chromium"):e.syntax_length===28&&t.push("gecko"),t.length===0)return;let r=new Map;for(let c of t)r.set(c,(r.get(c)??0)+1);let o,a=0,i=!1;for(let[c,u]of r)u>a?(a=u,o=c,i=!1):u===a&&(i=!0);return i?void 0:o}function En(){return s(()=>{try{throw new Error("probe")}catch(e){return Object.getOwnPropertyNames(e).sort().join(",")}})}var Qe={id:d.errors,tier:"fast",timeoutMs:50,run(){let e=vn(),t=f({null_property_length:L(()=>null.x),syntax_length:e?L(()=>new Function("!")):void 0,json_parse_length:L(()=>JSON.parse("{")),invalid_array_length:L(()=>{let n=[];n.length=-1}),const_assign_length:e?L(()=>{new Function("const c = 1; c = 2")()}):void 0,own_properties:En(),capture_stack_trace:s(()=>typeof Error.captureStackTrace=="function"),stack_trace_limit:s(()=>"stackTraceLimit"in Error)});return f({...t,observed:_n(t)})}};var Je={id:d.navigator,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator;return f({user_agent:s(()=>e.userAgent),platform:s(()=>e.platform),vendor:s(()=>e.vendor),product_sub:s(()=>e.productSub),app_version:s(()=>e.appVersion),hardware_concurrency:s(()=>e.hardwareConcurrency),device_memory:s(()=>e.deviceMemory),max_touch_points:s(()=>e.maxTouchPoints),webdriver:s(()=>e.webdriver),cookie_enabled:s(()=>e.cookieEnabled),pdf_viewer_enabled:s(()=>e.pdfViewerEnabled),do_not_track:s(()=>e.doNotTrack),plugin_count:s(()=>e.plugins?.length),mime_type_count:s(()=>e.mimeTypes?.length),language:s(()=>e.language),languages:s(()=>e.languages?[...e.languages]:void 0)})}},Ye={id:d.languages,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");return f({primary:s(()=>navigator.language),accepted:s(()=>navigator.languages?[...navigator.languages]:void 0)})}},Ze={id:d.vendor,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");return f({vendor:s(()=>navigator.vendor)})}},et={id:d.plugins,tier:"fast",run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator.plugins;if(!e)throw new l("no-plugins");return{plugins:Array.from(e,t=>({name:t.name,filename:t.filename,description:t.description,mime_types:Array.from(t,n=>({type:n.type,suffixes:n.suffixes,description:n.description}))}))}}},tt={id:d.userAgentData,tier:"deferred",timeoutMs:200,async run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator.userAgentData;if(!e)throw new l("no-user-agent-data");let t=f({brands:e.brands,mobile:e.mobile,platform:e.platform});if(typeof e.getHighEntropyValues!="function")return t;let n=await e.getHighEntropyValues(["architecture","bitness","model","platformVersion","fullVersionList","wow64"]);return{...t,...n}}};function J(e,t){let n=document.createElement("canvas");n.width=e,n.height=t;let r=n.getContext("2d");if(!r)throw new l("no-2d-context");return[n,r]}function nt(){let[e,t]=J(240,60);t.globalCompositeOperation="multiply";for(let[n,r,o]of[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]])t.fillStyle=n,t.beginPath(),t.arc(r,o,40,0,Math.PI*2,!0),t.closePath(),t.fill();return t.fillStyle="#f9c",t.arc(100,50,50,0,Math.PI*2,!0),t.arc(100,50,20,0,Math.PI*2,!0),t.fill("evenodd"),e.toDataURL()}function rt(){let[e,t]=J(300,60);return t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"',t.fillText("Fingerly <canvas> 1.0 \u{1F512}\u0416\u4E2D",2,15),t.font="18pt Arial",t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText("Fingerly <canvas> 1.0",4,45),e.toDataURL()}function xn(){let[,e]=J(1,1);return e.rect(0,0,10,10),e.rect(2,2,6,6),e.isPointInPath(5,5,"evenodd")===!1}function Tn(e){let t=e.completed(d.timing);if(t?.status!=="ok")return!1;let n=t.value?.now_resolution;return typeof n=="number"&&n>=16}var ot={id:d.canvas,tier:"deferred",timeoutMs:400,run(e){if(g(),typeof document>"u")throw new l("no-document");if(Tn(e))throw new v("rfp-canvas-prompt-avoided");try{let t=nt(),n=nt(),r=rt(),o=rt(),a=t!==n||r!==o;return f({geometry:A(t),text:A(r),winding:s(xn),unstable:a})}catch(t){_e(t)}}};function it(){if(typeof document>"u")throw new l("no-document");let e=document.createElement("canvas"),t=e.getContext("webgl")??e.getContext("experimental-webgl");if(!t)throw new l("no-webgl-context");return t}var at={id:d.webgl,tier:"fast",timeoutMs:400,run(){let e=it(),t=s(()=>e.getExtension("WEBGL_debug_renderer_info")),n={};for(let o of["MAX_TEXTURE_SIZE","MAX_VIEWPORT_DIMS","MAX_VERTEX_ATTRIBS","MAX_VARYING_VECTORS","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_RENDERBUFFER_SIZE","MAX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS","ALIASED_LINE_WIDTH_RANGE","ALIASED_POINT_SIZE_RANGE","RED_BITS","GREEN_BITS","BLUE_BITS","ALPHA_BITS","DEPTH_BITS","STENCIL_BITS"]){let a=e[o];if(typeof a!="number")continue;let i=s(()=>e.getParameter(a));i!=null&&(n[o]=ArrayBuffer.isView(i)?Array.from(i):i)}let r=[];for(let o of[e.VERTEX_SHADER,e.FRAGMENT_SHADER])for(let a of[e.LOW_FLOAT,e.MEDIUM_FLOAT,e.HIGH_FLOAT]){let i=s(()=>e.getShaderPrecisionFormat(o,a));i&&r.push(i.rangeMin,i.rangeMax,i.precision)}return f({vendor:s(()=>e.getParameter(e.VENDOR)),renderer:s(()=>e.getParameter(e.RENDERER)),unmasked_vendor:t?s(()=>e.getParameter(t.UNMASKED_VENDOR_WEBGL)):void 0,unmasked_renderer:t?s(()=>e.getParameter(t.UNMASKED_RENDERER_WEBGL)):void 0,version:s(()=>e.getParameter(e.VERSION)),shading_language_version:s(()=>e.getParameter(e.SHADING_LANGUAGE_VERSION)),max_texture_size:s(()=>e.getParameter(e.MAX_TEXTURE_SIZE)),max_render_buffer_size:s(()=>e.getParameter(e.MAX_RENDERBUFFER_SIZE)),parameters_hash:Object.keys(n).length>0?A(JSON.stringify(n)):void 0,shader_precision_hash:r.length>0?A(r.join(",")):void 0})}},st={id:d.webglExtensions,tier:"deferred",timeoutMs:200,run(){let t=it().getSupportedExtensions();if(!t)throw new v("extensions-withheld");return[...t].sort()}};function Mn(e){let t=[],n=Date.now()+12;for(;t.length<25&&Date.now()<n;){let r=e(),o=e(),a=0;for(;o===r&&a++<1e5&&Date.now()<n;)o=e();o!==r&&t.push(o-r)}return t.length===0?100:Math.round(Math.min(...t)*1e6)/1e6}var ut={id:d.timing,tier:"fast",timeoutMs:150,run(){let t=g().performance;return typeof t?.now!="function"?f({has_performance:!1}):f({has_performance:!0,now_resolution:Mn(()=>t.now())})}},ct=new WeakMap;function kn(e,t){let n=ct.get(e.navigator);n||(n=new Map,ct.set(e.navigator,n));let r=n.get(t);return r||(r=e.navigator.permissions.query({name:t}),n.set(t,r)),r}var dt={id:d.permissions,tier:"fast",timeoutMs:200,async run(){let e=g();if(!e.navigator.permissions?.query)throw new l("no-permissions-api");let t=async o=>{try{return(await kn(e,o)).state}catch{return}},n=await t("notifications"),r=s(()=>e.Notification?.permission);return f({notification:n,notification_legacy:r,geolocation:await t("geolocation")})}},An=["__nightmare","_phantom","callPhantom","__phantomas","Buffer","emit","spawn","__selenium_evaluate","__selenium_unwrapped","__webdriver_evaluate","__webdriver_script_fn","__webdriver_script_func","__webdriver_unwrapped","__fxdriver_evaluate","__fxdriver_unwrapped","__driver_evaluate","__driver_unwrapped","_Selenium_IDE_Recorder","domAutomation","domAutomationController","__lastWatirAlert","__playwright","__puppeteer","__pw_manual"],lt={id:d.automation,tier:"fast",run(){let e=g(),t=An.filter(r=>s(()=>r in e)===!0),n=s(()=>Object.getOwnPropertyNames(e).filter(r=>/^cdc_|^\$cdc_/.test(r)));return f({webdriver:s(()=>navigator.webdriver),cdp_artifacts:n&&n.length>0?n:void 0,distinctive_properties:t.length>0?[...t]:void 0,chrome_object:s(()=>"chrome"in e),window_external:s(()=>{let r=e.external;return r?String(r):void 0})})}};var Cn=50,ft=Symbol("timed-out");async function Dn(e){if(typeof e.brave?.isBrave=="function")try{let t=await Promise.race([e.brave.isBrave(),new Promise(n=>setTimeout(()=>n(ft),Cn))]);return t===ft?void 0:t===!0}catch{return}}function Rn(e){let t=e.userAgentData?.brands;if(Array.isArray(t))return t.some(n=>n?.brand==="Brave")}var pt=[[30,60,90],[210,180,140]],b=8;function On(){if(!(typeof document>"u"))try{let e=document.createElement("canvas");e.width=b,e.height=b;let t=e.getContext("2d",{willReadFrequently:!0});if(!t)return;for(let r=0;r<b;r++)for(let o=0;o<b;o++){let[a,i,c]=pt[(o+r)%2];t.fillStyle=`rgb(${a}, ${i}, ${c})`,t.fillRect(o,r,1,1)}let n=t.getImageData(0,0,b,b).data;for(let r=0;r<b*b;r++){let o=r%b,a=Math.floor(r/b),[i,c,u]=pt[(o+a)%2],p=r*4;if(n[p]!==i||n[p+1]!==c||n[p+2]!==u||n[p+3]!==255)return!0}return!1}catch{return}}var mt={id:d.shields,tier:"fast",timeoutMs:100,async run(){if(typeof navigator>"u")throw new l("no-navigator");let e=navigator;return f({brave:await Dn(e),brave_claimed:Rn(e),canvas_noise:On()})}};function gt(e){try{let t=window[e];if(!t)return!1;let n="__fingerly_probe__";return t.setItem(n,"1"),t.removeItem(n),!0}catch{return!1}}function Nn(){try{return typeof window.indexedDB=="object"&&window.indexedDB!==null}catch{return!1}}function Pn(e){let t=e instanceof Error?e.name:"",n=e instanceof Error?e.message:String(e);return n.includes("unknown transient reason")?"transient":t==="SecurityError"||n.includes("Security error")?"refused":"failed"}var In=200;async function Ln(){let e=navigator.storage;if(typeof e?.getDirectory=="function")return Promise.race([e.getDirectory().then(()=>"ok",t=>Pn(t)),new Promise(t=>setTimeout(t,In))])}var Bn=150;function Fn(){let e=navigator.webkitTemporaryStorage;return typeof e?.queryUsageAndQuota!="function"?Promise.resolve(void 0):new Promise(t=>{let n=!1,r=o=>{n||(n=!0,t(o))};setTimeout(()=>r(void 0),Bn);try{e.queryUsageAndQuota((o,a)=>r(typeof a=="number"?a:void 0),()=>r(void 0))}catch{r(void 0)}})}function Un(){if(window.isSecureContext)return"serviceWorker"in navigator}var ht={id:d.storage,tier:"fast",timeoutMs:250,async run(){g();let e=s(async()=>{if(typeof navigator.storage?.estimate!="function")return;let u=await navigator.storage.estimate();return{quota:u.quota,usage:u.usage}}),t=Fn(),n=Ln(),[r,o,a]=await Promise.all([e,t,n]),i=r?.quota,c=navigator.deviceMemory;return f({local_storage:gt("localStorage"),session_storage:gt("sessionStorage"),indexed_db:Nn(),quota:i,usage:r?.usage,legacy_quota:o,quota_ratio:typeof i=="number"&&typeof c=="number"&&c>0?i/(c*1024*1024*1024):void 0,origin_filesystem:a,service_worker:Un()})}},yt={id:d.storageQuota,tier:"fast",run(){if(g(),typeof document>"u")throw new l("no-document");return{partitioned:typeof document.hasStorageAccess=="function"}}};var St=["monospace","sans-serif","serif"],Wn="72px",qn="mmmmmmmmmmlli WwMmIi 0123",Y=["Arial","Arial Black","Calibri","Cambria","Candara","Comic Sans MS","Consolas","Constantia","Corbel","Courier New","Ebrima","Franklin Gothic","Gabriola","Georgia","Impact","Lucida Console","Lucida Sans Unicode","Malgun Gothic","Marlett","Microsoft Himalaya","MS Gothic","MV Boli","Nirmala UI","Palatino Linotype","Segoe UI","Segoe UI Emoji","Sylfaen","Tahoma","Times New Roman","Trebuchet MS","Verdana","Webdings","Wingdings","American Typewriter","Andale Mono","Apple Chancery","Arial Hebrew","Avenir","Avenir Next","Baskerville","Big Caslon","Bodoni 72","Chalkboard","Cochin","Copperplate","Didot","Futura","Geneva","Gill Sans","Helvetica","Helvetica Neue","Herculanum","Hoefler Text","Lucida Grande","Luminari","Menlo","Monaco","Optima","Papyrus","Phosphate","Rockwell","SF Pro","Skia","Snell Roundhand","Trattatello","Zapfino","Cantarell","DejaVu Sans","DejaVu Serif","FreeSans","Liberation Sans","Liberation Serif","Nimbus Sans","Noto Sans","Ubuntu","Ubuntu Mono","Droid Sans","Roboto","Roboto Condensed","Bahnschrift","Bookshelf Symbol 7","Cascadia Code","Fira Code","HoloLens MDL2 Assets","Inter","JetBrains Mono","MT Extra","Source Code Pro","Wingdings 2","Wingdings 3"],bt={id:d.fonts,tier:"deferred",timeoutMs:700,run(){if(typeof document>"u")throw new l("no-document");let e=document.createElement("div");e.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden;width:auto;height:auto;margin:0;padding:0;white-space:nowrap;";let t=o=>{let a=document.createElement("span");return a.style.cssText=`position:absolute;font-size:${Wn};margin:0;padding:0;font-family:${o};`,a.textContent=qn,e.appendChild(a),a},n=St.map(o=>t(o)),r=Y.map(o=>St.map(a=>t(`'${o}',${a}`)));document.body.appendChild(e);try{let o=n.map(c=>c.offsetWidth),a=n.map(c=>c.offsetHeight),i=[];return Y.forEach((c,u)=>{let p=r[u];if(!p)return;p.every((_,y)=>{let E=o[y],x=a[y];return _.offsetWidth!==E||_.offsetHeight!==x})&&i.push(c)}),f({available:i,probed:Y.length})}finally{e.remove()}}},wt={id:d.fontPreferences,tier:"deferred",timeoutMs:250,run(){if(typeof document>"u"||!document.body)throw new l("no-document-body");let e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;border:0",document.body.appendChild(e);try{let t=e.contentDocument;if(!t?.body)throw new l("no-frame-document");let n="mmMwWLliI0O&1",r={default:"",serif:"serif",sans:"sans-serif",mono:"monospace",system:"system-ui",apple:"-apple-system",min:"Arial, sans-serif"},o={};for(let[a,i]of Object.entries(r)){let c=t.createElement("span");c.textContent=n,c.style.cssText=`font:72px ${i||"initial"};white-space:nowrap;position:absolute`,t.body.appendChild(c),o[a]=Math.round(c.getBoundingClientRect().width*1e3)/1e3}return{widths:o}}finally{e.remove()}}};function Vn(e){return{...e,run:t=>{if(q())throw new l("embedded");return e.run(t)}}}var Gn=[Ke,Qe,ze,Je,Ye,et,Ze,Fe,Ue,We,qe,Ce,De,Ne,Pe,Ie,ht,yt,mt,ut,dt,lt,at,Oe,ot,st,ke,Ae,bt,wt,Le,Be,Re,tt,Xe,Ge],B=Gn.map(Vn);function vt(e){return new Promise(t=>t(new P({...e,platform:"web",sources:e.sources??B,integrity:n=>I(n.sources),embedding:()=>q()})))}return kt(Hn);})();
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
3
3
|
var core = require('@fingerly/core');
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
|
+
|
|
7
|
+
// src/embedding.ts
|
|
8
|
+
var THIRD_PARTY_IN_APP_BROWSERS = [
|
|
9
|
+
"fban/",
|
|
10
|
+
"fbav/",
|
|
11
|
+
"fb_iab",
|
|
12
|
+
"instagram",
|
|
13
|
+
"musical_ly",
|
|
14
|
+
"bytedancewebview",
|
|
15
|
+
"snapchat",
|
|
16
|
+
"linkedinapp",
|
|
17
|
+
"line/",
|
|
18
|
+
"micromessenger",
|
|
19
|
+
"pinterest/",
|
|
20
|
+
"gsa/"
|
|
21
|
+
];
|
|
22
|
+
function pageEnvironment() {
|
|
23
|
+
const g = globalThis;
|
|
24
|
+
return {
|
|
25
|
+
...typeof g.navigator?.userAgent === "string" ? { userAgent: g.navigator.userAgent } : {},
|
|
26
|
+
...typeof g.location?.protocol === "string" ? { protocol: g.location.protocol } : {},
|
|
27
|
+
window: globalThis
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function bridgeOf(win) {
|
|
31
|
+
try {
|
|
32
|
+
const capacitor = win["Capacitor"];
|
|
33
|
+
if (capacitor && typeof capacitor.isNativePlatform === "function" && capacitor.isNativePlatform() === true) {
|
|
34
|
+
return "capacitor";
|
|
35
|
+
}
|
|
36
|
+
if (win["cordova"] !== void 0 || win["_cordovaNative"] !== void 0) return "cordova";
|
|
37
|
+
if (win["ReactNativeWebView"] !== void 0) return "react-native-webview";
|
|
38
|
+
if (win["flutter_inappwebview"] !== void 0) return "flutter-webview";
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
function userAgentEmbedding(userAgent) {
|
|
44
|
+
const ua = userAgent.toLowerCase();
|
|
45
|
+
if (ua === "") return void 0;
|
|
46
|
+
if (ua.includes("electron/")) return "electron";
|
|
47
|
+
if (THIRD_PARTY_IN_APP_BROWSERS.some((needle) => ua.includes(needle))) return void 0;
|
|
48
|
+
if (ua.includes("android") && ua.includes("; wv)")) return "android-webview";
|
|
49
|
+
const appleDevice = ["iphone", "ipad", "ipod", "macintosh"].some((device) => ua.includes(device));
|
|
50
|
+
if (appleDevice && ua.includes("applewebkit/") && !ua.includes("safari/")) return "apple-webview";
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
function detectEmbedding(environment = pageEnvironment()) {
|
|
54
|
+
const protocol = (environment.protocol ?? "").toLowerCase();
|
|
55
|
+
if (protocol !== "" && !["http:", "https:", "about:", "blob:"].includes(protocol)) return "app-scheme";
|
|
56
|
+
const bridge = environment.window ? bridgeOf(environment.window) : void 0;
|
|
57
|
+
if (bridge) return bridge;
|
|
58
|
+
return userAgentEmbedding(environment.userAgent ?? "");
|
|
59
|
+
}
|
|
6
60
|
function compact(value) {
|
|
7
61
|
const out = {};
|
|
8
62
|
for (const [key, entry] of Object.entries(value)) {
|
|
@@ -1728,7 +1782,16 @@ var fontPreferencesSource = {
|
|
|
1728
1782
|
};
|
|
1729
1783
|
|
|
1730
1784
|
// src/sources/index.ts
|
|
1731
|
-
|
|
1785
|
+
function guarded(source) {
|
|
1786
|
+
return {
|
|
1787
|
+
...source,
|
|
1788
|
+
run: (ctx) => {
|
|
1789
|
+
if (detectEmbedding()) throw new core.UnsupportedSignal("embedded");
|
|
1790
|
+
return source.run(ctx);
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
var allBrowserSources = [
|
|
1732
1795
|
// fast
|
|
1733
1796
|
engineSource,
|
|
1734
1797
|
errorsSource,
|
|
@@ -1768,6 +1831,7 @@ var browserSources = [
|
|
|
1768
1831
|
domBlockersSource,
|
|
1769
1832
|
storageDurabilitySource
|
|
1770
1833
|
];
|
|
1834
|
+
var browserSources = allBrowserSources.map(guarded);
|
|
1771
1835
|
function load(options) {
|
|
1772
1836
|
return new Promise(
|
|
1773
1837
|
(resolve) => resolve(
|
|
@@ -1775,7 +1839,10 @@ function load(options) {
|
|
|
1775
1839
|
...options,
|
|
1776
1840
|
platform: "web",
|
|
1777
1841
|
sources: options.sources ?? browserSources,
|
|
1778
|
-
integrity: (report) => inspectIntegrity(report.sources)
|
|
1842
|
+
integrity: (report) => inspectIntegrity(report.sources),
|
|
1843
|
+
// After the caller's options, so nothing passed to load() can turn
|
|
1844
|
+
// detection off: there is no supported way to fingerprint in an app.
|
|
1845
|
+
embedding: () => detectEmbedding()
|
|
1779
1846
|
})
|
|
1780
1847
|
)
|
|
1781
1848
|
);
|
|
@@ -1802,5 +1869,6 @@ Object.defineProperty(exports, "isSuspiciousLevel", {
|
|
|
1802
1869
|
get: function () { return core.isSuspiciousLevel; }
|
|
1803
1870
|
});
|
|
1804
1871
|
exports.browserSources = browserSources;
|
|
1872
|
+
exports.detectEmbedding = detectEmbedding;
|
|
1805
1873
|
exports.inspectIntegrity = inspectIntegrity;
|
|
1806
1874
|
exports.load = load;
|
package/dist/index.d.cts
CHANGED
|
@@ -12,6 +12,38 @@ export { Confidence, ConsentError, ConsentState, FingerlyClient, FingerlyEvent,
|
|
|
12
12
|
|
|
13
13
|
declare const browserSources: readonly Source[];
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Is this page running inside an app?
|
|
17
|
+
*
|
|
18
|
+
* A page inside a customer's own app is the app reading the device. Apple's
|
|
19
|
+
* agreement forbids an app to "derive any data from a device for the purpose
|
|
20
|
+
* of uniquely identifying it", naming the properties of a web browser among
|
|
21
|
+
* that data, so the browser SDK collects nothing there. Use the iOS or Android
|
|
22
|
+
* SDK in an app instead.
|
|
23
|
+
*
|
|
24
|
+
* The rules are the table in the server's ADR 0024 (Appendix B), which the
|
|
25
|
+
* server applies to every report as well. Rows shared with the server are
|
|
26
|
+
* copied literally into `tests/embedding.test.ts`; change both together.
|
|
27
|
+
*
|
|
28
|
+
* Reading the user agent, `location` and a few globals is itself a read of the
|
|
29
|
+
* device, so this runs only once consent is granted, from `identify()` and
|
|
30
|
+
* `collect()` and the guarded sources.
|
|
31
|
+
*/
|
|
32
|
+
/** What the page can see of where it runs. Defaults to the real page. */
|
|
33
|
+
interface EmbeddingEnvironment {
|
|
34
|
+
userAgent?: string;
|
|
35
|
+
protocol?: string;
|
|
36
|
+
window?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The kind of app this page runs in, or undefined in a browser.
|
|
40
|
+
*
|
|
41
|
+
* Order: the page's own scheme, then a bridge, then the user agent. The first
|
|
42
|
+
* two are checked before the third-party exception, because either proves the
|
|
43
|
+
* page belongs to the customer's app.
|
|
44
|
+
*/
|
|
45
|
+
declare function detectEmbedding(environment?: EmbeddingEnvironment): string | undefined;
|
|
46
|
+
|
|
15
47
|
/**
|
|
16
48
|
* The tamper layer.
|
|
17
49
|
*
|
|
@@ -56,7 +88,7 @@ declare function inspectIntegrity(sources: Record<string, SignalOutcome>): Integ
|
|
|
56
88
|
* submits; the server scores.
|
|
57
89
|
*/
|
|
58
90
|
|
|
59
|
-
interface FingerlyOptions extends Omit<FingerlyClientOptions, 'sources' | 'integrity' | 'platform'> {
|
|
91
|
+
interface FingerlyOptions extends Omit<FingerlyClientOptions, 'sources' | 'integrity' | 'platform' | 'embedding'> {
|
|
60
92
|
/**
|
|
61
93
|
* Replace the source set. Intended for tests and for a caller who has a
|
|
62
94
|
* reason to run a subset; the default is every browser source.
|
|
@@ -76,8 +108,8 @@ interface FingerlyOptions extends Omit<FingerlyClientOptions, 'sources' | 'integ
|
|
|
76
108
|
* source runs until `identify()` or `collect()` is called, and those refuse
|
|
77
109
|
* while consent is not `granted`. Consent defaults to `pending`, so a page can
|
|
78
110
|
* load early and call `setConsent('granted')` from its consent tool, or pass
|
|
79
|
-
* `consent: 'granted'` once it already has consent (or
|
|
111
|
+
* `consent: 'granted'` once it already has consent (or know none is required here; see docs/privacy.md §4).
|
|
80
112
|
*/
|
|
81
113
|
declare function load(options: FingerlyOptions): Promise<FingerlyClient>;
|
|
82
114
|
|
|
83
|
-
export { type FingerlyOptions, browserSources, inspectIntegrity, load };
|
|
115
|
+
export { type FingerlyOptions, browserSources, detectEmbedding, inspectIntegrity, load };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,38 @@ export { Confidence, ConsentError, ConsentState, FingerlyClient, FingerlyEvent,
|
|
|
12
12
|
|
|
13
13
|
declare const browserSources: readonly Source[];
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Is this page running inside an app?
|
|
17
|
+
*
|
|
18
|
+
* A page inside a customer's own app is the app reading the device. Apple's
|
|
19
|
+
* agreement forbids an app to "derive any data from a device for the purpose
|
|
20
|
+
* of uniquely identifying it", naming the properties of a web browser among
|
|
21
|
+
* that data, so the browser SDK collects nothing there. Use the iOS or Android
|
|
22
|
+
* SDK in an app instead.
|
|
23
|
+
*
|
|
24
|
+
* The rules are the table in the server's ADR 0024 (Appendix B), which the
|
|
25
|
+
* server applies to every report as well. Rows shared with the server are
|
|
26
|
+
* copied literally into `tests/embedding.test.ts`; change both together.
|
|
27
|
+
*
|
|
28
|
+
* Reading the user agent, `location` and a few globals is itself a read of the
|
|
29
|
+
* device, so this runs only once consent is granted, from `identify()` and
|
|
30
|
+
* `collect()` and the guarded sources.
|
|
31
|
+
*/
|
|
32
|
+
/** What the page can see of where it runs. Defaults to the real page. */
|
|
33
|
+
interface EmbeddingEnvironment {
|
|
34
|
+
userAgent?: string;
|
|
35
|
+
protocol?: string;
|
|
36
|
+
window?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The kind of app this page runs in, or undefined in a browser.
|
|
40
|
+
*
|
|
41
|
+
* Order: the page's own scheme, then a bridge, then the user agent. The first
|
|
42
|
+
* two are checked before the third-party exception, because either proves the
|
|
43
|
+
* page belongs to the customer's app.
|
|
44
|
+
*/
|
|
45
|
+
declare function detectEmbedding(environment?: EmbeddingEnvironment): string | undefined;
|
|
46
|
+
|
|
15
47
|
/**
|
|
16
48
|
* The tamper layer.
|
|
17
49
|
*
|
|
@@ -56,7 +88,7 @@ declare function inspectIntegrity(sources: Record<string, SignalOutcome>): Integ
|
|
|
56
88
|
* submits; the server scores.
|
|
57
89
|
*/
|
|
58
90
|
|
|
59
|
-
interface FingerlyOptions extends Omit<FingerlyClientOptions, 'sources' | 'integrity' | 'platform'> {
|
|
91
|
+
interface FingerlyOptions extends Omit<FingerlyClientOptions, 'sources' | 'integrity' | 'platform' | 'embedding'> {
|
|
60
92
|
/**
|
|
61
93
|
* Replace the source set. Intended for tests and for a caller who has a
|
|
62
94
|
* reason to run a subset; the default is every browser source.
|
|
@@ -76,8 +108,8 @@ interface FingerlyOptions extends Omit<FingerlyClientOptions, 'sources' | 'integ
|
|
|
76
108
|
* source runs until `identify()` or `collect()` is called, and those refuse
|
|
77
109
|
* while consent is not `granted`. Consent defaults to `pending`, so a page can
|
|
78
110
|
* load early and call `setConsent('granted')` from its consent tool, or pass
|
|
79
|
-
* `consent: 'granted'` once it already has consent (or
|
|
111
|
+
* `consent: 'granted'` once it already has consent (or know none is required here; see docs/privacy.md §4).
|
|
80
112
|
*/
|
|
81
113
|
declare function load(options: FingerlyOptions): Promise<FingerlyClient>;
|
|
82
114
|
|
|
83
|
-
export { type FingerlyOptions, browserSources, inspectIntegrity, load };
|
|
115
|
+
export { type FingerlyOptions, browserSources, detectEmbedding, inspectIntegrity, load };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,61 @@
|
|
|
1
|
-
import { SOURCE,
|
|
1
|
+
import { SOURCE, hash64, UnsupportedSignal, BlockedSignal, valueOf, FingerlyClient } from '@fingerly/core';
|
|
2
2
|
export { ConsentError, FingerlyClient, SOURCE, TransportError, isSuspiciousLevel } from '@fingerly/core';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
|
+
|
|
6
|
+
// src/embedding.ts
|
|
7
|
+
var THIRD_PARTY_IN_APP_BROWSERS = [
|
|
8
|
+
"fban/",
|
|
9
|
+
"fbav/",
|
|
10
|
+
"fb_iab",
|
|
11
|
+
"instagram",
|
|
12
|
+
"musical_ly",
|
|
13
|
+
"bytedancewebview",
|
|
14
|
+
"snapchat",
|
|
15
|
+
"linkedinapp",
|
|
16
|
+
"line/",
|
|
17
|
+
"micromessenger",
|
|
18
|
+
"pinterest/",
|
|
19
|
+
"gsa/"
|
|
20
|
+
];
|
|
21
|
+
function pageEnvironment() {
|
|
22
|
+
const g = globalThis;
|
|
23
|
+
return {
|
|
24
|
+
...typeof g.navigator?.userAgent === "string" ? { userAgent: g.navigator.userAgent } : {},
|
|
25
|
+
...typeof g.location?.protocol === "string" ? { protocol: g.location.protocol } : {},
|
|
26
|
+
window: globalThis
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function bridgeOf(win) {
|
|
30
|
+
try {
|
|
31
|
+
const capacitor = win["Capacitor"];
|
|
32
|
+
if (capacitor && typeof capacitor.isNativePlatform === "function" && capacitor.isNativePlatform() === true) {
|
|
33
|
+
return "capacitor";
|
|
34
|
+
}
|
|
35
|
+
if (win["cordova"] !== void 0 || win["_cordovaNative"] !== void 0) return "cordova";
|
|
36
|
+
if (win["ReactNativeWebView"] !== void 0) return "react-native-webview";
|
|
37
|
+
if (win["flutter_inappwebview"] !== void 0) return "flutter-webview";
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
function userAgentEmbedding(userAgent) {
|
|
43
|
+
const ua = userAgent.toLowerCase();
|
|
44
|
+
if (ua === "") return void 0;
|
|
45
|
+
if (ua.includes("electron/")) return "electron";
|
|
46
|
+
if (THIRD_PARTY_IN_APP_BROWSERS.some((needle) => ua.includes(needle))) return void 0;
|
|
47
|
+
if (ua.includes("android") && ua.includes("; wv)")) return "android-webview";
|
|
48
|
+
const appleDevice = ["iphone", "ipad", "ipod", "macintosh"].some((device) => ua.includes(device));
|
|
49
|
+
if (appleDevice && ua.includes("applewebkit/") && !ua.includes("safari/")) return "apple-webview";
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
function detectEmbedding(environment = pageEnvironment()) {
|
|
53
|
+
const protocol = (environment.protocol ?? "").toLowerCase();
|
|
54
|
+
if (protocol !== "" && !["http:", "https:", "about:", "blob:"].includes(protocol)) return "app-scheme";
|
|
55
|
+
const bridge = environment.window ? bridgeOf(environment.window) : void 0;
|
|
56
|
+
if (bridge) return bridge;
|
|
57
|
+
return userAgentEmbedding(environment.userAgent ?? "");
|
|
58
|
+
}
|
|
5
59
|
function compact(value) {
|
|
6
60
|
const out = {};
|
|
7
61
|
for (const [key, entry] of Object.entries(value)) {
|
|
@@ -1727,7 +1781,16 @@ var fontPreferencesSource = {
|
|
|
1727
1781
|
};
|
|
1728
1782
|
|
|
1729
1783
|
// src/sources/index.ts
|
|
1730
|
-
|
|
1784
|
+
function guarded(source) {
|
|
1785
|
+
return {
|
|
1786
|
+
...source,
|
|
1787
|
+
run: (ctx) => {
|
|
1788
|
+
if (detectEmbedding()) throw new UnsupportedSignal("embedded");
|
|
1789
|
+
return source.run(ctx);
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
var allBrowserSources = [
|
|
1731
1794
|
// fast
|
|
1732
1795
|
engineSource,
|
|
1733
1796
|
errorsSource,
|
|
@@ -1767,6 +1830,7 @@ var browserSources = [
|
|
|
1767
1830
|
domBlockersSource,
|
|
1768
1831
|
storageDurabilitySource
|
|
1769
1832
|
];
|
|
1833
|
+
var browserSources = allBrowserSources.map(guarded);
|
|
1770
1834
|
function load(options) {
|
|
1771
1835
|
return new Promise(
|
|
1772
1836
|
(resolve) => resolve(
|
|
@@ -1774,10 +1838,13 @@ function load(options) {
|
|
|
1774
1838
|
...options,
|
|
1775
1839
|
platform: "web",
|
|
1776
1840
|
sources: options.sources ?? browserSources,
|
|
1777
|
-
integrity: (report) => inspectIntegrity(report.sources)
|
|
1841
|
+
integrity: (report) => inspectIntegrity(report.sources),
|
|
1842
|
+
// After the caller's options, so nothing passed to load() can turn
|
|
1843
|
+
// detection off: there is no supported way to fingerprint in an app.
|
|
1844
|
+
embedding: () => detectEmbedding()
|
|
1778
1845
|
})
|
|
1779
1846
|
)
|
|
1780
1847
|
);
|
|
1781
1848
|
}
|
|
1782
1849
|
|
|
1783
|
-
export { browserSources, inspectIntegrity, load };
|
|
1850
|
+
export { browserSources, detectEmbedding, inspectIntegrity, load };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fingerly/web-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@fingerly/core": "0.
|
|
31
|
+
"@fingerly/core": "0.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"happy-dom": "^15.11.7",
|