var Fun,chatInstance;(function(n){var t;(function(n){var t=function(){function n(){var f;this.SiteInstance=null;this.ChatQueryInterval=6e4;this.QuiqSDKUrl="https://fun.quiq-api.com/app/webchat/index.js";this.ChatCacheCookieName="CHATCACHE_V1";this.OfflineButton=$(".stlc-ofl");this.OnlineButton=$(".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(){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"),this.CheckChatStatus())},n.prototype.CheckChatStatus=function(){var n=this,t=this.QuiqOptions.contactPoint;this.GetChatStatus(t).done(function(t){typeof t!="undefined"&&typeof t.available!="undefined"&&(t.available===!0?n.EnableChatButton():setTimeout(function(){n.CheckChatStatus()},n.ChatQueryInterval))}).fail(function(n){console.log(n)})},n.prototype.DownloadChat=function(){if(typeof Quiq=="undefined"){this.OnlineButton.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.EnableChatButton=function(){var n=this;Fun.CookieManager.GetCookie(this.ChatCacheCookieName)==="true"?this.DownloadChat():setTimeout(function(){n.DownloadChat()},2e3)},n.prototype.GetChatStatus=function(n){var t="https://fun.quiq-api.com/api/v1/messaging/agents-available?contactPoint="+n+"&platform=Chat";return $.ajax({url:t,crossDomain:!0,type:"GET",success:function(n){if(typeof n!="undefined"&&typeof n.available!="undefined")return n.available},error:function(n){return console.log(n),!1}})},n.prototype.InitializeChat=function(){var n=this;typeof Quiq!="undefined"&&(this.QuiqChat=Quiq(this.QuiqOptions),this.QuiqChat.getChatVisibility().then(function(){n.SetChatCache()}),this.QuiqChat.getAgentAvailability().then(function(n){typeof chatInstance!="undefined"&&(n.available?(chatInstance.OnlineButton.removeClass("stlc-load"),chatInstance.ShowOnlineButton()):chatInstance.ShowOfflineButton())}))},n.prototype.SetChatCache=function(){Fun.CookieManager.SetCookie(this.ChatCacheCookieName,!0,1)},n.prototype.ShowOfflineButton=function(){this.OfflineButton.show();this.OnlineButton.hide()},n.prototype.ShowOnlineButton=function(){this.OfflineButton.hide();this.OnlineButton.show()},n}();n.Base=t})(t=n.Chat||(n.Chat={}))})(Fun||(Fun={}));$(function(){$("div[data-chatid='quiq']").length&&(chatInstance=new Fun.Chat.Base)})