function createDeviceRotationEvent(){window.addEventListener("resize",function(){waitForFinalEvent(function(){setupDeviceOrientation()},200,Math.random().toString())},!1)}function setupDeviceOrientation(){var n=PROACTIVE_CHAT.GetSessionKey("contactDrawerState"),t=$(window).width()-($(".contact-drawer").offset().left+$(".contact-drawer").outerWidth());window.innerHeight>window.innerWidth?(isObjOnObj()||n!=="open"||PROACTIVE_CHAT.OpenProactiveChatDrawer(!0,!1),isObjOnObj()&&n==="closed"&&PROACTIVE_CHAT.CloseProactiveChatDrawer()):(n==="open"&&t!==0&&PROACTIVE_CHAT.OpenProactiveChatDrawer(!0,!1),n==="closed"&&t===0&&PROACTIVE_CHAT.OpenProactiveChatDrawer(!0,!1))}function isObjOnObj(){var n=document.getElementById("smalldevicesChatIcon"),t=document.getElementById("contact-drawer"),i=t.offsetLeft,r=t.offsetLeft+t.offsetWidth,u=n.offsetLeft,f=n.offsetLeft+n.offsetWidth,e=t.offsetTop,o=t.offsetTop+t.offsetHeight,s=n.offsetTop,h=n.offsetTop+n.offsetHeight;return u>r||fo||hi&&ui&&fe&&se&&h1?i:"auto",t.attr("width",i)),f||(r=t.height(),r=r&&r>1?r:"auto",t.attr("height",r)))})}function f(t,i){var f=t||n("img.lazy"),e=i!==undefined?i:!0,u=null;r(f);f.lazyload({effect:"fadeIn",threshold:200,failure_limit:5,skip_invisible:e,appear:function(){var t=n(this);u!=null&&(clearTimeout(u),u=null);u=setTimeout(function(){t.trigger("lazy.img.load.complete")},500)}});f.trigger("scroll")}function o(){var t=n("img.ondemand");r(t);t.each(function(){var t=n(this),i=t.attr("data-ondemand"),r=t.attr("data-eventtype"),u=n("[data-"+i+"]");u.off(r+".ondemand").on(r+".ondemand",function(){var t=n('img[data-ondemand="'+i+'"]');t.each(function(){var t=n(this),i;n.inviewport(t,{})&&(i=t.attr("data-original"),t.attr("src",i),t.removeAttr("data-original"))})})})}function s(n){for(var i,r=0,u=n.length;r0?(i?(t.css({position:"fixed",left:"50%","margin-left":-$(t).width()/2}),f=$(window).width()-(t.offset().left+t.outerWidth())):f=-260,o=f==-260?"+=260px":"+="+(f+260)+"px",t.removeAttr("style"),t.addClass("animating").css("right","-260px").animate({right:o},r)):(i?(t.css({position:"fixed",bottom:"0"}),h=0):h="-"+u,o=h=="-"+u?"+="+u+"px":"+="+u+"px",t.removeAttr("style"),t.addClass("animating").css("bottom","-"+u+"px").animate({bottom:o},r));setTimeout(function(){t.removeClass("animating");a.addClass("dellmetrics-chatdrawerclose")},r);s("contactDrawerState","open",e);c="contactDrawerAutoOpenCount";n&&(c="contactDrawerClickedOpenCount");y(c)},nt=function(){clearTimeout(h);var i,n=$(window).width()-(t.offset().left+t.outerWidth());$(".contact-drawer").offset().left>0?(i=n===0?"-=260px":"-="+(n+260)+"px",t.addClass("animating").css("right",n).animate({right:i},r)):t.addClass("animating").animate({bottom:"-="+u},r);setTimeout(function(){t.removeClass("animating");a.removeClass("dellmetrics-chatdrawerclose");t.removeClass("is-open");v.removeClass("is-open")},r);s("contactDrawerState","closed",e)},c=function(){var n=!0,t=f("contactDrawerIsHardClosed");return t&&(n=!1),n},tt=function(n){clearTimeout(h);var t=f("contactDrawerClickedOpenCount"),i=typeof t=="undefined"?!0:!1;h=setTimeout(function(){c()&&p(!1,i)},n)},w=function(n){return n===undefined||n==null||n.length<=0?!0:!1},it=function(){var n=(typeof apiBaseUrl!="undefined"?apiBaseUrl:serverUrls.apiServiceUrl)+"personalization/getusercontext";$.ajax({url:n,xhrFields:{withCredentials:!0},success:function(n){if(n){var t="";_contactDrawerConfig&&(n.WarmState?(t=_contactDrawerConfig.MicroContent.PersonalizedLabelWithCategoryName,w(t)&&(t=_contactDrawerConfig.MicroContent.PersonalizedLabelWithoutCategoryName),t=w(t)?_contactDrawerConfig.MicroContent.SubtitleLabel:t.replace("{0}",n.DisplayName)):t=_contactDrawerConfig.MicroContent.SubtitleLabel);$("#chat-drawer-personalize-message-subtitle").html(t)}else $("#chat-drawer-personalize-message-subtitle").html(_contactDrawerConfig.MicroContent.SubtitleLabel)},error:function(){$("#chat-drawer-personalize-message-subtitle").html(_contactDrawerConfig.MicroContent.SubtitleLabel)}})};return n.Init=function(){if(n.SetSessionKey("contactDrawerState","closed",n.StorageExpirationTime),createDeviceRotationEvent(),chatDrawerPersonalizeMessageEnabled==="True"&&it(),i&&!(i<=0)&&l&&!(o<=0))if(_contactDrawerConfig.EnabledBehavior.PopOutOnLoad)n.OpenAndCloseProactiveChatDrawer(),setInterval(function(){n.OpenAndCloseProactiveChatDrawer()},i+o);else var t=setTimeout(function(){n.OpenAndCloseProactiveChatDrawer();clearTimeout(t);setInterval(function(){n.OpenAndCloseProactiveChatDrawer()},i+o)},i)},n.ClearSession=function(){k()},n.SetSessionKey=function(n,t,i){s(n,t,i)},n.GetSessionKey=function(n){return f(n)},n.ClearSessionKey=function(n){d(n)},n.IsExistingSession=function(){return g()},n.OpenAndCloseProactiveChatDrawer=function(){var t=n.AreBizRulesMet(),i=$("#nit-alme-window-root").is(":visible");t&&!i&&(n.OpenProactiveChatDrawer(!1,!1),setTimeout(function(){n.CloseProactiveChatDrawer()},o))},n.OpenProactiveChatDrawer=function(n,t){p(n,t)},n.CloseProactiveChatDrawer=function(){nt()},n.IncrementDrawerOpenCounter=function(n){y(n)},n.ResetTimeOut=function(){tt(i);i=setTimeout(function(){c&&n.OpenProactiveChatDrawer(!1,!1)},o)},n.AreBizRulesMet=function(){return c()},n.StorageExpirationTime=function(){return e},n.DrawerAutoOpenTimeToWait=function(){return i},n}();waitForFinalEvent=function(){var n={};return function(t,i,r){r||(r="Don't call this twice without a uniqueId");n[r]&&clearTimeout(n[r]);n[r]=setTimeout(t,i)}}();$(".contact-drawer-tab, .smalldevices-chat-icon").on("click",function(n){var t=$(this),i=t.parent(),r=PROACTIVE_CHAT.GetSessionKey("contactDrawerState");if(i.hasClass("animating")){n.preventDefault();n.stopImmediatePropagation();return}r==="closed"?PROACTIVE_CHAT.OpenProactiveChatDrawer(!0,!1):PROACTIVE_CHAT.CloseProactiveChatDrawer();PROACTIVE_CHAT.SetSessionKey("contactDrawerIsHardClosed",!0,PROACTIVE_CHAT.StorageExpirationTime())});$(".hide-drawer").on("click",function(){var t=$(".contact-drawer").offset().left,n;t>0?(n=$(window).width()-($(".contact-drawer").offset().left+$(".contact-drawer").outerWidth()),$(".contact-drawer").removeAttr("style"),$(".contact-drawer").css({right:n}),PROACTIVE_CHAT.CloseProactiveChatDrawer()):PROACTIVE_CHAT.CloseProactiveChatDrawer();PROACTIVE_CHAT.SetSessionKey("contactDrawerIsHardClosed",!0,PROACTIVE_CHAT.StorageExpirationTime())});_contactDrawerConfig&&PROACTIVE_CHAT.Init()