var InteractApp=function(){this.host=this.host||"quiz.tryinteract.com",this.height="800",this.width="800",this.auto_resize=!0,this.frameUrl="",this.footer=this.footer||"hide",this.initializeComplete=!1,this.initialize=function(t){for(var i in t)this[i]=t[i];this.key=this.ref?this.ref:this.appId+""+Math.floor(1e6*Math.random()),this.generateFrameUrl(),!1===this.initializeComplete&&(this.addEvent(window,"message",this.messageListener.bind(this)),this.initializeDone=!0)},this.generateFrameUrl=function(){var t="https://"+this.host+"/#/";t+=this.preview?"preview/":"",t+=this.template?"preview/template/":"",t+=this.transcript?"preview/transcript/":"",t+=this.appId?this.appId:"",t+=(this.no_cover?"/q/1":"")+"?embed="+this.key,t+=this.mobile?"&mobile=1":"",t+=this.redirect_host?"&redirect_host=1":"",t+=this.auto_resize?"&auto_resize=1":"",t+="&origin="+encodeURIComponent(window.location.origin?window.location.origin:window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));for(var i in this.user)t+="&user."+i+"="+encodeURIComponent(this.user[i]);this.frameUrl=t},this.messageListener=function(t){if(t.origin=="https://"+this.host){var i=t.data.length?t.data.split("|"):[],e=3===i.length&&i[1]===this.key,r=!!document.getElementById("interactApp"+this.key);e&&r&&("redirectHost"===i[0]&&this.redirect(i[2]||null),"resizeHeight"===i[0]&&this.resizeHeight(i[2]||null))}},this.redirect=function(t){if(!t)return null;window.location.href=t},this.resizeHeight=function(t){if(!this.auto_resize)return null;var i=document.getElementById("interact-"+(this.ref?this.ref:this.appId)),e=document.getElementById("interactApp"+this.key);e.height=t,e.style.height=t+"px";var r=i.getBoundingClientRect();if(r.top<0)if("scrollBehavior"in document.documentElement.style)window.scrollTo(0,window.scrollY+r.top);else{var s=document.scrollingElement||document.documentElement;s.scrollTop=s.scrollTop+r.top}},this.generateFrame=function(){var t=this.aspect_ratio?'