PageSourceSearch

https://www.meetion.pt/dist/js/xgplayer.js

js meetion.pt collected 2026-10-04 20:24:49 UTC 522,255 bytes, 1 lines download raw bytes

1((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("core-js/modules/es.array.find.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.number.is-nan.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.sticky.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.array.sort.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/es.number.to-fixed.js"),require("core-js/modules/es.string.repeat.js"),require("core-js/modules/es.array.find-index.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/esnext.typed-array.at.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/esnext.typed-array.find-last.js"),require("core-js/modules/esnext.typed-array.find-last-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.subarray.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.json.stringify.js")):"function"==typeof define&&define.amd?define(["core-js/modules/es.array.find.js","core-js/modules/es.object.to-string.js","core-js/modules/es.array.concat.js","core-js/modules/web.dom-collections.for-each.js","core-js/modules/es.object.keys.js","core-js/modules/es.array.slice.js","core-js/modules/es.array.join.js","core-js/modules/es.array.splice.js","core-js/modules/es.promise.js","core-js/modules/es.function.name.js","core-js/modules/es.number.is-nan.js","core-js/modules/es.number.constructor.js","core-js/modules/es.array.map.js","core-js/modules/es.array.iterator.js","core-js/modules/web.dom-collections.iterator.js","core-js/modules/es.array.filter.js","core-js/modules/es.object.assign.js","core-js/modules/es.symbol.js","core-js/modules/es.regexp.exec.js","core-js/modules/es.string.match.js","core-js/modules/es.regexp.constructor.js","core-js/modules/es.regexp.sticky.js","core-js/modules/es.regexp.to-string.js","core-js/modules/es.string.split.js","core-js/modules/es.string.replace.js","core-js/modules/es.string.trim.js","core-js/modules/es.regexp.test.js","core-js/modules/es.array.sort.js","core-js/modules/es.string.iterator.js","core-js/modules/es.number.to-fixed.js","core-js/modules/es.string.repeat.js","core-js/modules/es.array.find-index.js","core-js/modules/es.typed-array.uint8-array.js","core-js/modules/esnext.typed-array.at.js","core-js/modules/es.typed-array.copy-within.js","core-js/modules/es.typed-array.every.js","core-js/modules/es.typed-array.fill.js","core-js/modules/es.typed-array.filter.js","core-js/modules/es.typed-array.find.js","core-js/modules/es.typed-array.find-index.js","core-js/modules/esnext.typed-array.find-last.js","core-js/modules/esnext.typed-array.find-last-index.js","core-js/modules/es.typed-array.for-each.js","core-js/modules/es.typed-array.includes.js","core-js/modules/es.typed-array.index-of.js","core-js/modules/es.typed-array.iterator.js","core-js/modules/es.typed-array.join.js","core-js/modules/es.typed-array.last-index-of.js","core-js/modules/es.typed-array.map.js","core-js/modules/es.typed-array.reduce.js","core-js/modules/es.typed-array.reduce-right.js","core-js/modules/es.typed-array.reverse.js","core-js/modules/es.typed-array.set.js","core-js/modules/es.typed-array.slice.js","core-js/modules/es.typed-array.some.js","core-js/modules/es.typed-array.sort.js","core-js/modules/es.typed-array.subarray.js","core-js/modules/es.typed-array.to-locale-string.js","core-js/modules/es.typed-array.to-string.js","core-js/modules/web.url.js","core-js/modules/web.url-search-params.js","core-js/modules/es.json.stringify.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Player=t()})(this,function(){function M(t,e){var i,n=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)),n}function o(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};
1e%2?M(Object(i),!0).forEach(function(e){u(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):M(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function g(e){return(g="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 p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,H(n.key),n)}}function e(e,t,i){return t&&N(e.prototype,t),i&&N(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,i){return(t=H(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function t(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function i(i){var n=(()=>{if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}})();return function(){var e,t=a(i);return F(this,n?(e=a(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=((e,t)=>{for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e})(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:i):n.value}).apply(this,arguments)}function c(e){return(e=>{if(Array.isArray(e))return U(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||(e=>{var t;if(e)return"string"==typeof e?U(e,void 0):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?U(e,void 0):void 0})(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function H(e){e=(e=>{if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")})(e);return"symbol"==typeof e?e:String(e)}var V,f,G={exports:{}};function z(){}function q(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function W(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");i=new q(i,n||e,r),n=f?f+t:t;return e._events[n]?e._events[n].fn?e._events[n]=[e._events[n],i]:e._events[n].push(i):(e._events[n]=i,e._eventsCount++),e}function K(e,t){0==--e._eventsCount?e._events=new z:delete e._events[t]}function n(){this._events=new z,this._eventsCount=0}Y=G,V=Object.prototype.hasOwnProperty,f="~",Object.create&&(z.prototype=Object.create(null),(new z).__proto__||(f=!1)),n.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)V.call(e,t)&&i.push(f?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},n.prototype.listeners=function(e){var e=f?f+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,n=t.length,r=new Array(n);i<n;i++)r[i]=t[i].fn;return r},n.prototype.listenerCount=function(e){e=f?f+e:e,e=this._events[e];return e?e.fn?1:e.length:0},n.prototype.emit=function(e,t,i,n,r,s){var a=f?f+e:e;if(!this._events[a])return!1;var o,u=this._events[a],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,n),!0;case 5:return u.fn.call(u.context,t,i,n,r),!0;case 6:return u.fn.call(u.context,t,i,n,r,s),!0}for(d=1,o=new Array(l-1);d<l;d++)o[d-1]=arguments[d];u.fn.apply(u.context,o)}else for(var c,h=u.length,d=0;d<h;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,t);break;case 3:u[d].fn.call(u[d].context,t,i);break;case 4:u[d].fn.call(u[d].context,t,i,n);break;default:if(!o)for(c=1,o=new Array(l-1);c<l;c++)o[c-1]=arguments[c];u[d].fn.apply(u[d].context,o)}return!0},n.prototype.on=function(e,t,i){return W(this,e,t,i,!1)},n.prototype.once=function(e,t,i){return W(this,e,t,i,!0)},n.prototype.removeListener=function(e,t,i,n){e=f?f+e:e;if(this._events[e])if(t){var r=this._events[e];if(r.fn)r.fn!==t||n&&!r.once||i&&r.context!==i||K(this,e);else{for(var s=0,a=[],o=r.length;s<o;s++)(r[s].fn!==t||n&&!r[s].once||i&&r[s].context!==i)&&a.push(r[s]);a.length?this._events[e]=1===a.length?a[0]:a:K(this,e)}}else K(this,e);return this},n.prototype.removeAllListeners=function(e){return e?(e=f?f+e:e,this._events[e]&&K(this,e)):(this._events=new z,this._eventsCount=0),this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prefixed=f,Y.exports=n.EventEmitter=n;var Y=G.exports,G="undefined"!=typeof window&&window.location&&-1<window.location.href.indexOf("xgplayerdebugger=1"),X={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Q="%c[xgplayer]",d={config:{debug:G?3:0},logInfo:function(e){for(var t,i=arguments.length,n=new Array(1<i?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];
13<=this.config.debug&&(t=console).log.apply(t,[Q,X.info,e].concat(n))},logWarn:function(e){for(var t,i=arguments.length,n=new Array(1<i?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];1<=this.config.debug&&(t=console).warn.apply(t,[Q,X.warn,e].concat(n))},logError:function(e){var t;if(!(this.config.debug<1)){for(var i=2<=this.config.debug?"trace":"error",n=arguments.length,r=new Array(1<n?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];(t=console)[i].apply(t,[Q,X.error,e].concat(r))}}},Z=(e(J,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),J),m={};function J(e){p(this,J),this.bufferedList=e}function $(e){var t=g(e);return null!==e&&("object"===t||"function"===t)}function ee(n,s,e){var a,o,i,u,l,c,h=0,d=!1,f=!1,t=!0,r=!s&&0!==s&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof n)throw new TypeError("Expected a function");function p(e){var t=a,i=o;return a=o=void 0,h=e,u=n.apply(i,t)}function g(e,t){return r?(window.cancelAnimationFrame(l),window.requestAnimationFrame(e)):setTimeout(e,t)}function m(e){var t=e-c;return void 0===c||s<=t||t<0||f&&i<=e-h}function y(){var e,t=Date.now();if(m(t))return v(t);l=g(y,(e=t-h,t=s-(t-c),f?Math.min(t,i-e):t))}function v(e){return l=void 0,t&&a?p(e):(a=o=void 0,u)}function _(){for(var e=Date.now(),t=m(e),i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];if(a=n,o=this,c=e,t){if(void 0===l)return h=e=c,l=g(y,s),d?p(e):u;if(f)return l=g(y,s),p(c)}return void 0===l&&(l=g(y,s)),u}return s=+s||0,$(e)&&(d=!!e.leading,i=(f="maxWait"in e)?Math.max(+e.maxWait||0,s):i,t="trailing"in e?!!e.trailing:t),_.cancel=function(){var e;void 0!==l&&(e=l,r?window.cancelAnimationFrame(e):clearTimeout(e)),a=c=o=l=void(h=0)},_.flush=function(){return void 0===l?u:v(Date.now())},_.pending=function(){return void 0!==l},_}m.createDom=function(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"div",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},t=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(i);return r.className=t,r.innerHTML=e,Object.keys(n).forEach(function(e){var t=e,e=n[e];("video"!==i&&"audio"!==i&&"live-video"!==i||e)&&r.setAttribute(t,e)}),r},m.createDomFromHtml=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"";try{(r=document.createElement("div")).innerHTML=e;var n=r.children,r=null;return 0<n.length?(n=n[0],i&&m.addClass(n,i),t&&Object.keys(t).forEach(function(e){n.setAttribute(e,t[e])}),n):null}catch(e){return d.logError("util.createDomFromHtml",e),null}},m.hasClass=function(t,i){if(!t||!i)return!1;try{return Array.prototype.some.call(t.classList,function(e){return e===i})}catch(e){t=t.className&&"object"===g(t.className)?t.getAttribute("class"):t.className;return t&&!!t.match(new RegExp("(\\s|^)"+i+"(\\s|$)"))}},m.addClass=function(t,i){if(t&&i)try{i.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)})}catch(e){m.hasClass(t,i)||(t.className&&"object"===g(t.className)?t.setAttribute("class",t.getAttribute("class")+" "+i):t.className+=" "+i)}},m.removeClass=function(t,i){if(t&&i)try{i.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.remove(e)})}catch(e){m.hasClass(t,i)&&i.split(/\s+/g).forEach(function(e){e=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className&&"object"===g(t.className)?t.setAttribute("class",t.getAttribute("class").replace(e," ")):t.className=t.className.replace(e," ")})}},m.toggleClass=function(t,e){t&&e.split(/\s+/g).forEach(function(e){m.hasClass(t,e)?m.removeClass(t,e):m.addClass(t,e)})},m.classNames=function(){for(var i=arguments,n=[],e=0;e<arguments.length;e++)(t=>{"String"===m.typeOf(i[t])?n.push(i[t]):"Object"===m.typeOf(i[t])&&Object.keys(i[t]).map(function(e){i[t][e]&&n.push(e)})})(e);return n.join(" ")},m.findDom=function(){var t,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length?arguments[1]:void 0;try{t=i.querySelector(n)}catch(e){d.logError("util.findDom",e),0===n.indexOf("#")&&(t=i.getElementById(n.slice(1)))}return t},m.getCss=function(e,t){return(e.currentStyle||document.defaultView.getComputedStyle(e,!1))[t]},m.padStart=function(e,t,i){for(var n=String(i),i=t>>0,r=Math.ceil(i/n.length),s=[],t=String(e);r--;)s.push(n);return s.join("").substring(0,i-t.length)+t},m.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=m.padStart(Math.floor(e/3600),2,0),i=m.padStart(Math.floor((e-3600*t)/60),2,0),e=m.padStart(Math.floor(e-3600*t-60*i),2,0);return("00"===t?[i,e]:[t,i,e]).join(":")},m.event=function(e){var t;e.touches&&(t=e.touches[0]||e.changedTouches[0],e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop),e._target=e.target||e.srcElement},m.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},m.deepCopy=function(t,i){if("Object"===m.typeOf(i)&&"Object"===m.typeOf(t))return Object.keys(i).forEac
1h(function(e){"Object"!==m.typeOf(i[e])||i[e]instanceof Node?"Array"===m.typeOf(i[e])?t[e]="Array"===m.typeOf(t[e])?t[e].concat(i[e]):i[e]:t[e]=i[e]:void 0===t[e]||void 0===t[e]?t[e]=i[e]:m.deepCopy(t[e],i[e])}),t},m.deepMerge=function(i,n){return Object.keys(n).map(function(e){var t;"Array"===m.typeOf(n[e])&&"Array"===m.typeOf(i[e])?"Array"===m.typeOf(i[e])&&(t=i[e]).push.apply(t,c(n[e])):m.typeOf(i[e])!==m.typeOf(n[e])||null===i[e]||"Object"!==m.typeOf(i[e])||n[e]instanceof window.Node?null!==n[e]&&(i[e]=n[e]):m.deepMerge(i[e],n[e])}),i},m.getBgImage=function(e){var t,e=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;return e&&"none"!==e?((t=document.createElement("a")).href=e.replace(/url\("|"\)/g,""),t.href):""},m.copyDom=function(e){var t;return e&&1===e.nodeType?(t=document.createElement(e.tagName),Array.prototype.forEach.call(e.attributes,function(e){t.setAttribute(e.name,e.value)}),e.innerHTML&&(t.innerHTML=e.innerHTML),t):""},m.setInterval=function(e,t,i,n){e._interval[t]||(e._interval[t]=window.setInterval(i.bind(e),n))},m.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},m.setTimeout=function(e,t,i){e._timers||(e._timers=[]);var n=setTimeout(function(){t(),m.clearTimeout(e,n)},i);return e._timers.push(n),n},m.clearTimeout=function(e,t){var i=e._timers;if("Array"===m.typeOf(i)){for(var n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),clearTimeout(t);break}}else clearTimeout(t)},m.clearAllTimers=function(e){var t=e._timers;"Array"===m.typeOf(t)&&(t.map(function(e){clearTimeout(e)}),e._timerIds=[])},m.createImgBtn=function(e,t,i,n){var r,s,a,o=m.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));return o.style.backgroundImage='url("'.concat(t,'")'),i&&n&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every(function(e){return!(-1<i.indexOf(e)&&-1<n.indexOf(e)&&(r=parseFloat(i.slice(0,i.indexOf(e)).trim()),s=parseFloat(n.slice(0,n.indexOf(e)).trim()),a=e,1))}),o.style.width="".concat(r).concat(a),o.style.height="".concat(s).concat(a),o.style.backgroundSize="".concat(r).concat(a," ").concat(s).concat(a),o.style.margin="start"===e?"-".concat(s/2).concat(a," auto auto -").concat(r/2).concat(a):"auto 5px auto 5px"),o},m.Hex2RGBA=function(e,t){var i,n=[];return/^\#[0-9A-F]{3}$/i.test(e)&&(i="#",e.replace(/[0-9A-F]/gi,function(e){i+=e+e}),e=i),/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,function(e){n.push(parseInt(e,16))}),"rgba(".concat(n.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},m.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},m.checkIsFunction=function(e){return e&&"function"==typeof e},m.checkIsObject=function(e){return null!==e&&"object"===g(e)},m.hide=function(e){e.style.display="none"},m.show=function(e,t){e.style.display=t||"block"},m.isUndefined=function(e){if(null==e)return!0},m.isNotNull=function(e){return!(null==e)},m.setStyleFromCsstext=function(t,i){i&&("String"===m.typeOf(i)?i.replace(/\s+/g,"").split(";").map(function(e){e&&1<(e=e.split(":")).length&&(t.style[e[0]]=e[1])}):Object.keys(i).map(function(e){t.style[e]=i[e]}))},m.filterStyleFromText=function(t){var i,n,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],e=t.style.cssText;return e?(e=e.replace(/\s+/g,"").split(";"),i={},n={},e.map(function(e){e&&1<(e=e.split(":")).length&&(((e,t)=>{for(var i=0,n=t.length;i<n;i++)if(-1<e.indexOf(t[i]))return 1})(e[0],r)?i[e[0]]=e[1]:n[e[0]]=e[1])}),t.setAttribute("style",""),Object.keys(n).map(function(e){t.style[e]=n[e]}),i):{}},m.getStyleFromCsstext=function(e){var t,e=e.style.cssText;return e?(e=e.replace(/\s+/g,"").split(";"),t={},e.map(function(e){e&&1<(e=e.split(":")).length&&(t[e[0]]=e[1])}),t):{}},m.preloadImg=function(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(){},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(){};e&&((t=new window.Image).onload=function(e){t=null,i&&i(e)},t.onerror=function(e){t=null,n&&n(e)},t.src=e)},m.stopPropagation=function(e){e&&e.stopPropagation()},m.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},m.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},m.checkTouchSupport=function(){return"ontouchstart"in window},m.getBuffered2=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.5,i=[],n=0;n<e.length;n++)i.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});i.sort(function(e,t){return e.start-t.start||t.end-e.end});var r=[];if(t)for(var s=0;s<i.length;s++){var a,o=r.length;o&&(a=r[o-1].end,i[s].start-a<t)?i[s].end>a&&(r[o-1].end=i[s].end):r.push(i[s])}else r=i;return new Z(r)},m.getEventPos=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return{x:(e=e.touches&&0<e.touches.length?e.touches[0]:e).x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},m.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},m.getHostFromUrl=function(e){var t;
1return"String"!==m.typeOf(e)?"":(t="",3<(e=e.split("/")).length&&e[2]?e[2]:t)},m.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},m.isMSE=function(e){return!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},m.isBlob=function(e){return/^blob/.test(e)},m.generateSessionId=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,i=(new Date).getTime();try{t=parseInt(t)}catch(e){t=0}return i+=t,window.performance&&"function"==typeof window.performance.now&&(i+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?t:3&t|8).toString(16)})},m.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},m.adjustTimeByDuration=function(e,t,i){return t&&e&&(t<e||i&&e<t)?t:e},m.createPositionBar=function(e,t){e=m.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(e),e},m.getTransformStyle=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(n).forEach(function(e){var t=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),e="".concat(e,"(").concat(n[e],")");t.test(i)?(t.lastIndex=-1,i=i.replace(t,e)):i+="".concat(e," ")}),i},m.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},m.getIndexByTime=function(e,t){var i=t.length,n=-1;if(!(i<1))if(e<=t[0].end||i<2)n=0;else if(e>t[i-1].end)n=i-1;else for(var r=1;r<i;r++)if(e>t[r-1].end&&e<=t[r].end){n=r;break}return n},m.getOffsetCurrentTime=function(e,t){var i,n,r,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1;return(s=0<=s&&s<t.length?s:m.getIndexByTime(e,t))<0?-1:(i=t.length,n=(t=t[s]).start,r=t.end,e<n?t.cTime:n<=e&&e<=r?e-t.offset:r<e&&i-1<=s?r:-1)},m.getCurrentTimeByOffset=function(e,t){var i=-1;if(!t||t.length<0)return e;for(var n,r=0;r<t.length;r++)if(e<=t[r].duration){i=r;break}return-1!==i?(n=t[i].start,i-1<0?n+e:n+(e-t[i-1].duration)):e};var te=/(Android)\s([\d.]+)/,ie=/(Version)\/([\d.]+)/,ne=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],y={get device(){return y.os.isPc?"pc":"mobile"},get browser(){var t,i;return"undefined"==typeof navigator?"":(t=navigator.userAgent.toLowerCase(),i={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/},[].concat(Object.keys(i).filter(function(e){return i[e].test(t)}))[0])},get os(){var e,t,i,n,r,s,a,o;return"undefined"==typeof navigator?{}:(t=/(?:Windows Phone)/.test(e=navigator.userAgent),i=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),r=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||r&&/(?:Tablet)/.test(e),a=!((s=/(?:iPhone)/.test(e)&&!o)||n||i||o),{isTablet:o,isPhone:s,isIpad:o=/(?:iPad|PlayBook)/.test(e),isIos:s||o,isAndroid:n,isPc:a,isSymbian:i,isWindowsPhone:t,isFireFox:r})},get osVersion(){var e,t;return"undefined"!=typeof navigator&&(e="",e=(e=/(?:iPhone)|(?:iPad|PlayBook)/.test(t=navigator.userAgent)?ie:te)?e.exec(t):[])&&3<=e.length&&0<(t=e[2].split(".")).length?parseInt(t[0]):0},get isWeixin(){return"undefined"!=typeof navigator&&!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var t,i={isSupport:!1,mime:""};return"undefined"==typeof document?i:this.supportResult||("function"==typeof(t=document.createElement("video")).canPlayType&&ne.map(function(e){"probably"===t.canPlayType('video/mp4; codecs="'.concat(e,'"'))&&(i.isSupport=!0,i.mime+="||".concat(e))}),this.supportResult=i,t=null,i)},isMSESupport:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;
1try{return MediaSource.isTypeSupported(t)}catch(e){return this._logger.error(t,e),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var i=e.video||{},e=e.audio||{};try{var n=MediaSource.isTypeSupported(i.contentType),r=MediaSource.isTypeSupported(e.contentType);return Promise.resolve({supported:n&&r,smooth:!1,powerEfficient:!1})}catch(e){return Promise.resolve(t)}}},re="3.0.10",se={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},ae={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},oe=e(function e(t){var i,n,r,s,a,o,u,l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null},c=(p(this,e),t&&t.i18n?t.i18n.ERROR_TYPES:null);if(t.media)return i=l.mediaError||t.media.error||{},n=t.duration,r=t.currentSrc,a=(s=t.media).readyState,o=l.errorCode||i.code,u={playerVersion:re,currentTime:t.currentTime,duration:n,ended:t.ended,readyState:a,networkState:s.networkState,src:(n=t.src)||r,errorType:l.errorType,errorCode:o=ae[o]?ae[o]:o,message:l.errorMessage||i.message,mediaError:i,originError:l.originError?l.originError.stack:"",host:m.getHostFromUrl(n||r)},l.ext&&Object.keys(l.ext).map(function(e){u[e]=l.ext[e]}),u;if(1<arguments.length){for(var h={playerVersion:re,domain:document.domain},d=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],f=0;f<arguments.length;f++)h[d[f]]=arguments[f];return h.ex=c?(c[t]||{}).msg:"",h}}),r="play",ue="playing",le="ended",ce="pause",he="error",de="seeking",v="seeked",s="timeupdate",fe="waiting",_="canplay",pe="durationchange",ge="volumechange",k="loadeddata",me="ratechange",ye="progress",ve="loadstart",_e="emptied",ke="focus",be="ready",Se="urlNull",xe="autoplay_started",we="autoplay_was_prevented",Te="complete",Ee="replay",Ce="destroy",De="urlchange",Ae="download_speed_change",b="fullscreen_change",Le="cssFullscreen_change",Pe="mini_state_change",Ie="definition_change",Oe="after_definition_change",Re="video_resize",je="pip_change",Me="screenShot",Ne="playnext",Be="shortcut",Fe="user_action",Ue="reset",He="source_error",Ve="source_success",Ge=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],G={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},ze="fps_stuck",qe=Object.freeze(Object.defineProperty({__proto__:null,PLAY:r,PLAYING:ue,ENDED:le,PAUSE:ce,ERROR:he,SEEKING:de,SEEKED:v,TIME_UPDATE:s,WAITING:fe,CANPLAY:_,CANPLAY_THROUGH:"canplaythrough",DURATION_CHANGE:pe,VOLUME_CHANGE:ge,LOADED_DATA:k,LOADED_METADATA:"loadedmetadata",RATE_CHANGE:me,PROGRESS:ye,LOAD_START:ve,EMPTIED:_e,STALLED:"stalled",SUSPEND:"suspend",ABORT:"abort",BUFFER_CHANGE:"bufferedChange",PLAYER_FOCUS:ke,PLAYER_BLUR:"blur",READY:be,URL_NULL:Se,AUTOPLAY_STARTED:xe,AUTOPLAY_PREVENTED:we,COMPLETE:Te,REPLAY:Ee,DESTROY:Ce,URL_CHANGE:De,DOWNLOAD_SPEED_CHANGE:Ae,FULLSCREEN_CHANGE:b,CSS_FULLSCREEN_CHANGE:Le,MINI_STATE_CHANGE:Pe,DEFINITION_CHANGE:Ie,BEFORE_DEFINITION_CHANGE:"before_definition_change",AFTER_DEFINITION_CHANGE:Oe,SEI_PARSED:"SEI_PARSED",RETRY:"retry",VIDEO_RESIZE:Re,PIP_CHANGE:je,ROTATE:"rotate",SCREEN_SHOT:Me,PLAYNEXT:Ne,SHORTCUT:Be,XGLOG:"xglog",USER_ACTION:Fe,RESET:Ue,SOURCE_ERROR:He,SOURCE_SUCCESS:Ve,SWITCH_SUBTITLE:"switch_subtitle",VIDEO_EVENTS:Ge,STATS_EVENTS:G,FPS_STUCK:ze},Symbol.toStringTag,{value:"Module"}));function We(e,t){this&&this.emit&&("error"===e?this.errorHandler(e,t.error):this.emit
1(e,t))}t(x,Y),Ke=i(x),e(x,[{key:"setEventsMiddleware",value:function(t){var i=this;Object.keys(t).map(function(e){i.mediaEventMiddleware[e]=t[e]})}},{key:"removeEventsMiddleware",value:function(e){var t=this;Object.keys(e).map(function(e){delete t.mediaEventMiddleware[e]})}},{key:"attachVideoEvents",value:function(){var i=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=Ge.map(function(e){var n,r,t="on".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));return"function"==typeof i[t]&&i.on(e,i[t]),u({},e,(n=e,r=i,function(e,t){var i={player:r,eventName:n,originalEvent:e,detail:e.detail||{},timeStamp:e.timeStamp,currentTime:r.currentTime,duration:r.duration,paused:r.paused,ended:r.ended,isInternalOp:!!r._internalOp[e.type],muted:r.muted,volume:r.volume,host:m.getHostFromUrl(r.currentSrc),vtype:r.vtype};if(r.removeInnerOP(e.type),"timeupdate"===n&&(r._currentTime=r.media&&r.media.currentTime),"ratechange"===n){e=r.media?r.media.playbackRate:0;if(e&&r._rate===e)return;r._rate=r.media&&r.media.playbackRate}if("durationchange"===n&&(r._duration=r.media.duration),"volumechange"===n&&(i.isMutedChange=r._lastMuted!==r.muted,r._lastMuted=r.muted),"error"===n&&(i.error=t||r.video.error),r.mediaEventMiddleware[n]){e=We.bind(r,n,i);try{r.mediaEventMiddleware[n].call(r,i,e)}catch(e){throw We.call(r,n,i),e}}else We.call(r,n,i)}))})),this._evHandlers.forEach(function(e){var t=Object.keys(e)[0];n.addEventListener(t,e[t],!1)})}},{key:"detachVideoEvents",value:function(){var i=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers.forEach(function(e){var t=Object.keys(e)[0];n.removeEventListener(t,e[t],!1)}),this._evHandlers.forEach(function(e){var e=Object.keys(e)[0],t="on".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));"function"==typeof i[t]&&i.off(e,i[t])}),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var i=this,n=(e.removeAttribute("src"),e.load(),t.forEach(function(e,t){i.media.appendChild(m.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}),e.children);if(n){this._videoSourceCount=n.length,this._videoSourceIndex=n.length,this._vLoadeddata=function(e){i.emit(Ve,{src:e.target.currentSrc,host:m.getHostFromUrl(e.target.currentSrc)})};for(var r=null,s=0;s<this._evHandlers.length;s++)if("error"===Object.keys(this._evHandlers[s])[0]){r=this._evHandlers[s];break}this._sourceError||(this._sourceError=function(e){var t=parseInt(e.target.getAttribute("data-index"),10),t=(i._videoSourceIndex--,(0===i._videoSourceIndex||t>=i._videoSourceCount)&&(t={code:4,message:"sources_load_error"},r?r.error(e,t):i.errorHandler("error",t)),se[4]);i.emit(He,new oe(i,{errorType:t,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var a=0;a<n.length;a++)n[a].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var t=e.children;if(t&&0!==t.length&&this._sourceError){for(var i=0;i<t.length;i++)t[i].removeEventListener("error",this._sourceError);for(;0<t.length;)e.removeChild(t[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;this.media&&(this.media.error||i)&&(t=(i=this.media.error||i).code?se[i.code]:"other",this.media.currentSrc||(i={code:6,message:"empty_src"}),this.emit(e,new oe(this,{errorType:t,errorCode:i.code,errorMessage:i.message||"",mediaError:i})))}},{key:"destroy",value:function(){for(var e in this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){return this.media?this.media.play():null}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return!!this.media&&this.media.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0];if(!this.media)return t;e=e||this.media.buffered;var i=this.media.currentTime;if(e)for(var n=0,r=e.length;n<r&&(t[0]=e.start(n),t[1]=e.end(n),!(t[0]<=i&&i<=t[1]));n++);return t[0]-i<=0&&i-t[1]<=0?t:[0,0]}},{key:"autoplay",get:function(){return!!this.media&&this.media.autoplay}
1,set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?m.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(this.media){var t=this.media.buffered;if(t&&0!==t.length)for(var i=0;i<t.length;i++)if((t.start(i)<=this.currentTime||t.start(i)<.1)&&t.end(i)>=this.currentTime)return{start:t.start(i),end:t.end(i)}}return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){return this.media.error?["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]:""}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit(De,e),this.emit(fe),this._currentTime=0,this._duration=0,m.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===m.typeOf(e)?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()))}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e!==1/0&&this.media&&(this.media.volume=e)}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,t){for(var i,n=arguments.length,r=new Array(2<n?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];(i=l(a(x.prototype),"emit",this)).call.apply(i,[this,e,t].concat(r))}},{key:"on",value:function(e,t){for(var i,n=arguments.length,r=new Array(2<n?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];(i=l(a(x.prototype),"on",this)).call.apply(i,[this,e,t].concat(r))}},{key:"once",value:function(e,t){for(var i,n=arguments.length,r=new Array(2<n?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];(i=l(a(x.prototype),"once",this)).call.apply(i,[this,e,t].concat(r))}},{key:"off",value:function(e,t){for(var i,n=arguments.length,r=new Array(2<n?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];(i=l(a(x.prototype),"off",this)).call.apply(i,[this,e,t].concat(r))}},{key:"offAll",value:function(){l(a(x.prototype),"removeAllListeners",this).call(this)}}]);
1var Ke,S=x,Ye=(e($e,[{key:"openDB",value:function(t){var i=this,n=this,e=this.myDB.version||1,e=n.indexedDB.open(n.myDB.name,e);e.onerror=function(e){},e.onsuccess=function(e){i.myDB.db=e.target.result,t.call(n)},e.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(n.myDB.ojstore.name)||t.createObjectStore(n.myDB.ojstore.name,{keyPath:n.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.add(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.put(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(e,t,i){var n=this,e=this.myDB.db.transaction(e,"readwrite").objectStore(e).get(t);e.onerror=function(){i.call(n,null)},e.onsuccess=function(e){e=e.target.result;i.call(n,e)}}},{key:"deleteData",value:function(e,t){this.myDB.db.transaction(e,"readwrite").objectStore(e).delete(t)}},{key:"clearData",value:function(e){this.myDB.db.transaction(e,"readwrite").objectStore(e).clear()}}]),$e),Xe=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],Qe=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],Ze=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],Je="data-xgplayerid";function $e(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};p(this,$e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=e}function x(e){p(this,x),(t=Ke.call(this,e))._hasStart=!1,t._currentTime=0,t._duration=0,t._internalOp={},t._lastMuted=!1,t.vtype="MP4",t._rate=-1,t.mediaConfig=Object.assign({},{controls:!1,autoplay:e.autoplay,playsinline:e.playsinline,"x5-playsinline":e.playsinline,"webkit-playsinline":e.playsinline,"x5-video-player-fullscreen":e["x5-video-player-fullscreen"]||e.x5VideoPlayerFullscreen,"x5-video-orientation":e["x5-video-orientation"]||e.x5VideoOrientation,airplay:e.airplay,"webkit-airplay":e.airplay,tabindex:0|e.tabindex,mediaType:e.mediaType||"video","data-index":-1},e.videoConfig,e.videoAttributes);var t,i=e["x5-video-player-type"]||e.x5VideoPlayerType;return y.isWeixin&&y.os.isAndroid&&i&&(t.mediaConfig["x5-video-player-type"]=i,delete t.mediaConfig.playsinline,delete t.mediaConfig["webkit-playsinline"],delete t.mediaConfig["x5-playsinline"]),e.loop&&(t.mediaConfig.loop="loop"),e.autoplayMuted&&!Object.prototype.hasOwnProperty.call(t.mediaConfig,"muted")&&(t.mediaConfig.muted=!0),t.media=m.createDom(t.mediaConfig.mediaType,"",t.mediaConfig,""),e.defaultPlaybackRate&&(t.media.defaultPlaybackRate=t.media.playbackRate=e.defaultPlaybackRate),"Number"===m.typeOf(e.volume)&&(t.volume=e.volume),e.autoplayMuted&&(t.media.muted=!0,t._lastMuted=!0),e.autoplay&&(t.media.autoplay=!0),t._interval={},t.mediaEventMiddleware={},t.attachVideoEvents(),t}function et(n,e,r){for(var t=arguments.length,i=new Array(3<t?t-3:0),s=3;s<t;s++)i[s-3]=arguments[s];e=e.call.apply(e,[n].concat(i));r&&"function"==typeof r&&(e&&e.then?e.then(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r.call.apply(r,[n].concat(t))}):r.call.apply(r,[n].concat(i)))}function tt(s,a){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),this.__hooks[s]||(this.__hooks[s]=null),function(){var e,t=arguments,i=this;if(o.pre)try{(e=o.pre).call.apply(e,[this].concat(Array.prototype.slice.call(arguments)))}catch(e){throw e.message="[pluginName: ".concat(this.pluginName,":").concat(s,":pre error] >> ").concat(e.message),e}if(this.__hooks&&this.__hooks[s])try{var n,r=(n=this.__hooks[s]).call.apply(n,[this,this].concat(Array.prototype.slice.call(arguments)));r?r.then?r.then(function(e){!1!==e&&et.apply(void 0,[i,a,o.next].concat(c(t)))}).catch(function(e){throw e}):et.apply(void 0,[this,a,o.next].concat(Array.prototype.slice.call(arguments))):void 0===r&&et.apply(void 0,[this,a,o.next].concat(Array.prototype.slice.call(arguments)))}catch(e){throw e.message="[pluginName: ".concat(this.pluginName,":").concat(s,"] >> ").concat(e.message),e}else et.apply(void 0,[this,a,o.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function it(e,t){var i=this.__hooks;if(i)return i.hasOwnProperty(e)?(i&&(i[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function nt(e,t){var i=this.__hooks;i&&delete i[e]}function rt(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var e=this.plugins[e.toLowerCase()],t=arguments.length,i=new Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return e.useHooks&&e.useHooks.apply(e,i)}}function st(e){if(this.plugins&&this.plugins[e.toLowerCase()]){e=this.plugins[e.toLowerCase()];if(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return e.removeHooks&&e.removeHooks.apply(e,i)}}}function at(t,e){e=1<arguments.length&&void 0!==e?e:[];t.__hooks={},e&&e.map(function(e){t.__hooks[e]=null}),Object.defineProperty(t,"hooks",{get:function(){return t.__hooks&&Object.keys(t.__hooks).map(function(e){if(t.__hooks[e])return e})}})}function ot(e){e.__hooks=null}function w(t,i,n){for(var e=arguments.length,r=new Array(3<e?e-3:0),s=3;s<e;s++)r[s-3]=arguments[s];if(!t.__hooks||!t.__hooks[i])return n.call.apply(n,[t,t].concat(r));var a=(a=t.__hooks[i]).call.apply(a,[t,t].concat(r));if(a&&a.then)a.then(function(e){return!1===e?null:n.call.apply(n,[t,t].concat(r))}).catch(function(e){console.warn("[runHooks]".concat(i," reject"),e.message)});else if(!1!==a)return n.call.apply(n,[t,t].concat(r))}function ut(e,t){d.logError("[".concat(e,"] event or callback cant be undefined or null when call ").
1concat(t))}e(ct,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=(e.pluginName?e:this.constructor).pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||this.lang}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=m.checkTouchSupport()?"touch":"mouse";return e=!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType?e:this.playerConfig.domEventType}},{key:"on",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach(function(e){i.__events[e]=t,i.player.on(e,t)}):ut(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(t,i){var n=this;t&&i&&this.player?"string"==typeof t?(this.__onceEvents[t]=i,this.player.once(t,i)):Array.isArray(t)&&t.forEach(function(e){n.__onceEvents[e]=i,n.player.once(t,i)}):ut(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(t,i){var n=this;t&&i&&this.player?"string"==typeof t?(delete this.__events[t],this.player.off(t,i)):Array.isArray(t)&&t.forEach(function(e){delete n.__events[t],n.player.off(e,i)}):ut(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var i=this;["__events","__onceEvents"].forEach(function(t){Object.keys(i[t]).forEach(function(e){i[t][e]&&i.off(e,i[t][e]),e&&delete i[t][e]})}),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var i=arguments.length,n=new Array(1<i?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];(t=this.player).emit.apply(t,[e].concat(n))}}},{key:"emitUserAction",value:function(e,t){var i;this.player&&(i=o(o({},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}),{},{pluginName:this.pluginName}),this.player.emitUserAction(e,t,i))}},{key:"hook",value:function(e,t){return tt.call.apply(tt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var i=arguments.length,n=new Array(2<i?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return it.call.apply(it,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var i=arguments.length,n=new Array(2<i?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return nt.call.apply(nt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return i&&(t.pluginName=i),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var t=this,e=this.player,i=this.pluginName;this.offAll(),m.clearAllTimers(this),m.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map(function(e){t[e]=null}),e.unRegisterPlugin(i),ot(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(e,i,t[i])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]);var lt=ct;function ct(e){p(this,ct),m.checkIsFunction(this.beforeCreate)&&this.beforeCreate(e),at(this),this.__args=e,this.__events={},this.__onceEvents={},this.config=e.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(e)}"undefined"==typeof Element||Element.prototype.matches||((jt=Element.prototype).matches=jt.matchesSelector||jt.mozMatchesSelector||jt.msMatchesSelector||jt.oMatchesSelector||jt.webkitMatchesSelector);var ht=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}};function dt(e,t,i,n,r){var s=function(t,i,e,n){return function(e){e.delegateTarget=ht(e.target,i
1),e.delegateTarget&&n.call(t,e)}}.apply(this,arguments);return e.addEventListener(i,s,r),{destroy:function(){e.removeEventListener(i,s,r)}}}function ft(e,t,i,n,r){return"function"==typeof e.addEventListener?dt.apply(null,arguments):"function"==typeof i?dt.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,function(e){return dt(e,t,i,n,r)}))}var pt={CONTROLS:"controls",ROOT:"root"},T={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"};function gt(e){return e&&e.indexOf&&/^(?:http|data:|\/)/.test(e)}function mt(t,e,i,n,r){var i=2<arguments.length&&void 0!==i?i:"",s=3<arguments.length&&void 0!==n?n:{},n=4<arguments.length&&void 0!==r?r:"",a=null;if(t instanceof window.Element)return m.addClass(t,i),Object.keys(s).map(function(e){t.setAttribute(e,s[e])}),t;if(gt(t)||gt(t.url))return s.src=gt(t)?t:t.url||"",a=m.createDom(t.tag||"img","",s,"xg-img ".concat(i));if("function"==typeof t)try{return(a=t())instanceof window.Element?(m.addClass(a,i),Object.keys(s).map(function(e){a.setAttribute(e,s[e])}),a):(d.logWarn("warn>>icons.".concat(e," in config of plugin named [").concat(n,"] is a function mast return an Element Object")),null)}catch(e){return d.logError("Plugin named [".concat(n,"]:createIcon"),e),null}return"string"==typeof t?m.createDomFromHtml(t,s,i):(d.logWarn("warn>>icons.".concat(e," in config of plugin named [").concat(n,"] is invalid")),null)}function yt(l,c){var h=c.config.icons||c.playerConfig.icons;Object.keys(l).map(function(e){var t,i,n,r,s=l[e],a=s&&s.class?s.class:"",o=s&&s.attr?s.attr:{},u=null;h&&h[e]&&(n=h[e],r=a,a="object"===g(n)&&n.class&&"string"==typeof n.class?"".concat(r," ").concat(n.class):r,t=h[e],i=o,"object"===g(t)&&t.attr&&"object"===g(t.attr)&&Object.keys(t.attr).map(function(e){i[e]=t.attr[e]}),o=i,u=mt(h[e],e,a,o,c.pluginName)),!u&&s&&(u=mt(s.icon||s,o,a,{},c.pluginName)),c.icons[e]=u})}t(C,lt),vt=i(C),e(C,[{key:"__init",value:function(e){if(l(a(C.prototype),"__init",this).call(this,e),e.root){var t=e.root,i=null;this.icons={},this.root=null,this.parent=null,yt(this.registerIcons()||{},this),this.langText={};var n=this.registerLanguageTexts()||{},r=this,s=(Object.keys(n).map(function(i){Object.defineProperty(r.langText,i,{get:function(){var e=r.lang,t=r.i18n;return t[i]||n[i]&&n[i][e]||""}})}),"");try{s=this.render()}catch(e){throw d.logError("Plugin:".concat(this.pluginName,":render"),e),new Error("Plugin:".concat(this.pluginName,":render:").concat(e.message))}if(s)(i=C.insert(s,t,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(i=m.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),t.appendChild(i)}this.root=i,this.parent=t;s=this.config.attr||{},e=this.config.style||{};this.setAttr(s),this.setStyle(e),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var s,a=this;this.root&&(this._children=[],s=this.children())&&"object"===g(s)&&0<Object.keys(s).length&&Object.keys(s).map(function(e){var t,i,n=s[e],r={root:a.root};"function"==typeof n?(t=a.config[e]||{},i=n):"object"===g(n)&&"function"==typeof n.plugin&&(t=n.options?m.deepCopy(a.config[e]||{},n.options):a.config[e]||{},i=n.plugin),void 0!==(r.config=t).index&&(r.index=t.index),t.root&&(r.root=t.root),a.registerPlugin(i,r,e)})}},{key:"updateLang",value:function(i){i=i||this.lang;var e=this.root,n=this.i18n,r=this.langText;e&&function e(t,i){for(var n=0;n<t.children.length;n++)0<t.children[n].children.length?e(t.children[n],i):i(t.children[n])}(e,function(e){var t=e.getAttribute&&e.getAttribute("lang-key");t&&(t=n[t.toUpperCase()]||r[t])&&(e.innerHTML="function"==typeof t?t(i):t)})}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",i=this.i18n||{},n=this.langText,i=(e.setAttribute&&e.setAttribute("lang-key",t),i[t]||n[t]||"");i&&(e.innerHTML=i)}},{key:"plugins",value:function(){return this._children}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",e=(t.root=t.root||this.root,l(a(C.prototype),"registerPlugin",this).call(this,e,t,i));return this._children.push(e),e}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,t,i){var n=this;arguments.length<3&&"function"==typeof t?Array.isArray(e)?e.forEach(function(e){n.bindEL(e,t)}):this.bindEL(e,t):(e=C.delegate.call(this,this.root,e,t,i),this.__delegates=this.__delegates.concat(e))}},{key:"unbind",value:function(e,t){var i=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach(function(e){i.unbindEL(e,t)}):this.unbindEL(e,t);else for(var n="".concat(e,"_").concat(t),r=0;r<this.__delegates.length;r++)if(this.__delegates[r].key===n){this.__delegates[r].destroy(),this.__delegates.splice(r,1);break}}},{key:"setStyle",value:function(t,e){var i=this;if(this.root)return"String"===m.typeOf(t)?this.root.style[t]=e:void("Object"===m.typeOf(t)&&Object.keys(t).map(function(e){i.root.style[e]=t[e]}))}},{key:"setAttr",value:function(t,e){var i=this;if(this.root)return"String"===m.typeOf(t)?this.root.setAttribute(t,e):void("Object"===m.typeOf(t)&&Object.keys(t).map(function(e){i.root.setAttribute(e,t[e])}))}},{key:"setHtml",value:function(e,t){this.root&&(this.root.innerHTML=e,"function"==typeof t)&&t()}},{key:"bindEL",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,i)}},{key:"unbindEL",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.removeEventListener(e,t,i)}},{key:"show",value:function(e){if(this.root)return this.root.style.display=void 0!==e?e:"block","none"===window.getComputedStyle(this.root,null).getPropertyValue("display")?this.root.style.display="block":void 0}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,t){if(!this.root)return null;if(arguments.length<2&&e instanceof window.Element)return this.root.appendChild(e);if(!(t&&t instanceof window.Element))return null;try{return("string"==typeof e?this.find(e):e).appendChild(t)}catch(e){return d.logError("Plugin:appendChild",e),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var t=this,i=this.player;this.__delegates.map(function(e){e.destroy()}),this.__delegates=[],this._children instanceof Array&&(this._children.map(function(e){i.unRegisterPlugin(e.pluginName)}),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),l(a(C.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map(function(e){t[e]=null})}}],[{key:"insert",value:function(e,t){var i=t.children.length,n=Number(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0),r=e instanceof window.Node;if(i){for(var s=0,a=null,o="";s<i;s++){var a=t.children[s],u=Number(a.getAttribute("data-index"));if(n<=u){o="beforebegin";break}u<n&&(o="afterend")}return r?"afterend"===o?t.appendChild(e):t.insertBefore(e,a):a.insertAdjacentHTML(o,e),"afterend"===o?t.children[t.children.length-1]:t.children[s]}return r?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.children[t.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(i,n,e,r){var t,s=4<arguments.length&&void 0!==arguments[4]&&arguments[4],a=[];return i instanceof window.Node&&"function"==typeof r&&(Array.isArray(e)?e.forEach(function(e){var t=ft(i,n,e,r,s);t.key="".concat(n,"_").concat(e),a.push(t)}):((t=ft(i,n,e,r,s)).key="".concat(n,"_").concat(e),a.push(t))),a}},{key:"ROOT_TYPES",get:function(){return pt}},{key:"POSITIONS",get:function(){return T}}]);var vt,E=C,_t=(e(bt,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer,this.observer.observe(e);for(var i=e.getAttribute(Je),n=this.__handlers,r=-1,s=0;s<n.length;s++)n[s]&&e===n[s].target&&(r=s);-1<r?this.__handlers[r].handler=t:this.__handlers.push({target:e,handler:t,playerId:i})}}},{key:"unObserver",value:function(i){var n=-1;this.__handlers.map(function(e,t){i===e.target&&(n=t)});try{this.observer&&this.observer.unobserve(i)}catch(e){}this.observer&&this.observer.unobserve(i),-1<n&&this.__handlers.splice(n,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,i=0;i<t.length;i++)if(t[i]&&e===t[i].target){try{t[i].handler(e)}catch(e){console.error(e)}return!0}return!1}}]),bt),kt=null;function bt(){var n=this;if(p(this,bt),u(this,"__trigger",function(e){var t=(new Date).getTime();n.timeStamp=t;for(var i=0;i<e.length;i++)n.__runHandler(e[i].target)}),this.__handlers=[],this.timeStamp=0,this.observer=null,window.ResizeObserver)try{this.observer=new window.ResizeObserver(((e,t)=>{var i=!0,n=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return $(t)&&(i="leading"in t?!!t.leading:i,n="trailing"in t?!!t.trailing:n),ee(e,100,{leading:i,trailing:n,maxWait:100})})(this.__trigger,{trailing:!0})),this.timeStamp=(new Date).getTime()}catch(e){console.error(e)}}function C(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return p(this,C),(e=vt.call(this,e)).__delegates=[],e}var D={pluginGroup:{},init:function(e){var t,i,n=e._pluginInfoId;n||(n=(new Date).getTime(),e._pluginInfoId=n),e.config.closeResizeObserver||(t=e.root,i=function(){e.resize()},(kt=kt||new _t).addObserver(t,i)),0===Object.keys(this.pluginGroup).length&&(e.isUserActive=!0),this.pluginGroup[n]={_player:e,_originalOptions:e.config||{},_plugins:{}}},checkPlayerRoot:function(e){if(this.pluginGroup)for(var t=Object.keys(this.pluginGroup),i=0;i<t.length;i++){var n=this.pluginGroup[t[i]]._player;if(n.root===e)return n}return null},formatPluginInfo:function(e,t){var i=null,n=null,n=e.plugin&&"function"==typeof e.plugin?(i=e.plugin,e.options):(i=e,{});return t&&(n.config=t||{}),{PLUFGIN:i,options:n}},checkPluginIfExits:function(e,t){for(var i=0;i<t.length;i++)if(e.toLowerCase()===t[i].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(e,t){for(var i=Object.keys(t),n=null,r=0;r<i.length;
1r++)if(e.toLowerCase()===i[r].toLowerCase()){n=t[i[r]];break}return"Object"===m.typeOf(n)?{root:n.root,position:n.position}:{}},lazyRegister:function(i,e){var n=this,r=e.timeout||1500;return Promise.race([e.loader().then(function(e){var t=e&&e.__esModule?e.default:e;n.register(i,t,e.options)}),new Promise(function(e,t){setTimeout(function(){t(new Error("timeout"))},r)})])},register:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var n=e._pluginInfoId;if(n&&this.pluginGroup[n]){this.pluginGroup[n]._plugins||(this.pluginGroup[n]._plugins={});var r=this.pluginGroup[n]._plugins,s=this.pluginGroup[n]._originalOptions,a=(i.player=this.pluginGroup[n]._player,i.pluginName||t.pluginName);if(!a)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){i.config||(i.config={});for(var o=Object.keys(s),u=0;u<o.length;u++)if(a.toLowerCase()===o[u].toLowerCase()){var l=s[o[u]];"Object"===m.typeOf(l)?i.config=Object.assign({},i.config,s[o[u]]):"Boolean"===m.typeOf(l)&&(i.config.disable=!l);break}t.defaultConfig&&Object.keys(t.defaultConfig).forEach(function(e){void 0===i.config[e]&&(i.config[e]=t.defaultConfig[e])}),i.root?"string"==typeof i.root&&(i.root=e[i.root]):i.root=e.root,i.index=i.config.index||0;try{r[a.toLowerCase()]&&(this.unRegister(n,a.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(a,"] exist, destroy the old instance")));var c=new t(i);return r[a.toLowerCase()]=c,r[a.toLowerCase()].func=t,c&&"function"==typeof c.afterCreate&&c.afterCreate(),c}catch(e){throw console.error(e),e}}else console.warn("not supported plugin [".concat(a,"]"))}}},unRegister:function(t,i){t._pluginInfoId&&(t=t._pluginInfoId),i=i.toLowerCase();try{var e=this.pluginGroup[t]._plugins[i];e&&(e.pluginName&&e.__destroy(),delete this.pluginGroup[t]._plugins[i])}catch(e){console.error("[unRegister:".concat(i,"] cgid:[").concat(t,"] error"),e)}},deletePlugin:function(e,t){e=e._pluginInfoId;e&&this.pluginGroup[e]&&this.pluginGroup[e]._plugins&&delete this.pluginGroup[e]._plugins[t]},getPlugins:function(e){e=e._pluginInfoId;return e&&this.pluginGroup[e]?this.pluginGroup[e]._plugins:{}},findPlugin:function(e,t){e=e._pluginInfoId;return e&&this.pluginGroup[e]?(t=t.toLowerCase(),this.pluginGroup[e]._plugins[t]):null},beforeInit:function(r){var s=this;function a(e){return e&&e.then?e:new Promise(function(e){e()})}return new Promise(function(t){if(s.pluginGroup)return(r._loadingPlugins&&r._loadingPlugins.length?Promise.all(r._loadingPlugins):Promise.resolve()).then(function(){var i,n,e=r._pluginInfoId;s.pluginGroup[e]?(i=s.pluginGroup[e]._plugins,n=[],Object.keys(i).forEac
1h(function(e){if(i[e]&&i[e].beforePlayerInit)try{var t=i[e].beforePlayerInit();n.push(a(t))}catch(e){throw n.push(a(null)),e}}),Promise.all([].concat(n)).then(function(){t()}).catch(function(e){console.error(e),t()})):t()})})},afterInit:function(e){var t,e=e._pluginInfoId;e&&this.pluginGroup[e]&&(t=this.pluginGroup[e]._plugins,Object.keys(t).forEach(function(e){t[e]&&t[e].afterPlayerInit&&t[e].afterPlayerInit()}))},setLang:function(e,t){var i,t=t._pluginInfoId;t&&this.pluginGroup[t]&&(i=this.pluginGroup[t]._plugins,Object.keys(i).forEach(function(t){if(i[t].updateLang)i[t].updateLang(e);else try{i[t].lang=e}catch(e){console.warn("".concat(t," setLang"))}}))},reRender:function(t){var i,n,r=this,s=t._pluginInfoId;s&&this.pluginGroup[s]&&(i=[],n=this.pluginGroup[s]._plugins,Object.keys(n).forEach(function(e){"controls"!==e&&n[e]&&(i.push({plugin:n[e].func,options:n[e].__args}),r.unRegister(s,e))}),i.forEach(function(e){r.register(t,e.plugin,e.options)}))},onPluginsReady:function(e){var t,e=e._pluginInfoId;e&&this.pluginGroup[e]&&(t=this.pluginGroup[e]._plugins||{},Object.keys(t).forEach(function(e){t[e].onPluginsReady&&"function"==typeof t[e].onPluginsReady&&t[e].onPluginsReady()}))},setCurrentUserActive:function(e,t){if(this.pluginGroup[e]){if(t)for(var i=Object.keys(this.pluginGroup),n=0;n<i.length;n++){var r=this.pluginGroup[i[n]];r&&r._player&&(this.pluginGroup[i[n]]._player.isUserActive=!1)}return this.pluginGroup[e]._player.isUserActive=t,e}},getCurrentUseActiveId:function(){if(this.pluginGroup){for(var e=Object.keys(this.pluginGroup),t=0;t<e.length;t++){var i=this.pluginGroup[e[t]];if(i&&i._player&&i._player.isUserActive)return e[t]}return null}},destroy:function(e){var t=e._pluginInfoId;if(this.pluginGroup[t]){var i=e.root;kt.unObserver(i,void 0);for(var i=this.pluginGroup[t]._plugins,n=0,r=Object.keys(i);n<r.length;n++){var s=r[n];this.unRegister(t,s)}i=e.isUseActive;delete this.pluginGroup[t],delete e._pluginInfoId,i&&0<(e=Object.keys(this.pluginGroup)).length&&this.setCurrentUserActive(e[e.length-1],!0)}}},A={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function St(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:e="zh-cn"===(e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase())?"zh":e,controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}};var e}var xt,wt=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],Tt=(t(Et,E),xt=i(Et),e(Et,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==y.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var t,i=this,e=this.config,n=e.disable,r=e.height;n||("flex"===e.mode&&this.player.addClass(A.FLEX_CONTROLS),t={height:"".concat(r,"px")},Object.keys(t).map(function(e){i.root.style[e]=t[e]}),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-control
1s"),this.on(Pe,function(e){e?m.addClass(i.root,"mini-controls"):m.removeClass(i.root,"mini-controls")}),n=this.playerConfig.isMobileSimulateMode,"mobile"!==y.device&&"mobile"!==n&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave)))}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&m.addClass(this.root,A.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){m.removeClass(this.root,A.CONTROLS_AUTOHIDE)}},{key:"show",value:function(){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length?arguments[2]:void 0;if(this.root){var n=e.defaultConfig||{};if(!t.root){switch(t.position||(t.config&&t.config.position?t.config:n).position){case T.CONTROLS_LEFT:t.root=this.left;break;case T.CONTROLS_RIGHT:t.root=this.right;break;case T.CONTROLS_CENTER:t.root=this.center;break;case T.CONTROLS:t.root=this.root;break;default:t.root=this.left}return l(a(Et.prototype),"registerPlugin",this).call(this,e,t,i)}}}},{key:"destroy",value:function(){"mobile"!==y.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{key:"render",value:function(){var e=this.config,t=e.mode,i=e.autoHide,n=e.initShow;if(!e.disable)return e=m.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},u({},A.CONTROLS_AUTOHIDE,i),{"xgplayer-controls-initshow":n||!i}),'<xg-controls class="'.concat(e,'" unselectable="on">\n    <xg-inner-controls class="xg-inner-controls xg-pos">\n      <xg-left-grid class="xg-left-grid">\n      </xg-left-grid>\n      <xg-center-grid class="xg-center-grid"></xg-center-grid>\n      <xg-right-grid class="xg-right-grid">\n      </xg-right-grid>\n    </xg-inner-controls>\n    </xg-controls>')}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),Et),L={lang:{},langKeys:[],textKeys:[]};function Et(){var n;p(this,Et);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(n=xt.call.apply(xt,[this].concat(t))),"onMouseEnter",function(e){var t=h(n),i=t.player;t.playerConfig.closeControlsBlur&&i.focus({autoHide:!1})}),u(h(n),"onMouseLeave",function(e){h(n).player.focus()}),n}function Ct(r,s){Object.keys(s).forEach(function(e){var t,i=m.typeOf(s[e]),n=m.typeOf(r[e]);"Array"===i?("Array"!==n&&(r[e]=[]),(t=r[e]).push.apply(t,c(s[e]))):"Object"===i?("Object"!==n&&(r[e]={}),Ct(r[e],s[e])):r[e]=s[e]})}function Dt(){Object.keys(L.lang.en).map(function(e){L.textKeys[e]=e})}function At(e,t){var i=e.LANG;(t=t||L).lang&&(e=e.TEXT||{},t.lang[i="zh"===i?"zh-cn":i]?Ct(t.lang[i],e):(t.langKeys.push(i),t.lang[i]=e),Dt())}At({LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",E
1RROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}});var Lt,Pt={get textKeys(){return L.textKeys},get langKeys(){return L.langKeys},get lang(){var t={};return L.langKeys.map(function(e){t[e]=L.lang[e]}),L.lang["zh-cn"]&&(t.zh=L.lang["zh-cn"]||{}),t},extend:function(t,i){var n,e=[];(i=i||L).lang&&(e="Array"!==m.typeOf(t)?Object.keys(t).map(function(e){return{LANG:"zh"===e?"zh-cn":e,TEXT:t[e]}}):t,n=i.lang,e.map(function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),n[e.LANG]?Ct(n[e.LANG]||{},e.TEXT||{}):At(e,i)}),Dt())},use:At,init:function(e){var t,e={lang:{},langKeys:[],textKeys:{},pId:e};return Ct(e.lang,L.lang),(t=e.langKeys).push.apply(t,c(L.langKeys)),Ct(e.textKeys,L.textKeys),e}},It=["play","pause","replay","retry"],Ot=0,Rt=0,jt=(t(P,S),Lt=i(P),e(P,[{key:"_initDOM",value:function(){var t=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var e=this.config.el;if(!e||1!==e.nodeType)return this.emit(he,new oe("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1;this.root=e}var i,e=D.checkPlayerRoot(this.root),e=(e&&(d.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),e.destroy()),this.root.setAttribute(Je,this.playerId),D.init(this),this._initBaseDoms(),this.constructor.XgVideoProxy),n=(e&&this.mediaConfig.mediaType===e.mediaType&&(n=this.innerContainer||this.root,this.detachVideoEvents(this.media),e=new e(n,this.config,this.mediaConfig),this.attachVideoEvents(e),this.media=e),this.media.setAttribute(Je,this.playerId),this.config.controls&&(n=this.config.controls.root||null,e=D.register(this,Tt,{root:n}),this.controls=e),"mobile"===this.config.isMobileSimulateMode?"mobile":y.device),e=(this.addClass("".concat(A.DEFAULT," ").concat(A.INACTIVE," xgplayer-").concat(n," ").concat(this.config.controls?"":A.NO_CONTROLS)),this.config.autoplay?this.addClass(A.ENTER):this.addClass(A.NO_START),this.config.fluid?(n=(e=this.config).width,e=e.height,"number"==typeof n&&"number"==typeof e||(n=600,e=337.5),i={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(100*e/n,"%")}
1,Object.keys(i).forEach(function(e){t.root.style[e]=i[e]})):["width","height"].forEach(function(e){t.config[e]&&("number"!=typeof t.config[e]?t.root.style[e]=t.config[e]:t.root.style[e]="".concat(t.config[e],"px"))}),this.root.getBoundingClientRect()),n=e.width,r=e.height,s=e.left,e=e.top;return this.sizeInfo.width=n,this.sizeInfo.height=r,this.sizeInfo.left=s,this.sizeInfo.top=e,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=m.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var t=this;["focus","blur"].forEach(function(e){t.on(e,t["on"+e.charAt(0).toUpperCase()+e.slice(1)])}),Xe.forEach(function(e){document&&document.addEventListener(e,t.onFullscreenChange)}),y.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(k,this.resize),this.playFunc=function(){t.config.closeFocusVideoFocus||t.media.focus()},this.once(r,this.playFunc)}},{key:"_unbindEvents",value:function(){var t=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),Xe.forEach(function(e){document.removeEventListener(e,t.onFullscreenChange)}),this.playFunc&&this.off(r,this.playFunc),this.off(_,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_startInit",value:function(e){var t=this;!this.media||(!e||""===e||"Array"===m.typeOf(e)&&0===e.length)&&(e="",this.emit(Se),d.logWarn("config.url is null, please get url and run player._startInit(url)"),this.config.nullUrlStart)||(this._detachSourceEvents(this.media),"Array"===m.typeOf(e)&&0<e.length?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e,"Number"===m.typeOf(this.config.volume)&&(this.volume=this.config.volume),e=this.innerContainer||this.root,this.media instanceof window.Element&&!e.contains(this.media)&&e.insertBefore(this.media,e.firstChild),e=this.media.readyState,d.logInfo("_startInit readyState",e),this.config.autoplay&&(m.isMSE(this.media)||this.load(),y.os.isIpad||y.os.isPhone)&&this.mediaPlay(),2<=e?this.canPlayFunc():this.once(_,this.canPlayFunc),(!this.hasStart||this.state<4)&&D.afterInit(this),this.hasStart=!0,this.setState(4),m.setTimeout(this,function(){t.emit(Te)},0))}},{key:"_registerPlugins",value:function(){var n=this,r=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],e=(this._loadingPlugins=[],this.config.ignores||[]),t=this.config.plugins||[],i=this.config.i18n||[],s=(r&&Pt.extend(i,this.__i18n),e.join("||").toLowerCase().split("||")),a=this.plugins;t.forEach(function(e){try{var t,i=(e.plugin||e).pluginName;if(i&&-1<s.indexOf(i.toLowerCase()))return null;if(r||!a[i.toLowerCase()]){if(!e.lazy||!e.loader)return n.registerPlugin(e);t=D.lazyRegister(n,e),e.forceBeforeInit&&(t.then(function(){n._loadingPlugins.splice(n._loadingPlugins.indexOf(t),1)}).catch(function(e){d.logError("_registerPlugins:loadingPlugin",e),n._loadingPlugins.splice(n._loadingPlugins.indexOf(t),1)}),n._loadingPlugins.push(t))}}catch(e){d.logError("_registerPlugins:",e)}})}},{key:"_registerPresets",value:function(){var a=this;this.config.presets.forEach(function(e){var t,i,n,r,s;t=a,e=(e=e).preset&&e.options?new e.preset(e.options,t.config):new e({},t.config),i=void 0===(i=e.plugins)?[]:i,n=void 0===(n=e.ignores)?[]:n,s=void 0===(r=e.icons)?{}:r,e=void 0===(r=e.i18n)?[]:r,t.config.plugins||(t.config.plugins=[]),t.config.ignores||(t.config.ignores=[]),(r=t.config.plugins).push.apply(r,c(i)),(r=t.config.ignores).push.apply(r,c(n)),Object.keys(s).map(function(e){t.config.icons[e]||(t.config.icons[e]=s[e])}),i=t.config.i18n||[],e.push.apply(e,c(i)),t.config.i18n=e})}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case T.ROOT_RIGHT:this.rightBar||(this.rightBar=m.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case T.ROOT_LEFT:this.leftBar||(this.leftBar=m.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case T.ROOT_TOP:this.topBar||(this.topBar=m.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&m.addClass(this.topBar,A.TOP_BAR_AUTOHIDE)),t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var e=D.formatPluginInfo(e,t),t=e.PLUFGIN,e=e.options,i=this.config.plugins,i=(D.checkPluginIfExits(t.pluginName,i)||i.push(t),D.getRootByConfig(t.pluginName,this.config)),i=(i.root&&(e.root=i.root),i.position&&(e.position=i.position),e.position||e.config&&e.config.position||t.defaultConfig&&t.defaultConfig.position);return!e.root&&"string"==typeof i&&-1<i.indexOf("controls")?this.controls&&this.controls.registerPlugin(t,e,t.pluginName):(e.root||(e.root=this._getRootByPosition(i)),D.register(this,t,e))}},{key:"deregister",value:function(e){"string"==typeof e?D.unRegister(this,e):e instanceof lt&&D.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.deregister(e),t&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var t;if("string"==typeof e?t=e:e instanceof lt&&(t=e.pluginName),t)for(var i=this.config.plugins.length-1;-1<i;i--)if(this.config.plugins[i].pluginName.toLowerCase()===t.toLowerCase()){this.config.plugins.splice(i,1);break}}},{key:"plugins",get:function(){return D.getPlugins(this)}},{key:"getPlugin",value:function(e){e=D.findPlugin(this,e);return e&&e.pluginName?e:null}},{key:"addClass",value:function(e){!this.root||m.hasClass(this.root,e)||m.addClass(this.root,e)}},{key:"removeClass",value:function(e){this.root&&m.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return m.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,t){this.root&&this.root.setAttribute(e,t)}},{key:"removeAttribute",value:function(e,t){this.root&&this.root.removeAttribute(e,t)}},{key:"start",value:function(t){var i=this;if(!(3<this.state))return t||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(3),this._registerPlugins(!1),D.beforeInit(this).then(function(){var e;if(i.config)return t=t||i.url||i.config.url,e=i.preProcessUrl(t),i._startInit(e.url)}).catch(function(e){throw e.fileName="player",e.lineNumber="236",d.logError("start:beforeInit:",e),e})}},{key:"switchURL",value:function(e,t){var r=this,s=e,a=("Object"===m.typeOf(e)&&(s=e.url),s=this.preProcessUrl(s).url,this.currentTime),o=this.paused&&!this.isError;return this.src=s,new Promise(function(e,t){function i(){r.currentTime=a,o&&r.pause(),r.off("error",n),e(!0)}var n=function(e){r.off("timeupdate",i),r.off("canplay",i),t(e)};r.once("error",n),s?(y.os.isAndroid?r.once("timeupdate",i):r.once("canplay",i),r.play()):r.errorHandler("error",{code:6,message:"empty_src"})})}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e,t=this;if(this.hasStart||!(this.state<4))return this.state<6&&(this.removeClass(A.NO_START),!this.isCanplay)&&this.addClass(A.ENTER),void 0!==(e=l(a(P.prototype),"play",this).call(this))&&e&&e.then?e.then(function(){t.removeClass(A.NOT_ALLOW_AUTOPLAY),t.addClass(A.PLAYING),t.state<6&&(d.logInfo(">>>>playPromise.then"),t.setState(6),t.emit(xe))}).catch(function(e){d.logWarn(">>>>playPromise.catch",e.name),t.media&&t.media.error?(t.onError(),t.removeClass(A.ENTER)):"NotAllowedError"===e.name&&(t._errorTimer=m.setTimeout(t,function(){t._errorTimer=null,t.emit(we),t.addClass(A.NOT_ALLOW_AUTOPLAY),t.removeClass(A.ENTER),t.pause(),t.setState(5)},0))}):(d.logWarn("video.play not return promise"),this.state<6&&(this.setState(6),this.removeClass(A.NOT_ALLOW_AUTOPLAY),this.removeClass(A.NO_START),this.removeClass(A.ENTER),this.addClass(A.PLAYING),this.emit
1(xe))),e;this.removeClass(A.NO_START),this.addClass(A.ENTER),this.start(),this._useAutoplay=!0}},{key:"mediaPause",value:function(){l(a(P.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){l(a(P.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(A.PAUSED),w(this,"play",function(){return e.mediaPlay()})}},{key:"pause",value:function(){var e=this;w(this,"pause",function(){l(a(P.prototype),"pause",e).call(e)})}},{key:"seek",value:function(e,t){var i,n,r,s=this;this.media&&!Number.isNaN(Number(e))&&this.hasStart&&(n=(i=this.config).isSeekedPlay,r=t||(n?"play":i.seekedStatus),e=e<0?0:e>this.duration?parseInt(this.duration,10):e,this._isPauseBeforeSeek||(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(v,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(s.removeClass(A.ENTER),s.isSeeking=!1,r){case"play":s.play();break;case"pause":s.pause();break;default:1<s._isPauseBeforeSeek||s.paused?s.pause():s.play()}s._isPauseBeforeSeek=0,s._onceSeekCanplay=null},this.once(v,this._onceSeekCanplay),this.state<6?(this.removeClass(A.NO_START),this.currentTime=e,this.play()):this.currentTime=e)}},{key:"getInitDefinition",value:function(){var t=this,e=this.config,i=e.definition;!e.url&&i&&i.list&&0<i.list.length&&i.defaultDefinition&&i.list.map(function(e){e.definition===i.defaultDefinition&&(t.config.url=e.url,t.curDefinition=e)})}},{key:"changeDefinition",value:function(t,e){var i=this,n=this.config.definition;Array.isArray(null==n?void 0:n.list)&&n.list.forEach(function(e){(null==t?void 0:t.definition)===e.definition&&(i.curDefinition=e)}),null!=t&&t.bitrate&&"number"!=typeof t.bitrate&&(t.bitrate=parseInt(t.bitrate,10)||0),this.emit(Ie,{from:e,to:t}),this.hasStart?(n=this.switchURL(t.url,o({seamless:!1!==n.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},t)))&&n.then?n.then(function(){i.emit(Oe,{from:e,to:t})}):this.emit(Oe,{from:e,to:t}):this.config.url=t.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(k,this.reloadFunc)}},{key:"resetState",value:function(){var t=this,e=[A.NOT_ALLOW_AUTOPLAY,A.PLAYING,A.NO_START,A.PAUSED,A.REPLAY,A.ENTER,A.ENDED,A.ERROR,A.LOADING];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,e.forEach(function(e){t.removeClass(e)}),this.addClass(A.ENTER),this.emit(Ue)}},{key:"reset",value:function(){var t,i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],n=1<arguments.length?arguments[1]:void 0;this.resetState(),this.plugins&&(e.map(function(e){i.deregister(e)}),n)&&(t=St(),Object.keys(this.config).keys(function(e){"undefined"===i.config[e]||"plugins"!==e&&"presets"!==e&&"el"!==e&&"id"!==e||(i.config[e]=t[e])}))}},{key:"destroy",value:function(){var t=this,e=this.innerContainer,i=this.root,n=this.media;if(i&&n){if(this.hasStart=!1,this._useAutoplay=!1,i.removeAttribute(Je),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),m.clearAllTimers(this),this.emit(Ce),D.destroy(this),ot(this),l(a(P.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),e)for(var r=e.children,s=0;s<r.length;s++)e.removeChild(r[s]);!e&&n instanceof window.Node&&i.contains(n)&&i.removeChild(n),["topBar","leftBar","rightBar","innerContainer"].map(function(e){t[e]&&i.removeChild(t[e]),t[e]=null});n=i.className.split(" ");0<n.length?i.className=n.filter(function(e){return e.indexOf("xgplayer")<0}).join(" "):i.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach(function(e){t[e]=!1})}}},{key:"replay",value:function(){var t=this;this.removeClass(A.ENDED),this.currentTime=0,this.isSeeking=!1,w(this,"replay",function(){t.once(v,function(){var e=t.mediaPlay();e&&e.catch&&e.catch(function(e){console.log(e)})}),t.play(),t.emit(Ee),t.onPlay()})}},{key:"retry",value:function(){var i=this;this.removeClass(A.ERROR),this.addClass(A.LOADING),w(this,"retry",function(){var e=i.currentTime,t=i.config.url,t=m.isMSE(i.media)?{url:t}:i.preProcessUrl(t);i.src=t.url,i.config.isLive||(i.currentTime=e),i.once(_,function(){i.mediaPlay()})})}},{key:"changeFullStyle",value:function(e,t,i,n){e&&(n=n||A.PARENT_FULLSCREEN,this._orgCss||(this._orgCss=m.filterStyleFromText(e)),m.addClass(e,i),t)&&t!==e&&!this._orgPCss&&(this._orgPCss=m.filterStyleFromText(t),m.addClass(t,n),t.setAttribute(Je,this.playerId))}},{key:"recoverFullStyle",value:function(e,t,i,n){n=n||A.PARENT_FULLSCREEN,this._orgCss&&(m.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),m.removeClass(e,i),t&&t!==e&&this._orgPCss&&(m.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",m.removeClass(t,n),t.removeAttribute(Je))}},{key:"getFullscreen",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,i=this.media,e=e||t;if(this._fullScreenOffset={top:m.scrollTop(),left:m.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",m.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var n=0;n<Qe.length;n++){var r,s=Qe[n];if(e[s])return(r="webkitRequestFullscreen"===s?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[s]())&&r.then?r:Promise.resolve()}return i.fullscreenEnabled||i.webkitSupportsFullscreen?(i.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch(e){return Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),this._fullscreenEl||m.getFullScreenEl()){this.root;var t=this.media;this._fullActionFrom="exit";try{for(var i=0;i<Ze.length;i++){var n,r=Ze[i];if(document[r])return(n=document[r]())&&n.then?n:Promise.resolve()}return t&&t.webkitSupportsFullscreen?(t.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch(e){return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=(this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen(),e?"".concat(A.INNER_FULLSCREEN," ").concat(A.CSS_FULLSCREEN):A.CSS_FULLSCREEN),t=(this.changeFullStyle(this.root,e,t),this.config.fullscreen),t=void 0===t?{}:t;(!0===t.useCssFullscreen||"function"==typeof t.useCssFullscreen&&t.useCssFullscreen())&&(this.fullscreen=!0,this.emit
1(b,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Le,!0)}},{key:"exitCssFullscreen",value:function(){var e,t=this._cssfullscreenEl?"".concat(A.INNER_FULLSCREEN," ").concat(A.CSS_FULLSCREEN):A.CSS_FULLSCREEN;this.fullscreen?!0===(e=void 0===(e=this.config.fullscreen)?{}:e).useCssFullscreen||"function"==typeof e.useCssFullscreen&&e.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,t),this.fullscreen=!1,this.emit(b,!1)):this.removeClass(t):this.recoverFullStyle(this.root,this._cssfullscreenEl,t),this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Le,!1)}},{key:"getRotateFullscreen",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=(this.cssfullscreen&&this.exitCssFullscreen(e),e?"".concat(A.INNER_FULLSCREEN," ").concat(A.ROTATE_FULLSCREEN):A.ROTATE_FULLSCREEN);this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,t,A.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(b,!0)}},{key:"exitRotateFullscreen",value:function(e){var t=this._fullscreenEl!==this.root?"".concat(A.INNER_FULLSCREEN," ").concat(A.ROTATE_FULLSCREEN):A.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,t,A.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(b,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){90===window.orientation||-90===window.orientation?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};this.isActive?this.onFocus(e):this.emit(ke,o({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};this.isActive?this.emit("blur",o({paused:this.paused,ended:this.ended},e)):this.onBlur(e)}},{key:"onFocus",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{autoHide:!0,delay:3e3},i=this.innerStates;this.isActive=!0,this.removeClass(A.INACTIVE),this.userTimer&&(m.clearTimeout(this,this.userTimer),this.userTimer=null),void 0!==t.isLock&&(i.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||i.isActiveLocked?this.userTimer&&(m.clearTimeout(this,this.userTimer),this.userTimer=null):(i=t&&t.delay?t.delay:this.config.inactive,this.userTimer=m.setTimeout(this,function(){e.userTimer=null,e.blur()},i))}},{key:"onBlur",value:function(){var e,t=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).ignorePaused,t=void 0!==t&&t;this.isActive&&!this.innerStates.isActiveLocked&&(e=this.config.closePauseVideoFocus,this.isActive=!1,t||e||!this.paused&&!this.ended)&&this.addClass(A.INACTIVE)}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(A.ENTER),this.removeClass(A.ERROR),this.removeClass(A.LOADING),this.isCanplay=!0,this.waitTimer&&m.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){this.isError=!1,this.isSeeking=!1}},{key:"onLoadstart",value:function(){this.removeClass(A.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){7===this.state&&this.setState(6),this.removeClass(A.PAUSED),this.ended&&this.removeClass(A.ENDED),this.config.closePlayVideoFocus||this.focus()}},{key:"onPause",value:function(){this.addClass(A.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this.userTimer&&(m.clearTimeout(this,this.userTimer),this.userTimer=null),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(A.ENDED),this.setState(7)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(A.NOT_ALLOW_AUTOPLAY),this.removeClass(A.NO_START),this.removeClass(A.ENTER),this.removeClass(A.LOADING),this.addClass(A.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(A.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&m.clearTimeout(this,this.waitTimer),this.removeClass(A.LOADING),this.removeClass(A.
1SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&m.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=m.setTimeout(this,function(){e.addClass(A.LOADING),m.clearTimeout(e,e.waitTimer),e.waitTimer=null},this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var t=this;this.isError=!1,[A.NO_START,A.PAUSED,A.ENDED,A.ERROR,A.REPLAY,A.LOADING].forEach(function(e){t.removeClass(e)})}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(A.LOADING))&&2<this.media.readyState&&(this.removeClass(A.LOADING),m.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state<6&&this.duration&&(this.setState(6),this.emit(xe)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===m.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,i){var n;this.media&&t&&e&&(n="String"===m.typeOf(e)?e:e.type||"",i.props&&"Array"!==m.typeOf(i.props)&&(i.props=[i.props]),this.emit(Fe,o({eventType:n,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},i)))}},{key:"updateAcc",value:function(e){var t;this._accPlayed.t&&(t=(new Date).getTime()-this._accPlayed.t,this._accPlayed.acc+=t,this._accPlayed.t=0,"ended"!==e&&!this.ended||(this._accPlayed.loopAcc=this._accPlayed.acc))}},{key:"checkBuffer",value:function(e){var t=this.media.buffered;if(!t||0===t.length||!this.duration)return!0;for(var i=e||this.media.currentTime||.2,n=t.length,r=0;r<n;r++)if(t.start(r)<=i&&t.end(r)>i)return!0;return!1}},{key:"resizePosition",value:function(){var e,t,i,n,r,s,a,o,u=this.videoPos,l=u.rotate,c=u.vy,h=u.vx,d=u.h,u=u.w;l<0&&!c&&!h||(e=!(e=this.videoPos._pi)&&this.media.videoHeight?this.media.videoWidth/this.media.videoHeight*100:e)&&(this.videoPos.pi=e,e={rotate:l},o=t=0,i=1,l=Math.abs(l/90),a=this.root,r=this.innerContainer,n=a.offsetWidth,a=r=(r||a).offsetHeight,s=n,l%2==0?(e.scale=i=0<d?100/d:0<u?100/u:1,t=0<c?(100-d)/2-c:0,e.y=2===l?0-t:t,o=0<h?(100-u)/2-h:0,e.x=2===l?0-o:o,this.media.style.width="".concat(s,"px"),this.media.style.height="".concat(a,"px")):l%2==1&&(o=-(d=r-(a=n))/2/(s=r)*100,e.x=3===l?o+c/2:o-c/2,t=d/2/a*100,e.y=3===l?t+h/2:t-h/2,e.scale=i,this.media.style.width="".concat(s,"px"),this.media.style.height="".concat(a,"px")),u=m.getTransformStyle(e,this.media.style.transform||this.media.style.webkitTransform),this.media.style.transform=u,this.media.style.webkitTransform=u)}},{key:"position",value:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};this.media&&t&&t.h&&((e=this.videoPos).h=100*t.h||0,e.w=100*t.w||0,e.vx=100*t.x||0,e.vy=100*t.y||0,this.resizePosition())}},{key:"setConfig",value:function(i){var n=this;i&&Object.keys(i).map(function(e){var t;"plugins"!==e&&(n.config[e]=i[e],t=n.plugins[e.toLowerCase()])&&"Function"===m.typeOf(t.setConfig)&&t.setConfig(i[e])})}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,w(this,"playnext",function(){t.start(),t.emit(Ne,e)})}},{key:"resize",value:function(){var e,t,i,n,r,s,a,o,u,l,c=this;this.media&&(n=this.root.getBoundingClientRect(),this.sizeInfo.width=n.width,this.sizeInfo.height=n.height,this.sizeInfo.left=n.left,this.sizeInfo.top=n.top,r=(s=this.media).videoWidth,s=s.videoHeight,e=(t=this.config).fitVideoSize,"fill"!==(t=t.videoFillMode)&&"cover"!==t&&"contain"!==t||this.setAttribute("data-xgfill",t),s)&&r&&(this._videoHeight=s,this._videoWidth=r,i=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,l=n.width,n=n.height-i,r=parseInt(r/s*1e3,10),s=parseInt(l/n*1e3,10),a=l,o=n,u={},"auto"===e&&r<s||"fixWidth"===e?(o=l/r*1e3,this.config.fluid?u.paddingTop="".concat(100*o/a,"%"):u.height="".concat(o+i,"px")):("auto"===e&&s<r||"fixHeight"===e)&&(u.width="".concat(a=r*n/1e3,"px")),this.fullscreen||this.cssfullscreen||Object.keys(u).forEach(function(e){c.root.style[e]=u[e]}),("fillHeight"===t&&s<r||"fillWidth"===t&&r<s)&&this.setAttribute("data-xgfill","cover"),l={videoScale:r,vWidth:a,vHeight:o,cWidth:a,cHeight:o+i}
1,this.resizePosition(),this.emit(Re,l))}},{key:"updateObjectPosition",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(e,t):this.media.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%")}},{key:"setState",value:function(e){d.logInfo("setState","state from:".concat(wt[this.state]," to:").concat(wt[e])),this._state=e}},{key:"preProcessUrl",value:function(e,t){var i=this.config.preProcessUrl;return!m.isBlob(e)&&i&&"function"==typeof i?i(e,t):{url:e}}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"==typeof e&&(!1===(this._hasStart=e)&&this.setState(2),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return 6===this._state||7===this._state},set:function(e){e?this.setState(6):6<=this._state&&this.setState(4)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var i=this,n=this.config.definition,r=null,s=null;n.list=e,this.emit("resourceReady",e),e.forEach(function(e){var t;(null==(t=i.curDefinition)?void 0:t.definition)===e.definition&&(r=e),n.defaultDefinition===e.definition&&(s=e)}),!s&&0<e.length&&(s=e[0]),r?this.changeDefinition(r):s&&this.changeDefinition(s)}},{key:"videoFrameInfo",get:function(){var e,t={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};return this.media&&this.media.getVideoPlaybackQuality&&(e=this.media.getVideoPlaybackQuality(),t.dropped=e.droppedVideoFrames||0,t.total=e.totalVideoFrames||0,t.corrupted=e.corruptedVideoFrames||0,0<t.total)&&(t.droppedRate=t.dropped/t.total*100,t.droppedDuration=parseInt(this.cumulateTime/t.total*t.dropped,0)),t}},{key:"lang",get:function(){return this.config.lang},set:function(t){0!==Pt.langKeys.filter(function(e){return e===t}).length||"zh"===t?(this.config.lang=t,D.setLang(t,this)):console.error("Sorry, set lang fail, because the language [".concat(t,"] is not supported now, list of all supported languages is [").concat(Pt.langKeys.join(),"] "))}},{key:"i18n",get:function(){var e=this.config.lang;return this.__i18n.lang[e="zh"===e?"zh-cn":e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return re}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return(this.plugins.poster||this).config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return l(a(P.prototype),"readyState",this)}},{key:"error",get:function(){var e=l(a(P.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return l(a(P.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,e=e.t;return e?(new Date).getTime()-e+t:t}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){(e=m.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return Rt},set:function(e){Rt=e}},{key:"realTimeSpeed",get:function(){return Ot},set:function(e){Ot=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,t){return tt.call.apply(tt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){return it.call.apply(it,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){return nt.call.apply(nt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,t,i){for(var n=arguments.length,r=new Array(3<n?n-3:0),s=3;s<n;s++)r[s-3]=arguments[s];return rt.call.apply(rt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,t,i){for(var n=arguments.length,r=new Array(3<n?n-3:0),s=3;s<n;s++)r[s-3]=arguments[s];return st.call.apply(st,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,t){"boolean"==typeof t&&t!==this.muted&&(this.addInnerOP("volumechange"),this.muted=t),D.setCurrentUserActive(this.playerId,e)}}],[{key:"debugger",get:function(){return d.config.debug},set:function(e){d.config.debug=e}},{key:"getCurrentUserActivePlayerId",value:function(){return D.getCurrentUseActiveId()}},{key:"setCurrentUserActive",value:function(e,t){D.setCurrentUserActive(e,t)}},{key:"isHevcSupported",value:function(){return y.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return y.probeConfigSupported(e)}},{key:"install",value:function(e,t){(P.plugins=P.plugins?P.plugins:{})[e]||(P.plugins[e]=t)}},{key:"use",value:function(e,t){(P.plugins=P.plugins?P.plugins:{})[e]=t}}]),P);function P(e){var s;p(this,P);var t,i,e=m.deepMerge(St(),e),e=(u(h(s=Lt.call(this,e)),"canPlayFunc",function(){var e,t,i;s.config&&(e=(t=s.config).autoplay,i=t.defaultPlaybackRate,d.logInfo("player","canPlayFunc, startTime",t=t.startTime),t&&(s.currentTime=t>s.duration?s.duration:t,s.config.startTime=0),s.playbackRate=i,(e||s._useAutoplay)&&s.mediaPlay(),s.off(_,s.canPlayFunc),s.removeClass(A.ENTER))}),u(h(s),"onFullscreenChange",function(e,t){function i(){m.setTimeout(h(s),function(){s.resize()},100)}var n=m.getFullScreenEl(),r=(s._fullActionFrom?s._fullActionFrom="":s.emit(Fe,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:s.currentTime,duration:s.duration,props:[{prop:"fullscreen",from:!0,to:!1}]}),((e,t)=>{var i;if(e)return!(!(i=e.getAttribute("data-xgplayerid"))||i!==t||"VIDEO"!==e.tagName&&"AUDIO"!==e.tagName)})(n,s.playerId));t||n&&(n===s._fullscreenEl||r)?(i(),s.config.closeFocusVideoFocus||s.media.focus(),s.fullscreen=!0,s.changeFullStyle(s.root,n,A.FULLSCREEN),s.emit(b,!0,s._fullScreenOffset),s.cssfullscreen&&s.exitCssFullscreen()):s.fullscreen&&(i(),r=(t=h(s))._fullScreenOffset,t.config.needFullscreenScroll?(window.scrollTo(r.left,r.top),m.setTimeout(h(s),function(){s.fullscreen=!1,s._fullScreenOffset=null},100)):(s.config.closeFocusVideoFocus||s.media.focus(),s.fullscreen=!1,s._fullScreenOffset=null),s.cssfullscreen?s.removeClass(A.FULLSCREEN):s.recoverFullStyle(s.root,s._fullscreenEl,A.FULLSCREEN),s._fullscreenEl=null,s.emit(b,!1))}),u(h(s),"_onWebkitbeginfullscreen",function(e){s._fullscreenEl=s.media,s.onFullscreenChange(e,!0)}),u(h(s),"_onWebkitendfullscreen",function(e){s.onFullscreenChange(e,!1)}),at(h(s),It),s.config=e,s._pluginInfoId=m.generateSessionId(),(e=h(s)).logInfo=d.logInfo.bind(e),e.logWarn=d.logWarn.bind(e),e.logError=d.logError.bind(e),s.constructor.defaultPreset);return s.config.presets.length?0<=(t=s.config.presets.indexOf("default"))&&e&&(s.config.presets[t]=e):e&&s.config.presets.push(e),s.userTimer=null,s.waitTimer=null,s._state=1,s.isError=!1,s._hasStart=!1,s.isSeeking=!1,s.isCanplay=!1,s._useAutoplay=!1,s.rotateDeg=0,s.isActive=!1,s.fullscreen=!1,s.cssfullscreen=!1,s.isRotateFullscreen=!1,s._fullscreenEl=null,s.timeSegments=[],s._cssfullscreenEl=null,s.curDefinition=null,s._orgCss="",s._fullScreenOffset=null,s._videoHeight=0,s._videoWidth=0,s.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},s.sizeInfo={width:0,height:0,left:0,top:0},s._accPlayed={t:0,acc:0,loopAcc:0},s._offsetInfo={currentTime:-1,duration:0}
1,s.innerContainer=null,s.controls=null,s.topBar=null,s.root=null,s.__i18n=Pt.init(s._pluginInfoId),y.os.isAndroid&&0<y.osVersion&&y.osVersion<6&&(s.config.autoplay=!1),s.database=new Ye,s.isUserActive=!1,s._onceSeekCanplay=null,s._isPauseBeforeSeek=0,s.innerStates={isActiveLocked:!1},s._initDOM()?(e=(t=s.config).definition,i=void 0===e?{}:e,!t.url&&i.list&&0<i.list.length&&((e=i.list.find(function(e){return e.definition&&e.definition===i.defaultDefinition}))||(i.defaultDefinition=i.list[0].definition,e=i.list[0]),s.config.url=e.url,s.curDefinition=e),s._bindEvents(),s._registerPresets(),s._registerPlugins(),D.onPluginsReady(h(s)),s.getInitDefinition(),s.setState(2),m.setTimeout(h(s),function(){s.emit(be)},0),s.onReady&&s.onReady(),(s.config.videoInit||s.config.autoplay)&&(!s.hasStart||s.state<4)&&s.start(),s):(console.error(new Error("can't find the dom which id is ".concat(s.config.id," or this.config.el does not exist"))),F(s))}function I(){return(new Date).getTime()}u(jt,"defaultPreset",null),u(jt,"XgVideoProxy",null);var Mt,Nt="waitingStart",Bt=(t(Ft,E),Mt=i(Ft),e(Ft,[{key:"afterCreate",value:function(){var n=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=I(),this.loadedCostTime=0,this.startCostTime=0,this.on(ve,function(){var e=n._state,t=e.autoplayStart,i=e.isFFSend;n.startCostTime=I()-n.newPointTime,d.logInfo("[xgLogger]".concat(n.player.playerId," LOAD_START"),"autoplayStart:".concat(t," isFFSend:").concat(i," startCostTime:").concat(n.startCostTime," newPointTime").concat(n.newPointTime)),i||(e.isLs||n.emitLog("loadstart",{}),e.isLs=!0,e.isTimeUpdate=!1,e.isFFLoading=!0,n.pt=I(),n.vt=0,n.fvt=0,n._initOnceEvents(),n._onWaitingLoadStart())}),this.on(k,function(){n.vt=I(),n.fvt=n.vt-n.pt,n.loadedCostTime=n.vt-n.newPointTime;var e=n._state,t=e.isTimeUpdate,i=e.isFFSend,e=e.autoplayStart;d.logInfo("[xgLogger]".concat(n.player.playerId," LOADED_DATA"),"fvt:".concat(n.fvt," isTimeUpdate:").concat(n._state.isTimeUpdate," loadedCostTime:").concat(n.loadedCostTime)),(t||e)&&n._sendFF("loadedData"),i||n.emitLog("loadeddata",{}),n.suspendWaitingStatus("loadeddata")}),this.on(de,this._onSeeking),this.on(v,this._onSeeked),this.on(Ce,function(){n.endState("destroy")}),this.on(De,function(){n.endState("urlChange"),d.logInfo("[xgLogger]".concat(n.player.playerId," URL_CHANGE")),n._state.isFFSend&&n._onReset()}),this.on([ue,_],this._onPlaying),this.on(fe,this._onWaiting),this.on(he,this._onError),this.on(Ue,function(){d.logInfo("[xgLogger]".concat(n.player.playerId," RESET")),n.endState("reset"),n._initOnceEvents(),n._onReset()})}},{key:"_initOnceEvents",value:function(){this.off(xe,this._onAutoplayStart),this.off(s,this._onTimeupdate),this.once(xe,this._onAutoplayStart),this.once(s,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=I();var t=this._state,i=t.isFFLoading,t=t.isFFSend;d.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(i," !isFFSend:").concat(!t)),0<this.vt&&i&&!t&&(d.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog("firstFrame",{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&m.clearTimeout(this,this._waittTimer),this._waittTimer=m.setTimeout(this,function(){e.suspendWaitingStatus("timeout"),m.clearTimeout(e,e._waittTimer),e._waittTimer=null},this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){var t,i;this.seekingStart&&(i=(t=I())-this.seekingStart,this.seekingStart=0,this.emitLog("seekEnd",{end:t,costTime:i,endType:e}))}},{key:"suspendWaitingStatus",value:function(e){var t,i,n;this._waitTimer&&(m.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(m.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,this.waitingStart&&(t=(i=I())-this.waitingStart,i=i-this.fixedWaitingStart,n=this.config.waitTimeout,this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog("waitingEnd",{fixedCostTime:n<i?n:i,costTime:n<t?n:t,type:"loadeddata"===e?1:this._waitType,endType:2===this._waitType?"seek":e}))}},{key:"emitLog",value:function(e,t){var i=this.player;
1this.emit("xglog",o({t:I(),host:m.getHostFromUrl(i.currentSrc),vtype:i.vtype,eventType:e,currentTime:this.player.currentTime,readyState:i.video.readyState,networkState:i.video.networkState},t))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),Ft);function Ft(){var e;p(this,Ft);for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return u(h(e=Mt.call.apply(Mt,[this].concat(i))),"_onTimeupdate",function(){e._state.isTimeUpdate=!0,e._state.autoplayStart&&(d.logInfo("[xgLogger]".concat(e.player.playerId," _onTimeupdate")),e._sendFF("onTimeupdate"))}),u(h(e),"_onAutoplayStart",function(){d.logInfo("[xgLogger]".concat(e.player.playerId," _onAutoplayStart")),e._state.autoplayStart=!0,e.vt&&e._sendFF("onAutoplayStart")}),u(h(e),"_onReset",function(){e._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},e.vt=0,e.pt=0,e.fvt=0,e.newPointTime=I(),e.loadedCostTime=0,e.startCostTime=0,e._isSeeking=!1,e.seekingStart=0,e.waitingStart=0,e.fixedWaitingStart=0,e._isWaiting=!1,e._waitTimer&&m.clearTimeout(h(e),e._waitTimer),e._waittTimer&&m.clearTimeout(h(e),e._waittTimer),e._waitTimer=null,e._waittTimer=null,e._waitType=0}),u(h(e),"_onSeeking",function(){e.seekingStart||(e.suspendWaitingStatus("seek"),e.seekingStart=I(),e.emitLog("seekStart",{start:I()}))}),u(h(e),"_onSeeked",function(){e.suspendSeekingStatus("seeked")}),u(h(e),"_onWaitingLoadStart",function(){e._isWaiting||e.vt||(e._isWaiting=!0,e.waitingStart=I(),e.fixedWaitingStart=I(),e._waitType=1,e.emitLog(Nt,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:1,endType:"loadstart"}))}),u(h(e),"_onWaiting",function(){!e._isWaiting&&e.vt&&(e._isWaiting=!0,e.vt?e.seekingStart?e._waitType=2:e._waitType=0:e._waitType=1,e.fixedWaitingStart=I(),e._waitTimer=m.setTimeout(h(e),function(){e._isWaiting&&(e.waitingStart=I(),m.clearTimeout(h(e),e._waitTimer),e._waitTimer=null,e._startWaitTimeout(),e.emitLog(Nt,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:e._waitType,endType:2===e._waitType?"seek":"playing"}))},200))}),u(h(e),"_onError",function(){e.suspendSeekingStatus("error"),e.suspendWaitingStatus("error")}),u(h(e),"_onPlaying",function(){e._isWaiting&&e.suspendWaitingStatus("playing")}),e}function Ut(){return(new DOMParser).parseFromString('<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">\n  <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>\n</svg>\n',"image/svg+xml").firstChild}t(Wt,E),Vt=i(Wt),e(Wt,[{key:"registerIcons",value:function(){return{replay:Ut}}},{key:"afterCreate",value:function(){var i=this;E.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",function(){i.player.replay()},{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(le,function(){if(i.playerConfig.loop||m.addClass(i.player.root,"replay"),!i.config.disable){i.show();var e=i.root.querySelector("path");if(e){var t=window.getComputedStyle(e).getPropertyValue("transform");if("string"==typeof t&&-1<t.indexOf("none"))return null;e.setAttribute("transform",t)}}}),this.on(r,function(){i.hide()})}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),m.removeClass(this.player.root,"replay")}},{key:"show",value:function(){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return'<xg-replay class="xgplayer-replay">\n      <xg-replay-txt class="xgplayer-replay-txt" lang-key="'.concat(this.i18nKeys.REPLAY,'">').concat(this.i18n.REPLAY,"</xg-replay-txt>\n    </xg-replay>")}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]);var Ht,Vt,Gt=Wt,zt=(t(qt,E),Ht=i(qt),e(qt,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){m.addClass(this.root,"hide")}},{key:"show",value:function(){m.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(le,function(){e.isEndedShow&&m.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(s,function(){e.onTimeUpdate()}),this.on(De,function(){m.removeClass(e.root,"hide"),m.addClass(e.root,"xg-showplay"),e.once(s,function(){e.onTimeUpdate()})})):this.on(r,function(){m.addClass(e.root,"hide")})}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?m.removeClass(this.root,"xg-showplay"):this.once(s,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"render",value:function(){var e=this.config,t=e.poster,e=e.hideCanplay,t=t?"background-image:url(".concat(t,");"):"";return'<xg-poster class="xgplayer-poster '.concat(e?"xg-showplay":"",'" style="').concat(t,'">\n    </xg-poster>')}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,poster:""}}}]),qt);
1function qt(){return p(this,qt),Ht.apply(this,arguments)}function Wt(){return p(this,Wt),Vt.apply(this,arguments)}function Kt(){return(new DOMParser).parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n',"image/svg+xml").firstChild}function Yt(){return(new DOMParser).parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n',"image/svg+xml").firstChild}var O={};function Xt(e){e?window.clearTimeout(e):Object.keys(O).map(function(e){window.clearTimeout(O[e].id),delete O[e]})}t(ti,E),Zt=i(ti),e(ti,[{key:"afterCreate",value:function(){var i=this,e=this.player,t=this.playerConfig;this.initIcons(),this.once(be,function(){t&&(t.lang&&"en"===t.lang?m.addClass(e.root,"lang-is-en"):"jp"===t.lang&&m.addClass(e.root,"lang-is-jp"))}),this.on(xe,this.onAutoplayStart),t.autoplay||this.show(),this.on(we,function(){var e="auto"===i.config.mode?"auto-hide":"hide";i.setAttr("data-state","play"),m.removeClass(i.root,e),i.show()}),this.on(r,function(){i.onPlayPause("play")}),this.on(ce,function(){i.onPlayPause("pause")}),this.on(Ue,function(){i.onPlayerReset()}),this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(e){e.cancelable&&e.preventDefault(),e.stopPropagation();var t=i.player.paused;i.emitUserAction(e,"switch_play_pause",{props:"paused",from:t,to:!t})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:Kt,class:"xg-icon-play"},startPause:{icon:Yt,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){m.addClass(this.root,"hide")}},{key:"show",value:function(){m.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){m.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){m.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var t=this;this._animateId=function(e,t,i){var n=2<arguments.length&&void 0!==i?i:{start:null,end:null};return O[e]&&window.clearTimeout(O[e].id),O[e]={},n.start&&n.start(),O[e].id=window.setTimeout(function(){n.end&&n.end(),window.clearTimeout(O[e].id),delete O[e]},400),O[e].id}("pauseplay",400,{start:function(){m.addClass(t.root,"interact"),t.show(),t.switchStatus(!0)},end:function(){m.removeClass(t.root,"interact"),e||t.hide(),t._animateId=null}})}},{key:"endAnimate",value:function(){m.removeClass(this.root,"interact"),Xt(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var t=this.player;e.cancelable&&e.preventDefault(),e.stopPropagation(),t.state<2||(this.player.paused||6!==t.state?t.play():t.pause())}},{key:"onPlayPause",value:function(e){var t=this.config,i=this.player;!i||i.state<6||!this.autoPlayStart||("show"===t.mode?(this.switchStatus(),this.show()):"auto"!==t.mode?t.isShowPause&&i.paused&&!i.ended||t.isShowEnd&&i.ended?(this.switchStatus(),this.show(),this.endAnimate()):t.disableAnimate?(this.switchStatus(),this.hide()):"play"===e?this.autoPlayStart?this.animate():this.hide():this.autoPlayStart&&!i.ended&&this.animate():this.switchStatus())}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),Xt(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?"auto"===this.config.mode?"auto-hide":"hide":"";return'\n    <xg-start class="xgplayer-start '.concat(e,'">\n    <xg-start-inner></xg-start-inner>\n    </xg-start>')}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]);var Qt,Zt,Jt=ti,$t=(t(ei,E),Qt=i(ei),e(ei,[{key:"render",value:function(){var e=this.config.innerHtml,t=m.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)t.appendChild(e);else if(e&&"string"==typeof e)t.innerHTML=e;else{for(var i="",n=1;n<=12;n++)i+='<div class="xgplayer-enter-bar'.concat(n,'"></div>');t.innerHTML='<div class="xgplayer-enter-spinner">'.concat(i,"</div>")}return t}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),ei);function ei(){return p(this,ei),Qt.apply(this,arguments)}function ti(e){var t;return p(this,ti),u(h(t=Zt.call(this,e)),"onPlayerReset",function(){t.autoPlayStart=!1;var e="auto"===t.config.mode?"auto-hide":"hide";t.setAttr("data-state","play"),m.removeClass(t.root,e),t.show()}),u(h(t),"onAutoplayStart",function(){var e;t.autoPlayStart||(e="auto"===t.config.mode?"auto-hide":"hide",m.addClass(t.root,e),t.autoPlayStart=!0,t.onPlayPause("play"))}),t.autoPlayStart=!1,t}function ii(e,t,i){try{return' <div class="xg-tips '.concat(i?"hide":" ",'" lang-key="').concat(e.i18nKeys[t],'">\n    ').concat(e.i18n[t],"\n    </div>")}catch(e){return'<div class="xg-tips hide"></div>'}}t(si,E),ni=i(si),e(si,[{key:"afterCreate",value:function(){this.getMini=this.getMini.bind(this),this.exitMini=this.exitMini.bind(this),this.bind("click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e="MINISCREEN";return'\n      <xg-icon class="xgplayer-miniicon">\n      <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[e],'">
1').concat(this.i18n[e],"</span></div>\n      </xg-icon>")}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:10}}}]);var ni,ri=si;function si(){return p(this,si),ni.apply(this,arguments)}function ai(e){var t=parseFloat(e);return-1===e.indexOf("%")&&!Number.isNaN(t)&&t}var oi=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],ui=oi.length;function li(e){if((e="string"==typeof e?document.querySelector(e):e)&&"object"===g(e)&&e.nodeType){s=e;var t=window.getComputedStyle(s);if("none"===t.display){for(var i={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},n=0;n<ui;n++)i[oi[n]]=0;return i}var r={};r.width=e.offsetWidth,r.height=e.offsetHeight;for(var s=r.isBorderBox="border-box"===t.boxSizing,a=0;a<ui;a++){var o=oi[a],u=t[o],u=parseFloat(u);r[o]=Number.isNaN(u)?0:u}var e=r.paddingLeft+r.paddingRight,l=r.paddingTop+r.paddingBottom,c=r.marginLeft+r.marginRight,h=r.marginTop+r.marginBottom,d=r.borderLeftWidth+r.borderRightWidth,f=r.borderTopWidth+r.borderBottomWidth,p=ai(t.width),p=(!1!==p&&(r.width=p+(s?0:e+d)),ai(t.height));return!1!==p&&(r.height=p+(s?0:l+f)),r.innerWidth=r.width-(e+d),r.innerHeight=r.height-(l+f),r.outerWidth=r.width+c,r.outerHeight=r.height+h,r}var s}function ci(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n.identifier===t)return n}}var hi,di,fi,pi={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},gi=(t(Ti,Y),fi=i(Ti),e(Ti,[{key:"_bindStartEvent",value:function(){var t=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),pi[this._startKey].map(function(e){t["on".concat(e)]=t["on".concat(e)].bind(t)})}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var t=this;e&&((e=pi[this._startKey]).map(function(e){window.addEventListener(e,t["on".concat(e)])}),this._boundPointerEvents=e)}},{key:"_unbindPostStartEvents",value:function(){var t=this;this._boundPointerEvents&&(this._boundPointerEvents.map(function(e){window.removeEventListener(e,t["on".concat(e)])}),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame(function(){e.animate()}))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var t=e.changedTouches[0];this.dragStart(e,t),this.touchIdentifier=void 0!==t.pointerId?t.pointerId:t.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var t=ci(e.changedTouches,this.touchIdentifier);t&&this.dragMove(e,t)}},{key:"ontouchend",value:function(e){var t=ci(e.changedTouches,this.touchIdentifier);t&&this.dragEnd(e,t),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var t=ci(e.changedTouches,this.touchIdentifier);t&&this.dragCancel(e,t)}},{key:"dragStart",value:function(e,t){this._root&&!this.isDown&&this.isEnabled&&(this.downPoint=t,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition(),t=li(this._root),this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-t.height,this.startPos.maxX=window.innerWidth-t.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e))}},{key:"dragRealStart",value:function(e,t){this.isDragging=!0,this.animate(),this.emit
1("dragStart",this.startPos)}},{key:"dragEnd",value:function(e,t){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit("dragEnded")),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,t){var i={x:t.pageX-this.downPoint.pageX,y:t.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(i)&&this.dragRealStart(e,t),i}},{key:"dragMove",value:function(e,t){var i,n;e=e||window.event,this.isDown&&(i=(n=this.startPos).x,n=n.y,t=(e=this._dragPointerMove(e,t)).x,e=e.y,t=this.checkContain("x",t,i),e=this.checkContain("y",e,n),this.position.x=i+t,this.position.y=n+e,this.dragPoint.x=t,this.dragPoint.y=e,this.emit("dragMove",this.position))}},{key:"dragCancel",value:function(e,t){this.dragEnd(e,t)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return 3<Math.abs(e.x)||3<Math.abs(e.y)}},{key:"checkContain",value:function(e,t,i){return t+i<0?0-i:"x"===e&&t+i>this.startPos.maxX?this.startPos.maxX-i:"y"===e&&t+i>this.startPos.maxY?this.startPos.maxY-i:t}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),t=this._getPositionCoord(e.left,"width"),i=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(t)?0:t,this.position.y=Number.isNaN(i)?0:i,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var t,i,e=e.transform;0===e.indexOf("matrix")&&(i=e.split(","),e=0===e.indexOf("matrix3d")?12:4,t=parseInt(i[e],10),i=parseInt(i[1+e],10),this.position.x+=t,this.position.y+=i)}},{key:"_getPositionCoord",value:function(e,t){var i;return-1!==e.indexOf("%")?(i=li(this._root.parentNode))?parseFloat(e)/100*i[t]:0:parseInt(e,10)}}]),Ti),mi=(t(wi,E),di=i(wi),e(wi,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.mini&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(ce,function(){e.setAttr("data-state","pause")}),this.on(r,function(){e.setAttr("data-state","play")})}},{key:"onPluginsReady",value:function(){var e=this,t=this.player;this.config.disable||(this.config.isShowIcon&&t.controls.registerPlugin(ri,{config:{onClick:function(){e.getMini()}}},ri.pluginName),t=m.checkTouchSupport()?"touchend":"click",this.bind(".mini-cancel-btn",t,this.onCancelClick),this.bind(".play-icon",t,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new gi(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll))}},{key:"registerIcons",value:function(){return{play:{icon:Kt,class:"xg-icon-play"},pause:{icon:Yt,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e,t,i,n=this;this.isMini||(e=this.player,t=this.playerConfig,i=this.config.target||this.player.root,this.lastStyle={},m.addClass(e.root,"xgplayer-mini"),["width","height","top","left"].map(function(e){n.lastStyle[e]=i.style[e],i.style[e]="".concat(n.pos[e],"px")}),t.fluid&&(i.style["padding-top"]=""),this.emit(Pe,!0),e.isMini=this.isMini=!0)}},{key:"exitMini",value:function(){var t=this;if(!this.isMini)return!1;var e=this.player,i=this.playerConfig,n=this.config.target||this.player.root;m.removeClass(e.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map(function(e){n.style[e]=t.lastStyle[e]}),this.lastStyle=null,i.fluid&&(e.root.style.width="100%",e.root.style.height="0",e.root.style["padding-top"]="".concat(100*i.height/i.width,"%")),this.emit(Pe,!1),this.isMini=e.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=m.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return'\n      <xg-mini-layer class="xg-mini-layer">\n      <xg-mini-header class="xgplayer-mini-header">\n      '.concat(ii(this,"MINI_DRAG",this.playerConfig.isHideTips),'\n      </xg-mini-header>\n      <div class="mini-cancel-btn">\n        <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">\n          <path fill="#fff" fill-rule="evenodd" d="M3.99 3.49a1 1 0 0 1 1.414 0L10 8.085l4.596-4.595a1 1 0 1 1 1.414 1.414L11.414 9.5l4.596 4.596a1 1 0 0 1 .084 
11.32l-.084.094a1 1 0 0 1-1.414 0L10 10.914 5.404 15.51a1 1 0 0 1-1.414-1.414L8.585 9.5 3.99 4.904a1 1 0 0 1-.084-1.32z"></path>\n        </svg>\n      </div>\n      <div class="play-icon">\n      </div>\n      </xg-mini-layer>')}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),wi),yi={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},vi=["videoClick","videoDbClick"],_i=(t(xi,lt),hi=i(xi),e(xi,[{key:"afterCreate",value:function(){var t=this;this._clickCount=0,vi.map(function(e){t.__hooks[e]=null}),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===y.device&&!y.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var t=this,e=this.player,i=e.video,n=e.root,e=this.playerConfig.enableContextmenu;n&&n.addEventListener("click",this.onVideoClick,!1),n&&n.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(yi).map(function(e){n.addEventListener(e,t[yi[e]],!1)}),e&&i&&i.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var t=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:t.paused,to:!t.paused}),t.ended?t.duration!==1/0&&0<t.duration&&t.replay():t.paused?t.play():t.pause()}},{key:"onContextmenu",value:function(e){(e=e||window.event).preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var t=this,e=this.player,i=e.video,n=e.root;this.clickTimer&&clearTimeout(this.clickTimer),n.removeEventListener("click",this.onVideoClick,!1),n.removeEventListener("dblclick",this.onVideoDblClick,!1),i.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(yi).map(function(e){n.removeEventListener(e,t[yi[e]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),xi),ki="pressend",bi={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},Si={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function xi(){var r;p(this,xi);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(r=hi.call.apply(hi,[this].concat(t))),"onMouseMove",function(e){var t=h(r),i=t.player,t=t.playerConfig;i.isActive||(i.focus({autoHide:!t.closeDelayBlur}),t.closeFocusVideoFocus)||i.media.focus()}),u(h(r),"onMouseEnter",function(e){var t=h(r),i=t.playerConfig,t=t.player;i.closeFocusVideoFocus||t.media.focus(),i.closeDelayBlur?t.focus({autoHide:!1}):t.focus()}),u(h(r),"onMouseLeave",function(e){var t=r.playerConfig,i=t.closePlayerBlur,n=t.leavePlayerTime;i||t.closeDelayBlur||(n?r.player.focus({autoHide:!0,delay:n}):r.player.blur())}),u(h(r),"onVideoClick",function(e){var t=h(r),i=t.player,t=t.playerConfig;e.target&&t.closeVideoClick||e.target!==i.root&&e.target!==i.media&&e.target!==i.innerContainer&&e.target!==i.media.__canvas||(e.preventDefault(),t.closeVideoStopPropagation||e.stopPropagation(),r._clickCount++,r.clickTimer&&(clearTimeout(r.clickTimer),r.clickTimer=null),r.clickTimer=setTimeout(function(){r._clickCount&&(r._clickCount--,w(h(r),vi[0],function(e,t){r.switchPlayPause(t.e)},{e:e,paused:i.paused}),clearTimeout(r.clickTimer),r.clickTimer=null)},300))}),u(h(r),"onVideoDblClick",function(e){var t=h(r),i=t.player,t=t.playerConfig;t.closeVideoDblclick||!e.target||e.target!==i.media&&e.target!==i.media.__canvas||(!t.closeVideoClick&&r._clickCount<2?r._clickCount=0:(r._clickCount=0,r.clickTimer&&(clearTimeout(r.clickTimer),r.clickTimer=null),e.preventDefault(),e.stopPropagation(),w(h(r),vi[1],function(e,t){r.emitUserAction(t.e,"switch_fullscreen",{props:"fullscreen",from:i.fullscreen,to:!i.fullscreen}),i.fullscreen?i.exitFullscreen():i.getFullscreen()},{e:e,fullscreen:i.fullscreen})))}),r}function wi(e){p(this,wi),u(h(i=di.call(this,e)),"onCancelClick",function(e){i.exitMini(),i.isClose=!0}),u(h(i),"onCenterClick",function(e){var t=h(i).player;t.paused?t.play():t.pause()}),u(h(i),"onScroll",function(e){var t;!window.scrollY&&0!==window.scrollY||Math.abs(window.scrollY-i.pos.scrollY)<50||(t=parseInt(m.getCss(i.player.root,"height")),t+=i.config.scrollTop,i.pos.scrollY=window.scrollY,t+5<window.scrollY?i.isMini||i.isClose||i.getMini():window.scrollY<=t&&(i.isMini&&i.exitMini(),i.isClose=!1))}),i.isMini=!1,i.isClose=!1;var i,e=h(i).config;return i.pos={left:e.left<0?window.innerWidth-e.width-20:e.left,top:e.top<0?window.innerHeight-e.height-20:e.top,height:i.config.height,width:i.config.width,scrollY:window.scrollY||0},i.lastStyle=null,i}function Ti(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return p(this,Ti),(t=fi.call(this)).isEnabled=!0,t.isDragging=!1,t.isDown=!1,t.position={},t.downPoint={},t.dragPoint={x:0,y:0},t.startPos={x:0,y:0},t._root=e instanceof Element?e:document.querySelector(e),t._handlerDom=i.handle instanceof Element?i.handle:document.querySelector(i.handle),t._root&&t._handlerDom?(t._bindStartEvent(),t):F(t)}function Ei(e){return e&&0<e.length?e[e.length-1]:null}e(Di,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(e){var t=this,i=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout(function(){t.trigger("press",e),t._pos.press=!0,t.__clearPress()},i.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(e){var t=this,i=this.config;this.dbIntrvalId?(this.__clearDb(),this.trigger("doubleclick",e)):this.dbIntrvalId=setTimeout(function(){t.__clearDb(),t._pos.start||t._pos.press||t._pos.moving||t.trigger("click",e)},i.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(e,t){this.__handlers[e]||(this.__handlers[e]=[]),this.__handlers[e].push(t)}},{key:"off",value:function(e,t){if(this.__handlers[e]){for(var i=this.__handlers[e],n=-1,r=0;r<i.length;r++)if(i[r]===t){n=r;break}0<=n&&this.__handlers[e].splice(n,1)}}},{key:"trigger",value:function(t,i){this.__handlers[t]&&this.__handlers[t].map(function(e){try{e(i)}catch(e){console.error("trigger>>:".concat(t),e)}})}},{key:"destroy",value:function(){var t=this,i={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};
1Object.keys(i).forEach(function(e){t.root.removeEventListener(e,t[i[e]])})}}]);var Ci=Di;function Di(e){var s=this,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};p(this,Di),u(this,"onTouchStart",function(e){var t=s._pos,i=s.root,n=Ei(e.touches);t.x=n?parseInt(n.pageX,10):e.pageX,t.y=n?parseInt(n.pageX,10):e.pageX,t.start=!0,s.__setPress(e),i.addEventListener(s.events.end,s.onTouchEnd),i.addEventListener(s.events.cancel,s.onTouchCancel),i.addEventListener(s.events.move,s.onTouchMove),s.trigger("touchstart",e)}),u(this,"onTouchCancel",function(e){s.onTouchEnd(e)}),u(this,"onTouchEnd",function(e){var t=s._pos,i=s.root;s.__clearPress(),i.removeEventListener(s.events.cancel,s.onTouchCancel),i.removeEventListener(s.events.end,s.onTouchEnd),i.removeEventListener(s.events.move,s.onTouchMove),e.moving=t.moving,e.press=t.press,t.press&&s.trigger(ki,e),s.trigger("touchend",e),t.press||t.moving||s.__setDb(e),t.press=!1,t.start=!1,t.moving=!1}),u(this,"onTouchMove",function(e){var t=s._pos,i=s.config,n=Ei(e.touches),r=n?parseInt(n.pageX,10):e.pageX,n=n?parseInt(n.pageY,10):e.pageX,r=r-t.x;Math.abs(n-t.y)<i.miniStep&&Math.abs(r)<i.miniStep||(s.__clearPress(),t.press&&s.trigger(ki,e),t.press=!1,t.moving=!0,s.trigger("touchmove",e))}),this._pos={moving:!1,start:!1,x:0,y:0},this.config={pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0},Object.keys(t).map(function(e){s.config[e]=t[e]}),this.root=e,this.events="mouse"===t.eventType?Si:bi,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}function Ai(){return(new DOMParser).parseFromString('<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"\n  xmlns:xlink="http://www.w3.org/1999/xlink">\n  <path opacity="0.54"\n    d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"\n    fill="white" />\n  <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}var Li,Pi="auto",Ii=["videoClick","videoDbClick"],Oi=(t(Ri,E),Li=i(Ri),e(Ri,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"registerIcons",value:function(){return{seekTipIcon:{icon:Ai,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var i=this,e=(Ii.map(function(e){i.__hooks[e]=null}),this.playerConfig),t=this.config,n=this.player,e=(!0===e.closeVideoDblclick&&(t.closedbClick=!0),this.resetPos(),m.isUndefined(e.disableGesture)||(t.disableGesture=!!e.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=m.createDom("xg-mask","",{},"xgmask"),n.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail(),"mouse"===this.domEventType?"mouse":"touch"),r=(this.touch=new Ci(this.root,{eventType:e,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(e){e.preventDefault()}),n.root.addEventListener("touchmove",this.onRootTouchMove,!0),n.root.addEventListener("touchend",this.onRootTouchEnd,!0),this.on(pe,function(){var e=i.player,t=i.config;1e3*e.duration<t.moveDuration&&(t.moveDuration=1e3*e.duration)}),this.on([_,le],function(){var e=i.pos,t=e.time;!e.isStart&&0<t&&(i.pos.time=0)}),{touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"});Object.keys(r).map(function(t){i.touch.on(t,function(e){i[r[t]](e)})}),t.disableActive||(e=n.plugins.progress)&&(e.addCallBack("dragmove",function(e){i.activeSeekNote(e.currentTime,e.forward)}),e.addCallBack("dragend",function(){i.changeAction(Pi)}))}},{key:"registerThumbnail",value:function(){var e=this.player.plugins.thumbnail;e&&e.usable&&(this.thumbnail=e.createThumbnail(null,"mobile-thumbnail"),(e=this.find(".time-preview")).insertBefore(this.thumbnail,e.children[0]))}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle,t=e.playedColor,e=e.progressColor;t&&(this.find(".xg-curbar").style.backgroundColor=t,this.find(".xg-cur").style.color=t),e&&(this.find(".xg-bar").style.backgroundColor=e,this.find(".time-preview").style.color=e),this.config.disableTimeProgress&&m.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var t=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map(function(e){t.pos[e]=0})):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var t=this.player,e=(this.root.setAttribute("data-xg-action",e),t.plugins.start);e&&e.recover()}},{key:"getTouche",value:function(e){this.player.rotateDeg;e=e.touches&&0<e.touches.length?e.touches[e.touches.length-1]:e;return{pageX:e.pageX,pageY:e.pageY}}},{key:"checkScope",value:function(e,t,i,n,r){var s=r.width,a=-1;return e<0||s<e||(s=0===n?Math.abs(i):Math.abs(i/n),0<Math.abs(i)&&1.73<=s&&e>
1r.scopeM1&&e<r.scopeM2?a=0:(0===Math.abs(i)||s<=.57)&&(a=e<r.scopeL?1:e>r.scopeR?2:3)),a}},{key:"executeMove",value:function(e,t,i,n,r){switch(i){case 0:this.updateTime(e/n*this.config.scopeM);break;case 1:this.updateBrightness(t/r);break;case 2:y.os.isIos||this.updateVolume(t/r)}}},{key:"endLastMove",value:function(e){var t=this,i=this.pos,n=this.player,r=this.config,i=(i.time-this.timeOffset)/1e3;0===e&&(n.seek(Number(i).toFixed(1)),r.hideControlsEnd?n.blur():n.focus(),this.timer=setTimeout(function(){t.pos.time=0},500)),this.changeAction(Pi)}},{key:"checkIsRootTarget",value:function(e){var t=this.player.plugins||{};return(!t.progress||!t.progress.root.contains(e.target))&&(t.start&&t.start.root.contains(e.target)||t.controls&&t.controls.root.contains(e.target))}},{key:"sendUseAction",value:function(e){var t=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t,to:!t})}},{key:"clickHandler",value:function(e){var t=this.player,i=this.config,n=this.playerConfig;t.state<6?n.closeVideoClick||(this.sendUseAction(m.createEvent("click")),t.play()):!i.closedbClick||n.closeVideoClick?t.isActive?t.blur():t.focus():n.closeVideoClick||((t.isActive||i.focusVideoClick)&&(this.sendUseAction(m.createEvent("click")),this.switchPlayPause()),t.focus())}},{key:"dbClickHandler",value:function(e){var t=this.config,i=this.player;!t.closedbClick&&6<=i.state&&(this.sendUseAction(m.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var i=this,t=this.player;w(this,Ii[0],function(e,t){i.clickHandler(t.e)},{e:e,paused:t.paused})}},{key:"onDbClick",value:function(e){var i=this,t=this.player;w(this,Ii[1],function(e,t){i.dbClickHandler(t.e)},{e:e,paused:t.paused})}},{key:"onPress",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(t.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:n.playbackRate,to:i.pressRate}),n.playbackRate=i.pressRate,this.changeAction("playbackrate"))}},{key:"onPressEnd",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:n.playbackRate,to:t.rate}),n.playbackRate=t.rate,t.rate=1,this.changeAction(Pi))}},{key:"updateTime",value:function(e){var t=this.player,i=this.config,n=this.player.duration,r=(e=Number(e.toFixed(4)),parseInt(e*i.moveDuration,10)+this.timeOffset),r=(r+=this.pos.time)<0?0:1e3*n<r?1e3*n-200:r;t.getPlugin("time")&&t.getPlugin("time").updateTime(r/1e3),t.getPlugin("progress")&&t.getPlugin("progress").updatePercent(r/1e3/this.duration,!0),this.activeSeekNote(r/1e3,0<e),i.isTouchingSeek&&t.seek(Number((r-this.timeOffset)/1e3).toFixed(1)),this.pos.time=r}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.player,i=this.pos;e=parseInt(100*e,10),i.volume+=e,Math.abs(i.volume)<10||(e=parseInt(10*t.volume,10)-parseInt(i.volume/10,10),t.volume=(e=10<e?10:e<1?0:e)/10,i.volume=0)}},{key:"updateBrightness",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.pos,i=this.config,n=this.xgMask,e=(e=t.light+.8*e)>i.maxDarkness?i.maxDarkness:e<0?0:e;n&&(n.style.backgroundColor="rgba(0,0,0,".concat(e,")")),t.light=e}},{key:"activeSeekNote",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=this.player,n=this.config,r=!(this.duration!==1/0&&0<this.duration);!e||"number"!=typeof e||r||n.disableActive||(e<0?e=0:e>i.duration&&(e=i.duration-.2),this.changeAction("seeking"),(r=i.plugins.start)&&r.focusHide(),this.find(".xg-dur").innerHTML=m.format(this.duration),this.find(".xg-cur").innerHTML=m.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),t?m.removeClass(this.find(".xg-seek-show"),"xg-back"):m.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e))}},{key:"updateThumbnails",value:function(e){var t=this.player.plugins.thumbnail;t&&t.usable&&this.thumbnail&&t.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<4)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!1}},{key:"enableGesture",value:function(){this.config.disableGesture=!0}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0)}},{key:"render",value:function(){var e="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";
1return'\n     <xg-trigger class="trigger">\n     <div class="'.concat(e,'"></div>\n        <div class="time-preview">\n            <div class="xg-seek-show ').concat(this.config.disableSeekIcon?" hide-seek-icon":"",'">\n              <i class="xg-seek-icon"></i>\n              <span class="xg-cur">00:00</span>\n              <span>/</span>\n              <span class="xg-dur">00:00</span>\n            </div>\n              <div class="xg-bar xg-timebar">\n                <div class="xg-curbar"></div>\n              </div>\n        </div>\n        <div class="xg-playbackrate xg-top-note">\n            <span><i>').concat(this.config.pressRate,"X</i>").concat(this.i18n.FORWARD,"</span>\n        </div>\n     </xg-trigger>\n    ")}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:36e4,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),Ri);function Ri(e){var c;return p(this,Ri),u(h(c=Li.call(this,e)),"onTouchStart",function(e){var t=h(c),i=t.player,n=t.config,r=t.pos,t=t.playerConfig,e=c.getTouche(e);e&&!n.disableGesture&&0<c.duration&&!i.ended&&(r.isStart=!0,m.checkIsFunction(t.disableSwipeHandler)&&t.disableSwipeHandler(),c.find(".xg-dur").innerHTML=m.format(c.duration),t=c.root.getBoundingClientRect(),90===i.rotateDeg?(r.top=t.left,r.left=t.top,r.width=t.height,r.height=t.width):(r.top=t.top,r.left=t.left,r.width=t.width,r.height=t.height),t=parseInt(e.pageX-r.left,10),e=parseInt(e.pageY-r.top,10),r.x=90===i.rotateDeg?e:t,r.y=90===i.rotateDeg?t:e,r.scopeL=n.scopeL*r.width,r.scopeR=(1-n.scopeR)*r.width,r.scopeM1=r.width*(1-n.scopeM)/2,r.scopeM2=r.width-r.scopeM1)}),u(h(c),"onTouchMove",function(e){var t,i,n,r,s,a=c.getTouche(e),o=h(c),u=o.pos,l=o.config,o=o.player;a&&!l.disableGesture&&c.duration&&u.isStart&&(r=l.miniMoveStep,t=l.hideControlsActive,n=parseInt(a.pageX-u.left,10),a=parseInt(a.pageY-u.top,10),i=90===o.rotateDeg?a:n,n=90===o.rotateDeg?n:a,Math.abs(i-u.x)>r||Math.abs(n-u.y)>r)&&(a=i-u.x,r=n-u.y,-1===(s=u.scope)&&(0!==(s=c.checkScope(i,n,a,r,u))||(t?o.blur():o.focus({autoHide:!1}),u.time)||(u.time=parseInt(1e3*o.currentTime,10)+1e3*c.timeOffset),u.scope=s),-1===s||0<s&&!l.gestureY||0===s&&!l.gestureX||(e.cancelable&&e.preventDefault(),c.executeMove(a,r,s,u.width,u.height),u.x=i,u.y=n))}),u(h(c),"onTouchEnd",function(e){var t=h(c),i=t.player,n=t.pos,t=t.playerConfig;n.isStart&&(-1<n.scope&&e.cancelable&&e.preventDefault(),!(e=c.config).disableGesture&&e.gestureX?(c.endLastMove(n.scope),setTimeout(function(){i.getPlugin("progress")&&i.getPlugin("progress").resetSeekState()},10)):n.time=0,n.scope=-1,c.resetPos(),m.checkIsFunction(t.enableSwipeHandler)&&t.enableSwipeHandler(),c.changeAction(Pi))}),u(h(c),"onRootTouchMove",function(e){!c.config.disableGesture&&c.config.gestureX&&c.checkIsRootTarget(e)&&(e.stopPropagation(),c.pos.isStart?c.onTouchMove(e):c.onTouchStart(e))}),u(h(c),"onRootTouchEnd",function(e){c.pos.isStart&&c.checkIsRootTarget(e)&&(e.stopPropagation(),c.onTouchEnd(e))}),c.pos={isStart:!1,x:0,y:0,time:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1},c.timer=null,c}function ji(e){var t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||e.isContentEditable}t(Bi,lt),Mi=i(Bi),e(Bi,[{key:"mergekeyCodeMap",value:function(){var i=this,n=this.config.keyCodeMap;n&&Object.keys(n).map(function(t){i.keyCodeMap[t]?["keyCode","action","disable","pressAction","disablePress","isBodyTarget"].map(function(e){n[t][e]&&(i.keyCodeMap[t][e]=n[t][e])}):i.keyCodeMap[t]=n[t]})}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e="function"==typeof this.config.seekStep?this.config.seekStep(this.player):this.config.seekStep;e&&"number"==typeof e&&(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!1}
1,up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"checkIsVisible",value:function(){var e,t,i,n;return!(this.config.checkVisible&&(e=(i=this.player.root.getBoundingClientRect()).height,t=i.top,i=i.bottom,n=window.innerHeight,t<0&&t<0-.9*e||0<i&&.9*e<i-n))}},{key:"checkCode",value:function(t,i){var n=this,r=!1;return Object.keys(this.keyCodeMap).map(function(e){n.keyCodeMap[e]&&t===n.keyCodeMap[e].keyCode&&!n.keyCodeMap[e].disable&&(r=!i||!n.keyCodeMap[e].noBodyTarget)}),r}},{key:"downVolume",value:function(e){var t,i,n=this.player;n.volume<=0||(t=parseFloat((n.volume-.1).toFixed(1)),i={volume:{from:n.volume,to:t}},this.emitUserAction(e,"change_volume",{props:i}),n.volume=0<=t?t:0)}},{key:"upVolume",value:function(e){var t,i,n=this.player;1<=n.volume||(t=parseFloat((n.volume+.1).toFixed(1)),i={volume:{from:n.volume,to:t}},this.emitUserAction(e,"change_volume",{props:i}),n.volume=t<=1?t:1)}},{key:"seek",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.timeSegments,n=-1<n?n:i,t=t.offsetDuration||t.duration,s=e.repeat&&4<=this.seekStep?parseInt(this.seekStep/2,10):this.seekStep,s=(n+s<=t?n+=s:n=t,m.getCurrentTimeByOffset(n,r));this.emitUserAction(e,"seek",{props:{currentTime:{from:i,to:s}}}),this.player.currentTime=s}},{key:"seekBack",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,t=t.timeSegments,n=(-1<n?n:i)-(e.repeat?parseInt(this.seekStep/2,10):this.seekStep),i={currentTime:{from:i,to:n=m.getCurrentTimeByOffset(n=n<0?0:n,t)}};this.emitUserAction(e,"seek",{props:i}),this.player.currentTime=n}},{key:"changePlaybackRate",value:function(e){var t=this._keyState,i=this.config,n=this.player;0===t.playbackRate&&(t.playbackRate=n.playbackRate,n.playbackRate=i.playbackRate)}},{key:"playPause",value:function(e){var t=this.player;t&&(this.emitUserAction(e,"switch_play_pause"),t.paused?t.play():t.pause())}},{key:"exitFullscreen",value:function(e){var t=this.player,i=t.fullscreen,n=t.cssfullscreen;i&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:i,to:!i}),t.exitFullscreen()),n&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:n,to:!n}),t.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var t=this._keyState;if(e.repeat){t.isPress=!0;var i=Date.now();if(i-t.tt<200)return;t.tt=i}(i=e).preventDefault(),i.returnValue=!1,this.handleKeyCode(e.keyCode,e,t.isPress)}},{key:"handleKeyUp",value:function(e){var t=this._keyState;0<t.playbackRate&&(this.player.playbackRate=t.playbackRate,t.playbackRate=0),t.isKeyDown=!1,t.isPress=!1,t.tt=0}},{key:"handleKeyCode",value:function(e,t,i){for(var n=Object.keys(this.keyCodeMap),r=0;r<n.length;r++){var s=this.keyCodeMap[n[r]],a=s.action;if(s.keyCode===e){s.disable||i&&s.disablePress||("function"==typeof(s=i&&s.pressAction||a)?a(t,this.player,i):"string"==typeof s&&"function"==typeof this[s]&&this[s](t,this.player,i),this.emit(Be,o({key:n[r],target:t.target,isPress:i},this.keyCodeMap[n[r]])));break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!1,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!1}}}]);var Mi,Ni=Bi;function Bi(){var a;p(this,Bi);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(a=Mi.call.apply(Mi,[this].concat(t))),"onBodyKeyDown",function(e){var t,i,n,r,s;a.player&&(i=(t=e||window.event).keyCode,r=(n=h(a))._keyState,(s=a.config).disable||s.disableBodyTrigger||!n.player.isUserActive&&!s.isIgnoreUserActive||ji(t.target)||!a.checkIsVisible()||t.metaKey||t.altKey||t.ctrlKey?r.isBodyKeyDown=!1:(e.repeat||r.isKeyDown||((t.target===document.body||a.config.isGlobalTrigger&&!ji(t.target))&&a.checkCode(i,!0)&&(r.isBodyKeyDown=!0),document.addEventListener("keyup",a.onBodyKeyUp)),r.isBodyKeyDown&&a.handleKeyDown(t)))}),u(h(a),"onBodyKeyUp",function(e){a.player&&(document.removeEventListener("keyup",a.onBodyKeyUp),a.handleKeyUp(e))}),u(h(a),"onKeydown",function(e){if(a.player){var e=e||window.event,t=h(a)._keyState;if(!e.repeat){if(a.config.disable||a.config.disableRootTrigger||e.metaKey||e.altKey||e.ctrlKey)return;if(!a.player.isUserActive&&!a.config.isIgnoreUserActive)return;!e||37!==e.keyCode&&!a.checkCode(e.keyCode)||e.target!==a.player.root&&e.target!==a.player.video&&e.target!==a.player.controls.el||(t.isKeyDown=!0),a.player.root.addEventListener("keyup",a.onKeyup)}t.isKeyDown&&a.handleKeyDown(e)}}),u(h(a),"onKeyup",function(e){a.player&&(a.player.root.removeEventListener("keyup",a.onKeyup),a.handleKeyUp(e))}),a}function Fi(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewB
1ox="-5 -5 110 110">\n  <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>\n</svg>\n',"image/svg+xml").firstChild}t(en,E),Gi=i(en),e(en,[{key:"registerIcons",value:function(){return{loadingIcon:Fi}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return'\n    <xg-loading class="xgplayer-loading">\n      <xg-loading-inner></xg-loading-inner>\n    </xg-loading>'}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:T.ROOT}}}]);var Ui,Hi,Vi,Gi,zi=en,qi=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],Wi=(e($i,[{key:"updateDuration",value:function(e){var t=this,i=(this.duration=e,0),e=this.fragments;this.fragments=e.map(function(e){return e.start=parseInt(i,10),e.end=parseInt(i+e.percent*t.duration,10),e.duration=parseInt(e.percent*t.duration,10),i+=e.percent*t.duration,e})}},{key:"updateProgress",value:function(){var i,e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"played",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},r=this.progressList,s=this.fragments;r.length<1||(i=t.newIndex,e=t.curIndex,t=t.millisecond,i!==e&&r.map(function(e,t){t<i?e[n].style.width="100%":i<t&&(e[n].style.width=0)}),e=s[i],s=0===t?0:(t-e.start)/e.duration,r[i][n].style.width=s<0?0:"".concat(100*s,"%"))}},{key:"updateFocus",value:function(e){var t;!this.fragConfig.fragAutoFocus||this.fragments.length<2||(e?0<=(e=this.findIndex(1e3*e.currentTime,this.focusIndex))&&e!==this.focusIndex&&(-1<this.focusIndex&&this.unHightLight(this.focusIndex),this.setHightLight(e),t={index:e,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]},this.focusIndex=e,this._callBack)&&this._callBack(t):-1<this.focusIndex&&(this.unHightLight(this.focusIndex),e={index:-1,preIndex:this.focusIndex,fragment:null},this._callBack&&this._callBack(e),this.focusIndex=-1))}},{key:"update",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=1<arguments.length?arguments[1]:void 0;if(!this.duration||parseInt(1e3*t,10)!==this.duration){if(!t&&0!==t)return;this.updateDuration(parseInt(1e3*t,10))}var t=this.playedIndex,i=this.cachedIndex;if("Undefined"!==m.typeOf(e.played)){var n=this.findIndex(1e3*e.played,t);if(n<0)return;this.updateProgress("played",{newIndex:n,curIndex:t,millisecond:parseInt(1e3*e.played,10)}),this.playedIndex=n}"Undefined"===m.typeOf(e.cached)||(t=this.findIndex(1e3*e.cached,i))<0||(this.updateProgress("cached",{newIndex:t,curIndex:i,millisecond:parseInt(1e3*e.cached,10)}),this.cachedIndex=t)}},{key:"findIndex",value:function(e,t){var i=this.fragments;if(!i||0===i.length)return-1;if(1===i.length)return 0;if(!(-1<t&&t<i.length&&e>i[t].start&&e<i[t].end)){if(e>i[i.length-1].start)return i.length-1;for(var n=0;n<i.length;n++)if(e>i[n].start&&e<=i[n].end){t=n;break}}return t}},{key:"findHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)if(m.hasClass(e[t],this.fragConfig.fragFocusClass))return{dom:e[t],pos:e[t].getBoundingClientRect()}}},{key:"findFragment",value:function(e){var t=this.root.children;return e<0||e>=t.length?null:{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)m.removeClass(e[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(e){var t=this.root.children;if(e<t.length)return m.addClass(t[e],this.fragConfig.fragFocusClass),{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(t){var i=this;if(Object.keys(this.fragConfig).forEach(function(e){void 0!==t[e]&&(i.fragConfig[e]=t[e])}),t.fragments){if(this.fragments=0===t.fragments.length?[{percent:1}]:t.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var e=this.root.children;0<e.length;)this.root.removeChild(e[0]);this.render()}}},{key:"render",value:function(){var e,i,n,r=this,s=this.style.progressColor;return this.root||(this.root=m.createDom("xg-inners","",{},"progress-list")),this.fragments&&(e=this.fragConfig,i=e.fragClass,n=e.fragFocusClass,this.progressList=this.fragments.map(function(e){var t=m.createDom("xg-inner","",{style:(s?"background:".concat(s,"; flex: "):"flex: ").concat(e.percent)}
1,"".concat(e.isFocus?n:""," xgplayer-progress-inner ").concat(i));return r.root.appendChild(t),qi.forEach(function(e){t.appendChild(m.createDom(e.tag,"",{style:e.styleKey?"background: ".concat(r.style[e.styleKey],"; width:0;"):"width:0;"},e.className))}),{cached:t.children[0],played:t.children[1]}})),this.root}}]),$i),Ki={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},Yi=(t(Ji,E),Vi=i(Ji),e(Ji,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime;return 0<=t?t:e.currentTime+this.timeOffset}},{key:"changeState",value:function(){this.useable=!(0<arguments.length&&void 0!==arguments[0])||arguments[0]}},{key:"show",value:function(){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=o(o({fragments:e=e&&0!==e.length?e:[{percent:1}]},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}),{},{actionCallback:function(e){t.emitUserAction("fragment_focus","fragment_focus",e)}});this.innerList?this.innerList.reset(e):(this.innerList=new Wi(e),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map(function(e){t[e]=t.innerList[e].bind(t.innerList)}))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){var e,t,i=this;this.config.disable||this.playerConfig.isLive||(this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer"),t=(e=this.config).fragFocusClass,this._initInner(this.config.fragments,{fragFocusClass:t,fragAutoFocus:e.fragAutoFocus,fragClass:e.fragClass,style:this.playerConfig.commonStyle||{}}),"mobile"===y.device&&(this.config.isDragingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.on(pe,function(){i.onMouseLeave()}),this.on(s,function(){i.onTimeupdate()}),this.on(v,function(){i.onTimeupdate(),i.onCacheUpdate()}),this.on(ye,function(){i.onCacheUpdate()}),this.on(le,function(){i.onCacheUpdate(!0),i.onTimeupdate(!0),i._state.now=0}),this.on(_e,function(){i.onReset()}),this.on(Re,function(){i.onVideoResize()}),this.bindDomEvents(),this.initCustomStyle())}},{key:"setConfig",value:function(t){var i=this,n=null;Object.keys(t).forEach(function(e){i.config[e]=t[e],"fragments"===e&&(n=t[e])}),n&&this._initInner(n,t)}},{key:"initCustomStyle",value:function(){var t=(this.playerConfig||{}).commonStyle.sliderBtnStyle,i=this.progressBtn;t&&("string"==typeof t?i.style.boxShadow=t:"object"===g(t)&&Object.keys(t).map(function(e){i.style[e]=t[e]}))}},{key:"triggerCallbacks",value:function(e,i,n){0<this.__dragCallBacks.length&&this.__dragCallBacks.map(function(t){if(t&&t.handler&&t.type===e)try{t.handler(i,n)}catch(e){console.error("[XGPLAYER][triggerCallbacks] ".concat(t," error"),e)}})}},{key:"addCallBack",value:function(e,t){t&&"function"==typeof t&&this.__dragCallBacks.push({type:e,handler:t})}},{key:"removeCallBack",value:function(i,n){var e=this.__dragCallBacks,r=-1;e.map(function(e,t){e&&e.type===i&&e.handler===n&&(r=t)}),-1<r&&e.splice(r,1)}},{key:"unlock",value:function(){var e=this.player,t=this.pos;t.isEnter=!1,e.isMini||(this.unbind("mousemove",this.onMoveOnly),t.isDown?this.unbind("mouseleave",this.onMouseLeave):this.blur())}},{key:"bindDomEvents",value:function(){var e=this.player,t=e.controls,e=e.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),"touch"!==this.domEventType&&"compatible"!==this.domEventType||(this.root.addEventListener("touchstart",this.onMouseDown),t&&(t.root&&t.root.addEventListener("touchmove",m.stopPropagation),t.center)&&t.center.addEventListener("touchend",m.stopPropagation)),"mouse"!==this.domEventType&&"compatible"!==this.domEventType||(this.bind("mousedown",this.onMouseDown),"mobile"!==e.isMobileSimulateMode&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),m.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),m.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,t,i,n){var r=this.config,s=this.player;r.isCloseClickSeek&&0===n||(t=t=t>=s.duration?s.duration-r.endedDiff:Number(t).toFixed(1),this.updatePercent(i),this.updateTime(e),(1!==n||r.isDragingSeek&&"audio"!==s.config.mediaType)&&(this._state.now=t,this._state.direc=t>s.currentTime?0:1,s.seek(t)))}},{key:"computeTime",value:function(e,t){var i,n=this.player,r=this.root.getBoundingClientRect(),s=r.width,s=90===n.rotateDeg?(i=r.height,r.top):(i=s,r.left),r=t-s,t=(t=(r=i<r?i:r<0?0:r)/i)<0?0:1<t?1:t,a=parseInt(t*this.offsetDuration*1e3,10)/1e3;return{percent:t,currentTime:a,seekTime:m.getCurrentTimeByOffset(a,n.timeSegments),offset:r,width:i,left:s,e:e}}},{key:"updateTime",value:function(e){var t=this.player,i=this.duration,i=(i<e?e=i:e<0&&(e=0),t.plugins.time);i&&i.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,t){var i;this.isProgressMoving=!0,!this.config.disable&&(this.progressBtn.style.left="".concat(100*(e=1<e?1:e<0?0:e),"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration),i=this.player.plugins.miniprogress)&&i.update({played:e*this.offsetDuration},this.offsetDuration)}},{key:"onTimeupdate",value:function(e){var t=this.player,i=this._state,n=this.offsetDuration;if(!t.isSeeking&&!this.isProgressMoving){if(-1<i.now){t=parseInt(1e3*i.now,10)-parseInt(1e3*t.currentTime,10);if(0===i.direc&&300<t||1===i.direc&&-300<t)return void(i.now=-1);i.now=-1}t=this.currentTime,t=m.adjustTimeByDuration(t,n,e),i=(this.innerList.update({played:t},n),this.progressBtn.style.left="".concat(t/n*100,"%"),this.player.plugins.miniprogress);i&&i.update({played:t},n)}}},{key:"onCacheUpdate",value:function(e){var t=this.player,i=this.duration;t&&(t=t.bufferedPoint.end,t=m.adjustTimeByDuration(t,i,e),this.innerList.update({cached:t},i),e=this.player.plugins.miniprogress)&&e.update({cached:t},i)}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0);var e=this.player.plugins.miniprogress;e&&e.update({cached:0,played:0},0)}},{key:"destroy",value:function(){var e=this.player,t=e.controls,i=(this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null,this.domEventType);"touch"!==i&&"compatible"!==i||(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),t&&(t.root&&t.root.removeEventListener("touchmove",m.stopPropagation),t.center)&&t.center.removeEventListener("touchend",m.stopPropagation)),"mouse"!==i&&"compatible"!==i||(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){var e;if(!this.config.disable&&!this.playerConfig.isLive)return e=this.player.controls?this.player.controls.config.mode:"",'\n    <xg-progress class="xgplayer-progress '.concat("bottom"===e?"xgplayer-progress-bottom":"",'">\n      <xg-outer class="xgplayer-progress-outer">\n        <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n      </xg-outer>\n    </xg-progress>\n    ')}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_CENTER,index:0,disable:!1,isDragingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:Ki.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return Ki}}]),Ji),S=(t(Zi,E),Hi=i(Zi),e(Zi,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave)}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),Zi),Xi=(t(Qi,S),Ui=i(Qi),e(Qi,[{key:"afterCreate",value:function(){var e=this,t=(l(a(Qi.prototype),"afterCreate",this).call(this),this.player);this.config.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.on([ce,he,_e],function(){e.animate(t.paused)}),this.on(r,function(){e.animate(t.paused)}),this.animate(!0))}},{key:"registerIcons",value:function(){return{play:{icon:Kt,class:"xg-icon-play"},pause:{icon:Yt,class:"xg-icon-pause"}}}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player;return this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t.paused,to:!t.paused}),t.ended?t.replay():t.paused?(t.play(),this.animate(!1)):(t.pause(),this.animate(!0)),!1}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){var t,i;this.player&&(t=this.i18nKeys,i=this.find(".xg-tips"),e?(this.setAttr("data-state","pause"),i&&this.changeLangTextKey(i,t.PLAY_TIPS)):(this.setAttr("data-state","play"),i&&this.changeLangTextKey(i,t.PAUSE_TIPS)))}},{key:"destroy",value:function(){l(a(Qi.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-play">\n    <div class="xgplayer-icon">\n    </div>\n    '.concat(ii(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_LEFT,index:0,disable:!1}}}]),Qi);function Qi(){return p(this,Qi),Ui.apply(this,arguments)}function Zi(){var t;p(this,Zi);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return u(h(t=Hi.call.apply(Hi,[this].concat(i))),"_onMouseenter",function(e){t.emit("icon_mouseenter",{pluginName:t.pluginName})}),u(h(t),"_onMouseLeave",function(e){t.emit("icon_mouseleave",{pluginName:t.pluginName})}),t}function Ji(e){var o;return p(this,Ji),u(h(o=Vi.call(this,e)),"onMoveOnly",function(e,t){var i=h(o),n=i.pos,r=i.config,i=i.player;if(e){m.event(e);var s=m.getEventPos(e,i.zoom),i=90===i.rotateDeg?s.clientY:s.clientX;if(n.moving&&Math.abs(n.x-i)<r.miniMoveStep)return;n.moving=!0,n.x=i,t=o.computeTime(e,i)}o.triggerCallbacks("dragmove",t,e),o._updateInnerFocus(t)}),u(h(o),"onBodyClick",function(e){o.pos.isLocked&&(o.pos.isLocked=!1,e.preventDefault(),e.stopPropagation())}),u(h(o),"_mouseDownHandler",function(e,t){o._state.time=t.currentTime,o.updateWidth(t.currentTime,t.seekTime,t.percent,0),o._updateInnerFocus(t)}),u(h(o),"_mouseUpHandler",function(e,t){h(o).pos.moving&&o.updateWidth(t.currentTime,t.seekTime,t.percent,2)}),u(h(o),"_mouseMoveHandler",function(e,t){var i=h(o),n=i._state,r=i.pos,s=i.config,i=i.player;n.time<t.currentTime?t.forward=!0:t.forward=!1,n.time=t.currentTime,r.isDown&&!r.moving&&(r.moving=!0,s.isPauseMoving&&i.pause(),o.triggerCallbacks("dragstart",t,e),o.emitUserAction("drag","dragstart",t)),o.updateWidth(t.currentTime,t.seekTime,t.percent,1),o.triggerCallbacks("dragmove",t,e),o._updateInnerFocus(t)}),u(h(o),"onMouseDown",function(e){var t=h(o),i=t._state,n=t.player,r=t.pos,s=t.config,t=t.playerConfig,a=m.getEventPos(e,n.zoom),a=90===n.rotateDeg?a.clientY:a.clientX;if(!(n.isMini||s.closeMoveSeek||!t.allowSeekAfterEnded&&n.ended)){if(n.duration||n.isPlaying)return e.stopPropagation(),o.focus(),m.checkIsFunction(t.disableSwipeHandler)&&t.disableSwipeHandler(),m.checkIsFunction(s.onMoveStart)&&s.onMoveStart(),m.event(e),r.x=a,r.isDown=!0,r.moving=!1,i.prePlayTime=n.currentTime,n.focus({autoHide:!1}),o.isProgressMoving=!0,m.addClass(o.progressBtn,"active"),(t=o.computeTime(e,a)).prePlayTime=i.prePlayTime,o._mouseDownHandlerHook(e,t),"touchstart"===e.type?(o.root.addEventListener("touchmove",o.onMouseMove),o.root.addEventListener("touchend",o.onMouseUp)):(o.unbind("mousemove",o.onMoveOnly),document.addEventListener("mousemove",o.onMouseMove,!1),document.addEventListener("mouseup",o.onMouseUp,!1)),!0;n.play()}}),u(h(o),"onMouseUp",function(e){var t=h(o),i=t.player,n=t.config,r=t.pos,s=t.playerConfig,t=t._state,n=(e.stopPropagation(),e.preventDefault(),m.checkIsFunction(s.enableSwipeHandler)&&s.enableSwipeHandler(),m.checkIsFunction(n.onMoveEnd)&&n.onMoveEnd(),m.event(e),m.removeClass(o.progressBtn,"active"),o.computeTime(e,r.x));n.prePlayTime=t.prePlayTime,r.moving?(o.triggerCallbacks("dragend",n,e),o.emitUserAction("drag","dragend",n)):(o.triggerCallbacks("click",n,e),o.emitUserAction("click","click",n)),o._mouseUpHandlerHook(e,n),r.moving=!1,r.isDown=!1,r.x=0,r.y=0,r.isLocked=!0,t.prePlayTime=0,t.time=0,"touchend"===e.type?(o.root.removeEventListener("touchmove",o.onMouseMove),o.root.removeEventListener("touchend",o.onMouseUp),o.blur()
1):(document.removeEventListener("mousemove",o.onMouseMove,!1),document.removeEventListener("mouseup",o.onMouseUp,!1),r.isEnter?"mobile"!==s.isMobileSimulateMode&&o.bind("mousemove",o.onMoveOnly):o.onMouseLeave(e)),m.setTimeout(h(o),function(){o.resetSeekState()},10),i.focus()}),u(h(o),"onMouseMove",function(e){var t=h(o),i=t._state,n=t.pos,r=t.player,t=t.config,s=(m.checkTouchSupport()&&e.preventDefault(),m.event(e),m.getEventPos(e,r.zoom)),r=90===r.rotateDeg?s.clientY:s.clientX,s=Math.abs(n.x-r);n.moving&&s<t.miniMoveStep||!n.moving&&s<t.miniStartStep||(n.x=r,(s=o.computeTime(e,r)).prePlayTime=i.prePlayTime,o._mouseMoveHandlerHook(e,s))}),u(h(o),"onMouseOut",function(e){o.triggerCallbacks("mouseout",null,e)}),u(h(o),"onMouseOver",function(e){o.triggerCallbacks("mouseover",null,e)}),u(h(o),"onMouseEnter",function(e){var t=h(o),i=t.player,t=t.pos;t.isDown||t.isEnter||i.isMini||!i.config.allowSeekAfterEnded&&i.ended||(t.isEnter=!0,o.bind("mousemove",o.onMoveOnly),o.bind("mouseleave",o.onMouseLeave),m.event(e),t=m.getEventPos(e,i.zoom),i=90===i.rotateDeg?t.clientY:t.clientX,t=o.computeTime(e,i),o.triggerCallbacks("mouseenter",t,e),o.focus())}),u(h(o),"onMouseLeave",function(e){o.triggerCallbacks("mouseleave",null,e),o.unlock(),o._updateInnerFocus(null)}),u(h(o),"onVideoResize",function(){var e=o.pos,t=e.x;e.isEnter&&!e.isDown&&(e=o.computeTime(null,t),o.onMoveOnly(null,e))}),o.useable=!1,o.isProgressMoving=!1,o.__dragCallBacks=[],o._state={now:-1,direc:0,time:0,prePlayTime:-1},o._disableBlur=!1,o}function $i(e){p(this,$i),this.fragments=e.fragments||[],0===this.fragments.length&&this.fragments.push({percent:1}),this._callBack=e.actionCallback,this.fragConfig={fragFocusClass:e.fragFocusClass||"inner-focus-point",fragAutoFocus:!!e.fragAutoFocus,fragClass:e.fragClass||""},this.style=e.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}function en(){return p(this,en),Gi.apply(this,arguments)}function tn(){return(new DOMParser).parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n    </g>\n</svg>',"image/svg+xml").firstChild}t(sn,E),nn=i(sn),e(sn,[{key:"afterCreate",value:function(){var t=this;this.initIcons(),this.onClick=function(e){e.preventDefault(),e.stopPropagation(),t.config.onClick(e)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:tn,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){m.addClass(this.root,"show")}},{key:"hide",value:function(){m.removeClass(this.root,"show")}},{key:"render",value:function(){return'<xg-icon class="xgplayer-back">\n    </xg-icon>'}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:T.ROOT_TOP,index:0}}}]);var nn,rn=sn;function sn(){return p(this,sn),nn.apply(this,arguments)}function an(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n',"image/svg+xml").firstChild}function on(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n  <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n',"image/svg+xml").firstChild}t(mn,S),cn=i(mn),e(mn,[{key:"afterCreate",value:function(){var i=this,e=(l(a(mn.prototype),"afterCreate",this).call(this),this.config),t=this.playerConfig;e.disable||(e.target&&(this.playerConfig.fullscreenTarget=this.config.target),e=m.getFullScreenEl(),t.fullscreenTarget===e&&this.player.getFullscreen().catch(function(e){}),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(e){var t=i.player.fullscreen;i.emitUserAction(e,"switch_fullscreen",{prop:"fullscreen",from:t,to:!t})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(b,function(e){var t=i.find(".xg-tips");t&&i.changeLangTextKey(t,e?i.i18nKeys.EXITFULLSCREEN_TIPS:i.i18nKeys.FULLSCREEN_TIPS),i.animate(e)}
1),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:rn,options:{config:{onClick:function(e){i.handleFullscreen(e)}}}})),"mobile"===y.device&&window.addEventListener("orientationchange",this._onOrientationChange))}},{key:"registerIcons",value:function(){return{fullscreen:{icon:an,class:"xg-get-fullscreen"},exitFullscreen:{icon:on,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){l(a(mn.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===y.device?"touchend":"click",this.handleFullscreen),"mobile"===y.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e&&(e.preventDefault(),e.stopPropagation());var e=this.player,t=this.config;!0===t.useCssFullscreen||"function"==typeof t.useCssFullscreen&&t.useCssFullscreen()?(e.fullscreen?e.exitCssFullscreen():e.getCssFullscreen(),this.animate(e.fullscreen)):t.rotateFullscreen?(e.fullscreen?e.exitRotateFullscreen():e.getRotateFullscreen(),this.animate(e.fullscreen)):t.switchCallback&&"function"==typeof t.switchCallback?t.switchCallback(e.fullscreen):e.fullscreen?e.exitFullscreen():e.getFullscreen().catch(function(e){})}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"show",value:function(){l(a(mn.prototype),"show",this).call(this)}},{key:"hide",value:function(){l(a(mn.prototype),"hide",this).call(this)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-fullscreen">\n    <div class="xgplayer-icon">\n    </div>\n    '.concat(ii(this,"FULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]);var un,ln,cn,hn=mn,dn=(t(gn,E),ln=i(gn),e(gn,[{key:"duration",get:function(){var e=this.player,t=e.offsetDuration;return this.playerConfig.customDuration||t||e.duration}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime;return 0<=t?t:e.currentTime}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this,t=this.player.controls.config.mode;this.mode="flex"===t?"flex":"normal",this.config.disable||("flex"===this.mode&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.on([pe,v,s],function(){e.onTimeUpdate()}),this.on(le,function(){e.onTimeUpdate(!0)}),this.on(_e,function(){e.onReset()}))}},{key:"show",value:function(){"flex"===this.mode?(this.centerCurDom&&(this.centerCurDom.style.display="block"),this.centerDurDom&&(this.centerDurDom.style.display="block")):this.root.style.display="block"}},{key:"hide",value:function(){"flex"===this.mode?(this.centerCurDom&&(this.centerCurDom.style.display="none"),this.centerDurDom&&(this.centerDurDom.style.display="none")):this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var t=this.player,i=this.config,n=this.duration;i.disable||this.isActiving||!t.hasStart||(i=this.currentTime+this.timeOffset,i=m.adjustTimeByDuration(i,n,e),"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(m.format(i)),n!==1/0&&0<n&&(this.centerDurDom.innerHTML=m.format(n))):(this.timeDom.innerHTML=this.minWidthTime(m.format(i)),n!==1/0&&0<n&&(this.durationDom.innerHTML=m.format(n))))}},{key:"onReset",value:function(){"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(m.format(0)),this.centerDurDom.innerHTML=m.format(0)):(this.timeDom.innerHTML=this.minWidthTime(m.format(0)),this.durationDom.innerHTML=m.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;e.controls&&e.controls.center&&(e=e.controls.center,this.centerCurDom=m.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=m.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),0<e.children.length?e.insertBefore(this.centerCurDom,e.children[0]):e.appendChild(this.centerCurDom),e.appendChild(this.centerDurDom))}},{key:"afterPlayerInit",value:function(){var e=this.config;this.duration===1/0||this.playerConfig.isLive?(m.hide(this.durationDom),m.hide(this.timeDom),m.hide(this.find(".time-separator")),m.show(this.find(".time-live-tag"))):m.hide(this.find(".time-live-tag")),e.hide?this.hide():this.show()}},{key:"changeLiveState",value:function(e){e?(m.hide(this.durationDom),m.hide(this.timeDom),m.hide(this.find(".time-separator")),m.show(this.find(".time-live-tag"))):(m.hide(this.find(".time-live-tag")),m.show(this.find(".time-separator")),m.show(this.durationDom),m.show(this.timeDom))}},{key:"updateTime",value:function(e){this.isActiving=!0,!e&&0!==e||e>this.duration||("flex"!==this.mode?this.timeDom.innerHTML=this.minWidthTime(m.format(e)):this.centerCurDom.innerHTML=this.minWidthTime(m.format(e)))}},{key:"minWidthTime",value:function(e){return e.split(":").map(function(e){return'<span class="time-min-width">'.concat(e,"</span>")}).join(":")}},{key:"resetActive",value:function(){function e(){t.isActiving=!1}var t=this,i=this.player;this.off(v,e),i.isSeeking?this.once(v,e):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-time">\n    <span class="time-current">00:00</span>\n    <span class="time-separator">/</span>\n    <span class="time-duration">00:00</span>\n    <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP,"</span>\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_LEFT,index:2,disable:!1}}}]),gn),fn=(t(pn,lt),un=i(pn),e(pn,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(pe,this._onDurationChange),this.on(k,this._onLoadedData),this.on(s,this._onTimeupdate),this.on(de,this._onSeeking),this.on(r,this._onPlay)}},{key:"setConfig",value:function(t){var e,i=this;!t||(e=Object.keys(t)).length<1||(e.forEach(function(e){i.config[e]=t[e]}),this.updateSegments())}},{key:"updateSegments",value:function(){var e=this.config,t=e.disable,e=e.segments,i=this.player;t||!e||0===e.length?(i.timeSegments=[],i.offsetDuration=0,i.offsetCurrentTime=-1):(t=this.formatTimeSegments(e,i.duration),i.timeSegments=t,i.offsetDuration=0<t.length?t[t.length-1].duration:0)}},{key:"formatTimeSegments",value:function(e,r){var s=[];return e?(e.sort(function(e,t){return e.start-t.start}),e.forEach(function(e,t){var i,n={};n.start=e.start<0?0:e.start,n.end=0<r&&e.end>r?r:e.end,0<r&&r<n.start||(s.push(n),i=n.end-n.start,0===t?(n.offset=e.start,n.cTime=0,n.segDuration=i,n.duration=i):(n.offset=(e=s[t-1]).offset+(n.start-e.end),n.cTime=e.duration+e.cTime,n.segDuration=i,n.duration=e.duration+i))}),s):[]}},{key:"getSeekTime",value:function(e,t,i,n){var r=n[i],s=r.start;return!(s<=e&&e<=r.end)&&(r=e-t)<0&&e<s?0<=i-1?n[i-1].end+r+(s<t?t-s:0):0:-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,t){0<=(this.curIndex=e)&&0<t.length?this.curPos=t[e]:this.curPos=null}}
1],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),pn);function pn(){var s;p(this,pn);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(s=un.call.apply(un,[this].concat(t))),"_onDurationChange",function(){s.updateSegments();var e,t=s.player,i=t.currentTime,t=t.timeSegments;s._checkIfEnabled(t)&&(e=m.getIndexByTime(i,t),i=m.getOffsetCurrentTime(i,t,e),s.player.offsetCurrentTime=i,s.changeIndex(e,t))}),u(h(s),"_onLoadedData",function(){var e,t=s.player.timeSegments;s._checkIfEnabled(t)&&(e=m.getOffsetCurrentTime(0,t),s.player.offsetCurrentTime=e,s.changeIndex(0,t),0<s.curPos.start)&&(s.player.currentTime=s.curPos.start)}),u(h(s),"_onTimeupdate",function(){var e,t,i,n=s.player,r=n.currentTime,n=n.timeSegments;s._checkIfEnabled(n)&&(e=n.length,s.lastCurrentTime=r,(t=m.getIndexByTime(r,n))!==s.curIndex&&s.changeIndex(t,n),n=m.getOffsetCurrentTime(r,n,t),s.player.offsetCurrentTime=n,s.curPos)&&(i=(n=s.curPos).start,n=n.end,r<i?s.player.currentTime=i:n<r&&e-1<=t&&s.player.pause())}),u(h(s),"_onSeeking",function(){var e,t=s.player,i=t.currentTime,t=t.timeSegments;s._checkIfEnabled(t)&&(i<t[0].start?s.player.currentTime=t[0].start:i>t[t.length-1].end?s.player.currentTime=t[t.length-1].end:0<=(e=m.getIndexByTime(i,t))&&0<=(i=s.getSeekTime(i,s.lastCurrentTime,e,t))&&(s.player.currentTime=i))}),u(h(s),"_onPlay",function(){var e=s.player,t=e.currentTime,e=e.timeSegments;s._checkIfEnabled(e)&&t>=e[e.length-1].end&&(s.player.currentTime=e[0].start)}),s}function gn(e){return p(this,gn),(e=ln.call(this,e)).isActiving=!1,e}function mn(){var t;p(this,mn);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return u(h(t=cn.call.apply(cn,[this].concat(i))),"_onOrientationChange",function(e){t.player.fullscreen&&t.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?t.player.setRotateDeg(0):t.player.setRotateDeg(90))}),t}function yn(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function vn(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function _n(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n  <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>\n</svg>\n',"image/svg+xml").firstChild}t(Sn,E),kn=i(Sn),e(Sn,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:vn,class:"xg-volume-small"},volumeLarge:{icon:yn,class:"xg-volume"},volumeMuted:{icon:_n,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e,t,i=this;this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},this.config.disable||(this.initIcons(),e=(t=this.playerConfig).commonStyle,t=t.volume,e.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=e.volumeColor),this.changeMutedHandler=this.hook("mutedChange",function(e){i.changeMuted(e)},{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),"mobile"!==y.device&&"mobile"!==this.playerConfig.isMobileSimulateMode&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(ge,this.onVolumeChange),this.once(k,this.onVolumeChange),"
1Number"!==m.typeOf(t)&&(this.player.volume=this.config.default),this.onVolumeChange())}},{key:"updateVolumePos",value:function(e,t){var i=this.player,n=this.find(".xgplayer-drag"),r=this.find(".xgplayer-bar");r&&n&&(r=parseInt(e/r.getBoundingClientRect().height*1e3,10),n.style.height="".concat(e,"px"),n=Math.max(Math.min(r/1e3,1),0),e={volume:{from:i.volume,to:n}},i.muted&&(e.muted={from:!0,to:!1}),this.emitUserAction(t,"change_volume",{muted:i.muted,volume:i.volume,props:e}),i.volume=Math.max(Math.min(r/1e3,1),0),i.muted&&(i.muted=!1),this.config.showValueLabel)&&this.updateVolumeValue()}},{key:"updateVolumeValue",value:function(){var e=this.player,t=e.volume,e=e.muted,i=this.find(".xgplayer-value-label"),t=Math.max(Math.min(t,1),0);i.innerText=e?0:Math.ceil(100*t)}},{key:"focus",value:function(){this.player.focus({autoHide:!1}),this._timerId&&(m.clearTimeout(this,this._timerId),this._timerId=null),m.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:100,i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=2<arguments.length?arguments[2]:void 0,r=this._d,s=this.player;r.isActive||(this._timerId&&(m.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=m.setTimeout(this,function(){r.isActive||(i?s.blur():s.focus(),m.removeClass(e.root,"slide-show"),r.isStart&&e.onBarMouseUp(n)),e._timerId=null},t))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var t=this.player;this._d.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:t.muted,volume:t.volume,props:{muted:{from:t.muted,to:!t.muted}}}),0<t.volume&&(t.muted=!t.muted),t.volume<.01&&(t.volume=this.config.miniVolume)}},{key:"animate",value:function(e,t){e||0===t?this.setAttr("data-state","mute"):t<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(m.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon","mobile"===y.device?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){var e,t;if(!this.config.disable)return e=this.config.default||this.player.volume,t=this.config.showValueLabel,'\n    <xg-icon class="xgplayer-volume" data-state="normal">\n      <div class="xgplayer-icon">\n      </div>\n      <xg-slider class="xgplayer-slider">\n        '.concat(t?'<div class="xgplayer-value-label">'.concat(100*e,"</div>"):"",'\n        <div class="xgplayer-bar">\n          <xg-drag class="xgplayer-drag" style="height: ').concat(100*e,'%"></xg-drag>\n        </div>\n      </xg-slider>\n    </xg-icon>')}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]);var kn,bn=Sn;function Sn(){var r;p(this,Sn);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(r=kn.call.apply(kn,[this].concat(t))),"onBarMousedown",function(e){var t=h(r).player,i=r.find(".xgplayer-bar"),i=(m.event(e),i.getBoundingClientRect()),t=m.getEventPos(e,t.zoom),n=i.height-(t.clientY-i.top);if(t.h=n,t.barH=i.height,r.pos=t,!(n<-2))return r.updateVolumePos(n,e),document.addEventListener("mouseup",r.onBarMouseUp),!(r._d.isStart=!0)}),u(h(r),"onBarMouseMove",function(e){var t,i,n=h(r)._d;n.isStart&&(t=(i=h(r)).pos,i=i.player,e.preventDefault(),e.stopPropagation(),m.event(e),i=m.getEventPos(e,i.zoom),n.isMoving=!0,(n=t.h-i.clientY+t.clientY)>t.barH||r.updateVolumePos(n,e))}),u(h(r),"onBarMouseUp",function(e){m.event(e),document.removeEventListener("mouseup",r.onBarMouseUp);e=h(r)._d;e.isStart=!1,e.isMoving=!1}),u(h(r),"onMouseenter",function(e){r._d.isActive=!0,r.focus(),r.emit("icon_mouseenter",{pluginName:r.pluginName})}),u(h(r),"onMouseleave",function(e){r._d.isActive=!1,r.unFocus(100,!1,e),r.emit("icon_mouseleave",{pluginName:r.pluginName})}),u(h(r),"onVolumeChange",function(e){var t,i;r.player&&(t=(i=r.player).muted,i=i.volume,r._d.isMoving||(r.find(".xgplayer-drag").style.height=t||0===i?"4px":"".concat(100*i,"%"),r.config.showValueLabel&&r.updateVolumeValue()),r.animate(t,i))}),r}function xn(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">\n  <g clip-path="url(#clip0)">\n    <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>\n    <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 
10.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>\n  </g>\n  <defs>\n    <clipPath id="clip0">\n      <rect width="40" height="40" fill="white"/>\n    </clipPath>\n  </defs>\n</svg>\n',"image/svg+xml").firstChild}t(En,S),wn=i(En),e(En,[{key:"afterCreate",value:function(){var e,t=this;this.config.disable||(l(a(En.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(Re,function(){t.rotateDeg&&t.config.innerRotate&&m.setTimeout(t,function(){t.updateRotateDeg(t.rotateDeg,t.config.innerRotate)},100)}),e=this.player.root,this.rootWidth=e.style.width||e.offsetWidth||e.clientWidth,this.rootHeight=e.style.height||e.offsetHeight||e.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate))}},{key:"destroy",value:function(){l(a(En.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,t){var i,n,r,s,a,o,u,l,c,h,d,f;e=e||0,t?this.player.videoRotateDeg=e:(i=this.player,a=this.rootWidth,o=this.rootHeight,n=i.root,r=i.media,c=n.offsetWidth,s=((s=i.innerContainer)&&t?s:n).offsetHeight,a=a,o=o,l=u=0,.75!==e&&.25!==e||(a="".concat(s,"px"),o="".concat(c,"px"),u=-(s-c)/2,l=-(c-s)/2),c="translate(".concat(u,"px,").concat(l,"px) rotate(").concat(e,"turn)"),h={transformOrigin:"center center",transform:c,webKitTransform:c,height:o,width:a},d=t?r:n,f=t?i.getPlugin("poster"):null,Object.keys(h).map(function(e){d.style[e]=h[e],f&&f.root&&(f.root.style[e]=h[e])}))}},{key:"rotate",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=this.player,e=(this.rotateDeg||(this.rotateDeg=0),e?1:-1);this.rotateDeg=(this.rotateDeg+1+.25*e*i)%1,this.updateRotateDeg(this.rotateDeg,t),n.emit("rotate",360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:xn}}},{key:"render",value:function(){if(!this.config.disable)return'\n    <xg-icon class="xgplayer-rotate">\n      <div class="xgplayer-icon">\n      </div>\n      '.concat(ii(this,"ROTATE_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]);var wn,Tn=En;function En(e){return p(this,En),(e=wn.call(this,e)).rotateDeg=e.config.rotateDeg||0,e}function Cn(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n  <path fill-rule="evenodd" clip-rule="evenodd"\n    d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n    fill="white" />\n</svg>',"image/svg+xml").firstChild}function Dn(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n  <path fill-rule="evenodd" clip-rule="evenodd"\n    d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n    fill="white" />\n  <path fill-rule="evenodd" clip-rule="evenodd"\n    d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"\n    fill="white" />\n</svg>',"image/svg+xml").firstChild}var An,Ln="picture-in-picture",Pn="fullscreen",In=(t(R,S),An=i(R),e(R,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.pip&&
1(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(l(a(R.prototype),"afterCreate",this).call(this),this.pMode="inline",this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(Te,function(){e.config.showIcon&&(m.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))}))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:Cn,class:"xg-get-pip"},pipIconExit:{icon:Dn,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var i=this,n=this.player;this.leavePIPCallback=function(){var e=n.paused;m.setTimeout(i,function(){e||n.mediaPlay()},0),e||n.mediaPlay(),i.setAttr("data-state","normal"),n.emit(je,!1)},this.enterPIPCallback=function(e){n.emit(je,!0),i.pipWindow=e.pictureInPictureWindow,i.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(e){var t=n.media.webkitPresentationMode;i.pMode===Pn&&t!==Pn&&n.onFullscreenChange(null,!1),(i.pMode=t)===Ln?i.enterPIPCallback(e):"inline"===t&&i.leavePIPCallback(e)},n.media&&(n.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),n.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),R.checkWebkitSetPresentationMode(n.media))&&n.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged)}},{key:"requestPIP",value:function(){var e=this.player,t=this.playerConfig;if(this.isPIPAvailable()&&!this.isPip)try{var i=t.poster;return i&&(e.media.poster="String"===m.typeOf(i)?i:i.poster),R.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("picture-in-picture"):e.media.requestPictureInPicture(),!0}catch(e){return console.error("requestPiP",e),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{return this.isPIPAvailable()&&this.isPip&&(R.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture()),!0}catch(e){return console.error("exitPIP",e),!1}}},{key:"isPip",get:function(){var e=this.player;return document.pictureInPictureElement&&document.pictureInPictureElement===e.media||e.media.webkitPresentationMode===Ln}},{key:"isPIPAvailable",value:function(){var e=this.player.media;return("Boolean"!==m.typeOf(document.pictureInPictureEnabled)||document.pictureInPictureEnabled)&&("Boolean"===m.typeOf(e.disablePictureInPicture)&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&"Function"===m.typeOf(e.webkitSetPresentationMode))}},{key:"destroy",value:function(){l(a(R.prototype),"destroy",this).call(this);var e=this.player;e.media.removeEventListener("enterpictureinpicture",this.enterPIPCallback),e.media.removeEventListener("leavepictureinpicture",this.leavePIPCallback),R.checkWebkitSetPresentationMode(e.media)&&e.media.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.exitPIP(),this.unbind("click",this.btnClick)}},{key:"render",value:function(){if(this.config.showIcon&&this.isPIPAvailable())return'<xg-icon class="xgplayer-pip">\n      <div class="xgplayer-icon xg-icon-disable">\n      </div>\n      '.concat(ii(this,"PIP",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:6,showIcon:!1}}},{key:"checkWebkitSetPresentationMode",value:function(e){return"function"==typeof e.webkitSetPresentationMode}}]),R);function R(){var t;p(this,R);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return u(h(t=An.call.apply(An,[this].concat(i))),"switchPIP",function(e){if(!t.isPIPAvailable())return!1;e.stopPropagation&&e.stopPropagation(),t.isPip?(t.exitPIP(),t.emitUserAction(e,"change_pip",{props:"pip",from:!0,to:!1}),t.setAttr("data-state","normal")):4===t.player.media.readyState&&(t.requestPIP(),t.emitUserAction(e,"change_pip",{props:"pip",from:!1,to:!0}),t.setAttr("data-state","pip"))}),t}function On(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">\n  <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>\n</svg>\n',"image/svg+xml").firstChild}t(Mn,E),Rn=i(Mn),e(Mn,[{key:"afterCreate",value:function(){this.config.urlList&&0!==this.config.urlList.length&&(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:On}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e="mobile"===y.device?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var t=this.player;e&&(t.pause(),t.currentTime=0,t.switchURL?t.switchURL(e):t.src=e,t.config.url=e,t.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(this.config.urlList&&0!==this.config.urlList.length)return'\n     <xg-icon class="xgplayer-playnext">\n      <div class="xgplayer-icon">\n      </div>\n      '.concat(ii(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),"\n     </xg-icon>\n    ")}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]);var Rn,jn=Mn,Y={exports:{}};function Mn(e){var i;return p(this,Mn),u(h(i=Rn.call(this,e)),"playNext",function(e){var t=h(i).player;e.preventDefault(),e.stopPropagation(),i.idx+1<i.config.urlList.length?(i.idx++,i.nextHandler(i.config.urlList[i.idx],i.idx),t.emit(Ne,i.idx+1)):(i.nextHandler(),t.emit(Ne))}),i.idx=-1,i}Y.exports=function t(e,i,n){function r(e){return String(e)}var s,a=window,o="application/octet-stream",u=n||o,l=e,e=!i&&!n&&l,c=document.createElement("a"),h=a.Blob||a.MozBlob||a.WebKitBlob||r,d=i||"download",h=h.c
1all?h.bind(a):Blob;if("true"===String(this)&&(u=(l=[l,u])[0],l=l[1]),e&&e.length<2048&&(d=e.split("/").pop().split("?")[0],c.href=e,-1!==c.href.indexOf(e)))return(s=new XMLHttpRequest).open("GET",e,!0),s.responseType="blob",s.onload=function(e){t(e.target.response,d,o)},setTimeout(function(){s.send()},0),s;if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(l)){if(!(2096103.424<l.length&&h!==r))return navigator.msSaveBlob?navigator.msSaveBlob(m(l),d):y(l);u=(l=m(l)).type||o}else if(/([\x80-\xff])/.test(l)){for(var f=0,p=new Uint8Array(l.length),g=p.length;f<g;++f)p[f]=l.charCodeAt(f);l=new h([p],{type:u})}function m(e){for(var e=e.split(/[:;,]/),t=e[1],i=("base64"==e[2]?atob:decodeURIComponent)(e.pop()),n=i.length,r=0,s=new Uint8Array(n);r<n;++r)s[r]=i.charCodeAt(r);return new h([s],{type:t})}function y(e,t){var i;return"download"in c?(c.href=e,c.setAttribute("download",d),c.className="download-js-link",c.innerHTML="downloading...",c.style.display="none",document.body.appendChild(c),setTimeout(function(){c.click(),document.body.removeChild(c),!0===t&&setTimeout(function(){a.URL.revokeObjectURL(c.href)},250)},66),!0):/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)?(/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,o)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0):(i=document.createElement("iframe"),document.body.appendChild(i),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,o)),i.src=e,void setTimeout(function(){document.body.removeChild(i)},333))}if(n=l instanceof h?l:new h([l],{type:u}),navigator.msSaveBlob)return navigator.msSaveBlob(n,d);if(a.URL)y(a.URL.createObjectURL(n),!0);else{if("string"==typeof n||n.constructor===r)try{return y("data:"+u+";base64,"+a.btoa(n))}catch(e){return y("data:"+u+","+encodeURIComponent(n))}(i=new FileReader).onload=function(e){y(this.result)},i.readAsDataURL(n)}return!0};var Nn=Y.exports;function Bn(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">\n  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n    <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">\n      <g id="Group-2">\n        <g id="volme_big-copy" transform="translate(488.000000, 340.000000)">\n          <rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>\n          <rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>\n          <rect id="Rectangle-2" transform="translate(4.000000, 17.500000) rotate(90.000000) translate(-4.000000, -17.500000) " x="1.5" y="16.5" width="5" height="2" rx="1"></rect><rect id="Rectangle-2-Copy-3" transform="translate(20.000000, 17.500000) rotate(90.000000) translate(-20.000000, -17.500000) " x="17.5" y="16.5" width="5" height="2" rx="1"></rect>\n          <path d="M9.48791171,8.26502656 L9.48791171,14.2650266 C9.48791171,14.8173113 9.04019646,15.2650266 8.48791171,15.2650266 C7.93562696,15.2650266 7.48791171,14.8173113 7.48791171,14.2650266 L7.48791171,7.26502656 C7.48791171,6.71274181 7.93562696,6.26502656 8.48791171,6.26502656 L15.4879117,6.26502656 C16.0401965,6.26502656 16.4879117,6.71274181 16.4879117,7.26502656 C16.4879117,7.81731131 16.0401965,8.26502656 15.4879117,8.26502656 L9.48791171,8.26502656 Z" id="Combined-Shape" transform="translate(11.987912, 10.765027) scale(1, -1) rotate(45.000000) translate(-11.987912, -10.765027) "></path>\n        </g>\n      </g>\n    </g>\n  </g>\n</svg>\n',"image/svg+xml").firstChild}t(Xn,S),Un=i(Xn),e(Xn,[{key:"afterCreate",value:function(){l(a(Xn.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:Bn}}},{key:"getAbsoluteURL",value:function(e){var t;return e.match(/^https?:\/\//)||((t=document.createElement("div")).innerHTML='<a href="'.concat(e,'">x</a>'),e=t.firstChild.href),e}},{key:"destroy",value:function(){l(a(Xn.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n   <div class="xgplayer-icon">\n   </div>\n   '.concat(ii(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:3,disable:!0}}}]);var Fn,Un,Hn=Xn,Vn=(t(Yn,S),Fn=i(Yn),e(Yn,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.screenShot&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){l(a(Yn.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var t=this.config;this.initSize=function(e){t.fitVideo&&(t.width=e.vWidth,t.height=e.vHeight)},this.once(Re,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,t){var i=document.createElement("a"),e=(i.href=e,i.download=t,document.createEvent("MouseEvents"));
1e.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(e)}},{key:"createCanvas",value:function(e,t){var i=document.createElement("canvas"),n=i.getContext("2d");this.canvasCtx=n,(this.canvas=i).width=e||this.config.width,i.height=t||this.config.height,n.imageSmoothingEnabled=!0,n.imageSmoothingEnabled&&(n.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var t=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot"),this.shot().then(function(e){t.emit(Me,e),t.saveScreenShot(e,t.config.name+t.config.format)})}},{key:"shot",value:function(d,f){var p=this,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{quality:.92,type:"image/png"},g=this.config,m=this.player,y=e.quality||g.quality,v=e.type||g.type;return new Promise(function(e,t){var i,n,r,s,a,o,u,l,c,h=null;m.media.canvas?h=m.media.canvas:(p.canvas?(p.canvas.width=d||g.width,p.canvas.height=f||g.height):p.createCanvas(d,f),h=p.canvas,i=p.canvasCtx,o=m.media.videoWidth/m.media.videoHeight,u=h.width/h.height,l=m.media.videoWidth,c=m.media.videoHeight,u
1<o?(s=h.width,a=h.width/o,n=0,r=Math.round((h.height-a)/2)):o==u?(s=h.width,a=h.height,r=n=0):o<u&&(s=h.height*o,a=h.height,n=Math.round((h.width-s)/2),r=0),i.drawImage(m.media,0,0,l,c,n,r,s,a)),e(h.toDataURL(v,y).replace(v,"image/octet-stream").replace(/^data:image\/[^;]+/,"data:application/octet-stream"))})}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){l(a(Yn.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(Re,this.initSize)}},{key:"render",value:function(){var e,t;if(!this.config.disable)return e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",t="SCREENSHOT",'\n      <xg-icon class="xgplayer-shot">\n      <div class="'.concat(e,'">\n      ').concat(this.icons.screenshotIcon?"":'<span lang-key="'.concat(this.i18nKeys[t],'">').concat(this.i18n[t],"</span>"),"\n      </div>\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,fitVideo:!0,disable:!1,name:"screenshot"}}}]),Yn),Gn=(e(Kn,[{key:"renderItemList",value:function(e){var n=this,t=this.config,i=this.root;e?t.data=e:e=t.data,t.style&&Object.keys(t.style).map(function(e){i.style[e]=t[e]}),0<e.length&&(this.attrKeys=Object.keys(e[0])),this.root.innerHTML="",e.map(function(e,t){var i=e.selected?"option-item selected":"option-item";e["data-index"]=t,n.root.appendChild(m.createDom("li","<span>".concat(e.showText,"</span>"),e,i))})}},{key:"onItemClick",value:function(e){e.delegateTarget||(e.delegateTarget=e.target);var t=e.delegateTarget;if(t&&m.hasClass(t,"selected"))return!1;var i="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");m.addClass(t,"selected"),n&&m.removeClass(n,"selected"),i(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(t,e){var i;return t&&e?(i={},e.map(function(e){i[e]=t.getAttribute(e)}),(e=t.getAttribute("data-index"))&&(i.index=Number(e)),i):{}}},{key:"show",value:function(){m.removeClass(this.root,"hide"),m.addClass(this.root,"active")}},{key:"hide",value:function(){m.removeClass(this.root,"active"),m.addClass(this.root,"hide")}},{key:"setStyle",value:function(t){var i=this;Object.keys(t).forEach(function(e){i.root.style[e]=t[e]})}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map(function(e){e.destroy&&e.destroy()}),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),Kn),zn="side",qn="middle",Wn="click";function Kn(e){p(this,Kn),this.config=e.config,this.parent=e.root,this.root=m.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),e.root.appendChild(this.root);e=this.config.maxHeight,e&&this.setStyle({maxHeight:e}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList(),e="mobile"===y.device?"touchend":"click";this._delegates=E.delegate.call(this,this.root,"li",e,this.onItemClick)}function Yn(){return p(this,Yn),Fn.apply(this,arguments)}function Xn(e){var i;return p(this,Xn),u(h(i=Un.call(this,e)),"download",function(e){var t;i.isLock||(i.emitUserAction(e,"download"),e=i.playerConfig.url,t="","String"===m.typeOf(e)?t=e:"Array"===m.typeOf(e)&&0<e.length&&(t=e[0].src),e=i.getAbsoluteURL(t),Nn(e),i.isLock=!0,i.timer=window.setTimeout(function(){i.isLock=!1,window.clearTimeout(i.timer),i.timer=null},300))}),i.timer=null,i.isLock=!1,i}var Qn,Zn,Jn,$n="mobile"===y.device,er=(t(rr,E),Jn=i(rr),e(rr,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;this.initIcons(),$n&&t.listType!==qn&&(t.listType=zn),t.hidePortrait&&m.addClass(this.root,"portrait"),this.on([Re,b],function(){e._resizeList()}),this.once(_,function(){t.list&&0<t.list.length&&(e.renderItemList(t.list),e.show())}),$n&&this.on(ke,function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)}),$n?(t.toggleMode=Wn,this.activeEvent="touchend"):this.activeEvent=t.toggleMode===Wn?"click":"mouseenter",t.toggleMode===Wn?this.bind(this.activeEvent,this.switchActiveState):(this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var t=this,i=this.icons,e=Object.keys(i),n=!1;0<e.length&&(e.forEach(function(e){t.appendChild(".xgplayer-icon",i[e]),n=n||i[e]}),this.isIcons=n),n||(this.appendChild(".xgplayer-icon",m.createDom("span","",{},"icon-text")),m.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(){!this.config.list||this.config.list.length<2||m.addClass(this.root,"show")}},{key:"hide",value:function(){m.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,t,i){if(void 0===e)return"";var n=this.config.list;i=i||this.player.lang,t=!t||m.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]);try{return"object"===g(e[t])?e[t][i]||e[t].en:e[t]}catch(e){return console.warn(e),""}}},{key:"toggle",value:function(e){var t,i;e!==this.isActive&&(t=this.player.controls,i=this.config.listType,e?(i===zn?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):(i===zn?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e)}},{key:"onItemClick",value:function(e,t){e.stopPropagation();var e=this.config,i=e.listType,e=e.list;this.curIndex=t.to.index,this.curItem=e[this.curIndex],this.changeCurrentText(),(this.config.isItemClickHide||$n||i===zn)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){var e;this.isIcons||(e=(e=this.config.list)[this.curIndex<e.length?this.curIndex:0])&&(this.find(".icon-text").innerHTML=this.getTextByLang(e,"iconText"))}},{key:"renderItemList",value:function(e,t){var i=this,n=this.config,r=this.optionsList,s=this.player;"number"==typeof t&&(this.curIndex=t,this.curItem=n.list[t]),r?(r.renderItemList(e),this.changeCurrentText()):(t={config:{data:e||[],className:n.listType===zn?n.position===T.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":"",onItemClick:function(e,t){i.onItemClick(e,t)}},root:n.listType===zn?s.innerContainer||s.root:this.root},this.config.isShowIcon&&(r=this.player.root.getBoundingClientRect().height,(e=n.listType===qn?r-50:r)&&(t.config.maxHeight="".concat(e,"px")),this.optionsList=new Gn(t),this.changeCurrentText(),this.show()),this._resizeList(
1))}},{key:"_resizeList",value:function(){var e=this.player.root.getBoundingClientRect().height,e=this.config.listType===qn?e-50:e;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(e,"px")})}},{key:"destroy",value:function(){this.config.toggleMode===Wn?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.isIcons&&this.unbind("click",this.onIconClick),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n    <div class="xgplayer-icon">\n    </div>\n   </xg-icon>')}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:100,list:[],listType:"middle",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:"hover"}}}]),rr),tr=(t(nr,er),Zn=i(nr),e(nr,[{key:"beforeCreate",value:function(e){var t=e.config.list;Array.isArray(t)&&0<t.length&&(e.config.list=t.map(function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e}))}},{key:"afterCreate",value:function(){var t=this;l(a(nr.prototype),"afterCreate",this).call(this),this.on("resourceReady",function(e){t.changeDefinitionList(e)}),this.on(Ie,function(e){t.renderItemList(t.config.list,e.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(){!this.config.list||this.config.list.length<2||m.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var t,e=this.config,i=e.list,n=e.defaultDefinition;0<i.length&&(t=null,i.map(function(e){e.definition===n&&(t=e)}),t=t||i[0],this.changeDefinition(t))}},{key:"renderItemList",value:function(){var n=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.config.list||[],t=1<arguments.length?arguments[1]:void 0,r=t&&t.definition?t.definition:this.config.defaultDefinition,s=(t&&e.forEach(function(e){e.selected=!1}),0),t=e.map(function(e,t){var i=o(o({},e),{},{showText:n.getTextByLang(e)||e.definition,selected:!1});return(e.selected||e.definition&&e.definition==r)&&(i.selected=!0,s=t),i});l(a(nr.prototype),"renderItemList",this).call(this,t,s)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map(function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e}),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,t){this.player.changeDefinition(e,t)}},{key:"onItemClick",value:function(e,t){var i=this.player.definitionList;l(a(nr.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:t.from,to:t.to});for(var n=0;n<i.length;n++)t.to&&i[n].definition===t.to.definition&&(t.to.url=i[n].url),t.from&&i[n].definition===t.from.definition&&(t.from.url=i[n].url);this.player.changeDefinition(t.to,t.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return o(o({},er.defaultConfig),{},{position:T.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),nr),ir=(t(j,er),Qn=i(j),e(j,[{key:"beforeCreate",value:function(e){var t=e.player.config.playbackRate,t=t?Array.isArray(t)?t:e.config.list:[];Array.isArray(t)&&(e.config.list=t.map(function(e){return"number"==typeof e?e={rate:e,text:"".concat(e,"x")}:!e.text&&e.rate&&(e.text="".concat(e.rate,"x")),e}))}},{key:"afterCreate",value:function(){var e=this;l(a(j.prototype),"afterCreate",this).call(this),this.on(me,function(){e.curValue!==e.player.playbackRate&&e.renderItemList()}),this.renderItemList()}},{key:"show",value:function(){this.config.list&&0!==this.config.list.length&&l(a(j.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,t){l(a(j.prototype),"onItemClick",this).apply(this,arguments);var i=e.delegateTarget,i=Number(i.getAttribute("rate"));if(!i||i===this.curValue)return!1;var n={playbackRate:{from:this.player.playbackRate,to:i}};this.emitUserAction(e,"change_rate",{props:n}),this.curValue=i,this.player.playbackRate=i}},{key:"renderItemList",value:function(){var n=this,r=this.player.playbackRate||1,s=(this.curValue=r,-1),e=this.config.list.map(function(e,t){var i={rate:e.rate};return i.rate===r&&(i.selected=!0,s=t),i.showText=n.getTextByLang(e),i});l(a(j.prototype),"renderItemList",this).call(this,e,s)}},{key:"changeCurrentText",value:function(){var e,t;this.isIcons||(t="",t=!(e=(e=this.config.list)[this.curIndex<e.length?this.curIndex:0])||this.curIndex<0?"".concat(this.player.playbackRate,"x"):this.getTextByLang(e,"iconText"),this.find(".icon-text").innerHTML=t)}},{key:"destroy",value:function(){l(a(j.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return o(o({},er.defaultConfig),{},{position:T.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),j);function j(e){return p(this,j),(e=Qn.call(this,e)).curRate=1,e}function nr(e){return p(this,nr),(e=Zn.call(this,e)).curTime=0,e.isPau
1sed=!0,e}function rr(e){var t;return p(this,rr),u(h(t=Jn.call(this,e)),"onEnter",function(e){e.stopPropagation(),t.emit("icon_mouseenter",{pluginName:t.pluginName}),t.switchActiveState(e)}),u(h(t),"switchActiveState",function(e){e.stopPropagation(),t.config.toggleMode===Wn?t.toggle(!t.isActive):t.toggle(!0)}),u(h(t),"onLeave",function(e){e.stopPropagation(),t.emit("icon_mouseleave",{pluginName:t.pluginName}),t.config.listType!==zn&&t.isActive&&t.toggle(!1)}),u(h(t),"onListEnter",function(e){t.enterType=2}),u(h(t),"onListLeave",function(e){t.enterType=0,t.isActive&&t.toggle(!1)}),t.isIcons=!1,t.isActive=!1,t.curValue=null,t.curIndex=0,t}function sr(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n  <path fill="#fff" transform="scale(1.3, 1.3)" class=\'path_full\' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}function ar(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n  <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}t(mr,S),lr=i(mr),e(mr,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.cssFullscreen&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var t=this;l(a(mr.prototype),"afterCreate",this).call(this),this.config.disable||(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Le,function(e){t.animate(e)}),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,t=this.find(".xgplayer-icon");t.appendChild(e.cssFullscreen),t.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:t}),t?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var t=this.i18nKeys,i=this.find(".xg-tips");i&&this.changeLangTextKey(i,e?t.EXITCSSFULLSCREEN_TIPS:t.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:sr,class:"xg-get-cssfull"},exitCssFullscreen:{icon:ar,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){l(a(mr.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return"<xg-icon class='xgplayer-cssfullscreen'>\n    <div class=\"xgplayer-icon\">\n    </div>\n    ".concat(ii(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:T.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]);var or,ur,lr,cr=mr,hr=(t(gr,E),ur=i(gr),e(gr,[{key:"afterCreate",value:function(){var t=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(he,function(e){t.onError(e)})}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=this.player,t=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).errorType,i=e.errorNote?this.i18n[e.errorNote]:"";if(!i)switch(t){case"decoder":i=this.i18n.MEDIA_ERR_DECODE;break;case"network":i=this.i18n.MEDIA_ERR_NETWORK;break;default:i=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=i,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return'<xg-error class="xgplayer-error">\n      <div class="xgplayer-errornote">
1\n       <span class="xgplayer-error-text"></span>\n       <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n      </div>\n    </xg-error>'}}],[{key:"pluginName",get:function(){return"error"}}]),gr),dr=(t(pr,E),or=i(pr),e(pr,[{key:"afterCreate",value:function(){var t=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],function(e){(t.config.onClick||t.customOnClick)&&(e.preventDefault(),e.stopPropagation(),t.customOnClick?t.customOnClick(e):t.config.onClick(e))}),this.player.showPrompt=function(){t.show.apply(t,arguments)},this.player.hidePrompt=function(){t.hide()}}},{key:"setStyle",value:function(t){var i=this;Object.keys(t).map(function(e){i.root.style[e]=t[e]})}},{key:"show",value:function(e){var t,i=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};e&&(this.customOnClick=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(){},t=this.config.interval,this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),m.addClass(this.root,"show"),"arrow"===n.mode&&m.addClass(this.root,"arrow"),this.find(".xgplayer-prompt-detail").innerHTML="string"==typeof e?e:"".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),n.style&&this.setStyle(n.style),("boolean"==typeof n.autoHide?n:this.config).autoHide)&&(e=n.interval||t,this.intervalId=setTimeout(function(){i.hide()},e))}},{key:"hide",value:function(){m.removeClass(this.root,"show"),m.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(A.CONTROLS_FOLLOW,'">\n    <span class="xgplayer-prompt-detail"></span>\n    </xg-prompt>')}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),pr),fr={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function pr(){return p(this,pr),or.apply(this,arguments)}function gr(){return p(this,gr),ur.apply(this,arguments)}function mr(){return p(this,mr),lr.apply(this,arguments)}function yr(t){Object.keys(fr).map(function(e){void 0===t[e]&&(t[e]=fr[e])})}var vr,_r,kr,br={_updateDotDom:function(e,t){var i,n;t&&(i=this.calcuPosition(e.time,e.duration),(n=e.style||{}).left="".concat(i.left,"%"),n.width="".concat(i.width,"%"),t.setAttribute("data-text",e.text),t.setAttribute("data-time",e.time),i.isMini?m.addClass(t,"mini"):m.removeClass(t,"mini"),Object.keys(n).map(function(e){t.style[e]=n[e]}))},initDots:function(){var t=this;this._ispots.map(function(e){t.createDot(e,!1)}),this.ispotsInit=!0},createDot:function(e){var t,i,n,r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],s=this.player.plugins.progress;s&&(r&&(yr(e),this._ispots.push(e)),this.ispotsInit||!r)&&(r=this.calcuPosition(e.time,e.duration),(t=e.style||{}).left="".concat(r.left,"%"),t.width="".concat(r.width,"%"),i="xgspot_".concat(e.id," xgplayer-spot"),r.isMini&&(i+=" mini"),r=e.template?'<div class="xgplayer-spot-pop">'.concat(e.template,"</div>"):"",n=m.createDom("xg-spot",r,{"data-text":e.text,"data-time":e.time,"data-id":e.id},i),Object.keys(t).map(function(e){n.style[e]=t[e]}),s.outer&&s.outer.appendChild(n),this.positionDot(n,e.id))},findDot:function(i){var e;if(this.player.plugins.progress)return 0<(e=this._ispots.filter(function(e,t){return e.id===i})).length?e[0]:null},updateDot:function(t){var i,e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=this.player.plugins.progress;n&&((i=this.findDot(t.id))&&Object.keys(t).map(function(e){i[e]=t[e]}),this.ispotsInit)&&(n=n.find('xg-spot[data-id="'.concat(t.id,'"]')))&&(this._updateDotDom(t,n),e)&&this.showDot(t.id)},deleteDot:function(e){var t=this._ispots,i=this.player.plugins.progress;if(i){for(var n=[],r=0;r<t.length;r++)t[r].id===e&&n.push(r);for(var s,a=n.length-1;0<=a;a--)t.splice(n[a],1),this.ispotsInit&&(s=i.find('xg-spot[data-id="'.concat(e,'"]')))&&s.parentElement.removeChild(s)}},deleteAllDots:function(){var e=this.player.plugins.progress;if(e){if(this.ispotsInit)for(var t=e.root.getElementsByTagName("xg-spot"),i=t.length-1;0<=i;i--)e.outer.removeChild(t[i]);this._ispots=[]}},updateAllDots:function(){var i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=this.player.plugins.progress;if(t)if(this.ispotsInit){this._ispots=[];var n=t.root.getElementsByTagName("xg-spot"),r=n.length;if(r>e.length)for(var s=r-1;s>e.length-1;s--)t.outer.removeChild(n[s]);e.forEach(function(e,t){t<r?(n[t].setAttribute("data-id","".concat(e.id)),i._ispots.push(e),i.updateDot(e)):i.
1createDot(e)})}else this._ispots=e},positionDots:function(){var i=this,e=this._ispots,t=this.playerSize,n=this.player.sizeInfo,r=this.player.plugins.progress;r&&n.width!==t.width&&(t.width=n.width,t.left=n.left,e.forEach(function(e){var t=r.find('xg-spot[data-id="'.concat(e.id,'"]'));t&&i.positionDot(t,e.id)}))},positionDot:function(e,t){var i,n,r,s,a=m.findDom(e,".xgplayer-spot-pop");a&&(r=this.playerSize,e=e.getBoundingClientRect(),i=a.getBoundingClientRect(),s=e.left-r.left,n=r.width-s-e.width/2,s<i.width/2||r.width<i.width?(r=i.width/2-s,a.style.left="".concat(r,"px")):n<i.width/2?(s=n-i.width/2+e.width/2,a.style.left="".concat(s,"px")):a.style.left="50%")},updateDuration:function(){var i=this,n=this.player.plugins.progress;n&&this._ispots.forEach(function(e){var t=n.find('xg-spot[data-id="'.concat(e.id,'"]'));i._updateDotDom(e,t)})},getAllDotsDom:function(){var e=this.player.plugins.progress;return e?e.root.getElementsByTagName("xg-spot"):[]},getDotDom:function(e){var t=this.player.plugins.progress;if(t)return t.find('xg-spot[data-id="'.concat(e,'"]'))}},Sr={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},xr=(t(Ar,E),kr=i(Ar),e(Ar,[{key:"beforeCreate",value:function(e){var t=e.player.plugins.progress;t&&(e.root=t.root)}},{key:"afterCreate",value:function(){var t,e,i,n=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",function(e,t){t.seekTime&&n.player.seek(t.seekTime)}),this.transformTimeHook=this.hook("transformTime",function(e){n.setTimeContent(e)}),e=(t=this).config,i=t.player,Object.keys(br).map(function(e){t[e]=br[e].bind(t)}),e=i.config.progressDot||e.ispots||[],t._ispots=e.map(function(e){return yr(e),e}),t.ispotsInit=!1,t.playerSize={left:i.sizeInfo.left,width:i.sizeInfo.width},t.on(pe,function(){t.ispotsInit?t.updateDuration():t.initDots()}),t.on(Re,function(){t.positionDots()}),this.on(pe,function(){n.show()}),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(t){var i=this;t&&Object.keys(t).map(function(e){i.config[e]=t[e]})}},{key:"onPluginsReady",value:function(){this.player.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var t,i=this,n=this.player.plugins.progress;n&&(Object.keys(Sr).map(function(e){i[Sr[e]]=i[Sr[e]].bind(i),n.addCallBack(e,i[Sr[e]])}),"mobile"!==y.device)&&(this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup),t=this.hook("previewClick",function(){}),this.handlerPreviewClick=function(e){e.stopPropagation(),t(parseInt(1e3*i._state.now,10)/1e3,e)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick))}},{key:"onProgressMove",value:function(e,t){!this.config.disable&&this.player.duration&&this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!0,this.videoPreview)&&m.addClass(this.videoPreview,"show")}},{key:"onProgressDragEnd",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!1,this.videoPreview)&&m.removeClass(this.videoPreview,"show")}},{key:"onProgressClick",value:function(t,i){this.config.disable||m.hasClass(i.target,"xgplayer-spot")&&(i.stopPropagation(),i.preventDefault(),["time","id","text"].map(function(e){t[e]=i.target.getAttribute("data-".concat(e))}),t.time&&(t.time=Number(t.time)),this.handlerSpotClick(i,t))}},{key:"updateLinePos",value:function(e,t){var i,n=this.root,r=this.previewLine,s=this.player,a=this.config,s="flex"===s.controls.mode,o=n.getBoundingClientRect().width;!o&&this._hasThumnail||((a=e-(o=this._hasThumnail&&o<a.width?a.width:o)/2)<0&&!s?(a=0,i=e-o/2):t-o<a&&!s?(i=a-(t-o),a=t-o):i=0,void 0!==i&&(r.style.transform="translateX(".concat(i.toFixed(2),"px)")),n.style.transform="translateX(".concat(a.toFixed(2),"px) translateZ(0)"))}},{key:"updateTimeText",value:function(e){var t=this.timeText,i=this.timePoint;t.innerHTML=e,this.thumbnail||(i.innerHTML=e)}},{key:"updatePosition",value:function(e,t,i,n){var r=this.root,s=this.config,a=this._state;r&&(a.now=i,this.transformTimeHook(i),r=this.timeStr,n&&n.target&&m.hasClass(n.target,"xgplayer-spot")?(this.showTips(n.target.getAttribute("data-text"),!1,r),this.focusDot(n.target),a.f=!0,s.isFocusDots&&a.f&&(a.now=parseInt(n.target.getAttribute("data-time"),10))):s.defaultText?(a.f=!1,this.showTips(s.defaultText,!0,r)):(a.f=!1,this.hideTips("")),this.updateTimeText(r),this.updateThumbnails(a.now),this.updateLinePos(e,t))}},{key:"setTimeContent",value:function(e){this.timeStr="".concat(m.format(e))}},{key:"updateThumbnails",value:function(e){var t=this.player,i=this.videoPreview,n=this.config,t=t.plugins.thumbnail;t&&t.usable&&(this.thumbnail&&t.update(this.thumbnail,e,n.width,n.height),n=i&&i.getBoundingClientRect(),this.videothumbnail)&&t.update(this.videothumbnail,e,n.width,n.height)}},{key:"registerThumbnail",value:function(){var e,t,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};"mobile"!==y.device&&(e=this.player,t=this.config,(i=e.getPlugin("thumbnail"))&&i.setConfig(n),i&&i.usable&&t.isShowThumbnail?(m.removeClass(this.root,"short-line no-thumbn
1ail"),"short"===t.mode&&m.addClass(this.root,"short-line"),this._hasThumnail=!0,n=this.find(".xg-spot-thumbnail"),this.thumbnail=i.createThumbnail(n,"progress-thumbnail"),t.isShowCoverPreview&&(this.videoPreview=m.createDom("xg-video-preview","",{},"xgvideo-preview"),e.root.appendChild(this.videoPreview),this.videothumbnail=i.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)):m.addClass(this.root,"short-line no-thumbnail"))}},{key:"calcuPosition",value:function(e,t){var i=this.player.plugins.progress,n=this.player,i=i.root.getBoundingClientRect().width,i=n.duration/i*6;return e+t>n.duration&&(t=n.duration-e),n.duration,n.duration,{left:e/n.duration*100,width:t/n.duration*100,isMini:t<i}}},{key:"showDot",value:function(e){var t,i,e=this.findDot(e);e&&(t=this.root.getBoundingClientRect().width,i=e.time/this.player.duration*t,this.updatePosition(i,t,e.time))}},{key:"focusDot",value:function(e,t){e&&(t=t||e.getAttribute("data-id"),m.addClass(e,"active"),this._activeDotId=t)}},{key:"blurDot",value:function(e){var t;e||(t=this._activeDotId,e=this.getDotDom(t)),e&&(m.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"";m.addClass(this.root,"no-timepoint"),e&&(m.addClass(this.find(".xg-spot-content"),"show-text"),t&&"production"===this.config.mode?(m.addClass(this.root,"product"),this.tipText.textContent=e):(m.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(i," ").concat(e)))}},{key:"hideTips",value:function(){m.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",m.removeClass(this.find(".xg-spot-content"),"show-text"),m.removeClass(this.root,"product")}},{key:"hide",value:function(){m.addClass(this.root,"hide")}},{key:"show",value:function(){m.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,t=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(t.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var t=this,i=this.player.plugins.progress;i&&Object.keys(Sr).map(function(e){i.removeCallBack(e,t[Sr[e]])}),this.videothumbnail=null,this.thumbnail=null,this.videoPreview&&this.player.root.removeChild(this.videoPreview),this.unbind(".xg-spot-info","mousemove",this.onMousemove),this.unbind(".xg-spot-info","mousedown",this.onMousedown),this.unbind(".xg-spot-info","mouseup",this.onMouseup),this.unbind(".xg-spot-content","mouseup",this.handlerPreviewClick)}},{key:"render",value:function(){return"mobile"===y.device||"mobile"===this.playerConfig.isMobileSimulateMode?"":'<div class="xg-spot-info hide '.concat("short"===this.config.mode?"short-line":"",'">\n      <div class="xg-spot-content">\n        <div class="xg-spot-thumbnail">\n          <span class="xg-spot-time"></span>\n        </div>\n        <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n      </div>\n      <div class="xgplayer-progress-point">00:00</div>\n      <div class="xg-spot-ext-text"></div>\n      <div class="xg-spot-line"></div>\n    </div>')}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),Ar),wr=(t(Dr,E),_r=i(Dr),e(Dr,[{key:"afterCreate",value:function(){var i=this;this.usable&&this.initThumbnail(),this.on([pe],function(){var e=i.config,t=e.pic_num,e=e.interval;i.usable&&(i.interval=0<e?e:Math.round(1e3*i.player.duration/t)/1e3)})}},{key:"setConfig",value:function(t){var e,i=this;!t||(e=Object.keys(t)).length<1||(e.forEach(function(e){i.config[e]=t[e]}),this.usable&&this.initThumbnail())}},{key:"usable",get:function(){var e=this.config,t=e.urls;return t&&0<t.length&&0<e.pic_num}},{key:"initThumbnail",value:function(){var e=this.config,t=e.width,i=e.pic_num,n=e.interval;this.ratio=t/e.height*100,this.interval=n||Math.round(this.player.duration/i),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return 0<=e&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var t,i,n,r=this;this._preloadMark[e]||(t=this.config.urls,i=t.length,n=[],0<e&&n.push(e-1),n.push(e),0<e&&e<i-1&&n.push(e+1),n.map(function(e){!r._preloadMark[e]&&0<=e&&e<i&&(r._preloadMark[e]=1,m.preloadImg(t[e],function(){r._preloadMark[e]=2}))}))}},{key:"getPosition",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=this.config,r=n.pic_num,s=n.row,a=n.col,o=n.width,n=n.height,e=(this.interval=Math.round(this.player.duration/r),Math.ceil(e/this.interval)),r=(e=r<e?r:e)<s*a?0:Math.ceil(e/(s*a))-1,e=e-a*s*r,s=0<e?Math.ceil(e/a)-1:0,e=0<e?e-s*a-1:0,u=0,l=0,i=(t&&i?t/i<o/n?u=(l=i)*(o/n):l=(u=t)/(o/n):i?t||(u=(l=i||n)*(o/n)):l=(u=t||o)/(o/n),this.getUrlByIndex(r));return{urlIndex:r,rowIndex:s,colIndex:e,url:i,height:l,width:u,style:{backgroundImage:"url(".concat(i,")"),backgroundSize:"".concat(u*a,"px auto"),backgroundPosition:"-".concat(e*u,"px -").concat(s*l,"px"),width:"".concat(u,"px"),height:"".concat(l,"px")}}}},{key:"update",value:function(t,e){var i,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"",a=this.config,o=a.pic_num,a=a.urls;o<=0||!a||0===a.length||(i=this.getPosition(e,n,r),this.preload(i.urlIndex),Ob
1ject.keys(i.style).map(function(e){t.style[e]=i.style[e]}),Object.keys(s).map(function(e){t.style[e]=s[e]}))}},{key:"changeConfig",value:function(){this.setConfig(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}},{key:"createThumbnail",value:function(e,t){t=m.createDom("xg-thumbnail","",{},"thumbnail ".concat(t));return e&&e.appendChild(t),t}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),Dr),Tr=(t(Cr,E),vr=i(Cr),e(Cr,[{key:"afterCreate",value:function(){}},{key:"update",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=1<arguments.length?arguments[1]:void 0;t&&this.root&&(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/t*100,"%")),e.played)&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/t*100,"%"))}},{key:"render",value:function(){if(this.playerConfig.progress&&this.playerConfig.miniprogress)return'<xg-mini-progress class="xg-mini-progress">\n    <xg-mini-progress-cache class="xg-mini-progress-cache"></xg-mini-progress-cache>\n    <xg-mini-progress-played class="xg-mini-progress-played"></xg-mini-progress-played>\n    </xg-mini-progress>'}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{}}}]),Cr),Er="firstframe";function Cr(){return p(this,Cr),vr.apply(this,arguments)}function Dr(e){return p(this,Dr),(e=_r.call(this,e)).ratio=1,e.interval=null,e._preloadMark={},e}function Ar(e){var i;return p(this,Ar),u(h(i=kr.call(this,e)),"onMousemove",function(e){i.config.disable||(m.hasClass(e.target,"xg-spot-content")&&i.config.isHideThumbnailHover?i.player.plugins.progress.onMouseLeave(e):(i._state.f||m.hasClass(e.target,"xg-spot-content"))&&(m.event(e),e.stopPropagation()))}),u(h(i),"onMousedown",function(e){i.config.disable||(i._state.f||m.hasClass(e.target,"xg-spot-content"))&&(m.event(e),e.stopPropagation())}),u(h(i),"onMouseup",function(e){var t;i.isDrag&&(t=i.player.plugins.progress)&&t.pos&&(t.onMouseUp(e),!t.pos.isEnter)&&t.onMouseLeave(e)}),u(h(i),"onDotMouseLeave",function(e){i.config.disable||(i._curDot.removeEventListener("mouseleave",i.onDotMouseLeave),i.blurDot(e.target),i._curDot=null,(e=i.player.plugins.progress)&&e.enableBlur(),i.show())}),u(h(i),"onProgressMouseOver",function(e,t){i.config.disable||!m.hasClass(t.target,"xgplayer-spot")||i._curDot||(i._curDot=t.target,i.focusDot(t.target),0<i._curDot.children.length&&i.hide(),(t=i.player.plugins.progress)&&t.disableBlur(),i._curDot.addEventListener("mouseleave",i.onDotMouseLeave))}),i._ispots=[],i.videoPreview=null,i.videothumbnail=null,i.thumbnail=null,i.timeStr="",i._state={now:0,f:!1},i}var Lr,Pr,Ir,Or=null,Rr=(t(Ur,E),Ir=i(Ur),e(Ur,[{key:"afterCreate",value:function(){var e=this,t=(!0===this.playerConfig.dynamicBg&&(this.config.disable=!1),Ur.isSupport||(this.config.disable=!0),this.config),i=t.disable,n=t.mode,t=t.frameRate;i||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=parseInt(1e3/t,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this.once(Te,function(){e.player&&(e.init(),e.player.paused||e.start())}),"poster"!==n&&(n!==Er&&(this.on(_e,function(){e.stop()}),this.on(r,function(){e._checkIfCanStart()&&e.start()}),this.on(ce,function(){e.stop()})),this.on(k,this.onLoadedData),this.on(ve,function(){e._isLoaded=!1,e.stop()})))}},{key:"init",value:function(){var e=this.player,t=this.config;this.canvasFilter=Ur.supportCanvasFilter();try{var i=this.config.isInnerRender&&e.innerContainer||e.root;i.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(t.index,'"><canvas>\n        </canvas><xgmask></xgmask></div>')),this.root=i.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=t.filter,this.canvas.style.webkitFilter=t.filter),this.mask=this.find("xgmask"),t.addMask&&(this.mask.style.background=t.maskBg),this.canvasCtx=this.canvas.getContext("2d"),this.renderByPoster()}catch(e){d.logError("plugin:DynamicBg",e)}
1}},{key:"checkVideoIsSupport",value:function(e){var t;return e&&((e=e&&e instanceof window.HTMLVideoElement?e:e.canvas||e.flyVideo||null)&&("safari"!==y.browser||!m.isMSE(e))||"canvas"===(t=e?e.tagName.toLowerCase():"")||"img"===t)?e:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;e&&(e="String"===m.typeOf(e)?e:"String"===m.typeOf(e.poster)?e.poster:null,this.updateImg(e))}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&e!==Er&&"poster"!==e}},{key:"renderOnce",value:function(){var e,t=this.player.media;t.videoWidth&&t.videoHeight&&(this.videoPI=parseInt(t.videoWidth/t.videoHeight*100,10),e=this.checkVideoIsSupport(t))&&t.videoWidth&&this.update(e,this.videoPI)}},{key:"updateImg",value:function(e){var t,i,n,r,s=this;e&&(t=this.canvas.getBoundingClientRect(),i=t.width,n=t.height,(r=new window.Image).onload=function(){var e;!s.canvas||s.frameId||s.isStart||(s.canvas.height=n,s.canvas.width=i,e=parseInt(i/n*100,10),s.update(r,e),r=null)},r.src=e)}},{key:"update",value:function(e,t){if(this.canvas&&this.canvasCtx&&t)try{var i,n,r,s=this._pos,a=this.config,o=this.canvas.getBoundingClientRect(),u=o.width,l=o.height;u===s.width&&l===s.height&&s.pi===t||(i=parseInt(u/l*100,10),s.pi=t,s.width=this.canvas.width=u,n=s.height=this.canvas.height=l,r=u,i<t?r=parseInt(l*t/100,10):t<i&&(n=parseInt(100*u/t,10)),s.rwidth=r*a.multiple,s.rheight=n*a.multiple,s.x=(u-s.rwidth)/2,s.y=(l-s.rheight)/2),this.canvasFilter&&(this.canvasCtx.filter=a.filter),this.canvasCtx.drawImage(e,s.x,s.y,s.rwidth,s.rheight)}catch(e){d.logError("plugin:DynamicBg",e)}}},{key:"destroy",value:function(){this.stop(),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return"boolean"==typeof Or?Or:Or=(()=>{try{return!!document.createElement("canvas").getContext}catch(e){return!1}})()}},{key:"supportCanvasFilter",value:function(){return!("safari"===y.browser||"firefox"===y.browser)}}]),Ur),jr=G,Mr=(t(Fr,lt),Pr=i(Fr),e(Fr,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:(new Date).toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(Fe,this._recordUserActions),this.on(jr.STATS_INFO,this._recordInfo),this.on(jr.STATS_DOWNLOAD,this._downloadStats),this.on(jr.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var t=this._getTime();this._stats.info.push(o(o({},t),{},{payload:e}))}},{key:"_infoProfile",value:function(e){e&&e.startMs?(e=o({cat:"function",dur:Date.now()-e.startMs,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e),this._info(e)):console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(u(e={},"info",[]),u(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player.media,t=[],i=0;i<e.buffered.length;i++)t.push({start:e.buffered.start(i),end:e.buffered.end(i)});var n={currentTime:e.currentTime,readyState:e.readyState,buffered:t,paused:e.paused,ended:e.ended};return this._stats.media=n,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){return this._stats.info.map(function(e){var t=e.payload.data,i="";try{t instanceof Error?i=t.msg:void 0!==t&&(i=JSON.stringify(t))}catch(e){console.log("err",e)}return"[".concat(e.timeFormat,"] : ").concat(e.payload.msg," ").concat(i," ")})}},{key:"_getProfile",value:function(){var t={traceEvents:[]};return this._stats.info.forEach(function(e){e.payload.profile&&t.traceEvents.push(e.payload)}),t}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),Fr),Nr=(t(Br,E),Lr=i(Br),e(Br,[{key:"afterCreate",value:function(){var e=this;!1!==this.config.useGapJump&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(fe,this.onGapJump),this.on(r,function(){e.hasPlayed=!0}),this.on(de,function(){e.seekingEventReceived=!0}
1))}},{key:"_getIndex",value:function(e,t,i){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var n=this._getBuffered(e),r=null,s=0;s<n.length;s++)if(n[s].start>t&&(0===s||n[s-1].end-t<=i)){r=s;break}return r}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),Br);function Br(){var o;p(this,Br);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(o=Lr.call.apply(Lr,[this].concat(t))),"onGapJump",function(){var e,t,i,n,r,s=h(o),a=s.player,s=s.config;if(a.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(a.media.seeking){if(!o.seekingEventReceived)return}else o.seekingEventReceived=!1;a.media.paused&&0!==a.media.currentTime&&o.hasPlayed||(i=a.media.buffered,r=s.smallGapLimit||.5,t=s.gapDetectionThreshold||.3,e=a.media.currentTime,null!==(t=o._getIndex(i,e,t))&&0!==t&&(console.log("GapJump  bufferRange ",i.start(t),i.end(t)),(i=i.start(t)+.1)>a.media.duration||(r=(n=i-e)<=r,n<Br.BROWSER_GAP_TOLERANCE)||r&&(!1!==s.useGapJump&&(a.media.currentTime=o.isSafari?i+.1:i),o.player&&o.player.emit("detectGap"),console.log("gapJump gapIndex",t," isGapSamll:",r," currentTime:",a.media.currentTime," jumpSize:",e-a.media.currentTime),.08!==i)&&a&&a.emit("log",{type:"oneevent",end_type:"gap",vid:a.config.vid,ext:{video_postion:Math.floor(1e3*i)}})))}}),o}function Fr(){var i;p(this,Fr);for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(h(i=Pr.call.apply(Pr,[this].concat(t))),"_recordUserActions",function(e){var t=i._getTime(),e=Object.assign({},e,{msg:e.msg||e.action});i._stats.info.push(o(o({type:"userAction"},t),{},{payload:e}))}),u(h(i),"_onReset",function(){i.reset()}),u(h(i),"_recordInfo",function(e){i.info(e)}),u(h(i),"_downloadStats",function(){var e=i.getStats(),e=new Blob([JSON.stringify(e)],{type:"application/json"}),e=window.URL.createObjectURL(e),t=document.createElement("a");t.style.display="none",t.href=e,t.download="player.txt",t.disabled=!1,t.click()}),i}function Ur(){var n;p(this,Ur);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(n=Ir.call.apply(Ir,[this].concat(t))),"onLoadedData",function(e){n.player&&(n._frameCount=n.config.startFrameCount,n.renderOnTimeupdate(e),n.off(s,n.renderOnTimeupdate),n.on(s,n.renderOnTimeupdate))}),u(h(n),"renderOnTimeupdate",function(e){0<n._frameCount?(n.renderOnce(),n._frameCount--):(n._isLoaded=!0,n.off(s,n.renderOnTimeupdate),!n.player.paused&&n._checkIfCanStart()&&n.start())}),u(h(n),"start",function(){var e=n.player.media,t=(()=>{try{return parseInt(window.performance.now(),10)}catch(e){return(new Date).getTime()}})(),i=n.checkVideoIsSupport(e);i&&n.canvasCtx&&(n.stop(),e.videoWidth&&e.videoHeight&&(n.videoPI=0<e.videoHeight?parseInt(e.videoWidth/e.videoHeight*100,10):0,"realtime"===n.config.mode||t-n.preTime>=n.interval)&&(e&&e.videoWidth&&n.update(i,n.videoPI),n.preTime=t),n.frameId=m.requestAnimationFrame(n.start))}),u(h(n),"stop",function(){n.frameId&&(m.cancelAnimationFrame(n.frameId),n.frameId=null)}),n}Nr.BROWSER_GAP_TOLERANCE=.001;t(Zr,E),Gr=i(Zr),e(Zr,[{key:"afterCreate",value:function(){var e=this,t=this.config,i=t.useWaitingTimeoutJump,t=t.jumpSize;!1!==i&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=t,this.on(fe,this.onWaiting),this.on([ue,_],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on(r,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]);var Hr,Vr,Gr,zr=Zr,qr="cdn",Wr=["cdn"],Kr=(t(Qr,E),Vr=i(Qr),e(Qr,[{key:"afterCreate",value:function(){var e=this.config,t=e.openSpeed,e=e.addSpeedTypeList;0<(null==e?void 0:e.length)&&Wr.push.apply(Wr,c(e)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,t&&this.on([k,Ee],this.startTimer)}},{key:"getSpeedName",value:function(e,t){return e+"Speed"+t.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){!(this.config.openSpeed=e)&&this.timer?(clearTimeout(this.timer),this.timer=null):this.config.openSpeed&&!this.timer&&(this.timer=setTimeout(this.testSpeed,this.config.testTimeStep))}},{key:"destroy",value:function(){var t=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([k,Ee],this.startTimer),Wr.forEach(function(e){t.speedListCache&&t.speedListCache[e]&&(t.speedListCache[e]=[])}),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&4!==this.xhr.readyState&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:204800,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),Qr),Yr=(t(Xr,E),Hr=i(Xr),e(Xr,[{key:"afterCreate",value:function(){var e=this,t=this.player,i=this.config;this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],i.disabled||t.media.getVideoPlaybackQuality&&(this.on(r,function(){e._startTick()}),this.on(ce,function(){e._stopTick()}),this.on(le,function(){e._stopTick()}),this.on(_e,function(){e._stopTick()}))}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout(function(){e._checkDecodeFPS(),e._startTick()},this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkStuck",value:function(e,t,i,n){var r=this.player.media,s=document.hidden,a=r.paused;if("boolean"==typeof s&&!s&&!a){for(var o=r.currentTime,u=r.buffered,l=!1,c=[],h=0;h<u.length;h++){var d=u.start(h),f=u.end(h);if(c.push({start:d,end:f}),d<=o&&o<=f-1){l=!0;break}}4===r.readyState&&l&&(this._currentStuckCount>
1this.config.stuckCount?(this.emit(ze,this._payload),this._reset()):e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({bufs:c,currentTime:r.currentTime,curDecodedFrames:e,totalVideoFrames:t,droppedVideoFrames:i,checkInterval:n})):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e,t,i,n,r;this.player.media&&(e=(t=this.player.media.getVideoPlaybackQuality()).totalVideoFrames,t=t.droppedVideoFrames,i=performance.now(),e&&this._lastCheckPoint&&(n=e-this._lastDecodedFrames,r=i-this._lastCheckPoint,this._checkStuck(n,e,t,r)),this._lastDecodedFrames=e,this._lastCheckPoint=i)}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),Xr);function Xr(){return p(this,Xr),Hr.apply(this,arguments)}function Qr(){var c;p(this,Qr);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return u(h(c=Vr.call.apply(Vr,[this].concat(t))),"getSpeed",function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:qr;return!c.speedListCache||!c.speedListCache[e]||c.speedListCache[e].length<=0?0:(t=0,c.speedListCache[e].map(function(e){t+=e}),Math.floor(t/c.speedListCache[e].length))}),u(h(c),"startTimer",function(){m.isMSE(c.player.video)||(c.initSpeedList(),c.cnt=0,c.timer=setTimeout(c.testSpeed,c.config.testTimeStep))}),u(h(c),"initSpeedList",function(){c.speedListCache={},Wr.forEach(function(e){c.speedListCache[e]=[]})}),u(h(c),"_onRealSpeedChange",function(e){e.speed&&c.appendList(e.speed,e.type||qr)}),u(h(c),"testSpeed",function(){if(clearTimeout(c.timer),c.timer=null,c.player&&c.config.openSpeed){var e=c.config,t=e.url,i=e.loadSize,n=e.testCnt,r=e.testTimeStep,e=t+(t.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(c.cnt>=n)){c.cnt++;try{var s,a=(new Date).getTime(),o=new XMLHttpRequest,u=((c.xhr=o).open("GET",e),{}),l=Math.floor(10*Math.random());u.Range="bytes="+l+"-"+(i+l),u&&Object.keys(u).forEach(function(e){o.setRequestHeader(e,u[e])}),o.onreadystatechange=function(){var e;4===o.readyState&&(c.xhr=null,s=(new Date).getTime(),e=o.getResponseHeader("Content-Length")/1024*8,e=Math.round(1e3*e/(s-a)),c.appendList(e),c.timer=setTimeout(c.testSpeed,r))},o.send()}catch(e){console.error(e)}}}}),u(h(c),"appendList",function(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:qr;c.speedListCache&&c.speedListCache[i]&&(t=c.config.saveSpeedMax,c.speedListCache[i].length>=t&&c.speedListCache[i].shift(),c.speedListCache[i].push(e),(t=h(c).player)&&(i===qr?t.realTimeSpeed=e:t[c.getSpeedName("realTime",i)]=e),c.updateSpeed(i))}),u(h(c),"updateSpeed",function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:qr,t=c.getSpeed(e),i=h(c).player;i&&(e===qr?i.avgSpeed&&t===i.avgSpeed||(i.avgSpeed=t,i.emit(Ae,{speed:t,realTimeSpeed:i.realTimeSpeed})):i[e=c.getSpeedName("avg",e)]&&t===i[e]||(i[e]=t,i.emit(Ae,{speed:t,realTimeSpeed:i.realTimeSpeed})))}),c}function Zr(){var i;p(this,Zr);for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(h(i=Gr.call.apply(Gr,[this].concat(t))),"onWaiting",function(){var e=h(i).config;i.jumpCnt>e.jumpCntMax||i.timer||!1===e.useWaitingTimeoutJump||(i.timer=setTimeout(i.onJump,1e3*e.waitingTime))}),u(h(i),"onJump",function(){var e=h(i),t=e.player,e=e.config;clearTimeout(i.timer),i.timer=null,i.jumpCnt>e.jumpCntMax||!1===e.useWaitingTimeoutJump||t.media.paused&&0!==t.media.currentTime&&i.hasPlayed||(i.jumpSize=e.jumpSize*(i.jumpCnt+1),i.jumpCnt===e.jumpSize&&i.jumpSize<6&&(i.jumpSize=6),(e=t.currentTime+i.jumpSize)>t.media.duration)||(console.log("waitintTimeout, currentTime:",t.currentTime,", jumpTo:",e),i.jumpCnt++,t.currentTime=e)}),i}Pt.use({LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"è§£ç 
1é”™è¯¯",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}});var Jr,Y=e(function e(t,i){p(this,e);var n,r=i&&"mobile"===i.isMobileSimulateMode,i=i.isLive,i=[].concat(i?[]:[fn,Yi,Tr,xr,dn],[Xi,hn,Tn,jn,tr,ir,Hn,Vn,bn,In]),s=[Gt,zt,Jt,zi,$t,hr,dr,wr,mi],i=(this.plugins=[Mr,Bt].concat(c(i),s,[Nr,zr]),r?"mobile":y.device);switch(i){case"pc":(n=this.plugins).push.apply(n,[Ni,_i,cr,Kr,Yr]);break;case"mobile":(n=this.plugins).push.apply(n,[Oi]);break;default:(n=this.plugins).push.apply(n,[Ni,_i,cr])}!y.os.isIpad&&"pc"!==i||this.plugins.push(Rr),y.os.isIpad&&this.plugins.push(_i),this.ignores=[],this.i18n=[]}),S=(t($r,jt),Jr=i($r),e($r));function $r(){return p(this,$r),Jr.apply(this,arguments)}return u(S,"defaultPreset",Y),u(S,"Util",m),u(S,"Sniffer",y),u(S,"Errors",oe),u(S,"Events",qe),u(S,"Plugin",E),u(S,"BasePlugin",lt),u(S,"I18N",Pt),u(S,"STATE_CLASS",A),S}),((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.string.iterator.js"),require("xgplayer"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.json.stringify.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.promise.finally.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/esnext.typed-array.at.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/esnext.typed-array.find-last.js"),require("core-js/modules/esnext.typed-array.find-last-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.subarray.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.number.is-nan.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.set.js"),require("core-js/modules/es.number.is-finite.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.math.hypot.js"),require("core-js/modules/es.string.from-code-point.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.array.sort.js"),require("core-js/modules/es.regexp.flags.js"),require("core-js/modules/es.string.pad-start.js"),require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.typed-array.int8-array.js"),require("core-js/modules/es.typed-array.uint8-clamped-array.js"),require("core-js/modules/es.typed-array.int16-array.js"),require("core-js/modules/es.typed-array.uint16-array.js"),require("core-js/modules/es.typed-array.int32-array.js"),require("core-js/modules/es.typed-array.uint32-array.js"),require("core-js/modules/es.typed-array.float32-array.js"),require("core-js/modules/es.typed-array.float64-array.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.sticky.js"),require("core-js/modules/es.number.to-fixed.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.number.max-safe-integer.js"),require("core-js/modules/es.array.find-index.js")):"function"==typeof define&&define.amd?define(["core-js/modules/es.object.assign.js","core-js/modules/es.array.
1concat.js","core-js/modules/es.object.get-own-property-descriptor.js","core-js/modules/es.object.to-string.js","core-js/modules/es.promise.js","core-js/modules/es.array.slice.js","core-js/modules/es.array.join.js","core-js/modules/es.array.map.js","core-js/modules/es.array.from.js","core-js/modules/es.string.iterator.js","xgplayer","core-js/modules/es.regexp.exec.js","core-js/modules/es.regexp.test.js","core-js/modules/web.dom-collections.for-each.js","core-js/modules/es.object.keys.js","core-js/modules/es.array.iterator.js","core-js/modules/web.dom-collections.iterator.js","core-js/modules/web.url.js","core-js/modules/web.url-search-params.js","core-js/modules/es.array.splice.js","core-js/modules/es.function.name.js","core-js/modules/es.json.stringify.js","core-js/modules/es.array.includes.js","core-js/modules/es.promise.finally.js","core-js/modules/es.array.filter.js","core-js/modules/es.typed-array.uint8-array.js","core-js/modules/esnext.typed-array.at.js","core-js/modules/es.typed-array.copy-within.js","core-js/modules/es.typed-array.every.js","core-js/modules/es.typed-array.fill.js","core-js/modules/es.typed-array.filter.js","core-js/modules/es.typed-array.find.js","core-js/modules/es.typed-array.find-index.js","core-js/modules/esnext.typed-array.find-last.js","core-js/modules/esnext.typed-array.find-last-index.js","core-js/modules/es.typed-array.for-each.js","core-js/modules/es.typed-array.includes.js","core-js/modules/es.typed-array.index-of.js","core-js/modules/es.typed-array.iterator.js","core-js/modules/es.typed-array.join.js","core-js/modules/es.typed-array.last-index-of.js","core-js/modules/es.typed-array.map.js","core-js/modules/es.typed-array.reduce.js","core-js/modules/es.typed-array.reduce-right.js","core-js/modules/es.typed-array.reverse.js","core-js/modules/es.typed-array.set.js","core-js/modules/es.typed-array.slice.js","core-js/modules/es.typed-array.some.js","core-js/modules/es.typed-array.sort.js","core-js/modules/es.typed-array.subarray.js","core-js/modules/es.typed-array.to-locale-string.js","core-js/modules/es.typed-array.to-string.js","core-js/modules/es.string.replace.js","core-js/modules/es.number.is-nan.js","core-js/modules/es.number.constructor.js","core-js/modules/es.object.get-prototype-of.js","core-js/modules/es.symbol.js","core-js/modules/es.string.trim.js","core-js/modules/es.set.js","core-js/modules/es.number.is-finite.js","core-js/modules/es.array.find.js","core-js/modules/es.string.includes.js","core-js/modules/es.regexp.to-string.js","core-js/modules/es.math.hypot.js","core-js/modules/es.string.from-code-point.js","core-js/modules/es.string.match.js","core-js/modules/es.array.sort.js","core-js/modules/es.regexp.flags.js","core-js/modules/es.string.pad-start.js","core-js/modules/es.array-buffer.constructor.js","core-js/modules/es.typed-array.int8-array.js","core-js/modules/es.typed-array.uint8-clamped-array.js","core-js/modules/es.typed-array.int16-array.js","core-js/modules/es.typed-array.uint16-array.js","core-js/modules/es.typed-array.int32-array.js","core-js/modules/es.typed-array.uint32-array.js","core-js/modules/es.typed-array.float32-array.js","core-js/modules/es.typed-array.float64-array.js","core-js/modules/es.regexp.constructor.js","core-js/modules/es.regexp.sticky.js","core-js/modules/es.number.to-fixed.js","core-js/modules/es.string.split.js","core-js/modules/es.number.max-safe-integer.js","core-js/modules/es.array.find-index.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).HlsPlayer=t(0,0,0,0,0,0,0,0,0,0,e.Player)})(this,function(M,N,B,F,U,H,V,G,z,q,W){function K(t,e){var i,n=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)),n}function p(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?K(Object(i),!0).forEach(function(e){s(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):K(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function D(){D=function(){return a};var a={},e=Object.prototype,u=e.hasOwnProperty,l=Object.defineProperty||function(e,t,i){e[t]=i.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.asyncIterator||"@@asyncIterator",r=t.toStringTag||"@@toStringTag";function s(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,i){return e[t]=i}}function o(e,t,i,n){var r,s,a,o,t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype),n=new b(n||[]);return l(t,"_invoke",{value:(r=e,s=i,a=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var i=a.delegate;if(i){i=function e(t,i){var n=i.method,r=t.iterator[n];if(void 0===r)return i.delegate=null,"throw"===n&&t.iterator.return&&
1(i.method="return",i.arg=void 0,e(t,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;n=c(r,t.iterator,i.arg);if("throw"===n.type)return i.method="throw",i.arg=n.arg,i.delegate=null,h;r=n.arg;return r?r.done?(i[t.resultName]=r.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,h):r:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,h)}(i,a);if(i){if(i===h)continue;return i}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===o)throw o="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);o="executing";i=c(r,s,a);if("normal"===i.type){if(o=a.done?"completed":"suspendedYield",i.arg===h)continue;return{value:i.arg,done:a.done}}"throw"===i.type&&(o="completed",a.method="throw",a.arg=i.arg)}})}),t}function c(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}a.wrap=o;var h={};function d(){}function f(){}function p(){}var t={},g=(s(t,n,function(){return this}),Object.getPrototypeOf),g=g&&g(g(S([]))),m=(g&&g!==e&&u.call(g,n)&&(t=g),p.prototype=d.prototype=Object.create(t));function y(e){["next","throw","return"].forEach(function(t){s(e,t,function(e){return this._invoke(t,e)})})}function v(a,o){var t;l(this,"_invoke",{value:function(i,n){function e(){return new o(function(e,t){!function t(e,i,n,r){var s,e=c(a[e],a,i);if("throw"!==e.type)return(i=(s=e.arg).value)&&"object"==typeof i&&u.call(i,"__await")?o.resolve(i.__await).then(function(e){t("next",e,n,r)},function(e){t("throw",e,n,r)}):o.resolve(i).then(function(e){s.value=e,n(s)},function(e){return t("throw",e,n,r)});r(e.arg)}(i,n,e,t)})}return t=t?t.then(e,e):e()}})}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function b(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function S(t){if(t){var i,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return i=-1,(e=function e(){for(;++i<t.length;)if(u.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e}).next=e}return{next:x}}function x(){return{value:void 0,done:!0}}return l(m,"constructor",{value:f.prototype=p,configurable:!0}),l(p,"constructor",{value:f,configurable:!0}),f.displayName=s(p,r,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e},a.awrap=function(e){return{__await:e}},y(v.prototype),s(v.prototype,i,function(){return this}),a.AsyncIterator=v,a.async=function(e,t,i,n,r){void 0===r&&(r=Promise);var s=new v(o(e,t,i,n),r);return a.isGeneratorFunction(t)?s:s.next().then(function(e){return e.done?e.value:s.next()})},y(m),s(m,r,"Generator"),s(m,n,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,i=Object(e),n=[];for(t in i)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in i)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=S,b.prototype={constructor:b,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&u.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var n=this;function e(e,t){return s.type="throw",s.arg=i,n.next=e,t&&(n.method="next",n.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t],s=r.completion;if("root"===r.tryLoc)return e("end");if(r.tryLoc<=this.prev){var a=u.call(r,"catchLoc"),o=u.call(r,"finallyLoc");if(a&&o){if(this.prev<r.catchLoc)return e(r.catchLoc,!0);if(this.prev<r.finallyLoc)return e(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return e(r.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return e(r.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;0<=i;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var r=n;break}}var s=(r=r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc?null:r)?r.completion:{};return s.type=e,s.arg=t,r?(this.method="next",this.next=r.finallyLoc,h):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var i=this.tryEntries[t];
1if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),k(i),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var i,n,r=this.tryEntries[t];if(r.tryLoc===e)return"throw"===(i=r.completion).type&&(n=i.arg,k(r)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:S(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),h}},a}function Y(e){return(Y="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 X(e,t,i,n,r,s,a){try{var o=e[s](a),u=o.value}catch(e){return i(e)}o.done?t(u):Promise.resolve(u).then(n,r)}function A(o){return function(){var e=this,a=arguments;return new Promise(function(t,i){var n=o.apply(e,a);function r(e){X(n,t,i,r,s,"next",e)}function s(e){X(n,t,i,r,s,"throw",e)}r(void 0)})}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ue(n.key),n)}}function e(e,t,i){return t&&Q(e.prototype,t),i&&Q(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,i){(t=ue(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}function t(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function $(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function ee(e,t,i){return(ee=$()?Reflect.construct.bind():function(e,t,i){var n=[null],t=(n.push.apply(n,t),new(Function.bind.apply(e,n)));return i&&J(t,i.prototype),t}).apply(null,arguments)}function te(e){var i="function"==typeof Map?new Map:void 0;return(te=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return ee(e,arguments,Z(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),J(t,e)})(e)}function ie(e,t){if(null==e)return{};var i,n=((e,t)=>{if(null==e)return{};for(var i,n={},r=Object.keys(e),s=0;s<r.length;s++)i=r[s],0<=t.indexOf(i)||(n[i]=e[i]);return n})(e,t);if(Object.getOwnPropertySymbols)for(var r=Object.getOwnPropertySymbols(e),s=0;s<r.length;s++)i=r[s],0<=t.indexOf(i)||Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i]);return n}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(i){var n=$();return function(){var e,t=Z(i),t=(e=n?(e=Z(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),this);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)}}function ne(){return(ne="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=((e,t)=>{for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Z(e)););return e})(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:i):n.value}).apply(this,arguments)}function re(e,t){return(e=>{if(Array.isArray(e))return e})(e)||((e,t)=>{var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,s,a,o=[],u=!0,l=!1;try{if(s=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=s.call(i)).done)&&(o.push(n.value),o.length!==t);u=!0);}catch(e){l=!0,r=e}
1finally{try{if(!u&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(l)throw r}}return o}})(e,t)||se(e,t)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function m(e){return(e=>{if(Array.isArray(e))return ae(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||se(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function se(e,t){var i;if(e)return"string"==typeof e?ae(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ae(e,t):void 0}function ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function oe(e,t){var i,n,r,s,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return r=!(n=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return n=e.done,e},e:function(e){r=!0,i=e},f:function(){try{n||null==a.return||a.return()}finally{if(r)throw i}}};if(Array.isArray(e)||(a=se(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),s=0,{s:t=function(){},n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ue(e){e=(e=>{if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")})(e);return"symbol"==typeof e?e:String(e)}e(Le,null,[{key:"start",value:function(e){return!e||!e.length||1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0)}},{key:"end",value:function(e){return!e||!e.length||1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1)}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var i=[],n=0,r=e.length;n<r;n++){var s,a=i.length;a&&t&&(s=(a=i[a-1])[1],e.start(n)-s<=t)?s<(s=e.end(n))&&(a[1]=s):i.push([e.start(n),e.end(n)])}return i}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce(function(e,t){return e+(t[1]-t[0])},0):0}},{key:"info",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(!e||!e.length)return{start:0,end:0,buffers:[]};for(var n=0,r=0,s=0,a=0,o=0,u=0,l=0,c=Le.buffers(e,i),h=0,d=c.length;h<d;h++){var f=c[h];if(t+i>=f[0]&&t<=f[1])n=f[0],r=f[1],s=h;else{if(t+i<f[0]){a=f[0],o=f[1];break}t+i>f[1]&&(u=f[0],l=f[1])}}return{start:n,end:r,index:s,buffers:c,nextStart:a,nextEnd:o,prevStart:u,prevEnd:l,currentTime:t,behind:t-n,remaining:r?r-t:0,length:Le.totalLength&&Le.totalLength(c)}}},{key:"isBuffered",value:function(e,t){if(e){var i=Le.get(e);if(null!=i&&i.length)for(var n=0;n<i.length;n++)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}}]);var le,u=Le,ce="undefined"!=typeof window,he="manifest",de="network",fe="network_timeout",pe="media",ge="other",me="HLS",ye="FMP4",ve="MSE_ADD_SB",_e="MSE_APPEND_BUFFER",ke="MSE_OTHER",be="MSE_FULL",Se="MSE_CHANGE_TYPE",xe="OPTION",we=(s(n={},he,{HLS:1100,DASH:1200}),s(n,de,2100),s(n,fe,2101),s(n,"network_forbidden",2103),s(n,"network_notfound",2104),s(n,"network_range_not_satisfiable",2116),s(n,"demux",{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),s(n,"remux",{FMP4:4100,MP4:4200}),s(n,pe,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,MSE_CHANGE_TYPE:5205,EME_HIJACK:5301}
1),s(n,"drm",{LICENSE:7100,CUSTOM_LICENSE:7200}),s(n,ge,8e3),s(n,"runtime",{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),n),_=(t(Ae,te(Error)),le=i(Ae),e(Ae,null,[{key:"create",value:function(e,t,i,n,r){return e instanceof Ae?e:(e instanceof Error&&(i=e,e=""),new Ae(e=e||ge,t,i,n,r))}},{key:"network",value:function(e){return new Ae(null!=e&&e.isTimeout?fe:de,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null==(e=e.response)?void 0:e.status})}}]),Ae),Te={DEBUG:1,LOG:2,WARN:3,ERROR:4},Ee=["Boolean","Number","String","Undefined","Null","Date","Object"],Ce=(e(De,[{key:"debug",value:function(){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];this.logCache.apply(this,[Te.DEBUG].concat(i)),De.disabled||(e=console).debug.apply(e,["[".concat(Pe(),"]"),this._prefix].concat(i))}},{key:"log",value:function(){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];this.logCache.apply(this,[Te.LOG].concat(i)),De.disabled||(e=console).log.apply(e,["[".concat(Pe(),"]"),this._prefix].concat(i))}},{key:"warn",value:function(){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];this.logCache.apply(this,[Te.WARN].concat(i)),De.disabled||(e=console).warn.apply(e,["[".concat(Pe(),"]"),this._prefix].concat(i))}},{key:"error",value:function(){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];this.logCache.apply(this,[Te.ERROR].concat(i)),De.disabled||(e=console).error.apply(e,["[".concat(Pe(),"]"),this._prefix].concat(i))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var i=arguments.length,n=new Array(1<i?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];var s=n.map(function(e){return function e(t,i,n){n=n||1,i=i||2;var r={};if(!t||"object"!==Y(t))return t;var s=Object.prototype.toString.call(t).slice(8,-1);if(!Ee.includes(s))return s;if(!(i<n)){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n===i?r[a]=Ie(t[a]):"object"===Y(t[a])?r[a]=e(t[a],i,n+1):r[a]=t[a]);return r}}(e)}),t="[".concat(Pe(),"]")+this._prefix+JSON.stringify(s)}catch(e){return}e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize&&(s=this.logTextArray.shift(),this.logSize-=s.length)}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var e;De.disabled||(console.group(this._prefix),(e=console).table.apply(e,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){De.disabled=!1}},{key:"disable",value:function(){De.disabled=!0}}]),De);function De(e,t){l(this,De),this.name=e||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==t?void 0:t.logCacheLevel)||3,this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}function Ae(e,t,i,n,r){return l(this,Ae),(r=le.call(this,r||(null==i?void 0:i.message))).errorType=e===fe?de:e,r.originError=i,r.ext=n,r.errorCode=we[e][t]||we[e],r.errorMessage=r.message,r.errorCode||(r.errorType=ge,r.errorCode=we[r.errorType]),r}function Le(){l(this,Le)}function Pe(){return(new Date).toLocaleString()}function Ie(e){if("object"!==Y(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function Oe(){var i,n,e=new Promise(function(e,t){i=e,n=t});return e.used=!1,e.resolve=function(){return e.used=!0,i.apply(void 0,arguments)},e.reject=function(){return e.used=!0,n.apply(void 0,arguments)},e}function Re(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}s(Ce,"disabled",!0);function je(e){e=!(0<arguments.length&&void 0!==e)||e;try{return ce?e&&"undefined"!=typeof ManagedMediaSource?ManagedMediaSource:window.MediaSource:null}catch(e){}}function Me(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var Ne,Be,Fe,Ue="updateDuration",v=(e(He,[{key:"isOpened",get:function(){var e;return"open"===(null==(e=this.mediaSource)?void 0:e.readyState)}},{key:"hasOpTasks",get:function(){var t=this,i=!1;return Object.keys(this._queue).forEach(function(e){e=t._queue[e];Array.isArray(e)&&(i=i||0<e.length)}),i}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null==(e=this.mediaSource)?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!Me(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(e){return e?this._mseFullFlag[e]:this._mseFullFlag[He.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,i=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var n=0;if(Object.keys(this._sourceBuffer).forEach(function(e){try{n=Math.max(t.bufferEnd(e)||0,n)}catch(e){}}),e<n)return Promise.resolve()}return this._enqueueBlockingOp(function(){t.isEnded?t._logger.debug("setDuration but ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("setDuration",e))},Ue,{isReduceDuration:i})}},{key:"open",value:function(){var i,n=this;return this._openPromise.used&&!this.isOpened&&this.mediaSource&&((i=this.mediaSource).addEventListener("sourceopen",function e(){var t=Re()-n._st;n._logger.debug("sourceopen",t),i.removeEventListener("sourceopen",e),n._openPromise.resolve({costtime:t})}),this._openPromise=Oe()),this._openPromise}},{key:"bindMedia",value:(Fe=A(D().mark(function e(i){var t,n,r,s,a=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource||this.media)return e.next=3,this.unbindMedia();e.next=3;break;case 3:if(t=je(this._config.preferMMS),i&&t){e.next=6;break}throw new Error("Param media or MediaSource does not exist");case 6:return this.media=i,n=this.mediaSource=new t,r=Me(n),this._st=Re(),s=function e(){var t=Re()-a._st;a._logger.debug("sourceopen"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(i.src),a._openPromise.resolve({costtime:t})},n.addEventListener("sourceopen",s),r&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming)),this._url=URL.createObjectURL(n),i.src=this._url,i.disableRemotePlayback=r,e.abrupt("return",this._openPromise);case 17:case"end":return e.stop()}},e,this)})),function(e){return Fe.apply(this,arguments)})},{key:"unbindMedia",value:(Be=A(D().mark(function e(){var t,i,n,r=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach(function(e){e=r._queue[e];e&&e.forEach(function(e){var t;return null==(e=e.promise)||null==(t=e.resolve)?void 0:t.call(e)})}),i=!!this.media&&1<=this.media.readyState,n="open"===t.readyState,i&&n)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach(function(e){try{t.removeSourceBuffer(r._sourceBuffer[e])}catch(e){}}),Me(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=Oe(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}},e,this)})),function(){return Be.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var i;try{i=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new _(pe,ve,e)}i.mimeType=t,i.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),i.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var i=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t?"function"!=typeof n.changeType?Promise.reject(new _(pe,Se,new Error("changeType is not a function"))):this._enqueueOp(e,function(){try{n.changeType(t)}catch(e){throw new _(pe,Se,e)}n.mimeType=t,i._onSBUpdateEnd(e)},"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(t,i,n){var r=this;return i&&i.byteLength&&this._sourceBuffer[t]?this._enqueueOp(t,function(){var e;r.mediaSource&&!r.media.error&&(r._logger.debug("MSE APPEND START",n),r._opst=Re(),null!=(e=r._sourceBuffer[t]))&&e.appendBuffer(i)},"appendBuffer",n):Promise.resolve()}},{key:"remove",value:function(t,i,n,r){var s=this,e=!1;return this._mseFullFlag[t]&&(e=!0),this._enqueueOp(t,function(){var e;s.mediaSource&&!s.media.error&&(e=s._sourceBuffer[t],n<=i||!e?s._onSBUpdateEnd(t):(s._opst=Re(),s._logger.debug("MSE REMOVE START",t,i,n,r),e.remove(i,n)))},"removeBuffer",r,e)}},{key:"clearBuffer",value:function(t,i){var n,r=this;return Object.keys(this._sourceBuffer).forEach(function(e){n=r.remove(e,t,i)}),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var i,n=this;return Object.keys(this._sourceBuffer).forEach(function(e){var t=n._sourceBuffer[e];i=n.remove(e,0,u.end(u.get(t)))}),i}},{key:"clearOpQueues",value:function(e,t){this._logger.debug("MSE clearOpQueue START");var i,n=this._queue[e];
1t&&n?this._queue[e]=[]:!n||!n[e]||n.length<5||(i=[],n.forEach(function(e){e.context&&e.context.isinit&&i.push(e)}),this._queue[e]=n.slice(0,2),0<i.length&&(t=this._queue[e]).push.apply(t,i))}},{key:"endOfStream",value:function(t){var i=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp(function(){var e=i.mediaSource;e&&"open"===e.readyState&&(i._logger.debug("MSE endOfStream START"),t?e.endOfStream(t):e.endOfStream())},"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var i=this.mediaSource;e<0||t<e||null==i||!i.setLiveSeekableRange||"open"!==i.readyState||i.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return u.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return u.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return u.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,i,n,r){var s,a=this;return this.mediaSource?(s=this._queue[e]=this._queue[e]||[],t={exec:t,promise:Oe(),opName:i,context:n},r?(s.splice(0,0,t),this._mseFullFlag[e]=!1,this._startQueue(e)):s.push(t),this.isOpened||this.isEnded?1===s.length&&this._startQueue(e):this._openPromise.then(function(){1===s.length&&a._startQueue(e)}),t.promise):Promise.resolve()}},{key:"_enqueueBlockingOp",value:(Ne=A(D().mark(function e(t,n,r){var i,s,a=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return s=[],i.forEach(function(e){var t=a._queue[e],i=Oe();s.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:n,context:r}),1===t.length&&a._startQueue(e)}),e.abrupt("return",Promise.all(s).then(function(){try{return t()}finally{i.forEach(function(e){var t=a._queue[e],i=a._sourceBuffer[e];null!=t&&t.shift(),i&&i.updating||a._startQueue(e)})}}));case 8:case"end":return e.stop()}},e,this)})),function(e,t,i){return Ne.apply(this,arguments)})},{key:"_startQueue",value:function(t){var i=this._queue[t];if(i){var n,r=i[0];if(r&&!this._mseFullFlag[t])try{r.exec()}catch(e){e&&e.message&&0<=e.message.indexOf("SourceBuffer is full")?(this._mseFullFlag[t]=!0,r.context&&"object"===Y(r.context)&&(r.context.isFull=!0),this._logger.error("[MSE error],  context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),null!=r&&null!=(n=r.promise)&&n.reject(new _(pe,be,e))):(this._logger.error(e),null!=r&&null!=(n=r.promise)&&n.reject(e.constructor===_?e:new _(pe,ke,e)),i.shift(),this._startQueue(t))}}}},{key:"setTimeoffset",value:function(e,t,i){var n=this;return this._enqueueOp(e,function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)},"setTimeoffset",i)}},{key:"abort",value:function(e,t){var i=this;return this.isOpened?this._enqueueOp(e,function(){i._sourceBuffer[e].abort(),i._onSBUpdateEnd(e)},"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',e=je();if(!e)return!1;try{return e.isTypeSupported(t)}catch(e){return this._logger.error(t,e),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),He);function He(e,t){var r=this;l(this,He),s(this,"media",null),s(this,"mediaSource",null),s(this,"_openPromise",Oe()),s(this,"_queue",Object.create(null)),s(this,"_sourceBuffer",Object.create(null)),s(this,"_mseFullFlag",{}),s(this,"_st",0),s(this,"_opst",0),s(this,"_logger",null),s(this,"_config",null),s(this,"_url",null),s(this,"_onStartStreaming",function(){r._logger.debug("startstreaming")}),s(this,"_onEndStreaming",function(){r._logger.debug("endstreaming")}),s(this,"_onSBUpdateEnd",function(e){var t,i,n=r._queue[e];n&&((null==(t=n[0])?void 0:t.opName)!==Ue&&n.shift(),t)&&(n=Re()-r._opst,r._logger.debug("UpdateEnd(".concat(e,"/").concat(t.opName,")"),(e=>{try{return JSON.stringify(e)}catch(e){return""}})((e=>{var t=[];if(e instanceof TimeRanges)for(var i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t})(null==(i=r._sourceBuffer[e])?void 0:i.buffered)),n,t.context),t.promise.resolve({name:t.opName,context:t.context,costtime:n}),(n=null==(i=t.context)?void 0:i.callback)&&"function"==typeof n&&n(t.context),r._startQueue(e))}),s(this,"_onSBUpdateError",function(e,t){var i=r._queue[e];i&&(i=i[0])&&(r._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new _(pe,_e,t)))}),this._config=Object.assign(He.getDefaultConfig(),t),e&&this.bindMedia(e),this._logger=new Ce("MSE"),this._config.openLog&&Ce.enable()}s(v,"VIDEO","video"),s(v,"AUDIO","audio");var Ve,Ge="fetch",ze="arraybuffer",qe=(t(Ke,te(Error)),Ve=i(Ke),e(Ke)),We=Object.prototype.toString;function Ke(e,t,i,n){return l(this,Ke),s(o(n=Ve.call(this,n)),"retryCount",0),s(o(n),"isTimeout",!1),s(o(n),"loaderType",Ge),s(o(n),"startTime",0),s(o(n),"endTime",0),s(o(n),"options",{}),n.url=e,n.request=t,n.response=i,n}function Ye(e){if("[object Object]"===We.call(e))return null===(e=Object.getPrototypeOf(e))||e===Object.prototype}function Xe(e){var t;if(e&&null!=e[0]&&(0!==e[0]||null!=e[1]))return t="bytes="+e[0]+"-",e[1]&&(t+=e[1]),t}function Qe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ze(e,t){var n,i,r;if(e)return t&&(i=Object.keys(t).map(function(i){if(null!=(n=t[i]))return Array.isArray(n)?i+="[]":n=[n],n.map(function(e){var t=e;return"[object Date]"===We.call(t)?e=e.toISOString():null!==e&&"object"===Y(e)&&(e=JSON.stringify(e)),"".concat(Qe(i),"=").concat(Qe(e))}).join("&")}
1).filter(Boolean).join("&"))&&(-1!==(r=e.indexOf("#"))&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+i),e}function Je(e,t,i,n,r,s,a,o,u,l,c){return r=null!=r?parseFloat(r):null,n=parseInt(n||"0",10),{data:e,done:t,options:{range:u,vid:l,index:o,contentLength:n=Number.isNaN(n)?0:n,age:r,startTime:s,firstByteTime:a,endTime:Date.now(),priOptions:c},response:i}}function $e(e,t){return Math.round(8*e*1e3/t/1024)}var et,f,L={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",MEDIASOURCE_OPENED:"core.mediasourceopened",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",APPEND_BUFFER:"core.appendbuffer",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",CHASEFRAME:"core.chaseframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",DEMUXED_TRACK:"core.demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},n={exports:{}};function tt(){}function it(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function nt(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");i=new it(i,n||e,r),n=f?f+t:t;return e._events[n]?e._events[n].fn?e._events[n]=[e._events[n],i]:e._events[n].push(i):(e._events[n]=i,e._eventsCount++),e}function rt(e,t){0==--e._eventsCount?e._events=new tt:delete e._events[t]}function r(){this._events=new tt,this._eventsCount=0}ot=n,et=Object.prototype.hasOwnProperty,f="~",Object.create&&(tt.prototype=Object.create(null),(new tt).__proto__||(f=!1)),r.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)et.call(e,t)&&i.push(f?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},r.prototype.listeners=function(e){var e=f?f+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,n=t.length,r=new Array(n);i<n;i++)r[i]=t[i].fn;return r},r.prototype.listenerCount=function(e){e=f?f+e:e,e=this._events[e];return e?e.fn?1:e.length:0},r.prototype.emit=function(e,t,i,n,r,s){var a=f?f+e:e;if(!this._events[a])return!1;var o,u=this._events[a],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,n),!0;case 5:return u.fn.call(u.context,t,i,n,r),!0;case 6:return u.fn.call(u.context,t,i,n,r,s),!0}for(d=1,o=new Array(l-1);d<l;d++)o[d-1]=arguments[d];u.fn.apply(u.context,o)}else for(var c,h=u.length,d=0;d<h;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,t);break;case 3:u[d].fn.call(u[d].context,t,i);break;case 4:u[d].fn.call(u[d].context,t,i,n);break;default:if(!o)for(c=1,o=new Array(l-1);c<l;c++)o[c-1]=arguments[c];u[d].fn.apply(u[d].context,o)}return!0},r.prototype.on=function(e,t,i){return nt(this,e,t,i,!1)},r.prototype.once=function(e,t,i){return nt(this,e,t,i,!0)},r.prototype.removeListener=function(e,t,i,n){e=f?f+e:e;if(this._events[e])if(t){var r=this._events[e];if(r.fn)r.fn!==t||n&&!r.once||i&&r.context!==i||rt(this,e);else{for(var s=0,a=[],o=r.length;s<o;s++)(r[s].fn!==t||n&&!r[s].once||i&&r[s].context!==i)&&a.push(r[s]);a.length?this._events[e]=1===a.length?a[0]:a:rt(this,e)}}else rt(this,e);return this},r.prototype.removeAllListeners=function(e){return e?(e=f?f+e:e,this._events[e]&&rt(this,e)):(this._events=new tt,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=f,ot.exports=r.EventEmitter=r;var st,at,ot=n.exports,ut=(t(lt,ot),at=i(lt),e(lt,[{key:"load",value:function(e){var u=this,l=e.url,t=e.vid,i=e.timeout,c=e.responseType,h=e.onProgress,d=e.index,n=e.onTimeout,r=e.onCancel,f=e.range,p=e.transformResponse,s=e.request,a=e.params,o=e.method,g=e.headers,m=e.body,y=e.mode,v=e.credentials,_=e.cache,k=e.redirect,b=e.referrer,S=e.referrerPolicy,x=e.onProcessMinLen,w=e.priOptions,T=(this._logger=e.logger,this._aborted=!1,this._onProcessMinLen=x,this._onCancel=r,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=d,this._range=f||[0,0],this._vid=t||l,this._priOptions=w||{},{method:o,headers:g,body:m,mode:y,credentials:v,cache:_,redirect:k,referrer:b,referrerPolicy:S,signal:null==(e=this._abortController)?void 0:e.signal}),E=!1,x=(clearTimeout(this._timeoutTimer),l=Ze(l,a),Xe(f)),C=(x&&(g=s?s.headers:T.headers=T.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",x):g.Range=x),i&&(this._timeoutTimer=setTimeout(function(){var e;E=!0,u.cancel(),n&&((e=new qe(l,T,null,"timeout")).isTimeout=!0,n(e,{index:u._index,range:u._range,vid:u._vid,priOptions:u._priOptions}))},i)),Date.now());return this._logger.debug("[fetch load start], index,",d,",range,",f),new Promise(function(a,o){var t;fetch(s||l,s?void 0:T).then((t=A(D().mark(function e(t){var i,n,r,s;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(clearTimeout(u._timeoutTimer),u._response=t,u._aborted||!u._running)return e.abrupt("return");e.next=4;break;case 4:if((t=p?p(t,l)||t:t).ok){e.next=7;break}throw new qe(l,T,t,"bad network response");case 7:if(i=Date.now(),"text"===c)return e.next=11,t.text();e.next=15;break;case 11:n=e.sent,u._running=!1,e.next=37;break;case 15:if("json"===c)return e.next=18,t.json();e.next=22;break;case 18:n=e.sent,u._running=!1,e.next=37;break;case 22:if(h)return u.resolve=a,u.reject=o,u._loadChunk(t,h,C,i),e.abrupt("return");e.next=29;break;case 29:return e.next=31,t.arrayBuffer();case 31:n=e.sent,n=new Uint8Array(n),u._running=!1,r=Date.now()-C,s=$e(n.byteLength,r),u.emit(L.REAL_TIME_SPEED,{speed:s,len:n.byteLength,time:r,vid:u._vid,index:u._index,range:u._range,priOptions:u._priOptions});case 37:u._logger.debug("[fetch load end], index,",d,",range,",f),a(Je(n,!0,t,t.headers.get("Content-Length"),t.headers.get("age"),C,i,d,f,u._vid,u._priOptions));case 39:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)})).catch(function(e){var t;clearTimeout(u._timeoutTimer),u._running=!1,u._aborted&&!E||((e=e instanceof qe?e:new qe(l,T,null,null==(t=e)?void 0:t.message)).startTime=C,e.endTime=Date.now(),e.isTimeout=E,e.options={index:u._index,range:u._range,vid:u._vid,priOptions:u._priOptions},o(e))})})}},{key:"cancel",value:(st=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._aborted)return e.abrupt("return");e.next=2;break;case 2:if(this._aborted=!0,this._running=!1,this._response){if(e.prev=5,this._reader)return e.next=9,this._reader.cancel();e.next=9}else e.next=14;break;case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}},e,this,[[5,11]])})),function(){return st.apply(this,arguments)})},{key:"_loadChunk",value:function(a,o,u,l){var e,c,h,d,f,p,t,g=this;a.body&&a.body.getReader?(0<this._onProcessMinLen&&(this._cache=new Uint8Array(2097152),this._writeIdx=0),f=this._reader=a.body.getReader(),t=A(D().mark(function e(){var t,i,n,r,s;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return h=Date.now(),e.prev=1,e.next=4,f.read();case 4:c=e.sent,d=Date.now(),e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(1),d=Date.now(),g._aborted||(g._running=!1,e.t0.options={index:g._index,range:g._range,vid:g._vid,priOptions:g._priOptions},g.reject(e.t0)),e.abrupt("return");case 13:if(t=0<(null==(t=g._range)?void 0:t.length)?g._range[0]:0,i=t+g._receivedLength,g._aborted)return g._running=!1,o(void 0,!1,{range:[i,i],vid:g._vid,index:g._index,startTime:h,endTime:d,st:u,firstByteTime:l,priOptions:g._priOptions},a),e.abrupt("return");e.next=19;break;case 19:s=c.value?c.value.byteLength:0,g._receivedLength+=s,g._logger.debug("【fetchLoader,onProgress call】,task,",g._range,", start,",i,", end,",t+g._receivedLength,", done,",c.done),0<g._onProcessMinLen?g._writeIdx+s>=g._onProcessMinLen||c.done?((n=new Uint8Array(g._writeIdx+s)).set(g._cache.slice(0,g._writeIdx),0),0<s&&n.set(c.value,g._writeIdx),g._writeIdx=0,g._logger.debug("【fetchLoader,onProgress enough】,done,",c.done,",len,",n.byteLength,", writeIdx,",g._writeIdx)):0<s&&g._writeIdx+s<2097152?(g._cache.set(c.value,g._writeIdx),g._writeIdx+=s,g._logger.debug("【fetchLoader,onProgress cache】,len,",s,", writeIdx,",g._writeIdx)):0<s&&(r=new Uint8Array(g._writeIdx+s+2048),g._logger.debug("【fetchLoader,onProgress extra start】,size,",g._writeIdx+s+2048,", datalen,",s,", writeIdx,",g._writeIdx),r.set(g._cache.slice(0,g._writeIdx),0),0<s&&r.set(c.value,g._writeIdx),g._writeIdx+=s,delete g._
1cache,g._cache=r,g._logger.debug("【fetchLoader,onProgress extra end】,len,",s,", writeIdx,",g._writeIdx)):n=c.value,(n&&0<n.byteLength||c.done)&&o(n,c.done,{range:[g._range[0]+g._receivedLength-(n?n.byteLength:0),g._range[0]+g._receivedLength],vid:g._vid,index:g._index,startTime:h,endTime:d,st:u,firstByteTime:l,priOptions:g._priOptions},a),c.done?(r=Date.now()-u,s=$e(g._receivedLength,r),g.emit(L.REAL_TIME_SPEED,{speed:s,len:g._receivedLength,time:r,vid:g._vid,index:g._index,range:g._range,priOptions:g._priOptions}),g._running=!1,g._logger.debug("[fetchLoader onProgress end],task,",g._range,",done,",c.done),g.resolve(Je(c,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),u,l,g._index,g._range,g._vid,g._priOptions))):p();case 25:case"end":return e.stop()}},e,null,[[1,8]])})),(p=function(){return t.apply(this,arguments)})()):(this._running=!1,(e=new qe(a.url,"",a,"onProgress of bad response.body.getReader")).options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e))}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),lt);function lt(){var e;return l(this,lt),s(o(e=at.call(this)),"_abortController",null),s(o(e),"_timeoutTimer",null),s(o(e),"_reader",null),s(o(e),"_response",null),s(o(e),"_aborted",!1),s(o(e),"_index",-1),s(o(e),"_range",null),s(o(e),"_receivedLength",0),s(o(e),"_running",!1),s(o(e),"_logger",null),s(o(e),"_vid",""),s(o(e),"_onProcessMinLen",0),s(o(e),"_onCancel",null),s(o(e),"_priOptions",null),e}t(mt,ot),ht=i(mt),e(mt,[{key:"load",value:function(e){var i=this,t=(clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=Ze(e.url,e.params),Date.now());return new Promise(function(e,t){i._loadCompleteResolve=e,i._loadCompleteReject=t,i._startLoad()}).catch(function(e){if(clearTimeout(i._timeoutTimer),i._runing=!1,!i._aborted)throw(e=e instanceof qe?e:new qe(i._url,i._request)).startTime=t,e.endTime=Date.now(),e.options={index:i._index,vid:i._vid,priOptions:i._priOptions},e})}},{key:"_startLoad",value:function(){var e,t,i,n=null;this._responseType===ze&&this._range&&1<this._range.length&&(this._onProgress?(this._firstRtt=-1,e=1024*this._currentChunkSizeKB,t=this._range[0]+this._receivedLength,i=this._range[1],e<this._range[1]-t&&(i=t+e),this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",n=[t,i])):(n=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",n))),this._internalOpen(n)}},{key:"_internalOpen",value:function(t){var i=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest,r=(n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){i._running=!1;var t,e=new qe(i._url,i._request,null==e||null==(t=e.currentTarget)?void 0:t.response,"xhr.onerror.status:"+(null==e||null==(t=e.currentTarget)?void 0:t.status)+",statusText,"+(null==e||null==(t=e.currentTarget)?void 0:t.statusText));e.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i._loadCompleteReject(e)},n.ontimeout=function(e){i.cancel();var t=new qe(i._url,i._request,{status:408},"timeout");i._onTimeout&&(t.isTimeout=!0,i._onTimeout(t,{index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions})),t.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i._loadCompleteReject(t)},this._headers||{}),e=Xe(t);e&&(r.Range=e),r&&Object.keys(r).forEach(function(e){n.setRequestHeader(e,r[e])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",t),n.send(this._body)}catch(e){e.options={index:this._index,range:t,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(e)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||299<t)return(s=new qe(this._url,null,p(p({},e.target.response),{},{status:t}),"bad response,status:"+t)).options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(s);var i,n,r,s=null,a=!1,o=0<(null==(o=this._range)?void 0:o.length)?this._range[0]:0,u=(this._responseType===ze?(i=new Uint8Array(e.target.response),r=o+this._receivedLength,i&&0<i.byteLength&&(this._receivedLength+=i.byteLength,u=Date.now()-this._startTime,n=$e(this._receivedLength,u),this.emit
1(L.REAL_TIME_SPEED,{speed:n,len:this._receivedLength,time:u,vid:this._vid,index:this._index,range:[r,o+this._receivedLength],priOptions:this._priOptions})),a=!(1<(null==(n=this._range)?void 0:n.length)&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",r,"end ",o+this._receivedLength,",dataLen,",(s=i)?i.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)):(a=!0,s=e.target.response),{ok:200<=t&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response});this._transformResponse&&(u=this._transformResponse(u,this._url)||u),this._onProgress&&this._onProgress(s,a,{index:this._index,vid:this._vid,range:[r,o+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},u),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Je(this._onProgress?null:s,a,u,u.headers["content-length"],u.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,ne(Z(mt.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,i={},n=oe(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var r=t.value.split(": ");i[r[0].toLowerCase()]=r.slice(1).join(": ")}}catch(e){n.e(e)}finally{n.f()}return i}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]);var ct,ht,dt=mt,ft=["retry","retryDelay","onRetryError","transformError"],pt=(e(gt,[{key:"exec",value:function(){var e,n=this,t=this._config,r=t.retry,s=t.retryDelay,a=t.onRetryError,o=t.transformError,u=ie(t,ft),l=(e=A(D().mark(function e(){var t,i;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n._loader.load(u);case 3:i=e.sent,n.promise.resolve(i),e.next=27;break;case 7:if(e.prev=7,e.t0=e.catch(0),n._loader.running=!1,n._logger.debug("[task request catch err]",e.t0),n._canceled)return e.abrupt("return");e.next=13;break;case 13:if(e.t0.loaderType=n._loaderType,e.t0.retryCount=n._retryCount,t=e.t0,o&&(t=o(t)||t),a&&0<n._retryCount&&a(t,n._retryCount,{index:u.index,vid:u.vid,range:u.range,priOptions:u.priOptions}),n._retryCount++,i=!0,(i=n._retryCheckFunc?n._retryCheckFunc(e.t0):i)&&n._retryCount<=r)return clearTimeout(n._retryTimer),n._logger.debug("[task request setTimeout],retry",n._retryCount,",retry range,",u.range),n._retryTimer=setTimeout(l,s),e.abrupt("return");e.next=26;break;case 26:n.promise.reject(t);case 27:case"end":return e.stop()}},e,null,[[0,7]])})),function(){return e.apply(this,arguments)});return l(),this.promise}},{key:"cancel",value:(ct=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}},e,this)})),function(){return ct.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),gt);function gt(e,t){l(this,gt),this.promise=Oe(),this.alive=!!t.onProgress,t.logger||(t.logger=new Ce("Loader")),this._loaderType=e,this._loader=new(e===Ge&&"undefined"!=typeof fetch?ut:dt),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc,this._logger=t.logger}function mt(){var e;return l(this,mt),s(o(e=ht.call(this)),"_xhr",null),s(o(e),"_aborted",!1),s(o(e),"_timeoutTimer",null),s(o(e),"_range",null),s(o(e),"_receivedLength",0),s(o(e),"_url",null),s(o(e),"_onProgress",null),s(o(e),"_index",-1),s(o(e),"_headers",null),s(o(e),"_currentChunkSizeKB",384),s(o(e),"_timeout",null),s(o(e),"_xhr",null),s(o(e),"_withCredentials",null),s(o(e),"_startTime",-1),s(o(e),"_loadCompleteResolve",null),s(o(e),"_loadCompleteReject",null),s(o(e),"_runing",!1),s(o(e),"_logger",!1),s(o(e),"_vid",""),s(o(e),"_responseType",void 0),s(o(e),"_credentials",void 0),s(o(e),"_method",void 0),s(o(e),"_transformResponse",void 0),s(o(e),"_firstRtt",void 0),s(o(e),"_onCancel",null),s(o(e),"_priOptions",null),e}function yt(){for(var t,i,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];
1return(n=n.filter(Boolean)).length<2?n[0]:(t=new Uint8Array(n.reduce(function(e,t){return e+t.byteLength},0)),i=0,n.forEach(function(e){t.set(e,i),i+=e.byteLength}),t)}t(li,ot),bt=i(li),e(li,[{key:"isFetch",value:function(){return this.type===Ge}},{key:"load",value:function(e){var t=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=("string"!=typeof e&&e?i=e:i.url=e||i.url||this._config.url,(i=Object.assign({},this._config,i)).params&&(i.params=Object.assign({},i.params)),i.headers&&Ye(i.headers)&&(i.headers=Object.assign({},i.headers)),i.body&&Ye(i.body)&&(i.body=Object.assign({},i.body)),(i=i.transformRequest?i.transformRequest(i)||i:i).logger=this.log,new pt(this.type,i));return e.loader.on(L.REAL_TIME_SPEED,function(e){t.emit(L.REAL_TIME_SPEED,e)}),this._queue.push(e),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),e.promise}},{key:"cancel",value:(kt=A(D().mark(function e(){var t;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map(function(e){return e.cancel()}).concat(this._alive.map(function(e){return e.cancel()})),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,function(e){var t=0<arguments.length&&void 0!==e?e:0;return new Promise(function(e){return setTimeout(e,t)})}();case 8:case"end":return e.stop()}},e,this)})),function(){return kt.apply(this,arguments)})},{key:"_processTask",value:function(){var e,t=this;this._currentTask=this._queue.shift(),this._currentTask&&(this._currentTask.alive&&this._alive.push(this._currentTask),e=this._currentTask.exec().catch(function(e){}))&&"function"==typeof e.finally&&e.finally(function(){var e;null!=(e=t._currentTask)&&e.alive&&0<(null==(e=t._alive)?void 0:e.length)&&(t._alive=t._alive.filter(function(e){return e&&e!==t._currentTask})),t._processTask()})}}],[{key:"isFetchSupport",value:function(){return ut.isSupported()}}]);var vt,_t,kt,bt,St=li,xt=(e(ui,[{key:"do",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:3,i=2<arguments.length?arguments[2]:void 0,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;if(e){var r=e.currentTime,s=0;if(this._prevCurrentTime===r){var a=u.info(u.get(e),r);if(!a.buffers.length)return;i&&a.nextStart||a.nextStart&&a.nextStart-r<t?s=a.nextStart+.1:a.end&&a.end-r>n&&!e.seeking&&(s=r+.1)}this._prevCurrentTime=r,s&&r!==s&&(e.currentTime=s)}}}]),ui),wt=(e(oi,[{key:"throw",value:function(t,e){var i,n,r,s=this;null!=t&&this._seiSet.size&&(i=t-.2,n=t+.2,r=[],this._seiSet.forEach(function(e){e.time>=i&&e.time<=n&&r.push(e)}),r.forEach(function(e){s._seiSet.delete(e),s.emitter.emit(L.SEI_IN_TIME,e)}),e)&&this._seiSet.forEach(function(e){e.time<t-5&&s._seiSet.delete(e)})}},{key:"reset",value:function(){this._seiSet.clear()}}]),oi),Tt=(e(ai,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){var i;!e||!t||e<((null==(i=this._opts)?void 0:i.skipChunkSize)||1e3)||(this._totalSize+=e,this._totalCost+=t,this._chunkSpeed=8e3*e/t,this._chunkCache.push({size:e,duration:t,timestamp:performance.now()}),e=(null==(i=this._opts)?void 0:i.chunkCountForSpeed)||50,this._chunkCache.length>e&&(this._chunkCache=this._chunkCache.slice(-e)))}},{key:"getAvgSpeed",value:function(){var e,t;return this._chunkCache.length||this._speeds.length?this._speeds.length?this._speeds.reduce(function(e,t){return e+t})/this._speeds.length:(t=this._chunkCache[this._chunkCache.length-1],(t=performance.now()-t.timestamp)>((null==(e=this._opts)?void 0:e.longtimeNoReceived)||3e3)&&this._chunkCache.push({size:0,duration:t,timestamp:performance.now()}),8e3*this._chunkCache.reduce(function(e,t){return e+t.size},0)/this._chunkCache.reduce(function(e,t){return e+t.duration},0)):0}},{key:"getLatestSpeed",value:function(){return this._chunkCache.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeed:0}},{key:"getTotalSize",value:function(){return this._totalSize}},{key:"getTotalCost",value:function(){return this._totalCost}},{key:"reset",value:function(){this._chunkCache=[],this._speeds=[],this._totalSize=0,this._totalCost=0}}]),ai),Et=(e(si,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}}
1,{key:"setFpsFromScriptData",value:function(e){var e=e.data,e=null==e||null==(e=e.onMetaData)?void 0:e.framerate;e&&0<e&&e<100&&(this.fps=e)}},{key:"setVideoMeta",value:function(e){this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen&&0<(e=e.fpsNum/e.fpsDen)&&e<100&&(this.fps=e)}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t,i=this;(!this.fps||100<=this.fps)&&e.length&&(t=e.reduce(function(e,t){return e+t.duration},0)/e.length,this.fps=Math.round(this._timescale/t)),e.forEach(function(e){-1===i._startGopId&&(i._startGopId=e.gopId),e.gopId===i._startGopId&&i.gop++,i._bitsAccumulateDuration+=e.duration/(i._timescale/1e3),i._bitsAccumulateSize+=e.units.reduce(function(e,t){return e+t.length},0),1e3<=i._bitsAccumulateDuration&&(i.bitrate=8*i._bitsAccumulateSize,i._bitsAccumulateDuration=0,i._bitsAccumulateSize=0)})}}]),si),Ct=(e(ri,[{key:"getStats",value:function(){var e,t,i=(null==(i=this._core)?void 0:i.media)||{},n=i.currentTime,n=void 0===n?0:n,i=i.decodeFps,i=void 0===i?0:i;return p(p({},this._stats.getStats()),{},{downloadSpeed:(null==(e=this._core)||null==(t=e.speedInfo)?void 0:t.call(e).speed)||0,avgSpeed:(null==(t=this._core)||null==(e=t.speedInfo)?void 0:e.call(t).avgSpeed)||0,totalReceivedByte:(null==(e=this._core)||null==(t=e.speedInfo)?void 0:t.call(e).totalSize)||0,totalReceivedCost:(null==(t=this._core)||null==(e=t.speedInfo)?void 0:e.call(t).totalCost)||0,currentTime:n,bufferEnd:(null==(e=this._core)||null==(t=e.bufferInfo())?void 0:t.remaining)||0,decodeFps:i})}},{key:"_bindEvents",value:function(){var t=this;this._core.on(L.DEMUXED_TRACK,function(e){e=e.videoTrack;return t._stats.updateBitrate(e.samples)}),this._core.on(L.FLV_SCRIPT_DATA,function(e){t._stats.setFpsFromScriptData(e)}),this._core.on(L.METADATA_PARSED,function(e){"video"===e.type?t._stats.setVideoMeta(e.track):t._stats.setAudioMeta(e.track)}),this._core.on(L.TTFB,function(e){t._stats.setDomain(e.responseUrl)})}},{key:"reset",value:function(){this._samples=[],this._stats=new Et(this._timescale)}}]),ri),Dt="video",At="hevc",Lt="aac",Pt="g7110a",It="g7110m",Ot="opus",Rt="mp3",jt="LARGE_AV_SHIFT",Mt="LARGE_VIDEO_GAP",Nt="LARGE_VIDEO_GAP_BETWEEN_CHUNK",Bt="LARGE_AUDIO_GAP",Ft="AUDIO_FILLED",Ut="AUDIO_DROPPED",Ht=(e(ni,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){var e,t;return 0<this.samples.length?(e=this.samples[0],(t=this.samples[this.samples.length-1]).dts-e.dts+t.duration):0}},{key:"exist",value:function(){return!!/av01/.test(this.codec)||!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),ni),Vt=(e(ii,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!(!this.sampleRate||!this.channelCount||!this.codec&&!this.container||this.codecType!==Lt&&this.codecType!==Pt&&this.codecType!==It&&this.codecType!==Ot&&this.codecType!==Rt)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){var e,t;return 0<this.samples.length?(e=this.samples[0],(t=this.samples[this.samples.length-1]).dts-e.dts+t.duration):0}
1}]),ii),Gt=(e(ti,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),ti),zt=e(function e(t,i,n,r){l(this,e),s(this,"duration",1024),s(this,"flag",{dependsOn:2,isNonSyncSample:0}),s(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=i,this.size=i.byteLength,this.sampleOffset=r,n&&(this.duration=n)}),n=e(function e(t,i){l(this,e),s(this,"time",0),this.data=t,this.originPts=this.pts=i}),qt=(t(ei,n),_t=i(ei),e(ei)),Wt=(t($t,n),vt=i($t),e($t)),Kt=(e(Jt,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),Jt),Yt=(e(Zt,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var i=new Uint8Array(4);i.set(this._data.subarray(e,e+t)),this._word=new DataView(i.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){var t;this._bitsAvailable>e||(e=(e-=this._bitsAvailable)-8*(t=Math.floor(e/8)),this._bytesAvailable-=t,this._loadWord()),this._word<<=e,this._bitsAvailable-=e}},{key:"readBits",value:function(e){if(32<e)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),i=this._word>>>32-t;return this._bitsAvailable-=t,0<this._bitsAvailable?this._word<<=t:0<this._bytesAvailable&&this._loadWord(),0<(t=e-t)&&this._bitsAvailable?i<<t|this.readBits(t):i}},{key:"skipLZ",value:function(){for(var e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,i=8,n=0;n<e;n++)t=0===(i=0!==i?(t+this.readEG()+256)%256:i)?t:i}}]),Zt),Xt=(e(Qt,[{key:"warn",value:function(){var e;if(!Qt.disabled){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];(e=console).warn.apply(e,[this._prefix].concat(i))}}}],[{key:"enable",value:function(){Qt.disabled=!1}},{key:"disable",value:function(){Qt.disabled=!0}}]),Qt);function Qt(e){l(this,Qt),this.name=e||"",this._prefix="[".concat(this.name,"]")}function Zt(e){if(l(this,Zt),s(this,"_bytesAvailable",void 0),s(this,"_bitsAvailable",0),s(this,"_word",0),!e)throw new Error("ExpGolomb data params is required");this._data=e,this._bytesAvailable=e.byteLength,this._bytesAvailable&&this._loadWord()}function Jt(){l(this,Jt),s(this,"id",3),s(this,"type","metadata"),s(this,"timescale",0),s(this,"flvScriptSamples",[]),s(this,"seiSamples",[])}function $t(){return l(this,$t),vt.apply(this,arguments)}function ei(){return l(this,ei),_t.apply(this,arguments)}function ti(e,t,i){l(this,ti),s(this,"flag",{}),s(this,"keyframe",!1),s(this,"gopId",0),s(this,"duration",0),s(this,"size",0),s(this,"units",[]),s(this,"chromaFormat",420),this.originPts=this.pts=e,this.originDts=this.dts=t,i&&(this.units=i)}function ii(){l(this,ii),s(this,"id",2),s(this,"type","audio"),s(this,"codecType",Lt),s(this,"pid",-1),s(this,"codec",""),s(this,"container",""),s(this,"sequenceNumber",0),s(this,"sampleDuration",0),s(this,"timescale",0),s(this,"formatTimescale",0),s(this,"baseMediaDecodeTime",0),s(this,"duration",0),s(this,"warnings",[]),s(this,"samples",[]),s(this,"baseDts",0),s(this,"sampleSize",16),s(this,"sampleRate",0),s(this,"channelCount",0),s(this,"objectType",0),s(this,"sampleRateIndex",0),s(this,"config",[]),s(this,"present",!1),s(this,"isVideoEncryption",!1),s(this,"isAudioEncryption",!1),s(this,"kid",null),s(this,"ext",void 0)}function ni(){l(this,ni),s(this,"id",1),s(this,"type",Dt),s(this,"codecType","avc"),s(this,"pid",-1),s(this,"hvcC",void 0),s(this,"codec",""),s(this,"timescale",0),s(this,"formatTimescale",0),s(this,"sequenceNumber",0),s(this,"baseMediaDecodeTime",0),s(this,"baseDts",0),s(this,"duration",0),s(this,"warnings",[]),s(this,"samples",[]),s(this,"pps",[]),s(this,"sps",[]),s(this,"vps",[]),s(this,"fpsNum",0),s(this,"fpsDen",0),s(this,"sarRatio",[]),s(this,"width",0),s(this,"height",0),s(this,"nalUnitSize",4),s(this,"present",!1),s(this,"isVideoEncryption",!1),s(this,"isAudioEncryption",!1),s(this,"isVideo",!0),s(this,"lastKeyFrameDts",0),s(this,"kid",null),s(this,"pssh",null),s(this,"ext",void 0)}function ri(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e3;l(this,ri),s(this,"_core",null),s(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new Et(t),this._bindEvents()}function si(e){l(this,si),s(this,"encodeType",""),s(this,"audioCodec",""),s(this,"videoCodec",""),s(this,"domain",""),s(this,"fps",0),s(this,"bitrate",0),s(this,"width",0),s(this,"height",0),s(this,"samplerate",0),s(this,"channelCount",0),s(this,"gop",0),s(this,"_bitsAccumulateSize",0),s(this,"_bitsAccumulateDuration",0),s(this,"_startGopId",-1),this._timescale=e}function ai(e){l(this,ai),s(this,"_chunkSpeed",0),s(this,"_chunkCache",[]),s(this,"_speeds",[]),s(this,"_totalSize",0),s(this,"_totalCost",0),this._opts=e||{}}function oi(e){var t=this;l(this,oi),s(this,"_seiSet",new Set),(this.emitter=e).on(L.SEI,function(e){e&&t._seiSet.add(e)})}function ui(){l(this,ui),s(this,"_prevCurrentTime",0)}function li(e){var t;return l(this,li),s(o(t=bt.call(this,e)),"type",Ge),s(o(t),"_queue",[]),s(o(t),"_alive",[]),s(o(t),"_currentTask",null),s(o(t),"_finnalUrl",""),s(o(t),"_config",void 0),t._config=p({loaderType:Ge,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:"text",range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e),"xhr"!==t._config.loaderType&&ut.isSupported()||(t.type="xhr"),t.log=e.logger,t}s(Xt,"disabled",!0);e(pi,null,[{key:"decode",value:function(e){for(var t=[],i=e,n=0,r=e.length;n<r;){if(i[n]<128)t.push(String.fromCharCode(i[n]));
1else{if(!(i[n]<192))if(i[n]<224){if(pi._checkContinuation(i,n,1)){var s=(31&i[n])<<6|63&i[n+1];if(128<=s){t.push(String.fromCharCode(65535&s)),n+=2;continue}}}else if(i[n]<240){if(pi._checkContinuation(i,n,2)){s=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2];if(2048<=s&&55296!=(63488&s)){t.push(String.fromCharCode(65535&s)),n+=3;continue}}}else if(i[n]<248&&pi._checkContinuation(i,n,3)){var a=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3];if(65536<a&&a<1114112){a-=65536,t.push(String.fromCharCode(a>>>10|55296)),t.push(String.fromCharCode(1023&a|56320)),n+=4;continue}}t.push(String.fromCharCode(65533))}++n}return t.join("")}},{key:"_checkContinuation",value:function(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}}]);var ci=pi,n="undefined"!=typeof window,a=n&&navigator.userAgent.toLocaleLowerCase(),hi=n&&/^((?!chrome|android).)*safari/.test(a),di=n&&a.includes("firefox"),fi=n&&a.includes("android");function pi(){l(this,pi)}function y(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var t=t.filter(Boolean),n=new Uint8Array(t.reduce(function(e,t){return e+t.byteLength},0)),r=0;return t.forEach(function(e){n.set(e,r),r+=e.byteLength}),n}var gi=Math.pow(2,32);function d(e,t){t=1<arguments.length&&void 0!==t?t:0;return(e[t]<<8)+(e[t+1]||0)}function k(e,t){t=1<arguments.length&&void 0!==t?t:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function mi(e,t){t=1<arguments.length&&void 0!==t?t:0;return k(e,t)*gi+k(e,t+4)}function yi(e){for(var t,i="avc1.",n=0;n<3;n++)i+=t=(t=e[n].toString(16)).length<2?"0".concat(t):t;return i}function vi(e){if(Array.isArray(e))return e.map(function(e){return parseInt(e,16)});for(var t,i=[],n=0;n<e.length;n++)n%2&&(t=e[n-1]+e[n],i.push(parseInt(t,16)));return i}function _i(e,t){return Number(e+"."+t)}e(bi,null,[{key:"getRateIndexByRate",value:function(e){return bi.FREQ.indexOf(e)}},{key:"parseADTS",value:function(e,t){for(var i=e.length,n=0;n+2<i&&(255!==e[n]||240!=(246&e[n+1]));)n++;if(!(i<=n)){var r=n,s=[],a=(60&e[n+2])>>>2,o=bi.FREQ[a];if(!o)throw new Error("Invalid sampling index: ".concat(a));for(var u,l=1+((192&e[n+2])>>>6),c=(1&e[n+2])<<2|(192&e[n+3])>>>6,h=bi._getConfig(a,c,l),d=h.config,h=h.codec,f=0,p=bi.getFrameDuration(o);n+7<i;)if(255===e[n]&&240==(246&e[n+1])){if(!(u=(3&e[n+3])<<11|e[n+4]<<3|(224&e[n+5])>>5)||i-n<u)break;s.push({pts:t+f*p,data:e.subarray(n+7+2*(1&~e[n+1]),n+u)}),f++,n+=u}else n++;return{skip:r,remaining:i<=n?void 0:e.subarray(n),frames:s,samplingFrequencyIndex:a,sampleRate:o,objectType:l,channelCount:c,codec:h,config:d,originCodec:"mp4a.40.".concat(l)}}}},{key:"parseAudioSpecificConfig",value:function(e){if(e.length){var t=e[0]>>>3,i=(7&e[0])<<1|e[1]>>>7,e=(120&e[1])>>>3,n=bi.FREQ[i];if(n)return{samplingFrequencyIndex:i,sampleRate:n,objectType:t,channelCount:e,config:(n=bi._getConfig(i,e,t)).config,codec:n.codec,originCodec:"mp4a.40.".concat(t)}}}},{key:"getFrameDuration",value:function(e){return 1024*(1<arguments.length&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,i){var n,r,s=[];return di?r=6<=e?(n=5,e-3):(n=2,e):fi?(n=2,r=e):(n=5,6<=(r=e)?r=e-3:1===t&&(n=2,r=e)),s[0]=n<<3,s[0]|=(14&e)>>1,s[1]=(1&e)<<7,s[1]|=t<<3,5===n&&(s[1]|=(14&r)>>1,s[2]=(1&r)<<7,s[2]|=8,s[3]=0),{config:s,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){return"mp4a.40.2"===e?1===t?new Uint8Array([0,200,0,128,35,128]):2===t?new Uint8Array([33,0,73,144,2,25,0,35,128]):3===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]):4===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]):5===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]):6===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]):void 0:1===t?new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]):2===t||3===t?new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]):void 0}}]);var ki=bi;function bi(){l(this,bi)}s(ki,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);e(Vi,null,[{key:"parseAnnexB",value:function(e){for(var t=e.byteLength-1,i=0;0===e[t]&&(i++,0<--t););for(var n=(e=3<=i?e.subarray(0,t+1):e).length,r=2,s=0;null!=e[r]&&1!==e[r];)r++;if((s=++r+2)>=n)return[];for(var a=[];s<n;)switch(e[s]){case 0:if(0!==e[s-1])s+=2;else if(0!==e[s-2])s++;else if(s<n-1&&1!==e[s+1])s++;else{for(r!==s-2&&a.push(e.subarray(r,s-2));1!==e[++s]&&s<n;);s=(r=s+1)+2}break;case 1:0!==e[s-1]||0!==e[s-2]?s+=3:(r!==s-2&&a.push(e.subarray(r,s-2)),s=(r=s+1)+2);break;default:s+=3}return r<n&&a.push(e.subarray(r)),a}},{key:"parseAvcC",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var i,n=e.length,r=[],s=0;s+t<n;)if(i=k(e,s),3===t&&(i>>>=8),s+=t,i){if(n<s+i)break;r.push(e.subarray(s,s+i)),s+=i}return r}}},{key:"parseSEI",value:function(e,t){for(var i=e.length,n=t?2:1,r=0,s=0,a="";255===e[n];)r+=255,n++;for(r+=e[n++];255===e[n];)s+=255,n++;if(s+=e[n++],5===r&&n+16<i)for(var o=0;o<16;o++)a+=e[n].toString(16),n++;return{payload:e.subarray(n,n+s),type:r,size:s,uuid:a}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(!i.length)return e;for(var r=t-i.length,s=new Uint8Array(r),a=0,n=0;n<r;a++,n++)a===i[0]&&(a++,i.shift()),s[n]=e[a];return s}}]);var Si=Vi,xi=(e(Hi,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(e){if(!(e.length<7)){for(var t,i=1+(3&e[4]),n=[],r=[],s=6,a=31&e[5],o=0;o<a;o++){var u,l=e[s]<<8|e[s+1];s+=2,l&&(u=e.subarray(s,s+l),s+=l,n.push(u),t=t||Hi.parseSPS(Si.removeEPB(u)))}var c,h=e[s];s++;for(var d=0;d<h;d++)c=e[s]<<8|e[s+1],s+=2,c&&(r.push(e.subarray(s,s+c)),s+=c);return{sps:t,spsArr:n,ppsArr:r,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new Yt(e),i=(t.readUByte(),t.readUByte()),n=t.readUByte(),r=t.readUByte(),s=(t.skipUEG(),420);if(100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i){var a=t.readUEG();if(a<=3&&(s=[0,420,422,444][a]),3===a&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var o=3!==a?8:12,u=0;u<o;
1u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();a=t.readUEG();if(0===a)t.readUEG();else if(1===a){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),c=0;c<l;c++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var a=t.readUEG(),h=t.readUEG(),d=t.readBits(1);0===d&&t.skipBits(1),t.skipBits(1);var f,p,g,m,y,v=0,_=0,k=0,b=0;if(t.readBool()&&(v=t.readUEG(),_=t.readUEG(),k=t.readUEG(),b=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:f=[1,1];break;case 2:f=[12,11];break;case 3:f=[10,11];break;case 4:f=[16,11];break;case 5:f=[40,33];break;case 6:f=[24,11];break;case 7:f=[20,11];break;case 8:f=[32,11];break;case 9:f=[80,33];break;case 10:f=[18,11];break;case 11:f=[15,11];break;case 12:f=[64,33];break;case 13:f=[160,99];break;case 14:f=[4,3];break;case 15:f=[3,2];break;case 16:f=[2,1];break;case 255:f=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool())&&t.readBits(24),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()&&(p=t.readBits(32),g=t.readBits(32),m=t.readBool(),y=(g=g)/(p=2*p))}return{codec:yi(e.subarray(1,4)),profileIdc:i,profileCompatibility:n,levelIdc:r,chromaFormat:s,width:Math.ceil(16*(a+1)-2*(v+_)),height:(2-d)*(h+1)*16-(d?2:4)*(k+b),sarRatio:f,fpsNum:g,fpsDen:p,fps:y,fixedFrame:m}}}]),Hi),wi=(e(Ui,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!(e.length<23)){for(var i,n,r,t=t||{},s=1+(3&e[21]),a=[],o=[],u=[],l=23,c=e[22],h=0;h<c;h++){i=63&e[l],n=e[l+1]<<8|e[l+2],l+=3;for(var d=0;d<n;d++)if(r=e[l]<<8|e[l+1],l+=2,r){switch(i){case 32:var f=e.subarray(l,l+r),p=p||Ui.parseVPS(Si.removeEPB(f),t);u.push(f);break;case 33:var f=e.subarray(l,l+r),g=g||Ui.parseSPS(Si.removeEPB(f),t);a.push(f);break;case 34:o.push(e.subarray(l,l+r))}l+=r}}
1return{hvcC:t,sps:g,spsArr:a,ppsArr:o,vpsArr:u,nalUnitSize:s}}}},{key:"parseVPS",value:function(e,t){t=t||{};var e=new Yt(e),i=(e.readUByte(),e.readUByte(),e.readBits(12),e.readBits(3));return t.numTemporalLayers=Math.max(t.numTemporalLayers||0,i+1),e.readBits(17),Ui._parseProfileTierLevel(e,i,t),t}},{key:"parseSPS",value:function(e){var t=(t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{})||{},e=new Yt(e),i=(e.readUByte(),e.readUByte(),e.readBits(4),e.readBits(3)),i=(t.numTemporalLayers=Math.max(i+1,t.numTemporalLayers||0),t.temporalIdNested=e.readBits(1),Ui._parseProfileTierLevel(e,i,t),e.readUEG(),t.chromaFormatIdc=e.readUEG()),n=420,r=(i<=3&&(n=[0,420,422,444][i]),0);3===i&&(r=e.readBits(1));var s,a,o,u,l=e.readUEG(),c=e.readUEG(),h=e.readBits(1);return 1===h&&(s=e.readUEG(),a=e.readUEG(),o=e.readUEG(),u=e.readUEG()),t.bitDepthLumaMinus8=e.readUEG(),t.bitDepthChromaMinus8=e.readUEG(),1===h&&(l-=(1!==i&&2!==i||0!==r?1:2)*(a+s),c-=(1===i&&0===r?2:1)*(u+o)),{codec:"hev1.1.6.L93.B0",width:l,height:c,chromaFormat:n,hvcC:t}}},{key:"_parseProfileTierLevel",value:function(e,t,i){var n=i.generalTierFlag||0,r=(i.generalProfileSpace=e.readBits(2),i.generalTierFlag=Math.max(e.readBits(1),n),i.generalProfileIdc=Math.max(e.readBits(5),i.generalProfileIdc||0),i.generalProfileCompatibilityFlags=e.readBits(32),i.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)],e.readBits(8)),s=(n<i.generalTierFlag?i.generalLevelIdc=r:i.generalLevelIdc=Math.max(r,i.generalLevelIdc||0),[]),a=[];if(t>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var o=0;o<t;o++)s[o]=e.readBits(1),a[o]=e.readBits(1);0<t&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==s[u]&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),0!==a[u]&&e.readBits(8)}}]),Ui),Ti=(e(Fi,null,[{key:"getFrameDuration",value:function(e){return 20}},{key:"parseHeaderPackets",value:function(e){if(e.length){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i="",n=0;n<8;n++)i+=String.fromCodePoint(e[n]);if("OpusHead"!==i)throw new Error("Invalid Opus MagicSignature");var r=e[9],s=(console.log("Pre-skip",e[10],e[11]),t.getUint32(12,!0)),t=t.getInt16(16,!0);if(s)return{outputGain:t,sampleRate:s,channelCount:r,config:new Uint8Array(e.buffer,e.byteOffset+8,e.byteLength-8),codec:"opus",originCodec:"opus"}}}}]),Fi),Ei=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Ci=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Di=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ai=[0,1,1,4],Li=null,Pi=(e(Bi,null,[{key:"isHeader",value:function(e,t){return t+1<e.length&&255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}},{key:"appendFrame",value:function(e,t,i,n,r){if(!(i+24>t.length)){var s=Bi.parseHeader(t,i);if(s&&i+s.frameLength<=t.length)return n=n+r*(9e4*s.samplesPerFrame/s.sampleRate),(r={data:t.subarray(i,i+s.frameLength),pts:n,dts:n}).size=r.data.byteLength,e.config=[],e.channelCount=s.channelCount,e.sampleRate=s.sampleRate,di?e.codec="mp3":e.container="audio/mpeg",e.samples.push(r),{length:s.frameLength}}}},{key:"parseHeader",value:function(e,t){var i,n,r,s,a,o=e[t+1]>>3&3,u=e[t+1]>>1&3,l=e[t+2]>>4&15,c=e[t+2]>>2&3;if(1!=o&&0!=l&&15!=l&&3!=c)return a=e[t+2]>>1&1,l=1e3*Ei[14*(3==o?3-u:3==u?3:4)+l-1],c=Ci[3*(3==o?0:2==o?1:2)+c],n=3==(i=e[t+3]>>6)?1:2,s=8*(o=Di[o][u])*(r=Ai[u]),o=Math.floor(o*l/c+a)*r,null===Li&&(a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),Li=a?parseInt(a[1]):0),Li&&Li<=87&&2==u&&224e3<=l&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:n,frameLength:o,samplesPerFrame:s}}}]),Bi),Ii=(e(Ni,[{key:"fix",value:function(){var t,i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],e=Math.round(1e3*e),s=this.videoTrack,a=this.audioTrack;!n&&r||(this._videoLastSample=null,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0),n&&!r&&(this._baseDtsInited=!1),this._baseDtsInited||this._calculateBaseDts(a,s),!r&&e&&(this._audioNextPts=this._videoNextDts=e),!this._baseDtsInited||!this._videoTimestampBreak&&this.videoTrack.exist()||!this._audioTimestampBreak&&this.audioTrack.exist()||this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._keyFrameInNextChunk=!1,this._fixVideo(s),this.metadataTrack.exist()&&(t=this.metadataTrack.timescale,this.metadataTrack.seiSamples.forEac
1h(function(e){e.pts=e.originPts-i._baseDts,e.time=Math.max(0,e.pts)/t}),this.metadataTrack.flvScriptSamples.forEach(function(e){e.pts=e.originPts-i._baseDts,e.time=Math.max(0,e.pts)/t})),s.samples.length&&(s.baseMediaDecodeTime=s.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.timescale/1e3)}},{key:"_fixVideo",value:function(e){var t=this,i=e.samples;if(i.length){i.forEach(function(e){e.dts-=t._baseDts,e.pts-=t._baseDts,e.keyframe&&(t._keyFrameInNextChunk=!0)}),n=e.fpsNum&&e.fpsDen?e.timescale*(e.fpsDen/e.fpsNum):1<e.length?(u=e.samples[0],l=e.samples[i.length-1],Math.floor((l.dts-u.dts)/(i.length-1))):this._lastVideoDuration||40;var n,r=i.pop();if(this._videoLastSample&&i.unshift(this._videoLastSample),this._videoLastSample=r,i.length){void 0===this._videoNextDts&&(l=i[0],this._videoNextDts=l.dts);var s,a=i.length,o=0,u=i[0],l=this._videoNextDts-u.dts;200<Math.abs(l)&&(5e3<Math.abs(u.dts-this._lastVideoExceptionChunkFirstDtsDot)&&(this._lastVideoExceptionChunkFirstDtsDot=u.dts,e.warnings.push({type:Nt,nextDts:this._videoNextDts,firstSampleDts:u.dts,nextSampleDts:null==(s=i[1])?void 0:s.dts,sampleDuration:l})),5<=this._videoTimestampBreak?(this._videoNextDts=u.dts,this._videoTimestampBreak=0):(u.dts+=l,u.pts+=l,this.audioTrack.exist()||(this._videoTimestampBreak=1)));for(var c=0;c<a;c++){var h=i[c].dts,d=i[c+1];(1e3<(o=c<a-1?d.dts-h:r?r.dts-h:n)||o<0)&&(this._videoTimestampBreak++,5e3<Math.abs(h-this._lastVideoExceptionLargeGapDot)&&(this._lastVideoExceptionLargeGapDot=h,e.warnings.push({type:Mt,time:h/e.timescale,dts:h,originDts:i[c].originDts,nextDts:this._videoNextDts,sampleDuration:o,refSampleDuration:n})),o=n),i[c].duration=o,this._videoNextDts+=o,this._lastVideoDuration=o}}}}},{key:"_fixAudio",value:function(e){var t=this,i=e.samples;i.length&&(i.forEach(function(e){e.dts=e.pts-=t._baseDts}),this._doFixAudioInternal(e,i,1e3))}},{key:"_calculateBaseDts",value:function(e,t){var i,n,r=e.samples,s=t.samples;return!(!r.length&&!s.length)&&(n=i=1/0,r.length&&(e.baseDts=i=r[0].pts),s.length&&(t.baseDts=n=s[0].dts),this._baseDts=Math.min(i,n),e=n-i,Number.isFinite(e)&&500<Math.abs(e)&&t.warnings.push({type:jt,videoBaseDts:n,audioBasePts:i,baseDts:this._baseDts,delta:e}),this._baseDtsInited=!0)}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){this._calculateBaseDts(this.audioTrack,this.videoTrack)&&(this.audioTrack.exist()?this.videoTrack.exist()?this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts):this._baseDts-=this._audioNextPts:this._baseDts-=this._videoNextDts,this._videoTimestampBreak=0,this._audioTimestampBreak=0)}},{key:"_doFixAudioInternal",value:function(e,t,i){if(!e.sampleDuration)switch(e.codecType){case Lt:e.sampleDuration=ki.getFrameDuration(e.timescale,i);break;case Ot:e.sampleDuration=Ti.getFrameDuration(e.samples,i);break;case Pt:case It:e.sampleDuration=this._getG711Duration(e);break;default:console.error("can't fix audio codecType:",e.codecType)}var n,r=e.sampleDuration,s=e.codecType===Ot?20:e.codecType===Lt?1024:r*e.timescale/1e3;void 0===this._audioNextPts&&(n=t[0],this._audioNextPts=n.pts);for(var a=0;a<t.length;a++){var o=this._audioNextPts,u=t[a],l=u.pts-o;if(0===a&&5<=this._audioTimestampBreak&&this._keyFrameInNextChunk&&(o=this._audioNextPts=u.dts,this._audioTimestampBreak=l=0),!this._audioTimestampBreak&&3*r<=l&&l<=1e3&&!hi){var c=this._getSilentFrame(e)||t[0].data.subarray(),h=Math.floor(l/r);5e3<Math.abs(u.pts-this._lastAudioExceptionGapDot)&&(this._lastAudioExceptionGapDot=u.pts,e.warnings.push({type:Ft,pts:u.pts,originPts:u.originPts,count:h,nextPts:o,refSampleDuration:r}));for(var d=0;d<h;d++){var f=new zt(Math.floor(this._audioNextPts+r)-Math.floor(this._audioNextPts),c,s);f.originPts=Math.floor(this._baseDts+o),t.splice(a,0,f),this._audioNextPts+=r,a++}a--}else l<=-3*r&&-1e3<=l?(5e3<Math.abs(u.pts-this._lastAudioExceptionOverlapDot)&&(this._lastAudioExceptionOverlapDot=u.pts,e.warnings.push({type:Ut,pts:u.pts,originPts:u.originPts,nextPts:o,refSampleDuration:r})),t.splice(a,1),a--):(1e3<Math.abs(l)&&(this._audioTimestampBreak++,5e3<Math.abs(u.pts-this._lastAudioExceptionLargeGapDot))&&(this._lastAudioExceptionLargeGapDot=u.pts,e.warnings.push({type:Bt,time:u.pts/1e3,pts:u.pts,originPts:u.originPts,nextPts:o,sampleDuration:l,refSampleDuration:r})),e.codecType===Ot?(l=t[t.length-1])&&(l.duration=u.pts-l.pts):(u.dts=u.pts=o,u.duration=s),this._audioNextPts+=r)}}},{key:"_getG711Duration",value:function(e){var t=e.sampleSize,i=e.samples[0];
1if(i)return 2*i.data.byteLength/e.channelCount/(t/8)/e.sampleRate*1e3}},{key:"_getSilentFrame",value:function(e){return e.codecType===Lt?ki.getSilentFrame(e.codec,e.channelCount):new Uint8Array(8*e.sampleDuration*e.channelCount)}}]),Ni),Oi=(e(Mi,null,[{key:"parse",value:function(e){var t,i;if(!(e.length<3))return t={},i=Mi._parseValue(new DataView(e.buffer,e.byteOffset,e.byteLength)),e=Mi._parseValue(new DataView(e.buffer,e.byteOffset+i.size,e.byteLength-i.size)),t[i.data]=e.data,t}},{key:"_parseValue",value:function(e){var t=e.byteLength,i=1,n=!1;switch(e.getUint8(0)){case 0:s=e.getFloat64(1),i+=8;break;case 1:s=!!e.getUint8(1),i+=1;break;case 2:var r=Mi._parseString(new DataView(e.buffer,e.byteOffset+i,e.byteLength-i)),s=r.data;i+=r.size;break;case 3:s={};var a=0;for(9==(16777215&e.getUint32(t-4))&&(a=3);i<t-4;){var o=Mi._parseObject(new DataView(e.buffer,e.byteOffset+i,e.byteLength-i-a)),u=o.size,l=o.data;if(o.isEnd)break;s[l.name]=l.value,i+=u}i<=t-3&&9==(16777215&e.getUint32(i-1))&&(i+=3);break;case 8:s={},i+=4;var c=0;for(9==(16777215&e.getUint32(t-4))&&(c=3);i<t-8;){var h=Mi._parseObject(new DataView(e.buffer,e.byteOffset+i,e.byteLength-i-c)),d=h.size,f=h.data;if(h.isEnd)break;s[f.name]=f.value,i+=d}i<=t-3&&9==(16777215&e.getUint32(i-1))&&(i+=3);break;case 9:i=1,n=!(s=void 0);break;case 10:s=[];var p=e.getUint32(1);i+=4;for(var g=0;g<p;g++){var m=Mi._parseValue(new DataView(e.buffer,e.byteOffset+i,e.byteLength-i)),y=m.data,m=m.size;s.push(y),i+=m}break;case 11:r=e.getFloat64(i)+6e4*e.getInt16(i+8);s=new Date(r),i+=10;break;case 12:r=e.getUint32(1);i+=4,s="",0<r&&(s=ci.decode(new Uint8Array(e.buffer,e.byteOffset+i,r))),i+=r;break;default:i=t}return{data:s,size:i,isEnd:n}}},{key:"_parseString",value:function(e){var t=e.getUint16(0),i="";return{data:i=0<t?ci.decode(new Uint8Array(e.buffer,e.byteOffset+2,t)):i,size:2+t}}},{key:"_parseObject",value:function(e){var t;if(!(e.byteLength<3))return t=Mi._parseString(e),e=Mi._parseValue(new DataView(e.buffer,e.byteOffset+t.size,e.byteLength-t.size)),{data:{name:t.data,value:e.data},size:t.size+e.size,isEnd:e.isEnd}}}]),Mi),Ri=new Xt("FlvDemuxer");function ji(e,t,i){l(this,ji),s(this,"_headerParsed",!1),s(this,"_remainingData",null),s(this,"_gopId",0),s(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=e||new Ht,this.audioTrack=t||new Vt,this.metadataTrack=i||new Kt,this._fixer=new Ii(this.videoTrack,this.audioTrack,this.metadataTrack)}function Mi(){l(this,Mi)}function Ni(e,t,i){l(this,Ni),this.videoTrack=e,this.audioTrack=t,this.metadataTrack=i,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastVideoDuration=0,this._keyFrameInNextChunk=!1,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}function Bi(){l(this,Bi)}function Fi(){l(this,Fi)}function Ui(){l(this,Ui)}function Hi(){l(this,Hi)}function Vi(){l(this,Vi)}e(ji,[{key:"demux",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length?arguments[3]:void 0,r=this.audioTrack,s=this.videoTrack,a=this.metadataTrack;if(!t&&i||(this._remainingData=null),t&&(this._headerParsed=!1),t?(s.reset(),r.reset(),a.reset()):(s.samples=[],r.samples=[],a.seiSamples=[],a.flvScriptSamples=[],s.warnings=[],r.warnings=[],this._remainingData&&(e=y(this._remainingData,e),this._remainingData=null)),e.length){var o=0;if(!this._headerParsed){if(!ji.probe(e))throw new Error("Invalid flv file");r.present=(4&e[4])>>>2!=0,s.present=0!=(1&e[4]),this._headerParsed=!0,o=k(e,5)+4}for(var u,l,c,h,d=e.length;o+15<d&&(u=e[o],!(o+15+(l=e[o+1]<<16|e[o+2]<<8|e[o+3])>d));)c=(e[o+7]<<24>>>0)+(e[o+4]<<16)+(e[o+5]<<8)+e[o+6],h=e.subarray(o+=11,o+l),8===u?this._parseAudio(h,c):9===u?(n&&(this.seamlessLoadingSwitching=!0),this._parseVideo(h,c)):18===u?this._parseScript(h,c):Ri.warn("Invalid tag type: ".concat(u)),(h=k(e,o+=l))!==11+l&&Ri.warn("Invalid PrevTagSize ".concat(h," (").concat(11+l,")")),o+=4;o<d&&(this._remainingData=e.subarray(o)),r.formatTimescale=s.formatTimescale=s.timescale=a.timescale=1e3,r.timescale=r.codecType===Ot?1e3:r.sampleRate||0,!r.exist()&&r.hasSample()&&r.reset(),!s.exist()&&s.hasSample()&&s.reset();i=a.flvScriptSamples[a.flvScriptSamples.length-1],i=null==i||null==(t=i.data)?void 0:t.onMetaData;i&&(null!=s&&s.exist()&&(i.hasOwnProperty("duration")&&(s.duration=1e3*i.duration),i.hasOwnProperty("width"))&&i.hasOwnProperty("height")&&(s.width=i.width,s.height=i.height),null!=r)&&r.exist()&&i.hasOwnProperty("duration")&&(r.duration=1e3*i.duration)}return{videoTrack:s,audioTrack:r,metadataTrack:a}}},{key:"fix",value:function(e,t,i){return this._fixer.fix(e,t,i),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,i,n,r){return this.demux(e,t,i,r),this.fix(n,t,i)}},{key:"_parseAudio",value:function(e,t){if(e.length){var i,n,r,s=(240&e[0])>>>4,a=this.audioTrack;if(10!=s&&7!=s&&8!=s&&13!=s)Ri.warn("Unsupported sound format: ".concat(s)),a.reset();else switch(10!=s&&13!=s&&(i=(12&e[0])>>2,n=(2&e[0])>>1,r=1&e[0],a.sampleRate=ji.AUDIO_RATE[i],a.sampleSize=n?16:8,a.channelCount=1+r),s){case 7:case 8:this._parseG711(e,t,s);break;case 10:this._parseAac(e,t);break;case 13:this._parseOpus(e,t)}}}},{key:"_parseOpus",value:function(e,t){var i=this.audioTrack,n=e[1];switch(i.codecType=Ot,n){case 0:var r=Ti.parseHeaderPackets(e.subarray(2));r?(i.codec=r.codec,i.channelCount=r.channelCount,i.sampleRate=r.sampleRate,i.config=r.config,i.sampleDuration=Ti.getFrameDuration([],i.timescale)):(i.reset(),Ri.warn("Cannot parse AudioSpecificConfig",e));break;case 1:null!=t&&(r=new zt(t,e.subarray(2),i.sampleDuration),i.samples.push(r));break;default:Ri.warn("Unknown OpusPacketType: ".concat(n))}}},{key:"_parseG711",value:function(e,t,i){var n=this.audioTrack,e=e.subarray(1);e.byteLength<1||(t=new zt(t,e),n.codecType=7===i?Pt:It,n.sampleRate=8e3,n.codec=n.codecType,n.samples.push(t))}},{key:"_parseAac",value:function(e,t){var i,n=this.audioTrack;n.codecType=Lt,0===e[1]?(i=ki.parseAudioSpecificConfig(e.subarray(2)))?(n.codec=i.codec,n.channelCount=i.channelCount,n.sampleRate=i.sampleRate,n.config=i.config,n.objectType=i.objectType,n.sampleRateIndex=i.samplingFrequencyIndex):(n.reset(),Ri.warn("Cannot parse AudioSpecificConfig",e)):1===e[1]?null!=t&&n.samples.push(new zt(t,e.subarray(2))):Ri.warn("Unknown AACPacketType: ".concat(e[1]))}},{key:"_parseVideo",value:function(e,i){var t,n,r,s,a,o,u,l,c,h,d,f,p=this;e.length<6||(t=(240&e[0])>>>4,n=this.videoTrack,7!=(s=15&e[0])&&12!=s?(n.reset(),Ri.warn("Unsupported codecId: ".concat(s))):(n.codecType=(r=12==s)?At:"avc",a=(e[2]<<16|e[3]<<8|e[4])<<8>>8,0===(s=e[1])?(h=e.subarray(5),(h=r?wi.parseHEVCDecoderConfigurationRecord(h
1):xi.parseAVCDecoderConfigurationRecord(h))?(d=h.hvcC,o=h.sps,u=h.ppsArr,l=h.spsArr,c=h.vpsArr,h=h.nalUnitSize,d&&(n.hvcC=n.hvcC||d),o&&(n.codec=o.codec,n.width=o.width,n.height=o.height,n.sarRatio=o.sarRatio,n.fpsNum=o.fpsNum,n.fpsDen=o.fpsDen),l.length&&(n.sps=l),u.length&&(n.pps=u),c&&c.length&&(n.vps=c),h&&(n.nalUnitSize=h)):Ri.warn("Cannot parse ".concat(r?"HEVC":"AVC","DecoderConfigurationRecord"),e)):1===s?(d=Si.parseAvcC(e.subarray(5),n.nalUnitSize),(d=this._checkAddMetaNalToUnits(r,d,n))&&d.length?(f=new Gt(i+a,i,d),this.seamlessLoadingSwitching&&i<n.lastKeyFrameDts||(this.seamlessLoadingSwitching=!1,1==t&&(f.setToKeyframe(),n.lastKeyFrameDts=i),n.samples.push(f),d.forEach(function(e){var t=r?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:!r&&5!=t||r&&5==t||f.setToKeyframe();break;case 6:case 39:case 40:!r&&6!=t||r&&6==t||p.metadataTrack.seiSamples.push(new Wt(Si.parseSEI(Si.removeEPB(e),r),i+a))}}),f.keyframe&&this._gopId++,f.gopId=this._gopId)):Ri.warn("Cannot parse NALUs",e)):2!==s&&Ri.warn("Unknown AVCPacketType: ".concat(s))))}},{key:"_checkAddMetaNalToUnits",value:function(e,t,i){return!e||!this._needAddMetaBeforeKeyFrameNal||t.map(function(e){return e[0]>>>1&63}).includes(32)?(this._needAddMetaBeforeKeyFrameNal=!1,t):(t.unshift(i.pps[0]),t.unshift(i.sps[0]),t.unshift(i.vps[0]),t.filter(Boolean))}},{key:"_parseScript",value:function(e,t){this.metadataTrack.flvScriptSamples.push(new qt(Oi.parse(e),t))}}],[{key:"probe",value:function(e){return 70===e[0]&&76===e[1]&&86===e[2]&&1===e[3]&&9<=k(e,5)}}]),s(ji,"AUDIO_RATE",[5500,11e3,22e3,44e3]);e(Zi,[{key:"fix",value:function(){var e,t,i,n,r=this,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],s=Math.round(9e4*s),u=this.videoTrack,l=this.audioTrack,c=u.samples,h=l.samples;(c.length||h.length)&&(e=c[0],t=h[0],i=0,c.length&&h.length&&(i=e.dts-t.pts),this._baseDtsInited||this._calculateBaseDts(this.audioTrack,this.videoTrack),a&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=s,this._baseAudioDts-=s,this._baseVideoDts-=s),o||(this._videoNextDts=0<i?s+i:s,this._audioNextPts=0<i?s:s-i,this._needForceFixLargeGap&&(this._videoNextDts=0,this._audioNextPts=0),c=e?e.dts-this._baseDts-this._videoNextDts:0,h=t?t.pts-this._baseDts-this._audioNextPts:0,9e4<Math.abs(c||h)&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=s)),this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(l),this._fixVideo(u),this.metadataTrack.exist()&&(n=this.metadataTrack.timescale,this.metadataTrack.seiSamples.forEach(function(e){e.pts=e.originPts-r._baseDts,e.time=Math.max(0,e.pts)/n})),u.samples.length&&(u.baseMediaDecodeTime=u.samples[0].dts),l.samples.length)&&(l.baseMediaDecodeTime=l.samples[0].pts*l.timescale/9e4)}},{key:"_fixVideo",value:function(e){var t=this,i=e.samples;if(i.length){i.forEach(function(e){e.dts-=t._needForceFixLargeGap?t._baseVideoDts:t._baseDts,e.pts-=t._needForceFixLargeGap?t._baseVideoDts:t._baseDts}),void 0===this._videoNextDts&&(o=i[0],this._videoNextDts=o.dts);var n,r,s=i.length,a=0,o=i[0],u=i[1],l=this._videoNextDts-o.dts;if(45e3<Math.abs(l))if(e.warnings.push({type:Nt,nextDts:this._videoNextDts/90,firstSampleDts:o.dts/90,nextSampleDts:((null==(n=i[1])?void 0:n.dts)||0)/90,sampleDuration:l/90}),o.dts+=l,o.pts+=l,u&&9e4<Math.abs(u.dts-o.dts))this._videoTimestampBreak=!0,i.forEach(function(e,t){0!==t&&(e.dts+=l,e.pts+=l)});else for(var c=1;c<s-1;c++){var h=null==(h=i[c])?void 0:h.dts,d=i[c-1].dts;h&&h-d<0&&(i[c].dts+=l,i[c].pts+=l)}(r=(r=e.fpsNum&&e.fpsDen?e.timescale*(e.fpsDen/e.fpsNum):r)<900?0:r)||(n=e.samples[0],u=e.samples[1],r=1===s?9e3:Math.floor(u.dts-n.dts));for(var f=0;f<s;f++){var p,g=i[f].dts,m=i[f+1];(9e4<(a=f<s-1?m.dts-g:i[f-1]?Math.min(g-i[f-1].dts,r):r)||a<0)&&(this._videoTimestampBreak=!0,a=this._audioTimestampBreak?r:Math.max(a,2700),p=this._audioNextPts||0,m&&m.dts>p&&(a=r),e.warnings.push({type:Mt,time:g/e.timescale,dts:g,originDts:i[f].originDts,nextDts:this._videoNextDts,sampleDuration:a,refSampleDuration:r})),i[f].duration=a,this._videoNextDts+=a}}}},{key:"_fixAudio",value:function(e){var t=this,i=e.samples;if(i.length)if(e.codecType!==Rt)i.forEach(function(e){e.pts-=t._needForceFixLargeGap?t._baseAudioDts:t._baseDts,e.dts=e.pts}),this._doFixAudioInternal(e,i,9e4);else{this.lastAudioSample&&i.unshift(this.lastAudioSample);for(var n=0;n<i.length;n++){var r=i[n];if(!i[n+1])break;r.duration=i[n+1].pts-r.pts,r.pts-=this._baseDts,r.dts=r.pts}this.lastAudioSample=i.pop()}}},{key:"_calculateBaseDts",value:function(e,t){var i,n,r=e.samples,s=t.samples;return!(!r.length&&!s.length)&&(n=i=1/0,r.length&&(e.baseDts=i=r[0].pts,this._baseAudioDts=i),s.length&&(t.baseDts=n=s[0].dts,this._baseVideoDts=n),this._baseDts=Math.min(i,n),e=n-i,r=!1,Number.isFinite(e)&&45e3<Math.abs(e)&&t.warnings.push({type:jt,videoBaseDts:n,audioBasePts:i,baseDts:this._baseDts,delta:e}),Number.isFinite(e)&&Math.abs(e)>9e4*this._largeGapThreshold&&(r=!0),this._baseDtsInited||(r&&this._needForceFixLargeGap?this._needForceFixLargeGap=!0:this._needForceFixLargeGap=!1),this._baseDtsInited=!0)}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak&&this._calculateBaseDts(this.audioTrack,this.videoTrack)&&(this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1)}},{key:"_doFixAudioInternal",value:function(e,t,i){e.sampleDuration||(e.sampleDuration=ki.getFrameDuration(e.timescale,i));var n=e.sampleDuration;void 0===this._audioNextPts&&(i=t[0],this._audioNextPts=i.pts);for(var r=0;r<t.length;r++){var s=this._audioNextPts,a=t[r],o=a.pts-s;if(!this._audioTimestampBreak&&3*n<=o&&o<=9e4&&!hi){var u=ki.get
1SilentFrame(e.codec,e.channelCount)||t[0].data.subarray(),l=Math.floor(o/n);45e4<Math.abs(a.pts-this._lastAudioExceptionGapDot)&&(this._lastAudioExceptionGapDot=a.pts),e.warnings.push({type:Ft,pts:a.pts/90,originPts:a.originPts,count:l,nextPts:s/90,refSampleDuration:n});for(var c=0;c<l;c++){var h=new zt(Math.floor(s),u);h.originPts=Math.floor(this._baseDts+s),t.splice(r,0,h),this._audioNextPts+=n,r++}r--}else o<=-3*n&&-9e4<=o?(45e4<Math.abs(a.pts-this._lastAudioExceptionOverlapDot)&&(this._lastAudioExceptionOverlapDot=a.pts,e.warnings.push({type:Ut,pts:a.pts/90,originPts:a.originPts,nextPts:s/90,refSampleDuration:n})),t.splice(r,1),r--):(9e4<=Math.abs(o)&&(this._audioTimestampBreak=!0,45e4<Math.abs(a.pts-this._lastAudioExceptionLargeGapDot))&&(this._lastAudioExceptionLargeGapDot=a.pts,e.warnings.push({type:Bt,time:a.pts/1e3,pts:a.pts/90,originPts:a.originPts,nextPts:s/90,sampleDuration:o,refSampleDuration:n})),a.dts=a.pts=s,this._audioNextPts+=n)}}}]);var Gi=Zi,zi=new Xt("TsDemuxer"),qi=(e(Qi,[{key:"demux",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=this.audioTrack,r=this.videoTrack,s=this.metadataTrack,a=(t&&(this._pmtId=-1,r.reset(),n.reset(),s.reset()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(r.samples=[],n.samples=[],s.seiSamples=[],r.warnings=[],n.warnings=[],this._remainingPacketData&&(e=y(this._remainingPacketData,e),this._remainingPacketData=null)),e.length),i=a%188;i&&(this._remainingPacketData=e.subarray(a-i),a-=i);for(var o=r.pid,u=n.pid,l=0;l<a;l+=188){if(71!==e[l])throw new Error("TS packet did not start with 0x47");var c=!!(64&e[l+1]),h=((31&e[l+1])<<8)+e[l+2],d=void 0;if(1<(48&e[l+3])>>4){if((d=l+5+e[l+4])===l+188)continue}else d=l+4;switch(h){case 0:c&&(d+=e[d]+1),this._pmtId=(31&e[d+10])<<8|e[d+11];break;case this._pmtId:c&&(d+=e[d]+1);var f=d+3+((15&e[d+1])<<8|e[d+2])-4;for(d+=12+((15&e[d+10])<<8|e[d+11]);d<f;){var p=(31&e[d+1])<<8|e[d+2];switch(e[d]){case 15:n.pid=u=p;break;case 3:case 4:-1===n.pid&&(n.pid=u=p,n.codecType=Rt);break;case 27:-1===o&&(r.codecType="avc",r.pid=o=p);break;case 36:-1===o&&(r.codecType=At,r.pid=o=p);break;default:zi.warn("Unsupported stream. type: ".concat(e[d],", pid: ").concat(p))}d+=5+((15&e[d+3])<<8|e[d+4])}break;case o:c&&this._videoPesData.length&&this._parseVideoData(),this._videoPesData.push(e.subarray(d,l+188));break;case u:c&&this._audioPesData.length&&this._parseAudioData(),this._audioPesData.push(e.subarray(d,l+188));break;case 17:case 8191:break;default:zi.warn("Unknown pid: ".concat(h))}}return this._parseVideoData(),this._parseAudioData(),n.formatTimescale=r.formatTimescale=r.timescale=s.timescale=9e4,n.timescale=n.sampleRate||0,{videoTrack:r,audioTrack:n,metadataTrack:s}}},{key:"fix",value:function(e,t,i){return this._fixer.fix(e,t,i),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,i,n){return this.demux(e,t,i),this.fix(n,t,i)}},{key:"_parseVideoData",value:function(){var e,t;this._videoPesData.length&&((e=Qi._parsePES(y.apply(void 0,m(this._videoPesData))))?((t=Si.parseAnnexB(e.data))?this._createVideoSample(t,e.pts,e.dts):zi.warn("Cannot parse avc units",e),this._videoPesData=[]):zi.warn("Cannot parse video pes",this._videoPesData))}},{key:"_createVideoSample",value:function(e,s,t){var a,o,u,l=this;e.length&&(a=this.videoTrack,o=a.codecType===At,u=new Gt(s,t),e.forEach(function(e){var t,i=o?e[0]>>>1&63:31&e[0];switch(i){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:!o&&5!=i||o&&5==i||(u.setToKeyframe(),l._gopId++);break;case 6:case 39:case 40:if(!o&&6!=i||o&&6==i)break;return void l.metadataTrack.seiSamples.push(new Wt(Si.parseSEI(Si.removeEPB(e),o),s));case 32:!o||a.vps.length||(t=wi.parseVPS(Si.removeEPB(e),a.hvcC),a.hvcC=a.hvcC||t,a.vps=[e]);break;case 7:case 33:!o&&7!=i||o&&7==i||a.sps.length||(t=Si.removeEPB(e),t=o?wi.parseSPS(t,a.hvcC):xi.parseSPS(t),a.sps=[e],a.hvcC=a.hvcC||t.hvcC,a.codec=t.codec,a.width=t.width,a.height=t.height,a.sarRatio=t.sarRatio,a.fpsNum=t.fpsNum,a.fpsDen=t.fpsDen);break;case 8:case 34:!o&&8!=i||o&&8==i||a.pps.length||(a.pps=[e]);break;case 9:case 35:break;case 38:if(o){for(var n=!1,r=2;r<e.byteLength;r++)if(255===e[r]){n=!0;break}if(!n)return}}u.units.push(e)}),u.gopId=this._gopId,this._pushVideoSample(a,u))}},{key:"_pushVideoSample",value:function(e,t){var i;t.units.length&&(null==t.pts?(zi.warn("Video sample no pts",t),(i=e.samples[e.samples.length-1])?(t.pts=i.pts,t.dts=i.dts):zi.warn("Drop video sample",t)):e.samples.push(t))}},{key:"_parseAudioData",value:function(){if(this._audioPesData.length){var e=Qi._parsePES(y.apply(void 0,m(this._audioPesData)));if(e){switch(this.audioTrack.codecType){case Lt:this._parseAacData(e);break;case Rt:this._parseMPEG(e)}this._audioPesData=[]}else zi.warn("Cannot parse audio pes",this._audioPesData)}}},{key:"_parseAacData",value:function(e){var t=this.audioTrack,i=e.pts;if(null==i){if(zi.warn("AAC pes not pts",t),!t.samples.length||!t.sampleRate)return;i=t.samples[t.samples.length-1].pts+ki.getFrameDuration(t.sampleRate)}i=ki.parseADTS(e.data,i);i?(t.codec=i.codec,t.channelCount=i.channelCount,t.sampleRate=i.sampleRate,t.objectType=i.objectType,t.sampleRateIndex=i.samplingFrequencyIndex,t.config=i.config,(t=t.samples).push.apply(t,m(i.frames.map(function(e){return new zt(e.pts,e.data)}))),i.skip&&zi.warn("Skip aac adts ".concat(i.skip," bits")),i.remaining&&zi.warn("Remaining aac adts ".concat(i.remaining," bits"))):zi.warn("Cannot parse aac adts",e)}},{key:"_parseMPEG",value:function(e){var t=e.data,i=t.length,n=0,r=0,s=e.pts;if(void 0!==s)for(;r<i;)if(Pi.isHeader(t,r)){var a=Pi.appendFrame(this.audioTrack,t,r,s,n);if(!a)break;r+=a.length,n++}else r++;else zi.warn("[tsdemuxer]: MPEG PES unknown PTS")}}],[{key:"probe",value:function(e){return!!e.length&&71===e[0]&&71===e[188]&&71===e[376]}},{key:"_parsePES",value:function(e){var t=e[8];if(!(null==t||e.length<t+9)&&1==(e[0]<<16|e[1]<<8|e[2])){var i,n,r=(e[4]<<8)+e[5];if(!(r&&r>e.length-6))return 192&(r=e[7])&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&r?54e5<i-(n=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)&&(i=n):n=i),{data:e.subarray(9+t),pts:i,dts:n}}}}]),Qi),Wi=(e(Xi,[{key:"buffer",get:function(){return this.dv.buffer}},{key:"unreadLength",get:function(){return Math.max(this.end-this.offset,0)}},{key:"size",get:function(){return this.end-this.start}},{key:"readFloat",value:function(e){var t=0;switch(e){case 4:t=this.dv.getFloat32(this.offset);break;case 8:t=this.dv.getFloat64(this.offset);break;default:throw new Error("read ".concat(e,"-byte float is not supported"))}return this.offset+=e,t}},{key:"back",value:function(e){this.offset-=e}},{key:"skip",value:function(e){this.offset+=e}},{key:"readInt",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getInt8(t);case 2:return this.dv.getInt16(t);case 4:return this.dv.getInt32(t);default:throw new Error("read ".concat(e,"-byte integers is not supported"))}}},{key:"read",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getUint8(t);case 2:return this.dv.getUint16(t);case 3:return(this.dv.getUint16(t)<<8)+this.dv.getUint8(t+2);case 4:return this.dv.getUint32(t);default:return this.back(e-4),this.read(e-4)+this.dv.getUint32(t)*Math.pow(256,e-4)}}},{key:"write",value:function(e,t){var i=this.offset;switch(this.offset+=e,e){case 1:return this.dv.setUint8(i,t);case 2:return this.dv.setUint16(i,t);case 3:return this.dv.setUint8(i,t>>>16),this.dv.setUint16(i+1,65535&t);case 4:return this.dv.setUint32(i,t);default:throw new Error("write ".concat(e,"-byte integers is not supported"))}}},{key:"readToBuffer",value:function(e){e=this.offset||e?this.dv.buffer.slice(this.offset,e?this.offset+e:this.end):this.dv.buffer;return this.offset+=e.byteLength,e}},{key:"readToUint8",value:function(e){e=new Uint8Array(this.dv.buffer,this.offset,e||this.unreadLength);return this.offset+=e.byteLength,e}},{key:"readString",value:function(e){for(var t=0,i="";t<e;t++)i+=String.fromCharCode(this.dv.getUint8(this.offset)),this.offset++;return i}}],[{key:"fromUint8",value:function(e){return new Xi(e.buffer,e.byteOffset,e.byteLength)}},{key:"concatUint8s",value:function(e){var t=new Uint8Array(e.reduce(function(e,t){return e+t.byteLength},0)),i=0;return e.forEach(function(e){t.set(e,i),i+=e.byteLength}),t}},{key:"concatUint8",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.concatUint8s(t)}}]),Xi),Ki=(e(Yi,[{key:"skip",value:function(e){this.offset+=e}},{key:"read",value:function(e){var t=this.size-this.offset-e;if(0<=t){var i=0,n=0;if(this.offset+=e,31<this.size){for(;n<e;n++)i+=Math.pow(2,n);return this.val/Math.pow(2,t)&i}for(;n<e;n++)i+=1<<n;return this.val>>>t&i}throw new Error("the number of the read operation exceeds the total length limit of bits")}}],[{key:"fromByte",value:function(e,t){return new Yi(e.read(t),t<<3)}}]),Yi),b=(e(g,null,[{key:"findBox",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=[];if(e)for(var r,s=0,a=0;7<e.length;){if(s=k(e),r=String.fromCharCode.apply(null,e.subarray(4,8)),a=8,1===s?(s=mi(e,8),a+=8):s=s||e.length,!t[0]||r===t[0]){var o=e.subarray(0,s);if(!(t.length<2))return g.findBox(o.subarray(a),t.slice(1),i+a);n.push({start:i,size:s,headerSize:a,type:r,data:o})}i+=s,e=e.subarray(s)}return n}},{key:"tfhd",value:function(e){return S(e,!0,function(e,t){e.trackId=k(t);var i=4,n=2&e.flags,r=8&e.flags,s=16&e.flags,a=32&e.flags;1&e.flags&&(e.baseDataOffset=k(t,i+=4),i+=4),n&&(e.sampleDescriptionIndex=k(t,i),i+=4),r&&(e.defaultSampleDuration=k(t,i),i+=4),s&&(e.defaultSampleSize=k(t,i),i+=4),a&&(e.defaultSampleFlags=k(t,i))})}},{key:"sidx",value:function(e){return S(e,!0,function(e,t){var i=0,n=(e.reference_ID=k(t,i),e.timescale=k(t,i+=4),i+=4,0===e.version?(e.earliest_presentation_time=k(t,i),e.first_offset=k(t,i+=4),i+=4):(e.earliest_presentation_time=mi(t,i),e.first_offset=mi(t,i+=8),i+=8),i+=2,e.references=[],d(t,i));i+=2;for(var r=0;r<n;r++){var s={},a=(e.references.push(s),k(t,i));i+=4,s.reference_type=a>>31&1,s.referenced_size=2147483647&a,s.subsegment_duration=k(t,i),a=k(t,i+=4),i+=4,s.starts_with_SAP=a>>31&1,s.SAP_type=a>>28&7,s.SAP_delta_time=268435455&a}})}},{key:"moov",value:function(e){return S(e,!1,function(e,t,i){e.mvhd=g.mvhd(g.findBox(t,["mvhd"],i)[0]),e.trak=g.findBox(t,["trak"],i).map(function(e){return g.trak(e)}),e.pssh=g.pssh(g.findBox(t,["pssh"],i)[0])})}},{key:"mvhd",value:function(e){return S(e,!0,function(e,t){var i=0;1===e.version?(e.timescale=k(t,16),e.duration=mi(t,20),i+=28):(e.timescale=k(t,8),e.duration=k(t,12),i+=16),e.nextTrackId=k(t,i+76)})}},{key:"trak",value:function(e){return S(e,!1,function(e,t,i){e.tkhd=g.tkhd(g.findBox(t,["tkhd"],i)[0]),e.mdia=g.mdia(g.findBox(t,["mdia"],i)[0])})}},{key:"tkhd",value:function(e){return S(e,!0,function(e,t){var i=Wi.fromUint8(t);1===e.version?(i.read(8),i.read(8),e.trackId=i.read(4),i.read(4),e.duration=i.read(8)):(i.read(4),i.read(4),e.trackId=i.read(4),i.read(4),e.duration=i.read(4)),i.skip(16),e.matrix=[];for(var n=0;n<36;n++)e.matrix.push(i.read(1));i.back(36);for(var r,s,a,o=[],u=0;u<3;u++)o.push(_i(i.readInt(2),i.readInt(2))),o.push(_i(i.readInt(2),i.readInt(2))),r=i.readInt(4),o.push(_i(r>>30,1073741823&r));e.rotation=(t=o).length<5||(s=Math.hypot(t[0],t[3]),a=Math.hypot(t[1],t[4]),0===s)||0===a?0:180*Math.atan2(t[1]/a,t[0]/s)/Math.PI,e.width=i.read(4),e.height=i.read(4)})}},{key:"mdia",value:function(e){return S(e,!1,function(e,t,i){e.mdhd=g.mdhd(g.findBox(t,["mdhd"],i)[0]),e.hdlr=g.hdlr(g.findBox(t,["hdlr"],i)[0]),e.minf=g.minf(g.findBox(t,["minf"],i)[0])})}},{key:"mdhd",value:function(e){return S(e,!0,function(e,t){var i=0,t=(1===e.version?(e.timescale=k(t,16),e.duration=mi(t,20),i+=28):(e.timescale=k(t,8),e.duration=k(t,12),i+=16),d(t,i));e.language=String.fromCharCode(96+(t>>10&31),96+(t>>5&31),96+(31&t))})}},{key:"hdlr",value:function(e){return S(e,!0,function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))})}},{key:"minf",value:function(e){return S(e,!1,function(e,t,i){e.vmhd=g.vmhd(g.findBox(t,["vmhd"],i)[0]),e.smhd=g.smhd(g.findBox(t,["smhd"],i)[0]),e.stbl=g.stbl(g.findBox(t,["stbl"],i)[0])})}},{key:"vmhd",value:function(e){return S(e,!0,function(e,t){e.graphicsmode=d(t),e.opcolor=[d(t,2),d(t,4),d(t,6)]})}},{key:"smhd",value:function(e){return S(e,!0,function(e,t){e.balance=d(t)})}},{key:"stbl",value:function(e){return S(e,!1,function(e,t,i){e.stsd=g.stsd(g.findBox(t,["stsd"],i)[0]),e.stts=g.stts(g.findBox(t,["stts"],i)[0]),e.ctts=g.ctts(g.findBox(t,["ctts"],i)[0]),e.stsc=g.stsc(g.findBox(t,["stsc"],i)[0]),e.stsz=g.stsz(g.findBox(t,["stsz"],i)[0]),e.stco=g.st
1co(g.findBox(t,["stco"],i)[0]),e.stco||(e.co64=g.co64(g.findBox(t,["co64"],i)[0]),e.stco=e.co64);var n=null==(n=e.stsd.entries[0])||null==(n=n.sinf)||null==(n=n.schi)?void 0:n.tenc.default_IV_size;e.stss=g.stss(g.findBox(t,["stss"],i)[0]),e.senc=g.senc(g.findBox(t,["senc"],i)[0],n)})}},{key:"senc",value:function(e){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8;return S(e,!0,function(e,t){var i=0,n=k(t,i);i+=4,e.samples=[];for(var r=0;r<n;r++){for(var s={InitializationVector:[]},a=0;a<c;a++)s.InitializationVector[a]=t[i+a];if(i+=c,2&e.flags){s.subsamples=[];var o=d(t,i);i+=2;for(var u=0;u<o;u++){var l={};l.BytesOfClearData=d(t,i),l.BytesOfProtectedData=k(t,i+=2),i+=4,s.subsamples.push(l)}}e.samples.push(s)}})}},{key:"pssh",value:function(e){return S(e,!0,function(e,t){for(var i=[],n=[],r=0,s=0;s<16;s++)n.push(tn(t[r+s]));if(r+=16,0<e.version){var a=k(t,r);r+=4;for(var o=0;o<(""+a).length;o++)for(var u=0;u<16;u++){var l=t[r];r+=1,i.push(tn(l))}}var c=k(t,r);e.data_size=c,r+=4,e.kid=i,e.system_id=n,e.buffer=t})}},{key:"stsd",value:function(e){return S(e,!0,function(e,t,i){e.entryCount=k(t),e.entries=g.findBox(t.subarray(4),[],i+4).map(function(e){switch(e.type){case"av01":return g.av01(e);case"avc1":case"avc2":case"avc3":case"avc4":return g.avc1(e);case"hvc1":case"hev1":return g.hvc1(e);case"mp4a":return g.mp4a(e);case"alaw":case"ulaw":return g.alaw(e);case"enca":return S(e,!1,function(e,t,i){e.channelCount=d(t,16),e.samplesize=d(t,18),e.sampleRate=k(t,24)/65536,t=t.subarray(28),e.sinf=g.sinf(g.findBox(t,["sinf"],i)[0]),e.esds=g.esds(g.findBox(t,["esds"],i)[0])});case"encv":return S(e,!1,function(e,t,i){e.width=d(t,24),e.height=d(t,26),e.horizresolution=k(t,28),e.vertresolution=k(t,32),t=t.subarray(78),e.sinf=g.sinf(g.findBox(t,["sinf"],i)[0]),e.avcC=g.avcC(g.findBox(t,["avcC"],i)[0]),e.hvcC=g.hvcC(g.findBox(t,["hvcC"],i)[0]),e.pasp=g.pasp(g.findBox(t,["pasp"],i)[0])})}}).filter(Boolean)})}},{key:"tenc",value:function(e){return S(e,!1,function(e,t){var i=6;e.default_IsEncrypted=t[i],e.default_IV_size=t[i+=1],i+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(tn(t[i])),i+=1})}},{key:"schi",value:function(e){return S(e,!1,function(e,t,i){e.tenc=g.tenc(g.findBox(t,["tenc"],i)[0])})}},{key:"sinf",value:function(e){return S(e,!1,function(e,t,i){e.schi=g.schi(g.findBox(t,["schi"],i)[0]),e.frma=g.frma(g.findBox(t,["frma"],i)[0])})}},{key:"frma",value:function(e){return S(e,!1,function(e,t){e.data_format="";for(var i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])})}},{key:"colr",value:function(n){return S(n,!1,function(e,t){var i=Wi.fromUint8(t);e.data=n.data,e.colorType=i.readString(4),"nclx"===e.colorType?(e.colorPrimaries=i.read(2),e.transferCharacteristics=i.read(2),e.matrixCoefficients=i.read(2),e.fullRangeFlag=i.read(1)>>7):"rICC"!==e.colorType&&"prof"!==e.colorType||(e.iccProfile=t.readToUint8())})}},{key:"av01",value:function(e){return S(e,!1,function(e,t,i){$i(e,t);t=t.subarray(78);e.av1C=g.av1C(g.findBox(t,["av1C"],i+=78)[0]),e.colr=g.colr(g.findBox(t,["colr"],i)[0])})}},{key:"av1C",value:function(r){return S(r,!1,function(e,t){e.data=r.data;var i,t=Wi.fromUint8(t),n=Ki.fromByte(t,4);e.marker=n.read(1),e.version=n.read(7),e.seqProfile=n.read(3),e.seqLevelIdx0=n.read(5),e.seqTier0=n.read(1),e.highBitdepth=n.read(1),e.twelveBit=n.read(1),e.monochrome=n.read(1),e.chromaSubsamplingX=n.read(1),e.chromaSubsamplingY=n.read(1),e.chromaSamplePosition=n.read(2),e.reserved=n.read(3),e.initialPresentationDelayPresent=n.read(1),e.initialPresentationDelayPresent?e.initialPresentationDelayMinusOne=n.read(4):e.initialPresentationDelayMinusOne=0,e.configOBUs=t.readToUint8(),2===e.seqLevelIdx0&&1===e.highBitdepth?i=1===e.twelveBit?"12":"10":e.seqProfile<=2&&(i=1===e.highBitdepth?"10":"08"),e.codec=["av01",e.seqProfile,(e.seqLevelIdx0<10?"0"+e.seqLevelIdx0:e.seqLevelIdx0)+(e.seqTier0?"H":"M"),i].join(".")})}},{key:"avc1",value:function(e){return S(e,!1,function(e,t,i){$i(e,t);t=t.subarray(78);e.avcC=g.avcC(g.findBox(t,["avcC"],i+=78)[0]),e.pasp=g.pasp(g.findBox(t,["pasp"],i)[0])})}},{key:"avcC",value:function(o){return S(o,!1,function(e,t){e.data=o.data,e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=yi([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var i=6,n=0;n<e.spsLength;n++){var r=d(t,i);i+=2,e.sps.push(t.subarray(i,i+r)),i+=r}e.ppsLength=t[i],i+=1,e.pps=[];for(var s=0;s<e.ppsLength;s++){var a=d(t,i);i+=2,e.pps.push(t.subarray(i,i+=a)),i+=a}})}},{key:"hvc1",value:function(e){return S(e,!1,function(e,t,i){$i(e,t);t=t.subarray(78);e.hvcC=g.hvcC(g.findBox(t,["hvcC"],i+=78)[0]),e.pasp=g.pasp(g.findBox(t,["pasp"],i)[0])})}},{key:"hvcC",value:function(h){return S(h,!1,function(e,t){e.data=h.data,e.codec="hev1.1.6.L93.B0",e.configurationVersion=t[0];var i=t[1];e.generalProfileSpace=i>>6,e.generalTierFlag=(32&i)>>5,e.generalProfileIdc=31&i,e.generalProfileCompatibility=k(t,2),e.generalConstraintIndicatorFlags=t.subarray(6,12),e.generalLevelIdc=t[12],e.avgFrameRate=d(t,19),e.numOfArrays=t[22],e.vps=[],e.sps=[],e.pps=[];for(var n,r,s=23,a=0;a<e.numOfArrays;a++){u=63&t[s],n=d(t,s+1),s+=3;for(var o,u,l=[],c=0;c<n;c++)r=d(t,s),s+=2,l.push(t.subarray(s,s+r)),s+=r;32==u?(o=e.vps).push.apply(o,l):33==u?(o=e.sps).push.apply(o,l):34==u&&(u=e.pps).push.apply(u,l)}})}},{key:"pasp",value:function(e){return S(e,!1,function(e,t){e.hSpacing=k(t),e.vSpacing=k(t,4)})}},{key:"mp4a",value:function(e){return S(e,!1,function(e,t,i){en(e,t);e.esds=g.esds(g.findBox(t.subarray(28),["esds"],i+28)[0])})}},{key:"esds",value:function(e){return S(e,!0,function(e,t){e.codec="mp4a.";for(var i,n,r=0,s=0,a=0;t.length;){for(i=t[r=0],s=t[r+1],r+=2;128&s;)a=(127&s)<<7,s=t[r],r+=1;if(a+=127&s,3===i)t=t.subarray(r+3);else{if(4!==i)return 5===i&&(31===(n=(248&(i=e.config=t.subarray(r,r+a))[0])>>3)&&2<=i.length&&(n=32+((7&i[0])<<3)+((224&i[1])>>5)),e.objectType=n,e.codec+=n.toString(16)),"."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1));e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}})}},{key:"alaw",value:function(e){return S(e,!1,function(e,t){en(e,t)})}},{key:"stts",value:function(e){return S(e,!0,function(e,t){for(var i=k(t),n=[],r=4,s=0;s<i;s++)n.push({count:k(t,r),delta:k(t,r+4)}),r+=8;e.entryCount=i,e.entries=n})}},{key:"ctts",value:function(e){return S(e,!0,function(e,t){var i=k(t),n=[],r=4;if(1===e.version)for(var s=0;s<i;s++)n.push({count:k(t,r),offset:k(t,r+4)}),r+=8;else for(var a=0;a<i;a++)n.push({count:k(t,r),offset:-(1+~k(t,r+4))}),r+=8;e.entryCount=i,e.entries=n})}},{key:"stsc",value:function(e){return S(e,!0,function(e,t){for(var i=k(t),n=[],r=4,s=0;s<i;
1s++)n.push({firstChunk:k(t,r),samplesPerChunk:k(t,r+4),sampleDescriptionIndex:k(t,r+8)}),r+=12;e.entryCount=i,e.entries=n})}},{key:"stsz",value:function(e){return S(e,!0,function(e,t){var i=k(t),n=k(t,4),r=[];if(!i)for(var s=8,a=0;a<n;a++)r.push(k(t,s)),s+=4;e.sampleSize=i,e.sampleCount=n,e.entrySizes=r})}},{key:"stco",value:function(e){return S(e,!0,function(e,t){for(var i=k(t),n=[],r=4,s=0;s<i;s++)n.push(k(t,r)),r+=4;e.entryCount=i,e.entries=n})}},{key:"co64",value:function(e){return S(e,!0,function(e,t){for(var i=k(t),n=[],r=4,s=0;s<i;s++)n.push(mi(t,r)),r+=8;e.entryCount=i,e.entries=n})}},{key:"stss",value:function(e){return S(e,!0,function(e,t){for(var i=k(t),n=[],r=4,s=0;s<i;s++)n.push(k(t,r)),r+=4;e.entryCount=i,e.entries=n})}},{key:"moof",value:function(e){return S(e,!1,function(e,t,i){e.mfhd=g.mfhd(g.findBox(t,["mfhd"],i)[0]),e.traf=g.findBox(t,["traf"],i).map(function(e){return g.traf(e)})})}},{key:"mfhd",value:function(e){return S(e,!0,function(e,t){e.sequenceNumber=k(t)})}},{key:"traf",value:function(e){return S(e,!1,function(e,t,i){e.tfhd=g.tfhd(g.findBox(t,["tfhd"],i)[0]),e.tfdt=g.tfdt(g.findBox(t,["tfdt"],i)[0]),e.trun=g.trun(g.findBox(t,["trun"],i)[0])})}},{key:"trun",value:function(e){return S(e,!0,function(e,t){var i=e.version,n=e.flags,r=t.length,s=e.sampleCount=k(t),a=4;if(a<r&&1&n&&(e.dataOffset=-(1+~k(t,a)),a+=4),a<r&&4&n&&(e.firstSampleFlags=k(t,a),a+=4),e.samples=[],a<r)for(var o,u=0;u<s;u++)o={},256&n&&(o.duration=k(t,a),a+=4),512&n&&(o.size=k(t,a),a+=4),1024&n&&(o.flags=k(t,a),a+=4),2048&n&&(o.cts=i?-(1+~k(t,a+4)):k(t,a),a+=4),e.samples.push(o)})}},{key:"tfdt",value:function(e){return S(e,!0,function(e,t){1===e.version?e.baseMediaDecodeTime=mi(t):e.baseMediaDecodeTime=k(t)})}},{key:"probe",value:function(e){return!!g.findBox(e,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,i){var n,r=e.trak;if(r&&r.length){var s=r.find(function(e){return"vide"===(null==(e=e.mdia)||null==(e=e.hdlr)?void 0:e.handlerType)}),r=r.find(function(e){return"soun"===(null==(e=e.mdia)||null==(e=e.hdlr)?void 0:e.handlerType)});if(s&&t){var a=t;null!=(null==(o=s.tkhd)?void 0:o.trackId)&&(a.id=s.tkhd.trackId),a.tkhdDuration=s.tkhd.duration,a.mvhdDurtion=e.mvhd.duration,a.mvhdTimecale=e.mvhd.timescale,a.timescale=a.formatTimescale=s.mdia.mdhd.timescale,a.duration=s.mdia.mdhd.duration||a.mvhdDurtion/a.mvhdTimecale*a.timescale,a.rotation=s.tkhd.rotation,a.matrix=s.tkhd.matrix;var o=s.mdia.minf.stbl.stsd.entries[0];if(a.width=o.width,a.height=o.height,o.pasp&&(a.sarRatio=[o.pasp.hSpacing,o.pasp.vSpacing]),o.av1C)a.codecType="av1",a.codec=o.av1C.codec,a.av1C=o.av1C.data,a.colr=o.colr.data;else if(o.hvcC)a.codecType=At,a.codec=o.hvcC.codec,a.vps=o.hvcC.vps,a.sps=o.hvcC.sps,a.pps=o.hvcC.pps,a.hvcC=o.hvcC.data;else{if(!o.avcC)throw new Error("unknown video stsd entry");a.codec=o.avcC.codec,a.sps=o.avcC.sps,a.pps=o.avcC.pps}a.present=!0,a.ext={},a.ext.stss=null==(l=s.mdia)||null==(l=l.minf)||null==(l=l.stbl)?void 0:l.stss,a.ext.ctts=null==(l=s.mdia)||null==(l=l.minf)||null==(l=l.stbl)?void 0:l.ctts,o&&"encv"===o.type&&(a.isVideoEncryption=!0,o.default_KID=null==(l=o.sinf)||null==(l=l.schi)?void 0:l.tenc.default_KID,o.default_IsEncrypted=null==(l=o.sinf)||null==(l=l.schi)?void 0:l.tenc.default_IsEncrypted,o.default_IV_size=null==(l=o.sinf)||null==(l=l.schi)?void 0:l.tenc.default_IV_size,a.videoSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,o.data_format=null==(l=o.sinf)||null==(s=l.frma)?void 0:s.data_format,a.useEME=e.useEME,a.kidValue=e.kidValue,a.pssh=e.pssh,a.encv=o)}if(r&&i){var u=i;null!=(null==(l=r.tkhd)?void 0:l.trackId)&&(u.id=r.tkhd.trackId),u.tkhdDuration=r.tkhd.duration,u.mvhdDurtion=e.mvhd.duration,u.mvhdTimecale=e.mvhd.timescale,u.timescale=u.formatTimescale=r.mdia.mdhd.timescale,u.duration=r.mdia.mdhd.duration||u.mvhdDurtion/u.mvhdTimecale*u.timescale;var l,c=r.mdia.minf.stbl.stsd.entries[0];switch(u.sampleSize=c.sampleSize,u.sampleRate=c.sampleRate,u.channelCount=c.channelCount,u.present=!0,c.type){case"alaw":u.codecType=u.codec=Pt,u.sampleRate=8e3;break;case"ulaw":u.codecType=u.codec=It,u.sampleRate=8e3;break;default:u.sampleDuration=ki.getFrameDuration(u.sampleRate,u.timescale),u.sampleRateIndex=ki.getRateIndexByRate(u.sampleRate),u.objectType=(null==(n=c.esds)?void 0:n.objectType)||2,c.esds&&(u.config=Array.from(c.esds.config)),u.codec=(null==(n=c.esds)?void 0:n.codec)||"mp4a.40.2"}u.sampleDuration=ki.getFrameDuration(u.sampleRate,u.timescale),u.objectType=(null==(s=c.esds)?void 0:s.objectType)||2,c.esds&&(c.esds.config?u.config=Array.from(c.esds.config):console.warn("esds config is null")),u.codec=(null==(a=c.esds)?void 0:a.codec)||"mp4a.40.2",u.sampleRateIndex=ki.getRateIndexByRate(u.sampleRate),u.ext={},u.ext.stss=null==(o=r.mdia)||null==(l=o.minf)||null==(s=l.stbl)?void 0:s.stss,u.ext.ctts=null==(a=r.mdia)||null==(o=a.minf)||null==(l=o.stbl)?void 0:l.ctts,u.present=!0,c&&"enca"===c.type&&(u.isAudioEncryption=!0,c.data_format=null==(s=c.sinf)||null==(a=s.frma)?void 0:a.data_format,c.default_KID=null==(o=c.sinf)||null==(l=o.schi)?void 0:l.tenc.default_KID,c.default_IsEncrypted=null==(s=c.sinf)||null==(a=s.schi)?void 0:a.tenc.default_IsEncrypted,c.default_IV_size=null==(o=c.sinf)||null==(l=o.schi)?void 0:l.tenc.default_IV_size,u.audioSenc=r.mdia.minf.stbl.senc&&r.mdia.minf.stbl.senc.samples,u.useEME=e.useEME,u.kidValue=e.kidValue,u.enca=c)}return i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),(null!=t&&t.encv||null!=i&&i.enca)&&(a=null==t||null==(s=t.encv)?void 0:s.default_KID,l=null==i||null==(o=i.enca)?void 0:o.default_KID,r
1=a||l?(a||l).join(""):null,t&&(t.kid=r),i)&&(i.kid=r),t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}}},{key:"evaluateDefaultDuration",value:function(e,t,i){var n=null==t||null==(n=t.samples)?void 0:n.length;return n?1024*n/t.timescale*e.timescale/i:1024}},{key:"moofToSamples",value:function(e,c,h){var d={};return e.mfhd&&(c&&(c.sequenceNumber=e.mfhd.sequenceNumber),h)&&(h.sequenceNumber=e.mfhd.sequenceNumber),e.traf.forEach(function(e){var t=e.tfhd,i=e.tfdt,n=e.trun;if(t&&n){i&&(c&&c.id===t.trackId&&(c.baseMediaDecodeTime=i.baseMediaDecodeTime),h)&&h.id===t.trackId&&(h.baseMediaDecodeTime=i.baseMediaDecodeTime);var r=t.defaultSampleSize||0,s=t.defaultSampleDuration||g.evaluateDefaultDuration(c,h,n.samples.length||n.sampleCount),a=n.dataOffset||0,o=0,u=-1;if(!n.samples.length&&n.sampleCount){d[t.trackId]=[];for(var l=0;l<n.sampleCount;l++)d[t.trackId].push({offset:a,dts:o,duration:s,size:r}),o+=s,a+=r}else d[t.trackId]=n.samples.map(function(e,t){return(e={offset:a,dts:o,pts:o+(e.cts||0),duration:e.duration||s,size:e.size||r,gopId:u,keyframe:0===t||null!=e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(u++,e.gopId=u),o+=e.duration,a+=e.size,e})}}),d}},{key:"moovToSamples",value:function(e){e=e.trak;if(e&&e.length){var t,i=e.find(function(e){return"vide"===(null==(e=e.mdia)||null==(e=e.hdlr)?void 0:e.handlerType)}),e=e.find(function(e){return"soun"===(null==(e=e.mdia)||null==(e=e.hdlr)?void 0:e.handlerType)});if(i||e){if(i){i=null==(i=i.mdia)||null==(i=i.minf)?void 0:i.stbl;if(!i)return;var n=i.stts,r=i.stsc,s=i.stsz,a=i.stco,o=i.stss;if(!(n&&r&&s&&a&&o))return;n=Ji(n,r,s,a,i.ctts,o)}if(e){a=null==(r=e.mdia)||null==(s=r.minf)?void 0:s.stbl;if(!a)return;o=null==(i=e.mdia.mdhd)?void 0:i.timescale,r=a.stts,s=a.stsc,e=a.stsz,i=a.stco;if(!(o&&r&&s&&e&&i))return;t=Ji(r,s,e,i)}return{videoSamples:n,audioSamples:t}}}}}]),g);function g(){l(this,g)}function Yi(e,t){l(this,Yi),this.offset=0,this.val=e,this.size=t}function Xi(e,t,i){l(this,Xi),this.dv=new DataView(e),this.start=this.offset=t||this.dv.byteOffset,this.end=i?this.start+i:this.start+this.dv.byteLength}function Qi(e,t,i){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};l(this,Qi),s(this,"_pmtId",-1),s(this,"_remainingPacketData",null),s(this,"_videoPesData",[]),s(this,"_audioPesData",[]),s(this,"_gopId",0),this.videoTrack=e||new Ht,this.audioTrack=t||new Vt,this.metadataTrack=i||new Kt,this._fixer=new Gi(this.videoTrack,this.audioTrack,this.metadataTrack,n)}function Zi(e,t,i,n){l(this,Zi),this.videoTrack=e,this.audioTrack=t,this.metadataTrack=i,this._baseDts=-1,this._baseVideoDts=-1,this._baseAudioDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._needForceFixLargeGap=null==n?void 0:n.forceFixLargeGap,this._largeGapThreshold=(null==n?void 0:n.largeGapThreshold)||45e4}function Ji(e,t,r,i,n,s){var a,o,u,l=[],n=null==n?void 0:n.entries,c=t.entries,h=i.entries,d=r.entrySizes,f=null==s?void 0:s.entries,p=(f&&(a={},f.forEach(function(e){a[e-1]=!0})),n&&(o=[],n.forEach(function(e){for(var t=e.count,i=e.offset,n=0;n<t;n++)o.push(i)})),-1),g=0,m=0,y=0,v=0,_=0,k=c[0].samplesPerChunk,b=c[1]?c[1].firstChunk-1:1/0;return e.entries.forEach(function(e){for(var t=e.count,i=e.delta,n=0;n<t;n++)u={dts:g,duration:i,size:d[m]||r.sampleSize,offset:h[y]+_,index:m},f&&(u.keyframe=a[m],u.keyframe&&p++,u.gopId=p),o&&m<o.length&&(u.pts=u.dts+o[m]),l.push(u),g+=i,++m<k?_+=u.size:(_=0,b<=++y&&(b=c[++v+1]?c[v+1].firstChunk-1:1/0),k+=c[v].samplesPerChunk)}),l}function $i(e,t){return e.dataReferenceIndex=d(t,6),e.width=d(t,24),e.height=d(t,26),e.horizresolution=k(t,28),e.vertresolution=k(t,32),e.frameCount=d(t,40),e.depth=d(t,74),78}function en(e,t){return e.dataReferenceIndex=d(t,6),e.channelCount=d(t,16),e.sampleSize=d(t,18),e.sampleRate=k(t,24)/65536,28}function S(e,t,i){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=function(e,t){t=1<arguments.length&&void 0!==t?t:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),n.headerSize+=4),i(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var tn=function(){for(var t=[],e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];
1return i.forEach(function(e){t.push(((e,t,i)=>{for(var n=String(i),i=t>>0,r=Math.ceil(i/n.length),s=[],t=String(e);r--;)s.push(n);return s.join("").substring(0,i-t.length)+t})(Number(e).toString(16),2,0))}),t[0]},nn=(e(rn,[{key:"demuxPart",value:function(e,t,i){var n,l=this,c=this.videoTrack,r=this.audioTrack,s=c.exist(),a=r.exist(),h=/av01/.test(c.codec),d=(c.samples=[],r.samples=[],e),f=t;if(this.__lastRemainData&&(t<=(n=this.__lastRemainDataStart+this.__lastRemainData.byteLength)&&t>this.__lastRemainDataStart&&t+e.byteLength>n?(n=e.subarray(this.__lastRemainData.byteLength+this.__lastRemainDataStart-t),d=y(this.__lastRemainData,n),f=this.__lastRemainDataStart,this.__lastRemainData=null):(this.__lastRemainData=null,this.__lastRemainDataStart=0,this.__nextMoofStart=-1)),!i){e=b.findBox(d,["moov"])[0];if(!e)throw new Error("cannot found moov box");i=b.moov(e)}if(d){var p=f+d.byteLength,o=(s||a||b.moovToTrack(i,c,r),[]);this.__nextMoofStart<0?b.findBox(d,["moof"],f).forEach(function(e){return o.push(e)}):this.__nextMoofStart>=f&&this.__nextMoofStart<=p-8&&b.findBox(d.subarray(this.__nextMoofStart-f),["moof"],this.__nextMoofStart).forEach(function(e){return o.push(e)}),o.filter(function(e){return e.size<=e.data.length}).forEach(function(e){e=b.moof(e);l.__nextMoofStart=e.start+Math.max.apply(Math,m(e.traf.map(function(e){return e.trun.samples.reduce(function(e,t){return e+t.size},e.trun.dataOffset||0)}))),l.__loadedMoofWraps.push({start:e.start,nextMoofStart:l.__nextMoofStart,moof:e}),l.__loadedMoofWraps.sort(function(e,t){return e.start-t.start})});var g,u=oe(this.__loadedMoofWraps);try{for(u.s();!(g=u.n()).done;)(()=>{var e=g.value;if(e.start>p||e.nextMoofStart<f)return;var a,o=e.start,t=b.moofToSamples(e.moof,c,r),u=c.baseMediaDecodeTime,n=r.baseMediaDecodeTime;Object.keys(t).forEach(function(e){c.id==e?t[e].some(function(e){var t=e.offset+=o;if(!(t<f)){if(t+e.size>p)return!0;var i=new Gt((e.pts||e.dts)+u,e.dts+u),n=(i.duration=e.duration,i.gopId=e.gopId,e.keyframe&&i.setToKeyframe(),d.subarray(t-f,t-f+e.size));if(i.data=n,!h)for(var r=0,s=n.length-1;r<s;)a=k(n,r),i.units.push(n.subarray(r+=4,r+a)),r+=a;l.__lastRemainDataStart=t+e.size,c.samples.push(i)}}):r.id==e&&t[e].some(function(e){var t=e.offset+o;if(!(t<f)){if(t+e.size>p)return!0;var i=d.subarray(t-f,t-f+e.size);r.samples.push(new zt(e.dts+n,i,e.duration)),l.__lastRemainDataStart=t+e.size}})})})()}catch(e){u.e(e)}finally{u.f()}}return this.__lastRemainDataStart>f&&this.__lastRemainDataStart<d.byteLength+f?this.__lastRemainData=d.subarray(this.__lastRemainDataStart-f):(this.__lastRemainData=d,this.__lastRemainDataStart=f),c.samples.length&&(c.baseMediaDecodeTime=c.samples[0].pts),r.samples.length&&(r.baseMediaDecodeTime=r.samples[0].pts),{videoTrack:c,audioTrack:r,metadataTrack:this.metadataTrack}}},{key:"demux",value:function(s,i){var a=this.videoTrack,n=this.audioTrack,e=a.exist(),t=n.exist();if(a.samples=[],n.samples=[],i){if(!t){var r=b.findBox(i,["moov"])[0];if(!r)throw new Error("cannot found moov box");b.moovToTrack(b.moov(r),null,n)}var o,u,r=b.findBox(i,["moof"])[0];r&&(p=b.moofToSamples(b.moof(r),null,n)[n.id],o=n.baseMediaDecodeTime,p)&&(u=r.start,p.map(function(e){e.offset+=u;var t=i.subarray(e.offset,e.offset+e.size);n.samples.push(new zt(e.dts+o,t,e.duration))}))}if(s){if(!e&&!t){r=b.findBox(s,["moov"])[0];if(!r)throw new Error("cannot found moov box");b.moovToTrack(b.moov(r),a,n)}var l,c,h,d,f,p=b.findBox(s,["moof"])[0];p&&(c=b.moofToSamples(b.moof(p),a,n),h=a.baseMediaDecodeTime,d=n.baseMediaDecodeTime,f=p.start,Object.keys(c).forEach(function(e){a.id==e?c[e].map(function(e){e.offset+=f;for(var t=new Gt((e.pts||e.dts)+h,e.dts+h),i=(t.duration=e.duration,t.gopId=e.gopId,e.keyframe&&t.setToKeyframe(),s.subarray(e.offset,e.offset+e.size)),n=0,r=(t.data=i).length-1;n<r;)l=k(i,n),t.units.push(i.subarray(n+=4,n+l)),n+=l;a.samples.push(t)}):n.id==e&&c[e].map(function(e){e.offset+=f;var t=s.subarray(e.offset,e.offset+e.size);n.samples.push(new zt(e.dts+d,t,e.duration))})}))}return{videoTrack:a,audioTrack:n,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}}],[{key:"probe",value:function(e){return b.probe(e)}}]),rn);function rn(e,t,i){l(this,rn),s(this,"__loadedMoofWraps",[]),s(this,"__lastRemainData",null),s(this,"__lastRemainDataStart",0),s(this,"__nextMoofStart",-1),this.videoTrack=e||new Ht,this.audioTrack=t||new Vt,this.metadataTrack=i||new 
1Kt}e(an,[{key:"write",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];i.forEach(function(e){e?t.buffer=function(e){for(var t=0,i=arguments.length,n=new Array(1<i?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];n.forEach(function(e){t+=e.length});var s=new e(t),a=0;return n.forEach(function(e){s.set(e,a),a+=e.length}),s}(Uint8Array,t.buffer,e):window.console.warn(e)})}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]);var c=an,sn=Math.pow(2,32)-1,x=(e(h,null,[{key:"box",value:function(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];var r=8+(i=i.filter(Boolean)).reduce(function(e,t){return e+t.byteLength},0),s=new Uint8Array(r),a=(s[0]=r>>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=255&r,s.set(e,4),8);return i.forEach(function(e){s.set(e,a),a+=e.byteLength}),s}},{key:"ftyp",value:function(e){return e.find(function(e){return e.type===Dt&&e.codecType===At})?h.FTYPHEV1:h.FTYPAVC1}},{key:"initSegment",value:function(e){return y(h.ftyp(e),h.moov(e))}},{key:"pssh",value:function(e){e=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],vi(e.kid),[0,0,0,0]));return h.box(h.types.pssh,e)}},{key:"moov",value:function(e){var t;return e[0].useEME&&(e[0].encv||e[0].enca)?(e[0].pssh||(e[0].pssh={kid:e[0].kid}),t=this.pssh(e[0].pssh),h.box.apply(h,[h.types.moov,h.mvhd(e[0].mvhdDurtion||e[0].duration,e[0].mvhdTimecale||e[0].timescale),h.mvex(e)].concat(m(e.map(function(e){return h.trak(e)})),[t]))):h.box.apply(h,[h.types.moov,h.mvhd(e[0].mvhdDurtion||e[0].duration,e[0].mvhdTimecale||e[0].timescale)].concat(m(e.map(function(e){return h.trak(e)})),[h.mvex(e)]))}},{key:"mvhd",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:9e4;return h.box(h.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(e){return h.box(h.types.trak,h.tkhd(e.id,e.tkhdDuration||0,e.width,e.height),h.mdia(e))}},{key:"tkhd",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;return h.box(h.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,n>>8&255,255&n,0,0]))}},{key:"mdia",value:function(e){return h.box(h.types.mdia,h.mdhd(e.duration,e.timescale),h.hdlr(e.type),h.minf(e))}},{key:"mdhd",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:9e4;return h.box(h.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,85,196,0,0]))}},{key:"hdlr",value:function(e){return h.box(h.types.hdlr,h.HDLR_TYPES[e])}},{key:"minf",value:function(e){return h.box(h.types.minf,e.type===Dt?h.VMHD:h.SMHD,h.DINF,h.stbl(e))}},{key:"stbl",value:function(e){var t=[];return e&&e.ext&&e.ext.stss&&t.push(h.stss(e.ext.stss.entries)),h.box(h.types.stbl,h.stsd(e),h.STTS,t[0],h.STSC,h.STSZ,h.STCO)}},{key:"stsd",value:function(e){e="audio"===e.type?e.useEME&&e.enca?h.enca(e):e.codecType===Ot?h.opus(e):h.mp4a(e):e.useEME&&e.encv?h.encv(e):e.av1C?h.av01(e):h.avc1hev1(e);return h.box(h.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),e)}},{key:"enca",value:function(e){var t=e.enca.channelCount,i=e.enca.sampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>8&255,255&i,0,0]),i=h.esds(e.config),e=h.sinf(e.enca);return h.box(h.types.enca,t,i,e)}},{key:"encv",value:function(e){var t=0<e.sps.length?e.sps[0]:[],i=0<e.pps.length?e.pps[0]:[],n=e.width,r=e.height,s=e.sarRatio[0],a=e.sarRatio[1],n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,r>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t=new Uint8Array((r=(r=[1,t[1],t[2],t[3],255,225,t.length>>>8&255,255&t.length]).concat.apply(r,m(t)).concat([1,i.length>>>
18&255,255&i.length])).concat.apply(r,m(i))),r=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),i=h.sinf(e.encv),e=new Uint8Array([s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a]);return h.box(h.types.encv,n,h.box(h.types.avcC,t),h.box(h.types.btrt,r),i,h.box(h.types.pasp,e))}},{key:"schi",value:function(e){var t=new Uint8Array([]),e=h.tenc(e);return h.box(h.types.schi,t,e)}},{key:"tenc",value:function(e){e=new Uint8Array([0,0,0,0,0,0,255&e.default_IsEncrypted,255&e.default_IV_size].concat(vi(e.default_KID)));return h.box(h.types.tenc,e)}},{key:"sinf",value:function(e){var t=new Uint8Array([]),i=new Uint8Array([e.data_format.charCodeAt(0),e.data_format.charCodeAt(1),e.data_format.charCodeAt(2),e.data_format.charCodeAt(3)]),n=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),e=h.schi(e);return h.box(h.types.sinf,t,h.box(h.types.frma,i),h.box(h.types.schm,n),e)}},{key:"av01",value:function(e){return h.box(h.types.av01,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e.width>>8&255,255&e.width,e.height>>8&255,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),e.av1C,e.colr)}},{key:"avc1hev1",value:function(e){var t=e.codecType===At,i=t?h.types.hvc1:h.types.avc1,n=t?h.hvcC(e):h.avcC(e),n=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e.width>>8&255,255&e.width,e.height>>8&255,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n];return t?n.push(h.box(h.types.fiel,new Uint8Array([1,0]))):e.sarRatio&&1<e.sarRatio.length&&n.push(h.pasp(e.sarRatio)),h.box.apply(h,[i].concat(n))}},{key:"avcC",value:function(e){var t,i,n=[],r=[];return e.sps.forEach(function(e){i=e.byteLength,n.push(i>>>8&255),n.push(255&i),n.push.apply(n,m(e))}),e.pps.forEach(function(e){i=e.byteLength,r.push(i>>>8&255),r.push(255&i),r.push.apply(r,m(e))}),h.box(h.types.avcC,new Uint8Array((t=(t=[1,n[3],n[4],n[5],255,224|e.sps.length]).concat.apply(t,n).concat([e.pps.length])).concat.apply(t,r)))}},{key:"hvcC",value:function(e){var t,i,n,r,s,a,o=e.hvcC;return o instanceof ArrayBuffer||o instanceof Uint8Array?o:(t=e.vps,i=e.sps,e=e.pps,o?(a=o.generalProfileCompatibilityFlags,n=o.generalConstraintIndicatorFlags,r=(t.length&&1)+(i.length&&1)+(e.length&&1),s=[1,o.generalProfileSpace<<6|o.generalTierFlag<<5|o.generalProfileIdc,a>>>24,a>>>16,a>>>8,a,n[0],n[1],n[2],n[3],n[4],n[5],o.generalLevelIdc,240,0,252,252|o.chromaFormatIdc,248|o.bitDepthLumaMinus8,248|o.bitDepthChromaMinus8,0,0,o.numTemporalLayers<<3|o.temporalIdNested<<2|3,r],a=function(e){s.push(e.length>>8,e.length),s.push.apply(s,m(e))},t.length&&(s.push(160,0,t.length),t.forEach(a)),i.length&&(s.push(161,0,i.length),i.forEach(a)),e.length&&(s.push(162,0,e.length),e.forEach(a))):s=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64],h.box(h.types.hvcC,new Uint8Array(s)))}},{key:"pasp",value:function(e){var e=re(e,2),t=e[0],e=e[1];return h.box(h.types.pasp,new Uint8Array([t>>24,t>>16&255,t>>8&255,255&t,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"mp4a",value:function(e){return h.box(h.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,e.sampleRate>>8&255,255&e.sampleRate,0,0]),e.config.length?h.esds(e.config):void 0)}},{key:"esds",value:function(e){var t=e.length;return h.box(h.types.esds,new Uint8Array([0,0,0,0,3,23+t,0,0,0,4,15+t,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([t]).concat(e).concat([6,1,2])))}},{key:"opus",value:function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,e.sampleRate>>8&255,255&e.sampleRate,0,0]),e=e.config.length?h.dOps(e):[];return h.box(h.types.Opus,t,e)}},{key:"dOps",value:function(e){if(e.config)return e.config[4]=e.sampleRate>>>24&255,e.config[5]=e.sampleRate>>>16&255,e.config[6]=e.sampleRate>>>8&255,e.config[7]=255&e.sampleRate,h.box(h.types.dOps,e.config)}},{key:"mvex",value:function(e){return h.box.apply(h,[h.types.mvex].concat(m(e.map(function(e){return h.trex(e.id)}
1))))}},{key:"trex",value:function(e){return h.box(h.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(e){return h.box(h.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(e){return h.box(h.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(e){return h.box.apply(h,[h.types.moof,h.mfhd(e[0].samples?e[0].samples[0].gopId:0)].concat(m(e.map(function(e){return h.traf(e)}))))}},{key:"mfhd",value:function(e){return h.box(h.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"traf",value:function(e){var t,i,n,r,s,a=h.tfhd(e.id),o=h.tfdt(e,e.baseMediaDecodeTime),u=0;return e.isVideo&&e.videoSenc&&e.videoSenc.forEach(function(e){u+=8,e.subsamples&&e.subsamples.length&&(u=(u+=2)+6*e.subsamples.length)}),e.videoSencLength=u,e.useEME&&(e.isVideoEncryption||e.isAudioEncryption)?e.isVideoEncryption?e.isVideo?(i=h.saiz(e),n=h.saio(e),r=h.trun1(e),s=h.senc(e),h.box(h.types.traf,a,o,i,n,r,s)):e.isAudioEncryption?(i=h.sbgp(),n=h.saiz(e),r=h.saio(e),s=h.senc(e),t=h.trun1(e),h.box(h.types.traf,a,o,i,n,r,s,t)):(i=h.sbgp(),n=h.trun1(e),h.box(h.types.traf,a,o,i,n)):e.isVideo?(r=h.trun1(e),h.box(h.types.traf,a,o,r)):(s=h.sbgp(),t=h.saiz(e),i=h.saio(e),n=h.senc(e),r=h.trun1(e),h.box(h.types.traf,a,o,s,t,i,n,r)):(s=h.sdtp(e),h.box(h.types.traf,a,o,s,h.trun(e.samples,s.byteLength+76)))}},{key:"sdtp",value:function(t){var i=new c;return t.samples.forEach(function(e){i.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))}),h.box(h.types.sdtp,this.extension(0,0),i.buffer)}},{key:"trun1",value:function(t){var e,i=new c,n=c.writeUint32(t.samples.length),r=null;return t.isVideo?(e=t.videoSencLength,r=c.writeUint32(16*t.samples.length+e+149),!t.isVideoEncryption&&t.isAudioEncryption&&(r=c.writeUint32(16*t.samples.length+92))):(e=12*t.samples.length+124,t.isAudioEncryption&&(e=12*t.samples.length+8*t.audioSenc.length+177),r=c.writeUint32(e)),t.samples.forEach(function(e){i.write(c.writeUint32(e.duration)),i.write(c.writeUint32(e.size)),i.write(c.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&i.write(c.writeUint32(e.cts||0))}),h.box(h.types.trun,this.extension(0,t.flags),n,r,i.buffer)}},{key:"senc",value:function(e){var i=new c,t=e.samples.length,n=e.isVideo?2:0,r=[],s=0;return e.isVideo?(r=e.videoSenc,s=e.videoSencLength):r=e.audioSenc,i.write(c.writeUint32(16+(s=s||(e.isVideo?16:8)*t)),h.types.senc,this.extension(0,n)),i.write(c.writeUint32(t)),r.forEach(function(e){for(var t=0;t<e.InitializationVector.length;t++)i.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(i.write(c.writeUint16(e.subsamples.length)),e.subsamples.forEach(function(e){i.write(c.writeUint16(e.BytesOfClearData)),i.write(c.writeUint32(e.BytesOfProtectedData))}))}),i.buffer}},{key:"saio",value:function(e){var t=12*e.samples.length+141,e=(!e.isVideo&&e.isAudioEncryption&&(t=149),new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t]));return h.box(h.types.saio,e)}},{key:"saiz",value:function(e){e=e.samples.length,e=new Uint8Array([0,0,0,0,16,e>>24&255,e>>16&255,e>>8&255,255&e]);return h.box(h.types.saiz,e)}},{key:"sbgp",value:function(){var e=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return h.box(h.types.sbgp,this.extension(0,0),e)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(e){return h.box(h.types.tfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"tfdt",value:function(e,t){var i=Math.floor(t/(1+sn)),t=Math.floor(t%(1+sn));return e.useEME&&(e.isVideoEncryption||e.isAudioEncryption)?h.box(h.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])):h.box(h.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"trun",value:function(e,t){var i=e.length,n=12+16*i,r=(t+=8+n,new Uint8Array(n));r.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(var s=0;s<i;s++){var a=e[s],o=a.duration,u=a.size,l=a.flag,l=void 0===l?{}:l,a=a.cts,a=void 0===a?0:a;r.set([o>>>24&255,o>>>16&255,o>>>8&255,255&o,u>>
1>24&255,u>>>16&255,u>>>8&255,255&u,l.isLeading<<2|(null==l.dependsOn?1:l.dependsOn),l.isDependedOn<<6|l.hasRedundancy<<4|l.paddingValue<<1|(null==l.isNonSyncSample?1:l.isNonSyncSample),61440&l.degradationPriority,15&l.degradationPriority,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*s)}return h.box(h.types.trun,r)}},{key:"moovMP4",value:function(e){return h.box.apply(h,[h.types.moov,h.mvhd(e[0].duration,e[0].timescale)].concat(m(e.map(function(e){return h.trackMP4(e)}))))}},{key:"trackMP4",value:function(e){return h.box(h.types.trak,h.tkhd(e.id,e.duration,e.width,e.height),h.mdiaMP4(e))}},{key:"mdiaMP4",value:function(e){return h.box(h.types.mdia,h.mdhd(e.duration,e.timescale),h.hdlr(e.type),h.minfMP4(e))}},{key:"minfMP4",value:function(e){return h.box(h.types.minf,e.type===Dt?h.VMHD:h.SMHD,h.DINF,h.stblMP4(e))}},{key:"stblMP4",value:function(e){var t=e.ext,e=[h.stsd(e),h.stts(t.stts),h.stsc(t.stsc),h.stsz(t.stsz),h.stco(t.stco)];return t.stss.length&&e.push(h.stss(t.stss)),t.ctts.length&&e.push(h.ctts(t.ctts)),h.box.apply(h,[h.types.stbl].concat(e))}},{key:"stts",value:function(e){var t=e.length,i=new Uint8Array(8*t),n=0;return e.forEach(function(e){var t=e.value,e=e.count;i.set([e>>24,e>>16&255,e>>8&255,255&e,t>>24,t>>16&255,t>>8&255,255&t],n),n+=8}),h.box(h.types.stts,y(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]),i))}},{key:"stsc",value:function(e){var t=e.length,n=new Uint8Array(12*t),r=0;return e.forEach(function(e){var t=e.firstChunk,i=e.samplesPerChunk,e=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,e>>24,e>>16&255,e>>8&255,255&e],r),r+=12}),h.box(h.types.stsc,y(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]),n))}},{key:"stsz",value:function(e){var t=e.length,i=new Uint8Array(4*t),n=0;return e.forEach(function(e){i.set([e>>24,e>>16&255,e>>8&255,255&e],n),n+=4}),h.box(h.types.stsz,y(new Uint8Array([0,0,0,0,0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]),i))}},{key:"stco",value:function(e){var t=e.length,i=new Uint8Array(4*t),n=0;return e.forEach(function(e){i.set([e>>24,e>>16&255,e>>8&255,255&e],n),n+=4}),h.box(h.types.stco,y(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]),i))}},{key:"stss",value:function(e){var t=e.length,i=new Uint8Array(4*t),n=0;return e.forEach(function(e){i.set([e>>24,e>>16&255,e>>8&255,255&e],n),n+=4}),h.box(h.types.stss,y(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]),i))}},{key:"ctts",value:function(e){var t=e.length,i=new Uint8Array(8*t),n=0;return e.forEach(function(e){var t=e.value,e=e.count;i.set([e>>24,e>>16&255,e>>8&255,255&e,t>>24,t>>16&255,t>>8&255,255&t],n),n+=8}),h.box(h.types.ctts,y(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]),i))}},{key:"styp",value:function(){return h.box(h.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(e){var t,i=e.timescale,n=e.samples[0].duration,r=n*e.samples.length,n=e.samples[0].sampleOffset*n,s=8,a=(e.samples.forEach(function(e){s+=e.size}),0),o=(e.isVideo?(t=0,e.videoSenc&&(o=e.videoSenc),e.isVideo&&o.forEach(function(e){t+=8,e.subsamples&&e.subsamples.length&&(t=(t+=2)+6*e.subsamples.length)}),e.videoSencLength=t,a=s+141+16*e.samples.length+t,e.useEME&&e.isAudioEncryption&&!e.isVideoEncryption&&(a=s+16*e.samples.length+84)):(a=s+116+12*e.samples.length,e.useEME&&e.isAudioEncryption&&(a=s+169+12*e.samples.length+8*e.audioSenc.length)),new Uint8Array([0,0,0,0,0,0,0,255&e.id,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,1,0,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r,144,0,0,0]));return h.box(h.types.sidx,o)}},{key:"mdat",value:function(e){return h.box(h.types.mdat,e)}}]),h);function h(){l(this,h)}function an(){l(this,an),this.buffer=new Uint8Array(0)}s(x,"types",["Opus","dOps","av01","av1C","avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce(function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e},Object.create(null))),s(x,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),s(x,"FTYPAVC1",x.box(x.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),s(x,"FTYPHEV1",x.box(x.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),s(x,"DINF",x.box(x.types.dinf,x.box(x.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),s(x,"VMHD",x.box(x.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),s(x,"SMHD",x.box(x.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),s(x,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),s(x,"STTS",x.box(x.types.stts,x.StblTable)),s(x,"STSC",x.box(x.types.stsc,x.StblTable)),s(x,"STSZ",x.box(x.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),s(x,"STCO",x.box(x.types.stco,x.StblTable));e(un,[{key:"debug",value:function(){var e;if(!un.disabled){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];(e=console).debug.apply(e,[this._prefix].concat(i))}}},{key:"log",value:function(){var e;if(!un.disabled){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];
1(e=console).log.apply(e,[this._prefix].concat(i))}}},{key:"warn",value:function(){var e;if(!un.disabled){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];(e=console).warn.apply(e,[this._prefix].concat(i))}}},{key:"error",value:function(){var e;if(!un.disabled){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];(e=console).error.apply(e,[this._prefix].concat(i))}}},{key:"table",value:function(){var e;un.disabled||(console.group(this._prefix),(e=console).table.apply(e,arguments),console.groupEnd())}}],[{key:"enable",value:function(){un.disabled=!1}},{key:"disable",value:function(){un.disabled=!0}}]);var on=un;function un(e,t){l(this,un),this.name=e||"",this._prefix="[".concat(this.name,"]"),un.disabled=t}s(on,"disabled",!0);e(Tn,[{key:"remux",value:function(){var e,t,i,n,r,s=0<arguments.length&&void 0!==arguments[0]&&arguments[0],a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=this.videoTrack,u=this.audioTrack,l=o.exist(),c=u.exist(),h=[];return s&&(a&&a.initMerge?(l&&h.push(this.videoTrack),c&&h.push(this.audioTrack),i=x.initSegment(h)):(l&&(e=x.initSegment([this.videoTrack])),c&&(t=x.initSegment([this.audioTrack])))),l&&o.hasSample()&&(n=this._remuxVideo()),c&&u.hasSample()&&(r=this._remuxAudio()),o.samples=[],u.samples=[],{initSegment:i,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:r}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack,n=(this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0}
1),e.samples),t=/av01/.test(e.codec),i=0,r=(t?n.forEach(function(e){i+=e.data.byteLength}):n.forEach(function(e){i=(i+=e.units.reduce(function(e,t){return e+t.byteLength},0))+4*e.units.length}),new Uint8Array(i));if(t)for(var s,a=0,o=n.length,u=0;a<o;a++)s=n[a],r.set(s.data,u),s.size=s.data.byteLength,u+=s.size;else for(var l,c=new DataView(r.buffer),h=0,d=n.length,f=0;h<d;h++)((t,e)=>{e=n[h];var i=0;e.units.forEach(function(e){c.setUint32(t,e.byteLength),t+=4,r.set(e,t),t+=e.byteLength,i+=4+e.byteLength}),e.size=i,f=t,l=e})(f,l);t=x.mdat(r);return y(x.moof([e]),t)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,i=new Uint8Array(e.samples.reduce(function(e,t){return e+t.size},0)),t=(e.samples.reduce(function(e,t){return i.set(t.data,e),e+t.size},0),x.mdat(i));return y(x.moof([e]),t)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]);for(var ln,cn,hn,dn,fn=Tn,w=(e(wn,[{key:"mixIn",value:function(e){return Object.assign(this,e)}},{key:"clone",value:function(){var e=new this.constructor;return Object.assign(e,this),e}}],[{key:"create",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return ee(this,t)}}]),wn),pn=(t(xn,w),dn=i(xn),e(xn,[{key:"toString",value:function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:gn).stringify(this)}},{key:"concat",value:function(e){var t=this.words,i=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<r;s+=1){var a=i[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=a<<24-(n+s)%4*8}else for(var o=0;o<r;o+=4)t[n+o>>>2]=i[o>>>2];return this.sigBytes+=r,this}},{key:"clamp",value:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)}},{key:"clone",value:function(){var e=ne(Z(xn.prototype),"clone",this).call(this);return e.words=this.words.slice(0),e}}],[{key:"random",value:function(e){for(var t=[],i=0;i<e;i+=4){var n=(e=>{var t=e,i=987654321,n=4294967295;return function(){return((((i=36969*(65535&i)+(i>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(.5<Math.random()?1:-1)}})(4294967296*(r||Math.random())),r=987654071*n();t.push(4294967296*n()|0)}return new xn(t,e)}}]),xn),gn={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r+=1){var s=t[r>>>2]>>>24-r%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n+=2)i[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new pn(i,t/2)}},mn=function(e){for(var t=unescape(encodeURIComponent(e)),i=t.length,n=[],r=0;r<i;r+=1)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new pn(n,i)},n=(t(Sn,w),hn=i(Sn),e(Sn,[{key:"reset",value:function(){this._data=new pn,this._nDataBytes=0}},{key:"_append",value:function(e){"string"==typeof e&&(e=mn(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}},{key:"_process",value:function(e){var t,i=this._data,n=this.blockSize,r=i.words,s=i.sigBytes,a=s/(4*n),o=(e?Math.ceil(a):Math.max((0|a)-this._minBufferSize,0))*n,e=Math.min(4*o,s);if(o){for(var u=0;u<o;u+=n)this._doProcessBlock(r,u);t=r.splice(0,o),i.sigBytes-=e}return new pn(t,e)}},{key:"clone",value:function(){var e=ne(Z(Sn.prototype),"clone",this).call(this);return e._data=this._data.clone(),e}}]),Sn),a=(t(bn,n),cn=i(bn),e(bn,[{key:"reset",value:function(){ne(Z(bn.prototype),"reset",this).call(this),this._doReset()}},{key:"update",value:function(e){return this._append(e),this._process(),this}},{key:"finalize",value:function(e){return e&&this._append(e),this._doFinalize()}}],[{key:"_createHelper",value:function(i){return function(e,t){return new i(t).finalize(e)}}},{key:"_createHmacHelper",value:function(i){return function(e,t){return new yn(i,t).finalize(e)}}}]),bn),yn=(t(kn,w),ln=i(kn),e(kn,[{key:"reset",value:function(){var e=this._hasher;e.reset(),e.update(this._iKey)}},{key:"update",value:function(e){return this._hasher.update(e),this}},{key:"finalize",value:function(e){var t=this._hasher,e=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(e))}}]),kn),vn={stringify:function(e){var t=e.words,i=e.sigBytes,n=this._map;e.clamp();for(var r=[],s=0;s<i;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<i;o+=1)r.push(n.charAt(a>>>6*(3-o)&63));var u=n.charAt(64);if(u)for(;r.length%4;)r.push(u);return r.join("")},parse:function(e){var t=e.length,i=this._map;if(!(n=this._reverseMap)){this._reverseMap=[];for(var n=this._reverseMap,r=0;r<i.length;
1r+=1)n[i.charCodeAt(r)]=r}for(var s,a=i.charAt(64),o=(a&&-1!==(a=e.indexOf(a))&&(t=a),e),u=t,l=n,c=[],h=0,d=0;d<u;d+=1)d%4&&(s=l[o.charCodeAt(d-1)]<<d%4*2|l[o.charCodeAt(d)]>>>6-d%4*2,c[h>>>2]|=s<<24-h%4*8,h+=1);return pn.create(c,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},C=[],_n=0;_n<64;_n+=1)C[_n]=4294967296*Math.abs(Math.sin(_n+1))|0;function kn(e,t){l(this,kn),i=ln.call(this);var i,e=new e,n=(i._hasher=e,t),r=("string"==typeof n&&(n=mn(n)),e.blockSize),s=4*r,e=((n=n.sigBytes>s?e.finalize(t):n).clamp(),n.clone()),t=(i._oKey=e,n.clone());i._iKey=t;for(var a=e.words,o=t.words,u=0;u<r;u+=1)a[u]^=1549556828,o[u]^=909522486;return e.sigBytes=s,t.sigBytes=s,i.reset(),i}function bn(e){var t;return l(this,bn),(t=cn.call(this)).blockSize=16,t.cfg=Object.assign(new w,e),t.reset(),t}function Sn(){var e;return l(this,Sn),(e=hn.call(this))._minBufferSize=0,e}function xn(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:4*t.length,n=(l(this,xn),e=dn.call(this),t);if((n=(n=n instanceof ArrayBuffer?new Uint8Array(n):n)instanceof Int8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n)instanceof Uint8Array){for(var r=n.byteLength,s=[],a=0;a<r;a+=1)s[a>>>2]|=n[a]<<24-a%4*8;e.words=s,e.sigBytes=r}else e.words=t,e.sigBytes=i;return e}function wn(){l(this,wn)}function Tn(e,t,i){l(this,Tn),this.videoTrack=e,this.audioTrack=t;e=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=e&&Number(e[1])<50,this.log=new on("FMP4Remuxer",!i||!i.openLog||!i.openLog)}function P(e,t,i,n,r,s,a){return((e=e+(t&i|~t&n)+r+a)<<s|e>>>32-s)+t}function I(e,t,i,n,r,s,a){return((e=e+(t&n|i&~n)+r+a)<<s|e>>>32-s)+t}function O(e,t,i,n,r,s,a){return((e=e+(t^i^n)+r+a)<<s|e>>>32-s)+t}function R(e,t,i,n,r,s,a){return((e=e+(i^(t|~n))+r+a)<<s|e>>>32-s)+t}t(Dn,a),En=i(Dn),e(Dn,[{key:"_doReset",value:function(){this._hash=new pn([1732584193,4023233417,2562383102,271733878])}},{key:"_doProcessBlock",value:function(e,t){for(var i=e,n=0;n<16;n+=1){var r=t+n,s=e[r];i[r]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var a=this._hash.words,o=i[t+0],u=i[t+1],l=i[t+2],c=i[t+3],h=i[t+4],d=i[t+5],f=i[t+6],p=i[t+7],g=i[t+8],m=i[t+9],y=i[t+10],v=i[t+11],_=i[t+12],k=i[t+13],b=i[t+14],S=i[t+15],x=a[0],x=P(x,E=a[1],T=a[2],w=a[3],o,7,C[0]),w=P(w,x,E,T,u,12,C[1]),T=P(T,w,x,E,l,17,C[2]),E=P(E,T,w,x,c,22,C[3]);x=P(x,E,T,w,h,7,C[4]),w=P(w,x,E,T,d,12,C[5]),T=P(T,w,x,E,f,17,C[6]),E=P(E,T,w,x,p,22,C[7]),x=P(x,E,T,w,g,7,C[8]),w=P(w,x,E,T,m,12,C[9]),T=P(T,w,x,E,y,17,C[10]),E=P(E,T,w,x,v,22,C[11]),x=P(x,E,T,w,_,7,C[12]),w=P(w,x,E,T,k,12,C[13]),T=P(T,w,x,E,b,17,C[14]),E=P(E,T,w,x,S,22,C[15]),x=I(x,E,T,w,u,5,C[16]),w=I(w,x,E,T,f,9,C[17]),T=I(T,w,x,E,v,14,C[18]),E=I(E,T,w,x,o,20,C[19]),x=I(x,E,T,w,d,5,C[20]),w=I(w,x,E,T,y,9,C[21]),T=I(T,w,x,E,S,14,C[22]),E=I(E,T,w,x,h,20,C[23]),x=I(x,E,T,w,m,5,C[24]),w=I(w,x,E,T,b,9,C[25]),T=I(T,w,x,E,c,14,C[26]),E=I(E,T,w,x,g,20,C[27]),x=I(x,E,T,w,k,5,C[28]),w=I(w,x,E,T,l,9,C[29]),T=I(T,w,x,E,p,14,C[30]),E=I(E,T,w,x,_,20,C[31]),x=O(x,E,T,w,d,4,C[32]),w=O(w,x,E,T,g,11,C[33]),T=O(T,w,x,E,v,16,C[34]),E=O(E,T,w,x,b,23,C[35]),x=O(x,E,T,w,u,4,C[36]),w=O(w,x,E,T,h,11,C[37]),T=O(T,w,x,E,p,16,C[38]),E=O(E,T,w,x,y,23,C[39]),x=O(x,E,T,w,k,4,C[40]),w=O(w,x,E,T,o,11,C[41]),T=O(T,w,x,E,c,16,C[42]),E=O(E,T,w,x,f,23,C[43]),x=O(x,E,T,w,m,4,C[44]),w=O(w,x,E,T,_,11,C[45]),T=O(T,w,x,E,S,16,C[46]),E=O(E,T,w,x,l,23,C[47]),x=R(x,E,T,w,o,6,C[48]),w=R(w,x,E,T,p,10,C[49]),T=R(T,w,x,E,b,15,C[50]),E=R(E,T,w,x,d,21,C[51]),x=R(x,E,T,w,_,6,C[52]),w=R(w,x,E,T,c,10,C[53]),T=R(T,w,x,E,y,15,C[54]),E=R(E,T,w,x,u,21,C[55]),x=R(x,E,T,w,g,6,C[56]),w=R(w,x,E,T,S,10,C[57]),T=R(T,w,x,E,f,15,C[58]),E=R(E,T,w,x,k,21,C[59]),x=R(x,E,T,w,h,6,C[60]),w=R(w,x,E,T,v,10,C[61]),T=R(T,w,x,E,l,15,C[62]),E=R(E,T,w,x,m,21,C[63]),a[0]=a[0]+x|0,a[1]=a[1]+E|0,a[2]=a[2]+T|0,a[3]=a[3]+w|0}},{key:"_doFinalize",value:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,n=8*e.sigBytes,r=(t[n>>>5]|=128<<24-n%32,Math.floor(i/4294967296));t[15+(64+n>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t[14+(64+n>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,s=r.words,a=0;a<4;a+=1){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return r}},{key:"clone",value:function(){var e=ne(Z(Dn.prototype),"clone",this).call(this);return e._hash=this._hash.clone(),e}}]);var En,Cn=Dn;function Dn(){return l(this,Dn),En.apply(this,arguments)}a._createHelper(Cn),a._createHmacHelper(Cn);
1t(On,w),Ln=i(On),e(On,[{key:"compute",value:function(e,t){for(var i,n=this.cfg,r=n.hasher.create(),s=pn.create(),a=s.words,o=n.keySize,u=n.iterations;a.length<o;){i&&r.update(i),i=r.update(e).finalize(t),r.reset();for(var l=1;l<u;l+=1)i=r.finalize(i),r.reset();s.concat(i)}return s.sigBytes=4*o,s}}]);var An,Ln,Pn=On,a=(t(In,n),An=i(In),e(In,[{key:"reset",value:function(){ne(Z(In.prototype),"reset",this).call(this),this._doReset()}},{key:"process",value:function(e){return this._append(e),this._process()}},{key:"finalize",value:function(e){return e&&this._append(e),this._doFinalize()}}],[{key:"createEncryptor",value:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)}},{key:"createDecryptor",value:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)}},{key:"_createHelper",value:function(n){function r(e){return"string"==typeof e?tr:Qn}return{encrypt:function(e,t,i){return r(t).encrypt(n,e,t,i)},decrypt:function(e,t,i){return r(t).decrypt(n,e,t,i)}}}}]),In);function In(e,t,i){var n;return l(this,In),(n=An.call(this)).cfg=Object.assign(new w,i),n._xformMode=e,n._key=t,n.reset(),n}function On(e){var t;return l(this,On),(t=Ln.call(this)).cfg=Object.assign(new w,{keySize:4,hasher:Cn,iterations:1},e),t}a._ENC_XFORM_MODE=1,a._DEC_XFORM_MODE=2,a.keySize=4,a.ivSize=4;t(jn,w),Rn=i(jn),e(jn,null,[{key:"createEncryptor",value:function(e,t){return this.Encryptor.create(e,t)}},{key:"createDecryptor",value:function(e,t){return this.Decryptor.create(e,t)}}]);var Rn,n=jn;function jn(e,t){var i;return l(this,jn),(i=Rn.call(this))._cipher=e,i._iv=t,i}function Mn(e,t,i){var n,r=e,e=this._iv;e?(n=e,this._iv=void 0):n=this._prevBlock;for(var s=0;s<i;s+=1)r[t+s]^=n[s]}t(Hn,n),Nn=i(Hn);var Nn,Bn,Fn,Un=e(Hn);function Hn(){return l(this,Hn),Nn.apply(this,arguments)}function Vn(){return l(this,Vn),Bn.apply(this,arguments)}function Gn(){return l(this,Gn),Fn.apply(this,arguments)}Un.Encryptor=(t(Gn,Un),Fn=i(Gn),e(Gn,[{key:"processBlock",value:function(e,t){var i=this._cipher,n=i.blockSize;Mn.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}]),Gn),Un.Decryptor=(t(Vn,Un),Bn=i(Vn),e(Vn,[{key:"processBlock",value:function(e,t){var i=this._cipher,n=i.blockSize,r=e.slice(t,t+n);i.decryptBlock(e,t),Mn.call(this,e,t,n),this._prevBlock=r}}]),Vn);var zn,qn,Wn,Kn={pad:function(e,t){for(var t=4*t,i=t-e.sigBytes%t,n=i<<24|i<<16|i<<8|i,r=[],s=0;s<i;s+=4)r.push(n);t=pn.create(r,i);e.concat(t)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},a=(t($n,a),Wn=i($n),e($n,[{key:"reset",value:function(){ne(Z($n.prototype),"reset",this).call(this);var e,t=this.cfg,i=t.iv,t=t.mode;this._xformMode===this.constructor._ENC_XFORM_MODE?e=t.createEncryptor:(e=t.createDecryptor,this._minBufferSize=1),this._mode=e.call(t,this,i&&i.words),this._mode.__creator=e}},{key:"_doProcessBlock",value:function(e,t){this._mode.processBlock(e,t)}},{key:"_doFinalize",value:function(){var e,t=this.cfg.padding;return this._xformMode===this.constructor._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e}}]),$n),Yn=(t(Jn,w),qn=i(Jn),e(Jn,[{key:"toString",value:function(e){return(e||this.formatter).stringify(this)}}]),Jn),Xn={stringify:function(e){var t=e.ciphertext,e=e.salt;return(e?pn.create([1398893684,1701076831]).concat(e).concat(t):t).toString(vn)},parse:function(e){var t,e=vn.parse(e),i=e.words;return 1398893684===i[0]&&1701076831===i[1]&&(t=pn.create(i.slice(2,4)),i.splice(0,4),e.sigBytes-=16),Yn.create({ciphertext:e,salt:t})}},Qn=(t(Zn,w),zn=i(Zn),e(Zn,null,[{key:"encrypt",value:function(e,t,i,n){var n=Object.assign(new w,this.cfg,n),r=e.createEncryptor(i,n),t=r.finalize(t),s=r.cfg;return Yn.create({ciphertext:t,key:i,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:r.blockSize,formatter:n.format})}},{key:"decrypt",value:function(e,t,i,n){n=Object.assign(new w,this.cfg,n),t=this._parse(t,n.format);return e.createDecryptor(i,n).finalize(t.ciphertext)}},{key:"_parse",value:function(e,t){return"string"==typeof e?t.parse(e,this):e}}]),Zn);function Zn(){return l(this,Zn),zn.apply(this,arguments)}function Jn(e){var t;
1return l(this,Jn),(t=qn.call(this)).mixIn(e),t}function $n(e,t,i){return l(this,$n),(e=Wn.call(this,e,t,Object.assign({mode:Un,padding:Kn},i))).blockSize=4,e}Qn.cfg=Object.assign(new w,{format:Xn});var er,Xn={execute:function(e,t,i,n){n=(n=n)||pn.random(8),e=Pn.create({keySize:t+i}).compute(e,n),i=pn.create(e.words.slice(t),4*i);return e.sigBytes=4*t,Yn.create({key:e,iv:i,salt:n})}},tr=(t(ir,Qn),er=i(ir),e(ir,null,[{key:"encrypt",value:function(e,t,i,n){n=Object.assign(new w,this.cfg,n),i=n.kdf.execute(i,e.keySize,e.ivSize),n.iv=i.iv,e=Qn.encrypt.call(this,e,t,i.key,n);return e.mixIn(i),e}},{key:"decrypt",value:function(e,t,i,n){n=Object.assign(new w,this.cfg,n),t=this._parse(t,n.format),i=n.kdf.execute(i,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,Qn.decrypt.call(this,e,t,i.key,n)}}]),ir);function ir(){return l(this,ir),er.apply(this,arguments)}tr.cfg=Object.assign(Qn.cfg,{kdf:Xn});for(var T=[],nr=[],rr=[],sr=[],ar=[],or=[],ur=[],lr=[],cr=[],hr=[],dr=[],fr=0;fr<256;fr+=1)dr[fr]=fr<128?fr<<1:fr<<1^283;for(var pr=0,gr=0,mr=0;mr<256;mr+=1){var yr=gr^gr<<1^gr<<2^gr<<3^gr<<4,vr=(T[pr]=yr=yr>>>8^255&yr^99,dr[nr[yr]=pr]),_r=dr[vr],kr=dr[_r],br=257*dr[yr]^16843008*yr;rr[pr]=br<<24|br>>>8,sr[pr]=br<<16|br>>>16,ar[pr]=br<<8|br>>>
124,or[pr]=br,ur[yr]=(br=16843009*kr^65537*_r^257*vr^16843008*pr)<<24|br>>>8,lr[yr]=br<<16|br>>>16,cr[yr]=br<<8|br>>>24,hr[yr]=br,pr?(pr=vr^dr[dr[dr[kr^vr]]],gr^=dr[dr[gr]]):pr=gr=1}var Sr,xr=[0,1,2,4,8,16,32,64,128,27,54],Xn=(t(wr,a),Sr=i(wr),e(wr,[{key:"_doReset",value:function(){if(!this._nRounds||this._keyPriorReset!==this._key){this._keyPriorReset=this._key;var e=this._keyPriorReset,t=e.words,i=e.sigBytes/4,n=(this._nRounds=6+i,4*(this._nRounds+1));this._keySchedule=[];for(var r=this._keySchedule,s=0;s<n;s+=1)s<i?r[s]=t[s]:(l=r[s-1],s%i?6<i&&s%i==4&&(l=T[l>>>24]<<24|T[l>>>16&255]<<16|T[l>>>8&255]<<8|T[255&l]):(l=T[(l=l<<8|l>>>24)>>>24]<<24|T[l>>>16&255]<<16|T[l>>>8&255]<<8|T[255&l],l^=xr[s/i|0]<<24),r[s]=r[s-i]^l);this._invKeySchedule=[];for(var a=this._invKeySchedule,o=0;o<n;o+=1){var u=n-o,l=o%4?r[u]:r[u-4];a[o]=o<4||u<=4?l:ur[T[l>>>24]]^lr[T[l>>>16&255]]^cr[T[l>>>8&255]]^hr[T[255&l]]}}}},{key:"encryptBlock",value:function(e,t){this._doCryptBlock(e,t,this._keySchedule,rr,sr,ar,or,T)}},{key:"decryptBlock",value:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,ur,lr,cr,hr,nr),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i}},{key:"_doCryptBlock",value:function(e,t,i,n,r,s,a,o){for(var u=this._nRounds,l=e[t]^i[0],c=e[t+1]^i[1],h=e[t+2]^i[2],d=e[t+3]^i[3],f=4,p=1;p<u;p+=1){var g=n[l>>>24]^r[c>>>16&255]^s[h>>>8&255]^a[255&d]^i[f],m=n[c>>>24]^r[h>>>16&255]^s[d>>>8&255]^a[255&l]^i[f+=1],y=n[h>>>24]^r[d>>>16&255]^s[l>>>8&255]^a[255&c]^i[f+=1],v=n[d>>>24]^r[l>>>16&255]^s[c>>>8&255]^a[255&h]^i[f+=1];f+=1,l=g,c=m,h=y,d=v}var _=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[h>>>8&255]<<8|o[255&d])^i[f],k=(o[c>>>24]<<24|o[h>>>16&255]<<16|o[d>>>8&255]<<8|o[255&l])^i[f+=1],b=(o[h>>>24]<<24|o[d>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^i[f+=1],o=(o[d>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&h])^i[f+=1];f+=1,e[t]=_,e[t+1]=k,e[t+2]=b,e[t+3]=o}}]),wr);function wr(){return l(this,wr),Sr.apply(this,arguments)}Xn.keySize=8,a._createHelper(Xn);t(Cr,n),Tr=i(Cr);var Tr,Er,a=e(Cr);function Cr(){return l(this,Cr),Tr.apply(this,arguments)}function Dr(){return l(this,Dr),Er.apply(this,arguments)}a.Encryptor=(t(Dr,a),Er=i(Dr),e(Dr,[{key:"processBlock",value:function(e,t){var i=e,e=this._cipher,n=e.blockSize,r=this._iv,s=this._counter,a=(r&&(this._counter=r.slice(0),s=this._counter,this._iv=void 0),s.slice(0));e.encryptBlock(a,0),s[n-1]=s[n-1]+1|0;for(var o=0;o<n;o+=1)i[t+o]^=a[o]}}]),Dr),a.Decryptor=a.Encryptor;e(Qr,[{key:"destroy",value:function(){var e;null!=(e=this.externalDecryptor)&&e.destroy&&this.externalDecryptor.destroy()}},{key:"decrypt",value:function(e,t){var i;if(e||t)return i=[],e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}},{key:"_decryptSegment",value:(Ur=A(D().mark(function e(t){var i;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.data,t.key)return e.next=4,this._decryptData(t.data,t.key,t.keyIv);e.next=5;break;case 4:i=e.sent;case 5:if(t.map){e.next=7;break}return e.abrupt("return",i);case 7:return e.abrupt("return",yt(t.map,i));case 8:case"end":return e.stop()}},e,this)})),function(e){return Ur.apply(this,arguments)})},{key:"_decryptData",value:(Fr=A(D().mark(function e(t,i,n){var r;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.externalDecryptor)return e.next=3,this.externalDecryptor.decrypt(t,i,n);e.next=6;break;case 3:return e.abrupt("return",e.sent);case 6:if(this.subtle){e.next=8;break}throw new Error("crypto is not defined");case 8:return e.next=10,this.subtle.importKey("raw",i,{name:"AES-CBC"},!1,["encrypt","decrypt"]);case 10:return r=e.sent,e.t0=Uint8Array,e.next=14,this.subtle.decrypt({name:"AES-CBC",iv:n},r,t);case 14:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 16:case"end":return e.stop()}},e,this)})),function(e,t,i){return Fr.apply(this,arguments)})}]);var Ar,Lr,Pr,Ir,Or,Rr,jr,Mr,Nr,Br,Fr,Ur,Hr=Qr,E=p(p({},L),{},{STREAM_PARSED:"core.streamparsed",NO_AUDIO_TRACK:"core.noaudiotrack",SUBTITLE_SEGMENTS:"core.subtitlesegments",SUBTITLE_PLAYLIST:"core.subtitleplaylist",SEI_PAYLOAD_TIME:"core.seipayloadtime",APPEND_COST:"core.appendcost"}),Vr=new Ce("Transmuxer"),Gr=(e(Xr,[{key:"transmux",value:function(e,t,i,n,r,s){var a=this._demuxer;try{this._isMP4?a.demux(e,t):a.demuxAndFix(yt(e,t),i,n,r)}catch(e){throw new _("demux",me,e)}var e=a.videoTrack,t=a.audioTrack,n=a.metadataTrack,r={codec:e.codec,timescale:e.timescale,firstDts:e.firstDts/e.timescale,firstPts:e.firstPts/e.timescale,duration:e.samplesDuration/e.timescale},a={codec:t.codec,timescale:t.timescale,firstDts:t.firstDts/e.timescale,firstPts:t.firstPts/e.timescale,duration:t.samplesDuration/e.timescale,container:t.container},o="".concat(e.codec,"/").concat(e.width,"/").concat(e.height,"/").concat(t.codec,"/").concat(t.config);if(o!==this._initSegmentId&&(this._initSegmentId=o,s=!0),this._fireEvents(e,t,n,i||s),this.hls.emit(E.DEMUXED_TRACK,{videoTrack:e,audioTrack:t}),!this._remuxer)return[e,t];s&&this.hls.isLive&&!this.hls.config.mseLowLatency&&(e.duration=this.hls.totalDuration*e.timescale,t.duration=this.hls.totalDuration*t.timescale);try{var u=this._remuxer.remux(s),l=u.videoInitSegment,c=u.audioInitSegment,h=u.audioSegment,d=yt(l,u.videoSegment),f=yt(c,h);return[d?p(p({},r),{},{data:d}):void 0,f?p(p({},a),{},{data:f}):void 0]}catch(e){throw new _("remux",ye,e)}
1}},{key:"_fireEvents",value:function(e,t,i,n){var r=this,s=[e,t],a="discontinuity: ".concat(n);s.forEach(function(e){var t;null!=(t=e.samples)&&t.length&&(a+="; ".concat(e.samples.length," ").concat(e.type===Dt?"video":"audio"," samples, firstDts/firstPts/duration: ").concat((e.firstDts/e.timescale).toFixed(3),"/").concat((e.firstPts/e.timescale).toFixed(3),"/").concat((e.samplesDuration/e.timescale).toFixed(3))),n&&e.exist()&&r.hls.emit(E.METADATA_PARSED,{type:e.type,track:e,meta:p({codec:e.codec,timescale:e.timescale,baseDts:e.baseDts},e.type===Dt?{width:e.width,height:e.height,sarRatio:e.sarRatio}:{codec:e.codec,channelCount:e.channelCount,sampleRate:e.sampleRate})})}),Vr.debug(a),e.warnings.forEach(function(e){var t;switch(e.type){case jt:t=E.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case Mt:t=E.LARGE_VIDEO_DTS_GAP_DETECT;break;case Nt:t=E.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&r.hls.emit(E.STREAM_EXCEPTION,p(p({},e),{},{type:t})),Vr.warn("video exception",e)}),t.warnings.forEach(function(e){var t;switch(e.type){case Bt:t=E.LARGE_AUDIO_DTS_GAP_DETECT;break;case Ft:t=E.AUDIO_GAP_DETECT;break;case Ut:t=E.AUDIO_OVERLAP_DETECT}t&&r.hls.emit(E.STREAM_EXCEPTION,p(p({},e),{},{type:t})),Vr.warn("audio exception",e)}),e.samples.forEach(function(e){e.keyframe&&r.hls.emit(E.KEYFRAME,{pts:e.pts})}),i.seiSamples.forEach(function(e){r.hls.emit(E.SEI,p(p({},e),{},{originPts:e.originPts/90,sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))})}}]),Xr),zr=["data"],qr=["data"],Wr=new Ce("BufferService"),Kr=(e(Yr,[{key:"baseDts",get:function(){var e;return null==(e=this._transmuxer)||null==(e=e._demuxer)||null==(e=e._fixer)?void 0:e._baseDts}},{key:"nbSb",get:function(){var e;return null!=(e=this._mse)&&e._sourceBuffer?Object.keys(this._mse._sourceBuffer).length:0}},{key:"msIsOpened",get:function(){var e;return null==(e=this._mse)?void 0:e.isOpened}},{key:"msHasOpTasks",get:function(){var e;return null==(e=this._mse)?void 0:e.hasOpTasks}},{key:"msStreaming",get:function(){var e;return null==(e=this._mse)?void 0:e.streaming}},{key:"updateDuration",value:(Br=A(D().mark(function e(t){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wr.debug("update duration",t),!this._mse){e.next=9;break}if(this._mse.isOpened){e.next=5;break}return e.next=5,this._mse.open();case 5:return e.next=7,this._mse.updateDuration(t);case 7:e.next=10;break;case 9:this._softVideo&&(this._softVideo.duration=t);case 10:case"end":return e.stop()}},e,this)})),function(e){return Br.apply(this,arguments)})},{key:"createSource",value:function(e,t,i,n){if(!this._sourceCreated){var r,s=e||t;if(s){if(qi.probe(s))this._transmuxer||(this._transmuxer=new Gr(this.hls,!1,!this._softVideo,this.hls.config.fixerConfig));else{if(!b.probe(s))throw new _(ge,null,null,null,"unsupported stream");this._softVideo?this._transmuxer||(this._transmuxer=new Gr(this.hls,!0,null,this.hls.config.fixerConfig)):(r=!(this._directAppend=!0),e&&!i&&b.findBox(e,["moov","trak"]).forEach(function(e){var e=b.findBox(e.data,["trak","mdia","minf","stbl","stsd"])[0];e&&(e=b.stsd(e).entries[0])&&(e.hvcC?i=e.hvcC.codec||"hev1.1.6.L93.B0":e.avcC?i=e.avcC.codec:(e.sampleRate||e.esds)&&(n=(null==(e=e.esds)?void 0:e.codec)||"mp4a.40.2",r=!0))}),t&&!n&&b.findBox(t,["moov","trak","mdia","minf","stbl","stsd"]).forEac
1h(function(e){e=b.stsd(e).entries[0];e&&e.esds&&(n=e.esds.codec)}),e&&!i&&(i="avc1.42e01e"),t&&!n&&(n="mp4a.40.2"),r&&(i+=", ".concat(n),n=""),this._createMseSource(i,n))}this._softVideo&&(this._sourceCreated=!0)}}}},{key:"appendBuffer",value:(Nr=A(D().mark(function e(t,i,n,r,s,a,o){var u,l,c,h,d,f,p,g,m,y=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n&&n.length||null!=r&&r.length){e.next=2;break}return e.abrupt("return");case 2:if(u=function(){var e;null!=(e=y.hls)&&e.emit&&null!=(e=y.hls)&&e.emit(L.APPEND_BUFFER,{start:t.start,end:t.end})},this._directAppend)return c=[],n&&c.push(this._mse.append(v.VIDEO,n)),r&&c.push(this._mse.append(v.AUDIO,r)),e.abrupt("return",Promise.all(c).then(u));e.next=8;break;case 8:(l=this._needInitSegment||s,c=this._transmuxer.transmux(n,r,l,a,o,this._needInitSegment||s),d=re(c,2),h=d[0],d=d[1],r&&i&&(null!=i&&i.setTrackExist(!1,!0)),r&&t&&(null!=t&&t.setTrackExist(!0,!1)),i||null==t||t.setTrackExist(!!h,!!d),h&&!d&&this.hls.emit(E.NO_AUDIO_TRACK),this._softVideo)?(this._softVideo.appendBuffer(h,d),this._needInitSegment=!1,u(),e.next=32):e.next=20;break;case 20:if(this._mse)return(p=!this._sourceCreated)&&this._createMseSource(null==h?void 0:h.codec,null==d?void 0:d.codec,null==d?void 0:d.container),this._needInitSegment=!1,m=this._mse,f=[],l&&!p&&this._handleCodecChange(h,d).forEach(function(e){return f.push(e)}),h&&(p=h.data,g=ie(h,zr),f.push(m.append(v.VIDEO,p,g))),d&&(p=d.data,g=ie(d,qr),f.push(m.append(v.AUDIO,p,g))),(m=Promise.all(f)).then(u),e.abrupt("return",m);e.next=32;break;case 32:case"end":return e.stop()}},e,this)})),function(e,t,i,n,r,s,a){return Nr.apply(this,arguments)})},{key:"removeBuffer",value:(Mr=A(D().mark(function e(){var t,i,n,r=this,s=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=0<s.length&&void 0!==s[0]?s[0]:0,i=1<s.length&&void 0!==s[1]?s[1]:1/0,n=this.hls.media,!this._mse||!n||t<0||i<t||t>=this._mse.duration)return e.abrupt("return");e.next=5;break;case 5:return e.abrupt("return",this._mse.clearBuffer(t,i).then(function(){return r.hls.emit(L.REMOVE_BUFFER,{start:t,end:i,removeEnd:i})}));case 6:case"end":return e.stop()}},e,this)})),function(){return Mr.apply(this,arguments)})},{key:"evictBuffer",value:(jr=A(D().mark(function e(t){var i,n;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.hls.media,!(this._mse&&i&&t)||t<0)return e.abrupt("return");e.next=3;break;case 3:if(n=i.currentTime,(n=n-t)<=0)return e.abrupt("return");e.next=7;break;case 7:if(u.start(u.get(i))+1>=n)return e.abrupt("return");e.next=10;break;case 10:return e.abrupt("return",this.removeBuffer(0,n));case 11:case"end":return e.stop()}},e,this)})),function(e){return jr.apply(this,arguments)})},{key:"clearAllBuffer",value:(Rr=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._mse)return e.abrupt("return",this._mse.clearAllBuffer());e.next=2;break;case 2:case"end":return e.stop()}},e,this)})),function(){return Rr.apply(this,arguments)})},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:(Or=A(D().mark(function e(){var t,i=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=0<i.length&&void 0!==i[0]&&i[0],this._mse&&!t)return this._transmuxer=null,this._sourceCreated=!1,e.next=6,this._mse.unbindMedia();e.next=8;break;case 6:return e.next=8,this._mse.bindMedia(this.hls.media);case 8:this._needInitSegment=!0,this._directAppend=!1;case 10:case"end":return e.stop()}},e,this)})),function(){return Or.apply(this,arguments)})},{key:"endOfStream",value:(Ir=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._mse)if(this._sourceCreated)return e.next=4,this._mse.endOfStream();e.next=5;break;case 4:this.hls.emit(L.BUFFEREOS);case 5:this._softVideo&&this._softVideo.endOfStream();case 6:case"end":return e.stop()}},e,this)})),function(){return Ir.apply(this,arguments)})},{key:"setLiveSeekableRange",value:(Pr=A(D().mark(function e(t,i){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this._mse&&this._mse.setLiveSeekableRange(t,i);case 1:case"end":return e.stop()}},e,this)})),function(e,t){return Pr.apply(this,arguments)})},{key:"detachMedia",value:(Lr=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._mse)return e.next=3,this._mse.unbindMedia();e.next=3;break;case 3:case"end":return e.stop()}},e,this)})),function(){return Lr.apply(this,arguments)})},{key:"destroy",value:(Ar=A(D().mark(function e(){var t;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return null!=(t=this._decryptor)&&t.destroy(),e.next=3,this.detachMedia();case 3:this._decryptor=null,this._mse=null,this._softVideo=null;case 6:case"end":return e.stop()}},e,this)})),function(){return Ar.apply(this,arguments)})},{key:"_createMseSource",value:function(e,t,i){Wr.debug("create mse source, videoCodec=".concat(e,", audioCodec=").concat(t));var n=this._mse;n&&(e&&(n.createSource(v.VIDEO,"video/mp4;codecs=".concat(e)),this._sourceCreated=!0),t?(n.createSource(v.AUDIO,"audio/mp4;codecs=".concat(t)),this._sourceCreated=!0):i&&(n.createSource(v.AUDIO,"".concat(i,';codecs=""')),this._sourceCreated=!0),this.hls.emit(L.SOURCEBUFFER_CREATED))}},{key:"_handleCodecChange",value:function(e,t){var r=[],s=this._mse;return[{type:v.VIDEO,codecs:null==e?void 0:e.codec},{type:v.AUDIO,codecs:null==t?void 0:t.codec}].filter(function(e){return!!e.codecs}
1).forEach(function(e){var t,i=e.type,e=e.codecs,n=s.getSourceBuffer(i);n&&(t=e.split(",")[0],new RegExp(t,"ig").test(n.mimeType)||r.push(s.changeType(i,"".concat(i,"/mp4;codecs=").concat(e))))}),r}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}},{key:"isFull",value:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:v.VIDEO;return null==(e=this._mse)?void 0:e.isFull(t)}}]),Yr);function Yr(e){var t=this;l(this,Yr),s(this,"_decryptor",new Hr),s(this,"_transmuxer",null),s(this,"_mse",null),s(this,"_softVideo",null),s(this,"_sourceCreated",!1),s(this,"_needInitSegment",!0),s(this,"_directAppend",!1),(this.hls=e).config.softDecode?this._softVideo=e.media:(this._mse=new v(null,{preferMMS:e.config.preferMMS}),e.config.url&&this._mse.bindMedia(e.media).then(function(e){t.hls.emit(L.MEDIASOURCE_OPENED,e)})),e.config.decryptor&&(this._decryptor.externalDecryptor=e.config.decryptor)}function Xr(e,t,i,n){l(this,Xr),s(this,"_initSegmentId",""),this.hls=e,this._demuxer=t?new nn:new qi(null,null,null,n),this._isMP4=t,i&&(this._remuxer=new fn(this._demuxer.videoTrack,this._demuxer.audioTrack))}function Qr(){l(this,Qr);var e=window.crypto||window.msCrypto;this.subtle=e&&(e.subtle||e.webkitSubtle),this.externalDecryptor=null}var Zr=e(function e(){l(this,e),s(this,"version",0),s(this,"streams",[]),s(this,"isMaster",!0)}),Jr={CLEAR_KEY:"org.w3.clearkey",FAIRPLAY:["urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2","com.apple.streamingkeydelivery"],WIDEVINE:["urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine.alpha","com.widevine"],PLAYREADY:["urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95","com.microsoft.playready"]};var $r,es,ts=e(function e(){l(this,e),s(this,"id",0),s(this,"url",""),s(this,"default",!1),s(this,"autoSelect",!1),s(this,"forced",!1),s(this,"group",""),s(this,"name",""),s(this,"lang",""),s(this,"segments",[]),s(this,"endSN",0)}),is=(t(ys,ts),es=i(ys),e(ys)),ns=(t(ms,ts),$r=i(ms),e(ms)),rs=e(function e(){l(this,e),s(this,"id",0),s(this,"bitrate",0),s(this,"width",0),s(this,"height",0),s(this,"name",""),s(this,"url",""),s(this,"audioCodec",""),s(this,"videoCodec",""),s(this,"textCodec",""),s(this,"audioGroup",""),s(this,"audioStreams",[]),s(this,"subtitleStreams",[]),s(this,"closedCaptionsStream",[])}),ss=e(function e(){l(this,e),s(this,"version",0),s(this,"url",""),s(this,"type",""),s(this,"startCC",0),s(this,"endCC",0),s(this,"startSN",0),s(this,"endSN",0),s(this,"totalDuration",0),s(this,"targetDuration",0),s(this,"partTargetDuration",0),s(this,"canSkipUntil",0),s(this,"canSkipDateRanges",!1),s(this,"skippedSegments",0),s(this,"canBlockReload",!1),s(this,"partHoldBack",0),s(this,"live",!0),s(this,"lowLatency",!1),s(this,"endPartIndex",0),s(this,"segments",[]),s(this,"dateRanges",{}),s(this,"skippedSegments",0)}),as=(e(gs,[{key:"end",get:function(){return this.start+this.duration}},{key:"setTrackExist",value:function(e,t){this.hasVideo=e,this.hasAudio=t}},{key:"setByteRange",value:function(e,t){this.byteRange=[0];e=e.split("@");1===e.length&&t&&t.byteRange?(this.byteRange[0]=t.byteRange[1]||0,this.byteRange[0]&&(this.byteRange[0]+=1)):this.byteRange[0]=parseInt(e[1]),this.byteRange[1]=this.byteRange[0]+parseInt(e[0])-1}}]),gs),os=(e(ps,[{key:"clone",value:function(e){var t=new ps(this);return null!=e&&t.setIVFromSN(e),t}},{key:"setIVFromSN",value:function(e){if(!this.iv&&"AES-128"===this.method&&"number"==typeof e&&this.url){this.iv=new Uint8Array(16);for(var t=12;t<16;t++)this.iv[t]=e>>8*(15-t)&255}}},{key:"isSegmentEncrypted",value:function(){return"AES-128"===this.method}},{key:"isValidKeySystem",value:function(){return-1<function e(t){for(var i=[],n=0;n<t.length;n++)Array.isArray(t[n])?i=i.concat(e(t[n])):i.push(t[n]);return i}([Jr.CLEAR_KEY,Jr.FAIRPLAY,Jr.WIDEVINE,Jr.PLAYREADY]).indexOf(this.keyFormat)&&!!(-1<["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method))}},{key:"isSupported",value:function(){return!(!this.method||!this.isSegmentEncrypted()&&!this.isValidKeySystem())}}]),ps),us=(e(fs,[{key:"addDirectives",value:function(e){e=new self.URL(e);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href}}]),fs),ls=/^#(EXT[^:]*)(?::(.*))?$/,cs=/([^=]+)=(?:"([^"]*)"|([^",]*))(?
1:,|$)/g,hs=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,ds=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function fs(e,t,i){l(this,fs),this.msn=e,this.part=t,this.skip=i}function ps(e){l(this,ps),s(this,"method",""),s(this,"url",""),s(this,"iv",null),s(this,"keyFormat",""),s(this,"keyFormatVersions",""),e instanceof ps&&(this.method=e.method,this.url=e.url,this.keyFormat=e.keyFormat,this.keyFormatVersions=e.keyFormatVersions,e.iv)&&(this.iv=new Uint8Array(e.iv))}function gs(e){l(this,gs),s(this,"sn",0),s(this,"cc",0),s(this,"url",""),s(this,"parentUrl",""),s(this,"title",""),s(this,"start",0),s(this,"duration",0),s(this,"dataTime",""),s(this,"key",null),s(this,"byteRange",null),s(this,"isInitSegment",!1),s(this,"initSegment",null),s(this,"isLast",!1),s(this,"hasAudio",!1),s(this,"hasVideo",!1),s(this,"independent",!1),s(this,"partIndex",0),this.parentUrl=e}function ms(){var e;l(this,ms);for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return s(o(e=$r.call.apply($r,[this].concat(i))),"mediaType","SUBTITLE"),e}function ys(){var e;l(this,ys);for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return s(o(e=es.call.apply(es,[this].concat(i))),"mediaType","AUDIO"),s(o(e),"channels",0),e}function vs(e){e=e.match(ls);if(e&&e[1])return[e[1].replace("EXT-X-",""),e[2]]}function _s(e){for(var t={},i=cs.exec(e);i;)t[i[1]]=i[2]||i[3],i=cs.exec(e);return t}function ks(e,t){return t&&e&&!hs.test(e)&&(t=ds.exec(t))?"/"===e[0]?t[1]+e:t[1]+t[2]+e:e}var bs={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function Ss(e,t){var i=bs[e];if(i&&t&&t.length)for(var n=0;n<i.length;n++)for(var r=0;r<t.length;r++)if(i[n].test(t[r]))return t[r]}function xs(e,t,i){var n=new ss;n.url=t;for(var r,s=new as(t),a=null,o=null,u=0,l=0,c=0,h=0,d=!1,f=0;r=e[h++];)if("#"===r[0]){var p=vs(r);if(p){var p=re(p,2),g=p[0],m=p[1];switch(g){case"VERSION":n.version=parseInt(m);break;case"PLAYLIST-TYPE":n.type=null==m?void 0:m.toUpperCase();break;case"TARGETDURATION":n.targetDuration=parseFloat(m);break;case"PART-INF":i&&(n.lowLatency=!0);var y=_s(m);y["PART-TARGET"]&&(n.partTargetDuration=parseFloat(y["PART-TARGET"]));break;case"SERVER-CONTROL":y=_s(m);n.canBlockReload="YES"===y["CAN-BLOCK-RELOAD"],n.partHoldBack=parseFloat(y["PART-HOLD-BACK"]||0),n.canSkipUntil=parseFloat(y["CAN-SKIP-UNTIL"]||0),n.canSkipDateRanges=0<n.canSkipUntil&&"YES"===y["CAN-SKIP-DATERANGES"];break;case"ENDLIST":d=!0;break;case"MEDIA-SEQUENCE":l=n.startSN=parseInt(m);break;case"DISCONTINUITY-SEQUENCE":c=n.startCC=parseInt(m);break;case"DISCONTINUITY":c++;break;case"BYTERANGE":s.setByteRange(m,n.segments[n.segments.length-1]);break;case"PART":n.lowLatency&&(_=_s(m),s.duration=parseFloat(_.DURATION),s.independent="YES"===_.INDEPENDENT,s.sn=l,s.cc=c,s.partIndex=f,s.start=u,s.duration=parseFloat(_.DURATION),u+=s.duration,s.url=ks(_.URI,t),o&&(s.key=o.clone(l)),a&&(s.initSegment=a),n.segments.push(s),s=new as(t),f++);break;case"PRELOAD-HINT":var v,_=_s(m);"PART"===(n.preloadHint=_).TYPE&&_.URI&&(v=_.URI.split(".ts")[0].split("-"),n.nextSN=v[3],n.nextIndex=v[v.length-1]);break;case"PROGRAM-DATE-TIME":s.dataTime=m;break;case"EXTINF":n.lowLatency?f=0:(k=(v=re(m.split(","),2))[0],w=v[1],s.start=u,s.duration=parseFloat(k),u+=s.duration,s.title=w);break;case"KEY":var k=_s(m);if("NONE"===k.METHOD)o=null;else{if((o=new os).method=k.METHOD,o.url=/^blob:/.test(k.URI)?k.URI:ks(k.URI,t),o.keyFormat=k.KEYFORMAT||"identity",o.keyFormatVersions=k.KEYFORMATVERSIONS,!o.isSupported())throw new Error("encrypt ".concat(k.METHOD,"/").concat(k.KEYFORMAT," is not supported"));if(k.IV){var b=(1&(b=k.IV.slice(2)).length?"0":"")+b;o.iv=new Uint8Array(b.length/2);for(var S=0,x=b.length/2;S<x;S++)o.iv[S]=parseInt(b.slice(2*S,2*S+2),16)}}break;case"MAP":var w=_s(m);s.url=ks(w.URI,t),w.BYTERANGE&&s.setByteRange(w.BYTERANGE),s.isInitSegment=!0,s.sn=0,o&&(s.key=o.clone(0)),a=s,s=new as(t);break;case"SKIP":var T=_s(m),T=parseInt(T["SKIPPED-SEGMENTS"],10);T<=Number.MAX_SAFE_INTEGER&&(n.skippedSegments+=T,l+=T);break;case"DATERANGE":var T=_s(m),E=n.dateRanges[T.ID],C=(T._startDate=E?E._startDate:new Date(T["START-DATE"]),(null==E?void 0:E._endDate)||new Date(T.END_DATE));Number.isFinite(C)&&(T._endDate=C),(((e,t)=>{var i;if(t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e[n]!==t[n]){i=n;break}var r=null;e.DURATION&&(r=parseFloat(e.DURATION),Number.isFinite(r)?e._endDate&&(r=(e._endDate.getTime()-e._startDate.getTime())/1e3):r=null),s={pre:!1,post:!1,once:!1};var s,a=((a=e.CUE||e["X-CUE"])?a.split(/[ ,]+/):[]).reduce(function(e,t){return e[t.toLowerCase()]=!0,e},s);return e.ID&&!i&&Number.isFinite(e._startDate.getTime())&&(null===r||0<=r)&&("YES"!==e.END_ON_NEXT||e.CLASS)&&(!e.CUE||!a.pre&&!a.post||a.pre!==a.post)&&("com.apple.hls.interstitial"!==e.CLASS||"X-ASSET-URI"in e||"X-ASSET-LIST"in e)})(T,E)||n.skippedSegments)&&(n.dateRanges[T.ID]=T)}}}else{if(n.lowLatency){l++;continue}s.sn=l,s.cc=c,s.url=ks(r,t),o&&(s.key=o.clone(l)),a&&(s.initSegment=a),n.segments.push(s),s=new as(t),l++}n.segments=n.segments.filter(function(e){return 0!==e.duration});var D=n.segments[n.segments.length-1];return D&&(d&&(D.isLast=!0),n.endSN=D.sn,n.endPartIndex=D.partIndex),d&&(n.live=!1),n.totalDuration=u,n.endCC=c,n}e(Ds,null,[{key:"parse",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=1<arguments.length?arguments[1]:void 0,i=2<arguments.length?arguments[2]:void 0;if(e.includes("#EXTM3U")){var n=e.split(/[\r\n]/).map(function(e){return e.trim()}
1).filter(Boolean);if(Ds.isMediaPlaylist(e))return xs(n,t,i);else{var r=n;var s=t;for(var a=new Zr,o=0,u=[],l=[];c=r[o++];){var c=vs(c);if(c){var h,c=re(c,2),d=c[0],c=c[1];if("VERSION"===d)a.version=parseInt(c);else if("MEDIA"===d&&c){var f=_s(c),p=void 0;switch(f.TYPE){case"AUDIO":p=new is;break;case"SUBTITLES":p=new ns;break;default:p=new ts}p.url=ks(f.URI,s),p.default="YES"===f.DEFAULT,p.autoSelect="YES"===f.AUTOSELECT,p.group=f["GROUP-ID"],p.name=f.NAME,p.lang=f.LANGUAGE,f.CHANNELS&&(p.channels=Number(f.CHANNELS.split("/")[0]),Number.isNaN(p.channels))&&(p.channels=0),"AUDIO"===f.TYPE&&f.URI&&u.push(p),"SUBTITLES"===f.TYPE&&l.push(p)}else"STREAM-INF"===d&&c&&(f=new rs,d=_s(c),f.bitrate=parseInt(d["AVERAGE-BANDWIDTH"]||d.BANDWIDTH),f.name=d.NAME,f.url=ks(r[o++],s),d.RESOLUTION&&(h=(c=re(d.RESOLUTION.split("x"),2))[0],c=c[1],f.width=parseInt(h),f.height=parseInt(c)),d.CODECS&&(h=d.CODECS.split(/[ ,]+/).filter(Boolean),f.videoCodec=Ss("video",h),f.audioCodec=Ss("audio",h),f.textCodec=Ss("text",h)),f.audioGroup=d.AUDIO,f.subtitleGroup=d.SUBTITLES,a.streams.push(f))}}return a.streams.forEach(function(e,t){e.id=t}),u.length&&(u.forEach(function(e,t){e.id=t}),a.streams.forEach(function(t){t.audioGroup&&(t.audioStreams=u.filter(function(e){return e.group===t.audioGroup}))})),l.length&&(l.forEach(function(e,t){e.id=t}),a.streams.forEach(function(t){t.subtitleGroup&&(t.subtitleStreams=l.filter(function(e){return e.group===t.subtitleGroup}))})),a;return}}throw new Error("Invalid m3u8 file")}},{key:"isMediaPlaylist",value:function(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}]);var ws,Ts=Ds,Es=(e(Cs,[{key:"load",value:(ws=A(D().mark(function e(t,i,n){var r,s,a,o,u,l,c,h,d,f,p,g,m,y,v;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u=[this._loader.load(t)],i&&u.push(this._audioLoader.load(i)),n&&u.push(this._subtitleLoader.load(n)),e.prev=3,e.next=6,Promise.all(u);case 6:if(u=e.sent,h=re(u,3),l=h[0],c=h[1],h=h[2],l){e.next=13;break}return e.abrupt("return",[]);case 13:this._emitOnLoaded(l,t),r=l.data,o=l.response.url||t,i?(s=null==c?void 0:c.data,a=null==h?void 0:h.data,d=(null==c||null==(d=c.response)?void 0:d.url)||i,f=(null==h||null==(f=h.response)?void 0:f.url)||n,s&&this._emitOnLoaded(c,i),a&&this._emitOnLoaded(h,n)):(a=null==c?void 0:c.data,f=(null==c||null==(p=c.response)?void 0:p.url)||n,a&&this._emitOnLoaded(c,n)),e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(3),_.network(e.t0);case 22:if(p=this.hls.config.onPreM3U8Parse,e.prev=23,p&&(r=p(r)||r,s=s&&(p(s,!0)||s),a=a&&(p(a,!0)||a)),g=Ts.parse(r,o,this._useLowLatency),!1===(null==(v=g)?void 0:v.live)&&g.segments&&!g.segments.length)throw new Error("empty segments list");e.next=28;break;case 28:s&&(m=Ts.parse(s,d,this._useLowLatency)),a&&(y=Ts.parse(a,f,this._useLowLatency)),e.next=35;break;case 32:throw e.prev=32,e.t1=e.catch(23),new _(he,me,e.t1);case 35:return g&&(g.isMaster?this.hls.emit(E.HLS_MANIFEST_LOADED,{playlist:g}):(this._useLowLatency&&(g.canBlockReload?this.deliveryDirectives=new us(g.nextSN,g.nextIndex,""):this.deliveryDirectives=null),this.hls.emit(E.HLS_LEVEL_LOADED,{playlist:g}))),e.abrupt("return",[g,m,y]);case 37:case"end":return e.stop()}},e,this,[[3,19],[23,32]])})),function(e,t,i){return ws.apply(this,arguments)})},{key:"parseText",value:function(e,t){var i,n,r=this.hls.config.onPreM3U8Parse;try{if(r&&(e=r(e)||e),!1===(null==(n=i=Ts.parse(e,t,this._useLowLatency))?void 0:n.live)&&i.segments&&!i.segments.length)throw new Error("empty segments list")}catch(e){throw new _(he,me,e)}return i&&(i.isMaster?this.hls.emit(E.HLS_MANIFEST_LOADED,{playlist:i}):this.hls.emit(E.HLS_LEVEL_LOADED,{playlist:i})),[i]}},{key:"poll",value:function(n,r,s,a,o,u){var e,l=this,c=(clearTimeout(this._timer),u=u||3e3,this.hls.config.pollRetryCount),h=(e=A(D().mark(function e(){var t,i;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(l._timer),t=n,e.prev=2,l.deliveryDirectives&&(t=l.deliveryDirectives.addDirectives(n)),e.next=6,l.load(t,r,s);case 6:if((i=e.sent)[0]){e.next=9;break}return e.abrupt("return");case 9:c=l.hls.config.pollRetryCount,a(i[0],i[1],i[2]),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(2),--c<=0&&o(e.t0);case 17:l._timer=setTimeout(h,u);case 18:case"end":return e.stop()}},e,null,[[2,13]])})),function(){return e.apply(this,arguments)});this._timer=setTimeout(h,u)}},{key:"stopPoll",value:function(){return clearTimeout(this._timer),this.cancel()}},{key:"cancel",value:function(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}]),Cs);function Cs(e){var a=this,e=(l(this,Cs),s(this,"_emitOnLoaded",function(e,t){var i=e.response,e=e.options||{},n=e.firstByteTime,r=e.startTime,s=e.endTime-r;a.hls.emit(L.SPEED,{time:s,byteLength:e.contentLength,url:t}),a.hls.emit(L.LOAD_COMPLETE,{url:t,elapsed:s||0}),a.hls.emit(L.TTFB,{url:t,responseUrl:i.url,elapsed:n-r}),a.hls.emit(L.LOAD_RESPONSE_HEADERS,{headers:i.headers,url:t})}),s(this,"_onLoaderRetry",function(e,t){a.hls.emit(E.LOAD_RETRY,{error:_.network(e),retryTime:t})}),this.hls=e,this._timer=null,this._useLowLatency=e.config.useLowLatency,this.hls.config),t=e.retryCount,i=e.retryDelay,n=e.manifestLoadTimeout,e=e.fetchOptions;this._loader=new St(p(p({},e),{},{responseType:"text",retry:t,retryDelay:i,timeout:n,onRetryError:this._onLoaderRetry}
1)),this._audioLoader=new St(p(p({},e),{},{responseType:"text",retry:t,retryDelay:i,timeout:n,onRetryError:this._onLoaderRetry})),this._subtitleLoader=new St(p(p({},e),{},{responseType:"text",retry:t,retryDelay:i,timeout:n,onRetryError:this._onLoaderRetry}))}function Ds(){l(this,Ds)}function As(e,t,i){return i<t&&(i=t),Math.min(Math.max(e,t),i)}var Ls,Ps,Is,Os,Rs,js,Ms,Ns,Bs,Fs,Us,Hs,Vs,Gs,zs,qs,Ws,Ks,Ys=new Ce("playlist"),Xs=(e(ia,[{key:"lastSegment",get:function(){return this.segments.length?this.segments[this.segments.length-1]:null}},{key:"segmentDuration",get:function(){var e;return this.targetDuration||(null==(e=this.segments[0])?void 0:e.duration)||0}},{key:"liveEdge",get:function(){return this.endTime},set:function(e){this.endTime=e}},{key:"endTime",get:function(){var e;return(null==(e=this.lastSegment)?void 0:e.end)||0},set:function(e){var t=this.lastSegment;t&&(t.duration=e-t.start)}},{key:"currentSubtitleEndSn",get:function(){var e;return(null==(e=this.currentSubtitleStream)?void 0:e.endSN)||0}},{key:"clearOldSegment",value:function(e,t){return this.currentAudioStream&&this._clearSegments(e,t),this._clearSegments(e,t)}},{key:"getAudioSegment",value:function(e){var t;if(e&&this.currentAudioStream)return t=e.sn-this.snDiff,this.currentAudioStream.segments.find(function(e){return e.sn===t})}},{key:"update",value:function(e,t){this.url=e.url,Array.isArray(e.segments)?(null==this.live&&(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,this.lowLatency=e.lowLatency,this.canBlockReload=e.canBlockReload,this.canSkipDateRanges=e.canSkipDateRanges,this.canSkipUntil=e.canSkipUntil,this.partHoldBack=e.partHoldBack,this.partTargetDuration=e.partTargetDuration,this.skippedSegments=e.skippedSegments,this.endPartIndex=e.endPartIndex,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),null==this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn)):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find(function(e){return e.default})||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find(function(e){return e.default})||this.subtitleStreams[0]))}},{key:"updateSubtitle",value:function(e){var t=this;if(e&&this.currentSubtitleStream&&Array.isArray(e.segments)){var e=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;if(100<i.length&&(this.currentSubtitleStream.segments=i.slice(100)),e)return e.map(function(e){return{sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:t.currentSubtitleStream.lang}})}}},{key:"switchSubtitle",value:function(t){var e=this.subtitleStreams.find(function(e){return e.lang===t}),i=this.currentSubtitleStream;e&&(this.currentSubtitleStream=e,i.segments=[])}},{key:"_setLLPlaybackPoint",value:function(e){if(e.lowLatency&&e.segments.length){for(var t=e.totalDuration-e.partHoldBack,i=e.segments,n=0,r=0,s=i.length;r<s;r++)i[r].start<=t&&i[r].independent&&(n=r);var a=i.slice(n),o=0;a.forEach(function(e){e.start=o,o=e.end}),e.segments=a,e.totalDuration=o,e.startSN=a[0].sn,e.startCC=a[0].cc,Ys.log("set ll-hls playback point: SN=".concat(e.startSN," partIndex=").concat(a[0].partIndex,", duration=").concat(o))}return e}},{key:"_clearSegments",value:function(e,t){for(var i=0,n=this.segments,r=0,s=n.length;r<s;r++)if(n[r].end>=e){i=r;break}return(i=t<i?t:i)&&(this.segments=this.segments.slice(i),this.currentAudioStream)&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i)),t-i}},{key:"_updateSegments",value:function(e,t){var i=t.segments;if(this.live){var n,r,s=e.lowLatency,a=i[i.length-1],o=null!=(l=null==a?void 0:a.sn)?l:-1,u=(null==a?void 0:a.partIndex)||0,l=o<e.endSN&&e.segments.length;if(l=s?l||u<e.endPartIndex:l)return Ys.log("update segments: endSN:".concat(o,", partIndex:").concat(u," --\x3e endSN:").concat(e.endSN,", partIndex:").concat(e.endPartIndex)),l=(s=e.segments.findIndex(function(e){return e.sn===o&&e.partIndex===u}
1))<0?e.segments:e.segments.slice(s+1),i.length&&l.length&&(s=n=a.end,l.forEach(function(e){e.start=n,n=e.end}),Ys.log("liveEdge: ".concat(s," -> ").concat(n)),(r=(null==a?void 0:a.cc)||-1)>l[0].cc)&&l.forEach(function(e){return e.cc+=r}),t.endSN=e.endSN,t.segments=i.concat(l),l}else t.segments=e.segments}}]),ia),Qs=(e(ta,[{key:"lowLatency",get:function(){var e;return null==(e=this.currentStream)?void 0:e.lowLatency}},{key:"lastSegment",get:function(){var e;return null==(e=this.currentStream)?void 0:e.lastSegment}},{key:"currentSegment",get:function(){var e;return null==(e=this.currentSegments)?void 0:e[this._segmentPointer]}},{key:"nextSegment",get:function(){var e;return null==(e=this.currentSegments)?void 0:e[this._segmentPointer+1]}},{key:"currentSegments",get:function(){var e;return null==(e=this.currentStream)?void 0:e.segments}},{key:"currentSubtitleEndSn",get:function(){var e;return null==(e=this.currentStream)?void 0:e.currentSubtitleEndSn}},{key:"liveEdge",get:function(){var e;return null==(e=this.currentStream)?void 0:e.liveEdge},set:function(e){this.currentStream&&(this.currentStream.liveEdge=e)}},{key:"totalDuration",get:function(){var e;return(null==(e=this.currentStream)?void 0:e.totalDuration)||0}},{key:"seekRange",get:function(){var e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}},{key:"nbSegments",get:function(){var e;return(null==(e=this.currentSegments)?void 0:e.length)||0}},{key:"isEmpty",get:function(){var e;return!(null!=(e=this.currentSegments)&&e.length)}},{key:"isLive",get:function(){var e;return null==(e=this.currentStream)?void 0:e.live}},{key:"hadSegmentLoaded",get:function(){return-1!==this._segmentPointer}},{key:"hasSubtitle",get:function(){var e;return!(null==(e=this.currentStream)||!e.currentSubtitleStream)}},{key:"getAudioSegment",value:function(e){var t;return null==(t=this.currentStream)?void 0:t.getAudioSegment(e)}},{key:"moveSegmentPointer",value:function(e){null==e&&(e=this._segmentPointer+1),this._segmentPointer=As(e,-1,null==(e=this.currentSegments)?void 0:e.length)}},{key:"reset",value:function(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}},{key:"getSegmentByIndex",value:function(e){var t;return null==(t=this.currentSegments)?void 0:t[e]}},{key:"setNextSegmentByIndex",value:function(){this._segmentPointer=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)-1}},{key:"setNextSegmentBySN",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=null==(e=this.currentSegments)?void 0:e.findIndex(function(e){return e.sn===t});return-1!==e&&this.setNextSegmentByIndex(e+1),e}},{key:"findSegmentIndexByTime",value:function(e){var t=this.currentSegments;if(t){for(var i,n=0,r=t.length;n<r;n++)if(e>=(i=t[n]).start&&e<i.end)return n;var s=t[t.length-1];if(Math.abs(e-(null==s?void 0:s.end))<.2)return t.length-1}}},{key:"upsertPlaylist",value:function(e,t,i){var n,r=this;e&&(e.isMaster?(this.streams.length=e.streams.length,e.streams.filter(function(e){return e.url}).forEach(function(e,t){r.streams[t]?r.streams[t].update(e):r.streams[t]=new Xs(e)}),this.currentStream=this.streams[0]):Array.isArray(e.segments)&&((n=this.currentStream)?(n.update(e,t,i),(n=n.updateSubtitle(i))&&this.hls.emit(E.SUBTITLE_SEGMENTS,{list:n})):(this.reset(),this.currentStream=this.streams[0]=new Xs(e,t,i))),this.currentStream)&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(function(e,t){return e+t.duration},0))}},{key:"updateSegmentsRanges",value:function(t,i){var e;(null==(e=this.currentSegments)?void 0:e.filter(function(e){return e.sn>=t})).forEach(function(e){e.start=i,i=e.end})}},{key:"switchSubtitle",value:function(e){var t;null!=(t=this.currentStream)&&t.switchSubtitle(e)}},{key:"clearOldSegment",value:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.hls.config.maxPlaylistSize||50,i=this.currentStream;this.dvrWindow&&i&&((e=i.endTime-this.dvrWindow)<=0||i.segments.length<=t||(this._segmentPointer=i.clearOldSegment(e,this._segmentPointer)))}},{key:"checkSegmentTrackChange",value:function(e,t){var i=this.findSegmentIndexByTime(e),n=this.getSegmentByIndex(i);if(n&&(n.hasAudio||n.hasVideo))return 2!==t&&n.hasAudio&&n.hasVideo?n:!(.3<n.end-e)&&(t=this.getSegmentByIndex(i+1))&&(t.hasAudio||t.hasVideo)&&(t.hasAudio!==n.hasAudio||t.hasVideo!==n.hasVideo)?t:void 0}},{key:"feedbackLiveEdge",value:function(e,t){var i;this.currentSegments&&((null==(i=this.lastSegment)?void 0:i.sn)===e.sn?this.liveEdge=t:this.updateSegmentsRanges(e.sn+1,t))}}]),ta),Zs=(e(ea,[{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"load",value:function(e,t,i){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:i,r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,n)),Promise.all(r)}},{key:"loadVideoSegment",value:function(e,t){return this._loadSegment(this._segmentLoader,e,t)}},{key:"loadAudioSegment",value:function(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}},{key:"_loadSegment",value:(Ks=A(D().mark(function e(t,i,n){var r,s,a,o,u,l,c,h,d,f,p,g,m=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return f=[],this.hls.emit(L.LOAD_START,{url:i.url}),f[0]=t.load(i.url),n&&i.initSegment&&(c=i.initSegment.url,(r=this._mapCache[c])||(this.hls.emit(L.LOAD_START,{url:c}),f[1]=t.load(c).then(function(e){e&&(30<Object.keys(m._mapCache)&&(m._mapCache={}),r=m._mapCache[c]=e.data,m._emitOnLoaded(e,c))})),h=null==(l=i.initSegment.key)?void 0:l.url)&&(u=i.initSegment.key.iv,(o=this._keyCache[h])||(this.hls.emit(L.LOAD_START,{url:h}),f[2]=this._keyLoader.load(h).then(function(e){e&&(o=m._keyCache[h]=e.data,m._emitOnLoaded(e,h))}))),(d=null==(l=i.key)?void 0:l.url)&&i.key.isSegmentEncrypted()&&(a=i.key.iv,(s=this._keyCache[d])||(this.hls.emit(L.LOAD_START,{url:d}),f[3]=this._keyLoader.load(d).then(function(e){e&&(s=m._keyCache[d]=e.data,m._emitOnLoaded(e,d))}))),e.next=8,Promise.all(f);
1case 8:if(f=e.sent,p=re(f,1),p=p[0]){e.next=13;break}return e.abrupt("return");case 13:return g=p.data,this._emitOnLoaded(p,i.url),e.abrupt("return",{data:g,map:r,key:s,mapKey:o,keyIv:a,mapKeyIv:u});case 16:case"end":return e.stop()}},e,this)})),function(e,t,i){return Ks.apply(this,arguments)})},{key:"reset",value:function(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}},{key:"cancel",value:(Ws=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()]);case 2:case"end":return e.stop()}},e,this)})),function(){return Ws.apply(this,arguments)})}]),ea),j=new Ce("hls"),Js=(t($s,ot),qs=i($s),e($s,[{key:"isLive",get:function(){return this._playlist.isLive}},{key:"streams",get:function(){return this._playlist.streams}},{key:"currentStream",get:function(){return this._playlist.currentStream}},{key:"hasSubtitle",get:function(){return this._playlist.hasSubtitle}},{key:"totalDuration",get:function(){return this._playlist.totalDuration}},{key:"baseDts",get:function(){var e;return null==(e=this._bufferService)?void 0:e.baseDts}},{key:"abrSwitchPoint",get:function(){var e=this._urlSwitching?this._playlist.currentSegment:this._playlist.nextSegment;return e?e.start+e.duration/2:null}},{key:"speedInfo",value:function(){return this._segmentLoader.speedInfo()}},{key:"bufferInfo",value:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.1;return u.info(u.get(this.media),null==(e=this.media)?void 0:e.currentTime,t)}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"playbackQuality",value:function(){return(e=this.media)?"function"==typeof e.getVideoPlaybackQuality?{droppedVideoFrames:(t=e.getVideoPlaybackQuality()).droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}:{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}:{};var e,t}},{key:"load",value:(zs=A(D().mark(function e(){var t,i,n,r=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=0<r.length&&void 0!==r[0]?r[0]:"",n="boolean"==typeof(i=1<r.length&&void 0!==r[1]?r[1]:{})?i:!(null==i||!i.reuseMse),"object"===Y(i)&&null!=i&&i.clearSwitchStatus&&(this._urlSwitching=!1,this._switchUrlOpts=null,this.config.startTime=void 0),t&&(this.config.url=t),t=this.config.url,e.next=8,this._reset(n);case 8:return e.next=10,this._loadData(t);case 10:this._startTick();case 11:case"end":return e.stop()}},e,this)})),function(){return zs.apply(this,arguments)})},{key:"_loadData",value:(Gs=A(D().mark(function e(t){var i,n,r,s,a,o,u;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{t=t&&t.trim()}catch(e){}if(t){e.next=3;break}throw this._emitError(new _(ge,xe,null,null,"m3u8 url is missing"));case 3:return e.next=5,this._loadM3U8(t);case 5:(i=e.sent,n=this._playlist.currentStream,this._urlSwitching)?this.isLive?(r=this._playlist.setNextSegmentBySN(this._prevSegSn),j.log("segment nb=".concat(this._prevSegSn," index of ").concat(r," in the new playlist")),-1===r&&(this._prevSegCc=null,this._prevSegSn=null),e.next=23):e.next=14:e.next=23;break;case 14:if(0===n.bitrate&&null!=(r=this._switchUrlOpts)&&r.bitrate&&(n.bitrate=null==(s=this._switchUrlOpts)?void 0:s.bitrate),a="number"==typeof(null==(s=this._switchUrlOpts)?void 0:s.startTime)?null==(a=this._switchUrlOpts)?void 0:a.startTime:this._getSeamlessSwitchPoint(),this.config.startTime=a,o=this._playlist.findSegmentIndexByTime(a),o=this._playlist.getSegmentByIndex(o+1))return o=o.start,e.next=23,this._bufferService.removeBuffer(o);e.next=23;break;case 23:if(i){e.next=25;break}return e.abrupt("return");case 25:if(this.isLive){if(this._bufferService.setLiveSeekableRange(0,4294967295),j.log("totalDuration first time got:",this._playlist.totalDuration),j.log("nb segments got:",this._playlist.nbSegments),this.config.targetLatency<this._playlist.totalDuration&&(this.config.targetLatency=this._playlist.totalDuration,this.config.maxLatency=1.5*this.config.targetLatency),i.isMaster||this._pollM3U8(t),this._playlist.nbSegments<this.config.minSegmentsStartPlay)return e.abrupt("return");e.next=33}else e.next=36;break;case 33:return e.next=35,this._loadSegment();case 35:return e.abrupt("return");case 36:return e.next=38,this._bufferService.updateDuration(n.totalDuration);case 38:return(o=this.config.startTime)&&(null!=(u=this._switchUrlOpts)&&u.seamless||(this.media.currentTime=o),this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(o)||0)),e.next=42,this._loadSegment();case 42:case"end":return e.stop()}},e,this)})),function(e){return Gs.apply(this,arguments)})},{key:"replay",value:(Vs=A(D().mark(function e(t){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.config.startTime=0,this._urlSwitching=!1,this._switchUrlOpts=null,e.next=5,this.load();case 5:return this._reloadOnPlay=!1,e.abrupt("return",this.media.play(!t));case 7:case"end":return e.stop()}},e,this)})),function(e){return Vs.apply(this,arguments)})},{key:"switchURL",value:(Hs=A(D().mark(function e(t){var i,n,r,s,a,o,u=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=1<u.length&&void 0!==u[1]?u[1]:{},n={seamless:!1,startTime:0,bitrate:0},e.t0=Y(i),e.next="number"===e.t0?5:"boolean"===e.t0?7:"object"===e.t0?9:11;break;case 5:return i={startTime:i},e.abrupt("break",12);case 7:return i={seamless:i},e.abrupt("break",12);case 9:for(r in i)null==i[r]&&delete i[r];return e.abrupt("break",12);case 11:throw"unsupported switchURL args: ".concat(i);case 12:(i=Object.assign({},n,i),s=i.seamless,a=i.startTime,this.config.url=t,this.config.startTime=a,this._switchUrlOpts=i,s)?e.next=38:(e.prev=18,this.config.softDecode?(e.t1=this.load(t),e.next=26):e.next=23);break;case 23:return e.next=25,this.load(t);case 25:e.t1=e.sent;case 26:o=e.t1,e.next=33;break;
1case 29:throw e.prev=29,e.t2=e.catch(18),this.emit(E.SWITCH_URL_FAILED,e.t2),e.t2;case 33:return this._reloadOnPlay=!1,o&&this.emit(E.SWITCH_URL_SUCCESS,{url:t}),e.abrupt("return",this.media.play(!0));case 38:return this._urlSwitching=!0,this.isLive||(this._prevSegSn=null,this._prevSegCc=null),this._playlist.reset(),this._bufferService.seamlessSwitch(),e.next=44,this._clear();case 44:return e.next=46,this._loadData(t);case 46:this._startTick();case 47:this._switchUrlOpts=null;case 48:case"end":return e.stop()}},e,this,[[18,29]])})),function(e){return Hs.apply(this,arguments)})},{key:"switchStream",value:(Us=A(D().mark(function e(t){var i,n,r,s,a,o=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=!(1<o.length&&void 0!==o[1])||o[1],n=this.currentStream,r=this.streams,!n||n.id===t||!r||r.length<2)return e.abrupt("return");e.next=5;break;case 5:if(s=r.find(function(e){return e.id===t})){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this._clear();case 11:if(i)return e.next=14,this._bufferService.clearAllBuffer();e.next=14;break;case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(8),this._emitError(_.create(e.t0));case 19:if(n.currentAudioStream&&2<s.audioStreams.length&&(a=n.currentAudioStream.id,s.currentAudioStream=s.audioStreams.find(function(e){return e.id===a})||s.currentAudioStream),this._playlist.currentStream=s,e.prev=21,this.isLive||!s.segments.length)return e.next=25,this._refreshM3U8();e.next=25;break;case 25:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=29,this._loadSegmentDirect();case 29:e.next=35;break;case 31:throw e.prev=31,e.t1=e.catch(21),this._playlist.currentStream=n,e.t1;case 35:return this._startTick(),e.abrupt("return",s);case 37:case"end":return e.stop()}},e,this,[[8,16],[21,31]])})),function(e){return Us.apply(this,arguments)})},{key:"switchAudioStream",value:(Fs=A(D().mark(function e(t){var i,n,r,s,a=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=!(1<a.length&&void 0!==a[1])||a[1],n=this.currentStream){e.next=4;break}return e.abrupt("return");case 4:if(!(r=n.currentAudioStream)||r.id===t||n.audioStreams.length<2)return e.abrupt("return");e.next=7;break;case 7:if(s=n.audioStreams.find(function(e){return e.id===t})){e.next=10;break}return e.abrupt("return");case 10:return e.prev=10,e.next=13,this._clear();case 13:if(i)return e.next=16,this._bufferService.clearAllBuffer();e.next=16;break;case 16:e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(10),this._emitError(_.create(e.t0));case 21:if(n.currentAudioStream=s,e.prev=22,this.isLive||!s.segments.length)return e.next=26,this._refreshM3U8();e.next=26;break;case 26:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=30,this._loadSegmentDirect();case 30:e.next=36;break;case 32:throw e.prev=32,e.t1=e.catch(22),n.currentAudioStream=r,e.t1;case 36:return this._startTick(),e.abrupt("return",s);case 38:case"end":return e.stop()}},e,this,[[10,18],[22,32]])})),function(e){return Fs.apply(this,arguments)})},{key:"switchSubtitleStream",value:(Bs=A(D().mark(function e(t){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._playlist.switchSubtitle(t),e.next=3,this._manifestLoader.stopPoll();case 3:return e.next=5,this._refreshM3U8();case 5:case"end":return e.stop()}},e,this)})),function(e){return Bs.apply(this,arguments)})},{key:"detachMedia",value:(Ns=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._bufferService)return e.next=3,this._bufferService.detachMedia();e.next=3;break;case 3:case"end":return e.stop()}},e,this)})),function(){return Ns.apply(this,arguments)})},{key:"destroy",value:(Ms=A(D().mark(function e(){var t;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._playlist.reset(),this._segmentLoader.reset(),null!=(t=this._seiService)&&t.reset(),this.media.removeEventListener("loadeddata",this._onLoadeddata),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("pause",this._onPause),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),e.next=13,Promise.all([this._clear(),this._bufferService.destroy()]);case 13:this.media=null;case 14:case"end":return e.stop()}},e,this)})),function(){return Ms.apply(this,arguments)})},{key:"_loadM3U8",value:(js=A(D().mark(function e(t){var i,n,r;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(e.prev=0,i=null==(i=this.config.manifestList)||null==(i=i.filter(function(e){return e.url===t})[0])?void 0:i.manifest)?(e.t0=this._manifestLoader.parseText(i,t),e.next=9):e.next=6;break;case 6:return e.next=8,this._manifestLoader.load(t);case 8:e.t0=e.sent;case 9:i=e.t0,n=re(i,1),n=n[0],e.next=17;break;case 14:throw e.prev=14,e.t1=e.catch(0),this._emitError(_.create(e.t1));case 17:if(n){e.next=19;break}return e.abrupt("return");case 19:if(this._playlist.upsertPlaylist(n),n.isMaster)return null!=(r=this._playlist.currentStream.subtitleStreams)&&r.length&&this.emit
1(E.SUBTITLE_PLAYLIST,{list:this._playlist.currentStream.subtitleStreams}),e.next=24,this._refreshM3U8();e.next=24;break;case 24:return this.emit(E.STREAM_PARSED),e.abrupt("return",n);case 26:case"end":return e.stop()}},e,this,[[0,14]])})),function(e){return js.apply(this,arguments)})},{key:"_refreshM3U8",value:function(){var e,i,n,r,s=this,t=this._playlist.currentStream;if(t&&t.url)return i=t.url,n=null==(e=t.currentAudioStream)?void 0:e.url,r=null==(e=t.currentSubtitleStream)?void 0:e.url,this._manifestLoader.load(i,n,r).then(function(e){var e=re(e,3),t=e[0];t&&(s._playlist.upsertPlaylist(t,e[1],e[2]),s.isLive)&&s._pollM3U8(i,n,r)}).catch(function(e){throw s._emitError(_.create(e))});throw this._emitError(_.create(null,null,new Error("m3u8 url is not defined")))}},{key:"_pollM3U8",value:function(e,t,i){var n=this,r=this._playlist.isEmpty,s=this._playlist.lowLatency?1e3*(this._playlist.currentStream.partTargetDuration||0):1e3*((null==(s=this._playlist.lastSegment)?void 0:s.duration)||0);this._manifestLoader.poll(e,t,i,function(e,t,i){n._playlist.upsertPlaylist(e,t,i),n._playlist.clearOldSegment(),(e&&r&&!n._playlist.isEmpty||!n._playlist.hadSegmentLoaded&&n._playlist.nbSegments>=n.config.minSegmentsStartPlay)&&n._loadSegment(),r=r&&n._playlist.isEmpty},function(e){n._emitError(_.create(e))},s)}},{key:"_loadSegmentDirect",value:(Rs=A(D().mark(function e(t){var i,n,r,s;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._playlist.nextSegment){e.next=3;break}return e.abrupt("return");case 3:return n=!1,r=null,e.prev=5,this._segmentProcessing=!0,j.log("load segment, sn:".concat(i.sn,", [").concat(i.start,", ").concat(i.end,"], partIndex:").concat(i.partIndex)),e.next=10,this._reqAndBufferSegment(i,this._playlist.getAudioSegment(i));case 10:n=e.sent,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(5),r=e.t0;case 16:return e.prev=16,this._segmentProcessing=!1,e.finish(16);case 19:if(r){if(this._bufferService.isFull())return j.log("load segment, sn:".concat(i.sn,", partIndex:").concat(i.partIndex)),this._segmentProcessing=!0,this._isProcessQuotaExceeded=!0,e.abrupt("return",!1);e.next=25}else e.next=26;break;case 25:return e.abrupt("return",this._emitError(_.create(r)));case 26:return n&&(s=this.bufferInfo().end,this.isLive&&!this.media.seeking&&s&&1<Math.abs(i.end-s)&&(j.warn("segment: ".concat(i.sn," expected end=").concat(i.end,", real end=").concat(s)),this._playlist.feedbackLiveEdge(i,s)),s=(null==(s=this._playlist.currentStream)?void 0:s.url)===i.parentUrl,this._urlSwitching&&!s&&(j.warn("pre playlist segment appended!"),this._bufferService.seamlessSwitch()),this.isLive&&this._urlSwitching&&s&&(this._urlSwitching=!1,this.emit(E.SWITCH_URL_SUCCESS,{url:this.config.url})),this._playlist.moveSegmentPointer(),i.isLast?this._end():t||this._loadSegment()),e.abrupt("return",n);case 28:case"end":return e.stop()}},e,this,[[5,13,16,19]])})),function(e){return Rs.apply(this,arguments)})},{key:"_reqAndBufferSegment",value:(Os=A(D().mark(function e(t,i){var n,r,s,a,o,u,l,c,h;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=(t||i).cc,r=this._prevSegCc!==n,s=[],e.prev=3,e.next=6,this._segmentLoader.load(t,i,r);case 6:s=e.sent,e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(3),e.t0.fatal=!1,this._segmentLoader.error=e.t0,e.t0;case 14:if(s[0]){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,(u=this._bufferService).decryptBuffer.apply(u,m(s));case 18:if(a=e.sent){e.next=21;break}return e.abrupt("return");case 21:return o=(t||i).sn,u=(t||i).start,l=this._playlist.currentStream,this._bufferService.createSource(a[0],a[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),l=Date.now(),c=this._prevSegSn===o-1,this.isLive&&this._urlSwitching&&(h=this.bufferInfo().end,this._playlist.updateSegmentsRanges(o,h),j.warn("update the new playlist liveEdge, segment id=".concat(o,", buffer start=").concat(h,", liveEdge=").concat(this._playlist.liveEdge)),u=h),e.next=30,this._bufferService.appendBuffer(t,i,a[0],a[1],r,c,u);case 30:return this.emit(E.APPEND_COST,{elapsed:Date.now()-l,url:t.url}),e.next=33,this._bufferService.evictBuffer(this.config.bufferBehind);case 33:return this._prevSegCc=n,this._prevSegSn=o,e.abrupt("return",!0);case 36:case"end":return e.stop()}},e,this,[[3,9]])})),function(e,t){return Os.apply(this,arguments)})},{key:"_onCheckQuotaExceeded",value:(Is=A(D().mark(function e(){var t,i,n,r,s,a;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this.media.currentTime,i=this.media.buffered,n=!1,r=0;case 4:if(r<i.length){if(i.start(0)>=t&&t<i.end(r))return n=!0,e.abrupt("break",11);e.next=8}else e.next=11;break;case 8:r++,e.next=4;break;case 11:if(this._bufferService.isFull())if(s=n?this.config.bufferBehind:
15,0<(a=this.media.currentTime)-s)return e.next=17,this._bufferService.removeBuffer(0,a-s);e.next=17;break;case 17:case"end":return e.stop()}},e,this)})),function(){return Is.apply(this,arguments)})},{key:"_checkStreamTrackChange",value:function(e){e=this._playlist.checkSegmentTrackChange(e,this._bufferService.nbSb);e&&this.switchURL(this.config.url,e.start+.2)}},{key:"_clear",value:(Ps=A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._disconnectTimer),this._stopTick(),e.next=4,Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]);case 4:this._segmentProcessing=!1;case 5:case"end":return e.stop()}},e,this)})),function(){return Ps.apply(this,arguments)})},{key:"_reset",value:(Ls=A(D().mark(function e(){var t,i,n=arguments;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=0<n.length&&void 0!==n[0]&&n[0],this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),null!=(t=this._seiService)&&t.reset(),this._stats.reset(),e.next=11,this._clear();case 11:return e.abrupt("return",this._bufferService.reset(i));case 12:case"end":return e.stop()}},e,this)})),function(){return Ls.apply(this,arguments)})},{key:"_end",value:function(){this._clear(),this._bufferService.endOfStream(),(this.media.readyState<=2||1<this.media.buffered.length)&&this._startTick()}},{key:"_stopTick",value:function(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}},{key:"_startTick",value:function(){this._stopTick(),this._tickTimer=setTimeout(this._tick,this._tickInterval)}},{key:"_emitError",value:function(e){var t,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===(null==(t=e.originError)?void 0:t.fatal)?j.warn(e):(j.table(e),j.error(e),j.error(null==(t=this.media)?void 0:t.error),null!=(t=this.media)&&t.readyState&&this.media.pause(),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(E.SWITCH_URL_FAILED,e)),this.emit(E.ERROR,e),i&&this._end(),null!=(t=this._seiService)&&t.reset()),e}},{key:"_getSeamlessSwitchPoint",value:function(){var e,t=this.media,i=t.currentTime;return t.paused||(t=this._playlist.findSegmentIndexByTime(t.currentTime),t=this._playlist.getSegmentByIndex(t),i+=(e=null==(e=this._stats)?void 0:e.getStats().downloadSpeed)&&t?t.duration*this._playlist.currentStream.bitrate/e+1:5),i}},{key:"_tryEos",value:function(){var e=this.media,t=this._playlist,i=t.nextSegment,t=t.lastSegment;(!i||t&&u.isBuffered(e,t.start+t.duration/2))&&e.readyState&&0<e.duration&&null!=(i=this._bufferService)&&i.msIsOpened&&(null==(i=this._bufferService)||!i.msHasOpTasks)&&(i=this.bufferInfo(),e.paused&&!e.currentTime&&(i=this.bufferInfo(i.nextStart||.5)),Math.abs(i.end-e.duration)<.1||!this.isLive&&t&&i.end>=t.start+t.duration)&&this._bufferService.endOfStream()}}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:v.isSupported()}},{key:"enableLogger",value:function(){Ce.enable(),Xt.enable()}},{key:"disableLogger",value:function(){Ce.disable(),Xt.disable()}}]),$s);function $s(e){var a,t,i;return l(this,$s),s(o(a=qs.call(this)),"version",$s.version),s(o(a),"media",null),s(o(a),"config",null),s(o(a),"_manifestLoader",null),s(o(a),"_segmentLoader",null),s(o(a),"_playlist",null),s(o(a),"_bufferService",null),s(o(a),"_gapService",null),s(o(a),"_seiService",null),s(o(a),"_stats",null),s(o(a),"_prevSegSn",null),s(o(a),"_prevSegCc",null),s(o(a),"_tickTimer",null),s(o(a),"_tickInterval",500),s(o(a),"_segmentProcessing",!1),s(o(a),"_reloadOnPlay",!1),s(o(a),"_switchUrlOpts",null),s(o(a),"_isProcessQuotaExceeded",!1),s(o(a),"_loadSegment",A(D().mark(function e(){var t,i,n,r,s;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a._segmentProcessing||!a.media)return e.abrupt("return");e.next=2;break;case 2:if(n=a._playlist,t=n.nextSegment,n=n.lastSegment,i=o(a),i=i.
1config,n=Math.min(Math.max((null==n?void 0:n.duration)-.008||0,.016),.1),t){e.next=8;break}return e.abrupt("return");case 8:if(a.isLive)e.next=18;else{if(r=a.bufferInfo(),a.media.paused&&!a.media.currentTime&&(r=a.bufferInfo(r.nextStart||.5)),s=Math.abs(r.end-a.media.duration)<n,r.remaining>=i.preloadTime||s)return a._tryEos(),e.abrupt("return");e.next=15}break;case 15:if(i.preferMMSStreaming&&!a._bufferService.msStreaming)return e.abrupt("return");e.next=17;break;case 17:!a._urlSwitching&&a._prevSegSn!==t.sn-1&&r.end&&1<Math.abs(t.start-r.end)&&a._playlist.setNextSegmentByIndex(a._playlist.findSegmentIndexByTime(r.end+.1));case 18:return e.abrupt("return",a._loadSegmentDirect());case 19:case"end":return e.stop()}},e)}))),s(o(a),"_onLoadeddata",function(){a.isLive&&!a.config.mseLowLatency&&a.media.duration!==1/0&&a._bufferService.updateDuration(1/0).catch(function(e){})}),s(o(a),"_onPlay",A(D().mark(function e(){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a.media.seeking&&0===a.media.currentTime)return j.debug("replay currentTime 0, return"),e.abrupt("return");e.next=3;break;case 3:(clearTimeout(a._disconnectTimer),a._reloadOnPlay)?(a._reloadOnPlay=!1,a.replay(!0),e.next=12):e.next=9;break;case 9:return e.next=11,a._loadSegment();case 11:a._startTick();case 12:case"end":return e.stop()}},e)}))),s(o(a),"_onPause",function(){var e;a.isLive?a._reloadOnPlay||(null==(e=a.config.disconnectTime)&&(e=a._playlist.dvrWindow),Number.isFinite(e)&&(clearTimeout(a._disconnectTimer),a._disconnectTimer=setTimeout(function(){a._reloadOnPlay=!0,a._clear()},e||0))):a._stopTick()}),s(o(a),"_onSeeking",A(D().mark(function e(){var t,i,n,r,s;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a.media){e.next=2;break}return e.abrupt("return");case 2:if(a._onCheckQuotaExceeded(),t=a.media.currentTime,i=a._playlist.seekRange)if(0<=(i=As(t,i[0],a.isLive?i[1]:a.media.duration))&&.1<=Math.abs(t-i))return a.media.currentTime=i,e.abrupt("return");e.next=10;break;case 10:if(i=a._playlist.currentSegment,n=u.info(u.get(a.media),t,.1),i){if(n.end&&Math.abs(n.end-i.end)<.2)return e.abrupt("return");e.next=15}else e.next=17;break;case 15:if(a.isLive&&n.end)return e.abrupt("return");e.next=17;break;case 17:if(r=a._playlist.findSegmentIndexByTime(t),s=a._playlist.getSegmentByIndex(r),null==r||!s||a._segmentProcessing&&s===a._playlist.nextSegment)return e.abrupt("return");e.next=21;break;case 21:return j.debug("seek to",t,s),a._playlist.setNextSegmentByIndex(r),a._stopTick(),e.next=26,a._segmentLoader.cancel();case 26:if(a._segmentProcessing=!1,!n.end||a.isLive)return e.next=30,a._loadSegmentDirect(!0);e.next=30;break;case 30:a._startTick();case 31:case"end":return e.stop()}},e)}))),s(o(a),"_onTimeupdate",function(){if(a.media){var e=a.config;if(e.isLive&&e.maxLatency&&e.targetLatency){var t=a._playlist.liveEdge;if(!t)return;var i=t-a.media.currentTime;i>=e.maxLatency&&(j.debug("latency jump, currentTime:".concat(a.media.currentTime,", liveEdge:").concat(t,",  latency=").concat(i)),a.media.currentTime=t-e.targetLatency)}e.seiInTime&&null!=(i=a._seiService)&&i.throw(a.media.currentTime),e.allowedStreamTrackChange&&!e.softDecode&&a.media.readyState&&a._checkStreamTrackChange(a.media.currentTime)}}),s(o(a),"_tick",function(){var e,t;a.media&&(a._startTick(),e=a.media,t=a._segmentLoader.error,a._onCheckQuotaExceeded(),a._isProcessQuotaExceeded&&!a._bufferService.isFull()&&(a._isProcessQuotaExceeded=!1,a._segmentProcessing=!1),t?(!e.readyState||a.bufferInfo(.5).remaining<1)&&(t.fatal=!0,a._emitError(_.network(t))):(e.readyState&&(!e||e.paused||e.ended||0===e.playbackRate||0===e.readyState?e.readyState<2&&a._gapService&&a._gapService.do(e,a.config.maxJumpDistance,!e.currentTime||a.isLive):(a._loadSegment(),a._gapService&&a._gapService.do(e,a.config.maxJumpDistance,a.isLive))),a.isLive||a._tryEos()))}),a.config=(i=(null==(t=e)?void 0:t.media)||document.createElement("video"),e=p(p({maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,manifestLoadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,useLowLatency:!0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,seiInTime:!1,manifestList:[],minSegmentsStartPlay:3,preferMMS:!1,preferMMSStreaming:!1,mseLowLatency:!0,fixerConfig:{forceFixLargeGap:!1,largeGapThreshold:5}},t),{},{media:i})),a.media=a.config.media,a._manifestLoader=new Es(o(a)),a._segmentLoader=new Zs(o(a)),a._playlist=new Qs(o(a)),a._bufferService=new Kr(o(a)),e.seiInTime&&(a._seiService=new wt(o(a))),e.softDecode||(a._gapService=new xt),a._stats=new Ct(o(a),9e4),a.media.addEventListener("loadeddata",a._onLoadeddata),a.media.addEventListener("play",a._onPlay),a.media.addEventListener("pause",a._onPause),a.media.addEventListener("seeking",a._onSeeking),a.media.addEventListener("timeupdate",a._onTimeupdate),a}function ea(e){var o=this,e=(l(this,ea),s(this,"error",null),s(this,"_emitOnLoaded",function(e,t){var i=e.data,n=e.response,e=e.options||{},r=e.firstByteTime,s=e.startTime,a=e.contentLength,e=e.endTime-s;o._bandwidthService.addRecord(a||i.byteLength,e),o.hls.emit(L.SPEED,{time:e,byteLength:a,url:t}),o.hls.emit(L.LOAD_COMPLETE,{url:t,elapsed:e||0}),o.hls.emit(L.TTFB,{url:t,responseUrl:n.url,elapsed:r-s}),o.hls.emit(L.LOAD_RESPONSE_HEADERS,{headers:n.headers,url:t})}),s(this,"_onLoaderRetry",function(e,t){o.hls.emit(L.LOAD_RETRY,{error:_.network(e),retryTime:t})}),this.hls=e,this._bandwidthService=new Tt,this._mapCache={},this._keyCache={},this.hls.config),t=e.retryCount,i=e.retryDelay,n=e.loadTimeout,e=e.fetchOptions;this._segmentLoader=new St(p(p({},e),{},{responseType:"arraybuffer",retry:t,retryDelay:i,timeout:n,onRetryError:this._onLoaderRetry}
1)),this._audioSegmentLoader=new St(p(p({},e),{},{responseType:"arraybuffer",retry:t,retryDelay:i,timeout:n,onRetryError:this._onLoaderRetry})),this._keyLoader=new St(p(p({},e),{},{responseType:"arraybuffer",retry:t,retryDelay:i,timeout:n,onRetryError:this._onLoaderRetry}))}function ta(e){l(this,ta),s(this,"streams",[]),s(this,"currentStream",null),s(this,"dvrWindow",0),s(this,"_segmentPointer",-1),this.hls=e}function ia(e,t,i){l(this,ia),s(this,"live",void 0),s(this,"id",0),s(this,"bitrate",0),s(this,"width",0),s(this,"height",0),s(this,"name",""),s(this,"url",""),s(this,"audioCodec",""),s(this,"videoCodec",""),s(this,"textCodec",""),s(this,"startCC",0),s(this,"endCC",0),s(this,"startSN",0),s(this,"endSN",-1),s(this,"totalDuration",0),s(this,"targetDuration",0),s(this,"partTargetDuration",0),s(this,"canSkipUntil",0),s(this,"canSkipDateRanges",!1),s(this,"skippedSegments",0),s(this,"canBlockReload",!1),s(this,"partHoldBack",0),s(this,"lowLatency",!1),s(this,"endPartIndex",0),s(this,"snDiff",null),s(this,"segments",[]),s(this,"audioStreams",[]),s(this,"subtitleStreams",[]),s(this,"closedCaptions",[]),s(this,"currentAudioStream",null),s(this,"currentSubtitleStream",null),this.update(this._setLLPlaybackPoint(e),t,i)}s(Js,"version","3.0.21");try{localStorage.getItem("xgd")?Js.enableLogger():Js.disableLogger()}catch(e){}e(sa,[{key:"_init",value:function(){var e=this._opts,t=e.media,i=e.preloadTime,n=e.innerDegrade;t&&(e.isLive||!t.setPlayMode?(n&&t.setAttribute("innerdegrade",n),i&&t.setAttribute("preloadtime",i),this._bindEvents()):t.setPlayMode("VOD"))}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e;null!=(e=this._opts)&&null!=(e=e.media)&&e.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]);var na=sa,ra=["currentTime"];function sa(e,t){var r=this;l(this,sa),s(this,"_opts",null),s(this,"_plugin",null),s(this,"_onLowDecode",function(){var e,t=r._opts,i=t.media,t=t.innerDegrade;null!=(e=r._plugin)&&null!=(e=e.player)&&e.emit("lowdecode",i.degradeInfo),null!=(e=r._plugin)&&null!=(e=e.player)&&e.emit("core_event",p(p({},i.degradeInfo),{},{eventName:E.LOWDECODE})),1===t&&r._degrade(i.src)}),s(this,"_degrade",function(e){var t,i=r._plugin.player,n=i.video;n&&"MVideo"!==n.TAG||(t=i.video.degradeVideo,i.video=t,n.degrade(e),e&&(i.config.url=e),"MVideo"===(n=i.root.firstChild).TAG&&i.root.replaceChild(t,n),e=r._plugin.constructor.pluginName.toLowerCase(),i.unRegisterPlugin(e),i.once("canplay",function(){i.play()}))}),s(this,"forceDegradeToVideo",function(e){1===r._opts.innerDegrade&&r._degrade(e)}),this._opts=e,this._plugin=t,this._init()}t(oa,W.BasePlugin),aa=i(oa),e(oa,[{key:"core",get:function(){return this.hls}},{key:"version",get:function(){var e;return null==(e=this.hls)?void 0:e.version}},{key:"softDecode",get:function(){var e=null==(e=this.player)||null==(e=e.config)?void 0:e.mediaType;return!!e&&"video"!==e&&"audio"!==e&&"offscreen-video"!==e}},{key:"beforePlayerInit",value:function(){var e,o=this,t=this.player.config,i=this.player.media||this.player.video,n=t.hls||{};!t.url&&!t.__allowHlsEmptyUrl__||!this.softDecode&&!n.preferMMS&&v.isMMSOnly()||(this.hls&&this.hls.destroy(),(e=Object.getOwnPropertyDescriptor(this.player,"switchURL"))&&!e.writable||(this.player.switchURL=function(s,a){return new Promise(function(e,t){var i,n=o.player,r=o.hls;r?(i=(e=>{var t={startTime:o.player.currentTime};switch(Y(e)){case"boolean":t.seamless=e;break;case"object":var i=e.currentTime,n=ie(e,ra);Object.assign(t,n),"number"==typeof i&&(t.startTime=i)}return t})(a),n.config.url=s,r.switchURL(s,i).then(function(){return e(!0)}).catch(t),!i.seamless&&null!=(n=o.player.config)&&null!=(r=n.hls)&&r.keepStatusAfterSwitch&&o._keepPauseStatus()):t()})}),e=this.player.switchURL,this.player.handleSource=!1,n.innerDegrade=n.innerDegrade||t.innerDegrade,null==n.disconnectTime&&(n.disconnectTime=0),this.hls=new Js(p({softDecode:this.softDecode,isLive:t.isLive,media:i,startTime:t.startTime,url:t.url},n)),this.softDecode||W.BasePlugin.defineGetterOrSetter(this.player,{url:{get:function(){var e;return null==(e=o.hls)||null==(e=e.media)?void 0:e.src},configurable:!0}}),this.softDecode&&(this.pluginExtension=new na(p({isLive:t.isLive,media:i},n),this),this.player.forceDegradeToVideo=function(){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return null==(e=o.pluginExtension)?void 0:e.forceDegradeToVideo.apply(e,i)}),t.isLive&&null!=(i=this.player)&&i.useHooks("replay",function(){var e;return null==(e=o.hls)?void 0:e.replay()}
1),this.on(W.Events.URL_CHANGE,e),this.on(W.Events.SWITCH_SUBTITLE||"switch_subtitle",this._onSwitchSubtitle),this.on(W.Events.DESTROY,this.destroy.bind(this)),this._transError(),this._transCoreEvent(L.TTFB),this._transCoreEvent(L.LOAD_START),this._transCoreEvent(L.LOAD_RESPONSE_HEADERS),this._transCoreEvent(L.LOAD_COMPLETE),this._transCoreEvent(L.LOAD_RETRY),this._transCoreEvent(L.SOURCEBUFFER_CREATED),this._transCoreEvent(L.MEDIASOURCE_OPENED),this._transCoreEvent(L.APPEND_BUFFER),this._transCoreEvent(L.REMOVE_BUFFER),this._transCoreEvent(L.BUFFEREOS),this._transCoreEvent(L.KEYFRAME),this._transCoreEvent(L.METADATA_PARSED),this._transCoreEvent(L.DEMUXED_TRACK),this._transCoreEvent(L.SEI),this._transCoreEvent(L.SEI_IN_TIME),this._transCoreEvent(L.SPEED),this._transCoreEvent(L.HLS_MANIFEST_LOADED),this._transCoreEvent(L.HLS_LEVEL_LOADED),this._transCoreEvent(L.STREAM_EXCEPTION),this._transCoreEvent(L.SWITCH_URL_SUCCESS),this._transCoreEvent(L.SWITCH_URL_FAILED),this._transCoreEvent(E.NO_AUDIO_TRACK),this._transCoreEvent(E.STREAM_PARSED),this._transCoreEvent(E.SUBTITLE_SEGMENTS),this._transCoreEvent(E.SUBTITLE_PLAYLIST),this._transCoreEvent(E.APPEND_COST),t.url&&this.hls.load(t.url,{reuseMse:!0}).catch(function(e){}))}},{key:"destroy",value:function(){var e;this.hls&&(this.hls.destroy(),this.hls=null),null!=(e=this.pluginExtension)&&e.destroy(),this.pluginExtension=null}},{key:"_transError",value:function(){var t=this;this.hls.on(E.ERROR,function(e){t.player&&t.player.emit(W.Events.ERROR,new W.Errors(t.player,e))})}},{key:"_transCoreEvent",value:function(t){var i=this;this.hls.on(t,function(e){i.player&&(i.player.emit("core_event",p(p({},e),{},{eventName:t})),t===L.SEI_IN_TIME)&&i.hls.hasSubtitle&&i._emitSeiPaylodTime(e)})}},{key:"_emitSeiPaylodTime",value:function(e){try{var t=JSON.parse(Array.from(e.data.payload).map(function(e){return String.fromCharCode(e)}).join("").slice(0,-1));t.rtmp_dts&&this.player.emit("core_event",{eventName:E.SEI_PAYLOAD_TIME,time:t.rtmp_dts})}catch(e){}}}],[{key:"pluginName",get:function(){return"hls"}},{key:"isSupported",value:function(e,t){return Js.isSupported(e,t)}}]);var aa,Xn=oa;function oa(){var i;l(this,oa);for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s(o(i=aa.call.apply(aa,[this].concat(t))),"logger",j),s(o(i),"hls",null),s(o(i),"pluginExtension",null),s(o(i),"getStats",function(){var e;return null==(e=i.hls)?void 0:e.getStats()}),s(o(i),"_onSwitchSubtitle",function(e){var t,e=e.lang;null!=(t=i.hls)&&t.switchSubtitleStream(e)}),s(o(i),"_keepPauseStatus",function(){i.player.paused&&i.player.once("canplay",function(){i.player.pause()})}),i}return s(Xn,"Hls",Js),s(Xn,"EVENT",E),Xn});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.