{"version":3,"sources":["../../../../dev/j/v2/components/cmp-oops.js"],"names":["userPlatform","avastGlobals","detect","browser","platform","oopsModalsTriggerButton","document","querySelectorAll","i","length","button","getAttribute","getElementById","addEventListener","e","downloadPlatform","this","toLowerCase","modal","querySelector","preventDefault","stopPropagation","web","oopsShow","modalButtons","styleReset","x","style","display","classList","contains","oopsModal","BSN","Modal","show","dataLayer","push","event","once","y","hide"],"mappings":"CAAA,WACC,YAKA,KAAK,GAHDA,GAAeC,aAAaC,OAAOC,QAAQC,SAC9CC,EAA0BC,SAASC,iBAAiB,gEAE5CC,EAAI,EAAGA,EAAIH,EAAwBI,OAAQD,IAAK,CACxD,GAAIE,GAASL,EAAwBG,EAGW,MAA5CE,EAAOC,aAAa,qBAA8BL,SAASM,eAAeF,EAAOC,aAAa,sBACjGD,EAAOG,iBAAiB,QAAS,SAAUC,GAC1C,GAAIC,GAAmBC,KAAKL,aAAa,iBAAiBM,cACzDC,EAAQZ,SAASa,cAAc,IAAMH,KAAKL,aAAa,oBAGxD,IAAII,IAAqBf,EAAc,CACtCc,EAAEM,iBACFN,EAAEO,kBACFpB,aAAaqB,IAAIC,UAAW,CAM5B,KAAK,GAJDC,GAAeN,EAAMX,iBAAiB,+BAGtCkB,EAAaP,EAAMX,iBAAiB,uBAC/BmB,EAAI,EAAGA,EAAID,EAAWhB,OAAQiB,IACtCD,EAAWC,GAAGC,MAAMC,QAAU,MAI3BV,GAAMC,cAAc,kBAAoBnB,KAC3CkB,EAAMC,cAAc,kBAAoBnB,GAAc2B,MAAMC,QAAU,SAInEV,EAAMC,cAAc,wBAA0BnB,KACjDkB,EAAMC,cAAc,wBAA0BnB,GAAc2B,MAAMC,QAAU,SAEzEV,EAAMC,cAAc,iBAAmBnB,EAAe,IAAMe,KAC/DG,EAAMC,cAAc,iBAAmBnB,EAAe,IAAMe,GAAkBY,MAAMC,QAAU,SAI3FV,EAAMC,cAAc,oBAAsBnB,KAC7CkB,EAAMC,cAAc,oBAAsBnB,GAAc2B,MAAMC,QAAU,UAIpEV,EAAMW,UAAUC,SAAS,oBAAsB9B,IAAiBkB,EAAMC,cAAc,sBAAwBJ,KAChHG,EAAMC,cAAc,sBAAwBJ,GAAkBY,MAAMC,QAAU,QAI/E,IAAIG,GAAY,GAAIC,KAAIC,MAAMf,EAC9Ba,GAAUG,OAGVhB,EAAML,iBAAiB,gBAAiB,WACd,mBAAdsB,YAA2BA,UAAUC,MAAMC,MAAS,6BAC/DpC,aAAaqB,IAAIC,UAAW,IACzBe,MAAM,GAGV,KAAK,GAAIC,GAAI,EAAGA,EAAIf,EAAaf,OAAQ8B,IAAK,CACnCf,EAAae,GAEnB1B,iBAAiB,QAAS,WAC7BkB,EAAUS","file":"cmp-oops.js","sourcesContent":["(function () {\n\t'use strict';\n\n\tvar userPlatform = avastGlobals.detect.browser.platform,\n\t\toopsModalsTriggerButton = document.querySelectorAll('[data-role=\"download-link\"][data-oops-target][data-platform]');\n\n\tfor (var i = 0; i < oopsModalsTriggerButton.length; i++) {\n\t\tvar button = oopsModalsTriggerButton[i];\n\n\t\t// check if oops modal exist\n\t\tif (button.getAttribute('data-oops-target') !== '' && document.getElementById(button.getAttribute('data-oops-target'))) {\n\t\t\tbutton.addEventListener('click', function (e) {\n\t\t\t\tvar downloadPlatform = this.getAttribute('data-platform').toLowerCase(),\n\t\t\t\t\tmodal = document.querySelector('#' + this.getAttribute('data-oops-target'));\n\n\t\t\t\t// check if platforms isn't similar\n\t\t\t\tif (downloadPlatform !== userPlatform) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tavastGlobals.web.oopsShow = true;\n\n\t\t\t\t\tvar modalButtons = modal.querySelectorAll('[data-role=\"download-link\"]');\n\n\t\t\t\t\t// can be replaced by styles in css\n\t\t\t\t\tvar styleReset = modal.querySelectorAll('[class*=\"js-oops-\"]');\n\t\t\t\t\tfor (var x = 0; x < styleReset.length; x++) {\n\t\t\t\t\t\tstyleReset[x].style.display = 'none';\n\t\t\t\t\t}\n\n\t\t\t\t\t// show title by user's platform\n\t\t\t\t\tif (modal.querySelector('.js-oops-title-' + userPlatform)) {\n\t\t\t\t\t\tmodal.querySelector('.js-oops-title-' + userPlatform).style.display = 'block';\n\t\t\t\t\t}\n\n\t\t\t\t\t// show description by user's and downloaded platforms\n\t\t\t\t\tif (modal.querySelector('.js-oops-desc-custom-' + userPlatform)) {\n\t\t\t\t\t\tmodal.querySelector('.js-oops-desc-custom-' + userPlatform).style.display = 'block';\n\t\t\t\t\t}\n\t\t\t\t\tif (modal.querySelector('.js-oops-desc-' + userPlatform + '-' + downloadPlatform)) {\n\t\t\t\t\t\tmodal.querySelector('.js-oops-desc-' + userPlatform + '-' + downloadPlatform).style.display = 'block';\n\t\t\t\t\t}\n\n\t\t\t\t\t// show primary button by user's platform\n\t\t\t\t\tif (modal.querySelector('.js-oops-primary-' + userPlatform)) {\n\t\t\t\t\t\tmodal.querySelector('.js-oops-primary-' + userPlatform).style.display = 'block';\n\t\t\t\t\t}\n\n\t\t\t\t\t// show secondary button by downloaded platform if 'secondaryDisabled' parameter is not set\n\t\t\t\t\tif (!modal.classList.contains('js-oops-disabled-' + userPlatform) && modal.querySelector('.js-oops-secondary-' + downloadPlatform)) {\n\t\t\t\t\t\tmodal.querySelector('.js-oops-secondary-' + downloadPlatform).style.display = 'block';\n\t\t\t\t\t}\n\n\t\t\t\t\t// show oops modal\n\t\t\t\t\tvar oopsModal = new BSN.Modal(modal);\n\t\t\t\t\toopsModal.show()\n\n\t\t\t\t\t// tracking of closing modal without download\n\t\t\t\t\tmodal.addEventListener('hide.bs.modal', function(){\n\t\t\t\t\t\tif (typeof dataLayer !== 'undefined') dataLayer.push({\"event\": \"compatibilityPopupClosed\"});\n\t\t\t\t\t\tavastGlobals.web.oopsShow = false;\n\t\t\t\t\t},{ once: true });\n\n\t\t\t\t\t// closing modal by clicking download button\n\t\t\t\t\tfor (var y = 0; y < modalButtons.length; y++) {\n\t\t\t\t\t\tvar btn = modalButtons[y];\n\n\t\t\t\t\t\tbtn.addEventListener('click', function() {\n\t\t\t\t\t\t\toopsModal.hide();\n\t\t\t\t\t\t})\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n})();\n"]}