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