"use strict";define(["app","Controller","../../../../components/Overlay/Views/OverlayView","../Views/PAView","utils"],function(d,e,c,b,a){var f=e.extend({src:"",online:false,iUserId:null,initialize:function(g){e.prototype.initialize.apply(this,arguments);_.extend(this,g);this.overlayView=new c({framework:d.instance().FrontendFramework(),css:{}});this.paView=new b({parent:this.overlayView});},enableBootstrapStyling:function(){$(".container").show();},disableBootstrapStyling:function(){$(".container").hide();},transferLogout:function(h){var g=document.createElement("a");g.href=h;var i=g.protocol+"//"+g.host+"/TransferLogout.aspx?mode=kiosk";$.get(i).error(_.bind(function(l,j,k){console.log("Invalid url: "+h);this.overlayView.close();this.enableBootstrapStyling();},this));},launch:function(g){$.ajax({type:"POST",url:"/FirstAccess/GetIUser",cache:false,dataType:"HTML",data:{__RequestVerificationToken:$("[name=__RequestVerificationToken]").val(),profileId:g.profileId},success:_.bind(function(h){this.disableBootstrapStyling();this.iUserId=JSON.parse(h);if(this.iUserId.length===0){this.overlayView.close();this.enableBootstrapStyling();}else{this.view=this.paView.render(g.parent,g.src);this.view.delegateEvents();}g.parent.$el.show();window.addEventListener("message",_.bind(function(k){var i=this.src.split(":");var j=i.length>2?this.src.split(":")[1]:"";if(k.origin.indexOf(j)===-1){return;}if(k.data==="loading"||k.data==="loaded"){this.overlayView.hideSpinner();}if(k.data==="loaded"&&!this.online&&this.iUserId&&this.iUserId.length>0){this.online=true;}if(k.data==="ping"){$("body").trigger("mousemove");}else{if(k.data==="closeParent"){this.overlayView.close();this.enableBootstrapStyling();}}},this),false);},this),error:function(j,h,i){d.instance().router.navigate("/FirstAccess/error");}});}});return f;});