document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".video-content[data-settings]").forEach(t=>{const e=JSON.parse(t.getAttribute("data-settings"));let o=t.querySelector(".gkit-inline-youtube-video-iframe");"inline"!=e?.videoStyleOptions||"youtube"!=e?.videoType||e?.overlayLightbox||function(t,e){function o(){var t=document.createElement("script");t.src="https://www.youtube.com/iframe_api",t.async=!0;var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),t.onload=n}let i;function n(){const e=window.YT;e&&"function"==typeof e.Player?i=new e.Player(t,{events:{onReady:a,onStateChange:l}}):setTimeout(o,500)}function a(t){}function l(t){t.data==window.YT.PlayerState.ENDED&&e?.isVideoLoop&&i.seekTo(5)}o()}(o,e);const i=t.querySelector(".gkit-video-frame-overlay");e?.isImageOverlay&&(e?.overlayPlayIcon&&!e?.overlayLightbox||!e?.overlayLightbox&&!e?.overlayPlayIcon)&&i&&i.addEventListener("click",function(o){i.classList.add("gkit-video-frame-overlay-img");let n=t.querySelectorAll(".gkit-inline-video-iframe");"selfHosted"!==e?.videoType?n.forEach(t=>{var e=new URL(t.src);e.searchParams.set("autoplay","1"),t.src=e.toString()}):n.forEach(t=>{t.play()})}),Fancybox.bind(t,"[data-fancybox=true]",{mainClass:`gkit-video-popup-container-${e?.wrapperClass}`,tpl:{closeButton:`<button data-fancybox-close class="f-button is-close-btn gkit-video-popup-close-btn-icon" title="Close">${e?.gkitVideoCloseButtonIcon?.src||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">\n<path d="M17.131 16.8l9.034-9.034c0.312-0.312 0.312-0.819 0-1.131s-0.819-0.312-1.131 0l-9.034 9.034-9.034-9.034c-0.312-0.312-0.819-0.312-1.131 0s-0.312 0.819 0 1.131l9.034 9.034-9.034 9.034c-0.312 0.312-0.312 0.819 0 1.131 0.156 0.156 0.361 0.234 0.566 0.234s0.409-0.078 0.566-0.234l9.034-9.034 9.034 9.034c0.156 0.156 0.361 0.234 0.566 0.234s0.409-0.078 0.566-0.234c0.312-0.312 0.312-0.819 0-1.131l-9.034-9.034z"></path>\n</svg>'}</button>`},Html:{videoAutoplay:"selfHosted"==e?.videoType?!e?.isPlayerControlsEnabled||e?.isAutoPlay:e?.playerControl?e?.isAutoPlay:1,vimeo:{muted:e?.isVideoMute,loop:e?.isVideoLoop,controls:!0,title:e?.isIntroTitle,portrait:e?.isIntroPortrait,byline:e?.isIntroByLine},youtube:{mute:e?.isVideoMute?"1":"0",loop:e?.isVideoLoop?"1":"0",controls:e?.playerControl?"1":"0",start:e?.videoStartTime,end:e?.videoEndTime,playlist:e.getYoutubeVideoId?e.getYoutubeVideoId:"",autoplay:e?.isAutoPlay?"1":"0"},videoTpl:"selfHosted"==e?.videoType&&""!==e.selfVideoURL&&function(){const t=t=>String(t??"").replace(/["'<>&]/g,t=>({'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;"}[t]));return`<video src="${t(e.selfVideoURL)}#t=${t(e?.videoStartTime)},${t(e?.videoEndTime)}"\n\t\t\t\t\t\tpreload="${t(e?.videoPreLoad)}"\n\t\t\t\t\t\tid="player"\n                        loop="${t(e?.isVideoLoop)}"\n\t\t\t\t\t\tmuted="${t(e?.isVideoMute)}"\n                        ${e?.isPlayerControlsEnabled?"controls":""}\n\t\t\t\t\t\tcontrolsList="${e?.isDownloadButton?"default":"nodownload"}"\n\t\t\t\t\t\tposter="${t(e?.posterImage??"")}"\n                        width="100%" height="100%"\n\t\t\t\t\t>\n\t\t\t\t    </video>`}()}})})});