unshared-frontend-sdk 3.0.1 → 3.1.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 +5 -1
- package/dist/browser.d.ts +11 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/shared-types.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -255,12 +255,16 @@ All four methods default to the identity captured by `init()` (email + stable fi
|
|
|
255
255
|
|
|
256
256
|
| Method | Retries | Returns |
|
|
257
257
|
|--------|---------|---------|
|
|
258
|
-
| `checkUser(opts?)` | bounded availability failures only | `{ is_user_flagged, decision_id, decision_code }` |
|
|
258
|
+
| `checkUser(opts?)` | bounded availability failures only | `{ is_user_flagged, decision_id, decision_code, enforcement_type? }` |
|
|
259
259
|
| `triggerEmailVerification(opts?)` | **never** (each call emails a code) | `{ verification_id, next_allowed_at, retry_after_seconds }`; the SDK retains the challenge for `verify(...)` |
|
|
260
260
|
| `verify(code, opts?)` | **never** (attempts are budgeted) | Exact verified/not-verified result; UUIDv4 challenges and 6-digit OTPs are validated locally |
|
|
261
261
|
| `verifyEmail({ verification_id, code })` | **never** | Verification for an explicit challenge ID; reconciles flagged state when retained identity is available |
|
|
262
262
|
| `emailVerificationStatus(opts?)` | yes | `{ can_send: boolean, next_allowed_at }` |
|
|
263
263
|
|
|
264
|
+
`enforcement_type` is optionally `no_enforcement`, `soft_block`, or `hard_block`. Checks negotiate it automatically with `X-Unshared-Enforcement-Version: 1`; boolean-only responses remain compatible. A flagged signal with `enforcement_type: 'hard_block'` selects a local, non-dismissible access-denied message with no OTP action. It replaces an already open or loading soft-verification modal.
|
|
265
|
+
|
|
266
|
+
For manual presentation, call `sdk.showInterstitial({ enforcementType: 'hard_block' })`. Existing `unshared:flagged` listeners and interceptor callbacks can read the optional `enforcement_type`; callbacks taking no arguments still work. Call `destroy()` on logout to clear the prior user's sticky policy and pending UI work. Browser presentation does not enforce server access: protect data with the Node middleware or equivalent server checks.
|
|
267
|
+
|
|
264
268
|
V3 methods require exact success/error envelopes and endpoint-specific status/result shapes. After `verified: true`, the SDK performs one no-retry `checkUser` reconciliation; sticky flagged state is cleared only by a strict available unflagged decision, never by Verify alone or `CHECK_UNAVAILABLE`.
|
|
265
269
|
|
|
266
270
|
---
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CheckUserResult, FingerprintWireFormat, IngestResult, JSONObject, VerifyEmailRequest, VerifyEmailResult } from './shared-types';
|
|
1
|
+
import type { EnforcementType, CheckUserResult, FingerprintWireFormat, IngestResult, JSONObject, VerifyEmailRequest, VerifyEmailResult } from './shared-types';
|
|
2
2
|
export interface BrowserConfig {
|
|
3
3
|
/**
|
|
4
4
|
* Base URL of the customer's own backend.
|
|
@@ -56,6 +56,8 @@ export interface BrowserConfig {
|
|
|
56
56
|
}
|
|
57
57
|
/** Options for {@link UnsharedBrowser.showInterstitial}. */
|
|
58
58
|
export interface ShowInterstitialOptions {
|
|
59
|
+
/** Hard blocks show a local message without an email-verification action. */
|
|
60
|
+
enforcementType?: EnforcementType;
|
|
59
61
|
/** Flow type to fetch. @default the constructor's interstitialFlowType or "email_verification". */
|
|
60
62
|
flowType?: string;
|
|
61
63
|
/** Where to mount the modal. @default document.body. */
|
|
@@ -126,8 +128,12 @@ export interface VerificationStatusData {
|
|
|
126
128
|
can_send: boolean;
|
|
127
129
|
next_allowed_at?: string | null;
|
|
128
130
|
}
|
|
131
|
+
export interface FlaggedDetail {
|
|
132
|
+
email?: string;
|
|
133
|
+
enforcement_type?: EnforcementType;
|
|
134
|
+
}
|
|
129
135
|
export interface FlaggedInterceptorOptions {
|
|
130
|
-
onFlagged: () => void;
|
|
136
|
+
onFlagged: (detail: FlaggedDetail) => void;
|
|
131
137
|
}
|
|
132
138
|
interface CollectedFingerprint {
|
|
133
139
|
raw: JSONObject;
|
|
@@ -180,6 +186,9 @@ export declare class UnsharedBrowser {
|
|
|
180
186
|
private _interstitialHandle;
|
|
181
187
|
/** Guards against rendering the modal more than once per flagged signal. */
|
|
182
188
|
private _interstitialOpen;
|
|
189
|
+
private _interstitialEnforcement?;
|
|
190
|
+
private _interstitialGeneration;
|
|
191
|
+
private _checkSequence;
|
|
183
192
|
constructor(config?: BrowserConfig);
|
|
184
193
|
/**
|
|
185
194
|
* Initialize the SDK after user login.
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="1.5.2",t=1282368115,n={exclude:[],include:[],timeout:3e3,stabilize:["private","iframe","always"],experimental:!1,debug:!1,salt:""},o={always:[{exclude:["speech"],browsers:["brave","firefox"]},{exclude:["keyboard"],browsers:["firefox","safari"]},{exclude:["hardwareSensitive","navigatorProps"],browsers:["brave"]},{exclude:["canvas","audioOscillator","webglRender","canvasTextMetrics"],browsers:["brave"]},{exclude:["canvas","audioOscillator"],browsers:["firefox","safari"]}],private:[{exclude:["fonts"],browsers:["firefox"]},{exclude:["audio"],browsers:["safari","brave"]}],iframe:[{exclude:["permissions"]},{exclude:["keyboard"]}]};let r=null;function a(){if(r)return r;const e=navigator.userAgent;return r=function(){const e=navigator.brave;return!!e&&"function"==typeof e.isBrave}()?{name:"brave",version:i(e,/Chrome\/([\d.]+)/)}:/Edg\//i.test(e)?{name:"edge",version:i(e,/Edg\/([\d.]+)/)}:/OPR\//i.test(e)||/Opera/i.test(e)?{name:"opera",version:i(e,/OPR\/([\d.]+)/)||i(e,/Opera\/([\d.]+)/)}:/SamsungBrowser/i.test(e)?{name:"samsung",version:i(e,/SamsungBrowser\/([\d.]+)/)}:/Firefox\//i.test(e)?{name:"firefox",version:i(e,/Firefox\/([\d.]+)/)}:/Safari\//i.test(e)&&!/Chrome/i.test(e)?{name:"safari",version:i(e,/Version\/([\d.]+)/)}:/Chrome\//i.test(e)?{name:"chrome",version:i(e,/Chrome\/([\d.]+)/)}:{name:"unknown",version:""},r}function i(e,t){const n=e.match(t);return n?.[1]??""}const s=4294967296;function c(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}async function l(e){try{switch(e){case"chrome":case"edge":case"opera":default:return await u();case"brave":return await async function(){return!1}();case"safari":return await async function(){if(navigator.storage?.estimate)try{const{quota:e}=await navigator.storage.estimate();if(c(e))return e<s}catch{}try{return!!navigator.storage?.getDirectory&&(await navigator.storage.getDirectory(),!1)}catch(e){return"NotFoundError"===e?.name}}();case"firefox":return await async function(){if(window.isSecureContext&&!("serviceWorker"in navigator))return!0;try{return!!navigator.storage?.getDirectory&&(await navigator.storage.getDirectory(),!1)}catch(e){return"SecurityError"===e?.name}}()}}catch{return!1}}async function u(){if(!navigator.storage?.estimate)return!1;const{quota:e}=await navigator.storage.estimate();return!!c(e)&&e<s}const d=Object.freeze({status:"absent"}),m="indexedDB",p="localStorage",f="cacheApi",h={storage:{strategy:"allowlist",objectRequired:!0,incognitoFullReplacement:{incognito:!0},paths:[{path:"quota",outputPath:"quota_bucket",lanes:["full"],operation:"log2Bucket16",defaultValue:null},{path:m,lanes:["full"],operation:"keep",defaultValue:null},{path:p,lanes:["full"],operation:"keep",defaultValue:null},{path:f,lanes:["full"],operation:"keep",defaultValue:null}]},webrtc:{strategy:"passthrough",paths:[{path:"videoCodecCount",lanes:["full","stable"],operation:"omit"}]},navigatorProps:{strategy:"passthrough",paths:[{path:"cookieEnabled",lanes:["stable"],operation:"omit"}]}},g=new Set(["anyHover","anyPointer","pointer","hover","update","colorGamut","monochrome"]),y={"fp-v3-cross-context":h,"fp-v4-cross-session":{storage:{strategy:"allowlist",objectRequired:!0,paths:[{path:m,lanes:["full","stable"],operation:"keep",defaultValue:null},{path:p,lanes:["full"],operation:"keep",defaultValue:null},{path:f,lanes:["full"],operation:"keep",defaultValue:null}]},workers:{strategy:"stableAllowlist",objectRequired:!0,paths:[{path:"webWorker",lanes:["stable"],operation:"keep",defaultValue:null},{path:"sharedWorker",lanes:["stable"],operation:"keep",defaultValue:null}]},webrtc:{strategy:"allowlist",objectRequired:!0,paths:[{path:"supported",lanes:["full","stable"],operation:"keep",defaultValue:null},{path:"audioCodecs",lanes:["full","stable"],operation:"keep",defaultValue:[]},{path:"videoCodecs",lanes:["full","stable"],operation:"keep",defaultValue:[]},{path:"extensions",lanes:["full","stable"],operation:"keep",defaultValue:[]}]},navigatorProps:{strategy:"passthrough",paths:[{path:"cookieEnabled",lanes:["stable"],operation:"omit"}]},mediaQueries:{strategy:"allowlist",objectRequired:!0,paths:["prefersContrast","anyHover","anyPointer","pointer","hover","update","invertedColors","prefersReducedMotion","prefersReducedTransparency","scripting","forcedColors","prefersColorScheme","colorGamut","dynamicRange","monochrome"].map(e=>({path:e,lanes:g.has(e)?["full","stable"]:["full"],operation:"keep",defaultValue:null}))},applePay:{strategy:"stableAllowlist",objectRequired:!0,paths:[{path:"supported",lanes:["stable"],operation:"keep",defaultValue:null}]}}},v=Symbol("omit");function w(e,t){let n=e;for(const e of t.split(".")){if("object"!=typeof n||null===n||Array.isArray(n)||!Object.prototype.propertyIsEnumerable.call(n,e))return{found:!1,value:void 0};n=n[e]}return{found:!0,value:n}}function b(e,t){return"omit"===e?v:"log2Bucket16"===e?"number"==typeof t&&Number.isFinite(t)&&t>0?Math.round(16*Math.log2(t))/16:null:t}function x(e,t,n){const r=n.find(e=>e.path===t);if(r)return b(r.operation,e);if("object"!=typeof e||null===e||Array.isArray(e)||""!==t&&!n.some(e=>e.path.startsWith(`${t}.`)))return e;const o=[];for(const[r,i]of Object.entries(e)){const e=x(i,t?`${t}.${r}`:r,n);e!==v&&o.push([r,e])}return Object.fromEntries(o)}function S(e,t,n,r,o){const i=y[e][t];if(!i)return n;if("stableAllowlist"===i.strategy&&"full"===r)return n;if(i.objectRequired&&("object"!=typeof n||null===n||Array.isArray(n)))return d;if("full"===r&&o.isIncognito&&i.incognitoFullReplacement)return{...i.incognitoFullReplacement};const a=i.paths.filter(e=>e.lanes.includes(r));if("passthrough"===i.strategy)return x(n,"",a);const s=n,c=[];for(const e of a){const t=w(s,e.path),n=t.found?t.value:e.defaultValue,r=b(e.operation,n);r!==v&&c.push([e.outputPath??e.path,r])}return Object.fromEntries(c)}function C(e,t){const n=e[0]>>>16,r=65535&e[0],o=e[1]>>>16,i=65535&e[1],a=t[0]>>>16,s=65535&t[0],c=t[1]>>>16;let u=0,l=0,d=0,f=0,h=0;return l=i+(65535&t[1]),u=l>>>16,l&=65535,d=o+c+u,u=d>>>16,d&=65535,f=r+s+u,u=f>>>16,f&=65535,h=n+a+u,h&=65535,[h<<16|f,d<<16|l]}function _(e,t){const n=e[0]>>>16,r=65535&e[0],o=e[1]>>>16,i=65535&e[1],a=t[0]>>>16,s=65535&t[0],c=t[1]>>>16,u=65535&t[1];let l=0,d=0,f=0,h=0,m=0;return d=i*u,l=d>>>16,d&=65535,f=o*u+l,l=f>>>16,f&=65535,f+=i*c,l+=f>>>16,f&=65535,h=r*u+l,l=h>>>16,h&=65535,h+=o*c,l+=h>>>16,h&=65535,h+=i*s,l+=h>>>16,h&=65535,m=n*u+r*c+o*s+i*a+l,m&=65535,[m<<16|h,f<<16|d]}function A(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function E(e,t){return 0==(t%=64)?[e[0],e[1]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function P(e,t){return[e[0]^t[0],e[1]^t[1]]}function k(e){let t=[e[0],e[1]];return t=P(t,[0,t[0]>>>1]),t=_(t,[4283543511,3981806797]),t=P(t,[0,t[0]>>>1]),t=_(t,[3301882366,444984403]),t=P(t,[0,t[0]>>>1]),t}function R(e){return("00000000"+(e>>>0).toString(16)).slice(-8)}function T(e,t=0){const n=e.length%16,r=e.length-n;let o=[0,t],i=[0,t];const a=[2277735313,289559509],s=[1291169091,658871167];for(let t=0;t<r;t+=16){let n=[255&e.charCodeAt(t+4)|(255&e.charCodeAt(t+5))<<8|(255&e.charCodeAt(t+6))<<16|(255&e.charCodeAt(t+7))<<24,255&e.charCodeAt(t)|(255&e.charCodeAt(t+1))<<8|(255&e.charCodeAt(t+2))<<16|(255&e.charCodeAt(t+3))<<24],r=[255&e.charCodeAt(t+12)|(255&e.charCodeAt(t+13))<<8|(255&e.charCodeAt(t+14))<<16|(255&e.charCodeAt(t+15))<<24,255&e.charCodeAt(t+8)|(255&e.charCodeAt(t+9))<<8|(255&e.charCodeAt(t+10))<<16|(255&e.charCodeAt(t+11))<<24];n=_(n,a),n=A(n,31),n=_(n,s),o=P(o,n),o=A(o,27),o=C(o,i),o=C(_(o,[0,5]),[0,1390208809]),r=_(r,s),r=A(r,33),r=_(r,a),i=P(i,r),i=A(i,31),i=C(i,o),i=C(_(i,[0,5]),[0,944331445])}let c=[0,0],u=[0,0];switch(n){case 15:u=P(u,E([0,e.charCodeAt(r+14)],48));case 14:u=P(u,E([0,e.charCodeAt(r+13)],40));case 13:u=P(u,E([0,e.charCodeAt(r+12)],32));case 12:u=P(u,E([0,e.charCodeAt(r+11)],24));case 11:u=P(u,E([0,e.charCodeAt(r+10)],16));case 10:u=P(u,E([0,e.charCodeAt(r+9)],8));case 9:u=P(u,[0,e.charCodeAt(r+8)]),u=_(u,s),u=A(u,33),u=_(u,a),i=P(i,u);case 8:c=P(c,E([0,e.charCodeAt(r+7)],56));case 7:c=P(c,E([0,e.charCodeAt(r+6)],48));case 6:c=P(c,E([0,e.charCodeAt(r+5)],40));case 5:c=P(c,E([0,e.charCodeAt(r+4)],32));case 4:c=P(c,E([0,e.charCodeAt(r+3)],24));case 3:c=P(c,E([0,e.charCodeAt(r+2)],16));case 2:c=P(c,E([0,e.charCodeAt(r+1)],8));case 1:c=P(c,[0,e.charCodeAt(r)]),c=_(c,a),c=A(c,31),c=_(c,s),o=P(o,c)}return o=P(o,[0,e.length]),i=P(i,[0,e.length]),o=C(o,i),i=C(i,o),o=k(o),i=k(i),o=C(o,i),i=C(i,o),R(o[0])+R(o[1])+R(i[0])+R(i[1])}function M(e){return O(e,new Set)}function O(e,t){if(null===e)return"null";if(void 0===e)return"undefined";const n=typeof e;if("boolean"===n||"number"===n)return String(e);if("string"===n)return JSON.stringify(e);if(Array.isArray(e)){if(t.has(e))return'"[Circular]"';t.add(e);const n=e.map(e=>O(e,t));return t.delete(e),"["+n.join(",")+"]"}if("object"===n){const n=e;if(t.has(n))return'"[Circular]"';t.add(n);const r=Object.keys(n).sort().filter(e=>void 0!==n[e]).map(e=>JSON.stringify(e)+":"+O(n[e],t));return t.delete(n),"{"+r.join(",")+"}"}return String(e)}const I=T("",t);function D(e,n){const r=function(e){if(0===e.length)return T("",t);if(1===e.length)return T(e[0],t);let n=[...e];for(;n.length>1;){const e=[];for(let r=0;r<n.length;r+=2){const o=r+1<n.length?n[r+1]:I;e.push(T(n[r]+o,t))}n=e}return n[0]}(Object.keys(e).sort().map(n=>{const r=function(e){let n=t;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),1540483477),n^=n>>>13;return n>>>0}(n);return T(M(e[n]),r)})),o=String.fromCharCode(76,111,98,115),i=n?T(n,t):"";return T(r+o+i,t)}const B="fp-v4-cross-session",L="__version",F=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","display","locale","workers","plugins","css","cssLayout","navigatorProps","timing","navigatorConnection","webgpu","audio","fonts","webrtc","permissions","speech","mediaQueries","applePay","keyboard","storage","extendedLocale","privacyPrefs","vendorFlavors","audioOscillator","canvas"]),N=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","locale","workers","plugins","css","navigatorProps","webgpu","webrtc","mediaQueries","applePay","storage","vendorFlavors"]),V=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","display","locale","workers","plugins","css","cssLayout","navigatorProps","timing","navigatorConnection","webgpu","audio","fonts","webrtc","permissions","speech","mediaQueries","applePay","keyboard","storage","extendedLocale","privacyPrefs","vendorFlavors","audioOscillator","canvas"]),W=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","locale","workers","plugins","css","navigatorProps","webgpu","webrtc","mediaQueries","vendorFlavors"]),j=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","display","locale","workers","plugins","css","cssLayout","navigatorProps","timing","navigatorConnection","webgpu","audio","fonts","webrtc","permissions","speech","mediaQueries","applePay","keyboard"]),U=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","locale","workers","plugins","css","navigatorProps","webgpu","webrtc","mediaQueries","applePay","keyboard"]);function G(e,t,n,r,o){const i={};for(const a of t)Object.prototype.propertyIsEnumerable.call(e,a)&&void 0!==e[a]?i[a]=S(n,a,e[a],o,{isIncognito:r}):i[a]=d;return i}function z(e,t,n,r,o,i){return{policyVersion:e,hash:D(G(t,o,e,r,"full"),n),stableHash:D(G(t,i,e,r,"stable"),n)}}function H(e,t,n){return z(B,e,t,n,F,N)}function X(e,t,n){return z("fp-v3-cross-context",e,t,n,V,W)}function q(e,t){const n={[L]:"1.3.3"};for(const r of t)Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}function K(e,t){return{policyVersion:"fp-v1",hash:D(q(e,j),t),stableHash:D(q(e,U),t)}}function $(e,t,n){return[H(e,t,n),X(e,t,n),K(e,t)]}const Z={name:"webgl",tier:1,async collect(){const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!(t&&t instanceof WebGLRenderingContext))return null;const n=t.getExtension("WEBGL_debug_renderer_info"),r=t.getSupportedExtensions()??[],o=function(e){const t={},n=[e.VERTEX_SHADER,e.FRAGMENT_SHADER],r=[e.LOW_FLOAT,e.MEDIUM_FLOAT,e.HIGH_FLOAT,e.LOW_INT,e.MEDIUM_INT,e.HIGH_INT],o=["vertex","fragment"],i=["lowFloat","mediumFloat","highFloat","lowInt","mediumInt","highInt"];for(let a=0;a<n.length;a++){const s={};for(let t=0;t<r.length;t++){const o=e.getShaderPrecisionFormat(n[a],r[t]);o&&(s[i[t]]={rangeMin:o.rangeMin,rangeMax:o.rangeMax,precision:o.precision})}t[o[a]]=s}return t}(t),i={vendor:t.getParameter(t.VENDOR),renderer:t.getParameter(t.RENDERER),version:t.getParameter(t.VERSION),shadingLanguageVersion:t.getParameter(t.SHADING_LANGUAGE_VERSION),unmaskedVendor:n?t.getParameter(n.UNMASKED_VENDOR_WEBGL):null,unmaskedRenderer:n?t.getParameter(n.UNMASKED_RENDERER_WEBGL):null,extensions:r.sort(),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxRenderbufferSize:t.getParameter(t.MAX_RENDERBUFFER_SIZE),maxViewportDims:Array.from(t.getParameter(t.MAX_VIEWPORT_DIMS)),maxVertexAttribs:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniformVectors:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxFragmentUniformVectors:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxVaryingVectors:t.getParameter(t.MAX_VARYING_VECTORS),aliasedLineWidthRange:Array.from(t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)),aliasedPointSizeRange:Array.from(t.getParameter(t.ALIASED_POINT_SIZE_RANGE)),maxCombinedTextureImageUnits:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxTextureImageUnits:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),shaderPrecision:o,maxAnisotropy:Y(t),webgl2:Q(e)};return t.getExtension("WEBGL_lose_context")?.loseContext(),i}};function Y(e){try{const t=e.getExtension("EXT_texture_filter_anisotropic")??e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")??e.getExtension("MOZ_EXT_texture_filter_anisotropic");return t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):null}catch{return null}}function Q(e){try{const t=e.getContext("webgl2");if(!t)return null;const n={version:t.getParameter(t.VERSION),maxSamples:t.getParameter(t.MAX_SAMPLES),max3DTextureSize:t.getParameter(t.MAX_3D_TEXTURE_SIZE),maxArrayTextureLayers:t.getParameter(t.MAX_ARRAY_TEXTURE_LAYERS),maxUniformBlockSize:t.getParameter(t.MAX_UNIFORM_BLOCK_SIZE),maxVertexUniformComponents:t.getParameter(t.MAX_VERTEX_UNIFORM_COMPONENTS),maxFragmentUniformComponents:t.getParameter(t.MAX_FRAGMENT_UNIFORM_COMPONENTS),maxColorAttachments:t.getParameter(t.MAX_COLOR_ATTACHMENTS),maxDrawBuffers:t.getParameter(t.MAX_DRAW_BUFFERS)};return t.getExtension("WEBGL_lose_context")?.loseContext(),n}catch{return null}}const J={name:"hardware",tier:1,collect:async()=>({architecture:ne(),platform:te()})},ee={name:"hardwareSensitive",tier:1,collect:async()=>({deviceMemory:navigator.deviceMemory??null,hardwareConcurrency:navigator.hardwareConcurrency??null})};function te(){const e=navigator.userAgentData;if(e?.platform)return e.platform;const t=navigator.userAgent??"";return/Windows/.test(t)?"Windows":/Macintosh|Mac OS X/.test(t)?"macOS":/CrOS/.test(t)?"Chrome OS":/Android/.test(t)?"Android":/Linux/.test(t)?"Linux":/iPhone|iPad|iPod/.test(t)?"iOS":""}function ne(){try{const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint8Array(e);return t[0]=1/0,n[3]}catch{return 0}}const oe={name:"math",tier:1,collect:async()=>({acos:Math.acos(.5),asin:re(Math.asin,-1,1,97),cos:re(Math.cos,0,Math.PI,97),cosLarge:Math.cos(1e20),sinLarge:Math.sin(1e20),tanLarge:Math.tan(1e20),sin:re(Math.sin,0,Math.PI,97),tan:re(Math.tan,0,Math.PI/4,97)})};function re(e,t,n,r){const o=(n-t)/r;let i=e(t)+e(n);for(let n=1;n<r;n++)i+=e(t+n*o)*(n%2==0?2:4);return i*o/3}const ae={name:"i18n",tier:1,collect:async()=>({dateTimeFormat:ie(),numberFormat:se(),collator:ce(),pluralRules:le(),relativeTimeFormat:ue(),listFormat:de()})};function ie(){try{const e=(new Intl.DateTimeFormat).resolvedOptions();return{locale:e.locale,calendar:e.calendar,numberingSystem:e.numberingSystem,timeZone:e.timeZone}}catch{return{}}}function se(){try{const e=(new Intl.NumberFormat).resolvedOptions();return{locale:e.locale,numberingSystem:e.numberingSystem,style:e.style,minimumIntegerDigits:e.minimumIntegerDigits,minimumFractionDigits:e.minimumFractionDigits,maximumFractionDigits:e.maximumFractionDigits,useGrouping:e.useGrouping}}catch{return{}}}function ce(){try{const e=(new Intl.Collator).resolvedOptions();return{locale:e.locale,usage:e.usage,sensitivity:e.sensitivity,collation:e.collation,numeric:e.numeric,caseFirst:e.caseFirst}}catch{return{}}}function le(){try{const e=(new Intl.PluralRules).resolvedOptions(),t=new Intl.PluralRules(void 0,{type:"ordinal"}).resolvedOptions();return{locale:e.locale,type:e.type,cardinalCategories:(new Intl.PluralRules).select(0)+","+(new Intl.PluralRules).select(1)+","+(new Intl.PluralRules).select(2)+","+(new Intl.PluralRules).select(5)+","+(new Intl.PluralRules).select(11)+","+(new Intl.PluralRules).select(100),ordinalCategory1:t.type,minimumIntegerDigits:e.minimumIntegerDigits}}catch{return{}}}function ue(){try{const e=new Intl.RelativeTimeFormat;if(!e)return{};const t=e.resolvedOptions();return{locale:t.locale,style:t.style,numeric:t.numeric,numberingSystem:t.numberingSystem}}catch{return{}}}function de(){try{const e=new Intl.ListFormat;if(!e)return{};const t=e.resolvedOptions(),n=["X","Y","Z"],r=new Intl.ListFormat(void 0,{type:"conjunction",style:"long"}),o=new Intl.ListFormat(void 0,{type:"disjunction",style:"long"});return{locale:t.locale,type:t.type,style:t.style,conjunctionSample:r.format(n),disjunctionSample:o.format(n)}}catch{return{}}}const me={name:"domrect",tier:1,collect:async()=>({basic:function(){const e=document.createElement("div");e.style.cssText="position:fixed;left:-9999px;width:100px;height:100px;",document.body.appendChild(e);const t=e.getBoundingClientRect();return document.body.removeChild(e),{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}}(),precision:function(){const e=document.createElement("div");e.style.cssText=`position:absolute;left:-9999px;width:${Math.PI}px;height:${Math.E}px;`,document.body.appendChild(e);const t=e.getBoundingClientRect();return document.body.removeChild(e),{width:t.width,height:t.height}}(),fromRect:"undefined"!=typeof DOMRectReadOnly&&"function"==typeof DOMRectReadOnly.fromRect})},pe={name:"touch",tier:1,collect:async()=>({supported:"ontouchstart"in window||navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints??0})},fe={name:"display",tier:1,collect:async()=>({colorDepth:screen.colorDepth??0,pixelDepth:screen.pixelDepth??0})},he={name:"locale",tier:1,collect:async()=>({timezone:Intl.DateTimeFormat().resolvedOptions().timeZone??"",language:navigator.language??""})},ge={name:"workers",tier:1,collect:async()=>({webWorker:"undefined"!=typeof Worker,sharedWorker:"undefined"!=typeof SharedWorker,serviceWorker:"serviceWorker"in navigator})},ye={name:"plugins",tier:1,async collect(){const e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){const n=navigator.plugins[t];"internal-pdf-viewer"===n.filename&&e.push(`${n.name}|${n.filename}|${n.description}`)}return{plugins:e.sort(),pdfViewerEnabled:navigator.pdfViewerEnabled??!1}}},ve=[["backdrop-filter","blur(1px)"],["container-type","inline-size"],["text-wrap","balance"],["overscroll-behavior","contain"],["hanging-punctuation","first"],["-webkit-line-clamp","1"],["appearance","none"],["font-size-adjust","ex-height 0.5"],["font-palette","normal"],["field-sizing","content"],["-webkit-text-stroke","1px black"],["zoom","1"],["scrollbar-width","thin"],["scrollbar-color","red blue"],["animation-timeline","auto"],["mask-composite","add"],["offset-path","none"],["text-decoration-thickness","1px"],["content-visibility","auto"],["contain-intrinsic-size","auto 100px"],["aspect-ratio","16/9"],["gap","10px"],["color-mix","in srgb, red 50%, blue"],["linear-gradient(in oklch, red, blue)",""]],we={name:"css",tier:1,collect:async()=>({supports:be(),safeArea:xe()})};function be(){const e={};if("undefined"==typeof CSS||"function"!=typeof CSS.supports)return e;for(const[t,n]of ve)e[t]=n?CSS.supports(t,n):CSS.supports(t);return e}function xe(){try{const e=document.createElement("div");e.style.cssText=["position:fixed","top:0","left:0","width:0","height:0","visibility:hidden","padding-top:env(safe-area-inset-top,0px)","padding-bottom:env(safe-area-inset-bottom,0px)","padding-left:env(safe-area-inset-left,0px)","padding-right:env(safe-area-inset-right,0px)"].join(";"),document.body.appendChild(e);const t=getComputedStyle(e),n={top:t.paddingTop,bottom:t.paddingBottom,left:t.paddingLeft,right:t.paddingRight};return document.body.removeChild(e),n}catch{return null}}const Se={name:"cssLayout",tier:1,collect:async()=>({scrollbarWidth:Ce()})};function Ce(){try{const e=document.createElement("div");e.style.cssText="visibility:hidden;overflow:scroll;position:absolute;top:-9999px;width:100px;height:100px",document.body.appendChild(e);const t=document.createElement("div");e.appendChild(t);const n=e.offsetWidth-t.offsetWidth;return document.body.removeChild(e),n}catch{return-1}}const _e={name:"navigatorProps",tier:1,collect:async()=>({vendor:navigator.vendor??"",productSub:navigator.productSub??"",cookieEnabled:navigator.cookieEnabled})},Ae={name:"navigatorConnection",tier:2,async collect(){const e=navigator,t=e.connection??e.mozConnection??e.webkitConnection??null,n=performance.memory??null;return{connection:t?{type:t.type??null,effectiveType:t.effectiveType??null,saveData:t.saveData??null}:null,memory:n?{jsHeapSizeLimit:n.jsHeapSizeLimit}:null}}},Ee={name:"timing",tier:2,collect:async()=>({performancePrecisionUs:Pe()})};function Pe(){try{const e=performance.now();let t=1/0,n=e;for(let r=0;r<50;r++){const r=performance.now(),o=r-n;if(o>0&&o<t&&(t=o),n=r,r-e>=1)break}if(t===1/0)return-1;const r=1e3*t;if(r<=0)return-1;const o=Math.max(0,Math.round(Math.log10(r)));return Math.pow(10,o)}catch{return-1}}const ke={name:"webgpu",tier:2,async collect(){const e=navigator.gpu;if(!e)return null;const t=await e.requestAdapter();if(!t)return null;let n="",r="",o="",i="";if(t.info)n=t.info.vendor??"",r=t.info.architecture??"",o=t.info.device??"",i=t.info.description??"";else if("function"==typeof t.requestAdapterInfo){const e=await t.requestAdapterInfo();n=e.vendor??"",r=e.architecture??"",o=e.device??"",i=e.description??""}const a=[];t.features&&(t.features.forEach(e=>a.push(e)),a.sort());const s={};if(t.limits){const e=["maxTextureDimension1D","maxTextureDimension2D","maxTextureDimension3D","maxTextureArrayLayers","maxBindGroups","maxBindGroupsPlusVertexBuffers","maxBindingsPerBindGroup","maxDynamicUniformBuffersPerPipelineLayout","maxDynamicStorageBuffersPerPipelineLayout","maxSampledTexturesPerShaderStage","maxSamplersPerShaderStage","maxStorageBuffersPerShaderStage","maxStorageTexturesPerShaderStage","maxUniformBuffersPerShaderStage","maxUniformBufferBindingSize","maxStorageBufferBindingSize","minUniformBufferOffsetAlignment","minStorageBufferOffsetAlignment","maxVertexBuffers","maxBufferSize","maxVertexAttributes","maxVertexBufferArrayStride","maxInterStageShaderComponents","maxInterStageShaderVariables","maxColorAttachments","maxColorAttachmentBytesPerSample","maxComputeWorkgroupStorageSize","maxComputeInvocationsPerWorkgroup","maxComputeWorkgroupSizeX","maxComputeWorkgroupSizeY","maxComputeWorkgroupSizeZ","maxComputeWorkgroupsPerDimension"];for(const n of e){const e=t.limits[n];void 0!==e&&(s[n]=e)}}return{vendor:n,architecture:r,device:o,description:i,features:a,limits:s}}},Re={name:"audio",tier:2,async collect(){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;let t=null;try{t=new e;const n=t.destination;return{sampleRate:t.sampleRate,maxChannelCount:n.maxChannelCount,channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,baseLatency:t.baseLatency??null,outputLatency:t.outputLatency??null}}finally{if(t&&"closed"!==t.state)try{await t.close()}catch{}}}},Te=["Arial","Arial Black","Arial Narrow","Arial Rounded MT Bold","Bookman Old Style","Bradley Hand","Calibri","Cambria","Cambria Math","Century","Century Gothic","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Helvetica Neue","Impact","Lucida Console","Lucida Grande","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Tahoma","Times","Times New Roman","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3","Inter","Roboto","Open Sans","Lato","Montserrat","Poppins","Nunito","Raleway","Ubuntu","Merriweather","Playfair Display","Source Sans Pro","Source Code Pro","Fira Code","JetBrains Mono","Cascadia Code","Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji","SF Pro","SF Pro Display","SF Mono","San Francisco","Menlo","Andale Mono","Futura","MS Gothic","MS Mincho","MS PGothic","MS PMincho","Yu Gothic","Meiryo","Hiragino Sans","Hiragino Kaku Gothic Pro","SimSun","SimHei","Microsoft YaHei","PingFang SC","Noto Sans CJK","Malgun Gothic","Arial Hebrew"],Me=["monospace","sans-serif","serif"],Oe="mmMwWLliI0O&1",Ie={name:"fonts",tier:2,collect:()=>new Promise(e=>{const t=()=>e(function(){try{if("undefined"==typeof document)return{available:[],method:"css-layout"};const e=new Set,t=[];if("function"==typeof document.fonts?.check)for(const n of Te)document.fonts.check(`72px "${n}"`)?e.add(n):t.push(n);else t.push(...Te);const n=new Set;if(t.length>0){const e=document.createElement("div");e.style.cssText="position:absolute;visibility:hidden;top:-9999px;left:-9999px;pointer-events:none;";const r=Me.map(t=>{const n=document.createElement("span");return n.style.cssText=`font-size:72px;font-family:${t};white-space:nowrap;display:inline-block`,n.textContent=Oe,e.appendChild(n),n}),o=t.map(t=>Me.map(n=>{const r=document.createElement("span");return r.style.cssText=`font-size:72px;font-family:'${t}',${n};white-space:nowrap;display:inline-block`,r.textContent=Oe,e.appendChild(r),r}));document.body.appendChild(e);const i=r.map(e=>e.getBoundingClientRect().width),a=o.map(e=>e.map(e=>e.getBoundingClientRect().width));document.body.removeChild(e);for(let e=0;e<t.length;e++)for(let r=0;r<Me.length;r++)if(a[e][r]!==i[r]){n.add(t[e]);break}}return{available:Te.filter(t=>e.has(t)||n.has(t)),method:"css-layout"}}catch{return{available:[],method:"css-layout"}}}());"undefined"!=typeof requestIdleCallback?requestIdleCallback(t,{timeout:2e3}):setTimeout(t,0)})},De={name:"webrtc",tier:2,async collect(){if("undefined"==typeof RTCPeerConnection)return{supported:!1,audioCodecCount:0,videoCodecCount:0,audioCodecs:[],videoCodecs:[],extensions:[]};const e=new RTCPeerConnection({iceServers:[]});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=(await e.createOffer()).sdp??"",n=Be(t,"audio"),r=Be(t,"video"),o=function(e){const t=new Set,n=e.split("\r\n");for(const e of n)if(e.startsWith("a=extmap:")){const n=e.match(/^a=extmap:\d+(?:\/\w+)?\s+(.+)$/);n&&t.add(n[1].trim())}return Array.from(t)}(t);return{supported:!0,audioCodecCount:n.length,videoCodecCount:r.length,audioCodecs:n.sort(),videoCodecs:r.sort(),extensions:o.sort()}}finally{e.close()}}};function Be(e,t){const n=[],r=e.split("\r\n");let o=!1;for(const e of r)if(e.startsWith(`m=${t}`))o=!0;else{if(e.startsWith("m=")&&o)break;if(o&&e.startsWith("a=rtpmap:")){const t=e.match(/^a=rtpmap:\d+\s+(.+)$/);t&&n.push(t[1])}}return n}const Le=["accelerometer","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","display-capture","geolocation","gyroscope","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","screen-wake-lock","speaker-selection","storage-access","top-level-storage-access","window-management","xr-spatial-tracking"],Fe={name:"permissions",tier:2,async collect(){if(!navigator.permissions?.query)return{states:{}};const e=()=>Promise.allSettled(Le.map(async e=>{try{return{name:e,state:(await navigator.permissions.query({name:e})).state}}catch{return{name:e,state:"error"}}})),t=await Promise.all([e(),e(),e()]),n={};for(const e of t)for(const t of e)if("fulfilled"===t.status){const{name:e,state:r}=t.value;n[e]||(n[e]=[]),n[e].push(r)}const r={};for(const[e,t]of Object.entries(n))r[e]=Ne(t);return{states:r}}};function Ne(e){const t={};for(const n of e)t[n]=(t[n]??0)+1;let n=e[0],r=0;for(const[e,o]of Object.entries(t))o>r&&(n=e,r=o);return n}const Ve={name:"speech",tier:2,async collect(){if("undefined"==typeof speechSynthesis)return{supported:!1,voiceCount:0,voices:[]};const e=await new Promise(e=>{const t=speechSynthesis.getVoices();if(t.length>0)return void e(t);const n=setTimeout(()=>e([]),800);speechSynthesis.addEventListener("voiceschanged",()=>{clearTimeout(n),e(speechSynthesis.getVoices())},{once:!0})}),t=e.map(e=>`${e.name}|${e.lang}|${e.localService}`).sort();return{supported:!0,voiceCount:e.length,voices:t}}},We=[{name:"prefers-contrast",values:["no-preference","more","less","custom"]},{name:"any-hover",values:["none","hover"]},{name:"any-pointer",values:["none","coarse","fine"]},{name:"pointer",values:["none","coarse","fine"]},{name:"hover",values:["none","hover"]},{name:"update",values:["none","slow","fast"]},{name:"inverted-colors",values:["none","inverted"]},{name:"prefers-reduced-motion",values:["no-preference","reduce"]},{name:"prefers-reduced-transparency",values:["no-preference","reduce"]},{name:"scripting",values:["none","initial-only","enabled"]},{name:"forced-colors",values:["none","active"]},{name:"prefers-color-scheme",values:["light","dark"]},{name:"color-gamut",values:["srgb","p3","rec2020"]},{name:"dynamic-range",values:["standard","high"]}],je={name:"mediaQueries",tier:2,async collect(){if("function"!=typeof matchMedia){const e={};for(const t of We)e[t.name.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]="unsupported";return{...e,monochrome:0}}const e={};for(const t of We){let n="unknown";for(const e of t.values){const r=matchMedia(`(${t.name}: ${e})`);if(r?.matches){n=e;break}}e[t.name.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]=n}let t=0;for(let e=100;e>=0;e--)if(matchMedia(`(monochrome: ${e})`)?.matches){t=e;break}return{...e,monochrome:t}}},Ue={name:"applePay",tier:2,async collect(){const e=window.ApplePaySession;if(!e||"function"!=typeof e.supportsVersion)return{supported:!1,maxVersion:0};let t=0;for(let n=15;n>=1;n--)try{if(e.supportsVersion(n)){t=n;break}}catch{continue}return{supported:!0,maxVersion:t}}},Ge=["KeyQ","KeyW","KeyA","KeyS","KeyZ","KeyX","KeyY","KeyM","Semicolon","BracketLeft","Quote","Digit1","Digit2","Digit3"],ze={name:"keyboard",tier:2,async collect(){const e=navigator.keyboard;if(!e||"function"!=typeof e.getLayoutMap)return{supported:!1,layoutKeys:null,layoutHint:null};try{const t=await e.getLayoutMap(),n={};for(const e of Ge){const r=t.get(e);void 0!==r&&(n[e]=r)}return{supported:!0,layoutKeys:n,layoutHint:He(n)}}catch{return{supported:!1,layoutKeys:null,layoutHint:null}}}};function He(e){const t=e.KeyQ,n=e.KeyZ,r=e.KeyY;return t?"a"===t?"azerty":"q"===t&&"z"===r?"qwertz":"q"===t&&"z"===n?"qwerty":"'"===t?"dvorak":"other":null}const Xe={name:"canvas",tier:2,async collect(){const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return null;e.width=240,e.height=120,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"',t.fillText("Cwm fjordbank gly"+String.fromCharCode(55357,56835),2,15),t.fillStyle="rgba(102,204,0,0.2)",t.font="18pt Arial",t.fillText("Cwm fjordbank gly"+String.fromCharCode(55357,56835),4,45);const n=e.toDataURL("image/png");t.clearRect(0,0,e.width,e.height),t.globalCompositeOperation="multiply",t.fillStyle="#f2f",t.beginPath(),t.arc(40,40,40,0,2*Math.PI),t.fill(),t.fillStyle="#2ff",t.beginPath(),t.arc(80,40,40,0,2*Math.PI),t.fill(),t.fillStyle="#ff2",t.beginPath(),t.arc(60,80,40,0,2*Math.PI),t.fill(),t.globalCompositeOperation="source-over",t.fillStyle="#f9c",t.beginPath(),t.arc(60,60,60,0,2*Math.PI),t.arc(60,60,20,0,2*Math.PI),t.fill("evenodd");const r=e.toDataURL("image/png");return{textDataUrl:n,geometryDataUrl:r,readbackAllowed:n.length>=1e3&&r.length>=1e3,windingRule:0===t.getImageData(60,60,1,1).data[3]}}},qe={name:"audioOscillator",tier:2,async collect(){const e=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(!e)return null;const t=new e(1,5e3,44100),n=t.createOscillator();n.type="triangle",n.frequency.value=1e4;const r=t.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,n.connect(r),r.connect(t.destination),n.start(0);const o=(await t.startRendering()).getChannelData(0).slice(4500,5e3);let i=0;for(let e=0;e<o.length;e++)i+=Math.abs(o[e]);return{sampleSum:i,sampleCount:o.length}}},Ke={name:"webglRender",tier:2,async collect(){const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("webgl",{preserveDrawingBuffer:!0});if(!t)return null;try{const e="\n attribute vec2 position;\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vColor = color;\n }\n ",n="\n precision mediump float;\n varying vec3 vColor;\n void main() {\n gl_FragColor = vec4(vColor, 1.0);\n }\n ",r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,n),t.compileShader(o);const i=t.createProgram();t.attachShader(i,r),t.attachShader(i,o),t.linkProgram(i),t.useProgram(i);const a=new Float32Array([-.5,-.5,1,0,0,.5,-.5,0,1,0,0,.5,0,0,1]),s=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,a,t.STATIC_DRAW);const c=t.getAttribLocation(i,"position");t.enableVertexAttribArray(c),t.vertexAttribPointer(c,2,t.FLOAT,!1,20,0);const u=t.getAttribLocation(i,"color");t.enableVertexAttribArray(u),t.vertexAttribPointer(u,3,t.FLOAT,!1,20,8),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,3),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.drawArrays(t.TRIANGLES,0,3);const l=new Uint8Array(262144);t.readPixels(0,0,256,256,t.RGBA,t.UNSIGNED_BYTE,l);const d=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}(l);let f=!1;for(let e=0;e<l.length;e++)if(0!==l[e]){f=!0;break}return{pixelHash:d,readbackAllowed:f}}finally{t.getExtension("WEBGL_lose_context")?.loseContext()}}},$e=["14px Arial","14px Georgia","14px monospace"],Ze={name:"canvasTextMetrics",tier:2,async collect(){const e=document.createElement("canvas").getContext("2d");if(!e)return null;const t=[];for(const n of $e){e.font=n;const r=e.measureText("Sphinx of black quartz, judge my vow. 0123456789");t.push({font:n,width:r.width,actualBoundingBoxAscent:r.actualBoundingBoxAscent??null,actualBoundingBoxDescent:r.actualBoundingBoxDescent??null,actualBoundingBoxLeft:r.actualBoundingBoxLeft??null,actualBoundingBoxRight:r.actualBoundingBoxRight??null,fontBoundingBoxAscent:r.fontBoundingBoxAscent??null,fontBoundingBoxDescent:r.fontBoundingBoxDescent??null})}return{metrics:t}}},Ye=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"],Qe={name:"vendorFlavors",tier:2,async collect(){const e=window,t=[];for(const n of Ye)void 0!==e[n]&&t.push(n);return t.sort(),{flavors:t}}},Je=[{key:"default",family:""},{key:"apple",family:"-apple-system, BlinkMacSystemFont"},{key:"serif",family:"serif"},{key:"sansSerif",family:"sans-serif"},{key:"monospace",family:"monospace"},{key:"systemUi",family:"system-ui"}],et={name:"fontPreferences",tier:2,async collect(){if("undefined"==typeof document||!document.body)return null;const e=document.createElement("div");e.style.cssText="position:absolute;visibility:hidden;top:-9999px";const t=Je.map(({family:t})=>{const n=document.createElement("span");return n.textContent="mmMwWLliI0fiflO&1",n.style.fontSize="72px",t&&(n.style.fontFamily=t),e.appendChild(n),n});document.body.appendChild(e);const n={};for(let e=0;e<Je.length;e++){const r=t[e].getBoundingClientRect().width;n[Je[e].key]=Math.round(1e3*r)/1e3}return document.body.removeChild(e),n}},tt={name:"screenFrame",tier:2,async collect(){const e=screen,t=e.availTop??0,n=e.availLeft??0;return{top:t,right:screen.width-(e.availWidth??screen.width)-n,bottom:screen.height-(e.availHeight??screen.height)-t,left:n}}};function nt(e){return/Not[ ;)\/]/i.test(e)}const ot={name:"clientHints",tier:2,async collect(){const e=navigator;if(!e.userAgentData)return null;const t=(e.userAgentData.brands??[]).filter(e=>!nt(e.brand)),n=e.userAgentData.mobile??!1,r=e.userAgentData.platform??"",o=await e.userAgentData.getHighEntropyValues(["architecture","bitness","model","platformVersion","fullVersionList"]),i=(o.fullVersionList??[]).filter(e=>!nt(e.brand));return{brands:t,mobile:n,platform:r,architecture:o.architecture??"",bitness:o.bitness??"",model:o.model??"",platformVersion:o.platformVersion??"",fullVersionList:i}}},rt=[{name:"EasyList",selectors:[".ad-banner",".ad_banner","#ad-banner",".adsbygoogle",".ad-container"]},{name:"AdGuard Base",selectors:[".BannerAd",".ad-rotate","#ad-box",".ad-placement",".ad-zone"]},{name:"EasyPrivacy",selectors:["#tracking-pixel",".tracking",".analytics-tag","#beacon",".pixel-tracker"]},{name:"Fanboy Annoyances",selectors:["#newsletter-popup",".cookie-banner",".consent-dialog","#gdpr-notice",".subscribe-modal"]},{name:"AdGuard Tracking",selectors:[".tracker-frame","#analytics-beacon",".telemetry-pixel",".data-tracker","#stats-counter"]}],at={name:"domBlockers",tier:2,async collect(){if("undefined"==typeof document||!document.body)return{activeFilters:[]};const e=[],t=[];try{for(const n of rt){const r=[];for(const t of n.selectors){const n=document.createElement("div");t.startsWith("#")?n.id=t.slice(1):n.className=t.slice(1),document.body.appendChild(n),r.push(n),e.push(n)}t.push({name:n.name,elements:r})}await new Promise(e=>setTimeout(e,0));const n=[];for(const{name:e,elements:r}of t){let t=0;for(const e of r)null===e.offsetParent&&t++;t/r.length>.6&&n.push(e)}return{activeFilters:n}}catch{return{activeFilters:[]}}finally{for(const t of e)try{t.parentNode?.removeChild(t)}catch{}}}},it={name:"privateClickMeasurement",tier:2,collect:async()=>({supported:"attributionSourceId"in document.createElement("a")})},st={name:"automationDetection",tier:2,async collect(){const e=!!navigator.webdriver,t=function(){const e=[];try{const t=Object.getOwnPropertyNames(document);for(const n of t)/^\$?cdc_/.test(n)&&e.push(n)}catch{}const t=[["_Selenium_IDE_Recorder",()=>"t"in window],["__webdriver_evaluate",()=>"o"in document],["__driver_evaluate",()=>"i"in document],["__puppeteer_evaluation_script__",()=>"u"in window],["__playwright__binding__",()=>"l"in window],["__pwInitScripts",()=>"h"in window],["callPhantom",()=>"callPhantom"in window],["_phantom",()=>"m"in window],["__nightmare",()=>"p"in window],["domAutomation",()=>"domAutomation"in window],["domAutomationController",()=>"domAutomationController"in window]];for(const[n,r]of t)try{r()&&e.push(n)}catch{}return e}(),n=await async function(){const e=[];try{0===navigator.plugins.length&&window.chrome&&e.push("no_plugins_with_chrome")}catch{}0!==window.outerWidth&&0!==window.outerHeight||e.push("zero_outer_dimensions"),0===screen.availHeight&&e.push("zero_avail_height");try{0===navigator.languages.length&&e.push("empty_languages")}catch{}try{window.chrome&&void 0===window.chrome?.runtime&&e.push("chrome_without_runtime")}catch{}try{"undefined"!=typeof Notification&&"denied"===Notification.permission&&"prompt"===(await navigator.permissions.query({name:"notifications"})).state&&e.push("notification_permission_contradiction")}catch{}return e}(),r=function(){let e=null;try{if(e=document.createElement("canvas").getContext("webgl"),!e)return!1;const t=e.getExtension("WEBGL_debug_renderer_info");if(!t)return!1;const n=e.getParameter(t.UNMASKED_RENDERER_WEBGL);if("string"!=typeof n)return!1;const r=["swiftshader","google swiftshader","llvmpipe","mesa","software rasterizer","microsoft basic render driver"],o=n.toLowerCase();return r.some(e=>o.includes(e))}catch{return!1}finally{if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}}}();let o=0;return e&&(o+=30),t.length>0&&(o+=25),n.length>=2&&(o+=20),r&&(o+=25),{webdriver:e,automationMarkers:t,headlessIndicators:n,softwareRenderer:r,botScore:o}}},ct={name:"agentDetection",tier:2,async collect(){const e=function(){const e=[];try{13===navigator.hardwareConcurrency&&e.push("unusual_core_count_13")}catch{}try{4===navigator.deviceMemory&&6===navigator.hardwareConcurrency&&e.push("manus_hardware_signature")}catch{}try{1280===screen.width&&1100===screen.height&&e.push("manus_resolution")}catch{}try{if("UTC"===Intl.DateTimeFormat().resolvedOptions().timeZone){const t=navigator.languages||[],n=["en-GB","pt-PT","is","is-IS"];t.some(e=>n.includes(e))||e.push("utc_timezone_mismatch")}}catch{}return e}(),t=function(){try{const e=navigator.userAgent||"",t=navigator.userAgentData?.platform,n=navigator.platform||"";let r="";if(/Windows/.test(e)?r="Windows":/Macintosh|Mac OS X/.test(e)?r="macOS":/Android/.test(e)?r="Android":/iPhone|iPad|iPod/.test(e)?r="iOS":/Linux/.test(e)&&(r="Linux"),t){const e=t.toLowerCase();if("linux"===e&&("macOS"===r||"Windows"===r))return!1;if("windows"===e&&"macOS"===r)return!1;if("macos"===e&&"Windows"===r)return!1}if(n){const e=n.toLowerCase();if(e.includes("linux")&&("macOS"===r||"Windows"===r))return!1;if(e.includes("win")&&"macOS"===r)return!1;if(e.includes("mac")&&"Windows"===r)return!1}return!0}catch{return!0}}(),n=function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=(new Date).getTimezoneOffset();return"UTC"!==e||0===t}catch{return!0}}(),r=function(e,t){return e.includes("unusual_core_count_13")?"chatgpt":e.includes("manus_hardware_signature")&&e.includes("manus_resolution")?"manus":t?null:"operator"}(e,t);let o=0;return o+=25*e.length,t||(o+=30),r&&(o+=50),{fingerprintAnomalies:e,uaPlatformMatch:t,timezoneConsistent:n,detectedAgent:r,agentScore:o}}},lt={name:"tamperDetection",tier:2,async collect(){const e=function(){try{const e=navigator.userAgent||"",t=/Chrome\//.test(e)&&!/Edg\//.test(e),n=/Firefox\//.test(e)&&!/Chrome/.test(e),r="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-moz-appearance","none"),o=void 0!==window.chrome;return!(t&&r||n&&o)}catch{return!0}}(),t=function(){try{const e=Object.getOwnPropertyDescriptor(Navigator.prototype,"userAgent");if(!e)return!1;if(!e.get)return!1;const t=e.get.toString();return!!/\[native code\]/.test(t)}catch{return!0}}(),n=function(){try{const e=eval.toString().length;if(33!==e&&37!==e&&39!==e&&(e<20||e>60))return!1;try{if(1!==new(0,navigator.userAgent.constructor.constructor)("return 1")())return!1}catch{return!1}return!0}catch{return!0}}(),r=function(){const e=[];try{"_"in window&&e.push("multilogin")}catch{}try{void 0!==window.chrome&&0===navigator.plugins.length&&e.push("empty_plugins_chromium")}catch{}try{const t=window;if(t.safari){const n=t.safari.toString?.();n&&!/\[object Safari\]/.test(n)&&e.push("safari_object_spoofed")}}catch{}try{const t=navigator.userAgent||"",n=t.match(/Chrome\/(\d+)/);n&&parseInt(n[1],10)>=88&&/Macintosh/.test(t)&&void 0===window.BarcodeDetector&&e.push("missing_barcode_detector")}catch{}return e}(),o=function(){try{const e=((new Error).stack||"").split("\n").filter(e=>e.trim().length>0);for(const t of e){const e=t.trim();if("Error"!==e){if(/^\s*at\s/.test(e))return"chromium";if(/@/.test(e)&&!e.startsWith("at"))return/^\w+@/.test(e)?"gecko":"webkit"}}return"unknown"}catch{return"unknown"}}(),i=eval.toString().length;let a=0;if(e||(a+=30),t||(a+=25),n||(a+=20),a+=15*r.length,"unknown"!==o){const e=navigator.userAgent||"";("gecko"===o&&!/Firefox/.test(e)||"chromium"===o&&/Firefox/.test(e)&&!/Chrome/.test(e))&&(a+=10)}return{uaEngineConsistent:e,navigatorPropsNative:t,prototypeChainIntact:n,antiDetectMarkers:r,stackTraceFormat:o,evalLength:i,tamperScore:a}}},ut={name:"vmDetection",tier:2,async collect(){const e=function(){const e=[];try{navigator.hardwareConcurrency<=2&&e.push("low_core_count")}catch{}try{const t=navigator.deviceMemory;"number"==typeof t&&t<=2&&e.push("low_memory")}catch{}try{screen.colorDepth<24&&e.push("low_color_depth")}catch{}try{screen.colorDepth!==screen.pixelDepth&&e.push("depth_mismatch")}catch{}return e}();let t="",n=null;try{if(n=document.createElement("canvas").getContext("webgl"),n){const e=n.getExtension("WEBGL_debug_renderer_info");e&&(t=n.getParameter(e.UNMASKED_RENDERER_WEBGL)||"")}}catch{}finally{if(n)try{const e=n.getExtension("WEBGL_lose_context");e&&e.loseContext()}catch{}}const r=function(e){if(!e)return[];const t=e.toLowerCase();return dt.filter(e=>t.includes(e))}(t),o=function(e){if(!e)return!1;const t=e.toLowerCase();return mt.some(e=>t.includes(e))}(t);let i=0;return r.length>0?i=.9:o?i=.5:e.length>=3&&(i=.3),{isVM:r.length>0,vmRendererMatches:r,softwareRenderer:o,confidence:i,indicators:e}}},dt=["virtualbox","vmware","svga3d","qemu","parallels","hyper-v","qxl","red hat","virtio","citrix"],mt=["swiftshader","google swiftshader","llvmpipe","mesa","software rasterizer","microsoft basic render driver","softpipe"],pt=[{label:"h264",contentType:'video/mp4; codecs="avc1.42E01E"',width:1920,height:1080,bitrate:5e6,framerate:30},{label:"vp8",contentType:'video/webm; codecs="vp8"',width:1920,height:1080,bitrate:5e6,framerate:30},{label:"vp9",contentType:'video/webm; codecs="vp09.00.10.08"',width:1920,height:1080,bitrate:5e6,framerate:30},{label:"av1",contentType:'video/mp4; codecs="av01.0.05M.08"',width:1920,height:1080,bitrate:5e6,framerate:30}],ft=[{label:"aac",contentType:'audio/mp4; codecs="mp4a.40.2"',channels:"2",bitrate:128e3,samplerate:44100},{label:"opus",contentType:'audio/webm; codecs="opus"',channels:"2",bitrate:128e3,samplerate:48e3}],ht=[Z,J,ee,oe,ae,me,pe,fe,he,ge,ye,we,Se,_e,Ee,Ae,ke,Re,Ie,De,Fe,Ve,je,Ue,ze,Xe,qe,Ke,Ze,Qe,et,tt,ot,at,it,st,ct,lt,ut,{name:"devtoolsDetection",tier:2,collect:async()=>({dimensionDelta:function(){const e=window.outerHeight-window.innerHeight,t=window.outerWidth-window.innerWidth;return{heightDelta:e,widthDelta:t,likelyOpen:e>200||t>200}}(),consoleNative:function(){try{return/\[native code\]/.test(Function.prototype.toString.call(console.log))}catch{return!0}}()})},{name:"webApis",tier:2,async collect(){const e=navigator,t=window;return{credentials:void 0!==e.credentials,usb:void 0!==e.usb,bluetooth:void 0!==e.bluetooth,clipboard:void 0!==e.clipboard,serial:void 0!==e.serial,hid:void 0!==e.hid,xr:void 0!==e.xr,share:"function"==typeof e.share,wakeLock:void 0!==e.wakeLock,presentation:void 0!==e.presentation,mediaSession:void 0!==e.mediaSession,ink:void 0!==e.ink,virtualKeyboard:void 0!==e.virtualKeyboard,eyeDropper:void 0!==t.EyeDropper,getScreenDetails:"function"==typeof t.getScreenDetails,paymentRequest:void 0!==t.PaymentRequest,adoptedStyleSheets:void 0!==document.adoptedStyleSheets,cssHighlights:void 0!==t.CSS?.highlights}}},{name:"notificationState",tier:2,async collect(){const e="undefined"!=typeof Notification;return{supported:e,permission:e?Notification.permission:null}}},{name:"extendedLocale",tier:2,collect:async()=>({languages:Array.from(navigator.languages??[])})},{name:"privacyPrefs",tier:2,async collect(){const e=navigator;return{doNotTrack:navigator.doNotTrack??null,globalPrivacyControl:e.globalPrivacyControl??null}}},{name:"performanceContext",tier:2,async collect(){let e=null;try{const t=performance.getEntriesByType("navigation");t.length>0&&(e=t[0].nextHopProtocol||null)}catch{}let t=[];try{t=Array.from(PerformanceObserver.supportedEntryTypes??[])}catch{}return{nextHopProtocol:e,supportedEntryTypes:t}}},{name:"sensors",tier:2,async collect(){const e=window;return{deviceOrientation:void 0!==e.DeviceOrientationEvent,deviceMotion:void 0!==e.DeviceMotionEvent,gyroscope:void 0!==e.Gyroscope,accelerometer:void 0!==e.Accelerometer,ambientLightSensor:void 0!==e.AmbientLightSensor,absoluteOrientationSensor:void 0!==e.AbsoluteOrientationSensor,relativeOrientationSensor:void 0!==e.RelativeOrientationSensor}}},{name:"battery",tier:2,collect:async()=>({supported:"function"==typeof navigator.getBattery})},{name:"gamepads",tier:2,collect:async()=>({supported:"function"==typeof navigator.getGamepads})},{name:"storage",tier:2,async collect(){let e=null;try{navigator.storage?.estimate&&(e=(await navigator.storage.estimate()).quota??null)}catch{}let t=!1;try{t=void 0!==window.indexedDB}catch{}let n=!1;try{n=void 0!==window.localStorage}catch{}let r=!1;try{r=void 0!==window.caches}catch{}return{quota:e,indexedDB:t,localStorage:n,cacheApi:r}}},{name:"features",tier:2,async collect(){const e=window;return{isSecureContext:!!e.isSecureContext,webdriver:!!navigator.webdriver,crossOriginIsolated:!!e.crossOriginIsolated,sharedArrayBuffer:void 0!==e.SharedArrayBuffer,webAssembly:void 0!==e.WebAssembly,bigInt:void 0!==e.BigInt,offscreenCanvas:void 0!==e.OffscreenCanvas}}},{name:"screen",tier:2,async collect(){const e=window.visualViewport;return{availWidth:screen.availWidth??0,availHeight:screen.availHeight??0,devicePixelRatio:window.devicePixelRatio??1,orientationType:screen.orientation?.type??null,orientationAngle:screen.orientation?.angle??null,visualViewport:e?{width:e.width,height:e.height,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,scale:e.scale}:null}}},{name:"mediaCapabilities",tier:2,async collect(){if(!navigator.mediaCapabilities?.decodingInfo)return null;const e={},t=[...pt.map(e=>({label:e.label,config:{type:"file",video:{contentType:e.contentType,width:e.width,height:e.height,bitrate:e.bitrate,framerate:e.framerate}}})),...ft.map(e=>({label:e.label,config:{type:"file",audio:{contentType:e.contentType,channels:e.channels,bitrate:e.bitrate,samplerate:e.samplerate}}}))];return await Promise.allSettled(t.map(async({label:t,config:n})=>{try{const r=await navigator.mediaCapabilities.decodingInfo(n);e[t]={supported:r.supported,smooth:r.smooth,powerEfficient:r.powerEfficient}}catch{e[t]=null}})),e}}];async function gt(e,t,n){const r={},o=[],i=ht.filter(t=>!e.has(t.name)&&(n||3!==t.tier)),a=await Promise.allSettled(i.map(async e=>{const n=await(r=e.collect(),o=t,new Promise((e,t)=>{const n=setTimeout(()=>e(null),o);r.then(t=>{clearTimeout(n),e(t)},e=>{clearTimeout(n),t(e)})}));var r,o;return{name:e.name,value:n}}));for(let e=0;e<a.length;e++){const t=a[e],n=i[e].name;"fulfilled"===t.status&&null!==t.value.value?r[n]=t.value.value:"rejected"===t.status&&o.push({signal:n,error:String(t.reason?.message??t.reason)})}return{components:r,errors:o}}async function yt(t){const r=function(e){return e?{exclude:e.exclude??n.exclude,include:e.include??n.include,timeout:e.timeout??n.timeout,stabilize:e.stabilize??n.stabilize,experimental:e.experimental??n.experimental,debug:e.debug??n.debug,salt:e.salt??n.salt}:{...n}}(t),i=a(),s=function(){try{return window.self!==window.top}catch{return!0}}();let c=!1;try{c=await l(i.name)}catch{}const u=function(e,t,n,r){const i=new Set;for(const a of e){if("private"===a&&!n)continue;if("iframe"===a&&!r)continue;const e=o[a];if(e)for(const n of e)if(!n.browsers||n.browsers.includes(t))for(const e of n.exclude)i.add(e)}return i}(r.stabilize,i.name,c,s),d=new Set(r.exclude);for(const e of r.include)d.delete(e),u.delete(e);const{components:f,errors:h}=await gt(d,r.timeout,r.experimental),m=$(Object.fromEntries(Object.entries(f).filter(([e])=>!u.has(e))),r.salt,c),p=m[0],g={hash:p.hash,stableHash:p.stableHash,components:{...f},timestamp:(new Date).toISOString(),version:e,isIncognito:c,errors:h,hashPolicyVersion:p.policyVersion,hashes:m,browser:{...i}};return r.debug&&(console.log("[fingerprint] components:",f),console.log("[fingerprint] hash:",p.hash,"stableHash:",p.stableHash),h.length>0&&console.warn("[fingerprint] errors:",h)),g}new Set([...F,"fontPreferences","webglRender","clientHints","canvasTextMetrics","mediaCapabilities","features","sensors","webApis","performanceContext"]);const xt=new RegExp(["googlebot","bingbot","slurp","baiduspider","duckduckbot","yandex","sogou","exabot","ia_archiver","curl","wget","python-requests","python-urllib","axios","node-fetch","go-http-client","java/","libwww-perl","okhttp","apache-httpclient","http_request","httpie","headlesschrome","phantomjs","puppeteer","playwright","cypress","selenium","webdriver","electron","jsdom","vercel-screenshot","screenshot","prerender","lighthouse","chrome-lighthouse","pagespeed","gtmetrix","pingdom","nessus","nikto","sqlmap","burp","zap","qualys","openvas","nmap","masscan","facebookexternalhit","twitterbot","linkedinbot","whatsapp","telegrambot","slackbot","discordbot","bot","crawl","spider","scrape","fetch","scan"].join("|"),"i");function St(e){return!!e&&xt.test(e)}const S3_FINGERPRINT_URL="https://unshared-public.s3.us-east-2.amazonaws.com/fingerprint@1/fingerprint.umd.js",PROXY_FINGERPRINT_PATH="/__unshared/fingerprint.js",DEFAULT_LOAD_TIMEOUT_MS=1500;let cached;function resolveLoadTimeoutMs(){const e=globalThis.__UNSHARED_FP_LOAD_TIMEOUT_MS;return"number"==typeof e?e:1500}function readGlobalAgent(){if("undefined"==typeof window)return;const e=window.UnsharedFingerprint;return"function"==typeof e?.getFingerprint?e.getFingerprint:void 0}function injectScript(e,t){return new Promise(n=>{if("undefined"==typeof document||!document.head)return void n();let r=!1;const o=()=>{r||(r=!0,clearTimeout(i),n())},i=setTimeout(o,t),a=document.createElement("script");a.src=e,a.async=!0,a.onload=o,a.onerror=o,document.head.appendChild(a)})}function loadFingerprintAgent(e){return cached||(cached=(async()=>{const t=readGlobalAgent();if(t)return{getFingerprint:t,source:"remote"};const n=e.isProxy?`${e.proxyBaseUrl??""}${PROXY_FINGERPRINT_PATH}`:S3_FINGERPRINT_URL;await injectScript(n,resolveLoadTimeoutMs());const r=readGlobalAgent();return r?{getFingerprint:r,source:"remote"}:{getFingerprint:yt,source:"bundled"}})(),cached)}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},index_umd={exports:{}};!function(e){function t(e,t){return e&&(/^#[0-9a-fA-F]{3,8}$/.test(e)||/^rgba?\(\s*[\d.,\s]+\)$/.test(e))?e:t}const n=/^[a-zA-Z0-9\s,\-'"]+$/;function r(e){return e&&/^\d+(\.\d+)?(px|rem|em|%)?$/.test(e)?e:"8px"}const o=new Set;function i(e,t){let n=e;for(const e of t.split(".")){if(null==n||"object"!=typeof n)return"";n=n[e]}return null==n?"":String(n)}function a(e){if(!e)return"";const t=e.indexOf("@");if(t>0){const n=e.slice(0,t),r=e.slice(t);return`${n.slice(0,1)}${"*".repeat(Math.max(n.length-1,1))}${r}`}return e.length<=4?"*".repeat(e.length):`${"*".repeat(e.length-4)}${e.slice(-4)}`}function s(e,t,n,r){return"runtime"===t.source?t.path?i({user:n.user??{},device:n.device??{}},t.path):"":r.get(e)??""}const c={email_verification:{"verify-email":{op:"triggerEmailVerification",inputs:["email","deviceId"]},"verify-otp":{op:"verify",inputs:["email","deviceId","otp"]},"resend-verification":{op:"triggerEmailVerification",inputs:["email","deviceId"]}}};function u(e){const t=(e??"").trim();if(""===t)return!1;const n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;const r=n[1].toLowerCase();return"http"===r||"https"===r}function l(e){return{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`}}function d(e){return"string"!=typeof e?null:/^#[0-9a-fA-F]{3,8}$/.test(e)||/^rgba?\(\s*[\d.,\s]+\)$/.test(e)?e:null}function f(e,t,r={}){const o=t.props,i="heading"===t.type||"text"===t.type,a=o.fontSize;"number"==typeof a&&a>=8&&a<=120&&(e.style.fontSize=`${a}px`);const s=o.align,c="left"===s||"center"===s||"right"===s?s:void 0;c&&(e.style.textAlign=c);const u="boolean"==typeof o.bold?o.bold:r.bold;void 0!==u&&(e.style.fontWeight=u?"700":"400"),!0===o.italic&&(e.style.fontStyle="italic"),!0===o.underline&&(e.style.textDecoration="underline");const l="string"!=typeof(f=o.fontFamily)||""===f?null:n.test(f)?f:null;var f;l&&(e.style.fontFamily=l);const h=d(o.textColor)??r.color??null;h&&(e.style.color=h,i&&(e.style.opacity="1"));const m=o.verticalAlign;!i||"middle"!==m&&"bottom"!==m||(e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="bottom"===m?"flex-end":"center",e.style.alignItems="center"===c?"center":"right"===c?"flex-end":"flex-start")}function h(e,t){const n="string"==typeof e.props.binding?e.props.binding:"";return n&&t.flow.bindings[n]?function(e,t,n,r){if("never"===t.display)return"";const o=s(e,t,n,r);return"masked"===t.display?a(o):o}(n,t.flow.bindings[n],t.ctx,t.formState):String(e.props.text??"")}function m(e,t){const n=document.createElement("div");return n.className="el el-heading",Object.assign(n.style,l(e)),f(n,e,{bold:!0}),n.textContent=h(e,t),n}function p(e,t){const n=document.createElement("div");return n.className="el el-text",Object.assign(n.style,l(e)),f(n,e,{bold:!1}),n.textContent=h(e,t),n}function g(e){const t=document.createElement("img");return t.className="el el-image",Object.assign(t.style,l(e)),t.src=String(e.props.src??""),t.alt=String(e.props.alt??""),t}function y(e){const t=document.createElement("div");return t.className="el el-divider",t.style.left=`${e.x}px`,t.style.top=`${e.y+e.height/2}px`,t.style.width=`${e.width}px`,t}function _(e,t){const n=document.createElement("input");n.className="el el-input",Object.assign(n.style,l(e)),f(n,e),"string"==typeof e.props.placeholder&&(n.placeholder=e.props.placeholder),"number"==typeof e.props.maxLength&&(n.maxLength=e.props.maxLength),"string"==typeof e.props.pattern&&(n.pattern=e.props.pattern),"otp"===e.props.fieldType?n.inputMode="numeric":"email"===e.props.fieldType&&(n.type="email"),!0===e.props.autoFocus&&(n.autofocus=!0);const r=t.elementToBinding.get(e.id)??String(e.props.name??e.id);return n.value=t.formState.get(r)??"",n.addEventListener("input",()=>t.formState.set(r,n.value)),n}function v(e,t){const n=e?.goTo??e?.advanceTo;e?.dismiss?t.close():"string"==typeof n&&(t.screenState.goTo(n),t.screenState.isLast&&t.complete())}function w(e,t,n,r){e?.showError&&n(t instanceof Error&&t.message?t.message:"Something went wrong. Please try again."),e?.dismiss&&r.close()}function b(e,t,n){const r=document.createElement("button"),o="secondary"===e.props.variant?"secondary":"primary";r.className=`el el-button el-button-${o}`,Object.assign(r.style,l(e));const i=d(e.props.bgColor);return i&&(r.style.background=i),f(r,e),r.textContent=String(e.props.text??"Continue"),r.addEventListener("click",()=>{!async function(e,t,n,r){const o=String(e.props.action??"");if(!o)return;if("close"===o)return void t.close();if("prev-screen"===o)return void t.screenState.prev();if("next-screen"===o){if(t.screenState.isLast)return;return t.screenState.next(),void(t.screenState.isLast&&t.complete())}const i=t.flow.actions[o],a=e=>{r.textContent=e,r.classList.add("visible")};if("client_steps"===i?.type){const s=Array.isArray(e.props.steps)?e.props.steps:[];if(0===s.length)return void("undefined"!=typeof console&&console.warn(`[interstitial] client_steps action "${o}" has no steps`));r.classList.remove("visible"),n.disabled=!0;try{await async function(e){for(const t of e){if("redirect"===t.type)return u(t.url)?void window.location.assign(t.url):void("undefined"!=typeof console&&console.warn(`[interstitial] blocked unsafe redirect url: ${t.url}`));if("webhook"===t.type){const e=await fetch(t.url,{method:t.method??"POST",credentials:"same-origin"});if(!e.ok)throw new Error(`webhook ${t.url} returned ${e.status}`)}else"undefined"!=typeof console&&console.warn(`[interstitial] unknown step type: ${t.type}`)}}(s),v(i.onSuccess,t)}catch(e){w(i.onError,e,a,t)}finally{n.disabled=!1}return}const l=function(e,t,n,r){const o=c[e.flowType]?.[t];if(!o)return null;const i={};for(const t of o.inputs){const o=e.bindings[t];o&&(i[t]=s(t,o,n,r))}return{op:o.op,values:i}}(t.flow,o,t.ctx,t.formState);if(l){r.classList.remove("visible"),n.disabled=!0;try{await t.ctx.actions(l.op,l.values),v(i?.onSuccess,t)}catch(e){w(i?.onError,e,a,t)}finally{n.disabled=!1}}else"undefined"!=typeof console&&console.warn(`[interstitial] unknown action: ${o}`)}(e,t,r,n)}),r}function S(e,t,n){Array.from(t.children).forEach(e=>e.remove());const r=document.createElement("div");r.className="el-error",r.style.left="0",r.style.right="0",r.style.bottom="12px";for(const o of e.elements){let e=null;switch(o.type){case"heading":e=m(o,n);break;case"text":e=p(o,n);break;case"image":e=g(o);break;case"divider":e=y(o);break;case"input":e=_(o,n);break;case"button":e=b(o,n,r);break;default:e=null}e&&t.appendChild(e)}t.appendChild(r)}e.maskValue=a,e.renderFlow=function(e,i){const a=i.container??document.body,s=new Map,c=function(e){const t=new Map;for(const[n,r]of Object.entries(e.bindings))"form"===r.source&&r.elementId&&t.set(r.elementId,n);return t}(e);let u=!1;const l=()=>{u||(u=!0,d.destroy())},d=function(e,i,a){const s={primaryColor:t(e.primaryColor,"#4f46e5"),backgroundColor:t(e.backgroundColor,"#ffffff"),textColor:t(e.textColor,"#111827"),fontFamily:(c=e.fontFamily,c&&n.test(c)?c:"sans-serif"),borderRadius:r(e.borderRadius)};var c;const u=document.createElement("div");u.id="__unshared-interstitial-host",Object.assign(u.style,{position:"fixed",inset:"0",zIndex:"2147483647"}),a.appendChild(u),o.add(u);const l=u.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent=`\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n :host { all: initial; }\n .backdrop {\n position: fixed; inset: 0;\n /* Frost the page behind the modal: a lighter scrim reads as "blurred content"\n rather than "blacked out". Browsers without backdrop-filter fall back to the\n scrim alone, so it degrades to a plain dim — never worse. On the blockFlagged\n gate page there is no content behind it, so this has no visible effect there. */\n background: rgba(0,0,0,0.35);\n -webkit-backdrop-filter: blur(6px);\n backdrop-filter: blur(6px);\n display: flex; align-items: center; justify-content: center;\n }\n .frame {\n position: relative;\n background: ${function(e,n){const r=e.backgroundGradient;if(r&&"object"==typeof r){const{from:e,to:n,angle:o}=r,i=t(e,""),a=t(n,""),s="number"==typeof o&&isFinite(o)?o:180;if(i&&a)return`linear-gradient(${s}deg, ${i}, ${a})`}return n}(e,s.backgroundColor)};\n color: ${s.textColor};\n font-family: ${s.fontFamily};\n border-radius: ${s.borderRadius};\n width: ${i.width}px;\n height: ${i.height}px;\n max-width: 95vw; max-height: 95vh;\n overflow: hidden;\n box-shadow: 0 20px 60px rgba(0,0,0,0.3);\n }\n .frame:focus { outline: none; }\n .el { position: absolute; }\n .el-heading { font-weight: 700; line-height: 1.2; color: ${s.textColor}; }\n .el-text { color: ${s.textColor}; opacity: 0.75; line-height: 1.5; }\n .el-image { object-fit: contain; }\n /* Hairline: uses the frame's text color at low opacity so it reads on light AND dark themes. */\n .el-divider { background: currentColor; opacity: 0.12; height: 1px; }\n .el-input {\n width: 100%; height: 100%;\n border: 1.5px solid #D1D5DB; border-radius: ${s.borderRadius};\n padding: 0 12px; font-family: ${s.fontFamily}; outline: none;\n transition: border-color 0.15s;\n }\n .el-input:focus { border-color: ${s.primaryColor}; }\n .el-button {\n width: 100%; height: 100%;\n border-radius: ${s.borderRadius}; font-weight: 600;\n font-family: ${s.fontFamily}; cursor: pointer; transition: opacity 0.15s;\n }\n .el-button:hover { opacity: 0.9; }\n .el-button:disabled { opacity: 0.5; cursor: not-allowed; }\n .el-button-primary { background: ${s.primaryColor}; color: #fff; border: none; }\n .el-button-secondary { background: transparent; color: ${s.primaryColor}; border: 1.5px solid ${s.primaryColor}; }\n .el-error {\n position: absolute; color: #DC2626; font-size: 13px;\n display: none; text-align: center;\n }\n .el-error.visible { display: block; }\n `,l.appendChild(d);const f=document.createElement("div");f.className="backdrop";const h=document.createElement("div");h.className="frame",h.setAttribute("role","dialog"),h.setAttribute("aria-modal","true"),h.tabIndex=-1,f.appendChild(h),l.appendChild(f);const m=document.body.style.overflow;document.body.style.overflow="hidden";const p=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation())};document.addEventListener("keydown",p,!0);const g=e=>{const t=e.target;if(t){for(const e of o)if(e.contains(t))return;h.focus()}};return document.addEventListener("focusin",g,!0),h.focus(),{shadowRoot:l,frame:h,destroy:()=>{document.removeEventListener("keydown",p,!0),document.removeEventListener("focusin",g,!0),document.body.style.overflow=m,o.delete(u),u.remove()}}}(e.theme,e.frame,a),f={flow:e,ctx:i,formState:s,elementToBinding:c,screenState:void 0,close:()=>{l(),i.onDismiss?.()},complete:()=>i.onComplete?.()},h=function(e,t,n){let r=Math.max(e.findIndex(e=>e.id===t),0);return{get current(){return e[r]},get isLast(){return r===e.length-1},next(){r<e.length-1&&(r++,n(e[r]))},prev(){r>0&&(r--,n(e[r]))},goTo(t){const o=e.findIndex(e=>e.id===t);-1!==o&&o!==r&&(r=o,n(e[r]))}}}(e.screens,e.initialScreenId,e=>{S(e,d.frame,f)});return f.screenState=h,S(h.current,d.frame,f),{destroy:l}},e.resolvePath=i}(index_umd.exports);var index_umdExports=index_umd.exports;const SENTINEL_USER_IDS=new Set(["__pre_auth__","anonymous","guest","undefined","null"]);function isSentinelUserId(e){return"string"==typeof e&&SENTINEL_USER_IDS.has(e)}const DEFAULT_MAX_RETRIES=3,DEFAULT_TIMEOUT_MS=3e4,MAX_TOTAL_RETRY_MS=8e3,MAX_DELAY_MS=3e4,BASE_DELAY_MS=1e3,SUBMIT_FP_PATH="/__unshared/submit-fp",PROXY_FLOW_PATH="/__unshared/interstitial-flow",PROXY_VERIFY_TRIGGER_PATH="/__unshared/verify-trigger",PROXY_VERIFY_PATH="/__unshared/verify",RECONCILED_HEADER="X-Unshared-Enforcement-Reconciled",DIRECT_SUBMIT_PATH="/v3/browser/submit-fingerprint-event",DIRECT_CHECK_PATH="/v3/browser/check-user",DIRECT_TRIGGER_PATH="/v3/browser/trigger-email-verification",DIRECT_VERIFY_PATH="/v3/browser/verify",DIRECT_STATUS_PATH="/v2/browser/email-verification-status",DIRECT_FLOW_PATH="/v2/browser/interstitial-flow",DEFAULT_API_URL=["http","s://","api.","unsh","ared",".ai"].join(""),SS_EMAIL_KEY="__unshared_email",SS_FP_KEY="__unshared_fp",SS_LAST_SUBMIT_KEY="__unshared_last_submit",SS_RAW_FP_KEY="__unshared_fp_raw",SS_VERIFICATION_KEY="__unshared_verification_id",LS_DEVICE_ID="__unshared_device_id",LS_EVENT_QUEUE="__unshared_event_queue",LS_EVENT_QUEUE_INFLIGHT="__unshared_event_queue_inflight",COOKIE_UID="__unshared_uid",COOKIE_SID="__unshared_sid",COOKIE_DEVICE_ID="__unshared_device_id",COOKIE_STABLE_HASH="__unshared_stable_hash",COOKIE_FULL_HASH="__unshared_full_hash",COOKIE_FP_ID="__unshared_fp_id",SDK_VERSION="3.0.0",MAX_REQUEST_BYTES=1<<20,MAX_PROXY_REQUEST_BYTES=102400,MAX_ENCRYPTED_REQUEST_BYTES=1572864,SESSION_STORAGE_CAPTURE_KEYS=[SS_EMAIL_KEY,SS_LAST_SUBMIT_KEY,SS_VERIFICATION_KEY],UUID_V4_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,OTP_PATTERN=/^\d{6}$/,RFC3339_PATTERN=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/,CHECK_RETRYABLE_CODES=new Set(["RATE_LIMIT_UNAVAILABLE","AUDIT_UNAVAILABLE"]),BUILD_TIME_PUBLISHABLE_KEY="__UNSHARED_PUBLISHABLE_API_KEY__";function generateUUID(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function generatePermanentDeviceId(){return`upid_${generateUUID()}`}function isPermanentDeviceId(e){return"string"==typeof e&&/^upid_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function sleep(e){return new Promise(t=>setTimeout(t,e))}function retryDelay(e){const t=Math.min(1e3*Math.pow(2,e-1),3e4),n=500*Math.random()-250;return Math.max(0,t+n)}function getCookie(e){try{if("undefined"==typeof document)return;const t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}catch{return}}function secureSuffix(){try{return"undefined"!=typeof location&&"https:"===location.protocol?"; Secure":""}catch{return""}}function setCookie(e,t){try{if("undefined"==typeof document)return;document.cookie=`${e}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Max-Age=31536000${secureSuffix()}`}catch{}}function setPersistentCookie(e,t){try{if("undefined"==typeof document)return;document.cookie=`${e}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Max-Age=34560000${secureSuffix()}`}catch{}}function deleteCookie(e){try{if("undefined"==typeof document)return;document.cookie=`${e}=; Path=/; SameSite=Lax; Expires=Thu, 01 Jan 1970 00:00:00 GMT${secureSuffix()}`}catch{}}function getLocalStorageItem(e){try{if("undefined"==typeof localStorage)return;return localStorage.getItem(e)??void 0}catch{return}}function setLocalStorageItem(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch{}}function removeLocalStorageItem(e){try{if("undefined"==typeof localStorage)return;localStorage.removeItem(e)}catch{}}function getSessionStorageItem(e){try{if("undefined"==typeof sessionStorage)return;return sessionStorage.getItem(e)??void 0}catch{return}}function compareStorageEntries(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function collectCookies(){try{return"undefined"==typeof document?[]:document.cookie.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{const t=e.indexOf("="),n=-1===t?e:e.slice(0,t),r=-1===t?"":e.slice(t+1);try{return{name:n,value:decodeURIComponent(r)}}catch{return{name:n,value:r}}}).sort(compareStorageEntries)}catch{return[]}}function collectStorage(e,t){try{if(!e)return[];const n=[];for(const r of t){const t=e.getItem(r);null!==t&&n.push({name:r,value:t})}return n.sort(compareStorageEntries)}catch{return[]}}function collectBrowserStorage(){let e,t;try{e="undefined"==typeof localStorage?void 0:localStorage}catch{}try{t="undefined"==typeof sessionStorage?void 0:sessionStorage}catch{}return{cookies:collectCookies(),local_storage:collectStorage(e,[LS_DEVICE_ID]),session_storage:collectStorage(t,SESSION_STORAGE_CAPTURE_KEYS)}}function setSessionStorageItem(e,t){try{if("undefined"==typeof sessionStorage)return;sessionStorage.setItem(e,t)}catch{}}function asJSONObject(e){return null===e||"object"!=typeof e||Array.isArray(e)?{}:e}function isJSONObject(e,t=new WeakSet){if(null===e||"object"!=typeof e||Array.isArray(e)||t.has(e))return!1;const n=Object.getPrototypeOf(e);if(n!==Object.prototype&&null!==n)return!1;t.add(e);for(const n of Object.values(e))if(null!==n&&"string"!=typeof n&&"boolean"!=typeof n&&!("number"==typeof n&&Number.isFinite(n)||Array.isArray(n)&&isJSONValue(n,t)||isJSONObject(n,t)))return!1;return t.delete(e),!0}function isJSONValue(e,t){if(null===e||"string"==typeof e||"boolean"==typeof e)return!0;if("number"==typeof e)return Number.isFinite(e);if(Array.isArray(e)){if(t.has(e))return!1;t.add(e);let n=Object.keys(e).length===e.length;for(let r=0;n&&r<e.length;r++)n=Object.prototype.hasOwnProperty.call(e,r)&&isJSONValue(e[r],t);return t.delete(e),n}return isJSONObject(e,t)}function hasExactKeys(e,t){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&(Object.keys(e).length===t.length&&t.every(t=>Object.prototype.hasOwnProperty.call(e,t)))}function isValidTimestamp(e){if("string"!=typeof e)return!1;const t=RFC3339_PATTERN.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]),i=Number(t[4]),a=Number(t[5]),s=Number(t[6]),c=Number(t[7]??0),u=Number(t[8]??0);return r>=1&&r<=12&&o>=1&&o<=[31,n%4!=0||n%100==0&&n%400!=0?28:29,31,30,31,30,31,31,30,31,30,31][r-1]&&i<=23&&a<=59&&s<=59&&c<=23&&u<=59}function isStrictSuccessEnvelope(e){return hasExactKeys(e,["success","data"])&&!0===e.success}function isStrictErrorEnvelope(e){return hasExactKeys(e,["success","error"])&&!1===e.success&&hasExactKeys(e.error,["code","message"])&&"string"==typeof e.error.code&&"string"==typeof e.error.message}function isIngestResult(e){return hasExactKeys(e,["event_id","collected_at","endpoint_version"])&&"string"==typeof e.event_id&&UUID_V4_PATTERN.test(e.event_id)&&isValidTimestamp(e.collected_at)&&"v3"===e.endpoint_version}function isCheckUserResult(e){if(!hasExactKeys(e,["is_user_flagged","decision_id","decision_code"]))return!1;const t=new Set(["FLAGGED_RISK_MATCH","NO_ENFORCING_RISK","NO_IDENTITY_MATCH","IDENTITY_UNCERTAIN","CHECK_UNAVAILABLE"]);return"boolean"==typeof e.is_user_flagged&&"string"==typeof e.decision_id&&UUID_V4_PATTERN.test(e.decision_id)&&"string"==typeof e.decision_code&&t.has(e.decision_code)&&e.is_user_flagged===("FLAGGED_RISK_MATCH"===e.decision_code)}function isTriggerEmailResult(e){return hasExactKeys(e,["verification_id","next_allowed_at","retry_after_seconds"])&&"string"==typeof e.verification_id&&UUID_V4_PATTERN.test(e.verification_id)&&isValidTimestamp(e.next_allowed_at)&&Number.isInteger(e.retry_after_seconds)&&e.retry_after_seconds>=0}function isVerifyEmailResult(e){return hasExactKeys(e,["verified","verification_scope"])?!0===e.verified&&"email"===e.verification_scope:hasExactKeys(e,["verified","verification_scope","reason"])&&!1===e.verified&&"email"===e.verification_scope&&"invalid_code"===e.reason}function stringField(e,...t){for(const n of t){const t=e[n];if("string"==typeof t&&""!==t.trim())return t}}function getSharedDedup(){if("undefined"==typeof window)return;const e=window;return e.__unshared=e.__unshared||{}}function isValidUrl(e){try{return new URL(e),!0}catch{return!1}}function isSecureOrLoopbackUrl(e){const t=new URL(e);return"https:"===t.protocol||"localhost"===t.hostname||"[::1]"===t.hostname||/^127\./.test(t.hostname)}function resolveDefaultPublishableKey(e){if(void 0===e)return BUILD_TIME_PUBLISHABLE_KEY.startsWith("__UNSHARED_")?void 0:BUILD_TIME_PUBLISHABLE_KEY}function hasWebCrypto(){return"undefined"!=typeof crypto&&!!crypto.subtle&&!!crypto.getRandomValues}async function sha256Hex(e){if(hasWebCrypto())try{const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch{return}}function bytesToBase64(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function encryptEvent(e,t){if(!hasWebCrypto())throw new Error("WebCrypto is unavailable");const n=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)),r=await crypto.subtle.importKey("raw",n,{name:"AES-GCM"},!1,["encrypt"]),o=crypto.getRandomValues(new Uint8Array(12)),i=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,tagLength:128},r,(new TextEncoder).encode(e))),a=i.slice(i.length-16),s=i.slice(0,i.length-16);return JSON.stringify({encrypted_data:`${bytesToBase64(o)}:${bytesToBase64(a)}:${bytesToBase64(s)}`})}class UnsharedBrowser{constructor(e={}){var t;if(this.v=!1,this.S=!1,e.baseUrl&&!isValidUrl(e.baseUrl))throw new Error('baseUrl must be a valid URL (e.g. "https://app.example.com")');if(e.apiUrl&&!isValidUrl(e.apiUrl))throw new Error('apiUrl must be a valid URL (e.g. ["http","s://","api.","unsh","ared",".ai"].join(""))');if(e.baseUrl&&!isSecureOrLoopbackUrl(e.baseUrl))throw new Error("baseUrl must use HTTPS except for loopback development URLs");if(e.apiUrl&&!isSecureOrLoopbackUrl(e.apiUrl))throw new Error("apiUrl must use HTTPS except for loopback development URLs");let n,r;this.I=e.baseUrl?e.baseUrl.replace(/\/$/,""):"",this.T=e.publishableKey??resolveDefaultPublishableKey(e.baseUrl),this.A=(e.apiUrl??DEFAULT_API_URL).replace(/\/$/,""),this.C=e.maxRetries??3,this.R=e.timeout??3e4,this.O=e.includePathPrefix,this.P=e.skipPaths,this.D=e.sessionId,this.k=e.deviceId,this.L=e.enableInterstitial??!1,this.U=e.interstitialFlowType??"email_verification",this.M=getSharedDedup()??{},this.M.generation||((t=this.M).lastKey??(t.lastKey=getSessionStorageItem(SS_LAST_SUBMIT_KEY))),removeLocalStorageItem(LS_EVENT_QUEUE),removeLocalStorageItem(LS_EVENT_QUEUE_INFLIGHT);try{n=this.D?.()}catch{}this.N=n??this.M.sessionId??getCookie(COOKIE_SID)??generateUUID(),this.M.sessionId=this.N,setPersistentCookie(COOKIE_SID,this.N);try{r=this.k?.()}catch{}if(r)this.F=r;else{const e=getLocalStorageItem(LS_DEVICE_ID);this.F=isPermanentDeviceId(e)?"":e??""}const o=getLocalStorageItem(LS_DEVICE_ID);this.B=isPermanentDeviceId(o)?o:"",this.$(),this.L&&this.V()}async init(e){try{if("undefined"!=typeof navigator&&St(navigator.userAgent))return;if(!e.userId||isSentinelUserId(e.userId))return void this.K;if(!1===e.isPaidSubscriber)return void(this.v=!0);this.v=!1;const t=this.M.generation??0;this.j(),this.K=e.userId,this.H=e.emailAddress,setSessionStorageItem(SS_EMAIL_KEY,e.emailAddress),setCookie(COOKIE_UID,e.userId);const{wire:n,raw:r}=await this.Y();if(t!==(this.M.generation??0)||this.K!==e.userId||this.v)return;let o;try{o=this.k?.()}catch{}o?this.F=o:n.fingerprint_id&&(this.F=n.fingerprint_id),this.G(n,r,t).catch(()=>{})}catch{}}onRouteChange(){try{if(!(this.H??this.W()))return;const e=this.q();if(!e)return;this.G(e.wire,e.raw).catch(()=>{})}catch{}}destroy(){try{this.M.generation=(this.M.generation??0)+1,delete this.M.collection,delete this.M.collectionPromise,delete this.M.lastKey;try{"undefined"!=typeof sessionStorage&&(sessionStorage.removeItem(SS_EMAIL_KEY),sessionStorage.removeItem(SS_FP_KEY),sessionStorage.removeItem(SS_RAW_FP_KEY),sessionStorage.removeItem(SS_LAST_SUBMIT_KEY),sessionStorage.removeItem(SS_VERIFICATION_KEY))}catch{}deleteCookie(COOKIE_UID),this.J&&"undefined"!=typeof document&&(document.removeEventListener("DOMContentLoaded",this.J),this.J=void 0),this.X&&"undefined"!=typeof window&&(window.removeEventListener("unshared:flagged",this.X),this.X=void 0),this.Z?.destroy(),this.Z=void 0,this.S=!1,this.K=void 0,this.H=void 0,this.v=!1}catch{}}async collect(e){return(await this.ee(e)).wire}async collectRaw(e){return(await this.ee(e)).raw}async collectWithMetadata(e){return this.ee(e)}async ee(e){const{getFingerprint:t,source:n}=await loadFingerprintAgent({proxyBaseUrl:this.I,isProxy:!this.T}),r=asJSONObject(await t(e)),o=stringField(r,"stableHash","stable_hash","fingerprint_id")??"",i=stringField(r,"hash","full_hash")??"";return{raw:r,wire:{...r,fingerprint_id:o,full_hash:i,components:asJSONObject(r.components),timestamp:stringField(r,"timestamp","collected_at")??(new Date).toISOString(),isIncognito:"boolean"==typeof r.isIncognito&&r.isIncognito,version:stringField(r,"version")??"unknown",source:n},source:n}}async submitFingerprintEvent(e,t){try{if(this.v)return{success:!0};const n=this.te(e,e,{userId:t.userId,eventType:t.eventType,permanentDeviceId:t.permanentDeviceId}),r=generateUUID(),o=await this.ne(this.re(),JSON.stringify(n),r);return o.success?o.data?{success:!0,data:{...o.data,hash:e.full_hash,stable_hash:e.fingerprint_id,collected_at:o.data.collected_at??e.timestamp,version:e.version??"unknown"}}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 ingestion result"}}:{success:!1,error:o.error}}catch(e){return{success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}}async submitFingerprint(e){try{return this.v?{success:!0}:isJSONObject(e)?await this.ne(this.re(),JSON.stringify(e),generateUUID()):{success:!1,error:{code:"VALIDATION_ERROR",message:"Fingerprint payload must be a valid JSON object"}}}catch(e){return{success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}}async checkUser(e){return this.oe(e,!0)}async oe(e,t){const n=this.ie(e,!1);if("success"in n)return n;if("string"!=typeof n.email||""===n.email.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"email must be a non-empty string"}};const r={...this.K?{user_id:this.K}:{},email_address:n.email,identifiers:this.ae(n,!0)},o=await this.se("POST",DIRECT_CHECK_PATH,{body:r,retry:t,expectedStatus:200,validateData:isCheckUserResult,retryErrorCodes:CHECK_RETRYABLE_CODES});if(!o.success)return o;if(!o.data)return{success:!1,error:{code:"PARSE_ERROR",message:"Missing Check result"}};const i=getSharedDedup();return o.data.is_user_flagged?i&&(i.flagged={email:n.email}):"CHECK_UNAVAILABLE"!==o.data.decision_code&&i?.flagged?.email&&i.flagged.email.trim().toLowerCase()===n.email.trim().toLowerCase()&&delete i.flagged,o}async triggerEmailVerification(e){const t=this.ie(e,!1);if("success"in t)return t;if("string"!=typeof t.email||""===t.email.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"email must be a non-empty string"}};const n={email_address:t.email,identifiers:this.ae(t,!1)},r=await this.se("POST",DIRECT_TRIGGER_PATH,{body:n,retry:!1,expectedStatus:200,validateData:isTriggerEmailResult});return r.success&&r.data?(setSessionStorageItem(SS_VERIFICATION_KEY,JSON.stringify({email:t.email.toLowerCase(),verificationId:r.data.verification_id})),{success:!0,data:{...r.data,message:"Verification email sent"}}):r}async verify(e,t){const n=this.ie(t,!1);if("success"in n)return n;const r=this.ce(n.email);return r?this.ue({verification_id:r,code:e},n):{success:!1,error:{code:"MISSING_VERIFICATION_ID",message:"Trigger email verification before verifying the code."}}}async verifyEmail(e){return this.ue(e)}async ue(e,t){if(!this.T)return{success:!1,error:{code:"DIRECT_MODE_REQUIRED",message:"This method requires direct mode — construct the SDK with a publishableKey."}};if(null===e||"object"!=typeof e||"string"!=typeof e.verification_id||!UUID_V4_PATTERN.test(e.verification_id)||"string"!=typeof e.code||!OTP_PATTERN.test(e.code))return{success:!1,error:{code:"VALIDATION_ERROR",message:"verification_id must be UUIDv4 and code must be exactly 6 digits"}};const n=await this.se("POST",DIRECT_VERIFY_PATH,{body:e,retry:!1,expectedStatus:200,validateData:isVerifyEmailResult});if(n.success&&n.data?.verified){const n=t??this.le(e.verification_id);try{sessionStorage.removeItem(SS_VERIFICATION_KEY)}catch{}await this.oe(n,!1)}return n}async emailVerificationStatus(e){const t=this.ie(e);return"success"in t?t:this.se("GET",DIRECT_STATUS_PATH,{query:{email_address:t.email,device_id:t.deviceId,permanent_device_id:t.permanentDeviceId},retry:!0})}async showInterstitial(e){const t=!this.T;if("undefined"==typeof document)return{success:!1,error:{code:"NO_DOM",message:"showInterstitial requires a browser DOM."}};if(this.S)return{success:!0,data:{shown:!1}};this.S=!0;const n=e?.flowType??this.U,r=t?await this.de(n):await this.fe(n);if(!r.success||!r.data)return this.S=!1,{success:!1,error:r.error};try{return this.Z=index_umdExports.renderFlow(r.data,{user:t?{}:{email:this.H??this.W()??""},device:t?{}:{id:this.F},actions:t?this.he():this.me(),container:e?.container,onComplete:()=>{e?.onComplete?.()},onDismiss:()=>{this.S=!1,this.Z=void 0,e?.onDismiss?.()}}),{success:!0,data:{shown:!0}}}catch(e){return this.S=!1,{success:!1,error:{code:"RENDER_FAILED",message:e instanceof Error?e.message:String(e)}}}}async fe(e){return this.se("GET",DIRECT_FLOW_PATH,{query:{flow_type:e,platform:"web"},retry:!0})}async de(e){try{const t=`${this.I}${PROXY_FLOW_PATH}?flow_type=${encodeURIComponent(e)}&platform=web`,n=await fetch(t,{method:"GET",credentials:"include"}),r=await n.json().catch(()=>({}));return n.ok&&!1!==r?.success&&r?.data?{success:!0,data:r.data}:{success:!1,error:r?.error??{code:"FLOW_FETCH_FAILED",message:`Flow fetch failed (${n.status})`}}}catch(e){return{success:!1,error:{code:"FLOW_FETCH_FAILED",message:e instanceof Error?e.message:String(e)}}}}he(){const e=async(e,t)=>{const n=await fetch(`${this.I}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||!1===r?.success)throw new Error(r?.error?.message??"Request failed. Please try again.");return{json:r,enforcementReconciled:"clean"===n.headers?.get?.(RECONCILED_HEADER)}};return async(t,n)=>{if("triggerEmailVerification"!==t){if("verify"===t){const{json:t,enforcementReconciled:r}=await e(PROXY_VERIFY_PATH,{code:n.otp});if(!1===t?.data?.verified)throw new Error("Incorrect or expired code. Please try again.");if(!0===t?.data?.verified&&r){const e=getSharedDedup();e&&delete e.flagged}return}throw new Error(`Unsupported interstitial action: ${t}`)}await e(PROXY_VERIFY_TRIGGER_PATH,{})}}me(){return async(e,t)=>{const n={email:t.email,deviceId:t.deviceId};if("triggerEmailVerification"===e){const e=await this.triggerEmailVerification(n);if(!e.success)throw new Error(e.error?.message??"Could not send the verification code.");return}if("verify"===e){const e=await this.verify(t.otp,n);if(!e.success)throw new Error(e.error?.message??"Verification failed.");if(e.data&&!1===e.data.verified)throw new Error("Incorrect or expired code. Please try again.");return}throw new Error(`Unsupported interstitial action: ${e}`)}}V(){try{if("undefined"==typeof window)return;this.X=()=>{this.showInterstitial()},window.addEventListener("unshared:flagged",this.X),getSharedDedup()?.flagged&&this.showInterstitial()}catch{}}ie(e,t=!0){if(this.v)return{success:!1,error:{code:"COLLECTION_DISABLED",message:"Collection is disabled for this user."}};if(!this.T)return{success:!1,error:{code:"DIRECT_MODE_REQUIRED",message:"This method requires direct mode — construct the SDK with a publishableKey."}};const n=e?.email??this.H??this.W(),r=e?.deviceId??this.F,o=e?.permanentDeviceId??this.j();return!n||t&&!r?{success:!1,error:{code:"MISSING_IDENTITY",message:"No email/deviceId available — call init() first or pass them explicitly."}}:{email:n,deviceId:r,permanentDeviceId:o,stableHash:e?.stableHash,fullHash:e?.fullHash}}async se(e,t,n){try{let r=`${this.A}${t}`;n.query&&(r+=`?${new URLSearchParams(n.query).toString()}`);const o={"X-Publishable-Key":this.T,"X-Session-Id":this.N,"X-Device-Id":this.F},i={method:e,headers:o};if(void 0!==n.body){o["Content-Type"]="application/json";const e=JSON.stringify(n.body);if((new TextEncoder).encode(e).byteLength>1048576)return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Request body exceeds 1 MiB"}};i.body=e}const a=n.retry?this.C+1:1,s=n.retry?Date.now()+8e3:1/0;let c={code:"DELIVERY_FAILED",message:"Request failed"};for(let e=1;e<=a&&!(Date.now()>=s);e++){if(e>1){const t=Math.max(0,s-Date.now());if(0===t)break;await sleep(Math.min(retryDelay(e-1),t))}if(Date.now()>=s)break;const t=new AbortController,o=Math.min(this.R,Math.max(0,s-Date.now())),a=setTimeout(()=>t.abort(),n.retry?o:this.R);try{const e=await fetch(r,{...i,signal:t.signal}),o=await e.text();let a;try{a=JSON.parse(o)}catch{return{success:!1,error:{code:"PARSE_ERROR",message:"Invalid JSON response"}}}if(void 0!==n.expectedStatus&&n.validateData){if(isStrictErrorEnvelope(a)){if(c={code:a.error.code,message:a.error.message,retryAfter:Number(e.headers?.get?.("Retry-After"))||void 0},n.retry&&503===e.status&&n.retryErrorCodes?.has(a.error.code))continue;return{success:!1,error:c}}return e.status===n.expectedStatus&&isStrictSuccessEnvelope(a)&&n.validateData(a.data)?{success:!0,data:a.data}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 response"}}}if(e.status>=500){const t=a?.error??{};c={code:"string"==typeof t.code?t.code:"DELIVERY_FAILED",message:"string"==typeof t.message?t.message:`Backend returned ${e.status}`};continue}if(e.status>=400||!1===a?.success){const t=a?.error??{};return{success:!1,error:{code:"string"==typeof t.code?t.code:"UPSTREAM_ERROR",message:"string"==typeof t.message?t.message:`Backend returned ${e.status}`,retryAfter:Number(e.headers?.get?.("Retry-After"))||t.details?.retry_after_seconds,nextAllowedAt:t.details?.next_allowed_at}}}return!0===a?.success&&Object.prototype.hasOwnProperty.call(a,"data")?{success:!0,data:a.data}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 response envelope"}}}catch(e){c={code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}finally{clearTimeout(a)}}return{success:!1,error:c}}catch(e){return{success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}}W(){return getSessionStorageItem(SS_EMAIL_KEY)}pe(){const e=getSessionStorageItem(SS_FP_KEY);if(e)try{return JSON.parse(e)}catch{return}}ge(){const e=getSessionStorageItem(SS_RAW_FP_KEY);if(e)try{const t=JSON.parse(e);return isJSONObject(t)?t:void 0}catch{return}}q(){const e=this.M;if(e.collection)return e.collection;if(e.collectionPromise||e.generation)return;const t=this.pe(),n=this.ge();return t&&"string"==typeof t.fingerprint_id&&"string"==typeof t.full_hash&&n?e.collection={wire:t,raw:n,source:t.source??"bundled"}:void 0}async Y(){const e=this.M,t=e.generation??0,n=this.q();if(n)return n;if(e.collectionPromise)return e.collectionPromise;const r=this.ee().then(n=>{if(t!==(e.generation??0)||e.collectionPromise!==r)throw new Error("Collection cancelled");e.collection=n;try{sessionStorage.removeItem(SS_RAW_FP_KEY),sessionStorage.setItem(SS_FP_KEY,JSON.stringify(n.wire)),sessionStorage.setItem(SS_RAW_FP_KEY,JSON.stringify(n.raw))}catch{}return n}).finally(()=>{e.collectionPromise===r&&delete e.collectionPromise});return e.collectionPromise=r,r}ce(e){const t=getSessionStorageItem(SS_VERIFICATION_KEY);if(t)try{const n=JSON.parse(t);return n.email===e.toLowerCase()&&"string"==typeof n.verificationId?n.verificationId:void 0}catch{return}}le(e){const t=getSessionStorageItem(SS_VERIFICATION_KEY);if(t)try{const n=JSON.parse(t);return n.verificationId===e&&"string"==typeof n.email?{email:n.email}:void 0}catch{return}}ye(){if("undefined"==typeof location)return!0;const e=location.pathname||"/";if(this.P)for(const t of this.P)if(e.startsWith(t))return!1;return!this.O||this.O.some(t=>e.startsWith(t))}async G(e,t,n=this.M.generation??0){if(n!==(this.M.generation??0))return{success:!0};if("undefined"!=typeof navigator&&St(navigator.userAgent))return{success:!0};if(this.v)return{success:!0};if(!this.ye())return{success:!0};const r=this.H??this.W(),o=this.K??getCookie(COOKIE_UID);if(!o||isSentinelUserId(o))return{success:!0};this.j(),this.N=this.M.sessionId??this.N,setPersistentCookie(COOKIE_SID,this.N),e.fingerprint_id&&(setPersistentCookie(COOKIE_STABLE_HASH,e.fingerprint_id),setPersistentCookie(COOKIE_FP_ID,e.fingerprint_id)),e.full_hash&&setPersistentCookie(COOKIE_FULL_HASH,e.full_hash);const i="undefined"!=typeof location?(location.pathname||"/")+(location.search||""):"/",a=this.te(t??asJSONObject(e),e,{userId:o,email:r,eventType:i}),s=JSON.stringify(a);if((new TextEncoder).encode(s).byteLength>(this.T?1048576:102400))return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Request body exceeds "+(this.T?"1 MiB":"100 KiB")}};if(o){const e=`${o}|${i}`,t=this.M;if(t.lastKey===e)return{success:!0};t.lastKey=e,setSessionStorageItem(SS_LAST_SUBMIT_KEY,e)}const c=`${e.fingerprint_id}|${o??""}|${i}`,u=await sha256Hex(c);if(n!==(this.M.generation??0))return{success:!0};const l=u??(this.T?`${c}|${Math.floor(Date.now()/6e4)}`:c);return this.ne(this.re(),s,l)}re(){return this.T?`${this.A}${DIRECT_SUBMIT_PATH}`:`${this.I}${SUBMIT_FP_PATH}`}$(){try{if("undefined"==typeof document)return;this.J&&document.removeEventListener("DOMContentLoaded",this.J),this.J=()=>{if(this.v||!this.ye())return;if("undefined"!=typeof navigator&&St(navigator.userAgent))return;const e=this.K??getCookie(COOKIE_UID);if(!e||isSentinelUserId(e))return;if(!(this.H??this.W()))return;const t=this.M.generation??0;this.Y().then(({raw:e,wire:n})=>{if(t!==(this.M.generation??0))return;let r;try{r=this.k?.()}catch{}return this.F=r||n.fingerprint_id||this.F,this.G(n,e,t)}).catch(()=>{})},document.addEventListener("DOMContentLoaded",this.J)}catch{}}async ne(e,t,n){if((new TextEncoder).encode(t).byteLength>(this.T?1048576:102400))return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Request body exceeds "+(this.T?"1 MiB":"100 KiB")}};if(this.T){try{t=await encryptEvent(t,this.T)}catch(e){return{success:!1,error:{code:"CLIENT_ENCRYPTION_ERROR",message:e instanceof Error?e.message:String(e)}}}if((new TextEncoder).encode(t).byteLength>1572864)return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Encrypted request body exceeds 1.5 MiB"}}}let r={success:!1,error:{code:"DELIVERY_FAILED",message:"Request failed"}};for(let o=1;o<=1;o++){const o=new AbortController,i=setTimeout(()=>o.abort(),this.R),a={"Content-Type":"application/json","X-Idempotency-Key":n,"X-Session-Id":this.N,"X-Device-Id":this.F};this.T||(a["X-Permanent-Device-Id"]=this.j()),this.T&&(a["X-Publishable-Key"]=this.T);try{const n=await fetch(e,{method:"POST",headers:a,body:t,signal:o.signal,...!this.T&&this._e()?{credentials:"include"}:{}}),r=await n.text();let i;try{i=JSON.parse(r)}catch{return{success:!1,error:{code:"PARSE_ERROR",message:"Invalid JSON response"}}}if(isStrictErrorEnvelope(i)){const e=Number(n.headers?.get?.("Retry-After"))||void 0;return{success:!1,error:{...i.error,...e?{retryAfter:e}:{}}}}const s=this.T?202:200;return n.status===s&&isStrictSuccessEnvelope(i)&&isIngestResult(i.data)?{success:!0,data:i.data}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 ingestion response"}}}catch(e){r={success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}finally{clearTimeout(i)}}return r}ae(e,t){const n=this.pe(),r={unshared_device_id:e.permanentDeviceId},o=e.stableHash||n?.fingerprint_id,i=e.fullHash||n?.full_hash;return e.deviceId&&(r.device_id=e.deviceId),o&&(r.stable_hash=o),i&&(r.full_hash=i),t&&this.N&&(r.session_hash=this.N),r}te(e,t,n){const r=n.permanentDeviceId??this.j(),o={deviceId:this.F,permanentDeviceId:r,stableHash:t.fingerprint_id,fullHash:t.full_hash},i=n.userId??this.K??getCookie(COOKIE_UID),a=n.email??this.H??this.W(),s=n.eventType??("undefined"!=typeof location?(location.pathname||"/")+(location.search||""):"/"),c={fingerprint:e,context:{sdk:{name:"unshared-frontend-sdk",version:"3.0.0",agent_source:t.source??"unknown"},identity:{...i?{user_id:i}:{},...a?{email_address:a}:{}},identifiers:this.ae(o,!0),browser_storage:collectBrowserStorage(),event:{type:s,collected_at:(new Date).toISOString()}}};return!this.T&&(new TextEncoder).encode(JSON.stringify(c)).byteLength>102400&&(c.context.browser_storage.local_storage=[],c.context.browser_storage.session_storage=[],(new TextEncoder).encode(JSON.stringify(c)).byteLength>102400&&delete c.context.browser_storage),c}j(){if(!isPermanentDeviceId(this.B)){const e=getLocalStorageItem(LS_DEVICE_ID),t=getCookie(COOKIE_DEVICE_ID);this.B=isPermanentDeviceId(e)?e:isPermanentDeviceId(t)?t:generatePermanentDeviceId(),setLocalStorageItem(LS_DEVICE_ID,this.B)}return setPersistentCookie(COOKIE_DEVICE_ID,this.B),this.B}_e(){try{return"undefined"!=typeof location&&new URL(this.I||location.origin,location.href).origin===location.origin}catch{return!1}}}function createAxiosInterceptor(e){return t=>{if(403===t?.response?.status&&"account_flagged"===t?.response?.data?.error)try{e.onFlagged()}catch{}return Promise.reject(t)}}function createFetchInterceptor(e,t){return async(...n)=>{const r=await e(...n);if(403===r.status){const e=r.clone();try{const n=await e.json();if("account_flagged"===n?.error)try{t.onFlagged()}catch{}}catch{}}return r}}exports.UnsharedBrowser=UnsharedBrowser,exports.createAxiosInterceptor=createAxiosInterceptor,exports.createFetchInterceptor=createFetchInterceptor;
|
|
1
|
+
"use strict";const e="1.5.2",t=1282368115,n={exclude:[],include:[],timeout:3e3,stabilize:["private","iframe","always"],experimental:!1,debug:!1,salt:""},o={always:[{exclude:["speech"],browsers:["brave","firefox"]},{exclude:["keyboard"],browsers:["firefox","safari"]},{exclude:["hardwareSensitive","navigatorProps"],browsers:["brave"]},{exclude:["canvas","audioOscillator","webglRender","canvasTextMetrics"],browsers:["brave"]},{exclude:["canvas","audioOscillator"],browsers:["firefox","safari"]}],private:[{exclude:["fonts"],browsers:["firefox"]},{exclude:["audio"],browsers:["safari","brave"]}],iframe:[{exclude:["permissions"]},{exclude:["keyboard"]}]};let r=null;function a(){if(r)return r;const e=navigator.userAgent;return r=function(){const e=navigator.brave;return!!e&&"function"==typeof e.isBrave}()?{name:"brave",version:i(e,/Chrome\/([\d.]+)/)}:/Edg\//i.test(e)?{name:"edge",version:i(e,/Edg\/([\d.]+)/)}:/OPR\//i.test(e)||/Opera/i.test(e)?{name:"opera",version:i(e,/OPR\/([\d.]+)/)||i(e,/Opera\/([\d.]+)/)}:/SamsungBrowser/i.test(e)?{name:"samsung",version:i(e,/SamsungBrowser\/([\d.]+)/)}:/Firefox\//i.test(e)?{name:"firefox",version:i(e,/Firefox\/([\d.]+)/)}:/Safari\//i.test(e)&&!/Chrome/i.test(e)?{name:"safari",version:i(e,/Version\/([\d.]+)/)}:/Chrome\//i.test(e)?{name:"chrome",version:i(e,/Chrome\/([\d.]+)/)}:{name:"unknown",version:""},r}function i(e,t){const n=e.match(t);return n?.[1]??""}const s=4294967296;function c(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}async function l(e){try{switch(e){case"chrome":case"edge":case"opera":default:return await u();case"brave":return await async function(){return!1}();case"safari":return await async function(){if(navigator.storage?.estimate)try{const{quota:e}=await navigator.storage.estimate();if(c(e))return e<s}catch{}try{return!!navigator.storage?.getDirectory&&(await navigator.storage.getDirectory(),!1)}catch(e){return"NotFoundError"===e?.name}}();case"firefox":return await async function(){if(window.isSecureContext&&!("serviceWorker"in navigator))return!0;try{return!!navigator.storage?.getDirectory&&(await navigator.storage.getDirectory(),!1)}catch(e){return"SecurityError"===e?.name}}()}}catch{return!1}}async function u(){if(!navigator.storage?.estimate)return!1;const{quota:e}=await navigator.storage.estimate();return!!c(e)&&e<s}const d=Object.freeze({status:"absent"}),m="indexedDB",p="localStorage",f="cacheApi",h={storage:{strategy:"allowlist",objectRequired:!0,incognitoFullReplacement:{incognito:!0},paths:[{path:"quota",outputPath:"quota_bucket",lanes:["full"],operation:"log2Bucket16",defaultValue:null},{path:m,lanes:["full"],operation:"keep",defaultValue:null},{path:p,lanes:["full"],operation:"keep",defaultValue:null},{path:f,lanes:["full"],operation:"keep",defaultValue:null}]},webrtc:{strategy:"passthrough",paths:[{path:"videoCodecCount",lanes:["full","stable"],operation:"omit"}]},navigatorProps:{strategy:"passthrough",paths:[{path:"cookieEnabled",lanes:["stable"],operation:"omit"}]}},g=new Set(["anyHover","anyPointer","pointer","hover","update","colorGamut","monochrome"]),y={"fp-v3-cross-context":h,"fp-v4-cross-session":{storage:{strategy:"allowlist",objectRequired:!0,paths:[{path:m,lanes:["full","stable"],operation:"keep",defaultValue:null},{path:p,lanes:["full"],operation:"keep",defaultValue:null},{path:f,lanes:["full"],operation:"keep",defaultValue:null}]},workers:{strategy:"stableAllowlist",objectRequired:!0,paths:[{path:"webWorker",lanes:["stable"],operation:"keep",defaultValue:null},{path:"sharedWorker",lanes:["stable"],operation:"keep",defaultValue:null}]},webrtc:{strategy:"allowlist",objectRequired:!0,paths:[{path:"supported",lanes:["full","stable"],operation:"keep",defaultValue:null},{path:"audioCodecs",lanes:["full","stable"],operation:"keep",defaultValue:[]},{path:"videoCodecs",lanes:["full","stable"],operation:"keep",defaultValue:[]},{path:"extensions",lanes:["full","stable"],operation:"keep",defaultValue:[]}]},navigatorProps:{strategy:"passthrough",paths:[{path:"cookieEnabled",lanes:["stable"],operation:"omit"}]},mediaQueries:{strategy:"allowlist",objectRequired:!0,paths:["prefersContrast","anyHover","anyPointer","pointer","hover","update","invertedColors","prefersReducedMotion","prefersReducedTransparency","scripting","forcedColors","prefersColorScheme","colorGamut","dynamicRange","monochrome"].map(e=>({path:e,lanes:g.has(e)?["full","stable"]:["full"],operation:"keep",defaultValue:null}))},applePay:{strategy:"stableAllowlist",objectRequired:!0,paths:[{path:"supported",lanes:["stable"],operation:"keep",defaultValue:null}]}}},v=Symbol("omit");function w(e,t){let n=e;for(const e of t.split(".")){if("object"!=typeof n||null===n||Array.isArray(n)||!Object.prototype.propertyIsEnumerable.call(n,e))return{found:!1,value:void 0};n=n[e]}return{found:!0,value:n}}function b(e,t){return"omit"===e?v:"log2Bucket16"===e?"number"==typeof t&&Number.isFinite(t)&&t>0?Math.round(16*Math.log2(t))/16:null:t}function x(e,t,n){const r=n.find(e=>e.path===t);if(r)return b(r.operation,e);if("object"!=typeof e||null===e||Array.isArray(e)||""!==t&&!n.some(e=>e.path.startsWith(`${t}.`)))return e;const o=[];for(const[r,i]of Object.entries(e)){const e=x(i,t?`${t}.${r}`:r,n);e!==v&&o.push([r,e])}return Object.fromEntries(o)}function S(e,t,n,r,o){const i=y[e][t];if(!i)return n;if("stableAllowlist"===i.strategy&&"full"===r)return n;if(i.objectRequired&&("object"!=typeof n||null===n||Array.isArray(n)))return d;if("full"===r&&o.isIncognito&&i.incognitoFullReplacement)return{...i.incognitoFullReplacement};const a=i.paths.filter(e=>e.lanes.includes(r));if("passthrough"===i.strategy)return x(n,"",a);const s=n,c=[];for(const e of a){const t=w(s,e.path),n=t.found?t.value:e.defaultValue,r=b(e.operation,n);r!==v&&c.push([e.outputPath??e.path,r])}return Object.fromEntries(c)}function C(e,t){const n=e[0]>>>16,r=65535&e[0],o=e[1]>>>16,i=65535&e[1],a=t[0]>>>16,s=65535&t[0],c=t[1]>>>16;let u=0,l=0,d=0,f=0,h=0;return l=i+(65535&t[1]),u=l>>>16,l&=65535,d=o+c+u,u=d>>>16,d&=65535,f=r+s+u,u=f>>>16,f&=65535,h=n+a+u,h&=65535,[h<<16|f,d<<16|l]}function _(e,t){const n=e[0]>>>16,r=65535&e[0],o=e[1]>>>16,i=65535&e[1],a=t[0]>>>16,s=65535&t[0],c=t[1]>>>16,u=65535&t[1];let l=0,d=0,f=0,h=0,m=0;return d=i*u,l=d>>>16,d&=65535,f=o*u+l,l=f>>>16,f&=65535,f+=i*c,l+=f>>>16,f&=65535,h=r*u+l,l=h>>>16,h&=65535,h+=o*c,l+=h>>>16,h&=65535,h+=i*s,l+=h>>>16,h&=65535,m=n*u+r*c+o*s+i*a+l,m&=65535,[m<<16|h,f<<16|d]}function A(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function E(e,t){return 0==(t%=64)?[e[0],e[1]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function P(e,t){return[e[0]^t[0],e[1]^t[1]]}function k(e){let t=[e[0],e[1]];return t=P(t,[0,t[0]>>>1]),t=_(t,[4283543511,3981806797]),t=P(t,[0,t[0]>>>1]),t=_(t,[3301882366,444984403]),t=P(t,[0,t[0]>>>1]),t}function R(e){return("00000000"+(e>>>0).toString(16)).slice(-8)}function T(e,t=0){const n=e.length%16,r=e.length-n;let o=[0,t],i=[0,t];const a=[2277735313,289559509],s=[1291169091,658871167];for(let t=0;t<r;t+=16){let n=[255&e.charCodeAt(t+4)|(255&e.charCodeAt(t+5))<<8|(255&e.charCodeAt(t+6))<<16|(255&e.charCodeAt(t+7))<<24,255&e.charCodeAt(t)|(255&e.charCodeAt(t+1))<<8|(255&e.charCodeAt(t+2))<<16|(255&e.charCodeAt(t+3))<<24],r=[255&e.charCodeAt(t+12)|(255&e.charCodeAt(t+13))<<8|(255&e.charCodeAt(t+14))<<16|(255&e.charCodeAt(t+15))<<24,255&e.charCodeAt(t+8)|(255&e.charCodeAt(t+9))<<8|(255&e.charCodeAt(t+10))<<16|(255&e.charCodeAt(t+11))<<24];n=_(n,a),n=A(n,31),n=_(n,s),o=P(o,n),o=A(o,27),o=C(o,i),o=C(_(o,[0,5]),[0,1390208809]),r=_(r,s),r=A(r,33),r=_(r,a),i=P(i,r),i=A(i,31),i=C(i,o),i=C(_(i,[0,5]),[0,944331445])}let c=[0,0],u=[0,0];switch(n){case 15:u=P(u,E([0,e.charCodeAt(r+14)],48));case 14:u=P(u,E([0,e.charCodeAt(r+13)],40));case 13:u=P(u,E([0,e.charCodeAt(r+12)],32));case 12:u=P(u,E([0,e.charCodeAt(r+11)],24));case 11:u=P(u,E([0,e.charCodeAt(r+10)],16));case 10:u=P(u,E([0,e.charCodeAt(r+9)],8));case 9:u=P(u,[0,e.charCodeAt(r+8)]),u=_(u,s),u=A(u,33),u=_(u,a),i=P(i,u);case 8:c=P(c,E([0,e.charCodeAt(r+7)],56));case 7:c=P(c,E([0,e.charCodeAt(r+6)],48));case 6:c=P(c,E([0,e.charCodeAt(r+5)],40));case 5:c=P(c,E([0,e.charCodeAt(r+4)],32));case 4:c=P(c,E([0,e.charCodeAt(r+3)],24));case 3:c=P(c,E([0,e.charCodeAt(r+2)],16));case 2:c=P(c,E([0,e.charCodeAt(r+1)],8));case 1:c=P(c,[0,e.charCodeAt(r)]),c=_(c,a),c=A(c,31),c=_(c,s),o=P(o,c)}return o=P(o,[0,e.length]),i=P(i,[0,e.length]),o=C(o,i),i=C(i,o),o=k(o),i=k(i),o=C(o,i),i=C(i,o),R(o[0])+R(o[1])+R(i[0])+R(i[1])}function M(e){return O(e,new Set)}function O(e,t){if(null===e)return"null";if(void 0===e)return"undefined";const n=typeof e;if("boolean"===n||"number"===n)return String(e);if("string"===n)return JSON.stringify(e);if(Array.isArray(e)){if(t.has(e))return'"[Circular]"';t.add(e);const n=e.map(e=>O(e,t));return t.delete(e),"["+n.join(",")+"]"}if("object"===n){const n=e;if(t.has(n))return'"[Circular]"';t.add(n);const r=Object.keys(n).sort().filter(e=>void 0!==n[e]).map(e=>JSON.stringify(e)+":"+O(n[e],t));return t.delete(n),"{"+r.join(",")+"}"}return String(e)}const I=T("",t);function D(e,n){const r=function(e){if(0===e.length)return T("",t);if(1===e.length)return T(e[0],t);let n=[...e];for(;n.length>1;){const e=[];for(let r=0;r<n.length;r+=2){const o=r+1<n.length?n[r+1]:I;e.push(T(n[r]+o,t))}n=e}return n[0]}(Object.keys(e).sort().map(n=>{const r=function(e){let n=t;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),1540483477),n^=n>>>13;return n>>>0}(n);return T(M(e[n]),r)})),o=String.fromCharCode(76,111,98,115),i=n?T(n,t):"";return T(r+o+i,t)}const B="fp-v4-cross-session",L="__version",F=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","display","locale","workers","plugins","css","cssLayout","navigatorProps","timing","navigatorConnection","webgpu","audio","fonts","webrtc","permissions","speech","mediaQueries","applePay","keyboard","storage","extendedLocale","privacyPrefs","vendorFlavors","audioOscillator","canvas"]),N=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","locale","workers","plugins","css","navigatorProps","webgpu","webrtc","mediaQueries","applePay","storage","vendorFlavors"]),V=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","display","locale","workers","plugins","css","cssLayout","navigatorProps","timing","navigatorConnection","webgpu","audio","fonts","webrtc","permissions","speech","mediaQueries","applePay","keyboard","storage","extendedLocale","privacyPrefs","vendorFlavors","audioOscillator","canvas"]),W=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","locale","workers","plugins","css","navigatorProps","webgpu","webrtc","mediaQueries","vendorFlavors"]),j=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","display","locale","workers","plugins","css","cssLayout","navigatorProps","timing","navigatorConnection","webgpu","audio","fonts","webrtc","permissions","speech","mediaQueries","applePay","keyboard"]),U=Object.freeze(["webgl","hardware","hardwareSensitive","math","i18n","touch","locale","workers","plugins","css","navigatorProps","webgpu","webrtc","mediaQueries","applePay","keyboard"]);function G(e,t,n,r,o){const i={};for(const a of t)Object.prototype.propertyIsEnumerable.call(e,a)&&void 0!==e[a]?i[a]=S(n,a,e[a],o,{isIncognito:r}):i[a]=d;return i}function z(e,t,n,r,o,i){return{policyVersion:e,hash:D(G(t,o,e,r,"full"),n),stableHash:D(G(t,i,e,r,"stable"),n)}}function H(e,t,n){return z(B,e,t,n,F,N)}function X(e,t,n){return z("fp-v3-cross-context",e,t,n,V,W)}function q(e,t){const n={[L]:"1.3.3"};for(const r of t)Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}function K(e,t){return{policyVersion:"fp-v1",hash:D(q(e,j),t),stableHash:D(q(e,U),t)}}function $(e,t,n){return[H(e,t,n),X(e,t,n),K(e,t)]}const Z={name:"webgl",tier:1,async collect(){const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!(t&&t instanceof WebGLRenderingContext))return null;const n=t.getExtension("WEBGL_debug_renderer_info"),r=t.getSupportedExtensions()??[],o=function(e){const t={},n=[e.VERTEX_SHADER,e.FRAGMENT_SHADER],r=[e.LOW_FLOAT,e.MEDIUM_FLOAT,e.HIGH_FLOAT,e.LOW_INT,e.MEDIUM_INT,e.HIGH_INT],o=["vertex","fragment"],i=["lowFloat","mediumFloat","highFloat","lowInt","mediumInt","highInt"];for(let a=0;a<n.length;a++){const s={};for(let t=0;t<r.length;t++){const o=e.getShaderPrecisionFormat(n[a],r[t]);o&&(s[i[t]]={rangeMin:o.rangeMin,rangeMax:o.rangeMax,precision:o.precision})}t[o[a]]=s}return t}(t),i={vendor:t.getParameter(t.VENDOR),renderer:t.getParameter(t.RENDERER),version:t.getParameter(t.VERSION),shadingLanguageVersion:t.getParameter(t.SHADING_LANGUAGE_VERSION),unmaskedVendor:n?t.getParameter(n.UNMASKED_VENDOR_WEBGL):null,unmaskedRenderer:n?t.getParameter(n.UNMASKED_RENDERER_WEBGL):null,extensions:r.sort(),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxRenderbufferSize:t.getParameter(t.MAX_RENDERBUFFER_SIZE),maxViewportDims:Array.from(t.getParameter(t.MAX_VIEWPORT_DIMS)),maxVertexAttribs:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniformVectors:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxFragmentUniformVectors:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxVaryingVectors:t.getParameter(t.MAX_VARYING_VECTORS),aliasedLineWidthRange:Array.from(t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)),aliasedPointSizeRange:Array.from(t.getParameter(t.ALIASED_POINT_SIZE_RANGE)),maxCombinedTextureImageUnits:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxTextureImageUnits:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),shaderPrecision:o,maxAnisotropy:Y(t),webgl2:Q(e)};return t.getExtension("WEBGL_lose_context")?.loseContext(),i}};function Y(e){try{const t=e.getExtension("EXT_texture_filter_anisotropic")??e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")??e.getExtension("MOZ_EXT_texture_filter_anisotropic");return t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):null}catch{return null}}function Q(e){try{const t=e.getContext("webgl2");if(!t)return null;const n={version:t.getParameter(t.VERSION),maxSamples:t.getParameter(t.MAX_SAMPLES),max3DTextureSize:t.getParameter(t.MAX_3D_TEXTURE_SIZE),maxArrayTextureLayers:t.getParameter(t.MAX_ARRAY_TEXTURE_LAYERS),maxUniformBlockSize:t.getParameter(t.MAX_UNIFORM_BLOCK_SIZE),maxVertexUniformComponents:t.getParameter(t.MAX_VERTEX_UNIFORM_COMPONENTS),maxFragmentUniformComponents:t.getParameter(t.MAX_FRAGMENT_UNIFORM_COMPONENTS),maxColorAttachments:t.getParameter(t.MAX_COLOR_ATTACHMENTS),maxDrawBuffers:t.getParameter(t.MAX_DRAW_BUFFERS)};return t.getExtension("WEBGL_lose_context")?.loseContext(),n}catch{return null}}const J={name:"hardware",tier:1,collect:async()=>({architecture:ne(),platform:te()})},ee={name:"hardwareSensitive",tier:1,collect:async()=>({deviceMemory:navigator.deviceMemory??null,hardwareConcurrency:navigator.hardwareConcurrency??null})};function te(){const e=navigator.userAgentData;if(e?.platform)return e.platform;const t=navigator.userAgent??"";return/Windows/.test(t)?"Windows":/Macintosh|Mac OS X/.test(t)?"macOS":/CrOS/.test(t)?"Chrome OS":/Android/.test(t)?"Android":/Linux/.test(t)?"Linux":/iPhone|iPad|iPod/.test(t)?"iOS":""}function ne(){try{const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint8Array(e);return t[0]=1/0,n[3]}catch{return 0}}const oe={name:"math",tier:1,collect:async()=>({acos:Math.acos(.5),asin:re(Math.asin,-1,1,97),cos:re(Math.cos,0,Math.PI,97),cosLarge:Math.cos(1e20),sinLarge:Math.sin(1e20),tanLarge:Math.tan(1e20),sin:re(Math.sin,0,Math.PI,97),tan:re(Math.tan,0,Math.PI/4,97)})};function re(e,t,n,r){const o=(n-t)/r;let i=e(t)+e(n);for(let n=1;n<r;n++)i+=e(t+n*o)*(n%2==0?2:4);return i*o/3}const ae={name:"i18n",tier:1,collect:async()=>({dateTimeFormat:ie(),numberFormat:se(),collator:ce(),pluralRules:le(),relativeTimeFormat:ue(),listFormat:de()})};function ie(){try{const e=(new Intl.DateTimeFormat).resolvedOptions();return{locale:e.locale,calendar:e.calendar,numberingSystem:e.numberingSystem,timeZone:e.timeZone}}catch{return{}}}function se(){try{const e=(new Intl.NumberFormat).resolvedOptions();return{locale:e.locale,numberingSystem:e.numberingSystem,style:e.style,minimumIntegerDigits:e.minimumIntegerDigits,minimumFractionDigits:e.minimumFractionDigits,maximumFractionDigits:e.maximumFractionDigits,useGrouping:e.useGrouping}}catch{return{}}}function ce(){try{const e=(new Intl.Collator).resolvedOptions();return{locale:e.locale,usage:e.usage,sensitivity:e.sensitivity,collation:e.collation,numeric:e.numeric,caseFirst:e.caseFirst}}catch{return{}}}function le(){try{const e=(new Intl.PluralRules).resolvedOptions(),t=new Intl.PluralRules(void 0,{type:"ordinal"}).resolvedOptions();return{locale:e.locale,type:e.type,cardinalCategories:(new Intl.PluralRules).select(0)+","+(new Intl.PluralRules).select(1)+","+(new Intl.PluralRules).select(2)+","+(new Intl.PluralRules).select(5)+","+(new Intl.PluralRules).select(11)+","+(new Intl.PluralRules).select(100),ordinalCategory1:t.type,minimumIntegerDigits:e.minimumIntegerDigits}}catch{return{}}}function ue(){try{const e=new Intl.RelativeTimeFormat;if(!e)return{};const t=e.resolvedOptions();return{locale:t.locale,style:t.style,numeric:t.numeric,numberingSystem:t.numberingSystem}}catch{return{}}}function de(){try{const e=new Intl.ListFormat;if(!e)return{};const t=e.resolvedOptions(),n=["X","Y","Z"],r=new Intl.ListFormat(void 0,{type:"conjunction",style:"long"}),o=new Intl.ListFormat(void 0,{type:"disjunction",style:"long"});return{locale:t.locale,type:t.type,style:t.style,conjunctionSample:r.format(n),disjunctionSample:o.format(n)}}catch{return{}}}const me={name:"domrect",tier:1,collect:async()=>({basic:function(){const e=document.createElement("div");e.style.cssText="position:fixed;left:-9999px;width:100px;height:100px;",document.body.appendChild(e);const t=e.getBoundingClientRect();return document.body.removeChild(e),{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}}(),precision:function(){const e=document.createElement("div");e.style.cssText=`position:absolute;left:-9999px;width:${Math.PI}px;height:${Math.E}px;`,document.body.appendChild(e);const t=e.getBoundingClientRect();return document.body.removeChild(e),{width:t.width,height:t.height}}(),fromRect:"undefined"!=typeof DOMRectReadOnly&&"function"==typeof DOMRectReadOnly.fromRect})},pe={name:"touch",tier:1,collect:async()=>({supported:"ontouchstart"in window||navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints??0})},fe={name:"display",tier:1,collect:async()=>({colorDepth:screen.colorDepth??0,pixelDepth:screen.pixelDepth??0})},he={name:"locale",tier:1,collect:async()=>({timezone:Intl.DateTimeFormat().resolvedOptions().timeZone??"",language:navigator.language??""})},ge={name:"workers",tier:1,collect:async()=>({webWorker:"undefined"!=typeof Worker,sharedWorker:"undefined"!=typeof SharedWorker,serviceWorker:"serviceWorker"in navigator})},ye={name:"plugins",tier:1,async collect(){const e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){const n=navigator.plugins[t];"internal-pdf-viewer"===n.filename&&e.push(`${n.name}|${n.filename}|${n.description}`)}return{plugins:e.sort(),pdfViewerEnabled:navigator.pdfViewerEnabled??!1}}},ve=[["backdrop-filter","blur(1px)"],["container-type","inline-size"],["text-wrap","balance"],["overscroll-behavior","contain"],["hanging-punctuation","first"],["-webkit-line-clamp","1"],["appearance","none"],["font-size-adjust","ex-height 0.5"],["font-palette","normal"],["field-sizing","content"],["-webkit-text-stroke","1px black"],["zoom","1"],["scrollbar-width","thin"],["scrollbar-color","red blue"],["animation-timeline","auto"],["mask-composite","add"],["offset-path","none"],["text-decoration-thickness","1px"],["content-visibility","auto"],["contain-intrinsic-size","auto 100px"],["aspect-ratio","16/9"],["gap","10px"],["color-mix","in srgb, red 50%, blue"],["linear-gradient(in oklch, red, blue)",""]],we={name:"css",tier:1,collect:async()=>({supports:be(),safeArea:xe()})};function be(){const e={};if("undefined"==typeof CSS||"function"!=typeof CSS.supports)return e;for(const[t,n]of ve)e[t]=n?CSS.supports(t,n):CSS.supports(t);return e}function xe(){try{const e=document.createElement("div");e.style.cssText=["position:fixed","top:0","left:0","width:0","height:0","visibility:hidden","padding-top:env(safe-area-inset-top,0px)","padding-bottom:env(safe-area-inset-bottom,0px)","padding-left:env(safe-area-inset-left,0px)","padding-right:env(safe-area-inset-right,0px)"].join(";"),document.body.appendChild(e);const t=getComputedStyle(e),n={top:t.paddingTop,bottom:t.paddingBottom,left:t.paddingLeft,right:t.paddingRight};return document.body.removeChild(e),n}catch{return null}}const Se={name:"cssLayout",tier:1,collect:async()=>({scrollbarWidth:Ce()})};function Ce(){try{const e=document.createElement("div");e.style.cssText="visibility:hidden;overflow:scroll;position:absolute;top:-9999px;width:100px;height:100px",document.body.appendChild(e);const t=document.createElement("div");e.appendChild(t);const n=e.offsetWidth-t.offsetWidth;return document.body.removeChild(e),n}catch{return-1}}const _e={name:"navigatorProps",tier:1,collect:async()=>({vendor:navigator.vendor??"",productSub:navigator.productSub??"",cookieEnabled:navigator.cookieEnabled})},Ae={name:"navigatorConnection",tier:2,async collect(){const e=navigator,t=e.connection??e.mozConnection??e.webkitConnection??null,n=performance.memory??null;return{connection:t?{type:t.type??null,effectiveType:t.effectiveType??null,saveData:t.saveData??null}:null,memory:n?{jsHeapSizeLimit:n.jsHeapSizeLimit}:null}}},Ee={name:"timing",tier:2,collect:async()=>({performancePrecisionUs:Pe()})};function Pe(){try{const e=performance.now();let t=1/0,n=e;for(let r=0;r<50;r++){const r=performance.now(),o=r-n;if(o>0&&o<t&&(t=o),n=r,r-e>=1)break}if(t===1/0)return-1;const r=1e3*t;if(r<=0)return-1;const o=Math.max(0,Math.round(Math.log10(r)));return Math.pow(10,o)}catch{return-1}}const ke={name:"webgpu",tier:2,async collect(){const e=navigator.gpu;if(!e)return null;const t=await e.requestAdapter();if(!t)return null;let n="",r="",o="",i="";if(t.info)n=t.info.vendor??"",r=t.info.architecture??"",o=t.info.device??"",i=t.info.description??"";else if("function"==typeof t.requestAdapterInfo){const e=await t.requestAdapterInfo();n=e.vendor??"",r=e.architecture??"",o=e.device??"",i=e.description??""}const a=[];t.features&&(t.features.forEach(e=>a.push(e)),a.sort());const s={};if(t.limits){const e=["maxTextureDimension1D","maxTextureDimension2D","maxTextureDimension3D","maxTextureArrayLayers","maxBindGroups","maxBindGroupsPlusVertexBuffers","maxBindingsPerBindGroup","maxDynamicUniformBuffersPerPipelineLayout","maxDynamicStorageBuffersPerPipelineLayout","maxSampledTexturesPerShaderStage","maxSamplersPerShaderStage","maxStorageBuffersPerShaderStage","maxStorageTexturesPerShaderStage","maxUniformBuffersPerShaderStage","maxUniformBufferBindingSize","maxStorageBufferBindingSize","minUniformBufferOffsetAlignment","minStorageBufferOffsetAlignment","maxVertexBuffers","maxBufferSize","maxVertexAttributes","maxVertexBufferArrayStride","maxInterStageShaderComponents","maxInterStageShaderVariables","maxColorAttachments","maxColorAttachmentBytesPerSample","maxComputeWorkgroupStorageSize","maxComputeInvocationsPerWorkgroup","maxComputeWorkgroupSizeX","maxComputeWorkgroupSizeY","maxComputeWorkgroupSizeZ","maxComputeWorkgroupsPerDimension"];for(const n of e){const e=t.limits[n];void 0!==e&&(s[n]=e)}}return{vendor:n,architecture:r,device:o,description:i,features:a,limits:s}}},Re={name:"audio",tier:2,async collect(){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;let t=null;try{t=new e;const n=t.destination;return{sampleRate:t.sampleRate,maxChannelCount:n.maxChannelCount,channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,baseLatency:t.baseLatency??null,outputLatency:t.outputLatency??null}}finally{if(t&&"closed"!==t.state)try{await t.close()}catch{}}}},Te=["Arial","Arial Black","Arial Narrow","Arial Rounded MT Bold","Bookman Old Style","Bradley Hand","Calibri","Cambria","Cambria Math","Century","Century Gothic","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Helvetica Neue","Impact","Lucida Console","Lucida Grande","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Tahoma","Times","Times New Roman","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3","Inter","Roboto","Open Sans","Lato","Montserrat","Poppins","Nunito","Raleway","Ubuntu","Merriweather","Playfair Display","Source Sans Pro","Source Code Pro","Fira Code","JetBrains Mono","Cascadia Code","Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji","SF Pro","SF Pro Display","SF Mono","San Francisco","Menlo","Andale Mono","Futura","MS Gothic","MS Mincho","MS PGothic","MS PMincho","Yu Gothic","Meiryo","Hiragino Sans","Hiragino Kaku Gothic Pro","SimSun","SimHei","Microsoft YaHei","PingFang SC","Noto Sans CJK","Malgun Gothic","Arial Hebrew"],Me=["monospace","sans-serif","serif"],Oe="mmMwWLliI0O&1",Ie={name:"fonts",tier:2,collect:()=>new Promise(e=>{const t=()=>e(function(){try{if("undefined"==typeof document)return{available:[],method:"css-layout"};const e=new Set,t=[];if("function"==typeof document.fonts?.check)for(const n of Te)document.fonts.check(`72px "${n}"`)?e.add(n):t.push(n);else t.push(...Te);const n=new Set;if(t.length>0){const e=document.createElement("div");e.style.cssText="position:absolute;visibility:hidden;top:-9999px;left:-9999px;pointer-events:none;";const r=Me.map(t=>{const n=document.createElement("span");return n.style.cssText=`font-size:72px;font-family:${t};white-space:nowrap;display:inline-block`,n.textContent=Oe,e.appendChild(n),n}),o=t.map(t=>Me.map(n=>{const r=document.createElement("span");return r.style.cssText=`font-size:72px;font-family:'${t}',${n};white-space:nowrap;display:inline-block`,r.textContent=Oe,e.appendChild(r),r}));document.body.appendChild(e);const i=r.map(e=>e.getBoundingClientRect().width),a=o.map(e=>e.map(e=>e.getBoundingClientRect().width));document.body.removeChild(e);for(let e=0;e<t.length;e++)for(let r=0;r<Me.length;r++)if(a[e][r]!==i[r]){n.add(t[e]);break}}return{available:Te.filter(t=>e.has(t)||n.has(t)),method:"css-layout"}}catch{return{available:[],method:"css-layout"}}}());"undefined"!=typeof requestIdleCallback?requestIdleCallback(t,{timeout:2e3}):setTimeout(t,0)})},De={name:"webrtc",tier:2,async collect(){if("undefined"==typeof RTCPeerConnection)return{supported:!1,audioCodecCount:0,videoCodecCount:0,audioCodecs:[],videoCodecs:[],extensions:[]};const e=new RTCPeerConnection({iceServers:[]});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=(await e.createOffer()).sdp??"",n=Be(t,"audio"),r=Be(t,"video"),o=function(e){const t=new Set,n=e.split("\r\n");for(const e of n)if(e.startsWith("a=extmap:")){const n=e.match(/^a=extmap:\d+(?:\/\w+)?\s+(.+)$/);n&&t.add(n[1].trim())}return Array.from(t)}(t);return{supported:!0,audioCodecCount:n.length,videoCodecCount:r.length,audioCodecs:n.sort(),videoCodecs:r.sort(),extensions:o.sort()}}finally{e.close()}}};function Be(e,t){const n=[],r=e.split("\r\n");let o=!1;for(const e of r)if(e.startsWith(`m=${t}`))o=!0;else{if(e.startsWith("m=")&&o)break;if(o&&e.startsWith("a=rtpmap:")){const t=e.match(/^a=rtpmap:\d+\s+(.+)$/);t&&n.push(t[1])}}return n}const Le=["accelerometer","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","display-capture","geolocation","gyroscope","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","screen-wake-lock","speaker-selection","storage-access","top-level-storage-access","window-management","xr-spatial-tracking"],Fe={name:"permissions",tier:2,async collect(){if(!navigator.permissions?.query)return{states:{}};const e=()=>Promise.allSettled(Le.map(async e=>{try{return{name:e,state:(await navigator.permissions.query({name:e})).state}}catch{return{name:e,state:"error"}}})),t=await Promise.all([e(),e(),e()]),n={};for(const e of t)for(const t of e)if("fulfilled"===t.status){const{name:e,state:r}=t.value;n[e]||(n[e]=[]),n[e].push(r)}const r={};for(const[e,t]of Object.entries(n))r[e]=Ne(t);return{states:r}}};function Ne(e){const t={};for(const n of e)t[n]=(t[n]??0)+1;let n=e[0],r=0;for(const[e,o]of Object.entries(t))o>r&&(n=e,r=o);return n}const Ve={name:"speech",tier:2,async collect(){if("undefined"==typeof speechSynthesis)return{supported:!1,voiceCount:0,voices:[]};const e=await new Promise(e=>{const t=speechSynthesis.getVoices();if(t.length>0)return void e(t);const n=setTimeout(()=>e([]),800);speechSynthesis.addEventListener("voiceschanged",()=>{clearTimeout(n),e(speechSynthesis.getVoices())},{once:!0})}),t=e.map(e=>`${e.name}|${e.lang}|${e.localService}`).sort();return{supported:!0,voiceCount:e.length,voices:t}}},We=[{name:"prefers-contrast",values:["no-preference","more","less","custom"]},{name:"any-hover",values:["none","hover"]},{name:"any-pointer",values:["none","coarse","fine"]},{name:"pointer",values:["none","coarse","fine"]},{name:"hover",values:["none","hover"]},{name:"update",values:["none","slow","fast"]},{name:"inverted-colors",values:["none","inverted"]},{name:"prefers-reduced-motion",values:["no-preference","reduce"]},{name:"prefers-reduced-transparency",values:["no-preference","reduce"]},{name:"scripting",values:["none","initial-only","enabled"]},{name:"forced-colors",values:["none","active"]},{name:"prefers-color-scheme",values:["light","dark"]},{name:"color-gamut",values:["srgb","p3","rec2020"]},{name:"dynamic-range",values:["standard","high"]}],je={name:"mediaQueries",tier:2,async collect(){if("function"!=typeof matchMedia){const e={};for(const t of We)e[t.name.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]="unsupported";return{...e,monochrome:0}}const e={};for(const t of We){let n="unknown";for(const e of t.values){const r=matchMedia(`(${t.name}: ${e})`);if(r?.matches){n=e;break}}e[t.name.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]=n}let t=0;for(let e=100;e>=0;e--)if(matchMedia(`(monochrome: ${e})`)?.matches){t=e;break}return{...e,monochrome:t}}},Ue={name:"applePay",tier:2,async collect(){const e=window.ApplePaySession;if(!e||"function"!=typeof e.supportsVersion)return{supported:!1,maxVersion:0};let t=0;for(let n=15;n>=1;n--)try{if(e.supportsVersion(n)){t=n;break}}catch{continue}return{supported:!0,maxVersion:t}}},Ge=["KeyQ","KeyW","KeyA","KeyS","KeyZ","KeyX","KeyY","KeyM","Semicolon","BracketLeft","Quote","Digit1","Digit2","Digit3"],ze={name:"keyboard",tier:2,async collect(){const e=navigator.keyboard;if(!e||"function"!=typeof e.getLayoutMap)return{supported:!1,layoutKeys:null,layoutHint:null};try{const t=await e.getLayoutMap(),n={};for(const e of Ge){const r=t.get(e);void 0!==r&&(n[e]=r)}return{supported:!0,layoutKeys:n,layoutHint:He(n)}}catch{return{supported:!1,layoutKeys:null,layoutHint:null}}}};function He(e){const t=e.KeyQ,n=e.KeyZ,r=e.KeyY;return t?"a"===t?"azerty":"q"===t&&"z"===r?"qwertz":"q"===t&&"z"===n?"qwerty":"'"===t?"dvorak":"other":null}const Xe={name:"canvas",tier:2,async collect(){const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return null;e.width=240,e.height=120,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"',t.fillText("Cwm fjordbank gly"+String.fromCharCode(55357,56835),2,15),t.fillStyle="rgba(102,204,0,0.2)",t.font="18pt Arial",t.fillText("Cwm fjordbank gly"+String.fromCharCode(55357,56835),4,45);const n=e.toDataURL("image/png");t.clearRect(0,0,e.width,e.height),t.globalCompositeOperation="multiply",t.fillStyle="#f2f",t.beginPath(),t.arc(40,40,40,0,2*Math.PI),t.fill(),t.fillStyle="#2ff",t.beginPath(),t.arc(80,40,40,0,2*Math.PI),t.fill(),t.fillStyle="#ff2",t.beginPath(),t.arc(60,80,40,0,2*Math.PI),t.fill(),t.globalCompositeOperation="source-over",t.fillStyle="#f9c",t.beginPath(),t.arc(60,60,60,0,2*Math.PI),t.arc(60,60,20,0,2*Math.PI),t.fill("evenodd");const r=e.toDataURL("image/png");return{textDataUrl:n,geometryDataUrl:r,readbackAllowed:n.length>=1e3&&r.length>=1e3,windingRule:0===t.getImageData(60,60,1,1).data[3]}}},qe={name:"audioOscillator",tier:2,async collect(){const e=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(!e)return null;const t=new e(1,5e3,44100),n=t.createOscillator();n.type="triangle",n.frequency.value=1e4;const r=t.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,n.connect(r),r.connect(t.destination),n.start(0);const o=(await t.startRendering()).getChannelData(0).slice(4500,5e3);let i=0;for(let e=0;e<o.length;e++)i+=Math.abs(o[e]);return{sampleSum:i,sampleCount:o.length}}},Ke={name:"webglRender",tier:2,async collect(){const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("webgl",{preserveDrawingBuffer:!0});if(!t)return null;try{const e="\n attribute vec2 position;\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vColor = color;\n }\n ",n="\n precision mediump float;\n varying vec3 vColor;\n void main() {\n gl_FragColor = vec4(vColor, 1.0);\n }\n ",r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,n),t.compileShader(o);const i=t.createProgram();t.attachShader(i,r),t.attachShader(i,o),t.linkProgram(i),t.useProgram(i);const a=new Float32Array([-.5,-.5,1,0,0,.5,-.5,0,1,0,0,.5,0,0,1]),s=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,a,t.STATIC_DRAW);const c=t.getAttribLocation(i,"position");t.enableVertexAttribArray(c),t.vertexAttribPointer(c,2,t.FLOAT,!1,20,0);const u=t.getAttribLocation(i,"color");t.enableVertexAttribArray(u),t.vertexAttribPointer(u,3,t.FLOAT,!1,20,8),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,3),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.drawArrays(t.TRIANGLES,0,3);const l=new Uint8Array(262144);t.readPixels(0,0,256,256,t.RGBA,t.UNSIGNED_BYTE,l);const d=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}(l);let f=!1;for(let e=0;e<l.length;e++)if(0!==l[e]){f=!0;break}return{pixelHash:d,readbackAllowed:f}}finally{t.getExtension("WEBGL_lose_context")?.loseContext()}}},$e=["14px Arial","14px Georgia","14px monospace"],Ze={name:"canvasTextMetrics",tier:2,async collect(){const e=document.createElement("canvas").getContext("2d");if(!e)return null;const t=[];for(const n of $e){e.font=n;const r=e.measureText("Sphinx of black quartz, judge my vow. 0123456789");t.push({font:n,width:r.width,actualBoundingBoxAscent:r.actualBoundingBoxAscent??null,actualBoundingBoxDescent:r.actualBoundingBoxDescent??null,actualBoundingBoxLeft:r.actualBoundingBoxLeft??null,actualBoundingBoxRight:r.actualBoundingBoxRight??null,fontBoundingBoxAscent:r.fontBoundingBoxAscent??null,fontBoundingBoxDescent:r.fontBoundingBoxDescent??null})}return{metrics:t}}},Ye=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"],Qe={name:"vendorFlavors",tier:2,async collect(){const e=window,t=[];for(const n of Ye)void 0!==e[n]&&t.push(n);return t.sort(),{flavors:t}}},Je=[{key:"default",family:""},{key:"apple",family:"-apple-system, BlinkMacSystemFont"},{key:"serif",family:"serif"},{key:"sansSerif",family:"sans-serif"},{key:"monospace",family:"monospace"},{key:"systemUi",family:"system-ui"}],et={name:"fontPreferences",tier:2,async collect(){if("undefined"==typeof document||!document.body)return null;const e=document.createElement("div");e.style.cssText="position:absolute;visibility:hidden;top:-9999px";const t=Je.map(({family:t})=>{const n=document.createElement("span");return n.textContent="mmMwWLliI0fiflO&1",n.style.fontSize="72px",t&&(n.style.fontFamily=t),e.appendChild(n),n});document.body.appendChild(e);const n={};for(let e=0;e<Je.length;e++){const r=t[e].getBoundingClientRect().width;n[Je[e].key]=Math.round(1e3*r)/1e3}return document.body.removeChild(e),n}},tt={name:"screenFrame",tier:2,async collect(){const e=screen,t=e.availTop??0,n=e.availLeft??0;return{top:t,right:screen.width-(e.availWidth??screen.width)-n,bottom:screen.height-(e.availHeight??screen.height)-t,left:n}}};function nt(e){return/Not[ ;)\/]/i.test(e)}const ot={name:"clientHints",tier:2,async collect(){const e=navigator;if(!e.userAgentData)return null;const t=(e.userAgentData.brands??[]).filter(e=>!nt(e.brand)),n=e.userAgentData.mobile??!1,r=e.userAgentData.platform??"",o=await e.userAgentData.getHighEntropyValues(["architecture","bitness","model","platformVersion","fullVersionList"]),i=(o.fullVersionList??[]).filter(e=>!nt(e.brand));return{brands:t,mobile:n,platform:r,architecture:o.architecture??"",bitness:o.bitness??"",model:o.model??"",platformVersion:o.platformVersion??"",fullVersionList:i}}},rt=[{name:"EasyList",selectors:[".ad-banner",".ad_banner","#ad-banner",".adsbygoogle",".ad-container"]},{name:"AdGuard Base",selectors:[".BannerAd",".ad-rotate","#ad-box",".ad-placement",".ad-zone"]},{name:"EasyPrivacy",selectors:["#tracking-pixel",".tracking",".analytics-tag","#beacon",".pixel-tracker"]},{name:"Fanboy Annoyances",selectors:["#newsletter-popup",".cookie-banner",".consent-dialog","#gdpr-notice",".subscribe-modal"]},{name:"AdGuard Tracking",selectors:[".tracker-frame","#analytics-beacon",".telemetry-pixel",".data-tracker","#stats-counter"]}],at={name:"domBlockers",tier:2,async collect(){if("undefined"==typeof document||!document.body)return{activeFilters:[]};const e=[],t=[];try{for(const n of rt){const r=[];for(const t of n.selectors){const n=document.createElement("div");t.startsWith("#")?n.id=t.slice(1):n.className=t.slice(1),document.body.appendChild(n),r.push(n),e.push(n)}t.push({name:n.name,elements:r})}await new Promise(e=>setTimeout(e,0));const n=[];for(const{name:e,elements:r}of t){let t=0;for(const e of r)null===e.offsetParent&&t++;t/r.length>.6&&n.push(e)}return{activeFilters:n}}catch{return{activeFilters:[]}}finally{for(const t of e)try{t.parentNode?.removeChild(t)}catch{}}}},it={name:"privateClickMeasurement",tier:2,collect:async()=>({supported:"attributionSourceId"in document.createElement("a")})},st={name:"automationDetection",tier:2,async collect(){const e=!!navigator.webdriver,t=function(){const e=[];try{const t=Object.getOwnPropertyNames(document);for(const n of t)/^\$?cdc_/.test(n)&&e.push(n)}catch{}const t=[["_Selenium_IDE_Recorder",()=>"t"in window],["__webdriver_evaluate",()=>"o"in document],["__driver_evaluate",()=>"i"in document],["__puppeteer_evaluation_script__",()=>"u"in window],["__playwright__binding__",()=>"l"in window],["__pwInitScripts",()=>"h"in window],["callPhantom",()=>"callPhantom"in window],["_phantom",()=>"m"in window],["__nightmare",()=>"p"in window],["domAutomation",()=>"domAutomation"in window],["domAutomationController",()=>"domAutomationController"in window]];for(const[n,r]of t)try{r()&&e.push(n)}catch{}return e}(),n=await async function(){const e=[];try{0===navigator.plugins.length&&window.chrome&&e.push("no_plugins_with_chrome")}catch{}0!==window.outerWidth&&0!==window.outerHeight||e.push("zero_outer_dimensions"),0===screen.availHeight&&e.push("zero_avail_height");try{0===navigator.languages.length&&e.push("empty_languages")}catch{}try{window.chrome&&void 0===window.chrome?.runtime&&e.push("chrome_without_runtime")}catch{}try{"undefined"!=typeof Notification&&"denied"===Notification.permission&&"prompt"===(await navigator.permissions.query({name:"notifications"})).state&&e.push("notification_permission_contradiction")}catch{}return e}(),r=function(){let e=null;try{if(e=document.createElement("canvas").getContext("webgl"),!e)return!1;const t=e.getExtension("WEBGL_debug_renderer_info");if(!t)return!1;const n=e.getParameter(t.UNMASKED_RENDERER_WEBGL);if("string"!=typeof n)return!1;const r=["swiftshader","google swiftshader","llvmpipe","mesa","software rasterizer","microsoft basic render driver"],o=n.toLowerCase();return r.some(e=>o.includes(e))}catch{return!1}finally{if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}}}();let o=0;return e&&(o+=30),t.length>0&&(o+=25),n.length>=2&&(o+=20),r&&(o+=25),{webdriver:e,automationMarkers:t,headlessIndicators:n,softwareRenderer:r,botScore:o}}},ct={name:"agentDetection",tier:2,async collect(){const e=function(){const e=[];try{13===navigator.hardwareConcurrency&&e.push("unusual_core_count_13")}catch{}try{4===navigator.deviceMemory&&6===navigator.hardwareConcurrency&&e.push("manus_hardware_signature")}catch{}try{1280===screen.width&&1100===screen.height&&e.push("manus_resolution")}catch{}try{if("UTC"===Intl.DateTimeFormat().resolvedOptions().timeZone){const t=navigator.languages||[],n=["en-GB","pt-PT","is","is-IS"];t.some(e=>n.includes(e))||e.push("utc_timezone_mismatch")}}catch{}return e}(),t=function(){try{const e=navigator.userAgent||"",t=navigator.userAgentData?.platform,n=navigator.platform||"";let r="";if(/Windows/.test(e)?r="Windows":/Macintosh|Mac OS X/.test(e)?r="macOS":/Android/.test(e)?r="Android":/iPhone|iPad|iPod/.test(e)?r="iOS":/Linux/.test(e)&&(r="Linux"),t){const e=t.toLowerCase();if("linux"===e&&("macOS"===r||"Windows"===r))return!1;if("windows"===e&&"macOS"===r)return!1;if("macos"===e&&"Windows"===r)return!1}if(n){const e=n.toLowerCase();if(e.includes("linux")&&("macOS"===r||"Windows"===r))return!1;if(e.includes("win")&&"macOS"===r)return!1;if(e.includes("mac")&&"Windows"===r)return!1}return!0}catch{return!0}}(),n=function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=(new Date).getTimezoneOffset();return"UTC"!==e||0===t}catch{return!0}}(),r=function(e,t){return e.includes("unusual_core_count_13")?"chatgpt":e.includes("manus_hardware_signature")&&e.includes("manus_resolution")?"manus":t?null:"operator"}(e,t);let o=0;return o+=25*e.length,t||(o+=30),r&&(o+=50),{fingerprintAnomalies:e,uaPlatformMatch:t,timezoneConsistent:n,detectedAgent:r,agentScore:o}}},lt={name:"tamperDetection",tier:2,async collect(){const e=function(){try{const e=navigator.userAgent||"",t=/Chrome\//.test(e)&&!/Edg\//.test(e),n=/Firefox\//.test(e)&&!/Chrome/.test(e),r="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-moz-appearance","none"),o=void 0!==window.chrome;return!(t&&r||n&&o)}catch{return!0}}(),t=function(){try{const e=Object.getOwnPropertyDescriptor(Navigator.prototype,"userAgent");if(!e)return!1;if(!e.get)return!1;const t=e.get.toString();return!!/\[native code\]/.test(t)}catch{return!0}}(),n=function(){try{const e=eval.toString().length;if(33!==e&&37!==e&&39!==e&&(e<20||e>60))return!1;try{if(1!==new(0,navigator.userAgent.constructor.constructor)("return 1")())return!1}catch{return!1}return!0}catch{return!0}}(),r=function(){const e=[];try{"_"in window&&e.push("multilogin")}catch{}try{void 0!==window.chrome&&0===navigator.plugins.length&&e.push("empty_plugins_chromium")}catch{}try{const t=window;if(t.safari){const n=t.safari.toString?.();n&&!/\[object Safari\]/.test(n)&&e.push("safari_object_spoofed")}}catch{}try{const t=navigator.userAgent||"",n=t.match(/Chrome\/(\d+)/);n&&parseInt(n[1],10)>=88&&/Macintosh/.test(t)&&void 0===window.BarcodeDetector&&e.push("missing_barcode_detector")}catch{}return e}(),o=function(){try{const e=((new Error).stack||"").split("\n").filter(e=>e.trim().length>0);for(const t of e){const e=t.trim();if("Error"!==e){if(/^\s*at\s/.test(e))return"chromium";if(/@/.test(e)&&!e.startsWith("at"))return/^\w+@/.test(e)?"gecko":"webkit"}}return"unknown"}catch{return"unknown"}}(),i=eval.toString().length;let a=0;if(e||(a+=30),t||(a+=25),n||(a+=20),a+=15*r.length,"unknown"!==o){const e=navigator.userAgent||"";("gecko"===o&&!/Firefox/.test(e)||"chromium"===o&&/Firefox/.test(e)&&!/Chrome/.test(e))&&(a+=10)}return{uaEngineConsistent:e,navigatorPropsNative:t,prototypeChainIntact:n,antiDetectMarkers:r,stackTraceFormat:o,evalLength:i,tamperScore:a}}},ut={name:"vmDetection",tier:2,async collect(){const e=function(){const e=[];try{navigator.hardwareConcurrency<=2&&e.push("low_core_count")}catch{}try{const t=navigator.deviceMemory;"number"==typeof t&&t<=2&&e.push("low_memory")}catch{}try{screen.colorDepth<24&&e.push("low_color_depth")}catch{}try{screen.colorDepth!==screen.pixelDepth&&e.push("depth_mismatch")}catch{}return e}();let t="",n=null;try{if(n=document.createElement("canvas").getContext("webgl"),n){const e=n.getExtension("WEBGL_debug_renderer_info");e&&(t=n.getParameter(e.UNMASKED_RENDERER_WEBGL)||"")}}catch{}finally{if(n)try{const e=n.getExtension("WEBGL_lose_context");e&&e.loseContext()}catch{}}const r=function(e){if(!e)return[];const t=e.toLowerCase();return dt.filter(e=>t.includes(e))}(t),o=function(e){if(!e)return!1;const t=e.toLowerCase();return mt.some(e=>t.includes(e))}(t);let i=0;return r.length>0?i=.9:o?i=.5:e.length>=3&&(i=.3),{isVM:r.length>0,vmRendererMatches:r,softwareRenderer:o,confidence:i,indicators:e}}},dt=["virtualbox","vmware","svga3d","qemu","parallels","hyper-v","qxl","red hat","virtio","citrix"],mt=["swiftshader","google swiftshader","llvmpipe","mesa","software rasterizer","microsoft basic render driver","softpipe"],pt=[{label:"h264",contentType:'video/mp4; codecs="avc1.42E01E"',width:1920,height:1080,bitrate:5e6,framerate:30},{label:"vp8",contentType:'video/webm; codecs="vp8"',width:1920,height:1080,bitrate:5e6,framerate:30},{label:"vp9",contentType:'video/webm; codecs="vp09.00.10.08"',width:1920,height:1080,bitrate:5e6,framerate:30},{label:"av1",contentType:'video/mp4; codecs="av01.0.05M.08"',width:1920,height:1080,bitrate:5e6,framerate:30}],ft=[{label:"aac",contentType:'audio/mp4; codecs="mp4a.40.2"',channels:"2",bitrate:128e3,samplerate:44100},{label:"opus",contentType:'audio/webm; codecs="opus"',channels:"2",bitrate:128e3,samplerate:48e3}],ht=[Z,J,ee,oe,ae,me,pe,fe,he,ge,ye,we,Se,_e,Ee,Ae,ke,Re,Ie,De,Fe,Ve,je,Ue,ze,Xe,qe,Ke,Ze,Qe,et,tt,ot,at,it,st,ct,lt,ut,{name:"devtoolsDetection",tier:2,collect:async()=>({dimensionDelta:function(){const e=window.outerHeight-window.innerHeight,t=window.outerWidth-window.innerWidth;return{heightDelta:e,widthDelta:t,likelyOpen:e>200||t>200}}(),consoleNative:function(){try{return/\[native code\]/.test(Function.prototype.toString.call(console.log))}catch{return!0}}()})},{name:"webApis",tier:2,async collect(){const e=navigator,t=window;return{credentials:void 0!==e.credentials,usb:void 0!==e.usb,bluetooth:void 0!==e.bluetooth,clipboard:void 0!==e.clipboard,serial:void 0!==e.serial,hid:void 0!==e.hid,xr:void 0!==e.xr,share:"function"==typeof e.share,wakeLock:void 0!==e.wakeLock,presentation:void 0!==e.presentation,mediaSession:void 0!==e.mediaSession,ink:void 0!==e.ink,virtualKeyboard:void 0!==e.virtualKeyboard,eyeDropper:void 0!==t.EyeDropper,getScreenDetails:"function"==typeof t.getScreenDetails,paymentRequest:void 0!==t.PaymentRequest,adoptedStyleSheets:void 0!==document.adoptedStyleSheets,cssHighlights:void 0!==t.CSS?.highlights}}},{name:"notificationState",tier:2,async collect(){const e="undefined"!=typeof Notification;return{supported:e,permission:e?Notification.permission:null}}},{name:"extendedLocale",tier:2,collect:async()=>({languages:Array.from(navigator.languages??[])})},{name:"privacyPrefs",tier:2,async collect(){const e=navigator;return{doNotTrack:navigator.doNotTrack??null,globalPrivacyControl:e.globalPrivacyControl??null}}},{name:"performanceContext",tier:2,async collect(){let e=null;try{const t=performance.getEntriesByType("navigation");t.length>0&&(e=t[0].nextHopProtocol||null)}catch{}let t=[];try{t=Array.from(PerformanceObserver.supportedEntryTypes??[])}catch{}return{nextHopProtocol:e,supportedEntryTypes:t}}},{name:"sensors",tier:2,async collect(){const e=window;return{deviceOrientation:void 0!==e.DeviceOrientationEvent,deviceMotion:void 0!==e.DeviceMotionEvent,gyroscope:void 0!==e.Gyroscope,accelerometer:void 0!==e.Accelerometer,ambientLightSensor:void 0!==e.AmbientLightSensor,absoluteOrientationSensor:void 0!==e.AbsoluteOrientationSensor,relativeOrientationSensor:void 0!==e.RelativeOrientationSensor}}},{name:"battery",tier:2,collect:async()=>({supported:"function"==typeof navigator.getBattery})},{name:"gamepads",tier:2,collect:async()=>({supported:"function"==typeof navigator.getGamepads})},{name:"storage",tier:2,async collect(){let e=null;try{navigator.storage?.estimate&&(e=(await navigator.storage.estimate()).quota??null)}catch{}let t=!1;try{t=void 0!==window.indexedDB}catch{}let n=!1;try{n=void 0!==window.localStorage}catch{}let r=!1;try{r=void 0!==window.caches}catch{}return{quota:e,indexedDB:t,localStorage:n,cacheApi:r}}},{name:"features",tier:2,async collect(){const e=window;return{isSecureContext:!!e.isSecureContext,webdriver:!!navigator.webdriver,crossOriginIsolated:!!e.crossOriginIsolated,sharedArrayBuffer:void 0!==e.SharedArrayBuffer,webAssembly:void 0!==e.WebAssembly,bigInt:void 0!==e.BigInt,offscreenCanvas:void 0!==e.OffscreenCanvas}}},{name:"screen",tier:2,async collect(){const e=window.visualViewport;return{availWidth:screen.availWidth??0,availHeight:screen.availHeight??0,devicePixelRatio:window.devicePixelRatio??1,orientationType:screen.orientation?.type??null,orientationAngle:screen.orientation?.angle??null,visualViewport:e?{width:e.width,height:e.height,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,scale:e.scale}:null}}},{name:"mediaCapabilities",tier:2,async collect(){if(!navigator.mediaCapabilities?.decodingInfo)return null;const e={},t=[...pt.map(e=>({label:e.label,config:{type:"file",video:{contentType:e.contentType,width:e.width,height:e.height,bitrate:e.bitrate,framerate:e.framerate}}})),...ft.map(e=>({label:e.label,config:{type:"file",audio:{contentType:e.contentType,channels:e.channels,bitrate:e.bitrate,samplerate:e.samplerate}}}))];return await Promise.allSettled(t.map(async({label:t,config:n})=>{try{const r=await navigator.mediaCapabilities.decodingInfo(n);e[t]={supported:r.supported,smooth:r.smooth,powerEfficient:r.powerEfficient}}catch{e[t]=null}})),e}}];async function gt(e,t,n){const r={},o=[],i=ht.filter(t=>!e.has(t.name)&&(n||3!==t.tier)),a=await Promise.allSettled(i.map(async e=>{const n=await(r=e.collect(),o=t,new Promise((e,t)=>{const n=setTimeout(()=>e(null),o);r.then(t=>{clearTimeout(n),e(t)},e=>{clearTimeout(n),t(e)})}));var r,o;return{name:e.name,value:n}}));for(let e=0;e<a.length;e++){const t=a[e],n=i[e].name;"fulfilled"===t.status&&null!==t.value.value?r[n]=t.value.value:"rejected"===t.status&&o.push({signal:n,error:String(t.reason?.message??t.reason)})}return{components:r,errors:o}}async function yt(t){const r=function(e){return e?{exclude:e.exclude??n.exclude,include:e.include??n.include,timeout:e.timeout??n.timeout,stabilize:e.stabilize??n.stabilize,experimental:e.experimental??n.experimental,debug:e.debug??n.debug,salt:e.salt??n.salt}:{...n}}(t),i=a(),s=function(){try{return window.self!==window.top}catch{return!0}}();let c=!1;try{c=await l(i.name)}catch{}const u=function(e,t,n,r){const i=new Set;for(const a of e){if("private"===a&&!n)continue;if("iframe"===a&&!r)continue;const e=o[a];if(e)for(const n of e)if(!n.browsers||n.browsers.includes(t))for(const e of n.exclude)i.add(e)}return i}(r.stabilize,i.name,c,s),d=new Set(r.exclude);for(const e of r.include)d.delete(e),u.delete(e);const{components:f,errors:h}=await gt(d,r.timeout,r.experimental),m=$(Object.fromEntries(Object.entries(f).filter(([e])=>!u.has(e))),r.salt,c),p=m[0],g={hash:p.hash,stableHash:p.stableHash,components:{...f},timestamp:(new Date).toISOString(),version:e,isIncognito:c,errors:h,hashPolicyVersion:p.policyVersion,hashes:m,browser:{...i}};return r.debug&&(console.log("[fingerprint] components:",f),console.log("[fingerprint] hash:",p.hash,"stableHash:",p.stableHash),h.length>0&&console.warn("[fingerprint] errors:",h)),g}new Set([...F,"fontPreferences","webglRender","clientHints","canvasTextMetrics","mediaCapabilities","features","sensors","webApis","performanceContext"]);const xt=new RegExp(["googlebot","bingbot","slurp","baiduspider","duckduckbot","yandex","sogou","exabot","ia_archiver","curl","wget","python-requests","python-urllib","axios","node-fetch","go-http-client","java/","libwww-perl","okhttp","apache-httpclient","http_request","httpie","headlesschrome","phantomjs","puppeteer","playwright","cypress","selenium","webdriver","electron","jsdom","vercel-screenshot","screenshot","prerender","lighthouse","chrome-lighthouse","pagespeed","gtmetrix","pingdom","nessus","nikto","sqlmap","burp","zap","qualys","openvas","nmap","masscan","facebookexternalhit","twitterbot","linkedinbot","whatsapp","telegrambot","slackbot","discordbot","bot","crawl","spider","scrape","fetch","scan"].join("|"),"i");function St(e){return!!e&&xt.test(e)}const S3_FINGERPRINT_URL="https://unshared-public.s3.us-east-2.amazonaws.com/fingerprint@1/fingerprint.umd.js",PROXY_FINGERPRINT_PATH="/__unshared/fingerprint.js",DEFAULT_LOAD_TIMEOUT_MS=1500;let cached;function resolveLoadTimeoutMs(){const e=globalThis.__UNSHARED_FP_LOAD_TIMEOUT_MS;return"number"==typeof e?e:1500}function readGlobalAgent(){if("undefined"==typeof window)return;const e=window.UnsharedFingerprint;return"function"==typeof e?.getFingerprint?e.getFingerprint:void 0}function injectScript(e,t){return new Promise(n=>{if("undefined"==typeof document||!document.head)return void n();let r=!1;const o=()=>{r||(r=!0,clearTimeout(i),n())},i=setTimeout(o,t),a=document.createElement("script");a.src=e,a.async=!0,a.onload=o,a.onerror=o,document.head.appendChild(a)})}function loadFingerprintAgent(e){return cached||(cached=(async()=>{const t=readGlobalAgent();if(t)return{getFingerprint:t,source:"remote"};const n=e.isProxy?`${e.proxyBaseUrl??""}${PROXY_FINGERPRINT_PATH}`:S3_FINGERPRINT_URL;await injectScript(n,resolveLoadTimeoutMs());const r=readGlobalAgent();return r?{getFingerprint:r,source:"remote"}:{getFingerprint:yt,source:"bundled"}})(),cached)}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},index_umd={exports:{}};!function(e){function t(e,t){return e&&(/^#[0-9a-fA-F]{3,8}$/.test(e)||/^rgba?\(\s*[\d.,\s]+\)$/.test(e))?e:t}const n=/^[a-zA-Z0-9\s,\-'"]+$/;function r(e){return e&&/^\d+(\.\d+)?(px|rem|em|%)?$/.test(e)?e:"8px"}const o=new Set;function i(e,t){let n=e;for(const e of t.split(".")){if(null==n||"object"!=typeof n)return"";n=n[e]}return null==n?"":String(n)}function a(e){if(!e)return"";const t=e.indexOf("@");if(t>0){const n=e.slice(0,t),r=e.slice(t);return`${n.slice(0,1)}${"*".repeat(Math.max(n.length-1,1))}${r}`}return e.length<=4?"*".repeat(e.length):`${"*".repeat(e.length-4)}${e.slice(-4)}`}function s(e,t,n,r){return"runtime"===t.source?t.path?i({user:n.user??{},device:n.device??{}},t.path):"":r.get(e)??""}const c={email_verification:{"verify-email":{op:"triggerEmailVerification",inputs:["email","deviceId"]},"verify-otp":{op:"verify",inputs:["email","deviceId","otp"]},"resend-verification":{op:"triggerEmailVerification",inputs:["email","deviceId"]}}};function u(e){const t=(e??"").trim();if(""===t)return!1;const n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;const r=n[1].toLowerCase();return"http"===r||"https"===r}function l(e){return{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`}}function d(e){return"string"!=typeof e?null:/^#[0-9a-fA-F]{3,8}$/.test(e)||/^rgba?\(\s*[\d.,\s]+\)$/.test(e)?e:null}function f(e,t,r={}){const o=t.props,i="heading"===t.type||"text"===t.type,a=o.fontSize;"number"==typeof a&&a>=8&&a<=120&&(e.style.fontSize=`${a}px`);const s=o.align,c="left"===s||"center"===s||"right"===s?s:void 0;c&&(e.style.textAlign=c);const u="boolean"==typeof o.bold?o.bold:r.bold;void 0!==u&&(e.style.fontWeight=u?"700":"400"),!0===o.italic&&(e.style.fontStyle="italic"),!0===o.underline&&(e.style.textDecoration="underline");const l="string"!=typeof(f=o.fontFamily)||""===f?null:n.test(f)?f:null;var f;l&&(e.style.fontFamily=l);const h=d(o.textColor)??r.color??null;h&&(e.style.color=h,i&&(e.style.opacity="1"));const m=o.verticalAlign;!i||"middle"!==m&&"bottom"!==m||(e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="bottom"===m?"flex-end":"center",e.style.alignItems="center"===c?"center":"right"===c?"flex-end":"flex-start")}function h(e,t){const n="string"==typeof e.props.binding?e.props.binding:"";return n&&t.flow.bindings[n]?function(e,t,n,r){if("never"===t.display)return"";const o=s(e,t,n,r);return"masked"===t.display?a(o):o}(n,t.flow.bindings[n],t.ctx,t.formState):String(e.props.text??"")}function m(e,t){const n=document.createElement("div");return n.className="el el-heading",Object.assign(n.style,l(e)),f(n,e,{bold:!0}),n.textContent=h(e,t),n}function p(e,t){const n=document.createElement("div");return n.className="el el-text",Object.assign(n.style,l(e)),f(n,e,{bold:!1}),n.textContent=h(e,t),n}function g(e){const t=document.createElement("img");return t.className="el el-image",Object.assign(t.style,l(e)),t.src=String(e.props.src??""),t.alt=String(e.props.alt??""),t}function y(e){const t=document.createElement("div");return t.className="el el-divider",t.style.left=`${e.x}px`,t.style.top=`${e.y+e.height/2}px`,t.style.width=`${e.width}px`,t}function _(e,t){const n=document.createElement("input");n.className="el el-input",Object.assign(n.style,l(e)),f(n,e),"string"==typeof e.props.placeholder&&(n.placeholder=e.props.placeholder),"number"==typeof e.props.maxLength&&(n.maxLength=e.props.maxLength),"string"==typeof e.props.pattern&&(n.pattern=e.props.pattern),"otp"===e.props.fieldType?n.inputMode="numeric":"email"===e.props.fieldType&&(n.type="email"),!0===e.props.autoFocus&&(n.autofocus=!0);const r=t.elementToBinding.get(e.id)??String(e.props.name??e.id);return n.value=t.formState.get(r)??"",n.addEventListener("input",()=>t.formState.set(r,n.value)),n}function v(e,t){const n=e?.goTo??e?.advanceTo;e?.dismiss?t.close():"string"==typeof n&&(t.screenState.goTo(n),t.screenState.isLast&&t.complete())}function w(e,t,n,r){e?.showError&&n(t instanceof Error&&t.message?t.message:"Something went wrong. Please try again."),e?.dismiss&&r.close()}function b(e,t,n){const r=document.createElement("button"),o="secondary"===e.props.variant?"secondary":"primary";r.className=`el el-button el-button-${o}`,Object.assign(r.style,l(e));const i=d(e.props.bgColor);return i&&(r.style.background=i),f(r,e),r.textContent=String(e.props.text??"Continue"),r.addEventListener("click",()=>{!async function(e,t,n,r){const o=String(e.props.action??"");if(!o)return;if("close"===o)return void t.close();if("prev-screen"===o)return void t.screenState.prev();if("next-screen"===o){if(t.screenState.isLast)return;return t.screenState.next(),void(t.screenState.isLast&&t.complete())}const i=t.flow.actions[o],a=e=>{r.textContent=e,r.classList.add("visible")};if("client_steps"===i?.type){const s=Array.isArray(e.props.steps)?e.props.steps:[];if(0===s.length)return void("undefined"!=typeof console&&console.warn(`[interstitial] client_steps action "${o}" has no steps`));r.classList.remove("visible"),n.disabled=!0;try{await async function(e){for(const t of e){if("redirect"===t.type)return u(t.url)?void window.location.assign(t.url):void("undefined"!=typeof console&&console.warn(`[interstitial] blocked unsafe redirect url: ${t.url}`));if("webhook"===t.type){const e=await fetch(t.url,{method:t.method??"POST",credentials:"same-origin"});if(!e.ok)throw new Error(`webhook ${t.url} returned ${e.status}`)}else"undefined"!=typeof console&&console.warn(`[interstitial] unknown step type: ${t.type}`)}}(s),v(i.onSuccess,t)}catch(e){w(i.onError,e,a,t)}finally{n.disabled=!1}return}const l=function(e,t,n,r){const o=c[e.flowType]?.[t];if(!o)return null;const i={};for(const t of o.inputs){const o=e.bindings[t];o&&(i[t]=s(t,o,n,r))}return{op:o.op,values:i}}(t.flow,o,t.ctx,t.formState);if(l){r.classList.remove("visible"),n.disabled=!0;try{await t.ctx.actions(l.op,l.values),v(i?.onSuccess,t)}catch(e){w(i?.onError,e,a,t)}finally{n.disabled=!1}}else"undefined"!=typeof console&&console.warn(`[interstitial] unknown action: ${o}`)}(e,t,r,n)}),r}function S(e,t,n){Array.from(t.children).forEach(e=>e.remove());const r=document.createElement("div");r.className="el-error",r.style.left="0",r.style.right="0",r.style.bottom="12px";for(const o of e.elements){let e=null;switch(o.type){case"heading":e=m(o,n);break;case"text":e=p(o,n);break;case"image":e=g(o);break;case"divider":e=y(o);break;case"input":e=_(o,n);break;case"button":e=b(o,n,r);break;default:e=null}e&&t.appendChild(e)}t.appendChild(r)}e.maskValue=a,e.renderFlow=function(e,i){const a=i.container??document.body,s=new Map,c=function(e){const t=new Map;for(const[n,r]of Object.entries(e.bindings))"form"===r.source&&r.elementId&&t.set(r.elementId,n);return t}(e);let u=!1;const l=()=>{u||(u=!0,d.destroy())},d=function(e,i,a){const s={primaryColor:t(e.primaryColor,"#4f46e5"),backgroundColor:t(e.backgroundColor,"#ffffff"),textColor:t(e.textColor,"#111827"),fontFamily:(c=e.fontFamily,c&&n.test(c)?c:"sans-serif"),borderRadius:r(e.borderRadius)};var c;const u=document.createElement("div");u.id="__unshared-interstitial-host",Object.assign(u.style,{position:"fixed",inset:"0",zIndex:"2147483647"}),a.appendChild(u),o.add(u);const l=u.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent=`\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n :host { all: initial; }\n .backdrop {\n position: fixed; inset: 0;\n /* Frost the page behind the modal: a lighter scrim reads as "blurred content"\n rather than "blacked out". Browsers without backdrop-filter fall back to the\n scrim alone, so it degrades to a plain dim — never worse. On the blockFlagged\n gate page there is no content behind it, so this has no visible effect there. */\n background: rgba(0,0,0,0.35);\n -webkit-backdrop-filter: blur(6px);\n backdrop-filter: blur(6px);\n display: flex; align-items: center; justify-content: center;\n }\n .frame {\n position: relative;\n background: ${function(e,n){const r=e.backgroundGradient;if(r&&"object"==typeof r){const{from:e,to:n,angle:o}=r,i=t(e,""),a=t(n,""),s="number"==typeof o&&isFinite(o)?o:180;if(i&&a)return`linear-gradient(${s}deg, ${i}, ${a})`}return n}(e,s.backgroundColor)};\n color: ${s.textColor};\n font-family: ${s.fontFamily};\n border-radius: ${s.borderRadius};\n width: ${i.width}px;\n height: ${i.height}px;\n max-width: 95vw; max-height: 95vh;\n overflow: hidden;\n box-shadow: 0 20px 60px rgba(0,0,0,0.3);\n }\n .frame:focus { outline: none; }\n .el { position: absolute; }\n .el-heading { font-weight: 700; line-height: 1.2; color: ${s.textColor}; }\n .el-text { color: ${s.textColor}; opacity: 0.75; line-height: 1.5; }\n .el-image { object-fit: contain; }\n /* Hairline: uses the frame's text color at low opacity so it reads on light AND dark themes. */\n .el-divider { background: currentColor; opacity: 0.12; height: 1px; }\n .el-input {\n width: 100%; height: 100%;\n border: 1.5px solid #D1D5DB; border-radius: ${s.borderRadius};\n padding: 0 12px; font-family: ${s.fontFamily}; outline: none;\n transition: border-color 0.15s;\n }\n .el-input:focus { border-color: ${s.primaryColor}; }\n .el-button {\n width: 100%; height: 100%;\n border-radius: ${s.borderRadius}; font-weight: 600;\n font-family: ${s.fontFamily}; cursor: pointer; transition: opacity 0.15s;\n }\n .el-button:hover { opacity: 0.9; }\n .el-button:disabled { opacity: 0.5; cursor: not-allowed; }\n .el-button-primary { background: ${s.primaryColor}; color: #fff; border: none; }\n .el-button-secondary { background: transparent; color: ${s.primaryColor}; border: 1.5px solid ${s.primaryColor}; }\n .el-error {\n position: absolute; color: #DC2626; font-size: 13px;\n display: none; text-align: center;\n }\n .el-error.visible { display: block; }\n `,l.appendChild(d);const f=document.createElement("div");f.className="backdrop";const h=document.createElement("div");h.className="frame",h.setAttribute("role","dialog"),h.setAttribute("aria-modal","true"),h.tabIndex=-1,f.appendChild(h),l.appendChild(f);const m=document.body.style.overflow;document.body.style.overflow="hidden";const p=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation())};document.addEventListener("keydown",p,!0);const g=e=>{const t=e.target;if(t){for(const e of o)if(e.contains(t))return;h.focus()}};return document.addEventListener("focusin",g,!0),h.focus(),{shadowRoot:l,frame:h,destroy:()=>{document.removeEventListener("keydown",p,!0),document.removeEventListener("focusin",g,!0),document.body.style.overflow=m,o.delete(u),u.remove()}}}(e.theme,e.frame,a),f={flow:e,ctx:i,formState:s,elementToBinding:c,screenState:void 0,close:()=>{l(),i.onDismiss?.()},complete:()=>i.onComplete?.()},h=function(e,t,n){let r=Math.max(e.findIndex(e=>e.id===t),0);return{get current(){return e[r]},get isLast(){return r===e.length-1},next(){r<e.length-1&&(r++,n(e[r]))},prev(){r>0&&(r--,n(e[r]))},goTo(t){const o=e.findIndex(e=>e.id===t);-1!==o&&o!==r&&(r=o,n(e[r]))}}}(e.screens,e.initialScreenId,e=>{S(e,d.frame,f)});return f.screenState=h,S(h.current,d.frame,f),{destroy:l}},e.resolvePath=i}(index_umd.exports);var index_umdExports=index_umd.exports;const SENTINEL_USER_IDS=new Set(["__pre_auth__","anonymous","guest","undefined","null"]);function isSentinelUserId(e){return"string"==typeof e&&SENTINEL_USER_IDS.has(e)}const DEFAULT_MAX_RETRIES=3,DEFAULT_TIMEOUT_MS=3e4,MAX_TOTAL_RETRY_MS=8e3,MAX_DELAY_MS=3e4,BASE_DELAY_MS=1e3,SUBMIT_FP_PATH="/__unshared/submit-fp",PROXY_FLOW_PATH="/__unshared/interstitial-flow",PROXY_VERIFY_TRIGGER_PATH="/__unshared/verify-trigger",PROXY_VERIFY_PATH="/__unshared/verify",RECONCILED_HEADER="X-Unshared-Enforcement-Reconciled",DIRECT_SUBMIT_PATH="/v3/browser/submit-fingerprint-event",DIRECT_CHECK_PATH="/v3/browser/check-user",DIRECT_TRIGGER_PATH="/v3/browser/trigger-email-verification",DIRECT_VERIFY_PATH="/v3/browser/verify",DIRECT_STATUS_PATH="/v2/browser/email-verification-status",DIRECT_FLOW_PATH="/v2/browser/interstitial-flow",HARD_BLOCK_FLOW={flowType:"hard_block",schemaVersion:"2.0.0",name:"Access denied",initialScreenId:"blocked",actions:{},bindings:{},frame:{width:420,height:200},theme:{},screens:[{id:"blocked",elements:[{id:"heading",type:"heading",x:24,y:30,width:372,height:48,props:{text:"Access denied"}},{id:"message",type:"text",x:24,y:90,width:372,height:80,props:{text:"Your account cannot access this content. Contact support for assistance."}}]}]},DEFAULT_API_URL=["http","s://","api.","unsh","ared",".ai"].join(""),SS_EMAIL_KEY="__unshared_email",SS_FP_KEY="__unshared_fp",SS_LAST_SUBMIT_KEY="__unshared_last_submit",SS_RAW_FP_KEY="__unshared_fp_raw",SS_VERIFICATION_KEY="__unshared_verification_id",LS_DEVICE_ID="__unshared_device_id",LS_EVENT_QUEUE="__unshared_event_queue",LS_EVENT_QUEUE_INFLIGHT="__unshared_event_queue_inflight",COOKIE_UID="__unshared_uid",COOKIE_SID="__unshared_sid",COOKIE_DEVICE_ID="__unshared_device_id",COOKIE_STABLE_HASH="__unshared_stable_hash",COOKIE_FULL_HASH="__unshared_full_hash",COOKIE_FP_ID="__unshared_fp_id",SDK_VERSION="3.0.0",MAX_REQUEST_BYTES=1<<20,MAX_PROXY_REQUEST_BYTES=102400,MAX_ENCRYPTED_REQUEST_BYTES=1572864,SESSION_STORAGE_CAPTURE_KEYS=[SS_EMAIL_KEY,SS_LAST_SUBMIT_KEY,SS_VERIFICATION_KEY],UUID_V4_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,OTP_PATTERN=/^\d{6}$/,RFC3339_PATTERN=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/,CHECK_RETRYABLE_CODES=new Set(["RATE_LIMIT_UNAVAILABLE","AUDIT_UNAVAILABLE"]),BUILD_TIME_PUBLISHABLE_KEY="__UNSHARED_PUBLISHABLE_API_KEY__";function generateUUID(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function generatePermanentDeviceId(){return`upid_${generateUUID()}`}function isPermanentDeviceId(e){return"string"==typeof e&&/^upid_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function sleep(e){return new Promise(t=>setTimeout(t,e))}function retryDelay(e){const t=Math.min(1e3*Math.pow(2,e-1),3e4),n=500*Math.random()-250;return Math.max(0,t+n)}function getCookie(e){try{if("undefined"==typeof document)return;const t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}catch{return}}function secureSuffix(){try{return"undefined"!=typeof location&&"https:"===location.protocol?"; Secure":""}catch{return""}}function setCookie(e,t){try{if("undefined"==typeof document)return;document.cookie=`${e}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Max-Age=31536000${secureSuffix()}`}catch{}}function setPersistentCookie(e,t){try{if("undefined"==typeof document)return;document.cookie=`${e}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Max-Age=34560000${secureSuffix()}`}catch{}}function deleteCookie(e){try{if("undefined"==typeof document)return;document.cookie=`${e}=; Path=/; SameSite=Lax; Expires=Thu, 01 Jan 1970 00:00:00 GMT${secureSuffix()}`}catch{}}function getLocalStorageItem(e){try{if("undefined"==typeof localStorage)return;return localStorage.getItem(e)??void 0}catch{return}}function setLocalStorageItem(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch{}}function removeLocalStorageItem(e){try{if("undefined"==typeof localStorage)return;localStorage.removeItem(e)}catch{}}function getSessionStorageItem(e){try{if("undefined"==typeof sessionStorage)return;return sessionStorage.getItem(e)??void 0}catch{return}}function compareStorageEntries(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function collectCookies(){try{return"undefined"==typeof document?[]:document.cookie.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{const t=e.indexOf("="),n=-1===t?e:e.slice(0,t),r=-1===t?"":e.slice(t+1);try{return{name:n,value:decodeURIComponent(r)}}catch{return{name:n,value:r}}}).sort(compareStorageEntries)}catch{return[]}}function collectStorage(e,t){try{if(!e)return[];const n=[];for(const r of t){const t=e.getItem(r);null!==t&&n.push({name:r,value:t})}return n.sort(compareStorageEntries)}catch{return[]}}function collectBrowserStorage(){let e,t;try{e="undefined"==typeof localStorage?void 0:localStorage}catch{}try{t="undefined"==typeof sessionStorage?void 0:sessionStorage}catch{}return{cookies:collectCookies(),local_storage:collectStorage(e,[LS_DEVICE_ID]),session_storage:collectStorage(t,SESSION_STORAGE_CAPTURE_KEYS)}}function setSessionStorageItem(e,t){try{if("undefined"==typeof sessionStorage)return;sessionStorage.setItem(e,t)}catch{}}function asJSONObject(e){return null===e||"object"!=typeof e||Array.isArray(e)?{}:e}function isJSONObject(e,t=new WeakSet){if(null===e||"object"!=typeof e||Array.isArray(e)||t.has(e))return!1;const n=Object.getPrototypeOf(e);if(n!==Object.prototype&&null!==n)return!1;t.add(e);for(const n of Object.values(e))if(null!==n&&"string"!=typeof n&&"boolean"!=typeof n&&!("number"==typeof n&&Number.isFinite(n)||Array.isArray(n)&&isJSONValue(n,t)||isJSONObject(n,t)))return!1;return t.delete(e),!0}function isJSONValue(e,t){if(null===e||"string"==typeof e||"boolean"==typeof e)return!0;if("number"==typeof e)return Number.isFinite(e);if(Array.isArray(e)){if(t.has(e))return!1;t.add(e);let n=Object.keys(e).length===e.length;for(let r=0;n&&r<e.length;r++)n=Object.prototype.hasOwnProperty.call(e,r)&&isJSONValue(e[r],t);return t.delete(e),n}return isJSONObject(e,t)}function hasExactKeys(e,t){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&(Object.keys(e).length===t.length&&t.every(t=>Object.prototype.hasOwnProperty.call(e,t)))}function isValidTimestamp(e){if("string"!=typeof e)return!1;const t=RFC3339_PATTERN.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]),i=Number(t[4]),a=Number(t[5]),s=Number(t[6]),c=Number(t[7]??0),u=Number(t[8]??0);return r>=1&&r<=12&&o>=1&&o<=[31,n%4!=0||n%100==0&&n%400!=0?28:29,31,30,31,30,31,31,30,31,30,31][r-1]&&i<=23&&a<=59&&s<=59&&c<=23&&u<=59}function isStrictSuccessEnvelope(e){return hasExactKeys(e,["success","data"])&&!0===e.success}function isStrictErrorEnvelope(e){return hasExactKeys(e,["success","error"])&&!1===e.success&&hasExactKeys(e.error,["code","message"])&&"string"==typeof e.error.code&&"string"==typeof e.error.message}function isIngestResult(e){return hasExactKeys(e,["event_id","collected_at","endpoint_version"])&&"string"==typeof e.event_id&&UUID_V4_PATTERN.test(e.event_id)&&isValidTimestamp(e.collected_at)&&"v3"===e.endpoint_version}function isCheckUserResult(e){const t=["is_user_flagged","decision_id","decision_code"];if(!hasExactKeys(e,t)&&!hasExactKeys(e,[...t,"enforcement_type"]))return!1;if("enforcement_type"in e&&(!["no_enforcement","soft_block","hard_block"].includes(e.enforcement_type)||e.is_user_flagged!==("no_enforcement"!==e.enforcement_type)))return!1;const n=new Set(["FLAGGED_RISK_MATCH","NO_ENFORCING_RISK","NO_IDENTITY_MATCH","IDENTITY_UNCERTAIN","CHECK_UNAVAILABLE"]);return"boolean"==typeof e.is_user_flagged&&"string"==typeof e.decision_id&&UUID_V4_PATTERN.test(e.decision_id)&&"string"==typeof e.decision_code&&n.has(e.decision_code)&&e.is_user_flagged===("FLAGGED_RISK_MATCH"===e.decision_code)}function isTriggerEmailResult(e){return hasExactKeys(e,["verification_id","next_allowed_at","retry_after_seconds"])&&"string"==typeof e.verification_id&&UUID_V4_PATTERN.test(e.verification_id)&&isValidTimestamp(e.next_allowed_at)&&Number.isInteger(e.retry_after_seconds)&&e.retry_after_seconds>=0}function isVerifyEmailResult(e){return hasExactKeys(e,["verified","verification_scope"])?!0===e.verified&&"email"===e.verification_scope:hasExactKeys(e,["verified","verification_scope","reason"])&&!1===e.verified&&"email"===e.verification_scope&&"invalid_code"===e.reason}function stringField(e,...t){for(const n of t){const t=e[n];if("string"==typeof t&&""!==t.trim())return t}}function getSharedDedup(){if("undefined"==typeof window)return;const e=window;return e.__unshared=e.__unshared||{}}function isValidUrl(e){try{return new URL(e),!0}catch{return!1}}function isSecureOrLoopbackUrl(e){const t=new URL(e);return"https:"===t.protocol||"localhost"===t.hostname||"[::1]"===t.hostname||/^127\./.test(t.hostname)}function resolveDefaultPublishableKey(e){if(void 0===e)return BUILD_TIME_PUBLISHABLE_KEY.startsWith("__UNSHARED_")?void 0:BUILD_TIME_PUBLISHABLE_KEY}function hasWebCrypto(){return"undefined"!=typeof crypto&&!!crypto.subtle&&!!crypto.getRandomValues}async function sha256Hex(e){if(hasWebCrypto())try{const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch{return}}function bytesToBase64(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function encryptEvent(e,t){if(!hasWebCrypto())throw new Error("WebCrypto is unavailable");const n=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)),r=await crypto.subtle.importKey("raw",n,{name:"AES-GCM"},!1,["encrypt"]),o=crypto.getRandomValues(new Uint8Array(12)),i=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,tagLength:128},r,(new TextEncoder).encode(e))),a=i.slice(i.length-16),s=i.slice(0,i.length-16);return JSON.stringify({encrypted_data:`${bytesToBase64(o)}:${bytesToBase64(a)}:${bytesToBase64(s)}`})}class UnsharedBrowser{constructor(e={}){var t;if(this.v=!1,this.S=!1,this.I=0,this.T=0,e.baseUrl&&!isValidUrl(e.baseUrl))throw new Error('baseUrl must be a valid URL (e.g. "https://app.example.com")');if(e.apiUrl&&!isValidUrl(e.apiUrl))throw new Error('apiUrl must be a valid URL (e.g. ["http","s://","api.","unsh","ared",".ai"].join(""))');if(e.baseUrl&&!isSecureOrLoopbackUrl(e.baseUrl))throw new Error("baseUrl must use HTTPS except for loopback development URLs");if(e.apiUrl&&!isSecureOrLoopbackUrl(e.apiUrl))throw new Error("apiUrl must use HTTPS except for loopback development URLs");let n,r;this.A=e.baseUrl?e.baseUrl.replace(/\/$/,""):"",this.C=e.publishableKey??resolveDefaultPublishableKey(e.baseUrl),this.R=(e.apiUrl??DEFAULT_API_URL).replace(/\/$/,""),this.O=e.maxRetries??3,this.P=e.timeout??3e4,this.D=e.includePathPrefix,this.k=e.skipPaths,this.L=e.sessionId,this.U=e.deviceId,this.M=e.enableInterstitial??!1,this.N=e.interstitialFlowType??"email_verification",this.F=getSharedDedup()??{},this.F.generation||((t=this.F).lastKey??(t.lastKey=getSessionStorageItem(SS_LAST_SUBMIT_KEY))),removeLocalStorageItem(LS_EVENT_QUEUE),removeLocalStorageItem(LS_EVENT_QUEUE_INFLIGHT);try{n=this.L?.()}catch{}this.B=n??this.F.sessionId??getCookie(COOKIE_SID)??generateUUID(),this.F.sessionId=this.B,setPersistentCookie(COOKIE_SID,this.B);try{r=this.U?.()}catch{}if(r)this.$=r;else{const e=getLocalStorageItem(LS_DEVICE_ID);this.$=isPermanentDeviceId(e)?"":e??""}const o=getLocalStorageItem(LS_DEVICE_ID);this.V=isPermanentDeviceId(o)?o:"",this.K(),this.M&&this.j()}async init(e){try{if("undefined"!=typeof navigator&&St(navigator.userAgent))return;if(!e.userId||isSentinelUserId(e.userId))return void this.H;if(!1===e.isPaidSubscriber)return void(this.v=!0);this.v=!1;const t=this.F.generation??0;this.Y(),this.H=e.userId,this.G=e.emailAddress,setSessionStorageItem(SS_EMAIL_KEY,e.emailAddress),setCookie(COOKIE_UID,e.userId);const{wire:n,raw:r}=await this.W();if(t!==(this.F.generation??0)||this.H!==e.userId||this.v)return;let o;try{o=this.U?.()}catch{}o?this.$=o:n.fingerprint_id&&(this.$=n.fingerprint_id),this.q(n,r,t).catch(()=>{})}catch{}}onRouteChange(){try{if(!(this.G??this.J()))return;const e=this.X();if(!e)return;this.q(e.wire,e.raw).catch(()=>{})}catch{}}destroy(){try{this.F.generation=(this.F.generation??0)+1,delete this.F.collection,delete this.F.collectionPromise,delete this.F.lastKey,delete this.F.flagged,this.I++;try{"undefined"!=typeof sessionStorage&&(sessionStorage.removeItem(SS_EMAIL_KEY),sessionStorage.removeItem(SS_FP_KEY),sessionStorage.removeItem(SS_RAW_FP_KEY),sessionStorage.removeItem(SS_LAST_SUBMIT_KEY),sessionStorage.removeItem(SS_VERIFICATION_KEY))}catch{}deleteCookie(COOKIE_UID),this.Z&&"undefined"!=typeof document&&(document.removeEventListener("DOMContentLoaded",this.Z),this.Z=void 0),this.ee&&"undefined"!=typeof window&&(window.removeEventListener("unshared:flagged",this.ee),this.ee=void 0),this.te?.destroy(),this.te=void 0,this.S=!1,this.H=void 0,this.G=void 0,this.v=!1}catch{}}async collect(e){return(await this.ne(e)).wire}async collectRaw(e){return(await this.ne(e)).raw}async collectWithMetadata(e){return this.ne(e)}async ne(e){const{getFingerprint:t,source:n}=await loadFingerprintAgent({proxyBaseUrl:this.A,isProxy:!this.C}),r=asJSONObject(await t(e)),o=stringField(r,"stableHash","stable_hash","fingerprint_id")??"",i=stringField(r,"hash","full_hash")??"";return{raw:r,wire:{...r,fingerprint_id:o,full_hash:i,components:asJSONObject(r.components),timestamp:stringField(r,"timestamp","collected_at")??(new Date).toISOString(),isIncognito:"boolean"==typeof r.isIncognito&&r.isIncognito,version:stringField(r,"version")??"unknown",source:n},source:n}}async submitFingerprintEvent(e,t){try{if(this.v)return{success:!0};const n=this.re(e,e,{userId:t.userId,eventType:t.eventType,permanentDeviceId:t.permanentDeviceId}),r=generateUUID(),o=await this.oe(this.ie(),JSON.stringify(n),r);return o.success?o.data?{success:!0,data:{...o.data,hash:e.full_hash,stable_hash:e.fingerprint_id,collected_at:o.data.collected_at??e.timestamp,version:e.version??"unknown"}}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 ingestion result"}}:{success:!1,error:o.error}}catch(e){return{success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}}async submitFingerprint(e){try{return this.v?{success:!0}:isJSONObject(e)?await this.oe(this.ie(),JSON.stringify(e),generateUUID()):{success:!1,error:{code:"VALIDATION_ERROR",message:"Fingerprint payload must be a valid JSON object"}}}catch(e){return{success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}}async checkUser(e){return this.ae(e,!0)}async ae(e,t,n){const r=this.se(e,!1);if("success"in r)return r;if("string"!=typeof r.email||""===r.email.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"email must be a non-empty string"}};const o={...this.H?{user_id:this.H}:{},email_address:r.email,identifiers:this.ce(r,!0)},i=this.F.generation,a=++this.T,s=await this.ue("POST",DIRECT_CHECK_PATH,{body:o,retry:t,expectedStatus:200,validateData:isCheckUserResult,retryErrorCodes:CHECK_RETRYABLE_CODES});if(!s.success)return s;if(!s.data)return{success:!1,error:{code:"PARSE_ERROR",message:"Missing Check result"}};if(i!==this.F.generation||a!==this.T||void 0!==n&&n!==this.I)return s;const c=getSharedDedup();return s.data.is_user_flagged?c&&(c.flagged={email:r.email,...s.data.enforcement_type?{enforcement_type:s.data.enforcement_type}:{}}):"CHECK_UNAVAILABLE"!==s.data.decision_code&&c?.flagged?.email&&c.flagged.email.trim().toLowerCase()===r.email.trim().toLowerCase()&&delete c.flagged,s}async triggerEmailVerification(e){const t=this.se(e,!1);if("success"in t)return t;if("string"!=typeof t.email||""===t.email.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"email must be a non-empty string"}};const n={email_address:t.email,identifiers:this.ce(t,!1)},r=await this.ue("POST",DIRECT_TRIGGER_PATH,{body:n,retry:!1,expectedStatus:200,validateData:isTriggerEmailResult});return r.success&&r.data?(setSessionStorageItem(SS_VERIFICATION_KEY,JSON.stringify({email:t.email.toLowerCase(),verificationId:r.data.verification_id})),{success:!0,data:{...r.data,message:"Verification email sent"}}):r}async verify(e,t){const n=this.se(t,!1);if("success"in n)return n;const r=this.le(n.email);return r?this.de({verification_id:r,code:e},n):{success:!1,error:{code:"MISSING_VERIFICATION_ID",message:"Trigger email verification before verifying the code."}}}async verifyEmail(e){return this.de(e)}async de(e,t){if(!this.C)return{success:!1,error:{code:"DIRECT_MODE_REQUIRED",message:"This method requires direct mode — construct the SDK with a publishableKey."}};if(null===e||"object"!=typeof e||"string"!=typeof e.verification_id||!UUID_V4_PATTERN.test(e.verification_id)||"string"!=typeof e.code||!OTP_PATTERN.test(e.code))return{success:!1,error:{code:"VALIDATION_ERROR",message:"verification_id must be UUIDv4 and code must be exactly 6 digits"}};const n=this.I,r=this.F.generation,o=await this.ue("POST",DIRECT_VERIFY_PATH,{body:e,retry:!1,expectedStatus:200,validateData:isVerifyEmailResult});if(o.success&&o.data?.verified&&n===this.I&&r===this.F.generation){const r=t??this.fe(e.verification_id);try{sessionStorage.removeItem(SS_VERIFICATION_KEY)}catch{}await this.ae(r,!1,n)}return o}async emailVerificationStatus(e){const t=this.se(e);return"success"in t?t:this.ue("GET",DIRECT_STATUS_PATH,{query:{email_address:t.email,device_id:t.deviceId,permanent_device_id:t.permanentDeviceId},retry:!0})}async showInterstitial(e){const t=!this.C;if("undefined"==typeof document)return{success:!1,error:{code:"NO_DOM",message:"showInterstitial requires a browser DOM."}};const n=e?.enforcementType??getSharedDedup()?.flagged?.enforcement_type??"soft_block";if("no_enforcement"===n)return{success:!0,data:{shown:!1}};if(this.S&&("hard_block"!==n||"hard_block"===this.he))return{success:!0,data:{shown:!1}};const r=++this.I,o=this.F.generation,i=()=>r===this.I&&o===this.F.generation;this.te?.destroy(),this.te=void 0,this.he=n,this.S=!0;const a=e?.flowType??this.N,s="hard_block"===n?{success:!0,data:HARD_BLOCK_FLOW}:t?await this.me(a):await this.pe(a);if(!i())return{success:!0,data:{shown:!1}};if(!s.success||!s.data)return this.S=!1,{success:!1,error:s.error};try{return this.te=index_umdExports.renderFlow(s.data,{user:t?{}:{email:this.G??this.J()??""},device:t?{}:{id:this.$},actions:async(e,n)=>{if(!i())throw new Error("This verification is no longer active.");const r=t?this.ge():this.ye();if(await r(e,n),!i())throw new Error("This verification is no longer active.")},container:e?.container,onComplete:()=>{i()&&e?.onComplete?.()},onDismiss:()=>{i()&&(this.S=!1,this.te=void 0,e?.onDismiss?.())}}),{success:!0,data:{shown:!0}}}catch(e){return this.S=!1,{success:!1,error:{code:"RENDER_FAILED",message:e instanceof Error?e.message:String(e)}}}}async pe(e){return this.ue("GET",DIRECT_FLOW_PATH,{query:{flow_type:e,platform:"web"},retry:!0})}async me(e){try{const t=`${this.A}${PROXY_FLOW_PATH}?flow_type=${encodeURIComponent(e)}&platform=web`,n=await fetch(t,{method:"GET",credentials:"include"}),r=await n.json().catch(()=>({}));return n.ok&&!1!==r?.success&&r?.data?{success:!0,data:r.data}:{success:!1,error:r?.error??{code:"FLOW_FETCH_FAILED",message:`Flow fetch failed (${n.status})`}}}catch(e){return{success:!1,error:{code:"FLOW_FETCH_FAILED",message:e instanceof Error?e.message:String(e)}}}}ge(){const e=this.I,t=this.F.generation,n=async(e,t)=>{const n=await fetch(`${this.A}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||!1===r?.success)throw new Error(r?.error?.message??"Request failed. Please try again.");return{json:r,enforcementReconciled:"clean"===n.headers?.get?.(RECONCILED_HEADER),enforcementType:n.headers?.get?.("X-Unshared-Enforcement-Type")}};return async(r,o)=>{if("triggerEmailVerification"!==r){if("verify"===r){const{json:r,enforcementReconciled:i,enforcementType:a}=await n(PROXY_VERIFY_PATH,{code:o.otp});if(e!==this.I||t!==this.F.generation)throw new Error("This verification is no longer active.");if("hard_block"===a){const e=getSharedDedup();e&&(e.flagged={...e.flagged,enforcement_type:"hard_block"}),await this.showInterstitial({enforcementType:"hard_block"})}if(!1===r?.data?.verified)throw new Error("Incorrect or expired code. Please try again.");if(!0!==r?.data?.verified||!i)throw new Error("Access is still restricted. Please refresh to check your account status.");if(i){const e=getSharedDedup();e&&delete e.flagged}return}throw new Error(`Unsupported interstitial action: ${r}`)}await n(PROXY_VERIFY_TRIGGER_PATH,{})}}ye(){const e=this.I,t=this.F.generation;return async(n,r)=>{const o={email:r.email,deviceId:r.deviceId};if("triggerEmailVerification"===n){const e=await this.triggerEmailVerification(o);if(!e.success)throw new Error(e.error?.message??"Could not send the verification code.");return}if("verify"===n){const n=await this.verify(r.otp,o);if(e!==this.I||t!==this.F.generation)throw new Error("This verification is no longer active.");if(!n.success)throw new Error(n.error?.message??"Verification failed.");if("hard_block"===getSharedDedup()?.flagged?.enforcement_type&&await this.showInterstitial({enforcementType:"hard_block"}),getSharedDedup()?.flagged)throw new Error("Access is still restricted. Please refresh to check your account status.");if(n.data&&!1===n.data.verified)throw new Error("Incorrect or expired code. Please try again.");return}throw new Error(`Unsupported interstitial action: ${n}`)}}j(){try{if("undefined"==typeof window)return;this.ee=e=>{this.showInterstitial({enforcementType:e?.detail?.enforcement_type})},window.addEventListener("unshared:flagged",this.ee),getSharedDedup()?.flagged&&this.showInterstitial()}catch{}}se(e,t=!0){if(this.v)return{success:!1,error:{code:"COLLECTION_DISABLED",message:"Collection is disabled for this user."}};if(!this.C)return{success:!1,error:{code:"DIRECT_MODE_REQUIRED",message:"This method requires direct mode — construct the SDK with a publishableKey."}};const n=e?.email??this.G??this.J(),r=e?.deviceId??this.$,o=e?.permanentDeviceId??this.Y();return!n||t&&!r?{success:!1,error:{code:"MISSING_IDENTITY",message:"No email/deviceId available — call init() first or pass them explicitly."}}:{email:n,deviceId:r,permanentDeviceId:o,stableHash:e?.stableHash,fullHash:e?.fullHash}}async ue(e,t,n){try{let r=`${this.R}${t}`;n.query&&(r+=`?${new URLSearchParams(n.query).toString()}`);const o={"X-Publishable-Key":this.C,"X-Session-Id":this.B,"X-Device-Id":this.$};t===DIRECT_CHECK_PATH&&(o["X-Unshared-Enforcement-Version"]="1");const i={method:e,headers:o};if(void 0!==n.body){o["Content-Type"]="application/json";const e=JSON.stringify(n.body);if((new TextEncoder).encode(e).byteLength>1048576)return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Request body exceeds 1 MiB"}};i.body=e}const a=n.retry?this.O+1:1,s=n.retry?Date.now()+8e3:1/0;let c={code:"DELIVERY_FAILED",message:"Request failed"};for(let e=1;e<=a&&!(Date.now()>=s);e++){if(e>1){const t=Math.max(0,s-Date.now());if(0===t)break;await sleep(Math.min(retryDelay(e-1),t))}if(Date.now()>=s)break;const t=new AbortController,o=Math.min(this.P,Math.max(0,s-Date.now())),a=setTimeout(()=>t.abort(),n.retry?o:this.P);try{const e=await fetch(r,{...i,signal:t.signal}),o=await e.text();let a;try{a=JSON.parse(o)}catch{return{success:!1,error:{code:"PARSE_ERROR",message:"Invalid JSON response"}}}if(void 0!==n.expectedStatus&&n.validateData){if(isStrictErrorEnvelope(a)){if(c={code:a.error.code,message:a.error.message,retryAfter:Number(e.headers?.get?.("Retry-After"))||void 0},n.retry&&503===e.status&&n.retryErrorCodes?.has(a.error.code))continue;return{success:!1,error:c}}return e.status===n.expectedStatus&&isStrictSuccessEnvelope(a)&&n.validateData(a.data)?{success:!0,data:a.data}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 response"}}}if(e.status>=500){const t=a?.error??{};c={code:"string"==typeof t.code?t.code:"DELIVERY_FAILED",message:"string"==typeof t.message?t.message:`Backend returned ${e.status}`};continue}if(e.status>=400||!1===a?.success){const t=a?.error??{};return{success:!1,error:{code:"string"==typeof t.code?t.code:"UPSTREAM_ERROR",message:"string"==typeof t.message?t.message:`Backend returned ${e.status}`,retryAfter:Number(e.headers?.get?.("Retry-After"))||t.details?.retry_after_seconds,nextAllowedAt:t.details?.next_allowed_at}}}return!0===a?.success&&Object.prototype.hasOwnProperty.call(a,"data")?{success:!0,data:a.data}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 response envelope"}}}catch(e){c={code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}finally{clearTimeout(a)}}return{success:!1,error:c}}catch(e){return{success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}}J(){return getSessionStorageItem(SS_EMAIL_KEY)}_e(){const e=getSessionStorageItem(SS_FP_KEY);if(e)try{return JSON.parse(e)}catch{return}}ve(){const e=getSessionStorageItem(SS_RAW_FP_KEY);if(e)try{const t=JSON.parse(e);return isJSONObject(t)?t:void 0}catch{return}}X(){const e=this.F;if(e.collection)return e.collection;if(e.collectionPromise||e.generation)return;const t=this._e(),n=this.ve();return t&&"string"==typeof t.fingerprint_id&&"string"==typeof t.full_hash&&n?e.collection={wire:t,raw:n,source:t.source??"bundled"}:void 0}async W(){const e=this.F,t=e.generation??0,n=this.X();if(n)return n;if(e.collectionPromise)return e.collectionPromise;const r=this.ne().then(n=>{if(t!==(e.generation??0)||e.collectionPromise!==r)throw new Error("Collection cancelled");e.collection=n;try{sessionStorage.removeItem(SS_RAW_FP_KEY),sessionStorage.setItem(SS_FP_KEY,JSON.stringify(n.wire)),sessionStorage.setItem(SS_RAW_FP_KEY,JSON.stringify(n.raw))}catch{}return n}).finally(()=>{e.collectionPromise===r&&delete e.collectionPromise});return e.collectionPromise=r,r}le(e){const t=getSessionStorageItem(SS_VERIFICATION_KEY);if(t)try{const n=JSON.parse(t);return n.email===e.toLowerCase()&&"string"==typeof n.verificationId?n.verificationId:void 0}catch{return}}fe(e){const t=getSessionStorageItem(SS_VERIFICATION_KEY);if(t)try{const n=JSON.parse(t);return n.verificationId===e&&"string"==typeof n.email?{email:n.email}:void 0}catch{return}}we(){if("undefined"==typeof location)return!0;const e=location.pathname||"/";if(this.k)for(const t of this.k)if(e.startsWith(t))return!1;return!this.D||this.D.some(t=>e.startsWith(t))}async q(e,t,n=this.F.generation??0){if(n!==(this.F.generation??0))return{success:!0};if("undefined"!=typeof navigator&&St(navigator.userAgent))return{success:!0};if(this.v)return{success:!0};if(!this.we())return{success:!0};const r=this.G??this.J(),o=this.H??getCookie(COOKIE_UID);if(!o||isSentinelUserId(o))return{success:!0};this.Y(),this.B=this.F.sessionId??this.B,setPersistentCookie(COOKIE_SID,this.B),e.fingerprint_id&&(setPersistentCookie(COOKIE_STABLE_HASH,e.fingerprint_id),setPersistentCookie(COOKIE_FP_ID,e.fingerprint_id)),e.full_hash&&setPersistentCookie(COOKIE_FULL_HASH,e.full_hash);const i="undefined"!=typeof location?(location.pathname||"/")+(location.search||""):"/",a=this.re(t??asJSONObject(e),e,{userId:o,email:r,eventType:i}),s=JSON.stringify(a);if((new TextEncoder).encode(s).byteLength>(this.C?1048576:102400))return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Request body exceeds "+(this.C?"1 MiB":"100 KiB")}};if(o){const e=`${o}|${i}`,t=this.F;if(t.lastKey===e)return{success:!0};t.lastKey=e,setSessionStorageItem(SS_LAST_SUBMIT_KEY,e)}const c=`${e.fingerprint_id}|${o??""}|${i}`,u=await sha256Hex(c);if(n!==(this.F.generation??0))return{success:!0};const l=u??(this.C?`${c}|${Math.floor(Date.now()/6e4)}`:c);return this.oe(this.ie(),s,l)}ie(){return this.C?`${this.R}${DIRECT_SUBMIT_PATH}`:`${this.A}${SUBMIT_FP_PATH}`}K(){try{if("undefined"==typeof document)return;this.Z&&document.removeEventListener("DOMContentLoaded",this.Z),this.Z=()=>{if(this.v||!this.we())return;if("undefined"!=typeof navigator&&St(navigator.userAgent))return;const e=this.H??getCookie(COOKIE_UID);if(!e||isSentinelUserId(e))return;if(!(this.G??this.J()))return;const t=this.F.generation??0;this.W().then(({raw:e,wire:n})=>{if(t!==(this.F.generation??0))return;let r;try{r=this.U?.()}catch{}return this.$=r||n.fingerprint_id||this.$,this.q(n,e,t)}).catch(()=>{})},document.addEventListener("DOMContentLoaded",this.Z)}catch{}}async oe(e,t,n){if((new TextEncoder).encode(t).byteLength>(this.C?1048576:102400))return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Request body exceeds "+(this.C?"1 MiB":"100 KiB")}};if(this.C){try{t=await encryptEvent(t,this.C)}catch(e){return{success:!1,error:{code:"CLIENT_ENCRYPTION_ERROR",message:e instanceof Error?e.message:String(e)}}}if((new TextEncoder).encode(t).byteLength>1572864)return{success:!1,error:{code:"REQUEST_TOO_LARGE",message:"Encrypted request body exceeds 1.5 MiB"}}}let r={success:!1,error:{code:"DELIVERY_FAILED",message:"Request failed"}};for(let o=1;o<=1;o++){const o=new AbortController,i=setTimeout(()=>o.abort(),this.P),a={"Content-Type":"application/json","X-Idempotency-Key":n,"X-Session-Id":this.B,"X-Device-Id":this.$};this.C||(a["X-Permanent-Device-Id"]=this.Y()),this.C&&(a["X-Publishable-Key"]=this.C);try{const n=await fetch(e,{method:"POST",headers:a,body:t,signal:o.signal,...!this.C&&this.be()?{credentials:"include"}:{}}),r=await n.text();let i;try{i=JSON.parse(r)}catch{return{success:!1,error:{code:"PARSE_ERROR",message:"Invalid JSON response"}}}if(isStrictErrorEnvelope(i)){const e=Number(n.headers?.get?.("Retry-After"))||void 0;return{success:!1,error:{...i.error,...e?{retryAfter:e}:{}}}}const s=this.C?202:200;return n.status===s&&isStrictSuccessEnvelope(i)&&isIngestResult(i.data)?{success:!0,data:i.data}:{success:!1,error:{code:"PARSE_ERROR",message:"Invalid v3 ingestion response"}}}catch(e){r={success:!1,error:{code:"DELIVERY_FAILED",message:e instanceof Error?e.message:String(e)}}}finally{clearTimeout(i)}}return r}ce(e,t){const n=this._e(),r={unshared_device_id:e.permanentDeviceId},o=e.stableHash||n?.fingerprint_id,i=e.fullHash||n?.full_hash;return e.deviceId&&(r.device_id=e.deviceId),o&&(r.stable_hash=o),i&&(r.full_hash=i),t&&this.B&&(r.session_hash=this.B),r}re(e,t,n){const r=n.permanentDeviceId??this.Y(),o={deviceId:this.$,permanentDeviceId:r,stableHash:t.fingerprint_id,fullHash:t.full_hash},i=n.userId??this.H??getCookie(COOKIE_UID),a=n.email??this.G??this.J(),s=n.eventType??("undefined"!=typeof location?(location.pathname||"/")+(location.search||""):"/"),c={fingerprint:e,context:{sdk:{name:"unshared-frontend-sdk",version:"3.0.0",agent_source:t.source??"unknown"},identity:{...i?{user_id:i}:{},...a?{email_address:a}:{}},identifiers:this.ce(o,!0),browser_storage:collectBrowserStorage(),event:{type:s,collected_at:(new Date).toISOString()}}};return!this.C&&(new TextEncoder).encode(JSON.stringify(c)).byteLength>102400&&(c.context.browser_storage.local_storage=[],c.context.browser_storage.session_storage=[],(new TextEncoder).encode(JSON.stringify(c)).byteLength>102400&&delete c.context.browser_storage),c}Y(){if(!isPermanentDeviceId(this.V)){const e=getLocalStorageItem(LS_DEVICE_ID),t=getCookie(COOKIE_DEVICE_ID);this.V=isPermanentDeviceId(e)?e:isPermanentDeviceId(t)?t:generatePermanentDeviceId(),setLocalStorageItem(LS_DEVICE_ID,this.V)}return setPersistentCookie(COOKIE_DEVICE_ID,this.V),this.V}be(){try{return"undefined"!=typeof location&&new URL(this.A||location.origin,location.href).origin===location.origin}catch{return!1}}}function createAxiosInterceptor(e){return t=>{if(403===t?.response?.status&&"account_flagged"===t?.response?.data?.error)try{e.onFlagged(t.response.data)}catch{}return Promise.reject(t)}}function createFetchInterceptor(e,t){return async(...n)=>{const r=await e(...n);if(403===r.status){const e=r.clone();try{const n=await e.json();if("account_flagged"===n?.error)try{t.onFlagged(n)}catch{}}catch{}}return r}}exports.UnsharedBrowser=UnsharedBrowser,exports.createAxiosInterceptor=createAxiosInterceptor,exports.createFetchInterceptor=createFetchInterceptor;
|