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iB,QAAS1I,KAAK0G,iBAAiB,GAE1D,CAEAD,YAAAA,GAEEzG,KAAKkG,YAAYrC,SAASqE,IACxBA,EAAOW,oBAAoB,QAAS7I,KAAK0H,WAAW,IAItD1H,KAAKyF,QAAQkD,oBAAoBG,IAAI,eAAgB9I,KAAKwI,gBAG1DxI,KAAKmG,OAAOtC,SAASuC,IACnBA,EAAMyC,oBAAoB,QAAS7I,KAAKuI,iBAExCnC,EAAMyC,oBAAoB,OAAQ7I,KAAK0G,kBACvCN,EAAMyC,oBAAoB,aAAc7I,KAAK0G,kBAC7CN,EAAMyC,oBAAoB,QAAS7I,KAAK0G,kBACxCN,EAAMyC,oBAAoB,QAAS7I,KAAK0G,iBAAiB,GAE7D,EC5OF,S","sources":["webpack://@hero-digital/masonite/./src/components/modules/AudioCarousel/soundBarsAnimation.js","webpack://@hero-digital/masonite/./src/components/modules/AudioCarousel/AudioCarousel.js","webpack://@hero-digital/masonite/./src/components/modules/AudioCarousel/index.js"],"sourcesContent":["export default class SoundBarsAnimation {\n static SELECTORS = {\n HOLLOW_CORE:\n 'mod-audio-carousel__item-audio-player-soundWaveBar--hollowCore',\n SOLID_CORE: 'mod-audio-carousel__item-audio-player-soundWaveBar--solidCore',\n SOUNDWAVE_BAR: 'mod-audio-carousel__item-audio-player-soundWaveBar'\n }\n\n static CLASSES = {\n VERTICAL_LINE_WRAPPER:\n 'mod-audio-carousel__item-audio-player-soundBarVerticalLineWrapper',\n VERTICAL_LINE: 'mod-audio-carousel__item-audio-player-soundBarVerticalLine',\n PLAYING: 'mod-audio-carousel__item-audio-player-playing',\n GREEN_HIGHLIGHT: 'mod-audio-carousel__item-audio-player-greenHighlight'\n }\n\n constructor() {\n this.soundWaveFormAnimations = []\n this.AnimationIntervals = null\n this.AnimationFrame = null\n this.AnimationFrameCount = 10\n this.audioStatusMap = new Map()\n }\n\n /**\n * Create soundbar animations\n * @param {HTMLElement} module - The module where the soundbars will be created in\n */\n createSoundBarsAnimation(module) {\n const soundWaveBars = module.querySelectorAll(\n `.${SoundBarsAnimation.SELECTORS.HOLLOW_CORE}`\n )\n\n for (\n let soundBarIndex = 0;\n soundBarIndex < soundWaveBars.length;\n soundBarIndex++\n ) {\n const soundBarHollow = soundWaveBars[soundBarIndex]\n const soundbarSolid = module.querySelector(\n `.${\n SoundBarsAnimation.SELECTORS.SOLID_CORE\n }[sound=\"${soundBarHollow.getAttribute('sound')}\"]`\n )\n\n const soundWaveForm = []\n for (\n let soundWaveFormIndex = 0;\n soundWaveFormIndex < 19;\n soundWaveFormIndex++\n ) {\n const soundWaveFormKeys = []\n for (\n let soundWaveFormKey = 0;\n soundWaveFormKey < this.AnimationFrameCount;\n soundWaveFormKey++\n ) {\n let waveAmplitude = Math.random() * 0.75 + 0.25\n waveAmplitude = Math.floor(waveAmplitude * waveAmplitude * 100)\n\n soundWaveFormKeys[soundWaveFormKeys.length] = parseFloat(\n waveAmplitude.toFixed(1)\n )\n }\n soundWaveForm[soundWaveForm.length] = soundWaveFormKeys\n }\n this.soundWaveFormAnimations[soundBarIndex] = soundWaveForm\n soundBarHollow.setAttribute('soundBarAnimation', soundBarIndex)\n soundbarSolid.setAttribute('soundBarAnimation', soundBarIndex)\n\n this.initiateSoundBar(soundBarHollow)\n this.initiateSoundBar(soundbarSolid, soundWaveForm)\n }\n }\n\n /**\n * Initiates the soundbar\n * @param {HTMLElement} element - The element that will be updated\n */\n initiateSoundBar(element) {\n const soundBarVerticalLineWrapper = document.createElement('div')\n soundBarVerticalLineWrapper.classList.add(\n SoundBarsAnimation.CLASSES.VERTICAL_LINE_WRAPPER\n )\n element.append(soundBarVerticalLineWrapper)\n\n for (\n let soundBarVerticalLineIndex = 0;\n soundBarVerticalLineIndex < 55;\n soundBarVerticalLineIndex++\n ) {\n const soundBarVerticalLine = document.createElement('div')\n soundBarVerticalLine.classList.add(\n SoundBarsAnimation.CLASSES.VERTICAL_LINE\n )\n soundBarVerticalLine.classList.add(\n SoundBarsAnimation.CLASSES.VERTICAL_LINE + soundBarVerticalLineIndex\n )\n soundBarVerticalLine.style.left = 7 * soundBarVerticalLineIndex + 'px'\n\n const soundWaveFormIndex = Math.floor(soundBarVerticalLineIndex / 3)\n const soundBarWavePointOffset =\n soundBarVerticalLineIndex / 3 - soundWaveFormIndex\n\n soundBarVerticalLine.setAttribute(\n 'waveForm',\n Math.round(soundBarWavePointOffset) + soundWaveFormIndex\n )\n const multiplier = parseFloat(\n Math.abs(Math.round((soundBarWavePointOffset - 0.5) * 10)) * 0.2\n ).toFixed(1)\n soundBarVerticalLine.setAttribute('multiplier', multiplier)\n\n soundBarVerticalLineWrapper.append(soundBarVerticalLine)\n }\n this.updateWaveform(element, 0)\n }\n\n /**\n * Update waveform graphic\n * @param {HTMLElement} element - The element that will be updated\n * @param {number} frame - The frame of the animation\n */\n updateWaveform(element, frame) {\n const soundWaveForm =\n this.soundWaveFormAnimations[element.getAttribute('soundbaranimation')]\n const soundBarVerticalLines = element.querySelectorAll(\n `.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n )\n for (\n let soundBarVerticalLineIndex = 0;\n soundBarVerticalLineIndex < soundBarVerticalLines.length;\n soundBarVerticalLineIndex++\n ) {\n const soundBarVerticalLine =\n soundBarVerticalLines[soundBarVerticalLineIndex]\n const waveForm = soundBarVerticalLine.getAttribute('waveForm')\n const multiplier = soundBarVerticalLine.getAttribute('multiplier')\n\n soundBarVerticalLine.style.height =\n soundWaveForm[waveForm][frame] * multiplier + '%'\n }\n }\n\n /**\n * Play soundbar animation\n * @param {HTMLElement} currentElement - The element that was clicked\n * @param {number} animationDurationSeconds - The duration of the audio in seconds\n * @returns\n */\n playSoundBarAnimation(currentElement, animationDurationSeconds = 10) {\n const self = this // Save this context\n const id = currentElement.id // Assuming module.id is a unique identifier for each audio\n let status = this.audioStatusMap.get(id)\n\n if (status && status.isPlaying) return\n\n // Stop all other animations\n this.audioStatusMap.forEach((_status, id) => {\n if (id !== currentElement.id) this.stopSoundBarAnimationById(id)\n })\n\n if (!status) {\n status = {\n isPlaying: true,\n timerCount: 0 // to track progress of the animation\n }\n } else {\n status.isPlaying = true\n }\n\n currentElement.classList.remove(SoundBarsAnimation.CLASSES.PAUSED)\n currentElement.classList.add(SoundBarsAnimation.CLASSES.PLAYING)\n\n const verticalLines = currentElement.querySelectorAll(\n `.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n )\n\n if (!this.AnimationFrame && !status.timerCount) {\n currentElement.classList.add(SoundBarsAnimation.CLASSES.PLAYING)\n\n this.totalUpdates = 55\n this.progressIntervalMillis =\n (animationDurationSeconds * 1000) / this.totalUpdates\n this.AnimationFrame = 1\n this.updateWaveform(currentElement, this.AnimationFrame)\n } else {\n // Resetting the GREEN_HIGHLIGHT class for all lines\n verticalLines.forEach((line) => {\n line.classList.remove(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n })\n\n // Reapply the GREEN_HIGHLIGHT class up to the current position\n for (let i = 0; i < status.timerCount; i++) {\n verticalLines[i].classList.add(\n SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT\n )\n }\n }\n\n this.waveformAnimationInterval = setInterval(() => {\n self.AnimationFrame = (self.AnimationFrame + 1) % self.AnimationFrameCount\n self.updateWaveform(currentElement, self.AnimationFrame)\n }, 75)\n\n this.AnimationIntervals = setInterval(() => {\n currentElement\n .querySelector(\n `.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}` +\n Math.floor(status.timerCount)\n )\n .classList.add(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n const percentDone =\n (7 * Math.floor(status.timerCount)) / currentElement.clientWidth\n\n status.timerCount = status.timerCount + 1\n if (status.timerCount >= this.totalUpdates || percentDone >= 1) {\n clearInterval(self.AnimationIntervals)\n clearInterval(self.waveformAnimationInterval)\n status.isPlaying = false\n status.timerCount = 0 // Reset the timerCount for this audio only.\n }\n }, this.progressIntervalMillis)\n\n // Store the status in the map\n this.audioStatusMap.set(id, status)\n }\n\n /**\n * Stop all soundbar animations\n */\n stopAllSoundBarAnimations() {\n // Stop all playing animations\n this.audioStatusMap.forEach((status, id) => {\n const elm = document.getElementById(id)\n\n if (elm) {\n // Remove playing class\n elm.classList.remove(SoundBarsAnimation.CLASSES.PLAYING)\n\n // Remove green highlight from vertical lines\n const verticalLines = elm.querySelectorAll(\n `.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n )\n verticalLines.forEach((line) => {\n line.classList.remove(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n })\n\n // Reset waveform\n this.updateWaveform(elm, 0)\n }\n\n // Reset status\n status.isPlaying = false\n status.timerCount = 0\n })\n\n // Clear intervals\n clearInterval(this.AnimationIntervals)\n clearInterval(this.waveformAnimationInterval)\n }\n\n /**\n * Stop a specific soundbar animation\n * @param {number} id\n */\n stopSoundBarAnimationById(id) {\n // Get the status for the specified audio ID\n const status = this.audioStatusMap.get(id)\n\n if (status) {\n const elm = document.getElementById(id)\n\n if (elm) {\n // Remove playing class\n elm.classList.remove(SoundBarsAnimation.CLASSES.PLAYING)\n\n // Remove green highlight from vertical lines\n const verticalLines = elm.querySelectorAll(\n `.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n )\n verticalLines.forEach((line) => {\n line.classList.remove(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n })\n\n // Reset waveform\n this.updateWaveform(elm, 0)\n }\n\n // Reset status\n status.isPlaying = false\n status.timerCount = 0\n\n // Clear intervals\n clearInterval(this.AnimationIntervals)\n clearInterval(this.waveformAnimationInterval)\n\n // Store the status back in the map\n this.audioStatusMap.set(id, status)\n }\n }\n\n /**\n * Pause a specific soundbar animation\n * @param {HTMLElement} currentElement\n */\n pauseSoundBarAnimation(currentElement) {\n const id = currentElement.id\n const status = this.audioStatusMap.get(id)\n\n if (status && status.isPlaying) {\n status.isPlaying = false\n clearInterval(this.AnimationIntervals)\n clearInterval(this.waveformAnimationInterval)\n\n const elm = currentElement.querySelector(\n `.${SoundBarsAnimation.SELECTORS.SOUNDWAVE_BAR}.${SoundBarsAnimation.CLASSES.PLAYING}`\n )\n\n if (elm != null) {\n elm.classList.add(SoundBarsAnimation.CLASSES.PAUSED)\n }\n\n // Store the status back in the map\n this.audioStatusMap.set(id, status)\n }\n }\n}\n","// Soundwave animation\nimport SoundBarsAnimation from './soundBarsAnimation'\n\n// Utils\nimport Services from 'services'\nimport Analytics from 'services/Analytics/Analytics'\n\n/**\n * Module that displays an Where To Buy form\n */\nexport default class AudioCarousel {\n static SELECTORS = {\n PLAYER: '[data-cmp-audio-carousel=\"player\"]',\n PLAY_BUTTON: '[data-cmp-audio-carousel=\"button\"]',\n WAVEFORM_CONTAINER: '[data-cmp-audio-carousel=\"waveform\"]',\n CAROUSEL: '[data-carousel]',\n CAROUSEL_WRAPPER: '[data-cmp-is=\"carousel\"]'\n }\n\n static CLASSES = {\n PAUSED: 'mod-audio-carousel__item-audio-player-button--paused',\n PLAYING: 'mod-audio-carousel__item-audio-player-button--playing',\n SOUNDWAVE_BAR: 'mod-audio-carousel__item-audio-player-soundWaveBar'\n }\n\n constructor(element) {\n this.element = element // ref to component element\n this.id = element?.id || '' // ref to component id\n this.soundBarsAnimation = new SoundBarsAnimation() // Instantiate Soundbar animation class\n this.service = Services.getInstance()\n this.analyticsService = Analytics.getInstance() // ref to analytics service\n this.audioProgressMarkers = new Map()\n\n this.cacheDom()\n this.soundBarsAnimation.createSoundBarsAnimation(this.element)\n this.attachEvents()\n }\n\n /**\n * Cache the dom refs needed for the component\n */\n cacheDom() {\n this.players = this.element.querySelectorAll(AudioCarousel.SELECTORS.PLAYER)\n this.playButtons = this.element.querySelectorAll(\n AudioCarousel.SELECTORS.PLAY_BUTTON\n )\n this.audios = this.element.querySelectorAll('audio')\n this.audios.forEach((audio) => {\n this.audioProgressMarkers.set(audio, [25, 50, 75, 100]) // Initialize progress markers for each audio\n })\n this.carousel = this.element.querySelector(\n AudioCarousel.SELECTORS.CAROUSEL\n ).swiper\n this.carouselId = this.element.querySelector(\n AudioCarousel.SELECTORS.CAROUSEL_WRAPPER\n ).id\n }\n\n /**\n * Destroy the component and clean up event listeners\n */\n destroy() {\n this.detachEvents()\n this.soundBarsAnimation.destroy()\n }\n\n /**\n * Track interaction\n */\n trackInteraction = (event) => {\n const { target } = event\n\n switch (event.type) {\n case 'play':\n this.analyticsService.trackInteraction('audio', {\n audio_title: target.dataset?.title || '',\n audio_player_action: 'start',\n audio_play: 1\n })\n break\n case 'timeupdate': {\n const progress = Math.floor(\n (target.currentTime / target.duration) * 100\n )\n let progressMarkers = this.audioProgressMarkers.get(target)\n\n for (let i = 0; i < progressMarkers.length; i++) {\n if (progress >= progressMarkers[i]) {\n this.analyticsService.trackInteraction('audio', {\n audio_title: target.dataset?.title || '',\n audio_player_action: 'progress',\n audio_percent: progressMarkers[i]\n })\n progressMarkers = progressMarkers.slice(i + 1)\n this.audioProgressMarkers.set(target, progressMarkers)\n break\n }\n }\n break\n }\n case 'pause': {\n /**\n * This is a workaround to stop the audio player firing the pause event\n * along with the ended event when a file finishes playing.\n */\n const eventThreshold = Math.floor(target.duration) - 2 // Stop registering event 2 seconds before end of audio\n if (target.currentTime >= eventThreshold) return\n\n this.analyticsService.trackInteraction('audio', {\n audio_title: target.dataset?.title || '',\n audio_player_action: 'pause'\n })\n break\n }\n case 'ended':\n this.analyticsService.trackInteraction('audio', {\n audio_title: target.dataset?.title || '',\n audio_player_action: 'complete'\n })\n break\n default:\n break\n }\n }\n\n /**\n * Play/Pause audio\n */\n togglePlay = (event) => {\n const currentButton = event.target\n const currentElement = currentButton.parentNode.querySelector(\n `.${AudioCarousel.CLASSES.SOUNDWAVE_BAR}`\n )\n const audios = Array.from(this.audios)\n const currentAudio = audios.find(\n (audio) => audio.dataset.buttonId === currentButton.id\n )\n\n // Pause all other players\n // Update classes\n this.playButtons.forEach((button) => {\n if (button !== currentButton) {\n button.classList.add(AudioCarousel.CLASSES.PAUSED)\n button.classList.remove(AudioCarousel.CLASSES.PLAYING)\n }\n })\n // Pause audio\n audios.forEach((audioElement) => {\n if (!audioElement.paused && audioElement !== currentAudio) {\n audioElement.pause()\n audioElement.currentTime = 0\n }\n })\n\n // Toggle play/pause for current player\n if (currentAudio.paused) {\n this.audioProgressMarkers.set(currentAudio, [25, 50, 75, 100]) // Reset progress markers\n currentButton.classList.add(AudioCarousel.CLASSES.PLAYING)\n currentButton.classList.remove(AudioCarousel.CLASSES.PAUSED)\n\n currentAudio.play()\n this.soundBarsAnimation.playSoundBarAnimation(\n currentElement,\n currentAudio.duration\n )\n } else {\n currentButton.classList.add(AudioCarousel.CLASSES.PAUSED)\n currentButton.classList.remove(AudioCarousel.CLASSES.PLAYING)\n currentAudio.pause()\n this.soundBarsAnimation.pauseSoundBarAnimation(currentElement)\n }\n }\n\n /**\n * Reset all player buttons and classes\n */\n resetAllPlayers = () => {\n this.playButtons.forEach((button) => {\n button.classList.add(AudioCarousel.CLASSES.PAUSED)\n button.classList.remove(AudioCarousel.CLASSES.PLAYING)\n })\n }\n\n /**\n * Stop all players\n */\n stopAllPlayers = () => {\n // Update classes\n this.resetAllPlayers()\n\n // Stop players\n for (const player of this.audios) {\n player.pause()\n player.currentTime = 0\n }\n\n // Stop animations\n this.soundBarsAnimation.stopAllSoundBarAnimations()\n }\n\n attachEvents() {\n // Add event listeners to play/pause buttons\n this.playButtons.forEach((button) => {\n button.addEventListener('click', this.togglePlay)\n })\n\n // Stop all players if carousel slide changes\n this.service.EventEmitterService.on('slideChanged', this.stopAllPlayers)\n\n // Attach events to audio players\n this.audios.forEach((audio) => {\n audio.addEventListener('ended', this.resetAllPlayers)\n\n audio.addEventListener('play', this.trackInteraction)\n audio.addEventListener('timeupdate', this.trackInteraction)\n audio.addEventListener('pause', this.trackInteraction)\n audio.addEventListener('ended', this.trackInteraction)\n })\n }\n\n detachEvents() {\n // Remove event listeners to play/pause buttons\n this.playButtons.forEach((button) => {\n button.removeEventListener('click', this.togglePlay)\n })\n\n // Remove slide change listener\n this.service.EventEmitterService.off('slideChanged', this.stopAllPlayers)\n\n // Remove events to audio players\n this.audios.forEach((audio) => {\n audio.removeEventListener('ended', this.resetAllPlayers)\n\n audio.removeEventListener('play', this.trackInteraction)\n audio.removeEventListener('timeupdate', this.trackInteraction)\n audio.removeEventListener('pause', this.trackInteraction)\n audio.removeEventListener('ended', this.trackInteraction)\n })\n }\n}\n","import AudioCarousel from './AudioCarousel'\n\nexport default AudioCarousel\n"],"names":["SoundBarsAnimation","static","HOLLOW_CORE","SOLID_CORE","SOUNDWAVE_BAR","VERTICAL_LINE_WRAPPER","VERTICAL_LINE","PLAYING","GREEN_HIGHLIGHT","constructor","this","soundWaveFormAnimations","AnimationIntervals","AnimationFrame","AnimationFrameCount","audioStatusMap","Map","createSoundBarsAnimation","module","soundWaveBars","querySelectorAll","SELECTORS","soundBarIndex","length","soundBarHollow","soundbarSolid","querySelector","getAttribute","soundWaveForm","soundWaveFormIndex","soundWaveFormKeys","soundWaveFormKey","waveAmplitude","Math","random","floor","parseFloat","toFixed","setAttribute","initiateSoundBar","element","soundBarVerticalLineWrapper","document","createElement","classList","add","CLASSES","append","soundBarVerticalLineIndex","soundBarVerticalLine","style","left","soundBarWavePointOffset","round","multiplier","abs","updateWaveform","frame","soundBarVerticalLines","waveForm","height","playSoundBarAnimation","currentElement","animationDurationSeconds","arguments","undefined","self","id","status","get","isPlaying","forEach","_status","stopSoundBarAnimationById","timerCount","remove","PAUSED","verticalLines","line","i","totalUpdates","progressIntervalMillis","waveformAnimationInterval","setInterval","percentDone","clientWidth","clearInterval","set","stopAllSoundBarAnimations","elm","getElementById","pauseSoundBarAnimation","AudioCarousel","PLAYER","PLAY_BUTTON","WAVEFORM_CONTAINER","CAROUSEL","CAROUSEL_WRAPPER","soundBarsAnimation","service","Services","getInstance","analyticsService","Analytics","audioProgressMarkers","cacheDom","attachEvents","players","playButtons","audios","audio","carousel","swiper","carouselId","destroy","detachEvents","trackInteraction","event","target","type","audio_title","dataset","title","audio_player_action","audio_play","progress","currentTime","duration","progressMarkers","audio_percent","slice","eventThreshold","togglePlay","currentButton","parentNode","Array","from","currentAudio","find","buttonId","button","audioElement","paused","pause","play","resetAllPlayers","stopAllPlayers","player","addEventListener","EventEmitterService","on","removeEventListener","off"],"sourceRoot":""}