12 |
- var kt=Object.defineProperty,xt=Object.defineProperties;var Tt=Object.getOwnPropertyDescriptors;var le=Object.getOwnPropertySymbols;var je=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var Oe=(e,i,t)=>i in e?kt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,D=(e,i)=>{for(var t in i||(i={}))je.call(i,t)&&Oe(e,t,i[t]);if(le)for(var t of le(i))De.call(i,t)&&Oe(e,t,i[t]);return e},ce=(e,i)=>xt(e,Tt(i));var He=(e,i)=>{var t={};for(var r in e)je.call(e,r)&&i.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&le)for(var r of le(e))i.indexOf(r)<0&&De.call(e,r)&&(t[r]=e[r]);return t};import{d as Ct,c as pe}from"./index.06cf5f04.js";const At="_plyr__poster_mj75i_12",Et="_audios_mj75i_22";var Re={"video-container":"_video-container_mj75i_4",plyr__poster:At,audios:Et};function h(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function St(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function qe(e,i){for(var t=0;t<i.length;t++){var r=i[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pt(e,i,t){return i&&qe(e.prototype,i),t&&qe(e,t),e}function Mt(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function Fe(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,r)}return t}function Ve(e){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?Fe(Object(t),!0).forEach(function(r){Mt(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Fe(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var Ue={addCSS:!0,thumbWidth:15,watch:!0};function Nt(e,i){return function(){return Array.from(document.querySelectorAll(i)).includes(this)}.call(e,i)}function Lt(e,i){if(e&&i){var t=new Event(i,{bubbles:!0});e.dispatchEvent(t)}}var ne=function(e){return e!=null?e.constructor:null},Ne=function(e,i){return!!(e&&i&&e instanceof i)},Xe=function(e){return e==null},Je=function(e){return ne(e)===Object},It=function(e){return ne(e)===Number&&!Number.isNaN(e)},Ge=function(e){return ne(e)===String},$t=function(e){return ne(e)===Boolean},zt=function(e){return ne(e)===Function},Ze=function(e){return Array.isArray(e)},et=function(e){return Ne(e,NodeList)},Ot=function(e){return Ne(e,Element)},jt=function(e){return Ne(e,Event)},Dt=function(e){return Xe(e)||(Ge(e)||Ze(e)||et(e))&&!e.length||Je(e)&&!Object.keys(e).length},O={nullOrUndefined:Xe,object:Je,number:It,string:Ge,boolean:$t,function:zt,array:Ze,nodeList:et,element:Ot,event:jt,empty:Dt};function Ht(e){var i="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return i?Math.max(0,(i[1]?i[1].length:0)-(i[2]?+i[2]:0)):0}function Rt(e,i){if(1>i){var t=Ht(i);return parseFloat(e.toFixed(t))}return Math.round(e/i)*i}var qt=function(){function e(i,t){St(this,e),O.element(i)?this.element=i:O.string(i)&&(this.element=document.querySelector(i)),O.element(this.element)&&O.empty(this.element.rangeTouch)&&(this.config=Ve({},Ue,{},t),this.init())}return Pt(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(i){var t=this,r=i?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(s){t.element[r](s,function(n){return t.set(n)},!1)})}},{key:"get",value:function(i){if(!e.enabled||!O.event(i))return null;var t,r=i.target,s=i.changedTouches[0],n=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,l=parseFloat(r.getAttribute("step"))||1,c=r.getBoundingClientRect(),p=100/c.width*(this.config.thumbWidth/2)/100;return 0>(t=100/c.width*(s.clientX-c.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*p:50<t&&(t+=2*(t-50)*p),n+Rt(t/100*(o-n),l)}},{key:"set",value:function(i){e.enabled&&O.event(i)&&!i.target.disabled&&(i.preventDefault(),i.target.value=this.get(i),Lt(i.target,i.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(i){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},r=null;if(O.empty(i)||O.string(i)?r=Array.from(document.querySelectorAll(O.string(i)?i:'input[type="range"]')):O.element(i)?r=[i]:O.nodeList(i)?r=Array.from(i):O.array(i)&&(r=i.filter(O.element)),O.empty(r))return null;var s=Ve({},Ue,{},t);if(O.string(i)&&s.watch){var n=new MutationObserver(function(o){Array.from(o).forEach(function(l){Array.from(l.addedNodes).forEach(function(c){O.element(c)&&Nt(c,i)&&new e(c,s)})})});n.observe(document.body,{childList:!0,subtree:!0})}return r.map(function(o){return new e(o,t)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();const Z=e=>e!=null?e.constructor:null,V=(e,i)=>Boolean(e&&i&&e instanceof i),Le=e=>e==null,tt=e=>Z(e)===Object,Ft=e=>Z(e)===Number&&!Number.isNaN(e),fe=e=>Z(e)===String,Vt=e=>Z(e)===Boolean,it=e=>Z(e)===Function,rt=e=>Array.isArray(e),Ut=e=>V(e,WeakMap),st=e=>V(e,NodeList),Bt=e=>Z(e)===Text,Wt=e=>V(e,Event),Yt=e=>V(e,KeyboardEvent),Kt=e=>V(e,window.TextTrackCue)||V(e,window.VTTCue),Qt=e=>V(e,TextTrack)||!Le(e)&&fe(e.kind),Xt=e=>V(e,Promise)&&it(e.then),Jt=e=>e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object",nt=e=>Le(e)||(fe(e)||rt(e)||st(e))&&!e.length||tt(e)&&!Object.keys(e).length,Gt=e=>{if(V(e,window.URL))return!0;if(!fe(e))return!1;let i=e;e.startsWith("http://")&&e.startsWith("https://")||(i=`http://${e}`);try{return!nt(new URL(i).hostname)}catch{return!1}};var a={nullOrUndefined:Le,object:tt,number:Ft,string:fe,boolean:Vt,function:it,array:rt,weakMap:Ut,nodeList:st,element:Jt,textNode:Bt,event:Wt,keyboardEvent:Yt,cue:Kt,track:Qt,promise:Xt,url:Gt,empty:nt};const Te=(()=>{const e=document.createElement("span"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},t=Object.keys(i).find(r=>e.style[r]!==void 0);return!!a.string(t)&&i[t]})();function at(e,i){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch{}},i)}const z={isIE:Boolean(window.document.documentMode),isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function Zt(e){return JSON.parse(JSON.stringify(e))}function ot(e,i){return i.split(".").reduce((t,r)=>t&&t[r],e)}function N(e={},...i){if(!i.length)return e;const t=i.shift();return a.object(t)?(Object.keys(t).forEach(r=>{a.object(t[r])?(Object.keys(e).includes(r)||Object.assign(e,{[r]:{}}),N(e[r],t[r])):Object.assign(e,{[r]:t[r]})}),N(e,...i)):e}function lt(e,i){const t=e.length?e:[e];Array.from(t).reverse().forEach((r,s)=>{const n=s>0?i.cloneNode(!0):i,o=r.parentNode,l=r.nextSibling;n.appendChild(r),l?o.insertBefore(n,l):o.appendChild(n)})}function Ce(e,i){a.element(e)&&!a.empty(i)&&Object.entries(i).filter(([,t])=>!a.nullOrUndefined(t)).forEach(([t,r])=>e.setAttribute(t,r))}function f(e,i,t){const r=document.createElement(e);return a.object(i)&&Ce(r,i),a.string(t)&&(r.innerText=t),r}function ei(e,i){a.element(e)&&a.element(i)&&i.parentNode.insertBefore(e,i.nextSibling)}function Be(e,i,t,r){a.element(i)&&i.appendChild(f(e,t,r))}function F(e){a.nodeList(e)||a.array(e)?Array.from(e).forEach(F):a.element(e)&&a.element(e.parentNode)&&e.parentNode.removeChild(e)}function de(e){if(!a.element(e))return;let{length:i}=e.childNodes;for(;i>0;)e.removeChild(e.lastChild),i-=1}function me(e,i){return a.element(i)&&a.element(i.parentNode)&&a.element(e)?(i.parentNode.replaceChild(e,i),e):null}function H(e,i){if(!a.string(e)||a.empty(e))return{};const t={},r=N({},i);return e.split(",").forEach(s=>{const n=s.trim(),o=n.replace(".",""),l=n.replace(/[[\]]/g,"").split("="),[c]=l,p=l.length>1?l[1].replace(/["']/g,""):"";switch(n.charAt(0)){case".":a.string(r.class)?t.class=`${r.class} ${o}`:t.class=o;break;case"#":t.id=n.replace("#","");break;case"[":t[c]=p}}),N(r,t)}function Y(e,i){if(!a.element(e))return;let t=i;a.boolean(t)||(t=!e.hidden),e.hidden=t}function x(e,i,t){if(a.nodeList(e))return Array.from(e).map(r=>x(r,i,t));if(a.element(e)){let r="toggle";return t!==void 0&&(r=t?"add":"remove"),e.classList[r](i),e.classList.contains(i)}return!1}function ge(e,i){return a.element(e)&&e.classList.contains(i)}function K(e,i){const{prototype:t}=Element;return(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||function(){return Array.from(document.querySelectorAll(i)).includes(this)}).call(e,i)}function ti(e,i){const{prototype:t}=Element;return(t.closest||function(){let r=this;do{if(K.matches(r,i))return r;r=r.parentElement||r.parentNode}while(r!==null&&r.nodeType===1);return null}).call(e,i)}function X(e){return this.elements.container.querySelectorAll(e)}function I(e){return this.elements.container.querySelector(e)}function we(e=null,i=!1){a.element(e)&&(e.focus({preventScroll:!0}),i&&x(e,this.config.classNames.tabFocus))}const We={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},M={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,i,t){const r=z.isIPhone&&t&&M.playsinline,s=M[e]||i!=="html5";return{api:s,ui:s&&M.rangeInput&&(e!=="video"||!z.isIPhone||r)}},pip:!(z.isIPhone||!a.function(f("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||f("video").disablePictureInPicture)),airplay:a.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(a.empty(e))return!1;const[i]=e.split("/");let t=e;if(!this.isHTML5||i!==this.type)return!1;Object.keys(We).includes(t)&&(t+=`; codecs="${We[e]}"`);try{return Boolean(t&&this.media.canPlayType(t).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range",e.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:Te!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},ii=(()=>{let e=!1;try{const i=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch{}return e})();function J(e,i,t,r=!1,s=!0,n=!1){if(!e||!("addEventListener"in e)||a.empty(i)||!a.function(t))return;const o=i.split(" ");let l=n;ii&&(l={passive:s,capture:n}),o.forEach(c=>{this&&this.eventListeners&&r&&this.eventListeners.push({element:e,type:c,callback:t,options:l}),e[r?"addEventListener":"removeEventListener"](c,t,l)})}function T(e,i="",t,r=!0,s=!1){J.call(this,e,i,t,!0,r,s)}function be(e,i="",t,r=!0,s=!1){J.call(this,e,i,t,!1,r,s)}function Ie(e,i="",t,r=!0,s=!1){const n=(...o)=>{be(e,i,n,r,s),t.apply(this,o)};J.call(this,e,i,n,!0,r,s)}function b(e,i="",t=!1,r={}){if(!a.element(e)||a.empty(i))return;const s=new CustomEvent(i,{bubbles:t,detail:ce(D({},r),{plyr:this})});e.dispatchEvent(s)}function ri(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{const{element:i,type:t,callback:r,options:s}=e;i.removeEventListener(t,r,s)}),this.eventListeners=[])}function si(){return new Promise(e=>this.ready?setTimeout(e,0):T.call(this,this.elements.container,"ready",e)).then(()=>{})}function q(e){a.promise(e)&&e.then(null,()=>{})}function Ae(e){return a.array(e)?e.filter((i,t)=>e.indexOf(i)===t):e}function ct(e,i){return a.array(e)&&e.length?e.reduce((t,r)=>Math.abs(r-i)<Math.abs(t-i)?r:t):null}function pt(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const Ye=[[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,[i,t])=>ce(D({},e),{[i/t]:[i,t]}),{});function dt(e){return a.array(e)||a.string(e)&&e.includes(":")?(a.array(e)?e:e.split(":")).map(Number).every(a.number):!1}function ye(e){if(!a.array(e)||!e.every(a.number))return null;const[i,t]=e,r=(n,o)=>o===0?n:r(o,n%o),s=r(i,t);return[i/s,t/s]}function $e(e){const i=r=>dt(r)?r.split(":").map(Number):null;let t=i(e);if(t===null&&(t=i(this.config.ratio)),t===null&&!a.empty(this.embed)&&a.array(this.embed.ratio)&&({ratio:t}=this.embed),t===null&&this.isHTML5){const{videoWidth:r,videoHeight:s}=this.media;t=[r,s]}return ye(t)}function G(e){if(!this.isVideo)return{};const{wrapper:i}=this.elements,t=$e.call(this,e);if(!a.array(t))return{};const[r,s]=ye(t),n=100/r*s;if(pt(`aspect-ratio: ${r}/${s}`)?i.style.aspectRatio=`${r}/${s}`:i.style.paddingBottom=`${n}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const o=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),l=(o-n)/(o/50);this.fullscreen.active?i.style.paddingBottom=null:this.media.style.transform=`translateY(-${l}%)`}else this.isHTML5&&i.classList.add(this.config.classNames.videoFixedRatio);return{padding:n,ratio:t}}function ut(e,i,t=.05){const r=e/i,s=ct(Object.keys(Ye),r);return Math.abs(s-r)<=t?Ye[s]:[e,i]}function ni(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const W={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(e=>{const i=e.getAttribute("type");return!!a.empty(i)||M.mime.call(this,i)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:W.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,a.empty(this.config.ratio)||G.call(e),Object.defineProperty(e.media,"quality",{get(){const i=W.getSources.call(e).find(t=>t.getAttribute("src")===e.source);return i&&Number(i.getAttribute("size"))},set(i){if(e.quality!==i){if(e.config.quality.forced&&a.function(e.config.quality.onChange))e.config.quality.onChange(i);else{const t=W.getSources.call(e).find(c=>Number(c.getAttribute("size"))===i);if(!t)return;const{currentTime:r,paused:s,preload:n,readyState:o,playbackRate:l}=e.media;e.media.src=t.getAttribute("src"),(n!=="none"||o)&&(e.once("loadedmetadata",()=>{e.speed=l,e.currentTime=r,s||q(e.play())}),e.media.load())}b.call(e,e.media,"qualitychange",!1,{quality:i})}}})},cancelRequests(){this.isHTML5&&(F(W.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function ai(e){return`${e}-${Math.floor(1e4*Math.random())}`}function Ee(e,...i){return a.empty(e)?e:e.toString().replace(/{(\d+)}/g,(t,r)=>i[r].toString())}function oi(e,i){return e===0||i===0||Number.isNaN(e)||Number.isNaN(i)?0:(e/i*100).toFixed(2)}const ie=(e="",i="",t="")=>e.replace(new RegExp(i.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),t.toString()),ht=(e="")=>e.toString().replace(/\w\S*/g,i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase());function li(e=""){let i=e.toString();return i=ie(i,"-"," "),i=ie(i,"_"," "),i=ht(i),ie(i," ","")}function ci(e=""){let i=e.toString();return i=li(i),i.charAt(0).toLowerCase()+i.slice(1)}function pi(e){const i=document.createDocumentFragment(),t=document.createElement("div");return i.appendChild(t),t.innerHTML=e,i.firstChild.innerText}function di(e){const i=document.createElement("div");return i.appendChild(e),i.innerHTML}const Ke={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},$={get(e="",i={}){if(a.empty(e)||a.empty(i))return"";let t=ot(i.i18n,e);if(a.empty(t))return Object.keys(Ke).includes(e)?Ke[e]:"";const r={"{seektime}":i.seekTime,"{title}":i.title};return Object.entries(r).forEach(([s,n])=>{t=ie(t,s,n)}),t}};class re{constructor(i){h(this,"get",t=>{if(!re.supported||!this.enabled)return null;const r=window.localStorage.getItem(this.key);if(a.empty(r))return null;const s=JSON.parse(r);return a.string(t)&&t.length?s[t]:s}),h(this,"set",t=>{if(!re.supported||!this.enabled||!a.object(t))return;let r=this.get();a.empty(r)&&(r={}),N(r,t);try{window.localStorage.setItem(this.key,JSON.stringify(r))}catch{}}),this.enabled=i.config.storage.enabled,this.key=i.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const i="___test";return window.localStorage.setItem(i,i),window.localStorage.removeItem(i),!0}catch{return!1}}}function ae(e,i="text"){return new Promise((t,r)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",()=>{if(i==="text")try{t(JSON.parse(s.responseText))}catch{t(s.responseText)}else t(s.response)}),s.addEventListener("error",()=>{throw new Error(s.status)}),s.open("GET",e,!0),s.responseType=i,s.send()}catch(s){r(s)}})}function mt(e,i){if(!a.string(e))return;const t=a.string(i);let r=!1;const s=()=>document.getElementById(i)!==null,n=(o,l)=>{o.innerHTML=l,t&&s()||document.body.insertAdjacentElement("afterbegin",o)};if(!t||!s()){const o=re.supported,l=document.createElement("div");if(l.setAttribute("hidden",""),t&&l.setAttribute("id",i),o){const c=window.localStorage.getItem(`cache-${i}`);if(r=c!==null,r){const p=JSON.parse(c);n(l,p.content)}}ae(e).then(c=>{if(!a.empty(c)){if(o)try{window.localStorage.setItem(`cache-${i}`,JSON.stringify({content:c}))}catch{}n(l,c)}}).catch(()=>{})}}const gt=e=>Math.trunc(e/60/60%60,10),ui=e=>Math.trunc(e%60,10);function ve(e=0,i=!1,t=!1){if(!a.number(e))return ve(void 0,i,t);const r=c=>`0${c}`.slice(-2);let s=gt(e);const n=(o=e,Math.trunc(o/60%60,10));var o;const l=ui(e);return s=i||s>0?`${s}:`:"",`${t&&e>0?"-":""}${s}${r(n)}:${r(l)}`}const d={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),i=window.location.host?window.location.host:window.top.location.host,t=e.host!==i||z.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:t}},findElements(){try{return this.elements.controls=I.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:X.call(this,this.config.selectors.buttons.play),pause:I.call(this,this.config.selectors.buttons.pause),restart:I.call(this,this.config.selectors.buttons.restart),rewind:I.call(this,this.config.selectors.buttons.rewind),fastForward:I.call(this,this.config.selectors.buttons.fastForward),mute:I.call(this,this.config.selectors.buttons.mute),pip:I.call(this,this.config.selectors.buttons.pip),airplay:I.call(this,this.config.selectors.buttons.airplay),settings:I.call(this,this.config.selectors.buttons.settings),captions:I.call(this,this.config.selectors.buttons.captions),fullscreen:I.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=I.call(this,this.config.selectors.progress),this.elements.inputs={seek:I.call(this,this.config.selectors.inputs.seek),volume:I.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:I.call(this,this.config.selectors.display.buffer),currentTime:I.call(this,this.config.selectors.display.currentTime),duration:I.call(this,this.config.selectors.display.duration)},a.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon(e,i){const t="http://www.w3.org/2000/svg",r=d.getIconUrl.call(this),s=`${r.cors?"":r.url}#${this.config.iconPrefix}`,n=document.createElementNS(t,"svg");Ce(n,N(i,{"aria-hidden":"true",focusable:"false"}));const o=document.createElementNS(t,"use"),l=`${s}-${e}`;return"href"in o&&o.setAttributeNS("http://www.w3.org/1999/xlink","href",l),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l),n.appendChild(o),n},createLabel(e,i={}){const t=$.get(e,this.config);return f("span",ce(D({},i),{class:[i.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),t)},createBadge(e){if(a.empty(e))return null;const i=f("span",{class:this.config.classNames.menu.value});return i.appendChild(f("span",{class:this.config.classNames.menu.badge},e)),i},createButton(e,i){const t=N({},i);let r=ci(e);const s={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(o=>{Object.keys(t).includes(o)&&(s[o]=t[o],delete t[o])}),s.element!=="button"||Object.keys(t).includes("type")||(t.type="button"),Object.keys(t).includes("class")?t.class.split(" ").some(o=>o===this.config.classNames.control)||N(t,{class:`${t.class} ${this.config.classNames.control}`}):t.class=this.config.classNames.control,e){case"play":s.toggle=!0,s.label="play",s.labelPressed="pause",s.icon="play",s.iconPressed="pause";break;case"mute":s.toggle=!0,s.label="mute",s.labelPressed="unmute",s.icon="volume",s.iconPressed="muted";break;case"captions":s.toggle=!0,s.label="enableCaptions",s.labelPressed="disableCaptions",s.icon="captions-off",s.iconPressed="captions-on";break;case"fullscreen":s.toggle=!0,s.label="enterFullscreen",s.labelPressed="exitFullscreen",s.icon="enter-fullscreen",s.iconPressed="exit-fullscreen";break;case"play-large":t.class+=` ${this.config.classNames.control}--overlaid`,r="play",s.label="play",s.icon="play";break;default:a.empty(s.label)&&(s.label=r),a.empty(s.icon)&&(s.icon=e)}const n=f(s.element);return s.toggle?(n.appendChild(d.createIcon.call(this,s.iconPressed,{class:"icon--pressed"})),n.appendChild(d.createIcon.call(this,s.icon,{class:"icon--not-pressed"})),n.appendChild(d.createLabel.call(this,s.labelPressed,{class:"label--pressed"})),n.appendChild(d.createLabel.call(this,s.label,{class:"label--not-pressed"}))):(n.appendChild(d.createIcon.call(this,s.icon)),n.appendChild(d.createLabel.call(this,s.label))),N(t,H(this.config.selectors.buttons[r],t)),Ce(n,t),r==="play"?(a.array(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(n)):this.elements.buttons[r]=n,n},createRange(e,i){const t=f("input",N(H(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":$.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},i));return this.elements.inputs[e]=t,d.updateRangeFill.call(this,t),qt.setup(t),t},createProgress(e,i){const t=f("progress",N(H(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},i));if(e!=="volume"){t.appendChild(f("span",null,"0"));const r={played:"played",buffer:"buffered"}[e],s=r?$.get(r,this.config):"";t.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=t,t},createTime(e,i){const t=H(this.config.selectors.display[e],i),r=f("div",N(t,{class:`${t.class?t.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":$.get(e,this.config)}),"00:00");return this.elements.display[e]=r,r},bindMenuItemShortcuts(e,i){T.call(this,e,"keydown keyup",t=>{if(!["Space","ArrowUp","ArrowDown","ArrowRight"].includes(t.key)||(t.preventDefault(),t.stopPropagation(),t.type==="keydown"))return;const r=K(e,'[role="menuitemradio"]');if(!r&&["Space","ArrowRight"].includes(t.key))d.showMenuPanel.call(this,i,!0);else{let s;t.key!=="Space"&&(t.key==="ArrowDown"||r&&t.key==="ArrowRight"?(s=e.nextElementSibling,a.element(s)||(s=e.parentNode.firstElementChild)):(s=e.previousElementSibling,a.element(s)||(s=e.parentNode.lastElementChild)),we.call(this,s,!0))}},!1),T.call(this,e,"keyup",t=>{t.key==="Return"&&d.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:i,type:t,title:r,badge:s=null,checked:n=!1}){const o=H(this.config.selectors.inputs[t]),l=f("button",N(o,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${o.class?o.class:""}`.trim(),"aria-checked":n,value:e})),c=f("span");c.innerHTML=r,a.element(s)&&c.appendChild(s),l.appendChild(c),Object.defineProperty(l,"checked",{enumerable:!0,get:()=>l.getAttribute("aria-checked")==="true",set(p){p&&Array.from(l.parentNode.children).filter(m=>K(m,'[role="menuitemradio"]')).forEach(m=>m.setAttribute("aria-checked","false")),l.setAttribute("aria-checked",p?"true":"false")}}),this.listeners.bind(l,"click keyup",p=>{if(!a.keyboardEvent(p)||p.key==="Space"){switch(p.preventDefault(),p.stopPropagation(),l.checked=!0,t){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}d.showMenuPanel.call(this,"home",a.keyboardEvent(p))}},t,!1),d.bindMenuItemShortcuts.call(this,l,t),i.appendChild(l)},formatTime(e=0,i=!1){return a.number(e)?ve(e,gt(this.duration)>0,i):e},updateTimeDisplay(e=null,i=0,t=!1){a.element(e)&&a.number(i)&&(e.innerText=d.formatTime(i,t))},updateVolume(){this.supported.ui&&(a.element(this.elements.inputs.volume)&&d.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),a.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(e,i=0){a.element(e)&&(e.value=i,d.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!a.event(e))return;let i=0;const t=(r,s)=>{const n=a.number(s)?s:0,o=a.element(r)?r:this.elements.display.buffer;if(a.element(o)){o.value=n;const l=o.getElementsByTagName("span")[0];a.element(l)&&(l.childNodes[0].nodeValue=n)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=oi(this.currentTime,this.duration),e.type==="timeupdate"&&d.setRange.call(this,this.elements.inputs.seek,i);break;case"playing":case"progress":t(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(e){const i=a.event(e)?e.target:e;if(a.element(i)&&i.getAttribute("type")==="range"){if(K(i,this.config.selectors.inputs.seek)){i.setAttribute("aria-valuenow",this.currentTime);const t=d.formatTime(this.currentTime),r=d.formatTime(this.duration),s=$.get("seekLabel",this.config);i.setAttribute("aria-valuetext",s.replace("{currentTime}",t).replace("{duration}",r))}else if(K(i,this.config.selectors.inputs.volume)){const t=100*i.value;i.setAttribute("aria-valuenow",t),i.setAttribute("aria-valuetext",`${t.toFixed(1)}%`)}else i.setAttribute("aria-valuenow",i.value);z.isWebkit&&i.style.setProperty("--value",i.value/i.max*100+"%")}},updateSeekTooltip(e){var i,t;if(!this.config.tooltips.seek||!a.element(this.elements.inputs.seek)||!a.element(this.elements.display.seekTooltip)||this.duration===0)return;const r=this.elements.display.seekTooltip,s=`${this.config.classNames.tooltip}--visible`,n=m=>x(r,s,m);if(this.touch)return void n(!1);let o=0;const l=this.elements.progress.getBoundingClientRect();if(a.event(e))o=100/l.width*(e.pageX-l.left);else{if(!ge(r,s))return;o=parseFloat(r.style.left,10)}o<0?o=0:o>100&&(o=100);const c=this.duration/100*o;r.innerText=d.formatTime(c);const p=(i=this.config.markers)===null||i===void 0||(t=i.points)===null||t===void 0?void 0:t.find(({time:m})=>m===Math.round(c));p&&r.insertAdjacentHTML("afterbegin",`${p.label}<br>`),r.style.left=`${o}%`,a.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&n(e.type==="mouseenter")},timeUpdate(e){const i=!a.element(this.elements.display.duration)&&this.config.invertTime;d.updateTimeDisplay.call(this,this.elements.display.currentTime,i?this.duration-this.currentTime:this.currentTime,i),e&&e.type==="timeupdate"&&this.media.seeking||d.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return Y(this.elements.display.currentTime,!0),void Y(this.elements.progress,!0);a.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=a.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&d.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&d.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&d.setMarkers.call(this),d.updateSeekTooltip.call(this)},toggleMenuButton(e,i){Y(this.elements.settings.buttons[e],!i)},updateSetting(e,i,t){const r=this.elements.settings.panels[e];let s=null,n=i;if(e==="captions")s=this.currentTrack;else{if(s=a.empty(t)?this[e]:t,a.empty(s)&&(s=this.config[e].default),!a.empty(this.options[e])&&!this.options[e].includes(s))return void this.debug.warn(`Unsupported value of '${s}' for ${e}`);if(!this.config[e].options.includes(s))return void this.debug.warn(`Disabled value of '${s}' for ${e}`)}if(a.element(n)||(n=r&&r.querySelector('[role="menu"]')),!a.element(n))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=d.getLabel.call(this,e,s);const o=n&&n.querySelector(`[value="${s}"]`);a.element(o)&&(o.checked=!0)},getLabel(e,i){switch(e){case"speed":return i===1?$.get("normal",this.config):`${i}×`;case"quality":if(a.number(i)){const t=$.get(`qualityLabel.${i}`,this.config);return t.length?t:`${i}p`}return ht(i);case"captions":return A.getLabel.call(this);default:return null}},setQualityMenu(e){if(!a.element(this.elements.settings.panels.quality))return;const i="quality",t=this.elements.settings.panels.quality.querySelector('[role="menu"]');a.array(e)&&(this.options.quality=Ae(e).filter(n=>this.config.quality.options.includes(n)));const r=!a.empty(this.options.quality)&&this.options.quality.length>1;if(d.toggleMenuButton.call(this,i,r),de(t),d.checkMenu.call(this),!r)return;const s=n=>{const o=$.get(`qualityBadge.${n}`,this.config);return o.length?d.createBadge.call(this,o):null};this.options.quality.sort((n,o)=>{const l=this.config.quality.options;return l.indexOf(n)>l.indexOf(o)?1:-1}).forEach(n=>{d.createMenuItem.call(this,{value:n,list:t,type:i,title:d.getLabel.call(this,"quality",n),badge:s(n)})}),d.updateSetting.call(this,i,t)},setCaptionsMenu(){if(!a.element(this.elements.settings.panels.captions))return;const e="captions",i=this.elements.settings.panels.captions.querySelector('[role="menu"]'),t=A.getTracks.call(this),r=Boolean(t.length);if(d.toggleMenuButton.call(this,e,r),de(i),d.checkMenu.call(this),!r)return;const s=t.map((n,o)=>({value:o,checked:this.captions.toggled&&this.currentTrack===o,title:A.getLabel.call(this,n),badge:n.language&&d.createBadge.call(this,n.language.toUpperCase()),list:i,type:"language"}));s.unshift({value:-1,checked:!this.captions.toggled,title:$.get("disabled",this.config),list:i,type:"language"}),s.forEach(d.createMenuItem.bind(this)),d.updateSetting.call(this,e,i)},setSpeedMenu(){if(!a.element(this.elements.settings.panels.speed))return;const e="speed",i=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(r=>r>=this.minimumSpeed&&r<=this.maximumSpeed);const t=!a.empty(this.options.speed)&&this.options.speed.length>1;d.toggleMenuButton.call(this,e,t),de(i),d.checkMenu.call(this),t&&(this.options.speed.forEach(r=>{d.createMenuItem.call(this,{value:r,list:i,type:e,title:d.getLabel.call(this,"speed",r)})}),d.updateSetting.call(this,e,i))},checkMenu(){const{buttons:e}=this.elements.settings,i=!a.empty(e)&&Object.values(e).some(t=>!t.hidden);Y(this.elements.settings.menu,!i)},focusFirstMenuItem(e,i=!1){if(this.elements.settings.popup.hidden)return;let t=e;a.element(t)||(t=Object.values(this.elements.settings.panels).find(s=>!s.hidden));const r=t.querySelector('[role^="menuitem"]');we.call(this,r,i)},toggleMenu(e){const{popup:i}=this.elements.settings,t=this.elements.buttons.settings;if(!a.element(i)||!a.element(t))return;const{hidden:r}=i;let s=r;if(a.boolean(e))s=e;else if(a.keyboardEvent(e)&&e.key==="Escape")s=!1;else if(a.event(e)){const n=a.function(e.composedPath)?e.composedPath()[0]:e.target,o=i.contains(n);if(o||!o&&e.target!==t&&s)return}t.setAttribute("aria-expanded",s),Y(i,!s),x(this.elements.container,this.config.classNames.menu.open,s),s&&a.keyboardEvent(e)?d.focusFirstMenuItem.call(this,null,!0):s||r||we.call(this,t,a.keyboardEvent(e))},getMenuSize(e){const i=e.cloneNode(!0);i.style.position="absolute",i.style.opacity=0,i.removeAttribute("hidden"),e.parentNode.appendChild(i);const t=i.scrollWidth,r=i.scrollHeight;return F(i),{width:t,height:r}},showMenuPanel(e="",i=!1){const t=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!a.element(t))return;const r=t.parentNode,s=Array.from(r.children).find(n=>!n.hidden);if(M.transitions&&!M.reducedMotion){r.style.width=`${s.scrollWidth}px`,r.style.height=`${s.scrollHeight}px`;const n=d.getMenuSize.call(this,t),o=l=>{l.target===r&&["width","height"].includes(l.propertyName)&&(r.style.width="",r.style.height="",be.call(this,r,Te,o))};T.call(this,r,Te,o),r.style.width=`${n.width}px`,r.style.height=`${n.height}px`}Y(s,!0),Y(t,!1),d.focusFirstMenuItem.call(this,t,i)},setDownloadUrl(){const e=this.elements.buttons.download;a.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:i,createButton:t,createProgress:r,createRange:s,createTime:n,setQualityMenu:o,setSpeedMenu:l,showMenuPanel:c}=d;this.elements.controls=null,a.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(t.call(this,"play-large"));const p=f("div",H(this.config.selectors.controls.wrapper));this.elements.controls=p;const m={class:"plyr__controls__item"};return Ae(a.array(this.config.controls)?this.config.controls:[]).forEach(y=>{if(y==="restart"&&p.appendChild(t.call(this,"restart",m)),y==="rewind"&&p.appendChild(t.call(this,"rewind",m)),y==="play"&&p.appendChild(t.call(this,"play",m)),y==="fast-forward"&&p.appendChild(t.call(this,"fast-forward",m)),y==="progress"){const u=f("div",{class:`${m.class} plyr__progress__container`}),v=f("div",H(this.config.selectors.progress));if(v.appendChild(s.call(this,"seek",{id:`plyr-seek-${e.id}`})),v.appendChild(r.call(this,"buffer")),this.config.tooltips.seek){const _=f("span",{class:this.config.classNames.tooltip},"00:00");v.appendChild(_),this.elements.display.seekTooltip=_}this.elements.progress=v,u.appendChild(this.elements.progress),p.appendChild(u)}if(y==="current-time"&&p.appendChild(n.call(this,"currentTime",m)),y==="duration"&&p.appendChild(n.call(this,"duration",m)),y==="mute"||y==="volume"){let{volume:u}=this.elements;if(a.element(u)&&p.contains(u)||(u=f("div",N({},m,{class:`${m.class} plyr__volume`.trim()})),this.elements.volume=u,p.appendChild(u)),y==="mute"&&u.appendChild(t.call(this,"mute")),y==="volume"&&!z.isIos){const v={max:1,step:.05,value:this.config.volume};u.appendChild(s.call(this,"volume",N(v,{id:`plyr-volume-${e.id}`})))}}if(y==="captions"&&p.appendChild(t.call(this,"captions",m)),y==="settings"&&!a.empty(this.config.settings)){const u=f("div",N({},m,{class:`${m.class} plyr__menu`.trim(),hidden:""}));u.appendChild(t.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const v=f("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),_=f("div"),k=f("div",{id:`plyr-settings-${e.id}-home`}),S=f("div",{role:"menu"});k.appendChild(S),_.appendChild(k),this.elements.settings.panels.home=k,this.config.settings.forEach(w=>{const P=f("button",N(H(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));i.call(this,P,w),T.call(this,P,"click",()=>{c.call(this,w,!1)});const g=f("span",null,$.get(w,this.config)),C=f("span",{class:this.config.classNames.menu.value});C.innerHTML=e[w],g.appendChild(C),P.appendChild(g),S.appendChild(P);const L=f("div",{id:`plyr-settings-${e.id}-${w}`,hidden:""}),j=f("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});j.appendChild(f("span",{"aria-hidden":!0},$.get(w,this.config))),j.appendChild(f("span",{class:this.config.classNames.hidden},$.get("menuBack",this.config))),T.call(this,L,"keydown",U=>{U.key==="ArrowLeft"&&(U.preventDefault(),U.stopPropagation(),c.call(this,"home",!0))},!1),T.call(this,j,"click",()=>{c.call(this,"home",!1)}),L.appendChild(j),L.appendChild(f("div",{role:"menu"})),_.appendChild(L),this.elements.settings.buttons[w]=P,this.elements.settings.panels[w]=L}),v.appendChild(_),u.appendChild(v),p.appendChild(u),this.elements.settings.popup=v,this.elements.settings.menu=u}if(y==="pip"&&M.pip&&p.appendChild(t.call(this,"pip",m)),y==="airplay"&&M.airplay&&p.appendChild(t.call(this,"airplay",m)),y==="download"){const u=N({},m,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(u.download="");const{download:v}=this.config.urls;!a.url(v)&&this.isEmbed&&N(u,{icon:`logo-${this.provider}`,label:this.provider}),p.appendChild(t.call(this,"download",u))}y==="fullscreen"&&p.appendChild(t.call(this,"fullscreen",m))}),this.isHTML5&&o.call(this,W.getQualityOptions.call(this)),l.call(this),p},inject(){if(this.config.loadSprite){const s=d.getIconUrl.call(this);s.cors&&mt(s.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const i={id:this.id,seektime:this.config.seekTime,title:this.config.title};let t=!0;a.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,i)),this.config.controls||(this.config.controls=[]),a.element(this.config.controls)||a.string(this.config.controls)?e=this.config.controls:(e=d.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:A.getLabel.call(this)}),t=!1);let r;if(t&&a.string(this.config.controls)&&(e=(s=>{let n=s;return Object.entries(i).forEach(([o,l])=>{n=ie(n,`{${o}}`,l)}),n})(e)),a.string(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),a.element(r)||(r=this.elements.container),r[a.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),a.element(this.elements.controls)||d.findElements.call(this),!a.empty(this.elements.buttons)){const s=n=>{const o=this.config.classNames.controlPressed;Object.defineProperty(n,"pressed",{enumerable:!0,get:()=>ge(n,o),set(l=!1){x(n,o,l)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(n=>{a.array(n)||a.nodeList(n)?Array.from(n).filter(Boolean).forEach(s):s(n)})}if(z.isEdge&&at(r),this.config.tooltips.controls){const{classNames:s,selectors:n}=this.config,o=`${n.controls.wrapper} ${n.labels} .${s.hidden}`,l=X.call(this,o);Array.from(l).forEach(c=>{x(c,this.config.classNames.hidden,!1),x(c,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{}},setMarkers(){var e,i;if(!this.duration||this.elements.markers)return;const t=(e=this.config.markers)===null||e===void 0||(i=e.points)===null||i===void 0?void 0:i.filter(({time:c})=>c>0&&c<this.duration);if(t==null||!t.length)return;const r=document.createDocumentFragment(),s=document.createDocumentFragment();let n=null;const o=`${this.config.classNames.tooltip}--visible`,l=c=>x(n,o,c);t.forEach(c=>{const p=f("span",{class:this.config.classNames.marker},""),m=c.time/this.duration*100+"%";n&&(p.addEventListener("mouseenter",()=>{c.label||(n.style.left=m,n.innerHTML=c.label,l(!0))}),p.addEventListener("mouseleave",()=>{l(!1)})),p.addEventListener("click",()=>{this.currentTime=c.time}),p.style.left=m,s.appendChild(p)}),r.appendChild(s),this.config.tooltips.seek||(n=f("span",{class:this.config.classNames.tooltip},""),r.appendChild(n)),this.elements.markers={points:s,tip:n},this.elements.progress.appendChild(r)}};function yt(e,i=!0){let t=e;if(i){const r=document.createElement("a");r.href=t,t=r.href}try{return new URL(t)}catch{return null}}function ft(e){const i=new URLSearchParams;return a.object(e)&&Object.entries(e).forEach(([t,r])=>{i.set(t,r)}),i}const A={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!M.textTracks)return void(a.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&d.setCaptionsMenu.call(this));if(a.element(this.elements.captions)||(this.elements.captions=f("div",H(this.config.selectors.captions)),ei(this.elements.captions,this.elements.wrapper)),z.isIE&&window.URL){const r=this.media.querySelectorAll("track");Array.from(r).forEach(s=>{const n=s.getAttribute("src"),o=yt(n);o!==null&&o.hostname!==window.location.href.hostname&&["http:","https:"].includes(o.protocol)&&ae(n,"blob").then(l=>{s.setAttribute("src",window.URL.createObjectURL(l))}).catch(()=>{F(s)})})}const e=Ae((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(r=>r.split("-")[0]));let i=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();i==="auto"&&([i]=e);let t=this.storage.get("captions");if(a.boolean(t)||({active:t}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:t,language:i,languages:e}),this.isHTML5){const r=this.config.captions.update?"addtrack removetrack":"removetrack";T.call(this,this.media.textTracks,r,A.update.bind(this))}setTimeout(A.update.bind(this),0)},update(){const e=A.getTracks.call(this,!0),{active:i,language:t,meta:r,currentTrackNode:s}=this.captions,n=Boolean(e.find(o=>o.language===t));this.isHTML5&&this.isVideo&&e.filter(o=>!r.get(o)).forEach(o=>{this.debug.log("Track added",o),r.set(o,{default:o.mode==="showing"}),o.mode==="showing"&&(o.mode="hidden"),T.call(this,o,"cuechange",()=>A.updateCues.call(this))}),(n&&this.language!==t||!e.includes(s))&&(A.setLanguage.call(this,t),A.toggle.call(this,i&&n)),this.elements&&x(this.elements.container,this.config.classNames.captions.enabled,!a.empty(e)),a.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&d.setCaptionsMenu.call(this)},toggle(e,i=!0){if(!this.supported.ui)return;const{toggled:t}=this.captions,r=this.config.classNames.captions.active,s=a.nullOrUndefined(e)?!t:e;if(s!==t){if(i||(this.captions.active=s,this.storage.set({captions:s})),!this.language&&s&&!i){const n=A.getTracks.call(this),o=A.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=o.language,void A.set.call(this,n.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=s),x(this.elements.container,r,s),this.captions.toggled=s,d.updateSetting.call(this,"captions"),b.call(this,this.media,s?"captionsenabled":"captionsdisabled")}setTimeout(()=>{s&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(e,i=!0){const t=A.getTracks.call(this);if(e!==-1)if(a.number(e))if(e in t){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const r=t[e],{language:s}=r||{};this.captions.currentTrackNode=r,d.updateSetting.call(this,"captions"),i||(this.captions.language=s,this.storage.set({language:s})),this.isVimeo&&this.embed.enableTextTrack(s),b.call(this,this.media,"languagechange")}A.toggle.call(this,!0,i),this.isHTML5&&this.isVideo&&A.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else A.toggle.call(this,!1,i)},setLanguage(e,i=!0){if(!a.string(e))return void this.debug.warn("Invalid language argument",e);const t=e.toLowerCase();this.captions.language=t;const r=A.getTracks.call(this),s=A.findTrack.call(this,[t]);A.set.call(this,r.indexOf(s),i)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter(i=>!this.isHTML5||e||this.captions.meta.has(i)).filter(i=>["captions","subtitles"].includes(i.kind))},findTrack(e,i=!1){const t=A.getTracks.call(this),r=o=>Number((this.captions.meta.get(o)||{}).default),s=Array.from(t).sort((o,l)=>r(l)-r(o));let n;return e.every(o=>(n=s.find(l=>l.language===o),!n)),n||(i?s[0]:void 0)},getCurrentTrack(){return A.getTracks.call(this)[this.currentTrack]},getLabel(e){let i=e;return!a.track(i)&&M.textTracks&&this.captions.toggled&&(i=A.getCurrentTrack.call(this)),a.track(i)?a.empty(i.label)?a.empty(i.language)?$.get("enabled",this.config):e.language.toUpperCase():i.label:$.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!a.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!a.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let i=e;if(!i){const r=A.getCurrentTrack.call(this);i=Array.from((r||{}).activeCues||[]).map(s=>s.getCueAsHTML()).map(di)}const t=i.map(r=>r.trim()).join(`
- `);if(t!==this.elements.captions.innerHTML){de(this.elements.captions);const r=f("span",H(this.config.selectors.caption));r.innerHTML=t,this.elements.captions.appendChild(r),b.call(this,this.media,"cuechange")}}},bt={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.2/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",isIos:"plyr--is-ios",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"},tabFocus:"plyr__tab-focus",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:[]}},_e={active:"picture-in-picture",inactive:"inline"},B={html5:"html5",youtube:"youtube",vimeo:"vimeo"},ke={audio:"audio",video:"video"};function hi(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?B.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?B.vimeo:null}const xe=()=>{};class mi{constructor(i=!1){this.enabled=window.console&&i,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):xe}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):xe}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):xe}}class R{constructor(i){h(this,"onChange",()=>{if(!this.enabled)return;const t=this.player.elements.buttons.fullscreen;a.element(t)&&(t.pressed=this.active);const r=this.target===this.player.media?this.target:this.player.elements.container;b.call(this.player,r,this.active?"enterfullscreen":"exitfullscreen",!0)}),h(this,"toggleFallback",(t=!1)=>{if(t?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=t?"hidden":"",x(this.target,this.player.config.classNames.fullscreen.fallback,t),z.isIos){let r=document.head.querySelector('meta[name="viewport"]');const s="viewport-fit=cover";r||(r=document.createElement("meta"),r.setAttribute("name","viewport"));const n=a.string(r.content)&&r.content.includes(s);t?(this.cleanupViewport=!n,n||(r.content+=`,${s}`)):this.cleanupViewport&&(r.content=r.content.split(",").filter(o=>o.trim()!==s).join(","))}this.onChange()}),h(this,"trapFocus",t=>{if(z.isIos||!this.active||t.key!=="Tab")return;const r=document.activeElement,s=X.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[n]=s,o=s[s.length-1];r!==o||t.shiftKey?r===n&&t.shiftKey&&(o.focus(),t.preventDefault()):(n.focus(),t.preventDefault())}),h(this,"update",()=>{if(this.enabled){let t;t=this.forceFallback?"Fallback (forced)":R.native?"Native":"Fallback",this.player.debug.log(`${t} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");x(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}),h(this,"enter",()=>{this.enabled&&(z.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!R.native||this.forceFallback?this.toggleFallback(!0):this.prefix?a.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),h(this,"exit",()=>{if(this.enabled)if(z.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),q(this.player.play());else if(!R.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!a.empty(this.prefix)){const t=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${t}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),h(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=i,this.prefix=R.prefix,this.property=R.property,this.scrollPosition={x:0,y:0},this.forceFallback=i.config.fullscreen.fallback==="force",this.player.elements.fullscreen=i.config.fullscreen.container&&ti(this.player.elements.container,i.config.fullscreen.container),T.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),T.call(this.player,this.player.elements.container,"dblclick",t=>{a.element(this.player.elements.controls)&&this.player.elements.controls.contains(t.target)||this.player.listeners.proxy(t,this.toggle,"fullscreen")}),T.call(this,this.player.elements.container,"keydown",t=>this.trapFocus(t)),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return R.native&&!this.forceFallback}static get prefix(){if(a.function(document.exitFullscreen))return"";let i="";return["webkit","moz","ms"].some(t=>!(!a.function(document[`${t}ExitFullscreen`])&&!a.function(document[`${t}CancelFullScreen`]))&&(i=t,!0)),i}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get enabled(){return(R.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){if(!this.enabled)return!1;if(!R.native||this.forceFallback)return ge(this.target,this.player.config.classNames.fullscreen.fallback);const i=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return i&&i.shadowRoot?i===this.target.getRootNode().host:i===this.target}get target(){return z.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}function ue(e,i=1){return new Promise((t,r)=>{const s=new Image,n=()=>{delete s.onload,delete s.onerror,(s.naturalWidth>=i?t:r)(s)};Object.assign(s,{onload:n,onerror:n,src:e})})}const E={addStyleHook(){x(this.elements.container,this.config.selectors.container.replace(".",""),!0),x(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 E.toggleNativeControls.call(this,!0);a.element(this.elements.controls)||(d.inject.call(this),this.listeners.controls()),E.toggleNativeControls.call(this),this.isHTML5&&A.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,d.updateVolume.call(this),d.timeUpdate.call(this),d.durationUpdate.call(this),E.checkPlaying.call(this),x(this.elements.container,this.config.classNames.pip.supported,M.pip&&this.isHTML5&&this.isVideo),x(this.elements.container,this.config.classNames.airplay.supported,M.airplay&&this.isHTML5),x(this.elements.container,this.config.classNames.isIos,z.isIos),x(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{b.call(this,this.media,"ready")},0),E.setTitle.call(this),this.poster&&E.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&d.durationUpdate.call(this),this.config.mediaMetadata&&d.setMediaMetadata.call(this)},setTitle(){let e=$.get("play",this.config);if(a.string(this.config.title)&&!a.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(i=>{i.setAttribute("aria-label",e)}),this.isEmbed){const i=I.call(this,"iframe");if(!a.element(i))return;const t=a.empty(this.config.title)?"video":this.config.title,r=$.get("frameTitle",this.config);i.setAttribute("title",r.replace("{title}",t))}},togglePoster(e){x(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,i=!0){return i&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),si.call(this).then(()=>ue(e)).catch(t=>{throw e===this.poster&&E.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:""}),E.togglePoster.call(this,!0),e)))},checkPlaying(e){x(this.elements.container,this.config.classNames.playing,this.playing),x(this.elements.container,this.config.classNames.paused,this.paused),x(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(i=>{Object.assign(i,{pressed:this.playing}),i.setAttribute("aria-label",$.get(this.playing?"pause":"play",this.config))}),a.event(e)&&e.type==="timeupdate"||E.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{x(this.elements.container,this.config.classNames.loading,this.loading),E.toggleControls.call(this)},this.loading?250:0)},toggleControls(e){const{controls:i}=this.elements;if(i&&this.config.hideControls){const t=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||i.pressed||i.hover||t))}},migrateStyles(){Object.values(D({},this.media.style)).filter(e=>!a.empty(e)&&a.string(e)&&e.startsWith("--plyr")).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),a.empty(this.media.style)&&this.media.removeAttribute("style")}};class gi{constructor(i){h(this,"firstTouch",()=>{const{player:t}=this,{elements:r}=t;t.touch=!0,x(r.container,t.config.classNames.isTouch,!0)}),h(this,"setTabFocus",t=>{const{player:r}=this,{elements:s}=r,{key:n,type:o,timeStamp:l}=t;if(clearTimeout(this.focusTimer),o==="keydown"&&n!=="Tab")return;o==="keydown"&&(this.lastKeyDown=l);const c=l-this.lastKeyDown<=20;(o!=="focus"||c)&&((()=>{const p=r.config.classNames.tabFocus;x(X.call(r,`.${p}`),p,!1)})(),o!=="focusout"&&(this.focusTimer=setTimeout(()=>{const p=document.activeElement;s.container.contains(p)&&x(document.activeElement,r.config.classNames.tabFocus,!0)},10)))}),h(this,"global",(t=!0)=>{const{player:r}=this;r.config.keyboard.global&&J.call(r,window,"keydown keyup",this.handleKey,t,!1),J.call(r,document.body,"click",this.toggleMenu,t),Ie.call(r,document.body,"touchstart",this.firstTouch),J.call(r,document.body,"keydown focus blur focusout",this.setTabFocus,t,!1,!0)}),h(this,"container",()=>{const{player:t}=this,{config:r,elements:s,timers:n}=t;!r.keyboard.global&&r.keyboard.focused&&T.call(t,s.container,"keydown keyup",this.handleKey,!1),T.call(t,s.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",c=>{const{controls:p}=s;p&&c.type==="enterfullscreen"&&(p.pressed=!1,p.hover=!1);let m=0;["touchstart","touchmove","mousemove"].includes(c.type)&&(E.toggleControls.call(t,!0),m=t.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout(()=>E.toggleControls.call(t,!1),m)});const o=()=>{if(!t.isVimeo||t.config.vimeo.premium)return;const c=s.wrapper,{active:p}=t.fullscreen,[m,y]=$e.call(t),u=pt(`aspect-ratio: ${m} / ${y}`);if(!p)return void(u?(c.style.width=null,c.style.height=null):(c.style.maxWidth=null,c.style.margin=null));const[v,_]=ni(),k=v/_>m/y;u?(c.style.width=k?"auto":"100%",c.style.height=k?"100%":"auto"):(c.style.maxWidth=k?_/y*m+"px":null,c.style.margin=k?"0 auto":null)},l=()=>{clearTimeout(n.resized),n.resized=setTimeout(o,50)};T.call(t,s.container,"enterfullscreen exitfullscreen",c=>{const{target:p}=t.fullscreen;p===s.container&&(!t.isEmbed&&a.empty(t.config.ratio)||(o(),(c.type==="enterfullscreen"?T:be).call(t,window,"resize",l)))})}),h(this,"media",()=>{const{player:t}=this,{elements:r}=t;if(T.call(t,t.media,"timeupdate seeking seeked",n=>d.timeUpdate.call(t,n)),T.call(t,t.media,"durationchange loadeddata loadedmetadata",n=>d.durationUpdate.call(t,n)),T.call(t,t.media,"ended",()=>{t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())}),T.call(t,t.media,"progress playing seeking seeked",n=>d.updateProgress.call(t,n)),T.call(t,t.media,"volumechange",n=>d.updateVolume.call(t,n)),T.call(t,t.media,"playing play pause ended emptied timeupdate",n=>E.checkPlaying.call(t,n)),T.call(t,t.media,"waiting canplay seeked playing",n=>E.checkLoading.call(t,n)),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){const n=I.call(t,`.${t.config.classNames.video}`);if(!a.element(n))return;T.call(t,r.container,"click",o=>{([r.container,n].includes(o.target)||n.contains(o.target))&&(t.touch&&t.config.hideControls||(t.ended?(this.proxy(o,t.restart,"restart"),this.proxy(o,()=>{q(t.play())},"play")):this.proxy(o,()=>{q(t.togglePlay())},"play")))})}t.supported.ui&&t.config.disableContextMenu&&T.call(t,r.wrapper,"contextmenu",n=>{n.preventDefault()},!1),T.call(t,t.media,"volumechange",()=>{t.storage.set({volume:t.volume,muted:t.muted})}),T.call(t,t.media,"ratechange",()=>{d.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})}),T.call(t,t.media,"qualitychange",n=>{d.updateSetting.call(t,"quality",null,n.detail.quality)}),T.call(t,t.media,"ready qualitychange",()=>{d.setDownloadUrl.call(t)});const s=t.config.events.concat(["keyup","keydown"]).join(" ");T.call(t,t.media,s,n=>{let{detail:o={}}=n;n.type==="error"&&(o=t.media.error),b.call(t,r.container,n.type,!0,o)})}),h(this,"proxy",(t,r,s)=>{const{player:n}=this,o=n.config.listeners[s];let l=!0;a.function(o)&&(l=o.call(n,t)),l!==!1&&a.function(r)&&r.call(n,t)}),h(this,"bind",(t,r,s,n,o=!0)=>{const{player:l}=this,c=l.config.listeners[n],p=a.function(c);T.call(l,t,r,m=>this.proxy(m,s,n),o&&!p)}),h(this,"controls",()=>{const{player:t}=this,{elements:r}=t,s=z.isIE?"change":"input";if(r.buttons.play&&Array.from(r.buttons.play).forEach(n=>{this.bind(n,"click",()=>{q(t.togglePlay())},"play")}),this.bind(r.buttons.restart,"click",t.restart,"restart"),this.bind(r.buttons.rewind,"click",()=>{t.lastSeekTime=Date.now(),t.rewind()},"rewind"),this.bind(r.buttons.fastForward,"click",()=>{t.lastSeekTime=Date.now(),t.forward()},"fastForward"),this.bind(r.buttons.mute,"click",()=>{t.muted=!t.muted},"mute"),this.bind(r.buttons.captions,"click",()=>t.toggleCaptions()),this.bind(r.buttons.download,"click",()=>{b.call(t,t.media,"download")},"download"),this.bind(r.buttons.fullscreen,"click",()=>{t.fullscreen.toggle()},"fullscreen"),this.bind(r.buttons.pip,"click",()=>{t.pip="toggle"},"pip"),this.bind(r.buttons.airplay,"click",t.airplay,"airplay"),this.bind(r.buttons.settings,"click",n=>{n.stopPropagation(),n.preventDefault(),d.toggleMenu.call(t,n)},null,!1),this.bind(r.buttons.settings,"keyup",n=>{["Space","Enter"].includes(n.key)&&(n.key!=="Enter"?(n.preventDefault(),n.stopPropagation(),d.toggleMenu.call(t,n)):d.focusFirstMenuItem.call(t,null,!0))},null,!1),this.bind(r.settings.menu,"keydown",n=>{n.key==="Escape"&&d.toggleMenu.call(t,n)}),this.bind(r.inputs.seek,"mousedown mousemove",n=>{const o=r.progress.getBoundingClientRect(),l=100/o.width*(n.pageX-o.left);n.currentTarget.setAttribute("seek-value",l)}),this.bind(r.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",n=>{const o=n.currentTarget,l="play-on-seeked";if(a.keyboardEvent(n)&&!["ArrowLeft","ArrowRight"].includes(n.key))return;t.lastSeekTime=Date.now();const c=o.hasAttribute(l),p=["mouseup","touchend","keyup"].includes(n.type);c&&p?(o.removeAttribute(l),q(t.play())):!p&&t.playing&&(o.setAttribute(l,""),t.pause())}),z.isIos){const n=X.call(t,'input[type="range"]');Array.from(n).forEach(o=>this.bind(o,s,l=>at(l.target)))}this.bind(r.inputs.seek,s,n=>{const o=n.currentTarget;let l=o.getAttribute("seek-value");a.empty(l)&&(l=o.value),o.removeAttribute("seek-value"),t.currentTime=l/o.max*t.duration},"seek"),this.bind(r.progress,"mouseenter mouseleave mousemove",n=>d.updateSeekTooltip.call(t,n)),this.bind(r.progress,"mousemove touchmove",n=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.startMove(n)}),this.bind(r.progress,"mouseleave touchend click",()=>{const{previewThumbnails:n}=t;n&&n.loaded&&n.endMove(!1,!0)}),this.bind(r.progress,"mousedown touchstart",n=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.startScrubbing(n)}),this.bind(r.progress,"mouseup touchend",n=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.endScrubbing(n)}),z.isWebkit&&Array.from(X.call(t,'input[type="range"]')).forEach(n=>{this.bind(n,"input",o=>d.updateRangeFill.call(t,o.target))}),t.config.toggleInvert&&!a.element(r.display.duration)&&this.bind(r.display.currentTime,"click",()=>{t.currentTime!==0&&(t.config.invertTime=!t.config.invertTime,d.timeUpdate.call(t))}),this.bind(r.inputs.volume,s,n=>{t.volume=n.target.value},"volume"),this.bind(r.controls,"mouseenter mouseleave",n=>{r.controls.hover=!t.touch&&n.type==="mouseenter"}),r.fullscreen&&Array.from(r.fullscreen.children).filter(n=>!n.contains(r.container)).forEach(n=>{this.bind(n,"mouseenter mouseleave",o=>{r.controls&&(r.controls.hover=!t.touch&&o.type==="mouseenter")})}),this.bind(r.controls,"mousedown mouseup touchstart touchend touchcancel",n=>{r.controls.pressed=["mousedown","touchstart"].includes(n.type)}),this.bind(r.controls,"focusin",()=>{const{config:n,timers:o}=t;x(r.controls,n.classNames.noTransition,!0),E.toggleControls.call(t,!0),setTimeout(()=>{x(r.controls,n.classNames.noTransition,!1)},0);const l=this.touch?3e3:4e3;clearTimeout(o.controls),o.controls=setTimeout(()=>E.toggleControls.call(t,!1),l)}),this.bind(r.inputs.volume,"wheel",n=>{const o=n.webkitDirectionInvertedFromDevice,[l,c]=[n.deltaX,-n.deltaY].map(y=>o?-y:y),p=Math.sign(Math.abs(l)>Math.abs(c)?l:c);t.increaseVolume(p/50);const{volume:m}=t.media;(p===1&&m<1||p===-1&&m>0)&&n.preventDefault()},"volume",!1)}),this.player=i,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(i){const{player:t}=this,{elements:r}=t,{key:s,type:n,altKey:o,ctrlKey:l,metaKey:c,shiftKey:p}=i,m=n==="keydown",y=m&&s===this.lastKey;if(!(o||l||c||p)&&!!s){if(m){const v=document.activeElement;if(a.element(v)){const{editable:_}=t.config.selectors,{seek:k}=r.inputs;if(v!==k&&K(v,_)||i.key==="Space"&&K(v,'button, [role^="menuitem"]'))return}switch(["Space","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(s)&&(i.preventDefault(),i.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":y||(u=parseInt(s,10),t.currentTime=t.duration/10*u);break;case"Space":case"k":y||q(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":y||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":y||t.toggleCaptions();break;case"l":t.loop=!t.loop}s==="Escape"&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null;var u}}toggleMenu(i){d.toggleMenu.call(this.player,i)}}function yi(e,i){return e(i={exports:{}},i.exports),i.exports}var fi=yi(function(e,i){e.exports=function(){var t=function(){},r={},s={},n={};function o(u,v){u=u.push?u:[u];var _,k,S,w=[],P=u.length,g=P;for(_=function(C,L){L.length&&w.push(C),--g||v(w)};P--;)k=u[P],(S=s[k])?_(k,S):(n[k]=n[k]||[]).push(_)}function l(u,v){if(u){var _=n[u];if(s[u]=v,_)for(;_.length;)_[0](u,v),_.splice(0,1)}}function c(u,v){u.call&&(u={success:u}),v.length?(u.error||t)(v):(u.success||t)(u)}function p(u,v,_,k){var S,w,P=document,g=_.async,C=(_.numRetries||0)+1,L=_.before||t,j=u.replace(/[\?|#].*$/,""),U=u.replace(/^(css|img)!/,"");k=k||0,/(^css!|\.css$)/.test(j)?((w=P.createElement("link")).rel="stylesheet",w.href=U,(S="hideFocus"in w)&&w.relList&&(S=0,w.rel="preload",w.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(j)?(w=P.createElement("img")).src=U:((w=P.createElement("script")).src=u,w.async=g===void 0||g),w.onload=w.onerror=w.onbeforeload=function(Q){var oe=Q.type[0];if(S)try{w.sheet.cssText.length||(oe="e")}catch(_t){_t.code!=18&&(oe="e")}if(oe=="e"){if((k+=1)<C)return p(u,v,_,k)}else if(w.rel=="preload"&&w.as=="style")return w.rel="stylesheet";v(u,oe,Q.defaultPrevented)},L(u,w)!==!1&&P.head.appendChild(w)}function m(u,v,_){var k,S,w=(u=u.push?u:[u]).length,P=w,g=[];for(k=function(C,L,j){if(L=="e"&&g.push(C),L=="b"){if(!j)return;g.push(C)}--w||v(g)},S=0;S<P;S++)p(u[S],k,_)}function y(u,v,_){var k,S;if(v&&v.trim&&(k=v),S=(k?_:v)||{},k){if(k in r)throw"LoadJS";r[k]=!0}function w(P,g){m(u,function(C){c(S,C),P&&c({success:P,error:g},C),l(k,C)},S)}if(S.returnPromise)return new Promise(w);w()}return y.ready=function(u,v){return o(u,function(_){c(v,_)}),y},y.done=function(u){l(u,[])},y.reset=function(){r={},s={},n={}},y.isDefined=function(u){return u in r},y}()});function ze(e){return new Promise((i,t)=>{fi(e,{success:i,error:t})})}function bi(e){return a.empty(e)?null:a.number(Number(e))?e:e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}function vi(e){const i=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return i&&i.length===5?i[4]:null}function ee(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,b.call(this,this.media,e?"play":"pause"))}const Se={setup(){const e=this;x(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,G.call(e),a.object(window.Vimeo)?Se.ready.call(e):ze(e.config.urls.vimeo.sdk).then(()=>{Se.ready.call(e)}).catch(i=>{e.debug.warn("Vimeo SDK (player.js) failed to load",i)})},ready(){const e=this,i=e.config.vimeo,P=i,{premium:t,referrerPolicy:r}=P,s=He(P,["premium","referrerPolicy"]);let n=e.media.getAttribute("src"),o="";a.empty(n)?(n=e.media.getAttribute(e.config.attributes.embed.id),o=e.media.getAttribute(e.config.attributes.embed.hash)):o=vi(n);const l=o?{h:o}:{};t&&Object.assign(s,{controls:!1,sidedock:!1});const c=ft(D(D({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},l),s)),p=bi(n),m=f("iframe"),y=Ee(e.config.urls.vimeo.iframe,p,c);if(m.setAttribute("src",y),m.setAttribute("allowfullscreen",""),m.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),a.empty(r)||m.setAttribute("referrerPolicy",r),t||!i.customControls)m.setAttribute("data-poster",e.poster),e.media=me(m,e.media);else{const g=f("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});g.appendChild(m),e.media=me(g,e.media)}i.customControls||ae(Ee(e.config.urls.vimeo.api,y)).then(g=>{!a.empty(g)&&g.thumbnail_url&&E.setPoster.call(e,g.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(m,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(ee.call(e,!0),e.embed.play()),e.media.pause=()=>(ee.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:u}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>u,set(g){const{embed:C,media:L,paused:j,volume:U}=e,Q=j&&!C.hasPlayed;L.seeking=!0,b.call(e,L,"seeking"),Promise.resolve(Q&&C.setVolume(0)).then(()=>C.setCurrentTime(g)).then(()=>Q&&C.pause()).then(()=>Q&&C.setVolume(U)).catch(()=>{})}});let v=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>v,set(g){e.embed.setPlaybackRate(g).then(()=>{v=g,b.call(e,e.media,"ratechange")}).catch(()=>{e.options.speed=[1]})}});let{volume:_}=e.config;Object.defineProperty(e.media,"volume",{get:()=>_,set(g){e.embed.setVolume(g).then(()=>{_=g,b.call(e,e.media,"volumechange")})}});let{muted:k}=e.config;Object.defineProperty(e.media,"muted",{get:()=>k,set(g){const C=!!a.boolean(g)&&g;e.embed.setVolume(C?0:e.config.volume).then(()=>{k=C,b.call(e,e.media,"volumechange")})}});let S,{loop:w}=e.config;Object.defineProperty(e.media,"loop",{get:()=>w,set(g){const C=a.boolean(g)?g:e.config.loop.active;e.embed.setLoop(C).then(()=>{w=C})}}),e.embed.getVideoUrl().then(g=>{S=g,d.setDownloadUrl.call(e)}).catch(g=>{this.debug.warn(g)}),Object.defineProperty(e.media,"currentSrc",{get:()=>S}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(g=>{const[C,L]=g;e.embed.ratio=ut(C,L),G.call(this)}),e.embed.setAutopause(e.config.autopause).then(g=>{e.config.autopause=g}),e.embed.getVideoTitle().then(g=>{e.config.title=g,E.setTitle.call(this)}),e.embed.getCurrentTime().then(g=>{u=g,b.call(e,e.media,"timeupdate")}),e.embed.getDuration().then(g=>{e.media.duration=g,b.call(e,e.media,"durationchange")}),e.embed.getTextTracks().then(g=>{e.media.textTracks=g,A.setup.call(e)}),e.embed.on("cuechange",({cues:g=[]})=>{const C=g.map(L=>pi(L.text));A.updateCues.call(e,C)}),e.embed.on("loaded",()=>{e.embed.getPaused().then(g=>{ee.call(e,!g),g||b.call(e,e.media,"playing")}),a.element(e.embed.element)&&e.supported.ui&&e.embed.element.setAttribute("tabindex",-1)}),e.embed.on("bufferstart",()=>{b.call(e,e.media,"waiting")}),e.embed.on("bufferend",()=>{b.call(e,e.media,"playing")}),e.embed.on("play",()=>{ee.call(e,!0),b.call(e,e.media,"playing")}),e.embed.on("pause",()=>{ee.call(e,!1)}),e.embed.on("timeupdate",g=>{e.media.seeking=!1,u=g.seconds,b.call(e,e.media,"timeupdate")}),e.embed.on("progress",g=>{e.media.buffered=g.percent,b.call(e,e.media,"progress"),parseInt(g.percent,10)===1&&b.call(e,e.media,"canplaythrough"),e.embed.getDuration().then(C=>{C!==e.media.duration&&(e.media.duration=C,b.call(e,e.media,"durationchange"))})}),e.embed.on("seeked",()=>{e.media.seeking=!1,b.call(e,e.media,"seeked")}),e.embed.on("ended",()=>{e.media.paused=!0,b.call(e,e.media,"ended")}),e.embed.on("error",g=>{e.media.error=g,b.call(e,e.media,"error")}),i.customControls&&setTimeout(()=>E.build.call(e),0)}};function wi(e){return a.empty(e)?null:e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:e}function te(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,b.call(this,this.media,e?"play":"pause"))}function _i(e){return e.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const he={setup(){if(x(this.elements.wrapper,this.config.classNames.embed,!0),a.object(window.YT)&&a.function(window.YT.Player))he.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{a.function(e)&&e(),he.ready.call(this)},ze(this.config.urls.youtube.sdk).catch(i=>{this.debug.warn("YouTube API failed to load",i)})}},getTitle(e){ae(Ee(this.config.urls.youtube.api,e)).then(i=>{if(a.object(i)){const{title:t,height:r,width:s}=i;this.config.title=t,E.setTitle.call(this),this.embed.ratio=ut(s,r)}G.call(this)}).catch(()=>{G.call(this)})},ready(){const e=this,i=e.config.youtube,t=e.media&&e.media.getAttribute("id");if(!a.empty(t)&&t.startsWith("youtube-"))return;let r=e.media.getAttribute("src");a.empty(r)&&(r=e.media.getAttribute(this.config.attributes.embed.id));const s=wi(r),n=f("div",{id:ai(e.provider),"data-poster":i.customControls?e.poster:void 0});if(e.media=me(n,e.media),i.customControls){const o=l=>`https://i.ytimg.com/vi/${s}/${l}default.jpg`;ue(o("maxres"),121).catch(()=>ue(o("sd"),121)).catch(()=>ue(o("hq"))).then(l=>E.setPoster.call(e,l.src)).then(l=>{l.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}e.embed=new window.YT.Player(e.media,{videoId:s,host:_i(i),playerVars:N({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&i.customControls?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},i),events:{onError(o){if(!e.media.error){const l=o.data,c={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."}[l]||"An unknown error occured";e.media.error={code:l,message:c},b.call(e,e.media,"error")}},onPlaybackRateChange(o){const l=o.target;e.media.playbackRate=l.getPlaybackRate(),b.call(e,e.media,"ratechange")},onReady(o){if(a.function(e.media.play))return;const l=o.target;he.getTitle.call(e,s),e.media.play=()=>{te.call(e,!0),l.playVideo()},e.media.pause=()=>{te.call(e,!1),l.pauseVideo()},e.media.stop=()=>{l.stopVideo()},e.media.duration=l.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(l.getCurrentTime()),set(y){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,b.call(e,e.media,"seeking"),l.seekTo(y)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>l.getPlaybackRate(),set(y){l.setPlaybackRate(y)}});let{volume:c}=e.config;Object.defineProperty(e.media,"volume",{get:()=>c,set(y){c=y,l.setVolume(100*c),b.call(e,e.media,"volumechange")}});let{muted:p}=e.config;Object.defineProperty(e.media,"muted",{get:()=>p,set(y){const u=a.boolean(y)?y:p;p=u,l[u?"mute":"unMute"](),l.setVolume(100*c),b.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>l.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const m=l.getAvailablePlaybackRates();e.options.speed=m.filter(y=>e.config.speed.options.includes(y)),e.supported.ui&&i.customControls&&e.media.setAttribute("tabindex",-1),b.call(e,e.media,"timeupdate"),b.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=l.getVideoLoadedFraction(),(e.media.lastBuffered===null||e.media.lastBuffered<e.media.buffered)&&b.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,e.media.buffered===1&&(clearInterval(e.timers.buffering),b.call(e,e.media,"canplaythrough"))},200),i.customControls&&setTimeout(()=>E.build.call(e),50)},onStateChange(o){const l=o.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(o.data)&&(e.media.seeking=!1,b.call(e,e.media,"seeked")),o.data){case-1:b.call(e,e.media,"timeupdate"),e.media.buffered=l.getVideoLoadedFraction(),b.call(e,e.media,"progress");break;case 0:te.call(e,!1),e.media.loop?(l.stopVideo(),l.playVideo()):b.call(e,e.media,"ended");break;case 1:i.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(te.call(e,!0),b.call(e,e.media,"playing"),e.timers.playing=setInterval(()=>{b.call(e,e.media,"timeupdate")},50),e.media.duration!==l.getDuration()&&(e.media.duration=l.getDuration(),b.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),te.call(e,!1);break;case 3:b.call(e,e.media,"waiting")}b.call(e,e.elements.container,"statechange",!1,{code:o.data})}}})}},vt={setup(){this.media?(x(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),x(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&x(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=f("div",{class:this.config.classNames.video}),lt(this.media,this.elements.wrapper),this.elements.poster=f("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?W.setup.call(this):this.isYouTube?he.setup.call(this):this.isVimeo&&Se.setup.call(this)):this.debug.warn("No media element found!")}};class ki{constructor(i){h(this,"load",()=>{this.enabled&&(a.object(window.google)&&a.object(window.google.ima)?this.ready():ze(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),h(this,"ready",()=>{var t;this.enabled||((t=this).manager&&t.manager.destroy(),t.elements.displayContainer&&t.elements.displayContainer.destroy(),t.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),h(this,"setupIMA",()=>{this.elements.container=f("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,t=>this.onAdsManagerLoaded(t),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t=>this.onAdError(t),!1),this.requestAds()}),h(this,"requestAds",()=>{const{container:t}=this.player.elements;try{const r=new google.ima.AdsRequest;r.adTagUrl=this.tagUrl,r.linearAdSlotWidth=t.offsetWidth,r.linearAdSlotHeight=t.offsetHeight,r.nonLinearAdSlotWidth=t.offsetWidth,r.nonLinearAdSlotHeight=t.offsetHeight,r.forceNonLinearFullSlot=!1,r.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(r)}catch(r){this.onAdError(r)}}),h(this,"pollCountdown",(t=!1)=>{if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const r=ve(Math.max(this.manager.getRemainingTime(),0)),s=`${$.get("advertisement",this.player.config)} - ${r}`;this.elements.container.setAttribute("data-badge-text",s)},100)}),h(this,"onAdsManagerLoaded",t=>{if(!this.enabled)return;const r=new google.ima.AdsRenderingSettings;r.restoreCustomPlaybackStateOnAdBreakComplete=!0,r.enablePreloading=!0,this.manager=t.getAdsManager(this.player,r),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,s=>this.onAdError(s)),Object.keys(google.ima.AdEvent.Type).forEach(s=>{this.manager.addEventListener(google.ima.AdEvent.Type[s],n=>this.onAdEvent(n))}),this.trigger("loaded")}),h(this,"addCuePoints",()=>{a.empty(this.cuePoints)||this.cuePoints.forEach(t=>{if(t!==0&&t!==-1&&t<this.player.duration){const r=this.player.elements.progress;if(a.element(r)){const s=100/this.player.duration*t,n=f("span",{class:this.player.config.classNames.cues});n.style.left=`${s.toString()}%`,r.appendChild(n)}}})}),h(this,"onAdEvent",t=>{const{container:r}=this.player.elements,s=t.getAd(),n=t.getAdData();switch((o=>{b.call(this.player,this.player.media,`ads${o.replace(/_/g,"").toLowerCase()}`)})(t.type),t.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),s.isLinear()||(s.width=r.offsetWidth,s.height=r.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:n.adError&&this.player.debug.warn(`Non-fatal ad error: ${n.adError.getMessage()}`)}}),h(this,"onAdError",t=>{this.cancel(),this.player.debug.warn("Ads error",t)}),h(this,"listeners",()=>{const{container:t}=this.player.elements;let r;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{r=this.player.currentTime}),this.player.on("seeked",()=>{const s=this.player.currentTime;a.empty(this.cuePoints)||this.cuePoints.forEach((n,o)=>{r<n&&n<s&&(this.manager.discardAdBreak(),this.cuePoints.splice(o,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL)})}),h(this,"play",()=>{const{container:t}=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(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(r){this.onAdError(r)}}).catch(()=>{})}),h(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,q(this.player.media.play())}),h(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),h(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),h(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(t=>{this.on("loaded",t),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),h(this,"trigger",(t,...r)=>{const s=this.events[t];a.array(s)&&s.forEach(n=>{a.function(n)&&n.apply(this,r)})}),h(this,"on",(t,r)=>(a.array(this.events[t])||(this.events[t]=[]),this.events[t].push(r),this)),h(this,"startSafetyTimer",(t,r)=>{this.player.debug.log(`Safety timer invoked from: ${r}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},t)}),h(this,"clearSafetyTimer",t=>{a.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${t}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=i,this.config=i.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((t,r)=>{this.on("loaded",t),this.on("error",r)}),this.load()}get enabled(){const{config:i}=this;return this.player.isHTML5&&this.player.isVideo&&i.enabled&&(!a.empty(i.publisherId)||a.url(i.tagUrl))}get tagUrl(){const{config:i}=this;return a.url(i.tagUrl)?i.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${ft({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:i.publisherId})}`}}function wt(e=0,i=0,t=255){return Math.min(Math.max(e,i),t)}const xi=e=>{const i=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach(t=>{const r={};t.split(/\r\n|\n|\r/).forEach(s=>{if(a.number(r.startTime)){if(!a.empty(s.trim())&&a.empty(r.text)){const n=s.trim().split("#xywh=");[r.text]=n,n[1]&&([r.x,r.y,r.w,r.h]=n[1].split(","))}}else{const n=s.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})/);n&&(r.startTime=60*Number(n[1]||0)*60+60*Number(n[2])+Number(n[3])+Number(`0.${n[4]}`),r.endTime=60*Number(n[6]||0)*60+60*Number(n[7])+Number(n[8])+Number(`0.${n[9]}`))}}),r.text&&i.push(r)}),i},Qe=(e,i)=>{const t={};return e>i.width/i.height?(t.width=i.width,t.height=1/e*i.width):(t.height=i.height,t.width=e*i.height),t};class Pe{constructor(i){h(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.loaded=!0)})}),h(this,"getThumbnails",()=>new Promise(t=>{const{src:r}=this.player.config.previewThumbnails;if(a.empty(r))throw new Error("Missing previewThumbnails.src config attribute");const s=()=>{this.thumbnails.sort((n,o)=>n.height-o.height),this.player.debug.log("Preview thumbnails",this.thumbnails),t()};if(a.function(r))r(n=>{this.thumbnails=n,s()});else{const n=(a.string(r)?[r]:r).map(o=>this.getThumbnail(o));Promise.all(n).then(s)}})),h(this,"getThumbnail",t=>new Promise(r=>{ae(t).then(s=>{const n={frames:xi(s),height:null,urlPrefix:""};n.frames[0].text.startsWith("/")||n.frames[0].text.startsWith("http://")||n.frames[0].text.startsWith("https://")||(n.urlPrefix=t.substring(0,t.lastIndexOf("/")+1));const o=new Image;o.onload=()=>{n.height=o.naturalHeight,n.width=o.naturalWidth,this.thumbnails.push(n),r()},o.src=n.urlPrefix+n.frames[0].text})})),h(this,"startMove",t=>{if(this.loaded&&a.event(t)&&["touchmove","mousemove"].includes(t.type)&&this.player.media.duration){if(t.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var r,s;const n=this.player.elements.progress.getBoundingClientRect(),o=100/n.width*(t.pageX-n.left);this.seekTime=this.player.media.duration*(o/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=t.pageX,this.elements.thumb.time.innerText=ve(this.seekTime);const l=(r=this.player.config.markers)===null||r===void 0||(s=r.points)===null||s===void 0?void 0:s.find(({time:c})=>c===Math.round(this.seekTime));l&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${l.label}<br>`)}this.showImageAtCurrentTime()}}),h(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),h(this,"startScrubbing",t=>{(a.nullOrUndefined(t.button)||t.button===!1||t.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),h(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Ie.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),h(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})}),h(this,"render",()=>{this.elements.thumb.container=f("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=f("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const t=f("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=f("span",{},"00:00"),t.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(t),a.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=f("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),h(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),h(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const t=this.thumbnails[0].frames.findIndex(n=>this.seekTime>=n.startTime&&this.seekTime<=n.endTime),r=t>=0;let s=0;this.mouseDown||this.toggleThumbContainer(r),r&&(this.thumbnails.forEach((n,o)=>{this.loadedImages.includes(n.frames[t].text)&&(s=o)}),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(s)))}),h(this,"loadImage",(t=0)=>{const r=this.showingThumb,s=this.thumbnails[t],{urlPrefix:n}=s,o=s.frames[r],l=s.frames[r].text,c=n+l;if(this.currentImageElement&&this.currentImageElement.dataset.filename===l)this.showImage(this.currentImageElement,o,t,r,l,!1),this.currentImageElement.dataset.index=r,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const p=new Image;p.src=c,p.dataset.index=r,p.dataset.filename=l,this.showingThumbFilename=l,this.player.debug.log(`Loading image: ${c}`),p.onload=()=>this.showImage(p,o,t,r,l,!0),this.loadingImage=p,this.removeOldImages(p)}}),h(this,"showImage",(t,r,s,n,o,l=!0)=>{this.player.debug.log(`Showing thumb: ${o}. num: ${n}. qual: ${s}. newimg: ${l}`),this.setImageSizeAndOffset(t,r),l&&(this.currentImageContainer.appendChild(t),this.currentImageElement=t,this.loadedImages.includes(o)||this.loadedImages.push(o)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(s,t,r,o))}),h(this,"removeOldImages",t=>{Array.from(this.currentImageContainer.children).forEach(r=>{if(r.tagName.toLowerCase()!=="img")return;const s=this.usingSprites?500:1e3;if(r.dataset.index!==t.dataset.index&&!r.dataset.deleting){r.dataset.deleting=!0;const{currentImageContainer:n}=this;setTimeout(()=>{n.removeChild(r),this.player.debug.log(`Removing thumb: ${r.dataset.filename}`)},s)}})}),h(this,"preloadNearby",(t,r=!0)=>new Promise(s=>{setTimeout(()=>{const n=this.thumbnails[0].frames[t].text;if(this.showingThumbFilename===n){let o;o=r?this.thumbnails[0].frames.slice(t):this.thumbnails[0].frames.slice(0,t).reverse();let l=!1;o.forEach(c=>{const p=c.text;if(p!==n&&!this.loadedImages.includes(p)){l=!0,this.player.debug.log(`Preloading thumb filename: ${p}`);const{urlPrefix:m}=this.thumbnails[0],y=m+p,u=new Image;u.src=y,u.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${p}`),this.loadedImages.includes(p)||this.loadedImages.push(p),s()}}}),l||s()}},300)})),h(this,"getHigherQuality",(t,r,s,n)=>{if(t<this.thumbnails.length-1){let o=r.naturalHeight;this.usingSprites&&(o=s.h),o<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===n&&(this.player.debug.log(`Showing higher quality thumb for: ${n}`),this.loadImage(t+1))},300)}}),h(this,"toggleThumbContainer",(t=!1,r=!1)=>{const s=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(s,t),!t&&r&&(this.showingThumb=null,this.showingThumbFilename=null)}),h(this,"toggleScrubbingContainer",(t=!1)=>{const r=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(r,t),t||(this.showingThumb=null,this.showingThumbFilename=null)}),h(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),h(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:t}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(t.clientHeight>20&&t.clientWidth<20){const r=Math.floor(t.clientHeight*this.thumbAspectRatio);t.style.width=`${r}px`}else if(t.clientHeight<20&&t.clientWidth>20){const r=Math.floor(t.clientWidth/this.thumbAspectRatio);t.style.height=`${r}px`}}else{const r=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);t.style.height=`${this.thumbContainerHeight}px`,t.style.width=`${r}px`}this.setThumbContainerPos()}),h(this,"setThumbContainerPos",()=>{const t=this.player.elements.progress.getBoundingClientRect(),r=this.player.elements.container.getBoundingClientRect(),{container:s}=this.elements.thumb,n=r.left-t.left+10,o=r.right-t.left-s.clientWidth-10,l=this.mousePosX-t.left-s.clientWidth/2,c=wt(l,n,o);s.style.left=`${c}px`,s.style.setProperty("--preview-arrow-offset",l-c+"px")}),h(this,"setScrubbingContainerSize",()=>{const{width:t,height:r}=Qe(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${t}px`,this.elements.scrubbing.container.style.height=`${r}px`}),h(this,"setImageSizeAndOffset",(t,r)=>{if(!this.usingSprites)return;const s=this.thumbContainerHeight/r.h;t.style.height=t.naturalHeight*s+"px",t.style.width=t.naturalWidth*s+"px",t.style.left=`-${r.x*s}px`,t.style.top=`-${r.y*s}px`}),this.player=i,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:i}=Qe(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return i}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(i){this.mouseDown?this.currentScrubbingImageElement=i:this.currentThumbnailImageElement=i}}const Me={insertElements(e,i){a.string(i)?Be(e,this.media,{src:i}):a.array(i)&&i.forEach(t=>{Be(e,this.media,t)})},change(e){ot(e,"sources.length")?(W.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],F(this.media),this.media=null,a.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:i,type:t}=e,[{provider:r=B.html5,src:s}]=i,n=r==="html5"?t:"div",o=r==="html5"?{}:{src:s};Object.assign(this,{provider:r,type:t,supported:M.check(t,r,this.config.playsinline),media:f(n,o)}),this.elements.container.appendChild(this.media),a.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),a.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","")),E.addStyleHook.call(this),this.isHTML5&&Me.insertElements.call(this,"source",i),this.config.title=e.title,vt.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&Me.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&E.build.call(this),this.isHTML5&&this.media.load(),a.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 Pe(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class se{constructor(i,t){if(h(this,"play",()=>a.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>q(this.media.play())),this.media.play()):null),h(this,"pause",()=>this.playing&&a.function(this.media.pause)?this.media.pause():null),h(this,"togglePlay",l=>(a.boolean(l)?l:!this.playing)?this.play():this.pause()),h(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):a.function(this.media.stop)&&this.media.stop()}),h(this,"restart",()=>{this.currentTime=0}),h(this,"rewind",l=>{this.currentTime-=a.number(l)?l:this.config.seekTime}),h(this,"forward",l=>{this.currentTime+=a.number(l)?l:this.config.seekTime}),h(this,"increaseVolume",l=>{const c=this.media.muted?0:this.volume;this.volume=c+(a.number(l)?l:0)}),h(this,"decreaseVolume",l=>{this.increaseVolume(-l)}),h(this,"airplay",()=>{M.airplay&&this.media.webkitShowPlaybackTargetPicker()}),h(this,"toggleControls",l=>{if(this.supported.ui&&!this.isAudio){const c=ge(this.elements.container,this.config.classNames.hideControls),p=l===void 0?void 0:!l,m=x(this.elements.container,this.config.classNames.hideControls,p);if(m&&a.array(this.config.controls)&&this.config.controls.includes("settings")&&!a.empty(this.config.settings)&&d.toggleMenu.call(this,!1),m!==c){const y=m?"controlshidden":"controlsshown";b.call(this,this.media,y)}return!m}return!1}),h(this,"on",(l,c)=>{T.call(this,this.elements.container,l,c)}),h(this,"once",(l,c)=>{Ie.call(this,this.elements.container,l,c)}),h(this,"off",(l,c)=>{be(this.elements.container,l,c)}),h(this,"destroy",(l,c=!1)=>{if(!this.ready)return;const p=()=>{document.body.style.overflow="",this.embed=null,c?(Object.keys(this.elements).length&&(F(this.elements.buttons.play),F(this.elements.captions),F(this.elements.controls),F(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),a.function(l)&&l()):(ri.call(this),W.cancelRequests.call(this),me(this.elements.original,this.elements.container),b.call(this,this.elements.original,"destroyed",!0),a.function(l)&&l.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?(E.toggleNativeControls.call(this,!0),p()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&a.function(this.embed.destroy)&&this.embed.destroy(),p()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(p),setTimeout(p,200))}),h(this,"supports",l=>M.mime.call(this,l)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=M.touch,this.media=i,a.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||a.nodeList(this.media)||a.array(this.media))&&(this.media=this.media[0]),this.config=N({},bt,se.defaults,t||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{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 mi(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",M),a.nullOrUndefined(this.media)||!a.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(!M.check().api)return void this.debug.error("Setup failed: no support");const r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;const s=this.media.tagName.toLowerCase();let n=null,o=null;switch(s){case"div":if(n=this.media.querySelector("iframe"),a.element(n)){if(o=yt(n.getAttribute("src")),this.provider=hi(o.toString()),this.elements.container=this.media,this.media=n,this.elements.container.className="",o.search.length){const l=["1","true"];l.includes(o.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(o.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(o.searchParams.get("playsinline")),this.config.youtube.hl=o.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(a.empty(this.provider)||!Object.values(B).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=ke.video;break;case"video":case"audio":this.type=s,this.provider=B.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=M.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new gi(this),this.storage=new re(this),this.media.plyr=this,a.element(this.elements.container)||(this.elements.container=f("div",{tabindex:0}),lt(this.media,this.elements.container)),E.migrateStyles.call(this),E.addStyleHook.call(this),vt.setup.call(this),this.config.debug&&T.call(this,this.elements.container,this.config.events.join(" "),l=>{this.debug.log(`event: ${l.type}`)}),this.fullscreen=new R(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&E.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new ki(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>q(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Pe(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===B.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===B.youtube}get isVimeo(){return this.provider===B.vimeo}get isVideo(){return this.type===ke.video}get isAudio(){return this.type===ke.audio}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&this.currentTime===0)}get ended(){return Boolean(this.media.ended)}set currentTime(i){if(!this.duration)return;const t=a.number(i)&&i>0;this.media.currentTime=t?Math.min(i,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:i}=this.media;return a.number(i)?i:i&&i.length&&this.duration>0?i.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const i=parseFloat(this.config.duration),t=(this.media||{}).duration,r=a.number(t)&&t!==1/0?t:0;return i||r}set volume(i){let t=i;a.string(t)&&(t=Number(t)),a.number(t)||(t=this.storage.get("volume")),a.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!a.empty(i)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(i){let t=i;a.boolean(t)||(t=this.storage.get("muted")),a.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(i){let t=null;a.number(i)&&(t=i),a.number(t)||(t=this.storage.get("speed")),a.number(t)||(t=this.config.speed.selected);const{minimumSpeed:r,maximumSpeed:s}=this;t=wt(t,r,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(i){const t=this.config.quality,r=this.options.quality;if(!r.length)return;let s=[!a.empty(i)&&Number(i),this.storage.get("quality"),t.selected,t.default].find(a.number),n=!0;if(!r.includes(s)){const o=ct(r,s);this.debug.warn(`Unsupported quality option: ${s}, using ${o} instead`),s=o,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(i){const t=a.boolean(i)?i:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(i){Me.change.call(this,i)}get source(){return this.media.currentSrc}get download(){const{download:i}=this.config.urls;return a.url(i)?i:this.source}set download(i){a.url(i)&&(this.config.urls.download=i,d.setDownloadUrl.call(this))}set poster(i){this.isVideo?E.setPoster.call(this,i,!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 i=ye($e.call(this));return a.array(i)?i.join(":"):i}set ratio(i){this.isVideo?a.string(i)&&dt(i)?(this.config.ratio=ye(i),G.call(this)):this.debug.error(`Invalid aspect ratio specified (${i})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(i){this.config.autoplay=a.boolean(i)?i:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(i){A.toggle.call(this,i,!1)}set currentTrack(i){A.set.call(this,i,!1),A.setup.call(this)}get currentTrack(){const{toggled:i,currentTrack:t}=this.captions;return i?t:-1}set language(i){A.setLanguage.call(this,i,!1)}get language(){return(A.getCurrentTrack.call(this)||{}).language}set pip(i){if(!M.pip)return;const t=a.boolean(i)?i:!this.pip;a.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?_e.active:_e.inactive),a.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return M.pip?a.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===_e.active:null}setPreviewThumbnails(i){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,i),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Pe(this))}static supported(i,t,r){return M.check(i,t,r)}static loadSprite(i,t){return mt(i,t)}static setup(i,t={}){let r=null;return a.string(i)?r=Array.from(document.querySelectorAll(i)):a.nodeList(i)?r=Array.from(i):a.array(i)&&(r=i.filter(a.element)),a.empty(r)?null:r.map(s=>new se(s,t))}}se.defaults=Zt(bt);var Ai=Ct({name:"colVideo",props:{setting:{type:Object,default:()=>{}},controls:Boolean,height:String,src:{type:String,default:""},poster:{type:String,default:""},styleValue:{type:Object,default:()=>({})},type:{type:String,default:"video"}},data(){return{player:null}},mounted(){this._init()},methods:{_init(){let e=["play-large","play","progress","captions","fullscreen","duration","volume"];this.player=new se(this.$refs.video,D({controls:e},this.setting))}},render(){return pe("div",{class:Re["video-container"]},[this.type=="video"?pe("video",{"object-fit":"fill",ref:"video",src:this.src,poster:this.poster,style:D({},this.styleValue)},null):pe("div",{class:Re.audios},[pe("audio",{"object-fit":"fill",ref:"video",src:this.src,style:D({},this.styleValue)},null)])])}});export{Ai as c};
|