(window.webpackJsonp=window.webpackJsonp||[]).push([[88],{DlSw:function(e,t,r){"use strict";r.r(t),r.d(t,"ProvidersFilter",(function(){return L}));r("a1Th"),r("h7Nl"),r("XfO3"),r("HEwt"),r("rE2o"),r("LK8F"),r("WLL4"),r("jm62"),r("ioFf"),r("VRzm"),r("HAE/"),r("8+KV"),r("Tze0"),r("0l/t"),r("rGqo"),r("yt8O"),r("Btvt"),r("RW0V"),r("xfY5"),r("f3/d"),r("Z2Ku"),r("L9s1"),r("bWfx"),r("ls82");var i=r("wWZ4"),n=r("FaD1"),o=r("j1dq"),s=r("5otq"),a=r("RYuA"),l=r("e/Cp"),c=r("G3S1"),d=r("Bmw4"),u=r("h+oQ");function p(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);rs&&(i.coord.left=Math.floor(l-o-10),i.side="left"),i}}),this}},{key:"show",value:function(){return document.body.classList.add("has-popup"),this.cnt.classList.add(this.SHOW_POPUP_CLASS),this.isAlreadyOpened=!0,this}},{key:"close",value:function(){return this.searchInput.blur(),this.cnt.classList.remove(this.SHOW_POPUP_CLASS),document.documentElement.classList.remove("no-scroll"),document.body.classList.remove("has-popup"),this.searchInput.value&&(this.searchInput.value="",this._renderProvidersMarkup()._hideEmptySearchBlock()),this}},{key:"getProvidersList",value:(f=regeneratorRuntime.mark((function e(){var t,r,o,s,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(i.a)().query({query:Object(i.b)("getProvidersList"),variables:{platformType:Object(n.P)(),platform:Object(n.O)()},fetchPolicy:"network-only"});case 2:return t=e.sent,r=t.data.gameDeveloperListAll,e.next=6,l.a.sendQuery(!0);case 6:o=e.sent,s=o.data[l.a.queryName].developerIds,this.providersCount=r.length,r.map((function(e){var t=h(h({},e),{},{isEnable:s.includes(e.developerId)}),r=t.name,i=isNaN(Number(r[0]))?r[0].toUpperCase():"0-9";a.providersListByLetter[i]?a.providersListByLetter[i]=[].concat(p(a.providersListByLetter[i]),[t]):a.providersListByLetter[i]=[t]}));case 10:case"end":return e.stop()}}),e,this)})),y=function(){var e=this,t=arguments;return new Promise((function(r,i){var n=f.apply(e,t);function o(e){m(n,r,i,o,s,"next",e)}function s(e){m(n,r,i,o,s,"throw",e)}o(void 0)}))},function(){return y.apply(this,arguments)})},{key:"generateMarkup",value:function(){var e=this.generateColumnProvidersMarkup(),t='
\n
\n
\n
\n '.concat(Object(o.trans)(o.transConstant.PROVIDERS_FILTER_TITLE),'\n \n ').concat(Object(o.ln)(o.transConstant.PROVIDERS_FILTER_SHOW_ALL,0,{count:this.providersCount}),'\n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n ').concat(e,'\n
\n
\n
\n
😐
\n ').concat(Object(o.trans)(o.transConstant.PROVIDERS_FILTER_EMPTY_TEXT),'\n
\n
\n
\n
');return document.body.insertAdjacentHTML("beforeend",t),this}},{key:"generateColumnProvidersMarkup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.providersListByLetter,t="";for(var r in e)t+='
\n ').concat(r,'\n
\n ').concat(this.generateProvidersList(r,e),"\n
\n
");return t}},{key:"generateProvidersList",value:function(e,t){var r=this,i="";return t[e].map((function(e){i+='
\n
\n \n ").concat(e.name,"\n \n
")})),i}},{key:"_renderProvidersMarkup",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.providersListByLetter,r=this.lastChosenProvider&&this.lastChosenProvider.dataset.provider;return this.providersListCnt.innerHTML=this.generateColumnProvidersMarkup(t),this._setProviderButtonsEvent(),r&&(null===(e=this.providersList.querySelector('[data-provider="'.concat(r,'"]')))||void 0===e||e.classList.add("providers-filter__provider--active")),this}},{key:"_filterProviders",value:function(){var e=this,t=this.searchInput.value.toLowerCase(),r=Object.keys(this.providersListByLetter),i={};return r.map((function(r){var n=e.providersListByLetter[r].filter((function(e){return e.name.trim().toLowerCase().includes(t)}));n.length&&(i[r]=n)})),i}},{key:"_setProviderButtonsEvent",value:function(){var e=this;this.providersList.querySelectorAll("[data-provider]:not(.".concat(this.DISABLE_PROVIDER_CLASS,")")).forEach((function(t){t.addEventListener("click",(function(){var r,i=+t.dataset.provider;c.GamesList.setCurrentDeveloperId(i);var n=e.callPopupButton.querySelector('[data-provider="'.concat(i,'"]')),o=!n&&t.cloneNode(!0);t.classList.add("providers-filter__provider--active"),null===(r=e.lastChosenProvider)||void 0===r||r.classList.remove("providers-filter__provider--active"),l.a.sendQuery().then((function(r){var s=r.data[l.a.queryName].gameList,c=e.callPopupButton.querySelectorAll('[data-provider]:not([data-provider="'.concat(i,'"])'));e.lastChosenProvider=t,!e.currentFilterButtonContent&&e.callPopupButton.querySelector("[data-providers-filter-button-default]").classList.add("hide"),e.currentFilterButtonContent=o?e.callPopupButton.appendChild(o):n,c.length&&c.forEach((function(e){return e.classList.add("hide")})),null==n||n.classList.remove("hide"),e.gamesListCnt.innerHTML=s.map((function(e){return Object(a.a)(e)})).join("")})).then((function(){e.close(),e.showAllButton.classList.remove("hide")}))}))}))}},{key:"_attachButtonEvent",value:function(){var e=this;return this.callPopupButton.addEventListener("click",(function(){!e.isAlreadyOpened&&e._attachEvents(),e.show()})),this}},{key:"_showEmptySearchBlock",value:function(){this.emptySearch.classList.remove("hide"),this.providersList.classList.add("hide")}},{key:"_hideEmptySearchBlock",value:function(){return this.emptySearch.classList.add("hide"),this.providersList.classList.remove("hide"),this}},{key:"_attachEvents",value:function(){var e=this,t=window.innerWidth,r=null,i=0;this.showAllButton.addEventListener("click",(function(){var t;c.GamesList.setCurrentDeveloperId(null),null===(t=e.lastChosenProvider)||void 0===t||t.classList.remove("providers-filter__provider--active"),l.a.sendQuery().then((function(t){var r=t.data[l.a.queryName].gameList,i=e.callPopupButton.querySelectorAll("[data-provider]:not(.hide)");e.callPopupButton.querySelector("[data-providers-filter-button-default]").classList.remove("hide"),e.currentFilterButtonContent=null,null==i||i.forEach((function(e){e.classList.add("hide")})),e.gamesListCnt.innerHTML=r.map((function(e){return Object(a.a)(e)})).join("")})).then((function(){e.close(),e.showAllButton.classList.add("hide")}))})),this.background.addEventListener("click",(function(){e.close()})),this.closeButton.addEventListener("click",(function(){e.close()})),this.searchInput.addEventListener("keyup",(function(t){var n=t.keyCode,o=e.searchInput.value.length;i!==o&&(o>0&&(n>47&&n<58||n>95&&n<107||n>64&&n<91||32===n||46===n||8===n)?(r&&clearTimeout(r),r=setTimeout((function(){var t=e._filterProviders();Object.keys(t).length?e._renderProvidersMarkup(t)._hideEmptySearchBlock():e._showEmptySearchBlock(),clearTimeout(r)}),500)):0===o&&e._renderProvidersMarkup()._hideEmptySearchBlock()),i=o})),window.addEventListener("resize",(function(){var r=window.innerWidth,i=r0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(i.a)().query({query:Object(i.b)(r),variables:l(e,t),fetchPolicy:"network-only"})}}}();t.a=c}}]);