console.log("loading config for siliconera");console.log("no config found");window.gamursInfScroll={infScrollURL:"https://infinity-api.siliconera.com"};"use strict";console.log("Infinite scroll initialised");(function(){var F,V,Y,z,G,K,Q,X;if(typeof window>"u")return;let s=window.gamursInfScrollCustomSiteConfig;if(s&&s.disableOn&&s.disableOn.referrer){let e=s.disableOn.referrer.values.map(t=>{if(t==="")return t;let r=t;t.startsWith("https://")||t.startsWith("http://")||(r=`http://${t}`);try{r=new URL(r)}catch{r=!1}return r&&r.hostname.split(".").slice(-2).join(".")});e.includes("")&&(e=[...e,new URL(document.location).hostname.split(".").slice(-2).join(".")]);let l=s.disableOn.referrer.invert||!1,n="";try{n=new URL(document.referrer).hostname.split(".").slice(-2).join(".")}catch{n=""}if(e.includes(n)&&!l||!e.includes(n)&&l)return}let U=window.gamursInfScroll,N=s&&(F=s.categories)!=null?F:"",B=s&&(V=s.tags)!=null?V:"",A=!(s&&s.useCategories===!1),M=!(s&&s.useTags===!1),R=!!(s&&s.sameCategory),j=!!(s&&s.timeDecay),k=s&&(Y=s.timeDecayOffset)!=null?Y:"",P=s&&(z=s.timeDecayScale)!=null?z:"",q=s&&(G=s.timeDecayDecay)!=null?G:"",E=U&&(K=U.infScrollURL)!=null?K:"",C=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-categories"].value,O=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-tags"].value,p=(Q=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-experiments"])==null?void 0:Q.value,ee=window.location.href;window.gamurs_inf_scroll_data=window.gamurs_inf_scroll_data||{};let b=document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id,i=window.location.hostname.split(".")[window.location.hostname.split(".").length-2];i==="lndo"?i=window.location.hostname.split(".")[0]:i==="go-vip"&&(i=window.location.hostname.split(".")[0],i=i.split("-")[0],(i==="www"||i==="cms")&&(i=window.location.hostname.split(".")[0].split("-")[1])),window.gamurs_inf_scroll_data.nextUrl=`${E}/infscroll/${i}/${b}?categories=${C}&tags=${O}&useCategories=${A}&useTags=${M}&forceCategories=${N}&forceTags=${B}&sameCategory=${R}${j?`&timeDecayOffset=${k}&timeDecayScale=${P}&timeDecayDecay=${q}`:""}${p?`&experiments="${p}"`:""}`;let te={root:document.getElementById("scroll-area"),rootMargin:"0px",threshold:.5},se={rootMargin:"-50% 0% -50% 0%",threshold:0},le={rootMargin:"-50% 0% -10% 0%",threshold:0},ae={rootMargin:"-75% 0% -25% 0%",threshold:0},ne={rootMargin:"-87.5% 0% -12.5% 0%",threshold:0};function H(e,l,n){let t;return n==="middle"?(t=new IntersectionObserver(l,se),t=w(e,t,!1)):n==="middleofmiddle"?(t=new IntersectionObserver(l,le),t=w(e,t,!0)):n==="middlelower"?(t=new IntersectionObserver(l,ne),t=w(e,t,!1)):(t=new IntersectionObserver(l,te),t=w(e,t,!1)),t}function ie(e){if(typeof window.gamursInfScrollOnInfiniteScrollAppend=="function")try{window.gamursInfScrollOnInfiniteScrollAppend(e)}catch(l){console.log(l)}}function oe(e,l){e[0].isIntersecting&&(D(),l.unobserve(e[0].target))}function w(e,l,n){let t;return n?(e.style.position="relative",t=document.createElement("div"),t.style.position="absolute",t.style.top="50%",t.style.width="100%",t.style.height="50%",t.style.pointerEvents="none",e.appendChild(t)):t=e,l.observe(t),l}let y=[],$=document.getElementsByClassName("gamurs-inf-scroll-post")[0];y[$&&(X=$.dataset.id)!=null?X:0]=document.URL;let W=!1;history.scrollRestoration="manual";let _=!0,I="down",S=0;document.addEventListener("scroll",function(){let e=window.pageYOffset||document.documentElement.scrollTop;e>S?I="down":e<S&&(I="up"),S=e<=0?0:e});function re(e,l){e.forEach(n=>{if(n.isIntersecting&&window.location.href!==n.target.dataset.url){let t=y[n.target.dataset.id];if(I==="down"?document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id!==n.target.dataset.id&&history.pushState(null,"",t):window.location.href!==ee&&(_=!1,history.back()),document.title=n.target.dataset.title,typeof window.gamursInfScrollOnUrlChange=="function")try{window.gamursInfScrollOnUrlChange(t)}catch(o){console.log(o)}let r=Array.from(document.getElementsByTagName("link")).filter(o=>{var u;return o.attributes.getNamedItem("rel")!==null&&((u=o.attributes.getNamedItem("rel"))==null?void 0:u.value)==="canonical"})[0];r&&(r.href=t),window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"impression"})}}),Array.from(document.getElementsByClassName("gamurs-inf-scroll-post")).map(n=>l.observe(n))}addEventListener("popstate",e=>{try{_&&document.querySelector(`[data-url="${e.target.location.href.split("?")[0]}"]`).scrollIntoView()}catch(l){console.log(l)}_=!0});function D(){W?J(!1,y,L,x):(W=!0,J(!0,y,L,x))}async function J(e,l,n,t){let r=e?`${E}/campaign/${i}/${b}?categories=${C}&tags=${O}${p?`&experiments="${p}"`:""}`:window.gamurs_inf_scroll_data.nextUrl;await fetch(r).then(o=>{if(o.status!==200)throw e?"No Campaign":`request failed: ${o.text()}`;return o.json()}).then(function(u){let a=u;if(a.html!=null){l[a.id]=a.url,e||(window.gamurs_inf_scroll_data.nextUrl=a.nextUrl);let c=document.createElement("div");c.innerHTML=a.html;let g=c.firstElementChild,Z=document.head;Z&&c&&Array.from(c.getElementsByTagName("link")).forEach(v=>{Z.appendChild(v)});let f=document.getElementById("gamurs-inf-scroll-main");if(f&&g)f.appendChild(g);else throw"did not find #gamurs-inf-scroll-main";window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"append-article",label:a.id}),[c,g].forEach(v=>{Array.from(v.getElementsByTagName("script")).forEach(m=>{try{if(m.src){let d=document.createElement("script");d.src=m.src,d.type=m.type,d.id=m.id,d.async=!0,g&&v===g&&m.parentElement&&m.parentElement.removeChild(m),d.id?document.getElementById(d.id)||f==null||f.appendChild(d):f==null||f.appendChild(d)}else(0,eval)(m.innerText)}catch(d){console.log(d)}})}),ie(a.id);let h=document.getElementsByClassName("gamurs-inf-scroll-post");w(h[h.length-1],n,!0),w(h[h.length-1],t,!1),n.unobserve(h[h.length-2].lastChild)}}).catch(o=>{if(e)console.log(o),o!=="did not find #gamurs-inf-scroll-main"&&D();else{let u=window.gamurs_inf_scroll_data.nextUrl.split("?")[1].split("&").filter(c=>c.slice(0,5)==="page="),a=u.length?parseInt(u[0].split("=")[1]):1;if(a<20){if(o.slice(0,15)==="request failed:"){let c=window.gamurs_inf_scroll_data.nextUrl.split("?");window.gamurs_inf_scroll_data.nextUrl=c[0]+"?page="+(a+1).toString()+"&"+c[1].split("&").filter(g=>g.slice(0,5)!=="page=").join("&")}o!=="did not find #gamurs-inf-scroll-main"&&D()}}})}let x,L;function T(){x=H($,re,"middlelower"),L=H($,oe,"middleofmiddle")}i==="dotesports"?fetch("/wp-json/gamurs/v1/infscroll/multisites").then(e=>e.json()).then(e=>{let l=new URL(window.location.href).pathname.split("/")[1];e.includes(l)&&(i=`${i}|${l}`,window.gamurs_inf_scroll_data.nextUrl=`${E}/infscroll/${i}/${b}?categories=${C}&tags=${O}&useCategories=${A}&useTags=${M}&forceCategories=${N}&forceTags=${B}&sameCategory=${R}${j?`&timeDecayOffset=${k}&timeDecayScale=${P}&timeDecayDecay=${q}`:""}${p?`&experiments="${p}"`:""}`),T()}).catch(e=>{console.log(e),T()}):T()})();
