{"version":3,"file":"videoForNav.js","names":["player","Howitwork","audioDescription","volumeButton","open","volumeButtonClick","activateHowItWorks","$","click","document","getElementById","style","display","toggleVolumeHowitwork","item","isMobileView","window","innerWidth","video","classList","add","remove","close","videoId","zIndex","position","top","width","height","borderRadius","videoWidth","videoHeight","innerHeight","marginTop","left","transform","newWidth","newHeight","aspectRatio","maxScreenWidth","maxScreenHeight","Math","min","setAttribute","unMute","playVideo","body","overflow","innerHTML","overlay","querySelector","visibility","mute","pauseVideo","seekTo","toggleVolumebutton","volumeButtonNav","isMuted","addEventListener","e","event","videoMobile","target","contains","backgroundColor","navbar"],"sources":["videoForNav.js"],"sourcesContent":["/* eslint-disable */ // --> OFF - while we fix this file\nvar player; //eslint-disable-line\nvar Howitwork;\nvar audioDescription; //eslint-disable-line\nvar volumeButton;\nvar open = false;\nvar volumeButtonClick = false;\n\ndocument.addEventListener( \"DOMContentLoaded\", activateHowItWorks, false );\nfunction activateHowItWorks(){\n // overlay = document.querySelector('.overlay-nav');\n $(\"#d-howitwork\").click(function () {\n document.getElementById(\"video-container-body\").style.display = \"block\";\n toggleVolumeHowitwork(\"open\");\n open = true; //eslint-disable-line\n });\n\n // $(\"#maf-sidebar-howitworks\").click(function () {\n // document.getElementById(\"video-container-body\").style.display = \"block\";\n // toggleVolumeHowitwork(\"open\");\n // // $(\"#sidebar\").offcanvas(\"hide\");\n // document.body.style.overflow = \"hidden\";\n // var navbar = document.getElementById(\"maf-global-navbar\");\n // navbar.style.zIndex = \"0\";\n // open = true; //eslint-disable-line\n // document.documentElement.scrollTop = 0; // For modern browsers\n // document.body.scrollTop = 0; // For older browsers\n // });\n}\n\nfunction toggleVolumeHowitwork(item) {\n //eslint-disable-line\n //eslint-disable-line\n var isMobileView = window.innerWidth <= 960;\n volumeButton = document.getElementById(\"volume-button-howitwork\");\n var video = document.getElementById(\"howitwork\");\n if (item == \"open\") {\n document.getElementById(\"video-container-body\").style.display = \"block\";\n document.getElementById(\"video-container-body\").classList.add(\"visible\");\n } else {\n document.getElementById(\"video-container-body\").style.display = \"none\";\n document.getElementById(\"video-container-body\").classList.remove(\"visible\");\n }\n var close = document.getElementById(\"close-button-howitwork\");\n var videoId = document.getElementById(\"video-container-howitwork\");\n close.style.display = \"block\";\n close.style.zIndex = \"999999\";\n videoId.style.zIndex = \"999999\";\n videoId.style.position = \"fixed\";\n if (isMobileView) {\n videoId.style.top = \"0\";\n videoId.style.width = \"100%\";\n videoId.style.height = \"100%\";\n video.style.borderRadius = \"0\";\n } else {\n video.style.borderRadius = \"24px\";\n var videoWidth = window.innerWidth >= 1260;\n var videoHeight = window.innerHeight >= 800;\n videoId.style.top = \"50%\";\n videoId.style.marginTop = \"20px\";\n videoId.style.left = \"50%\";\n videoId.style.transform = \"translate(-50%, -50%)\";\n if (videoWidth && videoHeight) {\n videoId.style.width = \"1176px\";\n videoId.style.height = \"662px\";\n } else {\n videoWidth = 1176; // Width of the video\n videoHeight = 662; // Height of the video\n var windowWidth = window.innerWidth;\n var windowHeight = window.innerHeight;\n\n // Calculate the aspect ratio of the video\n var aspectRatio = videoWidth / videoHeight;\n\n var newWidth, newHeight;\n\n // Determine the maximum dimensions based on covering 80% of the screen\n var maxScreenWidth = windowWidth * 0.6;\n var maxScreenHeight = windowHeight * 0.6;\n\n // Determine which dimension (width or height) needs to be adjusted\n if (maxScreenWidth / maxScreenHeight > aspectRatio) {\n // Adjust based on width\n newWidth = Math.min(maxScreenWidth, videoWidth);\n newHeight = newWidth / aspectRatio;\n } else {\n // Adjust based on height\n newHeight = Math.min(maxScreenHeight, videoHeight);\n newWidth = newHeight * aspectRatio;\n }\n\n // Ensure the dimensions do not exceed the original video dimensions\n newWidth = Math.min(newWidth, videoWidth);\n newHeight = Math.min(newHeight, videoHeight);\n\n videoId.style.width = newWidth + \"px\";\n videoId.style.height = newHeight + \"px\";\n }\n }\n\n if (item == \"open\") {\n volumeButton.setAttribute(\"aria-label\", \"Mute and Expand Video\");\n } else {\n volumeButton.setAttribute(\"aria-label\", \"unMute and Expand Video\");\n }\n if (item == \"open\") {\n Howitwork.unMute();\n Howitwork.playVideo();\n document.body.style.overflow = \"hidden\";\n volumeButton.innerHTML =\n '';\n } else {\n var overlay = document.querySelector(\".overlay\");\n // var close = document.getElementById(\"close-button-howitwork\"); //already defined\n close.style.display = \"none\";\n overlay.style.visibility = \"hidden\";\n Howitwork.mute();\n Howitwork.pauseVideo();\n Howitwork.seekTo(0);\n var navbar = document.getElementById(\"maf-global-navbar\");\n navbar.style.zIndex = \"99999\";\n open = false; //eslint-disable-line\n document.body.style.overflow = \"scroll\";\n volumeButton.innerHTML =\n '';\n }\n}\n\nfunction toggleVolumebutton() {\n //eslint-disable-line\n volumeButtonClick = true;\n var volumeButtonNav = document.getElementById(\"volume-button-howitwork\");\n if (Howitwork.isMuted()) {\n Howitwork.unMute();\n Howitwork.playVideo();\n volumeButtonNav.innerHTML =\n '';\n } else {\n Howitwork.mute();\n volumeButtonNav.innerHTML =\n '';\n }\n}\n\nwindow.addEventListener(\"resize\", function (e) {\n var isMobileView = window.innerWidth <= 960;\n var videoId = document.getElementById(\"video-container-howitwork\");\n if (isMobileView) {\n videoId.style.top = \"0\";\n videoId.style.width = \"100%\";\n videoId.style.height = \"100%\";\n videoId.style.left = \"0\";\n videoId.style.transform = \"translate(0%, 0%)\";\n videoId.style.marginTop = \"0px\";\n } else {\n var videoWidth = window.innerWidth >= 1260;\n var videoHeight = window.innerHeight >= 800;\n videoId.style.marginTop = \"20px\";\n videoId.style.top = \"50%\";\n videoId.style.left = \"50%\";\n videoId.style.transform = \"translate(-50%, -50%)\";\n if (videoWidth && videoHeight) {\n videoId.style.top = \"50%\";\n videoId.style.left = \"50%\";\n videoId.style.width = \"1176px\";\n videoId.style.height = \"662px\";\n } else {\n var videoWidth = 1176; // Width of the video\n var videoHeight = 662; // Height of the video\n var windowWidth = window.innerWidth;\n var windowHeight = window.innerHeight;\n\n // Calculate the aspect ratio of the video\n var aspectRatio = videoWidth / videoHeight;\n\n let newWidth, newHeight;\n\n // Determine the maximum dimensions based on covering 80% of the screen\n var maxScreenWidth = windowWidth * 0.6;\n var maxScreenHeight = windowHeight * 0.6;\n\n // Determine which dimension (width or height) needs to be adjusted\n if (maxScreenWidth / maxScreenHeight > aspectRatio) {\n // Adjust based on width\n newWidth = Math.min(maxScreenWidth, videoWidth);\n newHeight = newWidth / aspectRatio;\n } else {\n // Adjust based on height\n newHeight = Math.min(maxScreenHeight, videoHeight);\n newWidth = newHeight * aspectRatio;\n }\n\n // Ensure the dimensions do not exceed the original video dimensions\n newWidth = Math.min(newWidth, videoWidth);\n newHeight = Math.min(newHeight, videoHeight);\n\n videoId.style.width = newWidth + \"px\";\n videoId.style.height = newHeight + \"px\";\n }\n }\n});\n\ndocument.addEventListener(\"click\", function (event) {\n var video = document.getElementById(\"d-howitwork\");\n var videoMobile = document.getElementById(\"maf-sidebar-howitworks\");\n var volumeButtonNav = document.getElementById(\"overlay-video\");\n if (event.target == volumeButtonNav) {\n volumeButtonClick = false;\n }\n // Check if the clicked element is not the video\n if (\n event.target !== video &&\n event.target !== videoMobile &&\n !video.contains(event.target) &&\n !videoMobile.contains(event.target)\n ) {\n // Close the video or take any action you want\n if (open && !volumeButtonClick) {\n toggleVolumeHowitwork(\"close\");\n document.getElementById(\"d-howitwork\").style.backgroundColor = \"unset\";\n var navbar = document.getElementById(\"maf-global-navbar\");\n navbar.style.backgroundColor = \"unset\";\n navbar.style.zIndex = \"99999\";\n }\n }\n});\n\n"],"mappings":"AACA,IAAIA,OACAC,UACAC,iBACAC,aACAC,MAAO,EACPC,mBAAoB,EAGxB,SAASC,qBAEPC,EAAE,gBAAgBC,OAAM,WACtBC,SAASC,eAAe,wBAAwBC,MAAMC,QAAU,QAChEC,sBAAsB,QACtBT,MAAO,CACT,GAaF,CAEA,SAASS,sBAAsBC,GAG7B,IAAIC,EAAeC,OAAOC,YAAc,IACxCd,aAAeM,SAASC,eAAe,2BACvC,IAAIQ,EAAQT,SAASC,eAAe,aACxB,Q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