1 |
- !function(){const e=["premium","referrerPolicy"];function t(e,t){if(null==e)return{};var i,s,n=function(e,t){if(null==e)return{};var i,s,n={},a=Object.keys(e);for(s=0;s<a.length;s++)i=a[s],t.indexOf(i)>=0||(n[i]=e[i]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function i(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function s(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?i(Object(s),!0).forEach((function(t){n(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function n(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}System.register(["./index-legacy-e1ea41b7.js","./plyr-legacy-dc19a0b3.js"],(function(i,n){"use strict";var a,l,r,o,c;return{setters:[e=>{a=e.d,l=e.R,r=e.a,o=e.L,c=e.A},null],execute:function(){var n=document.createElement("style");n.textContent="._video-container_1hxfx_1{position:relative;width:100%;--plyr-color-main: var(--k-primary)}._video-container_1hxfx_1 video{width:100%}._video-container_1hxfx_1 .video-back{position:absolute;left:.53333rem;top:.53333rem;color:#fff;z-index:99;font-size:.64rem;width:.8rem;height:.8rem;background-color:rgba(0,0,0,.5);border-radius:50%;padding:.10667rem .13333rem .10667rem .08rem}._video-container_1hxfx_1 .plyr__poster{background-size:cover}._video-container_1hxfx_1 .plyr__control--overlaid{border:.02667rem solid #fff;background-color:rgba(0,0,0,.2)!important}._video-container_1hxfx_1 .plyr--video .plyr__control:hover{background-color:transparent!important}._video-container_1hxfx_1 ._video_1hxfx_1{position:relative}._loadingVideo_1hxfx_35{position:absolute;top:0;left:0;bottom:0;right:0;background:rgba(0,0,0,.9);z-index:10}\n",document.head.appendChild(n);const u="_video-container_1hxfx_1",h="_video_1hxfx_1",d="_loadingVideo_1hxfx_35";function m(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function p(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function g(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function f(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function y(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?f(Object(i),!0).forEach((function(t){g(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):f(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var b={addCSS:!0,thumbWidth:15,watch:!0};var v=function(e){return null!=e?e.constructor:null},w=function(e,t){return!!(e&&t&&e instanceof t)},k=function(e){return null==e},T=function(e){return v(e)===Object},C=function(e){return v(e)===String},A=function(e){return Array.isArray(e)},S=function(e){return w(e,NodeList)},E=C,P=A,x=S,M=function(e){return w(e,Element)},N=function(e){return w(e,Event)},_=function(e){return k(e)||(C(e)||A(e)||S(e))&&!e.length||T(e)&&!Object.keys(e).length};function L(e,t){if(1>t){var i=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var I=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),M(t)?this.element=t:E(t)&&(this.element=document.querySelector(t)),M(this.element)&&_(this.element.rangeTouch)&&(this.config=y({},b,{},i),this.init())}return function(e,t,i){t&&p(e.prototype,t),i&&p(e,i)}(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,i=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[i](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!N(t))return null;var i,s=t.target,n=t.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,l=parseFloat(s.getAttribute("max"))||100,r=parseFloat(s.getAttribute("step"))||1,o=s.getBoundingClientRect(),c=100/o.width*(this.config.thumbWidth/2)/100;return 0>(i=100/o.width*(n.clientX-o.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+L(i/100*(l-a),r)}},{key:"set",value:function(t){e.enabled&&N(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),function(e,t){if(e&&t){var i=new Event(t,{bubbles:!0});e.dispatchEvent(i)}}(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=null;if(_(t)||E(t)?s=Array.from(document.querySelectorAll(E(t)?t:'input[type="range"]')):M(t)?s=[t]:x(t)?s=Array.from(t):P(t)&&(s=t.filter(M)),_(s))return null;var n=y({},b,{},i);if(E(t)&&n.watch){var a=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){M(i)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(i,t)&&new e(i,n)}))}))}));a.observe(document.body,{childList:!0,subtree:!0})}return s.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();const O=e=>null!=e?e.constructor:null,$=(e,t)=>Boolean(e&&t&&e instanceof t),j=e=>null==e,D=e=>O(e)===Object,q=e=>O(e)===String,H=e=>"function"==typeof e,R=e=>Array.isArray(e),F=e=>$(e,NodeList),V=e=>j(e)||(q(e)||R(e)||F(e))&&!e.length||D(e)&&!Object.keys(e).length;var B={nullOrUndefined:j,object:D,number:e=>O(e)===Number&&!Number.isNaN(e),string:q,boolean:e=>O(e)===Boolean,function:H,array:R,weakMap:e=>$(e,WeakMap),nodeList:F,element:e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,textNode:e=>O(e)===Text,event:e=>$(e,Event),keyboardEvent:e=>$(e,KeyboardEvent),cue:e=>$(e,window.TextTrackCue)||$(e,window.VTTCue),track:e=>$(e,TextTrack)||!j(e)&&q(e.kind),promise:e=>$(e,Promise)&&H(e.then),url:e=>{if($(e,window.URL))return!0;if(!q(e))return!1;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t=`http://${e}`);try{return!V(new URL(t).hostname)}catch(e){return!1}},empty:V};const U=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find((t=>void 0!==e.style[t]));return!!B.string(i)&&t[i]})();function W(e,t){setTimeout((()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var z={isIE:Boolean(window.document.documentMode),isEdge:/Edge/g.test(navigator.userAgent),isWebKit:"WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),isIPhone:/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,isIPadOS:"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,isIos:/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1};function K(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)}function Y(e={},...t){if(!t.length)return e;const i=t.shift();return B.object(i)?(Object.keys(i).forEach((t=>{B.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),Y(e[t],i[t])):Object.assign(e,{[t]:i[t]})})),Y(e,...t)):e}function Q(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach(((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)}))}function X(e,t){B.element(e)&&!B.empty(t)&&Object.entries(t).filter((([,e])=>!B.nullOrUndefined(e))).forEach((([t,i])=>e.setAttribute(t,i)))}function J(e,t,i){const s=document.createElement(e);return B.object(t)&&X(s,t),B.string(i)&&(s.innerText=i),s}function G(e,t,i,s){B.element(t)&&t.appendChild(J(e,i,s))}function Z(e){B.nodeList(e)||B.array(e)?Array.from(e).forEach(Z):B.element(e)&&B.element(e.parentNode)&&e.parentNode.removeChild(e)}function ee(e){if(!B.element(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),t-=1}function te(e,t){return B.element(t)&&B.element(t.parentNode)&&B.element(e)?(t.parentNode.replaceChild(e,t),e):null}function ie(e,t){if(!B.string(e)||B.empty(e))return{};const i={},s=Y({},t);return e.split(",").forEach((e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),[l]=a,r=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":B.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[l]=r}})),Y(s,i)}function se(e,t){if(!B.element(e))return;let i=t;B.boolean(i)||(i=!e.hidden),e.hidden=i}function ne(e,t,i){if(B.nodeList(e))return Array.from(e).map((e=>ne(e,t,i)));if(B.element(e)){let s="toggle";return void 0!==i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function ae(e,t){return B.element(e)&&e.classList.contains(t)}function le(e,t){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function re(e){return this.elements.container.querySelectorAll(e)}function oe(e){return this.elements.container.querySelector(e)}function ce(e=null,t=!1){B.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}const ue={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},he={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t){const i=he[e]||"html5"!==t;return{api:i,ui:i&&he.rangeInput}},pip:!(z.isIPhone||!B.function(J("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||J("video").disablePictureInPicture)),airplay:B.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(B.empty(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(ue).includes(i)&&(i+=`; codecs="${ue[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==U,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},de=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function me(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||B.empty(t)||!B.function(i))return;const l=t.split(" ");let r=a;de&&(r={passive:n,capture:a}),l.forEach((t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:r}),e[s?"addEventListener":"removeEventListener"](t,i,r)}))}function pe(e,t="",i,s=!0,n=!1){me.call(this,e,t,i,!0,s,n)}function ge(e,t="",i,s=!0,n=!1){me.call(this,e,t,i,!1,s,n)}function fe(e,t="",i,s=!0,n=!1){const a=(...l)=>{ge(e,t,a,s,n),i.apply(this,l)};me.call(this,e,t,a,!0,s,n)}function ye(e,t="",i=!1,n={}){if(!B.element(e)||B.empty(t))return;const a=new CustomEvent(t,{bubbles:i,detail:s(s({},n),{},{plyr:this})});e.dispatchEvent(a)}function be(){this&&this.eventListeners&&(this.eventListeners.forEach((e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)})),this.eventListeners=[])}function ve(){return new Promise((e=>this.ready?setTimeout(e,0):pe.call(this,this.elements.container,"ready",e))).then((()=>{}))}function we(e){B.promise(e)&&e.then(null,(()=>{}))}function ke(e){return B.array(e)?e.filter(((t,i)=>e.indexOf(t)===i)):e}function Te(e,t){return B.array(e)&&e.length?e.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)):null}function Ce(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const Ae=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce(((e,[t,i])=>s(s({},e),{},{[t/i]:[t,i]})),{});function Se(e){return!!(B.array(e)||B.string(e)&&e.includes(":"))&&(B.array(e)?e:e.split(":")).map(Number).every(B.number)}function Ee(e){if(!B.array(e)||!e.every(B.number))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function Pe(e){const t=e=>Se(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!B.empty(this.embed)&&B.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=[e,t]}return Ee(i)}function xe(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=Pe.call(this,e);if(!B.array(i))return{};const[s,n]=Ee(i),a=100/s*n;if(Ce(`aspect-ratio: ${s}/${n}`)?t.style.aspectRatio=`${s}/${n}`:t.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),i=(e-a)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${i}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function Me(e,t,i=.05){const s=e/t,n=Te(Object.keys(Ae),s);return Math.abs(n-s)<=i?Ae[n]:[e,t]}const Ne={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((e=>{const t=e.getAttribute("type");return!!B.empty(t)||he.mime.call(this,t)})):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:Ne.getSources.call(this).map((e=>Number(e.getAttribute("size")))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,B.empty(this.config.ratio)||xe.call(e),Object.defineProperty(e.media,"quality",{get(){const t=Ne.getSources.call(e).find((t=>t.getAttribute("src")===e.source));return t&&Number(t.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&B.function(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=Ne.getSources.call(e).find((e=>Number(e.getAttribute("size"))===t));if(!i)return;const{currentTime:s,paused:n,preload:a,readyState:l,playbackRate:r}=e.media;e.media.src=i.getAttribute("src"),("none"!==a||l)&&(e.once("loadedmetadata",(()=>{e.speed=r,e.currentTime=s,n||we(e.play())})),e.media.load())}ye.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(Z(Ne.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function _e(e){return`${e}-${Math.floor(1e4*Math.random())}`}function Le(e,...t){return B.empty(e)?e:e.toString().replace(/{(\d+)}/g,((e,i)=>t[i].toString()))}const Ie=(e="",t="",i="")=>e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),Oe=(e="")=>e.toString().replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()));function $e(e=""){let t=e.toString();return t=function(e=""){let t=e.toString();return t=Ie(t,"-"," "),t=Ie(t,"_"," "),t=Oe(t),Ie(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}function je(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const De={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},qe={get(e="",t={}){if(B.empty(e)||B.empty(t))return"";let i=K(t.i18n,e);if(B.empty(i))return Object.keys(De).includes(e)?De[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach((([e,t])=>{i=Ie(i,e,t)})),i}};class He{constructor(e){m(this,"get",(e=>{if(!He.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(B.empty(t))return null;const i=JSON.parse(t);return B.string(e)&&e.length?i[e]:i})),m(this,"set",(e=>{if(!He.supported||!this.enabled)return;if(!B.object(e))return;let t=this.get();B.empty(t)&&(t={}),Y(t,e);try{window.localStorage.setItem(this.key,JSON.stringify(t))}catch(e){}})),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(lt){return!1}}}function Re(e,t="text"){return new Promise(((i,s)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(()=>{if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(()=>{throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){s(e)}}))}function Fe(e,t){if(!B.string(e))return;const i="cache",s=B.string(t);let n=!1;const a=()=>null!==document.getElementById(t),l=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=He.supported,r=document.createElement("div");if(r.setAttribute("hidden",""),s&&r.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);l(r,t.content)}}Re(e).then((e=>{if(!B.empty(e)){if(a)try{window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e}))}catch(e){}l(r,e)}})).catch((()=>{}))}}const Ve=e=>Math.trunc(e/60/60%60,10);function Be(e=0,t=!1,i=!1){if(!B.number(e))return Be(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=Ve(e);const a=(e=>Math.trunc(e/60%60,10))(e),l=(e=>Math.trunc(e%60,10))(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(l)}`}const Ue={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,i=e.host!==t||z.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=oe.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:re.call(this,this.config.selectors.buttons.play),pause:oe.call(this,this.config.selectors.buttons.pause),restart:oe.call(this,this.config.selectors.buttons.restart),rewind:oe.call(this,this.config.selectors.buttons.rewind),fastForward:oe.call(this,this.config.selectors.buttons.fastForward),mute:oe.call(this,this.config.selectors.buttons.mute),pip:oe.call(this,this.config.selectors.buttons.pip),airplay:oe.call(this,this.config.selectors.buttons.airplay),settings:oe.call(this,this.config.selectors.buttons.settings),captions:oe.call(this,this.config.selectors.buttons.captions),fullscreen:oe.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=oe.call(this,this.config.selectors.progress),this.elements.inputs={seek:oe.call(this,this.config.selectors.inputs.seek),volume:oe.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:oe.call(this,this.config.selectors.display.buffer),currentTime:oe.call(this,this.config.selectors.display.currentTime),duration:oe.call(this,this.config.selectors.display.duration)},B.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(lt){return this.debug.warn("It looks like there is a problem with your custom controls HTML",lt),this.toggleNativeControls(!0),!1}},createIcon(e,t){const i="http://www.w3.org/2000/svg",s=Ue.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");X(a,Y(t,{"aria-hidden":"true",focusable:"false"}));const l=document.createElementNS(i,"use"),r=`${n}-${e}`;return"href"in l&&l.setAttributeNS("http://www.w3.org/1999/xlink","href",r),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),a.appendChild(l),a},createLabel(e,t={}){const i=qe.get(e,this.config);return J("span",s(s({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),i)},createBadge(e){if(B.empty(e))return null;const t=J("span",{class:this.config.classNames.menu.value});return t.appendChild(J("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=Y({},t);let s=$e(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])})),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((e=>e===this.config.classNames.control))||Y(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:B.empty(n.label)&&(n.label=s),B.empty(n.icon)&&(n.icon=e)}const a=J(n.element);return n.toggle?(a.appendChild(Ue.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(Ue.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(Ue.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(Ue.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(Ue.createIcon.call(this,n.icon)),a.appendChild(Ue.createLabel.call(this,n.label))),Y(i,ie(this.config.selectors.buttons[s],i)),X(a,i),"play"===s?(B.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=J("input",Y(ie(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":qe.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,Ue.updateRangeFill.call(this,i),I.setup(i),i},createProgress(e,t){const i=J("progress",Y(ie(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(J("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?qe.get(t,this.config):"";i.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=ie(this.config.selectors.display[e],t),s=J("div",Y(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":qe.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){pe.call(this,e,"keydown keyup",(i=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(i.key))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=le(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(i.key))Ue.showMenuPanel.call(this,t,!0);else{let t;" "!==i.key&&("ArrowDown"===i.key||s&&"ArrowRight"===i.key?(t=e.nextElementSibling,B.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,B.element(t)||(t=e.parentNode.lastElementChild)),ce.call(this,t,!0))}}),!1),pe.call(this,e,"keyup",(e=>{"Return"===e.key&&Ue.focusFirstMenuItem.call(this,null,!0)}))},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const l=ie(this.config.selectors.inputs[i]),r=J("button",Y(l,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${l.class?l.class:""}`.trim(),"aria-checked":a,value:e})),o=J("span");o.innerHTML=s,B.element(n)&&o.appendChild(n),r.appendChild(o),Object.defineProperty(r,"checked",{enumerable:!0,get:()=>"true"===r.getAttribute("aria-checked"),set(e){e&&Array.from(r.parentNode.children).filter((e=>le(e,'[role="menuitemradio"]'))).forEach((e=>e.setAttribute("aria-checked","false"))),r.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(r,"click keyup",(t=>{if(!B.keyboardEvent(t)||" "===t.key){switch(t.preventDefault(),t.stopPropagation(),r.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}Ue.showMenuPanel.call(this,"home",B.keyboardEvent(t))}}),i,!1),Ue.bindMenuItemShortcuts.call(this,r,i),t.appendChild(r)},formatTime(e=0,t=!1){return B.number(e)?Be(e,Ve(this.duration)>0,t):e},updateTimeDisplay(e=null,t=0,i=!1){B.element(e)&&B.number(t)&&(e.innerText=Ue.formatTime(t,i))},updateVolume(){this.supported.ui&&(B.element(this.elements.inputs.volume)&&Ue.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),B.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){B.element(e)&&(e.value=t,Ue.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!B.event(e))return;let t=0;const i=(e,t)=>{const i=B.number(t)?t:0,s=B.element(e)?e:this.elements.display.buffer;if(B.element(s)){s.value=i;const e=s.getElementsByTagName("span")[0];B.element(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":t=function(e,t){return 0===e||0===t||Number.isNaN(e)||Number.isNaN(t)?0:(e/t*100).toFixed(2)}(this.currentTime,this.duration),"timeupdate"===e.type&&Ue.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(e){const t=B.event(e)?e.target:e;if(B.element(t)&&"range"===t.getAttribute("type")){if(le(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=Ue.formatTime(this.currentTime),i=Ue.formatTime(this.duration),s=qe.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(le(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);(z.isWebKit||z.isIPadOS)&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){var t,i;if(!this.config.tooltips.seek||!B.element(this.elements.inputs.seek)||!B.element(this.elements.display.seekTooltip)||0===this.duration)return;const s=this.elements.display.seekTooltip,n=`${this.config.classNames.tooltip}--visible`,a=e=>ne(s,n,e);if(this.touch)return void a(!1);let l=0;const r=this.elements.progress.getBoundingClientRect();if(B.event(e))l=100/r.width*(e.pageX-r.left);else{if(!ae(s,n))return;l=parseFloat(s.style.left,10)}l<0?l=0:l>100&&(l=100);const o=this.duration/100*l;s.innerText=Ue.formatTime(o);const c=null===(t=this.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(o)));c&&s.insertAdjacentHTML("afterbegin",`${c.label}<br>`),s.style.left=`${l}%`,B.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&a("mouseenter"===e.type)},timeUpdate(e){const t=!B.element(this.elements.display.duration)&&this.config.invertTime;Ue.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||Ue.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return se(this.elements.display.currentTime,!0),void se(this.elements.progress,!0);B.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=B.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&Ue.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&Ue.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&Ue.setMarkers.call(this),Ue.updateSeekTooltip.call(this)},toggleMenuButton(e,t){se(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=B.empty(i)?this[e]:i,B.empty(n)&&(n=this.config[e].default),!B.empty(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(B.element(a)||(a=s&&s.querySelector('[role="menu"]')),!B.element(a))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=Ue.getLabel.call(this,e,n);const l=a&&a.querySelector(`[value="${n}"]`);B.element(l)&&(l.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?qe.get("normal",this.config):`${t}×`;case"quality":if(B.number(t)){const e=qe.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return Oe(t);case"captions":return Ke.getLabel.call(this);default:return null}},setQualityMenu(e){if(!B.element(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');B.array(e)&&(this.options.quality=ke(e).filter((e=>this.config.quality.options.includes(e))));const s=!B.empty(this.options.quality)&&this.options.quality.length>1;if(Ue.toggleMenuButton.call(this,t,s),ee(i),Ue.checkMenu.call(this),!s)return;const n=e=>{const t=qe.get(`qualityBadge.${e}`,this.config);return t.length?Ue.createBadge.call(this,t):null};this.options.quality.sort(((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1})).forEach((e=>{Ue.createMenuItem.call(this,{value:e,list:i,type:t,title:Ue.getLabel.call(this,"quality",e),badge:n(e)})})),Ue.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!B.element(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=Ke.getTracks.call(this),s=Boolean(i.length);if(Ue.toggleMenuButton.call(this,e,s),ee(t),Ue.checkMenu.call(this),!s)return;const n=i.map(((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:Ke.getLabel.call(this,e),badge:e.language&&Ue.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"})));n.unshift({value:-1,checked:!this.captions.toggled,title:qe.get("disabled",this.config),list:t,type:"language"}),n.forEach(Ue.createMenuItem.bind(this)),Ue.updateSetting.call(this,e,t)},setSpeedMenu(){if(!B.element(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((e=>e>=this.minimumSpeed&&e<=this.maximumSpeed));const i=!B.empty(this.options.speed)&&this.options.speed.length>1;Ue.toggleMenuButton.call(this,e,i),ee(t),Ue.checkMenu.call(this),i&&(this.options.speed.forEach((i=>{Ue.createMenuItem.call(this,{value:i,list:t,type:e,title:Ue.getLabel.call(this,"speed",i)})})),Ue.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!B.empty(e)&&Object.values(e).some((e=>!e.hidden));se(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;B.element(i)||(i=Object.values(this.elements.settings.panels).find((e=>!e.hidden)));const s=i.querySelector('[role^="menuitem"]');ce.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!B.element(t)||!B.element(i))return;const{hidden:s}=t;let n=s;if(B.boolean(e))n=e;else if(B.keyboardEvent(e)&&"Escape"===e.key)n=!1;else if(B.event(e)){const s=B.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),se(t,!n),ne(this.elements.container,this.config.classNames.menu.open,n),n&&B.keyboardEvent(e)?Ue.focusFirstMenuItem.call(this,null,!0):n||s||ce.call(this,i,B.keyboardEvent(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return Z(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!B.element(i))return;const s=i.parentNode,n=Array.from(s.children).find((e=>!e.hidden));if(he.transitions&&!he.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=Ue.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",ge.call(this,s,U,t))};pe.call(this,s,U,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}se(n,!0),se(i,!1),Ue.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;B.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:l,setSpeedMenu:r,showMenuPanel:o}=Ue;this.elements.controls=null,B.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=J("div",ie(this.config.selectors.controls.wrapper));this.elements.controls=c;const u={class:"plyr__controls__item"};return ke(B.array(this.config.controls)?this.config.controls:[]).forEach((l=>{if("restart"===l&&c.appendChild(i.call(this,"restart",u)),"rewind"===l&&c.appendChild(i.call(this,"rewind",u)),"play"===l&&c.appendChild(i.call(this,"play",u)),"fast-forward"===l&&c.appendChild(i.call(this,"fast-forward",u)),"progress"===l){const t=J("div",{class:`${u.class} plyr__progress__container`}),i=J("div",ie(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=J("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===l&&c.appendChild(a.call(this,"currentTime",u)),"duration"===l&&c.appendChild(a.call(this,"duration",u)),"mute"===l||"volume"===l){let{volume:t}=this.elements;if(B.element(t)&&c.contains(t)||(t=J("div",Y({},u,{class:`${u.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===l&&t.appendChild(i.call(this,"mute")),"volume"===l&&!z.isIos&&!z.isIPadOS){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",Y(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===l&&c.appendChild(i.call(this,"captions",u)),"settings"===l&&!B.empty(this.config.settings)){const s=J("div",Y({},u,{class:`${u.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=J("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=J("div"),l=J("div",{id:`plyr-settings-${e.id}-home`}),r=J("div",{role:"menu"});l.appendChild(r),a.appendChild(l),this.elements.settings.panels.home=l,this.config.settings.forEach((i=>{const s=J("button",Y(ie(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),pe.call(this,s,"click",(()=>{o.call(this,i,!1)}));const n=J("span",null,qe.get(i,this.config)),l=J("span",{class:this.config.classNames.menu.value});l.innerHTML=e[i],n.appendChild(l),s.appendChild(n),r.appendChild(s);const c=J("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),u=J("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});u.appendChild(J("span",{"aria-hidden":!0},qe.get(i,this.config))),u.appendChild(J("span",{class:this.config.classNames.hidden},qe.get("menuBack",this.config))),pe.call(this,c,"keydown",(e=>{"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),o.call(this,"home",!0))}),!1),pe.call(this,u,"click",(()=>{o.call(this,"home",!1)})),c.appendChild(u),c.appendChild(J("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c})),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===l&&he.pip&&c.appendChild(i.call(this,"pip",u)),"airplay"===l&&he.airplay&&c.appendChild(i.call(this,"airplay",u)),"download"===l){const e=Y({},u,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!B.url(t)&&this.isEmbed&&Y(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===l&&c.appendChild(i.call(this,"fullscreen",u))})),this.isHTML5&&l.call(this,Ne.getQualityOptions.call(this)),r.call(this),c},inject(){if(this.config.loadSprite){const e=Ue.getIconUrl.call(this);e.cors&&Fe(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i,s=!0;if(B.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),B.element(this.config.controls)||B.string(this.config.controls)?e=this.config.controls:(e=Ue.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Ke.getLabel.call(this)}),s=!1),s&&B.string(this.config.controls)&&(e=(e=>{let i=e;return Object.entries(t).forEach((([e,t])=>{i=Ie(i,`{${e}}`,t)})),i})(e)),B.string(this.config.selectors.controls.container)&&(i=document.querySelector(this.config.selectors.controls.container)),B.element(i)||(i=this.elements.container),i[B.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),B.element(this.elements.controls)||Ue.findElements.call(this),!B.empty(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;e.setAttribute("aria-pressed","false"),Object.defineProperty(e,"pressed",{configurable:!0,enumerable:!0,get:()=>ae(e,t),set(i=!1){ne(e,t,i),e.setAttribute("aria-pressed",i?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach((t=>{B.array(t)||B.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)}))}if(z.isEdge&&W(i),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=re.call(this,i);Array.from(s).forEach((e=>{ne(e,this.config.classNames.hidden,!1),ne(e,this.config.classNames.tooltip,!0)}))}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch(lt){}},setMarkers(){var e,t;if(!this.duration||this.elements.markers)return;const i=null===(e=this.config.markers)||void 0===e||null===(t=e.points)||void 0===t?void 0:t.filter((({time:e})=>e>0&&e<this.duration));if(null==i||!i.length)return;const s=document.createDocumentFragment(),n=document.createDocumentFragment();let a=null;const l=`${this.config.classNames.tooltip}--visible`,r=e=>ne(a,l,e);i.forEach((e=>{const t=J("span",{class:this.config.classNames.marker},""),i=e.time/this.duration*100+"%";a&&(t.addEventListener("mouseenter",(()=>{e.label||(a.style.left=i,a.innerHTML=e.label,r(!0))})),t.addEventListener("mouseleave",(()=>{r(!1)}))),t.addEventListener("click",(()=>{this.currentTime=e.time})),t.style.left=i,n.appendChild(t)})),s.appendChild(n),this.config.tooltips.seek||(a=J("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:n,tip:a},this.elements.progress.appendChild(s)}};function We(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch(e){return null}}function ze(e){const t=new URLSearchParams;return B.object(e)&&Object.entries(e).forEach((([e,i])=>{t.set(e,i)})),t}const Ke={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!he.textTracks)return void(B.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Ue.setCaptionsMenu.call(this));if(B.element(this.elements.captions)||(this.elements.captions=J("div",ie(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),function(e,t){B.element(e)&&B.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)}(this.elements.captions,this.elements.wrapper)),z.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach((e=>{const t=e.getAttribute("src"),i=We(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&Re(t,"blob").then((t=>{e.setAttribute("src",window.URL.createObjectURL(t))})).catch((()=>{Z(e)}))}))}const e=ke((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((e=>e.split("-")[0])));let t=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();"auto"===t&&([t]=e);let i=this.storage.get("captions");if(B.boolean(i)||({active:i}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:i,language:t,languages:e}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";pe.call(this,this.media.textTracks,e,Ke.update.bind(this))}setTimeout(Ke.update.bind(this),0)},update(){const e=Ke.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find((e=>e.language===i)));this.isHTML5&&this.isVideo&&e.filter((e=>!s.get(e))).forEach((e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),pe.call(this,e,"cuechange",(()=>Ke.updateCues.call(this)))})),(a&&this.language!==i||!e.includes(n))&&(Ke.setLanguage.call(this,i),Ke.toggle.call(this,t&&a)),this.elements&&ne(this.elements.container,this.config.classNames.captions.enabled,!B.empty(e)),B.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Ue.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=B.nullOrUndefined(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=Ke.getTracks.call(this),t=Ke.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void Ke.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),ne(this.elements.container,s,n),this.captions.toggled=n,Ue.updateSetting.call(this,"captions"),ye.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout((()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")}))},set(e,t=!0){const i=Ke.getTracks.call(this);if(-1!==e)if(B.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,Ue.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),ye.call(this,this.media,"languagechange")}Ke.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&Ke.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else Ke.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!B.string(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=Ke.getTracks.call(this),n=Ke.findTrack.call(this,[i]);Ke.set.call(this,s.indexOf(n),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter((t=>!this.isHTML5||e||this.captions.meta.has(t))).filter((e=>["captions","subtitles"].includes(e.kind)))},findTrack(e,t=!1){const i=Ke.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort(((e,t)=>s(t)-s(e)));let a;return e.every((e=>(a=n.find((t=>t.language===e)),!a))),a||(t?n[0]:void 0)},getCurrentTrack(){return Ke.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!B.track(t)&&he.textTracks&&this.captions.toggled&&(t=Ke.getCurrentTrack.call(this)),B.track(t)?B.empty(t.label)?B.empty(t.language)?qe.get("enabled",this.config):e.language.toUpperCase():t.label:qe.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!B.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!B.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=Ke.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map((e=>e.getCueAsHTML())).map(je)}const i=t.map((e=>e.trim())).join("\n");if(i!==this.elements.captions.innerHTML){ee(this.elements.captions);const e=J("span",ie(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),ye.call(this,this.media,"cuechange")}}},Ye={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},Qe="picture-in-picture",Xe="inline",Je={html5:"html5",youtube:"youtube",vimeo:"vimeo"},Ge="audio",Ze="video";const et=()=>{};class tt{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):et}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):et}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):et}}class it{constructor(e){m(this,"onChange",(()=>{if(!this.supported)return;const e=this.player.elements.buttons.fullscreen;B.element(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;ye.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)})),m(this,"toggleFallback",((e=!1)=>{var t,i;if(e?this.scrollPosition={x:null!==(t=window.scrollX)&&void 0!==t?t:0,y:null!==(i=window.scrollY)&&void 0!==i?i:0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",ne(this.target,this.player.config.classNames.fullscreen.fallback,e),z.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=B.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter((e=>e.trim()!==i)).join(","))}this.onChange()})),m(this,"trapFocus",(e=>{if(z.isIos||z.isIPadOS||!this.active||"Tab"!==e.key)return;const t=document.activeElement,i=re.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())})),m(this,"update",(()=>{if(this.supported){let e;e=this.forceFallback?"Fallback (forced)":it.nativeSupported?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");ne(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)})),m(this,"enter",(()=>{this.supported&&(z.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!it.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?B.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))})),m(this,"exit",(()=>{if(this.supported)if(z.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),we(this.player.play());else if(!it.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!B.empty(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)})),m(this,"toggle",(()=>{this.active?this.exit():this.enter()})),this.player=e,this.prefix=it.prefix,this.property=it.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===e.config.fullscreen.fallback,this.player.elements.fullscreen=e.config.fullscreen.container&&function(e,t){const{prototype:i}=Element;return(i.closest||function(){let e=this;do{if(le.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}(this.player.elements.container,e.config.fullscreen.container),pe.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,(()=>{this.onChange()})),pe.call(this.player,this.player.elements.container,"dblclick",(e=>{B.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,"fullscreen")})),pe.call(this,this.player.elements.container,"keydown",(e=>this.trapFocus(e))),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return it.nativeSupported&&!this.forceFallback}static get prefix(){if(B.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some((t=>!(!B.function(document[`${t}ExitFullscreen`])&&!B.function(document[`${t}CancelFullScreen`])||(e=t,0)))),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,it.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||it.nativeSupported||!z.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!it.nativeSupported||this.forceFallback)return ae(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){var e;return z.isIos&&this.player.config.fullscreen.iosNative?this.player.media:null!==(e=this.player.elements.fullscreen)&&void 0!==e?e:this.player.elements.container}}function st(e,t=1){return new Promise(((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})}))}const nt={addStyleHook(){ne(this.elements.container,this.config.selectors.container.replace(".",""),!0),ne(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void nt.toggleNativeControls.call(this,!0);B.element(this.elements.controls)||(Ue.inject.call(this),this.listeners.controls()),nt.toggleNativeControls.call(this),this.isHTML5&&Ke.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,Ue.updateVolume.call(this),Ue.timeUpdate.call(this),Ue.durationUpdate.call(this),nt.checkPlaying.call(this),ne(this.elements.container,this.config.classNames.pip.supported,he.pip&&this.isHTML5&&this.isVideo),ne(this.elements.container,this.config.classNames.airplay.supported,he.airplay&&this.isHTML5),ne(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((()=>{ye.call(this,this.media,"ready")}),0),nt.setTitle.call(this),this.poster&&nt.setPoster.call(this,this.poster,!1).catch((()=>{})),this.config.duration&&Ue.durationUpdate.call(this),this.config.mediaMetadata&&Ue.setMediaMetadata.call(this)},setTitle(){let e=qe.get("play",this.config);if(B.string(this.config.title)&&!B.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach((t=>{t.setAttribute("aria-label",e)})),this.isEmbed){const e=oe.call(this,"iframe");if(!B.element(e))return;const t=B.empty(this.config.title)?"video":this.config.title,i=qe.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){ne(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),ve.call(this).then((()=>st(e))).catch((t=>{throw e===this.poster&&nt.togglePoster.call(this,!1),t})).then((()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),nt.togglePoster.call(this,!0),e))))},checkPlaying(e){ne(this.elements.container,this.config.classNames.playing,this.playing),ne(this.elements.container,this.config.classNames.paused,this.paused),ne(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",qe.get(this.playing?"pause":"play",this.config))})),B.event(e)&&"timeupdate"===e.type||nt.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((()=>{ne(this.elements.container,this.config.classNames.loading,this.loading),nt.toggleControls.call(this)}),this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values(s({},this.media.style)).filter((e=>!B.empty(e)&&B.string(e)&&e.startsWith("--plyr"))).forEach((e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)})),B.empty(this.media.style)&&this.media.removeAttribute("style")}};class at{constructor(e){m(this,"firstTouch",(()=>{const{player:e}=this,{elements:t}=e;e.touch=!0,ne(t.container,e.config.classNames.isTouch,!0)})),m(this,"global",((e=!0)=>{const{player:t}=this;t.config.keyboard.global&&me.call(t,window,"keydown keyup",this.handleKey,e,!1),me.call(t,document.body,"click",this.toggleMenu,e),fe.call(t,document.body,"touchstart",this.firstTouch)})),m(this,"container",(()=>{const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&pe.call(e,i.container,"keydown keyup",this.handleKey,!1),pe.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(nt.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout((()=>nt.toggleControls.call(e,!1)),a)}));const n=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;const t=i.wrapper,{active:s}=e.fullscreen,[n,a]=Pe.call(e),l=Ce(`aspect-ratio: ${n} / ${a}`);if(!s)return void(l?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null));const[r,o]=[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)],c=r/o>n/a;l?(t.style.width=c?"auto":"100%",t.style.height=c?"100%":"auto"):(t.style.maxWidth=c?o/a*n+"px":null,t.style.margin=c?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};pe.call(e,i.container,"enterfullscreen exitfullscreen",(t=>{const{target:s}=e.fullscreen;s===i.container&&(!e.isEmbed&&B.empty(e.config.ratio)||(n(),("enterfullscreen"===t.type?pe:ge).call(e,window,"resize",a)))}))})),m(this,"media",(()=>{const{player:e}=this,{elements:t}=e;if(pe.call(e,e.media,"timeupdate seeking seeked",(t=>Ue.timeUpdate.call(e,t))),pe.call(e,e.media,"durationchange loadeddata loadedmetadata",(t=>Ue.durationUpdate.call(e,t))),pe.call(e,e.media,"ended",(()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())})),pe.call(e,e.media,"progress playing seeking seeked",(t=>Ue.updateProgress.call(e,t))),pe.call(e,e.media,"volumechange",(t=>Ue.updateVolume.call(e,t))),pe.call(e,e.media,"playing play pause ended emptied timeupdate",(t=>nt.checkPlaying.call(e,t))),pe.call(e,e.media,"waiting canplay seeked playing",(t=>nt.checkLoading.call(e,t))),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=oe.call(e,`.${e.config.classNames.video}`);if(!B.element(i))return;pe.call(e,t.container,"click",(s=>{([t.container,i].includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,(()=>{we(e.play())}),"play")):this.proxy(s,(()=>{we(e.togglePlay())}),"play")))}))}e.supported.ui&&e.config.disableContextMenu&&pe.call(e,t.wrapper,"contextmenu",(e=>{e.preventDefault()}),!1),pe.call(e,e.media,"volumechange",(()=>{e.storage.set({volume:e.volume,muted:e.muted})})),pe.call(e,e.media,"ratechange",(()=>{Ue.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})})),pe.call(e,e.media,"qualitychange",(t=>{Ue.updateSetting.call(e,"quality",null,t.detail.quality)})),pe.call(e,e.media,"ready qualitychange",(()=>{Ue.setDownloadUrl.call(e)}));const i=e.config.events.concat(["keyup","keydown"]).join(" ");pe.call(e,e.media,i,(i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),ye.call(e,t.container,i.type,!0,s)}))})),m(this,"proxy",((e,t,i)=>{const{player:s}=this,n=s.config.listeners[i];let a=!0;B.function(n)&&(a=n.call(s,e)),!1!==a&&B.function(t)&&t.call(s,e)})),m(this,"bind",((e,t,i,s,n=!0)=>{const{player:a}=this,l=a.config.listeners[s],r=B.function(l);pe.call(a,e,t,(e=>this.proxy(e,i,s)),n&&!r)})),m(this,"controls",(()=>{const{player:e}=this,{elements:t}=e,i=z.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach((t=>{this.bind(t,"click",(()=>{we(e.togglePlay())}),"play")})),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",(()=>{e.lastSeekTime=Date.now(),e.rewind()}),"rewind"),this.bind(t.buttons.fastForward,"click",(()=>{e.lastSeekTime=Date.now(),e.forward()}),"fastForward"),this.bind(t.buttons.mute,"click",(()=>{e.muted=!e.muted}),"mute"),this.bind(t.buttons.captions,"click",(()=>e.toggleCaptions())),this.bind(t.buttons.download,"click",(()=>{ye.call(e,e.media,"download")}),"download"),this.bind(t.buttons.fullscreen,"click",(()=>{e.fullscreen.toggle()}),"fullscreen"),this.bind(t.buttons.pip,"click",(()=>{e.pip="toggle"}),"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",(t=>{t.stopPropagation(),t.preventDefault(),Ue.toggleMenu.call(e,t)}),null,!1),this.bind(t.buttons.settings,"keyup",(t=>{[" ","Enter"].includes(t.key)&&("Enter"!==t.key?(t.preventDefault(),t.stopPropagation(),Ue.toggleMenu.call(e,t)):Ue.focusFirstMenuItem.call(e,null,!0))}),null,!1),this.bind(t.settings.menu,"keydown",(t=>{"Escape"===t.key&&Ue.toggleMenu.call(e,t)})),this.bind(t.inputs.seek,"mousedown mousemove",(e=>{const i=t.progress.getBoundingClientRect(),s=100/i.width*(e.pageX-i.left);e.currentTarget.setAttribute("seek-value",s)})),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(t=>{const i=t.currentTarget,s="play-on-seeked";if(B.keyboardEvent(t)&&!["ArrowLeft","ArrowRight"].includes(t.key))return;e.lastSeekTime=Date.now();const n=i.hasAttribute(s),a=["mouseup","touchend","keyup"].includes(t.type);n&&a?(i.removeAttribute(s),we(e.play())):!a&&e.playing&&(i.setAttribute(s,""),e.pause())})),z.isIos){const t=re.call(e,'input[type="range"]');Array.from(t).forEach((e=>this.bind(e,i,(e=>W(e.target)))))}this.bind(t.inputs.seek,i,(t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");B.empty(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration}),"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",(t=>Ue.updateSeekTooltip.call(e,t))),this.bind(t.progress,"mousemove touchmove",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)})),this.bind(t.progress,"mouseleave touchend click",(()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)})),this.bind(t.progress,"mousedown touchstart",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)})),this.bind(t.progress,"mouseup touchend",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)})),z.isWebKit&&Array.from(re.call(e,'input[type="range"]')).forEach((t=>{this.bind(t,"input",(t=>Ue.updateRangeFill.call(e,t.target)))})),e.config.toggleInvert&&!B.element(t.display.duration)&&this.bind(t.display.currentTime,"click",(()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,Ue.timeUpdate.call(e))})),this.bind(t.inputs.volume,i,(t=>{e.volume=t.target.value}),"volume"),this.bind(t.controls,"mouseenter mouseleave",(i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type})),t.fullscreen&&Array.from(t.fullscreen.children).filter((e=>!e.contains(t.container))).forEach((i=>{this.bind(i,"mouseenter mouseleave",(i=>{t.controls&&(t.controls.hover=!e.touch&&"mouseenter"===i.type)}))})),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",(e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(t.controls,"focusin",(()=>{const{config:i,timers:s}=e;ne(t.controls,i.classNames.noTransition,!0),nt.toggleControls.call(e,!0),setTimeout((()=>{ne(t.controls,i.classNames.noTransition,!1)}),0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((()=>nt.toggleControls.call(e,!1)),n)})),this.bind(t.inputs.volume,"wheel",(t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map((e=>i?-e:e)),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:l}=e.media;(1===a&&l<1||-1===a&&l>0)&&t.preventDefault()}),"volume",!1)})),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:i}=t,{key:s,type:n,altKey:a,ctrlKey:l,metaKey:r,shiftKey:o}=e,c="keydown"===n,u=c&&s===this.lastKey;var h;if(!(a||l||r||o)&&s)if(c){const n=document.activeElement;if(B.element(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&le(n,s))return;if(" "===e.key&&le(n,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(s)&&(e.preventDefault(),e.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(h=parseInt(s,10),t.currentTime=t.duration/10*h);break;case" ":case"k":u||we(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":u||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":u||t.toggleCaptions();break;case"l":t.loop=!t.loop}"Escape"===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null}toggleMenu(e){Ue.toggleMenu.call(this.player,e)}}var lt,rt,ot=(lt=function(e,t){e.exports=function(){var e=function(){},t={},i={},s={};function n(e,t){if(e){var n=s[e];if(i[e]=t,n)for(;n.length;)n[0](e,t),n.splice(0,1)}}function a(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function l(t,i,s,n){var a,r,o=document,c=s.async,u=(s.numRetries||0)+1,h=s.before||e,d=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");n=n||0,/(^css!|\.css$)/.test(d)?((r=o.createElement("link")).rel="stylesheet",r.href=m,(a="hideFocus"in r)&&r.relList&&(a=0,r.rel="preload",r.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d)?(r=o.createElement("img")).src=m:((r=o.createElement("script")).src=t,r.async=void 0===c||c),r.onload=r.onerror=r.onbeforeload=function(e){var o=e.type[0];if(a)try{r.sheet.cssText.length||(o="e")}catch(e){18!=e.code&&(o="e")}if("e"==o){if((n+=1)<u)return l(t,i,s,n)}else if("preload"==r.rel&&"style"==r.as)return r.rel="stylesheet";i(t,o,e.defaultPrevented)},!1!==h(t,r)&&o.head.appendChild(r)}function r(e,t,i){var s,n,a=(e=e.push?e:[e]).length,r=a,o=[];for(s=function(e,i,s){if("e"==i&&o.push(e),"b"==i){if(!s)return;o.push(e)}--a||t(o)},n=0;n<r;n++)l(e[n],s,i)}function o(e,i,s){var l,o;if(i&&i.trim&&(l=i),o=(l?s:i)||{},l){if(l in t)throw"LoadJS";t[l]=!0}function c(t,i){r(e,(function(e){a(o,e),t&&a({success:t,error:i},e),n(l,e)}),o)}if(o.returnPromise)return new Promise(c);c()}return o.ready=function(e,t){return function(e,t){e=e.push?e:[e];var n,a,l,r=[],o=e.length,c=o;for(n=function(e,i){i.length&&r.push(e),--c||t(r)};o--;)a=e[o],(l=i[a])?n(a,l):(s[a]=s[a]||[]).push(n)}(e,(function(e){a(t,e)})),o},o.done=function(e){n(e,[])},o.reset=function(){t={},i={},s={}},o.isDefined=function(e){return e in t},o}()},lt(rt={exports:{}},rt.exports),rt.exports);function ct(e){return new Promise(((t,i)=>{ot(e,{success:t,error:i})}))}function ut(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,ye.call(this,this.media,e?"play":"pause"))}const ht={setup(){const e=this;ne(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,xe.call(e),B.object(window.Vimeo)?ht.ready.call(e):ct(e.config.urls.vimeo.sdk).then((()=>{ht.ready.call(e)})).catch((t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready(){const i=this,n=i.config.vimeo,{premium:a,referrerPolicy:l}=n,r=t(n,e);let o=i.media.getAttribute("src"),c="";B.empty(o)?(o=i.media.getAttribute(i.config.attributes.embed.id),c=i.media.getAttribute(i.config.attributes.embed.hash)):c=function(e){const t=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return t&&5===t.length?t[4]:null}(o);const u=c?{h:c}:{};a&&Object.assign(r,{controls:!1,sidedock:!1});const h=ze(s(s({loop:i.config.loop.active,autoplay:i.autoplay,muted:i.muted,gesture:"media",playsinline:i.config.playsinline},u),r)),d=function(e){return B.empty(e)?null:B.number(Number(e))?e:e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}(o),m=J("iframe"),p=Le(i.config.urls.vimeo.iframe,d,h);if(m.setAttribute("src",p),m.setAttribute("allowfullscreen",""),m.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),B.empty(l)||m.setAttribute("referrerPolicy",l),a||!n.customControls)m.setAttribute("data-poster",i.poster),i.media=te(m,i.media);else{const e=J("div",{class:i.config.classNames.embedContainer,"data-poster":i.poster});e.appendChild(m),i.media=te(e,i.media)}n.customControls||Re(Le(i.config.urls.vimeo.api,p)).then((e=>{!B.empty(e)&&e.thumbnail_url&&nt.setPoster.call(i,e.thumbnail_url).catch((()=>{}))})),i.embed=new window.Vimeo.Player(m,{autopause:i.config.autopause,muted:i.muted}),i.media.paused=!0,i.media.currentTime=0,i.supported.ui&&i.embed.disableTextTrack(),i.media.play=()=>(ut.call(i,!0),i.embed.play()),i.media.pause=()=>(ut.call(i,!1),i.embed.pause()),i.media.stop=()=>{i.pause(),i.currentTime=0};let{currentTime:g}=i.media;Object.defineProperty(i.media,"currentTime",{get:()=>g,set(e){const{embed:t,media:s,paused:n,volume:a}=i,l=n&&!t.hasPlayed;s.seeking=!0,ye.call(i,s,"seeking"),Promise.resolve(l&&t.setVolume(0)).then((()=>t.setCurrentTime(e))).then((()=>l&&t.pause())).then((()=>l&&t.setVolume(a))).catch((()=>{}))}});let f=i.config.speed.selected;Object.defineProperty(i.media,"playbackRate",{get:()=>f,set(e){i.embed.setPlaybackRate(e).then((()=>{f=e,ye.call(i,i.media,"ratechange")})).catch((()=>{i.options.speed=[1]}))}});let{volume:y}=i.config;Object.defineProperty(i.media,"volume",{get:()=>y,set(e){i.embed.setVolume(e).then((()=>{y=e,ye.call(i,i.media,"volumechange")}))}});let{muted:b}=i.config;Object.defineProperty(i.media,"muted",{get:()=>b,set(e){const t=!!B.boolean(e)&&e;i.embed.setMuted(!!t||i.config.muted).then((()=>{b=t,ye.call(i,i.media,"volumechange")}))}});let v,{loop:w}=i.config;Object.defineProperty(i.media,"loop",{get:()=>w,set(e){const t=B.boolean(e)?e:i.config.loop.active;i.embed.setLoop(t).then((()=>{w=t}))}}),i.embed.getVideoUrl().then((e=>{v=e,Ue.setDownloadUrl.call(i)})).catch((e=>{this.debug.warn(e)})),Object.defineProperty(i.media,"currentSrc",{get:()=>v}),Object.defineProperty(i.media,"ended",{get:()=>i.currentTime===i.duration}),Promise.all([i.embed.getVideoWidth(),i.embed.getVideoHeight()]).then((e=>{const[t,s]=e;i.embed.ratio=Me(t,s),xe.call(this)})),i.embed.setAutopause(i.config.autopause).then((e=>{i.config.autopause=e})),i.embed.getVideoTitle().then((e=>{i.config.title=e,nt.setTitle.call(this)})),i.embed.getCurrentTime().then((e=>{g=e,ye.call(i,i.media,"timeupdate")})),i.embed.getDuration().then((e=>{i.media.duration=e,ye.call(i,i.media,"durationchange")})),i.embed.getTextTracks().then((e=>{i.media.textTracks=e,Ke.setup.call(i)})),i.embed.on("cuechange",(({cues:e=[]})=>{const t=e.map((e=>function(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)));Ke.updateCues.call(i,t)})),i.embed.on("loaded",(()=>{i.embed.getPaused().then((e=>{ut.call(i,!e),e||ye.call(i,i.media,"playing")})),B.element(i.embed.element)&&i.supported.ui&&i.embed.element.setAttribute("tabindex",-1)})),i.embed.on("bufferstart",(()=>{ye.call(i,i.media,"waiting")})),i.embed.on("bufferend",(()=>{ye.call(i,i.media,"playing")})),i.embed.on("play",(()=>{ut.call(i,!0),ye.call(i,i.media,"playing")})),i.embed.on("pause",(()=>{ut.call(i,!1)})),i.embed.on("timeupdate",(e=>{i.media.seeking=!1,g=e.seconds,ye.call(i,i.media,"timeupdate")})),i.embed.on("progress",(e=>{i.media.buffered=e.percent,ye.call(i,i.media,"progress"),1===parseInt(e.percent,10)&&ye.call(i,i.media,"canplaythrough"),i.embed.getDuration().then((e=>{e!==i.media.duration&&(i.media.duration=e,ye.call(i,i.media,"durationchange"))}))})),i.embed.on("seeked",(()=>{i.media.seeking=!1,ye.call(i,i.media,"seeked")})),i.embed.on("ended",(()=>{i.media.paused=!0,ye.call(i,i.media,"ended")})),i.embed.on("error",(e=>{i.media.error=e,ye.call(i,i.media,"error")})),n.customControls&&setTimeout((()=>nt.build.call(i)),0)}};function dt(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,ye.call(this,this.media,e?"play":"pause"))}function mt(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const pt={setup(){if(ne(this.elements.wrapper,this.config.classNames.embed,!0),B.object(window.YT)&&B.function(window.YT.Player))pt.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{B.function(e)&&e(),pt.ready.call(this)},ct(this.config.urls.youtube.sdk).catch((e=>{this.debug.warn("YouTube API failed to load",e)}))}},getTitle(e){Re(Le(this.config.urls.youtube.api,e)).then((e=>{if(B.object(e)){const{title:t,height:i,width:s}=e;this.config.title=t,nt.setTitle.call(this),this.embed.ratio=Me(s,i)}xe.call(this)})).catch((()=>{xe.call(this)}))},ready(){const e=this,t=e.config.youtube,i=e.media&&e.media.getAttribute("id");if(!B.empty(i)&&i.startsWith("youtube-"))return;let s=e.media.getAttribute("src");B.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const n=function(e){return B.empty(e)?null:e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:e}(s),a=J("div",{id:_e(e.provider),"data-poster":t.customControls?e.poster:void 0});if(e.media=te(a,e.media),t.customControls){const t=e=>`https://i.ytimg.com/vi/${n}/${e}default.jpg`;st(t("maxres"),121).catch((()=>st(t("sd"),121))).catch((()=>st(t("hq")))).then((t=>nt.setPoster.call(e,t.src))).then((t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((()=>{}))}e.embed=new window.YT.Player(e.media,{videoId:n,host:mt(t),playerVars:Y({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){const i=t.data,s={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occurred";e.media.error={code:i,message:s},ye.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),ye.call(e,e.media,"ratechange")},onReady(i){if(B.function(e.media.play))return;const s=i.target;pt.getTitle.call(e,n),e.media.play=()=>{dt.call(e,!0),s.playVideo()},e.media.pause=()=>{dt.call(e,!1),s.pauseVideo()},e.media.stop=()=>{s.stopVideo()},e.media.duration=s.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(s.getCurrentTime()),set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,ye.call(e,e.media,"seeking"),s.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>s.getPlaybackRate(),set(e){s.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,"volume",{get:()=>a,set(t){a=t,s.setVolume(100*a),ye.call(e,e.media,"volumechange")}});let{muted:l}=e.config;Object.defineProperty(e.media,"muted",{get:()=>l,set(t){const i=B.boolean(t)?t:l;l=i,s[i?"mute":"unMute"](),s.setVolume(100*a),ye.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>s.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const r=s.getAvailablePlaybackRates();e.options.speed=r.filter((t=>e.config.speed.options.includes(t))),e.supported.ui&&t.customControls&&e.media.setAttribute("tabindex",-1),ye.call(e,e.media,"timeupdate"),ye.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((()=>{e.media.buffered=s.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&ye.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),ye.call(e,e.media,"canplaythrough"))}),200),t.customControls&&setTimeout((()=>nt.build.call(e)),50)},onStateChange(i){const s=i.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(i.data)&&(e.media.seeking=!1,ye.call(e,e.media,"seeked")),i.data){case-1:ye.call(e,e.media,"timeupdate"),e.media.buffered=s.getVideoLoadedFraction(),ye.call(e,e.media,"progress");break;case 0:dt.call(e,!1),e.media.loop?(s.stopVideo(),s.playVideo()):ye.call(e,e.media,"ended");break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(dt.call(e,!0),ye.call(e,e.media,"playing"),e.timers.playing=setInterval((()=>{ye.call(e,e.media,"timeupdate")}),50),e.media.duration!==s.getDuration()&&(e.media.duration=s.getDuration(),ye.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),dt.call(e,!1);break;case 3:ye.call(e,e.media,"waiting")}ye.call(e,e.elements.container,"statechange",!1,{code:i.data})}}})}},gt={setup(){this.media?(ne(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),ne(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&ne(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=J("div",{class:this.config.classNames.video}),Q(this.media,this.elements.wrapper),this.elements.poster=J("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ne.setup.call(this):this.isYouTube?pt.setup.call(this):this.isVimeo&&ht.setup.call(this)):this.debug.warn("No media element found!")}};class ft{constructor(e){m(this,"load",(()=>{this.enabled&&(B.object(window.google)&&B.object(window.google.ima)?this.ready():ct(this.player.config.urls.googleIMA.sdk).then((()=>{this.ready()})).catch((()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))})))})),m(this,"ready",(()=>{var e;this.enabled||((e=this).manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((()=>{this.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()})),m(this,"setupIMA",(()=>{this.elements.container=J("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(e=>this.onAdsManagerLoaded(e)),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e)),!1),this.requestAds()})),m(this,"requestAds",(()=>{const{container:e}=this.player.elements;try{const t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}})),m(this,"pollCountdown",((e=!1)=>{if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval((()=>{const e=Be(Math.max(this.manager.getRemainingTime(),0)),t=`${qe.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)}),100)})),m(this,"onAdsManagerLoaded",(e=>{if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e))),Object.keys(google.ima.AdEvent.Type).forEach((e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],(e=>this.onAdEvent(e)))})),this.trigger("loaded")})),m(this,"addCuePoints",(()=>{B.empty(this.cuePoints)||this.cuePoints.forEach((e=>{if(0!==e&&-1!==e&&e<this.player.duration){const t=this.player.elements.progress;if(B.element(t)){const i=100/this.player.duration*e,s=J("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,t.appendChild(s)}}}))})),m(this,"onAdEvent",(e=>{const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData();switch((e=>{ye.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}})),m(this,"onAdError",(e=>{this.cancel(),this.player.debug.warn("Ads error",e)})),m(this,"listeners",(()=>{const{container:e}=this.player.elements;let t;this.player.on("canplay",(()=>{this.addCuePoints()})),this.player.on("ended",(()=>{this.loader.contentComplete()})),this.player.on("timeupdate",(()=>{t=this.player.currentTime})),this.player.on("seeked",(()=>{const e=this.player.currentTime;B.empty(this.cuePoints)||this.cuePoints.forEach(((i,s)=>{t<i&&i<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(s,1))}))})),window.addEventListener("resize",(()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)}))})),m(this,"play",(()=>{const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then((()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}})).catch((()=>{}))})),m(this,"resumeContent",(()=>{this.elements.container.style.zIndex="",this.playing=!1,we(this.player.media.play())})),m(this,"pauseContent",(()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()})),m(this,"cancel",(()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()})),m(this,"loadAds",(()=>{this.managerPromise.then((()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise((e=>{this.on("loaded",e),this.player.debug.log(this.manager)})),this.initialized=!1,this.requestAds()})).catch((()=>{}))})),m(this,"trigger",((e,...t)=>{const i=this.events[e];B.array(i)&&i.forEach((e=>{B.function(e)&&e.apply(this,t)}))})),m(this,"on",((e,t)=>(B.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this))),m(this,"startSafetyTimer",((e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout((()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")}),e)})),m(this,"clearSafetyTimer",(e=>{B.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)})),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise(((e,t)=>{this.on("loaded",e),this.on("error",t)})),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!B.empty(e.publisherId)||B.url(e.tagUrl))}get tagUrl(){const{config:e}=this;return B.url(e.tagUrl)?e.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${ze({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function yt(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}const bt=e=>{const t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e=>{const i={};e.split(/\r\n|\n|\r/).forEach((e=>{if(B.number(i.startTime)){if(!B.empty(e.trim())&&B.empty(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}})),i.text&&t.push(i)})),t},vt=(e,t)=>{const i={};return e>t.width/t.height?(i.width=t.width,i.height=1/e*t.width):(i.height=t.height,i.width=e*t.height),i};class wt{constructor(e){m(this,"load",(()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)}))})),m(this,"getThumbnails",(()=>new Promise((e=>{const{src:t}=this.player.config.previewThumbnails;if(B.empty(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort(((e,t)=>e.height-t.height)),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(B.function(t))t((e=>{this.thumbnails=e,i()}));else{const e=(B.string(t)?[t]:t).map((e=>this.getThumbnail(e)));Promise.all(e).then(i)}})))),m(this,"getThumbnail",(e=>new Promise((t=>{Re(e).then((i=>{const s={frames:bt(i),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||s.frames[0].text.startsWith("http://")||s.frames[0].text.startsWith("https://")||(s.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text}))})))),m(this,"startMove",(e=>{if(this.loaded&&B.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t,i;const s=this.player.elements.progress.getBoundingClientRect(),n=100/s.width*(e.pageX-s.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=Be(this.seekTime);const a=null===(t=this.player.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(this.seekTime)));a&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${a.label}<br>`)}this.showImageAtCurrentTime()}})),m(this,"endMove",(()=>{this.toggleThumbContainer(!1,!0)})),m(this,"startScrubbing",(e=>{(B.nullOrUndefined(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))})),m(this,"endScrubbing",(()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):fe.call(this.player,this.player.media,"timeupdate",(()=>{this.mouseDown||this.toggleScrubbingContainer(!1)}))})),m(this,"listeners",(()=>{this.player.on("play",(()=>{this.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(()=>{this.toggleThumbContainer(!1)})),this.player.on("timeupdate",(()=>{this.lastTime=this.player.media.currentTime}))})),m(this,"render",(()=>{this.elements.thumb.container=J("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=J("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=J("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=J("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),B.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=J("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)})),m(this,"destroy",(()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()})),m(this,"showImageAtCurrentTime",(()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex((e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime)),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach(((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)})),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))})),m(this,"loadImage",((e=0)=>{const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,l=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=l,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${l}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}})),m(this,"showImage",((e,t,i,s,n,a=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))})),m(this,"removeOldImages",(e=>{Array.from(this.currentImageContainer.children).forEach((t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout((()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)}),i)}}))})),m(this,"preloadNearby",((e,t=!0)=>new Promise((i=>{setTimeout((()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach((e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}})),a||i()}}),300)})))),m(this,"getHigherQuality",((e,t,i,s)=>{if(e<this.thumbnails.length-1){let n=t.naturalHeight;this.usingSprites&&(n=i.h),n<this.thumbContainerHeight&&setTimeout((()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))}),300)}})),m(this,"toggleThumbContainer",((e=!1,t=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)})),m(this,"toggleScrubbingContainer",((e=!1)=>{const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)})),m(this,"determineContainerAutoSizing",(()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)})),m(this,"setThumbContainerSizeAndPos",(()=>{const{imageContainer:e}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(e.clientHeight>20&&e.clientWidth<20){const t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){const t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}this.setThumbContainerPos()})),m(this,"setThumbContainerPos",(()=>{const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2,l=yt(a,s,n);i.style.left=`${l}px`,i.style.setProperty("--preview-arrow-offset",a-l+"px")})),m(this,"setScrubbingContainerSize",(()=>{const{width:e,height:t}=vt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`})),m(this,"setImageSizeAndOffset",((e,t)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`})),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=vt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const kt={insertElements(e,t){B.string(t)?G(e,this.media,{src:t}):B.array(t)&&t.forEach((t=>{G(e,this.media,t)}))},change(e){K(e,"sources.length")?(Ne.cancelRequests.call(this),this.destroy.call(this,(()=>{this.options.quality=[],Z(this.media),this.media=null,B.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=Je.html5,src:n}]=t,a="html5"===s?i:"div",l="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:he.check(i,s,this.config.playsinline),media:J(a,l)}),this.elements.container.appendChild(this.media),B.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),B.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),nt.addStyleHook.call(this),this.isHTML5&&kt.insertElements.call(this,"source",t),this.config.title=e.title,gt.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&kt.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&nt.build.call(this),this.isHTML5&&this.media.load(),B.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new wt(this))),this.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};class Tt{constructor(e,t){if(m(this,"play",(()=>B.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((()=>this.ads.play())).catch((()=>we(this.media.play()))),this.media.play()):null)),m(this,"pause",(()=>this.playing&&B.function(this.media.pause)?this.media.pause():null)),m(this,"togglePlay",(e=>(B.boolean(e)?e:!this.playing)?this.play():this.pause())),m(this,"stop",(()=>{this.isHTML5?(this.pause(),this.restart()):B.function(this.media.stop)&&this.media.stop()})),m(this,"restart",(()=>{this.currentTime=0})),m(this,"rewind",(e=>{this.currentTime-=B.number(e)?e:this.config.seekTime})),m(this,"forward",(e=>{this.currentTime+=B.number(e)?e:this.config.seekTime})),m(this,"increaseVolume",(e=>{const t=this.media.muted?0:this.volume;this.volume=t+(B.number(e)?e:0)})),m(this,"decreaseVolume",(e=>{this.increaseVolume(-e)})),m(this,"airplay",(()=>{he.airplay&&this.media.webkitShowPlaybackTargetPicker()})),m(this,"toggleControls",(e=>{if(this.supported.ui&&!this.isAudio){const t=ae(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,s=ne(this.elements.container,this.config.classNames.hideControls,i);if(s&&B.array(this.config.controls)&&this.config.controls.includes("settings")&&!B.empty(this.config.settings)&&Ue.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";ye.call(this,this.media,e)}return!s}return!1})),m(this,"on",((e,t)=>{pe.call(this,this.elements.container,e,t)})),m(this,"once",((e,t)=>{fe.call(this,this.elements.container,e,t)})),m(this,"off",((e,t)=>{ge(this.elements.container,e,t)})),m(this,"destroy",((e,t=!1)=>{if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&(Z(this.elements.buttons.play),Z(this.elements.captions),Z(this.elements.controls),Z(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),B.function(e)&&e()):(be.call(this),Ne.cancelRequests.call(this),te(this.elements.original,this.elements.container),ye.call(this,this.elements.original,"destroyed",!0),B.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout((()=>{this.elements=null,this.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(nt.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&B.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))})),m(this,"supports",(e=>he.mime.call(this,e))),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=he.touch,this.media=e,B.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||B.nodeList(this.media)||B.array(this.media))&&(this.media=this.media[0]),this.config=Y({},Ye,Tt.defaults,t||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch(e){return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new tt(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",he),B.nullOrUndefined(this.media)||!B.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!he.check().api)return void this.debug.error("Setup failed: no support");const i=this.media.cloneNode(!0);i.autoplay=!1,this.elements.original=i;const s=this.media.tagName.toLowerCase();let n=null,a=null;switch(s){case"div":if(n=this.media.querySelector("iframe"),B.element(n)){if(a=We(n.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?Je.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?Je.vimeo:null}(a.toString()),this.elements.container=this.media,this.media=n,this.elements.container.className="",a.search.length){const e=["1","true"];e.includes(a.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(a.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.includes(a.searchParams.get("playsinline")),this.config.youtube.hl=a.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(B.empty(this.provider)||!Object.values(Je).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=Ze;break;case"video":case"audio":this.type=s,this.provider=Je.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=he.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new at(this),this.storage=new He(this),this.media.plyr=this,B.element(this.elements.container)||(this.elements.container=J("div"),Q(this.media,this.elements.container)),nt.migrateStyles.call(this),nt.addStyleHook.call(this),gt.setup.call(this),this.config.debug&&pe.call(this,this.elements.container,this.config.events.join(" "),(e=>{this.debug.log(`event: ${e.type}`)})),this.fullscreen=new it(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&nt.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new ft(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",(()=>we(this.play()))),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new wt(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===Je.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===Je.youtube}get isVimeo(){return this.provider===Je.vimeo}get isVideo(){return this.type===Ze}get isAudio(){return this.type===Ge}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const t=B.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return B.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=B.number(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;B.string(t)&&(t=Number(t)),B.number(t)||(t=this.storage.get("volume")),B.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!B.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;B.boolean(t)||(t=this.storage.get("muted")),B.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||!!this.isAudio||Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)}set speed(e){let t=null;B.number(e)&&(t=e),B.number(t)||(t=this.storage.get("speed")),B.number(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=yt(t,i,s),this.config.speed.selected=t,setTimeout((()=>{this.media&&(this.media.playbackRate=t)}),0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!B.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(B.number),n=!0;if(!i.includes(s)){const e=Te(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=B.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){kt.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return B.url(e)?e:this.source}set download(e){B.url(e)&&(this.config.urls.download=e,Ue.setDownloadUrl.call(this))}set poster(e){this.isVideo?nt.setPoster.call(this,e,!1).catch((()=>{})):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=Ee(Pe.call(this));return B.array(e)?e.join(":"):e}set ratio(e){this.isVideo?B.string(e)&&Se(e)?(this.config.ratio=Ee(e),xe.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=B.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){Ke.toggle.call(this,e,!1)}set currentTrack(e){Ke.set.call(this,e,!1),Ke.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){Ke.setLanguage.call(this,e,!1)}get language(){return(Ke.getCurrentTrack.call(this)||{}).language}set pip(e){if(!he.pip)return;const t=B.boolean(e)?e:!this.pip;B.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Qe:Xe),B.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return he.pip?B.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Qe:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new wt(this))}static supported(e,t){return he.check(e,t)}static loadSprite(e,t){return Fe(e,t)}static setup(e,t={}){let i=null;return B.string(e)?i=Array.from(document.querySelectorAll(e)):B.nodeList(e)?i=Array.from(e):B.array(e)&&(i=e.filter(B.element)),B.empty(i)?null:i.map((e=>new Tt(e,t)))}}Tt.defaults=function(e){return JSON.parse(JSON.stringify(e))}(Ye);i("M",a({name:"m-video",props:{setting:{type:Object,default:()=>({})},controls:Boolean,height:String,src:{type:String,default:""},poster:{type:String,default:""},styleValue:{type:Object,default:()=>({})},preload:{type:String,default:"auto"},currentTime:{type:Boolean,default:!0},playsinline:{type:Boolean,default:!0},preLoading:{type:Boolean,default:!0}},emits:["exitfullscreen","play","ready","enterfullscreen"],data:()=>({player:null,loading:!0}),mounted(){this.loading=this.preLoading,this._init()},methods:{_init(){const e=["play-large","play","progress","captions","fullscreen"];this.currentTime&&e.push("current-time");const t=s(s({controls:e},this.setting),{},{invertTime:!1});l().iPhone&&(t.fullscreen={enabled:!0,fallback:"force",iosNative:!0}),this.player=new Tt(this.$refs.video,t),this.player.elements.container&&(this.player.elements.container.style.height=this.height||"210px"),"none"===this.preload&&(this.loading=!1),this.player.on("loadedmetadata",(()=>{this.loading=!1,this.domPlayVisibility(!1)})),this.player.on("loadeddata",(()=>{this.$emit("ready",this.player)})),this.player.on("play",(()=>{this.$emit("play",this.player)})),this.player.on("enterfullscreen",(()=>{console.log("fullscreen",this.player.elements);const e=document.createDocumentFragment(),t=document.createElement("i");t.id="fullscreen-back",t.className="van-icon van-icon-arrow-left video-back",t.addEventListener("click",(()=>{this.player.fullscreen.exit()})),console.log(document.getElementsByClassName("plyr"),t),e.appendChild(t),this.player.elements.container.appendChild(e),this.$emit("enterfullscreen")})),this.player.on("exitfullscreen",(()=>{console.log("exitfullscreen");const e=document.getElementById("fullscreen-back");e&&e.remove(),this.$emit("exitfullscreen")}))},domPlayVisibility(e=!0){const t=document.querySelector(".plyr__controls"),i=document.querySelector(".plyr__control--overlaid");e?(null==t||t.setAttribute("style","display:none"),null==i||i.setAttribute("style","display:none")):(null==t||t.removeAttribute("style"),setTimeout((()=>{null==i||i.removeAttribute("style")}),200))},onStop(){this.player.stop()},onExitScreen(){this.player.fullscreen.active&&this.player.fullscreen.exit()},onPlay(){var e;null===(e=this.player)||void 0===e||e.play()}},unmounted(){var e;null===(e=this.player)||void 0===e||e.destroy()},render(){return r("div",{class:u},[r("video",{ref:"video",class:h,src:this.src,playsinline:this.playsinline,poster:this.poster,preload:this.preload,style:s({},this.styleValue)},null),this.loading&&r("div",{class:d,style:{height:this.height||"210px"}},[r(o,{size:36,color:"#FF8057",vertical:!0,style:{height:"100%",justifyContent:"center"}},{default:()=>[c("加载中...")]})])])}}))}}}))}();
|