plyr/dist/plyr.js
2017-04-17 00:32:41 +10:00

2 lines
52 KiB
JavaScript

!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,document):"function"==typeof define&&define.amd?define([],function(){return t(e,document)}):e.plyr=t(e,document)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(){var e,n,a,s=navigator.userAgent,l=navigator.appName,i=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10),o=!1,u=!1,c=!1,d=!1;return navigator.appVersion.indexOf("Windows NT")!==-1&&navigator.appVersion.indexOf("rv:11")!==-1?(o=!0,l="IE",i="11"):(n=s.indexOf("MSIE"))!==-1?(o=!0,l="IE",i=s.substring(n+5)):(n=s.indexOf("Chrome"))!==-1?(c=!0,l="Chrome",i=s.substring(n+7)):(n=s.indexOf("Safari"))!==-1?(d=!0,l="Safari",i=s.substring(n+7),(n=s.indexOf("Version"))!==-1&&(i=s.substring(n+8))):(n=s.indexOf("Firefox"))!==-1?(u=!0,l="Firefox",i=s.substring(n+8)):(e=s.lastIndexOf(" ")+1)<(n=s.lastIndexOf("/"))&&(l=s.substring(e,n),i=s.substring(n+1),l.toLowerCase()===l.toUpperCase()&&(l=navigator.appName)),(a=i.indexOf(";"))!==-1&&(i=i.substring(0,a)),(a=i.indexOf(" "))!==-1&&(i=i.substring(0,a)),r=parseInt(""+i,10),isNaN(r)&&(i=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),{name:l,version:r,isIE:o,isFirefox:u,isChrome:c,isSafari:d,isIos:/(iPad|iPhone|iPod)/g.test(navigator.platform),isTouch:"ontouchstart"in t.documentElement}}function a(e){if(!t.querySelectorAll('script[src="'+e+'"]').length){var n=t.createElement("script");n.src=e;var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a)}}function s(){try{return e.self!==e.top}catch(e){return!0}}function l(e,t){return Array.prototype.indexOf&&e.indexOf(t)!==-1}function i(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var a=n>0?t.cloneNode(!0):t,s=e[n],l=s.parentNode,i=s.nextSibling;return a.appendChild(s),i?l.insertBefore(a,i):l.appendChild(a),a}}function r(e){e&&e.parentNode.removeChild(e)}function o(e,t){e.insertBefore(t,e.firstChild)}function u(e,t){for(var n in t)e.setAttribute(n,t[n])}function c(e,t){if(!O.string(e)||O.empty(e))return{};var n={};return e.split(",").forEach(function(e){e=e.trim();var a=e.charAt(0);switch(a){case".":var s=e.replace(".","");O.object(t)&&O.string(t.class)&&(t.class+=" "+s),n.class=s;break;case"#":n.id=e.replace("#","");break;case"[":e=e.replace(/[\[\]]/g,"");var l=e.split("="),i=l[0],r=l.length>1?l[1].replace(/[\"\']/g,""):"";n[i]=r}}),n}function d(e,n,a){var s=t.createElement(e);return O.object(n)&&u(s,n),O.string(a)&&(s.textContent=a),s}function p(e,t,n,a){var s=d(e,n,a);o(t,s)}function m(e){for(var t=e.childNodes.length;t--;)e.removeChild(e.lastChild)}function f(e){return e.replace(".","")}function y(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=a+(n?" "+t:"")}}function b(e,t){return!!e&&(e.classList?e.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className))}function v(e,n){var a=Element.prototype,s=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||function(e){return[].indexOf.call(t.querySelectorAll(e),this)!==-1};return s.call(e,n)}function g(e,t,n,a,s){k(e,t,function(t){n&&n.apply(e,[t]),a.apply(e,[t])},s)}function h(e,t,n,a,s){var l=t.split(" ");if(O.boolean(s)||(s=!1),e instanceof NodeList)for(var i=0;i<e.length;i++)e[i]instanceof Node&&h(e[i],arguments[1],arguments[2],arguments[3]);else for(var r=0;r<l.length;r++)e[a?"addEventListener":"removeEventListener"](l[r],n,s)}function k(e,t,n,a){O.undefined(e)||h(e,t,n,!0,a)}function w(e,t,n,a){O.undefined(e)||h(e,t,n,!1,a)}function C(e,t,n,a){if(e&&t){O.boolean(n)||(n=!1);var s=new CustomEvent(t,{bubbles:n,detail:a});e.dispatchEvent(s)}}function x(e,t){if(e)return t=O.boolean(t)?t:!e.getAttribute("aria-pressed"),e.setAttribute("aria-pressed",t),t}function T(e,t){return 0===e||0===t||isNaN(e)||isNaN(t)?0:(e/t*100).toFixed(2)}function S(){var e=arguments;if(e.length){if(1===e.length)return e[0];var t=Array.prototype.shift.call(e);O.object(t)||(t={});for(var n=e.length,a=0;a<n;a++){var s=e[a];O.object(s)||(s={});for(var l in s)s[l]&&s[l].constructor&&s[l].constructor===Object?(t[l]=t[l]||{},S(t[l],s[l])):t[l]=s[l]}return t}}function E(e){var t=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;return e.match(t)?RegExp.$2:e}function A(e){var t=/^.*(vimeo.com\/|video\/)(\d+).*/;return e.match(t)?RegExp.$2:e}function _(h,_){function N(t,n){_.debug&&e.console&&(n=Array.prototype.slice.call(n),O.string(_.logPrefix)&&_.logPrefix.length&&n.unshift(_.logPrefix),console[t].apply(console,n))}function R(e,t,n,a){C(e,t,n,S({},a,{plyr:at}))}function V(e){return st.elements.container.querySelectorAll(e)}function D(e){return V(e)[0]}function W(){function e(e){9===e.which&&st.fullscreen.active&&(e.target!==a||e.shiftKey?e.target===n&&e.shiftKey&&(e.preventDefault(),a.focus()):(e.preventDefault(),n.focus()))}var t=V("input:not([disabled]), button:not([disabled])"),n=t[0],a=t[t.length-1];k(st.elements.container,"keydown",e)}function H(e,t){O.string(t)?p(e,st.elements.media,{src:t}):O.array(t)&&t.forEach(function(t){p(e,st.elements.media,t)})}function B(){return{url:_.iconUrl,absolute:0===_.iconUrl.indexOf("http")||st.browser.isIE}}function Y(e,n){var a="http://www.w3.org/2000/svg",s=B(),l=(s.absolute?"":s.url)+"#"+_.iconPrefix,i=t.createElementNS(a,"svg");u(i,S(n,{role:"presentation"}));var r=t.createElementNS(a,"use");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l+"-"+e),i.appendChild(r),i}function X(e){var t=_.i18n[e];switch(e){case"pip":t="PIP";break;case"airplay":t="AirPlay"}return d("span",{class:_.classes.hidden},t)}function U(e){var t=d("span",{class:_.classes.menu.value});return t.appendChild(d("span",{class:_.classes.menu.badge},e)),t}function J(e,t){var n,a,s,l=d("button");switch(O.object(t)||(t={}),"class"in t?t.class.indexOf(_.classes.control)===-1&&(t.class+=" "+_.classes.control):t.class=_.classes.control,e){case"mute":s="toggleMute",n="volume",a="muted";break;case"captions":s="toggleCaptions",n="captions-off",a="captions-on";break;case"fullscreen":s="toggleFullscreen",n="enter-fullscreen",a="exit-fullscreen";break;case"play-large":t.class="plyr__play-large",e="play",s="play",n="play";break;default:s=e,n=e}return S(t,c(_.selectors.buttons[e],t)),O.string(a)&&l.appendChild(Y(a,{class:"icon--"+a})),l.appendChild(Y(n)),l.appendChild(X(s)),u(l,t),st.elements.buttons[e]=l,l}function K(e,t){var n=d("label",{for:t.id,class:_.classes.hidden},_.i18n[e]),a=d("input",S(c(_.selectors.inputs[e]),{type:"range",min:0,max:100,step:.1,value:0},t));return st.elements.inputs[e]=a,{label:n,input:a}}function Q(e,t){var n=d("progress",S(c(_.selectors.display[e]),{min:0,max:100,value:0},t));if("volume"!==e){n.appendChild(d("span",null,"0"));var a="";switch(e){case"played":a=_.i18n.played;break;case"buffer":a=_.i18n.buffered}n.textContent="% "+a.toLowerCase()}return st.elements.display[e]=n,n}function z(e){var t=d("span",{class:"plyr__time"});return t.appendChild(d("span",{class:_.classes.hidden},_.i18n[e])),t.appendChild(d("span",c(_.selectors.display[e]),"00:00")),st.elements.display[e]=t,t}function $(e){var t=d("div",c(_.selectors.controls.wrapper));if(l(_.controls,"restart")&&t.appendChild(J("restart")),l(_.controls,"rewind")&&t.appendChild(J("rewind")),l(_.controls,"play")&&(t.appendChild(J("play")),t.appendChild(J("pause"))),l(_.controls,"fast-forward")&&t.appendChild(J("fast-forward")),l(_.controls,"progress")){var n=d("span",c(_.selectors.progress)),a=K("seek",{id:"plyr-seek-"+e.id});if(n.appendChild(a.label),n.appendChild(a.input),n.appendChild(Q("played")),n.appendChild(Q("buffer")),_.tooltips.seek){var s=d("span",{role:"tooltip",class:_.classes.tooltip},"00:00");n.appendChild(s),st.elements.display.seekTooltip=s}st.elements.progress=n,t.appendChild(st.elements.progress)}if(l(_.controls,"current-time")&&t.appendChild(z("currentTime")),l(_.controls,"duration")&&t.appendChild(z("duration")),l(_.controls,"mute")&&t.appendChild(J("mute")),l(_.controls,"volume")){var i=d("span",{class:"plyr__volume"}),r={max:10,value:_.volume},o=K("volume",S(r,{id:"plyr-volume-"+e.id}));i.appendChild(o.label),i.appendChild(o.input);var u=Q("volume",r);i.appendChild(u),t.appendChild(i)}if(l(_.controls,"captions")&&t.appendChild(J("captions")),l(_.controls,"settings")){var p=d("span",S(c(_.selectors.buttons.settings),{class:"plyr__menu"}));p.appendChild(J("settings",{id:"plyr-settings-toggle-"+e.id,"aria-haspopup":!0,"aria-controls":"plyr-settings-"+e.id,"aria-expanded":!1}));var m=d("form",{class:"plyr__menu__container",id:"plyr-settings-"+e.id,"aria-hidden":!0,"aria-labelled-by":"plyr-settings-toggle-"+e.id,role:"tablist",tabindex:-1}),f=d("div"),y=d("div",{id:"plyr-settings-"+e.id+"-home","aria-hidden":!1,"aria-labelled-by":"plyr-settings-toggle-"+e.id,role:"tabpanel",tabindex:-1}),b=d("ul",{role:"tablist"});["captions","quality","speed","loop"].forEach(function(t){var n=d("li",{role:"tab"}),a=d("button",S(c(_.selectors.buttons.settings),{type:"button",class:_.classes.control+" "+_.classes.control+"--forward",id:"plyr-settings-"+e.id+"-"+t+"-tab","aria-haspopup":!0,"aria-controls":"plyr-settings-"+e.id+"-"+t,"aria-expanded":!1}),_.i18n[t]),s=d("span",{class:_.classes.menu.value});s.innerHTML=e[t],a.appendChild(s),n.appendChild(a),b.appendChild(n),st.elements.settings.tabs[t]=n}),y.appendChild(b),f.appendChild(y),["captions","quality","speed","loop"].forEach(function(t){var n=d("div",{id:"plyr-settings-"+e.id+"-"+t,"aria-hidden":!0,"aria-labelled-by":"plyr-settings-tab-"+e.id,role:"tabpanel",tabindex:-1}),a=d("button",{type:"button",class:_.classes.control+" "+_.classes.control+"--back","aria-haspopup":!0,"aria-controls":"plyr-settings-"+e.id+"-home","aria-expanded":!1},_.i18n[t]);n.appendChild(a);var s=d("ul");n.appendChild(s),f.appendChild(n),st.elements.settings.panes[t]=n}),m.appendChild(f),p.appendChild(m),t.appendChild(p),st.elements.settings.menu=p}return l(_.controls,"pip")&&M.pip&&t.appendChild(J("pip")),l(_.controls,"airplay")&&M.airplay&&t.appendChild(J("airplay")),l(_.controls,"fullscreen")&&t.appendChild(J("fullscreen")),st.elements.controls=t,t}function G(e,n){function a(e){var t="";switch(e){case"hd2160":t="4K";break;case"hd1440":t="WQHD";break;case"hd1080":t="HD";break;case"hd720":t="HD"}return t.length?U(t):null}function s(e){switch(e){case"hd2160":return"2160P";case"hd1440":return"1440P";case"hd1080":return"1080P";case"hd720":return"720P";case"large":return"480P";case"medium":return"360P";case"small":return"240P";default:return"Auto"}}if(!O.object(st.quality)&&(st.quality={available:e,current:n},O.array(e)&&e.length)){var l=e.filter(function(e){return["tiny","small"].indexOf(e)===-1}),i=st.elements.settings.panes.quality.querySelector("ul");l.forEach(function(e){var n=d("li"),l=d("label",{class:_.classes.control}),r=d("input",{type:"radio",name:"quality",value:e});e===st.quality.current&&r.setAttribute("checked",""),l.appendChild(r),l.appendChild(t.createTextNode(s(e)));var o=a(e);O.htmlElement(o)&&l.appendChild(o),n.appendChild(l),i.appendChild(n)})}}function Z(){if(st.supported.full&&("audio"!==st.type||_.fullscreen.allowAudio)&&_.fullscreen.enabled){var e=M.fullscreen;e||_.fullscreen.fallback&&!s()?(rt((e?"Native":"Fallback")+" fullscreen enabled"),y(st.elements.container,_.classes.fullscreen.enabled,!0)):rt("Fullscreen not supported and fallback disabled"),st.elements.buttons&&st.elements.buttons.fullscreen&&x(st.elements.buttons.fullscreen,!1),W()}}function ee(e){O.event(e)&&(e=e.target),e.activeCues[0]&&"text"in e.activeCues[0]?ae(e.activeCues[0].getCueAsHTML()):ae()}function te(){if("video"===st.type){D(_.selectors.captions)||st.elements.wrapper.insertAdjacentHTML("afterbegin",'<div class="'+f(_.selectors.captions)+'"></div>'),st.captions.textTracks=!1,st.elements.media.textTracks&&(st.captions.textTracks=!0);var e=[],t="";if(st.elements.media.childNodes.forEach(function(t){"track"===t.nodeName.toLowerCase()&&("captions"!==t.kind&&"subtitles"!==t.kind||e.push(t.getAttribute("src")))}),st.captions.exist=!0,0===e.length?(st.captions.exist=!1,rt("No caption track found")):Number(_.captions.selectedIndex)+1>e.length?(st.captions.exist=!1,rt("Caption index out of bound")):(t=e[_.captions.selectedIndex],rt("Caption track found; URI: "+t)),st.captions.exist){var n=st.elements.media.textTracks;if([].forEach.call(n,function(e){w(e,"cuechange",ee),e.mode="hidden"}),le(st),(st.browser.isIE&&st.browser.version>=10||st.browser.isFirefox&&st.browser.version>=31)&&(rt("Detected browser with known TextTrack issues - using manual fallback"),st.captions.textTracks=!1),st.captions.textTracks){rt("TextTracks supported");var a=n[_.captions.selectedIndex];"captions"!==a.kind&&"subtitles"!==a.kind||(k(a,"cuechange",ee),a.activeCues&&a.activeCues.length>0&&ee(a))}else if(rt("TextTracks not supported so rendering captions manually"),st.captions.current="",st.captions.captions=[],""!==t){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status){var e=s.responseText,t="\r\n";e.indexOf(t+t)===-1&&(t=e.indexOf("\r\r")!==-1?"\r":"\n");var n=e.split(t+t);st.captions.captions=n.map(function(e){var n=e.split(t),a=0;return n[a].indexOf(":")!==-1&&(a=1),[n[a],n[a+1]]}),st.captions.captions.shift(),rt("Successfully loaded the caption file via AJAX")}else ot(_.logPrefix+"There was a problem loading the caption file via AJAX")},s.open("get",t,!0),s.send()}}else y(st.elements.container,_.classes.captions.enabled)}}function ne(e){_.captions.selectedIndex=e||_.captions.selectedIndex,ae(),te()}function ae(e){var t=D(_.selectors.captions);if(O.htmlElement(t)){var n=d("span");m(t),O.undefined(e)&&(e=""),O.string(e)?n.innerHTML=e.trim():n.appendChild(e),t.appendChild(n)}}function se(e){function t(e,t){var n=[];n=e.split(" --> ");for(var a=0;a<n.length;a++)n[a]=n[a].replace(/(\d+:\d+:\d+\.\d+).*/,"$1");return s(n[t])}function n(e){return t(e,0)}function a(e){return t(e,1)}function s(e){if(O.undefined(e))return 0;var t=[],n=[],a=0;t=e.split(","),n=t[0].split(":");for(var s=0,l=n.length;s<l;s++)a+=Math.floor(n[s]*Math.pow(60,l-(s+1)));return a}if(!st.captions.textTracks&&"video"===st.type&&st.supported.full&&(st.captions.count=0,e=O.number(e)?e:st.elements.media.currentTime,st.captions.captions[st.captions.count])){for(;a(st.captions.captions[st.captions.count][0])<e.toFixed(1);)if(st.captions.count++,st.captions.count>st.captions.captions.length-1){st.captions.count=st.captions.captions.length-1;break}st.elements.media.currentTime.toFixed(1)>=n(st.captions[st.subcount][0])&&st.elements.media.currentTime.toFixed(1)<=a(st.captions[st.subcount][0])?(st.captions.current=st.captions.captions[st.captions.count][1],ae(st.captions.current)):ae()}}function le(){if(st.elements.buttons.captions){y(st.elements.container,_.classes.captions.enabled,!0);var e=st.storage.captions;O.boolean(e)||(e=_.captions.defaultActive),e&&(y(st.elements.container,_.classes.captions.active,!0),x(st.elements.buttons.captions,!0))}}function ie(e){st.supported.full&&st.elements.buttons.captions&&(O.boolean(e)||(e=st.elements.container.className.indexOf(_.classes.captions.active)===-1),st.captions.enabled=e,x(st.elements.buttons.captions,st.captions.enabled),y(st.elements.container,_.classes.captions.active,st.captions.enabled),R(st.elements.container,st.captions.enabled?"captionsenabled":"captionsdisabled",!0),pe({captions:st.captions.enabled}))}function re(){if(_.loadSprite){var e=B();e.absolute?(rt("AJAX loading absolute SVG sprite"+(st.browser.isIE?" (due to IE)":"")),I(e.url,"sprite-plyr")):rt("Sprite will be used as external resource directly")}l(_.controls,"play-large")&&(st.elements.buttons.playLarge=J("play-large"),st.elements.container.appendChild(st.elements.buttons.playLarge)),st.id=Math.floor(1e4*Math.random());var n,a=$({id:st.id,seektime:_.seekTime,speed:Te(),quality:"HD",captions:"English",loop:"None"});if(O.string(_.selectors.controls.container)&&(n=t.querySelector(_.selectors.controls.container)),O.htmlElement(n)||(n=st.elements.container),n.appendChild(a),_.tooltips.controls)for(var s=V([_.selectors.controls.wrapper," ",_.selectors.labels," .",_.classes.hidden].join("")),i=s.length-1;i>=0;i--){var r=s[i];y(r,_.classes.hidden,!1),y(r,_.classes.tooltip,!0)}}function oe(){y(st.elements.container,_.selectors.container.replace(".",""),st.supported.full)}function ue(e){e&&l(_.types.html5,st.type)?st.elements.media.setAttribute("controls",""):st.elements.media.removeAttribute("controls")}function ce(e){var t=_.i18n.play;O.string(_.title)&&_.title.length&&(t+=", "+_.title,st.elements.container.setAttribute("aria-label",_.title)),st.supported.full&&(O.htmlElement(st.elements.buttons.play)&&st.elements.buttons.play.setAttribute("aria-label",t),O.htmlElement(st.elements.buttons.playLarge)&&st.elements.buttons.playLarge.setAttribute("aria-label",t)),O.htmlElement(e)&&e.setAttribute("title",_.i18n.frameTitle.replace("{title}",_.title))}function de(){var t=null;st.storage={},M.storage&&_.storage.enabled&&(e.localStorage.removeItem("plyr-volume"),t=e.localStorage.getItem(_.storage.key),t&&(/^\d+(\.\d+)?$/.test(t)?pe({volume:parseFloat(t)}):st.storage=JSON.parse(t)))}function pe(t){M.storage&&_.storage.enabled&&(S(st.storage,t),e.localStorage.setItem(_.storage.key,JSON.stringify(st.storage)))}function me(){if(!st.elements.media)return void ot("No media element found!");if(st.supported.full&&(y(st.elements.container,_.classes.type.replace("{0}",st.type),!0),l(_.types.embed,st.type)&&y(st.elements.container,_.classes.type.replace("{0}","video"),!0),y(st.elements.container,_.classes.pip.enabled,M.pip),y(st.elements.container,_.classes.stopped,_.autoplay),y(st.elements.container,_.classes.isIos,st.browser.isIos),y(st.elements.container,_.classes.isTouch,st.browser.isTouch),"video"===st.type)){var e=d("div");e.setAttribute("class",_.classes.videoWrapper),i(st.elements.media,e),st.elements.wrapper=e}l(_.types.embed,st.type)&&fe()}function fe(){var t,n=d("div"),s=st.type+"-"+Math.floor(1e4*Math.random());switch(st.type){case"youtube":t=E(st.embedId);break;case"vimeo":t=A(st.embedId);break;default:t=st.embedId}for(var l=V('[id^="'+st.type+'-"]'),i=l.length-1;i>=0;i--)r(l[i]);if(y(st.elements.media,_.classes.videoWrapper,!0),y(st.elements.media,_.classes.embedWrapper,!0),"youtube"===st.type)st.elements.media.appendChild(n),n.setAttribute("id",s),O.object(e.YT)?be(t,n):(a(_.urls.youtube.api),e.onYouTubeReadyCallbacks=e.onYouTubeReadyCallbacks||[],e.onYouTubeReadyCallbacks.push(function(){be(t,n)}),e.onYouTubeIframeAPIReady=function(){e.onYouTubeReadyCallbacks.forEach(function(e){e()})});else if("vimeo"===st.type)if(st.supported.full?st.elements.media.appendChild(n):n=st.elements.media,n.setAttribute("id",s),O.object(e.Vimeo))ve(t,n);else{a(_.urls.vimeo.api);var o=e.setInterval(function(){O.object(e.Vimeo)&&(e.clearInterval(o),ve(t,n))},50)}else if("soundcloud"===st.type){var c=d("iframe");c.loaded=!1,k(c,"load",function(){c.loaded=!0}),u(c,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+t,id:s}),n.appendChild(c),st.elements.media.appendChild(n),e.SC||a(_.urls.soundcloud.api);var p=e.setInterval(function(){e.SC&&c.loaded&&(e.clearInterval(p),ge.call(c))},50)}}function ye(){st.supported.full&&(tt(),nt()),ce(D("iframe"))}function be(t,n){st.embed=new e.YT.Player(n.id,{videoId:t,playerVars:{autoplay:_.autoplay?1:0,controls:st.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:_.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(e){R(st.elements.container,"error",!0,{code:e.data,embed:e.target})},onPlaybackQualityChange:function(e){var t=e.target,n=t.getPlaybackQuality();console.warn(n)},onReady:function(t){var n=t.target;st.elements.media.play=function(){n.playVideo(),st.elements.media.paused=!1},st.elements.media.pause=function(){n.pauseVideo(),st.elements.media.paused=!0},st.elements.media.stop=function(){n.stopVideo(),st.elements.media.paused=!0},st.elements.media.duration=n.getDuration(),st.elements.media.paused=!0,st.elements.media.currentTime=0,st.elements.media.muted=n.isMuted();var a=n.getPlaybackRate(),s=n.getAvailablePlaybackRates();console.warn(a,s),_.title=n.getVideoData().title,st.supported.full&&st.elements.media.querySelector("iframe").setAttribute("tabindex","-1"),ye(),R(st.elements.media,"timeupdate"),R(st.elements.media,"durationchange"),e.clearInterval(lt.buffering),lt.buffering=e.setInterval(function(){st.elements.media.buffered=n.getVideoLoadedFraction(),(null===st.elements.media.lastBuffered||st.elements.media.lastBuffered<st.elements.media.buffered)&&R(st.elements.media,"progress"),st.elements.media.lastBuffered=st.elements.media.buffered,1===st.elements.media.buffered&&(e.clearInterval(lt.buffering),R(st.elements.media,"canplaythrough"))},200)},onStateChange:function(t){var n=t.target;switch(e.clearInterval(lt.playing),t.data){case 0:st.elements.media.paused=!0,R(st.elements.media,"ended");break;case 1:st.elements.media.paused=!1,st.elements.media.seeking&&R(st.elements.media,"seeked"),st.elements.media.seeking=!1,R(st.elements.media,"play"),R(st.elements.media,"playing"),lt.playing=e.setInterval(function(){st.elements.media.currentTime=n.getCurrentTime(),R(st.elements.media,"timeupdate")},100),st.elements.media.duration!==n.getDuration()&&(st.elements.media.duration=n.getDuration(),R(st.elements.media,"durationchange"));var a=n.getAvailableQualityLevels(),s=n.getPlaybackQuality();G(a,s);break;case 2:st.elements.media.paused=!0,R(st.elements.media,"pause")}R(st.elements.container,"statechange",!1,{code:t.data})}}})}function ve(t,n){st.embed=new e.Vimeo.Player(n,{id:parseInt(t),loop:_.loop.active,autoplay:_.autoplay,byline:!1,portrait:!1,title:!1}),st.elements.media.play=function(){st.embed.play(),st.elements.media.paused=!1},st.elements.media.pause=function(){st.embed.pause(),st.elements.media.paused=!0},st.elements.media.stop=function(){st.embed.stop(),st.elements.media.paused=!0},st.elements.media.paused=!0,st.elements.media.currentTime=0,ye(),st.embed.getCurrentTime().then(function(e){st.elements.media.currentTime=e,R(st.elements.media,"timeupdate")}),st.embed.getDuration().then(function(e){st.elements.media.duration=e,R(st.elements.media,"durationchange")}),st.embed.on("loaded",function(){O.htmlElement(st.embed.element)&&st.supported.full&&st.embed.element.setAttribute("tabindex","-1")}),st.embed.on("play",function(){st.elements.media.paused=!1,R(st.elements.media,"play"),R(st.elements.media,"playing")}),st.embed.on("pause",function(){st.elements.media.paused=!0,R(st.elements.media,"pause")}),st.embed.on("timeupdate",function(e){st.elements.media.seeking=!1,st.elements.media.currentTime=e.seconds,R(st.elements.media,"timeupdate")}),st.embed.on("progress",function(e){st.elements.media.buffered=e.percent,R(st.elements.media,"progress"),1===parseInt(e.percent)&&R(st.elements.media,"canplaythrough")}),st.embed.on("seeked",function(){st.elements.media.seeking=!1,R(st.elements.media,"seeked"),R(st.elements.media,"play")}),st.embed.on("ended",function(){st.elements.media.paused=!0,R(st.elements.media,"ended")})}function ge(){st.embed=e.SC.Widget(this),st.embed.bind(e.SC.Widget.Events.READY,function(){st.elements.media.play=function(){st.embed.play(),st.elements.media.paused=!1},st.elements.media.pause=function(){st.embed.pause(),st.elements.media.paused=!0},st.elements.media.stop=function(){st.embed.seekTo(0),st.embed.pause(),st.elements.media.paused=!0},st.elements.media.paused=!0,st.elements.media.currentTime=0,st.embed.getDuration(function(e){st.elements.media.duration=e/1e3,ye()}),st.embed.getPosition(function(e){st.elements.media.currentTime=e,R(st.elements.media,"timeupdate")}),st.embed.bind(e.SC.Widget.Events.PLAY,function(){st.elements.media.paused=!1,R(st.elements.media,"play"),R(st.elements.media,"playing")}),st.embed.bind(e.SC.Widget.Events.PAUSE,function(){st.elements.media.paused=!0,R(st.elements.media,"pause")}),st.embed.bind(e.SC.Widget.Events.PLAY_PROGRESS,function(e){st.elements.media.seeking=!1,st.elements.media.currentTime=e.currentPosition/1e3,R(st.elements.media,"timeupdate")}),st.embed.bind(e.SC.Widget.Events.LOAD_PROGRESS,function(e){st.elements.media.buffered=e.loadProgress,R(st.elements.media,"progress"),1===parseInt(e.loadProgress)&&R(st.elements.media,"canplaythrough")}),st.embed.bind(e.SC.Widget.Events.FINISH,function(){st.elements.media.paused=!0,R(st.elements.media,"ended")})})}function he(){"play"in st.elements.media&&st.elements.media.play()}function ke(){"pause"in st.elements.media&&st.elements.media.pause()}function we(e){return O.boolean(e)||(e=st.elements.media.paused),e?he():ke(),e}function Ce(e){l(["start","end","all","none","toggle"],e)||(e="toggle");var n=Number(st.elements.media.currentTime);switch(e){case"start":_.loop.end&&_.loop.end<=n&&(_.loop.end=null),_.loop.start=n,_.loop.indicator.start=st.elements.display.played.value;break;case"end":if(_.loop.start>=n)return;_.loop.end=n,_.loop.indicator.end=st.elements.display.played.value;break;case"all":_.loop.start=0,_.loop.end=st.elements.media.duration-2,_.loop.indicator.start=0,_.loop.indicator.end=100;break;case"toggle":_.loop.active?(_.loop.start=0,_.loop.end=null):(_.loop.start=0,_.loop.end=st.elements.media.duration-2);break;default:_.loop.start=0,_.loop.end=null}_.loop.active=O.number(_.loop.start)&&O.number(_.loop.end);var a=(We(_.loop.start,D('[data-plyr-loop="start"]')),null);O.number(_.loop.end)&&(a=We(_.loop.end,t.querySelector('[data-loop__value="loopout"]'))),_.loop.active}function xe(e){if(O.undefined(e)&&(e=st.storage.speed||_.defaultSpeed),!O.array(_.speeds))return void ot("Invalid speeds format");if(!O.number(e)){var t=_.speeds.indexOf(_.currentSpeed);if(t!==-1){var n=t+1;n>=_.speeds.length&&(n=0),e=_.speeds[n]}else e=_.defaultSpeed}_.currentSpeed=e,st.elements.media.playbackRate=e,pe({speed:e})}function Te(){return _.currentSpeed.toFixed(1).toString().replace(".0","")+"&times;"}function Se(e){O.number(e)||(e=_.seekTime),Ae(st.elements.media.currentTime-e)}function Ee(e){O.number(e)||(e=_.seekTime),Ae(st.elements.media.currentTime+e)}function Ae(e){var t=0,n=st.elements.media.paused,a=_e();O.number(e)?t=e:O.event(e)&&l(["input","change"],e.type)&&(t=e.target.value/e.target.max*a),t<0?t=0:t>a&&(t=a),Ye(t);try{st.elements.media.currentTime=t.toFixed(4)}catch(e){}if(l(_.types.embed,st.type)){switch(st.type){case"youtube":st.embed.seekTo(t);break;case"vimeo":st.embed.setCurrentTime(t.toFixed(0));break;case"soundcloud":st.embed.seekTo(1e3*t)}n&&ke(),R(st.elements.media,"timeupdate"),st.elements.media.seeking=!0,R(st.elements.media,"seeking")}rt("Seeking to "+st.elements.media.currentTime+" seconds"),se(t)}function _e(){var e=parseInt(_.duration),t=0;return null===st.elements.media.duration||isNaN(st.elements.media.duration)||(t=st.elements.media.duration),isNaN(e)?t:e}function Ie(){y(st.elements.container,_.classes.playing,!st.elements.media.paused),y(st.elements.container,_.classes.stopped,st.elements.media.paused),Ue(st.elements.media.paused)}function Pe(){q={x:e.pageXOffset||0,y:e.pageYOffset||0}}function Ne(){e.scrollTo(q.x,q.y)}function Fe(e){var n=M.fullscreen;if(n){if(!e||e.type!==j.eventType)return j.isFullScreen(st.elements.container)?j.cancelFullScreen():(Pe(),j.requestFullScreen(st.elements.container)),void(st.fullscreen.active=j.isFullScreen(st.elements.container));st.fullscreen.active=j.isFullScreen(st.elements.container)}else st.fullscreen.active=!st.fullscreen.active,t.body.style.overflow=st.fullscreen.active?"hidden":"";y(st.elements.container,_.classes.fullscreen.active,st.fullscreen.active),W(st.fullscreen.active),st.elements.buttons&&st.elements.buttons.fullscreen&&x(st.elements.buttons.fullscreen,st.fullscreen.active),R(st.elements.container,st.fullscreen.active?"enterfullscreen":"exitfullscreen",!0),!st.fullscreen.active&&n&&Ne()}function qe(e){if(O.boolean(e)||(e=!st.elements.media.muted),x(st.elements.buttons.mute,e),st.elements.media.muted=e,0===st.elements.media.volume&&Le(_.volume),l(_.types.embed,st.type)){switch(st.type){case"youtube":st.embed[st.elements.media.muted?"mute":"unMute"]();break;case"vimeo":case"soundcloud":st.embed.setVolume(st.elements.media.muted?0:parseFloat(_.volume/10))}R(st.elements.media,"volumechange")}}function Le(e){var t=10,n=0;if(O.event(e)&&(e=e.target.value),O.undefined(e)&&(e=st.storage.volume),(null===e||isNaN(e))&&(e=_.volume),e>t&&(e=t),e<n&&(e=n),st.elements.media.volume=parseFloat(e/t),st.elements.display.volume&&(st.elements.display.volume.value=e),l(_.types.embed,st.type)){switch(st.type){case"youtube":st.embed.setVolume(100*st.elements.media.volume);break;case"vimeo":case"soundcloud":st.embed.setVolume(st.elements.media.volume)}R(st.elements.media,"volumechange")}0===e?st.elements.media.muted=!0:st.elements.media.muted&&e>0&&qe()}function Oe(e){var t=st.elements.media.muted?0:10*st.elements.media.volume;O.number(e)||(e=1),Le(t+e)}function je(e){var t=st.elements.media.muted?0:10*st.elements.media.volume;O.number(e)||(e=1),Le(t-e)}function Me(){var e=st.elements.media.muted?0:10*st.elements.media.volume;st.supported.full&&(st.elements.inputs.volume&&(st.elements.inputs.volume.value=e),st.elements.display.volume&&(st.elements.display.volume.value=e)),pe({volume:e}),y(st.elements.container,_.classes.muted,0===e),st.supported.full&&st.elements.buttons.mute&&x(st.elements.buttons.mute,0===e)}function Re(e){var t="waiting"===e.type;clearTimeout(lt.loading),lt.loading=setTimeout(function(){y(st.elements.container,_.classes.loading,t),Ue(t)},t?250:0)}function Ve(e){if(st.supported.full){var t=st.elements.display.played,n=0,a=_e();if(e)switch(e.type){case"timeupdate":case"seeking":if(st.elements.controls.pressed)return;n=T(st.elements.media.currentTime,a),"timeupdate"===e.type&&st.elements.inputs.seek&&(st.elements.inputs.seek.value=n);break;case"playing":case"progress":t=st.elements.display.buffer,n=function(){var e=st.elements.media.buffered;return e&&e.length?T(e.end(0),a):O.number(e)?100*e:0}()}O.number(_.loop.start)&&O.number(_.loop.end)&&st.elements.media.currentTime>=_.loop.end&&Ae(_.loop.start),De(t,n)}}function De(e,t){if(st.supported.full){if(O.undefined(t)&&(t=0),O.undefined(e)){if(!O.htmlElement(st.elements.display.buffer))return;e=st.elements.display.buffer}if(O.htmlElement(e)){e.value=t;var n=e.getElementsByTagName("span")[0];O.htmlElement(n)&&(n.childNodes[0].nodeValue=t)}}}function We(e,t){if(t){isNaN(e)&&(e=0);var n=parseInt(e%60),a=parseInt(e/60%60),s=parseInt(e/60/60%60),l=parseInt(_e()/60/60%60)>0;n=("0"+n).slice(-2),a=("0"+a).slice(-2);var i=(l?s+":":"")+a+":"+n;return t.textContent=i,i}}function He(){if(st.supported.full){var e=_e()||0;!st.elements.display.duration&&_.displayDuration&&st.elements.media.paused&&We(e,st.elements.display.currentTime),st.elements.display.duration&&We(e,st.elements.display.duration),Xe()}}function Be(e){We(st.elements.media.currentTime,st.elements.display.currentTime),e&&"timeupdate"===e.type&&st.elements.media.seeking||Ve(e)}function Ye(e){O.number(e)||(e=0);var t=_e(),n=T(e,t);st.elements.progress&&st.elements.display.played&&(st.elements.display.played.value=n),st.elements.buttons&&st.elements.inputs.seek&&(st.elements.inputs.seek.value=n)}function Xe(e){var t=_e();if(_.tooltips.seek&&O.htmlElement(st.elements.inputs.seek)&&O.htmlElement(st.elements.display.seekTooltip)&&0!==t){var n=st.elements.inputs.seek.getBoundingClientRect(),a=0,s=_.classes.tooltip+"--visible";if(O.event(e))a=100/n.width*(e.pageX-n.left);else{if(!b(st.elements.display.seekTooltip,s))return;a=st.elements.display.seekTooltip.style.left.replace("%","")}a<0?a=0:a>100&&(a=100),We(t/100*a,st.elements.display.seekTooltip),st.elements.display.seekTooltip.style.left=a+"%",O.event(e)&&l(["mouseenter","mouseleave"],e.type)&&y(st.elements.display.seekTooltip,s,"mouseenter"===e.type)}}function Ue(t){if(_.hideControls&&"audio"!==st.type){var n=0,a=!1,s=t,i=b(st.elements.container,_.classes.loading);
if(O.boolean(t)||(t&&t.type?(a="enterfullscreen"===t.type,s=l(["mousemove","touchstart","mouseenter","focus"],t.type),l(["mousemove","touchmove"],t.type)&&(n=2e3),"focus"===t.type&&(n=3e3)):s=b(st.elements.container,_.classes.hideControls)),e.clearTimeout(lt.hover),s||st.elements.media.paused||i){if(y(st.elements.container,_.classes.hideControls,!1),st.elements.media.paused||i)return;st.browser.isTouch&&(n=3e3)}s&&st.elements.media.paused||(lt.hover=e.setTimeout(function(){(!st.elements.controls.pressed&&!st.elements.controls.hover||a)&&y(st.elements.container,_.classes.hideControls,!0)},n))}}function Je(e){if(!O.undefined(e))return void Ke(e);var t;switch(st.type){case"youtube":t=st.embed.getVideoUrl();break;case"vimeo":st.embed.getVideoUrl.then(function(e){t=e});break;case"soundcloud":st.embed.getCurrentSound(function(e){t=e.permalink_url});break;default:t=st.elements.media.currentSrc}return t||""}function Ke(e){function t(){if(st.embed=null,r(st.elements.media),"video"===st.type&&st.elements.wrapper&&r(st.elements.wrapper),st.elements.container&&st.elements.container.removeAttribute("class"),"type"in e&&(st.type=e.type,"video"===st.type)){var t=e.sources[0];"type"in t&&l(_.types.embed,t.type)&&(st.type=t.type)}switch(st.supported=P(st.type),st.type){case"video":st.elements.media=d("video");break;case"audio":st.elements.media=d("audio");break;case"youtube":case"vimeo":case"soundcloud":st.elements.media=d("div"),st.embedId=e.sources[0].src}o(st.elements.container,st.elements.media),O.boolean(e.autoplay)&&(_.autoplay=e.autoplay),l(_.types.html5,st.type)&&(_.crossorigin&&st.elements.media.setAttribute("crossorigin",""),_.autoplay&&st.elements.media.setAttribute("autoplay",""),"poster"in e&&st.elements.media.setAttribute("poster",e.poster),_.loop.active&&st.elements.media.setAttribute("loop","")),y(st.elements.container,_.classes.fullscreen.active,st.fullscreen.active),y(st.elements.container,_.classes.captions.active,st.captions.enabled),oe(),l(_.types.html5,st.type)&&H("source",e.sources),me(),l(_.types.html5,st.type)&&("tracks"in e&&H("track",e.tracks),st.elements.media.load()),(l(_.types.html5,st.type)||l(_.types.embed,st.type)&&!st.supported.full)&&(tt(),nt()),_.title=e.title,ce()}return O.object(e)&&"sources"in e&&e.sources.length?(y(st.elements.container,_.classes.ready,!1),ke(),Ye(),De(),Ge(),void Ze(t,!1)):void ot("Invalid source format")}function Qe(e){"video"===st.type&&st.elements.media.setAttribute("poster",e)}function ze(){function n(){var e=we(),t=st.elements.buttons[e?"play":"pause"],n=st.elements.buttons[e?"pause":"play"];if(n=n&&n.length>1?n[n.length-1]:n[0]){var a=b(t,_.classes.tabFocus);setTimeout(function(){n.focus(),a&&(y(t,_.classes.tabFocus,!1),y(n,_.classes.tabFocus,!0))},100)}}function a(){var e=t.activeElement;return e=e&&e!==t.body?t.querySelector(":focus"):null}function s(e){return e.keyCode?e.keyCode:e.which}function i(e){for(var t in st.elements.buttons){var n=st.elements.buttons[t];if(O.nodeList(n))for(var a=0;a<n.length;a++)y(n[a],_.classes.tabFocus,n[a]===e);else y(n,_.classes.tabFocus,n===e)}}function o(e){function t(){var e=st.elements.media.duration;O.number(e)&&Ae(e/10*(i-48))}var i=s(e),r="keydown"===e.type,o=r&&i===c;if(O.number(i))if(r){var u=[48,49,50,51,52,53,54,56,57,32,75,38,40,77,39,37,70,67,73,76,79],d=[38,40];if(l(d,i)){var p=a();if(O.htmlElement(p)&&"radio"===a().type)return}switch(l(u,i)&&(e.preventDefault(),e.stopPropagation()),i){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:o||t();break;case 32:case 75:o||n();break;case 38:Oe();break;case 40:je();break;case 77:o||qe();break;case 39:Ee();break;case 37:Se();break;case 70:Fe();break;case 67:o||ie();break;case 73:Ce("start");break;case 76:Ce();break;case 79:Ce("end")}!M.fullscreen&&st.fullscreen.active&&27===i&&Fe(),c=i}else c=null}var u=st.browser.isIE?"change":"input";if(_.keyboardShortcuts.focused){var c=null;_.keyboardShortcuts.global&&k(e,"keydown keyup",function(e){var t=s(e),n=a(),i=[48,49,50,51,52,53,54,56,57,75,77,70,67,73,76,79],r=F().length;1!==r||!l(i,t)||O.htmlElement(n)&&v(n,_.selectors.editable)||o(e)}),k(st.elements.container,"keydown keyup",o)}k(e,"keyup",function(e){var t=s(e),n=a();9===t&&i(n)}),k(t.body,"click",function(){y(D("."+_.classes.tabFocus),_.classes.tabFocus,!1)});for(var d in st.elements.buttons){var p=st.elements.buttons[d];k(p,"blur",function(){y(p,"tab-focus",!1)})}var m=function(e,t,n){O.function(t)&&t.call(this,e),O.function(n)&&n.call(this,e)};g(st.elements.buttons.play,"click",_.listeners.play,n),g(st.elements.buttons.playLarge,"click",_.listeners.play,n),g(st.elements.buttons.pause,"click",_.listeners.pause,n),g(st.elements.buttons.restart,"click",_.listeners.restart,Ae),g(st.elements.buttons.rewind,"click",_.listeners.rewind,Se),g(st.elements.buttons.forward,"click",_.listeners.forward,Ee),g(st.elements.buttons.mute,"click",_.listeners.mute,qe),g(st.elements.buttons.captions,"click",_.listeners.captions,ie),g(st.elements.buttons.fullscreen,"click",_.listeners.fullscreen,Fe),g(st.elements.buttons.pip,"click",_.listeners.pip,function(e){st.elements.media.webkitSetPresentationMode("picture-in-picture"===st.elements.media.webkitPresentationMode?"inline":"picture-in-picture")}),k(st.elements.settings.menu,"click",function(n){var a=this,s=n.target,l=t.getElementById(s.getAttribute("aria-controls")),i="false"===s.getAttribute("aria-expanded");if(O.htmlElement(l)){var o,u,c,d="tabpanel"===l.getAttribute("role");if(d){var p=a.querySelector('[role="tabpanel"][aria-hidden="false"]');c=p.parentNode,[].forEach.call(a.querySelectorAll('[aria-controls="'+p.getAttribute("id")+'"]'),function(e){e.setAttribute("aria-expanded",!1)}),c.style.width=p.scrollWidth+"px",c.style.height=p.scrollHeight+"px",p.setAttribute("aria-hidden",!0),p.setAttribute("tabindex",-1);var m=l.cloneNode(!0);m.style.position="absolute",m.style.opacity=0,m.setAttribute("aria-hidden",!1),c.appendChild(m),o=m.scrollWidth,u=m.scrollHeight,r(m)}l.setAttribute("aria-hidden",!i),s.setAttribute("aria-expanded",i),l.setAttribute("tabindex",0),d&&(c.style.width=o+"px",c.style.height=u+"px",e.setTimeout(function(){c.style.width="",c.style.height=""},300))}}),k(st.elements.settings.menu,"click",function(e){v(e.target,_.selectors.buttons.speed)?m.call(this,e,_.listeners.speed,function(){}):v(e.target,_.selectors.buttons.quality)?m.call(this,e,_.listeners.quality,function(){console.warn("Set quality")}):v(e.target,_.selectors.buttons.loop)?m.call(this,e,_.listeners.loop,function(){var t=e.target.getAttribute("data-loop__value")||e.target.getAttribute("data-loop__type");l(["start","end","all","none"],t)&&Ce(t)}):v(e.target,_.selectors.buttons.language)&&m.call(this,e,_.listeners.language,function(e){var t=e.target.attributes.getNamedItem("data-index").value;ne(t)})}),g(st.elements.inputs.seek,u,_.listeners.seek,Ae),g(st.elements.inputs.volume,u,_.listeners.volume,Le),k(st.elements.progress,"mouseenter mouseleave mousemove",Xe),_.hideControls&&(k(st.elements.container,"mouseenter mouseleave mousemove touchstart touchend touchcancel touchmove enterfullscreen",Ue),k(st.elements.controls,"mouseenter mouseleave",function(e){st.elements.controls.hover="mouseenter"===e.type}),k(st.elements.controls,"mousedown mouseup touchstart touchend touchcancel",function(e){st.elements.controls.pressed=l(["mousedown","touchstart"],e.type)}),k(st.elements.controls,"focus blur",Ue,!0)),g(st.elements.inputs.volume,"wheel",_.listeners.volume,function(e){var t=e.webkitDirectionInvertedFromDevice,n=.2,a=0;(e.deltaY<0||e.deltaX>0)&&(t?(je(n),a=-1):(Oe(n),a=1)),(e.deltaY>0||e.deltaX<0)&&(t?(Oe(n),a=1):(je(n),a=-1)),(1===a&&st.elements.media.volume<1||a===-1&&st.elements.media.volume>0)&&e.preventDefault()}),M.fullscreen&&k(t,j.eventType,Fe)}function $e(){if(k(st.elements.media,"timeupdate seeking",Be),k(st.elements.media,"timeupdate",se),k(st.elements.media,"durationchange loadedmetadata",He),k(st.elements.media,"ended",function(){"video"===st.type&&_.showPosterOnEnd&&("video"===st.type&&ae(),Ae(),st.elements.media.load())}),k(st.elements.media,"progress playing",Ve),k(st.elements.media,"volumechange",Me),k(st.elements.media,"play pause ended",Ie),k(st.elements.media,"waiting canplay seeked",Re),_.clickToPlay&&"audio"!==st.type){var e=D("."+_.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",k(e,"click",function(){_.hideControls&&st.browser.isTouch&&!st.elements.media.paused||(st.elements.media.paused?he():st.elements.media.ended?(Ae(),he()):ke())})}_.disableContextMenu&&k(st.elements.media,"contextmenu",function(e){e.preventDefault()}),k(st.elements.media,_.events.concat(["keyup","keydown"]).join(" "),function(e){R(st.elements.container,e.type,!0)})}function Ge(){if(l(_.types.html5,st.type)){for(var e=st.elements.media.querySelectorAll("source"),t=0;t<e.length;t++)r(e[t]);st.elements.media.setAttribute("src","https://cdn.selz.com/plyr/blank.mp4"),st.elements.media.load(),rt("Cancelled network requests")}}function Ze(n,a){function s(){O.boolean(a)||(a=!0),O.function(n)&&n.call(it),a&&(st.init=!1,st.elements.container.parentNode.replaceChild(it,st.elements.container),t.body.style.overflow="",R(it,"destroyed",!0))}if(!st.init)return null;switch(st.type){case"youtube":e.clearInterval(lt.buffering),e.clearInterval(lt.playing),st.embed.destroy(),s();break;case"vimeo":st.embed.unload().then(s),e.setTimeout(s,200);break;case"video":case"audio":ue(!0),s()}}function et(){if(st.init)return null;if(st.browser=n(),O.htmlElement(st.elements.media)){de();var e=h.tagName.toLowerCase();"div"===e?(st.type=h.getAttribute("data-type"),st.embedId=h.getAttribute("data-video-id"),h.removeAttribute("data-type"),h.removeAttribute("data-video-id")):(st.type=e,_.crossorigin=null!==h.getAttribute("crossorigin"),_.autoplay=_.autoplay||null!==h.getAttribute("autoplay"),_.loop=_.loop||null!==h.getAttribute("loop")),st.supported=P(st.type),st.supported.basic&&(st.elements.container=i(h,d("div")),st.elements.container.setAttribute("tabindex",0),oe(),rt(""+st.browser.name+" "+st.browser.version),me(),(l(_.types.html5,st.type)||l(_.types.embed,st.type)&&!st.supported.full)&&(tt(),nt(),ce()),st.init=!0)}}function tt(){return st.supported.full?(O.htmlElement(D(_.selectors.controls.wrapper))||(re(),ze()),$e(),ue(),Z(),te(),ne(),Le(),Me(),xe(),Ce(),Be(),void Ie()):(ot("Basic support only",st.type),r(D(_.selectors.controls.wrapper)),r(D(_.selectors.buttons.play)),void ue(!0))}function nt(){e.setTimeout(function(){R(st.elements.media,"ready")},0),y(st.elements.media,L.classes.setup,!0),y(st.elements.container,_.classes.ready,!0),st.elements.media.plyr=at,_.autoplay&&he()}var at,st=this,lt={};st.fullscreen={active:!1},st.elements={buttons:{},display:{},progress:{},inputs:{},settings:{menu:null,panes:{},tabs:{}},media:h},st.captions={enabled:!1,textTracks:!1,captions:[]};var it=h.cloneNode(!0),rt=function(){N("log",arguments)},ot=function(){N("warn",arguments)};return rt("Config",_),rt("Support",M),at={getOriginal:function(){return it},getContainer:function(){return st.elements.container},getEmbed:function(){return st.embed},getMedia:function(){return st.elements.media},getType:function(){return st.type},getDuration:_e,getCurrentTime:function(){return st.elements.media.currentTime},getVolume:function(){return st.elements.media.volume},isMuted:function(){return st.elements.media.muted},isReady:function(){return b(st.elements.container,_.classes.ready)},isLoading:function(){return b(st.elements.container,_.classes.loading)},isPaused:function(){return st.elements.media.paused},isLooping:function(){return _.loop.active},on:function(e,t){return k(st.elements.container,e,t),this},play:he,pause:ke,loop:Ce,stop:function(){ke(),Ae()},restart:Ae,rewind:Se,forward:Ee,seek:Ae,source:Je,poster:Qe,setVolume:Le,setSpeed:xe,togglePlay:we,toggleMute:qe,toggleCaptions:ie,toggleFullscreen:Fe,toggleControls:Ue,setCaptionIndex:ne,isFullscreen:function(){return st.fullscreen.active||!1},support:function(e){return M.mime(st,e)},destroy:Ze},et(),st.init?at:null}function I(e,n){var a=new XMLHttpRequest;if(!O.string(n)||!O.htmlElement(t.querySelector("#"+n))){var s=d("div");s.setAttribute("hidden",""),O.string(n)&&s.setAttribute("id",n),t.body.insertBefore(s,t.body.childNodes[0]),"withCredentials"in a&&(a.open("GET",e,!0),a.onload=function(){s.innerHTML=a.responseText},a.send())}}function P(e){var t,a,s=n(),l=s.isIE&&s.version<=9,i=s.isIos,r=/iPhone|iPod/i.test(navigator.userAgent),o=!!d("audio").canPlayType,u=!!d("video").canPlayType;switch(e){case"video":t=u,a=t&&!l&&!r;break;case"audio":t=o,a=t&&!l;break;case"vimeo":case"youtube":case"soundcloud":t=!0,a=!l&&!i;break;default:t=o&&u,a=t&&!l}return{basic:t,full:a}}function N(e,n){function a(e,t){b(t,L.classes.hook)||s.push({target:e,media:t})}var s=[],l=[],i=[L.selectors.html5,L.selectors.embed].join(",");if(O.string(e)?e=t.querySelectorAll(e):O.htmlElement(e)?e=[e]:O.nodeList(e)||O.array(e)||O.string(e)||(O.undefined(n)&&O.object(e)&&(n=e),e=t.querySelectorAll(i)),O.nodeList(e)&&(e=Array.prototype.slice.call(e)),!P().basic||!e.length)return!1;for(var r=0;r<e.length;r++){var o=e[r],u=o.querySelectorAll(i);if(u.length)for(var c=0;c<u.length;c++)a(o,u[c]);else v(o,i)&&a(o,o)}return s.forEach(function(e){var t=e.target,a=e.media,s=!1;a===t&&(s=!0);var i={};try{i=JSON.parse(t.getAttribute("data-plyr"))}catch(e){}var r=S({},L,n,i);if(!r.enabled)return null;var o=new _(a,r);if(O.object(o)){if(r.debug){var u=r.events.concat(["setup","statechange","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled"]);k(o.getContainer(),u.join(" "),function(e){console.log([r.logPrefix,"event:",e.type].join(" "),e.detail.plyr)})}C(o.getContainer(),"setup",!0,{plyr:o}),l.push(o)}}),l}function F(e){if(O.string(e)?e=t.querySelector(e):O.undefined(e)&&(e=t.body),O.htmlElement(e)){var n=e.querySelectorAll("."+L.classes.setup),a=[];return Array.prototype.slice.call(n).forEach(function(e){O.object(e.plyr)&&a.push(e.plyr)}),a}return[]}var q={x:0,y:0},L={enabled:!0,debug:!1,autoplay:!1,loop:{active:!1,start:0,end:null,indicator:{start:0,end:0}},seekTime:10,volume:10,defaultSpeed:1,currentSpeed:1,speeds:[.5,1,1.5,2],duration:null,displayDuration:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/2.0.10/plyr.svg",clickToPlay:!0,hideControls:!0,showPosterOnEnd:!1,disableContextMenu:!0,quality:{options:!1},keyboardShortcuts:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},tracks:[],selectors:{html5:"video, audio",embed:"[data-type]",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"]',forward:'[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"]',speed:'[data-plyr="speed"]',loop:'[data-plyr="loop"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress--buffer",played:".plyr__progress--played",loop:".plyr__progress--loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",menu:{quality:".js-plyr__menu__list--quality"}},classes:{setup:"plyr--setup",ready:"plyr--ready",videoWrapper:"plyr__video-wrapper",embedWrapper:"plyr__video-embed",control:"plyr__control",type:"plyr--{0}",stopped:"plyr--stopped",playing:"plyr--playing",muted:"plyr--muted",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",menu:{value:"plyr__menu__value",badge:"plyr__badge"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",active:"plyr--fullscreen-active"},pip:{enabled:"plyr--pip-enabled",active:"plyr--pip-active"},tabFocus:"tab-focus"},captions:{defaultActive:!1,selectedIndex:0},fullscreen:{enabled:!0,fallback:!0,allowAudio:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],i18n:{restart:"Restart",rewind:"Rewind {seektime} secs",play:"Play",pause:"Pause",forward:"Forward {seektime} secs",seek:"Seek",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",toggleMute:"Toggle Mute",toggleCaptions:"Toggle Captions",toggleFullscreen:"Toggle Fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",speed:"Speed",quality:"Quality",loop:"Loop",loopStart:"Loop start",loopEnd:"Loop end",loopAll:"Loop all",loopNone:"No Loop"},types:{embed:["youtube","vimeo","soundcloud"],html5:["video","audio"]},urls:{vimeo:{api:"https://player.vimeo.com/api/player.js"},youtube:{api:"https://www.youtube.com/iframe_api"},soundcloud:{api:"https://w.soundcloud.com/player/api.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,forward:null,mute:null,volume:null,captions:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ready","ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied"],logPrefix:""},O={object:function(e){return null!==e&&"object"==typeof e&&e.constructor===Object},array:function(e){return null!==e&&"object"==typeof e&&e.constructor===Array},number:function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"==typeof e&&e.constructor===Number)},string:function(e){return null!==e&&("string"==typeof e||"object"==typeof e&&e.constructor===String)},boolean:function(e){return null!==e&&"boolean"==typeof e},nodeList:function(e){return null!==e&&e instanceof NodeList},htmlElement:function(e){return null!==e&&e instanceof HTMLElement},function:function(e){return null!==e&&"function"==typeof e},event:function(e){return null!==e&&e instanceof Event},undefined:function(e){return null!==e&&"undefined"==typeof e},empty:function(e){return null===e||this.undefined(e)||(this.string(e)||this.array(e)||this.nodeList(e))&&0===e.length||this.object(e)&&0===Object.keys(e).length}},j=function(){var e=function(){var e=!1;return O.function(t.cancelFullScreen)?e="":["webkit","o","moz","ms","khtml"].some(function(n){return O.function(t[n+"CancelFullScreen"])?(e=n,!0):O.function(t.msExitFullscreen)&&t.msFullscreenEnabled?(e="ms",!0):void 0}),e}();return{prefix:e,eventType:"ms"===e?"MSFullscreenChange":e+"fullscreenchange",isFullScreen:function(n){if(!M.fullscreen)return!1;switch(O.undefined(n)&&(n=t.body),this.prefix){case"":return t.fullscreenElement===n;case"moz":return t.mozFullScreenElement===n;default:return t[e+"FullscreenElement"]===n}},requestFullScreen:function(n){return!!M.fullscreen&&(O.htmlElement(n)||(n=t.body),console.log(e),""===e?n.requestFullScreen():n[e+("ms"===e?"RequestFullscreen":"RequestFullScreen")]())},cancelFullScreen:function(){return!!M.fullscreen&&(""===e?t.cancelFullScreen():t[e+("ms"===e?"ExitFullscreen":"CancelFullScreen")]())},element:function(){return M.fullscreen?""===e?t.fullscreenElement:t[e+"FullscreenElement"]:null}}}(),M={fullscreen:j.prefix!==!1,storage:function(){if(!("localStorage"in e))return!1;try{e.localStorage.setItem("___test","OK");var t=e.localStorage.getItem("___test");return e.localStorage.removeItem("___test"),"OK"===t}catch(e){return!1}return!1}(),pip:function(){return O.function(d("video").webkitSetPresentationMode)}(),airplay:function(){return O.function(e.WebKitPlaybackTargetAvailabilityEvent)}(),mime:function(e,t){var n=e.media;try{if(!O.function(n.canPlayType))return!1;if("video"===e.type)switch(t){case"video/webm":return n.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,"");case"video/mp4":return n.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,"");case"video/ogg":return n.canPlayType('video/ogg; codecs="theora"').replace(/no/,"")}else if("audio"===e.type)switch(t){case"audio/mpeg":return n.canPlayType("audio/mpeg;").replace(/no/,"");case"audio/ogg":return n.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,"");case"audio/wav":return n.canPlayType('audio/wav; codecs="1"').replace(/no/,"")}}catch(e){return!1}return!1}};return{setup:N,supported:P,loadSprite:I,get:F}}),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,window.CustomEvent=e)}();