(window.webpackJsonp=window.webpackJsonp||[]).push([["SupportChat"],{"70cG":function(e,t,n){"use strict";n.r(t),function(e){n("dRSK"),n("V+eJ"),n("KKXr"),n("pIFo");var o=n("wWZ4"),a=n("bOgo"),i=n("FaD1"),c=n("a99S");function r(e){var t=Object(i.Jb)()?e.host:e.host.replace("stage","dev");return{widget_id:e.widgetId,signature:e.signature,user_id:0,user_info:{is_demo_game:Object(i.lb)()},settings:{hide_button:Object(i.sb)()||Object(i.Bb)(),locale:Object(i.J)().split("-")[0],host:t},events:{initCallback:u},eventsListener:function(e){if("refreshUnreadCounter"===e.event){var t="count"in e.data?e.data.count:0;Object(i.Bb)()&&function(e){var t=document.querySelector('[data-support-chat="open"] > div'),n=document.querySelector('[data-badge="support-chat-messages"]'),o=document.querySelector('.in-game-menu__nav-tab [data-badge="support-chat-ingame"]');if(o)if(e>0){o.innerText=e;var a=document.querySelector(".in-game-menu__toggle_button");a&&-1===a.className.indexOf("in-game-menu__toggle_button--close")&&(a.classList.add("in-game-menu__toggle_button--notify"),setTimeout((function(){a.classList.remove("in-game-menu__toggle_button--notify")}),3e3))}else o.innerText="";else{if(!t)return!1;n||((n=document.createElement("div")).classList.add("badge","badge-project-color"),n.setAttribute("data-badge","support-chat-messages"),t.appendChild(n)),e>0?n.innerText=e:n.remove()}}(t)}}}}function u(){e(window).trigger("supportChatActivated")}function s(e){console.error("[YHelperChat]",e)}function d(t){Object(i.hb)("//".concat(t.settings.host,"/widget.js")).then((function(){return function(e){return Object(i.Jb)()||console.log("yHelper config",e),new YHelperChat(e)}(t)})).then((function(){return function(){var t=e("#widget-container"),n=t.find("button.help-button");if(!t.length||!n.length)return!1;n.on("click",(function(){a.GTM.feedback({supportChat:l()})}))}()})).catch(s)}function b(){return window.ChatWidget||window.chat}function l(){return void 0!==b()}function h(e){l()&&(Object(i.Bb)()&&c.a.close(),e?b().openChat(e):b().show()),a.GTM.feedback({supportChat:l()})}function g(){window.showChat=h,Object(o.a)().query({query:Object(o.b)("supportConfig"),variables:{host:window.location.hostname},fetchPolicy:"network-only"}).then((function(e){var t,n,o=e.data.yhelperConfig,a=o.isAuthUser,c=r(o);o.brandId&&(c.settings.brandId=o.brandId),Object(i.Mb)()&&!0===a&&(c.user_id=Object(i.bb)(),c.user_info.auth_date=Object(i.X)(),c.user_info.balance=Object(i.Y)()),t=o.host,(n=document.createElement("link")).rel="preconnect",n.href="//".concat(t,"/"),document.head.appendChild(n),d(c)}))}t.default=function(){window.supportChatEnabled&&g()}}.call(this,n("EVdn"))}}]);