# Conflicts: # dist/plyr.js # dist/plyr.js.map # dist/plyr.min.js # dist/plyr.min.js.map # dist/plyr.polyfilled.js # dist/plyr.polyfilled.js.map # dist/plyr.polyfilled.min.js # dist/plyr.polyfilled.min.js.map # src/js/controls.js # src/js/fullscreen.js # src/js/plyr.js # src/js/ui.js # src/js/utils.js
3 lines
92 KiB
JavaScript
3 lines
92 KiB
JavaScript
"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):e.Plyr=t()}(this,function(){"use strict";var e=function(e){return null!=e?e.constructor:null},t=function(e,t){return Boolean(e&&t&&e instanceof t)},i={object:function(t){return e(t)===Object},number:function(t){return e(t)===Number&&!Number.isNaN(t)},string:function(t){return e(t)===String},boolean:function(t){return e(t)===Boolean},function:function(t){return e(t)===Function},array:function(e){return!i.nullOrUndefined(e)&&Array.isArray(e)},weakMap:function(e){return t(e,WeakMap)},nodeList:function(e){return t(e,NodeList)},element:function(e){return t(e,Element)},textNode:function(t){return e(t)===Text},event:function(e){return t(e,Event)},cue:function(e){return t(e,window.TextTrackCue)||t(e,window.VTTCue)},track:function(e){return t(e,TextTrack)||!i.nullOrUndefined(e)&&i.string(e.kind)},url:function(e){return!i.nullOrUndefined(e)&&/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(e)},nullOrUndefined:function(e){return null==e},empty:function(e){return i.nullOrUndefined(e)||(i.string(e)||i.array(e)||i.nodeList(e))&&!e.length||i.object(e)&&!Object.keys(e).length}},n=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function a(e,t,a){var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this,l=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!i.empty(t)&&i.function(a)){var c=t.split(" "),u=o;n&&(u={passive:l,capture:o}),c.forEach(function(t){r&&r.eventListeners&&s&&r.eventListeners.push({element:e,type:t,callback:a,options:u}),e[s?"addEventListener":"removeEventListener"](t,a,u)})}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];a.call(this,e,t,i,!0,n,s)}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];a.call(this,e,t,i,!1,n,s)}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];a.call(this,e,t,function a(){r(e,t,a,n,s);for(var l=arguments.length,o=Array(l),c=0;c<l;c++)o[c]=arguments[c];i.apply(this,o)},!0,n,s)}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(i.element(e)&&!i.empty(t)){var s=new CustomEvent(t,{bubbles:n,detail:Object.assign({},a,{plyr:this})});e.dispatchEvent(s)}}var c=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),d=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},p=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,a=!1,s=void 0;try{for(var r,l=e[Symbol.iterator]();!(n=(r=l.next()).done)&&(i.push(r.value),!t||i.length!==t);n=!0);}catch(e){a=!0,s=e}finally{try{!n&&l.return&&l.return()}finally{if(a)throw s}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function h(e,t){var i=e.length?e:[e];Array.from(i).reverse().forEach(function(e,i){var n=i>0?t.cloneNode(!0):t,a=e.parentNode,s=e.nextSibling;n.appendChild(e),s?a.insertBefore(n,s):a.appendChild(n)})}function m(e,t){i.element(e)&&!i.empty(t)&&Object.entries(t).filter(function(e){var t=p(e,2)[1];return!i.nullOrUndefined(t)}).forEach(function(t){var i=p(t,2),n=i[0],a=i[1];return e.setAttribute(n,a)})}function f(e,t,n){var a=document.createElement(e);return i.object(t)&&m(a,t),i.string(n)&&(a.innerText=n),a}function g(e,t,i,n){t.appendChild(f(e,i,n))}function y(e){i.nodeList(e)||i.array(e)?Array.from(e).forEach(y):i.element(e)&&i.element(e.parentNode)&&e.parentNode.removeChild(e)}function v(e){for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function b(e,t){return i.element(t)&&i.element(t.parentNode)&&i.element(e)?(t.parentNode.replaceChild(e,t),e):null}function k(e,t){if(!i.string(e)||i.empty(e))return{};var n={},a=t;return e.split(",").forEach(function(e){var t=e.trim(),s=t.replace(".",""),r=t.replace(/[[\]]/g,"").split("="),l=r[0],o=r.length>1?r[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":i.object(a)&&i.string(a.class)&&(a.class+=" "+s),n.class=s;break;case"#":n.id=t.replace("#","");break;case"[":n[l]=o}}),n}function w(e,t){if(i.element(e)){var n=t;i.boolean(n)||(n=!e.hasAttribute("hidden")),n?e.setAttribute("hidden",""):e.removeAttribute("hidden")}}function T(e,t,n){if(i.element(e)){var a="toggle";return void 0!==n&&(a=n?"add":"remove"),e.classList[a](t),e.classList.contains(t)}return null}function A(e,t){return i.element(e)&&e.classList.contains(t)}function C(e,t){var i={Element:Element};return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function E(e){return this.elements.container.querySelectorAll(e)}function S(e){return this.elements.container.querySelector(e)}function P(){var e=document.activeElement;return e=e&&e!==document.body?document.querySelector(":focus"):null}var N,L,x,M=(N=document.createElement("span"),L={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},x=Object.keys(L).find(function(e){return void 0!==N.style[e]}),!!i.string(x)&&L[x]);var _,q={isIE:!!document.documentMode,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)},I={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},O={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,i){var n=q.isIPhone&&i&&O.playsinline,a=O[e]||"html5"!==t;return{api:a,ui:a&&O.rangeInput&&("video"!==e||!q.isIPhone||n)}},pip:!q.isIPhone&&i.function(f("video").webkitSetPresentationMode),airplay:i.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){var t=e.split("/"),i=p(t,1)[0];if(!this.isHTML5||i!==this.type)return!1;var n=void 0;e&&e.includes("codecs=")?n=e:"audio/mpeg"===e?n="audio/mpeg;":e in I&&(n=e+'; codecs="'+I[e]+'"');try{return Boolean(n&&this.media.canPlayType(n).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(_=document.createElement("input"),_.type="range","range"===_.type),touch:"ontouchstart"in document.documentElement,transitions:!1!==M,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},j={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(function(t){return O.mime.call(e,t.getAttribute("type"))}):[]},getQualityOptions:function(){return j.getSources.call(this).map(function(e){return Number(e.getAttribute("size"))}).filter(Boolean)},extend:function(){if(this.isHTML5){var e=this;Object.defineProperty(e.media,"quality",{get:function(){var t=j.getSources.call(e).filter(function(t){return t.getAttribute("src")===e.source}),i=p(t,1)[0];return i&&Number(i.getAttribute("size"))},set:function(t){var i=j.getSources.call(e).find(function(e){return Number(e.getAttribute("size"))===t});if(i){var n=e.currentTime,a=e.playing;e.media.src=i.getAttribute("src");e.once("loadedmetadata",function(){e.currentTime=n}),e.media.load(),a&&e.play(),o.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(y(j.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function R(e,t){return t.split(".").reduce(function(e,t){return e&&e[t]},e)}function V(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(!n.length)return e;var s=n.shift();return i.object(s)?(Object.keys(s).forEach(function(t){i.object(s[t])?(Object.keys(e).includes(t)||Object.assign(e,d({},t,{})),V(e[t],s[t])):Object.assign(e,d({},t,s[t]))}),V.apply(void 0,[e].concat(n))):e}function H(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return i.empty(e)?e:e.toString().replace(/{(\d+)}/g,function(e,t){return n[t].toString()})}function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString())}function D(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}function F(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return(e=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return e=B(e,"-"," "),e=B(e,"_"," "),B(e=D(e)," ","")}(e)).charAt(0).toLowerCase()+e.slice(1)}function U(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i.empty(e)||i.empty(t))return"";var n=R(t.i18n,e);if(i.empty(n))return"";var a={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(a).forEach(function(e){var t=p(e,2),i=t[0],a=t[1];n=B(n,i,a)}),n};function W(e){return i.array(e)?e.filter(function(t,i){return e.indexOf(t)===i}):e}var K=function(){function e(t){c(this,e),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}return u(e,[{key:"get",value:function(t){if(!e.supported||!this.enabled)return null;var n=window.localStorage.getItem(this.key);if(i.empty(n))return null;var a=JSON.parse(n);return i.string(t)&&t.length?a[t]:a}},{key:"set",value:function(t){if(e.supported&&this.enabled&&i.object(t)){var n=this.get();i.empty(n)&&(n={}),V(n,t),window.localStorage.setItem(this.key,JSON.stringify(n))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),e}();function Y(e,t){if(i.string(e)){var n=i.string(t),a=function(){return null!==document.getElementById(t)},s=function(e,t){e.innerHTML=t,n&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!n||!a()){var r=K.supported,l=document.createElement("div");if(l.setAttribute("hidden",""),n&&l.setAttribute("id",t),r){var o=window.localStorage.getItem("cache-"+t);if(null!==o){var c=JSON.parse(o);s(l,c.content)}}fetch(e).then(function(e){i.empty(e)||(r&&window.localStorage.setItem("cache-"+t,JSON.stringify({content:e})),s(l,e))}).catch(function(){})}}}var Q=function(e){return parseInt(e/60/60%60,10)},J=function(e){return parseInt(e/60%60,10)},$=function(e){return parseInt(e%60,10)};function X(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!i.number(e))return X(null,t,n);var a=function(e){return("0"+e).slice(-2)},s=Q(e),r=J(e),l=$(e);return t||s>0?s+=":":s="",(n&&e>0?"-":"")+s+a(r)+":"+a(l)}var G={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||q.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=S.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:E.call(this,this.config.selectors.buttons.play),pause:S.call(this,this.config.selectors.buttons.pause),restart:S.call(this,this.config.selectors.buttons.restart),rewind:S.call(this,this.config.selectors.buttons.rewind),fastForward:S.call(this,this.config.selectors.buttons.fastForward),mute:S.call(this,this.config.selectors.buttons.mute),pip:S.call(this,this.config.selectors.buttons.pip),airplay:S.call(this,this.config.selectors.buttons.airplay),settings:S.call(this,this.config.selectors.buttons.settings),captions:S.call(this,this.config.selectors.buttons.captions),fullscreen:S.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=S.call(this,this.config.selectors.progress),this.elements.inputs={seek:S.call(this,this.config.selectors.inputs.seek),volume:S.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:S.call(this,this.config.selectors.display.buffer),currentTime:S.call(this,this.config.selectors.display.currentTime),duration:S.call(this,this.config.selectors.display.duration)},i.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector("."+this.config.classNames.tooltip)),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var i=G.getIconUrl.call(this),n=(i.cors?"":i.url)+"#"+this.config.iconPrefix,a=document.createElementNS("http://www.w3.org/2000/svg","svg");m(a,V(t,{role:"presentation",focusable:"false"}));var s=document.createElementNS("http://www.w3.org/2000/svg","use"),r=n+"-"+e;return"href"in s?s.setAttributeNS("http://www.w3.org/1999/xlink","href",r):s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),a.appendChild(s),a},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={pip:"PIP",airplay:"AirPlay"}[e]||z(e,this.config);return f("span",Object.assign({},t,{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),i)},createBadge:function(e){if(i.empty(e))return null;var t=f("span",{class:this.config.classNames.menu.value});return t.appendChild(f("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var n=f("button"),a=Object.assign({},t),s=F(e),r=!1,l=void 0,o=void 0,c=void 0,u=void 0;switch("type"in a||(a.type="button"),"class"in a?a.class.includes(this.config.classNames.control)&&(a.class+=" "+this.config.classNames.control):a.class=this.config.classNames.control,e){case"play":r=!0,l="play",c="pause",o="play",u="pause";break;case"mute":r=!0,l="mute",c="unmute",o="volume",u="muted";break;case"captions":r=!0,l="enableCaptions",c="disableCaptions",o="captions-off",u="captions-on";break;case"fullscreen":r=!0,l="enterFullscreen",c="exitFullscreen",o="enter-fullscreen",u="exit-fullscreen";break;case"play-large":a.class+=" "+this.config.classNames.control+"--overlaid",s="play",l="play",o="play";break;default:l=s,o=e}r?(n.appendChild(G.createIcon.call(this,u,{class:"icon--pressed"})),n.appendChild(G.createIcon.call(this,o,{class:"icon--not-pressed"})),n.appendChild(G.createLabel.call(this,c,{class:"label--pressed"})),n.appendChild(G.createLabel.call(this,l,{class:"label--not-pressed"}))):(n.appendChild(G.createIcon.call(this,o)),n.appendChild(G.createLabel.call(this,l))),V(a,k(this.config.selectors.buttons[s],a)),m(n,a),"play"===s?(i.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(n)):this.elements.buttons[s]=n;var d=this.config.classNames.controlPressed;return Object.defineProperty(n,"pressed",{enumerable:!0,get:function(){return A(n,d)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];T(n,d,e)}}),n},createRange:function(e,t){var i=f("input",V(k(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":z(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,G.updateRangeFill.call(this,i),i},createProgress:function(e,t){var i=f("progress",V(k(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"presentation","aria-hidden":!0},t));if("volume"!==e){i.appendChild(f("span",null,"0"));var n={played:"played",buffer:"buffered"}[e],a=n?z(n,this.config):"";i.innerText="% "+a.toLowerCase()}return this.elements.display[e]=i,i},createTime:function(e){var t=k(this.config.selectors.display[e]),i=f("div",V(t,{class:"plyr__time "+t.class,"aria-label":z(e,this.config)}),"00:00");return this.elements.display[e]=i,i},createMenuItem:function(e){var t=e.value,n=e.list,a=e.type,s=e.title,r=e.badge,l=void 0===r?null:r,o=e.checked,c=void 0!==o&&o,u=f("li"),d=f("label",{class:this.config.classNames.control}),p=f("input",V(k(this.config.selectors.inputs[a]),{type:"radio",name:"plyr-"+a,value:t,checked:c,class:"plyr__sr-only"})),h=f("span",{hidden:""});d.appendChild(p),d.appendChild(h),d.insertAdjacentHTML("beforeend",s),i.element(l)&&d.appendChild(l),u.appendChild(d),n.appendChild(u)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.number(e)?X(e,Q(this.duration)>0,t):e},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.element(e)&&i.number(t)&&(e.innerText=G.formatTime(t,n))},updateVolume:function(){this.supported.ui&&(i.element(this.elements.inputs.volume)&&G.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),i.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i.element(e)&&(e.value=t,G.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&i.event(e)){var n,a,s=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":n=this.currentTime,a=this.duration,s=0===n||0===a||Number.isNaN(n)||Number.isNaN(a)?0:(n/a*100).toFixed(2),"timeupdate"===e.type&&G.setRange.call(this,this.elements.inputs.seek,s);break;case"playing":case"progress":!function(e,n){var a=i.number(n)?n:0,s=i.element(e)?e:t.elements.display.buffer;if(i.element(s)){s.value=a;var r=s.getElementsByTagName("span")[0];i.element(r)&&(r.childNodes[0].nodeValue=a)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=i.event(e)?e.target:e;if(i.element(t)&&"range"===t.getAttribute("type")){if(C(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var n=G.formatTime(this.currentTime),a=G.formatTime(this.duration),s=z("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",n).replace("{duration}",a))}else if(C(t,this.config.selectors.inputs.volume)){var r=100*t.value;t.setAttribute("aria-valuenow",r),t.setAttribute("aria-valuetext",r+"%")}else t.setAttribute("aria-valuenow",t.value);q.isWebkit&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&i.element(this.elements.inputs.seek)&&i.element(this.elements.display.seekTooltip)&&0!==this.duration){var n=0,a=this.elements.progress.getBoundingClientRect(),s=this.config.classNames.tooltip+"--visible",r=function(e){T(t.elements.display.seekTooltip,s,e)};if(this.touch)r(!1);else{if(i.event(e))n=100/a.width*(e.pageX-a.left);else{if(!A(this.elements.display.seekTooltip,s))return;n=parseFloat(this.elements.display.seekTooltip.style.left,10)}n<0?n=0:n>100&&(n=100),G.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*n),this.elements.display.seekTooltip.style.left=n+"%",i.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&r("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!i.element(this.elements.display.duration)&&this.config.invertTime;G.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||G.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){i.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=i.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&G.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&G.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),G.updateSeekTooltip.call(this)}},toggleTab:function(e,t){w(this.elements.settings.tabs[e],!t)},setQualityMenu:function(e){var t=this;if(i.element(this.elements.settings.panes.quality)){var n=this.elements.settings.panes.quality.querySelector("ul");i.array(e)&&(this.options.quality=W(e).filter(function(e){return t.config.quality.options.includes(e)}));var a=!i.empty(this.options.quality)&&this.options.quality.length>1;if(G.toggleTab.call(this,"quality",a),G.checkMenu.call(this),a){v(n);this.options.quality.sort(function(e,i){var n=t.config.quality.options;return n.indexOf(e)>n.indexOf(i)?1:-1}).forEach(function(e){G.createMenuItem.call(t,{value:e,list:n,type:"quality",title:G.getLabel.call(t,"quality",e),badge:function(e){var i=z("qualityBadge."+e,t.config);return i.length?G.createBadge.call(t,i):null}(e)})}),G.updateSetting.call(this,"quality",n)}}},getLabel:function(e,t){switch(e){case"speed":return 1===t?z("normal",this.config):t+"×";case"quality":if(i.number(t)){var n=z("qualityLabel."+t,this.config);return n.length?n:t+"p"}return D(t);case"captions":return ie.getLabel.call(this);default:return null}},updateSetting:function(e,t,n){var a=this.elements.settings.panes[e],s=null,r=t;if("captions"===e)s=this.currentTrack;else{if(s=i.empty(n)?this[e]:n,i.empty(s)&&(s=this.config[e].default),!i.empty(this.options[e])&&!this.options[e].includes(s))return void this.debug.warn("Unsupported value of '"+s+"' for "+e);if(!this.config[e].options.includes(s))return void this.debug.warn("Disabled value of '"+s+"' for "+e)}if(i.element(r)||(r=a&&a.querySelector("ul")),i.element(r)){this.elements.settings.tabs[e].querySelector("."+this.config.classNames.menu.value).innerHTML=G.getLabel.call(this,e,s);var l=r&&r.querySelector('input[value="'+s+'"]');i.element(l)&&(l.checked=!0)}},setCaptionsMenu:function(){var e=this,t=this.elements.settings.panes.captions.querySelector("ul"),i=ie.getTracks.call(this);if(G.toggleTab.call(this,"captions",i.length),v(t),G.checkMenu.call(this),i.length){var n=i.map(function(i,n){return{value:n,checked:e.captions.toggled&&e.currentTrack===n,title:ie.getLabel.call(e,i),badge:i.language&&G.createBadge.call(e,i.language.toUpperCase()),list:t,type:"language"}});n.unshift({value:-1,checked:!this.captions.toggled,title:z("disabled",this.config),list:t,type:"language"}),n.forEach(G.createMenuItem.bind(this)),G.updateSetting.call(this,"captions",t)}},setSpeedMenu:function(e){var t=this;if(this.config.controls.includes("settings")&&this.config.settings.includes("speed")&&i.element(this.elements.settings.panes.speed)){i.array(e)?this.options.speed=e:(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(e){return t.config.speed.options.includes(e)});var n=!i.empty(this.options.speed)&&this.options.speed.length>1;if(G.toggleTab.call(this,"speed",n),G.checkMenu.call(this),n){var a=this.elements.settings.panes.speed.querySelector("ul");v(a),this.options.speed.forEach(function(e){G.createMenuItem.call(t,{value:e,list:a,type:"speed",title:G.getLabel.call(t,"speed",e)})}),G.updateSetting.call(this,"speed",a)}}},checkMenu:function(){var e=this.elements.settings.tabs,t=!i.empty(e)&&Object.values(e).some(function(e){return!e.hidden});w(this.elements.settings.menu,!t)},toggleMenu:function(e){var t=this.elements.settings.form,n=this.elements.buttons.settings;if(i.element(t)&&i.element(n)){var a=i.boolean(e)?e:i.element(t)&&t.hasAttribute("hidden");if(i.event(e)){var s=i.element(t)&&t.contains(e.target),r=e.target===this.elements.buttons.settings;if(s||!s&&!r&&a)return;r&&e.stopPropagation()}i.element(n)&&n.setAttribute("aria-expanded",a),i.element(t)&&(w(t,!a),T(this.elements.container,this.config.classNames.menu.open,a),a?t.removeAttribute("tabindex"):t.setAttribute("tabindex",-1))}},getTabSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),Array.from(t.querySelectorAll("input[name]")).forEach(function(e){var t=e.getAttribute("name");e.setAttribute("name",t+"-clone")}),e.parentNode.appendChild(t);var i=t.scrollWidth,n=t.scrollHeight;return y(t),{width:i,height:n}},showTab:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=this.elements.settings.menu,a=document.getElementById(t);if(i.element(a)&&"tabpanel"===a.getAttribute("role")){var l=n.querySelector('[role="tabpanel"]:not([hidden])'),o=l.parentNode;if(Array.from(n.querySelectorAll('[aria-controls="'+l.getAttribute("id")+'"]')).forEach(function(e){e.setAttribute("aria-expanded",!1)}),O.transitions&&!O.reducedMotion){o.style.width=l.scrollWidth+"px",o.style.height=l.scrollHeight+"px";var c=G.getTabSize.call(this,a);s.call(this,o,M,function t(i){i.target===o&&["width","height"].includes(i.propertyName)&&(o.style.width="",o.style.height="",r.call(e,o,M,t))}),o.style.width=c.width+"px",o.style.height=c.height+"px"}w(l,!0),l.setAttribute("tabindex",-1),w(a,!1);var u=E.call(this,'[aria-controls="'+t+'"]');Array.from(u).forEach(function(e){e.setAttribute("aria-expanded",!0)}),a.removeAttribute("tabindex"),a.querySelectorAll("button:not(:disabled), input:not(:disabled), [tabindex]")[0].focus()}},create:function(e){var t=this;if(i.empty(this.config.controls))return null;var n=f("div",k(this.config.selectors.controls.wrapper));if(this.config.controls.includes("restart")&&n.appendChild(G.createButton.call(this,"restart")),this.config.controls.includes("rewind")&&n.appendChild(G.createButton.call(this,"rewind")),this.config.controls.includes("play")&&n.appendChild(G.createButton.call(this,"play")),this.config.controls.includes("fast-forward")&&n.appendChild(G.createButton.call(this,"fast-forward")),this.config.controls.includes("progress")){var a=f("div",k(this.config.selectors.progress));if(a.appendChild(G.createRange.call(this,"seek",{id:"plyr-seek-"+e.id})),a.appendChild(G.createProgress.call(this,"buffer")),this.config.tooltips.seek){var s=f("span",{class:this.config.classNames.tooltip},"00:00");a.appendChild(s),this.elements.display.seekTooltip=s}this.elements.progress=a,n.appendChild(this.elements.progress)}if(this.config.controls.includes("current-time")&&n.appendChild(G.createTime.call(this,"currentTime")),this.config.controls.includes("duration")&&n.appendChild(G.createTime.call(this,"duration")),this.config.controls.includes("mute")&&n.appendChild(G.createButton.call(this,"mute")),this.config.controls.includes("volume")){var r=f("div",{class:"plyr__volume"}),l={max:1,step:.05,value:this.config.volume};r.appendChild(G.createRange.call(this,"volume",V(l,{id:"plyr-volume-"+e.id}))),this.elements.volume=r,n.appendChild(r)}if(this.config.controls.includes("captions")&&n.appendChild(G.createButton.call(this,"captions")),this.config.controls.includes("settings")&&!i.empty(this.config.settings)){var o=f("div",{class:"plyr__menu",hidden:""});o.appendChild(G.createButton.call(this,"settings",{id:"plyr-settings-toggle-"+e.id,"aria-haspopup":!0,"aria-controls":"plyr-settings-"+e.id,"aria-expanded":!1}));var c=f("form",{class:"plyr__menu__container",id:"plyr-settings-"+e.id,hidden:"","aria-labelled-by":"plyr-settings-toggle-"+e.id,role:"tablist",tabindex:-1}),u=f("div"),d=f("div",{id:"plyr-settings-"+e.id+"-home","aria-labelled-by":"plyr-settings-toggle-"+e.id,role:"tabpanel"}),p=f("ul",{role:"tablist"});this.config.settings.forEach(function(i){var n=f("li",{role:"tab",hidden:""}),a=f("button",V(k(t.config.selectors.buttons.settings),{type:"button",class:t.config.classNames.control+" "+t.config.classNames.control+"--forward",id:"plyr-settings-"+e.id+"-"+i+"-tab","aria-haspopup":!0,"aria-controls":"plyr-settings-"+e.id+"-"+i,"aria-expanded":!1}),z(i,t.config)),s=f("span",{class:t.config.classNames.menu.value});s.innerHTML=e[i],a.appendChild(s),n.appendChild(a),p.appendChild(n),t.elements.settings.tabs[i]=n}),d.appendChild(p),u.appendChild(d),this.config.settings.forEach(function(i){var n=f("div",{id:"plyr-settings-"+e.id+"-"+i,hidden:"","aria-labelled-by":"plyr-settings-"+e.id+"-"+i+"-tab",role:"tabpanel",tabindex:-1}),a=f("button",{type:"button",class:t.config.classNames.control+" "+t.config.classNames.control+"--back","aria-haspopup":!0,"aria-controls":"plyr-settings-"+e.id+"-home","aria-expanded":!1},z(i,t.config));n.appendChild(a);var s=f("ul");n.appendChild(s),u.appendChild(n),t.elements.settings.panes[i]=n}),c.appendChild(u),o.appendChild(c),n.appendChild(o),this.elements.settings.form=c,this.elements.settings.menu=o}return this.config.controls.includes("pip")&&O.pip&&n.appendChild(G.createButton.call(this,"pip")),this.config.controls.includes("airplay")&&O.airplay&&n.appendChild(G.createButton.call(this,"airplay")),this.config.controls.includes("fullscreen")&&n.appendChild(G.createButton.call(this,"fullscreen")),this.config.controls.includes("play-large")&&this.elements.container.appendChild(G.createButton.call(this,"play-large")),this.elements.controls=n,this.isHTML5&&G.setQualityMenu.call(this,j.getQualityOptions.call(this)),G.setSpeedMenu.call(this),n},inject:function(){var e=this;if(this.config.loadSprite){var t=G.getIconUrl.call(this);t.cors&&Y(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var n=null;this.elements.controls=null;var a={id:this.id,seektime:this.config.seekTime,title:this.config.title},s=!0;i.string(this.config.controls)||i.element(this.config.controls)?n=this.config.controls:i.function(this.config.controls)?n=this.config.controls.call(this,a):(n=G.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:ie.getLabel.call(this)}),s=!1);var r=function(e){var t=e;return Object.entries(a).forEach(function(e){var i=p(e,2),n=i[0],a=i[1];t=B(t,"{"+n+"}",a)}),t};s&&(i.string(this.config.controls)?n=r(n):i.element(n)&&(n.innerHTML=r(n.innerHTML)));var l,o=void 0;if(i.string(this.config.selectors.controls.container)&&(o=document.querySelector(this.config.selectors.controls.container)),i.element(o)||(o=this.elements.container),i.element(n)?o.appendChild(n):n&&o.insertAdjacentHTML("beforeend",n),i.element(this.elements.controls)||G.findElements.call(this),window.navigator.userAgent.includes("Edge")&&(l=o,setTimeout(function(){w(l,!0),l.offsetHeight,w(l,!1)},0)),this.config.tooltips.controls){var c=this.config,u=c.classNames,d=c.selectors,h=d.controls.wrapper+" "+d.labels+" ."+u.hidden,m=E.call(this,h);Array.from(m).forEach(function(t){T(t,e.config.classNames.hidden,!1),T(t,e.config.classNames.tooltip,!0)})}}};function Z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise(function(i,n){try{var a=new XMLHttpRequest;if(!("withCredentials"in a))return;a.addEventListener("load",function(){if("text"===t)try{i(JSON.parse(a.responseText))}catch(e){i(a.responseText)}else i(a.response)}),a.addEventListener("error",function(){throw new Error(a.statusText)}),a.open("GET",e,!0),a.responseType=t,a.send()}catch(e){n(e)}})}function ee(e){var t=e;if(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]){var i=document.createElement("a");i.href=t,t=i.href}try{return new URL(t)}catch(e){return null}}function te(e){var t=new URLSearchParams;return i.object(e)&&Object.entries(e).forEach(function(e){var i=p(e,2),n=i[0],a=i[1];t.set(n,a)}),t}var ie={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!O.textTracks)i.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&G.setCaptionsMenu.call(this);else{var e,t;if(i.element(this.elements.captions)||(this.elements.captions=f("div",k(this.config.selectors.captions)),e=this.elements.captions,(t=this.elements.wrapper).parentNode.insertBefore(e,t.nextSibling)),q.isIE&&window.URL){var n=this.media.querySelectorAll("track");Array.from(n).forEach(function(e){var t=e.getAttribute("src"),i=ee(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&Z(t,"blob").then(function(t){e.setAttribute("src",window.URL.createObjectURL(t))}).catch(function(){y(e)})})}var a=W(Array.from(navigator.languages||navigator.userLanguage).map(function(e){return e.split("-")[0]})),r=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===r)r=p(a,1)[0];var l=this.storage.get("captions");if(i.boolean(l)||(l=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:l,language:r,languages:a}),this.isHTML5){var o=this.config.captions.update?"addtrack removetrack":"removetrack";s.call(this,this.media.textTracks,o,ie.update.bind(this))}setTimeout(ie.update.bind(this),0)}},update:function(){var e=this,t=ie.getTracks.call(this,!0),n=this.captions,a=n.active,r=n.language,l=n.meta,o=n.currentTrackNode,c=Boolean(t.find(function(e){return e.language===r}));this.isHTML5&&this.isVideo&&t.filter(function(e){return!l.get(e)}).forEach(function(t){e.debug.log("Track added",t),l.set(t,{default:"showing"===t.mode}),t.mode="hidden",s.call(e,t,"cuechange",function(){return ie.updateCues.call(e)})}),(c&&this.language!==r||!t.includes(o))&&(ie.setLanguage.call(this,r),ie.toggle.call(this,a&&c)),T(this.elements.container,this.config.classNames.captions.enabled,!i.empty(t)),(this.config.controls||[]).includes("settings")&&this.config.settings.includes("captions")&&G.setCaptionsMenu.call(this)},toggle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var n=this.captions.toggled,a=this.config.classNames.captions.active,s=i.nullOrUndefined(e)?!n:e;if(s!==n){if(t||(this.captions.active=s,this.storage.set({captions:s})),!this.language&&s&&!t){var r=ie.getTracks.call(this),l=ie.findTrack.call(this,[this.captions.language].concat(function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}(this.captions.languages)),!0);return this.captions.language=l.language,void ie.set.call(this,r.indexOf(l))}this.elements.buttons.captions.pressed=s,T(this.elements.container,a,s),this.captions.toggled=s,G.updateSetting.call(this,"captions"),o.call(this,this.media,s?"captionsenabled":"captionsdisabled")}}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=ie.getTracks.call(this);if(-1!==e)if(i.number(e))if(e in n){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var a=n[e],s=(a||{}).language;this.captions.currentTrackNode=a,G.updateSetting.call(this,"captions"),t||(this.captions.language=s,this.storage.set({language:s})),this.isVimeo&&this.embed.enableTextTrack(s),o.call(this,this.media,"languagechange")}ie.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&ie.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else ie.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(i.string(e)){var n=e.toLowerCase();this.captions.language=n;var a=ie.getTracks.call(this),s=ie.findTrack.call(this,[n]);ie.set.call(this,a.indexOf(s),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Array.from((this.media||{}).textTracks||[]).filter(function(i){return!e.isHTML5||t||e.captions.meta.has(i)}).filter(function(e){return["captions","subtitles"].includes(e.kind)})},findTrack:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=ie.getTracks.call(this),a=function(e){return Number((t.captions.meta.get(e)||{}).default)},s=Array.from(n).sort(function(e,t){return a(t)-a(e)}),r=void 0;return e.every(function(e){return!(r=s.find(function(t){return t.language===e}))}),r||(i?s[0]:void 0)},getCurrentTrack:function(){return ie.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!i.track(t)&&O.textTracks&&this.captions.toggled&&(t=ie.getCurrentTrack.call(this)),i.track(t)?i.empty(t.label)?i.empty(t.language)?z("enabled",this.config):e.language.toUpperCase():t.label:z("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(i.element(this.elements.captions))if(i.nullOrUndefined(e)||Array.isArray(e)){var t=e;if(!t){var n=ie.getCurrentTrack.call(this);t=Array.from((n||{}).activeCues||[]).map(function(e){return e.getCueAsHTML()}).map(U)}var a=t.map(function(e){return e.trim()}).join("\n");if(a!==this.elements.captions.innerHTML){v(this.elements.captions);var s=f("span",k(this.config.selectors.caption));s.innerHTML=a,this.elements.captions.appendChild(s),o.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},ne={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:"16:9",clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.3.12/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240,"default"]},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",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:{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://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&fields=items(snippet(title))&part=snippet"},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,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","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","qualityrequested","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"]',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",menu:{quality:".js-plyr__menu__list--quality"}},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",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",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"},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},keys:{google:null},ads:{enabled:!1,publisherId:""}},ae={html5:"html5",youtube:"youtube",vimeo:"vimeo"},se={audio:"audio",video:"video"};var re=function(){},le=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];c(this,e),this.enabled=window.console&&t,this.enabled&&this.log("Debugging enabled")}return u(e,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):re}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):re}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):re}}]),e}();function oe(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;i.element(e)&&(e.pressed=this.active),o.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0),q.isIos||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i.element(e)){var n=E.call(this,"button:not(:disabled), input:not(:disabled), [tabindex]"),s=n[0],r=n[n.length-1];a.call(this,this.elements.container,"keydown",function(e){if("Tab"===e.key&&9===e.keyCode){var t=P();t!==r||e.shiftKey?t===s&&e.shiftKey&&(r.focus(),e.preventDefault()):(s.focus(),e.preventDefault())}},t,!1)}}.call(this.player,this.target,this.active)}}function ce(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",T(this.target,this.player.config.classNames.fullscreen.fallback,e),oe.call(this)}var ue=function(){function e(t){var n=this;c(this,e),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},s.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":this.prefix+"fullscreenchange",function(){oe.call(n)}),s.call(this.player,this.player.elements.container,"dblclick",function(e){i.element(n.player.elements.controls)&&n.player.elements.controls.contains(e.target)||n.toggle()}),this.update()}return u(e,[{key:"update",value:function(){this.enabled?this.player.debug.log((e.native?"Native":"Fallback")+" fullscreen enabled"):this.player.debug.log("Fullscreen not supported and fallback disabled"),T(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(q.isIos&&this.player.config.fullscreen.iosNative?this.player.playing&&this.target.webkitEnterFullscreen():e.native?this.prefix?i.empty(this.prefix)||this.target[this.prefix+"Request"+this.property]():this.target.requestFullscreen():ce.call(this,!0))}},{key:"exit",value:function(){if(this.enabled)if(q.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),this.player.play();else if(e.native)if(this.prefix){if(!i.empty(this.prefix)){var t="moz"===this.prefix?"Cancel":"Exit";document[""+this.prefix+t+this.property]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document);else ce.call(this,!1)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"enabled",get:function(){return(e.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&&(e.native?(this.prefix?document[""+this.prefix+this.property+"Element"]:document.fullscreenElement)===this.target:A(this.target,this.player.config.classNames.fullscreen.fallback))}},{key:"target",get:function(){return q.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(i.function(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some(function(t){return!(!i.function(document[t+"ExitFullscreen"])&&!i.function(document[t+"CancelFullScreen"]))&&(e=t,!0)}),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),e}();function de(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise(function(i,n){var a=new Image,s=function(){delete a.onload,delete a.onerror,(a.naturalWidth>=t?i:n)(a)};Object.assign(a,{onload:s,onerror:s,src:e})})}var pe={addStyleHook:function(){T(this.elements.container,this.config.selectors.container.replace(".",""),!0),T(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for "+this.provider+" "+this.type),void pe.toggleNativeControls.call(this,!0);i.element(this.elements.controls)||(G.inject.call(this),this.listeners.controls()),pe.toggleNativeControls.call(this),this.isHTML5&&ie.setup.call(this),this.volume=null,this.muted=null,this.speed=null,this.loop=null,this.quality=null,G.updateVolume.call(this),G.timeUpdate.call(this),pe.checkPlaying.call(this),T(this.elements.container,this.config.classNames.pip.supported,O.pip&&this.isHTML5&&this.isVideo),T(this.elements.container,this.config.classNames.airplay.supported,O.airplay&&this.isHTML5),T(this.elements.container,this.config.classNames.isIos,q.isIos),T(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(function(){o.call(e,e.media,"ready")},0),pe.setTitle.call(this),this.poster&&pe.setPoster.call(this,this.poster,!1).catch(function(){}),this.config.duration&&G.durationUpdate.call(this)},setTitle:function(){var e=z("play",this.config);if(i.string(this.config.title)&&!i.empty(this.config.title)&&(e+=", "+this.config.title),i.nodeList(this.elements.buttons.play)&&Array.from(this.elements.buttons.play).forEach(function(t){t.setAttribute("aria-label",e)}),this.isEmbed){var t=S.call(this,"iframe");if(!i.element(t))return;var n=i.empty(this.config.title)?"video":this.config.title,a=z("frameTitle",this.config);t.setAttribute("title",a.replace("{title}",n))}},togglePoster:function(e){T(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this;return arguments.length>1&&void 0!==arguments[1]&&!arguments[1]||!this.poster?(this.media.setAttribute("poster",e),function(){var e=this;return new Promise(function(t){return e.ready?setTimeout(t,0):s.call(e,e.elements.container,"ready",t)}).then(function(){})}.call(this).then(function(){return de(e)}).catch(function(i){throw e===t.poster&&pe.togglePoster.call(t,!1),i}).then(function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('"+e+"')",backgroundSize:""}),pe.togglePoster.call(t,!0),e})):Promise.reject(new Error("Poster already set"))},checkPlaying:function(e){var t=this;T(this.elements.container,this.config.classNames.playing,this.playing),T(this.elements.container,this.config.classNames.paused,this.paused),T(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play).forEach(function(e){e.pressed=t.playing}),i.event(e)&&"timeupdate"===e.type||pe.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(function(){T(t.elements.container,t.config.classNames.loading,t.loading),pe.toggleControls.call(t)},this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;t&&this.config.hideControls&&this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover))}},he=function(){function e(t){c(this,e),this.player=t,this.lastKey=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}return u(e,[{key:"handleKey",value:function(e){var t=this,n=e.keyCode?e.keyCode:e.which,a="keydown"===e.type,s=a&&n===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&i.number(n)){if(a){var r=P();if(i.element(r)&&r!==this.player.elements.inputs.seek&&C(r,this.player.config.selectors.editable))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)&&(e.preventDefault(),e.stopPropagation()),n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:s||(t.player.currentTime=t.player.duration/10*(n-48));break;case 32:case 75:s||this.player.togglePlay();break;case 38:this.player.increaseVolume(.1);break;case 40:this.player.decreaseVolume(.1);break;case 77:s||(this.player.muted=!this.player.muted);break;case 39:this.player.forward();break;case 37:this.player.rewind();break;case 70:this.player.fullscreen.toggle();break;case 67:s||this.player.toggleCaptions();break;case 76:this.player.loop=!this.player.loop}!this.player.fullscreen.enabled&&this.player.fullscreen.active&&27===n&&this.player.fullscreen.toggle(),this.lastKey=n}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){G.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){this.player.touch=!0,T(this.player.elements.container,this.player.config.classNames.isTouch,!0)}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.player.config.keyboard.global&&a.call(this.player,window,"keydown keyup",this.handleKey,e,!1),a.call(this.player,document.body,"click",this.toggleMenu,e),l.call(this.player,document.body,"touchstart",this.firstTouch)}},{key:"container",value:function(){var e=this;!this.player.config.keyboard.global&&this.player.config.keyboard.focused&&s.call(this.player,this.player.elements.container,"keydown keyup",this.handleKey,!1),s.call(this.player,this.player.elements.container,"focusout",function(t){T(t.target,e.player.config.classNames.tabFocus,!1)}),s.call(this.player,this.player.elements.container,"keydown",function(t){9===t.keyCode&&setTimeout(function(){T(P(),e.player.config.classNames.tabFocus,!0)},0)}),s.call(this.player,this.player.elements.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",function(t){var i=e.player.elements.controls;"enterfullscreen"===t.type&&(i.pressed=!1,i.hover=!1);var n=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(pe.toggleControls.call(e.player,!0),n=e.player.touch?3e3:2e3),clearTimeout(e.player.timers.controls),e.player.timers.controls=setTimeout(function(){return pe.toggleControls.call(e.player,!1)},n)})}},{key:"media",value:function(){var e=this;if(s.call(this.player,this.player.media,"timeupdate seeking seeked",function(t){return G.timeUpdate.call(e.player,t)}),s.call(this.player,this.player.media,"durationchange loadeddata loadedmetadata",function(t){return G.durationUpdate.call(e.player,t)}),s.call(this.player,this.player.media,"canplay",function(){w(e.player.elements.volume,!e.player.hasAudio),w(e.player.elements.buttons.mute,!e.player.hasAudio)}),s.call(this.player,this.player.media,"ended",function(){e.player.isHTML5&&e.player.isVideo&&e.player.config.resetOnEnd&&e.player.restart()}),s.call(this.player,this.player.media,"progress playing seeking seeked",function(t){return G.updateProgress.call(e.player,t)}),s.call(this.player,this.player.media,"volumechange",function(t){return G.updateVolume.call(e.player,t)}),s.call(this.player,this.player.media,"playing play pause ended emptied timeupdate",function(t){return pe.checkPlaying.call(e.player,t)}),s.call(this.player,this.player.media,"waiting canplay seeked playing",function(t){return pe.checkLoading.call(e.player,t)}),s.call(this.player,this.player.media,"playing",function(){e.player.ads&&e.player.ads.enabled&&!e.player.ads.initialized&&e.player.ads.managerPromise.then(function(){return e.player.ads.play()}).catch(function(){return e.player.play()})}),this.player.supported.ui&&this.player.config.clickToPlay&&!this.player.isAudio){var t=S.call(this.player,"."+this.player.config.classNames.video);if(!i.element(t))return;s.call(this.player,t,"click",function(){e.player.config.hideControls&&e.player.touch&&!e.player.paused||(e.player.paused?e.player.play():e.player.ended?(e.player.restart(),e.player.play()):e.player.pause())})}this.player.supported.ui&&this.player.config.disableContextMenu&&s.call(this.player,this.player.elements.wrapper,"contextmenu",function(e){e.preventDefault()},!1),s.call(this.player,this.player.media,"volumechange",function(){e.player.storage.set({volume:e.player.volume,muted:e.player.muted})}),s.call(this.player,this.player.media,"ratechange",function(){G.updateSetting.call(e.player,"speed"),e.player.storage.set({speed:e.player.speed})}),s.call(this.player,this.player.media,"qualityrequested",function(t){e.player.storage.set({quality:t.detail.quality})}),s.call(this.player,this.player.media,"qualitychange",function(t){G.updateSetting.call(e.player,"quality",null,t.detail.quality)});var n=this.player.config.events.concat(["keyup","keydown"]).join(" ");s.call(this.player,this.player.media,n,function(t){var i=t.detail,n=void 0===i?{}:i;"error"===t.type&&(n=e.player.media.error),o.call(e.player,e.player.elements.container,t.type,!0,n)})}},{key:"controls",value:function(){var e=this,t=q.isIE?"change":"input",n=function(t,n,a){var s=e.player.config.listeners[a],r=!0;i.function(s)&&(r=s.call(e.player,t)),r&&i.function(n)&&n.call(e.player,t)},a=function(t,a,r,l){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],c=e.player.config.listeners[l],u=i.function(c);s.call(e.player,t,a,function(e){return n(e,r,l)},o&&!u)};Array.from(this.player.elements.buttons.play).forEach(function(t){a(t,"click",e.player.togglePlay,"play")}),a(this.player.elements.buttons.restart,"click",this.player.restart,"restart"),a(this.player.elements.buttons.rewind,"click",this.player.rewind,"rewind"),a(this.player.elements.buttons.fastForward,"click",this.player.forward,"fastForward"),a(this.player.elements.buttons.mute,"click",function(){e.player.muted=!e.player.muted},"mute"),a(this.player.elements.buttons.captions,"click",function(){return e.player.toggleCaptions()}),a(this.player.elements.buttons.fullscreen,"click",function(){e.player.fullscreen.toggle()},"fullscreen"),a(this.player.elements.buttons.pip,"click",function(){e.player.pip="toggle"},"pip"),a(this.player.elements.buttons.airplay,"click",this.player.airplay,"airplay"),a(this.player.elements.buttons.settings,"click",function(t){G.toggleMenu.call(e.player,t)}),a(this.player.elements.settings.form,"click",function(t){t.stopPropagation();var i=function(){var t="plyr-settings-"+e.player.id+"-home";G.showTab.call(e.player,t)};if(C(t.target,e.player.config.selectors.inputs.language))n(t,function(){e.player.currentTrack=Number(t.target.value),i()},"language");else if(C(t.target,e.player.config.selectors.inputs.quality))n(t,function(){e.player.quality=t.target.value,i()},"quality");else if(C(t.target,e.player.config.selectors.inputs.speed))n(t,function(){e.player.speed=parseFloat(t.target.value),i()},"speed");else{var a=t.target;G.showTab.call(e.player,a.getAttribute("aria-controls"))}}),a(this.player.elements.inputs.seek,"mousedown mousemove",function(t){var i=e.player.elements.progress.getBoundingClientRect(),n=100/i.width*(t.pageX-i.left);t.currentTarget.setAttribute("seek-value",n)}),a(this.player.elements.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",function(t){var i=t.currentTarget,n=t.keyCode?t.keyCode:t.which,a=t.type;if("keydown"!==a&&"keyup"!==a||39===n||37===n){var s=i.hasAttribute("play-on-seeked"),r=["mouseup","touchend","keyup"].includes(t.type);s&&r?(i.removeAttribute("play-on-seeked"),e.player.play()):!r&&e.player.playing&&(i.setAttribute("play-on-seeked",""),e.player.pause())}}),a(this.player.elements.inputs.seek,t,function(t){var n=t.currentTarget,a=n.getAttribute("seek-value");i.empty(a)&&(a=n.value),n.removeAttribute("seek-value"),e.player.currentTime=a/n.max*e.player.duration},"seek"),this.player.config.toggleInvert&&!i.element(this.player.elements.display.duration)&&a(this.player.elements.display.currentTime,"click",function(){0!==e.player.currentTime&&(e.player.config.invertTime=!e.player.config.invertTime,G.timeUpdate.call(e.player))}),a(this.player.elements.inputs.volume,t,function(t){e.player.volume=t.target.value},"volume"),q.isWebkit&&Array.from(E.call(this.player,'input[type="range"]')).forEach(function(t){a(t,"input",function(t){return G.updateRangeFill.call(e.player,t.target)})}),a(this.player.elements.progress,"mouseenter mouseleave mousemove",function(t){return G.updateSeekTooltip.call(e.player,t)}),a(this.player.elements.controls,"mouseenter mouseleave",function(t){e.player.elements.controls.hover=!e.player.touch&&"mouseenter"===t.type}),a(this.player.elements.controls,"mousedown mouseup touchstart touchend touchcancel",function(t){e.player.elements.controls.pressed=["mousedown","touchstart"].includes(t.type)}),a(this.player.elements.controls,"focusin focusout",function(t){var i=e.player,n=i.config,a=i.elements,s=i.timers;if(T(a.controls,n.classNames.noTransition,"focusin"===t.type),pe.toggleControls.call(e.player,"focusin"===t.type),"focusin"===t.type){setTimeout(function(){T(a.controls,n.classNames.noTransition,!1)},0);var r=e.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout(function(){return pe.toggleControls.call(e.player,!1)},r)}}),a(this.player.elements.inputs.volume,"wheel",function(t){var i=t.webkitDirectionInvertedFromDevice,n=0;(t.deltaY<0||t.deltaX>0)&&(i?(e.player.decreaseVolume(.02),n=-1):(e.player.increaseVolume(.02),n=1)),(t.deltaY>0||t.deltaX<0)&&(i?(e.player.increaseVolume(.02),n=1):(e.player.decreaseVolume(.02),n=-1)),(1===n&&e.player.media.volume<1||-1===n&&e.player.media.volume>0)&&t.preventDefault()},"volume",!1)}}]),e}();"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var me,fe=(function(e,t){var i;i=function(){var e=function(){},t={},i={},n={};function a(e,t){if(e){var a=n[e];if(i[e]=t,a)for(;a.length;)a[0](e,t),a.splice(0,1)}}function s(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function r(t,i,n,a){var s,l,o=document,c=n.async,u=(n.numRetries||0)+1,d=n.before||e,p=t.replace(/^(css|img)!/,"");a=a||0,/(^css!|\.css$)/.test(t)?(s=!0,(l=o.createElement("link")).rel="stylesheet",l.href=p):/(^img!|\.(png|gif|jpg|svg)$)/.test(t)?(l=o.createElement("img")).src=p:((l=o.createElement("script")).src=t,l.async=void 0===c||c),l.onload=l.onerror=l.onbeforeload=function(e){var o=e.type[0];if(s&&"hideFocus"in l)try{l.sheet.cssText.length||(o="e")}catch(e){o="e"}if("e"==o&&(a+=1)<u)return r(t,i,n,a);i(t,o,e.defaultPrevented)},!1!==d(t,l)&&o.head.appendChild(l)}function l(e,i,n){var l,o;if(i&&i.trim&&(l=i),o=(l?n:i)||{},l){if(l in t)throw"LoadJS";t[l]=!0}!function(e,t,i){var n,a,s=(e=e.push?e:[e]).length,l=s,o=[];for(n=function(e,i,n){if("e"==i&&o.push(e),"b"==i){if(!n)return;o.push(e)}--s||t(o)},a=0;a<l;a++)r(e[a],n,i)}(e,function(e){s(o,e),a(l,e)},o)}return l.ready=function(e,t){return function(e,t){e=e.push?e:[e];var a,s,r,l=[],o=e.length,c=o;for(a=function(e,i){i.length&&l.push(e),--c||t(l)};o--;)s=e[o],(r=i[s])?a(s,r):(n[s]=n[s]||[]).push(a)}(e,function(e){s(t,e)}),l},l.done=function(e){a(e,[])},l.reset=function(){t={},i={},n={}},l.isDefined=function(e){return e in t},l},e.exports=i()}(me={exports:{}},me.exports),me.exports);function ge(e){return new Promise(function(t,i){fe(e,{success:t,error:i})})}function ye(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,o.call(this,this.media,e?"play":"pause"))}var ve={setup:function(){var e=this;T(this.elements.wrapper,this.config.classNames.embed,!0),ve.setAspectRatio.call(this),i.object(window.Vimeo)?ve.ready.call(this):ge(this.config.urls.vimeo.sdk).then(function(){ve.ready.call(e)}).catch(function(t){e.debug.warn("Vimeo API failed to load",t)})},setAspectRatio:function(e){var t=(i.string(e)?e:this.config.ratio).split(":"),n=p(t,2),a=100/n[0]*n[1];if(this.elements.wrapper.style.paddingBottom=a+"%",this.supported.ui){var s=(240-a)/4.8;this.media.style.transform="translateY(-"+s+"%)"}},ready:function(){var e=this,t=this,n=te({loop:t.config.loop.active,autoplay:t.autoplay,byline:!1,portrait:!1,title:!1,speed:!0,transparent:0,gesture:"media",playsinline:!this.config.fullscreen.iosNative}),a=t.media.getAttribute("src");i.empty(a)&&(a=t.media.getAttribute(t.config.attributes.embed.id));var s,r=(s=a,i.empty(s)?null:i.number(Number(s))?s:s.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:s),l=f("iframe"),c=H(t.config.urls.vimeo.iframe,r,n);l.setAttribute("src",c),l.setAttribute("allowfullscreen",""),l.setAttribute("allowtransparency",""),l.setAttribute("allow","autoplay");var u=f("div",{poster:t.poster,class:t.config.classNames.embedContainer});u.appendChild(l),t.media=b(u,t.media),Z(H(t.config.urls.vimeo.api,r),"json").then(function(e){if(!i.empty(e)){var n=new URL(e[0].thumbnail_large);n.pathname=n.pathname.split("_")[0]+".jpg",pe.setPoster.call(t,n.href).catch(function(){})}}),t.embed=new window.Vimeo.Player(l,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return ye.call(t,!0),t.embed.play()},t.media.pause=function(){return ye.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var d=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return d},set:function(e){var i=t.embed,n=t.media,a=t.paused,s=t.volume,r=a&&!i.hasPlayed;n.seeking=!0,o.call(t,n,"seeking"),Promise.resolve(r&&i.setVolume(0)).then(function(){return i.setCurrentTime(e)}).then(function(){return r&&i.pause()}).then(function(){return r&&i.setVolume(s)}).catch(function(){})}});var p=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return p},set:function(e){t.embed.setPlaybackRate(e).then(function(){p=e,o.call(t,t.media,"ratechange")}).catch(function(e){"Error"===e.name&&G.setSpeedMenu.call(t,[])})}});var h=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return h},set:function(e){t.embed.setVolume(e).then(function(){h=e,o.call(t,t.media,"volumechange")})}});var m=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return m},set:function(e){var n=!!i.boolean(e)&&e;t.embed.setVolume(n?0:t.config.volume).then(function(){m=n,o.call(t,t.media,"volumechange")})}});var g=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return g},set:function(e){var n=i.boolean(e)?e:t.config.loop.active;t.embed.setLoop(n).then(function(){g=n})}});var y=void 0;t.embed.getVideoUrl().then(function(e){y=e}).catch(function(t){e.debug.warn(t)}),Object.defineProperty(t.media,"currentSrc",{get:function(){return y}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then(function(t){var i=function(e,t){var i=function e(t,i){return 0===i?t:e(i,t%i)}(e,t);return e/i+":"+t/i}(t[0],t[1]);ve.setAspectRatio.call(e,i)}),t.embed.setAutopause(t.config.autopause).then(function(e){t.config.autopause=e}),t.embed.getVideoTitle().then(function(i){t.config.title=i,pe.setTitle.call(e)}),t.embed.getCurrentTime().then(function(e){d=e,o.call(t,t.media,"timeupdate")}),t.embed.getDuration().then(function(e){t.media.duration=e,o.call(t,t.media,"durationchange")}),t.embed.getTextTracks().then(function(e){t.media.textTracks=e,ie.setup.call(t)}),t.embed.on("cuechange",function(e){var i=e.cues,n=(void 0===i?[]:i).map(function(e){return t=e.text,i=document.createDocumentFragment(),n=document.createElement("div"),i.appendChild(n),n.innerHTML=t,i.firstChild.innerText;var t,i,n});ie.updateCues.call(t,n)}),t.embed.on("loaded",function(){(t.embed.getPaused().then(function(e){ye.call(t,!e),e||o.call(t,t.media,"playing")}),i.element(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)}),t.embed.on("play",function(){ye.call(t,!0),o.call(t,t.media,"playing")}),t.embed.on("pause",function(){ye.call(t,!1)}),t.embed.on("timeupdate",function(e){t.media.seeking=!1,d=e.seconds,o.call(t,t.media,"timeupdate")}),t.embed.on("progress",function(e){t.media.buffered=e.percent,o.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&o.call(t,t.media,"canplaythrough"),t.embed.getDuration().then(function(e){e!==t.media.duration&&(t.media.duration=e,o.call(t,t.media,"durationchange"))})}),t.embed.on("seeked",function(){t.media.seeking=!1,o.call(t,t.media,"seeked")}),t.embed.on("ended",function(){t.media.paused=!0,o.call(t,t.media,"ended")}),t.embed.on("error",function(e){t.media.error=e,o.call(t,t.media,"error")}),setTimeout(function(){return pe.build.call(t)},0)}};function be(e){var t=Object.entries({hd2160:2160,hd1440:1440,hd1080:1080,hd720:720,large:480,medium:360,small:240,tiny:144}).find(function(t){return t.includes(e)});return t?t.find(function(t){return t!==e}):"default"}function ke(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,o.call(this,this.media,e?"play":"pause"))}var we,Te={setup:function(){var e=this;T(this.elements.wrapper,this.config.classNames.embed,!0),Te.setAspectRatio.call(this),i.object(window.YT)&&i.function(window.YT.Player)?Te.ready.call(this):(ge(this.config.urls.youtube.sdk).catch(function(t){e.debug.warn("YouTube API failed to load",t)}),window.onYouTubeReadyCallbacks=window.onYouTubeReadyCallbacks||[],window.onYouTubeReadyCallbacks.push(function(){Te.ready.call(e)}),window.onYouTubeIframeAPIReady=function(){window.onYouTubeReadyCallbacks.forEach(function(e){e()})})},getTitle:function(e){var t=this;if(i.function(this.embed.getVideoData)){var n=this.embed.getVideoData().title;if(i.empty(n))return this.config.title=n,void pe.setTitle.call(this)}var a=this.config.keys.google;i.string(a)&&!i.empty(a)&&Z(H(this.config.urls.youtube.api,e,a)).then(function(e){i.object(e)&&(t.config.title=e.items[0].snippet.title,pe.setTitle.call(t))}).catch(function(){})},setAspectRatio:function(){var e=this.config.ratio.split(":");this.elements.wrapper.style.paddingBottom=100/e[0]*e[1]+"%"},ready:function(){var e=this,t=e.media.getAttribute("id");if(i.empty(t)||!t.startsWith("youtube-")){var n=e.media.getAttribute("src");i.empty(n)&&(n=e.media.getAttribute(this.config.attributes.embed.id));var a,s=(a=n,i.empty(a)?null:a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:a),r=e.provider+"-"+Math.floor(1e4*Math.random()),l=f("div",{id:r,poster:e.poster});e.media=b(l,e.media);var c=function(e){return"https://img.youtube.com/vi/"+s+"/"+e+"default.jpg"};de(c("maxres"),121).catch(function(){return de(c("sd"),121)}).catch(function(){return de(c("hq"))}).then(function(t){return pe.setPoster.call(e,t.src)}).then(function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(function(){}),e.embed=new window.YT.Player(r,{videoId:s,playerVars:{autoplay:e.config.autoplay?1:0,controls:e.supported.ui?0:1,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,disablekb:1,playsinline:1,widget_referrer:window?window.location.href:null,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language},events:{onError:function(t){if(!e.media.error){var i=t.data,n={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occured";e.media.error={code:i,message:n},o.call(e,e.media,"error")}},onPlaybackQualityChange:function(){o.call(e,e.media,"qualitychange",!1,{quality:e.media.quality})},onPlaybackRateChange:function(t){var i=t.target;e.media.playbackRate=i.getPlaybackRate(),o.call(e,e.media,"ratechange")},onReady:function(t){var n=t.target;Te.getTitle.call(e,s),e.media.play=function(){ke.call(e,!0),n.playVideo()},e.media.pause=function(){ke.call(e,!1),n.pauseVideo()},e.media.stop=function(){n.stopVideo()},e.media.duration=n.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(n.getCurrentTime())},set:function(t){e.paused&&e.embed.mute(),e.media.seeking=!0,o.call(e,e.media,"seeking"),n.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return n.getPlaybackRate()},set:function(e){n.setPlaybackRate(e)}}),Object.defineProperty(e.media,"quality",{get:function(){return be(n.getPlaybackQuality())},set:function(e){n.setPlaybackQuality(be(e))}});var a=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return a},set:function(t){a=t,n.setVolume(100*a),o.call(e,e.media,"volumechange")}});var r=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return r},set:function(t){var a=i.boolean(t)?t:r;r=a,n[a?"mute":"unMute"](),o.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return n.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}}),e.options.speed=n.getAvailablePlaybackRates(),e.supported.ui&&e.media.setAttribute("tabindex",-1),o.call(e,e.media,"timeupdate"),o.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(function(){e.media.buffered=n.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&o.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),o.call(e,e.media,"canplaythrough"))},200),setTimeout(function(){return pe.build.call(e)},50)},onStateChange:function(t){var n,a=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,o.call(e,e.media,"seeked")),t.data){case-1:o.call(e,e.media,"timeupdate"),e.media.buffered=a.getVideoLoadedFraction(),o.call(e,e.media,"progress");break;case 0:ke.call(e,!1),e.media.loop?(a.stopVideo(),a.playVideo()):o.call(e,e.media,"ended");break;case 1:e.media.paused&&!e.embed.hasPlayed?e.media.pause():(ke.call(e,!0),o.call(e,e.media,"playing"),e.timers.playing=setInterval(function(){o.call(e,e.media,"timeupdate")},50),e.media.duration!==a.getDuration()&&(e.media.duration=a.getDuration(),o.call(e,e.media,"durationchange")),G.setQualityMenu.call(e,(n=a.getAvailableQualityLevels(),i.empty(n)?n:W(n.map(function(e){return be(e)})))));break;case 2:e.muted||e.embed.unMute(),ke.call(e,!1)}o.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},Ae={setup:function(){this.media?(T(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),T(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&T(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=f("div",{class:this.config.classNames.video}),h(this.media,this.elements.wrapper),this.elements.poster=f("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?j.extend.call(this):this.isYouTube?Te.setup.call(this):this.isVimeo&&ve.setup.call(this)):this.debug.warn("No media element found!")}},Ce=function(){function e(t){var i=this;c(this,e),this.player=t,this.publisherId=t.config.ads.publisherId,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(e,t){i.on("loaded",e),i.on("error",t)}),this.load()}return u(e,[{key:"load",value:function(){var e=this;this.enabled&&(i.object(window.google)&&i.object(window.google.ima)?this.ready():ge(this.player.config.urls.googleIMA.sdk).then(function(){e.ready()}).catch(function(){e.trigger("error",new Error("Google IMA SDK failed to load"))}))}},{key:"ready",value:function(){var e=this;this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(function(){e.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){this.elements.container=f("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container),this.requestAds()}},{key:"requestAds",value:function(){var e=this,t=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(t){return e.onAdsManagerLoaded(t)},!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,function(t){return e.onAdError(t)},!1);var i=new google.ima.AdsRequest;i.adTagUrl=this.tagUrl,i.linearAdSlotWidth=t.offsetWidth,i.linearAdSlotHeight=t.offsetHeight,i.nonLinearAdSlotWidth=t.offsetWidth,i.nonLinearAdSlotHeight=t.offsetHeight,i.forceNonLinearFullSlot=!1,i.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(i)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this;if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0]))return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(function(){var t=X(Math.max(e.manager.getRemainingTime(),0)),i=z("advertisement",e.player.config)+" - "+t;e.elements.container.setAttribute("data-badge-text",i)},100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this,n=new google.ima.AdsRenderingSettings;n.restoreCustomPlaybackStateOnAdBreakComplete=!0,n.enablePreloading=!0,this.manager=e.getAdsManager(this.player,n),this.cuePoints=this.manager.getCuePoints(),i.empty(this.cuePoints)||this.cuePoints.forEach(function(e){if(0!==e&&-1!==e&&e<t.player.duration){var n=t.player.elements.progress;if(i.element(n)){var a=100/t.player.duration*e,s=f("span",{class:t.player.config.classNames.cues});s.style.left=a.toString()+"%",n.appendChild(s)}}}),this.manager.setVolume(this.player.volume),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,function(e){return t.onAdError(e)}),Object.keys(google.ima.AdEvent.Type).forEach(function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],function(e){return t.onAdEvent(e)})}),this.trigger("loaded")}},{key:"onAdEvent",value:function(e){var t=this,i=this.player.elements.container,n=e.getAd(),a=function(e){var i="ads"+e.replace(/_/g,"").toLowerCase();o.call(t.player,t.player.media,i)};switch(e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),a(e.type),this.pollCountdown(!0),n.isLinear()||(n.width=i.offsetWidth,n.height=i.offsetHeight);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:a(e.type),this.loadAds();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:a(e.type),this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:a(e.type),this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.STARTED:case google.ima.AdEvent.Type.MIDPOINT:case google.ima.AdEvent.Type.COMPLETE:case google.ima.AdEvent.Type.IMPRESSION:case google.ima.AdEvent.Type.CLICK:a(e.type)}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e=this,t=this.player.elements.container,n=void 0;this.player.on("ended",function(){e.loader.contentComplete()}),this.player.on("seeking",function(){return n=e.player.currentTime}),this.player.on("seeked",function(){var t=e.player.currentTime;i.empty(e.cuePoints)||e.cuePoints.forEach(function(i,a){n<i&&i<t&&(e.manager.discardAdBreak(),e.cuePoints.splice(a,1))})}),window.addEventListener("resize",function(){e.manager&&e.manager.resize(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL)})}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then(function(){e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}}).catch(function(){})}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,this.player.currentTime<this.player.duration&&this.player.play()}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then(function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise(function(t){e.on("loaded",t),e.player.debug.log(e.manager)}),e.requestAds()}).catch(function(){})}},{key:"trigger",value:function(e){for(var t=this,n=arguments.length,a=Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];var r=this.events[e];i.array(r)&&r.forEach(function(e){i.function(e)&&e.apply(t,a)})}},{key:"on",value:function(e,t){return i.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var i=this;this.player.debug.log("Safety timer invoked from: "+t),this.safetyTimer=setTimeout(function(){i.cancel(),i.clearSafetyTimer("startSafetyTimer()")},e)}},{key:"clearSafetyTimer",value:function(e){i.nullOrUndefined(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: "+e),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){return this.player.isVideo&&this.player.config.ads.enabled&&!i.empty(this.publisherId)}},{key:"tagUrl",get:function(){return"https://go.aniview.com/api/adserver6/vast/?"+te({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:this.publisherId})}}]),e}(),Ee={insertElements:function(e,t){var n=this;i.string(t)?g(e,this.media,{src:t}):i.array(t)&&t.forEach(function(t){g(e,n.media,t)})},change:function(e){var t=this;R(e,"sources.length")?(j.cancelRequests.call(this),this.destroy.call(this,function(){t.options.quality=[],y(t.media),t.media=null,i.element(t.elements.container)&&t.elements.container.removeAttribute("class");var n=e.sources,a=e.type,s=p(n,1)[0],r=s.provider,l=void 0===r?ae.html5:r,o=s.src,c="html5"===l?a:"div",u="html5"===l?{}:{src:o};Object.assign(t,{provider:l,type:a,supported:O.check(a,l,t.config.playsinline),media:f(c,u)}),t.elements.container.appendChild(t.media),i.boolean(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),i.empty(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),pe.addStyleHook.call(t),t.isHTML5&&Ee.insertElements.call(t,"source",n),t.config.title=e.title,Ae.setup.call(t),t.isHTML5&&("tracks"in e&&Ee.insertElements.call(t,"track",e.tracks),t.media.load()),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&pe.build.call(t),t.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}},Se=function(){function e(t,n){var a=this;if(c(this,e),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=O.touch,this.media=t,i.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||i.nodeList(this.media)||i.array(this.media))&&(this.media=this.media[0]),this.config=V({},ne,e.defaults,n||{},function(){try{return JSON.parse(a.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,buttons:{},display:{},progress:{},inputs:{},settings:{menu:null,panes:{},tabs:{}},captions:null},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new le(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",O),!i.nullOrUndefined(this.media)&&i.element(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(O.check().api){var r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;var l=this.media.tagName.toLowerCase(),o=null,u=null;switch(l){case"div":if(o=this.media.querySelector("iframe"),i.element(o)){if(u=ee(o.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/.test(e)?ae.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?ae.vimeo:null}(u.toString()),this.elements.container=this.media,this.media=o,this.elements.container.className="",u.searchParams.length){var d=["1","true"];d.includes(u.searchParams.get("autoplay"))&&(this.config.autoplay=!0),d.includes(u.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?this.config.playsinline=d.includes(u.searchParams.get("playsinline")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(i.empty(this.provider)||!Object.keys(ae).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=se.video;break;case"video":case"audio":this.type=l,this.provider=ae.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),this.media.hasAttribute("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=O.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new he(this),this.storage=new K(this),this.media.plyr=this,i.element(this.elements.container)||(this.elements.container=f("div"),h(this.media,this.elements.container)),pe.addStyleHook.call(this),Ae.setup.call(this),this.config.debug&&s.call(this,this.elements.container,this.config.events.join(" "),function(e){a.debug.log("event: "+e.type)}),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&pe.build.call(this),this.listeners.container(),this.listeners.global(),this.fullscreen=new ue(this),this.ads=new Ce(this),this.config.autoplay&&this.play()):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return u(e,[{key:"play",value:function(){return i.function(this.media.play)?this.media.play():null}},{key:"pause",value:function(){this.playing&&i.function(this.media.pause)&&this.media.pause()}},{key:"togglePlay",value:function(e){(i.boolean(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):i.function(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime=this.currentTime-(i.number(e)?e:this.config.seekTime)}},{key:"forward",value:function(e){this.currentTime=this.currentTime+(i.number(e)?e:this.config.seekTime)}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(i.number(e)?e:1)}},{key:"decreaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t-(i.number(e)?e:1)}},{key:"toggleCaptions",value:function(e){ie.toggle.call(this,e,!1)}},{key:"airplay",value:function(){O.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=A(this.elements.container,this.config.classNames.hideControls),n=void 0===e?void 0:!e,a=T(this.elements.container,this.config.classNames.hideControls,n);if(a&&this.config.controls.includes("settings")&&!i.empty(this.config.settings)&&G.toggleMenu.call(this,!1),a!==t){var s=a?"controlshidden":"controlsshown";o.call(this,this.media,s)}return!a}return!1}},{key:"on",value:function(e,t){s.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){l.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){r(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var a=function(){document.body.style.overflow="",t.embed=null,n?(Object.keys(t.elements).length&&(y(t.elements.buttons.play),y(t.elements.captions),y(t.elements.controls),y(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),i.function(e)&&e()):(function(){this&&this.eventListeners&&(this.eventListeners.forEach(function(e){var t=e.element,i=e.type,n=e.callback,a=e.options;t.removeEventListener(i,n,a)}),this.eventListeners=[])}.call(t),b(t.elements.original,t.elements.container),o.call(t,t.elements.original,"destroyed",!0),i.function(e)&&e.call(t.elements.original),t.ready=!1,setTimeout(function(){t.elements=null,t.media=null},200))};this.stop(),this.isHTML5?(clearTimeout(this.timers.loading),pe.toggleNativeControls.call(this,!0),a()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&i.function(this.embed.destroy)&&this.embed.destroy(),a()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(a),setTimeout(a,200))}}},{key:"supports",value:function(e){return O.mime.call(this,e)}},{key:"isHTML5",get:function(){return Boolean(this.provider===ae.html5)}},{key:"isEmbed",get:function(){return Boolean(this.isYouTube||this.isVimeo)}},{key:"isYouTube",get:function(){return Boolean(this.provider===ae.youtube)}},{key:"isVimeo",get:function(){return Boolean(this.provider===ae.vimeo)}},{key:"isVideo",get:function(){return Boolean(this.type===se.video)}},{key:"isAudio",get:function(){return Boolean(this.type===se.audio)}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=i.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to "+this.currentTime+" seconds")}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return i.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration||0;return e||t}},{key:"volume",set:function(e){var t=e;i.string(t)&&(t=Number(t)),i.number(t)||(t=this.storage.get("volume")),i.number(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!i.empty(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;i.boolean(t)||(t=this.storage.get("muted")),i.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=null;i.number(e)&&(t=e),i.number(t)||(t=this.storage.get("speed")),i.number(t)||(t=this.config.speed.selected),t<.1&&(t=.1),t>2&&(t=2),this.config.speed.options.includes(t)?(this.config.speed.selected=t,this.media.playbackRate=t):this.debug.warn("Unsupported speed ("+t+")")},get:function(){return Number(this.media.playbackRate)}},{key:"quality",set:function(e){var t=this.config.quality,n=this.options.quality;if(n.length){var a=[!i.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(i.number);if(!n.includes(a)){var s=function(e,t){return i.array(e)&&e.length?e.reduce(function(e,i){return Math.abs(i-t)<Math.abs(e-t)?i:e}):null}(n,a);this.debug.warn("Unsupported quality option: "+a+", using "+s+" instead"),a=s}o.call(this,this.media,"qualityrequested",!1,{quality:a}),t.selected=a,this.media.quality=a}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=i.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){Ee.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"poster",set:function(e){this.isVideo?pe.setPoster.call(this,e,!1).catch(function(){}):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster"):null}},{key:"autoplay",set:function(e){var t=i.boolean(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){ie.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,i=e.currentTrack;return t?i:-1}},{key:"language",set:function(e){ie.setLanguage.call(this,e,!1)},get:function(){return(ie.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){var t="picture-in-picture",n="inline";if(O.pip){var a=i.boolean(e)?e:this.pip===n;this.media.webkitSetPresentationMode(a?t:n)}},get:function(){return O.pip?this.media.webkitPresentationMode:null}}],[{key:"supported",value:function(e,t,i){return O.check(e,t,i)}},{key:"loadSprite",value:function(e,t){return Y(e,t)}},{key:"setup",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null;return i.string(t)?a=Array.from(document.querySelectorAll(t)):i.nodeList(t)?a=Array.from(t):i.array(t)&&(a=t.filter(i.element)),i.empty(a)?null:a.map(function(t){return new e(t,n)})}}]),e}();return Se.defaults=(we=ne,JSON.parse(JSON.stringify(we))),Se});
|
|
//# sourceMappingURL=plyr.min.js.map
|