var Fun;(function(n){var t;(function(n){class t{constructor(){this.SiteInstance=null;this.ChatQueryInterval=6e4;this.QuiqSDKUrl="https://fun.quiq-api.com/app/webchat/index.js";this.ChatCacheCookieName="CHATCACHE_V1";this.ContactContainers=document.querySelectorAll(".contact");this.ContactLaunchers=document.querySelectorAll(".contact__launcher");this.LaunchButtons=[];this.LaunchContainers=document.querySelectorAll("[data-chatid=quiq]:not(.contact)");this.OfflineButtonSelector=".stlc-ofl";this.OnlineButtonSelector=".stlc-onl";const e="#f9f9f9",o="#333",n="500",i="1px solid #ddd",r="10px 10px 10px 0",f="50rem",u="600",t="#fff";let s="25px",h="Customer Support",c="Ask Us Anything";this.LaunchContainers.forEach(n=>{this.LaunchButtons.push(`#${n.getAttribute("id")} .stlc-onl`)});this.ContactContainers.forEach(n=>{this.LaunchButtons.push(`#${n.getAttribute("id")} .contact__chat`)});typeof textResource!="undefined"&&(h=textResource.GetTextByCulture("Feature_Chat_CustomerSupport"),c=textResource.GetTextByCulture("Feature_Chat_AskAnything"));typeof renderBadge!="undefined"&&(s="79px");this.QuiqOptions={contactPoint:"funcom",showDefaultLaunchButton:!1,customLaunchButtons:this.LaunchButtons,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)",height:"min(calc(100% - 75px), 600px)",borderRadius:5,position:{right:"25px",bottom:s},colors:{primary:"#900",agentMessageBackground:t,agentMessageDropdownButtonIcons:t,agentMessageText:o,customerMessageText:t,menuText:"#e6e6e6",transcriptBackground:e},styles:{HeaderMenu:{padding:"10px"},HeaderMenuIcons:{width:"20px",height:"20px",marginLeft:"10px",lineHeight:"18px",fill:t},HeaderBanner:{fontWeight:n,backgroundColor:e,borderBottom:i,color:o,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:f},title:{fontWeight:n},subtitle:{fontWeight:n}},CustomerAttachmentBubble:{border:i,borderRadius:r},CustomerMessageBubble:{borderRadius:f},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:f,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:c,titleText:h,storageDisabled:"Storage Disabled",unsupportedBrowser:"Unsupported Browser"}}}ConfigureChat(){const n=$(".stlc-sco"),t=$(".stlc-nsrc");this.SiteInstance!==null&&($.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"||t.length?this.DownloadChat():n.length?this.ConfigureCheckoutChatButton(n):this.CheckChatStatus())}ReinitializeChat(){if(typeof chatInstance!="undefined"){const i="stlc-onl";let n=document.querySelectorAll("[data-chatid=quiq]"),t=[];if(n.length>0)for(let r=0;r<n.length;r++)t.push(`#${n[r].getAttribute("id")} .${i}`);let r={customLaunchButtons:t};$.extend(!0,chatInstance.QuiqOptions,r);this.QuiqChat.reinitialize(chatInstance.QuiqOptions).then(n=>{chatInstance.QuiqChat=n,this.PostInitializeChat()})}}CheckChatStatus(){const n=this.QuiqOptions.contactPoint;this.GetChatStatus(n).done(n=>{typeof n!="undefined"&&typeof n.available!="undefined"&&(n.available===!0?(this.DownloadButtonsOnline(),this.ConfigureDownloadButtons()):setTimeout(()=>{this.CheckChatStatus()},this.ChatQueryInterval))}).fail(n=>{console.log(n)})}ConfigureDownloadButtons(){const n=$("#menuModal"),t=$(".contact--head"),i="shown.bs.modal",r="shown.bs.dropdown";n.on(i,()=>{n.off(i),t.off(r),typeof chatInstance!="undefined"&&typeof Quiq=="undefined"&&chatInstance.DownloadChat()});t.on(r,()=>{n.off(i),t.off(r),typeof chatInstance!="undefined"&&typeof Quiq=="undefined"&&chatInstance.DownloadChat()})}ConfigureCheckoutChatButton(n){if(n.hasClass("lazyloaded"))this.DownloadChat();else $(document).on("lazybeforeunveil",function(n){$(n.target).attr("id")==="stlcsco"&&typeof chatInstance!="undefined"&&chatInstance.DownloadChat()})}DownloadButtonsOnline(){this.ContactLaunchers.forEach(n=>{n.classList.contains("contact__launcher--online")||n.classList.add("contact__launcher--online")})}DownloadButtonsOffline(){this.ContactLaunchers.forEach(n=>{n.classList.contains("contact__launcher--online")&&n.classList.remove("contact__launcher--online")})}DownloadChat(){if(typeof Quiq=="undefined"){let n=document.createElement("script");n.src=chatInstance.QuiqSDKUrl;n.charset="UTF-8";n.defer=!0;n.onload=()=>{typeof chatInstance!="undefined"&&chatInstance.InitializeChat()};document.body.appendChild(n)}else chatInstance.ShowOnlineButton()}GetChatStatus(n){const t=`https://fun.quiq-api.com/api/v1/messaging/agents-available?contactPoint=${n}&platform=Chat`;return $.ajax({url:t,crossDomain:!0,type:"GET",success:n=>{if(typeof n!="undefined"&&typeof n.available!="undefined")return n.available},error:n=>{console.log(n);return!1}})}InitializeChat(){typeof Quiq!="undefined"&&(this.QuiqChat=Quiq(this.QuiqOptions),this.PostInitializeChat())}PostInitializeChat(){this.QuiqChat.on("chatVisibilityDidChange",n=>{n.visible===!0&&this.SetChatCache()});this.QuiqChat.on("userDidRegister",n=>{let t=n.registrationData["schema.conversation.customer.email"];t!==""&&typeof emailProvider!="undefined"&&emailProvider.TriggerEmailCapture(t)});this.QuiqChat.getAgentAvailability().then(n=>{typeof chatInstance!="undefined"&&(n.available?chatInstance.ShowOnlineButton():chatInstance.ShowOfflineButton())})}SetChatCache(){Fun.CookieManager.SetCookie(this.ChatCacheCookieName,!0,1)}ShowOfflineButton(){let n=document.querySelectorAll(".contact__chat"),t=document.querySelectorAll(".contact__chat i");n.forEach(n=>{n.classList.add("disabled")});t.forEach(n=>{n.className="fas fa-spinner-third fa-spin mr-3"});$(this.OfflineButtonSelector).show();$(this.OnlineButtonSelector).hide();this.DownloadButtonsOffline()}ShowOnlineButton(){let n=document.querySelectorAll(".contact__chat"),t=document.querySelectorAll(".contact__chat i");n.forEach(n=>{n.classList.remove("disabled")});t.forEach(n=>{n.className="fas fa-comment-alt-dots mr-3"});$(this.OfflineButtonSelector).hide();$(this.OnlineButtonSelector).show();this.DownloadButtonsOnline()}}n.Base=t})(t=n.Chat||(n.Chat={}))})(Fun||(Fun={}));let chatInstance;$(()=>{$("div[data-chatid='quiq']").length&&(chatInstance=new Fun.Chat.Base)})