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AAiB,QAAS1I,KAAK0G,iBAAiB,GAExD,CAEAD,YAAAA,GAECzG,KAAKkG,YAAYrC,SAASqE,IACzBA,EAAOW,oBAAoB,QAAS7I,KAAK0H,WAAW,IAIrD1H,KAAKyF,QAAQkD,oBAAoBG,IAAI,eAAgB9I,KAAKwI,gBAG1DxI,KAAKmG,OAAOtC,SAASuC,IACpBA,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,GAE3D,EC9OD,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\tstatic SELECTORS = {\n\t\tHOLLOW_CORE:\n\t\t\t'mod-audio-carousel__item-audio-player-soundWaveBar--hollowCore',\n\t\tSOLID_CORE:\n\t\t\t'mod-audio-carousel__item-audio-player-soundWaveBar--solidCore',\n\t\tSOUNDWAVE_BAR: 'mod-audio-carousel__item-audio-player-soundWaveBar'\n\t}\n\n\tstatic CLASSES = {\n\t\tVERTICAL_LINE_WRAPPER:\n\t\t\t'mod-audio-carousel__item-audio-player-soundBarVerticalLineWrapper',\n\t\tVERTICAL_LINE:\n\t\t\t'mod-audio-carousel__item-audio-player-soundBarVerticalLine',\n\t\tPLAYING: 'mod-audio-carousel__item-audio-player-playing',\n\t\tGREEN_HIGHLIGHT: 'mod-audio-carousel__item-audio-player-greenHighlight'\n\t}\n\n\tconstructor() {\n\t\tthis.soundWaveFormAnimations = []\n\t\tthis.AnimationIntervals = null\n\t\tthis.AnimationFrame = null\n\t\tthis.AnimationFrameCount = 10\n\t\tthis.audioStatusMap = new Map()\n\t}\n\n\t/**\n\t * Create soundbar animations\n\t * @param {HTMLElement} module - The module where the soundbars will be created in\n\t */\n\tcreateSoundBarsAnimation(module) {\n\t\tconst soundWaveBars = module.querySelectorAll(\n\t\t\t`.${SoundBarsAnimation.SELECTORS.HOLLOW_CORE}`\n\t\t)\n\n\t\tfor (\n\t\t\tlet soundBarIndex = 0;\n\t\t\tsoundBarIndex < soundWaveBars.length;\n\t\t\tsoundBarIndex++\n\t\t) {\n\t\t\tconst soundBarHollow = soundWaveBars[soundBarIndex]\n\t\t\tconst soundbarSolid = module.querySelector(\n\t\t\t\t`.${\n\t\t\t\t\tSoundBarsAnimation.SELECTORS.SOLID_CORE\n\t\t\t\t}[sound=\"${soundBarHollow.getAttribute('sound')}\"]`\n\t\t\t)\n\n\t\t\tconst soundWaveForm = []\n\t\t\tfor (\n\t\t\t\tlet soundWaveFormIndex = 0;\n\t\t\t\tsoundWaveFormIndex < 19;\n\t\t\t\tsoundWaveFormIndex++\n\t\t\t) {\n\t\t\t\tconst soundWaveFormKeys = []\n\t\t\t\tfor (\n\t\t\t\t\tlet soundWaveFormKey = 0;\n\t\t\t\t\tsoundWaveFormKey < this.AnimationFrameCount;\n\t\t\t\t\tsoundWaveFormKey++\n\t\t\t\t) {\n\t\t\t\t\tlet waveAmplitude = Math.random() * 0.75 + 0.25\n\t\t\t\t\twaveAmplitude = Math.floor(waveAmplitude * waveAmplitude * 100)\n\n\t\t\t\t\tsoundWaveFormKeys[soundWaveFormKeys.length] = parseFloat(\n\t\t\t\t\t\twaveAmplitude.toFixed(1)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tsoundWaveForm[soundWaveForm.length] = soundWaveFormKeys\n\t\t\t}\n\t\t\tthis.soundWaveFormAnimations[soundBarIndex] = soundWaveForm\n\t\t\tsoundBarHollow.setAttribute('soundBarAnimation', soundBarIndex)\n\t\t\tsoundbarSolid.setAttribute('soundBarAnimation', soundBarIndex)\n\n\t\t\tthis.initiateSoundBar(soundBarHollow)\n\t\t\tthis.initiateSoundBar(soundbarSolid, soundWaveForm)\n\t\t}\n\t}\n\n\t/**\n\t * Initiates the soundbar\n\t * @param {HTMLElement} element - The element that will be updated\n\t */\n\tinitiateSoundBar(element) {\n\t\tconst soundBarVerticalLineWrapper = document.createElement('div')\n\t\tsoundBarVerticalLineWrapper.classList.add(\n\t\t\tSoundBarsAnimation.CLASSES.VERTICAL_LINE_WRAPPER\n\t\t)\n\t\telement.append(soundBarVerticalLineWrapper)\n\n\t\tfor (\n\t\t\tlet soundBarVerticalLineIndex = 0;\n\t\t\tsoundBarVerticalLineIndex < 55;\n\t\t\tsoundBarVerticalLineIndex++\n\t\t) {\n\t\t\tconst soundBarVerticalLine = document.createElement('div')\n\t\t\tsoundBarVerticalLine.classList.add(\n\t\t\t\tSoundBarsAnimation.CLASSES.VERTICAL_LINE\n\t\t\t)\n\t\t\tsoundBarVerticalLine.classList.add(\n\t\t\t\tSoundBarsAnimation.CLASSES.VERTICAL_LINE + soundBarVerticalLineIndex\n\t\t\t)\n\t\t\tsoundBarVerticalLine.style.left = 7 * soundBarVerticalLineIndex + 'px'\n\n\t\t\tconst soundWaveFormIndex = Math.floor(soundBarVerticalLineIndex / 3)\n\t\t\tconst soundBarWavePointOffset =\n\t\t\t\tsoundBarVerticalLineIndex / 3 - soundWaveFormIndex\n\n\t\t\tsoundBarVerticalLine.setAttribute(\n\t\t\t\t'waveForm',\n\t\t\t\tMath.round(soundBarWavePointOffset) + soundWaveFormIndex\n\t\t\t)\n\t\t\tconst multiplier = parseFloat(\n\t\t\t\tMath.abs(Math.round((soundBarWavePointOffset - 0.5) * 10)) * 0.2\n\t\t\t).toFixed(1)\n\t\t\tsoundBarVerticalLine.setAttribute('multiplier', multiplier)\n\n\t\t\tsoundBarVerticalLineWrapper.append(soundBarVerticalLine)\n\t\t}\n\t\tthis.updateWaveform(element, 0)\n\t}\n\n\t/**\n\t * Update waveform graphic\n\t * @param {HTMLElement} element - The element that will be updated\n\t * @param {number} frame - The frame of the animation\n\t */\n\tupdateWaveform(element, frame) {\n\t\tconst soundWaveForm =\n\t\t\tthis.soundWaveFormAnimations[element.getAttribute('soundbaranimation')]\n\t\tconst soundBarVerticalLines = element.querySelectorAll(\n\t\t\t`.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n\t\t)\n\t\tfor (\n\t\t\tlet soundBarVerticalLineIndex = 0;\n\t\t\tsoundBarVerticalLineIndex < soundBarVerticalLines.length;\n\t\t\tsoundBarVerticalLineIndex++\n\t\t) {\n\t\t\tconst soundBarVerticalLine =\n\t\t\t\tsoundBarVerticalLines[soundBarVerticalLineIndex]\n\t\t\tconst waveForm = soundBarVerticalLine.getAttribute('waveForm')\n\t\t\tconst multiplier = soundBarVerticalLine.getAttribute('multiplier')\n\n\t\t\tsoundBarVerticalLine.style.height =\n\t\t\t\tsoundWaveForm[waveForm][frame] * multiplier + '%'\n\t\t}\n\t}\n\n\t/**\n\t * Play soundbar animation\n\t * @param {HTMLElement} currentElement - The element that was clicked\n\t * @param {number} animationDurationSeconds - The duration of the audio in seconds\n\t * @returns\n\t */\n\tplaySoundBarAnimation(currentElement, animationDurationSeconds = 10) {\n\t\tconst self = this // Save this context\n\t\tconst id = currentElement.id // Assuming module.id is a unique identifier for each audio\n\t\tlet status = this.audioStatusMap.get(id)\n\n\t\tif (status && status.isPlaying) return\n\n\t\t// Stop all other animations\n\t\tthis.audioStatusMap.forEach((_status, id) => {\n\t\t\tif (id !== currentElement.id) this.stopSoundBarAnimationById(id)\n\t\t})\n\n\t\tif (!status) {\n\t\t\tstatus = {\n\t\t\t\tisPlaying: true,\n\t\t\t\ttimerCount: 0 // to track progress of the animation\n\t\t\t}\n\t\t} else {\n\t\t\tstatus.isPlaying = true\n\t\t}\n\n\t\tcurrentElement.classList.remove(SoundBarsAnimation.CLASSES.PAUSED)\n\t\tcurrentElement.classList.add(SoundBarsAnimation.CLASSES.PLAYING)\n\n\t\tconst verticalLines = currentElement.querySelectorAll(\n\t\t\t`.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n\t\t)\n\n\t\tif (!this.AnimationFrame && !status.timerCount) {\n\t\t\tcurrentElement.classList.add(SoundBarsAnimation.CLASSES.PLAYING)\n\n\t\t\tthis.totalUpdates = 55\n\t\t\tthis.progressIntervalMillis =\n\t\t\t\t(animationDurationSeconds * 1000) / this.totalUpdates\n\t\t\tthis.AnimationFrame = 1\n\t\t\tthis.updateWaveform(currentElement, this.AnimationFrame)\n\t\t} else {\n\t\t\t// Resetting the GREEN_HIGHLIGHT class for all lines\n\t\t\tverticalLines.forEach((line) => {\n\t\t\t\tline.classList.remove(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n\t\t\t})\n\n\t\t\t// Reapply the GREEN_HIGHLIGHT class up to the current position\n\t\t\tfor (let i = 0; i < status.timerCount; i++) {\n\t\t\t\tverticalLines[i].classList.add(\n\t\t\t\t\tSoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tthis.waveformAnimationInterval = setInterval(() => {\n\t\t\tself.AnimationFrame =\n\t\t\t\t(self.AnimationFrame + 1) % self.AnimationFrameCount\n\t\t\tself.updateWaveform(currentElement, self.AnimationFrame)\n\t\t}, 75)\n\n\t\tthis.AnimationIntervals = setInterval(() => {\n\t\t\tcurrentElement\n\t\t\t\t.querySelector(\n\t\t\t\t\t`.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}` +\n\t\t\t\t\t\tMath.floor(status.timerCount)\n\t\t\t\t)\n\t\t\t\t.classList.add(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n\t\t\tconst percentDone =\n\t\t\t\t(7 * Math.floor(status.timerCount)) / currentElement.clientWidth\n\n\t\t\tstatus.timerCount = status.timerCount + 1\n\t\t\tif (status.timerCount >= this.totalUpdates || percentDone >= 1) {\n\t\t\t\tclearInterval(self.AnimationIntervals)\n\t\t\t\tclearInterval(self.waveformAnimationInterval)\n\t\t\t\tstatus.isPlaying = false\n\t\t\t\tstatus.timerCount = 0 // Reset the timerCount for this audio only.\n\t\t\t}\n\t\t}, this.progressIntervalMillis)\n\n\t\t// Store the status in the map\n\t\tthis.audioStatusMap.set(id, status)\n\t}\n\n\t/**\n\t * Stop all soundbar animations\n\t */\n\tstopAllSoundBarAnimations() {\n\t\t// Stop all playing animations\n\t\tthis.audioStatusMap.forEach((status, id) => {\n\t\t\tconst elm = document.getElementById(id)\n\n\t\t\tif (elm) {\n\t\t\t\t// Remove playing class\n\t\t\t\telm.classList.remove(SoundBarsAnimation.CLASSES.PLAYING)\n\n\t\t\t\t// Remove green highlight from vertical lines\n\t\t\t\tconst verticalLines = elm.querySelectorAll(\n\t\t\t\t\t`.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n\t\t\t\t)\n\t\t\t\tverticalLines.forEach((line) => {\n\t\t\t\t\tline.classList.remove(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n\t\t\t\t})\n\n\t\t\t\t// Reset waveform\n\t\t\t\tthis.updateWaveform(elm, 0)\n\t\t\t}\n\n\t\t\t// Reset status\n\t\t\tstatus.isPlaying = false\n\t\t\tstatus.timerCount = 0\n\t\t})\n\n\t\t// Clear intervals\n\t\tclearInterval(this.AnimationIntervals)\n\t\tclearInterval(this.waveformAnimationInterval)\n\t}\n\n\t/**\n\t * Stop a specific soundbar animation\n\t * @param {number} id\n\t */\n\tstopSoundBarAnimationById(id) {\n\t\t// Get the status for the specified audio ID\n\t\tconst status = this.audioStatusMap.get(id)\n\n\t\tif (status) {\n\t\t\tconst elm = document.getElementById(id)\n\n\t\t\tif (elm) {\n\t\t\t\t// Remove playing class\n\t\t\t\telm.classList.remove(SoundBarsAnimation.CLASSES.PLAYING)\n\n\t\t\t\t// Remove green highlight from vertical lines\n\t\t\t\tconst verticalLines = elm.querySelectorAll(\n\t\t\t\t\t`.${SoundBarsAnimation.CLASSES.VERTICAL_LINE}`\n\t\t\t\t)\n\t\t\t\tverticalLines.forEach((line) => {\n\t\t\t\t\tline.classList.remove(SoundBarsAnimation.CLASSES.GREEN_HIGHLIGHT)\n\t\t\t\t})\n\n\t\t\t\t// Reset waveform\n\t\t\t\tthis.updateWaveform(elm, 0)\n\t\t\t}\n\n\t\t\t// Reset status\n\t\t\tstatus.isPlaying = false\n\t\t\tstatus.timerCount = 0\n\n\t\t\t// Clear intervals\n\t\t\tclearInterval(this.AnimationIntervals)\n\t\t\tclearInterval(this.waveformAnimationInterval)\n\n\t\t\t// Store the status back in the map\n\t\t\tthis.audioStatusMap.set(id, status)\n\t\t}\n\t}\n\n\t/**\n\t * Pause a specific soundbar animation\n\t * @param {HTMLElement} currentElement\n\t */\n\tpauseSoundBarAnimation(currentElement) {\n\t\tconst id = currentElement.id\n\t\tconst status = this.audioStatusMap.get(id)\n\n\t\tif (status && status.isPlaying) {\n\t\t\tstatus.isPlaying = false\n\t\t\tclearInterval(this.AnimationIntervals)\n\t\t\tclearInterval(this.waveformAnimationInterval)\n\n\t\t\tconst elm = currentElement.querySelector(\n\t\t\t\t`.${SoundBarsAnimation.SELECTORS.SOUNDWAVE_BAR}.${SoundBarsAnimation.CLASSES.PLAYING}`\n\t\t\t)\n\n\t\t\tif (elm != null) {\n\t\t\t\telm.classList.add(SoundBarsAnimation.CLASSES.PAUSED)\n\t\t\t}\n\n\t\t\t// Store the status back in the map\n\t\t\tthis.audioStatusMap.set(id, status)\n\t\t}\n\t}\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\tstatic SELECTORS = {\n\t\tPLAYER: '[data-cmp-audio-carousel=\"player\"]',\n\t\tPLAY_BUTTON: '[data-cmp-audio-carousel=\"button\"]',\n\t\tWAVEFORM_CONTAINER: '[data-cmp-audio-carousel=\"waveform\"]',\n\t\tCAROUSEL: '[data-carousel]',\n\t\tCAROUSEL_WRAPPER: '[data-cmp-is=\"carousel\"]'\n\t}\n\n\tstatic CLASSES = {\n\t\tPAUSED: 'mod-audio-carousel__item-audio-player-button--paused',\n\t\tPLAYING: 'mod-audio-carousel__item-audio-player-button--playing',\n\t\tSOUNDWAVE_BAR: 'mod-audio-carousel__item-audio-player-soundWaveBar'\n\t}\n\n\tconstructor(element) {\n\t\tthis.element = element // ref to component element\n\t\tthis.id = element?.id || '' // ref to component id\n\t\tthis.soundBarsAnimation = new SoundBarsAnimation() // Instantiate Soundbar animation class\n\t\tthis.service = Services.getInstance()\n\t\tthis.analyticsService = Analytics.getInstance() // ref to analytics service\n\t\tthis.audioProgressMarkers = new Map()\n\n\t\tthis.cacheDom()\n\t\tthis.soundBarsAnimation.createSoundBarsAnimation(this.element)\n\t\tthis.attachEvents()\n\t}\n\n\t/**\n\t * Cache the dom refs needed for the component\n\t */\n\tcacheDom() {\n\t\tthis.players = this.element.querySelectorAll(\n\t\t\tAudioCarousel.SELECTORS.PLAYER\n\t\t)\n\t\tthis.playButtons = this.element.querySelectorAll(\n\t\t\tAudioCarousel.SELECTORS.PLAY_BUTTON\n\t\t)\n\t\tthis.audios = this.element.querySelectorAll('audio')\n\t\tthis.audios.forEach((audio) => {\n\t\t\tthis.audioProgressMarkers.set(audio, [25, 50, 75, 100]) // Initialize progress markers for each audio\n\t\t})\n\t\tthis.carousel = this.element.querySelector(\n\t\t\tAudioCarousel.SELECTORS.CAROUSEL\n\t\t).swiper\n\t\tthis.carouselId = this.element.querySelector(\n\t\t\tAudioCarousel.SELECTORS.CAROUSEL_WRAPPER\n\t\t).id\n\t}\n\n\t/**\n\t * Destroy the component and clean up event listeners\n\t */\n\tdestroy() {\n\t\tthis.detachEvents()\n\t\tthis.soundBarsAnimation.destroy()\n\t}\n\n\t/**\n\t * Track interaction\n\t */\n\ttrackInteraction = (event) => {\n\t\tconst { target } = event\n\n\t\tswitch (event.type) {\n\t\t\tcase 'play':\n\t\t\t\tthis.analyticsService.trackInteraction('audio', {\n\t\t\t\t\taudio_title: target.dataset?.title || '',\n\t\t\t\t\taudio_player_action: 'start',\n\t\t\t\t\taudio_play: 1\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tcase 'timeupdate': {\n\t\t\t\tconst progress = Math.floor(\n\t\t\t\t\t(target.currentTime / target.duration) * 100\n\t\t\t\t)\n\t\t\t\tlet progressMarkers = this.audioProgressMarkers.get(target)\n\n\t\t\t\tfor (let i = 0; i < progressMarkers.length; i++) {\n\t\t\t\t\tif (progress >= progressMarkers[i]) {\n\t\t\t\t\t\tthis.analyticsService.trackInteraction('audio', {\n\t\t\t\t\t\t\taudio_title: target.dataset?.title || '',\n\t\t\t\t\t\t\taudio_player_action: 'progress',\n\t\t\t\t\t\t\taudio_percent: progressMarkers[i]\n\t\t\t\t\t\t})\n\t\t\t\t\t\tprogressMarkers = progressMarkers.slice(i + 1)\n\t\t\t\t\t\tthis.audioProgressMarkers.set(target, progressMarkers)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'pause': {\n\t\t\t\t/**\n\t\t\t\t * This is a workaround to stop the audio player firing the pause event\n\t\t\t\t * along with the ended event when a file finishes playing.\n\t\t\t\t */\n\t\t\t\tconst eventThreshold = Math.floor(target.duration) - 2 // Stop registering event 2 seconds before end of audio\n\t\t\t\tif (target.currentTime >= eventThreshold) return\n\n\t\t\t\tthis.analyticsService.trackInteraction('audio', {\n\t\t\t\t\taudio_title: target.dataset?.title || '',\n\t\t\t\t\taudio_player_action: 'pause'\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'ended':\n\t\t\t\tthis.analyticsService.trackInteraction('audio', {\n\t\t\t\t\taudio_title: target.dataset?.title || '',\n\t\t\t\t\taudio_player_action: 'complete'\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\t/**\n\t * Play/Pause audio\n\t */\n\ttogglePlay = (event) => {\n\t\tconst currentButton = event.target\n\t\tconst currentElement = currentButton.parentNode.querySelector(\n\t\t\t`.${AudioCarousel.CLASSES.SOUNDWAVE_BAR}`\n\t\t)\n\t\tconst audios = Array.from(this.audios)\n\t\tconst currentAudio = audios.find(\n\t\t\t(audio) => audio.dataset.buttonId === currentButton.id\n\t\t)\n\n\t\t// Pause all other players\n\t\t// Update classes\n\t\tthis.playButtons.forEach((button) => {\n\t\t\tif (button !== currentButton) {\n\t\t\t\tbutton.classList.add(AudioCarousel.CLASSES.PAUSED)\n\t\t\t\tbutton.classList.remove(AudioCarousel.CLASSES.PLAYING)\n\t\t\t}\n\t\t})\n\t\t// Pause audio\n\t\taudios.forEach((audioElement) => {\n\t\t\tif (!audioElement.paused && audioElement !== currentAudio) {\n\t\t\t\taudioElement.pause()\n\t\t\t\taudioElement.currentTime = 0\n\t\t\t}\n\t\t})\n\n\t\t// Toggle play/pause for current player\n\t\tif (currentAudio.paused) {\n\t\t\tthis.audioProgressMarkers.set(currentAudio, [25, 50, 75, 100]) // Reset progress markers\n\t\t\tcurrentButton.classList.add(AudioCarousel.CLASSES.PLAYING)\n\t\t\tcurrentButton.classList.remove(AudioCarousel.CLASSES.PAUSED)\n\n\t\t\tcurrentAudio.play()\n\t\t\tthis.soundBarsAnimation.playSoundBarAnimation(\n\t\t\t\tcurrentElement,\n\t\t\t\tcurrentAudio.duration\n\t\t\t)\n\t\t} else {\n\t\t\tcurrentButton.classList.add(AudioCarousel.CLASSES.PAUSED)\n\t\t\tcurrentButton.classList.remove(AudioCarousel.CLASSES.PLAYING)\n\t\t\tcurrentAudio.pause()\n\t\t\tthis.soundBarsAnimation.pauseSoundBarAnimation(currentElement)\n\t\t}\n\t}\n\n\t/**\n\t * Reset all player buttons and classes\n\t */\n\tresetAllPlayers = () => {\n\t\tthis.playButtons.forEach((button) => {\n\t\t\tbutton.classList.add(AudioCarousel.CLASSES.PAUSED)\n\t\t\tbutton.classList.remove(AudioCarousel.CLASSES.PLAYING)\n\t\t})\n\t}\n\n\t/**\n\t * Stop all players\n\t */\n\tstopAllPlayers = () => {\n\t\t// Update classes\n\t\tthis.resetAllPlayers()\n\n\t\t// Stop players\n\t\tfor (const player of this.audios) {\n\t\t\tplayer.pause()\n\t\t\tplayer.currentTime = 0\n\t\t}\n\n\t\t// Stop animations\n\t\tthis.soundBarsAnimation.stopAllSoundBarAnimations()\n\t}\n\n\tattachEvents() {\n\t\t// Add event listeners to play/pause buttons\n\t\tthis.playButtons.forEach((button) => {\n\t\t\tbutton.addEventListener('click', this.togglePlay)\n\t\t})\n\n\t\t// Stop all players if carousel slide changes\n\t\tthis.service.EventEmitterService.on('slideChanged', this.stopAllPlayers)\n\n\t\t// Attach events to audio players\n\t\tthis.audios.forEach((audio) => {\n\t\t\taudio.addEventListener('ended', this.resetAllPlayers)\n\n\t\t\taudio.addEventListener('play', this.trackInteraction)\n\t\t\taudio.addEventListener('timeupdate', this.trackInteraction)\n\t\t\taudio.addEventListener('pause', this.trackInteraction)\n\t\t\taudio.addEventListener('ended', this.trackInteraction)\n\t\t})\n\t}\n\n\tdetachEvents() {\n\t\t// Remove event listeners to play/pause buttons\n\t\tthis.playButtons.forEach((button) => {\n\t\t\tbutton.removeEventListener('click', this.togglePlay)\n\t\t})\n\n\t\t// Remove slide change listener\n\t\tthis.service.EventEmitterService.off('slideChanged', this.stopAllPlayers)\n\n\t\t// Remove events to audio players\n\t\tthis.audios.forEach((audio) => {\n\t\t\taudio.removeEventListener('ended', this.resetAllPlayers)\n\n\t\t\taudio.removeEventListener('play', this.trackInteraction)\n\t\t\taudio.removeEventListener('timeupdate', this.trackInteraction)\n\t\t\taudio.removeEventListener('pause', this.trackInteraction)\n\t\t\taudio.removeEventListener('ended', this.trackInteraction)\n\t\t})\n\t}\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":""}