(e=>{"use strict";const t=ThemifyBuilderModuleJs.cssUrl+"video_styles/",i=(i,s)=>{const a=e.selectWithParent("module-video",i),l=t=>{const i=t.currentTarget,o=i.closest(".module-video").tfTag("video")[0];if(!i.tfClass("tb_video_buffer")[0]){const t=document.createElement("div"),s=function(){let o=this.duration>0&&this.buffered.length>0?this.buffered.end(0)/this.duration*100:0;o<2&&(o=0),this.readyState>2&&(o=100,i.tfOff("pointerenter",l,{passive:!0}),this.tfOff("loadstart waiting progress canplay",s,{passive:!0}),t.tfOn("transitionend",(()=>{requestAnimationFrame((()=>{this.closest(".tb_hover_play").classList.add("tb_video_loaded"),this.dataset.forceplay=1,e.video([this]),t.remove()}))}),{passive:!0,once:!0})),o>2&&(t.style.width=o+"%")};e.loadCss("video","tf_video"),e.loadJs("video-player"),t.className="tb_video_buffer tf_abs_t",i.tfTag("img")[0].after(t),o.tfOn("loadstart waiting progress canplay",s,{passive:!0})}o.load()};for(let i=a.length-1;i>-1;--i){let d=a[i],v=d.classList,n=d.tfClass("tb_video_overlay")[0];if(v.contains("video-overlay")&&e.loadCss(t+"overlay","tb_video_overlay"),v.contains("tb_hover_play"))e.is_builder_active||d.tfTag("img")[0]?.parentNode.tfOn("pointerenter",l,{passive:!0});else if(n)e.loadCss(t+"play_button","tb_video_play_button"),n.tfOn("click",o,{once:!0,passive:!0});else{let t=d.tfTag("noscript")[0];if(t){let i=document.createElement("div");i.innerHTML=t.textContent.trim()||t.innerHTML;const o=i.tfTag("iframe")[0];s&&o&&(o.src=e.updateQueryString("autoplay","1",o.src),o.allow+=";autoplay"),t.replaceWith(i.firstElementChild)}else if(s){let t=d.tfTag("video")[0];t.dataset.autoplay=1,t.parentNode.tfClass("tf_vd_root")[0]?.remove(),e.video([t])}}v.remove("tf_lazy")}},o=function(e){e.stopPropagation();const t=this.closest(".module-video");t.classList.add("tf_lazy"),this.remove(),i(t,1)};e.on("builder_load_module_partial",((e,t)=>{(!0!==t||e.classList.contains("module-video"))&&i(e)}))})(Themify);