"use strict";define(["Controller","../../Overlay/Views/OverlayView","../Views/SessionTimeoutView","utils"],function(d,c,e,a){var b=d.extend({src:"",logoutTime:90000,logoutLeadTime:10000,opened:false,login:"",framework:null,disabled:false,idle:0,initialize:function(f){d.prototype.initialize.apply(this,arguments);_.extend(this,f);this.overlayView=new c({css:{display:"none","background-color":"rgba(27,27,27,0.9)","z-index":"2147483647"}});this.sessionTimeoutView=new e({parent:this.overlayView});},reset:function(){this.idle=0;this.opened=false;},redirect:function(){this.overlayView.close();if($.isFunction(this.login)){this.login();}else{if(this.login.length===0){window.location.reload(true);}else{window.location=this.login;}}},displayWarning:function(f){this.warningCountdown=Math.max(0,parseInt(this.logoutLeadTime,10));this.idleCountdown=Math.max(0,parseInt(this.logoutTime,10));if(this.idle>=this.idleCountdown&&!this.opened){var g=f.$el.is(":visible");f.$el.css("visibility","visible");this.open({parent:f},_.bind(function(h){if(!g){f.$el.css("visibility","hidden");}this.reset();if(h!==true){this.redirect();}},this));}if(this.idle>this.idleCountdown+this.warningCountdown){this.reset();this.redirect();}},open:function(f,h){var g=this.logoutLeadTime*1/1000;this.view=this.sessionTimeoutView.render({parent:f.parent,timeLeft:g,"z-index":"2147483647",framework:this.framework},h);this.view.delegateEvents();this.listenTo(this.view,"view:close",_.bind(function(){this.opened=false;},this));this.opened=true;},close:function(){this.overlayView.close();this.opened=false;}});return b;});