var Fun,chatInstance;(function(n){var t;(function(n){var t=function(){function n(){var f;this.SiteInstance=null;this.QuiqSDKUrl="https://fun.quiq-api.com/app/webchat/index.js";this.ChatCacheCookieName="CHATCACHE_V1";this.OfflineButtonSelector=".stlc-ofl";this.OnlineButtonSelector=".stlc-onl";var s="#f9f9f9",h="#333",n="500",i="1px solid #ddd",r="10px 10px 10px 0",e="50rem",u="600",t="#fff",c="25px",l="Customer Support",a="Ask Us Anything",o=document.querySelectorAll("[data-chatid=quiq]"),v=[];if(o.length>0)for(f=0;f<o.length;f++)v.push("#"+o[f].getAttribute("id")+" .stlc-onl");typeof textResource!="undefined"&&(l=textResource.GetTextByCulture("Feature_Chat_CustomerSupport"),a=textResource.GetTextByCulture("Feature_Chat_AskAnything"));typeof renderBadge!="undefined"&&(c="79px");this.QuiqOptions={contactPoint:"funcom",showDefaultLaunchButton:!1,customLaunchButtons:v,defaultAgentAvatar:window.location.origin+"/Views/Shared/_Chat/img/avatar.png",webFontUrls:[window.location.origin+"/content/font/monsterrat.css"],fontFamily:'"Monsterrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',width:"min(calc(100% - 50px), 450px)",borderRadius:5,position:{right:"25px",bottom:c},colors:{primary:"#900",agentMessageBackground:t,agentMessageDropdownButtonIcons:t,agentMessageText:h,customerMessageText:t,menuText:"#e6e6e6",transcriptBackground:s},styles:{HeaderMenu:{padding:"10px"},HeaderMenuIcons:{width:"20px",height:"20px",marginLeft:"10px",lineHeight:"18px",fill:t},HeaderBanner:{fontWeight:n,backgroundColor:s,borderBottom:i,color:h,padding:"0 20px",minHeight:"40px"},WelcomeFormBanner:{fontWeight:n},WelcomeFormFieldLabel:{fontWeight:n},WelcomeFormSubmitButton:{color:t,fontWeight:u,borderRadius:"0.4rem",padding:"0.5rem 1rem"},WelcomeFormValidationStyle:{background:"#f8d7da",border:"1px #f5c6cb solid",borderRadius:"0.25rem",color:"#721c24",padding:".75rem 1.25rem"},ErrorBanner:{background:"#f8d7da",border:"1px #f5c6cb solid",borderRadius:"0.25rem",color:"#721c24",padding:".75rem 1.25rem"},AgentAttachmentBubble:{border:i,borderRadius:r},AgentAvatar:{width:"50px",height:"50px",boxShadow:"none",alignSelf:"flex-end"},AgentMessageBubble:{border:i,borderRadius:r},AgentMessageText:{fontWeight:n},AgentOpenGraphLink:{bubble:{color:t,fontWeight:n}},AgentRichMessage:{body:{fontWeight:n},bubble:{borderRadius:r,border:i},button:{fontWeight:u,borderRadius:e},title:{fontWeight:n},subtitle:{fontWeight:n}},CustomerAttachmentBubble:{border:i,borderRadius:r},CustomerMessageBubble:{borderRadius:e},CustomerMessageText:{fontWeight:n},CustomerOpenGraphLink:{bubble:{fontWeight:n,color:t}},CustomerRichMessage:{body:{fontWeight:n},title:{fontWeight:n},subtitle:{fontWeight:n}},InlineActionButton:{background:t,fontWeight:u,fontSize:"16px",borderRadius:e,marginTop:"5px"},MessageFormInput:{fontWeight:n},MessageFormSend:{color:t,borderColor:"#600",fontWeight:u,borderRadius:"0.4rem",padding:"0.5rem 1rem",marginLeft:"10px",marginRight:0},OptionsMenuLineItem:{fontWeight:n}},messages:{headerText:a,titleText:l,storageDisabled:"Storage Disabled",unsupportedBrowser:"Unsupported Browser"}}}return n.prototype.ConfigureChat=function(){var n=$(".stlc-sco");if($("#duplicateOrder").fancybox({beforeLoad:function(){console.log("before show")}}),this.SiteInstance!==null)if($.extend(!0,this.QuiqOptions,this.SiteInstance.GetOptions()),(window.location.href.indexOf(".test/")>-1||window.location.href.indexOf(".alpha/")>-1||window.location.href.indexOf(".beta/")>-1||window.location.href.indexOf(".train/")>-1||window.location.href.indexOf(".stage/")>-1)&&(this.QuiqOptions.contactPoint="devtesting"),Fun.CookieManager.GetCookie(this.ChatCacheCookieName)==="true")this.DownloadChat();else if(n.length)if(n.hasClass("lazyloaded"))this.DownloadChat();else $(document).on("lazybeforeunveil",function(n){$(n.target).attr("id")==="stlcsco"&&typeof chatInstance!="undefined"&&chatInstance.DownloadChat()});else enquire.register(MediaMobile,{deferSetup:!0,setup:function(){$("#menuModal").on("show.bs.modal",function(){$(this).off("show.bs.modal");typeof chatInstance!="undefined"&&chatInstance.DownloadChat()})}}),enquire.register(MediaDesktop,{deferSetup:!0,setup:function(){typeof chatInstance!="undefined"&&(Fun.CookieManager.GetCookie(this.ChatCacheCookieName)==="true"?chatInstance.DownloadChat():setTimeout(function(){chatInstance.DownloadChat()},2e3))}})},n.prototype.DownloadChat=function(){if(typeof Quiq=="undefined"){$(this.OnlineButtonSelector).addClass("stlc-load");var n=document.createElement("script");n.src=chatInstance.QuiqSDKUrl;n.charset="UTF-8";n.defer=!0;n.onload=function(){typeof chatInstance!="undefined"&&chatInstance.InitializeChat()};document.body.appendChild(n)}},n.prototype.InitializeChat=function(){typeof Quiq!="undefined"&&(this.QuiqChat=Quiq(this.QuiqOptions),this.PostInitializeChat())},n.prototype.PostInitializeChat=function(){var n=this;this.QuiqChat.on("chatVisibilityDidChange",function(t){t.visible===!0&&n.SetChatCache()});this.QuiqChat.on("userDidRegister",function(n){var t=n.registrationData["schema.conversation.customer.email"];t!==""&&typeof emailProvider!="undefined"&&emailProvider.TriggerEmailCapture(t)});this.QuiqChat.getAgentAvailability().then(function(n){typeof chatInstance!="undefined"&&(n.available?($(chatInstance.OnlineButtonSelector).removeClass("stlc-load"),chatInstance.ShowOnlineButton()):chatInstance.ShowOfflineButton())})},n.prototype.ReinitializeChat=function(){var u=this,n,r;if(typeof chatInstance!="undefined"){var t=document.querySelectorAll("[data-chatid=quiq]"),i=[];if(t.length>0)for(n=0;n<t.length;n++)i.push("#"+t[n].getAttribute("id")+" .stlc-onl");r={customLaunchButtons:i};$.extend(!0,chatInstance.QuiqOptions,r);this.QuiqChat.reinitialize(chatInstance.QuiqOptions).then(function(n){chatInstance.QuiqChat=n;u.PostInitializeChat()})}},n.prototype.SetChatCache=function(){Fun.CookieManager.SetCookie(this.ChatCacheCookieName,!0,1)},n.prototype.ShowOfflineButton=function(){$(this.OfflineButtonSelector).show();$(this.OnlineButtonSelector).hide()},n.prototype.ShowOnlineButton=function(){$(this.OfflineButtonSelector).hide();$(this.OnlineButtonSelector).show()},n}();n.Base=t})(t=n.Chat||(n.Chat={}))})(Fun||(Fun={}));$(function(){$("div[data-chatid='quiq']").length&&(chatInstance=new Fun.Chat.Base)})