window.addEventListener('message',function(e){if(isControlFrameEvent(e)&&eventHasJwt(e)){var eventToken="none";if(typeof e.data.utoken!='undefined'){eventToken=e.data.utoken;}
const humvEvent=new CustomEvent("HumVLoaded",{detail:{token:eventToken,},});window.dispatchEvent(humvEvent);if(typeof e.data.redirect!=='undefined'&&e.data.redirect===true){handleHumVEmote(e);window.location.replace("https://www.humix.com/humv/redirect?humvt="+e.data.jwt+"&redirect_url="+encodeURIComponent(window.location.href));}}},false);var tokenFrame=document.createElement('iframe');tokenFrame.src="https://www.humix.com/humix/control-frame.html?domain="+location.host;tokenFrame.crossOrigin=true;tokenFrame.height="1";tokenFrame.width="1";document.getElementById('humix-login-wrapper').appendChild(tokenFrame);function isControlFrameEvent(e){return(e.origin==='https://www.humix.com'||e.origin==='https://login.ezoic.com'||e.origin==='https://'+location.host||e.origin==='https://www-test.humix.com')&&typeof e.data!='undefined'&&typeof e.data.sender!=='undefined'&&e.data.sender==='authc';}
function eventHasJwt(e){return typeof e.data.has!=='undefined'&&e.data.has===true&&typeof e.data.jwt!=='undefined';}
function handleHumVEmote(e){const data={email:"",password:"",sso:{token:e.data.jwt,provider:"humix",}};var req=new XMLHttpRequest();req.open("POST","https://i.emote.com/api/commenter/login",true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.withCredentials=true;req.send(JSON.stringify(data));}