vue-pure-admin/static/js/video-DyQLQ2tL.js

227 lines
281 KiB
JavaScript

import{a1 as Zi,k as Ji,e as ki,g as Ue,S as wt,d as Qi,m as en,X as tn,b as nn,w as Me,f as Ht,j as nt,u as Ut,h as Vt,_ as rn}from"./index-DI6gHrBb.js";import{u as sn}from"./hooks-CCgmh5KY.js";const an={viewBox:"0 0 1024 1024",width:"1em",height:"1em"};function on(o,a){return ki(),Ji("svg",an,a[0]||(a[0]=[Ue("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768a384 384 0 0 0 0 768m-48-247.616L668.608 512L464 375.616zm10.624-342.656l249.472 166.336a48 48 0 0 1 0 79.872L474.624 718.272A48 48 0 0 1 400 678.336V345.6a48 48 0 0 1 74.624-39.936z"},null,-1)]))}const un=Zi({name:"ep-video-play",render:on});function jt(o,a){var r=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);a&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})),r.push.apply(r,t)}return r}function U(o){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?jt(Object(r),!0).forEach(function(t){y(o,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(r,t))})}return o}function z(o){"@babel/helpers - typeof";return z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},z(o)}function E(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")}function Wt(o,a){for(var r=0;r<a.length;r++){var t=a[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(o,Ti(t.key),t)}}function S(o,a,r){return a&&Wt(o.prototype,a),r&&Wt(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}function y(o,a,r){return a=Ti(a),a in o?Object.defineProperty(o,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[a]=r,o}function w(o,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(a&&a.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),a&&Ct(o,a)}function P(o){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},P(o)}function Ct(o,a){return Ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ct(o,a)}function ln(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(o){return!1}}function v(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function xt(o,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return v(o)}function x(o){var a=ln();return function(){var t=P(o),e;if(a){var i=P(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return xt(this,e)}}function cn(o,a){for(;!Object.prototype.hasOwnProperty.call(o,a)&&(o=P(o),o!==null););return o}function I(){return typeof Reflect!="undefined"&&Reflect.get?I=Reflect.get.bind():I=function(a,r,t){var e=cn(a,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?a:t):i.value}},I.apply(this,arguments)}function Q(o){return fn(o)||hn(o)||dn(o)||gn()}function fn(o){if(Array.isArray(o))return kt(o)}function hn(o){if(typeof Symbol!="undefined"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)}function dn(o,a){if(o){if(typeof o=="string")return kt(o,a);var r=Object.prototype.toString.call(o).slice(8,-1);if(r==="Object"&&o.constructor&&(r=o.constructor.name),r==="Map"||r==="Set")return Array.from(o);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kt(o,a)}}function kt(o,a){(a==null||a>o.length)&&(a=o.length);for(var r=0,t=new Array(a);r<a;r++)t[r]=o[r];return t}function gn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pn(o,a){if(typeof o!="object"||o===null)return o;var r=o[Symbol.toPrimitive];if(r!==void 0){var t=r.call(o,a);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(o)}function Ti(o){var a=pn(o,"string");return typeof a=="symbol"?a:String(a)}var rt={exports:{}},Gt;function vn(){return Gt||(Gt=1,function(o){var a=Object.prototype.hasOwnProperty,r="~";function t(){}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(r=!1));function e(u,l,f){this.fn=u,this.context=l,this.once=f||!1}function i(u,l,f,h,d){if(typeof f!="function")throw new TypeError("The listener must be a function");var g=new e(f,h||u,d),p=r?r+l:l;return u._events[p]?u._events[p].fn?u._events[p]=[u._events[p],g]:u._events[p].push(g):(u._events[p]=g,u._eventsCount++),u}function n(u,l){--u._eventsCount===0?u._events=new t:delete u._events[l]}function s(){this._events=new t,this._eventsCount=0}s.prototype.eventNames=function(){var l=[],f,h;if(this._eventsCount===0)return l;for(h in f=this._events)a.call(f,h)&&l.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(f)):l},s.prototype.listeners=function(l){var f=r?r+l:l,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,g=h.length,p=new Array(g);d<g;d++)p[d]=h[d].fn;return p},s.prototype.listenerCount=function(l){var f=r?r+l:l,h=this._events[f];return h?h.fn?1:h.length:0},s.prototype.emit=function(l,f,h,d,g,p){var m=r?r+l:l;if(!this._events[m])return!1;var _=this._events[m],b=arguments.length,T,k;if(_.fn){switch(_.once&&this.removeListener(l,_.fn,void 0,!0),b){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,f),!0;case 3:return _.fn.call(_.context,f,h),!0;case 4:return _.fn.call(_.context,f,h,d),!0;case 5:return _.fn.call(_.context,f,h,d,g),!0;case 6:return _.fn.call(_.context,f,h,d,g,p),!0}for(k=1,T=new Array(b-1);k<b;k++)T[k-1]=arguments[k];_.fn.apply(_.context,T)}else{var D=_.length,A;for(k=0;k<D;k++)switch(_[k].once&&this.removeListener(l,_[k].fn,void 0,!0),b){case 1:_[k].fn.call(_[k].context);break;case 2:_[k].fn.call(_[k].context,f);break;case 3:_[k].fn.call(_[k].context,f,h);break;case 4:_[k].fn.call(_[k].context,f,h,d);break;default:if(!T)for(A=1,T=new Array(b-1);A<b;A++)T[A-1]=arguments[A];_[k].fn.apply(_[k].context,T)}}return!0},s.prototype.on=function(l,f,h){return i(this,l,f,h,!1)},s.prototype.once=function(l,f,h){return i(this,l,f,h,!0)},s.prototype.removeListener=function(l,f,h,d){var g=r?r+l:l;if(!this._events[g])return this;if(!f)return n(this,g),this;var p=this._events[g];if(p.fn)p.fn===f&&(!d||p.once)&&(!h||p.context===h)&&n(this,g);else{for(var m=0,_=[],b=p.length;m<b;m++)(p[m].fn!==f||d&&!p[m].once||h&&p[m].context!==h)&&_.push(p[m]);_.length?this._events[g]=_.length===1?_[0]:_:n(this,g)}return this},s.prototype.removeAllListeners=function(l){var f;return l?(f=r?r+l:l,this._events[f]&&n(this,f)):(this._events=new t,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,o.exports=s}(rt)),rt.exports}var bi=vn();const Ei=wt(bi);var mn=typeof window!="undefined"&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,st={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},at="%c[xgplayer]",O={config:{debug:mn?3:0},logInfo:function(a){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];this.config.debug>=3&&(r=console).log.apply(r,[at,st.info,a].concat(e))},logWarn:function(a){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];this.config.debug>=1&&(r=console).warn.apply(r,[at,st.warn,a].concat(e))},logError:function(a){var r;if(!(this.config.debug<1)){for(var t=this.config.debug>=2?"trace":"error",e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];(r=console)[t].apply(r,[at,st.error,a].concat(i))}}};function yn(o){o.logInfo=O.logInfo.bind(o),o.logWarn=O.logWarn.bind(o),o.logError=O.logError.bind(o)}var _n=function(){function o(a){E(this,o),this.bufferedList=a}return S(o,[{key:"start",value:function(r){return this.bufferedList[r].start}},{key:"end",value:function(r){return this.bufferedList[r].end}},{key:"length",get:function(){return this.bufferedList.length}}]),o}(),c={};c.createDom=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"div",a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",e=document.createElement(o);return e.className=t,e.innerHTML=a,Object.keys(r).forEach(function(i){var n=i,s=r[i];o==="video"||o==="audio"||o==="live-video"?s&&e.setAttribute(n,s):e.setAttribute(n,s)}),e};c.createDomFromHtml=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";try{var t=document.createElement("div");t.innerHTML=o;var e=t.children;return t=null,e.length>0?(e=e[0],r&&c.addClass(e,r),a&&Object.keys(a).forEach(function(i){e.setAttribute(i,a[i])}),e):null}catch(i){return O.logError("util.createDomFromHtml",i),null}};c.hasClass=function(o,a){if(!o||!a)return!1;try{return Array.prototype.some.call(o.classList,function(t){return t===a})}catch(t){var r=o.className&&z(o.className)==="object"?o.getAttribute("class"):o.className;return r&&!!r.match(new RegExp("(\\s|^)"+a+"(\\s|$)"))}};c.addClass=function(o,a){if(!(!o||!a))try{a.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&o.classList.add(r)})}catch(r){c.hasClass(o,a)||(o.className&&z(o.className)==="object"?o.setAttribute("class",o.getAttribute("class")+" "+a):o.className+=" "+a)}};c.removeClass=function(o,a){if(!(!o||!a))try{a.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&o.classList.remove(r)})}catch(r){c.hasClass(o,a)&&a.split(/\s+/g).forEach(function(t){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");o.className&&z(o.className)==="object"?o.setAttribute("class",o.getAttribute("class").replace(e," ")):o.className=o.className.replace(e," ")})}};c.toggleClass=function(o,a){o&&a.split(/\s+/g).forEach(function(r){c.hasClass(o,r)?c.removeClass(o,r):c.addClass(o,r)})};c.classNames=function(){for(var o=arguments,a=[],r=function(i){c.typeOf(o[i])==="String"?a.push(o[i]):c.typeOf(o[i])==="Object"&&Object.keys(o[i]).map(function(n){o[i][n]&&a.push(n)})},t=0;t<arguments.length;t++)r(t);return a.join(" ")};c.findDom=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,a=arguments.length>1?arguments[1]:void 0,r;try{r=o.querySelector(a)}catch(t){O.logError("util.findDom",t),a.indexOf("#")===0&&(r=o.getElementById(a.slice(1)))}return r};c.getCss=function(o,a){return o.currentStyle?o.currentStyle[a]:document.defaultView.getComputedStyle(o,!1)[a]};c.padStart=function(o,a,r){for(var t=String(r),e=a>>0,i=Math.ceil(e/t.length),n=[],s=String(o);i--;)n.push(t);return n.join("").substring(0,e-s.length)+s};c.format=function(o){if(window.isNaN(o))return"";o=Math.round(o);var a=c.padStart(Math.floor(o/3600),2,0),r=c.padStart(Math.floor((o-a*3600)/60),2,0),t=c.padStart(Math.floor(o-a*3600-r*60),2,0);return(a==="00"?[r,t]:[a,r,t]).join(":")};c.event=function(o){if(o.touches){var a=o.touches[0]||o.changedTouches[0];o.clientX=a.clientX||0,o.clientY=a.clientY||0,o.offsetX=a.pageX-a.target.offsetLeft,o.offsetY=a.pageY-a.target.offsetTop}o._target=o.target||o.srcElement};c.typeOf=function(o){return Object.prototype.toString.call(o).match(/([^\s.*]+)(?=]$)/g)[0]};c.deepCopy=function(o,a){if(c.typeOf(a)==="Object"&&c.typeOf(o)==="Object")return Object.keys(a).forEach(function(r){c.typeOf(a[r])==="Object"&&!(a[r]instanceof Node)?o[r]===void 0||o[r]===void 0?o[r]=a[r]:c.deepCopy(o[r],a[r]):c.typeOf(a[r])==="Array"?o[r]=c.typeOf(o[r])==="Array"?o[r].concat(a[r]):a[r]:o[r]=a[r]}),o};c.deepMerge=function(o,a){return Object.keys(a).map(function(r){if(c.typeOf(a[r])==="Array"&&c.typeOf(o[r])==="Array"){if(c.typeOf(o[r])==="Array"){var t;(t=o[r]).push.apply(t,Q(a[r]))}}else c.typeOf(o[r])===c.typeOf(a[r])&&o[r]!==null&&c.typeOf(o[r])==="Object"&&!(a[r]instanceof window.Node)?c.deepMerge(o[r],a[r]):a[r]!==null&&(o[r]=a[r])}),o};c.getBgImage=function(o){var a=(o.currentStyle||window.getComputedStyle(o,null)).backgroundImage;if(!a||a==="none")return"";var r=document.createElement("a");return r.href=a.replace(/url\("|"\)/g,""),r.href};c.copyDom=function(o){if(o&&o.nodeType===1){var a=document.createElement(o.tagName);return Array.prototype.forEach.call(o.attributes,function(r){a.setAttribute(r.name,r.value)}),o.innerHTML&&(a.innerHTML=o.innerHTML),a}else return""};c.setInterval=function(o,a,r,t){o._interval[a]||(o._interval[a]=window.setInterval(r.bind(o),t))};c.clearInterval=function(o,a){clearInterval(o._interval[a]),o._interval[a]=null};c.setTimeout=function(o,a,r){o._timers||(o._timers=[]);var t=setTimeout(function(){a(),c.clearTimeout(o,t)},r);return o._timers.push(t),t};c.clearTimeout=function(o,a){var r=o._timers;if(c.typeOf(r)==="Array"){for(var t=0;t<r.length;t++)if(r[t]===a){r.splice(t,1),clearTimeout(a);break}}else clearTimeout(a)};c.clearAllTimers=function(o){var a=o._timers;c.typeOf(a)==="Array"&&(a.map(function(r){clearTimeout(r)}),o._timerIds=[])};c.createImgBtn=function(o,a,r,t){var e=c.createDom("xg-".concat(o),"",{},"xgplayer-".concat(o,"-img"));if(e.style.backgroundImage='url("'.concat(a,'")'),r&&t){var i,n,s;["px","rem","em","pt","dp","vw","vh","vm","%"].every(function(u){return r.indexOf(u)>-1&&t.indexOf(u)>-1?(i=parseFloat(r.slice(0,r.indexOf(u)).trim()),n=parseFloat(t.slice(0,t.indexOf(u)).trim()),s=u,!1):!0}),e.style.width="".concat(i).concat(s),e.style.height="".concat(n).concat(s),e.style.backgroundSize="".concat(i).concat(s," ").concat(n).concat(s),o==="start"?e.style.margin="-".concat(n/2).concat(s," auto auto -").concat(i/2).concat(s):e.style.margin="auto 5px auto 5px"}return e};c.Hex2RGBA=function(o,a){var r=[];if(/^\#[0-9A-F]{3}$/i.test(o)){var t="#";o.replace(/[0-9A-F]/ig,function(e){t+=e+e}),o=t}return/^#[0-9A-F]{6}$/i.test(o)?(o.replace(/[0-9A-F]{2}/ig,function(e){r.push(parseInt(e,16))}),"rgba(".concat(r.join(","),", ").concat(a,")")):"rgba(255, 255, 255, 0.1)"};c.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement};c.checkIsFunction=function(o){return o&&typeof o=="function"};c.checkIsObject=function(o){return o!==null&&z(o)==="object"};c.hide=function(o){o.style.display="none"};c.show=function(o,a){o.style.display=a||"block"};c.isUndefined=function(o){if(typeof o=="undefined"||o===null)return!0};c.isNotNull=function(o){return o!=null};c.setStyleFromCsstext=function(o,a){if(a)if(c.typeOf(a)==="String"){var r=a.replace(/\s+/g,"").split(";");r.map(function(t){if(t){var e=t.split(":");e.length>1&&(o.style[e[0]]=e[1])}})}else Object.keys(a).map(function(t){o.style[t]=a[t]})};function Cn(o,a){for(var r=0,t=a.length;r<t;r++)if(o.indexOf(a[r])>-1)return!0;return!1}c.filterStyleFromText=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],r=o.style.cssText;if(!r)return{};var t=r.replace(/\s+/g,"").split(";"),e={},i={};return t.map(function(n){if(n){var s=n.split(":");s.length>1&&(Cn(s[0],a)?e[s[0]]=s[1]:i[s[0]]=s[1])}}),o.setAttribute("style",""),Object.keys(i).map(function(n){o.style[n]=i[n]}),e};c.getStyleFromCsstext=function(o){var a=o.style.cssText;if(!a)return{};var r=a.replace(/\s+/g,"").split(";"),t={};return r.map(function(e){if(e){var i=e.split(":");i.length>1&&(t[i[0]]=i[1])}}),t};c.preloadImg=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(o){var t=new window.Image;t.onload=function(e){t=null,a&&a(e)},t.onerror=function(e){t=null,r&&r(e)},t.src=o}};c.stopPropagation=function(o){o&&o.stopPropagation()};c.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0};c.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0};c.checkTouchSupport=function(){return"ontouchstart"in window};c.getBuffered2=function(o){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.5,r=[],t=0;t<o.length;t++)r.push({start:o.start(t)<.5?0:o.start(t),end:o.end(t)});r.sort(function(u,l){var f=u.start-l.start;return f||l.end-u.end});var e=[];if(a)for(var i=0;i<r.length;i++){var n=e.length;if(n){var s=e[n-1].end;r[i].start-s<a?r[i].end>s&&(e[n-1].end=r[i].end):e.push(r[i])}else e.push(r[i])}else e=r;return new _n(e)};c.getEventPos=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return o.touches&&o.touches.length>0&&(o=o.touches[0]),{x:o.x/a,y:o.y/a,clientX:o.clientX/a,clientY:o.clientY/a,offsetX:o.offsetX/a,offsetY:o.offsetY/a,pageX:o.pageX/a,pageY:o.pageY/a}};c.requestAnimationFrame=function(o){var a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(a)return a(o)};c.getHostFromUrl=function(o){if(c.typeOf(o)!=="String")return"";var a=o.split("/"),r="";return a.length>3&&a[2]&&(r=a[2]),r};c.cancelAnimationFrame=function(o){var a=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;a&&a(o)};c.isMSE=function(o){return o.media&&(o=o.media),!o||!(o instanceof HTMLMediaElement)?!1:/^blob/.test(o.currentSrc)||/^blob/.test(o.src)};c.isBlob=function(o){return typeof o=="string"&&/^blob/.test(o)};c.generateSessionId=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=new Date().getTime();try{o=parseInt(o)}catch(t){o=0}a+=o,window.performance&&typeof window.performance.now=="function"&&(a+=parseInt(window.performance.now()));var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(a+Math.random()*16)%16|0;return a=Math.floor(a/16),(t==="x"?e:e&3|8).toString(16)});return r};c.createEvent=function(o){var a;return typeof window.Event=="function"?a=new Event(o):(a=document.createEvent("Event"),a.initEvent(o,!0,!0)),a};c.adjustTimeByDuration=function(o,a,r){return!a||!o?o:o>a||r&&o<a?a:o};c.createPositionBar=function(o,a){var r=c.createDom("xg-bar","",{"data-index":-1},o);return a.appendChild(r),r};c.getTransformStyle=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{x:0,y:0,scale:1,rotate:0},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={scale:"".concat(o.scale||1),translate:"".concat(o.x||0,"%, ").concat(o.y||0,"%"),rotate:"".concat(o.rotate||0,"deg")},t=Object.keys(r);return t.forEach(function(e){var i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),n="".concat(e,"(").concat(r[e],")");i.test(a)?(i.lastIndex=-1,a=a.replace(i,n)):a+="".concat(n," ")}),a};c.convertDeg=function(o){return Math.abs(o)<=1?o*360:o%360};c.getIndexByTime=function(o,a){var r=a.length,t=-1;if(r<1)return t;if(o<=a[0].end||r<2)t=0;else if(o>a[r-1].end)t=r-1;else for(var e=1;e<r;e++)if(o>a[e-1].end&&o<=a[e].end){t=e;break}return t};c.getOffsetCurrentTime=function(o,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,t=-1;if(r>=0&&r<a.length?t=r:t=c.getIndexByTime(o,a),t<0)return-1;var e=a.length,i=a[t],n=i.start,s=i.end,u=i.cTime,l=i.offset;return o<n?u:o>=n&&o<=s?o-l:o>s&&t>=e-1?s:-1};c.getCurrentTimeByOffset=function(o,a){var r=-1;if(!a||a.length<0)return o;for(var t=0;t<a.length;t++)if(o<=a[t].duration){r=t;break}if(r!==-1){var e=a[r].start;return r-1<0?e+o:e+(o-a[r-1].duration)}return o};function Si(o){var a=z(o);return o!==null&&(a==="object"||a==="function")}function kn(o,a,r){var t,e,i,n,s,u,l=0,f=!1,h=!1,d=!0,g=!a&&a!==0&&typeof window.requestAnimationFrame=="function";if(typeof o!="function")throw new TypeError("Expected a function");a=+a||0,Si(r)&&(f=!!r.leading,h="maxWait"in r,i=h?Math.max(+r.maxWait||0,a):i,d="trailing"in r?!!r.trailing:d);function p(R){var Y=t,Z=e;return t=e=void 0,l=R,n=o.apply(Z,Y),n}function m(R,Y){return g?(window.cancelAnimationFrame(s),window.requestAnimationFrame(R)):setTimeout(R,Y)}function _(R){if(g)return window.cancelAnimationFrame(R);clearTimeout(R)}function b(R){return l=R,s=m(D,a),f?p(R):n}function T(R){var Y=R-u,Z=R-l,J=a-Y;return h?Math.min(J,i-Z):J}function k(R){var Y=R-u,Z=R-l;return u===void 0||Y>=a||Y<0||h&&Z>=i}function D(){var R=Date.now();if(k(R))return A(R);s=m(D,T(R))}function A(R){return s=void 0,d&&t?p(R):(t=e=void 0,n)}function B(){s!==void 0&&_(s),l=0,t=u=e=s=void 0}function M(){return s===void 0?n:A(Date.now())}function j(){return s!==void 0}function V(){for(var R=Date.now(),Y=k(R),Z=arguments.length,J=new Array(Z),ve=0;ve<Z;ve++)J[ve]=arguments[ve];if(t=J,e=this,u=R,Y){if(s===void 0)return b(u);if(h)return s=m(D,a),p(u)}return s===void 0&&(s=m(D,a)),n}return V.cancel=B,V.flush=M,V.pending=j,V}function Tn(o,a,r){var t=!0,e=!0;if(typeof o!="function")throw new TypeError("Expected a function");return Si(r)&&(t="leading"in r?!!r.leading:t,e="trailing"in r?!!r.trailing:e),kn(o,a,{leading:t,trailing:e,maxWait:a})}function bn(){var o=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return o==="zh-cn"&&(o="zh"),o}function En(o,a,r){if(o){var t=o.getAttribute(r);return!!(t&&t===a&&(o.tagName==="VIDEO"||o.tagName==="AUDIO"))}}var zt={android:/(Android)\s([\d.]+)/,ios:/(Version)\/([\d.]+)/},Sn=["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","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],L={get device(){var o=L.os;return o.isPc?"pc":"mobile"},get browser(){if(typeof navigator=="undefined")return"";var o=navigator.userAgent.toLowerCase(),a={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(a).filter(function(r){return a[r].test(o)}))[0]},get os(){if(typeof navigator=="undefined")return{};var o=navigator.userAgent,a=/(?:Windows Phone)/.test(o),r=/(?:SymbianOS)/.test(o)||a,t=/(?:Android)/.test(o),e=/(?:Firefox)/.test(o),i=/(?:iPad|PlayBook)/.test(o)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,n=i||t&&!/(?:Mobile)/.test(o)||e&&/(?:Tablet)/.test(o),s=/(?:iPhone)/.test(o)&&!n,u=!s&&!t&&!r&&!n;return{isTablet:n,isPhone:s,isIpad:i,isIos:s||i,isAndroid:t,isPc:u,isSymbian:r,isWindowsPhone:a,isFireFox:e}},get osVersion(){if(typeof navigator=="undefined")return 0;var o=navigator.userAgent,a="";/(?:iPhone)|(?:iPad|PlayBook)/.test(o)?a=zt.ios:a=zt.android;var r=a?a.exec(o):[];if(r&&r.length>=3){var t=r[2].split(".");return t.length>0?parseInt(t[0]):0}return 0},get isWeixin(){if(typeof navigator=="undefined")return!1;var o=/(micromessenger)\/([\d.]+)/,a=o.exec(navigator.userAgent.toLocaleLowerCase());return!!a},isSupportMP4:function(){var a={isSupport:!1,mime:""};if(typeof document=="undefined")return a;if(this.supportResult)return this.supportResult;var r=document.createElement("video");return typeof r.canPlayType=="function"&&Sn.map(function(t){r.canPlayType('video/mp4; codecs="'.concat(t,'"'))==="probably"&&(a.isSupport=!0,a.mime+="||".concat(t))}),this.supportResult=a,r=null,a},isMSESupport:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(typeof MediaSource=="undefined"||!MediaSource)return!1;try{return MediaSource.isTypeSupported(a)}catch(r){return this._logger.error(a,r),!1}},isHevcSupported:function(){return typeof MediaSource=="undefined"||!MediaSource.isTypeSupported?!1: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(a){var r={supported:!1,smooth:!1,powerEfficient:!1};if(!a||typeof navigator=="undefined")return Promise.resolve(r);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(a);var t=a.video||{},e=a.audio||{};try{var i=MediaSource.isTypeSupported(t.contentType),n=MediaSource.isTypeSupported(e.contentType);return Promise.resolve({supported:i&&n,smooth:!1,powerEfficient:!1})}catch(s){return Promise.resolve(r)}}},Tt="3.0.21",Kt={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},Yt={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},je=S(function o(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};E(this,o);var t=a&&a.i18n?a.i18n.ERROR_TYPES:null;if(a.media){var e=r.mediaError?r.mediaError:a.media.error||{},i=a.duration,n=a.currentTime,s=a.ended,u=a.src,l=a.currentSrc,f=a.media,h=f.readyState,d=f.networkState,g=r.errorCode||e.code;Yt[g]&&(g=Yt[g]);var p={playerVersion:Tt,currentTime:n,duration:i,ended:s,readyState:h,networkState:d,src:u||l,errorType:r.errorType,errorCode:g,message:r.errorMessage||e.message,mediaError:e,originError:r.originError?r.originError.stack:"",host:c.getHostFromUrl(u||l)};return r.ext&&Object.keys(r.ext).map(function(T){p[T]=r.ext[T]}),p}else if(arguments.length>1){for(var m={playerVersion:Tt,domain:document.domain},_=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],b=0;b<arguments.length;b++)m[_[b]]=arguments[b];return m.ex=t?(t[arguments[0]]||{}).msg:"",m}}),q="play",Pt="playing",_e="ended",Ie="pause",Re="error",Je="seeking",ae="seeked",$="timeupdate",Oe="waiting",se="canplay",wn="canplaythrough",ue="durationchange",wi="volumechange",oe="loadeddata",xn="loadedmetadata",xi="ratechange",Pi="progress",It="loadstart",Ce="emptied",Pn="stalled",In="suspend",An="abort",Ln="bufferedChange",At="focus",Ii="blur",Lt="ready",Ai="urlNull",ye="autoplay_started",Dt="autoplay_was_prevented",Qe="complete",We="replay",Rt="destroy",et="urlchange",bt="download_speed_change",Li="leaveplayer",Di="enterplayer",Ri="loading",re="fullscreen_change",Ge="cssFullscreen_change",ze="mini_state_change",Ot="definition_change",Dn="before_definition_change",Et="after_definition_change",Rn="SEI_PARSED",On="retry",de="video_resize",St="pip_change",Oi="rotate",Mi="screenShot",Ke="playnext",Ni="shortcut",Fi="xglog",Ye="user_action",tt="reset",Bi="source_error",Hi="source_success",Mn="switch_subtitle",Ui=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],Vi={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},ji="fps_stuck";const Nn=Object.freeze(Object.defineProperty({__proto__:null,ABORT:An,AFTER_DEFINITION_CHANGE:Et,AUTOPLAY_PREVENTED:Dt,AUTOPLAY_STARTED:ye,BEFORE_DEFINITION_CHANGE:Dn,BUFFER_CHANGE:Ln,CANPLAY:se,CANPLAY_THROUGH:wn,COMPLETE:Qe,CSS_FULLSCREEN_CHANGE:Ge,DEFINITION_CHANGE:Ot,DESTROY:Rt,DOWNLOAD_SPEED_CHANGE:bt,DURATION_CHANGE:ue,EMPTIED:Ce,ENDED:_e,ENTER_PLAYER:Di,ERROR:Re,FPS_STUCK:ji,FULLSCREEN_CHANGE:re,LEAVE_PLAYER:Li,LOADED_DATA:oe,LOADED_METADATA:xn,LOADING:Ri,LOAD_START:It,MINI_STATE_CHANGE:ze,PAUSE:Ie,PIP_CHANGE:St,PLAY:q,PLAYER_BLUR:Ii,PLAYER_FOCUS:At,PLAYING:Pt,PLAYNEXT:Ke,PROGRESS:Pi,RATE_CHANGE:xi,READY:Lt,REPLAY:We,RESET:tt,RETRY:On,ROTATE:Oi,SCREEN_SHOT:Mi,SEEKED:ae,SEEKING:Je,SEI_PARSED:Rn,SHORTCUT:Ni,SOURCE_ERROR:Bi,SOURCE_SUCCESS:Hi,STALLED:Pn,STATS_EVENTS:Vi,SUSPEND:In,SWITCH_SUBTITLE:Mn,TIME_UPDATE:$,URL_CHANGE:et,URL_NULL:Ai,USER_ACTION:Ye,VIDEO_EVENTS:Ui,VIDEO_RESIZE:de,VOLUME_CHANGE:wi,WAITING:Oe,XGLOG:Fi},Symbol.toStringTag,{value:"Module"}));function ot(o,a){!this||!this.emit||(o==="error"?this.errorHandler(o,a.error):this.emit(o,a))}function Fn(o,a){return function(r,t){var e={player:a,eventName:o,originalEvent:r,detail:r.detail||{},timeStamp:r.timeStamp,currentTime:a.currentTime,duration:a.duration,paused:a.paused,ended:a.ended,isInternalOp:!!a._internalOp[r.type],muted:a.muted,volume:a.volume,host:c.getHostFromUrl(a.currentSrc),vtype:a.vtype};if(a.removeInnerOP(r.type),o==="timeupdate"&&(a._currentTime=a.media&&a.media.currentTime),o==="ratechange"){var i=a.media?a.media.playbackRate:0;if(i&&a._rate===i)return;a._rate=a.media&&a.media.playbackRate}if(o==="durationchange"&&(a._duration=a.media.duration),o==="volumechange"&&(e.isMutedChange=a._lastMuted!==a.muted,a._lastMuted=a.muted),o==="error"&&(e.error=t||a.video.error),a.mediaEventMiddleware[o]){var n=ot.bind(a,o,e);try{a.mediaEventMiddleware[o].call(a,e,n)}catch(s){throw ot.call(a,o,e),s}}else ot.call(a,o,e)}}var Bn=function(o){w(r,o);var a=x(r);function r(t){var e;E(this,r),e=a.call(this,t),e._hasStart=!1,e._currentTime=0,e._duration=0,e._internalOp={},e._lastMuted=!1,e.vtype="MP4",e._rate=-1,e.mediaConfig=Object.assign({},{controls:!1,autoplay:t.autoplay,playsinline:t.playsinline,"x5-playsinline":t.playsinline,"webkit-playsinline":t.playsinline,"x5-video-player-fullscreen":t["x5-video-player-fullscreen"]||t.x5VideoPlayerFullscreen,"x5-video-orientation":t["x5-video-orientation"]||t.x5VideoOrientation,airplay:t.airplay,"webkit-airplay":t.airplay,tabindex:t.tabindex|0,mediaType:t.mediaType||"video","data-index":-1},t.videoConfig,t.videoAttributes);var i=t["x5-video-player-type"]||t.x5VideoPlayerType;return L.isWeixin&&L.os.isAndroid&&i&&(e.mediaConfig["x5-video-player-type"]=i,delete e.mediaConfig.playsinline,delete e.mediaConfig["webkit-playsinline"],delete e.mediaConfig["x5-playsinline"]),t.loop&&(e.mediaConfig.loop="loop"),t.autoplayMuted&&!Object.prototype.hasOwnProperty.call(e.mediaConfig,"muted")&&(e.mediaConfig.muted=!0),e.media=t.mediaEl instanceof HTMLMediaElement?t.mediaEl:typeof t.mediaEl=="function"?t.mediaEl(e.mediaConfig):c.createDom(e.mediaConfig.mediaType,"",e.mediaConfig,""),t.defaultPlaybackRate&&(e.media.defaultPlaybackRate=e.media.playbackRate=t.defaultPlaybackRate),c.typeOf(t.volume)==="Number"&&(e.volume=t.volume),t.autoplayMuted&&(e.media.muted=!0,e._lastMuted=!0),t.autoplay&&(e.media.autoplay=!0),t.playsinline&&(e.media.playsinline=!0),e._interval={},e.mediaEventMiddleware={},e.attachVideoEvents(),e}return S(r,[{key:"setEventsMiddleware",value:function(e){var i=this;Object.keys(e).map(function(n){i.mediaEventMiddleware[n]=e[n]})}},{key:"removeEventsMiddleware",value:function(e){var i=this;Object.keys(e).map(function(n){delete i.mediaEventMiddleware[n]})}},{key:"attachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers||(this._evHandlers=Ui.map(function(n){var s="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1));return typeof e[s]=="function"&&e.on(n,e[s]),y({},n,Fn(n,e))})),this._evHandlers.forEach(function(n){var s=Object.keys(n)[0];i.addEventListener(s,n[s],!1)})}},{key:"detachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers.forEach(function(n){var s=Object.keys(n)[0];i.removeEventListener(s,n[s],!1)}),this._evHandlers.forEach(function(n){var s=Object.keys(n)[0],u="on".concat(s.charAt(0).toUpperCase()).concat(s.slice(1));typeof e[u]=="function"&&e.off(s,e[u])}),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,i){var n=this;e.removeAttribute("src"),e.load(),i.forEach(function(h,d){n.media.appendChild(c.createDom("source","",{src:"".concat(h.src),type:"".concat(h.type||""),"data-index":d+1}))});var s=e.children;if(s){this._videoSourceCount=s.length,this._videoSourceIndex=s.length,this._vLoadeddata=function(h){n.emit(Hi,{src:h.target.currentSrc,host:c.getHostFromUrl(h.target.currentSrc)})};for(var u=null,l=0;l<this._evHandlers.length;l++)if(Object.keys(this._evHandlers[l])[0]==="error"){u=this._evHandlers[l];break}!this._sourceError&&(this._sourceError=function(h){var d=parseInt(h.target.getAttribute("data-index"),10);if(n._videoSourceIndex--,n._videoSourceIndex===0||d>=n._videoSourceCount){var g={code:4,message:"sources_load_error"};u?u.error(h,g):n.errorHandler("error",g)}var p=Kt[4];n.emit(Bi,new je(n,{errorType:p,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:h.target.src}))});for(var f=0;f<s.length;f++)s[f].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var i=e.children;if(!(!i||i.length===0||!this._sourceError)){for(var n=0;n<i.length;n++)i[n].removeEventListener("error",this._sourceError);for(;i.length>0;)e.removeChild(i[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.media&&(this.media.error||i)){var n=this.media.error||i,s=n.code?Kt[n.code]:"other",u=n.message;this.media.currentSrc||this.media.srcObject||(u="empty_src",n={code:6,message:u}),this.emit(e,new je(this,{errorType:s,errorCode:n.code,errorMessage:n.message||"",mediaError:n}))}}},{key:"destroy",value:function(){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;for(var e in 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(){var e=this.media?this.media.play():null;return e}},{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):!1}},{key:"getBufferedRange",value:function(e){var i=[0,0];if(!this.media)return i;e||(e=this.media.buffered);var n=this.media.currentTime;if(e)for(var s=0,u=e.length;s<u&&(i[0]=e.start(s),i[1]=e.end(s),!(i[0]<=n&&n<=i[1]));s++);return i[0]-n<=0&&n-i[1]<=0?i:[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?c.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var i=this.media.buffered;if(!i||i.length===0)return e;for(var n=0;n<i.length;n++)if((i.start(n)<=this.currentTime||i.start(n)<.1)&&i.end(n)>=this.currentTime)return{start:i.start(n),end:i.end(n)};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?this.media.currentTime!==void 0?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:!1},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:!1}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){var e=this.media.error;if(!e)return"";var i=["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"];return i[this.media.error.code-1]}},{key:"loop",get:function(){return this.media?this.media.loop:!1},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return this.media?this.media.muted:!1},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:!0}},{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:!1},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:!1}},{key:"seeking",get:function(){return this.media?this.media.seeking:!1}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){if(this.media){if(this.emit(et,e),this.emit(Oe),this._currentTime=0,this._duration=0,c.isMSE(this.media)){this.onWaiting();return}this._detachSourceEvents(this.media),c.typeOf(e)==="Array"?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:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,i){for(var n,s=arguments.length,u=new Array(s>2?s-2:0),l=2;l<s;l++)u[l-2]=arguments[l];(n=I(P(r.prototype),"emit",this)).call.apply(n,[this,e,i].concat(u))}},{key:"on",value:function(e,i){for(var n,s=arguments.length,u=new Array(s>2?s-2:0),l=2;l<s;l++)u[l-2]=arguments[l];(n=I(P(r.prototype),"on",this)).call.apply(n,[this,e,i].concat(u))}},{key:"once",value:function(e,i){for(var n,s=arguments.length,u=new Array(s>2?s-2:0),l=2;l<s;l++)u[l-2]=arguments[l];(n=I(P(r.prototype),"once",this)).call.apply(n,[this,e,i].concat(u))}},{key:"off",value:function(e,i){for(var n,s=arguments.length,u=new Array(s>2?s-2:0),l=2;l<s;l++)u[l-2]=arguments[l];(n=I(P(r.prototype),"off",this)).call.apply(n,[this,e,i].concat(u))}},{key:"offAll",value:function(){I(P(r.prototype),"removeAllListeners",this).call(this)}}]),r}(Ei),Hn=function(){function o(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};E(this,o),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=a}return S(o,[{key:"openDB",value:function(r){var t=this,e=this,i=this.myDB.version||1,n=e.indexedDB.open(e.myDB.name,i);n.onerror=function(s){},n.onsuccess=function(s){t.myDB.db=s.target.result,r.call(e)},n.onupgradeneeded=function(s){var u=s.target.result;s.target.transaction,u.objectStoreNames.contains(e.myDB.ojstore.name)||u.createObjectStore(e.myDB.ojstore.name,{keyPath:e.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){var r=this;r.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,n=0;n<t.length;n++)i=e.add(t[n]),i.onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,n=0;n<t.length;n++)i=e.put(t[n]),i.onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(r,t,e){var i=this,n=this.myDB.db.transaction(r,"readwrite").objectStore(r),s=n.get(t);s.onerror=function(){e.call(i,null)},s.onsuccess=function(u){var l=u.target.result;e.call(i,l)}}},{key:"deleteData",value:function(r,t){var e=this.myDB.db.transaction(r,"readwrite").objectStore(r);e.delete(t)}},{key:"clearData",value:function(r){var t=this.myDB.db.transaction(r,"readwrite").objectStore(r);t.clear()}}]),o}(),Xt=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],$t=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],qt=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],he="data-xgplayerid";function Ne(o,a,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i<t;i++)e[i-3]=arguments[i];var n=a.call.apply(a,[o].concat(e));!r||typeof r!="function"||(n&&n.then?n.then(function(){for(var s=arguments.length,u=new Array(s),l=0;l<s;l++)u[l]=arguments[l];r.call.apply(r,[o].concat(u))}):r.call.apply(r,[o].concat(e)))}function Xe(o,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[o]&&(this.__hooks[o]=null),function(){var t=arguments,e=this;if(r.pre)try{var i;(i=r.pre).call.apply(i,[this].concat(Array.prototype.slice.call(arguments)))}catch(s){throw s.message="[pluginName: ".concat(this.pluginName,":").concat(o,":pre error] >> ").concat(s.message),s}if(this.__hooks&&this.__hooks[o])try{var n=ne(this,o,a);n?n.then?n.then(function(s){s!==!1&&Ne.apply(void 0,[e,a,r.next].concat(Q(t)))}).catch(function(s){throw s}):Ne.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments))):n===void 0&&Ne.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments)))}catch(s){throw s.message="[pluginName: ".concat(this.pluginName,":").concat(o,"] >> ").concat(s.message),s}else Ne.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function Wi(o,a){var r=this.__hooks;if(!r||!Array.isArray(r[o]))return-1;for(var t=r[o],e=0;e<t.length;e++)if(t[e]===a)return e;return-1}function $e(o,a){var r=this.__hooks;if(r)return r.hasOwnProperty(o)?(Array.isArray(r[o])||(r[o]=[]),Wi.call(this,o,a)===-1&&r[o].push(a),!0):(console.warn("has no supported hook which name [".concat(o,"]")),!1)}function qe(o,a){var r=this.__hooks;if(r)if(Array.isArray(r[o])){var t=r[o],e=Wi.call(this,o,a);e!==-1&&t.splice(e,1)}else r[o]&&(r[o]=null)}function Zt(o){if(!(!this.plugins||!this.plugins[o.toLowerCase()])){for(var a=this.plugins[o.toLowerCase()],r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return a.useHooks&&a.useHooks.apply(a,t)}}function Jt(o){if(!(!this.plugins||!this.plugins[o.toLowerCase()])){var a=this.plugins[o.toLowerCase()];if(a){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return a.removeHooks&&a.removeHooks.apply(a,t)}}}function Gi(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];o.__hooks={},a&&a.map(function(r){o.__hooks[r]=null}),Object.defineProperty(o,"hooks",{get:function(){return o.__hooks&&Object.keys(o.__hooks).map(function(t){if(o.__hooks[t])return t})}})}function zi(o){o.__hooks=null}function ne(o,a,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i<t;i++)e[i-3]=arguments[i];if(o.__hooks&&Array.isArray(o.__hooks[a])){var n=o.__hooks[a],s=-1,u=function l(f,h,d){for(var g=arguments.length,p=new Array(g>3?g-3:0),m=3;m<g;m++)p[m-3]=arguments[m];if(s++,n.length===0||s===n.length)return d.call.apply(d,[f,f].concat(p));var _=n[s],b=_.call.apply(_,[f,f].concat(p));if(b&&b.then)return b.then(function(T){return T===!1?null:l.apply(void 0,[f,h,d].concat(p))}).catch(function(T){console.warn("[runHooks]".concat(h," reject"),T.message)});if(b!==!1)return l.apply(void 0,[f,h,d].concat(p))};return u.apply(void 0,[o,a,r].concat(e))}else return r.call.apply(r,[o,o].concat(e))}function ut(o,a){O.logError("[".concat(o,"] event or callback cant be undefined or null when call ").concat(a))}var ge=function(){function o(a){E(this,o),c.checkIsFunction(this.beforeCreate)&&this.beforeCreate(a),Gi(this),this.__args=a,this.__events={},this.__onceEvents={},this.config=a.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(a)}return S(o,[{key:"beforeCreate",value:function(r){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(r){this.player=r.player,this.playerConfig=r.player&&r.player.config,this.pluginName=r.pluginName?r.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=r.player&&r.player.logger}},{key:"updateLang",value:function(r){r||(r=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 r=c.checkTouchSupport()?"touch":"mouse";return this.playerConfig&&(this.playerConfig.domEventType==="touch"||this.playerConfig.domEventType==="mouse")&&(r=this.playerConfig.domEventType),r}},{key:"on",value:function(r,t){var e=this;if(!r||!t||!this.player){ut(this.pluginName,"plugin.on(event, callback)");return}typeof r=="string"?(this.__events[r]=t,this.player.on(r,t)):Array.isArray(r)&&r.forEach(function(i){e.__events[i]=t,e.player.on(i,t)})}},{key:"once",value:function(r,t){var e=this;if(!r||!t||!this.player){ut(this.pluginName,"plugin.once(event, callback)");return}typeof r=="string"?(this.__onceEvents[r]=t,this.player.once(r,t)):Array.isArray(r)&&r.forEach(function(i){e.__onceEvents[i]=t,e.player.once(r,t)})}},{key:"off",value:function(r,t){var e=this;if(!r||!t||!this.player){ut(this.pluginName,"plugin.off(event, callback)");return}typeof r=="string"?(delete this.__events[r],this.player.off(r,t)):Array.isArray(r)&&r.forEach(function(i){delete e.__events[r],e.player.off(i,t)})}},{key:"offAll",value:function(){var r=this;["__events","__onceEvents"].forEach(function(t){Object.keys(r[t]).forEach(function(e){r[t][e]&&r.off(e,r[t][e]),e&&delete r[t][e]})}),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(r){var t;if(this.player){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];(t=this.player).emit.apply(t,[r].concat(i))}}},{key:"emitUserAction",value:function(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.player){var i=U(U({},e),{},{pluginName:this.pluginName});this.player.emitUserAction(r,t,i)}}},{key:"hook",value:function(r,t){return Xe.call.apply(Xe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),n=2;n<e;n++)i[n-2]=arguments[n];return $e.call.apply($e,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),n=2;n<e;n++)i[n-2]=arguments[n];return qe.call.apply(qe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";if(this.player)return e&&(t.pluginName=e),this.player.registerPlugin({plugin:r,options:t})}},{key:"getPlugin",value:function(r){return this.player?this.player.getPlugin(r):null}},{key:"__destroy",value:function(){var r=this,t=this.player,e=this.pluginName;this.offAll(),c.clearAllTimers(this),c.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map(function(i){r[i]=null}),t.unRegisterPlugin(e),zi(this)}}],[{key:"defineGetterOrSetter",value:function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.defineProperty(r,e,t[e])}},{key:"defineMethod",value:function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&typeof t[e]=="function"&&Object.defineProperty(r,e,{configurable:!0,value:t[e]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),o}(),lt,Qt;function Un(){if(Qt)return lt;Qt=1;var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var a=Element.prototype;a.matches=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector}function r(t,e){for(;t&&t.nodeType!==o;){if(typeof t.matches=="function"&&t.matches(e))return t;t=t.parentNode}}return lt=r,lt}var ct,ei;function Vn(){if(ei)return ct;ei=1;var o=Un();function a(e,i,n,s,u){var l=t.apply(this,arguments);return e.addEventListener(n,l,u),{destroy:function(){e.removeEventListener(n,l,u)}}}function r(e,i,n,s,u){return typeof e.addEventListener=="function"?a.apply(null,arguments):typeof n=="function"?a.bind(null,document).apply(null,arguments):(typeof e=="string"&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,function(l){return a(l,i,n,s,u)}))}function t(e,i,n,s){return function(u){u.delegateTarget=o(u.target,i),u.delegateTarget&&s.call(e,u)}}return ct=r,ct}var jn=Vn();const ti=wt(jn);var Wn={CONTROLS:"controls",ROOT:"root"},H={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"},ii={ICON_DISABLE:"xg-icon-disable"};function ft(o){return o?o.indexOf&&/^(?:http|data:|\/)/.test(o):!1}function Gn(o,a){return z(o)==="object"&&o.class&&typeof o.class=="string"?"".concat(a," ").concat(o.class):a}function zn(o,a){return z(o)==="object"&&o.attr&&z(o.attr)==="object"&&Object.keys(o.attr).map(function(r){a[r]=o.attr[r]}),a}function ni(o,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",i=null;if(o instanceof window.Element)return c.addClass(o,r),Object.keys(t).map(function(n){o.setAttribute(n,t[n])}),o;if(ft(o)||ft(o.url))return t.src=ft(o)?o:o.url||"",i=c.createDom(o.tag||"img","",t,"xg-img ".concat(r)),i;if(typeof o=="function")try{return i=o(),i instanceof window.Element?(c.addClass(i,r),Object.keys(t).map(function(n){i.setAttribute(n,t[n])}),i):(O.logWarn("warn>>icons.".concat(a," in config of plugin named [").concat(e,"] is a function mast return an Element Object")),null)}catch(n){return O.logError("Plugin named [".concat(e,"]:createIcon"),n),null}return typeof o=="string"?c.createDomFromHtml(o,t,r):(O.logWarn("warn>>icons.".concat(a," in config of plugin named [").concat(e,"] is invalid")),null)}function Kn(o,a){var r=a.config.icons||a.playerConfig.icons;Object.keys(o).map(function(t){var e=o[t],i=e&&e.class?e.class:"",n=e&&e.attr?e.attr:{},s=null;r&&r[t]&&(i=Gn(r[t],i),n=zn(r[t],n),s=ni(r[t],t,i,n,a.pluginName)),!s&&e&&(s=ni(e.icon?e.icon:e,n,i,{},a.pluginName)),a.icons[t]=s})}function Yn(o,a){Object.keys(o).map(function(r){Object.defineProperty(a.langText,r,{get:function(){var e=a.lang,i=a.i18n;return i[r]?i[r]:o[r]&&o[r][e]||""}})})}var F=function(o){w(r,o);var a=x(r);function r(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return E(this,r),t=a.call(this,e),t.__delegates=[],t}return S(r,[{key:"__init",value:function(e){if(I(P(r.prototype),"__init",this).call(this,e),!!e.root){var i=e.root,n=null;this.icons={},this.root=null,this.parent=null;var s=this.registerIcons()||{};Kn(s,this),this.langText={};var u=this.registerLanguageTexts()||{};Yn(u,this);var l="";try{l=this.render()}catch(d){throw O.logError("Plugin:".concat(this.pluginName,":render"),d),new Error("Plugin:".concat(this.pluginName,":render:").concat(d.message))}if(l)n=r.insert(l,i,e.index),n.setAttribute("data-index",e.index);else if(e.tag)n=c.createDom(e.tag,"",e.attr,e.name),n.setAttribute("data-index",e.index),i.appendChild(n);else return;this.root=n,this.parent=i;var f=this.config.attr||{},h=this.config.style||{};this.setAttr(f),this.setStyle(h),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var i=this.children();i&&z(i)==="object"&&Object.keys(i).length>0&&Object.keys(i).map(function(n){var s=n,u=i[s],l={root:e.root},f,h;typeof u=="function"?(f=e.config[s]||{},h=u):z(u)==="object"&&typeof u.plugin=="function"&&(f=u.options?c.deepCopy(e.config[s]||{},u.options):e.config[s]||{},h=u.plugin),l.config=f,f.index!==void 0&&(l.index=f.index),f.root&&(l.root=f.root),e.registerPlugin(h,l,s)})}}},{key:"updateLang",value:function(e){e||(e=this.lang);function i(l,f){for(var h=0;h<l.children.length;h++)l.children[h].children.length>0?i(l.children[h],f):f(l.children[h])}var n=this.root,s=this.i18n,u=this.langText;n&&i(n,function(l){var f=l.getAttribute&&l.getAttribute("lang-key");if(f){var h=s[f.toUpperCase()]||u[f];h&&(l.innerHTML=typeof h=="function"?h(e):h)}})}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=this.i18n||{},s=this.langText;e.setAttribute&&e.setAttribute("lang-key",i);var u=n[i]||s[i]||"";u&&(e.innerHTML=u)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,c.addClass(this.find(".xgplayer-icon"),ii.ICON_DISABLE)}},{key:"enable",value:function(){this.config.disable=!1,c.removeClass(this.find(".xgplayer-icon"),ii.ICON_DISABLE)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";i.root=i.root||this.root;var s=I(P(r.prototype),"registerPlugin",this).call(this,e,i,n);return this._children.push(s),s}},{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,i,n){var s=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(l){s.bindEL(l,i)}):this.bindEL(e,i);else{var u=r.delegate.call(this,this.root,e,i,n);this.__delegates=this.__delegates.concat(u)}}},{key:"unbind",value:function(e,i){var n=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(l){n.unbindEL(l,i)}):this.unbindEL(e,i);else for(var s="".concat(e,"_").concat(i),u=0;u<this.__delegates.length;u++)if(this.__delegates[u].key===s){this.__delegates[u].destroy(),this.__delegates.splice(u,1);break}}},{key:"setStyle",value:function(e,i){var n=this;if(this.root){if(c.typeOf(e)==="String")return this.root.style[e]=i;c.typeOf(e)==="Object"&&Object.keys(e).map(function(s){n.root.style[s]=e[s]})}}},{key:"setAttr",value:function(e,i){var n=this;if(this.root){if(c.typeOf(e)==="String")return this.root.setAttribute(e,i);c.typeOf(e)==="Object"&&Object.keys(e).map(function(s){n.root.setAttribute(s,e[s])})}}},{key:"setHtml",value:function(e,i){this.root&&(this.root.innerHTML=e,typeof i=="function"&&i())}},{key:"bindEL",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.addEventListener(e,i,n)}},{key:"unbindEL",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.removeEventListener(e,i,n)}},{key:"show",value:function(e){if(this.root){this.root.style.display=e!==void 0?e:"block";var i=window.getComputedStyle(this.root,null),n=i.getPropertyValue("display");if(n==="none")return this.root.style.display="block"}}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,i){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!i||!(i instanceof window.Element))return null;try{return typeof e=="string"?this.find(e).appendChild(i):e.appendChild(i)}catch(n){return O.logError("Plugin:appendChild",n),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,i=this.player;this.__delegates.map(function(n){n.destroy()}),this.__delegates=[],this._children instanceof Array&&(this._children.map(function(n){i.unRegisterPlugin(n.pluginName)}),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),I(P(r.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map(function(n){e[n]=null})}}],[{key:"insert",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=i.children.length,u=Number(n),l=e instanceof window.Node;if(s){for(var f=0,h=null,d="";f<s;f++){h=i.children[f];var g=Number(h.getAttribute("data-index"));if(g>=u){d="beforebegin";break}else g<u&&(d="afterend")}return l?d==="afterend"?i.appendChild(e):i.insertBefore(e,h):h.insertAdjacentHTML(d,e),d==="afterend"?i.children[i.children.length-1]:i.children[f]}else return l?i.appendChild(e):i.insertAdjacentHTML("beforeend",e),i.children[i.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,i,n,s){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,l=[];if(e instanceof window.Node&&typeof s=="function")if(Array.isArray(n))n.forEach(function(h){var d=ti(e,i,h,s,u);d.key="".concat(i,"_").concat(h),l.push(d)});else{var f=ti(e,i,n,s,u);f.key="".concat(i,"_").concat(n),l.push(f)}return l}},{key:"ROOT_TYPES",get:function(){return Wn}},{key:"POSITIONS",get:function(){return H}}]),r}(ge),Xn=function(){function o(){var a=this;if(E(this,o),y(this,"__trigger",function(r){var t=new Date().getTime();a.timeStamp=t;for(var e=0;e<r.length;e++)a.__runHandler(r[e].target)}),this.__handlers=[],this.timeStamp=0,this.observer=null,!!window.ResizeObserver)try{this.observer=new window.ResizeObserver(Tn(this.__trigger,100,{trailing:!0})),this.timeStamp=new Date().getTime()}catch(r){console.error(r)}}return S(o,[{key:"addObserver",value:function(r,t){if(this.observer){this.observer.observe(r);for(var e=r.getAttribute(he),i=this.__handlers,n=-1,s=0;s<i.length;s++)i[s]&&r===i[s].target&&(n=s);n>-1?this.__handlers[n].handler=t:this.__handlers.push({target:r,handler:t,playerId:e})}}},{key:"unObserver",value:function(r){var t=-1;this.__handlers.map(function(i,n){r===i.target&&(t=n)});try{var e;(e=this.observer)===null||e===void 0||e.unobserve(r)}catch(i){}t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){var r;(r=this.observer)===null||r===void 0||r.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(r){for(var t=this.__handlers,e=0;e<t.length;e++)if(t[e]&&r===t[e].target){try{t[e].handler(r)}catch(i){console.error(i)}return!0}return!1}}]),o}(),Le=null;function $n(o,a){return Le||(Le=new Xn),Le.addObserver(o,a),Le}function qn(o,a){var r;(r=Le)===null||r===void 0||r.unObserver(o,a)}var W={pluginGroup:{},init:function(a){var r=a._pluginInfoId;r||(r=new Date().getTime(),a._pluginInfoId=r),!a.config.closeResizeObserver&&$n(a.root,function(){a.resize()}),this.pluginGroup[r]={_originalOptions:a.config||{},_plugins:{}}},formatPluginInfo:function(a,r){var t=null,e=null;return a.plugin&&typeof a.plugin=="function"?(t=a.plugin,e=a.options):(t=a,e={}),r&&(e.config=r||{}),{PLUFGIN:t,options:e}},checkPluginIfExits:function(a,r){for(var t=0;t<r.length;t++)if(a.toLowerCase()===r[t].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(a,r){for(var t=Object.keys(r),e=null,i=0;i<t.length;i++)if(a.toLowerCase()===t[i].toLowerCase()){e=r[t[i]];break}return c.typeOf(e)==="Object"?{root:e.root,position:e.position}:{}},lazyRegister:function(a,r){var t=this,e=r.timeout||1500;return Promise.race([r.loader().then(function(i){var n;i&&i.__esModule?n=i.default:n=i,t.register(a,n,i.options)}),new Promise(function(i,n){setTimeout(function(){n(new Error("timeout"))},e)})])},register:function(a,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!(!a||!r||typeof r!="function"||r.prototype===void 0)){var e=a._pluginInfoId;if(!(!e||!this.pluginGroup[e])){this.pluginGroup[e]._plugins||(this.pluginGroup[e]._plugins={});var i=this.pluginGroup[e]._plugins,n=this.pluginGroup[e]._originalOptions;t.player=a;var s=t.pluginName||r.pluginName;if(!s)throw new Error("The property pluginName is necessary");if(r.isSupported&&!r.isSupported(a.config.mediaType,a.config.codecType)){console.warn("not supported plugin [".concat(s,"]"));return}t.config||(t.config={});for(var u=Object.keys(n),l=0;l<u.length;l++)if(s.toLowerCase()===u[l].toLowerCase()){var f=n[u[l]];c.typeOf(f)==="Object"?t.config=Object.assign({},t.config,n[u[l]]):c.typeOf(f)==="Boolean"&&(t.config.disable=!f);break}r.defaultConfig&&Object.keys(r.defaultConfig).forEach(function(d){typeof t.config[d]=="undefined"&&(t.config[d]=r.defaultConfig[d])}),t.root?typeof t.root=="string"&&(t.root=a[t.root]):t.root=a.root,t.index=t.config.index||0;try{i[s.toLowerCase()]&&(this.unRegister(e,s.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(s,"] exist, destroy the old instance")));var h=new r(t);return i[s.toLowerCase()]=h,i[s.toLowerCase()].func=r,h&&typeof h.afterCreate=="function"&&h.afterCreate(),h}catch(d){throw console.error(d),d}}}},unRegister:function(a,r){a._pluginInfoId&&(a=a._pluginInfoId),r=r.toLowerCase();try{var t=this.pluginGroup[a]._plugins[r];t&&(t.pluginName&&t.__destroy(),delete this.pluginGroup[a]._plugins[r])}catch(e){console.error("[unRegister:".concat(r,"] cgid:[").concat(a,"] error"),e)}},deletePlugin:function(a,r){var t=a._pluginInfoId;t&&this.pluginGroup[t]&&this.pluginGroup[t]._plugins&&delete this.pluginGroup[t]._plugins[r]},getPlugins:function(a){var r=a._pluginInfoId;return r&&this.pluginGroup[r]?this.pluginGroup[r]._plugins:{}},findPlugin:function(a,r){var t=a._pluginInfoId;if(!t||!this.pluginGroup[t])return null;var e=r.toLowerCase();return this.pluginGroup[t]._plugins[e]},beforeInit:function(a){var r=this;function t(e){return!e||!e.then?new Promise(function(i){i()}):e}return new Promise(function(e){if(r.pluginGroup){var i;return a._loadingPlugins&&a._loadingPlugins.length?i=Promise.all(a._loadingPlugins):i=Promise.resolve(),i.then(function(){var n=a._pluginInfoId;if(!r.pluginGroup[n]){e();return}var s=r.pluginGroup[n]._plugins,u=[];Object.keys(s).forEach(function(l){if(s[l]&&s[l].beforePlayerInit)try{var f=s[l].beforePlayerInit();u.push(t(f))}catch(h){throw u.push(t(null)),h}}),Promise.all([].concat(u)).then(function(){e()}).catch(function(l){console.error(l),e()})})}})},afterInit:function(a){var r=a._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins;Object.keys(t).forEach(function(e){t[e]&&t[e].afterPlayerInit&&t[e].afterPlayerInit()})}},setLang:function(a,r){var t=r._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=this.pluginGroup[t]._plugins;Object.keys(e).forEach(function(i){if(e[i].updateLang)e[i].updateLang(a);else try{e[i].lang=a}catch(n){console.warn("".concat(i," setLang"))}})}},reRender:function(a){var r=this,t=a._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=[],i=this.pluginGroup[t]._plugins;Object.keys(i).forEach(function(n){n!=="controls"&&i[n]&&(e.push({plugin:i[n].func,options:i[n].__args}),r.unRegister(t,n))}),e.forEach(function(n){r.register(a,n.plugin,n.options)})}},onPluginsReady:function(a){var r=a._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins||{};Object.keys(t).forEach(function(e){t[e].onPluginsReady&&typeof t[e].onPluginsReady=="function"&&t[e].onPluginsReady()})}},destroy:function(a){var r=a._pluginInfoId;if(this.pluginGroup[r]){qn(a.root);for(var t=this.pluginGroup[r]._plugins,e=0,i=Object.keys(t);e<i.length;e++){var n=i[e];this.unRegister(r,n)}delete this.pluginGroup[r],delete a._pluginInfoId}}},C={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 ri(){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:bn(),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 Zn=function(a,r){var t,e,i;r.preset&&r.options?i=new r.preset(r.options,a.config):i=new r({},a.config);var n=i,s=n.plugins,u=s===void 0?[]:s,l=n.ignores,f=l===void 0?[]:l,h=n.icons,d=h===void 0?{}:h,g=n.i18n,p=g===void 0?[]:g;a.config.plugins||(a.config.plugins=[]),a.config.ignores||(a.config.ignores=[]),(t=a.config.plugins).push.apply(t,Q(u)),(e=a.config.ignores).push.apply(e,Q(f)),Object.keys(d).map(function(_){a.config.icons[_]||(a.config.icons[_]=d[_])});var m=a.config.i18n||[];p.push.apply(p,Q(m)),a.config.i18n=p},Jn=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onMouseEnter",function(s){var u=v(t),l=u.player,f=u.playerConfig;f.closeControlsBlur&&l.focus({autoHide:!1})}),y(v(t),"onMouseLeave",function(s){var u=v(t),l=u.player;l.focus()}),t}return S(r,[{key:"beforeCreate",value:function(e){!e.config.mode&&L.device==="mobile"&&(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.disable,s=i.height,u=i.mode;if(!n){u==="flex"&&this.player.addClass(C.FLEX_CONTROLS);var l={height:"".concat(s,"px")};Object.keys(l).map(function(h){e.root.style[h]=l[h]}),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-controls"),this.on(ze,function(h){h?c.addClass(e.root,"mini-controls"):c.removeClass(e.root,"mini-controls")});var f=this.playerConfig.isMobileSimulateMode;L.device!=="mobile"&&f!=="mobile"&&(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&&c.addClass(this.root,C.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){c.removeClass(this.root,C.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){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 i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var s=e.defaultConfig||{};if(!i.root){var u=i.position?i.position:i.config&&i.config.position?i.config.position:s.position;switch(u){case H.CONTROLS_LEFT:i.root=this.left;break;case H.CONTROLS_RIGHT:i.root=this.right;break;case H.CONTROLS_CENTER:i.root=this.center;break;case H.CONTROLS:i.root=this.root;break;default:i.root=this.left}return I(P(r.prototype),"registerPlugin",this).call(this,e,i,n)}}}},{key:"destroy",value:function(){L.device!=="mobile"&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.left=null,this.center=null,this.right=null,this.innerRoot=null}},{key:"render",value:function(){var e=this.config,i=e.mode,n=e.autoHide,s=e.initShow,u=e.disable;if(!u){var l=c.classNames({"xgplayer-controls":!0},{"flex-controls":i==="flex"},{"bottom-controls":i==="bottom"},y({},C.CONTROLS_AUTOHIDE,n),{"xgplayer-controls-initshow":s||!n});return'<xg-controls class="'.concat(l,`" unselectable="on">
<xg-inner-controls class="xg-inner-controls xg-pos">
<xg-left-grid class="xg-left-grid">
</xg-left-grid>
<xg-center-grid class="xg-center-grid"></xg-center-grid>
<xg-right-grid class="xg-right-grid">
</xg-right-grid>
</xg-inner-controls>
</xg-controls>`)}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),r}(F),Qn={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",ERROR:"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"}},X={lang:{},langKeys:[],textKeys:[]};function De(o,a){return Object.keys(a).forEach(function(r){var t=c.typeOf(a[r]),e=c.typeOf(o[r]);if(t==="Array"){var i;e!=="Array"&&(o[r]=[]),(i=o[r]).push.apply(i,Q(a[r]))}else t==="Object"?(e!=="Object"&&(o[r]={}),De(o[r],a[r])):o[r]=a[r]}),o}function Ki(){Object.keys(X.lang.en).map(function(o){X.textKeys[o]=o})}function er(o,a){var r=[];if(a||(a=X),!!a.lang){c.typeOf(o)!=="Array"?r=Object.keys(o).map(function(i){var n=i==="zh"?"zh-cn":i;return{LANG:n,TEXT:o[i]}}):r=o;var t=a,e=t.lang;r.map(function(i){i.LANG==="zh"&&(i.LANG="zh-cn"),e[i.LANG]?De(e[i.LANG]||{},i.TEXT||{}):Mt(i,a)}),Ki()}}function Mt(o,a){var r=o.LANG;if(a||(a=X),!!a.lang){var t=o.TEXT||{};r==="zh"&&(r="zh-cn"),a.lang[r]?De(a.lang[r],t):(a.langKeys.push(r),a.lang[r]=t),Ki()}}function tr(o){var a,r={lang:{},langKeys:[],textKeys:{},pId:o};return De(r.lang,X.lang),(a=r.langKeys).push.apply(a,Q(X.langKeys)),De(r.textKeys,X.textKeys),r}Mt(Qn);var Pe={get textKeys(){return X.textKeys},get langKeys(){return X.langKeys},get lang(){var o={};return X.langKeys.map(function(a){o[a]=X.lang[a]}),X.lang["zh-cn"]&&(o.zh=X.lang["zh-cn"]||{}),o},extend:er,use:Mt,init:tr},N={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7},si=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],K={},ht=null,Yi=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"add",value:function(e){e&&(K[e.playerId]=e,Object.keys(K).length===1&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete K[e.playerId])}},{key:"_iterate",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(var n in K)if(Object.prototype.hasOwnProperty.call(K,n)){var s=K[n];if(i){if(e(s))break}else e(s)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var i=null;return this._iterate(function(n){var s=e(n);return s&&(i=n),s},!0),i}},{key:"findAll",value:function(e){var i=[];return this._iterate(function(n){e(n)&&i.push(n)}),i}},{key:"setActive",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(K[e])return i?this.forEach(function(n){e===n.playerId?(n.isUserActive=!0,n.isInstNext=!1):n.isUserActive=!1}):K[e].isUserActive=i,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(K),i=0;i<e.length;i++){var n=K[e[i]];if(n&&n.isUserActive)return e[i]}return null}},{key:"setNext",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(K[e])return i?this.forEach(function(n){e===n.playerId?(n.isUserActive=!1,n.isInstNext=!0):n.isInstNext=!1}):K[e].isInstNext=i,e}}],[{key:"getInstance",value:function(){return ht||(ht=new r),ht}}]),r}(bi.EventEmitter);function ir(o){for(var a=Object.keys(K),r=0;r<a.length;r++){var t=K[a[r]];if(t.root===o)return t}return null}var nr=["play","pause","replay","retry"],ai=0,oi=0,le=null,it=function(o){w(r,o);var a=x(r);function r(t){var e;E(this,r);var i=c.deepMerge(ri(),t);e=a.call(this,i),y(v(e),"canPlayFunc",function(){if(e.config){var p=e.config,m=p.autoplay,_=p.defaultPlaybackRate;O.logInfo("player","canPlayFunc, startTime",e.__startTime),e._seekToStartTime(),e.playbackRate=_,(m||e._useAutoplay)&&e.mediaPlay(),e.off(se,e.canPlayFunc),e.removeClass(C.ENTER)}}),y(v(e),"onFullscreenChange",function(p,m){var _=function(){c.setTimeout(v(e),function(){e.resize()},100)},b=c.getFullScreenEl();e._fullActionFrom?e._fullActionFrom="":e.emit(Ye,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:e.currentTime,duration:e.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var T=En(b,e.playerId,he);if(m||b&&(b===e._fullscreenEl||T))_(),!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!0,e.changeFullStyle(e.root,b,C.FULLSCREEN),e.emit(re,!0,e._fullScreenOffset),e.cssfullscreen&&e.exitCssFullscreen();else if(e.fullscreen){_();var k=v(e),D=k._fullScreenOffset,A=k.config;if(A.needFullscreenScroll?(window.scrollTo(D.left,D.top),c.setTimeout(v(e),function(){e.fullscreen=!1,e._fullScreenOffset=null},100)):(!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!1,e._fullScreenOffset=null),e.cssfullscreen)e.removeClass(C.FULLSCREEN);else{var B=e._fullscreenEl;!B&&(e.root.contains(p.target)||p.target===e.root)&&(B=p.target),e.recoverFullStyle(e.root,B,C.FULLSCREEN)}e._fullscreenEl=null,e.emit(re,!1)}}),y(v(e),"_onWebkitbeginfullscreen",function(p){e._fullscreenEl=e.media,e.onFullscreenChange(p,!0)}),y(v(e),"_onWebkitendfullscreen",function(p){e.onFullscreenChange(p,!1)}),Gi(v(e),nr),e.config=i,e._pluginInfoId=c.generateSessionId(),yn(v(e));var n=e.constructor.defaultPreset;if(e.config.presets.length){var s=e.config.presets.indexOf("default");s>=0&&n&&(e.config.presets[s]=n)}else n&&e.config.presets.push(n);e.userTimer=null,e.waitTimer=null,e.handleSource=!0,e._state=N.INITIAL,e.isAd=!1,e.isError=!1,e._hasStart=!1,e.isSeeking=!1,e.isCanplay=!1,e._useAutoplay=!1,e.__startTime=-1,e.rotateDeg=0,e.isActive=!1,e.fullscreen=!1,e.cssfullscreen=!1,e.isRotateFullscreen=!1,e._fullscreenEl=null,e.timeSegments=[],e._cssfullscreenEl=null,e.curDefinition=null,e._orgCss="",e._fullScreenOffset=null,e._videoHeight=0,e._videoWidth=0,e.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},e.sizeInfo={width:0,height:0,left:0,top:0},e._accPlayed={t:0,acc:0,loopAcc:0},e._offsetInfo={currentTime:-1,duration:0},e.innerContainer=null,e.controls=null,e.topBar=null,e.root=null,e.__i18n=Pe.init(e._pluginInfoId),L.os.isAndroid&&L.osVersion>0&&L.osVersion<6&&(e.config.autoplay=!1),e.database=new Hn,e.isUserActive=!1,e._onceSeekCanplay=null,e._isPauseBeforeSeek=0,e.innerStates={isActiveLocked:!1},e.instManager=le;var u=e._initDOM();if(!u)return console.error(new Error("can't find the dom which id is ".concat(e.config.id," or this.config.el does not exist"))),xt(e);var l=e.config,f=l.definition,h=f===void 0?{}:f,d=l.url;if(!d&&h.list&&h.list.length>0){var g=h.list.find(function(p){return p.definition&&p.definition===h.defaultDefinition});g||(h.defaultDefinition=h.list[0].definition,g=h.list[0]),e.config.url=g.url,e.curDefinition=g}return e._bindEvents(),e._registerPresets(),e._registerPlugins(),W.onPluginsReady(v(e)),e.getInitDefinition(),e.setState(N.READY),c.setTimeout(v(e),function(){e.emit(Lt)},0),e.onReady&&e.onReady(),(e.config.videoInit||e.config.autoplay)&&(!e.hasStart||e.state<N.ATTACHED)&&e.start(),e}return S(r,[{key:"_initDOM",value:function(){var e,i=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var n=this.config.el;if(n&&n.nodeType===1)this.root=n;else return this.emit(Re,new je("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}var s=ir(this.root);if(s&&(O.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),s.destroy()),this.root.setAttribute(he,this.playerId),this.media.setAttribute(he,this.playerId),(e=le)===null||e===void 0||e.add(this),W.init(this),this._initBaseDoms(),this.config.controls){var u=this.config.controls.root||null,l=W.register(this,Jn,{root:u});this.controls=l}var f=this.config.isMobileSimulateMode==="mobile"?"mobile":L.device;if(this.addClass("".concat(C.DEFAULT," ").concat(C.INACTIVE," xgplayer-").concat(f," ").concat(this.config.controls?"":C.NO_CONTROLS)),this.config.autoplay?this.addClass(C.ENTER):this.addClass(C.NO_START),this.config.fluid){var h=this.config,d=h.width,g=h.height;(typeof d!="number"||typeof g!="number")&&(d=600,g=337.5);var p={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(g*100/d,"%")};Object.keys(p).forEach(function(D){i.root.style[D]=p[D]})}else["width","height"].forEach(function(D){i.config[D]&&(typeof i.config[D]!="number"?i.root.style[D]=i.config[D]:i.root.style[D]="".concat(i.config[D],"px"))});var m=this.root.getBoundingClientRect(),_=m.width,b=m.height,T=m.left,k=m.top;return this.sizeInfo.width=_,this.sizeInfo.height=b,this.sizeInfo.left=T,this.sizeInfo.top=k,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=c.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach(function(i){e.on(i,e["on"+i.charAt(0).toUpperCase()+i.slice(1)])}),Xt.forEach(function(i){document&&document.addEventListener(i,e.onFullscreenChange)}),L.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(oe,this.resize),this.playFunc=function(){e.config.closeFocusVideoFocus||e.media.focus()},this.once(q,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),Xt.forEach(function(i){document.removeEventListener(i,e.onFullscreenChange)}),this.playFunc&&this.off(q,this.playFunc),this.off(se,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_clearUserTimer",value:function(){this.userTimer&&(c.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var i=this;if(this.media&&!((!e||e===""||c.typeOf(e)==="Array"&&e.length===0)&&(e="",this.emit(Ai),O.logWarn("config.url is null, please get url and run player._startInit(url)"),this.config.nullUrlStart))){this.handleSource&&(this._detachSourceEvents(this.media),c.typeOf(e)==="Array"&&e.length>0?this._attachSourceEvents(this.media,e):!this.media.src||this.media.src!==e?this.media.src=e:e||this.media.removeAttribute("src")),c.typeOf(this.config.volume)==="Number"&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var s=this.media.readyState;O.logInfo("_startInit readyState",s),this.config.autoplay&&(!c.isMSE(this.media)&&this.load(),(L.os.isIpad||L.os.isPhone)&&this.mediaPlay());var u=this.config.startTime;this.__startTime=u>0?u:-1,this.config.startTime=0,s>=2&&this.duration>0?this.canPlayFunc():this.on(se,this.canPlayFunc),(!this.hasStart||this.state<N.ATTACHED)&&W.afterInit(this),this.hasStart=!0,this.setState(N.ATTACHED),c.setTimeout(this,function(){i.emit(Qe)},0)}}},{key:"_registerPlugins",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this._loadingPlugins=[];var n=this.config.ignores||[],s=this.config.plugins||[],u=this.config.i18n||[];i&&Pe.extend(u,this.__i18n);var l=n.join("||").toLowerCase().split("||"),f=this.plugins;s.forEach(function(h){try{var d=h.plugin?h.plugin.pluginName:h.pluginName;if(d&&l.indexOf(d.toLowerCase())>-1)return null;if(!i&&f[d.toLowerCase()])return;if(h.lazy&&h.loader){var g=W.lazyRegister(e,h);h.forceBeforeInit&&(g.then(function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}).catch(function(p){O.logError("_registerPlugins:loadingPlugin",p),e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}),e._loadingPlugins.push(g));return}return e.registerPlugin(h)}catch(p){O.logError("_registerPlugins:",p)}})}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach(function(i){Zn(e,i)})}},{key:"_getRootByPosition",value:function(e){var i=null;switch(e){case H.ROOT_RIGHT:this.rightBar||(this.rightBar=c.createPositionBar("xg-right-bar",this.root)),i=this.rightBar;break;case H.ROOT_LEFT:this.leftBar||(this.leftBar=c.createPositionBar("xg-left-bar",this.root)),i=this.leftBar;break;case H.ROOT_TOP:this.topBar||(this.topBar=c.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&c.addClass(this.topBar,C.TOP_BAR_AUTOHIDE)),i=this.topBar;break;default:i=this.innerContainer||this.root;break}return i}},{key:"registerPlugin",value:function(e,i){var n=W.formatPluginInfo(e,i),s=n.PLUFGIN,u=n.options,l=this.config.plugins,f=W.checkPluginIfExits(s.pluginName,l);!f&&l.push(s);var h=W.getRootByConfig(s.pluginName,this.config);h.root&&(u.root=h.root),h.position&&(u.position=h.position);var d=u.position?u.position:u.config&&u.config.position||s.defaultConfig&&s.defaultConfig.position;if(!u.root&&typeof d=="string"&&d.indexOf("controls")>-1){var g;return(g=this.controls)===null||g===void 0?void 0:g.registerPlugin(s,u,s.pluginName)}return u.root||(u.root=this._getRootByPosition(d)),W.register(this,s,u)}},{key:"deregister",value:function(e){typeof e=="string"?W.unRegister(this,e):e instanceof ge&&W.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.deregister(e),i&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var i;if(typeof e=="string"?i=e:e instanceof ge&&(i=e.pluginName),!!i)for(var n=this.config.plugins.length-1;n>-1;n--){var s=this.config.plugins[n];if(s.pluginName.toLowerCase()===i.toLowerCase()){this.config.plugins.splice(n,1);break}}}},{key:"plugins",get:function(){return W.getPlugins(this)}},{key:"getPlugin",value:function(e){var i=W.findPlugin(this,e);return i&&i.pluginName?i:null}},{key:"addClass",value:function(e){this.root&&(c.hasClass(this.root,e)||c.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&c.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return c.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,i){this.root&&this.root.setAttribute(e,i)}},{key:"removeAttribute",value:function(e,i){this.root&&this.root.removeAttribute(e,i)}},{key:"start",value:function(e){var i=this;if(!(this.state>N.ATTACHING))return!e&&!this.config.url&&this.getInitDefinition(),this.hasStart=!0,this.setState(N.ATTACHING),this._registerPlugins(!1),W.beforeInit(this).then(function(){if(i.config){e||(e=i.url||i.config.url);var n=i.preProcessUrl(e),s=i._startInit(n.url);return s}}).catch(function(n){throw n.fileName="player",n.lineNumber="236",O.logError("start:beforeInit:",n),n})}},{key:"switchURL",value:function(e,i){var n=this,s=e;c.typeOf(e)==="Object"&&(s=e.url),s=this.preProcessUrl(s).url;var u=this.currentTime;this.__startTime=u;var l=this.paused&&!this.isError;return this.src=s,new Promise(function(f,h){var d=function(m){n.off("timeupdate",g),n.off("canplay",g),h(m)},g=function(){n._seekToStartTime(),l&&n.pause(),n.off("error",d),f(!0)};if(n.once("error",d),!s){n.errorHandler("error",{code:6,message:"empty_src"});return}L.os.isAndroid?n.once("timeupdate",g):n.once("canplay",g),n.play()})}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<N.ATTACHED){this.removeClass(C.NO_START),this.addClass(C.ENTER),this.start(),this._useAutoplay=!0;return}this.state<N.RUNNING&&(this.removeClass(C.NO_START),!this.isCanplay&&this.addClass(C.ENTER));var i=I(P(r.prototype),"play",this).call(this);return i!==void 0&&i&&i.then?i.then(function(){e.removeClass(C.NOT_ALLOW_AUTOPLAY),e.addClass(C.PLAYING),e.state<N.RUNNING&&(O.logInfo(">>>>playPromise.then"),e.setState(N.RUNNING),e.emit(ye))}).catch(function(n){if(O.logWarn(">>>>playPromise.catch",n.name),e.media&&e.media.error){e.onError(),e.removeClass(C.ENTER);return}n.name==="NotAllowedError"&&(e._errorTimer=c.setTimeout(e,function(){e._errorTimer=null,e.emit(Dt),e.addClass(C.NOT_ALLOW_AUTOPLAY),e.removeClass(C.ENTER),e.pause(),e.setState(N.NOTALLOW)},0))}):(O.logWarn("video.play not return promise"),this.state<N.RUNNING&&(this.setState(N.RUNNING),this.removeClass(C.NOT_ALLOW_AUTOPLAY),this.removeClass(C.NO_START),this.removeClass(C.ENTER),this.addClass(C.PLAYING),this.emit(ye))),i}},{key:"mediaPause",value:function(){I(P(r.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){I(P(r.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(C.PAUSED),ne(this,"play",function(){return e.mediaPlay()})}},{key:"pause",value:function(){var e=this;ne(this,"pause",function(){I(P(r.prototype),"pause",e).call(e)})}},{key:"seek",value:function(e,i){var n=this;if(!(!this.media||Number.isNaN(Number(e))||!this.hasStart)){var s=this.config,u=s.isSeekedPlay,l=s.seekedStatus,f=i||(u?"play":l);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(ae,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(n.removeClass(C.ENTER),n.isSeeking=!1,f){case"play":n.play();break;case"pause":n.pause();break;default:n._isPauseBeforeSeek>1||n.paused?n.pause():n.play()}n._isPauseBeforeSeek=0,n._onceSeekCanplay=null},this.once(ae,this._onceSeekCanplay),this.state<N.RUNNING?(this.removeClass(C.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,i=this.config,n=i.definition,s=i.url;!s&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&n.list.map(function(u){u.definition===n.defaultDefinition&&(e.config.url=u.url,e.curDefinition=u)})}},{key:"changeDefinition",value:function(e,i){var n=this,s=this.config.definition;if(Array.isArray(s==null?void 0:s.list)&&s.list.forEach(function(l){(e==null?void 0:e.definition)===l.definition&&(n.curDefinition=l)}),e!=null&&e.bitrate&&typeof e.bitrate!="number"&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(Ot,{from:i,to:e}),!this.hasStart){this.config.url=e.url;return}var u=this.switchURL(e.url,U({seamless:s.seamless!==!1&&typeof MediaSource!="undefined"&&typeof MediaSource.isTypeSupported=="function"},e));u&&u.then?u.then(function(){n.emit(Et,{from:i,to:e})}):this.emit(Et,{from:i,to:e})}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(oe,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,i=C.NOT_ALLOW_AUTOPLAY,n=C.PLAYING,s=C.NO_START,u=C.PAUSED,l=C.REPLAY,f=C.ENTER,h=C.ENDED,d=C.ERROR,g=C.LOADING,p=[i,n,s,u,l,f,h,d,g];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,p.forEach(function(m){e.removeClass(m)}),this.addClass(C.NO_START),this.emit(tt)}},{key:"reset",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;this.resetState();var s=this.plugins;if(s&&(i.map(function(l){e.deregister(l)}),n)){var u=ri();Object.keys(this.config).keys(function(l){e.config[l]!=="undefined"&&(l==="plugins"||l==="presets"||l==="el"||l==="id")&&(e.config[l]=u[l])})}}},{key:"destroy",value:function(){var e,i=this,n=this.innerContainer,s=this.root,u=this.media;if(!(!s||!u)){if(this.hasStart=!1,this._useAutoplay=!1,s.removeAttribute(he),u.removeAttribute(he),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),c.clearAllTimers(this),this.emit(Rt),(e=le)===null||e===void 0||e.remove(this),W.destroy(this),zi(this),I(P(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),n)for(var l=n.children,f=0;f<l.length;f++)n.removeChild(l[f]);!n&&u instanceof window.Node&&s.contains(u)&&!this.config.remainMediaAfterDestroy&&s.removeChild(u),["topBar","leftBar","rightBar","innerContainer"].map(function(d){i[d]&&s.removeChild(i[d]),i[d]=null});var h=s.className.split(" ");h.length>0?s.className=h.filter(function(d){return d.indexOf("xgplayer")<0}).join(" "):s.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach(function(d){i[d]=!1})}}},{key:"replay",value:function(){var e=this;this.removeClass(C.ENDED),this.currentTime=0,this.isSeeking=!1,ne(this,"replay",function(){e.once(ae,function(){var i=e.mediaPlay();i&&i.catch&&i.catch(function(n){console.log(n)})}),e.emit(We),e.onPlay()})}},{key:"retry",value:function(){var e=this;this.removeClass(C.ERROR),this.addClass(C.LOADING),ne(this,"retry",function(){var i=e.currentTime,n=e.config.url,s=c.isMSE(e.media)?{url:n}:e.preProcessUrl(n);e.src=s.url,!e.config.isLive&&(e.currentTime=i),e.once(se,function(){e.mediaPlay()})})}},{key:"changeFullStyle",value:function(e,i,n,s){e&&(s||(s=C.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=c.filterStyleFromText(e)),c.addClass(e,n),i&&i!==e&&!this._orgPCss&&(this._orgPCss=c.filterStyleFromText(i),c.addClass(i,s),i.setAttribute(he,this.playerId)))}},{key:"recoverFullStyle",value:function(e,i,n,s){s||(s=C.PARENT_FULLSCREEN),this._orgCss&&(c.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),c.removeClass(e,n),i&&i!==e&&this._orgPCss&&(c.setStyleFromCsstext(i,this._orgPCss),this._orgPCss="",c.removeClass(i,s),i.removeAttribute(he))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget,i=this.root,n=this.media;(e==="video"||e==="media")&&(e=this[e]),e||(e=i),this._fullScreenOffset={top:c.scrollTop(),left:c.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get";var s=c.getFullScreenEl();if(s===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var u=0;u<$t.length;u++){var l=$t[u];if(e[l]){var f=l==="webkitRequestFullscreen"?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[l]();return f&&f.then?f:Promise.resolve()}}return n.fullscreenEnabled||n.webkitSupportsFullscreen?(n.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch(h){return Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),!(!this._fullscreenEl&&!c.getFullScreenEl())){this.root;var i=this.media;this._fullActionFrom="exit";try{for(var n=0;n<qt.length;n++){var s=qt[n];if(document[s]){var u=document[s]();return u&&u.then?u:Promise.resolve()}}return i&&i.webkitSupportsFullscreen?(i.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch(l){return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var i=e?"".concat(C.INNER_FULLSCREEN," ").concat(C.CSS_FULLSCREEN):C.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,i);var n=this.config.fullscreen,s=n===void 0?{}:n,u=s.useCssFullscreen===!0||typeof s.useCssFullscreen=="function"&&s.useCssFullscreen();u&&(this.fullscreen=!0,this.emit(re,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Ge,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(C.INNER_FULLSCREEN," ").concat(C.CSS_FULLSCREEN):C.CSS_FULLSCREEN;if(!this.fullscreen)this.recoverFullStyle(this.root,this._cssfullscreenEl,e);else{var i=this.config.fullscreen,n=i===void 0?{}:i,s=n.useCssFullscreen===!0||typeof n.useCssFullscreen=="function"&&n.useCssFullscreen();s?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(re,!1)):this.removeClass(e)}this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Ge,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var i=e?"".concat(C.INNER_FULLSCREEN," ").concat(C.ROTATE_FULLSCREEN):C.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,i,C.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(re,!0)}},{key:"exitRotateFullscreen",value:function(e){var i=this._fullscreenEl!==this.root?"".concat(C.INNER_FULLSCREEN," ").concat(C.ROTATE_FULLSCREEN):C.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,i,C.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(re,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){window.orientation===90||window.orientation===-90?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};if(this.isActive){this.onFocus(e);return}this.emit(At,U({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{ignorePaused:!1};if(!this.isActive){this.onBlur(e);return}this._clearUserTimer(),this.emit(Ii,U({paused:this.paused,ended:this.ended},e))}},{key:"onFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!0,delay:3e3},n=this.innerStates;if(this.isActive=!0,this.removeClass(C.INACTIVE),this._clearUserTimer(),i.isLock!==void 0&&(n.isActiveLocked=i.isLock),i.autoHide===!1||i.isLock===!0||n.isActiveLocked){this._clearUserTimer();return}var s=i&&i.delay?i.delay:this.config.inactive;this.userTimer=c.setTimeout(this,function(){e.userTimer=null,e.blur()},s)}},{key:"onBlur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=e.ignorePaused,n=i===void 0?!1:i;if(!this.innerStates.isActiveLocked){var s=this.config.closePauseVideoFocus;this.isActive=!1,(n||s||!this.paused&&!this.ended)&&this.addClass(C.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(C.ENTER),this.removeClass(C.ERROR),this.removeClass(C.LOADING),this.isCanplay=!0,this.waitTimer&&c.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){var e=this;this.isError=!1,this.isSeeking=!1,this.__startTime>0&&(this.duration>0?this._seekToStartTime():this.once(ue,function(){e._seekToStartTime()}))}},{key:"onLoadstart",value:function(){this.removeClass(C.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===N.ENDED&&this.setState(N.RUNNING),this.removeClass(C.PAUSED),this.ended&&this.removeClass(C.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(C.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(C.ENDED),this.setState(N.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(C.NOT_ALLOW_AUTOPLAY),this.removeClass(C.NO_START),this.removeClass(C.ENTER),this.removeClass(C.LOADING),this.addClass(C.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(C.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&c.clearTimeout(this,this.waitTimer),this.removeClass(C.LOADING),this.removeClass(C.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&c.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=c.setTimeout(this,function(){e.addClass(C.LOADING),e.emit(Ri),c.clearTimeout(e,e.waitTimer),e.waitTimer=null},this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1;var i=C.NO_START,n=C.PAUSED,s=C.ENDED,u=C.ERROR,l=C.REPLAY,f=C.LOADING,h=[i,n,s,u,l,f];h.forEach(function(d){e.removeClass(d)}),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(C.LOADING))&&this.media.readyState>2&&(this.removeClass(C.LOADING),c.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===N.NOTALLOW&&this.duration&&(this.setState(N.RUNNING),this.emit(ye)),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onVolumechange",value:function(){c.typeOf(this.config.volume)==="Number"&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,i,n){if(!(!this.media||!i||!e)){var s=c.typeOf(e)==="String"?e:e.type||"";n.props&&c.typeOf(n.props)!=="Array"&&(n.props=[n.props]),this.emit(Ye,U({eventType:s,action:i,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},n))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var i=new Date().getTime()-this._accPlayed.t;this._accPlayed.acc+=i,this._accPlayed.t=0,(e==="ended"||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{startDiff:0,endDiff:0},n=i||{},s=n.startDiff,u=s===void 0?0:s,l=n.endDiff,f=l===void 0?0:l,h=this.media.buffered;if(!h||h.length===0||!this.duration)return!0;for(var d=e||this.media.currentTime||.2,g=h.length,p=0;p<g;p++)if(h.start(p)+u<=d&&h.end(p)-f>d)return!0;return!1}},{key:"resizePosition",value:function(){var e=this,i=this.videoPos,n=i.vy,s=i.vx,u=i.h,l=i.w,f=this.videoPos.rotate;if(!(f<0&&u<0&&l<0)){var h=this.videoPos._pi;if(!h&&this.media.videoHeight&&(h=this.media.videoWidth/this.media.videoHeight*100),!!h){this.videoPos.pi=h,f=f<0?0:f;var d={rotate:f},g=0,p=0,m=1,_=Math.abs(f/90),b=this.root,T=this.innerContainer,k=b.offsetWidth,D=T?T.offsetHeight:b.offsetHeight,A={},B=D,M=k;if(_%2===0)m=u>0?100/u:l>0?100/l:1,d.scale=m,g=n>0?(100-u)/2-n:0,d.y=_===2?0-g:g,p=s>0?(100-l)/2-s:0,d.x=_===2?0-p:p,A.width="".concat(M,"px"),A.height="".concat(B,"px"),A.maxWidth="",A.maxHeight="";else if(_%2===1){M=D,B=k;var j=D-k;p=-j/2/M*100,d.x=_===3?p+n/2:p-n/2,g=j/2/B*100,d.y=_===3?g+s/2:g-s/2,d.scale=m,A.width="".concat(M,"px"),A.maxWidth="".concat(M,"px"),A.height="".concat(B,"px"),A.maxHeight="".concat(B,"px")}var V=c.getTransformStyle(d,this.media.style.transform||this.media.style.webkitTransform);A.transform=V,A.webkitTransform=V,Object.keys(A).map(function(R){e.media.style[R]=A[R]})}}}},{key:"position",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{h:0,y:0,x:0,w:0};if(!(!this.media||!e||!e.h)){var i=this.videoPos;i.h=e.h*100||0,i.w=e.w*100||0,i.vx=e.x*100||0,i.vy=e.y*100||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(n){if(n!=="plugins"){i.config[n]=e[n];var s=i.plugins[n.toLowerCase()];s&&c.typeOf(s.setConfig)==="Function"&&s.setConfig(e[n])}})}},{key:"playNext",value:function(e){var i=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,ne(this,"playnext",function(){i.start(),i.emit(Ke,e)})}},{key:"resize",value:function(){var e=this;if(this.media){var i=this.root.getBoundingClientRect();this.sizeInfo.width=i.width,this.sizeInfo.height=i.height,this.sizeInfo.left=i.left,this.sizeInfo.top=i.top;var n=this.media,s=n.videoWidth,u=n.videoHeight,l=this.config,f=l.fitVideoSize,h=l.videoFillMode;if((h==="fill"||h==="cover"||h==="contain")&&this.setAttribute("data-xgfill",h),!(!u||!s)){this._videoHeight=u,this._videoWidth=s;var d=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,g=i.width,p=i.height-d,m=parseInt(s/u*1e3,10),_=parseInt(g/p*1e3,10),b=g,T=p,k={};f==="auto"&&_>m||f==="fixWidth"?(T=g/m*1e3,this.config.fluid?k.paddingTop="".concat(T*100/b,"%"):k.height="".concat(T+d,"px")):(f==="auto"&&_<m||f==="fixHeight")&&(b=m*p/1e3,k.width="".concat(b,"px")),!this.fullscreen&&!this.cssfullscreen&&Object.keys(k).forEach(function(A){e.root.style[A]=k[A]}),(h==="fillHeight"&&_<m||h==="fillWidth"&&_>m)&&this.setAttribute("data-xgfill","cover");var D={videoScale:m,vWidth:b,vHeight:T,cWidth:b,cHeight:T+d};this.resizePosition(),this.emit(de,D)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(this.media.updateObjectPosition){this.media.updateObjectPosition(e,i);return}this.media.style.objectPosition="".concat(e*100,"% ").concat(i*100,"%")}},{key:"setState",value:function(e){O.logInfo("setState","state from:".concat(si[this.state]," to:").concat(si[e])),this._state=e}},{key:"preProcessUrl",value:function(e,i){var n=this.config,s=n.preProcessUrl,u=n.preProcessUrlOptions,l=Object.assign({},u,i);return!c.isBlob(e)&&typeof s=="function"?s(e,l):{url:e}}},{key:"_seekToStartTime",value:function(){this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime>this.duration?this.duration:this.__startTime,this.__startTime=-1)}},{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){typeof e=="boolean"&&(this._hasStart=e,e===!1&&this.setState(N.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===N.RUNNING||this._state===N.ENDED},set:function(e){e?this.setState(N.RUNNING):this._state>=N.RUNNING&&this.setState(N.ATTACHED)}},{key:"definitionList",get:function(){return!this.config||!this.config.definition?[]:this.config.definition.list||[]},set:function(e){var i=this,n=this.config.definition,s=null,u=null;n.list=e,this.emit("resourceReady",e),e.forEach(function(l){var f;((f=i.curDefinition)===null||f===void 0?void 0:f.definition)===l.definition&&(s=l),n.defaultDefinition===l.definition&&(u=l)}),!u&&e.length>0&&(u=e[0]),s?this.changeDefinition(s):u&&this.changeDefinition(u)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var i=this.media.getVideoPlaybackQuality();return e.dropped=i.droppedVideoFrames||0,e.total=i.totalVideoFrames||0,e.corrupted=i.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){var i=Pe.langKeys.filter(function(n){return n===e});if(i.length===0&&e!=="zh"){console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(Pe.langKeys.join(),"] "));return}this.config.lang=e,W.setLang(e,this)}},{key:"i18n",get:function(){var e=this.config.lang;return e==="zh"&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return Tt}},{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.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return I(P(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=I(P(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return I(P(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return this._fullScreenOffset!==null}},{key:"cumulateTime",get:function(){var e=this._accPlayed,i=e.acc,n=e.t;return n?new Date().getTime()-n+i:i}},{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=c.convertDeg(e),!(e%90!==0||e===this.videoPos.rotate)&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return oi},set:function(e){oi=e}},{key:"realTimeSpeed",get:function(){return ai},set:function(e){ai=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,i){return Xe.call.apply(Xe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,i){return $e.call.apply($e,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,i){return qe.call.apply(qe,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,i,n){for(var s=arguments.length,u=new Array(s>3?s-3:0),l=3;l<s;l++)u[l-3]=arguments[l];return Zt.call.apply(Zt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,i,n){for(var s=arguments.length,u=new Array(s>3?s-3:0),l=3;l<s;l++)u[l-3]=arguments[l];return Jt.call.apply(Jt,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,i){var n;typeof i=="boolean"&&i!==this.muted&&(this.addInnerOP("volumechange"),c.typeOf(i)===Boolean&&(this.muted=i)),(n=le)===null||n===void 0||n.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return O.config.debug},set:function(e){O.config.debug=e}},{key:"instManager",get:function(){return le},set:function(e){le=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return(e=le)===null||e===void 0?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,i){var n;(n=le)===null||n===void 0||n.setActive(e,i)}},{key:"isHevcSupported",value:function(){return L.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return L.probeConfigSupported(e)}},{key:"install",value:function(e,i){r.plugins||(r.plugins={}),r.plugins[e]||(r.plugins[e]=i)}},{key:"use",value:function(e,i){r.plugins||(r.plugins={}),r.plugins[e]=i}}]),r}(Bn);y(it,"defaultPreset",null);y(it,"XgVideoProxy",null);it.instManager=Yi.getInstance();function G(){return new Date().getTime()}var ce={LOAD_START:"loadstart",LOADED_DATA:"loadeddata",FIRST_FRAME:"firstFrame",WAIT_START:"waitingStart",WAIT_END:"waitingEnd",SEEK_START:"seekStart",SEEK_END:"seekEnd"},rr=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"_onTimeupdate",function(){t._state.isTimeUpdate=!0,t._state.autoplayStart&&(O.logInfo("[xgLogger]".concat(t.player.playerId," _onTimeupdate")),t._sendFF("onTimeupdate"))}),y(v(t),"_onAutoplayStart",function(){O.logInfo("[xgLogger]".concat(t.player.playerId," _onAutoplayStart")),t._state.autoplayStart=!0,t.vt&&t._sendFF("onAutoplayStart")}),y(v(t),"_onReset",function(){t._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},t.vt=0,t.pt=0,t.fvt=0,t.newPointTime=G(),t.loadedCostTime=0,t.startCostTime=0,t._isSeeking=!1,t.seekingStart=0,t.waitingStart=0,t.fixedWaitingStart=0,t._isWaiting=!1,t._waitTimer&&c.clearTimeout(v(t),t._waitTimer),t._waittTimer&&c.clearTimeout(v(t),t._waittTimer),t._waitTimer=null,t._waittTimer=null,t._waitType=0}),y(v(t),"_onSeeking",function(){t.seekingStart||(t.suspendWaitingStatus("seek"),t.seekingStart=G(),t.emitLog(ce.SEEK_START,{start:G()}))}),y(v(t),"_onSeeked",function(){t.suspendSeekingStatus("seeked")}),y(v(t),"_onWaitingLoadStart",function(){t._isWaiting||t.vt||(t._isWaiting=!0,t.waitingStart=G(),t.fixedWaitingStart=G(),t._waitType=1,t.emitLog(ce.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:1,endType:"loadstart"}))}),y(v(t),"_onWaiting",function(){t._isWaiting||!t.vt||(t._isWaiting=!0,t.vt?t.seekingStart?t._waitType=2:t._waitType=0:t._waitType=1,t.fixedWaitingStart=G(),t._waitTimer=c.setTimeout(v(t),function(){t._isWaiting&&(t.waitingStart=G(),c.clearTimeout(v(t),t._waitTimer),t._waitTimer=null,t._startWaitTimeout(),t.emitLog(ce.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:t._waitType,endType:t._waitType===2?"seek":"playing"}))},200))}),y(v(t),"_onError",function(){t.suspendSeekingStatus("error"),t.suspendWaitingStatus("error")}),y(v(t),"_onPlaying",function(){t._isWaiting&&t.suspendWaitingStatus("playing")}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=G(),this.loadedCostTime=0,this.startCostTime=0,this.on(It,function(){var i=e._state,n=i.autoplayStart,s=i.isFFSend;e.startCostTime=G()-e.newPointTime,O.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),"autoplayStart:".concat(n," isFFSend:").concat(s," startCostTime:").concat(e.startCostTime," newPointTime").concat(e.newPointTime)),!s&&(!i.isLs&&e.emitLog(ce.LOAD_START,{}),i.isLs=!0,i.isTimeUpdate=!1,i.isFFLoading=!0,e.pt=G(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())}),this.on(oe,function(){e.vt=G(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var i=e._state,n=i.isTimeUpdate,s=i.isFFSend,u=i.autoplayStart;O.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),"fvt:".concat(e.fvt," isTimeUpdate:").concat(e._state.isTimeUpdate," loadedCostTime:").concat(e.loadedCostTime)),(n||u)&&e._sendFF("loadedData"),s||e.emitLog(ce.LOADED_DATA,{}),e.suspendWaitingStatus("loadeddata")}),this.on(Je,this._onSeeking),this.on(ae,this._onSeeked),this.on(Rt,function(){e.endState("destroy")}),this.on(et,function(){e.endState("urlChange"),O.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()}),this.on([Pt,se],this._onPlaying),this.on(Oe,this._onWaiting),this.on(Re,this._onError),this.on(tt,function(){O.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()})}},{key:"_initOnceEvents",value:function(){this.off(ye,this._onAutoplayStart),this.off($,this._onTimeupdate),this.once(ye,this._onAutoplayStart),this.once($,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=G();var i=this._state,n=i.isFFLoading,s=i.isFFSend;O.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(n," !isFFSend:").concat(!s)),this.vt>0&&n&&!s&&(O.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(ce.FIRST_FRAME,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&c.clearTimeout(this,this._waittTimer),this._waittTimer=c.setTimeout(this,function(){e.suspendWaitingStatus("timeout"),c.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){if(this.seekingStart){var i=G(),n=i-this.seekingStart;this.seekingStart=0,this.emitLog(ce.SEEK_END,{end:i,costTime:n,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(c.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(c.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,!!this.waitingStart){var i=G(),n=i-this.waitingStart,s=i-this.fixedWaitingStart,u=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(ce.WAIT_END,{fixedCostTime:s>u?u:s,costTime:n>u?u:n,type:e==="loadeddata"?1:this._waitType,endType:this._waitType===2?"seek":e})}}},{key:"emitLog",value:function(e,i){var n=this.player;this.emit(Fi,U({t:G(),host:c.getHostFromUrl(n.currentSrc),vtype:n.vtype,eventType:e,currentTime:this.player.currentTime,readyState:n.video.readyState,networkState:n.video.networkState},i))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),r}(F);function sr(){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">
<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>
</svg>
`,"image/svg+xml").firstChild}var ar=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"registerIcons",value:function(){return{replay:sr}}},{key:"afterCreate",value:function(){var e=this;F.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",function(){e.player.replay()},{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(_e,function(){if(e.playerConfig.loop||c.addClass(e.player.root,"replay"),!e.config.disable){e.show();var i=e.root.querySelector("path");if(i){var n=window.getComputedStyle(i).getPropertyValue("transform");if(typeof n=="string"&&n.indexOf("none")>-1)return null;i.setAttribute("transform",n)}}}),this.on(q,function(){e.hide()})}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),c.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){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">
<xg-replay-txt class="xgplayer-replay-txt" lang-key="`.concat(this.i18nKeys.REPLAY,'">').concat(this.i18n.REPLAY,`</xg-replay-txt>
</xg-replay>`)}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),r}(F),or=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){c.addClass(this.root,"hide")}},{key:"show",value:function(e){c.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){typeof e.player.config.poster=="string"&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(_e,function(){e.isEndedShow&&c.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once($,function(){e.onTimeUpdate()}),this.on(et,function(){c.removeClass(e.root,"hide"),c.addClass(e.root,"xg-showplay"),e.once($,function(){e.onTimeUpdate()})})):this.on(q,function(){c.addClass(e.root,"hide")})}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(s){i.config[s]=e[s]});var n=this.config.poster;this.update(n)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?c.removeClass(this.root,"xg-showplay"):this.once($,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var i="";switch(e){case"cover":i="cover";break;case"contain":i="contain";break;case"fixHeight":i="auto 100%";break;default:i=""}return i?"background-size: ".concat(i,";"):""}},{key:"render",value:function(){var e=this.config,i=e.poster,n=e.hideCanplay,s=e.fillMode,u=e.notHidden,l=this.getBgSize(s),f=i?"background-image:url(".concat(i,");").concat(l):l,h=u?"xg-not-hidden":n?"xg-showplay":"";return'<xg-poster class="xgplayer-poster '.concat(h,'" style="').concat(f,`">
</xg-poster>`)}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),r}(F);function Nt(){return new DOMParser().parseFromString(`<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">
<path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>
</svg>
`,"image/svg+xml").firstChild}function Ft(){return new DOMParser().parseFromString(`<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">
<path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>
</svg>
`,"image/svg+xml").firstChild}var ie={};function ur(o,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{start:null,end:null};return ie[o]&&window.clearTimeout(ie[o].id),ie[o]={},r.start&&r.start(),ie[o].id=window.setTimeout(function(){r.end&&r.end(),window.clearTimeout(ie[o].id),delete ie[o]},a),ie[o].id}function ui(o){if(o){window.clearTimeout(o);return}Object.keys(ie).map(function(a){window.clearTimeout(ie[a].id),delete ie[a]})}var lr=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"onPlayerReset",function(){e.autoPlayStart=!1;var i=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),c.removeClass(e.root,i),e.show()}),y(v(e),"onAutoplayStart",function(){if(!e.autoPlayStart){var i=e.config.mode==="auto"?"auto-hide":"hide";c.addClass(e.root,i),e.autoPlayStart=!0,e.toggleTo("play")}}),e.autoPlayStart=!1,e}return S(r,[{key:"afterCreate",value:function(){var e=this.playerConfig;this.initIcons(),this.listenEvents(),this.bindClickEvents(),e.autoplay||this.show()}},{key:"listenEvents",value:function(){var e=this,i=this.player,n=this.playerConfig;this.once(Lt,function(){n&&(n.lang&&n.lang==="en"?c.addClass(i.root,"lang-is-en"):n.lang==="jp"&&c.addClass(i.root,"lang-is-jp"))}),this.on(ye,this.onAutoplayStart),this.on(Dt,function(){var s=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),c.removeClass(e.root,s),e.show()}),this.on(q,function(){e.toggleTo("play")}),this.on(Ie,function(){e.toggleTo("pause")}),this.on(tt,function(){e.onPlayerReset()})}},{key:"bindClickEvents",value:function(){var e=this;this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(n){n.cancelable&&n.preventDefault(),n.stopPropagation();var s=e.player.paused;e.emitUserAction(n,"switch_play_pause",{props:"paused",from:s,to:!s})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:Nt,class:"xg-icon-play"},startPause:{icon:Ft,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(){c.addClass(this.root,"hide")}},{key:"show",value:function(e){c.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){c.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){c.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 i=this;this._animateId=ur("pauseplay",400,{start:function(){c.addClass(i.root,"interact"),i.show(),i.switchStatus(!0)},end:function(){c.removeClass(i.root,"interact"),!e&&i.hide(),i._animateId=null}})}},{key:"endAnimate",value:function(){c.removeClass(this.root,"interact"),ui(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var i=this.player;if(e.cancelable&&e.preventDefault(),e.stopPropagation(),!(i.state<N.READY)){var n=this.player.paused;!n&&i.state===N.RUNNING?i.pause():i.play()}}},{key:"onPlayPause",value:function(e){this.toggleTo(e)}},{key:"toggleTo",value:function(e){var i=this.config,n=this.player;if(!(!n||n.state<N.RUNNING||!this.autoPlayStart)){if(i.mode==="show"){this.switchStatus(),this.show();return}if(i.mode==="auto"){this.switchStatus();return}if(i.isShowPause&&n.paused&&!n.ended||i.isShowEnd&&n.ended){this.switchStatus(),this.show(),this.endAnimate();return}if(i.disableAnimate){this.switchStatus(),this.hide();return}if(e==="play")this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||n.ended)return;this.animate()}}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),ui(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?this.config.mode==="auto"?"auto-hide":"hide":"";return`
<xg-start class="xgplayer-start `.concat(e,`">
<xg-start-inner></xg-start-inner>
</xg-start>`)}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),r}(F),cr=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"render",value:function(){var e=this.config.innerHtml,i=c.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)i.appendChild(e);else if(e&&typeof e=="string")i.innerHTML=e;else{for(var n="",s=1;s<=12;s++)n+='<div class="xgplayer-enter-bar'.concat(s,'"></div>');i.innerHTML='<div class="xgplayer-enter-spinner">'.concat(n,"</div>")}return i}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),r}(F);function pe(o,a,r){try{return' <div class="xg-tips '.concat(r?"hide":" ",'" lang-key="').concat(o.i18nKeys[a],`">
`).concat(o.i18n[a],`
</div>`)}catch(t){return'<div class="xg-tips hide"></div>'}}var li=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{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`
<xg-icon class="xgplayer-miniicon">
<div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="`.concat(this.i18nKeys[e],'">').concat(this.i18n[e],`</span></div>
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:10}}}]),r}(F);function ci(o){var a=parseFloat(o),r=o.indexOf("%")===-1&&!Number.isNaN(a);return r&&a}var Bt=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],Xi=Bt.length;function fr(){for(var o={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},a=0;a<Xi;a++){var r=Bt[a];o[r]=0}return o}function hr(o){var a=window.getComputedStyle(o);return a}function fi(o){if(typeof o=="string"&&(o=document.querySelector(o)),!(!o||z(o)!=="object"||!o.nodeType)){var a=hr(o);if(a.display==="none")return fr();var r={};r.width=o.offsetWidth,r.height=o.offsetHeight;for(var t=r.isBorderBox=a.boxSizing==="border-box",e=0;e<Xi;e++){var i=Bt[e],n=a[i],s=parseFloat(n);r[i]=Number.isNaN(s)?0:s}var u=r.paddingLeft+r.paddingRight,l=r.paddingTop+r.paddingBottom,f=r.marginLeft+r.marginRight,h=r.marginTop+r.marginBottom,d=r.borderLeftWidth+r.borderRightWidth,g=r.borderTopWidth+r.borderBottomWidth,p=t,m=ci(a.width);m!==!1&&(r.width=m+(p?0:u+d));var _=ci(a.height);return _!==!1&&(r.height=_+(p?0:l+g)),r.innerWidth=r.width-(u+d),r.innerHeight=r.height-(l+g),r.outerWidth=r.width+f,r.outerHeight=r.height+h,r}}function dt(o,a){for(var r=0;r<o.length;r++){var t=o[r];if(t.identifier===a)return t}}var gt={START:"dragStart",MOVE:"dragMove",ENDED:"dragEnded"},hi={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},dr=function(o){w(r,o);var a=x(r);function r(t){var e,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return E(this,r),e=a.call(this),e.isEnabled=!0,e.isDragging=!1,e.isDown=!1,e.position={},e.downPoint={},e.dragPoint={x:0,y:0},e.startPos={x:0,y:0},e._root=t instanceof Element?t:document.querySelector(t),e._handlerDom=i.handle instanceof Element?i.handle:document.querySelector(i.handle),!e._root||!e._handlerDom?xt(e):(e._bindStartEvent(),e)}return S(r,[{key:"_bindStartEvent",value:function(){var e=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)]),hi[this._startKey].map(function(i){e["on".concat(i)]=e["on".concat(i)].bind(e)})}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var i=this;if(e){var n=hi[this._startKey];n.map(function(s){window.addEventListener(s,i["on".concat(s)])}),this._boundPointerEvents=n}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map(function(i){window.removeEventListener(i,e["on".concat(i)])}),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 i=e.changedTouches[0];this.dragStart(e,i),this.touchIdentifier=i.pointerId!==void 0?i.pointerId:i.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var i=dt(e.changedTouches,this.touchIdentifier);i&&this.dragMove(e,i)}},{key:"ontouchend",value:function(e){var i=dt(e.changedTouches,this.touchIdentifier);i&&this.dragEnd(e,i),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var i=dt(e.changedTouches,this.touchIdentifier);i&&this.dragCancel(e,i)}},{key:"dragStart",value:function(e,i){if(!(!this._root||this.isDown||!this.isEnabled)){this.downPoint=i,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var n=fi(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-n.height,this.startPos.maxX=window.innerWidth-n.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,i){this.isDragging=!0,this.animate(),this.emit(gt.START,this.startPos)}},{key:"dragEnd",value:function(e,i){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(gt.ENDED)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,i){var n={x:i.pageX-this.downPoint.pageX,y:i.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(n)&&this.dragRealStart(e,i),n}},{key:"dragMove",value:function(e,i){if(e=e||window.event,!!this.isDown){var n=this.startPos,s=n.x,u=n.y,l=this._dragPointerMove(e,i),f=l.x,h=l.y;f=this.checkContain("x",f,s),h=this.checkContain("y",h,u),this.position.x=s+f,this.position.y=u+h,this.dragPoint.x=f,this.dragPoint.y=h,this.emit(gt.MOVE,this.position)}}},{key:"dragCancel",value:function(e,i){this.dragEnd(e,i)}},{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 Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,i,n){return i+n<0?0-n:e==="x"&&i+n>this.startPos.maxX?this.startPos.maxX-n:e==="y"&&i+n>this.startPos.maxY?this.startPos.maxY-n:i}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),i=this._getPositionCoord(e.left,"width"),n=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(i)?0:i,this.position.y=Number.isNaN(n)?0:n,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var i=e.transform;if(i.indexOf("matrix")===0){var n=i.split(","),s=i.indexOf("matrix3d")===0?12:4,u=parseInt(n[s],10),l=parseInt(n[s+1],10);this.position.x+=u,this.position.y+=l}}},{key:"_getPositionCoord",value:function(e,i){if(e.indexOf("%")!==-1){var n=fi(this._root.parentNode);return n?parseFloat(e)/100*n[i]:0}return parseInt(e,10)}}]),r}(Ei),gr=function(o){w(r,o);var a=x(r);function r(t){var e;E(this,r),e=a.call(this,t),y(v(e),"onCancelClick",function(s){e.exitMini(),e.isClose=!0}),y(v(e),"onCenterClick",function(s){var u=v(e),l=u.player;l.paused?l.play():l.pause()}),y(v(e),"onScroll",function(s){if(!(!window.scrollY&&window.scrollY!==0||Math.abs(window.scrollY-e.pos.scrollY)<50)){var u=parseInt(c.getCss(e.player.root,"height"));u+=e.config.scrollTop,e.pos.scrollY=window.scrollY,window.scrollY>u+5?!e.isMini&&!e.isClose&&e.getMini():window.scrollY<=u&&(e.isMini&&e.exitMini(),e.isClose=!1)}}),e.isMini=!1,e.isClose=!1;var i=v(e),n=i.config;return e.pos={left:n.left<0?window.innerWidth-n.width-20:n.left,top:n.top<0?window.innerHeight-n.height-20:n.top,height:e.config.height,width:e.config.width,scrollY:window.scrollY||0},e.lastStyle=null,e}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.mini=="boolean"&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(Ie,function(){e.setAttr("data-state","pause")}),this.on(q,function(){e.setAttr("data-state","play")})}},{key:"onPluginsReady",value:function(){var e=this,i=this.player,n=this.config;if(!n.disable){if(this.config.isShowIcon){var s={config:{onClick:function(){e.getMini()}}};i.controls.registerPlugin(li,s,li.pluginName)}var u=c.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",u,this.onCancelClick),this.bind(".play-icon",u,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new dr(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:Nt,class:"xg-icon-play"},pause:{icon:Ft,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=this;if(!this.isMini){var i=this.player,n=this.playerConfig,s=this.config.target||this.player.root;this.lastStyle={},c.addClass(i.root,"xgplayer-mini"),["width","height","top","left"].map(function(u){e.lastStyle[u]=s.style[u],s.style[u]="".concat(e.pos[u],"px")}),n.fluid&&(s.style["padding-top"]=""),this.emit(ze,!0),i.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var i=this.player,n=this.playerConfig,s=this.config.target||this.player.root;c.removeClass(i.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map(function(u){s.style[u]=e.lastStyle[u]}),this.lastStyle=null,n.fluid&&(i.root.style.width="100%",i.root.style.height="0",i.root.style["padding-top"]="".concat(n.height*100/n.width,"%")),this.emit(ze,!1),this.isMini=i.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=c.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`
<xg-mini-layer class="xg-mini-layer">
<xg-mini-header class="xgplayer-mini-header">
`.concat(pe(this,"MINI_DRAG",this.playerConfig.isHideTips),`
</xg-mini-header>
<div class="mini-cancel-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<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 1.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>
</svg>
</div>
<div class="play-icon">
</div>
</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}}}]),r}(F),Fe={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},pt=["videoClick","videoDbClick"],vt=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onMouseMove",function(s){var u=v(t),l=u.player,f=u.playerConfig;l.isActive||(l.focus({autoHide:!f.closeDelayBlur}),!f.closeFocusVideoFocus&&l.media.focus())}),y(v(t),"onMouseEnter",function(s){var u=v(t),l=u.playerConfig,f=u.player;!l.closeFocusVideoFocus&&f.media.focus(),l.closeDelayBlur?f.focus({autoHide:!1}):f.focus(),t.emit(Di)}),y(v(t),"onMouseLeave",function(s){var u=t.playerConfig,l=u.closePlayerBlur,f=u.leavePlayerTime,h=u.closeDelayBlur;!l&&!h&&(f?t.player.focus({autoHide:!0,delay:f}):t.player.blur({ignorePaused:!0})),t.emit(Li)}),y(v(t),"onVideoClick",function(s){var u=v(t),l=u.player,f=u.playerConfig;s.target&&f.closeVideoClick||(s.target===l.root||s.target===l.media||s.target===l.innerContainer||s.target===l.media.__canvas)&&(s.preventDefault(),f.closeVideoStopPropagation||s.stopPropagation(),t._clickCount++,t.clickTimer&&(clearTimeout(t.clickTimer),t.clickTimer=null),t.clickTimer=setTimeout(function(){t._clickCount&&(t._clickCount--,ne(v(t),pt[0],function(h,d){t.switchPlayPause(d.e)},{e:s,paused:l.paused}),clearTimeout(t.clickTimer),t.clickTimer=null)},300))}),y(v(t),"onVideoDblClick",function(s){var u=v(t),l=u.player,f=u.playerConfig;if(!(f.closeVideoDblclick||!s.target||s.target!==l.media&&s.target!==l.media.__canvas)){if(!f.closeVideoClick&&t._clickCount<2){t._clickCount=0;return}t._clickCount=0,t.clickTimer&&(clearTimeout(t.clickTimer),t.clickTimer=null),s.preventDefault(),s.stopPropagation(),ne(v(t),pt[1],function(h,d){t.emitUserAction(d.e,"switch_fullscreen",{props:"fullscreen",from:l.fullscreen,to:!l.fullscreen}),l.fullscreen?l.exitFullscreen():l.getFullscreen()},{e:s,fullscreen:l.fullscreen})}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,pt.map(function(n){e.__hooks[n]=null});var i=this.playerConfig.isMobileSimulateMode;i==="mobile"||L.device==="mobile"&&!L.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,i=this.player,n=i.media,s=i.root,u=this.playerConfig.enableContextmenu;s&&s.addEventListener("click",this.onVideoClick,!1),s&&s.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(Fe).map(function(l){s.addEventListener(l,e[Fe[l]],!1)}),!u&&n&&n.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var i=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:i.paused,to:!i.paused}),i.ended?i.duration!==1/0&&i.duration>0&&i.replay():i.paused?i.play():i.pause()}},{key:"onContextmenu",value:function(e){e=e||window.event,e.preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,i=this.player,n=i.video,s=i.root;this.clickTimer&&clearTimeout(this.clickTimer),s.removeEventListener("click",this.onVideoClick,!1),s.removeEventListener("dblclick",this.onVideoDblClick,!1),n.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(Fe).map(function(u){s.removeEventListener(u,e[Fe[u]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(ge),fe={PRESS:"press",PRESS_END:"pressend",DOUBlE_CLICK:"doubleclick",CLICK:"click",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend"},pr={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},vr={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function di(o){return o&&o.length>0?o[o.length-1]:null}function mr(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var yr=function(){function o(a){var r=this,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{eventType:"touch"};E(this,o),y(this,"onTouchStart",function(e){var i=r._pos,n=r.root,s=di(e.touches);i.x=s?parseInt(s.pageX,10):e.pageX,i.y=s?parseInt(s.pageX,10):e.pageX,i.start=!0,r.__setPress(e),n.addEventListener(r.events.end,r.onTouchEnd),n.addEventListener(r.events.cancel,r.onTouchCancel),n.addEventListener(r.events.move,r.onTouchMove),r.trigger(fe.TOUCH_START,e)}),y(this,"onTouchCancel",function(e){r.onTouchEnd(e)}),y(this,"onTouchEnd",function(e){var i=r._pos,n=r.root;r.__clearPress(),n.removeEventListener(r.events.cancel,r.onTouchCancel),n.removeEventListener(r.events.end,r.onTouchEnd),n.removeEventListener(r.events.move,r.onTouchMove),e.moving=i.moving,e.press=i.press,i.press&&r.trigger(fe.PRESS_END,e),r.trigger(fe.TOUCH_END,e),!i.press&&!i.moving&&r.__setDb(e),i.press=!1,i.start=!1,i.moving=!1}),y(this,"onTouchMove",function(e){var i=r._pos,n=r.config,s=di(e.touches),u=s?parseInt(s.pageX,10):e.pageX,l=s?parseInt(s.pageY,10):e.pageX,f=u-i.x,h=l-i.y;Math.abs(h)<n.miniStep&&Math.abs(f)<n.miniStep||(r.__clearPress(),i.press&&r.trigger(fe.PRESS_END,e),i.press=!1,i.moving=!0,r.trigger(fe.TOUCH_MOVE,e))}),this._pos={moving:!1,start:!1,x:0,y:0},this.config=mr(),Object.keys(t).map(function(e){r.config[e]=t[e]}),this.root=a,this.events=t.eventType==="mouse"?vr:pr,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return S(o,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(r){var t=this,e=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout(function(){t.trigger(fe.PRESS,r),t._pos.press=!0,t.__clearPress()},e.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(r){var t=this,e=this.config;if(this.dbIntrvalId){this.__clearDb(),this.trigger(fe.DOUBlE_CLICK,r);return}this.dbIntrvalId=setTimeout(function(){t.__clearDb(),!t._pos.start&&!t._pos.press&&!t._pos.moving&&t.trigger(fe.CLICK,r)},e.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(r,t){this.__handlers[r]||(this.__handlers[r]=[]),this.__handlers[r].push(t)}},{key:"off",value:function(r,t){if(this.__handlers[r]){for(var e=this.__handlers[r],i=-1,n=0;n<e.length;n++)if(e[n]===t){i=n;break}i>=0&&this.__handlers[r].splice(i,1)}}},{key:"trigger",value:function(r,t){this.__handlers[r]&&this.__handlers[r].map(function(e){try{e(t)}catch(i){console.error("trigger>>:".concat(r),i)}})}},{key:"destroy",value:function(){var r=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).forEach(function(e){r.root.removeEventListener(e,r[t[e]])})}}]),o}();function _r(){return new DOMParser().parseFromString(`<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<path opacity="0.54"
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" />
<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"/>
</svg>`,"image/svg+xml").firstChild}var Te={AUTO:"auto",SEEKING:"seeking",PLAYBACK:"playbackrate"},mt=["videoClick","videoDbClick"],Cr=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"onTouchStart",function(i){var n=v(e),s=n.player,u=n.config,l=n.pos,f=n.playerConfig,h=e.getTouche(i);if(h&&!u.disableGesture&&e.duration>0&&!s.ended){l.isStart=!0,e.timer&&clearTimeout(e.timer),c.checkIsFunction(f.disableSwipeHandler)&&f.disableSwipeHandler(),e.find(".xg-dur").innerHTML=c.format(e.duration);var d=e.root.getBoundingClientRect();s.rotateDeg===90?(l.top=d.left,l.left=d.top,l.width=d.height,l.height=d.width):(l.top=d.top,l.left=d.left,l.width=d.width,l.height=d.height);var g=parseInt(h.pageX-l.left,10),p=parseInt(h.pageY-l.top,10);l.x=s.rotateDeg===90?p:g,l.y=s.rotateDeg===90?g:p,l.scopeL=u.scopeL*l.width,l.scopeR=(1-u.scopeR)*l.width,l.scopeM1=l.width*(1-u.scopeM)/2,l.scopeM2=l.width-l.scopeM1}}),y(v(e),"onTouchMove",function(i){var n=e.getTouche(i),s=v(e),u=s.pos,l=s.config,f=s.player;if(!(!n||l.disableGesture||!e.duration||!u.isStart)){var h=l.miniMoveStep,d=l.hideControlsActive,g=parseInt(n.pageX-u.left,10),p=parseInt(n.pageY-u.top,10),m=f.rotateDeg===90?p:g,_=f.rotateDeg===90?g:p;if(Math.abs(m-u.x)>h||Math.abs(_-u.y)>h){var b=m-u.x,T=_-u.y,k=u.scope;if(k===-1&&(k=e.checkScope(m,_,b,T,u),k===0&&(d?f.blur():f.focus({autoHide:!1}),!u.time&&(u.time=parseInt(f.currentTime*1e3,10)+e.timeOffset*1e3)),u.scope=k),k===-1||k>0&&!l.gestureY||k===0&&!l.gestureX)return;e.executeMove(b,T,k,u.width,u.height),u.x=m,u.y=_}}}),y(v(e),"onTouchEnd",function(i){var n=v(e),s=n.player,u=n.pos,l=n.playerConfig;if(setTimeout(function(){s.getPlugin("progress")&&s.getPlugin("progress").resetSeekState()},10),!!u.isStart){u.scope>-1&&i.cancelable&&i.preventDefault();var f=e.config,h=f.disableGesture,d=f.gestureX;!h&&d?e.endLastMove(u.scope):u.time=0,u.scope=-1,e.resetPos(),c.checkIsFunction(l.enableSwipeHandler)&&l.enableSwipeHandler(),e.changeAction(Te.AUTO)}}),y(v(e),"onRootTouchMove",function(i){e.config.disableGesture||!e.config.gestureX||e.checkIsRootTarget(i)&&(i.stopPropagation(),e.pos.isStart?e.onTouchMove(i):e.onTouchStart(i))}),y(v(e),"onRootTouchEnd",function(i){e.pos.scope>-1&&e.onTouchEnd(i)}),e.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},e.timer=null,e}return S(r,[{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:_r,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this;mt.map(function(d){e.__hooks[d]=null});var i=this.playerConfig,n=this.config,s=this.player;i.closeVideoDblclick===!0&&(n.closedbClick=!0),this.resetPos(),c.isUndefined(i.disableGesture)||(n.disableGesture=!!i.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=c.createDom("xg-mask","",{},"xgmask"),s.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var u=this.domEventType==="mouse"?"mouse":"touch";this.touch=new yr(this.root,{eventType:u,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(d){d.preventDefault()}),s.root.addEventListener("touchmove",this.onRootTouchMove,!0),s.root.addEventListener("touchend",this.onRootTouchEnd,!0),s.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var l=this.player.controls;l&&l.center&&(l.center.addEventListener("touchmove",this.onRootTouchMove,!0),l.center.addEventListener("touchend",this.onRootTouchEnd,!0),l.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(ue,function(){var d=e.player,g=e.config;d.duration>0&&d.duration*1e3<g.moveDuration&&(g.moveDuration=d.duration*1e3)}),this.on([se,_e],function(){var d=e.pos,g=d.time,p=d.isStart;!p&&g>0&&(e.pos.time=0)});var f={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(f).map(function(d){e.touch.on(d,function(g){e[f[d]](g)})}),!n.disableActive){var h=s.plugins.progress;h&&(h.addCallBack("dragmove",function(d){e.activeSeekNote(d.currentTime,d.forward)}),["dragend","click"].forEach(function(d){h.addCallBack(d,function(){e.changeAction(Te.AUTO)})}))}}},{key:"registerThumbnail",value:function(){var e=this.player,i=e.plugins.thumbnail;if(i&&i.usable){this.thumbnail=i.createThumbnail(null,"mobile-thumbnail");var n=this.find(".time-preview");n.insertBefore(this.thumbnail,n.children[0])}}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,n=i.playedColor,s=i.progressColor,u=i.timePreviewStyle,l=i.curTimeColor,f=i.durationColor;if(n&&(this.find(".xg-curbar").style.backgroundColor=n),s&&(this.find(".xg-bar").style.backgroundColor=s),u){var h=this.find(".time-preview");Object.keys(u).forEach(function(p){h.style[p]=u[p]})}var d=l||n,g=f;d&&(this.find(".xg-cur").style.color=d),g&&(this.find(".xg-dur").style.color=g),this.config.disableTimeProgress&&c.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map(function(i){e.pos[i]=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 i=this.player,n=this.root;n.setAttribute("data-xg-action",e);var s=i.plugins.start;s&&s.recover()}},{key:"getTouche",value:function(e){var i=this.player.rotateDeg,n=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return i===0?{pageX:n.pageX,pageY:n.pageY}:{pageX:n.pageX,pageY:n.pageY}}},{key:"checkScope",value:function(e,i,n,s,u){var l=u.width,f=-1;if(e<0||e>l)return f;var h=Math.abs(s===0?n:n/s);return Math.abs(n)>0&&h>=1.73&&e>u.scopeM1&&e<u.scopeM2?f=0:(Math.abs(n)===0||h<=.57)&&(f=e<u.scopeL?1:e>u.scopeR?2:3),f}},{key:"executeMove",value:function(e,i,n,s,u){switch(n){case 0:this.updateTime(e/s*this.config.scopeM);break;case 1:this.updateBrightness(i/u);break;case 2:L.os.isIos||this.updateVolume(i/u);break}}},{key:"endLastMove",value:function(e){var i=this,n=this.pos,s=this.player,u=this.config,l=(n.time-this.timeOffset)/1e3;switch(e){case 0:s.seek(Number(l).toFixed(1)),u.hideControlsEnd?s.blur():s.focus(),this.timer=setTimeout(function(){i.pos.time=0},500);break}this.changeAction(Te.AUTO)}},{key:"checkIsRootTarget",value:function(e){var i=this.player.plugins||{};return i.progress&&i.progress.root.contains(e.target)?!1:i.start&&i.start.root.contains(e.target)||i.controls&&i.controls.root.contains(e.target)}},{key:"sendUseAction",value:function(e){var i=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i,to:!i})}},{key:"clickHandler",value:function(e){var i=this.player,n=this.config,s=this.playerConfig;if(i.state<N.RUNNING){s.closeVideoClick||(this.sendUseAction(c.createEvent("click")),i.play());return}!n.closedbClick||s.closeVideoClick?i.isActive?i.blur():i.focus():s.closeVideoClick||((i.isActive||n.focusVideoClick)&&(this.sendUseAction(c.createEvent("click")),this.switchPlayPause()),i.focus())}},{key:"dbClickHandler",value:function(e){var i=this.config,n=this.player;!i.closedbClick&&n.state>=N.RUNNING&&(this.sendUseAction(c.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var i=this,n=this.player;ne(this,mt[0],function(s,u){i.clickHandler(u.e)},{e,paused:n.paused})}},{key:"onDbClick",value:function(e){var i=this,n=this.player;ne(this,mt[1],function(s,u){i.dbClickHandler(u.e)},{e,paused:n.paused})}},{key:"onPress",value:function(e){var i=this.pos,n=this.config,s=this.player;n.disablePress||(i.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:s.playbackRate,to:n.pressRate}),s.playbackRate=n.pressRate,this.changeAction(Te.PLAYBACK))}},{key:"onPressEnd",value:function(e){var i=this.pos,n=this.config,s=this.player;n.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:s.playbackRate,to:i.rate}),s.playbackRate=i.rate,i.rate=1,this.changeAction(Te.AUTO))}},{key:"updateTime",value:function(e){var i=this.player,n=this.config,s=this.player.duration;e=Number(e.toFixed(4));var u=parseInt(e*n.moveDuration,10)+this.timeOffset;u+=this.pos.time,u=u<0?0:u>s*1e3?s*1e3-200:u,i.getPlugin("time")&&i.getPlugin("time").updateTime(u/1e3),i.getPlugin("progress")&&i.getPlugin("progress").updatePercent(u/1e3/this.duration,!0),this.activeSeekNote(u/1e3,e>0),n.isTouchingSeek&&i.seek(Number((u-this.timeOffset)/1e3).toFixed(1)),this.pos.time=u}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var i=this.player,n=this.pos;if(e=parseInt(e*100,10),n.volume+=e,!(Math.abs(n.volume)<10)){var s=parseInt(i.volume*10,10)-parseInt(n.volume/10,10);s=s>10?10:s<1?0:s,i.volume=s/10,n.volume=0}}},{key:"updateBrightness",value:function(e){var i=this.pos,n=this.config,s=this.xgMask;if(n.darkness){this.player.rotateDeg&&(e=-e);var u=i.light+.8*e;u=u>n.maxDarkness?n.maxDarkness:u<0?0:u,s&&(s.style.backgroundColor="rgba(0,0,0,".concat(u,")")),i.light=u}}},{key:"activeSeekNote",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.player,s=this.config,u=!(this.duration!==1/0&&this.duration>0);if(!(!e||typeof e!="number"||u||s.disableActive)){e<0?e=0:e>n.duration&&(e=n.duration-.2),this.changeAction(Te.SEEKING);var l=n.plugins.start;l&&l.focusHide(),this.find(".xg-dur").innerHTML=c.format(this.duration),this.find(".xg-cur").innerHTML=c.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),i?c.removeClass(this.find(".xg-seek-show"),"xg-back"):c.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var i=this.player,n=i.plugins.thumbnail;n&&n.usable&&this.thumbnail&&n.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<N.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!0}},{key:"enableGesture",value:function(){this.config.disableGesture=!1}},{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),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var i=this.player.controls;i&&i.center&&(i.center.removeEventListener("touchmove",this.onRootTouchMove,!0),i.center.removeEventListener("touchend",this.onRootTouchEnd,!0),i.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e=this.config.gradient!=="normal"?"gradient ".concat(this.config.gradient):"gradient";return`
<xg-trigger class="trigger">
<div class="`.concat(e,`"></div>
<div class="time-preview">
<div class="xg-seek-show `).concat(this.config.disableSeekIcon?" hide-seek-icon":"",`">
<i class="xg-seek-icon"></i>
<span class="xg-cur">00:00</span>
<span class="xg-separator">/</span>
<span class="xg-dur">00:00</span>
</div>
<div class="xg-bar xg-timebar">
<div class="xg-curbar"></div>
</div>
</div>
<div class="xg-playbackrate xg-top-note">
<span><i>`).concat(this.config.pressRate,"X</i>").concat(this.i18n.FORWARD,`</span>
</div>
</xg-trigger>
`)}}],[{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:60*6*1e3,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),r}(F);function kr(o){o.preventDefault(),o.returnValue=!1}function gi(o){var a=o.tagName;return!!(a==="INPUT"||a==="TEXTAREA"||o.isContentEditable)}var pi=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onBodyKeyDown",function(s){if(t.player){var u=s||window.event,l=u.keyCode,f=v(t),h=f._keyState,d=f.player,g=t.config,p=g.disable,m=g.disableBodyTrigger,_=g.isIgnoreUserActive;if(p||m||!(d.isUserActive||_)||gi(u.target)||!t.checkIsVisible()||u.metaKey||u.altKey||u.ctrlKey){h.isBodyKeyDown=!1;return}!s.repeat&&!h.isKeyDown&&((u.target===document.body||t.config.isGlobalTrigger&&!gi(u.target))&&t.checkCode(l,!0)&&(h.isBodyKeyDown=!0),document.addEventListener("keyup",t.onBodyKeyUp)),h.isBodyKeyDown&&t.handleKeyDown(u)}}),y(v(t),"onBodyKeyUp",function(s){t.player&&(document.removeEventListener("keyup",t.onBodyKeyUp),t.handleKeyUp(s))}),y(v(t),"onKeydown",function(s){if(t.player){var u=s||window.event,l=v(t),f=l._keyState;if(!u.repeat){if(t.config.disable||t.config.disableRootTrigger||u.metaKey||u.altKey||u.ctrlKey)return;u&&(u.keyCode===37||t.checkCode(u.keyCode))&&(u.target===t.player.root||u.target===t.player.video||u.target===t.player.controls.el)&&(f.isKeyDown=!0),t.player.root.addEventListener("keyup",t.onKeyup)}f.isKeyDown&&t.handleKeyDown(u)}}),y(v(t),"onKeyup",function(s){t.player&&(t.player.root.removeEventListener("keyup",t.onKeyup),t.handleKeyUp(s))}),t}return S(r,[{key:"mergekeyCodeMap",value:function(){var e=this,i=this.config.keyCodeMap;i&&Object.keys(i).map(function(n){e.keyCodeMap[n]?["keyCode","action","disable","pressAction","disablePress","isBodyTarget"].map(function(s){i[n][s]&&(e.keyCodeMap[n][s]=i[n][s])}):e.keyCodeMap[n]=i[n]})}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e=typeof this.config.seekStep=="function"?this.config.seekStep(this.player):this.config.seekStep;!e||typeof e!="number"||(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!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:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(n){i.config[n]=e[n]})}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),i=e.height,n=e.top,s=e.bottom,u=window.innerHeight;return!(n<0&&n<0-i*.9||s>0&&s-u>i*.9)}},{key:"checkCode",value:function(e,i){var n=this,s=!1;return Object.keys(this.keyCodeMap).map(function(u){n.keyCodeMap[u]&&e===n.keyCodeMap[u].keyCode&&!n.keyCodeMap[u].disable&&(s=!i||i&&!n.keyCodeMap[u].noBodyTarget)}),s}},{key:"downVolume",value:function(e){var i=this.player;if(!(i.volume<=0)){var n=parseFloat((i.volume-.1).toFixed(1)),s={volume:{from:i.volume,to:n}};this.emitUserAction(e,"change_volume",{props:s}),n>=0?i.volume=n:i.volume=0}}},{key:"upVolume",value:function(e){var i=this.player;if(!(i.volume>=1)){var n=parseFloat((i.volume+.1).toFixed(1)),s={volume:{from:i.volume,to:n}};this.emitUserAction(e,"change_volume",{props:s}),n<=1?i.volume=n:i.volume=1}}},{key:"seek",value:function(e){var i=this.player,n=i.currentTime,s=i.offsetCurrentTime,u=i.duration,l=i.offsetDuration,f=i.timeSegments,h=s>-1?s:n,d=l||u,g=e.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;h+g<=d?h=h+g:h=d;var p=c.getCurrentTimeByOffset(h,f),m={currentTime:{from:n,to:p}};this.emitUserAction(e,"seek",{props:m}),this.player.currentTime=p}},{key:"seekBack",value:function(e){var i=this.player,n=i.currentTime,s=i.offsetCurrentTime,u=i.timeSegments,l=e.repeat?parseInt(this.seekStep/2,10):this.seekStep,f=s>-1?s:n,h=f-l;h<0&&(h=0),h=c.getCurrentTimeByOffset(h,u);var d={currentTime:{from:n,to:h}};this.emitUserAction(e,"seek",{props:d}),this.player.currentTime=h}},{key:"changePlaybackRate",value:function(e){var i=this._keyState,n=this.config,s=this.player;i.playbackRate===0&&(i.playbackRate=s.playbackRate,s.playbackRate=n.playbackRate)}},{key:"playPause",value:function(e){var i=this.player;i&&(this.emitUserAction(e,"switch_play_pause"),i.paused?i.play():i.pause())}},{key:"exitFullscreen",value:function(e){var i=this.player,n=i.fullscreen,s=i.cssfullscreen;n&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:n,to:!n}),i.exitFullscreen()),s&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:s,to:!s}),i.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var i=this._keyState;if(e.repeat){i.isPress=!0;var n=Date.now();if(n-i.tt<200)return;i.tt=n}this.handleKeyCode(e.keyCode,e,i.isPress)}},{key:"handleKeyUp",value:function(e){var i=this._keyState;i.playbackRate>0&&(this.player.playbackRate=i.playbackRate,i.playbackRate=0),i.isKeyDown=!1,i.isPress=!1,i.tt=0}},{key:"handleKeyCode",value:function(e,i,n){for(var s=Object.keys(this.keyCodeMap),u=0;u<s.length;u++){var l=this.keyCodeMap[s[u]],f=l.action,h=l.keyCode,d=l.disable,g=l.pressAction,p=l.disablePress;if(h===e){if(!d&&!(n&&p)){var m=n&&g||f;typeof m=="function"?f(i,this.player,n):typeof m=="string"&&typeof this[m]=="function"&&this[m](i,this.player,n),this.emit(Ni,U({key:s[u],target:i.target,isPress:n},this.keyCodeMap[s[u]]))}kr(i),i.stopPropagation();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:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),r}(ge);function Tr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">
<path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>
</svg>
`,"image/svg+xml").firstChild}var br=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"registerIcons",value:function(){return{loadingIcon:Tr}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return`
<xg-loading class="xgplayer-loading">
<xg-loading-inner></xg-loading-inner>
</xg-loading>`}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:H.ROOT}}}]),r}(F),Er=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],Sr=function(){function o(a){E(this,o),this.fragments=a.fragments||[],this.fragments.length===0&&this.fragments.push({percent:1}),this._callBack=a.actionCallback,this.fragConfig={fragFocusClass:a.fragFocusClass||"inner-focus-point",fragAutoFocus:!!a.fragAutoFocus,fragClass:a.fragClass||""},this.style=a.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return S(o,[{key:"updateDuration",value:function(r){var t=this;this.duration=r;var e=0,i=this.fragments;this.fragments=i.map(function(n){return n.start=parseInt(e,10),n.end=parseInt(e+n.percent*t.duration,10),n.duration=parseInt(n.percent*t.duration,10),e+=n.percent*t.duration,n})}},{key:"updateProgress",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"played",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},e=this.progressList,i=this.fragments;if(!(e.length<1)){var n=t.newIndex,s=t.curIndex,u=t.millisecond;n!==s&&e.map(function(h,d){d<n?h[r].style.width="100%":d>n&&(h[r].style.width=0)});var l=i[n],f=u===0?0:(u-l.start)/l.duration;e[n][r].style.width=f<0?0:"".concat(f*100,"%")}}},{key:"updateFocus",value:function(r){if(!(!this.fragConfig.fragAutoFocus||this.fragments.length<2)){if(!r){if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var t={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(t),this.focusIndex=-1}return}var e=this.findIndex(r.currentTime*1e3,this.focusIndex);if(e>=0&&e!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(e);var i={index:e,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=e,this._callBack&&this._callBack(i)}}}},{key:"update",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(t*1e3,10)!==this.duration){if(!t&&t!==0)return;this.updateDuration(parseInt(t*1e3,10))}var e=this.playedIndex,i=this.cachedIndex;if(c.typeOf(r.played)!=="Undefined"){var n=this.findIndex(r.played*1e3,e);if(n<0)return;this.updateProgress("played",{newIndex:n,curIndex:e,millisecond:parseInt(r.played*1e3,10)}),this.playedIndex=n}if(c.typeOf(r.cached)!=="Undefined"){var s=this.findIndex(r.cached*1e3,i);if(s<0)return;this.updateProgress("cached",{newIndex:s,curIndex:i,millisecond:parseInt(r.cached*1e3,10)}),this.cachedIndex=s}}},{key:"findIndex",value:function(r,t){var e=this.fragments;if(!e||e.length===0)return-1;if(e.length===1)return 0;if(t>-1&&t<e.length&&r>e[t].start&&r<e[t].end)return t;if(r>e[e.length-1].start)return e.length-1;for(var i=0;i<e.length;i++)if(r>e[i].start&&r<=e[i].end){t=i;break}return t}},{key:"findHightLight",value:function(){for(var r=this.root.children,t=0;t<r.length;t++)if(c.hasClass(r[t],this.fragConfig.fragFocusClass))return{dom:r[t],pos:r[t].getBoundingClientRect()}}},{key:"findFragment",value:function(r){var t=this.root.children;return r<0||r>=t.length?null:{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var r=this.root.children,t=0;t<r.length;t++)c.removeClass(r[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(r){var t=this.root.children;if(r<t.length)return c.addClass(t[r],this.fragConfig.fragFocusClass),{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(r){var t=this;if(Object.keys(this.fragConfig).forEach(function(i){r[i]!==void 0&&(t.fragConfig[i]=r[i])}),r.fragments){if(this.fragments=r.fragments.length===0?[{percent:1}]:r.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var e=this.root.children;e.length>0;)this.root.removeChild(e[0]);this.render()}}},{key:"render",value:function(){var r=this,t=this.style.progressColor;if(this.root||(this.root=c.createDom("xg-inners","",{},"progress-list")),this.fragments){var e=this.fragConfig,i=e.fragClass,n=e.fragFocusClass;this.progressList=this.fragments.map(function(s){var u=c.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(s.percent):"flex: ".concat(s.percent)},"".concat(s.isFocus?n:""," xgplayer-progress-inner ").concat(i));return r.root.appendChild(u),Er.forEach(function(l){u.appendChild(c.createDom(l.tag,"",{style:l.styleKey?"background: ".concat(r.style[l.styleKey],"; width:0;"):"width:0;"},l.className))}),{cached:u.children[0],played:u.children[1]}})}return this.root}}]),o}(),vi={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},wr=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"onMoveOnly",function(i,n){var s=v(e),u=s.pos,l=s.config,f=s.player,h=n;if(i){c.event(i);var d=c.getEventPos(i,f.zoom),g=f.rotateDeg===90?d.clientY:d.clientX;if(u.moving&&Math.abs(u.x-g)<l.miniMoveStep)return;u.moving=!0,u.x=g,h=e.computeTime(i,g)}e.triggerCallbacks("dragmove",h,i),e._updateInnerFocus(h)}),y(v(e),"onBodyClick",function(i){e.pos.isLocked&&(e.pos.isLocked=!1,i.preventDefault(),i.stopPropagation())}),y(v(e),"_mouseDownHandler",function(i,n){e._state.time=n.currentTime,e.updateWidth(n.currentTime,n.seekTime,n.percent,0),e._updateInnerFocus(n)}),y(v(e),"_mouseUpHandler",function(i,n){var s=v(e),u=s.pos;u.moving&&e.updateWidth(n.currentTime,n.seekTime,n.percent,2)}),y(v(e),"_mouseMoveHandler",function(i,n){var s=v(e),u=s._state,l=s.pos,f=s.config,h=s.player;u.time<n.currentTime?n.forward=!0:n.forward=!1,u.time=n.currentTime,l.isDown&&!l.moving&&(l.moving=!0,f.isPauseMoving&&h.pause(),e.triggerCallbacks("dragstart",n,i),e.emitUserAction("drag","dragstart",n)),e.updateWidth(n.currentTime,n.seekTime,n.percent,1),e.triggerCallbacks("dragmove",n,i),e._updateInnerFocus(n)}),y(v(e),"onMouseDown",function(i){var n=v(e),s=n._state,u=n.player,l=n.pos,f=n.config,h=n.playerConfig,d=c.getEventPos(i,u.zoom),g=u.rotateDeg===90?d.clientY:d.clientX;if(!(u.isMini||f.closeMoveSeek||!h.allowSeekAfterEnded&&u.ended)){if(!u.duration&&!u.isPlaying){u.play();return}i.stopPropagation(),e.focus(),c.checkIsFunction(h.disableSwipeHandler)&&h.disableSwipeHandler(),c.checkIsFunction(f.onMoveStart)&&f.onMoveStart(),c.event(i),l.x=g,l.isDown=!0,l.moving=!1,s.prePlayTime=u.currentTime,u.focus({autoHide:!1}),e.isProgressMoving=!0,c.addClass(e.progressBtn,"active");var p=e.computeTime(i,g);p.prePlayTime=s.prePlayTime,e._mouseDownHandlerHook(i,p);var m=i.type;return m==="touchstart"?(e.root.addEventListener("touchmove",e.onMouseMove),e.root.addEventListener("touchend",e.onMouseUp),e.root.addEventListener("touchcancel",e.onMouseUp)):(e.unbind("mousemove",e.onMoveOnly),document.addEventListener("mousemove",e.onMouseMove,!1),document.addEventListener("mouseup",e.onMouseUp,!1)),!0}}),y(v(e),"onMouseUp",function(i){var n=v(e),s=n.player,u=n.config,l=n.pos,f=n.playerConfig,h=n._state;i.stopPropagation(),i.preventDefault(),c.checkIsFunction(f.enableSwipeHandler)&&f.enableSwipeHandler(),c.checkIsFunction(u.onMoveEnd)&&u.onMoveEnd(),c.event(i),c.removeClass(e.progressBtn,"active");var d=e.computeTime(i,l.x);d.prePlayTime=h.prePlayTime,l.moving?(e.triggerCallbacks("dragend",d,i),e.emitUserAction("drag","dragend",d)):(e.triggerCallbacks("click",d,i),e.emitUserAction("click","click",d)),e._mouseUpHandlerHook(i,d),l.moving=!1,l.isDown=!1,l.x=0,l.y=0,l.isLocked=!0,h.prePlayTime=0,h.time=0;var g=i.type;g==="touchend"||g==="touchcancel"?(e.root.removeEventListener("touchmove",e.onMouseMove),e.root.removeEventListener("touchend",e.onMouseUp),e.root.removeEventListener("touchcancel",e.onMouseUp),e.blur()):(document.removeEventListener("mousemove",e.onMouseMove,!1),document.removeEventListener("mouseup",e.onMouseUp,!1),l.isEnter?f.isMobileSimulateMode!=="mobile"&&e.bind("mousemove",e.onMoveOnly):e.onMouseLeave(i)),c.setTimeout(v(e),function(){e.resetSeekState()},1),s.focus()}),y(v(e),"onMouseMove",function(i){var n=v(e),s=n._state,u=n.pos,l=n.player,f=n.config;c.checkTouchSupport()&&i.preventDefault(),c.event(i);var h=c.getEventPos(i,l.zoom),d=l.rotateDeg===90?h.clientY:h.clientX,g=Math.abs(u.x-d);if(!(u.moving&&g<f.miniMoveStep||!u.moving&&g<f.miniStartStep)){u.x=d;var p=e.computeTime(i,d);p.prePlayTime=s.prePlayTime,e._mouseMoveHandlerHook(i,p)}}),y(v(e),"onMouseOut",function(i){e.triggerCallbacks("mouseout",null,i)}),y(v(e),"onMouseOver",function(i){e.triggerCallbacks("mouseover",null,i)}),y(v(e),"onMouseEnter",function(i){var n=v(e),s=n.player,u=n.pos;if(!(u.isDown||u.isEnter||s.isMini||!s.config.allowSeekAfterEnded&&s.ended)){u.isEnter=!0,e.bind("mousemove",e.onMoveOnly),e.bind("mouseleave",e.onMouseLeave),c.event(i);var l=c.getEventPos(i,s.zoom),f=s.rotateDeg===90?l.clientY:l.clientX,h=e.computeTime(i,f);e.triggerCallbacks("mouseenter",h,i),e.focus()}}),y(v(e),"onMouseLeave",function(i){e.triggerCallbacks("mouseleave",null,i),e.unlock(),e._updateInnerFocus(null)}),y(v(e),"onVideoResize",function(){var i=e.pos,n=i.x,s=i.isDown,u=i.isEnter;if(u&&!s){var l=e.computeTime(null,n);e.onMoveOnly(null,l)}}),e.useable=!1,e.isProgressMoving=!1,e.__dragCallBacks=[],e._state={now:-1,direc:0,time:0,prePlayTime:-1},e._disableBlur=!1,typeof e.config.isDragingSeek=="boolean"&&(console.warn("[XGPLAYER] 'isDragingSeek' is deprecated, please use 'isDraggingSeek' instead"),e.config.isDraggingSeek=e.config.isDragingSeek),e}return S(r,[{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,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n+this.timeOffset}},{key:"changeState",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!i||i.length===0)&&(i=[{percent:1}]);var s=U(U({fragments:i},n),{},{actionCallback:function(l){e.emitUserAction("fragment_focus","fragment_focus",l)}});this.innerList?this.innerList.reset(s):(this.innerList=new Sr(s),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map(function(u){e[u]=e.innerList[u].bind(e.innerList)}))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){if(!(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");var e=this.config,i=e.fragFocusClass,n=e.fragAutoFocus,s=e.fragClass;this._initInner(this.config.fragments,{fragFocusClass:i,fragAutoFocus:n,fragClass:s,style:this.playerConfig.commonStyle||{}}),L.device==="mobile"&&(this.config.isDraggingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.listenEvents(),this.bindDomEvents(),this.initCustomStyle()}}},{key:"listenEvents",value:function(){var e=this;this.on(ue,function(){e.onMouseLeave()}),this.on($,function(){e.onTimeupdate()}),this.on(ae,function(){e.onTimeupdate(),e.onCacheUpdate()}),this.on(Pi,function(){e.onCacheUpdate()}),this.on(_e,function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0}),this.on(Ce,function(){e.onReset()}),this.on(de,function(){e.onVideoResize()})}},{key:"setConfig",value:function(e){var i=this,n=null;Object.keys(e).forEach(function(s){i.config[s]=e[s],s==="fragments"&&(n=e[s])}),n&&this._initInner(n,e)}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,n=i.sliderBtnStyle,s=this.progressBtn;n&&(typeof n=="string"?s.style.boxShadow=n:z(n)==="object"&&Object.keys(n).map(function(u){s.style[u]=n[u]}))}},{key:"triggerCallbacks",value:function(e,i,n){this.__dragCallBacks.length>0&&this.__dragCallBacks.map(function(s){if(s&&s.handler&&s.type===e)try{s.handler(i,n)}catch(u){console.error("[XGPLAYER][triggerCallbacks] ".concat(s," error"),u)}})}},{key:"addCallBack",value:function(e,i){i&&typeof i=="function"&&this.__dragCallBacks.push({type:e,handler:i})}},{key:"removeCallBack",value:function(e,i){var n=this.__dragCallBacks,s=-1;n.map(function(u,l){u&&u.type===e&&u.handler===i&&(s=l)}),s>-1&&n.splice(s,1)}},{key:"unlock",value:function(){var e=this.player,i=this.pos;if(i.isEnter=!1,i.isLocked=!1,!e.isMini){if(this.unbind("mousemove",this.onMoveOnly),i.isDown){this.unbind("mouseleave",this.onMouseLeave);return}this.blur()}}},{key:"bindDomEvents",value:function(){var e=this.player.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),(this.domEventType==="touch"||this.domEventType==="compatible")&&this.root.addEventListener("touchstart",this.onMouseDown),(this.domEventType==="mouse"||this.domEventType==="compatible")&&(this.bind("mousedown",this.onMouseDown),e.isMobileSimulateMode!=="mobile"&&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(),c.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),c.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,i,n,s){var u=this.config,l=this.player;if(!(u.isCloseClickSeek&&s===0)){var f=i=i>=l.duration?l.duration-u.endedDiff:Number(i).toFixed(1);this.updatePercent(n),this.updateTime(e),!(s===1&&(!u.isDraggingSeek||l.config.mediaType==="audio"))&&(this._state.now=f,this._state.direc=f>l.currentTime?0:1,l.seek(f))}}},{key:"computeTime",value:function(e,i){var n=this.player,s=this.root.getBoundingClientRect(),u=s.width,l=s.height,f=s.top,h=s.left,d,g,p=i;n.rotateDeg===90?(d=l,g=f):(d=u,g=h);var m=p-g;m=m>d?d:m<0?0:m;var _=m/d;_=_<0?0:_>1?1:_;var b=parseInt(_*this.offsetDuration*1e3,10)/1e3,T=c.getCurrentTimeByOffset(b,n.timeSegments);return{percent:_,currentTime:b,seekTime:T,offset:m,width:d,left:g,e}}},{key:"updateTime",value:function(e){var i=this.player,n=this.duration;e>n?e=n:e<0&&(e=0);var s=i.plugins.time;s&&s.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,i){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(e*100,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var n=this.player.plugins.miniprogress;n&&n.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var i=this.player,n=this._state,s=this.offsetDuration;if(!(i.isSeeking&&i.media.seeking||this.isProgressMoving||!i.hasStart)){if(n.now>-1){var u=parseInt(n.now*1e3,10)-parseInt(i.currentTime*1e3,10);if(n.direc===0&&u>300||n.direc===1&&u>-300){n.now=-1;return}else n.now=-1}var l=this.currentTime;l=c.adjustTimeByDuration(l,s,e),this.innerList.update({played:l},s),this.progressBtn.style.left="".concat(l/s*100,"%")}}},{key:"onCacheUpdate",value:function(e){var i=this.player,n=this.duration;if(i){var s=i.bufferedPoint.end;s=c.adjustTimeByDuration(s,n,e),this.innerList.update({cached:s},n)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var i=this.domEventType;(i==="touch"||i==="compatible")&&(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),(i==="mouse"||i==="compatible")&&(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(){if(!(this.config.disable||this.playerConfig.isLive)){var e=this.player.controls?this.player.controls.config.mode:"",i=e==="bottom"?"xgplayer-progress-bottom":"";return`
<xg-progress class="xgplayer-progress `.concat(i,`">
<xg-outer class="xgplayer-progress-outer">
<xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>
</xg-outer>
</xg-progress>
`)}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_CENTER,index:0,disable:!1,isDraggingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:vi.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return vi}}]),r}(F),ke=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"_onMouseenter",function(s){t.emit("icon_mouseenter",{pluginName:t.pluginName})}),y(v(t),"_onMouseLeave",function(s){t.emit("icon_mouseleave",{pluginName:t.pluginName})}),t}return S(r,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),r}(F),xr=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"btnClick",function(s){s.preventDefault(),s.stopPropagation();var u=v(t),l=u.player;return t.emitUserAction(s,"switch_play_pause",{prop:"paused",from:l.paused,to:!l.paused}),l.ended?l.replay():l.paused?(l.play(),t.animate(!1)):(l.pause(),t.animate(!0)),!1}),t}return S(r,[{key:"afterCreate",value:function(){I(P(r.prototype),"afterCreate",this).call(this);var e=this.config;e.disable||(this.initIcons(),this.bind(["touchend","click"],this.btnClick),this.listenEvents(),this.animate(!0))}},{key:"listenEvents",value:function(){var e=this,i=this.player;this.on([q,Ie,Re,Ce],function(){e.animate(i.paused)})}},{key:"registerIcons",value:function(){return{play:{icon:Nt,class:"xg-icon-play"},pause:{icon:Ft,class:"xg-icon-pause"}}}},{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){if(this.player){var i=this.i18nKeys,n=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),n&&this.changeLangTextKey(n,i.PLAY_TIPS)):(this.setAttr("data-state","play"),n&&this.changeLangTextKey(n,i.PAUSE_TIPS))}}},{key:"destroy",value:function(){I(P(r.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">
<div class="xgplayer-icon">
</div>
`.concat(pe(this,"PLAY_TIPS",this.playerConfig.isHideTips),`
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:0,disable:!1}}}]),r}(ke);function Pr(){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">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<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>
</g>
</svg>`,"image/svg+xml").firstChild}var Ir=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(i){i.preventDefault(),i.stopPropagation(),e.config.onClick(i)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:Pr,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){c.addClass(this.root,"show")}},{key:"hide",value:function(){c.removeClass(this.root,"show")}},{key:"render",value:function(){return`<xg-icon class="xgplayer-back">
</xg-icon>`}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:H.ROOT_TOP,index:0}}}]),r}(F);function Ar(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">
<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>
</svg>
`,"image/svg+xml").firstChild}function Lr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">
<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>
</svg>
`,"image/svg+xml").firstChild}var Dr=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"_onOrientationChange",function(s){t.player.fullscreen&&t.config.rotateFullscreen&&(window.orientation===90||window.orientation===-90?t.player.setRotateDeg(0):t.player.setRotateDeg(90))}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;I(P(r.prototype),"afterCreate",this).call(this);var i=this.config,n=this.playerConfig;if(!i.disable){i.target&&(this.playerConfig.fullscreenTarget=this.config.target);var s=c.getFullScreenEl();n.fullscreenTarget===s&&this.player.getFullscreen().catch(function(u){}),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(l){var f=e.player.fullscreen;e.emitUserAction(l,"switch_fullscreen",{prop:"fullscreen",from:f,to:!f})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(re,function(u){var l=e.find(".xg-tips");l&&e.changeLangTextKey(l,u?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(u)}),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:Ir,options:{config:{onClick:function(l){e.handleFullscreen(l)}}}})),L.device==="mobile"&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:Ar,class:"xg-get-fullscreen"},exitFullscreen:{icon:Lr,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){I(P(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",L.device==="mobile"?"touchend":"click",this.handleFullscreen),L.device==="mobile"&&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 instanceof Event&&(e.preventDefault(),e.stopPropagation());var i=this.player,n=this.config,s=n.useCssFullscreen===!0||typeof n.useCssFullscreen=="function"&&n.useCssFullscreen();s?(i.fullscreen?i.exitCssFullscreen():i.getCssFullscreen(),this.animate(i.fullscreen)):n.rotateFullscreen?(i.fullscreen?i.exitRotateFullscreen():i.getRotateFullscreen(),this.animate(i.fullscreen)):n.switchCallback&&typeof n.switchCallback=="function"?n.switchCallback(i.fullscreen):i.fullscreen?(i.exitFullscreen(),n.useScreenOrientation&&this.unlockScreen()):(i.getFullscreen().catch(function(u){}),n.useScreenOrientation&&i.aspectRatio>1&&this.lockScreen(n.lockOrientationType))}},{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:"render",value:function(){if(!this.config.disable){var e="FULLSCREEN_TIPS";return`<xg-icon class="xgplayer-fullscreen">
<div class="xgplayer-icon">
</div>
`.concat(pe(this,e,this.playerConfig.isHideTips),`
</xg-icon>`)}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch(function(i){})}catch(i){}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch(function(e){})}catch(e){}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}(ke),Rr=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.isActiving=!1,e}return S(r,[{key:"duration",get:function(){var e=this.player,i=e.offsetDuration,n=e.duration;return this.playerConfig.customDuration||i||n}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this.player.controls.config.mode;this.mode=e==="flex"?"flex":"normal",!this.config.disable&&(this.mode==="flex"&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.listenEvents())}},{key:"listenEvents",value:function(){var e=this;this.on([ue,ae,$],function(i){i.eventName==="durationchange"&&(e.isActiving=!1),e.onTimeUpdate()}),this.on(_e,function(){e.onTimeUpdate(!0)}),this.on(Ce,function(){e.onReset()})}},{key:"show",value:function(e){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="block"),this.centerDurDom&&(this.centerDurDom.style.display="block");return}this.root.style.display="block"}},{key:"hide",value:function(){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="none"),this.centerDurDom&&(this.centerDurDom.style.display="none");return}this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var i=this.player,n=this.config,s=this.duration;if(!(n.disable||this.isActiving||!i.hasStart)){var u=this.currentTime+this.timeOffset;u=c.adjustTimeByDuration(u,s,e),this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime(c.format(u)),s!==1/0&&s>0&&(this.centerDurDom.innerHTML=c.format(s))):(this.timeDom.innerHTML=this.minWidthTime(c.format(u)),s!==1/0&&s>0&&(this.durationDom.innerHTML=c.format(s)))}}},{key:"onReset",value:function(){this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime(c.format(0)),this.centerDurDom.innerHTML=c.format(0)):(this.timeDom.innerHTML=this.minWidthTime(c.format(0)),this.durationDom.innerHTML=c.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(!(!e.controls||!e.controls.center)){var i=e.controls.center;this.centerCurDom=c.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=c.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),i.children.length>0?i.insertBefore(this.centerCurDom,i.children[0]):i.appendChild(this.centerCurDom),i.appendChild(this.centerDurDom)}}},{key:"afterPlayerInit",value:function(){var e=this.config;if(this.duration===1/0||this.playerConfig.isLive?(c.hide(this.durationDom),c.hide(this.timeDom),c.hide(this.find(".time-separator")),c.show(this.find(".time-live-tag"))):c.hide(this.find(".time-live-tag")),e.hide){this.hide();return}this.show()}},{key:"changeLiveState",value:function(e){e?(c.hide(this.durationDom),c.hide(this.timeDom),c.hide(this.find(".time-separator")),c.show(this.find(".time-live-tag"))):(c.hide(this.find(".time-live-tag")),c.show(this.find(".time-separator")),c.show(this.durationDom),c.show(this.timeDom))}},{key:"updateTime",value:function(e){if(this.isActiving=!0,!(!e&&e!==0||e>this.duration)){if(this.mode==="flex"){this.centerCurDom.innerHTML=this.minWidthTime(c.format(e));return}this.timeDom.innerHTML=this.minWidthTime(c.format(e))}}},{key:"minWidthTime",value:function(e){return e.split(":").map(function(i){return'<span class="time-min-width">'.concat(i,"</span>")}).join(":")}},{key:"resetActive",value:function(){var e=this,i=this.player,n=function(){e.isActiving=!1};this.off(ae,n),i.isSeeking&&i.media.seeking?this.once(ae,n):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">
<span class="time-current">00:00</span>
<span class="time-separator">/</span>
<span class="time-duration">00:00</span>
<span class="time-live-tag">`.concat(this.i18n.LIVE_TIP,`</span>
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:2,disable:!1}}}]),r}(F),Or=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"_onDurationChange",function(){t.updateSegments();var s=t.player,u=s.currentTime,l=s.timeSegments;if(t._checkIfEnabled(l)){var f=c.getIndexByTime(u,l),h=c.getOffsetCurrentTime(u,l,f);t.player.offsetCurrentTime=h,t.changeIndex(f,l)}}),y(v(t),"_onLoadedData",function(){var s=t.player.timeSegments;if(t._checkIfEnabled(s)){var u=c.getOffsetCurrentTime(0,s);t.player.offsetCurrentTime=u,t.changeIndex(0,s),t.curPos.start>0&&(t.player.currentTime=t.curPos.start)}}),y(v(t),"_onTimeupdate",function(){var s=t.player,u=s.currentTime,l=s.timeSegments;if(t._checkIfEnabled(l)){var f=l.length;t.lastCurrentTime=u;var h=c.getIndexByTime(u,l);h!==t.curIndex&&t.changeIndex(h,l);var d=c.getOffsetCurrentTime(u,l,h);if(t.player.offsetCurrentTime=d,!!t.curPos){var g=t.curPos,p=g.start,m=g.end;u<p?t.player.currentTime=p:u>m&&h>=f-1&&t.player.pause()}}}),y(v(t),"_onSeeking",function(){var s=t.player,u=s.currentTime,l=s.timeSegments;if(t._checkIfEnabled(l))if(u<l[0].start)t.player.currentTime=l[0].start;else if(u>l[l.length-1].end)t.player.currentTime=l[l.length-1].end;else{var f=c.getIndexByTime(u,l);if(f>=0){var h=t.getSeekTime(u,t.lastCurrentTime,f,l);h>=0&&(t.player.currentTime=h)}}}),y(v(t),"_onPlay",function(){var s=t.player,u=s.currentTime,l=s.timeSegments;t._checkIfEnabled(l)&&u>=l[l.length-1].end&&(t.player.currentTime=l[0].start)}),t}return S(r,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(ue,this._onDurationChange),this.on(oe,this._onLoadedData),this.on($,this._onTimeupdate),this.on(Je,this._onSeeking),this.on(q,this._onPlay)}},{key:"setConfig",value:function(e){var i=this;if(e){var n=Object.keys(e);n.length<1||(n.forEach(function(s){i.config[s]=e[s]}),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,i=e.disable,n=e.segments,s=this.player;if(i||!n||n.length===0)s.timeSegments=[],s.offsetDuration=0,s.offsetCurrentTime=-1;else{var u=this.formatTimeSegments(n,s.duration);s.timeSegments=u,s.offsetDuration=u.length>0?u[u.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,i){var n=[];return e?(e.sort(function(s,u){return s.start-u.start}),e.forEach(function(s,u){var l={};if(l.start=s.start<0?0:s.start,l.end=i>0&&s.end>i?i:s.end,!(i>0&&l.start>i)){n.push(l);var f=l.end-l.start;if(u===0)l.offset=s.start,l.cTime=0,l.segDuration=f,l.duration=f;else{var h=n[u-1];l.offset=h.offset+(l.start-h.end),l.cTime=h.duration+h.cTime,l.segDuration=f,l.duration=h.duration+f}}}),n):[]}},{key:"getSeekTime",value:function(e,i,n,s){var u=-1,l=s[n],f=l.start,h=l.end;if(e>=f&&e<=h)return u;var d=e-i;if(d<0&&e<f){var g=i>f?i-f:0;return u=n-1>=0?s[n-1].end+d+g:0,u}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,i){this.curIndex=e,e>=0&&i.length>0?this.curPos=i[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),r}(ge);function Mr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
<path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>
<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>
</svg>
`,"image/svg+xml").firstChild}function Nr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
<path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>
<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>
</svg>
`,"image/svg+xml").firstChild}function Fr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">
<path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>
<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>
</svg>
`,"image/svg+xml").firstChild}var Br=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onBarMousedown",function(s){var u=v(t),l=u.player,f=t.find(".xgplayer-bar");c.event(s);var h=f.getBoundingClientRect(),d=c.getEventPos(s,l.zoom),g=h.height-(d.clientY-h.top);if(d.h=g,d.barH=h.height,t.pos=d,!(g<-2))return t.updateVolumePos(g,s),document.addEventListener("mouseup",t.onBarMouseUp),t._d.isStart=!0,!1}),y(v(t),"onBarMouseMove",function(s){var u=v(t),l=u._d;if(l.isStart){var f=v(t),h=f.pos,d=f.player;s.preventDefault(),s.stopPropagation(),c.event(s);var g=c.getEventPos(s,d.zoom);l.isMoving=!0;var p=h.h-g.clientY+h.clientY;p>h.barH||t.updateVolumePos(p,s)}}),y(v(t),"onBarMouseUp",function(s){c.event(s),document.removeEventListener("mouseup",t.onBarMouseUp);var u=v(t),l=u._d;l.isStart=!1,l.isMoving=!1}),y(v(t),"onMouseenter",function(s){t._d.isActive=!0,t.focus(),t.emit("icon_mouseenter",{pluginName:t.pluginName})}),y(v(t),"onMouseleave",function(s){t._d.isActive=!1,t.unFocus(100,!1,s),t.emit("icon_mouseleave",{pluginName:t.pluginName})}),y(v(t),"onVolumeChange",function(s){if(t.player){var u=t.player,l=u.muted,f=u.volume;t._d.isMoving||(t.find(".xgplayer-drag").style.height=l||f===0?"4px":"".concat(f*100,"%"),t.config.showValueLabel&&t.updateVolumeValue()),t.animate(l,f)}}),t}return S(r,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:Nr,class:"xg-volume-small"},volumeLarge:{icon:Mr,class:"xg-volume"},volumeMuted:{icon:Fr,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var i=this.playerConfig,n=i.commonStyle,s=i.volume;n.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=n.volumeColor),this.changeMutedHandler=this.hook("mutedChange",function(u){e.changeMuted(u)},{pre:function(l){l.preventDefault(),l.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),L.device!=="mobile"&&this.playerConfig.isMobileSimulateMode!=="mobile"&&(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(wi,this.onVolumeChange),this.once(oe,this.onVolumeChange),c.typeOf(s)!=="Number"&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,i){var n=this.player,s=this.find(".xgplayer-drag"),u=this.find(".xgplayer-bar");if(!(!u||!s)){var l=parseInt(e/u.getBoundingClientRect().height*1e3,10);s.style.height="".concat(e,"px");var f=Math.max(Math.min(l/1e3,1),0),h={volume:{from:n.volume,to:f}};n.muted&&(h.muted={from:!0,to:!1}),this.emitUserAction(i,"change_volume",{muted:n.muted,volume:n.volume,props:h}),n.volume=Math.max(Math.min(l/1e3,1),0),n.muted&&(n.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,i=e.volume,n=e.muted,s=this.find(".xgplayer-value-label"),u=Math.max(Math.min(i,1),0);s.innerText=n?0:Math.round(u*100)}},{key:"focus",value:function(){var e=this.player;e.focus({autoHide:!1}),this._timerId&&(c.clearTimeout(this,this._timerId),this._timerId=null),c.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2?arguments[2]:void 0,u=this._d,l=this.player;u.isActive||(this._timerId&&(c.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=c.setTimeout(this,function(){u.isActive||(n?l.blur():l.focus(),c.removeClass(e.root,"slide-show"),u.isStart&&e.onBarMouseUp(s)),e._timerId=null},i))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var i=this.player,n=this._d;n.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:i.muted,volume:i.volume,props:{muted:{from:i.muted,to:!i.muted}}}),i.volume>0&&(i.muted=!i.muted),i.volume<.01&&(i.volume=this.config.miniVolume)}},{key:"animate",value:function(e,i){e||i===0?this.setAttr("data-state","mute"):i<.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&&(c.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",L.device==="mobile"?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,i=this.config.showValueLabel;return`
<xg-icon class="xgplayer-volume" data-state="normal">
<div class="xgplayer-icon">
</div>
<xg-slider class="xgplayer-slider">
`.concat(i?'<div class="xgplayer-value-label">'.concat(e*100,"</div>"):"",`
<div class="xgplayer-bar">
<xg-drag class="xgplayer-drag" style="height: `).concat(e*100,`%"></xg-drag>
</div>
</xg-slider>
</xg-icon>`)}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}(F);function Hr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">
<g>
<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"/>
<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 0.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"/>
</g>
<defs>
<clipPath>
<rect width="40" height="40" fill="white"/>
</clipPath>
</defs>
</svg>
`,"image/svg+xml").firstChild}var Ur=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.rotateDeg=e.config.rotateDeg||0,e}return S(r,[{key:"afterCreate",value:function(){var e=this;if(!this.config.disable){I(P(r.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(de,function(){e.rotateDeg&&e.config.innerRotate&&c.setTimeout(e,function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)},100)});var i=this.player.root;this.rootWidth=i.style.width||i.offsetWidth||i.clientWidth,this.rootHeight=i.style.height||i.offsetHeight||i.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){I(P(r.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,i){if(e||(e=0),i){this.player.videoRotateDeg=e;return}var n=this.player,s=this.rootWidth,u=this.rootHeight,l=n.root,f=n.innerContainer,h=n.media,d=l.offsetWidth,g=f&&i?f.offsetHeight:l.offsetHeight,p=s,m=u,_=0,b=0;(e===.75||e===.25)&&(p="".concat(g,"px"),m="".concat(d,"px"),_=-(g-d)/2,b=-(d-g)/2);var T="translate(".concat(_,"px,").concat(b,"px) rotate(").concat(e,"turn)"),k={transformOrigin:"center center",transform:T,webKitTransform:T,height:m,width:p},D=i?h:l,A=i?n.getPlugin("poster"):null;Object.keys(k).map(function(B){D.style[B]=k[B],A&&A.root&&(A.root.style[B]=k[B])})}},{key:"rotate",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.player;this.rotateDeg||(this.rotateDeg=0);var u=e?1:-1;this.rotateDeg=(this.rotateDeg+1+u*.25*n)%1,this.updateRotateDeg(this.rotateDeg,i),s.emit(Oi,this.rotateDeg*360)}},{key:"registerIcons",value:function(){return{rotate:Hr}}},{key:"render",value:function(){if(!this.config.disable)return`
<xg-icon class="xgplayer-rotate">
<div class="xgplayer-icon">
</div>
`.concat(pe(this,"ROTATE_TIPS",this.playerConfig.isHideTips),`
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),r}(ke);function Vr(){return new DOMParser().parseFromString(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
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"
fill="white" />
</svg>`,"image/svg+xml").firstChild}function jr(){return new DOMParser().parseFromString(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
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"
fill="white" />
<path fill-rule="evenodd" clip-rule="evenodd"
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"
fill="white" />
</svg>`,"image/svg+xml").firstChild}var be={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"},Wr=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"switchPIP",function(s){if(!t.isPIPAvailable())return!1;s.stopPropagation&&s.stopPropagation(),t.isPip?(t.exitPIP(),t.emitUserAction(s,"change_pip",{props:"pip",from:!0,to:!1}),t.setAttr("data-state","normal")):t.player.media.readyState===4&&(t.requestPIP(),t.emitUserAction(s,"change_pip",{props:"pip",from:!1,to:!0}),t.setAttr("data-state","pip"))}),t}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.pip=="boolean"&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(I(P(r.prototype),"afterCreate",this).call(this),this.pMode=be.INLINE,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(Qe,function(){e.config.showIcon&&(c.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))}))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:Vr,class:"xg-get-pip"},pipIconExit:{icon:jr,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 e=this,i=this.player;this.leavePIPCallback=function(){var n=i.paused;c.setTimeout(e,function(){!n&&i.mediaPlay()},0),!n&&i.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,i.emit(St,!1)},this.enterPIPCallback=function(n){i.emit(St,!0),n!=null&&n.pictureInPictureWindow&&(e.pipWindow=n.pictureInPictureWindow),e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(n){var s=i.media.webkitPresentationMode;e.pMode===be.FULLSCREEN&&s!==be.FULLSCREEN&&i.onFullscreenChange(null,!1),e.pMode=s,s===be.PIP?e.enterPIPCallback(n):s===be.INLINE&&e.leavePIPCallback(n)},i.media&&(i.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),i.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),r.checkWebkitSetPresentationMode(i.media)&&i.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"copyStyleIntoPiPWindow",value:function(e){var i=Q(document.styleSheets).map(function(s){try{return Q(s.cssRules).map(function(l){return l.cssText}).join("")}catch(l){var u=document.createElement("link");u.rel="stylesheet",u.type=s.type,u.media=s.media,u.href=s.href,e.document.head.appendChild(u)}return""}).filter(Boolean).join(`
`),n=document.createElement("style");n.textContent=i,e.document.head.appendChild(n)}},{key:"requestPIP",value:function(){var e=this,i=this.player,n=this.playerConfig,s=this.config;if(!(!this.isPIPAvailable()||this.isPip))try{var u=n.poster;if(u&&(i.media.poster=c.typeOf(u)==="String"?u:u.poster),s.preferDocument&&this.isDocPIPAvailable()){var l={};if(s.width&&s.height)l.width=s.width,l.height=s.height;else{var f=i.root.getBoundingClientRect();l.width=f.width,l.height=f.height}documentPictureInPicture.requestWindow(l).then(function(h){var d=s.docPiPNode,g=s.docPiPStyle;e.enterPIPCallback();var p=d||i.root,m=p.parentElement,_=p.previousSibling,b=p.nextSibling;e.copyStyleIntoPiPWindow(h);var T=document.createElement("style");if(T.append("body{padding:0; margin:0;}"),g){var k="";typeof g=="string"?k=g:typeof g=="function"&&(k=g.call(s)),k&&T.append(k)}else p===i.root&&T.append(`
.xgplayer{width: 100%!important; height: 100%!important;}
`);h.document.head.append(T),h.document.body.append(p),h.addEventListener("pagehide",function(D){m&&(b?m.insertBefore(p,b):_?m.insertBefore(p,_.nextSibling):m.appendChild(p)),e.leavePIPCallback()},{once:!0})})}else r.checkWebkitSetPresentationMode(i.media)?i.media.webkitSetPresentationMode("picture-in-picture"):i.media.requestPictureInPicture();return!0}catch(h){return console.error("requestPiP",h),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{if(this.isPIPAvailable()&&this.isPip){var i;this.isDocPIPAvailable()&&(i=documentPictureInPicture)!==null&&i!==void 0&&i.window?documentPictureInPicture.window.close():r.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture()}return!0}catch(n){return console.error("exitPIP",n),!1}}},{key:"isPip",get:function(){var e,i=this.player;return!!(this.isDocPIPAvailable()&&(e=documentPictureInPicture)!==null&&e!==void 0&&e.window)||document.pictureInPictureElement&&document.pictureInPictureElement===i.media||i.media.webkitPresentationMode===be.PIP}},{key:"isPIPAvailable",value:function(){var e=this.player.media,i=c.typeOf(document.pictureInPictureEnabled)==="Boolean"?document.pictureInPictureEnabled:!1;return i&&(c.typeOf(e.disablePictureInPicture)==="Boolean"&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&c.typeOf(e.webkitSetPresentationMode)==="Function")||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return"documentPictureInPicture"in window&&/^(https|file)/.test(location.protocol)}},{key:"destroy",value:function(){I(P(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">
<div class="xgplayer-icon xg-icon-disable">
</div>
`.concat(pe(this,"PIP",this.playerConfig.isHideTips),`
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return typeof e.webkitSetPresentationMode=="function"}}]),r}(ke);function Gr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">
<path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>
</svg>
`,"image/svg+xml").firstChild}var zr=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"playNext",function(i){var n=v(e),s=n.player;i.preventDefault(),i.stopPropagation(),e.idx+1<e.config.urlList.length?(e.idx++,e.nextHandler(e.config.urlList[e.idx],e.idx),s.emit(Ke,e.idx+1)):(e.nextHandler(),s.emit(Ke))}),e.idx=-1,e}return S(r,[{key:"afterCreate",value:function(){!this.config.urlList||this.config.urlList.length===0||(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:Gr}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e=L.device==="mobile"?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var i=this.player;e&&(i.pause(),i.currentTime=0,i.switchURL?i.switchURL(e):i.src=e,i.config.url=e,i.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(!(!this.config.urlList||this.config.urlList.length===0))return`
<xg-icon class="xgplayer-playnext">
<div class="xgplayer-icon">
</div>
`.concat(pe(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),`
</xg-icon>
`)}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),r}(F),Ve={exports:{}},Kr=Ve.exports,mi;function Yr(){return mi||(mi=1,function(o,a){(function(r,t){o.exports=t()})(Kr,function(){return function r(t,e,i){var n=window,s="application/octet-stream",u=i||s,l=t,f=!e&&!i&&l,h=document.createElement("a"),d=function(M){return String(M)},g=n.Blob||n.MozBlob||n.WebKitBlob||d,p=e||"download",m,_;if(g=g.call?g.bind(n):Blob,String(this)==="true"&&(l=[l,u],u=l[0],l=l[1]),f&&f.length<2048&&(p=f.split("/").pop().split("?")[0],h.href=f,h.href.indexOf(f)!==-1)){var b=new XMLHttpRequest;return b.open("GET",f,!0),b.responseType="blob",b.onload=function(M){r(M.target.response,p,s)},setTimeout(function(){b.send()},0),b}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(l))if(l.length>1024*1024*1.999&&g!==d)l=A(l),u=l.type||s;else return navigator.msSaveBlob?navigator.msSaveBlob(A(l),p):B(l);else if(/([\x80-\xff])/.test(l)){var T=0,k=new Uint8Array(l.length),D=k.length;for(T;T<D;++T)k[T]=l.charCodeAt(T);l=new g([k],{type:u})}m=l instanceof g?l:new g([l],{type:u});function A(M){var j=M.split(/[:;,]/),V=j[1],R=j[2]=="base64"?atob:decodeURIComponent,Y=R(j.pop()),Z=Y.length,J=0,ve=new Uint8Array(Z);for(J;J<Z;++J)ve[J]=Y.charCodeAt(J);return new g([ve],{type:V})}function B(M,j){if("download"in h)return h.href=M,h.setAttribute("download",p),h.className="download-js-link",h.innerHTML="downloading...",h.style.display="none",document.body.appendChild(h),setTimeout(function(){h.click(),document.body.removeChild(h),j===!0&&setTimeout(function(){n.URL.revokeObjectURL(h.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(M)&&(M="data:"+M.replace(/^data:([\w\/\-\+]+)/,s)),window.open(M)||confirm(`Displaying New Document
Use Save As... to download, then click back to return to this page.`)&&(location.href=M),!0;var V=document.createElement("iframe");document.body.appendChild(V),!j&&/^data:/.test(M)&&(M="data:"+M.replace(/^data:([\w\/\-\+]+)/,s)),V.src=M,setTimeout(function(){document.body.removeChild(V)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(m,p);if(n.URL)B(n.URL.createObjectURL(m),!0);else{if(typeof m=="string"||m.constructor===d)try{return B("data:"+u+";base64,"+n.btoa(m))}catch(M){return B("data:"+u+","+encodeURIComponent(m))}_=new FileReader,_.onload=function(M){B(this.result)},_.readAsDataURL(m)}return!0}})}(Ve)),Ve.exports}var Xr=Yr();const $r=wt(Xr);function qr(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">
<g id="Group-2">
<g id="volme_big-copy" transform="translate(488.000000, 340.000000)">
<rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>
<rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>
<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>
<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>
</g>
</g>
</g>
</g>
</svg>
`,"image/svg+xml").firstChild}var Zr=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"download",function(i){if(!e.isLock){e.emitUserAction(i,"download");var n=e.playerConfig.url,s="";c.typeOf(n)==="String"?s=n:c.typeOf(n)==="Array"&&n.length>0&&(s=n[0].src);var u=e.getAbsoluteURL(s);$r(u),e.isLock=!0,e.timer=window.setTimeout(function(){e.isLock=!1,window.clearTimeout(e.timer),e.timer=null},300)}}),e.timer=null,e.isLock=!1,e}return S(r,[{key:"afterCreate",value:function(){I(P(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(i){i.preventDefault(),i.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:qr}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var i=document.createElement("div");i.innerHTML='<a href="'.concat(e,'">x</a>'),e=i.firstChild.href}return e}},{key:"destroy",value:function(){I(P(r.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">
<div class="xgplayer-icon">
</div>
`.concat(pe(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),`
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:3,disable:!0}}}]),r}(ke),Jr=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.screenShot=="boolean"&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){I(P(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(i){e.fitVideo&&(e.width=i.vWidth,e.height=i.vHeight)},this.once(de,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,i){var n=document.createElement("a");n.href=e,n.download=i;var s;try{typeof MouseEvent!="undefined"?s=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null))}catch(u){console.error("MouseEvent unsupported",u)}s&&n.dispatchEvent(s)}},{key:"createCanvas",value:function(e,i){var n=document.createElement("canvas"),s=n.getContext("2d");this.canvasCtx=s,this.canvas=n,n.width=e||this.config.width,n.height=i||this.config.height,s.imageSmoothingEnabled=!0,s.imageSmoothingEnabled&&(s.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var i=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var n=this.config;this.shot(n.width,n.height).then(function(s){i.emit(Mi,s),n.saveImg&&i.saveScreenShot(s,n.name+n.format)})}},{key:"shot",value:function(e,i){var n=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{quality:.92,type:"image/png"},u=this.config,l=this.player,f=s.quality||u.quality,h=s.type||u.type;return new Promise(function(d,g){var p=null,m;if(l.media.canvas)p=l.media.canvas;else{n.canvas?(n.canvas.width=e||u.width,n.canvas.height=i||u.height):n.createCanvas(e,i),p=n.canvas,m=n.canvasCtx;var _=l.media.videoWidth/l.media.videoHeight,b=p.width/p.height,T=0,k=0,D=l.media.videoWidth,A=l.media.videoHeight,B,M,j,V;_>b?(j=p.width,V=p.width/_,B=0,M=Math.round((p.height-V)/2)):_===b?(j=p.width,V=p.height,B=0,M=0):_<b&&(j=p.height*_,V=p.height,B=Math.round((p.width-j)/2),M=0),m.drawImage(l.media,T,k,D,A,B,M,j,V)}var R=p.toDataURL(h,f).replace(h,"image/octet-stream");R=R.replace(/^data:image\/[^;]+/,"data:application/octet-stream"),d(R)})}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){I(P(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(de,this.initSize)}},{key:"render",value:function(){if(!this.config.disable){var e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",i="SCREENSHOT";return`
<xg-icon class="xgplayer-shot">
<div class="`.concat(e,`">
`).concat(this.icons.screenshotIcon?"":'<span lang-key="'.concat(this.i18nKeys[i],'">').concat(this.i18n[i],"</span>"),`
</div>
</xg-icon>`)}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),r}(ke),Qr=function(){function o(a){E(this,o),this.config=a.config,this.parent=a.root,this.root=c.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),a.root.appendChild(this.root);var r=this.config.maxHeight;r&&this.setStyle({maxHeight:r}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var t=this.config.domEventType==="touch"?"touchend":"click";this._delegates=F.delegate.call(this,this.root,"li",t,this.onItemClick)}return S(o,[{key:"renderItemList",value:function(r){var t=this,e=this.config,i=this.root;r?e.data=r:r=e.data,e.style&&Object.keys(e.style).map(function(n){i.style[n]=e[n]}),r.length>0&&(this.attrKeys=Object.keys(r[0])),this.root.innerHTML="",r.map(function(n,s){var u=n.selected?"option-item selected":"option-item";n["data-index"]=s,t.root.appendChild(c.createDom("li","<span>".concat(n.showText,"</span>"),n,u))})}},{key:"onItemClick",value:function(r){r.delegateTarget||(r.delegateTarget=r.target);var t=r.delegateTarget;if(t&&c.hasClass(t,"selected"))return!1;var e=typeof this.config.onItemClick=="function"?this.config.onItemClick:null,i=this.root.querySelector(".selected");c.addClass(t,"selected"),i&&c.removeClass(i,"selected"),e(r,{from:i?this.getAttrObj(i,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(r,t){if(!r||!t)return{};var e={};t.map(function(n){e[n]=r.getAttribute(n)});var i=r.getAttribute("data-index");return i&&(e.index=Number(i)),e}},{key:"show",value:function(){c.removeClass(this.root,"hide"),c.addClass(this.root,"active")}},{key:"hide",value:function(){c.removeClass(this.root,"active"),c.addClass(this.root,"hide")}},{key:"setStyle",value:function(r){var t=this;Object.keys(r).forEach(function(e){t.root.style[e]=r[e]})}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map(function(r){r.destroy&&r.destroy()}),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),o}(),te={SIDE:"side",MIDDLE:"middle",DEFAULT:"default"},Ee={CLICK:"click",HOVER:"hover"};function es(o,a){return o===te.SIDE?a===H.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""}var me=L.device==="mobile",Ze=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"onEnter",function(i){i.stopPropagation(),e.emit("icon_mouseenter",{pluginName:e.pluginName}),e.switchActiveState(i)}),y(v(e),"switchActiveState",function(i){i.stopPropagation();var n=e.config.toggleMode;n===Ee.CLICK?e.toggle(!e.isActive):e.toggle(!0)}),y(v(e),"onLeave",function(i){i.stopPropagation(),e.emit("icon_mouseleave",{pluginName:e.pluginName}),e.config.listType!==te.SIDE&&e.isActive&&e.toggle(!1)}),y(v(e),"onListEnter",function(i){e.enterType=2}),y(v(e),"onListLeave",function(i){e.enterType=0,e.isActive&&e.toggle(!1)}),e.isIcons=!1,e.isActive=!1,e.curValue=null,e.curIndex=0,e}return S(r,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,i=this.config;this.initIcons(),me=me||this.domEventType==="touch",me&&L.device==="mobile"&&i.listType===te.DEFAULT&&(i.listType=te.SIDE),i.hidePortrait&&c.addClass(this.root,"portrait"),this.on([de,re],function(){e._resizeList()}),this.once(se,function(){i.list&&i.list.length>0&&(e.renderItemList(i.list),e.show())}),me&&this.on(At,function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)}),me?(i.toggleMode=Ee.CLICK,this.activeEvent="touchend"):this.activeEvent=i.toggleMode===Ee.CLICK?"click":"mouseenter",i.toggleMode===Ee.CLICK?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 e=this,i=this.icons,n=Object.keys(i),s=!1;n.length>0&&(n.forEach(function(u){e.appendChild(".xgplayer-icon",i[u]),!s&&(s=i[u])}),this.isIcons=s),!s&&(this.appendChild(".xgplayer-icon",c.createDom("span","",{},"icon-text")),c.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||c.addClass(this.root,"show")}},{key:"hide",value:function(){c.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,i,n){if(e===void 0)return"";var s=this.config.list;!n&&(n=this.player.lang),i=!i||c.isUndefined(e[i])?"text":i,typeof e=="number"&&(e=s[e]);try{return z(e[i])==="object"?e[i][n]||e[i].en:e[i]}catch(u){return console.warn(u),""}}},{key:"toggle",value:function(e){if(!(e===this.isActive||this.config.disable)){var i=this.player.controls,n=this.config.listType;e?(n===te.SIDE?i.blur():i.focus(),this.optionsList&&this.optionsList.show()):(n===te.SIDE?i.focus():i.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,i){e.stopPropagation();var n=this.config,s=n.listType,u=n.list;this.curIndex=i.to.index,this.curItem=u[this.curIndex],this.changeCurrentText();var l=this.config.isItemClickHide;(l||me||s===te.SIDE)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex<e.length?this.curIndex:0,n=e[i];n&&(this.find(".icon-text").innerHTML=this.getTextByLang(n,"iconText"))}}},{key:"renderItemList",value:function(e,i){var n=this,s=this.config,u=this.optionsList,l=this.player;if(typeof i=="number"&&(this.curIndex=i,this.curItem=s.list[i]),u){u.renderItemList(e),this.changeCurrentText();return}var f={config:{data:e||[],className:es(s.listType,s.position),onItemClick:function(m,_){n.onItemClick(m,_)},domEventType:me?"touch":"mouse"},root:s.listType===te.SIDE?l.innerContainer||l.root:this.root};if(this.config.isShowIcon){var h=this.player.root.getBoundingClientRect(),d=h.height,g=s.listType===te.MIDDLE?d-50:d;g&&s.heightLimit&&(f.config.maxHeight="".concat(g,"px")),this.optionsList=new Qr(f),this.changeCurrentText(),this.show()}this._resizeList()}},{key:"_resizeList",value:function(){if(this.config.heightLimit){var e=this.player.root.getBoundingClientRect(),i=e.height,n=this.config.listType===te.MIDDLE?i-50:i;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(n,"px")})}}},{key:"destroy",value:function(){var e=this.config;e.toggleMode===Ee.CLICK?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||"",`">
<div class="xgplayer-icon">
</div>
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:Ee.HOVER,heightLimit:!0}}}]),r}(F),ts=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.curTime=0,e.isPaused=!0,e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.config.list;Array.isArray(i)&&i.length>0&&(e.config.list=i.map(function(n){return!n.text&&n.name&&(n.text=n.name),n.text||(n.text=n.definition),n}))}},{key:"afterCreate",value:function(){var e=this;I(P(r.prototype),"afterCreate",this).call(this),this.on("resourceReady",function(i){e.changeDefinitionList(i)}),this.on(Ot,function(i){e.renderItemList(e.config.list,i.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||c.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,i=e.list,n=e.defaultDefinition;if(i.length>0){var s=null;i.map(function(u){u.definition===n&&(s=u)}),s||(s=i[0]),this.changeDefinition(s)}}},{key:"renderItemList",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,s=n&&n.definition?n.definition:this.config.defaultDefinition;n&&i.forEach(function(f){f.selected=!1});var u=0,l=i.map(function(f,h){var d=U(U({},f),{},{showText:e.getTextByLang(f)||f.definition,selected:!1});return(f.selected||f.definition&&f.definition==s)&&(d.selected=!0,u=h),d});I(P(r.prototype),"renderItemList",this).call(this,l,u)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map(function(i){return!i.text&&i.name&&(i.text=i.name),i.text||(i.text=i.definition),i}),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,i){this.player.changeDefinition(e,i)}},{key:"onItemClick",value:function(e,i){var n=this.player.definitionList;I(P(r.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:i.from,to:i.to});for(var s=0;s<n.length;s++)i.to&&n[s].definition===i.to.definition&&(i.to.url=n[s].url),i.from&&n[s].definition===i.from.definition&&(i.from.url=n[s].url);this.player.changeDefinition(i.to,i.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return U(U({},Ze.defaultConfig),{},{position:H.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),r}(Ze),is=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.curRate=1,e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.player.config.playbackRate,n=i?Array.isArray(i)?i:e.config.list:[];Array.isArray(n)&&(e.config.list=n.map(function(s){return typeof s=="number"?s={rate:s,text:"".concat(s,"x")}:!s.text&&s.rate&&(s.text="".concat(s.rate,"x")),s}))}},{key:"afterCreate",value:function(){var e=this;I(P(r.prototype),"afterCreate",this).call(this),this.on(xi,function(){e.curValue!==e.player.playbackRate&&e.renderItemList()}),this.renderItemList()}},{key:"show",value:function(e){!this.config.list||this.config.list.length===0||I(P(r.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,i){I(P(r.prototype),"onItemClick",this).call(this,e,i);var n=e.delegateTarget,s=Number(n.getAttribute("rate"));if(!s||s===this.curValue)return!1;var u={playbackRate:{from:this.player.playbackRate,to:s}};this.emitUserAction(e,"change_rate",{props:u}),this.curValue=s,this.player.playbackRate=s}},{key:"renderItemList",value:function(){var e=this,i=this.player.playbackRate||1;this.curValue=i;var n=-1,s=this.config.list.map(function(u,l){var f={rate:u.rate};return f.rate===i&&(f.selected=!0,n=l),f.showText=e.getTextByLang(u),f});I(P(r.prototype),"renderItemList",this).call(this,s,n)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex<e.length?this.curIndex:0,n=e[i],s="";!n||this.curIndex<0?s="".concat(this.player.playbackRate,"x"):s=this.getTextByLang(n,"iconText"),this.find(".icon-text").innerHTML=s}}},{key:"destroy",value:function(){I(P(r.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return U(U({},Ze.defaultConfig),{},{position:H.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),r}(Ze);function ns(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
<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>
</svg>
`,"image/svg+xml").firstChild}function rs(){return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
<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>
</svg>
`,"image/svg+xml").firstChild}var yi=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.cssFullscreen=="boolean"&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;I(P(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Ge,function(i){e.animate(i)}),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,i=this.find(".xgplayer-icon");i.appendChild(e.cssFullscreen),i.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var i=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:i}),i?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 i=this.i18nKeys,n=this.find(".xg-tips");n&&this.changeLangTextKey(n,e?i.EXITCSSFULLSCREEN_TIPS:i.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:ns,class:"xg-get-cssfull"},exitCssFullscreen:{icon:rs,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){I(P(r.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'>
<div class="xgplayer-icon">
</div>
`.concat(pe(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),`
</xg-icon>`)}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:H.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),r}(ke),ss=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(n){n.preventDefault(),n.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(Re,function(i){e.onError(i)})}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=this.player,n=e.errorType,s=i.errorNote?this.i18n[i.errorNote]:"";if(!s)switch(n){case"decoder":s=this.i18n.MEDIA_ERR_DECODE;break;case"network":s=this.i18n.MEDIA_ERR_NETWORK;break;default:s=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=s,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">
<div class="xgplayer-errornote">
<span class="xgplayer-error-text"></span>
<span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>
</div>
</xg-error>`}}],[{key:"pluginName",get:function(){return"error"}}]),r}(F),as=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],function(i){(e.config.onClick||e.customOnClick)&&(i.preventDefault(),i.stopPropagation(),e.customOnClick?e.customOnClick(i):e.config.onClick(i))}),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var i=this;Object.keys(e).map(function(n){i.root.style[n]=e[n]})}},{key:"showPrompt",value:function(e){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(e){this.customOnClick=s;var u=this.config.interval;this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),c.addClass(this.root,"show"),n.mode==="arrow"&&c.addClass(this.root,"arrow"),typeof e=="string"?this.find(".xgplayer-prompt-detail").innerHTML=e:this.find(".xgplayer-prompt-detail").innerHTML="".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),n.style&&this.setStyle(n.style);var l=typeof n.autoHide=="boolean"?n.autoHide:this.config.autoHide;if(l){var f=n.interval||u;this.intervalId=setTimeout(function(){i.hide()},f)}}}},{key:"hide",value:function(){c.removeClass(this.root,"show"),c.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(C.CONTROLS_FOLLOW,`">
<span class="xgplayer-prompt-detail"></span>
</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(){}}}}]),r}(F),_i={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function $i(o){Object.keys(_i).map(function(a){o[a]===void 0&&(o[a]=_i[a])})}var Ci={_updateDotDom:function(a,r){if(r){var t=this.calcuPosition(a.time,a.duration),e=a.style||{};e.left="".concat(t.left,"%"),e.width="".concat(t.width,"%"),r.setAttribute("data-text",a.text),r.setAttribute("data-time",a.time),t.isMini?c.addClass(r,"mini"):c.removeClass(r,"mini"),Object.keys(e).map(function(i){r.style[i]=e[i]})}},initDots:function(){var a=this;this._ispots.map(function(r){a.createDot(r,!1)}),this.ispotsInit=!0},createDot:function(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this.player.plugins.progress;if(t&&(r&&($i(a),this._ispots.push(a)),!(!this.ispotsInit&&r))){var e=this.calcuPosition(a.time,a.duration),i=a.style||{};i.left="".concat(e.left,"%"),i.width="".concat(e.width,"%");var n="xgspot_".concat(a.id," xgplayer-spot");e.isMini&&(n+=" mini");var s=a.template?'<div class="xgplayer-spot-pop">'.concat(a.template,"</div>"):"",u=c.createDom("xg-spot",s,{"data-text":a.text,"data-time":a.time,"data-id":a.id},n);Object.keys(i).map(function(l){u.style[l]=i[l]}),t.outer&&t.outer.appendChild(u),this.positionDot(u,a.id)}},findDot:function(a){if(this.player.plugins.progress){var r=this._ispots.filter(function(t,e){return t.id===a});return r.length>0?r[0]:null}},updateDot:function(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=this.player.plugins.progress;if(t){var e=this.findDot(a.id);if(e&&Object.keys(a).map(function(n){e[n]=a[n]}),!!this.ispotsInit){var i=t.find('xg-spot[data-id="'.concat(a.id,'"]'));i&&(this._updateDotDom(a,i),r&&this.showDot(a.id))}}},deleteDot:function(a){var r=this._ispots,t=this.player.plugins.progress;if(t){for(var e=[],i=0;i<r.length;i++)r[i].id===a&&e.push(i);for(var n=e.length,s=n-1;s>=0;s--)if(r.splice(e[s],1),this.ispotsInit){var u=t.find('xg-spot[data-id="'.concat(a,'"]'));u&&u.parentElement.removeChild(u)}}},deleteAllDots:function(){var a=this.player.plugins.progress;if(a){if(!this.ispotsInit){this._ispots=[];return}for(var r=a.root.getElementsByTagName("xg-spot"),t=r.length-1;t>=0;t--)a.outer.removeChild(r[t]);this._ispots=[]}},updateAllDots:function(){var a=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=this.player.plugins.progress;if(t){if(!this.ispotsInit){this._ispots=r;return}this._ispots=[];var e=t.root.getElementsByTagName("xg-spot"),i=e.length;if(i>r.length)for(var n=i-1;n>r.length-1;n--)t.outer.removeChild(e[n]);r.forEach(function(s,u){u<i?(e[u].setAttribute("data-id","".concat(s.id)),a._ispots.push(s),a.updateDot(s)):a.createDot(s)})}},positionDots:function(){var a=this,r=this._ispots,t=this.playerSize,e=this.player.sizeInfo,i=this.player.plugins.progress;!i||e.width===t.width||(t.width=e.width,t.left=e.left,r.forEach(function(n){var s=i.find('xg-spot[data-id="'.concat(n.id,'"]'));s&&a.positionDot(s,n.id)}))},positionDot:function(a,r){var t=c.findDom(a,".xgplayer-spot-pop");if(t){var e=this.playerSize,i=a.getBoundingClientRect(),n=t.getBoundingClientRect(),s=i.left-e.left,u=e.width-s-i.width/2;if(s<n.width/2||e.width<n.width){var l=n.width/2-s;t.style.left="".concat(l,"px")}else if(u<n.width/2){var f=u-n.width/2+i.width/2;t.style.left="".concat(f,"px")}else t.style.left="50%"}},updateDuration:function(){var a=this,r=this.player.plugins.progress;if(r){var t=this._ispots;t.forEach(function(e){var i=r.find('xg-spot[data-id="'.concat(e.id,'"]'));a._updateDotDom(e,i)})}},getAllDotsDom:function(){var a=this.player.plugins.progress;if(!a)return[];var r=a.root.getElementsByTagName("xg-spot");return r},getDotDom:function(a){var r=this.player.plugins.progress;if(r)return r.find('xg-spot[data-id="'.concat(a,'"]'))}};function os(o){var a=o.config,r=o.player;Object.keys(Ci).map(function(e){o[e]=Ci[e].bind(o)});var t=r.config.progressDot||a.ispots||[];o._ispots=t.map(function(e){return $i(e),e}),o.ispotsInit=!1,o.playerSize={left:r.sizeInfo.left,width:r.sizeInfo.width},o.on(ue,function(){o.ispotsInit?o.updateDuration():o.initDots()}),o.on(de,function(){o.positionDots()})}var Se={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},us=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(v(e),"onMousemove",function(i){if(!e.config.disable){if(c.hasClass(i.target,"xg-spot-content")&&e.config.isHideThumbnailHover){e.player.plugins.progress.onMouseLeave(i);return}(e._state.f||c.hasClass(i.target,"xg-spot-content"))&&(c.event(i),i.stopPropagation())}}),y(v(e),"onMousedown",function(i){e.config.disable||(e._state.f||c.hasClass(i.target,"xg-spot-content"))&&(c.event(i),i.stopPropagation())}),y(v(e),"onMouseup",function(i){if(e.isDrag){var n=e.player.plugins.progress;n&&n.pos&&(n.onMouseUp(i),!n.pos.isEnter&&n.onMouseLeave(i))}}),y(v(e),"onDotMouseLeave",function(i){if(!e.config.disable){e._curDot.removeEventListener("mouseleave",e.onDotMouseLeave),e.blurDot(i.target),e._curDot=null;var n=e.player.plugins.progress;n&&n.enableBlur(),e.show()}}),y(v(e),"onProgressMouseOver",function(i,n){if(!e.config.disable&&c.hasClass(n.target,"xgplayer-spot")&&!e._curDot){e._curDot=n.target,e.focusDot(n.target),e._curDot.children.length>0&&e.hide();var s=e.player.plugins.progress;s&&s.disableBlur(),e._curDot.addEventListener("mouseleave",e.onDotMouseLeave)}}),e._ispots=[],e.videoPreview=null,e.videothumbnail=null,e.thumbnail=null,e.timeStr="",e._state={now:0,f:!1},e}return S(r,[{key:"beforeCreate",value:function(e){var i=e.player.plugins.progress;i&&(e.root=i.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",function(i,n){n.seekTime&&e.player.seek(n.seekTime)}),this.transformTimeHook=this.hook("transformTime",function(i){e.setTimeContent(c.format(i))}),os(this),this.on(ue,function(){e.show()}),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(n){i.config[n]=e[n]})}},{key:"onPluginsReady",value:function(){var e=this.player;e.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 e=this,i=this.player.plugins.progress;if(i&&(Object.keys(Se).map(function(s){e[Se[s]]=e[Se[s]].bind(e),i.addCallBack(s,e[Se[s]])}),L.device!=="mobile")){this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup);var n=this.hook("previewClick",function(){});this.handlerPreviewClick=function(s){s.stopPropagation(),n(parseInt(e._state.now*1e3,10)/1e3,s)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,i){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&&c.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!1,this.videoPreview&&c.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,i){this.config.disable||c.hasClass(i.target,"xgplayer-spot")&&(i.stopPropagation(),i.preventDefault(),["time","id","text"].map(function(n){e[n]=i.target.getAttribute("data-".concat(n))}),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(i,e))}},{key:"updateLinePos",value:function(e,i){var n=this.root,s=this.previewLine,u=this.player,l=this.config,f=u.controls.mode,h=f==="flex",d=n.getBoundingClientRect().width;if(!(!d&&this._hasThumnail)){d=this._hasThumnail&&d<l.width?l.width:d;var g=e-d/2,p;g<0&&!h?(g=0,p=e-d/2):g>i-d&&!h?(p=g-(i-d),g=i-d):p=0,p!==void 0&&(s.style.transform="translateX(".concat(p.toFixed(2),"px)")),n.style.transform="translateX(".concat(g.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var i=this.timeText,n=this.timePoint;i.innerHTML=e,!this.thumbnail&&(n.innerHTML=e)}},{key:"updatePosition",value:function(e,i,n,s){var u=this.root,l=this.config,f=this._state;if(u){f.now=n,this.transformTimeHook(n);var h=this.timeStr;s&&s.target&&c.hasClass(s.target,"xgplayer-spot")?(this.showTips(s.target.getAttribute("data-text"),!1,h),this.focusDot(s.target),f.f=!0,l.isFocusDots&&f.f&&(f.now=parseInt(s.target.getAttribute("data-time"),10))):l.defaultText?(f.f=!1,this.showTips(l.defaultText,!0,h)):(f.f=!1,this.hideTips("")),this.updateTimeText(h),this.updateThumbnails(f.now),this.updateLinePos(e,i)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var i=this.player,n=this.videoPreview,s=this.config,u=i.plugins.thumbnail;if(u&&u.usable){this.thumbnail&&u.update(this.thumbnail,e,s.width,s.height);var l=n&&n.getBoundingClientRect();this.videothumbnail&&u.update(this.videothumbnail,e,l.width,l.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(L.device!=="mobile"){var i=this.player,n=this.config,s=i.getPlugin("thumbnail");if(s&&s.setConfig(e),!s||!s.usable||!n.isShowThumbnail){c.addClass(this.root,"short-line no-thumbnail");return}else c.removeClass(this.root,"short-line no-thumbnail");n.mode==="short"&&c.addClass(this.root,"short-line"),this._hasThumnail=!0;var u=this.find(".xg-spot-thumbnail");this.thumbnail=s.createThumbnail(u,"progress-thumbnail"),n.isShowCoverPreview&&(this.videoPreview=c.createDom("xg-video-preview","",{},"xgvideo-preview"),i.root.appendChild(this.videoPreview),this.videothumbnail=s.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}}},{key:"calcuPosition",value:function(e,i){var n=this.player.plugins.progress,s=this.player,u=n.root.getBoundingClientRect().width,l=s.duration/u*6;return e+i>s.duration&&(i=s.duration-e),e/s.duration*100,i/s.duration,{left:e/s.duration*100,width:i/s.duration*100,isMini:i<l}}},{key:"showDot",value:function(e){var i=this.findDot(e);if(i){var n=this.root.getBoundingClientRect(),s=n.width,u=i.time/this.player.duration*s;this.updatePosition(u,s,i.time)}}},{key:"focusDot",value:function(e,i){e&&(i||(i=e.getAttribute("data-id")),c.addClass(e,"active"),this._activeDotId=i)}},{key:"blurDot",value:function(e){if(!e){var i=this._activeDotId;e=this.getDotDom(i)}e&&(c.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";c.addClass(this.root,"no-timepoint"),e&&(c.addClass(this.find(".xg-spot-content"),"show-text"),i&&this.config.mode==="production"?(c.addClass(this.root,"product"),this.tipText.textContent=e):(c.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(n," ").concat(e)))}},{key:"hideTips",value:function(){c.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",c.removeClass(this.find(".xg-spot-content"),"show-text"),c.removeClass(this.root,"product")}},{key:"hide",value:function(){c.addClass(this.root,"hide")}},{key:"show",value:function(e){c.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,i=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(i.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,i=this.player.plugins.progress;i&&Object.keys(Se).map(function(n){i.removeCallBack(n,e[Se[n]])}),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 L.device==="mobile"||this.playerConfig.isMobileSimulateMode==="mobile"?"":'<div class="xg-spot-info hide '.concat(this.config.mode==="short"?"short-line":"",`">
<div class="xg-spot-content">
<div class="xg-spot-thumbnail">
<span class="xg-spot-time"></span>
</div>
<div class="xg-spot-text"><span class="spot-inner-text"></span></div>
</div>
<div class="xgplayer-progress-point">00:00</div>
<div class="xg-spot-ext-text"></div>
<div class="xg-spot-line"></div>
</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}}}]),r}(F),ls=function(o){w(r,o);var a=x(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.ratio=1,e.interval=null,e._preloadMark={},e}return S(r,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([ue],function(){var i=e.config,n=i.pic_num,s=i.interval;e.usable&&(e.interval=s>0?s:Math.round(e.player.duration*1e3/n)/1e3)})}},{key:"setConfig",value:function(e){var i=this;if(e){var n=Object.keys(e);n.length<1||(n.forEach(function(s){i.config[s]=e[s]}),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,i=e.urls,n=e.pic_num;return i&&i.length>0&&n>0}},{key:"initThumbnail",value:function(){var e=this.config,i=e.width,n=e.height,s=e.pic_num,u=e.interval;this.ratio=i/n*100,this.interval=u||Math.round(this.player.duration/s),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var i=this;if(!this._preloadMark[e]){var n=this.config.urls,s=n.length,u=[];e>0&&u.push(e-1),u.push(e),e>0&&e<s-1&&u.push(e+1),u.map(function(l){!i._preloadMark[l]&&l>=0&&l<s&&(i._preloadMark[l]=1,c.preloadImg(n[l],function(){i._preloadMark[l]=2}))})}}},{key:"getPosition",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=this.config,u=s.pic_num,l=s.row,f=s.col,h=s.width,d=s.height;this.interval=Math.round(this.player.duration/u);var g=Math.ceil(e/this.interval);g=g>u?u:g;var p=g<l*f?0:Math.ceil(g/(l*f))-1,m=g-p*(f*l),_=m>0?Math.ceil(m/f)-1:0,b=m>0?m-_*f-1:0,T=0,k=0;if(i&&n){var D=i/n;D<h/d?(k=n,T=k*(h/d)):(T=i,k=T/(h/d))}else n?i||(k=n||d,T=k*(h/d)):(T=i||h,k=T/(h/d));var A=this.getUrlByIndex(p);return{urlIndex:p,rowIndex:_,colIndex:b,url:A,height:k,width:T,style:{backgroundImage:"url(".concat(A,")"),backgroundSize:"".concat(T*f,"px auto"),backgroundPosition:"-".concat(b*T,"px -").concat(_*k,"px"),width:"".concat(T,"px"),height:"".concat(k,"px")}}}},{key:"update",value:function(e,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",l=this.config,f=l.pic_num,h=l.urls;if(!(f<=0||!h||h.length===0)){var d=this.getPosition(i,n,s);this.preload(d.urlIndex),Object.keys(d.style).map(function(g){e.style[g]=d.style[g]}),Object.keys(u).map(function(g){e.style[g]=u[g]})}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,i){var n=c.createDom("xg-thumbnail","",{},"thumbnail ".concat(i));return e&&e.appendChild(n),n}}],[{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}}}]),r}(F);function yt(o){return o?"background:".concat(o,";"):""}var cs=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onTimeupdate",function(){var s=t.player.ended,u=v(t),l=u.offsetDuration,f=t.currentTime;f=c.adjustTimeByDuration(f,l,s),t.update({played:f},l)}),t}return S(r,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,n=e.currentTime;return i>=0?i:n}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on($,this.onTimeupdate),this.on(Ce,function(){e.reset()}))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},i=arguments.length>1?arguments[1]:void 0;!i||!this.root||(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/i*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/i*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,i=e.commonStyle,n=e.miniprogress;if(n){var s=this.config,u=s.mode,l=s.height,f={cached:yt(i.cachedColor),played:yt(i.playedColor),progress:yt(i.progressColor),height:l>0&&l!==2?"height: ".concat(l,"px;"):""},h=u==="show"?"xg-mini-progress-show":"";return'<xg-mini-progress class="xg-mini-progress '.concat(h,'" style="').concat(f.progress," ").concat(f.height,`">
<xg-mini-progress-cache class="xg-mini-progress-cache" style="`).concat(f.cached,`"></xg-mini-progress-cache>
<xg-mini-progress-played class="xg-mini-progress-played" style="`).concat(f.played,`"></xg-mini-progress-played>
</xg-mini-progress>`)}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),r}(F),we={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",POSTER:"poster"};function fs(){try{return parseInt(window.performance.now(),10)}catch(o){return new Date().getTime()}}function hs(){try{var o=document.createElement("canvas").getContext;return!!o}catch(a){return!1}}var Be=null,ds=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onLoadedData",function(s){t.player&&(t._frameCount=t.config.startFrameCount,t.stop(),t.renderOnTimeupdate(s),t.off($,t.renderOnTimeupdate),t.on($,t.renderOnTimeupdate))}),y(v(t),"onVisibilitychange",function(s){document.visibilityState==="visible"?t._checkIfCanStart()&&t.start():document.visibilityState==="hidden"&&t.stop()}),y(v(t),"renderOnTimeupdate",function(s){if(t._frameCount>0)t.renderOnce(),t._frameCount--;else{t._isLoaded=!0,t.off($,t.renderOnTimeupdate);var u=t.config.startInterval;!t.player.paused&&t._checkIfCanStart()&&t.start(0,u)}}),y(v(t),"start",function(s,u){var l=t.player.video,f=fs(),h=t.checkVideoIsSupport(l);!h||!t.canvasCtx||(u||(u=t.interval),t.stop(),l.videoWidth&&l.videoHeight&&(t.videoPI=l.videoHeight>0?parseInt(l.videoWidth/l.videoHeight*100,10):0,(t.config.mode===we.REAL_TIME||f-t.preTime>=u)&&(l&&l.videoWidth&&t.update(h,t.videoPI),t.preTime=f)),t.frameId=t._loopType==="timer"?c.setTimeout(v(t),t.start,u):c.requestAnimationFrame(t.start))}),y(v(t),"stop",function(){t.frameId&&(t._loopType==="timer"?c.clearTimeout(v(t),t.frameId):c.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return S(r,[{key:"afterCreate",value:function(){var e=this;this.playerConfig.dynamicBg===!0&&(this.config.disable=!1),r.isSupport||(this.config.disable=!0);var i=this.config,n=i.disable,s=i.mode,u=i.frameRate;n||(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/u,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==we.REAL_TIME&&this.interval>=1e3?"timer":"animation",this.once(Qe,function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())}),s!==we.POSTER&&(s!==we.FIRST_FRAME&&(this.on(Ce,function(){e.stop()}),this.on(q,function(){var l=e.config.startInterval;e._checkIfCanStart()&&e.start(0,l)}),this.on(Ie,function(){e.stop()})),this.on(oe,this.onLoadedData),this.on(It,function(){e._isLoaded=!1,e.stop()}),document.addEventListener("visibilitychange",this.onVisibilitychange)))}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(n){n==="root"&&e[n]!==i.config[n]?i.reRender(e[n]):n==="frameRate"?i.interval=parseInt(1e3/e[n],10):n==="disable"&&e[n]&&i.stop(),i.config[n]=e[n]})}},{key:"init",value:function(e){var i=this.player,n=this.config;this.canvasFilter=r.supportCanvasFilter();try{var s=e||n.root;s||(s=n.isInnerRender&&i.innerContainer||i.root),s.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,`"><canvas>
</canvas><xgmask></xgmask></div>`)),this.root=s.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=n.filter,this.canvas.style.webkitFilter=n.filter),this.mask=this.find("xgmask"),n.addMask&&(this.mask.style.background=n.maskBg),this.canvasCtx=this.canvas.getContext("2d")}catch(u){O.logError("plugin:DynamicBg",u)}}},{key:"reRender",value:function(e){var i=this.config.disable;if(!(!i&&!this.root)){this.stop();var n=this.root?this.root.parentElement:null;if(n!==e&&n.removeChild(this.root),!e){this.root=null;return}this.init(e),this.renderOnce();var s=this.config.startInterval;this._checkIfCanStart()&&this.start(0,s)}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var i=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(i&&!(L.browser==="safari"&&c.isMSE(i)))return i;var n=i?i.tagName.toLowerCase():"";return n==="canvas"||n==="img"?i:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var i=c.typeOf(e)==="String"?e:c.typeOf(e.poster)==="String"?e.poster:null;this.updateImg(i)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==we.FIRST_FRAME&&e!==we.POSTER}},{key:"renderOnce",value:function(){var e=this.player.video;if(!(!e.videoWidth||!e.videoHeight)){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var i=this.checkVideoIsSupport(e);i&&this.update(i,this.videoPI)}}},{key:"updateImg",value:function(e){var i=this;if(e){var n=this.canvas.getBoundingClientRect(),s=n.width,u=n.height,l=new window.Image;l.onload=function(){if(!(!i.canvas||i.frameId||i.isStart)){i.canvas.height=u,i.canvas.width=s;var f=parseInt(s/u*100,10);i.update(l,f),l=null}},l.src=e}}},{key:"update",value:function(e,i){if(!(!this.canvas||!this.canvasCtx||!i))try{var n=this._pos,s=this.config,u=this.canvas.getBoundingClientRect(),l=u.width,f=u.height;if(l!==n.width||f!==n.height||n.pi!==i){var h=parseInt(l/f*100,10);n.pi=i,n.width!==l&&(n.width=this.canvas.width=l),n.height!==f&&(n.height=this.canvas.height=f);var d=f,g=l;h<i?g=parseInt(f*i/100,10):h>i&&(d=parseInt(l*100/i,10)),n.rwidth=g*s.multiple,n.rheight=d*s.multiple,n.x=(l-n.rwidth)/2,n.y=(f-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=s.filter),this.canvasCtx.drawImage(e,n.x,n.y,n.rwidth,n.rheight)}catch(p){O.logError("plugin:DynamicBg",p)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),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,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return typeof Be=="boolean"||(Be=hs()),Be}},{key:"supportCanvasFilter",value:function(){return!(L.browser==="safari"||L.browser==="firefox")}}]),r}(F),gs={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:"解码错误",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:"直播"}},Ae="info",_t=Vi,ps=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"_recordUserActions",function(s){var u=t._getTime(),l=Object.assign({},s,{msg:s.msg||s.action});t._stats[Ae].push(U(U({type:"userAction"},u),{},{payload:l}))}),y(v(t),"_onReset",function(){t.reset()}),y(v(t),"_recordInfo",function(s){t.info(s)}),y(v(t),"_downloadStats",function(){var s=t.getStats(),u=new Blob([JSON.stringify(s)],{type:"application/json"}),l=window.URL.createObjectURL(u),f=document.createElement("a");f.style.display="none",f.href=l,f.download="player.txt",f.disabled=!1,f.click()}),t}return S(r,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:new Date().toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(Ye,this._recordUserActions),this.on(_t.STATS_INFO,this._recordInfo),this.on(_t.STATS_DOWNLOAD,this._downloadStats),this.on(_t.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 i=this._getTime();this._stats[Ae].push(U(U({},i),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var i=Date.now(),n=i-e.startMs,s=U({cat:"function",dur:n,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(s)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(e={},y(e,Ae,[]),y(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player,i=e.media,n=[],s=0;s<i.buffered.length;s++)n.push({start:i.buffered.start(s),end:i.buffered.end(s)});var u={currentTime:i.currentTime,readyState:i.readyState,buffered:n,paused:i.paused,ended:i.ended};return this._stats.media=u,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){var e=this._stats[Ae],i=e.map(function(n){var s=n.payload.data,u="";try{s instanceof Error?u=s.msg:s!==void 0&&(u=JSON.stringify(s))}catch(l){console.log("err",l)}return"[".concat(n.timeFormat,"] : ").concat(n.payload.msg," ").concat(u," ")});return i}},{key:"_getProfile",value:function(){var e={traceEvents:[]},i=this._stats[Ae];return i.forEach(function(n){n.payload.profile&&e.traceEvents.push(n.payload)}),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),r}(ge),qi=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onGapJump",function(){var s=v(t),u=s.player,l=s.config;if(u.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(u.media.seeking){if(!t.seekingEventReceived)return}else t.seekingEventReceived=!1;if(!(u.media.paused&&u.media.currentTime!==0&&t.hasPlayed)){var f=u.media.buffered,h=l.smallGapLimit||.5,d=l.gapDetectionThreshold||.3,g=u.media.currentTime,p=t._getIndex(f,g,d);if(!(p===null||p===0)){console.log("GapJump bufferRange ",f.start(p),f.end(p));var m=f.start(p)+.1,_=u.media.duration;if(!(m>_)){var b=m-g,T=b<=h;b<r.BROWSER_GAP_TOLERANCE||T&&(l.useGapJump!==!1&&(u.media.currentTime=t.isSafari?m+.1:m),t.player&&t.player.emit("detectGap"),console.log("gapJump gapIndex",p," isGapSamll:",T," currentTime:",u.media.currentTime," jumpSize:",g-u.media.currentTime),m!==.08&&u&&u.emit("log",{type:"oneevent",end_type:"gap",vid:u.config.vid,ext:{video_postion:Math.floor(m*1e3)}}))}}}}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.config.useGapJump;i!==!1&&(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(Oe,this.onGapJump),this.on(q,function(){e.hasPlayed=!0}),this.on(Je,function(){e.seekingEventReceived=!0}))}},{key:"_getIndex",value:function(e,i,n){if(!e||!e.length||e.length===1&&e.end(0)-e.start(0)<1e-6)return null;for(var s=this._getBuffered(e),u=null,l=0;l<s.length;l++){var f=s[l];if(f.start>i&&(l===0||s[l-1].end-i<=n)){u=l;break}}return u}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var i=[],n=0;n<e.length;n++)i.push({start:e.start(n),end:e.end(n)});return i}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),r}(F);qi.BROWSER_GAP_TOLERANCE=.001;var vs=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"onWaiting",function(){var s=v(t),u=s.config;t.jumpCnt>u.jumpCntMax||t.timer||u.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,u.waitingTime*1e3))}),y(v(t),"onJump",function(){var s=v(t),u=s.player,l=s.config;if(clearTimeout(t.timer),t.timer=null,!(t.jumpCnt>l.jumpCntMax||l.useWaitingTimeoutJump===!1)&&!(u.media.paused&&u.media.currentTime!==0&&t.hasPlayed)){t.jumpSize=l.jumpSize*(t.jumpCnt+1),t.jumpCnt===l.jumpSize&&t.jumpSize<6&&(t.jumpSize=6);var f=u.currentTime+t.jumpSize,h=u.media.duration;f>h||(t.jumpCnt++,u.currentTime=f)}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.useWaitingTimeoutJump,s=i.jumpSize;n!==!1&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=s,this.on(Oe,this.onWaiting),this.on([Pt,se],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on(q,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(F),xe="cdn",He=["cdn"],ms=function(o){w(r,o);var a=x(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=a.call.apply(a,[this].concat(i)),y(v(t),"getSpeed",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xe;if(!t.speedListCache||!t.speedListCache[s]||t.speedListCache[s].length<=0)return 0;var u=0;return t.speedListCache[s].map(function(l){u+=l}),Math.floor(u/t.speedListCache[s].length)}),y(v(t),"startTimer",function(){c.isMSE(t.player.video)||(t.initSpeedList(),t.cnt=0,t.timer=setTimeout(t.testSpeed,t.config.testTimeStep))}),y(v(t),"initSpeedList",function(){t.speedListCache={},He.forEach(function(s){t.speedListCache[s]=[]})}),y(v(t),"_onRealSpeedChange",function(s){s.speed&&t.appendList(s.speed,s.type||xe)}),y(v(t),"testSpeed",function(){if(clearTimeout(t.timer),t.timer=null,!(!t.player||!t.config.openSpeed)){var s=t.config,u=s.url,l=s.loadSize,f=s.testCnt,h=s.testTimeStep,d=u+(u.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=f)){t.cnt++;try{var g=new Date().getTime(),p=null,m=new XMLHttpRequest;t.xhr=m,m.open("GET",d);var _={},b=Math.floor(Math.random()*10);_.Range="bytes="+b+"-"+(l+b),_&&Object.keys(_).forEach(function(T){m.setRequestHeader(T,_[T])}),m.onreadystatechange=function(){if(m.readyState===4){t.xhr=null,p=new Date().getTime();var T=m.getResponseHeader("Content-Length")/1024*8,k=Math.round(T*1e3/(p-g));t.appendList(k),t.timer=setTimeout(t.testSpeed,h)}},m.send()}catch(T){console.error(T)}}}}),y(v(t),"appendList",function(s){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xe;if(!(!t.speedListCache||!t.speedListCache[u])){var l=t.config.saveSpeedMax;t.speedListCache[u].length>=l&&t.speedListCache[u].shift(),t.speedListCache[u].push(s);var f=v(t),h=f.player;h&&(u===xe?h.realTimeSpeed=s:h[t.getSpeedName("realTime",u)]=s),t.updateSpeed(u)}}),y(v(t),"updateSpeed",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xe,u=t.getSpeed(s),l=v(t),f=l.player;if(f)if(s===xe)(!f.avgSpeed||u!==f.avgSpeed)&&(f.avgSpeed=u,f.emit(bt,{speed:u,realTimeSpeed:f.realTimeSpeed}));else{var h=t.getSpeedName("avg",s);(!f[h]||u!==f[h])&&(f[h]=u,f.emit(bt,{speed:u,realTimeSpeed:f.realTimeSpeed}))}}),t}return S(r,[{key:"afterCreate",value:function(){var e=this.config,i=e.openSpeed,n=e.addSpeedTypeList;(n==null?void 0:n.length)>0&&He.push.apply(He,Q(n)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,i&&this.on([oe,We],this.startTimer)}},{key:"getSpeedName",value:function(e,i){return e+"Speed"+i.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer){clearTimeout(this.timer),this.timer=null;return}if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([oe,We],this.startTimer),He.forEach(function(i){e.speedListCache&&e.speedListCache[i]&&(e.speedListCache[i]=[])}),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&this.xhr.readyState!==4&&(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:200*1024,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),r}(F),ys=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.config,s=i.media||i.video;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],!n.disabled){var u=s.getVideoPlaybackQuality;u&&(this.on(q,function(){e._startTick()}),this.on(Ie,function(){e._stopTick()}),this.on(_e,function(){e._stopTick()}),this.on(Ce,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:"_checkBuffer",value:function(e,i){for(var n=!1,s=[],u=0;u<i.length;u++){var l=i.start(u),f=i.end(u);if(s.push({start:l,end:f}),l<=e&&e<=f-1){n=!0;break}}return{enoughBuffer:n,buffers:s}}},{key:"_checkStuck",value:function(e,i,n,s){var u=this.player.media||this.player.video,l=document.hidden,f=u.paused,h=u.readyState,d=u.currentTime,g=u.buffered;if(!(l||f||h<4)){var p=this._checkBuffer(d,g),m=p.enoughBuffer,_=p.buffers;m&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:d,buffers:_,curDecodedFrames:e,totalVideoFrames:i,droppedVideoFrames:n,checkInterval:s}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(ji,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var i=e.getVideoPlaybackQuality(),n=i.totalVideoFrames,s=i.droppedVideoFrames,u=performance.now();if(n&&this._lastCheckPoint){var l=n-this._lastDecodedFrames,f=u-this._lastCheckPoint;this._checkStuck(l,n,s,f)}this._lastDecodedFrames=n,this._lastCheckPoint=u}}},{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}}}]),r}(F);Pe.use(gs);var _s=S(function o(a,r){var t,e,i;E(this,o);var n=r&&r.isMobileSimulateMode==="mobile",s=r.isLive,u=s?[]:[Or,wr,cs,us,Rr],l=[].concat(u,[xr,Dr,Ur,zr,ts,is,Zr,Jr,Br,Wr]),f=[ar,or,lr,br,cr,ss,as,ls,gr];this.plugins=[ps,rr].concat(Q(l),f,[qi,vs]);var h=n?"mobile":L.device;switch(h){case"pc":(t=this.plugins).push.apply(t,[pi,vt,yi,ms,ys]);break;case"mobile":(e=this.plugins).push.apply(e,[Cr]);break;default:(i=this.plugins).push.apply(i,[pi,vt,yi])}(L.os.isIpad||h==="pc")&&this.plugins.push(ds),L.os.isIpad&&this.plugins.push(vt),this.ignores=[],this.i18n=[]}),ee=function(o){w(r,o);var a=x(r);function r(){return E(this,r),a.apply(this,arguments)}return S(r)}(it);y(ee,"defaultPreset",_s);y(ee,"Util",c);y(ee,"Sniffer",L);y(ee,"Errors",je);y(ee,"Events",Nn);y(ee,"Plugin",F);y(ee,"BasePlugin",ge);y(ee,"I18N",Pe);y(ee,"STATE_CLASS",C);y(ee,"InstManager",Yi);const Cs={class:"card-header"},ks={class:"font-medium"},Ts=Qi({name:"VideoPage",__name:"video",setup(o){return en(()=>{new ee({id:"mse",lang:"zh",volume:0,autoplay:!1,screenShot:!0,videoAttributes:{crossOrigin:"anonymous"},url:"//lf3-static.bytednsdoc.com/obj/eden-cn/nupenuvpxnuvo/xgplayer_doc/xgplayer-demo.mp4",poster:"//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/byted-player-videos/1.0.0/poster.jpg",fluid:tn(),playbackRate:[.5,.75,1,1.5,2]})}),(a,r)=>{const t=Vt("el-link"),e=Vt("el-card");return ki(),nn(e,{shadow:"never"},{header:Me(()=>[Ue("div",Cs,[Ue("span",ks,[r[1]||(r[1]=nt(" 视频组件,采用开源的 ")),Ht(t,{href:"https://v3.h5player.bytedance.com/",target:"_blank",icon:Ut(sn)(Ut(un)),style:{margin:"0 4px 5px","font-size":"16px"}},{default:Me(()=>r[0]||(r[0]=[nt(" 西瓜播放器 ")])),_:1},8,["icon"])])]),Ht(t,{class:"mt-2",href:"https://github.com/pure-admin/vue-pure-admin/blob/main/src/views/able/video.vue",target:"_blank"},{default:Me(()=>r[2]||(r[2]=[nt(" 代码位置 src/views/able/video.vue ")])),_:1})]),default:Me(()=>[r[3]||(r[3]=Ue("div",{id:"mse"},null,-1))]),_:1})}}}),Ss=rn(Ts,[["__scopeId","data-v-892154db"]]);export{Ss as default};