-
Notifications
You must be signed in to change notification settings - Fork 83
/
openplayer.min.js
1 lines (1 loc) · 117 KB
/
openplayer.min.js
1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OpenPlayer=t():e.OpenPlayer=t()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=51)}([function(e,t,n){var i=n(3),r=n(6),s=n(16),a=n(21),o=n(18),l=function(e,t,n){var u,c,d,h,p=e&l.F,f=e&l.G,v=e&l.S,m=e&l.P,y=e&l.B,b=f?i:v?i[t]||(i[t]={}):(i[t]||{}).prototype,g=f?r:r[t]||(r[t]={}),E=g.prototype||(g.prototype={});for(u in f&&(n=t),n)d=((c=!p&&b&&void 0!==b[u])?b:n)[u],h=y&&c?o(d,i):m&&"function"==typeof d?o(Function.call,d):d,b&&a(b,u,d,e&l.U),g[u]!=d&&s(g,u,h),m&&E[u]!=d&&(E[u]=d)};i.core=r,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){var i=n(42)("wks"),r=n(27),s=n(3).Symbol,a="function"==typeof s;(e.exports=function(e){return i[e]||(i[e]=a&&s[e]||(a?s:r)("Symbol."+e))}).store=i},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";var i=n(7);e.exports=function(e,t){return!!e&&i(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAbsoluteUrl=function(e){var t;return t||(t=document.createElement("a")),t.href=e,t.href},t.isVideo=function(e){return"video"===e.tagName.toLowerCase()},t.isAudio=function(e){return"audio"===e.tagName.toLowerCase()},t.loadScript=function(e){return new Promise(function(t,n){var i=document.createElement("script");i.src=e,i.async=!0,i.onload=function(){i.remove(),t()},i.onerror=function(){i.remove(),n()},document.head.appendChild(i)})},t.request=function(e,t,n,i){var r,s=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");switch(t){case"text":r="text/plain";break;case"json":r="application/json, text/javascript";break;case"html":r="text/html";break;case"xml":r="application/xml, text/xml";break;default:r="application/x-www-form-urlencoded; charset=UTF-8"}var a=!1,o="application/x-www-form-urlencoded"!==r?"".concat(r,", */*; q=0.01"):"*/".concat("*");s&&(s.open("GET",e,!0),s.setRequestHeader("Accept",o),s.onreadystatechange=function(){if(!a&&4===s.readyState)if(200===s.status){var e;switch(a=!0,t){case"json":e=JSON.parse(s.responseText);break;case"xml":e=s.responseXML;break;default:e=s.responseText}n(e)}else"function"==typeof i&&i(s.status)},s.send())},t.hasClass=function(e,t){return!!(e.className.split(" ").indexOf(t)>-1)},t.offset=function(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset||document.documentElement.scrollLeft),top:t.top+(window.pageYOffset||document.documentElement.scrollTop)}}},function(e,t){var n=e.exports={version:"2.6.2"};"number"==typeof __e&&(__e=n)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var i=n(37);e.exports=function(e){return Object(i(e))}},function(e,t,n){var i=n(0),r=n(6),s=n(7);e.exports=function(e,t){var n=(r.Object||{})[e]||Object[e],a={};a[e]=t(n),i(i.S+i.F*s(function(){n(1)}),"Object",a)}},function(e,t,n){var i=n(11),r=n(54),s=n(39),a=Object.defineProperty;t.f=n(12)?Object.defineProperty:function(e,t,n){if(i(e),t=s(t,!0),i(n),r)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var i=n(2);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports=!n(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var i=n(29),r=n(37);e.exports=function(e){return i(r(e))}},function(e,t,n){var i=n(31),r=Math.min;e.exports=function(e){return e>0?r(i(e),9007199254740991):0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addEvent=function(e,t){if("string"!=typeof e)throw new Error("Event name must be a string");return new CustomEvent(e,{detail:t})},t.events=["loadstart","durationchange","loadedmetadata","loadeddata","progress","canplay","canplaythrough","suspend","abort","error","emptied","stalled","play","playing","pause","waiting","seeking","seeked","timeupdate","ended","ratechange","volumechange"]},function(e,t,n){var i=n(10),r=n(26);e.exports=n(12)?function(e,t,n){return i.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(22);e.exports=function(e,t,n){if(i(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,r){return e.call(t,n,i,r)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var i=n(18),r=n(29),s=n(8),a=n(14),o=n(83);e.exports=function(e,t){var n=1==e,l=2==e,u=3==e,c=4==e,d=6==e,h=5==e||d,p=t||o;return function(t,o,f){for(var v,m,y=s(t),b=r(y),g=i(o,f,3),E=a(b.length),_=0,k=n?p(t,E):l?p(t,0):void 0;E>_;_++)if((h||_ in b)&&(m=g(v=b[_],_,y),e))if(n)k[_]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return _;case 2:k.push(v)}else if(c)return!1;return d?-1:u||c?c:k}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NAV=window.navigator,t.UA=t.NAV.userAgent.toLowerCase(),t.IS_IPAD=/ipad/i.test(t.UA)&&!window.MSStream,t.IS_IPHONE=/iphone/i.test(t.UA)&&!window.MSStream,t.IS_IPOD=/ipod/i.test(t.UA)&&!window.MSStream,t.IS_IOS=/ipad|iphone|ipod/i.test(t.UA)&&!window.MSStream,t.IS_ANDROID=/android/i.test(t.UA),t.IS_IE=/(trident|microsoft)/i.test(t.NAV.appName),t.IS_EDGE="msLaunchUri"in t.NAV&&!("documentMode"in document),t.IS_CHROME=/chrome/i.test(t.UA),t.IS_FIREFOX=/firefox/i.test(t.UA),t.IS_SAFARI=/safari/i.test(t.UA)&&!t.IS_CHROME,t.IS_STOCK_ANDROID=/^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(t.UA),t.HAS_MSE="MediaSource"in window,t.SUPPORTS_HLS=function(){var e=window.MediaSource||window.WebKitMediaSource,n=window.SourceBuffer||window.WebKitSourceBuffer,i=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),r=!n||n.prototype&&"function"==typeof n.prototype.appendBuffer&&"function"==typeof n.prototype.remove;return!!i&&!!r&&!t.IS_SAFARI}},function(e,t,n){var i=n(3),r=n(16),s=n(17),a=n(27)("src"),o=Function.toString,l=(""+o).split("toString");n(6).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,o){var u="function"==typeof n;u&&(s(n,"name")||r(n,"name",t)),e[t]!==n&&(u&&(s(n,a)||r(n,a,e[t]?""+e[t]:l.join(String(t)))),e===i?e[t]=n:o?e[t]?e[t]=n:r(e,t,n):(delete e[t],r(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||o.call(this)})},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var i=n(56),r=n(43);e.exports=Object.keys||function(e){return i(e,r)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=!1},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t){e.exports={}},function(e,t,n){var i=n(24);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},function(e,t,n){var i=n(1)("unscopables"),r=Array.prototype;null==r[i]&&n(16)(r,i,{}),e.exports=function(e){r[i][e]=!0}},function(e,t){var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t,n){var i=n(31),r=Math.max,s=Math.min;e.exports=function(e,t){return(e=i(e))<0?r(e+t,0):s(e,t)}},function(e,t,n){var i=n(10).f,r=n(17),s=n(1)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,s)&&i(e,s,{configurable:!0,value:t})}},function(e,t,n){var i=n(27)("meta"),r=n(2),s=n(17),a=n(10).f,o=0,l=Object.isExtensible||function(){return!0},u=!n(7)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,i,{value:{i:"O"+ ++o,w:{}}})},d=e.exports={KEY:i,NEED:!1,fastKey:function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,i)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[i].i},getWeak:function(e,t){if(!s(e,i)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[i].w},onFreeze:function(e){return u&&d.NEED&&l(e)&&!s(e,i)&&c(e),e}}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";function i(e){if("string"!=typeof e)throw new Error("`url` argument must be a string");var t=e.split("?")[0].split("\\").pop().split("/").pop();return t.indexOf(".")>-1?t.substring(t.lastIndexOf(".")+1):""}Object.defineProperty(t,"__esModule",{value:!0}),t.getExtension=i,t.isHlsSource=function(e){return/\.m3u8/i.test(e.src)||["application/x-mpegURL","application/vnd.apple.mpegurl"].indexOf(e.type)>-1},t.isDashSource=function(e){return/\.mpd/i.test(e.src)||"application/dash+xml"===e.type},t.predictType=function(e){var t,n=i(e);if(!n)return"video/mp4";switch(n){case"m3u8":t="application/x-mpegURL";break;case"mpd":t="application/dash+xml";break;case"mp3":t="audio/mp3";break;case"webm":t="video/webm";break;default:t="video/mp4"}return t},t.isAutoplaySupported=function(e,t,n,i){var r=e.play();void 0!==r?r.then(function(){e.pause(),t(!0),n(!1),i()}).catch(function(){e.volume=0,e.muted=!0,e.play().then(function(){e.pause(),t(!0),n(!0),i()}).catch(function(){e.volume=1,e.muted=!1,t(!1),n(!1),i()})}):(t(!e.paused||"Promise"in window&&r instanceof Promise),e.pause(),n(!1),i())}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var i=n(2),r=n(3).document,s=i(r)&&i(r.createElement);e.exports=function(e){return s?r.createElement(e):{}}},function(e,t,n){var i=n(2);e.exports=function(e,t){if(!i(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!i(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var i=n(11),r=n(55),s=n(43),a=n(41)("IE_PROTO"),o=function(){},l=function(){var e,t=n(38)("iframe"),i=s.length;for(t.style.display="none",n(44).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),l=e.F;i--;)delete l.prototype[s[i]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(o.prototype=i(e),n=new o,o.prototype=null,n[a]=e):n=l(),void 0===t?n:r(n,t)}},function(e,t,n){var i=n(42)("keys"),r=n(27);e.exports=function(e){return i[e]||(i[e]=r(e))}},function(e,t,n){var i=n(6),r=n(3),s=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(e.exports=function(e,t){return s[e]||(s[e]=void 0!==t?t:{})})("versions",[]).push({version:i.version,mode:n(25)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var i=n(3).document;e.exports=i&&i.documentElement},function(e,t,n){var i=n(24);e.exports=Array.isArray||function(e){return"Array"==i(e)}},function(e,t,n){var i=n(24),r=n(1)("toStringTag"),s="Arguments"==i(function(){return arguments}());e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),r))?n:s?i(t):"Object"==(a=i(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var i=n(35),r=n(26),s=n(13),a=n(39),o=n(17),l=n(54),u=Object.getOwnPropertyDescriptor;t.f=n(12)?u:function(e,t){if(e=s(e),t=a(t,!0),l)try{return u(e,t)}catch(e){}if(o(e,t))return r(!i.f.call(e,t),e[t])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatTime=function(e,t){var n=Math.floor(e%1*(t||0)),i=Math.floor(e),r=Math.floor(i/60),s=Math.floor(r/60),a=function(e){return e<10?"0".concat(e):e};return r%=60,i%=60,"".concat(s>0?"".concat(a(s),":"):"").concat(a(r),":").concat(a(i)).concat(n?":".concat(a(n)):"")},t.timeToSeconds=function(e){var t=e.replace(/;/g,":").split(":"),n=60*parseFloat(t[0])*60;return n+=60*parseFloat(t[1]),n+=parseFloat(t[2])}},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,this.media=n,this.promise=new Promise(function(e){e()})}var t,n,r;return t=e,(n=[{key:"play",value:function(){this.element.play()}},{key:"pause",value:function(){this.element.pause()}},{key:"volume",set:function(e){this.element.volume=e},get:function(){return this.element.volume}},{key:"muted",set:function(e){this.element.muted=e},get:function(){return this.element.muted}},{key:"playbackRate",set:function(e){this.element.playbackRate=e},get:function(){return this.element.playbackRate}},{key:"currentTime",set:function(e){this.element.currentTime=e},get:function(){return this.element.currentTime}},{key:"duration",get:function(){return this.element.duration}},{key:"paused",get:function(){return this.element.paused}},{key:"ended",get:function(){return this.element.ended}}])&&i(t.prototype,n),r&&i(t,r),e}();t.default=r},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0}),n(73),n(101),n(124),n(136);var r=n(137);n(138),n(139);var s=n(140),a=n(148),o=n(152),l=n(20),u=n(15),c=n(5),d=n(36),h=function(){function e(t,n,i,s){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={},this.autoplay=!1,this.processedAutoplay=!1,this.customControlItems=[],this.defaultOptions={hidePlayBtnTimer:350,labels:{captions:"CC/Subtitles",click:"Click to unmute",fullscreen:"Fullscreen",lang:{en:"English"},live:"Live Broadcast",mute:"Mute",off:"Off",pause:"Pause",play:"Play",progressRail:"Time Rail",progressSlider:"Time Slider",settings:"Player Settings",speed:"Speed",speedNormal:"Normal",tap:"Tap to unmute",toggleCaptions:"Toggle Captions",unmute:"Unmute",volume:"Volume",volumeControl:"Volume Control",volumeSlider:"Volume Slider"},startTime:0,startVolume:1,step:0},this.element=t instanceof HTMLMediaElement?t:document.getElementById(t),this.element&&(this.ads=n,this.fill=i,this.autoplay=this.element.autoplay||!1,this.options=r(this.defaultOptions,s||{}),this.element.volume=this.options.startVolume,this.options.startTime>0&&(this.element.currentTime=this.options.startTime),this.volume=this.element.volume,this.element.autoplay=!1),this}var t,n,h;return t=e,h=[{key:"init",value:function(){e.instances={};for(var t=document.querySelectorAll("video.op-player, audio.op-player"),n=0,i=t.length;n<i;n++){var r=t[n];new e(r,r.getAttribute("data-op-ads"),!!r.getAttribute("data-op-fill"),JSON.parse(r.getAttribute("data-op-options"))).init()}}},{key:"addMedia",value:function(t,n,i,r){e.customMedia.media[n]=r,e.customMedia.optionsKey[n]=t,e.customMedia.rules.push(i)}}],(n=[{key:"init",value:function(){this._isValid()&&(this._wrapInstance(),this._prepareMedia(),this._createPlayButton(),this._createUID(),this._createControls(),this._setEvents(),e.instances[this.id]=this)}},{key:"load",value:function(){this.isMedia()&&this.media.load()}},{key:"play",value:function(){this.adsInstance?this.adsInstance.play():this.media.play()}},{key:"pause",value:function(){this.adsInstance?this.adsInstance.pause():this.media.pause()}},{key:"destroy",value:function(){var e=this;this.adsInstance&&(this.adsInstance.pause(),this.adsInstance.destroy());var t=this.element;this.media.destroy(),Object.keys(this.events).forEach(function(n){t.removeEventListener(n,e.events[n])}),this.autoplay&&!this.processedAutoplay&&c.isVideo(this.element)&&t.removeEventListener("canplay",this._autoplay.bind(this)),this.controls.destroy(),c.isVideo(this.element)&&(this.playBtn.remove(),this.loader.remove()),t.controls=!0,t.removeAttribute("op-live");var n=t.parentElement;n.parentNode.replaceChild(t,n);var i=u.addEvent("playerdestroyed");t.dispatchEvent(i)}},{key:"getContainer",value:function(){return this.element.parentElement}},{key:"getControls",value:function(){return this.controls}},{key:"getCustomControls",value:function(){return this.customControlItems}},{key:"getElement",value:function(){return this.element}},{key:"getEvents",value:function(){return this.events}},{key:"getOptions",value:function(){return this.options}},{key:"activeElement",value:function(){return this.adsInstance&&this.adsInstance.adsStarted?this.adsInstance:this.media}},{key:"isMedia",value:function(){return this.activeElement()instanceof a.default}},{key:"isAd",value:function(){return this.activeElement()instanceof o.default}},{key:"getMedia",value:function(){return this.media}},{key:"getAd",value:function(){return this.adsInstance}},{key:"addCaptions",value:function(e){if(e.default)for(var t=this.element.querySelectorAll("track"),n=0,i=t.length;n<i;n++)t[n].default=!1;var r=this.element,s=r.querySelector('track[srclang="'.concat(e.srclang,'"][kind="').concat(e.kind,'"]'));s?(s.src=e.src,s.label=e.label,s.default=e.default||null):((s=document.createElement("track")).srclang=e.srclang,s.src=e.src,s.kind=e.kind,s.label=e.label,s.default=e.default||null,r.appendChild(s));var a=u.addEvent("controlschanged");r.dispatchEvent(a)}},{key:"addControl",value:function(e){e.custom=!0,this.customControlItems.push(e);var t=u.addEvent("controlschanged");this.element.dispatchEvent(t)}},{key:"_isValid",value:function(){var e=this.element;return e instanceof HTMLElement!=!1&&(!(!c.isAudio(e)&&!c.isVideo(e))&&!!e.classList.contains("op-player__media"))}},{key:"_wrapInstance",value:function(){var e=document.createElement("div");e.className="op-player op-player__keyboard--inactive",e.className+=c.isAudio(this.element)?" op-player__audio":" op-player__video",e.tabIndex=0,this.element.classList.remove("op-player"),this.element.parentElement.insertBefore(e,this.element),e.appendChild(this.element),e.addEventListener("keydown",function(){e.classList.contains("op-player__keyboard--inactive")&&e.classList.remove("op-player__keyboard--inactive")}),e.addEventListener("click",function(){e.classList.contains("op-player__keyboard--inactive")||e.classList.add("op-player__keyboard--inactive")}),this.fill&&this._fill()}},{key:"_createControls",value:function(){l.IS_IPHONE&&c.isVideo(this.element)&&this.getContainer().classList.add("op-player__ios--iphone"),this.controls=new s.default(this),this.controls.create()}},{key:"_prepareMedia",value:function(){try{if(this.autoplay&&c.isVideo(this.element)&&this.element.addEventListener("canplay",this._autoplay.bind(this)),this.media=new a.default(this.element,this.options,this.autoplay,e.customMedia),this.media.load(),!this.autoplay&&this.ads){var t=this.options&&this.options.ads?this.options.ads:void 0;this.adsInstance=new o.default(this.media,this.ads,!1,!1,t)}}catch(e){console.error(e)}}},{key:"_createUID",value:function(){if(this.element.id)this.uid=this.element.id,this.element.removeAttribute("id");else{var t;do{t="om_".concat(Math.random().toString(36).substr(2,9))}while(void 0!==e.instances[t]);this.uid=t}this.element.parentElement.id=this.uid}},{key:"_createPlayButton",value:function(){var e=this;c.isAudio(this.element)||(this.playBtn=document.createElement("button"),this.playBtn.className="op-player__play",this.playBtn.tabIndex=0,this.playBtn.title=this.options.labels.play,this.playBtn.innerHTML="<span>".concat(this.options.labels.play,"</span>"),this.playBtn.setAttribute("aria-pressed","false"),this.playBtn.setAttribute("aria-hidden","false"),this.loader=document.createElement("span"),this.loader.className="op-player__loader",this.loader.tabIndex=-1,this.loader.setAttribute("aria-hidden","true"),this.element.parentElement.insertBefore(this.loader,this.element),this.element.parentElement.insertBefore(this.playBtn,this.element),this.playBtn.addEventListener("click",function(){e.adsInstance&&(e.adsInstance.playRequested=e.activeElement().paused),e.activeElement().paused?e.activeElement().play():e.activeElement().pause()}))}},{key:"_setEvents",value:function(){var e=this;c.isVideo(this.element)&&(this.events.loadedmetadata=function(){var t=e.activeElement();e.loader.setAttribute("aria-hidden","true"),t.paused&&(e.playBtn.classList.remove("op-player__play--paused"),e.playBtn.setAttribute("aria-pressed","false"),e.playBtn.setAttribute("aria-hidden","false"))},this.events.waiting=function(){e.playBtn.setAttribute("aria-hidden","true"),e.loader.setAttribute("aria-hidden","false")},this.events.canplay=function(){e.playBtn.setAttribute("aria-hidden",l.IS_ANDROID||l.IS_IOS?"false":"true"),e.loader.setAttribute("aria-hidden","true")},this.events.seeking=function(){var t=e.activeElement();e.playBtn.setAttribute("aria-hidden","true"),e.loader.setAttribute("aria-hidden",t instanceof a.default?"false":"true")},this.events.seeked=function(){var t=e.activeElement();e.playBtn.setAttribute("aria-hidden",t instanceof a.default?"false":"true"),e.loader.setAttribute("aria-hidden","true")},this.events.play=function(){e.playBtn.classList.add("op-player__play--paused"),e.playBtn.title=e.options.labels.pause,e.loader.setAttribute("aria-hidden","true"),setTimeout(function(){e.playBtn.setAttribute("aria-hidden","true")},e.options.hidePlayBtnTimer)},this.events.playing=function(){e.loader.setAttribute("aria-hidden","true")},this.events.pause=function(){e.loader.setAttribute("aria-hidden","true"),e.playBtn.classList.remove("op-player__play--paused"),e.playBtn.setAttribute("aria-hidden",l.IS_ANDROID||l.IS_IOS?"false":"true"),e.playBtn.title=e.options.labels.play}),Object.keys(this.events).forEach(function(t){e.element.addEventListener(t,e.events[t])}),this.events.keydown=function(t){var n=e.activeElement(),i=n instanceof o.default,r=t.which||t.keyCode||0,s=e.options.step?e.options.step:.05*n.duration,a=n.duration!==1/0?s:0;switch(r){case 13:case 32:n.paused?n.play():n.pause();break;case 36:i||(n.currentTime=0);break;case 37:case 39:i||n.duration===1/0||(n.currentTime+=37===r?-1*a:a,n.currentTime<0?n.currentTime=0:n.currentTime>=n.duration&&(n.currentTime=n.duration));break;case 38:case 40:var l=38===r?Math.min(n.volume+.1,1):Math.max(n.volume-.1,0);n.volume=l,n.muted=!(l>0);break;case 35:i||(n.currentTime=n.duration);break;case 70:t.ctrlKey||void 0===e.controls.fullscreen.fullScreenEnabled||e.controls.fullscreen.toggleFullscreen();break;default:return!0}t.preventDefault()},this.getContainer().addEventListener("keydown",this.events.keydown)}},{key:"_autoplay",value:function(){var e=this;this.processedAutoplay||(this.processedAutoplay=!0,this.element.removeEventListener("canplay",this._autoplay.bind(this)),d.isAutoplaySupported(this.element,function(t){e.canAutoplay=t},function(t){e.canAutoplayMuted=t},function(){if(e.canAutoplayMuted){e.activeElement().muted=!0,e.activeElement().volume=0;var t=u.addEvent("volumechange");e.element.dispatchEvent(t);var n=document.createElement("div"),i=l.IS_IOS||l.IS_ANDROID?e.options.labels.tap:e.options.labels.click;n.className="op-player__unmute",n.innerHTML="<span>".concat(i,"</span>"),n.addEventListener("click",function(){e.activeElement().muted=!1,e.activeElement().volume=e.volume;var t=u.addEvent("volumechange");e.element.dispatchEvent(t),n.remove()});var r=e.getContainer();r.insertBefore(n,r.firstChild)}else e.activeElement().muted=!1,e.activeElement().volume=e.volume;if(e.ads){var s=e.options&&e.options.ads?e.options.ads:void 0;e.adsInstance=new o.default(e.media,e.ads,e.canAutoplay,e.canAutoplayMuted,s)}else(e.canAutoplay||e.canAutoplayMuted)&&e.play()}))}},{key:"_fill",value:function(){c.isAudio(this.element)||l.IS_IPHONE||this.getContainer().classList.add("op-player__full")}},{key:"src",set:function(e){this.media instanceof a.default&&(this.media.mediaFiles=[],this.media.src=e)},get:function(){return this.media.src}},{key:"id",get:function(){return this.uid}}])&&i(t.prototype,n),h&&i(t,h),e}();h.instances={},h.customMedia={media:{},optionsKey:{},rules:[]},t.default=h,window.OpenPlayer=h,h.init()},function(e,t,n){"use strict";var i=n(74)(!0);n(53)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";var i=n(25),r=n(0),s=n(21),a=n(16),o=n(28),l=n(75),u=n(33),c=n(58),d=n(1)("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,f,v,m,y){l(n,t,f);var b,g,E,_=function(e){if(!h&&e in w)return w[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},k=t+" Iterator",A="values"==v,S=!1,w=e.prototype,L=w[d]||w["@@iterator"]||v&&w[v],O=L||_(v),T=v?A?_("entries"):O:void 0,C="Array"==t&&w.entries||L;if(C&&(E=c(C.call(new e)))!==Object.prototype&&E.next&&(u(E,k,!0),i||"function"==typeof E[d]||a(E,d,p)),A&&L&&"values"!==L.name&&(S=!0,O=function(){return L.call(this)}),i&&!y||!h&&!S&&w[d]||a(w,d,O),o[t]=O,o[k]=p,v)if(b={values:A?O:_("values"),keys:m?O:_("keys"),entries:T},y)for(g in b)g in w||s(w,g,b[g]);else r(r.P+r.F*(h||S),t,b);return b}},function(e,t,n){e.exports=!n(12)&&!n(7)(function(){return 7!=Object.defineProperty(n(38)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var i=n(10),r=n(11),s=n(23);e.exports=n(12)?Object.defineProperties:function(e,t){r(e);for(var n,a=s(t),o=a.length,l=0;o>l;)i.f(e,n=a[l++],t[n]);return e}},function(e,t,n){var i=n(17),r=n(13),s=n(57)(!1),a=n(41)("IE_PROTO");e.exports=function(e,t){var n,o=r(e),l=0,u=[];for(n in o)n!=a&&i(o,n)&&u.push(n);for(;t.length>l;)i(o,n=t[l++])&&(~s(u,n)||u.push(n));return u}},function(e,t,n){var i=n(13),r=n(14),s=n(32);e.exports=function(e){return function(t,n,a){var o,l=i(t),u=r(l.length),c=s(a,u);if(e&&n!=n){for(;u>c;)if((o=l[c++])!=o)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){var i=n(17),r=n(8),s=n(41)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),i(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var i=n(11);e.exports=function(e,t,n,r){try{return r?t(i(n)[0],n[1]):t(n)}catch(t){var s=e.return;throw void 0!==s&&i(s.call(e)),t}}},function(e,t,n){var i=n(28),r=n(1)("iterator"),s=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||s[r]===e)}},function(e,t,n){"use strict";var i=n(10),r=n(26);e.exports=function(e,t,n){t in e?i.f(e,t,r(0,n)):e[t]=n}},function(e,t,n){var i=n(46),r=n(1)("iterator"),s=n(28);e.exports=n(6).getIteratorMethod=function(e){if(null!=e)return e[r]||e["@@iterator"]||s[i(e)]}},function(e,t,n){var i=n(1)("iterator"),r=!1;try{var s=[7][i]();s.return=function(){r=!0},Array.from(s,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var n=!1;try{var s=[7],a=s[i]();a.next=function(){return{done:n=!0}},s[i]=function(){return a},e(s)}catch(e){}return n}},function(e,t,n){var i=n(22),r=n(8),s=n(29),a=n(14);e.exports=function(e,t,n,o,l){i(t);var u=r(e),c=s(u),d=a(u.length),h=l?d-1:0,p=l?-1:1;if(n<2)for(;;){if(h in c){o=c[h],h+=p;break}if(h+=p,l?h<0:d<=h)throw TypeError("Reduce of empty array with no initial value")}for(;l?h>=0:d>h;h+=p)h in c&&(o=t(o,c[h],h,u));return o}},function(e,t,n){"use strict";var i=n(3),r=n(10),s=n(12),a=n(1)("species");e.exports=function(e){var t=i[e];s&&t&&!t[a]&&r.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var i=n(30),r=n(100),s=n(28),a=n(13);e.exports=n(53)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),s.Arguments=s.Array,i("keys"),i("values"),i("entries")},function(e,t,n){t.f=n(1)},function(e,t,n){var i=n(13),r=n(69).f,s={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==s.call(e)?function(e){try{return r(e)}catch(e){return a.slice()}}(e):r(i(e))}},function(e,t,n){var i=n(56),r=n(43).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,r)}},function(e,t,n){"use strict";var i=n(46),r={};r[n(1)("toStringTag")]="z",r+""!="[object z]"&&n(21)(Object.prototype,"toString",function(){return"[object "+i(this)+"]"},!0)},function(e,t,n){var i,r,s,a=n(18),o=n(130),l=n(44),u=n(38),c=n(3),d=c.process,h=c.setImmediate,p=c.clearImmediate,f=c.MessageChannel,v=c.Dispatch,m=0,y={},b=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},g=function(e){b.call(e.data)};h&&p||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return y[++m]=function(){o("function"==typeof e?e:Function(e),t)},i(m),m},p=function(e){delete y[e]},"process"==n(24)(d)?i=function(e){d.nextTick(a(b,e,1))}:v&&v.now?i=function(e){v.now(a(b,e,1))}:f?(s=(r=new f).port2,r.port1.onmessage=g,i=a(s.postMessage,s,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(i=function(e){c.postMessage(e+"","*")},c.addEventListener("message",g,!1)):i="onreadystatechange"in u("script")?function(e){l.appendChild(u("script")).onreadystatechange=function(){l.removeChild(this),b.call(e)}}:function(e){setTimeout(a(b,e,1),0)}),e.exports={set:h,clear:p}},function(e,t,n){"use strict";var i=n(22);function r(e){var t,n;this.promise=new e(function(e,i){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=i}),this.resolve=i(t),this.reject=i(n)}e.exports.f=function(e){return new r(e)}},function(e,t,n){n(52),n(76),n(77),n(78),n(79),n(80),n(81),n(82),n(85),n(86),n(87),n(88),n(89),n(90),n(91),n(92),n(93),n(95),n(97),n(98),n(99),n(66),e.exports=n(6).Array},function(e,t,n){var i=n(31),r=n(37);e.exports=function(e){return function(t,n){var s,a,o=String(r(t)),l=i(n),u=o.length;return l<0||l>=u?e?"":void 0:(s=o.charCodeAt(l))<55296||s>56319||l+1===u||(a=o.charCodeAt(l+1))<56320||a>57343?e?o.charAt(l):s:e?o.slice(l,l+2):a-56320+(s-55296<<10)+65536}}},function(e,t,n){"use strict";var i=n(40),r=n(26),s=n(33),a={};n(16)(a,n(1)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(a,{next:r(1,n)}),s(e,t+" Iterator")}},function(e,t,n){var i=n(0);i(i.S,"Array",{isArray:n(45)})},function(e,t,n){"use strict";var i=n(18),r=n(0),s=n(8),a=n(59),o=n(60),l=n(14),u=n(61),c=n(62);r(r.S+r.F*!n(63)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,r,d,h=s(e),p="function"==typeof this?this:Array,f=arguments.length,v=f>1?arguments[1]:void 0,m=void 0!==v,y=0,b=c(h);if(m&&(v=i(v,f>2?arguments[2]:void 0,2)),null==b||p==Array&&o(b))for(n=new p(t=l(h.length));t>y;y++)u(n,y,m?v(h[y],y):h[y]);else for(d=b.call(h),n=new p;!(r=d.next()).done;y++)u(n,y,m?a(d,v,[r.value,y],!0):r.value);return n.length=y,n}})},function(e,t,n){"use strict";var i=n(0),r=n(61);i(i.S+i.F*n(7)(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)r(n,e,arguments[e++]);return n.length=t,n}})},function(e,t,n){"use strict";var i=n(0),r=n(13),s=[].join;i(i.P+i.F*(n(29)!=Object||!n(4)(s)),"Array",{join:function(e){return s.call(r(this),void 0===e?",":e)}})},function(e,t,n){"use strict";var i=n(0),r=n(44),s=n(24),a=n(32),o=n(14),l=[].slice;i(i.P+i.F*n(7)(function(){r&&l.call(r)}),"Array",{slice:function(e,t){var n=o(this.length),i=s(this);if(t=void 0===t?n:t,"Array"==i)return l.call(this,e,t);for(var r=a(e,n),u=a(t,n),c=o(u-r),d=new Array(c),h=0;h<c;h++)d[h]="String"==i?this.charAt(r+h):this[r+h];return d}})},function(e,t,n){"use strict";var i=n(0),r=n(22),s=n(8),a=n(7),o=[].sort,l=[1,2,3];i(i.P+i.F*(a(function(){l.sort(void 0)})||!a(function(){l.sort(null)})||!n(4)(o)),"Array",{sort:function(e){return void 0===e?o.call(s(this)):o.call(s(this),r(e))}})},function(e,t,n){"use strict";var i=n(0),r=n(19)(0),s=n(4)([].forEach,!0);i(i.P+i.F*!s,"Array",{forEach:function(e){return r(this,e,arguments[1])}})},function(e,t,n){var i=n(84);e.exports=function(e,t){return new(i(e))(t)}},function(e,t,n){var i=n(2),r=n(45),s=n(1)("species");e.exports=function(e){var t;return r(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!r(t.prototype)||(t=void 0),i(t)&&null===(t=t[s])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){"use strict";var i=n(0),r=n(19)(1);i(i.P+i.F*!n(4)([].map,!0),"Array",{map:function(e){return r(this,e,arguments[1])}})},function(e,t,n){"use strict";var i=n(0),r=n(19)(2);i(i.P+i.F*!n(4)([].filter,!0),"Array",{filter:function(e){return r(this,e,arguments[1])}})},function(e,t,n){"use strict";var i=n(0),r=n(19)(3);i(i.P+i.F*!n(4)([].some,!0),"Array",{some:function(e){return r(this,e,arguments[1])}})},function(e,t,n){"use strict";var i=n(0),r=n(19)(4);i(i.P+i.F*!n(4)([].every,!0),"Array",{every:function(e){return r(this,e,arguments[1])}})},function(e,t,n){"use strict";var i=n(0),r=n(64);i(i.P+i.F*!n(4)([].reduce,!0),"Array",{reduce:function(e){return r(this,e,arguments.length,arguments[1],!1)}})},function(e,t,n){"use strict";var i=n(0),r=n(64);i(i.P+i.F*!n(4)([].reduceRight,!0),"Array",{reduceRight:function(e){return r(this,e,arguments.length,arguments[1],!0)}})},function(e,t,n){"use strict";var i=n(0),r=n(57)(!1),s=[].indexOf,a=!!s&&1/[1].indexOf(1,-0)<0;i(i.P+i.F*(a||!n(4)(s)),"Array",{indexOf:function(e){return a?s.apply(this,arguments)||0:r(this,e,arguments[1])}})},function(e,t,n){"use strict";var i=n(0),r=n(13),s=n(31),a=n(14),o=[].lastIndexOf,l=!!o&&1/[1].lastIndexOf(1,-0)<0;i(i.P+i.F*(l||!n(4)(o)),"Array",{lastIndexOf:function(e){if(l)return o.apply(this,arguments)||0;var t=r(this),n=a(t.length),i=n-1;for(arguments.length>1&&(i=Math.min(i,s(arguments[1]))),i<0&&(i=n+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}})},function(e,t,n){var i=n(0);i(i.P,"Array",{copyWithin:n(94)}),n(30)("copyWithin")},function(e,t,n){"use strict";var i=n(8),r=n(32),s=n(14);e.exports=[].copyWithin||function(e,t){var n=i(this),a=s(n.length),o=r(e,a),l=r(t,a),u=arguments.length>2?arguments[2]:void 0,c=Math.min((void 0===u?a:r(u,a))-l,a-o),d=1;for(l<o&&o<l+c&&(d=-1,l+=c-1,o+=c-1);c-- >0;)l in n?n[o]=n[l]:delete n[o],o+=d,l+=d;return n}},function(e,t,n){var i=n(0);i(i.P,"Array",{fill:n(96)}),n(30)("fill")},function(e,t,n){"use strict";var i=n(8),r=n(32),s=n(14);e.exports=function(e){for(var t=i(this),n=s(t.length),a=arguments.length,o=r(a>1?arguments[1]:void 0,n),l=a>2?arguments[2]:void 0,u=void 0===l?n:r(l,n);u>o;)t[o++]=e;return t}},function(e,t,n){"use strict";var i=n(0),r=n(19)(5),s=!0;"find"in[]&&Array(1).find(function(){s=!1}),i(i.P+i.F*s,"Array",{find:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),n(30)("find")},function(e,t,n){"use strict";var i=n(0),r=n(19)(6),s="findIndex",a=!0;s in[]&&Array(1)[s](function(){a=!1}),i(i.P+i.F*a,"Array",{findIndex:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),n(30)(s)},function(e,t,n){n(65)("Array")},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){n(102),n(105),n(106),n(107),n(108),n(109),n(110),n(111),n(112),n(113),n(114),n(115),n(116),n(117),n(118),n(120),n(122),n(70),e.exports=n(6).Object},function(e,t,n){"use strict";var i=n(3),r=n(17),s=n(12),a=n(0),o=n(21),l=n(34).KEY,u=n(7),c=n(42),d=n(33),h=n(27),p=n(1),f=n(67),v=n(103),m=n(104),y=n(45),b=n(11),g=n(2),E=n(13),_=n(39),k=n(26),A=n(40),S=n(68),w=n(48),L=n(10),O=n(23),T=w.f,C=L.f,M=S.f,x=i.Symbol,P=i.JSON,j=P&&P.stringify,I=p("_hidden"),D=p("toPrimitive"),F={}.propertyIsEnumerable,N=c("symbol-registry"),R=c("symbols"),H=c("op-symbols"),q=Object.prototype,B="function"==typeof x,V=i.QObject,z=!V||!V.prototype||!V.prototype.findChild,U=s&&u(function(){return 7!=A(C({},"a",{get:function(){return C(this,"a",{value:7}).a}})).a})?function(e,t,n){var i=T(q,t);i&&delete q[t],C(e,t,n),i&&e!==q&&C(q,t,i)}:C,W=function(e){var t=R[e]=A(x.prototype);return t._k=e,t},G=B&&"symbol"==typeof x.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof x},K=function(e,t,n){return e===q&&K(H,t,n),b(e),t=_(t,!0),b(n),r(R,t)?(n.enumerable?(r(e,I)&&e[I][t]&&(e[I][t]=!1),n=A(n,{enumerable:k(0,!1)})):(r(e,I)||C(e,I,k(1,{})),e[I][t]=!0),U(e,t,n)):C(e,t,n)},X=function(e,t){b(e);for(var n,i=m(t=E(t)),r=0,s=i.length;s>r;)K(e,n=i[r++],t[n]);return e},J=function(e){var t=F.call(this,e=_(e,!0));return!(this===q&&r(R,e)&&!r(H,e))&&(!(t||!r(this,e)||!r(R,e)||r(this,I)&&this[I][e])||t)},$=function(e,t){if(e=E(e),t=_(t,!0),e!==q||!r(R,t)||r(H,t)){var n=T(e,t);return!n||!r(R,t)||r(e,I)&&e[I][t]||(n.enumerable=!0),n}},Q=function(e){for(var t,n=M(E(e)),i=[],s=0;n.length>s;)r(R,t=n[s++])||t==I||t==l||i.push(t);return i},Y=function(e){for(var t,n=e===q,i=M(n?H:E(e)),s=[],a=0;i.length>a;)!r(R,t=i[a++])||n&&!r(q,t)||s.push(R[t]);return s};B||(o((x=function(){if(this instanceof x)throw TypeError("Symbol is not a constructor!");var e=h(arguments.length>0?arguments[0]:void 0),t=function(n){this===q&&t.call(H,n),r(this,I)&&r(this[I],e)&&(this[I][e]=!1),U(this,e,k(1,n))};return s&&z&&U(q,e,{configurable:!0,set:t}),W(e)}).prototype,"toString",function(){return this._k}),w.f=$,L.f=K,n(69).f=S.f=Q,n(35).f=J,n(47).f=Y,s&&!n(25)&&o(q,"propertyIsEnumerable",J,!0),f.f=function(e){return W(p(e))}),a(a.G+a.W+a.F*!B,{Symbol:x});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;Z.length>ee;)p(Z[ee++]);for(var te=O(p.store),ne=0;te.length>ne;)v(te[ne++]);a(a.S+a.F*!B,"Symbol",{for:function(e){return r(N,e+="")?N[e]:N[e]=x(e)},keyFor:function(e){if(!G(e))throw TypeError(e+" is not a symbol!");for(var t in N)if(N[t]===e)return t},useSetter:function(){z=!0},useSimple:function(){z=!1}}),a(a.S+a.F*!B,"Object",{create:function(e,t){return void 0===t?A(e):X(A(e),t)},defineProperty:K,defineProperties:X,getOwnPropertyDescriptor:$,getOwnPropertyNames:Q,getOwnPropertySymbols:Y}),P&&a(a.S+a.F*(!B||u(function(){var e=x();return"[null]"!=j([e])||"{}"!=j({a:e})||"{}"!=j(Object(e))})),"JSON",{stringify:function(e){for(var t,n,i=[e],r=1;arguments.length>r;)i.push(arguments[r++]);if(n=t=i[1],(g(t)||void 0!==e)&&!G(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!G(t))return t}),i[1]=t,j.apply(P,i)}}),x.prototype[D]||n(16)(x.prototype,D,x.prototype.valueOf),d(x,"Symbol"),d(Math,"Math",!0),d(i.JSON,"JSON",!0)},function(e,t,n){var i=n(3),r=n(6),s=n(25),a=n(67),o=n(10).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=s?{}:i.Symbol||{});"_"==e.charAt(0)||e in t||o(t,e,{value:a.f(e)})}},function(e,t,n){var i=n(23),r=n(47),s=n(35);e.exports=function(e){var t=i(e),n=r.f;if(n)for(var a,o=n(e),l=s.f,u=0;o.length>u;)l.call(e,a=o[u++])&&t.push(a);return t}},function(e,t,n){var i=n(0);i(i.S,"Object",{create:n(40)})},function(e,t,n){var i=n(0);i(i.S+i.F*!n(12),"Object",{defineProperty:n(10).f})},function(e,t,n){var i=n(0);i(i.S+i.F*!n(12),"Object",{defineProperties:n(55)})},function(e,t,n){var i=n(13),r=n(48).f;n(9)("getOwnPropertyDescriptor",function(){return function(e,t){return r(i(e),t)}})},function(e,t,n){var i=n(8),r=n(58);n(9)("getPrototypeOf",function(){return function(e){return r(i(e))}})},function(e,t,n){var i=n(8),r=n(23);n(9)("keys",function(){return function(e){return r(i(e))}})},function(e,t,n){n(9)("getOwnPropertyNames",function(){return n(68).f})},function(e,t,n){var i=n(2),r=n(34).onFreeze;n(9)("freeze",function(e){return function(t){return e&&i(t)?e(r(t)):t}})},function(e,t,n){var i=n(2),r=n(34).onFreeze;n(9)("seal",function(e){return function(t){return e&&i(t)?e(r(t)):t}})},function(e,t,n){var i=n(2),r=n(34).onFreeze;n(9)("preventExtensions",function(e){return function(t){return e&&i(t)?e(r(t)):t}})},function(e,t,n){var i=n(2);n(9)("isFrozen",function(e){return function(t){return!i(t)||!!e&&e(t)}})},function(e,t,n){var i=n(2);n(9)("isSealed",function(e){return function(t){return!i(t)||!!e&&e(t)}})},function(e,t,n){var i=n(2);n(9)("isExtensible",function(e){return function(t){return!!i(t)&&(!e||e(t))}})},function(e,t,n){var i=n(0);i(i.S+i.F,"Object",{assign:n(119)})},function(e,t,n){"use strict";var i=n(23),r=n(47),s=n(35),a=n(8),o=n(29),l=Object.assign;e.exports=!l||n(7)(function(){var e={},t={},n=Symbol(),i="abcdefghijklmnopqrst";return e[n]=7,i.split("").forEach(function(e){t[e]=e}),7!=l({},e)[n]||Object.keys(l({},t)).join("")!=i})?function(e,t){for(var n=a(e),l=arguments.length,u=1,c=r.f,d=s.f;l>u;)for(var h,p=o(arguments[u++]),f=c?i(p).concat(c(p)):i(p),v=f.length,m=0;v>m;)d.call(p,h=f[m++])&&(n[h]=p[h]);return n}:l},function(e,t,n){var i=n(0);i(i.S,"Object",{is:n(121)})},function(e,t){e.exports=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}},function(e,t,n){var i=n(0);i(i.S,"Object",{setPrototypeOf:n(123).set})},function(e,t,n){var i=n(2),r=n(11),s=function(e,t){if(r(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,i){try{(i=n(18)(Function.call,n(48).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return s(e,n),t?e.__proto__=n:i(e,n),e}}({},!1):void 0),check:s}},function(e,t,n){n(70),n(52),n(125),n(126),e.exports=n(6).Promise},function(e,t,n){for(var i=n(66),r=n(23),s=n(21),a=n(3),o=n(16),l=n(28),u=n(1),c=u("iterator"),d=u("toStringTag"),h=l.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},f=r(p),v=0;v<f.length;v++){var m,y=f[v],b=p[y],g=a[y],E=g&&g.prototype;if(E&&(E[c]||o(E,c,h),E[d]||o(E,d,y),l[y]=h,b))for(m in i)E[m]||s(E,m,i[m],!0)}},function(e,t,n){"use strict";var i,r,s,a,o=n(25),l=n(3),u=n(18),c=n(46),d=n(0),h=n(2),p=n(22),f=n(127),v=n(128),m=n(129),y=n(71).set,b=n(131)(),g=n(72),E=n(132),_=n(133),k=n(134),A=l.TypeError,S=l.process,w=S&&S.versions,L=w&&w.v8||"",O=l.Promise,T="process"==c(S),C=function(){},M=r=g.f,x=!!function(){try{var e=O.resolve(1),t=(e.constructor={})[n(1)("species")]=function(e){e(C,C)};return(T||"function"==typeof PromiseRejectionEvent)&&e.then(C)instanceof t&&0!==L.indexOf("6.6")&&-1===_.indexOf("Chrome/66")}catch(e){}}(),P=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},j=function(e,t){if(!e._n){e._n=!0;var n=e._c;b(function(){for(var i=e._v,r=1==e._s,s=0,a=function(t){var n,s,a,o=r?t.ok:t.fail,l=t.resolve,u=t.reject,c=t.domain;try{o?(r||(2==e._h&&F(e),e._h=1),!0===o?n=i:(c&&c.enter(),n=o(i),c&&(c.exit(),a=!0)),n===t.promise?u(A("Promise-chain cycle")):(s=P(n))?s.call(n,l,u):l(n)):u(i)}catch(e){c&&!a&&c.exit(),u(e)}};n.length>s;)a(n[s++]);e._c=[],e._n=!1,t&&!e._h&&I(e)})}},I=function(e){y.call(l,function(){var t,n,i,r=e._v,s=D(e);if(s&&(t=E(function(){T?S.emit("unhandledRejection",r,e):(n=l.onunhandledrejection)?n({promise:e,reason:r}):(i=l.console)&&i.error&&i.error("Unhandled promise rejection",r)}),e._h=T||D(e)?2:1),e._a=void 0,s&&t.e)throw t.v})},D=function(e){return 1!==e._h&&0===(e._a||e._c).length},F=function(e){y.call(l,function(){var t;T?S.emit("rejectionHandled",e):(t=l.onrejectionhandled)&&t({promise:e,reason:e._v})})},N=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),j(t,!0))},R=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw A("Promise can't be resolved itself");(t=P(e))?b(function(){var i={_w:n,_d:!1};try{t.call(e,u(R,i,1),u(N,i,1))}catch(e){N.call(i,e)}}):(n._v=e,n._s=1,j(n,!1))}catch(e){N.call({_w:n,_d:!1},e)}}};x||(O=function(e){f(this,O,"Promise","_h"),p(e),i.call(this);try{e(u(R,this,1),u(N,this,1))}catch(e){N.call(this,e)}},(i=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(135)(O.prototype,{then:function(e,t){var n=M(m(this,O));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=T?S.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&j(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),s=function(){var e=new i;this.promise=e,this.resolve=u(R,e,1),this.reject=u(N,e,1)},g.f=M=function(e){return e===O||e===a?new s(e):r(e)}),d(d.G+d.W+d.F*!x,{Promise:O}),n(33)(O,"Promise"),n(65)("Promise"),a=n(6).Promise,d(d.S+d.F*!x,"Promise",{reject:function(e){var t=M(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(o||!x),"Promise",{resolve:function(e){return k(o&&this===a?O:this,e)}}),d(d.S+d.F*!(x&&n(63)(function(e){O.all(e).catch(C)})),"Promise",{all:function(e){var t=this,n=M(t),i=n.resolve,r=n.reject,s=E(function(){var n=[],s=0,a=1;v(e,!1,function(e){var o=s++,l=!1;n.push(void 0),a++,t.resolve(e).then(function(e){l||(l=!0,n[o]=e,--a||i(n))},r)}),--a||i(n)});return s.e&&r(s.v),n.promise},race:function(e){var t=this,n=M(t),i=n.reject,r=E(function(){v(e,!1,function(e){t.resolve(e).then(n.resolve,i)})});return r.e&&i(r.v),n.promise}})},function(e,t){e.exports=function(e,t,n,i){if(!(e instanceof t)||void 0!==i&&i in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var i=n(18),r=n(59),s=n(60),a=n(11),o=n(14),l=n(62),u={},c={};(t=e.exports=function(e,t,n,d,h){var p,f,v,m,y=h?function(){return e}:l(e),b=i(n,d,t?2:1),g=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(s(y)){for(p=o(e.length);p>g;g++)if((m=t?b(a(f=e[g])[0],f[1]):b(e[g]))===u||m===c)return m}else for(v=y.call(e);!(f=v.next()).done;)if((m=r(v,b,f.value,t))===u||m===c)return m}).BREAK=u,t.RETURN=c},function(e,t,n){var i=n(11),r=n(22),s=n(1)("species");e.exports=function(e,t){var n,a=i(e).constructor;return void 0===a||null==(n=i(a)[s])?t:r(n)}},function(e,t){e.exports=function(e,t,n){var i=void 0===n;switch(t.length){case 0:return i?e():e.call(n);case 1:return i?e(t[0]):e.call(n,t[0]);case 2:return i?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return i?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return i?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var i=n(3),r=n(71).set,s=i.MutationObserver||i.WebKitMutationObserver,a=i.process,o=i.Promise,l="process"==n(24)(a);e.exports=function(){var e,t,n,u=function(){var i,r;for(l&&(i=a.domain)&&i.exit();e;){r=e.fn,e=e.next;try{r()}catch(i){throw e?n():t=void 0,i}}t=void 0,i&&i.enter()};if(l)n=function(){a.nextTick(u)};else if(!s||i.navigator&&i.navigator.standalone)if(o&&o.resolve){var c=o.resolve(void 0);n=function(){c.then(u)}}else n=function(){r.call(i,u)};else{var d=!0,h=document.createTextNode("");new s(u).observe(h,{characterData:!0}),n=function(){h.data=d=!d}}return function(i){var r={fn:i,next:void 0};t&&(t.next=r),e||(e=r,n()),t=r}}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var i=n(3).navigator;e.exports=i&&i.userAgent||""},function(e,t,n){var i=n(11),r=n(2),s=n(72);e.exports=function(e,t){if(i(e),r(t)&&t.constructor===e)return t;var n=s.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){var i=n(21);e.exports=function(e,t,n){for(var r in t)i(e,r,t[r],n);return e}},function(e,t){!function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,i;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i=n.preventDefault,n.preventDefault=function(){i.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}()},function(e,t,n){e.exports=function(){"use strict";var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?r((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map(function(e){return n(e,i)})}function r(t,s,a){(a=a||{}).arrayMerge=a.arrayMerge||i,a.isMergeableObject=a.isMergeableObject||e;var o=Array.isArray(s),l=Array.isArray(t),u=o===l;return u?o?a.arrayMerge(t,s,a):function(e,t,i){var s={};return i.isMergeableObject(e)&&Object.keys(e).forEach(function(t){s[t]=n(e[t],i)}),Object.keys(t).forEach(function(a){i.isMergeableObject(t[a])&&e[a]?s[a]=r(e[a],t[a],i):s[a]=n(t[a],i)}),s}(t,s,a):n(s,a)}return r.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return r(e,n,t)},{})},r}()},function(e,t,n){"use strict";n.r(t),t.default=function(e){const t=e.Element.prototype;"function"!=typeof t.matches&&(t.matches=t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||function(e){const t=(n.document||n.ownerDocument).querySelectorAll(e);let n=this,i=0;for(;t[i]&&t[i]!==n;)++i;return Boolean(t[i])}),"function"!=typeof t.closest&&(t.closest=function(e){let t=this;for(;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}},function(e,t){[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach(function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})})},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(141),s=n(142),a=n(143),o=n(144),l=n(145),u=n(146),c=n(147),d=n(20),h=n(15),p=n(5),f=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={media:{},mouse:{}},this.player=t,this._setElements(),this}var t,n,f;return t=e,(n=[{key:"create",value:function(){var e=this;this.player.getElement().controls=!1;var t=p.isVideo(this.player.getElement());this.controls=document.createElement("div"),this.controls.className="op-controls",this.player.getContainer().appendChild(this.controls),this._buildElements(),this.events.controlschanged=function(){e.destroy(),e._setElements(),e.create()},this.player.getElement().addEventListener("controlschanged",this.events.controlschanged),d.IS_ANDROID||d.IS_IOS||(this.events.mouse.mouseenter=function(){t&&(e._stopControlTimer(),e.player.playBtn.setAttribute("aria-hidden","false"),e.player.getContainer().classList.remove("op-controls--hidden"),e._startControlTimer(2500))},this.events.mouse.mousemove=function(){t&&(e.player.playBtn.setAttribute("aria-hidden","false"),e.player.getContainer().classList.remove("op-controls--hidden"),e._startControlTimer(2500))},this.events.mouse.mouseleave=function(){t&&e._startControlTimer(1e3)},this.events.media.play=function(){t&&e._startControlTimer(e.player.getOptions().hidePlayBtnTimer)},this.events.media.pause=function(){e.player.getContainer().classList.remove("op-controls--hidden"),e._stopControlTimer()},Object.keys(this.events.media).forEach(function(t){e.player.getElement().addEventListener(t,e.events.media[t])}),Object.keys(this.events.mouse).forEach(function(t){e.player.getContainer().addEventListener(t,e.events.mouse[t])}),this._startControlTimer(3e3))}},{key:"destroy",value:function(){var e=this;d.IS_ANDROID||d.IS_IOS||(Object.keys(this.events.mouse).forEach(function(t){e.player.getContainer().removeEventListener(t,e.events.mouse[t])}),Object.keys(this.events.media).forEach(function(t){e.player.getElement().removeEventListener(t,e.events.media[t])}),this._stopControlTimer()),this.player.getElement().removeEventListener("controlschanged",this.events.controlschanged),Object.keys(this.items).forEach(function(t){e.items[t].forEach(function(t){t.custom?e._destroyCustomControl(t):t.destroy()})}),this.controls.remove()}},{key:"getContainer",value:function(){return this.controls}},{key:"_startControlTimer",value:function(e){var t=this,n=this.player.activeElement();this._stopControlTimer(),this.timer=window.setTimeout(function(){if((!n.paused||!n.ended)&&p.isVideo(t.player.getElement())){t.player.getContainer().classList.add("op-controls--hidden"),t.player.playBtn.setAttribute("aria-hidden","true"),t._stopControlTimer();var e=h.addEvent("controlshidden");t.player.getElement().dispatchEvent(e)}},e)}},{key:"_stopControlTimer",value:function(){null!==this.timer&&(clearTimeout(this.timer),delete this.timer,this.timer=null)}},{key:"_setElements",value:function(){var e=this;this.play=new a.default(this.player),this.time=new u.default(this.player),this.progress=new o.default(this.player),this.volume=new c.default(this.player),this.captions=new r.default(this.player),this.settings=new l.default(this.player),this.items={left:[this.play,this.time,this.volume],middle:[this.progress],right:[this.captions,this.settings]},this.player.getCustomControls().forEach(function(t){"right"===t.position?e.items[t.position].unshift(t):e.items[t.position].push(t)}),p.isVideo(this.player.getElement())&&(this.fullscreen=new s.default(this.player),this.items.right.push(this.fullscreen))}},{key:"_buildElements",value:function(){var e=this;Object.keys(this.items).forEach(function(t){e.items[t].forEach(function(t){t.custom?e._createCustomControl(t):t.create()})}),Object.keys(this.items).forEach(function(t){e.items[t].forEach(function(t){if(!t.custom&&"function"==typeof t.addSettings){var n=t.addSettings();Object.keys(n).length&&e.settings.addItem(n.name,n.key,n.default,n.subitems,n.className)}})});var t=h.addEvent("controlschanged");this.controls.dispatchEvent(t)}},{key:"_createCustomControl",value:function(e){var t=document.createElement("button"),n=e.title.toLowerCase().replace(" ","-");t.className="op-controls__".concat(n," op-control__").concat(e.position),t.tabIndex=0,t.title=e.title,t.innerHTML='<img src="'.concat(e.icon,'"> <span class="op-sr">').concat(e.title,"</span>"),t.addEventListener("click",e.click),this.getContainer().appendChild(t)}},{key:"_destroyCustomControl",value:function(e){var t=e.title.toLowerCase().replace(" ","-"),n=this.getContainer().querySelector(".op-controls__".concat(t));n.removeEventListener("click",e.click),n.remove()}}])&&i(t.prototype,n),f&&i(t,f),e}();t.default=f},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(15),a=n(5),o=n(49),l=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={button:{},global:{},media:{}},this.tracks={},this.trackUrlList={},this.player=t,this.labels=t.getOptions().labels,this.trackList=this.player.getElement().textTracks,this.hasTracks=!!this.trackList.length,this}var t,n,l;return t=e,(n=[{key:"create",value:function(){var e=this;if(this.hasTracks){this.button=document.createElement("button"),this.button.className="op-controls__captions op-control__right",this.button.tabIndex=0,this.button.title=this.labels.toggleCaptions,this.button.setAttribute("aria-controls",this.player.id),this.button.setAttribute("aria-pressed","false"),this.button.setAttribute("aria-label",this.labels.toggleCaptions),this.button.setAttribute("data-active-captions","off"),this.button.innerHTML='<span class="op-sr">'.concat(this.labels.toggleCaptions,"</span>");for(var t=function(t,n,i){var r=n[t];if("subtitles"===r.kind){r.default&&(e.default=r.srclang,e.button.setAttribute("data-active-captions",r.srclang));var o=a.getAbsoluteUrl(r.src);e.trackList[t].language===r.srclang&&(e.trackList[t].cues&&e.trackList[t].cues.length?(e.tracks[r.srclang]=e._getNativeCues(e.trackList[t]),e._prepareTrack(t,r.srclang,o,r.default||!1)):a.request(o,"text",function(n){e.tracks[r.srclang]=e._getCuesFromText(n),e._prepareTrack(t,r.srclang,o,r.default||!1)},function(){delete e.trackList[t],r.remove();var n={detail:{id:r.srclang,type:"captions"}},i=s.addEvent("settingremoved",n);e.player.getElement().dispatchEvent(i),setTimeout(function(){var t=s.addEvent("controlschanged");e.player.getElement().dispatchEvent(t)},200)}))}},n=0,i=this.player.getElement().querySelectorAll("track"),r=i.length;n<r;n++)t(n,i);this.captions=document.createElement("div"),this.captions.className="op-captions",this.captions.innerHTML="<span></span>";var o=this.captions.querySelector("span");if(this.events.media.timeupdate=function(){if(e.player.isMedia()){var t=e.tracks[e.current.language];if(void 0!==t){var n=e._search(t,e.player.getMedia().currentTime);o.innerHTML="",n>-1&&a.hasClass(e.button,"op-controls__captions--on")?(e.captions.classList.add("op-captions--on"),o.innerHTML=e._sanitize(t[n].text)):e._hide()}}else e._hide()},this.events.button.click=function(t){var n=t.target;n.setAttribute("aria-pressed","true"),a.hasClass(n,"op-controls__captions--on")?(e._hide(),n.classList.remove("op-controls__captions--on"),n.setAttribute("data-active-captions","off")):(e._show(),n.classList.add("op-controls__captions--on"),n.setAttribute("data-active-captions",e.current.language))},this.button.addEventListener("click",this.events.button.click),this.hasTracks){var l=this.player.getContainer();l.insertBefore(this.captions,l.firstChild),this.player.getControls().getContainer().appendChild(this.button)}this.trackList.length<=1||(this.events.global.click=function(t){var n=t.target;if(n.closest("#".concat(e.player.id))&&a.hasClass(n,"op-subtitles__option")){var i=n.getAttribute("data-value").replace("captions-","");e.current=Array.from(e.trackList).filter(function(e){return e.language===i}).pop(),e._show(),e.button.setAttribute("data-active-captions",i);var r=s.addEvent("captionschanged");e.player.getElement().dispatchEvent(r)}},void 0!==this.events.global.click&&document.addEventListener("click",this.events.global.click))}}},{key:"destroy",value:function(){void 0!==this.events.global.click&&document.removeEventListener("click",this.events.global.click),this.hasTracks&&(this.button.removeEventListener("click",this.events.button.click),this.player.getElement().removeEventListener("timeupdate",this.events.media.timeupdate),this.button.remove(),this.captions.remove())}},{key:"addSettings",value:function(){var e=this;if(this.trackList.length<=1)return{};for(var t=[{key:"off",label:this.labels.off}],n=function(n,i){var r=e.trackList[n];(t=t.filter(function(e){return e.key!==r.language})).push({key:r.language,label:e.labels.lang[r.language]||e.trackList[n].label})},i=0,r=this.trackList.length;i<r;i++)n(i);return t.length>2?{className:"op-subtitles__option",default:this.default||"off",key:"captions",name:this.labels.captions,subitems:t}:{}}},{key:"_getCuesFromText",value:function(e){var t=e.split(/\r?\n/),n=[],r=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;var s,a=new RegExp("^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\x3e ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*?)$");function l(e){e="string"!=typeof e?JSON.stringify(e):e;try{e=JSON.parse(e)}catch(e){return!1}return"object"===i(e)&&null!==e}for(var u=0,c=t.length;u<c;u++){var d=a.exec(t[u]);if(d&&u<t.length){u-1>=0&&""!==t[u-1]&&(s=t[u-1]);var h=t[++u];for(u++;""!==t[u]&&u<t.length;)h="".concat(h,"\n").concat(t[u]),u++;h=h.trim().replace(r,"<a href='$1' target='_blank'>$1</a>");var p=o.timeToSeconds(d[1]);n.push({endTime:o.timeToSeconds(d[3]),identifier:s,settings:l(d[5])?JSON.parse(d[5]):{},startTime:0===p?.2:p,text:h})}s=""}return n}},{key:"_getNativeCues",value:function(e){var t=[];return Object.keys(e.cues).forEach(function(n){var i=parseInt(n,10),r=e.cues[i];t.push({endTime:r.endTime,identifier:r.id,settings:{},startTime:r.startTime,text:r.text})}),t}},{key:"_show",value:function(){this.captions&&this.current&&void 0!==this.current.cues&&(this.captions.querySelector("span").innerHTML="",this.player.getElement().addEventListener("timeupdate",this.events.media.timeupdate))}},{key:"_hide",value:function(){this.captions.classList.remove("op-captions--on"),this.button.setAttribute("data-active-captions","none")}},{key:"_search",value:function(e,t){for(var n=0,i=e.length-1;n<=i;){var r=n+i>>1,s=e[r].startTime,a=e[r].endTime;if(t>=s&&t<a)return r;s<t?n=r+1:s>t&&(i=r-1)}return-1}},{key:"_sanitize",value:function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.getElementsByTagName("script"),i=n.length;i--;)n[i].remove();for(var r=t.getElementsByTagName("*"),s=0,a=r.length;s<a;s++)for(var o=r[s].attributes,l=Array.prototype.slice.call(o),u=0,c=l.length;u<c;u++)/^(on|javascript:)/.test(l[u].name)?r[s].remove():"style"===l[u].name&&r[s].removeAttribute(l[u].name);return t.innerHTML}},{key:"_prepareTrack",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.trackUrlList[t]=n,this.trackList[e].mode="disabled",r?(this.default=t,this.button.classList.add("op-controls__captions--on"),this.button.setAttribute("data-active-captions",t),this.current=Array.from(this.trackList).filter(function(e){return e.language===i.default}).pop()):this.current=this.trackList[0],this._show(),this.player.getContainer().classList.contains("op-captions--detected")||this.player.getContainer().classList.add("op-captions--detected")}}])&&r(t.prototype,n),l&&r(t,l),e}();t.default=l},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.player=t,this.labels=t.getOptions().labels,this.isFullscreen=document.body.classList.contains("op-fullscreen__on");var n=document;return this.fullScreenEnabled=!!(n.fullscreenEnabled||n.mozFullScreenEnabled||n.msFullscreenEnabled||n.webkitSupportsFullscreen||n.webkitFullscreenEnabled||document.createElement("video").webkitRequestFullScreen),this}var t,n,r;return t=e,(n=[{key:"create",value:function(){var e=this;this.button=document.createElement("button"),this.button.type="button",this.button.className="op-controls__fullscreen op-control__right",this.button.tabIndex=0,this.button.title=this.labels.fullscreen,this.button.setAttribute("aria-controls",this.player.id),this.button.setAttribute("aria-pressed","false"),this.button.setAttribute("aria-label",this.labels.fullscreen),this.button.innerHTML='<span class="op-sr">'.concat(this.labels.fullscreen,"</span>"),this.clickEvent=function(){e.button.setAttribute("aria-pressed","true"),e.toggleFullscreen()},this.fullscreenEvents=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],this._setFullscreenData(!1),this.fullscreenEvents.forEach(function(t){document.addEventListener(t,e._fullscreenChange.bind(e))}),this.button.addEventListener("click",this.clickEvent.bind(this)),this.player.getControls().getContainer().appendChild(this.button)}},{key:"destroy",value:function(){var e=this;this.fullscreenEvents.forEach(function(t){document.removeEventListener(t,e._fullscreenChange.bind(e))}),this.button.removeEventListener("click",this.clickEvent.bind(this)),this.button.remove()}},{key:"toggleFullscreen",value:function(){if(this.isFullscreen){var e=document;e.exitFullscreen?e.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():document.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msExitFullscreen?e.msExitFullscreen():this._fullscreenChange(),document.body.classList.remove("op-fullscreen__on")}else{var t=this.player.getElement();this.fullscreenWidth=window.screen.width,this.fullscreenHeight=window.screen.height,t.requestFullscreen?t.parentElement.requestFullscreen():t.mozRequestFullScreen?t.parentElement.mozRequestFullScreen():t.webkitRequestFullScreen?t.parentElement.webkitRequestFullScreen():t.msRequestFullscreen?t.parentElement.msRequestFullscreen():t.webkitEnterFullscreen?t.webkitEnterFullscreen():this._fullscreenChange(),document.body.classList.add("op-fullscreen__on")}}},{key:"_fullscreenChange",value:function(){var e=this.isFullscreen?0:this.fullscreenWidth,t=this.isFullscreen?0:this.fullscreenHeight;this._setFullscreenData(!this.isFullscreen),this.player.isAd()&&this.player.getAd().resizeAds(e,t),this.isFullscreen=!this.isFullscreen,this._resize(e,t)}},{key:"_setFullscreenData",value:function(e){this.player.getContainer().setAttribute("data-fullscreen",(!!e).toString()),e?this.button.classList.add("op-controls__fullscreen--out"):this.button.classList.remove("op-controls__fullscreen--out")}},{key:"_resize",value:function(e,t){var n=this.player.getContainer(),i=this.player.getElement();n.style.width=e?"100%":null,n.style.height=t?"100%":null,i.style.width=e?"100%":null,i.style.height=t?"100%":null}}])&&i(t.prototype,n),r&&i(t,r),e}();t.default=r},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(51),s=n(15),a=n(5),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={controls:{},media:{}},this.player=t,this.labels=this.player.getOptions().labels,this}var t,n,o;return t=e,(n=[{key:"create",value:function(){var e=this;this.button=document.createElement("button"),this.button.type="button",this.button.className="op-controls__playpause",this.button.tabIndex=0,this.button.title=this.labels.play,this.button.setAttribute("aria-controls",this.player.id),this.button.setAttribute("aria-pressed","false"),this.button.setAttribute("aria-label",this.labels.play),this.button.innerHTML='<span class="op-sr">'.concat(this.labels.play,"/").concat(this.labels.pause,"</span>"),this.player.getControls().getContainer().appendChild(this.button),this.events.media.click=function(t){e.button.setAttribute("aria-pressed","true");var n=e.player.activeElement();n.paused||n.ended?(e.player.adsInstance&&(e.player.adsInstance.playRequested=!0),n.play()):n.pause(),t.preventDefault()},this.events.media.play=function(){e.player.activeElement().ended?(e.player.isMedia()?e.button.classList.add("op-controls__playpause--replay"):e.button.classList.add("op-controls__playpause--pause"),e.button.title=e.labels.play,e.button.setAttribute("aria-label",e.labels.play)):(e.button.classList.remove("op-controls__playpause--replay"),e.button.classList.add("op-controls__playpause--pause"),e.button.title=e.labels.pause,e.button.setAttribute("aria-label",e.labels.pause),Object.keys(r.default.instances).forEach(function(t){t!==e.player.id&&r.default.instances[t].activeElement().pause()}))},this.events.media.loadedmetadata=function(){a.hasClass(e.button,"op-controls__playpause--pause")&&(e.button.classList.remove("op-controls__playpause--replay"),e.button.classList.remove("op-controls__playpause--pause"),e.button.title=e.labels.play,e.button.setAttribute("aria-label",e.labels.play))},this.events.media.playing=function(){a.hasClass(e.button,"op-controls__playpause--pause")||(e.button.classList.remove("op-controls__playpause--replay"),e.button.classList.add("op-controls__playpause--pause"),e.button.title=e.labels.pause,e.button.setAttribute("aria-label",e.labels.pause))},this.events.media.pause=function(){e.button.classList.remove("op-controls__playpause--pause"),e.button.title=e.labels.play,e.button.setAttribute("aria-label",e.labels.play)},this.events.media.ended=function(){e.player.activeElement().ended&&e.player.isMedia()?(e.button.classList.add("op-controls__playpause--replay"),e.button.classList.remove("op-controls__playpause--pause")):(e.button.classList.remove("op-controls__playpause--replay"),e.button.classList.add("op-controls__playpause--pause")),e.button.title=e.labels.play,e.button.setAttribute("aria-label",e.labels.play)},this.events.media.adsmediaended=function(){e.button.classList.remove("op-controls__playpause--replay"),e.button.classList.add("op-controls__playpause--pause"),e.button.title=e.labels.pause,e.button.setAttribute("aria-label",e.labels.pause)};var t=this.player.getElement();this.events.controls.controlschanged=function(){if(!e.player.activeElement().paused){var n=s.addEvent("playing");t.dispatchEvent(n)}},Object.keys(this.events.media).forEach(function(n){t.addEventListener(n,e.events.media[n])}),this.player.getControls().getContainer().addEventListener("controlschanged",this.events.controls.controlschanged),this.button.addEventListener("click",this.events.media.click)}},{key:"destroy",value:function(){var e=this;Object.keys(this.events.media).forEach(function(t){e.player.getElement().removeEventListener(t,e.events.media[t])}),this.player.getControls().getContainer().removeEventListener("controlschanged",this.events.controls.controlschanged),this.button.removeEventListener("click",this.events.media.click),this.button.remove()}}])&&i(t.prototype,n),o&&i(t,o),e}();t.default=o},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),s=n(5),a=n(49),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={container:{},global:{},media:{},slider:{}},this.player=t,this.labels=t.getOptions().labels,this.forcePause=!1,this}var t,n,o;return t=e,(n=[{key:"create",value:function(){var e=this;this.progress=document.createElement("div"),this.progress.className="op-controls__progress",this.progress.tabIndex=0,this.progress.setAttribute("aria-label",this.labels.progressSlider),this.progress.setAttribute("aria-valuemin","0"),this.slider=document.createElement("input"),this.slider.type="range",this.slider.className="op-controls__progress--seek",this.slider.tabIndex=-1,this.slider.setAttribute("min","0"),this.slider.setAttribute("max","0"),this.slider.setAttribute("step","0.1"),this.slider.value="0",this.slider.setAttribute("aria-label",this.labels.progressRail),this.slider.setAttribute("role","slider"),this.buffer=document.createElement("progress"),this.buffer.className="op-controls__progress--buffer",this.buffer.setAttribute("max","100"),this.buffer.value=0,this.played=document.createElement("progress"),this.played.className="op-controls__progress--played",this.played.setAttribute("max","100"),this.played.setAttribute("role","presentation"),this.played.value=0,this.progress.appendChild(this.slider),this.progress.appendChild(this.played),this.progress.appendChild(this.buffer),r.IS_IOS||r.IS_ANDROID||(this.tooltip=document.createElement("span"),this.tooltip.className="op-controls__tooltip",this.tooltip.tabIndex=-1,this.tooltip.innerHTML="00:00",this.progress.appendChild(this.tooltip)),this.events.media.loadedmetadata=function(){var t=e.player.activeElement();if(t.duration===1/0||e.player.getElement().getAttribute("op-live"))e.destroy();else{e.slider.setAttribute("max","".concat(t.duration));var n=e.player.isMedia()?t.currentTime:t.duration-t.currentTime;e.slider.value=n.toString(),e.progress.setAttribute("aria-valuemax",t.duration.toString())}},this.events.media.progress=function(t){var n=t.target;if(n.duration!==1/0&&!e.player.getElement().getAttribute("op-live")&&n.duration>0)for(var i=0,r=n.buffered.length;i<r;i++)if(n.buffered.start(n.buffered.length-1-i)<n.currentTime){e.buffer.value=n.buffered.end(n.buffered.length-1-i)/n.duration*100;break}},this.events.media.pause=function(){var t=e.player.activeElement();if(t.duration!==1/0&&!e.player.getElement().getAttribute("op-live")){var n=t.currentTime;e.progress.setAttribute("aria-valuenow",n.toString()),e.progress.setAttribute("aria-valuetext",a.formatTime(n))}},this.events.media.play=function(){e.player.activeElement().duration===1/0||e.player.getElement().getAttribute("op-live")||(e.progress.removeAttribute("aria-valuenow"),e.progress.removeAttribute("aria-valuetext"))},this.events.media.timeupdate=function(){var t=e.player.activeElement();if(t.duration===1/0||e.player.getElement().getAttribute("op-live"))e.destroy();else{e.slider.getAttribute("max")&&"0"!==e.slider.getAttribute("max")&&parseFloat(e.slider.getAttribute("max"))===t.duration||e.slider.setAttribute("max","".concat(t.duration));var n=e.player.isMedia()?t.currentTime:t.duration-t.currentTime+1>=100?100:t.duration-t.currentTime+1,i=parseFloat(e.slider.min),r=parseFloat(e.slider.max);e.slider.value=n.toString(),e.slider.style.backgroundSize="".concat(100*(n-i)/(r-i),"% 100%"),e.played.value=t.duration<=0||isNaN(t.duration)||!isFinite(t.duration)?0:n/t.duration*100}},this.events.media.ended=function(){e.slider.style.backgroundSize="0% 100%",e.slider.setAttribute("max","0"),e.buffer.value=0,e.played.value=0};var t=function(t){if(!s.hasClass(e.slider,"op-progress--pressed")){var n=t.target;e.slider.classList.add(".op-progress--pressed");var i=e.player.activeElement(),r=parseFloat(n.min),a=parseFloat(n.max),o=parseFloat(n.value);e.slider.style.backgroundSize="".concat(100*(o-r)/(a-r),"% 100%"),e.slider.classList.remove(".op-progress--pressed"),i.currentTime=o,t.preventDefault()}},n=function(t){var n=e.player.activeElement();1!==t.which&&0!==t.which||!e.player.isMedia()||n.paused||(n.pause(),e.forcePause=!0)},i=function(){var t=e.player.activeElement();!0===e.forcePause&&e.player.isMedia()&&t.paused&&(t.play(),e.forcePause=!1)};this.events.slider.input=t.bind(this),this.events.slider.change=t.bind(this),this.events.slider.mousedown=n.bind(this),this.events.slider.mouseup=i.bind(this),this.events.slider.touchstart=function(i){var r=e.player.activeElement();if(r.duration===1/0)return!0;var a=((i.originalEvent&&i.originalEvent.changedTouches?i.originalEvent.changedTouches[0].pageX:i.pageX)-s.offset(e.progress).left)/e.progress.offsetWidth*r.duration;e.slider.value=a.toString(),t(i),n(i),i.preventDefault()}.bind(this),this.events.slider.touchend=i.bind(this),r.IS_IOS||r.IS_ANDROID||(this.events.container.mousemove=function(t){var n=e.player.activeElement();if(n.duration===1/0||e.player.isAd())return!0;var i=t.originalEvent&&t.originalEvent.changedTouches?t.originalEvent.changedTouches[0].pageX:t.pageX,r=i-s.offset(e.progress).left,o=e.tooltip.offsetWidth/2,l=r/e.progress.offsetWidth,u=l*n.duration,c=e.player.getContainer(),d=c.offsetWidth-e.tooltip.offsetWidth;r<=0||i-s.offset(c).left<=o?r=0:i-s.offset(c).left>=d?r=d:r-=o,l>=0&&l<=1?e.tooltip.classList.add("op-controls__tooltip--visible"):e.tooltip.classList.remove("op-controls__tooltip--visible"),e.tooltip.style.left="".concat(r,"px"),e.tooltip.innerHTML=isNaN(u)?"00:00":a.formatTime(u)},this.events.global.mousemove=function(t){t.target.closest(".op-controls__progress")&&!e.player.isAd()||e.tooltip.classList.remove("op-controls__tooltip--visible")}),Object.keys(this.events.media).forEach(function(t){e.player.getElement().addEventListener(t,e.events.media[t])}),Object.keys(this.events.slider).forEach(function(t){e.slider.addEventListener(t,e.events.slider[t])}),this.progress.addEventListener("keydown",this.player.getEvents().keydown),this.progress.addEventListener("mousemove",this.events.container.mousemove),document.addEventListener("mousemove",this.events.global.mousemove),this.player.getControls().getContainer().appendChild(this.progress)}},{key:"destroy",value:function(){var e=this;Object.keys(this.events).forEach(function(t){e.player.getElement().removeEventListener(t,e.events[t])}),Object.keys(this.events.slider).forEach(function(t){e.slider.removeEventListener(t,e.events.slider[t])}),this.progress.removeEventListener("keydown",this.player.getEvents().keydown),this.progress.removeEventListener("mousemove",this.events.container.mousemove),document.removeEventListener("mousemove",this.events.global.mousemove),this.buffer.remove(),this.played.remove(),this.slider.remove(),r.IS_IOS||r.IS_ANDROID||this.tooltip.remove(),this.progress.remove()}}])&&i(t.prototype,n),o&&i(t,o),e}();t.default=o},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(5),a=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.submenu={},this.events={global:{},media:{}},this.player=t,this.labels=t.getOptions().labels,this}var t,n,a;return t=e,(n=[{key:"create",value:function(){var e=this;this.button=document.createElement("button"),this.button.className="op-controls__settings op-control__right",this.button.tabIndex=0,this.button.title=this.labels.settings,this.button.setAttribute("aria-controls",this.player.id),this.button.setAttribute("aria-pressed","false"),this.button.setAttribute("aria-label",this.labels.settings),this.button.innerHTML='<span class="op-sr">'.concat(this.labels.settings,"</span>"),this.menu=document.createElement("div"),this.menu.className="op-settings",this.menu.setAttribute("aria-hidden","true"),this.menu.innerHTML='<div class="op-settings__menu" role="menu"></div>',this.clickEvent=function(){e.button.setAttribute("aria-pressed","true"),e.menu.setAttribute("aria-hidden","false"===e.menu.getAttribute("aria-hidden")?"true":"false")},this.hideEvent=function(){var t;t&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(function(){e.menu.innerHTML=e.originalOutput,e.menu.setAttribute("aria-hidden","true")})},this.removeEvent=function(t){var n=t.detail,i=n.id,r=n.type;e.removeItem(i,r)},this.events.media.controlshidden=this.hideEvent.bind(this),this.events.media.settingremoved=this.removeEvent.bind(this),this.events.media.play=this.hideEvent.bind(this),this.events.media.pause=this.hideEvent.bind(this),this.events.global.click=function(t){t.target.closest("#".concat(e.player.id))&&s.hasClass(t.target,"op-speed__option")&&(e.player.getMedia().playbackRate=parseFloat(t.target.getAttribute("data-value").replace("speed-","")))},this.events.global.resize=this.hideEvent.bind(this),this.button.addEventListener("click",this.clickEvent.bind(this)),Object.keys(this.events).forEach(function(t){e.player.getElement().addEventListener(t,e.events.media[t])}),document.addEventListener("click",this.events.global.click),window.addEventListener("resize",this.events.global.resize),this.player.getControls().getContainer().appendChild(this.button),this.player.getContainer().appendChild(this.menu)}},{key:"destroy",value:function(){var e=this;this.button.removeEventListener("click",this.clickEvent.bind(this)),Object.keys(this.events).forEach(function(t){e.player.getElement().removeEventListener(t,e.events.media[t])}),document.removeEventListener("click",this.events.global.click),window.removeEventListener("resize",this.events.global.resize),void 0!==this.events.global["settings.submenu"]&&(document.removeEventListener("click",this.events.global["settings.submenu"]),this.player.getElement().removeEventListener("controlshidden",this.hideEvent)),this.menu.remove(),this.button.remove(),this.player.getMedia().playbackRate=1}},{key:"addSettings",value:function(){return{className:"op-speed__option",default:"1",key:"speed",name:this.labels.speed,subitems:[{key:"0.25",label:"0.25"},{key:"0.5",label:"0.5"},{key:"0.75",label:"0.75"},{key:"1",label:this.labels.speedNormal},{key:"1.25",label:"1.25"},{key:"1.5",label:"1.5"},{key:"2",label:"2"}]}}},{key:"addItem",value:function(e,t,n,r,a){var o=this,l=document.createElement("div");if(l.className="op-settings__menu-item",l.tabIndex=0,l.setAttribute("role","menuitemradio"),l.innerHTML='<div class="op-settings__menu-label" data-value="'.concat(t,"-").concat(n,'">').concat(e,'</div>\n <div class="op-settings__menu-content">').concat(r.find(function(e){return e.key===n}).label,"</div>"),this.menu.querySelector(".op-settings__menu").appendChild(l),this.originalOutput=this.menu.innerHTML,r){var u='\n <div class="op-settings__header">\n <button type="button" class="op-settings__back">'.concat(e,'</button>\n </div>\n <div class="op-settings__menu" role="menu" id="menu-item-').concat(t,'">\n ').concat(r.map(function(e){return'\n <div class="op-settings__submenu-item" tabindex="0" role="menuitemradio"\n aria-checked="'.concat(n===e.key?"true":"false",'">\n <div class="op-settings__submenu-label ').concat(a||"",'" data-value="').concat(t,"-").concat(e.key,'">').concat(e.label,"</div>\n </div>")}).join(""),"\n </div>");this.submenu[t]=u}this.events.global["settings.submenu"]=function(e){var r=e.target;if(r.closest("#".concat(o.player.id))){if(s.hasClass(r,"op-settings__back"))o.menu.classList.add("op-settings--sliding"),setTimeout(function(){o.menu.innerHTML=o.originalOutput,o.menu.classList.remove("op-settings--sliding")},100);else if(s.hasClass(r,"op-settings__menu-content")){var a=r.parentElement.querySelector(".op-settings__menu-label").getAttribute("data-value").split("-");a.pop();var l=a.join("-");void 0!==i(o.submenu[l])&&(o.menu.classList.add("op-settings--sliding"),setTimeout(function(){o.menu.innerHTML=o.submenu[l],o.menu.classList.remove("op-settings--sliding")},100))}else if(s.hasClass(r,"op-settings__submenu-label")){var u=r.getAttribute("data-value"),c=u.replace("".concat(t,"-"),""),d=r.innerText,h=o.menu.querySelector("#menu-item-".concat(t," .op-settings__submenu-item[aria-checked=true]"));h&&(h.setAttribute("aria-checked","false"),r.parentElement.setAttribute("aria-checked","true"),o.submenu[t]=o.menu.innerHTML,o.menu.classList.add("op-settings--sliding"),setTimeout(function(){o.menu.innerHTML=o.originalOutput;var e=o.menu.querySelector('.op-settings__menu-label[data-value="'.concat(t,"-").concat(n,'"]'));e.setAttribute("data-value","".concat(u)),e.nextElementSibling.innerHTML=d,n=c,o.originalOutput=o.menu.innerHTML,o.menu.classList.remove("op-settings--sliding")},100))}}else o.hideEvent()},document.addEventListener("click",this.events.global["settings.submenu"]),this.player.getElement().addEventListener("controlshidden",this.hideEvent)}},{key:"removeItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,i=this.player.getElement().querySelector(".op-settings__submenu-label[data-value=".concat(t,"-").concat(e,"]"));i&&i.remove(),this.player.getElement().querySelectorAll(".op-settings__submenu-label[data-value^=".concat(t,"]")).length<n&&(delete this.submenu[t],this.player.getElement().querySelector(".op-settings__menu-label[data-value^=".concat(t,"]")).closest(".op-settings__menu-item").remove())}}])&&r(t.prototype,n),a&&r(t,a),e}();t.default=a},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(49),s=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={controls:{},media:{}},this.player=t,this.labels=t.getOptions().labels,this}var t,n,s;return t=e,(n=[{key:"create",value:function(){var e=this;this.current=document.createElement("time"),this.current.className="op-controls__current",this.current.setAttribute("role","timer"),this.current.setAttribute("aria-live","off"),this.current.setAttribute("aria-hidden","false"),this.current.innerText="0:00",this.delimiter=document.createElement("span"),this.delimiter.className="op-controls__time-delimiter",this.delimiter.setAttribute("aria-hidden","false"),this.delimiter.innerText="/",this.duration=document.createElement("time"),this.duration.className="op-controls__duration",this.duration.setAttribute("aria-hidden","false"),this.duration.innerText="0:00";var t=function(){var t=e.player.activeElement();if(t.duration===1/0||e.player.getElement().getAttribute("op-live"))e.duration.setAttribute("aria-hidden","true"),e.delimiter.setAttribute("aria-hidden","true");else{var n=isNaN(t.duration)?0:t.duration;e.duration.innerText=r.formatTime(n),e.current.innerText=r.formatTime(t.currentTime)}};this.events.media.loadedmetadata=t.bind(this),this.events.controls.controlschanged=t.bind(this),this.events.media.timeupdate=function(){var t=e.player.activeElement();if(t.duration===1/0||e.player.getElement().getAttribute("op-live"))"false"===e.duration.getAttribute("aria-hidden")&&(e.duration.setAttribute("aria-hidden","true"),e.delimiter.setAttribute("aria-hidden","true"),e.current.innerText=e.labels.live);else{var n=r.formatTime(t.duration);isNaN(t.duration)||n===e.duration.innerText||(e.duration.innerText=n,e.duration.setAttribute("aria-hidden","false"),e.delimiter.setAttribute("aria-hidden","false")),e.current.innerText=r.formatTime(t.currentTime)}},this.events.media.ended=function(){var t=e.player.activeElement();e.player.isMedia()&&"0:00"!==e.duration.innerText&&(e.duration.innerText=r.formatTime(t.duration))},Object.keys(this.events.media).forEach(function(t){e.player.getElement().addEventListener(t,e.events.media[t])}),this.player.getControls().getContainer().addEventListener("controlschanged",this.events.controls.controlschanged);var n=this.player.getControls().getContainer();n.appendChild(this.current),n.appendChild(this.delimiter),n.appendChild(this.duration)}},{key:"destroy",value:function(){var e=this;Object.keys(this.events.media).forEach(function(t){e.player.getElement().removeEventListener(t,e.events.media[t])}),this.player.getControls().getContainer().removeEventListener("controlschanged",this.events.controls.controlschanged),this.current.remove(),this.delimiter.remove(),this.duration.remove()}}])&&i(t.prototype,n),s&&i(t,s),e}();t.default=s},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),s=n(15),a=n(5),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={button:{},media:{},slider:{}},this.player=t,this.labels=t.getOptions().labels,this.volume=this.player.getMedia().volume,this}var t,n,o;return t=e,(n=[{key:"create",value:function(){var e=this;this.container=document.createElement("div"),this.container.className="op-controls__volume",this.container.tabIndex=0,this.container.setAttribute("aria-valuemin","0"),this.container.setAttribute("aria-valuemax","100"),this.container.setAttribute("aria-valuenow","".concat(this.volume)),this.container.setAttribute("aria-valuetext","".concat(this.labels.volume,": ").concat(this.volume)),this.container.setAttribute("aria-orientation","vertical"),this.container.setAttribute("aria-label",this.labels.volumeSlider),this.slider=document.createElement("input"),this.slider.type="range",this.slider.className="op-controls__volume--input",this.slider.tabIndex=-1,this.slider.value=this.player.getMedia().volume.toString(),this.slider.setAttribute("min","0"),this.slider.setAttribute("max","1"),this.slider.setAttribute("step","0.1"),this.slider.setAttribute("aria-label",this.labels.volumeControl),this.display=document.createElement("progress"),this.display.className="op-controls__volume--display",this.display.setAttribute("max","10"),this.display.setAttribute("role","presentation"),this.display.value=10*this.player.getMedia().volume,this.container.appendChild(this.slider),this.container.appendChild(this.display),this.button=document.createElement("button"),this.button.type="button",this.button.className="op-controls__mute",this.button.tabIndex=0,this.button.title=this.labels.mute,this.button.setAttribute("aria-controls",this.player.id),this.button.setAttribute("aria-pressed","false"),this.button.setAttribute("aria-label",this.labels.mute),this.button.innerHTML='<span class="op-sr">'.concat(this.labels.mute,"</span>");var t=function(t){var n=e.player.activeElement(),i=parseFloat(t.target.value);n.volume=i,n.muted=0===n.volume,e.volume=i,!n.muted&&e.player.getContainer().querySelector(".op-player__unmute")&&e.player.getContainer().querySelector(".op-player__unmute").remove();var r=s.addEvent("volumechange");e.player.getElement().dispatchEvent(r)};if(this.events.media.volumechange=function(){var t,n,i,r=e.player.activeElement();n=1*(t=r).volume,i=Math.floor(100*n),e.slider.value="".concat(t.volume),e.display.value=10*n,e.container.setAttribute("aria-valuenow","".concat(i)),e.container.setAttribute("aria-valuetext","".concat(e.labels.volume,": ").concat(i)),function(t){var n=t.volume;n<=.5&&n>0?(e.button.classList.remove("op-controls__mute--muted"),e.button.classList.add("op-controls__mute--half")):0===n?(e.button.classList.add("op-controls__mute--muted"),e.button.classList.remove("op-controls__mute--half")):(e.button.classList.remove("op-controls__mute--muted"),e.button.classList.remove("op-controls__mute--half"))}(r)},this.events.media.timeupdate=function(){a.isAudio(e.player.getElement())&&(e.player.activeElement().duration===1/0||e.player.getElement().getAttribute("op-live"))&&e.button.classList.add("op-control__right")},this.events.media.loadedmetadata=function(){var t=e.player.activeElement();t.muted&&(t.volume=0);var n=s.addEvent("volumechange");e.player.getElement().dispatchEvent(n)},this.events.slider.input=t.bind(this),this.events.slider.change=t.bind(this),this.events.button.click=function(){e.button.setAttribute("aria-pressed","true");var t=e.player.activeElement();t.muted=!t.muted,t.muted?(t.volume=0,e.button.title=e.labels.unmute,e.button.setAttribute("aria-label",e.labels.unmute)):(t.volume=e.volume,e.button.title=e.labels.mute,e.button.setAttribute("aria-label",e.labels.mute));var n=s.addEvent("volumechange");e.player.getElement().dispatchEvent(n)},this.button.addEventListener("click",this.events.button.click),Object.keys(this.events.media).forEach(function(t){e.player.getElement().addEventListener(t,e.events.media[t])}),Object.keys(this.events.slider).forEach(function(t){e.slider.addEventListener(t,e.events.slider[t])}),!r.IS_ANDROID&&!r.IS_IOS){var n=this.player.getControls().getContainer();n.appendChild(this.button),n.appendChild(this.container)}}},{key:"destroy",value:function(){var e=this;this.button.removeEventListener("click",this.events.button.click),Object.keys(this.events.media).forEach(function(t){e.player.getElement().removeEventListener(t,e.events.media[t])}),Object.keys(this.events.slider).forEach(function(t){e.slider.removeEventListener(t,e.events.slider[t])}),this.slider.remove(),this.display.remove(),this.container.remove()}}])&&i(t.prototype,n),o&&i(t,o),e}();t.default=o},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(149),a=n(150),o=n(151),l=n(36),u=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.customMedia={media:{},optionsKey:{},rules:[]},this.element=t,this.options=n,this.mediaFiles=this._getMediaFiles(),this.promisePlay=null,this.customMedia=r,this.autoplay=i,this}var t,n,u;return t=e,(n=[{key:"canPlayType",value:function(e){return this.media.canPlayType(e)}},{key:"load",value:function(){var e=this;if(!this.mediaFiles.length)throw new TypeError("Media not set");this.media&&"function"==typeof this.media.destroy&&(1===this.mediaFiles.length&&this.mediaFiles[0].src===this.media.media.src||this.media.destroy());this.mediaFiles.some(function(t){try{e.media=e._invoke(t)}catch(n){e.media=new o.default(e.element,t)}var n=e.canPlayType(t.type);return n||(e.media=new o.default(e.element,t),e.canPlayType(t.type))});try{if(null===this.media)throw new TypeError("Media cannot be played with any valid media type");this.media.promise.then(function(){e.media.load()})}catch(e){throw this.media.destroy(),e}}},{key:"play",value:function(){var e=this;return this.promisePlay=new Promise(function(e){e()}).then(function(){e.media.promise.then(function(){e.media.play()})}),this.promisePlay}},{key:"pause",value:function(){var e=this;this.promisePlay?this.promisePlay.then(function(){e.media.pause()}):this.media.pause()}},{key:"destroy",value:function(){this.media.destroy()}},{key:"_getMediaFiles",value:function(){var e=[],t=this.element.querySelectorAll("source"),n=this.element.src;n&&e.push({src:n,type:this.element.getAttribute("type")||l.predictType(n)});for(var i=0,r=t.length;i<r;i++){var s=t[i],a=s.src;e.push({src:a,type:s.getAttribute("type")||l.predictType(a)})}return e}},{key:"_invoke",value:function(e){var t,n=this;if(Object.keys(this.customMedia.media).length)return this.customMedia.rules.forEach(function(i){var r=i(e.src);if(r){var s=n.customMedia.media[r],a=n.options[n.customMedia.optionsKey[r]]||void 0;t=s(n.element,e,n.autoplay,a)}}),t?(t.create(),t):new o.default(this.element,e);if(l.isHlsSource(e)){var i=this.options&&this.options.hls?this.options.hls:void 0;return new a.default(this.element,e,this.autoplay,i)}if(l.isDashSource(e)){var r=this.options&&this.options.dash?this.options.dash:void 0;return new s.default(this.element,e,r)}return new o.default(this.element,e)}},{key:"src",set:function(e){var t=this;"string"==typeof e?this.mediaFiles.push({src:e,type:l.predictType(e)}):Array.isArray(e)?this.mediaFiles=e:"object"===i(e)&&this.mediaFiles.push(e),this.mediaFiles.some(function(e){return t.canPlayType(e.type)}),this.element.src&&this.element.setAttribute("data-op-file",this.mediaFiles[0].src),this.element.src=this.mediaFiles[0].src,this.media.src=this.mediaFiles[0]},get:function(){return this.mediaFiles}},{key:"volume",set:function(e){this.media.volume=e},get:function(){return this.media.volume}},{key:"muted",set:function(e){this.media.muted=e},get:function(){return this.media.muted}},{key:"playbackRate",get:function(){return this.media.playbackRate},set:function(e){this.media.playbackRate=e}},{key:"currentTime",set:function(e){this.media.currentTime=e},get:function(){return this.media.currentTime}},{key:"duration",get:function(){var e=this.media.duration;return e===1/0&&this.element.seekable&&this.element.seekable.length?this.element.seekable.end(0):e}},{key:"paused",get:function(){return this.media.paused}},{key:"ended",get:function(){return this.media.ended}}])&&r(t.prototype,n),u&&r(t,u),e}();t.default=u},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?l(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Object.defineProperty(t,"__esModule",{value:!0});var u=n(20),c=n(15),d=n(5),h=n(36),p=n(50),f=function(e){function t(e,n,i){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=s(this,a(t).call(this,e,n))).events={},r.options=i,r.promise="undefined"==typeof dashjs?d.loadScript("https://cdn.dashjs.org/latest/dash.all.min.js"):new Promise(function(e){return e()}),r.promise.then(function(){this.player=dashjs.MediaPlayer().create()}.bind(l(l(r)))),s(r,l(l(r)))}var n,f,v;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,p.default),n=t,(f=[{key:"canPlayType",value:function(e){return u.HAS_MSE&&"application/dash+xml"===e}},{key:"load",value:function(){var e=this;this._preparePlayer(),this.player.attachSource(this.media.src);var t=c.addEvent("loadedmetadata");this.element.dispatchEvent(t),this.events||(this.events=dashjs.MediaPlayer.events,Object.keys(this.events).forEach(function(t){e.player.on(e.events[t],e._assign.bind(e))}))}},{key:"destroy",value:function(){this._revoke()}},{key:"_assign",value:function(e){if("error"===e.type)console.error(e);else{var t=c.addEvent(e.type,e);this.element.dispatchEvent(t)}}},{key:"_revoke",value:function(){var e=this;this.events&&(Object.keys(this.events).forEach(function(t){e.player.off(e.events[t],e._assign.bind(e))}),this.events=null),this.player.reset()}},{key:"_preparePlayer",value:function(){this.player.getDebug().setLogToBrowserConsole(!1),this.player.initialize(),this.player.setScheduleWhilePaused(!1),this.player.setFastSwitchEnabled(!0),this.player.attachView(this.element),this.player.setAutoPlay(!1),this.options&&"object"===i(this.options.drm)&&Object.keys(this.options.drm).length&&(this.player.setProtectionData(this.options.drm),this.options.robustnessLevel&&this.options.robustnessLevel&&this.player.getProtectionController().setRobustnessLevel(this.options.robustnessLevel))}},{key:"src",set:function(e){var t=this;h.isDashSource(e)&&(this._revoke(),this.player=dashjs.MediaPlayer().create(),this._preparePlayer(),this.player.attachSource(e.src),this.events=dashjs.MediaPlayer.events,Object.keys(this.events).forEach(function(e){t.player.on(t.events[e],t._assign.bind(t))}))}}])&&r(n.prototype,f),v&&r(n,v),t}();t.default=f},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?l(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0});var c=n(20),d=n(15),h=n(5),p=n(36),f=n(50),v=function(e){function t(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(i=s(this,a(t).call(this,e,n))).events={},i.options=o,i.element=e,i.media=n,i.autoplay=r,i.promise="undefined"==typeof Hls?h.loadScript("https://cdn.jsdelivr.net/npm/hls.js@latest/dist/hls.min.js"):new Promise(function(e){return e()}),i.promise.then(i._create.bind(l(l(i)))),s(i,l(l(i)))}var n,i,v;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,f.default),n=t,(i=[{key:"canPlayType",value:function(e){return c.SUPPORTS_HLS()&&"application/x-mpegURL"===e}},{key:"load",value:function(){var e=this;this.player.detachMedia(),this.player.loadSource(this.media.src),this.player.attachMedia(this.element);var t=d.addEvent("loadedmetadata");this.element.dispatchEvent(t),this.events||(this.events=Hls.Events,Object.keys(this.events).forEach(function(t){e.player.on(e.events[t],function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e._assign(e.events[t],i)})}))}},{key:"destroy",value:function(){this._revoke()}},{key:"_create",value:function(){var e=this,t=this.options;t||(t={});var n=!("auto"!==this.element.preload&&!this.autoplay);t.autoStartLoad=n,this.player=new Hls(this.options),this.events=Hls.Events,Object.keys(this.events).forEach(function(t){e.player.on(e.events[t],function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e._assign(e.events[t],i)})}),n||(this.element.addEventListener("play",function(){e.player&&e.player.startLoad()}),this.element.addEventListener("pause",function(){e.player&&e.player.stopLoad()}))}},{key:"_assign",value:function(e,t){if("hlsError"===e){console.warn(t);var n=t=t[1],i=n.type,r=n.fatal,s=u(t,["type","fatal"]);if(r)switch(i){case"mediaError":var a=(new Date).getTime();if(!this.recoverDecodingErrorDate||a-this.recoverDecodingErrorDate>3e3)this.recoverDecodingErrorDate=(new Date).getTime(),this.player.recoverMediaError();else if(!this.recoverSwapAudioCodecDate||a-this.recoverSwapAudioCodecDate>3e3)this.recoverSwapAudioCodecDate=(new Date).getTime(),console.warn("Attempting to swap Audio Codec and recover from media error"),this.player.swapAudioCodec(),this.player.recoverMediaError();else{console.error("Cannot recover, last media error recovery failed");var o=d.addEvent(i,s);this.element.dispatchEvent(o)}break;case"networkError":console.error("Network error");var l=d.addEvent(i,s);this.element.dispatchEvent(l);break;default:this.player.destroy();var c=d.addEvent(i,s);this.element.dispatchEvent(c)}else{var h=d.addEvent(i,s);this.element.dispatchEvent(h)}}else{if("hlsLevelLoaded"===e&&!0===t[1].details.live){this.element.setAttribute("op-live","true");var p=d.addEvent("timeupdate");this.element.dispatchEvent(p)}var f=d.addEvent(e,t[1]);this.element.dispatchEvent(f)}}},{key:"_revoke",value:function(){var e=this;this.player.stopLoad(),this.events&&Object.keys(this.events).forEach(function(t){e.player.off(e.events[t],function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e._assign(e.events[t],i)})}),this.element.removeEventListener("play",function(){e.player&&e.player.startLoad()}),this.element.removeEventListener("pause",function(){e.player&&e.player.stopLoad()}),this.player.destroy()}},{key:"src",set:function(e){var t=this;p.isHlsSource(e)&&(this._revoke(),this.player=new Hls(this.options),this.player.loadSource(e.src),this.player.attachMedia(this.element),this.events=Hls.Events,Object.keys(this.events).forEach(function(e){t.player.on(t.events[e],function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return t._assign(t.events[e],i)})}))}}])&&r(n.prototype,i),v&&r(n,v),t}();t.default=v},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?l(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Object.defineProperty(t,"__esModule",{value:!0});var u=n(5),c=n(50),d=function(e){function t(e,n){var i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!u.isAudio(e)&&!u.isVideo(e))throw new TypeError("Native method only supports video/audio tags");return i=s(this,a(t).call(this,e,n)),s(i,l(l(i)))}var n,i,d;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,c.default),n=t,(i=[{key:"canPlayType",value:function(e){return!!this.element.canPlayType(e).replace("no","")}},{key:"load",value:function(){this.element.load()}},{key:"destroy",value:function(){return this}},{key:"src",set:function(e){this.element.src=e.src}}])&&r(n.prototype,i),d&&r(n,d),t}();t.default=d},function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),s=n(15),a=n(5),o=function(){function e(t,n,i,r,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.adsEnded=!1,this.adsDone=!1,this.adsActive=!1,this.adsStarted=!1,this.intervalTimer=0,this.adsMuted=!1,this.adsDuration=0,this.adsCurrentTime=0,this.adsManager=null,this.autoStart=!1,this.autoStartMuted=!1,this.playTriggered=!1,this.currentAdsIndex=0,this.lastTimePaused=0,this.mediaStarted=!1;this.ads=n,this.media=t,this.element=t.element,this.autoStart=i||!1,this.autoStartMuted=r||!1,this.adsOptions=Object.assign({},{debug:!1,url:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"},s),this.playTriggered=!1,this.originalVolume=this.element.volume,this.adsVolume=this.originalVolume;var o=this.adsOptions.debug?this.adsOptions.url.replace(/(\.js$)/,"_debug.js"):this.adsOptions.url;return this.promise="undefined"==typeof google||void 0===google.ima?a.loadScript(o):new Promise(function(e){return e()}),this.promise.then(this.load.bind(this)),this}var t,n,o;return t=e,(n=[{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.adsStarted=!0,this.adsContainer=document.createElement("div"),this.adsContainer.id="op-ads",this.adsContainer.tabIndex=-1,this.element.parentElement.insertBefore(this.adsContainer,this.element.nextSibling),this.mediaSources=this.media.src;var t=s.addEvent("waiting");this.element.dispatchEvent(t),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),this.adDisplayContainer=new google.ima.AdDisplayContainer(this.adsContainer,this.element),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setDisableCustomPlaybackForIOS10Plus(!0),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this._loaded.bind(this)),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this._error.bind(this)),window.addEventListener("resize",this.resizeAds.bind(this)),this.element.addEventListener("loadedmetadata",this.resizeAds.bind(this)),!0!==this.autoStart&&!0!==this.autoStartMuted&&!0!==e||(this.adsDone||(this.adsDone=!0,this.adDisplayContainer.initialize()),this._requestAds())}},{key:"play",value:function(){if(!this.adsDone)return this.adsDone=!0,this.adDisplayContainer.initialize(),void(r.IS_IOS||r.IS_ANDROID?(this.preloadContent=this._contentLoadedAction,this.element.addEventListener("loadedmetadata",this._contentLoadedAction.bind(this)),this.element.load()):this._contentLoadedAction());if(this.adsManager){this.adsActive=!0,this.adsManager.resume();var e=s.addEvent("play");this.element.dispatchEvent(e)}}},{key:"pause",value:function(){if(this.adsManager){this.adsActive=!1,this.adsManager.pause();var e=s.addEvent("pause");this.element.dispatchEvent(e)}}},{key:"destroy",value:function(){var e=this;this.events&&this.events.forEach(function(t){e.adsManager.removeEventListener(t,e._assign.bind(e))}),this.events=[],this.adsLoader.removeEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this._error.bind(this)),this.adsLoader.removeEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this._loaded.bind(this));var t=!Array.isArray(this.ads)||this.currentAdsIndex>this.ads.length;this.adsManager&&t&&this.adsManager.destroy(),(r.IS_IOS||r.IS_ANDROID)&&this.element.removeEventListener("loadedmetadata",this._contentLoadedAction.bind(this)),this.element.removeEventListener("loadedmetadata",this.resizeAds.bind(this)),this.element.removeEventListener("ended",this._contentEndedListener.bind(this)),window.removeEventListener("resize",this.resizeAds.bind(this)),this.adsContainer.remove()}},{key:"resizeAds",value:function(e,t){var n=this;if(this.adsManager){var i,r=this.element,s="true"===r.getAttribute("data-fullscreen")?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL;i&&window.cancelAnimationFrame(i),i=window.requestAnimationFrame(function(){n.adsManager.resize(e&&t?e:r.offsetWidth,e&&t?t:r.offsetHeight,s)})}}},{key:"_assign",value:function(e){var t=this,n=e.getAd();switch(e.type){case google.ima.AdEvent.Type.LOADED:if(n.isLinear()){if(this.media.paused||this.media.pause(),r.IS_IPHONE&&a.isVideo(this.element)&&(this.element.controls=!1),this.element.parentElement.classList.add("op-ads--active"),this.adsDuration=n.getDuration(),this.adsCurrentTime=n.getDuration(),!this.mediaStarted){var i=s.addEvent("waiting");this.element.dispatchEvent(i);var o=s.addEvent("loadedmetadata");this.element.dispatchEvent(o),this.resizeAds(),this.mediaStarted=!0}}else this._onContentResumeRequested();break;case google.ima.AdEvent.Type.STARTED:if(n.isLinear()){this.adsActive=!0;var l,u=s.addEvent("play");if(this.element.dispatchEvent(u),l||(this.resizeAds(),l=!0),this.media.ended){this.adsEnded=!1;var c=s.addEvent("adsmediaended");this.element.dispatchEvent(c)}this.intervalTimer=window.setInterval(function(){if(!0===t.adsActive){t.adsCurrentTime=Math.round(t.adsManager.getRemainingTime());var e=s.addEvent("timeupdate");t.element.dispatchEvent(e)}},300)}break;case google.ima.AdEvent.Type.COMPLETE:case google.ima.AdEvent.Type.SKIPPED:n.isLinear()&&(this.element.parentElement.classList.remove("op-ads--active"),this.adsActive=!1,clearInterval(this.intervalTimer));break;case google.ima.AdEvent.Type.VOLUME_CHANGED:case google.ima.AdEvent.Type.VOLUME_MUTED:if(n.isLinear()){var d=s.addEvent("volumechange");this.element.dispatchEvent(d)}break;case google.ima.AdEvent.ALL_ADS_COMPLETED:n.isLinear()&&(this.adsActive=!1,this.adsEnded=!0,this.element.parentElement.classList.remove("op-ads--active"))}var h=s.addEvent("ads".concat(e.type));this.element.dispatchEvent(h)}},{key:"_error",value:function(e){if(console.error("Ad error: ".concat(e.getError().toString())),Array.isArray(this.ads)&&this.ads.length>1&&this.currentAdsIndex<=this.ads.length)this.currentAdsIndex++,this.playTriggered=!0,this.adsStarted=!0,this.adsDone=!1,this.destroy(),this.load(!0);else{this.adsManager&&this.adsManager.destroy();var t=this.element.parentElement.querySelector(".op-player__unmute");t&&t.remove(),!0!==this.autoStart&&!0!==this.autoStartMuted&&!0!==this.adsStarted||(this.adsActive=!1,this._resumeMedia())}}},{key:"_loaded",value:function(e){var t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!1,this.adsManager=e.getAdsManager(this.element,t),this._start(this.adsManager)}},{key:"_start",value:function(e){var t=this;if(e.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this._error.bind(this)),e.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this._onContentPauseRequested.bind(this)),e.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this._onContentResumeRequested.bind(this)),this.events=[google.ima.AdEvent.Type.ALL_ADS_COMPLETED,google.ima.AdEvent.Type.CLICK,google.ima.AdEvent.Type.COMPLETE,google.ima.AdEvent.Type.FIRST_QUARTILE,google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.MIDPOINT,google.ima.AdEvent.Type.PAUSED,google.ima.AdEvent.Type.STARTED,google.ima.AdEvent.Type.THIRD_QUARTILE,google.ima.AdEvent.Type.SKIPPED,google.ima.AdEvent.Type.VOLUME_CHANGED,google.ima.AdEvent.Type.VOLUME_MUTED],this.events.forEach(function(n){e.addEventListener(n,t._assign.bind(t))}),!0===this.autoStart||!0===this.playTriggered){if(this.playTriggered=!1,!this.adsDone)return this.adsDone=!0,this.adDisplayContainer.initialize(),void(r.IS_IOS||r.IS_ANDROID?(this.preloadContent=this._contentLoadedAction,this.element.addEventListener("loadedmetadata",this._contentLoadedAction.bind(this)),this.element.load()):this._contentLoadedAction());e.init(this.element.offsetWidth,this.element.offsetHeight,"true"===this.element.parentElement.getAttribute("data-fullscreen")?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL),e.start();var n=s.addEvent("play");this.element.dispatchEvent(n);var i=s.addEvent("playing");this.element.dispatchEvent(i)}}},{key:"_contentEndedListener",value:function(){this.adsEnded=!0,this.adsActive=!1,this.adsStarted=!1,this.adsLoader.contentComplete()}},{key:"_onContentPauseRequested",value:function(){this.element.removeEventListener("ended",this._contentEndedListener.bind(this)),this.lastTimePaused=this.media.currentTime,this.adsStarted?this.media.pause():this.adsStarted=!0;var e=s.addEvent("play");this.element.dispatchEvent(e)}},{key:"_onContentResumeRequested",value:function(){if(this.element.addEventListener("ended",this._contentEndedListener.bind(this)),this.element.addEventListener("loadedmetadata",this._loadedMetadataHandler.bind(this)),r.IS_IOS||r.IS_ANDROID)this.media.src=this.mediaSources,this.media.load(),this._prepareMedia();else{var e=s.addEvent("loadedmetadata");this.element.dispatchEvent(e)}}},{key:"_loadedMetadataHandler",value:function(){this.element.seekable.length?this.element.seekable.end(0)>this.lastTimePaused&&this._prepareMedia():setTimeout(this._loadedMetadataHandler.bind(this),100)}},{key:"_resumeMedia",value:function(){var e=this;if(this.intervalTimer=0,this.adsMuted=!1,this.adsStarted=!1,this.adsDuration=0,this.adsCurrentTime=0,this.element.parentElement.classList.remove("op-ads--active"),this.media.ended){var t=s.addEvent("ended");this.element.dispatchEvent(t)}else setTimeout(function(){e.media.play();var t=s.addEvent("play");e.element.dispatchEvent(t)},50)}},{key:"_requestAds",value:function(){this.adsRequest=new google.ima.AdsRequest,this.adsRequest.adTagUrl=Array.isArray(this.ads)?this.ads[this.currentAdsIndex]:this.ads;var e=this.element.parentElement.offsetWidth,t=this.element.parentElement.offsetWidth;this.adsRequest.linearAdSlotWidth=e,this.adsRequest.linearAdSlotHeight=t,this.adsRequest.setAdWillAutoPlay(this.autoStart),this.adsRequest.setAdWillPlayMuted(this.autoStartMuted),this.adsLoader.requestAds(this.adsRequest)}},{key:"_contentLoadedAction",value:function(){this.preloadContent&&(this.element.removeEventListener("loadedmetadata",this.preloadContent.bind(this)),this.preloadContent=null),this._requestAds()}},{key:"_prepareMedia",value:function(){r.IS_IPHONE&&a.isVideo(this.element)&&(this.element.controls=!0),this.media.currentTime=this.lastTimePaused,this.element.removeEventListener("loadedmetadata",this._loadedMetadataHandler.bind(this)),this._resumeMedia()}},{key:"playRequested",set:function(e){this.playTriggered=e}},{key:"volume",set:function(e){this.adsVolume=e,this.adsManager.setVolume(e),this.media.volume=e,this.media.muted=0===e,this.adsMuted=0===e},get:function(){return this.adsVolume}},{key:"muted",set:function(e){!0===e?(this.adsManager.setVolume(0),this.adsMuted=!0,this.media.muted=!0,this.media.volume=0):(this.adsManager.setVolume(this.adsVolume),this.adsMuted=!1,this.media.muted=!1,this.media.volume=this.adsVolume)},get:function(){return this.adsMuted}},{key:"currentTime",set:function(e){this.adsCurrentTime=e},get:function(){return this.adsCurrentTime}},{key:"duration",get:function(){return this.adsDuration}},{key:"paused",get:function(){return!this.adsActive}},{key:"ended",get:function(){return this.adsEnded}}])&&i(t.prototype,n),o&&i(t,o),e}();t.default=o}]).default});