(window.webpackJsonp=window.webpackJsonp||[]).push([[230],{4798:function(t,e,n){"use strict";n.r(e),n.d(e,"DomainsChecker",(function(){return r}));const o=()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1);var h=(t,e,n)=>new Promise(((o,h)=>{var r=t=>{try{d(n.next(t))}catch(t){h(t)}},c=t=>{try{d(n.throw(t))}catch(t){h(t)}},d=t=>t.done?o(t.value):Promise.resolve(t.value).then(r,c);d((n=n.apply(t,e)).next())}));class r{constructor(t,e){this.index=0,this.domains=[],this.status=[],this.timeouts={},this.checkIsForceRedirectOff=t=>!1,this.startDomainsPing=()=>{setTimeout((()=>{this.timeouts.between=setInterval((()=>{this.ping(this.index),this.index++}),2e4)}),6e3)},this.generateImage=t=>{const e=this.domains[t];if(!e)return;const img=new Image;img.onload=()=>h(this,null,(function*(){yield this.prepareSend(t,1)})),img.onerror=()=>h(this,null,(function*(){yield this.prepareSend(t,3)})),img.src=`https://${e.d}/static/pixel.gif?${Date.now()}`},this.httpClient=t,this.cookies=e}init(){return h(this,null,(function*(){if(this.cookies.get("che_g")||this.setGUID(),this.checkIsForceRedirectOff(this.cookies.get("force_redirect_off")))return;const{data:data}=yield this.httpClient.getRequest(`${document.location.origin}/checker/redirect/stat/run/`);(null==data?void 0:data.domains)&&(this.domains=data.domains,this.startDomainsPing())}))}setGUID(){this.cookies.set("che_g",`${o()}${o()}-${o()}-${o()}-${o()}-${o()}${o()}${o()}`,{expires:new Date(Date.now()+2592e6),path:"/"})}ping(t){t>this.domains.length-1?this.timeouts.between&&clearInterval(this.timeouts.between):(this.timeouts.ping=setTimeout((()=>h(this,null,(function*(){this.status[t]=2;const e=this.domains[t];e&&(yield this.send({domain:e.d,index:e.n,status:2}))}))),5e3),this.generateImage(t))}prepareSend(t,e){return h(this,null,(function*(){const n=this.domains[t];!this.status[t]&&n&&(this.timeouts.ping&&clearTimeout(this.timeouts.ping),this.status[t]=e,yield this.send({domain:n.d,index:n.n,status:e}))}))}send(t){return h(this,null,(function*(){var e;this.cookies.set("che_i",String(t.index-Number(null!=(e=this.cookies.get("che_r"))?e:0)+1),{expires:new Date(Date.now()+2592e6),path:"/"}),yield this.httpClient.postRequest(`${document.location.origin}/checker/redirect/stat/`,{params:`domain=${t.domain}&status=${t.status}&index=${t.index}`})}))}}}}]);