!function(t,e){"object"==typeof module&&"object"==typeof module.exports?e():"function"==typeof define&&define.amd?define([],e):(t="undefined"!=typeof globalThis?globalThis:t||self)&&e()}(this,function(){"use strict";"object"==typeof window&&(window.openRedirect={version:"1.2.20",webpackPluginVersion:"3.4.22",reportOnly:!1})}),!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).xss={})}(this,function(t){"use strict";var e=function(){return(e=Object.assign||function(t){for(var e,n=1,i=arguments.length;n/g,a=/&#([a-zA-Z0-9]*);?/gim,s=/"/g,u=/:?/gim,c=/&newline;?/gim,l=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,f=/u\s*r\s*l\s*\(.*/gi,h=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,p=/"/g,d=function(t){return t.replace(r,"<").replace(o,">")},y={indexOf:function(t,e){var n,i;for(n=0,i=t.length;n127&&i<2048?e+=String.fromCharCode(i>>6|192)+String.fromCharCode(63&i|128):e+=String.fromCharCode(i>>12|224)+String.fromCharCode(i>>6&63|128)+String.fromCharCode(63&i|128)}return e}(t);l>2,o=(3&e)<<4|(n=t.charCodeAt(l++))>>4,a=(15&n)<<2|(i=t.charCodeAt(l++))>>6,s=63&i,isNaN(n)?a=s=64:isNaN(i)&&(s=64),c=c+u.charAt(r)+u.charAt(o)+u.charAt(a)+u.charAt(s);return c}function b(t){var e,n,i,r,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");c>4,n=(15&r)<<4|(o=s.indexOf(t.charAt(c++)))>>2,i=(3&o)<<6|(a=s.indexOf(t.charAt(c++))),u+=String.fromCharCode(e),64!==o&&(u+=String.fromCharCode(n)),64!==a&&(u+=String.fromCharCode(i));return function(t){for(var e="",n=0,i=0,r=0,o=0;n191&&i<224?(e+=String.fromCharCode((31&i)<<6|63&(o=t.charCodeAt(n+1))),n+=2):(o=t.charCodeAt(n+1),e+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&(r=t.charCodeAt(n+2))),n+=3);return e}(u)}function w(t,e,n){var i="",r=0,o=!1,a=!1,s=0,u=t.length,c="",l="";t:for(s=0;s"===f||s===u-1){i+=n(t.slice(r,o)),c=function(t){var e,n=y.spaceIndex(t);return e=-1===n?t.slice(1,-1):t.slice(1,n+1),"/"===(e=y.trim(e).toLowerCase()).slice(0,1)&&(e=e.slice(1)),"/"===e.slice(-1)&&(e=e.slice(0,-1)),e}(l=t.slice(o,s+1)),i+=e(o,i.length,c,l,"0;e--){var n=t[e];if(" "!==n)return"="===n?e:-1}return -1}(t,c-1))){u(a,g(y.trim(t.slice(n,c)))),a=!1,n=c+1;continue}}}else{if(-1===(f=t.indexOf(l,c+1)))break;u(a,y.trim(t.slice(r+1,f))),a=!1,n=(c=f)+1}}else a=t.slice(n,c),n=c+1,r='"'===t.charAt(n)||"'"===t.charAt(n)?n:function(t,e){for(;et.charCodeAt(n)?" ":t.charAt(n);return y.trim(e)}(t=(t=(t=t.replace(s,'"')).replace(a,function(t,e){return"x"===e[0]||"X"===e[0]?String.fromCharCode(parseInt(e.substr(1),16)):String.fromCharCode(parseInt(e,10))})).replace(u,":").replace(c," "))}(n),"href"===e||"src"===e){if("#"===(n=y.trim(n)))return"#";if("http://"!==n.substr(0,7)&&"https://"!==n.substr(0,8)&&"mailto:"!==n.substr(0,7)&&"tel:"!==n.substr(0,4)&&"data:image/"!==n.substr(0,11)&&"ftp://"!==n.substr(0,6)&&"./"!==n.substr(0,2)&&"../"!==n.substr(0,3)&&"#"!==n[0]&&"/"!==n[0])return""}else if("background"===e){if(l.lastIndex=0,l.test(n))return""}else if("style"===e&&(h.lastIndex=0,h.test(n)||(f.lastIndex=0,f.test(n)&&(l.lastIndex=0,l.test(n)))))return"";return n=function(t){return t=d(t=t.replace(p,"""))}(n)}var S=function(t){return"string"==typeof t?t.replace(/'/g,'"').replace('=""',"").replace(/\s+/g,"").toLowerCase():""},P=function(){function t(t){var e=function(t){var e={};for(var n in t)e[n]=t[n];return e}(t||{});e.stripIgnoreTag&&(e.onIgnoreTag,e.onIgnoreTag=function(){return""}),e.whiteList={},e.onTag=function(){},e.onTagAttr=function(){},e.onIgnoreTag=function(){},e.onIgnoreTagAttr=function(){},e.safeAttrValue=_,e.escapeHtml=d,this.options=Object.assign(e,t)}return t.prototype.process=function(t){if(!(t=(t=t||"").toString()))return"";var e,n,i,r,o,a,s=this.options,u=s.whiteList,c=s.onTag,l=s.onIgnoreTag,f=s.onTagAttr,h=s.onIgnoreTagAttr,p=s.safeAttrValue,d=s.escapeHtml;s.stripBlankChar&&(t=(e=(e=t.split("")).filter(function(t){var e=t.charCodeAt(0);return!(127===e||e<=31&&10!==e&&13!==e)})).join("")),s.allowCommentTag||(t=function(t){for(var e="",n=0;n");var s=function(t){var e=y.spaceIndex(t);if(-1===e)return{html:"",closing:"/"===t[t.length-2]};var n="/"===(t=y.trim(t.slice(e+1,-1)))[t.length-1];return n&&(t=y.trim(t.slice(0,-1))),{html:t,closing:n}}(i),v=u[n],g=k(s.html,function(t,e){var i=-1!==y.indexOf(v,t),r=f(n,t,e,i);return null==r?i?(e=p(n,t,e,null))?"".concat(t,'="').concat(e,'"'):t:null==(r=h(n,t,e,i))?void 0:r:r});return i="<".concat(n),g&&(i+=" ".concat(g)),s.closing&&(i+=" /"),i+=">"}return null==(a=l(n,i,o))?d(i):a},d);return v&&(g=v.remove(g)),g},t}(),O=Function("\nvar _checkXSS = function (it) {\n return it && it.Math == Math && it;\n};\nreturn _checkXSS(typeof globalThis === 'object' && globalThis) ||\n_checkXSS(typeof window === 'object' && window) ||\n_checkXSS(typeof self === 'object' && self) ||\n_checkXSS(typeof global === 'object' && global) ||\nFunction('return this')();\n")(),T=new(function(){function t(){var t=this;this.batchData=[],this.uniqKeys=new Set,this.timeout=2e3,this.lock=!1,this.getSlardarBid=function(){var e,n,i="douyin_web";if(!y.includes(i,"bid"))return i;if(t.config&&t.config.bid)return t.config.bid;if(O&&O._xssBid)return O._xssBid;if(O&&O.slardar&&"function"==typeof O.slardar.config){var r=(O.slardar.config()||{}).bid;if(r)return r}if(O&&O.Slardar&&"function"==typeof O.Slardar.config){var o=(O.Slardar.config()||{}).bid;if(o)return o}return(null===(n=null===(e=null==O?void 0:O.Slardar)||void 0===e?void 0:e._baseParams)||void 0===n?void 0:n.bid)||"argus"},this.getConfigRegion=function(){var e;return y.includes("cn","region")?t.config&&t.config.region?t.config.region:((null===(e=null==O?void 0:O.gfdatav1)||void 0===e?void 0:e.region)||"cn").toLowerCase():"cn"},this.gerReportUrl=function(){var e={cn:b("aHR0cHM6Ly9tb24uemlqaWVhcGkuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),boe:b("aHR0cHM6Ly9tb24uemlqaWVhcGkuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),ttp:b("aHR0cHM6Ly9tb24udXMudGlrdG9rdi5jb20vbW9uaXRvcl9icm93c2VyL2NvbGxlY3QvYmF0Y2gvc2VjdXJpdHkvP2JpZD0="),va:b("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),maliva:b("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),sg:b("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),boei18n:b("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9")}[t.getConfigRegion()];if(e)return e+t.getSlardarBid()}}return t.prototype.setConfig=function(t){this.config=t},t.prototype.upload=function(){var t=this,e=this.gerReportUrl();!this.lock&&e&&0!==this.batchData.length&&(this.lock=!0,setTimeout(function(){var n=t.batchData.slice(0,100);t.batchData=t.batchData.slice(100),O.fetch(e,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}).catch(function(t){}),t.lock=!1,t.upload()},this.timeout))},t.prototype.generateKey=function(t){return t.collectKey?[t.collectMode,t.collectKey].join("___"):""},t.prototype.push=function(t){this.batchData.push(t),this.upload()},t.prototype.report=function(t){var e=this.generateKey(t);if(O.fetch&&t.collectKey){var n="object"==typeof window?window.location.href:"SSR";t.documentUrl=n;var i={age:Math.floor(Date.now()),type:"xss",url:n,body:t,"user-agent":""};"enforce"===t.disposition&&"SSR"!==n||(i.url=e),"SSR"===n&&(i.url="SSR___".concat(i.url),i.body.ssr=!0),this.push(i)}},t}()),E=function(t){for(var e=0,n=function(n){Array.isArray(t[n])?0===t[n].length?delete t[n]:(t[n]=y.from(y.uniq(t[n])),e+=t[n].length):0===y.keys(t[n]).length?delete t[n]:y.keys(t[n]).forEach(function(i){t[n][i]=y.from(y.uniq(t[n][i])),e+=t[n][i].length})},i=0,r=y.keys(t);i0)return e&&e("javascript:"),!1;if(/^javascript:/i.test(t)){var r=t.slice(11).replace(/\s/g,"").trim();return!!y.some(["void","void(0)","void0","false","undefined",";"],function(t){return t===r})||(e&&e("javascript:"),!1)}return!0}var A=function(t,e){var n,i,r="<%= isSaveValidUrl =>";if("string"!=typeof t||(i=Number("<%= urlLimit =>"),void 0!==n&&(i=n),"NaN"!==t.toString()&&-1!==i&&t.length>=i)||R(t,e))return t;try{if(!0===(r=JSON.parse(r))||"true"===r){var o=new URL(t);return o.origin+o.pathname}}catch(t){}return"#"};function L(t,e,i){if(void 0===t&&(t=""),void 0===e&&(e=[]),"string"!=typeof t)return!0;if(!R(t=j(t)))return!1;var r,o={url:(r=t.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/)||[])[0],scheme:r[1],slash:r[2],host:r[3],port:r[4],path:r[5],query:r[6],hash:r[7]},a=o.scheme,s=o.host;return i?!!i(t):!(!a||!s)&&(!y.includes(["http","https","file"],a)||("object"==typeof window&&window&&(e=n(n([],e,!0),[location.host],!1)),y.some(e,function(t){return!!(t instanceof RegExp&&t.test(s))||t===s})))}var I={a:["target","title","spellcheck","rel"],canvas:[],abbr:["title"],address:[],area:["shape","coords","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:["dir"],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["alt","title","width","height","decoding"],ins:["datetime"],li:[],mark:[],nav:[],ol:["start"],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],delete:[],form:[],strong:[],mask:["maskunits","x","y","width","height","fill"],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],wbr:[],video:["autoplay","controls","loop","preload","height","width"],svg:["viewBox","version","xmlns","fill","width","height","stroke","stroke-width","style"],path:["d","fill","opacity","stroke","p-id","fill-rule","clip-rule","stroke-width","stroke-linecap","stroke-linejoin","fill-opacity","mask"],rect:["x","y","width","height","fill","stroke","rx"],g:[]},D={collect:null,initCollect:function(){this.collect={whiteList:{},filterProtocol:[]}},removeCollect:function(){var t=E(this.collect),e=t.count,n=t.ret;return this.collect=null,{collectKey:0===e?null:JSON.stringify(n),collectMode:"white"}},onIgnoreTagAttr:function(t,e,i){return t&&y.indexOf(["href","src"],e)>-1?D.domainWhiteList&&Array.isArray(D.domainWhiteList)&&D.domainWhiteList.length>0&&!L(i,n([],D.domainWhiteList,!0))?"":"".concat(e,'="').concat(A(i,function(t){var e;null===(e=D.collect)||void 0===e||e.filterProtocol.push(t)}),'"'):t&&(y.indexOf(["style","class","id"],e)>-1||e.indexOf("data-")>-1)?"".concat(e,'="').concat(i,'"'):(D.collect.whiteList[t]=D.collect.whiteList[t]||[],void D.collect.whiteList[t].push(e))},onIgnoreTag:function(t,e){if("style"===t)return e;w(e,function(t,e,n,i){k(x(i).html.replace("/",""),function(t){D.collect.whiteList[n]=D.collect.whiteList[n]||[],D.collect.whiteList[n].push(t)})},d)},whiteList:I,mergeWhiteList:function(t){for(var e,n={},i=0,r=y.keys(I);i");var o=x(i),a=k(o.html,function(t,e){var i,r=0;if(F.blackList[n]&&y.includes(F.blackList[n],t)&&(W.collect.blackList[n]=W.collect.blackList[n]||[],W.collect.blackList[n].push(t),r++),F.blackAttrRegExps.length&&F.blackAttrRegExps.some(function(e){return e.test(t)})&&y.forEach(F.blackAttrRegExps,function(e){e.test(t)&&(W.collect.blackAttrRegExps.push("".concat(e.toString(),"->").concat(t)),r++)}),F.blackAttrs.length&&y.includes(F.blackAttrs,t)&&(F.blackAttrs.push(t),r++),!r){if(F.filterList&&F.filterList[n]&&y.includes(F.filterList[n],t)){var o=A(e,function(t){var e;null===(e=W.collect)||void 0===e||e.filterProtocol.push(t)});return o!==e&&(W.collect.filterList[n]=W.collect.filterList[n]||[],W.collect.filterList[n].push(t)),e?"".concat(t,"='").concat(o,"'"):t}return F.filterAttrs&&y.includes(F.filterAttrs,t)?((o=A(e,function(t){var e;null===(e=W.collect)||void 0===e||e.filterProtocol.push(t)}))!==e&&(null===(i=W.collect)||void 0===i||i.filterAttrs.push(t)),e?"".concat(t,"='").concat(o,"'"):t):e?"".concat(t,"='").concat(e,"'"):t}});return i="<".concat(n),a&&(i+=" ".concat(a)),o.closing&&(i+=" /"),i+=">"},d);null===(n=W.collect)||void 0===n||n.blackTags.push(t)}},V=function(t){var e=t.reportOnly,n=void 0===e||e,i=t.block;return n&&"all"===n?"report":("string"==typeof n&&("true"===n&&(n=!0),"false"===n&&(n=!1)),i?"enforce":n?"report":"enforce")},G=function(t){return function(n,i,r){if(!n||"string"!=typeof n)return n;var o=i;t===C&&(o=D).initCollect();var a=t(n,o);if(S(a)===S(n))return n;if(!r)return a;var s=r.logType,u=V(r),c=o.removeCollect();return T.report(e(e({type:s,disposition:u},c),{sourceText:m(n),filterText:m(a)})),"enforce"===u?a:n}},z=G(function(t,e){return void 0===e&&(e={}),e&&e.whiteList||(e.whiteList={a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}),new P(e).process(t)}),K=G(C),Y=function(t,e,n){var i=[],r=A(t,function(t){i.push(t)});if(r===t)return t;i=y.from(y.uniq(i));var o=e||n||{};if(!o)return r;var a=o.logType,s=V(n);return T.report({type:a,disposition:s,collectKey:i.join("___"),collectData:JSON.stringify(i),collectMode:"black",sourceText:m(t),filterText:m(r)}),"enforce"===s?r:t},X=O._xssProject||{},q=O.xssNamespace||{},J="3.0.26",Z={FilterXSS:P,version:J,webpackPluginVersion:"<%= webpackPluginVersion =>",reportOnly:"<%= reportOnly =>",filterXSS:z,_filterXSS:K,filterUrl:Y,Config:D,BlackConfig:W,project:X,setProjectName:function(t){X[t]=this,O._xssProjectName=t}};q.douyin_web=Z,O.xssNamespace=q,O.Math&&!O.Math.xssNamespace&&(O.Math.xssNamespace=q),X[J]=Z,O.globalThis=O,O.getFilterXss=function(){return void 0!==this._xssProjectName?this._xssProject[this._xssProjectName]:Z},O.xss=Z,O.isSafeUrl=L,O.isSafeDomain=L,O.isSafeProtocol=R,O._xssProject=X,O._xssProjectName&&(X[O._xssProjectName]=Z);var $=Z.setProjectName.bind(Z);t.BlackConfig=W,t.Config=D,t.FilterXSS=P,t._filterXSS=K,t.filterUrl=Y,t.filterXSS=z,t.isSafeDomain=L,t.isSafeProtocol=R,t.isSafeUrl=L,t.project=X,t.setProjectName=$,t.setXssNamespace=function(t){var e=t.appId,n=t.bid,i=t.region;q[e]=Z;D.bid=n,D.region=i,D.enabled=!0},t.xssNamespace=q,Object.defineProperty(t,"__esModule",{value:!0})}),!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.pace=e():t.pace=e()}(self,function(){return function(){var t={27377:function(t){if("undefined"!=typeof Element&&!Element.prototype.matches){var e=Element.prototype;e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}},59798:function(t,e,n){var i=n(27377);function r(t,e,n,i,r){var a=o.apply(this,arguments);return t.addEventListener(n,a,r),{destroy:function(){t.removeEventListener(n,a,r)}}}function o(t,e,n,r){return function(n){n.delegateTarget=i(n.target,e),n.delegateTarget&&r.call(t,n)}}t.exports=function(t,e,n,i,o){return"function"==typeof t.addEventListener?r.apply(null,arguments):"function"==typeof n?r.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return r(t,e,n,i,o)}))}},78108:function(t){var e,n;e=0,n=function(){return function t(e,n,i){var r,o,a=window,s="application/octet-stream",u=i||s,c=e,l=!n&&!i&&c,f=document.createElement("a"),h=function(t){return String(t)},p=a.Blob||a.MozBlob||a.WebKitBlob||h,d=n||"download";if(p=p.call?p.bind(a):Blob,"true"===String(this)&&(u=(c=[c,u])[0],c=c[1]),l&&l.length<2048&&(d=l.split("/").pop().split("?")[0],f.href=l,-1!==f.href.indexOf(l))){var y=new XMLHttpRequest;return y.open("GET",l,!0),y.responseType="blob",y.onload=function(e){t(e.target.response,d,s)},setTimeout(function(){y.send()},0),y}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)){if(!(c.length>2096103.424)||p===h)return navigator.msSaveBlob?navigator.msSaveBlob(b(c),d):w(c);u=(c=b(c)).type||s}else if(/([\x80-\xff])/.test(c)){for(var v=0,g=new Uint8Array(c.length),m=g.length;v-1,d={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},y="%c[xgplayer]",v={config:{debug:p?3:1},logInfo:function(t){for(var e,n=arguments.length,i=Array(n>1?n-1:0),r=1;r=3&&(e=console).log.apply(e,[y,d.info,t].concat(i))},logWarn:function(t){for(var e,n=arguments.length,i=Array(n>1?n-1:0),r=1;r=1&&(e=console).warn.apply(e,[y,d.warn,t].concat(i))},logError:function(t){if(!(this.config.debug<1)){for(var e,n=this.config.debug>=2?"trace":"error",i=arguments.length,r=Array(i>1?i-1:0),o=1;ot.length)&&(e=t.length);for(var n=0,i=Array(e);n0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(t);return r.className=i,r.innerHTML=e,Object.keys(n).forEach(function(e){var i=n[e];"video"===t||"audio"===t||"live-video"===t?i&&r.setAttribute(e,i):r.setAttribute(e,i)}),r},_.createDomFromHtml=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var i=document.createElement("div");i.innerHTML=t;var r=i.children;if(i=null,r.length>0)return r=r[0],n&&_.addClass(r,n),e&&Object.keys(e).forEach(function(t){r.setAttribute(t,e[t])}),r;return null}catch(t){return v.logError("util.createDomFromHtml",t),null}},_.hasClass=function(t,e){if(!t||!e)return!1;try{return Array.prototype.some.call(t.classList,function(t){return t===e})}catch(i){var n=t.className&&"object"===k(t.className)?t.getAttribute("class"):t.className;return n&&!!n.match(RegExp("(\\s|^)"+e+"(\\s|$)"))}},_.addClass=function(t,e){if(!!t&&!!e)try{e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)})}catch(n){!_.hasClass(t,e)&&(t.className&&"object"===k(t.className)?t.setAttribute("class",t.getAttribute("class")+" "+e):t.className+=" "+e)}},_.removeClass=function(t,e){if(!!t&&!!e)try{e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.remove(e)})}catch(n){_.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=RegExp("(\\s|^)"+e+"(\\s|$)");t.className&&"object"===k(t.className)?t.setAttribute("class",t.getAttribute("class").replace(n," ")):t.className=t.className.replace(n," ")})}},_.toggleClass=function(t,e){if(!!t)e.split(/\s+/g).forEach(function(e){_.hasClass(t,e)?_.removeClass(t,e):_.addClass(t,e)})},_.classNames=function(){for(var t=arguments,e=[],n=function(n){"String"===_.typeOf(t[n])?e.push(t[n]):"Object"===_.typeOf(t[n])&&Object.keys(t[n]).map(function(i){t[n][i]&&e.push(i)})},i=0;i0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1?arguments[1]:void 0;try{t=e.querySelector(n)}catch(i){v.logError("util.findDom",i),0===n.indexOf("#")&&(t=e.getElementById(n.slice(1)))}return t},_.getCss=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,!1)[e]},_.padStart=function(t,e,n){for(var i=String(n),r=e>>0,o=Math.ceil(r/i.length),a=[],s=String(t);o--;)a.push(i);return a.join("").substring(0,r-s.length)+s},_.format=function(t){if(window.isNaN(t))return"";t=Math.round(t);var e=_.padStart(Math.floor(t/3600),2,0),n=_.padStart(Math.floor((t-3600*e)/60),2,0),i=_.padStart(Math.floor(t-3600*e-60*n),2,0);return("00"===e?[n,i]:[e,n,i]).join(":")},_.event=function(t){if(t.touches){var e=t.touches[0]||t.changedTouches[0];t.clientX=e.clientX||0,t.clientY=e.clientY||0,t.offsetX=e.pageX-e.target.offsetLeft,t.offsetY=e.pageY-e.target.offsetTop}t._target=t.target||t.srcElement},_.typeOf=function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},_.deepCopy=function(t,e){if("Object"===_.typeOf(e)&&"Object"===_.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==_.typeOf(e[n])||e[n]instanceof Node?"Array"===_.typeOf(e[n])?t[n]="Array"===_.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:void 0===t[n]||void 0===t[n]?t[n]=e[n]:_.deepCopy(t[n],e[n])}),t},_.deepMerge=function(t,e){return Object.keys(e).map(function(n){if("Array"===_.typeOf(e[n])&&"Array"===_.typeOf(t[n])){if("Array"===_.typeOf(t[n])){var i,r;(i=t[n]).push.apply(i,function(t){if(Array.isArray(t))return w(t)}(r=e[n])||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}}(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}else _.typeOf(t[n])!==_.typeOf(e[n])||null===t[n]||"Object"!==_.typeOf(t[n])||e[n]instanceof window.Node?null!==e[n]&&(t[n]=e[n]):_.deepMerge(t[n],e[n])}),t},_.getBgImage=function(t){var e=(t.currentStyle||window.getComputedStyle(t,null)).backgroundImage;if(!e||"none"===e)return"";var n=document.createElement("a");return n.href=e.replace(/url\("|"\)/g,""),n.href},_.copyDom=function(t){if(!t||1!==t.nodeType)return"";var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e},_.setInterval=function(t,e,n,i){!t._interval[e]&&(t._interval[e]=window.setInterval(n.bind(t),i))},_.clearInterval=function(t,e){clearInterval(t._interval[e]),t._interval[e]=null},_.setTimeout=function(t,e,n){!t._timers&&(t._timers=[]);var i=setTimeout(function(){e(),_.clearTimeout(t,i)},n);return t._timers.push(i),i},_.clearTimeout=function(t,e){var n=t._timers;if("Array"===_.typeOf(n)){for(var i=0;i-1&&i.indexOf(t)>-1)||(r=parseFloat(n.slice(0,n.indexOf(t)).trim()),o=parseFloat(i.slice(0,i.indexOf(t)).trim()),a=t,!1)}),s.style.width="".concat(r).concat(a),s.style.height="".concat(o).concat(a),s.style.backgroundSize="".concat(r).concat(a," ").concat(o).concat(a),"start"===t?s.style.margin="-".concat(o/2).concat(a," auto auto -").concat(r/2).concat(a):s.style.margin="auto 5px auto 5px"),s},_.Hex2RGBA=function(t,e){var n=[];if(/^\#[0-9A-F]{3}$/i.test(t)){var i="#";t.replace(/[0-9A-F]/ig,function(t){i+=t+t}),t=i}return/^#[0-9A-F]{6}$/i.test(t)?(t.replace(/[0-9A-F]{2}/ig,function(t){n.push(parseInt(t,16))}),"rgba(".concat(n.join(","),", ").concat(e,")")):"rgba(255, 255, 255, 0.1)"},_.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},_.checkIsFunction=function(t){return t&&"function"==typeof t},_.checkIsObject=function(t){return null!==t&&"object"===k(t)},_.hide=function(t){t.style.display="none"},_.show=function(t,e){t.style.display=e||"block"},_.isUndefined=function(t){if(null==t)return!0},_.setStyleFromCsstext=function(t,e){if(!!e)"String"===_.typeOf(e)?e.replace(/\s+/g,"").split(";").map(function(e){if(e){var n=e.split(":");n.length>1&&(t.style[n[0]]=n[1])}}):Object.keys(e).map(function(n){t.style[n]=e[n]})};function S(t){var e=k(t);return null!==t&&("object"===e||"function"===e)}_.filterStyleFromText=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=t.style.cssText;if(!n)return{};var i=n.replace(/\s+/g,"").split(";"),r={},o={};return i.map(function(t){if(t){var n=t.split(":");n.length>1&&(function(t,e){for(var n=0,i=e.length;n-1)return!0;return!1}(n[0],e)?r[n[0]]=n[1]:o[n[0]]=n[1])}}),t.setAttribute("style",""),Object.keys(o).map(function(e){t.style[e]=o[e]}),r},_.getStyleFromCsstext=function(t){var e=t.style.cssText;if(!e)return{};var n=e.replace(/\s+/g,"").split(";"),i={};return n.map(function(t){if(t){var e=t.split(":");e.length>1&&(i[e[0]]=e[1])}}),i},_.preloadImg=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(!!t){var i=new window.Image;i.onload=function(t){i=null,e&&e(t)},i.onerror=function(t){i=null,n&&n(t)},i.src=t}},_.stopPropagation=function(t){t&&(t.stopPropagation(),t.cancelable&&t.preventDefault())},_.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},_.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},_.checkTouchSupport=function(){return"ontouchstart"in window},_.getBuffered2=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],i=0;it.start(i)?0:t.start(i),end:t.end(i)});n.sort(function(t,e){var n=t.start-e.start;return n?n:e.end-t.end});var r=[];if(e)for(var o=0;os&&(r[a-1].end=n[o].end):r.push(n[o])}else r.push(n[o])}else r=n;return new b(r)},_.getBufferByCurrentTime=function(t,e){var n={start:0,end:0,include:0,diff:0,cur:e};if(!t||t.length<1)return n;for(var i=-1,r=-1,o=parseInt(1e3*e,10),a=t.length-1;a>-1;a--){var s=parseInt(1e3*t.start(a),10),u=parseInt(1e3*t.end(a),10);if(o>=s&&o<=u){n.include=1,n.start=s/1e3,n.end=u/1e3,n.diff=(u-o)/1e3;break}ou&&(i<0||o-u1&&void 0!==arguments[1]?arguments[1]:1;return t.touches&&t.touches.length>0&&(t=t.touches[0]),{x:t.x/e,y:t.y/e,clientX:t.clientX/e,clientY:t.clientY/e,offsetX:t.offsetX/e,offsetY:t.offsetY/e,pageX:t.pageX/e,pageY:t.pageY/e}},_.requestAnimationFrame=function(t){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(e)return e(t)},_.getHostFromUrl=function(t){if("String"!==_.typeOf(t))return"";var e=t.split("/"),n="";return e.length>3&&e[2]&&(n=e[2]),n},_.cancelAnimationFrame=function(t){var e=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;e&&e(t)},_.isMSE=function(t){return t.media&&(t=t.media),!!(t&&t instanceof HTMLMediaElement)&&(/^blob/.test(t.currentSrc)||/^blob/.test(t.src))},_.isBlob=function(t){return"string"==typeof t&&/^blob/.test(t)},_.generateSessionId=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=new Date().getTime();try{t=parseInt(t)}catch(e){t=0}return e+=t,window.performance&&"function"==typeof window.performance.now&&(e+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},_.adjustTimeByDuration=function(t,e,n){return e&&t?t>e||n&&t0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(t.scale||1),translate:"".concat(t.x||0,"%, ").concat(t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")};return Object.keys(n).forEach(function(t){var i=RegExp("".concat(t,"\\([^\\(]+\\)"),"g"),r="".concat(t,"(").concat(n[t],")");i.test(e)?(i.lastIndex=-1,e=e.replace(i,r)):e+="".concat(r," ")}),e},_.convertDeg=function(t){return 1>=Math.abs(t)?360*t:t%360};function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null,src:null};!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,t);var i=e&&e.i18n?e.i18n.ERROR_TYPES:null;if(null!=e&&e.video){var r=n.mediaError?n.mediaError:e.video.error||{},o=e.duration,a=e.currentTime,s=e.ended,u=e.src,c=e.currentSrc,l=e.video,f=l.readyState,p=l.networkState,d={playerVersion:h,domain:document.domain,currentTime:a,duration:o,ended:s,readyState:f,networkState:p,src:n.src||u||c,errorType:n.errorType,errorCode:n.errorCode||r.code,message:n.errorMessage||r.message,mediaError:r,originError:n.originError?n.originError.stack:"",host:_.getHostFromUrl(u||c)};return n.ext&&Object.keys(n.ext).map(function(t){d[t]=n.ext[t]}),d}if(arguments.length>1){for(var y={playerVersion:h,domain:document.domain},v=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],g=0;g=3){var tZ=tJ[2].split(".");return tZ.length>0?parseInt(tZ[0]):0}return 0},get isWeixin(){if("undefined"==typeof navigator)return!1;if(/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase()))return!0;return!1},isSupportMP4:function(){var t={isSupport:!1,mime:""};if("undefined"==typeof document)return t;if(this.supportResult)return this.supportResult;var e=document.createElement("video");return"function"==typeof e.canPlayType&&tN.map(function(n){"probably"===e.canPlayType('video/mp4; codecs="'.concat(n,'"'))&&(t.isSupport=!0,t.mime+="||".concat(n))}),this.supportResult=t,e=null,t},isHevcSupported:function(){return"undefined"!=typeof MediaSource&&!!MediaSource.isTypeSupported&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(t){var e={supported:!1,smooth:!1,powerEfficient:!1};if(!t||"undefined"==typeof navigator)return Promise.resolve(e);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(t);var n=t.video||{},i=t.audio||{};try{var r=MediaSource.isTypeSupported(n.contentType),o=MediaSource.isTypeSupported(i.contentType);return Promise.resolve({supported:r&&o,smooth:!1,powerEfficient:!1})}catch(t){return Promise.resolve(e)}},isHdrSupported:function(){if("function"==typeof matchMedia){var t=matchMedia("(dynamic-range: high)"),e=matchMedia("not supported query");return t.media!==e.media&&!0===t.matches}return!1},isDolbyHdrSupported:function(){if("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)return!1;var t=function(){if("undefined"!=typeof navigator){var t=null;if(void 0===s){var e=navigator.userAgent.toLowerCase();s=/chrome\/([\d.]+)/.exec(e)}if((t=s)&&t[1]&&parseInt(t[1].split(".")[0])>=122)return!0}return!1};return tM.isHdrSupported()&&(MediaSource.isTypeSupported('video/mp4;codecs="dvh1.08.07"')||MediaSource.isTypeSupported('video/mp4;codecs="hvc1.2.4.L150.90"')&&t())}},t$=tM;function tQ(t){return(tQ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t0(t,e){for(var n=0;n=0?t.bizType:0,e._rate=-1,e.videoConfig=Object.assign({},{controls:!1,autoplay:t.autoplay,playsinline:t.playsinline,"x5-playsinline":t.playsinline,"webkit-playsinline":t.playsinline,"x5-video-player-fullscreen":t["x5-video-player-fullscreen"]||t.x5VideoPlayerFullscreen,"x5-video-orientation":t["x5-video-orientation"]||t.x5VideoOrientation,airplay:t.airplay,"webkit-airplay":t.airplay,tabindex:0|t.tabindex,mediaType:t.mediaType||"video","data-index":-1},t.videoConfig,t.videoAttributes);var e,n=t["x5-video-player-type"]||t.x5VideoPlayerType;return t$.isWeixin&&t$.os.isAndroid&&n&&(e.videoConfig["x5-video-player-type"]=n,delete e.videoConfig.playsinline,delete e.videoConfig["webkit-playsinline"],delete e.videoConfig["x5-playsinline"]),t.loop&&(e.videoConfig.loop="loop"),e.video=_.createDom(e.videoConfig.mediaType,"",e.videoConfig,""),t.defaultPlaybackRate&&(e.video.defaultPlaybackRate=e.video.playbackRate=t.defaultPlaybackRate),"Number"===_.typeOf(t.volume)&&(e.volume=t.volume),t.autoplayMuted&&(e.video.muted=!0,e._lastMuted=!0),t.autoplay&&(e.video.autoplay=!0),e._interval={},e.videoEventMiddleware={},e.attachVideoEvents(),e}return i=s,r=[{key:"setEventsMiddleware",value:function(t){var e=this;Object.keys(t).map(function(n){e.videoEventMiddleware[n]=t[n]})}},{key:"removeEventsMiddleware",value:function(t){var e=this;Object.keys(t).map(function(t){delete e.videoEventMiddleware[t]})}},{key:"attachVideoEvents",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];!this.evHandlers&&(this._evHandlers=tR.map(function(t){var n,i,r,o,a,s;return o={},a=t,s=(n=t,(i=e)[r="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1))]&&"function"==typeof i[r]&&i.on(n,i[r]),function(t,e){var r={player:i,eventName:n,originalEvent:t,detail:t.detail||{},timeStamp:t.timeStamp,currentTime:i.currentTime,duration:i.duration,paused:i.paused,ended:i.ended,isInternalOp:!!i._internalOp[t.type],muted:i.muted,volume:i.volume,host:_.getHostFromUrl(i.currentSrc),vtype:i.vtype};if(i.removeInnerOP(t.type),"timeupdate"===n&&(i._currentTime=i.video&&i.video.currentTime),"ratechange"===n){var o=i.video?i.video.playbackRate:0;if(o&&i._rate===o)return;i._rate=i.video&&i.video.playbackRate}if("durationchange"===n&&(i._duration=i.video.duration),"volumechange"===n&&(r.isMutedChange=i._lastMuted!==i.muted,i._lastMuted=i.muted),"error"===n&&(r.error=e||i.video.error),i.videoEventMiddleware[n]){var a=t5.bind(i,n,r);try{i.videoEventMiddleware[n].call(i,r,a)}catch(t){throw t5.call(i,n,r),t}}else t5.call(i,n,r)}),(a=t1(a))in o?Object.defineProperty(o,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[a]=s,o})),!t&&(t=this.video),this._evHandlers.forEach(function(e){var i=Object.keys(e)[0];(0===n.length||n.indexOf(i)>-1)&&t.addEventListener(i,e[i],!1)})}},{key:"detachVideoEvents",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];!t&&(t=this.video),this._evHandlers.forEach(function(n){var i=Object.keys(n)[0];(0===e.length||e.indexOf(i)>-1)&&t.removeEventListener(i,n[i],!1)})}},{key:"_attachSourceEvents",value:function(t,e){var n=this;t.removeAttribute("src"),t.load(),t.removeEventListener("loadeddata",this._vLoadeddata),e.forEach(function(t){n.video.appendChild(_.createDom("source","",{src:"".concat(t.src),type:"".concat(t.type||"")}))});var i=t.children;if(!!i){this._videoSourceCount=i.length,this._vLoadeddata=function(t){n.emit(tx,{src:t.target.currentSrc,host:_.getHostFromUrl(t.target.currentSrc)})};for(var r=null,o=0;o0;)t.removeChild(e[0]);this._vLoadeddata&&t.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.video&&(this.video.error||e)){var n=this.video.error||e,i=n.code?T[n.code]:"other",r=n.message||"";!this.video.currentSrc&&(n={code:6,message:r="empty_src_".concat(n.message)}),this.emit(t,new E(this,{errorType:i,errorCode:n.code,errorMessage:n.message||"",mediaError:n}))}}},{key:"hasStart",get:function(){return this._hasStart},set:function(t){"boolean"==typeof t&&(this._hasStart=t,this.emit("hasstart"))}},{key:"destroy",value:function(){var t=this;for(var e in this.video&&(this.video.pause&&(this.video.pause(),this.video.muted=!0),this.video.removeAttribute("src"),this.video.load()),this._currentTime=0,this._duration=0,this._hasStart=!1,this.videoConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this._evHandlers.map(function(e){var n=Object.keys(e)[0],i="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1));"function"==typeof t[i]&&t.off(n,t[i])}),this._evHandlers=null,this.video=null,this.videoEventMiddleware={},this.removeAllListeners()}},{key:"play",value:function(){return this.video?this.video.play():null}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"load",value:function(){this.video&&this.video.load()}},{key:"canPlayType",value:function(t){return!!this.video&&this.video.canPlayType(t)}},{key:"getBufferedRange",value:function(t){var e=[0,0];if(!this.video)return e;!t&&(t=this.video.buffered);var n=this.video.currentTime;if(t)for(var i=0,r=t.length;ie.start(n))&&e.end(n)>=this.currentTime)return{start:e.start(n),end:e.end(n)};return t}},{key:"crossOrigin",get:function(){return this.video?this.video.crossOrigin:""},set:function(t){this.video&&(this.video.crossOrigin=t)}},{key:"currentSrc",get:function(){return this.video?this.video.currentSrc:""},set:function(t){this.video&&(this.video.currentSrc=t)}},{key:"currentTime",get:function(){return this.video?void 0!==this.video.currentTime?this.video.currentTime:this._currentTime:0},set:function(t){this.video&&(this.video.currentTime=t)}},{key:"defaultMuted",get:function(){return!!this.video&&this.video.defaultMuted},set:function(t){this.video&&(this.video.defaultMuted=t)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.video&&this.video.ended}},{key:"error",get:function(){return this.video&&this.video.error?["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.video.error.code-1]:null}},{key:"loop",get:function(){return!!this.video&&this.video.loop},set:function(t){this.video&&(this.video.loop=t)}},{key:"muted",get:function(){return!!this.video&&this.video.muted},set:function(t){if(!!this.video&&this.video.muted!==t)this._lastMuted=this.video.muted,this.video.muted=t}},{key:"networkState",get:function(){return this.video?this.video.networkState:0}},{key:"paused",get:function(){return!this.video||this.video.paused}},{key:"playbackRate",get:function(){return this.video?this.video.playbackRate:0},set:function(t){if(!!this.video&&t!==1/0)this.video.defaultPlaybackRate=t,this.video.playbackRate=t}},{key:"played",get:function(){return this.video?this.video.played:null}},{key:"preload",get:function(){return!!this.video&&this.video.preload},set:function(t){this.video&&(this.video.preload=t)}},{key:"readyState",get:function(){return this.video?this.video.readyState:0}},{key:"seekable",get:function(){return!!this.video&&this.video.seekable}},{key:"seeking",get:function(){return!!this.video&&this.video.seeking}},{key:"src",get:function(){return this.video?this.video.src:""},set:function(t){this.video.src=t}},{key:"volume",get:function(){return this.video?this.video.volume:0},set:function(t){if("number"==typeof t&&!(t<0)&&!(t>1)&&!!this.video)this.video.volume=t}},{key:"addInnerOP",value:function(t){this._internalOp[t]=!0}},{key:"removeInnerOP",value:function(t){delete this._internalOp[t]}},{key:"emit",value:function(t,e){for(var n,i=arguments.length,r=Array(i>2?i-2:0),o=2;o2?i-2:0),o=2;o2?i-2:0),o=2;o2?i-2:0),o=2;o0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,i),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}return t=i,e=[{key:"openDB",value:function(t){var e=this,n=this,i=this.myDB.version||1,r=n.indexedDB.open(n.myDB.name,i);r.onerror=function(t){},r.onsuccess=function(i){e.myDB.db=i.target.result,t.call(n)},r.onupgradeneeded=function(t){var e,i=t.target.result;t.target.transaction,!i.objectStoreNames.contains(n.myDB.ojstore.name)&&i.createObjectStore(n.myDB.ojstore.name,{keyPath:n.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(t,e){for(var n,i=this.myDB.db.transaction(t,"readwrite").objectStore(t),r=0;rt.length)&&(e=t.length);for(var n=0,i=Array(e);n3?i-3:0),o=3;o2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return!this.__hooks&&(this.__hooks={}),this.__hooks[t]||(this.__hooks[t]=null),(function(){var i=arguments,r=this;if(n.pre)try{(o=n.pre).call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}catch(e){throw e.message="[pluginName: ".concat(this.pluginName,":").concat(t,":pre error] >> ").concat(e.message),e}if(this.__hooks&&this.__hooks[t])try{var o,a,s=(a=this.__hooks[t]).call.apply(a,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then(function(t){if(!1!==t){var o;es.apply(void 0,[r,e,n.next].concat((o=i,function(t){if(Array.isArray(t))return ea(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||function(t,e){if(t){if("string"==typeof t)return ea(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ea(t,e)}}(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())))}}).catch(function(t){throw t}):es.apply(void 0,[this,e,n.next].concat(Array.prototype.slice.call(arguments))):void 0===s&&es.apply(void 0,[this,e,n.next].concat(Array.prototype.slice.call(arguments)))}catch(e){throw e.message="[pluginName: ".concat(this.pluginName,":").concat(t,"] >> ").concat(e.message),e}else es.apply(void 0,[this,e,n.next].concat(Array.prototype.slice.call(arguments)))}).bind(this)}function ec(t,e){var n=this.__hooks;return n?!!n.hasOwnProperty(t)&&(n&&(n[t]=e),!0):void 0}function el(t,e){var n=this.__hooks;if(!n||!Array.isArray(n[t]))return -1;for(var i=n[t],r=0;r1?n-1:0),r=1;r1?n-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:[];t.__hooks={},e&&e.map(function(e){t.__hooks[e]=null}),Object.defineProperty(t,"hooks",{get:function(){return t.__hooks&&Object.keys(t.__hooks).map(function(e){if(t.__hooks[e])return e})}})}function ey(t){t.__hooks=null}function ev(t,e,n){for(var i=arguments.length,r=Array(i>3?i-3:0),o=3;o-1&&(e=this.playerConfig.domEventType),e}},{key:"on",value:function(t,e){var n=this;if(!t||!e||!this.player){e_(this.pluginName,"plugin.on(event, callback)");return}"string"==typeof t?(this.__events[t]=e,this.player.on(t,e)):Array.isArray(t)&&t.forEach(function(t){n.__events[t]=e,n.player.on(t,e)})}},{key:"once",value:function(t,e){var n=this;if(!t||!e||!this.player){e_(this.pluginName,"plugin.once(event, callback)");return}"string"==typeof t?(this.__onceEvents[t]=e,this.player.once(t,e)):Array.isArray(t)&&t.forEach(function(i){n.__onceEvents[i]=e,n.player.once(t,e)})}},{key:"off",value:function(t,e){var n=this;if(!t||!e||!this.player){e_(this.pluginName,"plugin.off(event, callback)");return}"string"==typeof t?(delete this.__events[t],this.player.off(t,e)):Array.isArray(t)&&t.forEach(function(i){delete n.__events[t],n.player.off(i,e)})}},{key:"offAll",value:function(){var t=this;["__events","__onceEvents"].forEach(function(e){Object.keys(t[e]).forEach(function(n){t[e][n]&&t.off(n,t[e][n]),n&&delete t[e][n]})}),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(t){var e;if(!!this.player){for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{};if(!!this.player){var i=eb(eb({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(t,e,i)}}},{key:"hook",value:function(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],eu.call.apply(eu,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(t,e){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r2?n-2:0),r=2;r1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!!this.player)return n&&(e.pluginName=n),this.player.registerPlugin({plugin:t,options:e})}},{key:"getPlugin",value:function(t){return this.player?this.player.getPlugin(t):null}},{key:"__destroy",value:function(){var t=this,e=this.player,n=this.pluginName;this.offAll(),_.clearAllTimers(this),_.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map(function(e){t[e]=null}),e.unRegisterPlugin(n),ey(this)}}],n=[{key:"defineGetterOrSetter",value:function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&Object.defineProperty(t,n,e[n])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}],e&&ew(t.prototype,e),n&&ew(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(),eP=n("59798"),eO=n.n(eP);function eT(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=null;if(t instanceof window.Element)return _.addClass(t,n),Object.keys(i).map(function(e){t.setAttribute(e,i[e])}),t;if(eI(t)||eI(t.url))return i.src=eI(t)?t:t.url||"",o=_.createDom(t.tag||"img","",i,"xg-img ".concat(n));if("function"==typeof t)try{if((o=t())instanceof window.Element)return _.addClass(o,n),Object.keys(i).map(function(t){o.setAttribute(t,i[t])}),o;v.logWarn("warn>>icons.".concat(e," in config of plugin named [").concat(r,"] is a function mast return an Element Object"));return null}catch(t){return v.logError("Plugin named [".concat(r,"]:createIcon"),t),null}return"string"==typeof t?_.createDomFromHtml(t,i,n):(v.logWarn("warn>>icons.".concat(e," in config of plugin named [").concat(r,"] is invalid")),null)}var eN=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&eC(t,e)}(s,t);var e,n,i,r,o,a=(e=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,i=ex(e);return t=n?Reflect.construct(i,arguments,ex(this).constructor):i.apply(this,arguments),function(t,e){if(e&&("object"===ej(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,s),(t=a.call(this,e)).__delegates=[],t}return i=s,r=[{key:"__init",value:function(t){if(eE(ex(s.prototype),"__init",this).call(this,t),!!t.root){var e=t.root,n=null;this.icons={},this.root=null,this.parent=null,!function(t,e){var n=e.config.icons||e.playerConfig.icons;Object.keys(t).map(function(i){var r,o,a,s,u=t[i],c=u&&u.class?u.class:"",l=u&&u.attr?u.attr:{},f=null;if(n&&n[i]){;r=n[i],o=c,c="object"===ej(r)&&r.class&&"string"==typeof r.class?"".concat(o," ").concat(r.class):o,a=n[i],s=l,"object"===ej(a)&&a.attr&&"object"===ej(a.attr)&&Object.keys(a.attr).map(function(t){s[t]=a.attr[t]}),l=s,f=eD(n[i],i,c,l,e.pluginName)}!f&&u&&(f=eD(u.icon?u.icon:u,l,c,{},e.pluginName)),e.icons[i]=f})}(this.registerIcons()||{},this),this.langText={},!function(t,e){Object.keys(t).map(function(n){Object.defineProperty(e.langText,n,{get:function(){var i=e.lang,r=e.i18n;return r[n]?r[n]:t[n]&&t[n][i]||""}})})}(this.registerLanguageTexts()||{},this);var i="";try{i=this.render()}catch(t){throw v.logError("Plugin:".concat(this.pluginName,":render"),t),Error("Plugin:".concat(this.pluginName,":render:").concat(t.message))}if(i)(n=s.insert(i,e,t.index)).setAttribute("data-index",t.index);else{if(!t.tag)return;(n=_.createDom(t.tag,"",t.attr,t.name)).setAttribute("data-index",t.index),e.appendChild(n)}this.root=n,this.parent=e;var r=this.config.attr||{},o=this.config.style||{};this.setAttr(r),this.setStyle(o),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var t=this;if(!!this.root){this._children=[];var e=this.children();e&&"object"===ej(e)&&Object.keys(e).length>0&&Object.keys(e).map(function(n){var i,r,o=e[n],a={root:t.root};"function"==typeof o?(i=t.config[n]||{},r=o):"object"===ej(o)&&"function"==typeof o.plugin&&(i=o.options?_.deepCopy(t.config[n]||{},o.options):t.config[n]||{},r=o.plugin),a.config=i,void 0!==i.index&&(a.index=i.index),i.root&&(a.root=i.root),t.registerPlugin(r,a,n)})}}},{key:"updateLang",value:function(t){!t&&(t=this.lang);var e=this.root,n=this.i18n,i=this.langText;e&&!function t(e,n){for(var i=0;i0?t(e.children[i],n):n(e.children[i])}(e,function(e){var r=e.getAttribute&&e.getAttribute("lang-key");if(!!r){var o=n[r.toUpperCase()]||i[r];o&&(e.innerHTML="function"==typeof o?o(t):o)}})}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this.i18n||{},i=this.langText;t.setAttribute&&t.setAttribute("lang-key",e);var r=n[e]||i[e]||"";r&&(t.innerHTML=r)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,_.addClass(this.find(".xgplayer-icon"),eL)}},{key:"enable",value:function(){this.config.disable=!1,_.removeClass(this.find(".xgplayer-icon"),eL)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.root=e.root||this.root;var i=eE(ex(s.prototype),"registerPlugin",this).call(this,t,e,n);return this._children.push(i),i}},{key:"unregisterPlugin",value:function(t){if(this._children instanceof Array){var e=function(t,e){if(t instanceof Array){for(var n=0;n-1&&this._children.splice(e,1)}}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(t){if(!!this.root)return this.root.querySelector(t)}},{key:"bind",value:function(t,e,n){var i=this;if(arguments.length<3&&"function"==typeof e)Array.isArray(t)?t.forEach(function(t){i.bindEL(t,e)}):this.bindEL(t,e);else{var r=s.delegate.call(this,this.root,t,e,n);this.__delegates=this.__delegates.concat(r)}}},{key:"unbind",value:function(t,e){var n=this;if(arguments.length<3&&"function"==typeof e)Array.isArray(t)?t.forEach(function(t){n.unbindEL(t,e)}):this.unbindEL(t,e);else{for(var i="".concat(t,"_").concat(e),r=0;r2&&void 0!==arguments[2]&&arguments[2];if(!!this.root)"on".concat(t) in this.root&&"function"==typeof e&&this.root.addEventListener(t,e,n)}},{key:"unbindEL",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!!this.root)"on".concat(t) in this.root&&"function"==typeof e&&this.root.removeEventListener(t,e,n)}},{key:"show",value:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!!this.root){if(this.root.style.display=void 0!==t?t:"block",e&&"none"===window.getComputedStyle(this.root,null).getPropertyValue("display"))return this.root.style.display="block"}}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(t,e){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!e||!(e instanceof window.Element))return null;try{if("string"==typeof t)return this.find(t).appendChild(e);return t.appendChild(e)}catch(t){return v.logError("Plugin:appendChild",t),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var t=this,e=this.player;this.__delegates.map(function(t){t.destroy()}),this.__delegates=[],this._children instanceof Array&&(this._children.forEach(function(t){e.unRegisterPlugin(t.pluginName)}),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),eE(ex(s.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map(function(e){t[e]=null})}}],o=[{key:"insert",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e.children.length,r=Number(n),o=t instanceof window.Node;if(!i)return o?e.appendChild(t):e.insertAdjacentHTML("beforeend",t),e.children[e.children.length-1];for(var a=0,s=null,u="";a=r){u="beforebegin";break}c4&&void 0!==arguments[4]&&arguments[4],o=[];if(t instanceof window.Node&&"function"==typeof i){if(Array.isArray(n))n.forEach(function(n){var a=eO()(t,e,n,i,r);a.key="".concat(e,"_").concat(n),o.push(a)});else{var a=eO()(t,e,n,i,r);a.key="".concat(e,"_").concat(n),o.push(a)}}return o}},{key:"ROOT_TYPES",get:function(){return eR}},{key:"POSITIONS",get:function(){return eA}}],r&&eT(i.prototype,r),o&&eT(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eS);function eM(t){return(eM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function eB(t,e){for(var n=0;n=e||n<0||f&&i>=o}function g(){var t,n,i,r,a=Date.now();if(v(a))return m(a);s=y(g,(n=(t=a)-u,i=t-c,r=e-n,f?Math.min(r,o-i):r))}function m(t){return(s=void 0,h&&i)?d(t):(i=r=void 0,a)}function b(){for(var t,n=Date.now(),o=v(n),h=arguments.length,p=Array(h),m=0;m-1?this.__handlers[r].handler=e:this.__handlers.push({target:t,handler:e,playerId:n})}}},{key:"unObserver",value:function(t){var e=-1;this.__handlers.map(function(n,i){t===n.target&&(e=i)});try{this.observer&&this.observer.unobserve(t)}catch(t){}this.observer&&this.observer.unobserve(t),e>-1&&this.__handlers.splice(e,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(t){for(var e=this.__handlers,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(!t||!e||"function"!=typeof e||void 0===e.prototype)return;var i=t._pluginInfoId;if(!i||!this.pluginGroup[i])return;!this.pluginGroup[i]._plugins&&(this.pluginGroup[i]._plugins={});var r=this.pluginGroup[i]._plugins,o=this.pluginGroup[i]._originalOptions;n.player=t;var a=n.pluginName||e.pluginName;if(!a)throw Error("The property pluginName is necessary");if(!e.isSupported||!!e.isSupported()){!n.config&&(n.config={});for(var s=Object.keys(o),u=0;ut.length)&&(e=t.length);for(var n=0,i=Array(e);n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(!!this.root){var i=t.defaultConfig||{};if(!e.root){switch(e.position?e.position:e.config&&e.config.position?e.config.position:i.position){case eA.CONTROLS_LEFT:e.root=this.left;break;case eA.CONTROLS_RIGHT:e.root=this.right;break;case eA.CONTROLS_CENTER:e.root=this.center;break;case eA.CONTROLS:e.root=this.root;break;default:e.root=this.left}return eJ(eQ(s.prototype),"registerPlugin",this).call(this,t,e,n)}}}},{key:"destroy",value:function(){"mobile"!==t$.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.player&&this.player.config&&this.player.config.enableMemLeakFix&&(this.left=null,this.center=null,this.right=null,this.innerRoot=null)}},{key:"render",value:function(){var t=this.config,e=t.mode,n=t.autoHide,i=t.initShow;if(!t.disable){var r=_.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===e},{"bottom-controls":"bottom"===e},{control_autohide:n},{controls_permanent:!n},{"xgplayer-controls-initshow":i||!n});return'\n \n \n \n \n \n \n \n ')}}}],eq(i.prototype,r),o&&eq(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function e3(t){return function(t){if(Array.isArray(t))return e4(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return e4(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e4(t,e)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e4(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n1&&void 0!==arguments[1]&&arguments[1];for(var n in no)if(Object.prototype.hasOwnProperty.call(no,n)){var i=no[n];if(e){if(t(i))break}else t(i)}}},{key:"forEach",value:function(t){this._iterate(t)}},{key:"find",value:function(t){var e=null;return this._iterate(function(n){var i=t(n);return i&&(e=n),i},!0),e}},{key:"findAll",value:function(t){var e=[];return this._iterate(function(n){t(n)&&e.push(n)}),e}},{key:"setActive",value:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!!no[t]){if(e){var n=!1;this.forEach(function(e){t===e.playerId?(!e.isUserActive&&(n=!0),e.isUserActive=!0,e.isInstNext=!1):e.isUserActive=!1}),n&&this.emit("activeChanged")}else no[t].isUserActive=e;return t}}},{key:"getActiveId",value:function(){for(var t=Object.keys(no),e=0;e1)||void 0===arguments[1]||arguments[1];if(!!no[t])return e?this.forEach(function(e){t===e.playerId?(e.isUserActive=!1,e.isInstNext=!0):e.isInstNext=!1}):no[t].isInstNext=e,t}}],o=[{key:"getInstance",value:function(){return na||(na=new s),na}}],r&&nn(i.prototype,r),o&&nn(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(l.EventEmitter);function nu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function nc(t){for(var e=1;en.duration?n.duration:i,n.config.startTime=0),n.playbackRate=r,e&&n.videoPlay(),n.off(M,n.canPlayFunc),n.removeClass(eV.ENTER)}}),ng(ny(n),"onFullscreenChange",function(t,e){var i=function(){_.setTimeout(ny(n),function(){n.getVideoSize()},100)},r=_.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(tT,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var o=function(t,e,n){if(!!t){var i=t.getAttribute(n);return!!i&&i===e&&("VIDEO"===t.tagName||"AUDIO"===t.tagName)||!1}}(r,n.playerId,ei);if(e||r&&(r===n._fullscreenEl||o))i(),n.config.closeFocusVideoFocus||n.video.focus(),n.fullscreen=!0,n.emit(tf,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){i();var a=ny(n),s=a._fullScreenOffset;a.config.needFullscreenScroll?(window.scrollTo(s.left,s.top),_.setTimeout(ny(n),function(){n.fullscreen=!1,n._fullScreenOffset=null},100)):(n.config.closeFocusVideoFocus||n.video.focus(),n.fullscreen=!1,n._fullScreenOffset=null),n.cssfullscreen?n.removeClass(eV.FULLSCREEN):n.recoverFullStyle(n.root,n._fullscreenEl,eV.FULLSCREEN),n._fullscreenEl=null,n.emit(tf,!1)}}),ng(ny(n),"_onWebkitbeginfullscreen",function(t){n._fullscreenEl=n.video,n.onFullscreenChange(t,!0)}),ng(ny(n),"_onWebkitendfullscreen",function(t){n.onFullscreenChange(t,!1)}),ed(ny(n),nb),n.config=i,n._pluginInfoId=_.generateSessionId(),(e=ny(n)).logInfo=v.logInfo.bind(e),e.logWarn=v.logWarn.bind(e),e.logError=v.logError.bind(e);var r=n.constructor.defaultPreset;if(n.config.presets.length){var o=n.config.presets.indexOf("default");o>=0&&r&&(n.config.presets[o]=r)}else r&&n.config.presets.push(r);return(n.userTimer=null,n.waitTimer=null,n.isReady=!1,n.isPlaying=!1,n.isError=!1,n.isSeeking=!1,n.isCanplay=!1,n._runPending=!1,n.rotateDeg=0,n.isActive=!1,n.isBufferControlPaused=!1,n.isCssfullScreen=!1,n.fullscreen=!1,n._fullscreenEl=null,n._cssfullscreenEl=null,n.curDefinition=null,n._orgCss="",n._fullScreenOffset=null,n._videoHeight=0,n._videoWidth=0,n.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},n.sizeInfo={width:0,height:0,left:0,top:0},n._accPlayed={t:0,acc:0,loopAcc:0},n.innerContainer=null,n.controls=null,n.topBar=null,n.topBar=null,n.root=null,n.__i18n=e7.init(),t$.os.isAndroid&&t$.osVersion>0&&t$.osVersion<6&&(n.config.autoplay=!1),n.database=new t7,n.isUserActive=!1,n._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=n_,n._initDOM())?(n._bindEvents(),n._registerPresets(),n._registerPlugins(),eW.onPluginsReady(ny(n)),_.setTimeout(ny(n),function(){n.emit(Q),n.onReady&&n.onReady(),n.isReady=!0},0),n.getInitDefinition(),n.syncFullstate(),(n.config.videoInit||n.config.autoplay)&&!n.hasStart&&n.start(),n):nd(n)}return i=s,r=[{key:"_initDOM",value:function(){var t,e=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var n=this.config.el;if(!n||1!==n.nodeType)return this.emit(A,new E("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),!1;this.root=n}var i=function(t){for(var e=Object.keys(no),n=0;n0?this._attachSourceEvents(this.video,t):this.video.src&&this.video.src===t?!t&&this.video.removeAttribute("src"):this.video.src=t,"Number"===_.typeOf(this.config.volume)&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;this.video instanceof window.Element&&!n.contains(this.video)&&n.insertBefore(this.video,n.firstChild);var i=this.video.readyState;v.logInfo("_startInit readyState",i),this.config.autoplay&&(_.isMSE(this.video)||this.load(),(t$.os.isIpad||t$.os.isPhone)&&this.videoPlay()),i>=2?this.canPlayFunc():this.once(M,this.canPlayFunc),_.setTimeout(this,function(){e.isComplete=!0,e.emit(ti)},1),!this.hasStart&&eW.afterInit(this),this.hasStart=!0}}},{key:"_registerPlugins",value:function(){var t=this,e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this._loadingPlugins=[];var n=this.config.ignores||[],i=this.config.plugins||[],r=this.config.i18n||[];e&&e7.extend(r,this.__i18n);var o=n.join("||").toLowerCase().split("||"),a=this.plugins;i.forEach(function(n){try{var i=n.plugin?n.plugin.pluginName:n.pluginName;if(!i)return;var r=i.toLowerCase(),s=t.config[r]||t.config[i];if("Boolean"===_.typeOf(s)&&!s||o.indexOf(r)>-1||!e&&a[r])return;if(n.lazy&&n.loader){var u=eW.lazyRegister(t,n);n.forceBeforeInit&&(u.then(function(){t._loadingPlugins.splice(t._loadingPlugins.indexOf(u),1)}).catch(function(e){v.logError("_registerPlugins:loadingPlugin",e),t._loadingPlugins.splice(t._loadingPlugins.indexOf(u),1)}),t._loadingPlugins.push(u));return}return t.registerPlugin(n)}catch(t){v.logError("_registerPlugins:",t)}})}},{key:"_registerPresets",value:function(){var t=this;this.config.presets.forEach(function(e){eY(t,e)})}},{key:"_getRootByPosition",value:function(t){var e=null;switch(t){case eA.ROOT_RIGHT:e=this.rightBar;break;case eA.ROOT_LEFT:e=this.leftBar;break;case eA.ROOT_TOP:e=this.topBar;break;default:e=this.innerContainer||this.root}return e}},{key:"registerPlugin",value:function(t,e){var n=eW.formatPluginInfo(t,e),i=n.PLUFGIN,r=n.options,o=this.config.plugins;eW.checkPluginIfExits(i.pluginName,o)||o.push(i);var a=eW.getRootByConfig(i.pluginName,this.config);a.root&&(r.root=a.root),a.position&&(r.position=a.position);var s=r.position?r.position:r.config&&r.config.position||i.defaultConfig&&i.defaultConfig.position;return!r.root&&"string"==typeof s&&s.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(i,r,i.pluginName):(!r.root&&(r.root=this._getRootByPosition(s)),eW.register(this,i,r))}},{key:"deregister",value:function(t){var e,n,i=eW.unRegister(this,"string"==typeof t?t:t.pluginName);i&&null!==(e=this.config)&&void 0!==e&&e.unregisterPluginFromControls&&(null===(n=this.controls)||void 0===n||n.unregisterPlugin(i))}},{key:"unRegisterPlugin",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!!t)this.deregister(t),e&&this.removePluginFromConfig(t)}},{key:"removePluginFromConfig",value:function(t){var e;if("string"==typeof t?e=t:t instanceof eS&&(e=t.pluginName),!!e){for(var n=this.config.plugins.length-1;n>-1;n--)if(this.config.plugins[n].pluginName.toLowerCase()===e.toLowerCase()){this.config.plugins.splice(n,1);break}}}},{key:"plugins",get:function(){return eW.getPlugins(this)}},{key:"getPlugin",value:function(t){var e=eW.findPlugin(this,t);return e&&e.pluginName?e:null}},{key:"addClass",value:function(t){if(!!this.root)!_.hasClass(this.root,t)&&_.addClass(this.root,t)}},{key:"removeClass",value:function(t){if(!!this.root)_.removeClass(this.root,t)}},{key:"hasClass",value:function(t){if(!!this.root)return _.hasClass(this.root,t)}},{key:"setAttribute",value:function(t,e){if(!!this.root)this.root.setAttribute(t,e)}},{key:"removeAttribute",value:function(t,e){if(!!this.root)this.root.removeAttribute(t,e)}},{key:"start",value:function(t){var e=this;if(!this.hasStart)return!t&&!this.config.url&&this.getInitDefinition(),this.hasStart=!0,this._registerPlugins(!1),eW.beforeInit(this).then(function(){if(!!e.config){!t&&(t=e.url||e.config.url);var n=e.preProcessUrl(t);return e._startInit(n.url)}}).catch(function(t){throw t.fileName="player",t.lineNumber="236",v.logError("start:beforeInit:",t),t})}},{key:"switchURL",value:function(t){var e=this;arguments.length>1&&void 0!==arguments[1]&&arguments[1];var n=t;"Object"===_.typeOf(t)&&(n=t.url);var i=this.currentTime,r=this.paused&&!this.isError;return this.src=n,new Promise(function(t){var n=function(){e.currentTime=i,r&&e.once("canplay",function(){e.pause()}),t()};t$.os.isAndroid?e.once("timeupdate",function(){n()}):e.once("canplay",function(){n()}),e.play()})}},{key:"videoPlay",value:function(){var t=this;if(!this.hasStart){this.removeClass(eV.NO_START),this.addClass(eV.ENTER);var e=this.start();e&&e.then(function(e){t.config.autoplay||t.videoPlay()});return}!this.isPlaying&&(this.removeClass(eV.NO_START),this.isCanplay||this.addClass(eV.ENTER));var n=nh(nv(s.prototype),"play",this).call(this);return void 0!==n&&n&&n.then?n.then(function(){t.removeClass(eV.NOT_ALLOW_AUTOPLAY),t.addClass(eV.PLAYING),!t.isPlaying&&(v.logInfo(">>>>playPromise.then"),t.isPlaying=!0,t.emit(te))}).catch(function(e){if(v.logWarn(">>>>playPromise.catch",e.name),t.video&&t.video.error){t.onError(),t.removeClass(eV.ENTER);return}"NotAllowedError"===e.name&&(t._errorTimer=_.setTimeout(t,function(){t._errorTimer=null,t.emit(tn),t.addClass(eV.NOT_ALLOW_AUTOPLAY),t.removeClass(eV.ENTER),t.pause()},0)),"AbortError"===e.name&&(t._errorTimer=_.setTimeout(t,function(){t._errorTimer=null,t.emit(tc)},0))}):(v.logWarn("video.play not return promise"),!this.isPlaying&&(this.isPlaying=!0,this.removeClass(eV.NOT_ALLOW_AUTOPLAY),this.removeClass(eV.NO_START),this.removeClass(eV.ENTER),this.addClass(eV.PLAYING),this.emit(te))),n}},{key:"videoPause",value:function(){nh(nv(s.prototype),"pause",this).call(this)}},{key:"play",value:function(){var t=this;this.removeClass(eV.PAUSED),ev(this,"play",function(){t.videoPlay()})}},{key:"pause",value:function(t){var e=this;ev(this,"pause",function(){t===er.BUFFER_CONTROLS?!e.isBufferControlPaused&&(e.isBufferControlPaused=!0,e.emit(tu,{type:eo.WAITING})):e.isBufferControlPaused&&(e.isBufferControlPaused=!1,e.emit(tu,{type:eo.PLAYING})),nh(nv(s.prototype),"pause",e).call(e)},t)}},{key:"seek",value:function(t,e){var n=this;if(!(!this.video||Number.isNaN(Number(t)))&&!!this.hasStart){var i=this.config,r=i.isSeekedPlay,o=i.seekedStatus,a=e||(r?"play":o);t=t<0?0:t>this.duration?parseInt(this.duration,10):t,this._isPauseBeforeSeek||(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(I,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(n.removeClass(eV.ENTER),n.isSeeking=!1,a){case"play":n.play();break;case"pause":n.pause();break;default:n._isPauseBeforeSeek>1||n.paused?n.pause():n.play()}n._isPauseBeforeSeek=0,n._onceSeekCanplay=null},this.once(I,this._onceSeekCanplay),this.isPlaying?this.currentTime=t:(this.removeClass(eV.NO_START),this.currentTime=t,this.play())}}},{key:"getInitDefinition",value:function(){var t=this,e=this.config,n=e.definition;!e.url&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&n.list.map(function(e){e.definition===n.defaultDefinition&&(t.config.url=e.url,t.curDefinition=e.definition)})}},{key:"changeDefinition",value:function(t,e){var n=this,i=this.config.definition;if(Array.isArray(null==i?void 0:i.list)&&i.list.forEach(function(e){(null==t?void 0:t.definition)===e.definition&&(n.curDefinition=e)}),null!=t&&t.bitrate&&"number"!=typeof t.bitrate&&(t.bitrate=parseInt(t.bitrate,10)||0),this.emit(td,{from:e,to:t}),!this.hasStart){this.config.url=t.url;return}var r=this.switchURL(t.url);r&&r.then?r.then(function(){n.emit(tv,{from:e,to:t})}):this.emit(tv,{from:e,to:t})}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once("loadeddata",this.reloadFunc)}},{key:"resetState",value:function(){var t=this,e=eV.NOT_ALLOW_AUTOPLAY,n=eV.PLAYING,i=eV.NO_START,r=eV.PAUSED,o=eV.REPLAY,a=eV.ENTER,s=eV.ENDED,u=eV.ERROR,c=eV.LOADING;this.hasStart=!1,this.isError=!1,this.isPlaying=!1,this.videoPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,[e,n,i,r,o,a,s,u,c].forEach(function(e){t.removeClass(e)}),this.addClass(eV.ENTER),this.emit(tE)}},{key:"reset",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(this.resetState(),!!this.plugins){if(e.map(function(e){t.deregister(e)}),n){var i=eG();Object.keys(this.config).keys(function(e){"undefined"!==t.config[e]&&("plugins"===e||"presets"===e||"el"===e||"id"===e)&&(t.config[e]=i[e])})}}}},{key:"destroy",value:function(){var t,e,n=this,i=this.innerContainer,r=this.root,o=this.video;if(this.config&&this.config.enableMemLeakFix){if(this._destroyed)return;this._destroyed=!0;try{this._unbindEvents&&this._unbindEvents()}catch(t){}try{o&&this._detachSourceEvents(this.video)}catch(t){}try{_.clearAllTimers(this)}catch(t){}this.emit(to);try{null===(t=n_)||void 0===t||t.remove(this)}catch(t){}try{eW.destroy(this)}catch(t){}try{ey(this)}catch(t){}try{nh(nv(s.prototype),"destroy",this).call(this)}catch(t){}if(!r||!o)return;r.removeAttribute(ei),this.updateAcc("destroy")}else{if(!r||!o)return;r.removeAttribute(ei),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.video),_.clearAllTimers(this),this.emit(to),null===(e=n_)||void 0===e||e.remove(this),eW.destroy(this),ey(this),nh(nv(s.prototype),"destroy",this).call(this)}if(this.fullscreen&&this._fullscreenEl===this.root)try{this.exitFullscreen()}catch(t){}if(i){for(var a=i.children,u=0;u0?r.className=c.filter(function(t){return 0>t.indexOf("xgplayer")}).join(" "):r.className="",this.removeAttribute("data-xgfill"),["isReady","isPlaying","isSeeking","isCanplay","isActive","isCssfullScreen","fullscreen"].map(function(t){n[t]=!1})}},{key:"replay",value:function(){var t=this;this.removeClass(eV.ENDED),this.currentTime=0,this.isSeeking=!1,ev(this,"replay",function(){t.once(I,function(){var e=t.videoPlay();e&&e.catch&&e.catch(function(t){})}),t.play(),t.emit(tr),t.onPlay()})}},{key:"retry",value:function(){var t=this;this.removeClass(eV.ERROR),this.addClass(eV.LOADING),ev(this,"retry",function(){var e=t.currentTime;t.src=t.config.url,t.config.isLive||(t.currentTime=e),t.once(M,function(){t.videoPlay()})})}},{key:"syncFullstate",value:function(){var t=_.getFullScreenEl();t&&t===this.config.fullscreenTarget&&(this.fullscreen=!0,this._fullscreenEl=t,!this._orgPCss&&(this._orgPCss=_.filterStyleFromText(t)))}},{key:"changeFullStyle",value:function(t,e,n,i){if(!!t)!i&&(i=eV.PARENT_FULLSCREEN),!this._orgCss&&(this._orgCss=_.filterStyleFromText(t)),_.addClass(t,n),e&&e!==t&&!this._orgPCss&&(this._orgPCss=_.filterStyleFromText(e),_.addClass(e,i),e.setAttribute(ei,this.playerId))}},{key:"recoverFullStyle",value:function(t,e,n,i){!i&&(i=eV.PARENT_FULLSCREEN),this._orgCss&&(_.setStyleFromCsstext(t,this._orgCss),this._orgCss=""),_.removeClass(t,n),e&&e!==t&&this._orgPCss&&(_.setStyleFromCsstext(e,this._orgPCss),this._orgPCss="",_.removeClass(e,i),e.removeAttribute(ei))}},{key:"getFullscreen",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,n=this.root,i=this.video;if(!e&&(e=n),this._fullScreenOffset={top:_.scrollTop(),left:_.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",this.emit(tl),_.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.fullscreen&&this.exitFullscreen(),this._cssfullscreenEl=t,this.changeFullStyle(this.root,t,t?eV.INNER_FULLSCREEN:eV.CSS_FULLSCREEN),this.isCssfullScreen=!0,this.emit(th,!0)}},{key:"exitCssFullscreen",value:function(){var t=this._cssfullscreenEl?eV.INNER_FULLSCREEN:eV.CSS_FULLSCREEN;this.fullscreen?this.removeClass(t):this.recoverFullStyle(this.root,this._cssfullscreenEl,t),this._cssfullscreenEl=null,this.isCssfullScreen=!1,this.emit(th,!1)}},{key:"focus",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};if(this.isActive){this.onFocus(t);return}this.emit(Z,nc({paused:this.paused,ended:this.ended},t))}},{key:"blur",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};if(!this.isActive){this.onBlur(t);return}this.emit($,nc({paused:this.paused,ended:this.ended},t))}},{key:"onFocus",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!0,delay:3e3},n=this.innerStates;if(this.isActive=!0,this.removeClass(eV.ACTIVE),this.userTimer&&(_.clearTimeout(this,this.userTimer),this.userTimer=null),void 0!==e.isLock&&(n.isActiveLocked=e.isLock),!1===e.autoHide||!0===e.isLock||n.isActiveLocked){this.userTimer&&(_.clearTimeout(this,this.userTimer),this.userTimer=null);return}var i=e&&e.delay?e.delay:this.config.inactive;this.userTimer=_.setTimeout(this,function(){t.userTimer=null,t.blur()},i)}},{key:"onBlur",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};if(!!this.isActive&&!this.innerStates.isActiveLocked){var e=this.config.closePauseVideoFocus;this.isActive=!1,(t.ignorePaused||e||!this.paused&&!this.ended)&&this.addClass(eV.ACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.hasStart&&this.removeClass(eV.ENTER),this.isBufferControlPaused||this.removeClass(eV.LOADING),this.isCanplay=!0,this.waitTimer&&_.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){this.isError=!1}},{key:"onPlay",value:function(){this.removeClass(eV.PAUSED),this.ended&&this.removeClass(eV.ENDED),this.config.closePlayVideoFocus||this.focus()}},{key:"onPause",value:function(){this.isBufferControlPaused||this.addClass(eV.PAUSED),this.updateAcc("pause"),!this.config.closePauseVideoFocus&&(this.userTimer&&(_.clearTimeout(this,this.userTimer),this.userTimer=null),this.focus())}},{key:"onEnded",value:function(){this.isBufferControlPaused=!1,this.updateAcc("ended"),this.addClass(eV.ENDED)}},{key:"onError",value:function(){this.isBufferControlPaused=!1,this.isError=!0,this.updateAcc("error"),this.removeClass(eV.NOT_ALLOW_AUTOPLAY),this.removeClass(eV.NO_START),this.removeClass(eV.ENTER),this.removeClass(eV.LOADING),this.addClass(eV.ERROR)}},{key:"onSeeking",value:function(){!this.isSeeking&&this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(eV.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&_.clearTimeout(this,this.waitTimer),this.removeClass(eV.LOADING),this.removeClass(eV.SEEKING)}},{key:"onWaiting",value:function(){var t=this;this.waitTimer&&_.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=_.setTimeout(this,function(){t.addClass(eV.LOADING),_.clearTimeout(t,t.waitTimer),t.waitTimer=null},200)}},{key:"onPlaying",value:function(){var t=this;this.isError=!1;var e=eV.NO_START,n=eV.PAUSED,i=eV.ENDED,r=eV.ERROR,o=eV.REPLAY,a=eV.LOADING;[e,n,i,r,o,a].forEach(function(e){t.removeClass(e)})}},{key:"onTimeupdate",value:function(){this._videoHeight||this.getVideoSize(),(this.waitTimer||this.hasClass(eV.LOADING))&&this.video.readyState>2&&(this.isBufferControlPaused||this.removeClass(eV.LOADING),_.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&!this.isPlaying&&this.duration&&(this.isPlaying=!0,this.emit(te)),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onVolumechange",value:function(){"Number"===_.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"onBufferControl",value:function(t){if(!!this.isPlaying)"waiting"===t.type?(this.isBufferControlPaused=!0,this.addClass(eV.LOADING),this.removeClass(eV.PAUSED)):"playing"===t.type&&(this.isBufferControlPaused=!1,this.removeClass(eV.LOADING),this.paused&&this.addClass(eV.PAUSED))}},{key:"emitUserAction",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!!this.video&&!!e&&!!t){var i="String"===_.typeOf(t)?t:t.type||"";"switch_play_pause"===e&&("Undefined"===_.typeOf(n.paused)&&(n.paused=this.paused),n.isFirstStart=!this.playing),this.emit(tT,nc({eventType:i,action:e,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:t},n))}}},{key:"updateAcc",value:function(t){if(this._accPlayed.t){var e=new Date().getTime(),n=e-this._accPlayed.t;if(!(n<0))this._accPlayed.acc+=n,this._accPlayed.t="get"===t?e:0,("ended"===t||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(t){var e=this.video.buffered;if(!e||0===e.length||!this.duration)return!0;for(var n=parseInt(1e3*(t||this.video.currentTime||0),10),i=e.length,r=0;rn)return!0;return!1}},{key:"resizePosition",value:function(){var t=this.videoPos,e=t.rotate,n=t.vy,i=t.vx,r=t.h,o=t.w;if(e<0&&r<0&&o<0)return;var a=this.videoPos._pi;if(!a&&this.video.videoHeight&&(a=this.video.videoWidth/this.video.videoHeight*100),!!a){this.videoPos.pi=a;var s={},u=0,c=0,l=1,f=e<0?0:Math.abs(e/90),h=this.root,p=this.innerContainer,d=h.offsetWidth,y=p?p.offsetHeight:h.offsetHeight,v=y,g=d,m={width:d,height:y};if(f%2==0)l=r>0?100/r:o>0?100/o:1,s.scale=l,u=n>0?(100-r)/2-n:0,s.y=2===f?0-u:u,c=i>0?(100-o)/2-i:0,s.x=2===f?0-c:c,m.width=g,m.height=v;else if(f%2==1){g=y,v=d;var b=y-d;c=-b/2/g*100,s.x=3===f?c+n/2:c-n/2,u=b/2/v*100,s.y=3===f?u+i/2:u-i/2,s.scale=l,m.width=g,m.height=v}var w=this.video;e>=0&&["width","height"].forEach(function(t){w.style[t]="".concat(m[t],"px")}),s.rotate=e<0?0:e;var k=_.getTransformStyle(s,this.video.style.transform||this.video.style.webkitTransform);w.style.transform=k,w.style.webkitTransform=k}}},{key:"position",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};if(!!this.video&&!!t&&!!t.h){var e=this.videoPos;e.h=100*t.h||0,e.w=100*t.w||0,e.vx=100*t.x||0,e.vy=100*t.y||0,this.resizePosition()}}},{key:"setConfig",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{deepMerge:!1};if(!!t)Object.keys(t).map(function(i){if("plugins"!==i){n.deepMerge&&"Object"===_.typeOf(e.config[i])?_.deepMerge(e.config[i],t[i]):e.config[i]=t[i];var r=e.plugins[i.toLowerCase()];r&&"Function"===_.typeOf(r.setConfig)&&r.setConfig(t[i],n)}})}},{key:"playNext",value:function(t){var e=this;this.resetState(),this._currentTime=0,this._duration=0,this.isPlaying=!1,this.setConfig(t),this.vtype="MP4",ev(this,"playnext",function(){e.start(),e.emit(tS,t)})}},{key:"getVideoSize",value:function(){var t=this;if(!this.video)return;var e=this.root.getBoundingClientRect();this.sizeInfo.width=e.width,this.sizeInfo.height=e.height,this.sizeInfo.left=e.left,this.sizeInfo.top=e.top;var n=this.video,i=n.videoWidth,r=n.videoHeight,o=this.config,a=o.fitVideoSize,s=o.videoFillMode;if(("fill"===s||"cover"===s||"contain"===s)&&this.setAttribute("data-xgfill",s),!!r&&!!i){this._videoHeight=r,this._videoWidth=i;var u=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,c=e.width,l=e.height-u,f=parseInt(i/r*1e3,10),h=parseInt(c/l*1e3,10),p=c,d=l,y={};"auto"===a&&h>f||"fixWidth"===a?(d=c/f*1e3,this.config.fluid?y.paddingTop="".concat(100*d/p,"%"):y.height="".concat(d+u,"px")):("auto"===a&&hf)&&this.setAttribute("data-xgfill","cover");var v={videoScale:f,vWidth:p,vHeight:d,cWidth:p,cHeight:d+u};this.resizePosition(),this.emit(tb,v)}}},{key:"updateObjectPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this.video.updateObjectPosition){this.video.updateObjectPosition(t,e);return}this.video.style.objectPosition="".concat(100*t,"% ").concat(100*e,"%")}},{key:"preProcessUrl",value:function(t,e){var n=this.config,i=n.preProcessUrl,r=Object.assign({},n.preProcessUrlOptions,e);return _.isBlob(t)||"function"!=typeof i?{url:t}:i(t,r)}},{key:"src",get:function(){return this.video?this.video.src:""},set:function(t){if(!!this.video){if(this.emit(ta,t),this.emit(N),this._currentTime=0,this._duration=0,_.isMSE(this.video)){this.onWaiting();return}t=this.preProcessUrl(t).url,this._detachSourceEvents(this.video),"Array"===_.typeOf(t)?this._attachSourceEvents(this.video,t):t?this.video.src=t:this.video.removeAttribute("src"),this.load()}}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(t){var e=this,n=this.config.definition;n.list=t,this.emit("resourceReady",t);var i=null,r=null;t.map(function(t){e.curDefinition===t.definition&&(i=t),n.defaultDefinition===t.definition&&(r=t)}),!r&&t.length>0&&(r=t[0]),i?this.changeDefinition(i):r&&this.changeDefinition(r)}},{key:"videoFrameInfo",get:function(){var t={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.video||!this.video.getVideoPlaybackQuality)return t;var e=this.video.getVideoPlaybackQuality();return t.dropped=e.droppedVideoFrames||0,t.total=e.totalVideoFrames||0,t.corrupted=e.corruptedVideoFrames||0,t.total>0&&(t.droppedRate=t.dropped/t.total*100,t.droppedDuration=parseInt(this.cumulateTime/t.total*t.dropped,0)),t}},{key:"lang",get:function(){return this.config.lang},set:function(t){if(0!==e7.langKeys.filter(function(e){return e===t}).length||"zh"===t)this.config.lang=t,eW.setLang(t,this)}},{key:"i18n",get:function(){var t=this.config.lang;return"zh"===t&&(t="zh-cn"),this.__i18n.lang[t]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return h}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(t){this.__url=t}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(t){this.plugins.poster&&this.plugins.poster.update(t)}},{key:"readyState",get:function(){var t=nh(nv(s.prototype),"readyState",this);return this.i18n[t]||t}},{key:"error",get:function(){var t=nh(nv(s.prototype),"error",this);return this.i18n[t]||t}},{key:"networkState",get:function(){var t=nh(nv(s.prototype),"networkState",this);return this.i18n[t]||t}},{key:"fullscreenChanging",get:function(){return null!==this._fullScreenOffset}},{key:"cumulateTime",get:function(){var t=this._accPlayed;return this.updateAcc("get"),t.acc}},{key:"zoom",get:function(){return this.config.zoom},set:function(t){this.config.zoom=t}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(t){if((t=_.convertDeg(t))%90==0&&t!==this.videoPos.rotate)this.videoPos.rotate=t,this.resizePosition()}},{key:"avgSpeed",get:function(){return nk},set:function(t){nk=t}},{key:"realTimeSpeed",get:function(){return nw},set:function(t){nw=t}},{key:"hook",value:function(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],eu.call.apply(eu,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(t,e){return ec.call.apply(ec,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(t,e){return ef.call.apply(ef,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(t,e,n){for(var i=arguments.length,r=Array(i>3?i-3:0),o=3;o3?i-3:0),o=3;o0?parseInt(1e3*e.end(0),10):0,n.startType="onplay")}),nR(nx(t),"_onAutoplayStart",function(){v.logInfo(nD,"_onAutoplayStart"),t._state.autoplayStart=!0,t.vt&&t._sendFF("onAutoplayStart")}),nR(nx(t),"_onReset",function(){t._state={time:0,autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1,isLoadStartDelay:!1},t.vt=0,t.pt=0,t.fvt=0,t.newPointTime=nL(),t.loadedCostTime=0,t.startCostTime=0,t.seekingStart=0,t.seekData={startTime:0,lastTime:0,timeBefore:0,timeAfter:0,inBuffer:0,diffStart:0,interval:-1},t.waitData={startTime:0,lastTime:0,interval:-1,diffStart:0},t.waitingStart=0,t.fixedWaitingStart=0,t.ffsendTime=0,t.levelInfo={diff:0,buffer:-1,startBuffer:-1,startType:""},t._isWaiting=!1,t._waitTimer&&_.clearTimeout(nx(t),t._waitTimer),t._waittTimer&&_.clearTimeout(nx(t),t._waittTimer),t._waitTimer=null,t._waittTimer=null,t._waitType=0}),nR(nx(t),"_onSeeking",function(){var e=nx(t),n=e.seekData,i=e._state;if(!n.startTime){var r=t.player,o=r.buffered,a=r.currentTime;n.startTime=nL(),n.timeBefore=i.time,n.timeAfter=a;var s=_.getBufferByCurrentTime(o,a);v.logInfo(nD,"onSeeking",a,s),n.inBuffer=s.include,n.diffStart=1e3*s.diff,n.lastTime>0?n.interval=n.startTime-n.lastTime:n.interval=-1,v.logInfo(nD,"onSeeking",n),t.suspendWaitingStatus("seek");var u=t._getSeekInfo();t.emitLog(nI.SEEK_START,nT({start:nL()},u))}}),nR(nx(t),"_onSeeked",function(){v.logInfo(nD,"onSeeked"),t.suspendSeekingStatus("seeked")}),nR(nx(t),"_onWaiting",function(){if(!t._isWaiting&&!!t.vt){t._isWaiting=!0;var e=nx(t),n=e.waitData,i=e.seekData;e._state.isTimeUpdate||0!==i.startTime?i.startTime?t._waitType=2:t._waitType=0:t._waitType=1,t.fixedWaitingStart=nL(),v.logInfo(nD,"_onWaiting"),n.lastTime>0?n.interval=t.fixedWaitingStart-n.lastTime:n.interval=-1;var r=t.player,o=r.buffered,a=r.currentTime,s=_.getBufferByCurrentTime(o,a);n.diffStart=1e3*s.diff,t._waitTimer=_.setTimeout(nx(t),function(){v.logInfo(nD,"_onWaiting real");var e=nx(t).waitData;t._isWaiting?(t.waitingStart=nL(),_.clearTimeout(nx(t),t._waitTimer),e.lastTime=t.fixedWaitingStart,t._waitTimer=null,t._startWaitTimeout(),t.emitLog(nI.WAIT_START,{fixedStart:t.fixedWaitingStart,start:t.waitingStart,type:t._waitType,endType:2===t._waitType?"seek":"playing",diffStart:e.diffStart,interval:e.interval})):(e.interval=-1,e.diffStart=0)},200)}}),nR(nx(t),"_onError",function(){t.suspendSeekingStatus("error"),t.suspendWaitingStatus("error")}),nR(nx(t),"_onWaitingTimeout",function(e){t.suspendWaitingStatus(e||"timeout"),_.clearTimeout(nx(t),t._waittTimer),t._waittTimer=null}),nR(nx(t),"_onProgress",function(){v.logInfo(nD,"_onProgress")}),nR(nx(t),"_onPlaying",function(){v.logInfo(nD,"_onPlaying"),t._isWaiting&&t.suspendWaitingStatus("playing")}),t}return i=s,o=[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}],r=[{key:"afterCreate",value:function(){var t=this;this._onReset(),this._waitType=-1,this._initOnceEvents(),this.newPointTime=nL(),this.loadedCostTime=0,this.startCostTime=0,this.ffsendTime=0,this.on(W,this._onLoadedMetaData),this.on(z,this._onLoadStart),this.on(U,this._onLoadedData),this.on(L,this._onSeeking),this.on(I,this._onSeeked),this.on(to,function(){t.endState("destroy")}),this.on(j,function(){t.endState("ended")}),this.on(R,function(){t.endState("pause")}),this.on(C,this._onPlay),this.on(ta,function(){t.endState("urlChange"),v.logInfo(nD,"URL_CHANGE"),t._state.isFFSend&&t._onReset()}),this.on([x,M],this._onPlaying),this.on(N,this._onWaiting),this.on(A,this._onError),this.on(tE,function(){v.logInfo(nD,"RESET"),t.endState("reset"),t._initOnceEvents(),t._onReset();var e=t.levelInfo;t.playerConfig.autoplay&&(e.startType="onreset",e.startBuffer=0)})}},{key:"_initOnceEvents",value:function(){this.off(te,this._onAutoplayStart),this.off(D,this._onTimeupdate),this.once(te,this._onAutoplayStart),this.on(D,this._onTimeupdate)}},{key:"_sendFF",value:function(t){var e=this._state,n=e.isFFLoading,i=e.isFFSend;if(v.logInfo(nD,"_sendFF","".concat(t," fvt:").concat(this.fvt," isFFLoading:").concat(n," !isFFSend:").concat(!i)),this.vt>0&&n&&!i){this.ffsendTime=nL();var r,o=this.levelInfo,a=o.buffer,s=o.startBuffer,u=o.startType;v.logInfo(nD,"emitLog_firstFrame",t,"startBuffer:".concat(s," startType:").concat(u," buffer:").concat(a," ")),this._state.isFFLoading=!1,this._state.isFFSend=!0;var c=this.fvt+((null===(r=this.player)||void 0===r?void 0:r.beforeLoadStartCostTime)||0);this.emitLog(nI.FIRST_FRAME,{fvt:this.fvt,costTime:c,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime,buffer:a,startBuffer:s,endType:t})}}},{key:"_updateBuffer",value:function(){var t=this.player,e=t.buffered,n=t.currentTime,i=_.getBufferByCurrentTime(e,n);v.logInfo(nD,"_updateBuffer",i);var r=this.levelInfo;r.buffer=1e3*i.end,r.diff=1e3*i.diff}},{key:"_getSeekInfo",value:function(){var t=this.seekData;return{interval:t.interval,timeBefore:t.timeBefore,timeAfter:t.timeAfter,inBuffer:t.inBuffer,diffStart:t.diffStart}}},{key:"_startWaitTimeout",value:function(){this._waittTimer&&_.clearTimeout(this,this._waittTimer),this._waittTimer=_.setTimeout(this,this._onWaitingTimeout,this.config.waitTimeout)}},{key:"endState",value:function(t){var e=this.player,n=e.currentTime,i=e.duration,r=i-n,o=!(i>0&&n>0&&r<1);v.logInfo(nD,"endState:".concat(t," duration - currentTime:").concat(r," _emit:").concat(o)),this.suspendWaitingStatus(t,o),this.suspendSeekingStatus(t,o)}},{key:"suspendSeekingStatus",value:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.seekData;if(!!n.startTime){var i=nL(),r=i-n.startTime,o=this.player,a=o.buffered,s=o.currentTime,u=_.getBufferByCurrentTime(a,s);v.logInfo(nD,"suspendSeekingStatus",s,r),n.lastTime=n.startTime,n.startTime=0;var c=e?nI.SEEK_END:nI.SEEK_END_EXT,l=this._getSeekInfo();this.emitLog(c,nT(nT({end:i,costTime:r,endType:t},l),{},{diffEnd:1e3*u.diff}))}}},{key:"suspendWaitingStatus",value:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this._waitTimer&&(_.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(_.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,!!this.waitingStart){var n=this.waitData,i=nL(),r=i-this.waitingStart,o=i-this.fixedWaitingStart,a=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0;var s=this.player,u=s.buffered,c=s.currentTime,l=_.getBufferByCurrentTime(u,c),f=e?nI.WAIT_END:nI.WAIT_END_EXT;this.emitLog(f,{fixedCostTime:o>a?a:o,costTime:r>a?a:r,type:"loadeddata"===t?1:this._waitType,endType:2===this._waitType?"seek":t,diffStart:n.diffStart,diffEnd:1e3*l.diff,interval:n.interval})}}},{key:"emitLog",value:function(t,e){var n=this.player,i=n.video,r=i.readyState,o=i.networkState;this.emit(tO,nT({t:nL(),host:_.getHostFromUrl(n.currentSrc),vtype:n.vtype,eventType:t,currentTime:n.currentTime,readyState:r,networkState:o},e))}}],nE(i.prototype,r),o&&nE(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function nM(t){return(nM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nB(t,e){for(var n=0;n'}}},{key:"afterCreate",value:function(){var t=this;eN.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayHandler",function(){t.player.replay()},{pre:function(t){t.preventDefault(),t.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(j,function(){if(!t.playerConfig.loop&&_.addClass(t.player.root,"replay"),!t.config.disable){t.show();var e=t.root.querySelector("path");if(e){var n=window.getComputedStyle(e).getPropertyValue("transform");if("string"==typeof n&&n.indexOf("none")>-1)return null;e.setAttribute("transform",n)}}}),this.on(C,function(){t.hide()})}},{key:"handleReplay",value:function(t){t.preventDefault(),t.stopPropagation(),this.player.replay(),_.removeClass(this.player.root,"replay")}},{key:"show",value:function(){if(!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'\n ').concat(this.i18n.REPLAY,"\n ")}}],nB(i.prototype,r),o&&nB(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function nW(t){return(nW="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nV(t,e){for(var n=0;n\n ')}}],nV(i.prototype,r),o&&nV(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function nY(t){return(nY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nX(t,e){for(var n=0;n',class:"xg-icon-play"},startPause:{icon:'',class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild("xg-start-inner",t.startPlay),this.appendChild("xg-start-inner",t.startPause)}},{key:"hide",value:function(){_.addClass(this.root,"hide")}},{key:"show",value:function(){_.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){_.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){_.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(t){t?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(t){var e=this;!function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{start:null,end:null};n0[t]&&window.clearTimeout(n0[t].id),n0[t]={},n.start&&n.start(),n0[t].id=window.setTimeout(function(){n.end&&n.end(),window.clearTimeout(n0[t].id),delete n0[t]},e)}("pauseplay",400,{start:function(){_.addClass(e.root,"interact"),e.show(),e.switchStatus(!0)},end:function(){_.removeClass(e.root,"interact"),t||e.hide()}})}},{key:"switchPausePlay",value:function(t){var e=this.player;if(t.cancelable&&t.preventDefault(),t.stopPropagation(),!!e.isReady)!this.player.paused&&e.isPlaying?e.pause():e.play()}},{key:"onPlayPause",value:function(t){var e=this.config,n=this.player;if(!!n.isPlaying&&!!this.autoPlayStart&&("pause"!==t||this._lastState!==t&&!n.isBufferControlPaused)){if(this._lastState=t,"show"===e.mode){this.switchStatus(),this.show();return}if("auto"===e.mode){this.switchStatus();return}if(e.isShowPause&&n.paused&&!n.ended||e.isShowEnd&&n.ended){this.switchStatus(),this.show();return}if(e.disableAnimate){this.switchStatus(),this.hide();return}if("play"===t)this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||n.ended)return;this.animate()}}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),Object.keys(n0).map(function(t){window.clearTimeout(n0[t].id),delete n0[t]})}},{key:"render",value:function(){var t=this.playerConfig.autoplay?"auto"===this.config.mode?"auto-hide":"hide":"";return'\n \n \n ')}}],nX(i.prototype,r),o&&nX(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function n2(t){return(n2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n3(t,e){for(var n=0;n');e.innerHTML='
'.concat(n,"
")}return e}}],n3(i.prototype,r),o&&n3(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function n9(t){return(n9="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n8(t,e){for(var n=0;n\n
').concat(this.i18n[t],"
\n ")}}],o=[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:10}}}],r&&n8(i.prototype,r),o&&n8(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function ii(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return(!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,s),(e=a.call(this)).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=n.handle instanceof Element?n.handle:document.querySelector(n.handle),e._root&&e._handlerDom)?(e._bindStartEvent(),e):io(e)}return i=s,r=[{key:"_bindStartEvent",value:function(){var t=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),iy[this._startKey].map(function(e){t["on".concat(e)]=t["on".concat(e)].bind(t)})}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(t){var e=this;if(!!t){var n=iy[this._startKey];n.map(function(t){window.addEventListener(t,e["on".concat(t)])}),this._boundPointerEvents=n}}},{key:"_unbindPostStartEvents",value:function(){var t=this;if(!!this._boundPointerEvents)this._boundPointerEvents.map(function(e){window.removeEventListener(e,t["on".concat(e)])}),delete this._boundPointerEvents}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(t){this.onUp()}},{key:"animate",value:function(){var t=this;if(!!this.isDragging)this.positionDrag(),window.requestAnimationFrame(function(){t.animate()})}},{key:"positionDrag",value:function(){var t="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=t,this._root.style.webKitTransform=t}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(t){this.dragStart(t,t)}},{key:"onmousemove",value:function(t){this.dragMove(t,t)}},{key:"onmouseup",value:function(t){this.dragEnd(t,t)}},{key:"ontouchstart",value:function(t){var e=t.changedTouches[0];this.dragStart(t,e),this.touchIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,t.preventDefault()}},{key:"ontouchmove",value:function(t){var e=ip(t.changedTouches,this.touchIdentifier);e&&this.dragMove(t,e)}},{key:"ontouchend",value:function(t){var e=ip(t.changedTouches,this.touchIdentifier);e&&this.dragEnd(t,e),t.preventDefault()}},{key:"ontouchcancel",value:function(t){var e=ip(t.changedTouches,this.touchIdentifier);e&&this.dragCancel(t,e)}},{key:"dragStart",value:function(t,e){if(!!this._root&&!this.isDown&&!!this.isEnabled){this.downPoint=e,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var n=ih(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(t)}}},{key:"dragRealStart",value:function(t,e){this.isDragging=!0,this.animate(),this.emit(id.START,this.startPos)}},{key:"dragEnd",value:function(t,e){if(!!this._root)this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(id.ENDED)),this.presetInfo()}},{key:"_dragPointerMove",value:function(t,e){var n={x:e.pageX-this.downPoint.pageX,y:e.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(n)&&this.dragRealStart(t,e),n}},{key:"dragMove",value:function(t,e){if(t=t||window.event,!!this.isDown){var n=this.startPos,i=n.x,r=n.y,o=this._dragPointerMove(t,e),a=o.x,s=o.y;a=this.checkContain("x",a,i),s=this.checkContain("y",s,r),this.position.x=i+a,this.position.y=r+s,this.dragPoint.x=a,this.dragPoint.y=s,this.emit(id.MOVE,this.position)}}},{key:"dragCancel",value:function(t,e){this.dragEnd(t,e)}},{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(t){return Math.abs(t.x)>3||Math.abs(t.y)>3}},{key:"checkContain",value:function(t,e,n){return e+n<0?0-n:"x"===t&&e+n>this.startPos.maxX?this.startPos.maxX-n:"y"===t&&e+n>this.startPos.maxY?this.startPos.maxY-n:e}},{key:"_getPosition",value:function(){var t=window.getComputedStyle(this._root),e=this._getPositionCoord(t.left,"width"),n=this._getPositionCoord(t.top,"height");this.position.x=Number.isNaN(e)?0:e,this.position.y=Number.isNaN(n)?0:n,this._addTransformPosition(t)}},{key:"_addTransformPosition",value:function(t){var e=t.transform;if(0===e.indexOf("matrix")){var n=e.split(","),i=0===e.indexOf("matrix3d")?12:4,r=parseInt(n[i],10),o=parseInt(n[i+1],10);this.position.x+=r,this.position.y+=o}}},{key:"_getPositionCoord",value:function(t,e){if(-1!==t.indexOf("%")){var n=ih(this._root.parentNode);return n?parseFloat(t)/100*n[e]:0}return parseInt(t,10)}}],ii(i.prototype,r),Object.defineProperty(i,"prototype",{writable:!1}),s}(f());function ig(t){return(ig="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function im(t,e){for(var n=0;nMath.abs(window.scrollY-e.pos.scrollY))){var n=parseInt(_.getCss(e.player.root,"height"));n+=e.config.scrollTop,e.pos.scrollY=window.scrollY,window.scrollY>n+5?e.isMini||e.isClose||e.getMini():window.scrollY<=n&&(e.isMini&&e.exitMini(),e.isClose=!1)}}),e.isMini=!1,e.isClose=!1;var e,n=iw(e).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 i=s,o=[{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=[{key:"beforeCreate",value:function(t){"boolean"==typeof t.player.config.mini&&(t.config.isShowIcon=t.player.config.mini)}},{key:"afterCreate",value:function(){var t=this;this.initIcons(),this.on(R,function(){t.setAttr("data-state","pause")}),this.on(C,function(){t.setAttr("data-state","play")})}},{key:"onPluginsReady",value:function(){var t=this,e=this.player;if(!this.config.disable){this.config.isShowIcon&&e.controls.registerPlugin(ie,{config:{onClick:function(){t.getMini()}}},ie.pluginName);var n=_.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",n,this.onCancelClick),this.bind(".play-icon",n,this.onCenterClick),!this.config.disableDrag&&(this._draggabilly=new iv(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:'',class:"xg-icon-play"},pause:{icon:'',class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild(".play-icon",t.play),this.appendChild(".play-icon",t.pause)}},{key:"getMini",value:function(){var t=this;if(!this.isMini){var e=this.player,n=this.playerConfig,i=this.config.target||this.player.root;this.lastStyle={},_.addClass(e.root,"xgplayer-mini"),["width","height","top","left"].map(function(e){t.lastStyle[e]=i.style[e],i.style[e]="".concat(t.pos[e],"px")}),n.fluid&&(i.style["padding-top"]=""),this.emit(tp,!0),e.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var t=this;if(!this.isMini)return!1;var e=this.player,n=this.playerConfig,i=this.config.target||this.player.root;_.removeClass(e.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map(function(e){i.style[e]=t.lastStyle[e]}),this.lastStyle=null,n.fluid&&(e.root.style.width="100%",e.root.style.height="0",e.root.style["padding-top"]="".concat(100*n.height/n.width,"%")),this.emit(tp,!1),this.isMini=e.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var t=_.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",t,this.onCancelClick),this.unbind(".play-icon",t,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return'\n \n \n
').concat(this.i18n.MINI_DRAG,'
\n
\n
\n \n \n \n
\n
\n
\n
')}}],im(i.prototype,r),o&&im(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function iO(t){return(iO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function iT(t,e){for(var n=0;n0&&e.replay():e.paused?e.play():e.pause()}},{key:"onContextmenu",value:function(t){(t=t||window.event).preventDefault&&t.preventDefault(),t.stopPropagation?t.stopPropagation():(t.returnValue=!1,t.cancelBubble=!0)}},{key:"destroy",value:function(){var t=this,e=this.player,n=e.video,i=e.root;this.clickTimer&&clearTimeout(this.clickTimer),n.removeEventListener("click",this.onVideoClick,!1),n.removeEventListener("dblclick",this.onVideoDblClick,!1),n.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(iA).map(function(e){i.removeEventListener(e,t[iA[e]],!1)})}}],iT(i.prototype,r),o&&iT(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eS);function iD(t){return(iD="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function iN(t,e){for(var n=0;n0?t[t.length-1]:null}function iV(t){var e=navigator.userAgent;/(?:iPhone|iPad)/.test(e)&&t.cancelable&&t.preventDefault()}var iG=function(){var t,e,n;function i(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,i),iM(this,"onTouchStart",function(t){var n=e._pos,i=e.root;e.config.needPreventDefault&&iV(t);var r=iW(t.touches);n.x=r?parseInt(r.pageX,10):t.pageX,n.y=r?parseInt(r.pageX,10):t.pageX,n.start=!0,e.__setPress(t),i.addEventListener(e.events.end,e.onTouchEnd),i.addEventListener(e.events.cancel,e.onTouchCancel),i.addEventListener(e.events.move,e.onTouchMove),e.trigger(iF.TOUCH_START,t)}),iM(this,"onTouchCancel",function(t){e.onTouchEnd(t)}),iM(this,"onTouchEnd",function(t){var n=e._pos,i=e.root;e.config.needPreventDefault&&iV(t),e.__clearPress(),i.removeEventListener(e.events.cancel,e.onTouchCancel),i.removeEventListener(e.events.end,e.onTouchEnd),i.removeEventListener(e.events.move,e.onTouchMove),t.moving=n.moving,t.press=n.press,n.press&&e.trigger(iF.PRESS_END,t),e.trigger(iF.TOUCH_END,t),n.press||n.moving||e.__setDb(t),n.press=!1,n.start=!1,n.moving=!1}),iM(this,"onTouchMove",function(t){var n=e._pos,i=e.config,r=iW(t.touches),o=r?parseInt(r.pageX,10):t.pageX,a=r?parseInt(r.pageY,10):t.pageX,s=o-n.x;if(!(Math.abs(a-n.y)=0&&this.__handlers[t].splice(i,1)}}},{key:"trigger",value:function(t,e){if(!!this.__handlers[t])this.__handlers[t].map(function(t){try{t(e)}catch(t){}})}},{key:"destroy",value:function(){var t=this,e={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(e).forEach(function(n){t.root.removeEventListener(n,t[e[n]])})}}],iN(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}();function iz(t){return(iz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function iK(t,e){for(var n=0;n0&&!i.ended){o.isStart=!0,_.checkIsFunction(a.disableSwipeHandler)&&a.disableSwipeHandler(),e.find(".xg-dur").innerHTML=_.format(e.duration);var u=e.root.getBoundingClientRect();90===i.rotateDeg?(o.top=u.left,o.left=u.top,o.width=u.height,o.height=u.width):(o.top=u.top,o.left=u.left,o.width=u.width,o.height=u.height);var c=parseInt(s.pageX-o.left,10),l=parseInt(s.pageY-o.top,10);o.x=90===i.rotateDeg?l:c,o.y=90===i.rotateDeg?c:l,o.scopeL=r.scopeL*o.width,o.scopeR=(1-r.scopeR)*o.width,o.scopeM1=o.width*(1-r.scopeM)/2,o.scopeM2=o.width-o.scopeM1}}),iJ(iX(e),"onTouchMove",function(t){var n=e.getTouche(t),i=iX(e),r=i.pos,o=i.config,a=i.player;if(!!n&&!o.disableGesture&&!!e.duration&&!!r.isStart){var s=o.miniMoveStep,u=o.hideControlsActive,c=parseInt(n.pageX-r.left,10),l=parseInt(n.pageY-r.top,10),f=90===a.rotateDeg?l:c,h=90===a.rotateDeg?c:l;if(Math.abs(f-r.x)>s||Math.abs(h-r.y)>s){var p=f-r.x,d=h-r.y,y=r.scope;if(-1===y&&(0===(y=e.checkScope(f,h,p,d,r))&&(u?a.blur():a.focus({autoHide:!1}),r.time||(r.time=parseInt(1e3*a.currentTime,10)+1e3*e.timeOffset)),r.scope=y),-1===y||y>0&&!o.gestureY||0===y&&!o.gestureX)return;t.cancelable&&t.preventDefault(),e.executeMove(p,d,y,r.width,r.height),r.x=f,r.y=h}}}),iJ(iX(e),"onTouchEnd",function(t){var n=iX(e),i=n.player,r=n.pos,o=n.playerConfig;if(!!r.isStart)r.scope>-1&&t.cancelable&&t.preventDefault(),e.endLastMove(r.scope),setTimeout(function(){i.getPlugin("progress")&&i.getPlugin("progress").resetSeekState()},10),r.scope=-1,e.resetPos(),_.checkIsFunction(o.enableSwipeHandler)&&o.enableSwipeHandler(),e.changeAction(i$.AUTO)}),iJ(iX(e),"onRootTouchMove",function(t){if(!e.config.disableGesture&&!!e.config.gestureX)e.checkIsRootTarget(t)&&(t.stopPropagation(),e.pos.isStart?e.onTouchMove(t):e.onTouchStart(t))}),iJ(iX(e),"onRootTouchEnd",function(t){if(e.pos.isStart&&e.checkIsRootTarget(t)){t.stopPropagation(),e.onTouchEnd(t);var n=e.player.controls;n&&n.recoverAutoHide()}}),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 i=s,o=[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{stopPropagation:!0,index:0,disableGesture:!1,gestureX:!0,gestureY:!0,updateGesture:function(){},onTouchStart:function(){},onTouchEnd:function(){},gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:36e4,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}],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:'',class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var t=this;iQ.map(function(e){t.__hooks[e]=null});var e=this.playerConfig,n=this.config,i=this.player;!0===e.closeVideoDblclick&&(n.closedbClick=!0),this.resetPos(),!_.isUndefined(e.disableGesture)&&(n.disableGesture=!!e.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=_.createDom("xg-mask","",{},"xgmask"),i.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var r="mouse"===this.domEventType?"mouse":"touch";this.touch=new iG(this.root,{eventType:r,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(t){t.preventDefault()}),i.root.addEventListener("touchmove",this.onRootTouchMove,!0),i.root.addEventListener("touchend",this.onRootTouchEnd,!0),this.on(F,function(){var e=t.player,n=t.config;1e3*e.duration0&&(t.pos.time=0)});var o={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(o).forEach(function(e){t.touch.on(e,function(n){t[o[e]](n)})}),!n.disableActive){var a=i.plugins.progress;a&&(a.addCallBack("dragmove",function(e){t.activeSeekNote(e.currentTime,e.forward)}),a.addCallBack("dragend",function(){t.changeAction(i$.AUTO)}),a.addCallBack("click",function(){t.changeAction(i$.AUTO)}))}}},{key:"registerThumbnail",value:function(){var t=this.player.plugins.thumbnail;if(t&&t.usable){this.thumbnail=t.createThumbnail(null,"mobile-thumbnail");var e=this.find(".time-preview");e.insertBefore(this.thumbnail,e.children[0])}}},{key:"initCustomStyle",value:function(){var t=(this.playerConfig||{}).commonStyle,e=t.playedColor,n=t.progressColor;e&&(this.find(".xg-curbar").style.backgroundColor=e,this.find(".xg-cur").style.color=e),n&&(this.find(".xg-bar").style.backgroundColor=n,this.find(".time-preview").style.color=n),this.config.disableTimeProgress&&_.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var t=this;arguments.length>0&&void 0!==arguments[0]&&arguments[0],this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map(function(e){t.pos[e]=0})):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(t){var e=this.player;this.root.setAttribute("data-xg-action",t);var n=e.plugins.start;n&&n.recover()}},{key:"getTouche",value:function(t){var e=this.player.rotateDeg,n=t.touches&&t.touches.length>0?t.touches[t.touches.length-1]:t;return{pageX:n.pageX,pageY:n.pageY}}},{key:"checkScope",value:function(t,e,n,i,r){var o=r.width,a=-1;if(t<0||t>o)return a;var s=0===i?Math.abs(n):Math.abs(n/i);return Math.abs(n)>0&&s>=1.73&&t>r.scopeM1&&tr.scopeR?2:3),a}},{key:"executeMove",value:function(t,e,n,i,r){switch(n){case 0:this.updateTime(t/i*this.config.scopeM);break;case 1:this.updateBrightness(e/r);break;case 2:!t$.os.isIos&&this.updateVolume(e/r)}}},{key:"endLastMove",value:function(t){var e=this,n=this.pos,i=this.player,r=this.config,o=(n.time-this.timeOffset)/1e3;if(0===t)i.seek(Number(o).toFixed(1)),r.hideControlsEnd?i.blur():i.focus(),this.timer=setTimeout(function(){e.pos.time=0},500);this.changeAction(i$.AUTO)}},{key:"checkIsRootTarget",value:function(t){var e=this.player.plugins||{};return!(e.progress&&e.progress.root.contains(t.target))&&(e.start&&e.start.root.contains(t.target)||e.controls&&e.controls.root.contains(t.target))}},{key:"clickHandler",value:function(t){var e=this.player,n=this.config,i=this.playerConfig;if(!e.isPlaying){!i.closeVideoClick&&(this.emitUserAction("click","switch_play_pause"),e.play());return}!n.closedbClick||i.closeVideoClick?e.isActive?e.blur():e.focus():!i.closeVideoClick&&((e.isActive||n.focusVideoClick)&&(this.emitUserAction("click","switch_play_pause"),this.switchPlayPause()),e.focus())}},{key:"dbClickHandler",value:function(t){var e=this.config,n=this.player;!e.closedbClick&&n.isPlaying&&(this.emitUserAction("dblclick","switch_play_pause"),this.switchPlayPause())}},{key:"onClick",value:function(t){var e=this,n=this.player;ev(this,iQ[0],function(t,n){e.clickHandler(n.e)},{e:t,paused:n.paused})}},{key:"onDbClick",value:function(t){var e=this,n=this.player;ev(this,iQ[1],function(t,n){e.dbClickHandler(n.e)},{e:t,paused:n.paused})}},{key:"onPress",value:function(t){var e=this.pos,n=this.config,i=this.player;if(!n.disablePress)e.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{from:i.playbackRate,to:n.pressRate}),i.playbackRate=n.pressRate,this.changeAction(i$.PLAYBACK)}},{key:"onPressEnd",value:function(t){var e=this.pos,n=this.config,i=this.player;if(!n.disablePress)this.emitUserAction("pressend","change_rate",{from:i.playbackRate,to:e.rate}),i.playbackRate=e.rate,e.rate=1,this.changeAction(i$.AUTO)}},{key:"updateTime",value:function(t){var e=this.player,n=this.config,i=this.player.duration,r=parseInt((t=Number(t.toFixed(4)))*n.moveDuration,10)+this.timeOffset;r+=this.pos.time,r=r<0?0:r>1e3*i?1e3*i-200:r,e.getPlugin("time")&&e.getPlugin("time").updateTime(r/1e3),e.getPlugin("progress")&&e.getPlugin("progress").updatePercent(r/1e3/this.duration,!0),this.activeSeekNote(r/1e3,t>0),n.isTouchingSeek&&e.seek(Number((r-this.timeOffset)/1e3).toFixed(1)),this.pos.time=r}},{key:"updateVolume",value:function(t){this.player.rotateDeg&&(t=-t);var e=this.player,n=this.pos;if(t=parseInt(100*t,10),n.volume+=t,!(10>Math.abs(n.volume))){var i=parseInt(10*e.volume,10)-parseInt(n.volume/10,10);i=i>10?10:i<1?0:i,e.volume=i/10,n.volume=0}}},{key:"updateBrightness",value:function(t){this.player.rotateDeg&&(t=-t);var e=this.pos,n=this.config,i=this.xgMask,r=e.light+.8*t;r=r>n.maxDarkness?n.maxDarkness:r<0?0:r,i&&(i.style.backgroundColor="rgba(0,0,0,".concat(r,")")),e.light=r}},{key:"activeSeekNote",value:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.player,i=this.config,r=!(this.duration!==1/0&&this.duration>0);if(!!t&&"number"==typeof t&&!r&&!i.disableActive){t<0?t=0:t>n.duration&&(t=n.duration-.2),this.changeAction(i$.SEEKING);var o=n.plugins.start;o&&o.focusHide(),this.find(".xg-dur").innerHTML=_.format(this.duration),this.find(".xg-cur").innerHTML=_.format(t),this.find(".xg-curbar").style.width="".concat(t/this.duration*100,"%"),e?_.removeClass(this.find(".xg-seek-show"),"xg-back"):_.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(t)}}},{key:"updateThumbnails",value:function(t){var e=this.player.plugins.thumbnail;e&&e.usable&&this.thumbnail&&e.update(this.thumbnail,t,160,90)}},{key:"switchPlayPause",value:function(){var t=this.player;if(!t.hasStart)return!1;!t.ended&&(t.paused?t.play():t.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!1}},{key:"enableGesture",value:function(){this.config.disableGesture=!0}},{key:"destroy",value:function(){var t=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,t.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,t.root.removeEventListener("touchmove",this.onRootTouchMove,!0),t.root.removeEventListener("touchend",this.onRootTouchEnd,!0)}},{key:"render",value:function(){var t="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";return'\n \n
\n
\n
\n \n 00:00\n /\n 00:00\n
\n
\n
\n
\n
\n
\n ').concat(this.config.pressRate,"X").concat(this.i18n.FORWARD,"\n
\n
\n ")}}],iK(i.prototype,r),o&&iK(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function i1(t){return(i1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function i3(t,e){for(var n=0;n0)||!(i-r>.9*e))&&!0}},{key:"checkCode",value:function(t,e){var n=this,i=!1;return Object.keys(this.keyCodeMap).map(function(r){n.keyCodeMap[r]&&t===n.keyCodeMap[r].keyCode&&!n.keyCodeMap[r].disable&&(i=!e||e&&!n.keyCodeMap[r].noBodyTarget)}),i}},{key:"downVolume",value:function(t){var e=this.player;if(!(e.volume<=0)){var n=parseFloat((e.volume-.1).toFixed(1)),i={volume:{from:e.volume,to:n}};this.emitUserAction(t,"change_volume",{props:i}),n>=0?e.volume=n:e.volume=0}}},{key:"upVolume",value:function(t){var e=this.player;if(!(e.volume>=1)){var n=parseFloat((e.volume+.1).toFixed(1)),i={volume:{from:e.volume,to:n}};this.emitUserAction(t,"change_volume",{props:i}),n<=1?e.volume=n:e.volume=1}}},{key:"seek",value:function(t){var e=this.player,n=e.currentTime,i=e.duration,r=n,o=t.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;r=n+o<=i?n+o:i;var a={currentTime:{from:n,to:r}};this.emitUserAction(t,"seek",{props:a}),this.player.currentTime=r}},{key:"seekBack",value:function(t){var e=this.player.currentTime,n=t.repeat?parseInt(this.seekStep/2,10):this.seekStep,i=0;e-n>=0&&(i=e-n);var r={currentTime:{from:e,to:i}};this.emitUserAction(t,"seek",{props:r}),this.player.currentTime=i}},{key:"changePlaybackRate",value:function(t){var e=this._keyState,n=this.config,i=this.player;0===e.playbackRate&&(e.playbackRate=i.playbackRate,i.playbackRate=n.playbackRate)}},{key:"playPause",value:function(t){var e=this.player;if(!!e)this.emitUserAction(t,"switch_play_pause"),e.paused?e.play():e.pause()}},{key:"exitFullscreen",value:function(t){var e=this.player,n=e.fullscreen,i=e.cssfullscreen;n&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:n,to:!n}),e.exitFullscreen()),i&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:i,to:!i}),e.exitCssFullscreen())}},{key:"handleKeyDown",value:function(t){var e,n=this._keyState;if(t.repeat){n.isPress=!0;var i=Date.now();if(i-n.tt<200)return;n.tt=i}(e=t).preventDefault(),e.returnValue=!1,this.handleKeyCode(t.keyCode,t,n.isPress)}},{key:"handleKeyUp",value:function(t){var e=this._keyState;e.playbackRate>0&&(this.player.playbackRate=e.playbackRate,e.playbackRate=0),e.isKeyDown=!1,e.isPress=!1,e.tt=0}},{key:"handleKeyCode",value:function(t,e,n){for(var i=Object.keys(this.keyCodeMap),r=0;r'}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return'\n \n \n '}}],o=[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:eA.ROOT}}}],r&&rn(i.prototype,r),o&&rn(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function ra(t){return(ra="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rs(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"played",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},n=this.progressList,i=this.fragments;if(!(n.length<1)){var r=e.newIndex,o=e.curIndex,a=e.millisecond;r!==o&&n.map(function(e,n){nr&&(e[t].style.width=0)});var s=i[r],u=0===a?0:(a-s.start)/s.duration;n[r][t].style.width=u<0?0:"".concat(100*u,"%")}}},{key:"updateFocus",value:function(t){if(!!this.fragConfig.fragAutoFocus&&!(this.fragments.length<2)){if(!t){if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var e={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(e),this.focusIndex=-1}return}var n=this.findIndex(1e3*t.currentTime,this.focusIndex);if(n>=0&&n!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(n);var i={index:n,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=n,this._callBack&&this._callBack(i)}}}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},e=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(1e3*e,10)!==this.duration){if(!e&&0!==e)return;this.updateDuration(parseInt(1e3*e,10))}var n=this.playedIndex,i=this.cachedIndex;if("Undefined"!==_.typeOf(t.played)){var r=this.findIndex(1e3*t.played,n);if(r<0)return;this.updateProgress("played",{newIndex:r,curIndex:n,millisecond:parseInt(1e3*t.played,10)}),this.playedIndex=r}if("Undefined"!==_.typeOf(t.cached)){var o=this.findIndex(1e3*t.cached,i);if(o<0)return;this.updateProgress("cached",{newIndex:o,curIndex:i,millisecond:parseInt(1e3*t.cached,10)}),this.cachedIndex=o}}},{key:"findIndex",value:function(t,e){var n=this.fragments;if(!n||0===n.length)return -1;if(1===n.length)return 0;if(e>-1&&en[e].start&&tn[n.length-1].start)return n.length-1;for(var i=0;in[i].start&&t<=n[i].end){e=i;break}return e}},{key:"findHightLight",value:function(){for(var t=this.root.children,e=0;e=e.length?null:{dom:e[t],pos:e[t].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var t=this.root.children,e=0;e0;)this.root.removeChild(n[0])}this.render()}}},{key:"render",value:function(){var t=this,e=this.style.progressColor;if(!this.root&&(this.root=_.createDom("xg-inners","",{},"progress-list")),this.fragments){var n=this.fragConfig,i=n.fragClass,r=n.fragFocusClass;this.progressList=this.fragments.map(function(n){var o=_.createDom("xg-inner","",{style:e?"background:".concat(e,"; flex: ").concat(n.percent):"flex: ".concat(n.percent)},"".concat(n.isFocus?r:""," xgplayer-progress-inner ").concat(i));return t.root.appendChild(o),ru.forEach(function(e){o.appendChild(_.createDom(e.tag,"",{style:e.styleKey?"background: ".concat(t.style[e.styleKey],"; width:0;"):"width:0;"},e.className))}),{cached:o.children[0],played:o.children[1]}})}return this.root}}],rs(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}();function rl(t){return(rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function rh(t){for(var e=1;e0)||void 0===arguments[0]||arguments[0];this.useable=t}},{key:"beforeCreate",value:function(t){"boolean"==typeof t.player.config.progress&&(t.config.disable=!t.player.config.progress)}},{key:"_initInner",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(!e||0===e.length)&&(e=[{percent:1}]);var i=rh(rh({fragments:e},n),{},{actionCallback:function(e){t.emitUserAction("fragment_focus","fragment_focus",e)}});this.innerList?this.innerList.reset(i):(this.innerList=new rc(i),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map(function(e){t[e]=t.innerList[e].bind(t.innerList)}))}},{key:"_updateInnerFocus",value:function(t){this.innerList&&this.innerList.updateFocus(t)}},{key:"afterCreate",value:function(){var t=this;if(!this.config.disable&&!this.playerConfig.isLive){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1},this.outer=this.find("xg-outer");var e=this.config,n=e.fragFocusClass,i=e.fragAutoFocus,r=e.fragClass;this._initInner(this.config.fragments,{fragFocusClass:n,fragAutoFocus:i,fragClass:r,style:this.playerConfig.commonStyle||{}}),"mobile"===t$.device&&(this.config.isDragingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.on(F,function(){t.onMouseLeave()}),this.on(D,function(){t.onTimeupdate()}),this.on(I,function(){t.onTimeupdate(),t.onCacheUpdate()}),this.on(G,function(){t.onCacheUpdate()}),this.on(j,function(){t.onCacheUpdate(!0),t.onTimeupdate(!0),t._state.now=0}),this.on(K,function(){t.onReset()}),this.on(tb,function(){t.onVideoResize()}),this.on(tE,function(){t.config.resetBlur&&t._disableBlur&&(t.enableBlur(),t.blur())}),this.bindDomEvents(),this.initCustomStyle()}}},{key:"setConfig",value:function(t){var e=this,n=null;Object.keys(t).forEach(function(i){e.config[i]=t[i],"fragments"===i&&(n=t[i])}),n&&this._initInner(n,t)}},{key:"initCustomStyle",value:function(){var t=(this.playerConfig||{}).commonStyle.sliderBtnStyle,e=this.progressBtn;t&&("string"==typeof t?e.style.boxShadow=t:"object"===rl(t)&&Object.keys(t).map(function(n){e.style[n]=t[n]}))}},{key:"triggerCallbacks",value:function(t,e,n){this.__dragCallBacks.length>0&&this.__dragCallBacks.map(function(i){if(i&&i.handler&&i.type===t)try{i.handler(e,n)}catch(t){}})}},{key:"addCallBack",value:function(t,e){e&&"function"==typeof e&&this.__dragCallBacks.push({type:t,handler:e})}},{key:"removeCallBack",value:function(t,e){var n=this.__dragCallBacks,i=-1;n.map(function(n,r){n&&n.type===t&&n.handler===e&&(i=r)}),i>-1&&n.splice(i,1)}},{key:"unlock",value:function(){var t=this.player,e=this.pos;if(e.isEnter=!1,!t.isMini){if(this.unbind("mousemove",this.onMoveOnly),e.isDown){this.unbind("mouseleave",this.onMouseLeave);return}this.blur()}}},{key:"bindDomEvents",value:function(){var t=this.player,e=t.controls,n=t.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),("touch"===this.domEventType||"compatible"===this.domEventType)&&(this.root.addEventListener("touchstart",this.onMouseDown),e&&(e.root&&e.root.addEventListener("touchmove",_.stopPropagation),e.center&&e.center.addEventListener("touchend",_.stopPropagation))),("mouse"===this.domEventType||"compatible"===this.domEventType)&&(this.bind("mousedown",this.onMouseDown),"mobile"!==n.isMobileSimulateMode&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),_.addClass(this.root,"active")}},{key:"blur",value:function(){if(!this._disableBlur)this.player.controls.recoverAutoHide(),_.removeClass(this.root,"active")}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(t,e,n){var i=this.config,r=this.player;if(i.isCloseClickSeek&&0===n)return;var o=t>=r.duration?r.duration-i.endedDiff:Number(t).toFixed(1);if(this.updatePercent(e),this.updateTime(t),1!==n||!!i.isDragingSeek&&"audio"!==r.videoConfig.mediaType)this._state.now=o,this._state.direc=o>r.currentTime?0:1,r.seek(o)}},{key:"computeTime",value:function(t,e){var n,i,r=this.player,o=this.root.getBoundingClientRect(),a=o.width,s=o.height,u=o.top,c=o.left;90===r.rotateDeg?(n=s,i=u):(n=a,i=c);var l=e-i,f=(l=l>n?n:l<0?0:l)/n,h=parseInt((f=f<0?0:f>1?1:f)*this.duration*1e3,10)/1e3;return{percent:f,currentTime:h,offset:l,width:n,left:i,e:t}}},{key:"updateTime",value:function(t){var e=this.player,n=this.duration;t>n?t=n:t<0&&(t=0);var i=e.plugins.time;i&&i.updateTime(t)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var t=this.player.plugins.time;t&&t.resetActive()}},{key:"updatePercent",value:function(t,e){if(this.isProgressMoving=!0,!this.config.disable){t=t>1?1:t<0?0:t,this.progressBtn.style.left="".concat(100*t,"%"),this.innerList.update({played:t*this.duration},this.duration);var n=this.player.plugins.miniprogress;n&&n.update({played:t*this.duration},this.duration)}}},{key:"onTimeupdate",value:function(t){var e=this.player,n=this._state,i=this.duration;if((!e.isSeeking||!e.video.seeking)&&!this.isProgressMoving&&!!e.hasStart){if(n.now>-1){var r=parseInt(1e3*n.now,10)-parseInt(1e3*e.currentTime,10);if(0===n.direc&&r>300||1===n.direc&&r>-300){n.now=-1;return}n.now=-1}var o=this.timeOffset+e.currentTime;o=_.adjustTimeByDuration(o,i,t),this.innerList.update({played:o},i),this.progressBtn.style.left="".concat(o/i*100,"%");var a=this.player.plugins.miniprogress;a&&a.update({played:o},i)}}},{key:"onCacheUpdate",value:function(t){var e=this.player,n=this.duration;if(!!e){var i=e.bufferedPoint.end;i=_.adjustTimeByDuration(i,n,t),this.innerList.update({cached:i},n);var r=this.player.plugins.miniprogress;r&&r.update({cached:i},n)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0);var t=this.player.plugins.miniprogress;t&&t.update({cached:0,played:0},0)}},{key:"destroy",value:function(){var t=this.player,e=t.controls;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var n=this.domEventType;("touch"===n||"compatible"===n)&&(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),e&&(e.root&&e.root.removeEventListener("touchmove",_.stopPropagation),e.center&&e.center.removeEventListener("touchend",_.stopPropagation))),("mouse"===n||"compatible"===n)&&(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),t.root.removeEventListener("click",this.onBodyClick,!1))}},{key:"render",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){var t=this.player.controls?this.player.controls.config.mode:"";return'\n \n \n \n \n \n ')}}}],o=[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_CENTER,index:0,disable:!1,isDragingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:rb.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2,resetBlur:!1}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return rb}}],r&&rp(i.prototype,r),o&&rp(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function rk(t){return(rk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r_(t,e){for(var n=0;n',class:"xg-icon-play"},pause:{icon:'',class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild(".xgplayer-icon",t.play),this.appendChild(".xgplayer-icon",t.pause)}},{key:"animate",value:function(t){var e=this.i18nKeys,n=this.player;if(!t||!n.isBufferControlPaused)t?(this.setAttr("data-state","pause"),this.changeLangTextKey(this.find(".xg-tips"),e.PLAY_TIPS)):(this.setAttr("data-state","play"),this.changeLangTextKey(this.find(".xg-tips"),e.PAUSE_TIPS))}},{key:"destroy",value:function(){rR(rI(s.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){return'\n
\n
\n
').concat(this.i18n.PLAY_TIPS,"
\n
")}}],o=[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_LEFT,index:0,disable:!1}}}],r&&rj(i.prototype,r),o&&rj(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function rM(t){return(rM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rB(t,e){for(var n=0;n',class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild(this.root,t.screenBack)}},{key:"show",value:function(){_.addClass(this.root,"show")}},{key:"hide",value:function(){_.removeClass(this.root,"show")}},{key:"render",value:function(){return'\n '}}],o=[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:eA.ROOT_TOP,index:0}}}],r&&rB(i.prototype,r),o&&rB(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function rW(t){return(rW="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rV(t,e){for(var n=0;n',class:"xg-get-fullscreen"},exitFullscreen:{icon:'',class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){rG(rY(s.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===t$.device?"touchend":"click",this.handleFullscreen),"mobile"===t$.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild(".xgplayer-icon",t.fullscreen),this.appendChild(".xgplayer-icon",t.exitFullscreen)}},{key:"setRotateDeg",value:function(t){var e=this.player;90===window.orientation||-90===window.orientation?e.rotateDeg=0:e.rotateDeg=t}},{key:"getRotateFullscreen",value:function(t){var e=this.player;e.isCssfullScreen&&e.exitCssFullscreen(t);var n=t?eV.INNER_FULLSCREEN:eV.ROTATE_FULLSCREEN;e._fullscreenEl=t||e.root,e.changeFullStyle(e.root,t,n,eV.PARENT_ROTATE_FULLSCREEN),e.fullscreen=!0,this.setRotateDeg(90),this.emit(tf,!0)}},{key:"exitRotateFullscreen",value:function(t){var e=this.player;e.fullscreen=!1;var n=e._fullscreenEl!==e.root?eV.INNER_FULLSCREEN:eV.ROTATE_FULLSCREEN;e.recoverFullStyle(e.root,e._fullscreenEl,n,eV.PARENT_ROTATE_FULLSCREEN),this.setRotateDeg(0),this.emit(tf,!1)}},{key:"changeFullScreen",value:function(t){var e=this.player,n=this.config;if(!n.disable){t&&(t.preventDefault(),t.stopPropagation());var i=!1;if((!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen())&&(i=!0),i)e.fullscreen?(e.fullscreen=!1,e.exitCssFullscreen(),this.emit(tf,!1)):(e.fullscreen=!0,e.getCssFullscreen(),this.emit(tf,!0)),this.animate(e.fullscreen);else if(n.rotateFullscreen)e.fullscreen?this.exitRotateFullscreen():this.getRotateFullscreen(),this.animate(e.fullscreen);else{if(n.switchCallback&&"function"==typeof n.switchCallback){n.switchCallback(e.fullscreen);return}e.fullscreen?e.exitFullscreen():e.getFullscreen().catch(function(){})}}}},{key:"animate",value:function(t){t?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(t?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"show",value:function(){rG(rY(s.prototype),"show",this).call(this)}},{key:"hide",value:function(){rG(rY(s.prototype),"hide",this).call(this)}},{key:"render",value:function(){var t="FULLSCREEN_TIPS";return'\n
\n
\n
').concat(this.i18n[t],"
\n
")}}],o=[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}],r&&rV(i.prototype,r),o&&rV(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function rJ(t){return(rJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rZ(t,e){for(var n=0;n0&&(o.textContent=_.format(i))):(r.innerHTML=c,i!==1/0&&i>0&&(o.innerHTML=_.format(i)))}}},{key:"onReset",value:function(){var t="flex"===this.mode?this.centerCurDom:this.timeDom,e="flex"===this.mode?this.centerDurDom:this.durationDom;this.config.smartRender?(this.state.currentTime=0,this.state.duration=0,t.textContent=_.format(0),e.textContent=_.format(0)):(t.innerHTML=_.format(0),e.innerHTML=_.format(0))}},{key:"createCenterTime",value:function(){var t=this.player;if(!!t.controls&&!!t.controls.center){var e=t.controls.center;this.centerCurDom=_.createDom("xg-icon","00:00",{},"xgplayer-time left"),this.centerDurDom=_.createDom("xg-icon","00:00",{},"xgplayer-time right"),e.children.length>0?e.insertBefore(this.centerCurDom,e.children[0]):e.appendChild(this.centerCurDom),e.appendChild(this.centerDurDom)}}},{key:"changeLiveState",value:function(t){t?(_.hide(this.durationDom),_.hide(this.timeDom),_.hide(this.find(".time-separator")),_.show(this.find(".time-live-tag"))):(_.hide(this.find(".time-live-tag")),_.show(this.find(".time-separator")),_.show(this.durationDom),_.show(this.timeDom))}},{key:"updateTime",value:function(t){if(this.isActiving=!0,(!!t||0===t)&&!(t>this.duration)){var e="flex"===this.mode?this.centerCurDom:this.timeDom;this.config.smartRender?(this.state.currentTime=t,e.textContent=_.format(t)):e.innerHTML=_.format(t)}}},{key:"resetActive",value:function(){var t=this,e=this.player,n=function(){t.isActiving=!1};this.off(I,n),e.isSeeking&&e.video.seeking?this.once(I,n):this.isActiving=!1}},{key:"destroy",value:function(){var t=this.player.controls.center;this.centerCurDom&&t.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&t.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return'\n 00:00\n /\n 00:00\n '.concat(this.i18n.LIVE_TIP,"\n ")}}],o=[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_LEFT,index:2,disable:!1,smartRender:!1}}}],r&&rZ(i.prototype,r),o&&rZ(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function r2(t){return(r2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r3(t,e){for(var n=0;nr.barH))t.updateVolumePos(s,e)}),r9(r5(t),"onBarMouseUp",function(e){_.event(e),document.removeEventListener("mouseup",t.onBarMouseUp);var n=r5(t)._d;n.isStart=!1,n.isMoving=!1}),r9(r5(t),"onMouseenter",function(e){t._d.isActive=!0,t.focus(),t.emit("icon_mouseenter",{pluginName:t.pluginName})}),r9(r5(t),"onMouseleave",function(e){t._d.isActive=!1,t.unFocus(100,!1,e),t.emit("icon_mouseleave",{pluginName:t.pluginName})}),r9(r5(t),"onVolumeChange",function(e){if(!!t.player){var n=t.player,i=n.muted,r=n.volume;!t._d.isMoving&&(t.find(".xgplayer-drag").style.height=i||0===r?"4px":"".concat(100*r,"%"),t.config.showValueLabel&&t.updateVolumeValue()),t.animate(i,r)}}),r9(r5(t),"onIconHandle",function(e){t.changeMutedHandler(e)}),t}return i=s,r=[{key:"registerIcons",value:function(){return{volumeSmall:{icon:'',class:"xg-volume-small"},volumeLarge:{icon:'',class:"xg-volume"},volumeMuted:{icon:'',class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var t=this;this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},this.initIcons();var e=this.playerConfig,n=e.commonStyle,i=e.volume;n.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=n.volumeColor),this.changeMutedHandler=this.hook("mutedChange",function(e){t.changeMuted(e)},{pre:function(t){t.preventDefault(),t.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),("mobile"!==t$.device&&"mobile"!==this.playerConfig.isMobileSimulateMode||"compatible"===this.domEventType)&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider",["mousedown","touchstart"],this.onBarMousedown),this.bind(".xgplayer-slider",["mousemove","touchmove"],this.onBarMouseMove),this.bind(".xgplayer-slider",["mouseup","touchend"],this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.onIconHandle),this.on(H,this.onVolumeChange),this.once(U,this.onVolumeChange),("Number"!==_.typeOf(i)||i<0||i>1)&&(this.player.volume=this.config.default),this.onVolumeChange(),this.config.disable&&this.disable()}},{key:"updateVolumePos",value:function(t,e){var n=this.player,i=this.find(".xgplayer-drag"),r=this.find(".xgplayer-bar");if(!!r&&!!i){var o=Math.max(Math.min(t/r.getBoundingClientRect().height,1),0),a=parseInt(1e3*o,10),s={volume:{from:n.volume,to:a/1e3}};i.style.height="".concat(100*o,"%"),n.muted&&(s.muted={from:!0,to:!1}),this.emitUserAction(e,"change_volume",{muted:n.muted,volume:n.volume,props:s}),n.volume=Math.max(Math.min(a/1e3,1),0),n.muted&&(n.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var t=this.player,e=t.volume,n=t.muted,i=this.find(".xgplayer-value-label"),r=Math.max(Math.min(e,1),0);i.innerText=n?0:Math.round(100*r)}},{key:"focus",value:function(){var t=this.player;if(!this.config.disable)t.focus({autoHide:!1}),this._timerId&&(_.clearTimeout(this,this._timerId),this._timerId=null),_.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=this._d,o=this.player;if(!r.isActive)this._timerId&&(_.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=_.setTimeout(this,function(){!r.isActive&&(n?o.blur():o.focus(),_.removeClass(t.root,"slide-show"),r.isStart&&t.onBarMouseUp(i)),t._timerId=null},e)}},{key:"changeMuted",value:function(t){if(!this.config.disable){t&&t.stopPropagation();var e=this.player;this._d.isStart&&this.onBarMouseUp(t),this.emitUserAction(t,"change_muted",{muted:e.muted,volume:e.volume,props:{muted:{from:e.muted,to:!e.muted}}}),e.volume>0&&(e.muted=!e.muted),e.volume<.01&&(e.volume=this.config.miniVolume)}}},{key:"animate",value:function(t,e){t||0===e?this.setAttr("data-state","mute"):e<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild(".xgplayer-icon",t.volumeSmall),this.appendChild(".xgplayer-icon",t.volumeLarge),this.appendChild(".xgplayer-icon",t.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(_.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider",["mousedown","touchstart"],this.onBarMousedown),this.unbind(".xgplayer-slider",["mousemove","touchmove"],this.onBarMouseMove),this.unbind(".xgplayer-slider",["mouseup","touchend"],this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon","mobile"===t$.device?"touchend":"click",this.onIconHandle)}},{key:"render",value:function(){var t=this.config.default||this.player.volume,e=this.config.showValueLabel;return'\n \n
\n
\n \n '.concat(e?'
'.concat(100*t,"
"):"",'\n
\n \n
\n
\n
')}}],o=[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}],r&&r3(i.prototype,r),o&&r3(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function ot(t){return(ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oe(t,e){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=this.player;!this.rotateDeg&&(this.rotateDeg=0);this.rotateDeg=(this.rotateDeg+1+.25*(t?1:-1)*n)%1,this.updateRotateDeg(this.rotateDeg,e),i.emit(tk,360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:''}}},{key:"render",value:function(){return'\n \n
\n
\n
\n ').concat(this.i18n.ROTATE_TIPS,"\n
\n
")}}],o=[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}],r&&oe(i.prototype,r),o&&oe(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function ou(t){return(ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oc(){oc=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype);return i(o,"_invoke",{value:function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return O()}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var s=function t(e,n){var i=n.method,r=e.iterator[i];if(void 0===r)return n.delegate=null,"throw"===i&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=TypeError("The iterator does not provide a '"+i+"' method")),f;var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,f;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,f):a:(n.method="throw",n.arg=TypeError("iterator result is not an object"),n.delegate=null,f)}(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var u=l(t,e,n);if("normal"===u.type){if(i=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i="completed",n.method="throw",n.arg=u.arg)}}}(t,n,new S(r||[]))}),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function p(){}function d(){}var y={};u(y,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(P([])));g&&g!==e&&n.call(g,o)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function b(t){["next","throw","return"].forEach(function(e){u(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){var r;i(this,"_invoke",{value:function(i,o){function a(){return new e(function(r,a){!function i(r,o,a,s){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==ou(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){i("next",t,a,s)},function(t){i("throw",t,a,s)}):e.resolve(f).then(function(t){c.value=t,a(c)},function(t){return i("throw",t,a,s)})}s(u.arg)}(i,o,r,a)})}return r=r?r.then(a,a):a()}})}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;_(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function ol(t,e,n,i,r,o,a){try{var s=t[o](a),u=s.value}catch(t){n(t);return}s.done?e(u):Promise.resolve(u).then(i,r)}function of(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,i=Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{!a&&null!=n.return&&n.return()}finally{if(s)throw o}}}}(document.styleSheets);try{for(s.s();!(a=s.n()).done;)!function(){var t=a.value;try{var n=Array.from(t.cssRules);n.length>0&&i.push(n.map(function(t){return t.cssText}).join(""))}catch(n){if(t.href){var s=document.createElement("link");s.rel="stylesheet",s.type=t.type||"text/css",s.media=t.media.mediaText||"all",s.href=t.href,s.onload=function(){o--,0===o&&e()},s.onerror=function(){o--,0===o&&e()},r.push(s),o++}}}()}catch(t){s.e(t)}finally{s.f()}if(r.forEach(function(t){return n.appendChild(t)}),i.length>0){var u=document.createElement("style");u.textContent=i.join("\n"),n.appendChild(u)}t.document.head.appendChild(n),0===o&&e()})}(e);case 7:l=document.createElement("style"),f=["body{padding:0; margin:0;}"],o?(h="","string"==typeof o?h=o:"function"==typeof o&&(h=o.call(r)),h&&f.push(h)):c===(null==u?void 0:u.root)&&f.push(".xgplayer{width: 100%!important; height: 100%!important;}"),l.textContent=f.join("\n"),e.document.head.append(l),i.attachPlayer(u,{element:c,window:e,onEnter:a,onLeave:s}),null==a||a({documentPictureInPictureWindow:e});case 14:case"end":return t.stop()}},t)}),function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(t){ol(o,i,r,a,s,"next",t)}function s(t){ol(o,i,r,a,s,"throw",t)}a(void 0)})}),function(t){return n.apply(this,arguments)})),c}},{key:"exit",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=this.window)||void 0===t||t.close(),e&&this._onLeave()}},{key:"attachEl",value:function(t){if(!!t&&!!this.window){var e=t.parentElement,n=t.nextSibling;this.window.document.body.append(t),this.currentElement_={element:t,parentNode:e,nextSibling:n}}}},{key:"detachEl",value:function(t){var e,n=this;if(!!this.currentElement_&&(!t||t===(null===(e=this.currentElement_)||void 0===e?void 0:e.element))){var i=this.currentElement_,r=i.element,o=i.parentNode,a=i.nextSibling;return o&&(o.isConnected?o.insertBefore(r,a):r.remove?r.remove():r.parentNode.removeChild(r)),Object.keys(this.currentElement_).forEach(function(t){n.currentElement_[t]=null}),this.currentElement_=null,r}}},{key:"attachPlayer",value:function(t,e){var n,i=e.element,r=e.window,o=e.onEnter,a=e.onLeave;if(!this.window||r===this.window)r&&(this.window=r),this.currentOptions_&&(o&&(this.currentOptions_.onEnter=o),a&&(this.currentOptions_.onLeave=a),t&&(this.currentOptions_.player=t)),i&&i!==(null===(n=this.currentElement_)||void 0===n?void 0:n.element)&&(this.detachEl(),this.attachEl(i))}},{key:"detachPlayer",value:function(t){if(!!t){(null===(e=this.currentOptions_)||void 0===e?void 0:e.player)===t&&(this.currentOptions_.player=null);var e,n,i=null===(n=this.currentElement_)||void 0===n?void 0:n.element;i&&(i===t.root||i.contains(t.root))&&this.detachEl()}}}],of(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}());function ov(t){return(ov="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function og(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};if(this.config.showIcon)this.initIcons(),n.checkStyle&&this.show("",!1);else{n.checkStyle&&this.hide();return}null!==(t=this.player)&&void 0!==t&&t.isComplete?this._checkIcon():this.once(ti,function(){return e._checkIcon()}),this.config.docPiPTargetWindow&&this.isDocPIPAvailable()&&this.requestPIP(),this.isPip&&this.setAttr("data-state","pip")}},{key:"_checkIcon",value:function(){this.config.showIcon&&(_.removeClass(this.find(".xgplayer-icon"),"xg-icon-disable"),this.bind("click",this.switchPIP))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:'',class:"xg-get-pip"},pipIconExit:{icon:'',class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var t=this.icons;if(!this._isInitIcons)this.appendChild(".xgplayer-icon",t.pipIcon),this.appendChild(".xgplayer-icon",t.pipIconExit),this._isInitIcons=!0}},{key:"_initPipEvents",value:function(){var t=this,e=this.player;this.onBeforeFullscreenRequest=function(n){oy.contains(e.root)&&oy.detachEl(),t.exitPIP()},this.leavePIPCallback=function(){var n=e.paused;_.setTimeout(t,function(){n||e.videoPlay()},0),n||e.videoPlay(),t.setAttr("data-state","normal"),t.pipWindow=null,e.emit(tw,!1)},this.enterPIPCallback=function(n){t.setAttr("data-state","pip"),null!=n&&n.pictureInPictureWindow&&(t.pipWindow=n.pictureInPictureWindow),e.emit(tw,!0)},this.onWebkitpresentationmodechanged=function(n){var i=e.video.webkitPresentationMode;t.pMode===oS.FULLSCREEN&&i!==oS.FULLSCREEN&&e.onFullscreenChange(null,!1),t.pMode=i,i===oS.PIP?t.enterPIPCallback(n):i===oS.INLINE&&t.leavePIPCallback(n)},e.on(tl,this.onBeforeFullscreenRequest),e.video&&(e.video.addEventListener("enterpictureinpicture",this.enterPIPCallback),e.video.addEventListener("leavepictureinpicture",this.leavePIPCallback),s.checkWebkitSetPresentationMode(e.video)&&e.video.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"requestPIP",value:function(t){var e=this.player,n=this.playerConfig,i=this.config;if(!!this.isPIPAvailable()&&!this.isPip)try{var r=n.poster;return r&&(e.video.poster="String"===_.typeOf(r)?r:r.poster),i.preferDocument&&this.isDocPIPAvailable()?oy.requestWindow({config:i,window:t,player:e,onEnter:this.enterPIPCallback,onLeave:this.leavePIPCallback}):s.checkWebkitSetPresentationMode(e.video)?e.video.webkitSetPresentationMode("picture-in-picture"):e.video.requestPictureInPicture(),!0}catch(t){return!1}}},{key:"exitPIP",value:function(){var t=this.player;try{return this.isPIPAvailable()&&this.isPip&&(this.isDocPIPAvailable()&&this.getDocumentWindow()?oy.exit():s.checkWebkitSetPresentationMode(t.video)?t.video.webkitSetPresentationMode("inline"):document.exitPictureInPicture()),!0}catch(t){return!1}}},{key:"isPip",get:function(){var t=this.player;return!!(this.isDocPIPAvailable()&&this.getDocumentWindow())||document.pictureInPictureElement&&document.pictureInPictureElement===t.video||t.video.webkitPresentationMode===oS.PIP}},{key:"isPIPAvailable",value:function(){var t=this.player.video;return("Boolean"!==_.typeOf(document.pictureInPictureEnabled)||document.pictureInPictureEnabled)&&("Boolean"===_.typeOf(t.disablePictureInPicture)&&!t.disablePictureInPicture||t.webkitSupportsPresentationMode&&"Function"===_.typeOf(t.webkitSetPresentationMode))||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return oy.isSupported()}},{key:"getWindow",value:function(){return this.pipWindow}},{key:"getDocumentWindow",value:function(){return oy.window}},{key:"attachDocumentWindow",value:function(t){var e,n=this.config.docPiPNode||(null===(e=this.player)||void 0===e?void 0:e.root);oy.attachPlayer(this.player,{element:n,window:t,onEnter:this.enterPIPCallback,onLeave:this.leavePIPCallback})}},{key:"destroy",value:function(){om(ok(s.prototype),"destroy",this).call(this);var t=this.player,e=!(this.isPip&&this.getDocumentWindow()&&oy.isStandaloneWindow);this.unbind("click",this.btnClick),t.off(tl,this.onBeforeFullscreenRequest),t.video.removeEventListener("enterpictureinpicture",this.enterPIPCallback),t.video.removeEventListener("leavepictureinpicture",this.leavePIPCallback),s.checkWebkitSetPresentationMode(t.video)&&t.video.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.isPip&&this.getDocumentWindow()&&oy.detachPlayer(t),e&&this.exitPIP(),this.pipWindow=null,!oy.isStandaloneWindow&&(oy.window=null)}},{key:"render",value:function(){if(!!this.canShow())return'\n
\n
\n
').concat(this.i18n.PIP,"
\n
")}}],o=[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPTargetWindow:void 0,docPiPNode:void 0,docPiPStyle:void 0,alwaysKeepDocumentWindow:!1}}},{key:"checkWebkitSetPresentationMode",value:function(t){return"function"==typeof t.webkitSetPresentationMode}}],r&&og(i.prototype,r),o&&og(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function oO(t){return(oO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oT(t,e){for(var n=0;n'}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("playNext",this.changeSrc);var t="mobile"===t$.device?"touchend":"click";this.bind(t,this.playNext),this.show()}},{key:"changeSrc",value:function(t){var e=this.player;if(!!t)e.pause(),e.currentTime=0,e.autoplay=!0,e.src=t}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(!!this.config.urlList&&0!==this.config.urlList.length)return'\n \n
\n
\n
'.concat(this.i18n.PLAYNEXT_TIPS,"
\n
\n ")}}],o=[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}],r&&oT(i.prototype,r),o&&oT(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN),oA=n("78108"),oL=n.n(oA);function oI(t){return(oI="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oD(t,e){for(var n=0;n'}}},{key:"getAbsoluteURL",value:function(t){if(!t.match(/^https?:\/\//)){var e=document.createElement("div");e.innerHTML='x'),t=e.firstChild.href}return t}},{key:"destroy",value:function(){oN(oF(s.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){return'\n
\n
\n
').concat(this.i18n.DOWNLOAD_TIPS,"
\n
")}}],o=[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:3,disable:!0}}}],r&&oD(i.prototype,r),o&&oD(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function oW(t){return(oW="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oV(t,e){for(var n=0;n4&&void 0!==arguments[4]?arguments[4]:{quality:.92,type:"image/png"},a=this.config,s=this.player,u=o.quality||a.quality,c=o.type||a.type,l=s.video||s.media,f=this.canvas;return new Promise(function(o){var a,s=r.canvasCtx;f.width=n,f.height=i;var h={isContain:"contain"===(a=getComputedStyle(l)["object-fit"]),isCover:"cover"===a},p=h.isContain,d=h.isCover;if(p){var y=l.videoHeight/l.videoWidth,v=l.clientHeight/l.clientWidth,g=y;g=v>y?l.videoWidth/l.clientWidth:l.videoHeight/l.clientHeight,f.width=n,f.height=i,s.drawImage(l,t*g,e*g,n*g,i*g,0,0,n,i),o(f.toDataURL(c,u))}else if(d){var m=function(t,e,n,i){var r,o,a,s,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.5,l=t/e;return n/i>l?(a=i*l,s=i,r=(n-a)*u,o=0):(a=n,r=0,o=(i-(s=n/l))*c),{source:{x:r,y:o,width:a,height:s},destination:{x:0,y:0,width:t,height:e}}}(l.clientWidth,l.clientHeight,l.videoWidth,l.videoHeight),b=m.source,w=m.destination;f.width=w.width,f.height=w.height,s.drawImage(l,b.x,b.y,b.width,b.height,w.x,w.y,w.width,w.height);var k=f.toDataURL("image/png"),_=new Image(w.width,w.height);_.src=k,_.onload=function(){s.clearRect(0,0,f.width,f.height),f.width=n,f.height=i,s.drawImage(_,t,e,n,i,0,0,n,i),_.onload=null},s.drawImage(l,t,e,n,i,0,0,n,i),o(f.toDataURL(c,u))}})}},{key:"shot",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{quality:.92,type:"image/png"},r=this.config,o=this.player,a=i.quality||r.quality,s=i.type||r.type;return new Promise(function(i,u){n.canvas?(n.canvas.width=t||r.width,n.canvas.height=e||r.height):n.createCanvas(t,e),n.canvasCtx.drawImage(o.video,0,0,t||r.width,e||r.height);var c=n.canvas.toDataURL(s,a).replace(s,"image/octet-stream");i(c=c.replace(/^data:image\/[^;]+/,"data:application/octet-stream"))})}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){oG(oK(s.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(tb,this.initSize)}},{key:"render",value:function(){if(!this.config.disable&&!!this.config.showIcon){var t=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",e="SCREENSHOT";return'\n \n
\n ').concat(this.icons.screenshotIcon?"":'').concat(this.i18n[e],"")," \n
\n
")}}}],o=[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,fitVideo:!0,disable:!1,name:"screenshot",showIcon:!0,canvasCreated:!1,canvasAdded:!1}}}],r&&oV(i.prototype,r),o&&oV(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function oX(t){return(oX="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oq(t,e){for(var n=0;n0&&(this.attrKeys=Object.keys(t[0])),this.root.innerHTML="",t.map(function(t,n){var i=t.selected?"option-item selected":"option-item";t["data-index"]=n,e.root.appendChild(_.createDom("li","".concat(t.showText,""),t,i))})}},{key:"onItemClick",value:function(t){!t.delegateTarget&&(t.delegateTarget=t.target);var e=t.delegateTarget;if(e&&_.hasClass(e,"selected"))return!1;var n="function"==typeof this.config.onItemClick?this.config.onItemClick:null,i=this.root.querySelector(".selected");_.addClass(e,"selected"),i&&_.removeClass(i,"selected"),n(t,{from:i?this.getAttrObj(i,this.attrKeys):null,to:this.getAttrObj(e,this.attrKeys)})}},{key:"getAttrObj",value:function(t,e){if(!t||!e)return{};var n={};e.map(function(e){n[e]=t.getAttribute(e)});var i=t.getAttribute("data-index");return i&&(n.index=Number(i)),n}},{key:"show",value:function(){_.removeClass(this.root,"hide"),_.addClass(this.root,"active")}},{key:"hide",value:function(){_.removeClass(this.root,"active"),_.addClass(this.root,"hide")}},{key:"setStyle",value:function(t){var e=this;Object.keys(t).forEach(function(n){e.root.style[n]=t[n]})}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map(function(t){t.destroy&&t.destroy()}),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}],oq(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}();function oZ(t){return(oZ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o$(t,e){for(var n=0;n0&&(t.renderItemList(e.list),t.show())}),o4&&this.on(Z,function(){if(!!t.isActive)t.optionsList&&t.optionsList.hide(),t.isActive=!1}),this.activeEvent=o4?"touchend":"mouseenter",this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave),this.isIcons&&this.bind("click",this.onIconClick),this.config.disable&&this.disable()}},{key:"initIcons",value:function(){var t=this,e=this.icons,n=Object.keys(e),i=!1;if(n.length>0&&(n.forEach(function(n){t.appendChild(".xgplayer-icon",e[n]),i||(i=e[n])}),this.isIcons=i),!i)this.appendChild(".xgplayer-icon",_.createDom("span","",{},"icon-text")),_.addClass(this.find(".xgplayer-icon"),"btn-text")}},{key:"show",value:function(){if(!!this.config.list&&!(this.config.list.length<1))_.addClass(this.root,"show")}},{key:"hide",value:function(){_.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(t,e,n){if(void 0===t)return"";var i=this.config.list;n||(n=this.player.lang),e=!e||_.isUndefined(t[e])?"text":e,"number"==typeof t&&(t=i[t]);try{if("object"===oZ(t[e]))return t[e][n]||t[e].zh;return t[e]}catch(t){return""}}},{key:"onToggle",value:function(t){if(t!==this.isActive&&!this.config.disable){var e=this.player.controls,n=this.config.listType;t?("rightSide"===n?e.blur():e.focus(),this.optionsList&&this.optionsList.show()):("rightSide"===n?e.focus():e.unFocus(),this.optionsList&&this.optionsList.hide()),this.isActive=t}}},{key:"onItemClick",value:function(t,e){t.preventDefault(),t.stopPropagation();var n=this.config,i=n.listType,r=n.list;(o4||"rightSide"===i)&&this.onToggle(!1),this.curIndex=e.to.index,this.curItem=r[this.curIndex],this.changeCurrentText(),this.onToggle(!1)}},{key:"onIconClick",value:function(t){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var t=this.config.list,e=this.curIndex\n
\n
\n ')}}],o=[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:100,list:[],listType:"middle",listStyle:{},hidePortrait:!0,isShowIcon:!1}}}],r&&o$(i.prototype,r),o&&o$(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function o6(t){return(o6="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o9(t,e){for(var n=0;n0&&(t.config.list=e.map(function(t){return!t.text&&t.name&&(t.text=t.name),!t.text&&(t.text=t.definition),t}))}},{key:"afterCreate",value:function(){var t=this;o8(at(s.prototype),"afterCreate",this).call(this);var e=this.config,n=e.list,i=e.defaultDefinition,r=this.playerConfig.defaultConfig;n.forEach(function(t){(t.definition===i||t.definition===r)&&(t.selected=!0)}),this.on("resourceReady",function(e){t.changeDefinitionList(e)}),this.on(td,function(e){t.renderItemList(t.config.list,e.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"initDefinition",value:function(){var t=this.config,e=t.list,n=t.defaultDefinition,i=this.playerConfig.defaultConfig;if(e.length>0){var r=null;e.map(function(t){(t.definition===n||t.definition===i)&&(r=t,t.selected=!0)}),!r&&(r=e[0]),this.changeDefinition(r)}}},{key:"renderItemList",value:function(t,e){var n=this,i=e&&e.definition?e.definition:"";e&&!Array.isArray(e)&&t.forEach(function(t){t.selected=!1});var r=0,o=t.map(function(t,e){var o={url:t.url,definition:t.definition||"",showText:n.getTextByLang(t)||t.definition,selected:!1};return(t.selected||!_.isUndefined(t.definition)&&t.definition===i)&&(o.selected=!0,r=e),o});o8(at(s.prototype),"renderItemList",this).call(this,o,r)}},{key:"changeDefinitionList",value:function(t){if(!!Array.isArray(t)){var e=this.playerConfig,n=e.definition,i=e.defaultDefinition,r=n||this.config.defaultDefinition||"";this.config.list=t.map(function(t){return!t.text&&t.name&&(t.text=t.name),!t.text&&(t.text=t.definition),(t.definition===r||t.definition===i)&&(t.selected=!0),t}),n.list=t,this.renderItemList(t),this.config.list.length<2?this.hide():this.show()}}},{key:"changeDefinition",value:function(t,e){var n=this.player;n.switchURL?n.switchUrl(t.url):n.changeDefinition(t,e)}},{key:"onItemClick",value:function(t,e){var n=this.player.definitionList;o8(at(s.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(t,"change_definition",{from:e.from,to:e.to});for(var i=0;i',class:"xg-get-cssfull"},exitCssFullscreen:{icon:'',class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){al(ah(s.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){return'\n
\n
\n
').concat(this.i18n.CSSFULLSCREEN_TIPS,"
\n
")}}],o=[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:eA.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}],r&&ac(i.prototype,r),o&&ac(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(rC);function ad(t){return(ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ay(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=this.player,n=t.errorType,i=e.error;if(!i)switch(n){case"decoder":i=this.i18n.MEDIA_ERR_DECODE;break;case"network":i=this.i18n.MEDIA_ERR_NETWORK;break;default:i=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=i,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'').concat(this.i18n.REFRESH,"")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return'\n
\n \n \n
\n
'}}],ay(i.prototype,r),o&&ay(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function ab(t){return(ab="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function aw(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(!!t){this.customOnClick=i;var r=this.config.interval;if(this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),n.style&&this.setStyle(n.style),"string"==typeof t?this.find(".xgplayer-prompt-detail").innerHTML=t:this.find(".xgplayer-prompt-detail").innerHTML="".concat(t.text||"")+"".concat(t.highlight?''.concat(t.highlight,""):""),"arrow"===n.mode&&_.addClass(this.root,"arrow"),n.preventScreenOverflow){var o=this.root.getBoundingClientRect(),a=o.left,s=o.right,u=document.documentElement.clientWidth||document.body.clientWidth;if(a<0){var c=Number((Math.abs(a)/u*100).toFixed(2));if(n.style.left){var l=parseInt(n.style.left);this.setStyle({left:"".concat(l+c+.5,"%")})}}if(s>=u){var f=Number(((Math.abs(s)-u)/u*100).toFixed(2));if(n.style.left){var h=parseInt(n.style.left);this.setStyle({left:"".concat(h-f-.5,"%")})}}}if(_.addClass(this.root,"show"),"boolean"==typeof n.autoHide?n.autoHide:this.config.autoHide){var p=n.interval||r;this.intervalId=setTimeout(function(){e.hide()},p)}}}},{key:"hide",value:function(){this.root&&(_.removeClass(this.root,"show"),_.removeClass(this.root,"arrow"),this.root.removeAttribute("style")),this.customOnClick=null}},{key:"render",value:function(){return'\n \n ')}}],aw(i.prototype,r),o&&aw(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN),aP={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function aO(t){Object.keys(aP).map(function(e){void 0===t[e]&&(t[e]=aP[e])})}var aT={initDots:function(){this.createDots(this._ispots,!1),this._ispotsInit=!0},createDots:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!!Array.isArray(e)&&!!e.length){var i=this.player.plugins.progress;if(i&&i.outer){var r=document.createDocumentFragment();e.forEach(function(e){var i=t._createDotElement(e,n);i&&r.appendChild(i)}),i.outer.appendChild(r)}}},createDot:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this._createDotElement(t,e);if(n){var i=this.player.plugins.progress;i.outer&&i.outer.appendChild(n)}},_createDotElement:function(t){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!this.player.plugins.progress)return null;if(e&&(aO(t),this._ispots.push(t)),!this._ispotsInit&&e)return null;var n=this.calcuPosition(t.time,t.duration),i=t.style||{},r=t.stylePreferred;i.left=r&&void 0!==i.left?i.left:"".concat(n.left,"%"),i.width=r&&void 0!==i.width?i.width:"".concat(n.width,"%");var o="xgspot_".concat(t.id," xgplayer-spot");n.isMini&&(o+=" mini");var a=_.createDom("xg-spot",t.template||"",{"data-text":t.text,"data-time":t.time,"data-id":t.id},o);return Object.keys(i).forEach(function(t){a.style[t]=i[t]}),a},findDot:function(t){if(!!this.player.plugins.progress){var e=this._ispots.filter(function(e,n){return e.id===t});return e.length>0?e[0]:null}},updateDot:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.player.plugins.progress;if(!n)return;var i=this.findDot(t.id);if(i&&Object.keys(t).map(function(e){i[e]=t[e]}),!this._ispotsInit)return;var r=n.find('xg-spot[data-id="'.concat(t.id,'"]'));if(!!r){var o=this.calcuPosition(t.time,t.duration),a=t.style||{};a.left="".concat(o.left,"%"),a.width="".concat(o.width,"%"),r.setAttribute("data-text",t.text),r.setAttribute("data-time",t.time),o.isMini?_.addClass(r,"mini"):_.removeClass(r,"mini"),Object.keys(a).map(function(t){r.style[t]=a[t]}),e&&this.showDot(t.id)}},deleteDot:function(t){var e=this._ispots,n=this.player.plugins.progress;if(!!n){for(var i=[],r=0;r=0;a--)if(e.splice(i[a],1),this._ispotsInit){var s=n.find('xg-spot[data-id="'.concat(t,'"]'));s&&s.parentElement.removeChild(s)}}},deleteAllDots:function(){var t=this.player.plugins.progress;if(!!t){if(!this._ispotsInit){this._ispots=[];return}for(var e=t.root.getElementsByTagName("xg-spot"),n=e.length-1;n>=0;n--)t.outer.removeChild(e[n]);this._ispots=[]}},updateAllDots:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.player.plugins.progress;if(!!n){if(!this._ispotsInit){this._ispots=e;return}this._ispots=[];var i=n.root.getElementsByTagName("xg-spot"),r=i.length;if(r>e.length)for(var o=r-1;o>e.length-1;o--)n.outer.removeChild(i[o]);e.map(function(e,n){n0)||void 0===arguments[0]||arguments[0],n=this.player.plugins.progress;if(!!(null!=n&&n.root))for(var i=n.root.getElementsByTagName("xg-spot"),r=function(n){var r=(n=i[a]).getAttribute("data-id"),s=t.findDot(r);if(s&&s.activeStyle&&s.style&&s.stylePreferred){var u=e?null==s?void 0:s.activeStyle:null==s?void 0:s.style;u&&Object.keys(u).map(function(t){n.style[t]=u[t]})}o=n},o,a=0;a0&&e.hide(),null==o||o.disableBlur()}else a&&(null==o||o.enableBlur())}}),e._ispots=[],e.videoPreview=null,e.videothumbnail=null,e.thumbnail=null,e._state={now:0,f:!1},e}return i=s,o=[{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,isDotAdaptWidth:!0}}}],r=[{key:"beforeCreate",value:function(t){var e=t.player.plugins.progress;e&&(t.root=e.root)}},{key:"afterCreate",value:function(){var t,e,n,i,r=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",function(t,e){e.time&&r.player.seek(e.time)}),t=this,e=t.config,n=t.player,Object.keys(aT).map(function(e){t[e]=aT[e].bind(t)}),i=n.config.progressDot||e.ispots||[],t._ispots=i.map(function(t){return aO(t),t}),t._ispotsInit=!1,n.once(F,function(){t.initDots()}),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(t){var e=this;if(!!t)Object.keys(t).map(function(n){e.config[n]=t[n]})}},{key:"onPluginsReady",value:function(){if(!!this.player.plugins.progress)this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents()}},{key:"bindEvents",value:function(){var t=this,e=this.player.plugins.progress;if(!!e){if(Object.keys(aI).map(function(n){t[aI[n]]=t[aI[n]].bind(t),e.addCallBack(n,t[aI[n]])}),"mobile"!==t$.device){this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup);var n=this.hook("previewClick",function(){});this.handlerPreviewClick=function(e){e.stopPropagation(),n(parseInt(1e3*t._state.now,10)/1e3,e)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}}},{key:"onProgressMouseEnter",value:function(t,e){this.onProgressMove(t,e),this.updateAllDotsStyles(!0)}},{key:"onProgressMove",value:function(t,e){if(!this.config.disable&&!!this.player.duration)this.updatePosition(t.offset,t.width,t.currentTime,t.e)}},{key:"onProgressDragMove",value:function(t,e){if(!this.config.disable&&!!this.player.duration)this.onProgressMove(t,e)}},{key:"onProgressDragStart",value:function(t){if(!this.config.disable&&!!this.player.duration)this.isDrag=!0,this.videoPreview&&_.addClass(this.videoPreview,"show")}},{key:"onProgressDragEnd",value:function(t){if(!this.config.disable&&!!this.player.duration)this.isDrag=!1,this.videoPreview&&_.removeClass(this.videoPreview,"show")}},{key:"onProgressClick",value:function(t,e){if(!this.config.disable){if(_.hasClass(e.target,"xgplayer-spot")){e.stopPropagation(),e.preventDefault();var n={};["time","id","text"].map(function(t){n[t]=e.target.getAttribute("data-".concat(t))}),n.time&&(n.time=Number(n.time)),this.handlerSpotClick(e,n)}}}},{key:"updateLinePos",value:function(t,e){var n,i,r=this.root,o=this.previewLine,a=this.timePoint,s=this.player,u=this.config,c="flex"===s.controls.mode,l=r.getBoundingClientRect().width;if(!!l||!this._hasThumnail){var f=a.getBoundingClientRect().width,h=t-(l=this._hasThumnail&&le-l&&!c?(n=h-(e-l),this.thumbnail||(i=h-(e-l)-f/2),h=e-l):(n=0,this.thumbnail||(i=-f/2)),void 0!==n&&(o.style.transform="translateX(".concat(n.toFixed(2),"px)")),void 0!==i&&(a.style.transform="translateX(".concat(i.toFixed(2),"px)")),r.style.transform="translateX(".concat(h.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(t){var e=this.timeText,n=this.timePoint;e.textContent=t,this.thumbnail||(n.textContent=t)}},{key:"updatePosition",value:function(t,e,n,i){var r=this.root,o=this.config,a=this._state;if(!!r){this.updateLinePos(t,e),a.now=n;var s=_.format(n);i&&i.target&&_.hasClass(i.target,"xgplayer-spot")?(this.showTips(i.target.getAttribute("data-text"),!1,s),this.focusDot(i.target),a.f=!0,o.isFocusDots&&a.f&&(a.now=parseInt(i.target.getAttribute("data-time"),10))):o.defaultText?(a.f=!1,this.showTips(o.defaultText,!0,s)):(a.f=!1,this.hideTips("")),this.updateTimeText(s),this.updateThumbnails(a.now)}}},{key:"updateThumbnails",value:function(t){var e=this.player,n=this.videoPreview,i=this.config,r=e.plugins.thumbnail;if(r&&r.usable){this.thumbnail&&r.update(this.thumbnail,t,i.width,i.height);var o=n&&n.getBoundingClientRect();this.videothumbnail&&r.update(this.videothumbnail,t,o.width,o.height)}}},{key:"registerThumbnail",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("mobile"!==t$.device){var e=this.player,n=this.config,i=e.getPlugin("thumbnail");if(i&&i.setConfig(t),i&&i.usable&&n.isShowThumbnail)_.removeClass(this.root,"short-line no-thumbnail");else{_.addClass(this.root,"short-line no-thumbnail");return}"short"===n.mode&&_.addClass(this.root,"short-line"),this._hasThumnail=!0;var r=this.find(".xg-spot-thumbnail");this.thumbnail=i.createThumbnail(r,"progress-thumbnail"),n.isShowCoverPreview&&(this.videoPreview=_.createDom("xg-video-preview","",{},"xgvideo-preview"),e.root.appendChild(this.videoPreview),this.videothumbnail=i.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}}},{key:"calcuPosition",value:function(t,e){var n=this.player.plugins.progress,i=this.player;t+e>i.duration&&(e=i.duration-t);var r={left:t/i.duration*100,width:e/i.duration*100,isMini:!1};if(this.config.isDotAdaptWidth){var o=0;if(i.duration>0){var a=n.root.getBoundingClientRect().width;o=i.duration/a*6}r.isMini=o>e}else r.isMini=!0;return r}},{key:"showDot",value:function(t){var e=this.findDot(t);if(e){var n=this.root.getBoundingClientRect().width,i=e.time/this.player.duration*n;this.updatePosition(i,n,e.time)}}},{key:"focusDot",value:function(t,e){if(!!t)!e&&(e=t.getAttribute("data-id")),_.addClass(t,"active"),this._activeDotId=e}},{key:"blurDot",value:function(t){if(!t){var e=this._activeDotId;t=this.getDotDom(e)}if(!!t)_.removeClass(t,"active"),this._activeDotId=null}},{key:"showTips",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(_.addClass(this.root,"no-timepoint"),!!t)_.addClass(this.find(".xg-spot-content"),"show-text"),e&&"production"===this.config.mode?(_.addClass(this.root,"product"),this.tipText.textContent=t):(_.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?t:"".concat(n," ").concat(t))}},{key:"hideTips",value:function(){_.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",_.removeClass(this.find(".xg-spot-content"),"show-text"),_.removeClass(this.root,"product")}},{key:"hide",value:function(){_.addClass(this.root,"hide")}},{key:"show",value:function(){_.removeClass(this.root,"hide")}},{key:"enable",value:function(){var t=this.config,e=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&t.isShowThumbnail&&this.registerThumbnail(e.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var t=this,e=this.player.plugins.progress;e&&Object.keys(aI).map(function(n){e.removeCallBack(n,t[aI[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"mobile"===t$.device||"mobile"===this.playerConfig.isMobileSimulateMode?"":'
\n
\n
\n \n
\n
\n
\n
00:00
\n
\n
\n
')}}],aC(i.prototype,r),o&&aC(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function aN(t){return(aN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function aM(t,e){for(var n=0;n0?i:Math.round(1e3*t.player.duration/n)/1e3)})}},{key:"setConfig",value:function(t){var e=this;if(!t)return;var n=Object.keys(t);if(!(n.length<1))n.forEach(function(n){e.config[n]=t[n]}),this.usable&&this.initThumbnail()}},{key:"usable",get:function(){var t=this.config,e=t.urls,n=t.pic_num;return e&&e.length>0&&n>0}},{key:"initThumbnail",value:function(){var t=this.config,e=t.width,n=t.height,i=t.pic_num,r=t.interval;this.ratio=e/n*100,this.interval=r||Math.round(this.player.duration/i),this._preloadMark={}}},{key:"getUrlByIndex",value:function(t){return t>=0&&t0&&r.push(t-1),r.push(t),t>0&&t=0&&t1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.config,r=i.pic_num,o=i.row,a=i.col,s=i.width,u=i.height;this.interval=Math.round(this.player.duration/r);var c=Math.ceil(t/this.interval),l=(c=c>r?r:c)0?Math.ceil(f/a)-1:0,p=f>0?f-h*a-1:0,d=0,y=0;e&&n?e/n2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=this.config,a=o.pic_num,s=o.urls;if(!(a<=0)&&!!s&&0!==s.length){var u=this.getPosition(e,n,i);this.preload(u.urlIndex),Object.keys(u.style).map(function(e){t.style[e]=u.style[e]}),Object.keys(r).map(function(e){t.style[e]=r[e]})}}},{key:"changeConfig",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setConfig(t)}},{key:"createThumbnail",value:function(t,e){var n=_.createDom("xg-thumbnail","",{},"thumbnail ".concat(e));return t&&t.appendChild(n),n}}],aM(i.prototype,r),o&&aM(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function aU(t){return(aU="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function aW(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},e=arguments.length>1?arguments[1]:void 0;if(!!e&&!!this.root)t.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(t.cached/e*100,"%")),t.played&&(this.find("xg-mini-progress-played").style.width="".concat(t.played/e*100,"%"))}},{key:"render",value:function(){if(!!this.playerConfig.progress&&!!this.playerConfig.miniprogress)return'\n \n \n '}}],aW(i.prototype,r),o&&aW(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function aK(t){return(aK="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function aY(t,e){for(var n=0;n0)t.renderOnce(),t._frameCount--;else{t._isLoaded=!0,t.off(D,t.renderOnTimeupdate);var n=t.config.startInterval;!t.player.paused&&t._checkIfCanStart()&&t.start(0,n)}}),aZ(aq(t),"start",function(e,n){var i=t.player.video,r=function(){try{return parseInt(window.performance.now(),10)}catch(t){return new Date().getTime()}}(),o=t.checkVideoIsSupport(i);if(!!o&&!!t.canvasCtx)!n&&(n=t.interval),t.stop(),i.videoWidth&&i.videoHeight&&(t.videoPI=i.videoHeight>0?parseInt(i.videoWidth/i.videoHeight*100,10):0,t.config.mode===aQ.REAL_TIME?(i&&i.videoWidth&&t.update(o,t.videoPI),t.preTime=r):r-t.preTime>=n&&(i&&i.videoWidth&&t.update(o,t.videoPI),t.preTime=r)),t.frameId="timer"===t._loopType?_.setTimeout(aq(t),t.start,n):_.requestAnimationFrame(t.start)}),aZ(aq(t),"stop",function(){t.frameId&&("timer"===t._loopType?_.clearTimeout(aq(t),t.frameId):_.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return i=s,r=[{key:"afterCreate",value:function(){var t=this;!0===this.playerConfig.dynamicBg&&(this.config.disable=!1),!s.isSupport&&(this.config.disable=!0);var e=this.config,n=e.disable,i=e.mode,r=e.frameRate;if(n)return;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/r,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==aQ.REAL_TIME&&this.interval>=1e3?"timer":"animation";var o=function(){if(!!t.player)t.init(),t.renderByPoster(),!t.player.paused&&t.start()};if(this.player.hasStart?o():this.once(ti,o),i!==aQ.POSTER)i!==aQ.FIRST_FRAME&&(this.on(K,function(){t.stop()}),this.on(C,function(){var e=t.config.startInterval;t._checkIfCanStart()&&t.start(0,e)}),this.on(R,function(){t.stop()})),this.on(U,this.onLoadedData),this.on(z,function(){t._isLoaded=!1,t.stop()}),document.addEventListener("visibilitychange",this.onVisibilitychange)}},{key:"setConfig",value:function(t){var e=this;Object.keys(t).forEach(function(n){"root"===n&&t[n]!==e.config[n]?e.reRender(t[n]):"frameRate"===n?e.interval=parseInt(1e3/t[n],10):"disable"===n&&t[n]&&e.stop(),e.config[n]=t[n]})}},{key:"init",value:function(t){var e=this.player,n=this.config;this.canvasFilter=s.supportCanvasFilter();try{var i=t||n.root;!i&&(i=n.isInnerRender&&e.innerContainer||e.root),i.insertAdjacentHTML("afterbegin",'
\n
')),this.root=i.children[0],this.canvas=this.find("canvas"),!this.canvasFilter&&(this.canvas.style.filter=n.filter,this.canvas.style.webkitFilter=n.filter),this.mask=this.find("xgmask"),n.addMask&&(this.mask.style.background=n.maskBg),this.canvasCtx=this.canvas.getContext("2d")}catch(t){v.logError("plugin:DynamicBg",t)}}},{key:"reRender",value:function(t){if(!!this.config.disable||!!this.root){this.stop();var e=this.root?this.root.parentElement:null;if(e!==t&&e.removeChild(this.root),!t){this.root=null;return}this.init(t),this.renderOnce();var n=this.config.startInterval;this._checkIfCanStart()&&this.start(0,n)}}},{key:"checkVideoIsSupport",value:function(t){if(!t)return null;var e=t&&t instanceof window.HTMLVideoElement?t:t.canvas?t.canvas:t.flyVideo?t.flyVideo:null;if(e&&!("safari"===t$.browser&&_.isMSE(e)))return e;var n=e?e.tagName.toLowerCase():"";return"canvas"===n||"img"===n?e:null}},{key:"renderByPoster",value:function(){var t=this.playerConfig.poster;if(t){var e="String"===_.typeOf(t)?t:"String"===_.typeOf(t.poster)?t.poster:null;this.updateImg(e)}}},{key:"_checkIfCanStart",value:function(){var t=this.config.mode;return this._isLoaded&&!this.player.paused&&t!==aQ.FIRST_FRAME&&t!==aQ.POSTER}},{key:"renderOnce",value:function(){var t=this.player.video;if(!!t.videoWidth&&!!t.videoHeight){this.videoPI=parseInt(t.videoWidth/t.videoHeight*100,10);var e=this.checkVideoIsSupport(t);e&&this.update(e,this.videoPI)}}},{key:"updateImg",value:function(t){var e=this;if(!!t){var n=this.canvas.getBoundingClientRect(),i=n.width,r=n.height,o=new window.Image;o.onload=function(){if(!!e.canvas&&!e.frameId&&!e.isStart){e.canvas.height=r,e.canvas.width=i;var t=parseInt(i/r*100,10);e.update(o,t),o=null}},o.src=t}}},{key:"update",value:function(t,e){if(!!this.canvas&&!!this.canvasCtx&&!!e)try{var n=this._pos,i=this.config,r=this.canvas.getBoundingClientRect(),o=r.width,a=r.height;if(o!==n.width||a!==n.height||n.pi!==e){var s=parseInt(o/a*100,10);n.pi=e,n.width!==o&&(n.width=this.canvas.width=o),n.height!==a&&(n.height=this.canvas.height=a);var u=a,c=o;se&&(u=parseInt(100*o/e,10)),n.rwidth=c*i.multiple,n.rheight=u*i.multiple,n.x=(o-n.rwidth)/2,n.y=(a-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=i.filter),this.canvasCtx.drawImage(t,n.x,n.y,n.rwidth,n.rheight)}catch(t){v.logError("plugin:DynamicBg",t)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],o=[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return"boolean"==typeof a0?a0:a0=function(){try{if(document.createElement("canvas").getContext)return!0;return!1}catch(t){return!1}}()}},{key:"supportCanvasFilter",value:function(){return!("safari"===t$.browser||"firefox"===t$.browser)}}],r&&aY(i.prototype,r),o&&aY(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function a2(t){return(a2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function a4(t){for(var e=1;en.video.duration)return;var f=l-u;if(!(fe&&(0===o||i[o-1].end-e<=n)){r=o;break}return r}},{key:"_getBuffered",value:function(t){if(!t)return[];for(var e=[],n=0;ne.jumpCntMax)&&!t.timer&&!1!==e.useWaitingTimeoutJump)t.timer=setTimeout(t.onJump,1e3*e.waitingTime)}),sy(sp(t),"onJump",function(){var e=sp(t),n=e.player,i=e.config;if(clearTimeout(t.timer),t.timer=null,t.jumpCnt>i.jumpCntMax||!1===i.useWaitingTimeoutJump||n.video.paused&&0!==n.video.currentTime&&t.hasPlayed)return;t.jumpSize=i.jumpSize*(t.jumpCnt+1),t.jumpCnt===i.jumpSize&&t.jumpSize<6&&(t.jumpSize=6);var r=n.currentTime+t.jumpSize;if(!(r>n.video.duration))t.jumpCnt++,n.currentTime=r}),t}return i=s,o=[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}],r=[{key:"afterCreate",value:function(){var t=this,e=this.config,n=e.useWaitingTimeoutJump,i=e.jumpSize;if(!1!==n)this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=i,this.on(N,this.onWaiting),this.on([x,M],function(){clearTimeout(t.timer),t.timer=null,t.jumpSize=t.config.jumpSize}),this.on(C,function(){t.hasPlayed=!0})}}],sf(i.prototype,r),o&&sf(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function sm(t){return(sm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function sb(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);nn.indexOf("?")?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=r)){t.cnt++;try{var s=new Date().getTime(),u=null,c=new XMLHttpRequest;t.xhr=c,c.open("GET",a);var l={},f=Math.floor(10*Math.random());l.Range="bytes="+f+"-"+(i+f),l&&Object.keys(l).forEach(function(t){c.setRequestHeader(t,l[t])}),c.onreadystatechange=function(){if(4===c.readyState){t.xhr=null,u=new Date().getTime();var e=c.getResponseHeader("Content-Length")/1024*8,n=u-s,i=Math.round(1e3*e/n);t.appendList(i,e,n),t.timer=setTimeout(t.testSpeed,o)}},c.send()}catch(t){}}}}),sP(s_(t),"appendList",function(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"cdn";if(s.speedListCache&&s.speedListCache[r]){var o=t.config.saveSpeedMax;s.speedListCache[r].length>=o&&s.speedListCache[r].shift(),s.speedListCache[r].push({speed:e,bytes:n,time:i});var a=s_(t).player;a&&("cdn"===r?a.realTimeSpeed=e:a[t.getSpeedName("realTime",r)]=e),t.updateSpeed(r)}}),sP(s_(t),"updateSpeed",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cdn",n=s.getAvgSpeedKbs(e),i=s_(t).player;if(i){if("cdn"===e)(!i.avgSpeed||n!==i.avgSpeed)&&(i.avgSpeed=n,i.emit(ts,{speed:n,realTimeSpeed:i.realTimeSpeed}));else{var r=t.getSpeedName("avg",e);(!i[r]||n!==i[r])&&(i[r]=n,i.emit(ts,{speed:n,realTimeSpeed:i.realTimeSpeed}))}}}),t}return i=s,r=[{key:"afterCreate",value:function(){var t,e=this.config,n=e.openSpeed,i=e.addSpeedTypeList,r=e.testCnt;if((null==i?void 0:i.length)>0){;sT.push.apply(sT,function(t){if(Array.isArray(t))return sb(t)}(t=i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return sb(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sb(t,e)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}if(this.initSpeedList(),!!n)this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,r>0&&this.on([U,tr],this.startTimer)}},{key:"getSpeedName",value:function(t,e){return t+"Speed"+e.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(t){if(this.config.openSpeed=t,!t&&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(){this.off("real_time_speed",this._onRealSpeedChange),this.off([U,tr],this.startTimer),clearTimeout(this.timer),this.timer=null,this.xhr&&4!==this.xhr.readyState&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],o=[{key:"pluginName",get:function(){return"testspeed"}},{key:"speedSampleList",get:function(){return s.speedListCache}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:204800,testTimeStep:3e3,url:"",saveSpeedMax:20,addSpeedTypeList:[]}}},{key:"getAvgSpeedKbs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cdn";if(!s.speedListCache||!s.speedListCache[t]||s.speedListCache[t].length<=0)return -1;var e=0;return s.speedListCache[t].map(function(t){e+=t.speed}),Math.floor(e/s.speedListCache[t].length)}},{key:"getWeightedSpeedKbs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cdn",e=-1;if(!s.speedListCache||!s.speedListCache[t]||s.speedListCache[t].length<=0)return e;var n=[];s.speedListCache[t].forEach(function(t){n.push(t)}),n.sort(function(t,e){return t.speed-e.speed});for(var i=n.length,r=0,o=0;o=this.config.stuckCount&&(this.emit(tL,this._payload),this._resetCheck())):this._resetCheck()}},{key:"_resetCheck",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_resetData",value:function(){this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[]}},{key:"_checkDecodeFPS",value:function(){var t,e,n=(null===(t=this.player)||void 0===t?void 0:t.media)||(null===(e=this.player)||void 0===e?void 0:e.video);if(!n){this._stopTick();return}var i=n.getVideoPlaybackQuality(),r=i.totalVideoFrames,o=i.droppedVideoFrames,a=performance.now();if(r&&this._lastCheckPoint){var s=r-this._lastDecodedFrames,u=a-this._lastCheckPoint;this._checkStuck(s,r,o,u)}this._lastDecodedFrames=r,this._lastCheckPoint=a}},{key:"destroy",value:function(){this._stopTick(),this._resetData()}}],sx(i.prototype,r),o&&sx(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(eN);function sL(t){return(sL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function sI(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n