import{g as ut,c as bi,R as Ti,_ as Ei}from"./index-fa5d6b3f.js";import{u as wi}from"./hooks-a12c1294.js";const Si={width:1024,height:1024,body:''},xi=Si;function wt(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 B(o){for(var a=1;a"u"||!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{return!1}}function p(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function lt(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 p(o)}function I(o){var a=Pi();return function(){var t=S(o),e;if(a){var i=S(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return lt(this,e)}}function Ii(o,a){for(;!Object.prototype.hasOwnProperty.call(o,a)&&(o=S(o),o!==null););return o}function x(){return typeof Reflect<"u"&&Reflect.get?x=Reflect.get.bind():x=function(a,r,t){var e=Ii(a,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?a:t):i.value}},x.apply(this,arguments)}function re(o){return Ai(o)||Li(o)||Di(o)||Ri()}function Ai(o){if(Array.isArray(o))return rt(o)}function Li(o){if(typeof Symbol<"u"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)}function Di(o,a){if(o){if(typeof o=="string")return rt(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 rt(o,a)}}function rt(o,a){(a==null||a>o.length)&&(a=o.length);for(var r=0,t=new Array(a);r-1,Ye={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Ke="%c[xgplayer]",L={config:{debug:Ni?3:0},logInfo:function(a){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i=3&&(r=console).log.apply(r,[Ke,Ye.info,a].concat(e))},logWarn:function(a){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i=1&&(r=console).warn.apply(r,[Ke,Ye.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;n0&&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 L.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{var r=o.className&&j(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{c.hasClass(o,a)||(o.className&&j(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{c.hasClass(o,a)&&a.split(/\s+/g).forEach(function(t){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");o.className&&j(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;t0&&arguments[0]!==void 0?arguments[0]:document,a=arguments.length>1?arguments[1]:void 0,r;try{r=o.querySelector(a)}catch(t){L.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,re(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-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&&j(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>"u"||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 Bi(o,a){for(var r=0,t=a.length;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&&(Bi(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(),o.cancelable&&o.preventDefault())};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;ts&&(e[n-1].end=r[i].end):e.push(r[i])}else e.push(r[i])}else e=r;return new Hi(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||!(o instanceof HTMLMediaElement)?!1:/^blob/.test(o.currentSrc)||/^blob/.test(o.src)};c.generateSessionId=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=new Date().getTime();try{o=parseInt(o)}catch{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||Y<0||f&&$>=i}function H(){var R=Date.now();if(b(R))return M(R);s=_(H,T(R))}function M(R){return s=void 0,d&&t?v(R):(t=e=void 0,n)}function z(){s!==void 0&&m(s),l=0,t=u=e=s=void 0}function N(){return s===void 0?n:M(Date.now())}function W(){return s!==void 0}function V(){for(var R=Date.now(),Y=b(R),$=arguments.length,q=new Array($),ae=0;ae<$;ae++)q[ae]=arguments[ae];if(t=q,e=this,u=R,Y){if(s===void 0)return k(u);if(f)return s=_(H,a),v(u)}return s===void 0&&(s=_(H,a)),n}return V.cancel=z,V.flush=N,V.pending=W,V}function Vi(o,a,r){var t=!0,e=!0;if(typeof o!="function")throw new TypeError("Expected a function");return ti(r)&&(t="leading"in r?!!r.leading:t,e="trailing"in r?!!r.trailing:e),Ui(o,a,{leading:t,trailing:e,maxWait:a})}function Gi(){var o=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return o==="zh-cn"&&(o="zh"),o}function ji(o,a,r){if(o){var t=o.getAttribute(r);return!!(t&&t===a&&(o.tagName==="VIDEO"||o.tagName==="AUDIO"))}}var xt={android:/(Android)\s([\d.]+)/,ios:/(Version)\/([\d.]+)/},Wi=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],A={get device(){var o=A.os;return o.isPc?"pc":"mobile"},get browser(){if(typeof navigator>"u")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>"u")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)||t&&!/(?:Mobile)/.test(o)||e&&/(?:Tablet)/.test(o),n=/(?:iPhone)/.test(o)&&!i,s=!n&&!t&&!r&&!i,u=/(?:iPad|PlayBook)/.test(o);return{isTablet:i,isPhone:n,isIpad:u,isIos:n||u,isAndroid:t,isPc:s,isSymbian:r,isWindowsPhone:a,isFireFox:e}},get osVersion(){if(typeof navigator>"u")return 0;var o=navigator.userAgent,a="";/(?:iPhone)|(?:iPad|PlayBook)/.test(o)?a=xt.ios:a=xt.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>"u")return!1;var o=/(micromessenger)\/([\d.]+)/,a=o.exec(navigator.userAgent.toLocaleLowerCase());return!!a},isSupportMP4:function(){var a={isSupport:!1,mime:""};if(typeof document>"u")return a;if(this.supportResult)return this.supportResult;var r=document.createElement("video");return typeof r.canPlayType=="function"&&Wi.map(function(t){r.canPlayType('video/mp4; codecs="'.concat(t,'"'))==="probably"&&(a.isSupport=!0,a.mime+="||".concat(t))}),this.supportResult=a,r=null,a},isHevcSupported:function(){return typeof MediaSource>"u"||!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>"u")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{return Promise.resolve(r)}}},st="3.0.2",zi={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},Pt={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},ct=w(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,h=a.media,f=h.readyState,d=h.networkState,g=r.errorCode||e.code;Pt[g]&&(g=Pt[g]);var v={playerVersion:st,currentTime:n,duration:i,ended:s,readyState:f,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){v[T]=r.ext[T]}),v}else if(arguments.length>1){for(var _={playerVersion:st,domain:document.domain},m=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],k=0;k0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers||(this._evHandlers=fi.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,nn(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(f){n.media.appendChild(c.createDom("source","",{src:"".concat(f.src),type:"".concat(f.type||"")}))});var s=e.children;if(s){this._videoSourceCount=s.length;for(var u=null,l=0;l0;)e.removeChild(i[0])}}},{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?zi[n.code]:"other",u=n.message;this.media.currentSrc||(u="empty_src",n={code:6,message:u}),this.emit(e,new ct(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=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(We,e),this.emit(Ae),this._currentTime=0,this._duration=0,/^blob/.test(this.media.currentSrc)||/^blob/.test(this.media.src)){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:"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;l2?s-2:0),l=2;l2?s-2:0),l=2;l2?s-2:0),l=2;l0&&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 w(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;n3?t-3:0),i=3;i2&&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(u){throw u.message="[pluginName: ".concat(this.pluginName,":").concat(o,":pre error] >> ").concat(u.message),u}if(this.__hooks&&this.__hooks[o])try{var n,s=(n=this.__hooks[o]).call.apply(n,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then(function(u){u!==!1&&Le.apply(void 0,[e,a,r.next].concat(re(t)))}).catch(function(u){throw u}):Le.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments))):s===void 0&&Le.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments)))}catch(u){throw u.message="[pluginName: ".concat(this.pluginName,":").concat(o,"] >> ").concat(u.message),u}else Le.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function Ue(o,a){var r=this.__hooks;if(r)return r.hasOwnProperty(o)?(r&&(r[o]=a),!0):(console.warn("has no supported hook which name [".concat(o,"]")),!1)}function Ve(o,a){var r=this.__hooks;r&&delete r[o]}function Dt(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;e1?r-1:0),e=1;e1&&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 vi(o){o.__hooks=null}function ue(o,a,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i1?e-1:0),n=1;n2&&arguments[2]!==void 0?arguments[2]:{};if(this.player){var i=B(B({},e),{},{pluginName:this.pluginName});this.player.emitUserAction(r,t,i)}}},{key:"hook",value:function(r,t){return Be.call.apply(Be,[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;n2?e-2:0),n=2;n1&&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),vi(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:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),o}(),an=9;if(typeof Element<"u"&&!Element.prototype.matches){var pe=Element.prototype;pe.matches=pe.matchesSelector||pe.mozMatchesSelector||pe.msMatchesSelector||pe.oMatchesSelector||pe.webkitMatchesSelector}function on(o,a){for(;o&&o.nodeType!==an;){if(typeof o.matches=="function"&&o.matches(a))return o;o=o.parentNode}}var un=on,ln=un;function qe(o,a,r,t,e){var i=hn.apply(this,arguments);return o.addEventListener(r,i,e),{destroy:function(){o.removeEventListener(r,i,e)}}}function cn(o,a,r,t,e){return typeof o.addEventListener=="function"?qe.apply(null,arguments):typeof r=="function"?qe.bind(null,document).apply(null,arguments):(typeof o=="string"&&(o=document.querySelectorAll(o)),Array.prototype.map.call(o,function(i){return qe(i,a,r,t,e)}))}function hn(o,a,r,t){return function(e){e.delegateTarget=ln(e.target,a),e.delegateTarget&&t.call(o,e)}}var fn=cn;const Ot=ut(fn);var dn={CONTROLS:"controls",ROOT:"root"},F={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"};function Ze(o){return o?o.indexOf&&/^(?:http|data:|\/)/.test(o):!1}function gn(o,a){return j(o)==="object"&&o.class&&typeof o.class=="string"?"".concat(a," ").concat(o.class):a}function pn(o,a){return j(o)==="object"&&o.attr&&j(o.attr)==="object"&&Object.keys(o.attr).map(function(r){a[r]=o.attr[r]}),a}function Mt(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(Ze(o)||Ze(o.url))return t.src=Ze(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):(L.logWarn("warn>>icons.".concat(a," in config of plugin named [").concat(e,"] is a function mast return an Element Object")),null)}catch(n){return L.logError("Plugin named [".concat(e,"]:createIcon"),n),null}return typeof o=="string"?c.createDomFromHtml(o,t,r):(L.logWarn("warn>>icons.".concat(a," in config of plugin named [").concat(e,"] is invalid")),null)}function vn(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=pn(r[t],n),s=Mt(r[t],t,i,n,a.pluginName)),!s&&e&&(s=Mt(e.icon?e.icon:e,n,i,{},a.pluginName)),a.icons[t]=s})}function mn(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 O=function(o){P(r,o);var a=I(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 w(r,[{key:"__init",value:function(e){if(x(S(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()||{};vn(s,this),this.langText={};var u=this.registerLanguageTexts()||{};mn(u,this);var l="";try{l=this.render()}catch(d){throw L.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 h=this.config.attr||{},f=this.config.style||{};this.setAttr(h),this.setStyle(f),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&&j(i)==="object"&&Object.keys(i).length>0&&Object.keys(i).map(function(n){var s=n,u=i[s],l={root:e.root},h,f;typeof u=="function"?(h=e.config[s]||{},f=u):j(u)==="object"&&typeof u.plugin=="function"&&(h=u.options?c.deepCopy(e.config[s]||{},u.options):e.config[s]||{},f=u.plugin),l.config=h,h.index!==void 0&&(l.index=h.index),h.root&&(l.root=h.root),e.registerPlugin(f,l,s)})}}},{key:"updateLang",value:function(e){e||(e=this.lang);function i(l,h){for(var f=0;f0?i(l.children[f],h):h(l.children[f])}var n=this.root,s=this.i18n,u=this.langText;n&&i(n,function(l){var h=l.getAttribute&&l.getAttribute("lang-key");if(h){var f=s[h.toUpperCase()]||u[h];f&&(l.innerHTML=typeof f=="function"?f(e):f)}})}},{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:"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=x(S(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;u2&&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 L.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)),x(S(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 h=0,f=null,d="";h=u){d="beforebegin";break}else g4&&arguments[4]!==void 0?arguments[4]:!1,l=[];if(e instanceof window.Node&&typeof s=="function")if(Array.isArray(n))n.forEach(function(f){var d=Ot(e,i,f,s,u);d.key="".concat(i,"_").concat(f),l.push(d)});else{var h=Ot(e,i,n,s,u);h.key="".concat(i,"_").concat(n),l.push(h)}return l}},{key:"ROOT_TYPES",get:function(){return dn}},{key:"POSITIONS",get:function(){return F}}]),r}(he),yn=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-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(e,i){r===e.target&&(t=i)});try{this.observer&&this.observer.unobserve(r)}catch{}this.observer&&this.observer.unobserve(r),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(r){for(var t=this.__handlers,e=0;e2&&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=this.pluginGroup[e]._player;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"&&(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 f=new r(t);return i[s.toLowerCase()]=f,i[s.toLowerCase()].func=r,f&&typeof f.afterCreate=="function"&&f.afterCreate(),f}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 h=s[l].beforePlayerInit();u.push(t(h))}catch(f){throw u.push(t(null)),f}}),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{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()})}},setCurrentUserActive:function(a,r){if(this.pluginGroup[a]){if(!r)return this.pluginGroup[a]._player.isUserActive=r,a;for(var t=Object.keys(this.pluginGroup),e=0;e0&&this.setCurrentUserActive(u[u.length-1],!0)}}}},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 Nt(){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(){},ignores:[],whitelist:[],inactive:3e3,lang:Gi(),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,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}}}var kn=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,h=l===void 0?[]:l,f=n.icons,d=f===void 0?{}:f,g=n.i18n,v=g===void 0?[]:g;a.config.plugins||(a.config.plugins=[]),a.config.ignores||(a.config.ignores=[]),(t=a.config.plugins).push.apply(t,re(u)),(e=a.config.ignores).push.apply(e,re(h)),Object.keys(d).map(function(m){a.config.icons[m]||(a.config.icons[m]=d[m])});var _=a.config.i18n||[];v.push.apply(v,re(_)),a.config.i18n=v},bn=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n1&&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 F.CONTROLS_LEFT:i.root=this.left;break;case F.CONTROLS_RIGHT:i.root=this.right;break;case F.CONTROLS_CENTER:i.root=this.center;break;case F.CONTROLS:i.root=this.root;break;default:i.root=this.left}return x(S(r.prototype),"registerPlugin",this).call(this,e,i,n)}}}},{key:"destroy",value:function(){A.device!=="mobile"&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{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' `)}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),r}(O),Tn={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"}},K={lang:{},langKeys:[],textKeys:[]};function Pe(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,re(a[r]))}else t==="Object"?(e!=="Object"&&(o[r]={}),Pe(o[r],a[r])):o[r]=a[r]}),o}function mi(){Object.keys(K.lang.en).map(function(o){K.textKeys[o]=o})}function En(o,a){var r=[];if(a||(a=K),!!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]?Pe(e[i.LANG]||{},i.TEXT||{}):Ct(i,a)}),mi()}}function Ct(o,a){var r=o.LANG;if(a||(a=K),!!a.lang){var t=o.TEXT||{};r==="zh"&&(r="zh-cn"),a.lang[r]?Pe(a.lang[r],t):(a.langKeys.push(r),a.lang[r]=t),mi()}}function wn(o){var a,r={lang:{},langKeys:[],textKeys:{},pId:o};return Pe(r.lang,K.lang),(a=r.langKeys).push.apply(a,re(K.langKeys)),Pe(r.textKeys,K.textKeys),r}Ct(Tn);var _e={get textKeys(){return K.textKeys},get langKeys(){return K.langKeys},get lang(){var o={};return K.langKeys.map(function(a){o[a]=K.lang[a]}),K.lang["zh-cn"]&&(o.zh=K.lang["zh-cn"]||{}),o},extend:En,use:Ct,init:wn},D={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},Ft=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],Sn=["play","pause","replay","retry"],Ht=0,Bt=0,kt=function(o){P(r,o);var a=I(r);function r(t){var e;E(this,r);var i=c.deepMerge(Nt(),t);e=a.call(this,i),y(p(e),"canPlayFunc",function(){if(e.config){var v=e.config,_=v.autoplay,m=v.startTime,k=v.defaultPlaybackRate;L.logInfo("player","canPlayFunc, startTime",m),m&&(e.currentTime=m>e.duration?e.duration:m,e.config.startTime=0),e.playbackRate=k,(_||e._useAutoplay)&&e.mediaPlay(),e.off(Z,e.canPlayFunc),e.removeClass(C.ENTER)}}),y(p(e),"onFullscreenChange",function(v,_){var m=function(){c.setTimeout(p(e),function(){e.resize()},100)},k=c.getFullScreenEl();e._fullActionFrom?e._fullActionFrom="":e.emit(He,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:e.currentTime,duration:e.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var T=ji(k,e.playerId,oe);if(_||k&&(k===e._fullscreenEl||T))m(),!e.config.closeFocusVideoFocus&&e.media.focus(),e.fullscreen=!0,e.changeFullStyle(e.root,k,C.FULLSCREEN),e.emit(ne,!0,e._fullScreenOffset),e.cssfullscreen&&e.exitCssFullscreen();else if(e.fullscreen){m();var b=p(e),H=b._fullScreenOffset,M=b.config;M.needFullscreenScroll?(window.scrollTo(H.left,H.top),c.setTimeout(p(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):e.recoverFullStyle(e.root,e._fullscreenEl,C.FULLSCREEN),e._fullscreenEl=null,e.emit(ne,!1)}}),y(p(e),"_onWebkitbeginfullscreen",function(v){e._fullscreenEl=e.media,e.onFullscreenChange(v,!0)}),y(p(e),"_onWebkitendfullscreen",function(v){e.onFullscreenChange(v,!1)}),pi(p(e),Sn),e.config=i,e._pluginInfoId=c.generateSessionId(),Fi(p(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._state=D.INITIAL,e.isError=!1,e._hasStart=!1,e.isSeeking=!1,e.isCanplay=!1,e._useAutoplay=!1,e.rotateDeg=0,e.isActive=!1,e.fullscreen=!1,e.cssfullscreen=!1,e.isRotateFullscreen=!1,e._fullscreenEl=null,e._cssfullscreenEl=null,e.curDefinition=null,e._orgCss="",e._fullScreenOffset=null,e._videoHeight=0,e._videoWidth=0,e._accPlayed={t:0,acc:0,loopAcc:0},e.innerContainer=null,e.controls=null,e.topBar=null,e.root=null,e.__i18n=_e.init(e._pluginInfoId),A.os.isAndroid&&A.osVersion>0&&A.osVersion<6&&(e.config.autoplay=!1),e.database=new sn,e.isUserActive=!1;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"))),lt(e);var l=e.config,h=l.definition,f=h===void 0?{}:h,d=l.url;if(!d&&f.list&&f.list.length>0){var g=f.list.find(function(v){return v.definition&&v.definition===f.defaultDefinition});g||(f.defaultDefinition=f.list[0].definition,g=f.list[0]),e.config.url=g.url,e.curDefinition=g}return e._bindEvents(),e._registerPresets(),e._registerPlugins(),U.onPluginsReady(p(e)),e.getInitDefinition(),e.setState(D.READY),c.setTimeout(p(e),function(){e.emit(pt)},0),e.onReady&&e.onReady(),(e.config.videoInit||e.config.autoplay)&&(!e.hasStart||e.state0?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;L.logInfo("_startInit readyState",s),this.config.autoplay&&(!(/^blob/.test(this.media.currentSrc)||/^blob/.test(this.media.src))&&this.load(),(A.os.isIpad||A.os.isPhone)&&this.mediaPlay()),s>=2?this.canPlayFunc():this.once(Z,this.canPlayFunc),(!this.hasStart||this.state0&&arguments[0]!==void 0?arguments[0]:!0;this._loadingPlugins=[];var n=this.config.ignores||[],s=this.config.plugins||[],u=this.config.i18n||[];i&&_e.extend(u,this.__i18n);var l=n.join("||").toLowerCase().split("||"),h=this.plugins;s.forEach(function(f){try{var d=f.plugin?f.plugin.pluginName:f.pluginName;if(d&&l.indexOf(d.toLowerCase())>-1)return null;if(!i&&h[d.toLowerCase()])return;if(f.lazy&&f.loader){var g=U.lazyRegister(e,f);f.forceBeforeInit&&(g.then(function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}).catch(function(v){L.logError("_registerPlugins:loadingPlugin",v),e._loadingPlugins.splice(e._loadingPlugins.indexOf(g),1)}),e._loadingPlugins.push(g));return}return e.registerPlugin(f)}catch(v){L.logError("_registerPlugins:",v)}})}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach(function(i){kn(e,i)})}},{key:"_getRootByPosition",value:function(e){var i=null;switch(e){case F.ROOT_RIGHT:this.rightBar||(this.rightBar=c.createPositionBar("xg-right-bar",this.root)),i=this.rightBar;break;case F.ROOT_LEFT:this.leftBar||(this.leftBar=c.createPositionBar("xg-left-bar",this.root)),i=this.leftBar;break;case F.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=U.formatPluginInfo(e,i),s=n.PLUFGIN,u=n.options,l=this.config.plugins,h=U.checkPluginIfExits(s.pluginName,l);!h&&l.push(s);var f=U.getRootByConfig(s.pluginName,this.config);f.root&&(u.root=f.root),f.position&&(u.position=f.position);var d=u.position?u.position:u.config&&u.config.position||s.defaultConfig&&s.defaultConfig.position;return!u.root&&typeof d=="string"&&d.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(s,u,s.pluginName):(u.root||(u.root=this._getRootByPosition(d)),U.register(this,s,u))}},{key:"deregister",value:function(e){typeof e=="string"?U.unRegister(this,e):e instanceof he&&U.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 he&&(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 U.getPlugins(this)}},{key:"getPlugin",value:function(e){var i=U.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>D.ATTACHING))return!e&&!this.config.url&&this.getInitDefinition(),this.hasStart=!0,this.setState(D.ATTACHING),this._registerPlugins(!1),U.beforeInit(this).then(function(){if(i.config){e||(e=i.url||i.config.url);var n=i._startInit(e);return n}}).catch(function(n){throw n.fileName="player",n.lineNumber="236",L.logError("start:beforeInit:",n),n})}},{key:"switchURL",value:function(e,i){var n=this,s=e;c.typeOf(e)==="Object"&&(s=e.url);var u=this.currentTime,l=this.paused&&!this.isError;return this.src=s,new Promise(function(h){var f=function(){n.currentTime=u,l&&n.once("canplay",function(){n.pause()}),h()};A.os.isAndroid?n.once("timeupdate",function(){f()}):n.once("canplay",function(){f()}),n.play()})}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state>>>playPromise.then"),e.setState(D.RUNNING),e.emit(le))}).catch(function(n){if(L.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(vt),e.addClass(C.NOT_ALLOW_AUTOPLAY),e.removeClass(C.ENTER),e.pause(),e.setState(D.NOTALLOW)},0))}):(L.logWarn("video.play not return promise"),this.statethis.duration?parseInt(this.duration,10):e,this.once(Z,function(){switch(n.removeClass(C.ENTER),n.isSeeking=!1,h){case"play":n.play();break;case"pause":n.pause();break;default:!n.paused&&n.play()}}),this.state0&&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(_t,{from:i,to:e}),!this.hasStart){this.config.url=e.url;return}var u=this.switchURL(e.url,B({seamless:s.seamless!==!1&&typeof MediaSource<"u"&&typeof MediaSource.isTypeSupported=="function"},e));u&&u.then?u.then(function(){n.emit(at,{from:i,to:e})}):this.emit(at,{from:i,to:e})}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(ce,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,h=C.ENTER,f=C.ENDED,d=C.ERROR,g=C.LOADING,v=[i,n,s,u,l,h,f,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,v.forEach(function(_){e.removeClass(_)}),this.addClass(C.ENTER),this.emit(ze)}},{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=Nt();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=this,i=this.innerContainer,n=this.root,s=this.media;if(!(!n||!s)){if(this.hasStart=!1,this._useAutoplay=!1,n.removeAttribute(oe),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),c.clearAllTimers(this),this.emit(yt),U.destroy(this),vi(this),x(S(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),i)for(var u=i.children,l=0;l0?n.className=h.filter(function(f){return f.indexOf("xgplayer")<0}).join(" "):n.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach(function(f){e[f]=!1})}}},{key:"replay",value:function(){var e=this;this.removeClass(C.ENDED),this.currentTime=0,this.isSeeking=!1,ue(this,"replay",function(){e.once(Z,function(){var i=e.mediaPlay();i&&i.catch&&i.catch(function(n){console.log(n)})}),e.play(),e.emit(mt),e.onPlay()})}},{key:"retry",value:function(){var e=this;this.removeClass(C.ERROR),this.addClass(C.LOADING),ue(this,"retry",function(){var i=e.currentTime;e.src=e.config.url,!e.config.isLive&&(e.currentTime=i),e.once(Z,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(oe,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(oe))}},{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||(e=i),this._fullScreenOffset={top:c.scrollTop(),left:c.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get";var s=c.getFullScreenEl();if(s===this._fullscreenEl){this.onFullscreenChange();return}try{for(var u=0;u0&&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(ne,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Me,!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(ne,!1)):this.removeClass(e)}this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Me,!1)}},{key:"getRotateFullscreen",value:function(e){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.emit(ne,!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(ne,!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(gt,B({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.emit(si,B({paused:this.paused,ended:this.ended},e))}},{key:"onFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=i.autoHide,s=n===void 0?!this.config.closePlayerBlur:n,u=i.delay,l=u===void 0?this.config.inactive:u;if(this.isActive=!0,this.removeClass(C.INACTIVE),this.userTimer&&(c.clearTimeout(this,this.userTimer),this.userTimer=null),!s){this.userTimer&&(c.clearTimeout(this,this.userTimer),this.userTimer=null);return}this.userTimer=c.setTimeout(this,function(){e.userTimer=null,e.blur()},l)}},{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.isActive){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(){this.isError=!1}},{key:"onLoadstart",value:function(){this.removeClass(C.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===D.ENDED&&this.setState(D.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.userTimer&&(c.clearTimeout(this,this.userTimer),this.userTimer=null),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(C.ENDED),this.setState(D.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),c.clearTimeout(e,e.waitTimer),e.waitTimer=null},200)}},{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,h=C.LOADING,f=[i,n,s,u,l,h];f.forEach(function(d){e.removeClass(d)})}},{key:"onTimeupdate",value:function(){!this._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.staten)return!0;return!1}},{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=1/e.h,n=i!==1?"scale(".concat(i,")"):"",s=0,u=0;e.y&&(u=(100-e.h*100)/2-e.y*100),e.w&&e.x&&(s=(100-e.w*100)/2-e.x*100),n+=" translate(".concat(s,"%, ").concat(u,"%)"),this.media.style.transform=n,this.media.style.webkitTransform=n}}},{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,ue(this,"playnext",function(){i.start(),i.emit(Fe,e)})}},{key:"resize",value:function(){var e=this;if(this.media){var i=this.media,n=i.videoWidth,s=i.videoHeight,u=this.config,l=u.fitVideoSize,h=u.videoFillMode;if((h==="fill"||h==="cover")&&this.setAttribute("data-xgfill",h),!(!s||!n)){this._videoHeight=s,this._videoWidth=n;var f=this.root.getBoundingClientRect(),d=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,g=f.width,v=f.height-d,_=parseInt(n/s*1e3,10),m=parseInt(g/v*1e3,10),k=g,T=v,b={};l==="auto"&&m>_||l==="fixWidth"?(T=g/_*1e3,this.config.fluid?b.paddingTop="".concat(T*100/k,"%"):b.height="".concat(T+d,"px")):(l==="auto"&&m<_||l==="fixHeight")&&(k=_*v/1e3,b.width="".concat(k,"px")),!this.fullscreen&&!this.cssfullscreen&&Object.keys(b).forEach(function(M){e.root.style[M]=b[M]}),(h==="fillHeight"&&m<_||h==="fillWidth"&&m>_)&&this.setAttribute("data-xgfill","cover");var H={videoScale:_,vWidth:k,vHeight:T,cWidth:k,cHeight:T+d};this.emit(Ce,H)}}}},{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){L.logInfo("setState","state from:".concat(Ft[this.state]," to:").concat(Ft[e])),this._state=e}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){typeof e=="boolean"&&(this._hasStart=e,e===!1&&this.setState(D.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===D.RUNNING||this._state===D.ENDED},set:function(e){e?this.setState(D.RUNNING):this._state>=D.RUNNING&&this.setState(D.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 h;((h=i.curDefinition)===null||h===void 0?void 0:h.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=_e.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(_e.langKeys.join(),"] "));return}this.config.lang=e,U.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 st}},{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 x(S(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=x(S(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return x(S(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return this._fullScreenOffset!==null}},{key:"cumulateTime",get:function(){var e=this._accPlayed;return this.updateAcc("get"),e.acc}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"avgSpeed",get:function(){return Bt},set:function(e){Bt=e}},{key:"realTimeSpeed",get:function(){return Ht},set:function(e){Ht=e}},{key:"hook",value:function(e,i){return Be.call.apply(Be,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,i){return Ue.call.apply(Ue,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,i){return Ve.call.apply(Ve,[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;l3?s-3:0),l=3;l0&&n&&!s&&(L.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(te.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(te.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(te.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(hi,B({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}(O);function Pn(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var In=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(r,[{key:"registerIcons",value:function(){return{replay:Pn}}},{key:"afterCreate",value:function(){var e=this;O.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(fe,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(X,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(){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` ').concat(this.i18n.REPLAY,` `)}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),r}(O),An=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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(){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(fe,function(){e.isEndedShow&&c.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(J,function(){e.onTimeUpdate()}),this.on(We,function(){c.removeClass(e.root,"hide"),c.addClass(e.root,"xg-showplay"),e.once(J,function(){e.onTimeUpdate()})})):this.on(X,function(){c.addClass(e.root,"hide")})}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?c.removeClass(this.root,"xg-showplay"):this.once(J,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"render",value:function(){var e=this.config,i=e.poster,n=e.hideCanplay,s=i?"background-image:url(".concat(i,");"):"";return' `)}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,poster:""}}}]),r}(O);function bt(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function Tt(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var ee={};function Ln(o,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{start:null,end:null};ee[o]&&window.clearTimeout(ee[o].id),ee[o]={},r.start&&r.start(),ee[o].id=window.setTimeout(function(){r.end&&r.end(),window.clearTimeout(ee[o].id),delete ee[o]},a)}function Dn(){Object.keys(ee).map(function(o){window.clearTimeout(ee[o].id),delete ee[o]})}var Rn=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(p(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(p(e),"onAutoplayStart",function(){if(!e.autoPlayStart){var i=e.config.mode==="auto"?"auto-hide":"hide";c.addClass(e.root,i),e.autoPlayStart=!0,e.onPlayPause("play")}}),e.autoPlayStart=!1,e}return w(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.playerConfig;this.initIcons(),this.once(pt,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(le,this.onAutoplayStart),n.autoplay||this.show(),this.on(vt,function(){var s=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),c.removeClass(e.root,s),e.show()}),this.on(X,function(){e.onPlayPause("play")}),this.on(ke,function(){e.onPlayPause("pause")}),this.on(ze,function(){e.onPlayerReset()}),this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(u){u.cancelable&&u.preventDefault(),u.stopPropagation();var l=e.player.paused;e.emitUserAction(u,"switch_play_pause",{props:"paused",from:l,to:!l})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:bt,class:"xg-icon-play"},startPause:{icon:Tt,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(){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;Ln("pauseplay",400,{start:function(){c.addClass(i.root,"interact"),i.show(),i.switchStatus(!0)},end:function(){c.removeClass(i.root,"interact"),!e&&i.hide()}})}},{key:"switchPausePlay",value:function(e){var i=this.player;if(e.cancelable&&e.preventDefault(),e.stopPropagation(),!(i.state `)}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),r}(O),On=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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+='
');i.innerHTML='
'.concat(n,"
")}return i}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),r}(O);function se(o,a,r){try{return'
`).concat(o.i18n[a],`
`)}catch{return'
'}}var Ut=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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`
').concat(this.i18n[e],`
`)}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:10}}}]),r}(O);function Vt(o){var a=parseFloat(o),r=o.indexOf("%")===-1&&!Number.isNaN(a);return r&&a}var Et=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],yi=Et.length;function Mn(){for(var o={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},a=0;a1&&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?lt(e):(e._bindStartEvent(),e)}return w(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)]),jt[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=jt[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=Je(e.changedTouches,this.touchIdentifier);i&&this.dragMove(e,i)}},{key:"ontouchend",value:function(e){var i=Je(e.changedTouches,this.touchIdentifier);i&&this.dragEnd(e,i),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var i=Je(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=Gt(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(Qe.START,this.startPos)}},{key:"dragEnd",value:function(e,i){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(Qe.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),h=l.x,f=l.y;h=this.checkContain("x",h,s),f=this.checkContain("y",f,u),this.position.x=s+h,this.position.y=u+f,this.dragPoint.x=h,this.dragPoint.y=f,this.emit(Qe.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=Gt(this._root.parentNode);return n?parseFloat(e)/100*n[i]:0}return parseInt(e,10)}}]),r}(ei),Hn=function(o){P(r,o);var a=I(r);function r(t){var e;E(this,r),e=a.call(this,t),y(p(e),"onCancelClick",function(s){e.exitMini(),e.isClose=!0}),y(p(e),"onCenterClick",function(s){var u=p(e),l=u.player;l.paused?l.play():l.pause()}),y(p(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=p(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 w(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(ke,function(){e.setAttr("data-state","pause")}),this.on(X,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(Ut,s,Ut.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 Fn(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:bt,class:"xg-icon-play"},pause:{icon:Tt,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(Ne,!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(Ne,!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` `.concat(se(this,"MINI_DRAG",this.playerConfig.isHideTips),`
`)}}],[{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}(O),De={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},et=["videoClick","videoDbClick"],tt=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n0&&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(De).map(function(u){s.removeEventListener(u,e[De[u]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(he),ie={PRESS:"press",PRESS_END:"pressend",DOUBlE_CLICK:"doubleclick",CLICK:"click",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend"},Bn={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},Un={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function Wt(o){return o&&o.length>0?o[o.length-1]:null}function zt(o){var a=navigator.userAgent;/(?:iPhone|iPad)/.test(a)&&o.cancelable&&o.preventDefault()}function Vn(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var Gn=function(){function o(a){var r=this,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{eventType:"touch"};E(this,o),this._pos={moving:!1,start:!1,x:0,y:0},this.config=Vn(),Object.keys(t).map(function(e){r.config[e]=t[e]}),this.root=a,this.events=t.eventType==="mouse"?Un:Bn,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return w(o,[{key:"_initEvent",value:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),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(ie.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(ie.DOUBlE_CLICK,r);return}this.dbIntrvalId=setTimeout(function(){t.__clearDb(),!t._pos.start&&!t._pos.press&&!t._pos.moving&&t.trigger(ie.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=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:"onTouchStart",value:function(r){var t=this._pos,e=this.root,i=this.config;i.needPreventDefault&&zt(r);var n=Wt(r.touches);t.x=n?parseInt(n.pageX,10):r.pageX,t.y=n?parseInt(n.pageX,10):r.pageX,t.start=!0,this.__setPress(r),e.addEventListener(this.events.end,this.onTouchEnd),e.addEventListener(this.events.cancel,this.onTouchCancel),e.addEventListener(this.events.move,this.onTouchMove),this.trigger(ie.TOUCH_START,r)}},{key:"onTouchCancel",value:function(r){this.onTouchEnd(r)}},{key:"onTouchEnd",value:function(r){var t=this._pos,e=this.root,i=this.config;i.needPreventDefault&&zt(r),this.__clearPress(),e.removeEventListener(this.events.cancel,this.onTouchCancel),e.removeEventListener(this.events.end,this.onTouchEnd),e.removeEventListener(this.events.move,this.onTouchMove),r.moving=t.moving,r.press=t.press,t.press&&this.trigger(ie.PRESS_END,r),this.trigger(ie.TOUCH_END,r),!t.press&&!t.moving&&this.__setDb(r),t.press=!1,t.start=!1,t.moving=!1}},{key:"onTouchMove",value:function(r){var t=this._pos,e=this.config,i=Wt(r.touches),n=i?parseInt(i.pageX,10):r.pageX,s=i?parseInt(i.pageY,10):r.pageX,u=n-t.x,l=s-t.y;Math.abs(l) `,"image/svg+xml").firstChild}var ve={AUTO:"auto",SEEKING:"seeking",PLAYBACK:"playbackrate",LIGHT:""},Wn=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(p(e),"onTouchStart",function(i){var n=p(e),s=n.player,u=n.config,l=n.pos,h=n.playerConfig,f=e.getTouche(i);if(f&&!u.disableGesture&&e.duration>0&&!s.ended){l.isStart=!0,c.checkIsFunction(h.disableSwipeHandler)&&h.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(f.pageX-l.left,10),v=parseInt(f.pageY-l.top,10);l.x=s.rotateDeg===90?v:g,l.y=s.rotateDeg===90?g:v,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(p(e),"onTouchMove",function(i){var n=e.getTouche(i),s=p(e),u=s.pos,l=s.config,h=s.player;if(!(!n||l.disableGesture||!e.duration||!u.isStart)){var f=l.miniMoveStep,d=l.hideControlsActive,g=parseInt(n.pageX-u.left,10),v=parseInt(n.pageY-u.top,10),_=h.rotateDeg===90?v:g,m=h.rotateDeg===90?g:v;if(Math.abs(_-u.x)>f||Math.abs(m-u.y)>f){var k=_-u.x,T=m-u.y,b=u.scope;if(b===-1&&(b=e.checkScope(_,m,k,T,u),b===0&&(d?h.blur():h.focus({autoHide:!1}),!u.time&&(u.time=parseInt(h.currentTime*1e3,10)+e.timeOffset*1e3)),u.scope=b),b===-1||b>0&&!l.gestureY||b===0&&!l.gestureX)return;i.cancelable&&i.preventDefault(),e.executeMove(k,T,b,u.width,u.height),u.x=_,u.y=m}}}),y(p(e),"onTouchEnd",function(i){var n=p(e),s=n.player,u=n.pos,l=n.playerConfig;if(u.isStart){u.scope>-1&&i.cancelable&&i.preventDefault();var h=e.config,f=h.disableGesture,d=h.gestureX;!f&&d?(e.endLastMove(u.scope),setTimeout(function(){s.getPlugin("progress")&&s.getPlugin("progress").resetSeekState()},10)):u.time=0,u.scope=-1,e.resetPos(),c.checkIsFunction(l.enableSwipeHandler)&&l.enableSwipeHandler(),e.changeAction(ve.AUTO)}}),y(p(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(p(e),"onRootTouchEnd",function(i){e.pos.isStart&&e.checkIsRootTarget(i)&&(i.stopPropagation(),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 w(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:jn,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this,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;this.touch=new Gn(this.root,{eventType:u,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(f){f.preventDefault()}),s.root.addEventListener("touchmove",this.onRootTouchMove,!0),s.root.addEventListener("touchend",this.onRootTouchEnd,!0),this.on(de,function(){var f=e.player,d=e.config;f.duration*1e30&&(e.pos.time=0)});var l={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(l).map(function(f){e.touch.on(f,function(d){e[l[f]](d)})}),!n.disableActive){var h=s.plugins.progress;h&&(h.addCallBack("dragmove",function(f){e.activeSeekNote(f.currentTime,f.forward)}),h.addCallBack("dragend",function(){e.changeAction(ve.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;n&&(this.find(".xg-curbar").style.backgroundColor=n,this.find(".xg-cur").style.color=n),s&&(this.find(".xg-bar").style.backgroundColor=s,this.find(".time-preview").style.color=s),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,h=-1;if(e<0||e>l)return h;var f=Math.abs(s===0?n:n/s);return Math.abs(n)>0&&f>=1.73&&e>u.scopeM1&&eu.scopeR?2:3),h}},{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:A.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(ve.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:"onClick",value:function(e){var i=this.player,n=this.config,s=this.playerConfig;if(i.state=D.RUNNING&&(this.sendUseAction(c.createEvent("dblclick")),this.switchPlayPause())}},{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(ve.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(ve.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){this.player.rotateDeg&&(e=-e);var i=this.pos,n=this.config,s=this.xgMask,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(ve.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
00:00 / 00:00
`).concat(this.config.pressRate,"X").concat(this.i18n.FORWARD,`
`)}}],[{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}(O);function Yt(o){o.preventDefault(),o.returnValue=!1}function zn(o){var a=o.tagName;return!!(a==="INPUT"||a==="TEXTAREA"||o.isContentEditable)}var Kt=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n0&&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,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,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.duration,u=n;n+this.seekStep<=s?u=n+this.seekStep:u=s-1;var l={currentTime:{from:n,to:u}};this.emitUserAction(e,"seek",{props:l}),this.player.currentTime=u}},{key:"seekBack",value:function(e){var i=this.player.currentTime,n=0;i-this.seekStep>=0&&(n=i-this.seekStep);var s={currentTime:{from:i,to:n}};this.emitUserAction(e,"seek",{props:s}),this.player.currentTime=n}},{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:"handleKeyCode",value:function(e,i){var n=this;Object.keys(this.keyCodeMap).map(function(s){var u=n.keyCodeMap[s],l=u.action,h=u.keyCode,f=u.disable;h===e&&!f&&(typeof l=="function"?l(i,n.player):typeof l=="string"&&typeof n[l]=="function"&&n[l](i,n.player),n.emit(ci,B({key:s,target:i.target},n.keyCodeMap[s])))})}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown)}},{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:!0,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!1,keyCodeMap:{},disable:!1,isIgnoreUserActive:!1}}}]),r}(he);function Yn(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var Kn=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(r,[{key:"registerIcons",value:function(){return{loadingIcon:Yn}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return` `}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:F.ROOT}}}]),r}(O),Xn=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],$n=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 w(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(f,d){dn&&(f[r].style.width=0)});var l=i[n],h=u===0?0:(u-l.start)/l.duration;e[n][r].style.width=h<0?0:"".concat(h*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&&te[t].start&&re[e.length-1].start)return e.length-1;for(var i=0;ie[i].start&&r<=e[i].end){t=i;break}return t}},{key:"findHightLight",value:function(){for(var r=this.root.children,t=0;t=t.length?null:{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var r=this.root.children,t=0;t0;)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),Xn.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}(),Xt={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},qn=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(p(e),"onMoveOnly",function(i,n){var s=p(e),u=s.pos,l=s.config,h=s.player,f=n;if(i){c.event(i);var d=c.getEventPos(i,h.zoom),g=h.rotateDeg===90?d.clientY:d.clientX;if(u.moving&&Math.abs(u.x-g)0&&arguments[0]!==void 0?arguments[0]:!0;this.useable=e}},{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=B(B({fragments:i},n),{},{actionCallback:function(l){e.emitUserAction("fragment_focus","fragment_focus",l)}});this.innerList?this.innerList.reset(s):(this.innerList=new $n(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(){var e=this;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 i=this.config,n=i.fragFocusClass,s=i.fragAutoFocus,u=i.fragClass;this._initInner(this.config.fragments,{fragFocusClass:n,fragAutoFocus:s,fragClass:u,style:this.playerConfig.commonStyle||{}}),A.device==="mobile"&&(this.config.isDragingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.on(de,function(){e.onMouseLeave()}),this.on(J,function(){e.onTimeupdate()}),this.on(xe,function(){e.onTimeupdate(),e.onCacheUpdate()}),this.on(ri,function(){e.onCacheUpdate()}),this.on(fe,function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0}),this.on(be,function(){e.onReset()}),this.on(Ce,function(){e.onVideoResize()}),this.bindDomEvents(),this.initCustomStyle()}}},{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:j(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,!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,i=e.controls,n=e.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),i&&(i.root&&i.root.addEventListener("touchmove",c.stopPropagation),i.center&&i.center.addEventListener("touchend",c.stopPropagation))),(this.domEventType==="mouse"||this.domEventType==="compatible")&&(this.bind("mousedown",this.onMouseDown),n.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){var s=this.config,u=this.player;if(!(s.isCloseClickSeek&&n===0)){var l=e>=u.duration?u.duration-s.endedDiff:Number(e).toFixed(1);this.updatePercent(i),this.updateTime(e),!(n===1&&(!s.isDragingSeek||u.config.mediaType==="audio"))&&(this._state.now=l,this._state.direc=l>u.currentTime?0:1,u.seek(l))}}},{key:"computeTime",value:function(e,i){var n=this.player,s=this.root.getBoundingClientRect(),u=s.width,l=s.height,h=s.top,f=s.left,d,g,v=i;n.rotateDeg===90?(d=l,g=h):(d=u,g=f);var _=v-g;_=_>d?d:_<0?0:_;var m=_/d;m=m<0?0:m>1?1:m;var k=parseInt(m*this.duration*1e3,10)/1e3;return{percent:m,currentTime:k,offset:_,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.duration},this.duration);var n=this.player.plugins.miniprogress;n&&n.update({played:e*this.duration},this.duration)}}},{key:"onTimeupdate",value:function(e){var i=this.player,n=this._state,s=this.duration;if(!(i.isSeeking||this.isProgressMoving)){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.timeOffset+i.currentTime;l=c.adjustTimeByDuration(l,s,e),this.innerList.update({played:l},s),this.progressBtn.style.left="".concat(l/s*100,"%");var h=this.player.plugins.miniprogress;h&&h.update({played:l},s)}}},{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);var u=this.player.plugins.miniprogress;u&&u.update({cached:s},n)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0);var e=this.player.plugins.miniprogress;e&&e.update({cached:0,played:0},0)}},{key:"destroy",value:function(){var e=this.player,i=e.controls;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var n=this.domEventType;(n==="touch"||n==="compatible")&&(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),i&&(i.root&&i.root.removeEventListener("touchmove",c.stopPropagation),i.center&&i.center.removeEventListener("touchend",c.stopPropagation))),(n==="mouse"||n==="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` `)}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_CENTER,index:0,disable:!1,isDragingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:Xt.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return Xt}}]),r}(O),ge=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n
`.concat(se(this,"PLAY_TIPS",this.playerConfig.isHideTips),` `)}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_LEFT,index:0,disable:!1}}}]),r}(ge);function Jn(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var Qn=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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:Jn,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` `}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:F.ROOT_TOP,index:0}}}]),r}(O);function er(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function tr(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var ir=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n
`.concat(se(this,e,this.playerConfig.isHideTips),` `)}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}(ge),nr=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.isActiving=!1,e}return w(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"currentTime",get:function(){return this.player.currentTime||0}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this,i=this.player.controls.config.mode;this.mode=i==="flex"?"flex":"normal",!this.config.disable&&(this.mode==="flex"&&(this.createCenterTime(),this.hide()),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.on(de,function(){e.onTimeUpdate()}),this.on(J,function(){e.onTimeUpdate()}),this.on(fe,function(){e.onTimeUpdate(!0)}),this.on(be,function(){e.onReset()}))}},{key:"show",value:function(){this.mode!=="flex"&&x(S(r.prototype),"show",this).call(this)}},{key:"onTimeUpdate",value:function(e){var i=this.player,n=this.config,s=this.duration;if(!(n.disable||this.isActiving||!i.hasStart)){var u=i.currentTime+this.timeOffset;u=c.adjustTimeByDuration(u,s,e),this.mode==="flex"?(this.centerCurDom.innerHTML=c.format(u),s!==1/0&&s>0&&(this.centerDurDom.innerHTML=c.format(s))):(this.timeDom.innerHTML=c.format(u),s!==1/0&&s>0&&(this.durationDom.innerHTML=c.format(s)))}}},{key:"onReset",value:function(){this.mode==="flex"?(this.centerCurDom.innerHTML=c.format(0),this.centerDurDom.innerHTML=c.format(0)):(this.timeDom.innerHTML=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 left"),this.centerDurDom=c.createDom("xg-icon","00:00",{},"xgplayer-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=c.format(e);return}this.timeDom.innerHTML=c.format(e)}}},{key:"resetActive",value:function(){var e=this,i=this.player,n=function(){e.isActiving=!1};this.off(xe,n),i.isSeeking?this.once(xe,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` 00:00 / 00:00 `.concat(this.i18n.LIVE_TIP,` `)}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_LEFT,index:2,disable:!1}}}]),r}(O);function rr(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function sr(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function ar(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var or=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;nf.barH||t.updateVolumePos(v,s)}}),y(p(t),"onBarMouseUp",function(s){c.event(s),document.removeEventListener("mouseup",t.onBarMouseUp);var u=p(t),l=u._d;l.isStart=!1,l.isMoving=!1}),y(p(t),"onMouseenter",function(s){t._d.isActive=!0,t.focus(),t.emit("icon_mouseenter",{pluginName:t.pluginName})}),y(p(t),"onMouseleave",function(s){t._d.isActive=!1,t.unFocus(100,!1,s),t.emit("icon_mouseleave",{pluginName:t.pluginName})}),y(p(t),"onVolumeChange",function(s){if(t.player){var u=t.player,l=u.muted,h=u.volume;t._d.isMoving||(t.find(".xgplayer-drag").style.height=l||h===0?"4px":"".concat(h*100,"%"),t.config.showValueLabel&&t.updateVolumeValue()),t.animate(l,h)}}),t}return w(r,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:sr,class:"xg-volume-small"},volumeLarge:{icon:rr,class:"xg-volume"},volumeMuted:{icon:ar,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),A.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(ii,this.onVolumeChange),this.once(ce,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 h=Math.max(Math.min(l/1e3,1),0),f={volume:{from:n.volume,to:h}};n.muted&&(f.muted={from:!0,to:!1}),this.emitUserAction(i,"change_volume",{muted:n.muted,volume:n.volume,props:f}),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.ceil(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",A.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`
`.concat(i?'
'.concat(e*100,"
"):"",`
`)}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}(O);function ur(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var lr=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.rotateDeg=e.config.rotateDeg||0,e}return w(r,[{key:"afterCreate",value:function(){var e=this;this.config.disable||(x(S(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(Ce,function(){e.rotateDeg&&c.setTimeout(e,function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)},100)}),this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate))}},{key:"destroy",value:function(){x(S(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){var n=this.player;e||(e=0);var s=this.player,u=s.root,l=s.innerContainer,h=this.player.media,f=u.offsetWidth,d=l&&i?l.offsetHeight:u.offsetHeight,g="100%",v="100%",_=0,m=0;(e===.75||e===.25)&&(g="".concat(d,"px"),v="".concat(f,"px"),_=-(d-f)/2,m=-(f-d)/2);var k="translate(".concat(_,"px,").concat(m,"px) rotate(").concat(e,"turn)"),T={transformOrigin:"center center",transform:k,webKitTransform:k,height:v,width:g},b=i?h:u,H=i?n.getPlugin("poster"):null;Object.keys(T).map(function(M){b.style[M]=T[M],H&&H.root&&(H.root.style[M]=T[M])})}},{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(ui,this.rotateDeg*360)}},{key:"registerIcons",value:function(){return{rotate:ur}}},{key:"render",value:function(){if(!this.config.disable)return`
`.concat(se(this,"ROTATE_TIPS",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),r}(ge);function cr(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function hr(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var me={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"},fr=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n
`.concat(se(this,"PIP",this.playerConfig.isHideTips),` `)}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:6,showIcon:!1}}},{key:"checkWebkitSetPresentationMode",value:function(e){return typeof e.webkitSetPresentationMode=="function"}}]),r}(ge);function dr(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var gr=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(p(e),"playNext",function(i){var n=p(e),s=n.player;i.preventDefault(),i.stopPropagation(),e.idx+1
`.concat(se(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),` `)}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),r}(O),_i={exports:{}};(function(o,a){(function(r,t){o.exports=t()})(bi,function(){return function r(t,e,i){var n=window,s="application/octet-stream",u=i||s,l=t,h=!e&&!i&&l,f=document.createElement("a"),d=function(N){return String(N)},g=n.Blob||n.MozBlob||n.WebKitBlob||d,v=e||"download",_,m;if(g=g.call?g.bind(n):Blob,String(this)==="true"&&(l=[l,u],u=l[0],l=l[1]),h&&h.length<2048&&(v=h.split("/").pop().split("?")[0],f.href=h,f.href.indexOf(h)!==-1)){var k=new XMLHttpRequest;return k.open("GET",h,!0),k.responseType="blob",k.onload=function(N){r(N.target.response,v,s)},setTimeout(function(){k.send()},0),k}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(l))if(l.length>1024*1024*1.999&&g!==d)l=M(l),u=l.type||s;else return navigator.msSaveBlob?navigator.msSaveBlob(M(l),v):z(l);else if(/([\x80-\xff])/.test(l)){var T=0,b=new Uint8Array(l.length),H=b.length;for(T;T `,"image/svg+xml").firstChild}var yr=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(p(e),"download",function(i){if(!e.isLock){e.emitUserAction(i,"download");var n=e.getAbsoluteURL(e.player.src);vr(n),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 w(r,[{key:"afterCreate",value:function(){x(S(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.appendChild(".xgplayer-icon",this.icons.download),this.bind(["click","touchend"],this.download))}},{key:"registerIcons",value:function(){return{download:mr}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var i=document.createElement("div");i.innerHTML='x'),e=i.firstChild.href}return e}},{key:"destroy",value:function(){x(S(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`
`.concat(se(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:3,disable:!0}}}]),r}(ge),_r=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.screenShot=="boolean"&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){x(S(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(Ce,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=document.createEvent("MouseEvents");s.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),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"),this.shot().then(function(n){i.emit(li,n),i.saveScreenShot(n,i.config.name+i.config.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,h=s.quality||u.quality,f=s.type||u.type;return new Promise(function(d,g){var v=null,_;if(l.media.canvas)v=l.media.canvas;else{n.canvas?(n.canvas.width=e||u.width,n.canvas.height=i||u.height):n.createCanvas(e,i),v=n.canvas,_=n.canvasCtx;var m=l.media.videoWidth/l.media.videoHeight,k=v.width/v.height,T=0,b=0,H=l.media.videoWidth,M=l.media.videoHeight,z,N,W,V;m>k?(W=v.width,V=v.width/m,z=0,N=Math.round((v.height-V)/2)):m===k?(W=v.width,V=v.height,z=0,N=0):m
`).concat(this.icons.screenshotIcon?"":'').concat(this.i18n[i],""),`
`)}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,fitVideo:!0,disable:!1,name:"screenshot"}}}]),r}(ge),Cr=function(){function o(a){E(this,o),this.config=a.config,this.parent=a.root,this.root=c.createDom("ul","",{},"xg-options-list ".concat(this.config.className)),a.root.appendChild(this.root),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var r=A.device==="mobile"?"touchend":"click";this._delegates=O.delegate.call(this,this.root,"li",r,this.onItemClick)}return w(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","".concat(n.showText,""),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:"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={RIGHT_SIDE:"rightSide",MIDDLE:"middle"},Re=A.device==="mobile",Ge=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),y(p(e),"onEnter",function(i){i.preventDefault(),i.stopPropagation(),e.emit("icon_mouseenter",{pluginName:e.pluginName}),e.toggle(!0)}),y(p(e),"onLeave",function(i){i.preventDefault(),i.stopPropagation(),e.emit("icon_mouseleave",{pluginName:e.pluginName}),e.config.listType!==Te.RIGHT_SIDE&&e.isActive&&e.toggle(!1)}),y(p(e),"onListEnter",function(i){console.log("onListEnter"),e.enterType=2}),y(p(e),"onListLeave",function(i){console.log("onListLeave",i.target),e.enterType=0,e.isActive&&e.toggle(!1)}),e.isIcons=!1,e.isActive=!1,e.curValue=null,e.curIndex=0,e}return w(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(),Re&&i.listType!==Te.MIDDLE&&(i.listType="rightSide"),i.hidePortrait&&c.addClass(this.root,"portrait"),this.once(Z,function(){i.list&&i.list.length>0&&(e.renderItemList(i.list),e.show())}),Re&&this.on(gt,function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)}),this.activeEvent=Re?"touchend":"mouseenter",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(){!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 j(e[i])==="object"?e[i][n]||e[i].zh:e[i]}catch(u){return console.warn(u),""}}},{key:"toggle",value:function(e){if(e!==this.isActive){var i=this.player.controls,n=this.config.listType;e?(n==="rightSide"?i.blur():i.focus(),this.optionsList&&this.optionsList.show()):(n==="rightSide"?i.focus():i.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,i){e.preventDefault(),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||Re||s===Te.RIGHT_SIDE)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex
`)}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:100,list:[],listType:"middle",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0}}}]),r}(O),kr=function(o){P(r,o);var a=I(r);function r(t){var e;return E(this,r),e=a.call(this,t),e.curTime=0,e.isPaused=!0,e}return w(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;x(S(r.prototype),"afterCreate",this).call(this),this.on("resourceReady",function(i){e.changeDefinitionList(i)}),this.on(_t,function(i){e.renderItemList(e.config.list,i.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(){!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(h){h.selected=!1});var u=0,l=i.map(function(h,f){var d=B(B({},h),{},{showText:e.getTextByLang(h)||h.definition,selected:!1});return(h.selected||h.definition&&h.definition==s)&&(d.selected=!0,u=f),d});x(S(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;x(S(r.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:i.from,to:i.to});for(var s=0;s `,"image/svg+xml").firstChild}function Er(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var $t=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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;x(S(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Me,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:Tr,class:"xg-get-cssfull"},exitCssFullscreen:{icon:Er,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){x(S(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return`
`.concat(se(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:F.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),r}(ge),wr=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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(Ie,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,'').concat(this.i18n.REFRESH,"")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return`
`}}],[{key:"pluginName",get:function(){return"error"}}]),r}(O),Sr=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(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.show.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:"show",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?''.concat(e.highlight,""):""),n.style&&this.setStyle(n.style);var l=typeof n.autoHide=="boolean"?n.autoHide:this.config.autoHide;if(l){var h=n.interval||u;this.intervalId=setTimeout(function(){i.hide()},h)}}}},{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' `)}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),r}(O),qt={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function Ci(o){Object.keys(qt).map(function(a){o[a]===void 0&&(o[a]=qt[a])})}var Zt={_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&&(Ci(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=c.createDom("xg-spot",a.template||"",{"data-text":a.text,"data-time":a.time,"data-id":a.id},n);Object.keys(i).map(function(u){s.style[u]=i[u]}),t.outer&&t.outer.appendChild(s)}},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=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){u0&&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 w(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.currentTime&&e.player.seek(n.currentTime)}),this.transformTimeHook=this.hook("transformTime",function(i){e.setTimeContent(c.format(i))}),xr(this),this.on(de,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(ye).map(function(s){e[ye[s]]=e[ye[s]].bind(e),i.addCallBack(s,e[ye[s]])}),A.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.timePoint,l=this.player,h=this.config,f=l.controls.mode,d=f==="flex",g=n.getBoundingClientRect().width;if(g){var v=u.getBoundingClientRect().width;g=this._hasThumnail&&gi-g&&!d?(m=_-(i-g),!this.thumbnail&&(k=_-(i-g)-v/2),_=i-g):(m=0,!this.thumbnail&&(k=-v/2)),m!==void 0&&(s.style.transform="translateX(".concat(m.toFixed(2),"px)")),k!==void 0&&(u.style.transform="translateX(".concat(k.toFixed(2),"px)")),n.style.transform="translateX(".concat(_.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var i=this.timeText,n=this.timePoint;i.textContent=e,!this.thumbnail&&(n.textContent=e)}},{key:"updatePosition",value:function(e,i,n,s){var u=this.root,l=this.config,h=this._state;if(u){this.updateLinePos(e,i),h.now=n,this.transformTimeHook(n);var f=this.timeStr;s&&s.target&&c.hasClass(s.target,"xgplayer-spot")?(this.showTips(s.target.getAttribute("data-text"),!1,f),this.focusDot(s.target),h.f=!0,l.isFocusDots&&h.f&&(h.now=parseInt(s.target.getAttribute("data-time"),10))):l.defaultText?(h.f=!1,this.showTips(l.defaultText,!0,f)):(h.f=!1,this.hideTips("")),this.updateTimeText(f),this.updateThumbnails(h.now)}}},{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(A.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:i2&&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(){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(ye).map(function(n){i.removeCallBack(n,e[ye[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 A.device==="mobile"||this.playerConfig.isMobileSimulateMode==="mobile"?"":'
00:00
`)}}],[{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}(O),Ir=function(o){P(r,o);var a=I(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 w(r,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([de],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&&e0&&u.push(e-1),u.push(e),e>0&&e=0&&l1&&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,h=s.col,f=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 v=g0?Math.ceil(_/h)-1:0,k=_>0?_-m*h-1:0,T=0,b=0;if(i&&n){var H=i/n;H2&&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,h=l.pic_num,f=l.urls;if(!(h<=0||!f||f.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}(O),Ar=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(r,[{key:"afterCreate",value:function(){}},{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(){if(!(!this.playerConfig.progress||!this.playerConfig.miniprogress))return` `}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{}}}]),r}(O),Ee={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",FRAME_RATE:"framerate",POSTER:"poster"};function Lr(){try{return parseInt(window.performance.now(),10)}catch{return new Date().getTime()}}function Dr(){try{var o=document.createElement("canvas").getContext;return!!o}catch{return!1}}var Oe=null,Rr=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n0?(t.renderOnce(),t._frameCount--):(t._isLoaded=!0,t.off(J,t.renderOnTimeupdate),!t.player.paused&&t._checkIfCanStart()&&t.start())}),y(p(t),"start",function(){var s=t.player.media,u=Lr(),l=t.checkVideoIsSupport(s);!l||!t.canvasCtx||(t.stop(),s.videoWidth&&s.videoHeight&&(t.videoPI=s.videoHeight>0?parseInt(s.videoWidth/s.videoHeight*100,10):0,(t.config.mode===Ee.REAL_TIME||u-t.preTime>=t.interval)&&(s&&s.videoWidth&&t.update(l,t.videoPI),t.preTime=u)),t.frameId=c.requestAnimationFrame(t.start))}),y(p(t),"stop",function(){t.frameId&&(c.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return w(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.once(je,function(){e.player&&(e.init(),e.player.paused||e.start())}),s!==Ee.POSTER&&(s!==Ee.FIRST_FRAME&&(this.on(be,function(){e.stop()}),this.on(X,function(){e._checkIfCanStart()&&e.start()}),this.on(ke,function(){e.stop()})),this.on(ce,this.onLoadedData),this.on(dt,function(){e._isLoaded=!1,e.stop()})))}},{key:"init",value:function(){var e=this.player,i=this.config;this.canvasFilter=r.supportCanvasFilter();try{var n=this.config.isInnerRender&&e.innerContainer||e.root;n.insertAdjacentHTML("afterbegin",`
`),this.root=n.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=i.filter,this.canvas.style.webkitFilter=i.filter),this.mask=this.find("xgmask"),i.addMask&&(this.mask.style.background=i.maskBg),this.canvasCtx=this.canvas.getContext("2d"),this.renderByPoster()}catch(s){L.logError("plugin:DynamicBg",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&&!(A.browser==="safari"&&(/^blob/.test(i.currentSrc)||/^blob/.test(i.src))))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&&e!==Ee.FIRST_FRAME&&e!==Ee.POSTER}},{key:"renderOnce",value:function(){var e=this.player.media;if(!(!e.videoWidth||!e.videoHeight)){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var i=this.checkVideoIsSupport(e);i&&e.videoWidth&&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 h=parseInt(s/u*100,10);i.update(l,h),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,h=u.height;if(l!==n.width||h!==n.height||n.pi!==i){var f=parseInt(l/h*100,10);n.pi=i,n.width=this.canvas.width=l,n.height=this.canvas.height=h;var d=h,g=l;fi&&(d=parseInt(l*100/i,10)),n.rwidth=g*s.multiple,n.rheight=d*s.multiple,n.x=(l-n.rwidth)/2,n.y=(h-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=s.filter),this.canvasCtx.drawImage(e,n.x,n.y,n.rwidth,n.rheight)}catch(v){L.logError("plugin:DynamicBg",v)}}},{key:"destroy",value:function(){this.stop(),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return typeof Oe=="boolean"||(Oe=Dr()),Oe}},{key:"supportCanvasFilter",value:function(){return!(A.browser==="safari"||A.browser==="firefox")}}]),r}(O),Or={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:"直播"}},we="info",it=di,Mr=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;nm)){var k=_-g,T=k<=f;ki&&(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;nu.jumpCntMax||t.timer||u.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,u.waitingTime*1e3))}),y(p(t),"onJump",function(){var s=p(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 h=u.currentTime+t.jumpSize,f=u.media.duration;h>f||(console.log("waitintTimeout, currentTime:",u.currentTime,", jumpTo:",h),t.jumpCnt++,u.currentTime=h)}}),t}return w(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(Ae,this.onWaiting),this.on([ht,Z],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on(X,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(O),Fr=function(o){P(r,o);var a=I(r);function r(){var t;E(this,r);for(var e=arguments.length,i=new Array(e),n=0;n=h)){t.cnt++;try{var g=new Date().getTime(),v=null,_=new XMLHttpRequest;t.xhr=_,_.open("GET",d);var m={},k=Math.floor(Math.random()*10);m.Range="bytes="+k+"-"+(l+k),m&&Object.keys(m).forEach(function(T){_.setRequestHeader(T,m[T])}),_.onreadystatechange=function(){if(_.readyState===4){t.xhr=null,v=new Date().getTime();var T=_.getResponseHeader("Content-Length")/1024*8,b=Math.round(T*1e3/(v-g));t.appendList(b),t.timer=setTimeout(t.testSpeed,f)}},_.send()}catch(T){console.error(T)}}}}),y(p(t),"appendList",function(s){var u=t.config.saveSpeedMax;t.speedListCache.length>=u&&t.speedListCache.shift(),t.speedListCache.push(s),t.player&&(t.player.realTimeSpeed=s),t.updateSpeed()}),y(p(t),"updateSpeed",function(){var s=t.getSpeed(),u=p(t),l=u.player;l&&(!l.avgSpeed||s!==l.avgSpeed)&&(l.avgSpeed=s,l.emit(oi,{speed:s,realTimeSpeed:l.realTimeSpeed}))}),t}return w(r,[{key:"afterCreate",value:function(){var e=this;this.speedListCache=[];var i=this.config,n=i.openSpeed,s=i.testTimeStep;this.timer=null,this.cnt=0,this.xhr=null,n&&(this.on("real_time_speed",this._onRealSpeedChange),this.on([ce,mt],function(){c.isMSE(e.player.video)||(e.speedListCache=[],e.cnt=0,e.timer=setTimeout(e.testSpeed,s))}))}},{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(){clearTimeout(this.timer),this.timer=null,this.xhr&&this.xhr.readyState!==4&&(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}}}]),r}(O),Hr=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.config;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,!n.disabled){var s=i.media.getVideoPlaybackQuality;s&&(this.on(X,function(){e._startTick()}),this.on(ke,function(){e._stopTick()}),this.on(fe,function(){e._stopTick()}),this.on(be,function(){e._stopTick()}))}}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout(function(){e._checkDecodeFPS(),e._startTick()},this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkStuck",value:function(e){var i=this.player.media,n=document.hidden,s=i.paused;if(typeof n=="boolean"&&!n&&!s){for(var u=i.currentTime,l=i.buffered,h=!1,f=0;fthis.config.stuckCount?(this.emit(gi),this._currentStuckCount=0):e<=this.config.reportFrame?this._currentStuckCount++:this._currentStuckCount=0)}}},{key:"_checkDecodeFPS",value:function(){if(this.player.media){var e=this.player.media.getVideoPlaybackQuality(),i=e.totalVideoFrames,n=performance.now();if(i&&this._lastCheckPoint){var s=i-this._lastDecodedFrames;this._checkStuck(s)}this._lastDecodedFrames=i,this._lastCheckPoint=n}}},{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}(O);_e.use(Or);var Br=w(function o(a,r){var t,e,i;E(this,o);var n=r&&r.isMobileSimulateMode==="mobile",s=r.isLive,u=s?[]:[qn,Ar,Pr,nr],l=[].concat(u,[Zn,ir,lr,gr,kr,br,yr,_r,or,fr]),h=[In,An,Rn,Kn,On,wr,Sr,Ir,Hn];this.plugins=[Mr,xn].concat(re(l),h,[ki,Nr]);var f=n?"mobile":A.device;switch(f){case"pc":(t=this.plugins).push.apply(t,[Kt,tt,$t,Fr,Hr]);break;case"mobile":(e=this.plugins).push.apply(e,[Wn]);break;default:(i=this.plugins).push.apply(i,[Kt,tt,$t])}(A.os.isIpad||f==="pc")&&this.plugins.push(Rr),A.os.isIpad&&this.plugins.push(tt),this.ignores=[],this.i18n=[]}),Q=function(o){P(r,o);var a=I(r);function r(){return E(this,r),a.apply(this,arguments)}return w(r)}(kt);y(Q,"defaultPreset",Br);y(Q,"Util",c);y(Q,"Sniffer",A);y(Q,"Errors",ct);y(Q,"Events",tn);y(Q,"Plugin",O);y(Q,"BasePlugin",he);y(Q,"I18N",_e);y(Q,"STATE_CLASS",C);const Ur=o=>(Vue.pushScopeId("data-v-a961fabe"),o=o(),Vue.popScopeId(),o),Vr={class:"card-header"},Gr={class:"font-medium"},jr=Ur(()=>Vue.createElementVNode("div",{id:"mse"},null,-1)),Wr=Vue.defineComponent({name:"VideoPage",__name:"index",setup(o){return Vue.onMounted(()=>{new Q({id:"mse",lang:"zh",volume:0,autoplay:!1,screenShot:!0,videoAttributes:{crossOrigin:"anonymous"},url:"https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-720p.mp4",poster:"https://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/poster.jpg",fluid:Ti(),playbackRate:[.5,.75,1,1.5,2]})}),(a,r)=>{const t=Vue.resolveComponent("el-link"),e=Vue.resolveComponent("el-card");return Vue.openBlock(),Vue.createBlock(e,{shadow:"never"},{header:Vue.withCtx(()=>[Vue.createElementVNode("div",Vr,[Vue.createElementVNode("span",Gr,[Vue.createTextVNode(" 视频组件,采用开源的 "),Vue.createVNode(t,{href:"https://v3.h5player.bytedance.com/",target:"_blank",icon:Vue.unref(wi)(Vue.unref(xi)),style:{margin:"0 4px 5px","font-size":"16px"}},{default:Vue.withCtx(()=>[Vue.createTextVNode(" 西瓜播放器 ")]),_:1},8,["icon"])])])]),default:Vue.withCtx(()=>[jr]),_:1})}}});const Kr=Ei(Wr,[["__scopeId","data-v-a961fabe"]]);export{Kr as default};