class botDetectorAjax{static moderateUrl="https://moderate.cleantalk.org/api3.0/frontend_data";static endpoints={moderate:["frontend_data"]};static send(a,n){return new Promise((t,o)=>{let r;if(-1===this.endpoints.moderate.indexOf(a))o(new Error("Method name unknown. "+a));else{r=new URL(this.moderateUrl);let e=new XMLHttpRequest;e.open("POST",r),e.timeout=15e3,e.setRequestHeader("Content-Type","application/json"),n.method_name=a,e.send(JSON.stringify(n)),e.onload=()=>{t(e)},e.onerror=()=>{o(new Error("Connection error. "+r.toString()))}}})}}class botDetectorLocalStorage{static maxLifetime=600;static get(e,t){void 0===t&&(t="value");e=localStorage.getItem(e);if(null!==e)try{var o=JSON.parse(e);return o.hasOwnProperty(t)?o[t]:o}catch(e){return new Error(e)}return!1}static set(e,t){t={value:t,timestamp:Math.floor((new Date).getTime()/1e3)};localStorage.setItem(e,JSON.stringify(t))}static isAlive(e,t){return void 0===t&&(t=this.maxLifetime),this.get(e,"timestamp")+t>Math.floor((new Date).getTime()/1e3)}static isSet(e){return null!==localStorage.getItem(e)}static delete(e){localStorage.removeItem(e)}}class botDetectorLog{constructor(){this.logLsName="ct_bot_detector_frontend_data_log",this.logsLimit=10,this.getInstance(),this.enabled=!1}writeLog(e){e.frontend_data=this.filterFrontendData(e.frontend_data),e.responder_data=this.filterResponderData(e.responder_data),e.forms_processed=this.filterFormsProcessed(e.forms_processed),this.instance.records.push(e),this.instance.log_last_update=Math.floor((new Date).getTime()/1e3),this.saveInstance()}getInstance(){this.dropInstance(),this.instance={log_start:Math.floor((new Date).getTime()/1e3),log_last_update:"",records:[]}}validateInstance(e){return"object"==typeof e&&!(!(e.hasOwnProperty("log_start")&&e.hasOwnProperty("log_last_update")&&e.hasOwnProperty("records"))||e.records.length>this.logsLimit)&&Array.isArray(e.records)}dropInstance(){botDetectorLocalStorage.delete(this.logLsName)}saveInstance(){this.validateInstance(this.instance)&&botDetectorLocalStorage.set(this.logLsName,JSON.stringify(this.instance))}getRecordInstance(){return{success:!1,timestamp_on_send:null,timestamp_on_received:null,frontend_data:{event_token:"",js_event:""},responder_data:{host_name:"",headers:"",new_event_token:""},forms_processed:{forms_count:0,forms_list:[],forms_handling_error:""},error:""}}filterFrontendData(e){return e={event_token:e.hasOwnProperty("event_token")?e.event_token:"",js_event:e.hasOwnProperty("js_event")?e.js_event:""}}filterResponderData(e){return e={host_name:e.hasOwnProperty("host_name")?e.host_name:"",headers:e.hasOwnProperty("headers")?e.headers:"",new_event_token:e.hasOwnProperty("new_event_token")?e.new_event_token:""}}filterFormsProcessed(e){return e={forms_count:e.hasOwnProperty("forms_count")?e.forms_count:0,forms_list:e.hasOwnProperty("forms_list")?e.forms_list:[],forms_handling_error:e.hasOwnProperty("forms_handling_error")?e.forms_handling_error:""}}}class TypoData{fieldData={fieldName:"",fieldType:"",isAutocompleteExist:!1,isAutocomplete:!1,label:"",isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0};fields=document.querySelectorAll("input[type=text], input[type=email], textarea");data=[];gatheringFields(){Array.prototype.slice.call(this.fields).forEach((e,t)=>{var o=Object.assign({},this.fieldData);e.name&&(o.fieldName=e.name),e.nodeName&&(o.fieldType=e.nodeName),e.autocomplete&&"off"!==e.autocomplete&&(o.isAutocompleteExist=!0,o.isAutocomplete=e.autocomplete),e.labels&&0{e.addEventListener("paste",e=>{e&&"object"==typeof e&&e instanceof ClipboardEvent?e.clipboardData.getData("text"):void 0!==window.clipboardData&&window.clipboardData.getData("text"),this.data[t].isUseBuffer=!0})}),this.fields.forEach((e,r)=>{e.addEventListener("input",e=>{this.data[r].countOfKey++;var t,o=+new Date;1===this.data[r].countOfKey?(this.data[r].lastKeyTimestamp=o,this.data[r].firstKeyTimestamp=o):(t=o-this.data[r].lastKeyTimestamp,2===this.data[r].countOfKey?(this.data[r].lastKeyTimestamp=o,this.data[r].lastDelta=t):2e.toString(16).padStart(2,"0")).join("")}async webglFingerPrint(){var t={fingerprint:"",agent:this.GL_AGENT,configurations:this.GL_CONFIGURATIONS,error:"",success:!1};let e,o;try{this.render()}catch(e){t.error="Render error: "+e.toString()}try{(e=document.createElement("canvas")).width=256,e.height=128,o=e.getContext("webgl2")||e.getContext("experimental-webgl2")||e.getContext("webgl")||e.getContext("experimental-webgl")||e.getContext("moz-webgl")}catch(e){t.error="Unable to create canvas. Is WebGL supported? "+e.toString()}if(null!==o){try{var r=o.createBuffer(),a=(o.bindBuffer(o.ARRAY_BUFFER,r),new Float32Array([-.2,-.9,0,.4,-.26,0,0,.7321,0])),n=(o.bufferData(o.ARRAY_BUFFER,a,o.STATIC_DRAW),r.itemSize=3,r.numItems=3,o.createProgram()),i=o.createShader(o.VERTEX_SHADER),s=(o.shaderSource(i,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){ varyinTexCoordinate = attrVertex + uniformOffset; gl_Position = vec4(attrVertex, 0, 1);}"),o.compileShader(i),o.createShader(o.FRAGMENT_SHADER));o.shaderSource(s,"precision mediump float;varying vec2 varyinTexCoordinate;void main(){ gl_FragColor = vec4(varyinTexCoordinate, 0, 1);}"),o.compileShader(s),o.attachShader(n,i),o.attachShader(n,s),o.linkProgram(n),o.useProgram(n),n.vertexPosAttrib=o.getAttribLocation(n,"attrVertex"),n.offsetUniform=o.getUniformLocation(n,"uniformOffset"),o.enableVertexAttribArray(n.vertexPosArray),o.vertexAttribPointer(n.vertexPosAttrib,r.itemSize,o.FLOAT,!1,0,0),o.uniform2f(n.offsetUniform,1,1),o.drawArrays(o.TRIANGLE_STRIP,0,r.numItems)}catch(e){return t.error="Draw WebGL Image: "+e.toString(),t}a="";try{var c=new Uint8Array(131072);if(o.readPixels(0,0,256,128,o.RGBA,o.UNSIGNED_BYTE,c),""==(a=JSON.stringify(c).replace(/,?"[0-9]+":/g,"")).replace(/^{[0]+}$/g,""))throw"JSON.stringify only ZEROes";var l=JSON.stringify(this.GL_CONFIGURATIONS);t.fingerprint=await this.sha256(a+l),t.success=!0}catch(e){t.error="Draw WebGL Image: "+e.toString()}}return t}add(e,t,o){void 0===this.GL_CONFIGURATIONS[e]&&(this.GL_CONFIGURATIONS[e]={}),this.GL_CONFIGURATIONS[e][t]=o}destroy_webgl(e){try{var t=e.getExtension("WEBGL_lose_context")||e.getExtension("WEBKIT_WEBGL_lose_context")||e.getExtension("MOZ_WEBGL_lose_context");null!==t&&t.loseContext()}catch(e){console.warn("webgl: Unable to lose gl context")}}webgl_detect(){var e=["webgl2","experimental-webgl2","webgl","experimental-webgl","moz-webgl","fake-webgl"],t=[];let o=!1;var r,a;o;for(a in e){0;try{(r=document.createElement("canvas").getContext(e[a],{stencil:!0}))&&(o?this.destroy_webgl(r):o=r,t.push(e[a]))}catch(e){console.warn("webgl: Issue webgl_detect")}}return!!o&&{name:t,gl:o}}expand_param_pair(e){return null==e?"null":"["+e[0]+", "+e[1]+"]"}get_antialiasing_string(e){let t=!1;try{t=e.getContextAttributes().antialias}catch(e){console.warn("webgl: Issue getAntialiasingString")}return t?"True":"False"}renderer_info(e){var t={renderer:"render_ctx",vendor:"render_ctx"},o=e.getExtension("WEBGL_debug_renderer_info");return null!=o&&(t.renderer=e.getParameter(o.UNMASKED_RENDERER_WEBGL)),t.vendor=e.getParameter(o.UNMASKED_VENDOR_WEBGL),t}get_angle(e){function t(e){return 0!==e&&0==(e&e-1)}var o=this.expand_param_pair(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE));return"Win32"!==navigator.platform&&"Win64"!==navigator.platform||"Internet Explorer"===e.getParameter(e.RENDERER)||"Microsoft Edge"===e.getParameter(e.RENDERER)||o!==this.expand_param_pair([1,1])?"False":t(e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS))&&t(e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS))?"True, Direct3D 11":"True, Direct3D 9"}get_anisotropy(t){var o=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic");if(o){let e=t.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT);return e=0===e?2:e}return"n/a"}get_major_performance_caveat(e){try{var t=document.createElement("canvas"),o=(t.style.height="1px",t.style.width="1px",document.body.appendChild(t),t.getContext(e,{failIfMajorPerformanceCaveat:!0}));return t.remove(),o?void 0===o.getContextAttributes().failIfMajorPerformanceCaveat?(this.destroy_webgl(o),"Not implemented"):(this.destroy_webgl(o),"False"):"True"}catch(e){return"n/gl"}}get_max_draw_buffers(e){let t=0;var o=e.getExtension("WEBGL_draw_buffers");return t=null!==o?e.getParameter(o.MAX_DRAW_BUFFERS_WEBGL):t}get_float_int_precision(e){try{var t=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT),o=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT),r=0!==t.precision?"highp/":"mediump/";return r+=0!==o.rangeMax?"highp":"lowp"}catch(e){return"n/a"}}get_webgl_extensions(e){let t=[],o=[],r=[];try{r=e.getSupportedExtensions()}catch(e){console.warn("webgl: Unable to get gl extensions")}if(void 0===r||!r.length)return!1;for(let e=0;e{botDetectorLocalStorage.set("bot_detector_webgl_f_hash",e)});[["bot_detector_pointer_data",0],["bot_detector_screen_info",botDetectorGetScreenInfo()],["bot_detector_headless",navigator.webdriver]].forEach(e=>{botDetectorLocalStorage.set(e[0],e[1])});var e=botDetectorLocalStorage.get("bot_detector_page_hits")?botDetectorLocalStorage.get("bot_detector_page_hits"):0,e=(botDetectorLocalStorage.set("bot_detector_page_hits",parseInt(e)+1),botDetectorLocalStorage.get("bot_detector_user_agent")?botDetectorLocalStorage.get("bot_detector_user_agent"):window.navigator.userAgent);botDetectorLocalStorage.set("bot_detector_user_agent",e),botDetectorFormsExclusions=botDetectorGetFormsExclusions(),botDetectorStartFormsListeners(),botDetectorSetBrowserCookieSupportFlag(),botDetectorSetWebGlSupportFlag(),botDetectorSetReferrers(),botDetectorStartCron([botDetectorSetCronTask(botDetectorCronSendTypoData,"cronTypoData",botDetectorCronInterval,500),botDetectorSetCronTask(botDetectorCronSendPointerData,"cronPointerData",botDetectorCronInterval,1500),botDetectorSetCronTask(botDetectorSendScrollingParameters,"cronScrollingAdditional",botDetectorCronInterval,1500),botDetectorSetCronTask(botDetectorCronSendWebGLFingerprint,"cronFingerprint",botDetectorCronInterval,500)]),botDetectorFrontendData("DOMContentLoaded"),setInterval(()=>{botDetectorLocalStorage.isSet("bot_detector_event_token")&&!botDetectorLocalStorage.isAlive("bot_detector_event_token")&&botDetectorFrontendData("automaticRefresh")},3e3);document.typoData=new TypoData,document.typoData.gatheringFields(),document.typoData.setListeners()}function botDetectorGetFormsExclusions(){let e=[];try{e=(e="object"==typeof ctPublic&&!0===ctPublic.hasOwnProperty("bot_detector_forms_excluded"))?JSON.parse(atob(ctPublic.bot_detector_forms_excluded)):[]}catch{}return e}function botDetectorStartFormsListeners(){var t=document.forms;if(0{botDetectorFrontendData("submit")});botDetectorStartFieldsListening(t)}function botDetectorAttachEventHandler(e,t,o){"function"==typeof window.addEventListener?e.addEventListener(t,o):e.attachEvent(t,o)}function botDetectorRemoveEventHandler(e,t,o){"function"==typeof window.removeEventListener?e.removeEventListener(t,o):e.detachEvent(t,o)}function botDetectorGetScreenInfo(){return{fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight}}function botDetectorMouseStopData(){BotDetectorPointerDataCollector.send_on_stop_collect=!0,window.removeEventListener("mousemove",botDetectorGetMouseData)}function botDetectorGetMouseData(e){botDetectorMouseDataFlag&&(botDetectorMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-botDetectorTimeMs)]),botDetectorMouseDataFlag=!1,new Promise(e=>{setTimeout(()=>e(),150)}).then(()=>{botDetectorLocalStorage.set("bot_detector_pointer_data",botDetectorMouseData),botDetectorMouseDataCounter++,botDetectorMouseDataFlag=!0}),150<=botDetectorMouseDataCounter)&&botDetectorMouseStopData()}function botDetectorSetHasScrolled(){botDetectorLocalStorage.isSet("bot_detector_has_scrolled")&&botDetectorLocalStorage.isAlive("bot_detector_has_scrolled")&&botDetectorLocalStorage.get("bot_detector_has_scrolled")||(botDetectorLocalStorage.set("bot_detector_has_scrolled",!0),botDetectorFrontendData("scrolled"))}let maxScrollEvents=20,lastScrollTop=window.scrollY||document.documentElement.scrollTop,lastTimestamp=(new Date).getTime(),lastScrollEventTime=lastTimestamp,scrollEndCount=0,scrollCount=0,scrollData=[],scrollDataMap=["timestamp","scrollTop","scrollSpeed","scrollDistance","scrollPercent","scrollEndCount","scrollDelay","scrollCount"];function botDetectorCollectScrollingParameters(){var e=window.scrollY||document.documentElement.scrollTop,t=(new Date).getTime(),o=document.documentElement.scrollHeight||document.body.scrollHeight,r=window.innerHeight||document.documentElement.clientHeight,a=e/(o-r)*100,n=Math.abs(e-lastScrollTop),i=n/((t-lastTimestamp)/1e3),s=(t-lastScrollEventTime)/1e3;lastScrollTop=e,lastTimestamp=t,lastScrollEventTime=t,o<=e+r&&scrollEndCount++,scrollCount++,scrollData.push([t,e,i,n,a,scrollEndCount,s,scrollCount]),scrollData.length>maxScrollEvents&&(scrollData=scrollData.slice(scrollData.length-maxScrollEvents)),botDetectorLocalStorage.set("bot_detector_scrolling_additional",scrollData)}function botDetectorSendScrollingParameters(e){var t,o=botDetectorLocalStorage.isSet("bot_detector_scrolling_additional")?botDetectorLocalStorage.get("bot_detector_scrolling_additional","value"):0;if(0!==o&&void 0!==o.length&&botDetectorScrollingAdditional.last_data_length!==o.length)return(t=botDetectorCreateClientInfo()).scrolling_additional=o,botDetectorSendClientInfoToCloud(t,e),botDetectorScrollingAdditional.last_data_length=o.length,!0;return!1}function botDetectorSetMouseMoved(){botDetectorLocalStorage.isSet("bot_detector_mouse_moved")&&botDetectorLocalStorage.isAlive("bot_detector_mouse_moved")&&botDetectorLocalStorage.get("bot_detector_mouse_moved")||(botDetectorLocalStorage.set("bot_detector_mouse_moved",!0),botDetectorFrontendData("mousemoved"))}function botDetectorStartFieldsListening(t){if((!botDetectorLocalStorage.isSet("bot_detector_has_key_up")&&!botDetectorLocalStorage.get("bot_detector_has_key_up")||!botDetectorLocalStorage.isSet("bot_detector_has_input_focused")&&!botDetectorLocalStorage.get("bot_detector_has_input_focused"))&&0{r.responder_data.headers=e.getAllResponseHeaders(),r.timestamp_on_received=Math.floor((new Date).getTime()/1e3);try{var t,o=JSON.parse(e.response);"SUCCESS"===o.data.operation_status?(botDetectorLocalStorage.set("bot_detector_event_token",o.event_token),r.forms_processed=setEventTokenFieldsToForms(o.event_token),r.responder_data.new_event_token=o.event_token,r.success=!0):(t="API error: "+o.error_no+" - "+o.error_message,console.log(t),r.error=t),r.responder_data.host_name=o.hasOwnProperty("host_name")?o.host_name:"not provided"}catch(e){r.error=e.toString(),console.log("Can not parse the response. "+e.toString())}}).catch(e=>{console.log(e.toString()),r.error=e.toString()}).finally(()=>{!0===botDetectorLogInstance.enabled&&botDetectorLogInstance.writeLog(r)})}function botDetectorStartCron(e){if(localStorage.removeItem("bot_detector_cron_log"),void 0!==e&&0{setInterval(()=>{if(t._function(t.cronName)){let e=localStorage.getItem("bot_detector_cron_log");(e=e?JSON.parse(e):{})[o]={task:t,last_run:Math.floor((new Date).getTime()/1e3)},localStorage.setItem("bot_detector_cron_log",JSON.stringify(e))}},t.period)},t.startDelay)}}function botDetectorSetCronTask(e,t,o,r=0){return!(void 0===e||"function"!=typeof e||void 0===o||"number"!=typeof o||void 0===t||"string"!=typeof t||32+new Date-botDetectorCronInterval)return(t=botDetectorCreateClientInfo()).typo=document.typoData.data,botDetectorSendClientInfoToCloud(t,e),!0;return!1}function botDetectorCronSendWebGLFingerprint(e){var t,o=botDetectorLocalStorage.get("bot_detector_webgl_f_hash");return!(!o||!1!==o.sent||(o.sent=Math.floor((new Date).getTime()/1e3),botDetectorLocalStorage.set("bot_detector_webgl_f_hash",o),(t=botDetectorCreateClientInfo()).webgl_f_hash_data=o,botDetectorSendClientInfoToCloud(t,e),0))}function botDetectorCronSendPointerData(e){var t=botDetectorLocalStorage.isSet("bot_detector_pointer_data")?botDetectorLocalStorage.get("bot_detector_pointer_data","value"):0;if(0!==t&&void 0!==t.length&&BotDetectorPointerDataCollector.last_data_length!==t.length){var o=botDetectorCreateClientInfo();if(o.pointer_data=t,BotDetectorPointerDataCollector.send_on_stop_collect)return botDetectorSendClientInfoToCloud(o,e),BotDetectorPointerDataCollector.last_data_length=t.length,BotDetectorPointerDataCollector.send_on_stop_collect=!1,!(BotDetectorPointerDataCollector.send_on_cron=!1);if(BotDetectorPointerDataCollector.send_on_cron)return botDetectorSendClientInfoToCloud(o,e),BotDetectorPointerDataCollector.last_data_length=t.length,!0}return!1}function setEventTokenFieldsToForms(t){var e,o={forms_count:0,forms_list:[],forms_handling_error:""};if("string"!=typeof t||64!==t.length)e="API error: no valid bot detector event token found in server response.",console.warn(e),o.forms_handling_error=e;else{var r=document.forms;if(botDetectorLocalStorage.delete("ct_bot_detector_form_exclusion"),0