((t,e,o)=>{"use strict";const l="mobile"===t.device,i=t=>({mute:"unmute"!==t.dataset.mutevideo,loop:"unloop"!==t.dataset.unloopvideo}),a=(t,o,l,i)=>{const a=e.createElement("div"),d=e.createElement("iframe");return a.className="tb_fullwidth_video tf_lazy tb_"+l+" tf_abs tf_w tf_h tf_overflow",d.setAttribute("allowfullscreen",!1),d.setAttribute("webkitallowfullscreen",!1),d.setAttribute("mozallowfullscreen",!1),d.className="tf_abs_c tf_mw tf_w tf_h",d.id=t,d.src=encodeURI(o),i&&(d.dataset.autoplay=!0,d.setAttribute("allow","autoplay")),d.setAttribute("unselectable","on"),a.appendChild(d),a},d=(t,e,l)=>{const d=i(t),s="tb_vimeo_"+l,n=new URL(e);let f="https://player.vimeo.com/video/"+l+"?api=1&byline=0&autopause=0&portrait=0&title=0&controls=0&keyboard=0&dnt=1&playsinline=1&callback=tb_vimeo&player_id="+s,u=!1;d.loop&&(f+="&loop=1"),!1!==d.autoplay&&(f+="&autoplay=1",d.mute=!0,u=!0),!0===d.mute&&(f+="&muted=1"),0===n.hash?.indexOf("#t=")&&(f+=n.hash);const _=a(s,f,"vimeo",u),w=_.firstChild,r=t=>{if(t.origin.includes("player.vimeo.com")&&w?.contentWindow){const e=JSON.parse(t.data);if(s===e.player_id){const{value:t,method:l}=e;if("ready"===e.event){const t="https://player.vimeo.com";w.contentWindow.postMessage(JSON.stringify({method:"getVideoWidth"}),t),w.contentWindow.postMessage(JSON.stringify({method:"getVideoHeight"}),t)}else if("getVideoWidth"===l||"getVideoHeight"===l){"getVideoWidth"===l?w.width=t:w.height=t;const{width:e,height:i}=w;i&&e&&(window.tfOff("message",r,{passive:!0}),w.style.minHeight=100*o(i/e)+"vw",w.style.minWidth=100*o(e/i)+"vh",w.parentNode.classList.remove("tf_lazy"))}}}};return window.tfOn("message",r,{passive:!0}),_},s=async t=>{if(t.paused)try{await t.play()}catch(e){if(t.muted)throw e;t.muted=!0,await t.play()}},n=(o,a)=>{const d=!0===l?{loop:"unloop"!==o.dataset.unloopvideo,mute:!0}:i(o),n=e.createElement("div"),f=e.createElement("video");return n.className="tb_fullwidth_video tb_local_video tf_abs tf_w tf_h",f.className="tf_w tf_h",f.setAttribute("type","video/"+a.split(".").pop().split("?")[0]),f.preload="auto",f.setAttribute("webkit-playsinline",1),f.setAttribute("playsinline",!0),f.dataset.hideControls=1,f.src=a,!1!==d.autoplay&&"no"!==o.dataset.autoplay&&(d.mute=f.autoplay=!0,setTimeout((async()=>{try{if(await s(f),f.paused)throw""}catch(o){(o=>{o.classList.add("tb_fullwidth_lowpower"),e.body.tfOn(t.click,(()=>{for(let t=e.tfClass("tb_fullwidth_lowpower"),o=t.length-1;o>-1;--o)try{s(t[o])}catch(t){}}),{passive:!0,once:!0})})(f)}}),50)),!0!==d.mute&&"desktop"===t.device||(f.muted=!0),!0===d.loop&&(f.loop=!0),n.appendChild(f),n},f=(t,e,l)=>{if(l){const d=i(t),s=new URL(e),n="tb_ytb_"+l;let f="https://www.youtube-nocookie.com/embed/"+l+"?playsinline=1&controls=0&rel=0&disablekb&fs=0&iv_load_policy=3&playerapiid="+n+"&playlist="+l,u=640,_=360,w=!1;if(d.loop&&(f+="&loop=1"),!1!==d.autoplay&&(f+="&autoplay=1",d.mute=!0,w=!0),!0===d.mute&&(f+="&mute=1"),s){const t=s.searchParams,e=t.get("t"),o=t.get("w"),l=t.get("h");e&&(f+="&start="+e),o&&(u=o),l&&(_=l)}const r=a(n,f,"ytb",w),c=r.firstChild;return c.style.minHeight=100*o(_/u)+"vw",c.tfOn("load",(function(){this.parentNode.classList.remove("tf_lazy")}),{passive:!0,once:!0}).style.minWidth=100*o(u/_)+"vh",r}};t.on("builder_load_module_partial",((e,o)=>{let i;if(!0===o){if(!e.hasAttribute("data-tbfullwidthvideo"))return;i=[e]}else i=t.selectWithParent("[data-tbfullwidthvideo]",e);i.length>0&&(()=>t.loadCss(ThemifyBuilderModuleJs.cssUrl+"fullwidth-video","tb_fullwidth_video"))().then((()=>{for(let e=i.length-1;e>-1;--e){let o=i[e],{tbfullwidthvideo:a,playonmobile:s}=o.dataset;if(a&&(!1===l||"play"===s)){let e,l=t.parseVideo(a),i=o.tfClass("tb_fullwidth_video")[0];i?.parentNode===o&&o.removeChild(i),e="youtube"===l.type?f(o,a,l.id):"vimeo"===l.type?d(o,a,l.id):n(o,a),e&&(o.classList.contains("module_subrow")?o.appendChild(e):o.prepend(e),t.trigger("tb_fullwidth_video_added",[o]))}}}))}))})(Themify,document,parseFloat);