@dtect/security-sdk-js 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1,11 @@
1
- "use strict";var pe=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var gt=(e,t)=>{for(var r in t)pe(e,r,{get:t[r],enumerable:!0})},vt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Tt(t))!Ot.call(e,i)&&i!==r&&pe(e,i,{get:()=>t[i],enumerable:!(n=It(t,i))||n.enumerable});return e};var _t=e=>vt(pe({},"__esModule",{value:!0}),e);var br={};gt(br,{LanguageCodes:()=>q,QualityQuestionsRespondentTypes:()=>K,SecurityAPIError:()=>dt,checkQualityQuestions:()=>le,default:()=>Nr,getQualityQuestions:()=>ue,getSecurityResult:()=>ae,getSecurityToken:()=>ce,init:()=>Rt,isAIUsageDetected:()=>he});module.exports=_t(br);function At(e,t){return function(r,n){return Object.prototype.hasOwnProperty.call(r,n)}(e,t)?e[t]:void 0}function Dt(e,t,r,n){let i=document,o="securitypolicyviolation",c,s=p=>{let l=new URL(e,location.href),{blockedURI:h}=p;h!==l.href&&h!==l.protocol.slice(0,-1)&&h!==l.origin||(c=p,a())};i.addEventListener(o,s);let a=()=>i.removeEventListener(o,s);return n?.then(a,a),Promise.resolve().then(t).then(p=>(a(),p),p=>new Promise(l=>{let h=new MessageChannel;h.port1.onmessage=()=>l(),h.port2.postMessage(null)}).then(()=>{if(a(),c)return r(c);throw p}))}function w(e){let t="";for(let r=0;r<e.length;++r)if(r>0){let n=e[r].toLowerCase();n!==e[r]?t+=` ${n}`:t+=e[r]}else t+=e[r].toUpperCase();return t}var wt={default:"endpoint"},Nt={default:"tlsEndpoint"},bt="Client timeout",Pt="Network connection error",kt="Network request aborted",St="Response cannot be parsed",Ee="Blocked by CSP",me="The endpoint parameter is not a valid URL",Mt="Handle on demand agent data error",Lt=w("WrongRegion"),Ft=w("SubscriptionNotActive"),xt=w("UnsupportedVersion"),Ut=w("InstallationMethodRestricted"),qt=w("HostnameRestricted"),Kt=w("IntegrationFailed"),Gt=w("NetworkRestricted"),Bt=w("InvalidProxyIntegrationSecret"),Qt=w("InvalidProxyIntegrationHeaders"),Ct=w("ProxyIntegrationSecretEnvironmentMismatch"),Re="API key required",Se="API key not found",Me="API key expired",jt="Request cannot be parsed",Vt="Request failed",Yt="Request failed to process",$t="Too many requests, rate limit exceeded",Xt="Not available for this origin",Wt="Not available with restricted header",Jt=Re,zt=Se,Zt=Me,Ht="3.12.0",W="Failed to load the JS script of the agent",ye="9319";function er(e,t){let r=[],[n,i]=function(s){let a=function(h){let R=[...h];return{current:()=>R[0],postpone(){let y=R.shift();y!==void 0&&R.push(y)},exclude(){R.shift()}}}(s),p=function(h,R){let y=0;return()=>Math.random()*Math.min(R,h*Math.pow(2,y++))}(100,3e3),l=new Set;return[a.current(),(h,R)=>{let y,m=R instanceof Error?R.message:"";if(m===Ee||m===me)a.exclude(),y=0;else if(m===ye)a.exclude();else if(m===W){let g=Date.now()-h.getTime()<50,f=a.current();f&&g&&!l.has(f)&&(l.add(f),y=0),a.postpone()}else a.postpone();let d=a.current();return d===void 0?void 0:[d,y??h.getTime()+p()-Date.now()]}]}(e),o;if(n===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));let c=s=>{let a=new Date,p=h=>r.push({url:s,startedAt:a,finishedAt:new Date,error:h}),l=t(s);return l.then(()=>p(),p),l.catch(h=>{if(o!=null||(o=h),r.length>=5)throw o;let R=i(a,h);if(!R)throw o;let[y,m]=R;return(d=m,new Promise(g=>setTimeout(g,d))).then(()=>c(y));var d})};return c(n).then(s=>[s,r])}var Le="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",tr=Le;function rr(e){var t,r;let{picked:n,rest:i}=function(l,h){let R={},y={};for(let[m,d]of Object.entries(l))h.includes(m)?R[m]=d:y[m]=d;return{picked:R,rest:y}}(e,["scriptUrlPattern","token","apiKey"]),o=n.token,c=(t=n.apiKey)!==null&&t!==void 0?t:o,s=(r=At(e,"scriptUrlPattern"))!==null&&r!==void 0?r:Le,[a,p]=function(){let l=[],h=()=>{l.push({time:new Date,state:document.visibilityState})},R=function(y,m,d,g){return y.addEventListener(m,d,g),()=>y.removeEventListener(m,d,g)}(document,"visibilitychange",h);return h(),[l,R]}();return Promise.resolve().then(()=>{if(!c||typeof c!="string")throw new Error(Re);let l=function(h,R){return(Array.isArray(h)?h:[h]).map(y=>function(m,d){let g=encodeURIComponent;return m.replace(/<[^<>]+>/g,f=>f==="<version>"?"3":f==="<apiKey>"?g(d):f==="<loaderVersion>"?g(Ht):f)}(String(y),R))}(s,c);return er(l,nr)}).catch(l=>{throw p(),function(h){return h instanceof Error&&h.message===ye?new Error(W):h}(l)}).then(([l,h])=>(p(),l.load({...i,ldi:{attempts:h,visibilityStates:a}})))}function nr(e){return Dt(e,()=>function(t){return new Promise((r,n)=>{if(function(s){if(URL.prototype)try{return new URL(s,location.href),!1}catch(a){if(a instanceof Error&&a.name==="TypeError")return!0;throw a}}(t))throw new Error(me);let i=document.createElement("script"),o=()=>{var s;return(s=i.parentNode)===null||s===void 0?void 0:s.removeChild(i)},c=document.head||document.getElementsByTagName("head")[0];i.onload=()=>{o(),r()},i.onerror=()=>{o(),n(new Error(W))},i.async=!0,i.src=t,c.appendChild(i)})}(e),()=>{throw new Error(Ee)}).then(ir)}function ir(){let e=window,t="__fpjs_p_l_b",r=e[t];if(function(n,i){var o;let c=(o=Object.getOwnPropertyDescriptor)===null||o===void 0?void 0:o.call(Object,n,i);c?.configurable?delete n[i]:c&&!c.writable||(n[i]=void 0)}(e,t),typeof r?.load!="function")throw new Error(ye);return r}var U={load:rr,defaultScriptUrlPattern:tr,ERROR_SCRIPT_LOAD_FAIL:W,ERROR_API_KEY_EXPIRED:Me,ERROR_API_KEY_INVALID:Se,ERROR_API_KEY_MISSING:Re,ERROR_BAD_REQUEST_FORMAT:jt,ERROR_BAD_RESPONSE_FORMAT:St,ERROR_CLIENT_TIMEOUT:bt,ERROR_CSP_BLOCK:Ee,ERROR_FORBIDDEN_ENDPOINT:qt,ERROR_FORBIDDEN_HEADER:Wt,ERROR_FORBIDDEN_ORIGIN:Xt,ERROR_GENERAL_SERVER_FAILURE:Vt,ERROR_HANDLE_AGENT_DATA:Mt,ERROR_INSTALLATION_METHOD_RESTRICTED:Ut,ERROR_INTEGRATION_FAILURE:Kt,ERROR_INVALID_ENDPOINT:me,ERROR_INVALID_PROXY_INTEGRATION_HEADERS:Qt,ERROR_INVALID_PROXY_INTEGRATION_SECRET:Bt,ERROR_NETWORK_ABORT:kt,ERROR_NETWORK_CONNECTION:Pt,ERROR_NETWORK_RESTRICTED:Gt,ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH:Ct,ERROR_RATE_LIMIT:$t,ERROR_SERVER_TIMEOUT:Yt,ERROR_SUBSCRIPTION_NOT_ACTIVE:Ft,ERROR_TOKEN_EXPIRED:Zt,ERROR_TOKEN_INVALID:zt,ERROR_TOKEN_MISSING:Jt,ERROR_UNSUPPORTED_VERSION:xt,ERROR_WRONG_REGION:Lt,defaultEndpoint:wt,defaultTlsEndpoint:Nt};var v=[];for(let e=0;e<256;++e)v.push((e+256).toString(16).slice(1));function Fe(e,t=0){return(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase()}var Ie,sr=new Uint8Array(16);function Te(){if(!Ie){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ie=crypto.getRandomValues.bind(crypto)}return Ie(sr)}var or=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Oe={randomUUID:or};function ar(e,t,r){if(Oe.randomUUID&&!t&&!e)return Oe.randomUUID();e=e||{};let n=e.random??e.rng?.()??Te();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Fe(n)}var C=ar;var cr={UNAUTHORIZED:"Unauthorized"},ur={EXPIRED:"EXPIRED_TOKEN",INVALID_API_KEY:"INVALID_API_KEY",MISSING_AUTHENTICATION_TOKEN:"MISSING_AUTHENTICATION_TOKEN"},xe={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance",RATE_LIMIT_REACHED:"Too many requests. Rate limit exceeded"},Ue={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},qe={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},Ke={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},Ge={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},E={...cr,...ur,...xe,...Ue,...qe,...Ke,...Ge},Be={...xe,...Ue,...qe,...Ke,...Ge};var q=(f=>(f.AR="ar",f.BN="bn",f.DE="de",f.EN="en",f.ES="es",f.FR="fr",f.HI="hi",f.ID="id",f.IT="it",f.JA="ja",f.KO="ko",f.MS="ms",f.NL="nl",f.PT="pt",f.RU="ru",f.YU="yu",f.ZH="zh",f))(q||{}),K=(I=>(I.GeneralConsumer="general-consumer",I.HRManagerDirector="hr-manager-director",I.WebDeveloper="web-developer",I.SoftwareEngineer="software-engineer",I.ITDirector="it-director",I.BusinessAdministrator="business-administrator",I.AccountsPayableManager="accounts-payable-manager",I.Accountant="accountant",I.FinanceDirector="finance-director",I.SmallBusinessOwner="small-business-owner",I.GeneralContractor="general-contractor",I.MarketingManagerDirector="marketing-manager-director",I.ConsumerShopper="consumer-shopper",I.Travel="travel",I.Entertainment="entertainment",I.FinanceAndBanking="finance-and-banking",I.General="general",I.B2BWhiteCollar="b2b-white-collar",I.B2BBlueCollar="b2b-blue-collar",I.Lawyer="lawyer",I))(K||{});var lr=(e,t={})=>({"Content-Type":"application/json",...e?.accessToken&&{Authorization:`Bearer ${e?.accessToken}`},...t}),hr=async(e,t)=>{if(!e.ok){let r=await e.text();throw new Error(r)}return t==="file"?e.blob():t==="json"?e.json():t==="text"?e.text():null},Qe=async({url:e,auth:t,body:r,method:n="GET",headers:i={},responseType:o="json"})=>{let c={method:n,headers:lr(t,i),...r?{body:r instanceof FormData?r:JSON.stringify(r)}:{}},s=await fetch(e,c);return hr(s,o)},ge=e=>Qe({...e,method:"GET"}),J=e=>Qe({...e,method:"POST"});function Ce(e){let t=e?.qbc||!1,r=e?.mas||!1,n=e?.apd||!1,i=e?.scb||null,o=0,c=()=>{t=!1,r=!1,n=!1,i=void 0,o=0},s=()=>{let h=window?.getSelection()?.toString();h&&h.length>0&&(o=Date.now(),t=!0)},a=l=>{let h=l.clipboardData?.getData("text"),R=l.target instanceof HTMLInputElement||l.target instanceof HTMLTextAreaElement;h&&R&&(n=!0)},p=()=>{r=!0;let l=Date.now();if(o){let h=(l-o)/1e3;(i===void 0||h<i)&&(i=h)}};return document?.addEventListener("copy",s),document?.addEventListener("paste",a),window?.addEventListener("blur",p),{get qbc(){return t},get mas(){return r},get apd(){return n},get scb(){return i},reset:c,destroy(){document?.removeEventListener("copy",s),document?.removeEventListener("paste",a),window?.removeEventListener("blur",p)}}}var b=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var P=typeof window>"u"||"Deno"in globalThis;function A(){}function Ye(e,t){return typeof e=="function"?e(t):e}function $e(e){return typeof e=="number"&&e>=0&&e!==1/0}function Xe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function _e(e,t){return typeof e=="function"?e(t):e}function We(e,t){return typeof e=="function"?e(t):e}function Ae(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:c,stale:s}=e;if(c){if(n){if(t.queryHash!==j(c,t.options))return!1}else if(!B(t.queryKey,c))return!1}if(r!=="all"){let a=t.isActive();if(r==="active"&&!a||r==="inactive"&&a)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||i&&i!==t.state.fetchStatus||o&&!o(t))}function De(e,t){let{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(G(t.options.mutationKey)!==G(o))return!1}else if(!B(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function j(e,t){return(t?.queryKeyHashFn||G)(e)}function G(e){return JSON.stringify(e,(t,r)=>ve(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function B(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!B(e[r],t[r])):!1}function Je(e,t){if(e===t)return e;let r=je(e)&&je(t);if(r||ve(e)&&ve(t)){let n=r?e:Object.keys(e),i=n.length,o=r?t:Object.keys(t),c=o.length,s=r?[]:{},a=0;for(let p=0;p<c;p++){let l=r?p:o[p];(!r&&n.includes(l)||r)&&e[l]===void 0&&t[l]===void 0?(s[l]=void 0,a++):(s[l]=Je(e[l],t[l]),s[l]===e[l]&&e[l]!==void 0&&a++)}return i===c&&a===i?e:s}return t}function je(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ve(e){if(!Ve(e))return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(!Ve(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ve(e){return Object.prototype.toString.call(e)==="[object Object]"}function ze(e){return new Promise(t=>{setTimeout(t,e)})}function Ze(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?Je(e,t):t}function He(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n}function et(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var V=Symbol();function z(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===V?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var fr=class extends b{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!P&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Z=new fr;var dr=class extends b{#e=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!P&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},Q=new dr;function tt(){let e,t,r=new Promise((i,o)=>{e=i,t=o});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}function pr(e){return Math.min(1e3*2**e,3e4)}function we(e){return(e??"online")==="online"?Q.isOnline():!0}var rt=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function H(e){return e instanceof rt}function ee(e){let t=!1,r=0,n=!1,i,o=tt(),c=d=>{n||(R(new rt(d)),e.abort?.())},s=()=>{t=!0},a=()=>{t=!1},p=()=>Z.isFocused()&&(e.networkMode==="always"||Q.isOnline())&&e.canRun(),l=()=>we(e.networkMode)&&e.canRun(),h=d=>{n||(n=!0,e.onSuccess?.(d),i?.(),o.resolve(d))},R=d=>{n||(n=!0,e.onError?.(d),i?.(),o.reject(d))},y=()=>new Promise(d=>{i=g=>{(n||p())&&d(g)},e.onPause?.()}).then(()=>{i=void 0,n||e.onContinue?.()}),m=()=>{if(n)return;let d,g=r===0?e.initialPromise:void 0;try{d=g??e.fn()}catch(f){d=Promise.reject(f)}Promise.resolve(d).then(h).catch(f=>{if(n)return;let k=e.retry??(P?0:3),x=e.retryDelay??pr,I=typeof x=="function"?x(r,f):x,yt=k===!0||typeof k=="number"&&r<k||typeof k=="function"&&k(r,f);if(t||!yt){R(f);return}r++,e.onFail?.(r,f),ze(I).then(()=>p()?void 0:y()).then(()=>{t?R(f):m()})})};return{promise:o,cancel:c,continue:()=>(i?.(),o),cancelRetry:s,continueRetry:a,canStart:l,start:()=>(l()?m():y().then(m),o)}}function Er(){let e=[],t=0,r=s=>{s()},n=s=>{s()},i=s=>setTimeout(s,0),o=s=>{t?e.push(s):i(()=>{r(s)})},c=()=>{let s=e;e=[],s.length&&i(()=>{n(()=>{s.forEach(a=>{r(a)})})})};return{batch:s=>{let a;t++;try{a=s()}finally{t--,t||c()}return a},batchCalls:s=>(...a)=>{o(()=>{s(...a)})},schedule:o,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{i=s}}}var O=Er();var te=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$e(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(P?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}};var nt=class extends te{#e;#t;#r;#n;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Rr(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){let r=Ze(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(A).catch(A):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>We(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===V||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!Xe(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#n&&(this.#s?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(e&&this.setOptions(e),!this.options.queryFn){let s=this.observers.find(a=>a.options.queryFn);s&&this.setOptions(s.options)}let r=new AbortController,n=s=>{Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(this.#s=!0,r.signal)})},i=()=>{let s=z(this.options,t),a={queryKey:this.queryKey,meta:this.meta};return n(a),this.#s=!1,this.options.persister?this.options.persister(s,a,this):s(a)},o={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};n(o),this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta});let c=s=>{H(s)&&s.silent||this.#i({type:"error",error:s}),H(s)||(this.#r.config.onError?.(s,this),this.#r.config.onSettled?.(this.state.data,s,this)),this.scheduleGc()};return this.#n=ee({initialPromise:t?.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:s=>{if(s===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(s)}catch(a){c(a);return}this.#r.config.onSuccess?.(s,this),this.#r.config.onSettled?.(s,this.state.error,this),this.scheduleGc()},onError:c,onFail:(s,a)=>{this.#i({type:"failed",failureCount:s,error:a})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}),this.#n.start()}#i(e){let t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...mr(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let n=e.error;return H(n)&&n.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),O.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function mr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:we(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Rr(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Y=class extends b{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let n=t.queryKey,i=t.queryHash??j(n,t),o=this.get(i);return o||(o=new nt({cache:this,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){O.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(r=>Ae(t,r))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Ae(e,r)):t}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){O.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};var it=class extends te{#e;#t;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#t=e.mutationCache,this.#e=[],this.state=e.state||yr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){this.#r=ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(n,i)=>{this.#n({type:"failed",failureCount:n,error:i})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});let t=this.state.status==="pending",r=!this.#r.canStart();try{if(!t){this.#n({type:"pending",variables:e,isPaused:r}),await this.#t.config.onMutate?.(e,this);let i=await this.options.onMutate?.(e);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:r})}let n=await this.#r.start();return await this.#t.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#t.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#n({type:"success",data:n}),n}catch(n){try{throw await this.#t.config.onError?.(n,e,this.state.context,this),await this.options.onError?.(n,e,this.state.context),await this.#t.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,n,e,this.state.context),n}finally{this.#n({type:"error",error:n})}}finally{this.#t.runNext(this)}}#n(e){let t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),O.batch(()=>{this.#e.forEach(r=>{r.onMutationUpdate(e)}),this.#t.notify({mutation:this,type:"updated",action:e})})}};function yr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $=class extends b{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(e,t,r){let n=new it({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#e.add(e);let t=re(e);if(typeof t=="string"){let r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){let t=re(e);if(typeof t=="string"){let r=this.#t.get(t);if(r)if(r.length>1){let n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=re(e);if(typeof t=="string"){let n=this.#t.get(t)?.find(i=>i.state.status==="pending");return!n||n===e}else return!0}runNext(e){let t=re(e);return typeof t=="string"?this.#t.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){O.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(r=>De(t,r))}findAll(e={}){return this.getAll().filter(t=>De(e,t))}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(t=>t.state.isPaused);return O.batch(()=>Promise.all(e.map(t=>t.continue().catch(A))))}};function re(e){return e.options.scope?.id}function Ne(e){return{onFetch:(t,r)=>{let n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],c=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},a=0,p=async()=>{let l=!1,h=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?l=!0:t.signal.addEventListener("abort",()=>{l=!0}),t.signal)})},R=z(t.options,t.fetchOptions),y=async(m,d,g)=>{if(l)return Promise.reject();if(d==null&&m.pages.length)return Promise.resolve(m);let f={queryKey:t.queryKey,pageParam:d,direction:g?"backward":"forward",meta:t.options.meta};h(f);let k=await R(f),{maxPages:x}=t.options,I=g?et:He;return{pages:I(m.pages,k,x),pageParams:I(m.pageParams,d,x)}};if(i&&o.length){let m=i==="backward",d=m?Ir:st,g={pages:o,pageParams:c},f=d(n,g);s=await y(g,f,m)}else{let m=e??o.length;do{let d=a===0?c[0]??n.initialPageParam:st(n,s);if(a>0&&d==null)break;s=await y(s,d),a++}while(a<m)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p}}}function st(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Ir(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var be=class{#e;#t;#r;#n;#o;#s;#i;#a;constructor(e={}){this.#e=e.queryCache||new Y,this.#t=e.mutationCache||new $,this.#r=e.defaultOptions||{},this.#n=new Map,this.#o=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#i=Z.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Q.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#i?.(),this.#i=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#e.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(_e(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{let n=r.data;return[t,n]})}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(n.queryHash)?.state.data,c=Ye(t,o);if(c!==void 0)return this.#e.build(this,n).setData(c,{...r,manual:!0})}setQueriesData(e,t,r){return O.batch(()=>this.#e.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;O.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){let r=this.#e,n={type:"active",...e};return O.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(n,t)))}cancelQueries(e,t={}){let r={revert:!0,...t},n=O.batch(()=>this.#e.findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(A).catch(A)}invalidateQueries(e,t={}){return O.batch(()=>{if(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none")return Promise.resolve();let r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0},n=O.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,r);return r.throwOnError||(o=o.catch(A)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(A)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let r=this.#e.build(this,t);return r.isStaleByTime(_e(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(A).catch(A)}fetchInfiniteQuery(e){return e.behavior=Ne(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(A).catch(A)}ensureInfiniteQueryData(e){return e.behavior=Ne(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Q.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#n.set(G(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#n.values()],r={};return t.forEach(n=>{B(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#o.set(G(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#o.values()],r={};return t.forEach(n=>{B(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=j(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===V&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var Tr=new be({defaultOptions:{queries:{staleTime:3e4}},queryCache:new Y({onError:(e,t)=>{}}),mutationCache:new $}),ot=Tr;var at="dtect_security_sdk_state",ct=typeof window<"u",ut={isLoading:!1,token:"",visitorId:"",projectId:"",questionData:null,clientData:null,aiCheckData:null,tokens:null},ne={state:{...ut},securityKeys:{behaviorKey:"",automationKey:""}};function lt(){if(!ct)return ne;try{let e=sessionStorage.getItem(at);if(!e)return ne;let t=JSON.parse(e);return t.expiresAt&&t.expiresAt<Date.now()?ne:{state:{...ut,...t.state},securityKeys:t.securityKeys||{behaviorKey:"",automationKey:""}}}catch{return ne}}function S(e){if(ct)try{let t=Date.now()+864e5,r={...e,expiresAt:t};sessionStorage.setItem(at,JSON.stringify(r))}catch{}}function ht(e){return e.token||C()}async function _(e,t="info",r={}){let n=`${r.endpoint??"https://api.dtect.io/security"}/log`,i={message:e,type:t,payload:r};navigator.sendBeacon(n,JSON.stringify(i))}var ie,T="https://api.dtect.io/security",se=`${T}/client/check`,L="",F="",ft="0.0.19";var Or="20000000-aaaa-bbbb-cccc-000000000002",oe;var{state:u,securityKeys:{automationKey:D,behaviorKey:N}}=lt(),dt=Be,X;async function gr({clientId:e,apiKey:t,endpoint:r}){if(fe({automationKey:D,behaviorKey:N}))return{automationKey:D,behaviorKey:N};let n=await ot.fetchQuery({queryKey:["getClientConfig",e,t],queryFn:()=>ge({url:`${r}/client/config`,headers:{"client-id":L,"x-api-key":F}})});if(!fe(n))throw new Error;return D=n.automationKey,N=n.behaviorKey,S({state:u,securityKeys:n}),n}function Pe(e){if(e instanceof Error){if(e?.message?.includes("maintenance_mode"))throw new Error(E.MAINTENANCE_MODE);if(e?.message?.includes("rate-limited"))throw new Error(E.RATE_LIMIT_REACHED);switch(e?.message){case U.ERROR_RATE_LIMIT:throw new Error(E.RATE_LIMIT_REACHED);default:throw new Error(E.INTERNAL_SERVER_ERROR)}}throw new Error(E.FAILED_TO_GET_SECURITY_TOKEN)}function M(){if(mt(u)&&fe({automationKey:D,behaviorKey:N}))return!0;let e=de(),t=document.querySelector("#dtect-h-captcha");return!!ie&&!!(t||e)}function pt(){return!!(L&&F)}function vr(){return new Promise(e=>{let t=()=>{window?.hcaptcha?e():requestAnimationFrame(t)};t()})}var de=()=>window?.location?.href?.includes("localhost")||window?.location?.href?.includes("file:///");async function _r({behaviorKey:e}){if(ie=await U.load({apiKey:e,endpoint:["https://fp.dtect.io",U.defaultEndpoint],scriptUrlPattern:["https://fp.dtect.io/web/v<version>/<apiKey>/loader_v<loaderVersion>.js",U.defaultScriptUrlPattern]}),de()||(await vr(),await window.hcaptcha.render("dtect-h-captcha",{sitekey:D,size:"invisible"})),!ie)throw new Error(E.SDK_INIT_ERROR)}async function Ar(){let e=performance.now();if(u.tokens){let a=(performance.now()-e).toFixed();return _(`getTokens finishes in ${a}ms`,"info",{function:"getTokens",endpoint:T,diff:a,token:u.token}),u.tokens}let t=new Promise(s=>{let a=ie?.get();s(a)}),r=new Promise(async s=>{de()&&s({response:Or});let p=await window?.hcaptcha?.execute({async:!0});s(p)}),[n,i]=await Promise.all([r,t]);u.tokens={behaviorRequestId:i?.requestId,behaviorToken:i?.sealedResult,automationToken:n?.response};let c=(performance.now()-e).toFixed();return _(`getTokens finishes in ${c}ms`,"info",{function:"getTokens",endpoint:T,diff:c,token:u.token}),u.tokens}function Dr(e){let t=e?.projectId,r=e?.visitorId||C();return(typeof e?.projectId=="number"||typeof e?.visitorId=="number")&&(t=`${e?.projectId}`,r=`${e?.visitorId}`),{visitorId:r,projectId:t}}function ke(e){if(u.projectId&&u.visitorId)return{visitorId:u.visitorId,projectId:u.projectId};let{projectId:t,visitorId:r}=Dr(e);return{projectId:t,visitorId:r}}async function Et(e,t){let r=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);if(!pt())throw new Error(E.MISSING_CREDENTIALS);let{projectId:n,visitorId:i}=ke(e);if(u.projectId=n,u.visitorId=i,!e||!n?.trim())throw new Error(E.FAILED_TO_GET_SECURITY_RESULT);try{let o=await Ar();if(o?.behaviorToken&&o?.behaviorRequestId&&o?.automationToken){let c={behaviorToken:o.behaviorToken,automationToken:o.automationToken,behaviorRequestId:o.behaviorRequestId,entryLink:window?.location?.href,securitySettings:e.securitySettings,metaData:e.metaData};u.clientData=c;let s={...e,projectId:n,visitorId:i,clientData:c,version:"0.0.19",token:u.token,questionData:u.questionData,aiCheckData:u.aiCheckData},a=await J({url:`${t}`,body:{...s},headers:{"client-id":L,"x-api-key":F}});if("token"in a||"results"in a){S({state:u,securityKeys:{automationKey:D,behaviorKey:N}});let l=(performance.now()-r).toFixed();return _(`getResultBase finishes in ${l}ms`,"info",{function:"getResultBase",endpoint:T,diff:l,token:u.token}),a}}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-r).toFixed();if(_("getResultBase error","error",{function:"getResultBase",endpoint:T,error:o,diff:s,token:u.token}),o instanceof Error){if(o?.message?.includes("maintenance_mode"))throw new Error(E.MAINTENANCE_MODE);if(o?.message?.includes("rate-limited")||o?.message?.includes("429"))throw new Error(E.RATE_LIMIT_REACHED);switch(o?.message){case U.ERROR_RATE_LIMIT:throw new Error(E.RATE_LIMIT_REACHED);default:throw new Error(E.INTERNAL_SERVER_ERROR)}}throw new Error(E.FAILED_TO_GET_SECURITY_RESULT)}}async function ae(e){return await Et(e,`${T}/client/check/result`)}async function ce(e){return await Et(e,`${T}/client/check`)}async function ue(e){let t=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);let{respondentType:r,language:n}=e;try{let i=await ge({url:`${T}/client/quality-questions/${r}/${n}`,headers:{"client-id":L,"x-api-key":F}});if(i){let c=(performance.now()-t).toFixed();return _(`getQualityQuestions finishes in ${c}ms`,"info",{function:"getQualityQuestions",endpoint:T,diff:c,token:u.token}),i}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(i){let c=(performance.now()-t).toFixed();_("getQualityQuestions error","error",{endpoint:T,error:i,diff:c,token:u.token}),Pe(i)}}async function le(e){let t=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);u.questionData||(u.questionData={questions:e.questions});let{visitorId:r,projectId:n}=ke(e);u.visitorId=r,u.projectId=n;try{let i=await J({url:se,headers:{"client-id":L,"x-api-key":F},body:{token:u.token,visitorId:r,projectId:n,version:ft,questionData:u.questionData,aiCheckData:u.aiCheckData,clientData:u.clientData}});if(i){S({state:u,securityKeys:{automationKey:D,behaviorKey:N}});let c=(performance.now()-t).toFixed();return _(`checkQualityQuestions finishes in ${c}ms`,"info",{function:"checkQualityQuestions",endpoint:T,diff:c,token:u.token}),i}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(i){let c=(performance.now()-t).toFixed();_("checkQualityQuestions error","error",{endpoint:T,error:i,diff:c,token:u.token}),Pe(i)}}async function he(e){let t=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);u.aiCheckData={timeTakenSeconds:e.timeTakenSeconds,qbc:e.qbc||X.qbc,mas:e.mas||X.mas,scb:e.scb||X.scb,apd:e.apd||X.apd};let{visitorId:r,projectId:n}=ke(e);u.visitorId=r,u.projectId=n;try{let i=await J({url:se,headers:{"client-id":L,"x-api-key":F},body:{token:u.token,visitorId:r,projectId:n,version:ft,clientData:u.clientData,questionData:u.questionData,aiCheckData:u.aiCheckData}});if(i){S({state:u,securityKeys:{automationKey:D,behaviorKey:N}});let c=(performance.now()-t).toFixed();return _(`isAIUsageDetected finishes in ${c}ms`,"info",{function:"isAIUsageDetected",endpoint:T,diff:c,token:u.token}),i}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(i){let c=(performance.now()-t).toFixed();_("isAIUsageDetected error","error",{endpoint:T,error:i,diff:c,token:u.token}),Pe(i)}}function wr(){let e=performance.now(),t=document.querySelector("head"),r=document.querySelector("body");if(!de()){r?.insertAdjacentHTML("beforeend",'<div id="dtect-h-captcha" ></div>');let i=document.createElement("script");i.setAttribute("src","https://js.hcaptcha.com/1/api.js"),i.setAttribute("async","true"),i.setAttribute("defer","true"),t?.append(i);let c=(performance.now()-e).toFixed();_(`loadHCaptcha finishes in ${c}ms`,"info",{function:"loadHCaptcha",endpoint:T,diff:c,token:u.token})}}function fe(e){return e?.automationKey&&e?.behaviorKey}function mt(e){let t=e.tokens;return!!(t&&t.behaviorToken&&t.behaviorRequestId&&t.automationToken)}async function Rt(e){let t=performance.now();if(!e?.clientId||!e?.apiKey)throw _(E.MISSING_CREDENTIALS,"error",{endpoint:T,...e}),new Error(E.MISSING_CREDENTIALS);let{clientId:r,apiKey:n,endpoint:i="https://api.dtect.io/security",includeResults:o}=e;T=i,se=`${T}/client/check`;let c=ht(u);if(u.isLoading){if(M())return oe;throw _(E.DUPLICATE_INITIALIZATION,"error",{endpoint:T,clientId:r,apiKey:n,token:u.token}),new Error(E.DUPLICATE_INITIALIZATION)}if(X=Ce(u.aiCheckData),L=r,F=n,o&&(se=`${T}/client/check/result`),u={...u,isLoading:!0,token:c||""},mt(u)&&fe({automationKey:D,behaviorKey:N}))return u={...u,isLoading:!1,token:c},S({state:u,securityKeys:{automationKey:D,behaviorKey:N}}),{getSecurityResult:ae,getSecurityToken:ce,isAIUsageDetected:he,checkQualityQuestions:le,getQualityQuestions:ue,LanguageCodes:q,QualityQuestionsRespondentTypes:K};if(!pt())throw _(E.MISSING_CREDENTIALS,"error",{endpoint:T,...e}),new Error(E.MISSING_CREDENTIALS);if(M())return oe;wr();try{let a=await gr({clientId:r,apiKey:n,endpoint:i});if(M())throw new Error;return _r({behaviorKey:a.behaviorKey}).then(()=>{let l=(performance.now()-t).toFixed();return _(`init() finishes ${l}ms`,"info",{endpoint:T,function:"init",diff:l,token:u.token}),{getSecurityResult:ae,getSecurityToken:ce,SecurityAPIError:dt,isAIUsageDetected:he,checkQualityQuestions:le,getQualityQuestions:ue,LanguageCodes:q,QualityQuestionsRespondentTypes:K}}).catch(p=>{throw new Error(p.message)})}catch(a){if(a instanceof Error){if(_(a.message,"error",{function:"init",endpoint:T,error:a,token:u.token}),a?.message?.includes("maintenance_mode"))throw new Error(E.MAINTENANCE_MODE);if([E.INVALID_API_KEY,E.UNAUTHORIZED].includes(a?.message))throw new Error(E.INVALID_CREDENTIALS)}throw new Error(E.SDK_INIT_ERROR)}finally{u={...u,isLoading:!1,token:c},S({state:u,securityKeys:{automationKey:D,behaviorKey:N}})}}oe={init:Rt,getSecurityResult:ae,getSecurityToken:ce,isAIUsageDetected:he,checkQualityQuestions:le,getQualityQuestions:ue,QualityQuestionsRespondentTypes:K,LanguageCodes:q};var Nr=oe;
1
+ "use strict";var Ce=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var Rn=Object.getOwnPropertyNames;var vn=Object.prototype.hasOwnProperty;var bn=(e,t)=>{for(var n in t)Ce(e,n,{get:t[n],enumerable:!0})},Tn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Rn(t))!vn.call(e,o)&&o!==n&&Ce(e,o,{get:()=>t[o],enumerable:!(r=wn(t,o))||r.enumerable});return e};var An=e=>Tn(Ce({},"__esModule",{value:!0}),e);var po={};bn(po,{LanguageCodes:()=>Q,QualityQuestionsRespondentTypes:()=>W,SecurityAPIError:()=>pn,checkQualityQuestions:()=>Se,default:()=>ho,getQualityQuestions:()=>De,getSecurityResult:()=>Ae,getSecurityToken:()=>Oe,init:()=>In,isAIUsageDetected:()=>_e});module.exports=An(po);function On(e,t){return function(n,r){return Object.prototype.hasOwnProperty.call(n,r)}(e,t)?e[t]:void 0}function Dn(e,t,n,r){let o=document,i="securitypolicyviolation",s,a=m=>{let u=new URL(e,location.href),{blockedURI:l}=m;l!==u.href&&l!==u.protocol.slice(0,-1)&&l!==u.origin||(s=m,c())};o.addEventListener(i,a);let c=()=>o.removeEventListener(i,a);return r?.then(c,c),Promise.resolve().then(t).then(m=>(c(),m),m=>new Promise(u=>{let l=new MessageChannel;l.port1.onmessage=()=>u(),l.port2.postMessage(null)}).then(()=>{if(c(),s)return n(s);throw m}))}function F(e){let t="";for(let n=0;n<e.length;++n)if(n>0){let r=e[n].toLowerCase();r!==e[n]?t+=` ${r}`:t+=e[n]}else t+=e[n].toUpperCase();return t}var Sn={default:"endpoint"},_n={default:"tlsEndpoint"},Pn="Client timeout",kn="Network connection error",xn="Network request aborted",Nn="Response cannot be parsed",Fe="Blocked by CSP",Ue="The endpoint parameter is not a valid URL",Mn="Handle on demand agent data error",Ln=F("WrongRegion"),Cn=F("SubscriptionNotActive"),Fn=F("UnsupportedVersion"),Un=F("InstallationMethodRestricted"),Bn=F("HostnameRestricted"),qn=F("IntegrationFailed"),Kn=F("NetworkRestricted"),Gn=F("InvalidProxyIntegrationSecret"),Vn=F("InvalidProxyIntegrationHeaders"),jn=F("ProxyIntegrationSecretEnvironmentMismatch"),Be="API key required",Et="API key not found",It="API key expired",Qn="Request cannot be parsed",Wn="Request failed",$n="Request failed to process",zn="Too many requests, rate limit exceeded",Yn="Not available for this origin",Jn="Not available with restricted header",Xn=Be,Zn=Et,Hn=It,er="3.12.0",ae="Failed to load the JS script of the agent",qe="9319";function tr(e,t){let n=[],[r,o]=function(a){let c=function(l){let h=[...l];return{current:()=>h[0],postpone(){let E=h.shift();E!==void 0&&h.push(E)},exclude(){h.shift()}}}(a),m=function(l,h){let E=0;return()=>Math.random()*Math.min(h,l*Math.pow(2,E++))}(100,3e3),u=new Set;return[c.current(),(l,h)=>{let E,y=h instanceof Error?h.message:"";if(y===Fe||y===Ue)c.exclude(),E=0;else if(y===qe)c.exclude();else if(y===ae){let I=Date.now()-l.getTime()<50,g=c.current();g&&I&&!u.has(g)&&(u.add(g),E=0),c.postpone()}else c.postpone();let f=c.current();return f===void 0?void 0:[f,E??l.getTime()+m()-Date.now()]}]}(e),i;if(r===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));let s=a=>{let c=new Date,m=l=>n.push({url:a,startedAt:c,finishedAt:new Date,error:l}),u=t(a);return u.then(()=>m(),m),u.catch(l=>{if(i!=null||(i=l),n.length>=5)throw i;let h=o(c,l);if(!h)throw i;let[E,y]=h;return(f=y,new Promise(I=>setTimeout(I,f))).then(()=>s(E));var f})};return s(r).then(a=>[a,n])}var wt="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",nr=wt;function rr(e){var t,n;let{picked:r,rest:o}=function(u,l){let h={},E={};for(let[y,f]of Object.entries(u))l.includes(y)?h[y]=f:E[y]=f;return{picked:h,rest:E}}(e,["scriptUrlPattern","token","apiKey"]),i=r.token,s=(t=r.apiKey)!==null&&t!==void 0?t:i,a=(n=On(e,"scriptUrlPattern"))!==null&&n!==void 0?n:wt,[c,m]=function(){let u=[],l=()=>{u.push({time:new Date,state:document.visibilityState})},h=function(E,y,f,I){return E.addEventListener(y,f,I),()=>E.removeEventListener(y,f,I)}(document,"visibilitychange",l);return l(),[u,h]}();return Promise.resolve().then(()=>{if(!s||typeof s!="string")throw new Error(Be);let u=function(l,h){return(Array.isArray(l)?l:[l]).map(E=>function(y,f){let I=encodeURIComponent;return y.replace(/<[^<>]+>/g,g=>g==="<version>"?"3":g==="<apiKey>"?I(f):g==="<loaderVersion>"?I(er):g)}(String(E),h))}(a,s);return tr(u,or)}).catch(u=>{throw m(),function(l){return l instanceof Error&&l.message===qe?new Error(ae):l}(u)}).then(([u,l])=>(m(),u.load({...o,ldi:{attempts:l,visibilityStates:c}})))}function or(e){return Dn(e,()=>function(t){return new Promise((n,r)=>{if(function(a){if(URL.prototype)try{return new URL(a,location.href),!1}catch(c){if(c instanceof Error&&c.name==="TypeError")return!0;throw c}}(t))throw new Error(Ue);let o=document.createElement("script"),i=()=>{var a;return(a=o.parentNode)===null||a===void 0?void 0:a.removeChild(o)},s=document.head||document.getElementsByTagName("head")[0];o.onload=()=>{i(),n()},o.onerror=()=>{i(),r(new Error(ae))},o.async=!0,o.src=t,s.appendChild(o)})}(e),()=>{throw new Error(Fe)}).then(ir)}function ir(){let e=window,t="__fpjs_p_l_b",n=e[t];if(function(r,o){var i;let s=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,r,o);s?.configurable?delete r[o]:s&&!s.writable||(r[o]=void 0)}(e,t),typeof n?.load!="function")throw new Error(qe);return n}var j={load:rr,defaultScriptUrlPattern:nr,ERROR_SCRIPT_LOAD_FAIL:ae,ERROR_API_KEY_EXPIRED:It,ERROR_API_KEY_INVALID:Et,ERROR_API_KEY_MISSING:Be,ERROR_BAD_REQUEST_FORMAT:Qn,ERROR_BAD_RESPONSE_FORMAT:Nn,ERROR_CLIENT_TIMEOUT:Pn,ERROR_CSP_BLOCK:Fe,ERROR_FORBIDDEN_ENDPOINT:Bn,ERROR_FORBIDDEN_HEADER:Jn,ERROR_FORBIDDEN_ORIGIN:Yn,ERROR_GENERAL_SERVER_FAILURE:Wn,ERROR_HANDLE_AGENT_DATA:Mn,ERROR_INSTALLATION_METHOD_RESTRICTED:Un,ERROR_INTEGRATION_FAILURE:qn,ERROR_INVALID_ENDPOINT:Ue,ERROR_INVALID_PROXY_INTEGRATION_HEADERS:Vn,ERROR_INVALID_PROXY_INTEGRATION_SECRET:Gn,ERROR_NETWORK_ABORT:xn,ERROR_NETWORK_CONNECTION:kn,ERROR_NETWORK_RESTRICTED:Kn,ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH:jn,ERROR_RATE_LIMIT:zn,ERROR_SERVER_TIMEOUT:$n,ERROR_SUBSCRIPTION_NOT_ACTIVE:Cn,ERROR_TOKEN_EXPIRED:Hn,ERROR_TOKEN_INVALID:Zn,ERROR_TOKEN_MISSING:Xn,ERROR_UNSUPPORTED_VERSION:Fn,ERROR_WRONG_REGION:Ln,defaultEndpoint:Sn,defaultTlsEndpoint:_n};var O=[];for(let e=0;e<256;++e)O.push((e+256).toString(16).slice(1));function Rt(e,t=0){return(O[e[t+0]]+O[e[t+1]]+O[e[t+2]]+O[e[t+3]]+"-"+O[e[t+4]]+O[e[t+5]]+"-"+O[e[t+6]]+O[e[t+7]]+"-"+O[e[t+8]]+O[e[t+9]]+"-"+O[e[t+10]]+O[e[t+11]]+O[e[t+12]]+O[e[t+13]]+O[e[t+14]]+O[e[t+15]]).toLowerCase()}var Ke,sr=new Uint8Array(16);function Ge(){if(!Ke){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ke=crypto.getRandomValues.bind(crypto)}return Ke(sr)}var ar=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ve={randomUUID:ar};function cr(e,t,n){if(Ve.randomUUID&&!t&&!e)return Ve.randomUUID();e=e||{};let r=e.random??e.rng?.()??Ge();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return Rt(r)}var H=cr;var ur={UNAUTHORIZED:"Unauthorized"},lr={EXPIRED:"EXPIRED_TOKEN",INVALID_API_KEY:"INVALID_API_KEY",MISSING_AUTHENTICATION_TOKEN:"MISSING_AUTHENTICATION_TOKEN"},vt={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance",RATE_LIMIT_REACHED:"Too many requests. Rate limit exceeded"},bt={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},Tt={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},At={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},Ot={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},R={...ur,...lr,...vt,...bt,...Tt,...At,...Ot},Dt={...vt,...bt,...Tt,...At,...Ot};var Q=(g=>(g.AR="ar",g.BN="bn",g.DE="de",g.EN="en",g.ES="es",g.FR="fr",g.HI="hi",g.ID="id",g.IT="it",g.JA="ja",g.KO="ko",g.MS="ms",g.NL="nl",g.PT="pt",g.RU="ru",g.YU="yu",g.ZH="zh",g))(Q||{}),W=(w=>(w.GeneralConsumer="general-consumer",w.HRManagerDirector="hr-manager-director",w.WebDeveloper="web-developer",w.SoftwareEngineer="software-engineer",w.ITDirector="it-director",w.BusinessAdministrator="business-administrator",w.AccountsPayableManager="accounts-payable-manager",w.Accountant="accountant",w.FinanceDirector="finance-director",w.SmallBusinessOwner="small-business-owner",w.GeneralContractor="general-contractor",w.MarketingManagerDirector="marketing-manager-director",w.ConsumerShopper="consumer-shopper",w.Travel="travel",w.Entertainment="entertainment",w.FinanceAndBanking="finance-and-banking",w.General="general",w.B2BWhiteCollar="b2b-white-collar",w.B2BBlueCollar="b2b-blue-collar",w.Lawyer="lawyer",w))(W||{});var $={exclude:[],include:[],stabilize:["private","iframe"],logging:!0,timeout:5e3,cache_api_call:!0,performance:!1,experimental:!1},Uo={...$},je={private:[{exclude:["canvas"],browsers:["firefox","safari>=17","brave"]},{exclude:["audio"],browsers:["samsungbrowser","safari"]},{exclude:["fonts"],browsers:["firefox"]},{exclude:["audio.sampleHash","hardware.deviceMemory","header.acceptLanguage.q","system.hardwareConcurrency","plugins"],browsers:["brave"]},{exclude:["tls.extensions"],browsers:["firefox","chrome","safari"]},{exclude:["header.acceptLanguage"],browsers:["edge","chrome"]}],iframe:[{exclude:["system.applePayVersion","system.cookieEnabled"],browsers:["safari"]},{exclude:["permissions"]}],vpn:[{exclude:["ip"]}]};async function Qe(){return mr()}async function mr(){return new Promise((t,n)=>{try{let i=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,5e3,44100),s=i?.createBufferSource(),a=i.createOscillator();a.frequency.value=1e3;let c=i.createDynamicsCompressor();c.threshold.value=-50,c.knee.value=40,c.ratio.value=12,c.attack.value=0,c.release.value=.2,a.connect(c),c.connect(i.destination),a.start();let m;i.oncomplete=u=>{m=u.renderedBuffer.getChannelData(0),t({sampleHash:dr(m),maxChannels:i.destination.maxChannelCount,channelCountMode:s.channelCountMode})},i.startRendering()}catch(r){console.error("Error creating audio fingerprint:",r),n(r)}})}function dr(e){let t=0;for(let n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function ce(e,t,n){let r=[];for(let s=0;s<e[0].data.length;s++){let a=[];for(let c=0;c<e.length;c++)a.push(e[c].data[s]);r.push(fr(a))}let o=r,i=new Uint8ClampedArray(o);return new ImageData(i,t,n)}function fr(e){if(e.length===0)return 0;let t={};for(let r of e)t[r]=(t[r]||0)+1;let n=e[0];for(let r in t)t[r]>t[n]&&(n=parseInt(r,10));return n}function hr(e){return new TextEncoder().encode(e).buffer}function ue(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^=e>>>16,e>>>0}var S=new Uint32Array([597399067,2869860233,951274213,2716044179]);function L(e,t){return e<<t|e>>>32-t}function pr(e,t){let n=e.byteLength/16|0,r=new Uint32Array(e,0,n*4);for(let o=0;o<n;o++){let i=r.subarray(o*4,(o+1)*4);i[0]=Math.imul(i[0],S[0]),i[0]=L(i[0],15),i[0]=Math.imul(i[0],S[1]),t[0]=t[0]^i[0],t[0]=L(t[0],19),t[0]=t[0]+t[1],t[0]=Math.imul(t[0],5)+1444728091,i[1]=Math.imul(i[1],S[1]),i[1]=L(i[1],16),i[1]=Math.imul(i[1],S[2]),t[1]=t[1]^i[1],t[1]=L(t[1],17),t[1]=t[1]+t[2],t[1]=Math.imul(t[1],5)+197830471,i[2]=Math.imul(i[2],S[2]),i[2]=L(i[2],17),i[2]=Math.imul(i[2],S[3]),t[2]=t[2]^i[2],t[2]=L(t[2],15),t[2]=t[2]+t[3],t[2]=Math.imul(t[2],5)+2530024501,i[3]=Math.imul(i[3],S[3]),i[3]=L(i[3],18),i[3]=Math.imul(i[3],S[0]),t[3]=t[3]^i[3],t[3]=L(t[3],13),t[3]=t[3]+t[0],t[3]=Math.imul(t[3],5)+850148119}}function gr(e,t){let n=e.byteLength/16|0,r=e.byteLength%16,o=new Uint32Array(4),i=new Uint8Array(e,n*16,r);switch(r){case 15:o[3]=o[3]^i[14]<<16;case 14:o[3]=o[3]^i[13]<<8;case 13:o[3]=o[3]^i[12]<<0,o[3]=Math.imul(o[3],S[3]),o[3]=L(o[3],18),o[3]=Math.imul(o[3],S[0]),t[3]=t[3]^o[3];case 12:o[2]=o[2]^i[11]<<24;case 11:o[2]=o[2]^i[10]<<16;case 10:o[2]=o[2]^i[9]<<8;case 9:o[2]=o[2]^i[8]<<0,o[2]=Math.imul(o[2],S[2]),o[2]=L(o[2],17),o[2]=Math.imul(o[2],S[3]),t[2]=t[2]^o[2];case 8:o[1]=o[1]^i[7]<<24;case 7:o[1]=o[1]^i[6]<<16;case 6:o[1]=o[1]^i[5]<<8;case 5:o[1]=o[1]^i[4]<<0,o[1]=Math.imul(o[1],S[1]),o[1]=L(o[1],16),o[1]=Math.imul(o[1],S[2]),t[1]=t[1]^o[1];case 4:o[0]=o[0]^i[3]<<24;case 3:o[0]=o[0]^i[2]<<16;case 2:o[0]=o[0]^i[1]<<8;case 1:o[0]=o[0]^i[0]<<0,o[0]=Math.imul(o[0],S[0]),o[0]=L(o[0],15),o[0]=Math.imul(o[0],S[1]),t[0]=t[0]^o[0]}}function yr(e,t){t[0]=t[0]^e.byteLength,t[1]=t[1]^e.byteLength,t[2]=t[2]^e.byteLength,t[3]=t[3]^e.byteLength,t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0,t[0]=ue(t[0]),t[1]=ue(t[1]),t[2]=ue(t[2]),t[3]=ue(t[3]),t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0}function D(e,t=0){if(t=t?t|0:0,typeof e=="string"&&(e=hr(e)),!(e instanceof ArrayBuffer))throw new TypeError("Expected key to be ArrayBuffer or string");let n=new Uint32Array([t,t,t,t]);pr(e,n),gr(e,n),yr(e,n);let r=new Uint8Array(n.buffer);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}var Er=3,St=280,_t=20;async function We(){return Ir()}function Ir(){return new Promise(e=>{let t=Array.from({length:Er},()=>wr()),n=ce(t,St,_t);e({commonPixelsHash:D(n.data.toString()).toString()})})}function wr(){let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return new ImageData(1,1);e.width=St,e.height=_t;let n=t.createLinearGradient(0,0,e.width,e.height);n.addColorStop(0,"red"),n.addColorStop(1/6,"orange"),n.addColorStop(2/6,"yellow"),n.addColorStop(3/6,"green"),n.addColorStop(4/6,"blue"),n.addColorStop(5/6,"indigo"),n.addColorStop(1,"violet"),t.fillStyle=n,t.fillRect(0,0,e.width,e.height);let r="Random Text WMwmil10Oo";return t.font="23.123px Arial",t.fillStyle="black",t.fillText(r,-5,15),t.fillStyle="rgba(0, 0, 255, 0.5)",t.fillText(r,-3.3,17.7),t.beginPath(),t.moveTo(0,0),t.lineTo(e.width*2/7,e.height),t.strokeStyle="white",t.lineWidth=2,t.stroke(),t.getImageData(0,0,e.width,e.height)}async function le(e){for(;!document.body;)await Rr(50);let t=document.createElement("iframe");t.setAttribute("frameBorder","0");let n=t.style;n.setProperty("position","fixed"),n.setProperty("display","block","important"),n.setProperty("visibility","visible"),n.setProperty("border","0"),n.setProperty("opacity","0"),t.src="about:blank",document.body.appendChild(t);let r=t.contentDocument||t.contentWindow?.document;if(!r)throw new Error("Iframe document is not accessible");e({iframe:r}),setTimeout(()=>{document.body.removeChild(t)},0)}function Rr(e,t){return new Promise(n=>setTimeout(n,e,t))}var vr=["Arial","Arial Black","Arial Narrow","Arial Rounded MT","Arimo","Archivo","Barlow","Bebas Neue","Bitter","Bookman","Calibri","Cabin","Candara","Century","Century Gothic","Comic Sans MS","Constantia","Courier","Courier New","Crimson Text","DM Mono","DM Sans","DM Serif Display","DM Serif Text","Dosis","Droid Sans","Exo","Fira Code","Fira Sans","Franklin Gothic Medium","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Impact","Inconsolata","Indie Flower","Inter","Josefin Sans","Karla","Lato","Lexend","Lucida Bright","Lucida Console","Lucida Sans Unicode","Manrope","Merriweather","Merriweather Sans","Montserrat","Myriad","Noto Sans","Nunito","Nunito Sans","Open Sans","Optima","Orbitron","Oswald","Pacifico","Palatino","Perpetua","PT Sans","PT Serif","Poppins","Prompt","Public Sans","Quicksand","Rajdhani","Recursive","Roboto","Roboto Condensed","Rockwell","Rubik","Segoe Print","Segoe Script","Segoe UI","Sora","Source Sans Pro","Space Mono","Tahoma","Taviraj","Times","Times New Roman","Titillium Web","Trebuchet MS","Ubuntu","Varela Round","Verdana","Work Sans"],br=["monospace","sans-serif","serif"];async function $e(e){return Tr()}function Tr(){return new Promise((e,t)=>{try{le(async({iframe:n})=>{let o=n.createElement("canvas").getContext("2d"),i=br.map(a=>Pt(o,a)),s={};vr.forEach(a=>{let c=Pt(o,a);i.includes(c)||(s[a]=c)}),e(s)})}catch{t({error:"unsupported"})}})}function Pt(e,t){if(!e)return null;let n="WwMmLli0Oo";return e.font=`72px ${t}`,e.measureText(n).width}function ze(){return new Promise((e,t)=>{let n=navigator.deviceMemory!==void 0?navigator.deviceMemory:0,r=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:Ar(),architecture:Or(),deviceMemory:n.toString()||"undefined",jsHeapSizeLimit:r.jsHeapSizeLimit||0})})}function Ar(){let e=document.createElement("canvas"),t=e.getContext("webgl")??e.getContext("experimental-webgl");if(t&&"getParameter"in t)try{let n=(t.getParameter(t.VENDOR)||"").toString(),r=(t.getParameter(t.RENDERER)||"").toString(),o={vendor:n,renderer:r,version:(t.getParameter(t.VERSION)||"").toString(),shadingLanguageVersion:(t.getParameter(t.SHADING_LANGUAGE_VERSION)||"").toString()};if(!r.length||!n.length){let i=t.getExtension("WEBGL_debug_renderer_info");if(i){let s=(t.getParameter(i.UNMASKED_VENDOR_WEBGL)||"").toString(),a=(t.getParameter(i.UNMASKED_RENDERER_WEBGL)||"").toString();s&&(o.vendorUnmasked=s),a&&(o.rendererUnmasked=a)}}return o}catch{}return"undefined"}function Or(){let e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function Ye(){return new Promise(e=>{e({languages:Dr(),timezone:Sr()})})}function Dr(){let e=[];return navigator.language}function Sr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var me=(e,t,n,r)=>{let o=(n-t)/r,i=0;for(let s=0;s<r;s++){let a=t+(s+.5)*o;i+=e(a)}return i*o};function Je(){return new Promise(e=>{e({acos:Math.acos(.5),asin:me(Math.asin,-1,1,97),cos:me(Math.cos,0,Math.PI,97),largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),sin:me(Math.sin,-Math.PI,Math.PI,97),tan:me(Math.tan,0,2*Math.PI,97)})})}function _r(e){if(e.length===0)return null;let t={};e.forEach(o=>{let i=String(o);t[i]=(t[i]||0)+1});let n=e[0],r=1;return Object.keys(t).forEach(o=>{t[o]>r&&(n=o,r=t[o])}),n}function kt(e,t){let n={};return t.forEach(r=>{let o=e.map(s=>r in s?s[r]:void 0).filter(s=>s!==void 0),i=_r(o);i&&(n[r]=i)}),n}var Pr=["accelerometer","accessibility","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","device-info","display-capture","gyroscope","geolocation","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","speaker","storage-access","top-level-storage-access","window-management","query"];async function Xe(e){let t=e?.permissions_to_check||Pr,r=await Promise.all(Array.from({length:3},()=>kr(t)));return kt(r,t)}async function kr(e){let t={};for(let n of e)try{let r=await navigator.permissions.query({name:n});t[n]=r.state.toString()}catch{}return t}async function Ze(){let e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){let n=navigator.plugins[t];e.push([n.name,n.filename,n.description].join("|"))}return new Promise(t=>{t({plugins:e})})}function z(){if(typeof navigator>"u")return{name:"unknown",version:"unknown"};let e=navigator.userAgent,t=[/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>EdgA|EdgiOS|Edg)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>OPR|OPX)\/(?<version>\d+(?:\.\d+)+)/,/Opera[\s\/](?<version>\d+(?:\.\d+)+)/,/Opera Mini\/(?<version>\d+(?:\.\d+)+)/,/Opera Mobi\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Vivaldi)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Brave)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>CriOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>FxiOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Chrome|Chromium)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Firefox|Waterfox|Iceweasel|IceCat)\/(?<version>\d+(?:\.\d+)+)/,/Version\/(?<version1>[\d.]+).*Safari\/[\d.]+|(?<name>Safari)\/(?<version2>[\d.]+)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)+)/,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)+)/],n={edg:"Edge",edga:"Edge",edgios:"Edge",opr:"Opera",opx:"Opera",crios:"Chrome",fxios:"Firefox",samsung:"SamsungBrowser",vivaldi:"Vivaldi",brave:"Brave"};for(let r of t){let o=e.match(r);if(o){let i=o.groups?.name,s=o.groups?.version||o.groups?.version1||o.groups?.version2;if(!i&&(o.groups?.version1||o.groups?.version2)&&(i="Safari"),!i&&r.source.includes("Opera Mini")&&(i="Opera Mini"),!i&&r.source.includes("Opera Mobi")&&(i="Opera Mobi"),!i&&r.source.includes("Opera")&&(i="Opera"),!i&&o[1]&&(i=o[1]),!s&&o[2]&&(s=o[2]),i)return{name:n[i.toLowerCase()]||i,version:s||"unknown"}}}return{name:"unknown",version:"unknown"}}function de(){if(typeof navigator>"u"||!navigator.userAgent)return!1;let e=navigator.userAgent;return/Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e)&&!/iPad/i.test(e)}function He(){return new Promise(e=>{let t={is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:Nr()};de()&&navigator.maxTouchPoints>0&&(t.resolution=xr()),e(t)})}function xr(){let e=window.screen.width,t=window.screen.height,n=Math.max(e,t).toString(),r=Math.min(e,t).toString();return`${n}x${r}`}function Nr(){let e=[],t={"prefers-contrast":["high","more","low","less","forced","no-preference"],"any-hover":["hover","none"],"any-pointer":["none","coarse","fine"],pointer:["none","coarse","fine"],hover:["hover","none"],update:["fast","slow"],"inverted-colors":["inverted","none"],"prefers-reduced-motion":["reduce","no-preference"],"prefers-reduced-transparency":["reduce","no-preference"],scripting:["none","initial-only","enabled"],"forced-colors":["active","none"]};return Object.keys(t).forEach(n=>{t[n].forEach(r=>{matchMedia(`(${n}: ${r})`).matches&&e.push(`${n}: ${r}`)})}),e}function et(){return new Promise(e=>{let t=z(),n=navigator.userAgent,r={platform:window.navigator.platform,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:t.name,version:t.version},mobile:de(),applePayVersion:Mr(),cookieEnabled:window.navigator.cookieEnabled};e(r)})}function Mr(){if(window.location.protocol==="https:"&&typeof window.ApplePaySession=="function")try{let e=window.ApplePaySession.supportsVersion;for(let t=15;t>0;t--)if(e(t))return t}catch{return 0}return 0}var Lr=z().name!=="SamsungBrowser"?1:3,_,p=null;function Cr(){typeof document<"u"&&(_=document.createElement("canvas"),_.width=200,_.height=100,p=_.getContext("webgl"))}async function tt(){Cr();try{if(!p)throw new Error("WebGL not supported");let e=Array.from({length:Lr},()=>Fr()),t=ce(e,_.width,_.height);return{commonPixelsHash:D(t.data.toString()).toString()}}catch{return{webgl:"unsupported"}}}function Fr(){try{if(!p)throw new Error("WebGL not supported");let e=`
2
+ attribute vec2 position;
3
+ void main() {
4
+ gl_Position = vec4(position, 0.0, 1.0);
5
+ }
6
+ `,t=`
7
+ precision mediump float;
8
+ void main() {
9
+ gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
10
+ }
11
+ `,n=p.createShader(p.VERTEX_SHADER),r=p.createShader(p.FRAGMENT_SHADER);if(!n||!r)throw new Error("Failed to create shaders");if(p.shaderSource(n,e),p.shaderSource(r,t),p.compileShader(n),!p.getShaderParameter(n,p.COMPILE_STATUS))throw new Error("Vertex shader compilation failed: "+p.getShaderInfoLog(n));if(p.compileShader(r),!p.getShaderParameter(r,p.COMPILE_STATUS))throw new Error("Fragment shader compilation failed: "+p.getShaderInfoLog(r));let o=p.createProgram();if(!o)throw new Error("Failed to create shader program");if(p.attachShader(o,n),p.attachShader(o,r),p.linkProgram(o),!p.getProgramParameter(o,p.LINK_STATUS))throw new Error("Shader program linking failed: "+p.getProgramInfoLog(o));p.useProgram(o);let i=137,s=new Float32Array(i*4),a=2*Math.PI/i;for(let h=0;h<i;h++){let E=h*a;s[h*4]=0,s[h*4+1]=0,s[h*4+2]=Math.cos(E)*(_.width/2),s[h*4+3]=Math.sin(E)*(_.height/2)}let c=p.createBuffer();p.bindBuffer(p.ARRAY_BUFFER,c),p.bufferData(p.ARRAY_BUFFER,s,p.STATIC_DRAW);let m=p.getAttribLocation(o,"position");p.enableVertexAttribArray(m),p.vertexAttribPointer(m,2,p.FLOAT,!1,0,0),p.viewport(0,0,_.width,_.height),p.clearColor(0,0,0,1),p.clear(p.COLOR_BUFFER_BIT),p.drawArrays(p.LINES,0,i*2);let u=new Uint8ClampedArray(_.width*_.height*4);return p.readPixels(0,0,_.width,_.height,p.RGBA,p.UNSIGNED_BYTE,u),new ImageData(u,_.width,_.height)}catch{return new ImageData(1,1)}finally{p&&(p.bindBuffer(p.ARRAY_BUFFER,null),p.useProgram(null),p.viewport(0,0,p.drawingBufferWidth,p.drawingBufferHeight),p.clearColor(0,0,0,0))}}function N(e){let t=[];return function n(r){if(r&&r.toJSON&&typeof r.toJSON=="function"&&(r=r.toJSON()),r===void 0)return;if(typeof r=="number")return isFinite(r)?""+r:"null";if(typeof r!="object")return JSON.stringify(r);let o,i;if(Array.isArray(r)){for(i="[",o=0;o<r.length;o++)o&&(i+=","),i+=n(r[o])||"null";return i+"]"}if(r===null)return"null";if(t.indexOf(r)!==-1)throw new TypeError("Converting circular structure to JSON");let s=t.push(r)-1,a=Object.keys(r).sort();for(i="",o=0;o<a.length;o++){let c=a[o],m=n(r[c]);m&&(i&&(i+=","),i+=JSON.stringify(c)+":"+m)}return t.splice(s,1),"{"+i+"}"}(e)||""}async function nt(){return new Promise(e=>{try{let t=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection;if(!t){e({supported:!1,error:"WebRTC not supported"});return}let n={iceCandidatePoolSize:1,iceServers:[]},r=new t(n);r.createDataChannel(""),(async()=>{try{let i={offerToReceiveAudio:!0,offerToReceiveVideo:!0},s=await r.createOffer(i);await r.setLocalDescription(s);let a=s.sdp||"",c=[...new Set((a.match(/extmap:\d+ [^\n\r]+/g)||[]).map(f=>f.replace(/extmap:\d+ /,"")))].sort(),m=f=>{let I=a.match(new RegExp(`m=${f} [^\\s]+ [^\\s]+ ([^\\n\\r]+)`));return I?I[1].split(" "):[]},u=(f,I)=>I.map(g=>{let A=new RegExp(`(rtpmap|fmtp|rtcp-fb):${g} (.+)`,"g"),k=[...a.matchAll(A)];if(!k.length)return null;let w={};return k.forEach(xe=>{let[go,Ne,Me]=xe,Le=Me.split("/");Ne==="rtpmap"?(w.mimeType=`${f}/${Le[0]}`,w.clockRate=+Le[1],f==="audio"&&(w.channels=+Le[2]||1)):Ne==="rtcp-fb"?(w.feedbackSupport=w.feedbackSupport||[],w.feedbackSupport.push(Me)):Ne==="fmtp"&&(w.sdpFmtpLine=Me)}),w}).filter(Boolean),l=u("audio",m("audio")),h=u("video",m("video")),E={audio:{count:l.length,hash:D(N(l))},video:{count:h.length,hash:D(N(h))},extensionsHash:D(N(c))},y=await new Promise(f=>{let I=setTimeout(()=>{r.removeEventListener("icecandidate",g),r.close(),f({supported:!0,...E,timeout:!0})},3e3),g=A=>{let k=A.candidate;!k||!k.candidate||(clearTimeout(I),r.removeEventListener("icecandidate",g),r.close(),f({supported:!0,...E,candidateType:k.type||""}))};r.addEventListener("icecandidate",g)});e({details:y,hash:D(N(y))})}catch(i){r.close(),e({supported:!0,error:`WebRTC offer failed: ${i.message}`})}})()}catch(t){e({supported:!1,error:`WebRTC error: ${t.message}`})}})}var xt=["\u{1D504}","\u{1D505}","\u212D","\u{1D507}","\u{1D508}","\u{1D509}","\u{1D538}","\u{1D539}","\u2102","\u{1D53B}","\u{1D53C}","\u{1D53D}"],Nt=["\u03B2","\u03C8","\u03BB","\u03B5","\u03B6","\u03B1","\u03BE","\u03BC","\u03C1","\u03C6","\u03BA","\u03C4","\u03B7","\u03C3","\u03B9","\u03C9","\u03B3","\u03BD","\u03C7","\u03B4","\u03B8","\u03C0","\u03C5","\u03BF"];async function rt(){return new Promise(e=>{try{le(async({iframe:t})=>{try{if(!Ur(t)){e({supported:!1,error:"MathML not supported"});return}let n=[ee("integral","<msubsup><mo>\u222B</mo><mi>a</mi><mi>b</mi></msubsup><mfrac><mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow><mrow><mi>g</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mfrac><mi>dx</mi>"),ee("fraction","<mfrac><mrow><mi>\u03C0</mi><mo>\xD7</mo><msup><mi>r</mi><mn>2</mn></msup></mrow><mrow><mn>2</mn><mi>\u03C3</mi></mrow></mfrac>"),ee("matrix","<mo>[</mo><mtable><mtr><mtd><mi>\u03B1</mi></mtd><mtd><mi>\u03B2</mi></mtd></mtr><mtr><mtd><mi>\u03B3</mi></mtd><mtd><mi>\u03B4</mi></mtd></mtr></mtable><mo>]</mo>"),Br(),...qr()],r=[],o="";n.forEach((s,a)=>{let c=Kr(s,t);r.push({width:c.dimensions.width,height:c.dimensions.height}),a===0&&c.fontInfo&&(o=D(N(c.fontInfo)))});let i={fontStyleHash:o,dimensions:r};e({details:i,hash:D(N(i))})}catch(n){e({supported:!1,error:`MathML error: ${n.message}`})}})}catch(t){e({supported:!1,error:`MathML error: ${t.message}`})}})}function Ur(e){try{let t=e.createElement("math");t.innerHTML="<mrow><mi>x</mi></mrow>",t.style.position="absolute",t.style.visibility="hidden",e.body.appendChild(t);let n=t.getBoundingClientRect();return e.body.removeChild(t),n.width>0&&n.height>0}catch{return!1}}function ee(e,t){return`<math><mrow>${t}</mrow></math>`}function Br(){let e="<mo>\u220F</mo>";return xt.forEach((t,n)=>{let r=n*2,o=Nt.slice(r,r+2);o.length===2&&(e+=`<mmultiscripts><mi>${t}</mi><none/><mi>${o[1]}</mi><mprescripts></mprescripts><mi>${o[0]}</mi><none/></mmultiscripts>`)}),ee("complex_nested",`<munderover><mmultiscripts>${e}</mmultiscripts></munderover>`)}function qr(){let e=[];return xt.forEach((t,n)=>{let r=n*2,o=Nt.slice(r,r+2);o.length===2&&e.push(ee("combined",`<mmultiscripts><mi>${t}</mi><none/><mi>${o[1]}</mi><mprescripts></mprescripts><mi>${o[0]}</mi><none/></mmultiscripts>`))}),e}function Kr(e,t){try{let n=t.createElement("math");n.innerHTML=e.replace(/<\/?math>/g,""),n.style.whiteSpace="nowrap",n.style.position="absolute",n.style.visibility="hidden",n.style.top="-9999px",t.body.appendChild(n);let r=n.getBoundingClientRect(),i=(t.defaultView||window).getComputedStyle(n),s={dimensions:{width:r.width,height:r.height},fontInfo:{fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontStyle:i.fontStyle,lineHeight:i.lineHeight,fontVariant:i.fontVariant||"normal",fontStretch:i.fontStretch||"normal",fontSizeAdjust:i.fontSizeAdjust||"none",textRendering:i.textRendering||"auto",fontFeatureSettings:i.fontFeatureSettings||"normal",fontVariantNumeric:i.fontVariantNumeric||"normal",fontKerning:i.fontKerning||"auto"}};return t.body.removeChild(n),s}catch(n){return{error:n.message}}}var Gr=800;async function ot(){return new Promise(e=>{try{if(typeof window>"u"||!window.speechSynthesis||typeof window.speechSynthesis.getVoices!="function"){e({supported:!1,error:"Speech Synthesis API not supported"});return}let t=!1,n=null,r=s=>{if(!t){t=!0,n&&clearTimeout(n);try{let a=s.map(m=>{let u=h=>h.replace(/\\/g,"\\\\").replace(/,/g,"\\,");return[u(m.voiceURI||""),u(m.name||""),u(m.lang||""),m.localService?"1":"0",m.default?"1":"0"].join(",")});a.sort();let c={voiceCount:s.length,voicesHash:D(N(a))};e({details:c,hash:D(N(c))})}catch(a){e({supported:!0,error:`Voice processing failed: ${a.message}`})}}},o=window.speechSynthesis.getVoices();if(o.length>0){r(o);return}n=setTimeout(()=>{let s=window.speechSynthesis.getVoices();r(s)},Gr);let i=()=>{window.speechSynthesis.removeEventListener("voiceschanged",i);let s=window.speechSynthesis.getVoices();r(s)};window.speechSynthesis.addEventListener("voiceschanged",i)}catch(t){e({supported:!1,error:`Speech Synthesis error: ${t.message}`})}})}var Mt={audio:Qe,canvas:We,fonts:$e,hardware:ze,locales:Ye,math:Je,permissions:Xe,plugins:Ze,screen:He,system:et,webgl:tt},Lt={webrtc:nt,mathml:rt,speech:ot},it={},Ct={timeout:"true"},st=(e,t,n)=>{it[e]=t};function Vr(e,t){return new Promise(n=>{setTimeout(()=>n(t),e)})}function Ft(e,t,n){return Promise.all(e.map(r=>{let o=performance.now();return Promise.race([r.then(i=>({value:i,elapsed:performance.now()-o})),Vr(t,n).then(i=>({value:i,elapsed:performance.now()-o}))])}))}function fe(e,t){let n=z();if(n.name==="unknown"&&e.system&&typeof e.system=="object"&&!Array.isArray(e.system)){let l=e.system.browser;if(l&&typeof l=="object"&&!Array.isArray(l)){let h=l;n={name:h.name||"unknown",version:h.version||"unknown"}}}let r=n.name.toLowerCase(),o=n.version.split(".")[0]||"0",i=parseInt(o,10),s=[...t?.exclude||[]],a=t?.stabilize||[],c=t?.include||[];for(let u of a){let l=je[u];if(l)for(let h of l){let E=!("browsers"in h),y=!E&&h.browsers?.some(f=>{let I=f.match(/(.+?)(>=)(\d+)/);if(I){let[,g,,A]=I,k=parseInt(A,10);return r===g&&i>=k}return r===f});(E||y)&&s.push(...h.exclude)}}function m(u,l=""){let h={};for(let[E,y]of Object.entries(u)){let f=l?`${l}.${E}`:E;if(typeof y=="object"&&!Array.isArray(y)&&y!==null){let I=m(y,f);Object.keys(I).length>0&&(h[E]=I)}else{let I=s.some(A=>f.startsWith(A)),g=c.some(A=>f.startsWith(A));(!I||g)&&(h[E]=y)}}return h}return m(e)}async function at(e){let t={...$,...e},n=t.logging&&!sessionStorage.getItem("_tmjs_l")&&Math.random()<1e-4,r={...Mt,...it},{elapsed:o,resolvedComponents:i}=await Ut(r,t),s={},a={};if(n||t.experimental){let{elapsed:I,resolvedComponents:g}=await Ut(Lt,t);s=g,a=I}let c={...o,...a},m=t.performance?{elapsed:c}:{},u=fe({},t),l={...i,...u},h={};return{thumbmark:D(N(l)),components:l,info:h,version:"",...m,...Object.keys(s).length>0&&t.experimental&&{experimental:s}}}async function Ut(e,t){let n={...$,...t},r=Object.entries(e).filter(([u])=>!n?.exclude?.includes(u)).filter(([u])=>n?.include?.some(l=>l.includes("."))?n?.include?.some(l=>l.startsWith(u)):n?.include?.length===0||n?.include?.includes(u)),o=r.map(([u])=>u),i=r.map(([u,l])=>l(t)),s=await Ft(i,n?.timeout||5e3,Ct),a={},c={};s.forEach((u,l)=>{u.value!=null&&(c[o[l]]=u.value,a[o[l]]=u.elapsed??0)});let m=fe(c,n);return{elapsed:a,resolvedComponents:m}}var te=class{options;constructor(t){this.options={...$,...t}}async get(t){let n={...this.options,...t};return at(n)}getVersion(){return""}includeComponent(t,n){st(t,n)}};var jr=(e,t={})=>({"Content-Type":"application/json",...e?.accessToken&&{Authorization:`Bearer ${e?.accessToken}`},...t}),Qr=async(e,t)=>{if(!e.ok){let n=await e.text();throw new Error(n)}return t==="file"?e.blob():t==="json"?e.json():t==="text"?e.text():null},Bt=async({url:e,auth:t,body:n,method:r="GET",headers:o={},responseType:i="json"})=>{let s={method:r,headers:jr(t,o),...n?{body:n instanceof FormData?n:JSON.stringify(n)}:{}},a=await fetch(e,s);return Qr(a,i)},ct=e=>Bt({...e,method:"GET"}),he=e=>Bt({...e,method:"POST"});function qt(e){let t=e?.qbc||!1,n=e?.mas||!1,r=e?.apd||!1,o=e?.scb||null,i=0,s=()=>{t=!1,n=!1,r=!1,o=void 0,i=0},a=()=>{let l=window?.getSelection()?.toString();l&&l.length>0&&(i=Date.now(),t=!0)},c=u=>{let l=u.clipboardData?.getData("text"),h=u.target instanceof HTMLInputElement||u.target instanceof HTMLTextAreaElement;l&&h&&(r=!0)},m=()=>{n=!0;let u=Date.now();if(i){let l=(u-i)/1e3;(o===void 0||l<o)&&(o=l)}};return document?.addEventListener("copy",a),document?.addEventListener("paste",c),window?.addEventListener("blur",m),{get qbc(){return t},get mas(){return n},get apd(){return r},get scb(){return o},reset:s,destroy(){document?.removeEventListener("copy",a),document?.removeEventListener("paste",c),window?.removeEventListener("blur",m)}}}var q=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var K=typeof window>"u"||"Deno"in globalThis;function M(){}function Vt(e,t){return typeof e=="function"?e(t):e}function jt(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function lt(e,t){return typeof e=="function"?e(t):e}function Wt(e,t){return typeof e=="function"?e(t):e}function mt(e,t){let{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ne(s,t.options))return!1}else if(!J(t.queryKey,s))return!1}if(n!=="all"){let c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function dt(e,t){let{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Y(t.options.mutationKey)!==Y(i))return!1}else if(!J(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ne(e,t){return(t?.queryKeyHashFn||Y)(e)}function Y(e){return JSON.stringify(e,(t,n)=>ut(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function J(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!J(e[n],t[n])):!1}function $t(e,t){if(e===t)return e;let n=Kt(e)&&Kt(t);if(n||ut(e)&&ut(t)){let r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},c=0;for(let m=0;m<s;m++){let u=n?m:i[m];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,c++):(a[u]=$t(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Kt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ut(e){if(!Gt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Gt(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Gt(e){return Object.prototype.toString.call(e)==="[object Object]"}function zt(e){return new Promise(t=>{setTimeout(t,e)})}function Yt(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?$t(e,t):t}function Jt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Xt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var re=Symbol();function pe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===re?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Wr=class extends q{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!K&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ge=new Wr;var $r=class extends q{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!K&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},X=new $r;function Zt(){let e,t,n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function zr(e){return Math.min(1e3*2**e,3e4)}function ft(e){return(e??"online")==="online"?X.isOnline():!0}var Ht=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ye(e){return e instanceof Ht}function Ee(e){let t=!1,n=0,r=!1,o,i=Zt(),s=f=>{r||(h(new Ht(f)),e.abort?.())},a=()=>{t=!0},c=()=>{t=!1},m=()=>ge.isFocused()&&(e.networkMode==="always"||X.isOnline())&&e.canRun(),u=()=>ft(e.networkMode)&&e.canRun(),l=f=>{r||(r=!0,e.onSuccess?.(f),o?.(),i.resolve(f))},h=f=>{r||(r=!0,e.onError?.(f),o?.(),i.reject(f))},E=()=>new Promise(f=>{o=I=>{(r||m())&&f(I)},e.onPause?.()}).then(()=>{o=void 0,r||e.onContinue?.()}),y=()=>{if(r)return;let f,I=n===0?e.initialPromise:void 0;try{f=I??e.fn()}catch(g){f=Promise.reject(g)}Promise.resolve(f).then(l).catch(g=>{if(r)return;let A=e.retry??(K?0:3),k=e.retryDelay??zr,w=typeof k=="function"?k(n,g):k,xe=A===!0||typeof A=="number"&&n<A||typeof A=="function"&&A(n,g);if(t||!xe){h(g);return}n++,e.onFail?.(n,g),zt(w).then(()=>m()?void 0:E()).then(()=>{t?h(g):y()})})};return{promise:i,cancel:s,continue:()=>(o?.(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?y():E().then(y),i)}}function Yr(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0),i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{let a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var b=Yr();var Ie=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),jt(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(K?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}};var en=class extends Ie{#e;#t;#n;#r;#s;#i;constructor(e){super(),this.#i=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Xr(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){let n=Yt(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(M).catch(M):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Wt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===re||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!Qt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#i?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){let a=this.observers.find(c=>c.options.queryFn);a&&this.setOptions(a.options)}let n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},o=()=>{let a=pe(this.options,t),c={queryKey:this.queryKey,meta:this.meta};return r(c),this.#i=!1,this.options.persister?this.options.persister(a,c,this):a(c)},i={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};r(i),this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#o({type:"fetch",meta:i.fetchOptions?.meta});let s=a=>{ye(a)&&a.silent||this.#o({type:"error",error:a}),ye(a)||(this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this)),this.scheduleGc()};return this.#r=Ee({initialPromise:t?.initialPromise,fn:i.fetchFn,abort:n.abort.bind(n),onSuccess:a=>{if(a===void 0){s(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(a)}catch(c){s(c);return}this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),this.scheduleGc()},onError:s,onFail:(a,c)=>{this.#o({type:"failed",failureCount:a,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}),this.#r.start()}#o(e){let t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Jr(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let r=e.error;return ye(r)&&r.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),b.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Jr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ft(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Xr(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var oe=class extends q{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,o=t.queryHash??ne(r,t),i=this.get(o);return i||(i=new en({cache:this,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){b.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(n=>mt(t,n))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(n=>mt(e,n)):t}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){b.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){b.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};var tn=class extends Ie{#e;#t;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#t=e.mutationCache,this.#e=[],this.state=e.state||Zr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(r,o)=>{this.#r({type:"failed",failureCount:r,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});let t=this.state.status==="pending",n=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:n}),await this.#t.config.onMutate?.(e,this);let o=await this.options.onMutate?.(e);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:n})}let r=await this.#n.start();return await this.#t.config.onSuccess?.(r,e,this.state.context,this),await this.options.onSuccess?.(r,e,this.state.context),await this.#t.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,e,this.state.context),this.#r({type:"success",data:r}),r}catch(r){try{throw await this.#t.config.onError?.(r,e,this.state.context,this),await this.options.onError?.(r,e,this.state.context),await this.#t.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,r,e,this.state.context),r}finally{this.#r({type:"error",error:r})}}finally{this.#t.runNext(this)}}#r(e){let t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),b.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(e)}),this.#t.notify({mutation:this,type:"updated",action:e})})}};function Zr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ie=class extends q{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new tn({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=we(e);if(typeof t=="string"){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){let t=we(e);if(typeof t=="string"){let n=this.#t.get(t);if(n)if(n.length>1){let r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=we(e);if(typeof t=="string"){let r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){let t=we(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){b.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(n=>dt(t,n))}findAll(e={}){return this.getAll().filter(t=>dt(e,t))}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(t=>t.state.isPaused);return b.batch(()=>Promise.all(e.map(t=>t.continue().catch(M))))}};function we(e){return e.options.scope?.id}function ht(e){return{onFetch:(t,n)=>{let r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},c=0,m=async()=>{let u=!1,l=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=pe(t.options,t.fetchOptions),E=async(y,f,I)=>{if(u)return Promise.reject();if(f==null&&y.pages.length)return Promise.resolve(y);let g={queryKey:t.queryKey,pageParam:f,direction:I?"backward":"forward",meta:t.options.meta};l(g);let A=await h(g),{maxPages:k}=t.options,w=I?Xt:Jt;return{pages:w(y.pages,A,k),pageParams:w(y.pageParams,f,k)}};if(o&&i.length){let y=o==="backward",f=y?Hr:nn,I={pages:i,pageParams:s},g=f(r,I);a=await E(I,g,y)}else{let y=e??i.length;do{let f=c===0?s[0]??r.initialPageParam:nn(r,a);if(c>0&&f==null)break;a=await E(a,f),c++}while(c<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=m}}}function nn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Hr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var pt=class{#e;#t;#n;#r;#s;#i;#o;#a;constructor(e={}){this.#e=e.queryCache||new oe,this.#t=e.mutationCache||new ie,this.#n=e.defaultOptions||{},this.#r=new Map,this.#s=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=X.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(lt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{let r=n.data;return[t,r]})}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,s=Vt(t,i);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return b.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;b.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){let n=this.#e,r={type:"active",...e};return b.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=b.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(M).catch(M)}invalidateQueries(e,t={}){return b.batch(()=>{if(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none")return Promise.resolve();let n={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=b.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(M)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(M)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(lt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(M).catch(M)}fetchInfiniteQuery(e){return e.behavior=ht(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(M).catch(M)}ensureInfiniteQueryData(e){return e.behavior=ht(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return X.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Y(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(r=>{J(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(Y(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#s.values()],n={};return t.forEach(r=>{J(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ne(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===re&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var eo=new pt({defaultOptions:{queries:{staleTime:3e4}},queryCache:new oe({onError:(e,t)=>{}}),mutationCache:new ie}),rn=eo;var to=[{name:"lowCpuCores",weight:1,async check(){let e=navigator.hardwareConcurrency||0,t=e>0&&e<=2;return{value:e,triggered:t}}},{name:"lowDeviceMemory",weight:1,async check(){let e=navigator.deviceMemory||0,t=e>0&&e<=4;return{value:e,triggered:t}}},{name:"platformMismatch",weight:1,async check(){let e=navigator.userAgent||"",t=navigator.platform||"",n=e.includes("Mac")&&t.includes("Linux")||e.includes("Win")&&t.includes("Mac")||t===""||t==="Unknown";return{value:t,triggered:n}}},{name:"webglSoftwareRenderer",weight:2,async check(){let e=null,t=null,n=!1;try{let r=document.createElement("canvas"),o=r.getContext("webgl")||r.getContext("experimental-webgl");if(o){let i=o.getExtension("WEBGL_debug_renderer_info");if(i){e=o.getParameter(i.UNMASKED_VENDOR_WEBGL)||"",t=o.getParameter(i.UNMASKED_RENDERER_WEBGL)||"";let s=t.toLowerCase(),a=e.toLowerCase();n=s.includes("swiftshader")||s.includes("llvmpipe")||s.includes("softwar")||s.includes("basic render")||s.includes("vmware")||s.includes("virtualbox")||a.includes("vmware")||a.includes("parallels")}}}catch{}return{value:{vendor:e,renderer:t},triggered:n}}},{name:"missingWebGPUAdapter",weight:2,async check(){if(!("gpu"in navigator))return{value:"no WebGPU",triggered:!0};try{let e=await navigator.gpu.requestAdapter();return{value:e?"adapter-present":"adapter-null",triggered:!e}}catch{return{value:"adapter-error",triggered:!0}}}},{name:"reducedTimerPrecision",weight:1,async check(){let e=performance.now();await new Promise(r=>setTimeout(r,50));let t=performance.now()-e,n=t<30||t>80;return{value:t.toFixed(2),triggered:n}}},{name:"timerJitter",weight:1,async check(){let e=[];for(let r=0;r<10;r++){let o=performance.now();await new Promise(s=>setTimeout(s,10));let i=performance.now();e.push(i-o)}let t=Math.sqrt(e.map(r=>(r-10)**2).reduce((r,o)=>r+o)/e.length),n=t>5;return{value:t.toFixed(3),triggered:n}}},{name:"audioFingerprint",weight:1,async check(){try{let e=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,44100,44100),t=e.createOscillator();t.frequency.value=440,t.connect(e.destination),t.start(0);let r=(await e.startRendering()).getChannelData(0).reduce((i,s)=>i+Math.abs(s),0),o=r<100;return{value:r,triggered:o}}catch{return{value:"audio-error",triggered:!0}}}},{name:"canvasEntropy",weight:1,async check(){try{let e=document.createElement("canvas"),t=e.getContext("2d");t.textBaseline="top",t.font="14px 'Arial'",t.fillText("VM CHECK",2,2);let r=[...e.toDataURL()].reduce((i,s)=>(i+s.charCodeAt(0))%9999999,0);return{value:r,triggered:r===0||r===999999}}catch{return{value:"canvas-error",triggered:!0}}}},{name:"windowSizeWeird",weight:1,async check(){let e=window.innerWidth/window.innerHeight,t=e===1.333||e===1.6;return{value:e.toFixed(2),triggered:t}}},{name:"touchMismatch",weight:1,async check(){let e="ontouchstart"in window,t=navigator.maxTouchPoints||0;return{value:{hasTouch:e,maxTouch:t},triggered:e&&t===0}}},{name:"batteryVirtualized",weight:1,async check(){if(!navigator.getBattery)return{value:"no API",triggered:!0};try{let e=await navigator.getBattery(),t=e.chargingTime===0&&e.dischargingTime===1/0;return{value:{chargingTime:e.chargingTime,dischargingTime:e.dischargingTime},triggered:t}}catch{return{value:"battery-error",triggered:!0}}}},{name:"permissionsWeird",weight:1,async check(){try{let e=await navigator.permissions.query({name:"camera"}),t=e.state==="prompt";return{value:e.state,triggered:t}}catch{return{value:"perm-error",triggered:!0}}}},{name:"noMediaDevices",weight:1,async check(){try{let e=await navigator.mediaDevices.enumerateDevices(),t=e.length===0;return{value:e.length,triggered:t}}catch{return{value:"media-error",triggered:!0}}}},{name:"virtualizedMediaDevices",weight:1,async check(){try{let e=await navigator.mediaDevices.enumerateDevices(),t=e.some(n=>n.label.toLowerCase().includes("virtual"));return{value:e.map(n=>n.label),triggered:t}}catch{return{value:"media-error",triggered:!0}}}},{name:"webrtcIpPattern",weight:2,async check(){return new Promise(e=>{let t=new RTCPeerConnection({iceServers:[]});t.createDataChannel("x"),t.onicecandidate=n=>{if(!n||!n.candidate){e({value:"no candidate",triggered:!0});return}let r=n.candidate.candidate.toLowerCase(),o=r.includes("10.0.2.")||r.includes("172.16.")||r.includes("192.168.56.");e({value:r,triggered:o})},t.createOffer().then(n=>t.setLocalDescription(n))})}},{name:"gpuAccelerationDisabled",weight:2,async check(){let t=document.createElement("canvas").getContext("webgl");return{value:!!t,triggered:!t}}},{name:"noWebGL2",weight:1,async check(){let e=document.createElement("canvas").getContext("webgl2");return{value:!!e,triggered:!e}}},{name:"lowStorageQuota",weight:1,async check(){try{let e=await navigator.storage.estimate(),t=e.quota<500*1024*1024;return{value:e.quota,triggered:t}}catch{return{value:"storage-error",triggered:!0}}}},{name:"lowEntropy",weight:1,async check(){let e=Object.keys(navigator).length+Object.keys(screen).length+Object.keys(window).length,t=e<200;return{value:e,triggered:t}}},{name:"noLanguages",weight:1,async check(){let e=navigator.languages||[];return{value:e,triggered:e.length===0}}},{name:"uaEntropyLow",weight:1,async check(){let e=navigator.userAgent,t=e.length<30;return{value:e,triggered:t}}},{name:"weirdDPI",weight:1,async check(){let e=window.devicePixelRatio;return{value:e,triggered:e===1}}}];async function on({threshold:e=6}={}){let t={},n=0;for(let r of to){let o=await r.check();t[r.name]=o,o.triggered&&(n+=r.weight)}return{isLikelyVM:n>=e,score:n,threshold:e,signals:t}}var no=[{name:"hookedFunctionToString",weight:2,async check(){let e=Function.prototype.toString.toString(),t=Function.prototype.toString+"";return{value:{native:e,current:t},triggered:e!==t}}},{name:"navigatorProxyTrap",weight:2,async check(){let e=!1;try{let t=Object.getOwnPropertyDescriptor(window,"navigator");t&&t.get&&t.get.toString()?.includes("[native code]")===!1&&(e=!0)}catch{}return{value:"navigator getter",triggered:e}}},{name:"uaMismatch",weight:2,async check(){let e=navigator.userAgent||"",t="";try{let r=await navigator.userAgentData?.getHighEntropyValues?.(["platform","brands"]);t=JSON.stringify(r)}catch{}let n=e?.includes("Mac")&&t?.includes("Windows")||e?.includes("Win")&&t?.includes("Mac")||t&&t.length>0&&!e;return{value:{ua:e,brandInfo:t},triggered:n}}},{name:"timezoneLocaleMismatch",weight:1,async check(){let e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=navigator.language||"",n=t.startsWith("en")&&e==="Asia/Shanghai"||t.startsWith("zh")&&e==="America/New_York"||e===void 0;return{value:{tz:e,lang:t},triggered:n}}},{name:"canvasNoise",weight:2,async check(){let e=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return i.textBaseline="top",i.font="14px Arial",i.fillText("anti-detect-check",2,2),o.toDataURL()},t=e(),n=e();return{value:{a:t,b:n},triggered:t!==n}}},{name:"webglNoise",weight:2,async check(){try{let t=document.createElement("canvas").getContext("webgl");if(!t)return{value:"no-webgl",triggered:!0};let n=t.getExtension("WEBGL_debug_renderer_info");if(!n)return{value:"no-debug-extension",triggered:!1};let r=t.getParameter(n.UNMASKED_VENDOR_WEBGL),o=t.getParameter(n.UNMASKED_RENDERER_WEBGL),i=r===""||o===""||r?.includes(" ")===!1||o?.includes(" ")===!1;return{value:{v:r,r:o},triggered:i}}catch{return{value:"gl-error",triggered:!0}}}},{name:"webdriverFlag",weight:3,async check(){let e=navigator.webdriver===!0;return{value:navigator.webdriver,triggered:e}}},{name:"perfectEventTiming",weight:1,async check(){let e=performance.now();return{value:e,triggered:e%1===0}}},{name:"serviceWorkerBlocked",weight:1,async check(){let e=!("serviceWorker"in navigator);return{value:e,triggered:e}}},{name:"smallQuota",weight:2,async check(){try{let e=await navigator.storage.estimate(),t=e.quota<50*1024*1024;return{value:e.quota,triggered:t}}catch{return{value:"quota-error",triggered:!0}}}},{name:"indexedDbBlocked",weight:2,async check(){try{let e=indexedDB.open("tamper-check");return await new Promise(t=>{e.onerror=()=>t({value:"error",triggered:!0}),e.onsuccess=()=>t({value:"ok",triggered:!1})})}catch{return{value:"throw",triggered:!0}}}},{name:"screenDprMismatch",weight:1,async check(){let e=window.screen.width,t=window.screen.height,n=window.devicePixelRatio,r=e===1920&&n===1&&t===1080||n%1!==0&&n%1!==.5;return{value:{w:e,h:t,dpr:n},triggered:r}}},{name:"missingCommonFonts",weight:1,async check(){return{value:"skipped",triggered:!1}}},{name:"noMediaDevices",weight:1,async check(){try{let e=await navigator.mediaDevices.enumerateDevices();return{value:e.length,triggered:e.length===0}}catch{return{value:"error",triggered:!0}}}},{name:"languagesEmpty",weight:1,async check(){let e=navigator.languages||[];return{value:e,triggered:e.length===0}}},{name:"pluginMismatch",weight:1,async check(){try{let e=navigator.plugins.length;return{value:e,triggered:e===0}}catch{return{value:"error",triggered:!0}}}},{name:"devtoolsDetected",weight:2,async check(){return new Promise(async e=>{let t={viewportBreakpoint:!1,debuggerLatency:!1,consoleSpeed:!1},n=160,r=window.outerWidth-window.innerWidth,o=window.outerHeight-window.innerHeight;(r>n||o>n)&&(t.viewportBreakpoint=!0);function i(c=200){let m=performance.now();debugger;return performance.now()-m>c}t.debuggerLatency=i();async function s(c=50){return new Promise(m=>{let u=performance.now();console.log("%c ","font-size:3000px");let l=performance.now();m(l-u>c)})}t.consoleSpeed=await s();let a=Object.values(t).some(Boolean);setTimeout(()=>{e({value:a,triggered:a})},50)})}},{name:"knownAntiDetectBrowser",weight:5,async check(){let e=navigator.userAgent.toLowerCase(),n=["incogniton","multilogin","morelogin","adspect","kameleo","goLogin"].some(r=>e?.includes(r));return{value:e,triggered:n}}}];async function sn({threshold:e=5}={}){let t={},n=0;for(let o of no){let i=await o.check();t[o.name]=i,i.triggered&&(n+=o.weight)}let r=Math.min(1,n/15);return{result:r>=.5||t.knownAntiDetectBrowser?.triggered,anomalyScore:r,antiDetectBrowser:t.knownAntiDetectBrowser?.triggered||!1,signals:t}}function ro(){let e=0;try{0 .toFixed(-1)}catch(t){e=t.message.length}return e}function oo(){let e=navigator.userAgent,t=ro();return t===44||t===43?"Safari":t===51?"Chrome":t===25?"Firefox":navigator.msSaveBlob!==void 0?"MSIE":e.match(/Chrome/)?navigator.brave!==void 0?"Brave":e.includes("Edg")?"Edge":e.includes("OPR")?"Opera":"Chrome":"Unknown"}var io=[{name:"safari_currentStorageTest",weight:2,browser:"Safari",async check(){if(typeof navigator.storage?.getDirectory!="function")return{triggered:!1,value:"unsupported"};try{return await navigator.storage.getDirectory(),{triggered:!1,value:"ok"}}catch(e){let t=e?.message??String(e);return{triggered:t.includes("unknown transient reason"),value:t}}}},{name:"safari13to18_indexedDbBlobTest",weight:2,browser:"Safari",async check(){return await new Promise(e=>{let t=String(Math.random()),n=indexedDB.open(t,1);n.onupgradeneeded=r=>{let o=r.target.result;try{o.createObjectStore("t",{autoIncrement:!0}).put(new Blob),e({triggered:!1,value:"ok"})}catch(i){let s=i?.message??String(i);e({triggered:s.includes("are not yet supported"),value:s})}finally{o.close(),indexedDB.deleteDatabase(t)}},n.onerror=()=>e({triggered:!1,value:"idb-error"})})}},{name:"safari_oldWebkitTest",weight:1,browser:"Safari",async check(){let e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null)}catch{return{triggered:!0,value:"openDatabase denied"}}try{t.setItem("test","1"),t.removeItem("test")}catch{return{triggered:!0,value:"localStorage denied"}}return{triggered:!1,value:"ok"}}},{name:"chrome_storageQuotaPrivateTest",weight:2,browser:"Chrome",async check(){return await new Promise((e,t)=>{let r=window?.performance?.memory?.jsHeapSizeLimit??1073741824;navigator.webkitTemporaryStorage.queryUsageAndQuota((o,i)=>{let s=Math.round(i/1048576),a=Math.round(r/(1024*1024))*2;e({triggered:s<a,value:{quotaMB:s,limitMB:a}})},o=>t(o))})}},{name:"chrome_oldFileSystemTest",weight:1,browser:"Chrome",async check(){let e=window.webkitRequestFileSystem;return e?await new Promise(t=>e(0,1,()=>t({triggered:!1,value:"ok"}),()=>t({triggered:!0,value:"denied"}))):{triggered:!1,value:"unsupported"}}},{name:"firefox_storageDirectoryTest",weight:2,browser:"Firefox",async check(){if(typeof navigator.storage?.getDirectory!="function")return{triggered:!1,value:"unsupported"};try{return await navigator.storage.getDirectory(),{triggered:!1,value:"ok"}}catch(e){let t=e?.message??String(e);return{triggered:t.includes("Security error"),value:t}}}},{name:"firefox_indexedDbInvalidStateTest",weight:1,browser:"Firefox",async check(){return await new Promise(e=>{let t=indexedDB.open("inPrivate");t.onerror=()=>{e({triggered:t.error?.name==="InvalidStateError",value:t.error?.name})},t.onsuccess=()=>{indexedDB.deleteDatabase("inPrivate"),e({triggered:!1,value:"ok"})}})}},{name:"msie_indexedDbMissing",weight:2,browser:"MSIE",async check(){return{triggered:window.indexedDB===void 0,value:"msie-idb-check"}}}];async function an(){let e=oo(),t={},n=0;for(let r of io){if(r.browser!==e)continue;let o=await r.check();t[r.name]=o,o.triggered&&(n+=r.weight)}return{isPrivate:n>0,browserName:e,score:n,signals:t}}typeof window<"u"&&(window.detectIncognito=an);var cn=an;var un="dtect_security_sdk_state",ln=typeof window<"u",mn={isLoading:!1,token:"",visitorId:"",projectId:"",questionData:null,clientData:null,aiCheckData:null,tokens:null},Re={state:{...mn},securityKeys:{behaviorKey:"",automationKey:"",dtectSignalEnabled:!1,dtectAutomationSignalEnabled:!1}};function dn(){if(!ln)return Re;try{let e=sessionStorage.getItem(un);if(!e)return Re;let t=JSON.parse(e);return t.expiresAt&&t.expiresAt<Date.now()?Re:{state:{...mn,...t.state},securityKeys:t.securityKeys||{behaviorKey:"",automationKey:"",dtectSignalEnabled:!1,dtectAutomationSignalEnabled:!1}}}catch{return Re}}function G(e){if(ln)try{let t=Date.now()+864e5,n={...e,expiresAt:t};sessionStorage.setItem(un,JSON.stringify(n))}catch{}}function fn(e){return e.token||H()}async function P(e,t="info",n={}){let r=`${n.endpoint??"https://api.dtect.io/security"}/log`,o={message:e,type:t,payload:n};navigator.sendBeacon(r,JSON.stringify(o))}var ve,v="https://api.dtect.io/security",be=`${v}/client/check`,T="",V="",hn="0.0.20";var so="20000000-aaaa-bbbb-cccc-000000000002",Te;var{state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}}=dn(),pn=Dt,se;async function ao({clientId:e,apiKey:t,endpoint:n}){if(Pe({automationKey:C,behaviorKey:U,dtectAutomationSignalEnabled:x}))return{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x};let r=await rn.fetchQuery({queryKey:["getClientConfig",e,t],queryFn:()=>ct({url:`${n}/client/config`,headers:{"client-id":T,"x-api-key":V}})});if(!Pe(r))throw new Error("Missing keys from get client config");return C=r.automationKey,U=r.behaviorKey,B=r.dtectSignalEnabled,x=r.dtectAutomationSignalEnabled,G({state:d,securityKeys:r}),r}function gt(e){if(e instanceof Error){if(e?.message?.includes("maintenance_mode"))throw new Error(R.MAINTENANCE_MODE);if(e?.message?.includes("rate-limited"))throw new Error(R.RATE_LIMIT_REACHED);switch(e?.message){case j.ERROR_RATE_LIMIT:throw new Error(R.RATE_LIMIT_REACHED);default:throw new Error(R.INTERNAL_SERVER_ERROR)}}throw new Error(R.FAILED_TO_GET_SECURITY_TOKEN)}function Z(){if(En(d)&&Pe({automationKey:C,behaviorKey:U,dtectAutomationSignalEnabled:x}))return!0;let e=ke(),t=document.querySelector("#dtect-h-captcha");return!!ve&&!!(!x&&t||e||x)}function gn(){return!!(T&&V)}function co(){return new Promise(e=>{let t=()=>{window?.hcaptcha?e():requestAnimationFrame(t)};t()})}var ke=()=>window?.location?.href?.includes("localhost")||window?.location?.href?.includes("file:///");async function uo({behaviorKey:e,dtectAutomationSignalEnabled:t=!1}){if(ve=await j.load({apiKey:e,endpoint:["https://fp.dtect.io",j.defaultEndpoint],scriptUrlPattern:["https://fp.dtect.io/web/v<version>/<apiKey>/loader_v<loaderVersion>.js",j.defaultScriptUrlPattern]}),!ke()&&!t&&(await co(),await window.hcaptcha.render("dtect-h-captcha",{sitekey:C,size:"invisible"})),!ve)throw new Error(R.SDK_INIT_ERROR)}async function lo(){let e=performance.now();if(d.tokens){let c=(performance.now()-e).toFixed();return P(`getTokens finishes in ${c}ms`,"info",{function:"getTokens",endpoint:v,diff:c,token:d.token,clientId:T}),d.tokens}let t=new Promise(a=>{let c=ve?.get();a(c)}),n=new Promise(async a=>{ke()&&a({response:so});let m=await window?.hcaptcha?.execute({async:!0});a(m)}),[r,o]=await Promise.all([x?{response:""}:n,t]);d.tokens={behaviorRequestId:o?.requestId,behaviorToken:o?.sealedResult,automationToken:r?.response};let s=(performance.now()-e).toFixed();return P(`getTokens finishes in ${s}ms`,"info",{function:"getTokens",endpoint:v,diff:s,token:d.token,clientId:T}),d.tokens}function mo(e){let t=e?.projectId,n=e?.visitorId||H();return(typeof e?.projectId=="number"||typeof e?.visitorId=="number")&&(t=`${e?.projectId}`,n=`${e?.visitorId}`),{visitorId:n,projectId:t}}function yt(e){if(d.projectId&&d.visitorId)return{visitorId:d.visitorId,projectId:d.projectId};let{projectId:t,visitorId:n}=mo(e);return{projectId:t,visitorId:n}}async function yn(e,t){let n=performance.now();if(!Z())throw new Error(R.NOT_INITIALIZED);if(!gn())throw new Error(R.MISSING_CREDENTIALS);let{projectId:r,visitorId:o}=yt(e);if(d.projectId=r,d.visitorId=o,!e||!r?.trim())throw new Error(R.FAILED_TO_GET_SECURITY_RESULT);let i;try{let s=await lo();if(B){let a=new te,[c,m,u,l]=await Promise.allSettled([a.get(),on(),sn(),cn()]);i={deviceRes:c,vmDtectResults:m,tamperingDtectResults:u,incognitoDtectResults:l}}if(s?.behaviorToken&&s?.behaviorRequestId&&(x||!x&&s?.automationToken)){let a={behaviorToken:s.behaviorToken,automationToken:s.automationToken,behaviorRequestId:s.behaviorRequestId,entryLink:window?.location?.href,securitySettings:e.securitySettings,metaData:e.metaData,...B?{vmDtectResults:i?.vmDtectResults?.value,tamperingDtectResults:i?.tamperingDtectResults?.value,incognitoDtectResults:i?.incognitoDtectResults?.value,deviceIdResults:i?.deviceRes?.value}:{}};d.clientData=a;let c={...e,projectId:r,visitorId:o,clientData:a,version:"0.0.20",token:d.token,questionData:d.questionData,aiCheckData:d.aiCheckData},m=await he({url:`${t}`,body:{...c},headers:{"client-id":T,"x-api-key":V}});if("token"in m||"results"in m){G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}});let l=(performance.now()-n).toFixed();return P(`getResultBase finishes in ${l}ms`,"info",{function:"getResultBase",endpoint:v,diff:l,token:d.token,clientId:T}),m}}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(s){let c=(performance.now()-n).toFixed();if(P("getResultBase error","error",{function:"getResultBase",endpoint:v,error:s,diff:c,token:d.token,clientId:T}),s instanceof Error){if(s?.message?.includes("maintenance_mode"))throw new Error(R.MAINTENANCE_MODE);if(s?.message?.includes("rate-limited")||s?.message?.includes("429"))throw new Error(R.RATE_LIMIT_REACHED);switch(s?.message){case j.ERROR_RATE_LIMIT:throw new Error(R.RATE_LIMIT_REACHED);default:throw new Error(R.INTERNAL_SERVER_ERROR)}}throw new Error(R.FAILED_TO_GET_SECURITY_RESULT)}}async function Ae(e){return await yn(e,`${v}/client/check/result`)}async function Oe(e){return await yn(e,`${v}/client/check`)}async function De(e){let t=performance.now();if(!Z())throw new Error(R.NOT_INITIALIZED);let{respondentType:n,language:r}=e;try{let o=await ct({url:`${v}/client/quality-questions/${n}/${r}`,headers:{"client-id":T,"x-api-key":V}});if(o){let s=(performance.now()-t).toFixed();return P(`getQualityQuestions finishes in ${s}ms`,"info",{function:"getQualityQuestions",endpoint:v,diff:s,token:d.token,clientId:T}),o}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-t).toFixed();P("getQualityQuestions error","error",{endpoint:v,error:o,diff:s,token:d.token,clientId:T}),gt(o)}}async function Se(e){let t=performance.now();if(!Z())throw new Error(R.NOT_INITIALIZED);d.questionData||(d.questionData={questions:e.questions});let{visitorId:n,projectId:r}=yt(e);d.visitorId=n,d.projectId=r;try{let o=await he({url:be,headers:{"client-id":T,"x-api-key":V},body:{token:d.token,visitorId:n,projectId:r,version:hn,questionData:d.questionData,aiCheckData:d.aiCheckData,clientData:d.clientData}});if(o){G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}});let s=(performance.now()-t).toFixed();return P(`checkQualityQuestions finishes in ${s}ms`,"info",{function:"checkQualityQuestions",endpoint:v,diff:s,token:d.token,clientId:T}),o}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-t).toFixed();P("checkQualityQuestions error","error",{endpoint:v,error:o,diff:s,token:d.token,clientId:T}),gt(o)}}async function _e(e){let t=performance.now();if(!Z())throw new Error(R.NOT_INITIALIZED);d.aiCheckData={timeTakenSeconds:e.timeTakenSeconds,qbc:e.qbc||se.qbc,mas:e.mas||se.mas,scb:e.scb||se.scb,apd:e.apd||se.apd};let{visitorId:n,projectId:r}=yt(e);d.visitorId=n,d.projectId=r;try{let o=await he({url:be,headers:{"client-id":T,"x-api-key":V},body:{token:d.token,visitorId:n,projectId:r,version:hn,clientData:d.clientData,questionData:d.questionData,aiCheckData:d.aiCheckData}});if(o){G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}});let s=(performance.now()-t).toFixed();return P(`isAIUsageDetected finishes in ${s}ms`,"info",{function:"isAIUsageDetected",endpoint:v,diff:s,token:d.token,clientId:T}),o}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-t).toFixed();P("isAIUsageDetected error","error",{endpoint:v,error:o,diff:s,token:d.token,clientId:T}),gt(o)}}function fo(){let e=performance.now(),t=document.querySelector("head"),n=document.querySelector("body");if(!ke()){n?.insertAdjacentHTML("beforeend",'<div id="dtect-h-captcha" ></div>');let o=document.createElement("script");o.setAttribute("src","https://js.hcaptcha.com/1/api.js"),o.setAttribute("async","true"),o.setAttribute("defer","true"),t?.append(o);let s=(performance.now()-e).toFixed()}}function Pe(e){return(e.dtectAutomationSignalEnabled||e?.automationKey)&&e?.behaviorKey}function En(e){let t=e.tokens;return!!(t&&t.behaviorToken&&t.behaviorRequestId&&t.automationToken)}async function In(e){let t=performance.now();if(!e?.clientId||!e?.apiKey)throw P(R.MISSING_CREDENTIALS,"error",{endpoint:v,...e}),new Error(R.MISSING_CREDENTIALS);let{clientId:n,apiKey:r,endpoint:o="https://api.dtect.io/security",includeResults:i}=e;v=o,be=`${v}/client/check`;let s=fn(d);if(d.isLoading){if(Z())return Te;throw P(R.DUPLICATE_INITIALIZATION,"error",{endpoint:v,clientId:n,apiKey:r,token:d.token}),new Error(R.DUPLICATE_INITIALIZATION)}if(se=qt(d.aiCheckData),T=n,V=r,i&&(be=`${v}/client/check/result`),d={...d,isLoading:!0,token:s||""},En(d)&&Pe({automationKey:C,behaviorKey:U,dtectAutomationSignalEnabled:x}))return d={...d,isLoading:!1,token:s},G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}}),{getSecurityResult:Ae,getSecurityToken:Oe,isAIUsageDetected:_e,checkQualityQuestions:Se,getQualityQuestions:De,LanguageCodes:Q,QualityQuestionsRespondentTypes:W};if(!gn())throw P(R.MISSING_CREDENTIALS,"error",{endpoint:v,...e}),new Error(R.MISSING_CREDENTIALS);if(Z())return Te;try{let c=await ao({clientId:n,apiKey:r,endpoint:o});return c.dtectAutomationSignalEnabled||fo(),uo({behaviorKey:c.behaviorKey,dtectAutomationSignalEnabled:c.dtectAutomationSignalEnabled}).then(()=>{let u=(performance.now()-t).toFixed();return P(`init() finishes ${u}ms`,"info",{endpoint:v,function:"init",diff:u,token:d.token,clientId:T}),{getSecurityResult:Ae,getSecurityToken:Oe,SecurityAPIError:pn,isAIUsageDetected:_e,checkQualityQuestions:Se,getQualityQuestions:De,LanguageCodes:Q,QualityQuestionsRespondentTypes:W}}).catch(m=>{throw new Error(m.message)})}catch(c){if(c instanceof Error){if(P(c.message,"error",{function:"init",endpoint:v,error:c,token:d.token,clientId:T}),c?.message?.includes("maintenance_mode"))throw new Error(R.MAINTENANCE_MODE);if([R.INVALID_API_KEY,R.UNAUTHORIZED].includes(c?.message))throw new Error(R.INVALID_CREDENTIALS)}throw new Error(R.SDK_INIT_ERROR)}finally{d={...d,isLoading:!1,token:s},G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}})}}Te={init:In,getSecurityResult:Ae,getSecurityToken:Oe,isAIUsageDetected:_e,checkQualityQuestions:Se,getQualityQuestions:De,QualityQuestionsRespondentTypes:W,LanguageCodes:Q};var ho=Te;
package/dist/index.mjs CHANGED
@@ -1 +1,11 @@
1
- function mt(e,t){return function(r,n){return Object.prototype.hasOwnProperty.call(r,n)}(e,t)?e[t]:void 0}function Rt(e,t,r,n){let i=document,o="securitypolicyviolation",c,s=p=>{let l=new URL(e,location.href),{blockedURI:h}=p;h!==l.href&&h!==l.protocol.slice(0,-1)&&h!==l.origin||(c=p,a())};i.addEventListener(o,s);let a=()=>i.removeEventListener(o,s);return n?.then(a,a),Promise.resolve().then(t).then(p=>(a(),p),p=>new Promise(l=>{let h=new MessageChannel;h.port1.onmessage=()=>l(),h.port2.postMessage(null)}).then(()=>{if(a(),c)return r(c);throw p}))}function w(e){let t="";for(let r=0;r<e.length;++r)if(r>0){let n=e[r].toLowerCase();n!==e[r]?t+=` ${n}`:t+=e[r]}else t+=e[r].toUpperCase();return t}var yt={default:"endpoint"},It={default:"tlsEndpoint"},Tt="Client timeout",Ot="Network connection error",gt="Network request aborted",vt="Response cannot be parsed",ue="Blocked by CSP",le="The endpoint parameter is not a valid URL",_t="Handle on demand agent data error",At=w("WrongRegion"),Dt=w("SubscriptionNotActive"),wt=w("UnsupportedVersion"),Nt=w("InstallationMethodRestricted"),bt=w("HostnameRestricted"),Pt=w("IntegrationFailed"),kt=w("NetworkRestricted"),St=w("InvalidProxyIntegrationSecret"),Mt=w("InvalidProxyIntegrationHeaders"),Lt=w("ProxyIntegrationSecretEnvironmentMismatch"),he="API key required",ke="API key not found",Se="API key expired",Ft="Request cannot be parsed",xt="Request failed",Ut="Request failed to process",qt="Too many requests, rate limit exceeded",Kt="Not available for this origin",Gt="Not available with restricted header",Bt=he,Qt=ke,Ct=Se,jt="3.12.0",W="Failed to load the JS script of the agent",fe="9319";function Vt(e,t){let r=[],[n,i]=function(s){let a=function(h){let R=[...h];return{current:()=>R[0],postpone(){let y=R.shift();y!==void 0&&R.push(y)},exclude(){R.shift()}}}(s),p=function(h,R){let y=0;return()=>Math.random()*Math.min(R,h*Math.pow(2,y++))}(100,3e3),l=new Set;return[a.current(),(h,R)=>{let y,m=R instanceof Error?R.message:"";if(m===ue||m===le)a.exclude(),y=0;else if(m===fe)a.exclude();else if(m===W){let g=Date.now()-h.getTime()<50,f=a.current();f&&g&&!l.has(f)&&(l.add(f),y=0),a.postpone()}else a.postpone();let d=a.current();return d===void 0?void 0:[d,y??h.getTime()+p()-Date.now()]}]}(e),o;if(n===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));let c=s=>{let a=new Date,p=h=>r.push({url:s,startedAt:a,finishedAt:new Date,error:h}),l=t(s);return l.then(()=>p(),p),l.catch(h=>{if(o!=null||(o=h),r.length>=5)throw o;let R=i(a,h);if(!R)throw o;let[y,m]=R;return(d=m,new Promise(g=>setTimeout(g,d))).then(()=>c(y));var d})};return c(n).then(s=>[s,r])}var Me="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Yt=Me;function $t(e){var t,r;let{picked:n,rest:i}=function(l,h){let R={},y={};for(let[m,d]of Object.entries(l))h.includes(m)?R[m]=d:y[m]=d;return{picked:R,rest:y}}(e,["scriptUrlPattern","token","apiKey"]),o=n.token,c=(t=n.apiKey)!==null&&t!==void 0?t:o,s=(r=mt(e,"scriptUrlPattern"))!==null&&r!==void 0?r:Me,[a,p]=function(){let l=[],h=()=>{l.push({time:new Date,state:document.visibilityState})},R=function(y,m,d,g){return y.addEventListener(m,d,g),()=>y.removeEventListener(m,d,g)}(document,"visibilitychange",h);return h(),[l,R]}();return Promise.resolve().then(()=>{if(!c||typeof c!="string")throw new Error(he);let l=function(h,R){return(Array.isArray(h)?h:[h]).map(y=>function(m,d){let g=encodeURIComponent;return m.replace(/<[^<>]+>/g,f=>f==="<version>"?"3":f==="<apiKey>"?g(d):f==="<loaderVersion>"?g(jt):f)}(String(y),R))}(s,c);return Vt(l,Xt)}).catch(l=>{throw p(),function(h){return h instanceof Error&&h.message===fe?new Error(W):h}(l)}).then(([l,h])=>(p(),l.load({...i,ldi:{attempts:h,visibilityStates:a}})))}function Xt(e){return Rt(e,()=>function(t){return new Promise((r,n)=>{if(function(s){if(URL.prototype)try{return new URL(s,location.href),!1}catch(a){if(a instanceof Error&&a.name==="TypeError")return!0;throw a}}(t))throw new Error(le);let i=document.createElement("script"),o=()=>{var s;return(s=i.parentNode)===null||s===void 0?void 0:s.removeChild(i)},c=document.head||document.getElementsByTagName("head")[0];i.onload=()=>{o(),r()},i.onerror=()=>{o(),n(new Error(W))},i.async=!0,i.src=t,c.appendChild(i)})}(e),()=>{throw new Error(ue)}).then(Wt)}function Wt(){let e=window,t="__fpjs_p_l_b",r=e[t];if(function(n,i){var o;let c=(o=Object.getOwnPropertyDescriptor)===null||o===void 0?void 0:o.call(Object,n,i);c?.configurable?delete n[i]:c&&!c.writable||(n[i]=void 0)}(e,t),typeof r?.load!="function")throw new Error(fe);return r}var U={load:$t,defaultScriptUrlPattern:Yt,ERROR_SCRIPT_LOAD_FAIL:W,ERROR_API_KEY_EXPIRED:Se,ERROR_API_KEY_INVALID:ke,ERROR_API_KEY_MISSING:he,ERROR_BAD_REQUEST_FORMAT:Ft,ERROR_BAD_RESPONSE_FORMAT:vt,ERROR_CLIENT_TIMEOUT:Tt,ERROR_CSP_BLOCK:ue,ERROR_FORBIDDEN_ENDPOINT:bt,ERROR_FORBIDDEN_HEADER:Gt,ERROR_FORBIDDEN_ORIGIN:Kt,ERROR_GENERAL_SERVER_FAILURE:xt,ERROR_HANDLE_AGENT_DATA:_t,ERROR_INSTALLATION_METHOD_RESTRICTED:Nt,ERROR_INTEGRATION_FAILURE:Pt,ERROR_INVALID_ENDPOINT:le,ERROR_INVALID_PROXY_INTEGRATION_HEADERS:Mt,ERROR_INVALID_PROXY_INTEGRATION_SECRET:St,ERROR_NETWORK_ABORT:gt,ERROR_NETWORK_CONNECTION:Ot,ERROR_NETWORK_RESTRICTED:kt,ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH:Lt,ERROR_RATE_LIMIT:qt,ERROR_SERVER_TIMEOUT:Ut,ERROR_SUBSCRIPTION_NOT_ACTIVE:Dt,ERROR_TOKEN_EXPIRED:Ct,ERROR_TOKEN_INVALID:Qt,ERROR_TOKEN_MISSING:Bt,ERROR_UNSUPPORTED_VERSION:wt,ERROR_WRONG_REGION:At,defaultEndpoint:yt,defaultTlsEndpoint:It};var v=[];for(let e=0;e<256;++e)v.push((e+256).toString(16).slice(1));function Le(e,t=0){return(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase()}var de,Jt=new Uint8Array(16);function pe(){if(!de){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");de=crypto.getRandomValues.bind(crypto)}return de(Jt)}var zt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ee={randomUUID:zt};function Zt(e,t,r){if(Ee.randomUUID&&!t&&!e)return Ee.randomUUID();e=e||{};let n=e.random??e.rng?.()??pe();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Le(n)}var B=Zt;var Ht={UNAUTHORIZED:"Unauthorized"},er={EXPIRED:"EXPIRED_TOKEN",INVALID_API_KEY:"INVALID_API_KEY",MISSING_AUTHENTICATION_TOKEN:"MISSING_AUTHENTICATION_TOKEN"},Fe={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance",RATE_LIMIT_REACHED:"Too many requests. Rate limit exceeded"},xe={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},Ue={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},qe={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},Ke={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},E={...Ht,...er,...Fe,...xe,...Ue,...qe,...Ke},Ge={...Fe,...xe,...Ue,...qe,...Ke};var Q=(f=>(f.AR="ar",f.BN="bn",f.DE="de",f.EN="en",f.ES="es",f.FR="fr",f.HI="hi",f.ID="id",f.IT="it",f.JA="ja",f.KO="ko",f.MS="ms",f.NL="nl",f.PT="pt",f.RU="ru",f.YU="yu",f.ZH="zh",f))(Q||{}),C=(I=>(I.GeneralConsumer="general-consumer",I.HRManagerDirector="hr-manager-director",I.WebDeveloper="web-developer",I.SoftwareEngineer="software-engineer",I.ITDirector="it-director",I.BusinessAdministrator="business-administrator",I.AccountsPayableManager="accounts-payable-manager",I.Accountant="accountant",I.FinanceDirector="finance-director",I.SmallBusinessOwner="small-business-owner",I.GeneralContractor="general-contractor",I.MarketingManagerDirector="marketing-manager-director",I.ConsumerShopper="consumer-shopper",I.Travel="travel",I.Entertainment="entertainment",I.FinanceAndBanking="finance-and-banking",I.General="general",I.B2BWhiteCollar="b2b-white-collar",I.B2BBlueCollar="b2b-blue-collar",I.Lawyer="lawyer",I))(C||{});var tr=(e,t={})=>({"Content-Type":"application/json",...e?.accessToken&&{Authorization:`Bearer ${e?.accessToken}`},...t}),rr=async(e,t)=>{if(!e.ok){let r=await e.text();throw new Error(r)}return t==="file"?e.blob():t==="json"?e.json():t==="text"?e.text():null},Be=async({url:e,auth:t,body:r,method:n="GET",headers:i={},responseType:o="json"})=>{let c={method:n,headers:tr(t,i),...r?{body:r instanceof FormData?r:JSON.stringify(r)}:{}},s=await fetch(e,c);return rr(s,o)},me=e=>Be({...e,method:"GET"}),J=e=>Be({...e,method:"POST"});function Qe(e){let t=e?.qbc||!1,r=e?.mas||!1,n=e?.apd||!1,i=e?.scb||null,o=0,c=()=>{t=!1,r=!1,n=!1,i=void 0,o=0},s=()=>{let h=window?.getSelection()?.toString();h&&h.length>0&&(o=Date.now(),t=!0)},a=l=>{let h=l.clipboardData?.getData("text"),R=l.target instanceof HTMLInputElement||l.target instanceof HTMLTextAreaElement;h&&R&&(n=!0)},p=()=>{r=!0;let l=Date.now();if(o){let h=(l-o)/1e3;(i===void 0||h<i)&&(i=h)}};return document?.addEventListener("copy",s),document?.addEventListener("paste",a),window?.addEventListener("blur",p),{get qbc(){return t},get mas(){return r},get apd(){return n},get scb(){return i},reset:c,destroy(){document?.removeEventListener("copy",s),document?.removeEventListener("paste",a),window?.removeEventListener("blur",p)}}}var b=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var P=typeof window>"u"||"Deno"in globalThis;function A(){}function Ve(e,t){return typeof e=="function"?e(t):e}function Ye(e){return typeof e=="number"&&e>=0&&e!==1/0}function $e(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ye(e,t){return typeof e=="function"?e(t):e}function Xe(e,t){return typeof e=="function"?e(t):e}function Ie(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:c,stale:s}=e;if(c){if(n){if(t.queryHash!==j(c,t.options))return!1}else if(!K(t.queryKey,c))return!1}if(r!=="all"){let a=t.isActive();if(r==="active"&&!a||r==="inactive"&&a)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||i&&i!==t.state.fetchStatus||o&&!o(t))}function Te(e,t){let{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(q(t.options.mutationKey)!==q(o))return!1}else if(!K(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function j(e,t){return(t?.queryKeyHashFn||q)(e)}function q(e){return JSON.stringify(e,(t,r)=>Re(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function K(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!K(e[r],t[r])):!1}function We(e,t){if(e===t)return e;let r=Ce(e)&&Ce(t);if(r||Re(e)&&Re(t)){let n=r?e:Object.keys(e),i=n.length,o=r?t:Object.keys(t),c=o.length,s=r?[]:{},a=0;for(let p=0;p<c;p++){let l=r?p:o[p];(!r&&n.includes(l)||r)&&e[l]===void 0&&t[l]===void 0?(s[l]=void 0,a++):(s[l]=We(e[l],t[l]),s[l]===e[l]&&e[l]!==void 0&&a++)}return i===c&&a===i?e:s}return t}function Ce(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Re(e){if(!je(e))return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(!je(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function je(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){return new Promise(t=>{setTimeout(t,e)})}function ze(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?We(e,t):t}function Ze(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n}function He(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var V=Symbol();function z(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===V?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var nr=class extends b{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!P&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Z=new nr;var ir=class extends b{#e=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!P&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},G=new ir;function et(){let e,t,r=new Promise((i,o)=>{e=i,t=o});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}function sr(e){return Math.min(1e3*2**e,3e4)}function Oe(e){return(e??"online")==="online"?G.isOnline():!0}var tt=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function H(e){return e instanceof tt}function ee(e){let t=!1,r=0,n=!1,i,o=et(),c=d=>{n||(R(new tt(d)),e.abort?.())},s=()=>{t=!0},a=()=>{t=!1},p=()=>Z.isFocused()&&(e.networkMode==="always"||G.isOnline())&&e.canRun(),l=()=>Oe(e.networkMode)&&e.canRun(),h=d=>{n||(n=!0,e.onSuccess?.(d),i?.(),o.resolve(d))},R=d=>{n||(n=!0,e.onError?.(d),i?.(),o.reject(d))},y=()=>new Promise(d=>{i=g=>{(n||p())&&d(g)},e.onPause?.()}).then(()=>{i=void 0,n||e.onContinue?.()}),m=()=>{if(n)return;let d,g=r===0?e.initialPromise:void 0;try{d=g??e.fn()}catch(f){d=Promise.reject(f)}Promise.resolve(d).then(h).catch(f=>{if(n)return;let k=e.retry??(P?0:3),x=e.retryDelay??sr,I=typeof x=="function"?x(r,f):x,Et=k===!0||typeof k=="number"&&r<k||typeof k=="function"&&k(r,f);if(t||!Et){R(f);return}r++,e.onFail?.(r,f),Je(I).then(()=>p()?void 0:y()).then(()=>{t?R(f):m()})})};return{promise:o,cancel:c,continue:()=>(i?.(),o),cancelRetry:s,continueRetry:a,canStart:l,start:()=>(l()?m():y().then(m),o)}}function or(){let e=[],t=0,r=s=>{s()},n=s=>{s()},i=s=>setTimeout(s,0),o=s=>{t?e.push(s):i(()=>{r(s)})},c=()=>{let s=e;e=[],s.length&&i(()=>{n(()=>{s.forEach(a=>{r(a)})})})};return{batch:s=>{let a;t++;try{a=s()}finally{t--,t||c()}return a},batchCalls:s=>(...a)=>{o(()=>{s(...a)})},schedule:o,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{i=s}}}var O=or();var te=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ye(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(P?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}};var rt=class extends te{#e;#t;#r;#n;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=cr(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){let r=ze(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(A).catch(A):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Xe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===V||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!$e(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#n&&(this.#s?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(e&&this.setOptions(e),!this.options.queryFn){let s=this.observers.find(a=>a.options.queryFn);s&&this.setOptions(s.options)}let r=new AbortController,n=s=>{Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(this.#s=!0,r.signal)})},i=()=>{let s=z(this.options,t),a={queryKey:this.queryKey,meta:this.meta};return n(a),this.#s=!1,this.options.persister?this.options.persister(s,a,this):s(a)},o={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};n(o),this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta});let c=s=>{H(s)&&s.silent||this.#i({type:"error",error:s}),H(s)||(this.#r.config.onError?.(s,this),this.#r.config.onSettled?.(this.state.data,s,this)),this.scheduleGc()};return this.#n=ee({initialPromise:t?.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:s=>{if(s===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(s)}catch(a){c(a);return}this.#r.config.onSuccess?.(s,this),this.#r.config.onSettled?.(s,this.state.error,this),this.scheduleGc()},onError:c,onFail:(s,a)=>{this.#i({type:"failed",failureCount:s,error:a})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}),this.#n.start()}#i(e){let t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ar(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let n=e.error;return H(n)&&n.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),O.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function ar(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Oe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cr(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Y=class extends b{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let n=t.queryKey,i=t.queryHash??j(n,t),o=this.get(i);return o||(o=new rt({cache:this,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){O.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(r=>Ie(t,r))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Ie(e,r)):t}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){O.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};var nt=class extends te{#e;#t;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#t=e.mutationCache,this.#e=[],this.state=e.state||ur(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){this.#r=ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(n,i)=>{this.#n({type:"failed",failureCount:n,error:i})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});let t=this.state.status==="pending",r=!this.#r.canStart();try{if(!t){this.#n({type:"pending",variables:e,isPaused:r}),await this.#t.config.onMutate?.(e,this);let i=await this.options.onMutate?.(e);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:r})}let n=await this.#r.start();return await this.#t.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#t.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#n({type:"success",data:n}),n}catch(n){try{throw await this.#t.config.onError?.(n,e,this.state.context,this),await this.options.onError?.(n,e,this.state.context),await this.#t.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,n,e,this.state.context),n}finally{this.#n({type:"error",error:n})}}finally{this.#t.runNext(this)}}#n(e){let t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),O.batch(()=>{this.#e.forEach(r=>{r.onMutationUpdate(e)}),this.#t.notify({mutation:this,type:"updated",action:e})})}};function ur(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $=class extends b{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(e,t,r){let n=new nt({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#e.add(e);let t=re(e);if(typeof t=="string"){let r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){let t=re(e);if(typeof t=="string"){let r=this.#t.get(t);if(r)if(r.length>1){let n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=re(e);if(typeof t=="string"){let n=this.#t.get(t)?.find(i=>i.state.status==="pending");return!n||n===e}else return!0}runNext(e){let t=re(e);return typeof t=="string"?this.#t.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){O.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(r=>Te(t,r))}findAll(e={}){return this.getAll().filter(t=>Te(e,t))}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(t=>t.state.isPaused);return O.batch(()=>Promise.all(e.map(t=>t.continue().catch(A))))}};function re(e){return e.options.scope?.id}function ge(e){return{onFetch:(t,r)=>{let n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],c=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},a=0,p=async()=>{let l=!1,h=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?l=!0:t.signal.addEventListener("abort",()=>{l=!0}),t.signal)})},R=z(t.options,t.fetchOptions),y=async(m,d,g)=>{if(l)return Promise.reject();if(d==null&&m.pages.length)return Promise.resolve(m);let f={queryKey:t.queryKey,pageParam:d,direction:g?"backward":"forward",meta:t.options.meta};h(f);let k=await R(f),{maxPages:x}=t.options,I=g?He:Ze;return{pages:I(m.pages,k,x),pageParams:I(m.pageParams,d,x)}};if(i&&o.length){let m=i==="backward",d=m?lr:it,g={pages:o,pageParams:c},f=d(n,g);s=await y(g,f,m)}else{let m=e??o.length;do{let d=a===0?c[0]??n.initialPageParam:it(n,s);if(a>0&&d==null)break;s=await y(s,d),a++}while(a<m)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p}}}function it(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function lr(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var ve=class{#e;#t;#r;#n;#o;#s;#i;#a;constructor(e={}){this.#e=e.queryCache||new Y,this.#t=e.mutationCache||new $,this.#r=e.defaultOptions||{},this.#n=new Map,this.#o=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#i=Z.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=G.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#i?.(),this.#i=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#e.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(ye(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{let n=r.data;return[t,n]})}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(n.queryHash)?.state.data,c=Ve(t,o);if(c!==void 0)return this.#e.build(this,n).setData(c,{...r,manual:!0})}setQueriesData(e,t,r){return O.batch(()=>this.#e.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;O.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){let r=this.#e,n={type:"active",...e};return O.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(n,t)))}cancelQueries(e,t={}){let r={revert:!0,...t},n=O.batch(()=>this.#e.findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(A).catch(A)}invalidateQueries(e,t={}){return O.batch(()=>{if(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none")return Promise.resolve();let r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0},n=O.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,r);return r.throwOnError||(o=o.catch(A)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(A)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let r=this.#e.build(this,t);return r.isStaleByTime(ye(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(A).catch(A)}fetchInfiniteQuery(e){return e.behavior=ge(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(A).catch(A)}ensureInfiniteQueryData(e){return e.behavior=ge(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return G.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#n.set(q(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#n.values()],r={};return t.forEach(n=>{K(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#o.set(q(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#o.values()],r={};return t.forEach(n=>{K(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=j(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===V&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var hr=new ve({defaultOptions:{queries:{staleTime:3e4}},queryCache:new Y({onError:(e,t)=>{}}),mutationCache:new $}),st=hr;var ot="dtect_security_sdk_state",at=typeof window<"u",ct={isLoading:!1,token:"",visitorId:"",projectId:"",questionData:null,clientData:null,aiCheckData:null,tokens:null},ne={state:{...ct},securityKeys:{behaviorKey:"",automationKey:""}};function ut(){if(!at)return ne;try{let e=sessionStorage.getItem(ot);if(!e)return ne;let t=JSON.parse(e);return t.expiresAt&&t.expiresAt<Date.now()?ne:{state:{...ct,...t.state},securityKeys:t.securityKeys||{behaviorKey:"",automationKey:""}}}catch{return ne}}function S(e){if(at)try{let t=Date.now()+864e5,r={...e,expiresAt:t};sessionStorage.setItem(ot,JSON.stringify(r))}catch{}}function lt(e){return e.token||B()}async function _(e,t="info",r={}){let n=`${r.endpoint??"https://api.dtect.io/security"}/log`,i={message:e,type:t,payload:r};navigator.sendBeacon(n,JSON.stringify(i))}var ie,T="https://api.dtect.io/security",se=`${T}/client/check`,L="",F="",ht="0.0.19";var fr="20000000-aaaa-bbbb-cccc-000000000002",oe;var{state:u,securityKeys:{automationKey:D,behaviorKey:N}}=ut(),dr=Ge,X;async function pr({clientId:e,apiKey:t,endpoint:r}){if(ae({automationKey:D,behaviorKey:N}))return{automationKey:D,behaviorKey:N};let n=await st.fetchQuery({queryKey:["getClientConfig",e,t],queryFn:()=>me({url:`${r}/client/config`,headers:{"client-id":L,"x-api-key":F}})});if(!ae(n))throw new Error;return D=n.automationKey,N=n.behaviorKey,S({state:u,securityKeys:n}),n}function be(e){if(e instanceof Error){if(e?.message?.includes("maintenance_mode"))throw new Error(E.MAINTENANCE_MODE);if(e?.message?.includes("rate-limited"))throw new Error(E.RATE_LIMIT_REACHED);switch(e?.message){case U.ERROR_RATE_LIMIT:throw new Error(E.RATE_LIMIT_REACHED);default:throw new Error(E.INTERNAL_SERVER_ERROR)}}throw new Error(E.FAILED_TO_GET_SECURITY_TOKEN)}function M(){if(pt(u)&&ae({automationKey:D,behaviorKey:N}))return!0;let e=ce(),t=document.querySelector("#dtect-h-captcha");return!!ie&&!!(t||e)}function ft(){return!!(L&&F)}function Er(){return new Promise(e=>{let t=()=>{window?.hcaptcha?e():requestAnimationFrame(t)};t()})}var ce=()=>window?.location?.href?.includes("localhost")||window?.location?.href?.includes("file:///");async function mr({behaviorKey:e}){if(ie=await U.load({apiKey:e,endpoint:["https://fp.dtect.io",U.defaultEndpoint],scriptUrlPattern:["https://fp.dtect.io/web/v<version>/<apiKey>/loader_v<loaderVersion>.js",U.defaultScriptUrlPattern]}),ce()||(await Er(),await window.hcaptcha.render("dtect-h-captcha",{sitekey:D,size:"invisible"})),!ie)throw new Error(E.SDK_INIT_ERROR)}async function Rr(){let e=performance.now();if(u.tokens){let a=(performance.now()-e).toFixed();return _(`getTokens finishes in ${a}ms`,"info",{function:"getTokens",endpoint:T,diff:a,token:u.token}),u.tokens}let t=new Promise(s=>{let a=ie?.get();s(a)}),r=new Promise(async s=>{ce()&&s({response:fr});let p=await window?.hcaptcha?.execute({async:!0});s(p)}),[n,i]=await Promise.all([r,t]);u.tokens={behaviorRequestId:i?.requestId,behaviorToken:i?.sealedResult,automationToken:n?.response};let c=(performance.now()-e).toFixed();return _(`getTokens finishes in ${c}ms`,"info",{function:"getTokens",endpoint:T,diff:c,token:u.token}),u.tokens}function yr(e){let t=e?.projectId,r=e?.visitorId||B();return(typeof e?.projectId=="number"||typeof e?.visitorId=="number")&&(t=`${e?.projectId}`,r=`${e?.visitorId}`),{visitorId:r,projectId:t}}function Pe(e){if(u.projectId&&u.visitorId)return{visitorId:u.visitorId,projectId:u.projectId};let{projectId:t,visitorId:r}=yr(e);return{projectId:t,visitorId:r}}async function dt(e,t){let r=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);if(!ft())throw new Error(E.MISSING_CREDENTIALS);let{projectId:n,visitorId:i}=Pe(e);if(u.projectId=n,u.visitorId=i,!e||!n?.trim())throw new Error(E.FAILED_TO_GET_SECURITY_RESULT);try{let o=await Rr();if(o?.behaviorToken&&o?.behaviorRequestId&&o?.automationToken){let c={behaviorToken:o.behaviorToken,automationToken:o.automationToken,behaviorRequestId:o.behaviorRequestId,entryLink:window?.location?.href,securitySettings:e.securitySettings,metaData:e.metaData};u.clientData=c;let s={...e,projectId:n,visitorId:i,clientData:c,version:"0.0.19",token:u.token,questionData:u.questionData,aiCheckData:u.aiCheckData},a=await J({url:`${t}`,body:{...s},headers:{"client-id":L,"x-api-key":F}});if("token"in a||"results"in a){S({state:u,securityKeys:{automationKey:D,behaviorKey:N}});let l=(performance.now()-r).toFixed();return _(`getResultBase finishes in ${l}ms`,"info",{function:"getResultBase",endpoint:T,diff:l,token:u.token}),a}}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-r).toFixed();if(_("getResultBase error","error",{function:"getResultBase",endpoint:T,error:o,diff:s,token:u.token}),o instanceof Error){if(o?.message?.includes("maintenance_mode"))throw new Error(E.MAINTENANCE_MODE);if(o?.message?.includes("rate-limited")||o?.message?.includes("429"))throw new Error(E.RATE_LIMIT_REACHED);switch(o?.message){case U.ERROR_RATE_LIMIT:throw new Error(E.RATE_LIMIT_REACHED);default:throw new Error(E.INTERNAL_SERVER_ERROR)}}throw new Error(E.FAILED_TO_GET_SECURITY_RESULT)}}async function _e(e){return await dt(e,`${T}/client/check/result`)}async function Ae(e){return await dt(e,`${T}/client/check`)}async function De(e){let t=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);let{respondentType:r,language:n}=e;try{let i=await me({url:`${T}/client/quality-questions/${r}/${n}`,headers:{"client-id":L,"x-api-key":F}});if(i){let c=(performance.now()-t).toFixed();return _(`getQualityQuestions finishes in ${c}ms`,"info",{function:"getQualityQuestions",endpoint:T,diff:c,token:u.token}),i}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(i){let c=(performance.now()-t).toFixed();_("getQualityQuestions error","error",{endpoint:T,error:i,diff:c,token:u.token}),be(i)}}async function we(e){let t=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);u.questionData||(u.questionData={questions:e.questions});let{visitorId:r,projectId:n}=Pe(e);u.visitorId=r,u.projectId=n;try{let i=await J({url:se,headers:{"client-id":L,"x-api-key":F},body:{token:u.token,visitorId:r,projectId:n,version:ht,questionData:u.questionData,aiCheckData:u.aiCheckData,clientData:u.clientData}});if(i){S({state:u,securityKeys:{automationKey:D,behaviorKey:N}});let c=(performance.now()-t).toFixed();return _(`checkQualityQuestions finishes in ${c}ms`,"info",{function:"checkQualityQuestions",endpoint:T,diff:c,token:u.token}),i}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(i){let c=(performance.now()-t).toFixed();_("checkQualityQuestions error","error",{endpoint:T,error:i,diff:c,token:u.token}),be(i)}}async function Ne(e){let t=performance.now();if(!M())throw new Error(E.NOT_INITIALIZED);u.aiCheckData={timeTakenSeconds:e.timeTakenSeconds,qbc:e.qbc||X.qbc,mas:e.mas||X.mas,scb:e.scb||X.scb,apd:e.apd||X.apd};let{visitorId:r,projectId:n}=Pe(e);u.visitorId=r,u.projectId=n;try{let i=await J({url:se,headers:{"client-id":L,"x-api-key":F},body:{token:u.token,visitorId:r,projectId:n,version:ht,clientData:u.clientData,questionData:u.questionData,aiCheckData:u.aiCheckData}});if(i){S({state:u,securityKeys:{automationKey:D,behaviorKey:N}});let c=(performance.now()-t).toFixed();return _(`isAIUsageDetected finishes in ${c}ms`,"info",{function:"isAIUsageDetected",endpoint:T,diff:c,token:u.token}),i}throw new Error(E.INTERNAL_SERVER_ERROR)}catch(i){let c=(performance.now()-t).toFixed();_("isAIUsageDetected error","error",{endpoint:T,error:i,diff:c,token:u.token}),be(i)}}function Ir(){let e=performance.now(),t=document.querySelector("head"),r=document.querySelector("body");if(!ce()){r?.insertAdjacentHTML("beforeend",'<div id="dtect-h-captcha" ></div>');let i=document.createElement("script");i.setAttribute("src","https://js.hcaptcha.com/1/api.js"),i.setAttribute("async","true"),i.setAttribute("defer","true"),t?.append(i);let c=(performance.now()-e).toFixed();_(`loadHCaptcha finishes in ${c}ms`,"info",{function:"loadHCaptcha",endpoint:T,diff:c,token:u.token})}}function ae(e){return e?.automationKey&&e?.behaviorKey}function pt(e){let t=e.tokens;return!!(t&&t.behaviorToken&&t.behaviorRequestId&&t.automationToken)}async function Tr(e){let t=performance.now();if(!e?.clientId||!e?.apiKey)throw _(E.MISSING_CREDENTIALS,"error",{endpoint:T,...e}),new Error(E.MISSING_CREDENTIALS);let{clientId:r,apiKey:n,endpoint:i="https://api.dtect.io/security",includeResults:o}=e;T=i,se=`${T}/client/check`;let c=lt(u);if(u.isLoading){if(M())return oe;throw _(E.DUPLICATE_INITIALIZATION,"error",{endpoint:T,clientId:r,apiKey:n,token:u.token}),new Error(E.DUPLICATE_INITIALIZATION)}if(X=Qe(u.aiCheckData),L=r,F=n,o&&(se=`${T}/client/check/result`),u={...u,isLoading:!0,token:c||""},pt(u)&&ae({automationKey:D,behaviorKey:N}))return u={...u,isLoading:!1,token:c},S({state:u,securityKeys:{automationKey:D,behaviorKey:N}}),{getSecurityResult:_e,getSecurityToken:Ae,isAIUsageDetected:Ne,checkQualityQuestions:we,getQualityQuestions:De,LanguageCodes:Q,QualityQuestionsRespondentTypes:C};if(!ft())throw _(E.MISSING_CREDENTIALS,"error",{endpoint:T,...e}),new Error(E.MISSING_CREDENTIALS);if(M())return oe;Ir();try{let a=await pr({clientId:r,apiKey:n,endpoint:i});if(M())throw new Error;return mr({behaviorKey:a.behaviorKey}).then(()=>{let l=(performance.now()-t).toFixed();return _(`init() finishes ${l}ms`,"info",{endpoint:T,function:"init",diff:l,token:u.token}),{getSecurityResult:_e,getSecurityToken:Ae,SecurityAPIError:dr,isAIUsageDetected:Ne,checkQualityQuestions:we,getQualityQuestions:De,LanguageCodes:Q,QualityQuestionsRespondentTypes:C}}).catch(p=>{throw new Error(p.message)})}catch(a){if(a instanceof Error){if(_(a.message,"error",{function:"init",endpoint:T,error:a,token:u.token}),a?.message?.includes("maintenance_mode"))throw new Error(E.MAINTENANCE_MODE);if([E.INVALID_API_KEY,E.UNAUTHORIZED].includes(a?.message))throw new Error(E.INVALID_CREDENTIALS)}throw new Error(E.SDK_INIT_ERROR)}finally{u={...u,isLoading:!1,token:c},S({state:u,securityKeys:{automationKey:D,behaviorKey:N}})}}oe={init:Tr,getSecurityResult:_e,getSecurityToken:Ae,isAIUsageDetected:Ne,checkQualityQuestions:we,getQualityQuestions:De,QualityQuestionsRespondentTypes:C,LanguageCodes:Q};var Si=oe;export{Q as LanguageCodes,C as QualityQuestionsRespondentTypes,dr as SecurityAPIError,we as checkQualityQuestions,Si as default,De as getQualityQuestions,_e as getSecurityResult,Ae as getSecurityToken,Tr as init,Ne as isAIUsageDetected};
1
+ function yn(e,t){return function(n,r){return Object.prototype.hasOwnProperty.call(n,r)}(e,t)?e[t]:void 0}function En(e,t,n,r){let o=document,i="securitypolicyviolation",s,a=m=>{let u=new URL(e,location.href),{blockedURI:l}=m;l!==u.href&&l!==u.protocol.slice(0,-1)&&l!==u.origin||(s=m,c())};o.addEventListener(i,a);let c=()=>o.removeEventListener(i,a);return r?.then(c,c),Promise.resolve().then(t).then(m=>(c(),m),m=>new Promise(u=>{let l=new MessageChannel;l.port1.onmessage=()=>u(),l.port2.postMessage(null)}).then(()=>{if(c(),s)return n(s);throw m}))}function F(e){let t="";for(let n=0;n<e.length;++n)if(n>0){let r=e[n].toLowerCase();r!==e[n]?t+=` ${r}`:t+=e[n]}else t+=e[n].toUpperCase();return t}var In={default:"endpoint"},wn={default:"tlsEndpoint"},Rn="Client timeout",vn="Network connection error",bn="Network request aborted",Tn="Response cannot be parsed",ke="Blocked by CSP",xe="The endpoint parameter is not a valid URL",An="Handle on demand agent data error",On=F("WrongRegion"),Dn=F("SubscriptionNotActive"),Sn=F("UnsupportedVersion"),_n=F("InstallationMethodRestricted"),Pn=F("HostnameRestricted"),kn=F("IntegrationFailed"),xn=F("NetworkRestricted"),Nn=F("InvalidProxyIntegrationSecret"),Mn=F("InvalidProxyIntegrationHeaders"),Ln=F("ProxyIntegrationSecretEnvironmentMismatch"),Ne="API key required",yt="API key not found",Et="API key expired",Cn="Request cannot be parsed",Fn="Request failed",Un="Request failed to process",Bn="Too many requests, rate limit exceeded",qn="Not available for this origin",Kn="Not available with restricted header",Gn=Ne,Vn=yt,jn=Et,Qn="3.12.0",ae="Failed to load the JS script of the agent",Me="9319";function Wn(e,t){let n=[],[r,o]=function(a){let c=function(l){let h=[...l];return{current:()=>h[0],postpone(){let E=h.shift();E!==void 0&&h.push(E)},exclude(){h.shift()}}}(a),m=function(l,h){let E=0;return()=>Math.random()*Math.min(h,l*Math.pow(2,E++))}(100,3e3),u=new Set;return[c.current(),(l,h)=>{let E,y=h instanceof Error?h.message:"";if(y===ke||y===xe)c.exclude(),E=0;else if(y===Me)c.exclude();else if(y===ae){let I=Date.now()-l.getTime()<50,g=c.current();g&&I&&!u.has(g)&&(u.add(g),E=0),c.postpone()}else c.postpone();let f=c.current();return f===void 0?void 0:[f,E??l.getTime()+m()-Date.now()]}]}(e),i;if(r===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));let s=a=>{let c=new Date,m=l=>n.push({url:a,startedAt:c,finishedAt:new Date,error:l}),u=t(a);return u.then(()=>m(),m),u.catch(l=>{if(i!=null||(i=l),n.length>=5)throw i;let h=o(c,l);if(!h)throw i;let[E,y]=h;return(f=y,new Promise(I=>setTimeout(I,f))).then(()=>s(E));var f})};return s(r).then(a=>[a,n])}var It="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",$n=It;function zn(e){var t,n;let{picked:r,rest:o}=function(u,l){let h={},E={};for(let[y,f]of Object.entries(u))l.includes(y)?h[y]=f:E[y]=f;return{picked:h,rest:E}}(e,["scriptUrlPattern","token","apiKey"]),i=r.token,s=(t=r.apiKey)!==null&&t!==void 0?t:i,a=(n=yn(e,"scriptUrlPattern"))!==null&&n!==void 0?n:It,[c,m]=function(){let u=[],l=()=>{u.push({time:new Date,state:document.visibilityState})},h=function(E,y,f,I){return E.addEventListener(y,f,I),()=>E.removeEventListener(y,f,I)}(document,"visibilitychange",l);return l(),[u,h]}();return Promise.resolve().then(()=>{if(!s||typeof s!="string")throw new Error(Ne);let u=function(l,h){return(Array.isArray(l)?l:[l]).map(E=>function(y,f){let I=encodeURIComponent;return y.replace(/<[^<>]+>/g,g=>g==="<version>"?"3":g==="<apiKey>"?I(f):g==="<loaderVersion>"?I(Qn):g)}(String(E),h))}(a,s);return Wn(u,Yn)}).catch(u=>{throw m(),function(l){return l instanceof Error&&l.message===Me?new Error(ae):l}(u)}).then(([u,l])=>(m(),u.load({...o,ldi:{attempts:l,visibilityStates:c}})))}function Yn(e){return En(e,()=>function(t){return new Promise((n,r)=>{if(function(a){if(URL.prototype)try{return new URL(a,location.href),!1}catch(c){if(c instanceof Error&&c.name==="TypeError")return!0;throw c}}(t))throw new Error(xe);let o=document.createElement("script"),i=()=>{var a;return(a=o.parentNode)===null||a===void 0?void 0:a.removeChild(o)},s=document.head||document.getElementsByTagName("head")[0];o.onload=()=>{i(),n()},o.onerror=()=>{i(),r(new Error(ae))},o.async=!0,o.src=t,s.appendChild(o)})}(e),()=>{throw new Error(ke)}).then(Jn)}function Jn(){let e=window,t="__fpjs_p_l_b",n=e[t];if(function(r,o){var i;let s=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,r,o);s?.configurable?delete r[o]:s&&!s.writable||(r[o]=void 0)}(e,t),typeof n?.load!="function")throw new Error(Me);return n}var j={load:zn,defaultScriptUrlPattern:$n,ERROR_SCRIPT_LOAD_FAIL:ae,ERROR_API_KEY_EXPIRED:Et,ERROR_API_KEY_INVALID:yt,ERROR_API_KEY_MISSING:Ne,ERROR_BAD_REQUEST_FORMAT:Cn,ERROR_BAD_RESPONSE_FORMAT:Tn,ERROR_CLIENT_TIMEOUT:Rn,ERROR_CSP_BLOCK:ke,ERROR_FORBIDDEN_ENDPOINT:Pn,ERROR_FORBIDDEN_HEADER:Kn,ERROR_FORBIDDEN_ORIGIN:qn,ERROR_GENERAL_SERVER_FAILURE:Fn,ERROR_HANDLE_AGENT_DATA:An,ERROR_INSTALLATION_METHOD_RESTRICTED:_n,ERROR_INTEGRATION_FAILURE:kn,ERROR_INVALID_ENDPOINT:xe,ERROR_INVALID_PROXY_INTEGRATION_HEADERS:Mn,ERROR_INVALID_PROXY_INTEGRATION_SECRET:Nn,ERROR_NETWORK_ABORT:bn,ERROR_NETWORK_CONNECTION:vn,ERROR_NETWORK_RESTRICTED:xn,ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH:Ln,ERROR_RATE_LIMIT:Bn,ERROR_SERVER_TIMEOUT:Un,ERROR_SUBSCRIPTION_NOT_ACTIVE:Dn,ERROR_TOKEN_EXPIRED:jn,ERROR_TOKEN_INVALID:Vn,ERROR_TOKEN_MISSING:Gn,ERROR_UNSUPPORTED_VERSION:Sn,ERROR_WRONG_REGION:On,defaultEndpoint:In,defaultTlsEndpoint:wn};var O=[];for(let e=0;e<256;++e)O.push((e+256).toString(16).slice(1));function wt(e,t=0){return(O[e[t+0]]+O[e[t+1]]+O[e[t+2]]+O[e[t+3]]+"-"+O[e[t+4]]+O[e[t+5]]+"-"+O[e[t+6]]+O[e[t+7]]+"-"+O[e[t+8]]+O[e[t+9]]+"-"+O[e[t+10]]+O[e[t+11]]+O[e[t+12]]+O[e[t+13]]+O[e[t+14]]+O[e[t+15]]).toLowerCase()}var Le,Xn=new Uint8Array(16);function Ce(){if(!Le){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Le=crypto.getRandomValues.bind(crypto)}return Le(Xn)}var Zn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Fe={randomUUID:Zn};function Hn(e,t,n){if(Fe.randomUUID&&!t&&!e)return Fe.randomUUID();e=e||{};let r=e.random??e.rng?.()??Ce();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return wt(r)}var X=Hn;var er={UNAUTHORIZED:"Unauthorized"},tr={EXPIRED:"EXPIRED_TOKEN",INVALID_API_KEY:"INVALID_API_KEY",MISSING_AUTHENTICATION_TOKEN:"MISSING_AUTHENTICATION_TOKEN"},Rt={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance",RATE_LIMIT_REACHED:"Too many requests. Rate limit exceeded"},vt={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},bt={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},Tt={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},At={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},R={...er,...tr,...Rt,...vt,...bt,...Tt,...At},Ot={...Rt,...vt,...bt,...Tt,...At};var Z=(g=>(g.AR="ar",g.BN="bn",g.DE="de",g.EN="en",g.ES="es",g.FR="fr",g.HI="hi",g.ID="id",g.IT="it",g.JA="ja",g.KO="ko",g.MS="ms",g.NL="nl",g.PT="pt",g.RU="ru",g.YU="yu",g.ZH="zh",g))(Z||{}),H=(w=>(w.GeneralConsumer="general-consumer",w.HRManagerDirector="hr-manager-director",w.WebDeveloper="web-developer",w.SoftwareEngineer="software-engineer",w.ITDirector="it-director",w.BusinessAdministrator="business-administrator",w.AccountsPayableManager="accounts-payable-manager",w.Accountant="accountant",w.FinanceDirector="finance-director",w.SmallBusinessOwner="small-business-owner",w.GeneralContractor="general-contractor",w.MarketingManagerDirector="marketing-manager-director",w.ConsumerShopper="consumer-shopper",w.Travel="travel",w.Entertainment="entertainment",w.FinanceAndBanking="finance-and-banking",w.General="general",w.B2BWhiteCollar="b2b-white-collar",w.B2BBlueCollar="b2b-blue-collar",w.Lawyer="lawyer",w))(H||{});var Q={exclude:[],include:[],stabilize:["private","iframe"],logging:!0,timeout:5e3,cache_api_call:!0,performance:!1,experimental:!1},So={...Q},Ue={private:[{exclude:["canvas"],browsers:["firefox","safari>=17","brave"]},{exclude:["audio"],browsers:["samsungbrowser","safari"]},{exclude:["fonts"],browsers:["firefox"]},{exclude:["audio.sampleHash","hardware.deviceMemory","header.acceptLanguage.q","system.hardwareConcurrency","plugins"],browsers:["brave"]},{exclude:["tls.extensions"],browsers:["firefox","chrome","safari"]},{exclude:["header.acceptLanguage"],browsers:["edge","chrome"]}],iframe:[{exclude:["system.applePayVersion","system.cookieEnabled"],browsers:["safari"]},{exclude:["permissions"]}],vpn:[{exclude:["ip"]}]};async function Be(){return nr()}async function nr(){return new Promise((t,n)=>{try{let i=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,5e3,44100),s=i?.createBufferSource(),a=i.createOscillator();a.frequency.value=1e3;let c=i.createDynamicsCompressor();c.threshold.value=-50,c.knee.value=40,c.ratio.value=12,c.attack.value=0,c.release.value=.2,a.connect(c),c.connect(i.destination),a.start();let m;i.oncomplete=u=>{m=u.renderedBuffer.getChannelData(0),t({sampleHash:rr(m),maxChannels:i.destination.maxChannelCount,channelCountMode:s.channelCountMode})},i.startRendering()}catch(r){console.error("Error creating audio fingerprint:",r),n(r)}})}function rr(e){let t=0;for(let n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function ce(e,t,n){let r=[];for(let s=0;s<e[0].data.length;s++){let a=[];for(let c=0;c<e.length;c++)a.push(e[c].data[s]);r.push(or(a))}let o=r,i=new Uint8ClampedArray(o);return new ImageData(i,t,n)}function or(e){if(e.length===0)return 0;let t={};for(let r of e)t[r]=(t[r]||0)+1;let n=e[0];for(let r in t)t[r]>t[n]&&(n=parseInt(r,10));return n}function ir(e){return new TextEncoder().encode(e).buffer}function ue(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^=e>>>16,e>>>0}var S=new Uint32Array([597399067,2869860233,951274213,2716044179]);function L(e,t){return e<<t|e>>>32-t}function sr(e,t){let n=e.byteLength/16|0,r=new Uint32Array(e,0,n*4);for(let o=0;o<n;o++){let i=r.subarray(o*4,(o+1)*4);i[0]=Math.imul(i[0],S[0]),i[0]=L(i[0],15),i[0]=Math.imul(i[0],S[1]),t[0]=t[0]^i[0],t[0]=L(t[0],19),t[0]=t[0]+t[1],t[0]=Math.imul(t[0],5)+1444728091,i[1]=Math.imul(i[1],S[1]),i[1]=L(i[1],16),i[1]=Math.imul(i[1],S[2]),t[1]=t[1]^i[1],t[1]=L(t[1],17),t[1]=t[1]+t[2],t[1]=Math.imul(t[1],5)+197830471,i[2]=Math.imul(i[2],S[2]),i[2]=L(i[2],17),i[2]=Math.imul(i[2],S[3]),t[2]=t[2]^i[2],t[2]=L(t[2],15),t[2]=t[2]+t[3],t[2]=Math.imul(t[2],5)+2530024501,i[3]=Math.imul(i[3],S[3]),i[3]=L(i[3],18),i[3]=Math.imul(i[3],S[0]),t[3]=t[3]^i[3],t[3]=L(t[3],13),t[3]=t[3]+t[0],t[3]=Math.imul(t[3],5)+850148119}}function ar(e,t){let n=e.byteLength/16|0,r=e.byteLength%16,o=new Uint32Array(4),i=new Uint8Array(e,n*16,r);switch(r){case 15:o[3]=o[3]^i[14]<<16;case 14:o[3]=o[3]^i[13]<<8;case 13:o[3]=o[3]^i[12]<<0,o[3]=Math.imul(o[3],S[3]),o[3]=L(o[3],18),o[3]=Math.imul(o[3],S[0]),t[3]=t[3]^o[3];case 12:o[2]=o[2]^i[11]<<24;case 11:o[2]=o[2]^i[10]<<16;case 10:o[2]=o[2]^i[9]<<8;case 9:o[2]=o[2]^i[8]<<0,o[2]=Math.imul(o[2],S[2]),o[2]=L(o[2],17),o[2]=Math.imul(o[2],S[3]),t[2]=t[2]^o[2];case 8:o[1]=o[1]^i[7]<<24;case 7:o[1]=o[1]^i[6]<<16;case 6:o[1]=o[1]^i[5]<<8;case 5:o[1]=o[1]^i[4]<<0,o[1]=Math.imul(o[1],S[1]),o[1]=L(o[1],16),o[1]=Math.imul(o[1],S[2]),t[1]=t[1]^o[1];case 4:o[0]=o[0]^i[3]<<24;case 3:o[0]=o[0]^i[2]<<16;case 2:o[0]=o[0]^i[1]<<8;case 1:o[0]=o[0]^i[0]<<0,o[0]=Math.imul(o[0],S[0]),o[0]=L(o[0],15),o[0]=Math.imul(o[0],S[1]),t[0]=t[0]^o[0]}}function cr(e,t){t[0]=t[0]^e.byteLength,t[1]=t[1]^e.byteLength,t[2]=t[2]^e.byteLength,t[3]=t[3]^e.byteLength,t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0,t[0]=ue(t[0]),t[1]=ue(t[1]),t[2]=ue(t[2]),t[3]=ue(t[3]),t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0}function D(e,t=0){if(t=t?t|0:0,typeof e=="string"&&(e=ir(e)),!(e instanceof ArrayBuffer))throw new TypeError("Expected key to be ArrayBuffer or string");let n=new Uint32Array([t,t,t,t]);sr(e,n),ar(e,n),cr(e,n);let r=new Uint8Array(n.buffer);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}var ur=3,Dt=280,St=20;async function qe(){return lr()}function lr(){return new Promise(e=>{let t=Array.from({length:ur},()=>mr()),n=ce(t,Dt,St);e({commonPixelsHash:D(n.data.toString()).toString()})})}function mr(){let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return new ImageData(1,1);e.width=Dt,e.height=St;let n=t.createLinearGradient(0,0,e.width,e.height);n.addColorStop(0,"red"),n.addColorStop(1/6,"orange"),n.addColorStop(2/6,"yellow"),n.addColorStop(3/6,"green"),n.addColorStop(4/6,"blue"),n.addColorStop(5/6,"indigo"),n.addColorStop(1,"violet"),t.fillStyle=n,t.fillRect(0,0,e.width,e.height);let r="Random Text WMwmil10Oo";return t.font="23.123px Arial",t.fillStyle="black",t.fillText(r,-5,15),t.fillStyle="rgba(0, 0, 255, 0.5)",t.fillText(r,-3.3,17.7),t.beginPath(),t.moveTo(0,0),t.lineTo(e.width*2/7,e.height),t.strokeStyle="white",t.lineWidth=2,t.stroke(),t.getImageData(0,0,e.width,e.height)}async function le(e){for(;!document.body;)await dr(50);let t=document.createElement("iframe");t.setAttribute("frameBorder","0");let n=t.style;n.setProperty("position","fixed"),n.setProperty("display","block","important"),n.setProperty("visibility","visible"),n.setProperty("border","0"),n.setProperty("opacity","0"),t.src="about:blank",document.body.appendChild(t);let r=t.contentDocument||t.contentWindow?.document;if(!r)throw new Error("Iframe document is not accessible");e({iframe:r}),setTimeout(()=>{document.body.removeChild(t)},0)}function dr(e,t){return new Promise(n=>setTimeout(n,e,t))}var fr=["Arial","Arial Black","Arial Narrow","Arial Rounded MT","Arimo","Archivo","Barlow","Bebas Neue","Bitter","Bookman","Calibri","Cabin","Candara","Century","Century Gothic","Comic Sans MS","Constantia","Courier","Courier New","Crimson Text","DM Mono","DM Sans","DM Serif Display","DM Serif Text","Dosis","Droid Sans","Exo","Fira Code","Fira Sans","Franklin Gothic Medium","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Impact","Inconsolata","Indie Flower","Inter","Josefin Sans","Karla","Lato","Lexend","Lucida Bright","Lucida Console","Lucida Sans Unicode","Manrope","Merriweather","Merriweather Sans","Montserrat","Myriad","Noto Sans","Nunito","Nunito Sans","Open Sans","Optima","Orbitron","Oswald","Pacifico","Palatino","Perpetua","PT Sans","PT Serif","Poppins","Prompt","Public Sans","Quicksand","Rajdhani","Recursive","Roboto","Roboto Condensed","Rockwell","Rubik","Segoe Print","Segoe Script","Segoe UI","Sora","Source Sans Pro","Space Mono","Tahoma","Taviraj","Times","Times New Roman","Titillium Web","Trebuchet MS","Ubuntu","Varela Round","Verdana","Work Sans"],hr=["monospace","sans-serif","serif"];async function Ke(e){return pr()}function pr(){return new Promise((e,t)=>{try{le(async({iframe:n})=>{let o=n.createElement("canvas").getContext("2d"),i=hr.map(a=>_t(o,a)),s={};fr.forEach(a=>{let c=_t(o,a);i.includes(c)||(s[a]=c)}),e(s)})}catch{t({error:"unsupported"})}})}function _t(e,t){if(!e)return null;let n="WwMmLli0Oo";return e.font=`72px ${t}`,e.measureText(n).width}function Ge(){return new Promise((e,t)=>{let n=navigator.deviceMemory!==void 0?navigator.deviceMemory:0,r=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:gr(),architecture:yr(),deviceMemory:n.toString()||"undefined",jsHeapSizeLimit:r.jsHeapSizeLimit||0})})}function gr(){let e=document.createElement("canvas"),t=e.getContext("webgl")??e.getContext("experimental-webgl");if(t&&"getParameter"in t)try{let n=(t.getParameter(t.VENDOR)||"").toString(),r=(t.getParameter(t.RENDERER)||"").toString(),o={vendor:n,renderer:r,version:(t.getParameter(t.VERSION)||"").toString(),shadingLanguageVersion:(t.getParameter(t.SHADING_LANGUAGE_VERSION)||"").toString()};if(!r.length||!n.length){let i=t.getExtension("WEBGL_debug_renderer_info");if(i){let s=(t.getParameter(i.UNMASKED_VENDOR_WEBGL)||"").toString(),a=(t.getParameter(i.UNMASKED_RENDERER_WEBGL)||"").toString();s&&(o.vendorUnmasked=s),a&&(o.rendererUnmasked=a)}}return o}catch{}return"undefined"}function yr(){let e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function Ve(){return new Promise(e=>{e({languages:Er(),timezone:Ir()})})}function Er(){let e=[];return navigator.language}function Ir(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var me=(e,t,n,r)=>{let o=(n-t)/r,i=0;for(let s=0;s<r;s++){let a=t+(s+.5)*o;i+=e(a)}return i*o};function je(){return new Promise(e=>{e({acos:Math.acos(.5),asin:me(Math.asin,-1,1,97),cos:me(Math.cos,0,Math.PI,97),largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),sin:me(Math.sin,-Math.PI,Math.PI,97),tan:me(Math.tan,0,2*Math.PI,97)})})}function wr(e){if(e.length===0)return null;let t={};e.forEach(o=>{let i=String(o);t[i]=(t[i]||0)+1});let n=e[0],r=1;return Object.keys(t).forEach(o=>{t[o]>r&&(n=o,r=t[o])}),n}function Pt(e,t){let n={};return t.forEach(r=>{let o=e.map(s=>r in s?s[r]:void 0).filter(s=>s!==void 0),i=wr(o);i&&(n[r]=i)}),n}var Rr=["accelerometer","accessibility","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","device-info","display-capture","gyroscope","geolocation","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","speaker","storage-access","top-level-storage-access","window-management","query"];async function Qe(e){let t=e?.permissions_to_check||Rr,r=await Promise.all(Array.from({length:3},()=>vr(t)));return Pt(r,t)}async function vr(e){let t={};for(let n of e)try{let r=await navigator.permissions.query({name:n});t[n]=r.state.toString()}catch{}return t}async function We(){let e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){let n=navigator.plugins[t];e.push([n.name,n.filename,n.description].join("|"))}return new Promise(t=>{t({plugins:e})})}function W(){if(typeof navigator>"u")return{name:"unknown",version:"unknown"};let e=navigator.userAgent,t=[/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>EdgA|EdgiOS|Edg)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>OPR|OPX)\/(?<version>\d+(?:\.\d+)+)/,/Opera[\s\/](?<version>\d+(?:\.\d+)+)/,/Opera Mini\/(?<version>\d+(?:\.\d+)+)/,/Opera Mobi\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Vivaldi)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Brave)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>CriOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>FxiOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Chrome|Chromium)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Firefox|Waterfox|Iceweasel|IceCat)\/(?<version>\d+(?:\.\d+)+)/,/Version\/(?<version1>[\d.]+).*Safari\/[\d.]+|(?<name>Safari)\/(?<version2>[\d.]+)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)+)/,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)+)/],n={edg:"Edge",edga:"Edge",edgios:"Edge",opr:"Opera",opx:"Opera",crios:"Chrome",fxios:"Firefox",samsung:"SamsungBrowser",vivaldi:"Vivaldi",brave:"Brave"};for(let r of t){let o=e.match(r);if(o){let i=o.groups?.name,s=o.groups?.version||o.groups?.version1||o.groups?.version2;if(!i&&(o.groups?.version1||o.groups?.version2)&&(i="Safari"),!i&&r.source.includes("Opera Mini")&&(i="Opera Mini"),!i&&r.source.includes("Opera Mobi")&&(i="Opera Mobi"),!i&&r.source.includes("Opera")&&(i="Opera"),!i&&o[1]&&(i=o[1]),!s&&o[2]&&(s=o[2]),i)return{name:n[i.toLowerCase()]||i,version:s||"unknown"}}}return{name:"unknown",version:"unknown"}}function de(){if(typeof navigator>"u"||!navigator.userAgent)return!1;let e=navigator.userAgent;return/Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e)&&!/iPad/i.test(e)}function $e(){return new Promise(e=>{let t={is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:Tr()};de()&&navigator.maxTouchPoints>0&&(t.resolution=br()),e(t)})}function br(){let e=window.screen.width,t=window.screen.height,n=Math.max(e,t).toString(),r=Math.min(e,t).toString();return`${n}x${r}`}function Tr(){let e=[],t={"prefers-contrast":["high","more","low","less","forced","no-preference"],"any-hover":["hover","none"],"any-pointer":["none","coarse","fine"],pointer:["none","coarse","fine"],hover:["hover","none"],update:["fast","slow"],"inverted-colors":["inverted","none"],"prefers-reduced-motion":["reduce","no-preference"],"prefers-reduced-transparency":["reduce","no-preference"],scripting:["none","initial-only","enabled"],"forced-colors":["active","none"]};return Object.keys(t).forEach(n=>{t[n].forEach(r=>{matchMedia(`(${n}: ${r})`).matches&&e.push(`${n}: ${r}`)})}),e}function ze(){return new Promise(e=>{let t=W(),n=navigator.userAgent,r={platform:window.navigator.platform,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:t.name,version:t.version},mobile:de(),applePayVersion:Ar(),cookieEnabled:window.navigator.cookieEnabled};e(r)})}function Ar(){if(window.location.protocol==="https:"&&typeof window.ApplePaySession=="function")try{let e=window.ApplePaySession.supportsVersion;for(let t=15;t>0;t--)if(e(t))return t}catch{return 0}return 0}var Or=W().name!=="SamsungBrowser"?1:3,_,p=null;function Dr(){typeof document<"u"&&(_=document.createElement("canvas"),_.width=200,_.height=100,p=_.getContext("webgl"))}async function Ye(){Dr();try{if(!p)throw new Error("WebGL not supported");let e=Array.from({length:Or},()=>Sr()),t=ce(e,_.width,_.height);return{commonPixelsHash:D(t.data.toString()).toString()}}catch{return{webgl:"unsupported"}}}function Sr(){try{if(!p)throw new Error("WebGL not supported");let e=`
2
+ attribute vec2 position;
3
+ void main() {
4
+ gl_Position = vec4(position, 0.0, 1.0);
5
+ }
6
+ `,t=`
7
+ precision mediump float;
8
+ void main() {
9
+ gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
10
+ }
11
+ `,n=p.createShader(p.VERTEX_SHADER),r=p.createShader(p.FRAGMENT_SHADER);if(!n||!r)throw new Error("Failed to create shaders");if(p.shaderSource(n,e),p.shaderSource(r,t),p.compileShader(n),!p.getShaderParameter(n,p.COMPILE_STATUS))throw new Error("Vertex shader compilation failed: "+p.getShaderInfoLog(n));if(p.compileShader(r),!p.getShaderParameter(r,p.COMPILE_STATUS))throw new Error("Fragment shader compilation failed: "+p.getShaderInfoLog(r));let o=p.createProgram();if(!o)throw new Error("Failed to create shader program");if(p.attachShader(o,n),p.attachShader(o,r),p.linkProgram(o),!p.getProgramParameter(o,p.LINK_STATUS))throw new Error("Shader program linking failed: "+p.getProgramInfoLog(o));p.useProgram(o);let i=137,s=new Float32Array(i*4),a=2*Math.PI/i;for(let h=0;h<i;h++){let E=h*a;s[h*4]=0,s[h*4+1]=0,s[h*4+2]=Math.cos(E)*(_.width/2),s[h*4+3]=Math.sin(E)*(_.height/2)}let c=p.createBuffer();p.bindBuffer(p.ARRAY_BUFFER,c),p.bufferData(p.ARRAY_BUFFER,s,p.STATIC_DRAW);let m=p.getAttribLocation(o,"position");p.enableVertexAttribArray(m),p.vertexAttribPointer(m,2,p.FLOAT,!1,0,0),p.viewport(0,0,_.width,_.height),p.clearColor(0,0,0,1),p.clear(p.COLOR_BUFFER_BIT),p.drawArrays(p.LINES,0,i*2);let u=new Uint8ClampedArray(_.width*_.height*4);return p.readPixels(0,0,_.width,_.height,p.RGBA,p.UNSIGNED_BYTE,u),new ImageData(u,_.width,_.height)}catch{return new ImageData(1,1)}finally{p&&(p.bindBuffer(p.ARRAY_BUFFER,null),p.useProgram(null),p.viewport(0,0,p.drawingBufferWidth,p.drawingBufferHeight),p.clearColor(0,0,0,0))}}function N(e){let t=[];return function n(r){if(r&&r.toJSON&&typeof r.toJSON=="function"&&(r=r.toJSON()),r===void 0)return;if(typeof r=="number")return isFinite(r)?""+r:"null";if(typeof r!="object")return JSON.stringify(r);let o,i;if(Array.isArray(r)){for(i="[",o=0;o<r.length;o++)o&&(i+=","),i+=n(r[o])||"null";return i+"]"}if(r===null)return"null";if(t.indexOf(r)!==-1)throw new TypeError("Converting circular structure to JSON");let s=t.push(r)-1,a=Object.keys(r).sort();for(i="",o=0;o<a.length;o++){let c=a[o],m=n(r[c]);m&&(i&&(i+=","),i+=JSON.stringify(c)+":"+m)}return t.splice(s,1),"{"+i+"}"}(e)||""}async function Je(){return new Promise(e=>{try{let t=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection;if(!t){e({supported:!1,error:"WebRTC not supported"});return}let n={iceCandidatePoolSize:1,iceServers:[]},r=new t(n);r.createDataChannel(""),(async()=>{try{let i={offerToReceiveAudio:!0,offerToReceiveVideo:!0},s=await r.createOffer(i);await r.setLocalDescription(s);let a=s.sdp||"",c=[...new Set((a.match(/extmap:\d+ [^\n\r]+/g)||[]).map(f=>f.replace(/extmap:\d+ /,"")))].sort(),m=f=>{let I=a.match(new RegExp(`m=${f} [^\\s]+ [^\\s]+ ([^\\n\\r]+)`));return I?I[1].split(" "):[]},u=(f,I)=>I.map(g=>{let A=new RegExp(`(rtpmap|fmtp|rtcp-fb):${g} (.+)`,"g"),k=[...a.matchAll(A)];if(!k.length)return null;let w={};return k.forEach(De=>{let[so,Se,_e]=De,Pe=_e.split("/");Se==="rtpmap"?(w.mimeType=`${f}/${Pe[0]}`,w.clockRate=+Pe[1],f==="audio"&&(w.channels=+Pe[2]||1)):Se==="rtcp-fb"?(w.feedbackSupport=w.feedbackSupport||[],w.feedbackSupport.push(_e)):Se==="fmtp"&&(w.sdpFmtpLine=_e)}),w}).filter(Boolean),l=u("audio",m("audio")),h=u("video",m("video")),E={audio:{count:l.length,hash:D(N(l))},video:{count:h.length,hash:D(N(h))},extensionsHash:D(N(c))},y=await new Promise(f=>{let I=setTimeout(()=>{r.removeEventListener("icecandidate",g),r.close(),f({supported:!0,...E,timeout:!0})},3e3),g=A=>{let k=A.candidate;!k||!k.candidate||(clearTimeout(I),r.removeEventListener("icecandidate",g),r.close(),f({supported:!0,...E,candidateType:k.type||""}))};r.addEventListener("icecandidate",g)});e({details:y,hash:D(N(y))})}catch(i){r.close(),e({supported:!0,error:`WebRTC offer failed: ${i.message}`})}})()}catch(t){e({supported:!1,error:`WebRTC error: ${t.message}`})}})}var kt=["\u{1D504}","\u{1D505}","\u212D","\u{1D507}","\u{1D508}","\u{1D509}","\u{1D538}","\u{1D539}","\u2102","\u{1D53B}","\u{1D53C}","\u{1D53D}"],xt=["\u03B2","\u03C8","\u03BB","\u03B5","\u03B6","\u03B1","\u03BE","\u03BC","\u03C1","\u03C6","\u03BA","\u03C4","\u03B7","\u03C3","\u03B9","\u03C9","\u03B3","\u03BD","\u03C7","\u03B4","\u03B8","\u03C0","\u03C5","\u03BF"];async function Xe(){return new Promise(e=>{try{le(async({iframe:t})=>{try{if(!_r(t)){e({supported:!1,error:"MathML not supported"});return}let n=[ee("integral","<msubsup><mo>\u222B</mo><mi>a</mi><mi>b</mi></msubsup><mfrac><mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow><mrow><mi>g</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mfrac><mi>dx</mi>"),ee("fraction","<mfrac><mrow><mi>\u03C0</mi><mo>\xD7</mo><msup><mi>r</mi><mn>2</mn></msup></mrow><mrow><mn>2</mn><mi>\u03C3</mi></mrow></mfrac>"),ee("matrix","<mo>[</mo><mtable><mtr><mtd><mi>\u03B1</mi></mtd><mtd><mi>\u03B2</mi></mtd></mtr><mtr><mtd><mi>\u03B3</mi></mtd><mtd><mi>\u03B4</mi></mtd></mtr></mtable><mo>]</mo>"),Pr(),...kr()],r=[],o="";n.forEach((s,a)=>{let c=xr(s,t);r.push({width:c.dimensions.width,height:c.dimensions.height}),a===0&&c.fontInfo&&(o=D(N(c.fontInfo)))});let i={fontStyleHash:o,dimensions:r};e({details:i,hash:D(N(i))})}catch(n){e({supported:!1,error:`MathML error: ${n.message}`})}})}catch(t){e({supported:!1,error:`MathML error: ${t.message}`})}})}function _r(e){try{let t=e.createElement("math");t.innerHTML="<mrow><mi>x</mi></mrow>",t.style.position="absolute",t.style.visibility="hidden",e.body.appendChild(t);let n=t.getBoundingClientRect();return e.body.removeChild(t),n.width>0&&n.height>0}catch{return!1}}function ee(e,t){return`<math><mrow>${t}</mrow></math>`}function Pr(){let e="<mo>\u220F</mo>";return kt.forEach((t,n)=>{let r=n*2,o=xt.slice(r,r+2);o.length===2&&(e+=`<mmultiscripts><mi>${t}</mi><none/><mi>${o[1]}</mi><mprescripts></mprescripts><mi>${o[0]}</mi><none/></mmultiscripts>`)}),ee("complex_nested",`<munderover><mmultiscripts>${e}</mmultiscripts></munderover>`)}function kr(){let e=[];return kt.forEach((t,n)=>{let r=n*2,o=xt.slice(r,r+2);o.length===2&&e.push(ee("combined",`<mmultiscripts><mi>${t}</mi><none/><mi>${o[1]}</mi><mprescripts></mprescripts><mi>${o[0]}</mi><none/></mmultiscripts>`))}),e}function xr(e,t){try{let n=t.createElement("math");n.innerHTML=e.replace(/<\/?math>/g,""),n.style.whiteSpace="nowrap",n.style.position="absolute",n.style.visibility="hidden",n.style.top="-9999px",t.body.appendChild(n);let r=n.getBoundingClientRect(),i=(t.defaultView||window).getComputedStyle(n),s={dimensions:{width:r.width,height:r.height},fontInfo:{fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontStyle:i.fontStyle,lineHeight:i.lineHeight,fontVariant:i.fontVariant||"normal",fontStretch:i.fontStretch||"normal",fontSizeAdjust:i.fontSizeAdjust||"none",textRendering:i.textRendering||"auto",fontFeatureSettings:i.fontFeatureSettings||"normal",fontVariantNumeric:i.fontVariantNumeric||"normal",fontKerning:i.fontKerning||"auto"}};return t.body.removeChild(n),s}catch(n){return{error:n.message}}}var Nr=800;async function Ze(){return new Promise(e=>{try{if(typeof window>"u"||!window.speechSynthesis||typeof window.speechSynthesis.getVoices!="function"){e({supported:!1,error:"Speech Synthesis API not supported"});return}let t=!1,n=null,r=s=>{if(!t){t=!0,n&&clearTimeout(n);try{let a=s.map(m=>{let u=h=>h.replace(/\\/g,"\\\\").replace(/,/g,"\\,");return[u(m.voiceURI||""),u(m.name||""),u(m.lang||""),m.localService?"1":"0",m.default?"1":"0"].join(",")});a.sort();let c={voiceCount:s.length,voicesHash:D(N(a))};e({details:c,hash:D(N(c))})}catch(a){e({supported:!0,error:`Voice processing failed: ${a.message}`})}}},o=window.speechSynthesis.getVoices();if(o.length>0){r(o);return}n=setTimeout(()=>{let s=window.speechSynthesis.getVoices();r(s)},Nr);let i=()=>{window.speechSynthesis.removeEventListener("voiceschanged",i);let s=window.speechSynthesis.getVoices();r(s)};window.speechSynthesis.addEventListener("voiceschanged",i)}catch(t){e({supported:!1,error:`Speech Synthesis error: ${t.message}`})}})}var Nt={audio:Be,canvas:qe,fonts:Ke,hardware:Ge,locales:Ve,math:je,permissions:Qe,plugins:We,screen:$e,system:ze,webgl:Ye},Mt={webrtc:Je,mathml:Xe,speech:Ze},He={},Lt={timeout:"true"},et=(e,t,n)=>{He[e]=t};function Mr(e,t){return new Promise(n=>{setTimeout(()=>n(t),e)})}function Ct(e,t,n){return Promise.all(e.map(r=>{let o=performance.now();return Promise.race([r.then(i=>({value:i,elapsed:performance.now()-o})),Mr(t,n).then(i=>({value:i,elapsed:performance.now()-o}))])}))}function fe(e,t){let n=W();if(n.name==="unknown"&&e.system&&typeof e.system=="object"&&!Array.isArray(e.system)){let l=e.system.browser;if(l&&typeof l=="object"&&!Array.isArray(l)){let h=l;n={name:h.name||"unknown",version:h.version||"unknown"}}}let r=n.name.toLowerCase(),o=n.version.split(".")[0]||"0",i=parseInt(o,10),s=[...t?.exclude||[]],a=t?.stabilize||[],c=t?.include||[];for(let u of a){let l=Ue[u];if(l)for(let h of l){let E=!("browsers"in h),y=!E&&h.browsers?.some(f=>{let I=f.match(/(.+?)(>=)(\d+)/);if(I){let[,g,,A]=I,k=parseInt(A,10);return r===g&&i>=k}return r===f});(E||y)&&s.push(...h.exclude)}}function m(u,l=""){let h={};for(let[E,y]of Object.entries(u)){let f=l?`${l}.${E}`:E;if(typeof y=="object"&&!Array.isArray(y)&&y!==null){let I=m(y,f);Object.keys(I).length>0&&(h[E]=I)}else{let I=s.some(A=>f.startsWith(A)),g=c.some(A=>f.startsWith(A));(!I||g)&&(h[E]=y)}}return h}return m(e)}async function tt(e){let t={...Q,...e},n=t.logging&&!sessionStorage.getItem("_tmjs_l")&&Math.random()<1e-4,r={...Nt,...He},{elapsed:o,resolvedComponents:i}=await Ft(r,t),s={},a={};if(n||t.experimental){let{elapsed:I,resolvedComponents:g}=await Ft(Mt,t);s=g,a=I}let c={...o,...a},m=t.performance?{elapsed:c}:{},u=fe({},t),l={...i,...u},h={};return{thumbmark:D(N(l)),components:l,info:h,version:"",...m,...Object.keys(s).length>0&&t.experimental&&{experimental:s}}}async function Ft(e,t){let n={...Q,...t},r=Object.entries(e).filter(([u])=>!n?.exclude?.includes(u)).filter(([u])=>n?.include?.some(l=>l.includes("."))?n?.include?.some(l=>l.startsWith(u)):n?.include?.length===0||n?.include?.includes(u)),o=r.map(([u])=>u),i=r.map(([u,l])=>l(t)),s=await Ct(i,n?.timeout||5e3,Lt),a={},c={};s.forEach((u,l)=>{u.value!=null&&(c[o[l]]=u.value,a[o[l]]=u.elapsed??0)});let m=fe(c,n);return{elapsed:a,resolvedComponents:m}}var te=class{options;constructor(t){this.options={...Q,...t}}async get(t){let n={...this.options,...t};return tt(n)}getVersion(){return""}includeComponent(t,n){et(t,n)}};var Lr=(e,t={})=>({"Content-Type":"application/json",...e?.accessToken&&{Authorization:`Bearer ${e?.accessToken}`},...t}),Cr=async(e,t)=>{if(!e.ok){let n=await e.text();throw new Error(n)}return t==="file"?e.blob():t==="json"?e.json():t==="text"?e.text():null},Ut=async({url:e,auth:t,body:n,method:r="GET",headers:o={},responseType:i="json"})=>{let s={method:r,headers:Lr(t,o),...n?{body:n instanceof FormData?n:JSON.stringify(n)}:{}},a=await fetch(e,s);return Cr(a,i)},nt=e=>Ut({...e,method:"GET"}),he=e=>Ut({...e,method:"POST"});function Bt(e){let t=e?.qbc||!1,n=e?.mas||!1,r=e?.apd||!1,o=e?.scb||null,i=0,s=()=>{t=!1,n=!1,r=!1,o=void 0,i=0},a=()=>{let l=window?.getSelection()?.toString();l&&l.length>0&&(i=Date.now(),t=!0)},c=u=>{let l=u.clipboardData?.getData("text"),h=u.target instanceof HTMLInputElement||u.target instanceof HTMLTextAreaElement;l&&h&&(r=!0)},m=()=>{n=!0;let u=Date.now();if(i){let l=(u-i)/1e3;(o===void 0||l<o)&&(o=l)}};return document?.addEventListener("copy",a),document?.addEventListener("paste",c),window?.addEventListener("blur",m),{get qbc(){return t},get mas(){return n},get apd(){return r},get scb(){return o},reset:s,destroy(){document?.removeEventListener("copy",a),document?.removeEventListener("paste",c),window?.removeEventListener("blur",m)}}}var q=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var K=typeof window>"u"||"Deno"in globalThis;function M(){}function Gt(e,t){return typeof e=="function"?e(t):e}function Vt(e){return typeof e=="number"&&e>=0&&e!==1/0}function jt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ot(e,t){return typeof e=="function"?e(t):e}function Qt(e,t){return typeof e=="function"?e(t):e}function it(e,t){let{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ne(s,t.options))return!1}else if(!z(t.queryKey,s))return!1}if(n!=="all"){let c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function st(e,t){let{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if($(t.options.mutationKey)!==$(i))return!1}else if(!z(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ne(e,t){return(t?.queryKeyHashFn||$)(e)}function $(e){return JSON.stringify(e,(t,n)=>rt(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function z(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!z(e[n],t[n])):!1}function Wt(e,t){if(e===t)return e;let n=qt(e)&&qt(t);if(n||rt(e)&&rt(t)){let r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},c=0;for(let m=0;m<s;m++){let u=n?m:i[m];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,c++):(a[u]=Wt(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function qt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function rt(e){if(!Kt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Kt(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Kt(e){return Object.prototype.toString.call(e)==="[object Object]"}function $t(e){return new Promise(t=>{setTimeout(t,e)})}function zt(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Wt(e,t):t}function Yt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Jt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var re=Symbol();function pe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===re?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Fr=class extends q{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!K&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ge=new Fr;var Ur=class extends q{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!K&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Y=new Ur;function Xt(){let e,t,n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function Br(e){return Math.min(1e3*2**e,3e4)}function at(e){return(e??"online")==="online"?Y.isOnline():!0}var Zt=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ye(e){return e instanceof Zt}function Ee(e){let t=!1,n=0,r=!1,o,i=Xt(),s=f=>{r||(h(new Zt(f)),e.abort?.())},a=()=>{t=!0},c=()=>{t=!1},m=()=>ge.isFocused()&&(e.networkMode==="always"||Y.isOnline())&&e.canRun(),u=()=>at(e.networkMode)&&e.canRun(),l=f=>{r||(r=!0,e.onSuccess?.(f),o?.(),i.resolve(f))},h=f=>{r||(r=!0,e.onError?.(f),o?.(),i.reject(f))},E=()=>new Promise(f=>{o=I=>{(r||m())&&f(I)},e.onPause?.()}).then(()=>{o=void 0,r||e.onContinue?.()}),y=()=>{if(r)return;let f,I=n===0?e.initialPromise:void 0;try{f=I??e.fn()}catch(g){f=Promise.reject(g)}Promise.resolve(f).then(l).catch(g=>{if(r)return;let A=e.retry??(K?0:3),k=e.retryDelay??Br,w=typeof k=="function"?k(n,g):k,De=A===!0||typeof A=="number"&&n<A||typeof A=="function"&&A(n,g);if(t||!De){h(g);return}n++,e.onFail?.(n,g),$t(w).then(()=>m()?void 0:E()).then(()=>{t?h(g):y()})})};return{promise:i,cancel:s,continue:()=>(o?.(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?y():E().then(y),i)}}function qr(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0),i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{let a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var b=qr();var Ie=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vt(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(K?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}};var Ht=class extends Ie{#e;#t;#n;#r;#s;#i;constructor(e){super(),this.#i=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Gr(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){let n=zt(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(M).catch(M):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Qt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===re||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!jt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#i?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){let a=this.observers.find(c=>c.options.queryFn);a&&this.setOptions(a.options)}let n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},o=()=>{let a=pe(this.options,t),c={queryKey:this.queryKey,meta:this.meta};return r(c),this.#i=!1,this.options.persister?this.options.persister(a,c,this):a(c)},i={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};r(i),this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#o({type:"fetch",meta:i.fetchOptions?.meta});let s=a=>{ye(a)&&a.silent||this.#o({type:"error",error:a}),ye(a)||(this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this)),this.scheduleGc()};return this.#r=Ee({initialPromise:t?.initialPromise,fn:i.fetchFn,abort:n.abort.bind(n),onSuccess:a=>{if(a===void 0){s(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(a)}catch(c){s(c);return}this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),this.scheduleGc()},onError:s,onFail:(a,c)=>{this.#o({type:"failed",failureCount:a,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}),this.#r.start()}#o(e){let t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Kr(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let r=e.error;return ye(r)&&r.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),b.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Kr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:at(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Gr(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var oe=class extends q{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,o=t.queryHash??ne(r,t),i=this.get(o);return i||(i=new Ht({cache:this,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){b.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(n=>it(t,n))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(n=>it(e,n)):t}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){b.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){b.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};var en=class extends Ie{#e;#t;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#t=e.mutationCache,this.#e=[],this.state=e.state||Vr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(r,o)=>{this.#r({type:"failed",failureCount:r,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});let t=this.state.status==="pending",n=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:n}),await this.#t.config.onMutate?.(e,this);let o=await this.options.onMutate?.(e);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:n})}let r=await this.#n.start();return await this.#t.config.onSuccess?.(r,e,this.state.context,this),await this.options.onSuccess?.(r,e,this.state.context),await this.#t.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,e,this.state.context),this.#r({type:"success",data:r}),r}catch(r){try{throw await this.#t.config.onError?.(r,e,this.state.context,this),await this.options.onError?.(r,e,this.state.context),await this.#t.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,r,e,this.state.context),r}finally{this.#r({type:"error",error:r})}}finally{this.#t.runNext(this)}}#r(e){let t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),b.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(e)}),this.#t.notify({mutation:this,type:"updated",action:e})})}};function Vr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ie=class extends q{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new en({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=we(e);if(typeof t=="string"){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){let t=we(e);if(typeof t=="string"){let n=this.#t.get(t);if(n)if(n.length>1){let r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=we(e);if(typeof t=="string"){let r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){let t=we(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){b.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(n=>st(t,n))}findAll(e={}){return this.getAll().filter(t=>st(e,t))}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(t=>t.state.isPaused);return b.batch(()=>Promise.all(e.map(t=>t.continue().catch(M))))}};function we(e){return e.options.scope?.id}function ct(e){return{onFetch:(t,n)=>{let r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},c=0,m=async()=>{let u=!1,l=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=pe(t.options,t.fetchOptions),E=async(y,f,I)=>{if(u)return Promise.reject();if(f==null&&y.pages.length)return Promise.resolve(y);let g={queryKey:t.queryKey,pageParam:f,direction:I?"backward":"forward",meta:t.options.meta};l(g);let A=await h(g),{maxPages:k}=t.options,w=I?Jt:Yt;return{pages:w(y.pages,A,k),pageParams:w(y.pageParams,f,k)}};if(o&&i.length){let y=o==="backward",f=y?jr:tn,I={pages:i,pageParams:s},g=f(r,I);a=await E(I,g,y)}else{let y=e??i.length;do{let f=c===0?s[0]??r.initialPageParam:tn(r,a);if(c>0&&f==null)break;a=await E(a,f),c++}while(c<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=m}}}function tn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function jr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ut=class{#e;#t;#n;#r;#s;#i;#o;#a;constructor(e={}){this.#e=e.queryCache||new oe,this.#t=e.mutationCache||new ie,this.#n=e.defaultOptions||{},this.#r=new Map,this.#s=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ot(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{let r=n.data;return[t,r]})}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,s=Gt(t,i);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return b.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;b.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){let n=this.#e,r={type:"active",...e};return b.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=b.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(M).catch(M)}invalidateQueries(e,t={}){return b.batch(()=>{if(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none")return Promise.resolve();let n={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=b.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(M)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(M)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ot(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(M).catch(M)}fetchInfiniteQuery(e){return e.behavior=ct(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(M).catch(M)}ensureInfiniteQueryData(e){return e.behavior=ct(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Y.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set($(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(r=>{z(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set($(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#s.values()],n={};return t.forEach(r=>{z(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ne(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===re&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var Qr=new ut({defaultOptions:{queries:{staleTime:3e4}},queryCache:new oe({onError:(e,t)=>{}}),mutationCache:new ie}),nn=Qr;var Wr=[{name:"lowCpuCores",weight:1,async check(){let e=navigator.hardwareConcurrency||0,t=e>0&&e<=2;return{value:e,triggered:t}}},{name:"lowDeviceMemory",weight:1,async check(){let e=navigator.deviceMemory||0,t=e>0&&e<=4;return{value:e,triggered:t}}},{name:"platformMismatch",weight:1,async check(){let e=navigator.userAgent||"",t=navigator.platform||"",n=e.includes("Mac")&&t.includes("Linux")||e.includes("Win")&&t.includes("Mac")||t===""||t==="Unknown";return{value:t,triggered:n}}},{name:"webglSoftwareRenderer",weight:2,async check(){let e=null,t=null,n=!1;try{let r=document.createElement("canvas"),o=r.getContext("webgl")||r.getContext("experimental-webgl");if(o){let i=o.getExtension("WEBGL_debug_renderer_info");if(i){e=o.getParameter(i.UNMASKED_VENDOR_WEBGL)||"",t=o.getParameter(i.UNMASKED_RENDERER_WEBGL)||"";let s=t.toLowerCase(),a=e.toLowerCase();n=s.includes("swiftshader")||s.includes("llvmpipe")||s.includes("softwar")||s.includes("basic render")||s.includes("vmware")||s.includes("virtualbox")||a.includes("vmware")||a.includes("parallels")}}}catch{}return{value:{vendor:e,renderer:t},triggered:n}}},{name:"missingWebGPUAdapter",weight:2,async check(){if(!("gpu"in navigator))return{value:"no WebGPU",triggered:!0};try{let e=await navigator.gpu.requestAdapter();return{value:e?"adapter-present":"adapter-null",triggered:!e}}catch{return{value:"adapter-error",triggered:!0}}}},{name:"reducedTimerPrecision",weight:1,async check(){let e=performance.now();await new Promise(r=>setTimeout(r,50));let t=performance.now()-e,n=t<30||t>80;return{value:t.toFixed(2),triggered:n}}},{name:"timerJitter",weight:1,async check(){let e=[];for(let r=0;r<10;r++){let o=performance.now();await new Promise(s=>setTimeout(s,10));let i=performance.now();e.push(i-o)}let t=Math.sqrt(e.map(r=>(r-10)**2).reduce((r,o)=>r+o)/e.length),n=t>5;return{value:t.toFixed(3),triggered:n}}},{name:"audioFingerprint",weight:1,async check(){try{let e=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,44100,44100),t=e.createOscillator();t.frequency.value=440,t.connect(e.destination),t.start(0);let r=(await e.startRendering()).getChannelData(0).reduce((i,s)=>i+Math.abs(s),0),o=r<100;return{value:r,triggered:o}}catch{return{value:"audio-error",triggered:!0}}}},{name:"canvasEntropy",weight:1,async check(){try{let e=document.createElement("canvas"),t=e.getContext("2d");t.textBaseline="top",t.font="14px 'Arial'",t.fillText("VM CHECK",2,2);let r=[...e.toDataURL()].reduce((i,s)=>(i+s.charCodeAt(0))%9999999,0);return{value:r,triggered:r===0||r===999999}}catch{return{value:"canvas-error",triggered:!0}}}},{name:"windowSizeWeird",weight:1,async check(){let e=window.innerWidth/window.innerHeight,t=e===1.333||e===1.6;return{value:e.toFixed(2),triggered:t}}},{name:"touchMismatch",weight:1,async check(){let e="ontouchstart"in window,t=navigator.maxTouchPoints||0;return{value:{hasTouch:e,maxTouch:t},triggered:e&&t===0}}},{name:"batteryVirtualized",weight:1,async check(){if(!navigator.getBattery)return{value:"no API",triggered:!0};try{let e=await navigator.getBattery(),t=e.chargingTime===0&&e.dischargingTime===1/0;return{value:{chargingTime:e.chargingTime,dischargingTime:e.dischargingTime},triggered:t}}catch{return{value:"battery-error",triggered:!0}}}},{name:"permissionsWeird",weight:1,async check(){try{let e=await navigator.permissions.query({name:"camera"}),t=e.state==="prompt";return{value:e.state,triggered:t}}catch{return{value:"perm-error",triggered:!0}}}},{name:"noMediaDevices",weight:1,async check(){try{let e=await navigator.mediaDevices.enumerateDevices(),t=e.length===0;return{value:e.length,triggered:t}}catch{return{value:"media-error",triggered:!0}}}},{name:"virtualizedMediaDevices",weight:1,async check(){try{let e=await navigator.mediaDevices.enumerateDevices(),t=e.some(n=>n.label.toLowerCase().includes("virtual"));return{value:e.map(n=>n.label),triggered:t}}catch{return{value:"media-error",triggered:!0}}}},{name:"webrtcIpPattern",weight:2,async check(){return new Promise(e=>{let t=new RTCPeerConnection({iceServers:[]});t.createDataChannel("x"),t.onicecandidate=n=>{if(!n||!n.candidate){e({value:"no candidate",triggered:!0});return}let r=n.candidate.candidate.toLowerCase(),o=r.includes("10.0.2.")||r.includes("172.16.")||r.includes("192.168.56.");e({value:r,triggered:o})},t.createOffer().then(n=>t.setLocalDescription(n))})}},{name:"gpuAccelerationDisabled",weight:2,async check(){let t=document.createElement("canvas").getContext("webgl");return{value:!!t,triggered:!t}}},{name:"noWebGL2",weight:1,async check(){let e=document.createElement("canvas").getContext("webgl2");return{value:!!e,triggered:!e}}},{name:"lowStorageQuota",weight:1,async check(){try{let e=await navigator.storage.estimate(),t=e.quota<500*1024*1024;return{value:e.quota,triggered:t}}catch{return{value:"storage-error",triggered:!0}}}},{name:"lowEntropy",weight:1,async check(){let e=Object.keys(navigator).length+Object.keys(screen).length+Object.keys(window).length,t=e<200;return{value:e,triggered:t}}},{name:"noLanguages",weight:1,async check(){let e=navigator.languages||[];return{value:e,triggered:e.length===0}}},{name:"uaEntropyLow",weight:1,async check(){let e=navigator.userAgent,t=e.length<30;return{value:e,triggered:t}}},{name:"weirdDPI",weight:1,async check(){let e=window.devicePixelRatio;return{value:e,triggered:e===1}}}];async function rn({threshold:e=6}={}){let t={},n=0;for(let r of Wr){let o=await r.check();t[r.name]=o,o.triggered&&(n+=r.weight)}return{isLikelyVM:n>=e,score:n,threshold:e,signals:t}}var $r=[{name:"hookedFunctionToString",weight:2,async check(){let e=Function.prototype.toString.toString(),t=Function.prototype.toString+"";return{value:{native:e,current:t},triggered:e!==t}}},{name:"navigatorProxyTrap",weight:2,async check(){let e=!1;try{let t=Object.getOwnPropertyDescriptor(window,"navigator");t&&t.get&&t.get.toString()?.includes("[native code]")===!1&&(e=!0)}catch{}return{value:"navigator getter",triggered:e}}},{name:"uaMismatch",weight:2,async check(){let e=navigator.userAgent||"",t="";try{let r=await navigator.userAgentData?.getHighEntropyValues?.(["platform","brands"]);t=JSON.stringify(r)}catch{}let n=e?.includes("Mac")&&t?.includes("Windows")||e?.includes("Win")&&t?.includes("Mac")||t&&t.length>0&&!e;return{value:{ua:e,brandInfo:t},triggered:n}}},{name:"timezoneLocaleMismatch",weight:1,async check(){let e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=navigator.language||"",n=t.startsWith("en")&&e==="Asia/Shanghai"||t.startsWith("zh")&&e==="America/New_York"||e===void 0;return{value:{tz:e,lang:t},triggered:n}}},{name:"canvasNoise",weight:2,async check(){let e=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return i.textBaseline="top",i.font="14px Arial",i.fillText("anti-detect-check",2,2),o.toDataURL()},t=e(),n=e();return{value:{a:t,b:n},triggered:t!==n}}},{name:"webglNoise",weight:2,async check(){try{let t=document.createElement("canvas").getContext("webgl");if(!t)return{value:"no-webgl",triggered:!0};let n=t.getExtension("WEBGL_debug_renderer_info");if(!n)return{value:"no-debug-extension",triggered:!1};let r=t.getParameter(n.UNMASKED_VENDOR_WEBGL),o=t.getParameter(n.UNMASKED_RENDERER_WEBGL),i=r===""||o===""||r?.includes(" ")===!1||o?.includes(" ")===!1;return{value:{v:r,r:o},triggered:i}}catch{return{value:"gl-error",triggered:!0}}}},{name:"webdriverFlag",weight:3,async check(){let e=navigator.webdriver===!0;return{value:navigator.webdriver,triggered:e}}},{name:"perfectEventTiming",weight:1,async check(){let e=performance.now();return{value:e,triggered:e%1===0}}},{name:"serviceWorkerBlocked",weight:1,async check(){let e=!("serviceWorker"in navigator);return{value:e,triggered:e}}},{name:"smallQuota",weight:2,async check(){try{let e=await navigator.storage.estimate(),t=e.quota<50*1024*1024;return{value:e.quota,triggered:t}}catch{return{value:"quota-error",triggered:!0}}}},{name:"indexedDbBlocked",weight:2,async check(){try{let e=indexedDB.open("tamper-check");return await new Promise(t=>{e.onerror=()=>t({value:"error",triggered:!0}),e.onsuccess=()=>t({value:"ok",triggered:!1})})}catch{return{value:"throw",triggered:!0}}}},{name:"screenDprMismatch",weight:1,async check(){let e=window.screen.width,t=window.screen.height,n=window.devicePixelRatio,r=e===1920&&n===1&&t===1080||n%1!==0&&n%1!==.5;return{value:{w:e,h:t,dpr:n},triggered:r}}},{name:"missingCommonFonts",weight:1,async check(){return{value:"skipped",triggered:!1}}},{name:"noMediaDevices",weight:1,async check(){try{let e=await navigator.mediaDevices.enumerateDevices();return{value:e.length,triggered:e.length===0}}catch{return{value:"error",triggered:!0}}}},{name:"languagesEmpty",weight:1,async check(){let e=navigator.languages||[];return{value:e,triggered:e.length===0}}},{name:"pluginMismatch",weight:1,async check(){try{let e=navigator.plugins.length;return{value:e,triggered:e===0}}catch{return{value:"error",triggered:!0}}}},{name:"devtoolsDetected",weight:2,async check(){return new Promise(async e=>{let t={viewportBreakpoint:!1,debuggerLatency:!1,consoleSpeed:!1},n=160,r=window.outerWidth-window.innerWidth,o=window.outerHeight-window.innerHeight;(r>n||o>n)&&(t.viewportBreakpoint=!0);function i(c=200){let m=performance.now();debugger;return performance.now()-m>c}t.debuggerLatency=i();async function s(c=50){return new Promise(m=>{let u=performance.now();console.log("%c ","font-size:3000px");let l=performance.now();m(l-u>c)})}t.consoleSpeed=await s();let a=Object.values(t).some(Boolean);setTimeout(()=>{e({value:a,triggered:a})},50)})}},{name:"knownAntiDetectBrowser",weight:5,async check(){let e=navigator.userAgent.toLowerCase(),n=["incogniton","multilogin","morelogin","adspect","kameleo","goLogin"].some(r=>e?.includes(r));return{value:e,triggered:n}}}];async function on({threshold:e=5}={}){let t={},n=0;for(let o of $r){let i=await o.check();t[o.name]=i,i.triggered&&(n+=o.weight)}let r=Math.min(1,n/15);return{result:r>=.5||t.knownAntiDetectBrowser?.triggered,anomalyScore:r,antiDetectBrowser:t.knownAntiDetectBrowser?.triggered||!1,signals:t}}function zr(){let e=0;try{0 .toFixed(-1)}catch(t){e=t.message.length}return e}function Yr(){let e=navigator.userAgent,t=zr();return t===44||t===43?"Safari":t===51?"Chrome":t===25?"Firefox":navigator.msSaveBlob!==void 0?"MSIE":e.match(/Chrome/)?navigator.brave!==void 0?"Brave":e.includes("Edg")?"Edge":e.includes("OPR")?"Opera":"Chrome":"Unknown"}var Jr=[{name:"safari_currentStorageTest",weight:2,browser:"Safari",async check(){if(typeof navigator.storage?.getDirectory!="function")return{triggered:!1,value:"unsupported"};try{return await navigator.storage.getDirectory(),{triggered:!1,value:"ok"}}catch(e){let t=e?.message??String(e);return{triggered:t.includes("unknown transient reason"),value:t}}}},{name:"safari13to18_indexedDbBlobTest",weight:2,browser:"Safari",async check(){return await new Promise(e=>{let t=String(Math.random()),n=indexedDB.open(t,1);n.onupgradeneeded=r=>{let o=r.target.result;try{o.createObjectStore("t",{autoIncrement:!0}).put(new Blob),e({triggered:!1,value:"ok"})}catch(i){let s=i?.message??String(i);e({triggered:s.includes("are not yet supported"),value:s})}finally{o.close(),indexedDB.deleteDatabase(t)}},n.onerror=()=>e({triggered:!1,value:"idb-error"})})}},{name:"safari_oldWebkitTest",weight:1,browser:"Safari",async check(){let e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null)}catch{return{triggered:!0,value:"openDatabase denied"}}try{t.setItem("test","1"),t.removeItem("test")}catch{return{triggered:!0,value:"localStorage denied"}}return{triggered:!1,value:"ok"}}},{name:"chrome_storageQuotaPrivateTest",weight:2,browser:"Chrome",async check(){return await new Promise((e,t)=>{let r=window?.performance?.memory?.jsHeapSizeLimit??1073741824;navigator.webkitTemporaryStorage.queryUsageAndQuota((o,i)=>{let s=Math.round(i/1048576),a=Math.round(r/(1024*1024))*2;e({triggered:s<a,value:{quotaMB:s,limitMB:a}})},o=>t(o))})}},{name:"chrome_oldFileSystemTest",weight:1,browser:"Chrome",async check(){let e=window.webkitRequestFileSystem;return e?await new Promise(t=>e(0,1,()=>t({triggered:!1,value:"ok"}),()=>t({triggered:!0,value:"denied"}))):{triggered:!1,value:"unsupported"}}},{name:"firefox_storageDirectoryTest",weight:2,browser:"Firefox",async check(){if(typeof navigator.storage?.getDirectory!="function")return{triggered:!1,value:"unsupported"};try{return await navigator.storage.getDirectory(),{triggered:!1,value:"ok"}}catch(e){let t=e?.message??String(e);return{triggered:t.includes("Security error"),value:t}}}},{name:"firefox_indexedDbInvalidStateTest",weight:1,browser:"Firefox",async check(){return await new Promise(e=>{let t=indexedDB.open("inPrivate");t.onerror=()=>{e({triggered:t.error?.name==="InvalidStateError",value:t.error?.name})},t.onsuccess=()=>{indexedDB.deleteDatabase("inPrivate"),e({triggered:!1,value:"ok"})}})}},{name:"msie_indexedDbMissing",weight:2,browser:"MSIE",async check(){return{triggered:window.indexedDB===void 0,value:"msie-idb-check"}}}];async function sn(){let e=Yr(),t={},n=0;for(let r of Jr){if(r.browser!==e)continue;let o=await r.check();t[r.name]=o,o.triggered&&(n+=r.weight)}return{isPrivate:n>0,browserName:e,score:n,signals:t}}typeof window<"u"&&(window.detectIncognito=sn);var an=sn;var cn="dtect_security_sdk_state",un=typeof window<"u",ln={isLoading:!1,token:"",visitorId:"",projectId:"",questionData:null,clientData:null,aiCheckData:null,tokens:null},Re={state:{...ln},securityKeys:{behaviorKey:"",automationKey:"",dtectSignalEnabled:!1,dtectAutomationSignalEnabled:!1}};function mn(){if(!un)return Re;try{let e=sessionStorage.getItem(cn);if(!e)return Re;let t=JSON.parse(e);return t.expiresAt&&t.expiresAt<Date.now()?Re:{state:{...ln,...t.state},securityKeys:t.securityKeys||{behaviorKey:"",automationKey:"",dtectSignalEnabled:!1,dtectAutomationSignalEnabled:!1}}}catch{return Re}}function G(e){if(un)try{let t=Date.now()+864e5,n={...e,expiresAt:t};sessionStorage.setItem(cn,JSON.stringify(n))}catch{}}function dn(e){return e.token||X()}async function P(e,t="info",n={}){let r=`${n.endpoint??"https://api.dtect.io/security"}/log`,o={message:e,type:t,payload:n};navigator.sendBeacon(r,JSON.stringify(o))}var ve,v="https://api.dtect.io/security",be=`${v}/client/check`,T="",V="",fn="0.0.20";var Xr="20000000-aaaa-bbbb-cccc-000000000002",Te;var{state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}}=mn(),Zr=Ot,se;async function Hr({clientId:e,apiKey:t,endpoint:n}){if(Ae({automationKey:C,behaviorKey:U,dtectAutomationSignalEnabled:x}))return{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x};let r=await nn.fetchQuery({queryKey:["getClientConfig",e,t],queryFn:()=>nt({url:`${n}/client/config`,headers:{"client-id":T,"x-api-key":V}})});if(!Ae(r))throw new Error("Missing keys from get client config");return C=r.automationKey,U=r.behaviorKey,B=r.dtectSignalEnabled,x=r.dtectAutomationSignalEnabled,G({state:d,securityKeys:r}),r}function pt(e){if(e instanceof Error){if(e?.message?.includes("maintenance_mode"))throw new Error(R.MAINTENANCE_MODE);if(e?.message?.includes("rate-limited"))throw new Error(R.RATE_LIMIT_REACHED);switch(e?.message){case j.ERROR_RATE_LIMIT:throw new Error(R.RATE_LIMIT_REACHED);default:throw new Error(R.INTERNAL_SERVER_ERROR)}}throw new Error(R.FAILED_TO_GET_SECURITY_TOKEN)}function J(){if(gn(d)&&Ae({automationKey:C,behaviorKey:U,dtectAutomationSignalEnabled:x}))return!0;let e=Oe(),t=document.querySelector("#dtect-h-captcha");return!!ve&&!!(!x&&t||e||x)}function hn(){return!!(T&&V)}function eo(){return new Promise(e=>{let t=()=>{window?.hcaptcha?e():requestAnimationFrame(t)};t()})}var Oe=()=>window?.location?.href?.includes("localhost")||window?.location?.href?.includes("file:///");async function to({behaviorKey:e,dtectAutomationSignalEnabled:t=!1}){if(ve=await j.load({apiKey:e,endpoint:["https://fp.dtect.io",j.defaultEndpoint],scriptUrlPattern:["https://fp.dtect.io/web/v<version>/<apiKey>/loader_v<loaderVersion>.js",j.defaultScriptUrlPattern]}),!Oe()&&!t&&(await eo(),await window.hcaptcha.render("dtect-h-captcha",{sitekey:C,size:"invisible"})),!ve)throw new Error(R.SDK_INIT_ERROR)}async function no(){let e=performance.now();if(d.tokens){let c=(performance.now()-e).toFixed();return P(`getTokens finishes in ${c}ms`,"info",{function:"getTokens",endpoint:v,diff:c,token:d.token,clientId:T}),d.tokens}let t=new Promise(a=>{let c=ve?.get();a(c)}),n=new Promise(async a=>{Oe()&&a({response:Xr});let m=await window?.hcaptcha?.execute({async:!0});a(m)}),[r,o]=await Promise.all([x?{response:""}:n,t]);d.tokens={behaviorRequestId:o?.requestId,behaviorToken:o?.sealedResult,automationToken:r?.response};let s=(performance.now()-e).toFixed();return P(`getTokens finishes in ${s}ms`,"info",{function:"getTokens",endpoint:v,diff:s,token:d.token,clientId:T}),d.tokens}function ro(e){let t=e?.projectId,n=e?.visitorId||X();return(typeof e?.projectId=="number"||typeof e?.visitorId=="number")&&(t=`${e?.projectId}`,n=`${e?.visitorId}`),{visitorId:n,projectId:t}}function gt(e){if(d.projectId&&d.visitorId)return{visitorId:d.visitorId,projectId:d.projectId};let{projectId:t,visitorId:n}=ro(e);return{projectId:t,visitorId:n}}async function pn(e,t){let n=performance.now();if(!J())throw new Error(R.NOT_INITIALIZED);if(!hn())throw new Error(R.MISSING_CREDENTIALS);let{projectId:r,visitorId:o}=gt(e);if(d.projectId=r,d.visitorId=o,!e||!r?.trim())throw new Error(R.FAILED_TO_GET_SECURITY_RESULT);let i;try{let s=await no();if(B){let a=new te,[c,m,u,l]=await Promise.allSettled([a.get(),rn(),on(),an()]);i={deviceRes:c,vmDtectResults:m,tamperingDtectResults:u,incognitoDtectResults:l}}if(s?.behaviorToken&&s?.behaviorRequestId&&(x||!x&&s?.automationToken)){let a={behaviorToken:s.behaviorToken,automationToken:s.automationToken,behaviorRequestId:s.behaviorRequestId,entryLink:window?.location?.href,securitySettings:e.securitySettings,metaData:e.metaData,...B?{vmDtectResults:i?.vmDtectResults?.value,tamperingDtectResults:i?.tamperingDtectResults?.value,incognitoDtectResults:i?.incognitoDtectResults?.value,deviceIdResults:i?.deviceRes?.value}:{}};d.clientData=a;let c={...e,projectId:r,visitorId:o,clientData:a,version:"0.0.20",token:d.token,questionData:d.questionData,aiCheckData:d.aiCheckData},m=await he({url:`${t}`,body:{...c},headers:{"client-id":T,"x-api-key":V}});if("token"in m||"results"in m){G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}});let l=(performance.now()-n).toFixed();return P(`getResultBase finishes in ${l}ms`,"info",{function:"getResultBase",endpoint:v,diff:l,token:d.token,clientId:T}),m}}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(s){let c=(performance.now()-n).toFixed();if(P("getResultBase error","error",{function:"getResultBase",endpoint:v,error:s,diff:c,token:d.token,clientId:T}),s instanceof Error){if(s?.message?.includes("maintenance_mode"))throw new Error(R.MAINTENANCE_MODE);if(s?.message?.includes("rate-limited")||s?.message?.includes("429"))throw new Error(R.RATE_LIMIT_REACHED);switch(s?.message){case j.ERROR_RATE_LIMIT:throw new Error(R.RATE_LIMIT_REACHED);default:throw new Error(R.INTERNAL_SERVER_ERROR)}}throw new Error(R.FAILED_TO_GET_SECURITY_RESULT)}}async function lt(e){return await pn(e,`${v}/client/check/result`)}async function mt(e){return await pn(e,`${v}/client/check`)}async function dt(e){let t=performance.now();if(!J())throw new Error(R.NOT_INITIALIZED);let{respondentType:n,language:r}=e;try{let o=await nt({url:`${v}/client/quality-questions/${n}/${r}`,headers:{"client-id":T,"x-api-key":V}});if(o){let s=(performance.now()-t).toFixed();return P(`getQualityQuestions finishes in ${s}ms`,"info",{function:"getQualityQuestions",endpoint:v,diff:s,token:d.token,clientId:T}),o}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-t).toFixed();P("getQualityQuestions error","error",{endpoint:v,error:o,diff:s,token:d.token,clientId:T}),pt(o)}}async function ft(e){let t=performance.now();if(!J())throw new Error(R.NOT_INITIALIZED);d.questionData||(d.questionData={questions:e.questions});let{visitorId:n,projectId:r}=gt(e);d.visitorId=n,d.projectId=r;try{let o=await he({url:be,headers:{"client-id":T,"x-api-key":V},body:{token:d.token,visitorId:n,projectId:r,version:fn,questionData:d.questionData,aiCheckData:d.aiCheckData,clientData:d.clientData}});if(o){G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}});let s=(performance.now()-t).toFixed();return P(`checkQualityQuestions finishes in ${s}ms`,"info",{function:"checkQualityQuestions",endpoint:v,diff:s,token:d.token,clientId:T}),o}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-t).toFixed();P("checkQualityQuestions error","error",{endpoint:v,error:o,diff:s,token:d.token,clientId:T}),pt(o)}}async function ht(e){let t=performance.now();if(!J())throw new Error(R.NOT_INITIALIZED);d.aiCheckData={timeTakenSeconds:e.timeTakenSeconds,qbc:e.qbc||se.qbc,mas:e.mas||se.mas,scb:e.scb||se.scb,apd:e.apd||se.apd};let{visitorId:n,projectId:r}=gt(e);d.visitorId=n,d.projectId=r;try{let o=await he({url:be,headers:{"client-id":T,"x-api-key":V},body:{token:d.token,visitorId:n,projectId:r,version:fn,clientData:d.clientData,questionData:d.questionData,aiCheckData:d.aiCheckData}});if(o){G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}});let s=(performance.now()-t).toFixed();return P(`isAIUsageDetected finishes in ${s}ms`,"info",{function:"isAIUsageDetected",endpoint:v,diff:s,token:d.token,clientId:T}),o}throw new Error(R.INTERNAL_SERVER_ERROR)}catch(o){let s=(performance.now()-t).toFixed();P("isAIUsageDetected error","error",{endpoint:v,error:o,diff:s,token:d.token,clientId:T}),pt(o)}}function oo(){let e=performance.now(),t=document.querySelector("head"),n=document.querySelector("body");if(!Oe()){n?.insertAdjacentHTML("beforeend",'<div id="dtect-h-captcha" ></div>');let o=document.createElement("script");o.setAttribute("src","https://js.hcaptcha.com/1/api.js"),o.setAttribute("async","true"),o.setAttribute("defer","true"),t?.append(o);let s=(performance.now()-e).toFixed()}}function Ae(e){return(e.dtectAutomationSignalEnabled||e?.automationKey)&&e?.behaviorKey}function gn(e){let t=e.tokens;return!!(t&&t.behaviorToken&&t.behaviorRequestId&&t.automationToken)}async function io(e){let t=performance.now();if(!e?.clientId||!e?.apiKey)throw P(R.MISSING_CREDENTIALS,"error",{endpoint:v,...e}),new Error(R.MISSING_CREDENTIALS);let{clientId:n,apiKey:r,endpoint:o="https://api.dtect.io/security",includeResults:i}=e;v=o,be=`${v}/client/check`;let s=dn(d);if(d.isLoading){if(J())return Te;throw P(R.DUPLICATE_INITIALIZATION,"error",{endpoint:v,clientId:n,apiKey:r,token:d.token}),new Error(R.DUPLICATE_INITIALIZATION)}if(se=Bt(d.aiCheckData),T=n,V=r,i&&(be=`${v}/client/check/result`),d={...d,isLoading:!0,token:s||""},gn(d)&&Ae({automationKey:C,behaviorKey:U,dtectAutomationSignalEnabled:x}))return d={...d,isLoading:!1,token:s},G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}}),{getSecurityResult:lt,getSecurityToken:mt,isAIUsageDetected:ht,checkQualityQuestions:ft,getQualityQuestions:dt,LanguageCodes:Z,QualityQuestionsRespondentTypes:H};if(!hn())throw P(R.MISSING_CREDENTIALS,"error",{endpoint:v,...e}),new Error(R.MISSING_CREDENTIALS);if(J())return Te;try{let c=await Hr({clientId:n,apiKey:r,endpoint:o});return c.dtectAutomationSignalEnabled||oo(),to({behaviorKey:c.behaviorKey,dtectAutomationSignalEnabled:c.dtectAutomationSignalEnabled}).then(()=>{let u=(performance.now()-t).toFixed();return P(`init() finishes ${u}ms`,"info",{endpoint:v,function:"init",diff:u,token:d.token,clientId:T}),{getSecurityResult:lt,getSecurityToken:mt,SecurityAPIError:Zr,isAIUsageDetected:ht,checkQualityQuestions:ft,getQualityQuestions:dt,LanguageCodes:Z,QualityQuestionsRespondentTypes:H}}).catch(m=>{throw new Error(m.message)})}catch(c){if(c instanceof Error){if(P(c.message,"error",{function:"init",endpoint:v,error:c,token:d.token,clientId:T}),c?.message?.includes("maintenance_mode"))throw new Error(R.MAINTENANCE_MODE);if([R.INVALID_API_KEY,R.UNAUTHORIZED].includes(c?.message))throw new Error(R.INVALID_CREDENTIALS)}throw new Error(R.SDK_INIT_ERROR)}finally{d={...d,isLoading:!1,token:s},G({state:d,securityKeys:{automationKey:C,behaviorKey:U,dtectSignalEnabled:B,dtectAutomationSignalEnabled:x}})}}Te={init:io,getSecurityResult:lt,getSecurityToken:mt,isAIUsageDetected:ht,checkQualityQuestions:ft,getQualityQuestions:dt,QualityQuestionsRespondentTypes:H,LanguageCodes:Z};var Wa=Te;export{Z as LanguageCodes,H as QualityQuestionsRespondentTypes,Zr as SecurityAPIError,ft as checkQualityQuestions,Wa as default,dt as getQualityQuestions,lt as getSecurityResult,mt as getSecurityToken,io as init,ht as isAIUsageDetected};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtect/security-sdk-js",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",