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AC1D,IAER,IAnEY7C,EAASsD,UAAUnD,EAAMoD,OAC7B,CACJ,GACJ,GACA,CACIC,WAAY,YACZC,UAAW,KAInB1D,GAAqBC,EAAS0D,QAAQ3D,EAC1C,GA2DJ,C","sources":["webpack:///./html/wp-content/themes/ls/src/js/main/components/videoEmbed/videoEmbed.ts"],"sourcesContent":["interface WistiaOptions {\n videoFoam: boolean;\n playerColor: string;\n controlsVisibleOnLoad: boolean;\n googleAnalytics: boolean;\n fitStrategy: string;\n preload: string;\n wmode: string;\n playButton?: boolean;\n popover?: boolean;\n}\n\ninterface WistiaVideo {\n options: WistiaOptions;\n container: HTMLElement;\n play(): void;\n bind(event: string, callback: () => void): void;\n popover: {\n show(): void;\n };\n}\n\ninterface WistiaQueueItem {\n id: string;\n options: WistiaOptions;\n onReady(video: WistiaVideo): void;\n}\n\ndeclare global {\n interface Window {\n _wq: WistiaQueueItem[];\n }\n}\nexport default function videoEmbed(els) {\n els.forEach(wistiaPlaceholder => {\n const observer = new IntersectionObserver(\n (entries, observer) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n const wistiaSnippet =\n wistiaPlaceholder.getAttribute('data-wistia-snippet'); // Get the Wistia snippet inlined inside the data attribute\n const wistiaContainer = document.createElement('div'); // Create a placeholder container to house the Wistia snippet\n wistiaContainer.innerHTML = wistiaSnippet;\n wistiaPlaceholder.replaceWith(wistiaContainer); // replace with the created div\n const scripts = wistiaContainer.querySelectorAll('script');\n scripts.forEach(script => {\n const newScript = document.createElement('script');\n newScript.src = script.src;\n newScript.async = true;\n document.body.appendChild(newScript);\n });\n enableWistiaVideoCustomization();\n observer.unobserve(entry.target); // stop observing after load\n }\n });\n },\n {\n rootMargin: '300px 0px', // start loading when the element is 300px below the viewport\n threshold: 0.1, // trigger when 1% of the element is visible\n }\n );\n\n wistiaPlaceholder && observer.observe(wistiaPlaceholder);\n });\n\n function enableWistiaVideoCustomization() {\n window._wq = window._wq || [];\n window._wq.push({\n id: '_all',\n options: {\n videoFoam: true,\n playerColor: getComputedStyle(document.documentElement).getPropertyValue(\n '--color--darkmid'\n ),\n controlsVisibleOnLoad: false,\n googleAnalytics: true,\n fitStrategy: 'cover',\n preload: 'none',\n wmode: 'transparent',\n },\n\n onReady: function (video) {\n const videoContainer = video.container.closest('.video-embed-wrapper');\n const customPlayButton = videoContainer?.querySelector(\n '[data-custom-play-button]'\n ) as HTMLElement;\n const isPopover = video.options.popover;\n\n if (video.options.playButton === false) {\n // if video from Wistia does not have a play button - hide the custom play button\n customPlayButton && (customPlayButton.style.display = 'none');\n } else {\n if (customPlayButton) {\n customPlayButton.classList.remove('tw-hidden');\n customPlayButton.style.display = 'grid';\n }\n }\n\n if (customPlayButton) {\n customPlayButton.addEventListener('click', function (e) {\n e.preventDefault();\n if (isPopover) {\n video.popover.show();\n }\n video.play();\n });\n }\n\n if (!isPopover) {\n /* Checking for isPopover because we want to hide the button on play only if it is not a popover video */\n video.bind('play', function () {\n // hides the button on play\n customPlayButton && (customPlayButton.style.display = 'none');\n });\n video.bind('end', function () {\n // shows the button on video end\n customPlayButton && (customPlayButton.style.display = 'grid');\n });\n }\n },\n });\n }\n}\n"],"names":["videoEmbed","els","forEach","wistiaPlaceholder","observer","IntersectionObserver","entries","entry","isIntersecting","wistiaSnippet","getAttribute","wistiaContainer","document","createElement","innerHTML","replaceWith","querySelectorAll","script","newScript","src","async","body","appendChild","window","_wq","push","id","options","videoFoam","playerColor","getComputedStyle","documentElement","getPropertyValue","controlsVisibleOnLoad","googleAnalytics","fitStrategy","preload","wmode","onReady","video","videoContainer","container","closest","customPlayButton","querySelector","isPopover","popover","playButton","style","display","classList","remove","addEventListener","e","preventDefault","show","play","bind","unobserve","target","rootMargin","threshold","observe"],"sourceRoot":""}