(function(){if(!window.wts7||typeof window.wts7!=="object"){window.wts7={};} const wts7=window.wts7;const INIT={version_number:"8.409",package_name:"web_stat",app_name:"web-stat",app_url:"app.ardalio.com",session_length:1800000,max_duration:3600000,};const src=(document.currentScript&&document.currentScript.src)||"";if(src.includes("alias=")){const u=new URL(src,window.location.href);for(const[key,val]of u.searchParams.entries()){if(wts7[key]==null){wts7[key]=val;}}} else if(src.includes("shopify")){const m=src.match(/\/shopify\/(\d+)\/(\d+)\/wts7\.js/i);if(m){wts7.db=wts7.db||m[1];wts7.alias=wts7.alias||m[2];wts7.origin='shopify';}} if(wts7.alias&&wts7.db){wtsl7(wts7.alias,wts7.db);} function wtsl7(alias,db,obj={},event_name="",event_conversion=0,evt=null,origin=(window.wts7&&window.wts7.origin)||null,wts7_arg=window.wts7){if(/bot|crawler|spider|baidu|preview|headless|facebookexternalhit|Site24x7|mediapartners-google|google-read-aloud|googleother|woorank|cincraw|peeker|Knowledge AI|wget|insights|embedly|Datanyze|rackspace|libwww-perl|aweme|admantx|python-requests|newspaper\//i.test(navigator.userAgent)){return;} console.log("wtsl7 / v "+INIT.version_number);if(alias==null||db==null)return;alias=String(alias).replace(/\D/g,"");db=String(db).replace(/\D/g,"");if(!alias||!db)return;if(alias==="1311076"||alias==="1271129"||alias==="1753501"||alias==="2043840"){return;} const seed=(wts7_arg&&typeof wts7_arg==="object")?wts7_arg:{};const INPUT=Object.assign({},seed,{alias,db,obj,origin,event_name,event_conversion,event:evt,version_number:INIT.version_number,package_name:INIT.package_name});if(INPUT.origin==="embeddedScript"){INPUT.params="wix";INPUT.invisible="yes";} if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",function onReady(){document.removeEventListener("DOMContentLoaded",onReady);try{wtsl7_exe(INPUT);} catch(err){wtsDebug7("load errror 1: "+(err&&err.stack?err.stack:String(err)));}});}else{try{wtsl7_exe(INPUT);} catch(err){wtsDebug7("load errror 2 on ua "+navigator.userAgent+" / error: "+(err&&err.stack?err.stack:String(err)));}}} window.wtslog7=wtsl7;window.wtsl7=wtsl7;function wtsl7_exe(INPUT){INIT.worker_data=null;let STORAGE_JSON;let STORAGE={};let CALCULATED={};let PING={};let PANEL={};if(INPUT.origin=="embeddedScript"&&!INIT.message_handlers_added){window.addEventListener("message",function(event){messageHandler(event,INPUT,STORAGE);});INIT.message_handlers_added=true;} try{STORAGE_JSON=localStorage.getItem('STORAGE_JSON_'+INPUT.alias);STORAGE=STORAGE_JSON?JSON.parse(STORAGE_JSON):{};} catch(err){STORAGE={};} STORAGE.test_mode=STORAGE.test_mode||"no";STORAGE.n_pv_session=parseInt(STORAGE.n_pv_session||"1");STORAGE.timeLastLoad=parseInt(STORAGE.timeLastLoad||'0');if(INPUT.origin==="shopify"){INPUT=getShopifyData(INPUT);STORAGE.visitor_id=STORAGE.visitor_id||INPUT.shopify_visitor_id;} else if(INPUT.origin==="wix"){if(!STORAGE.visitor_id||STORAGE.visitor_id==INPUT.wix_userId){STORAGE.visitor_id=INPUT.wix_visitorId;}} if(INPUT.wixEventName){if(INPUT.wixEventName=='AddToCart'){if(INPUT.sku&&INPUT.quantity&&INPUT.currency&&INPUT.price){INPUT.event_name='Added to Cart: sku '+INPUT.sku+', '+INPUT.quantity+' @ '+INPUT.currency+INPUT.price;} else{INPUT.event_name='Added Product to Cart';} INPUT.group_name='Add to Cart';} else if(INPUT.wixEventName=='RemoveFromCart'){if(INPUT.sku&&INPUT.quantity&&INPUT.currency&&INPUT.price){INPUT.event_name='Removed from Cart: sku '+INPUT.sku+', '+INPUT.quantity+' @ '+INPUT.currency+INPUT.price;} else{INPUT.event_name='Removed Product from Cart';} INPUT.group_name='Remove from Cart';} else if(INPUT.wixEventName=='AddCoupon'){INPUT.event_name='Added Coupon';INPUT.group_name='Add Coupon';} else if(INPUT.wixEventName=='AddPaymentInfo'){INPUT.event_name='Added Payment Info';INPUT.group_name='Add Payment Info';} else if(INPUT.wixEventName=='Purchase'){if(INPUT.alias=='2099440'){wtsDebug7("koltukshoney / 2099440 / Wix event "+INPUT.wixEventName+" STORAGE user_id: "+STORAGE.user_id+" / INPUT user_id: "+INPUT.user_id);} let currency=INPUT.currency||INPUT.contents[0].currency;INPUT.event_name='Purchased '+currency+INPUT.revenue;INPUT.group_name='Purchase';} else if(INPUT.wixEventName=='Lead'){if(!INPUT.action&&INPUT.formId){INPUT.action="proxy.php?url=form submitted";} INPUT.event_name=INPUT.action;INPUT.group_name='Lead';} else if(INPUT.wixEventName=='CustomEvent'){if(INPUT.eventCategory=='Site members'){if(INPUT.eventAction=='Log in Submit'||INPUT.eventAction=='Log in Success'){INPUT.eventAction='Login';} else if(INPUT.eventAction=='Sign up Submit'||INPUT.eventAction=='Sign up Success'){INPUT.eventAction='Sign up';} INPUT.event_name='Site Member '+INPUT.eventAction;INPUT.group_name='Site Members';}}} if(STORAGE.exclusion_type=="forbidden"){} let over_limit;try{over_limit=sessionStorage.getItem("over_limit");}catch(e){} if(over_limit=="yes"){const today=new Date();const dayOfMonth=today.getDate();if(dayOfMonth>5){CALCULATED.exclusion_type="over_limit";}} if(INPUT.event_name){INIT.currentURL=INPUT.event_name;} else if(INPUT.pagePath){INIT.currentURL=window.location.protocol+'//'+window.location.host+INPUT.pagePath;} else if(INPUT.url){INIT.currentURL=INPUT.url;} else{INIT.currentURL=window.location.href;try{INIT.currentURL=window.top.location.href;} catch(err){}} if(/[?&]wtsx=\d+/.test(INIT.currentURL)){STORAGE.has_exclusion_code=1;try{localStorage.setItem('STORAGE_JSON_'+INPUT.alias,JSON.stringify(STORAGE));} catch(err){console.log(err);}} if(STORAGE.has_exclusion_code){CALCULATED.exclusion_type="has_exclusion_code";} INIT.timeInitClient=Date.now();if(!CALCULATED.exclusion_type&&INIT.timeInitClient-STORAGE.timeLastLoad<=INIT.session_length){if(['regular','free','basic'].includes(STORAGE.user_status)&&STORAGE.test_mode!='yes'){CALCULATED.exclusion_type="pv_no_premium";} else if(INIT.currentURL==STORAGE.lastURL&&STORAGE.test_mode!='yes'){CALCULATED.exclusion_type="reload";if(!['regular','free','basic'].includes(STORAGE.user_status)){if(STORAGE.session_id&&STORAGE.unique_id){initStartPing(PING,INPUT,STORAGE);}}} else{STORAGE.n_pv_session++;if(STORAGE.n_pv_session>150){return;}}} else{STORAGE.n_pv_session=1;} if(INIT.currentURL.includes('wts_se_')){CALCULATED.exclusion_type=undefined;} if(/[?&]installation_check=[\d\.]+$/.test(INIT.currentURL)){CALCULATED.exclusion_type=undefined;} if(INPUT.action=="draw"){CALCULATED.exclusion_type="no_count";} if(CALCULATED.exclusion_type&&(INPUT.invisible=="yes"||STORAGE.counter_info=="invisible")){console.log("return / "+CALCULATED.exclusion_type);return;} INIT.lastURL=STORAGE.lastURL;INIT.timeLastLoad=STORAGE.timeLastLoad;if(!CALCULATED.exclusion_type){STORAGE.lastURL=INIT.currentURL;STORAGE.timeLastLoad=INIT.timeInitClient;STORAGE.user_id=INPUT.user_id;try{localStorage.setItem('STORAGE_JSON_'+INPUT.alias,JSON.stringify(STORAGE));} catch(err){}} if(INPUT.event){INPUT.event.preventDefault();} if(INPUT.user_id&&(!STORAGE.user_id||INPUT.user_id!=STORAGE.user_id)){INPUT.update_user_id=1;} INPUT.user_id=INPUT.user_id||STORAGE.user_id;INPUT.origin=INPUT.origin||"log7";let OUTPUT={package_name:INIT.package_name,alias:INPUT.alias,db:INPUT.db,invisible:INPUT.invisible||"",exclusion_type:CALCULATED.exclusion_type||"",};if(!CALCULATED.exclusion_type){Object.assign(OUTPUT,{session_id:STORAGE.session_id||null,visitor_id:STORAGE.visitor_id||null,is_owner:STORAGE.is_owner||0,has_exclusion_code:STORAGE.has_exclusion_code||0,user_id:INPUT.user_id||null,user_info:INPUT.user_info||null,update_user_id:INPUT.update_user_id||null,time_last_visit_server:STORAGE.time_last_visit_server||null,n_visits:STORAGE.n_visits||0,original_ref:STORAGE.original_ref||"",url:INIT.currentURL,title:INPUT.title,page_name:INPUT.page_name||"",group_name:INPUT.group_name||"",conversion_number:INPUT.conversion_number||"",version_number:INIT.version_number,origin:INPUT.origin,});OUTPUT.scrW=screen.width||window.innerWidth||0;OUTPUT.scrH=screen.height||window.innerHeight||0;if(INPUT.event_name){OUTPUT.invisible="yes";OUTPUT.conversion_number=INPUT.event_conversion||null;OUTPUT.event_name=encodeURIComponent(String(INPUT.event_name));OUTPUT.page_name="event_"+INPUT.event_name;OUTPUT.group_name=INPUT.group_name||INPUT.event_name;OUTPUT.url=INPUT.event_name;OUTPUT.title=INPUT.event_name;} else{if(Number(INPUT.embedVersion||0)>=2){if(typeof INPUT.pageTitle==="string"){OUTPUT.title=INPUT.pageTitle;if(OUTPUT.title.includes("Checkout")){OUTPUT.title="Initiated Checkout";}else if(OUTPUT.title.includes("Cart Page")){OUTPUT.title="Viewed Cart";}}} if(!OUTPUT.title){OUTPUT.title=document.title;try{OUTPUT.title=top.document.title;}catch(err){}} if(INPUT.origin=="shopify"){if(OUTPUT.title.includes(" – ")){OUTPUT.title=OUTPUT.title.split(" – ")[0];}} if(INPUT.referer){OUTPUT.referer=INPUT.referer;} else{OUTPUT.referer=document.referrer;try{OUTPUT.referer=top.document.referrer;}catch(err){} OUTPUT.referer=OUTPUT.referer?OUTPUT.referer.substring(0,510).replace(/\/$/,""):"";if(INPUT.params==="wix"&&OUTPUT.url.includes("wixStats")){OUTPUT.url=OUTPUT.referer;}} if(OUTPUT.url.indexOf(INIT.app_url)>-1){OUTPUT.url=OUTPUT.referer;} OUTPUT.url=OUTPUT.url?OUTPUT.url.replace(/\/$/,""):"";}} function headersToObject(headers){const obj={};headers.forEach((v,k)=>{obj[k]=v;});return obj;} OUTPUT.human_probe=startHumanProbe();const browser_fp={webdriver:safe_check(()=>navigator.webdriver?1:0),hardwareConcurrency:safe_check(()=>navigator.hardwareConcurrency||0),plugins:safe_check(()=>navigator.plugins?navigator.plugins.length:0),languages:safe_check(()=>getLanguagesInfo(),""),cookieOK:safe_check(()=>testCookie(),0),localStorageOK:safe_check(()=>testLocalStorage(),0),scrW:safe_check(()=>screen.width,0),scrH:safe_check(()=>screen.height,0)};OUTPUT.browser_fp=browser_fp;const fetch_url="https://"+INIT.app_url+"/submit/"+INPUT.alias;attemptFetch(fetch_url,{method:"POST",body:JSON.stringify(OUTPUT),}) .then(async function(response){if(!response.ok){if(response.status=="403"){let bodyText="";try{bodyText=await response.text();}catch(e){} let parsedBody=null;let error_message="";try{parsedBody=JSON.parse(bodyText);error_message=parsedBody.error_message;}catch(e){} const full={status:response.status,statusText:response.statusText,headers:headersToObject(response.headers),body:bodyText,error_message:error_message,retryCount:response.retryCount||0,url:response.url,ua:navigator.userAgent,};STORAGE.exclusion_type="forbidden";try{localStorage.setItem('STORAGE_JSON_'+INPUT.alias,JSON.stringify(STORAGE));}catch(e){} if(1==0&&INPUT.origin=="shopify"){if(error_message){if(!/Linux with bad UA|Bot UA|HTTP_IS_BOT/.test(error_message)){wtsDebug7("403 / "+error_message+" / origin: "+INPUT.origin);}} else{wtsDebug7("403 / "+JSON.stringify(full)+" / origin: "+INPUT.origin);}} return{};}} const contentType=response.headers.get("Content-Type");if(!contentType||!contentType.includes("application/json")){throw new Error("Invalid response type: Expected JSON");} return response.json();}) .then(function(RESPONSE){if(!RESPONSE||Object.keys(RESPONSE).length===0){return;} console.log("wtsl7_exe / response OK");if(RESPONSE.error_code||RESPONSE.error_message){if(RESPONSE.error_message.indexOf("no alias")>-1||RESPONSE.error_code=="FORBIDDEN"){STORAGE.exclusion_type="forbidden";try{localStorage.setItem('STORAGE_JSON_'+INPUT.alias,JSON.stringify(STORAGE));} catch(err){}} return;} if(RESPONSE.correct_time_last_visit_server||RESPONSE.user_status!=STORAGE.user_status||RESPONSE.test_mode=="yes"&&(RESPONSE.test_mode!=STORAGE.test_mode)){if(window.parent){var message;if(RESPONSE.correct_time_last_visit_server){STORAGE.time_last_visit_server=RESPONSE.server_time;message={type:"updateStorage",field:"time_last_visit_server",value:STORAGE};window.parent.postMessage(message,"*");} if(RESPONSE.test_mode=="yes"&&(RESPONSE.test_mode!=STORAGE.test_mode)){STORAGE.test_mode="yes";message={type:"updateStorage",field:"test_mode",value:STORAGE};window.parent.postMessage(message,"*");} if(RESPONSE.user_status!=STORAGE.user_status){STORAGE.user_status=RESPONSE.user_status;message={type:"updateStorage",field:"user_status",value:STORAGE};window.parent.postMessage(message,"*");}} try{STORAGE.user_status=RESPONSE.user_status;STORAGE.time_last_visit_server=RESPONSE.server_time;localStorage.setItem("STORAGE_JSON_"+INPUT.alias,JSON.stringify(STORAGE));} catch(err){}} if(document.getElementById("wts"+INPUT.alias)){if(RESPONSE.HTML){document.getElementById("wts"+INPUT.alias).innerHTML=RESPONSE.HTML;if(typeof INPUT.callback==='function'){INPUT.callback();}}} if(!["regular","free","basic"].includes(RESPONSE.user_status)&&RESPONSE.counter_info=="panel"&&INPUT.invisible!="yes"){PANEL.alias=RESPONSE.alias;PANEL.db=RESPONSE.db;PANEL.delta_time=RESPONSE.delta_time;PANEL.user_status=RESPONSE.user_status;PANEL.task="get_panel_data";PANEL.package_name=INPUT.package_name;PANEL.test_mode=RESPONSE.test_mode;PANEL.delay=4000;updatePanel7(PANEL);} if(RESPONSE.exclusion_type){if(RESPONSE.exclusion_type=="exclusion_code"||RESPONSE.exclusion_type=="exclusion_check"){if(RESPONSE.exclusion_type=="exclusion_code"){STORAGE.has_exclusion_code=1;} if(RESPONSE.exclusion_type=="exclusion_check"){STORAGE.is_owner=1;}} else if(RESPONSE.exclusion_type!="installation_check"){STORAGE.user_status=RESPONSE.user_status;STORAGE.counter_info=RESPONSE.counter_info;STORAGE.delta_time=RESPONSE.delta_time;STORAGE.exclusion_type=RESPONSE.exclusion_type;STORAGE.test_mode=RESPONSE.test_mode;if(RESPONSE.exclusion_type=="over_limit"){STORAGE.exclusion_type='';try{sessionStorage.setItem("over_limit","yes");} catch(err){}}} try{localStorage.setItem("STORAGE_JSON_"+INPUT.alias,JSON.stringify(STORAGE));} catch(err){} if(INPUT.obj){redirect7(INPUT.obj);} return;} STORAGE.lastURL=INIT.currentURL;STORAGE.timeLastLoad=INIT.timeInitClient;STORAGE.time_last_visit_server=RESPONSE.server_time;STORAGE.session_id=RESPONSE.session_id;STORAGE.unique_id=RESPONSE.unique_id;STORAGE.new_session=RESPONSE.new_session;STORAGE.user_status=RESPONSE.user_status;STORAGE.delta_time=RESPONSE.delta_time;STORAGE.counter_info=RESPONSE.counter_info;STORAGE.exclusion_type=RESPONSE.exclusion_type;STORAGE.test_mode=RESPONSE.test_mode;STORAGE.user_id=RESPONSE.user_id;STORAGE.n_visits=RESPONSE.n_visits;STORAGE.visitor_id=RESPONSE.visitor_id;STORAGE.original_ref=RESPONSE.original_ref;STORAGE.conv_setting=RESPONSE.conv_setting;try{localStorage.setItem("STORAGE_JSON_"+INPUT.alias,JSON.stringify(STORAGE));} catch(err){} if(INPUT.obj){redirect7(INPUT.obj);} if(!INIT.event_handlers_added){window.addEventListener("focus",function(event){focusHandler(event,INPUT,PING,PANEL);});document.addEventListener("visibilitychange",function(event){visibilitychangeHandler(event,INPUT,PING,PANEL);});window.addEventListener("pageshow",function(event){pageshowHandler(event,INPUT);});if(INPUT.origin=="embeddedScript"){INIT.event_handlers_added=true;}} if(INPUT.origin=="embeddedScript"){INIT.update_worker={task:"update_worker",package_name:"web_stat",session_id:RESPONSE.session_id,visitor_id:RESPONSE.visitor_id,alias:INPUT.alias,db:INPUT.db,version_number:INPUT.version_number};if(INIT.worker_data){if(INIT.worker_data.user_id&&!STORAGE.user_id){INPUT.update_user_id=1;STORAGE.user_id=INIT.worker_data.user_id;try{localStorage.setItem('STORAGE_JSON_'+INPUT.alias,JSON.stringify(STORAGE));} catch(err){}} var DATA=Object.assign({},INIT.update_worker,INIT.worker_data);var beacon_sent=navigator.sendBeacon("https://"+INIT.app_url+"/image",JSON.stringify(DATA));if(beacon_sent){INIT.update_worker=undefined;}}} if(['regular','free','basic'].includes(RESPONSE.user_status)){return;} initStartPing(PING,INPUT,RESPONSE);if(!INPUT.beforeunloadEventAdded){window.addEventListener("beforeunload",function(){beforeunloadHandler(PING);});INPUT.beforeunloadEventAdded=1;}}) .catch(function(){OUTPUT.version_number=INIT.version_number;if(INPUT.action!=="draw"){OUTPUT.beaconSent=navigator.sendBeacon(fetch_url,JSON.stringify(OUTPUT));}});} function attemptFetch(url,options,retries=1,retryCount=0){return fetch(url,options).then((response)=>{response.retryCount=retryCount;return response;}) .catch((error)=>{if(retries>0){return attemptFetch(url,options,retries-1,retryCount+1);} throw error;});} function messageHandler(event,INPUT,STORAGE){if(event.data==INPUT.alias+" worker loaded"){try{event.source.postMessage(INPUT.alias+" embedded script OK",event.origin);} catch(e){console.log("error posting back: ",e);}} else if(event.data.type==="workerData"){if(event.data.value){INIT.worker_data=event.data.value;if(INIT.update_worker){if(INIT.worker_data.user_id&&!STORAGE.user_id){INIT.update_worker.update_user_id=1;STORAGE.user_id=INIT.worker_data.user_id;try{localStorage.setItem('STORAGE_JSON_'+INPUT.alias,JSON.stringify(STORAGE));} catch(err){}} var DATA=Object.assign({},INIT.update_worker,INIT.worker_data);var beacon_sent=navigator.sendBeacon("https://"+INIT.app_url+"/image",JSON.stringify(DATA));if(beacon_sent){INIT.update_worker=undefined;}}}} else if(event.data.type&&event.data.type=="updateStorage"){var UPDATED_STORAGE=event.data.value;localStorage.setItem("STORAGE_JSON_"+INPUT.alias,JSON.stringify(UPDATED_STORAGE));}} function safe_check(fn,fallback=0){try{return fn();} catch(e){return fallback;}} function initStartPing(PING,INPUT,DATA){PING.delay=1000;PING.alias=INPUT.alias;PING.db=INPUT.db;PING.session_id=DATA.session_id;PING.unique_id=DATA.unique_id;PING.new_session=DATA.new_session;PING.delta_time=DATA.delta_time;PING.user_status=DATA.user_status;PING.version_number=INIT.version_number;PING.package_name=INIT.package_name;PING.started_on=Date.now();PING.task="ping";PING.origin=INPUT.origin;pingPage7(PING);} function pingPage7(PING){if(PING.timerId){clearTimeout(PING.timerId);PING.timerId=null;} if(Date.now()-PING.started_on>INIT.max_duration){return;} let hasFocus=true;if(PING.origin!="WixStatsWorker"){try{if(document.hasFocus)hasFocus=document.hasFocus();}catch(_){}} if(document.visibilityState==="hidden"||!hasFocus){PING.delay=2000;PING.timerId=setTimeout(()=>pingPage7(PING),2000);return;} fetch("https://"+INIT.app_url+"/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(PING),keepalive:true}) .then((response)=>{if(!response.ok){throw new Error("HTTP "+response.status);} const ct=(response.headers.get("content-type")||"").toLowerCase();if(!ct.includes("application/json")){return{};} return response.json() .catch(()=>{return{};});}) .then((RESPONSE)=>{if(RESPONSE&&RESPONSE.success!=="1"){}}) .catch(()=>{});PING.delay=PING.delay+1000;if(PING.delay>60000)PING.delay=60000;PING.timerId=setTimeout(()=>pingPage7(PING),PING.delay);} function updatePanel7(PANEL){if(PANEL.timerId){clearTimeout(PANEL.timerId);} if(PANEL.error||!document.getElementById("wts_dot2_"+PANEL.alias)){return;} if(document.visibilityState=="hidden"){PANEL.timerId=setTimeout(function(){updatePanel7(PANEL);},3000);return;} try{document.getElementById("wts_dot2_"+PANEL.alias).style.opacity="1";} catch(err){wtsDebug7("Error getting style for wts_dot2_"+PANEL.alias+" / typeof = "+typeof document.getElementById("wts_dot2_"+PANEL.alias));} var previous_count=parseInt(document.getElementById("wts_last_"+PANEL.alias).innerHTML);fetch("https://"+INIT.app_url+"/image",{method:"POST",body:JSON.stringify(PANEL),keepalive:true}) .then(function(response){if(!response.ok){throw new Error("Server responded with an error");} return response.json();}) .then(function(RESPONSE){if(!RESPONSE.visits&&!RESPONSE.online){PANEL.error=true;return;} document.getElementById("wts_p_visits_"+PANEL.alias).innerHTML=RESPONSE.visits.toLocaleString();document.getElementById("wts_p_online_"+PANEL.alias).innerHTML=RESPONSE.online.toLocaleString();if(RESPONSE.visits>previous_count&&PANEL.delay>3000){PANEL.delay=PANEL.delay-1000;} else{PANEL.delay=PANEL.delay+1000;} if(PANEL.delay>60000){PANEL.delay=60000;} if(PANEL.delay<2000){PANEL.delay=2000;} PANEL.timerId=setTimeout(function(){updatePanel7(PANEL);},PANEL.delay);document.getElementById("wts_dot2_"+PANEL.alias).style.opacity="0";}) .catch(function(){});} function redirect7(obj){var _obj_dataset,_obj_dataset2;var url=obj.href||((_obj_dataset=obj.dataset)===null||_obj_dataset===void 0?void 0:_obj_dataset.href);if(!url){return;} var target=obj.target||(((_obj_dataset2=obj.dataset)===null||_obj_dataset2===void 0?void 0:_obj_dataset2.target)==="new"?"_blank":null);if(target){try{window.open(url,target);} catch(err){redirectToTopOrCurrent(url);}} else{redirectToTopOrCurrent(url);}} function redirectToTopOrCurrent(url){try{window.top.location=url;} catch(err){window.location=url;}} function beforeunloadHandler(PING){if(PING.unload_signal_sent){return;} PING.task="unload";PING.unload_signal_sent=navigator.sendBeacon("https://"+INIT.app_url+"/image",JSON.stringify(PING));} function visibilitychangeHandler(e,INPUT,PING,PANEL){if(document.visibilityState==='visible'){if(PANEL.task){PANEL.delay=0;updatePanel7(PANEL);} var hasFocus=true;try{hasFocus=top.document.hasFocus();} catch(err){} if(hasFocus){var now=Date.now();if(now-INIT.timeLastLoad>INIT.session_length){wtsl7_exe(INPUT);} else if((now-INIT.timeLastLoad)>INIT.session_length){wtsl7_exe(INPUT);} else{if(PING.task){PING.delay=0;PING.started_on=Date.now();PING.restarted_by=visibilitychangeHandler;PING.restarted_tllc=INIT.timeLastLoad;PING.restarted_now=now;setTimeout(function(){pingPage7(PING);},1000);}}}}} function focusHandler(e,INPUT,PING,PANEL){var now=Date.now();if(now-INIT.timeLastLoad>INIT.session_length){wtsl7_exe(INPUT);} else if((now-INIT.timeLastLoad)>INIT.session_length){wtsl7_exe(INPUT);} else{if(PING.task){PING.restarted_by=focusHandler;PING.restarted_tllc=INIT.timeLastLoad;PING.restarted_now=now;PING.delay=0;PING.started_on=Date.now();setTimeout(function(){pingPage7(PING);},1000);} if(PANEL.task){PANEL.delay=0;updatePanel7(PANEL);}}} function pageshowHandler(e,INPUT){if(e.persisted){if(INIT.currentURL!=INIT.lastURL){wtsl7_exe(INPUT);} else{var now=Date.now();if(now-INIT.timeLastLoad>INIT.session_length){wtsl7_exe(INPUT);}}}} function testCookie(){let cookieOK=0;try{const secure=location.protocol==="https:"?"; Secure":"";const val=Math.random().toString(36).slice(2);document.cookie="wb_test="+val+"; Path=/; SameSite=Lax"+secure;if(document.cookie.indexOf("wb_test="+val)!==-1){cookieOK=1;} document.cookie="wb_test=; Path=/; Max-Age=0; SameSite=Lax"+secure;}catch(e){} return cookieOK;} function testLocalStorage(){let localStorageOK=0;try{localStorage.setItem("__wb","1");localStorage.removeItem("__wb");localStorageOK=1;}catch(e){} return localStorageOK;} function startHumanProbe(){const details={cookieOK:false,localStorageOK:false,ua:navigator.userAgent||"",webdriver:!!navigator.webdriver,pluginsCount:(navigator.plugins&&navigator.plugins.length)||0,workMs:0,};try{const secure=location.protocol==="https:"?"; Secure":"";document.cookie="wb_test=1; Path=/; SameSite=Lax"+secure;details.cookieOK=document.cookie.indexOf("wb_test=")!==-1;document.cookie="wb_test=; Path=/; Max-Age=0; SameSite=Lax"+secure;}catch(e){} try{localStorage.setItem("__wb","1");localStorage.removeItem("__wb");details.localStorageOK=true;}catch(e){} let base=0;if(details.cookieOK)base+=1;if(details.localStorageOK)base+=2;if(details.ua)base+=1;if(!details.webdriver)base+=1;const bot=getBotScore();if(base>5){wtsDebug7("Human probe with base = "+base+" > 5 ?");} const score=Math.max(0,Math.min(10,base-0.5*bot.score));const reasons=[];if(bot.score>0)reasons.push(...bot.reasons.map(r=>"bot:"+r));if(!details.cookieOK)reasons.push("cookies-disabled");if(!details.localStorageOK)reasons.push("localstorage-disabled");if(details.webdriver)reasons.push("webdriver-true");if(score>5){wtsDebug7("Human probe with score = "+score+" > 5 ?");} return{score,details,reasons,ready:true,baseScore:base};} function getBotScore(){let score=0;const reasons=[];if(safeGet(()=>navigator.webdriver,false)){score+=2;reasons.push("navigator.webdriver is true");} const langs=safeGet(()=>navigator.languages,[]);if(!langs||langs.length===0){score+=1;reasons.push("navigator.languages is empty");} const ua=safeGet(()=>navigator.userAgent,"");if(!ua){score+=0.5;reasons.push("Missing userAgent");}else if(/HeadlessChrome|PhantomJS|SlimerJS/i.test(ua)){score+=2;reasons.push("Suspicious user agent");} const plat=safeGet(()=>navigator.platform,"").toLowerCase();if(/iphone|ipad|ipod|ios/.test(ua)&&!/iphone|ipad|ipod|ios/.test(plat)){score+=0.5;reasons.push("platform_mismatch_client_ios");} if(/android/.test(ua)&&!/android|linux arm/.test(plat)){score+=0.5;reasons.push("platform_mismatch_client_android");} const hc=safeGet(()=>Number(navigator.hardwareConcurrency),0);if(hc===1){score+=1;reasons.push("Single CPU core reported");} const touchEventCapable=safeGet(()=>"ontouchstart"in window,false);const hasTouchPoints=safeGet(()=>(navigator.maxTouchPoints||0)>0,false);if(touchEventCapable!==hasTouchPoints){score+=0.5;reasons.push("Touch support mismatch");} return{score,reasons};} function safeGet(fn,fallback=""){try{return fn();}catch(e){return fallback;}} function getShopifyData(INPUT){function safeGet(fn){try{return fn();}catch(e){return null;}} function get(obj,path){var cur=obj;for(var i=0;i0&&typeof langs[0]==="string";return{status:ok?"valid":"broken_array",count:langs.length||0};} if(typeof langs==="string"){return{status:"string",count:langs?1:0};} if(typeof langs==="object"&&typeof langs.length==="number"){return{status:"array_like",count:langs.length||0};} return{status:"invalid_type",count:0};} function wtsDebug7(e_text,e_object){console.log("error: "+e_text);var errData=new URLSearchParams();errData.append('e_text',e_text);if(e_object){errData.append('e_object',e_object.toString()+' / e name: '+e_object.name+' e message: '+e_object.message);} errData.append('origin','log7');errData.append('version',INIT.version_number);errData.append('referrer',document.referrer);errData.append('url',document.URL);navigator.sendBeacon("https://app1.selusio.com/print.pl",errData);return;}})();