@ginger-ai/ginger-react 0.0.3

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.
Files changed (37) hide show
  1. package/dist/client/index.d.ts +16 -0
  2. package/dist/client/index.d.ts.map +1 -0
  3. package/dist/constants.d.ts +5 -0
  4. package/dist/constants.d.ts.map +1 -0
  5. package/dist/contexts/index.d.ts +3 -0
  6. package/dist/contexts/index.d.ts.map +1 -0
  7. package/dist/helper.d.ts +4 -0
  8. package/dist/helper.d.ts.map +1 -0
  9. package/dist/hooks/index.d.ts +3 -0
  10. package/dist/hooks/index.d.ts.map +1 -0
  11. package/dist/hooks/useEvent/computeFieldMetrics.d.ts +9 -0
  12. package/dist/hooks/useEvent/computeFieldMetrics.d.ts.map +1 -0
  13. package/dist/hooks/useEvent/fieldUpdater.d.ts +15 -0
  14. package/dist/hooks/useEvent/fieldUpdater.d.ts.map +1 -0
  15. package/dist/hooks/useEvent/helper.d.ts +5 -0
  16. package/dist/hooks/useEvent/helper.d.ts.map +1 -0
  17. package/dist/hooks/useEvent/index.d.ts +12 -0
  18. package/dist/hooks/useEvent/index.d.ts.map +1 -0
  19. package/dist/hooks/useEvent/submit.d.ts +10 -0
  20. package/dist/hooks/useEvent/submit.d.ts.map +1 -0
  21. package/dist/hooks/useGinger.d.ts +6 -0
  22. package/dist/hooks/useGinger.d.ts.map +1 -0
  23. package/dist/http/index.d.ts +19 -0
  24. package/dist/http/index.d.ts.map +1 -0
  25. package/dist/http/request.d.ts +9 -0
  26. package/dist/http/request.d.ts.map +1 -0
  27. package/dist/index.cjs.js +558 -0
  28. package/dist/index.cjs.js.map +1 -0
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.esm.js +554 -0
  32. package/dist/index.esm.js.map +1 -0
  33. package/dist/provider/index.d.ts +4 -0
  34. package/dist/provider/index.d.ts.map +1 -0
  35. package/dist/types.d.ts +101 -0
  36. package/dist/types.d.ts.map +1 -0
  37. package/package.json +47 -0
@@ -0,0 +1,554 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext, useRef, useEffect, useCallback, useState } from 'react';
3
+
4
+ const GingerClientContext = createContext(undefined);
5
+
6
+ const GingerReactProvider = ({ children, config, }) => {
7
+ if (!config.apikey) {
8
+ throw new Error("Missing 'apikey' in GingerReactProvider configuration");
9
+ }
10
+ return (jsx(GingerClientContext.Provider, { value: { config }, children: children }));
11
+ };
12
+
13
+ const computeFieldInputMetrics = ({ id, e, currentField, focusInputFields, }) => {
14
+ const inputEvent = e.nativeEvent;
15
+ const now = performance.now();
16
+ const lastKeyStrokeTime = currentField.ended_at;
17
+ // Detection Methods
18
+ const isCorrected = isCorrectionAction(inputEvent.inputType);
19
+ const isPaste = isPasteAction(inputEvent.inputType);
20
+ const isAutoFill = isAutoFillAction(e, currentField);
21
+ const isPause = isPauseAction(now, lastKeyStrokeTime);
22
+ const focusTime = focusInputFields?.[id];
23
+ // Update variables
24
+ const started_at = currentField.started_at || now;
25
+ const paste_count = currentField.paste_count + (isPaste ? 1 : 0);
26
+ const autofill_count = currentField.autofill_count + (isAutoFill ? 1 : 0);
27
+ const pauses = currentField.pauses + (isPause ? 1 : 0);
28
+ const corrections_count = currentField.corrections_count + (isCorrected ? 1 : 0);
29
+ const interaction_count = currentField.interaction_count + 1;
30
+ const characters_count = e.target.value.length;
31
+ const pause_durations = calculatePauseDurations(currentField, isPause, now);
32
+ const hesitation_time = calculateHesitationTime(started_at, focusTime);
33
+ return {
34
+ ...currentField,
35
+ field_name: id,
36
+ started_at,
37
+ ended_at: now,
38
+ interaction_count,
39
+ characters_count,
40
+ paste_count,
41
+ autofill_count,
42
+ corrections_count,
43
+ pauses,
44
+ hesitation_time,
45
+ pause_durations,
46
+ };
47
+ };
48
+ const calculatePauseDurations = (currentField, isPause, now) => {
49
+ if (!isPause)
50
+ return currentField.pause_durations;
51
+ const duration = now - currentField.ended_at;
52
+ const pauseDurations = [...currentField.pause_durations, duration];
53
+ return pauseDurations;
54
+ };
55
+ const isCorrectionAction = (inputType) => inputType == "deleteContentBackward" ||
56
+ inputType == "deleteContentForward" ||
57
+ inputType == "deleteSoftLineBackward";
58
+ const isPasteAction = (inputType) => inputType == "insertFromPaste" || inputType == "insertFromDrop";
59
+ const isPauseAction = (now, lastKeystrokeTime, waitTime = 2500) => {
60
+ const timeSinceLastStroke = now - lastKeystrokeTime;
61
+ return lastKeystrokeTime !== 0 && timeSinceLastStroke > waitTime;
62
+ };
63
+ const isAutoFillAction = (e, currentField) => {
64
+ const inputEvent = e.nativeEvent;
65
+ const isPaste = isPasteAction(inputEvent.inputType);
66
+ const isRedo = isRedoAction(inputEvent.inputType);
67
+ const isUndo = isUndoAction(inputEvent.inputType);
68
+ if (isPaste || isRedo || isUndo || inputEvent.isComposing) {
69
+ return false;
70
+ }
71
+ const prevCharacterCount = currentField.characters_count;
72
+ const currentCharacterCount = e.target.value.length;
73
+ const difference = currentCharacterCount - prevCharacterCount;
74
+ return difference > 1;
75
+ };
76
+ const isRedoAction = (inputType) => inputType === "historyRedo";
77
+ const isUndoAction = (inputType) => inputType === "historyUndo";
78
+ const calculateHesitationTime = (typeStartTime, focusTime) => {
79
+ if (!focusTime)
80
+ return 0;
81
+ const hesitationTime = typeStartTime - focusTime;
82
+ return hesitationTime;
83
+ };
84
+
85
+ const e=()=>{const e=Date.now(),t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".slice(0,34);return `${e}.${n(e,t)}`};function t(e,t){if(0===e)return "00000000";let n="";for(;e>0;){n=t[e%34]+n,e=Math.floor(e/34);}for(;n.length<8;)n="0"+n;return n.slice(-8)}const n=(e,i,o=1)=>{if(o>3)return t(e,i);const r=0x4bf63f8c5b100,a=function(e,t){let n=0;for(let i of e){let e=t.indexOf(i.toUpperCase());if(-1===e)throw new Error("Invalid base-34 character");n=34*n+e;}return n}(t((e+function(e){const t=e;return Math.floor(Math.random()*t)}(r))%r,i),i);return n(a,i,o+1)};class o extends Error{constructor(e){super(e),this.name="GingerClientError";}}const r=["mobile","desktop","tablet"];var a;!function(e){e.typed="typed",e.paste="pasted",e.mixed="mixed";}(a||(a={}));const u=()=>{let e=0;const t=()=>{"hidden"===document.visibilityState&&e++;};return {getCount:()=>e,addListener:()=>document.addEventListener("visibilitychange",t),removeListener:()=>document.removeEventListener("visibilitychange",t)}};var m;!function(e){e.POST="POST";}(m||(m={}));let f={exclude:[],include:[],logging:true};const w={},p=(e,t)=>{"undefined"!=typeof window&&(w[e]=t);},g={timeout:"true"};function b(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),(e^=e>>>16)>>>0}const v=new Uint32Array([597399067,2869860233,951274213,2716044179]);function y(e,t){return e<<t|e>>>32-t}function k(e,t=0){var n;if(t=t?0|t:0,"string"==typeof e&&(n=e,e=(new TextEncoder).encode(n).buffer),!(e instanceof ArrayBuffer))throw new TypeError("Expected key to be ArrayBuffer or string");const i=new Uint32Array([t,t,t,t]);!function(e,t){const n=e.byteLength/16|0,i=new Uint32Array(e,0,4*n);for(let e=0;e<n;e++){const n=i.subarray(4*e,4*(e+1));n[0]=Math.imul(n[0],v[0]),n[0]=y(n[0],15),n[0]=Math.imul(n[0],v[1]),t[0]=t[0]^n[0],t[0]=y(t[0],19),t[0]=t[0]+t[1],t[0]=Math.imul(t[0],5)+1444728091,n[1]=Math.imul(n[1],v[1]),n[1]=y(n[1],16),n[1]=Math.imul(n[1],v[2]),t[1]=t[1]^n[1],t[1]=y(t[1],17),t[1]=t[1]+t[2],t[1]=Math.imul(t[1],5)+197830471,n[2]=Math.imul(n[2],v[2]),n[2]=y(n[2],17),n[2]=Math.imul(n[2],v[3]),t[2]=t[2]^n[2],t[2]=y(t[2],15),t[2]=t[2]+t[3],t[2]=Math.imul(t[2],5)+2530024501,n[3]=Math.imul(n[3],v[3]),n[3]=y(n[3],18),n[3]=Math.imul(n[3],v[0]),t[3]=t[3]^n[3],t[3]=y(t[3],13),t[3]=t[3]+t[0],t[3]=Math.imul(t[3],5)+850148119;}}(e,i),function(e,t){const n=e.byteLength/16|0,i=e.byteLength%16,o=new Uint32Array(4),r=new Uint8Array(e,16*n,i);switch(i){case 15:o[3]=o[3]^r[14]<<16;break;case 14:o[3]=o[3]^r[13]<<8;break;case 13:o[3]=o[3]^(0|r[12]),o[3]=Math.imul(o[3],v[3]),o[3]=y(o[3],18),o[3]=Math.imul(o[3],v[0]),t[3]=t[3]^o[3];break;case 12:o[2]=o[2]^r[11]<<24;break;case 11:o[2]=o[2]^r[10]<<16;break;case 10:o[2]=o[2]^r[9]<<8;break;case 9:o[2]=o[2]^(0|r[8]),o[2]=Math.imul(o[2],v[2]),o[2]=y(o[2],17),o[2]=Math.imul(o[2],v[3]),t[2]=t[2]^o[2];break;case 8:o[1]=o[1]^r[7]<<24;break;case 7:o[1]=o[1]^r[6]<<16;break;case 6:o[1]=o[1]^r[5]<<8;break;case 5:o[1]=o[1]^(0|r[4]),o[1]=Math.imul(o[1],v[1]),o[1]=y(o[1],16),o[1]=Math.imul(o[1],v[2]),t[1]=t[1]^o[1];break;case 4:o[0]=o[0]^r[3]<<24;break;case 3:o[0]=o[0]^r[2]<<16;break;case 2:o[0]=o[0]^r[1]<<8;break;case 1:o[0]=o[0]^(0|r[0]),o[0]=Math.imul(o[0],v[0]),o[0]=y(o[0],15),o[0]=Math.imul(o[0],v[1]),t[0]=t[0]^o[0];}}(e,i),function(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]=b(t[0]),t[1]=b(t[1]),t[2]=b(t[2]),t[3]=b(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;}(e,i);const o=new Uint8Array(i.buffer);return Array.from(o).map(e=>e.toString(16).padStart(2,"0")).join("")}async function x(){try{const e=Object.fromEntries(Object.entries(w).filter(([e])=>!f?.exclude?.includes(e)).filter(([e])=>f?.include?.some(e=>e.includes("."))?f?.include?.some(t=>t.startsWith(e)):0===f?.include?.length||f?.include?.includes(e)).map(([e,t])=>[e,t()])),t=Object.keys(e),n=Object.values(e),i=await function(e,t,n){return Promise.all(e.map(e=>{return Promise.race([e,(i=t,o=n,new Promise(e=>{setTimeout(()=>e(o),i);}))]);var i,o;}))}(n,f?.timeout||1e3,g),o={};return i.forEach((e,n)=>{void 0!==e&&(o[t[n]]=e);}),S(o,f.exclude||[],f.include||[],"")}catch(e){throw e}}function S(e,t,n,i=""){const o={};for(const[r,a]of Object.entries(e)){const e=i+r+".";if("object"!=typeof a||Array.isArray(a)){const i=t.some(t=>e.startsWith(t)),s=n.some(t=>e.startsWith(t));i&&!s||(o[r]=a);}else {const i=S(a,t,n,e);Object.keys(i).length>0&&(o[r]=i);}}return o}async function L(){try{const e=await x(),t=E(e),n=k(JSON.stringify(t)),i=function(e){const t=E(e);return Object.keys(t)}(t);return {hash:n.toString(),data:e,componentsUsedForHash:i}}catch(e){throw e}}function E(e){return {audio:e.audio,fonts:e.fonts,hardware:e.hardware,math:e.math,permissions:e.permissions,screen:e.screen,system:e.system,emojiFingerprint:e.emojiFingerprint,vendorFlavour:e.vendorFlavour,colorGamut:e.colorGamut,canvas:e.canvas,webglBasics:e.webGlBasics}}async function _(){let e=0;"Atlantic/Reykjavik"===Intl.DateTimeFormat().resolvedOptions().timeZone&&e++;const t=C();return ["Mozilla","unknown"].includes(t.vendor)&&e++,window.RTCPeerConnection||e++,navigator.deviceMemory||e++,2===navigator.hardwareConcurrency&&e++,navigator.credentials||e++,navigator.geolocation||e++,{status:e>=6,confidence:`${(e/7).toFixed(2)}`}}const C=()=>{try{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return {vendor:"unsupported",renderer:"unsupported"};const n=t.getExtension("WEBGL_debug_renderer_info");return n?{vendor:t.getParameter(n.UNMASKED_VENDOR_WEBGL),renderer:t.getParameter(n.UNMASKED_RENDERER_WEBGL)}:{vendor:"unknown",renderer:"unknown"}}catch{return {vendor:"error",renderer:"error"}}};async function A(){return new Promise(function(e,t){let n="unknown";function i(t){e({status:t,browser_name:n});}function o(){let e=0,t=parseInt("-1");try{t.toFixed(t);}catch(t){e=t.message.length;}return e}function r(){return void 0!==navigator.msSaveBlob&&39===eval.toString().length}function a(){const e=String(Math.random());try{window.indexedDB.open(e,1).onupgradeneeded=function(t){const n=t.target?.result;try{n.createObjectStore("test",{autoIncrement:!0}).put(new Blob);}catch(e){let t=e;if(e instanceof Error&&(t=e.message??e),"string"!=typeof t)return void i(!1);t.includes("BlobURLs are not yet supported")&&i(!0);}finally{n.close(),window.indexedDB.deleteDatabase(e),navigator.storage?.estimate?navigator.storage.estimate().then(({quota:e})=>{i(!!(e&&e<2e9));}).catch(()=>{i(!1);}):i(!1);}};}catch(e){i(false);}}function s(){ void 0!==navigator.maxTouchPoints?a():function(){const e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null);}catch(e){return void i(true)}try{t.setItem("test","1"),t.removeItem("test");}catch(e){return void i(true)}i(false);}();}function c(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(e,t){i(Math.round(t/1048576)<2*Math.round(function(){const e=window;return void 0!==e.performance&&void 0!==e.performance.memory&&void 0!==e.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824}()/1048576));},function(e){t(new Error("detectIncognito somehow failed to query storage quota: "+e.message));});}function d(){ void 0!==self.Promise&&void 0!==self.Promise.allSettled?c():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}44===o()?(n="Safari",s()):51===o()?(n=function(){const e=navigator.userAgent;return e.match(/Chrome/)?void 0!==navigator.brave?"Brave":e.match(/Edg/)?"Edge":e.match(/OPR/)?"Opera":"Chrome":"Chromium"}(),d()):25===o()?(n="Firefox",i(void 0===navigator.serviceWorker)):r()?(n="Internet Explorer",i(void 0===window.indexedDB)):t(new Error("detectIncognito cannot determine the browser"));})}var P=function(e,t){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);},P(e,t)};function V(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e));}catch(e){r(e);}}function s(e){try{c(i.throw(e));}catch(e){r(e);}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t);})).then(a,s);}c((i=i.apply(e,[])).next());})}function I(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r);}catch(e){s=[6,e],i=0;}finally{n=o=0;}if(5&s[0])throw s[1];return {value:s[0]?s[1]:void 0,done:true}}([s,c])}}}function M(e,t,n){if(2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var R="awesomium",F="cef",W="cefsharp",T="coachjs",j="electron",O="fminer",G="geb",D="nightmarejs",B="phantomas",N="phantomjs",Z="rhino",H="selenium",z="sequentum",Y="slimerjs",X="webdriverio",U="webdriver",J="headless_chrome",q="unknown",K=function(e){function t(n,i){var o=e.call(this,i)||this;return o.state=n,o.name="BotdError",Object.setPrototypeOf(o,t.prototype),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e;}P(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n);}(t,e),t}(Error);function $(e){return V(this,void 0,void 0,function(){var t,n,i=this;return I(this,function(o){switch(o.label){case 0:return t={},n=Object.keys(e),[4,Promise.all(n.map(function(n){return V(i,void 0,void 0,function(){var i,o,r,a,s;return I(this,function(c){switch(c.label){case 0:i=e[n],c.label=1;case 1:return c.trys.push([1,3,,4]),o=t,r=n,s={},[4,i()];case 2:return o[r]=(s.value=c.sent(),s.state=0,s),[3,4];case 3:return a=c.sent(),t[n]=a instanceof K?{state:a.state,error:"".concat(a.name,": ").concat(a.message)}:{state:-3,error:a instanceof Error?"".concat(a.name,": ").concat(a.message):String(a)},[3,4];case 4:return [2]}})})}))];case 1:return o.sent(),[2,t]}})})}function Q(e,t){return -1!==e.indexOf(t)}function ee(e,t){return -1!==e.indexOf(t)}function te(e){return Object.getOwnPropertyNames(e)}function ne(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var i=function(t){if("string"==typeof t){if(Q(e,t))return {value:true}}else if(null!=function(e,t){if("find"in e)return e.find(t);for(var n=0;n<e.length;n++)if(t(e[n],n,e))return e[n]}(e,function(e){return t.test(e)}))return {value:true}},o=0,r=t;o<r.length;o++){var a=i(r[o]);if("object"==typeof a)return a.value}return false}function ie(e){return e.reduce(function(e,t){return e+(t?1:0)},0)}var oe={detectAppVersion:function(e){var t=e.appVersion;return 0===t.state&&(/headless/i.test(t.value)?J:/electron/i.test(t.value)?j:/slimerjs/i.test(t.value)?Y:void 0)},detectDocumentAttributes:function(e){var t=e.documentElementKeys;return 0===t.state&&(ne(t.value,"selenium","webdriver","driver")?H:void 0)},detectErrorTrace:function(e){var t=e.errorTrace;return 0===t.state&&(/PhantomJS/i.test(t.value)?N:void 0)},detectEvalLengthInconsistency:function(e){var t=e.evalLength,n=e.browserKind,i=e.browserEngineKind;if(0===t.state&&0===n.state&&0===i.state){var o=t.value;return "unknown"!==i.value&&(37===o&&!Q(["webkit","gecko"],i.value)||39===o&&!Q(["internet_explorer"],n.value)||33===o&&!Q(["chromium"],i.value))}},detectFunctionBind:function(e){if(-2===e.functionBind.state)return N},detectLanguagesLengthInconsistency:function(e){var t=e.languages;if(0===t.state&&0===t.value.length)return J},detectNotificationPermissions:function(e){var t=e.notificationPermissions,n=e.browserKind;return 0===n.state&&"chrome"===n.value&&(0===t.state&&t.value?J:void 0)},detectPluginsArray:function(e){var t=e.pluginsArray;if(0===t.state&&!t.value)return J},detectPluginsLengthInconsistency:function(e){var t=e.pluginsLength,n=e.android,i=e.browserKind,o=e.browserEngineKind;if(0===t.state&&0===n.state&&0===i.state&&0===o.state&&"chrome"===i.value&&!n.value&&"chromium"===o.value)return 0===t.value?J:void 0},detectProcess:function(e){var t,n=e.process;return 0===n.state&&("renderer"===n.value.type||null!=(null===(t=n.value.versions)||void 0===t?void 0:t.electron)?j:void 0)},detectUserAgent:function(e){var t=e.userAgent;return 0===t.state&&(/PhantomJS/i.test(t.value)?N:/Headless/i.test(t.value)?J:/Electron/i.test(t.value)?j:/slimerjs/i.test(t.value)?Y:void 0)},detectWebDriver:function(e){var t=e.webDriver;if(0===t.state&&t.value)return J},detectWebGL:function(e){var t=e.webGL;if(0===t.state){var n=t.value,i=n.vendor,o=n.renderer;if("Brian Paul"==i&&"Mesa OffScreen"==o)return J}},detectWindowExternal:function(e){var t=e.windowExternal;return 0===t.state&&(/Sequentum/i.test(t.value)?z:void 0)},detectWindowSize:function(e){var t=e.windowSize,n=e.documentFocus;if(0!==t.state||0!==n.state)return false;var i=t.value,o=i.outerWidth,r=i.outerHeight;return n.value&&0===o&&0===r?J:void 0},detectMimeTypesConsistent:function(e){var t=e.mimeTypesConsistent;if(0===t.state&&!t.value)return q},detectProductSub:function(e){var t=e.productSub,n=e.browserKind;return 0===t.state&&0===n.state&&("chrome"!==n.value&&"safari"!==n.value&&"opera"!==n.value&&"wechat"!==n.value||"20030107"===t.value?void 0:q)},detectDistinctiveProperties:function(e){var t=e.distinctiveProps;if(0!==t.state)return false;var n,i=t.value;for(n in i)if(i[n])return n}};function re(){var e,t,n=window,i=navigator;return ie(["webkitPersistentStorage"in i,"webkitTemporaryStorage"in i,0===i.vendor.indexOf("Google"),"webkitResolveLocalFileSystemURL"in n,"BatteryManager"in n,"webkitMediaStream"in n,"webkitSpeechGrammar"in n])>=5?"chromium":ie(["ApplePayError"in n,"CSSPrimitiveValue"in n,"Counter"in n,0===i.vendor.indexOf("Apple"),"getStorageUpdates"in i,"WebKitMediaKeys"in n])>=4?"webkit":ie(["buildID"in navigator,"MozAppearance"in(null!==(t=null===(e=document.documentElement)||void 0===e?void 0:e.style)&&void 0!==t?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4?"gecko":"unknown"}var ae={android:function(){var e=re(),t="chromium"===e,n="gecko"===e;if(!t&&!n)return false;var i=window;return ie(["onorientationchange"in i,"orientation"in i,t&&!("SharedWorker"in i),n&&/android/i.test(navigator.appVersion)])>=2},browserKind:function(){var e,t=null===(e=navigator.userAgent)||void 0===e?void 0:e.toLowerCase();return ee(t,"edg/")?"edge":ee(t,"trident")||ee(t,"msie")?"internet_explorer":ee(t,"wechat")?"wechat":ee(t,"firefox")?"firefox":ee(t,"opera")||ee(t,"opr")?"opera":ee(t,"chrome")?"chrome":ee(t,"safari")?"safari":"unknown"},browserEngineKind:re,documentFocus:function(){return void 0!==document.hasFocus&&document.hasFocus()},userAgent:function(){return navigator.userAgent},appVersion:function(){var e=navigator.appVersion;if(null==e)throw new K(-1,"navigator.appVersion is undefined");return e},rtt:function(){if(void 0===navigator.connection)throw new K(-1,"navigator.connection is undefined");if(void 0===navigator.connection.rtt)throw new K(-1,"navigator.connection.rtt is undefined");return navigator.connection.rtt},windowSize:function(){return {outerWidth:window.outerWidth,outerHeight:window.outerHeight,innerWidth:window.innerWidth,innerHeight:window.innerHeight}},pluginsLength:function(){if(void 0===navigator.plugins)throw new K(-1,"navigator.plugins is undefined");if(void 0===navigator.plugins.length)throw new K(-3,"navigator.plugins.length is undefined");return navigator.plugins.length},pluginsArray:function(){if(void 0===navigator.plugins)throw new K(-1,"navigator.plugins is undefined");if(void 0===window.PluginArray)throw new K(-1,"window.PluginArray is undefined");return navigator.plugins instanceof PluginArray},errorTrace:function(){try{null[0]();}catch(e){if(e instanceof Error&&null!=e.stack)return e.stack.toString()}throw new K(-3,"errorTrace signal unexpected behaviour")},productSub:function(){var e=navigator.productSub;if(void 0===e)throw new K(-1,"navigator.productSub is undefined");return e},windowExternal:function(){if(void 0===window.external)throw new K(-1,"window.external is undefined");var e=window.external;if("function"!=typeof e.toString)throw new K(-2,"window.external.toString is not a function");return e.toString()},mimeTypesConsistent:function(){if(void 0===navigator.mimeTypes)throw new K(-1,"navigator.mimeTypes is undefined");for(var e=navigator.mimeTypes,t=Object.getPrototypeOf(e)===MimeTypeArray.prototype,n=0;n<e.length;n++)t&&(t=Object.getPrototypeOf(e[n])===MimeType.prototype);return t},evalLength:function(){return eval.toString().length},webGL:function(){var e=document.createElement("canvas");if("function"!=typeof e.getContext)throw new K(-2,"HTMLCanvasElement.getContext is not a function");var t=e.getContext("webgl");if(null===t)throw new K(-4,"WebGLRenderingContext is null");if("function"!=typeof t.getParameter)throw new K(-2,"WebGLRenderingContext.getParameter is not a function");return {vendor:t.getParameter(t.VENDOR),renderer:t.getParameter(t.RENDERER)}},webDriver:function(){if(null==navigator.webdriver)throw new K(-1,"navigator.webdriver is undefined");return navigator.webdriver},languages:function(){var e,t=navigator,n=[],i=t.language||t.userLanguage||t.browserLanguage||t.systemLanguage;if(void 0!==i&&n.push([i]),Array.isArray(t.languages))"chromium"===re()&&ie([!("MediaSettingsRange"in(e=window)),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3||n.push(t.languages);else if("string"==typeof t.languages){var o=t.languages;o&&n.push(o.split(","));}return n},notificationPermissions:function(){return V(this,void 0,void 0,function(){var e,t;return I(this,function(n){switch(n.label){case 0:if(void 0===window.Notification)throw new K(-1,"window.Notification is undefined");if(void 0===navigator.permissions)throw new K(-1,"navigator.permissions is undefined");if("function"!=typeof(e=navigator.permissions).query)throw new K(-2,"navigator.permissions.query is not a function");n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.query({name:"notifications"})];case 2:return t=n.sent(),[2,"denied"===window.Notification.permission&&"prompt"===t.state];case 3:throw n.sent(),new K(-3,"notificationPermissions signal unexpected behaviour");case 4:return [2]}})})},documentElementKeys:function(){if(void 0===document.documentElement)throw new K(-1,"document.documentElement is undefined");var e=document.documentElement;if("function"!=typeof e.getAttributeNames)throw new K(-2,"document.documentElement.getAttributeNames is not a function");return e.getAttributeNames()},functionBind:function(){if(void 0===Function.prototype.bind)throw new K(-2,"Function.prototype.bind is undefined");return Function.prototype.bind.toString()},process:function(){var e=window.process,t="window.process is";if(void 0===e)throw new K(-1,"".concat(t," undefined"));if(e&&"object"!=typeof e)throw new K(-3,"".concat(t," not an object"));return e},distinctiveProps:function(){var e,t,n=((e={})[R]={window:["awesomium"]},e[F]={window:["RunPerfTest"]},e[W]={window:["CefSharp"]},e[T]={window:["emit"]},e[O]={window:["fmget_targets"]},e[G]={window:["geb"]},e[D]={window:["__nightmare","nightmare"]},e[B]={window:["__phantomas"]},e[N]={window:["callPhantom","_phantom"]},e[Z]={window:["spawn"]},e[H]={window:["_Selenium_IDE_Recorder","_selenium","calledSelenium",/^([a-z]){3}_.*_(Array|Promise|Symbol)$/],document:["__selenium_evaluate","selenium-evaluate","__selenium_unwrapped"]},e[X]={window:["wdioElectron"]},e[U]={window:["webdriver","__webdriverFunc","__lastWatirAlert","__lastWatirConfirm","__lastWatirPrompt","_WEBDRIVER_ELEM_CACHE","ChromeDriverw"],document:["__webdriver_script_fn","__driver_evaluate","__webdriver_evaluate","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__fxdriver_unwrapped","__webdriver_script_fn","__webdriver_script_func","__webdriver_script_function","$cdc_asdjflasutopfhvcZLmcf","$cdc_asdjflasutopfhvcZLmcfl_","$chrome_asyncScriptInfo","__$webdriverAsyncExecutor"]},e[J]={window:["domAutomation","domAutomationController"]},e),i={},o=te(window),r=[];for(t in void 0!==window.document&&(r=te(window.document)),n){var a=n[t];if(void 0!==a){var s=void 0!==a.window&&ne.apply(void 0,M([o],a.window,false)),c=!(void 0===a.document||!r.length)&&ne.apply(void 0,M([r],a.document,false));i[t]=s||c;}}return i}},se=function(){function e(){this.components=void 0,this.detections=void 0;}return e.prototype.getComponents=function(){return this.components},e.prototype.getDetections=function(){return this.detections},e.prototype.detect=function(){if(void 0===this.components)throw new Error("BotDetector.detect can't be called before BotDetector.collect");var e=function(e,t){var n={},i={bot:false};for(var o in t){var r=(0, t[o])(e),a={bot:false};"string"==typeof r?a={bot:true,botKind:r}:r&&(a={bot:true,botKind:q}),n[o]=a,a.bot&&(i=a);}return [n,i]}(this.components,oe),t=e[0],n=e[1];return this.detections=t,n},e.prototype.collect=function(){return V(this,void 0,void 0,function(){var e;return I(this,function(t){switch(t.label){case 0:return e=this,[4,$(ae)];case 1:return e.components=t.sent(),[2,this.components]}})})},e}();function ce(e){var t=({}).monitoring,n=void 0===t||t;return V(this,void 0,void 0,function(){var e;return I(this,function(t){switch(t.label){case 0:return n&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/botd/v".concat("1.9.1","/npm-monitoring"),!0),e.send();}catch(e){console.error(e);}}(),[4,(e=new se).collect()];case 1:return t.sent(),[2,e]}})})}async function de(){try{const e=(await ce()).detect();return e.bot?{status:!0,botKind:e.botKind}:{status:!1}}catch(e){return console.error(e),null}}function ue(){return le().name}function le(){const e={name:"Unknown",version:"Unknown",confidence:0,engine:"Unknown"},t=[],n=navigator.userAgent.toLowerCase();-1===n.indexOf("edg/")&&-1===n.indexOf("edge/")||t.push({name:"Edge",confidence:75});if(function(e,t){44===t.toFixedErrorLength?e.push({name:"Safari",confidence:40}):51===t.toFixedErrorLength?e.push({name:"Chrome",confidence:30}):25===t.toFixedErrorLength&&e.push({name:"Firefox",confidence:30});t.functionToStringLength>30&&t.functionToStringLength<40?e.push({name:"Firefox",confidence:10}):t.functionToStringLength>40&&e.push({name:"Chrome",confidence:15});}(t,function(){let e=0;try{const e=parseInt("-1");e.toFixed(e);}catch(t){e=t.message.length;}let t=0;try{t=Function.prototype.toString.call(Function).length;}catch(e){}return {toFixedErrorLength:e,functionToStringLength:t}}()),function(e){navigator.brave&&"function"==typeof navigator.brave.isBrave&&e.push({name:"Brave",confidence:90});if(void 0!==window.chrome&&window.chrome.app&&window.chrome.runtime){const t=navigator.userAgent.toLowerCase();-1===t.indexOf("edg/")&&-1===t.indexOf("edge/")?void 0===navigator.brave&&e.push({name:"Chrome",confidence:40}):e.push({name:"Edge",confidence:40});}!(window.chrome&&window.chrome.csi&&window.chrome.loadTimes)||window.opr||window.opera||navigator.brave&&"function"==typeof navigator.brave.isBrave||e.push({name:"Chrome",confidence:60});void 0===window.InstallTrigger&&void 0===window.sidebar||e.push({name:"Firefox",confidence:70});(/constructor/i.test(window.HTMLElement)||"[object SafariRemoteNotification]"===(!(void 0===window.safari)&&window.safari.pushNotification).toString())&&e.push({name:"Safari",confidence:70});(window.msCredentials||document.documentMode)&&e.push({name:"Edge",confidence:60});(window.opr||window.opera)&&e.push({name:"Opera",confidence:60});}(t),function(e){if("function"==typeof navigator.registerProtocolHandler)try{if("chrome"in window){const t=navigator.userAgent.toLowerCase();-1===t.indexOf("edg/")&&-1===t.indexOf("edge/")&&e.push({name:"Chrome",confidence:25});}("ms-access"in navigator||"ms-browser-extension"in navigator||"ms-calculator"in navigator||"ms-drive-to"in navigator||"ms-excel"in navigator||"ms-gamebarservices"in navigator||"ms-search"in navigator||"ms-word"in navigator)&&e.push({name:"Edge",confidence:80}),("opr:"in navigator.plugins||"opera:"in navigator.plugins)&&e.push({name:"Opera",confidence:25});}catch(e){}}(t),function(e){const t=window.getComputedStyle(document.documentElement);""===t.getPropertyValue("--apple-trailing-word")&&""===t.getPropertyValue("-webkit-app-region")||e.push({name:"Safari",confidence:20});""===t.getPropertyValue("-moz-context-properties")&&""===t.getPropertyValue("-moz-user-focus")||e.push({name:"Firefox",confidence:20});""===t.getPropertyValue("-ms-ime-align")&&""===t.getPropertyValue("-ms-flow-from")||e.push({name:"Edge",confidence:60});}(t),function(e){if(performance.memory&&performance.memory.jsHeapSizeLimit){if(performance.memory.jsHeapSizeLimit>2e9){const t=navigator.userAgent.toLowerCase();-1===t.indexOf("edg/")&&-1===t.indexOf("edge/")&&e.push({name:"Chrome",confidence:20});}}if(void 0!==window.chrome&&"function"==typeof window.chrome.loadTimes)try{const t=window.chrome.loadTimes();t&&"number"==typeof t.firstPaintTime&&"number"==typeof t.requestTime&&e.push({name:"Chrome",confidence:30});}catch(e){}}(t),function(e){try{throw new Error}catch(t){if(t.stack&&t.stack.indexOf("()@")>=0&&e.push({name:"Firefox",confidence:15}),t.stack&&t.stack.indexOf("at new")>=0){const t=navigator.userAgent.toLowerCase();-1===t.indexOf("edg/")&&-1===t.indexOf("edge/")&&e.push({name:"Chrome",confidence:20});}t.stack&&-1===t.stack.indexOf("@")&&-1===t.stack.indexOf("at ")&&e.push({name:"Safari",confidence:15});}if(document.createElement("canvas").toDataURL().length>15&&void 0===navigator.brave&&void 0!==window.chrome){const t=new Image;let n=0;t.onload=()=>{n++,0===n&&e.push({name:"Brave",confidence:20});},t.onerror=()=>{e.push({name:"Brave",confidence:10});},t.src="https://www.facebook.com/tr?id=1234567890&ev=PageView";}try{!!window.__JQUERY_OBJECT__&&e.push({name:"Chrome",confidence:15});}catch(e){} -1!==navigator.userAgent.indexOf("Chrome")&&-1===navigator.userAgent.indexOf("Edg")&&-1===navigator.userAgent.indexOf("OPR")&&-1===navigator.userAgent.indexOf("Brave")&&void 0!==window.chrome&&window.chrome.runtime&&e.push({name:"Chrome",confidence:35});}(t),function(e){const t=navigator.userAgent.toLowerCase();-1===t.indexOf("edg/")&&-1===t.indexOf("edge/")||e.push({name:"Edge",confidence:80});try{CSS.supports("-ms-ime-align","auto")&&e.push({name:"Edge",confidence:70});}catch(e){}try{"function"==typeof navigator.msLaunchUri&&e.push({name:"Edge",confidence:85}),void 0!==window.MSInputMethodContext&&e.push({name:"Edge",confidence:80}),(document.documentMode||/edge/i.test(navigator.userAgent))&&e.push({name:"Edge",confidence:75}),void 0!==window.chrome&&window.chrome.runtime&&!window.chrome.webstore&&e.push({name:"Edge",confidence:60});}catch(e){}try{const t=document.createElement("canvas"),n=t.getContext("2d");if(n){t.width=200,t.height=50,n.font="20px Arial",n.textBaseline="top",n.fillText("EdgeBrowserTest",0,0);const i=n.getImageData(0,0,t.width,t.height).data;let o=0;for(let e=0;e<400;e+=4)o=(o<<5)-o+i[e];o<0&&e.push({name:"Edge",confidence:50});}}catch(e){}}(t),function(e){ -1!==navigator.userAgent.indexOf("Chrome")&&-1===navigator.userAgent.indexOf("Edg")&&-1===navigator.userAgent.indexOf("OPR")&&void 0!==window.chrome&&window.chrome.runtime&&"function"==typeof window.chrome.loadTimes&&"function"==typeof window.chrome.csi&&void 0===navigator.brave&&e.push({name:"Chrome",confidence:75});try{Array.from(navigator.plugins).some(e=>"Chrome PDF Viewer"===e.name)&&-1!==navigator.userAgent.indexOf("Chrome")&&-1===navigator.userAgent.indexOf("Edg")&&e.push({name:"Chrome",confidence:60});}catch(e){}try{const t=navigator.userAgent.match(/Chrome\/([0-9.]+)/);if(t){const n=t[1];-1!==navigator.appVersion.indexOf(n)&&-1===navigator.userAgent.indexOf("Edg")&&-1===navigator.userAgent.indexOf("OPR")&&e.push({name:"Chrome",confidence:30});}}catch(e){}}(t),function(e){try{if(navigator.brave)return void e.push({name:"Brave",confidence:95});const t=navigator.userAgent;if(t.includes("Brave")||t.includes("brave"))return void e.push({name:"Brave",confidence:90});if(void 0!==window.chrome&&window.chrome.runtime&&!window.google){!("google"in window)&&!window.chrome.webstore&&void 0!==navigator.brave&&e.push({name:"Brave",confidence:60});}}catch(e){}}(t),t.length>0){const n=t.reduce((e,t)=>(e[t.name]=(e[t.name]||0)+t.confidence,e),{});let i=0,o="Unknown";for(const[e,t]of Object.entries(n))t>i&&(i=t,o=e);"Chrome"===o&&function(){try{const e=navigator.userAgent.toLowerCase();if(-1!==e.indexOf("edg/")||-1!==e.indexOf("edge/"))return !0;if(window.msCredentials||document.documentMode||void 0!==window.MSInputMethodContext||"function"==typeof navigator.msLaunchUri)return !0;if(void 0!==window.chrome&&window.chrome.runtime&&!window.chrome.webstore&&!window.opr&&!window.opera)try{const e=Array.from(navigator.plugins).some(e=>"Chrome PDF Viewer"===e.name),t=Array.from(navigator.plugins).some(e=>-1!==e.name.indexOf("Edge"));if(!e||t)return !0}catch(e){}return !1}catch(e){return false}}()&&(o="Edge"),e.name=o,e.confidence=Math.min(100,i),["Chrome","Edge","Opera","Brave"].includes(o)?e.engine="Blink":"Firefox"===o?e.engine="Gecko":"Safari"===o&&(e.engine="WebKit"),e.version=function(e){const t=navigator.userAgent;let n="Unknown";try{if("Chrome"===e){const e=t.match(/Chrome\/([0-9.]+)/);e&&(n=e[1]);}else if("Firefox"===e){const e=t.match(/Firefox\/([0-9.]+)/);e&&(n=e[1]);}else if("Safari"===e){const e=t.match(/Version\/([0-9.]+)/);e&&(n=e[1]);}else if("Edge"===e){const e=t.match(/Edg(?:e)?\/([0-9.]+)/);e&&(n=e[1]);}else if("Opera"===e){const e=t.match(/OPR\/([0-9.]+)/);e&&(n=e[1]);}else if("Brave"===e)if(navigator.brave&&navigator.brave.version)n=navigator.brave.version;else {const e=t.match(/Brave\/([0-9.]+)/);if(e)n=e[1];else {const e=t.match(/Chrome\/([0-9.]+)/);e&&(n=e[1]);}if(void 0!==navigator.brave)try{navigator.brave.isBrave().then(e=>{});}catch(e){}}}catch(e){}return n}(o);}return e}var me,he="user-agent",fe="",we="function",pe="undefined",ge="object",be="string",ve="browser",ye="cpu",ke="device",xe="engine",Se="os",Le="result",Ee="name",_e="type",Ce="vendor",Ae="version",Pe="architecture",Ve="major",Ie="model",Me="console",Re="mobile",Fe="tablet",We="smarttv",Te="wearable",je="xr",Oe="embedded",Ge="inapp",De="brands",Be="formFactors",Ne="fullVersionList",Ze="platform",He="platformVersion",ze="bitness",Ye="sec-ch-ua",Xe=Ye+"-full-version-list",Ue=Ye+"-arch",Je=Ye+"-"+ze,qe=Ye+"-form-factors",Ke=Ye+"-"+Re,$e=Ye+"-"+Ie,Qe=Ye+"-"+Ze,et=Qe+"-version",tt=[De,Ne,Re,Ie,Ze,He,Pe,Be,ze],nt="Amazon",it="Apple",ot="ASUS",rt="BlackBerry",at="Google",st="Huawei",ct="Lenovo",dt="Honor",ut="LG",lt="Microsoft",mt="Motorola",ht="Nvidia",ft="OnePlus",wt="OPPO",pt="Samsung",gt="Sharp",bt="Sony",vt="Xiaomi",yt="Zebra",kt="Chrome",xt="Chromium",St="Chromecast",Lt="Edge",Et="Firefox",_t="Opera",Ct="Facebook",At="Sogou",Pt="Mobile ",Vt=" Browser",It="Windows",Mt=typeof window!==pe&&window.navigator?window.navigator:void 0,Rt=Mt&&Mt.userAgentData?Mt.userAgentData:void 0,Ft=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Wt=function(e,t){if(typeof e===ge&&e.length>0){for(var n in e)if(Gt(t)==Gt(e[n]))return true;return false}return !!jt(e)&&Gt(t)==Gt(e)},Tt=function(e,t){for(var n in e)return /^(browser|cpu|device|engine|os)$/.test(n)||!!t&&Tt(e[n])},jt=function(e){return typeof e===be},Ot=function(e){if(e){for(var t=[],n=Nt(/\\?\"/g,e).split(","),i=0;i<n.length;i++)if(n[i].indexOf(";")>-1){var o=Ht(n[i]).split(";v=");t[i]={brand:o[0],version:o[1]};}else t[i]=Ht(n[i]);return t}},Gt=function(e){return jt(e)?e.toLowerCase():e},Dt=function(e){return jt(e)?Nt(/[^\d\.]/g,e).split(".")[0]:void 0},Bt=function(e){for(var t in e){var n=e[t];typeof n==ge&&2==n.length?this[n[0]]=n[1]:this[n]=void 0;}return this},Nt=function(e,t){return jt(t)?t.replace(e,fe):t},Zt=function(e){return Nt(/\\?\"/g,e)},Ht=function(e,t){if(jt(e))return e=Nt(/^\s\s*/,e),typeof t===pe?e:e.substring(0,500)},zt=function(e,t){if(e&&t)for(var n,i,o,r,a,s,c=0;c<t.length&&!a;){var d=t[c],u=t[c+1];for(n=i=0;n<d.length&&!a&&d[n];)if(a=d[n++].exec(e))for(o=0;o<u.length;o++)s=a[++i],typeof(r=u[o])===ge&&r.length>0?2===r.length?typeof r[1]==we?this[r[0]]=r[1].call(this,s):this[r[0]]=r[1]:r.length>=3&&(typeof r[1]!==we||r[1].exec&&r[1].test?3==r.length?this[r[0]]=s?s.replace(r[1],r[2]):void 0:4==r.length?this[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):void 0:r.length>4&&(this[r[0]]=s?r[3].apply(this,[s.replace(r[1],r[2])].concat(r.slice(4))):void 0):r.length>3?this[r[0]]=s?r[1].apply(this,r.slice(2)):void 0:this[r[0]]=s?r[1].call(this,s,r[2]):void 0):this[r]=s||void 0;c+=2;}},Yt=function(e,t){for(var n in t)if(typeof t[n]===ge&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(Wt(t[n][i],e))return "?"===n?void 0:n}else if(Wt(t[n],e))return "?"===n?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},Xt={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2",8.1:"6.3",10:["6.4","10.0"],NT:""},Ut={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Jt={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},qt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ae,[Ee,Pt+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[Ae,[Ee,Lt+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ae,[Ee,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Ee,Ae],[/opios[\/ ]+([\w\.]+)/i],[Ae,[Ee,_t+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ae,[Ee,_t+" GX"]],[/\bopr\/([\w\.]+)/i],[Ae,[Ee,_t]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ae,[Ee,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ae,[Ee,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[Ee,Ae],[/quark(?:pc)?\/([-\w\.]+)/i],[Ae,[Ee,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ae,[Ee,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ae,[Ee,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ae,[Ee,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ae,[Ee,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ae,[Ee,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ae,[Ee,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ae,[Ee,"Smart "+ct+Vt]],[/(avast|avg)\/([\w\.]+)/i],[[Ee,/(.+)/,"$1 Secure"+Vt],Ae],[/\bfocus\/([\w\.]+)/i],[Ae,[Ee,Et+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ae,[Ee,_t+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ae,[Ee,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ae,[Ee,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ae,[Ee,_t+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ae,[Ee,"MIUI"+Vt]],[/fxios\/([\w\.-]+)/i],[Ae,[Ee,Pt+Et]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ae,[Ee,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Ee,/(.+)/,"$1Browser"],Ae],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Ee,/(.+)/,"$1"+Vt],Ae],[/samsungbrowser\/([\w\.]+)/i],[Ae,[Ee,pt+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ae,[Ee,At+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Ee,At+" Mobile"],Ae],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Ee,Ae],[/(lbbrowser|rekonq)/i],[Ee],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ae,Ee],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Ee,Ct],Ae,[_e,Ge]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[Ee,Ae,[_e,Ge]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ae,[Ee,"GSA"],[_e,Ge]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ae,[Ee,"TikTok"],[_e,Ge]],[/\[(linkedin)app\]/i],[Ee,[_e,Ge]],[/(chromium)[\/ ]([-\w\.]+)/i],[Ee,Ae],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ae,[Ee,kt+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[Ae,[Ee,Lt+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Ee,kt+" WebView"],Ae],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ae,[Ee,"Android"+Vt]],[/chrome\/([\w\.]+) mobile/i],[Ae,[Ee,Pt+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Ee,Ae],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ae,[Ee,Pt+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Ee,Pt+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ae,Ee],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Ee,[Ae,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Ee,Ae],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Ee,Pt+Et],Ae],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Ee,"Netscape"],Ae],[/(wolvic|librewolf)\/([\w\.]+)/i],[Ee,Ae],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ae,[Ee,Et+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[Ee,[Ae,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Ee,[Ae,/[^\d\.]+./,fe]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Pe,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Pe,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Pe,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Pe,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Pe,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Pe,/ower/,fe,Gt]],[/ sun4\w[;\)]/i],[[Pe,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Pe,Gt]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[Ie,[Ce,pt],[_e,Fe]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[Ie,[Ce,pt],[_e,Re]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Ie,[Ce,it],[_e,Re]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Ie,[Ce,it],[_e,Fe]],[/(macintosh);/i],[Ie,[Ce,it]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Ie,[Ce,gt],[_e,Re]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[Ie,[Ce,dt],[_e,Fe]],[/honor([-\w ]+)[;\)]/i],[Ie,[Ce,dt],[_e,Re]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[Ie,[Ce,st],[_e,Fe]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Ie,[Ce,st],[_e,Re]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[Ie,/_/g," "],[Ce,vt],[_e,Fe]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[Ie,/_/g," "],[Ce,vt],[_e,Re]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Ie,[Ce,ft],[_e,Re]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Ie,[Ce,wt],[_e,Re]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[Ie,[Ce,Yt,{OnePlus:["203","304","403","404","413","415"],"*":wt}],[_e,Fe]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[Ie,[Ce,"BLU"],[_e,Re]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Ie,[Ce,"Vivo"],[_e,Re]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Ie,[Ce,"Realme"],[_e,Re]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[Ie,[Ce,ct],[_e,Fe]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[Ie,[Ce,ct],[_e,Re]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[Ie,[Ce,mt],[_e,Re]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Ie,[Ce,mt],[_e,Fe]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Ie,[Ce,ut],[_e,Fe]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[Ie,[Ce,ut],[_e,Re]],[/(nokia) (t[12][01])/i],[Ce,Ie,[_e,Fe]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[Ie,/_/g," "],[_e,Re],[Ce,"Nokia"]],[/(pixel (c|tablet))\b/i],[Ie,[Ce,at],[_e,Fe]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[Ie,[Ce,at],[_e,Re]],[/(google) (pixelbook( go)?)/i],[Ce,Ie],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[Ie,[Ce,bt],[_e,Re]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Ie,"Xperia Tablet"],[Ce,bt],[_e,Fe]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Ie,[Ce,nt],[_e,Fe]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Ie,/(.+)/g,"Fire Phone $1"],[Ce,nt],[_e,Re]],[/(playbook);[-\w\),; ]+(rim)/i],[Ie,Ce,[_e,Fe]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Ie,[Ce,rt],[_e,Re]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Ie,[Ce,ot],[_e,Fe]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Ie,[Ce,ot],[_e,Re]],[/(nexus 9)/i],[Ie,[Ce,"HTC"],[_e,Fe]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Ce,[Ie,/_/g," "],[_e,Re]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Ce,"TCL"],[_e,Fe]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Ce,"TCL"],[_e,Re]],[/(itel) ((\w+))/i],[[Ce,Gt],Ie,[_e,Yt,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Ie,[Ce,"Acer"],[_e,Fe]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Ie,[Ce,"Meizu"],[_e,Re]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Ie,[Ce,"Ulefone"],[_e,Re]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Ie,[Ce,"Energizer"],[_e,Re]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Ie,[Ce,"Cat"],[_e,Re]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Ie,[Ce,"Smartfren"],[_e,Re]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[Ie,[Ce,"Nothing"],[_e,Re]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[Ie,[Ce,"Archos"],[_e,Fe]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[Ie,[Ce,"Archos"],[_e,Re]],[/; (n159v)/i],[Ie,[Ce,"HMD"],[_e,Re]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[Ce,Ie,[_e,Fe]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[Ce,Ie,[_e,Re]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Ce,Ie,[_e,Fe]],[/(surface duo)/i],[Ie,[Ce,lt],[_e,Fe]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Ie,[Ce,"Fairphone"],[_e,Re]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[Ie,[Ce,ht],[_e,Fe]],[/(sprint) (\w+)/i],[Ce,Ie,[_e,Re]],[/(kin\.[onetw]{3})/i],[[Ie,/\./g," "],[Ce,lt],[_e,Re]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Ie,[Ce,yt],[_e,Fe]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Ie,[Ce,yt],[_e,Re]],[/smart-tv.+(samsung)/i],[Ce,[_e,We]],[/hbbtv.+maple;(\d+)/i],[[Ie,/^/,"SmartTV"],[Ce,pt],[_e,We]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[Ce,Ie,[_e,We]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Ce,ut],[_e,We]],[/(apple) ?tv/i],[Ce,[Ie,it+" TV"],[_e,We]],[/crkey.*devicetype\/chromecast/i],[[Ie,St+" Third Generation"],[Ce,at],[_e,We]],[/crkey.*devicetype\/([^/]*)/i],[[Ie,/^/,"Chromecast "],[Ce,at],[_e,We]],[/fuchsia.*crkey/i],[[Ie,St+" Nest Hub"],[Ce,at],[_e,We]],[/crkey/i],[[Ie,St],[Ce,at],[_e,We]],[/(portaltv)/i],[Ie,[Ce,Ct],[_e,We]],[/droid.+aft(\w+)( bui|\))/i],[Ie,[Ce,nt],[_e,We]],[/(shield \w+ tv)/i],[Ie,[Ce,ht],[_e,We]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Ie,[Ce,gt],[_e,We]],[/(bravia[\w ]+)( bui|\))/i],[Ie,[Ce,bt],[_e,We]],[/(mi(tv|box)-?\w+) bui/i],[Ie,[Ce,vt],[_e,We]],[/Hbbtv.*(technisat) (.*);/i],[Ce,Ie,[_e,We]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Ce,/.+\/(\w+)/,"$1",Yt,{LG:"lge"}],[Ie,Ht],[_e,We]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[Ie,[_e,We]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[_e,We]],[/(playstation \w+)/i],[Ie,[Ce,bt],[_e,Me]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Ie,[Ce,lt],[_e,Me]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[Ce,Ie,[_e,Me]],[/droid.+; (shield)( bui|\))/i],[Ie,[Ce,ht],[_e,Me]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[Ie,[Ce,pt],[_e,Te]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[Ce,Ie,[_e,Te]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[Ie,[Ce,wt],[_e,Te]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Ie,[Ce,it],[_e,Te]],[/(opwwe\d{3})/i],[Ie,[Ce,ft],[_e,Te]],[/(moto 360)/i],[Ie,[Ce,mt],[_e,Te]],[/(smartwatch 3)/i],[Ie,[Ce,bt],[_e,Te]],[/(g watch r)/i],[Ie,[Ce,ut],[_e,Te]],[/droid.+; (wt63?0{2,3})\)/i],[Ie,[Ce,yt],[_e,Te]],[/droid.+; (glass) \d/i],[Ie,[Ce,at],[_e,je]],[/(pico) (4|neo3(?: link|pro)?)/i],[Ce,Ie,[_e,je]],[/(quest( \d| pro)?s?).+vr/i],[Ie,[Ce,Ct],[_e,je]],[/mobile vr; rv.+firefox/i],[[_e,je]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Ce,[_e,Oe]],[/(aeobc)\b/i],[Ie,[Ce,nt],[_e,Oe]],[/(homepod).+mac os/i],[Ie,[Ce,it],[_e,Oe]],[/windows iot/i],[[_e,Oe]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[Ie,[_e,Yt,{mobile:"Mobile",xr:"VR","*":Fe}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[_e,Fe]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[_e,Re]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[Ie,[Ce,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ae,[Ee,Lt+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Ee,Ae],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ae,[Ee,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[Ee,Ae],[/ladybird\//i],[[Ee,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ae,Ee]],os:[[/(windows nt) (6\.[23]); arm/i],[[Ee,/N/,"R"],[Ae,Yt,Xt]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[Ee,Ae],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[Ae,/(;|\))/g,"",Yt,Xt],[Ee,It]],[/(windows ce)\/?([\d\.]*)/i],[Ee,Ae],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ae,/_/g,"."],[Ee,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[Ee,"macOS"],[Ae,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ae,[Ee,St+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ae,[Ee,St+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ae,[Ee,St+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ae,[Ee,St+" Linux"]],[/crkey\/([\d\.]+)/i],[Ae,[Ee,St]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[Ae,Ee],[/(ubuntu) ([\w\.]+) like android/i],[[Ee,/(.+)/,"$1 Touch"],Ae],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[Ee,Ae],[/\(bb(10);/i],[Ae,[Ee,rt]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[Ae,[Ee,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ae,[Ee,Et+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[Ae,[Ee,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[Ae,Yt,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[Ee,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ae,[Ee,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Ee,"Chrome OS"],Ae],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[Ee,Ae],[/(sunos) ?([\d\.]*)/i],[[Ee,"Solaris"],Ae],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Ee,Ae]]},Kt=(Bt.call((me={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[[ve,[Ee,Ae,Ve,_e]],[ye,[Pe]],[ke,[_e,Ie,Ce]],[xe,[Ee,Ae]],[Se,[Ee,Ae]]]),Bt.call(me.isIgnore,[[ve,[Ae,Ve]],[xe,[Ae]],[Se,[Ae]]]),Bt.call(me.isIgnoreRgx,[[ve,/ ?browser$/i],[Se,/ ?os$/i]]),Bt.call(me.toString,[[ve,[Ee,Ae]],[ye,[Pe]],[ke,[Ce,Ie]],[xe,[Ee,Ae]],[Se,[Ee,Ae]]]),me),$t=function(e,t){var n=Kt.init[t],i=Kt.isIgnore[t]||0,o=Kt.isIgnoreRgx[t]||0,r=Kt.toString[t]||0;function a(){Bt.call(this,n);}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return Rt?Rt.getHighEntropyValues(tt).then(function(t){return e.setCH(new Qt(t,false)).parseCH().get()}):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=Le&&(a.prototype.is=function(e){var t=false;for(var n in this)if(this.hasOwnProperty(n)&&!Wt(i,n)&&Gt(o?Nt(o,this[n]):this[n])==Gt(o?Nt(o,e):e)){if(t=true,e!=pe)break}else if(e==pe&&t){t=!t;break}return t},a.prototype.toString=function(){var e=fe;for(var t in r)typeof this[r[t]]!==pe&&(e+=(e?" ":fe)+this[r[t]]);return e||pe}),Rt||(a.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);};n.prototype={is:a.prototype.is,toString:a.prototype.toString};var i=new n;return e(i),i}),new a};function Qt(e,t){if(e=e||{},Bt.call(this,tt),t)Bt.call(this,[[De,Ot(e[Ye])],[Ne,Ot(e[Xe])],[Re,/\?1/.test(e[Ke])],[Ie,Zt(e[$e])],[Ze,Zt(e[Qe])],[He,Zt(e[et])],[Pe,Zt(e[Ue])],[Be,Ot(e[qe])],[ze,Zt(e[Je])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==pe&&(this[n]=e[n]);}function en(e,t,n,i){return this.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},this.set=function(e,t){return this.data[e]=t,this},this.setCH=function(e){return this.uaCH=e,this},this.detectFeature=function(){if(Mt&&Mt.userAgent==this.ua)switch(this.itemType){case ve:Mt.brave&&typeof Mt.brave.isBrave==we&&this.set(Ee,"Brave");break;case ke:!this.get(_e)&&Rt&&Rt[Re]&&this.set(_e,Re),"Macintosh"==this.get(Ie)&&Mt&&typeof Mt.standalone!==pe&&Mt.maxTouchPoints&&Mt.maxTouchPoints>2&&this.set(Ie,"iPad").set(_e,Fe);break;case Se:!this.get(Ee)&&Rt&&Rt[Ze]&&this.set(Ee,Rt[Ze]);break;case Le:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(ve,t(ve)).set(ye,t(ye)).set(ke,t(ke)).set(xe,t(xe)).set(Se,t(Se));}return this},this.parseUA=function(){return this.itemType!=Le&&zt.call(this.data,this.ua,this.rgxMap),this.itemType==ve&&this.set(Ve,Dt(this.get(Ae))),this},this.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case ve:case xe:var n,i=e[Ne]||e[De];if(i)for(var o in i){var r=i[o].brand||i[o],a=i[o].version;this.itemType==ve&&!/not.a.brand/i.test(r)&&(!n||/Chrom/.test(n)&&r!=xt||n==Lt&&/WebView2/.test(r))&&(r=Yt(r,Jt),(n=this.get(Ee))&&!/Chrom/.test(n)&&/Chrom/.test(r)||this.set(Ee,r).set(Ae,a).set(Ve,Dt(a)),n=r),this.itemType==xe&&r==xt&&this.set(Ae,a);}break;case ye:var s=e[Pe];s&&(s&&"64"==e[ze]&&(s+="64"),zt.call(this.data,s+";",t));break;case ke:if(e[Re]&&this.set(_e,Re),e[Ie]&&(this.set(Ie,e[Ie]),!this.get(_e)||!this.get(Ce))){var c={};zt.call(c,"droid 9; "+e[Ie]+")",t),!this.get(_e)&&c.type&&this.set(_e,c.type),!this.get(Ce)&&c.vendor&&this.set(Ce,c.vendor);}if(e[Be]){var d;if("string"!=typeof e[Be])for(var u=0;!d&&u<e[Be].length;)d=Yt(e[Be][u++],Ut);else d=Yt(e[Be],Ut);this.set(_e,d);}break;case Se:var l=e[Ze];if(l){var m=e[He];l==It&&(m=parseInt(Dt(m),10)>=13?"11":"10"),this.set(Ee,l).set(Ae,m);}this.get(Ee)==It&&"Xbox"==e[Ie]&&this.set(Ee,"Xbox").set(Ae,void 0);break;case Le:var h=this.data,f=function(t){return h[t].getItem().setCH(e).parseCH().get()};this.set(ve,f(ve)).set(ye,f(ye)).set(ke,f(ke)).set(xe,f(xe)).set(Se,f(Se));}return this},Bt.call(this,[["itemType",e],["ua",t],["uaCH",i],["rgxMap",n],["data",$t(this,e)]]),this}function tn(e,t,n){if(typeof e===ge?(Tt(e,true)?(typeof t===ge&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e!==be||Tt(t,true)||(n=t,t=void 0),n&&typeof n.append===we){var i={};n.forEach(function(e,t){i[t]=e;}),n=i;}if(!(this instanceof tn))return new tn(e,t,n).getResult();var o=typeof e===be?e:n&&n[he]?n[he]:Mt&&Mt.userAgent?Mt.userAgent:fe,r=new Qt(n,true),a=t?function(e,t){var n={},i=t;if(!Tt(t))for(var o in i={},t)for(var r in t[o])i[r]=t[o][r].concat(i[r]?i[r]:[]);for(var a in e)n[a]=i[a]&&i[a].length%2==0?i[a].concat(e[a]):e[a];return n}(qt,t):qt,s=function(e){return e==Le?function(){return new en(e,o,a,r).set("ua",o).set(ve,this.getBrowser()).set(ye,this.getCPU()).set(ke,this.getDevice()).set(xe,this.getEngine()).set(Se,this.getOS()).get()}:function(){return new en(e,o,a[e],r).parseUA().get()}};return Bt.call(this,[["getBrowser",s(ve)],["getCPU",s(ye)],["getDevice",s(ke)],["getEngine",s(xe)],["getOS",s(Se)],["getResult",s(Le)],["getUA",function(){return o}],["setUA",function(e){return jt(e)&&(o=e.length>500?Ht(e,500):e),this}]]).setUA(o),this}tn.VERSION="2.0.4",tn.BROWSER=Ft([Ee,Ae,Ve,_e]),tn.CPU=Ft([Pe]),tn.DEVICE=Ft([Ie,Ce,_e,Me,Re,We,Fe,Te,Oe]),tn.ENGINE=tn.OS=Ft([Ee,Ae]);const nn=async()=>({...new tn(navigator.userAgent).getResult().os,device_type:on()}),on=()=>{const e=window.innerWidth;return e<=767?"mobile":e<=1024?"tablet":"desktop"},rn=e=>{if(!e)return null;const t=e.toLowerCase();return t.includes("android")?"android":t.includes("iphone")||t.includes("ipad")||"ios"===t?"ios":t.includes("win")?"windows":t.includes("mac")||t.includes("macos")?"macos":t.includes("linux")?"linux":null},an={ios:[/apple a\d+ gpu/i],macos:[/apple m\d+/i,/opengl engine/i],windows:[/angle.*direct3d/i],android:[/adreno|mali|powervr/i],linux:[/mesa|x11/i]},sn=(e,t,n,i)=>"ios"===i||"android"===i?n>768?"tablet":"mobile":"windows"===i||"macos"===i||"linux"===i?"desktop":t?n<600?"mobile":n<=1024?"tablet":false===e?"desktop":"tablet":t?null:"desktop",cn=e=>parseFloat(e.toFixed(2)),dn=(e,t)=>{let n=1;const i=[],o={confidence:1,spoofingConfidence:0,isSpoofed:false,detectionConflicts:[],realPlatform:null,realDeviceType:null},a=t.touchPoints>0,s=t.screen.width,c=rn(e.platform),d=(u=t.webGL.renderer?.toLowerCase()||"",an.ios.some(e=>e.test(u))?"ios":an.macos.some(e=>e.test(u))?"macos":an.windows.some(e=>e.test(u))?"windows":an.android.some(e=>e.test(u))?"android":an.linux.some(e=>e.test(u))||/NVIDIA|AMD|Intel/i.test(u)?"linux":null);var u;const l=rn(t.actualPlatform),m=d||l;let h=c;c&&m&&c!==m?(n-=.3,i.push(`Claimed OS "${c}" disagrees with actual OS signal "${m}".`),h=m):c&&!m&&""!==e.platform?(n-=.2,i.push(`Actual OS signal "${t.actualPlatform}" is unrecognized.`),h=c):!c&&m&&(n-=.2,i.push(`Claimed OS signal "${e.platform}" is unrecognized.`),h=m);const f=(t.webGL.vendor||"").toLowerCase(),w=(t.webGL.renderer||"").toLowerCase();if(f&&"n/a"!==f&&"n/a (masked)"!==f){let e=false,o=null;"android"===h&&(f.includes("apple")||w.includes("apple"))?(e=true,o="ios"):"ios"!==h||f.includes("apple")||w.includes("apple")?"windows"===h&&(f.includes("apple")||w.includes("apple"))?(e=true,o="macos"):"macos"!==h||f.includes("apple")||w.includes("apple")||f.includes("intel")||w.includes("intel")||f.includes("amd")||w.includes("amd")||w.includes("radeon")||(e=true,o=f.includes("qualcomm")||f.includes("adreno")||f.includes("mali")||f.includes("powervr")||f.includes("arm")?"android":"windows"):(e=true,o=f.includes("qualcomm")||f.includes("adreno")||f.includes("mali")||f.includes("powervr")||f.includes("arm")?"android":f.includes("intel")||w.includes("intel")||f.includes("nvidia")||w.includes("nvidia")||f.includes("amd")||w.includes("amd")||w.includes("radeon")?"windows":"android"),e&&(n-=.5,i.push(`OS "${h}" conflicts with GPU "${t.webGL.vendor} / ${t.webGL.renderer}". GPU suggests "${o||"unknown"}".`),o&&(h=o));}else t.webGL.error&&(n-=.1,i.push(`WebGL info unavailable (${t.webGL.error}).`));let p=null;const g=(b=e.guessedDeviceType)&&r.includes(b)?e.guessedDeviceType:null;var b;true!==e.mobile||a?false===e.mobile&&a?(n-=.15,i.push("Claimed mobile=false but touch points detected."),p=sn(e.mobile,a,s,h)):g&&(p=g):(n-=.3,i.push("Claimed mobile=true but no touch points detected."),p="desktop");"mobile"===p&&s>1024?(n-=.15,i.push(`Device type 'mobile', but screen width (${s}px) is large.`),p="tablet"):"desktop"===p&&s<768&&(n-=.15,i.push(`Preliminary type 'desktop', but screen width (${s}px) is small.`),p=a?"mobile":"desktop"),o.realPlatform=h||c;const v=sn(e.mobile,a,s,o.realPlatform);return p?v&&v!==p?(n-=.12,i.push(`Initial device type guess (${p}) adjusted to ${v} based on final signals.`),o.realDeviceType=v):o.realDeviceType=p:o.realDeviceType=v,o.realDeviceType||("ios"===o.realPlatform||"android"===o.realPlatform?o.realDeviceType=v||"mobile":o.realPlatform?o.realDeviceType=v||"desktop":o.realDeviceType=a?s>768?"tablet":"mobile":"desktop"),o.confidence=cn(Math.max(0,n)),o.spoofingConfidence=cn(1-o.confidence),o.isSpoofed=o.spoofingConfidence>.1,o.detectionConflicts=i,o},un=async()=>{const e={claimed:{platform:"",mobile:false,brands:[],guessedDeviceType:null},signals:{actualPlatform:"",touchPoints:0,screen:{width:0,height:0,pixelRatio:1},webGL:{vendor:void 0,renderer:void 0,error:""},userAgentString:""},analysis:{confidence:1,spoofingConfidence:0,isSpoofed:false,detectionConflicts:[],realPlatform:null,realDeviceType:null}},t=(()=>{const e={actualPlatform:navigator.userAgentData?.platform||navigator.platform,touchPoints:navigator.maxTouchPoints||0,screen:{width:screen.width,height:screen.height,pixelRatio:window.devicePixelRatio||1},webGL:{vendor:void 0,renderer:void 0,error:""},userAgentString:navigator.userAgent};try{const t=document.createElement("canvas"),n=t.getContext("webgl2")||t.getContext("webgl")||t.getContext("experimental-webgl");if(n&&"getParameter"in n){const t=n.getExtension("WEBGL_debug_renderer_info");t?(e.webGL.vendor=n.getParameter(t.UNMASKED_VENDOR_WEBGL)||"n/a",e.webGL.renderer=n.getParameter(t.UNMASKED_RENDERER_WEBGL)||"n/a"):(e.webGL.vendor=n.getParameter(n.VENDOR)||"n/a (masked)",e.webGL.renderer=n.getParameter(n.RENDERER)||"n/a (masked)",e.webGL.vendor&&"n/a (masked)"!==e.webGL.vendor||(e.webGL.error="Debug info extension unavailable or vendor masked"));}else e.webGL.error="WebGL context unavailable";}catch(t){console.error("Error getting WebGL data:",t),e.webGL.error=t instanceof Error?t.message:"Unknown WebGL error";}return e})();e.signals=t;const n=await(async e=>{const t={};try{if(navigator.userAgentData){const e=await navigator.userAgentData.getHighEntropyValues(["platform","platformVersion","architecture","model","uaFullVersion","brands","mobile"]);t.platform=e.platform,t.mobile=e.mobile??null,t.brands=e.brands||[],t.mobile?t.guessedDeviceType=screen.width>768?"tablet":"mobile":t.guessedDeviceType="desktop";}else {const n=e,i=n.toLowerCase();i.includes("android")?t.platform="Android":i.includes("iphone")||i.includes("ipad")?t.platform="iOS":i.includes("windows nt")?t.platform="Windows":i.includes("mac os x")||i.includes("macintosh")?t.platform="macOS":i.includes("linux")&&(t.platform="Linux");const o=(e=>{const t=e.toLowerCase();return /(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(t)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|hpwos|Opera M(obi|ini)/i.test(t)?"mobile":t.includes("windows nt")||t.includes("macintosh")||t.includes("x11")?"desktop":null})(n);t.guessedDeviceType=o,t.mobile="mobile"===o||"tablet"===o;const r=n.match(/(Apple|Samsung|Google|Microsoft|Sony|LG|HTC|Nokia|Motorola|Huawei|Xiaomi|Pixel|Firefox|Safari|Edge|Chrome)/i);if(r){const e=n.match(new RegExp(r[0]+"[ /]([\\d._]+)"));t.brands.push({brand:r[0],version:e?e[1]:"unknown"});}}}catch(e){console.error("Error getting User Agent Data:",e);}return t})(t.userAgentString);e.claimed=n;const i=dn(n,t);e.analysis=i;return {...e,deviceOs:i.realPlatform,deviceType:i.realDeviceType,tampering:i.isSpoofed?{status:true,confidence:i.spoofingConfidence}:{status:false}}};async function ln(){const{name:e,version:t}=le();return {name:e,version:t,user_agent:navigator.userAgent}}function mn(e,t,n){let i=[];for(let t=0;t<e[0].data.length;t++){let n=[];for(let i=0;i<e.length;i++)n.push(e[i].data[t]);i.push(hn(n));}const o=new Uint8ClampedArray(i);return new ImageData(o,t,n)}function hn(e){if(0===e.length)return 0;const t={};for(const n of e)t[n]=(t[n]||0)+1;let n=e[0];for(const e in t)t[e]>t[n]&&(n=parseInt(e,10));return n}p("audio",async function(){return new Promise((e,t)=>{try{const t=44100,n=5e3,i=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,n,t),o=i.createBufferSource(),r=i.createAnalyser(),a=new Float32Array(r.frequencyBinCount);r.getFloatFrequencyData(a);const s=i.createOscillator();s.frequency.value=1e3;const c=i.createDynamicsCompressor();c.threshold.value=-50,c.knee.value=40,c.ratio.value=12,c.attack.value=0,c.release.value=.2,s.connect(c),c.connect(i.destination),s.start(),i.oncomplete=()=>{e({oscillator:s.type,maxChannels:i.destination.maxChannelCount,channelCountMode:o.channelCountMode,frequencyBinCount:r.frequencyBinCount});},i.startRendering();}catch(e){console.error("Error creating audio fingerprint:",e),t(e);}})});const fn="SamsungBrowser"!==ue()?1:3;function wn(e,t){return new Promise(n=>setTimeout(n,e,t))}"Firefox"!=ue()&&p("canvas",function(){return new Promise(e=>{const t=Array.from({length:fn},()=>function(){const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return new ImageData(1,1);e.width=280,e.height=20;const 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(.5,"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);const i="Random Text WMwmil10Oo";t.font="23.123px Arial",t.fillStyle="black",t.fillText(i,-5,15),t.fillStyle="rgba(0, 0, 255, 0.5)",t.fillText(i,-3.3,17.7),t.beginPath(),t.moveTo(0,0),t.lineTo(2*e.width/7,e.height),t.strokeStyle="white",t.lineWidth=2,t.stroke();const o=t.getImageData(0,0,e.width,e.height);return o}());e({commonImageDataHash:k(mn(t,280,20).data.toString()).toString()});})});const pn=["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"],gn=["monospace","sans-serif","serif"];function bn(e,t){if(!e)throw new Error("Canvas context not supported");return e.font=`72px ${t}`,e.measureText("WwMmLli0Oo").width}function vn(){const e=document.createElement("canvas"),t=e.getContext("webgl")??e.getContext("experimental-webgl");if(t&&"getParameter"in t)try{const e=(t.getParameter(t.VENDOR)||"").toString();let n={vendor:e,renderer:(t.getParameter(t.RENDERER)||"").toString(),version:(t.getParameter(t.VERSION)||"").toString(),shadingLanguageVersion:(t.getParameter(t.SHADING_LANGUAGE_VERSION)||"").toString()};const i=t.getExtension("WEBGL_debug_renderer_info");if(i){const e=(t.getParameter(i.UNMASKED_VENDOR_WEBGL)||"").toString(),o=(t.getParameter(i.UNMASKED_RENDERER_WEBGL)||"").toString();e&&(n.vendorUnmasked=e),o&&(n.rendererUnmasked=o);}return n}catch(e){}return "undefined"}function yn(){const e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function kn(e,t){const n={};return t.forEach(t=>{const i=function(e){if(0===e.length)return null;const t={};e.forEach(e=>{const n=String(e);t[n]=(t[n]||0)+1;});let n=e[0],i=1;return Object.keys(t).forEach(e=>{t[e]>i&&(n=e,i=t[e]);}),n}(e.map(e=>t in e?e[t]:void 0).filter(e=>void 0!==e));i&&(n[t]=i);}),n}let xn;function Sn(e){return e.reduce((e,t)=>e+(t?1:0),0)}function Ln(){const e=window;return Sn(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,0===navigator.vendor.indexOf("Apple"),"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function En(){const e=window;return t=e.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(t))&&"[object WebPageNamespace]"===String(e.browser);var t;}function _n(){const e=window;return Sn(["buildID"in navigator,"MozAppearance"in(document.documentElement?.style??{}),"onmozfullscreenchange"in e,"mozInnerScreenX"in e,"CSSMozDocumentRule"in e,"CanvasCaptureMediaStream"in e])>=4}function Cn(){const e=function(){const e=window,t=navigator;return Sn(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,0===(t.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}(),t=_n(),n=window,i=navigator;return e?Sn([!("SharedWorker"in n),!("sinkId"in new Audio)])>=2:!!t&&Sn(["onorientationchange"in n,"orientation"in n,/android/i.test(i.appVersion)])>=2}"Firefox"!=ue()&&p("fonts",function(){return new Promise((e,t)=>{try{!async function(e){for(;!document.body;)await wn(50);const t=document.createElement("iframe");t.setAttribute("frameBorder","0");const 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);const i=t.contentDocument||t.contentWindow?.document;if(!i)throw new Error("Iframe document is not accessible");e({iframe:i}),setTimeout(()=>{document.body.removeChild(t);},0);}(async({iframe:t})=>{const n=t.createElement("canvas").getContext("2d"),i=gn.map(e=>bn(n,e));let o={};pn.forEach(e=>{const t=bn(n,e);i.includes(t)||(o[e]=t);}),e(o);});}catch(e){t({error:"unsupported"});}})}),p("hardware",function(){return new Promise(e=>{const t=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:vn(),architecture:yn(),jsHeapSizeLimit:t.jsHeapSizeLimit||0});})}),p("locales",function(){return new Promise(e=>{e({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone});})}),p("permissions",async function(){xn=f?.permissions_to_check||["accelerometer","accessibility","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","clipboard-read","clipboard-write","device-info","display-capture","gyroscope","local-fonts","magnetometer","midi","nfc","notifications","payment-handler","persistent-storage","speaker","storage-access","top-level-storage-access","window-management","query"];const e=Array.from({length:f?.retries||3},()=>async function(){const e={};for(const t of xn)try{const n=await navigator.permissions.query({name:t});e[t]=n.state.toString();}catch(e){}return e}());return Promise.all(e).then(e=>kn(e,xn))}),p("screen",function(){return new Promise(e=>{e({colorDepth:screen.colorDepth});})}),p("screenResolution",async function(){return Ln()&&function(){const e=window,t=navigator,{CSS:n,HTMLButtonElement:i}=e;return Sn([!("getStorageUpdates"in t),i&&"popover"in i.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}()&&En()?[]:function(){const e=screen,t=e=>function(e,t){return "number"==typeof e&&isNaN(e)?t:e}(function(e){return parseInt(e)}(e),null),n=[t(e.width),t(e.height)];return n.sort().reverse(),n}()});const An="SamsungBrowser"!==function(){if("undefined"==typeof navigator)return {name:"unknown",version:"unknown"};const e=navigator.userAgent,t=[/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/,/(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/,/(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/,/(?<name>samsung).*Version\/(?<version>\d+(?:\.\d+)?)/i],n={edg:"Edge",opr:"Opera",samsung:"SamsungBrowser"};for(const i of t){const t=e.match(i);if(t&&t.groups){return {name:n[t.groups.name.toLowerCase()]||t.groups.name,version:t.groups.version}}}return {name:"unknown",version:"unknown"}}().name?1:3;let Pn,Vn=null;async function In(){"undefined"!=typeof document&&(Pn=document.createElement("canvas"),Pn.width=200,Pn.height=100,Vn=Pn.getContext("webgl"));try{if(!Vn)throw new Error("WebGL not supported");const e=Array.from({length:An},()=>function(){try{if(!Vn)throw new Error("WebGL not supported");const e="\n attribute vec2 position;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n }\n ",t="\n precision mediump float;\n void main() {\n gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color\n }\n ",n=Vn.createShader(Vn.VERTEX_SHADER),i=Vn.createShader(Vn.FRAGMENT_SHADER);if(!n||!i)throw new Error("Failed to create shaders");if(Vn.shaderSource(n,e),Vn.shaderSource(i,t),Vn.compileShader(n),!Vn.getShaderParameter(n,Vn.COMPILE_STATUS))throw new Error("Vertex shader compilation failed: "+Vn.getShaderInfoLog(n));if(Vn.compileShader(i),!Vn.getShaderParameter(i,Vn.COMPILE_STATUS))throw new Error("Fragment shader compilation failed: "+Vn.getShaderInfoLog(i));const o=Vn.createProgram();if(!o)throw new Error("Failed to create shader program");if(Vn.attachShader(o,n),Vn.attachShader(o,i),Vn.linkProgram(o),!Vn.getProgramParameter(o,Vn.LINK_STATUS))throw new Error("Shader program linking failed: "+Vn.getProgramInfoLog(o));Vn.useProgram(o);const r=137,a=new Float32Array(4*r),s=2*Math.PI/r;for(let e=0;e<r;e++){const t=e*s;a[4*e]=0,a[4*e+1]=0,a[4*e+2]=Math.cos(t)*(Pn.width/2),a[4*e+3]=Math.sin(t)*(Pn.height/2);}const c=Vn.createBuffer();Vn.bindBuffer(Vn.ARRAY_BUFFER,c),Vn.bufferData(Vn.ARRAY_BUFFER,a,Vn.STATIC_DRAW);const d=Vn.getAttribLocation(o,"position");Vn.enableVertexAttribArray(d),Vn.vertexAttribPointer(d,2,Vn.FLOAT,!1,0,0),Vn.viewport(0,0,Pn.width,Pn.height),Vn.clearColor(0,0,0,1),Vn.clear(Vn.COLOR_BUFFER_BIT),Vn.drawArrays(Vn.LINES,0,2*r);const u=new Uint8ClampedArray(Pn.width*Pn.height*4);Vn.readPixels(0,0,Pn.width,Pn.height,Vn.RGBA,Vn.UNSIGNED_BYTE,u);return new ImageData(u,Pn.width,Pn.height)}catch(e){return new ImageData(1,1)}finally{Vn&&(Vn.bindBuffer(Vn.ARRAY_BUFFER,null),Vn.useProgram(null),Vn.viewport(0,0,Vn.drawingBufferWidth,Vn.drawingBufferHeight),Vn.clearColor(0,0,0,0));}}());return {commonImageHash:k(mn(e,Pn.width,Pn.height).data.toString()).toString()}}catch(e){return}}function Mn(){if("https:"===window.location.protocol&&"function"==typeof window.ApplePaySession)try{const e=window.ApplePaySession.supportsVersion;for(let t=15;t>0;t--)if(e(t))return t}catch(e){return 0}return 0}p("webgl",async function({cache:e={}}={cache:{}}){const t=function(e){if(e.webgl)return e.webgl.context;const t=document.createElement("canvas");let n;t.addEventListener("webglCreateContextError",()=>n=void 0);for(const e of ["webgl","experimental-webgl"]){try{n=t.getContext(e);}catch{}if(n)break}return e.webgl={context:n},n}(e);if(!t)return {status:-1};if(!function(e){return "function"==typeof e.getParameter}(t))return {status:-2};const n=_n()?null:t.getExtension("WEBGL_debug_renderer_info"),i=await In();return {version:t.getParameter(t.VERSION)?.toString()||"",vendor:t.getParameter(t.VENDOR)?.toString()||"",vendorUnmasked:n?t.getParameter(n.UNMASKED_VENDOR_WEBGL)?.toString():"",renderer:t.getParameter(t.RENDERER)?.toString()||"",rendererUnmasked:n?t.getParameter(n.UNMASKED_RENDERER_WEBGL)?.toString():"",shadingLanguageVersion:t.getParameter(t.SHADING_LANGUAGE_VERSION)?.toString()||"",...i}}),p("plugins",function(){const e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){const n=navigator.plugins[t];e.push([n.name,n.filename,n.description].join("|"));}return new Promise(t=>{t({plugins:e});})}),p("system",async function(){return new Promise(e=>{const t=le();e({platform:window.navigator.platform,cookieEnabled:window.navigator.cookieEnabled,productSub:navigator.productSub,product:navigator.product,browser:{name:t.name},applePayVersion:Mn()});})});const Rn=["😀","👨‍👩‍👧‍👦","🇺🇸","🍎","🐼","🚀","🏳️‍🌈","👍🏽","❤️","🤦‍♂️"],Fn=["Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","Android Emoji","EmojiOne","Twemoji Mozilla","sans-serif"];function Wn(e,t){try{const n=document.createElement("canvas"),i=20;n.width=i,n.height=i;const o=n.getContext("2d");return o?(o.fillStyle="white",o.fillRect(0,0,i,i),o.textBaseline="middle",o.textAlign="center",o.fillStyle="black",o.font=`16px "${t}"`,o.fillText(e,i/2,i/2),o.getImageData(0,0,i,i).data):null}catch(e){return null}}function Tn(e){const t=[];for(let n=0;n<e.length;n+=32)t.push(e[n],e[n+1],e[n+2]);return t}p("emojiFingerprint",async function(){return new Promise(e=>{try{const t={};let n=[];Rn.forEach((e,i)=>{for(const o of Fn){const r=Wn(e,o);if(r){const e=Tn(r);n=[...n,...e],t[`emoji_${i}`]=k(new Uint8Array(e).buffer).slice(0,16);break}}});e({emojiFingerprintHash:k(new Uint8Array(n).buffer),emojiDetails:t,uniqueEmojisRendered:Object.keys(t).length});}catch(t){e({emojiFingerprintHash:"unsupported",emojiDetails:{},uniqueEmojisRendered:0});}})});const jn=(e,t,n,i)=>{const o=(n-t)/i;let r=0;for(let n=0;n<i;n++){r+=e(t+(n+.5)*o);}return r*o};function On(e,t){return new Promise(n=>setTimeout(n,e,t))}function Gn(e){const[t,n]=function(e){const t=`Unexpected syntax '${e}'`,n=/^\s*([a-z-]*)(.*)$/i.exec(e),i=n[1]||void 0,o={},r=/([.:#][\w-]+|\[.+?\])/gi,a=(e,t)=>{o[e]=o[e]||[],o[e].push(t);};for(;;){const e=r.exec(n[2]);if(!e)break;const i=e[0];switch(i[0]){case ".":a("class",i.slice(1));break;case "#":a("id",i.slice(1));break;case "[":{const e=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(i);if(!e)throw new Error(t);a(e[1],e[4]??e[5]??"");break}default:throw new Error(t)}}return [i,o]}(e),i=document.createElement(t??"div");for(const e of Object.keys(n)){const t=n[e].join(" ");"style"===e?Dn(i.style,t):i.setAttribute(e,t);}return i}function Dn(e,t){for(const n of t.split(";")){const t=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(n);if(t){const[,n,i,,o]=t;e.setProperty(n,i,o||"");}}}function Bn(e){return matchMedia(`(forced-colors: ${e})`).matches}p("math",async()=>({acos:Math.acos(.5),asin:jn(Math.asin,-1,1,97),atan:jn(Math.atan,-1,1,97),cos:jn(Math.cos,0,Math.PI,97),cosh:Math.cosh(9/7),e:Math.E,largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),log:Math.log(1e3),pi:Math.PI,sin:jn(Math.sin,-Math.PI,Math.PI,97),sinh:jn(Math.sinh,-9/7,7/9,97),sqrt:Math.sqrt(2),tan:jn(Math.tan,0,2*Math.PI,97),tanh:jn(Math.tanh,-9/7,7/9,97)}));function Nn(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important");}p("domBlockers",async function(){if(!Ln()&&!Cn())return;const e=function(){const e=atob;return {abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}(),t=Object.keys(e),n=[].concat(...t.map(t=>e[t])),i=await async function(e){const t=document,n=t.createElement("div"),i=new Array(e.length),o={};Nn(n);for(let o=0;o<e.length;++o){const r=Gn(e[o]);"DIALOG"===r.tagName&&r.show();const a=t.createElement("div");Nn(a),a.appendChild(r),n.appendChild(a),i[o]=r;}for(;!t.body;)await On(50);t.body.appendChild(n);try{for(let t=0;t<e.length;++t)i[t].offsetParent||(o[e[t]]=!0);}finally{n.parentNode?.removeChild(n);}return o}(n),o=t.filter(t=>{const n=e[t];return Sn(n.map(e=>i[e]))>.6*n.length});return o.sort(),o}),p("vendorFlavour",function(){const e=[];for(const t of ["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"]){const n=window[t];n&&"object"==typeof n&&e.push(t);}const t=e.sort();if(t.length>0)return t;{const{name:e}=le();return [e]}}),p("monochrome",function(){if(matchMedia("(min-monochrome: 0)").matches){for(let e=0;e<=100;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw new Error("Too high value")}}),p("forcedColors",function(){return !!Bn("active")||!Bn("none")&&void 0}),p("colorGamut",function(){for(const e of ["rec2020","p3","srgb"])if(matchMedia(`(color-gamut: ${e})`).matches)return e}),p("osCpu",function(){return navigator.oscpu}),p("audioLatency",function(){return Cn()||Ln()?window.AudioContext?(new AudioContext).baseLatency??-1:-1:-2});const Zn=async(e,t)=>{const[n,i,o,r,a,s,c]=await Hn();return {request_id:e,device:{fingerprint_id:n.hash,type:"web",os:s.deviceOs,os_version:a.version,raw_device_data:n.data,browserDetails:c,bot:o,tampering:s.tampering,incognito:r,tor:i},sdk:{name:t?.name,version:t?.version}}};async function Hn(){return await Promise.all([L(),_(),de(),A(),nn(),un(),ln()])}const{addListener:Yn}=u();class Un{constructor(e={}){this.isInitialized=false,this.fields=[],this.trackedFieldIds=new Set,this.config={...Un.DEFAULT_CONFIG,...e},Yn();}initializeTracking(e){e.filter(e=>!this.trackedFieldIds.has(e.id)).forEach(e=>this.trackField(e)),this.isInitialized=true;}get metrics(){return this.ensureInitialized(),this.fields.map(({element:e,...t})=>t)}removeTracking(e){e?this.removeFieldTracking(e):this.removeAllTracking();}trackField(e){const{id:t,ltm:n}=e,i=this.getValidElement(t),o=this.createFieldMetric(t,i,n);this.fields.push(o),this.trackedFieldIds.add(t);const r=this.createInputHandler(o);i.addEventListener("input",r);}getValidElement(e){const t=document.getElementById(e);if(!t)throw new o(`Element with ID "${e}" was not found in the DOM. Please ensure the ID is correctly assigned to an input element.`);if(!this.isValidInputElement(t))throw new o(`Element with ID "${e}" must be an HTMLInputElement or HTMLTextAreaElement.`);return t}isValidInputElement(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement}createFieldMetric(e,t,n){return {field_name:e,started_at:0,ended_at:0,interaction_count:0,fill_method:null,paste_count:0,ltm:n??false,corrections_count:0,pauses:0,pauseDurations:[],element:t}}createInputHandler(e){return t=>{this.handleInput(e,t);}}handleInput(e,t){const n=performance.now(),i=e.ended_at||0,o=this.analyzeInteraction(e,t,n,i);this.updateFieldMetrics(e,o,n);}analyzeInteraction(e,t,n,i){const o=this.determineFillMethod(e,t);return {fillMethod:o,isCorrection:this.isCorrection(t),isPaste:this.isPaste(o,t),isPause:this.isPause(n,i),pauseDuration:n-i}}updateFieldMetrics(e,t,n){e.started_at||(e.started_at=n),e.ended_at=n,e.fill_method=t.fillMethod,e.interaction_count+=1,t.isCorrection&&(e.corrections_count+=1),t.isPaste&&(e.paste_count+=1),t.isPause&&(e.pauses+=1,e.pauseDurations.push(t.pauseDuration));}determineFillMethod(e,t){const n=t.inputType;if(!n)return a.paste;const i="insertText"===n?a.typed:"insertFromPaste"===n?a.paste:a.mixed;return e.fill_method&&e.fill_method!==i?a.mixed:i}isCorrection(e){return "deleteContentBackward"===e.inputType}isPaste(e,t){return e===a.paste||"insertFromPaste"===t.inputType}isPause(e,t){if(0===t)return false;return e-t>this.config.pauseThresholdMs}removeFieldTracking(e){const t=this.fields.findIndex(t=>t.field_name===e);if(-1===t)return;const n=this.fields[t];this.cleanupFieldTracking(n),this.fields.splice(t,1),this.trackedFieldIds.delete(e);}removeAllTracking(){this.fields.forEach(e=>this.cleanupFieldTracking(e)),this.fields.length=0,this.trackedFieldIds.clear();}cleanupFieldTracking(e){e.element.removeEventListener("input",this.createInputHandler(e));}ensureInitialized(){if(!this.isInitialized)throw new o("Ginger.trackEvent must be initialized before data can be fetched.")}}Un.DEFAULT_CONFIG={pauseThresholdMs:1500};new Un;
86
+
87
+ const CONSTANTS = {
88
+ LIVE_URL: 'https://app.getrayyan.com',
89
+ TEST_URL: 'https://api-sandbox.useginger.ai',
90
+ };
91
+
92
+ function getBasePath(apikey) {
93
+ if (apikey.includes("sk_live") || apikey.includes("pk_live"))
94
+ return CONSTANTS.LIVE_URL;
95
+ return CONSTANTS.TEST_URL;
96
+ }
97
+
98
+ const sendRequest = async ({ url, payload, apikey, method, }) => {
99
+ try {
100
+ const response = await fetch(url, {
101
+ method,
102
+ headers: {
103
+ 'Content-Type': 'application/json',
104
+ 'Accept': 'application/json',
105
+ 'Authorization': `Bearer ${apikey}`,
106
+ },
107
+ body: JSON.stringify(payload),
108
+ });
109
+ if (!response.ok) {
110
+ const responsejson = await response.json();
111
+ throw new Error(responsejson.error || 'HTTP request failed');
112
+ }
113
+ const data = await response.json();
114
+ return data;
115
+ }
116
+ catch (e) {
117
+ throw e;
118
+ }
119
+ };
120
+
121
+ var METHOD;
122
+ (function (METHOD) {
123
+ METHOD["POST"] = "POST";
124
+ })(METHOD || (METHOD = {}));
125
+ class GingerHttpClient {
126
+ baseUrl;
127
+ apikey;
128
+ constructor(apikey) {
129
+ this.apikey = apikey;
130
+ this.baseUrl = getBasePath(apikey);
131
+ }
132
+ async post(options) {
133
+ const { url, payload } = options;
134
+ const fullUrl = `${this.baseUrl}${url}`;
135
+ try {
136
+ const response = await sendRequest({
137
+ url: fullUrl,
138
+ apikey: this.apikey,
139
+ payload: payload,
140
+ method: METHOD.POST,
141
+ });
142
+ return response;
143
+ }
144
+ catch (e) {
145
+ throw e;
146
+ }
147
+ }
148
+ }
149
+
150
+ class GingerClient {
151
+ static instance = new GingerClient();
152
+ store = undefined;
153
+ static getInstance() {
154
+ return GingerClient.instance;
155
+ }
156
+ async initialize(apikey) {
157
+ try {
158
+ const httpClient = new GingerHttpClient(apikey);
159
+ const sdkInfo = { name: "ginger-react", version: "0.0.3" };
160
+ const payload = await Zn(e(), sdkInfo);
161
+ const response = await httpClient.post({
162
+ url: `/api/v1/devices`,
163
+ payload,
164
+ });
165
+ return response;
166
+ }
167
+ catch (error) {
168
+ throw error;
169
+ }
170
+ }
171
+ async submitEvent(apikey, payload) {
172
+ try {
173
+ const httpClient = new GingerHttpClient(apikey);
174
+ return await httpClient.post({
175
+ url: "/api/v1/events",
176
+ payload,
177
+ });
178
+ }
179
+ catch (error) {
180
+ throw error;
181
+ }
182
+ }
183
+ updateStore(params) {
184
+ this.store = params;
185
+ }
186
+ getStoreData() {
187
+ return this.store;
188
+ }
189
+ }
190
+
191
+ const submitTrackedData = async (apikey, { event_type, request_id, fieldsMetrics, distractions_count, device_time_origin }) => {
192
+ const client = GingerClient.getInstance();
193
+ const store = client.getStoreData();
194
+ try {
195
+ if (!store) {
196
+ throw new Error("useEvent requires GingerClient to be initialized.");
197
+ }
198
+ const { request_id: requestId, fingerprint_id } = store;
199
+ const eventPayload = {
200
+ event: {
201
+ event_type,
202
+ request_id: requestId || request_id,
203
+ fingerprint_id: fingerprint_id,
204
+ data: {
205
+ fields: fieldsMetrics,
206
+ distractions_count,
207
+ device_time_origin
208
+ },
209
+ },
210
+ };
211
+ const response = await client.submitEvent(apikey, eventPayload);
212
+ return response;
213
+ }
214
+ catch (error) {
215
+ throw error;
216
+ }
217
+ };
218
+
219
+ const getDeviceTimeOrigin = () => {
220
+ return performance.timeOrigin;
221
+ };
222
+ const createDefaultMetrics = (fieldName, ltm) => ({
223
+ field_name: fieldName,
224
+ ltm: ltm,
225
+ started_at: 0,
226
+ ended_at: 0,
227
+ interaction_count: 0,
228
+ characters_count: 0,
229
+ paste_count: 0,
230
+ autofill_count: 0,
231
+ corrections_count: 0,
232
+ pauses: 0,
233
+ hesitation_time: 0,
234
+ pause_durations: [],
235
+ key_hold_times: [],
236
+ });
237
+ const MODIFIER_KEYS = [
238
+ "Meta",
239
+ "Alt",
240
+ "Control",
241
+ "Shift",
242
+ "CapsLock",
243
+ "Tab",
244
+ "Backspace",
245
+ "Enter",
246
+ "Escape",
247
+ "ArrowUp",
248
+ "ArrowDown",
249
+ "ArrowLeft",
250
+ "ArrowRight",
251
+ "Home",
252
+ "End",
253
+ "PageUp",
254
+ "PageDown",
255
+ "Insert",
256
+ "Delete",
257
+ "ContextMenu",
258
+ "NumLock",
259
+ "ScrollLock",
260
+ "Pause",
261
+ ];
262
+
263
+ const useEvent = ({ event_type, track_fields, request_id, }) => {
264
+ const context = useContext(GingerClientContext);
265
+ if (!context) {
266
+ throw new Error("useEvent must be used within GingerReactProvider");
267
+ }
268
+ const registeredFieldsIdRef = useRef(track_fields.map((field) => field.id));
269
+ const trackedFieldMetricsRef = useRef({});
270
+ const fieldFocusMetricsRef = useRef({});
271
+ const modifierKeysCountRef = useRef({});
272
+ // For key hold Time (How long each key is pressed)
273
+ const activeKeysRef = useRef(new Map());
274
+ const holdTimesRef = useRef({});
275
+ // For Flight time calculation (Time between releasing one key and pressing next)
276
+ const flightTimeEventsRef = useRef({});
277
+ const computeMetrics = (id, e, eventType) => {
278
+ if (eventType === "change") {
279
+ computeChangeMetrics(id, e);
280
+ }
281
+ if (eventType === "focus") {
282
+ computeFocusMetrics(id);
283
+ }
284
+ if (eventType === "keydown") {
285
+ computeKeyDownMetrics(id, e);
286
+ computeModifierKeysCount(id, e);
287
+ }
288
+ if (eventType === 'keyup') {
289
+ computeKeyUpMetrics(id, e);
290
+ }
291
+ };
292
+ const computeChangeMetrics = (id, e) => {
293
+ const trackedFields = trackedFieldMetricsRef.current;
294
+ const currentField = trackedFields[id];
295
+ if (!currentField)
296
+ return;
297
+ const focusInputFields = fieldFocusMetricsRef.current;
298
+ const computedMetrics = computeFieldInputMetrics({ id, e, currentField, focusInputFields });
299
+ trackedFields[id] = computedMetrics;
300
+ };
301
+ const computeModifierKeysCount = (id, e) => {
302
+ const key = e.key;
303
+ const modifierKeys = modifierKeysCountRef.current;
304
+ if (MODIFIER_KEYS.includes(key)) {
305
+ modifierKeys[id] = (modifierKeys[id] || 0) + 1;
306
+ }
307
+ };
308
+ const computeFocusMetrics = (id, e) => {
309
+ if (fieldFocusMetricsRef.current && !fieldFocusMetricsRef.current?.[id]) {
310
+ const now = performance.now();
311
+ fieldFocusMetricsRef.current[id] = now;
312
+ }
313
+ };
314
+ const computeKeyDownMetrics = (id, e) => {
315
+ const { key, timeStamp } = e;
316
+ addToActiveKeyStore(id, key, timeStamp);
317
+ addToFlightKeyStore(id, key, timeStamp);
318
+ };
319
+ const addToActiveKeyStore = (id, key, timestamp) => {
320
+ const map = activeKeysRef.current;
321
+ const field = map.get(id) ?? new Map();
322
+ const downTime = timestamp;
323
+ if (field.has(key))
324
+ return;
325
+ field.set(key, { downTime });
326
+ map.set(id, field);
327
+ };
328
+ const addToFlightKeyStore = (id, key, timestamp) => {
329
+ const map = flightTimeEventsRef.current;
330
+ const field = map[id] ?? [];
331
+ const keyTime = { key, downTime: timestamp, upTime: null };
332
+ field.push(keyTime);
333
+ map[id] = field;
334
+ };
335
+ const computeKeyUpMetrics = (id, e) => {
336
+ const { key, timeStamp } = e;
337
+ computeKeyHoldTime(id, key, timeStamp);
338
+ computeFlightTime(id, key, timeStamp);
339
+ };
340
+ const computeKeyHoldTime = (id, key, timestamp) => {
341
+ const map = activeKeysRef.current;
342
+ const field = map.get(id);
343
+ if (!field)
344
+ return;
345
+ const fieldObject = field.get(key);
346
+ if (!fieldObject)
347
+ return;
348
+ const { downTime } = fieldObject;
349
+ const upTime = timestamp;
350
+ const holdTime = upTime - downTime;
351
+ const holdTimes = holdTimesRef.current;
352
+ const holdTimeArray = (holdTimes[id] ||= []);
353
+ holdTimeArray.push(holdTime);
354
+ field.delete(key);
355
+ };
356
+ // Time between releasing one key and pressing next
357
+ const computeFlightTime = (id, key, timestamp) => {
358
+ const map = flightTimeEventsRef.current;
359
+ const fieldArray = map[id];
360
+ if (!fieldArray)
361
+ return;
362
+ const lastEntry = fieldArray.findLast(f => f.key === key);
363
+ if (!lastEntry)
364
+ return;
365
+ lastEntry.upTime = timestamp;
366
+ const index = fieldArray.lastIndexOf(lastEntry);
367
+ if (index !== -1) {
368
+ fieldArray[index] = lastEntry;
369
+ }
370
+ };
371
+ useEffect(() => {
372
+ // Update stored ids if track_fields changes
373
+ const newIds = track_fields.map((field) => field.id);
374
+ registeredFieldsIdRef.current = newIds;
375
+ // Clean up stale fields
376
+ const trackedIds = Object.keys(trackedFieldMetricsRef.current);
377
+ const staleIds = trackedIds.filter((id) => !newIds.includes(id));
378
+ staleIds.forEach((id) => {
379
+ removeTracking(id);
380
+ });
381
+ }, [track_fields]);
382
+ const removeTracking = (id) => {
383
+ removeFieldTracking(id);
384
+ removeFocusMetric(id);
385
+ removeModifierMetric(id);
386
+ removeHoldTimeMetric(id);
387
+ };
388
+ const removeFieldTracking = (id) => {
389
+ const field = trackedFieldMetricsRef.current;
390
+ if (!field)
391
+ return;
392
+ delete field[id];
393
+ };
394
+ const removeFocusMetric = (id) => {
395
+ const field = fieldFocusMetricsRef.current;
396
+ if (!field)
397
+ return;
398
+ delete field[id];
399
+ };
400
+ const removeModifierMetric = (id) => {
401
+ const field = modifierKeysCountRef.current;
402
+ if (!field)
403
+ return;
404
+ delete field[id];
405
+ };
406
+ const removeHoldTimeMetric = (id) => {
407
+ const field = holdTimesRef.current;
408
+ if (!field)
409
+ return;
410
+ delete field[id];
411
+ };
412
+ const resetFields = () => {
413
+ trackedFieldMetricsRef.current = {};
414
+ fieldFocusMetricsRef.current = {};
415
+ modifierKeysCountRef.current = {};
416
+ holdTimesRef.current = {};
417
+ };
418
+ // Calculate distraction count
419
+ const distractionCountRef = useRef(0);
420
+ const wasHiddenRef = useRef(false);
421
+ useEffect(() => {
422
+ const handleVisibilityChange = () => {
423
+ if (document.hidden) {
424
+ wasHiddenRef.current = true;
425
+ }
426
+ else if (wasHiddenRef.current) {
427
+ distractionCountRef.current += 1;
428
+ wasHiddenRef.current = false;
429
+ }
430
+ };
431
+ document.addEventListener("visibilitychange", handleVisibilityChange);
432
+ return () => {
433
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
434
+ };
435
+ });
436
+ const serializeMetrics = useCallback(() => {
437
+ const fieldMetrics = trackedFieldMetricsRef.current;
438
+ return Object.values(fieldMetrics).map((field) => {
439
+ const id = field.field_name;
440
+ const key_hold_times = holdTimesRef.current[id] || [];
441
+ const flight_time = getFlightTime(id);
442
+ return { ...field, key_hold_times, flight_time };
443
+ });
444
+ }, []);
445
+ const getFlightTime = (id) => {
446
+ const flights = flightTimeEventsRef.current[id] || [];
447
+ return computeFlightTimeMetric(flights);
448
+ };
449
+ const computeFlightTimeMetric = (flights) => {
450
+ return flights.reduce((acc, curr, index, arr) => {
451
+ if (index === 0)
452
+ return acc;
453
+ const prev = arr[index - 1];
454
+ if (curr.downTime != null && prev.upTime != null) {
455
+ const flightTime = curr.downTime - prev.upTime;
456
+ acc.push(flightTime);
457
+ }
458
+ return acc;
459
+ }, []);
460
+ };
461
+ const submitEvent = async () => {
462
+ const { config } = context;
463
+ try {
464
+ const fieldsMetrics = serializeMetrics();
465
+ const distractions_count = distractionCountRef.current;
466
+ const device_time_origin = getDeviceTimeOrigin();
467
+ const res = await submitTrackedData(config.apikey, {
468
+ event_type,
469
+ request_id,
470
+ fieldsMetrics,
471
+ distractions_count,
472
+ device_time_origin,
473
+ });
474
+ resetFields();
475
+ return res;
476
+ }
477
+ catch (e) {
478
+ throw e;
479
+ }
480
+ };
481
+ const register = (id, handler) => {
482
+ const storedIds = registeredFieldsIdRef.current;
483
+ if (!storedIds.includes(id)) {
484
+ console.error(`Field "${id}" must be registered in track_fields first.`);
485
+ return {};
486
+ }
487
+ const ltm = track_fields.find((field) => field.id === id)?.ltm ?? false;
488
+ const metrics = trackedFieldMetricsRef.current;
489
+ if (!metrics[id]) {
490
+ metrics[id] = createDefaultMetrics(id, ltm);
491
+ }
492
+ else if (metrics[id].ltm !== ltm) {
493
+ metrics[id].ltm = ltm;
494
+ }
495
+ const wrapHandler = (eventType, originalHandler) => (e) => {
496
+ computeMetrics(id, e, eventType);
497
+ originalHandler?.();
498
+ };
499
+ return {
500
+ onChange: wrapHandler('change', handler?.onChange),
501
+ onFocus: wrapHandler('focus', handler?.onFocus),
502
+ onKeyDown: wrapHandler('keydown', handler?.onKeyDown),
503
+ onKeyUp: wrapHandler('keyup', handler?.onKeyUp),
504
+ };
505
+ };
506
+ return {
507
+ register,
508
+ fieldFocusMetricsRef: fieldFocusMetricsRef.current,
509
+ submitEvent,
510
+ };
511
+ };
512
+
513
+ const useGinger = () => {
514
+ const context = useContext(GingerClientContext);
515
+ if (!context) {
516
+ throw new Error("useGinger must be used within a GingerReactProvider");
517
+ }
518
+ const { config } = context;
519
+ const [loading, setLoading] = useState(false);
520
+ const [error, setError] = useState(null);
521
+ const initialize = useCallback(async () => {
522
+ setLoading(true);
523
+ setError(null);
524
+ const client = GingerClient.getInstance();
525
+ try {
526
+ const response = await client.initialize(config.apikey);
527
+ const data = response.data;
528
+ client.updateStore({
529
+ request_id: data.request_id,
530
+ fingerprint_id: data.fingerprint_id,
531
+ });
532
+ return response;
533
+ }
534
+ catch (e) {
535
+ const msg = e instanceof Error
536
+ ? e.message
537
+ : "Initialization failed. Please try again.";
538
+ setError(msg);
539
+ client.updateStore(undefined);
540
+ throw new Error(msg);
541
+ }
542
+ finally {
543
+ setLoading(false);
544
+ }
545
+ }, [config]);
546
+ return {
547
+ loading,
548
+ error,
549
+ initialize,
550
+ };
551
+ };
552
+
553
+ export { GingerReactProvider, useEvent, useGinger };
554
+ //# sourceMappingURL=index.esm.js.map