{"version":3,"sources":["../../../../dev/j/v3/pages/avast-one.js"],"names":["detectedPlatform","avastGlobals","detect","os","name","toLowerCase","collapseCompBox","document","querySelectorAll","collapseCompTable","querySelector","scrollToTarget","e","currentTarget","getAttribute","scrollIntoView","observer","MutationObserver","mutations","forEach","mutation","type","attributeName","attrVal","target","iconEntity","classList","remove","add","button","removeAttribute","dataset","bsToggle","waypoints","avm","require","tableHeaders","hideHeader","header","boolean","isVisible","el","offsetParent","tooltipInit","tooltip","BSN","Tooltip","nextHeader","nextEl","nextElementSibling","contains","window","addEventListener","getElementById","platform","togglers","activeToggler","panels","activePanel","toggler","setAttribute","panel","error","sdl","console","push","system","message","event","observe","attributes","testimonials","tns","container","controlsContainer","preventScrollOnTouch","controlsPosition","navPosition","gutter","slideBy","responsive","992"],"mappings":"CAAA,WACC,YACA,IACCA,GAAiE,YAA9CC,aAAaC,OAAOC,GAAGC,KAAKC,cAA8B,KAAOJ,aAAaC,OAAOC,GAAGC,KAAKC,cAChHC,EAAkBC,SAASC,iBAAiB,kCAC5CC,EAAoBF,SAASG,cAAc,oCAG3CC,EAAiB,SAASC,GACzBL,SAASG,cAAcE,EAAEC,cAAcC,aAAa,mBAAmBC,kBA8CxEC,EAAW,GAAIC,kBAAiB,SAASC,GACxCA,EAAUC,QAAQ,SAASC,GAC1B,GAAsB,eAAlBA,EAASC,MAAoD,kBAA3BD,EAASE,cAAmC,CACjF,GACCC,GAAUH,EAASI,OAAOV,aAAaM,EAASE,eAChDG,EAAaL,EAASI,OAAOd,cAAc,yBAE5B,UAAZa,GAEHE,EAAWC,UAAUC,OAAO,eAC5BF,EAAWC,UAAUE,IAAI,cAGzBtB,EAAgBa,QAAQ,SAASU,GAChCA,EAAOC,gBAAgB,sBAKxBL,EAAWC,UAAUE,IAAI,eACzBH,EAAWC,UAAUC,OAAO,cAG5BrB,EAAgBa,QAAQ,SAASU,GAChCA,EAAOE,QAAQC,SAAW,mBAQ/BC,EAAYC,IAAIC,QAAQ,uBACxBC,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iBAAiB,QAASzC,KAGlCF,EAAkB2C,iBAAiB,QAASzC,GAG5CK,EAASqD,QAAQ5D,GAAoB6D,YAAY,IAIjDnB,OAAOC,iBAAiB,mBAAoBT,KAM7C,IAAI4B,cAAeC,KAClBC,UAAa,0BACbC,kBAAqB,mCACrBC,qBAAwB,QACxBC,iBAAoB,SACpBC,YAAe,SACfC,OAAU,GACVC,QAAW,OACXC,YACCC,KACCH,OAAU,MAKb5C,KAAIC,QAAQ,0BAA0BoC","file":"avast-one.js","sourcesContent":["(function() {\n\t'use strict';\n\tvar\n\t\tdetectedPlatform = avastGlobals.detect.os.name.toLowerCase() === 'windows' ? 'pc' : avastGlobals.detect.os.name.toLowerCase(),\n\t\tcollapseCompBox = document.querySelectorAll('.compare-box-btn .collapse-btn'),\n\t\tcollapseCompTable = document.querySelector('#compare-table-btn .collapse-btn'),\n\n\t\t// When clicked on button, page scrolls to button's target\n\t\tscrollToTarget = function(e){\n\t\t\tdocument.querySelector(e.currentTarget.getAttribute('data-bs-target')).scrollIntoView();\n\t\t},\n\n\t\t// Makes active panel/toggler based on platform detection\n\t\tsetActivePanel = function(platform){\n\t\t\ttry {\n\t\t\t\tvar\n\t\t\t\t\ttogglers = document.querySelectorAll('.toggler-item'),\n\t\t\t\t\tactiveToggler = document.querySelector('[aria-controls=\"content_'+platform+'\"]'),\n\t\t\t\t\tpanels = document.querySelectorAll('.tab-panel'),\n\t\t\t\t\tactivePanel = document.getElementById('content_'+platform);\n\n\t\t\t\t// reset togglers\n\t\t\t\ttogglers.forEach(function(toggler){\n\t\t\t\t\ttoggler.classList.remove(\"active\");\n\t\t\t\t\ttoggler.setAttribute('aria-selected', 'false');\n\t\t\t\t});\n\n\t\t\t\t// reset panels\n\t\t\t\tpanels.forEach(function(panel){\n\t\t\t\t\tpanel.classList.remove(\"show\", \"active\");\n\t\t\t\t});\n\n\t\t\t\t// set toggler and panel active by detected platform\n\t\t\t\tactiveToggler.classList.add(\"active\");\n\t\t\t\tactiveToggler.setAttribute('aria-selected', 'true');\n\t\t\t\tactivePanel.classList.add(\"show\", \"active\");\n\t\t\t\t\n\t\t\t} catch (error) {\n\t\t\t\t// singe data layer error tracking\n\t\t\t\tif (typeof sdl !== 'undefined') {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t\tsdl.push({\n\t\t\t\t\t\tsystem: {\n\t\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\t\ttype: error.name,\n\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tevent: 'system.error'\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\n\t\t// Observer to monitor the status of the table and update opening button's icon accordingly\n\t\tobserver = new MutationObserver(function(mutations) {\n\t\t\tmutations.forEach(function(mutation) {\n\t\t\t\tif (mutation.type === \"attributes\" && mutation.attributeName === \"aria-expanded\") {\n\t\t\t\t\tvar\n\t\t\t\t\t\tattrVal = mutation.target.getAttribute(mutation.attributeName),\n\t\t\t\t\t\ticonEntity = mutation.target.querySelector('[data-cmp-name=\"icon\"]');\n\t\n\t\t\t\t\tif (attrVal === 'true') {\n\t\t\t\t\t\t//table is expanded\n\t\t\t\t\t\ticonEntity.classList.remove(\"icon-filter\");\n\t\t\t\t\t\ticonEntity.classList.add(\"icon-cross\");\n\n\t\t\t\t\t\t// remove toggle attribute from links in Compare boxes thus disable their collapse functionality\n\t\t\t\t\t\tcollapseCompBox.forEach(function(button){\n\t\t\t\t\t\t\tbutton.removeAttribute(\"data-bs-toggle\");\n\t\t\t\t\t\t});\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//table is collapsed\n\t\t\t\t\t\ticonEntity.classList.add(\"icon-filter\");\n\t\t\t\t\t\ticonEntity.classList.remove(\"icon-cross\");\n\n\t\t\t\t\t\t// add toggle attribute to links in Compare boxes thus enable their collapse functionality\n\t\t\t\t\t\tcollapseCompBox.forEach(function(button){\n\t\t\t\t\t\t\tbutton.dataset.bsToggle = \"collapse\";\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}),\n\n\t\t// Hide overlapping table sticky headers\n\t\twaypoints = avm.require('avast.web.waypoints'),\n\t\ttableHeaders = document.querySelectorAll('.tr.table-header-tr.simple'),\n\t\thideHeader = function(header, boolean) {\n\t\t\tif (boolean) {\n\t\t\t\theader.classList.add('unsticked');\n\t\t\t} else {\n\t\t\t\theader.classList.remove('unsticked');\n\t\t\t}\n\t\t},\n\n\t\t// Check el visibility is the DOM\n\t\tisVisible = function(el) {\n\t\t\treturn (el.offsetParent != null);\n\t\t},\n\t\t\n\t\t// Re-detect tooltips for proper functionality on vue priceboxes\n\t\ttooltipInit = function(){\n\t\t\tdocument.querySelectorAll(\".pricebox [data-bs-toggle='tooltip']\").forEach(function(tooltip){\n\t\t\t\tvar bsnTip = new BSN.Tooltip(tooltip);\n\t\t\t});\n\t\t};\n\t\t\n\n\t// Find next header element after each header -> next header is a waypoint where each header should not be sticky anymore\n\ttableHeaders.forEach(function(header) {\n\t\tvar\n\t\t\tnextEl = header.nextElementSibling,\n\t\t\tnextHeader;\n\t\t\n\t\t// iterate trough siblings to find a next header\n\t\twhile (nextEl) {\n\t\t\tif (nextEl.classList.contains('table-header-tr')) {\n\t\t\t\tnextHeader = nextEl;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tnextEl = nextEl.nextElementSibling;\n\t\t}\n\n\t\t// event listeners assignment only if waypoint element exists\n\t\tif (nextHeader) {\n\t\t\twindow.addEventListener('scroll', function () {\n\t\t\t\t\n\t\t\t\t// if table and both header and its waypoint header are visible, check the waypoint position\n\t\t\t\tif (document.getElementById('compare-table-collapse').classList.contains('show') && isVisible(header) && isVisible(nextHeader)) {\n\t\t\t\t\tif (waypoints(nextHeader, 20, null, true)) {\n\t\t\t\t\t\thideHeader(header, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\thideHeader(header, false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\t// Set active panel on comparison table\n\tsetActivePanel(detectedPlatform);\n\n\t// Listeners for collapse buttons in Compare Boxes\n\tcollapseCompBox.forEach(function(button){\n\t\tbutton.addEventListener(\"click\", scrollToTarget);\n\t});\n\n\tcollapseCompTable.addEventListener(\"click\", scrollToTarget);\n\n\t// Observer - pass the target node, as well as the observer options\n\tobserver.observe(collapseCompTable, {attributes: true});\n\n\n\t// listen to pricebox change and init the tooltip on #mac buy buttons\n\twindow.addEventListener(\"pricebox-updated\", tooltipInit);\n\n})();\n\n\n//carousel configuration\nvar testimonials = tns({\n\t\"container\": \".avast-one-testimonials\",\n\t\"controlsContainer\": \".avast-one-testimonials-controls\",\n\t\"preventScrollOnTouch\": \"force\",\n\t\"controlsPosition\": \"bottom\",\n\t\"navPosition\": \"bottom\",\n\t\"gutter\": 24,\n\t\"slideBy\": \"page\",\n\t\"responsive\": {\n\t\t\"992\": {\n\t\t\t\"gutter\": 32\n\t\t}\n\t}\n});\n// Create a slide counter bellow the Carousel\navm.require('avast.web.slideCounter')(testimonials);\n"]}