@webdecoy/client 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -334,6 +334,13 @@ declare class EnvironmentalCollector {
334
334
  _getCanvasHash(): Record<string, unknown>;
335
335
  _getWebGLInfo(): Record<string, unknown>;
336
336
  _getAudioInfo(): Record<string, unknown>;
337
+ /**
338
+ * Native-function integrity check. Stealth automation hides itself by
339
+ * overriding native functions; a patched native's `toString()` no longer
340
+ * reports `[native code]`. A genuine browser never patches its own natives,
341
+ * so any hit here is deliberate evasion (scored in the `stealth` category).
342
+ */
343
+ _getLieDetection(): Record<string, unknown>;
337
344
  _getHeadlessIndicators(): Record<string, unknown>;
338
345
  _getScreenInfo(): Record<string, unknown>;
339
346
  _getNavigatorInfo(): Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -334,6 +334,13 @@ declare class EnvironmentalCollector {
334
334
  _getCanvasHash(): Record<string, unknown>;
335
335
  _getWebGLInfo(): Record<string, unknown>;
336
336
  _getAudioInfo(): Record<string, unknown>;
337
+ /**
338
+ * Native-function integrity check. Stealth automation hides itself by
339
+ * overriding native functions; a patched native's `toString()` no longer
340
+ * reports `[native code]`. A genuine browser never patches its own natives,
341
+ * so any hit here is deliberate evasion (scored in the `stealth` category).
342
+ */
343
+ _getLieDetection(): Record<string, unknown>;
337
344
  _getHeadlessIndicators(): Record<string, unknown>;
338
345
  _getScreenInfo(): Record<string, unknown>;
339
346
  _getNavigatorInfo(): Record<string, unknown>;
package/dist/index.js CHANGED
@@ -493,7 +493,9 @@ var EnvironmentalCollector = class {
493
493
  domRectFingerprint: this._getDOMRectFingerprint(),
494
494
  cssMediaQueries: this._getCSSMediaQueries(),
495
495
  permissionsInfo: this._getPermissionsInfo(),
496
- fontsInfo: this._getFontsInfo()
496
+ fontsInfo: this._getFontsInfo(),
497
+ // Native-function integrity (stealth self-hiding leaves patched toStrings)
498
+ lieDetection: this._getLieDetection()
497
499
  };
498
500
  }
499
501
  // Async detections collected separately
@@ -565,12 +567,6 @@ var EnvironmentalCollector = class {
565
567
  const desc = Object.getOwnPropertyDescriptor(proto, "webdriver");
566
568
  if (!desc) {
567
569
  signals.push("webdriver_deleted");
568
- } else if (desc.configurable !== false) {
569
- signals.push("webdriver_configurable");
570
- }
571
- const isChrome = /Chrome\//.test(navigator.userAgent) && !/Edg\//.test(navigator.userAgent);
572
- if (isChrome && w.chrome && !w.chrome.runtime) {
573
- signals.push("chrome_runtime_missing");
574
570
  }
575
571
  return { detected: signals.length > 0, signals };
576
572
  } catch (e) {
@@ -677,6 +673,47 @@ var EnvironmentalCollector = class {
677
673
  return { supported: false, error: true };
678
674
  }
679
675
  }
676
+ /**
677
+ * Native-function integrity check. Stealth automation hides itself by
678
+ * overriding native functions; a patched native's `toString()` no longer
679
+ * reports `[native code]`. A genuine browser never patches its own natives,
680
+ * so any hit here is deliberate evasion (scored in the `stealth` category).
681
+ */
682
+ _getLieDetection() {
683
+ try {
684
+ const w = window;
685
+ const patched = [];
686
+ const isPatched = (fn) => {
687
+ try {
688
+ return typeof fn === "function" && fn.toString().indexOf("[native code]") === -1;
689
+ } catch {
690
+ return false;
691
+ }
692
+ };
693
+ const check = (fn, name) => {
694
+ if (isPatched(fn)) patched.push(name);
695
+ };
696
+ check(Function.prototype.toString, "Function.prototype.toString");
697
+ check(navigator.permissions && navigator.permissions.query, "navigator.permissions.query");
698
+ check(w.Notification && w.Notification.requestPermission, "Notification.requestPermission");
699
+ check(w.HTMLCanvasElement && w.HTMLCanvasElement.prototype.toDataURL, "HTMLCanvasElement.toDataURL");
700
+ check(
701
+ w.WebGLRenderingContext && w.WebGLRenderingContext.prototype.getParameter,
702
+ "WebGLRenderingContext.getParameter"
703
+ );
704
+ check(navigator.mediaDevices && navigator.mediaDevices.enumerateDevices, "mediaDevices.enumerateDevices");
705
+ try {
706
+ const desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(navigator), "webdriver") || Object.getOwnPropertyDescriptor(navigator, "webdriver");
707
+ if (desc && typeof desc.get === "function" && desc.get.toString().indexOf("[native code]") === -1) {
708
+ patched.push("navigator.webdriver getter");
709
+ }
710
+ } catch {
711
+ }
712
+ return { supported: true, patched, patchedCount: patched.length };
713
+ } catch (e) {
714
+ return { supported: false };
715
+ }
716
+ }
680
717
  _getHeadlessIndicators() {
681
718
  const nav = navigator;
682
719
  return {
package/dist/index.mjs CHANGED
@@ -456,7 +456,9 @@ var EnvironmentalCollector = class {
456
456
  domRectFingerprint: this._getDOMRectFingerprint(),
457
457
  cssMediaQueries: this._getCSSMediaQueries(),
458
458
  permissionsInfo: this._getPermissionsInfo(),
459
- fontsInfo: this._getFontsInfo()
459
+ fontsInfo: this._getFontsInfo(),
460
+ // Native-function integrity (stealth self-hiding leaves patched toStrings)
461
+ lieDetection: this._getLieDetection()
460
462
  };
461
463
  }
462
464
  // Async detections collected separately
@@ -528,12 +530,6 @@ var EnvironmentalCollector = class {
528
530
  const desc = Object.getOwnPropertyDescriptor(proto, "webdriver");
529
531
  if (!desc) {
530
532
  signals.push("webdriver_deleted");
531
- } else if (desc.configurable !== false) {
532
- signals.push("webdriver_configurable");
533
- }
534
- const isChrome = /Chrome\//.test(navigator.userAgent) && !/Edg\//.test(navigator.userAgent);
535
- if (isChrome && w.chrome && !w.chrome.runtime) {
536
- signals.push("chrome_runtime_missing");
537
533
  }
538
534
  return { detected: signals.length > 0, signals };
539
535
  } catch (e) {
@@ -640,6 +636,47 @@ var EnvironmentalCollector = class {
640
636
  return { supported: false, error: true };
641
637
  }
642
638
  }
639
+ /**
640
+ * Native-function integrity check. Stealth automation hides itself by
641
+ * overriding native functions; a patched native's `toString()` no longer
642
+ * reports `[native code]`. A genuine browser never patches its own natives,
643
+ * so any hit here is deliberate evasion (scored in the `stealth` category).
644
+ */
645
+ _getLieDetection() {
646
+ try {
647
+ const w = window;
648
+ const patched = [];
649
+ const isPatched = (fn) => {
650
+ try {
651
+ return typeof fn === "function" && fn.toString().indexOf("[native code]") === -1;
652
+ } catch {
653
+ return false;
654
+ }
655
+ };
656
+ const check = (fn, name) => {
657
+ if (isPatched(fn)) patched.push(name);
658
+ };
659
+ check(Function.prototype.toString, "Function.prototype.toString");
660
+ check(navigator.permissions && navigator.permissions.query, "navigator.permissions.query");
661
+ check(w.Notification && w.Notification.requestPermission, "Notification.requestPermission");
662
+ check(w.HTMLCanvasElement && w.HTMLCanvasElement.prototype.toDataURL, "HTMLCanvasElement.toDataURL");
663
+ check(
664
+ w.WebGLRenderingContext && w.WebGLRenderingContext.prototype.getParameter,
665
+ "WebGLRenderingContext.getParameter"
666
+ );
667
+ check(navigator.mediaDevices && navigator.mediaDevices.enumerateDevices, "mediaDevices.enumerateDevices");
668
+ try {
669
+ const desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(navigator), "webdriver") || Object.getOwnPropertyDescriptor(navigator, "webdriver");
670
+ if (desc && typeof desc.get === "function" && desc.get.toString().indexOf("[native code]") === -1) {
671
+ patched.push("navigator.webdriver getter");
672
+ }
673
+ } catch {
674
+ }
675
+ return { supported: true, patched, patchedCount: patched.length };
676
+ } catch (e) {
677
+ return { supported: false };
678
+ }
679
+ }
643
680
  _getHeadlessIndicators() {
644
681
  const nav = navigator;
645
682
  return {
@@ -1,4 +1,4 @@
1
- "use strict";var WebDecoyCaptchaBundle=(()=>{var O=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var q=(h,t)=>{for(var e in t)O(h,e,{get:t[e],enumerable:!0})},X=(h,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of B(t))!$.call(h,i)&&i!==e&&O(h,i,{get:()=>t[i],enumerable:!(n=N(t,i))||n.enumerable});return h};var Y=h=>X(O({},"__esModule",{value:!0}),h);var G={};q(G,{WebDecoyCaptcha:()=>A});var S=class{constructor(){this.mousePositions=[],this.mouseVelocities=[],this.mouseAccelerations=[],this.scrollEvents=[],this.keyEvents=[],this.touchEvents=[],this.touchMultiTouchSeen=!1,this.touchIdentifiers=new Set,this.pointerPoints=[],this.focusEvents=[],this.clickData=null,this.startTime=Date.now(),this.lastMousePos=null,this.lastMouseTime=null,this.lastVelocity=null,this.eventDeltas=[]}recordMouseMove(t){let e=performance.now(),n={x:t.clientX,y:t.clientY,t:e};if(this.mousePositions.push(n),this.lastMousePos&&this.lastMouseTime){let i=e-this.lastMouseTime;if(i>0){let o=t.clientX-this.lastMousePos.x,r=t.clientY-this.lastMousePos.y,a=Math.sqrt(o*o+r*r)/i;if(this.mouseVelocities.push({v:a,t:e}),this.eventDeltas.push(i),this.lastVelocity!==null){let c=(a-this.lastVelocity)/i;this.mouseAccelerations.push({a:c,t:e})}this.lastVelocity=a}}this.lastMousePos={x:t.clientX,y:t.clientY},this.lastMouseTime=e,this.mousePositions.length>500&&(this.mousePositions.shift(),this.mouseVelocities.length>500&&this.mouseVelocities.shift(),this.mouseAccelerations.length>500&&this.mouseAccelerations.shift())}recordMouseDown(t){this.clickData={x:t.clientX,y:t.clientY,button:t.button,downTime:performance.now()}}recordMouseUp(t){this.clickData&&(this.clickData.upTime=performance.now(),this.clickData.holdDuration=this.clickData.upTime-this.clickData.downTime)}recordScroll(t){this.scrollEvents.push({x:window.scrollX,y:window.scrollY,t:performance.now()}),this.scrollEvents.length>100&&this.scrollEvents.shift()}recordKeyEvent(t){this.keyEvents.push({type:t.type,keyLength:t.key?t.key.length:0,t:performance.now()})}recordTouch(t){let e=t.touches&&t.touches.length?t.touches:t.changedTouches;if(!e||e.length===0)return;e.length>1&&(this.touchMultiTouchSeen=!0);let n=e[0];typeof n.identifier=="number"&&this.touchIdentifiers.add(n.identifier),this.touchEvents.push({x:n.clientX,y:n.clientY,t:performance.now(),force:typeof n.force=="number"?n.force:0,radiusX:typeof n.radiusX=="number"?n.radiusX:0,radiusY:typeof n.radiusY=="number"?n.radiusY:0,rotationAngle:typeof n.rotationAngle=="number"?n.rotationAngle:0,identifier:typeof n.identifier=="number"?n.identifier:-1,touchCount:e.length}),this.touchEvents.length>500&&this.touchEvents.shift()}recordPointer(t){this.pointerPoints.push({x:t.clientX,y:t.clientY,t:performance.now(),type:t.type,pressure:typeof t.pressure=="number"?t.pressure:0,tiltX:typeof t.tiltX=="number"?t.tiltX:0,tiltY:typeof t.tiltY=="number"?t.tiltY:0,tangentialPressure:typeof t.tangentialPressure=="number"?t.tangentialPressure:0,pointerType:t.pointerType||"unknown"}),this.pointerPoints.length>500&&this.pointerPoints.shift()}recordFocus(t){var e;this.focusEvents.push({type:t.type,target:(e=t.target)==null?void 0:e.tagName,t:performance.now()})}analyze(){let t=this.mousePositions,e=this.mouseVelocities,n=this.mouseAccelerations;if(t.length<10)return this._getEmptyAnalysis();let i=0,o=0;e.length>0&&(i=e.reduce((f,d)=>f+d.v,0)/e.length,o=e.reduce((f,d)=>f+Math.pow(d.v-i,2),0)/e.length);let r=0,s=0;if(n.length>0){r=n.reduce((m,f)=>m+f.a,0)/n.length;for(let m=1;m<n.length;m++)Math.sign(n[m].a)!==Math.sign(n[m-1].a)&&s++}let a=this._detectMicroTremor(t),c=this._calculateStraightLineRatio(t),l=0;for(let m=1;m<t.length;m++){let f=Math.abs(t[m].x-t[m-1].x),d=Math.abs(t[m].y-t[m-1].y);f<3&&d<3&&(f>0||d>0)&&l++}let u=this._countDirectionChanges(t),v=this._variance(this.eventDeltas),p=t.length>1?t.length/((t[t.length-1].t-t[0].t)/1e3):0,y=0;for(let m=1;m<t.length;m++){let f=t[m].x-t[m-1].x,d=t[m].y-t[m-1].y;y+=Math.sqrt(f*f+d*d)}let w=this._analyzeTouchPoints(this.touchEvents),_=this._analyzePointerPoints(this.pointerPoints);return{totalPoints:t.length,trajectoryLength:y,avgVelocity:i,velocityVariance:o,avgAcceleration:r,accelerationChanges:s,microTremorScore:a,straightLineRatio:c,microMovements:l,directionChanges:u,eventDeltas:this.eventDeltas.slice(-50),eventDeltaVariance:v,mouseEventRate:p,scrollEvents:this.scrollEvents.length,keyEvents:this.keyEvents.length,touchEvents:this.touchEvents.length,focusEvents:this.focusEvents.length,clickData:this.clickData,interactionDuration:Date.now()-this.startTime,...w,..._}}_analyzeTouchPoints(t){if(!t||t.length===0)return{touchTotalPoints:0,touchTrajectoryLength:0,touchAvgVelocity:0,touchVelocityVariance:0,touchMicroTremorScore:0,touchStraightLineRatio:0,touchDirectionChanges:0,touchForceMin:0,touchForceMax:0,touchForceVariance:0,touchRadiusMin:0,touchRadiusMax:0,touchRadiusVariance:0,touchMultiTouchSeen:this.touchMultiTouchSeen,touchUniqueIdentifiers:this.touchIdentifiers.size,touchForceAllZero:!1,touchForceAllOne:!1};let e=0,n=[];for(let c=1;c<t.length;c++){let l=t[c].x-t[c-1].x,u=t[c].y-t[c-1].y,v=Math.sqrt(l*l+u*u);e+=v;let p=t[c].t-t[c-1].t;p>0&&n.push(v/p)}let i=n.length>0?n.reduce((c,l)=>c+l,0)/n.length:0,o=t.map(c=>c.force),r=t.map(c=>Math.max(c.radiusX||0,c.radiusY||0)),s=o.length>0&&o.every(c=>c===0),a=o.length>0&&o.every(c=>c===1);return{touchTotalPoints:t.length,touchTrajectoryLength:e,touchAvgVelocity:i,touchVelocityVariance:this._variance(n),touchMicroTremorScore:this._detectMicroTremor(t),touchStraightLineRatio:this._calculateStraightLineRatio(t),touchDirectionChanges:this._countDirectionChanges(t),touchForceMin:o.length>0?Math.min(...o):0,touchForceMax:o.length>0?Math.max(...o):0,touchForceVariance:this._variance(o),touchRadiusMin:r.length>0?Math.min(...r):0,touchRadiusMax:r.length>0?Math.max(...r):0,touchRadiusVariance:this._variance(r),touchMultiTouchSeen:this.touchMultiTouchSeen,touchUniqueIdentifiers:this.touchIdentifiers.size,touchForceAllZero:s,touchForceAllOne:a}}_analyzePointerPoints(t){if(!t||t.length===0)return{pointerEvents:0,pointerAvgPressure:0,pointerPressureVariance:0,pointerMaxTilt:0,pointerHasNonMouseType:!1,pointerTypes:[]};let e=t.map(r=>r.pressure),n=e.length>0?e.reduce((r,s)=>r+s,0)/e.length:0,i=0,o=new Set;for(let r of t){let s=Math.abs(r.tiltX||0)+Math.abs(r.tiltY||0);s>i&&(i=s),r.pointerType&&o.add(r.pointerType)}return{pointerEvents:t.length,pointerAvgPressure:n,pointerPressureVariance:this._variance(e),pointerMaxTilt:i,pointerHasNonMouseType:Array.from(o).some(r=>r!=="mouse"&&r!=="unknown"),pointerTypes:Array.from(o)}}analyzeClick(t,e,n){let i=this.mousePositions;if(i.length<5)return this._getEmptyClickAnalysis();let o=i.slice(-20),r=n.left+n.width/2,s=n.top+n.height/2,a=Math.sqrt(Math.pow(t-r,2)+Math.pow(e-s,2)),c=0,l=0;for(let d=1;d<i.length;d++){let g=Math.sqrt(Math.pow(i[d].x-i[d-1].x,2)+Math.pow(i[d].y-i[d-1].y,2));l+=g,i[d].x>=n.left&&i[d].x<=n.right&&i[d].y>=n.top&&i[d].y<=n.bottom||(c+=g)}let u=l>0?c/l:0,v=0,p=!1,y=!1;for(let d of o){let g=d.x>=n.left&&d.x<=n.right&&d.y>=n.top&&d.y<=n.bottom;p&&!g&&(y=!0),y&&g&&(v++,y=!1),p=g}let w=0;for(let d=o.length-1;d>=0;d--){let g=o[d],L=g.x>=n.left&&g.x<=n.right&&g.y>=n.top&&g.y<=n.bottom;if(L&&d<o.length-1)w=o[o.length-1].t-g.t;else if(!L)break}let _=Math.sqrt(Math.pow(o[o.length-1].x-o[0].x,2)+Math.pow(o[o.length-1].y-o[0].y,2)),m=0;for(let d=1;d<o.length;d++)m+=Math.sqrt(Math.pow(o[d].x-o[d-1].x,2)+Math.pow(o[d].y-o[d-1].y,2));let f=m>0?_/m:1;return{clickPrecision:a,explorationRatio:u,overshootCorrections:v,hoverTime:w,approachDirectness:f,approachPoints:o.length}}_detectMicroTremor(t){if(t.length<20)return .5;let e=5,n=0;for(let o=e;o<t.length-e;o++){let r=0,s=0;for(let c=o-e;c<=o+e;c++)r+=t[c].x,s+=t[c].y;r/=e*2+1,s/=e*2+1;let a=Math.sqrt(Math.pow(t[o].x-r,2)+Math.pow(t[o].y-s,2));n+=a}let i=n/(t.length-e*2);return Math.min(1,i/2)}_calculateStraightLineRatio(t){if(t.length<3)return 0;let e=0,n=0;for(let i=2;i<t.length;i++){let o=t[i-2],r=t[i-1],s=t[i],a=Math.atan2(r.y-o.y,r.x-o.x),c=Math.atan2(s.y-r.y,s.x-r.x),l=Math.abs(c-a);n++,l<.1&&e++}return n>0?e/n:0}_countDirectionChanges(t){let e=0;for(let n=2;n<t.length;n++){let i=Math.atan2(t[n-1].y-t[n-2].y,t[n-1].x-t[n-2].x),o=Math.atan2(t[n].y-t[n-1].y,t[n].x-t[n-1].x);Math.abs(o-i)>Math.PI/6&&e++}return e}_variance(t){if(t.length===0)return 0;let e=t.reduce((n,i)=>n+i,0)/t.length;return t.reduce((n,i)=>n+Math.pow(i-e,2),0)/t.length}_getEmptyAnalysis(){return{totalPoints:0,trajectoryLength:0,avgVelocity:0,velocityVariance:0,avgAcceleration:0,accelerationChanges:0,microTremorScore:.5,straightLineRatio:0,microMovements:0,directionChanges:0,eventDeltas:[],eventDeltaVariance:0,mouseEventRate:0,scrollEvents:this.scrollEvents.length,keyEvents:this.keyEvents.length,touchEvents:this.touchEvents.length,focusEvents:this.focusEvents.length,clickData:this.clickData,interactionDuration:Date.now()-this.startTime,...this._analyzeTouchPoints(this.touchEvents),...this._analyzePointerPoints(this.pointerPoints)}}_getEmptyClickAnalysis(){return{clickPrecision:0,explorationRatio:0,overshootCorrections:0,hoverTime:0,approachDirectness:1,approachPoints:0}}};var E=class{collect(){return{webdriver:this._detectWebdriver(),automationFlags:this._getAutomationFlags(),cdp:this._detectCDP(),playwright:this._detectPlaywright(),canvasHash:this._getCanvasHash(),webglInfo:this._getWebGLInfo(),audioInfo:this._getAudioInfo(),headlessIndicators:this._getHeadlessIndicators(),screen:this._getScreenInfo(),navigator:this._getNavigatorInfo(),jsExecutionTime:this._measureJSExecution(),mathFingerprint:this._getMathFingerprint(),errorFingerprint:this._getErrorFingerprint(),domRectFingerprint:this._getDOMRectFingerprint(),cssMediaQueries:this._getCSSMediaQueries(),permissionsInfo:this._getPermissionsInfo(),fontsInfo:this._getFontsInfo()}}async collectAsync(){let[t,e,n]=await Promise.all([this._getSpeechInfo(),this._getWebRTCInfo(),this._checkWorkerConsistency()]);return{speechInfo:t,webrtcInfo:e,workerConsistency:n}}_detectWebdriver(){let t=navigator,e=window;return!!(t.webdriver||e.document.__webdriver_evaluate||e.document.__selenium_evaluate||e.document.__webdriver_script_fn||e.document.__webdriver_script_func||e.document.__webdriver_script_function||e.document.$cdc_asdjflasutopfhvcZLmcfl_||e.document.$wdc_||e._Selenium_IDE_Recorder||e._phantom||e.__nightmare||e.callPhantom||e._phantom)}_getAutomationFlags(){let t=navigator,e=window;return{webdriver:!!t.webdriver,domAutomation:!!e.domAutomation,domAutomationController:!!e.domAutomationController,_selenium:!!e._selenium,__webdriver_script_fn:!!e.__webdriver_script_fn,__driver_evaluate:!!e.__driver_evaluate,__webdriver_evaluate:!!e.__webdriver_evaluate,__fxdriver_evaluate:!!e.__fxdriver_evaluate,__driver_unwrapped:!!e.__driver_unwrapped,__webdriver_unwrapped:!!e.__webdriver_unwrapped,__fxdriver_unwrapped:!!e.__fxdriver_unwrapped,_Selenium_IDE_Recorder:!!e._Selenium_IDE_Recorder,calledSelenium:!!e.calledSelenium,$chrome_asyncScriptInfo:!!e.$chrome_asyncScriptInfo,$cdc_asdjflasutopfhvcZLmcfl_:!!e.$cdc_asdjflasutopfhvcZLmcfl_,_phantom:!!e._phantom,callPhantom:!!e.callPhantom,__nightmare:!!e.__nightmare,__lastWatirAlert:!!e.__lastWatirAlert,__lastWatirConfirm:!!e.__lastWatirConfirm,__lastWatirPrompt:!!e.__lastWatirPrompt,plugins:navigator.plugins?navigator.plugins.length:0,languages:navigator.languages&&navigator.languages.length>0,mimeTypes:navigator.mimeTypes?navigator.mimeTypes.length:0,cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack,chrome:!!e.chrome,chromeRuntime:!!(e.chrome&&e.chrome.runtime&&e.chrome.runtime.id),permissionsAPI:!!navigator.permissions}}_detectPlaywright(){try{let t=window,e=[];Object.getOwnPropertyNames(window).filter(s=>s.startsWith("__pw")||s.startsWith("__playwright")).length>0&&e.push("playwright_globals");let i=Object.getPrototypeOf(navigator),o=Object.getOwnPropertyDescriptor(i,"webdriver");return o?o.configurable!==!1&&e.push("webdriver_configurable"):e.push("webdriver_deleted"),/Chrome\//.test(navigator.userAgent)&&!/Edg\//.test(navigator.userAgent)&&t.chrome&&!t.chrome.runtime&&e.push("chrome_runtime_missing"),{detected:e.length>0,signals:e}}catch{return{detected:!1,signals:[]}}}_detectCDP(){try{let t=window,e=[];Object.keys(window).filter(i=>i.startsWith("cdc_")).length>0&&e.push("chromedriver_cdc"),"__webdriver_evaluate"in window&&e.push("selenium_evaluate"),"__driver_evaluate"in window&&e.push("selenium_driver_evaluate"),"__webdriver_unwrapped"in window&&e.push("selenium_unwrapped"),"__driver_unwrapped"in window&&e.push("selenium_driver_unwrapped"),"__selenium_evaluate"in window&&e.push("selenium_direct"),"__fxdriver_evaluate"in window&&e.push("firefox_driver"),"__fxdriver_unwrapped"in window&&e.push("firefox_driver_unwrapped"),"__puppeteer_evaluation_script__"in window&&e.push("puppeteer_eval"),document.__webdriver_script_fn&&e.push("cdp_script_injection");try{let i=Object.getOwnPropertyDescriptor(navigator,"webdriver");i&&typeof i.get=="function"&&i.get.toString().indexOf("[native code]")===-1&&e.push("webdriver_getter_modified")}catch{}return{detected:e.length>0,signals:e}}catch{return{detected:!1,signals:[]}}}_getCanvasHash(){try{let t=document.createElement("canvas");t.width=200,t.height=50;let e=t.getContext("2d");e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("FCaptcha",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("FCaptcha",4,17);let n=t.toDataURL(),i=0;for(let o=0;o<n.length;o++)i=(i<<5)-i+n.charCodeAt(o),i=i&i;return{hash:i.toString(16),dataLength:n.length,supported:!0}}catch{return{error:!0,supported:!1}}}_getWebGLInfo(){try{let t=document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");if(!e)return{supported:!1};let n=e.getExtension("WEBGL_debug_renderer_info"),i=n?e.getParameter(n.UNMASKED_VENDOR_WEBGL):"unknown",o=n?e.getParameter(n.UNMASKED_RENDERER_WEBGL):"unknown",r=o.toLowerCase(),s=r.includes("swiftshader")||r.includes("llvmpipe")||r.includes("softpipe")||r.includes("virtualbox")||r.includes("vmware");return{supported:!0,vendor:i,renderer:o,version:e.getParameter(e.VERSION),shadingVersion:e.getParameter(e.SHADING_LANGUAGE_VERSION),suspiciousRenderer:s}}catch{return{supported:!1,error:!0}}}_getAudioInfo(){try{let t=window,e=t.AudioContext||t.webkitAudioContext;if(!e)return{supported:!1};let n=new e,i={supported:!0,sampleRate:n.sampleRate,state:n.state,baseLatency:n.baseLatency};return n.close(),i}catch{return{supported:!1,error:!0}}}_getHeadlessIndicators(){let t=navigator;return{hasOuterDimensions:window.outerWidth>0&&window.outerHeight>0,innerEqualsOuter:window.innerWidth===window.outerWidth&&window.innerHeight===window.outerHeight,screenColorDepth:window.screen.colorDepth,screenPixelDepth:window.screen.pixelDepth,connectionType:t.connection?t.connection.type:"unknown",connectionRtt:t.connection?t.connection.rtt:-1,notificationPermission:typeof Notification!="undefined"?Notification.permission:"unsupported",hasBattery:"getBattery"in navigator,hasCredentials:"credentials"in navigator,hasMediaDevices:"mediaDevices"in navigator}}_getScreenInfo(){return{width:screen.width,height:screen.height,colorDepth:screen.colorDepth,pixelRatio:window.devicePixelRatio,availWidth:screen.availWidth,availHeight:screen.availHeight,innerWidth:window.innerWidth,innerHeight:window.innerHeight}}_getNavigatorInfo(){var e;let t=navigator;return{language:navigator.language,languageCount:((e=navigator.languages)==null?void 0:e.length)||0,platform:navigator.platform,hardwareConcurrency:navigator.hardwareConcurrency,deviceMemory:t.deviceMemory,maxTouchPoints:navigator.maxTouchPoints||0,vendor:navigator.vendor,userAgent:navigator.userAgent,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()}}_measureJSExecution(){let t={},e=performance.now();for(let o=0;o<1e3;o++)Math.sqrt(o)*Math.sin(o);t.mathOps=performance.now()-e,e=performance.now();let n=[];for(let o=0;o<1e3;o++)n.push(o);t.arrayOps=performance.now()-e,t.arrayLen=n.length,e=performance.now();let i="";for(let o=0;o<100;o++)i+="a";return t.stringOps=performance.now()-e,t}async measureRAFConsistency(){return new Promise(t=>{let e=[],n=0,i=10;function o(r){if(e.push(r),n++,n<i)requestAnimationFrame(o);else{let s=[];for(let l=1;l<e.length;l++)s.push(e[l]-e[l-1]);let a=s.reduce((l,u)=>l+u,0)/s.length,c=s.reduce((l,u)=>l+Math.pow(u-a,2),0)/s.length;t({avgFrameTime:a,frameTimeVariance:c,frames:i})}}requestAnimationFrame(o)})}_getMathFingerprint(){try{let t={acos:Math.acos(.123456789),acosh:Math.acosh(1e308),asin:Math.asin(.123456789),asinh:Math.asinh(1),atanh:Math.atanh(.5),cbrt:Math.cbrt(100),cosh:Math.cosh(1),expm1:Math.expm1(1),log1p:Math.log1p(10),sinh:Math.sinh(1),tan:Math.tan(-1e308),tanh:Math.tanh(1),pow:Math.pow(Math.PI,-100),sin:Math.sin(Math.PI)},e=Object.values(t).map(i=>String(i)).join(","),n=0;for(let i=0;i<e.length;i++)n=(n<<5)-n+e.charCodeAt(i),n=n&n;return{hash:n.toString(16),sinPi:t.sin,tanLarge:t.tan,supported:!0}}catch{return{supported:!1,error:!0}}}_getErrorFingerprint(){try{let t={};try{null.foo}catch(i){t.typeError=i.message}try{[].length=-1}catch(i){t.rangeError=i.message}try{decodeURIComponent("%")}catch(i){t.uriError=i.message}try{({}).undefinedMethod()}catch(i){t.refTypeError=i.message}let e=Object.values(t).join("|"),n=0;for(let i=0;i<e.length;i++)n=(n<<5)-n+e.charCodeAt(i),n=n&n;return{hash:n.toString(16),typeError:t.typeError,supported:!0}}catch{return{supported:!1,error:!0}}}_getDOMRectFingerprint(){try{let t=document.createElement("div");t.style.cssText="position:absolute;left:-9999px;font-size:16px;font-family:Arial,sans-serif;";let e=document.createElement("span");e.textContent="FCaptcha Test String 123",t.appendChild(e);let n=document.createElement("span");n.style.cssText="letter-spacing:1px;word-spacing:2px;",n.textContent="WWWW 0000",t.appendChild(n),document.body.appendChild(t);let i=e.getBoundingClientRect(),o=n.getBoundingClientRect(),r=document.createRange();r.selectNode(e);let s=r.getBoundingClientRect();document.body.removeChild(t);let c=[i.width,i.height,i.x,i.y,o.width,o.height,s.width,s.height].map(u=>u.toFixed(6)).join(","),l=0;for(let u=0;u<c.length;u++)l=(l<<5)-l+c.charCodeAt(u),l=l&l;return{hash:l.toString(16),rectAWidth:i.width,rectBWidth:o.width,rangeWidth:s.width,supported:!0}}catch{return{supported:!1,error:!0}}}_getCSSMediaQueries(){try{return{...{prefersColorScheme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",prefersReducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,prefersReducedTransparency:window.matchMedia("(prefers-reduced-transparency: reduce)").matches,prefersContrast:window.matchMedia("(prefers-contrast: more)").matches?"more":window.matchMedia("(prefers-contrast: less)").matches?"less":"no-preference",anyHover:window.matchMedia("(any-hover: hover)").matches,anyPointer:window.matchMedia("(any-pointer: fine)").matches?"fine":window.matchMedia("(any-pointer: coarse)").matches?"coarse":"none",hover:window.matchMedia("(hover: hover)").matches,pointer:window.matchMedia("(pointer: fine)").matches?"fine":window.matchMedia("(pointer: coarse)").matches?"coarse":"none",colorGamut:window.matchMedia("(color-gamut: p3)").matches?"p3":window.matchMedia("(color-gamut: srgb)").matches?"srgb":"none",displayMode:window.matchMedia("(display-mode: standalone)").matches?"standalone":window.matchMedia("(display-mode: fullscreen)").matches?"fullscreen":"browser",orientation:window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape",dynamicRange:window.matchMedia("(dynamic-range: high)").matches?"high":"standard",forcedColors:window.matchMedia("(forced-colors: active)").matches},supported:!0}}catch{return{supported:!1,error:!0}}}_getPermissionsInfo(){try{return{hasPermissionsAPI:"permissions"in navigator,hasClipboard:"clipboard"in navigator,hasShare:"share"in navigator,hasCredentials:"credentials"in navigator,hasBluetooth:"bluetooth"in navigator,hasUsb:"usb"in navigator,hasSerial:"serial"in navigator,hasHid:"hid"in navigator,hasXR:"xr"in navigator,hasGeolocation:"geolocation"in navigator,hasMIDI:"requestMIDIAccess"in navigator,supported:!0}}catch{return{supported:!1,error:!0}}}_getFontsInfo(){try{let t=["monospace","sans-serif","serif"],e=["Arial","Helvetica","Times New Roman","Courier New","Georgia","Verdana","Trebuchet MS","Comic Sans MS","Impact","Lucida Console","Menlo","Monaco","SF Pro","Helvetica Neue","Segoe UI","Consolas","Calibri","Cambria","DejaVu Sans","Liberation Sans","Ubuntu","Cantarell","MS Gothic","Meiryo","SimHei","Microsoft YaHei"],n=document.createElement("canvas");n.width=400,n.height=40;let i=n.getContext("2d"),o="mmMWWLLiiff00",r="72px",s={};for(let u of t)i.font=r+" "+u,s[u]=i.measureText(o).width;let a=[];for(let u of e){let v=!1;for(let p of t)if(i.font=r+' "'+u+'", '+p,i.measureText(o).width!==s[p]){v=!0;break}v&&a.push(u)}let c=a.join(","),l=0;for(let u=0;u<c.length;u++)l=(l<<5)-l+c.charCodeAt(u),l=l&l;return{hash:l.toString(16),count:a.length,hasArial:a.includes("Arial"),hasTimesNewRoman:a.includes("Times New Roman"),hasSegoeUI:a.includes("Segoe UI"),hasSFPro:a.includes("SF Pro"),hasDejaVuSans:a.includes("DejaVu Sans"),supported:!0}}catch{return{supported:!1,error:!0}}}async _getSpeechInfo(){try{if(!("speechSynthesis"in window))return{supported:!1};let e=await new Promise(a=>{let c=speechSynthesis.getVoices();if(c.length>0){a(c);return}let l=setTimeout(()=>a([]),1e3);speechSynthesis.onvoiceschanged=()=>{clearTimeout(l),a(speechSynthesis.getVoices())}}),n=e.filter(a=>a.localService),i=e.find(a=>a.default),o=[...new Set(e.map(a=>a.lang))],r=e.map(a=>a.name).sort().join(","),s=0;for(let a=0;a<r.length;a++)s=(s<<5)-s+r.charCodeAt(a),s=s&s;return{hash:s.toString(16),totalVoices:e.length,localVoices:n.length,languages:o.length,defaultVoiceLang:(i==null?void 0:i.lang)||null,hasGoogleVoices:e.some(a=>a.name.includes("Google")),hasMicrosoftVoices:e.some(a=>a.name.includes("Microsoft")),hasAppleVoices:e.some(a=>a.name.includes("Samantha")||a.name.includes("Alex")),supported:!0}}catch{return{supported:!1,error:!0}}}async _getWebRTCInfo(){try{let t={supported:"RTCPeerConnection"in window,mediaDevices:{supported:!1},localIPs:[]};if(!t.supported)return t;if(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)try{let e=await navigator.mediaDevices.enumerateDevices();t.mediaDevices={supported:!0,audioInputs:e.filter(n=>n.kind==="audioinput").length,audioOutputs:e.filter(n=>n.kind==="audiooutput").length,videoInputs:e.filter(n=>n.kind==="videoinput").length,totalDevices:e.length}}catch{t.mediaDevices={supported:!1,error:!0}}try{let e=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]}),n=new Set;e.onicecandidate=i=>{if(i.candidate){let o=i.candidate.candidate,r=/([0-9]{1,3}\.){3}[0-9]{1,3}/g,s=o.match(r);s&&s.forEach(a=>{(a.startsWith("192.168.")||a.startsWith("10.")||a.startsWith("172.")||a.startsWith("169.254."))&&n.add(a)})}},e.createDataChannel(""),await e.createOffer().then(i=>e.setLocalDescription(i)),await new Promise(i=>setTimeout(i,500)),t.localIPs=Array.from(n),t.hasLocalIP=n.size>0,e.close()}catch{t.localIPError=!0}return t}catch{return{supported:!1,error:!0}}}async _checkWorkerConsistency(){try{if(typeof Worker=="undefined")return{supported:!1};let t=navigator,e=`
1
+ "use strict";var WebDecoyCaptchaBundle=(()=>{var O=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var $=(h,t)=>{for(var e in t)O(h,e,{get:t[e],enumerable:!0})},X=(h,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of B(t))!q.call(h,i)&&i!==e&&O(h,i,{get:()=>t[i],enumerable:!(n=N(t,i))||n.enumerable});return h};var Y=h=>X(O({},"__esModule",{value:!0}),h);var G={};$(G,{WebDecoyCaptcha:()=>R});var S=class{constructor(){this.mousePositions=[],this.mouseVelocities=[],this.mouseAccelerations=[],this.scrollEvents=[],this.keyEvents=[],this.touchEvents=[],this.touchMultiTouchSeen=!1,this.touchIdentifiers=new Set,this.pointerPoints=[],this.focusEvents=[],this.clickData=null,this.startTime=Date.now(),this.lastMousePos=null,this.lastMouseTime=null,this.lastVelocity=null,this.eventDeltas=[]}recordMouseMove(t){let e=performance.now(),n={x:t.clientX,y:t.clientY,t:e};if(this.mousePositions.push(n),this.lastMousePos&&this.lastMouseTime){let i=e-this.lastMouseTime;if(i>0){let o=t.clientX-this.lastMousePos.x,r=t.clientY-this.lastMousePos.y,a=Math.sqrt(o*o+r*r)/i;if(this.mouseVelocities.push({v:a,t:e}),this.eventDeltas.push(i),this.lastVelocity!==null){let c=(a-this.lastVelocity)/i;this.mouseAccelerations.push({a:c,t:e})}this.lastVelocity=a}}this.lastMousePos={x:t.clientX,y:t.clientY},this.lastMouseTime=e,this.mousePositions.length>500&&(this.mousePositions.shift(),this.mouseVelocities.length>500&&this.mouseVelocities.shift(),this.mouseAccelerations.length>500&&this.mouseAccelerations.shift())}recordMouseDown(t){this.clickData={x:t.clientX,y:t.clientY,button:t.button,downTime:performance.now()}}recordMouseUp(t){this.clickData&&(this.clickData.upTime=performance.now(),this.clickData.holdDuration=this.clickData.upTime-this.clickData.downTime)}recordScroll(t){this.scrollEvents.push({x:window.scrollX,y:window.scrollY,t:performance.now()}),this.scrollEvents.length>100&&this.scrollEvents.shift()}recordKeyEvent(t){this.keyEvents.push({type:t.type,keyLength:t.key?t.key.length:0,t:performance.now()})}recordTouch(t){let e=t.touches&&t.touches.length?t.touches:t.changedTouches;if(!e||e.length===0)return;e.length>1&&(this.touchMultiTouchSeen=!0);let n=e[0];typeof n.identifier=="number"&&this.touchIdentifiers.add(n.identifier),this.touchEvents.push({x:n.clientX,y:n.clientY,t:performance.now(),force:typeof n.force=="number"?n.force:0,radiusX:typeof n.radiusX=="number"?n.radiusX:0,radiusY:typeof n.radiusY=="number"?n.radiusY:0,rotationAngle:typeof n.rotationAngle=="number"?n.rotationAngle:0,identifier:typeof n.identifier=="number"?n.identifier:-1,touchCount:e.length}),this.touchEvents.length>500&&this.touchEvents.shift()}recordPointer(t){this.pointerPoints.push({x:t.clientX,y:t.clientY,t:performance.now(),type:t.type,pressure:typeof t.pressure=="number"?t.pressure:0,tiltX:typeof t.tiltX=="number"?t.tiltX:0,tiltY:typeof t.tiltY=="number"?t.tiltY:0,tangentialPressure:typeof t.tangentialPressure=="number"?t.tangentialPressure:0,pointerType:t.pointerType||"unknown"}),this.pointerPoints.length>500&&this.pointerPoints.shift()}recordFocus(t){var e;this.focusEvents.push({type:t.type,target:(e=t.target)==null?void 0:e.tagName,t:performance.now()})}analyze(){let t=this.mousePositions,e=this.mouseVelocities,n=this.mouseAccelerations;if(t.length<10)return this._getEmptyAnalysis();let i=0,o=0;e.length>0&&(i=e.reduce((f,d)=>f+d.v,0)/e.length,o=e.reduce((f,d)=>f+Math.pow(d.v-i,2),0)/e.length);let r=0,s=0;if(n.length>0){r=n.reduce((m,f)=>m+f.a,0)/n.length;for(let m=1;m<n.length;m++)Math.sign(n[m].a)!==Math.sign(n[m-1].a)&&s++}let a=this._detectMicroTremor(t),c=this._calculateStraightLineRatio(t),l=0;for(let m=1;m<t.length;m++){let f=Math.abs(t[m].x-t[m-1].x),d=Math.abs(t[m].y-t[m-1].y);f<3&&d<3&&(f>0||d>0)&&l++}let u=this._countDirectionChanges(t),v=this._variance(this.eventDeltas),p=t.length>1?t.length/((t[t.length-1].t-t[0].t)/1e3):0,y=0;for(let m=1;m<t.length;m++){let f=t[m].x-t[m-1].x,d=t[m].y-t[m-1].y;y+=Math.sqrt(f*f+d*d)}let w=this._analyzeTouchPoints(this.touchEvents),_=this._analyzePointerPoints(this.pointerPoints);return{totalPoints:t.length,trajectoryLength:y,avgVelocity:i,velocityVariance:o,avgAcceleration:r,accelerationChanges:s,microTremorScore:a,straightLineRatio:c,microMovements:l,directionChanges:u,eventDeltas:this.eventDeltas.slice(-50),eventDeltaVariance:v,mouseEventRate:p,scrollEvents:this.scrollEvents.length,keyEvents:this.keyEvents.length,touchEvents:this.touchEvents.length,focusEvents:this.focusEvents.length,clickData:this.clickData,interactionDuration:Date.now()-this.startTime,...w,..._}}_analyzeTouchPoints(t){if(!t||t.length===0)return{touchTotalPoints:0,touchTrajectoryLength:0,touchAvgVelocity:0,touchVelocityVariance:0,touchMicroTremorScore:0,touchStraightLineRatio:0,touchDirectionChanges:0,touchForceMin:0,touchForceMax:0,touchForceVariance:0,touchRadiusMin:0,touchRadiusMax:0,touchRadiusVariance:0,touchMultiTouchSeen:this.touchMultiTouchSeen,touchUniqueIdentifiers:this.touchIdentifiers.size,touchForceAllZero:!1,touchForceAllOne:!1};let e=0,n=[];for(let c=1;c<t.length;c++){let l=t[c].x-t[c-1].x,u=t[c].y-t[c-1].y,v=Math.sqrt(l*l+u*u);e+=v;let p=t[c].t-t[c-1].t;p>0&&n.push(v/p)}let i=n.length>0?n.reduce((c,l)=>c+l,0)/n.length:0,o=t.map(c=>c.force),r=t.map(c=>Math.max(c.radiusX||0,c.radiusY||0)),s=o.length>0&&o.every(c=>c===0),a=o.length>0&&o.every(c=>c===1);return{touchTotalPoints:t.length,touchTrajectoryLength:e,touchAvgVelocity:i,touchVelocityVariance:this._variance(n),touchMicroTremorScore:this._detectMicroTremor(t),touchStraightLineRatio:this._calculateStraightLineRatio(t),touchDirectionChanges:this._countDirectionChanges(t),touchForceMin:o.length>0?Math.min(...o):0,touchForceMax:o.length>0?Math.max(...o):0,touchForceVariance:this._variance(o),touchRadiusMin:r.length>0?Math.min(...r):0,touchRadiusMax:r.length>0?Math.max(...r):0,touchRadiusVariance:this._variance(r),touchMultiTouchSeen:this.touchMultiTouchSeen,touchUniqueIdentifiers:this.touchIdentifiers.size,touchForceAllZero:s,touchForceAllOne:a}}_analyzePointerPoints(t){if(!t||t.length===0)return{pointerEvents:0,pointerAvgPressure:0,pointerPressureVariance:0,pointerMaxTilt:0,pointerHasNonMouseType:!1,pointerTypes:[]};let e=t.map(r=>r.pressure),n=e.length>0?e.reduce((r,s)=>r+s,0)/e.length:0,i=0,o=new Set;for(let r of t){let s=Math.abs(r.tiltX||0)+Math.abs(r.tiltY||0);s>i&&(i=s),r.pointerType&&o.add(r.pointerType)}return{pointerEvents:t.length,pointerAvgPressure:n,pointerPressureVariance:this._variance(e),pointerMaxTilt:i,pointerHasNonMouseType:Array.from(o).some(r=>r!=="mouse"&&r!=="unknown"),pointerTypes:Array.from(o)}}analyzeClick(t,e,n){let i=this.mousePositions;if(i.length<5)return this._getEmptyClickAnalysis();let o=i.slice(-20),r=n.left+n.width/2,s=n.top+n.height/2,a=Math.sqrt(Math.pow(t-r,2)+Math.pow(e-s,2)),c=0,l=0;for(let d=1;d<i.length;d++){let g=Math.sqrt(Math.pow(i[d].x-i[d-1].x,2)+Math.pow(i[d].y-i[d-1].y,2));l+=g,i[d].x>=n.left&&i[d].x<=n.right&&i[d].y>=n.top&&i[d].y<=n.bottom||(c+=g)}let u=l>0?c/l:0,v=0,p=!1,y=!1;for(let d of o){let g=d.x>=n.left&&d.x<=n.right&&d.y>=n.top&&d.y<=n.bottom;p&&!g&&(y=!0),y&&g&&(v++,y=!1),p=g}let w=0;for(let d=o.length-1;d>=0;d--){let g=o[d],L=g.x>=n.left&&g.x<=n.right&&g.y>=n.top&&g.y<=n.bottom;if(L&&d<o.length-1)w=o[o.length-1].t-g.t;else if(!L)break}let _=Math.sqrt(Math.pow(o[o.length-1].x-o[0].x,2)+Math.pow(o[o.length-1].y-o[0].y,2)),m=0;for(let d=1;d<o.length;d++)m+=Math.sqrt(Math.pow(o[d].x-o[d-1].x,2)+Math.pow(o[d].y-o[d-1].y,2));let f=m>0?_/m:1;return{clickPrecision:a,explorationRatio:u,overshootCorrections:v,hoverTime:w,approachDirectness:f,approachPoints:o.length}}_detectMicroTremor(t){if(t.length<20)return .5;let e=5,n=0;for(let o=e;o<t.length-e;o++){let r=0,s=0;for(let c=o-e;c<=o+e;c++)r+=t[c].x,s+=t[c].y;r/=e*2+1,s/=e*2+1;let a=Math.sqrt(Math.pow(t[o].x-r,2)+Math.pow(t[o].y-s,2));n+=a}let i=n/(t.length-e*2);return Math.min(1,i/2)}_calculateStraightLineRatio(t){if(t.length<3)return 0;let e=0,n=0;for(let i=2;i<t.length;i++){let o=t[i-2],r=t[i-1],s=t[i],a=Math.atan2(r.y-o.y,r.x-o.x),c=Math.atan2(s.y-r.y,s.x-r.x),l=Math.abs(c-a);n++,l<.1&&e++}return n>0?e/n:0}_countDirectionChanges(t){let e=0;for(let n=2;n<t.length;n++){let i=Math.atan2(t[n-1].y-t[n-2].y,t[n-1].x-t[n-2].x),o=Math.atan2(t[n].y-t[n-1].y,t[n].x-t[n-1].x);Math.abs(o-i)>Math.PI/6&&e++}return e}_variance(t){if(t.length===0)return 0;let e=t.reduce((n,i)=>n+i,0)/t.length;return t.reduce((n,i)=>n+Math.pow(i-e,2),0)/t.length}_getEmptyAnalysis(){return{totalPoints:0,trajectoryLength:0,avgVelocity:0,velocityVariance:0,avgAcceleration:0,accelerationChanges:0,microTremorScore:.5,straightLineRatio:0,microMovements:0,directionChanges:0,eventDeltas:[],eventDeltaVariance:0,mouseEventRate:0,scrollEvents:this.scrollEvents.length,keyEvents:this.keyEvents.length,touchEvents:this.touchEvents.length,focusEvents:this.focusEvents.length,clickData:this.clickData,interactionDuration:Date.now()-this.startTime,...this._analyzeTouchPoints(this.touchEvents),...this._analyzePointerPoints(this.pointerPoints)}}_getEmptyClickAnalysis(){return{clickPrecision:0,explorationRatio:0,overshootCorrections:0,hoverTime:0,approachDirectness:1,approachPoints:0}}};var E=class{collect(){return{webdriver:this._detectWebdriver(),automationFlags:this._getAutomationFlags(),cdp:this._detectCDP(),playwright:this._detectPlaywright(),canvasHash:this._getCanvasHash(),webglInfo:this._getWebGLInfo(),audioInfo:this._getAudioInfo(),headlessIndicators:this._getHeadlessIndicators(),screen:this._getScreenInfo(),navigator:this._getNavigatorInfo(),jsExecutionTime:this._measureJSExecution(),mathFingerprint:this._getMathFingerprint(),errorFingerprint:this._getErrorFingerprint(),domRectFingerprint:this._getDOMRectFingerprint(),cssMediaQueries:this._getCSSMediaQueries(),permissionsInfo:this._getPermissionsInfo(),fontsInfo:this._getFontsInfo(),lieDetection:this._getLieDetection()}}async collectAsync(){let[t,e,n]=await Promise.all([this._getSpeechInfo(),this._getWebRTCInfo(),this._checkWorkerConsistency()]);return{speechInfo:t,webrtcInfo:e,workerConsistency:n}}_detectWebdriver(){let t=navigator,e=window;return!!(t.webdriver||e.document.__webdriver_evaluate||e.document.__selenium_evaluate||e.document.__webdriver_script_fn||e.document.__webdriver_script_func||e.document.__webdriver_script_function||e.document.$cdc_asdjflasutopfhvcZLmcfl_||e.document.$wdc_||e._Selenium_IDE_Recorder||e._phantom||e.__nightmare||e.callPhantom||e._phantom)}_getAutomationFlags(){let t=navigator,e=window;return{webdriver:!!t.webdriver,domAutomation:!!e.domAutomation,domAutomationController:!!e.domAutomationController,_selenium:!!e._selenium,__webdriver_script_fn:!!e.__webdriver_script_fn,__driver_evaluate:!!e.__driver_evaluate,__webdriver_evaluate:!!e.__webdriver_evaluate,__fxdriver_evaluate:!!e.__fxdriver_evaluate,__driver_unwrapped:!!e.__driver_unwrapped,__webdriver_unwrapped:!!e.__webdriver_unwrapped,__fxdriver_unwrapped:!!e.__fxdriver_unwrapped,_Selenium_IDE_Recorder:!!e._Selenium_IDE_Recorder,calledSelenium:!!e.calledSelenium,$chrome_asyncScriptInfo:!!e.$chrome_asyncScriptInfo,$cdc_asdjflasutopfhvcZLmcfl_:!!e.$cdc_asdjflasutopfhvcZLmcfl_,_phantom:!!e._phantom,callPhantom:!!e.callPhantom,__nightmare:!!e.__nightmare,__lastWatirAlert:!!e.__lastWatirAlert,__lastWatirConfirm:!!e.__lastWatirConfirm,__lastWatirPrompt:!!e.__lastWatirPrompt,plugins:navigator.plugins?navigator.plugins.length:0,languages:navigator.languages&&navigator.languages.length>0,mimeTypes:navigator.mimeTypes?navigator.mimeTypes.length:0,cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack,chrome:!!e.chrome,chromeRuntime:!!(e.chrome&&e.chrome.runtime&&e.chrome.runtime.id),permissionsAPI:!!navigator.permissions}}_detectPlaywright(){try{let t=window,e=[];Object.getOwnPropertyNames(window).filter(r=>r.startsWith("__pw")||r.startsWith("__playwright")).length>0&&e.push("playwright_globals");let i=Object.getPrototypeOf(navigator);return Object.getOwnPropertyDescriptor(i,"webdriver")||e.push("webdriver_deleted"),{detected:e.length>0,signals:e}}catch{return{detected:!1,signals:[]}}}_detectCDP(){try{let t=window,e=[];Object.keys(window).filter(i=>i.startsWith("cdc_")).length>0&&e.push("chromedriver_cdc"),"__webdriver_evaluate"in window&&e.push("selenium_evaluate"),"__driver_evaluate"in window&&e.push("selenium_driver_evaluate"),"__webdriver_unwrapped"in window&&e.push("selenium_unwrapped"),"__driver_unwrapped"in window&&e.push("selenium_driver_unwrapped"),"__selenium_evaluate"in window&&e.push("selenium_direct"),"__fxdriver_evaluate"in window&&e.push("firefox_driver"),"__fxdriver_unwrapped"in window&&e.push("firefox_driver_unwrapped"),"__puppeteer_evaluation_script__"in window&&e.push("puppeteer_eval"),document.__webdriver_script_fn&&e.push("cdp_script_injection");try{let i=Object.getOwnPropertyDescriptor(navigator,"webdriver");i&&typeof i.get=="function"&&i.get.toString().indexOf("[native code]")===-1&&e.push("webdriver_getter_modified")}catch{}return{detected:e.length>0,signals:e}}catch{return{detected:!1,signals:[]}}}_getCanvasHash(){try{let t=document.createElement("canvas");t.width=200,t.height=50;let e=t.getContext("2d");e.textBaseline="top",e.font="14px Arial",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText("FCaptcha",2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText("FCaptcha",4,17);let n=t.toDataURL(),i=0;for(let o=0;o<n.length;o++)i=(i<<5)-i+n.charCodeAt(o),i=i&i;return{hash:i.toString(16),dataLength:n.length,supported:!0}}catch{return{error:!0,supported:!1}}}_getWebGLInfo(){try{let t=document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");if(!e)return{supported:!1};let n=e.getExtension("WEBGL_debug_renderer_info"),i=n?e.getParameter(n.UNMASKED_VENDOR_WEBGL):"unknown",o=n?e.getParameter(n.UNMASKED_RENDERER_WEBGL):"unknown",r=o.toLowerCase(),s=r.includes("swiftshader")||r.includes("llvmpipe")||r.includes("softpipe")||r.includes("virtualbox")||r.includes("vmware");return{supported:!0,vendor:i,renderer:o,version:e.getParameter(e.VERSION),shadingVersion:e.getParameter(e.SHADING_LANGUAGE_VERSION),suspiciousRenderer:s}}catch{return{supported:!1,error:!0}}}_getAudioInfo(){try{let t=window,e=t.AudioContext||t.webkitAudioContext;if(!e)return{supported:!1};let n=new e,i={supported:!0,sampleRate:n.sampleRate,state:n.state,baseLatency:n.baseLatency};return n.close(),i}catch{return{supported:!1,error:!0}}}_getLieDetection(){try{let t=window,e=[],n=o=>{try{return typeof o=="function"&&o.toString().indexOf("[native code]")===-1}catch{return!1}},i=(o,r)=>{n(o)&&e.push(r)};i(Function.prototype.toString,"Function.prototype.toString"),i(navigator.permissions&&navigator.permissions.query,"navigator.permissions.query"),i(t.Notification&&t.Notification.requestPermission,"Notification.requestPermission"),i(t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.toDataURL,"HTMLCanvasElement.toDataURL"),i(t.WebGLRenderingContext&&t.WebGLRenderingContext.prototype.getParameter,"WebGLRenderingContext.getParameter"),i(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices,"mediaDevices.enumerateDevices");try{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(navigator),"webdriver")||Object.getOwnPropertyDescriptor(navigator,"webdriver");o&&typeof o.get=="function"&&o.get.toString().indexOf("[native code]")===-1&&e.push("navigator.webdriver getter")}catch{}return{supported:!0,patched:e,patchedCount:e.length}}catch{return{supported:!1}}}_getHeadlessIndicators(){let t=navigator;return{hasOuterDimensions:window.outerWidth>0&&window.outerHeight>0,innerEqualsOuter:window.innerWidth===window.outerWidth&&window.innerHeight===window.outerHeight,screenColorDepth:window.screen.colorDepth,screenPixelDepth:window.screen.pixelDepth,connectionType:t.connection?t.connection.type:"unknown",connectionRtt:t.connection?t.connection.rtt:-1,notificationPermission:typeof Notification!="undefined"?Notification.permission:"unsupported",hasBattery:"getBattery"in navigator,hasCredentials:"credentials"in navigator,hasMediaDevices:"mediaDevices"in navigator}}_getScreenInfo(){return{width:screen.width,height:screen.height,colorDepth:screen.colorDepth,pixelRatio:window.devicePixelRatio,availWidth:screen.availWidth,availHeight:screen.availHeight,innerWidth:window.innerWidth,innerHeight:window.innerHeight}}_getNavigatorInfo(){var e;let t=navigator;return{language:navigator.language,languageCount:((e=navigator.languages)==null?void 0:e.length)||0,platform:navigator.platform,hardwareConcurrency:navigator.hardwareConcurrency,deviceMemory:t.deviceMemory,maxTouchPoints:navigator.maxTouchPoints||0,vendor:navigator.vendor,userAgent:navigator.userAgent,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()}}_measureJSExecution(){let t={},e=performance.now();for(let o=0;o<1e3;o++)Math.sqrt(o)*Math.sin(o);t.mathOps=performance.now()-e,e=performance.now();let n=[];for(let o=0;o<1e3;o++)n.push(o);t.arrayOps=performance.now()-e,t.arrayLen=n.length,e=performance.now();let i="";for(let o=0;o<100;o++)i+="a";return t.stringOps=performance.now()-e,t}async measureRAFConsistency(){return new Promise(t=>{let e=[],n=0,i=10;function o(r){if(e.push(r),n++,n<i)requestAnimationFrame(o);else{let s=[];for(let l=1;l<e.length;l++)s.push(e[l]-e[l-1]);let a=s.reduce((l,u)=>l+u,0)/s.length,c=s.reduce((l,u)=>l+Math.pow(u-a,2),0)/s.length;t({avgFrameTime:a,frameTimeVariance:c,frames:i})}}requestAnimationFrame(o)})}_getMathFingerprint(){try{let t={acos:Math.acos(.123456789),acosh:Math.acosh(1e308),asin:Math.asin(.123456789),asinh:Math.asinh(1),atanh:Math.atanh(.5),cbrt:Math.cbrt(100),cosh:Math.cosh(1),expm1:Math.expm1(1),log1p:Math.log1p(10),sinh:Math.sinh(1),tan:Math.tan(-1e308),tanh:Math.tanh(1),pow:Math.pow(Math.PI,-100),sin:Math.sin(Math.PI)},e=Object.values(t).map(i=>String(i)).join(","),n=0;for(let i=0;i<e.length;i++)n=(n<<5)-n+e.charCodeAt(i),n=n&n;return{hash:n.toString(16),sinPi:t.sin,tanLarge:t.tan,supported:!0}}catch{return{supported:!1,error:!0}}}_getErrorFingerprint(){try{let t={};try{null.foo}catch(i){t.typeError=i.message}try{[].length=-1}catch(i){t.rangeError=i.message}try{decodeURIComponent("%")}catch(i){t.uriError=i.message}try{({}).undefinedMethod()}catch(i){t.refTypeError=i.message}let e=Object.values(t).join("|"),n=0;for(let i=0;i<e.length;i++)n=(n<<5)-n+e.charCodeAt(i),n=n&n;return{hash:n.toString(16),typeError:t.typeError,supported:!0}}catch{return{supported:!1,error:!0}}}_getDOMRectFingerprint(){try{let t=document.createElement("div");t.style.cssText="position:absolute;left:-9999px;font-size:16px;font-family:Arial,sans-serif;";let e=document.createElement("span");e.textContent="FCaptcha Test String 123",t.appendChild(e);let n=document.createElement("span");n.style.cssText="letter-spacing:1px;word-spacing:2px;",n.textContent="WWWW 0000",t.appendChild(n),document.body.appendChild(t);let i=e.getBoundingClientRect(),o=n.getBoundingClientRect(),r=document.createRange();r.selectNode(e);let s=r.getBoundingClientRect();document.body.removeChild(t);let c=[i.width,i.height,i.x,i.y,o.width,o.height,s.width,s.height].map(u=>u.toFixed(6)).join(","),l=0;for(let u=0;u<c.length;u++)l=(l<<5)-l+c.charCodeAt(u),l=l&l;return{hash:l.toString(16),rectAWidth:i.width,rectBWidth:o.width,rangeWidth:s.width,supported:!0}}catch{return{supported:!1,error:!0}}}_getCSSMediaQueries(){try{return{...{prefersColorScheme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",prefersReducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,prefersReducedTransparency:window.matchMedia("(prefers-reduced-transparency: reduce)").matches,prefersContrast:window.matchMedia("(prefers-contrast: more)").matches?"more":window.matchMedia("(prefers-contrast: less)").matches?"less":"no-preference",anyHover:window.matchMedia("(any-hover: hover)").matches,anyPointer:window.matchMedia("(any-pointer: fine)").matches?"fine":window.matchMedia("(any-pointer: coarse)").matches?"coarse":"none",hover:window.matchMedia("(hover: hover)").matches,pointer:window.matchMedia("(pointer: fine)").matches?"fine":window.matchMedia("(pointer: coarse)").matches?"coarse":"none",colorGamut:window.matchMedia("(color-gamut: p3)").matches?"p3":window.matchMedia("(color-gamut: srgb)").matches?"srgb":"none",displayMode:window.matchMedia("(display-mode: standalone)").matches?"standalone":window.matchMedia("(display-mode: fullscreen)").matches?"fullscreen":"browser",orientation:window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape",dynamicRange:window.matchMedia("(dynamic-range: high)").matches?"high":"standard",forcedColors:window.matchMedia("(forced-colors: active)").matches},supported:!0}}catch{return{supported:!1,error:!0}}}_getPermissionsInfo(){try{return{hasPermissionsAPI:"permissions"in navigator,hasClipboard:"clipboard"in navigator,hasShare:"share"in navigator,hasCredentials:"credentials"in navigator,hasBluetooth:"bluetooth"in navigator,hasUsb:"usb"in navigator,hasSerial:"serial"in navigator,hasHid:"hid"in navigator,hasXR:"xr"in navigator,hasGeolocation:"geolocation"in navigator,hasMIDI:"requestMIDIAccess"in navigator,supported:!0}}catch{return{supported:!1,error:!0}}}_getFontsInfo(){try{let t=["monospace","sans-serif","serif"],e=["Arial","Helvetica","Times New Roman","Courier New","Georgia","Verdana","Trebuchet MS","Comic Sans MS","Impact","Lucida Console","Menlo","Monaco","SF Pro","Helvetica Neue","Segoe UI","Consolas","Calibri","Cambria","DejaVu Sans","Liberation Sans","Ubuntu","Cantarell","MS Gothic","Meiryo","SimHei","Microsoft YaHei"],n=document.createElement("canvas");n.width=400,n.height=40;let i=n.getContext("2d"),o="mmMWWLLiiff00",r="72px",s={};for(let u of t)i.font=r+" "+u,s[u]=i.measureText(o).width;let a=[];for(let u of e){let v=!1;for(let p of t)if(i.font=r+' "'+u+'", '+p,i.measureText(o).width!==s[p]){v=!0;break}v&&a.push(u)}let c=a.join(","),l=0;for(let u=0;u<c.length;u++)l=(l<<5)-l+c.charCodeAt(u),l=l&l;return{hash:l.toString(16),count:a.length,hasArial:a.includes("Arial"),hasTimesNewRoman:a.includes("Times New Roman"),hasSegoeUI:a.includes("Segoe UI"),hasSFPro:a.includes("SF Pro"),hasDejaVuSans:a.includes("DejaVu Sans"),supported:!0}}catch{return{supported:!1,error:!0}}}async _getSpeechInfo(){try{if(!("speechSynthesis"in window))return{supported:!1};let e=await new Promise(a=>{let c=speechSynthesis.getVoices();if(c.length>0){a(c);return}let l=setTimeout(()=>a([]),1e3);speechSynthesis.onvoiceschanged=()=>{clearTimeout(l),a(speechSynthesis.getVoices())}}),n=e.filter(a=>a.localService),i=e.find(a=>a.default),o=[...new Set(e.map(a=>a.lang))],r=e.map(a=>a.name).sort().join(","),s=0;for(let a=0;a<r.length;a++)s=(s<<5)-s+r.charCodeAt(a),s=s&s;return{hash:s.toString(16),totalVoices:e.length,localVoices:n.length,languages:o.length,defaultVoiceLang:(i==null?void 0:i.lang)||null,hasGoogleVoices:e.some(a=>a.name.includes("Google")),hasMicrosoftVoices:e.some(a=>a.name.includes("Microsoft")),hasAppleVoices:e.some(a=>a.name.includes("Samantha")||a.name.includes("Alex")),supported:!0}}catch{return{supported:!1,error:!0}}}async _getWebRTCInfo(){try{let t={supported:"RTCPeerConnection"in window,mediaDevices:{supported:!1},localIPs:[]};if(!t.supported)return t;if(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)try{let e=await navigator.mediaDevices.enumerateDevices();t.mediaDevices={supported:!0,audioInputs:e.filter(n=>n.kind==="audioinput").length,audioOutputs:e.filter(n=>n.kind==="audiooutput").length,videoInputs:e.filter(n=>n.kind==="videoinput").length,totalDevices:e.length}}catch{t.mediaDevices={supported:!1,error:!0}}try{let e=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]}),n=new Set;e.onicecandidate=i=>{if(i.candidate){let o=i.candidate.candidate,r=/([0-9]{1,3}\.){3}[0-9]{1,3}/g,s=o.match(r);s&&s.forEach(a=>{(a.startsWith("192.168.")||a.startsWith("10.")||a.startsWith("172.")||a.startsWith("169.254."))&&n.add(a)})}},e.createDataChannel(""),await e.createOffer().then(i=>e.setLocalDescription(i)),await new Promise(i=>setTimeout(i,500)),t.localIPs=Array.from(n),t.hasLocalIP=n.size>0,e.close()}catch{t.localIPError=!0}return t}catch{return{supported:!1,error:!0}}}async _checkWorkerConsistency(){try{if(typeof Worker=="undefined")return{supported:!1};let t=navigator,e=`
2
2
  self.onmessage = function() {
3
3
  const data = {
4
4
  userAgent: navigator.userAgent,
@@ -12,7 +12,7 @@
12
12
  };
13
13
  self.postMessage(data);
14
14
  };
15
- `,n=new Blob([e],{type:"application/javascript"}),i=new Worker(URL.createObjectURL(n)),o=await new Promise((a,c)=>{let l=setTimeout(()=>c(new Error("timeout")),2e3);i.onmessage=u=>{clearTimeout(l),a(u.data)},i.onerror=()=>{clearTimeout(l),c(new Error("worker error"))},i.postMessage("collect")});i.terminate();let r={userAgent:navigator.userAgent,language:navigator.language,languages:navigator.languages?Array.from(navigator.languages):[],platform:navigator.platform,hardwareConcurrency:navigator.hardwareConcurrency,deviceMemory:t.deviceMemory,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()},s=[];return o.userAgent!==r.userAgent&&s.push("userAgent"),o.language!==r.language&&s.push("language"),o.platform!==r.platform&&s.push("platform"),o.hardwareConcurrency!==r.hardwareConcurrency&&s.push("hardwareConcurrency"),o.deviceMemory!==r.deviceMemory&&s.push("deviceMemory"),o.timezone!==r.timezone&&s.push("timezone"),o.timezoneOffset!==r.timezoneOffset&&s.push("timezoneOffset"),JSON.stringify(o.languages)!==JSON.stringify(r.languages)&&s.push("languages"),{supported:!0,consistent:s.length===0,mismatches:s,mismatchCount:s.length}}catch{return{supported:!1,error:!0}}}};var x=class{constructor(){this.motionEvents=[],this.orientationEvents=[],this._motionHandler=t=>this._recordMotion(t),this._orientationHandler=t=>this._recordOrientation(t),this._attached=!1}attach(){if(!this._attached){this._attached=!0;try{window.addEventListener("devicemotion",this._motionHandler,{passive:!0}),window.addEventListener("deviceorientation",this._orientationHandler,{passive:!0})}catch{}}}detach(){if(this._attached){this._attached=!1;try{window.removeEventListener("devicemotion",this._motionHandler),window.removeEventListener("deviceorientation",this._orientationHandler)}catch{}}}_recordMotion(t){let e=t.accelerationIncludingGravity||t.acceleration||{};this.motionEvents.push({x:typeof e.x=="number"?e.x:0,y:typeof e.y=="number"?e.y:0,z:typeof e.z=="number"?e.z:0,t:performance.now()}),this.motionEvents.length>300&&this.motionEvents.shift()}_recordOrientation(t){this.orientationEvents.push({alpha:typeof t.alpha=="number"?t.alpha:0,beta:typeof t.beta=="number"?t.beta:0,gamma:typeof t.gamma=="number"?t.gamma:0,t:performance.now()}),this.orientationEvents.length>300&&this.orientationEvents.shift()}analyze(){let t=this.motionEvents,e=this.orientationEvents,n=0,i=0;if(t.length>1){let r=t.map(s=>Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z));i=r.reduce((s,a)=>s+a,0)/r.length,n=r.reduce((s,a)=>s+(a-i)*(a-i),0)/r.length}let o=0;if(e.length>1){let r=e.map(a=>Math.abs(a.beta)+Math.abs(a.gamma)),s=r.reduce((a,c)=>a+c,0)/r.length;o=r.reduce((a,c)=>a+(c-s)*(c-s),0)/r.length}return{motionEventCount:t.length,motionAccelAvg:i,motionAccelVariance:n,orientationEventCount:e.length,orientationVariance:o,hasSensorSupport:typeof window.DeviceMotionEvent!="undefined"}}};var V=class{constructor(){this.pageLoadTime=performance.now(),this.firstInteractionTime=null,this.lastInteractionTime=null,this.totalEvents=0,this.eventLog=[],this.textareaStats=new Map,this.submitData=null,this._setupListeners()}_setupListeners(){["mousedown","keydown","touchstart","scroll"].forEach(e=>{document.addEventListener(e,n=>this._recordInteraction(n),{passive:!0})}),document.addEventListener("keydown",e=>this._recordTextareaKey(e),{passive:!0}),document.addEventListener("keyup",e=>this._recordTextareaKey(e),{passive:!0}),document.addEventListener("submit",e=>this._recordSubmit(e),{capture:!0}),this._interceptFormSubmit()}_recordInteraction(t){var n;let e=performance.now();this.firstInteractionTime===null&&(this.firstInteractionTime=e),this.lastInteractionTime=e,this.totalEvents++,this.eventLog.push({type:t.type,time:e,target:((n=t.target)==null?void 0:n.tagName)||"unknown"}),this.eventLog.length>50&&this.eventLog.shift()}_recordTextareaKey(t){let e=t.target;if((e==null?void 0:e.tagName)!=="TEXTAREA")return;let n=e.id||e.name||"unnamed";this.textareaStats.has(n)||this.textareaStats.set(n,{keydowns:[],keyups:[],intervals:[],lastKeyTime:null,inputWithoutKey:0,pasteCount:0,dwellTimes:[],rollovers:0,activeKeyCount:0,pendingKeydowns:[]});let i=this.textareaStats.get(n),o=performance.now(),r=["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock"].includes(t.key);if(t.type==="keydown")i.keydowns.push(o),i.lastKeyTime!==null&&i.intervals.push(o-i.lastKeyTime),i.lastKeyTime=o,!r&&!t.repeat&&(i.activeKeyCount>0&&i.rollovers++,i.activeKeyCount++,i.pendingKeydowns.push(o)),i.keydowns.length>200&&i.keydowns.shift(),i.intervals.length>200&&i.intervals.shift();else if(t.type==="keyup"&&(i.keyups.push(o),i.keyups.length>200&&i.keyups.shift(),!r&&i.activeKeyCount>0&&(i.activeKeyCount--,i.pendingKeydowns.length>0))){let s=i.pendingKeydowns.shift(),a=o-s;a>0&&a<2e3&&(i.dwellTimes.push(a),i.dwellTimes.length>100&&i.dwellTimes.shift())}}_interceptFormSubmit(){let t=this,e=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){return t._recordProgrammaticSubmit(this),e.apply(this,arguments)}}_recordProgrammaticSubmit(t){let e=performance.now();this.submitData={method:"programmatic",time:e,timeSincePageLoad:e-this.pageLoadTime,timeSinceFirstInteraction:this.firstInteractionTime?e-this.firstInteractionTime:null,timeSinceLastInteraction:this.lastInteractionTime?e-this.lastInteractionTime:null,eventsBeforeSubmit:this.totalEvents,hadTriggerEvent:!1}}_recordSubmit(t){let e=performance.now(),n=this.eventLog.slice(-5),i=n.find(s=>s.type==="keydown"&&e-s.time<100),o=n.find(s=>s.type==="mousedown"&&e-s.time<100),r="unknown";i?r="keyboard":o?r="mouse":this.submitData||(r="programmatic_click"),(!this.submitData||this.submitData.method==="programmatic")&&(this.submitData={method:r,time:e,timeSincePageLoad:e-this.pageLoadTime,timeSinceFirstInteraction:this.firstInteractionTime?e-this.firstInteractionTime:null,timeSinceLastInteraction:this.lastInteractionTime?e-this.lastInteractionTime:null,eventsBeforeSubmit:this.totalEvents,hadTriggerEvent:r==="keyboard"||r==="mouse"})}analyze(){let t=performance.now(),e={};return this.textareaStats.forEach((i,o)=>{let r=i.intervals,s=0,a=0;r.length>0&&(s=r.reduce((c,l)=>c+l,0)/r.length,a=r.reduce((c,l)=>c+Math.pow(l-s,2),0)/r.length),e[o]={keyCount:i.keydowns.length,avgKeyInterval:s,keyIntervalVariance:a,keydownUpRatio:i.keyups.length>0?i.keydowns.length/i.keyups.length:0,pasteCount:i.pasteCount,intervals:i.intervals.slice(-100),dwellTimes:i.dwellTimes.slice(-100),rollovers:i.rollovers}}),document.querySelectorAll("textarea").forEach(i=>{let o=i.id||i.name||"unnamed",r=(i.value||"").length;r>0&&(e[o]?(e[o].contentLength=r,e[o].noKeyboardEvents=e[o].keyCount===0):e[o]={keyCount:0,avgKeyInterval:0,keyIntervalVariance:0,keydownUpRatio:0,pasteCount:0,contentLength:r,noKeyboardEvents:!0})}),{pageLoadToFirstInteraction:this.firstInteractionTime?this.firstInteractionTime-this.pageLoadTime:null,pageLoadToNow:t-this.pageLoadTime,totalInteractionEvents:this.totalEvents,submit:this.submitData||{method:"none",eventsBeforeSubmit:this.totalEvents,hadTriggerEvent:!1},textareaKeyboard:Object.keys(e).length>0?e:null}}recordPaste(t){let e=t.target;if((e==null?void 0:e.tagName)!=="TEXTAREA")return;let n=e.id||e.name||"unnamed";this.textareaStats.has(n)&&this.textareaStats.get(n).pasteCount++}},R=null;function M(){return R||(R=new V,document.addEventListener("paste",h=>R.recordPaste(h),{passive:!0})),R}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>M()):M());async function T(h){let t=new TextEncoder().encode(h),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}var k=class{constructor(){this.firstInteractionTime=null;this.powResult=null;this.pageLoadTime=performance.now()}recordFirstInteraction(){this.firstInteractionTime||(this.firstInteractionTime=performance.now())}async performProofOfWork(t=4){let e=`${Date.now()}:${Math.random().toString(36).slice(2)}`,n="0".repeat(t),i=performance.now(),o=0,r=0;for(;;){let s=await T(`${e}:${o}`);if(r++,s.startsWith(n))return this.powResult={prefix:e,nonce:o,hash:s,iterations:r,duration:performance.now()-i,difficulty:t},this.powResult;o++,r%1e3===0&&await new Promise(a=>setTimeout(a,0))}}collect(t){let e={};if(performance.timing){let n=performance.timing;e.dnsLookup=n.domainLookupEnd-n.domainLookupStart,e.tcpConnection=n.connectEnd-n.connectStart,e.serverResponse=n.responseEnd-n.requestStart,e.domLoad=n.domContentLoadedEventEnd-n.navigationStart,e.fullLoad=n.loadEventEnd-n.navigationStart}return{pageLoadToFirstInteraction:this.firstInteractionTime?this.firstInteractionTime-this.pageLoadTime:null,firstInteractionToClick:this.firstInteractionTime&&t?t-this.firstInteractionTime:null,totalSessionTime:performance.now()-this.pageLoadTime,performanceTiming:e,pow:this.powResult}}};var K=null,H="/__webdecoy";function b(){return K}function W(h){K=h}function C(){return H}function U(h){H=h.replace(/\/$/,"")}var D=class{constructor(){this.workers=[];this.challenge=null;this.solution=null;this.solving=!1;this.solvePromise=null;this.startTime=null}_createWorker(){let t=`
15
+ `,n=new Blob([e],{type:"application/javascript"}),i=new Worker(URL.createObjectURL(n)),o=await new Promise((a,c)=>{let l=setTimeout(()=>c(new Error("timeout")),2e3);i.onmessage=u=>{clearTimeout(l),a(u.data)},i.onerror=()=>{clearTimeout(l),c(new Error("worker error"))},i.postMessage("collect")});i.terminate();let r={userAgent:navigator.userAgent,language:navigator.language,languages:navigator.languages?Array.from(navigator.languages):[],platform:navigator.platform,hardwareConcurrency:navigator.hardwareConcurrency,deviceMemory:t.deviceMemory,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()},s=[];return o.userAgent!==r.userAgent&&s.push("userAgent"),o.language!==r.language&&s.push("language"),o.platform!==r.platform&&s.push("platform"),o.hardwareConcurrency!==r.hardwareConcurrency&&s.push("hardwareConcurrency"),o.deviceMemory!==r.deviceMemory&&s.push("deviceMemory"),o.timezone!==r.timezone&&s.push("timezone"),o.timezoneOffset!==r.timezoneOffset&&s.push("timezoneOffset"),JSON.stringify(o.languages)!==JSON.stringify(r.languages)&&s.push("languages"),{supported:!0,consistent:s.length===0,mismatches:s,mismatchCount:s.length}}catch{return{supported:!1,error:!0}}}};var x=class{constructor(){this.motionEvents=[],this.orientationEvents=[],this._motionHandler=t=>this._recordMotion(t),this._orientationHandler=t=>this._recordOrientation(t),this._attached=!1}attach(){if(!this._attached){this._attached=!0;try{window.addEventListener("devicemotion",this._motionHandler,{passive:!0}),window.addEventListener("deviceorientation",this._orientationHandler,{passive:!0})}catch{}}}detach(){if(this._attached){this._attached=!1;try{window.removeEventListener("devicemotion",this._motionHandler),window.removeEventListener("deviceorientation",this._orientationHandler)}catch{}}}_recordMotion(t){let e=t.accelerationIncludingGravity||t.acceleration||{};this.motionEvents.push({x:typeof e.x=="number"?e.x:0,y:typeof e.y=="number"?e.y:0,z:typeof e.z=="number"?e.z:0,t:performance.now()}),this.motionEvents.length>300&&this.motionEvents.shift()}_recordOrientation(t){this.orientationEvents.push({alpha:typeof t.alpha=="number"?t.alpha:0,beta:typeof t.beta=="number"?t.beta:0,gamma:typeof t.gamma=="number"?t.gamma:0,t:performance.now()}),this.orientationEvents.length>300&&this.orientationEvents.shift()}analyze(){let t=this.motionEvents,e=this.orientationEvents,n=0,i=0;if(t.length>1){let r=t.map(s=>Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z));i=r.reduce((s,a)=>s+a,0)/r.length,n=r.reduce((s,a)=>s+(a-i)*(a-i),0)/r.length}let o=0;if(e.length>1){let r=e.map(a=>Math.abs(a.beta)+Math.abs(a.gamma)),s=r.reduce((a,c)=>a+c,0)/r.length;o=r.reduce((a,c)=>a+(c-s)*(c-s),0)/r.length}return{motionEventCount:t.length,motionAccelAvg:i,motionAccelVariance:n,orientationEventCount:e.length,orientationVariance:o,hasSensorSupport:typeof window.DeviceMotionEvent!="undefined"}}};var V=class{constructor(){this.pageLoadTime=performance.now(),this.firstInteractionTime=null,this.lastInteractionTime=null,this.totalEvents=0,this.eventLog=[],this.textareaStats=new Map,this.submitData=null,this._setupListeners()}_setupListeners(){["mousedown","keydown","touchstart","scroll"].forEach(e=>{document.addEventListener(e,n=>this._recordInteraction(n),{passive:!0})}),document.addEventListener("keydown",e=>this._recordTextareaKey(e),{passive:!0}),document.addEventListener("keyup",e=>this._recordTextareaKey(e),{passive:!0}),document.addEventListener("submit",e=>this._recordSubmit(e),{capture:!0}),this._interceptFormSubmit()}_recordInteraction(t){var n;let e=performance.now();this.firstInteractionTime===null&&(this.firstInteractionTime=e),this.lastInteractionTime=e,this.totalEvents++,this.eventLog.push({type:t.type,time:e,target:((n=t.target)==null?void 0:n.tagName)||"unknown"}),this.eventLog.length>50&&this.eventLog.shift()}_recordTextareaKey(t){let e=t.target;if((e==null?void 0:e.tagName)!=="TEXTAREA")return;let n=e.id||e.name||"unnamed";this.textareaStats.has(n)||this.textareaStats.set(n,{keydowns:[],keyups:[],intervals:[],lastKeyTime:null,inputWithoutKey:0,pasteCount:0,dwellTimes:[],rollovers:0,activeKeyCount:0,pendingKeydowns:[]});let i=this.textareaStats.get(n),o=performance.now(),r=["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock"].includes(t.key);if(t.type==="keydown")i.keydowns.push(o),i.lastKeyTime!==null&&i.intervals.push(o-i.lastKeyTime),i.lastKeyTime=o,!r&&!t.repeat&&(i.activeKeyCount>0&&i.rollovers++,i.activeKeyCount++,i.pendingKeydowns.push(o)),i.keydowns.length>200&&i.keydowns.shift(),i.intervals.length>200&&i.intervals.shift();else if(t.type==="keyup"&&(i.keyups.push(o),i.keyups.length>200&&i.keyups.shift(),!r&&i.activeKeyCount>0&&(i.activeKeyCount--,i.pendingKeydowns.length>0))){let s=i.pendingKeydowns.shift(),a=o-s;a>0&&a<2e3&&(i.dwellTimes.push(a),i.dwellTimes.length>100&&i.dwellTimes.shift())}}_interceptFormSubmit(){let t=this,e=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){return t._recordProgrammaticSubmit(this),e.apply(this,arguments)}}_recordProgrammaticSubmit(t){let e=performance.now();this.submitData={method:"programmatic",time:e,timeSincePageLoad:e-this.pageLoadTime,timeSinceFirstInteraction:this.firstInteractionTime?e-this.firstInteractionTime:null,timeSinceLastInteraction:this.lastInteractionTime?e-this.lastInteractionTime:null,eventsBeforeSubmit:this.totalEvents,hadTriggerEvent:!1}}_recordSubmit(t){let e=performance.now(),n=this.eventLog.slice(-5),i=n.find(s=>s.type==="keydown"&&e-s.time<100),o=n.find(s=>s.type==="mousedown"&&e-s.time<100),r="unknown";i?r="keyboard":o?r="mouse":this.submitData||(r="programmatic_click"),(!this.submitData||this.submitData.method==="programmatic")&&(this.submitData={method:r,time:e,timeSincePageLoad:e-this.pageLoadTime,timeSinceFirstInteraction:this.firstInteractionTime?e-this.firstInteractionTime:null,timeSinceLastInteraction:this.lastInteractionTime?e-this.lastInteractionTime:null,eventsBeforeSubmit:this.totalEvents,hadTriggerEvent:r==="keyboard"||r==="mouse"})}analyze(){let t=performance.now(),e={};return this.textareaStats.forEach((i,o)=>{let r=i.intervals,s=0,a=0;r.length>0&&(s=r.reduce((c,l)=>c+l,0)/r.length,a=r.reduce((c,l)=>c+Math.pow(l-s,2),0)/r.length),e[o]={keyCount:i.keydowns.length,avgKeyInterval:s,keyIntervalVariance:a,keydownUpRatio:i.keyups.length>0?i.keydowns.length/i.keyups.length:0,pasteCount:i.pasteCount,intervals:i.intervals.slice(-100),dwellTimes:i.dwellTimes.slice(-100),rollovers:i.rollovers}}),document.querySelectorAll("textarea").forEach(i=>{let o=i.id||i.name||"unnamed",r=(i.value||"").length;r>0&&(e[o]?(e[o].contentLength=r,e[o].noKeyboardEvents=e[o].keyCount===0):e[o]={keyCount:0,avgKeyInterval:0,keyIntervalVariance:0,keydownUpRatio:0,pasteCount:0,contentLength:r,noKeyboardEvents:!0})}),{pageLoadToFirstInteraction:this.firstInteractionTime?this.firstInteractionTime-this.pageLoadTime:null,pageLoadToNow:t-this.pageLoadTime,totalInteractionEvents:this.totalEvents,submit:this.submitData||{method:"none",eventsBeforeSubmit:this.totalEvents,hadTriggerEvent:!1},textareaKeyboard:Object.keys(e).length>0?e:null}}recordPaste(t){let e=t.target;if((e==null?void 0:e.tagName)!=="TEXTAREA")return;let n=e.id||e.name||"unnamed";this.textareaStats.has(n)&&this.textareaStats.get(n).pasteCount++}},A=null;function M(){return A||(A=new V,document.addEventListener("paste",h=>A.recordPaste(h),{passive:!0})),A}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>M()):M());async function T(h){let t=new TextEncoder().encode(h),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}var k=class{constructor(){this.firstInteractionTime=null;this.powResult=null;this.pageLoadTime=performance.now()}recordFirstInteraction(){this.firstInteractionTime||(this.firstInteractionTime=performance.now())}async performProofOfWork(t=4){let e=`${Date.now()}:${Math.random().toString(36).slice(2)}`,n="0".repeat(t),i=performance.now(),o=0,r=0;for(;;){let s=await T(`${e}:${o}`);if(r++,s.startsWith(n))return this.powResult={prefix:e,nonce:o,hash:s,iterations:r,duration:performance.now()-i,difficulty:t},this.powResult;o++,r%1e3===0&&await new Promise(a=>setTimeout(a,0))}}collect(t){let e={};if(performance.timing){let n=performance.timing;e.dnsLookup=n.domainLookupEnd-n.domainLookupStart,e.tcpConnection=n.connectEnd-n.connectStart,e.serverResponse=n.responseEnd-n.requestStart,e.domLoad=n.domContentLoadedEventEnd-n.navigationStart,e.fullLoad=n.loadEventEnd-n.navigationStart}return{pageLoadToFirstInteraction:this.firstInteractionTime?this.firstInteractionTime-this.pageLoadTime:null,firstInteractionToClick:this.firstInteractionTime&&t?t-this.firstInteractionTime:null,totalSessionTime:performance.now()-this.pageLoadTime,performanceTiming:e,pow:this.powResult}}};var z=null,K="/__webdecoy";function b(){return z}function W(h){z=h}function P(){return K}function U(h){K=h.replace(/\/$/,"")}var D=class{constructor(){this.workers=[];this.challenge=null;this.solution=null;this.solving=!1;this.solvePromise=null;this.startTime=null}_createWorker(){let t=`
16
16
  async function sha256(message) {
17
17
  const msgBuffer = new TextEncoder().encode(message);
18
18
  const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
@@ -54,7 +54,7 @@
54
54
  });
55
55
  }
56
56
  };
57
- `,e=new Blob([t],{type:"application/javascript"});return new Worker(URL.createObjectURL(e))}_threadCount(){let t=typeof navigator!="undefined"&&navigator.hardwareConcurrency||1;return Math.max(1,Math.floor(t/2))}_terminateWorkers(){for(let t of this.workers)try{t.terminate()}catch{}this.workers=[]}async fetchChallenge(t){let e=b();if(!e)return this._generateLocalChallenge();try{let n=await fetch(`${e}${C()}/challenge?siteKey=${encodeURIComponent(t||"default")}`);return n.ok?(this.challenge=await n.json(),this.challenge):(console.warn(`PoW challenge fetch failed (status ${n.status}), using local challenge`),this._generateLocalChallenge())}catch(n){return console.warn("PoW challenge fetch failed, using local challenge:",n),this._generateLocalChallenge()}}_generateLocalChallenge(){let t=Math.random().toString(36).slice(2)+Date.now().toString(36);return this.challenge={challengeId:t,prefix:`${t}:${Date.now()}:4`,difficulty:4,expiresAt:Date.now()+3e5,local:!0},this.challenge}async startSolving(t){return this._solve(t,null)}async solveWithSignalsHash(t,e){return this._solve(t,e)}async _solve(t,e){if(this.solving&&this.solvePromise)return this.solvePromise;this.challenge||await this.fetchChallenge(t);let n=this.challenge;return this.solving=!0,this.startTime=performance.now(),this.solvePromise=new Promise((i,o)=>{let r=this._threadCount(),s=!1,a=(c,l)=>{s||(s=!0,this.solving=!1,this._terminateWorkers(),c(l))};for(let c=0;c<r;c++){let l=this._createWorker();l.onmessage=u=>{u.data.found&&(this.solution={challengeId:n.challengeId,nonce:u.data.nonce,hash:u.data.hash,iterations:u.data.iterations,duration:u.data.duration,difficulty:n.difficulty,signalsHash:e||null,local:n.local||!1},a(i,this.solution))},l.onerror=u=>{a(o,u)},l.postMessage({prefix:n.prefix,difficulty:n.difficulty,signalsHash:e||null,startNonce:c,stride:r,batchSize:5e3}),this.workers.push(l)}}),this.solvePromise}async getSolution(t){return this.solution?this.solution:this.solving&&this.solvePromise?this.solvePromise:this.startSolving(t)}reset(){this._terminateWorkers(),this.challenge=null,this.solution=null,this.solving=!1,this.solvePromise=null}},z=null;function j(){return z||(z=new D),z}var P=class{constructor(t,e){this.token=null;this.verified=!1;let n=typeof t=="string"?document.getElementById(t):t;if(!n)throw new Error("WebDecoy captcha: container element not found");this.container=n,this.options=Object.assign({siteKey:null,theme:"light",size:"normal",callback:null,errorCallback:null,expiredCallback:null,powDifficulty:4},e),this.id="webdecoy_"+Math.random().toString(36).slice(2,11),this.behavioral=new S,this.environmental=new E,this.temporal=new k,this.sensor=new x,this.powManager=j(),this._init()}_init(){this._createWidget(),this._attachListeners(),this._fetchChallenge()}async _fetchChallenge(){try{await this.powManager.fetchChallenge(this.options.siteKey)}catch(t){console.warn("PoW challenge fetch failed:",t)}}_createWidget(){let t=this.options.theme==="dark";this.container.innerHTML=`
57
+ `,e=new Blob([t],{type:"application/javascript"});return new Worker(URL.createObjectURL(e))}_threadCount(){let t=typeof navigator!="undefined"&&navigator.hardwareConcurrency||1;return Math.max(1,Math.floor(t/2))}_terminateWorkers(){for(let t of this.workers)try{t.terminate()}catch{}this.workers=[]}async fetchChallenge(t){let e=b();if(!e)return this._generateLocalChallenge();try{let n=await fetch(`${e}${P()}/challenge?siteKey=${encodeURIComponent(t||"default")}`);return n.ok?(this.challenge=await n.json(),this.challenge):(console.warn(`PoW challenge fetch failed (status ${n.status}), using local challenge`),this._generateLocalChallenge())}catch(n){return console.warn("PoW challenge fetch failed, using local challenge:",n),this._generateLocalChallenge()}}_generateLocalChallenge(){let t=Math.random().toString(36).slice(2)+Date.now().toString(36);return this.challenge={challengeId:t,prefix:`${t}:${Date.now()}:4`,difficulty:4,expiresAt:Date.now()+3e5,local:!0},this.challenge}async startSolving(t){return this._solve(t,null)}async solveWithSignalsHash(t,e){return this._solve(t,e)}async _solve(t,e){if(this.solving&&this.solvePromise)return this.solvePromise;this.challenge||await this.fetchChallenge(t);let n=this.challenge;return this.solving=!0,this.startTime=performance.now(),this.solvePromise=new Promise((i,o)=>{let r=this._threadCount(),s=!1,a=(c,l)=>{s||(s=!0,this.solving=!1,this._terminateWorkers(),c(l))};for(let c=0;c<r;c++){let l=this._createWorker();l.onmessage=u=>{u.data.found&&(this.solution={challengeId:n.challengeId,nonce:u.data.nonce,hash:u.data.hash,iterations:u.data.iterations,duration:u.data.duration,difficulty:n.difficulty,signalsHash:e||null,local:n.local||!1},a(i,this.solution))},l.onerror=u=>{a(o,u)},l.postMessage({prefix:n.prefix,difficulty:n.difficulty,signalsHash:e||null,startNonce:c,stride:r,batchSize:5e3}),this.workers.push(l)}}),this.solvePromise}async getSolution(t){return this.solution?this.solution:this.solving&&this.solvePromise?this.solvePromise:this.startSolving(t)}reset(){this._terminateWorkers(),this.challenge=null,this.solution=null,this.solving=!1,this.solvePromise=null}},H=null;function j(){return H||(H=new D),H}var C=class{constructor(t,e){this.token=null;this.verified=!1;let n=typeof t=="string"?document.getElementById(t):t;if(!n)throw new Error("WebDecoy captcha: container element not found");this.container=n,this.options=Object.assign({siteKey:null,theme:"light",size:"normal",callback:null,errorCallback:null,expiredCallback:null,powDifficulty:4},e),this.id="webdecoy_"+Math.random().toString(36).slice(2,11),this.behavioral=new S,this.environmental=new E,this.temporal=new k,this.sensor=new x,this.powManager=j(),this._init()}_init(){this._createWidget(),this._attachListeners(),this._fetchChallenge()}async _fetchChallenge(){try{await this.powManager.fetchChallenge(this.options.siteKey)}catch(t){console.warn("PoW challenge fetch failed:",t)}}_createWidget(){let t=this.options.theme==="dark";this.container.innerHTML=`
58
58
  <div class="webdecoy-widget ${t?"webdecoy-dark":""}" id="${this.id}">
59
59
  <style>
60
60
  .webdecoy-widget {
@@ -107,4 +107,4 @@
107
107
  <span class="webdecoy-brand">WebDecoy</span>
108
108
  </div>
109
109
  </div>
110
- `,this.checkbox=this.container.querySelector(".webdecoy-checkbox"),this.spinner=this.container.querySelector(".webdecoy-spinner"),this.label=this.container.querySelector(".webdecoy-label")}_attachListeners(){document.addEventListener("mousemove",e=>this.behavioral.recordMouseMove(e),{passive:!0}),document.addEventListener("mousedown",e=>this.behavioral.recordMouseDown(e),{passive:!0}),document.addEventListener("mouseup",e=>this.behavioral.recordMouseUp(e),{passive:!0}),document.addEventListener("scroll",e=>this.behavioral.recordScroll(e),{passive:!0}),document.addEventListener("keydown",e=>this.behavioral.recordKeyEvent(e),{passive:!0}),document.addEventListener("keyup",e=>this.behavioral.recordKeyEvent(e),{passive:!0}),document.addEventListener("touchstart",e=>this.behavioral.recordTouch(e),{passive:!0}),document.addEventListener("touchmove",e=>this.behavioral.recordTouch(e),{passive:!0}),document.addEventListener("pointermove",e=>this.behavioral.recordPointer(e),{passive:!0}),document.addEventListener("pointerdown",e=>this.behavioral.recordPointer(e),{passive:!0}),document.addEventListener("pointerup",e=>this.behavioral.recordPointer(e),{passive:!0}),document.addEventListener("focus",e=>this.behavioral.recordFocus(e),{passive:!0,capture:!0}),document.addEventListener("blur",e=>this.behavioral.recordFocus(e),{passive:!0,capture:!0}),this.sensor.attach();let t=()=>this.temporal.recordFirstInteraction();document.addEventListener("mousemove",t,{once:!0}),document.addEventListener("touchstart",t,{once:!0}),document.addEventListener("keydown",t,{once:!0}),this.checkbox.addEventListener("click",e=>{this._handleClick(e)}),this.checkbox.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._handleClick(e))})}async _handleClick(t){var i,o,r;if(this.verified||this.checkbox.classList.contains("loading"))return;let e=performance.now(),n=this.checkbox.getBoundingClientRect();this.checkbox.classList.add("loading"),this.spinner.style.display="block",this.label.textContent="Verifying...";try{let s=this.behavioral.analyze(),a="clientX"in t?t.clientX:n.left,c="clientY"in t?t.clientY:n.top,l=this.behavioral.analyzeClick(a,c,n),u=this.environmental.collect(),[v,p]=await Promise.all([this.environmental.measureRAFConsistency(),this.environmental.collectAsync()]),y=this.temporal.collect(e),w=M().analyze(),_=this.sensor.analyze(),m={behavioral:{...s,...l},environmental:{...u,rafConsistency:v,...p,sensor:_},temporal:y,formAnalysis:w,meta:{widgetId:this.id,siteKey:this.options.siteKey,challengeNonce:((i=this.powManager.challenge)==null?void 0:i.nonce)||null,timestamp:Date.now(),userAgent:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},f=JSON.stringify(m),d=await T(f),g=await this.powManager.solveWithSignalsHash(this.options.siteKey,d),L={duration:g.duration,iterations:g.iterations,difficulty:g.difficulty},F=await this._verify(m,g,f,d,L);F.success?this._showSuccess((o=F.token)!=null?o:""):this._showFailure((r=F.message)!=null?r:void 0)}catch(s){console.error("WebDecoy captcha error:",s),this._showFailure("Verification failed. Please try again.")}}async _verify(t,e,n,i,o){let r=b();if(!r)return this._clientSideVerify(t);try{return await(await fetch(r+C()+"/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteKey:this.options.siteKey,signals:t,signalsJson:n||null,powSolution:e?{challengeId:e.challengeId,nonce:e.nonce,hash:e.hash,signalsHash:i||null}:null,powTiming:o||null})})).json()}catch{return console.warn("Server unavailable, using client-side verification"),this._clientSideVerify(t)}}_clientSideVerify(t){let e=0,n=t.behavioral,i=t.environmental,o=t.temporal,r=(n.touchEvents||0)>=3,s=(n.keyEvents||0)>0&&n.totalPoints===0;n.totalPoints<5&&n.trajectoryLength<10&&!r&&!s?e+=.35:n.totalPoints<10&&!r&&!s&&n.trajectoryLength<30&&(e+=.15),n.microTremorScore<.2&&(e+=.12),n.velocityVariance<.03&&(e+=.1),n.explorationRatio<.05&&(e+=.08),n.overshootCorrections===0&&n.trajectoryLength>100&&(e+=.05),n.clickPrecision<2&&(e+=.05),n.straightLineRatio>.8&&(e+=.08),n.microMovements<5&&n.totalPoints>50&&(e+=.06),i.webdriver&&(e+=.25),i.automationFlags&&i.automationFlags.plugins===0&&(e+=.05),i.webglInfo&&i.webglInfo.suspiciousRenderer&&(e+=.1),i.headlessIndicators&&!i.headlessIndicators.hasOuterDimensions&&(e+=.12),i.headlessIndicators&&i.headlessIndicators.innerEqualsOuter&&(e+=.05),o.pow&&o.pow.duration<50&&(e+=.1),n.eventDeltaVariance<3&&(e+=.08),n.interactionDuration<300&&(e+=.07);let a=e<.5;return{success:a,score:e,token:a?btoa(JSON.stringify({timestamp:Date.now(),score:e,id:this.id})):null,message:a?null:"Verification failed"}}_showSuccess(t){this.verified=!0,this.token=t,this.checkbox.classList.remove("loading"),this.checkbox.classList.add("verified"),this.checkbox.setAttribute("aria-checked","true"),this.spinner.style.display="none",this.label.textContent="Verified",this.options.callback&&this.options.callback(t),this.container.dispatchEvent(new CustomEvent("webdecoy:verified",{detail:{token:t}}))}_showFailure(t){this.checkbox.classList.remove("loading"),this.checkbox.classList.add("failed"),this.spinner.style.display="none",this.label.textContent=t||"Verification failed",this.options.errorCallback&&this.options.errorCallback(t),setTimeout(()=>{this.checkbox.classList.remove("failed"),this.label.textContent="I'm not a robot"},3e3)}getToken(){return this.token}reset(){this.verified=!1,this.token=null,this.behavioral=new S,this.temporal=new k,this.sensor&&this.sensor.detach(),this.sensor=new x,this.sensor.attach(),this.powManager.reset(),this.checkbox.classList.remove("verified","failed","loading"),this.checkbox.setAttribute("aria-checked","false"),this.spinner.style.display="none",this.label.textContent="I'm not a robot",this._fetchChallenge()}};var I=class{constructor(t){this.lastScore=null;this.listeners=[];this.options=Object.assign({siteKey:null,serverUrl:null,minCollectionTime:2e3,autoScore:!0,scoreThreshold:.5,powDifficulty:3},t),this.id="webdecoy_inv_"+Math.random().toString(36).slice(2,11),this.behavioral=new S,this.environmental=new E,this.temporal=new k,this.sensor=new x,this.powManager=new D,this.startTime=Date.now(),this._init()}_init(){this._attachListeners();let t=()=>this.temporal.recordFirstInteraction();document.addEventListener("mousemove",t,{once:!0}),document.addEventListener("touchstart",t,{once:!0}),document.addEventListener("keydown",t,{once:!0}),document.addEventListener("scroll",t,{once:!0}),this.options.autoScore&&this._attachToForms(),this._fetchChallenge()}async _fetchChallenge(){try{await this.powManager.fetchChallenge(this.options.siteKey)}catch(t){console.warn("PoW challenge fetch failed:",t)}}_attachListeners(){let t={mousemove:e=>this.behavioral.recordMouseMove(e),mousedown:e=>this.behavioral.recordMouseDown(e),mouseup:e=>this.behavioral.recordMouseUp(e),scroll:e=>this.behavioral.recordScroll(e),keydown:e=>this.behavioral.recordKeyEvent(e),keyup:e=>this.behavioral.recordKeyEvent(e),touchmove:e=>this.behavioral.recordTouch(e),touchstart:e=>this.behavioral.recordTouch(e),pointermove:e=>this.behavioral.recordPointer(e),pointerdown:e=>this.behavioral.recordPointer(e),pointerup:e=>this.behavioral.recordPointer(e),focus:e=>this.behavioral.recordFocus(e),blur:e=>this.behavioral.recordFocus(e)};for(let[e,n]of Object.entries(t)){let i=e==="focus"||e==="blur"?{passive:!0,capture:!0}:{passive:!0};document.addEventListener(e,n,i),this.listeners.push({event:e,handler:n,opts:i})}this.sensor.attach()}_attachToForms(){document.addEventListener("submit",async t=>{let e=t.target;if(e.dataset.webdecoyIgnore)return;let n=e.querySelector('input[name="webdecoy_token"]');if(n||(n=document.createElement("input"),n.type="hidden",n.name="webdecoy_token",e.appendChild(n)),!this.lastScore||Date.now()-this.lastScore.timestamp>6e4){t.preventDefault();try{let i=await this.execute(e.dataset.webdecoyAction||"form_submit");n.value=i.token||"",i.success?e.submit():document.dispatchEvent(new CustomEvent("webdecoy:blocked",{detail:{score:i.score,form:e}}))}catch(i){console.error("WebDecoy captcha error:",i),e.submit()}}else n.value=this.lastScore.token||""})}async execute(t=""){var _;let e=Date.now()-this.startTime;e<this.options.minCollectionTime&&await new Promise(m=>setTimeout(m,this.options.minCollectionTime-e));let n=this.behavioral.analyze(),i=this.environmental.collect(),o=this.temporal.collect(Date.now()),[r,s]=await Promise.all([this.environmental.measureRAFConsistency(),this.environmental.collectAsync()]),a=M().analyze(),c=this.sensor.analyze(),l={behavioral:n,environmental:{...i,rafConsistency:r,...s,sensor:c},temporal:o,formAnalysis:a,meta:{sessionId:this.id,siteKey:this.options.siteKey,action:t,challengeNonce:((_=this.powManager.challenge)==null?void 0:_.nonce)||null,timestamp:Date.now(),userAgent:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,sessionDuration:Date.now()-this.startTime,invisible:!0}},u=JSON.stringify(l),v=await T(u),p=await this.powManager.solveWithSignalsHash(this.options.siteKey,v),y={duration:p.duration,iterations:p.iterations,difficulty:p.difficulty},w=await this._score(l,t,p,u,v,y);return this.lastScore={...w,timestamp:Date.now()},w}async _score(t,e,n,i,o,r){let s=this.options.serverUrl||b();if(!s)return this._clientSideScore(t);try{return await(await fetch(s+C()+"/score",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteKey:this.options.siteKey,signals:t,signalsJson:i||null,action:e,powSolution:n?{challengeId:n.challengeId,nonce:n.nonce,hash:n.hash,signalsHash:o||null}:null,powTiming:r||null})})).json()}catch{return console.warn("WebDecoy server unavailable, using client-side scoring"),this._clientSideScore(t)}}_clientSideScore(t){let e=0,n=t.behavioral,i=t.environmental,o=t.temporal,r=t.meta,s=(n.touchEvents||0)>=3,a=(n.keyEvents||0)>0&&n.totalPoints===0;n.totalPoints<5&&n.trajectoryLength<10&&!s&&!a?e+=.35:n.totalPoints<10&&!s&&!a&&n.trajectoryLength<30&&(e+=.15),n.microTremorScore<.2&&(e+=.12),n.velocityVariance<.03&&(e+=.1),n.totalPoints<10&&r.sessionDuration>5e3&&(e+=.08),n.scrollEvents===0&&n.keyEvents===0&&r.sessionDuration>1e4&&(e+=.06),n.eventDeltaVariance<3&&(e+=.08),n.straightLineRatio>.8&&(e+=.08),i.webdriver&&(e+=.25),i.automationFlags&&i.automationFlags.plugins===0&&(e+=.06),i.headlessIndicators&&!i.headlessIndicators.hasOuterDimensions&&(e+=.12),i.webglInfo&&i.webglInfo.suspiciousRenderer&&(e+=.1),o.pow&&o.pow.duration<30&&(e+=.1),r.sessionDuration<500&&(e+=.12),r.sessionDuration<1e3&&n.totalPoints<5&&(e+=.15);let c=e<this.options.scoreThreshold;return{success:c,score:Math.min(1,e),action:r.action,token:c?btoa(JSON.stringify({timestamp:Date.now(),score:e,action:r.action,id:this.id})):null}}getScore(){return this.lastScore}destroy(){for(let{event:t,handler:e,opts:n}of this.listeners)document.removeEventListener(t,e,n);this.listeners=[],this.powManager&&this.powManager.reset()}};var A={widgets:new Map,get serverUrl(){return b()},set serverUrl(h){W(h)},configure(h){h.serverUrl&&W(h.serverUrl),h.basePath&&U(h.basePath)},render(h,t){let e=new P(h,t);return this.widgets.set(e.id,e),e.id},getResponse(h){let t=this.widgets.get(h);return t&&t instanceof P?t.getToken():null},reset(h){let t=this.widgets.get(h);t instanceof P&&t.reset()},invisible(h){let t=new I(h);return this.widgets.set(t.id,t),t},async execute(h,t={}){let e=new I({siteKey:h,serverUrl:b(),minCollectionTime:t.minTime||1e3,autoScore:!1,powDifficulty:t.powDifficulty||3}),n=await e.execute(t.action||"");return e.destroy(),n},getSignals(){return{environmental:new E().collect()}},autoInit(){document.querySelectorAll("[data-webdecoy]").forEach(h=>{let t=h.dataset.sitekey||h.dataset.webdecoy,e=h.dataset.theme||"light",n=h.dataset.endpoint,i=h.dataset.callback,o=i?window[i]:void 0;n&&W(n),this.render(h,{siteKey:t,theme:e,callback:o!=null?o:null})})}};window.WebDecoyCaptcha=A;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>A.autoInit()):A.autoInit();return Y(G);})();
110
+ `,this.checkbox=this.container.querySelector(".webdecoy-checkbox"),this.spinner=this.container.querySelector(".webdecoy-spinner"),this.label=this.container.querySelector(".webdecoy-label")}_attachListeners(){document.addEventListener("mousemove",e=>this.behavioral.recordMouseMove(e),{passive:!0}),document.addEventListener("mousedown",e=>this.behavioral.recordMouseDown(e),{passive:!0}),document.addEventListener("mouseup",e=>this.behavioral.recordMouseUp(e),{passive:!0}),document.addEventListener("scroll",e=>this.behavioral.recordScroll(e),{passive:!0}),document.addEventListener("keydown",e=>this.behavioral.recordKeyEvent(e),{passive:!0}),document.addEventListener("keyup",e=>this.behavioral.recordKeyEvent(e),{passive:!0}),document.addEventListener("touchstart",e=>this.behavioral.recordTouch(e),{passive:!0}),document.addEventListener("touchmove",e=>this.behavioral.recordTouch(e),{passive:!0}),document.addEventListener("pointermove",e=>this.behavioral.recordPointer(e),{passive:!0}),document.addEventListener("pointerdown",e=>this.behavioral.recordPointer(e),{passive:!0}),document.addEventListener("pointerup",e=>this.behavioral.recordPointer(e),{passive:!0}),document.addEventListener("focus",e=>this.behavioral.recordFocus(e),{passive:!0,capture:!0}),document.addEventListener("blur",e=>this.behavioral.recordFocus(e),{passive:!0,capture:!0}),this.sensor.attach();let t=()=>this.temporal.recordFirstInteraction();document.addEventListener("mousemove",t,{once:!0}),document.addEventListener("touchstart",t,{once:!0}),document.addEventListener("keydown",t,{once:!0}),this.checkbox.addEventListener("click",e=>{this._handleClick(e)}),this.checkbox.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._handleClick(e))})}async _handleClick(t){var i,o,r;if(this.verified||this.checkbox.classList.contains("loading"))return;let e=performance.now(),n=this.checkbox.getBoundingClientRect();this.checkbox.classList.add("loading"),this.spinner.style.display="block",this.label.textContent="Verifying...";try{let s=this.behavioral.analyze(),a="clientX"in t?t.clientX:n.left,c="clientY"in t?t.clientY:n.top,l=this.behavioral.analyzeClick(a,c,n),u=this.environmental.collect(),[v,p]=await Promise.all([this.environmental.measureRAFConsistency(),this.environmental.collectAsync()]),y=this.temporal.collect(e),w=M().analyze(),_=this.sensor.analyze(),m={behavioral:{...s,...l},environmental:{...u,rafConsistency:v,...p,sensor:_},temporal:y,formAnalysis:w,meta:{widgetId:this.id,siteKey:this.options.siteKey,challengeNonce:((i=this.powManager.challenge)==null?void 0:i.nonce)||null,timestamp:Date.now(),userAgent:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},f=JSON.stringify(m),d=await T(f),g=await this.powManager.solveWithSignalsHash(this.options.siteKey,d),L={duration:g.duration,iterations:g.iterations,difficulty:g.difficulty},F=await this._verify(m,g,f,d,L);F.success?this._showSuccess((o=F.token)!=null?o:""):this._showFailure((r=F.message)!=null?r:void 0)}catch(s){console.error("WebDecoy captcha error:",s),this._showFailure("Verification failed. Please try again.")}}async _verify(t,e,n,i,o){let r=b();if(!r)return this._clientSideVerify(t);try{return await(await fetch(r+P()+"/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteKey:this.options.siteKey,signals:t,signalsJson:n||null,powSolution:e?{challengeId:e.challengeId,nonce:e.nonce,hash:e.hash,signalsHash:i||null}:null,powTiming:o||null})})).json()}catch{return console.warn("Server unavailable, using client-side verification"),this._clientSideVerify(t)}}_clientSideVerify(t){let e=0,n=t.behavioral,i=t.environmental,o=t.temporal,r=(n.touchEvents||0)>=3,s=(n.keyEvents||0)>0&&n.totalPoints===0;n.totalPoints<5&&n.trajectoryLength<10&&!r&&!s?e+=.35:n.totalPoints<10&&!r&&!s&&n.trajectoryLength<30&&(e+=.15),n.microTremorScore<.2&&(e+=.12),n.velocityVariance<.03&&(e+=.1),n.explorationRatio<.05&&(e+=.08),n.overshootCorrections===0&&n.trajectoryLength>100&&(e+=.05),n.clickPrecision<2&&(e+=.05),n.straightLineRatio>.8&&(e+=.08),n.microMovements<5&&n.totalPoints>50&&(e+=.06),i.webdriver&&(e+=.25),i.automationFlags&&i.automationFlags.plugins===0&&(e+=.05),i.webglInfo&&i.webglInfo.suspiciousRenderer&&(e+=.1),i.headlessIndicators&&!i.headlessIndicators.hasOuterDimensions&&(e+=.12),i.headlessIndicators&&i.headlessIndicators.innerEqualsOuter&&(e+=.05),o.pow&&o.pow.duration<50&&(e+=.1),n.eventDeltaVariance<3&&(e+=.08),n.interactionDuration<300&&(e+=.07);let a=e<.5;return{success:a,score:e,token:a?btoa(JSON.stringify({timestamp:Date.now(),score:e,id:this.id})):null,message:a?null:"Verification failed"}}_showSuccess(t){this.verified=!0,this.token=t,this.checkbox.classList.remove("loading"),this.checkbox.classList.add("verified"),this.checkbox.setAttribute("aria-checked","true"),this.spinner.style.display="none",this.label.textContent="Verified",this.options.callback&&this.options.callback(t),this.container.dispatchEvent(new CustomEvent("webdecoy:verified",{detail:{token:t}}))}_showFailure(t){this.checkbox.classList.remove("loading"),this.checkbox.classList.add("failed"),this.spinner.style.display="none",this.label.textContent=t||"Verification failed",this.options.errorCallback&&this.options.errorCallback(t),setTimeout(()=>{this.checkbox.classList.remove("failed"),this.label.textContent="I'm not a robot"},3e3)}getToken(){return this.token}reset(){this.verified=!1,this.token=null,this.behavioral=new S,this.temporal=new k,this.sensor&&this.sensor.detach(),this.sensor=new x,this.sensor.attach(),this.powManager.reset(),this.checkbox.classList.remove("verified","failed","loading"),this.checkbox.setAttribute("aria-checked","false"),this.spinner.style.display="none",this.label.textContent="I'm not a robot",this._fetchChallenge()}};var I=class{constructor(t){this.lastScore=null;this.listeners=[];this.options=Object.assign({siteKey:null,serverUrl:null,minCollectionTime:2e3,autoScore:!0,scoreThreshold:.5,powDifficulty:3},t),this.id="webdecoy_inv_"+Math.random().toString(36).slice(2,11),this.behavioral=new S,this.environmental=new E,this.temporal=new k,this.sensor=new x,this.powManager=new D,this.startTime=Date.now(),this._init()}_init(){this._attachListeners();let t=()=>this.temporal.recordFirstInteraction();document.addEventListener("mousemove",t,{once:!0}),document.addEventListener("touchstart",t,{once:!0}),document.addEventListener("keydown",t,{once:!0}),document.addEventListener("scroll",t,{once:!0}),this.options.autoScore&&this._attachToForms(),this._fetchChallenge()}async _fetchChallenge(){try{await this.powManager.fetchChallenge(this.options.siteKey)}catch(t){console.warn("PoW challenge fetch failed:",t)}}_attachListeners(){let t={mousemove:e=>this.behavioral.recordMouseMove(e),mousedown:e=>this.behavioral.recordMouseDown(e),mouseup:e=>this.behavioral.recordMouseUp(e),scroll:e=>this.behavioral.recordScroll(e),keydown:e=>this.behavioral.recordKeyEvent(e),keyup:e=>this.behavioral.recordKeyEvent(e),touchmove:e=>this.behavioral.recordTouch(e),touchstart:e=>this.behavioral.recordTouch(e),pointermove:e=>this.behavioral.recordPointer(e),pointerdown:e=>this.behavioral.recordPointer(e),pointerup:e=>this.behavioral.recordPointer(e),focus:e=>this.behavioral.recordFocus(e),blur:e=>this.behavioral.recordFocus(e)};for(let[e,n]of Object.entries(t)){let i=e==="focus"||e==="blur"?{passive:!0,capture:!0}:{passive:!0};document.addEventListener(e,n,i),this.listeners.push({event:e,handler:n,opts:i})}this.sensor.attach()}_attachToForms(){document.addEventListener("submit",async t=>{let e=t.target;if(e.dataset.webdecoyIgnore)return;let n=e.querySelector('input[name="webdecoy_token"]');if(n||(n=document.createElement("input"),n.type="hidden",n.name="webdecoy_token",e.appendChild(n)),!this.lastScore||Date.now()-this.lastScore.timestamp>6e4){t.preventDefault();try{let i=await this.execute(e.dataset.webdecoyAction||"form_submit");n.value=i.token||"",i.success?e.submit():document.dispatchEvent(new CustomEvent("webdecoy:blocked",{detail:{score:i.score,form:e}}))}catch(i){console.error("WebDecoy captcha error:",i),e.submit()}}else n.value=this.lastScore.token||""})}async execute(t=""){var _;let e=Date.now()-this.startTime;e<this.options.minCollectionTime&&await new Promise(m=>setTimeout(m,this.options.minCollectionTime-e));let n=this.behavioral.analyze(),i=this.environmental.collect(),o=this.temporal.collect(Date.now()),[r,s]=await Promise.all([this.environmental.measureRAFConsistency(),this.environmental.collectAsync()]),a=M().analyze(),c=this.sensor.analyze(),l={behavioral:n,environmental:{...i,rafConsistency:r,...s,sensor:c},temporal:o,formAnalysis:a,meta:{sessionId:this.id,siteKey:this.options.siteKey,action:t,challengeNonce:((_=this.powManager.challenge)==null?void 0:_.nonce)||null,timestamp:Date.now(),userAgent:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,sessionDuration:Date.now()-this.startTime,invisible:!0}},u=JSON.stringify(l),v=await T(u),p=await this.powManager.solveWithSignalsHash(this.options.siteKey,v),y={duration:p.duration,iterations:p.iterations,difficulty:p.difficulty},w=await this._score(l,t,p,u,v,y);return this.lastScore={...w,timestamp:Date.now()},w}async _score(t,e,n,i,o,r){let s=this.options.serverUrl||b();if(!s)return this._clientSideScore(t);try{return await(await fetch(s+P()+"/score",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteKey:this.options.siteKey,signals:t,signalsJson:i||null,action:e,powSolution:n?{challengeId:n.challengeId,nonce:n.nonce,hash:n.hash,signalsHash:o||null}:null,powTiming:r||null})})).json()}catch{return console.warn("WebDecoy server unavailable, using client-side scoring"),this._clientSideScore(t)}}_clientSideScore(t){let e=0,n=t.behavioral,i=t.environmental,o=t.temporal,r=t.meta,s=(n.touchEvents||0)>=3,a=(n.keyEvents||0)>0&&n.totalPoints===0;n.totalPoints<5&&n.trajectoryLength<10&&!s&&!a?e+=.35:n.totalPoints<10&&!s&&!a&&n.trajectoryLength<30&&(e+=.15),n.microTremorScore<.2&&(e+=.12),n.velocityVariance<.03&&(e+=.1),n.totalPoints<10&&r.sessionDuration>5e3&&(e+=.08),n.scrollEvents===0&&n.keyEvents===0&&r.sessionDuration>1e4&&(e+=.06),n.eventDeltaVariance<3&&(e+=.08),n.straightLineRatio>.8&&(e+=.08),i.webdriver&&(e+=.25),i.automationFlags&&i.automationFlags.plugins===0&&(e+=.06),i.headlessIndicators&&!i.headlessIndicators.hasOuterDimensions&&(e+=.12),i.webglInfo&&i.webglInfo.suspiciousRenderer&&(e+=.1),o.pow&&o.pow.duration<30&&(e+=.1),r.sessionDuration<500&&(e+=.12),r.sessionDuration<1e3&&n.totalPoints<5&&(e+=.15);let c=e<this.options.scoreThreshold;return{success:c,score:Math.min(1,e),action:r.action,token:c?btoa(JSON.stringify({timestamp:Date.now(),score:e,action:r.action,id:this.id})):null}}getScore(){return this.lastScore}destroy(){for(let{event:t,handler:e,opts:n}of this.listeners)document.removeEventListener(t,e,n);this.listeners=[],this.powManager&&this.powManager.reset()}};var R={widgets:new Map,get serverUrl(){return b()},set serverUrl(h){W(h)},configure(h){h.serverUrl&&W(h.serverUrl),h.basePath&&U(h.basePath)},render(h,t){let e=new C(h,t);return this.widgets.set(e.id,e),e.id},getResponse(h){let t=this.widgets.get(h);return t&&t instanceof C?t.getToken():null},reset(h){let t=this.widgets.get(h);t instanceof C&&t.reset()},invisible(h){let t=new I(h);return this.widgets.set(t.id,t),t},async execute(h,t={}){let e=new I({siteKey:h,serverUrl:b(),minCollectionTime:t.minTime||1e3,autoScore:!1,powDifficulty:t.powDifficulty||3}),n=await e.execute(t.action||"");return e.destroy(),n},getSignals(){return{environmental:new E().collect()}},autoInit(){document.querySelectorAll("[data-webdecoy]").forEach(h=>{let t=h.dataset.sitekey||h.dataset.webdecoy,e=h.dataset.theme||"light",n=h.dataset.endpoint,i=h.dataset.callback,o=i?window[i]:void 0;n&&W(n),this.render(h,{siteKey:t,theme:e,callback:o!=null?o:null})})}};window.WebDecoyCaptcha=R;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>R.autoInit()):R.autoInit();return Y(G);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webdecoy/client",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Web Decoy browser widget - signal collection, proof-of-work, and captcha UI",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",