diff --git a/jquery.youtube-background.js b/jquery.youtube-background.js index 5d17cfa..61947d4 100644 --- a/jquery.youtube-background.js +++ b/jquery.youtube-background.js @@ -1,4 +1,4 @@ -/* youtube-background v1.0.15 | https://github.com/stamat/youtube-background | MIT License */ +/* youtube-background v1.0.18 | https://github.com/stamat/youtube-background | MIT License */ (() => { // node_modules/book-of-spells/src/helpers.mjs function stringToBoolean(str) { diff --git a/jquery.youtube-background.min.js b/jquery.youtube-background.min.js index 3d09fd7..5640e7c 100644 --- a/jquery.youtube-background.min.js +++ b/jquery.youtube-background.min.js @@ -1,4 +1,4 @@ -/* youtube-background v1.0.15 | https://github.com/stamat/youtube-background | MIT License */ +/* youtube-background v1.0.18 | https://github.com/stamat/youtube-background | MIT License */ (()=>{function Ve(e){if(/^\s*(true|false)\s*$/i.test(e))return e==="true"}function je(e){if(/^\s*\d+\s*$/.test(e))return parseInt(e);if(/^\s*[\d.]+\s*$/.test(e))return parseFloat(e)}function xe(e){if(/^\s*\[.*\]\s*$/.test(e))try{return JSON.parse(e)}catch{}}function Le(e){if(/^\s*\{.*\}\s*$/.test(e))try{return JSON.parse(e)}catch{}}function Fe(e){if(/^\s*\/.*\/g?i?\s*$/.test(e))try{return new RegExp(e)}catch{}}function De(e){if(/^\s*null\s*$/.test(e))return null;const t=Ve(e);return t!==void 0?t:je(e)||xe(e)||Le(e)||Fe(e)||e}function qe(e){return Array.isArray(e)}function ge(e,t){return e>t&&([e,t]=[t,e]),e===t?e:(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e)}var ze=/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i,$e=/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i,Ue=/(.*\/[^\/]+\.mp4|ogg|ogv|ogm|webm|avi)\s?$/i;function Be(e){return/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(e)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(e)}function ce(){return"maxTouchPoints"in navigator?navigator.maxTouchPoints>0:"matchMedia"in window?!!matchMedia("(pointer:coarse)").matches:"orientation"in window?!0:Be(navigator.userAgent)}function We(e,t){return e.classList.contains(t)}function N(e,t){const r=t.split(" ");e.classList.add(...r)}function S(e,t){const r=t.split(" ");e.classList.remove(...r)}function fe(e){const t=e.split(/\s?:\s?/i),r=16/9;if(t.length<2)return r;const n=parseInt(t[0],10),i=parseInt(t[1],10);return isNaN(n)||isNaN(i)?r:n/i}function he(e,t,r,n){let i={};if(!e)i=t;else for(let s in t)e.hasOwnProperty(s)||(i[s]=t[s]);if(!r)return i;for(let s in i){let o;if(qe(n))for(var a=0;a',initialState:!1,stateClassName:"paused",condition_parameter:"autoplay",stateChildClassNames:["fa-pause-circle","fa-play-circle"],actions:["play","pause"]}),this.params["mute-button"]&&X(this,{name:"mute",className:"mute-toggle",innerHtml:'',initialState:!0,stateClassName:"muted",condition_parameter:"muted",stateChildClassNames:["fa-volume-up","fa-volume-mute"],actions:["unmute","mute"]})))},this.__init__()}V.prototype.initYTPlayer=function(){const e=this;window.hasOwnProperty("YT")&&this.player===null&&(this.player=new YT.Player(this.uid,{events:{onReady:function(t){e.onVideoPlayerReady(t)},onStateChange:function(t){e.onVideoStateChange(t)},onError:function(t){}}}))},V.prototype.injectScript=function(){if(window.hasOwnProperty("YT")||document.querySelector('script[src="https://www.youtube.com/player_api"]'))return;const e=document.createElement("script");e.src="https://www.youtube.com/player_api";const t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)},V.prototype.seekTo=function(e){e>0&&this.player.seekTo(e,!0)},V.prototype.onVideoPlayerReady=function(e){this.seekTo(this.params["start-at"]),this.params.autoplay&&(this.params["always-play"]||this.isIntersecting)&&(this.player.playVideo(),this.element.dispatchEvent(new CustomEvent("video-background-play",{bubbles:!0,detail:this}))),this.iframe.style.opacity=1},V.prototype.onVideoStateChange=function(e){e.data===0&&this.params.loop&&(this.seekTo(this.params["start-at"]),this.player.playVideo()),e.data===-1&&this.params.autoplay&&(this.seekTo(this.params["start-at"]),this.player.playVideo(),this.element.dispatchEvent(new CustomEvent("video-background-play",{bubbles:!0,detail:this}))),this.params.onStatusChange(e)},V.prototype.injectPlayer=function(){this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder",0),this.iframe.setAttribute("allow","autoplay; mute");let e="https://www.youtube.com/embed/";this.params["no-cookie"]&&(e="https://www.youtube-nocookie.com/embed/");let t=`${e}${this.ytid}?&enablejsapi=1&disablekb=1&controls=0&rel=0&iv_load_policy=3&cc_load_policy=0&playsinline=1&showinfo=0&modestbranding=1&fs=0`;if(this.params.muted&&(t+="&mute=1"),this.params.autoplay&&this.params["always-play"]&&(t+="&autoplay=1"),this.params.loop&&(t+="&loop=1"),this.params["end-at"]>0&&(t+=`&end=${this.params["end-at"]}`),this.iframe.src=t,this.uid&&(this.iframe.id=this.uid),this.params["inline-styles"]&&(this.iframe.style.top="50%",this.iframe.style.left="50%",this.iframe.style.transform="translateX(-50%) translateY(-50%)",this.iframe.style.position="absolute",this.iframe.style.opacity=0),this.element.appendChild(this.iframe),this.params["fit-box"])this.iframe.style.width="100%",this.iframe.style.height="100%";else{let r=function(){const i=n.iframe.parentNode.offsetHeight+n.params.offset,a=n.iframe.parentNode.offsetWidth+n.params.offset,s=n.params.resolution_mod;s>a/i?(n.iframe.style.width=i*s+"px",n.iframe.style.height=i+"px"):(n.iframe.style.width=a+"px",n.iframe.style.height=a/s+"px")};const n=this;window.hasOwnProperty("ResizeObserver")?new ResizeObserver(()=>{window.requestAnimationFrame(r)}).observe(this.element):window.addEventListener("resize",()=>{window.requestAnimationFrame(r)}),r()}},V.prototype.buildHTML=function(){const e=this.element.parentNode;N(this.element,"youtube-background video-background");const t={height:"100%",width:"100%","z-index":"0",position:"absolute",overflow:"hidden",top:0,left:0,bottom:0,right:0};if(this.params["mute-button"]||(t["pointer-events"]="none"),(this.params["load-background"]||this.params.poster)&&(this.params["load-background"]&&(t["background-image"]="url(https://img.youtube.com/vi/"+this.ytid+"/maxresdefault.jpg)"),this.params.poster&&(t["background-image"]=this.params.poster),t["background-size"]="cover",t["background-repeat"]="no-repeat",t["background-position"]="center"),this.params["inline-styles"]){for(let r in t)this.element.style[r]=t[r];["absolute","fixed","relative","sticky"].indexOf(e.style.position)||(e.style.position="relative")}if(this.params["play-button"]||this.params["mute-button"]){const r=document.createElement("div");r.className="video-background-controls",r.style.position="absolute",r.style.top="10px",r.style.right="10px",r.style["z-index"]=2,this.controls_element=r,e.appendChild(r)}return this.element},V.prototype.play=function(){if(this.buttons.hasOwnProperty("play")){const e=this.buttons.play;S(e.element,e.button_properties.stateClassName),N(e.element.firstChild,e.button_properties.stateChildClassNames[0]),S(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.params["start-at"]&&this.player.getCurrentTime()=0;--E){var y=this.tryEntries[E],T=y.completion;if(y.tryLoc==="root")return f("end");if(y.tryLoc<=this.prev){var M=r.call(y,"catchLoc"),F=r.call(y,"finallyLoc");if(M&&F){if(this.prev=0;--f){var E=this.tryEntries[f];if(E.tryLoc<=this.prev&&r.call(E,"finallyLoc")&&this.prev=0;--u){var f=this.tryEntries[u];if(f.finallyLoc===c)return this.complete(f.completion,f.afterLoc),v(f),w}},catch:function(c){for(var u=this.tryEntries.length-1;u>=0;--u){var f=this.tryEntries[u];if(f.tryLoc===c){var E=f.completion;if(E.type==="throw"){var y=E.arg;v(f)}return y}}throw new Error("illegal catch attempt")},delegateYield:function(c,u,f){return this.delegate={iterator:$(c),resultName:u,nextLoc:f},this.method==="next"&&(this.arg=void 0),w}},e}function ke(e,t,r,n,i,a,s){try{var o=e[a](s),p=o.value}catch(l){r(l);return}o.done?t(p):Promise.resolve(p).then(n,i)}function H(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function s(p){ke(a,n,i,s,o,"next",p)}function o(p){ke(a,n,i,s,o,"throw",p)}s(void 0)})}}function Ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ae(e,t,r){return _e()?ae=Reflect.construct.bind():ae=function(i,a,s){var o=[null];o.push.apply(o,a);var p=Function.bind.apply(i,o),l=new p;return s&&te(l,s.prototype),l},ae.apply(null,arguments)}function Ye(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function pe(e){var t=typeof Map=="function"?new Map:void 0;return pe=function(n){if(n===null||!Ye(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return ae(n,arguments,ee(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),te(i,n)},pe(e)}function se(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ge(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return se(e)}function Qe(e){var t=_e();return function(){var n=ee(e),i;if(t){var a=ee(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Ge(this,i)}}function Xe(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Te(e){var t=Xe(e,"string");return typeof t=="symbol"?t:String(t)}var Ne=typeof global<"u"&&{}.toString.call(global)==="[object global]";function Oe(e,t){return e.indexOf(t.toLowerCase())===0?e:"".concat(t.toLowerCase()).concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}function Je(e){return!!(e&&e.nodeType===1&&"nodeName"in e&&e.ownerDocument&&e.ownerDocument.defaultView)}function Ke(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function Y(e){return/^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(e)}function Se(e){var t=/^https:\/\/player\.vimeo\.com\/video\/\d+/;return t.test(e)}function Me(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.id,r=e.url,n=t||r;if(!n)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(Ke(n))return"https://vimeo.com/".concat(n);if(Y(n))return n.replace("http:","https:");throw t?new TypeError("\u201C".concat(t,"\u201D is not a valid video id.")):new TypeError("\u201C".concat(n,"\u201D is not a vimeo.com url."))}var Ae=function(t,r,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"addEventListener",a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"removeEventListener",s=typeof r=="string"?[r]:r;return s.forEach(function(o){t[i](o,n)}),{cancel:function(){return s.forEach(function(p){return t[a](p,n)})}}},Ze=typeof Array.prototype.indexOf<"u",et=typeof window<"u"&&typeof window.postMessage<"u";if(!Ne&&(!Ze||!et))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tt(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e){if(e.WeakMap)return;var t=Object.prototype.hasOwnProperty,r=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch{}}(),n=function(a,s,o){r?Object.defineProperty(a,s,{configurable:!0,writable:!0,value:o}):a[s]=o};e.WeakMap=function(){function a(){if(this===void 0)throw new TypeError("Constructor WeakMap requires 'new'");if(n(this,"_id",o("_WeakMap")),arguments.length>0)throw new TypeError("WeakMap iterable is not supported")}n(a.prototype,"delete",function(l){if(s(this,"delete"),!i(l))return!1;var C=l[this._id];return C&&C[0]===l?(delete l[this._id],!0):!1}),n(a.prototype,"get",function(l){if(s(this,"get"),!!i(l)){var C=l[this._id];if(C&&C[0]===l)return C[1]}}),n(a.prototype,"has",function(l){if(s(this,"has"),!i(l))return!1;var C=l[this._id];return!!(C&&C[0]===l)}),n(a.prototype,"set",function(l,C){if(s(this,"set"),!i(l))throw new TypeError("Invalid value used as weak map key");var w=l[this._id];return w&&w[0]===l?(w[1]=C,this):(n(l,this._id,[l,C]),this)});function s(l,C){if(!i(l)||!t.call(l,"_id"))throw new TypeError(C+" method called on incompatible receiver "+typeof l)}function o(l){return l+"_"+p()+"."+p()}function p(){return Math.random().toString().substring(2)}return n(a,"_polyfill",!0),a}();function i(a){return Object(a)===a}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:J);var q=tt(function(e){(function(r,n,i){n[r]=n[r]||i(),e.exports&&(e.exports=n[r])})("Promise",J,function(){var r,n,i,a=Object.prototype.toString,s=typeof setImmediate<"u"?function(h){return setImmediate(h)}:setTimeout;try{Object.defineProperty({},"x",{}),r=function(h,d,b,_){return Object.defineProperty(h,d,{value:b,writable:!0,configurable:_!==!1})}}catch{r=function(d,b,_){return d[b]=_,d}}i=function(){var h,d,b;function _(O,v){this.fn=O,this.self=v,this.next=void 0}return{add:function(v,L){b=new _(v,L),d?d.next=b:h=b,d=b,b=void 0},drain:function(){var v=h;for(h=d=n=void 0;v;)v.fn.call(v.self),v=v.next}}}();function o(m,h){i.add(m,h),n||(n=s(i.drain))}function p(m){var h,d=typeof m;return m!=null&&(d=="object"||d=="function")&&(h=m.then),typeof h=="function"?h:!1}function l(){for(var m=0;m0&&o(l,d))}catch(b){P.call(new g(d),b)}}}function P(m){var h=this;h.triggered||(h.triggered=!0,h.def&&(h=h.def),h.msg=m,h.state=2,h.chain.length>0&&o(l,h))}function k(m,h,d,b){for(var _=0;_=8&&i<10&&(n=JSON.stringify(n)),e.element.contentWindow.postMessage(n,e.origin)}}function it(e,t){t=le(t);var r=[],n;if(t.event){if(t.event==="error"){var i=oe(e,t.data.method);i.forEach(function(s){var o=new Error(t.data.message);o.name=t.data.name,s.reject(o),ue(e,t.data.method,s)})}r=oe(e,"event:".concat(t.event)),n=t.data}else if(t.method){var a=rt(e,t.method);a&&(r.push(a),n=t.value)}r.forEach(function(s){try{if(typeof s=="function"){s.call(e,n);return}s.resolve(n)}catch{}})}var at=["autopause","autoplay","background","byline","color","colors","controls","dnt","height","id","interactive_params","keyboard","loop","maxheight","maxwidth","muted","playsinline","portrait","responsive","speed","texttrack","title","transparent","url","width"];function Ie(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at.reduce(function(r,n){var i=e.getAttribute("data-vimeo-".concat(n));return(i||i==="")&&(r[n]=i===""?1:i),r},t)}function de(e,t){var r=e.html;if(!t)throw new TypeError("An element must be provided");if(t.getAttribute("data-vimeo-initialized")!==null)return t.querySelector("iframe");var n=document.createElement("div");return n.innerHTML=r,t.appendChild(n.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function Re(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return new Promise(function(n,i){if(!Y(e))throw new TypeError("\u201C".concat(e,"\u201D is not a vimeo.com url."));var a="https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(e));for(var s in t)t.hasOwnProperty(s)&&(a+="&".concat(s,"=").concat(encodeURIComponent(t[s])));var o="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;o.open("GET",a,!0),o.onload=function(){if(o.status===404){i(new Error("\u201C".concat(e,"\u201D was not found.")));return}if(o.status===403){i(new Error("\u201C".concat(e,"\u201D is not embeddable.")));return}try{var p=JSON.parse(o.responseText);if(p.domain_status_code===403){de(p,r),i(new Error("\u201C".concat(e,"\u201D is not embeddable.")));return}n(p)}catch(l){i(l)}},o.onerror=function(){var p=o.status?" (".concat(o.status,")"):"";i(new Error("There was an error fetching the embed code from Vimeo".concat(p,".")))},o.send()})}function st(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,t=[].slice.call(e.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),r=function(i){"console"in window&&console.error&&console.error("There was an error creating an embed: ".concat(i))};t.forEach(function(n){try{if(n.getAttribute("data-vimeo-defer")!==null)return;var i=Ie(n),a=Me(i);Re(a,i,n).then(function(s){return de(s,n)}).catch(r)}catch(s){r(s)}})}function ot(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(!window.VimeoPlayerResizeEmbeds_){window.VimeoPlayerResizeEmbeds_=!0;var t=function(n){if(Y(n.origin)&&!(!n.data||n.data.event!=="spacechange")){for(var i=e.querySelectorAll("iframe"),a=0;a0&&arguments[0]!==void 0?arguments[0]:document;if(!window.VimeoSeoMetadataAppended){window.VimeoSeoMetadataAppended=!0;var t=function(n){if(Y(n.origin)){var i=le(n.data);if(!(!i||i.event!=="ready"))for(var a=e.querySelectorAll("iframe"),s=0;s0&&arguments[0]!==void 0?arguments[0]:document;if(!window.VimeoCheckedUrlTimeParam){window.VimeoCheckedUrlTimeParam=!0;var t=function(i){"console"in window&&console.error&&console.error("There was an error getting video Id: ".concat(i))},r=function(i){if(Y(i.origin)){var a=le(i.data);if(!(!a||a.event!=="ready"))for(var s=e.querySelectorAll("iframe"),o=function(){var C=s[p],w=C.contentWindow===i.source;if(Se(C.src)&&w){var P=new ye(C);P.getVideoId().then(function(k){var g=new RegExp("[?&]vimeo_t_".concat(k,"=([^&#]*)")).exec(window.location.href);if(g&&g[1]){var R=decodeURI(g[1]);P.setCurrentTime(R)}}).catch(t)}},p=0;p2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;return Ce(this,r),a=t.call(this),ie(se(a),"logger",void 0),ie(se(a),"speedAdjustment",0),ie(se(a),"adjustSpeed",function(){var p=H(I().mark(function l(C,w){var P;return I().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(a.speedAdjustment!==w){g.next=2;break}return g.abrupt("return");case 2:return g.next=4,C.getPlaybackRate();case 4:return g.t0=g.sent,g.t1=a.speedAdjustment,g.t2=g.t0-g.t1,g.t3=w,P=g.t2+g.t3,a.log("New playbackRate: ".concat(P)),g.next=12,C.setPlaybackRate(P);case 12:a.speedAdjustment=w;case 13:case"end":return g.stop()}},l)}));return function(l,C){return p.apply(this,arguments)}}()),a.logger=o,a.init(i,n,we(we({},ft),s)),a}return Pe(r,[{key:"disconnect",value:function(){this.dispatchEvent(new Event("disconnect"))}},{key:"init",value:function(){var n=H(I().mark(function a(s,o,p){var l=this,C,w,P;return I().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,this.waitForTOReadyState(s,"open");case 2:if(p.role!=="viewer"){g.next=10;break}return g.next=5,this.updatePlayer(s,o,p);case 5:C=Ae(s,"change",function(){return l.updatePlayer(s,o,p)}),w=this.maintainPlaybackPosition(s,o,p),this.addEventListener("disconnect",function(){w.cancel(),C.cancel()}),g.next=14;break;case 10:return g.next=12,this.updateTimingObject(s,o);case 12:P=Ae(o,["seeked","play","pause","ratechange"],function(){return l.updateTimingObject(s,o)},"on","off"),this.addEventListener("disconnect",function(){return P.cancel()});case 14:case"end":return g.stop()}},a,this)}));function i(a,s,o){return n.apply(this,arguments)}return i}()},{key:"updateTimingObject",value:function(){var n=H(I().mark(function a(s,o){return I().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.t0=s,l.next=3,o.getCurrentTime();case 3:return l.t1=l.sent,l.next=6,o.getPaused();case 6:if(!l.sent){l.next=10;break}l.t2=0,l.next=13;break;case 10:return l.next=12,o.getPlaybackRate();case 12:l.t2=l.sent;case 13:l.t3=l.t2,l.t4={position:l.t1,velocity:l.t3},l.t0.update.call(l.t0,l.t4);case 16:case"end":return l.stop()}},a)}));function i(a,s){return n.apply(this,arguments)}return i}()},{key:"updatePlayer",value:function(){var n=H(I().mark(function a(s,o,p){var l,C,w;return I().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:if(l=s.query(),C=l.position,w=l.velocity,typeof C=="number"&&o.setCurrentTime(C),typeof w!="number"){k.next=25;break}if(w!==0){k.next=11;break}return k.next=6,o.getPaused();case 6:if(k.t0=k.sent,k.t0!==!1){k.next=9;break}o.pause();case 9:k.next=25;break;case 11:if(!(w>0)){k.next=25;break}return k.next=14,o.getPaused();case 14:if(k.t1=k.sent,k.t1!==!0){k.next=19;break}return k.next=18,o.play().catch(function(){var g=H(I().mark(function R(A){return I().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(!(A.name==="NotAllowedError"&&p.autoPlayMuted)){m.next=5;break}return m.next=3,o.setMuted(!0);case 3:return m.next=5,o.play().catch(function(h){return console.error("Couldn't play the video from TimingSrcConnector. Error:",h)});case 5:case"end":return m.stop()}},R)}));return function(R){return g.apply(this,arguments)}}());case 18:this.updatePlayer(s,o,p);case 19:return k.next=21,o.getPlaybackRate();case 21:if(k.t2=k.sent,k.t3=w,k.t2===k.t3){k.next=25;break}o.setPlaybackRate(w);case 25:case"end":return k.stop()}},a,this)}));function i(a,s,o){return n.apply(this,arguments)}return i}()},{key:"maintainPlaybackPosition",value:function(i,a,s){var o=this,p=s.allowedDrift,l=s.maxAllowedDrift,C=s.minCheckInterval,w=s.maxRateAdjustment,P=s.maxTimeToCatchUp,k=Math.min(P,Math.max(C,l))*1e3,g=function(){var A=H(I().mark(function x(){var m,h,d,b,_;return I().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(v.t0=i.query().velocity===0,v.t0){v.next=6;break}return v.next=4,a.getPaused();case 4:v.t1=v.sent,v.t0=v.t1===!0;case 6:if(!v.t0){v.next=8;break}return v.abrupt("return");case 8:return v.t2=i.query().position,v.next=11,a.getCurrentTime();case 11:if(v.t3=v.sent,m=v.t2-v.t3,h=Math.abs(m),o.log("Drift: ".concat(m)),!(h>l)){v.next=22;break}return v.next=18,o.adjustSpeed(a,0);case 18:a.setCurrentTime(i.query().position),o.log("Resync by currentTime"),v.next=29;break;case 22:if(!(h>p)){v.next=29;break}return d=h/P,b=w,_=d1&&arguments[1]!==void 0?arguments[1]:{};if(Ce(this,e),window.jQuery&&t instanceof jQuery&&(t.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),t=t[0]),typeof document<"u"&&typeof t=="string"&&(t=document.getElementById(t)),!Je(t))throw new TypeError("You must pass either a valid element or a valid id.");if(t.nodeName!=="IFRAME"){var i=t.querySelector("iframe");i&&(t=i)}if(t.nodeName==="IFRAME"&&!Y(t.getAttribute("src")||""))throw new Error("The player element passed isn\u2019t a Vimeo embed.");if(K.has(t))return K.get(t);this._window=t.ownerDocument.defaultView,this.element=t,this.origin="*";var a=new q(function(o,p){if(r._onMessage=function(w){if(!(!Y(w.origin)||r.element.contentWindow!==w.source)){r.origin==="*"&&(r.origin=w.origin);var P=le(w.data),k=P&&P.event==="error",g=k&&P.data&&P.data.method==="ready";if(g){var R=new Error(P.data.message);R.name=P.data.name,p(R);return}var A=P&&P.event==="ready",x=P&&P.method==="ping";if(A||x){r.element.setAttribute("data-ready","true"),o();return}it(r,P)}},r._window.addEventListener("message",r._onMessage),r.element.nodeName!=="IFRAME"){var l=Ie(t,n),C=Me(l);Re(C,l,t).then(function(w){var P=de(w,t);return r.element=P,r._originalElement=t,nt(t,P),K.set(r.element,r),w}).catch(p)}});if(me.set(this,a),K.set(this.element,this),this.element.nodeName==="IFRAME"&&G(this,"ping"),j.isEnabled){var s=function(){return j.exit()};this.fullscreenchangeHandler=function(){j.isFullscreen?re(r,"event:exitFullscreen",s):ue(r,"event:exitFullscreen",s),r.ready().then(function(){G(r,"fullscreenchange",j.isFullscreen)})},j.on("fullscreenchange",this.fullscreenchangeHandler)}return this}return Pe(e,[{key:"callMethod",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new q(function(a,s){return n.ready().then(function(){re(n,r,{resolve:a,reject:s}),G(n,r,i)}).catch(s)})}},{key:"get",value:function(r){var n=this;return new q(function(i,a){return r=Oe(r,"get"),n.ready().then(function(){re(n,r,{resolve:i,reject:a}),G(n,r)}).catch(a)})}},{key:"set",value:function(r,n){var i=this;return new q(function(a,s){if(r=Oe(r,"set"),n==null)throw new TypeError("There must be a value to set.");return i.ready().then(function(){re(i,r,{resolve:a,reject:s}),G(i,r,n)}).catch(s)})}},{key:"on",value:function(r,n){if(!r)throw new TypeError("You must pass an event name.");if(!n)throw new TypeError("You must pass a callback function.");if(typeof n!="function")throw new TypeError("The callback must be a function.");var i=oe(this,"event:".concat(r));i.length===0&&this.callMethod("addEventListener",r).catch(function(){}),re(this,"event:".concat(r),n)}},{key:"off",value:function(r,n){if(!r)throw new TypeError("You must pass an event name.");if(n&&typeof n!="function")throw new TypeError("The callback must be a function.");var i=ue(this,"event:".concat(r),n);i&&this.callMethod("removeEventListener",r).catch(function(a){})}},{key:"loadVideo",value:function(r){return this.callMethod("loadVideo",r)}},{key:"ready",value:function(){var r=me.get(this)||new q(function(n,i){i(new Error("Unknown player. Probably unloaded."))});return q.resolve(r)}},{key:"addCuePoint",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.callMethod("addCuePoint",{time:r,data:n})}},{key:"removeCuePoint",value:function(r){return this.callMethod("removeCuePoint",r)}},{key:"enableTextTrack",value:function(r,n){if(!r)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:r,kind:n})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"requestFullscreen",value:function(){return j.isEnabled?j.request(this.element):this.callMethod("requestFullscreen")}},{key:"exitFullscreen",value:function(){return j.isEnabled?j.exit():this.callMethod("exitFullscreen")}},{key:"getFullscreen",value:function(){return j.isEnabled?q.resolve(j.isFullscreen):this.get("fullscreen")}},{key:"requestPictureInPicture",value:function(){return this.callMethod("requestPictureInPicture")}},{key:"exitPictureInPicture",value:function(){return this.callMethod("exitPictureInPicture")}},{key:"getPictureInPicture",value:function(){return this.get("pictureInPicture")}},{key:"remotePlaybackPrompt",value:function(){return this.callMethod("remotePlaybackPrompt")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var r=this;return new q(function(n){if(me.delete(r),K.delete(r.element),r._originalElement&&(K.delete(r._originalElement),r._originalElement.removeAttribute("data-vimeo-initialized")),r.element&&r.element.nodeName==="IFRAME"&&r.element.parentNode&&(r.element.parentNode.parentNode&&r._originalElement&&r._originalElement!==r.element.parentNode?r.element.parentNode.parentNode.removeChild(r.element.parentNode):r.element.parentNode.removeChild(r.element)),r.element&&r.element.nodeName==="DIV"&&r.element.parentNode){r.element.removeAttribute("data-vimeo-initialized");var i=r.element.querySelector("iframe");i&&i.parentNode&&(i.parentNode.parentNode&&r._originalElement&&r._originalElement!==i.parentNode?i.parentNode.parentNode.removeChild(i.parentNode):i.parentNode.removeChild(i))}r._window.removeEventListener("message",r._onMessage),j.isEnabled&&j.off("fullscreenchange",r.fullscreenchangeHandler),n()})}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(r){return this.set("autopause",r)}},{key:"getBuffered",value:function(){return this.get("buffered")}},{key:"getCameraProps",value:function(){return this.get("cameraProps")}},{key:"setCameraProps",value:function(r){return this.set("cameraProps",r)}},{key:"getChapters",value:function(){return this.get("chapters")}},{key:"getCurrentChapter",value:function(){return this.get("currentChapter")}},{key:"getColor",value:function(){return this.get("color")}},{key:"getColors",value:function(){return q.all([this.get("colorOne"),this.get("colorTwo"),this.get("colorThree"),this.get("colorFour")])}},{key:"setColor",value:function(r){return this.set("color",r)}},{key:"setColors",value:function(r){if(!Array.isArray(r))return new q(function(a,s){return s(new TypeError("Argument must be an array."))});var n=new q(function(a){return a(null)}),i=[r[0]?this.set("colorOne",r[0]):n,r[1]?this.set("colorTwo",r[1]):n,r[2]?this.set("colorThree",r[2]):n,r[3]?this.set("colorFour",r[3]):n];return q.all(i)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(r){return this.set("currentTime",r)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(r){return this.set("loop",r)}},{key:"setMuted",value:function(r){return this.set("muted",r)}},{key:"getMuted",value:function(){return this.get("muted")}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(r){return this.set("playbackRate",r)}},{key:"getPlayed",value:function(){return this.get("played")}},{key:"getQualities",value:function(){return this.get("qualities")}},{key:"getQuality",value:function(){return this.get("quality")}},{key:"setQuality",value:function(r){return this.set("quality",r)}},{key:"getRemotePlaybackAvailability",value:function(){return this.get("remotePlaybackAvailability")}},{key:"getRemotePlaybackState",value:function(){return this.get("remotePlaybackState")}},{key:"getSeekable",value:function(){return this.get("seekable")}},{key:"getSeeking",value:function(){return this.get("seeking")}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(r){return this.set("volume",r)}},{key:"setTimingSrc",value:function(){var t=H(I().mark(function n(i,a){var s=this,o;return I().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(i){l.next=2;break}throw new TypeError("A Timing Object must be provided.");case 2:return l.next=4,this.ready();case 4:return o=new ht(this,i,a),G(this,"notifyTimingObjectConnect"),o.addEventListener("disconnect",function(){return G(s,"notifyTimingObjectDisconnect")}),l.abrupt("return",o);case 8:case"end":return l.stop()}},n,this)}));function r(n,i){return t.apply(this,arguments)}return r}()}]),e}();Ne||(j=ct(),st(),ot(),ut(),lt());var pt=ye;function z(e,t,r,n){this.is_mobile=ce(),this.element=e,this.vid=r,this.uid=n,this.element.setAttribute("data-vbg-uid",n),this.player=null,this.buttons={},this.state={},this.state.play=!1,this.state.mute=!1,this.state.volume_once=!1,this.params={};const i={pause:!1,"play-button":!1,"mute-button":!1,autoplay:!0,muted:!0,loop:!0,mobile:!0,"load-background":!1,resolution:"16:9","inline-styles":!0,"fit-box":!1,offset:200,"start-at":0,"end-at":0,poster:null,"always-play":!1,volume:1,"no-cookie":!0};this.__init__=function(){this.vid&&(this.params=he(t,i,this.element,["data-ytbg-","data-vbg-"]),this.params.pause&&(this.params["play-button"]=this.params.pause),this.params.resolution_mod=fe(this.params.resolution),this.state.playing=this.params.autoplay,this.state.muted=this.params.muted,this.buildHTML(),!(this.is_mobile&&!this.params.mobile)&&(this.injectPlayer(),this.params["play-button"]&&X(this,{name:"play",className:"play-toggle",innerHtml:'',initialState:!1,stateClassName:"paused",condition_parameter:"autoplay",stateChildClassNames:["fa-pause-circle","fa-play-circle"],actions:["play","pause"]}),this.params["mute-button"]&&X(this,{name:"mute",className:"mute-toggle",innerHtml:'',initialState:!0,stateClassName:"muted",condition_parameter:"muted",stateChildClassNames:["fa-volume-up","fa-volume-mute"],actions:["unmute","mute"]})))},this.__init__()}z.prototype.seekTo=function(e){this.player.setCurrentTime(e)},z.prototype.onVideoPlayerReady=function(e){this.seekTo(this.params["start-at"]),this.params.autoplay&&(this.params["always-play"]||this.isIntersecting)&&(this.player.play(),this.element.dispatchEvent(new CustomEvent("video-background-play",{bubbles:!0,detail:this}))),this.iframe.style.opacity=1},z.prototype.onVideoEnded=function(e){this.params.loop&&(this.seekTo(this.params["start-at"]),this.player.play())},z.prototype.onVideoProgress=function(e){e.seconds>=this.params["end-at"]&&(this.seekTo(this.params["start-at"]),this.params.loop||this.pause())},z.prototype.injectPlayer=function(){this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder",0),this.iframe.setAttribute("allow",["autoplay; mute"]);let e="https://player.vimeo.com/video/"+this.vid+"?background=1&controls=0";if(this.params.muted&&(e+="&muted=1"),this.params.autoplay&&this.params["always-play"]&&(e+="&autoplay=1"),this.params.loop&&(e+="&loop=1&autopause=0"),this.params["no-cookie"]&&(e+="&dnt=1"),this.params["start-at"]&&(e+="#t="+this.params["start-at"]+"s"),this.iframe.src=e,this.uid&&(this.iframe.id=this.uid),this.params["inline-styles"]&&(this.iframe.style.top="50%",this.iframe.style.left="50%",this.iframe.style.transform="translateX(-50%) translateY(-50%)",this.iframe.style.position="absolute",this.iframe.style.opacity=1),this.element.appendChild(this.iframe),this.params["fit-box"])this.iframe.style.width="100%",this.iframe.style.height="100%";else{const t=this,r=function(){const n=t.iframe.parentNode.offsetHeight+t.params.offset,i=t.iframe.parentNode.offsetWidth+t.params.offset,a=t.params.resolution_mod;a>i/n?(t.iframe.style.width=n*a+"px",t.iframe.style.height=n+"px"):(t.iframe.style.width=i+"px",t.iframe.style.height=i/a+"px")};window.hasOwnProperty("ResizeObserver")?new ResizeObserver(()=>{window.requestAnimationFrame(r)}).observe(this.element):window.addEventListener("resize",()=>{window.requestAnimationFrame(r)}),r()}this.player=new pt(this.iframe),this.player.on("loaded",this.onVideoPlayerReady.bind(this)),this.player.on("ended",this.onVideoEnded.bind(this)),this.params["end-at"]>0&&this.player.on("progress",this.onVideoProgress.bind(this)),this.params.volume!==1&&!this.params.muted&&this.setVolume(this.params.volume)},z.prototype.buildHTML=function(){const e=this.element.parentNode;N(this.element,"youtube-background");const t={height:"100%",width:"100%","z-index":"0",position:"absolute",overflow:"hidden",top:0,left:0,bottom:0,right:0};if((this.params["load-background"]||this.params.poster)&&(this.params["load-background"]&&(t["background-image"]="url(https://vumbnail.com/"+this.vid+".jpg)"),this.params.poster&&(t["background-image"]=`url(${this.params.poster})`),t["background-size"]="cover",t["background-repeat"]="no-repeat",t["background-position"]="center"),this.params["mute-button"]||(t["pointer-events"]="none"),this.params["inline-styles"]){for(let r in t)this.element.style[r]=t[r];["absolute","fixed","relative","sticky"].indexOf(e.style.position)||(e.style.position="relative")}if(this.params["play-button"]||this.params["mute-button"]){const r=document.createElement("div");r.className="video-background-controls",r.style.position="absolute",r.style.top="10px",r.style.right="10px",r.style["z-index"]=2,this.controls_element=r,e.appendChild(r)}return this.element},z.prototype.play=function(){if(this.buttons.hasOwnProperty("play")){const e=this.buttons.play;S(e.element,e.button_properties.stateClassName),N(e.element.firstChild,e.button_properties.stateChildClassNames[0]),S(e.element.firstChild,e.button_properties.stateChildClassNames[1])}if(this.player){if(this.params["start-at"]||this.params["end-at"]){const e=this;this.player.getCurrentTime().then(function(t){te.params["end-at"]&&e.seekTo(e.params["start-at"])})}this.player.play(),this.element.dispatchEvent(new CustomEvent("video-background-play",{bubbles:!0,detail:this}))}},z.prototype.pause=function(){if(this.buttons.hasOwnProperty("play")){const e=this.buttons.play;N(e.element,e.button_properties.stateClassName),S(e.element.firstChild,e.button_properties.stateChildClassNames[0]),N(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.player.pause(),this.element.dispatchEvent(new CustomEvent("video-background-pause",{bubbles:!0,detail:this})))},z.prototype.unmute=function(){if(this.buttons.hasOwnProperty("mute")){const e=this.buttons.mute;S(e.element,e.button_properties.stateClassName),N(e.element.firstChild,e.button_properties.stateChildClassNames[0]),S(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.state.volume_once||(this.state.volume_once=!0,this.setVolume(this.params.volume)),this.player.setMuted(!1),this.element.dispatchEvent(new CustomEvent("video-background-unmute",{bubbles:!0,detail:this})))},z.prototype.mute=function(){if(this.buttons.hasOwnProperty("mute")){const e=this.buttons.mute;N(e.element,e.button_properties.stateClassName),S(e.element.firstChild,e.button_properties.stateChildClassNames[0]),N(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.player.setMuted(!0),this.element.dispatchEvent(new CustomEvent("video-background-mute",{bubbles:!0,detail:this})))},z.prototype.setVolume=function(e){this.player&&(this.player.setVolume(e),this.element.dispatchEvent(new CustomEvent("video-background-volume-change",{bubbles:!0,detail:this})))};function B(e,t,r,n){this.is_mobile=ce(),this.element=e,this.link=r.link,this.ext=/(?:\.([^.]+))?$/.exec(r.id)[1],this.uid=n,this.element.setAttribute("data-vbg-uid",n),this.player=null,this.buttons={},this.state={},this.state.play=!1,this.state.mute=!1,this.state.volume_once=!1,this.params={};const i={ogv:"video/ogg",ogm:"video/ogg",ogg:"video/ogg",avi:"video/avi",mp4:"video/mp4",webm:"video/webm"},a={pause:!1,"play-button":!1,"mute-button":!1,autoplay:!0,muted:!0,loop:!0,mobile:!0,resolution:"16:9","inline-styles":!0,"fit-box":!1,offset:200,poster:null,"always-play":!1,volume:1};this.__init__=function(){!this.link||!this.ext||(this.mime=i[this.ext.toLowerCase()],this.params=he(t,a,this.element,["data-ytbg-","data-vbg-"]),this.params.pause&&(this.params["play-button"]=this.params.pause),this.params.resolution_mod=fe(this.params.resolution),this.state.playing=this.params.autoplay,this.state.muted=this.params.muted,this.buildHTML(),this.injectPlayer(),this.params["play-button"]&&X(this,{name:"play",className:"play-toggle",innerHtml:'',initialState:!1,stateClassName:"paused",condition_parameter:"autoplay",stateChildClassNames:["fa-pause-circle","fa-play-circle"],actions:["play","pause"]}),this.params["mute-button"]&&X(this,{name:"mute",className:"mute-toggle",innerHtml:'',initialState:!0,stateClassName:"muted",condition_parameter:"muted",stateChildClassNames:["fa-volume-up","fa-volume-mute"],actions:["unmute","mute"]}))},this.__init__()}B.prototype.seekTo=function(e){if(this.player.hasOwnProperty("fastSeek")){this.player.fastSeek(e);return}this.player.currentTime=e},B.prototype.injectPlayer=function(){this.player=document.createElement("video"),this.player.toggleAttribute("playsinline",!0),this.player.toggleAttribute("loop",this.params.loop),this.player.toggleAttribute("autoplay",this.params.autoplay&&(this.params["always-play"]||this.isIntersecting)),this.player.toggleAttribute("muted",this.params.muted),this.params.volume!==1&&!this.params.muted&&this.setVolume(this.params.volume),this.player.setAttribute("id",this.uid),this.params["inline-styles"]&&(this.player.style.top="50%",this.player.style.left="50%",this.player.style.transform="translateX(-50%) translateY(-50%)",this.player.style.position="absolute",this.player.style.opacity=0,this.player.addEventListener("canplay",r=>{r.target.style.opacity=1}));const e=this,t=document.createElement("source");if(t.setAttribute("src",this.link),t.setAttribute("type",this.mime),this.player.appendChild(t),this.element.appendChild(this.player),this.params["fit-box"])this.player.style.width="100%",this.player.style.height="100%";else{let r=function(){const n=e.player.parentNode.offsetHeight+e.params.offset,i=e.player.parentNode.offsetWidth+e.params.offset,a=e.params.resolution_mod;a>i/n?(e.player.style.width=n*a+"px",e.player.style.height=n+"px"):(e.player.style.width=i+"px",e.player.style.height=i/a+"px")};window.hasOwnProperty("ResizeObserver")?new ResizeObserver(()=>{window.requestAnimationFrame(r)}).observe(this.element):window.addEventListener("resize",()=>{window.requestAnimationFrame(r)}),r()}},B.prototype.buildHTML=function(){const e=this.element.parentNode;N(this.element,"video-background");const t={height:"100%",width:"100%","z-index":"0",position:"absolute",overflow:"hidden",top:0,left:0,bottom:0,right:0};if(this.params["mute-button"]||(t["pointer-events"]="none"),this.params.poster&&(this.params.poster&&(t["background-image"]=`url('${this.params.poster}')`),t["background-size"]="cover",t["background-repeat"]="no-repeat",t["background-position"]="center"),this.params["inline-styles"]){for(let r in t)this.element.style[r]=t[r];["absolute","fixed","relative","sticky"].indexOf(e.style.position)||(e.style.position="relative")}if(this.params["play-button"]||this.params["mute-button"]){const r=document.createElement("div");r.className="video-background-controls",r.style.position="absolute",r.style.top="10px",r.style.right="10px",r.style["z-index"]=2,this.controls_element=r,e.appendChild(r)}return this.element},B.prototype.play=function(){if(this.buttons.hasOwnProperty("play")){const e=this.buttons.play;S(e.element,e.button_properties.stateClassName),N(e.element.firstChild,e.button_properties.stateChildClassNames[0]),S(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.player.play(),this.element.dispatchEvent(new CustomEvent("video-background-play",{bubbles:!0,detail:this})))},B.prototype.pause=function(){if(this.buttons.hasOwnProperty("play")){const e=this.buttons.play;N(e.element,e.button_properties.stateClassName),S(e.element.firstChild,e.button_properties.stateChildClassNames[0]),N(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.player.pause(),this.element.dispatchEvent(new CustomEvent("video-background-pause",{bubbles:!0,detail:this})))},B.prototype.unmute=function(){if(this.buttons.hasOwnProperty("mute")){const e=this.buttons.mute;S(e.element,e.button_properties.stateClassName),N(e.element.firstChild,e.button_properties.stateChildClassNames[0]),S(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.player.muted=!1,this.state.volume_once||(this.state.volume_once=!0,this.setVolume(this.params.volume)),this.element.dispatchEvent(new CustomEvent("video-background-unmute",{bubbles:!0,detail:this})))},B.prototype.mute=function(){if(this.buttons.hasOwnProperty("mute")){const e=this.buttons.mute;N(e.element,e.button_properties.stateClassName),S(e.element.firstChild,e.button_properties.stateChildClassNames[0]),N(e.element.firstChild,e.button_properties.stateChildClassNames[1])}this.player&&(this.player.muted=!0,this.element.dispatchEvent(new CustomEvent("video-background-mute",{bubbles:!0,detail:this})))},B.prototype.setVolume=function(e){this.player&&(this.player.volume=e,this.element.dispatchEvent(new CustomEvent("video-background-volume-change",{bubbles:!0,detail:this})))};function W(e,t){this.elements=e,typeof e=="string"&&(this.elements=document.querySelectorAll(e)),this.index={},this.re={},this.re.YOUTUBE=ze,this.re.VIMEO=$e,this.re.VIDEO=Ue,this.__init__=function(){const r=this;this.intersectionObserver=new IntersectionObserver(function(n){n.forEach(function(i){const a=i.target.getAttribute("data-vbg-uid");a&&r.index.hasOwnProperty(a)&&i.isIntersecting?(r.index[a].isIntersecting=!0,r.index[a].player&&r.index[a].params.autoplay&&r.index[a].play()):(r.index[a].isIntersecting=!1,r.index[a].player&&r.index[a].pause())})});for(let n=0;n