@byteplus/veplayer 1.18.0 → 1.19.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1141 -266
- package/index.min.css +1 -1
- package/index.min.js +2 -2
- package/lite.cjs +2 -2
- package/lite.cjs.css +1 -1
- package/lite.d.ts +637 -0
- package/lite.esm.css +1 -1
- package/lite.esm.mjs +2 -2
- package/lite.min.css +1 -1
- package/lite.min.js +2 -2
- package/package.json +1 -1
- package/plugin/hlsEncrypt.js +2 -2
- package/plugin/hlsjs.js +1 -1
- package/plugin/hlsjsPro.js +2 -2
- package/plugin/modules/DashAbralgo.mjs +1 -1
- package/plugin/modules/XGVideo.mjs +1 -1
- package/plugin/modules/danmuMask.mjs +1 -1
- package/plugin/modules/danmujs.mjs +1 -1
- package/plugin/modules/dash.mjs +1 -1
- package/plugin/modules/flv.mjs +1 -1
- package/plugin/modules/hls.mjs +1 -1
- package/plugin/modules/hlsEncrypt.mjs +2 -2
- package/plugin/modules/hlsjs.mjs +2 -2
- package/plugin/modules/hlsjsPro.mjs +2 -2
- package/plugin/modules/mp4Encrypt.mjs +1 -1
- package/plugin/modules/preloader.mjs +1 -1
- package/plugin/modules/streamprobe.mjs +1 -1
- package/plugin/modules/vestrategy.mjs +1 -1
- package/plugin/modules/vestrategy_adapt_range.mjs +1 -1
- package/plugin/modules/vestrategy_h265.mjs +1 -1
- package/plugin/modules/vestrategy_preload.mjs +1 -1
- package/plugin/xgHls.js +1 -1
package/lite.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @byteplus/veplayer@1.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VePlayerLite=t()}(this,(function(){var e,t=Object.defineProperty,i=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=Math.pow,l=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,c=(e,t)=>{for(var i in t||(t={}))o.call(t,i)&&l(e,i,t[i]);if(r)for(var i of r(t))a.call(t,i)&&l(e,i,t[i]);return e},u=(e,t)=>i(e,n(t)),h=(e,t)=>{var i={};for(var n in e)o.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&r)for(var n of r(e))t.indexOf(n)<0&&a.call(e,n)&&(i[n]=e[n]);return i},d=(e,t,i)=>new Promise(((n,r)=>{var o=e=>{try{s(i.next(e))}catch(t){r(t)}},a=e=>{try{s(i.throw(e))}catch(t){r(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,a);s((i=i.apply(e,t)).next())}));function f(e,t){return e===t||e!=e&&t!=t}function p(e,t){for(var i=e.length;i--;)if(f(e[i][0],t))return i;return-1}var g=Array.prototype.splice;function y(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}y.prototype.clear=function(){this.__data__=[],this.size=0},y.prototype.delete=function(e){var t=this.__data__,i=p(t,e);return!(i<0)&&(i==t.length-1?t.pop():g.call(t,i,1),--this.size,!0)},y.prototype.get=function(e){var t=this.__data__,i=p(t,e);return i<0?void 0:t[i][1]},y.prototype.has=function(e){return p(this.__data__,e)>-1},y.prototype.set=function(e,t){var i=this.__data__,n=p(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};const v="object"==typeof global&&global&&global.Object===Object&&global;var m="object"==typeof self&&self&&self.Object===Object&&self;const _=v||m||Function("return this")();const E=_.Symbol;var T=Object.prototype,b=T.hasOwnProperty,S=T.toString,C=E?E.toStringTag:void 0;var k=Object.prototype.toString;var I="[object Null]",P="[object Undefined]",D=E?E.toStringTag:void 0;function w(e){return null==e?void 0===e?P:I:D&&D in Object(e)?function(e){var t=b.call(e,C),i=e[C];try{e[C]=void 0;var n=!0}catch(o){}var r=S.call(e);return n&&(t?e[C]=i:delete e[C]),r}(e):function(e){return k.call(e)}(e)}function A(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var R="[object AsyncFunction]",x="[object Function]",O="[object GeneratorFunction]",L="[object Proxy]";function N(e){if(!A(e))return!1;var t=w(e);return t==x||t==O||t==R||t==L}const M=_["__core-js_shared__"];var U,B=(U=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"";var F=Function.prototype.toString;function H(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var j=/^\[object .+?Constructor\]$/,V=Function.prototype,K=Object.prototype,W=V.toString,G=K.hasOwnProperty,Y=RegExp("^"+W.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z(e){return!(!A(e)||(t=e,B&&B in t))&&(N(e)?Y:j).test(H(e));var t}function $(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return z(i)?i:void 0}const X=$(_,"Map");const q=$(Object,"create");var Z=Object.prototype.hasOwnProperty;var Q=Object.prototype.hasOwnProperty;function J(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}function ee(e,t){var i,n,r=e.__data__;return("string"==(n=typeof(i=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?r["string"==typeof t?"string":"hash"]:r.map}function te(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}J.prototype.clear=function(){this.__data__=q?q(null):{},this.size=0},J.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},J.prototype.get=function(e){var t=this.__data__;if(q){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return Z.call(t,e)?t[e]:void 0},J.prototype.has=function(e){var t=this.__data__;return q?void 0!==t[e]:Q.call(t,e)},J.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=q&&void 0===t?"__lodash_hash_undefined__":t,this},te.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(X||y),string:new J}},te.prototype.delete=function(e){var t=ee(this,e).delete(e);return this.size-=t?1:0,t},te.prototype.get=function(e){return ee(this,e).get(e)},te.prototype.has=function(e){return ee(this,e).has(e)},te.prototype.set=function(e,t){var i=ee(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function ie(e){var t=this.__data__=new y(e);this.size=t.size}ie.prototype.clear=function(){this.__data__=new y,this.size=0},ie.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},ie.prototype.get=function(e){return this.__data__.get(e)},ie.prototype.has=function(e){return this.__data__.has(e)},ie.prototype.set=function(e,t){var i=this.__data__;if(i instanceof y){var n=i.__data__;if(!X||n.length<199)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new te(n)}return i.set(e,t),this.size=i.size,this};var ne=function(){try{var e=$(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();const re=ne;function oe(e,t,i){"__proto__"==t&&re?re(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var ae=Object.prototype.hasOwnProperty;function se(e,t,i){var n=e[t];ae.call(e,t)&&f(n,i)&&(void 0!==i||t in e)||oe(e,t,i)}function le(e,t,i,n){var r=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=n?n(i[s],e[s],s,i,e):void 0;void 0===l&&(l=e[s]),r?oe(i,s,l):se(i,s,l)}return i}function ce(e){return null!=e&&"object"==typeof e}function ue(e){return ce(e)&&"[object Arguments]"==w(e)}var he=Object.prototype,de=he.hasOwnProperty,fe=he.propertyIsEnumerable,pe=ue(function(){return arguments}())?ue:function(e){return ce(e)&&de.call(e,"callee")&&!fe.call(e,"callee")};const ge=pe;const ye=Array.isArray;var ve="object"==typeof exports&&exports&&!exports.nodeType&&exports,me=ve&&"object"==typeof module&&module&&!module.nodeType&&module,_e=me&&me.exports===ve?_.Buffer:void 0;const Ee=(_e?_e.isBuffer:void 0)||function(){return!1};var Te=9007199254740991,be=/^(?:0|[1-9]\d*)$/;function Se(e,t){var i=typeof e;return!!(t=null==t?Te:t)&&("number"==i||"symbol"!=i&&be.test(e))&&e>-1&&e%1==0&&e<t}var Ce=9007199254740991;function ke(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ce}var Ie={};function Pe(e){return function(t){return e(t)}}Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Arguments]"]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object Boolean]"]=Ie["[object DataView]"]=Ie["[object Date]"]=Ie["[object Error]"]=Ie["[object Function]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie["[object Object]"]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object WeakMap]"]=!1;var De="object"==typeof exports&&exports&&!exports.nodeType&&exports,we=De&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=we&&we.exports===De&&v.process;const Re=function(){try{var e=we&&we.require&&we.require("util").types;return e||Ae&&Ae.binding&&Ae.binding("util")}catch(t){}}();var xe=Re&&Re.isTypedArray;const Oe=xe?Pe(xe):function(e){return ce(e)&&ke(e.length)&&!!Ie[w(e)]};var Le=Object.prototype.hasOwnProperty;function Ne(e,t){var i=ye(e),n=!i&&ge(e),r=!i&&!n&&Ee(e),o=!i&&!n&&!r&&Oe(e),a=i||n||r||o,s=a?function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}(e.length,String):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||a&&("length"==c||r&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Se(c,l))||s.push(c);return s}var Me=Object.prototype;function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Me)}function Be(e,t){return function(i){return e(t(i))}}const Fe=Be(Object.keys,Object);var He=Object.prototype.hasOwnProperty;function je(e){return null!=e&&ke(e.length)&&!N(e)}function Ve(e){return je(e)?Ne(e):function(e){if(!Ue(e))return Fe(e);var t=[];for(var i in Object(e))He.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var Ke=Object.prototype.hasOwnProperty;function We(e){if(!A(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=Ue(e),i=[];for(var n in e)("constructor"!=n||!t&&Ke.call(e,n))&&i.push(n);return i}function Ge(e){return je(e)?Ne(e,!0):We(e)}var Ye="object"==typeof exports&&exports&&!exports.nodeType&&exports,ze=Ye&&"object"==typeof module&&module&&!module.nodeType&&module,$e=ze&&ze.exports===Ye?_.Buffer:void 0,Xe=$e?$e.allocUnsafe:void 0;function qe(e,t){if(t)return e.slice();var i=e.length,n=Xe?Xe(i):new e.constructor(i);return e.copy(n),n}function Ze(e,t){var i=-1,n=e.length;for(t||(t=Array(n));++i<n;)t[i]=e[i];return t}function Qe(){return[]}var Je=Object.prototype.propertyIsEnumerable,et=Object.getOwnPropertySymbols;const tt=et?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,n=null==e?0:e.length,r=0,o=[];++i<n;){var a=e[i];t(a,i,e)&&(o[r++]=a)}return o}(et(e),(function(t){return Je.call(e,t)})))}:Qe;function it(e,t){for(var i=-1,n=t.length,r=e.length;++i<n;)e[r+i]=t[i];return e}const nt=Be(Object.getPrototypeOf,Object);const rt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)it(t,tt(e)),e=nt(e);return t}:Qe;function ot(e,t,i){var n=t(e);return ye(e)?n:it(n,i(e))}function at(e){return ot(e,Ve,tt)}function st(e){return ot(e,Ge,rt)}const lt=$(_,"DataView");const ct=$(_,"Promise");const ut=$(_,"Set");const ht=$(_,"WeakMap");var dt="[object Map]",ft="[object Promise]",pt="[object Set]",gt="[object WeakMap]",yt="[object DataView]",vt=H(lt),mt=H(X),_t=H(ct),Et=H(ut),Tt=H(ht),bt=w;(lt&&bt(new lt(new ArrayBuffer(1)))!=yt||X&&bt(new X)!=dt||ct&&bt(ct.resolve())!=ft||ut&&bt(new ut)!=pt||ht&&bt(new ht)!=gt)&&(bt=function(e){var t=w(e),i="[object Object]"==t?e.constructor:void 0,n=i?H(i):"";if(n)switch(n){case vt:return yt;case mt:return dt;case _t:return ft;case Et:return pt;case Tt:return gt}return t});const St=bt;var Ct=Object.prototype.hasOwnProperty;const kt=_.Uint8Array;function It(e){var t=new e.constructor(e.byteLength);return new kt(t).set(new kt(e)),t}var Pt=/\w*$/;var Dt=E?E.prototype:void 0,wt=Dt?Dt.valueOf:void 0;function At(e,t){var i=t?It(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}var Rt="[object Boolean]",xt="[object Date]",Ot="[object Map]",Lt="[object Number]",Nt="[object RegExp]",Mt="[object Set]",Ut="[object String]",Bt="[object Symbol]",Ft="[object ArrayBuffer]",Ht="[object DataView]",jt="[object Float32Array]",Vt="[object Float64Array]",Kt="[object Int8Array]",Wt="[object Int16Array]",Gt="[object Int32Array]",Yt="[object Uint8Array]",zt="[object Uint8ClampedArray]",$t="[object Uint16Array]",Xt="[object Uint32Array]";function qt(e,t,i){var n,r,o,a=e.constructor;switch(t){case Ft:return It(e);case Rt:case xt:return new a(+e);case Ht:return function(e,t){var i=t?It(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,i);case jt:case Vt:case Kt:case Wt:case Gt:case Yt:case zt:case $t:case Xt:return At(e,i);case Ot:return new a;case Lt:case Ut:return new a(e);case Nt:return(o=new(r=e).constructor(r.source,Pt.exec(r))).lastIndex=r.lastIndex,o;case Mt:return new a;case Bt:return n=e,wt?Object(wt.call(n)):{}}}var Zt=Object.create;const Qt=function(){function e(){}return function(t){if(!A(t))return{};if(Zt)return Zt(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();function Jt(e){return"function"!=typeof e.constructor||Ue(e)?{}:Qt(nt(e))}var ei=Re&&Re.isMap;const ti=ei?Pe(ei):function(e){return ce(e)&&"[object Map]"==St(e)};var ii=Re&&Re.isSet;const ni=ii?Pe(ii):function(e){return ce(e)&&"[object Set]"==St(e)};var ri=1,oi=2,ai=4,si="[object Arguments]",li="[object Function]",ci="[object GeneratorFunction]",ui="[object Object]",hi={};function di(e,t,i,n,r,o){var a,s=t&ri,l=t&oi,c=t&ai;if(i&&(a=r?i(e,n,r,o):i(e)),void 0!==a)return a;if(!A(e))return e;var u=ye(e);if(u){if(a=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&Ct.call(e,"index")&&(i.index=e.index,i.input=e.input),i}(e),!s)return Ze(e,a)}else{var h=St(e),d=h==li||h==ci;if(Ee(e))return qe(e,s);if(h==ui||h==si||d&&!r){if(a=l||d?{}:Jt(e),!s)return l?function(e,t){return le(e,rt(e),t)}(e,function(e,t){return e&&le(t,Ge(t),e)}(a,e)):function(e,t){return le(e,tt(e),t)}(e,function(e,t){return e&&le(t,Ve(t),e)}(a,e))}else{if(!hi[h])return r?e:{};a=qt(e,h,s)}}o||(o=new ie);var f=o.get(e);if(f)return f;o.set(e,a),ni(e)?e.forEach((function(n){a.add(di(n,t,i,n,e,o))})):ti(e)&&e.forEach((function(n,r){a.set(r,di(n,t,i,r,e,o))}));var p=u?void 0:(c?l?st:at:l?Ge:Ve)(e);return function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n&&!1!==t(e[i],i,e););}(p||e,(function(n,r){p&&(n=e[r=n]),se(a,r,di(n,t,i,r,e,o))})),a}hi[si]=hi["[object Array]"]=hi["[object ArrayBuffer]"]=hi["[object DataView]"]=hi["[object Boolean]"]=hi["[object Date]"]=hi["[object Float32Array]"]=hi["[object Float64Array]"]=hi["[object Int8Array]"]=hi["[object Int16Array]"]=hi["[object Int32Array]"]=hi["[object Map]"]=hi["[object Number]"]=hi[ui]=hi["[object RegExp]"]=hi["[object Set]"]=hi["[object String]"]=hi["[object Symbol]"]=hi["[object Uint8Array]"]=hi["[object Uint8ClampedArray]"]=hi["[object Uint16Array]"]=hi["[object Uint32Array]"]=!0,hi["[object Error]"]=hi[li]=hi["[object WeakMap]"]=!1;var fi;function pi(e){return di(e,5)}function gi(e,t,i){(void 0!==i&&!f(e[t],i)||void 0===i&&!(t in e))&&oe(e,t,i)}const yi=function(e,t,i){for(var n=-1,r=Object(e),o=i(e),a=o.length;a--;){var s=o[fi?a:++n];if(!1===t(r[s],s,r))break}return e};var vi="[object Object]",mi=Function.prototype,_i=Object.prototype,Ei=mi.toString,Ti=_i.hasOwnProperty,bi=Ei.call(Object);function Si(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function Ci(e,t,i,n,r,o,a){var s=Si(e,i),l=Si(t,i),c=a.get(l);if(c)gi(e,i,c);else{var u,h=o?o(s,l,i+"",e,t,a):void 0,d=void 0===h;if(d){var f=ye(l),p=!f&&Ee(l),g=!f&&!p&&Oe(l);h=l,f||p||g?ye(s)?h=s:ce(u=s)&&je(u)?h=Ze(s):p?(d=!1,h=qe(l,!0)):g?(d=!1,h=At(l,!0)):h=[]:function(e){if(!ce(e)||w(e)!=vi)return!1;var t=nt(e);if(null===t)return!0;var i=Ti.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Ei.call(i)==bi}(l)||ge(l)?(h=s,ge(s)?h=function(e){return le(e,Ge(e))}(s):A(s)&&!N(s)||(h=Jt(l))):d=!1}d&&(a.set(l,h),r(h,l,n,o,a),a.delete(l)),gi(e,i,h)}}function ki(e,t,i,n,r){e!==t&&yi(t,(function(o,a){if(r||(r=new ie),A(o))Ci(e,t,a,i,ki,n,r);else{var s=n?n(Si(e,a),o,a+"",e,t,r):void 0;void 0===s&&(s=o),gi(e,a,s)}}),Ge)}function Ii(e){return e}var Pi=Math.max;var Di=re?function(e,t){return re(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:Ii;const wi=Di;var Ai=Date.now;var Ri,xi,Oi,Li=(Ri=wi,xi=0,Oi=0,function(){var e=Ai(),t=16-(e-Oi);if(Oi=e,t>0){if(++xi>=800)return arguments[0]}else xi=0;return Ri.apply(void 0,arguments)});const Ni=Li;function Mi(e,t){return Ni(function(e,t,i){return t=Pi(void 0===t?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=Pi(n.length-t,0),a=Array(o);++r<o;)a[r]=n[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=n[r];return s[t]=i(a),function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}(e,this,s)}}(e,t,Ii),e+"")}function Ui(e){return Mi((function(t,i){var n=-1,r=i.length,o=r>1?i[r-1]:void 0,a=r>2?i[2]:void 0;for(o=e.length>3&&"function"==typeof o?(r--,o):void 0,a&&function(e,t,i){if(!A(i))return!1;var n=typeof t;return!!("number"==n?je(i)&&Se(t,i.length):"string"==n&&t in i)&&f(i[t],e)}(i[0],i[1],a)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var s=i[n];s&&e(t,s,n,o)}return t}))}const Bi=Ui((function(e,t,i,n){ki(e,t,i,n)}));function Fi(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new te;++t<i;)this.add(e[t])}function Hi(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1}function ji(e,t){return e.has(t)}Fi.prototype.add=Fi.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Fi.prototype.has=function(e){return this.__data__.has(e)};var Vi=1,Ki=2;function Wi(e,t,i,n,r,o){var a=i&Vi,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var h=-1,d=!0,f=i&Ki?new Fi:void 0;for(o.set(e,t),o.set(t,e);++h<s;){var p=e[h],g=t[h];if(n)var y=a?n(g,p,h,t,e,o):n(p,g,h,e,t,o);if(void 0!==y){if(y)continue;d=!1;break}if(f){if(!Hi(t,(function(e,t){if(!ji(f,t)&&(p===e||r(p,e,i,n,o)))return f.push(t)}))){d=!1;break}}else if(p!==g&&!r(p,g,i,n,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function Gi(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i}function Yi(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var zi=1,$i=2,Xi="[object Boolean]",qi="[object Date]",Zi="[object Error]",Qi="[object Map]",Ji="[object Number]",en="[object RegExp]",tn="[object Set]",nn="[object String]",rn="[object Symbol]",on="[object ArrayBuffer]",an="[object DataView]",sn=E?E.prototype:void 0,ln=sn?sn.valueOf:void 0;var cn=1,un=Object.prototype.hasOwnProperty;var hn=1,dn="[object Arguments]",fn="[object Array]",pn="[object Object]",gn=Object.prototype.hasOwnProperty;function yn(e,t,i,n,r,o){var a=ye(e),s=ye(t),l=a?fn:St(e),c=s?fn:St(t),u=(l=l==dn?pn:l)==pn,h=(c=c==dn?pn:c)==pn,d=l==c;if(d&&Ee(e)){if(!Ee(t))return!1;a=!0,u=!1}if(d&&!u)return o||(o=new ie),a||Oe(e)?Wi(e,t,i,n,r,o):function(e,t,i,n,r,o,a){switch(i){case an:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case on:return!(e.byteLength!=t.byteLength||!o(new kt(e),new kt(t)));case Xi:case qi:case Ji:return f(+e,+t);case Zi:return e.name==t.name&&e.message==t.message;case en:case nn:return e==t+"";case Qi:var s=Gi;case tn:var l=n&zi;if(s||(s=Yi),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;n|=$i,a.set(e,t);var u=Wi(s(e),s(t),n,r,o,a);return a.delete(e),u;case rn:if(ln)return ln.call(e)==ln.call(t)}return!1}(e,t,l,i,n,r,o);if(!(i&hn)){var p=u&&gn.call(e,"__wrapped__"),g=h&&gn.call(t,"__wrapped__");if(p||g){var y=p?e.value():e,v=g?t.value():t;return o||(o=new ie),r(y,v,i,n,o)}}return!!d&&(o||(o=new ie),function(e,t,i,n,r,o){var a=i&cn,s=at(e),l=s.length;if(l!=at(t).length&&!a)return!1;for(var c=l;c--;){var u=s[c];if(!(a?u in t:un.call(t,u)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var f=!0;o.set(e,t),o.set(t,e);for(var p=a;++c<l;){var g=e[u=s[c]],y=t[u];if(n)var v=a?n(y,g,u,t,e,o):n(g,y,u,e,t,o);if(!(void 0===v?g===y||r(g,y,i,n,o):v)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var m=e.constructor,_=t.constructor;m==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _||(f=!1)}return o.delete(e),o.delete(t),f}(e,t,i,n,r,o))}function vn(e,t,i,n,r){return e===t||(null==e||null==t||!ce(e)&&!ce(t)?e!=e&&t!=t:yn(e,t,i,n,vn,r))}var mn=1,_n=2;function En(e){return e==e&&!A(e)}function Tn(e,t){return function(i){return null!=i&&(i[e]===t&&(void 0!==t||e in Object(i)))}}function bn(e){var t=function(e){for(var t=Ve(e),i=t.length;i--;){var n=t[i],r=e[n];t[i]=[n,r,En(r)]}return t}(e);return 1==t.length&&t[0][2]?Tn(t[0][0],t[0][1]):function(i){return i===e||function(e,t,i,n){var r=i.length,o=r,a=!n;if(null==e)return!o;for(e=Object(e);r--;){var s=i[r];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++r<o;){var l=(s=i[r])[0],c=e[l],u=s[1];if(a&&s[2]){if(void 0===c&&!(l in e))return!1}else{var h=new ie;if(n)var d=n(c,u,l,e,t,h);if(!(void 0===d?vn(u,c,mn|_n,n,h):d))return!1}}return!0}(i,e,t)}}var Sn="[object Symbol]";function Cn(e){return"symbol"==typeof e||ce(e)&&w(e)==Sn}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,In=/^\w*$/;function Pn(e,t){if(ye(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Cn(e))||(In.test(e)||!kn.test(e)||null!=t&&e in Object(t))}var Dn="Expected a function";function wn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Dn);var i=function(){var n=arguments,r=t?t.apply(this,n):n[0],o=i.cache;if(o.has(r))return o.get(r);var a=e.apply(this,n);return i.cache=o.set(r,a)||o,a};return i.cache=new(wn.Cache||te),i}wn.Cache=te;var An=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rn=/\\(\\)?/g,xn=function(e){var t=wn(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(An,(function(e,i,n,r){t.push(n?r.replace(Rn,"$1"):i||e)})),t}));const On=xn;var Ln=1/0,Nn=E?E.prototype:void 0,Mn=Nn?Nn.toString:void 0;function Un(e){if("string"==typeof e)return e;if(ye(e))return function(e,t){for(var i=-1,n=null==e?0:e.length,r=Array(n);++i<n;)r[i]=t(e[i],i,e);return r}(e,Un)+"";if(Cn(e))return Mn?Mn.call(e):"";var t=e+"";return"0"==t&&1/e==-Ln?"-0":t}function Bn(e,t){return ye(e)?e:Pn(e,t)?[e]:On(function(e){return null==e?"":Un(e)}(e))}var Fn=1/0;function Hn(e){if("string"==typeof e||Cn(e))return e;var t=e+"";return"0"==t&&1/e==-Fn?"-0":t}function jn(e,t){for(var i=0,n=(t=Bn(t,e)).length;null!=e&&i<n;)e=e[Hn(t[i++])];return i&&i==n?e:void 0}function Vn(e,t,i){var n=null==e?void 0:jn(e,t);return void 0===n?i:n}function Kn(e,t){return null!=e&&t in Object(e)}function Wn(e,t){return null!=e&&function(e,t,i){for(var n=-1,r=(t=Bn(t,e)).length,o=!1;++n<r;){var a=Hn(t[n]);if(!(o=null!=e&&i(e,a)))break;e=e[a]}return o||++n!=r?o:!!(r=null==e?0:e.length)&&ke(r)&&Se(a,r)&&(ye(e)||ge(e))}(e,t,Kn)}var Gn=1,Yn=2;function zn(e){return Pn(e)?(t=Hn(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return jn(t,e)}}(e);var t}function $n(e){return"function"==typeof e?e:null==e?Ii:"object"==typeof e?ye(e)?(t=e[0],i=e[1],Pn(t)&&En(i)?Tn(Hn(t),i):function(e){var n=Vn(e,t);return void 0===n&&n===i?Wn(e,t):vn(i,n,Gn|Yn)}):bn(e):zn(e);var t,i}function Xn(e){return e!=e}function qn(e,t){return!!(null==e?0:e.length)&&function(e,t,i){return t==t?function(e,t,i){for(var n=i-1,r=e.length;++n<r;)if(e[n]===t)return n;return-1}(e,t,i):function(e,t,i,n){for(var r=e.length,o=i+(n?1:-1);n?o--:++o<r;)if(t(e[o],o,e))return o;return-1}(e,Xn,i)}(e,t,0)>-1}function Zn(e,t,i){for(var n=-1,r=null==e?0:e.length;++n<r;)if(i(t,e[n]))return!0;return!1}const Qn=ut&&1/Yi(new ut([,-0]))[1]==1/0?function(e){return new ut(e)}:function(){};var Jn=200;function er(e,t){return e&&e.length?function(e,t,i){var n=-1,r=qn,o=e.length,a=!0,s=[],l=s;if(i)a=!1,r=Zn;else if(o>=Jn){var c=t?null:Qn(e);if(c)return Yi(c);a=!1,r=ji,l=new Fi}else l=t?[]:s;e:for(;++n<o;){var u=e[n],h=t?t(u):u;if(u=i||0!==u?u:0,a&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue e;t&&l.push(h),s.push(u)}else r(l,h,i)||(l!==s&&l.push(h),s.push(u))}return s}(e,$n(t)):[]}const tr={H264:"h264",H265:"h265",H266:"h266",AAC:"aac",MP3:"mp3",OPUS:"opus",UNKNOWN:"unknown"},ir={[tr.H265]:'video/mp4; codecs="hev1.1.6.L120.90"',[tr.H264]:'video/mp4; codecs="avc1.42c01e"'};var nr=(e=>(e.MP4="mp4",e.DASH="dash",e.HLS="hls",e))(nr||{}),rr=(e=>(e.M4A="m4a",e.MP4="mp4",e.MP3="mp3",e.DASH="dash",e.HLS="hls",e.OGG="ogg",e))(rr||{}),or=(e=>(e.DRM_ENCRYPT="drm_encrypt",e.PRIVATE_ENCRYPT="private_encrypt",e.PRIVATE_ENCRYPT_UPGRADE="private_encrypt_upgrade",e.STANDARD_ENCRYPT="standard_encrypt",e))(or||{}),ar="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lr=function(){let e,t=null;function i(e){return!!e&&("object"==typeof e||"function"==typeof e)}function n(e){if(null!==e&&!i(e))throw new TypeError("Object prototype may only be an Object or null: "+e)}const r=Object,o=Boolean(r.create)||!({__proto__:null}instanceof r),a=r.create||(o?function(e){return n(e),{__proto__:e}}:function(e){if(n(e),null===e)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var t=function(){};return t.prototype=e,new t}),s=function(){return null},l=r.getPrototypeOf||([].__proto__===Array.prototype?function(e){const t=e.__proto__;return i(t)?t:null}:s);return e=function(c,u){if(void 0===(this&&this instanceof e?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!i(c)||!i(u))throw new TypeError("Cannot create proxy with a non-object as target or handler");let h=function(){};t=function(){c=null,h=function(e){throw new TypeError(`Cannot perform '${e}' on a proxy that has been revoked`)}},setTimeout((function(){t=null}),0);const d=u;u={get:null,set:null,apply:null,construct:null};for(let e in d){if(!(e in u))throw new TypeError(`Proxy polyfill does not support trap '${e}'`);u[e]=d[e]}"function"==typeof d&&(u.apply=d.apply.bind(d));const f=l(c);let p,g=!1,y=!1;"function"==typeof c?(p=function(){const e=this&&this.constructor===p,t=Array.prototype.slice.call(arguments);if(h(e?"construct":"apply"),e&&u.construct)return u.construct.call(this,c,t);if(!e&&u.apply)return u.apply(c,this,t);if(e){t.unshift(c);return new(c.bind.apply(c,t))}return c.apply(this,t)},g=!0):c instanceof Array?(p=[],y=!0):p=o||null!==f?a(f):{};const v=u.get?function(e){return h("get"),u.get(this,e,p)}:function(e){return h("get"),this[e]},m=u.set?function(e,t){h("set"),u.set(this,e,t,p)}:function(e,t){h("set"),this[e]=t},_=r.getOwnPropertyNames(c),E={};_.forEach((function(e){if((g||y)&&e in p)return;const t=r.getOwnPropertyDescriptor(c,e),i={enumerable:Boolean(t.enumerable),get:v.bind(c,e),set:m.bind(c,e)};r.defineProperty(p,e,i),E[e]=!0}));let T=!0;if(g||y){const e=r.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return n(t),e.__proto__=t,e}:s);f&&e(p,f)||(T=!1)}if(u.get||!T)for(let e in c)E[e]||r.defineProperty(p,e,{get:v.bind(c,e)});return r.seal(c),r.seal(p),p},e.revocable=function(i,n){return{proxy:new e(i,n),revoke:t}},e};const cr=sr(lr)();const ur=new class{constructor(){this.subscribeId=0,this.watcherMap=new Map}observe(e){const t=new cr(e,{set:(e,i,n)=>{const r=Reflect.get(e,i);Reflect.set(e,i,n);const o=this.watcherMap.get(t);return o&&(this.flushCallback(o),this.flushPropertyCallback(o,i,r,n)),!0}});return this.watcherMap.set(t,{pending:!1,queue:[],property:{}}),t}subscribe(e,t){const i=this.watcherMap.get(e);if(!i)return;this.subscribeId++;return i.queue.push({id:this.subscribeId,callback:t}),this.subscribeId}unsubscribe(e,t){const i=this.watcherMap.get(e);if(!i)return;const n=i.queue,r=n.findIndex((e=>e.id===t));void 0!==r&&r>-1&&n.splice(r,1)}subscribeProperty(e,t,i){const n=this.watcherMap.get(e);if(n){this.subscribeId++,n.property[t]||(n.property[t]={pending:!1,timer:0,pre:null,queue:[]});return n.property[t].queue.push({id:this.subscribeId,callback:i}),this.subscribeId}}unsubscribeProperty(e,t,i){const n=this.watcherMap.get(e);if(n){const e=n.property[t];if(e){const t=e.queue,n=t.findIndex((e=>e.id===i));void 0!==n&&n>-1&&t.splice(n,1)}}}flushCallback(e){e.pending||(e.pending=!0,setTimeout((()=>{e.queue.forEach((e=>e.callback())),e.pending=!1}),0))}flushPropertyCallback(e,t,i,n){const r=e.property[t];r&&(clearTimeout(r.timer),!1===r.pending&&(r.pending=!0,r.pre=i),r.timer=setTimeout((()=>{r.queue.forEach((e=>e.callback(r.pre,n))),r.pending=!1}),0))}};function hr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function dr(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(i),!0).forEach((function(t){vr(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):hr(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function fr(e){return(fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gr(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Pr(n.key),n)}}function yr(e,t,i){return t&&gr(e.prototype,t),i&&gr(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function vr(e,t,i){return(t=Pr(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function mr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Er(e,t)}function _r(e){return(_r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Er(e,t){return(Er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Tr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function br(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Tr(e)}function Sr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=_r(e);if(t){var r=_r(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return br(this,i)}}function Cr(){return Cr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_r(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}},Cr.apply(this,arguments)}function kr(e){return function(e){if(Array.isArray(e))return Ir(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ir(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Ir(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function Pr(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var Dr={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new r(n,o||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,r),!0;case 5:return u.fn.call(u.context,t,n,r,o),!0;case 6:return u.fn.call(u.context,t,n,r,o,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||n&&s.context!==n||a(this,o);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||r&&!s[l].once||n&&s[l].context!==n)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(Dr);var wr=Dr.exports;const Ar=sr(wr);var Rr="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,xr={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Or="%c[xgplayer]",Lr={config:{debug:Rr?3:0},logInfo:function(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];this.config.debug>=3&&(t=console).log.apply(t,[Or,xr.info,e].concat(n))},logWarn:function(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];this.config.debug>=1&&(t=console).warn.apply(t,[Or,xr.warn,e].concat(n))},logError:function(e){var t;if(!(this.config.debug<1)){for(var i=this.config.debug>=2?"trace":"error",n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console)[i].apply(t,[Or,xr.error,e].concat(r))}}};var Nr=function(){function e(t){pr(this,e),this.bufferedList=t}return yr(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}(),Mr={};function Ur(e){var t=fr(e);return null!==e&&("object"===t||"function"===t)}function Br(e,t,i){var n,r,o,a,s,l,c=0,u=!1,h=!1,d=!0,f=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var i=n,o=r;return n=r=void 0,c=t,a=e.apply(o,i)}function g(e,t){return f?(window.cancelAnimationFrame(s),window.requestAnimationFrame(e)):setTimeout(e,t)}function y(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function v(){var e=Date.now();if(y(e))return m(e);s=g(v,function(e){var i=e-c,n=t-(e-l);return h?Math.min(n,o-i):n}(e))}function m(e){return s=void 0,d&&n?p(e):(n=r=void 0,a)}function _(){for(var e=Date.now(),i=y(e),o=arguments.length,d=new Array(o),f=0;f<o;f++)d[f]=arguments[f];if(n=d,r=this,l=e,i){if(void 0===s)return function(e){return c=e,s=g(v,t),u?p(e):a}(l);if(h)return s=g(v,t),p(l)}return void 0===s&&(s=g(v,t)),a}return t=+t||0,Ur(i)&&(u=!!i.leading,o=(h="maxWait"in i)?Math.max(+i.maxWait||0,t):o,d="trailing"in i?!!i.trailing:d),_.cancel=function(){void 0!==s&&function(e){if(f)return window.cancelAnimationFrame(e);clearTimeout(e)}(s),c=0,n=l=r=s=void 0},_.flush=function(){return void 0===s?a:m(Date.now())},_.pending=function(){return void 0!==s},_}Mr.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(e);return r.className=n,r.innerHTML=t,Object.keys(i).forEach((function(t){var n=t,o=i[t];"video"===e||"audio"===e||"live-video"===e?o&&r.setAttribute(n,o):r.setAttribute(n,o)})),r},Mr.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var r=n.children;return n=null,r.length>0?(r=r[0],i&&Mr.addClass(r,i),t&&Object.keys(t).forEach((function(e){r.setAttribute(e,t[e])})),r):null}catch(o){return Lr.logError("util.createDomFromHtml",o),null}},Mr.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(n){var i=e.className&&"object"===fr(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},Mr.addClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)}))}catch(i){Mr.hasClass(e,t)||(e.className&&"object"===fr(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},Mr.removeClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.remove(t)}))}catch(i){Mr.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===fr(e.className)?e.setAttribute("class",e.getAttribute("class").replace(i," ")):e.className=e.className.replace(i," ")}))}},Mr.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){Mr.hasClass(e,t)?Mr.removeClass(e,t):Mr.addClass(e,t)}))},Mr.classNames=function(){for(var e=arguments,t=[],i=function(i){"String"===Mr.typeOf(e[i])?t.push(e[i]):"Object"===Mr.typeOf(e[i])&&Object.keys(e[i]).map((function(n){e[i][n]&&t.push(n)}))},n=0;n<arguments.length;n++)i(n);return t.join(" ")},Mr.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,i=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(i)}catch(n){Lr.logError("util.findDom",n),0===i.indexOf("#")&&(e=t.getElementById(i.slice(1)))}return e},Mr.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},Mr.padStart=function(e,t,i){for(var n=String(i),r=t>>0,o=Math.ceil(r/n.length),a=[],s=String(e);o--;)a.push(n);return a.join("").substring(0,r-s.length)+s},Mr.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=Mr.padStart(Math.floor(e/3600),2,0),i=Mr.padStart(Math.floor((e-3600*t)/60),2,0),n=Mr.padStart(Math.floor(e-3600*t-60*i),2,0);return("00"===t?[i,n]:[t,i,n]).join(":")},Mr.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},Mr.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Mr.deepCopy=function(e,t){if("Object"===Mr.typeOf(t)&&"Object"===Mr.typeOf(e))return Object.keys(t).forEach((function(i){"Object"!==Mr.typeOf(t[i])||t[i]instanceof Node?"Array"===Mr.typeOf(t[i])?e[i]="Array"===Mr.typeOf(e[i])?e[i].concat(t[i]):t[i]:e[i]=t[i]:void 0===e[i]||void 0===e[i]?e[i]=t[i]:Mr.deepCopy(e[i],t[i])})),e},Mr.deepMerge=function(e,t){return Object.keys(t).map((function(i){var n;"Array"===Mr.typeOf(t[i])&&"Array"===Mr.typeOf(e[i])?"Array"===Mr.typeOf(e[i])&&(n=e[i]).push.apply(n,kr(t[i])):Mr.typeOf(e[i])!==Mr.typeOf(t[i])||null===e[i]||"Object"!==Mr.typeOf(e[i])||t[i]instanceof window.Node?null!==t[i]&&(e[i]=t[i]):Mr.deepMerge(e[i],t[i])})),e},Mr.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var i=document.createElement("a");return i.href=t.replace(/url\("|"\)/g,""),i.href},Mr.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},Mr.setInterval=function(e,t,i,n){e._interval[t]||(e._interval[t]=window.setInterval(i.bind(e),n))},Mr.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},Mr.setTimeout=function(e,t,i){e._timers||(e._timers=[]);var n=setTimeout((function(){t(),Mr.clearTimeout(e,n)}),i);return e._timers.push(n),n},Mr.clearTimeout=function(e,t){var i=e._timers;if("Array"===Mr.typeOf(i)){for(var n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),clearTimeout(t);break}}else clearTimeout(t)},Mr.clearAllTimers=function(e){var t=e._timers;"Array"===Mr.typeOf(t)&&(t.map((function(e){clearTimeout(e)})),e._timerIds=[])},Mr.createImgBtn=function(e,t,i,n){var r,o,a,s=Mr.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(s.style.backgroundImage='url("'.concat(t,'")'),i&&n)&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){return!(i.indexOf(e)>-1&&n.indexOf(e)>-1)||(r=parseFloat(i.slice(0,i.indexOf(e)).trim()),o=parseFloat(n.slice(0,n.indexOf(e)).trim()),a=e,!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),s.style.margin="start"===e?"-".concat(o/2).concat(a," auto auto -").concat(r/2).concat(a):"auto 5px auto 5px");return s},Mr.Hex2RGBA=function(e,t){var i=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var n="#";e.replace(/[0-9A-F]/gi,(function(e){n+=e+e})),e=n}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){i.push(parseInt(e,16))})),"rgba(".concat(i.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},Mr.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},Mr.checkIsFunction=function(e){return e&&"function"==typeof e},Mr.checkIsObject=function(e){return null!==e&&"object"===fr(e)},Mr.hide=function(e){e.style.display="none"},Mr.show=function(e,t){e.style.display=t||"block"},Mr.isUndefined=function(e){if(null==e)return!0},Mr.isNotNull=function(e){return!(null==e)},Mr.setStyleFromCsstext=function(e,t){t&&("String"===Mr.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var i=t.split(":");i.length>1&&(e.style[i[0]]=i[1])}})):Object.keys(t).map((function(i){e.style[i]=t[i]})))},Mr.filterStyleFromText=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],i=e.style.cssText;if(!i)return{};var n=i.replace(/\s+/g,"").split(";"),r={},o={};return n.map((function(e){if(e){var i=e.split(":");i.length>1&&(!function(e,t){for(var i=0,n=t.length;i<n;i++)if(e.indexOf(t[i])>-1)return!0;return!1}(i[0],t)?o[i[0]]=i[1]:r[i[0]]=i[1])}})),e.setAttribute("style",""),Object.keys(o).map((function(t){e.style[t]=o[t]})),r},Mr.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var i=t.replace(/\s+/g,"").split(";"),n={};return i.map((function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},Mr.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var n=new window.Image;n.onload=function(e){n=null,t&&t(e)},n.onerror=function(e){n=null,i&&i(e)},n.src=e}},Mr.stopPropagation=function(e){e&&e.stopPropagation()},Mr.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Mr.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},Mr.checkTouchSupport=function(){return"ontouchstart"in window},Mr.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=[],n=0;n<e.length;n++)i.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});i.sort((function(e,t){var i=e.start-t.start;return i||t.end-e.end}));var r=[];if(t)for(var o=0;o<i.length;o++){var a=r.length;if(a){var s=r[a-1].end;i[o].start-s<t?i[o].end>s&&(r[a-1].end=i[o].end):r.push(i[o])}else r.push(i[o])}else r=i;return new Nr(r)},Mr.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},Mr.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},Mr.getHostFromUrl=function(e){if("String"!==Mr.typeOf(e))return"";var t=e.split("/"),i="";return t.length>3&&t[2]&&(i=t[2]),i},Mr.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},Mr.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},Mr.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},Mr.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch(i){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)}))},Mr.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},Mr.adjustTimeByDuration=function(e,t,i){return t&&e&&(e>t||i&&e<t)?t:e},Mr.createPositionBar=function(e,t){var i=Mr.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(i),i},Mr.getTransformStyle=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(i).forEach((function(e){var n=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),r="".concat(e,"(").concat(i[e],")");n.test(t)?(n.lastIndex=-1,t=t.replace(n,r)):t+="".concat(r," ")})),t},Mr.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},Mr.getIndexByTime=function(e,t){var i=t.length,n=-1;if(i<1)return n;if(e<=t[0].end||i<2)n=0;else if(e>t[i-1].end)n=i-1;else for(var r=1;r<i;r++)if(e>t[r-1].end&&e<=t[r].end){n=r;break}return n},Mr.getOffsetCurrentTime=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=i>=0&&i<t.length?i:Mr.getIndexByTime(e,t))<0)return-1;var r=t.length,o=t[n],a=o.start,s=o.end,l=o.cTime,c=o.offset;return e<a?l:e>=a&&e<=s?e-c:e>s&&n>=r-1?s:-1},Mr.getCurrentTimeByOffset=function(e,t){var i=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){i=n;break}if(-1!==i){var r=t[i].start;return i-1<0?r+e:r+(e-t[i-1].duration)}return e};var Fr=/(Android)\s([\d.]+)/,Hr=/(Version)\/([\d.]+)/,jr=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],Vr={get device(){return Vr.os.isPc?"pc":"mobile"},get browser(){if("undefined"==typeof navigator)return"";var e=navigator.userAgent.toLowerCase(),t={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(t).filter((function(i){return t[i].test(e)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),i=/(?:SymbianOS)/.test(e)||t,n=/(?:Tizen)/gi.test(e),r=/(?:Web0S)/gi.test(e),o=/(?:Android)/.test(e),a=/(?:Firefox)/.test(e),s=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,l=s||o&&!/(?:Mobile)/.test(e)||a&&/(?:Tablet)/.test(e),c=/(?:iPhone)/.test(e)&&!l;return{isTablet:l,isPhone:c,isIpad:s,isIos:c||s,isAndroid:o,isPc:!(c||o||i||l),isSymbian:i,isWindowsPhone:t,isFireFox:a,isTizen:n,isWebOS:r}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",i=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?Hr:Fr)?t.exec(e):[];if(i&&i.length>=3){var n=i[2].split(".");return n.length>0?parseInt(n[0]):0}return 0},get isWeixin(){if("undefined"==typeof navigator)return!1;return!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&jr.map((function(i){"probably"===t.canPlayType('video/mp4; codecs="'.concat(i,'"'))&&(e.isSupport=!0,e.mime+="||".concat(i))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var i=e.video||{},n=e.audio||{};try{var r=MediaSource.isTypeSupported(i.contentType),o=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:r&&o,smooth:!1,powerEfficient:!1})}catch(a){return Promise.resolve(t)}}},Kr="3.0.23-rc.3",Wr={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},Gr={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Yr=yr((function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};pr(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var r=i.mediaError?i.mediaError:t.media.error||{},o=t.duration,a=t.currentTime,s=t.ended,l=t.src,c=t.currentSrc,u=t.media,h=u.readyState,d=u.networkState,f=i.errorCode||r.code;Gr[f]&&(f=Gr[f]);var p={playerVersion:Kr,currentTime:a,duration:o,ended:s,readyState:h,networkState:d,src:l||c,errorType:i.errorType,errorCode:f,message:i.errorMessage||r.message,mediaError:r,originError:i.originError?i.originError.stack:"",host:Mr.getHostFromUrl(l||c)};return i.ext&&Object.keys(i.ext).map((function(e){p[e]=i.ext[e]})),p}if(arguments.length>1){for(var g={playerVersion:Kr,domain:document.domain},y=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v<arguments.length;v++)g[y[v]]=arguments[v];return g.ex=n?(n[arguments[0]]||{}).msg:"",g}})),zr="play",$r="playing",Xr="ended",qr="pause",Zr="error",Qr="seeking",Jr="seeked",eo="timeupdate",to="waiting",io="canplay",no="durationchange",ro="volumechange",oo="loadeddata",ao="ratechange",so="progress",lo="loadstart",co="emptied",uo="focus",ho="blur",fo="ready",po="urlNull",go="autoplay_started",yo="autoplay_was_prevented",vo="complete",mo="replay",_o="destroy",Eo="urlchange",To="download_speed_change",bo="leaveplayer",So="enterplayer",Co="loading",ko="fullscreen_change",Io="cssFullscreen_change",Po="mini_state_change",Do="definition_change",wo="after_definition_change",Ao="video_resize",Ro="pip_change",xo="rotate",Oo="screenShot",Lo="playnext",No="shortcut",Mo="xglog",Uo="user_action",Bo="reset",Fo="source_error",Ho="source_success",jo=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],Vo={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},Ko="fps_stuck";const Wo=Object.freeze(Object.defineProperty({__proto__:null,ABORT:"abort",AFTER_DEFINITION_CHANGE:wo,AUTOPLAY_PREVENTED:yo,AUTOPLAY_STARTED:go,BEFORE_DEFINITION_CHANGE:"before_definition_change",BUFFER_CHANGE:"bufferedChange",CANPLAY:io,CANPLAY_THROUGH:"canplaythrough",COMPLETE:vo,CSS_FULLSCREEN_CHANGE:Io,DEFINITION_CHANGE:Do,DESTROY:_o,DOWNLOAD_SPEED_CHANGE:To,DURATION_CHANGE:no,EMPTIED:co,ENDED:Xr,ENTER_PLAYER:So,ERROR:Zr,FPS_STUCK:Ko,FULLSCREEN_CHANGE:ko,LEAVE_PLAYER:bo,LOADED_DATA:oo,LOADED_METADATA:"loadedmetadata",LOADING:Co,LOAD_START:lo,MINI_STATE_CHANGE:Po,PAUSE:qr,PIP_CHANGE:Ro,PLAY:zr,PLAYER_BLUR:ho,PLAYER_FOCUS:uo,PLAYING:$r,PLAYNEXT:Lo,PROGRESS:so,RATE_CHANGE:ao,READY:fo,REPLAY:mo,RESET:Bo,RETRY:"retry",ROTATE:xo,SCREEN_SHOT:Oo,SEEKED:Jr,SEEKING:Qr,SEI_PARSED:"SEI_PARSED",SHORTCUT:No,SOURCE_ERROR:Fo,SOURCE_SUCCESS:Ho,STALLED:"stalled",STATS_EVENTS:Vo,SUSPEND:"suspend",SWITCH_SUBTITLE:"switch_subtitle",TIME_UPDATE:eo,URL_CHANGE:Eo,URL_NULL:po,USER_ACTION:Uo,VIDEO_EVENTS:jo,VIDEO_RESIZE:Ao,VOLUME_CHANGE:ro,WAITING:to,XGLOG:Mo},Symbol.toStringTag,{value:"Module"}));function Go(e,t){this&&this.emit&&("error"===e?this.errorHandler(e,t.error):this.emit(e,t))}var Yo=function(e){mr(i,e);var t=Sr(i);function i(e){var n;pr(this,i),(n=t.call(this,e))._hasStart=!1,n._currentTime=0,n._duration=0,n._internalOp={},n._lastMuted=!1,n.vtype="MP4",n._rate=-1,n.mediaConfig=Object.assign({},{controls:!1,autoplay:e.autoplay,playsinline:e.playsinline,"x5-playsinline":e.playsinline,"webkit-playsinline":e.playsinline,"x5-video-player-fullscreen":e["x5-video-player-fullscreen"]||e.x5VideoPlayerFullscreen,"x5-video-orientation":e["x5-video-orientation"]||e.x5VideoOrientation,airplay:e.airplay,"webkit-airplay":e.airplay,tabindex:0|e.tabindex,mediaType:e.mediaType||"video","data-index":-1},e.videoConfig,e.videoAttributes);var r=e["x5-video-player-type"]||e.x5VideoPlayerType;return Vr.isWeixin&&Vr.os.isAndroid&&r&&(n.mediaConfig["x5-video-player-type"]=r,delete n.mediaConfig.playsinline,delete n.mediaConfig["webkit-playsinline"],delete n.mediaConfig["x5-playsinline"]),e.loop&&(n.mediaConfig.loop="loop"),e.autoplayMuted&&!Object.prototype.hasOwnProperty.call(n.mediaConfig,"muted")&&(n.mediaConfig.muted=!0),n.media=e.mediaEl instanceof HTMLMediaElement?e.mediaEl:"function"==typeof e.mediaEl?e.mediaEl(n.mediaConfig):Mr.createDom(n.mediaConfig.mediaType,"",n.mediaConfig,""),e.defaultPlaybackRate&&(n.media.defaultPlaybackRate=n.media.playbackRate=e.defaultPlaybackRate),"Number"===Mr.typeOf(e.volume)&&(n.volume=e.volume),e.autoplayMuted&&(n.media.muted=!0,n._lastMuted=!0),e.autoplay&&(n.media.autoplay=!0),e.playsinline&&(n.media.playsinline=!0),n._interval={},n.mediaEventMiddleware={},n.attachVideoEvents(),n}return yr(i,[{key:"setEventsMiddleware",value:function(e){var t=this;Object.keys(e).map((function(i){t.mediaEventMiddleware[i]=e[i]}))}},{key:"removeEventsMiddleware",value:function(e){var t=this;Object.keys(e).map((function(e){delete t.mediaEventMiddleware[e]}))}},{key:"attachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=jo.map((function(t){var i="on".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));return"function"==typeof e[i]&&e.on(t,e[i]),vr({},t,function(e,t){return function(i,n){var r={player:t,eventName:e,originalEvent:i,detail:i.detail||{},timeStamp:i.timeStamp,currentTime:t.currentTime,duration:t.duration,paused:t.paused,ended:t.ended,isInternalOp:!!t._internalOp[i.type],muted:t.muted,volume:t.volume,host:Mr.getHostFromUrl(t.currentSrc),vtype:t.vtype};if(t.removeInnerOP(i.type),"timeupdate"===e&&(t._currentTime=t.media&&t.media.currentTime),"ratechange"===e){var o=t.media?t.media.playbackRate:0;if(o&&t._rate===o)return;t._rate=t.media&&t.media.playbackRate}if("durationchange"===e&&(t._duration=t.media.duration),"volumechange"===e&&(r.isMutedChange=t._lastMuted!==t.muted,t._lastMuted=t.muted),"error"===e&&(r.error=n||t.video.error),t.mediaEventMiddleware[e]){var a=Go.bind(t,e,r);try{t.mediaEventMiddleware[e].call(t,r,a)}catch(s){throw Go.call(t,e,r),s}}else Go.call(t,e,r)}}(t,e))}))),this._evHandlers.forEach((function(e){var i=Object.keys(e)[0];t.addEventListener(i,e[i],!1)}))}},{key:"detachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers.forEach((function(e){var i=Object.keys(e)[0];t.removeEventListener(i,e[i],!1)})),this._evHandlers.forEach((function(t){var i=Object.keys(t)[0],n="on".concat(i.charAt(0).toUpperCase()).concat(i.slice(1));"function"==typeof e[n]&&e.off(i,e[n])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var i=this;e.removeAttribute("src"),e.load(),t.forEach((function(e,t){i.media.appendChild(Mr.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}));var n=e.children;if(n){this._videoSourceCount=n.length,this._videoSourceIndex=n.length,this._vLoadeddata=function(e){i.emit(Ho,{src:e.target.currentSrc,host:Mr.getHostFromUrl(e.target.currentSrc)})};for(var r=null,o=0;o<this._evHandlers.length;o++)if("error"===Object.keys(this._evHandlers[o])[0]){r=this._evHandlers[o];break}!this._sourceError&&(this._sourceError=function(e){var t=parseInt(e.target.getAttribute("data-index"),10);if(i._videoSourceIndex--,0===i._videoSourceIndex||t>=i._videoSourceCount){var n={code:4,message:"sources_load_error"};r?r.error(e,n):i.errorHandler("error",n)}var o=Wr[4];i.emit(Fo,new Yr(i,{errorType:o,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var a=0;a<n.length;a++)n[a].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var t=e.children;if(t&&0!==t.length&&this._sourceError){for(var i=0;i<t.length;i++)t[i].removeEventListener("error",this._sourceError);for(;t.length>0;)e.removeChild(t[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.media&&(this.media.error||t)){var i=this.media.error||t,n=i.code?Wr[i.code]:"other";i.message;this.media.currentSrc||this.media.srcObject||(i={code:6,message:"empty_src"}),this.emit(e,new Yr(this,{errorType:n,errorCode:i.code,errorMessage:i.message||"",mediaError:i}))}}},{key:"destroy",value:function(){for(var e in this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){return this.media?this.media.play():null}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return!!this.media&&this.media.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0];if(!this.media)return t;e||(e=this.media.buffered);var i=this.media.currentTime;if(e)for(var n=0,r=e.length;n<r&&(t[0]=e.start(n),t[1]=e.end(n),!(t[0]<=i&&i<=t[1]));n++);return t[0]-i<=0&&i-t[1]<=0?t:[0,0]}},{key:"autoplay",get:function(){return!!this.media&&this.media.autoplay},set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?Mr.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var t=this.media.buffered;if(!t||0===t.length)return e;for(var i=0;i<t.length;i++)if((t.start(i)<=this.currentTime||t.start(i)<.1)&&t.end(i)>=this.currentTime)return{start:t.start(i),end:t.end(i)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){if(!this.media.error)return"";return["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit(Eo,e),this.emit(to),this._currentTime=0,this._duration=0,Mr.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===Mr.typeOf(e)?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()))}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e!==1/0&&this.media&&(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=Cr(_r(i.prototype),"emit",this)).call.apply(n,[this,e,t].concat(o))}},{key:"on",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=Cr(_r(i.prototype),"on",this)).call.apply(n,[this,e,t].concat(o))}},{key:"once",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=Cr(_r(i.prototype),"once",this)).call.apply(n,[this,e,t].concat(o))}},{key:"off",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=Cr(_r(i.prototype),"off",this)).call.apply(n,[this,e,t].concat(o))}},{key:"offAll",value:function(){Cr(_r(i.prototype),"removeAllListeners",this).call(this)}}]),i}(Ar),zo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};pr(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}return yr(e,[{key:"openDB",value:function(e){var t=this,i=this,n=this.myDB.version||1,r=i.indexedDB.open(i.myDB.name,n);r.onerror=function(e){},r.onsuccess=function(n){t.myDB.db=n.target.result,e.call(i)},r.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(i.myDB.ojstore.name)||t.createObjectStore(i.myDB.ojstore.name,{keyPath:i.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.add(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.put(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(e,t,i){var n=this,r=this.myDB.db.transaction(e,"readwrite").objectStore(e).get(t);r.onerror=function(){i.call(n,null)},r.onsuccess=function(e){var t=e.target.result;i.call(n,t)}}},{key:"deleteData",value:function(e,t){this.myDB.db.transaction(e,"readwrite").objectStore(e).delete(t)}},{key:"clearData",value:function(e){this.myDB.db.transaction(e,"readwrite").objectStore(e).clear()}}]),e}(),$o=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],Xo=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],qo=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],Zo="data-xgplayerid";function Qo(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];var a=t.call.apply(t,[e].concat(r));i&&"function"==typeof i&&(a&&a.then?a.then((function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];i.call.apply(i,[e].concat(n))})):i.call.apply(i,[e].concat(r)))}function Jo(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var n=arguments,r=this;if(i.pre)try{var o;(o=i.pre).call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}catch(s){throw s.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(s.message),s}if(this.__hooks&&this.__hooks[e])try{var a=sa.apply(void 0,[this,e,t].concat(Array.prototype.slice.call(arguments)));a?a.then?a.then((function(e){!1!==e&&Qo.apply(void 0,[r,t,i.next].concat(kr(n)))})).catch((function(e){throw e})):Qo.apply(void 0,[this,t,i.next].concat(Array.prototype.slice.call(arguments))):void 0===a&&Qo.apply(void 0,[this,t,i.next].concat(Array.prototype.slice.call(arguments)))}catch(s){throw s.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(s.message),s}else Qo.apply(void 0,[this,t,i.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function ea(e,t){var i=this.__hooks;if(!i||!Array.isArray(i[e]))return-1;for(var n=i[e],r=0;r<n.length;r++)if(n[r]===t)return r;return-1}function ta(e,t){var i=this.__hooks;if(i)return i.hasOwnProperty(e)?(Array.isArray(i[e])||(i[e]=[]),-1===ea.call(this,e,t)&&i[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function ia(e,t){var i=this.__hooks;if(i)if(Array.isArray(i[e])){var n=i[e],r=ea.call(this,e,t);-1!==r&&n.splice(r,1)}else i[e]&&(i[e]=null)}function na(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var t=this.plugins[e.toLowerCase()],i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.useHooks&&t.useHooks.apply(t,n)}}function ra(e){if(this.plugins&&this.plugins[e.toLowerCase()]){var t=this.plugins[e.toLowerCase()];if(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.removeHooks&&t.removeHooks.apply(t,n)}}}function oa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&t.map((function(t){e.__hooks[t]=null})),Object.defineProperty(e,"hooks",{get:function(){return e.__hooks&&Object.keys(e.__hooks).map((function(t){if(e.__hooks[t])return t}))}})}function aa(e){e.__hooks=null}function sa(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];if(e.__hooks&&Array.isArray(e.__hooks[t])){var a=e.__hooks[t],s=-1;return function e(t,i,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),l=3;l<r;l++)o[l-3]=arguments[l];if(s++,0===a.length||s===a.length)return n.call.apply(n,[t,t].concat(o));var c=a[s],u=c.call.apply(c,[t,t].concat(o));return u&&u.then?u.then((function(r){return!1===r?null:e.apply(void 0,[t,i,n].concat(o))})).catch((function(e){console.warn("[runHooks]".concat(i," reject"),e.message)})):!1!==u?e.apply(void 0,[t,i,n].concat(o)):void 0}.apply(void 0,[e,t,i].concat(r))}return i.call.apply(i,[e,e].concat(r))}function la(e,t){Lr.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var ca=function(){function e(t){pr(this,e),Mr.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),oa(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return yr(e,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=Mr.checkTouchSupport()?"touch":"mouse";return!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType||(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){i.__events[e]=t,i.player.on(e,t)})):la(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(n){i.__onceEvents[n]=t,i.player.once(e,t)})):la(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(n){delete i.__events[e],i.player.off(n,t)})):la(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(i){e[t][i]&&e.off(i,e[t][i]),i&&delete e[t][i]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];(t=this.player).emit.apply(t,[e].concat(n))}}},{key:"emitUserAction",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=dr(dr({},i),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){return Jo.call.apply(Jo,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return ta.call.apply(ta,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return ia.call.apply(ia,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return i&&(t.pluginName=i),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e=this,t=this.player,i=this.pluginName;this.offAll(),Mr.clearAllTimers(this),Mr.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(i),aa(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(e,i,t[i])}},{key:"defineMethod",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&"function"==typeof t[i]&&Object.defineProperty(e,i,{configurable:!0,value:t[i]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();if("undefined"!=typeof Element&&!Element.prototype.matches){var ua=Element.prototype;ua.matches=ua.matchesSelector||ua.mozMatchesSelector||ua.msMatchesSelector||ua.oMatchesSelector||ua.webkitMatchesSelector}var ha=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}};function da(e,t,i,n,r){var o=fa.apply(this,arguments);return e.addEventListener(i,o,r),{destroy:function(){e.removeEventListener(i,o,r)}}}function fa(e,t,i,n){return function(i){i.delegateTarget=ha(i.target,t),i.delegateTarget&&n.call(e,i)}}var pa=function(e,t,i,n,r){return"function"==typeof e.addEventListener?da.apply(null,arguments):"function"==typeof i?da.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return da(e,t,i,n,r)})))};const ga=sr(pa);var ya={CONTROLS:"controls",ROOT:"root"},va={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},ma="xg-icon-disable";function _a(e){return!!e&&(e.indexOf&&/^(?:http|data:|\/)/.test(e))}function Ea(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=null;if(e instanceof window.Element)return Mr.addClass(e,i),Object.keys(n).map((function(t){e.setAttribute(t,n[t])})),e;if(_a(e)||_a(e.url))return n.src=_a(e)?e:e.url||"",o=Mr.createDom(e.tag||"img","",n,"xg-img ".concat(i));if("function"==typeof e)try{return(o=e())instanceof window.Element?(Mr.addClass(o,i),Object.keys(n).map((function(e){o.setAttribute(e,n[e])})),o):(Lr.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(r,"] is a function mast return an Element Object")),null)}catch(a){return Lr.logError("Plugin named [".concat(r,"]:createIcon"),a),null}return"string"==typeof e?Mr.createDomFromHtml(e,n,i):(Lr.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(r,"] is invalid")),null)}function Ta(e,t){var i=t.config.icons||t.playerConfig.icons;Object.keys(e).map((function(n){var r=e[n],o=r&&r.class?r.class:"",a=r&&r.attr?r.attr:{},s=null;i&&i[n]&&(o=function(e,t){return"object"===fr(e)&&e.class&&"string"==typeof e.class?"".concat(t," ").concat(e.class):t}(i[n],o),a=function(e,t){return"object"===fr(e)&&e.attr&&"object"===fr(e.attr)&&Object.keys(e.attr).map((function(i){t[i]=e.attr[i]})),t}(i[n],a),s=Ea(i[n],n,o,a,t.pluginName)),!s&&r&&(s=Ea(r.icon?r.icon:r,a,o,{},t.pluginName)),t.icons[n]=s}))}var ba=function(e){mr(i,e);var t=Sr(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return pr(this,i),(e=t.call(this,n)).__delegates=[],e}return yr(i,[{key:"__init",value:function(e){if(Cr(_r(i.prototype),"__init",this).call(this,e),e.root){var t=e.root,n=null;this.icons={},this.root=null,this.parent=null,this.extraEls=[],Ta(this.registerIcons()||{},this),this.langText={};var r,o,a=this.registerLanguageTexts()||{};r=a,o=this,Object.keys(r).map((function(e){Object.defineProperty(o.langText,e,{get:function(){var t=o.lang,i=o.i18n;return i[e]?i[e]:r[e]&&r[e][t]||""}})}));var s="";try{s=this.render()}catch(u){throw Lr.logError("Plugin:".concat(this.pluginName,":render"),u),new Error("Plugin:".concat(this.pluginName,":render:").concat(u.message))}if(s)(n=i.insert(s,t,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(n=Mr.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),t.appendChild(n)}this.root=n,this.parent=t;var l=this.config.attr||{},c=this.config.style||{};this.setAttr(l),this.setStyle(c),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var t=this.children();t&&"object"===fr(t)&&Object.keys(t).length>0&&Object.keys(t).map((function(i){var n,r,o=i,a=t[o],s={root:e.root};"function"==typeof a?(n=e.config[o]||{},r=a):"object"===fr(a)&&"function"==typeof a.plugin&&(n=a.options?Mr.deepCopy(e.config[o]||{},a.options):e.config[o]||{},r=a.plugin),s.config=n,void 0!==n.index&&(s.index=n.index),n.root&&(s.root=n.root),e.registerPlugin(r,s,o)}))}}},{key:"updateLang",value:function(e){e||(e=this.lang);var t=this.root,i=this.i18n,n=this.langText;t&&function e(t,i){for(var n=0;n<t.children.length;n++)t.children[n].children.length>0?e(t.children[n],i):i(t.children[n])}(t,(function(t){var r=t.getAttribute&&t.getAttribute("lang-key");if(r){var o=i[r.toUpperCase()]||n[r];o&&(t.innerHTML="function"==typeof o?o(e):o)}}))}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=this.i18n||{},n=this.langText;e.setAttribute&&e.setAttribute("lang-key",t);var r=i[t]||n[t]||"";r&&(e.innerHTML=r)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,Mr.addClass(this.find(".xgplayer-icon"),ma)}},{key:"enable",value:function(){this.config.disable=!1,Mr.removeClass(this.find(".xgplayer-icon"),ma)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.root=t.root||this.root;var r=Cr(_r(i.prototype),"registerPlugin",this).call(this,e,t,n);return this._children.push(r),r}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,t,n){var r=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){r.bindEL(e,t)})):this.bindEL(e,t);else{var o=i.delegate.call(this,this.root,e,t,n);this.__delegates=this.__delegates.concat(o)}}},{key:"unbind",value:function(e,t){var i=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){i.unbindEL(e,t)})):this.unbindEL(e,t);else for(var n="".concat(e,"_").concat(t),r=0;r<this.__delegates.length;r++)if(this.__delegates[r].key===n){this.__delegates[r].destroy(),this.__delegates.splice(r,1);break}}},{key:"setStyle",value:function(e,t){var i=this;if(this.root)return"String"===Mr.typeOf(e)?this.root.style[e]=t:void("Object"===Mr.typeOf(e)&&Object.keys(e).map((function(t){i.root.style[t]=e[t]})))}},{key:"setAttr",value:function(e,t){var i=this;if(this.root)return"String"===Mr.typeOf(e)?this.root.setAttribute(e,t):void("Object"===Mr.typeOf(e)&&Object.keys(e).map((function(t){i.root.setAttribute(t,e[t])})))}},{key:"setHtml",value:function(e,t){this.root&&(this.root.innerHTML=e,"function"==typeof t&&t())}},{key:"bindEL",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,i)}},{key:"unbindEL",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.removeEventListener(e,t,i)}},{key:"show",value:function(e){if(this.root)return this.root.style.display=void 0!==e?e:"block","none"===window.getComputedStyle(this.root,null).getPropertyValue("display")?this.root.style.display="block":void 0}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,t){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!(t&&t instanceof window.Element))return null;try{return"string"==typeof e?this.find(e).appendChild(t):e.appendChild(t)}catch(i){return Lr.logError("Plugin:appendChild",i),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,t=this.player;this.__delegates.map((function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array&&(this._children.map((function(e){t.unRegisterPlugin(e.pluginName)})),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),Cr(_r(i.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map((function(t){e[t]=null})),this.extraEls=[]}}],[{key:"insert",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=t.children.length,r=Number(i),o=e instanceof window.Node;if(n){for(var a=0,s=null,l="";a<n;a++){s=t.children[a];var c=Number(s.getAttribute("data-index"));if(c>=r){l="beforebegin";break}c<r&&(l="afterend")}return o?"afterend"===l?t.appendChild(e):t.insertBefore(e,s):s.insertAdjacentHTML(l,e),"afterend"===l?t.children[t.children.length-1]:t.children[a]}return o?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.children[t.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,t,i,n){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=[];if(e instanceof window.Node&&"function"==typeof n)if(Array.isArray(i))i.forEach((function(i){var a=ga(e,t,i,n,r);a.key="".concat(t,"_").concat(i),o.push(a)}));else{var a=ga(e,t,i,n,r);a.key="".concat(t,"_").concat(i),o.push(a)}return o}},{key:"ROOT_TYPES",get:function(){return ya}},{key:"POSITIONS",get:function(){return va}}]),i}(ca),Sa=function(){function e(){var t=this;if(pr(this,e),vr(this,"__trigger",(function(e){var i=(new Date).getTime();t.timeStamp=i;for(var n=0;n<e.length;n++)t.__runHandler(e[n].target)})),this.__handlers=[],this.timeStamp=0,this.observer=null,window.ResizeObserver)try{this.observer=new window.ResizeObserver(function(e,t,i){var n=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Ur(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),Br(e,t,{leading:n,trailing:r,maxWait:t})}(this.__trigger,100,{trailing:!0})),this.timeStamp=(new Date).getTime()}catch(i){console.error(i)}}return yr(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer.observe(e);for(var i=e.getAttribute(Zo),n=this.__handlers,r=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(r=o);r>-1?this.__handlers[r].handler=t:this.__handlers.push({target:e,handler:t,playerId:i})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(i,n){e===i.target&&(t=n)}));try{var i;null===(i=this.observer)||void 0===i||i.unobserve(e)}catch(n){}t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,i=0;i<t.length;i++)if(t[i]&&e===t[i].target){try{t[i].handler(e)}catch(n){console.error(n)}return!0}return!1}}]),e}(),Ca=null;var ka={pluginGroup:{},init:function(e){var t,i,n=e._pluginInfoId;n||(n=(new Date).getTime(),e._pluginInfoId=n),!e.config.closeResizeObserver&&(t=e.root,i=function(){e.resize()},Ca||(Ca=new Sa),Ca.addObserver(t,i)),this.pluginGroup[n]={_originalOptions:e.config||{},_plugins:{}}},formatPluginInfo:function(e,t){var i=null,n=null;return e.plugin&&"function"==typeof e.plugin?(i=e.plugin,n=e.options):(i=e,n={}),t&&(n.config=t||{}),{PLUFGIN:i,options:n}},checkPluginIfExits:function(e,t){for(var i=0;i<t.length;i++)if(e.toLowerCase()===t[i].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(e,t){for(var i=Object.keys(t),n=null,r=0;r<i.length;r++)if(e.toLowerCase()===i[r].toLowerCase()){n=t[i[r]];break}return"Object"===Mr.typeOf(n)?{root:n.root,position:n.position}:{}},lazyRegister:function(e,t){var i=this,n=t.timeout||1500;return Promise.race([t.loader().then((function(t){var n;n=t&&t.__esModule?t.default:t,i.register(e,n,t.options)})),new Promise((function(e,t){setTimeout((function(){t(new Error("timeout"))}),n)}))])},register:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var n=e._pluginInfoId;if(n&&this.pluginGroup[n]){this.pluginGroup[n]._plugins||(this.pluginGroup[n]._plugins={});var r=this.pluginGroup[n]._plugins,o=this.pluginGroup[n]._originalOptions;i.player=e;var a=i.pluginName||t.pluginName;if(!a)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){i.config||(i.config={});for(var s=Object.keys(o),l=0;l<s.length;l++)if(a.toLowerCase()===s[l].toLowerCase()){var c=o[s[l]];"Object"===Mr.typeOf(c)?i.config=Object.assign({},i.config,o[s[l]]):"Boolean"===Mr.typeOf(c)&&(i.config.disable=!c);break}t.defaultConfig&&Object.keys(t.defaultConfig).forEach((function(e){void 0===i.config[e]&&(i.config[e]=t.defaultConfig[e])})),i.root?"string"==typeof i.root&&(i.root=e[i.root]):i.root=e.root,i.index=i.config.index||0;try{r[a.toLowerCase()]&&(this.unRegister(n,a.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(a,"] exist, destroy the old instance")));var u=new t(i);return r[a.toLowerCase()]=u,r[a.toLowerCase()].func=t,u&&"function"==typeof u.afterCreate&&u.afterCreate(),u}catch(h){throw console.error(h),h}}else console.warn("not supported plugin [".concat(a,"]"))}}},unRegister:function(e,t){e._pluginInfoId&&(e=e._pluginInfoId),t=t.toLowerCase();try{var i=this.pluginGroup[e]._plugins[t];i&&(i.pluginName&&i.__destroy(),delete this.pluginGroup[e]._plugins[t])}catch(n){console.error("[unRegister:".concat(t,"] cgid:[").concat(e,"] error"),n)}},deletePlugin:function(e,t){var i=e._pluginInfoId;i&&this.pluginGroup[i]&&this.pluginGroup[i]._plugins&&delete this.pluginGroup[i]._plugins[t]},getPlugins:function(e){var t=e._pluginInfoId;return t&&this.pluginGroup[t]?this.pluginGroup[t]._plugins:{}},findPlugin:function(e,t){var i=e._pluginInfoId;if(!i||!this.pluginGroup[i])return null;var n=t.toLowerCase();return this.pluginGroup[i]._plugins[n]},beforeInit:function(e){var t=this;function i(e){return e&&e.then?e:new Promise((function(e){e()}))}return new Promise((function(n){if(t.pluginGroup)return(e._loadingPlugins&&e._loadingPlugins.length?Promise.all(e._loadingPlugins):Promise.resolve()).then((function(){var r=e._pluginInfoId;if(t.pluginGroup[r]){var o=t.pluginGroup[r]._plugins,a=[];Object.keys(o).forEach((function(e){if(o[e]&&o[e].beforePlayerInit)try{var t=o[e].beforePlayerInit();a.push(i(t))}catch(n){throw a.push(i(null)),n}})),Promise.all([].concat(a)).then((function(){n()})).catch((function(e){console.error(e),n()}))}else n()}))}))},afterInit:function(e){var t=e._pluginInfoId;if(t&&this.pluginGroup[t]){var i=this.pluginGroup[t]._plugins;Object.keys(i).forEach((function(e){i[e]&&i[e].afterPlayerInit&&i[e].afterPlayerInit()}))}},setLang:function(e,t){var i=t._pluginInfoId;if(i&&this.pluginGroup[i]){var n=this.pluginGroup[i]._plugins;Object.keys(n).forEach((function(t){if(n[t].updateLang)n[t].updateLang(e);else try{n[t].lang=e}catch(i){console.warn("".concat(t," setLang"))}}))}},reRender:function(e){var t=this,i=e._pluginInfoId;if(i&&this.pluginGroup[i]){var n=[],r=this.pluginGroup[i]._plugins;Object.keys(r).forEach((function(e){"controls"!==e&&r[e]&&(n.push({plugin:r[e].func,options:r[e].__args}),t.unRegister(i,e))})),n.forEach((function(i){t.register(e,i.plugin,i.options)}))}},onPluginsReady:function(e){var t=e._pluginInfoId;if(t&&this.pluginGroup[t]){var i=this.pluginGroup[t]._plugins||{};Object.keys(i).forEach((function(e){i[e].onPluginsReady&&"function"==typeof i[e].onPluginsReady&&i[e].onPluginsReady()}))}},destroy:function(e){var t=e._pluginInfoId;if(this.pluginGroup[t]){var i,n,r;i=e.root,null===(r=Ca)||void 0===r||r.unObserver(i,n);for(var o=this.pluginGroup[t]._plugins,a=0,s=Object.keys(o);a<s.length;a++){var l=s[a];this.unRegister(t,l)}delete this.pluginGroup[t],delete e._pluginInfoId}}},Ia={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function Pa(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:(e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase(),"zh-cn"===e&&(e="zh"),e),controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}};var e}var Da=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onMouseEnter",(function(t){var i=Tr(e),n=i.player;i.playerConfig.closeControlsBlur&&n.focus({autoHide:!1})})),vr(Tr(e),"onMouseLeave",(function(t){Tr(e).player.focus()})),e}return yr(i,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==Vr.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,t=this.config,i=t.disable,n=t.height,r=t.mode;if(!i){"flex"===r&&this.player.addClass(Ia.FLEX_CONTROLS);var o={height:"".concat(n,"px")};Object.keys(o).map((function(t){e.root.style[t]=o[t]})),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-controls"),this.on(Po,(function(t){t?Mr.addClass(e.root,"mini-controls"):Mr.removeClass(e.root,"mini-controls")}));var a=this.playerConfig.isMobileSimulateMode;"mobile"!==Vr.device&&"mobile"!==a&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave))}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&Mr.addClass(this.root,Ia.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){Mr.removeClass(this.root,Ia.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var r=e.defaultConfig||{};if(!t.root){switch(t.position?t.position:t.config&&t.config.position?t.config.position:r.position){case va.CONTROLS_LEFT:t.root=this.left;break;case va.CONTROLS_RIGHT:t.root=this.right;break;case va.CONTROLS_CENTER:t.root=this.center;break;case va.CONTROLS:t.root=this.root;break;default:t.root=this.left}return Cr(_r(i.prototype),"registerPlugin",this).call(this,e,t,n)}}}},{key:"destroy",value:function(){"mobile"!==Vr.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.left=null,this.center=null,this.right=null,this.innerRoot=null}},{key:"render",value:function(){var e=this.config,t=e.mode,i=e.autoHide,n=e.initShow;if(!e.disable){var r=Mr.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},vr({},Ia.CONTROLS_AUTOHIDE,i),{"xgplayer-controls-initshow":n||!i});return'<xg-controls class="'.concat(r,'" unselectable="on">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),i}(ba),wa={lang:{},langKeys:[],textKeys:[]};function Aa(e,t){return Object.keys(t).forEach((function(i){var n,r=Mr.typeOf(t[i]),o=Mr.typeOf(e[i]);"Array"===r?("Array"!==o&&(e[i]=[]),(n=e[i]).push.apply(n,kr(t[i]))):"Object"===r?("Object"!==o&&(e[i]={}),Aa(e[i],t[i])):e[i]=t[i]})),e}function Ra(){Object.keys(wa.lang.en).map((function(e){wa.textKeys[e]=e}))}function xa(e,t){var i=e.LANG;if(t||(t=wa),t.lang){var n=e.TEXT||{};"zh"===i&&(i="zh-cn"),t.lang[i]?Aa(t.lang[i],n):(t.langKeys.push(i),t.lang[i]=n),Ra()}}xa({LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}});var Oa={get textKeys(){return wa.textKeys},get langKeys(){return wa.langKeys},get lang(){var e={};return wa.langKeys.map((function(t){e[t]=wa.lang[t]})),wa.lang["zh-cn"]&&(e.zh=wa.lang["zh-cn"]||{}),e},extend:function(e,t){var i=[];if(t||(t=wa),t.lang){i="Array"!==Mr.typeOf(e)?Object.keys(e).map((function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}})):e;var n=t.lang;i.map((function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),n[e.LANG]?Aa(n[e.LANG]||{},e.TEXT||{}):xa(e,t)})),Ra()}},use:xa,init:function(e){var t,i={lang:{},langKeys:[],textKeys:{},pId:e};return Aa(i.lang,wa.lang),(t=i.langKeys).push.apply(t,kr(wa.langKeys)),Aa(i.textKeys,wa.textKeys),i}},La={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},Na=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],Ma={},Ua=null,Ba=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"add",value:function(e){e&&(Ma[e.playerId]=e,1===Object.keys(Ma).length&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete Ma[e.playerId])}},{key:"_iterate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var i in Ma)if(Object.prototype.hasOwnProperty.call(Ma,i)){var n=Ma[i];if(t){if(e(n))break}else e(n)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(i){var n=e(i);return n&&(t=i),n}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(i){e(i)&&t.push(i)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Ma[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):Ma[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(Ma),t=0;t<e.length;t++){var i=Ma[e[t]];if(i&&i.isUserActive)return e[t]}return null}},{key:"setNext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Ma[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):Ma[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return Ua||(Ua=new i),Ua}}]),i}(wr.EventEmitter);var Fa=["play","pause","replay","retry"],Ha=0,ja=0,Va=null,Ka=function(e){mr(i,e);var t=Sr(i);function i(e){var n;pr(this,i);var r,o=Mr.deepMerge(Pa(),e);vr(Tr(n=t.call(this,o)),"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,i=e.defaultPlaybackRate;Lr.logInfo("player","canPlayFunc, startTime",n.__startTime),n._seekToStartTime(),n.playbackRate=i,(t||n._useAutoplay)&&n.mediaPlay(),n.off(io,n.canPlayFunc),n.removeClass(Ia.ENTER)}})),vr(Tr(n),"onFullscreenChange",(function(e,t){var i=function(){Mr.setTimeout(Tr(n),(function(){n.resize()}),100)},r=Mr.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(Uo,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var o=function(e,t,i){if(e){var n=e.getAttribute(i);return!(!n||n!==t||"VIDEO"!==e.tagName&&"AUDIO"!==e.tagName)}}(r,n.playerId,Zo);if(t||r&&(r===n._fullscreenEl||o))i(),!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!0,n.changeFullStyle(n.root,r,Ia.FULLSCREEN),n.emit(ko,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){i();var a=Tr(n),s=a._fullScreenOffset;if(a.config.needFullscreenScroll?(window.scrollTo(s.left,s.top),Mr.setTimeout(Tr(n),(function(){n.fullscreen=!1,n._fullScreenOffset=null}),100)):(!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!1,n._fullScreenOffset=null),n.cssfullscreen)n.removeClass(Ia.FULLSCREEN);else{var l=n._fullscreenEl;l||!n.root.contains(e.target)&&e.target!==n.root||(l=e.target),n.recoverFullStyle(n.root,l,Ia.FULLSCREEN)}n._fullscreenEl=null,n.emit(ko,!1)}})),vr(Tr(n),"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),vr(Tr(n),"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),oa(Tr(n),Fa),n.config=o,n._pluginInfoId=Mr.generateSessionId(),(r=Tr(n)).logInfo=Lr.logInfo.bind(r),r.logWarn=Lr.logWarn.bind(r),r.logError=Lr.logError.bind(r);var a=n.constructor.defaultPreset;if(n.config.presets.length){var s=n.config.presets.indexOf("default");s>=0&&a&&(n.config.presets[s]=a)}else a&&n.config.presets.push(a);if(n.userTimer=null,n.waitTimer=null,n.handleSource=!0,n._state=La.INITIAL,n.isAd=!1,n.isError=!1,n._hasStart=!1,n.isSeeking=!1,n.isCanplay=!1,n._useAutoplay=!1,n.__startTime=-1,n.rotateDeg=0,n.isActive=!1,n.fullscreen=!1,n.cssfullscreen=!1,n.isRotateFullscreen=!1,n._fullscreenEl=null,n.timeSegments=[],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._offsetInfo={currentTime:-1,duration:0},n.innerContainer=null,n.controls=null,n.topBar=null,n.root=null,n.__i18n=Oa.init(n._pluginInfoId),Vr.os.isAndroid&&Vr.osVersion>0&&Vr.osVersion<6&&(n.config.autoplay=!1),n.database=new zo,n.isUserActive=!1,n._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=Va,!n._initDOM())return console.error(new Error("can't find the dom which id is ".concat(n.config.id," or this.config.el does not exist"))),br(n);var l=n.config,c=l.definition,u=void 0===c?{}:c;if(!l.url&&u.list&&u.list.length>0){var h=u.list.find((function(e){return e.definition&&e.definition===u.defaultDefinition}));h||(u.defaultDefinition=u.list[0].definition,h=u.list[0]),n.config.url=h.url,n.curDefinition=h}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),ka.onPluginsReady(Tr(n)),n.getInitDefinition(),n.setState(La.READY),Mr.setTimeout(Tr(n),(function(){n.emit(fo)}),0),n.onReady&&n.onReady(),(n.config.videoInit||n.config.autoplay)&&(!n.hasStart||n.state<La.ATTACHED)&&n.start(),n}return yr(i,[{key:"_initDOM",value:function(){var e,t=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var i=this.config.el;if(!i||1!==i.nodeType)return this.emit(Zr,new Yr("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1;this.root=i}var n=function(e){for(var t=Object.keys(Ma),i=0;i<t.length;i++){var n=Ma[t[i]];if(n.root===e)return n}return null}(this.root);if(n&&(Lr.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),n.destroy()),this.root.setAttribute(Zo,this.playerId),this.media.setAttribute(Zo,this.playerId),null===(e=Va)||void 0===e||e.add(this),ka.init(this),this._initBaseDoms(),this.config.controls){var r=this.config.controls.root||null,o=ka.register(this,Da,{root:r});this.controls=o}var a="mobile"===this.config.isMobileSimulateMode?"mobile":Vr.device;if(this.addClass("".concat(Ia.DEFAULT," ").concat(Ia.INACTIVE," xgplayer-").concat(a," ").concat(this.config.controls?"":Ia.NO_CONTROLS)),this.config.autoplay?this.addClass(Ia.ENTER):this.addClass(Ia.NO_START),this.config.fluid){var s=this.config,l=s.width,c=s.height;"number"==typeof l&&"number"==typeof c||(l=600,c=337.5);var u={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(100*c/l,"%")};Object.keys(u).forEach((function(e){t.root.style[e]=u[e]}))}else["width","height"].forEach((function(e){t.config[e]&&("number"!=typeof t.config[e]?t.root.style[e]=t.config[e]:t.root.style[e]="".concat(t.config[e],"px"))}));var h=this.root.getBoundingClientRect(),d=h.width,f=h.height,p=h.left,g=h.top;return this.sizeInfo.width=d,this.sizeInfo.height=f,this.sizeInfo.left=p,this.sizeInfo.top=g,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=Mr.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach((function(t){e.on(t,e["on"+t.charAt(0).toUpperCase()+t.slice(1)])})),$o.forEach((function(t){document&&document.addEventListener(t,e.onFullscreenChange)})),Vr.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(oo,this.resize),this.playFunc=function(){e.config.closeFocusVideoFocus||e.media.focus()},this.once(zr,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),$o.forEach((function(t){document.removeEventListener(t,e.onFullscreenChange)})),this.playFunc&&this.off(zr,this.playFunc),this.off(io,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_clearUserTimer",value:function(){this.userTimer&&(Mr.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.media&&(e&&""!==e&&("Array"!==Mr.typeOf(e)||0!==e.length)||(e="",this.emit(po),Lr.logWarn("config.url is null, please get url and run player._startInit(url)"),!this.config.nullUrlStart))){Mr.isNotNull(i.playSessionId)&&(this._playSessionId=i.playSessionId),this.handleSource&&(this._detachSourceEvents(this.media),"Array"===Mr.typeOf(e)&&e.length>0?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e),"Number"===Mr.typeOf(this.config.volume)&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var r=this.media.readyState;Lr.logInfo("_startInit readyState",r),this.config.autoplay&&(!Mr.isMSE(this.media)&&this.load(),(Vr.os.isIpad||Vr.os.isPhone)&&this.mediaPlay());var o=this.config.startTime;this.__startTime=o>0?o:-1,this.config.startTime=0,r>=2&&this.duration>0?this.canPlayFunc():this.on(io,this.canPlayFunc),(!this.hasStart||this.state<La.ATTACHED)&&ka.afterInit(this),this.hasStart=!0,this.setState(La.ATTACHED),Mr.setTimeout(this,(function(){t.emit(vo)}),0)}}},{key:"_registerPlugins",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._loadingPlugins=[];var i=this.config.ignores||[],n=this.config.plugins||[],r=this.config.i18n||[];t&&Oa.extend(r,this.__i18n);var o=i.join("||").toLowerCase().split("||"),a=this.plugins;n.forEach((function(i){try{var n=i.plugin?i.plugin.pluginName:i.pluginName;if(n&&o.indexOf(n.toLowerCase())>-1)return null;if(!t&&a[n.toLowerCase()])return;if(i.lazy&&i.loader){var r=ka.lazyRegister(e,i);return void(i.forceBeforeInit&&(r.then((function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(r),1)})).catch((function(t){Lr.logError("_registerPlugins:loadingPlugin",t),e._loadingPlugins.splice(e._loadingPlugins.indexOf(r),1)})),e._loadingPlugins.push(r)))}return e.registerPlugin(i)}catch(s){Lr.logError("_registerPlugins:",s)}}))}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach((function(t){!function(e,t){var i,n,r=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),o=r.plugins,a=void 0===o?[]:o,s=r.ignores,l=void 0===s?[]:s,c=r.icons,u=void 0===c?{}:c,h=r.i18n,d=void 0===h?[]:h;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(i=e.config.plugins).push.apply(i,kr(a)),(n=e.config.ignores).push.apply(n,kr(l)),Object.keys(u).map((function(t){e.config.icons[t]||(e.config.icons[t]=u[t])}));var f=e.config.i18n||[];d.push.apply(d,kr(f)),e.config.i18n=d}(e,t)}))}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case va.ROOT_RIGHT:this.rightBar||(this.rightBar=Mr.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case va.ROOT_LEFT:this.leftBar||(this.leftBar=Mr.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case va.ROOT_TOP:this.topBar||(this.topBar=Mr.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&Mr.addClass(this.topBar,Ia.TOP_BAR_AUTOHIDE)),t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var i=ka.formatPluginInfo(e,t),n=i.PLUFGIN,r=i.options,o=this.config.plugins;!ka.checkPluginIfExits(n.pluginName,o)&&o.push(n);var a=ka.getRootByConfig(n.pluginName,this.config);a.root&&(r.root=a.root),a.position&&(r.position=a.position);var s,l=r.position?r.position:r.config&&r.config.position||n.defaultConfig&&n.defaultConfig.position;return!r.root&&"string"==typeof l&&l.indexOf("controls")>-1?null===(s=this.controls)||void 0===s?void 0:s.registerPlugin(n,r,n.pluginName):(r.root||(r.root=this._getRootByPosition(l)),ka.register(this,n,r))}},{key:"deregister",value:function(e){"string"==typeof e?ka.unRegister(this,e):e instanceof ca&&ka.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.deregister(e),t&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var t;if("string"==typeof e?t=e:e instanceof ca&&(t=e.pluginName),t)for(var i=this.config.plugins.length-1;i>-1;i--){if(this.config.plugins[i].pluginName.toLowerCase()===t.toLowerCase()){this.config.plugins.splice(i,1);break}}}},{key:"plugins",get:function(){return ka.getPlugins(this)}},{key:"getPlugin",value:function(e){var t=ka.findPlugin(this,e);return t&&t.pluginName?t:null}},{key:"addClass",value:function(e){this.root&&(Mr.hasClass(this.root,e)||Mr.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&Mr.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return Mr.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,t){this.root&&this.root.setAttribute(e,t)}},{key:"removeAttribute",value:function(e,t){this.root&&this.root.removeAttribute(e,t)}},{key:"start",value:function(e){var t=this;if(!(this.state>La.ATTACHING)){var i=this._playSessionId;return Mr.isNotNull(i)&&(this._playSessionId=void 0),e||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(La.ATTACHING),this._registerPlugins(!1),ka.beforeInit(this).then((function(){if(t.config){e||(e=t.url||t.config.url);var n=t.preProcessUrl(e);return t._startInit(n.url,{playSessionId:i})}})).catch((function(e){throw e.fileName="player",e.lineNumber="236",Lr.logError("start:beforeInit:",e),e}))}}},{key:"switchURL",value:function(e,t){var i=this,n=e;"Object"===Mr.typeOf(e)&&(n=e.url),n=this.preProcessUrl(n).url;var r=this.currentTime;this.__startTime=r;var o=this.paused&&!this.isError;return this.src=n,new Promise((function(e,t){var r=function(e){i.off("timeupdate",a),i.off("canplay",a),t(e)},a=function(){i._seekToStartTime(),o&&i.pause(),i.off("error",r),e(!0)};i.once("error",r),n?(Vr.os.isAndroid?i.once("timeupdate",a):i.once("canplay",a),i.play()):i.errorHandler("error",{code:6,message:"empty_src"})}))}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<La.ATTACHED)return this.removeClass(Ia.NO_START),this.addClass(Ia.ENTER),this.start(),void(this._useAutoplay=!0);this.state<La.RUNNING&&(this.removeClass(Ia.NO_START),!this.isCanplay&&this.addClass(Ia.ENTER));var t=Cr(_r(i.prototype),"play",this).call(this);return void 0!==t&&t&&t.then?t.then((function(){e.removeClass(Ia.NOT_ALLOW_AUTOPLAY),e.addClass(Ia.PLAYING),e.state<La.RUNNING&&(Lr.logInfo(">>>>playPromise.then"),e.setState(La.RUNNING),e.emit(go))})).catch((function(t){if(Lr.logWarn(">>>>playPromise.catch",t.name),e.media&&e.media.error)return e.onError(),void e.removeClass(Ia.ENTER);"NotAllowedError"===t.name&&(e._errorTimer=Mr.setTimeout(e,(function(){e._errorTimer=null,e.emit(yo),e.addClass(Ia.NOT_ALLOW_AUTOPLAY),e.removeClass(Ia.ENTER),e.pause(),e.setState(La.NOTALLOW)}),0))})):(Lr.logWarn("video.play not return promise"),this.state<La.RUNNING&&(this.setState(La.RUNNING),this.removeClass(Ia.NOT_ALLOW_AUTOPLAY),this.removeClass(Ia.NO_START),this.removeClass(Ia.ENTER),this.addClass(Ia.PLAYING),this.emit(go))),t}},{key:"mediaPause",value:function(){Cr(_r(i.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){Cr(_r(i.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(Ia.PAUSED),sa(this,"play",(function(){return e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;sa(this,"pause",(function(){Cr(_r(i.prototype),"pause",e).call(e)}))}},{key:"seek",value:function(e,t){var i=this;if(this.media&&!Number.isNaN(Number(e))&&this.hasStart){var n=this.config,r=n.isSeekedPlay,o=n.seekedStatus,a=t||(r?"play":o);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(Jr,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(i.removeClass(Ia.ENTER),i.isSeeking=!1,a){case"play":i.play();break;case"pause":i.pause();break;default:i._isPauseBeforeSeek>1||i.paused?i.pause():i.play()}i._isPauseBeforeSeek=0,i._onceSeekCanplay=null},this.once(Jr,this._onceSeekCanplay),this.state<La.RUNNING?(this.removeClass(Ia.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,t=this.config,i=t.definition;!t.url&&i&&i.list&&i.list.length>0&&i.defaultDefinition&&i.list.map((function(t){t.definition===i.defaultDefinition&&(e.config.url=t.url,e.curDefinition=t)}))}},{key:"changeDefinition",value:function(e,t){var i=this,n=this.config.definition;if(Array.isArray(null==n?void 0:n.list)&&n.list.forEach((function(t){(null==e?void 0:e.definition)===t.definition&&(i.curDefinition=t)})),null!=e&&e.bitrate&&"number"!=typeof e.bitrate&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(Do,{from:t,to:e}),this.hasStart){var r=this.switchURL(e.url,dr({seamless:!1!==n.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},e));r&&r.then?r.then((function(){i.emit(wo,{from:t,to:e})})):this.emit(wo,{from:t,to:e})}else this.config.url=e.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(oo,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,t=[Ia.NOT_ALLOW_AUTOPLAY,Ia.PLAYING,Ia.NO_START,Ia.PAUSED,Ia.REPLAY,Ia.ENTER,Ia.ENDED,Ia.ERROR,Ia.LOADING];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,t.forEach((function(t){e.removeClass(t)})),this.addClass(Ia.NO_START),this.emit(Bo)}},{key:"reset",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0;if(this.resetState(),this.plugins&&(t.map((function(t){e.deregister(t)})),i)){var n=Pa();Object.keys(this.config).keys((function(t){"undefined"===e.config[t]||"plugins"!==t&&"presets"!==t&&"el"!==t&&"id"!==t||(e.config[t]=n[t])}))}}},{key:"destroy",value:function(){var e,t=this,n=this.innerContainer,r=this.root,o=this.media;if(r&&o){if(this.hasStart=!1,this._useAutoplay=!1,r.removeAttribute(Zo),o.removeAttribute(Zo),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),Mr.clearAllTimers(this),this.emit(_o),null===(e=Va)||void 0===e||e.remove(this),ka.destroy(this),aa(this),Cr(_r(i.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),n)for(var a=n.children,s=0;s<a.length;s++)n.removeChild(a[s]);!n&&o instanceof window.Node&&r.contains(o)&&!this.config.remainMediaAfterDestroy&&r.removeChild(o),["topBar","leftBar","rightBar","innerContainer"].map((function(e){t[e]&&r.removeChild(t[e]),t[e]=null}));var l=r.className.split(" ");l.length>0?r.className=l.filter((function(e){return e.indexOf("xgplayer")<0})).join(" "):r.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach((function(e){t[e]=!1}))}}},{key:"replay",value:function(){var e=this;this.removeClass(Ia.ENDED),this.currentTime=0,this.isSeeking=!1,sa(this,"replay",(function(){e.once(Jr,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),e.emit(mo),e.onPlay()}))}},{key:"retry",value:function(){var e=this;this.removeClass(Ia.ERROR),this.addClass(Ia.LOADING),sa(this,"retry",(function(){var t=e.currentTime,i=e.config.url,n=Mr.isMSE(e.media)?{url:i}:e.preProcessUrl(i);e.src=n.url,!e.config.isLive&&(e.currentTime=t),e.once(io,(function(){e.mediaPlay()}))}))}},{key:"changeFullStyle",value:function(e,t,i,n){e&&(n||(n=Ia.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=Mr.filterStyleFromText(e)),Mr.addClass(e,i),t&&t!==e&&!this._orgPCss&&(this._orgPCss=Mr.filterStyleFromText(t),Mr.addClass(t,n),t.setAttribute(Zo,this.playerId)))}},{key:"recoverFullStyle",value:function(e,t,i,n){n||(n=Ia.PARENT_FULLSCREEN),this._orgCss&&(Mr.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),Mr.removeClass(e,i),t&&t!==e&&this._orgPCss&&(Mr.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",Mr.removeClass(t,n),t.removeAttribute(Zo))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,i=this.media;if("video"!==e&&"media"!==e||(e=this[e]),e||(e=t),this._fullScreenOffset={top:Mr.scrollTop(),left:Mr.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",Mr.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var n=0;n<Xo.length;n++){var r=Xo[n];if(e[r]){var o="webkitRequestFullscreen"===r?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[r]();return o&&o.then?o:Promise.resolve()}}return i.fullscreenEnabled||i.webkitSupportsFullscreen?(i.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch(a){return Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),this._fullscreenEl||Mr.getFullScreenEl()){this.root;var t=this.media;this._fullActionFrom="exit";try{for(var i=0;i<qo.length;i++){var n=qo[i];if(document[n]){var r=document[n]();return r&&r.then?r:Promise.resolve()}}return t&&t.webkitSupportsFullscreen?(t.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch(o){return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var t=e?"".concat(Ia.INNER_FULLSCREEN," ").concat(Ia.CSS_FULLSCREEN):Ia.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,t);var i=this.config.fullscreen,n=void 0===i?{}:i;(!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen())&&(this.fullscreen=!0,this.emit(ko,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Io,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(Ia.INNER_FULLSCREEN," ").concat(Ia.CSS_FULLSCREEN):Ia.CSS_FULLSCREEN;if(this.fullscreen){var t=this.config.fullscreen,i=void 0===t?{}:t;!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(ko,!1)):this.removeClass(e)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,e);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Io,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var t=e?"".concat(Ia.INNER_FULLSCREEN," ").concat(Ia.ROTATE_FULLSCREEN):Ia.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,t,Ia.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style");var i=90===Math.abs(window.orientation)||90===Math.abs(screen.orientation.angle);this.root.style.width="".concat(i?window.innerWidth:window.innerHeight,"px"),this.emit(ko,!0)}},{key:"exitRotateFullscreen",value:function(e){var t=this._fullscreenEl!==this.root?"".concat(Ia.INNER_FULLSCREEN," ").concat(Ia.ROTATE_FULLSCREEN):Ia.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,t,Ia.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(ko,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){90===window.orientation||-90===window.orientation?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};this.isActive?this.onFocus(e):this.emit(uo,dr({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};this.isActive?(this._clearUserTimer(),this.emit(ho,dr({paused:this.paused,ended:this.ended},e))):this.onBlur(e)}},{key:"onFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!0,delay:3e3},i=this.innerStates;if(this.isActive=!0,this.removeClass(Ia.INACTIVE),this._clearUserTimer(),void 0!==t.isLock&&(i.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||i.isActiveLocked)this._clearUserTimer();else{var n=t&&t.delay?t.delay:this.config.inactive;this.userTimer=Mr.setTimeout(this,(function(){e.userTimer=null,e.blur()}),n)}}},{key:"onBlur",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).ignorePaused,t=void 0!==e&&e;if(!this.innerStates.isActiveLocked){var i=this.config.closePauseVideoFocus;this.isActive=!1,(t||i||!this.paused&&!this.ended)&&this.addClass(Ia.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(Ia.ENTER),this.removeClass(Ia.ERROR),this.removeClass(Ia.LOADING),this.isCanplay=!0,this.waitTimer&&Mr.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){var e=this;this.isError=!1,this.isSeeking=!1,this.__startTime>0&&(this.duration>0?this._seekToStartTime():this.once(no,(function(){e._seekToStartTime()})))}},{key:"onLoadstart",value:function(){this.removeClass(Ia.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===La.ENDED&&this.setState(La.RUNNING),this.removeClass(Ia.PAUSED),this.ended&&this.removeClass(Ia.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(Ia.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(Ia.ENDED),this.setState(La.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(Ia.NOT_ALLOW_AUTOPLAY),this.removeClass(Ia.NO_START),this.removeClass(Ia.ENTER),this.removeClass(Ia.LOADING),this.addClass(Ia.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(Ia.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&Mr.clearTimeout(this,this.waitTimer),this.removeClass(Ia.LOADING),this.removeClass(Ia.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&Mr.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=Mr.setTimeout(this,(function(){e.addClass(Ia.LOADING),e.emit(Co),Mr.clearTimeout(e,e.waitTimer),e.waitTimer=null}),this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1,[Ia.NO_START,Ia.PAUSED,Ia.ENDED,Ia.ERROR,Ia.REPLAY,Ia.LOADING].forEach((function(t){e.removeClass(t)})),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(Ia.LOADING))&&this.media.readyState>2&&(this.removeClass(Ia.LOADING),Mr.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===La.NOTALLOW&&this.duration&&(this.setState(La.RUNNING),this.emit(go)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===Mr.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,i){if(this.media&&t&&e){var n="String"===Mr.typeOf(e)?e:e.type||"";i.props&&"Array"!==Mr.typeOf(i.props)&&(i.props=[i.props]),this.emit(Uo,dr({eventType:n,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},i))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var t=(new Date).getTime()-this._accPlayed.t;this._accPlayed.acc+=t,this._accPlayed.t=0,("ended"===e||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{startDiff:0,endDiff:0})||{},i=t.startDiff,n=void 0===i?0:i,r=t.endDiff,o=void 0===r?0:r,a=this.media.buffered;if(!a||0===a.length||!this.duration)return!0;for(var s=e||this.media.currentTime||.2,l=a.length,c=0;c<l;c++)if(a.start(c)+n<=s&&a.end(c)-o>s)return!0;return!1}},{key:"resizePosition",value:function(){var e=this,t=this.videoPos,i=t.vy,n=t.vx,r=t.h,o=t.w,a=this.videoPos.rotate;if(!(a<0&&r<0&&o<0)){var s=this.videoPos._pi;if(!s&&this.media.videoHeight&&(s=this.media.videoWidth/this.media.videoHeight*100),s){this.videoPos.pi=s;var l={rotate:a=a<0?0:a},c=0,u=0,h=1,d=Math.abs(a/90),f=this.root,p=this.innerContainer,g=f.offsetWidth,y=p?p.offsetHeight:f.offsetHeight,v={},m=y,_=g;if(d%2==0)h=r>0?100/r:o>0?100/o:1,l.scale=h,c=i>0?(100-r)/2-i:0,l.y=2===d?0-c:c,u=n>0?(100-o)/2-n:0,l.x=2===d?0-u:u,v.width="".concat(_,"px"),v.height="".concat(m,"px"),v.maxWidth="",v.maxHeight="";else if(d%2==1){m=g;var E=y-g;u=-E/2/(_=y)*100,l.x=3===d?u+i/2:u-i/2,c=E/2/m*100,l.y=3===d?c+n/2:c-n/2,l.scale=h,v.width="".concat(_,"px"),v.maxWidth="".concat(_,"px"),v.height="".concat(m,"px"),v.maxHeight="".concat(m,"px")}var T=Mr.getTransformStyle(l,this.media.style.transform||this.media.style.webkitTransform);v.transform=T,v.webkitTransform=T,Object.keys(v).map((function(t){e.media.style[t]=v[t]}))}}}},{key:"position",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};if(this.media&&e&&e.h){var t=this.videoPos;t.h=100*e.h||0,t.w=100*e.w||0,t.vx=100*e.x||0,t.vy=100*e.y||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(i){if("plugins"!==i){t.config[i]=e[i];var n=t.plugins[i.toLowerCase()];n&&"Function"===Mr.typeOf(n.setConfig)&&n.setConfig(e[i])}}))}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,sa(this,"playnext",(function(){t.start(),t.emit(Lo,e)}))}},{key:"resize",value:function(){var e=this;if(this.media&&this.root){var t=this.root.getBoundingClientRect();this.sizeInfo.width=t.width,this.sizeInfo.height=t.height,this.sizeInfo.left=t.left,this.sizeInfo.top=t.top;var i=this.media,n=i.videoWidth,r=i.videoHeight,o=this.config,a=o.fitVideoSize,s=o.videoFillMode;if("fill"!==s&&"cover"!==s&&"contain"!==s||this.setAttribute("data-xgfill",s),r&&n){this._videoHeight=r,this._videoWidth=n;var l=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,c=t.width,u=t.height-l,h=parseInt(n/r*1e3,10),d=parseInt(c/u*1e3,10),f=c,p=u,g={};"auto"===a&&d>h||"fixWidth"===a?(p=c/h*1e3,this.config.fluid?g.paddingTop="".concat(100*p/f,"%"):g.height="".concat(p+l,"px")):("auto"===a&&d<h||"fixHeight"===a)&&(f=h*u/1e3,g.width="".concat(f,"px")),this.fullscreen||this.cssfullscreen||Object.keys(g).forEach((function(t){e.root.style[t]=g[t]})),("fillHeight"===s&&d<h||"fillWidth"===s&&d>h)&&this.setAttribute("data-xgfill","cover");var y={videoScale:h,vWidth:f,vHeight:p,cWidth:f,cHeight:p+l};this.resizePosition(),this.emit(Ao,y)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(e,t):this.media.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%")}},{key:"setState",value:function(e){Lr.logInfo("setState","state from:".concat(Na[this.state]," to:").concat(Na[e])),this._state=e}},{key:"preProcessUrl",value:function(e,t){var i=this.config,n=i.preProcessUrl,r=i.preProcessUrlOptions,o=Object.assign({},r,t);return Mr.isBlob(e)||"function"!=typeof n?{url:e}:n(e,o)}},{key:"_seekToStartTime",value:function(){this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime>this.duration?this.duration:this.__startTime,this.__startTime=-1)}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"==typeof e&&(this._hasStart=e,!1===e&&this.setState(La.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===La.RUNNING||this._state===La.ENDED},set:function(e){e?this.setState(La.RUNNING):this._state>=La.RUNNING&&this.setState(La.ATTACHED)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var t=this,i=this.config.definition,n=null,r=null;i.list=e,this.emit("resourceReady",e),e.forEach((function(e){var o;(null===(o=t.curDefinition)||void 0===o?void 0:o.definition)===e.definition&&(n=e),i.defaultDefinition===e.definition&&(r=e)})),!r&&e.length>0&&(r=e[0]),n?this.changeDefinition(n):r&&this.changeDefinition(r)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var t=this.media.getVideoPlaybackQuality();return e.dropped=t.droppedVideoFrames||0,e.total=t.totalVideoFrames||0,e.corrupted=t.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){0!==Oa.langKeys.filter((function(t){return t===e})).length||"zh"===e?(this.config.lang=e,ka.setLang(e,this)):console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(Oa.langKeys.join(),"] "))}},{key:"i18n",get:function(){var e=this.config.lang;return"zh"===e&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return Kr}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return Cr(_r(i.prototype),"readyState",this)}},{key:"error",get:function(){var e=Cr(_r(i.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return Cr(_r(i.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,i=e.t;return i?(new Date).getTime()-i+t:t}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){(e=Mr.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return ja},set:function(e){ja=e}},{key:"realTimeSpeed",get:function(){return Ha},set:function(e){Ha=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,t){return Jo.call.apply(Jo,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){return ta.call.apply(ta,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){return ia.call.apply(ia,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];return na.call.apply(na,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];return ra.call.apply(ra,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,t){var i;"boolean"==typeof t&&t!==this.muted&&(this.addInnerOP("volumechange"),Mr.typeOf(t)===Boolean&&(this.muted=t)),null===(i=Va)||void 0===i||i.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return Lr.config.debug},set:function(e){Lr.config.debug=e}},{key:"instManager",get:function(){return Va},set:function(e){Va=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return null===(e=Va)||void 0===e?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,t){var i;null===(i=Va)||void 0===i||i.setActive(e,t)}},{key:"isHevcSupported",value:function(){return Vr.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return Vr.probeConfigSupported(e)}},{key:"install",value:function(e,t){i.plugins||(i.plugins={}),i.plugins[e]||(i.plugins[e]=t)}},{key:"use",value:function(e,t){i.plugins||(i.plugins={}),i.plugins[e]=t}}]),i}(Yo);vr(Ka,"defaultPreset",null),vr(Ka,"XgVideoProxy",null),Ka.instManager=Ba.getInstance();const Wa=Object.assign(Ka,{BasePlugin:ca,Errors:Yr,Events:Wo,InstManager:Ba,Sniffer:Vr,Util:Mr}),Ga={origin:{index:1,next:"uhd",prev:null},uhd:{index:2,next:"hd",prev:"origin"},hd:{index:3,next:"sd",prev:"uhd"},sd:{index:4,next:"ld",prev:"hd"},ld:{index:5,next:"ao",prev:"sd"},ao:{index:6,next:null,prev:"ld"}},Ya=["zh","en","jp","zh-hk"],za={NORMAL:0,INNER:1,FULLSCREEN:2};var $a=(e=>(e[e.VALID=10]="VALID",e[e.TRANSCODING=30]="TRANSCODING",e[e.NO_SET_AUDIT=1e3]="NO_SET_AUDIT",e[e.OFFLINE=1002]="OFFLINE",e[e.NO_AUTH=2001]="NO_AUTH",e[e.UN_AUTH=2002]="UN_AUTH",e))($a||{});const Xa=5e9,qa={jp:"キャンセル",en:"Cancel",zh:"取消","zh-hk":"取消"};var Za=(e=>(e.WIDEVINE="widevine",e.FAIRPLAY="fairplay",e.PLAYREADY="playready",e))(Za||{}),Qa={LANG:"jp",TEXT:{ERROR_TYPES:{network:{code:1,msg:"ビデオダウンロードエラー"},mse:{code:2,msg:"ストリーム追加エラー"},parse:{code:3,msg:"解析エラー"},format:{code:4,msg:"間違ったフォーマット"},decoder:{code:5,msg:"デコードエラー"},runtime:{code:6,msg:"文法エラー"},timeout:{code:7,msg:"再生タイムアウト"},other:{code:8,msg:"その他のエラー"}},HAVE_NOTHING:"オーディオ/ビデオが準備できているか情報がありません",HAVE_METADATA:"オーディオ/ビデオのメタデータは準備できています",HAVE_CURRENT_DATA:"現在の再生位置に関するデータは利用可能ですが、次のフレーム/ミリ秒を再生するのに十分なデータがありません",HAVE_FUTURE_DATA:"現在、少なくとも次のフレームのデータが利用可能です",HAVE_ENOUGH_DATA:"利用可能なデータは再生を開始するのに十分です",NETWORK_EMPTY:"オーディオ/ビデオが初期化されていません",NETWORK_IDLE:"オーディオ/ビデオはアクティブでリソースが選択されていますが、ネットワークが使用されていません",NETWORK_LOADING:"ブラウザーはデータをダウンロードしています",NETWORK_NO_SOURCE:"オーディオ/ビデオ のソースが見つかりません",MEDIA_ERR_ABORTED:"ユーザーによってフェッチプロセスが中止されました",MEDIA_ERR_NETWORK:"ダウンロード中にエラーが発生しました",MEDIA_ERR_DECODE:"デコード中にエラーが発生しました",MEDIA_ERR_SRC_NOT_SUPPORTED:"オーディオ/ビデオ の形式がサポートされていません",REPLAY:"リプレイ",ERROR:"ネットワークの接続に問題が発生しました",PLAY_TIPS:"プレイ",PAUSE_TIPS:"一時停止",PLAYNEXT_TIPS:"次をプレイ",DOWNLOAD_TIPS:"ダウンロード",ROTATE_TIPS:"回転",RELOAD_TIPS:"再読み込み",FULLSCREEN_TIPS:"フルスクリーン",EXITFULLSCREEN_TIPS:"フルスクリーンを終了",CSSFULLSCREEN_TIPS:"シアターモード",EXITCSSFULLSCREEN_TIPS:"シアターモードを終了",TEXTTRACK:"字幕",PIP:"ミニプレーヤー",SCREENSHOT:"スクリーンショット",LIVE:"生放送",OFF:"オフ",OPEN:"開いた",MINI_DRAG:"ボタンを押して働画をドラッグする",MINISCREEN:"小さな画面",REFRESH:"リフレッシュ",REFRESH_TIPS:"してみてください",FORWARD:"早送り",LIVE_TIP:"生放送"}},Ja={LANG:"zh-hk",TEXT:{ERROR_TYPES:{network:{code:1,msg:"視頻下載錯誤"},mse:{code:2,msg:"流追加錯誤"},parse:{code:3,msg:"解析錯誤"},format:{code:4,msg:"格式錯誤"},decoder:{code:5,msg:"解碼錯誤"},runtime:{code:6,msg:"語法錯誤"},timeout:{code:7,msg:"播放超時"},other:{code:8,msg:"其他錯誤"}},HAVE_NOTHING:"沒有關於音頻/視頻是否就緒的信息",HAVE_METADATA:"音頻/視頻的元數據已就緒",HAVE_CURRENT_DATA:"關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒",HAVE_FUTURE_DATA:"當前及至少下壹幀的數據是可用的",HAVE_ENOUGH_DATA:"可用數據足以開始播放",NETWORK_EMPTY:"音頻/視頻尚未初始化",NETWORK_IDLE:"音頻/視頻是活動的且已選取資源,但並未使用網絡",NETWORK_LOADING:"瀏覽器正在下載數據",NETWORK_NO_SOURCE:"未找到音頻/視頻來源",MEDIA_ERR_ABORTED:"取回過程被用戶中止",MEDIA_ERR_NETWORK:"下載錯誤",MEDIA_ERR_DECODE:"解碼錯誤",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音頻/視頻格式",REPLAY:"重播",ERROR:"網絡連接似乎出現了問題",PLAY_TIPS:"播放",PAUSE_TIPS:"暫停",PLAYNEXT_TIPS:"下壹集",DOWNLOAD_TIPS:"下載",ROTATE_TIPS:"旋轉",RELOAD_TIPS:"重新載入",FULLSCREEN_TIPS:"進入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"進入樣式全屏",EXITCSSFULLSCREEN_TIPS:"退出樣式全屏",TEXTTRACK:"字幕",PIP:"畫中畫",SCREENSHOT:"截圖",LIVE:"正在直播",OFF:"關閉",OPEN:"開啟",MINI_DRAG:"點擊按住可拖動視頻",MINISCREEN:"小屏幕",REFRESH_TIPS:"請試試",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}};const es="undefined"!=typeof window&&window.location&&window.location.href.indexOf("veplayerdebugger=1")>-1,ts="color: #fff; background-color: #5f5f5f;",is="color: #fff; background-color: #f53f3f;",ns="color: #fff; background-color: #ff7d00;",rs="color: #fff; background: #4281ff",os="%c VePlayer %c 1.18.0 ",as={config:{debug:es?3:1},log:function(e,...t){this.config.debug>=3&&console.log(os,ts,rs,e,...t)},warn:function(e,...t){this.config.debug>=1&&console.warn(os,ns,rs,e,...t)},error:function(e,...t){if(this.config.debug<1)return;const i=this.config.debug>=2?"trace":"error";console[i](os,is,rs,e,...t)}};localStorage.getItem("velog")&&(as.config.debug=3);var ss={exports:{}};ss.exports=function(){var e=1e3,t=6e4,i=36e5,n="millisecond",r="second",o="minute",a="hour",s="day",l="week",c="month",u="quarter",h="year",d="date",f="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],i=e%100;return"["+e+(t[(i-20)%10]||t[i]||t[0])+"]"}},v=function(e,t,i){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(i)+e},m={s:v,z:function(e){var t=-e.utcOffset(),i=Math.abs(t),n=Math.floor(i/60),r=i%60;return(t<=0?"+":"-")+v(n,2,"0")+":"+v(r,2,"0")},m:function e(t,i){if(t.date()<i.date())return-e(i,t);var n=12*(i.year()-t.year())+(i.month()-t.month()),r=t.clone().add(n,c),o=i-r<0,a=t.clone().add(n+(o?-1:1),c);return+(-(n+(i-r)/(o?r-a:a-r))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:h,w:l,d:s,D:d,h:a,m:o,s:r,ms:n,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},_="en",E={};E[_]=y;var T=function(e){return e instanceof k},b=function e(t,i,n){var r;if(!t)return _;if("string"==typeof t){var o=t.toLowerCase();E[o]&&(r=o),i&&(E[o]=i,r=o);var a=t.split("-");if(!r&&a.length>1)return e(a[0])}else{var s=t.name;E[s]=t,r=s}return!n&&r&&(_=r),r||!n&&_},S=function(e,t){if(T(e))return e.clone();var i="object"==typeof t?t:{};return i.date=e,i.args=arguments,new k(i)},C=m;C.l=b,C.i=T,C.w=function(e,t){return S(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var k=function(){function y(e){this.$L=b(e.locale,null,!0),this.parse(e)}var v=y.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,i=e.utc;if(null===t)return new Date(NaN);if(C.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(p);if(n){var r=n[2]-1||0,o=(n[7]||"0").substring(0,3);return i?new Date(Date.UTC(n[1],r,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],r,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return C},v.isValid=function(){return!(this.$d.toString()===f)},v.isSame=function(e,t){var i=S(e);return this.startOf(t)<=i&&i<=this.endOf(t)},v.isAfter=function(e,t){return S(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<S(e)},v.$g=function(e,t,i){return C.u(e)?this[t]:this.set(i,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var i=this,n=!!C.u(t)||t,u=C.p(e),f=function(e,t){var r=C.w(i.$u?Date.UTC(i.$y,t,e):new Date(i.$y,t,e),i);return n?r:r.endOf(s)},p=function(e,t){return C.w(i.toDate()[e].apply(i.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),i)},g=this.$W,y=this.$M,v=this.$D,m="set"+(this.$u?"UTC":"");switch(u){case h:return n?f(1,0):f(31,11);case c:return n?f(1,y):f(0,y+1);case l:var _=this.$locale().weekStart||0,E=(g<_?g+7:g)-_;return f(n?v-E:v+(6-E),y);case s:case d:return p(m+"Hours",0);case a:return p(m+"Minutes",1);case o:return p(m+"Seconds",2);case r:return p(m+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var i,l=C.p(e),u="set"+(this.$u?"UTC":""),f=(i={},i[s]=u+"Date",i[d]=u+"Date",i[c]=u+"Month",i[h]=u+"FullYear",i[a]=u+"Hours",i[o]=u+"Minutes",i[r]=u+"Seconds",i[n]=u+"Milliseconds",i)[l],p=l===s?this.$D+(t-this.$W):t;if(l===c||l===h){var g=this.clone().set(d,1);g.$d[f](p),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else f&&this.$d[f](p);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[C.p(e)]()},v.add=function(n,u){var d,f=this;n=Number(n);var p=C.p(u),g=function(e){var t=S(f);return C.w(t.date(t.date()+Math.round(e*n)),f)};if(p===c)return this.set(c,this.$M+n);if(p===h)return this.set(h,this.$y+n);if(p===s)return g(1);if(p===l)return g(7);var y=(d={},d[o]=t,d[a]=i,d[r]=e,d)[p]||1,v=this.$d.getTime()+n*y;return C.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,i=this.$locale();if(!this.isValid())return i.invalidDate||f;var n=e||"YYYY-MM-DDTHH:mm:ssZ",r=C.z(this),o=this.$H,a=this.$m,s=this.$M,l=i.weekdays,c=i.months,u=function(e,i,r,o){return e&&(e[i]||e(t,n))||r[i].slice(0,o)},h=function(e){return C.s(o%12||12,e,"0")},d=i.meridiem||function(e,t,i){var n=e<12?"AM":"PM";return i?n.toLowerCase():n},p={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:C.s(s+1,2,"0"),MMM:u(i.monthsShort,s,c,3),MMMM:u(c,s),D:this.$D,DD:C.s(this.$D,2,"0"),d:String(this.$W),dd:u(i.weekdaysMin,this.$W,l,2),ddd:u(i.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(o),HH:C.s(o,2,"0"),h:h(1),hh:h(2),a:d(o,a,!0),A:d(o,a,!1),m:String(a),mm:C.s(a,2,"0"),s:String(this.$s),ss:C.s(this.$s,2,"0"),SSS:C.s(this.$ms,3,"0"),Z:r};return n.replace(g,(function(e,t){return t||p[e]||r.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(n,d,f){var p,g=C.p(d),y=S(n),v=(y.utcOffset()-this.utcOffset())*t,m=this-y,_=C.m(this,y);return _=(p={},p[h]=_/12,p[c]=_,p[u]=_/3,p[l]=(m-v)/6048e5,p[s]=(m-v)/864e5,p[a]=m/i,p[o]=m/t,p[r]=m/e,p)[g]||m,f?_:C.a(_)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return E[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var i=this.clone(),n=b(e,t,!0);return n&&(i.$L=n),i},v.clone=function(){return C.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},y}(),I=k.prototype;return S.prototype=I,[["$ms",n],["$s",r],["$m",o],["$H",a],["$W",s],["$M",c],["$y",h],["$D",d]].forEach((function(e){I[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),S.extend=function(e,t){return e.$i||(e(t,k,S),e.$i=!0),S},S.locale=b,S.isDayjs=T,S.unix=function(e){return S(1e3*e)},S.en=E[_],S.Ls=E,S.p={},S}();const ls=sr(ss.exports);var cs={exports:{}};!function(e,t){var i,n,r;e.exports=(i="minute",n=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g,function(e,t,o){var a=t.prototype;o.utc=function(e){return new t({date:e,utc:!0,args:arguments})},a.utc=function(e){var t=o(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),i):t},a.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var l=a.init;a.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else l.call(this)};var c=a.utcOffset;a.utcOffset=function(e,t){var o=this.$utils().u;if(o(e))return this.$u?0:o(this.$offset)?c.call(this):this.$offset;if("string"==typeof e&&null===(e=function(e){void 0===e&&(e="");var t=e.match(n);if(!t)return null;var i=(""+t[0]).match(r)||["-",0,0],o=i[0],a=60*+i[1]+ +i[2];return 0===a?0:"+"===o?a:-a}(e)))return this;var a=Math.abs(e)<=16?60*e:e,s=this;if(t)return s.$offset=a,s.$u=0===e,s;if(0!==e){var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(s=this.local().add(a+l,i)).$offset=a,s.$x.$localOffset=l}else s=this.utc();return s};var u=a.format;a.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return u.call(this,t)},a.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var h=a.toDate;a.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var d=a.diff;a.diff=function(e,t,i){if(e&&this.$u===e.$u)return d.call(this,e,t,i);var n=this.local(),r=o(e).local();return d.call(n,r,t,i)}})}(cs);const us=sr(cs.exports);var hs=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=22)}([function(e,t,i){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,i){var n=i(12)("wks"),r=i(13),o=i(0).Symbol,a="function"==typeof o;(e.exports=function(e){return n[e]||(n[e]=a&&o[e]||(a?o:r)("Symbol."+e))}).store=n},function(e,t,i){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,i){var n=i(4);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,i){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(e){return"object"===(void 0===e?"undefined":n(e))?null!==e:"function"==typeof e}},function(e,t,i){var n=i(6);e.exports=function(e,t,i){if(n(e),void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,n){return e.call(t,i,n)};case 3:return function(i,n,r){return e.call(t,i,n,r)}}return function(){return e.apply(t,arguments)}}},function(e,t,i){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,i){e.exports=!i(15)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,i){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,i){var n=i(3),r=i(26),o=i(27),a=Object.defineProperty;t.f=i(7)?Object.defineProperty:function(e,t,i){if(n(e),t=o(t,!0),n(i),r)try{return a(e,t,i)}catch(s){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(e[t]=i.value),e}},function(e,t,i){e.exports=!1},function(e,t,i){var n=i(8),r=i(1)("toStringTag"),o="Arguments"==n(function(){return arguments}());e.exports=function(e){var t,i,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=Object(e),r))?i:o?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,i){var n=i(2),r=i(0),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:i(10)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,i){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,i){var n=i(9),r=i(28);e.exports=i(7)?function(e,t,i){return n.f(e,t,r(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,i){var n=i(4),r=i(0).document,o=n(r)&&n(r.createElement);e.exports=function(e){return o?r.createElement(e):{}}},function(e,t,i){var n=i(0),r=i(14),o=i(18),a=i(13)("src"),s=i(29),l=(""+s).split("toString");i(2).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,i,s){var c="function"==typeof i;c&&(o(i,"name")||r(i,"name",t)),e[t]!==i&&(c&&(o(i,a)||r(i,a,e[t]?""+e[t]:l.join(String(t)))),e===n?e[t]=i:s?e[t]?e[t]=i:r(e,t,i):(delete e[t],r(e,t,i)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[a]||s.call(this)}))},function(e,t,i){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,i){e.exports={}},function(e,t,i){var n,r,o,a=i(5),s=i(38),l=i(39),c=i(16),u=i(0),h=u.process,d=u.setImmediate,f=u.clearImmediate,p=u.MessageChannel,g=u.Dispatch,y=0,v={},m=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},_=function(e){m.call(e.data)};d&&f||(d=function(e){for(var t=[],i=1;arguments.length>i;)t.push(arguments[i++]);return v[++y]=function(){s("function"==typeof e?e:Function(e),t)},n(y),y},f=function(e){delete v[e]},"process"==i(8)(h)?n=function(e){h.nextTick(a(m,e,1))}:g&&g.now?n=function(e){g.now(a(m,e,1))}:p?(o=(r=new p).port2,r.port1.onmessage=_,n=a(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(n=function(e){u.postMessage(e+"","*")},u.addEventListener("message",_,!1)):n="onreadystatechange"in c("script")?function(e){l.appendChild(c("script")).onreadystatechange=function(){l.removeChild(this),m.call(e)}}:function(e){setTimeout(a(m,e,1),0)}),e.exports={set:d,clear:f}},function(e,t,i){var n=i(6);function r(e){var t,i;this.promise=new e((function(e,n){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=n})),this.resolve=n(t),this.reject=n(i)}e.exports.f=function(e){return new r(e)}},function(e,t,i){e.exports=i(23)},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),i(24);var n,r=(n=i(48))&&n.__esModule?n:{default:n};t.default={url:r.default},e.exports=t.default},function(e,t,i){var n,r,o,a,s=i(10),l=i(0),c=i(5),u=i(11),h=i(25),d=i(4),f=i(6),p=i(30),g=i(31),y=i(37),v=i(20).set,m=i(40)(),_=i(21),E=i(41),T=i(42),b=i(43),S=l.TypeError,C=l.process,k=C&&C.versions,I=k&&k.v8||"",P=l.Promise,D="process"==u(C),w=function(){},A=r=_.f,R=!!function(){try{var e=P.resolve(1),t=(e.constructor={})[i(1)("species")]=function(e){e(w,w)};return(D||"function"==typeof PromiseRejectionEvent)&&e.then(w)instanceof t&&0!==I.indexOf("6.6")&&-1===T.indexOf("Chrome/66")}catch(n){}}(),x=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},O=function(e,t){if(!e._n){e._n=!0;var i=e._c;m((function(){for(var n=e._v,r=1==e._s,o=0,a=function(t){var i,o,a,s=r?t.ok:t.fail,l=t.resolve,c=t.reject,u=t.domain;try{s?(r||(2==e._h&&M(e),e._h=1),!0===s?i=n:(u&&u.enter(),i=s(n),u&&(u.exit(),a=!0)),i===t.promise?c(S("Promise-chain cycle")):(o=x(i))?o.call(i,l,c):l(i)):c(n)}catch(h){u&&!a&&u.exit(),c(h)}};i.length>o;)a(i[o++]);e._c=[],e._n=!1,t&&!e._h&&L(e)}))}},L=function(e){v.call(l,(function(){var t,i,n,r=e._v,o=N(e);if(o&&(t=E((function(){D?C.emit("unhandledRejection",r,e):(i=l.onunhandledrejection)?i({promise:e,reason:r}):(n=l.console)&&n.error&&n.error("Unhandled promise rejection",r)})),e._h=D||N(e)?2:1),e._a=void 0,o&&t.e)throw t.v}))},N=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){v.call(l,(function(){var t;D?C.emit("rejectionHandled",e):(t=l.onrejectionhandled)&&t({promise:e,reason:e._v})}))},U=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),O(t,!0))},B=function e(t){var i,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw S("Promise can't be resolved itself");(i=x(t))?m((function(){var r={_w:n,_d:!1};try{i.call(t,c(e,r,1),c(U,r,1))}catch(o){U.call(r,o)}})):(n._v=t,n._s=1,O(n,!1))}catch(r){U.call({_w:n,_d:!1},r)}}};R||(P=function(e){p(this,P,"Promise","_h"),f(e),n.call(this);try{e(c(B,this,1),c(U,this,1))}catch(t){U.call(this,t)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=i(44)(P.prototype,{then:function(e,t){var i=A(y(this,P));return i.ok="function"!=typeof e||e,i.fail="function"==typeof t&&t,i.domain=D?C.domain:void 0,this._c.push(i),this._a&&this._a.push(i),this._s&&O(this,!1),i.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new n;this.promise=e,this.resolve=c(B,e,1),this.reject=c(U,e,1)},_.f=A=function(e){return e===P||e===a?new o(e):r(e)}),h(h.G+h.W+h.F*!R,{Promise:P}),i(45)(P,"Promise"),i(46)("Promise"),a=i(2).Promise,h(h.S+h.F*!R,"Promise",{reject:function(e){var t=A(this);return(0,t.reject)(e),t.promise}}),h(h.S+h.F*(s||!R),"Promise",{resolve:function(e){return b(s&&this===a?P:this,e)}}),h(h.S+h.F*!(R&&i(47)((function(e){P.all(e).catch(w)}))),"Promise",{all:function(e){var t=this,i=A(t),n=i.resolve,r=i.reject,o=E((function(){var i=[],o=0,a=1;g(e,!1,(function(e){var s=o++,l=!1;i.push(void 0),a++,t.resolve(e).then((function(e){l||(l=!0,i[s]=e,--a||n(i))}),r)})),--a||n(i)}));return o.e&&r(o.v),i.promise},race:function(e){var t=this,i=A(t),n=i.reject,r=E((function(){g(e,!1,(function(e){t.resolve(e).then(i.resolve,n)}))}));return r.e&&n(r.v),i.promise}})},function(e,t,i){var n=i(0),r=i(2),o=i(14),a=i(17),s=i(5),l=function e(t,i,l){var c,u,h,d,f=t&e.F,p=t&e.G,g=t&e.P,y=t&e.B,v=p?n:t&e.S?n[i]||(n[i]={}):(n[i]||{}).prototype,m=p?r:r[i]||(r[i]={}),_=m.prototype||(m.prototype={});for(c in p&&(l=i),l)h=((u=!f&&v&&void 0!==v[c])?v:l)[c],d=y&&u?s(h,n):g&&"function"==typeof h?s(Function.call,h):h,v&&a(v,c,h,t&e.U),m[c]!=h&&o(m,c,d),g&&_[c]!=h&&(_[c]=h)};n.core=r,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,i){e.exports=!i(7)&&!i(15)((function(){return 7!=Object.defineProperty(i(16)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,i){var n=i(4);e.exports=function(e,t){if(!n(e))return e;var i,r;if(t&&"function"==typeof(i=e.toString)&&!n(r=i.call(e)))return r;if("function"==typeof(i=e.valueOf)&&!n(r=i.call(e)))return r;if(!t&&"function"==typeof(i=e.toString)&&!n(r=i.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t,i){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,i){e.exports=i(12)("native-function-to-string",Function.toString)},function(e,t,i){e.exports=function(e,t,i,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(i+": incorrect invocation!");return e}},function(e,t,i){var n=i(5),r=i(32),o=i(33),a=i(3),s=i(34),l=i(36),c={},u={},h=e.exports=function(e,t,i,h,d){var f,p,g,y,v=d?function(){return e}:l(e),m=n(i,h,t?2:1),_=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(o(v)){for(f=s(e.length);f>_;_++)if((y=t?m(a(p=e[_])[0],p[1]):m(e[_]))===c||y===u)return y}else for(g=v.call(e);!(p=g.next()).done;)if((y=r(g,m,p.value,t))===c||y===u)return y};h.BREAK=c,h.RETURN=u},function(e,t,i){var n=i(3);e.exports=function(e,t,i,r){try{return r?t(n(i)[0],i[1]):t(i)}catch(a){var o=e.return;throw void 0!==o&&n(o.call(e)),a}}},function(e,t,i){var n=i(19),r=i(1)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||o[r]===e)}},function(e,t,i){var n=i(35),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},function(e,t,i){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,i){var n=i(11),r=i(1)("iterator"),o=i(19);e.exports=i(2).getIteratorMethod=function(e){if(null!=e)return e[r]||e["@@iterator"]||o[n(e)]}},function(e,t,i){var n=i(3),r=i(6),o=i(1)("species");e.exports=function(e,t){var i,a=n(e).constructor;return void 0===a||null==(i=n(a)[o])?t:r(i)}},function(e,t,i){e.exports=function(e,t,i){var n=void 0===i;switch(t.length){case 0:return n?e():e.call(i);case 1:return n?e(t[0]):e.call(i,t[0]);case 2:return n?e(t[0],t[1]):e.call(i,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(i,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(i,t[0],t[1],t[2],t[3])}return e.apply(i,t)}},function(e,t,i){var n=i(0).document;e.exports=n&&n.documentElement},function(e,t,i){var n=i(0),r=i(20).set,o=n.MutationObserver||n.WebKitMutationObserver,a=n.process,s=n.Promise,l="process"==i(8)(a);e.exports=function(){var e,t,i,c=function(){var n,r;for(l&&(n=a.domain)&&n.exit();e;){r=e.fn,e=e.next;try{r()}catch(o){throw e?i():t=void 0,o}}t=void 0,n&&n.enter()};if(l)i=function(){a.nextTick(c)};else if(!o||n.navigator&&n.navigator.standalone)if(s&&s.resolve){var u=s.resolve(void 0);i=function(){u.then(c)}}else i=function(){r.call(n,c)};else{var h=!0,d=document.createTextNode("");new o(c).observe(d,{characterData:!0}),i=function(){d.data=h=!h}}return function(n){var r={fn:n,next:void 0};t&&(t.next=r),e||(e=r,i()),t=r}}},function(e,t,i){e.exports=function(e){try{return{e:!1,v:e()}}catch(t){return{e:!0,v:t}}}},function(e,t,i){var n=i(0).navigator;e.exports=n&&n.userAgent||""},function(e,t,i){var n=i(3),r=i(4),o=i(21);e.exports=function(e,t){if(n(e),r(t)&&t.constructor===e)return t;var i=o.f(e);return(0,i.resolve)(t),i.promise}},function(e,t,i){var n=i(17);e.exports=function(e,t,i){for(var r in t)n(e,r,t[r],i);return e}},function(e,t,i){var n=i(9).f,r=i(18),o=i(1)("toStringTag");e.exports=function(e,t,i){e&&!r(e=i?e:e.prototype,o)&&n(e,o,{configurable:!0,value:t})}},function(e,t,i){var n=i(0),r=i(9),o=i(7),a=i(1)("species");e.exports=function(e){var t=n[e];o&&t&&!t[a]&&r.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,i){var n=i(1)("iterator"),r=!1;try{var o=[7][n]();o.return=function(){r=!0},Array.from(o,(function(){throw 2}))}catch(a){}e.exports=function(e,t){if(!t&&!r)return!1;var i=!1;try{var o=[7],a=o[n]();a.next=function(){return{done:i=!0}},o[n]=function(){return a},e(o)}catch(s){}return i}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e||!t)return Promise.reject("vid, host and token can't be empty");var s=void 0;try{s=(0,o.getUri)(e,t,i,r)}catch(l){return Promise.reject(l.message)}return new a.default({type:"json",method:"GET",url:s}).then((function(e){var t=void 0;if(e&&e.response)switch(n(e.response)){case"string":t=JSON.parse(e.response).Result;break;case"object":t=e.response.Result;break;default:t=e.response}else t=e;return t}))};var r,o=i(49),a=(r=i(51))&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.getUri=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments[3];try{e=JSON.parse((0,n.decode)(e))}catch(s){throw new Error("base64 decode error: "+s.message)}!1===o.jointSsl||r(i,"ssl")||r(i,"Ssl")||(i.Ssl=1);var a=(/^http/.test(t)?t:"//"+t)+"?"+e.GetPlayInfoToken+function(e){var t=[];for(var i in e)r(e,i)&&t.push(i+"="+e[i]);return t.length>0?"&"+t.join("&"):""}(i);return a};var n=i(50),r=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){var t=void 0,i=void 0,n=void 0,r=void 0,o=void 0,a=void 0,s=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],l=e.length;for(o=0,a="";o<l;){do{t=s[255&e.charCodeAt(o++)]}while(o<l&&-1===t);if(-1===t)break;do{i=s[255&e.charCodeAt(o++)]}while(o<l&&-1===i);if(-1===i)break;a+=String.fromCharCode(t<<2|(48&i)>>4);do{if(61==(n=255&e.charCodeAt(o++)))return a;n=s[n]}while(o<l&&-1===n);if(-1===n)break;a+=String.fromCharCode((15&i)<<4|(60&n)>>2);do{if(61==(r=255&e.charCodeAt(o++)))return a;r=s[r]}while(o<l&&-1===r);if(-1===r)break;a+=String.fromCharCode((3&n)<<6|r)}return a}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i=t.url,n=t.method,r=void 0===n?"GET":n,o=t.data,a=void 0===o?{}:o,s=t.headers,l=void 0===s?{}:s;return new Promise((function(e,t){var n=new window.XMLHttpRequest,o=r.toUpperCase(),s=[];if("GET"!==o)throw new Error("xhr "+o+" is not supported");for(var c in a)s.push(c+"="+a[c]);for(var u in n.open(o,""+i,!0),n.responseType="",l)Object.prototype.hasOwnProperty.call(l,u)&&n.setRequestHeader(u,""+l[u]);n.onload=function(){200===n.status||206===n.status?e(n):t(n)},n.onerror=n.ontimeout=function(){return t(n)},n.send()}))},e.exports=t.default}]);const ds=sr(hs);ls.extend(us);var fs=(e=>(e.VIDEO="video",e.EVIDEO="evideo",e.DRM_EVIDEO="drm_evideo",e))(fs||{});function ps(e){try{return JSON.parse(e)}catch(t){return as.warn(`[utils/json] decode fail: ${e}`,t),null}}function gs(e,t="GetPlayInfoToken"){if(!e)return;const i={},n=ps(window.atob(e));if(n&&"string"==typeof n[t]){n[t].split("&").map((e=>{const t=e.split("=");t[0]&&t[1]&&(i[t[0]]=t[1])}))}return i}function ys(e){const t={};return decodeURIComponent(e).split("&").map((e=>{const i=e.split("=");i[0]&&i[1]&&(t[decodeURIComponent(i[0])]=decodeURIComponent(i[1]))})),t}const vs=e=>{var t,i,n;if(!(null==e?void 0:e.playAuthToken))return;const r=gs(null==e?void 0:e.playAuthToken),o=null!=(i=null==(t=null==r?void 0:r.FileType)?void 0:t.toLowerCase())?i:"video",a=null==(n=null==r?void 0:r.Format)?void 0:n.toLowerCase();return a||(Object.values(fs).includes(o)?nr.MP4:rr.M4A)},ms=function(e){if(!e["X-Expires"]||!e["X-Date"])return!1;const t=parseInt(e["X-Expires"]);if(isNaN(t))return!1;const i=e["X-Date"].replace(/T/g," ").replace(/Z/g,""),n=ls.utc(i,"YYYYMMDD hhmmss");if(!n.isValid())return!1;return n.add(t,"seconds").isBefore(ls())};function _s(e,t){const i=["240p","360p","480p","540p","720p","1080p","2k","4k","od","oe"],n=e.Definition,r=t.Definition;if(i.includes(n)&&i.includes(r)){const e=i.findIndex((e=>e.toLocaleLowerCase()===n.toLocaleLowerCase()));return i.findIndex((e=>e.toLocaleLowerCase()===r.toLocaleLowerCase()))-e}return t.Bitrate&&e.Bitrate?t.Bitrate-e.Bitrate:-1}function Es(e){const{playAuthToken:t,playDomain:i,reqParams:n={},definitionMap:r,needThumbs:o=!1,needBarrageMask:a=!1,autoDemoteDefinition:s,autoDemoteDefinitionTextKey:l,urlQueryParams:h}=e;if(t){const e=u(c({},n),{NeedThumbs:o?1:0,NeedBarrageMask:a?1:0});return new Promise(((n,o)=>{ds.url(t,i,e).then((e=>{var t;const{Status:i,PlayInfoList:o=[],PosterUrl:a,Vid:d,Duration:f,BarrageMaskUrl:p,ThumbInfoList:g=[],EnableAdaptive:y,AdaptiveBitrateStreamingInfo:v}=e.Data||e;if(i===$a.VALID&&o.length){const i=o.map((e=>{var t;const i=h?Ks(e.MainPlayUrl,h):e.MainPlayUrl,n=h?Ks(e.BackupPlayUrl,h):e.BackupPlayUrl;return c(c({vid:d,url:i,_mainURL:i,_backupURL:n,streamType:e.Format,backupUrl:n,backUrlList:[n],fileType:e.FileType,format:e.Format,bitrate:e.Bitrate,size:e.Size,kid:e.PlayAuthId,playAuthId:e.PlayAuthId,playAuth:e.PlayAuth,secretKey:e.PlayAuth,vwidth:e.Width,vheight:e.Height,vtype:null==(t=e.Format)?void 0:t.toLocaleUpperCase(),codec:e.Codec,urlExpireTimestamp:il(e.MainUrlExpire,10,Xa),drmType:e.DrmType},e),Ms(e,{definitionMap:r,autoDemoteDefinition:s,autoDemoteDefinitionTextKey:l}))})).sort(_s);n({playList:i,type:null==(t=i[0])?void 0:t.Format,poster:a,vid:d,duration:f,dashOpts:e.Data?e:{Data:u(c({},e),{VideoID:d})},thumbs:g,barrageMaskUrl:p,enableAdaptive:y,adaptiveBitrateStreamingInfo:v})}else n({playList:[],poster:a,vid:d,duration:f,dashOpts:e.Data?e:{Data:e},thumbs:g,barrageMaskUrl:p,enableAdaptive:y,adaptiveBitrateStreamingInfo:v}),as.error("HAS NO VIDEO INFORMATION CORRECTLY, PLEASE CHECK THE TOKEN.")})).catch((e=>{as.log("err",e),o(e)}))}))}return Promise.resolve(void 0)}function Ts(e,t,i,n){return d(this,null,(function*(){try{return yield e()}catch(r){if(--t&&i(r))return Ts(e,t,i,n);if(n&&"function"==typeof n)return yield n(r);throw r}}))}function bs(e,t,i,n){return i+"/?"+n+"&"+el({ThirdPartyDrmType:e,Kid:t})}const Ss="__veplayer_";function Cs(e,t="",i){if(!e)return;const n=Ss+t+"_"+e;localStorage.setItem(n,i+"")}function ks(e,t=""){if(!e)return;const i=Ss+t+"_"+e;return localStorage.getItem(i)}function Is(){var e,t;try{const i=null==(t=null==(e=globalThis.crypto)?void 0:e.randomUUID)?void 0:t.call(e);if("string"==typeof i&&i.length>0)return i}catch(i){}return`ve_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,14)}`}function Ps(e){if(!e)return Is();const t=`line_user_${encodeURIComponent(e)}`;try{const e=ks(t,"ttdrama");if(e)return e;const i=Is();return Cs(t,"ttdrama",i),i}catch(i){return Is()}}function Ds(){try{return Math.round(window.performance.now())}catch(e){return(new Date).getTime()}}var ws=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.ERROR=-1]="ERROR",e[e.TIMEOUT=-2]="TIMEOUT",e))(ws||{});function As(e,t){return new Promise(((i,n)=>{try{e||n(new Error("url is undefined"));let r=Ds();const o=r,a=new window.XMLHttpRequest,s={status:0,statusText:"",connectTime:0,raw:a};a.open("get",e),a.onreadystatechange=()=>{2===a.readyState&&(s.headers=function(e){const t={};if(e instanceof window.XMLHttpRequest)try{e.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((function(e){const i=e.split(": "),n=i.shift();t[n]=i.join(": ")}))}catch(i){return t}return t}(a),s.connectTime=Ds()-o,s.status=a.status,s.statusText=a.statusText,r=Ds())},a.onload=()=>{s.response=a.response,i(s)},a.onprogress=e=>{const t=Ds()-r;let i=0;i=parseInt(""+e.loaded/1e3/(t/1e3),10),s.speed=0|i,s.costTime=t},a.onerror=()=>{s.status||(s.status=-1,s.costTime=Ds()-r),n(s)},a.ontimeout=()=>{s.status||(s.status=-2,s.costTime=Ds()-r),i(s)},a.onabort=()=>{i(s)},(null==t?void 0:t.type)&&(a.responseType=t.type),a.timeout=(null==t?void 0:t.timeout)||1e4,a.setRequestHeader("Range",`bytes=${(null==t?void 0:t.range)||"0-1048576"}`),a.send()}catch(r){n(r)}}))}function Rs(e){var t,i,n;if(e.url)return(null==(i=null==(t=null==e?void 0:e.plugins)?void 0:t.encrypthlsplugin)?void 0:i.hls)||(null==(n=null==e?void 0:e.plugins)?void 0:n.mp4encryptplayer)?1:+Mr.isMSE(e.media)}function xs(e){return Number.isFinite(e)?Math.max(0,Math.round(e)):0}class Os{constructor(){this.timings=[],this.timingMap={},this.now=function(){const e=globalThis.performance;return(null==e?void 0:e.now)&&"function"==typeof e.now?()=>e.now():()=>Date.now()}(),this.startAt=this.now()}markDuration(e,t){const i=xs(t);this.timings.push({name:e,duration:i}),this.timingMap[e]=i}measure(e,t){const i=this.now();try{return t()}finally{this.markDuration(e,this.now()-i)}}measureAsync(e,t){return d(this,null,(function*(){const i=this.now();try{return yield t()}finally{this.markDuration(e,this.now()-i)}}))}finish(){return{totalDuration:xs(this.now()-this.startAt),timings:[...this.timings],timingMap:c({},this.timingMap)}}}let Ls;const Ns=()=>Ls,Ms=function(e,t){var i;const{definitionMap:n,autoDemoteDefinition:r,autoDemoteDefinitionTextKey:o}=t||{};if(!e)return{definition:"240P"};const a=e,s=a.Definition||a.Quality||a.definition||a.quality;if(!s)return{definition:"240P"};if(n){let e={definition:s};const t=n[s];return e=t?"string"==typeof t?{definition:t}:c({definition:s},t||{}):{definition:s},r&&r.toLocaleLowerCase()===(null==(i=null==e?void 0:e.definition)?void 0:i.toLocaleLowerCase())&&(e={definition:"auto",definitionTextKey:o,mapDefinition:e.definition}),e}return{definition:s}};const Us=class{constructor(){this.timeID=null,this.func=null}repeat(e,t){this.timeID=1,this.repeatInterval(e,t)}repeatInterval(e,t){this.timeID&&(null===this.func&&(this.func=e),this.func===e&&(this.timeID&&clearTimeout(this.timeID),this.timeID=null,this.timeID=setTimeout((()=>{e(),this.repeatInterval(e,t)}),t)))}clear(){clearTimeout(this.timeID),this.timeID=null}},Bs='video/mp4; codecs="avc1.42E01E,mp4a.40.2"',Fs=['video/mp4;codecs="hev1.1.6.L120.90"','video/mp4;codecs="hev1.2.4.L120.90"','video/mp4;codecs="hev1.3.E.L120.90"','video/mp4;codecs="hev1.4.10.L120.90"'],Hs={mp4:["video/mp4","audio/mp4"],hls:["application/vnd.apple.mpegurl","application/x-mpegurl","audio/mpegurl"],webm:["audio/webm","video/webm"],mov:["video/quicktime"]};function js(e){var t;let i;if(Array.isArray(e)&&e.length){if(e[0].type){let e="";for(const t of Object.entries(Hs)){const[i,n]=t;if(n.includes(i)){e=i;break}}if(e)return e}i=null==(t=e[0])?void 0:t.src}else i="string"==typeof e?e:"";return function(e){return e&&0<e.toLowerCase().indexOf(".m3u8")}(i)?"hls":function(e){return e&&0<e.toLowerCase().indexOf(".flv")}(i)?"flv":function(e){return e&&0<e.toLowerCase().indexOf(".mp4")}(i)?"mp4":function(e){return e&&0<e.toLowerCase().indexOf(".mpd")}(i)?"dash":"mp4"}function Vs(e){return e&&e.then?e:Promise.resolve(e)}const Ks=(e,t)=>t?e+=(-1===e.indexOf("?")?"?":"&")+el(t):e,Ws=(e,t)=>{if(!t||!e)return;let i;return Object.keys(e).map((n=>{n.toLowerCase()===t.toLowerCase()&&(i=e[n])})),i};function Gs(){let e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return"zh-cn"!==e&&"cn"!==e||(e="zh"),e}function Ys(e,t=200,i=""){let n=setTimeout((()=>{i&&as.warn(i),n=null}),t);return e.then?e.then((()=>clearTimeout(n))):(clearTimeout(n),n=null),e}function zs(e,t=1,i=0){return new Promise(((n,r)=>{e().then(n).catch((o=>{setTimeout((()=>{1!==t?zs(e,t-1,i).then(n,r):r(o)}),i)}))}))}function $s(e='video/mp4; codecs="avc1.42E01E,mp4a.40.2"'){if(!window.MediaSource)return!1;try{return window.MediaSource.isTypeSupported(e)}catch(t){return as.error("mse error",t),!1}}function Xs(e="h264"){return void 0!==window.ManagedMediaSource&&("h264"===e?window.ManagedMediaSource.isTypeSupported(Bs):"h265"===e?Fs.some((e=>window.ManagedMediaSource.isTypeSupported(e))):window.ManagedMediaSource.isTypeSupported(e))}const qs="undefined"!=typeof window,Zs=qs&&navigator.userAgent.toLocaleLowerCase(),Qs=qs&&/^((?!chrome|android).)*safari/.test(Zs);function Js(e,t){const i={sg:{__LOG_TEA_ID__:323254,__LOG_CHANNEL__:"sg",__LOG_CUSTOM_REGION__:"byteplus",__LOG_CHANNEL_DOMAIN__:"https://mcs-nontt.byteintlapi.com",__UMD_PRE_PATH__:"https://sf-unpkg.bytepluscdn.com/obj/byteplusfe-sg/sdk/@byteplus/veplayer/1.18.0/plugin"}},n=t||"sg";return e&&i[e]||i[n]}function el(e){return Object.entries(e).map((([e,t])=>Array.isArray(t)?t.map((t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&"):`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&")}function tl(e){var t;return"string"==typeof e?e:null==(t=null==e?void 0:e[0])?void 0:t.src}function il(e,t=10,i=0){const n=parseInt(e,t);return Number.isNaN(n)?i:n}function nl(e){var t,i,n,r,o,a,s;const l=e.getPlugin("drm"),c=e.getPlugin("EncryptHlsPlugin"),u=e.getPlugin("Mp4EncryptPlayer"),h=e.getPlugin("DASHPlugin"),d=(null==(t=null==c?void 0:c.config)?void 0:t.drmKeyToken)||(null==(i=null==u?void 0:u.config)?void 0:i.drmKeyToken)||(null==(n=null==h?void 0:h.config)?void 0:n.drmKeyToken),f=((null==(r=null==c?void 0:c.config)?void 0:r.drmType)||(null==(o=null==u?void 0:u.config)?void 0:o.drmType)||(null==(a=null==h?void 0:h.config)?void 0:a.drmType))===or.PRIVATE_ENCRYPT_UPGRADE,p=null==(s=null==c?void 0:c.config)?void 0:s.keyToken;return l?or.DRM_ENCRYPT:d?or.PRIVATE_ENCRYPT:p?or.STANDARD_ENCRYPT:f?or.PRIVATE_ENCRYPT_UPGRADE:void 0}function rl(e){var t,i,n,r;const o=null==(i=null==(t=null==e?void 0:e.plugins)?void 0:t.encrypthlsplugin)?void 0:i._playOriginalUrl,a=null==(n=null==e?void 0:e.curDefinition)?void 0:n.main_url;return o||a||(null==(r=e.curDefinition)?void 0:r.url)||e.config.url}const ol=/["'&<>]/;function al(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function sl(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?al(Object(i),!0).forEach((function(t){dl(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):al(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function ll(e){return(ll="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ul(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,pl(n.key),n)}}function hl(e,t,i){return t&&ul(e.prototype,t),i&&ul(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function dl(e,t,i){return(t=pl(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function fl(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)i=o[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)i=o[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function pl(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var gl=function(e){return e&&e.Math==Math&&e},yl=gl("object"==typeof globalThis&&globalThis)||gl("object"==typeof window&&window)||gl("object"==typeof self&&self)||gl("object"==typeof ar&&ar)||function(){return this}()||Function("return this")(),vl={},ml=function(e){try{return!!e()}catch(t){return!0}},_l=!ml((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),El=!ml((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Tl=El,bl=Function.prototype.call,Sl=Tl?bl.bind(bl):function(){return bl.apply(bl,arguments)},Cl={},kl={}.propertyIsEnumerable,Il=Object.getOwnPropertyDescriptor,Pl=Il&&!kl.call({1:2},1);Cl.f=Pl?function(e){var t=Il(this,e);return!!t&&t.enumerable}:kl;var Dl,wl,Al=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Rl=El,xl=Function.prototype,Ol=xl.call,Ll=Rl&&xl.bind.bind(Ol,Ol),Nl=Rl?Ll:function(e){return function(){return Ol.apply(e,arguments)}},Ml=Nl,Ul=Ml({}.toString),Bl=Ml("".slice),Fl=function(e){return Bl(Ul(e),8,-1)},Hl=ml,jl=Fl,Vl=Object,Kl=Nl("".split),Wl=Hl((function(){return!Vl("z").propertyIsEnumerable(0)}))?function(e){return"String"==jl(e)?Kl(e,""):Vl(e)}:Vl,Gl=function(e){return null==e},Yl=Gl,zl=TypeError,$l=function(e){if(Yl(e))throw zl("Can't call method on "+e);return e},Xl=Wl,ql=$l,Zl=function(e){return Xl(ql(e))},Ql="object"==typeof document&&document.all,Jl={all:Ql,IS_HTMLDDA:void 0===Ql&&void 0!==Ql},ec=Jl.all,tc=Jl.IS_HTMLDDA?function(e){return"function"==typeof e||e===ec}:function(e){return"function"==typeof e},ic=tc,nc=Jl.all,rc=Jl.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ic(e)||e===nc}:function(e){return"object"==typeof e?null!==e:ic(e)},oc=yl,ac=tc,sc=function(e,t){return arguments.length<2?(i=oc[e],ac(i)?i:void 0):oc[e]&&oc[e][t];var i},lc=Nl({}.isPrototypeOf),cc=sc("navigator","userAgent")||"",uc=yl,hc=cc,dc=uc.process,fc=uc.Deno,pc=dc&&dc.versions||fc&&fc.version,gc=pc&&pc.v8;gc&&(wl=(Dl=gc.split("."))[0]>0&&Dl[0]<4?1:+(Dl[0]+Dl[1])),!wl&&hc&&(!(Dl=hc.match(/Edge\/(\d+)/))||Dl[1]>=74)&&(Dl=hc.match(/Chrome\/(\d+)/))&&(wl=+Dl[1]);var yc=wl,vc=yc,mc=ml,_c=!!Object.getOwnPropertySymbols&&!mc((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&vc&&vc<41})),Ec=_c&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Tc=sc,bc=tc,Sc=lc,Cc=Object,kc=Ec?function(e){return"symbol"==typeof e}:function(e){var t=Tc("Symbol");return bc(t)&&Sc(t.prototype,Cc(e))},Ic=String,Pc=function(e){try{return Ic(e)}catch(t){return"Object"}},Dc=tc,wc=Pc,Ac=TypeError,Rc=function(e){if(Dc(e))return e;throw Ac(wc(e)+" is not a function")},xc=Rc,Oc=Gl,Lc=function(e,t){var i=e[t];return Oc(i)?void 0:xc(i)},Nc=Sl,Mc=tc,Uc=rc,Bc=TypeError,Fc={exports:{}},Hc=yl,jc=Object.defineProperty,Vc=function(e,t){try{jc(Hc,e,{value:t,configurable:!0,writable:!0})}catch(i){Hc[e]=t}return t},Kc=Vc,Wc="__core-js_shared__",Gc=yl[Wc]||Kc(Wc,{}),Yc=Gc;(Fc.exports=function(e,t){return Yc[e]||(Yc[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var zc=Fc.exports,$c=$l,Xc=Object,qc=function(e){return Xc($c(e))},Zc=qc,Qc=Nl({}.hasOwnProperty),Jc=Object.hasOwn||function(e,t){return Qc(Zc(e),t)},eu=Nl,tu=0,iu=Math.random(),nu=eu(1..toString),ru=function(e){return"Symbol("+(void 0===e?"":e)+")_"+nu(++tu+iu,36)},ou=yl,au=Jc,su=ru,lu=_c,cu=Ec,uu=zc("wks"),hu=ou.Symbol,du=hu&&hu.for,fu=cu?hu:hu&&hu.withoutSetter||su,pu=function(e){if(!au(uu,e)||!lu&&"string"!=typeof uu[e]){var t="Symbol."+e;lu&&au(hu,e)?uu[e]=hu[e]:uu[e]=cu&&du?du(t):fu(t)}return uu[e]},gu=Sl,yu=rc,vu=kc,mu=Lc,_u=function(e,t){var i,n;if("string"===t&&Mc(i=e.toString)&&!Uc(n=Nc(i,e)))return n;if(Mc(i=e.valueOf)&&!Uc(n=Nc(i,e)))return n;if("string"!==t&&Mc(i=e.toString)&&!Uc(n=Nc(i,e)))return n;throw Bc("Can't convert object to primitive value")},Eu=TypeError,Tu=pu("toPrimitive"),bu=function(e,t){if(!yu(e)||vu(e))return e;var i,n=mu(e,Tu);if(n){if(void 0===t&&(t="default"),i=gu(n,e,t),!yu(i)||vu(i))return i;throw Eu("Can't convert object to primitive value")}return void 0===t&&(t="number"),_u(e,t)},Su=bu,Cu=kc,ku=function(e){var t=Su(e,"string");return Cu(t)?t:t+""},Iu=rc,Pu=yl.document,Du=Iu(Pu)&&Iu(Pu.createElement),wu=function(e){return Du?Pu.createElement(e):{}},Au=wu,Ru=!_l&&!ml((function(){return 7!=Object.defineProperty(Au("div"),"a",{get:function(){return 7}}).a})),xu=_l,Ou=Sl,Lu=Cl,Nu=Al,Mu=Zl,Uu=ku,Bu=Jc,Fu=Ru,Hu=Object.getOwnPropertyDescriptor;vl.f=xu?Hu:function(e,t){if(e=Mu(e),t=Uu(t),Fu)try{return Hu(e,t)}catch(i){}if(Bu(e,t))return Nu(!Ou(Lu.f,e,t),e[t])};var ju={},Vu=_l&&ml((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ku=rc,Wu=String,Gu=TypeError,Yu=function(e){if(Ku(e))return e;throw Gu(Wu(e)+" is not an object")},zu=_l,$u=Ru,Xu=Vu,qu=Yu,Zu=ku,Qu=TypeError,Ju=Object.defineProperty,eh=Object.getOwnPropertyDescriptor,th="enumerable",ih="configurable",nh="writable";ju.f=zu?Xu?function(e,t,i){if(qu(e),t=Zu(t),qu(i),"function"==typeof e&&"prototype"===t&&"value"in i&&nh in i&&!i[nh]){var n=eh(e,t);n&&n[nh]&&(e[t]=i.value,i={configurable:ih in i?i[ih]:n[ih],enumerable:th in i?i[th]:n[th],writable:!1})}return Ju(e,t,i)}:Ju:function(e,t,i){if(qu(e),t=Zu(t),qu(i),$u)try{return Ju(e,t,i)}catch(n){}if("get"in i||"set"in i)throw Qu("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var rh=ju,oh=Al,ah=_l?function(e,t,i){return rh.f(e,t,oh(1,i))}:function(e,t,i){return e[t]=i,e},sh={exports:{}},lh=_l,ch=Jc,uh=Function.prototype,hh=lh&&Object.getOwnPropertyDescriptor,dh=ch(uh,"name"),fh={EXISTS:dh,PROPER:dh&&"something"===function(){}.name,CONFIGURABLE:dh&&(!lh||lh&&hh(uh,"name").configurable)},ph=tc,gh=Gc,yh=Nl(Function.toString);ph(gh.inspectSource)||(gh.inspectSource=function(e){return yh(e)});var vh,mh,_h,Eh=gh.inspectSource,Th=tc,bh=yl.WeakMap,Sh=Th(bh)&&/native code/.test(String(bh)),Ch=ru,kh=zc("keys"),Ih=function(e){return kh[e]||(kh[e]=Ch(e))},Ph={},Dh=Sh,wh=yl,Ah=rc,Rh=ah,xh=Jc,Oh=Gc,Lh=Ih,Nh=Ph,Mh="Object already initialized",Uh=wh.TypeError,Bh=wh.WeakMap;if(Dh||Oh.state){var Fh=Oh.state||(Oh.state=new Bh);Fh.get=Fh.get,Fh.has=Fh.has,Fh.set=Fh.set,vh=function(e,t){if(Fh.has(e))throw Uh(Mh);return t.facade=e,Fh.set(e,t),t},mh=function(e){return Fh.get(e)||{}},_h=function(e){return Fh.has(e)}}else{var Hh=Lh("state");Nh[Hh]=!0,vh=function(e,t){if(xh(e,Hh))throw Uh(Mh);return t.facade=e,Rh(e,Hh,t),t},mh=function(e){return xh(e,Hh)?e[Hh]:{}},_h=function(e){return xh(e,Hh)}}var jh={set:vh,get:mh,has:_h,enforce:function(e){return _h(e)?mh(e):vh(e,{})},getterFor:function(e){return function(t){var i;if(!Ah(t)||(i=mh(t)).type!==e)throw Uh("Incompatible receiver, "+e+" required");return i}}},Vh=ml,Kh=tc,Wh=Jc,Gh=_l,Yh=fh.CONFIGURABLE,zh=Eh,$h=jh.enforce,Xh=jh.get,qh=Object.defineProperty,Zh=Gh&&!Vh((function(){return 8!==qh((function(){}),"length",{value:8}).length})),Qh=String(String).split("String"),Jh=sh.exports=function(e,t,i){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Wh(e,"name")||Yh&&e.name!==t)&&(Gh?qh(e,"name",{value:t,configurable:!0}):e.name=t),Zh&&i&&Wh(i,"arity")&&e.length!==i.arity&&qh(e,"length",{value:i.arity});try{i&&Wh(i,"constructor")&&i.constructor?Gh&&qh(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(r){}var n=$h(e);return Wh(n,"source")||(n.source=Qh.join("string"==typeof t?t:"")),e};Function.prototype.toString=Jh((function(){return Kh(this)&&Xh(this).source||zh(this)}),"toString");var ed=sh.exports,td=tc,id=ju,nd=ed,rd=Vc,od=function(e,t,i,n){n||(n={});var r=n.enumerable,o=void 0!==n.name?n.name:t;if(td(i)&&nd(i,o,n),n.global)r?e[t]=i:rd(t,i);else{try{n.unsafe?e[t]&&(r=!0):delete e[t]}catch(a){}r?e[t]=i:id.f(e,t,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},ad={},sd=Math.ceil,ld=Math.floor,cd=Math.trunc||function(e){var t=+e;return(t>0?ld:sd)(t)},ud=function(e){var t=+e;return t!=t||0===t?0:cd(t)},hd=ud,dd=Math.max,fd=Math.min,pd=function(e,t){var i=hd(e);return i<0?dd(i+t,0):fd(i,t)},gd=ud,yd=Math.min,vd=function(e){return e>0?yd(gd(e),9007199254740991):0},md=vd,_d=function(e){return md(e.length)},Ed=Zl,Td=pd,bd=_d,Sd=function(e){return function(t,i,n){var r,o=Ed(t),a=bd(o),s=Td(n,a);if(e&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},Cd={includes:Sd(!0),indexOf:Sd(!1)},kd=Jc,Id=Zl,Pd=Cd.indexOf,Dd=Ph,wd=Nl([].push),Ad=function(e,t){var i,n=Id(e),r=0,o=[];for(i in n)!kd(Dd,i)&&kd(n,i)&&wd(o,i);for(;t.length>r;)kd(n,i=t[r++])&&(~Pd(o,i)||wd(o,i));return o},Rd=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xd=Ad,Od=Rd.concat("length","prototype");ad.f=Object.getOwnPropertyNames||function(e){return xd(e,Od)};var Ld={};Ld.f=Object.getOwnPropertySymbols;var Nd=sc,Md=ad,Ud=Ld,Bd=Yu,Fd=Nl([].concat),Hd=Nd("Reflect","ownKeys")||function(e){var t=Md.f(Bd(e)),i=Ud.f;return i?Fd(t,i(e)):t},jd=Jc,Vd=Hd,Kd=vl,Wd=ju,Gd=function(e,t,i){for(var n=Vd(t),r=Wd.f,o=Kd.f,a=0;a<n.length;a++){var s=n[a];jd(e,s)||i&&jd(i,s)||r(e,s,o(t,s))}},Yd=ml,zd=tc,$d=/#|\.prototype\./,Xd=function(e,t){var i=Zd[qd(e)];return i==Jd||i!=Qd&&(zd(t)?Yd(t):!!t)},qd=Xd.normalize=function(e){return String(e).replace($d,".").toLowerCase()},Zd=Xd.data={},Qd=Xd.NATIVE="N",Jd=Xd.POLYFILL="P",ef=Xd,tf=yl,nf=vl.f,rf=ah,of=od,af=Vc,sf=Gd,lf=ef,cf=function(e,t){var i,n,r,o,a,s=e.target,l=e.global,c=e.stat;if(i=l?tf:c?tf[s]||af(s,{}):(tf[s]||{}).prototype)for(n in t){if(o=t[n],r=e.dontCallGetSet?(a=nf(i,n))&&a.value:i[n],!lf(l?n:s+(c?".":"#")+n,e.forced)&&void 0!==r){if(typeof o==typeof r)continue;sf(o,r)}(e.sham||r&&r.sham)&&rf(o,"sham",!0),of(i,n,o,e)}},uf=Fl,hf=Array.isArray||function(e){return"Array"==uf(e)},df=TypeError,ff=function(e){if(e>9007199254740991)throw df("Maximum allowed index exceeded");return e},pf=ku,gf=ju,yf=Al,vf=function(e,t,i){var n=pf(t);n in e?gf.f(e,n,yf(0,i)):e[n]=i},mf={};mf[pu("toStringTag")]="z";var _f="[object z]"===String(mf),Ef=_f,Tf=tc,bf=Fl,Sf=pu("toStringTag"),Cf=Object,kf="Arguments"==bf(function(){return arguments}()),If=Ef?bf:function(e){var t,i,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=Cf(e),Sf))?i:kf?bf(t):"Object"==(n=bf(t))&&Tf(t.callee)?"Arguments":n},Pf=Nl,Df=ml,wf=tc,Af=If,Rf=Eh,xf=function(){},Of=[],Lf=sc("Reflect","construct"),Nf=/^\s*(?:class|function)\b/,Mf=Pf(Nf.exec),Uf=!Nf.exec(xf),Bf=function(e){if(!wf(e))return!1;try{return Lf(xf,Of,e),!0}catch(t){return!1}},Ff=function(e){if(!wf(e))return!1;switch(Af(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Uf||!!Mf(Nf,Rf(e))}catch(t){return!0}};Ff.sham=!0;var Hf=!Lf||Df((function(){var e;return Bf(Bf.call)||!Bf(Object)||!Bf((function(){e=!0}))||e}))?Ff:Bf,jf=hf,Vf=Hf,Kf=rc,Wf=pu("species"),Gf=Array,Yf=function(e){var t;return jf(e)&&(t=e.constructor,(Vf(t)&&(t===Gf||jf(t.prototype))||Kf(t)&&null===(t=t[Wf]))&&(t=void 0)),void 0===t?Gf:t},zf=function(e,t){return new(Yf(e))(0===t?0:t)},$f=ml,Xf=yc,qf=pu("species"),Zf=function(e){return Xf>=51||!$f((function(){var t=[];return(t.constructor={})[qf]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Qf=cf,Jf=ml,ep=hf,tp=rc,ip=qc,np=_d,rp=ff,op=vf,ap=zf,sp=Zf,lp=yc,cp=pu("isConcatSpreadable"),up=lp>=51||!Jf((function(){var e=[];return e[cp]=!1,e.concat()[0]!==e})),hp=sp("concat"),dp=function(e){if(!tp(e))return!1;var t=e[cp];return void 0!==t?!!t:ep(e)};Qf({target:"Array",proto:!0,arity:1,forced:!up||!hp},{concat:function(e){var t,i,n,r,o,a=ip(this),s=ap(a,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(dp(o=-1===t?a:arguments[t]))for(r=np(o),rp(l+r),i=0;i<r;i++,l++)i in o&&op(s,l,o[i]);else rp(l+1),op(s,l++,o);return s.length=l,s}});var fp=Fl,pp=Nl,gp=function(e){if("Function"===fp(e))return pp(e)},yp=Rc,vp=El,mp=gp(gp.bind),_p=function(e,t){return yp(e),void 0===t?e:vp?mp(e,t):function(){return e.apply(t,arguments)}},Ep=_p,Tp=Wl,bp=qc,Sp=_d,Cp=zf,kp=Nl([].push),Ip=function(e){var t=1==e,i=2==e,n=3==e,r=4==e,o=6==e,a=7==e,s=5==e||o;return function(l,c,u,h){for(var d,f,p=bp(l),g=Tp(p),y=Ep(c,u),v=Sp(g),m=0,_=h||Cp,E=t?_(l,v):i||a?_(l,0):void 0;v>m;m++)if((s||m in g)&&(f=y(d=g[m],m,p),e))if(t)E[m]=f;else if(f)switch(e){case 3:return!0;case 5:return d;case 6:return m;case 2:kp(E,d)}else switch(e){case 4:return!1;case 7:kp(E,d)}return o?-1:n||r?r:E}},Pp={forEach:Ip(0),map:Ip(1),filter:Ip(2),some:Ip(3),every:Ip(4),find:Ip(5),findIndex:Ip(6),filterReject:Ip(7)},Dp=Pp.map;cf({target:"Array",proto:!0,forced:!Zf("map")},{map:function(e){return Dp(this,e,arguments.length>1?arguments[1]:void 0)}});var wp=Ad,Ap=Rd,Rp=Object.keys||function(e){return wp(e,Ap)},xp=qc,Op=Rp;cf({target:"Object",stat:!0,forced:ml((function(){Op(1)}))},{keys:function(e){return Op(xp(e))}});var Lp=If,Np=String,Mp=function(e){if("Symbol"===Lp(e))throw TypeError("Cannot convert a Symbol value to a string");return Np(e)},Up=Nl,Bp=ud,Fp=Mp,Hp=$l,jp=Up("".charAt),Vp=Up("".charCodeAt),Kp=Up("".slice),Wp=function(e){return function(t,i){var n,r,o=Fp(Hp(t)),a=Bp(i),s=o.length;return a<0||a>=s?e?"":void 0:(n=Vp(o,a))<55296||n>56319||a+1===s||(r=Vp(o,a+1))<56320||r>57343?e?jp(o,a):n:e?Kp(o,a,a+2):r-56320+(n-55296<<10)+65536}},Gp={codeAt:Wp(!1),charAt:Wp(!0)},Yp=Gp.charAt,zp=$l,$p=ud,Xp=Mp;cf({target:"String",proto:!0,forced:!0},{at:function(e){var t=Xp(zp(this)),i=t.length,n=$p(e),r=n>=0?n:i+n;return r<0||r>=i?void 0:Yp(t,r)}});var qp=If,Zp=_f?{}.toString:function(){return"[object "+qp(this)+"]"};_f||od(Object.prototype,"toString",Zp,{unsafe:!0});var Qp=Yu,Jp=function(){var e=Qp(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},eg=Sl,tg=Jc,ig=lc,ng=Jp,rg=RegExp.prototype,og=function(e){var t=e.flags;return void 0!==t||"flags"in rg||tg(e,"flags")||!ig(rg,e)?t:eg(ng,e)},ag=fh.PROPER,sg=od,lg=Yu,cg=Mp,ug=ml,hg=og,dg="toString",fg=RegExp.prototype[dg],pg=ug((function(){return"/a/b"!=fg.call({source:"a",flags:"b"})})),gg=ag&&fg.name!=dg;(pg||gg)&&sg(RegExp.prototype,dg,(function(){var e=lg(this);return"/"+cg(e.source)+"/"+cg(hg(e))}),{unsafe:!0});var yg=wu("span").classList,vg=yg&&yg.constructor&&yg.constructor.prototype,mg=vg===Object.prototype?void 0:vg,_g=ml,Eg=function(e,t){var i=[][e];return!!i&&_g((function(){i.call(null,t||function(){return 1},1)}))},Tg=Pp.forEach,bg=Eg("forEach")?[].forEach:function(e){return Tg(this,e,arguments.length>1?arguments[1]:void 0)},Sg=yl,Cg={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},kg=mg,Ig=bg,Pg=ah,Dg=function(e){if(e&&e.forEach!==Ig)try{Pg(e,"forEach",Ig)}catch(t){e.forEach=Ig}};for(var wg in Cg)Cg[wg]&&Dg(Sg[wg]&&Sg[wg].prototype);Dg(kg);var Ag=tc,Rg=String,xg=TypeError,Og=Nl,Lg=Yu,Ng=function(e){if("object"==typeof e||Ag(e))return e;throw xg("Can't set "+Rg(e)+" as a prototype")},Mg=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Og(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(n){}return function(i,n){return Lg(i),Ng(n),t?e(i,n):i.__proto__=n,i}}():void 0),Ug=tc,Bg=rc,Fg=Mg,Hg=function(e,t,i){var n,r;return Fg&&Ug(n=t.constructor)&&n!==i&&Bg(r=n.prototype)&&r!==i.prototype&&Fg(e,r),e},jg=Nl(1..valueOf),Vg="\t\n\v\f\r \u2028\u2029\ufeff",Kg=$l,Wg=Mp,Gg=Vg,Yg=Nl("".replace),zg="["+Gg+"]",$g=RegExp("^"+zg+zg+"*"),Xg=RegExp(zg+zg+"*$"),qg=function(e){return function(t){var i=Wg(Kg(t));return 1&e&&(i=Yg(i,$g,"")),2&e&&(i=Yg(i,Xg,"")),i}},Zg={start:qg(1),end:qg(2),trim:qg(3)},Qg=_l,Jg=yl,ey=Nl,ty=ef,iy=od,ny=Jc,ry=Hg,oy=lc,ay=kc,sy=bu,ly=ml,cy=ad.f,uy=vl.f,hy=ju.f,dy=jg,fy=Zg.trim,py="Number",gy=Jg[py],yy=gy.prototype,vy=Jg.TypeError,my=ey("".slice),_y=ey("".charCodeAt),Ey=function(e){var t,i,n,r,o,a,s,l,c=sy(e,"number");if(ay(c))throw vy("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=fy(c),43===(t=_y(c,0))||45===t){if(88===(i=_y(c,2))||120===i)return NaN}else if(48===t){switch(_y(c,1)){case 66:case 98:n=2,r=49;break;case 79:case 111:n=8,r=55;break;default:return+c}for(a=(o=my(c,2)).length,s=0;s<a;s++)if((l=_y(o,s))<48||l>r)return NaN;return parseInt(o,n)}return+c};if(ty(py,!gy(" 0o1")||!gy("0b1")||gy("+0x1"))){for(var Ty,by=function(e){var t=arguments.length<1?0:gy(function(e){var t=sy(e,"number");return"bigint"==typeof t?t:Ey(t)}(e)),i=this;return oy(yy,i)&&ly((function(){dy(i)}))?ry(Object(t),i,by):t},Sy=Qg?cy(gy):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),Cy=0;Sy.length>Cy;Cy++)ny(gy,Ty=Sy[Cy])&&!ny(by,Ty)&&hy(by,Ty,uy(gy,Ty));by.prototype=yy,yy.constructor=by,iy(Jg,py,by,{constructor:!0})}var ky=_l,Iy=fh.EXISTS,Py=Nl,Dy=ju.f,wy=Function.prototype,Ay=Py(wy.toString),Ry=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,xy=Py(Ry.exec);ky&&!Iy&&Dy(wy,"name",{configurable:!0,get:function(){try{return xy(Ry,Ay(this))[1]}catch(e){return""}}});var Oy=cf,Ly=Wl,Ny=Zl,My=Eg,Uy=Nl([].join),By=Ly!=Object,Fy=My("join",",");Oy({target:"Array",proto:!0,forced:By||!Fy},{join:function(e){return Uy(Ny(this),void 0===e?",":e)}});var Hy,jy,Vy,Ky,Wy="process"==Fl(yl.process),Gy=ju.f,Yy=Jc,zy=pu("toStringTag"),$y=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Yy(e,zy)&&Gy(e,zy,{configurable:!0,value:t})},Xy=sc,qy=ju,Zy=_l,Qy=pu("species"),Jy=function(e){var t=Xy(e),i=qy.f;Zy&&t&&!t[Qy]&&i(t,Qy,{configurable:!0,get:function(){return this}})},ev=lc,tv=TypeError,iv=Hf,nv=Pc,rv=TypeError,ov=Yu,av=function(e){if(iv(e))return e;throw rv(nv(e)+" is not a constructor")},sv=Gl,lv=pu("species"),cv=function(e,t){var i,n=ov(e).constructor;return void 0===n||sv(i=ov(n)[lv])?t:av(i)},uv=El,hv=Function.prototype,dv=hv.apply,fv=hv.call,pv="object"==typeof Reflect&&Reflect.apply||(uv?fv.bind(dv):function(){return fv.apply(dv,arguments)}),gv=sc("document","documentElement"),yv=Nl([].slice),vv=TypeError,mv=/(?:ipad|iphone|ipod).*applewebkit/i.test(cc),_v=yl,Ev=pv,Tv=_p,bv=tc,Sv=Jc,Cv=ml,kv=gv,Iv=yv,Pv=wu,Dv=function(e,t){if(e<t)throw vv("Not enough arguments");return e},wv=mv,Av=Wy,Rv=_v.setImmediate,xv=_v.clearImmediate,Ov=_v.process,Lv=_v.Dispatch,Nv=_v.Function,Mv=_v.MessageChannel,Uv=_v.String,Bv=0,Fv={},Hv="onreadystatechange";try{Hy=_v.location}catch(nF){}var jv=function(e){if(Sv(Fv,e)){var t=Fv[e];delete Fv[e],t()}},Vv=function(e){return function(){jv(e)}},Kv=function(e){jv(e.data)},Wv=function(e){_v.postMessage(Uv(e),Hy.protocol+"//"+Hy.host)};Rv&&xv||(Rv=function(e){Dv(arguments.length,1);var t=bv(e)?e:Nv(e),i=Iv(arguments,1);return Fv[++Bv]=function(){Ev(t,void 0,i)},jy(Bv),Bv},xv=function(e){delete Fv[e]},Av?jy=function(e){Ov.nextTick(Vv(e))}:Lv&&Lv.now?jy=function(e){Lv.now(Vv(e))}:Mv&&!wv?(Ky=(Vy=new Mv).port2,Vy.port1.onmessage=Kv,jy=Tv(Ky.postMessage,Ky)):_v.addEventListener&&bv(_v.postMessage)&&!_v.importScripts&&Hy&&"file:"!==Hy.protocol&&!Cv(Wv)?(jy=Wv,_v.addEventListener("message",Kv,!1)):jy=Hv in Pv("script")?function(e){kv.appendChild(Pv("script"))[Hv]=function(){kv.removeChild(this),jv(e)}}:function(e){setTimeout(Vv(e),0)});var Gv,Yv,zv,$v,Xv,qv,Zv,Qv,Jv={set:Rv,clear:xv},em=yl,tm=/ipad|iphone|ipod/i.test(cc)&&void 0!==em.Pebble,im=/web0s(?!.*chrome)/i.test(cc),nm=yl,rm=_p,om=vl.f,am=Jv.set,sm=mv,lm=tm,cm=im,um=Wy,hm=nm.MutationObserver||nm.WebKitMutationObserver,dm=nm.document,fm=nm.process,pm=nm.Promise,gm=om(nm,"queueMicrotask"),ym=gm&&gm.value;ym||(Gv=function(){var e,t;for(um&&(e=fm.domain)&&e.exit();Yv;){t=Yv.fn,Yv=Yv.next;try{t()}catch(nF){throw Yv?$v():zv=void 0,nF}}zv=void 0,e&&e.enter()},sm||um||cm||!hm||!dm?!lm&&pm&&pm.resolve?((Zv=pm.resolve(void 0)).constructor=pm,Qv=rm(Zv.then,Zv),$v=function(){Qv(Gv)}):um?$v=function(){fm.nextTick(Gv)}:(am=rm(am,nm),$v=function(){am(Gv)}):(Xv=!0,qv=dm.createTextNode(""),new hm(Gv).observe(qv,{characterData:!0}),$v=function(){qv.data=Xv=!Xv}));var vm=ym||function(e){var t={fn:e,next:void 0};zv&&(zv.next=t),Yv||(Yv=t,$v()),zv=t},mm=yl,_m=function(e){try{return{error:!1,value:e()}}catch(nF){return{error:!0,value:nF}}},Em=function(){this.head=null,this.tail=null};Em.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Tm=Em,bm=yl.Promise,Sm="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Cm=!Sm&&!Wy&&"object"==typeof window&&"object"==typeof document,km=yl,Im=bm,Pm=tc,Dm=ef,wm=Eh,Am=pu,Rm=Cm,xm=Sm,Om=yc;Im&&Im.prototype;var Lm=Am("species"),Nm=!1,Mm=Pm(km.PromiseRejectionEvent),Um={CONSTRUCTOR:Dm("Promise",(function(){var e=wm(Im),t=e!==String(Im);if(!t&&66===Om)return!0;if(!Om||Om<51||!/native code/.test(e)){var i=new Im((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((i.constructor={})[Lm]=n,!(Nm=i.then((function(){}))instanceof n))return!0}return!t&&(Rm||xm)&&!Mm})),REJECTION_EVENT:Mm,SUBCLASSING:Nm},Bm={},Fm=Rc,Hm=TypeError,jm=function(e){var t,i;this.promise=new e((function(e,n){if(void 0!==t||void 0!==i)throw Hm("Bad Promise constructor");t=e,i=n})),this.resolve=Fm(t),this.reject=Fm(i)};Bm.f=function(e){return new jm(e)};var Vm,Km,Wm,Gm=cf,Ym=Wy,zm=yl,$m=Sl,Xm=od,qm=Mg,Zm=$y,Qm=Jy,Jm=Rc,e_=tc,t_=rc,i_=function(e,t){if(ev(t,e))return e;throw tv("Incorrect invocation")},n_=cv,r_=Jv.set,o_=vm,a_=function(e,t){var i=mm.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},s_=_m,l_=Tm,c_=jh,u_=bm,h_=Bm,d_="Promise",f_=Um.CONSTRUCTOR,p_=Um.REJECTION_EVENT,g_=Um.SUBCLASSING,y_=c_.getterFor(d_),v_=c_.set,m_=u_&&u_.prototype,__=u_,E_=m_,T_=zm.TypeError,b_=zm.document,S_=zm.process,C_=h_.f,k_=C_,I_=!!(b_&&b_.createEvent&&zm.dispatchEvent),P_="unhandledrejection",D_=function(e){var t;return!(!t_(e)||!e_(t=e.then))&&t},w_=function(e,t){var i,n,r,o=t.value,a=1==t.state,s=a?e.ok:e.fail,l=e.resolve,c=e.reject,u=e.domain;try{s?(a||(2===t.rejection&&L_(t),t.rejection=1),!0===s?i=o:(u&&u.enter(),i=s(o),u&&(u.exit(),r=!0)),i===e.promise?c(T_("Promise-chain cycle")):(n=D_(i))?$m(n,i,l,c):l(i)):c(o)}catch(nF){u&&!r&&u.exit(),c(nF)}},A_=function(e,t){e.notified||(e.notified=!0,o_((function(){for(var i,n=e.reactions;i=n.get();)w_(i,e);e.notified=!1,t&&!e.rejection&&x_(e)})))},R_=function(e,t,i){var n,r;I_?((n=b_.createEvent("Event")).promise=t,n.reason=i,n.initEvent(e,!1,!0),zm.dispatchEvent(n)):n={promise:t,reason:i},!p_&&(r=zm["on"+e])?r(n):e===P_&&a_("Unhandled promise rejection",i)},x_=function(e){$m(r_,zm,(function(){var t,i=e.facade,n=e.value;if(O_(e)&&(t=s_((function(){Ym?S_.emit("unhandledRejection",n,i):R_(P_,i,n)})),e.rejection=Ym||O_(e)?2:1,t.error))throw t.value}))},O_=function(e){return 1!==e.rejection&&!e.parent},L_=function(e){$m(r_,zm,(function(){var t=e.facade;Ym?S_.emit("rejectionHandled",t):R_("rejectionhandled",t,e.value)}))},N_=function(e,t,i){return function(n){e(t,n,i)}},M_=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,A_(e,!0))},U_=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw T_("Promise can't be resolved itself");var n=D_(t);n?o_((function(){var i={done:!1};try{$m(n,t,N_(U_,i,e),N_(M_,i,e))}catch(nF){M_(i,nF,e)}})):(e.value=t,e.state=1,A_(e,!1))}catch(nF){M_({done:!1},nF,e)}}};if(f_&&(E_=(__=function(e){i_(this,E_),Jm(e),$m(Vm,this);var t=y_(this);try{e(N_(U_,t),N_(M_,t))}catch(nF){M_(t,nF)}}).prototype,(Vm=function(e){v_(this,{type:d_,done:!1,notified:!1,parent:!1,reactions:new l_,rejection:!1,state:0,value:void 0})}).prototype=Xm(E_,"then",(function(e,t){var i=y_(this),n=C_(n_(this,__));return i.parent=!0,n.ok=!e_(e)||e,n.fail=e_(t)&&t,n.domain=Ym?S_.domain:void 0,0==i.state?i.reactions.add(n):o_((function(){w_(n,i)})),n.promise})),Km=function(){var e=new Vm,t=y_(e);this.promise=e,this.resolve=N_(U_,t),this.reject=N_(M_,t)},h_.f=C_=function(e){return e===__||undefined===e?new Km(e):k_(e)},e_(u_)&&m_!==Object.prototype)){Wm=m_.then,g_||Xm(m_,"then",(function(e,t){var i=this;return new __((function(e,t){$m(Wm,i,e,t)})).then(e,t)}),{unsafe:!0});try{delete m_.constructor}catch(nF){}qm&&qm(m_,E_)}Gm({global:!0,constructor:!0,wrap:!0,forced:f_},{Promise:__}),Zm(__,d_,!1),Qm(d_);var B_={},F_=B_,H_=pu("iterator"),j_=Array.prototype,V_=If,K_=Lc,W_=Gl,G_=B_,Y_=pu("iterator"),z_=function(e){if(!W_(e))return K_(e,Y_)||K_(e,"@@iterator")||G_[V_(e)]},$_=Sl,X_=Rc,q_=Yu,Z_=Pc,Q_=z_,J_=TypeError,eE=Sl,tE=Yu,iE=Lc,nE=_p,rE=Sl,oE=Yu,aE=Pc,sE=function(e){return void 0!==e&&(F_.Array===e||j_[H_]===e)},lE=_d,cE=lc,uE=function(e,t){var i=arguments.length<2?Q_(e):t;if(X_(i))return q_($_(i,e));throw J_(Z_(e)+" is not iterable")},hE=z_,dE=function(e,t,i){var n,r;tE(e);try{if(!(n=iE(e,"return"))){if("throw"===t)throw i;return i}n=eE(n,e)}catch(nF){r=!0,n=nF}if("throw"===t)throw i;if(r)throw n;return tE(n),i},fE=TypeError,pE=function(e,t){this.stopped=e,this.result=t},gE=pE.prototype,yE=function(e,t,i){var n,r,o,a,s,l,c,u=i&&i.that,h=!(!i||!i.AS_ENTRIES),d=!(!i||!i.IS_RECORD),f=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),g=nE(t,u),y=function(e){return n&&dE(n,"normal",e),new pE(!0,e)},v=function(e){return h?(oE(e),p?g(e[0],e[1],y):g(e[0],e[1])):p?g(e,y):g(e)};if(d)n=e.iterator;else if(f)n=e;else{if(!(r=hE(e)))throw fE(aE(e)+" is not iterable");if(sE(r)){for(o=0,a=lE(e);a>o;o++)if((s=v(e[o]))&&cE(gE,s))return s;return new pE(!1)}n=uE(e,r)}for(l=d?e.next:n.next;!(c=rE(l,n)).done;){try{s=v(c.value)}catch(nF){dE(n,"throw",nF)}if("object"==typeof s&&s&&cE(gE,s))return s}return new pE(!1)},vE=pu("iterator"),mE=!1;try{var _E=0,EE={next:function(){return{done:!!_E++}},return:function(){mE=!0}};EE[vE]=function(){return this},Array.from(EE,(function(){throw 2}))}catch(nF){}var TE=bm,bE=Um.CONSTRUCTOR||!function(e,t){if(!t&&!mE)return!1;var i=!1;try{var n={};n[vE]=function(){return{next:function(){return{done:i=!0}}}},e(n)}catch(nF){}return i}((function(e){TE.all(e).then(void 0,(function(){}))})),SE=Sl,CE=Rc,kE=Bm,IE=_m,PE=yE;cf({target:"Promise",stat:!0,forced:bE},{all:function(e){var t=this,i=kE.f(t),n=i.resolve,r=i.reject,o=IE((function(){var i=CE(t.resolve),o=[],a=0,s=1;PE(e,(function(e){var l=a++,c=!1;s++,SE(i,t,e).then((function(e){c||(c=!0,o[l]=e,--s||n(o))}),r)})),--s||n(o)}));return o.error&&r(o.value),i.promise}});var DE=cf,wE=Um.CONSTRUCTOR,AE=bm,RE=sc,xE=tc,OE=od,LE=AE&&AE.prototype;if(DE({target:"Promise",proto:!0,forced:wE,real:!0},{catch:function(e){return this.then(void 0,e)}}),xE(AE)){var NE=RE("Promise").prototype.catch;LE.catch!==NE&&OE(LE,"catch",NE,{unsafe:!0})}var ME=Sl,UE=Rc,BE=Bm,FE=_m,HE=yE;cf({target:"Promise",stat:!0,forced:bE},{race:function(e){var t=this,i=BE.f(t),n=i.reject,r=FE((function(){var r=UE(t.resolve);HE(e,(function(e){ME(r,t,e).then(i.resolve,n)}))}));return r.error&&n(r.value),i.promise}});var jE=Sl,VE=Bm;cf({target:"Promise",stat:!0,forced:Um.CONSTRUCTOR},{reject:function(e){var t=VE.f(this);return jE(t.reject,void 0,e),t.promise}});var KE=Yu,WE=rc,GE=Bm,YE=function(e,t){if(KE(e),WE(t)&&t.constructor===e)return t;var i=GE.f(e);return(0,i.resolve)(t),i.promise},zE=cf,$E=Um.CONSTRUCTOR,XE=YE;sc("Promise"),zE({target:"Promise",stat:!0,forced:$E},{resolve:function(e){return XE(this,e)}});var qE=cf,ZE=bm,QE=ml,JE=sc,eT=tc,tT=cv,iT=YE,nT=od,rT=ZE&&ZE.prototype;if(qE({target:"Promise",proto:!0,real:!0,forced:!!ZE&&QE((function(){rT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=tT(this,JE("Promise")),i=eT(e);return this.then(i?function(i){return iT(t,e()).then((function(){return i}))}:e,i?function(i){return iT(t,e()).then((function(){throw i}))}:e)}}),eT(ZE)){var oT=JE("Promise").prototype.finally;rT.finally!==oT&&nT(rT,"finally",oT,{unsafe:!0})}var aT=_l,sT=hf,lT=TypeError,cT=Object.getOwnPropertyDescriptor,uT=aT&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(nF){return nF instanceof TypeError}}(),hT=Pc,dT=TypeError,fT=cf,pT=qc,gT=pd,yT=ud,vT=_d,mT=uT?function(e,t){if(sT(e)&&!cT(e,"length").writable)throw lT("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},_T=ff,ET=zf,TT=vf,bT=function(e,t){if(!delete e[t])throw dT("Cannot delete property "+hT(t)+" of "+hT(e))},ST=Zf("splice"),CT=Math.max,kT=Math.min;fT({target:"Array",proto:!0,forced:!ST},{splice:function(e,t){var i,n,r,o,a,s,l=pT(this),c=vT(l),u=gT(e,c),h=arguments.length;for(0===h?i=n=0:1===h?(i=0,n=c-u):(i=h-2,n=kT(CT(yT(t),0),c-u)),_T(c+i-n),r=ET(l,n),o=0;o<n;o++)(a=u+o)in l&&TT(r,o,l[a]);if(r.length=n,i<n){for(o=u;o<c-n;o++)s=o+i,(a=o+n)in l?l[s]=l[a]:bT(l,s);for(o=c;o>c-n+i;o--)bT(l,o-1)}else if(i>n)for(o=c-n;o>u;o--)s=o+i-1,(a=o+n-1)in l?l[s]=l[a]:bT(l,s);for(o=0;o<i;o++)l[o+u]=arguments[o+2];return mT(l,c-n+i),r}});var IT=ud,PT=Mp,DT=$l,wT=RangeError,AT=cf,RT=Nl,xT=ud,OT=jg,LT=function(e){var t=PT(DT(this)),i="",n=IT(e);if(n<0||n==1/0)throw wT("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(i+=t);return i},NT=ml,MT=RangeError,UT=String,BT=Math.floor,FT=RT(LT),HT=RT("".slice),jT=RT(1..toFixed),VT=function(e,t,i){return 0===t?i:t%2==1?VT(e,t-1,i*e):VT(e*e,t/2,i)},KT=function(e,t,i){for(var n=-1,r=i;++n<6;)r+=t*e[n],e[n]=r%1e7,r=BT(r/1e7)},WT=function(e,t){for(var i=6,n=0;--i>=0;)n+=e[i],e[i]=BT(n/t),n=n%t*1e7},GT=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var n=UT(e[t]);i=""===i?n:i+FT("0",7-n.length)+n}return i};AT({target:"Number",proto:!0,forced:NT((function(){return"0.000"!==jT(8e-5,3)||"1"!==jT(.9,0)||"1.25"!==jT(1.255,2)||"1000000000000000128"!==jT(0xde0b6b3a7640080,0)}))||!NT((function(){jT({})}))},{toFixed:function(e){var t,i,n,r,o=OT(this),a=xT(e),s=[0,0,0,0,0,0],l="",c="0";if(a<0||a>20)throw MT("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return UT(o);if(o<0&&(l="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*VT(2,69,1))-69)<0?o*VT(2,-t,1):o/VT(2,t,1),i*=4503599627370496,(t=52-t)>0){for(KT(s,0,i),n=a;n>=7;)KT(s,1e7,0),n-=7;for(KT(s,VT(10,n,1),0),n=t-1;n>=23;)WT(s,1<<23),n-=23;WT(s,1<<n),KT(s,1,1),WT(s,2),c=GT(s)}else KT(s,0,i),KT(s,1<<-t,0),c=GT(s)+FT("0",a);return c=a>0?l+((r=c.length)<=a?"0."+FT("0",a-r)+c:HT(c,0,r-a)+"."+HT(c,r-a)):l+c}}),cf({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var YT=ml,zT=yl.RegExp,$T=YT((function(){var e=zT("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),XT=$T||YT((function(){return!zT("a","y").sticky})),qT={BROKEN_CARET:$T||YT((function(){var e=zT("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:XT,UNSUPPORTED_Y:$T},ZT={},QT=_l,JT=Vu,eb=ju,tb=Yu,ib=Zl,nb=Rp;ZT.f=QT&&!JT?Object.defineProperties:function(e,t){tb(e);for(var i,n=ib(t),r=nb(t),o=r.length,a=0;o>a;)eb.f(e,i=r[a++],n[i]);return e};var rb,ob=Yu,ab=ZT,sb=Rd,lb=Ph,cb=gv,ub=wu,hb="prototype",db="script",fb=Ih("IE_PROTO"),pb=function(){},gb=function(e){return"<"+db+">"+e+"</"+db+">"},yb=function(e){e.write(gb("")),e.close();var t=e.parentWindow.Object;return e=null,t},vb=function(){try{rb=new ActiveXObject("htmlfile")}catch(nF){}var e,t,i;vb="undefined"!=typeof document?document.domain&&rb?yb(rb):(t=ub("iframe"),i="java"+db+":",t.style.display="none",cb.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(gb("document.F=Object")),e.close(),e.F):yb(rb);for(var n=sb.length;n--;)delete vb[hb][sb[n]];return vb()};lb[fb]=!0;var mb,_b,Eb=Object.create||function(e,t){var i;return null!==e?(pb[hb]=ob(e),i=new pb,pb[hb]=null,i[fb]=e):i=vb(),void 0===t?i:ab.f(i,t)},Tb=ml,bb=yl.RegExp,Sb=Tb((function(){var e=bb(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Cb=ml,kb=yl.RegExp,Ib=Cb((function(){var e=kb("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Pb=Sl,Db=Nl,wb=Mp,Ab=Jp,Rb=qT,xb=Eb,Ob=jh.get,Lb=Sb,Nb=Ib,Mb=zc("native-string-replace",String.prototype.replace),Ub=RegExp.prototype.exec,Bb=Ub,Fb=Db("".charAt),Hb=Db("".indexOf),jb=Db("".replace),Vb=Db("".slice),Kb=(_b=/b*/g,Pb(Ub,mb=/a/,"a"),Pb(Ub,_b,"a"),0!==mb.lastIndex||0!==_b.lastIndex),Wb=Rb.BROKEN_CARET,Gb=void 0!==/()??/.exec("")[1];(Kb||Gb||Wb||Lb||Nb)&&(Bb=function(e){var t,i,n,r,o,a,s,l=this,c=Ob(l),u=wb(e),h=c.raw;if(h)return h.lastIndex=l.lastIndex,t=Pb(Bb,h,u),l.lastIndex=h.lastIndex,t;var d=c.groups,f=Wb&&l.sticky,p=Pb(Ab,l),g=l.source,y=0,v=u;if(f&&(p=jb(p,"y",""),-1===Hb(p,"g")&&(p+="g"),v=Vb(u,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==Fb(u,l.lastIndex-1))&&(g="(?: "+g+")",v=" "+v,y++),i=new RegExp("^(?:"+g+")",p)),Gb&&(i=new RegExp("^"+g+"$(?!\\s)",p)),Kb&&(n=l.lastIndex),r=Pb(Ub,f?i:l,v),f?r?(r.input=Vb(r.input,y),r[0]=Vb(r[0],y),r.index=l.lastIndex,l.lastIndex+=r[0].length):l.lastIndex=0:Kb&&r&&(l.lastIndex=l.global?r.index+r[0].length:n),Gb&&r&&r.length>1&&Pb(Mb,r[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r&&d)for(r.groups=a=xb(null),o=0;o<d.length;o++)a[(s=d[o])[0]]=r[s[1]];return r});var Yb=Bb;cf({target:"RegExp",proto:!0,forced:/./.exec!==Yb},{exec:Yb});var zb=gp,$b=od,Xb=Yb,qb=ml,Zb=pu,Qb=ah,Jb=Zb("species"),eS=RegExp.prototype,tS=function(e,t,i,n){var r=Zb(e),o=!qb((function(){var t={};return t[r]=function(){return 7},7!=""[e](t)})),a=o&&!qb((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Jb]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!o||!a||i){var s=zb(/./[r]),l=t(r,""[e],(function(e,t,i,n,r){var a=zb(e),l=t.exec;return l===Xb||l===eS.exec?o&&!r?{done:!0,value:s(t,i,n)}:{done:!0,value:a(i,t,n)}:{done:!1}}));$b(String.prototype,e,l[0]),$b(eS,r,l[1])}n&&Qb(eS[r],"sham",!0)},iS=Gp.charAt,nS=function(e,t,i){return t+(i?iS(e,t).length:1)},rS=Nl,oS=qc,aS=Math.floor,sS=rS("".charAt),lS=rS("".replace),cS=rS("".slice),uS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,hS=/\$([$&'`]|\d{1,2})/g,dS=Sl,fS=Yu,pS=tc,gS=Fl,yS=Yb,vS=TypeError,mS=function(e,t){var i=e.exec;if(pS(i)){var n=dS(i,e,t);return null!==n&&fS(n),n}if("RegExp"===gS(e))return dS(yS,e,t);throw vS("RegExp#exec called on incompatible receiver")},_S=pv,ES=Sl,TS=Nl,bS=tS,SS=ml,CS=Yu,kS=tc,IS=Gl,PS=ud,DS=vd,wS=Mp,AS=$l,RS=nS,xS=Lc,OS=function(e,t,i,n,r,o){var a=i+e.length,s=n.length,l=hS;return void 0!==r&&(r=oS(r),l=uS),lS(o,l,(function(o,l){var c;switch(sS(l,0)){case"$":return"$";case"&":return e;case"`":return cS(t,0,i);case"'":return cS(t,a);case"<":c=r[cS(l,1,-1)];break;default:var u=+l;if(0===u)return o;if(u>s){var h=aS(u/10);return 0===h?o:h<=s?void 0===n[h-1]?sS(l,1):n[h-1]+sS(l,1):o}c=n[u-1]}return void 0===c?"":c}))},LS=mS,NS=pu("replace"),MS=Math.max,US=Math.min,BS=TS([].concat),FS=TS([].push),HS=TS("".indexOf),jS=TS("".slice),VS="$0"==="a".replace(/./,"$0"),KS=!!/./[NS]&&""===/./[NS]("a","$0");bS("replace",(function(e,t,i){var n=KS?"$":"$0";return[function(e,i){var n=AS(this),r=IS(e)?void 0:xS(e,NS);return r?ES(r,e,n,i):ES(t,wS(n),e,i)},function(e,r){var o=CS(this),a=wS(e);if("string"==typeof r&&-1===HS(r,n)&&-1===HS(r,"$<")){var s=i(t,o,a,r);if(s.done)return s.value}var l=kS(r);l||(r=wS(r));var c=o.global;if(c){var u=o.unicode;o.lastIndex=0}for(var h=[];;){var d=LS(o,a);if(null===d)break;if(FS(h,d),!c)break;""===wS(d[0])&&(o.lastIndex=RS(a,DS(o.lastIndex),u))}for(var f,p="",g=0,y=0;y<h.length;y++){for(var v=wS((d=h[y])[0]),m=MS(US(PS(d.index),a.length),0),_=[],E=1;E<d.length;E++)FS(_,void 0===(f=d[E])?f:String(f));var T=d.groups;if(l){var b=BS([v],_,m,a);void 0!==T&&FS(b,T);var S=wS(_S(r,void 0,b))}else S=OS(v,a,m,_,T,r);m>=g&&(p+=jS(a,g,m)+S,g=m+v.length)}return p+jS(a,g)}]}),!!SS((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!VS||KS);var WS=rc,GS=Fl,YS=pu("match"),zS=function(e){var t;return WS(e)&&(void 0!==(t=e[YS])?!!t:"RegExp"==GS(e))},$S=pd,XS=_d,qS=vf,ZS=Array,QS=Math.max,JS=function(e,t,i){for(var n=XS(e),r=$S(t,n),o=$S(void 0===i?n:i,n),a=ZS(QS(o-r,0)),s=0;r<o;r++,s++)qS(a,s,e[r]);return a.length=s,a},eC=pv,tC=Sl,iC=Nl,nC=tS,rC=Yu,oC=Gl,aC=zS,sC=$l,lC=cv,cC=nS,uC=vd,hC=Mp,dC=Lc,fC=JS,pC=mS,gC=Yb,yC=ml,vC=qT.UNSUPPORTED_Y,mC=4294967295,_C=Math.min,EC=[].push,TC=iC(/./.exec),bC=iC(EC),SC=iC("".slice),CC=!yC((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}));nC("split",(function(e,t,i){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var n=hC(sC(this)),r=void 0===i?mC:i>>>0;if(0===r)return[];if(void 0===e)return[n];if(!aC(e))return tC(t,n,e,r);for(var o,a,s,l=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),u=0,h=new RegExp(e.source,c+"g");(o=tC(gC,h,n))&&!((a=h.lastIndex)>u&&(bC(l,SC(n,u,o.index)),o.length>1&&o.index<n.length&&eC(EC,l,fC(o,1)),s=o[0].length,u=a,l.length>=r));)h.lastIndex===o.index&&h.lastIndex++;return u===n.length?!s&&TC(h,"")||bC(l,""):bC(l,SC(n,u)),l.length>r?fC(l,0,r):l}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:tC(t,this,e,i)}:t,[function(t,i){var r=sC(this),o=oC(t)?void 0:dC(t,e);return o?tC(o,t,r,i):tC(n,hC(r),t,i)},function(e,r){var o=rC(this),a=hC(e),s=i(n,o,a,r,n!==t);if(s.done)return s.value;var l=lC(o,RegExp),c=o.unicode,u=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(vC?"g":"y"),h=new l(vC?"^(?:"+o.source+")":o,u),d=void 0===r?mC:r>>>0;if(0===d)return[];if(0===a.length)return null===pC(h,a)?[a]:[];for(var f=0,p=0,g=[];p<a.length;){h.lastIndex=vC?0:p;var y,v=pC(h,vC?SC(a,p):a);if(null===v||(y=_C(uC(h.lastIndex+(vC?p:0)),a.length))===f)p=cC(a,p,c);else{if(bC(g,SC(a,f,p)),g.length===d)return g;for(var m=1;m<=v.length-1;m++)if(bC(g,v[m]),g.length===d)return g;p=f=y}}return bC(g,SC(a,f)),g}]}),!CC,vC);var kC=fh.PROPER,IC=ml,PC=Vg,DC=Zg.trim;cf({target:"String",proto:!0,forced:function(e){return IC((function(){return!!PC[e]()||"
"!=="
"[e]()||kC&&PC[e].name!==e}))}("trim")},{trim:function(){return DC(this)}});var wC=Pp.filter;cf({target:"Array",proto:!0,forced:!Zf("filter")},{filter:function(e){return wC(this,e,arguments.length>1?arguments[1]:void 0)}});var AC=Sl,RC=Yu,xC=Gl,OC=vd,LC=Mp,NC=$l,MC=Lc,UC=nS,BC=mS;tS("match",(function(e,t,i){return[function(t){var i=NC(this),n=xC(t)?void 0:MC(t,e);return n?AC(n,t,i):new RegExp(t)[e](LC(i))},function(e){var n=RC(this),r=LC(e),o=i(t,n,r);if(o.done)return o.value;if(!n.global)return BC(n,r);var a=n.unicode;n.lastIndex=0;for(var s,l=[],c=0;null!==(s=BC(n,r));){var u=LC(s[0]);l[c]=u,""===u&&(n.lastIndex=UC(r,OC(n.lastIndex),a)),c++}return 0===c?null:l}]}));var FC=ju.f,HC=_l,jC=yl,VC=Nl,KC=ef,WC=Hg,GC=ah,YC=ad.f,zC=lc,$C=zS,XC=Mp,qC=og,ZC=qT,QC=function(e,t,i){i in e||FC(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})},JC=od,ek=ml,tk=Jc,ik=jh.enforce,nk=Jy,rk=Sb,ok=Ib,ak=pu("match"),sk=jC.RegExp,lk=sk.prototype,ck=jC.SyntaxError,uk=VC(lk.exec),hk=VC("".charAt),dk=VC("".replace),fk=VC("".indexOf),pk=VC("".slice),gk=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,yk=/a/g,vk=/a/g,mk=new sk(yk)!==yk,_k=ZC.MISSED_STICKY,Ek=ZC.UNSUPPORTED_Y,Tk=HC&&(!mk||_k||rk||ok||ek((function(){return vk[ak]=!1,sk(yk)!=yk||sk(vk)==vk||"/a/i"!=sk(yk,"i")})));if(KC("RegExp",Tk)){for(var bk=function(e,t){var i,n,r,o,a,s,l=zC(lk,this),c=$C(e),u=void 0===t,h=[],d=e;if(!l&&c&&u&&e.constructor===bk)return e;if((c||zC(lk,e))&&(e=e.source,u&&(t=qC(d))),e=void 0===e?"":XC(e),t=void 0===t?"":XC(t),d=e,rk&&"dotAll"in yk&&(n=!!t&&fk(t,"s")>-1)&&(t=dk(t,/s/g,"")),i=t,_k&&"sticky"in yk&&(r=!!t&&fk(t,"y")>-1)&&Ek&&(t=dk(t,/y/g,"")),ok&&(o=function(e){for(var t,i=e.length,n=0,r="",o=[],a={},s=!1,l=!1,c=0,u="";n<=i;n++){if("\\"===(t=hk(e,n)))t+=hk(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:uk(gk,pk(e,n+1))&&(n+=2,l=!0),r+=t,c++;continue;case">"===t&&l:if(""===u||tk(a,u))throw new ck("Invalid capture group name");a[u]=!0,o[o.length]=[u,c],l=!1,u="";continue}l?u+=t:r+=t}return[r,o]}(e),e=o[0],h=o[1]),a=WC(sk(e,t),l?this:lk,bk),(n||r||h.length)&&(s=ik(a),n&&(s.dotAll=!0,s.raw=bk(function(e){for(var t,i=e.length,n=0,r="",o=!1;n<=i;n++)"\\"!==(t=hk(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),r+=t):r+="[\\s\\S]":r+=t+hk(e,++n);return r}(e),i)),r&&(s.sticky=!0),h.length&&(s.groups=h)),e!==d)try{GC(a,"source",""===d?"(?:)":d)}catch(nF){}return a},Sk=YC(sk),Ck=0;Sk.length>Ck;)QC(bk,sk,Sk[Ck++]);lk.constructor=bk,bk.prototype=lk,JC(jC,"RegExp",bk,{constructor:!0})}nk("RegExp");var kk="undefined"!=typeof window&&window.location.href.indexOf("loggerdebug")>-1;function Ik(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0,i=0;i<e.length;i++){var n=e[i].end,r=e[i].begin;Number.isNaN(Number(n))||Number.isNaN(Number(r))||r<0||n<0||n<r||(t+=e[i].end-e[i].begin)}return t=parseInt(1e3*t,10)}function Pk(e){if(null==e||""===e||"string"!=typeof e)return"";var t=e.split("/"),i="";return t.length>3&&t[2]&&(i=t[2]),i}function Dk(e){var t={};if(e instanceof window.XMLHttpRequest)try{e.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((function(e){var i=e.split(": "),n=i.shift(),r=i.join(": ");t[n]=r}))}catch(nF){return t}return t}function wk(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];kk&&(t=console).log.apply(t,["[logger]",e].concat(n))}function Ak(){try{return Math.round(window.performance.now())}catch(nF){return(new Date).getTime()}}function Rk(){return(new Date).getTime()}function xk(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,n){try{e||n(new Error("url is undefined"));var r=Ak(),o=r,a={},s=new window.XMLHttpRequest;s.open("get",e),s.onreadystatechange=function(){2===s.readyState&&(a.headers=Dk(s),a.connectTime=Ak()-o,a.status=s.status,a.statusText=s.statusText,r=Ak())},s.onload=function(){i(a)},s.onprogress=function(e){var t,i=Ak()-r;t=parseInt(e.loaded/1e3/(i/1e3),10),a.speed=0|t,a.costTime=i},s.onerror=function(){a.status||(a.status=-1,a.costTime=Ak()-r),n(a)},s.ontimeout=function(){a.status||(a.status=-2,a.costTime=Ak()-r),i(a)},s.onabort=function(){i(a)},s.responseType="arraybuffer",s.timeout=t.timeout||1e4,s.setRequestHeader("Range","bytes=".concat(t.range||"0-1048576")),s.send()}catch(l){n(l)}}))}function Ok(e){return!e||window.location.href.indexOf(e)>-1}function Lk(e){return!!e&&/^blob:/.test(e)}var Nk={x_response_sinfo:"x-response-sinfo",x_response_cache:"x-response-cache",x_response_cinfo:"x-response-cinfo"};function Mk(e){if(!e)return{};var t={};return Object.keys(Nk).map((function(i){if(e[i]||"string"!=typeof Nk[i]){if(!e[i]&&Nk[i]instanceof Array){var n=Nk[i].filter((function(t){return void 0!==e[t]}));n.length>0?t[i]=e[n[0]]:t[i]=""}}else t[i]=e[Nk[i]]||""})),t}function Uk(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function Bk(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(n){var i=e.className&&"object"===ll(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)".concat(t,"(\\s|$)")))}}function Fk(e){return"String"===Uk(e)?e.replace("P","p"):e?"Number"===Uk(e)?"".concat(e):void 0:""}function Hk(e){try{return JSON.stringify(e)}catch(t){return""}}var jk=0,Vk=1,Kk=2;function Wk(e,t){return Math.round(t/e*1e3*100)}var Gk=[];"undefined"!=typeof window&&function(){try{new window.PerformanceObserver((function(e){var t=e.getEntriesByType("resource");Gk.length>30&&Gk.splice(0,Gk.length-30);for(var i=0;i<t.length;i++)Gk.push(t[i])})).observe({entryTypes:["resource"]})}catch(e){console.warn("PerformanceObserver not support",e)}}();var Yk="videoplayer_oneplay",zk="videoplayer_oneopera",$k="videoplayer_oneerror",Xk="videoplayer_oneevent",qk="videoplayer_onetemp",Zk={data:1e3,runtime:1002,parse:1004,network:1003,no_error_handler:9997,custom_error:9998,other:9999,notSupport:1005},Qk={1:-499991,2:-499992,3:-499993,4:-499994,5:-499995},Jk=0,eI=1,tI=2,iI=3,nI=4,rI=0,oI=1,aI=2,sI=3,lI=1,cI=2,uI=3,hI=4,dI=5,fI=6,pI=7,gI="error_retry",yI="oneerror",vI="oneevent",mI="onetemp",_I=0,EI=1,TI=864e5,bI=36e5,SI=["tag","subtag","device_type"],CI={NO_FULLSCREEN:0,FULLSCREEN:1,CSS:2};var kI=function(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e){return!1}}()&&!function(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(t){return!0}}()?window.localStorage:{},II="__xgplayerlogkey",PI={set:function(e){try{var t=this.get();t.push(e),kI.setItem(II,JSON.stringify(t))}catch(nF){}},get:function(){try{var e=kI.getItem(II);return e=e?JSON.parse(e):[]}catch(nF){return[]}},remove:function(){try{kI.removeItem(II)}catch(nF){}},clear:function(){try{kI.clear()}catch(nF){}}},DI={},wI=Fl,AI=Zl,RI=ad.f,xI=JS,OI="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];DI.f=function(e){return OI&&"Window"==wI(e)?function(e){try{return RI(e)}catch(nF){return xI(OI)}}(e):RI(AI(e))};var LI={},NI=pu;LI.f=NI;var MI=yl,UI=Jc,BI=LI,FI=ju.f,HI=Sl,jI=sc,VI=pu,KI=od,WI=cf,GI=yl,YI=Sl,zI=Nl,$I=_l,XI=_c,qI=ml,ZI=Jc,QI=lc,JI=Yu,eP=Zl,tP=ku,iP=Mp,nP=Al,rP=Eb,oP=Rp,aP=ad,sP=DI,lP=Ld,cP=vl,uP=ju,hP=ZT,dP=Cl,fP=od,pP=zc,gP=Ph,yP=ru,vP=pu,mP=LI,_P=function(e){var t=MI.Symbol||(MI.Symbol={});UI(t,e)||FI(t,e,{value:BI.f(e)})},EP=function(){var e=jI("Symbol"),t=e&&e.prototype,i=t&&t.valueOf,n=VI("toPrimitive");t&&!t[n]&&KI(t,n,(function(e){return HI(i,this)}),{arity:1})},TP=$y,bP=jh,SP=Pp.forEach,CP=Ih("hidden"),kP="Symbol",IP="prototype",PP=bP.set,DP=bP.getterFor(kP),wP=Object[IP],AP=GI.Symbol,RP=AP&&AP[IP],xP=GI.TypeError,OP=GI.QObject,LP=cP.f,NP=uP.f,MP=sP.f,UP=dP.f,BP=zI([].push),FP=pP("symbols"),HP=pP("op-symbols"),jP=pP("wks"),VP=!OP||!OP[IP]||!OP[IP].findChild,KP=$I&&qI((function(){return 7!=rP(NP({},"a",{get:function(){return NP(this,"a",{value:7}).a}})).a}))?function(e,t,i){var n=LP(wP,t);n&&delete wP[t],NP(e,t,i),n&&e!==wP&&NP(wP,t,n)}:NP,WP=function(e,t){var i=FP[e]=rP(RP);return PP(i,{type:kP,tag:e,description:t}),$I||(i.description=t),i},GP=function(e,t,i){e===wP&&GP(HP,t,i),JI(e);var n=tP(t);return JI(i),ZI(FP,n)?(i.enumerable?(ZI(e,CP)&&e[CP][n]&&(e[CP][n]=!1),i=rP(i,{enumerable:nP(0,!1)})):(ZI(e,CP)||NP(e,CP,nP(1,{})),e[CP][n]=!0),KP(e,n,i)):NP(e,n,i)},YP=function(e,t){JI(e);var i=eP(t),n=oP(i).concat(qP(i));return SP(n,(function(t){$I&&!YI(zP,i,t)||GP(e,t,i[t])})),e},zP=function(e){var t=tP(e),i=YI(UP,this,t);return!(this===wP&&ZI(FP,t)&&!ZI(HP,t))&&(!(i||!ZI(this,t)||!ZI(FP,t)||ZI(this,CP)&&this[CP][t])||i)},$P=function(e,t){var i=eP(e),n=tP(t);if(i!==wP||!ZI(FP,n)||ZI(HP,n)){var r=LP(i,n);return!r||!ZI(FP,n)||ZI(i,CP)&&i[CP][n]||(r.enumerable=!0),r}},XP=function(e){var t=MP(eP(e)),i=[];return SP(t,(function(e){ZI(FP,e)||ZI(gP,e)||BP(i,e)})),i},qP=function(e){var t=e===wP,i=MP(t?HP:eP(e)),n=[];return SP(i,(function(e){!ZI(FP,e)||t&&!ZI(wP,e)||BP(n,FP[e])})),n};XI||(AP=function(){if(QI(RP,this))throw xP("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?iP(arguments[0]):void 0,t=yP(e),i=function(e){this===wP&&YI(i,HP,e),ZI(this,CP)&&ZI(this[CP],t)&&(this[CP][t]=!1),KP(this,t,nP(1,e))};return $I&&VP&&KP(wP,t,{configurable:!0,set:i}),WP(t,e)},fP(RP=AP[IP],"toString",(function(){return DP(this).tag})),fP(AP,"withoutSetter",(function(e){return WP(yP(e),e)})),dP.f=zP,uP.f=GP,hP.f=YP,cP.f=$P,aP.f=sP.f=XP,lP.f=qP,mP.f=function(e){return WP(vP(e),e)},$I&&(NP(RP,"description",{configurable:!0,get:function(){return DP(this).description}}),fP(wP,"propertyIsEnumerable",zP,{unsafe:!0}))),WI({global:!0,constructor:!0,wrap:!0,forced:!XI,sham:!XI},{Symbol:AP}),SP(oP(jP),(function(e){_P(e)})),WI({target:kP,stat:!0,forced:!XI},{useSetter:function(){VP=!0},useSimple:function(){VP=!1}}),WI({target:"Object",stat:!0,forced:!XI,sham:!$I},{create:function(e,t){return void 0===t?rP(e):YP(rP(e),t)},defineProperty:GP,defineProperties:YP,getOwnPropertyDescriptor:$P}),WI({target:"Object",stat:!0,forced:!XI},{getOwnPropertyNames:XP}),EP(),TP(AP,kP),gP[CP]=!0;var ZP=_c&&!!Symbol.for&&!!Symbol.keyFor,QP=cf,JP=sc,eD=Jc,tD=Mp,iD=zc,nD=ZP,rD=iD("string-to-symbol-registry"),oD=iD("symbol-to-string-registry");QP({target:"Symbol",stat:!0,forced:!nD},{for:function(e){var t=tD(e);if(eD(rD,t))return rD[t];var i=JP("Symbol")(t);return rD[t]=i,oD[i]=t,i}});var aD=cf,sD=Jc,lD=kc,cD=Pc,uD=ZP,hD=zc("symbol-to-string-registry");aD({target:"Symbol",stat:!0,forced:!uD},{keyFor:function(e){if(!lD(e))throw TypeError(cD(e)+" is not a symbol");if(sD(hD,e))return hD[e]}});var dD=cf,fD=sc,pD=pv,gD=Sl,yD=Nl,vD=ml,mD=hf,_D=tc,ED=rc,TD=kc,bD=yv,SD=_c,CD=fD("JSON","stringify"),kD=yD(/./.exec),ID=yD("".charAt),PD=yD("".charCodeAt),DD=yD("".replace),wD=yD(1..toString),AD=/[\uD800-\uDFFF]/g,RD=/^[\uD800-\uDBFF]$/,xD=/^[\uDC00-\uDFFF]$/,OD=!SD||vD((function(){var e=fD("Symbol")();return"[null]"!=CD([e])||"{}"!=CD({a:e})||"{}"!=CD(Object(e))})),LD=vD((function(){return'"\\udf06\\ud834"'!==CD("\udf06\ud834")||'"\\udead"'!==CD("\udead")})),ND=function(e,t){var i=bD(arguments),n=t;if((ED(t)||void 0!==e)&&!TD(e))return mD(t)||(t=function(e,t){if(_D(n)&&(t=gD(n,this,e,t)),!TD(t))return t}),i[1]=t,pD(CD,null,i)},MD=function(e,t,i){var n=ID(i,t-1),r=ID(i,t+1);return kD(RD,e)&&!kD(xD,r)||kD(xD,e)&&!kD(RD,n)?"\\u"+wD(PD(e,0),16):e};CD&&dD({target:"JSON",stat:!0,arity:3,forced:OD||LD},{stringify:function(e,t,i){var n=bD(arguments),r=pD(OD?ND:CD,null,n);return LD&&"string"==typeof r?DD(r,AD,MD):r}});var UD=Ld,BD=qc;cf({target:"Object",stat:!0,forced:!_c||ml((function(){UD.f(1)}))},{getOwnPropertySymbols:function(e){var t=UD.f;return t?t(BD(e)):[]}});var FD=cf,HD=_l,jD=yl,VD=Nl,KD=Jc,WD=tc,GD=lc,YD=Mp,zD=ju.f,$D=Gd,XD=jD.Symbol,qD=XD&&XD.prototype;if(HD&&WD(XD)&&(!("description"in qD)||void 0!==XD().description)){var ZD={},QD=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:YD(arguments[0]),t=GD(qD,this)?new XD(e):void 0===e?XD():XD(e);return""===e&&(ZD[t]=!0),t};$D(QD,XD),QD.prototype=qD,qD.constructor=QD;var JD="Symbol(test)"==String(XD("test")),ew=VD(qD.valueOf),tw=VD(qD.toString),iw=/^Symbol\((.*)\)[^)]+$/,nw=VD("".replace),rw=VD("".slice);zD(qD,"description",{configurable:!0,get:function(){var e=ew(this);if(KD(ZD,e))return"";var t=tw(e),i=JD?rw(t,7,-1):nw(t,iw,"$1");return""===i?void 0:i}}),FD({global:!0,constructor:!0,forced:!0},{Symbol:QD})}var ow=[{key:"QQBrowser",reg:/(qqbrowser)\/([\d.]+)/},{key:"QIHU360EE",reg:/qihu 360ee/},{key:"QIHU360SE",reg:/qihu 360se/},{key:"2345Explorer",reg:/(2345explorer)\/([\d.]+)/},{key:"Sogou",reg:/(metasr)/},{key:"Wexin",reg:/(micromessenger)\/([\d.]+)/},{key:"Openlanguage",reg:/(openlanguage)\/([\d.]+)/},{key:"NewsArticle",reg:/(newsarticle)\/([\d.]+)/},{key:"VideoArticle",reg:/(videoarticle)\/([\d.]+)/},{key:"Hotsoon",reg:/(live_stream)_([\d.]+)/},{key:"Aweme",reg:/(aweme)_([\d.]+)/},{key:"Lark",reg:/(lark)\/([\d.]+)/},{key:"PlayStation",reg:/(playstation)/},{key:"BingPreview",reg:/(bingpreview)\/([\d.]+)/},{key:"Baiduspider",reg:/(baiduspider-render)\/([\d.]+)/},{key:"YandexBot",reg:/(yandexbot)\/([\d.]+)/},{key:"Chrome",reg:/(chrome)\/([\d.]+)/},{key:"Safari",reg:/(version)\/([\d.]+)\s*(safari)/}],aw=[{key:"Trident",reg:/(rv:)([\d.]+)/},{key:"Trident",reg:/(msie)\s*([\d.]+)/}],sw=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"];var lw=["Baiduspider","YandexBot"],cw=["Baiduspider","googlebot","360Spider","haosouspider","YoudaoBot","Sogou News Spider","Yisouspider","Googlebot","Headless","Applebot","Bingbot","PetalBot"];var uw="undefined"!=typeof navigator&&function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e=e.toLocaleLowerCase();var t=/(iphone)/.test(e)||/(ipad)/.test(e),i=/(android)/.test(e),n=/(windows phone)/.test(e),r=t||i||n,o={isIOS:t,isAndroid:i,isMobile:r,isPC:!r,isPad:/(ipad)/.test(e)},a=function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;var t=document.createElement("video");return"function"==typeof t.canPlayType?(sw.map((function(i){"probably"===t.canPlayType('video/mp4; codecs="'.concat(i,'"'))&&(e.isSupport=!0,e.mime+="||".concat(i))})),e):(t=null,e)}();o.isSupportMP4=a.isSupport,o.mime=a.mime;var s="",l=0,c=[],u=ow;/trident/.test(e)&&(u=aw);for(var h=0;h<u.length;h++)if(c=u[h].reg.exec(e)){s=u[h].key,l=c.length>2?c[2]:"";break}if(s)o["is".concat(s)]=!0,o.name=s,o.appVersion=l;else{var d=function(){var e=navigator.mimeTypes;if(e){for(var t=0;t<e.length;t++){if(e[t].type&&e[t].type.indexOf("360")>-1)return!0;if(e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1)return!0;if(e[t].description&&e[t].description.indexOf("360")>-1)return!0}return!1}}();d&&(o.name="360EE")}return o.name&&"Trident"!==o.name&&/(trident)/.exec(e)&&(o.name=o.name?"".concat(o.name,"_Trident"):"Trident"),o.isSpider=function(e,t){var i=!1;lw.map((function(t){t===e&&(i=!0)}));for(var n=0;n<cw.length;n++){var r=cw[n];if(-1!==t.indexOf(r)){i=!0;break}}return i}(o.name,e),o}(navigator.userAgent);function hw(){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"'))}var dw=[1,1,1,1,1];function fw(){return parseInt(dw.join(""),10)}dw[0]=uw.isSupportMP4?dw[1]+1:dw[1],dw[1]=hw()?dw[1]+1:dw[1],function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var i=e.video||{},n=e.audio||{};try{var r=MediaSource.isTypeSupported(i.contentType),o=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:r&&o,smooth:!1,powerEfficient:!1})}catch(a){return Promise.resolve(t)}}({type:"file",video:{contentType:'video/mp4;codecs="hev1.1.6.L120.90"',width:1920,height:1080,bitrate:1e4,framerate:30}}).then((function(e){e&&e.supported?dw[2]=dw[2]+1:dw[2]=1})).catch((function(){dw[2]=dw[2]-1}));var pw={range:"0-1048576",timer:6e4,timeout:15e3},gw=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};cl(this,e),Object.keys(pw).map((function(e){void 0!==t[e]&&null!==t[e]||(t[e]=pw[e])})),this.options=t,this._headers={},this.intervalId=null,this.ishangUp=!1,this._data={contentLength:0,statusText:"",status:-1,speed:0,costTime:0,connectTime:0,contentType:""},this.url=[]}return hl(e,[{key:"setData",value:function(e){var t=this;if(Object.keys(e).map((function(i){"headers"!==i&&(t._data[i]=e[i])})),e.headers&&Object.keys(e.headers).length>0){this._headers=Mk(e.headers),e.headers["content-type"]&&(this._data.contentType=e.headers["content-type"]);var i=(e.headers["content-range"]||"").split("/");i&&i.length>1&&(this._data.contentLength=parseInt(i[1]))}}},{key:"contentLength",get:function(){return this._data.length||0}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"start",n=this.options;this.url=e,!this.url||"start"!==i&&(this.ishangUp||this.intervalId)?wk("task>>cant`t trigger url",this.ishangUp,this.intervalId):(wk("task>>trigger url ",e),this.ishangUp=!0,this.intervalId&&this.clear(),this.intervalId=setTimeout((function(){t.clear()}),"start"===i?500:n.timer),xk(this.url,{range:"start"===i?"0-1024":n.range,timeout:n.timeout}).then((function(e){wk("getXhr>>check result ",e),t.setData(e||{}),t.ishangUp=!1})).catch((function(e){wk("getXhr>>error ",e),t.ishangUp=!1,t._data.status=-1})))}},{key:"url",get:function(){return this.options.url},set:function(e){e&&(this.options.url=e)}},{key:"serverIp",get:function(){return this._headers.x_response_sinfo||""}},{key:"headers",get:function(){return this._headers||{}}},{key:"status",get:function(){return this._data.status||-1}},{key:"speed",get:function(){return this._data.speed}},{key:"clear",value:function(){clearTimeout(this.intervalId),this.intervalId=null}}]),e}(),yw="ProgressInfo";var vw=function(){function e(){cl(this,e),this._init()}return hl(e,[{key:"_init",value:function(){this.played=[],this.playedSize=0,this.cachedSize=0,this.pcdnCached=0,this.cachedVideoSize=0,this.pcdnVideoCached=0,this.file={audio:0,video:0},this.lastBitrate=null,this.curBitrate={vBitrate:0,aBitrate:0,cdnSize:0,pcdnSize:0,definition:"",fileid:""},this.nextBitrate={start:-1},this.currentTime=0,this.buffered=[],this.cachedTime=0,this.duration=0}},{key:"reset",value:function(){this._init()}},{key:"getFileSize",value:function(e){var t=this.curBitrate,i=t.vBitrate,n=t.aBitrate;return{audio:Math.round(e*n/8),video:Math.round(e*i/8),total:Math.round(e*(i+n)/8)}}},{key:"updatePlayed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.played,n=i.length;if(0===t||n<1){var r=n>0?i[n-1]:null,o=this.curBitrate,a=o.vBitrate,s=o.aBitrate;r&&(r.end<0||r.end-r.start<1)?(r.end<0?r.start=e:r.end=e,r.vBitrate=a,r.aBitrate=s):i.push({start:e,end:-1,vBitrate:a,aBitrate:s})}else i[n-1].end=e}},{key:"calculatePlaySize",value:function(){var e=this.played,t=this.curBitrate,i=function(e){for(var t=0,i=0;i<e.length;i++){var n=e[i];n.end<0||(t+=n.end-n.start)}return t}(e),n=Math.round((t.aBitrate+t.vBitrate)*i/8);return this.playedSize+=n,wk(yw,"calculatePlaySize","duration: ".concat(i," playedSize:").concat(this.playedSize),this.played),this.played=[],this.playedSize}},{key:"copyBitrateInfo",value:function(e,t){return["aBitrate","vBitrate","definition","fileid","cdnSize","pcdnSize"].forEach((function(i){e[i]&&(t[i]=e[i])})),t.cdnSize=e.cdnSize,t.pcdnSize=e.pcdnSize,t}},{key:"checkNextBitrate",value:function(e){var t=this.nextBitrate;if(t.start>-1&&e>=t.start){var i=this.curBitrate;this.calculatePlaySize(),wk(yw,"checkNextBitrate",e,t.start,this.cachedSize),this.copyBitrateInfo(t,i),this.updatePlayed(e,0),t.start=-1,t.fileid="",["vBitrate","aBitrate","cdnSize","pcdnSize"].forEach((function(e){t[e]=0}))}}},{key:"updateLastDefInfo",value:function(){var e=this.curBitrate;if(e.vBitrate>0){var t={};this.copyBitrateInfo(e,t),this.lastBitrate=t}}},{key:"updateDefInfo",value:function(e,t){wk(yw,"updateDefInfo",t,this.curBitrate.vBitrate,e);var i=e.mediaType,n=e.start,r=e.bitrate,o=e.definition,a=e.fileid,s={cdnSize:0,pcdnSize:0};"audio"===i?s.aBitrate=r:(s.vBitrate=r,s.definition=o,s.fileid=a,this.updateLastDefInfo()),s.start=n,this.nextBitrate=s,this.checkNextBitrate(t)}},{key:"upDateDownload",value:function(e){var t=e.cdn_size,i=e.pcdn_size,n=e.mediaType,r=this.curBitrate,o=this.nextBitrate,a=0,s=0;i?(a=1,s=i):t&&(s=t),this.cachedSize+=s,"video"===n&&(this.cachedVideoSize+=s,a>0&&(this.pcdnVideoCached+=s)),a>0&&(this.pcdnCached+=s);var l=o.start>=0?o:r;l.cdnSize+=s,a>0&&(l.pcdnSize+=s)}},{key:"updateBuffered",value:function(e){var t=function(e){var t=[];if(!e||e.length<1)return t;for(var i=0;i<e.length;i++){var n=parseInt(1e3*e.start(i),10)/1e3,r=parseInt(1e3*e.end(i),10)/1e3;t.push({start:n,end:r})}return t}(e),i=0;t.forEach((function(e){var t,n;i+=(t=e.end,n=e.start,parseInt(1e3*t-1e3*n,10)/1e3)})),this.buffered=t,this.cachedTime=i}},{key:"isDefInfoFirstChange",value:function(){return!(this.curBitrate&&this.curBitrate.vBitrate>0)}}]),e}();const mw="0.12.10";var _w=["try_req_num","req_node_succ","conn_req_num","has_ret_node","conn_fail_num","conn_jump_num"];wk("xgVodLogger version is ".concat(mw));var Ew,Tw=(Ew="Object",function(e){return Object.prototype.toString.call(e)==="[object ".concat(Ew,"]")}),bw=1300,Sw="__tea_cache_tokens_".concat(bw),Cw="",kw=null,Iw=function(){function e(t,i){var n=this;if(cl(this,e),dl(this,"initializeUrlLog",(function(e){var t=e&&e.url?e.url:"String"===Uk(e)?e:"";"String"!==Uk(t)&&(t=""),n.urlLog={initial_url:t,initial_host:Pk(t),initial_ip:""}})),dl(this,"onXgLogCache",(function(){var e,t=n._getLogCache();t&&(n._templog={vtype:null===(e=n.player)||void 0===e?void 0:e.vtype,log:t},n.onOneTemp())})),dl(this,"onPrfDataSize",(function(e){n._progressInfo.upDateDownload(e)})),dl(this,"onDegrade",(function(e){e&&(e.local_time=(new Date).getTime(),n.onOneEvent({end_type:"degrade"},e))})),dl(this,"onMediaFormatError",(function(e){n.onOneEvent({end_type:"".concat(e.error_type||"","Error")})})),dl(this,"onReplayBtnClick",(function(){n.resetLoggerParams()})),dl(this,"onBeforeDefinitionChange",(function(){n.resLogs.ldst=Ak(),n._endType="switch"})),dl(this,"onDefinitionChangeDetail",(function(e){var t=n._progressInfo;t.updateDefInfo(e,n.player.currentTime),t.lastBitrate&&"video"===e.mediaType&&n.sendSwitchOpera("changedetail")})),dl(this,"onDefinitionChange",(function(e){var t=e.from,i=e.to;n.changeResolution({from:t,to:i,startTime:n.resLogs.ldst,operaType:"switch"}),wk("onDefinitionChange from:".concat(t,", to:").concat(i))})),dl(this,"onDefiChangeSuccess",(function(){wk("onDefinitionChangeSuccess"),n.updateVideoSize(),n.triggerTask("start")})),dl(this,"onAbrChange",(function(e){var t=e.prev,i=e.cur,r=e.abrInfo;if(n.player.abrInstance){var o=n.player.abrInstance.eventInfo;wk("abrChange",o),o.last_definition=t,o.now_definition=i,n.abrInfo.abr_event_info.video_switch.push(o),n.changeResolution({from:t,to:i,startTime:Ak(),operaType:"abr_switch",abrInfo:r})}})),dl(this,"onTimeUpdate",(function(){var e=n.playlogs,t=n.resLogs,i=n.player;if(n.errorLog.try_err_c=0,e.vt||1!==n.startStep||(e.vt=Rk(),wk("onTimeUpdate: first frame inited","currentTime11:".concat(i.currentTime," vt-pt:").concat(e.vt-e.pt," vt-nt:").concat(e.vt-e.nt," vt-rt:").concat(e.vt-e.rt)),n.startStep=2),!t.initial_resolution){var r=i.currentDefitionFromPlayer&&i.currentDefitionFromPlayer.definition?i.currentDefitionFromPlayer.definition:i.config.defaultDefinition||"".concat(i.video.videoHeight,"p")||"";r=Fk(r),t.initial_resolution=r}t.final_resolution||(t.final_resolution=t.initial_resolution);var o=e.played.length;o<1?e.played.push({begin:i.currentTime,end:-1}):e.played[o-1].end=i.currentTime,n._progressInfo.updatePlayed(i.currentTime),n._progressInfo.checkNextBitrate(i.currentTime);var a=t.played.length;a<1?t.played.push({begin:i.currentTime,end:-1}):t.played[a-1].end=i.currentTime,n.lastVideoTime=i.currentTime||0})),dl(this,"onVideoProgress",(function(){n.updateBuffers(),n._progressInfo.updateBuffered(n.player.buffered)})),dl(this,"onCanplay",(function(){wk("onCanplay","this.startStep:".concat(n.startStep," ").concat(Rk())),n.setVt()})),dl(this,"onLoadeddata",(function(){wk("onLoadeddata","this.startStep:".concat(n.startStep," ").concat(Rk())),n.setVt(),n.updateVideoSize()})),dl(this,"onLoadStart",(function(){n.commonParams.web_url=location.href;var e=Ok(n.player.currentSrc);n.triggerTask("start"),wk("onLoadStart","this.startStep:".concat(n.startStep," ").concat(Rk()," isSrcEmpty:").concat(e," player.src:").concat(n.player.src)),0!==n.startStep||e||"visible"!==document.visibilityState||n.setPt()})),dl(this,"onBufferedChange",(function(){var e=n.player.video&&n.player.video.buffered;if(e){var t=e.length;t>0&&e.end(t-1)+1>n.player.duration&&(n.bft=Rk())}})),dl(this,"onPlayerInited",(function(){wk("player init"),n._playerCreatedTime=Rk(),n.playlogs.rt=Rk()})),dl(this,"onNotAutoPlay",(function(){wk("onNotAutoPlay","autoplay:".concat(n.isAutoplay)),0===n.isAutoplay?n.isAutoplay=2:1===n.isAutoplay&&(n.isAutoplay=3)})),dl(this,"onPlayerError",(function(e){e=e||{};var t=n.errorLog,i=n.player;if(wk("onPlayerError","this.player.type:".concat(n.player.type," this.player.replayRunning:").concat(n.player.replayRunning," isSupportMP4:").concat(uw.isSupportMP4," isPC:").concat(uw.isPC)),wk("onPlayerError",e),n.load_state=sI,n._endType="error",n.suspendWaitingStatus("onPlayerError"),n._progressInfo.calculatePlaySize(),"dash"!==i.type||!i.replayRunning){if(e.url||(e.url=n.player.currentSrc),uw.isPC&&!uw.isSupportMP4||uw.isSpider)return t.errc=Qk[5],t.errt=Zk.notSupport,n.onOneError({errorType:t.errt,code:t.errc,url:e.url,headers:e.headers||{},message:e.message||""},0),void(n._isOnePlayReport=!0);t.errt=e.errorTypeCode||(e.errorType&&Zk[e.errorType]?Zk[e.errorType]:9999),t.message=e.message||"",e.errorCode?t.errc=e.errorCode>0&&Qk[e.errorCode]?Qk[e.errorCode]:e.errorCode:e.code&&(t.errc=e.code>0&&Qk[e.code]?Qk[e.code]:e.code),t.last_errors.push(t.errc),0===t.fir_errc&&(t.fir_errc=t.errc),n.sendSwitchOpera(lI),n.onOnePlay(lI),n.onOneTemp(lI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade);var r=!1,o=e.mediaError;o&&n._options.needXhrCheck&&(4===o.code||2===o)&&(r=!0),n.onOneError({endState:pI,errorType:t.errt,code:t.errc,url:e.url,headers:e.headers||{},message:e.message||""},0,r),n.sendEventsQueue()}})),dl(this,"onPlayInterfaceInfo",(function(e){wk("onPlayInterfaceInfo",e);var t=n.errorLog,i=n.apiLog,r=n.playlogs;if(e&&Object.keys(e).map((function(t){"code"===t?i.vsc=e[t]:"message"===t?i.vsc_message=e.message||"success,视频可正常播放":i[t]=e[t]})),r.at=e.timestamep||(new Date).getTime(),(!e.error||-9988!==e.error.errc)&&(i.vsc=e.code||10,i.vsc_message=e.message||"success,视频可正常播放",e.error)){var o=e.error;t.errt=1e3,t.errc=o.errc||-9998,t.last_errors.push(o.errc||-9998),0===t.fir_errc&&(t.fir_errc=o.errc||-9998),t.accu_errc++,1===t.accu_errc&&(t.fir_errt=Ak()),n.onOneError({errorType:1e3,code:o.errc||-9998,url:"",headers:{}})}})),dl(this,"onProgressEvent",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.netLog;if(e.speed){var i=e.speed>1e6?Math.floor(e.speed/1e3):e.speed;t.downloadSpeed=i,t.totalSpeed+=i,t.rqCount++}"oversize"!==e.type&&t.requestCount++,e.connectTime&&(t.connectCost=e.connectTime);var r=t.rqCount<7?100:e.costTime>=5e3?20:10;if(!("success"===e.type&&parseInt(100*Math.random(),10)<=r)){var o=function(e){var t={};try{e=e.replace(/^http:|^https:/,"");for(var i=Gk||[],n=function(n){if(i[n].name.replace(/^http:|^https:/,"")===e)return["domainLookupEnd","domainLookupStart","startTime","requestStart","responseEnd","responseStart","connectStart","connectEnd","fetchStart"].map((function(e){t[e]=Math.round(i[n][e])})),t.url=i[n].name,t.duration=Math.round(i[n].duration),t.domainDuration=t.domainLookupEnd-t.domainLookupStart,t.connectDuration=t.connectEnd-t.connectStart,"break"},r=i.length-1;r>=0&&"break"!==n(r);r--);return t}catch(o){return t}}(e.cdnUrl),a=e.xhr||{},s=e.type?"progress_".concat(e.type):"progress",l=e.headers;l||(l=Dk(a));var c=sl(sl({},l=Mk(l)),{},{download_speed:t.downloadSpeed,connect_cost:t.connectCost,c_dur:o.connectDuration||0,d_dur:o.domainDuration||0,r_dur:o.duration||0,rqtt:(new Date).getTime(),x_cache:l.x_response_cache||"",server_ip:l.x_response_sinfo});e.status?t.status=e.status:a&&a instanceof window.XMLHttpRequest&&(t.status=a.status||0),c.status=t.status;var u=e.cdnUrl||e.url;"error"===e.type&&n.merror.cdn.push(sl(sl({costTime:e.costTime,cur_play_pos:e.pos,cdn_url:u,cdn_host:Pk(u)},c),l)),n.onOneEvent({costTime:e.costTime,vid:e.vid,end_type:s,cur_play_pos:e.pos,cdn_url:u,cdn_host:Pk(u)},c,"error"===e.type?0:2)}})),dl(this,"onNext",(function(){if(wk("onNext:startStep:",n.startStep),n.startStep>0){if(n._reportInvalidVV(cI))return;n.sendSwitchOpera(cI),n.onOnePlay(cI),n.onOneTemp(cI),n.sendEventsQueue()}n.vtype=null,n.playlogs.lc=0,n.resetLoggerParams()})),dl(this,"onNextEnded",(function(){var e=n.player,t=n.resLogs,i=Fk(e.config.defaultDefinition||"");t.initial_resolution=i,t.final_resolution=i})),dl(this,"onXgLogWaiting",(function(e){var t=n.playlogs,i=n.resLogs,r=n.stall;if(n._options.checkByInnerLog&&0===e.type){wk("onXgLogWaiting",e);var o=e.endType,a=e.costTime,s=e.start,l={download_speed:n.realSpeed,avg_speed:n.avgSpeed,mse_op:n.mp4MseOpLength,mp4_load_range:n.mp4LoadSegmentTimeRange,bitrate:n.curBitrate};if("waitingStart"===e.eventType)return n.onOneEvent({costTime:a,end_type:"waitstart"},l,2),void n.appendStallInfo("start",s);if("waitingEnd"===e.eventType){var c=Ak();wk("onXgLogWaiting>>".concat(o,"|costTime:").concat(a," vt:").concat(t.vt)),n.appendStallInfo("end",c,o),t.bc++,n.checkInBuffer(n.player.currentTime)?(t.de_bu_acu_t+=a,t.dbc++):(t.nbc++,t.n_bu_acu_t+=a),i.bc++,t.bu_acu_t+=a,i.bu_acu_t+=a,r.end=n.cur_play_pos,r.cost=a,r.acc+=r.cost,1===r.sc&&(r.endf=n.cur_play_pos),n.onOneEvent({costTime:a,end_type:"waitend"},l,2)}}})),dl(this,"onSeeking",(function(){if(!Ok(n.player.src)){var e=n.resLogs,t=n.playlogs,i=n.player,r=n.seekLog;wk("onSeeking","currentTime:".concat(i.currentTime)),0===n.startStep&&n.setPt(),n.suspendWaitingStatus("seek"),n.isSeeking&&n.suspendSeekStatus("seek",!1),n.isSeeking=!0,t.played.push({begin:i.currentTime,end:-1}),e.played.push({begin:i.currentTime,end:-1}),n._progressInfo.updatePlayed(i.currentTime,0),r.lastSeekStartTime=Ak(),r.seekBefore=n.lastVideoTime.toString(),r.buf_include=n.checkInBuffer(n.player.currentTime)?1:0,r.intervalId=setTimeout((function(){n.isSeeking&&n.suspendSeekStatus("seekTimeout",!0)}),6e4)}})),dl(this,"onSeeked",(function(){Ok(n.player.src)||n.isSeeking&&n.suspendSeekStatus("seeked",!0)})),dl(this,"onPlaying",(function(){n.suspendWaitingStatus("play"),n.load_state=oI;var e=Ak();n.pauseLog.isPausing&&(n.pauseLog.isPausing=!1,n.pauseLog.pause_acu_t+=e-n.pauseLog.pause_start)})),dl(this,"onPlayCatch",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorTypeCode:0,errorCode:0,url:"",headers:{},status:0};if(wk("onPlayCatch",e,t),e){switch(e){case"mp42dash":n.vtype="DASH_2";break;case"dash2mp4":n.vtype="MP4_2";break;case"dash1mp4":n.vtype="MP4_1";break;default:n.vtype=e}var i=n.errorLog,r=n.playlogs;n.merror.playCatch.push(sl({errc:t.errorCode,errt:t.errorType},t.headers)),n.setBr("playcatch"),i.accu_errc++,i.try_err_c++,i.fir_errc=t.errorCode,t.errorCode&&i.last_errors.push(t.errorCode),n.suspendWaitingStatus("playcatch"),n.suspendSeekStatus("playcatch"),n.sendDegradeLog("playCatch",r.degrade,{cdn_url:t.url}),r.degrade=e,n.onOneError({errorType:t.errorTypeCode,code:t.errorCode,url:t.url||"",status:t.httpCode||t.status,headers:t.headers||{},vid:t.vid||n.vid,preload_hit:t.preloadHit||0,preload_cached:t.preloadCached||0,endState:fI,costTime:t.costTime,message:t.errorMessage||t.message,interval_time:t.timerStep||0},0)}})),dl(this,"onMediaExpied",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{errorType:"",errorTypeCode:0,errorCode:0,url:"",headers:{},status:0},t=n.errorLog,i=n.playlogs;wk("onMediaExpied",e),n.suspendWaitingStatus("expied"),n.setBr("expied"),t.accu_errc++,t.try_err_c++,t.last_errors.push(e.errorCode),i.at=(new Date).getTime(),n.merror.expied.push(sl({errorType:e.errorTypeCode||e.errorType,code:e.errorCode,url:e.url||"",status:e.status},Mk(e.headers||{}))),n.onOneError({errorType:e.errorTypeCode||e.errorType,code:e.errorCode,url:e.url||"",status:e.status,headers:e.headers||{}},0)})),dl(this,"onLog",(function(e){wk("onLog",e);var t=e.type;if(delete e.type,t)switch(t){case gI:break;case mI:n._templog||(n._templog={}),n._templog=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return Object.keys(t).map((function(n){var r,o;e[n]="append"===i?(r=e[n],o=t[n],!r||"string"!=typeof o&&"number"!=typeof o?o:"".concat(r," ").concat(o)):t[n]})),e}(n._templog,e.data,e.action),n._templog.preload_hit&&(n._cacheFile=EI);break;case yI:var i=n.errorLog;i.accu_errc++,i.try_err_c++,n.setBr("mp4error"),i.last_errors.push(e.code),n.onOneError(e,0);break;case vI:var r=function(e,t){var i={ext:e.ext||{},data:{}};return Object.keys(e).map((function(n){t[n]?i.data[t[n]]=e[n]:"ext"!==n&&(i.ext[n]=e[n])})),i}(e,{costTime:"costTime",vid:"vid",end_type:"end_type",pos:"cur_play_pos",cdnUrl:"cdn_url"});r.ext&&["start","end"].map((function(e){r.ext[e]&&(r.ext["ext_".concat(e)]=r.ext[e],delete r.ext[e])})),n.onOneEvent(r.data,r.ext,2)}})),dl(this,"onPlay",(function(){wk("onPlay","this.startStep :".concat(n.startStep," this.isEnded:").concat(n.isEnded)),n.isEnded&&(n.resetLoggerParams(),n.setPt())})),dl(this,"onPause",(function(){wk("onPause");var e=n.pauseLog;e.isPausing=!0,e.pause_start=Ak()})),dl(this,"onWaiting",(function(){var e=n._options;n.updateCurBuffer("onWaiting"),e.checkByInnerLog||(wk("onWaiting>","isSeeking:".concat(n.isSeeking," startStep:").concat(n.startStep," intervalId:").concat(n.stallIntervalId)),n.wait_buf_include=n.checkInBuffer(n.player.currentTime,-1e3)?1:0,n.isSeeking||0===n.playlogs.vt||n.inWaitingStart>0||(n.stallIntervalId&&(window.clearTimeout(n.stallIntervalId),n.stallIntervalId=null),n.inWaitingStart=Ak(),n.waitStartTime=n.cur_play_pos,n.stallIntervalId=window.setTimeout((function(){var e=n.stall;wk("this.stallIntervalId>>".concat(n.stallIntervalId," cost: ").concat(Ak()-n.inWaitingStart)),n._endType="wait",n.load_state=aI,n.vtype.indexOf("MP4")>-1&&n.player.currentTime>10&&n.task&&(n.triggerTask("waiting",n.initial_url),n.requestCount++),e.start=n.waitStartTime,e.bc++,1===e.bc&&(e.startf=n.waitStartTime),window.clearTimeout(n.stallIntervalId),n.stallIntervalId=null,n.startWaitingStatus(n.inWaitingStart,Ak()-n.inWaitingStart),n.stallIntervalId=setTimeout((function(){n.inWaitingStart>0&&n.suspendWaitingStatus("timeout")}),6e4)}),200)))})),dl(this,"onEnded",(function(){if(n.initial_url){wk("onEnded","watchDur:".concat(n.watchDur," vt:").concat(n.vt," pt:").concat(n.pt)),n.isEnded=!0;var e=n.resLogs.df,t=n._progressInfo;t.calculatePlaySize(),t.cachedSize<1?n.changeResolution({from:e,to:e,startTime:Ak(),operaType:"leave_switch",endType:"ended"}):n.sendSwitchOpera(uI),n.onOnePlay(uI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade),n.onOneTemp(uI),n.sendEventsQueue(),n.playlogs.lc++}})),dl(this,"onUnload",(function(){0!==n.startStep&&n.initial_url&&(n.onOneTemp(hI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade),n._reportInvalidVV(hI)||(n.sendSwitchOpera(hI),n.onOnePlay(hI,!0)))})),dl(this,"onVisibilitychange",(function(){var e=n.playlogs.vt;"visible"===document.visibilityState&&(e||n.setPt())})),dl(this,"onDestroy",(function(){wk("onDestroy:this.startStep:".concat(n.startStep," initial_url:").concat(n.initial_url," ").concat(!!n.initial_url)),n.onOnePlay(dI),n.startStep>0&&n.initial_url&&(n.onOneTemp(dI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade));var e=n.resLogs.df;n._progressInfo.cachedSize<1?n.changeResolution({from:e,to:e,startTime:Ak(),operaType:"leave_switch",endType:"destroy"}):n.sendSwitchOpera(uI),n.sendEventsQueue(),uw.isPC?window.removeEventListener("beforeunload",n.onUnload):(uw.isMobile||uw.isPad)&&window.removeEventListener("pagehide",n.onUnload),document.removeEventListener("visibilitychange",n.onVisibilitychange),n.listeners.forEach((function(e){n.player.off(e.evt,e.handler)})),n.clearTimers(),n.player.off("destroy",n.onDestroy),n.task&&n.task.clear()})),dl(this,"onOnePlay",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(wk("onOnePlay _isOnePlayReport:".concat(n._isOnePlayReport," isLeave: ").concat(t," endState:").concat(e)),!n._isOnePlayReport){var i=n.errorLog,r=n.playlogs,o=n.abrInfo,a=n.resLogs,s=n.player,l=n.apiLog,c=n.pauseLog,u=n.stall,h=n.netLog,d=n.watchDur;n._isOnePlayReport=!0;var f=Rk();n.getBufferTime(s);var p=n.getFrameInfo(),g=n.getPerformance(),y=i.errc,v=n._progressInfo,m=v.playedSize,_=v.cachedSize,E=v.pcdnCached,T=v.cachedVideoSize,b=v.pcdnVideoCached,S=n._progressInfo.getFileSize(s.duration),C=n.seekLog,k=C.sc,I=C.sat,P={bc:Wk(d,n.bc),bu_acu_t:Wk(d,n.bu_acu_t),sc:Wk(d,k),sat:Wk(d,I)};n.setExt();var D=n._getCompatibilityInfo();n.setNovv(null,e);var w=sl(sl(sl(sl({local_time:(new Date).getTime(),log_type:"video_playq",plugin_exception:0,player_create_exception:"",v:n.vid,initial_url:n.initial_url,initial_host:n.initial_host,initial_ip:n.curHeaders.x_response_sinfo||0,initial_type:n.initial_type},n.curHeaders),{},{initial_resolution:a.initial_resolution,final_resolution:a.final_resolution,pt:n.pt,prepare_start_time:r.nt,prepare_end_time:r.rt||Rk(),vt:n.vt,lt:n.lt,lpt:n.lpt,fvt:n.fvt,nvt:n.nvt,bft:n.bft,sc:k,sat:I,bc:n.bc,dbc:r.dbc||0,nbc:r.nbc||0,video_net_s:n.videoNetworkState,status:n.curStatus,first_buf_startt:u.startf,first_buf_endt:u.endf,lc:r.lc,bu_acu_t:n.bu_acu_t,de_bu_acu_t:r.de_bu_acu_t||0,n_bu_acu_t:r.n_bu_acu_t||0,pause_acu_t:c.pause_acu_t,cur_play_pos:n.cur_play_pos,load_state:n.load_state,play_speed:n.playbackRate,playback_state:n.playback_state,end_state:e,watch_dur:d,switch_resolution_c:n.switchResolutionCount,is_start_play_automatically:n.isAutoplay,start_time:n.start_time,finish:n.finish,errt:i.errt,errc:y,vsc:l.vsc,vsc_message:i.message||l.vsc_message,api_str:l.api_str,auth:l.auth||l.logid,width:n.videoWidth,height:n.videoHeight,vd:n.vd,video_length:S.video,audio_length:S.audio,df:n.resolution,lf:a.lf,play_c:0,player_created_t:n.player_created_t,fir_errt:i.fir_errt,fir_errc:i.fir_errc,lv_method:0,ldst:a.ldst,ldet:a.ldet,is_disable_short_seek:0,mute:n.mute,volume:n.volume,download_speed:n.realSpeed?n.realSpeed:n.task&&n.task.speed?n.task.speed:h.downloadSpeed,avg_speed:n.avgSpeed?n.avgSpeed:h.rqCount>0?parseInt(h.totalSpeed/h.rqCount,10):0,bitrate:n.curBitrate,preload_state:n.preloadState,preload_hit:n.preLoadData.hit||0,preload_cached:n.preLoadData.duration||n.preLoadData.byteLength||0,mdl_req_num:h.requestCount,watingcost:n.watingCost,br:r.br,fbrt:r.fbrt,try_err_c:i.try_err_c,accu_errc:i.accu_errc,merror:Hk(n.merror),ex:Hk(n.exInfo),perf:Hk(g),bufs:Hk(n.buffers.allBuffer),vds:_,pvds:E,vps:m,vvds:T,pvvds:b,pcdn:Hk(n.getPCDNStat())},n.buffers.curBuffer),{},{degrade:r.degrade,cache_file:n._cacheFile},p),{},{fullScreen:n._getFullScreenType(),encryptedInfo:Hk(n.encryptedInfo),per100_info:Hk(P)},D);0!==n.vt&&(w.et=f);var A=n._logstrcache||n._getLogCache();0===w.fvt&&A&&(w.log=A,n._logstrcache=null),null!=s&&s.softDecoder&&(w.soft_decoder=s.softDecoder),s&&s.dashState&&(w.dash_state=s.dashState),null!=s&&s.softDecoder&&(w.soft_decoder=s.softDecoder),o.abr_init_opts=s.config.autoBitrateOpts||{},w.abr_info=Hk(n.abrInfo);var R=D.is_support_mp4&&D.is_support_mse_mp4;if(D.is_spider||uw.isPC&&!R&&0===n.fvt)wk("is_spider",D.is_spider,"is_support_mp4",D.is_support_mp4);else if(t){var x=!n._options.disableLocalCache;n.reportLog(Yk,w,x?1:0)}else n.reportLog(Yk,w)}})),dl(this,"onOneEvent",(function(e){var t=e.costTime,i=e.vid,r=e.end_type,o=e.cur_play_pos,a=e.cdn_url,s=e.cdn_host,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2?arguments[2]:void 0;wk("onOneEvent",r);var u=n.buffers,h=u.curBuffer,d=u.allBuffer,f=n.getFrameInfo(),p=sl(sl({local_time:(new Date).getTime(),v:i||n.vid,cost_time:t,end_type:r||n.end_type,cdn_url:a||n.url,cdn_host:s||"",initial_type:n.initial_type,resolution:n.resolution,play_speed:n.playbackRate,first_frame_interval:Ak()-n.pt,last_switch_interval:n.getLastInterval("lastSwitchStartTime",n.resLogs,!1),last_seek_interval:n.updateSeekPt(!1),last_event_interval:n.getLastInterval("lastEventTime"),cur_play_pos:o||n.cur_play_pos,video_ready_s:n.videoReadyState,video_seeking:n.videoSeeking,video_paused:n.videoPaused,bufs:Hk(d),retry_count:n._retryCount,at:n.playlogs.at,bc:n.stall.bc,stay_seconds:parseInt(((new Date).getTime()-n.playlogs.at)/1e3,10),preload_state:n.preloadState,preload_hit:n.preLoadData.hit,preload_cached:n.preLoadData.duration||n.preLoadData.byteLength},h),f);r.indexOf("waitend")>=0&&t>3e3&&(p.log=n._getLogCache());var g=n.player,y=g.currentTime,v=g.duration-y;if(r.indexOf("waitstart")>=0&&v<=1){var m=p.local_time,_=p.v,E=p.cost_time,T=p.cdn_url,b=p.first_frame_interval,S=p.cur_play_pos,C=p.video_ready_s,k=p.video_seeking,I=p.video_paused,P=p.bufs,D=p.bc,w=p.preload_hit;n.reportLog(Xk,sl({end_type:"longwait",local_time:m,v:_,cost_time:E,cdn_url:T,first_frame_interval:b,cur_play_pos:S,video_ready_s:C,video_seeking:k,video_paused:I,bufs:P,bc:D,preload_hit:w},h),c)}if("waitstart"===r&&"function"==typeof n._options.getPageFPS){var A=n._options.getPageFPS();p.cur_fps=A.curFPS||0,p.avg_fps=A.avgFPS||0}r.indexOf("wait")>-1&&(p.buf_include=n.wait_buf_include),r.indexOf("timeout")>-1&&p.cost_time>bI&&(p.cost_time=bI);var R=n.player;R&&R.dashState&&(p.dash_state=n.player.dashState),Object.keys(l).forEach((function(e){p[e]=l[e]})),p.ex=Hk(n.getPlayerExt()),n.addIfExist("drm_type",n._options,p),n.reportLog(Xk,p,c)})),dl(this,"onOneTemp",(function(){if(wk("onOneTemp>>",!n._templog),n._templog){var e=n.player,t=n.playlogs,i=n.pauseLog,r=n.errorLog,o=n.resLogs,a=n.watchDur,s=sl(sl(sl({local_time:(new Date).getTime()},n._templog),{},{v:n.vid,initial_type:n.initial_type,pt:n.pt,vt:n.vt,lt:n.lt,fvt:n.fvt,bc:n.bc,bu_acu_t:n.bu_acu_t>TI?0:n.bu_acu_t,pause_acu_t:i.pause_acu_t,cur_play_pos:n.cur_play_pos,watch_dur:a>TI?0:a,finish:n.finish,errt:r.errt,errc:r.errc,vd:n.vd,df:n.resolution,lf:o.lf,br:t.br,fbrt:t.fbrt,try_err_c:r.try_err_c,accu_errc:r.accu_errc,dash_break:2===e.dashBufferBreak?1:0,bufs:Hk(n.buffers.allBuffer),vs:o.vs,vds:o.vds,vps:o.vps},n.buffers.curBuffer),{},{degrade:t.degrade});0!==n.vt&&(s.et=Rk()),["drm_type","dynamic_type"].forEach((function(e){n.addIfExist(e,n._options,s)})),n.reportLog(qk,s,0),n._templog=null}})),this.player=t,void 0===this.player||null===this.player)throw new Error("player is ".concat(this.player));if(i&&i.line_app_id){i.isTask&&(this.task=new gw),this.eventQueue=[],this._instanceCreateTime=(new Date).getTime(),i.codec_type=i.codec_type||"h264",this._envInfo=i.envInfo||{},this._options=i,!this._options.maxQueueCount&&(this._options.maxQueueCount=5),this.line_app_id=parseInt(i.line_app_id,10)||0,this.line_user_id=(i.line_user_id||"").toString(),this.playerCoreVersion=t.version,this.playerVersion=i.playerVersion,this.closeSeekLog=i.closeSeekLog||!1,this.start_time=1e3*(i.start_time||0),this._initial_resolution="",this.__vtype=null,this.__dt="",this._progressInfo=new vw,this.resetLoggerParams();try{this.initializeTracker(),this.sendLocalLog(),this.bindEvt(),wk("logger constructor:".concat(this.player.video))}catch(r){console.error(r)}}else console.warn("player.config.vodLogOpts.line_app_id is necessary for plugin xgVodLogger")}return hl(e,[{key:"resetLoggerParams",value:function(){wk("resetLoggerParams");var e=this.playlogs?this.playlogs.lc:0;this.playlogs={nt:Rk(),vt:0,rt:this.isEnded?Rk():0,at:0,pt:0,bu_acu_t:0,bc:0,br:0,fbrt:"",dbc:0,de_bu_acu_t:0,nbc:0,n_bu_acu_t:0,played:[{begin:0,end:-1}],degrade:"none",lc:e},this.degradeLog={bu_acu_t:0,bc:0,watch_dur:0,hasSendEnd:!1},this.buffers={allBuffer:[],curBuffer:{buf_diff:0,buf_s_pos:0,buf_e_pos:0,buf_include:0}},this.netLog={downloadSpeed:0,requestCount:0,connectCost:0,totalSpeed:0,rqCount:0,status:0},this.merror={cdn:[],player:[],playCatch:[],expied:[]},this.exInfo={stall:[]},this._templog=null,this._isOnePlayReport=!1,this.startStep=0,this.bft=0,this._progressInfo.reset(),this._novv={log_pt:Rk()},this.initializeLogDatas(),this.initializeUrlLog()}},{key:"setNovv",value:function(e,t){!this._novv||this.fvt>0||(e&&(this._novv.errc=e.code,this._novv.errt=e.errorType,this._novv.errorMessage=e.message),this._novv.end_state=t,this._novv.novv_pt||(this._novv.novv_pt=Rk(),this._novv.novv_lpt=Rk()-this._novv.log_pt),this.player&&(this._novv.vtype=this.player.vtype,this.player.novv=this._novv))}},{key:"initializeLogDatas",value:function(){this.startStep=0,this.inWaitingStart=0,this.waitStartTime=0,this.lastVideoTime=0,this._endType="",this._retryCount=0,this.lastOperaTime=-1,this.lastEventTime=-1,this.stallIntervalId=null,this.seekLog={intervalId:0,lastSeekStartTime:Ak(),seekBefore:0,sat:0,sc:0,buf_include:0},this.resLogs={lastSwitchStartTime:-1,switch_count:0,abr_switch_count:0,initial_resolution:"",final_resolution:"",ldst:0,ldet:0,df:"",lf:"",played:[],bc:0,bu_acu_t:0,sc:0,sat:0,buf:0,lbuf:0,lplayed:0,vs:0,vds:0,vps:0,vis:0,bitrate:0},this.apiLog={code:0,message:"",logid:"",api:"",auth:"",error:{}},this.errorLog={accu_errc:0,try_err_c:0,errt:0,errc:0,fir_errt:0,fir_errc:uw.isSupportMP4?0:1005,last_errors:[],message:""},this.pauseLog={pause_acu_t:0,isPausing:!1,pause_start:0},this.stall={sc:0,startf:0,endf:0,start:0,end:0,cost:0,acc:0},this._playerCreatedTime=0,this.load_state=rI,this.lv_method=6,this.isSeeking=!1,this.isEnded=!1,this.startStep=0,this.isAutoplay=this.player.config&&this.player.config.autoplay?1:0,this.abrInfo={abr_general_info:{},abr_event_info:{video_switch:[],video_stall:[],video_exit:{}},abr_play_info:{start_play_time_ms:0,is_hint:0,playback_info:{internet_speed_record:[],play_bitrate_record:[],buffer_length_record:[],play_speed_record:[]}},abr_user_info:{cancel_abr:0},abr_init_opts:this.player.config.autoBitrateOpts||{}},this._cacheFile=_I}},{key:"initSessionId",value:function(){var e="0";try{e=window.localStorage.getItem(Sw).web_id||"0"}catch(nF){e="0"}this._sessionId=function(e){var t=(new Date).getTime();try{e=parseInt(e)}catch(i){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=window.performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)}))}(e),wk("sessionId ".concat(this._sessionId))}},{key:"initializeTracker",value:function(){var e=this,t=this._options;if(window.__xgplayer_vod_log__)this.tracker=window.__xgplayer_vod_log__;else{this.tracker=window.__xgplayer_vod_log__=new kw("tracker");var i=t.channel||"cn",n={app_id:"cn"===(i="va"===i||"sg"===i?i:"cn")?bw:1300===bw?323254:bw,channel:i,log:!1,disable_sdk_monitor:!0,disable_heartbeat:!0};t.channelDomain&&(n.channel_domain=t.channelDomain),n.enable_ab_test=!!t.enableAbTest,this.tracker.init(n)}this.initSessionId();var r=navigator?navigator.hardwareConcurrency:0,o=navigator?navigator.deviceMemory:0;this.commonParams={play_type:0,source_type:"vid",sdk_version:mw,pc:this.playerCoreVersion,pv:this.playerVersion,line_app_id:this.line_app_id,line_user_id:this.line_user_id,app_version:t.appVersion||"",platform:uw.isPad?"pad":uw.isMobile?"mobile":"pc",cpu_core:Number(r)||0,memory_size:Number(o)||0,support:fw(),webdriver:navigator&&navigator.webdriver?1:0,player_sessionid:this.sessionId,web_url:window.location.href,user_agent:navigator.userAgent};var a=t.trackerConfig||{};wk("commonParams ",this.commonParams,a);var s=sl({evtParams:this.commonParams,disable_auto_pv:!0},a);!uw.name||uw.isChrome||uw.isSafari||(s.browser=uw.name,uw.appVersion&&(s.browser_version=uw.appVersion)),this.line_user_id&&(s.user_unique_id=this.line_user_id,!t.enableTeaWebId&&(s.web_id=this.line_user_id)),t.referrer&&(s.referrer=t.referrer,s.referrer_host=Pk(t.referrer)),t.ext&&Object.keys(t.ext).map((function(i){e.exInfo[i]=t.ext[i]})),wk("trackConfig",s),this.tracker.config(s),this.tracker.start()}},{key:"resetDefiInfo",value:function(){var e=this.resLogs;e.played=[],e.bc=0,e.bu_acu_t=0,e.sc=0,e.sat=0}},{key:"sendLocalLog",value:function(){var e=this,t=PI.get();PI.remove(),t.map((function(t){Object.keys(t).map((function(i){if(wk("sendLocalLog",i,t[i]),e.player){e.player.emit("abLog",i,t[i]);var n=e._options.sendLocalCallback;n&&"function"==typeof n&&n(i,t[i])}e._track(i,t[i])}))}))}},{key:"_track",value:function(e,t){"function"==typeof this.tracker?this.tracker(e,t):this._options.enableBeacon&&e===Yk?this.tracker.beaconEvent(e,t):this.tracker.event(e,t)}},{key:"bindEvt",value:function(){var e=this;this.listeners=[{evt:"play",handler:this.onPlay},{evt:"playing",handler:this.onPlaying},{evt:"pause",handler:this.onPause},{evt:"waiting",handler:this.onWaiting},{evt:"playInterfaceInfo",handler:this.onPlayInterfaceInfo},{evt:"ended",handler:this.onEnded},{evt:"loadeddata",handler:this.onLoadeddata},{evt:"loadstart",handler:this.onLoadStart},{evt:"canplay",handler:this.onCanplay},{evt:"progress",handler:this.onVideoProgress},{evt:"autoplay_was_prevented",handler:this.onNotAutoPlay},{evt:"seeking",handler:this.onSeeking},{evt:"seeked",handler:this.onSeeked},{evt:"complete",handler:this.onPlayerInited},{evt:"timeupdate",handler:this.onTimeUpdate},{evt:"bufferedChange",handler:this.onBufferedChange},{evt:"beforeDefinitionChange",handler:this.onBeforeDefinitionChange},{evt:"definitionChange",handler:this.onDefinitionChange},{evt:"definitionChangeSuccess",handler:this.onDefiChangeSuccess},{evt:"replayBtnClick",handler:this.onReplayBtnClick},{evt:"initialUrl",handler:this.initializeUrlLog},{evt:"ABR_CHANGE",handler:this.onAbrChange},{evt:"playCatch",handler:this.onPlayCatch},{evt:"log",handler:this.onLog},{evt:"progress_event",handler:this.onProgressEvent},{evt:"logger_next",handler:this.onNext},{evt:"playnext",handler:this.onNext},{evt:"nextEnded",handler:this.onNextEnded},{evt:"media_format_error",handler:this.onMediaFormatError},{evt:"xglog",handler:this.onXgLogWaiting},{evt:"xglog_cache",handler:this.onXgLogCache},{evt:"degrade",handler:this.onDegrade},{evt:"definitionChangeDetail",handler:this.onDefinitionChangeDetail},{evt:"prf_data_size",handler:this.onPrfDataSize}];var t=this.player.config.errorKey;wk(">>>errorKey",t);var i={evt:"error",handler:this.onPlayerError};t&&(i.evt=t),this.listeners.push(i),this.listeners.forEach((function(t){e.player.on(t.evt,t.handler)})),this.bindUnload()}},{key:"_getLogCache",value:function(){var e,t;return(null===(e=this.player)||void 0===e?void 0:e.logCache)||(null===(t=this.player)||void 0===t?void 0:t.getLogCache)}},{key:"addIfExist",value:function(e,t,i){if(Tw(t)){var n=t[e];!(null==n)&&(i[e]=n)}}},{key:"sendSwitchOpera",value:function(e){var t=this._progressInfo,i=t.lastBitrate,n=t.curBitrate,r=t.nextBitrate,o={costTime:0,operaType:"detail_switch",stateBefore:"",stateAfter:"",endType:e},a=null;if("changedetail"===e){if(!i)return;a=i,o.stateBefore=i.definition,o.stateAfter=r.definition}else a=n,o.stateBefore=n.definition,o.stateAfter="";var s={vds:a.cdnSize,pvds:a.pcdnSize,fileid:a.fileid};this.onOneOperator(o,s)}},{key:"changeResolution",value:function(e){var t=e.from,i=e.to,n=e.startTime,r=e.operaType,o=e.abrInfo,a=e.endType,s=void 0===a?"":a,l=this.resLogs;t=Fk(t),i=Fk(i),l.ldet=Ak(),l.df=i,l.lf=t,l.final_resolution=i,l.switch_count++;var c=l.ldet-n,u={bc:l.bc,bu_acu_t:l.bu_acu_t,sc:l.sc,sat:l.sat,watch_dur:Ik(l.played)};o&&(u.abrInfo=o),this.updateVds(),this.resetDefiInfo(),this._options.closeResolutionLog||this.onOneOperator({costTime:c,operaType:r,endType:s,stateBefore:t,stateAfter:i},u,0)}},{key:"getLastInterval",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=t[e],r=Ak(),o=-1===n?-1:r-n;return i&&(t[e]=r),o}},{key:"updateSeekPt",value:function(e){return this.getLastInterval("lastSeekStartTime",this.seekLog,e)}},{key:"_reportInvalidVV",value:function(e){return!!this._isInvaidVV()&&(this.onOneError({endState:e,errorType:9998,code:-1,url:this.player.currentSrc,headers:{}},0),this._isOnePlayReport=!0,!0)}},{key:"_isInvaidVV",value:function(){return 0===this.vt&&-1===this.curStatus}},{key:"bindUnload",value:function(){uw.isPC?window.addEventListener("beforeunload",this.onUnload):(uw.isMobile||uw.isPad)&&window.addEventListener("pagehide",this.onUnload),document.addEventListener("visibilitychange",this.onVisibilitychange),this.player.once("destroy",this.onDestroy)}},{key:"clearTimers",value:function(){var e=this.seekLog;e.intervalId&&window.clearTimeout(e.intervalId),this.stallIntervalId&&window.clearTimeout(this.stallIntervalId)}},{key:"sendDegradeLog",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"playCatch",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};wk("sendDegradeLog",e,t,i);var n=this.degradeLog;if(!(n.hasSendEnd||"playCatch_end"===e&&"none"===t)){"playCatch_end"===e&&(n.hasSendEnd=!0);var r=this.bu_acu_t-n.bu_acu_t;this.onOneEvent({costTime:this.vd,vid:this.vid,end_type:e,cur_play_pos:this.player.currentTime,cdn_url:i.url},sl({degrade:t,vt:this.vt,pt:this.pt,fvt:this.fvt,bc:this.bc-n.bc,bu_acu_t:r>TI?0:r,watch_dur:this.watchDur-n.watch_dur},i),0)}}},{key:"_getFullScreenType",value:function(){return this.player.isFullscreen?CI.FULLSCREEN_TYPE:this.player.isCssfullScreen?CI.CSS:CI.NO_FULLSCREEN}},{key:"getBufferTime",value:function(e){var t=0,i=0,n=e.video&&e.video.buffered;if(n){for(var r=n.length,o=0,a=0;a<r;a++)o+=n.end(a)-n.start(a);t=i=1e3*o}return{video:t,audio:i}}},{key:"updateAbrInfo",value:function(e,t,i){e.abr_general_info=t.generalInfo,e.abr_event_info.video_exit={local_time_ms:(new Date).getTime(),buffer_length:t.bufferLength,internet_speed:t.downloadSpeed,now_bitrate:t.nowBitrate,play_speed:i},t.getAbrPlayInfo&&(e.abr_play_info=t.getAbrPlayInfo())}},{key:"getPerformance",value:function(){return this.player.performance||{}}},{key:"setExt",value:function(){var e=this,t=this.player.ext||{};t.performance&&delete t.performance,Object.keys(t).map((function(i){"performance"!==i&&(e.exInfo[i]=t[i])}))}},{key:"onOneOperator",value:function(e){var t=e.costTime,i=e.operaType,n=e.stateBefore,r=e.stateAfter,o=e.endType,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,l=this.getLastInterval("lastOperaTime"),c={local_time:(new Date).getTime(),v:this.vid,opera_type:i,state_before:n,state_after:r,cost_time:t,end_type:o||this.end_type,cdn_url:this.url,resolution:this.resolution,last_interval:l,bufs:Hk(this.buffers.allBuffer),cur_play_pos:this.cur_play_pos,retry_count:this._retryCount};"seek"===i&&(c.buf_include=this.seekLog.buf_include,this.seekLog.buf_include=0);var u=this.player;u&&u.dashState&&(c.dash_state=this.player.dashState),Object.keys(a).forEach((function(e){c[e]=a[e]})),this.addIfExist("drm_type",this._options,c),this.reportLog(zk,c,s)}},{key:"onOneError",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{errorType:0,code:0,url:"",headers:{},costTime:0,vid:"",message:"",preload_hit:0,preload_cached:0,interval_time:0},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];wk("onOneError",t);var r=this.errorLog,o=this.apiLog,a=this.resLogs,s=this.player,l=this.playlogs,c=Mk(t.headers||{}),u=this.getPerformance(),h=t.code>0?0-t.code:t.code;this.setExt();var d=this._getCompatibilityInfo();this.setNovv(t,t.endState||lI);var f=sl(sl(sl({v:t.vid||this.vid,video_pos:this.cur_play_pos,local_time:(new Date).getTime(),cost_time:t&&t.costTime?t.costTime:0,errt:t.errorType,errc:h,es:this.es,cdn_url:t.url||this.url,bufs:Hk(this.buffers.allBuffer),resolution:a.final_resolution,last_errors:r.last_errors.join(";"),vsc:o.vsc,vsc_message:t.message||o.vsc_message,server_ip:c.x_response_sinfo||0,initial_url:this.initial_url,initial_host:this.initial_host},c),{},{cur_play_pos:this.cur_play_pos},this.buffers.curBuffer),{},{degrade:l.degrade,end_state:t.endState||lI,preload_hit:t.preload_hit||0,preload_cached:t.preload_cached||0,ex:Hk(this.exInfo),pref:Hk(u),video_ready_s:this.videoReadyState,interval_time:t.interval_time||0},d);s&&s.dashState&&(f.dash_state=s.dashState);var p=this.player.currentSrc,g=Lk(p)?Lk(t.url)?this.initial_url:t.url:p,y={connectTime:0,status:0,statusText:"",isexpired:0,isBlob:Lk(p)?1:0};if(n&&"String"===Uk(g)){var v={};xk(g,{range:"0-8",timeout:2e3}).then((function(e){wk("getXhr>>check result ",e);var t=Mk(e.headers||{});f.server_ip=t.x_response_sinfo,v=sl(sl({},y),{},{statusText:e.statusText||"",status:e.status||0,connectTime:0|e.connectTime,sinfo:t.x_response_sinfo||"",cinfo:t.x_response_cinfo||""})})).catch((function(e){v=sl(sl({},y),{},{statusText:-2===e.status?"timeout":"error",status:e.status})})).finally((function(){var t=function(e){if(!e||"String"!==Uk(e))return 0;var t=0;try{var i=new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),n=e.match(i);if(null!==n)t=parseInt(n[2],10);else{var r=e.split("/");r.length>5&&8===r[4].length&&(t=parseInt(r[4],16))}return t>0?t<parseInt((new Date).getTime()/1e3,10)?Vk:Kk:jk}catch(o){return jk}}(g);v.isexpired=t,f.net=Hk(v),e.reportLog($k,f,i)}))}else f.net=Hk(y),this.reportLog($k,f,i)}},{key:"_getCompatibilityInfo",value:function(){var e=function(){if("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)return{support:!1,message:"MediaSource API not support"};for(var e=!1,t="",i=0;i<sw.length;i++){var n='video/mp4; codecs="'.concat(sw[i],'"'),r=MediaSource.isTypeSupported(n);t+="".concat(n," is ").concat(r," "),r&&(e=!0)}return{support:e,message:t}}();return{is_spider:uw.isSpider?1:0,is_support_mp4:uw.isSupportMP4?1:0,is_support_hevc:hw()?1:0,is_support_mse_mp4:e.support?1:0,support_mse_mp4:e.message}}},{key:"reportLog",value:function(t,i,n){var r=this,o=this._options,a=this.player.ABTestTag,s=this.commonParams;i.dynamic_type=this.dynamicType;var l="Array"===Uk(o.absdkVersion)?o.absdkVersion.join(","):o.absdkVersion;i.absdkVersion=l||e.AB_SDK_VERSION,null!=a&&(i.abtest_tag=a);var c=this._options;i.codec_type=this.codecType,Tw(c)&&(SI.forEach((function(e){r.addIfExist(e,c,i)})),Object.keys(s).forEach((function(e){r.addIfExist(e,s,i)})),i.vtype=this.vtype),i.env_info=Hk(this._envInfo||{}),i.support=fw(),i.visible="undefined"==typeof document?0:"visible"===document.visibilityState?1:0;var u=function(){if(1===n){var e={};return e[t]=i,void PI.set(e)}2!==n?(r.player&&r.player.emit("abLog",t,i),r._track(t,i)):r.addEventsQueue(t,i)};if("function"==typeof o.onReportLog){var h=o.onReportLog(t,i);null!=h&&h.then?h.finally((function(){return u()})):u()}else u()}},{key:"addEventsQueue",value:function(e,t){this.eventQueue.push({event:e,params:t}),this.eventQueue.length>=this._options.maxQueueCount&&this.sendEventsQueue()}},{key:"sendEventsQueue",value:function(){for(;this.eventQueue.length>0;){var e=this.eventQueue.pop();this._track(e.event,e.params)}}},{key:"startWaitingStatus",value:function(e,t){this.appendStallInfo("start",e),this.updateCurBuffer("startWaitingStatus"),this.onOneEvent({costTime:t,end_type:"waitstart"},{},2)}},{key:"triggerTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start",t=arguments.length>1?arguments[1]:void 0;wk("triggerTask>>",e),!Ok(t=t||this.player.src)&&this.vtype.indexOf("MP4")>-1&&this.task&&this.task.trigger(t,e)}},{key:"appendStallInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start",t=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;this.exInfo.stall||(this.exInfo.stall=[]);var n=this.exInfo.stall;if("start"===e){n.length>6&&n.splice(0,n.length-6);var r=this.buffers.curBuffer;n.push({start:t,end:-1,endType:"waitstart",cost:0,cur:this.cur_play_pos,buf_s:r.buf_s_pos,buf_e:r.buf_e_pos,buf_i:r.buf_include})}else if("end"===e){var o=n.length-1;if(o<0)return;n[o].end<0&&(n[o].end=t,n[o].endType=i,n[o].cost=t-n[o].start)}wk("appendStallInfo",n)}},{key:"suspendWaitingStatus",value:function(e){var t=Ak(),i=this.playlogs,n=this.resLogs,r=this.stall,o=this.inWaitingStart;if(!(o<=0||this.isSeeking||i.vt<=0)){if(wk("suspendWaitingStatus>>".concat(e,"|costTime:").concat(t-o," isSeeking:").concat(this.isSeeking)),this.appendStallInfo("end",t,e),t-o>200){var a=t-this.inWaitingStart;if(i.bc++,this.checkInBuffer(this.player.currentTime)?(i.de_bu_acu_t+=a,i.dbc++):(i.nbc++,i.n_bu_acu_t+=a),n.bc++,i.bu_acu_t+=a,n.bu_acu_t+=a,r.end=this.cur_play_pos,r.cost=a,r.acc+=r.cost,1===r.sc&&(r.endf=this.cur_play_pos),this.player.abrInstance&&!this.isSeeking&&this.playlogs.vt){var s=this.player.abrInstance;this.abrInfo.abr_event_info.video_stall.push({local_time_ms:(new Date).getTime(),stall_duration:parseFloat((a/1e3).toFixed(2)),buffer_length:s.bufferLength,internet_speed:s.downloadSpeed,now_bitrate:s.nowBitrate,play_speed:this.player.playbackRate,is_abr:s.isCurrentInAbr?1:0})}this.onOneEvent({costTime:a,end_type:"waitend_".concat(e)||"waitend"},{},2)}this._endType="",this.load_state=oI,this.inWaitingStart=0,this.waitStartTime=0,window.clearTimeout(this.stallIntervalId),this.stallIntervalId=null}}},{key:"suspendSeekStatus",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isSeeking){var i=this.seekLog,n=this.resLogs,r=this.player,o=Ak()-i.lastSeekStartTime;wk("suspendSeekStatus>>","".concat(e," currentTime:").concat(r.currentTime," costTime:").concat(o," sat:").concat(i.sat," resLogs.sat:").concat(n.sat)),i.intervalId&&window.clearTimeout(i.intervalId),i.intervalId=null,this.isSeeking=!1;var a=this._endType="seek",s=i.seekBefore,l=(r.currentTime||0).toString();i.sc++,i.sat+=o>bI?0:o,n.sc++,n.sat+=o>bI?0:o,o>bI&&(o=bI),this.updateSeekPt(!0),!this.closeSeekLog&&t&&this.onOneOperator({costTime:o,operaType:a,stateBefore:s,stateAfter:l,endType:e})}}},{key:"setPt",value:function(){var e=this.playlogs;this.startStep=1,!e.pt&&this.player.currentTime&&(this.isSeeking=!0),e.pt||(e.pt=Rk(),wk("setPt","init pt :".concat(e.pt,", document.visibilityState:").concat(document.visibilityState)))}},{key:"setVt",value:function(){var e=this.playlogs;1===this.startStep&&(e.vt||(e.vt=Rk(),wk("setVt: first frame inited","vt-pt:".concat(e.vt-e.pt," vt-nt:").concat(e.vt-e.nt))),this.startStep=2)}},{key:"setBr",value:function(e){var t=this.playlogs;t.vt>0&&(0===t.br&&(t.fbrt=e||""),t.br++)}},{key:"codecType",get:function(){var e=this.player;return e&&e.config&&e.config.codecType?e.config.codecType:this._options.codec_type||"h264"}},{key:"url",get:function(){var e=this.player;return e&&e.config?e.config.url:""}},{key:"vid",get:function(){var e=this.player;return e&&e.config?e.config.vid:""}},{key:"bc",get:function(){return this.playlogs.bc}},{key:"bu_acu_t",get:function(){var e=this.playlogs.bu_acu_t;return e>TI?0:e}},{key:"pt",get:function(){return this.playlogs.pt||Rk()}},{key:"vt",get:function(){var e=this.playlogs,t=e.vt;return e.pt>0?t:0}},{key:"fvt",get:function(){var e=this.playlogs,t=e.vt,i=e.pt,n=0;return t>0&&i>0&&(n=parseInt(t-i,10)),n>6e4?6e4:n}},{key:"nvt",get:function(){var e=this.playlogs,t=e.vt,i=e.nt;return t>0&&i>0?parseInt(t-i,10):0}},{key:"getFrameInfo",value:function(){if(this.player&&this.player.videoFrameInfo){var e=this.player.videoFrameInfo,t=e.dropped,i=e.corrupted,n=e.droppedRate;return{f_total:e.total,drop_count:t,drop_rate:n,corrupted:i}}return{f_total:0,drop_count:0,drop_rate:0,corrupted:0}}},{key:"vd",get:function(){var e=this.player;return e.duration&&"number"==typeof e.duration&&e.duration>0?parseInt(1e3*e.duration,10):e.config.duration&&"number"==typeof e.config.duration?parseInt(1e3*e.config.duration,10):0}},{key:"cur_play_pos",get:function(){return parseInt(1e3*this.player.currentTime,10)}},{key:"volume",get:function(){return this.player.volume}},{key:"buffer_time",get:function(){var e=0;try{var t=this.player.getBufferedRange();e=t[1]-t[0]}catch(i){e=0}return e}},{key:"player_created_t",get:function(){return this._playerCreatedTime}},{key:"playbackRate",get:function(){return this.player.playbackRate}},{key:"mute",get:function(){return this.player.muted?0:1}},{key:"videoWidth",get:function(){var e=this.player;return e&&e.video?e.video.videoWidth:0}},{key:"videoHeight",get:function(){var e=this.player;return e&&e.video?e.video.videoHeight:0}},{key:"preload",get:function(){var e=this.player;return!(!e||!e.video)&&e.video.preload}},{key:"initial_url",get:function(){var e=this.player.currentSrc;return e.indexOf("blob:")>-1&&this.urlLog.initial_url?this.urlLog.initial_url:Ok(e)?"":e}},{key:"initial_host",get:function(){var e=this.player.currentSrc;return e.indexOf("blob:")>-1&&this.urlLog.initial_host?this.urlLog.initial_host:Pk(Ok(e)?"":e)}},{key:"curHeaders",get:function(){var e=this.player,t=this.task;return e&&e.__dash__&&e.__dash__.curReqVideoSegInfo?Mk(e.__dash__.curReqVideoSegInfo.headers||{}):t?t.headers:{}}},{key:"curStatus",get:function(){var e=this.task,t=this.vtype,i=this.netLog;return t.indexOf("MP4")>-1?e?e.status:0:i.status}},{key:"play_type",get:function(){return 0}},{key:"resolution",get:function(){var e=this.player.curDefinition;return e?"".concat(e.definition):this.resLogs.df}},{key:"sessionId",get:function(){return this._sessionId}},{key:"finish",get:function(){return this.isEnded?1:0}},{key:"end_type",get:function(){return this._endType}},{key:"avgSpeed",get:function(){return this.player&&this.player.avgSpeed?this.player.avgSpeed:0}},{key:"realSpeed",get:function(){return this.player&&this.player.realTimeSpeed?this.player.realTimeSpeed:0}},{key:"mp4MseOpLength",get:function(){if(!this.player||!this.player.plugins)return-1;var e=this.player.plugins.mp4encryptplayer;return e?e.opQueueLen||0:-1}},{key:"mp4LoadSegmentTimeRange",get:function(){if(!this.player||!this.player.plugins)return"";var e=this.player.plugins.mp4encryptplayer;return e?e.loadSegmentTimeRange.join(","):""}},{key:"preLoadData",get:function(){if(!this.player||!this.player.plugins)return[];var e=this.player.plugins.mp4encryptplayer;if(e&&e.preLoadData)return{hit:1,duration:e.preLoadData.duration,length:e.preLoadData.byteLength};var t=this.player.stat||{};if(t.preLoadData){var i=t.preLoadData.length;return{hit:i>0,length:i}}return{hit:0,duration:0,length:0}}},{key:"preloadState",get:function(){if(!this.player||!this.player.plugins)return 0;if(void 0!==this.player.preloadState)return this.player.preloadState||0;var e=this.player.plugins.mp4encryptplayer;return e&&e.preloadState?e.preloadState:0}},{key:"curBitrate",get:function(){var e=this.player,t=e.config,i=e.curDefinition;return i&&i.bitrate?i.bitrate:t.defaultBitrate?t.defaultBitrate:0}},{key:"videoReadyState",get:function(){var e=this.player;return e&&e.video?e.video.readyState:-1}},{key:"videoSeeking",get:function(){var e=this.player;return e&&e.video&&e.video.seeking?1:0}},{key:"videoPaused",get:function(){var e=this.player;return e&&e.video&&e.video.paused?1:0}},{key:"switchResolutionCount",get:function(){return this.resLogs.switch_count}},{key:"isError",get:function(){return this.player._isError||this.player.video.error}},{key:"isPlaying",get:function(){return Bk(this.player.root,"xgplayer-playing")}},{key:"isStop",get:function(){return Bk(this.player.root,"xgplayer-ended")||Bk(this.player.root,"xgplayer-nostart")}},{key:"isPause",get:function(){return Bk(this.player.root,"xgplayer-pause")}},{key:"isLoading",get:function(){return Bk(this.player.root,"xgplayer-isloading")}},{key:"es",get:function(){return this.isPlaying?"playing":"beforePlay"}},{key:"lt",get:function(){var e=0;return 0===this.vt&&(wk("lt init",this.playlogs.lt),e=Rk()),e}},{key:"lpt",get:function(){return this.lt?this.lt-this.pt:0}},{key:"playback_state",get:function(){return this.isError?iI:this.isStop?Jk:this.isPause?tI:this.isLoading?nI:eI}},{key:"is_start_play_automatically",get:function(){return"".concat(this.isAutoplay)}},{key:"watchDur",get:function(){var e=this.player,t=this.playlogs,i=e.cumulateTime?e.cumulateTime:Ik(t.played);return i>=0?i>TI?TI:i:0}},{key:"vtype",get:function(){if(this.__vtype)return this.__vtype;var e=this.player?this.player.vtype||this.player.config.vtype:"";return e||(this.player.dash?"DASH":this._options.vtype||"MP4")},set:function(e){this.__vtype=e}},{key:"envInfo",get:function(){return this._envInfo},set:function(e){e&&(this._envInfo=e)}},{key:"getPlayerExt",value:function(){var e=this.player.ext;if(e)return e}},{key:"watingCost",get:function(){if(this.inWaitingStart>0){var e=Ak()-this.inWaitingStart;return e>bI?0:e}return 0}},{key:"videoNetworkState",get:function(){var e=this.player;return e&&e.video?e.video.networkState:-1}},{key:"eagleid",get:function(){var e=this.player;return e&&e.__dash__&&e.__dash__.curReqVideoSegInfo?(e.__dash__.curReqVideoSegInfo.headers||{}).eagleid:""}},{key:"initial_type",get:function(){var e=this.player.config||{};return e&&e.vodLogOpts&&void 0!==e.vodLogOpts.currentDashType?parseInt(e.vodLogOpts.currentDashType,10):-1}},{key:"dynamicType",get:function(){var e=this.player;return this.__dt?this.__dt:e&&e.__dash__&&e.__dash__.dash&&e.__dash__.dash.mpd?(this.__dt=e.__dash__.dash.mpd.dashType,this.__dt):""}},{key:"updateBuffers",value:function(){var e=this.player.buffered,t=[];if(!e||e.length<1)this.buffers.allBuffer=[];else{for(var i=0;i<e.length;i++){var n=parseInt(1e3*e.start(i),10),r=parseInt(1e3*e.end(i),10);t.push({s:n,e:r})}this.buffers.allBuffer=t}}},{key:"updateCurBuffer",value:function(e){var t=this.player,i=t.buffered,n=t.currentTime,r={buf_s_pos:0,buf_e_pos:0,buf_include:0,buf_diff:0};if(!i||i.length<1)return r;for(var o=-1,a=-1,s=parseInt(1e3*n,10),l=i.length-1;l>-1;l--){var c=parseInt(1e3*i.start(l),10),u=parseInt(1e3*i.end(l),10);if(s>=c&&s<=u){r.buf_include=1,r.buf_s_pos=c,r.buf_e_pos=u,r.buf_diff=u-s;break}s<c&&(o<0||c-s<o)?(o=c-s,a=l):s>u&&(o<0||s-u<o)&&(o=s-u,a=l)}1!==r.buf_include&&(a<0&&(a=i.length-1),r.buf_s_pos=parseInt(1e3*i.start(a),10),r.buf_e_pos=parseInt(1e3*i.end(a),10)),this.buffers.curBuffer=r}},{key:"checkInBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.player.buffered;if(!i)return!1;e=parseInt(1e3*e,10);for(var n=0;n<i.length;n++){var r=parseInt(1e3*i.start(n),10),o=parseInt(1e3*i.end(n),10)+t;if(e>r&&e<o)return!0}return!1}},{key:"getPCDNStat",value:function(){if(this.player&&this.player.pcdnVVStat){var e=this.player.pcdnVVStat,t=e.try_req_num,i=e.req_node_succ,n=e.conn_req_num;return sl({try_req:t,req_succ:i,has_ret:e.has_ret_node,conn_req:n,conn_fail:e.conn_fail_num,conn_jump:e.conn_jump_num},fl(e,_w))}return{}}},{key:"updateVideoSize",value:function(){var e=this._options,t=this.player,i=this.resLogs,n=0,r=0;if(t.__dash__&&t.__dash__.dash&&t.__dash__.dash.mpd.mediaList){var o=t.__dash__.dash.mpd.mediaList.video,a=o[o.selectedIdx];wk("updateVideoSize》》videoItem",a),r=a?a.bitrate||a.bandwidth:0,n=a?a.size:0}else{var s=this.player.curDefinition;s?(r=s.bitrate||t.config.bitrate||0,n=parseInt(s.bitrate*t.duration/8,10)):(n=e.videoSize||t.config.videoSize||0,r=e.bitrate||t.config.bitrate||0)}wk("updateVideoSize","bitrate:".concat(r,", vs:").concat(n)),n&&(i.vs=n,i.vis=parseInt(n/t.duration,10),i.bitrate=r||i.vis)}},{key:"updateVds",value:function(){var e=this.resLogs,t=this.playlogs,i=this.player;if(0!==e.vis){for(var n=parseInt(Ik(t.played)/1e3,10),r=i.buffered,o=0,a=0;a<r.length;a++)o+=parseInt(r.end(a)-r.start(a),10);wk("updateVds","pdur:".concat(n," bdur:").concat(o," \n lbuf:").concat(e.lbuf," lplayed:").concat(e.lplayed," bitrate: ").concat(e.bitrate," vis:").concat(e.vis," vs:").concat(e.vs)),e.lplayed=n,e.lbuf=o}else wk("updateVds","vis:".concat(e.vis))}},{key:"encryptedInfo",get:function(){return this.player.encryptedInfo||{encryptedType:0}}}],[{key:"TEA_ID",get:function(){return bw},set:function(e){Sw="__tea_cache_tokens_".concat(bw=e)}},{key:"AB_SDK_VERSION",get:function(){return Cw},set:function(e){Cw="Array"===Uk(e)?e.join(","):e}},{key:"Collector",set:function(e){kw=e}},{key:"defaultConfig",value:function(){return{line_app_id:"",line_user_id:"",isTask:!1,codec_type:"",playerCoreVersion:"",playerVersion:"",start_time:0,maxQueueCount:5,channel:"cn",channelDomain:"",absdkVersion:"",checkByInnerLog:!0,drm_type:0,vtype:"MP4",tag:"普通视频",subtag:"",dynamic_type:"",sendLocalCallback:function(){},disableLocalCache:!1,closeResolutionLog:!1,closeSeekLog:!1,needXhrCheck:!1,trackerConfig:{},envInfo:{},enableTeaWebId:!1,enableBeacon:!1}}}]),e}();const Pw=null==(e=Js())?void 0:e.__LOG_TEA_ID__;function Dw(e){let t={};const i=(i,n)=>{const r=(e=>Object.assign({},t,null!=e?e:{}))(n);as.log("veplayer sendLog",i,r),e(i,r)};function n(e,t){i(e,t)}return n.init=e=>{},n.config=e=>{const i=null==e?void 0:e.evtParams;i&&"object"==typeof i&&(t=c({},i))},n.start=()=>{},n.event=(e,t)=>{i(e,t)},n.beaconEvent=(e,t)=>{i(e,t)},n}function ww(){var e;const t=null==(e=pB.ttDramaEnv)?void 0:e.sendLog;return"function"==typeof t?t:void 0}Iw.TEA_ID=Pw,Iw.Collector=function(e){const t=ww();if(t)return Dw(t);const i=Ns();return i?new i(e):void 0};const Aw="beforePlayerCreate.authtoken.getVideoInfo.getVideos",Rw=`${Aw}.getDramaInfoViaJSB.perfInfo`,xw={prepareCost:`${Rw}.prepareCost`,requestCost:`${Rw}.requestCost`,parseCost:`${Rw}.parseCost`,totalCost:`${Rw}.totalCost`};function Ow(e,t){var i;const n=null==(i=null==e?void 0:e.timingMap)?void 0:i[t];return Number.isFinite(n)?n:0}const Lw=function(e){if(e&&e.player){const t=(t,i)=>d(this,null,(function*(){var n,r,o;const a=e.player;i.player_sum_num=function(e){var t,i;let n=0;return null==(i=null==(t=null==e?void 0:e.instManager)?void 0:t.forEach)||i.call(t,(()=>(n++,!0))),n}(a),i.is_mse=Rs(a),i.drm_encrypt_type=nl(a)||"",i.initial_url=Mr.isBlob(i.initial_url)&&a.config.url||i.initial_url,i.album_id=a.config.albumId||"",i.episode_id=a.config.episodeId||"",i.client_key=(null==(n=pB.ttDramaEnv)?void 0:n.clientKey)||"";const s=function(e){var t,i;return null==(i=null==(t=null==e?void 0:e.sdk)?void 0:t.getCreatePlayerPerfReport)?void 0:i.call(t)}(a),l=Ow(s,Aw);const c=function(e){const t=null==e?void 0:e.totalDuration;return Number.isFinite(t)?t:0}(s);if(i.server_fetch_duration=l,Object.assign(i,function(e){return{server_fetch_prepare_cost:Ow(e,xw.prepareCost),server_fetch_request_cost:Ow(e,xw.requestCost),server_fetch_parse_cost:Ow(e,xw.parseCost),server_fetch_total_cost:Ow(e,xw.totalCost)}}(s)),i.create_player_total_duration=c,i.prepare_play=c-l,i.is_preload_enabled=2===pB.preloaderStatus,t===Yk||t===$k){const e=null==a?void 0:a.veError;0!==i.errc&&e?(i.ve_error_code=(null==e?void 0:e.veErrorCode)||0,i.ve_error_type=(null==e?void 0:e.veErrorType)||"",i.ve_error_message=(null==e?void 0:e.veErrorMessage)||"",i.ve_error_ext=JSON.stringify((null==e?void 0:e.ext)||"")):(i.ve_error_code=0,i.ve_error_type="",i.ve_error_message="",i.ve_error_ext=""),i.licenseStatus=(null==(r=null==a?void 0:a.licenseLogInfo)?void 0:r.licenseStatus)||"",i.licenseType=(null==(o=null==a?void 0:a.licenseLogInfo)?void 0:o.licenseType)||""}})),i=Object.assign({onReportLog:t},e.player.config.vodLogOpts||{});e.player.vodLogger=new Iw(e.player,i),e.player.plugins.xgVodLogger=e.player.vodLogger}else this.vodLogger=new Iw(this,this.config.vodLogOpts||{})};Lw.pluginName="__xgVodLogger",Lw.playerConfig={},Lw.Collector=Iw.Collector,Lw.setABSdkVersion=e=>{Iw.AB_SDK_VERSION=e};const Nw=Ui((function(e,t,i){ki(e,t,i)}));class Mw{constructor(e){this.isLive=e.configs.isLive,this.playerData=e.playerData,this.streamType=e.streamType}}const Uw={"@byted/streamprobe":"1.0.2","@byted/volcengine-vestrategy":"1.1.0-rc.71","@byted/volcengine-vestrategy-adapt-range":"1.1.0-rc.0","@byted/volcengine-vestrategy-h265":"1.1.0-rc.0","@byted/volcengine-vestrategy-preload":"1.1.0-rc.3","@byted/xgplayer-encrypt":"3.5.29-rc.1","@byted/xgplayer-encrypt-hls":"4.2.0","@byted/xgplayer-encrypt-mp4":"3.0.31-alpha.1","@byted/xgplayer-vod-abralgo":"1.0.5","@byted/xgplayer-vod-preload":"1.0.9-rc.3","@byted/xgplayer-xgvideo":"0.2.5-rc.3","xgplayer-flv":"3.0.23-rc.6","xgplayer-hls":"3.0.24-rc.18"};var Bw=(e=>(e.HLS="hls",e.HLSJS="hlsjs",e.FLV="flv",e.XGVideo="XGVideo",e.HLSEncrypt="hlsEncrypt",e.DASH="dash",e.MP4Encrypt="mp4Encrypt",e.DanmuJS="danmujs",e.DanmuMask="danmuMask",e.StreamProbe="streamprobe",e.VeStrategy="vestrategy",e.VeStrategyH265="vestrategy_h265",e.VeStrategyPreload="vestrategy_preload",e.VeStrategyAdaptRange="vestrategy_adapt_range",e.DashAbralgo="DashAbralgo",e.Preloader="preloader",e.HLSjsPro="hlsjsPro",e))(Bw||{});const Fw={[Bw.HLS]:{name:"HlsPlayer",pluginName:"hls",packageName:"xgplayer-hls",devPath:`xgplayer-hls@${Uw["xgplayer-hls"]}/dist/index.min.js`},[Bw.FLV]:{name:"FlvPlayer",pluginName:"flv",packageName:"xgplayer-flv",devPath:`xgplayer-flv@${Uw["xgplayer-flv"]}/dist/index.min.js`},[Bw.XGVideo]:{name:"XGVideo",packageName:"@byted/xgplayer-xgvideo",devPath:`@byted/xgplayer-xgvideo@${Uw["@byted/xgplayer-xgvideo"]}/dist/index.min.js`},[Bw.HLSEncrypt]:{name:"EncryptHlsPlugin",pluginName:"EncryptHlsPlugin",packageName:"@byted/xgplayer-encrypt-hls",devPath:`@byted/xgplayer-encrypt-hls@${Uw["@byted/xgplayer-encrypt-hls"]}/dist/index.min.js`},[Bw.DASH]:{name:"DashPlugin",pluginName:"DASHPlugin",packageName:"@byted/xgplayer-encrypt",devPath:`@byted/xgplayer-encrypt@${Uw["@byted/xgplayer-encrypt"]}/dist/index.min.js`},[Bw.MP4Encrypt]:{name:"Mp4EncryptPlayer",pluginName:"Mp4EncryptPlayer",packageName:"@byted/xgplayer-encrypt-mp4",devPath:`@byted/xgplayer-encrypt-mp4@${Uw["@byted/xgplayer-encrypt-mp4"]}/dist/index.min.js`},[Bw.StreamProbe]:{name:"StreamProbe",pluginName:"streamprobe",packageName:"@byted/streamprobe",devPath:`@byted/streamprobe@${Uw["@byted/streamprobe"]}/dist/index.min.js`},[Bw.VeStrategyH265]:{name:"__VESTRATEGY_STRATEGY_H265__",packageName:"@byted/volcengine-vestrategy-h265",devPath:`@byted/volcengine-vestrategy-h265@${Uw["@byted/volcengine-vestrategy-h265"]}/umd/vestrategy.strategy.h265.production.js`},[Bw.VeStrategy]:{name:"VeStrategy",packageName:"@byted/volcengine-vestrategy",devPath:`@byted/volcengine-vestrategy@${Uw["@byted/volcengine-vestrategy"]}/umd/vestrategy.production.js`},[Bw.VeStrategyPreload]:{name:"__VESTRATEGY_STRATEGY_PRELOAD__",packageName:"@byted/volcengine-vestrategy-preload",devPath:`@byted/volcengine-vestrategy-preload@${Uw["@byted/volcengine-vestrategy-preload"]}/umd/vestrategy.strategy.preload.production.js`},[Bw.VeStrategyAdaptRange]:{name:"__VESTRATEGY_STRATEGY_ADAPT_RANGE__",packageName:"@byted/volcengine-vestrategy-adapt-range",devPath:`@byted/volcengine-vestrategy-adapt-range@${Uw["@byted/volcengine-vestrategy-adapt-range"]}/umd/vestrategy.strategy.adapt-range.production.js`},[Bw.DashAbralgo]:{name:"DashAbralgo",packageName:"@byted/xgplayer-vod-abralgo",devPath:`@byted/xgplayer-vod-abralgo@${Uw["@byted/xgplayer-vod-abralgo"]}/dist/index.min.js`},[Bw.Preloader]:{name:"XGPlayerPreload",packageName:"@byted/xgplayer-vod-preload",devPath:`@byted/xgplayer-vod-preload@${Uw["@byted/xgplayer-vod-preload"]}/dist/index.min.js`},[Bw.HLSjsPro]:{name:"EncryptHlsjsPlugin",packageName:"@byted/xgplayer-encrypt-hls",devPath:`@byted/xgplayer-encrypt-hls@${Uw["@byted/xgplayer-encrypt-hls"]}/dist/hlsjs.min.js`}},Hw={h265:Bw.VeStrategyH265,preload:Bw.VeStrategyPreload,adaptRange:Bw.VeStrategyAdaptRange},jw={setImportedPlugins(e,t){e.importedPlugins=t},prepareStrategyLoad(e){"undefined"!=typeof window&&window.VeStrategy&&(window.__VESTRATEGY_BASE__||(window.__VESTRATEGY_BASE__=window.VeStrategy),window.__VESTRATEGY_STRATEGY_PRELOAD__||e.clearPluginCache(Bw.VeStrategyPreload))},loadVeStrategy(e){return d(this,null,(function*(){return e.loadPlugins(Bw.VeStrategy)}))},loadStrategy(e,t){return d(this,null,(function*(){return e.loadPlugins(Hw[t])}))},loadPreloader(e){return d(this,null,(function*(){return e.loadPlugins(Bw.Preloader)}))},loadMp4Encrypt(e){return d(this,null,(function*(){return e.loadPlugins(Bw.MP4Encrypt)}))},loadHlsjsPro(e){return d(this,null,(function*(){return e.loadPlugins(Bw.HLSjsPro)}))}};let Vw=!1;class Kw extends Mw{constructor(e){super(e)}applyAbrPluginConfig(e,t){e.Mp4EncryptPlayer=u(c({},e.Mp4EncryptPlayer),{autoBitrateOpts:t})}prepareAbrModule(e,t){return d(this,null,(function*(){var i;const n=null==(i=e.configs)?void 0:i.autoBitrateOpts;e.isOpenABR()&&!(null==n?void 0:n.module)&&e.updateConfigs({autoBitrateOpts:u(c({},n),{module:yield t.loadPlugins(Bw.DashAbralgo)})})}))}needAbrAutoDefinition(){return!1}setAbrDefaultDefiWithAuto(){return!1}generatePlaylistFromServer(e){Vw=!0;const{playList:t=[]}=e||{};return[...t||[]]}useNativeAbr(){return!1}canOpenAbr(e){var t;if(this.playerData.isVidPlay()&&e){const{playList:t=[]}=e;if(!(t.length>1))return Vw&&as.warn("The obtained media information does not meet the ABR requirements. Please check whether the parameters for generating playAuthToken are correct and whether there are more than 1 video."),Vw=!1,!1}return!((null==(t=Vr.os)?void 0:t.isIos)&&!Xs())}canAdaptRangeEnable(){var e;return!((null==(e=Vr.os)?void 0:e.isIos)&&!Xs())}adaptRangeDefaultOptions(){return{maxTargetCacheDur:30,minTargetCacheDur:12,rangeMaxDuration:15,rangeMinDuration:5,cacheSafeFactor:2,estPTcontrol:!0,estPlayTime:12,minBandwidth:1e6,minDangerThreshold:3,rangeControl:!0,rangeMinSize:409600,safeFactor:.1,targetCacheControl:!0}}applyAdaptRangePluginConfig(e,t){e.Mp4EncryptPlayer=u(c({},e.Mp4EncryptPlayer),{adaptRange:t})}applyAdaptRangeStrategy(e,t){var i,n;e.Mp4EncryptPlayer=u(c({},e.Mp4EncryptPlayer),{adaptRange:c(c(c({},this.adaptRangeDefaultOptions()),null!=(n=null==(i=e.Mp4EncryptPlayer)?void 0:i.adaptRange)?n:{}),t)})}getPlugins(e){return d(this,null,(function*(){var t;const{configs:i,openSoftDecoding:n,isVidEncrypt:r,drmType:o}=this.playerData,a=[or.PRIVATE_ENCRYPT_UPGRADE,or.PRIVATE_ENCRYPT].includes(o);if(i.enableMp4MSE||r||(null==(t=null==i?void 0:i.autoBitrateOpts)?void 0:t.enable)||n||a){return[yield jw.loadMp4Encrypt(e)]}return[]}))}setPluginConfigInVid(e,t){var i;const{vid:n,defaultDefinitionData:r}=e,{config:o,privateDrmAuthToken:a,sessionId:s,useUnionInfoDRM:l}=t,u=!!r.kid,{autoBitrateOpts:h,Mp4EncryptPlayer:d,enableMp4MSE:f}=this.playerData.configs,p=this.playerData.drmType===or.PRIVATE_ENCRYPT_UPGRADE;if(u||(null==h?void 0:h.enable)||d||f){const{kid:e,secretKey:t}=r,h=null==(i=this.playerData.configs)?void 0:i.Mp4EncryptPlayer,d="object"==typeof h?h:{};if(u){if(p)this.playerData.options.Mp4EncryptPlayer=c({vid:n,kid:e,isEncrypt:!0,rangeMaxDuration:10,keyTokenExpiredDuration:9999999,retryCount:3,useUnionInfoDRM:!0,sessionId:this.playerData.encryptSessionId,drmType:or.PRIVATE_ENCRYPT_UPGRADE,preferMMS:!0,secretKey:t},d);else if(a&&s){const t=ys(a),i=parseInt(""+t["X-Expires"]),r=isNaN(i)?30:i;this.playerData.options.Mp4EncryptPlayer=c({vid:n,kid:e,isEncrypt:!0,rangeMaxDuration:10,retryCount:3,drmKeyToken:a,useUnionInfoDRM:l,keyTokenExpiredDuration:r,preferMMS:!0,sessionId:s,playDomain:o.playDomain||this.playerData.playDomain},d)}}else this.playerData.options.Mp4EncryptPlayer=c({vid:n,retryCount:3,preferMMS:!0},d)}}}let Ww=!1;class Gw extends Mw{applyAbrPluginConfig(e,t){e.DASHPlugin=u(c({},e.DASHPlugin),{autoBitrateOpts:t})}prepareAbrModule(e,t){return d(this,null,(function*(){var i;const n=null==(i=e.configs)?void 0:i.autoBitrateOpts;e.isOpenABR()&&!(null==n?void 0:n.module)&&e.updateConfigs({autoBitrateOpts:u(c({},n),{module:yield t.loadPlugins(Bw.DashAbralgo)})})}))}needAbrAutoDefinition(){return!1}setAbrDefaultDefiWithAuto(){return!1}useNativeAbr(){return!1}canOpenAbr(e){if(this.playerData.isVidPlay()&&e){const{enableAdaptive:t,adaptiveBitrateStreamingInfo:i,playList:n=[]}=e;if(!(n.length>2&&t&&i))return Ww&&as.warn("The obtained media information does not meet the ABR requirements. Please check whether the parameters for generating playAuthToken are correct and whether the video contains ABR transcoding products."),Ww=!1,!1}return!0}canAdaptRangeEnable(){var e;return!(null==(e=Vr.os)?void 0:e.isIos)}generatePlaylistFromServer(e){Ww=!0;const{playList:t=[]}=e||{};return t.filter((e=>e.FileType===fs.VIDEO))}adaptRangeDefaultOptions(){return{maxTargetCacheDur:60,minTargetCacheDur:50,rangeMaxDuration:15,rangeMinDuration:5,cacheSafeFactor:2,estPTcontrol:!0,estPlayTime:12,minBandwidth:1e6,minDangerThreshold:3,rangeControl:!0,rangeMinSize:409600,safeFactor:.1,targetCacheControl:!0}}applyAdaptRangePluginConfig(e,t){var i;e.DASHPlugin=u(c({},null!=(i=e.DASHPlugin)?i:{}),{adaptRange:t})}applyAdaptRangeStrategy(e,t){var i,n;e.DASHPlugin=u(c({},e.DASHPlugin),{adaptRange:c(c(c({},this.adaptRangeDefaultOptions()),null!=(n=null==(i=e.DASHPlugin)?void 0:i.adaptRange)?n:{}),t)})}getPlugins(e){return d(this,null,(function*(){var t,i;const n=yield e.loadPlugins(Bw.DASH);return(null==(i=null==(t=null==n?void 0:n.encryptUtils)?void 0:t.isSupported)?void 0:i.call(t))?[n]:(as.warn("current browser is not supported DASHPlugin"),[])}))}setPluginConfigInVid(e,t){var i;const{vid:n,playList:r=[],dashOpts:o,defaultDefinitionData:a}=e||{},{config:s,privateDrmAuthToken:l,sessionId:u,useUnionInfoDRM:h}=t,d=c({},(null==(i=this.playerData.configs)?void 0:i.DASHPlugin)||{}),{kid:f,secretKey:p}=a,g=this.playerData.drmType===or.PRIVATE_ENCRYPT_UPGRADE,y=o.Data.PlayInfoList.reduce(((e,t)=>{const i=t.Definition||t.Quality;let n="";const o=r.find((e=>e.Definition===i||e.Quality===i));return o&&(n=o.definition),e[i]=n,e}),{});if(this.playerData.dashOpts=o,g)this.playerData.options.DASHPlugin=c({playInfoType:"TOP",useEME:!0,keyTokenExpiredDuration:9999999,useUnionInfoDRM:!0,defaultFormat:"dash",replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3,vid:n,definitionText:y,defaultDefinition:a.definition,kid:f,dashOpts:o,drmType:or.PRIVATE_ENCRYPT_UPGRADE,secretKey:p,sessionId:this.playerData.encryptSessionId,playDomain:s.playDomain||this.playerData.playDomain},d);else if(l&&u&&this.playerData.drmType!==or.DRM_ENCRYPT){const e=ys(l),t=parseInt(""+e["X-Expires"]),i=isNaN(t)?30:t;this.playerData.options.DASHPlugin=c({playInfoType:"TOP",vid:n,dashOpts:o,defaultFormat:"dash",definitionText:y,defaultDefinition:a.definition,useUnionInfoDRM:h,kid:f,keyTokenExpiredDuration:i,sessionId:u,drmKeyToken:l,playDomain:s.playDomain||this.playerData.playDomain,replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3},d)}else this.playerData.options.DASHPlugin=c({vid:n,dashOpts:o,playInfoType:"TOP",defaultFormat:"dash",definitionText:y,defaultDefinition:a.definition,replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3},d)}}var Yw=/\s/;var zw=/^\s+/;function $w(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&Yw.test(e.charAt(t)););return t}(e)+1).replace(zw,""):e}var Xw=NaN,qw=/^[-+]0x[0-9a-f]+$/i,Zw=/^0b[01]+$/i,Qw=/^0o[0-7]+$/i,Jw=parseInt;function eA(e){if("number"==typeof e)return e;if(Cn(e))return Xw;if(A(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=A(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$w(e);var i=Zw.test(e);return i||Qw.test(e)?Jw(e.slice(2),i?2:8):qw.test(e)?Xw:+e}const tA=function(){return _.Date.now()};var iA="Expected a function",nA=Math.max,rA=Math.min;function oA(e,t,i){var n,r,o,a,s,l,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(iA);function f(t){var i=n,o=r;return n=r=void 0,c=t,a=e.apply(o,i)}function p(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function g(){var e=tA();if(p(e))return y(e);s=setTimeout(g,function(e){var i=t-(e-l);return h?rA(i,o-(e-c)):i}(e))}function y(e){return s=void 0,d&&n?f(e):(n=r=void 0,a)}function v(){var e=tA(),i=p(e);if(n=arguments,r=this,l=e,i){if(void 0===s)return function(e){return c=e,s=setTimeout(g,t),u?f(e):a}(l);if(h)return clearTimeout(s),s=setTimeout(g,t),f(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=eA(t)||0,A(i)&&(u=!!i.leading,o=(h="maxWait"in i)?nA(eA(i.maxWait)||0,t):o,d="trailing"in i?!!i.trailing:d),v.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=r=s=void 0},v.flush=function(){return void 0===s?a:y(tA())},v}const aA=class{static registerModules(e){for(const[t,i]of Object.entries(e)){if(!Object.values(Bw).includes(t))throw new Error(`Unknown UMD key: ${t}`);if(void 0===i)throw new Error(`Registered UMD module ${t} must not be undefined`)}Object.assign(aA.registeredModules,e)}clearPluginCache(e){const t=`${this.pluginPublicPath}_${e}_load`;delete aA.jsLoadMap[t],delete aA.jsLoadPromiseMap[t]}constructor(){this.umdMap=Fw,this.backupUmdUrlMap={},this.region={}.__DEFAULT_REGION__,this.customPluginPublicPath=""}get pluginPublicPath(){var e;return this.customPluginPublicPath||(null==(e=Js(this.userRegion,this.region))?void 0:e.__UMD_PRE_PATH__)}updateBackupMap(e){this.backupUmdUrlMap=e}loadExtraCdn(e,t=!0){return new Promise(((i,n)=>{const r=t?document.createElement("script"):document.createElement("link");t?r.src=e:(r.rel="stylesheet",r.type="text/css",r.href=e),r.onerror=()=>{n(`url: ${e}`)},r.onload=r.onreadystatechange=function(){(null==this?void 0:this.readyState)&&"loaded"!==(null==this?void 0:this.readyState)&&"complete"!==(null==this?void 0:this.readyState)||(r.onload=r.onreadystatechange=null,i())},document.body.appendChild(r)}))}loadPlugins(e,t){return new Promise((i=>{var n;const r=`${this.pluginPublicPath}_${e}_load`;if(Object.prototype.hasOwnProperty.call(aA.registeredModules,e))return this.triggerSuccessCallback(t),i(aA.registeredModules[e]);if(Reflect.get(aA.jsLoadMap,r))return i(aA.jsLoadMap[r]);const o=this.umdMap[e];if((null==(n=this.importedPlugins)?void 0:n.length)>0&&o.pluginName){const e=this.importedPlugins.find((e=>e.pluginName===o.pluginName));if(e)return i(e)}if(!o)return as.error(`${e} umd info not exit`),this.handleLoadError(e,void 0,i);const{name:a,devPath:s}=o,l=a?Vn(window,a):null;if(l)return aA.jsLoadMap[r]=l,this.triggerSuccessCallback(t),i(l);const c=`${this.pluginPublicPath}/${e+".js"}`;let u=aA.jsLoadPromiseMap[r];as.log(`umdLoader cache hit ${r}=${!!u}`),u||(u=zs((()=>this.loadExtraCdn(c,!0)),2),aA.jsLoadPromiseMap[r]=u),u.then((()=>this.handleLoadSuccess(r,a,t,i))).catch((n=>this.handleLoadCatch(n,e,r,a,t,i)))}))}handleLoadSuccess(e,t,i,n){const r=t?Vn(window,t):null;aA.jsLoadMap[e]=null==r||r,this.triggerSuccessCallback(i),null==n||n(r)}handleLoadError(e,t,i){this.failCallback&&"function"==typeof this.failCallback&&this.failCallback(e,t),i(null)}handleLoadCatch(e,t,i,n,r,o){const a=this.backupUmdUrlMap[t];a?this.loadBackupUrl(a,t,i,n,r,o):(as.error(`load ${t} error, ${e}`),this.handleLoadError(t,e,o))}loadBackupUrl(e,t,i,n,r,o){if(!((a=e)&&a.indexOf&&/^(?:http|data:|\/)/.test(a)))return as.error(`umdMap.${t} isn't a valid url`),this.handleLoadError(t,void 0,o);var a;this.loadExtraCdn(e).then((()=>this.handleLoadSuccess(i,n,r,o))).catch((e=>{as.error(`load ${t} error, ${e}`),this.handleLoadError(t,void 0,o)}))}triggerSuccessCallback(e){e&&e()}};let sA=aA;sA.jsLoadMap={},sA.jsLoadPromiseMap={},sA.registeredModules={};const lA=new sA;var cA=(e=>(e.H265="h265",e.PRELOAD="preload",e.ADAPT_RANGE="adaptRange",e))(cA||{});function uA(e){if(!e||"boolean"==typeof e)return{config:{}};const t=e,{Strategy:i,disabled:n,config:r}=t,o=h(t,["Strategy","disabled","config"]);return u(c({},e),{config:c(c({},o),null!=r?r:{})})}var hA=(e=>(e[e.DISABLED=0]="DISABLED",e[e.INITIALIZING=1]="INITIALIZING",e[e.READY=2]="READY",e[e.FAILED=3]="FAILED",e))(hA||{});class dA{constructor(e){this.strategyKey=cA.PRELOAD,this.preloaderStatus=1,this.preloadCacheConfig={},this.preloadCacheList=[],this._strategyManager=e,this.sdkUmdLoader=new sA}init(e){return d(this,null,(function*(){var t,i,n,r,o,a,s,l,h;const f=null==(t=null==e?void 0:e.strategies)?void 0:t[cA.PRELOAD],p="boolean"==typeof f;if(!f||!p&&(null==f?void 0:f.disabled))return this.preloaderStatus=0,!1;const g=null==(i=uA(f))?void 0:i.config,y=null==(a=null==(o=null==(r=null==(n=this._strategyManager.config)?void 0:n.strategies)?void 0:r[cA.PRELOAD])?void 0:o.Strategy)?void 0:a.preloader;if(!(null==y?void 0:y.register))return this.preloaderStatus=3,!1;y.init((()=>d(this,null,(function*(){as.log("preloader init");const[e,t]=yield Promise.all([jw.loadPreloader(this.sdkUmdLoader),p||"hls"!==(null==f?void 0:f.format)?jw.loadMp4Encrypt(this.sdkUmdLoader):jw.loadHlsjsPro(this.sdkUmdLoader)]);if(!(null==e?void 0:e.PreloaderManager)||!t)return this.preloaderStatus=3,void as.error("preloader init error");const i=(null==t?void 0:t.Mp4Preloader)||(null==t?void 0:t.HlsPreloader);return u(c({},g),{PreloaderModule:e.PreloaderManager,loaders:[i].filter((e=>!!e)),playPlugins:[t]})}))));const v=yield y.prepare();if(!v)return this.preloaderStatus=3,void as.warn("preloader prepare fail",v);this.preloaderStatus=2,null==(h=null==(l=null==(s=y.inst)?void 0:s.call(y))?void 0:l.on)||h.call(l,"prf_data_size",(e=>{var t,i;null==(i=null==(t=this._strategyManager.tea)?void 0:t.event)||i.call(t,"veplayer_preload_prf_data_size",c({},e))})),this.preloader=y,this.initPreloaderConfig()}))}addPreloadList(e){if(1===this.preloaderStatus)return this.preloadCacheList=this.preloadCacheList.concat(null!=e?e:[]),void as.log("preloader add preload cache list",e);2!==this.preloaderStatus?this.preloadCacheList=[]:this.preloader.addPreloadList(e)}setPreloadList(e){return d(this,null,(function*(){if(1===this.preloaderStatus)return this.preloadCacheList=null!=e?e:[],void as.log("preloader set preload cache list",e);2!==this.preloaderStatus?this.preloadCacheList=[]:this.preloader.setPreloadList(null!=e?e:[])}))}setPreloadScene(e,t){if([1,0].includes(e))return 1===this.preloaderStatus?(this.preloadCacheScene!==e&&(this.preloadCacheList=[],as.log("preloader reset preload cache list")),this.preloadCacheScene=e,this.preloadCacheConfig=c(c({},this.preloadCacheConfig),null!=t?t:{}),void as.log("preloader set preload cache config",this.preloadCacheScene,this.preloadCacheConfig)):void(2!==this.preloaderStatus||this.preloader.setPreloadScene(e,t))}initPreloaderConfig(){var e,t,i,n;"undefined"!==this.preloadCacheScene&&this.preloader.setPreloadScene(this.preloadCacheScene,null!=(e=this.preloadCacheConfig)?e:{}),(null==(t=this.preloadCacheList)?void 0:t.length)&&(this.preloader.setPreloadList(this.preloadCacheList),null==(n=(i=this.preloader).checkPreloadData)||n.call(i),this.preloadCacheList=[])}}class fA{constructor(e){this.strategyKey=cA.H265,this._strategyManager=e}init(){return d(this,null,(function*(){return!0}))}isHevcRecommended(){var e,t;return!!(null==(t=null==(e=this._strategyManager.getStrategyRecommendations().result)?void 0:e[cA.H265])?void 0:t.enableH265Hardware)}}const pA=new class{constructor(){var e,t;this.teaId=null==(e=Js())?void 0:e.__LOG_TEA_ID__,this.teaChannel=null==(t=Js())?void 0:t.__LOG_CHANNEL__,this.status=0,this.initUmdLoader()}get preloader(){var e;return null==(e=this.preloadWrapper)?void 0:e.preloader}get preloaderStatus(){var e,t;return null!=(t=null==(e=this.preloadWrapper)?void 0:e.preloaderStatus)?t:hA.INITIALIZING}initUmdLoader(){this.sdkUmdLoader=new sA}fetchWebId(){return d(this,null,(function*(){var e,t;return(null==(e=this.config)?void 0:e.deviceId)?Promise.resolve(null==(t=this.config)?void 0:t.deviceId):new Promise((e=>{var t;return(null==(t=this.tea)?void 0:t.getToken)?this.tea.getToken((t=>e(null==t?void 0:t.web_id))):e("default_web_id")})).then((e=>(this.config=u(c({},this.config),{deviceId:e}),this.webId)))}))}initTea(e){var t,i;const n=this.collector;n&&(e&&(this.teaId=null==(t=Js(e))?void 0:t.__LOG_TEA_ID__,this.teaChannel=null==(i=Js(e))?void 0:i.__LOG_CHANNEL__),this.tea=new n(`${this.teaId}_vestrategy_tracker`),this.tea.init({app_id:this.teaId,channel:this.teaChannel}),this.tea.start())}fetchVeStrategy(){return d(this,null,(function*(){if(this.config.Module)return;const e=yield jw.loadVeStrategy(this.sdkUmdLoader);e&&(this.config=u(c({},this.config),{Module:e}))}))}fetchStrategies(){return d(this,null,(function*(){const e={};return jw.prepareStrategyLoad(this.sdkUmdLoader),yield Promise.all(Object.keys(this.config.strategies).map((t=>d(this,null,(function*(){if(!this.config.strategies[t])return;!0===this.config.strategies[t]&&(this.config.strategies[t]={});const{Strategy:i}=this.config.strategies[t];if(i)e[t]=this.config.strategies[t];else{const i=t;if(!["h265","preload","adaptRange"].includes(i))return;const n=yield jw.loadStrategy(this.sdkUmdLoader,i);n&&(e[t]=u(c({},this.config.strategies[t]),{Strategy:n}))}e[t]=uA(e[t])}))))),this.config.strategies=e,e}))}initOnce(e){return d(this,null,(function*(){if(!e||!e.appId)return;this.collector=Ns(),this.initTea(e.region),this.status=1,this.config=e;try{yield Promise.all([this.fetchWebId(),this.fetchVeStrategy()]),yield this.fetchStrategies()}catch(r){}const{appId:t,deviceId:i,Module:n}=this.config;if(t&&i&&n){this.Module=n;const e=this.collector;yield n.bootstrap(u(c(u(c({},this.config),{strategies:this.config.strategies}),e?{tracker:{Collector:e,enableABVersion:!1}}:{}),{log:{logger:as}})),this.status=2,this.preloadWrapper=new dA(this),this.h265Wrapper=new fA(this)}else this.status=3;return this.isReady()}))}init(e){return d(this,null,(function*(){var t,i;const n=e;return this.initPromise?(null==(i=this.config)?void 0:i.serviceConfigMode)&&(null==n?void 0:n.serviceConfigMode)&&this.config.serviceConfigMode!==n.serviceConfigMode&&as.warn("[VeStrategy] Ignoring conflicting serviceConfigMode after initialization has started."):((null==(t=null==e?void 0:e.plugins)?void 0:t.length)&&jw.setImportedPlugins(this.sdkUmdLoader,e.plugins),this.initPromise=this.initOnce(n).then((t=>d(this,null,(function*(){var i,n;return t&&(yield Promise.all([null==(i=this.preloadWrapper)?void 0:i.init(e),null==(n=this.h265Wrapper)?void 0:n.init()])),t}))))),this.initPromise}))}addPreloadList(e){this.preloadWrapper&&this.preloadWrapper.addPreloadList(e)}setPreloadList(e){return d(this,null,(function*(){if(this.preloadWrapper)return this.preloadWrapper.setPreloadList(e)}))}setPreloadScene(e,t){this.preloadWrapper&&this.preloadWrapper.setPreloadScene(e,t)}prepare(){return this.initPromise||Promise.resolve(this.isReady())}getDeviceId(){var e;return null==(e=this.config)?void 0:e.deviceId}isReady(){return 2===this.status}getStrategyRecommendations(e=void 0,t=void 0){if(!this.isReady())return{plugins:[],pluginConfiguration:{}};const i=this.config.Module.rec(e,t)||{};return as.log("strategy recommendations:",i),i}getStrategyRecommendationsAsync(e=void 0,t=void 0){return d(this,null,(function*(){if(!this.isReady())return{plugins:[],pluginConfiguration:{}};const i=yield this.config.Module.recAsync(e,t);return as.log("strategy recommendations:",i),i}))}isHevcRecommended(){var e,t;return this.h265Wrapper?this.h265Wrapper.isHevcRecommended():!!(null==(t=null==(e=this.getStrategyRecommendations().result)?void 0:e[cA.H265])?void 0:t.enableH265Hardware)}};let gA=!1;class yA extends Mw{constructor(e){super(e)}applyAbrPluginConfig(e,t){var i;e.EncryptHlsPlugin=u(c({},e.EncryptHlsPlugin),{autoBitrateOpts:t,maxBufferLength:(null==(i=e.EncryptHlsPlugin)?void 0:i.maxBufferLength)||40})}prepareAbrModule(e,t){return d(this,null,(function*(){var i;const n=null==(i=e.configs)?void 0:i.autoBitrateOpts;!e.isOpenABR()||(null==n?void 0:n.module)||this.useNativeAbr()||e.updateConfigs({autoBitrateOpts:u(c({},n),{module:yield t.loadPlugins(Bw.DashAbralgo)})})}))}needAbrAutoDefinition(){return!0}setAbrDefaultDefiWithAuto(){return!this.useNativeAbr()}generatePlaylistFromServer(e,t){var i,n,r;gA=!0;const{vid:o,playList:a=[],enableAdaptive:s,adaptiveBitrateStreamingInfo:l}=e||{};if(t&&(null==l?void 0:l.MainPlayUrl))return[{vid:o,url:null==l?void 0:l.MainPlayUrl,_mainURL:l.MainPlayUrl,_backupURL:l.BackupPlayUrl,streamType:l.AbrFormat,backupUrl:l.BackupPlayUrl,backUrlList:[l.BackupPlayUrl],isMasterM3u8:!0}];const c=[...a||[]];if(this.useNativeAbr()&&(null==(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.autoBitrateOpts)?void 0:r.enable)&&s&&l&&c.length){const e={url:l.MainPlayUrl,definition:"auto",streamType:"hls",format:"hls",backupUrl:l.BackupPlayUrl,backUrlList:[l.BackupPlayUrl],vid:o};c.push(e)}return c}useNativeAbr(){return Vr.os.isIos||"safari"===Vr.browser&&this.playerData.drmType===or.DRM_ENCRYPT}canOpenAbr(e){if(this.playerData.isVidPlay()&&e){const{enableAdaptive:t,adaptiveBitrateStreamingInfo:i,playList:n=[]}=e;if(!(n.length>1&&t&&i))return gA&&as.warn("The obtained media information does not meet the ABR requirements. Please check whether the parameters for generating playAuthToken are correct and whether the video contains ABR transcoding products."),gA=!1,!1}return!0}canAdaptRangeEnable(){return!1}adaptRangeDefaultOptions(){}applyAdaptRangePluginConfig(e,t){}applyAdaptRangeStrategy(e,t){}getPlugins(e){return d(this,null,(function*(){var t,i,n;if(null==(i=null==(t=pA.config)?void 0:t.strategies)?void 0:i[cA.PRELOAD]){return[yield e.loadPlugins(Bw.HLSjsPro)]}const{configs:r,options:o,useHlsPluginForSafari:a,enableHlsJs:s,isVidEncrypt:l,isLive:c,openSoftDecoding:u,isMobile:h,drmType:d}=this.playerData,f=d===or.DRM_ENCRYPT,p=[or.PRIVATE_ENCRYPT_UPGRADE,or.PRIVATE_ENCRYPT].includes(d),g=Ws(r,"EncryptHlsPlugin");if(!!(null==g?void 0:g.keyToken)||l&&!f||p||this.playerData.isOpenABR()&&!(null==(n=null==this?void 0:this.useNativeAbr)?void 0:n.call(this))){return[yield e.loadPlugins(Bw.HLSEncrypt)]}{const t=Ws(o,"Subtitle"),i=c&&t,n=($s()||window.WebAssembly)&&u,l=r.enableHlsMSE,d=r.enableMobileHlsPlugin&&(Vr.os.isAndroid&&$s()||Vr.os.isIos&&Xs()),p=f&&Vr.os.isAndroid,g=f&&Qs,y=h&&!document.createElement("video").canPlayType("application/vnd.apple.mpegurl");if(h&&(n||i||l||d||p||y)||!(h||Qs&&!a||g)){return[yield e.loadPlugins(s?Bw.HLSjsPro:Bw.HLS)]}}}))}setPluginConfigInVid(e,t){var i;const{vid:n,defaultDefinitionData:r}=e,{config:o,privateDrmAuthToken:a,sessionId:s,useUnionInfoDRM:l}=t,{playDomain:u,keyToken:h,getKeyType:d}=o,f=!!r.kid,p=this.playerData.drmType===or.DRM_ENCRYPT,g=this.playerData.drmType===or.PRIVATE_ENCRYPT_UPGRADE;if(f&&!p){const e=null==(i=this.playerData.configs)?void 0:i.EncryptHlsPlugin,t="object"==typeof e?e:{},{kid:o,secretKey:f}=r;if(h)this.playerData.options.EncryptHlsPlugin=c({keyToken:h,playDomain:u||this.playerData.playDomain,getKeyType:d||"TOP",preferMMS:!0,preferMMSStreaming:!0},t);else if(g)this.playerData.options.EncryptHlsPlugin=c({vid:n,kid:o,useUnionInfoDRM:!0,sessionId:this.playerData.encryptSessionId,drmType:or.PRIVATE_ENCRYPT_UPGRADE,keyTokenExpiredDuration:9999999,secretKey:f,preferMMS:!0,preferMMSStreaming:!0},t);else if(a&&s){const e=ys(a),i=parseInt(""+e["X-Expires"]),r=isNaN(i)?30:i;this.playerData.options.EncryptHlsPlugin=c({vid:n,kid:o,keyTokenExpiredDuration:r,drmKeyToken:a,useUnionInfoDRM:l,sessionId:s,playDomain:u||this.playerData.playDomain,preferMMS:!0,preferMMSStreaming:!0},t)}}}}class vA extends Mw{applyAbrPluginConfig(e,t){}needAbrAutoDefinition(){return!1}prepareAbrModule(e,t){}setAbrDefaultDefiWithAuto(){return!1}generatePlaylistFromServer(e,...t){const{playList:i=[]}=e||{};return[...i||[]]}useNativeAbr(){return!1}canOpenAbr(){return!1}canAdaptRangeEnable(){return!1}adaptRangeDefaultOptions(){}applyAdaptRangePluginConfig(e,t){}applyAdaptRangeStrategy(e,t){}getPlugins(){return Promise.resolve([])}setPluginConfigInVid(){}}var mA=(e=>(e.EDITION_STANDARD="standard_edition",e.EDITION_PREMIUM="premium_edition",e.EDITION_NONE="none_edition",e))(mA||{}),_A=(e=>(e.SDK_VOD_PLAY="web_vod_play",e.SDK_LIVE_PULL="web_live_pull",e))(_A||{}),EA=(e=>(e.H265="h265",e.PRELOAD="preload",e.ADAPT_RANGE="adaptRange",e.ABR="abr",e))(EA||{}),TA=(e=>(e[e.LICENSE_STATUS_INVALID=0]="LICENSE_STATUS_INVALID",e[e.LICENSE_STATUS_OK=1]="LICENSE_STATUS_OK",e[e.LICENSE_STATUS_EXPIRED=2]="LICENSE_STATUS_EXPIRED",e[e.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH=401]="LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH",e))(TA||{});const bA={setLicenseConfig:e=>d(this,null,(function*(){})),checkLicense:()=>d(this,null,(function*(){return"premium_edition"})),checkModuleList:()=>d(this,null,(function*(){return Object.values(EA)})),checkLicenseStatus:()=>d(this,null,(function*(){return 1})),checkLicenseModuleAuth:(e,t)=>d(this,null,(function*(){return!0})),renderLogo:e=>{}};class SA{constructor(e,t){var i,n;this.id="",this.type="",this.isLive=!1,this.options=null,this.isMobile=!1,this.playList=[],this.plugins=[],this.openSoftDecoding=!1,this.current={lineId:0,language:"",definition:"",streamType:"",codec:tr.UNKNOWN,kid:"",secretKey:"",drmType:void 0},this.strategiesPlugins=[],this.strategiesPluginConfigs={},this.urlCheckData={enableUrlExpireCheck:!1,urlExpireTimestamp:Xa,urlExpireDiff:60,urlCheckExpireInterval:400},this.isAutoBitrateEnable=!1,this.isVidEncrypt=!1,this.drmType=void 0;const r=e,{options:o,type:a,isLive:s,id:l,root:c,plugins:u=[],defaultConfig:d,languages:f,codec:p,isMobile:g=!1,enableH265Degrade:y=!1,onMediaExpired:v,onTokenExpired:m,unionId:_,isMusic:E=!1,sdkPlugins:T=[],useHlsPluginForSafari:b=!0,enableHlsJs:S=!0,enableMenu:C=!1,region:k={}.__DEFAULT_REGION__,userRegion:I,debug:P=!1,licensSupportModuleList:D=Object.values(EA),encryptSessionId:w}=r,A=h(r,["options","type","isLive","id","root","plugins","defaultConfig","languages","codec","isMobile","enableH265Degrade","onMediaExpired","onTokenExpired","unionId","isMusic","sdkPlugins","useHlsPluginForSafari","enableHlsJs","enableMenu","region","userRegion","debug","licensSupportModuleList","encryptSessionId"]);this.configs=e,this.sdk=t,P&&(as.config.debug=3),this.options=Object.assign({},o,A),this.options.poster="string"==typeof this.options.poster?function(e){const t=""+e,i=ol.exec(t);if(!i)return t;let n,r,o="",a=0;for(r=i.index;r<t.length;r++){switch(t.charCodeAt(r)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}a!==r&&(o+=t.substring(a,r)),a=r+1,o+=n}return a!==r?o+t.substring(a,r):o}(this.options.poster):this.options.poster,this.options.icons=(e=>{const t={};return e&&Object.entries(e).forEach((([e,i])=>{i&&"string"!=typeof i&&(t[e]=i)})),t})(this.options.icons),this.id=l,this.root=c,this.type=a,this.isLive=!!(null!=s?s:"live"===a),this.defaultConfig=d,this.languageData=this.initI18nData(f),this.isMobile=g||"mobile"===Vr.device,this.openSoftDecoding=null==(i=this.configs)?void 0:i.useSoftDecoding,this.enableH265Degrade=y,this.codec=p||tr.UNKNOWN,this.onMediaExpired=v,this.onTokenExpired=m,null==(n=this.setVodPlayListConfig)||n.call(this,this.configs),this.current=ur.observe(this.current),this.plugins=[...u],this.isMusic=E,this.unionId=_,this.sdkPlugins=T,this.useHlsPluginForSafari=b,this.enableHlsJs=S,this.enableMenu=C,C&&(this.options.enableContextmenu=!0,this.options.closeVideoStopPropagation=!0),this.region=k,this.userRegion=I,this.setVodTeaId(),this.playDomainDegrade=!1,this.dashOpts=null,this.encryptSessionId=w,this.initPlayData(this.configs),ur.subscribeProperty(this.current,"definition",this.updateCheckExpireData.bind(this))}initPlayData(e){const t=this.initPlaylistAndGetCurrent(e);this.initCurrent(t)}initPlaylistAndGetCurrent(e){var t,i;const{url:n,playList:r=[],streamType:o="",definitionText:a,definitionTextKey:s,urlExpireTimestamp:l,playAuth:h,playAuthId:d}=e,f=e.defaultDefinition||this.configs.defaultDefinition,p=e.codec||tr.UNKNOWN;(null==e?void 0:e.autoBitrateOpts)&&this.updateConfigs({autoBitrateOpts:c(c({},null!=(t=this.configs.autoBitrateOpts)?t:{}),e.autoBitrateOpts)});let g=null;const y=pi([...r].filter((e=>e.url)).map(((e,t)=>u(c({},e),{bitrate:e.bitrate||e.Bitrate||1e3*(t+1),secretKey:e.playAuth,kid:e.playAuthId}))));if(n)if(0===y.length){const e=c(u(c({},this.current),{url:n,streamType:o,definitionTextKey:s,codec:p,secretKey:h,kid:d,urlExpireTimestamp:l}),s||a?{definition:a}:{definition:"HD"});this.playList=[e],this.defaultDefinition=e.definition}else{this.playList=y;const e=this.getUrlList({url:n});e.length>0?g=e[0]:as.warn("default url is not match Playlist")}else this.playList=y;e.drmType&&this.setDrmType(e.drmType);let v=this.getCurrentByDefaultConfig();v?this.defaultDefinition=v.definition:(v=g||(f&&(null==(i=this.getUrlList({definition:f}))?void 0:i[0])||this.playList[0]),this.defaultDefinition=null==v?void 0:v.definition);const m=this.getTargetStreamType(v);if(this.adapter=function(e,t){const i=u(c({},t),{streamType:e});switch(null==e?void 0:e.toLowerCase()){case"mp4":case"m4a":return new Kw(i);case"dash":return new Gw(i);case"hls":return new yA(i);default:return as.log(`no adapter match ${e}, use others adapter by default`),new vA(i)}}(m,{configs:this.configs,playerData:this}),this.isAutoBitrateEnable=this.checkAutoBitratePlayList(),this.isOpenABR()){const e=this.getABRStreamInfo(m,v);v=e.defaultStream,this.playList=e.playList,this.defaultDefinition=e.defaultDefinition}return this.playList.forEach((e=>{(null==e?void 0:e.streamType)&&(e.vtype=e.streamType.toUpperCase()),(null==e?void 0:e.codec)&&(e.codecType=e.codec)})),v}checkAutoBitratePlayList(){var e,t;return!(Vr.os.isIos&&this.adapter.needAbrAutoDefinition()&&!(null==(t=null==(e=this.playList)?void 0:e.find((e=>this.isAutoDefinition(null==e?void 0:e.definition))))?void 0:t.url))}getABRStreamInfo(e,t){var i,n,r,o,a;let s=this.defaultDefinition;const l=(null==(n=null==(i=this.playList)?void 0:i.concat)?void 0:n.call(i))||[];let c=t;const u=l.findIndex((e=>this.isAutoDefinition(null==e?void 0:e.definition))),h=-1!==u?l.splice(u,1)[0]:void 0,d={definition:null!=(r=null==h?void 0:h.definition)?r:"auto",bitrate:void 0,definitionTextKey:(null==h?void 0:h.definitionTextKey)||(null==(a=null==(o=this.configs)?void 0:o.autoBitrateOpts)?void 0:a.definitionTextKey)||"DEFINITION_AUTO",url:(null==h?void 0:h.url)||"__auto__",name:"auto",streamType:e||this.configs.streamType};return this.isAutoDefinition(this.configs.defaultDefinition)||(d.bitrate=null==c?void 0:c.bitrate,s=null==c?void 0:c.definition),this.isPlayAutoDefinition()&&(c=d,this.adapter.setAbrDefaultDefiWithAuto()&&(s=d.definition)),l.push(d),{defaultDefinition:s,defaultStream:c,playList:l}}isCurrentH265(){if(this.codec){return this.codec.replace(".","").toLowerCase()===tr.H265}return!1}setDrmType(e){this.drmType=e}getCurrentByDefaultConfig(){if(!this.defaultConfig)return;const{type:e,isLive:t,lineId:i="",definition:n=""}=this.defaultConfig;if((null!=t?t:"live"===e)!==this.isLive)return;if(!i&&!n)return as.warn("默认配置未设置默认线路或默认清晰度"),void(this.isHitDefault=!1);const r=this.getUrlList({lineId:i,definition:n});return r.length>0?(this.isHitDefault=!0,r[0]):(as.warn("playlist中没有满足默认配置的流"),void(this.isHitDefault=!1))}initCurrent(e){var t,i,n;Object.keys(this.current).forEach((t=>{this.current[t]=null==e?void 0:e[t]}));const r=null==e?void 0:e.codec;this.codec=r&&Object.values(tr).includes(r)?r:tr.UNKNOWN,(null==(t=this.current)?void 0:t.drmType)&&this.setDrmType(null==(i=this.current)?void 0:i.drmType),this.isVidEncrypt=!!(null==(n=this.current)?void 0:n.kid),this.initCheckExpireData()}initCheckExpireData(){const{enableUrlExpireCheck:e,urlExpireDiff:t,urlCheckExpireInterval:i}=this.configs;Nw(this.urlCheckData,{enableUrlExpireCheck:e,urlExpireDiff:t,urlCheckExpireInterval:i}),this.updateCheckExpireData()}updateCheckExpireData(){var e;const t=null==(e=this.getCurrentStreams())?void 0:e[0];if(t){const{url:e,urlExpireTimestamp:i}=t;if(!e)return;const n=il(""+(i||this.configs.urlExpireTimestamp));n?this.urlCheckData.urlExpireTimestamp=n:this.urlCheckData.enableUrlExpireCheck&&(this.urlCheckData.urlExpireTimestamp=Xa,as.warn("not provide urlExpireTimestamp, url expire check will not work")),as.log("update urlCheckData to:",this.urlCheckData)}}initI18nData(e){const t=[Qa,Ja],i=e&&Object.entries(e).reduce(((e,[i,n])=>(Ya.includes(i)?e.push({LANG:"zh"===i?"zh-cn":i,TEXT:n}):t.push({LANG:i,TEXT:n}),e)),[]);return{extraLangList:t,extendLangList:i}}getCurrentUrl(){var e;return null==(e=this.getCurrentStreams()[0])?void 0:e.url}getTargetStreamType(e){var t;return e?e.streamType||this.configs.streamType||js(e.url):this.configs.streamType||vs(null==(t=this.configs)?void 0:t.getVideoByToken)}getCurrentStreamType(){const e=this.getCurrentStreams();if(e.length){const{url:t,streamType:i}=e[0];return i||this.configs.streamType||js(t)||"mp4"}return this.configs.streamType||"mp4"}getStreamType(){var e;return this.getCurrentStreamType()||vs(null==(e=this.configs)?void 0:e.getVideoByToken)}isOpenABR(){var e,t,i,n,r;if(!this.isAutoBitrateEnable||!(null==(t=null==(e=this.configs)?void 0:e.autoBitrateOpts)?void 0:t.enable)||!(null==(i=this.configs)?void 0:i.isLive)&&!(null==(r=null==(n=this.configs)?void 0:n.licensSupportModuleList)?void 0:r.includes(EA.ABR)))return!1;const o=this.sdk.getSdkPlugin("AuthToken");return this.adapter.canOpenAbr(null==o?void 0:o.playInfo)}showRealDefinition(){var e,t;return!!(null==(t=null==(e=this.configs)?void 0:e.autoBitrateOpts)?void 0:t.showRealDefinition)}isAutoDefinition(e){return["auto","自动"].includes(e)}isPlayAutoDefinition(e=""){var t;return this.isAutoDefinition(e||this.defaultDefinition)||(null==(t=this.configs.autoBitrateOpts)?void 0:t.startWithAuto)}isDefinitionMatch(e,t){return!(!this.isAutoDefinition(e)||!this.isAutoDefinition(t))||e===t}getCurrentStreams(){const e=this.current;return this.getUrlList(e)}getLineList(){return pi(er(this.playList,"lineId"))}getLineListByLineId(e){return this.playList.filter((t=>{var i;return(null==e?void 0:e.toString())===(null==(i=t.lineId)?void 0:i.toString())}))}getDefinitionListByLineId(e){return pi(er(this.getLineListByLineId(e),"definition"))}getUrlList(e){return this.playList.filter((t=>Object.keys(e).every((i=>{var n,r;if("url"===i){const i=null==e?void 0:e.url,n=null==t?void 0:t.url;return"string"==typeof i?i===(null==n?void 0:n.toString()):!(!Array.isArray(i)||!Array.isArray(n))&&i.map((e=>e.src)).join("")===n.map((e=>e.src)).join("")}{const o=(null==(n=e[i])?void 0:n.toString())===(null==(r=t[i])?void 0:r.toString()),a=!e[i];return o||a}}))))}getNextDefinition(e=!0,t){var i,n,r;const o=e?"next":"prev",{definition:a,lineId:s}=this.current;if(!a)return;const l=null==(i=this.getCurrentStreams())?void 0:i[0],c="auto"===a?l.mapDefinition:a,u=(e=>(null==e?void 0:e.length)&&e.reduce(((t,i,n)=>(t[i]={next:n+1>=e.length?null:e[n+1],pre:0===n?null:e[n-1]},t)),{}))(t)||Ga;if(!Object.keys(u).includes(c))return;let h=null==(n=u[c])?void 0:n[o];const d=this.getDefinitionListByLineId(s);for(;0===d.filter((e=>e.definition===h)).length&&h;)h=null==(r=u[h])?void 0:r[o];if(h)return"auto"===a&&h&&(l.mapDefinition=h),this.getUrlList({lineId:s,definition:h});as.log("已经降至最低级")}get apiMap(){var e;const t="sg",i=null==(e=pB.ttDramaEnv)?void 0:e.channel,n={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}},r={cn:{__PLAY_DOMAIN__:"https://vod.volcengineapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.volcengineapi.com"},mya:{__PLAY_DOMAIN__:"https://vod.ap-southeast-1.volcengineapi.com"}};let o,a=t;"byteplus"===i&&n?(o=n,a="sg"):"volcengine"===i&&r?(o=r,a=o[t]?t:"cn"):o={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}};const s=o[this.region]||o[a];return{playDomain:s.__PLAY_DOMAIN__,backupPlayDomain:null==s?void 0:s.__BACKUP_PLAY_DOMAIN__}}get playDomain(){var e;return this.playDomainDegrade&&null!=(e=this.apiMap.backupPlayDomain)?e:this.apiMap.playDomain}setVodTeaId(){const e=Js(this.userRegion,this.region);!function(e){Iw.TEA_ID=e}(this.configs.logTeaAppId||e.__LOG_TEA_ID__||4951)}getMergedConfigs(e){const t=pi(this.configs);return Bi(t,pi(e),((e,t)=>{if(ye(e))return t})),t}updateConfigs(e){Bi(this.configs,pi(e),((e,t)=>{if(ye(e))return t}))}updatePlayList(){const{url:e,playList:t=[],urlExpireTimestamp:i}=this.configs,n=[...t].filter((e=>e.url));if(e&&!n.length){const t=u(c({},this.current),{url:e,urlExpireTimestamp:i});this.playList=[t]}else this.playList=n}isVidPlay(){var e,t;return!!(null==(t=null==(e=this.configs)?void 0:e.getVideoByToken)?void 0:t.playAuthToken)}}class CA{}CA.isSupported=()=>!1,CA.isSupportedH264=e=>!1;var kA=function(){function e(t){pr(this,e),this.config=t.config,this.parent=t.root,this.root=Mr.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),t.root.appendChild(this.root);var i=this.config.maxHeight;i&&this.setStyle({maxHeight:i}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var n="touch"===this.config.domEventType?"touchend":"click";this._delegates=ba.delegate.call(this,this.root,"li",n,this.onItemClick)}return yr(e,[{key:"renderItemList",value:function(e){var t=this,i=this.config,n=this.root;e?i.data=e:e=i.data,i.style&&Object.keys(i.style).map((function(e){n.style[e]=i[e]})),e.length>0&&(this.attrKeys=Object.keys(e[0])),this.root.innerHTML="",e.map((function(e,i){var n=e.selected?"option-item selected":"option-item";e["data-index"]=i,t.root.appendChild(Mr.createDom("li","<span>".concat(e.showText,"</span>"),e,n))}))}},{key:"onItemClick",value:function(e){e.delegateTarget||(e.delegateTarget=e.target);var t=e.delegateTarget;if(t&&Mr.hasClass(t,"selected"))return!1;var i="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");Mr.addClass(t,"selected"),n&&Mr.removeClass(n,"selected"),i(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(e,t){if(!e||!t)return{};var i={};t.map((function(t){i[t]=e.getAttribute(t)}));var n=e.getAttribute("data-index");return n&&(i.index=Number(n)),i}},{key:"show",value:function(){Mr.removeClass(this.root,"hide"),Mr.addClass(this.root,"active")}},{key:"hide",value:function(){Mr.removeClass(this.root,"active"),Mr.addClass(this.root,"hide")}},{key:"setStyle",value:function(e){var t=this;Object.keys(e).forEach((function(i){t.root.style[i]=e[i]}))}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map((function(e){e.destroy&&e.destroy()})),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),e}(),IA="side",PA="middle",DA="default",wA="click",AA="hover";var RA="mobile"===Vr.device,xA=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"onEnter",(function(e){e.stopPropagation(),n.emit("icon_mouseenter",{pluginName:n.pluginName}),n.switchActiveState(e)})),vr(Tr(n),"switchActiveState",(function(e){e.stopPropagation(),n.config.toggleMode===wA?n.toggle(!n.isActive):n.toggle(!0)})),vr(Tr(n),"onLeave",(function(e){e.stopPropagation(),n.emit("icon_mouseleave",{pluginName:n.pluginName}),n.config.listType!==IA&&n.isActive&&n.toggle(!1)})),vr(Tr(n),"onListEnter",(function(e){n.enterType=2})),vr(Tr(n),"onListLeave",(function(e){n.enterType=0,n.isActive&&n.toggle(!1)})),n.isIcons=!1,n.isActive=!1,n.curValue=null,n.curIndex=0,n}return yr(i,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;this.initIcons(),(RA=RA||"touch"===this.domEventType)&&"mobile"===Vr.device&&t.listType===DA&&(t.listType=IA),t.hidePortrait&&Mr.addClass(this.root,"portrait"),this.on([Ao,ko],(function(){e._resizeList()})),this.once(io,(function(){t.list&&t.list.length>0&&(e.renderItemList(t.list),e.show())})),RA&&this.on(uo,(function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)})),RA?(t.toggleMode=wA,this.activeEvent="touchend"):this.activeEvent=t.toggleMode===wA?"click":"mouseenter",t.toggleMode===wA?this.bind(this.activeEvent,this.switchActiveState):(this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,t=this.icons,i=Object.keys(t),n=!1;i.length>0&&(i.forEach((function(i){e.appendChild(".xgplayer-icon",t[i]),!n&&(n=t[i])})),this.isIcons=n),n||(this.appendChild(".xgplayer-icon",Mr.createDom("span","",{},"icon-text")),Mr.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||Mr.addClass(this.root,"show")}},{key:"hide",value:function(){Mr.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,t,i){if(void 0===e)return"";var n=this.config.list;!i&&(i=this.player.lang),t=!t||Mr.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]);try{return"object"===fr(e[t])?e[t][i]||e[t].en:e[t]}catch(r){return console.warn(r),""}}},{key:"toggle",value:function(e){if(e!==this.isActive&&!this.config.disable){var t=this.player.controls,i=this.config.listType;e?(i===IA?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):(i===IA?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,t){e.stopPropagation();var i=this.config,n=i.listType,r=i.list;this.curIndex=t.to.index,this.curItem=r[this.curIndex],this.changeCurrentText(),(this.config.isItemClickHide||RA||n===IA)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0];t&&(this.find(".icon-text").innerHTML=this.getTextByLang(t,"iconText"))}}},{key:"renderItemList",value:function(e,t){var i=this,n=this.config,r=this.optionsList,o=this.player;if("number"==typeof t&&(this.curIndex=t,this.curItem=n.list[t]),r)return r.renderItemList(e),void this.changeCurrentText();var a,s,l={config:{data:e||[],className:(a=n.listType,s=n.position,a===IA?s===va.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""),onItemClick:function(e,t){i.onItemClick(e,t)},domEventType:RA?"touch":"mouse"},root:n.listType===IA?o.innerContainer||o.root:this.root};if(this.config.isShowIcon){var c=this.player.root.getBoundingClientRect().height,u=n.listType===PA?c-50:c;u&&n.heightLimit&&(l.config.maxHeight="".concat(u,"px")),this.optionsList=new kA(l),this.changeCurrentText(),this.show()}this._resizeList()}},{key:"_resizeList",value:function(){if(this.config.heightLimit){var e=this.player.root.getBoundingClientRect().height,t=this.config.listType===PA?e-50:e;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(t,"px")})}}},{key:"destroy",value:function(){this.config.toggleMode===wA?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.isIcons&&this.unbind("click",this.onIconClick),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>')}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:AA,heightLimit:!0}}}]),i}(ba);const OA={READY:"ready",COMPLETE:"complete",URL_CHANGE:"urlchange",PLAYER_FOCUS:"focus",PLAYER_BLUR:"blur",FULLSCREEN_CHANGE:"fullscreen_change",CSS_FULLSCREEN_CHANGE:"cssFullscreen_change",MINI_STATE_CHANGE:"mini_state_change",DESTROY:"destroy",REPLAY:"replay",RETRY:"retry",DEFINITION_CHANGE:"definition_change",Before_DEFINITION_CHANGE:"before_definition_change",AFTER_DEFINITION_CHANGE:"after_definition_change",VIDEO_RESIZE:"video_resize",PIP_CHANGE:"pip_change",ROTATE:"rotate",SHORTCUT:"shortcut",SEI_PARSED:"SEI_PARSED",USER_ACTION:"user_action",AUTOPLAY_STARTED:"autoplay_started",AUTOPLAY_PREVENTED:"autoplay_was_prevented",READY_CREATE_PLAYER:"ready_create_player",PLAYER_CREATED_FINISH:"player_create_finish",CREATE_PLAYER_PERF:"create_player_perf",PLAYER_REBUILD:"player_rebuild",NOT_SUPPORT_HARDWARE_DECODER:"not_support_hardware_decoder",NOT_SUPPORT_SOFT_DECODER:"not_support_soft_decoder",TOKEN_EXPIRED:"playAuthToken_expired",UMD_LOAD_FAIL:"umd_load_fail",PLAYNEXT:"playnext",URL_NULL:"urlNull",LEAVE_PLAYER:"leaveplayer",ENTER_PLAYER:"enterplayer",RESET:"reset",SOURCE_ERROR:"source_error",SOURCE_SUCCESS:"source_success",LICENSE_STATUS_WARNING:"license_status_warning",AUDIO_TRACKS_UPDATED:"audio_tracks_updated",AUDIO_TRACK_CHANGE:"audio_track_change"},LA=u(c({DANMU_CHANGE:"danmu_change",TIME_SHIFT_CHANGE:"time_shift_change",AI_SUBTITLE_LANG_CHANGE:"ai_subtitle_lang_change",AI_SUBTITLE_MATCH:"ai_subtitle_match",CANCEL_UNMUTE:"cancel_unmute",REFRESH_CLICK:"refresh_click",PLAY_BACKUP_CHANGE:"play_backup_change",PLAY_BACKUP_CHANGE_FINISH:"play_backup_change_finish",PLAY_ERROR_BUTTON_CLICK:"play_error_button_click",PlAY_URL_CHANGE:"play_url_change",SHOW_PLAY_ERROR:"show_play_error",PLAYER_EXTEND_BUTTON:"player_extend_button",LONG_WAITING:"long_waiting",OFTEN_WAITING:"often_waiting",DEFINITION_DEMOTE:"definition_demote",LARKWINDOW_CHANGE:"larkWindow_change",PANEL_MODE_CHANGE:"panel_mode_change",INNER_DEFINITION_CHANGE:"inner_definition_change",LINE_CHANGE:"line_change",GET_PLAY_URL_ERR:"get_play_url_err",MEDIA_EXPIRED:"MEDIA_EXPIRED",MIRROR_CHANGE:"mirror_change"},{}),{AUTOPLAY_SUCCESS:"autoplay_success",AUTOPLAY_FAILED:"autoplay_failed",MENU_LOG:"MENU_LOG",MENU_REPORT:"MENU_REPORT",PLAY_LIST_CHANGE:"play_list_change",PLAY_LIST_ITEM_CHANGE:"play_list_item_change",PLAY_NEXT_START:"play_next_start",PLAY_NEXT_END:"play_next_end",ABR_AUTO_DESC_CHANGE:"ABR_AUTO_DESC_CHANGE",CORE_EVENT:"core_event",PRELOAD_INFO:"PRELOAD_INFO"}),NA=c(c(c({},{ABORT:"abort",CANPLAY:"canplay",CANPLAY_THROUGH:"canplaythrough",DURATION_CHANGE:"durationchange",EMPITED:"empited",EMPTIED:"emptied",ENDED:"ended",ERROR:"error",LOADED_DATA:"loadeddata",LOADED_META_DATA:"loadedmetadata",LOAD_START:"loadstart",PAUSE:"pause",PLAY:"play",PLAYING:"playing",PROGRESS:"progress",RATE_CHANGE:"ratechange",SEEKED:"seeked",SEEKING:"seeking",STALLED:"stalled",SUSPEND:"suspend",TIME_UPDATE:"timeupdate",VOLUME_CHANGE:"volumechange",WAITING:"waiting"}),OA),LA),MA={SDKEvents:OA,PluginEvents:LA},UA=NA,BA=70,FA=30,HA=50,jA=60,VA=20,KA=e=>class extends e{constructor(e){super(e),this._playTimer=null,this.handleABRDescChange=(...e)=>{this._autoRealDefinition=e[1]||void 0,this.refreshDefinitionList()},this.handleResourceReady=(e=[])=>{var t,i;const{list:n}=this.getCurrentDefinitionInfo(this.player),r=n.filter((t=>{var i;const n=t&&e.find((e=>this.playerData.isDefinitionMatch(e.definition,t.definition)));return n&&"dash"===(null==(i=this.playerData.getStreamType())?void 0:i.toLowerCase())&&(t.url=n.url),n})),o=e.find((e=>null==e?void 0:e.selected))||this.playerData.current,a=r.find((e=>this.playerData.isDefinitionMatch(e.definition,null==o?void 0:o.definition)));this.playerData.playList=r,(null==a?void 0:a.definition)&&(null==(t=this.playerData.current)?void 0:t.definition)!==a.definition&&(this.playerData.current.definition=null==a?void 0:a.definition),null==(i=this.refreshDefinitionList)||i.call(this)},this.getAutoDefRealLevel=()=>{var e;if(this.playerData.isAutoDefinition(null==(e=this.playerData.current)?void 0:e.definition)){const{videoWidth:e,videoHeight:t}=this.player.media;if(e&&t){const{list:i=[]}=this.getCurrentDefinitionInfo(this.player),n=i.find((i=>{const n=i.vwidth||i.width,r=i.vheight||i.height;return n&&r&&n===e&&r===t}));(null==n?void 0:n.definition)&&this._autoRealDefinition!==n.definition&&(this._autoRealDefinition=n.definition,this.refreshDefinitionList(),"mobile"===Vr.device&&(null==this||this.updatePanel()))}}},this.clientType=e.clientType,this.playerData=e.player.config.playerData,this.toastInfo={},this.dataMonitoring()}afterCreate(){var e,t,i,n,r;super.afterCreate(),this._autoRealDefinition=void 0,null==(e=this.refreshDefinitionList)||e.call(this),(this.playerData.isOpenABR()||"dash"===(null==(t=this.playerData.getStreamType())?void 0:t.toLowerCase()))&&this.on("resourceReady",this.handleResourceReady),this.playerData.isOpenABR()&&(this.on("ABR_AUTO_DESC_CHANGE",this.handleABRDescChange),((null==(r=null==(n=null==(i=this.playerData)?void 0:i.adapter)?void 0:n.useNativeAbr)?void 0:r.call(n))||this.player.plugins.dashplugin||this.player.plugins.mp4encryptplayer)&&(this.autoDefDetectTimer=new Us,this.autoDefDetectTimer.repeat(this.getAutoDefRealLevel,1e3))),this.on(LA.PLAY_NEXT_START,(()=>{this.definitionSubscribeId&&ur.unsubscribeProperty(this.playerData.current,"definition",this.definitionSubscribeId),this.playListSubscribeId&&ur.unsubscribeProperty(this.playerData,"playList",this.playListSubscribeId)})),this.on(LA.PLAY_NEXT_END,(()=>{var e,t;null==(e=this.dataMonitoring)||e.call(this),null==(t=this.refreshDefinitionList)||t.call(this)}))}getShowText(e={},t,i){var n,r;if(t)return this.playerData.isOpenABR()&&this.playerData.isAutoDefinition(t.definition)?(null==(r=null==(n=this.playerData.configs)?void 0:n.autoBitrateOpts)?void 0:r.autoDefinitionText)||e[t.definitionTextKey]||t.definition:e[t.definitionTextKey]||t.definition||t.definitionTextKey||i||"HD"}getCurrentDefinitionInfo(e){const t={list:[],defaultDefinition:""},i=e.config.playerData,{current:{lineId:n,definition:r}}=i,o=i.getDefinitionListByLineId(n);return Array.isArray(o)&&o.length>0&&(t.list=o.map((t=>(t.text||(t.text=this.getShowText(e.i18n,t,t.definition)),t)))),t.defaultDefinition=r,t}showToast(e,t){var i,n;const r=null==(i=this.player)?void 0:i.getPlugin("sdkToastPlugin");if(!r)return;const o=this.getShowText(this.i18n,e,t);this.toastInfo&&(clearTimeout(this.toastInfo.timer),null==(n=null==r?void 0:r.remove)||n.call(r,this.toastInfo.id),this.player.off(wo,this.toastInfo.remove),this.player.off(Zr,this.toastInfo.remove)),this.toastInfo={id:r.add(`${this.langText.switching} ${o}...`,0,!0),showTime:Date.now(),delayClose:!1},this.toastInfo.timer=setTimeout((()=>{r.remove(this.toastInfo.id),clearTimeout(this.toastInfo.timer)}),2e3),this.toastInfo.remove=()=>{if(!this.toastInfo.id)return;Date.now()-this.toastInfo.showTime>2e3?r.remove(this.toastInfo.id):this.toastInfo.delayClose=!0},this.player.once(wo,this.toastInfo.remove),this.player.once(Zr,this.toastInfo.remove)}selectDefinition(e){var t,i,n;const r=null==(n=null==(i=null==(t=this.renderList)?void 0:t.find)?void 0:i.call(t,(t=>this.playerData.isDefinitionMatch(t.definition,e.definition))))?void 0:n.definitionTextKey;this.config.showToastOnManualClick&&this.showToast(u(c({},e),{definitionTextKey:r}),e.definition),this.playerData.current.definition=e.definition,this.playerData.isAutoDefinition(e.definition)||(this._autoRealDefinition=void 0)}showRealDefinition(e){return e.selected&&this.playerData.isAutoDefinition(e.definition)&&this.playerData.showRealDefinition()&&this._autoRealDefinition&&!this.playerData.isAutoDefinition(this._autoRealDefinition)}dataMonitoring(){this.playerData&&(this.definitionSubscribeId=ur.subscribeProperty(this.playerData.current,"definition",((e,t)=>{if(e&&t&&e!==t&&this.player){const{list:i}=this.getCurrentDefinitionInfo(this.player),n=i.find((e=>e.definition===t));n&&n.url&&(this.player.changeDefinition(u(c({kid:n.playAuthId},n),{secretKey:n.secretKey,definition:t,url:n.url})),"MOBILE"===this.clientType&&this.updatePanel(),this.player.emit(LA.INNER_DEFINITION_CHANGE,{from:e,to:t,url:n.url}),this.player.emit(LA.PlAY_URL_CHANGE,{url:n.url,from:LA.INNER_DEFINITION_CHANGE}),"PC"===this.clientType&&this.renderItemList(t),this.player.config.isLive&&(this._playTimer=setTimeout((()=>{this.player.ended?this.player.replay():this.player.paused&&this.player.play()}),1e3)))}})),this.playListSubscribeId=ur.subscribeProperty(this.playerData,"playList",(()=>{this.refreshDefinitionList()})))}onItemClick(...e){super.onItemClick(...e)}destroy(){clearTimeout(this.toastInfo.timer),clearTimeout(this._playTimer),this.autoDefDetectTimer&&(this.autoDefDetectTimer.clear(),this.autoDefDetectTimer=null,this.getAutoDefRealLevel=null),this.off("resourceReady",this.handleResourceReady),this.off("ABR_AUTO_DESC_CHANGE",this.handleABRDescChange)}};class WA extends(KA(xA)){constructor(e){const t=e.config.className;super(u(c({},e),{config:c(c({},e.config),t?{className:`${t} xgplayer-definition-plugin-pc`}:{}),clientType:"PC"})),this.onItemClick=function(e,t,i){var n=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return A(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),oA(e,t,{leading:n,maxWait:t,trailing:r})}(this.onItemClick.bind(this),1e3,{trailing:!0})}static get pluginName(){return"sdkDefinitionPlugin"}static get defaultConfig(){return{position:ba.POSITIONS.CONTROLS_RIGHT,index:FA,list:[],defaultDefinition:"",hidePortrait:!1,disable:!1,showToastOnManualClick:!0,className:"xgplayer-definition xgplayer-definition-plugin-pc",isShowIcon:!0,isNeedAuto:!0,allowedSize:null,alwaysShowDefinition:!1}}registerLanguageTexts(){return{switching:{jp:"に切り替える",en:"Switching to",zh:"正在切换至","zh-hk":"正在切換至"}}}afterCreate(){super.afterCreate()}refreshDefinitionList(){var e;(null==(e=this.player.config)?void 0:e.alwaysShowDefinition)&&(this.config.alwaysShowDefinition=!0);const{defaultDefinition:t,list:i}=this.getCurrentDefinitionInfo(this.player);this.config.defaultDefinition=t,this.config.list=i.map(((e,t)=>u(c({},e),{itemIndex:t}))),this.config.list&&this.config.list.length>0&&(this.config.list.length<2?this.config.alwaysShowDefinition?(this.renderItemList(),this.show()):this.hide():(this.renderItemList(),this.show()))}show(){var e;!this.config.list||(null==(e=this.config.list)?void 0:e.length)<2&&!this.config.alwaysShowDefinition||Mr.addClass(this.root,"show")}afterPlayerInit(){}renderItemList(e){if(Array.isArray(e))return;const{list:t,defaultDefinition:i}=this.config;let n=0;const r=t.map(((t,r)=>{var o;const a={url:t.url,definition:t.definition||"",definitionTextKey:t.definitionTextKey,showText:this.getShowText(this.i18n,t,t.definition),isCurrent:!1,selected:!1,isDefinitionAuto:!1},s="string"==typeof e?t.definition===e:void 0===e&&t.definition===i;if(!Mr.isUndefined(t.definition)&&s&&(a.isCurrent=!0,a.selected=!0,n=r),this.showRealDefinition(a)){const e=null==(o=this.renderList)?void 0:o.find((e=>this.playerData.isDefinitionMatch(null==e?void 0:e.definition,this._autoRealDefinition))),t=this.getShowText(this.i18n,e,null==e?void 0:e.definition);a.showText=t?`${a.showText}(${t})`:a.showText}return a.isDefinitionAuto=this.playerData.isAutoDefinition(t.definition),a}));this.renderList=r,super.renderItemList(r,n)}onItemClick(e,t){var i;if(t.to.definition!==this.playerData.current.definition){const n=null==(i=this.playerData.getCurrentStreams())?void 0:i[0];this.emitUserAction(e,"change_definition",{from:n,to:t.to}),this.selectDef(t.to)}}selectDef(e){this.selectDefinition(e),"ontouchstart"in window&&this.optionsList.hide()}changeDefinition(e){const t=this.renderList.find((t=>this.playerData.isDefinitionMatch(t.definition,e)));t&&this.selectDef(t)}destroy(){super.destroy()}}function GA(e){const t={};for(const i of["lang","name"]){const n=e[i];void 0!==n&&(t[i]=n)}return t}function YA(e,t){if(!(t<0||t>=e.length))for(let i=0;i<e.length;i++)e[i].enabled=i===t}function zA(e,t){const i=e;if("function"==typeof i.setAudioOption)i.setAudioOption(GA(t));else{const{id:i,lang:n,name:r}=t,o=e.audioTracks.find((e=>e.id===i&&((void 0===n||e.lang===n)&&(void 0===r||e.name===r))));if(!o||e.audioTrack===o.id)return;e.audioTrack=o.id}}const $A={zh:"中文","zh-cn":"普通话","zh-hk":"粤語","zh-tw":"繁體中文","zh-sg":"普通话",en:"English",ja:"日本語",ko:"한국어",th:"ภาษาไทย",vi:"Tiếng Việt",id:"Bahasa Indonesia",ms:"Bahasa Melayu",fil:"Filipino",tl:"Filipino",my:"မြန်မာဘာသာ",km:"ភាសាខ្មែរ",lo:"ພາສາລາວ",hi:"हिन्दी",bn:"বাংলা",ta:"தமிழ்",te:"తెలుగు",mr:"मराठी",ur:"اردو",fr:"Français",de:"Deutsch",es:"Español","es-419":"Español (Latinoamérica)",it:"Italiano",pt:"Português","pt-br":"Português (Brasil)","pt-pt":"Português (Portugal)",nl:"Nederlands",sv:"Svenska",da:"Dansk",no:"Norsk",fi:"Suomi",ca:"Català",ru:"Русский",pl:"Polski",uk:"Українська",cs:"Čeština",sk:"Slovenčina",ro:"Română",hu:"Magyar",bg:"Български",hr:"Hrvatski",sr:"Српски",sl:"Slovenščina",el:"Ελληνικά",ar:"العربية",fa:"فارسی",he:"עברית",tr:"Türkçe",az:"Azərbaycan",kk:"Қазақша",mn:"Монгол",sw:"Kiswahili"};function XA(e){var t;return null!=(t=$A[e.toLowerCase()])?t:e.toUpperCase()}function qA(e,t){var i;const n=null!=(i=e.name)?i:"",r=e.lang?XA(e.lang):"";return[r||n||`Track ${e.id+1}`,!1!==(null==t?void 0:t.showNameSuffix)&&r&&n?`(${n})`:""].filter(Boolean).join(" ")}function ZA(e,t,i){var n;const r=null!=(n=e.label)?n:"",o=e.language?XA(e.language):"";return[o||r||`Track ${t+1}`,!1!==(null==i?void 0:i.showNameSuffix)&&o&&r?`(${r})`:""].filter(Boolean).join(" ")}class QA extends xA{constructor(){super(...arguments),this._nativeMode=!1,this._nativeAddTrackHandler=null,this._nativeChangeHandler=null,this._nativeRemoveTrackHandler=null,this._nativeChangeRaf=null}static get pluginName(){return"AudioTrack"}static get defaultConfig(){return u(c({},xA.defaultConfig),{position:ba.POSITIONS.CONTROLS_RIGHT,index:BA,list:[],className:"xgplayer-audio-track",hidePortrait:!1,isShowIcon:!0,showNameSuffix:!0})}registerIcons(){return{}}afterPlayerInit(){var e;super.afterPlayerInit(),this.on("hlsAudioTracksUpdated",(e=>{this._onAudioTracksUpdated(e.audioTracks)})),this.on("hlsAudioTrackSwitched",(e=>{this._updateSelection(e.id)}));const t=this._getHls();(null==(e=null==t?void 0:t.audioTracks)?void 0:e.length)>1?this._onAudioTracksUpdated(t.audioTracks):t?this.hide():this._initNativeAudioTracks()}onItemClick(e,t){if(super.onItemClick(e,t),this._nativeMode){const e=this._getNativeTrackList();if(!e)return;YA(e,t.to.id)}else{const e=this._getHls();if(!e)return;zA(e,t.to)}}destroy(){var e;null!==this._nativeChangeRaf&&cancelAnimationFrame(this._nativeChangeRaf),this._unbindNativeAudioTracks(),null==(e=super.destroy)||e.call(this)}_getHls(){var e,t;const i=this.player.plugins;return(null==(e=null==i?void 0:i.encrypthlsplugin)?void 0:e.hls)||(null==(t=null==i?void 0:i.hls)?void 0:t.hls)}_getNativeTrackList(){var e,t;return null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks}_initNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeMode=!0,this._nativeAddTrackHandler=()=>this._onNativeTracksChanged(),this._nativeChangeHandler=()=>{null===this._nativeChangeRaf&&(this._nativeChangeRaf=requestAnimationFrame((()=>{this._nativeChangeRaf=null,this._onNativeTrackEnabled()})))},this._nativeRemoveTrackHandler=()=>this._onNativeTracksChanged(),e.addEventListener("addtrack",this._nativeAddTrackHandler),e.addEventListener("change",this._nativeChangeHandler),e.addEventListener("removetrack",this._nativeRemoveTrackHandler),e.length>1?this._onNativeTracksChanged():this.hide())}_unbindNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeAddTrackHandler&&e.removeEventListener("addtrack",this._nativeAddTrackHandler),this._nativeChangeHandler&&e.removeEventListener("change",this._nativeChangeHandler),this._nativeRemoveTrackHandler&&e.removeEventListener("removetrack",this._nativeRemoveTrackHandler))}_onNativeTracksChanged(){const e=this._getNativeTrackList();!e||e.length<=1?this.hide():(this._renderNativeTracks(e),this.show())}_onNativeTrackEnabled(){const e=this._getNativeTrackList();e&&this._renderNativeTracks(e)}_renderNativeTracks(e){const t={showNameSuffix:!1!==this.config.showNameSuffix},i=[];for(let r=0;r<e.length;r++){const n=e[r],o=ZA(n,r,t);i.push({id:r,name:o,showText:o,iconText:o,selected:n.enabled,default:n.enabled})}const n=i.findIndex((e=>e.selected));this.config.list=i,super.renderItemList(i,n>-1?n:0)}_onAudioTracksUpdated(e){!e||e.length<=1?this.hide():(this._renderTracks(e),this.show())}_updateSelection(e){const t=this._getHls();t&&this._renderTracks(t.audioTracks,e)}_renderTracks(e,t){var i;const n=this._getHls(),r=null!=(i=null!=t?t:null==n?void 0:n.audioTrack)?i:-1,o={showNameSuffix:!1!==this.config.showNameSuffix},a=e.find((e=>e.default)),s=e.map((e=>u(c({},e),{showText:qA(e,o),iconText:qA(e,o),selected:e.id===r})));if(-1===r&&a){const e=s.findIndex((e=>e.id===a.id));e>-1&&(s[e].selected=!0)}const l=s.findIndex((e=>e.selected));this.config.list=s,super.renderItemList(s,l>-1?l:0)}}function JA(){return(new DOMParser).parseFromString('<svg width="19" height="16" viewBox="0 0 19 15" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_18_7532)" filter="url(#filter0_d_18_7532)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.33333 3.19115C9.33333 2.79702 8.91856 2.54067 8.56604 2.71694L4.66668 4.66662C4.66667 4.66662 4.66667 4.66663 4.66667 4.66663C4.66667 4.66664 4.66666 4.66665 4.66665 4.66665H3.19685C2.90404 4.66665 2.66666 4.90402 2.66666 5.19684V9.4698C2.66666 9.76261 2.90404 9.99998 3.19685 9.99998H4.55791C4.62971 9.99998 4.70076 10.0146 4.76676 10.0429L8.5943 11.6832C8.94415 11.8332 9.33333 11.5765 9.33333 11.1959V3.19115Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13 6.87773L14.8934 4.7138C14.9485 4.6509 15.0377 4.6509 15.0927 4.7138L15.2921 4.94158C15.3471 5.00448 15.3471 5.10646 15.2921 5.16936L13.3986 7.33329L15.2921 9.49722C15.3471 9.56012 15.3471 9.6621 15.2921 9.725L15.0927 9.95278C15.0377 10.0157 14.9485 10.0157 14.8934 9.95278L13 7.78886L11.1066 9.95278C11.0515 10.0157 10.9623 10.0157 10.9073 9.95278L10.7079 9.725C10.6529 9.6621 10.6529 9.56012 10.7079 9.49722L12.6014 7.33329L10.7079 5.16936C10.6529 5.10646 10.6529 5.00448 10.7079 4.94158L10.9073 4.7138C10.9623 4.6509 11.0515 4.6509 11.1066 4.7138L13 6.87773Z" fill="white" stroke="white" stroke-width="0.530187"/>\n </g>\n <defs>\n <filter id="filter0_d_18_7532" x="-0.666667" y="0" width="19.3333" height="19.3333" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n <feOffset dy="2.66667"/>\n <feGaussianBlur stdDeviation="1.33333"/>\n <feComposite in2="hardAlpha" operator="out"/>\n <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>\n <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_18_7532"/>\n <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_18_7532" result="shape"/>\n </filter>\n <clipPath id="clip0_18_7532">\n <rect width="14" height="14" fill="white" transform="translate(2)"/>\n </clipPath>\n </defs>\n</svg>\n\n',"image/svg+xml").firstChild}const{isWeixin:eR,os:tR,device:iR}=Vr,nR=tR.isAndroid,rR=tR.isIos,oR="mobile"===iR;let aR=0,sR=!1;class lR extends ba{constructor(e){super(e),this.state={mode:0,showUnmuteBt:!1},this.wxCanPlayFn=()=>{window.WeixinJSBridge&&window.WeixinJSBridge.invoke("getNetworkType",{},(()=>{this.wxTimer=setTimeout((()=>{this.wxTimer&&clearTimeout(this.wxTimer);const e=this.player.play();e&&e.then?e.then((()=>{as.log("wechat autoplay success")})).catch((e=>{as.warn("wechat autoplay fail:",e),this.state.showUnmuteBt=!1,this.renderUnmuteBt()})):as.warn("wechat browser no play promise")}))}))},this.wxPlay=()=>{this.player.readyState>=2?this.wxCanPlayFn():nR?this.player.once(io,this.wxCanPlayFn):rR&&this.player.once(vo,this.wxCanPlayFn)},this.userClickPlay=()=>{if(sR)return;const e=this.player.play();e&&e.then?e.then((()=>{as.log("user action autoplay success"),sR=!0})).catch((e=>{as.warn("user action autoplay fail:",e)})):(as.warn("no play promise"),sR=!0)},this.handleAutoplayPrevented=()=>0===this.state.mode?(as.warn("unmute autoplay fail"),this.player.emit(LA.AUTOPLAY_FAILED,{mode:"unmute"}),nR&&eR?void(this.state.mode=2):void(this.config.enableDegradeMuteAutoplay&&this.changeMuteMode())):1===this.state.mode?(as.warn("mute autoplay fail"),this.player.emit(LA.AUTOPLAY_FAILED,{mode:"mute"}),void(this.state.mode=2)):2===this.state.mode?(this.player.emit(LA.AUTOPLAY_FAILED,{mode:"noSupport"}),void as.warn("not support autoplay")):void 0,this.handleAutoplayStart=()=>{if(0!==this.state.mode)return 1===this.state.mode?(this.player.emit(LA.AUTOPLAY_SUCCESS,{mode:"mute"}),this.state.showUnmuteBt=!0,void this.renderUnmuteBt()):2===this.state.mode?(this.player.emit(LA.AUTOPLAY_SUCCESS,{mode:"click"}),this.player.muted=!1,this.state.showUnmuteBt=!1,void this.renderUnmuteBt()):void 0;this.player.emit(LA.AUTOPLAY_SUCCESS,{mode:"unmute"})},this.handleVolumechange=()=>{this.state.showUnmuteBt&&(this.state.showUnmuteBt=!1,this.renderUnmuteBt(),this.player.paused&&this.player.readyState>=1&&this.player.play())},this.cancelUnmute=e=>{const t=Date.now();t-aR>200&&(aR=t,this.player.muted=!1,this.state.showUnmuteBt=!1,this.renderUnmuteBt(),this.emitUserAction(e,"cancel_mute"))}}static get pluginName(){return"AutoplayPlugin"}static get defaultConfig(){return{position:ba.POSITIONS.ROOT,enableDegradeMuteAutoplay:!1,enableWxJsBridgeAutoplay:!1,userActionDom:window.document.body,enableUserActionAutoplay:!1,showUnmuteBtn:!0}}afterCreate(){this.initState(),this.initEvents(),this.setWXAutoPlay()}registerLanguageTexts(){return{unmute:{jp:"ミュートを解除する",en:"Click to unmute",zh:"点击取消静音","zh-hk":"點擊取消靜音"},muted:{jp:"ミュート",en:"muted",zh:"已静音","zh-hk":"已靜音"}}}registerIcons(){return{muted:{icon:JA,class:"xgplayer-muted-svg"}}}updateLang(){this.renderUnmuteBt()}initState(){const{enableDegradeMuteAutoplay:e,enableWxJsBridgeAutoplay:t,enableUserActionAutoplay:i}=this.player.config;e&&(this.config.enableDegradeMuteAutoplay=!0),t&&(this.config.enableWxJsBridgeAutoplay=!0),i&&(this.config.enableUserActionAutoplay=!0),this.state.mode=this.player.muted?1:0}initEvents(){this.player.on(yo,this.handleAutoplayPrevented),this.player.on(go,this.handleAutoplayStart),this.player.on(ro,this.handleVolumechange),this.setUserActionAutoPlay()}setWXAutoPlay(){eR&&this.player.config.autoplay&&this.config.enableWxJsBridgeAutoplay&&(window.WeixinJSBridge?this.wxPlay():document.addEventListener("WeixinJSBridgeReady",this.wxPlay,!1))}setUserActionAutoPlay(){var e;(null==(e=this.config)?void 0:e.enableUserActionAutoplay)&&this.player.once(LA.AUTOPLAY_FAILED,(()=>{this.hasSetUserAutoplay=!0;(this.config.userActionDom instanceof window.Node?this.config.userActionDom:window.document.body).addEventListener("click",this.userClickPlay,!1)}))}changeMuteMode(){this.player.muted=!0,this.state.showUnmuteBt=!0,this.state.mode=1,this.renderUnmuteBt(),this.timer=setTimeout((()=>{this.timer&&clearTimeout(this.timer);const e=this.player.play();e&&e.then?e.then((()=>{as.log("degrade mute autoplay success")})).catch((e=>{as.warn("degrade mute autoplay fail:",e),this.player.muted=!1,this.state.showUnmuteBt=!1,this.renderUnmuteBt()})):as.warn("no play promise")}))}renderUnmuteBt(){var e,t,i;const n=this.root;if(n&&(n.innerHTML="",this.state.showUnmuteBt&&this.config.showUnmuteBtn)){const r=this.langText.unmute||(null==(i=null==(t=null==(e=this.registerLanguageTexts)?void 0:e.call(this))?void 0:t.unmute)?void 0:i.en),o=Mr.createDom("div",r,void 0,"xgplayer-unmute-bt");n.appendChild(o),this.bind(".xgplayer-unmute-bt","click",this.cancelUnmute),this.bind(".xgplayer-unmute-bt","touchend",this.cancelUnmute)}}destroy(){if(this.player.off(yo,this.handleAutoplayPrevented),this.player.off(go,this.handleAutoplayStart),this.player.off(ro,this.handleVolumechange),this.timer&&window.clearTimeout(this.timer),this.wxTimer&&window.clearTimeout(this.wxTimer),document.removeEventListener("WeixinJSBridgeReady",this.wxPlay,!1),this.hasSetUserAutoplay){const e=oR?"touch":"click";(this.config.userActionDom instanceof window.Node?this.config.userActionDom:window.document.body).removeEventListener(e,this.userClickPlay,!1)}}render(){return'<div class="xgplayer-unmute"></div>'}}const cR=void 0;function uR(){return(new DOMParser).parseFromString('<svg width="18" height="18" viewBox="0 0 23 22" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M5.75 11C5.75 11.9665 4.9665 12.75 4 12.75C3.0335 12.75 2.25 11.9665 2.25 11C2.25 10.0335 3.0335 9.25 4 9.25C4.9665 9.25 5.75 10.0335 5.75 11ZM13.25 11C13.25 11.9665 12.4665 12.75 11.5 12.75C10.5335 12.75 9.75 11.9665 9.75 11C9.75 10.0335 10.5335 9.25 11.5 9.25C12.4665 9.25 13.25 10.0335 13.25 11ZM19 12.75C19.9665 12.75 20.75 11.9665 20.75 11C20.75 10.0335 19.9665 9.25 19 9.25C18.0335 9.25 17.25 10.0335 17.25 11C17.25 11.9665 18.0335 12.75 19 12.75Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}class hR extends ba{constructor(e){super(e),this.panel=null,this.panelContainer=null}static get pluginName(){return"MoreButtonPlugin"}static get defaultConfig(){return{position:ba.POSITIONS.ROOT_TOP,iconPlugins:[],maxShowNum:2}}beforePlayerInit(){}afterPlayerInit(){}afterCreate(){this.renderMoreIcon()}updateLang(e){if(!this.panelContainer)return;const t=this.panelContainer.querySelectorAll(".panel-icon-bt-text"),i=this.getAndSplitList().extraList;t.forEach((t=>{var n,r;const o=Number(t.getAttribute("plugin-index"));(null==(r=null==(n=i[o])?void 0:n.textTips)?void 0:r[e])&&(t.innerHTML=i[o].textTips[e])}))}registerIcons(){return{more:{icon:uR,class:"xgplayer-more-svg"}}}getAndSplitList(){var e;let t,i;const n=(null!=(e=this.player.config.ignores)?e:[]).map((e=>e.toLowerCase())),r=this.config.iconPlugins.filter((e=>!n.includes(e.pluginName.toLowerCase())));return r.length>this.config.maxShowNum+1?(t=r.slice(0,this.config.maxShowNum),i=r.slice(-(r.length-this.config.maxShowNum))):t=[...r],{list:null!=t?t:[],extraList:null!=i?i:[]}}children(){const e=this.getAndSplitList().list,t={};return e.forEach((e=>{t[e.pluginName]={plugin:e,options:{root:this.root}}})),t}renderMoreIcon(){const e=this.getAndSplitList().extraList;if(0===e.length)return;const t=this.root,i=Mr.createDom("div","",{},"xgplayer-icon");i.appendChild(this.icons.more),i.addEventListener("click",(()=>{this.renderPanel(e)}));const n=Mr.createDom("xg-icon","",{"data-index":0},"xgplayer-more");n.appendChild(i),t.appendChild(n)}renderPanel(e){this.panelContainer||(this.panelContainer=Mr.createDom("div","",{},"panel-content"),e.forEach(((e,t)=>{var i,n;const r=Mr.createDom("div","",{},"panel-icon-bt"),o=Mr.createDom("div","",{},"panel-icon-svg");r.appendChild(o),this.registerExtraPlugin(e,o);const a="zh-cn"===this.player.lang?"zh":this.player.lang,s=null!=(n=null==(i=e.textTips)?void 0:i[a])?n:e.pluginName;r.appendChild(Mr.createDom("span",s,{"plugin-index":t},"panel-icon-bt-text")),this.panelContainer.appendChild(r)}))),this.player.panel.showPanel(this.panelContainer)}registerExtraPlugin(e,t){this.player.registerPlugin({plugin:e,options:{root:t}})}destroy(){}render(){return'<div class="xgplayer-rightTop-iconList"></div>'}}function dR(){return(new DOMParser).parseFromString('<svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M68 40C68 55.464 55.464 68 40 68C24.536 68 12 55.464 12 40C12 24.536 24.536 12 40 12C55.464 12 68 24.536 68 40ZM34.75 34.05C34.75 35.7897 33.5747 37.2 32.125 37.2C30.6753 37.2 29.5 35.7897 29.5 34.05C29.5 32.3103 30.6753 30.9 32.125 30.9C33.5747 30.9 34.75 32.3103 34.75 34.05ZM40.2276 43.7334C36.2145 43.7334 32.6052 45.4732 30.1709 48.2331C29.5316 48.9579 29.6009 50.0638 30.3258 50.7031C31.0506 51.3424 32.1565 51.2731 32.7958 50.5483C34.5802 48.5252 37.2407 47.2334 40.2276 47.2334C43.2213 47.2334 45.8871 48.531 47.6715 50.562C48.3094 51.288 49.4152 51.3594 50.1412 50.7215C50.8673 50.0836 50.9387 48.9778 50.3008 48.2518C47.8663 45.481 44.2498 43.7334 40.2276 43.7334ZM47.8352 37.2C49.2849 37.2 50.4602 35.7897 50.4602 34.05C50.4602 32.3103 49.2849 30.9 47.8352 30.9C46.3854 30.9 45.2102 32.3103 45.2102 34.05C45.2102 35.7897 46.3854 37.2 47.8352 37.2Z" fill="#ffffff" fill-opacity="0.15"/>\n</svg>\n',"image/svg+xml").firstChild}var fR=(e=>(e.NETWORK="NETWORK",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_FORBIDDEN="NETWORK_FORBIDDEN",e.NETWORK_NOTFOUND="NETWORK_NOTFOUND",e.NETWORK_RANGE_NOT_SATISFIABLE="NETWORK_RANGE_NOT_SATISFIABLE",e.NETWORK_PROTOCOL="NETWORK_PROTOCOL",e.NETWORK_URL_EXPIRE="NETWORK_URL_EXPIRE",e.NETWORK_URL_SIGN="NETWORK_URL_SIGN",e.NETWORK_ENCRYPT_HLS_ERR="NETWORK_ENCRYPT_HLS_ERR",e.MEDIA_ERR="MEDIA_ERR",e.MEDIA_ERR_ABORTED="MEDIA_ERR_ABORTED",e.MEDIA_ERR_NETWORK="MEDIA_ERR_NETWORK",e.MEDIA_ERR_DECODE="MEDIA_ERR_DECODE",e.MEDIA_ERR_SRC_NOT_SUPPORTED="MEDIA_ERR_SRC_NOT_SUPPORTED",e.MEDIA_ERR_NOT_SUPPORTED="MEDIA_ERR_NOT_SUPPORTED",e.MEDIA_ERR_URL_EMPTY="MEDIA_ERR_URL_EMPTY",e.MEDIA_ERR_FILE_NOT_SUPPORTED="MEDIA_ERR_FILE_NOT_SUPPORTED",e.MEDIA_ERR_PLAY_ERR="MEDIA_ERR_PLAY_ERR",e.MEDIA_SOURCE_CANNOT_PLAY_TYPE="MEDIA_SOURCE_CANNOT_PLAY_TYPE",e.BUSINESS_DRM_NOT_SUPPORT="BUSINESS_DRM_NOT_SUPPORT",e.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD="BUSINESS_DRM_NOT_SUPPORT_UN_RECORD",e.BUSINESS_DRM_LACK_MEDIA_KEY="BUSINESS_DRM_LACK_MEDIA_KEY",e.BUSINESS_DRM_LACK_KEY_SESSION="BUSINESS_DRM_LACK_KEY_SESSION",e.BUSINESS_DRM_GENERATE_REQUEST_FAIL="BUSINESS_DRM_GENERATE_REQUEST_FAIL",e.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH="BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH",e.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH="BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH",e.BUSINESS_DRM_LICENSE_FAIL="BUSINESS_DRM_LICENSE_FAIL",e.BUSINESS_DRM_KEY_ERROR="BUSINESS_DRM_KEY_ERROR",e.BUSINESS_DRM_CERT_FAIL="BUSINESS_DRM_CERT_FAIL",e.PRIVATE_DRM_KEY_GET_FAILED="PRIVATE_DRM_KEY_GET_FAILED",e.PRIVATE_DRM_CRYPTO_NOT_SUPPORT="PRIVATE_DRM_CRYPTO_NOT_SUPPORT",e.PRIVATE_DRM_RSA_FAIL="PRIVATE_DRM_RSA_FAIL",e.OTHER="OTHER",e.VOD_LOG_NOT_CONFIGURED="VOD_LOG_NOT_CONFIGURED",e.PLAY_AUTH_TOKEN_EXPIRED="PLAY_AUTH_TOKEN_EXPIRED",e.HLS_KEY_TOKEN_EXPIRED="HLS_KEY_TOKEN_EXPIRED",e.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED="THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED",e.GET_PLAY_INFO_ERR="GET_PLAY_INFO_ERR",e.GET_HLS_DECRYPTION_KEY_ERR="GET_HLS_DECRYPTION_KEY_ERR",e.LICENSE_VALIDATE_FAIL="LICENSE_VALIDATE_FAIL",e.DEFINITION_AUTO="DEFINITION_AUTO",e.LICENSE_STATUS_INVALID="LICENSE_STATUS_INVALID",e.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH="LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH",e.BASE_LICENSE_NOT_SUPPORT_265="BASE_LICENSE_NOT_SUPPORT_265",e.BASE_LICENSE_NOT_SUPPORT_ABR="BASE_LICENSE_NOT_SUPPORT_ABR",e.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER="BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER",e.BASE_LICENSE_NOT_SUPPORT_PRELOAD="BASE_LICENSE_NOT_SUPPORT_PRELOAD",e.EXPIRED_LICENSE_NOT_SUPPORT_265="EXPIRED_LICENSE_NOT_SUPPORT_265",e.EXPIRED_LICENSE_NOT_SUPPORT_ABR="EXPIRED_LICENSE_NOT_SUPPORT_ABR",e.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER="EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER",e.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD="EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD",e.DRAMA_INVALID_PARAM="DRAMA_INVALID_PARAM",e.DRAMA_NO_INFO_FOUND="DRAMA_NO_INFO_FOUND",e.DRAMA_NOT_SUBMITTED="DRAMA_NOT_SUBMITTED",e.DRAMA_UNDER_REVIEW="DRAMA_UNDER_REVIEW",e.DRAMA_FAILED_REVIEW="DRAMA_FAILED_REVIEW",e.DRAMA_WITHDRAWN_REVIEW="DRAMA_WITHDRAWN_REVIEW",e.DRAMA_FAILED_TO_QUERY="DRAMA_FAILED_TO_QUERY",e.DRAMA_INVALID_TTOP_TOKEN="DRAMA_INVALID_TTOP_TOKEN",e.DRAMA_NOT_ON_SHELF="DRAMA_NOT_ON_SHELF",e.DRAMA_FAILED_GET_EPISODE_INFO="DRAMA_FAILED_GET_EPISODE_INFO",e))(fR||{});const pR={NETWORK:{code:2100,message:"Network error",textKey:fR.NETWORK},NETWORK_TIMEOUT:{code:2101,message:"Network timeout",textKey:fR.NETWORK_TIMEOUT},NETWORK_FORBIDDEN:{code:2103,message:"Block access to this media",textKey:fR.NETWORK_FORBIDDEN},NETWORK_NOTFOUND:{code:2104,message:"Media not found",textKey:fR.NETWORK_NOTFOUND},NETWORK_RANGE_NOT_SATISFIABLE:{code:2116,message:"Media fetch range not satisfiable",textKey:fR.NETWORK_RANGE_NOT_SATISFIABLE},NETWORK_PROTOCOL:{code:2190,message:"The current page protocol is https, but video url protocol is http",textKey:fR.NETWORK_PROTOCOL},NETWORK_URL_EXPIRE:{code:2191,message:"Media url has expired",textKey:fR.NETWORK_URL_EXPIRE},NETWORK_URL_SIGN:{code:2192,message:"Media url signature parameter error",textKey:fR.NETWORK_URL_SIGN},NETWORK_ENCRYPT_HLS_ERR:{code:2193,message:"Get m3u8 file or encrypt key fail",textKey:fR.NETWORK_ENCRYPT_HLS_ERR},MEDIA_ERR_ABORTED:{code:5101,message:"User or browser abort the media",textKey:fR.NETWORK_URL_SIGN},MEDIA_ERR_NETWORK:{code:5102,message:"Network error",textKey:fR.MEDIA_ERR_NETWORK},MEDIA_ERR_DECODE:{code:5103,message:"Media decode error",textKey:fR.MEDIA_ERR_DECODE},MEDIA_ERR_SRC_NOT_SUPPORTED:{code:5104,message:"Media is not supported or url is not available",textKey:fR.MEDIA_ERR_SRC_NOT_SUPPORTED},MEDIA_ERR_NOT_SUPPORTED:{code:5105,message:"Media not support play",textKey:fR.MEDIA_ERR_NOT_SUPPORTED},MEDIA_ERR_URL_EMPTY:{code:5106,message:"Media url empty",textKey:fR.MEDIA_ERR_URL_EMPTY},MEDIA_ERR_FILE_NOT_SUPPORTED:{code:5901,message:"Media file not supported",textKey:fR.MEDIA_ERR_FILE_NOT_SUPPORTED},MEDIA_ERR_PLAY_ERR:{code:5902,message:"Media play error",textKey:fR.MEDIA_ERR_PLAY_ERR},BUSINESS_DRM_NOT_SUPPORT:{code:7101,message:"DRM encrypted playback is not supported",textKey:fR.BUSINESS_DRM_NOT_SUPPORT},BUSINESS_DRM_NOT_SUPPORT_UN_RECORD:{code:7102,message:"Anti-screen recording is not supported",textKey:fR.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD},BUSINESS_DRM_LACK_MEDIA_KEY:{code:7103,message:"The video data lacks the corresponding MediaKey",textKey:fR.BUSINESS_DRM_LACK_MEDIA_KEY},BUSINESS_DRM_LACK_KEY_SESSION:{code:7104,message:"The browser does not support the corresponding DRM KeySession",textKey:fR.BUSINESS_DRM_LACK_KEY_SESSION},BUSINESS_DRM_GENERATE_REQUEST_FAIL:{code:7105,message:"Decryption playback error",textKey:fR.BUSINESS_DRM_GENERATE_REQUEST_FAIL},BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH:{code:7106,message:"Missing DRM certificate request link",textKey:fR.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH},BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH:{code:7107,message:"Missing DRM License request link",textKey:fR.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH},BUSINESS_DRM_LICENSE_FAIL:{code:7108,message:"Failed to request or update a license",textKey:fR.BUSINESS_DRM_LICENSE_FAIL},BUSINESS_DRM_KEY_ERROR:{code:7109,message:"Decryption Error",textKey:fR.BUSINESS_DRM_KEY_ERROR},BUSINESS_DRM_CERT_FAIL:{code:7110,message:"Failed to request DRM certificate",textKey:fR.BUSINESS_DRM_CERT_FAIL},PRIVATE_DRM_GET_KEY_FAILED:{code:7200,message:"Private DRM key get failed",textKey:fR.PRIVATE_DRM_KEY_GET_FAILED},PRIVATE_DRM_CRYPTO_NOT_SUPPORT:{code:7201,message:"Web cryptography API is not supported",textKey:fR.PRIVATE_DRM_CRYPTO_NOT_SUPPORT},PRIVATE_DRM_RSA_FAIL:{code:7202,message:"Decryption by RSA-OAEP failed",textKey:fR.PRIVATE_DRM_RSA_FAIL},OTHER:{code:8e3,message:"Other error",textKey:fR.OTHER},VOD_LOG_NOT_CONFIGURED:{code:8999,message:"Log options not configured correctly",textKey:fR.VOD_LOG_NOT_CONFIGURED},PLAY_AUTH_TOKEN_EXPIRED:{code:10001,message:"playAuthToken has expired",textKey:fR.PLAY_AUTH_TOKEN_EXPIRED},HLS_KEY_TOKEN_EXPIRED:{code:10003,message:"keyToken has expired",textKey:fR.HLS_KEY_TOKEN_EXPIRED},THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED:{code:10003,message:"thirdPartyDrmAuthToken has expired",textKey:fR.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED},GET_PLAY_INFO_ERR:{code:11001,message:"Failed to get play info",textKey:fR.GET_PLAY_INFO_ERR},GET_HLS_DECRYPTION_KEY_ERR:{code:11002,message:"Failed to get the HLS decryption key",textKey:fR.GET_HLS_DECRYPTION_KEY_ERR},LICENSE_STATUS_INVALID:{code:12001,message:"License validation is invalid",textKey:fR.LICENSE_STATUS_INVALID},LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH:{code:12002,message:"License domain name does not match",textKey:fR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH}},gR={BASE_LICENSE_NOT_SUPPORT_265:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12111,message:"The basic license does not support H265",textKey:fR.BASE_LICENSE_NOT_SUPPORT_265},BASE_LICENSE_NOT_SUPPORT_ABR:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12112,message:"The basic license does not support ABR",textKey:fR.BASE_LICENSE_NOT_SUPPORT_ABR},BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12113,message:"The basic license does not support dynamic buffer",textKey:fR.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER},BASE_LICENSE_NOT_SUPPORT_PRELOAD:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12114,message:"The basic license does not support preload",textKey:fR.BASE_LICENSE_NOT_SUPPORT_PRELOAD},EXPIRED_LICENSE_NOT_SUPPORT_265:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12211,message:"Expired license does not support H265",textKey:fR.EXPIRED_LICENSE_NOT_SUPPORT_265},EXPIRED_LICENSE_NOT_SUPPORT_ABR:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12212,message:"Expired license does not support ABR",textKey:fR.EXPIRED_LICENSE_NOT_SUPPORT_ABR},EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12213,message:"The expired license does not support dynamic buffer",textKey:fR.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER},EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12214,message:"Expired license does not support preloading",textKey:fR.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD}};var yR=(e=>(e[e.manifest=1]="manifest",e[e.network=2]="network",e[e.demux=3]="demux",e[e.remux=4]="remux",e[e.media=5]="media",e[e.decoder=6]="decoder",e[e.drm=7]="drm",e[e.other=8]="other",e[e.runtime=9]="runtime",e[e.token=10]="token",e[e.serve=11]="serve",e[e.license=12]="license",e[e.ad=13]="ad",e))(yR||{});const vR={INVALID_PARAM:{code:9301,message:"Invalid parameter in short drama environment",textKey:fR.DRAMA_INVALID_PARAM},NO_INFO_FOUND:{code:9302,message:"No information found for this Episode",textKey:fR.DRAMA_NO_INFO_FOUND},NOT_SUBMITTED:{code:9303,message:"Episode not submitted for review",textKey:fR.DRAMA_NOT_SUBMITTED},UNDER_REVIEW:{code:9304,message:"Episode under for review",textKey:fR.DRAMA_UNDER_REVIEW},FAILED_REVIEW:{code:9305,message:"Episode failed review",textKey:fR.DRAMA_FAILED_REVIEW},WITHDRAWN_REVIEW:{code:9306,message:"Episode withdrawn from review",textKey:fR.DRAMA_WITHDRAWN_REVIEW},FAILED_TO_QUERY:{code:9307,message:"Failed to query video playback information",textKey:fR.DRAMA_FAILED_TO_QUERY},INVALID_TTOP_TOKEN:{code:9308,message:"Invalid playAuthToken or failed to verify TTOP token",textKey:fR.DRAMA_INVALID_TTOP_TOKEN},NOT_ON_SHELF:{code:9310,message:"Video is not on shelf",textKey:fR.DRAMA_NOT_ON_SHELF},FAILED_GET_EPISODE_INFO:{code:9399,message:"Failed get episode info",textKey:fR.DRAMA_FAILED_GET_EPISODE_INFO}};const mR={SUCCESS:0,NOT_SUBMITTED:1,UNDER_REVIEW:2,FAILED_REVIEW:3,WITHDRAWN:4,NOT_ON_SHELF:5},_R=1002305;class ER{constructor(){this.actions={}}addMiddleware(e,t){this.actions[e]?this.actions[e].push(t):this.actions[e]=[t]}removeMiddleware(e,t){const i=this.actions[e]||[],n=i.findIndex((e=>e===t));n>-1&&(i.splice(n,1),this.actions[e]=i)}removeAllMiddlewareByKey(e){this.actions[e]=[]}removeAllMiddleware(){this.actions={}}applyMiddleware(e){const t=this;return function(i,n){return d(this,null,(function*(){const{eventName:r}=i,o=t.actions[e]||[],a=[];o.forEach((e=>{try{const t=e(i);a.push(Vs(t))}catch(t){throw a.push(Vs(null)),t}})),Promise.all([...a]).then((e=>{e.every((e=>!e))&&n(r,i)})).catch((e=>{as.error(e),n(r,e)}))}))}}}const TR="xgplayer-error-analysing",bR="xgplayer-error-retrying",SR="ve_error",CR={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},kR={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},IR="http:",PR="https:";let DR=null;function wR(e){var t;const i=null==(t=null==window?void 0:window.location)?void 0:t.protocol;if(e.startsWith(IR)&&i===PR){if(new URL(e).protocol===IR)return AR.getVeErrorInfo(pR.NETWORK_PROTOCOL)}}class AR{constructor(e,t){this.retryTimestamps=[],this.totalRetryCount=0,this.retrying=!1,this.retryTimer=null,this.userInvokedPlay=!1,this._playIntentHook=()=>{this.userInvokedPlay=!0},this._onError=e=>d(this,null,(function*(){var t;this.player.addClass(TR);const i=yield this.transformToVeError(e);this.player.veError=i,as.error("error: ",i),this.player.removeClass(TR),(null==(t=this.config.ignoreErrorCodes)?void 0:t.includes(null==i?void 0:i.veErrorCode))?as.log("ignore errorCode",null==i?void 0:i.veErrorCode):this.player.emit(SR,i)})),this.player=e,this.config={},t&&Object.keys(AR.defaultConfig).forEach((e=>{void 0===t[e]?this.config[e]=AR.defaultConfig[e]:this.config[e]=t[e]})),this.init()}static get defaultConfig(){return{oriErrRetryCount:3,oriErrRetryCycle:1e4,oriErrRetryBaseDelay:500,oriErrMaxTotalRetry:0,enableOriErrRetry:!0,needSyncAnalyzeError:!0,analyzeTimeout:3e3,ignoreErrorCodes:[],clientKey:void 0}}createVeError(e={}){var t,i;const{errorType:n,errorCode:r=0,errorMessage:o="",originError:a="",ext:s={},mediaError:l=null}=e,h=(null==(i=null==(t=this.player)?void 0:t.i18n)?void 0:i.ERROR_TYPES)||{},d=this.player.media;if(d){const t=l||d.error||{},{duration:i,currentTime:h,ended:f,src:p,currentSrc:g}=this.player,{readyState:y,networkState:v}=d;let m=r||t.code;CR[m]&&(m=CR[m]);const{code:_,message:E,textKey:T}=e.veError||{},b=o||t.message,S=_||m,C=AR.getErrorType(e),k=E||b,I=T||(e=>{for(const[t,{code:i,textKey:n}]of Object.entries(pR))if(i===e)return n})(S)||function(e){for(const t of Object.values(vR))if(t.code===e)return t.textKey}(S),P=this.player.i18n[I]||k||this.player.i18n[fR.MEDIA_ERR]||"unknown error",D=this.player.config,w=this.config.clientKey?{clientKey:this.config.clientKey}:{},A=this.config.clientKey?{albumId:D.albumId||D.album_id,episodeId:D.episodeId||D.episode_id||D.episodeID}:{};return u(c({playerVersion:"1.18.0",currentTime:h,duration:i,ended:f,readyState:y,networkState:v,src:p||g,errorType:n,errorCode:m,httpCode:e.httpCode,message:b,mediaError:t,originError:a?a.stack:"",host:Mr.getHostFromUrl(p||g),veErrorCode:S,veErrorType:C,veErrorMessage:k,displayMessage:P},w),{videoInfo:c({isMSE:Rs(this.player),vtype:this.player.url?this.player.vtype:"",drmEncryptType:nl(this.player)||"",vid:D.vid},A),ext:s})}if(arguments.length>1){const e={playerVersion:"1.18.0",domain:document.domain,ex:null},t=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"];for(let i=0;i<arguments.length;i++)e[t[i]]=arguments[i];return e.ex=h?(h[arguments[0]]||{}).msg:"",e}}static getErrorType(e){const{veError:t,mediaError:i}=e||{},n=t||(null==i?void 0:i.veError);if(null==n?void 0:n.code){const e=n.code+"";return n.code>=1e4?yR[e.slice(0,2)]:yR[e.slice(0,1)]}if(null==i?void 0:i.code)return kR[i.code]||"other"}static getVeErrorInfo(e,t){const{code:i,message:n,textKey:r}=e;return{code:i,message:t||n,textKey:r}}init(){var e,t;DR||(DR=this.player.errorHandler),function(e,t){for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&"function"==typeof t[i]&&Object.defineProperty(e,i,{configurable:!0,value:t[i]})}(this.player,(e=this.player,t=this,{errorHandler(i,n){var r;as.log("errorHandler, err: ",n);const o=e;if(o.media&&(o.media.error||n)){let e=o.media.error||n;const a=e.code?Wr[e.code]:"other";let s=e.message;"xg-video"===(null==(r=null==o?void 0:o.config)?void 0:r.mediaType)||o.media.currentSrc||o.media.srcObject||(s="empty_src",e={code:6,message:s}),o.emit(i,t.createVeError({errorType:a,errorCode:e.code,errorMessage:e.message||"",mediaError:e,veError:n.veError,originError:n}))}}})),this.setErrorEventMiddleWare(),this.player.on(Zr,this._onError),this.player.useHooks("play",this._playIntentHook)}destroy(){this.player.off(Zr,this._onError),this.player.removeHooks("play",this._playIntentHook),this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null,this.retrying=!1,this.player.removeClass(bR))}shouldOriRetryReloadOnly(){var e;if(this.userInvokedPlay)return!1;const t=this.player.config;if(!t||t.autoplay||t.autoplayMuted)return!1;const i=this.player.media;return!!i&&0===(null==(e=i.played)?void 0:e.length)}setErrorEventMiddleWare(){this.eventMiddleware=new ER,this.eventMiddleware.addMiddleware(Zr,this.defaultErrorMiddleWare.bind(this)),this.player.setEventsMiddleware({error:this.eventMiddleware.applyMiddleware(Zr)})}defaultErrorMiddleWare(e){return d(this,null,(function*(){var t,i;if(!Mr.isMSE(this.player.media)){const{error:n}=e||{};if(!n)return as.error("invalid media error: ",e),!1;const{code:r}=n||{};if((2===r||3===r||4===r)&&(null==(i=null==(t=this.player)?void 0:t.config)?void 0:i.url)){const t=Date.now();this.retryTimestamps=this.retryTimestamps.filter((e=>t-e<=this.config.oriErrRetryCycle));const{oriErrRetryCount:i,oriErrMaxTotalRetry:n}=this.config,o=n>0&&this.totalRetryCount>=n,a=this.retryTimestamps.length>=i,s=!1!==this.config.enableOriErrRetry;if(s&&!o&&!a)return this.oriVideoRetry(!this.shouldOriRetryReloadOnly());if(s&&(o?as.warn(`max total retry count ${n} reached, stop retrying`):as.warn(`retry count in window ${this.config.oriErrRetryCycle}ms reached ${i}, stop retrying`)),3===r)this.config.needSyncAnalyzeError&&(yield this.analyseStream());else{const t=tl(rl(this.player));if(t){const i=wR(t);if(i)return e.error.veError=i,!1;this.config.needSyncAnalyzeError&&(e.error.veError=yield this.analyseNet(t,e.error,this.config.analyzeTimeout))}}}}return!1}))}oriVideoRetry(e=!0){if(this.retrying)return!0;this.retrying=!0;const t=this.config.oriErrRetryBaseDelay*Math.pow(2,this.retryTimestamps.length);return as.warn(`origin video play error, retry in ${t}ms (window: ${this.retryTimestamps.length+1}/${this.config.oriErrRetryCount}, total: ${this.totalRetryCount+1})`),this.player.addClass(bR),clearTimeout(this.retryTimer),this.retryTimer=setTimeout((()=>{this.retryTimestamps.push(Date.now()),this.totalRetryCount++,e?this.player.retry():this.oriVideoReloadWithoutPlay(),this.player.removeClass(bR),this.retrying=!1}),t),!0}oriVideoReloadWithoutPlay(){const e=this.player;e.removeClass("xgplayer-is-error"),e.addClass("xgplayer-isloading"),e.runHooks("retry",(()=>{const t=e.currentTime,i="string"==typeof e.config.url?e.config.url:"",n=Mr.isMSE(e.media)?{url:i}:e.preProcessUrl(i);e.src=n.url,e.config.isLive||(e.currentTime=t)}))}analyseNet(e,t,i){return d(this,null,(function*(){const n=t.code||t.errorCode,r=t.message||t.errorMessage||t.msg;try{const t=yield As(e,{range:"0-8",timeout:i});as.log("xhr result",t);const{status:o,response:a}=t;if(403===o){if("string"==typeof a){if(a.includes("expire"))return AR.getVeErrorInfo(pR.NETWORK_URL_EXPIRE);if(a.includes("sign"))return AR.getVeErrorInfo(pR.NETWORK_URL_SIGN)}return AR.getVeErrorInfo(pR.NETWORK_FORBIDDEN)}if(416===o)return AR.getVeErrorInfo(pR.NETWORK_RANGE_NOT_SATISFIABLE);if(404===o)return AR.getVeErrorInfo(pR.NETWORK_NOTFOUND);if(o===ws.TIMEOUT)return AR.getVeErrorInfo(pR.NETWORK_TIMEOUT);if(o===ws.ERROR)return AR.getVeErrorInfo(pR.NETWORK,r);if(200===o||206===o){if(4===n)return r?AR.getVeErrorInfo(pR.MEDIA_ERR_PLAY_ERR,r):AR.getVeErrorInfo(pR.MEDIA_ERR_FILE_NOT_SUPPORTED);if(3===n)return AR.getVeErrorInfo(pR.MEDIA_ERR_DECODE,r);if(2===n)return AR.getVeErrorInfo(pR.MEDIA_ERR_NETWORK,r);if(1===n)return AR.getVeErrorInfo(pR.MEDIA_ERR_ABORTED,r);if(-9996===n){return nl(this.player)===or.PRIVATE_ENCRYPT_UPGRADE?AR.getVeErrorInfo(pR.PRIVATE_DRM_GET_KEY_FAILED):AR.getVeErrorInfo(pR.GET_HLS_DECRYPTION_KEY_ERR)}}return}catch(o){return as.warn("Failed to analyze the network. If the domain of the video address has been configured with CORS, it means that the playback error is caused by the failure of the video request. If the domain of the video address is not configured with CORS, the real reason for the playback error cannot be determined because the video request cannot be analyzed."),AR.getVeErrorInfo(pR.NETWORK)}}))}analyseStream(){return d(this,null,(function*(){}))}handle2100Error(e){return d(this,arguments,(function*({error:e,errorCode:t,httpCode:i,response:n,finalMessage:r}){const o={errorType:yR.network,errorCode:t,httpCode:i,errorMessage:r,originError:e};if(i){if(404===i)o.veError=AR.getVeErrorInfo(pR.NETWORK_NOTFOUND);else if(416===i)o.veError=AR.getVeErrorInfo(pR.NETWORK_RANGE_NOT_SATISFIABLE);else if(403===i){try{const e=yield function(e){return(t=e)&&"object"==typeof t&&"responseText"in t&&"status"in t&&"statusText"in t?e.responseText:function(e){return!(!e||"object"!=typeof e)&&"json"in e&&"text"in e&&"status"in e}(e)?e.text():e;var t}(n);if("string"==typeof e)return e.includes("expire")?o.veError=AR.getVeErrorInfo(pR.NETWORK_URL_EXPIRE):e.includes("sign")?o.veError=AR.getVeErrorInfo(pR.NETWORK_URL_SIGN):o.veError=AR.getVeErrorInfo(pR.NETWORK_FORBIDDEN),this.createVeError(o)}catch(a){as.warn("get response text error")}return o.veError=AR.getVeErrorInfo(pR.NETWORK_FORBIDDEN),this.createVeError(o)}}else{const e=tl(rl(this.player));if(e){const t=wR(e);t&&(o.veError=t)}}return this.createVeError(o)}))}handle9991Error({error:e,errorCode:t,httpCode:i,finalMessage:n}){return this.createVeError({errorType:yR.serve,errorCode:t||pR.OTHER.code,httpCode:i,errorMessage:n,originError:e,veError:AR.getVeErrorInfo(pR.GET_HLS_DECRYPTION_KEY_ERR)})}handleNetError(e){return d(this,arguments,(function*({error:e,errorCode:t,httpCode:i,finalMessage:n}){try{const r=tl(rl(this.player)),o=yield this.analyseNet(r,e,3e3);return o?this.createVeError({errorType:yR.network,errorCode:t||pR.OTHER.code,httpCode:i,errorMessage:n,originError:e,veError:o}):this.createVeError({errorCode:t||pR.NETWORK_ENCRYPT_HLS_ERR.code,httpCode:i,errorMessage:n,originError:e,veError:AR.getVeErrorInfo(pR.NETWORK_ENCRYPT_HLS_ERR)})}catch(r){return as.warn("analyse fail of the net error of encrypt hls m3u8 file"),this.createVeError({errorCode:t||pR.NETWORK_ENCRYPT_HLS_ERR.code,httpCode:i,errorMessage:n,originError:e,veError:AR.getVeErrorInfo(pR.NETWORK_ENCRYPT_HLS_ERR)})}}))}handleStuckError({error:e,errorCode:t,httpCode:i,finalMessage:n}){const r={errorType:yR.network,errorCode:t,httpCode:i,errorMessage:n,originError:e},{currentTime:o,duration:a,buffered:s}=this.player,l=!s||0===s.length||!a,c=this.player.checkBuffer(o,{startDiff:0,endDiff:.1});if(l||!c)return r.veError=AR.getVeErrorInfo(pR.NETWORK),this.createVeError(r);this.createVeError(r)}transformToVeError(e){return d(this,null,(function*(){if((null==e?void 0:e.veErrorCode)&&!this.player.getPlugin("Mp4EncryptPlayer"))return e;const{httpCode:t,errorMessage:i,message:n,msg:r,response:o}=e||{},a=(null==e?void 0:e.code)||(null==e?void 0:e.errorCode),s=i||n||("string"==typeof r?r:"other error");if(2100===a)return this.handle2100Error({error:e,errorCode:a,httpCode:t,response:o,finalMessage:s});if(-9991===a)this.handle9991Error({error:e,errorCode:a,httpCode:t,finalMessage:s});else{if([2103,5104,5102].includes(a)&&this.player.getPlugin("Mp4EncryptPlayer")||-9996===a&&this.player.getPlugin("EncryptHlsPlugin"))return this.handleNetError({error:e,errorCode:a,httpCode:t,finalMessage:s});if([9002,9003].includes(a))return this.handleStuckError({error:e,errorCode:a,httpCode:t,finalMessage:s})}return this.createVeError(c({errorCode:a||pR.OTHER.code,httpCode:t,errorMessage:s,originError:e},e||{}))}))}}const RR=new Set(Object.values(vR).map((e=>e.code)));let xR=class extends ba{constructor(e){super(e),this._errDetailList=[],this._errorDomMode=null,this.state={showError:!1,retryTimes:0,idx:0},this.handleError=e=>d(this,null,(function*(){this.isVodLogConError=(null==e?void 0:e.errorCode)===pR.VOD_LOG_NOT_CONFIGURED.code,this.player&&this.player.pause(),this.config.isNeedDemoteBack?(this.state.showError=!1,this.changeMainOrBackup()):this.state.showError=!0,this.renderError(e)})),this.handleEnd=()=>{},this.handleRefreshClick=()=>{var e,t;null==(e=this.player)||e.emit(LA.PLAY_ERROR_BUTTON_CLICK),this.player.removeClass(Ia.PAUSED),this.closeError(),null==(t=this.player)||t.retry()},this.closeError=()=>{this.state.showError&&(this.state.showError=!1,this.renderError())},this.playerData=e.player.config.playerData}static get pluginName(){return"sdkErrorPlugin"}static get defaultConfig(){return{showError:!0,errorImg:!0,errorTips:!0,isNeedRefreshButton:!0,isNeedCopyButton:!0,isNeedDemoteBack:!1,retryLoopNum:1,errorTipsText:null,position:ba.POSITIONS.ROOT}}afterCreate(){var e,t,i;this.initEvents();const n=Object.values(pR).reduce(((e,t)=>{const{code:i,textKey:n}=t;return e[i]=this.i18n[n],e}),{});this.errNoteMap=c({other:null!=(i=null==(t=null==(e=this.i18n.ERROR_TYPES)?void 0:e.other)?void 0:t.msg)?i:"error",1:this.i18n.MEDIA_ERR_ABORTED,2:this.i18n.MEDIA_ERR_NETWORK,3:this.i18n.MEDIA_ERR_DECODE},n)}registerLanguageTexts(){return{clickButton:{jp:"リフレッシュ",en:"Refresh",zh:"刷新","zh-hk":"刷新"},errorTips:{jp:"再生中にエラーが発生しました。[更新]をクリックして試してください",en:"An error occurred while playing, click refresh to try",zh:"播放发生错误,点击刷新试试吧","zh-hk":"播放發生錯誤,點擊刷新試試吧"},errorCode:{jp:"コード",en:"code",zh:"错误码","zh-hk":"錯誤碼"},did:{jp:"デバイスID",en:"deviceID",zh:"设备 ID","zh-hk":"設備 ID"},playTime:{jp:"遊び時間",en:"playTime",zh:"播放时间","zh-hk":"播放時間"},copyError:{jp:"コピーエラー",en:"Copy error",zh:"复制错误信息","zh-hk":"複製錯誤訊息"},copySuccess:{jp:"コピー成功",en:"Copy success",zh:"复制成功","zh-hk":"複製成功"}}}registerIcons(){return{errorImg:{icon:dR,class:"xgplayer-error-svg"}}}updateLang(){var e,t;if(!this.$errorDom)return;const i=this.$errorDom.querySelector(".xgplayer-error-tips");if(i){const n=null!=(t=null==(e=this.config.errorTipsText)?void 0:e[this.lang])?t:this.langText.errorTips;i.innerHTML=n}const n=this.$errorDom.querySelector(".xgplayer-error-button");n&&(n.innerHTML=this.langText.clickButton)}initEvents(){this.player.on(SR,this.handleError),this.on(io,this.closeError),this.on($r,this.closeError)}getRetryList(){var e;const t=this.playerData.getCurrentStreams()[0];return[null==t?void 0:t.url,...null!=(e=null==t?void 0:t.backUrlList)?e:[]]}changeMainOrBackup(){this.player.addClass(Ia.ENTER);const e=this.getRetryList(),t=this.config.retryLoopNum*e.length,i=(e.indexOf(this.player.config.url)+1)%e.length;this.state.idx=i;const n=e[i];if(!n||this.state.retryTimes===t)return this.player.removeClass(Ia.ENTER),this.state.retryTimes===t&&this.player.emit(LA.PLAY_BACKUP_CHANGE_FINISH),this.state.showError=!0,this.renderError(),void this.resetTimes();this.player.once("canplay",(()=>{this.state.retryTimes=0})),as.log(`retry times: ${this.state.retryTimes}`,n),this.player.emit(LA.PLAY_BACKUP_CHANGE,{currentUrl:this.player.config.url,nextUrl:n,retryTimes:this.state.retryTimes}),this.changeUrl(n),this.state.retryTimes=this.state.retryTimes+1}changeUrl(e){this.player.config.url=e,this.player.switchURL(e,!1),this.player.emit(LA.PlAY_URL_CHANGE,{url:e,from:LA.PLAY_BACKUP_CHANGE})}resetTimes(){this.state.retryTimes=0,this.state.idx=0}renderError(e){if(!this.config.showError)return;const t=this.root;t&&(t.innerHTML="",t.style.display="none",(this.state.showError||this.isVodLogConError)&&(this.player.emit(LA.SHOW_PLAY_ERROR),t.style.display="block",t.appendChild(this.getErrorDom(e))),this.isVodLogConError&&(this.player.blur(),this.player.pause()))}addErrDetail(e){Array.isArray(e)?this._errDetailList=[...this._errDetailList,...e]:this._errDetailList.push(e)}getErrorInfo(e){var t,i,n,r,o;const a=e.veErrorCode||e.errorCode,s=null==(t=this.player)?void 0:t.vodLogger,l=(null==(o=null==(r=null==(n=null==(i=null==s?void 0:s.tracker)?void 0:i.getConfig)?void 0:n.call(i))?void 0:r.user)?void 0:o.user_unique_id)||(null==s?void 0:s.line_user_id);return{code:a,appId:null==s?void 0:s.line_app_id,did:l||"unknown",playTime:ls().format("YYYY-MM-DD HH:mm:ss")}}getErrorInfoDom(e){const{code:t,did:i,playTime:n}=this.getErrorInfo(e),r=Mr.createDom("div","",void 0,"xgplayer-error-info-wrap"),o=`<p class="xgplayer-error-info-p">\n <span class="xgplayer-error-info-title">${this.langText.errorCode||"code"}</span>\n <span class="xgplayer-error-info-content">${t}</span>\n </p>`;r.appendChild(Mr.createDomFromHtml(o));const a=`<p class="xgplayer-error-info-p">\n <span class="xgplayer-error-info-title">${this.langText.did||"deviceID"}</span>\n <span class="xgplayer-error-info-content">${i}</span>\n </p>`;r.appendChild(Mr.createDomFromHtml(a));const s=`<p class="xgplayer-error-info-p">\n <span class="xgplayer-error-info-title">${this.langText.playTime||"playTime"}</span>\n <span class="xgplayer-error-info-content">${n}</span>\n </p>`;return r.appendChild(Mr.createDomFromHtml(s)),r}handleCopyBtnClick(e){const{did:t,playTime:i,appId:n}=this.getErrorInfo(e);try{const r=JSON.stringify(u(c({},e),{playTime:i,deviceID:t,appId:n}));navigator.clipboard.writeText(r).then((()=>{!function(e,t=1e3){const i=document.createElement("div");i.className="veplayer-toast",i.textContent=e,document.body.appendChild(i),setTimeout((()=>i.classList.add("show")),10),setTimeout((()=>{i.classList.remove("show"),setTimeout((()=>null==i?void 0:i.remove()),300)}),t)}(this.langText.copySuccess||"copySuccess")}))}catch(r){as.error("copy error info err ",r)}}getActionDom(e){const t=e.errorType,i=Mr.createDomFromHtml('<div class="xgplayer-error-action-wrap"></div>'),n=!(t&&[yR[10],yR[11],yR[12]].includes(t));if(this.config.isNeedRefreshButton&&n){const e=Mr.createDom("div",this.langText.clickButton||"Refresh",void 0,"xgplayer-error-button refresh-button");this.bind(".refresh-button","click",this.handleRefreshClick),i.appendChild(e)}if(this.config.isNeedCopyButton){const t=Mr.createDom("div",this.langText.copyError||"CopyError",void 0,"xgplayer-error-button copy-button");this.bind(".copy-button","click",this.handleCopyBtnClick.bind(this,e)),i.appendChild(t)}return i}getErrorDom(e){var t,i,n,r,o,a;const{errorCode:s,message:l,displayMessage:c}=e,u=null!=(t=null==e?void 0:e.veErrorCode)?t:null==e?void 0:e.errorCode,h=!!pB.ttDramaEnv,d="number"==typeof u&&RR.has(u);if("drama"===(h&&d?"drama":"normal")){if(!this.$errorDom){this.$errorDom=Mr.createDom("div","",void 0,"xgplayer-error-cover xgplayer-drama-error-cover");const e=Mr.createDom("div","Video isn't available",void 0,"xgplayer-drama-error-toast");this.$errorDom.appendChild(e),this.emit("sdkerrorplugin_render",this.$errorDom)}return this.$errorDom}if(!this.$errorDom){if(this.$errorDom=Mr.createDom("div","",void 0,"xgplayer-error-cover"),this.config.errorImg){const e=Mr.createDom("div","",void 0,"xgplayer-error-img");e.appendChild(this.icons.errorImg),this.$errorDom.appendChild(e)}if(this.config.errorTips){let t="";t=(null==(n=null==(i=this.config)?void 0:i.errorTipsText)?void 0:n[this.lang])?null==(r=this.config.errorTipsText)?void 0:r[this.lang]:e?c||this.errNoteMap[s]||this.player.errorNote&&this.i18n[this.player.errorNote]||l||this.errNoteMap.other||"error":this.langText.errorTips;const o=Mr.createDom("div",t,void 0,"xgplayer-error-tips");this.$errorDom.appendChild(o)}this.$errorDom.appendChild(this.getErrorInfoDom(e)),this.$errorDom.appendChild(this.getActionDom(e)),(null==(o=this._errDetailList)?void 0:o.length)&&(null==(a=this._errDetailList)||a.forEach((e=>{const t="function"==typeof e?e():e;if(t){const e=Mr.createDom("div",`${t.label}: ${t.value}`,void 0,"xgplayer-error-detail-info");this.$errorDom.appendChild(e)}}))),this.emit("sdkerrorplugin_render",this.$errorDom)}return this.$errorDom}destroy(){this.player.off(Zr,this.handleError)}render(){return this.config.showError?'<xgplayer-error class="xgplayer-error"></xgplayer-error>':""}};function OR(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function LR(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?OR(Object(i),!0).forEach((function(t){FR(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):OR(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function NR(e){return(NR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function UR(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,QR(n.key),n)}}function BR(e,t,i){return t&&UR(e.prototype,t),i&&UR(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function FR(e,t,i){return(t=QR(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function HR(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&VR(e,t)}function jR(e){return(jR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function VR(e,t){return(VR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function KR(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function WR(e,t,i){return(WR=KR()?Reflect.construct.bind():function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&VR(r,i.prototype),r}).apply(null,arguments)}function GR(e){var t="function"==typeof Map?new Map:void 0;return GR=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return WR(e,arguments,jR(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),VR(n,e)},GR(e)}function YR(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zR(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return YR(e)}function $R(e){var t=KR();return function(){var i,n=jR(e);if(t){var r=jR(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return zR(this,i)}}function XR(){return XR="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=jR(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}},XR.apply(this,arguments)}function qR(e){return function(e){if(Array.isArray(e))return ZR(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ZR(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return ZR(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ZR(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function QR(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var JR=["b","i","u","span","c","ruby","rt","v","lang"],ex=["br"];var tx=/^WEBVTT/i,ix=/^\d+\r?\n\d{2}:\d{2}:\d{2},\d{3}\s*-->/m,nx=/^STYLE+$/,rx=/^\:\:cue/,ox=/^}+$/,ax=/^\[Script Info\].*/,sx=[/[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,3}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/,/[0-9]{1,3}:[0-9]{2}:[0-9]{2},[0-9]{1,3}\s*-->\s*[0-9]{1,3}:[0-9]{2}:[0-9]{2},[0-9]{1,3}/],lx=/^Format:\s/,cx=/^Style:\s/,ux=/^Dialogue:\s/,hx=/^([0-5]?\d)[.,](\d{1,3})$/;function dx(e){var t=hx.exec(e);return t?(1e3*Number(t[1])+Number(t[2]))/1e3:0}function fx(e){var t=e.length;return 3===t?60*(60*Number(e[0])+Number(e[1]))+dx(e[2]):2===t?60*Number(e[0])+dx(e[1]):dx(e[0])}function px(e){return/^(\-|\+)?\d+(\.\d+)?$/.test(e)}function gx(e){return null==e?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function yx(e,t){return e>=0&&e<t.length?t[e]:""}function vx(e){return t=function(e){return String(e||"").trim().split(/[\s.]/)[0].toLowerCase()}(e),JR.includes(t)||ex.includes(t);var t}var mx=function(){function e(){MR(this,e)}return BR(e,null,[{key:"parseJson",value:function(e){for(var t=[],i=0,n=0;n<e.length;n++){if(i>=50&&(i=0),0===i){var r={start:e[n].start,list:[e[n]],end:e[n].end};t.push(r)}else t[t.length-1].list.push(e[n]),t[t.length-1].end=e[n].end;i++}return t}},{key:"parse",value:function(t,i){var n=e.checkFormat(t);try{var r;i({format:n,list:(r="ass"===n?e.parseASS(t):e.parseVTT(t)).list,styles:r.styles})}catch(nF){console.error(nF),i({format:n},nF)}}},{key:"parseASSItem",value:function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(","),i={},n="";try{var r=t.length-e.length;return n=gx(n=(n=r>0?t.splice(e.length-1,r+1).join(",")+"":t[t.length-1]+"").replace(/\\n+/g,"")),t[e.length-1]=n,e.map((function(e,n){"end"===e||"start"===e?i[e]=fx(t[n].split(":")):"text"===e?i[e]=[t[n]]:"layer"===e?(i[e]=[t[n]],i.textTag=[t[n]]):i[e]="style"===e?[t[n]]:Number(t[n])?Number(t[n]):t[n]})),i}catch(nF){return console.error(nF),{}}}},{key:"parseASS",value:function(t){for(var i=t.split("\n"),n=[],r=0,o=0,a=[],s=[],l=null;r<i.length;){if(lx.test(i[r]))s=(s=i[r].replace(lx,"").replace(/\s+/g,"").split(",")).map((function(e){return e.toLocaleLowerCase()}));else if(cx.test(i[r]))a.push(i[r].replace(cx,"").replace(/\s+/g,""));else if(ux.test(i[r])){var c=e.parseASSItem(i[r].replace(ux,""),s);if(l&&c.start===l.start&&c.end===l.end)try{var u=l,h=u.text,d=u.textTag,f=u.style;h.push(c.text[0]),d.push(c.textTag[0]),f.push(c.style[0])}catch(nF){console.error(nF)}else{l=c;var p=null;o%50==0?((p={start:l.start,end:l.end,list:[]}).list.push(l),n.push(p)):((p=n[n.length-1]).end=l.end,p.list.push(l)),o++}}r++}return{list:n,styles:[]}}},{key:"parseVTTStyle",value:function(e,t){var i=e.split(":");if(i.length>1){var n=i[0].trim().split("-"),r="";n.length>1?n.map((function(e,t){r+=0===t?e:e.charAt(0).toUpperCase()+e.slice(1)})):r=n[0],t[r]=i[1].trim().replace(/;$/,"")}return t}},{key:"parseVTT",value:function(e){for(var t=(e=e.replace(tx,"")).split("\n"),i=[],n=0,r=0,o=null,a=!1,s=!1,l=null,c=null,u=[];n<t.length;){var h=yx(n,t).trim();if(!h||a&&px(h))a=!h;else if(rx.test(h)&&nx.test(yx(n-1,t).trim())){s=!0;var d=/\((.+?)\)/g.exec(h);c=d?d[1]:"",l=""}else if(s)ox.test(h)?(u.push({key:c||"",style:l||""}),l=null,c=null,s=!1):l+=h;else if(h){a=!1;var f=this.checkIsTime(t[n]);if(f){var p=this.parseVttTime(f);if(!o||p.start!==o.start||p.end!==o.end){(o=p).text=[],o.textTag=[];var g=null;r%50==0?((g={start:o.start,end:o.end,list:[]}).list.push(o),i.push(g)):((g=i[i.length-1]).end=o.end,g.list.push(o)),r++}}else if(o){var y=o,v=y.text,m=y.textTag,_=this.parseVttText(t[n]);v.push(_.text),m.push(_.tag)}a=!1}n++}return{list:i,styles:u}}},{key:"checkIsTime",value:function(e){e=e.replace(/\s+/g,"");for(var t=0,i=null;t<sx.length&&!(i=sx[t].exec(e));)t++;return i?i[0]:null}},{key:"parseVttText",value:function(e){var t=/^(<?.+?>)/g.exec(e),i="",n="default";if(t){if(vx(n=t[0].replace(/\<|\>|\&/g,"")))return{tag:"default",text:gx(e.replace(/\\n+/g,"<br/>"))};var r=RegExp("^<".concat(n,">(([\\s\\S])*?)</").concat(n,">$")).exec(e);r?i=r[1]:(i=e,n="")}else i=e;for(var o=/<(\w+)\.(\w+)>/g,a=o.exec(i);a&&a.length>2;)i=i.replace(a[0],"<".concat(a[1],' class="').concat(a[2],'">')),a=o.exec(i);return{tag:n,text:gx(i.replace(/\\n+/g,"<br/>"))}}},{key:"parseVttTime",value:function(e){var t=e.split("--\x3e"),i=0,n=0;if(2===t.length){var r=t[0].split(":"),o=t[1].split(":");i=fx(r),n=fx(o)}return{start:i,end:n,time:e}}},{key:"isVTT",value:function(e){return tx.test(e)}},{key:"isASS",value:function(e){return ax.test(e)}},{key:"checkFormat",value:function(e){return e?tx.test(e)?"vtt":ax.test(e)?"ass":ix.test(e)?"srt":"":""}}]),e}(),_x=[{code:0,msg:"SUCCESS"},{code:1,msg:"LOAD_ERROR"},{code:2,msg:"PARSER_ERROR"},{code:3,msg:"FORMAT_NOT_SUPPORTED"},{code:4,msg:"ID_OR_LANGUAGE_NOT_EXIST"},{code:5,msg:"PARAMETERS_ERROR"},{code:6,msg:"ABORT"},{code:7,msg:"UNKNOWN"},{code:8,msg:"DATA_ERROR:subtitle.url is null"},{code:9,msg:"DATA_ERROR:subtitle.url length is 0"}],Ex=function(e){HR(i,e);var t=$R(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:7,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return MR(this,i),e||(e=_x[r||7].msg),(n=t.call(this,e)).code=r||7,n.message=e,n.type=_x[r||7].msg,n.orgError=o||null,n.data=a||null,n}return BR(i)}(GR(Error));function Tx(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n={code:_x[e].code,msg:_x[e].msg,message:_x[e].msg,id:i&&i.id||"",language:i&&i.language||""};return Object.keys(t).map((function(e){n[e]=t[e]})),n}var bx=BR((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.url,n=t.method,r=void 0===n?"GET":n,o=t.type,a=void 0===o?"arraybuffer":o,s=t.timeout,l=void 0===s?1e4:s,c=t.data,u=void 0===c?{}:c,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return MR(this,e),new Promise((function(e,t){var n=new window.XMLHttpRequest,o=r.toUpperCase(),s=[];if(a&&(n.responseType=a),l&&(n.timeout=l),Object.keys(u).forEach((function(e){s.push("k=".concat(u[e]))})),n.onload=function(){200===n.status||206===n.status?e({context:h,res:n}):t(new Error({context:h,res:n,type:"error"}))},n.onerror=function(e){t(new Error({context:h,res:n,type:"error"}))},n.ontimeout=function(e){t(new Error({context:h,res:n,type:"error"}))},n.onabort=function(){t(new Error({context:h,res:n,type:"error"}))},"GET"===o)n.open(o,"".concat(i)),n.send();else{if("post"!==o)throw new Error("xhr ".concat(o," is not supported"));n.open(o,i),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.send(s.join("&"))}}))})),Sx=function(){function e(){var t,i;MR(this,e);var n=new Promise((function(e,n){t=e,i=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){i(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}return BR(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}();function Cx(e,t){if(!e)return!1;if(e.classList)return Array.prototype.some.call(e.classList,(function(e){return e===t}));var i=e.className&&"object"===NR(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function kx(e,t){e&&(e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):Cx(e,t)||(e.className&&"object"===NR(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t))}function Ix(e,t,i){var n=t.length;if(n<1)return-1;if(t[i=i<0?0:i>=n?n-1:i].start<=e&&e<t[i].end)return i;for(var r=t[i].end<=e?i+1:0;r<n;r++){if(t[r].start<=e&&e<t[r].end)return r;if(e>t[r].end&&r+1<n&&e<t[r+1].start)return-1;if(e>t[r].end&&r+1>=n)return-1}return-1}function Px(e,t,i){var n=t.length;if(n<1)return[];var r=[];if((i=i<0?0:i>=n?n-1:i)<n)for(var o=t[i].end<=e?i:0;o<n&&(t[o].start<=e&&e<t[o].end&&r.push(o),!(e<t[o].start));o++);return r}function Dx(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function wx(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(e);return r.className=n,r.innerHTML=t,Object.keys(i).forEach((function(t){var n=t,o=i[t];"video"===e||"audio"===e||"live-video"===e?o&&r.setAttribute(n,o):r.setAttribute(n,o)})),r}function Ax(e){return e&&e instanceof window.HTMLMediaElement}function Rx(e,t,i){if(i||(i=new Sx),"json"===t){var n=mx.parseJson(e);i.resolve({list:n,format:"json"})}else"string"===t&&mx.parse(e,(function(e,t){if(t){var n=Tx(2,t);i.reject(n,{format:e.format})}else if(e.format||e.list&&0!==e.list.length)i.resolve({styles:e.styles,list:e.list,format:e.format});else{var r=Tx(3);i.reject(r)}}));return i}function xx(e,t){t||(t=new Sx);var i=[];"String"===Dx(e.url)?i=[e.url]:"Array"===Dx(e.url)&&(i=qR(e.url));return function n(){var r=i.shift();if(r)new bx({url:r,type:"text"}).then((function(i){Rx(i.res.response,"string").then((function(i){t.resolve(LR(LR({},i),e))})).catch((function(e){t.reject(e)}))})).catch((function(o){if(i.length>0)n();else{var a=Tx(1,LR({statusText:o.statusText,status:o.status,type:o.type,message:"http load error",url:r},e));t.reject(a)}}));else{var o=Tx(1,LR({message:"http load error",url:e.url},e));t.reject(o)}}(),t}function Ox(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("number"==typeof e)return Number.isFinite(e)?Math.trunc(e):t;if("string"==typeof e){var i=e.trim();if(!i)return t;var n=parseInt(i,10);return Number.isNaN(n)?t:n}return t}function Lx(e,t){return!(!e||!t)&&!!(e.id&&t.id&&e.id===t.id||e.language&&t.language&&e.language===t.language)}function Nx(e){return null!==e&&""!==e.trim()&&/^[a-zA-Z]+$/.test(e)}function Mx(e){return!!/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(e)}var Ux=function(){function e(){var t=this;MR(this,e),this.__handlers=[],window.ResizeObserver&&(this.observer=new window.ResizeObserver((function(e){t.__trigger(e)})))}return BR(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var i=this.__handlers,n=-1,r=0;r<i.length;r++)i[r]&&e===i[r].target&&(n=r);n>-1?this.__handlers[n].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(i,n){e===i.target&&(t=n)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e,t){for(var i=this.__handlers,n=0;n<i.length;n++)if(i[n]&&e===i[n].target){i[n].handler&&i[n].handler.forEach((function(i){try{i(e,t)}catch(nF){console.error(nF)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){var i=e.contentRect;t.__runHandler(e.target,i)}))}}]),e}(),Bx=null;var Fx="resize",Hx="change",jx="off",Vx="update",Kx="error",Wx=/^[A-Za-z0-9_-]+$/,Gx=/^[A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*$/;function Yx(e,t){t&&String(t).split(/(?:\\[nN]|\r\n|\r|\n)+/).forEach((function(t,i){i>0&&e.appendChild(document.createElement("br")),t&&e.appendChild(document.createTextNode(t))}))}function zx(e){var t=e.slice(1,-1).trim();if(!t||"!"===t[0]||"?"===t[0])return null;if("/"===t[0]){var i=/^\/\s*([A-Za-z][\w:-]*)/.exec(t),n=i&&i[1].toLowerCase();return n&&JR.includes(n)?{closing:!0,tagName:n}:null}var r=/\/\s*$/.test(t),o=t.replace(/\/\s*$/,""),a=/^([A-Za-z][\w:-]*(?:\.[^\s/>.]+)*)([\s\S]*)$/.exec(o);if(!a)return null;var s=a[1].split("."),l=s.shift().toLowerCase();if(!JR.includes(l)&&!ex.includes(l))return null;var c,u=function(e){var t=e.trim(),i={};if(!t||!/(?:^|\s)[^\s=]+\s*=/.test(t))return{attrs:i,annotation:t};for(var n=/([^\s=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,r=n.exec(t);r;)i[r[1].toLowerCase()]=r[2]||r[3]||r[4]||"",r=n.exec(t);return{attrs:i,annotation:""}}(a[2]),h=u.attrs;return{attrs:h,annotation:u.annotation,closing:!1,className:(c="".concat(s.join(" ")," ").concat(h.class||""),String(c||"").split(/\s+/).filter((function(e){return Wx.test(e)})).join(" ")),selfClosing:r,tagName:l}}function $x(e){var t="c"===e.tagName||"v"===e.tagName||"lang"===e.tagName?"span":e.tagName,i=document.createElement(t);e.className&&(i.className=e.className);var n=function(e){var t=String(e||"").trim();return Gx.test(t)?t:""}(e.attrs.lang||("lang"===e.tagName?e.annotation:""));return n&&i.setAttribute("lang",n),"v"===e.tagName&&e.annotation&&i.setAttribute("data-voice",e.annotation),i}function Xx(e,t){for(var i=function(e){return null==e?"":String(e).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'|'/g,"'").replace(/&/g,"&")}(t),n=[{dom:e,tagName:""}],r=/<[^>]*>/g,o=0,a=r.exec(i);a;){Yx(n[n.length-1].dom,i.slice(o,a.index));var s=a[0],l=zx(s);if(l)if(l.closing){var c=n.map((function(e){return e.tagName})).lastIndexOf(l.tagName);c>0?n.length=c:Yx(n[n.length-1].dom,s)}else if("br"===l.tagName)n[n.length-1].dom.appendChild(document.createElement("br"));else{var u=$x(l);n[n.length-1].dom.appendChild(u),l.selfClosing||n.push({dom:u,tagName:l.tagName})}else Yx(n[n.length-1].dom,s);o=r.lastIndex,a=r.exec(i)}Yx(n[n.length-1].dom,i.slice(o))}function qx(e){var t=[];if(e&&"String"===Dx(e))t.push({url:[e],index:0,start:-1,end:-1});else if("Array"===Dx(e)){if(0===e.length)return t;"String"===Dx(e[0])?t.push({url:qR(e),index:0,start:-1,end:-1}):e.forEach((function(e,i){t.push({url:e.url||e.src||"",index:i,start:e.start||-1,end:e.end||-1})}))}return t}var Zx=!1,Qx=function(e){HR(i,e);var t=$R(i);function i(e){var n,r,o,a,s,l,c;return MR(this,i),FR(YR(n=t.call(this)),"_onPause",(function(){n.stopRender()})),FR(YR(n),"_onPlay",(function(){n._curRenderTask.length>0&&n.startRender(-1)})),FR(YR(n),"_onTimeupdate",(function(){if(n._isOpen){if(n.config.domRender){var e=n.player.media?n.player.media:n.player,t=e.videoWidth,i=e.videoHeight;!n._videoMeta.scale&&t&&i&&n._onResize(n.player.root)}var r=n._getPlayerCurrentTime();Math.round(Math.abs(1e3*r-n._ctime))<200||(n._ctime=1e3*r,n.currentText&&n.currentText.list&&("live"===n.config.updateMode?n._liveUpdate(r):n._update(r)))}})),FR(YR(n),"_onResize",(function(e){var t=YR(n),i=t._videoMeta;if(t.config.domRender){if(e&&e instanceof window.Element||(e=n.player.root),n._iId&&(clearTimeout(n._iId),n._iId=null),!i.scale){if(!n.player.video)return;var r=n.player.video,o=r.videoWidth,a=r.videoHeight;if(!o||!a)return;i.videoWidth=o,i.videoHeight=a,i.scale=Ox(a/o*100)}n.__startResize(e)}})),FR(YR(n),"_onCoreEvents",(function(e){try{switch(e.eventName){case"core.subtitlesegments":n._onSubtitleSegment(e.list||[]);break;case"core.subtitleplaylist":n._onSubtitlePlaylist(e.list||[]);break;case"core.seipayloadtime":n._onCoreSeiintime(e)}}catch(t){console.error(t)}})),FR(YR(n),"startRender",(function(e){if(e>0&&n._renderIntervalId&&(window.cancelAnimationFrame(n._renderIntervalId),n._renderIntervalId=-1),n.textTrack){var t=YR(n)._curRenderTask;n._lastTimeStamp=(new Date).getTime();var i=[];t.forEach((function(t,r){var o=t.lastTime,a=t.wordList,s=t.interval,l=t.dom,c=t.ids;if(e<0||n._lastTimeStamp<0||n._lastTimeStamp-o>=s){var u=a.shift();u&&l.appendData(u),t.lastTime=n._lastTimeStamp}a.length<1&&i.push({index:r,ids:c})})),n._log(">>>>_renderByWords emptyArr",i.length,t.length),i.forEach((function(e){t.splice(e.index,1),n._log(">>>_renderByWords remove emptyArr",e.index,t.length)})),t.length>0&&(n._renderIntervalId=window.requestAnimationFrame(n.startRender))}})),FR(YR(n),"destroy",(function(){n.detachPlayer(),n.removeAllListeners(),n.player=null,n.textTrack=null,n._curRenderTask=[],n.stopRender()})),r=navigator.userAgent,o=/(?:Windows Phone)/.test(r),a=/(?:SymbianOS)/.test(r)||o,s=/(?:Android)/.test(r),l=/(?:Firefox)/.test(r),c=/(?:iPad|PlayBook)/.test(r)||s&&!/(?:Mobile)/.test(r)||l&&/(?:Tablet)/.test(r),Zx=/(?:iPhone)/.test(r)&&!c||s||a||c,n.currentText=null,n.currentExtText=null,n.textTrack=[],n._cid=-1,n._gid=-1,n._cids=[],n._iId=null,n._iC=0,n.player=null,n.root=null,n.config={line:"double",bottom:0,mode:"stroke",defaultOpen:!1,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,fitVideo:!0,offsetBottom:2,fontColor:"#fff",domRender:!0,updateMode:"vod",renderMode:"",debugger:!1},n._ctime=0,n._loadingTrack={},n.seiTime=0,n.lastSeiTime=0,n._curTexts=[],n._curRenderTask=[],n._renderIntervalId=-1,n._lastTimeStamp=-1,Object.keys(n.config).map((function(t){void 0!==e[t]&&null!==e[t]&&(n.config[t]=e[t])})),n._isOpen=n.config.defaultOpen||!1,n._videoMeta={scale:0,videoHeight:0,videoWidth:0,lwidth:0,lheight:0,vWidth:0,vHeight:0,vBottom:0,vLeft:0,marginBottom:0},e.subTitles&&"Array"===Dx(e.subTitles)?(e.player&&n.attachPlayer(e.player),n.setSubTitles(e.subTitles,n.config.defaultOpen),n):zR(n)}return BR(i,[{key:"version",get:function(){return"3.0.25-rc.11"}},{key:"setSubTitles",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this._isOpen||i;n&&this.innerRoot&&this.switchOff(),!t||t.length<1?this.switchOff():(this.currentText=null,this.textTrack=[],t.forEach((function(t){var i={};Object.keys(t).map((function(e){i[e]=t[e]})),i.url=qx(i.url),i.isDefault&&(e.currentText=i),e.textTrack.push(i)})),this._log("setSubTitles",r),r&&(this.currentText||(this.currentText=this.textTrack[0]),this.switch().catch((function(t){e.emitError(t),e._log("[switch]",t)}))),this.currentText&&this._loadTrack(this.currentText).then((function(t){e.addStyles(t)})).catch((function(t){e.emitError(t),e._log("[_loadTrack] error",t)})),this.emit("reset",{type:"reset",list:this.textTrack,isOpen:r}))}},{key:"updateSubTitle",value:function(e){for(var t=this,i=-1,n=0;n<this.textTrack.length;n++)if(Lx(e,this.textTrack[n])){i=n;break}if(this._log("updateSubTitle",i,e),i>-1){var r=Lx(this.currentText,this.textTrack[i]);if(this._log("updateSubTitle","_isCurrent",r,"this.isOpen",this.isOpen,this.currentText),!r)return;var o=qx(e.url);this.isOpen?(o.forEach((function(e){t.textTrack[i].url.push(e)})),this._log("updateSubTitle _loadTrackUrls",this.textTrack[i]),this._loadTrackUrls(this.currentText,2)):this.textTrack[i].url=o}}},{key:"addStyles",value:function(e){var t=e.styles,i=e.format;t&&"vtt"===i&&(t.map((function(e){e.key||(e.key="xg-text-track-span")})),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="";e.map((function(e){i+=" ".concat(t," ").concat(e.key," {").concat(e.style,"}")}));var n=document.head||document.getElementsByTagName("head")[0],r="xg-text-track-style",o=document.getElementById(r);if(o||((o=document.createElement("style")).type="text/css",o.id=r,n.appendChild(o)),o.styleSheet){var a=function(){try{o.styleSheet.cssText=(o.styleSheet.cssText||"")+i}catch(e){}};o.styleSheet.disabled?setTimeout(a,10):a()}else{var s=document.createTextNode(i);o.appendChild(s)}}(t,".xg-text-track"))}},{key:"attachPlayer",value:function(e){var t=this;if(this._log("attachPlayer"),e&&e!==this.player){this.player&&this.detachPlayer();var i,n,r=this.config,o=r.fontColor,a=r.mode,s=r.fitVideo,l=r.domRender;if(this.player=e,l&&(this.root=document.createElement("xg-text-track"),this.root.className="xg-text-track",!this._isOpen&&kx(this.root,"text-track-hide"),!s&&kx(this.root,"text-track-no-fitvideo"),a&&kx(this.root,"text-track-".concat(a)),this.innerRoot=document.createElement("xg-text-track-inner"),this.root.appendChild(this.innerRoot),o&&(this.root.style.color=o),this.currentText&&["language","id","label"].map((function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")})),this.player.root&&this.player.root.appendChild(this.root),this.player.root&&(i=e.root,n=this._onResize,Bx||(Bx=new Ux),Bx.addObserver(i,n))),Ax(this.player))this.player.addEventListener("timeupdate",this._onTimeupdate),this.player.addEventListener("pause",this._onPause),this.player.addEventListener("play",this._onPlay);else{if("function"!=typeof this.player.on)return;this.player.on("destroy",this.destroy),this.player.on("timeupdate",this._onTimeupdate),this.player.on("pause",this._onPause),this.player.on("play",this._onPlay),this.player.on("core_event",this._onCoreEvents)}this._isOpen&&this.switch().catch((function(e){t._log("[switch]",e)}))}}},{key:"detachPlayer",value:function(){var e,t,i=this.player,n=this.config;i&&(Ax(i)?(i.removeEventListener("timeupdate",this._onTimeupdate),i.removeEventListener("pause",this._onPause),i.removeEventListener("play",this._onPlay)):"function"==typeof i.off&&(i.off("destroy",this.destroy),i.off("timeupdate",this._onTimeupdate),i.off("pause",this._onPause),i.off("play",this._onPlay),i.off("core_event",this._onCoreEvents)),n.domRender&&(i.root&&(e=i.root,Bx&&Bx.unObserver(e,t),this.root&&i.root.contains(this.root)&&i.root.removeChild(this.root)),this.innerRoot=null,this.root=null),this.player=null)}},{key:"switch",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return this._log("switch",t),this._loadingTrack=t,new Promise((function(i,n){if(!t.id&&!t.language){if(e.currentText)return e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn(),void i({message:"switch default subtitle success",code:0});var r=new Ex("no default subtitle",5);return e.emitError(r),void n(r)}if(e.currentText&&Lx(t,e.currentText))e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn(),i(Tx(0));else{var o=null;e.__removeByTime(e._curTexts,0);for(var a=0;a<e.textTrack.length;a++)if(Lx(t,e.textTrack[a])){o=e.textTrack[a];break}if(e._log("nextSubtitle",o),o)e._emitPlayerSwitch(e.currentText,o),o.list?(e._loadingTrack={},e._updateCurrent(o),e.switchOn(),i(Tx(0))):(e._log("this._loadTrack",o),e._updateCurrent(o),e._loadTrack(o).then((function(r){if(e.addStyles(r),e._loadingTrack.id===o.id||e._loadingTrack.language===r.language)e._loadingTrack={},e._updateCurrent(r),e.switchOn(),i(Tx(0));else{var a=new Ex("check _loadingTrack fail id: ".concat(e._loadingTrack.id," nextSubtitle:").concat(r.id),6,null,t);e.emitError(a),n(a)}})).catch((function(t){e.emitError(t),n(t)})));else{var s=new Ex("The is no subtitle with id:[{".concat(t.id,"}] or language:[").concat(t.language,"]"),4,null,t);e.emitError(s),n(s)}}}))}},{key:"switchExt",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return new Promise((function(i,n){if(t.id||t.language){for(var r=null,o=0;o<e.textTrack.length;o++)if(Lx(t,e.textTrack[o])){r=e.textTrack[o];break}r&&!Lx(r,e.currentText)&&e._loadTrack(r).then((function(t){e.currentExtText=t,i(Tx(0))})).catch((function(t){e.emitError(t)}))}else e.currentExtText=null,i(Tx(0))}))}},{key:"emitError",value:function(e){this.emit(Kx,{type:Kx,error:e})}},{key:"switchOn",value:function(){this._log("switchOn"),this._isOpen=!0,this.show();var e=this.currentText||{},t=e.id,i=e.language;this.emit(Hx,{type:Hx,isOpen:!0,id:t,language:i,texts:[]})}},{key:"switchOff",value:function(){if(this._isOpen=!1,this.hide(),this.currentText){var e=this.currentText,t=e.id,i=e.language;this.emit(jx,{type:jx,id:t,language:i,texts:[],isOpen:!1})}}},{key:"isOpen",get:function(){return this._isOpen}},{key:"_log",value:function(){if(this.config.debugger){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];(e=console).log.apply(e,["[xgSubtitle]"].concat(i))}}},{key:"_loadTrack",value:function(e){var t=this;this._log("_loadTrack",e.language,e);var i=new Sx,n="",r="";if(e.json?(n="json",r=e.json):!e.stringContent||e.url&&0!==e.url.length||(n="string",r=e.stringContent),r)return Rx(r,n).then((function(t){e.format=t.format,e.styles=t.styles,e.list=t.list,i.resolve(e)})).catch((function(e){t.emitError(e),i.reject(e)})),i;var o=e.url;return 0===o.length?(i.resolve(e),i):(xx(o.splice(0,1)[0]).then((function(n){e.format=n.format,e.styles=n.styles,e.list||(e.list=[]),t._pushList(e.list,n.list),o.length>0&&t._loadTrackUrls(e,2),i.resolve(e)})).catch((function(e){t.emitError(e),i.reject(e)})),i)}},{key:"_emitPlayerSwitch",value:function(e,t){e&&"live"===this.config.updateMode&&(e.list=[],e.url=[]);var i=LR({lang:t.language},t);this._log("emit subtile_switch ",t,i),this.player&&"function"==typeof this.player.emit&&this.player.emit("switch_subtitle",i)}},{key:"_loadTrackUrls",value:function(e,t,i){var n=this,r=e.url.length,o=r>t?e.url.splice(0,t):e.url.splice(0,r),a=o.length;this._log("_loadTrackUrls",e.language,r,o.length,a),o.forEach((function(t,r){xx(LR(LR({},t),{},{index:r})).then((function(t){e.format=t.format,e.styles=t.styles,e.list||(e.list=[]),n._pushList(e.list,t.list),a--})).catch((function(e){a--})).finally((function(t){0===a&&(i&&i.resolve(e),n._loadTrackUrls(e,2))}))}))}},{key:"_freshUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{url:""},i=-1;e.url.forEach((function(e,n){e.url===t.url&&(i=n)})),i>-1&&e.url.splice(i,1)}},{key:"_pushList",value:function(e,t){if(!t||0===t.length)return e;var i=t[0].start,n=t[t.length-1].end;if(0===e.length||i>=e[e.length-1].end)t.forEach((function(t){e.push(t)}));else{for(var r=-1,o=0;o<e.length;o++)if(e[o].start>n){r=o;break}r>-1&&t.forEach((function(t,i){e.splice(r+i,0,t)}))}return e}},{key:"_updateCurrent",value:function(e){var t=this;this.currentText=e,this.config.domRender&&this.root&&(["language","id","label"].map((function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")})),this.__remove(this._cids)),this._cids=[],this._gid=-1,this._cid=-1,this._curTexts=[];var i=this._getPlayerCurrentTime();i&&("live"===this.config.updateMode?this._liveUpdate(i):this._update(i))}},{key:"__loadAll",value:function(){var e=this;this.textTrack.forEach((function(t){e._loadTrack(t)}))}},{key:"getDelCid",value:function(e,t){for(var i=[],n=0;n<e.length;n++)t.includes(e[n])||i.push(e[n]);return i}},{key:"getNewCid",value:function(e,t){for(var i=[],n=0;n<t.length;n++)e.includes(t[n])||i.push(t[n]);return i}},{key:"_liveUpdate",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var i=[],n=Ix(e,this.currentText.list,this._gid);if(n>-1&&(i=Px(e,this.currentText.list[n].list,this._cid)),this.__removeByTime(this._curTexts,e),this._log("_liveUpdate",e,n,i,this.currentText.list[0].list[0].start,this.currentText.list[0].list[0].end),i.length>0){var r=function(e,t,i){if(0===e.length||t<0||t>e.length-1)return[];var n=e[t].list;if(0===i.length)return[];var r=n.splice(i[0],i.length);return t>0&&e.splice(0,t),0===n.length&&e.splice(0,1),r}(this.currentText.list,n,i),o=this._curTexts.length,a=o>0?this._curTexts[o-1].index:0;r.forEach((function(e,i){e.index=i+a,t._curTexts.push(e)})),this.__render(r)}this.emit(Vx,this.getUpdateData(this._curTexts,0,this.currentText))}}},{key:"_update",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var i=Ix(e,this.currentText.list,this._gid),n=[];if(i>-1&&(n=Px(e,this.currentText.list[i].list,this._cid)),n.length<1)return this._cids.length>0&&this.config.domRender&&this.__remove(this._cids),this._cids=[],this._curTexts.length>0&&this.emit(Vx,this.getUpdateData([],e,this.currentText)),void(this._curTexts=[]);if(this._cids.join("")!==n.join("")||i!==this._gid){this._gid=i,this._cid=n[0];var r=this.getDelCid(this._cids,n),o=this.getNewCid(this._cids,n);this._cids=n,this.config.domRender&&this.__remove(r);var a=[];o.map((function(e){var n=t.currentText.list[i].list[e];n.index=e,a.push(n)})),this.currentExtText&&o.map((function(e){var n=t.currentText.list[i].list[e];n.index=e,a.push(n)})),this._log("update",a,e),this._curTexts=a,this.emit(Vx,this.getUpdateData(a,e,this.currentText)),this.__render(a,e)}}}},{key:"getUpdateData",value:function(e,t,i){var n=i.id,r=i.language;return{type:Vx,currentTime:0|t,id:n,language:r,texts:e,isOpen:this._isOpen}}},{key:"_getPlayerCurrentTime",value:function(){if(!this.player)return 0;var e=this.player.currentTime;return Ox(1e3*(void 0===e?0:e)+1e3*this.seiTime-1e3*this.lastSeiTime)/1e3}},{key:"_onSubtitlePlaylist",value:function(e){this._log("_onSubtitlePlaylist",e);var t=e.map((function(e){return{label:e.name,language:e.lang,id:e.id,isDefault:e.default,url:[],mUrl:e.url}}));this.setSubTitles(t)}},{key:"_onSubtitleSegment",value:function(e){if(this._log("_onSubtitleSegment",e.length,e[0].lang,e[0].sn,e[e.length-1].sn,e[0].start,e[e.length-1].end),e&&0!==e.length){var t={language:e[0].lang,url:e.map((function(e){return{id:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end}}))};Lx(t,this.currentText)&&this.updateSubTitle(t)}}},{key:"_onCoreSeiintime",value:function(e){try{var t=e.time/1e3;this._log("_onCoreSeiintime sei",t,this.seiTime,this.lastSeiTime),this.seiTime=t,this.lastSeiTime=this.player?this.player.currentTime:0}catch(i){}}},{key:"resize",value:function(e,t){var i,n=this,r=this.config,o=r.baseSizeX,a=r.baseSizeY,s=r.minMobileSize,l=r.minSize,c=r.fitVideo,u=r.offsetBottom,h=this._videoMeta.scale;this._videoMeta.lwidth=e,this._videoMeta.lheight=t;var d=0;t/e*100>=h?(d=Ox(h*e)/100,i=e):(d=t,i=Ox(t/h*100)),this._videoMeta.vWidth=i,this._videoMeta.vHeight=d;var f=0,p=0;p=Ox(h>120?(f=a)*d/1080:(f=o)*i/1920);var g=Zx?s:l,y={fontSize:p=p<g?g:p>f?f:p},v=Ox((t-d)/2),m=Ox((e-i)/2),_=Ox(d*u)/100;this._videoMeta.vBottom=v,this._videoMeta.vLeft=m,this._videoMeta.marginBottom=_,c&&(y.bottom=v+_,y.left=y.right=m),Object.keys(y).map((function(e){n.root.style[e]="".concat(y[e],"px")})),this.emit(Fx,{vLeft:m,vBottom:v,marginBottom:_,vWidth:i,vHeight:d,fontSize:p,scale:h})}},{key:"__startResize",value:function(e){var t=this,i=e.getBoundingClientRect(),n=this._videoMeta,r=i.width,o=i.height;if(this._iId&&(clearTimeout(this._iId),this._iId=null),r>0&&o>0&&(r!==n.lwidth||o!==n.lheight))this._iC=0,this.resize(r,o);else{if(this._iC>=5)return void(this._iC=0);this._iC++,this._iId=setTimeout((function(){t.__startResize(e)}),50)}}},{key:"__removeByTime",value:function(e,t){for(var i=[],n=0;n<e.length;n++)(!t||e[n].end<t)&&i.push(n);0!==i.length&&(e.splice(i[0],i.length),this.config.domRender&&this.__remove(i))}},{key:"__remove",value:function(e){var t=this;if(e&&!(e.length<1)){this._log(">>>>_renderByWords__remove",e);for(var i=this.innerRoot.children,n=[],r=0;r<i.length;r++){var o=Number(i[r].getAttribute("data-index"));e.includes(o)&&n.push(i[r])}n.map((function(e){t.innerRoot.removeChild(e)}))}}},{key:"__render",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._log("__render",t.length,this.config.domRender);var i=this.config,n=i.renderMode,r=i.domRender;t.length>0&&r&&t.forEach((function(t){var i="text-track-".concat(e.config.line);t.text.forEach((function(r,o){o>0&&(i+=" text-track-deputy");var a={"data-start":t.start,"data-end":t.end,"data-index":t.index},s=wx("xg-text-track-span","",a,i);if(e.innerRoot.appendChild(s),"step"===n){var l=wx("xg-text-track-span","",a,"".concat(i," text-track-space"));e.innerRoot.appendChild(l),Xx(l,r),setTimeout((function(){e._renderByWords(s,o,t.start,t.end,r)}),600)}else Xx(s,r)}))}))}},{key:"_renderByWords",value:function(e,t,i,n,r){var o=document.createTextNode("");e.appendChild(o);var a,s,l=function(e){for(var t=e.split(""),i=[],n=!1,r=0;r<t.length;r++){var o=t[r];if(Nx(o))if(n){var a=i.length-1;i[a]="".concat(i[a]).concat(o)}else i.push(o),n=!0;else if(o.match(/^[ ]*$/)||Mx(o)||/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(o)){n=!1;var s=i.length-1;s>=0?i[s]="".concat(i[s]).concat(o):i.push(o)}else n=!1,i.push(o)}return i}((a=r,Xx(s=document.createElement("span"),a),s.textContent||"")),c=this._getPlayerCurrentTime(),u=Ox(1e3*(n-c));if(!(c>=n)){i>=c&&(c=i),u>300&&(u-=50);var h={dom:o,ids:t,wordList:l,interval:u/l.length,start:c,end:n,duration:u,lastTime:0};this._log(">>>>_renderByWords",u,h);for(var d=this._curRenderTask,f=-1,p=0;p<d.length;p++)if(d[p].ids===t){f=p;break}f>-1&&d.slice(f,1),d.push(h),this.startRender(-1)}}},{key:"stopRender",value:function(){this._renderIntervalId&&window.cancelAnimationFrame(this._renderIntervalId)}},{key:"show",value:function(){var e,t;this.config.domRender&&(e=this.root,t="text-track-hide",e&&(e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):Cx(e,t)&&t.split(/\s+/g).forEach((function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===NR(e.className)?e.setAttribute("class",e.getAttribute("class").replace(i," ")):e.className=e.className.replace(i," ")}))))}},{key:"hide",value:function(){this.config.domRender&&(kx(this.root,"text-track-hide"),this.innerRoot&&(this.innerRoot.innerHTML=""))}},{key:"emit",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=XR(jR(i.prototype),"emit",this)).call.apply(n,[this,e,t].concat(o))}},{key:"on",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=XR(jR(i.prototype),"on",this)).call.apply(n,[this,e,t].concat(o))}},{key:"once",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=XR(jR(i.prototype),"once",this)).call.apply(n,[this,e,t].concat(o))}},{key:"off",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];(n=XR(jR(i.prototype),"off",this)).call.apply(n,[this,e,t].concat(o))}},{key:"offAll",value:function(){XR(jR(i.prototype),"removeAllListeners",this).call(this)}},{key:"marginBottom",get:function(){var e=this._videoMeta,t=e.vBottom,i=e.marginBottom;return this.config.fitVideo?t+i:i}}]),i}(Ar);class Jx extends Ar{constructor(e){super(),this._onChange=e=>{const t=this._media.textTracks;if(!t||0===t.length)return;const i=[],n=[];let r=-1;for(let o=0;o<t.length;o++){const e=t[o];"subtitles"===e.kind&&(i.push({id:e.id||e.language,language:e.language,text:e.label,isDefault:"showing"===e.mode}),-1===r&&"showing"===e.mode&&(r=o),n.push(e.language))}n.join("|")!==this._languages?(this._languages=n.join("|"),this.emit("reset",{list:i,isOpen:r>-1})):-1===r?this.emit("off"):this.curIndex!==r&&this.emit("change",i[r]),this.curIndex=r},this._media=e,this._list=[],this._languages="",this.curIndex=-1,this._init()}_init(){const e=this._media.textTracks;e?(e.addEventListener("change",this._onChange),e.addEventListener("addtrack",this._onChange)):as.warn("current browser not support native subtitle")}switch(e){return new Promise(((t,i)=>{if(!e)return i({code:1,message:"no subtitle data"});const n=this._media.textTracks;for(let r=0;r<n.length;r++){const t=n[r];t.language===e.language?t.mode="showing":"showing"===t.mode&&(t.mode="disabled")}return t({code:0})}))}switchOff(){const e=this._media.textTracks;for(let t=0;t<e.length;t++)e[t].mode="disabled";this.curIndex=-1}destroy(){this._media.textTracks.removeEventListener("change",this._onChange),this._media=null,this._list=[],this._languages="",this.curIndex=-1}}function eO(){return(new DOMParser).parseFromString('<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0.5C0.895431 0.5 0 1.39543 0 2.5V13.5C0 14.6046 0.89543 15.5 2 15.5H16C17.1046 15.5 18 14.6046 18 13.5V2.5C18 1.39543 17.1046 0.5 16 0.5H2ZM7.49634 11.0454C8.00741 10.606 8.29061 10.0037 8.34595 9.23877H6.8811C6.84855 9.67171 6.71997 9.99235 6.49536 10.2007C6.27401 10.4058 5.93709 10.5083 5.48462 10.5083C4.98332 10.5083 4.61548 10.3309 4.3811 9.97607C4.14998 9.62126 4.03442 9.05973 4.03442 8.2915V7.75439C4.04093 7.01872 4.16463 6.47673 4.40552 6.12842C4.64966 5.77686 5.01587 5.60107 5.50415 5.60107C5.95337 5.60107 6.28703 5.70524 6.50513 5.91357C6.72648 6.11865 6.85506 6.45068 6.89087 6.90967H8.35571C8.27759 6.1154 7.98787 5.49854 7.48657 5.05908C6.98527 4.61963 6.32446 4.3999 5.50415 4.3999C4.9117 4.3999 4.39087 4.53988 3.94165 4.81982C3.49569 5.09652 3.15226 5.49528 2.91138 6.01611C2.67049 6.53695 2.55005 7.13916 2.55005 7.82275V8.25732C2.55005 9.32829 2.81047 10.1714 3.3313 10.7866C3.85539 11.3986 4.57316 11.7046 5.48462 11.7046C6.31795 11.7046 6.98853 11.4849 7.49634 11.0454ZM14.5393 11.0454C15.0504 10.606 15.3336 10.0037 15.3889 9.23877H13.9241C13.8915 9.67171 13.7629 9.99235 13.5383 10.2007C13.317 10.4058 12.9801 10.5083 12.5276 10.5083C12.0263 10.5083 11.6584 10.3309 11.4241 9.97607C11.193 9.62126 11.0774 9.05973 11.0774 8.2915V7.75439C11.0839 7.01872 11.2076 6.47673 11.4485 6.12842C11.6926 5.77686 12.0588 5.60107 12.5471 5.60107C12.9963 5.60107 13.33 5.70524 13.5481 5.91357C13.7695 6.11865 13.898 6.45068 13.9338 6.90967H15.3987C15.3206 6.1154 15.0308 5.49854 14.5295 5.05908C14.0282 4.61963 13.3674 4.3999 12.5471 4.3999C11.9547 4.3999 11.4338 4.53988 10.9846 4.81982C10.5387 5.09652 10.1952 5.49528 9.95435 6.01611C9.71346 6.53695 9.59302 7.13916 9.59302 7.82275V8.25732C9.59302 9.32829 9.85343 10.1714 10.3743 10.7866C10.8984 11.3986 11.6161 11.7046 12.5276 11.7046C13.3609 11.7046 14.0315 11.4849 14.5393 11.0454Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}function tO(){return(new DOMParser).parseFromString('<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49609 11.0454C8.00716 10.606 8.29037 10.0037 8.3457 9.23877H6.88086C6.84831 9.67171 6.71973 9.99235 6.49512 10.2007C6.27376 10.4058 5.93685 10.5083 5.48438 10.5083C4.98307 10.5083 4.61523 10.3309 4.38086 9.97607C4.14974 9.62126 4.03418 9.05973 4.03418 8.2915V7.75439C4.04069 7.01872 4.16439 6.47673 4.40527 6.12842C4.64941 5.77686 5.01562 5.60107 5.50391 5.60107C5.95312 5.60107 6.28678 5.70524 6.50488 5.91357C6.72624 6.11865 6.85482 6.45068 6.89062 6.90967H8.35547C8.27734 6.1154 7.98763 5.49854 7.48633 5.05908C6.98503 4.61963 6.32422 4.3999 5.50391 4.3999C4.91146 4.3999 4.39062 4.53988 3.94141 4.81982C3.49544 5.09652 3.15202 5.49528 2.91113 6.01611C2.67025 6.53695 2.5498 7.13916 2.5498 7.82275V8.25732C2.5498 9.32829 2.81022 10.1714 3.33105 10.7866C3.85514 11.3986 4.57292 11.7046 5.48438 11.7046C6.31771 11.7046 6.98828 11.4849 7.49609 11.0454Z" fill="white"/>\n<path d="M14.5391 11.0454C15.0501 10.606 15.3333 10.0037 15.3887 9.23877H13.9238C13.8913 9.67171 13.7627 9.99235 13.5381 10.2007C13.3167 10.4058 12.9798 10.5083 12.5273 10.5083C12.026 10.5083 11.6582 10.3309 11.4238 9.97607C11.1927 9.62126 11.0771 9.05973 11.0771 8.2915V7.75439C11.0837 7.01872 11.2074 6.47673 11.4482 6.12842C11.6924 5.77686 12.0586 5.60107 12.5469 5.60107C12.9961 5.60107 13.3298 5.70524 13.5479 5.91357C13.7692 6.11865 13.8978 6.45068 13.9336 6.90967H15.3984C15.3203 6.1154 15.0306 5.49854 14.5293 5.05908C14.028 4.61963 13.3672 4.3999 12.5469 4.3999C11.9544 4.3999 11.4336 4.53988 10.9844 4.81982C10.5384 5.09652 10.195 5.49528 9.9541 6.01611C9.71322 6.53695 9.59277 7.13916 9.59277 7.82275V8.25732C9.59277 9.32829 9.85319 10.1714 10.374 10.7866C10.8981 11.3986 11.6159 11.7046 12.5273 11.7046C13.3607 11.7046 14.0312 11.4849 14.5391 11.0454Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.5C0 1.39543 0.895431 0.5 2 0.5H16C17.1046 0.5 18 1.39543 18 2.5V13.5C18 14.6046 17.1046 15.5 16 15.5H2C0.89543 15.5 0 14.6046 0 13.5V2.5ZM2 2.3H16C16.1105 2.3 16.2 2.38954 16.2 2.5V13.5C16.2 13.6105 16.1105 13.7 16 13.7H2C1.88954 13.7 1.8 13.6105 1.8 13.5V2.5C1.8 2.38954 1.88954 2.3 2 2.3Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:iO}=ba,nO="mobile"===Vr.device,rO="text-close";function oO(e=[]){let t=-1;return e.map(((e,i)=>{e.id||e.language||(e.id=""+i),!e.url&&(e.url=e.src),!e.text&&(e.text=e.label),!e.language&&(e.language=e.srclang),void 0===e.isDefault&&(e.isDefault=e.default),(e.isDefault||e.default)&&(t<0?t=i:e.isDefault=e.default=!1)})),t}class aO extends ba{constructor(e){super(e),this.isOpenState=!0,this.optionList=null,this.currentLang="",this._onOff=()=>{this.noShowSubtitle()},this._onChange=e=>{const t=this.getSubTitleIndex(this.config.list,e);t<0||this.updateCurItem(t,e)},this._onListReset=e=>{this.updateList(e)},this.handleButtonChange=e=>{e.preventDefault(),e.stopPropagation(),e.delegateTarget||(nO?this.showMobilePanel():this.isOpenState?this.switchOffSubtitle():this.openSubtitle().then((()=>this.showList())))},this.onEnter=e=>{e.stopPropagation(),this.emit("icon_mouseenter",{pluginName:this.pluginName}),this.showList()},this.onLeave=e=>{e.stopPropagation(),this.emit("icon_mouseleave",{pluginName:this.pluginName}),this.hideList()},this.handlerClickSwitch=(e,t)=>{e.stopPropagation(),e.preventDefault(),this.subTitles&&(t.type===rO?this.switchOffSubtitle():this.switchSubTitle({language:t.language,id:t.id}))},this.onPlayerFocus=e=>{this.subTitles&&this.config.style.follow&&this.rePosition()},this.onPlayerBlur=e=>{this.subTitles&&this.config.style.follow&&!this.playerConfig.marginControls&&this.subTitles.root&&(this.subTitles.root.style.transform="translate(0, 0)")};const{player:t,config:i}=e;t.config.isLive&&(e.config.updateMode="live",Vr.os.isIos&&(e.config.mode="native"))}static get pluginName(){return"Subtitle"}static get defaultConfig(){return{position:iO.CONTROLS_RIGHT,index:jA,list:[],isDefaultOpen:!0,style:{follow:!0,mode:"stroke",followBottom:50,fitVideo:!0,offsetBottom:4,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,line:"double",fontColor:"#fff"},isShowIcon:!0,mode:"external",updateMode:"vod"}}afterCreate(){const{list:e=[]}=this.config;this.curIndex=-1,this.curItem=null;const t=oO(e);super.afterCreate(),"native"===this.config.mode?this._initNativeSubtitle(t):this._initExtSubTitle(t),e.length||this.hide()}_initNativeSubtitle(e){const{player:t}=this;t._subTitles||(t._subTitles=new Jx(t.video)),this.subTitles=t._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("reset",this._onListReset),this._renderList(e)}_initExtSubTitle(e){const{list:t=[],style:i,isDefaultOpen:n,updateMode:r,renderMode:o}=this.config,a={subTitles:t,defaultOpen:n,debugger:!1,renderMode:o,updateMode:r};this.isOpenState=n,Object.keys(i).map((e=>{a[e]=i[e]}));!this.playerConfig.marginControls&&this.player.controls.root&&(this.on(uo,this.onPlayerFocus),this.on(ho,this.onPlayerBlur));const{player:s}=this;s._subTitles?s._subTitles._isOpen&&(e=this.getSubTitleIndex(this.config.list,s._subTitles.currentText)):(s._subTitles=new Qx(a),s._subTitles.attachPlayer(this.player),this.changeTipText()),this.subTitles=s._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("reset",this._onListReset),i.follow&&this.subTitles.root&&Mr.addClass(this.subTitles.root,"follow-control"),this._renderList(e)}_renderList(e){const{list:t=[],isDefaultOpen:i}=this.config;t.length&&(e<0?(t[0].isDefault=!0,this.curIndex=0,this.curItem=t[0]):(this.curIndex=e,this.curItem=t[e])),this.appendChild(".xgplayer-icon",this.icons.vttSubOpen),this.appendChild(".xgplayer-icon",this.icons.vttSubClose),this.creatOptionList(),this.initEvents(),this.isOpenState?Mr.addClass(this.root,"isOpen"):Mr.addClass(this.root,"isClose"),!1===this.config.isShowIcon&&this.hide()}updateCurItem(e,t){this.curIndex=e,this.curItem=this.config.list[e],this.renderItemList(),this.emit("subtitle_change",c({off:!1,isListUpdate:!1,list:[]},t))}initEvents(){this.bind(["click"],this.handleButtonChange),this.bind(["mouseenter"],this.onEnter),this.bind(["mouseleave"],this.onLeave),this._delegates=[]}showList(){var e;!nO&&this.isOpenState&&(null==(e=this.optionList)||e.show())}hideList(){var e;!nO&&this.isOpenState&&(null==(e=this.optionList)||e.hide())}openSubtitle(){return this.curIndex<0&&(this.curIndex=0,this.curItem=this.config.list[0]),this.curIndex>-1&&this.curItem?this.switchSubTitle(this.curItem):Promise.resolve(void 0)}getSubTitleIndex(e,t={id:"",language:""}){let i=-1;return t&&(t.id||t.language)?(e.forEach(((e,n)=>{e.id!==t.id&&e.language!==t.language||(i=n)})),i):i}registerIcons(){return{vttSubOpen:{icon:eO,class:"xgplayer-vttsub-open-svg"},vttSubClose:{icon:tO,class:"xgplayer-vttsub-close-svg"}}}registerLanguageTexts(){return{sub:{jp:"字幕",en:"Subtitles",zh:"字幕","zh-hk":"字幕"},subOpen:{jp:"字幕をオンにする",en:"Show subtitles",zh:"开启字幕","zh-hk":"開啟字幕"},subClose:{jp:"クローズドキャプション",en:"Hide subtitles",zh:"关闭字幕","zh-hk":"關閉字幕"}}}creatOptionList(){if(nO)return;const e={config:{data:this.getList(),className:"",onItemClick:(e,t)=>{this.handlerClickSwitch(e,null==t?void 0:t.to)}},root:this.root};this.optionList=new kA(e)}getList(){return this.config.list.map(((e,t)=>(t===this.curIndex&&this.isOpenState?(e.isCurrent=!0,e.selected=!0):(e.isCurrent=!1,e.selected=!1),e.showText=this.getTextByLang(e),e)))}renderOptionList(){this.optionList.renderItemList(this.getList())}switchSubTitle(e={id:"",language:""}){let t=-1;return e&&(e.id||e.language)?(this.config.list.map(((i,n)=>{i.id+""==e.id+""&&i.language+""==e.language+""&&(t=n)})),t<0||this.isOpenState&&t===this.curIndex?Promise.resolve(void 0):this.subTitles.switch(e).then((i=>{0===i.code&&(e.off=!1,e.isListUpdate=!1,e.list=[],this.curIndex=t,this.curItem=this.config.list[t],this.isOpenState=!0,Mr.removeClass(this.root,"isClose"),Mr.addClass(this.root,"isOpen"),this.renderItemList(),this.changeTipText(),this.emit("subtitle_change",e))})).catch((e=>as.error("switch subtitle err: ",e)))):Promise.resolve(void 0)}switchOffSubtitle(){this.subTitles.switchOff(),this.noShowSubtitle()}noShowSubtitle(){var e;this.emit("subtitle_change",{off:!0,isListUpdate:!1,list:[]}),this.isOpenState=!1,Mr.addClass(this.root,"isClose"),Mr.removeClass(this.root,"isOpen"),this.renderItemList(),this.changeTipText(),null==(e=this.optionList)||e.hide()}renderItemList(){nO?this.updatePanel():this.renderOptionList()}updateSubtitles(e=[],t=!0){if(!e)return;const i=this.curIndex>-1||this.config.isDefaultOpen;this.updateList({list:e,isOpen:i}),this.subTitles&&this.subTitles.setSubTitles(this.config.list,i,t)}updateList(e={}){var t,i,n,r;if(!e.list)return;e.list.length>0&&!1!==this.config.isShowIcon&&this.show();const o=[];e.list.map((e=>{o.push(e)}));const a=oO(o);e.isOpen?(this.isOpenState=!0,this.curIndex=a,this.curItem=a>-1?o[a]:null,Mr.removeClass(this.root,"isClose"),Mr.addClass(this.root,"isOpen")):(this.isOpenState=!1,this.curIndex=-1,this.curItem=null,Mr.removeClass(this.root,"isOpen"),Mr.addClass(this.root,"isClose"),this.changeTipText(),null==(t=this.optionList)||t.hide()),this.config.list=o,o.length>0?nO||null==(i=this.optionList)||i.hide():(this.switchOffSubtitle(),nO?this.showMobilePanel():null==(n=this.optionList)||n.show(),nO||null==(r=this.optionList)||r.hide(),this.hide()),this.renderItemList()}changeTipText(){this.isOpenState?this.find(".xg-tips").innerHTML=this.langText.subClose:this.find(".xg-tips").innerHTML=this.langText.subOpen}showMobilePanel(){var e;const t=this.renderPanel();null==(e=this.player.panel)||e.showPanel(t,this.langText.sub,!0)}updatePanel(){var e;const t=this.renderPanel();null==(e=this.player.panel)||e.updatePanel(t)}renderPanel(){const e=[...this.config.list],t=Mr.createDom("div","",{},"ai-panel-content");e.map(((e,i)=>{const n=c({language:e.language||e.srclang,"data-id":e.id,selected:this.isOpenState&&this.curIndex===i,showText:this.getTextByLang(e)},e),r=this.renderPanelItem(n);t.appendChild(r)}));const i={showText:this.langText.subClose,"data-type":rO,selected:!this.isOpenState};return t.appendChild(this.renderPanelItem(i)),t}renderPanelItem(e){const{showText:t,selected:i}=e,n=Mr.createDom("div","",{language:e.language,"data-id":e["data-id"],"data-type":e["data-type"]},"panel-Item "+(i?"select-in":""));n.innerHTML=t;const r=nO?"touchend":"click",o=ba.delegate(n,".panel-Item",r,(t=>{e["data-type"]===rO?(t.stopPropagation(),t.preventDefault(),this.switchOffSubtitle()):this.handlerClickSwitch(t,e)}));return this._delegates.push(o),n}getTextByLang(e,t,i){if(void 0===e)return"";const{list:n}=this.config;return!i&&(i=this.player.lang),t=!t||Mr.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]),"object"==typeof e[t]?e[t][i]||e[t].zh:e[t]||""}rePosition(){const{fitVideo:e}=this.config.style,t=0-this.player.controls.root.getBoundingClientRect().height;if(!e)return void(this.subTitles.root.style.transform=`translate(0, ${t}px)`);const{video:i,root:n}=this.player,{height:r,width:o}=n.getBoundingClientRect(),{videoHeight:a,videoWidth:s}=i;let l=parseInt(a/s*100,10)*o/100;l>r&&(l=r);const c=(r-l)/2-t;c<0&&(this.subTitles.root.style.transform=`translate(0, ${c}px)`)}destroy(){var e;this.subTitles&&(this.subTitles.destroy(),this.subTitles=null),this.unbind(["click"],this.handleButtonChange.bind(this)),this.unbind(["mouseenter"],this.showList.bind(this)),this.unbind(["mouseleave"],this.hideList.bind(this)),null==(e=this.optionList)||e.destroy(),this._delegates&&this._delegates.length>0&&(this._delegates.map((e=>{Array.isArray(e)&&e.map((e=>{e.destroy&&e.destroy()})),e.destroy&&e.destroy()})),this._delegates=null),super.destroy()}render(){var e;return`\n <xg-icon class="xgplayer-vttsub"${!1===this.config.isShowIcon||!(null==(e=this.config.list)?void 0:e.length)?' style="display: none;"':""}>\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="vttSubOpen">${this.langText.subOpen}</div>\n </xg-icon>\n `}}const sO=class extends ba{constructor(e){super(e),this.toastNumber=0,this.toastMaps={}}static get pluginName(){return"sdkToastPlugin"}static get defaultConfig(){return{index:5}}beforePlayerInit(){}afterPlayerInit(){}afterCreate(){}destroy(){}add(e,t=2e3,i=!1){const n=this.toastNumber+1;this.toastNumber=n;const r=this.renderToast(e,i,n);return this.root.appendChild(r),this.toastMaps[n]=r,t&&setTimeout((()=>{this.remove(n)}),t),n}remove(e){const t=this.toastMaps[e];t&&(this.root.contains(t)&&this.root.removeChild(t),delete this.toastMaps[e])}renderToast(e,t,i){const n=Mr.createDom("div","",void 0,"toast-container"),r=Mr.checkIsObject(e)?e:Mr.createDom("div",e,void 0,"toast-txt");if(n.appendChild(r),t){const e=Mr.createDom("span","×",void 0,"toast-close-bt");e.addEventListener("click",(()=>{this.remove(i)})),n.appendChild(e)}return n}render(){return'<xg-sdk-toast class="xgplayer-sdk-toast"></xg-sdk-toast>'}};function lO(){return(new Date).getTime()}var cO="loadstart",uO="loadeddata",hO="firstFrame",dO="waitingStart",fO="waitingEnd",pO="seekStart",gO="seekEnd",yO=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"_onTimeupdate",(function(){e._state.isTimeUpdate=!0,e._state.autoplayStart&&(Lr.logInfo("[xgLogger]".concat(e.player.playerId," _onTimeupdate")),e._sendFF("onTimeupdate"))})),vr(Tr(e),"_onAutoplayStart",(function(){Lr.logInfo("[xgLogger]".concat(e.player.playerId," _onAutoplayStart")),e._state.autoplayStart=!0,e.vt&&e._sendFF("onAutoplayStart")})),vr(Tr(e),"_onReset",(function(){e._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},e.vt=0,e.pt=0,e.fvt=0,e.newPointTime=lO(),e.loadedCostTime=0,e.startCostTime=0,e._isSeeking=!1,e.seekingStart=0,e.waitingStart=0,e.fixedWaitingStart=0,e._isWaiting=!1,e._waitTimer&&Mr.clearTimeout(Tr(e),e._waitTimer),e._waittTimer&&Mr.clearTimeout(Tr(e),e._waittTimer),e._waitTimer=null,e._waittTimer=null,e._waitType=0})),vr(Tr(e),"_onSeeking",(function(){e.seekingStart||(e.suspendWaitingStatus("seek"),e.seekingStart=lO(),e.emitLog(pO,{start:lO()}))})),vr(Tr(e),"_onSeeked",(function(){e.suspendSeekingStatus("seeked")})),vr(Tr(e),"_onWaitingLoadStart",(function(){e._isWaiting||e.vt||(e._isWaiting=!0,e.waitingStart=lO(),e.fixedWaitingStart=lO(),e._waitType=1,e.emitLog(dO,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:1,endType:"loadstart"}))})),vr(Tr(e),"_onWaiting",(function(){!e._isWaiting&&e.vt&&(e._isWaiting=!0,e.vt?e.seekingStart?e._waitType=2:e._waitType=0:e._waitType=1,e.fixedWaitingStart=lO(),e._waitTimer=Mr.setTimeout(Tr(e),(function(){e._isWaiting&&(e.waitingStart=lO(),Mr.clearTimeout(Tr(e),e._waitTimer),e._waitTimer=null,e._startWaitTimeout(),e.emitLog(dO,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:e._waitType,endType:2===e._waitType?"seek":"playing"}))}),200))})),vr(Tr(e),"_onError",(function(){e.suspendSeekingStatus("error"),e.suspendWaitingStatus("error")})),vr(Tr(e),"_onPlaying",(function(){e._isWaiting&&e.suspendWaitingStatus("playing")})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=lO(),this.loadedCostTime=0,this.startCostTime=0,this.on(lo,(function(){var t=e._state,i=t.autoplayStart,n=t.isFFSend;e.startCostTime=lO()-e.newPointTime,Lr.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),"autoplayStart:".concat(i," isFFSend:").concat(n," startCostTime:").concat(e.startCostTime," newPointTime").concat(e.newPointTime)),n||(!t.isLs&&e.emitLog(cO,{}),t.isLs=!0,t.isTimeUpdate=!1,t.isFFLoading=!0,e.pt=lO(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())})),this.on(oo,(function(){e.vt=lO(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var t=e._state,i=t.isTimeUpdate,n=t.isFFSend,r=t.autoplayStart;Lr.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),"fvt:".concat(e.fvt," isTimeUpdate:").concat(e._state.isTimeUpdate," loadedCostTime:").concat(e.loadedCostTime)),(i||r)&&e._sendFF("loadedData"),n||e.emitLog(uO,{}),e.suspendWaitingStatus("loadeddata")})),this.on(Qr,this._onSeeking),this.on(Jr,this._onSeeked),this.on(_o,(function(){e.endState("destroy")})),this.on(Eo,(function(){e.endState("urlChange"),Lr.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()})),this.on([$r,io],this._onPlaying),this.on(to,this._onWaiting),this.on(Zr,this._onError),this.on(Bo,(function(){Lr.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()}))}},{key:"_initOnceEvents",value:function(){this.off(go,this._onAutoplayStart),this.off(eo,this._onTimeupdate),this.once(go,this._onAutoplayStart),this.once(eo,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=lO();var t=this._state,i=t.isFFLoading,n=t.isFFSend;Lr.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(i," !isFFSend:").concat(!n)),this.vt>0&&i&&!n&&(Lr.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(hO,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&Mr.clearTimeout(this,this._waittTimer),this._waittTimer=Mr.setTimeout(this,(function(){e.suspendWaitingStatus("timeout"),Mr.clearTimeout(e,e._waittTimer),e._waittTimer=null}),this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var t=lO(),i=t-this.seekingStart;this.seekingStart=0,this.emitLog(gO,{end:t,costTime:i,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(Mr.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(Mr.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,this.waitingStart){var t=lO(),i=t-this.waitingStart,n=t-this.fixedWaitingStart,r=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(fO,{fixedCostTime:n>r?r:n,costTime:i>r?r:i,type:"loadeddata"===e?1:this._waitType,endType:2===this._waitType?"seek":e})}}},{key:"emitLog",value:function(e,t){var i=this.player;this.emit(Mo,dr({t:lO(),host:Mr.getHostFromUrl(i.currentSrc),vtype:i.vtype,eventType:e,currentTime:this.player.currentTime,readyState:i.video.readyState,networkState:i.video.networkState},t))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),i}(ba);function vO(){return(new DOMParser).parseFromString('<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">\n <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var mO=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"registerIcons",value:function(){return{replay:vO}}},{key:"afterCreate",value:function(){var e=this;ba.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",(function(){e.player.replay()}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(Xr,(function(){if(e.playerConfig.loop||Mr.addClass(e.player.root,"replay"),!e.config.disable){e.show();var t=e.root.querySelector("path");if(t){var i=window.getComputedStyle(t).getPropertyValue("transform");if("string"==typeof i&&i.indexOf("none")>-1)return null;t.setAttribute("transform",i)}}})),this.on(zr,(function(){e.hide()}))}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),Mr.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return'<xg-replay class="xgplayer-replay">\n <xg-replay-txt class="xgplayer-replay-txt" lang-key="'.concat(this.i18nKeys.REPLAY,'">').concat(this.i18n.REPLAY,"</xg-replay-txt>\n </xg-replay>")}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),i}(ba);function _O(){return(new DOMParser).parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n',"image/svg+xml").firstChild}function EO(){return(new DOMParser).parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n',"image/svg+xml").firstChild}var TO={};function bO(e){e?window.clearTimeout(e):Object.keys(TO).map((function(e){window.clearTimeout(TO[e].id),delete TO[e]}))}var SO=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"onPlayerReset",(function(){n.autoPlayStart=!1;var e="auto"===n.config.mode?"auto-hide":"hide";n.setAttr("data-state","play"),Mr.removeClass(n.root,e),n.show()})),vr(Tr(n),"onAutoplayStart",(function(){if(!n.autoPlayStart){var e="auto"===n.config.mode?"auto-hide":"hide";Mr.addClass(n.root,e),n.autoPlayStart=!0,n.toggleTo("play")}})),n.autoPlayStart=!1,n}return yr(i,[{key:"afterCreate",value:function(){var e=this.playerConfig;this.initIcons(),this.listenEvents(),this.bindClickEvents(),e.autoplay||this.show()}},{key:"listenEvents",value:function(){var e=this,t=this.player,i=this.playerConfig;this.once(fo,(function(){i&&(i.lang&&"en"===i.lang?Mr.addClass(t.root,"lang-is-en"):"jp"===i.lang&&Mr.addClass(t.root,"lang-is-jp"))})),this.on(go,this.onAutoplayStart),this.on(yo,(function(){var t="auto"===e.config.mode?"auto-hide":"hide";e.setAttr("data-state","play"),Mr.removeClass(e.root,t),e.show()})),this.on(zr,(function(){e.toggleTo("play")})),this.on(qr,(function(){e.toggleTo("pause")})),this.on(Bo,(function(){e.onPlayerReset()}))}},{key:"bindClickEvents",value:function(){var e=this;this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(t){t.cancelable&&t.preventDefault(),t.stopPropagation();var i=e.player.paused;e.emitUserAction(t,"switch_play_pause",{props:"paused",from:i,to:!i})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:_O,class:"xg-icon-play"},startPause:{icon:EO,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){Mr.addClass(this.root,"hide")}},{key:"show",value:function(e){Mr.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){Mr.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){Mr.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var t=this;this._animateId=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{start:null,end:null};return TO[e]&&window.clearTimeout(TO[e].id),TO[e]={},i.start&&i.start(),TO[e].id=window.setTimeout((function(){i.end&&i.end(),window.clearTimeout(TO[e].id),delete TO[e]}),t),TO[e].id}("pauseplay",400,{start:function(){Mr.addClass(t.root,"interact"),t.show(),t.switchStatus(!0)},end:function(){Mr.removeClass(t.root,"interact"),!e&&t.hide(),t._animateId=null}})}},{key:"endAnimate",value:function(){Mr.removeClass(this.root,"interact"),bO(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var t=this.player;(e.cancelable&&e.preventDefault(),e.stopPropagation(),t.state<La.READY)||(this.player.paused||t.state!==La.RUNNING?t.play():t.pause())}},{key:"onPlayPause",value:function(e){this.toggleTo(e)}},{key:"toggleTo",value:function(e){var t=this.config,i=this.player;if(i&&!(i.state<La.RUNNING)&&this.autoPlayStart){if("show"===t.mode)return this.switchStatus(),void this.show();if("auto"!==t.mode){if(t.isShowPause&&i.paused&&!i.ended||t.isShowEnd&&i.ended)return this.switchStatus(),this.show(),void this.endAnimate();if(t.disableAnimate)return this.switchStatus(),void this.hide();if("play"===e)this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||i.ended)return;this.animate()}}else this.switchStatus()}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),bO(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?"auto"===this.config.mode?"auto-hide":"hide":"";return'\n <xg-start class="xgplayer-start '.concat(e,'">\n <xg-start-inner></xg-start-inner>\n </xg-start>')}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),i}(ba),CO=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"render",value:function(){var e=this.config.innerHtml,t=Mr.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)t.appendChild(e);else if(e&&"string"==typeof e)t.innerHTML=e;else{for(var i="",n=1;n<=12;n++)i+='<div class="xgplayer-enter-bar'.concat(n,'"></div>');t.innerHTML='<div class="xgplayer-enter-spinner">'.concat(i,"</div>")}return t}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),i}(ba);function kO(e,t,i){try{return' <div class="xg-tips '.concat(i?"hide":" ",'" lang-key="').concat(e.i18nKeys[t],'">\n ').concat(e.i18n[t],"\n </div>")}catch(n){return'<div class="xg-tips hide"></div>'}}var IO=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"afterCreate",value:function(){this.getMini=this.getMini.bind(this),this.exitMini=this.exitMini.bind(this),this.bind("click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e="MINISCREEN";return'\n <xg-icon class="xgplayer-miniicon">\n <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[e],'">').concat(this.i18n[e],"</span></div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:10}}}]),i}(ba);function PO(e){var t=parseFloat(e);return-1===e.indexOf("%")&&!Number.isNaN(t)&&t}var DO=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],wO=DO.length;function AO(e){if("string"==typeof e&&(e=document.querySelector(e)),e&&"object"===fr(e)&&e.nodeType){var t=function(e){return window.getComputedStyle(e)}(e);if("none"===t.display)return function(){for(var e={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},t=0;t<wO;t++)e[DO[t]]=0;return e}();var i={};i.width=e.offsetWidth,i.height=e.offsetHeight;for(var n=i.isBorderBox="border-box"===t.boxSizing,r=0;r<wO;r++){var o=DO[r],a=t[o],s=parseFloat(a);i[o]=Number.isNaN(s)?0:s}var l=i.paddingLeft+i.paddingRight,c=i.paddingTop+i.paddingBottom,u=i.marginLeft+i.marginRight,h=i.marginTop+i.marginBottom,d=i.borderLeftWidth+i.borderRightWidth,f=i.borderTopWidth+i.borderBottomWidth,p=n,g=PO(t.width);!1!==g&&(i.width=g+(p?0:l+d));var y=PO(t.height);return!1!==y&&(i.height=y+(p?0:c+f)),i.innerWidth=i.width-(l+d),i.innerHeight=i.height-(c+f),i.outerWidth=i.width+u,i.outerHeight=i.height+h,i}}function RO(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n.identifier===t)return n}}var xO="dragStart",OO="dragMove",LO="dragEnded",NO={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},MO=function(e){mr(i,e);var t=Sr(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return pr(this,i),(n=t.call(this)).isEnabled=!0,n.isDragging=!1,n.isDown=!1,n.position={},n.downPoint={},n.dragPoint={x:0,y:0},n.startPos={x:0,y:0},n._root=e instanceof Element?e:document.querySelector(e),n._handlerDom=r.handle instanceof Element?r.handle:document.querySelector(r.handle),n._root&&n._handlerDom?(n._bindStartEvent(),n):br(n)}return yr(i,[{key:"_bindStartEvent",value:function(){var e=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),NO[this._startKey].map((function(t){e["on".concat(t)]=e["on".concat(t)].bind(e)}))}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var t=this;if(e){var i=NO[this._startKey];i.map((function(e){window.addEventListener(e,t["on".concat(e)])})),this._boundPointerEvents=i}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map((function(t){window.removeEventListener(t,e["on".concat(t)])})),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame((function(){e.animate()})))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var t=e.changedTouches[0];this.dragStart(e,t),this.touchIdentifier=void 0!==t.pointerId?t.pointerId:t.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var t=RO(e.changedTouches,this.touchIdentifier);t&&this.dragMove(e,t)}},{key:"ontouchend",value:function(e){var t=RO(e.changedTouches,this.touchIdentifier);t&&this.dragEnd(e,t),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var t=RO(e.changedTouches,this.touchIdentifier);t&&this.dragCancel(e,t)}},{key:"dragStart",value:function(e,t){if(this._root&&!this.isDown&&this.isEnabled){this.downPoint=t,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var i=AO(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-i.height,this.startPos.maxX=window.innerWidth-i.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,t){this.isDragging=!0,this.animate(),this.emit(xO,this.startPos)}},{key:"dragEnd",value:function(e,t){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(LO)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,t){var i={x:t.pageX-this.downPoint.pageX,y:t.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(i)&&this.dragRealStart(e,t),i}},{key:"dragMove",value:function(e,t){if(e=e||window.event,this.isDown){var i=this.startPos,n=i.x,r=i.y,o=this._dragPointerMove(e,t),a=o.x,s=o.y;a=this.checkContain("x",a,n),s=this.checkContain("y",s,r),this.position.x=n+a,this.position.y=r+s,this.dragPoint.x=a,this.dragPoint.y=s,this.emit(OO,this.position)}}},{key:"dragCancel",value:function(e,t){this.dragEnd(e,t)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,t,i){return t+i<0?0-i:"x"===e&&t+i>this.startPos.maxX?this.startPos.maxX-i:"y"===e&&t+i>this.startPos.maxY?this.startPos.maxY-i:t}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),t=this._getPositionCoord(e.left,"width"),i=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(t)?0:t,this.position.y=Number.isNaN(i)?0:i,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var t=e.transform;if(0===t.indexOf("matrix")){var i=t.split(","),n=0===t.indexOf("matrix3d")?12:4,r=parseInt(i[n],10),o=parseInt(i[n+1],10);this.position.x+=r,this.position.y+=o}}},{key:"_getPositionCoord",value:function(e,t){if(-1!==e.indexOf("%")){var i=AO(this._root.parentNode);return i?parseFloat(e)/100*i[t]:0}return parseInt(e,10)}}]),i}(Ar),UO=function(e){mr(i,e);var t=Sr(i);function i(e){var n;pr(this,i),vr(Tr(n=t.call(this,e)),"onCancelClick",(function(e){n.exitMini(),n.isClose=!0})),vr(Tr(n),"onCenterClick",(function(e){var t=Tr(n).player;t.paused?t.play():t.pause()})),vr(Tr(n),"onScroll",(function(e){if(!(!window.scrollY&&0!==window.scrollY||Math.abs(window.scrollY-n.pos.scrollY)<50)){var t=parseInt(Mr.getCss(n.player.root,"height"));t+=n.config.scrollTop,n.pos.scrollY=window.scrollY,window.scrollY>t+5?!n.isMini&&!n.isClose&&n.getMini():window.scrollY<=t&&(n.isMini&&n.exitMini(),n.isClose=!1)}})),n.isMini=!1,n.isClose=!1;var r=Tr(n).config;return n.pos={left:r.left<0?window.innerWidth-r.width-20:r.left,top:r.top<0?window.innerHeight-r.height-20:r.top,height:n.config.height,width:n.config.width,scrollY:window.scrollY||0},n.lastStyle=null,n}return yr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.mini&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(qr,(function(){e.setAttr("data-state","pause")})),this.on(zr,(function(){e.setAttr("data-state","play")}))}},{key:"onPluginsReady",value:function(){var e=this,t=this.player;if(!this.config.disable){if(this.config.isShowIcon){var i={config:{onClick:function(){e.getMini()}}};t.controls.registerPlugin(IO,i,IO.pluginName)}var n=Mr.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",n,this.onCancelClick),this.bind(".play-icon",n,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new MO(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:_O,class:"xg-icon-play"},pause:{icon:EO,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e=this;if(!this.isMini){var t=this.player,i=this.playerConfig,n=this.config.target||this.player.root;this.lastStyle={},Mr.addClass(t.root,"xgplayer-mini"),["width","height","top","left"].map((function(t){e.lastStyle[t]=n.style[t],n.style[t]="".concat(e.pos[t],"px")})),i.fluid&&(n.style["padding-top"]=""),this.emit(Po,!0),t.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var t=this.player,i=this.playerConfig,n=this.config.target||this.player.root;Mr.removeClass(t.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map((function(t){n.style[t]=e.lastStyle[t]})),this.lastStyle=null,i.fluid&&(t.root.style.width="100%",t.root.style.height="0",t.root.style["padding-top"]="".concat(100*i.height/i.width,"%")),this.emit(Po,!1),this.isMini=t.isMini=!1}},{key:"updatePos",value:function(e){this.pos=Object.assign(this.pos,e),this.isMini&&(this.player.root.style.left="".concat(this.pos.left,"px"),this.player.root.style.top="".concat(this.pos.top,"px"),this.player.root.style.width="".concat(this.pos.width,"px"),this.player.root.style.height="".concat(this.pos.height,"px"))}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=Mr.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-mini-layer class="xg-mini-layer">\n <xg-mini-header class="xgplayer-mini-header">\n '.concat(kO(this,"MINI_DRAG",this.playerConfig.isHideTips),'\n </xg-mini-header>\n <div class="mini-cancel-btn">\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">\n <path fill="#fff" fill-rule="evenodd" d="M3.99 3.49a1 1 0 0 1 1.414 0L10 8.085l4.596-4.595a1 1 0 1 1 1.414 1.414L11.414 9.5l4.596 4.596a1 1 0 0 1 .084 1.32l-.084.094a1 1 0 0 1-1.414 0L10 10.914 5.404 15.51a1 1 0 0 1-1.414-1.414L8.585 9.5 3.99 4.904a1 1 0 0 1-.084-1.32z"></path>\n </svg>\n </div>\n <div class="play-icon">\n </div>\n </xg-mini-layer>')}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),i}(ba),BO={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},FO=["videoClick","videoDbClick"],HO=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onMouseMove",(function(t){var i=Tr(e),n=i.player,r=i.playerConfig;n.isActive||(n.focus({autoHide:!r.closeDelayBlur}),!r.closeFocusVideoFocus&&n.media.focus())})),vr(Tr(e),"onMouseEnter",(function(t){var i=Tr(e),n=i.playerConfig,r=i.player;!n.closeFocusVideoFocus&&r.media.focus(),n.closeDelayBlur?r.focus({autoHide:!1}):r.focus(),e.emit(So)})),vr(Tr(e),"onMouseLeave",(function(t){var i=e.playerConfig,n=i.closePlayerBlur,r=i.leavePlayerTime,o=i.closeDelayBlur;n||o||(r?e.player.focus({autoHide:!0,delay:r}):e.player.blur({ignorePaused:!0})),e.emit(bo)})),vr(Tr(e),"onVideoClick",(function(t){var i=Tr(e),n=i.player,r=i.playerConfig;t.target&&r.closeVideoClick||t.target!==n.root&&t.target!==n.media&&t.target!==n.innerContainer&&t.target!==n.media.__canvas||(t.preventDefault(),r.closeVideoStopPropagation||t.stopPropagation(),e._clickCount++,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),e.clickTimer=setTimeout((function(){e._clickCount&&(e._clickCount--,sa(Tr(e),FO[0],(function(t,i){e.switchPlayPause(i.e)}),{e:t,paused:n.paused}),clearTimeout(e.clickTimer),e.clickTimer=null)}),300))})),vr(Tr(e),"onVideoDblClick",(function(t){var i=Tr(e),n=i.player,r=i.playerConfig;r.closeVideoDblclick||!t.target||t.target!==n.media&&t.target!==n.media.__canvas||(!r.closeVideoClick&&e._clickCount<2?e._clickCount=0:(e._clickCount=0,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),t.preventDefault(),t.stopPropagation(),sa(Tr(e),FO[1],(function(t,i){e.emitUserAction(i.e,"switch_fullscreen",{props:"fullscreen",from:n.fullscreen,to:!n.fullscreen}),n.fullscreen?n.exitFullscreen():n.getFullscreen()}),{e:t,fullscreen:n.fullscreen})))})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,FO.map((function(t){e.__hooks[t]=null})),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===Vr.device&&!Vr.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,t=this.player,i=t.media,n=t.root,r=this.playerConfig.enableContextmenu;n&&n.addEventListener("click",this.onVideoClick,!1),n&&n.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(BO).map((function(t){n.addEventListener(t,e[BO[t]],!1)})),!r&&i&&i.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var t=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:t.paused,to:!t.paused}),t.ended?t.duration!==1/0&&t.duration>0&&t.replay():t.paused?t.play():t.pause()}},{key:"onContextmenu",value:function(e){(e=e||window.event).preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,t=this.player,i=t.video,n=t.root;this.clickTimer&&clearTimeout(this.clickTimer),n.removeEventListener("click",this.onVideoClick,!1),n.removeEventListener("dblclick",this.onVideoDblClick,!1),i.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(BO).map((function(t){n.removeEventListener(t,e[BO[t]],!1)}))}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),i}(ca),jO="press",VO="pressend",KO="doubleclick",WO="click",GO="touchmove",YO="touchstart",zO="touchend",$O={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},XO={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function qO(e){return e&&e.length>0?e[e.length-1]:null}var ZO=function(){function e(t){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};pr(this,e),vr(this,"onTouchStart",(function(e){var t=i._pos,n=i.root,r=qO(e.touches);t.x=r?parseInt(r.pageX,10):e.pageX,t.y=r?parseInt(r.pageX,10):e.pageX,t.start=!0,i.__setPress(e),n.addEventListener(i.events.end,i.onTouchEnd),n.addEventListener(i.events.cancel,i.onTouchCancel),n.addEventListener(i.events.move,i.onTouchMove),i.trigger(YO,e)})),vr(this,"onTouchCancel",(function(e){i.onTouchEnd(e)})),vr(this,"onTouchEnd",(function(e){var t=i._pos,n=i.root;i.__clearPress(),n.removeEventListener(i.events.cancel,i.onTouchCancel),n.removeEventListener(i.events.end,i.onTouchEnd),n.removeEventListener(i.events.move,i.onTouchMove),e.moving=t.moving,e.press=t.press,t.press&&i.trigger(VO,e),i.trigger(zO,e),!t.press&&!t.moving&&i.__setDb(e),t.press=!1,t.start=!1,t.moving=!1})),vr(this,"onTouchMove",(function(e){var t=i._pos,n=i.config,r=qO(e.touches),o=r?parseInt(r.pageX,10):e.pageX,a=r?parseInt(r.pageY,10):e.pageX,s=o-t.x,l=a-t.y;Math.abs(l)<n.miniStep&&Math.abs(s)<n.miniStep||(i.__clearPress(),t.press&&i.trigger(VO,e),t.press=!1,t.moving=!0,i.trigger(GO,e))})),this._pos={moving:!1,start:!1,x:0,y:0},this.config={pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0},Object.keys(n).map((function(e){i.config[e]=n[e]})),this.root=t,this.events="mouse"===n.eventType?XO:$O,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return yr(e,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(e){var t=this,i=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout((function(){t.trigger(jO,e),t._pos.press=!0,t.__clearPress()}),i.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(e){var t=this,i=this.config;if(this.dbIntrvalId)return this.__clearDb(),void this.trigger(KO,e);this.dbIntrvalId=setTimeout((function(){t.__clearDb(),t._pos.start||t._pos.press||t._pos.moving||t.trigger(WO,e)}),i.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(e,t){this.__handlers[e]||(this.__handlers[e]=[]),this.__handlers[e].push(t)}},{key:"off",value:function(e,t){if(this.__handlers[e]){for(var i=this.__handlers[e],n=-1,r=0;r<i.length;r++)if(i[r]===t){n=r;break}n>=0&&this.__handlers[e].splice(n,1)}}},{key:"trigger",value:function(e,t){this.__handlers[e]&&this.__handlers[e].map((function(i){try{i(t)}catch(nF){console.error("trigger>>:".concat(e),nF)}}))}},{key:"destroy",value:function(){var e=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).forEach((function(i){e.root.removeEventListener(i,e[t[i]])}))}}]),e}();function QO(){return(new DOMParser).parseFromString('<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <path opacity="0.54"\n d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"\n fill="white" />\n <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}var JO="auto",eL="seeking",tL="playbackrate",iL=["videoClick","videoDbClick"],nL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"onTouchStart",(function(e){var t=Tr(n),i=t.player,r=t.config,o=t.pos,a=t.playerConfig,s=n.getTouche(e);if(s&&!r.disableGesture&&n.duration>0&&!i.ended){o.isStart=!0,n.timer&&clearTimeout(n.timer),Mr.checkIsFunction(a.disableSwipeHandler)&&a.disableSwipeHandler(),n.find(".xg-dur").innerHTML=Mr.format(n.duration);var l=n.root.getBoundingClientRect();90===i.rotateDeg?(o.top=l.left,o.left=l.top,o.width=l.height,o.height=l.width):(o.top=l.top,o.left=l.left,o.width=l.width,o.height=l.height);var c=parseInt(s.pageX-o.left,10),u=parseInt(s.pageY-o.top,10);o.x=90===i.rotateDeg?u:c,o.y=90===i.rotateDeg?c:u,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}})),vr(Tr(n),"onTouchMove",(function(e){var t=n.getTouche(e),i=Tr(n),r=i.pos,o=i.config,a=i.player;if(t&&!o.disableGesture&&n.duration&&r.isStart){var s=o.miniMoveStep,l=o.hideControlsActive,c=parseInt(t.pageX-r.left,10),u=parseInt(t.pageY-r.top,10),h=90===a.rotateDeg?u:c,d=90===a.rotateDeg?c:u;if(Math.abs(h-r.x)>s||Math.abs(d-r.y)>s){var f=h-r.x,p=d-r.y,g=r.scope;if(-1===g&&(0===(g=n.checkScope(h,d,f,p,r))&&(l?a.blur():a.focus({autoHide:!1}),!r.time&&(r.time=parseInt(1e3*a.currentTime,10)+1e3*n.timeOffset)),r.scope=g),-1===g||g>0&&!o.gestureY||0===g&&!o.gestureX)return;n.executeMove(f,p,g,r.width,r.height),r.x=h,r.y=d}}})),vr(Tr(n),"onTouchEnd",(function(e){var t=Tr(n),i=t.player,r=t.pos,o=t.playerConfig;if(setTimeout((function(){i.getPlugin("progress")&&i.getPlugin("progress").resetSeekState()}),10),r.isStart){r.scope>-1&&e.cancelable&&e.preventDefault();var a=n.config,s=a.disableGesture,l=a.gestureX;!s&&l?n.endLastMove(r.scope):r.time=0,r.scope=-1,n.resetPos(),Mr.checkIsFunction(o.enableSwipeHandler)&&o.enableSwipeHandler(),n.changeAction(JO)}})),vr(Tr(n),"onRootTouchMove",(function(e){!n.config.disableGesture&&n.config.gestureX&&n.checkIsRootTarget(e)&&(e.stopPropagation(),n.pos.isStart?n.onTouchMove(e):n.onTouchStart(e))})),vr(Tr(n),"onRootTouchEnd",(function(e){n.pos.scope>-1&&n.onTouchEnd(e)})),n.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},n.timer=null,n}return yr(i,[{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:QO,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this;iL.map((function(t){e.__hooks[t]=null}));var t=this.playerConfig,i=this.config,n=this.player;!0===t.closeVideoDblclick&&(i.closedbClick=!0),this.resetPos(),Mr.isUndefined(t.disableGesture)||(i.disableGesture=!!t.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=Mr.createDom("xg-mask","",{},"xgmask"),n.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var r="mouse"===this.domEventType?"mouse":"touch";this.touch=new ZO(this.root,{eventType:r,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",(function(e){e.preventDefault()})),n.root.addEventListener("touchmove",this.onRootTouchMove,!0),n.root.addEventListener("touchend",this.onRootTouchEnd,!0),n.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var o=this.player.controls;o&&o.center&&(o.center.addEventListener("touchmove",this.onRootTouchMove,!0),o.center.addEventListener("touchend",this.onRootTouchEnd,!0),o.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(no,(function(){var t=e.player,i=e.config;t.duration>0&&1e3*t.duration<i.moveDuration&&(i.moveDuration=1e3*t.duration)})),this.on([io,Xr],(function(){var t=e.pos,i=t.time;!t.isStart&&i>0&&(e.pos.time=0)}));var a={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(a).map((function(t){e.touch.on(t,(function(i){e[a[t]](i)}))})),!i.disableActive){var s=n.plugins.progress;s&&(s.addCallBack("dragmove",(function(t){e.activeSeekNote(t.currentTime,t.forward)})),["dragend","click"].forEach((function(t){s.addCallBack(t,(function(){e.changeAction(JO)}))})))}}},{key:"registerThumbnail",value:function(){var e=this.player.plugins.thumbnail;if(e&&e.usable){this.thumbnail=e.createThumbnail(null,"mobile-thumbnail");var t=this.find(".time-preview");t.insertBefore(this.thumbnail,t.children[0])}}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle,t=e.playedColor,i=e.progressColor,n=e.timePreviewStyle,r=e.curTimeColor,o=e.durationColor;if(t&&(this.find(".xg-curbar").style.backgroundColor=t),i&&(this.find(".xg-bar").style.backgroundColor=i),n){var a=this.find(".time-preview");Object.keys(n).forEach((function(e){a.style[e]=n[e]}))}var s=r||t,l=o;s&&(this.find(".xg-cur").style.color=s),l&&(this.find(".xg-dur").style.color=l),this.config.disableTimeProgress&&Mr.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map((function(t){e.pos[t]=0}))):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var t=this.player;this.root.setAttribute("data-xg-action",e);var i=t.plugins.start;i&&i.recover()}},{key:"getTouche",value:function(e){this.player.rotateDeg;var t=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return{pageX:t.pageX,pageY:t.pageY}}},{key:"checkScope",value:function(e,t,i,n,r){var o=r.width,a=-1;if(e<0||e>o)return a;var s=0===n?Math.abs(i):Math.abs(i/n);return Math.abs(i)>0&&s>=1.73&&e>r.scopeM1&&e<r.scopeM2?a=0:(0===Math.abs(i)||s<=.57)&&(a=e<r.scopeL?1:e>r.scopeR?2:3),a}},{key:"executeMove",value:function(e,t,i,n,r){switch(i){case 0:this.updateTime(e/n*this.config.scopeM);break;case 1:this.updateBrightness(t/r);break;case 2:Vr.os.isIos||this.updateVolume(t/r)}}},{key:"endLastMove",value:function(e){var t=this,i=this.pos,n=this.player,r=this.config,o=(i.time-this.timeOffset)/1e3;if(0===e)n.seek(Number(o).toFixed(1)),r.hideControlsEnd?n.blur():n.focus(),this.timer=setTimeout((function(){t.pos.time=0}),500);this.changeAction(JO)}},{key:"checkIsRootTarget",value:function(e){var t=this.player.plugins||{};return(!t.progress||!t.progress.root.contains(e.target))&&(t.start&&t.start.root.contains(e.target)||t.controls&&t.controls.root.contains(e.target))}},{key:"sendUseAction",value:function(e){var t=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t,to:!t})}},{key:"clickHandler",value:function(e){var t=this.player,i=this.config,n=this.playerConfig;t.state<La.RUNNING?n.closeVideoClick||(this.sendUseAction(Mr.createEvent("click")),t.play()):!i.closedbClick||n.closeVideoClick?t.isActive?t.blur():t.focus():n.closeVideoClick||((t.isActive||i.focusVideoClick)&&(this.sendUseAction(Mr.createEvent("click")),this.switchPlayPause()),t.focus())}},{key:"dbClickHandler",value:function(e){var t=this.config,i=this.player;!t.closedbClick&&i.state>=La.RUNNING&&(this.sendUseAction(Mr.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var t=this,i=this.player;sa(this,iL[0],(function(e,i){t.clickHandler(i.e)}),{e:e,paused:i.paused})}},{key:"onDbClick",value:function(e){var t=this,i=this.player;sa(this,iL[1],(function(e,i){t.dbClickHandler(i.e)}),{e:e,paused:i.paused})}},{key:"onPress",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(t.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:n.playbackRate,to:i.pressRate}),n.playbackRate=i.pressRate,this.changeAction(tL))}},{key:"onPressEnd",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:n.playbackRate,to:t.rate}),n.playbackRate=t.rate,t.rate=1,this.changeAction(JO))}},{key:"updateTime",value:function(e){var t=this.player,i=this.config,n=this.player.duration;e=Number(e.toFixed(4));var r=parseInt(e*i.moveDuration,10)+this.timeOffset;r=(r+=this.pos.time)<0?0:r>1e3*n?1e3*n-200:r,t.getPlugin("time")&&t.getPlugin("time").updateTime(r/1e3),t.getPlugin("progress")&&t.getPlugin("progress").updatePercent(r/1e3/this.duration,!0),this.activeSeekNote(r/1e3,e>0),i.isTouchingSeek&&t.seek(Number((r-this.timeOffset)/1e3).toFixed(1)),this.pos.time=r}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.player,i=this.pos;if(e=parseInt(100*e,10),i.volume+=e,!(Math.abs(i.volume)<10)){var n=parseInt(10*t.volume,10)-parseInt(i.volume/10,10);n=n>10?10:n<1?0:n,t.volume=n/10,i.volume=0}}},{key:"updateBrightness",value:function(e){var t=this.pos,i=this.config,n=this.xgMask;if(i.darkness){this.player.rotateDeg&&(e=-e);var r=t.light+.8*e;r=r>i.maxDarkness?i.maxDarkness:r<0?0:r,n&&(n.style.backgroundColor="rgba(0,0,0,".concat(r,")")),t.light=r}}},{key:"activeSeekNote",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.player,n=this.config,r=!(this.duration!==1/0&&this.duration>0);if(e&&"number"==typeof e&&!r&&!n.disableActive){e<0?e=0:e>i.duration&&(e=i.duration-.2),this.changeAction(eL);var o=i.plugins.start;o&&o.focusHide(),this.find(".xg-dur").innerHTML=Mr.format(this.duration),this.find(".xg-cur").innerHTML=Mr.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),t?Mr.removeClass(this.find(".xg-seek-show"),"xg-back"):Mr.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var t=this.player.plugins.thumbnail;t&&t.usable&&this.thumbnail&&t.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<La.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!0}},{key:"enableGesture",value:function(){this.config.disableGesture=!1}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var t=this.player.controls;t&&t.center&&(t.center.removeEventListener("touchmove",this.onRootTouchMove,!0),t.center.removeEventListener("touchend",this.onRootTouchEnd,!0),t.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";return'\n <xg-trigger class="trigger">\n <div class="'.concat(e,'"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon?" hide-seek-icon":"",'">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span class="xg-separator">/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate,"X</i>").concat(this.i18n.FORWARD,"</span>\n </div>\n </xg-trigger>\n ")}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:36e4,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),i}(ba);function rL(e){var t=e.tagName;return!("INPUT"!==t&&"TEXTAREA"!==t&&!e.isContentEditable)}var oL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onBodyKeyDown",(function(t){if(e.player){var i=t||window.event,n=i.keyCode,r=Tr(e),o=r._keyState,a=r.player,s=e.config,l=s.disable,c=s.disableBodyTrigger,u=s.isIgnoreUserActive;l||c||!a.isUserActive&&!u||rL(i.target)||!e.checkIsVisible()||i.metaKey||i.altKey||i.ctrlKey?o.isBodyKeyDown=!1:(t.repeat||o.isKeyDown||((i.target===document.body||e.config.isGlobalTrigger&&!rL(i.target))&&e.checkCode(n,!0)&&(o.isBodyKeyDown=!0),document.addEventListener("keyup",e.onBodyKeyUp)),o.isBodyKeyDown&&e.handleKeyDown(i))}})),vr(Tr(e),"onBodyKeyUp",(function(t){e.player&&(document.removeEventListener("keyup",e.onBodyKeyUp),e.handleKeyUp(t))})),vr(Tr(e),"onKeydown",(function(t){if(e.player){var i=t||window.event,n=Tr(e)._keyState;if(!i.repeat){if(e.config.disable||e.config.disableRootTrigger||i.metaKey||i.altKey||i.ctrlKey)return;!i||37!==i.keyCode&&!e.checkCode(i.keyCode)||i.target!==e.player.root&&i.target!==e.player.video&&i.target!==e.player.controls.el||(n.isKeyDown=!0),e.player.root.addEventListener("keyup",e.onKeyup)}n.isKeyDown&&e.handleKeyDown(i)}})),vr(Tr(e),"onKeyup",(function(t){e.player&&(e.player.root.removeEventListener("keyup",e.onKeyup),e.handleKeyUp(t))})),e}return yr(i,[{key:"mergekeyCodeMap",value:function(){var e=this,t=this.config.keyCodeMap;t&&Object.keys(t).map((function(i){e.keyCodeMap[i]?["keyCode","action","disable","pressAction","disablePress","isBodyTarget"].map((function(n){t[i][n]&&(e.keyCodeMap[i][n]=t[i][n])})):e.keyCodeMap[i]=t[i]}))}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e="function"==typeof this.config.seekStep?this.config.seekStep(this.player):this.config.seekStep;e&&"number"==typeof e&&(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"setConfig",value:function(e){var t=this;Object.keys(e).forEach((function(i){t.config[i]=e[i]}))}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),t=e.height,i=e.top,n=e.bottom,r=window.innerHeight;return!(i<0&&i<0-.9*t||n>0&&n-r>.9*t)}},{key:"checkCode",value:function(e,t){var i=this,n=!1;return Object.keys(this.keyCodeMap).map((function(r){i.keyCodeMap[r]&&e===i.keyCodeMap[r].keyCode&&!i.keyCodeMap[r].disable&&(n=!t||t&&!i.keyCodeMap[r].noBodyTarget)})),n}},{key:"downVolume",value:function(e){var t=this.player;if(!(t.volume<=0)){var i=parseFloat((t.volume-.1).toFixed(1)),n={volume:{from:t.volume,to:i}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=i>=0?i:0}}},{key:"upVolume",value:function(e){var t=this.player;if(!(t.volume>=1)){var i=parseFloat((t.volume+.1).toFixed(1)),n={volume:{from:t.volume,to:i}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=i<=1?i:1}}},{key:"seek",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.duration,o=t.offsetDuration,a=t.timeSegments,s=n>-1?n:i,l=o||r,c=e.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;s+c<=l?s+=c:s=l;var u=Mr.getCurrentTimeByOffset(s,a),h={currentTime:{from:i,to:u}};this.emitUserAction(e,"seek",{props:h}),this.player.currentTime=u}},{key:"seekBack",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.timeSegments,o=(n>-1?n:i)-(e.repeat?parseInt(this.seekStep/2,10):this.seekStep);o<0&&(o=0);var a={currentTime:{from:i,to:o=Mr.getCurrentTimeByOffset(o,r)}};this.emitUserAction(e,"seek",{props:a}),this.player.currentTime=o}},{key:"changePlaybackRate",value:function(e){var t=this._keyState,i=this.config,n=this.player;0===t.playbackRate&&(t.playbackRate=n.playbackRate,n.playbackRate=i.playbackRate)}},{key:"playPause",value:function(e){var t=this.player;t&&(this.emitUserAction(e,"switch_play_pause"),t.paused?t.play():t.pause())}},{key:"exitFullscreen",value:function(e){var t=this.player,i=t.fullscreen,n=t.cssfullscreen;i&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:i,to:!i}),t.exitFullscreen()),n&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:n,to:!n}),t.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var t=this._keyState;if(e.repeat){t.isPress=!0;var i=Date.now();if(i-t.tt<200)return;t.tt=i}this.handleKeyCode(e.keyCode,e,t.isPress)}},{key:"handleKeyUp",value:function(e){var t=this._keyState;t.playbackRate>0&&(this.player.playbackRate=t.playbackRate,t.playbackRate=0),t.isKeyDown=!1,t.isPress=!1,t.tt=0}},{key:"handleKeyCode",value:function(e,t,i){for(var n,r=Object.keys(this.keyCodeMap),o=0;o<r.length;o++){var a=this.keyCodeMap[r[o]],s=a.action,l=a.keyCode,c=a.disable,u=a.pressAction,h=a.disablePress;if(l===e){if(!(c||i&&h)){var d=i&&u||s;"function"==typeof d?s(t,this.player,i):"string"==typeof d&&"function"==typeof this[d]&&this[d](t,this.player,i),this.emit(No,dr({key:r[o],target:t.target,isPress:i},this.keyCodeMap[r[o]]))}(n=t).preventDefault(),n.returnValue=!1,t.stopPropagation();break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),i}(ca);function aL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">\n <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>\n</svg>\n',"image/svg+xml").firstChild}var sL=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"registerIcons",value:function(){return{loadingIcon:aL}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return'\n <xg-loading class="xgplayer-loading">\n <xg-loading-inner></xg-loading-inner>\n </xg-loading>'}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:va.ROOT}}}]),i}(ba),lL=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],cL=function(){function e(t){pr(this,e),this.fragments=t.fragments||[],0===this.fragments.length&&this.fragments.push({percent:1}),this._callBack=t.actionCallback,this.fragConfig={fragFocusClass:t.fragFocusClass||"inner-focus-point",fragAutoFocus:!!t.fragAutoFocus,fragClass:t.fragClass||""},this.style=t.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return yr(e,[{key:"updateDuration",value:function(e){var t=this;this.duration=e;var i=0,n=this.fragments;this.fragments=n.map((function(e){return e.start=parseInt(i,10),e.end=parseInt(i+e.percent*t.duration,10),e.duration=parseInt(e.percent*t.duration,10),i+=e.percent*t.duration,e}))}},{key:"updateProgress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"played",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},i=this.progressList,n=this.fragments;if(!(i.length<1)){var r=t.newIndex,o=t.curIndex,a=t.millisecond;r!==o&&i.map((function(t,i){i<r?t[e].style.width="100%":i>r&&(t[e].style.width=0)}));var s=n[r],l=0===a?0:(a-s.start)/s.duration;i[r][e].style.width=l<0?0:"".concat(100*l,"%")}}},{key:"updateFocus",value:function(e){if(this.fragConfig.fragAutoFocus&&!(this.fragments.length<2))if(e){var t=this.findIndex(1e3*e.currentTime,this.focusIndex);if(t>=0&&t!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(t);var i={index:t,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=t,this._callBack&&this._callBack(i)}}else if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var n={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(n),this.focusIndex=-1}}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(1e3*t,10)!==this.duration){if(!t&&0!==t)return;this.updateDuration(parseInt(1e3*t,10))}var i=this.playedIndex,n=this.cachedIndex;if("Undefined"!==Mr.typeOf(e.played)){var r=this.findIndex(1e3*e.played,i);if(r<0)return;this.updateProgress("played",{newIndex:r,curIndex:i,millisecond:parseInt(1e3*e.played,10)}),this.playedIndex=r}if("Undefined"!==Mr.typeOf(e.cached)){var o=this.findIndex(1e3*e.cached,n);if(o<0)return;this.updateProgress("cached",{newIndex:o,curIndex:n,millisecond:parseInt(1e3*e.cached,10)}),this.cachedIndex=o}}},{key:"findIndex",value:function(e,t){var i=this.fragments;if(!i||0===i.length)return-1;if(1===i.length)return 0;if(t>-1&&t<i.length&&e>i[t].start&&e<i[t].end)return t;if(e>i[i.length-1].start)return i.length-1;for(var n=0;n<i.length;n++)if(e>i[n].start&&e<=i[n].end){t=n;break}return t}},{key:"findHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)if(Mr.hasClass(e[t],this.fragConfig.fragFocusClass))return{dom:e[t],pos:e[t].getBoundingClientRect()}}},{key:"findFragment",value:function(e){var t=this.root.children;return e<0||e>=t.length?null:{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)Mr.removeClass(e[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(e){var t=this.root.children;if(e<t.length)return Mr.addClass(t[e],this.fragConfig.fragFocusClass),{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(e){var t=this;if(Object.keys(this.fragConfig).forEach((function(i){void 0!==e[i]&&(t.fragConfig[i]=e[i])})),e.fragments){if(this.fragments=0===e.fragments.length?[{percent:1}]:e.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var i=this.root.children;i.length>0;)this.root.removeChild(i[0]);this.render()}}},{key:"render",value:function(){var e=this,t=this.style.progressColor;if(this.root||(this.root=Mr.createDom("xg-inners","",{},"progress-list")),this.fragments){var i=this.fragConfig,n=i.fragClass,r=i.fragFocusClass;this.progressList=this.fragments.map((function(i){var o=Mr.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(i.percent):"flex: ".concat(i.percent)},"".concat(i.isFocus?r:""," xgplayer-progress-inner ").concat(n));return e.root.appendChild(o),lL.forEach((function(t){o.appendChild(Mr.createDom(t.tag,"",{style:t.styleKey?"background: ".concat(e.style[t.styleKey],"; width:0;"):"width:0;"},t.className))})),{cached:o.children[0],played:o.children[1]}}))}return this.root}}]),e}(),uL={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},hL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"onMoveOnly",(function(e,t){var i=Tr(n),r=i.pos,o=i.config,a=i.player,s=t;if(e){Mr.event(e);var l=Mr.getEventPos(e,a.zoom),c=90===a.rotateDeg?l.clientY:l.clientX;if(r.moving&&Math.abs(r.x-c)<o.miniMoveStep)return;r.moving=!0,r.x=c,s=n.computeTime(e,c)}n.triggerCallbacks("dragmove",s,e),n._updateInnerFocus(s)})),vr(Tr(n),"onBodyClick",(function(e){n.pos.isLocked&&(n.pos.isLocked=!1,e.preventDefault(),e.stopPropagation())})),vr(Tr(n),"_mouseDownHandler",(function(e,t){n._state.time=t.currentTime,n.updateWidth(t.currentTime,t.seekTime,t.percent,0),n._updateInnerFocus(t)})),vr(Tr(n),"_mouseUpHandler",(function(e,t){Tr(n).pos.moving&&n.updateWidth(t.currentTime,t.seekTime,t.percent,2)})),vr(Tr(n),"_mouseMoveHandler",(function(e,t){var i=Tr(n),r=i._state,o=i.pos,a=i.config,s=i.player;r.time<t.currentTime?t.forward=!0:t.forward=!1,r.time=t.currentTime,o.isDown&&!o.moving&&(o.moving=!0,a.isPauseMoving&&s.pause(),n.triggerCallbacks("dragstart",t,e),n.emitUserAction("drag","dragstart",t)),n.updateWidth(t.currentTime,t.seekTime,t.percent,1),n.triggerCallbacks("dragmove",t,e),n._updateInnerFocus(t)})),vr(Tr(n),"onMouseDown",(function(e){var t=Tr(n),i=t._state,r=t.player,o=t.pos,a=t.config,s=t.playerConfig,l=Mr.getEventPos(e,r.zoom),c=90===r.rotateDeg?l.clientY:l.clientX;if(!(r.isMini||a.closeMoveSeek||!s.allowSeekAfterEnded&&r.ended)){if(r.duration||r.isPlaying){e.stopPropagation(),n.focus(),Mr.checkIsFunction(s.disableSwipeHandler)&&s.disableSwipeHandler(),Mr.checkIsFunction(a.onMoveStart)&&a.onMoveStart(),Mr.event(e),o.x=c,o.isDown=!0,o.moving=!1,i.prePlayTime=r.currentTime,r.focus({autoHide:!1}),n.isProgressMoving=!0,Mr.addClass(n.progressBtn,"active");var u=n.computeTime(e,c);return u.prePlayTime=i.prePlayTime,n._mouseDownHandlerHook(e,u),"touchstart"===e.type?(n.root.addEventListener("touchmove",n.onMouseMove),n.root.addEventListener("touchend",n.onMouseUp),n.root.addEventListener("touchcancel",n.onMouseUp)):(n.unbind("mousemove",n.onMoveOnly),document.addEventListener("mousemove",n.onMouseMove,!1),document.addEventListener("mouseup",n.onMouseUp,!1)),!0}r.play()}})),vr(Tr(n),"onMouseUp",(function(e){var t=Tr(n),i=t.player,r=t.config,o=t.pos,a=t.playerConfig,s=t._state;if(o){e.stopPropagation(),e.preventDefault(),Mr.checkIsFunction(a.enableSwipeHandler)&&a.enableSwipeHandler(),Mr.checkIsFunction(r.onMoveEnd)&&r.onMoveEnd(),Mr.event(e),Mr.removeClass(n.progressBtn,"active");var l=n.computeTime(e,o.x);l.prePlayTime=s.prePlayTime,o.moving?(n.triggerCallbacks("dragend",l,e),n.emitUserAction("drag","dragend",l)):(n.triggerCallbacks("click",l,e),n.emitUserAction("click","click",l)),n._mouseUpHandlerHook(e,l),o.moving=!1,o.isDown=!1,o.x=0,o.y=0,o.isLocked=!0,s.prePlayTime=0,s.time=0;var c=e.type;"touchend"===c||"touchcancel"===c?(n.root.removeEventListener("touchmove",n.onMouseMove),n.root.removeEventListener("touchend",n.onMouseUp),n.root.removeEventListener("touchcancel",n.onMouseUp),n.blur()):(document.removeEventListener("mousemove",n.onMouseMove,!1),document.removeEventListener("mouseup",n.onMouseUp,!1),o.isEnter?"mobile"!==a.isMobileSimulateMode&&n.bind("mousemove",n.onMoveOnly):n.onMouseLeave(e)),Mr.setTimeout(Tr(n),(function(){n.resetSeekState()}),1),i.focus()}})),vr(Tr(n),"onMouseMove",(function(e){var t=Tr(n),i=t._state,r=t.pos,o=t.player,a=t.config;Mr.checkTouchSupport()&&e.preventDefault(),Mr.event(e);var s=Mr.getEventPos(e,o.zoom),l=90===o.rotateDeg?s.clientY:s.clientX,c=Math.abs(r.x-l);if(!(r.moving&&c<a.miniMoveStep||!r.moving&&c<a.miniStartStep)){r.x=l;var u=n.computeTime(e,l);u.prePlayTime=i.prePlayTime,n._mouseMoveHandlerHook(e,u)}})),vr(Tr(n),"onMouseOut",(function(e){n.triggerCallbacks("mouseout",null,e)})),vr(Tr(n),"onMouseOver",(function(e){n.triggerCallbacks("mouseover",null,e)})),vr(Tr(n),"onMouseEnter",(function(e){var t=Tr(n),i=t.player,r=t.pos;if(!(r.isDown||r.isEnter||i.isMini||!i.config.allowSeekAfterEnded&&i.ended)){r.isEnter=!0,n.bind("mousemove",n.onMoveOnly),n.bind("mouseleave",n.onMouseLeave),Mr.event(e);var o=Mr.getEventPos(e,i.zoom),a=90===i.rotateDeg?o.clientY:o.clientX,s=n.computeTime(e,a);n.triggerCallbacks("mouseenter",s,e),n.focus()}})),vr(Tr(n),"onMouseLeave",(function(e){n.triggerCallbacks("mouseleave",null,e),n.unlock(),n._updateInnerFocus(null)})),vr(Tr(n),"onVideoResize",(function(){var e=n.pos,t=e.x,i=e.isDown;if(e.isEnter&&!i){var r=n.computeTime(null,t);n.onMoveOnly(null,r)}})),n.useable=!1,n.isProgressMoving=!1,n.__dragCallBacks=[],n._state={now:-1,direc:0,time:0,prePlayTime:-1},n._disableBlur=!1,"boolean"==typeof n.config.isDragingSeek&&(console.warn("[XGPLAYER] 'isDragingSeek' is deprecated, please use 'isDraggingSeek' instead"),n.config.isDraggingSeek=n.config.isDragingSeek),n}return yr(i,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i+this.timeOffset}},{key:"changeState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t&&0!==t.length||(t=[{percent:1}]);var n=dr(dr({fragments:t},i),{},{actionCallback:function(t){e.emitUserAction("fragment_focus","fragment_focus",t)}});this.innerList?this.innerList.reset(n):(this.innerList=new cL(n),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map((function(t){e[t]=e.innerList[t].bind(e.innerList)})))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer");var e=this.config,t=e.fragFocusClass,i=e.fragAutoFocus,n=e.fragClass;this._initInner(this.config.fragments,{fragFocusClass:t,fragAutoFocus:i,fragClass:n,style:this.playerConfig.commonStyle||{}}),"mobile"===Vr.device&&(this.config.isDraggingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.listenEvents(),this.bindDomEvents(),this.initCustomStyle()}}},{key:"listenEvents",value:function(){var e=this;this.on(no,(function(){e.onMouseLeave()})),this.on(eo,(function(){e.onTimeupdate()})),this.on(Jr,(function(){e.onTimeupdate(),e.onCacheUpdate()})),this.on(so,(function(){e.onCacheUpdate()})),this.on(Xr,(function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0})),this.on(co,(function(){e.onReset()})),this.on(Ao,(function(){e.onVideoResize()}))}},{key:"setConfig",value:function(e){var t=this,i=null;Object.keys(e).forEach((function(n){t.config[n]=e[n],"fragments"===n&&(i=e[n])})),i&&this._initInner(i,e)}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle.sliderBtnStyle,t=this.progressBtn;e&&("string"==typeof e?t.style.boxShadow=e:"object"===fr(e)&&Object.keys(e).map((function(i){t.style[i]=e[i]})))}},{key:"triggerCallbacks",value:function(e,t,i){this.__dragCallBacks.length>0&&this.__dragCallBacks.map((function(n){if(n&&n.handler&&n.type===e)try{n.handler(t,i)}catch(nF){console.error("[XGPLAYER][triggerCallbacks] ".concat(n," error"),nF)}}))}},{key:"addCallBack",value:function(e,t){t&&"function"==typeof t&&this.__dragCallBacks.push({type:e,handler:t})}},{key:"removeCallBack",value:function(e,t){var i=this.__dragCallBacks,n=-1;i.map((function(i,r){i&&i.type===e&&i.handler===t&&(n=r)})),n>-1&&i.splice(n,1)}},{key:"unlock",value:function(){var e=this.player,t=this.pos;t.isEnter=!1,t.isLocked=!1,e.isMini||(this.unbind("mousemove",this.onMoveOnly),t.isDown?this.unbind("mouseleave",this.onMouseLeave):this.blur())}},{key:"bindDomEvents",value:function(){var e=this.player.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),"mouse"!==this.domEventType&&"compatible"!==this.domEventType||(this.bind("mousedown",this.onMouseDown),"mobile"!==e.isMobileSimulateMode&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),Mr.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),Mr.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,t,i,n){var r=this.config,o=this.player;if(!r.isCloseClickSeek||0!==n){var a=t=t>=o.duration?o.duration-r.endedDiff:Number(t).toFixed(1);this.updatePercent(i),this.updateTime(e),(1!==n||r.isDraggingSeek&&"audio"!==o.config.mediaType)&&(this._state.now=a,this._state.direc=a>o.currentTime?0:1,o.seek(a))}}},{key:"computeTime",value:function(e,t){var i,n,r=this.player,o=this.root.getBoundingClientRect(),a=o.width,s=o.height,l=o.top,c=o.left,u=t;90===r.rotateDeg?(i=s,n=l):(i=a,n=c);var h=u-n,d=(h=h>i?i:h<0?0:h)/i;d=d<0?0:d>1?1:d,Number.isNaN(d)&&(d=this.player.currentTime/this.offsetDuration);var f=parseInt(d*this.offsetDuration*1e3,10)/1e3;return{percent:d,currentTime:f,seekTime:Mr.getCurrentTimeByOffset(f,r.timeSegments),offset:h,width:i,left:n,e:e}}},{key:"updateTime",value:function(e){var t=this.player,i=this.duration;e>i?e=i:e<0&&(e=0);var n=t.plugins.time;n&&n.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,t){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(100*e,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var i=this.player.plugins.miniprogress;i&&i.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var t=this.player,i=this._state,n=this.offsetDuration;if(!(t.isSeeking&&t.media.seeking||this.isProgressMoving)&&t.hasStart){if(i.now>-1){var r=parseInt(1e3*i.now,10)-parseInt(1e3*t.currentTime,10);if(0===i.direc&&r>300||1===i.direc&&r>-300)return void(i.now=-1);i.now=-1}var o=this.currentTime;o=Mr.adjustTimeByDuration(o,n,e),this.innerList.update({played:o},n),this.progressBtn.style.left="".concat(o/n*100,"%")}}},{key:"onCacheUpdate",value:function(e){var t=this.player,i=this.duration;if(t){var n=t.bufferedPoint.end;n=Mr.adjustTimeByDuration(n,i,e),this.innerList.update({cached:n},i)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var t=this.domEventType;"touch"!==t&&"compatible"!==t||(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),"mouse"!==t&&"compatible"!==t||(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){var e=this.player.controls?this.player.controls.config.mode:"";return'\n <xg-progress class="xgplayer-progress '.concat("bottom"===e?"xgplayer-progress-bottom":"",'">\n <xg-outer class="xgplayer-progress-outer">\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n </xg-outer>\n </xg-progress>\n ')}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_CENTER,index:0,disable:!1,isDraggingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:uL.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return uL}}]),i}(ba),dL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"_onMouseenter",(function(t){e.emit("icon_mouseenter",{pluginName:e.pluginName})})),vr(Tr(e),"_onMouseLeave",(function(t){e.emit("icon_mouseleave",{pluginName:e.pluginName})})),e}return yr(i,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),i}(ba),fL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"btnClick",(function(t){t.preventDefault(),t.stopPropagation();var i=Tr(e).player;return e.emitUserAction(t,"switch_play_pause",{prop:"paused",from:i.paused,to:!i.paused}),i.ended?i.replay():i.paused?(i.play(),e.animate(!1)):(i.pause(),e.animate(!0)),!1})),e}return yr(i,[{key:"afterCreate",value:function(){Cr(_r(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.initIcons(),this.bind(["touchend","click"],this.btnClick),this.listenEvents(),this.animate(!0))}},{key:"listenEvents",value:function(){var e=this,t=this.player;this.on([zr,qr,Zr,co],(function(){e.animate(t.paused)}))}},{key:"registerIcons",value:function(){return{play:{icon:_O,class:"xg-icon-play"},pause:{icon:EO,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){if(this.player){var t=this.i18nKeys,i=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),i&&this.changeLangTextKey(i,t.PLAY_TIPS)):(this.setAttr("data-state","play"),i&&this.changeLangTextKey(i,t.PAUSE_TIPS))}}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-play">\n <div class="xgplayer-icon">\n </div>\n '.concat(kO(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_LEFT,index:0,disable:!1}}}]),i}(dL);function pL(){return(new DOMParser).parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n </g>\n</svg>',"image/svg+xml").firstChild}var gL=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(t){t.preventDefault(),t.stopPropagation(),e.config.onClick(t)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:pL,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){Mr.addClass(this.root,"show")}},{key:"hide",value:function(){Mr.removeClass(this.root,"show")}},{key:"render",value:function(){return'<xg-icon class="xgplayer-back">\n </xg-icon>'}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:va.ROOT_TOP,index:0}}}]),i}(ba);function yL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n',"image/svg+xml").firstChild}function vL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n',"image/svg+xml").firstChild}var mL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"_onOrientationChange",(function(t){e.player.fullscreen&&e.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?e.player.setRotateDeg(0):e.player.setRotateDeg(90))})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this;Cr(_r(i.prototype),"afterCreate",this).call(this);var t=this.config,n=this.playerConfig;if(!t.disable){t.target&&(this.playerConfig.fullscreenTarget=this.config.target);var r=Mr.getFullScreenEl();n.fullscreenTarget===r&&this.player.getFullscreen().catch((function(e){})),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(t){var i=e.player.fullscreen;e.emitUserAction(t,"switch_fullscreen",{prop:"fullscreen",from:i,to:!i})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(ko,(function(t){var i=e.find(".xg-tips");i&&e.changeLangTextKey(i,t?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(t)})),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:gL,options:{config:{onClick:function(t){e.handleFullscreen(t)}}}})),"mobile"===Vr.device&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:yL,class:"xg-get-fullscreen"},exitFullscreen:{icon:vL,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===Vr.device?"touchend":"click",this.handleFullscreen),"mobile"===Vr.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e instanceof Event&&(e.preventDefault(),e.stopPropagation());var t=this.player,i=this.config;!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen()?(t.fullscreen?t.exitCssFullscreen():t.getCssFullscreen(),this.animate(t.fullscreen)):i.rotateFullscreen?(t.fullscreen?t.exitRotateFullscreen():t.getRotateFullscreen(),this.animate(t.fullscreen)):i.switchCallback&&"function"==typeof i.switchCallback?i.switchCallback(t.fullscreen):t.fullscreen?(t.exitFullscreen(),i.useScreenOrientation&&this.unlockScreen()):(t.getFullscreen().catch((function(e){})),i.useScreenOrientation&&t.aspectRatio>1&&this.lockScreen(i.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){return'<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(kO(this,"FULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch((function(e){}))}catch(t){}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch((function(e){}))}catch(e){}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),i}(dL),_L=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),(n=t.call(this,e)).isActiving=!1,n}return yr(i,[{key:"duration",get:function(){var e=this.player,t=e.offsetDuration,i=e.duration;return this.playerConfig.customDuration||t||i}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this.player.controls.config.mode;this.mode="flex"===e?"flex":"normal",this.config.disable||("flex"===this.mode&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.listenEvents())}},{key:"listenEvents",value:function(){var e=this;this.on([no,Jr,eo],(function(t){"durationchange"===t.eventName&&(e.isActiving=!1),e.onTimeUpdate()})),this.on(Xr,(function(){e.onTimeUpdate(!0)})),this.on(co,(function(){e.onReset()}))}},{key:"show",value:function(e){if("flex"===this.mode)return this.centerCurDom&&(this.centerCurDom.style.display="block"),void(this.centerDurDom&&(this.centerDurDom.style.display="block"));this.root.style.display="block"}},{key:"hide",value:function(){if("flex"===this.mode)return this.centerCurDom&&(this.centerCurDom.style.display="none"),void(this.centerDurDom&&(this.centerDurDom.style.display="none"));this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var t=this.player,i=this.config,n=this.duration;if(!i.disable&&!this.isActiving&&t.hasStart){var r=this.currentTime+this.timeOffset;r=Mr.adjustTimeByDuration(r,n,e),"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(Mr.format(r)),n!==1/0&&n>0&&(this.centerDurDom.innerHTML=Mr.format(n))):(this.timeDom.innerHTML=this.minWidthTime(Mr.format(r)),n!==1/0&&n>0&&(this.durationDom.innerHTML=Mr.format(n)))}}},{key:"onReset",value:function(){"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(Mr.format(0)),this.centerDurDom.innerHTML=Mr.format(0)):(this.timeDom.innerHTML=this.minWidthTime(Mr.format(0)),this.durationDom.innerHTML=Mr.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(e.controls&&e.controls.center){var t=e.controls.center;this.centerCurDom=Mr.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=Mr.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),t.children.length>0?t.insertBefore(this.centerCurDom,t.children[0]):t.appendChild(this.centerCurDom),t.appendChild(this.centerDurDom),this.extraEls=[this.centerCurDom,this.centerDurDom]}}},{key:"afterPlayerInit",value:function(){var e=this.config;this.duration===1/0||this.playerConfig.isLive?(Mr.hide(this.durationDom),Mr.hide(this.timeDom),Mr.hide(this.find(".time-separator")),Mr.show(this.find(".time-live-tag"))):Mr.hide(this.find(".time-live-tag")),e.hide?this.hide():this.show()}},{key:"changeLiveState",value:function(e){e?(Mr.hide(this.durationDom),Mr.hide(this.timeDom),Mr.hide(this.find(".time-separator")),Mr.show(this.find(".time-live-tag"))):(Mr.hide(this.find(".time-live-tag")),Mr.show(this.find(".time-separator")),Mr.show(this.durationDom),Mr.show(this.timeDom))}},{key:"updateTime",value:function(e){this.isActiving=!0,!e&&0!==e||e>this.duration||("flex"!==this.mode?this.timeDom.innerHTML=this.minWidthTime(Mr.format(e)):this.centerCurDom.innerHTML=this.minWidthTime(Mr.format(e)))}},{key:"minWidthTime",value:function(e){return e.split(":").map((function(e){return'<span class="time-min-width">'.concat(e,"</span>")})).join(":")}},{key:"resetActive",value:function(){var e=this,t=this.player,i=function(){e.isActiving=!1};this.off(Jr,i),t.isSeeking&&t.media.seeking?this.once(Jr,i):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-time">\n <span class="time-current">00:00</span>\n <span class="time-separator">/</span>\n <span class="time-duration">00:00</span>\n <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP,"</span>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_LEFT,index:2,disable:!1}}}]),i}(ba),EL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"_onDurationChange",(function(){e.updateSegments();var t=e.player,i=t.currentTime,n=t.timeSegments;if(e._checkIfEnabled(n)){var r=Mr.getIndexByTime(i,n),o=Mr.getOffsetCurrentTime(i,n,r);e.player.offsetCurrentTime=o,e.changeIndex(r,n)}})),vr(Tr(e),"_onLoadedData",(function(){var t=e.player.timeSegments;if(e._checkIfEnabled(t)){var i=Mr.getOffsetCurrentTime(0,t);e.player.offsetCurrentTime=i,e.changeIndex(0,t),e.curPos.start>0&&(e.player.currentTime=e.curPos.start)}})),vr(Tr(e),"_onTimeupdate",(function(){var t=e.player,i=t.currentTime,n=t.timeSegments;if(e._checkIfEnabled(n)){var r=n.length;e.lastCurrentTime=i;var o=Mr.getIndexByTime(i,n);o!==e.curIndex&&e.changeIndex(o,n);var a=Mr.getOffsetCurrentTime(i,n,o);if(e.player.offsetCurrentTime=a,e.curPos){var s=e.curPos,l=s.start,c=s.end;i<l?e.player.currentTime=l:i>c&&o>=r-1&&e.player.pause()}}})),vr(Tr(e),"_onSeeking",(function(){var t=e.player,i=t.currentTime,n=t.timeSegments;if(e._checkIfEnabled(n))if(i<n[0].start)e.player.currentTime=n[0].start;else if(i>n[n.length-1].end)e.player.currentTime=n[n.length-1].end;else{var r=Mr.getIndexByTime(i,n);if(r>=0){var o=e.getSeekTime(i,e.lastCurrentTime,r,n);o>=0&&(e.player.currentTime=o)}}})),vr(Tr(e),"_onPlay",(function(){var t=e.player,i=t.currentTime,n=t.timeSegments;e._checkIfEnabled(n)&&i>=n[n.length-1].end&&(e.player.currentTime=n[0].start)})),e}return yr(i,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(no,this._onDurationChange),this.on(oo,this._onLoadedData),this.on(eo,this._onTimeupdate),this.on(Qr,this._onSeeking),this.on(zr,this._onPlay)}},{key:"setConfig",value:function(e){var t=this;if(e){var i=Object.keys(e);i.length<1||(i.forEach((function(i){t.config[i]=e[i]})),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,t=e.disable,i=e.segments,n=this.player;if(t||!i||0===i.length)n.timeSegments=[],n.offsetDuration=0,n.offsetCurrentTime=-1;else{var r=this.formatTimeSegments(i,n.duration);n.timeSegments=r,n.offsetDuration=r.length>0?r[r.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,t){var i=[];return e?(e.sort((function(e,t){return e.start-t.start})),e.forEach((function(e,n){var r={};if(r.start=e.start<0?0:e.start,r.end=t>0&&e.end>t?t:e.end,!(t>0&&r.start>t)){i.push(r);var o=r.end-r.start;if(0===n)r.offset=e.start,r.cTime=0,r.segDuration=o,r.duration=o;else{var a=i[n-1];r.offset=a.offset+(r.start-a.end),r.cTime=a.duration+a.cTime,r.segDuration=o,r.duration=a.duration+o}}})),i):[]}},{key:"getSeekTime",value:function(e,t,i,n){var r=-1,o=n[i],a=o.start,s=o.end;if(e>=a&&e<=s)return r;var l=e-t;if(l<0&&e<a){var c=t>a?t-a:0;return r=i-1>=0?n[i-1].end+l+c:0}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,t){this.curIndex=e,e>=0&&t.length>0?this.curPos=t[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),i}(ca);function TL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function bL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function SL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>\n</svg>\n',"image/svg+xml").firstChild}var CL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onBarMousedown",(function(t){var i=Tr(e).player,n=e.find(".xgplayer-bar");Mr.event(t);var r=n.getBoundingClientRect(),o=Mr.getEventPos(t,i.zoom),a=r.height-(o.clientY-r.top);if(o.h=a,o.barH=r.height,e.pos=o,!(a<-2))return e.updateVolumePos(a,t),document.addEventListener("mouseup",e.onBarMouseUp),e._d.isStart=!0,!1})),vr(Tr(e),"onBarMouseMove",(function(t){var i=Tr(e)._d;if(i.isStart){var n=Tr(e),r=n.pos,o=n.player;t.preventDefault(),t.stopPropagation(),Mr.event(t);var a=Mr.getEventPos(t,o.zoom);i.isMoving=!0;var s=r.h-a.clientY+r.clientY;s>r.barH||e.updateVolumePos(s,t)}})),vr(Tr(e),"onBarMouseUp",(function(t){Mr.event(t),document.removeEventListener("mouseup",e.onBarMouseUp);var i=Tr(e)._d;i.isStart=!1,i.isMoving=!1})),vr(Tr(e),"onMouseenter",(function(t){e._d.isActive=!0,e.focus(),e.emit("icon_mouseenter",{pluginName:e.pluginName})})),vr(Tr(e),"onMouseleave",(function(t){e._d.isActive=!1,e.unFocus(100,!1,t),e.emit("icon_mouseleave",{pluginName:e.pluginName})})),vr(Tr(e),"onVolumeChange",(function(t){if(e.player){var i=e.player,n=i.muted,r=i.volume;e._d.isMoving||(e.find(".xgplayer-drag").style.height=n||0===r?"4px":"".concat(100*r,"%"),e.config.showValueLabel&&e.updateVolumeValue()),e.animate(n,r)}})),e}return yr(i,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:bL,class:"xg-volume-small"},volumeLarge:{icon:TL,class:"xg-volume"},volumeMuted:{icon:SL,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var t=this.playerConfig,i=t.commonStyle,n=t.volume;i.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=i.volumeColor),this.changeMutedHandler=this.hook("mutedChange",(function(t){e.changeMuted(t)}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),"mobile"!==Vr.device&&"mobile"!==this.playerConfig.isMobileSimulateMode&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(ro,this.onVolumeChange),this.once(oo,this.onVolumeChange),"Number"!==Mr.typeOf(n)&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,t){var i=this.player,n=this.find(".xgplayer-drag"),r=this.find(".xgplayer-bar");if(r&&n){var o=parseInt(e/r.getBoundingClientRect().height*1e3,10);n.style.height="".concat(e,"px");var a=Math.max(Math.min(o/1e3,1),0),s={volume:{from:i.volume,to:a}};i.muted&&(s.muted={from:!0,to:!1}),this.emitUserAction(t,"change_volume",{muted:i.muted,volume:i.volume,props:s}),i.volume=Math.max(Math.min(o/1e3,1),0),i.muted&&(i.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,t=e.volume,i=e.muted,n=this.find(".xgplayer-value-label"),r=Math.max(Math.min(t,1),0);n.innerText=i?0:Math.round(100*r)}},{key:"focus",value:function(){this.player.focus({autoHide:!1}),this._timerId&&(Mr.clearTimeout(this,this._timerId),this._timerId=null),Mr.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=this._d,o=this.player;r.isActive||(this._timerId&&(Mr.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=Mr.setTimeout(this,(function(){r.isActive||(i?o.blur():o.focus(),Mr.removeClass(e.root,"slide-show"),r.isStart&&e.onBarMouseUp(n)),e._timerId=null}),t))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var t=this.player;this._d.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:t.muted,volume:t.volume,props:{muted:{from:t.muted,to:!t.muted}}}),t.volume>0&&(t.muted=!t.muted),t.volume<.01&&(t.volume=this.config.miniVolume)}},{key:"animate",value:function(e,t){e||0===t?this.setAttr("data-state","mute"):t<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(Mr.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon","mobile"===Vr.device?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,t=this.config.showValueLabel;return'\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(t?'<div class="xgplayer-value-label">'.concat(100*e,"</div>"):"",'\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ').concat(100*e,'%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>')}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),i}(ba);function kL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">\n <g>\n <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>\n <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>\n </g>\n <defs>\n <clipPath>\n <rect width="40" height="40" fill="white"/>\n </clipPath>\n </defs>\n</svg>\n',"image/svg+xml").firstChild}var IL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),(n=t.call(this,e)).rotateDeg=n.config.rotateDeg||0,n}return yr(i,[{key:"afterCreate",value:function(){var e=this;if(!this.config.disable){Cr(_r(i.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(Ao,(function(){e.rotateDeg&&e.config.innerRotate&&Mr.setTimeout(e,(function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)}),100)}));var t=this.player.root;this.rootWidth=t.style.width||t.offsetWidth||t.clientWidth,this.rootHeight=t.style.height||t.offsetHeight||t.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,t){if(e||(e=0),t)this.player.videoRotateDeg=e;else{var i=this.player,n=this.rootWidth,r=this.rootHeight,o=i.root,a=i.innerContainer,s=i.media,l=o.offsetWidth,c=a&&t?a.offsetHeight:o.offsetHeight,u=n,h=r,d=0,f=0;.75!==e&&.25!==e||(u="".concat(c,"px"),h="".concat(l,"px"),d=-(c-l)/2,f=-(l-c)/2);var p="translate(".concat(d,"px,").concat(f,"px) rotate(").concat(e,"turn)"),g={transformOrigin:"center center",transform:p,webKitTransform:p,height:h,width:u},y=t?s:o,v=t?i.getPlugin("poster"):null;Object.keys(g).map((function(e){y.style[e]=g[e],v&&v.root&&(v.root.style[e]=g[e])}))}}},{key:"rotate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.player;this.rotateDeg||(this.rotateDeg=0);var r=e?1:-1;this.rotateDeg=(this.rotateDeg+1+.25*r*i)%1,this.updateRotateDeg(this.rotateDeg,t),n.emit(xo,360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:kL}}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-icon class="xgplayer-rotate">\n <div class="xgplayer-icon">\n </div>\n '.concat(kO(this,"ROTATE_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),i}(dL);function PL(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}function DL(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}var wL="picture-in-picture",AL="inline",RL="fullscreen",xL=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"switchPIP",(function(t){if(!e.isPIPAvailable())return!1;t.stopPropagation&&t.stopPropagation(),e.isPip?(e.exitPIP(),e.emitUserAction(t,"change_pip",{props:"pip",from:!0,to:!1}),e.setAttr("data-state","normal")):4===e.player.media.readyState&&(e.requestPIP(),e.emitUserAction(t,"change_pip",{props:"pip",from:!1,to:!0}),e.setAttr("data-state","pip"))})),e}return yr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.pip&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(Cr(_r(i.prototype),"afterCreate",this).call(this),this.pMode=AL,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(vo,(function(){e.config.showIcon&&(Mr.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))})))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:PL,class:"xg-get-pip"},pipIconExit:{icon:DL,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var e=this,t=this.player;this.leavePIPCallback=function(){var i=t.paused;Mr.setTimeout(e,(function(){!i&&t.mediaPlay()}),0),!i&&t.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,t.emit(Ro,!1)},this.enterPIPCallback=function(i){t.emit(Ro,!0),null!=i&&i.pictureInPictureWindow&&(e.pipWindow=i.pictureInPictureWindow),e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(i){var n=t.media.webkitPresentationMode;e.pMode===RL&&n!==RL&&t.onFullscreenChange(null,!1),e.pMode=n,n===wL?e.enterPIPCallback(i):n===AL&&e.leavePIPCallback(i)},t.media&&(t.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),t.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),i.checkWebkitSetPresentationMode(t.media)&&t.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"copyStyleIntoPiPWindow",value:function(e){var t=kr(document.styleSheets).map((function(t){try{return kr(t.cssRules).map((function(e){return e.cssText})).join("")}catch(n){var i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media,i.href=t.href,e.document.head.appendChild(i)}return""})).filter(Boolean).join("\n"),i=document.createElement("style");i.textContent=t,e.document.head.appendChild(i)}},{key:"requestPIP",value:function(){var e=this,t=this.player,n=this.playerConfig,r=this.config;if(this.isPIPAvailable()&&!this.isPip)try{var o=n.poster;if(o&&(t.media.poster="String"===Mr.typeOf(o)?o:o.poster),r.preferDocument&&this.isDocPIPAvailable()){var a={};if(r.width&&r.height)a.width=r.width,a.height=r.height;else{var s=t.root.getBoundingClientRect();a.width=s.width,a.height=s.height}documentPictureInPicture.requestWindow(a).then((function(i){var n=r.docPiPNode,o=r.docPiPStyle;e.enterPIPCallback();var a=n||t.root,s=a.parentElement,l=a.previousSibling,c=a.nextSibling;e.copyStyleIntoPiPWindow(i);var u=document.createElement("style");if(u.append("body{padding:0; margin:0;}"),o){var h="";"string"==typeof o?h=o:"function"==typeof o&&(h=o.call(r)),h&&u.append(h)}else a===t.root&&u.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");i.document.head.append(u),i.document.body.append(a),i.addEventListener("pagehide",(function(t){s&&(c?s.insertBefore(a,c):l?s.insertBefore(a,l.nextSibling):s.appendChild(a)),e.leavePIPCallback()}),{once:!0})}))}else i.checkWebkitSetPresentationMode(t.media)?t.media.webkitSetPresentationMode("picture-in-picture"):t.media.requestPictureInPicture();return!0}catch(l){return console.error("requestPiP",l),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{var t;if(this.isPIPAvailable()&&this.isPip)this.isDocPIPAvailable()&&null!==(t=documentPictureInPicture)&&void 0!==t&&t.window?documentPictureInPicture.window.close():i.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture();return!0}catch(n){return console.error("exitPIP",n),!1}}},{key:"isPip",get:function(){var e,t=this.player;return!(!this.isDocPIPAvailable()||null===(e=documentPictureInPicture)||void 0===e||!e.window)||document.pictureInPictureElement&&document.pictureInPictureElement===t.media||t.media.webkitPresentationMode===wL}},{key:"isPIPAvailable",value:function(){var e=this.player.media;return"Boolean"===Mr.typeOf(document.pictureInPictureEnabled)&&document.pictureInPictureEnabled&&("Boolean"===Mr.typeOf(e.disablePictureInPicture)&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&"Function"===Mr.typeOf(e.webkitSetPresentationMode))||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return"documentPictureInPicture"in window&&/^(https|file)/.test(location.protocol)}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this);var e=this.player;e.media.removeEventListener("enterpictureinpicture",this.enterPIPCallback),e.media.removeEventListener("leavepictureinpicture",this.leavePIPCallback),i.checkWebkitSetPresentationMode(e.media)&&e.media.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.exitPIP(),this.unbind("click",this.btnClick)}},{key:"render",value:function(){if(this.config.showIcon&&this.isPIPAvailable())return'<xg-icon class="xgplayer-pip">\n <div class="xgplayer-icon xg-icon-disable">\n </div>\n '.concat(kO(this,"PIP",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return"function"==typeof e.webkitSetPresentationMode}}]),i}(dL);function OL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">\n <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>\n</svg>\n',"image/svg+xml").firstChild}var LL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"playNext",(function(e){var t=Tr(n).player;e.preventDefault(),e.stopPropagation(),n.idx+1<n.config.urlList.length?(n.idx++,n.nextHandler(n.config.urlList[n.idx],n.idx),t.emit(Lo,n.idx+1)):(n.nextHandler(),t.emit(Lo))})),n.idx=-1,n}return yr(i,[{key:"afterCreate",value:function(){this.config.urlList&&0!==this.config.urlList.length&&(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:OL}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e="mobile"===Vr.device?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var t=this.player;e&&(t.pause(),t.currentTime=0,t.switchURL?t.switchURL(e):t.src=e,t.config.url=e,t.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(this.config.urlList&&0!==this.config.urlList.length)return'\n <xg-icon class="xgplayer-playnext">\n <div class="xgplayer-icon">\n </div>\n '.concat(kO(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),i}(ba),NL={exports:{}};!function(e,t){e.exports=function e(t,i,n){var r,o,a=window,s="application/octet-stream",l=n||s,c=t,u=!i&&!n&&c,h=document.createElement("a"),d=function(e){return String(e)},f=a.Blob||a.MozBlob||a.WebKitBlob||d,p=i||"download";if(f=f.call?f.bind(a):Blob,"true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),u&&u.length<2048&&(p=u.split("/").pop().split("?")[0],h.href=u,-1!==h.href.indexOf(u))){var g=new XMLHttpRequest;return g.open("GET",u,!0),g.responseType="blob",g.onload=function(t){e(t.target.response,p,s)},setTimeout((function(){g.send()}),0),g}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)){if(!(c.length>2096103.424&&f!==d))return navigator.msSaveBlob?navigator.msSaveBlob(_(c),p):E(c);l=(c=_(c)).type||s}else if(/([\x80-\xff])/.test(c)){for(var y=0,v=new Uint8Array(c.length),m=v.length;y<m;++y)v[y]=c.charCodeAt(y);c=new f([v],{type:l})}function _(e){for(var t=e.split(/[:;,]/),i=t[1],n=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=n.length,o=0,a=new Uint8Array(r);o<r;++o)a[o]=n.charCodeAt(o);return new f([a],{type:i})}function E(e,t){if("download"in h)return h.href=e,h.setAttribute("download",p),h.className="download-js-link",h.innerHTML="downloading...",h.style.display="none",document.body.appendChild(h),setTimeout((function(){h.click(),document.body.removeChild(h),!0===t&&setTimeout((function(){a.URL.revokeObjectURL(h.href)}),250)}),66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,s)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var i=document.createElement("iframe");document.body.appendChild(i),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,s)),i.src=e,setTimeout((function(){document.body.removeChild(i)}),333)}if(r=c instanceof f?c:new f([c],{type:l}),navigator.msSaveBlob)return navigator.msSaveBlob(r,p);if(a.URL)E(a.URL.createObjectURL(r),!0);else{if("string"==typeof r||r.constructor===d)try{return E("data:"+l+";base64,"+a.btoa(r))}catch(T){return E("data:"+l+","+encodeURIComponent(r))}(o=new FileReader).onload=function(e){E(this.result)},o.readAsDataURL(r)}return!0}}(NL);const ML=sr(NL.exports);function UL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">\n <g id="Group-2">\n <g id="volme_big-copy" transform="translate(488.000000, 340.000000)">\n <rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>\n <rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>\n <rect id="Rectangle-2" transform="translate(4.000000, 17.500000) rotate(90.000000) translate(-4.000000, -17.500000) " x="1.5" y="16.5" width="5" height="2" rx="1"></rect><rect id="Rectangle-2-Copy-3" transform="translate(20.000000, 17.500000) rotate(90.000000) translate(-20.000000, -17.500000) " x="17.5" y="16.5" width="5" height="2" rx="1"></rect>\n <path d="M9.48791171,8.26502656 L9.48791171,14.2650266 C9.48791171,14.8173113 9.04019646,15.2650266 8.48791171,15.2650266 C7.93562696,15.2650266 7.48791171,14.8173113 7.48791171,14.2650266 L7.48791171,7.26502656 C7.48791171,6.71274181 7.93562696,6.26502656 8.48791171,6.26502656 L15.4879117,6.26502656 C16.0401965,6.26502656 16.4879117,6.71274181 16.4879117,7.26502656 C16.4879117,7.81731131 16.0401965,8.26502656 15.4879117,8.26502656 L9.48791171,8.26502656 Z" id="Combined-Shape" transform="translate(11.987912, 10.765027) scale(1, -1) rotate(45.000000) translate(-11.987912, -10.765027) "></path>\n </g>\n </g>\n </g>\n </g>\n</svg>\n',"image/svg+xml").firstChild}var BL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"download",(function(e){if(!n.isLock){n.emitUserAction(e,"download");var t=n.playerConfig.url,i="";"String"===Mr.typeOf(t)?i=t:"Array"===Mr.typeOf(t)&&t.length>0&&(i=t[0].src);var r=n.getAbsoluteURL(i);ML(r),n.isLock=!0,n.timer=window.setTimeout((function(){n.isLock=!1,window.clearTimeout(n.timer),n.timer=null}),300)}})),n.timer=null,n.isLock=!1,n}return yr(i,[{key:"afterCreate",value:function(){Cr(_r(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:UL}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var t=document.createElement("div");t.innerHTML='<a href="'.concat(e,'">x</a>'),e=t.firstChild.href}return e}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n <div class="xgplayer-icon">\n </div>\n '.concat(kO(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:3,disable:!0}}}]),i}(dL),FL=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.screenShot&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){Cr(_r(i.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(t){e.fitVideo&&(e.width=t.vWidth,e.height=t.vHeight)},this.once(Ao,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,t){var i,n=document.createElement("a");n.href=e,n.download=t;try{"undefined"!=typeof MouseEvent?i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(i=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}catch(r){console.error("MouseEvent unsupported",r)}i&&n.dispatchEvent(i)}},{key:"createCanvas",value:function(e,t){var i=document.createElement("canvas"),n=i.getContext("2d");this.canvasCtx=n,this.canvas=i,i.width=e||this.config.width,i.height=t||this.config.height,n.imageSmoothingEnabled=!0,n.imageSmoothingEnabled&&(n.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var t=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var i=this.config;this.shot(i.width,i.height).then((function(e){t.emit(Oo,e),i.saveImg&&t.saveScreenShot(e,i.name+i.format)}))}},{key:"shot",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{quality:.92,type:"image/png"},r=this.config,o=this.player,a=n.quality||r.quality,s=n.type||r.type;return new Promise((function(n,l){var c,u=null;if(o.media.canvas)u=o.media.canvas;else{i.canvas?(i.canvas.width=e||r.width,i.canvas.height=t||r.height):i.createCanvas(e,t),u=i.canvas,c=i.canvasCtx;var h,d,f,p,g=o.media.videoWidth/o.media.videoHeight,y=u.width/u.height,v=o.media.videoWidth,m=o.media.videoHeight;g>y?(f=u.width,p=u.width/g,h=0,d=Math.round((u.height-p)/2)):g===y?(f=u.width,p=u.height,h=0,d=0):g<y&&(f=u.height*g,p=u.height,h=Math.round((u.width-f)/2),d=0),c.drawImage(o.media,0,0,v,m,h,d,f,p)}var _=u.toDataURL(s,a).replace(s,"image/octet-stream");n(_=_.replace(/^data:image\/[^;]+/,"data:application/octet-stream"))}))}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(Ao,this.initSize)}},{key:"render",value:function(){if(!this.config.disable){var e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",t="SCREENSHOT";return'\n <xg-icon class="xgplayer-shot">\n <div class="'.concat(e,'">\n ').concat(this.icons.screenshotIcon?"":'<span lang-key="'.concat(this.i18nKeys[t],'">').concat(this.i18n[t],"</span>"),"\n </div>\n </xg-icon>")}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),i}(dL),HL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),(n=t.call(this,e)).curTime=0,n.isPaused=!0,n}return yr(i,[{key:"beforeCreate",value:function(e){var t=e.config.list;Array.isArray(t)&&t.length>0&&(e.config.list=t.map((function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})))}},{key:"afterCreate",value:function(){var e=this;Cr(_r(i.prototype),"afterCreate",this).call(this),this.on("resourceReady",(function(t){e.changeDefinitionList(t)})),this.on(Do,(function(t){e.renderItemList(e.config.list,t.to)})),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||Mr.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,t=e.list,i=e.defaultDefinition;if(t.length>0){var n=null;t.map((function(e){e.definition===i&&(n=e)})),n||(n=t[0]),this.changeDefinition(n)}}},{key:"renderItemList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,r=n&&n.definition?n.definition:this.config.defaultDefinition;n&&t.forEach((function(e){e.selected=!1}));var o=0,a=t.map((function(t,i){var n=dr(dr({},t),{},{showText:e.getTextByLang(t)||t.definition,selected:!1});return(t.selected||t.definition&&t.definition==r)&&(n.selected=!0,o=i),n}));Cr(_r(i.prototype),"renderItemList",this).call(this,a,o)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map((function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,t){this.player.changeDefinition(e,t)}},{key:"onItemClick",value:function(e,t){var n=this.player.definitionList;Cr(_r(i.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:t.from,to:t.to});for(var r=0;r<n.length;r++)t.to&&n[r].definition===t.to.definition&&(t.to.url=n[r].url),t.from&&n[r].definition===t.from.definition&&(t.from.url=n[r].url);this.player.changeDefinition(t.to,t.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return dr(dr({},xA.defaultConfig),{},{position:va.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),i}(xA),jL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),(n=t.call(this,e)).curRate=1,n}return yr(i,[{key:"beforeCreate",value:function(e){var t=e.player.config.playbackRate,i=t?Array.isArray(t)?t:e.config.list:[];Array.isArray(i)&&(e.config.list=i.map((function(e){return"number"==typeof e?e={rate:e,text:"".concat(e,"x")}:!e.text&&e.rate&&(e.text="".concat(e.rate,"x")),e})))}},{key:"afterCreate",value:function(){var e=this;Cr(_r(i.prototype),"afterCreate",this).call(this),this.on(ao,(function(){e.curValue!==e.player.playbackRate&&e.renderItemList()})),this.renderItemList()}},{key:"show",value:function(e){this.config.list&&0!==this.config.list.length&&Cr(_r(i.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,t){Cr(_r(i.prototype),"onItemClick",this).call(this,e,t);var n=e.delegateTarget,r=Number(n.getAttribute("rate"));if(!r||r===this.curValue)return!1;var o={playbackRate:{from:this.player.playbackRate,to:r}};this.emitUserAction(e,"change_rate",{props:o}),this.curValue=r,this.player.playbackRate=r}},{key:"renderItemList",value:function(){var e=this,t=this.player.playbackRate||1;this.curValue=t;var n=-1,r=this.config.list.map((function(i,r){var o={rate:i.rate};return o.rate===t&&(o.selected=!0,n=r),o.showText=e.getTextByLang(i),o}));Cr(_r(i.prototype),"renderItemList",this).call(this,r,n)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0],i="";i=!t||this.curIndex<0?"".concat(this.player.playbackRate,"x"):this.getTextByLang(t,"iconText"),this.find(".icon-text").innerHTML=i}}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return dr(dr({},xA.defaultConfig),{},{position:va.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),i}(xA);function VL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" class=\'path_full\' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}function KL(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var WL=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.cssFullscreen&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;Cr(_r(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Io,(function(t){e.animate(t)})),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,t=this.find(".xgplayer-icon");t.appendChild(e.cssFullscreen),t.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:t}),t?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var t=this.i18nKeys,i=this.find(".xg-tips");i&&this.changeLangTextKey(i,e?t.EXITCSSFULLSCREEN_TIPS:t.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:VL,class:"xg-get-cssfull"},exitCssFullscreen:{icon:KL,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){Cr(_r(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return"<xg-icon class='xgplayer-cssfullscreen'>\n <div class=\"xgplayer-icon\">\n </div>\n ".concat(kO(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:va.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),i}(dL),GL=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(Zr,(function(t){e.onError(t)}))}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.player,i=e.errorType,n=t.errorNote?this.i18n[t.errorNote]:"";if(!n)switch(i){case"decoder":n=this.i18n.MEDIA_ERR_DECODE;break;case"network":n=this.i18n.MEDIA_ERR_NETWORK;break;default:n=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=n,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return'<xg-error class="xgplayer-error">\n <div class="xgplayer-errornote">\n <span class="xgplayer-error-text"></span>\n <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n </div>\n </xg-error>'}}],[{key:"pluginName",get:function(){return"error"}}]),i}(ba),YL=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],(function(t){(e.config.onClick||e.customOnClick)&&(t.preventDefault(),t.stopPropagation(),e.customOnClick?e.customOnClick(t):e.config.onClick(t))})),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var t=this;Object.keys(e).map((function(i){t.root.style[i]=e[i]}))}},{key:"showPrompt",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){this.customOnClick=n;var r=this.config.interval;if(this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),Mr.addClass(this.root,"show"),"arrow"===i.mode&&Mr.addClass(this.root,"arrow"),this.find(".xgplayer-prompt-detail").innerHTML="string"==typeof e?e:"".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),i.style&&this.setStyle(i.style),"boolean"==typeof i.autoHide?i.autoHide:this.config.autoHide){var o=i.interval||r;this.intervalId=setTimeout((function(){t.hide()}),o)}}}},{key:"hide",value:function(){Mr.removeClass(this.root,"show"),Mr.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(Ia.CONTROLS_FOLLOW,'">\n <span class="xgplayer-prompt-detail"></span>\n </xg-prompt>')}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),i}(ba),zL={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function $L(e){Object.keys(zL).map((function(t){void 0===e[t]&&(e[t]=zL[t])}))}var XL={_updateDotDom:function(e,t){if(t){var i=this.calcuPosition(e.time,e.duration),n=e.style||{};n.left="".concat(i.left,"%"),n.width="".concat(i.width,"%"),t.setAttribute("data-text",e.text),t.setAttribute("data-time",e.time),i.isMini?Mr.addClass(t,"mini"):Mr.removeClass(t,"mini"),Object.keys(n).map((function(e){t.style[e]=n[e]}))}},initDots:function(){var e=this;this._ispots.map((function(t){e.createDot(t,!1)})),this.ispotsInit=!0},createDot:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.player.plugins.progress;if(i&&(t&&($L(e),this._ispots.push(e)),this.ispotsInit||!t)){var n=this.calcuPosition(e.time,e.duration),r=e.style||{};r.left="".concat(n.left,"%"),r.width="".concat(n.width,"%");var o="xgspot_".concat(e.id," xgplayer-spot");n.isMini&&(o+=" mini");var a=e.template?'<div class="xgplayer-spot-pop">'.concat(e.template,"</div>"):"",s=Mr.createDom("xg-spot",a,{"data-text":e.text,"data-time":e.time,"data-id":e.id},o);Object.keys(r).map((function(e){s.style[e]=r[e]})),i.outer&&i.outer.appendChild(s),this.positionDot(s,e.id)}},findDot:function(e){if(this.player.plugins.progress){var t=this._ispots.filter((function(t,i){return t.id===e}));return t.length>0?t[0]:null}},updateDot:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.player.plugins.progress;if(i){var n=this.findDot(e.id);if(n&&Object.keys(e).map((function(t){n[t]=e[t]})),this.ispotsInit){var r=i.find('xg-spot[data-id="'.concat(e.id,'"]'));r&&(this._updateDotDom(e,r),t&&this.showDot(e.id))}}},deleteDot:function(e){var t=this._ispots,i=this.player.plugins.progress;if(i){for(var n=[],r=0;r<t.length;r++)t[r].id===e&&n.push(r);for(var o=n.length-1;o>=0;o--)if(t.splice(n[o],1),this.ispotsInit){var a=i.find('xg-spot[data-id="'.concat(e,'"]'));a&&a.parentElement.removeChild(a)}}},deleteAllDots:function(){var e=this.player.plugins.progress;if(e)if(this.ispotsInit){for(var t=e.root.getElementsByTagName("xg-spot"),i=t.length-1;i>=0;i--)e.outer.removeChild(t[i]);this._ispots=[]}else this._ispots=[]},updateAllDots:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=this.player.plugins.progress;if(i)if(this.ispotsInit){this._ispots=[];var n=i.root.getElementsByTagName("xg-spot"),r=n.length;if(r>t.length)for(var o=r-1;o>t.length-1;o--)i.outer.removeChild(n[o]);t.forEach((function(t,i){i<r?(n[i].setAttribute("data-id","".concat(t.id)),e._ispots.push(t),e.updateDot(t)):e.createDot(t)}))}else this._ispots=t},positionDots:function(){var e=this,t=this._ispots,i=this.playerSize,n=this.player.sizeInfo,r=this.player.plugins.progress;r&&n.width!==i.width&&(i.width=n.width,i.left=n.left,t.forEach((function(t){var i=r.find('xg-spot[data-id="'.concat(t.id,'"]'));i&&e.positionDot(i,t.id)})))},positionDot:function(e,t){var i=Mr.findDom(e,".xgplayer-spot-pop");if(i){var n=this.playerSize,r=e.getBoundingClientRect(),o=i.getBoundingClientRect(),a=r.left-n.left,s=n.width-a-r.width/2;if(a<o.width/2||n.width<o.width){var l=o.width/2-a;i.style.left="".concat(l,"px")}else if(s<o.width/2){var c=s-o.width/2+r.width/2;i.style.left="".concat(c,"px")}else i.style.left="50%"}},updateDuration:function(){var e=this,t=this.player.plugins.progress;t&&this._ispots.forEach((function(i){var n=t.find('xg-spot[data-id="'.concat(i.id,'"]'));e._updateDotDom(i,n)}))},getAllDotsDom:function(){var e=this.player.plugins.progress;return e?e.root.getElementsByTagName("xg-spot"):[]},getDotDom:function(e){var t=this.player.plugins.progress;if(t)return t.find('xg-spot[data-id="'.concat(e,'"]'))}};var qL={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},ZL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),vr(Tr(n=t.call(this,e)),"onMousemove",(function(e){n.config.disable||(Mr.hasClass(e.target,"xg-spot-content")&&n.config.isHideThumbnailHover?n.player.plugins.progress.onMouseLeave(e):(n._state.f||Mr.hasClass(e.target,"xg-spot-content"))&&(Mr.event(e),e.stopPropagation()))})),vr(Tr(n),"onMousedown",(function(e){n.config.disable||(n._state.f||Mr.hasClass(e.target,"xg-spot-content"))&&(Mr.event(e),e.stopPropagation())})),vr(Tr(n),"onMouseup",(function(e){if(n.isDrag){var t=n.player.plugins.progress;t&&t.pos&&(t.onMouseUp(e),!t.pos.isEnter&&t.onMouseLeave(e))}})),vr(Tr(n),"onDotMouseLeave",(function(e){if(!n.config.disable){n._curDot.removeEventListener("mouseleave",n.onDotMouseLeave),n.blurDot(e.target),n._curDot=null;var t=n.player.plugins.progress;t&&t.enableBlur(),n.show()}})),vr(Tr(n),"onProgressMouseOver",(function(e,t){if(!n.config.disable&&Mr.hasClass(t.target,"xgplayer-spot")&&!n._curDot){n._curDot=t.target,n.focusDot(t.target),n._curDot.children.length>0&&n.hide();var i=n.player.plugins.progress;i&&i.disableBlur(),n._curDot.addEventListener("mouseleave",n.onDotMouseLeave)}})),n._ispots=[],n.videoPreview=null,n.videothumbnail=null,n.thumbnail=null,n.timeStr="",n._state={now:0,f:!1},n}return yr(i,[{key:"beforeCreate",value:function(e){var t=e.player.plugins.progress;t&&(e.root=t.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",(function(t,i){i.seekTime&&e.player.seek(i.seekTime)})),this.transformTimeHook=this.hook("transformTime",(function(t){e.setTimeContent(Mr.format(t))})),function(e){var t=e.config,i=e.player;Object.keys(XL).map((function(t){e[t]=XL[t].bind(e)}));var n=i.config.progressDot||t.ispots||[];e._ispots=n.map((function(e){return $L(e),e})),e.ispotsInit=!1,e.playerSize={left:i.sizeInfo.left,width:i.sizeInfo.width},e.on(no,(function(){e.ispotsInit?e.updateDuration():e.initDots()})),e.on(Ao,(function(){e.positionDots()}))}(this),this.on(no,(function(){e.show()})),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(i){t.config[i]=e[i]}))}},{key:"onPluginsReady",value:function(){this.player.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e=this,t=this.player.plugins.progress;if(t&&(Object.keys(qL).map((function(i){e[qL[i]]=e[qL[i]].bind(e),t.addCallBack(i,e[qL[i]])})),"mobile"!==Vr.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 i=this.hook("previewClick",(function(){}));this.handlerPreviewClick=function(n){n.stopPropagation(),i(parseInt(1e3*e._state.now,10)/1e3,n),t&&t.onMouseUp(n)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,t){!this.config.disable&&this.player.duration&&this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!0,this.videoPreview&&Mr.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!1,this.videoPreview&&Mr.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,t){this.config.disable||Mr.hasClass(t.target,"xgplayer-spot")&&(t.stopPropagation(),t.preventDefault(),["time","id","text"].map((function(i){e[i]=t.target.getAttribute("data-".concat(i))})),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(t,e))}},{key:"updateLinePos",value:function(e,t){var i=this.root,n=this.previewLine,r=this.player,o=this.config,a="flex"===r.controls.mode,s=i.getBoundingClientRect().width;if(s||!this._hasThumnail){var l,c=e-(s=this._hasThumnail&&s<o.width?o.width:s)/2;c<0&&!a?(c=0,l=e-s/2):c>t-s&&!a?(l=c-(t-s),c=t-s):l=0,void 0!==l&&(n.style.transform="translateX(".concat(l.toFixed(2),"px)")),i.style.transform="translateX(".concat(c.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var t=this.timeText,i=this.timePoint;t.innerHTML=e,!this.thumbnail&&(i.innerHTML=e)}},{key:"updatePosition",value:function(e,t,i,n){var r=this.root,o=this.config,a=this._state;if(r){a.now=i,this.transformTimeHook(i);var s=this.timeStr;n&&n.target&&Mr.hasClass(n.target,"xgplayer-spot")?(this.showTips(n.target.getAttribute("data-text"),!1,s),this.focusDot(n.target),a.f=!0,o.isFocusDots&&a.f&&(a.now=parseInt(n.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),this.updateLinePos(e,t)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var t=this.player,i=this.videoPreview,n=this.config,r=t.plugins.thumbnail;if(r&&r.usable){this.thumbnail&&r.update(this.thumbnail,e,n.width,n.height);var o=i&&i.getBoundingClientRect();this.videothumbnail&&r.update(this.videothumbnail,e,o.width,o.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("mobile"!==Vr.device){var t=this.player,i=this.config,n=t.getPlugin("thumbnail");if(n&&n.setConfig(e),n&&n.usable&&i.isShowThumbnail){Mr.removeClass(this.root,"short-line no-thumbnail"),"short"===i.mode&&Mr.addClass(this.root,"short-line"),this._hasThumnail=!0;var r=this.find(".xg-spot-thumbnail");this.thumbnail=n.createThumbnail(r,"progress-thumbnail"),i.isShowCoverPreview&&(this.videoPreview=Mr.createDom("xg-video-preview","",{},"xgvideo-preview"),t.root.appendChild(this.videoPreview),this.videothumbnail=n.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}else Mr.addClass(this.root,"short-line no-thumbnail")}}},{key:"calcuPosition",value:function(e,t){var i=this.player.plugins.progress,n=this.player,r=i.root.getBoundingClientRect().width,o=n.duration/r*6;return e+t>n.duration&&(t=n.duration-e),n.duration,n.duration,{left:e/n.duration*100,width:t/n.duration*100,isMini:t<o}}},{key:"showDot",value:function(e){var t=this.findDot(e);if(t){var i=this.root.getBoundingClientRect().width,n=t.time/this.player.duration*i;this.updatePosition(n,i,t.time)}}},{key:"focusDot",value:function(e,t){e&&(t||(t=e.getAttribute("data-id")),Mr.addClass(e,"active"),this._activeDotId=t)}},{key:"blurDot",value:function(e){if(!e){var t=this._activeDotId;e=this.getDotDom(t)}e&&(Mr.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";Mr.addClass(this.root,"no-timepoint"),e&&(Mr.addClass(this.find(".xg-spot-content"),"show-text"),t&&"production"===this.config.mode?(Mr.addClass(this.root,"product"),this.tipText.textContent=e):(Mr.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(i," ").concat(e)))}},{key:"hideTips",value:function(){Mr.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",Mr.removeClass(this.find(".xg-spot-content"),"show-text"),Mr.removeClass(this.root,"product")}},{key:"hide",value:function(){Mr.addClass(this.root,"hide")}},{key:"show",value:function(e){Mr.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,t=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(t.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,t=this.player.plugins.progress;t&&Object.keys(qL).map((function(i){t.removeCallBack(i,e[qL[i]])})),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"===Vr.device||"mobile"===this.playerConfig.isMobileSimulateMode?"":'<div class="xg-spot-info hide '.concat("short"===this.config.mode?"short-line":"",'">\n <div class="xg-spot-content">\n <div class="xg-spot-thumbnail">\n <span class="xg-spot-time"></span>\n </div>\n <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n </div>\n <div class="xgplayer-progress-point">00:00</div>\n <div class="xg-spot-ext-text"></div>\n <div class="xg-spot-line"></div>\n </div>')}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),i}(ba),QL=function(e){mr(i,e);var t=Sr(i);function i(e){var n;return pr(this,i),(n=t.call(this,e)).ratio=1,n.interval=null,n._preloadMark={},n}return yr(i,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([no],(function(){var t=e.config,i=t.pic_num,n=t.interval;e.usable&&(e.interval=n>0?n:Math.round(1e3*e.player.duration/i)/1e3)}))}},{key:"setConfig",value:function(e){var t=this;if(e){var i=Object.keys(e);i.length<1||(i.forEach((function(i){t.config[i]=e[i]})),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,t=e.urls,i=e.pic_num;return t&&t.length>0&&i>0}},{key:"initThumbnail",value:function(){var e=this.config,t=e.width,i=e.height,n=e.pic_num,r=e.interval;this.ratio=t/i*100,this.interval=r||Math.round(this.player.duration/n),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var t=this;if(!this._preloadMark[e]){var i=this.config.urls,n=i.length,r=[];e>0&&r.push(e-1),r.push(e),e>0&&e<n-1&&r.push(e+1),r.map((function(e){!t._preloadMark[e]&&e>=0&&e<n&&(t._preloadMark[e]=1,Mr.preloadImg(i[e],(function(){t._preloadMark[e]=2})))}))}}},{key:"getPosition",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.config,r=n.pic_num,o=n.row,a=n.col,s=n.width,l=n.height;this.interval=Math.round(this.player.duration/r);var c=Math.ceil(e/this.interval),u=(c=c>r?r:c)<o*a?0:Math.ceil(c/(o*a))-1,h=c-u*(a*o),d=h>0?Math.ceil(h/a)-1:0,f=h>0?h-d*a-1:0,p=0,g=0;t&&i?t/i<s/l?p=(g=i)*(s/l):g=(p=t)/(s/l):i?t||(p=(g=i||l)*(s/l)):g=(p=t||s)/(s/l);var y=this.getUrlByIndex(u);return{urlIndex:u,rowIndex:d,colIndex:f,url:y,height:g,width:p,style:{backgroundImage:"url(".concat(y,")"),backgroundSize:"".concat(p*a,"px auto"),backgroundPosition:"-".concat(f*p,"px -").concat(d*g,"px"),width:"".concat(p,"px"),height:"".concat(g,"px")}}}},{key:"update",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=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 l=this.getPosition(t,i,n);this.preload(l.urlIndex),Object.keys(l.style).map((function(t){e.style[t]=l.style[t]})),Object.keys(r).map((function(t){e.style[t]=r[t]}))}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,t){var i=Mr.createDom("xg-thumbnail","",{},"thumbnail ".concat(t));return e&&e.appendChild(i),i}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),i}(ba);function JL(e){return e?"background:".concat(e,";"):""}var eN=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onTimeupdate",(function(){var t=e.player.ended,i=Tr(e).offsetDuration,n=e.currentTime;n=Mr.adjustTimeByDuration(n,i,t),e.update({played:n},i)})),e}return yr(i,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(eo,this.onTimeupdate),this.on(co,(function(){e.reset()})))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;t&&this.root&&(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/t*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/t*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,t=e.commonStyle;if(e.miniprogress){var i=this.config,n=i.mode,r=i.height,o={cached:JL(t.cachedColor),played:JL(t.playedColor),progress:JL(t.progressColor),height:r>0&&2!==r?"height: ".concat(r,"px;"):""};return'<xg-mini-progress class="xg-mini-progress '.concat("show"===n?"xg-mini-progress-show":"",'" style="').concat(o.progress," ").concat(o.height,'">\n <xg-mini-progress-cache class="xg-mini-progress-cache" style="').concat(o.cached,'"></xg-mini-progress-cache>\n <xg-mini-progress-played class="xg-mini-progress-played" style="').concat(o.played,'"></xg-mini-progress-played>\n </xg-mini-progress>')}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),i}(ba),tN="realtime",iN="firstframe",nN="poster";var rN=null,oN=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onLoadedData",(function(t){e.player&&(e._frameCount=e.config.startFrameCount,e.stop(),e.renderOnTimeupdate(t),e.off(eo,e.renderOnTimeupdate),e.on(eo,e.renderOnTimeupdate))})),vr(Tr(e),"onVisibilitychange",(function(t){"visible"===document.visibilityState?e._checkIfCanStart()&&e.start():"hidden"===document.visibilityState&&e.stop()})),vr(Tr(e),"renderOnTimeupdate",(function(t){if(e._frameCount>0)e.renderOnce(),e._frameCount--;else{e._isLoaded=!0,e.off(eo,e.renderOnTimeupdate);var i=e.config.startInterval;!e.player.paused&&e._checkIfCanStart()&&e.start(0,i)}})),vr(Tr(e),"start",(function(t,i){var n=e.player.video,r=function(){try{return parseInt(window.performance.now(),10)}catch(e){return(new Date).getTime()}}(),o=e.checkVideoIsSupport(n);o&&e.canvasCtx&&(i||(i=e.interval),e.stop(),n.videoWidth&&n.videoHeight&&(e.videoPI=n.videoHeight>0?parseInt(n.videoWidth/n.videoHeight*100,10):0,(e.config.mode===tN||r-e.preTime>=i)&&(n&&n.videoWidth&&e.update(o,e.videoPI),e.preTime=r)),e.frameId="timer"===e._loopType?Mr.setTimeout(Tr(e),e.start,i):Mr.requestAnimationFrame(e.start))})),vr(Tr(e),"stop",(function(){e.frameId&&("timer"===e._loopType?Mr.clearTimeout(Tr(e),e.frameId):Mr.cancelAnimationFrame(e.frameId),e.frameId=null)})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this;!0===this.playerConfig.dynamicBg&&(this.config.disable=!1),i.isSupport||(this.config.disable=!0);var t=this.config,n=t.disable,r=t.mode,o=t.frameRate;n||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=parseInt(1e3/o,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==tN&&this.interval>=1e3?"timer":"animation",this.once(vo,(function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())})),r!==nN&&(r!==iN&&(this.on(co,(function(){e.stop()})),this.on(zr,(function(){var t=e.config.startInterval;e._checkIfCanStart()&&e.start(0,t)})),this.on(qr,(function(){e.stop()}))),this.on(oo,this.onLoadedData),this.on(lo,(function(){e._isLoaded=!1,e.stop()})),document.addEventListener("visibilitychange",this.onVisibilitychange)))}},{key:"setConfig",value:function(e){var t=this;Object.keys(e).forEach((function(i){"root"===i&&e[i]!==t.config[i]?t.reRender(e[i]):"frameRate"===i?t.interval=parseInt(1e3/e[i],10):"disable"===i&&e[i]&&t.stop(),t.config[i]=e[i]}))}},{key:"init",value:function(e){var t=this.player,n=this.config;this.canvasFilter=i.supportCanvasFilter();try{var r=e||n.root;r||(r=n.isInnerRender&&t.innerContainer||t.root),r.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,'"><canvas>\n </canvas><xgmask></xgmask></div>')),this.root=r.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(o){Lr.logError("plugin:DynamicBg",o)}}},{key:"reRender",value:function(e){if(this.config.disable||this.root){this.stop();var t=this.root?this.root.parentElement:null;if(t!==e&&t.removeChild(this.root),e){this.init(e),this.renderOnce();var i=this.config.startInterval;this._checkIfCanStart()&&this.start(0,i)}else this.root=null}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var t=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(t&&("safari"!==Vr.browser||!Mr.isMSE(t)))return t;var i=t?t.tagName.toLowerCase():"";return"canvas"===i||"img"===i?t:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var t="String"===Mr.typeOf(e)?e:"String"===Mr.typeOf(e.poster)?e.poster:null;this.updateImg(t)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==iN&&e!==nN}},{key:"renderOnce",value:function(){var e=this.player.video;if(e.videoWidth&&e.videoHeight){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var t=this.checkVideoIsSupport(e);t&&this.update(t,this.videoPI)}}},{key:"updateImg",value:function(e){var t=this;if(e){var i=this.canvas.getBoundingClientRect(),n=i.width,r=i.height,o=new window.Image;o.onload=function(){if(t.canvas&&!t.frameId&&!t.isStart){t.canvas.height=r,t.canvas.width=n;var e=parseInt(n/r*100,10);t.update(o,e),o=null}},o.src=e}}},{key:"update",value:function(e,t){if(this.canvas&&this.canvasCtx&&t)try{var i=this._pos,n=this.config,r=this.canvas.getBoundingClientRect(),o=r.width,a=r.height;if(o!==i.width||a!==i.height||i.pi!==t){var s=parseInt(o/a*100,10);i.pi=t,i.width!==o&&(i.width=this.canvas.width=o),i.height!==a&&(i.height=this.canvas.height=a);var l=a,c=o;s<t?c=parseInt(a*t/100,10):s>t&&(l=parseInt(100*o/t,10)),i.rwidth=c*n.multiple,i.rheight=l*n.multiple,i.x=(o-i.rwidth)/2,i.y=(a-i.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=n.filter),this.canvasCtx.drawImage(e,i.x,i.y,i.rwidth,i.rheight)}catch(u){Lr.logError("plugin:DynamicBg",u)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return"boolean"==typeof rN?rN:rN=function(){try{return!!document.createElement("canvas").getContext}catch(e){return!1}}()}},{key:"supportCanvasFilter",value:function(){return!("safari"===Vr.browser||"firefox"===Vr.browser)}}]),i}(ba),aN="info",sN=Vo,lN=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"_recordUserActions",(function(t){var i=e._getTime(),n=Object.assign({},t,{msg:t.msg||t.action});e._stats[aN].push(dr(dr({type:"userAction"},i),{},{payload:n}))})),vr(Tr(e),"_onReset",(function(){e.reset()})),vr(Tr(e),"_recordInfo",(function(t){e.info(t)})),vr(Tr(e),"_downloadStats",(function(){var t=e.getStats(),i=new Blob([JSON.stringify(t)],{type:"application/json"}),n=window.URL.createObjectURL(i),r=document.createElement("a");r.style.display="none",r.href=n,r.download="player.txt",r.disabled=!1,r.click()})),e}return yr(i,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:(new Date).toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(Uo,this._recordUserActions),this.on(sN.STATS_INFO,this._recordInfo),this.on(sN.STATS_DOWNLOAD,this._downloadStats),this.on(sN.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var t=this._getTime();this._stats[aN].push(dr(dr({},t),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var t=dr({cat:"function",dur:Date.now()-e.startMs,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(t)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(vr(e={},aN,[]),vr(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player.media,t=[],i=0;i<e.buffered.length;i++)t.push({start:e.buffered.start(i),end:e.buffered.end(i)});var n={currentTime:e.currentTime,readyState:e.readyState,buffered:t,paused:e.paused,ended:e.ended};return this._stats.media=n,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){return this._stats[aN].map((function(e){var t=e.payload.data,i="";try{t instanceof Error?i=t.msg:void 0!==t&&(i=JSON.stringify(t))}catch(nF){console.log("err",nF)}return"[".concat(e.timeFormat,"] : ").concat(e.payload.msg," ").concat(i," ")}))}},{key:"_getProfile",value:function(){var e={traceEvents:[]};return this._stats[aN].forEach((function(t){t.payload.profile&&e.traceEvents.push(t.payload)})),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),i}(ca),cN=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onGapJump",(function(){var t=Tr(e),n=t.player,r=t.config;if(n.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(n.media.seeking){if(!e.seekingEventReceived)return}else e.seekingEventReceived=!1;if(!n.media.paused||0===n.media.currentTime||!e.hasPlayed){var o=n.media.buffered,a=r.smallGapLimit||.5,s=r.gapDetectionThreshold||.3,l=n.media.currentTime,c=e._getIndex(o,l,s);if(null!==c&&0!==c){console.log("GapJump bufferRange ",o.start(c),o.end(c));var u=o.start(c)+.1;if(!(u>n.media.duration)){var h=u-l,d=h<=a;h<i.BROWSER_GAP_TOLERANCE||d&&(!1!==r.useGapJump&&(n.media.currentTime=e.isSafari?u+.1:u),e.player&&e.player.emit("detectGap"),console.log("gapJump gapIndex",c," isGapSamll:",d," currentTime:",n.media.currentTime," jumpSize:",l-n.media.currentTime),.08!==u&&n&&n.emit("log",{type:"oneevent",end_type:"gap",vid:n.config.vid,ext:{video_postion:Math.floor(1e3*u)}}))}}}}})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this;!1!==this.config.useGapJump&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(to,this.onGapJump),this.on(zr,(function(){e.hasPlayed=!0})),this.on(Qr,(function(){e.seekingEventReceived=!0})))}},{key:"_getIndex",value:function(e,t,i){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var n=this._getBuffered(e),r=null,o=0;o<n.length;o++){if(n[o].start>t&&(0===o||n[o-1].end-t<=i)){r=o;break}}return r}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),i}(ba);cN.BROWSER_GAP_TOLERANCE=.001;var uN=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"onWaiting",(function(){var t=Tr(e).config;e.jumpCnt>t.jumpCntMax||e.timer||!1===t.useWaitingTimeoutJump||(e.timer=setTimeout(e.onJump,1e3*t.waitingTime))})),vr(Tr(e),"onJump",(function(){var t=Tr(e),i=t.player,n=t.config;if(clearTimeout(e.timer),e.timer=null,!(e.jumpCnt>n.jumpCntMax||!1===n.useWaitingTimeoutJump||i.media.paused&&0!==i.media.currentTime&&e.hasPlayed)){e.jumpSize=n.jumpSize*(e.jumpCnt+1),e.jumpCnt===n.jumpSize&&e.jumpSize<6&&(e.jumpSize=6);var r=i.currentTime+e.jumpSize;r>i.media.duration||(e.jumpCnt++,i.currentTime=r)}})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this,t=this.config,i=t.useWaitingTimeoutJump,n=t.jumpSize;!1!==i&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=n,this.on(to,this.onWaiting),this.on([$r,io],(function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize})),this.on(zr,(function(){e.hasPlayed=!0})))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),i}(ba),hN="cdn",dN=["cdn"],fN=function(e){mr(i,e);var t=Sr(i);function i(){var e;pr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return vr(Tr(e=t.call.apply(t,[this].concat(r))),"getSpeed",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hN;if(!e.speedListCache||!e.speedListCache[t])return 0;if(e.speedListCache[t].length<=0)return 0;var i=0;return e.speedListCache[t].map((function(e){i+=e})),Math.floor(i/e.speedListCache[t].length)})),vr(Tr(e),"startTimer",(function(){Mr.isMSE(e.player.video)||(e.initSpeedList(),e.cnt=0,e.timer=setTimeout(e.testSpeed,e.config.testTimeStep))})),vr(Tr(e),"initSpeedList",(function(){e.speedListCache={},dN.forEach((function(t){e.speedListCache[t]=[]}))})),vr(Tr(e),"_onRealSpeedChange",(function(t){t.speed&&e.appendList(t.speed,t.type||hN)})),vr(Tr(e),"testSpeed",(function(){if(clearTimeout(e.timer),e.timer=null,e.player&&e.config.openSpeed){var t=e.config,i=t.url,n=t.loadSize,r=t.testCnt,o=t.testTimeStep,a=i+(i.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(e.cnt>=r)){e.cnt++;try{var s=(new Date).getTime(),l=null,c=new XMLHttpRequest;e.xhr=c,c.open("GET",a);var u={},h=Math.floor(10*Math.random());u.Range="bytes="+h+"-"+(n+h),u&&Object.keys(u).forEach((function(e){c.setRequestHeader(e,u[e])})),c.onreadystatechange=function(){if(4===c.readyState){e.xhr=null,l=(new Date).getTime();var t=c.getResponseHeader("Content-Length")/1024*8,i=Math.round(1e3*t/(l-s));e.appendList(i),e.timer=setTimeout(e.testSpeed,o)}},c.send()}catch(d){console.error(d)}}}})),vr(Tr(e),"appendList",(function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hN;if(e.speedListCache&&e.speedListCache[i]){var n=e.config.saveSpeedMax;e.speedListCache[i].length>=n&&e.speedListCache[i].shift(),e.speedListCache[i].push(t);var r=Tr(e).player;r&&(i===hN?r.realTimeSpeed=t:r[e.getSpeedName("realTime",i)]=t),e.updateSpeed(i)}})),vr(Tr(e),"updateSpeed",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hN,i=e.getSpeed(t),n=Tr(e).player;if(n)if(t===hN)n.avgSpeed&&i===n.avgSpeed||(n.avgSpeed=i,n.emit(To,{speed:i,realTimeSpeed:n.realTimeSpeed}));else{var r=e.getSpeedName("avg",t);n[r]&&i===n[r]||(n[r]=i,n.emit(To,{speed:i,realTimeSpeed:n.realTimeSpeed}))}})),e}return yr(i,[{key:"afterCreate",value:function(){var e=this.config,t=e.openSpeed,i=e.addSpeedTypeList;(null==i?void 0:i.length)>0&&dN.push.apply(dN,kr(i)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,t&&this.on([oo,mo],this.startTimer)}},{key:"getSpeedName",value:function(e,t){return e+"Speed"+t.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer)return clearTimeout(this.timer),void(this.timer=null);if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([oo,mo],this.startTimer),dN.forEach((function(t){e.speedListCache&&e.speedListCache[t]&&(e.speedListCache[t]=[])})),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&4!==this.xhr.readyState&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:204800,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),i}(ba),pN=function(e){mr(i,e);var t=Sr(i);function i(){return pr(this,i),t.apply(this,arguments)}return yr(i,[{key:"afterCreate",value:function(){var e=this,t=this.player,i=this.config,n=t.media||t.video;(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],i.disabled)||n.getVideoPlaybackQuality&&(this.on(zr,(function(){e._startTick()})),this.on(qr,(function(){e._stopTick()})),this.on(Xr,(function(){e._stopTick()})),this.on(co,(function(){e._stopTick()})))}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout((function(){e._checkDecodeFPS(),e._startTick()}),this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkBuffer",value:function(e,t){for(var i=!1,n=[],r=0;r<t.length;r++){var o=t.start(r),a=t.end(r);if(n.push({start:o,end:a}),o<=e&&e<=a-1){i=!0;break}}return{enoughBuffer:i,buffers:n}}},{key:"_checkStuck",value:function(e,t,i,n){var r=this.player.media||this.player.video,o=document.hidden,a=r.paused,s=r.readyState,l=r.currentTime,c=r.buffered;if(!(o||a||s<4)){var u=this._checkBuffer(l,c),h=u.enoughBuffer,d=u.buffers;h&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:l,buffers:d,curDecodedFrames:e,totalVideoFrames:t,droppedVideoFrames:i,checkInterval:n}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(Ko,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var t=e.getVideoPlaybackQuality(),i=t.totalVideoFrames,n=t.droppedVideoFrames,r=performance.now();if(i&&this._lastCheckPoint){var o=i-this._lastDecodedFrames,a=r-this._lastCheckPoint;this._checkStuck(o,i,n,a)}this._lastDecodedFrames=i,this._lastCheckPoint=r}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),i}(ba);const gN=class extends ba{static get pluginName(){return"poster"}static get defaultConfig(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}set isEndedShow(e){this.config.isEndedShow=e}get isEndedShow(){return this.config.isEndedShow}hide(){Mr.addClass(this.root,"hide")}show(){return Mr.removeClass(this.root,"hide"),""}beforeCreate(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}afterCreate(){this.on(Xr,(()=>{this.isEndedShow&&Mr.removeClass(this.root,"hide")})),this.config.hideCanplay?(this.once(eo,(()=>{this.onTimeUpdate()})),this.on(Eo,(()=>{Mr.removeClass(this.root,"hide"),Mr.addClass(this.root,"xg-showplay"),this.once(eo,(()=>{this.onTimeUpdate()}))}))):this.on(zr,(()=>{Mr.addClass(this.root,"hide")}))}onTimeUpdate(){this.player.currentTime?Mr.removeClass(this.root,"xg-showplay"):this.once(eo,(()=>{this.onTimeUpdate()}))}update(e){e&&(this.config.poster=e,this.root.style.backgroundImage=`url(${e})`)}setConfig(e){"string"==typeof e?this.config.poster=e:"object"==typeof e&&Object.keys(this.config).forEach((t=>{Object.keys(e).includes(t)&&(this.config[t]=e[t])})),this.update(this.config.poster)}getBgSize(e){let t="";switch(e){case"cover":t="cover";break;case"contain":t="contain";break;case"fixHeight":t="auto 100%";break;case"fixWidth":t="100% auto";break;default:t=""}return t?`background-size: ${t};`:""}render(){const{poster:e,hideCanplay:t,fillMode:i,notHidden:n}=this.config,r=this.getBgSize(i);return`<xg-poster class="xgplayer-poster ${n?"xg-not-hidden":t?"xg-showplay":""} ${e?"active":""}" style="${e?`background-image:url(${e});${r}`:r}">\n </xg-poster>`}};Oa.use({LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}});class yN{constructor(e,t){const i=t&&"mobile"===t.isMobileSimulateMode,{isLive:n}=t,r=[...n?[]:[EL,hL,eN,ZL,_L],fL,mL,IL,LL,HL,jL,BL,FL,CL,xL],o=[mO,gN,SO,sL,CO,GL,YL,QL,UO];this.plugins=[lN,yO,...r,...o,cN,uN];const a=i?"mobile":Vr.device;switch(a){case"pc":this.plugins.push(oL,HO,WL,fN,pN);break;case"mobile":this.plugins.push(nL);break;default:this.plugins.push(oL,HO,WL)}(Vr.os.isIpad||"pc"===a)&&this.plugins.push(oN),this.ignores=[],this.i18n=[]}}function vN(e,t){return d(this,arguments,(function*({isLive:e=!1,streamType:t,isMobile:i=!1,getSoftOptionTask:n,playerData:r},o){const a=[yN,mN()],{openSoftDecoding:s,isMusic:l}=r,c=[],u=[];if(i?a.push(function({isLive:e,playerData:t}){const i=["error","playbackRate"],n=t.configs,r=Ws(n,"EncryptHlsPlugin");(null==r?void 0:r.playAuthToken)||i.push("definition");const o=[hR];return class{constructor(){this.plugins=o,this.ignores=[...i]}}}({isLive:e,playerData:o.playerData})):a.push(function({isLive:e,playerData:t}){const i=["cssfullscreen"],n=[QA],r=t.configs,o=Ws(r,"EncryptHlsPlugin");(null==o?void 0:o.playAuthToken)||(i.push("definition"),n.push(WA));return class{constructor(){this.plugins=n,this.ignores=[...i]}}}({isLive:e,playerData:o.playerData})),"flv"===t)u.push((()=>d(this,null,(function*(){if(i){if($s()||Xs()||s){const e=yield o.sdkUmdLoader.loadPlugins(Bw.FLV);c.push(e)}}else{const e=yield o.sdkUmdLoader.loadPlugins(Bw.FLV);c.push(e)}})))());Ws(o.playerData.options,"Subtitle")&&o.playerData.plugins.every((e=>"subtitle"!==e.pluginName.toLowerCase()))&&c.push(aO);const[h,f]=yield Promise.all([n(),_N({playerData:o.playerData},o),...u]);return{presets:a,softDecodingOption:h,plugins:[...c,...f].filter(Boolean)}}))}function mN(e){const t=[xR,sO,lR];return class{constructor(){this.plugins=t,this.ignores=["error"]}}}function _N(e,t){return d(this,arguments,(function*({playerData:e},t){var i,n,r;const o=[];e.options,e.drmType,or.DRM_ENCRYPT;const a=(yield null==(r=null==(n=null==(i=t.playerData)?void 0:i.adapter)?void 0:n.getPlugins)?void 0:r.call(n,t.sdkUmdLoader))||[];return o.push(...a),Boolean(ww()||Ns())&&o.push(Lw),e.enableMenu&&o.push(cR),o}))}function EN(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"/>\n',"image/svg+xml").firstChild}function TN(){return(new DOMParser).parseFromString('<svg width="72" height="72" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><g fill="#FFF" fill-rule="evenodd"><circle fill-opacity=".3" cx="36" cy="36" r="36"/><path d="M40.167 32.667a.833.833 0 01-.834-.834v-1.666c0-.46.373-.834.834-.834h5.409a11.653 11.653 0 00-9.576-5c-6.443 0-11.667 5.224-11.667 11.667S29.557 47.667 36 47.667c5.285 0 9.749-3.514 11.183-8.333h3.445C49.112 46.014 43.138 51 36 51c-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15 4.713 0 8.918 2.173 11.668 5.572l-.001-4.739c0-.46.373-.833.833-.833h1.667c.46 0 .833.373.833.833V31c0 .879-.68 1.598-1.542 1.662l-.125.005h-9.166z"/></g></svg>',"image/svg+xml").firstChild}function bN(){return(new DOMParser).parseFromString('<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#000" fill-opacity=".4"/><path d="M40.243 28.3a2 2 0 010 3.401L24.06 41.712c-1.332.825-3.052-.134-3.052-1.7V19.988c0-1.566 1.72-2.525 3.052-1.7l16.184 10.01z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function SN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.867 2.5h.55c.44 0 .799.34.83.771l.003.062v13.334c0 .44-.34.799-.771.83l-.062.003h-.55a.833.833 0 01-.444-.128l-.064-.045-4.867-3.744a.831.831 0 01-.322-.59l-.003-.07V7.077c0-.235.099-.458.271-.615l.054-.045L9.36 2.673a.832.832 0 01.43-.17l.078-.003h.55-.55zm6.767 2.278A7.474 7.474 0 0118.75 10a7.477 7.477 0 01-2.128 5.234.4.4 0 01-.57-.004l-.587-.586a.442.442 0 01.005-.617A5.812 5.812 0 0017.083 10c0-1.557-.61-2.97-1.603-4.017a.442.442 0 01-.003-.615l.586-.586a.4.4 0 01.57-.004zM2.5 6.667c.23 0 .417.186.417.416v5.834c0 .23-.187.416-.417.416h-.833a.417.417 0 01-.417-.416V7.083c0-.23.187-.416.417-.416H2.5zm11.768.46A4.153 4.153 0 0115.417 10c0 1.12-.442 2.137-1.162 2.886a.388.388 0 01-.555-.007l-.577-.578c-.176-.176-.156-.467.009-.655A2.49 2.49 0 0013.75 10a2.49 2.49 0 00-.61-1.636c-.163-.188-.182-.477-.006-.653l.578-.578a.388.388 0 01.556-.006z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function CN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.045 2.5h.55c.44 0 .8.34.831.771l.003.062v13.334c0 .44-.34.799-.771.83l-.063.003h-.55a.833.833 0 01-.443-.128l-.065-.045-4.866-3.744a.831.831 0 01-.323-.59l-.003-.07V7.077c0-.235.1-.458.272-.615l.054-.045 4.866-3.744a.832.832 0 01.43-.17l.078-.003h.55-.55zM2.68 6.667c.23 0 .416.186.416.416v5.834c0 .23-.186.416-.416.416h-.834a.417.417 0 01-.416-.416V7.083c0-.23.186-.416.416-.416h.834zm10.467.294a.417.417 0 01.59 0l1.767 1.768L17.27 6.96a.417.417 0 01.589 0l.59.59a.417.417 0 010 .589L16.68 9.908l1.768 1.767c.15.15.162.387.035.55l-.035.04-.589.589a.417.417 0 01-.59 0l-1.767-1.768-1.768 1.768a.417.417 0 01-.59 0l-.588-.59a.417.417 0 010-.589l1.767-1.768-1.767-1.767a.417.417 0 01-.035-.55l.035-.04.589-.589z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function kN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.867 2.5h.55c.44 0 .799.34.83.771l.003.062v13.334c0 .44-.34.799-.771.83l-.062.003h-.55a.833.833 0 01-.444-.128l-.064-.045-4.867-3.744a.831.831 0 01-.322-.59l-.003-.07V7.077c0-.235.099-.458.271-.615l.054-.045L9.36 2.673a.832.832 0 01.43-.17l.078-.003h.55-.55zM2.5 6.667c.23 0 .417.186.417.416v5.834c0 .23-.187.416-.417.416h-.833a.417.417 0 01-.417-.416V7.083c0-.23.187-.416.417-.416H2.5zm11.768.46A4.153 4.153 0 0115.417 10c0 1.12-.442 2.137-1.162 2.886a.388.388 0 01-.555-.007l-.577-.578c-.176-.176-.156-.467.009-.655A2.49 2.49 0 0013.75 10a2.49 2.49 0 00-.61-1.636c-.163-.188-.182-.477-.006-.653l.578-.578a.388.388 0 01.556-.006z" fill="#fff"/></svg>',"image/svg+xml").firstChild}const IN=u(c({startPlay:bN,play:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.121 8.299a2 2 0 010 3.402l-7.94 4.91c-1.332.825-3.051-.133-3.051-1.7V5.09c0-1.567 1.72-2.525 3.052-1.701l7.939 4.911z" fill="#fff"/></svg>',"image/svg+xml").firstChild},pause:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="5.313" y="3.75" width="3.125" height="12.5" rx=".625" fill="#fff"/><rect x="11.563" y="3.75" width="3.125" height="12.5" rx=".625" fill="#fff"/></svg>',"image/svg+xml").firstChild},fullscreen:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.778 2h4.444v1.778H3.778v4.444H2V3.778C2 2.796 2.796 2 3.778 2zM2 11.778v4.444C2 17.204 2.796 18 3.778 18h4.444v-1.778H4.823l2.313-2.313a.9.9 0 00-1.272-1.273l-2.086 2.086v-2.944H2zm14.222 0v4.444h-4.444V18h4.444c.982 0 1.778-.796 1.778-1.778v-4.444h-1.778zM18 8.222V3.778C18 2.796 17.204 2 16.222 2h-4.444v1.778h2.945l-2.587 2.586a.9.9 0 101.273 1.273l2.813-2.813v3.398H18z" fill="#fff"/></svg>',"image/svg+xml").firstChild},exitFullscreen:function(){return(new DOMParser).parseFromString('<svg width="21" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.892 2h4.445v1.778H3.892v4.444H2.114V3.778C2.114 2.796 2.91 2 3.892 2zm4.445 16v-4.444c0-.982-.796-1.778-1.778-1.778H2.114v1.778h2.944L2.264 16.35a.9.9 0 001.272 1.273l2.988-2.987a.918.918 0 00.035-.037V18h1.778zm8-6.222v4.444h-4.445V18h4.445c.981 0 1.777-.796 1.777-1.778v-4.444h-1.777zM11.892 2v4.445c0 .981.796 1.777 1.778 1.777h4.444V6.445H15.17l2.568-2.568a.9.9 0 10-1.273-1.273L13.67 5.4V2h-1.778z" fill="#fff"/></svg>',"image/svg+xml").firstChild},playNext:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.03 8.312a2 2 0 010 3.376l-7.642 4.858c-1.332.847-3.073-.11-3.073-1.687V5.14c0-1.577 1.741-2.534 3.073-1.687l7.642 4.858z" fill="#fff"/><path d="M13 3.5a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v13a.5.5 0 01-.5.5h-1a.5.5 0 01-.5-.5v-13z" fill="#fff"/></svg>',"image/svg+xml").firstChild},replay:TN,refresh:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 2.488a7.48 7.48 0 00-4.154 1.253.908.908 0 101.005 1.512 5.695 5.695 0 018.844 4.746h-.908a.33.33 0 00-.264.528l1.816 2.422a.33.33 0 00.529 0l1.815-2.422A.33.33 0 0018.42 10h-.908A7.511 7.511 0 0010 2.49zM2.489 10a7.511 7.511 0 0011.665 6.26.908.908 0 00-1.005-1.513A5.695 5.695 0 014.305 10h.908a.33.33 0 00.264-.528L3.66 7.05a.33.33 0 00-.528 0L1.317 9.47a.33.33 0 00.264.53h.908z" fill="#fff"/></svg>',"image/svg+xml").firstChild}},{}),{volumeLarge:SN,volumeMuted:CN,volumeSmall:kN}),PN={whitelist:[""],widescreen:!0,width:"100%",height:"100%",lang:Gs(),fitVideoSize:!1,inactive:2e3,playsinline:!0,keyShortcut:"off",closeVideoClick:!0,closeVideoDblclick:!0,closePlayerBlur:!1,closeControlsBlur:!1,closePlayVideoFocus:!0,leavePlayerTime:0,mini:!1,pip:{position:"controlsRight",index:2.5,showIcon:!0},volume:{index:2.6},miniscreen:{left:window.innerWidth-360,top:window.innerHeight-450},time:{index:3},icons:c({},IN),flv:{retryCount:0,preferMMS:!0,preferMMSStreaming:!0},hls:{retryCount:3,allowedStreamTrackChange:!1,preferMMS:!0,preferMMSStreaming:!0},Mp4EncryptPlayer:{retryCount:3},DASHPlugin:{disableBufferBreakCheck:!1},gapJump:{smallGapLimit:1},EncryptHlsPlugin:{preferMMS:!0,preferMMSStreaming:!0}},DN={isLive:!0,closeVideoClick:!0,autoplay:!0,autoplayMuted:!0,preloadTime:8,start:{isShowPause:!1,isShowEnd:!1,mode:"hide",disableAnimate:!0},retry:{count:0}},wN={isLive:!1,closeVideoClick:!1,defaultPlaybackRate:1,closeVideoStopPropagation:!0,autoplay:!1,autoplayMuted:!1,playbackRate:[2,1.5,1.25,{rate:1,iconText:{zh:"倍速",en:"Speed",jp:"Speed"}},.75,.5],start:{isShowPause:!0,isShowEnd:!1,mode:"hide",disableAnimate:!0},progresspreview:{isShowCoverPreview:!0},progress:{isPauseMoving:!0}};const AN=u(c({startPlay:bN,play:function(){return(new DOMParser).parseFromString('<svg style="\n height: 18px;\n width: 18px;\n" width="28" height="28" fill="none" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="M19.77 11.619c1.768 1.094 1.768 3.668 0 4.762L8.653 23.257c-1.865 1.154-4.273-.188-4.273-2.381V7.125c0-2.194 2.408-3.536 4.273-2.382L19.77 11.62z" fill="#fff"/></svg>',"image/svg+xml").firstChild},pause:function(){return(new DOMParser).parseFromString('<svg style="\n height: 18px;\n width: 18px;\n" width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.438" y="5.25" width="4.375" height="17.5" rx=".875" fill="#fff"/><rect x="16.188" y="5.25" width="4.375" height="17.5" rx=".875" fill="#fff"/></svg>',"image/svg+xml").firstChild},fullscreen:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.125 3a.375.375 0 00-.375.375v.75c0 .207.168.375.375.375H15.5v3.375c0 .207.168.375.375.375h.75A.375.375 0 0017 7.875v-4.5A.375.375 0 0016.625 3h-4.5zm0 12.5a.375.375 0 00-.375.375v.75c0 .207.168.375.375.375h4.5a.375.375 0 00.375-.375v-4.5a.375.375 0 00-.375-.375h-.75a.375.375 0 00-.375.375V15.5h-3.375zM3 3.375C3 3.168 3.168 3 3.375 3h4.5c.207 0 .375.168.375.375v.75a.375.375 0 01-.375.375H4.5v3.375a.375.375 0 01-.375.375h-.75A.375.375 0 013 7.875v-4.5zM7.875 15.5H4.5v-3.375a.375.375 0 00-.375-.375h-.75a.375.375 0 00-.375.375v4.5c0 .207.168.375.375.375h4.5a.375.375 0 00.375-.375v-.75a.375.375 0 00-.375-.375z" fill="#fff"/></svg>\n',"image/svg+xml").firstChild},exitFullscreen:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.333h-4.167c-.92 0-1.666-.746-1.666-1.666V2.5h1.666v4.167H17.5v1.666zM2.5 6.667v1.666h4.167c.92 0 1.666-.746 1.666-1.666V2.5H6.667v4.167H2.5zM2.5 13.333h4.167V17.5h1.666v-4.167c0-.92-.746-1.666-1.666-1.666H2.5v1.666zM13.333 17.5v-4.167H17.5v-1.666h-4.167c-.92 0-1.666.746-1.666 1.666V17.5h1.666z" fill="#fff"/></svg>\n',"image/svg+xml").firstChild},playNext:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4.77 4.124l8.358 5.07c.38.23.486.704.238 1.056a.807.807 0 01-.238.22L4.77 15.543c-.38.231-.889.132-1.137-.221a.723.723 0 01-.134-.417V4.762c0-.421.368-.762.822-.762.159 0 .316.042.449.124z" stroke="#fff" stroke-width="1.5"/><path d="M15.5 4.5A.5.5 0 0116 4h.5a.5.5 0 01.5.5v11a.5.5 0 01-.5.5H16a.5.5 0 01-.5-.5v-11z" fill="#fff"/></svg>',"image/svg+xml").firstChild},replay:TN,refresh:function(){return(new DOMParser).parseFromString('<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M0 0h18v18H0z"/><path d="M10.875 7.5a.375.375 0 01-.375-.375v-.75c0-.207.168-.375.375-.375h2.434a5.25 5.25 0 10.723 4.5h1.55a6.75 6.75 0 11-1.332-5.743V2.626c0-.207.168-.375.375-.375h.75c.207 0 .375.168.375.375V6.75a.75.75 0 01-.694.748L15 7.5h-4.125z" fill="#FFF"/></g></svg>',"image/svg+xml").firstChild}},{}),{volumeLarge:SN,volumeMuted:CN,volumeSmall:kN}),RN=u(c({width:"100%",height:"100%",lang:Gs(),playsinline:!0,closeVideoClick:!0,closeVideoTouch:!0,whitelist:[""],"x5-video-player-type":"h5-page","x5-video-player-fullscreen":!1,"x5-video-orientation":"landscape|portrait",enterTips:{background:"linear-gradient(90deg,#000,#49e6d3,#49e6d3,#138afc,#000)"},retainPlay:!0,start:{isShowPause:!0,isShowEnd:!0,disableAnimate:!1},fullscreen:{useCssFullscreen:!1},plugins:[],time:{mode:"pc",index:2.5},controls:{mode:"flex"}},{}),{cusPlaybackRatePlugin:{needCheck:!0,needPanel:!1},icons:c({},AN),flv:{innerDegrade:1,retryCount:0,preferMMS:!0,preferMMSStreaming:!0},hls:{innerDegrade:1,retryCount:3,allowedStreamTrackChange:!1,preferMMS:!0,preferMMSStreaming:!0},Mp4EncryptPlayer:{retryCount:3},DASHPlugin:{disableBufferBreakCheck:!1},gapJump:{smallGapLimit:1},EncryptHlsPlugin:{preferMMS:!0,preferMMSStreaming:!0}}),xN={isLive:!0,closeVideoClick:!0,autoplay:!0,autoplayMuted:!0,start:{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"},retry:{count:0},longwaiting:{duration:3e4},mobile:{gestureY:!1,gestureX:!1,disableActive:!0}},ON={isLive:!1,closeVideoClick:!1,autoplay:!1,autoplayMuted:!1,playbackRate:[2,1.5,1.25,{rate:1,iconText:"倍速",en:"speed",jp:"speed"},.75,.5],defaultPlaybackRate:1,closeVideoStopPropagation:!0,mobile:{gestureY:!1},start:{isShowPause:!0,isShowEnd:!1,disableAnimate:!1,mode:"hide"}};const{POSITIONS:LN}=ba,NN=e=>{const t="mobile"===Vr.device,{pluginName:i=`ExtendPlugin${Math.random().toString().slice(-5)}`,type:n=(t?"inner":"normal"),position:r=LN.CONTROLS_LEFT,icon:o=EN,index:a=1,hideAtFullScreen:s=!0,tips:l={jp:"custom",en:"custom",zh:"自定义","zh-hk":"自定义"}}=e;return class extends ba{static get isExtendPlugin(){return!0}static get type(){return n}static get textTips(){return l}static get pluginName(){return i}static get defaultConfig(){return{position:r,index:a}}afterCreate(){var e;this.appendChild(".xgplayer-icon",this.icons[i]),this.initEvents(),s&&(null==(e=this.player)?void 0:e.fullscreen)&&this.handleFullScreenChange()}registerIcons(){return{[i]:{icon:o,class:"xgplayer-extendicon-svg"}}}updateIcons(e){const t=this.find(".xgplayer-icon");t&&(t.innerHTML=e)}registerLanguageTexts(){return{[i]:l}}initEvents(){var e;this.handleCallback=oA(this.handleCallback.bind(this),200);const t="mobile"===Vr.device?"touchend":"click";this.bind(t,this.handleCallback),this.show(),s&&(null==(e=this.player)||e.on(ko,this.handleFullScreenChange.bind(this)))}handleFullScreenChange(){var e;const t=this.player;null==(e=this.player)||e.changePluginsIcon(i,!(null==t?void 0:t.fullscreen))}handleCallback(e){const{player:t}=this;t&&(e.preventDefault(),e.stopPropagation(),t.emit(LA.PLAYER_EXTEND_BUTTON,i))}destroy(){var e;this.unbind(["touchend","click"],this.handleCallback),s&&(null==(e=this.player)||e.off(ko,this.handleFullScreenChange.bind(this)))}render(){return`\n <xg-icon class="xgplayer-extend-icon">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="${i}">${this.langText[i]}</div>\n </xg-icon>\n `}}};class MN{constructor(e){var t,i,n;const{config:r,root:o,player:a}=e;this.config=r,this.parent=o,this.player=a;let s=null!=(t=null==r?void 0:r.mode)?t:za.INNER;Object.values(za).includes(s)||(s=za.INNER),this.mode=s,this.isAutoChange=null!=(i=null==r?void 0:r.isAutoChange)&&i,this.isShow=!1,this.showCancelBtn=null!=(n=null==r?void 0:r.showCancelBtn)&&n,this.initEvents(),this.renderPanel()}initEvents(){var e;this.isAutoChange&&(window.addEventListener("orientationchange",this.handleOrientationChange.bind(this)),null==(e=this.player)||e.on(ko,this.handleOrientationChange.bind(this)))}handleOrientationChange(){var e,t,i;const n=[90,-90,"90","-90"].includes(window.orientation);(null==(e=this.player)?void 0:e.fullscreen)&&n?this.changeMode(za.FULLSCREEN):this.changeMode(null!=(i=null==(t=this.config)?void 0:t.mode)?i:za.INNER)}changeConfig(e){this.config=e}changeMode(e){this.mode=e,this.player.emit(LA.PANEL_MODE_CHANGE,{mode:e}),this.destroy(),this.renderPanel()}renderPanel(){const e=`xg-mobile-panel panel-${["normal","inner","fullscreen"][this.mode]}`;switch(this.root=Mr.createDom("div","",{},e),this.parent&&(this.parent.appendChild(this.root),this.hide()),this.bind("click",this.handleHide.bind(this)),this.mode){case za.NORMAL:{const e=Mr.createDom("div","",{},"xg-mobile-panel-content "+(this.showCancelBtn?"xg-mobile-panel-cancel-mode":""));if(this.root.appendChild(e),this.showCancelBtn){const e="zh-cn"===this.player.lang?"zh":this.player.lang,t=Mr.createDom("div",qa[e],{},"xg-mobile-panel-cancel");this.root.appendChild(t)}this.container=e,e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()}));break}case za.INNER:this.container=this.root;break;case za.FULLSCREEN:{const e=Mr.createDom("div","",{},"xg-mobile-panel-content");this.root.appendChild(e),this.container=e,e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()}));break}}}showPanel(e,t="",i=!1){return d(this,null,(function*(){if(i&&Mr.addClass(e,"item-list-panel-content"),this.setTitle(t),this.children)return yield this.hide(),void setTimeout((()=>{this.children=e,this.container&&(this.title&&this.container.appendChild(this.title),this.container.appendChild(e)),this.show()}));this.children=e,this.container&&(this.title&&this.container.appendChild(this.title),this.container.appendChild(e)),this.show()}))}updatePanel(e){this.children&&Mr.hasClass(this.children,"item-list-panel-content")&&Mr.addClass(e,"item-list-panel-content"),this.children=e,this.container&&(this.container.innerHTML="",this.title&&this.container.appendChild(this.title),this.container.appendChild(e))}setTitle(e){e&&this.mode!==za.INNER?this.title?this.title.innerHTML=e:this.title=this.renderTitle(e):this.title=void 0}renderTitle(e){return Mr.createDom("div",e,{},"xg-mobile-panel-title")}show(){this.isShow=!0,Mr.removeClass(this.root,"hide"),Mr.addClass(this.root,"active")}hide(){this.isShow=!1,Mr.removeClass(this.root,"active"),Mr.addClass(this.root,"hide"),this.container&&(this.container.innerHTML="")}handleHide(e){e.stopPropagation(),e.preventDefault(),this.hide()}bind(e,t,i=!1){this.root&&`on${e}`in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,i)}destroy(){var e;this.parent&&this.root&&this.parent.contains(this.root)&&(this.parent.removeChild(this.root),this.root=null),window.removeEventListener("orientationchange",this.handleOrientationChange.bind(this)),null==(e=this.player)||e.off(ko,this.handleOrientationChange.bind(this))}}function UN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M16 3.8001H4C3.55817 3.8001 3.2 4.15827 3.2 4.6001V12.6001C3.2 13.0419 3.55817 13.4001 4 13.4001H16C16.4418 13.4001 16.8 13.0419 16.8 12.6001V4.6001C16.8 4.15827 16.4418 3.8001 16 3.8001ZM4 2.6001C2.89543 2.6001 2 3.49553 2 4.6001V12.6001C2 13.7047 2.89543 14.6001 4 14.6001H16C17.1046 14.6001 18 13.7047 18 12.6001V4.6001C18 3.49553 17.1046 2.6001 16 2.6001H4ZM5.0249 6.24509V11.6001H5.9024V9.23009H8.6174V11.6001H9.4949V6.24509H8.6174V8.48009H5.9024V6.24509H5.0249ZM10.5474 6.24509V11.6001H12.5049C13.3749 11.6001 14.0274 11.3601 14.4774 10.8801C14.9049 10.4226 15.1224 9.77009 15.1224 8.92259C15.1224 8.06759 14.9049 7.41509 14.4774 6.96509C14.0274 6.48509 13.3749 6.24509 12.5049 6.24509H10.5474ZM11.4249 6.99509H12.3399C13.0074 6.99509 13.4949 7.14509 13.8024 7.45259C14.1024 7.75259 14.2524 8.24759 14.2524 8.92259C14.2524 9.58259 14.1024 10.0701 13.8024 10.3851C13.4949 10.6926 13.0074 10.8501 12.3399 10.8501H11.4249V6.99509ZM4.15 16.1001C3.79101 16.1001 3.5 16.3911 3.5 16.7501C3.5 17.1091 3.79101 17.4001 4.15 17.4001H15.85C16.209 17.4001 16.5 17.1091 16.5 16.7501C16.5 16.3911 16.209 16.1001 15.85 16.1001H4.15Z" fill="#ffffff"/>\n</svg>',"image/svg+xml").firstChild}const{POSITIONS:BN}=ba;class FN extends(KA(ba)){constructor(e){super(u(c({},e),{clientType:"MOBILE"})),this.handleButtonChange=()=>{const e=this.renderItemList();this.renderPanel(e)}}static get pluginName(){return"DefinitionMobilePlugin"}static get textTips(){return{jp:"明快さ",en:"Definition",zh:"清晰度","zh-hk":"清晰度"}}static get defaultConfig(){return{position:BN.CONTROLS_RIGHT,index:3,showToastOnManualClick:!0,alwaysShowDefinition:!1}}afterCreate(){super.afterCreate()}refreshDefinitionList(){var e;const{current:{lineId:t}}=this.playerData,i=this.playerData.getDefinitionListByLineId(t);(null==(e=this.player.config)?void 0:e.alwaysShowDefinition)&&(this.config.alwaysShowDefinition=!0),i.length>1||this.config.alwaysShowDefinition?(this.appendChild(".xgplayer-icon",this.icons.definition),this.initEvents()):this.hide(),this.renderItemList()}registerIcons(){return{definition:{icon:UN,class:"xgplayer-definition-svg"}}}registerLanguageTexts(){return{definition:{jp:"明快さ",en:"Definition",zh:"清晰度","zh-hk":"清晰度"},definitionSelect:{jp:"クラリティセレクション",en:"Definition Choose",zh:"清晰度选择","zh-hk":"清晰度選擇"},switching:{jp:"に切り替える",en:"Switching to",zh:"正在切换至","zh-hk":"正在切換至"}}}afterPlayerInit(){}initEvents(){this.unbind(["click"],this.handleButtonChange),this.bind(["click"],this.handleButtonChange)}renderItemList(){const{defaultDefinition:e,list:t}=this.getCurrentDefinitionInfo(this.player),i=Mr.createDom("div","",{},"definition-panel-content");return t.forEach((t=>{t.selected=e===t.definition,t.isDefinitionAuto=this.playerData.isAutoDefinition(t.definition);const n=this.renderItem(t);i.appendChild(n)})),this.renderList=t,i}renderItem(e){var t;const{current:{definition:i}}=this.playerData,n=Mr.createDom("div","",{},"panel-Item "+(i===e.definition?"select-in":""));let r=this.getShowText(this.i18n,e,i);if(this.showRealDefinition(e)){const e=null==(t=this.renderList)?void 0:t.find((e=>this.playerData.isDefinitionMatch(null==e?void 0:e.definition,this._autoRealDefinition))),i=this.getShowText(this.i18n,e,null==e?void 0:e.definition);r=i?`${r}(${i})`:r}return n.innerHTML=r,n.addEventListener("click",(t=>{var n;if(t.stopPropagation(),t.preventDefault(),e.definition!==this.playerData.current.definition){const r=null==(n=this.playerData.getCurrentStreams())?void 0:n[0];this.emitUserAction(t,"change_definition",{from:r,to:e}),this.config.showToastOnManualClick&&this.showToast(e,i),this.playerData.current.definition=e.definition}})),n}selectDef(e){this.selectDefinition(e)}changeDefinition(e){const t=this.renderList.find((t=>this.playerData.isDefinitionMatch(t.definition,e)));t&&this.selectDef(t)}renderPanel(e){var t,i;null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(e,this.langText.definitionSelect,!0)}updatePanel(){var e,t,i,n,r,o,a;if((null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&(null==(r=null==(n=null==(i=this.player)?void 0:i.panel)?void 0:n.title)?void 0:r.innerHTML)!==this.langText.definitionSelect)return;const s=this.renderItemList();null==(a=null==(o=this.player)?void 0:o.panel)||a.updatePanel(s)}destroy(){super.destroy(),this.unbind(["click"],this.handleButtonChange)}render(){return'\n <xg-icon class="xgplayer-mobile-definition">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}function HN(){return(new DOMParser).parseFromString('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12.7123 1C11.85 1 11.1173 1.55472 10.8516 2.32675L4.94973 2.32675C3.16413 2.32675 1.71662 3.77427 1.71662 5.55987C1.71662 7.34547 3.16413 8.79298 4.94973 8.79298L11.0483 8.79298L11.1134 8.79418C11.9936 8.82748 12.697 9.55166 12.697 10.44C12.697 11.3497 11.9596 12.0871 11.05 12.0871H5.01323C4.67882 11.4781 4.03143 11.0654 3.28763 11.0654C2.20111 11.0654 1.32031 11.9462 1.32031 13.0327C1.32031 14.1192 2.20111 15 3.28763 15C4.14992 15 4.88264 14.4452 5.14834 13.6732H11.05C12.8356 13.6732 14.2831 12.2256 14.2831 10.44C14.2831 8.65444 12.8356 7.20693 11.05 7.20693L4.94973 7.20693C4.04009 7.20693 3.30267 6.46951 3.30267 5.55987C3.30267 4.65022 4.04009 3.91281 4.94973 3.91281L10.9866 3.91281C11.321 4.52183 11.9685 4.93464 12.7123 4.93464C13.7988 4.93464 14.6796 4.05384 14.6796 2.96732C14.6796 1.8808 13.7988 1 12.7123 1ZM12.7123 2.18954C12.2827 2.18954 11.9345 2.53777 11.9345 2.96732C11.9345 3.39688 12.2827 3.7451 12.7123 3.7451C13.1418 3.7451 13.4901 3.39688 13.4901 2.96732C13.4901 2.53777 13.1418 2.18954 12.7123 2.18954ZM2.50986 13.0327C2.50986 12.6031 2.85808 12.2549 3.28763 12.2549C3.71719 12.2549 4.06541 12.6031 4.06541 13.0327C4.06541 13.4622 3.71719 13.8105 3.28763 13.8105C2.85808 13.8105 2.50986 13.4622 2.50986 13.0327Z" fill="#FFFFFF"/>\n</svg>',"image/svg+xml").firstChild}const{POSITIONS:jN}=ba;class VN extends ba{constructor(e){super(e),this.playerData=e.player.config.playerData,this.dataMonitoring()}static get pluginName(){return"LineMobilePlugin"}static get textTips(){return{jp:"ライン",en:"Line",zh:"线路","zh-hk":"線路"}}static get defaultConfig(){return{position:jN.CONTROLS_RIGHT,index:4}}dataMonitoring(){this.playerData&&ur.subscribeProperty(this.playerData.current,"definition",((e,t)=>{if(e!==t&&this.player){const e=this.playerData.getCurrentUrl();this.player.changeDefinition({definition:t,url:e}),this.updatePanel(),setTimeout((()=>{this.player.paused&&this.player.play()}),1e3)}}))}registerIcons(){return{line:{icon:HN,class:"xgplayer-line-svg"}}}registerLanguageTexts(){return{line:{jp:"ライン",en:"Line",zh:"线路","zh-hk":"線路"},lineSelect:{jp:"ライン選ぶ",en:"Line Choose",zh:"线路选择","zh-hk":"線路選擇"}}}afterCreate(){this.appendChild(".xgplayer-icon",this.icons.line),this.initEvents()}afterPlayerInit(){}initEvents(){this.bind(["click"],this.handleButtonChange.bind(this))}handleButtonChange(){const e=this.renderItemList();this.renderPanel(e)}renderItemList(){const e=this.playerData.getLineList(),t=Mr.createDom("div","",{},"line-panel-content");return e.forEach((e=>{const i=this.renderItem(e);t.appendChild(i)})),t}renderItem(e){const{current:{lineId:t}}=this.playerData,i=Mr.createDom("div","",{},"panel-Item "+(t===e.lineId?"select-in":""));return i.innerHTML=this.i18n[e.lineTextKey]||e.lineTextKey,i.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault(),this.player.emit(LA.LINE_CHANGE,{from:this.playerData.current.lineId,to:e.lineId}),this.playerData.current.lineId=e.lineId,this.player.emit(OA.PLAYER_REBUILD)})),i}renderPanel(e){var t,i;null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(e,this.langText.lineSelect,!0)}updatePanel(){var e;const t=this.renderItemList();null==(e=this.player)||e.panel.updatePanel(t)}destroy(){this.unbind(["click"],this.handleButtonChange.bind(this))}render(){return'\n <xg-icon class="xgplayer-mobile-line">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}function KN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M14.6879 3.64579C14.7387 3.60575 14.7387 3.52868 14.6879 3.48864L13.3089 2.40296C13.2433 2.35132 13.147 2.39805 13.147 2.48153V4.6529C13.147 4.73639 13.2433 4.78312 13.3089 4.73147L14.6879 3.64579ZM4 2.61914H11.3001V3.91914H4C3.6134 3.91914 3.3 4.23254 3.3 4.61914V15.6191C3.3 16.0057 3.6134 16.3191 4 16.3191H16C16.3866 16.3191 16.7 16.0057 16.7 15.6191V6.75253H18V15.6191C18 16.7237 17.1046 17.6191 16 17.6191H4C2.89543 17.6191 2 16.7237 2 15.6191V4.61914C2 3.51457 2.89543 2.61914 4 2.61914ZM17.7879 3.48864C17.8388 3.52868 17.8388 3.60575 17.7879 3.64579L16.4089 4.73147C16.3433 4.78312 16.2471 4.73639 16.2471 4.6529V2.48153C16.2471 2.39805 16.3433 2.35132 16.4089 2.40296L17.7879 3.48864Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:WN}=ba;class GN extends ba{constructor(e){super(e),this.state={currentRate:1,isSupport:!0},this.playerData=e.player.config.playerData}static get pluginName(){return"PlaybackRateMobilePlugin"}static get textTips(){return{jp:"倍速",en:"PlaybackRate",zh:"倍速","zh-hk":"倍速"}}static get defaultConfig(){return{position:WN.CONTROLS_RIGHT,index:5,list:[2,1.5,1.25,1,.75,.5],default:1}}registerIcons(){return{playbackRate:{icon:KN,class:"xgplayer-rate-svg"}}}registerLanguageTexts(){return{rate:{jp:"倍速",en:"PlaybackRate",zh:"倍速","zh-hk":"倍速"},rateSelect:{jp:"倍速選ぶ",en:"PlaybackRate",zh:"倍速选择","zh-hk":"倍速選擇"}}}afterCreate(){this.appendChild(".xgplayer-icon",this.icons.playbackRate),this.initEvents(),this.state.currentRate=this.player.playbackRate||1,this.changeIconText()}afterPlayerInit(){}initEvents(){this.bind(["click"],this.renderList.bind(this)),this.on(ao,(()=>{var e,t;this.state.currentRate!==this.player.playbackRate&&(this.state.currentRate=this.player.playbackRate,(null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&this.updatePanel(),this.changeIconText())}))}renderList(){const e=this.renderItemList();this.renderPanel(e)}renderItemList(){const e=Mr.createDom("div","",{},"playbackRate-panel-content");return this.config.list.forEach((t=>{const i=this.renderItem(t);e.appendChild(i)})),e}renderItem(e){const t=A(e)?e:{textKey:e+"X",value:e},i=Mr.createDom("div","",{},"panel-Item "+(this.state.currentRate===t.value?"select-in":""));return i.innerHTML=this.i18n[t.textKey]||t.textKey,i.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault();const i={playbackRate:{from:this.player.playbackRate,to:t.value}};this.emitUserAction(e,"change_rate",{props:i}),this.state.currentRate=t.value,this.player.playbackRate=t.value,this.updatePanel(),this.changeIconText()})),i}renderPanel(e){var t,i;null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(e,this.langText.rateSelect,!0)}updatePanel(){var e;const t=this.renderItemList();null==(e=this.player)||e.panel.updatePanel(t)}changeIconText(){let e;const t=this.state.currentRate,i=t%1==0?t.toFixed(1):t+"";switch(i.length){case 1:case 2:case 3:default:e=.7;break;case 4:e=.5}const n=this.find(".icon-text");n.style.transform=`scale(${e})`,n.innerHTML=i}destroy(){this.unbind(["click"],this.renderList.bind(this))}render(){return'\n <xg-icon class="xgplayer-mobile-playBackRate">\n <div class="xgplayer-icon">\n <div class="icon-text"></div>\n </div>\n </xg-icon>\n '}}function YN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M16.8881 11.8208C16.812 11.6153 16.5213 11.6153 16.4452 11.8208L16.0985 12.7579C15.8115 13.5334 15.2001 14.1448 14.4246 14.4318L13.4875 14.7786C13.2819 14.8546 13.2819 15.1454 13.4875 15.2214L14.4246 15.5682C15.2001 15.8551 15.8115 16.4666 16.0985 17.2421L16.4452 18.1792C16.5213 18.3847 16.812 18.3847 16.8881 18.1792L17.2348 17.2421C17.5218 16.4666 18.1332 15.8551 18.9087 15.5682L19.8458 15.2214C20.0514 15.1454 20.0514 14.8546 19.8458 14.7786L18.9087 14.4318C18.1332 14.1448 17.5218 13.5334 17.2348 12.7579L16.8881 11.8208Z" fill="white"/>\n<rect x="9.5" y="2" width="1.5" height="16" rx="0.75" fill="white"/>\n<rect x="5.75" y="5" width="1.5" height="10" rx="0.75" fill="white"/>\n<rect x="2" y="7" width="1.5" height="6" rx="0.75" fill="white"/>\n<path d="M16.5 7.75C16.5 7.33579 16.8358 7 17.25 7C17.6642 7 18 7.33579 18 7.75V9.18934C18 9.85752 17.1921 10.1921 16.7197 9.71967C16.579 9.57902 16.5 9.38825 16.5 9.18934V7.75Z" fill="white"/>\n<path d="M12.75 5.75C12.75 5.33579 13.0858 5 13.5 5C13.9142 5 14.25 5.33579 14.25 5.75V11.3229C14.25 11.4394 14.2229 11.5542 14.1708 11.6584C13.8169 12.3662 12.75 12.1144 12.75 11.3229V5.75Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:zN}=ba;class $N extends ba{constructor(){super(...arguments),this._nativeMode=!1,this._nativeAddTrackHandler=null,this._nativeChangeHandler=null,this._nativeRemoveTrackHandler=null,this._clickHandler=null,this._nativePanelUpdateRaf=null}static get pluginName(){return"AudioTrackMobile"}static get textTips(){return{en:"Audio",zh:"音频","zh-hk":"音頻",jp:"オーディオ"}}static get defaultConfig(){return{position:zN.CONTROLS_RIGHT,index:2.6,isShowIcon:!0,showNameSuffix:!0}}registerIcons(){return{audiotrack:{icon:YN,class:"xgplayer-audiotrack-svg"}}}afterPlayerInit(){var e;this.on("hlsAudioTracksUpdated",(e=>{this._onAudioTracksUpdated(e.audioTracks)})),this.on("hlsAudioTrackSwitched",(e=>{var t,i;(null==(i=null==(t=this.player)?void 0:t.panel)?void 0:i.isShow)&&this._updateHlsPanel(e.id)}));const t=this._getHls();(null==(e=null==t?void 0:t.audioTracks)?void 0:e.length)>1?this._onAudioTracksUpdated(t.audioTracks):t||this._initNativeAudioTracks()}destroy(){this._clickHandler&&this.unbind(["click"],this._clickHandler),null!==this._nativePanelUpdateRaf&&cancelAnimationFrame(this._nativePanelUpdateRaf),this._unbindNativeAudioTracks()}render(){return this.config.isShowIcon?'\n <xg-icon class="xgplayer-mobile-audiotrack">\n <div class="xgplayer-icon"></div>\n </xg-icon>\n ':""}_getHls(){var e,t;const i=this.player.plugins;return(null==(e=null==i?void 0:i.encrypthlsplugin)?void 0:e.hls)||(null==(t=null==i?void 0:i.hls)?void 0:t.hls)}_getNativeTrackList(){var e,t;return null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks}_onAudioTracksUpdated(e){!e||e.length<=1||this._bindClickOnce()}_renderList(){this._nativeMode?this._renderNativePanel():this._renderHlsPanel()}_getLabelOpts(){return{showNameSuffix:!1!==this.config.showNameSuffix}}_renderHlsPanel(){var e,t,i;const n=this._getHls();if(!n)return;const r=n.audioTracks;if(!(null==r?void 0:r.length))return;const o=null!=(e=n.audioTrack)?e:-1,a=r.find((e=>e.default)),s=this._getLabelOpts(),l=Mr.createDom("div","",{},"audiotrack-panel-content");r.forEach((e=>{let t=e.id===o;t||-1!==o||(null==a?void 0:a.id)!==e.id||(t=!0);const i=Mr.createDom("div","",{},"panel-Item "+(t?"select-in":""));i.innerHTML=qA(e,s),i.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault(),this._switchHlsTrack(n,e)})),l.appendChild(i)})),null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(l,this._panelTitle(),!0)}_updateHlsPanel(e){var t,i;const n=this._getHls();if(!n)return;const r=n.audioTracks;if(!(null==r?void 0:r.length))return;const o=this._getLabelOpts(),a=Mr.createDom("div","",{},"audiotrack-panel-content");r.forEach((t=>{const i=Mr.createDom("div","",{},"panel-Item "+(t.id===e?"select-in":""));i.innerHTML=qA(t,o),i.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),this._switchHlsTrack(n,t)})),a.appendChild(i)})),null==(i=null==(t=this.player)?void 0:t.panel)||i.updatePanel(a)}_switchHlsTrack(e,t){zA(e,t)}_initNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeMode=!0,this._nativeAddTrackHandler=()=>this._onNativeTracksChanged(),this._nativeChangeHandler=()=>{var e,t;(null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&null===this._nativePanelUpdateRaf&&(this._nativePanelUpdateRaf=requestAnimationFrame((()=>{var e,t;this._nativePanelUpdateRaf=null,(null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&this._renderNativePanel(!0)})))},this._nativeRemoveTrackHandler=()=>this._onNativeTracksChanged(),e.addEventListener("addtrack",this._nativeAddTrackHandler),e.addEventListener("change",this._nativeChangeHandler),e.addEventListener("removetrack",this._nativeRemoveTrackHandler),e.length>1&&this._onNativeTracksChanged())}_unbindNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeAddTrackHandler&&e.removeEventListener("addtrack",this._nativeAddTrackHandler),this._nativeChangeHandler&&e.removeEventListener("change",this._nativeChangeHandler),this._nativeRemoveTrackHandler&&e.removeEventListener("removetrack",this._nativeRemoveTrackHandler))}_bindClickOnce(){this._clickHandler||(this.appendChild(".xgplayer-icon",this.icons.audiotrack),this._clickHandler=this._renderList.bind(this),this.bind(["click"],this._clickHandler))}_onNativeTracksChanged(){const e=this._getNativeTrackList();!e||e.length<=1||this._bindClickOnce()}_renderNativePanel(e=!1){var t;const i=this._getNativeTrackList();if(!i)return;const n=this._getLabelOpts(),r=Mr.createDom("div","",{},"audiotrack-panel-content");for(let a=0;a<i.length;a++){const e=i[a],t=ZA(e,a,n),o=Mr.createDom("div","",{},"panel-Item "+(e.enabled?"select-in":""));o.innerHTML=t,o.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault();const t=this._getNativeTrackList();t&&YA(t,a)})),r.appendChild(o)}const o=null==(t=this.player)?void 0:t.panel;e?null==o||o.updatePanel(r):null==o||o.showPanel(r,this._panelTitle(),!0)}_panelTitle(){var e;return null!=(e=$N.textTips[this.player.lang||"en"])?e:$N.textTips.en}}class XN{constructor(e){this.__args=null,this.sdk=null,this.playerData=null,this.player=null,this._emitter=null,this.beforeCreate&&"function"==typeof this.beforeCreate&&this.beforeCreate(),this.__args=e,this.pluginName="",this.__init(e)}static defineGetterOrSetter(e,t){for(const i in t)Object.defineProperty(e,i,t[i])}static get pluginName(){return"pluginName"}beforeCreate(){}afterCreate(){}beforePlayerCreate(){}afterPlayerCreate(){}destroy(){}__init(e){XN.defineGetterOrSetter(this,{sdk:{get:()=>e.sdk,configurable:!0},player:{get:()=>e.sdk.getPlayerInstance(),configurable:!0},playerData:{get:()=>e.sdk.playerData,configurable:!0},pluginName:{get:()=>e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),configurable:!0},_emitter:{get:()=>e.sdk._emitter,configurable:!0}})}__destroy(){const e=this.sdk,t=this.pluginName;this.destroy&&"function"==typeof this.destroy&&this.destroy(),["sdk","player","playerData","pluginName","_emitter"].map((e=>{Object.defineProperty(this,e,{writable:!0})})),Object.keys(this).map((e=>{this[e]=null,delete this[e]})),Object.setPrototypeOf&&Object.setPrototypeOf(this,null),delete e._sdkPlugins[t]}}const qN=18e5,ZN=1e3,QN="media_info",JN="ttdrama_media_info",eM="[mediaInfoCache]";let tM=c({},{enable:!1,expireTime:qN,cacheType:"memory",maxEntries:100});const iM=new Map,nM=new Map;function rM(e,t={}){as.log(`${eM} ${e}`,t)}function oM(e){var t;return{vid:null==e?void 0:e.vid,playListLength:(null==(t=null==e?void 0:e.playList)?void 0:t.length)||0,hasValidPlayUrl:cM(e)}}function aM(){return c({},tM)}function sM(){const e=iM.size,t=nM.size;iM.clear(),nM.clear();rM("clear success",{memoryCacheCount:e,prefetchedCacheCount:t,localStorageCacheCount:function(){const e=gM();if(!e)return 0;const t=[`${Ss}${QN}_`,`${Ss}${JN}_`],i=[];for(let n=0;n<e.length;n++){const r=e.key(n);r&&t.some((e=>r.startsWith(e)))&&i.push(r)}return i.forEach((t=>e.removeItem(t))),i.length}()})}function lM(e){return"string"==typeof e?e.trim():""}function cM(e){var t;return!!(null==(t=null==e?void 0:e.playList)?void 0:t.some((e=>!!(null==e?void 0:e.url))))}function uM(e){let t=5381;for(let i=0;i<e.length;i++)t=33*t^e.charCodeAt(i);return(t>>>0).toString(36)}function hM(e){const t=dM(e);return t.playAuthTokenHash?uM(JSON.stringify(t)):""}function dM(e){const t=lM(e.playAuthToken);return{playAuthTokenHash:t?uM(t):"",reqParams:fM(e.reqParams),urlQueryParams:e.urlQueryParams,needThumbs:e.needThumbs,needBarrageMask:e.needBarrageMask}}function fM(e){if(!e)return;const t=c({},e);return delete t.Vid,delete t.vid,Object.keys(t).length?t:void 0}const pM={getItem:e=>iM.get(e)||null,setItem(e,t){iM.delete(e),iM.set(e,t)},removeItem(e){iM.delete(e)}};function gM(){try{return"undefined"!=typeof localStorage?localStorage:null==window?void 0:window.localStorage}catch(e){return}}function yM(e){return e.startsWith(`${Ss}${QN}_`)||e.startsWith(`${Ss}${JN}_`)}function vM(){if("memory"===tM.cacheType)return Array.from(iM.keys()).filter(yM);const e=gM();return e?function(e){const t=[];for(let i=0;i<e.length;i++){const n=e.key(i);n&&yM(n)&&t.push(n)}return t}(e):[]}function mM(){return"memory"===tM.cacheType?pM:gM()}function _M(e){try{return JSON.parse(e)}catch(t){return}}function EM(e){const t=lM(e.moduleName),i=lM(e.cacheKey);return t&&i?`${Ss}${t}_${i}`:""}function TM(e){const t=(e.playList||[]).map((e=>function(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t>s(10,12)?t:1e3*t}(e.urlExpireTimestamp||e.MainUrlExpire||e.mainUrlExpire||e.main_url_expire))).filter((e=>!!e));if(t.length)return Math.min(...t)}function bM(e,t){const i=Date.now()+t,n=TM(e);return n?Math.min(i,n-ZN):i}function SM(e){const t=lM(e.moduleName),i=lM(e.cacheKey);return t&&i?`${t}:${i}`:""}function CM(e){const t=SM(e),i=t?nM.get(t):void 0;if(i){if(!(Date.now()>=i.expireAt))return i.lastAccessedAt=Date.now(),i.mediaInfo;nM.delete(t)}}function kM(e,t){const i=SM(e);if(!i||!cM(t))return;const n=bM(t,tM.expireTime);n<=Date.now()||(nM.set(i,{mediaInfo:t,expireAt:n,lastAccessedAt:Date.now()}),function(){const e=nM.size-tM.maxEntries;e<=0||[...nM.entries()].sort((([,e],[,t])=>e.lastAccessedAt-t.lastAccessedAt)).slice(0,e).forEach((([e])=>nM.delete(e)))}())}function IM(e){return{moduleName:lM(e.moduleName),cacheKey:lM(e.cacheKey),cacheKeyInfo:e.cacheKeyInfo,cacheType:tM.cacheType}}function PM(e){const t=mM(),i=EM(e),n=IM(e);if(!t)return void rM("get skip no storage",n);if(!i)return void rM("get skip empty storage key",n);const r=t.getItem(i)||"";if(!r)return void rM("get miss empty cache",n);const o=_M(r);if(!o)return void rM("get miss parse failed",n);const a=null==o?void 0:o.mediaInfo;if(a&&o.expireAt)return Date.now()>=o.expireAt?(t.removeItem(i),void rM("get miss expired and removed",u(c({},n),{expireAt:o.expireAt,now:Date.now()}))):(rM("get hit",c(u(c({},n),{cacheKeyInfo:o.cacheKeyInfo,expireAt:o.expireAt,ttl:o.expireAt-Date.now()}),oM(a))),function(e,t,i,n){try{e.setItem(t,JSON.stringify(u(c({},i),{lastAccessedAt:Date.now()})))}catch(nF){rM("touch failed",u(c({},n),{error:nF}))}}(t,i,o,n),a);rM("get miss invalid cache payload",n)}function DM(e,t,i=qN){const n=mM(),r=EM(e),o=IM(e);if(!n)return void rM("set skip no storage",c(c({},o),oM(t)));if(!r)return void rM("set skip empty storage key",c(c({},o),oM(t)));if(!cM(t))return void rM("set skip invalid media info",c(c({},o),oM(t)));const a=bM(t,i);if(a<=Date.now())return void rM("set skip expired media info",c(u(c({},o),{expireTime:i,expireAt:a}),oM(t)));const s={createdAt:Date.now(),expireAt:a,lastAccessedAt:Date.now(),cacheKeyInfo:e.cacheKeyInfo,mediaInfo:t};try{n.setItem(r,JSON.stringify(s)),function(e){const t=vM(),i=tM.maxEntries;if(t.length<=i)return;const n=t.map((t=>{const i=_M(e.getItem(t)||"");return{key:t,lastAccessedAt:(null==i?void 0:i.lastAccessedAt)||(null==i?void 0:i.createdAt)||0}})).sort(((e,t)=>e.lastAccessedAt-t.lastAccessedAt)),r=t.length-i;n.slice(0,r).forEach((t=>e.removeItem(t.key))),rM("prune success",{removeCount:r,maxEntries:i,cacheType:tM.cacheType})}(n),rM("set success",c(u(c({},o),{cacheKeyInfo:s.cacheKeyInfo,expireTime:i,expireAt:a}),oM(t)))}catch(nF){rM("set failed",c(u(c({},o),{error:nF}),oM(t)))}}function wM(e){if(tM.enable)return function(e){return PM({moduleName:QN,cacheKey:hM(e),cacheKeyInfo:dM(e)})}(e)}function AM(e){return CM({moduleName:QN,cacheKey:hM(e),cacheKeyInfo:dM(e)})||wM(e)}function RM(e,t){tM.enable&&function(e,t,i=qN){DM({moduleName:QN,cacheKey:hM(e),cacheKeyInfo:dM(e)},t,i)}(e,t,tM.expireTime)}const xM=[["format","format"],["codec","codec"],["definition","definition"],["fileType","file_type"],["needThumbs","need_thumbs"],["needBarrageMask","need_barrage_mask"],["unionInfo","union_info"],["quality","quality"],["drmKek","drm_kek"],["jsPlayer","js_player"]];function OM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function LM(e){if(!e)return;const t={};return xM.forEach((([i,n])=>{const r=e[i];"string"==typeof r&&(t[n]=r)})),t}function NM(e){return uM(JSON.stringify(LM(e)||{}))}function MM(e){return!0===(null==e?void 0:e.canIUseGetDramaInfoTranscodeParam)}function UM(e){switch(e){case mR.NOT_SUBMITTED:return"NOT_SUBMITTED";case mR.UNDER_REVIEW:return"UNDER_REVIEW";case mR.FAILED_REVIEW:return"FAILED_REVIEW";case mR.WITHDRAWN:return"WITHDRAWN_REVIEW";case mR.NOT_ON_SHELF:return"NOT_ON_SHELF";default:return"FAILED_GET_EPISODE_INFO"}}function BM(e,t){return void 0!==t?UM(t):(null==e?void 0:e.includes("not found"))||(null==e?void 0:e.includes("未查询"))?"NO_INFO_FOUND":(null==e?void 0:e.includes("query"))||(null==e?void 0:e.includes("查询"))?"FAILED_TO_QUERY":"FAILED_GET_EPISODE_INFO"}function FM(e,t){return e&&t?`${e}${-1===e.indexOf("?")?"?":"&"}${i=t,Object.entries(i).map((([e,t])=>Array.isArray(t)?t.map((t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&"):`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&")}`:e;var i}function HM(e,t=10,i=0){const n=parseInt(`${e}`,t);return Number.isNaN(n)?i:n}function jM(e){var t;return lM(e.defaultDefinition||(null==(t=e.getVideoByToken)?void 0:t.defaultDefinition))}function VM(e){var t,i;const n="sg",r={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}},o={cn:{__PLAY_DOMAIN__:"https://vod.volcengineapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.volcengineapi.com"},mya:{__PLAY_DOMAIN__:"https://vod.ap-southeast-1.volcengineapi.com"}};let a={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}},s=n;return"byteplus"===e&&r?(a=r,s="sg"):"volcengine"===e&&o&&(a=o,s=a[n]?n:"cn"),(null==(t=null==a?void 0:a[n])?void 0:t.__PLAY_DOMAIN__)||(null==(i=null==a?void 0:a[s])?void 0:i.__PLAY_DOMAIN__)||""}function KM(e){return lM(e.albumId||e.album_id)}function WM(e){return lM(e.episodeId||e.episode_id||e.episodeID)}function GM(e,t){const i={episodeId:WM(e)};return!OM(e,"transcodeParam")||t&&!MM(t)||(i.transcodeParam=e.transcodeParam),i}function YM(e){const t=lM(e.episodeId);return t?OM(e,"transcodeParam")?`${t}_${NM(e.transcodeParam||{})}`:t:""}function zM(e){const t={episodeId:lM(e.episodeId)};return OM(e,"transcodeParam")&&(t.transcodeParamHash=NM(e.transcodeParam||{})),t}function $M(e){const t={moduleName:JN,cacheKey:YM(e),cacheKeyInfo:zM(e)};return CM(t)||function(e){if(tM.enable)return PM(e);rM("get skip disabled",u(c({},IM(e)),{config:aM()}))}(t)}function XM(e,t){!function(e,t){tM.enable?DM(e,t,tM.expireTime):rM("set skip disabled",c(u(c({},IM(e)),{config:aM()}),oM(t)))}({moduleName:JN,cacheKey:YM(e),cacheKeyInfo:zM(e)},t)}function qM(e){return AM(ZM(e))}function ZM(e){const t=e.getVideoByToken||{};return u(c({},t),{defaultDefinition:jM(e),reqParams:c({},t.reqParams||{}),urlQueryParams:t.urlQueryParams||e.urlQueryParams})}function QM(e,t){const i=ZM(e);return u(c({},i),{playDomain:i.playDomain||VM(null==t?void 0:t.channel)})}function JM(e,t={}){var i,n,r;const o=(e,t,i)=>{for(const n of t)if(e&&void 0!==e[n])return e[n];return i},a=o(e,["PlayInfoList","playInfoList","play_info_list"],[]),s=o(e,["PosterUrl","posterUrl","poster_url"],""),l=o(e,["Vid","vid"],""),h=o(e,["Duration","duration"],0),d=o(e,["BarrageMaskUrl","barrageMaskUrl","barrage_mask_url"],""),f=o(e,["ThumbInfoList","thumbInfoList","thumb_info_list"],[]),p=o(e,["EnableAdaptive","enableAdaptive","enable_adaptive"],void 0),g=o(e,["AdaptiveBitrateStreamingInfo","adaptiveBitrateStreamingInfo","adaptive_bitrate_streaming_info"],void 0),y=null==t?void 0:t.urlQueryParams,{definitionMap:v,autoDemoteDefinition:m,autoDemoteDefinitionTextKey:_}=t||{},E=a.map((e=>{const t=(t,i)=>o(e,t,i),i=t(["MainPlayUrl","mainPlayUrl","main_play_url"],""),n=t(["BackupPlayUrl","backupPlayUrl","backup_play_url"],""),r=FM(i,y),a=FM(n,y),s=t(["Format","format"],"");return c(c({vid:l,url:r,_mainURL:r,_backupURL:a,streamType:s,backupUrl:a,backUrlList:[a],fileType:t(["FileType","fileType","file_type"]),format:s,bitrate:t(["Bitrate","bitrate"]),size:t(["Size","size"]),kid:t(["PlayAuthId","playAuthId","play_auth_id"]),playAuthId:t(["PlayAuthId","playAuthId","play_auth_id"]),playAuth:t(["PlayAuth","playAuth","play_auth"]),secretKey:t(["PlayAuth","playAuth","play_auth"]),vwidth:t(["Width","width"]),vheight:t(["Height","height"]),vtype:null==s?void 0:s.toLocaleUpperCase(),codec:t(["Codec","codec"]),urlExpireTimestamp:HM(t(["MainUrlExpire","mainUrlExpire","main_url_expire"]),10,Xa),drmType:t(["DrmType","drmType","drm_type"])},e),Ms(e,{definitionMap:v,autoDemoteDefinition:m,autoDemoteDefinitionTextKey:_}))})).sort(_s);return{playList:E,type:(null==(i=E[0])?void 0:i.Format)||(null==(n=E[0])?void 0:n.format)||(null==(r=E[0])?void 0:r.streamType),poster:s||"",vid:l,duration:h||0,dashOpts:{Data:u(c({},e),{VideoID:l})},thumbs:f||[],barrageMaskUrl:d||"",enableAdaptive:p,adaptiveBitrateStreamingInfo:g}}function eU(e){var t;return"string"==typeof e?e:(null==(t=null==e?void 0:e[0])?void 0:t.src)||""}function tU(e,t){var i,n;const r=jM(t),o=function(e,t){const i=e.playList||[];return t&&i.find((e=>{var i;const n=e.mapDefinition||e.definition||e.Definition;return(null==(i=null==n?void 0:n.toLocaleLowerCase)?void 0:i.call(n))===t.toLocaleLowerCase()}))||i[0]}(e,r),a=eU(null==o?void 0:o.url);if(!o||!a)return;const s=o.mapDefinition||o.definition||o.Definition||r,l=o.streamType||o.format||o.Format||e.type||"",c=(o.codec||(null==(n=null==(i=o.Codec)?void 0:i.toLowerCase)?void 0:n.call(i))||tr.H264).toLowerCase();return{vid:e.vid||o.vid||t.vid||"",url:a,definition:s,streamType:l,codec:c,bitrate:HM(o.bitrate||o.Bitrate),duration:HM(o.duration||o.Duration||e.duration),size:HM(o.size||o.Size)}}let iU=!1;const nU=["url","src","_mainURL","_backupURL","backupUrl","MainPlayUrl","mainPlayUrl","main_play_url","BackupPlayUrl","backupPlayUrl","backup_play_url"];function rU(e,t){if(!e)return e;const i=e.indexOf("#"),n=-1===i?"":e.slice(i),r=-1===i?e:e.slice(0,i),o=r.indexOf("?"),a=-1===o?r:r.slice(0,o),s=-1===o?"":r.slice(o+1),l=s?s.split("&").filter((e=>{const t=e.split("=")[0];try{return"t"!==decodeURIComponent(t||"")}catch(i){return"t"!==t}})):[];return l.push(`t=${encodeURIComponent(t)}`),`${a}?${l.join("&")}${n}`}function oU(e,t){return"string"==typeof e?rU(e,t):Array.isArray(e)?e.map((e=>"string"==typeof e?rU(e,t):e&&"object"==typeof e&&"string"==typeof e.src?u(c({},e),{src:rU(e.src,t)}):e)):e}function aU(e,t=Date.now()){if(!iU||!e)return e;const i=c({},e);return nU.forEach((e=>{i[e]&&(i[e]=oU(i[e],t))})),Array.isArray(i.backUrlList)&&(i.backUrlList=i.backUrlList.map((e=>oU(e,t)))),i}function sU(e,t=Date.now()){return iU&&e?u(c({},e),{playList:(e.playList||[]).map((e=>aU(e,t)))}):e}const lU=[{id:1,tag:"cmn-Hans-CN",label:"简体中文"},{id:2,tag:"eng-US",label:"English"},{id:3,tag:"jpn-JP",label:"日本語"},{id:4,tag:"kor-KR",label:"한국어"},{id:5,tag:"cmn-Hans-CN|eng-US",label:"中英双语"},{id:6,tag:"rus-RU",label:"Русский"},{id:7,tag:"fra-FR",label:"Français"},{id:8,tag:"por-PT",label:"Português"},{id:9,tag:"spa-ES",label:"Español"},{id:10,tag:"vie-VN",label:"Tiếng Việt"},{id:11,tag:"afr-ZA",label:"Afrikaans"},{id:12,tag:"ben-BD",label:"বাংলা"},{id:13,tag:"bul-BG",label:"Български"},{id:14,tag:"mya-MM",label:"မြန်မာဘာသာ"},{id:15,tag:"ces-CZ",label:"Čeština"},{id:16,tag:"dan-DK",label:"Dansk"},{id:17,tag:"hrv-HR",label:"Hrvatski"},{id:18,tag:"nld-NL",label:"Nederlands"},{id:19,tag:"fin-FI",label:"Suomi"},{id:20,tag:"deu-DE",label:"Deutsch"},{id:21,tag:"ell-GR",label:"Ελληνικά"},{id:22,tag:"hun-HU",label:"Magyar"},{id:23,tag:"ind-ID",label:"Bahasa Indonesia"},{id:24,tag:"gle-IE",label:"Gaeilge"},{id:25,tag:"isl-IS",label:"Íslenska"},{id:26,tag:"ita-IT",label:"Italiano"},{id:27,tag:"nor-NO",label:"Norsk"},{id:28,tag:"pol-PL",label:"Polski"},{id:29,tag:"swe-SE",label:"Svenska"},{id:30,tag:"tha-TH",label:"ภาษาไทย"},{id:31,tag:"tur-TR",label:"Türkçe"},{id:32,tag:"ukr-UA",label:"Українська"},{id:33,tag:"urd-PK",label:"اردو"},{id:34,tag:"ara-SA",label:"العربية"},{id:35,tag:"fra-CA",label:"Français (Canada)"},{id:36,tag:"cmn-Hant-CN",label:"繁體中文"},{id:37,tag:"msa-MY",label:"Bahasa Melayu"},{id:38,tag:"heb-IL",label:"עברית"},{id:39,tag:"jva-ID",label:"Basa Jawa"},{id:40,tag:"ron-RO",label:"Română"},{id:41,tag:"fil-PH",label:"Filipino"},{id:42,tag:"hin-IN",label:"हिन्दी"},{id:43,tag:"ben-IN",label:"বাংলা (ভারত)"},{id:44,tag:"khm-KH",label:"ភាសាខ្មែរ"},{id:45,tag:"bos-PH",label:"Bosanski"},{id:46,tag:"est-EE",label:"Eesti"},{id:47,tag:"lav-LV",label:"Latviešu"},{id:48,tag:"slk-SK",label:"Slovenčina"},{id:49,tag:"lit-LT",label:"Lietuvių"},{id:50,tag:"uyg-CN",label:"ئۇيغۇرچە"}],cU=new Map,uU=new Map;for(const rF of lU)cU.set(rF.id,rF.label),uU.set(rF.tag.toLowerCase(),rF.label);function hU(...e){for(const t of e){if("string"!=typeof t)continue;const e=t.trim();if(e)return e}return null}function dU(e){return{albumId:hU(null==e?void 0:e.album_id,null==e?void 0:e.albumId),episodeId:hU(null==e?void 0:e.episode_id,null==e?void 0:e.episodeId,null==e?void 0:e.episodeID)}}const fU=AR.getVeErrorInfo,pU={playAuthToken:"",needDefinitionList:!0},gU=(e,t,i,n=!1)=>{for(const r of t){const t=null==e?void 0:e[r];if(void 0!==t&&(!n||""!==t))return t}return i},yU=(e,t="")=>null==e?t:`${e}`;class vU extends XN{constructor(e){super(e),this.isPlayByToken=!1,this.isEncrypt=!1,this.config=null,this.useUnionInfoDRM=!0,this.retryCount=1,this.init()}static get pluginName(){return"AuthToken"}beforePlayerCreate(){return d(this,null,(function*(){if(this.isPlayByToken){const e=yield this.getVideoInfo();e&&this.playerData.initPlayData(e)}}))}getVideoInfo(e){return d(this,null,(function*(){var t;const i=null==(t=this.sdk)?void 0:t._createPlayerPerf,n=()=>d(this,null,(function*(){var t,n,r,o,a,s,l,c,u,h,f,p,g;try{const y=this.isMinisDramaMode&&(null==(t=null==pB?void 0:pB.ttDramaEnv)?void 0:t.canIUseGetDramaInfo);if(!y&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.checkPlayAuthTokenValid",(()=>this.checkPlayAuthTokenValid())):this.checkPlayAuthTokenValid()))return;if(!!this.keyTokenInfo&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.checkKeyTokenValid",(()=>this.checkKeyTokenValid())):this.checkKeyTokenValid()))return;if(!!this.thirdPartyDrmAuthTokenInfo&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.checkDrmAuthTokenValid",(()=>this.checkDrmAuthTokenValid())):this.checkDrmAuthTokenValid()))return;const v=((null==i?void 0:i.measureAsync)?yield i.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getVideos",(()=>d(this,null,(function*(){return yield this.getVideos(e)})))):yield this.getVideos(e))||{};if(!(null==(n=null==v?void 0:v.playList)?void 0:n.length))return void as.error("get no media info");as.log("getVideo res: ",v);const{type:m,poster:_,vid:E,dashOpts:T,thumbs:b,barrageMaskUrl:S}=v||{},C=v.playList||[];null==(o=null==(r=this.sdk)?void 0:r.assertLiteConfig)||o.call(r,{type:m,playList:C,rtm:v.rtm}),this.playInfo=v,this.setSubtitleConfig(v);const k=m||vs(this.config);this.getPrivateDrmInfo&&((null==i?void 0:i.measureAsync)?yield i.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo",(()=>d(this,null,(function*(){return yield this.getPrivateDrmInfo(C,E,k)})))):yield this.getPrivateDrmInfo(C,E,k)),this.playerData.options.vid=E;if(_&&(this.config.needPoster||this.isMinisDramaMode)&&("string"==typeof this.playerData.options.poster?this.playerData.options.poster=_:"object"==typeof this.playerData.options.poster?this.playerData.options.poster.poster=_:this.playerData.options.poster=_),this.config.needThumbs&&b.length>0&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.getThumbnailConfig",(()=>this.getThumbnailConfig(b))):this.getThumbnailConfig(b)),C.length>0){(null==(a=C[0])?void 0:a.drmType)&&this.playerData.setDrmType(C[0].drmType);const t=(null==(l=null==(s=this.playerData)?void 0:s.adapter)?void 0:l.generatePlaylistFromServer(v,this.config.useMasterM3u8))||[...C],n=this.config.defaultDefinition||(null==e?void 0:e.defaultDefinition)||this.playerData.configs.defaultDefinition;let r=t[0];if(n){const e=t.find((e=>(e.mapDefinition||e.definition||e.Definition).toLocaleLowerCase()===n.toLocaleLowerCase()));e&&(r=e)}const o=this.config.needDefinitionList?t:[r];this.isEncrypt=!!(null==o?void 0:o[0].kid);const d=(null==(c=C[0])?void 0:c.codec)||(null==(h=null==(u=C[0])?void 0:u.Codec)?void 0:h.toLowerCase())||(null==(p=null==(f=this.tokenInfo)?void 0:f.Codec)?void 0:p.toLowerCase())||tr.H264,y={vid:E,dashOpts:T,codec:d,playList:o,defaultDefinitionData:r};return(null==i?void 0:i.measure)?(i.measure("beforePlayerCreate.authtoken.getVideoInfo.getDrmConfig",(()=>this.getDrmConfig(y))),i.measure("beforePlayerCreate.authtoken.getVideoInfo.setPluginConfigInVid",(()=>{var e;return null==(e=this.playerData.adapter)?void 0:e.setPluginConfigInVid(y,this)}))):(this.getDrmConfig(y),null==(g=this.playerData.adapter)||g.setPluginConfigInVid(y,this)),{vid:E,playList:o,codec:d,defaultDefinition:r.definition}}as.error("get no media info")}catch(y){if(as.error(y),"VEPLAYER_LITE_UNSUPPORTED_FEATURE"===(null==y?void 0:y.code))throw y}}));return(null==i?void 0:i.measureAsync)?yield i.measureAsync("beforePlayerCreate.authtoken.getVideoInfo",n):yield n()}))}getDramaInfoViaJSB(e){return d(this,null,(function*(){var t,i;const n=pB.ttDramaEnv,r=e||(null==(t=this.playerData)?void 0:t.configs)||{},{albumId:o,episodeId:a}=dU(r),s=r.vid||"";if((null==n?void 0:n.getDramaInfo)&&o&&a)return new Promise((e=>{const t={clientKey:n.clientKey,albumId:o,episodeId:a,vid:s};!0===n.canIUseGetDramaInfoTranscodeParam&&Object.prototype.hasOwnProperty.call(r,"transcodeParam")&&(t.transcodeParam=LM(r.transcodeParam)||{});const i=t=>{var i;as.error("getDramaInfo error:",t);const n={errorType:"drama",errorCode:vR.FAILED_GET_EPISODE_INFO.code,veError:fU({code:vR.FAILED_GET_EPISODE_INFO.code,message:vR.FAILED_GET_EPISODE_INFO.message,textKey:vR.FAILED_GET_EPISODE_INFO.textKey}),errorMessage:vR.FAILED_GET_EPISODE_INFO.message,ext:{originError:t},originError:t};null==(i=this.sdk)||i.delayError.push(n),e(void 0)};try{n.getDramaInfo((t=>{var n,r,l,c;try{if(as.log("getDramaInfoViaJSB res:",t),this.reportGetDramaInfoPerf(t,{albumId:o,episodeId:a,vid:s}),!(null==t?void 0:t.is_success)){as.error("getDramaInfoViaJSB invalid response:",t);const i=BM(null==(n=null==t?void 0:t.error)?void 0:n.error_msg,void 0),o=vR[i]||vR.FAILED_GET_EPISODE_INFO,a={errorType:"drama",errorCode:o.code,veError:fU({code:o.code,message:o.message,textKey:o.textKey}),errorMessage:o.message,ext:{jsbError:null==t?void 0:t.error},originError:t};return null==(r=this.sdk)||r.delayError.push(a),void e(void 0)}const{data:i}=t;if((null==i?void 0:i.status)!==mR.SUCCESS){as.error("getDramaInfoViaJSB invalid response:",t);const n=UM(null==i?void 0:i.status),r=vR[n]||vR.FAILED_GET_EPISODE_INFO,o={errorType:"drama",errorCode:r.code,veError:fU({code:r.code,message:r.message,textKey:r.textKey}),errorMessage:r.message,ext:{status:null==i?void 0:i.status},originError:t};return null==(l=this.sdk)||l.delayError.push(o),void e(void 0)}if(!(null==i?void 0:i.video_info)){as.error("getDramaInfoViaJSB invalid response:",t);const n={errorType:"drama",errorCode:vR.FAILED_TO_QUERY.code,veError:fU({code:vR.FAILED_TO_QUERY.code,message:vR.FAILED_TO_QUERY.message,textKey:vR.FAILED_TO_QUERY.textKey}),errorMessage:vR.FAILED_TO_QUERY.message,ext:{status:null==i?void 0:i.status},originError:t};return null==(c=this.sdk)||c.delayError.push(n),void e(void 0)}as.log("videoInfoRes before transformDramaVideoInfoToRes",i.video_info);const u=this.transformDramaVideoInfoToRes(i.video_info,this.config);as.log("videoInfoRes after transformDramaVideoInfoToRes",u),e(u)}catch(u){i(u)}}),t)}catch(l){i(l)}}));{const e=vR.INVALID_PARAM;null==(i=this.sdk)||i.delayError.push({errorType:yR.network,errorCode:e.code,veError:fU({code:e.code,message:e.message,textKey:e.textKey}),errorMessage:e.message,ext:{},originError:void 0})}}))}mapReviewStatusToErrorCode(e){return UM(e)}mapDramaErrorCode(e,t){return BM(e,t)}transformDramaVideoInfoToRes(e,t){return JM(e,t)}callOnGetMediaInfo(e,t){var i,n,r;if(e)try{null==(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.onGetMediaInfo)||r.call(n,{data:e,fromCache:t})}catch(o){as.error("onGetMediaInfo callback error:",o)}}reportGetDramaInfoPerf(e,t){var i,n,r,o;const a=null==(i=null==e?void 0:e.data)?void 0:i.perf_info;a&&(null==(o=null==(n=this.sdk)?void 0:n.recordGetDramaInfoPerf)||o.call(n,{perfInfo:a,albumId:t.albumId,episodeId:t.episodeId,vid:t.vid,isSuccess:!!(null==e?void 0:e.is_success),status:null==(r=null==e?void 0:e.data)?void 0:r.status,fromCache:!1,timestamp:Date.now()}))}getVideos(e){return d(this,null,(function*(){var t,i,n,r,o,a;const s=null==(t=this.sdk)?void 0:t._createPlayerPerf;if(as.log("tt drama info: ",this.isMinisDramaMode,null==pB?void 0:pB.ttDramaEnv),this.isMinisDramaMode&&(null==(i=null==pB?void 0:pB.ttDramaEnv)?void 0:i.canIUseGetDramaInfo)){const t=u(c({},e||(null==(n=this.playerData)?void 0:n.configs)||{}),{defaultDefinition:(null==e?void 0:e.defaultDefinition)||(null==(o=null==(r=this.playerData)?void 0:r.configs)?void 0:o.defaultDefinition)||(null==(a=this.config)?void 0:a.defaultDefinition),getVideoByToken:this.config}),i=$M(GM(t,pB.ttDramaEnv));if(i){const e=sU(i);return this.callOnGetMediaInfo(e,!0),e}const l=e=>{XM(GM(t,pB.ttDramaEnv),e);const i=sU(e);return this.callOnGetMediaInfo(i,!1),i};if(null==s?void 0:s.measureAsync){return l(yield s.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getVideos.getDramaInfoViaJSB",(()=>d(this,null,(function*(){return yield this.getDramaInfoViaJSB(e)})))))}return l(yield this.getDramaInfoViaJSB(e))}const l=e=>{var t,i,n;try{const i=JSON.parse(e.response);if(100006===Vn(i,"ResponseMetadata.Error.CodeN")){as.error("playAuthToken is invalid or expired, please check or update your playAuthToken");const i={errorType:"token",errorCode:9101,veError:fU(pR.PLAY_AUTH_TOKEN_EXPIRED),errorMessage:"playAuthToken has expired",ext:{serveResponse:"string"==typeof(null==e?void 0:e.response)?null==e?void 0:e.response:"",serveStatus:null==e?void 0:e.status,playAuthToken:this.config.playAuthToken,config:this.config},originError:e};return null==(t=this.sdk)?void 0:t.delayError.push(i)}}catch(o){as.log(o)}null==(i=this._emitter)||i.emit(LA.GET_PLAY_URL_ERR,e);const r={errorType:"token",errorCode:9100,errorMessage:"get play url error by playAuthToken, please check the playAuthToken",veError:fU(pR.GET_PLAY_INFO_ERR),ext:{serveResponse:"string"==typeof(null==e?void 0:e.response)?null==e?void 0:e.response:"",serveStatus:null==e?void 0:e.status,playAuthToken:this.config.playAuthToken},originError:e};null==(n=this.sdk)||n.delayError.push(r)},h=e=>d(this,null,(function*(){if(!this.config.playDomain&&502===(null==e?void 0:e.status)&&this.playerData.apiMap.backupPlayDomain)return this.playerData.playDomainDegrade=!0,yield Ts((()=>Es(c({playDomain:this.playerData.playDomain},this.config))),this.retryCount,(e=>502===e.status),l);l(e)})),f=()=>d(this,null,(function*(){var e,t;const i=c({playDomain:this.config.playDomain||this.playerData.playDomain},this.config),n=hM(i),r=AM(i);if(r){as.log("[mediaInfoCache] authToken use cached media info",{cacheKey:n,vid:r.vid,playListLength:(null==(e=r.playList)?void 0:e.length)||0});const t=sU(r);return this.callOnGetMediaInfo(t,!0),t}as.log("[mediaInfoCache] authToken request media info",{cacheKey:n,retryCount:this.retryCount,playDomain:i.playDomain});const o=yield Ts((()=>Es(i)),this.retryCount,(e=>502===e.status),h);RM(i,o);const a=sU(o);return as.log("[mediaInfoCache] authToken request finished",{cacheKey:n,vid:null==o?void 0:o.vid,playListLength:(null==(t=null==o?void 0:o.playList)?void 0:t.length)||0,mediaInfo:o}),this.callOnGetMediaInfo(a,!1),a}));return(null==s?void 0:s.measureAsync)?yield s.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getVideos.getPlayInfoByAuthToken",f):yield f()}))}getPrivateDrmInfo(e,t,i){return d(this,null,(function*(){var n,r,o,a;const s=null==(n=this.sdk)?void 0:n._createPlayerPerf;if(this.config.getDrmAuthToken&&"function"==typeof this.config.getDrmAuthToken&&this.playerData.unionId){let n;if(this.sessionId=(new Date).getTime().toString(),"hls"===i){const e=(null==s?void 0:s.measureAsync)?yield s.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.loadPlugins.hlsEncrypt",(()=>d(this,null,(function*(){return yield this.sdk.sdkUmdLoader.loadPlugins(Bw.HLSEncrypt)})))):yield this.sdk.sdkUmdLoader.loadPlugins(Bw.HLSEncrypt);n=null==(r=null==e?void 0:e.updateUnionInfo)?void 0:r.call(e,this.playerData.unionId,this.sessionId)}else if("dash"===i){const e=(null==s?void 0:s.measureAsync)?yield s.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.loadPlugins.dash",(()=>d(this,null,(function*(){return yield this.sdk.sdkUmdLoader.loadPlugins(Bw.DASH)})))):yield this.sdk.sdkUmdLoader.loadPlugins(Bw.DASH);n=null==(o=null==e?void 0:e.updateUnionInfo)?void 0:o.call(e,this.playerData.unionId,this.sessionId)}else if(["mp4","m4a"].includes(i)){const e=(null==s?void 0:s.measureAsync)?yield s.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.loadPlugins.mp4Encrypt",(()=>d(this,null,(function*(){return yield jw.loadMp4Encrypt(this.sdk.sdkUmdLoader)})))):yield jw.loadMp4Encrypt(this.sdk.sdkUmdLoader);n=null==(a=null==e?void 0:e.updateUnionInfo)?void 0:a.call(e,this.playerData.unionId,this.sessionId)}if(!n)return void as.error("updateUnionInfo fail");const c=[...new Set(e.map((e=>e.kid)))].join(",");try{const i=(null==s?void 0:s.measureAsync)?yield s.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.getDrmAuthToken",(()=>d(this,null,(function*(){return yield Ys(Vs(this.config.getDrmAuthToken(c,t,n)),200,"The execution time of obtaining privateDrmAuthToken by getDrmAuthToken function of options has exceeded more than 200ms")})))):yield Ys(Vs(this.config.getDrmAuthToken(c,t,n)),200,"The execution time of obtaining privateDrmAuthToken by getDrmAuthToken function of options has exceeded more than 200ms");if(i&&"string"==typeof i){this.privateDrmAuthToken=i;const t=ys(i);(null==t?void 0:t.DrmType)&&(this.useUnionInfoDRM="webdevice"===(null==t?void 0:t.DrmType)),e.forEach((e=>{e.drmKeyToken=this.privateDrmAuthToken}))}}catch(l){as.error("get privaterDrmToken fail")}}}))}getThumbnailConfig(e){const t=e[0],i=c({},this.playerData.configs.thumbnail||{});this.playerData.options.thumbnail=c({pic_num:t.CaptureNum,urls:t.StoreUrls,width:t.CellWidth,height:t.CellHeight,col:t.ImgXLen,row:t.ImgYLen},i)}getBarrageMaskUrl(e){var t,i;const n=null==(t=this.playerData.configs)?void 0:t.DanmuPlugin,r="object"==typeof n?n:{},o=c({},(null==r?void 0:r.maskConfig)||{});this.playerData.configs.DanmuPlugin?(this.playerData.options.DanmuPlugin.maskActive=null==(i=r.maskActive)||i,this.playerData.options.DanmuPlugin.maskConfig=c({maskUrl:e},o)):this.playerData.options.DanmuPlugin={active:!0,maskActive:!0,maskConfig:c({maskUrl:e},o)}}setSubtitleConfig(e){var t,i,n,r,o,a,s,l,h;if(!(null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.autoSubtitle)||!e)return;const d=this.getAutoSubtitleList(e),f=null==(n=this.playerData.options)?void 0:n.Subtitle,p=null==(r=this.playerData.configs)?void 0:r.Subtitle,g="object"==typeof f&&f?f:"object"==typeof p&&p?p:{};this.playerData.options.Subtitle=u(c({},g),{list:d}),null==(h=null==(l=null==(s=null==(a=null==(o=this.sdk)?void 0:o.player)?void 0:a.plugins)?void 0:s.subtitle)?void 0:l.updateSubtitles)||h.call(l,d)}getAutoSubtitleList(e){const t=this.getSubtitleSourceData(e),i=gU(t,["SubtitleInfoList","subtitleInfoList","subtitle_info_list"],[]);if(!Array.isArray(i))return[];const n=i.map(((e,t)=>this.getAutoSubtitleItem(e,t))).filter((e=>Boolean(e)));return n.some((e=>void 0!==e._subtitleOrder))&&n.sort(((e,t)=>{var i,n;return(null!=(i=e._subtitleOrder)?i:1/0)-(null!=(n=t._subtitleOrder)?n:1/0)})),n.forEach((e=>{delete e._subtitleOrder})),n}getSubtitleSourceData(e){const t=null==e?void 0:e.dashOpts;return(null==t?void 0:t.Data)||(null==t?void 0:t.data)||e}getAutoSubtitleItem(e,t){const i="string"==typeof e?this.getStringAutoSubtitleItem(e,t):this.getObjectAutoSubtitleItem(e,t);if(i)return this.formatAutoSubtitleItem(i,e,t)}getStringAutoSubtitleItem(e,t){const i=`${t+1}`;return c({id:`${t}`,language:`${t}`,label:i,text:i},!/\n/.test(n=e)&&(/^(https?:)?\/\//.test(n)||/^data:/.test(n)||/\.(vtt|srt)([?#].*)?$/i.test(n))?{url:e}:{stringContent:e});var n}getObjectAutoSubtitleItem(e,t){if(!e||"object"!=typeof e)return;const i=gU(e,["SubtitleUrl","subtitleUrl","subtitle_url","url","src"],"",!0),n=gU(e,["StringContent","stringContent","string_content"],"",!0),r=gU(e,["List","list"]);if(!i&&!n&&!r)return;const o=function(e,t){const i="string"==typeof e?parseInt(e,10):e;if("number"==typeof i&&!isNaN(i)){const e=cU.get(i);if(e)return e}if(t){const e=uU.get(t.toLowerCase());if(e)return e}}(gU(e,["LanguageId","languageId","language_id"],void 0,!0),gU(e,["Language","language"],"",!0)),a=o||yU(gU(e,["Title","title","label","text","Language","language","Tag","tag","LanguageId","languageId","language_id"],`${t+1}`,!0),`${t+1}`),s=yU(gU(e,["SubtitleId","subtitleId","subtitle_id","FileId","fileId","file_id","id"],`${t}`,!0),`${t}`),l=yU(gU(e,["Language","language","LanguageId","languageId","language_id","srclang"],`${t}`,!0),`${t}`);return c(c(c(u(c({},e),{id:s,language:l,label:a,text:a}),i?{url:i}:{}),n?{stringContent:n}:{}),r?{list:r}:{})}formatAutoSubtitleItem(e,t,i){var n,r;const o=null==(r=null==(n=this.playerData)?void 0:n.configs)?void 0:r.formatAutoSubtitleItem;if("function"!=typeof o)return e;const a=o(t,i);if(!1!==a&&null!==a){if(!0===a||void 0===a)return e;if("string"==typeof a||"number"==typeof a){const t=`${a}`;return u(c({},e),{label:t,text:t})}if("object"==typeof a){if(!1===a.show||!1===a.visible)return;const t=Object.prototype.hasOwnProperty.call(a,"order"),i=Object.prototype.hasOwnProperty.call(a,"label")||Object.prototype.hasOwnProperty.call(a,"text")?(()=>{var t;const i=yU(null!=(t=a.label)?t:a.text,"");return u(c({},e),{label:i,text:i})})():e;t&&(i._subtitleOrder=a.order);const n=Object.prototype.hasOwnProperty.call(a,"isDefault"),r=Object.prototype.hasOwnProperty.call(a,"default");return(n||r)&&(i.isDefault=n?Boolean(a.isDefault):Boolean(a.default)),i}return e}}getDrmConfig(e){var t,i,n,r,o,a,s,l;const{thirdPartyDrmAuthToken:u,serverCertificatePath:h}=this.config;if(u)try{const{vid:u,playList:d}=e,{kid:f,codec:p}=null==d?void 0:d[0];if(!f||!u)return void as.warn("get kid or vid fail");const g=null==(t=this.playerData.configs)?void 0:t.drm,y="object"==typeof g?g:{},{playDomain:v}=this.config,m=v||this.playerData.playDomain,_=function(e,t="GetPlayInfoToken"){const i=ps(window.atob(e));return i?i[t]:""}(this.config.thirdPartyDrmAuthToken,"GetThirdPartyDrmAuthToken"),E=c({ignoreLicenseHeader:!1,unRecord:null!=(i=this.config.unRecord)&&i,contentType:ir[p],initDataType:"cenc",[Za.FAIRPLAY]:{serverProcessSPCPath:bs(Za.FAIRPLAY,f,m,_),serverCertificatePath:h},[Za.WIDEVINE]:{serverProcessSPCPath:bs(Za.WIDEVINE,f,m,_)},[Za.PLAYREADY]:{serverProcessSPCPath:bs(Za.PLAYREADY,f,m,_)}},y);(null==(o=null==(r=null==(n=this.sdk)?void 0:n.player)?void 0:r.plugins)?void 0:o.drm)&&(null==(l=null==(s=null==(a=this.sdk)?void 0:a.player)?void 0:s.plugins)||l.drm.updateConfig(E)),this.playerData.options.drm=E}catch(d){as.error("generate drm config error:",d)}else this.playerData.options.drm={initDataType:"cenc"}}get isMinisDramaMode(){const e=pB.ttDramaEnv;return!!(null==e?void 0:e.getDramaInfo)}init(){const e=this.playerData.configs,{getVideoByToken:t={}}=e;this.initConfig(t)}initConfig(e,t){var i;const n=t||(null==(i=this.playerData)?void 0:i.configs)||{},{albumId:r,episodeId:o}=dU(n),a=!(!r||!o),s=!!pB.ttDramaEnv;if(this.isPlayByToken=!!e.playAuthToken||s&&a,this.isPlayByToken&&(this.config=Object.assign({},pU,e),Object.prototype.hasOwnProperty.call(n,"definitionMap")&&(this.config.definitionMap=n.definitionMap),e.playAuthToken)){if(this.tokenInfo=gs(e.playAuthToken),e.keyToken){const t=(l=e.keyToken,/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/.test(l)?window.atob(e.keyToken):e.keyToken);this.keyTokenInfo=ys(t)}e.thirdPartyDrmAuthToken&&(this.thirdPartyDrmAuthTokenInfo=gs(e.thirdPartyDrmAuthToken,"GetThirdPartyDrmAuthToken")),e.retryCount&&(this.retryCount=e.retryCount)}var l}updateDramaEpisode(e,t){return d(this,null,(function*(){var i,n,r;const o=t||(null==(i=this.playerData)?void 0:i.configs)||{},a=o.getVideoByToken||{},s={config:this.config,isPlayByToken:this.isPlayByToken,tokenInfo:this.tokenInfo,keyTokenInfo:this.keyTokenInfo,thirdPartyDrmAuthTokenInfo:this.thirdPartyDrmAuthTokenInfo,retryCount:this.retryCount};this.initConfig(a,o);const l=yield this.getVideoInfo(o);if(!l)throw this.config=s.config,this.isPlayByToken=s.isPlayByToken,this.tokenInfo=s.tokenInfo,this.keyTokenInfo=s.keyTokenInfo,this.thirdPartyDrmAuthTokenInfo=s.thirdPartyDrmAuthTokenInfo,this.retryCount=s.retryCount,new Error("Failed to get drama media info");if(t&&(this.playerData.configs=t),e)this.playerData.initPlayData(l);else{const e=this.playerData.current.definition,t=(null==(n=l.playList)?void 0:n.find((t=>{var i,n;const r=t.mapDefinition||t.definition||t.Definition;return(null==(i=null==r?void 0:r.toLocaleLowerCase)?void 0:i.call(r))===(null==(n=null==e?void 0:e.toLocaleLowerCase)?void 0:n.call(e))})))||(null==(r=l.playList)?void 0:r[0]),i=(null==t?void 0:t.mapDefinition)||(null==t?void 0:t.definition)||(null==t?void 0:t.Definition);this.playerData.updateConfigs(u(c({},l),{defaultDefinition:i})),this.playerData.updatePlayList(),t&&this.playerData.initCurrent(t),this.playerData.updateCheckExpireData()}}))}updateAuthToken(e,t){return d(this,null,(function*(){const i=Object.assign({},this.config,e);this.initConfig(i);const n=yield this.getVideoInfo();n&&(t?this.playerData.initPlayData(n):(this.playerData.updateConfigs(u(c({},n),{defaultDefinition:this.playerData.current.definition})),this.playerData.updatePlayList(),this.playerData.updateCheckExpireData()))}))}checkPlayAuthTokenValid(){var e,t;if(!this.tokenInfo)return!1;if(ms(this.tokenInfo)){as.error("playAuthToken is expired, please check or update your playAuthToken"),null==(e=this.sdk)||e.delayEvents.push({name:OA.TOKEN_EXPIRED,payload:{type:"playAuthToken",token:this.tokenInfo}});const i={errorType:"token",errorCode:9101,veError:fU(pR.PLAY_AUTH_TOKEN_EXPIRED),errorMessage:"playAuthToken has expired",ext:{playAuthToken:this.config.playAuthToken,config:this.config},originError:void 0};return null==(t=this.sdk)||t.delayError.push(i),!0}return!1}checkKeyTokenValid(){var e,t;if(ms(this.keyTokenInfo)){as.error("keyToken is expired, please check or update your keyToken"),null==(e=this.sdk)||e.delayEvents.push({name:OA.TOKEN_EXPIRED,payload:{type:"keyToken",token:this.keyTokenInfo}});const i={errorType:"token",errorCode:9102,veError:fU(pR.HLS_KEY_TOKEN_EXPIRED),errorMessage:"keyToken for hls encrypt play has expired",ext:{keyToken:this.config.keyToken,config:this.config},originError:void 0};return null==(t=this.sdk)||t.delayError.push(i),!0}return!1}checkDrmAuthTokenValid(){var e,t;if(ms(this.thirdPartyDrmAuthTokenInfo)){as.error("thirdPartyDrmAuthToken is expired, please check or update your thirdPartyDrmAuthToken"),null==(e=this.sdk)||e.delayEvents.push({name:OA.TOKEN_EXPIRED,payload:{type:"thirdPartyDrmAuthToken",token:this.thirdPartyDrmAuthTokenInfo}});const i={errorType:"token",errorCode:9103,errorMessage:"thirdPartyDrmAuthToken for DRM has expired",veError:fU(pR.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED),ext:{thirdPartyDrmAuthToken:this.config.thirdPartyDrmAuthToken,config:this.config},originError:void 0};return null==(t=this.sdk)||t.delayError.push(i),!0}return!1}}class mU extends XN{static get pluginName(){return"Abr"}constructor(e){super(e)}static get defaultConfig(){return{autoDefiText:"",isOpenAutoDefi:!1,interval:1e3,hurryThreshold:.25,lowThreshold:.4,highThreshold:.7,noStallCheckTime:5,isOpenHint:!1,method:31}}beforePlayerCreate(){return d(this,null,(function*(){return yield this.prepareAbrModule()}))}prepareAbrModule(){return d(this,null,(function*(){var e,t;return null==(t=null==(e=this.sdk.playerData)?void 0:e.adapter)?void 0:t.prepareAbrModule(this.playerData,this.sdk.sdkUmdLoader)}))}adaptAbrOptions(){var e;const t=null==(e=this.playerData.configs)?void 0:e.autoBitrateOpts;if(t){const e=this.playerData.defaultDefinition;return u(c(c({},mU.defaultConfig),t),{autoDefiText:t.autoDefinitionText||"",isOpenAutoDefi:this.playerData.isOpenABR(),isPlayAutoDefi:this.playerData.isPlayAutoDefinition(e)})}}applyAbrConfig(e){var t,i;const n=this.adaptAbrOptions();n&&(null==(i=null==(t=this.sdk.playerData)?void 0:t.adapter)||i.applyAbrPluginConfig(e,n))}}class _U extends XN{static get pluginName(){return"AdaptRange"}constructor(e){super(e)}adaptRangeOptions(){var e,t,i,n,r,o,a,s;const l=null!=(t=null==(e=this.playerData.configs)?void 0:e.adaptRange)?t:void 0;if(!(null==l?void 0:l.enable)||!(null==(n=null==(i=this.playerData.adapter)?void 0:i.canAdaptRangeEnable)?void 0:n.call(i)))return;const h=this.playerData.adapter.adaptRangeDefaultOptions();return u(c(c({},null!=h?h:{}),l),{minTargetCacheDur:null!=(r=l.minCacheDuration)?r:null==h?void 0:h.minTargetCacheDur,maxTargetCacheDur:null!=(o=l.maxCacheDuration)?o:null==h?void 0:h.maxTargetCacheDur,rangeMinDuration:null!=(a=l.minRangeDuration)?a:null==h?void 0:h.rangeMinDuration,rangeMaxDuration:null!=(s=l.maxRangeDuration)?s:null==h?void 0:h.rangeMaxDuration})}applyRangeConfig(e){const t=this.adaptRangeOptions();t&&e&&this.playerData.adapter.applyAdaptRangePluginConfig(e,t)}}class EU extends XN{static get pluginName(){return"Strategy"}applyFinalStrategy(e){var t,i,n,r;if(pA.isReady()){const o=this.playerData.configs.duration||(null==(i=null==(t=this.playerData.playList)?void 0:t[0])?void 0:i.duration)||-1,a=o>0&&o<=180?"svideo":o>180&&o<=1800?"mvideo":"lvideo",s={vtype:null==(n=this.playerData.adapter)?void 0:n.streamType,duration:o,videoLabel:a},l=pA.getStrategyRecommendations(void 0,s),{result:c}=l;as.log("VodLogCommon Final StrategyConfig:",c);const u=null==c?void 0:c[cA.ADAPT_RANGE];(null==u?void 0:u.enable)&&(null==u?void 0:u.options)&&(null==(r=this.playerData.adapter)||r.applyAdaptRangeStrategy(e,u.options))}}}const TU={init(e){var t;if(!e)return;const i=e.playerData.sdkPlugins;(null==(t=e.playerData)?void 0:t.isLive)?e.sdkPlugins=[...i]:e.sdkPlugins=[vU,mU,_U,EU,...i],e._sdkPlugins={}},registerPlugin(e,t){if(!e||!t)return;let i=null,n=null;e.plugin&&"function"==typeof e.plugin?(i=e.plugin,n=e.options):(i=e,n={}),n.sdk=t;const r=n.pluginName||i.pluginName;if(!r)throw new Error("The property pluginName is necessary");const o=t._sdkPlugins;try{o[r.toLowerCase()]&&this.unRegister(r);const e=new i(n);return o[r.toLowerCase()]=e,o[r.toLowerCase()].func=i,e&&"function"==typeof e.afterCreate&&e.afterCreate(),e}catch(a){as.error(a)}},unRegister(e,t){if(e&&t){e=e.toLowerCase();try{const i=t._sdkPlugins[e];i&&(i.pluginName&&i.__destroy(),delete t._sdkPlugins[e])}catch(i){as.error(i)}}},beforePlayerCreate(e){if(!e)return;e._sdkPlugins||this.init(e);const t=e._sdkPlugins,i=null==e?void 0:e._createPlayerPerf,n=[];for(const o of Object.keys(t))if(t[o]&&t[o].beforePlayerCreate)try{const e=()=>Vs(t[o].beforePlayerCreate());(null==i?void 0:i.measureAsync)?n.push(i.measureAsync(`beforePlayerCreate.${o}`,e)):n.push(e())}catch(r){throw n.push(Vs(null)),r}return new Promise(((e,t)=>{Promise.all([...n]).then((()=>{e(null)})).catch((i=>{as.error(i),"VEPLAYER_LITE_UNSUPPORTED_FEATURE"!==(null==i?void 0:i.code)?e(null):t(i)}))}))},afterPlayerCreate(e){if(!e)return;const t=e._sdkPlugins;for(const n of Object.keys(t))if(t[n]&&t[n].beforePlayerCreate)try{t[n].afterPlayerCreate()}catch(i){throw i}},destroy(e){if(!e)return;const t=e._sdkPlugins;if(t){for(const i of Object.keys(t))this.unRegister(i,e);delete e._sdkPlugins}}},bU={[fR.NETWORK]:"Network error",[fR.NETWORK_TIMEOUT]:"Network timeout",[fR.NETWORK_FORBIDDEN]:"The video URL is prohibited from access. Please check the domain name access control",[fR.NETWORK_NOTFOUND]:"The video not found, please check whether the URL is correct",[fR.NETWORK_RANGE_NOT_SATISFIABLE]:"The request range is incorrect, please try again later",[fR.NETWORK_PROTOCOL]:"The request protocol is incorrect, please use the https URL to access",[fR.NETWORK_URL_EXPIRE]:"The video URL has expired",[fR.NETWORK_URL_SIGN]:"The video URL signature is incorrect, please check whether the URL is correct",[fR.NETWORK_ENCRYPT_HLS_ERR]:"Get the m3u8 file or encrypt key fail",[fR.MEDIA_ERR]:"Media error",[fR.MEDIA_ERR_ABORTED]:"Playback was canceled by the user or browser",[fR.MEDIA_ERR_NETWORK]:"Network error",[fR.MEDIA_ERR_DECODE]:"Decoding error",[fR.MEDIA_ERR_SRC_NOT_SUPPORTED]:"Audio/Video format not supported or URL unavailable",[fR.MEDIA_ERR_NOT_SUPPORTED]:"Unsupported video format",[fR.MEDIA_ERR_URL_EMPTY]:"Video URL is empty",[fR.MEDIA_ERR_FILE_NOT_SUPPORTED]:"Video file is not supported in the current browser environment",[fR.MEDIA_ERR_PLAY_ERR]:"Video playback error",[fR.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"Unsupported video type",[fR.BUSINESS_DRM_NOT_SUPPORT]:"DRM encrypted playback is not supported",[fR.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"Screen recording protection is not supported",[fR.BUSINESS_DRM_LACK_MEDIA_KEY]:"Video data lacks the corresponding MediaKey",[fR.BUSINESS_DRM_LACK_KEY_SESSION]:"Browser does not support the corresponding DRM KeySession",[fR.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"Decryption playback error",[fR.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"Missing DRM certificate request link",[fR.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"Missing DRM License request link",[fR.BUSINESS_DRM_LICENSE_FAIL]:"Request or update License failed",[fR.BUSINESS_DRM_KEY_ERROR]:"Decryption error",[fR.BUSINESS_DRM_CERT_FAIL]:"Request for DRM certificate failed",[fR.PRIVATE_DRM_KEY_GET_FAILED]:"Private DRM get key failed",[fR.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"Web cryptography API is not supported, please visit page by https",[fR.PRIVATE_DRM_RSA_FAIL]:"Decryption by RSA-OAEP failed, please check playAuthId",[fR.OTHER]:"Other error",[fR.VOD_LOG_NOT_CONFIGURED]:"Log options not configured correctly",[fR.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthToken has expired",[fR.HLS_KEY_TOKEN_EXPIRED]:"keyToken has expired",[fR.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthToken has expired",[fR.GET_PLAY_INFO_ERR]:"Failed to get media information",[fR.GET_HLS_DECRYPTION_KEY_ERR]:"Failed to get HLS key",[fR.LICENSE_VALIDATE_FAIL]:"License validation failed",[fR.DEFINITION_AUTO]:"Auto",[fR.LICENSE_STATUS_INVALID]:"License validation is invalid",[fR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"license domain name does not match",[fR.BASE_LICENSE_NOT_SUPPORT_265]:"The basic license does not support H265",[fR.BASE_LICENSE_NOT_SUPPORT_ABR]:"The basic license does not support ABR",[fR.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"The basic license does not support dynamic buffer",[fR.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"The basic license does not support preload",[fR.EXPIRED_LICENSE_NOT_SUPPORT_265]:"Expired license does not support H265",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"Expired license does not support ABR",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"The expired license does not support dynamic buffer",[fR.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"Expired license does not support preloading",[fR.DRAMA_INVALID_PARAM]:"Invalid parameter",[fR.DRAMA_NO_INFO_FOUND]:"No information found for this episode",[fR.DRAMA_NOT_SUBMITTED]:"Episode has not been submitted for review",[fR.DRAMA_UNDER_REVIEW]:"Episode is under review",[fR.DRAMA_FAILED_REVIEW]:"Episode failed review",[fR.DRAMA_WITHDRAWN_REVIEW]:"Episode review was withdrawn",[fR.DRAMA_FAILED_TO_QUERY]:"Failed to query video playback information",[fR.DRAMA_INVALID_TTOP_TOKEN]:"Invalid playback credential or TTOP signature verification failed",[fR.DRAMA_NOT_ON_SHELF]:"Video is not on shelf",[fR.DRAMA_FAILED_GET_EPISODE_INFO]:"Failed to get episode information"},SU={[fR.NETWORK]:"网络错误",[fR.NETWORK_TIMEOUT]:"网络超时",[fR.NETWORK_FORBIDDEN]:"视频地址禁止访问,请检查域名访问控制",[fR.NETWORK_NOTFOUND]:"视频不存在,请检查视频地址是否正确",[fR.NETWORK_RANGE_NOT_SATISFIABLE]:"请求 range 不正确,请稍后再试",[fR.NETWORK_PROTOCOL]:"请求协议错误,请使用 https 地址访问",[fR.NETWORK_URL_EXPIRE]:"视频地址已过期",[fR.NETWORK_URL_SIGN]:"视频地址签名错误,请检查地址是否正确",[fR.NETWORK_ENCRYPT_HLS_ERR]:"m3u8 文件或密钥获取失败",[fR.MEDIA_ERR]:"播放错误",[fR.MEDIA_ERR_ABORTED]:"播放被用户或浏览器取消",[fR.MEDIA_ERR_NETWORK]:"网络错误",[fR.MEDIA_ERR_DECODE]:"解码错误",[fR.MEDIA_ERR_SRC_NOT_SUPPORTED]:"音/视频格式不支持或地址不可用",[fR.MEDIA_ERR_NOT_SUPPORTED]:"不支持的视频格式",[fR.MEDIA_ERR_URL_EMPTY]:"视频地址为空",[fR.MEDIA_ERR_FILE_NOT_SUPPORTED]:"视频文件当前浏览器环境下不支持",[fR.MEDIA_ERR_PLAY_ERR]:"视频播放错误",[fR.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"不支持的视频类型",[fR.BUSINESS_DRM_NOT_SUPPORT]:"DRM加密播放不支持",[fR.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"不支持防录屏",[fR.BUSINESS_DRM_LACK_MEDIA_KEY]:"视频数据缺少相应 MediaKey",[fR.BUSINESS_DRM_LACK_KEY_SESSION]:"浏览器不支持相应 DRM KeySession",[fR.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"解密播放错误",[fR.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"缺少 DRM 证书请求链接",[fR.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"缺少 DRM License 请求链接",[fR.BUSINESS_DRM_LICENSE_FAIL]:"请求或更新 License 失败",[fR.BUSINESS_DRM_KEY_ERROR]:"解密错误",[fR.BUSINESS_DRM_CERT_FAIL]:"请求DRM证书失败",[fR.PRIVATE_DRM_KEY_GET_FAILED]:"私有加密密钥解析失败",[fR.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"当前浏览器不支持Crypto API,请使用https环境访问",[fR.PRIVATE_DRM_RSA_FAIL]:"解密错误,请检查playAuthId是否正确",[fR.OTHER]:"其他错误",[fR.VOD_LOG_NOT_CONFIGURED]:"未正确配置质量日志参数",[fR.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthToken 已过期",[fR.HLS_KEY_TOKEN_EXPIRED]:"keyToken 已过期",[fR.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthToken 已过期",[fR.GET_PLAY_INFO_ERR]:"获取媒体信息失败",[fR.GET_HLS_DECRYPTION_KEY_ERR]:"获取 HLS 密钥失败",[fR.LICENSE_VALIDATE_FAIL]:"license 校验失败",[fR.DEFINITION_AUTO]:"自动",[fR.LICENSE_STATUS_INVALID]:"license 校验无效",[fR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"license 域名不匹配",[fR.BASE_LICENSE_NOT_SUPPORT_265]:"基础版license 不支持H265",[fR.BASE_LICENSE_NOT_SUPPORT_ABR]:"基础版license 不支持自适应码率",[fR.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"基础版license 不支持动态Buffer",[fR.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"基础版license 不支持预加载",[fR.EXPIRED_LICENSE_NOT_SUPPORT_265]:"已过期版license 不支持H265",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"已过期版license 不支持自适应码率",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"已过期版license 不支持动态Buffer",[fR.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"已过期版license 不支持预加载",[fR.DRAMA_INVALID_PARAM]:"参数错误",[fR.DRAMA_NO_INFO_FOUND]:"未查询到该剧集信息",[fR.DRAMA_NOT_SUBMITTED]:"剧集未送审",[fR.DRAMA_UNDER_REVIEW]:"剧集审核中",[fR.DRAMA_FAILED_REVIEW]:"剧集审核不通过",[fR.DRAMA_WITHDRAWN_REVIEW]:"剧集审核撤回",[fR.DRAMA_FAILED_TO_QUERY]:"查询视频播放信息失败",[fR.DRAMA_INVALID_TTOP_TOKEN]:"播放凭证无效或TTOP签名验证失败",[fR.DRAMA_NOT_ON_SHELF]:"视频未上架",[fR.DRAMA_FAILED_GET_EPISODE_INFO]:"查询剧集信息失败"},CU={[fR.NETWORK]:"ネットワークエラー",[fR.NETWORK_TIMEOUT]:"ネットワークタイムアウト",[fR.NETWORK_FORBIDDEN]:"動画のURLへのアクセスが禁止されています。ドメインアクセス制御を確認してください",[fR.NETWORK_NOTFOUND]:"動画が存在しません。動画アドレスが正しいか確認してください",[fR.NETWORK_RANGE_NOT_SATISFIABLE]:"リクエスト範囲が正しくありません。後でもう一度お試しください",[fR.NETWORK_PROTOCOL]:"リクエストプロトコルエラー。httpsアドレスを使用してアクセスしてください",[fR.NETWORK_URL_EXPIRE]:"動画のURLは期限切れです",[fR.NETWORK_URL_SIGN]:"動画のURL署名エラー。アドレスが正しいか確認してください",[fR.NETWORK_ENCRYPT_HLS_ERR]:"m3u8 ファイルまたはキーの取得に失敗しました",[fR.MEDIA_ERR]:"再生エラー",[fR.MEDIA_ERR_ABORTED]:"再生がユーザーまたはブラウザによってキャンセルされました",[fR.MEDIA_ERR_NETWORK]:"ネットワークエラー",[fR.MEDIA_ERR_DECODE]:"デコードエラー",[fR.MEDIA_ERR_SRC_NOT_SUPPORTED]:"音声/動画フォーマットがサポートされていないか、アドレスが利用できません",[fR.MEDIA_ERR_NOT_SUPPORTED]:"サポートされていない動画フォーマット",[fR.MEDIA_ERR_URL_EMPTY]:"動画のURLが空です",[fR.MEDIA_ERR_FILE_NOT_SUPPORTED]:"動画ファイルは現在のブラウザ環境でサポートされていません",[fR.MEDIA_ERR_PLAY_ERR]:"動画再生エラー",[fR.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"サポートされていない動画の種類",[fR.BUSINESS_DRM_NOT_SUPPORT]:"DRM暗号化再生はサポートされていません",[fR.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"録画防止はサポートされていません",[fR.BUSINESS_DRM_LACK_MEDIA_KEY]:"動画データに対応するMediaKeyが不足しています",[fR.BUSINESS_DRM_LACK_KEY_SESSION]:"ブラウザが対応するDRM KeySessionをサポートしていません",[fR.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"復号再生エラー",[fR.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"DRM証明書リクエストリンクが不足しています",[fR.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"DRMライセンスリクエストリンクが不足しています",[fR.BUSINESS_DRM_LICENSE_FAIL]:"ライセンスのリクエストまたは更新に失敗しました",[fR.BUSINESS_DRM_KEY_ERROR]:"復号エラー",[fR.BUSINESS_DRM_CERT_FAIL]:"DRM証明書のリクエストに失敗しました",[fR.PRIVATE_DRM_KEY_GET_FAILED]:"プライベートDRMキーの取得に失敗しました",[fR.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"現在のブラウザはCrypto APIをサポートしていません。アクセスするにはhttps環境を使用してください",[fR.PRIVATE_DRM_RSA_FAIL]:"復号化エラー。playAuthIdが正しいかどうかを確認してください",[fR.OTHER]:"その他のエラー",[fR.VOD_LOG_NOT_CONFIGURED]:"品質ログパラメータが正しく設定されていません",[fR.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthTokenが期限切れです",[fR.HLS_KEY_TOKEN_EXPIRED]:"keyTokenが期限切れです",[fR.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthTokenが期限切れです",[fR.GET_PLAY_INFO_ERR]:"動画情報の取得に失敗しました",[fR.GET_HLS_DECRYPTION_KEY_ERR]:"HLSキーの取得に失敗しました",[fR.LICENSE_VALIDATE_FAIL]:"ライセンスの検証に失敗しました",[fR.DEFINITION_AUTO]:"自動",[fR.LICENSE_STATUS_INVALID]:"ライセンス検証が無効です",[fR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"ライセンスドメイン名が一致しません",[fR.BASE_LICENSE_NOT_SUPPORT_265]:"基本ライセンスはH265をサポートしていません",[fR.BASE_LICENSE_NOT_SUPPORT_ABR]:"基本ライセンスはアダプティブビットレートをサポートしていません",[fR.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"基本ライセンスはダイナミックバッファをサポートしていません",[fR.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"基本ライセンスはプリロードをサポートしていません",[fR.EXPIRED_LICENSE_NOT_SUPPORT_265]:"期限切れのライセンスはH265をサポートしていません",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"期限切れのライセンスはアダプティブ ビットレートをサポートしていません",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"期限切れのライセンスは動的バッファをサポートしていません",[fR.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"期限切れのライセンスはプリロードをサポートしていません",[fR.DRAMA_INVALID_PARAM]:"パラメータが無効です",[fR.DRAMA_NO_INFO_FOUND]:"このエピソードの情報が見つかりません",[fR.DRAMA_NOT_SUBMITTED]:"エピソードは審査に提出されていません",[fR.DRAMA_UNDER_REVIEW]:"エピソードは審査中です",[fR.DRAMA_FAILED_REVIEW]:"エピソードは審査に不合格でした",[fR.DRAMA_WITHDRAWN_REVIEW]:"エピソードの審査が取り下げられました",[fR.DRAMA_FAILED_TO_QUERY]:"動画再生情報の取得に失敗しました",[fR.DRAMA_INVALID_TTOP_TOKEN]:"再生資格情報が無効か、TTOP署名の検証に失敗しました",[fR.DRAMA_NOT_ON_SHELF]:"動画は未公開です",[fR.DRAMA_FAILED_GET_EPISODE_INFO]:"エピソード情報の取得に失敗しました"},kU=[{LANG:"en",TEXT:bU},{LANG:"zh",TEXT:SU},{LANG:"zh-hk",TEXT:{[fR.NETWORK]:"網路錯誤",[fR.NETWORK_TIMEOUT]:"網路逾時",[fR.NETWORK_FORBIDDEN]:"視頻地址禁止訪問,請檢查域名訪問控制",[fR.NETWORK_NOTFOUND]:"視頻不存在,請檢查視訊地址是否正確",[fR.NETWORK_RANGE_NOT_SATISFIABLE]:"請求範圍不正確,請稍後再試",[fR.NETWORK_PROTOCOL]:"請求協議錯誤,請使用 https 地址訪問",[fR.NETWORK_URL_EXPIRE]:"視頻地址已過期",[fR.NETWORK_URL_SIGN]:"視頻地址簽名錯誤,請檢查地址是否正確",[fR.NETWORK_ENCRYPT_HLS_ERR]:"m3u8 檔案或金鑰取得失敗",[fR.MEDIA_ERR]:"播放錯誤",[fR.MEDIA_ERR_ABORTED]:"播放被用戶或瀏覽器取消",[fR.MEDIA_ERR_NETWORK]:"網路錯誤",[fR.MEDIA_ERR_DECODE]:"解碼錯誤",[fR.MEDIA_ERR_SRC_NOT_SUPPORTED]:"音/視頻格式不支援或地址不可用",[fR.MEDIA_ERR_NOT_SUPPORTED]:"不支援的視頻格式",[fR.MEDIA_ERR_URL_EMPTY]:"視頻地址為空",[fR.MEDIA_ERR_FILE_NOT_SUPPORTED]:"視頻文件在當前瀏覽器環境下不支援",[fR.MEDIA_ERR_PLAY_ERR]:"視頻播放錯誤",[fR.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"不支援的視頻類型",[fR.BUSINESS_DRM_NOT_SUPPORT]:"不支援 DRM 加密播放",[fR.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"不支援防錄屏",[fR.BUSINESS_DRM_LACK_MEDIA_KEY]:"視頻數據缺少相應 MediaKey",[fR.BUSINESS_DRM_LACK_KEY_SESSION]:"瀏覽器不支援相應 DRM KeySession",[fR.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"解密播放錯誤",[fR.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"缺少 DRM 證書請求鏈接",[fR.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"缺少 DRM License 請求鏈接",[fR.BUSINESS_DRM_LICENSE_FAIL]:"請求或更新 License 失敗",[fR.BUSINESS_DRM_KEY_ERROR]:"解密錯誤",[fR.BUSINESS_DRM_CERT_FAIL]:"請求 DRM 證書失敗",[fR.PRIVATE_DRM_KEY_GET_FAILED]:"私有加密金鑰解析失敗",[fR.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"目前瀏覽器不支援Crypto API,請使用https環境訪問",[fR.PRIVATE_DRM_RSA_FAIL]:"解密錯誤,請檢查playAuthId是否正確",[fR.OTHER]:"其他錯誤",[fR.VOD_LOG_NOT_CONFIGURED]:"未正確配置質量日誌參數",[fR.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthToken 已過期",[fR.HLS_KEY_TOKEN_EXPIRED]:"keyToken 已過期",[fR.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthToken 已過期",[fR.GET_PLAY_INFO_ERR]:"獲取視頻信息失敗",[fR.GET_HLS_DECRYPTION_KEY_ERR]:"獲取 HLS 密鑰失敗",[fR.LICENSE_VALIDATE_FAIL]:"license 校驗失敗",[fR.DEFINITION_AUTO]:"自動",[fR.LICENSE_STATUS_INVALID]:"license 校驗無效",[fR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"license 域名不匹配",[fR.BASE_LICENSE_NOT_SUPPORT_265]:"基礎版license 不支援H265",[fR.BASE_LICENSE_NOT_SUPPORT_ABR]:"基礎版license 不支援自適應碼率",[fR.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"基礎版license 不支援動態Buffer",[fR.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"基礎版license 不支援預載入",[fR.EXPIRED_LICENSE_NOT_SUPPORT_265]:"已過期版license 不支援H265",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"已過期版license 不支援自適應碼率",[fR.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"已過期版license 不支援動態Buffer",[fR.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"已過期版license 不支援預載入",[fR.DRAMA_INVALID_PARAM]:"參數錯誤",[fR.DRAMA_NO_INFO_FOUND]:"未查詢到該劇集資訊",[fR.DRAMA_NOT_SUBMITTED]:"劇集未送審",[fR.DRAMA_UNDER_REVIEW]:"劇集審核中",[fR.DRAMA_FAILED_REVIEW]:"劇集審核不通過",[fR.DRAMA_WITHDRAWN_REVIEW]:"劇集審核撤回",[fR.DRAMA_FAILED_TO_QUERY]:"查詢視頻播放資訊失敗",[fR.DRAMA_INVALID_TTOP_TOKEN]:"播放憑證無效或TTOP簽名驗證失敗",[fR.DRAMA_NOT_ON_SHELF]:"影片未上架",[fR.DRAMA_FAILED_GET_EPISODE_INFO]:"查詢劇集資訊失敗"}},{LANG:"jp",TEXT:CU}],IU="ignoreServicePreloadConfigEnable";class PU extends Error{constructor(e,t){super(t),this.code=e}}const DU=new Map;function wU(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function AU(e){return!!(e&&KM(e)&&WM(e))}function RU(e){var t;return!!(null==(t=null==e?void 0:e.getVideoByToken)?void 0:t.playAuthToken)}function xU(e,t){return e instanceof PU?e:new PU(t.code,t.message)}function OU(e,t,i){const n=`${t.cacheOptions.moduleName}:${t.cacheOptions.cacheKey}`,r=DU.get(n);if(r)return r;const o="ttDrama"===t.kind?function(e,t){const i=KM(t),n=WM(t);if(!(null==e?void 0:e.getDramaInfo)||!i||!n){const e=vR.INVALID_PARAM;return Promise.reject(new PU(e.code,e.message))}const r={clientKey:e.clientKey,albumId:i,episodeId:n,vid:t.vid||""};return MM(e)&&wU(t,"transcodeParam")&&(r.transcodeParam=LM(t.transcodeParam)||{}),new Promise(((i,n)=>{try{e.getDramaInfo((r=>{var o,a,s,l;try{if(!(null==r?void 0:r.is_success)){const e=BM(null==(o=null==r?void 0:r.error)?void 0:o.error_msg,void 0),t=vR[e];return void n(new PU(t.code,t.message))}if((null==(a=r.data)?void 0:a.status)!==mR.SUCCESS){const e=UM(null==(s=r.data)?void 0:s.status),t=vR[e];return void n(new PU(t.code,t.message))}if(!(null==(l=r.data)?void 0:l.video_info)){const e=vR.FAILED_TO_QUERY;return void n(new PU(e.code,e.message))}const c=JM(r.data.video_info,QM(t,e));if(!cM(c)){const e=vR.FAILED_TO_QUERY;return void n(new PU(e.code,e.message))}i(c)}catch(nF){n(xU(nF,vR.FAILED_GET_EPISODE_INFO))}}),r)}catch(nF){n(xU(nF,vR.FAILED_GET_EPISODE_INFO))}}))}(i,e):function(e,t){return d(this,null,(function*(){const i=QM(e,t);try{const e=gs(i.playAuthToken);if(ms(e)){const e=pR.PLAY_AUTH_TOKEN_EXPIRED;throw new PU(e.code,e.message)}const t=yield Es(i);if(!cM(t))throw new PU(pR.GET_PLAY_INFO_ERR.code,pR.GET_PLAY_INFO_ERR.message);return t}catch(nF){throw xU(nF,pR.GET_PLAY_INFO_ERR)}}))}(e,i);DU.set(n,o);const a=()=>{DU.get(n)===o&&DU.delete(n)};return o.then(a,a),o}function LU(e,t){return d(this,null,(function*(){try{const i=function(e,t){if(AU(e)&&!0===(null==t?void 0:t.canIUseGetDramaInfo)){const i=GM(e,t);return{kind:"ttDrama",cacheOptions:{moduleName:JN,cacheKey:YM(i),cacheKeyInfo:zM(i)}}}if(RU(e)){const t=ZM(e);return{kind:"playAuthToken",cacheOptions:{moduleName:QN,cacheKey:hM(t),cacheKeyInfo:dM(t)}}}if(AU(e)){const e=vR.INVALID_PARAM;throw new PU(e.code,e.message)}throw new PU(8e3,"Unsupported media info source")}(e,t),n=function(e,t,i){const n=CM(t.cacheOptions);return n||("ttDrama"===t.kind?$M(GM(e,i)):qM(e))}(e,i,t);if(n)return{status:"fulfilled",source:e,data:n,fromCache:!0};const r=yield OU(e,i,t);return kM(i.cacheOptions,r),{status:"fulfilled",source:e,data:r,fromCache:!1}}catch(nF){const i=xU(nF,pR.OTHER);return{status:"rejected",source:e,error:{code:i.code,message:i.message}}}}))}function NU(e,t){const i=QM(e,t);return i.playAuthToken?Es(i).catch((()=>{})):Promise.resolve(void 0)}function MU(e,t){return d(this,null,(function*(){if(t&&!t.canIUseGetDramaInfo)return UU(e,t);const i=function(e,t){const i=$M(GM(e,t));return i?tU(i,e):void 0}(e,t);if(i)return aU(i);if(!(null==t?void 0:t.canIUseGetDramaInfo))return UU(e,t);const n=yield function(e,t){const i=KM(t),n=WM(t);if(!i||!n)return Promise.resolve(void 0);if(!(null==e?void 0:e.canIUseGetDramaInfo))return NU(t,e);if(!e.getDramaInfo)return Promise.resolve(void 0);const r={clientKey:e.clientKey,albumId:i,episodeId:n,vid:t.vid||""};return MM(e)&&wU(t,"transcodeParam")&&(r.transcodeParam=LM(t.transcodeParam)||{}),new Promise((i=>{try{e.getDramaInfo((n=>{try{if(!(null==n?void 0:n.is_success))return as.error("[ttdrama] getDramaInfo invalid response",n),void i(void 0);const{data:r}=n;if((null==r?void 0:r.status)!==mR.SUCCESS||!(null==r?void 0:r.video_info))return as.error("[ttdrama] getDramaInfo invalid response",n),void i(void 0);const o=JM(r.video_info,QM(t,e));i(o)}catch(r){as.error("[ttdrama] getDramaInfo invalid response",n),i(void 0)}}),r)}catch(n){as.error("[ttdrama] getDramaInfo call failed",n),i(void 0)}}))}(t,e);return n?(XM(GM(e,t),n),aU(tU(n,e))):void 0}))}function UU(e,t){return d(this,null,(function*(){const i=function(e){const t=qM(e);return t?tU(t,e):void 0}(e);if(i)return aU(i);const n=yield NU(e,t);var r;return n?(r=n,RM(ZM(e),r),aU(tU(n,e))):void 0}))}function BU(e,t){return d(this,null,(function*(){if(eU(e.url))return e;if(AU(e)){const i=yield MU(e,t);return i||t||RU(e)?i:e}return RU(e)?UU(e,t):e}))}function FU(e,t){return d(this,null,(function*(){if(!(null==e?void 0:e.length))return e||[];let i;if(Vr.os.isAndroid&&!(null==t?void 0:t.canAndroidBatchGetDramaInfo)){i=[];for(const n of e)i.push(yield BU(n,t))}else i=yield Promise.all(e.map((e=>BU(e,t))));return i.filter(Boolean)}))}const HU=["live","rtm","music","danmu","ad"],jU=["configs","options","defaultConfig","current"],VU=["url","src","playUrl","playURL"],KU=["plugins","sdkPlugins","strategiesPlugins","presets"];class WU extends Error{constructor(e){var t;super(`[VEPLAYER_LITE_UNSUPPORTED_FEATURE] ${e} 功能不受精简版支持,请改用 ${function(e){const t=(e||"").toUpperCase();return t.includes("BYTEPLUS")?"@byteplus/veplayer":t.includes("VOLCENGINE")?"@volcengine/veplayer":"@byted-vcloud/veplayer"}("undefined"==typeof process||null==(t=process.env)?void 0:t.LUX_REGION)}。`),this.code="VEPLAYER_LITE_UNSUPPORTED_FEATURE",this.name="VePlayerLiteUnsupportedFeatureError",this.feature=e,Object.setPrototypeOf(this,WU.prototype)}}class GU extends Error{constructor(){super("[VEPLAYER_LITE_UNSUPPORTED_ENVIRONMENT] 当前环境不支持 Lite 版本使用"),this.code="VEPLAYER_LITE_UNSUPPORTED_ENVIRONMENT",this.name="VePlayerLiteUnsupportedEnvironmentError",Object.setPrototypeOf(this,GU.prototype)}}function YU(e){return"object"==typeof e&&null!==e||"function"==typeof e}function zU(e,t){if(YU(e))try{return e[t]}catch(i){return}}function $U(e){try{return Array.isArray(e)}catch(t){return!1}}function XU(e){if(!$U(e))return[];const t=zU(e,"length");if("number"!=typeof t||t<0||t>4294967295||Math.floor(t)!==t)return[];const i=[];for(let n=0;n<t;n+=1)i.push(zU(e,String(n)));return i}function qU(e){return null!=e&&!1!==e}function ZU(e){return"string"==typeof e?e.toLowerCase():""}function QU(e){return"string"==typeof e&&e.split(/[?#]/,1)[0].toLowerCase().endsWith(".sdp")}function JU(e){return VU.some((t=>function(e){const t=[e],i=new WeakSet;for(let n=0;n<t.length;n+=1){const e=t[n];if(QU(e))return!0;if(YU(e)&&!i.has(e))if(i.add(e),$U(e))for(const i of XU(e))t.push(i);else for(const i of VU)t.push(zU(e,i))}return!1}(zU(e,t))))}function eB(e){if("string"==typeof e)return[e];if(!YU(e))return[];const t=[],i=zU(e,"pluginName"),n=zU(e,"name");return"string"==typeof i&&t.push(i),"string"==typeof n&&t.push(n),t}function tB(e,t){return KU.some((i=>XU(zU(e,i)).some((e=>function(e){const t=eB(e);return t.push(...eB(zU(e,"plugin"))),t.push(...eB(zU(e,"preset"))),t}(e).some((e=>function(e,t){const{compact:i,parts:n}=function(e){const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().replace(/[\s_]+/g,"-").replace(/-+/g,"-");return{compact:t.replace(/-/g,""),parts:t.split("-")}}(t);switch(e){case"live":return"timeshiftplugin"===i||"liveinfopanel"===i||i.startsWith("livesubtitles");case"rtm":return"rtm"===i||"rtmplugin"===i;case"music":return i.includes("music");case"danmu":return i.includes("danmu");case"ad":return n.some((e=>"ad"===e||"ads"===e))||["ad","ads","adplugin","adsplugin"].includes(i)}}(t,e)))))))}function iB(e,t){switch(t){case"live":return!0===zU(e,"isLive")||"live"===ZU(zU(e,"type"))||qU(zU(e,"TimeShiftPlugin"))||qU(zU(e,"LiveInfoPanel"))||qU(zU(e,"LiveSubtitlesPlugin"))||qU(zU(e,"LiveSubtitlesIconPlugin"));case"rtm":return"rtm"===ZU(zU(e,"streamType"))||qU(zU(e,"rtm"))||JU(e);case"music":return!0===zU(e,"isMusic")||qU(zU(e,"music"));case"danmu":{const t=zU(e,"getVideoByToken");return qU(zU(e,"DanmuPlugin"))||!0===zU(e,"needBarrageMask")||!0===zU(t,"needBarrageMask")}case"ad":return qU(zU(e,"AdsPlugin"))||qU(zU(e,"AdPlugin"))}}function nB(e){const t=function(e){const t=[],i=[e],n=new WeakSet;for(let r=0;r<i.length;r+=1){const e=i[r];if(YU(e)&&!n.has(e)){n.add(e),t.push(e);for(const t of jU)i.push(zU(e,t));for(const t of XU(zU(e,"playList")))i.push(t)}}return t}(e);for(const i of HU)if(t.some((e=>iB(e,i)||tB(e,i))))throw new WU(i)}const rB=()=>Mr.generateSessionId(),oB=e=>"number"==typeof e&&Number.isFinite(e)&&e>=0?e:0,aB=e=>c({},e),sB=(e,t)=>t.lastEnteredPlayingAt-e.lastEnteredPlayingAt||t.sequence-e.sequence,lB=(e,t)=>t.lastPlaybackAt-e.lastPlaybackAt||t.sequence-e.sequence,cB=(e,t)=>t.createdAt-e.createdAt||t.sequence-e.sequence,uB=(e,t,i="creating")=>({playbackSessionId:t,playbackState:i,isEnded:!1,isPaused:!1,isBeforePlayerCreate:!0,albumId:e.albumId,episodeId:e.episodeId,duration:0,currentTime:0});const hB=new class{constructor(e=Date.now,t=rB){this.now=e,this.createPlaybackSessionId=t,this.sessions=new Map,this.transactionResolvers=new WeakMap,this.historical=null,this.sequence=0}register(e,t){const i=this.now(),n=++this.sequence,r=this.createPlaybackSessionId();this.sessions.set(e,{vePlayer:e,playbackSessionId:r,pendingPlaybackSessionId:null,identity:c({},t),pendingIdentity:null,identitySwitchCore:null,pendingTransaction:null,identitySwitchArmed:!1,identitySwitchIsSameCore:!1,useStableSnapshot:!1,core:null,state:"creating",creationFailed:!1,hasEverPlayed:!1,isBuffering:!1,createdAt:i,lastEnteredPlayingAt:0,lastPlaybackAt:0,sequence:n,lastStableSnapshot:uB(t,r)})}has(e){return this.sessions.has(e)}beginCoreCreate(e,t){const i=this.sessions.get(e);i&&(!this.matchesPendingTransaction(i,t)&&i.pendingTransaction||(i.core=null,i.state="creating",i.creationFailed=!1,i.isBuffering=!1,this.matchesPendingTransaction(i,t)&&(i.identitySwitchCore=null,i.identitySwitchArmed=!1,i.identitySwitchIsSameCore=!1)))}failCoreCreate(e,t){const i=this.sessions.get(e);i&&(!this.matchesPendingTransaction(i,t)&&i.pendingTransaction||(i.core=null,i.state="error",i.creationFailed=!0,i.isBuffering=!1,this.matchesPendingTransaction(i,t)&&this.rollbackIdentitySwitch(e,t)))}attachCore(e,t,i){var n;const r=this.sessions.get(e);if(r&&(this.matchesPendingTransaction(r,i)||!r.pendingTransaction)){r.core=t,r.state="ready",r.creationFailed=!1,r.isBuffering=!1,this.matchesPendingTransaction(r,i)&&(r.identitySwitchCore=t,r.identitySwitchArmed=!0,r.identitySwitchIsSameCore=!1);for(const i of["play","playing","waiting","canplay","timeupdate","pause","ended","error"])null==(n=t.on)||n.call(t,i,(()=>this.handleCoreEvent(e,t,i)))}}handleCoreEvent(e,t,i){const n=this.sessions.get(e);if(n&&n.core===t&&("error"!==i&&"canplay"!==i||!n.pendingTransaction||n.identitySwitchArmed||n.identitySwitchCore!==t)){if("play"===i||"playing"===i){const e="playing"!==n.state,t=this.now();return n.hasEverPlayed=!0,n.isBuffering=!1,n.state="playing",n.lastPlaybackAt=t,void(e&&(n.lastEnteredPlayingAt=t))}if("waiting"!==i){if(n.isBuffering=!1,"canplay"===i)return n.pendingTransaction?n.identitySwitchArmed&&n.identitySwitchCore===t&&this.commitIdentitySwitch(e,n.pendingTransaction):(n.useStableSnapshot=!1,n.lastStableSnapshot=null),void(n.hasEverPlayed||(n.state="ready"));if("timeupdate"!==i)if("pause"!==i){if("ended"===i)return n.hasEverPlayed=!0,n.lastPlaybackAt=this.now(),void(n.state="ended");n.state="error",n.pendingTransaction&&n.identitySwitchArmed&&n.identitySwitchCore===t&&this.rollbackIdentitySwitch(e,n.pendingTransaction)}else n.hasEverPlayed&&(n.lastPlaybackAt=this.now(),n.state="paused");else n.hasEverPlayed&&(n.lastPlaybackAt=this.now(),n.state=t.paused?"paused":"playing")}else n.hasEverPlayed&&(n.isBuffering=!0,n.state="buffering")}}beginIdentitySwitch(e,t,i,n=!1,r){const o=this.sessions.get(e);if(!o)return null;if(!!o.pendingIdentity||!!o.pendingPlaybackSessionId){if(!this.matchesPendingTransaction(o,r))return null}else o.lastStableSnapshot=this.snapshotSession(o,null!=i?i:o.core).snapshot,o.identitySwitchCore=null!=i?i:o.core,o.identitySwitchArmed=!1,o.identitySwitchIsSameCore=!0,o.pendingTransaction=this.createIdentitySwitchTransaction();return o.pendingIdentity=c({},t),n&&!o.pendingPlaybackSessionId&&(o.pendingPlaybackSessionId=this.createPlaybackSessionId()),o.useStableSnapshot=!0,o.pendingTransaction}armIdentitySwitch(e,t,i){const n=this.sessions.get(e);return!(!n||n.core!==i||!this.matchesPendingTransaction(n,t))&&(n.identitySwitchCore=i,n.identitySwitchArmed=!0,n.identitySwitchIsSameCore=!0,!0)}hasActiveIdentitySwitch(e){var t;return!!(null==(t=this.sessions.get(e))?void 0:t.pendingTransaction)}commitIdentitySwitch(e,t){const i=this.sessions.get(e);if(!i||!i.pendingIdentity&&!i.pendingPlaybackSessionId||!this.matchesPendingTransaction(i,t))return;i.pendingIdentity&&(i.identity=i.pendingIdentity),i.pendingPlaybackSessionId&&(i.playbackSessionId=i.pendingPlaybackSessionId),i.pendingIdentity=null,i.pendingPlaybackSessionId=null,i.identitySwitchCore=null,i.identitySwitchArmed=!1,i.identitySwitchIsSameCore=!1;const n=i.pendingTransaction;i.pendingTransaction=null,i.useStableSnapshot=!1,i.lastStableSnapshot=null,this.settleTransaction(n)}rollbackIdentitySwitch(e,t){const i=this.sessions.get(e);if(!i||!this.matchesPendingTransaction(i,t))return;const n=!i.identitySwitchIsSameCore&&!!i.core&&i.core===i.identitySwitchCore,r=i.identitySwitchIsSameCore&&!!i.core&&i.core===i.identitySwitchCore;i.pendingIdentity=null,i.pendingPlaybackSessionId=null,i.identitySwitchCore=null,i.identitySwitchArmed=!1,i.identitySwitchIsSameCore=!1;const o=i.pendingTransaction;i.pendingTransaction=null,i.useStableSnapshot=!r&&!!i.lastStableSnapshot,r&&(i.lastStableSnapshot=null),n&&(i.core=null),this.settleTransaction(o)}destroy(e,t){const i=this.sessions.get(e);if(!i)return;const n=i.useStableSnapshot&&i.lastStableSnapshot?this.rank(i,aB(i.lastStableSnapshot)):this.snapshotSession(i,null!=t?t:i.core);n.snapshot=u(c({},n.snapshot),{playbackState:"destroyed",isBeforePlayerCreate:!1}),n.state="destroyed",this.settleTransaction(i.pendingTransaction),this.sessions.delete(e),n.hasEverPlayed&&(!this.historical||lB(n,this.historical)<0)&&(this.historical=n)}query(e){const t=[];for(const a of this.sessions.values()){if((a.pendingIdentity||a.pendingPlaybackSessionId||a.useStableSnapshot)&&a.lastStableSnapshot){t.push(this.rank(a,aB(a.lastStableSnapshot)));continue}const i=e.find((e=>e===a.core&&e.sdk===a.vePlayer));try{const e=this.snapshotSession(a,null!=i?i:null);a.lastStableSnapshot=aB(e.snapshot),t.push(e)}catch(o){a.lastStableSnapshot&&t.push(this.rank(a,aB(a.lastStableSnapshot)))}}const i=t.filter((e=>"playing"===e.state||"buffering"===e.state)).sort(sB)[0];if(i)return aB(i.snapshot);const n=t.filter((e=>e.hasEverPlayed)).concat(this.historical?[this.historical]:[]).sort(lB)[0];if(n)return aB(n.snapshot);const r=t.sort(cB)[0];return r?aB(r.snapshot):null}resetForTests(){this.sessions.clear(),this.historical=null,this.sequence=0}createIdentitySwitchTransaction(){let e;const t={settled:new Promise((t=>{e=t}))};return this.transactionResolvers.set(t,e),t}settleTransaction(e){if(!e)return;const t=this.transactionResolvers.get(e);t&&(this.transactionResolvers.delete(e),t())}matchesPendingTransaction(e,t){return!!t&&e.pendingTransaction===t}snapshotSession(e,t){if(!t){const t=e.creationFailed?"error":"creating";return this.rank(e,uB(e.identity,e.playbackSessionId,t))}const i=!!t.paused,n=!!t.ended;let r;return r=t.isError||"error"===e.state?"error":n||"ended"===e.state?"ended":e.hasEverPlayed&&i?"paused":e.hasEverPlayed&&e.isBuffering?"buffering":e.hasEverPlayed?"playing":"ready",this.rank(e,{playbackSessionId:e.playbackSessionId,playbackState:r,isEnded:n,isPaused:i,isBeforePlayerCreate:!1,albumId:e.identity.albumId,episodeId:e.identity.episodeId,duration:oB(t.duration),currentTime:oB(t.currentTime)})}rank(e,t){return{snapshot:t,state:t.playbackState,hasEverPlayed:e.hasEverPlayed,createdAt:e.createdAt,lastEnteredPlayingAt:e.lastEnteredPlayingAt,lastPlaybackAt:e.lastPlaybackAt,sequence:e.sequence}}};window.Player||(window.Player=Wa);const dB=class{constructor(e){this.player=null,this.mountingDom=null,this.playerContainer=null,this.mobilePanel=null,this._lastSelectedAudioTrack=null,this._suppressAudioTrackMemory=!1,this._suppressAudioTrackMemoryTimer=null,this._playNextPending=!1,this._isCollectingCreatePlayerPerf=!1,this._getDramaInfoPerfRecords=[],this._isFirstCreated=!0,this.sdkPlugins=[],this._sdkPlugins={},this.delayError=[],this._publicPlayNextOperation=null,this._lifecycleGeneration=0,this._isVolcengine=!1,this._originConfigs={},this.delayEvents=[],this.createPlayer=e=>d(this,null,(function*(){const t=this._lifecycleGeneration||0;hB.beginCoreCreate(this,e);try{const i=yield this._createPlayer(e,t);return this._isStaleLifecycleGeneration(t)?void this._discardStalePlayer(i):i}catch(nF){throw hB.failCoreCreate(this,e),nF}})),this._createPlayer=(e,...t)=>d(this,[e,...t],(function*(e,t=this._lifecycleGeneration||0){var i,n,r,o,a,s,l;this._createPlayerPerf=new Os,this._isCollectingCreatePlayerPerf=!0;const f=this._createPlayerPerf;if(yield f.measureAsync("destroyPlayer",(()=>d(this,null,(function*(){yield this._destroyPlayer()})))),this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();if(yield this.beforePlayerCreate(),this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();nB(this.playerData);const{options:p,plugins:g,isMobile:y,openSoftDecoding:v,configs:m,strategiesPlugins:_,strategiesPluginConfigs:E}=this.playerData,T=!1,b=this.playerData.isOpenABR()?void 0:this.playerData.getCurrentUrl(),S=this.playerData.getCurrentStreamType()||vs(null==m?void 0:m.getVideoByToken);Ws(m,"EncryptHlsPlugin")||b&&S||this.playerData.isOpenABR()||(as.warn(`url is empty or streamType is empty (url:${b}, streamType: ${S})`),this.renderPoster());const C=()=>d(this,null,(function*(){const e=tl(b);return yield this.getSoftDecodingOption(v,e,S)})),k=yield f.measureAsync("createSDKPreset",(()=>d(this,null,(function*(){return yield vN({isLive:T,isMobile:y,streamType:S,playerData:this.playerData,getSoftOptionTask:C},this)}))));if(this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();const{presets:I,softDecodingOption:P,plugins:D}=k,w=y?function(e=!1){const t=c({},RN),i=c({},e?xN:ON);return c(c({},t),i)}(T):function(e=!1){const t=c({},PN),i=c({},e?DN:wN);return c(c({},t),i)}(T),{basicPlugins:A=[],iconPlugins:R=[]}=this._analyzeExtendPlugins(),x=P||{},{plugins:O=[]}=x,L=h(x,["plugins"]),N=this.getDefinitionConfig(),M=Mr.deepMerge(w,p),U=u(c(u(c(c(c({},{errorKey:SR}),M),L||{}),{definition:N,icons:c(c(c({},w.icons),{}),null!=(i=null==p?void 0:p.icons)?i:{}),MoreButtonPlugin:{iconPlugins:[...null!=(r=null==(n=p.MoreButtonPlugin)?void 0:n.iconPlugins)?r:[],...R,GN,FN,$N]}}),E),{playerData:this.playerData});this.playerData.getLineList().length>1&&U.MoreButtonPlugin.iconPlugins.push(VN),this.setDefaultConfigOptions(U);const B=function(e){const t=[];return e.forEach((e=>{t.find((t=>{var i,n;return(null==(i=null==t?void 0:t.pluginName)?void 0:i.toLowerCase())===(null==(n=null==e?void 0:e.pluginName)?void 0:n.toLowerCase())}))||t.push(e)})),t}([...A,...g,...D,...O,..._]),F=(null!=(o=null==U?void 0:U.ignores)?o:[]).some((e=>"sdkunmuteplugin"===(e+"").toLowerCase()));U.ignores=[...null!=(a=null==U?void 0:U.ignores)?a:[],...F?["AutoplayPlugin"]:[]],this._isFirstCreated?this._isFirstCreated=!1:(U.autoplayMuted=!1,U.ignores=[...null!=(s=null==U?void 0:U.ignores)?s:[],"sdkUnmutePlugin"]),this.setPluginConfig(U);const H={},j=null==(l=dB.ttDramaEnv)?void 0:l.videoSecurityModule;if(null==j?void 0:j.generateSignature){const e=yield f.measureAsync("videoSecuritySignature",(()=>d(this,null,(function*(){return yield j.generateSignature()}))));e&&(H["data-tt-sign"]=e)}if(this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();this._emitter.emit(OA.READY_CREATE_PLAYER);let V,K={};if(dB.shouldCheckLicense()){const e=yield dB.checkLicenseStatus();e!==TA.LICENSE_STATUS_OK&&e!==TA.LICENSE_STATUS_EXPIRED&&(K={progress:{closeMoveSeek:!0,isCloseClickSeek:!0},sdkErrorPlugin:{isNeedRefreshButton:!1}})}if(this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();if(f.measure("instantiatePlayer",(()=>{var e;V=new Wa(u(c(c({el:this.playerContainer,presets:I,url:b,isLive:!1},U),K),{videoAttributes:c(c({},null!=(e=U.videoAttributes)?e:{}),H),plugins:[...B]}))})),this._isStaleLifecycleGeneration(t))return this._discardStalePlayer(V),this._cancelStalePlayerCreation();this.player=V,V.playerData=this.playerData,V.sdk=this,hB.attachCore(this,V,e);const W=f.finish();return this._isCollectingCreatePlayerPerf=!1,this._lastCreatePlayerPerfReport=W,this.emit(OA.CREATE_PLAYER_PERF,W),as.log("createPlayer perf: ",W),this._emitter.emit(OA.PLAYER_CREATED_FINISH),this.afterPlayerCreate(),V})),this._onMp4PreloadInfo=e=>{this.emit(LA.PRELOAD_INFO,e)},this._proxyError=e=>this.emit(UA.ERROR,e),this._onError=e=>{var t;const{errorCode:i,httpCode:n,mediaError:r}=e||{};if(Mr.isMSE(null==(t=this.player)?void 0:t.media))n+""!="403"&&i+""!="9203"||this._emitExpireEvent("error",e);else if(4===(null==r?void 0:r.code)||2===(null==r?void 0:r.code)){const t=tl(this.playerData.getCurrentUrl());t&&As(t,{range:"0-8",timeout:2e3}).then((t=>{as.log("xhr result",t);const{status:i,response:n}=t;403===i&&"string"==typeof n&&n.includes("expire")&&this._emitExpireEvent("error",e)})).catch((e=>{as.log("xhr error",e)}))}},this._onNativeAddTrack=()=>{var e,t;if(this._getHlsInstance())return;this._playNextPending=!1;const i=null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks;if(!i)return;const n=[];for(let r=0;r<i.length;r++){const e=i[r];n.push({id:e.id,name:e.label||e.language||e.id,lang:e.language,default:e.enabled,selected:e.enabled})}this._applyAudioPreferenceNative(i),this._emitter.emit(OA.AUDIO_TRACKS_UPDATED,{audioTracks:n})},this._onNativeTrackChange=()=>{var e,t;if(this._getHlsInstance())return;const i=null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks;if(i)for(let n=0;n<i.length;n++){const e=i[n];if(e.enabled){const t={id:n,name:e.label||e.language||String(n),lang:e.language,default:e.enabled,selected:!0};this._playNextPending||(this._lastSelectedAudioTrack=t),this._emitter.emit(OA.AUDIO_TRACK_CHANGE,{id:n,audioTrack:t});break}}},function(e){if(!e)throw new GU}(Boolean(dB.ttDramaEnv)),this.assertLiteConfig(e),hB.register(this,dU(e)),this._init(e)}static getPlayerPlaybackState(){var e,t,i;const n=null!=(i=null==(t=null==(e=Wa.instManager)?void 0:e.findAll)?void 0:t.call(e,(e=>!!(null==e?void 0:e.sdk)&&hB.has(e.sdk))))?i:[];return hB.query(n)}static registerModules(e){sA.registerModules(e)}static setAppendVideoUrlTimestamp(e=!0){!function(e=!0){iU=!!e}(e)}static getAppendVideoUrlTimestamp(){return iU}static setTTDramaEnv(e){var t;as.log("TTDramaEnv: ",e);dB.ttDramaEnv=u(c({},e),{channel:null!=(t=e.channel)?t:"byteplus"})}static setMediaInfoCacheConfig(e){!function(e){e?("boolean"==typeof e.enable&&(tM.enable=e.enable),e.cacheType&&(tM.cacheType=e.cacheType),"number"==typeof e.expireTime&&Number.isFinite(e.expireTime)&&e.expireTime>0?tM.expireTime=e.expireTime:void 0!==e.expireTime&&rM("config ignore invalid expireTime",{expireTime:e.expireTime,currentExpireTime:tM.expireTime}),"number"==typeof e.maxEntries&&Number.isFinite(e.maxEntries)&&e.maxEntries>0?tM.maxEntries=Math.floor(e.maxEntries):void 0!==e.maxEntries&&rM("config ignore invalid maxEntries",{maxEntries:e.maxEntries,currentMaxEntries:tM.maxEntries}),rM("config updated",aM())):rM("config skip empty config",{currentConfig:aM()})}(e)}static getMediaInfoCacheConfig(){return aM()}static clearMediaInfoCache(){sM()}static prefetchMediaInfo(e){return function(e,t){return d(this,null,(function*(){if(!Array.isArray(e))throw new TypeError("sources must be an array");if(!e.length)return[];if(Vr.os.isAndroid&&!0===(null==t?void 0:t.canIUseGetDramaInfo)&&!t.canAndroidBatchGetDramaInfo){const i=[];for(const n of e)i.push(yield LU(n,t));return i}return Promise.all(e.map((e=>LU(e,t))))}))}(e,dB.ttDramaEnv)}static setDebug(e){!function(e){as.config.debug=e?3:1}(e)}static setCollector(e){Ls=e}static shouldCheckLicense(){return!1}static prepare(e){return d(this,null,(function*(){let t=e;const i=Boolean(dB.ttDramaEnv);!(null==t?void 0:t.appId)&&i&&(t=u(c({},t),{appId:_R}));const n=null==t?void 0:t.serviceConfigMode,r=function(e,t){return"remote"===e||"local-only"===e?e:t?"local-only":"remote"}(n,i);void 0!==n&&"remote"!==n&&"local-only"!==n&&as.warn("[VePlayer.prepare] Invalid serviceConfigMode; using the environment default.");const o=function(e){var t,i;const n=null==(t=null==e?void 0:e.strategies)?void 0:t.preload,r="boolean"==typeof n;if(!n||!r&&(null==n?void 0:n.disabled))return e;const o=r?{}:n;return u(c({},e),{strategies:u(c({},e.strategies),{preload:u(c({},o),{[IU]:!0,config:u(c({},null!=(i=null==o?void 0:o.config)?i:{}),{[IU]:!0})})})})}(u(c({},t),{serviceConfigMode:r}));if(dB.shouldCheckLicense())try{dB.hasInitVeStrategy=!0;const e=yield dB.checkLicenseStatus(),t=yield dB.checkLicense();if(e===TA.LICENSE_STATUS_INVALID)throw new Error("LICENSE_STATUS_INVALID");if(t===mA.EDITION_STANDARD)throw new Error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}catch(nF){return void as.error(nF.message)}else dB.hasInitVeStrategy=!0;yield pA.init(o)}))}static setPreloadScene(e,t){return pA.setPreloadScene(e,t)}static get preloader(){return pA.preloader}static get preloaderStatus(){return pA.preloaderStatus}static addPreloadList(e){return FU(e,dB.ttDramaEnv).then((e=>((null==e?void 0:e.length)||as.warn("[addPreloadList] resolved preloadList is empty"),pA.addPreloadList(e))))}static setPreloadList(e){return FU(e,dB.ttDramaEnv).then((e=>((null==e?void 0:e.length)||as.warn("[setPreloadList] resolved preloadList is empty"),as.log("[setPreloadList] resolved preloadList:",JSON.stringify(e)),pA.setPreloadList(e))))}static setLicenseConfig(e){return bA.setLicenseConfig(e)}static checkLicense(){return bA.checkLicense()}static checkModuleList(){return bA.checkModuleList()}static checkLicenseStatus(){return bA.checkLicenseStatus()}static checkLicenseModuleAuth(e,t){return bA.checkLicenseModuleAuth(e,t)}static generateEncryptInfo(e,t){return d(this,null,(function*(){try{const i={hls:Bw.HLSEncrypt,mp4:Bw.MP4Encrypt,dash:Bw.DASH};if(!t||!i[t])return void as.warn("param of streamType is invalid");const n=(new Date).getTime().toString(),r="mp4"===t?yield jw.loadMp4Encrypt(lA):yield lA.loadPlugins(i[t]);return null==r?void 0:r.generateEncryptInfo(e,n)}catch(i){as.error("generate encrypt info error: ",i)}}))}assertLiteConfig(e){nB(e)}_init(e,t){return d(this,null,(function*(){var i;if(dB.ttDramaEnv){!(!e.url&&!e.playList)&&this.delayError.push(this._buildDramaInvalidParamError())}this._emitter=new Ar,this.renderDom({id:null==e?void 0:e.id,root:null==e?void 0:e.root});const n=dB.shouldCheckLicense()&&!(null==e?void 0:e.isLive)?yield dB.checkModuleList():Object.values(EA);this.playerData=ur.observe(new SA(u(c({},e),{licensSupportModuleList:n}),this)),this.adapter=this.playerData.adapter,this.initUmdLoader(e),this.on(OA.TOKEN_EXPIRED,this.onTokenExpiredAction.bind(this)),this.checkVodLogOptions(),this._initSdkPlugins();this.createPlayer(t).catch((e=>{if("VEPLAYER_LITE_UNSUPPORTED_FEATURE"===(null==e?void 0:e.code))return as.error("createPlayer error:",e),void this.emit(UA.ERROR,e);throw e})),this._initI18N(this.playerData.languageData),this._originConfigs={autoBitrateOpts:{enable:null==(i=null==e?void 0:e.autoBitrateOpts)?void 0:i.enable},useSoftDecoding:null==e?void 0:e.useSoftDecoding}}))}_initSdkPlugins(){TU.init(this);[...this.sdkPlugins].map((e=>TU.registerPlugin(e,this)))}_initCheckExpire(){this.checkExpireTimer&&(this.checkExpireTimer.clear(),this.checkExpireTimer=null);const{enableUrlExpireCheck:e,urlCheckExpireInterval:t}=this.playerData.urlCheckData;e&&(this.checkExpireTimer=new Us,this.checkExpireTimer.repeat(this._onRepeat.bind(this),t)),this.on(LA.MEDIA_EXPIRED,this._onMediaExpiredAction.bind(this))}initUmdLoader(e){this.sdkUmdLoader=new sA,this.updateUmdLoader(this.sdkUmdLoader,e)}updateUmdLoader(e,t){const{umdUrlMap:i,region:n,userRegion:r,pluginPublicPath:o,plugins:a=[]}=t;e.failCallback=(e,t)=>this.umdLoadErr(e,t),i&&"object"==typeof i&&e.updateBackupMap(t.umdUrlMap),e.region=n,e.userRegion=r,o&&"string"==typeof o&&(e.customPluginPublicPath=o),e.importedPlugins=a}checkVodLogOptions(){var e;const{isLive:t,configs:i}=this.playerData,n=Ws(i,"vodLogOpts");if(!t&&!i.disableVodLogOptsCheck){if(null==(e=dB.ttDramaEnv)?void 0:e.clientKey)return;if(!(null==n?void 0:n.line_app_id)){const e={errorType:"log",errorCode:pR.VOD_LOG_NOT_CONFIGURED.code,errorMessage:"vod log options not configured or configured correctly",ext:{},originError:void 0};this.delayError.push(e)}}}umdLoadErr(e,t){this.emit(OA.UMD_LOAD_FAIL,{name:e,error:t})}_onRepeat(){const{urlExpireTimestamp:e,urlExpireDiff:t=60}=this.playerData.urlCheckData;Math.round((new Date).getTime()/1e3)>=e-t&&(this.playerData.urlCheckData.urlExpireTimestamp=Xa,this._emitExpireEvent("time"))}_emitExpireEvent(e="error",t){const i=Math.round((new Date).getTime()/1e3),n={errorCode:-499897,errorType:"network",errorMessage:"url expire",url:this.playerData.getCurrentUrl(),httpCode:403,version:"1.18.0",ext:this,detectType:e,urlCheckData:this.playerData.urlCheckData,originError:t,from:"veplayer"};this.emitExpireTimestamp?i-this.emitExpireTimestamp>300&&(this.emitExpireTimestamp=i,as.warn("media is expired, ",n),this.emit(UA.MEDIA_EXPIRED,n)):(this.emitExpireTimestamp=i,as.warn("media is expired, ",n),this.emit(UA.MEDIA_EXPIRED,n))}on(e,t){this._emitter.on(e,t)}emit(e,t){this._emitter.emit(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}renderDom({id:e,root:t}){const i=document.createElement("div");this.playerContainer=i;const n=t||document.querySelector(`#${e}`);n&&(n.appendChild(i),this.mountingDom=n)}renderPoster(){if(!this.playerContainer)return;const{poster:e="",width:t,height:i}=this.playerData.options;("string"==typeof e?e:null==e?void 0:e.poster)&&(this.playerContainer.style.cssText=`background: url("${e}");\n background-size: cover;\n width:${t?t+"px":"100%"};\n height:${i?i+"px":"100%"};\n `)}getDefinitionConfig(){var e;const{current:{lineId:t},isVidEncrypt:i,configs:n,options:r}=this.playerData,o="hls"===(this.playerData.getCurrentStreamType()||vs(null==n?void 0:n.getVideoByToken))&&i&&!!(null==(e=Ws(r,"EncryptHlsPlugin"))?void 0:e.keyToken);let a=this.playerData.getDefinitionListByLineId(t).map((e=>o?function(e,t){const i=c({},e);return t.forEach((e=>delete i[e])),i}(e,["secretKey","playAuth"]):e)),s=this.playerData.current.definition;return this.playerData.isOpenABR()&&(s=this.playerData.defaultDefinition,a=(null==a?void 0:a.length)&&!this.adapter.needAbrAutoDefinition()?a.filter((e=>!this.playerData.isAutoDefinition(e.definition))):a),{defaultDefinition:s,list:a}}checkLicenseCallback(){return d(this,null,(function*(){var e,t,i,n,r,o,a,s,l,h,d,f,p;const g=yield dB.checkLicense(),y=yield dB.checkLicenseStatus();if(this.player.licenseLogInfo={licenseStatus:y,licenseType:g},y===TA.LICENSE_STATUS_EXPIRED)bA.renderLogo(this.playerContainer),!this.playerData.isOpenABR()&&(null==(t=null==(e=null==this?void 0:this._originConfigs)?void 0:e.autoBitrateOpts)?void 0:t.enable)&&this.emit(OA.LICENSE_STATUS_WARNING,gR.EXPIRED_LICENSE_NOT_SUPPORT_ABR),(null==(n=null==(i=this.playerData.configs)?void 0:i.adaptRange)?void 0:n.enable)&&this.emit(OA.LICENSE_STATUS_WARNING,gR.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER),!0===dB.hasInitVeStrategy&&this.emit(OA.LICENSE_STATUS_WARNING,gR.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD);else if(y!==TA.LICENSE_STATUS_OK){null==(r=this.player.plugins.controls)||r.destroy(),null==(o=this.player.plugins.play)||o.destroy(),null==(a=this.player.plugins.sdkdefinitionplugin)||a.hide(),null==(s=this.player.plugins.definitionmobileplugin)||s.destroy(),null==(l=this.player.media)||l.removeAttribute("src");const e=u(c({errorType:yR.license},y===TA.LICENSE_STATUS_INVALID?{errorCode:pR.LICENSE_STATUS_INVALID.code,errorMessage:pR.LICENSE_STATUS_INVALID.message}:{errorCode:pR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH.code,errorMessage:pR.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH.message}),{ext:{},originError:void 0});this.delayError.push(e)}else g===mA.EDITION_STANDARD&&(!this.playerData.isOpenABR()&&(null==(d=null==(h=this._originConfigs)?void 0:h.autoBitrateOpts)?void 0:d.enable)&&this.emit(OA.LICENSE_STATUS_WARNING,gR.BASE_LICENSE_NOT_SUPPORT_ABR),(null==(p=null==(f=this.playerData.configs)?void 0:f.adaptRange)?void 0:p.enable)&&this.emit(OA.LICENSE_STATUS_WARNING,gR.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER),!0===dB.hasInitVeStrategy&&this.emit(OA.LICENSE_STATUS_WARNING,gR.BASE_LICENSE_NOT_SUPPORT_PRELOAD))}))}setPluginConfig(e){var t,i,n,r,o;const{apiMap:a,configs:s,unionInfo:l,playList:h,useHlsPluginForSafari:d,isMobile:f}=this.playerData,p=this.playerData.getCurrentStreamType()||vs(null==s?void 0:s.getVideoByToken),g=Ws(s,"EncryptHlsPlugin"),y=Ws(e,"EncryptHlsPlugin"),v=Ws(s,"Mp4EncryptPlayer"),m=Ws(e,"Mp4EncryptPlayer"),_=Ws(s,"DASHPlugin"),E=Ws(e,"DASHPlugin"),T=Ws(s,"vodLogOpts"),b=(null==(t=dB.ttDramaEnv)?void 0:t.clientKey)?{appVersion:dB.ttDramaEnv.appVersion,clientKey:dB.ttDramaEnv.clientKey,line_app_id:_R,line_user_id:Ps(dB.ttDramaEnv.clientKey)}:{},S=!!(null==(i=null==h?void 0:h[0])?void 0:i.kid)||!!g;g&&(e.EncryptHlsPlugin=c(c(c({playDomain:a.playDomain,getKeyType:"TOP",preferMMS:!0,preferMMSStreaming:!0},f||!Qs||d?{}:{useHls:!1}),y||{}),g)),v&&(e.Mp4EncryptPlayer=c(c({playDomain:a.playDomain,preferMMS:!0,getKeyType:"TOP"},m||{}),v)),_&&(e.DASHPlugin=c(c({playDomain:a.playDomain,getKeyType:"TOP"},E||{}),_));const{vid:C}=s,{encryptSessionId:k,current:I,drmType:P}=this.playerData,{kid:D,secretKey:w}=I;if(P===or.PRIVATE_ENCRYPT_UPGRADE&&k&&w&&("hls"===p?e.EncryptHlsPlugin=c(c({vid:C,kid:D,useUnionInfoDRM:!0,sessionId:k,drmType:or.PRIVATE_ENCRYPT_UPGRADE,keyTokenExpiredDuration:9999999,secretKey:w,preferMMS:!0,preferMMSStreaming:!0},y||{}),g||{}):"dash"===p?e.DASHPlugin=c(c({playInfoType:"TOP",useEME:!0,keyTokenExpiredDuration:9999999,useUnionInfoDRM:!0,defaultFormat:"dash",replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3,vid:C,kid:D,drmType:or.PRIVATE_ENCRYPT_UPGRADE,secretKey:w,sessionId:k},E||{}),_||{}):"mp4"===p&&(e.Mp4EncryptPlayer=c(c({vid:C,kid:D,isEncrypt:!0,rangeMaxDuration:10,keyTokenExpiredDuration:9999999,retryCount:3,useUnionInfoDRM:!0,sessionId:k,drmType:or.PRIVATE_ENCRYPT_UPGRADE,secretKey:w,preferMMS:!0},m||{}),v||{}))),s.privateDrmAuthToken&&s.kid&&l&&("hls"===p?e.EncryptHlsPlugin=c(c({kid:s.kid,drmKeyToken:s.privateDrmAuthToken,playDomain:a.playDomain,preferMMS:!0,preferMMSStreaming:!0},y||{}),g||{}):"dash"===p?e.DASHPlugin=c(c({kid:s.kid,drmKeyToken:s.privateDrmAuthToken,playDomain:a.playDomain},E||{}),_||{}):"mp4"===p&&(e.Mp4EncryptPlayer=c(c({kid:s.kid,drmKeyToken:s.privateDrmAuthToken,playDomain:a.playDomain,preferMMS:!0},m||{}),v||{}))),T||b.clientKey){as.log("codec",this.playerData.codec);const t=Js(this.userRegion,this.region),i=null==t?void 0:t.__LOG_CUSTOM_REGION__,n=null==t?void 0:t.__LOG_CHANNEL_DOMAIN__;e.vodLogOpts=c(c(u(c(c({vtype:(p||"mp4").toUpperCase(),codec_type:this.playerData.codec,drm_type:S?1:0,playerVersion:"1.18.0",channel:null==t?void 0:t.__LOG_CHANNEL__,needXhrCheck:!0,enableTeaWebId:!0},i?{trackerConfig:{log_from_region:null==t?void 0:t.__LOG_CUSTOM_REGION__}}:{}),n?{channelDomain:n}:{}),{ext:this.vodLogCommon}),b),T||{})}null==(n=this.getSdkPlugin("Abr"))||n.applyAbrConfig(e),null==(r=this.getSdkPlugin("AdaptRange"))||r.applyRangeConfig(e),null==(o=this.getSdkPlugin("Strategy"))||o.applyFinalStrategy(e)}detectCodec(e){return d(this,null,(function*(){var t;try{const{LoadProbe:i}=(yield this.sdkUmdLoader.loadPlugins(Bw.StreamProbe))||{};if(i){const n=yield null==(t=new i)?void 0:t.parseUrl(e),{codec:r}=n||{};"bytevc1"===r?this.playerData.codec=tr.H265:"avc"===r&&(this.playerData.codec=tr.H264)}}catch(i){as.warn("detect codec error: ",i)}}))}setDefaultConfigOptions(e){if(!this._isFirstCreated)return;const{defaultConfig:t,isHitDefault:i}=this.playerData;if(!t)return;const{volume:n,startTime:r,DanmuPlugin:o,LiveSubtitlesIconPlugin:a}=null!=t?t:{};n&&(e.volume=e.volume?u(c({},e.volume),{default:n}):n),i&&r&&(e.startTime=r)}getCurrentPlayerConfig(){var e,t;const{isLive:i,current:{lineId:n,definition:r}}=this.playerData,o={type:i?"live":"vod",isLive:i,definition:r,lineId:n,volume:null!=(e=this.player.volume)?e:.6};return i||(o.startTime=null!=(t=this.player.currentTime)?t:0),c({},o)}getStreamType(){var e,t;return this.playerData.getCurrentStreamType()||vs(null==(t=null==(e=this.playerData)?void 0:e.configs)?void 0:t.getVideoByToken)}_analyzeExtendPlugins(){var e;const{options:t}=this.playerData,i=t.extendPlugin||[],n=null!=(e=null==t?void 0:t.ignore)?e:[],r=[],o=[];return i.forEach((e=>{const t=NN(e);"inner"!==t.type||n[e.pluginName]?r.push(t):o.push(t)})),{basicPlugins:r,iconPlugins:o}}beforePlayerCreate(){return d(this,null,(function*(){const e=this._createPlayerPerf;e?yield e.measureAsync("beforePlayerCreate",(()=>d(this,null,(function*(){yield Promise.all([e.measureAsync("beforePlayerCreate.sdkPlugins",(()=>d(this,null,(function*(){yield TU.beforePlayerCreate(this)})))),e.measureAsync("beforePlayerCreate.prepareStrategies",(()=>d(this,null,(function*(){yield this.prepareStrategies()}))))]),e.measure("beforePlayerCreate.updateConfigByStrategy",(()=>{this.updateConfigByStrategy()}))})))):(yield Promise.all([TU.beforePlayerCreate(this),this.prepareStrategies()]),this.updateConfigByStrategy())}))}getCreatePlayerPerfReport(){return this._lastCreatePlayerPerfReport}recordGetDramaInfoPerf(e){var t,i,n;if(null==e?void 0:e.perfInfo){this._getDramaInfoPerfRecords=this._getDramaInfoPerfRecords||[],this._getDramaInfoPerfRecords.push(e),this._markGetDramaInfoClientPerf(e);try{null==(n=null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.onGetDramaInfoPerf)||n.call(i,e)}catch(r){as.error("onGetDramaInfoPerf callback error:",r)}}}getDramaInfoPerfRecords(){return[...this._getDramaInfoPerfRecords||[]]}getLastDramaInfoPerf(){const e=this._getDramaInfoPerfRecords||[];return e[e.length-1]}_markGetDramaInfoClientPerf(e){if(!this._isCollectingCreatePlayerPerf||!this._createPlayerPerf)return;const t=e.perfInfo,i=(e,t)=>{var i;"number"==typeof t&&(null==(i=this._createPlayerPerf)||i.markDuration(`beforePlayerCreate.authtoken.getVideoInfo.getVideos.getDramaInfoViaJSB.perfInfo.${e}`,t))};i("prepareCost",t.prepare_cost),i("requestCost",t.request_cost),i("parseCost",t.parse_cost),i("totalCost",t.total_cost)}prepareStrategies(){return d(this,null,(function*(){if(yield pA.prepare()){const{plugins:e,pluginConfiguration:t}=pA.getStrategyRecommendations();this.playerData.strategiesPlugins=e,this.playerData.strategiesPluginConfigs=t}else this.playerData.strategiesPlugins=[],this.playerData.strategiesPluginConfigs={}}))}updateConfigByStrategy(){if(pA.isReady()){const e=pA.getStrategyRecommendations(),{result:t}=e;if(as.log("vodLogCommon strategyConfig:",t),this.vodLogCommon={strategyResult:t},null==t?void 0:t[cA.H265]){const{configs:e}=this.playerData;if(!e)return;const{url:i,codec:n}=e,r=this.playerData.playList||[],o=r.filter((e=>!e.codec||e.codec===tr.UNKNOWN)),a=r.filter((e=>e.codec===tr.H264)),s=r.filter((e=>e.codec===tr.H265)),l=t[cA.H265].enableH265Hardware,h=er(l?s.concat(a).concat(o):a.concat(o).concat(s),"definition"),d=!l&&!!i&&n===tr.H265&&h.length>0;this.playerData.initPlayData(u(c({},this.playerData.configs),{url:d?null:i,codec:d?tr.UNKNOWN:n,playList:h})),as.log("hit h265strategy, current playList: ",this.playerData.playList)}}}afterPlayerCreate(){const{isMobile:e,isLive:t}=this.playerData;dB.shouldCheckLicense()&&!t&&this.checkLicenseCallback(),this._setVeError(),this._mountingPlayerPanel(e),this._mountingExtendMethods(),this._bindSdkEvents(),this._bindPlayerEvents(),this._setPlayerInfo(),this._initCheckExpire(),TU.afterPlayerCreate(this)}_setVeError(){var e;const t=this.playerData.configs,i={oriErrRetryCount:t.oriErrRetryCount,oriErrRetryCycle:t.oriErrRetryCycle,oriErrRetryBaseDelay:t.oriErrRetryBaseDelay,oriErrMaxTotalRetry:t.oriErrMaxTotalRetry,enableOriErrRetry:t.enableOriErrRetry,needSyncAnalyzeError:t.needSyncAnalyzeError,analyzeTimeout:t.analyzeTimeout,clientKey:null==(e=dB.ttDramaEnv)?void 0:e.clientKey};this.veErrorIns=new AR(this.player,i)}_emitDelayError(){this.player&&this.delayError.forEach((e=>{this.player.emit(UA.ERROR,e)})),this.delayError=[]}_emitDelayEvent(){this.player&&this.delayEvents.forEach((e=>{const{name:t,payload:i}=e||{};t&&this.emit(t,i)})),this.delayEvents=[]}_setPlayerInfo(){this.player&&(this.player.playerVersion="1.18.0",this.player.vtype=this.getVtype())}getVtype(){var e,t,i;const n=this.getStreamType()||vs(null==(t=null==(e=this.playerData)?void 0:e.configs)?void 0:t.getVideoByToken),r=Mr.isMSE(this.player.media);return!this.player.playerType&&(this.player.playerType=n,"hls"===(null==n?void 0:n.toLowerCase())&&(null==(i=this.player)?void 0:i.vodLogger))?r?"HLS_MSE":"HLS":n.toUpperCase()}_mountingPlayerPanel(e){var t;const{options:i,isLive:n}=this.playerData;this.player&&e&&(this.mobilePanel=new MN({config:null!=(t=i.panel)?t:{mode:n?za.INNER:za.NORMAL,isAutoChange:!0},root:this.player.root,player:this.player}),this.player.panel=this.mobilePanel)}_onPlayerRebuild(){if(!this._publicPlayNextOperation&&!hB.hasActiveIdentitySwitch(this))return this.createPlayer()}_getPlayerRebuildListener(){return this._playerRebuildListener||(this._playerRebuildListener=()=>this._onPlayerRebuild()),this._playerRebuildListener}_bindPlayerEvents(){var e;if(!this.player)return;this.player.on(OA.PLAYER_REBUILD,this._getPlayerRebuildListener()),this.player.once(UA.READY,this._emitDelayError.bind(this)),this.player.once(UA.READY,this._emitDelayEvent.bind(this)),this.player.on(UA.ERROR,this._onError),this.player.on(SR,this._proxyError);const t=null==(e=this.player.plugins)?void 0:e.mp4encryptplayer;t&&t.on(LA.PRELOAD_INFO,this._onMp4PreloadInfo)}_onMediaExpiredAction(){var e,t;if(this.emitExpireTimestamp=Math.round((new Date).getTime()/1e3),(null==(e=this.playerData)?void 0:e.onMediaExpired)&&"function"==typeof(null==(t=this.playerData)?void 0:t.onMediaExpired)){const e=Vs(this.playerData.onMediaExpired());(null==e?void 0:e.then)&&e.then((e=>this.updateMediaSource(e)))}}updateMediaSource(e){try{this.assertLiteConfig(e)}catch(r){return Promise.reject(r)}const{url:t,playList:i,getVideoByToken:n}=e||{};return t||(null==i?void 0:i.length)?new Promise(((t,n)=>{this.playerData.updateConfigs(e),this.playerData.updatePlayList(),this.playerData.updateCheckExpireData();const r=this.playerData.getCurrentUrl();if(this.player.isError||this.player.state<6&&Vr.isWeixin&&Vr.os.isIos){if(!(null==i?void 0:i.length))return this.playNext(c({},e),!1);{const t=this.playerData.current.definition,n=i.find((e=>e.definition===t));if(n&&n.url)return this.playNext(u(c({},e),{url:n.url}),!1)}}else{this.player.setConfig(u(c({},e),{url:r,definition:this.getDefinitionConfig()}));const i=this.player.switchURL(r,{seamless:!0});i&&i.then?(i.then((()=>t(void 0))),i.catch((()=>n()))):t(void 0)}})):(null==n?void 0:n.playAuthToken)?this.updateAuthToken(n):void 0}onTokenExpiredAction(){var e,t;if((null==(e=this.playerData)?void 0:e.onTokenExpired)&&"function"==typeof(null==(t=this.playerData)?void 0:t.onTokenExpired)){const e=Vs(this.playerData.onTokenExpired());(null==e?void 0:e.then)&&e.then((e=>this.updateAuthToken(e)))}}_bindSdkEvents(){const e=Object.values(Wo).filter((e=>e!==Zr)),t=[...Object.values(LA),...Object.values(OA),...e];[...new Set(t.filter((e=>"string"==typeof e)))].forEach((e=>{"string"==typeof e&&this.player.on(e,((...t)=>{this._emitter.emit(e,...t)}))})),this.player.on("hlsAudioTracksUpdated",(e=>{this._applyAudioPreference(e.audioTracks),this._emitter.emit(OA.AUDIO_TRACKS_UPDATED,e)})),this.player.on("hlsAudioTrackSwitched",(e=>{var t,i,n,r,o;const a=this._getHlsInstance(),s=null==(t=null==a?void 0:a.audioTracks)?void 0:t.find((t=>t.id===e.id));if(this._suppressAudioTrackMemory)this._clearSuppressAudioTrackMemory();else{s&&(this._lastSelectedAudioTrack=s);const e=null!=(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.audioTrackSwitchSeekOffset)?r:.1,t=null==(o=this.player)?void 0:o.media;e>0&&t&&!t.paused&&isFinite(t.currentTime)&&(t.currentTime+=e)}this._emitter.emit(OA.AUDIO_TRACK_CHANGE,u(c({},e),{audioTrack:s}))})),this._bindNativeAudioTrackEvents()}_bindNativeAudioTrackEvents(){var e,t;const i=null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks;i&&(i.addEventListener("addtrack",this._onNativeAddTrack),i.addEventListener("change",this._onNativeTrackChange),i.addEventListener("removetrack",this._onNativeAddTrack))}_mountingExtendMethods(){this.player&&(this.player.changePluginsIcon=this.changePluginsIcon.bind(this))}_getHlsInstance(){var e,t,i;const n=null==(e=this.player)?void 0:e.plugins;return(null==(t=null==n?void 0:n.encrypthlsplugin)?void 0:t.hls)||(null==(i=null==n?void 0:n.hls)?void 0:i.hls)}_applyAudioPreference(e){var t,i,n,r;if(!(null==e?void 0:e.length))return;const o=this._getHlsInstance();if(!o)return;const a=null!=(r=null!=(n=this._lastSelectedAudioTrack)?n:null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.audioPreference)?r:{};if(0===Object.keys(a).length)return;this._setSuppressAudioTrackMemory();const s=o;if("function"==typeof s.setAudioOption)s.setAudioOption(GA(a));else{const t=a.lang;if(!t)return void this._clearSuppressAudioTrackMemory();const i=e.findIndex((e=>{var i;return(null==(i=e.lang)?void 0:i.toLowerCase())===t.toLowerCase()}));-1!==i&&o.audioTrack!==i?o.audioTrack=i:this._clearSuppressAudioTrackMemory()}}_setSuppressAudioTrackMemory(){this._suppressAudioTrackMemory=!0,null!==this._suppressAudioTrackMemoryTimer&&clearTimeout(this._suppressAudioTrackMemoryTimer),this._suppressAudioTrackMemoryTimer=setTimeout((()=>{this._suppressAudioTrackMemory=!1,this._suppressAudioTrackMemoryTimer=null}),2e3)}_clearSuppressAudioTrackMemory(){this._suppressAudioTrackMemory=!1,null!==this._suppressAudioTrackMemoryTimer&&(clearTimeout(this._suppressAudioTrackMemoryTimer),this._suppressAudioTrackMemoryTimer=null)}_applyAudioPreferenceNative(e){var t,i,n;if(!(null==e?void 0:e.length))return;const r=[this._lastSelectedAudioTrack,null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.audioPreference];for(const o of r){if(!o)continue;const t=o.id,i=o.lang,r=o.name;if(void 0===t&&!i&&!r)continue;let a=-1;for(let o=0;o<e.length;o++){const s=e[o];if((void 0===t||o===Number(t))&&!(i&&(null==(n=s.language)?void 0:n.toLowerCase())!==i.toLowerCase()||r&&s.label!==r)){a=o;break}}if(-1!==a)return void YA(e,a)}}_offPlayerEvents(){var e;if(!this.player)return;this.player.off(OA.PLAYER_REBUILD,this._getPlayerRebuildListener()),this.player.off(UA.ERROR,this._onError),this.player.off(SR,this._proxyError);const t=null==(e=this.player.plugins)?void 0:e.mp4encryptplayer;null==t||t.off(LA.PRELOAD_INFO,this._onMp4PreloadInfo)}changePluginsIcon(e,t){var i;if(!this.player)return;const n=this.player.getPlugin(e);if(!n||!(null==n?void 0:n.root))return;const r=Mr.hasClass(null==n?void 0:n.parent,"panel-icon-svg")?null==(i=null==n?void 0:n.parent)?void 0:i.parentNode:null==n?void 0:n.root;r&&(t?Mr.show(r,"block"):Mr.hide(r))}getSdkPlugin(e){var t;const i=null==(t=this._sdkPlugins)?void 0:t[e.toLowerCase()];return i&&i.pluginName?i:null}switchAuthToken(e,t=!0){try{this.assertLiteConfig({getVideoByToken:e})}catch(i){return Promise.reject(i)}return this._performAuthTokenSwitch(e,t)}_switchAuthToken(e,t,i){return this._performAuthTokenSwitch(e,t,i).then((()=>{i&&hB.commitIdentitySwitch(this,i)})).catch((e=>{throw i&&hB.rollbackIdentitySwitch(this,i),e}))}_performAuthTokenSwitch(e,t,i){const n=t?0:this.player.currentTime,r=this.getSdkPlugin("AuthToken");return r&&this.player?this._runDestroyableSourceSwitch((o=>r.updateAuthToken(e,t).then((()=>(o(),this._playerPlayNext(n,i)))).then((()=>{})))):(as.error("current is not playAuthToken play or player not created"),Promise.reject())}updateAuthToken(e){try{this.assertLiteConfig({getVideoByToken:e})}catch(i){return Promise.reject(i)}const t=this.getSdkPlugin("AuthToken");return new Promise(((i,n)=>{t&&this.player?t.updateAuthToken(e,!1).then((()=>{if(this.player.isError)this._playerPlayNext(this.player.currentTime).then((()=>i())).catch((()=>n()));else{const e=this.playerData.getCurrentUrl();this.player.setConfig({url:e,definition:this.getDefinitionConfig()});const t=this.player.switchURL(e,{seamless:!0});t&&t.then?(t.then((()=>i())),t.catch((()=>n()))):i()}})).catch((e=>n(e))):(as.error("current is not playAuthToken play or player not created"),n())}))}_playerPlayNext(e=0,t){const i=this.player;return new Promise(((n,r)=>{var o,a,s;const l=i.paused&&!i.isError;i.addClass(Ia.ENTER);const h=this.playerData.isOpenABR()?void 0:this.playerData.getCurrentUrl(),d=u(c(c({},this.playerData.options),this._getDramaConfigPatchForPlayer()),{definition:this.getDefinitionConfig(),startTime:e,autoplay:!0,url:h});d.poster&&i.plugins.poster&&i.plugins.poster.update(d.poster),this.setPluginConfig(d);let f=!t,p=!1,g=()=>{};const y=[],v=(e,t)=>{y.push([e,t]),i.once(e,t)},m=e=>{p||(p=!0,g(),(()=>{for(const[e,t]of y)i.off(e,t);y.length=0})(),e())};g=this._registerSourceSwitchAborter((e=>{m((()=>r(e)))}));const _=(e,t)=>{const i=(...n)=>{f?m((()=>t(...n))):v(e,i)};v(e,i)};_(UA.ERROR,(e=>r(e))),_(UA.CANPLAY,(()=>{l&&i.pause(),n(!0)})),v(UA.EMPTIED,(()=>{!f&&t&&(f=hB.armIdentitySwitch(this,t,i))}));try{if(i.plugins.dashplugin){const e=c(c({},Ws(i.config,"DASHPlugin")),this.playerData.options.DASHPlugin||{});e.dashOpts=this.playerData.dashOpts,e.vid=null==(a=null==(o=this.playerData.dashOpts)?void 0:o.Data)?void 0:a.Vid,i.plugins.drm&&(null==(s=i.plugins.drm)||s.restart()),i.setConfig(d),i.plugins.dashplugin.next(i.currentTime,"NEXT",e)}else i.playNext(d)}catch(nF){m((()=>r(nF)))}}))}get src(){var e,t;return(null==(e=this.player)?void 0:e.currentSrc)||(null==(t=this.player)?void 0:t.src)}set src(e){this.player&&(this.player.src=e)}switchURL(e){try{this.assertLiteConfig({url:e})}catch(n){return Promise.reject(n)}const t=this.player.switchURL(e,!1),i=this.player.currentTime;return t&&t.then?t:new Promise((e=>{const t=this.player.paused&&!this.player.isError,n=()=>{this.player.currentTime=i,t&&this.player.once(UA.CANPLAY,(()=>{this.player.pause()})),e()};Vr.os.isAndroid?this.once(UA.TIME_UPDATE,(()=>{n()})):this.once(UA.CANPLAY,(()=>{n()})),this.player.play()}))}next(e,t=!0){try{this.assertLiteConfig(e)}catch(i){return Promise.reject(i)}return this._publicPlayNextOperation||hB.hasActiveIdentitySwitch(this)?Promise.reject(this._createPlayNextInProgressError()):this._next(e,t)}_next(e,t=!0,i){var n;const r=this._lifecycleGeneration||0,o=t?0:this.player.currentTime,a=this.playerData.configs,s=this._applyIncomingIdentityAliases(c(u(c({},a),{startTime:o,autoplay:!0}),e),e);(null==(n=null==e?void 0:e.getVideoByToken)?void 0:n.playAuthToken)&&(s.streamType=vs(null==e?void 0:e.getVideoByToken)||nr.MP4);const l=hB.beginIdentitySwitch(this,dU(s),this.player,t,i);return l?this._teardown(!0).then((()=>{if(this._isStaleLifecycleGeneration(r))throw this._createDestroyedPlaybackSwitchError();return this._init(s,l)})).catch((e=>{if(hB.rollbackIdentitySwitch(this,l),this._isDestroyedPlaybackSwitchError(e))throw e;if(as.error("next_error",e),"VEPLAYER_LITE_UNSUPPORTED_FEATURE"===(null==e?void 0:e.code))throw e})):Promise.reject(this._createPlayNextInProgressError())}playNext(e,t=!0){try{this.assertLiteConfig(e)}catch(s){return Promise.reject(s)}if(this._publicPlayNextOperation||hB.hasActiveIdentitySwitch(this))return Promise.reject(this._createPlayNextInProgressError());const i={};this._publicPlayNextOperation=i;const n=this.player;try{n.emit(LA.PLAY_NEXT_START)}catch(s){return this._publicPlayNextOperation===i&&(this._publicPlayNextOperation=null),Promise.reject(s)}let r,o=null;try{const i=this._createDramaPlayNextCandidateConfig(e);if(o=hB.beginIdentitySwitch(this,dU(i),this.player,t),!o)throw this._createPlayNextInProgressError();this._lastSelectedAudioTrack=null,this._clearSuppressAudioTrackMemory(),this._playNextPending=!0,r=this._playNext(e,t,o)}catch(s){o&&hB.rollbackIdentitySwitch(this,o),r=Promise.reject(s)}const a=r.catch((e=>{throw o&&hB.rollbackIdentitySwitch(this,o),e}));return o?o.settled.then((()=>{this._publicPlayNextOperation===i&&(this._publicPlayNextOperation=null)})):a.finally((()=>{this._publicPlayNextOperation===i&&(this._publicPlayNextOperation=null)})).catch((()=>{})),a.finally((()=>{n.emit(LA.PLAY_NEXT_END)})).catch((()=>{})),a}_createPlayNextInProgressError(){return new Error("VePlayer playNext is already in progress")}_registerSourceSwitchAborter(e){this._sourceSwitchAborters||(this._sourceSwitchAborters=new Set);const t=this._sourceSwitchAborters;return t.add(e),()=>{t.delete(e),0===t.size&&this._sourceSwitchAborters===t&&(this._sourceSwitchAborters=void 0)}}_abortSourceSwitches(){const e=this._sourceSwitchAborters;if(this._sourceSwitchAborters=void 0,!e)return;const t=this._createDestroyedPlaybackSwitchError();for(const i of e)i(t)}_runDestroyableSourceSwitch(e){return new Promise(((t,i)=>{let n=!1,r=()=>{};const o=()=>{if(n)throw this._createDestroyedPlaybackSwitchError()},a=e=>{n||(n=!0,r(),e())};r=this._registerSourceSwitchAborter((e=>{a((()=>i(e)))}));try{Promise.resolve(e(o)).then((e=>a((()=>t(e)))),(e=>a((()=>i(e)))))}catch(nF){a((()=>i(nF)))}}))}_createDestroyedPlaybackSwitchError(){return new Error("VePlayer destroyed during playback switch")}_isDestroyedPlaybackSwitchError(e){return e instanceof Error&&"VePlayer destroyed during playback switch"===e.message}_isStaleLifecycleGeneration(e){return e!==(this._lifecycleGeneration||0)}_cancelStalePlayerCreation(){this._isCollectingCreatePlayerPerf=!1}_discardStalePlayer(e){var t;if(e){this.player===e&&(this.player=null);try{const i=null==(t=e.destroy)?void 0:t.call(e);(null==i?void 0:i.catch)&&i.catch((()=>{}))}catch(i){}}}updatePlayNextSubtitleConfig(e,t){var i,n,r,o;const a=Ws(e,"Subtitle"),s=Array.isArray(null==a?void 0:a.list);if(!s&&!t)return;const l=s?a.list:[],h=u(c(c(c({},Ws(this.playerData.options,"Subtitle")||{}),Ws(this.playerData.configs,"Subtitle")||{}),a||{}),{list:l});e.Subtitle=h,this.playerData.updateConfigs({Subtitle:h}),this.playerData.options.Subtitle=h,null==(o=null==(r=null==(n=null==(i=this.player)?void 0:i.plugins)?void 0:n.subtitle)?void 0:r.updateSubtitles)||o.call(r,l)}_playNext(e,t=!0,i){var n,r,o;if(!e)return Promise.reject();const{url:a,playList:s,getVideoByToken:l}=e,h=this.player.paused&&!this.player.isError,d=t?0:this.player.currentTime;if(a||(null==s?void 0:s.length)){this._applyIncomingIdentityAliases(this.playerData.configs,e),this.playerData.updateConfigs(e),this.playerData.initPlayData(e);const n=this.adapter.canOpenAbr()&&this.playerData.isOpenABR()?void 0:this.playerData.getCurrentUrl(),r=this.player,o=r.state,a=this.getDefinitionConfig(),s=u(c({startTime:d},e),{url:n,definition:a});return this.updatePlayNextSubtitleConfig(s,t),this.setPluginConfig(s),new Promise(((e,t)=>{let n=!1,a=!1,l=()=>{};const c=[],u=(e,t)=>{const i=(...i)=>{n||e===UA.EMPTIED?t(...i):u(e,t)};c.push([e,i]),r.once(e,i)},d=e=>{a||(a=!0,l(),(()=>{var e;for(const[t,i]of c)null==(e=r.off)||e.call(r,t,i);c.length=0})(),e())};l=this._registerSourceSwitchAborter((e=>{d((()=>t(e)))})),u(UA.ERROR,(e=>{d((()=>t(e)))})),u(UA.CANPLAY,(()=>{d((()=>{6===o&&h?r.pause():6!==o&&r.config.autoplay&&r.play(),e(void 0)}))}));const f=()=>{n||(n=!i||hB.armIdentitySwitch(this,i,r))};c.push([UA.EMPTIED,f]),r.once(UA.EMPTIED,f);try{r.playNext(s)}catch(p){d((()=>t(p)))}}))}if(dB.ttDramaEnv){if(null==(n=e.getVideoByToken)?void 0:n.playAuthToken){if((this.playerData.getCurrentStreamType()||vs(null==(r=this.playerData.configs)?void 0:r.getVideoByToken))!==(e.streamType||vs(null==e?void 0:e.getVideoByToken)||"mp4"))return this._next(e,t,i)}const o=this._createDramaPlayNextCandidateConfig(e);return i?this.switchDramaEpisode(o,t,i):this.switchDramaEpisode(o,t)}if(null==l?void 0:l.playAuthToken){return(this.playerData.getCurrentStreamType()||vs(null==(o=this.playerData.configs)?void 0:o.getVideoByToken))!==(e.streamType||vs(null==e?void 0:e.getVideoByToken)||"mp4")?this._next(e,t,i):(this.playerData.updateConfigs(e),this._switchAuthToken(l,t,i))}return this._next(e,t,i)}_applyIncomingIdentityAliases(e,t){const i=e,n=t;for(const r of[["albumId","album_id"],["episodeId","episode_id","episodeID"]]){if(r.some((e=>Object.prototype.hasOwnProperty.call(n,e)))){for(const e of r)delete i[e];for(const e of r)Object.prototype.hasOwnProperty.call(n,e)&&(i[e]=n[e])}}return e}_createDramaPlayNextCandidateConfig(e){const t=this._applyIncomingIdentityAliases(this.playerData.getMergedConfigs(e),e);return Object.prototype.hasOwnProperty.call(e,"transcodeParam")&&(t.transcodeParam=e.transcodeParam),t}_getDramaConfigPatchForPlayer(){const e=this.playerData.configs,t=["albumId","album_id","episodeId","episode_id","episodeID"],i={};for(const n of t){const t=e[n];null!=t&&""!==t&&(i[n]=t)}return i}_buildDramaInvalidParamError(){const e=vR.INVALID_PARAM;return{errorType:yR.network,errorCode:e.code,veError:AR.getVeErrorInfo({code:e.code,message:e.message,textKey:e.textKey}),errorMessage:e.message,ext:{},originError:void 0}}_getDramaAlbumIdFromConfig(e){return dU(e).albumId||""}_getDramaEpisodeIdFromConfig(e){return dU(e).episodeId||""}switchDramaEpisode(e,t=!0,i){const n=t?0:this.player.currentTime,r=this.getSdkPlugin("AuthToken"),o=hB.beginIdentitySwitch(this,dU(e),this.player,t,i);return o?r&&this.player?this._runDestroyableSourceSwitch((i=>r.updateDramaEpisode(t,e).then((()=>(i(),this._playerPlayNext(n,o)))).then((()=>{})))).then((()=>{hB.commitIdentitySwitch(this,o)})).catch((e=>{throw hB.rollbackIdentitySwitch(this,o),e})):(hB.rollbackIdentitySwitch(this,o),as.error("switchDramaEpisode: AuthToken plugin or player not available"),Promise.reject(new Error("AuthToken plugin or player not available"))):Promise.reject(this._createPlayNextInProgressError())}_destroyPlayer(){return d(this,null,(function*(){var e,t,i;this._offPlayerEvents(),null==(e=this.veErrorIns)||e.destroy(),this.veErrorIns=null,yield null==(t=this.mobilePanel)?void 0:t.destroy(),yield null==(i=this.player)?void 0:i.destroy(),this.player=null}))}getPlayerInstance(){return this.player}getSoftDecodingOption(e,t,i){return d(this,null,(function*(){var n,r;const{enableH265Degrade:o,codec:a,configs:s,isLive:l}=this.playerData,c=function(e){var t,i;if(!(null==e?void 0:e.playAuthToken))return!1;const n=gs(null==e?void 0:e.playAuthToken),r=null!=(i=null==(t=null==n?void 0:n.FileType)?void 0:t.toLowerCase())?i:"video";return!!n&&("evideo"===r||"eaudio"===r)}(null==s?void 0:s.getVideoByToken),u=!!(s.enableMp4MSE||Ws(this.playerData.options,"Mp4EncryptPlayer")||"mp4"===i&&(a===tr.H265||c||(null==(n=null==s?void 0:s.autoBitrateOpts)?void 0:n.enable)));if(dB.shouldCheckLicense()&&(null==(r=this._originConfigs)?void 0:r.useSoftDecoding)&&!l)try{const e=yield dB.checkLicenseStatus();if(!(yield dB.checkLicenseModuleAuth(_A.SDK_VOD_PLAY,EA.H265)))throw this.emit(OA.LICENSE_STATUS_WARNING,e===TA.LICENSE_STATUS_EXPIRED?gR.EXPIRED_LICENSE_NOT_SUPPORT_265:gR.BASE_LICENSE_NOT_SUPPORT_265),new Error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}catch(nF){return void as.error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}if(e){const e=yield this.sdkUmdLoader.loadPlugins(Bw.XGVideo);if(null==e?void 0:e.isSupported()){if(a&&e.setDecodeCapacity({preloadDecoder:this.playerData.codec,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1}),this.setH265SoftPlayList(),u){const e=yield jw.loadMp4Encrypt(this.sdkUmdLoader);return{mediaType:this.playerData.isCurrentH265()?"xg-video":"video",innerDegrade:1,codecType:null!=a?a:tr.H264,plugins:[e]}}return{mediaType:"xg-video",innerDegrade:1,codecType:null!=a?a:tr.H264}}{this.emit(OA.NOT_SUPPORT_SOFT_DECODER);const e={errorType:"decoder",errorCode:3,errorMessage:"soft decode is not support by current browser",ext:{},originError:void 0};this.delayError.push(e),as.error("soft decode is not support by current browser")}}else if(o&&!a&&t&&(yield this.detectCodec(t)),this.playerData.isCurrentH265()&&!function(){const e=window.navigator.userAgent.toLocaleLowerCase(),t=/(iphone)/.test(e)||/(ipad)/.test(e);if(/(VivoBrowser)/.test(e)){const t=e.match(/VivoBrowser\/(\d+)?/);if((null==t?void 0:t[1])>=22)return!0}return!!(t||window.MediaSource&&window.MediaSource.isTypeSupported&&(window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')))}())if(o){if(dB.shouldCheckLicense()&&!l)try{const e=yield dB.checkLicenseStatus();if(!(yield dB.checkLicenseModuleAuth(_A.SDK_VOD_PLAY,EA.H265)))throw this.emit(OA.LICENSE_STATUS_WARNING,e===TA.LICENSE_STATUS_EXPIRED?gR.EXPIRED_LICENSE_NOT_SUPPORT_265:gR.BASE_LICENSE_NOT_SUPPORT_265),new Error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}catch(nF){return void as.error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}const e=yield this.sdkUmdLoader.loadPlugins(Bw.XGVideo);if(null==e?void 0:e.isSupported()){if(null==e||e.setDecodeCapacity({preloadDecoder:this.playerData.codec,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1}),this.setH265SoftPlayList(),this.playerData.openSoftDecoding=!0,u){const e=yield jw.loadMp4Encrypt(this.sdkUmdLoader);return{mediaType:this.playerData.isCurrentH265()?"xg-video":"video",innerDegrade:1,codecType:null!=a?a:tr.H264,plugins:[e]}}return{mediaType:"xg-video",innerDegrade:1,codecType:null!=a?a:tr.H264}}{this.emit(OA.NOT_SUPPORT_SOFT_DECODER);const e={errorType:"decoder",errorCode:3,errorMessage:"soft decode is not support by current browser",ext:{},originError:void 0};this.delayError.push(e),as.error("soft decode is not support by current browser")}}else{this.emit(OA.NOT_SUPPORT_HARDWARE_DECODER);const e={ext:{},originError:void 0,errorType:"decoder",errorCode:3,errorMessage:"h265 hardware decode is not supported by this browser"};this.delayError.push(e),as.error("h265 hardware decode is not supported by this browser")}return{}}))}setH265SoftPlayList(){if(this.playerData.isCurrentH265()){const e=this.playerData.playList;e.length>1&&(this.playerData.playList=e.filter((e=>{var t;return(null==(t=null==e?void 0:e.codec)?void 0:t.toLowerCase())===tr.H265}))),this.playerData.initCurrent(this.playerData.playList[0])}}changeDefinition(e){var t,i,n,r,o,a;if((null==(t=this.getDefinitionList())?void 0:t.length)<=1)return;const{sdkdefinitionplugin:s,definitionmobileplugin:l}=(null==(i=this.player)?void 0:i.plugins)||{};if(s||l)e!==this.playerData.current.definition&&(s?null==s||s.changeDefinition(e):l&&(null==l||l.changeDefinition(e)));else{let t;const{current:{lineId:i}}=this.playerData;t=this.playerData.getDefinitionListByLineId(i).find((t=>t.definition===e)),t||(t=null==(a=null==(o=null==(r=null==(n=this.player)?void 0:n.config)?void 0:r.definition)?void 0:o.list)?void 0:a.find((t=>(null==t?void 0:t.definition)===e))),t&&(this.player.changeDefinition(t),t.definition!==this.playerData.current.definition&&(this.playerData.current.definition=t.definition))}}getDefinitionList(){var e;const{sdkdefinitionplugin:t,definitionmobileplugin:i}=(null==(e=this.player)?void 0:e.plugins)||{};return t||i?(null==t?void 0:t.renderList)||(null==i?void 0:i.renderList):this.player.definitionList.map((e=>{var t;const i=this.playerData.isDefinitionMatch(e.definition,null==(t=this.player.curDefinition)?void 0:t.definition),n=e.url===this.player.url,r=e.url===this.player.src;return u(c({},e),{isDefinitionAuto:this.playerData.isAutoDefinition(e.definition),selected:i||(this.playerData.isOpenABR()&&Vr.os.isIos?r:n)})}))}getAudioTracks(){var e,t,i;const n=this._getHlsInstance();if(null==(e=null==n?void 0:n.audioTracks)?void 0:e.length){const e=n.audioTrack;return n.audioTracks.map((t=>u(c({},t),{selected:t.id===e})))}const r=null==(i=null==(t=this.player)?void 0:t.media)?void 0:i.audioTracks;if(!(null==r?void 0:r.length))return[];const o=[];for(let a=0;a<r.length;a++){const e=r[a];o.push({id:a,name:e.label||e.language||String(a),lang:e.language,default:e.enabled,selected:e.enabled})}return o}getCurrentAudioTrack(){var e,t,i;const n=this._getHlsInstance();if(null==(e=null==n?void 0:n.audioTracks)?void 0:e.length){const e=n.audioTrack,t=n.audioTracks.find((t=>t.id===e));return t?u(c({},t),{selected:!0}):null}const r=null==(i=null==(t=this.player)?void 0:t.media)?void 0:i.audioTracks;if(!r)return null;for(let o=0;o<r.length;o++){const e=r[o];if(e.enabled)return{id:o,name:e.label||e.language||String(o),lang:e.language,default:!0,selected:!0}}return null}switchAudioTrack(e){var t,i;const{id:n}=e,r=this._getHlsInstance();if(r)return void zA(r,e);const o=null==(i=null==(t=this.player)?void 0:t.media)?void 0:i.audioTracks;o&&YA(o,n)}get preLoadData(){var e;if(!this.player||!this.player.plugins)return{hit:0};const t=this.player.plugins.mp4encryptplayer;if(t&&t.preLoadData)return{hit:!0===t.hitpreload?1:0,duration:t.preLoadData.duration,length:t.preLoadData.byteLength};const i=(null==(e=this.player)?void 0:e.stat)||{};if(i.preLoadData){const{length:e,duration:t}=i.preLoadData,n={hit:e>0?1:0,length:e,duration:0};return t>=0&&(n.duration=t),n}return{hit:0,duration:0,length:0}}_initI18N(e){const{extraLangList:t,extendLangList:i}=e;null==t||t.forEach((e=>{Oa.use(e)})),Oa.extend(kU),i&&Oa.extend(i)}get musicMode(){}set musicMode(e){}get musicTimeScale(){}set musicTimeScale(e){}get musicList(){}set musicList(e){}musicAdd(e){}musicRandom(){}musicNext(){}musicPrev(){}musicSetIndex(e){}musicForward(){}musicBackward(){}musicRemove(e){}musicSetAbCycle(e,t,i,n){}musicRemoveAbCycle(){}getLogUserId(){var e,t,i;const n=null==(e=this.player)?void 0:e.vodLogger;if(n){const e=(null==(t=null==n?void 0:n.tracker)?void 0:t.getConfig())||{};return null==(i=null==e?void 0:e.user)?void 0:i.user_unique_id}}get region(){return this.playerData.region}get userRegion(){return this.playerData.userRegion}getPlugin(e){var t;return null==(t=this.player)?void 0:t.getPlugin(e)}getSubtitleList(){var e,t;const i=this.getPlugin("subtitle");return null!=(t=null==(e=null==i?void 0:i.config)?void 0:e.list)?t:[]}switchSubtitle(e){const t=this.getPlugin("subtitle");return t?t.switchSubTitle(e):Promise.reject(new Error("subtitle plugin is not registered"))}showSubtitle(){var e,t;const i=this.getPlugin("subtitle");if(i)if(i.curIndex>-1&&i.curItem)i.switchSubTitle(i.curItem);else{const n=null!=(t=null==(e=i.config)?void 0:e.list)?t:[];n.length>0&&i.switchSubTitle(n[0])}}hideSubtitle(){var e;const t=this.getPlugin("subtitle");null==(e=null==t?void 0:t.switchOffSubtitle)||e.call(t)}_teardown(e){return d(this,null,(function*(){var t;const i=this.player;e||(this._lifecycleGeneration=(this._lifecycleGeneration||0)+1,this._abortSourceSwitches(),hB.destroy(this,i)),yield this._destroyPlayer(),this.checkExpireTimer&&(this.checkExpireTimer.clear(),this.checkExpireTimer=null,this._onRepeat=null),this.mountingDom&&this.mountingDom.contains(this.playerContainer)&&this.mountingDom.removeChild(this.playerContainer),null==(t=this._emitter)||t.removeAllListeners(),this._emitter=null,TU.destroy(this)}))}destroy(){return d(this,null,(function*(){yield this._teardown(!1)}))}};let fB=dB;fB.isMSESupported=$s,fB.veStrategy=pA,fB.sdkVersion="1.18.0",fB.ttDramaEnv=null,fB.isMMSSupported=Xs,fB.isRTMSupported=CA.isSupported,fB.hasInitVeStrategy=!1;const pB=fB;const gB="function"==typeof Buffer,yB=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),vB=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),mB=(e=>{let t={};return e.forEach(((e,i)=>t[e]=i)),t})(vB),_B=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,EB=String.fromCharCode.bind(String),TB=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),bB=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),SB=e=>{let t,i,n,r,o="";const a=e.length%3;for(let s=0;s<e.length;){if((i=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=i<<16|n<<8|r,o+=vB[t>>18&63]+vB[t>>12&63]+vB[t>>6&63]+vB[63&t]}return a?o.slice(0,a-3)+"===".substring(a):o},CB="function"==typeof btoa?e=>btoa(e):gB?e=>Buffer.from(e,"binary").toString("base64"):SB,kB=gB?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let i=0,n=e.length;i<n;i+=4096)t.push(EB.apply(null,e.subarray(i,i+4096)));return CB(t.join(""))},IB=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?EB(192|t>>>6)+EB(128|63&t):EB(224|t>>>12&15)+EB(128|t>>>6&63)+EB(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return EB(240|t>>>18&7)+EB(128|t>>>12&63)+EB(128|t>>>6&63)+EB(128|63&t)},PB=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,DB=e=>e.replace(PB,IB),wB=gB?e=>Buffer.from(e,"utf8").toString("base64"):yB?e=>kB(yB.encode(e)):e=>CB(DB(e)),AB=(e,t=!1)=>t?TB(wB(e)):wB(e),RB=e=>{if(e=e.replace(/\s+/g,""),!_B.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,i,n,r="";for(let o=0;o<e.length;)t=mB[e.charAt(o++)]<<18|mB[e.charAt(o++)]<<12|(i=mB[e.charAt(o++)])<<6|(n=mB[e.charAt(o++)]),r+=64===i?EB(t>>16&255):64===n?EB(t>>16&255,t>>8&255):EB(t>>16&255,t>>8&255,255&t);return r},xB=AB;var OB={};!function(e){e._getPrivFilters=function(){var e,t=/</g,i=/"/g,n=/'/g,r=/&/g,o=/\x00/g,a=/(?:^$|[\x00\x09-\x0D "'`=<>])/g,s=/[&<>"'`]/g,l=/(?:\x00|^-*!?>|--!?>|--?!?$|\]>|\]$)/g,c=/&(?:#([xX][0-9A-Fa-f]+|\d+);?|(Tab|NewLine|colon|semi|lpar|rpar|apos|sol|comma|excl|ast|midast|ensp|emsp|thinsp);|(nbsp|amp|AMP|lt|LT|gt|GT|quot|QUOT);?)/g,u={Tab:"\t",NewLine:"\n",colon:":",semi:";",lpar:"(",rpar:")",apos:"'",sol:"/",comma:",",excl:"!",ast:"*",midast:"*",ensp:" ",emsp:" ",thinsp:" ",nbsp:" ",amp:"&",lt:"<",gt:">",quot:'"',QUOT:'"'},h=/^(?:(?!-*expression)#?[-\w]+|[+-]?(?:\d+|\d*\.\d+)(?:r?em|ex|ch|cm|mm|in|px|pt|pc|%|vh|vw|vmin|vmax)?|!important|)$/i,d=/[\x00-\x1F\x7F\[\]{}\\"]/g,f=/[\x00-\x1F\x7F\[\]{}\\']/g,p=/url[\(\u207D\u208D]+/g,g=/['\(\)]/g,y=/\/\/%5[Bb]([A-Fa-f0-9:]+)%5[Dd]/,v={javascript:1,data:1,vbscript:1,mhtml:1,"x-schema":1},m=/(?::|&#[xX]0*3[aA];?|�*58;?|:)/,_=/(?:^[\x00-\x20]+|[\t\n\r\x00]+)/g,E={Tab:"\t",NewLine:"\n"},T=function(e,t,i){return void 0===e?"undefined":null===e?"null":e.toString().replace(t,i)},b=String.fromCodePoint||function(e){return 0===arguments.length?"":e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),e%1024+56320))};function S(e){var t=e.split(m,2);return!t[0]||2!==t.length&&e.length===t[0].length?null:t[0]}function C(t,i,n,r){return i=i||u,n=n||c,void 0===t?"undefined":null===t?"null":t.toString().replace(o,"�").replace(n,(function(t,n,o,a){return n?(n=Number(n[0]<="9"?n:"0"+n),r?b(n):128===n?"€":130===n?"‚":131===n?"ƒ":132===n?"„":133===n?"…":134===n?"†":135===n?"‡":136===n?"ˆ":137===n?"‰":138===n?"Š":139===n?"‹":140===n?"Œ":142===n?"Ž":145===n?"‘":146===n?"’":147===n?"“":148===n?"”":149===n?"•":150===n?"–":151===n?"—":152===n?"˜":153===n?"™":154===n?"š":155===n?"›":156===n?"œ":158===n?"ž":159===n?"Ÿ":n>=55296&&n<=57343||13===n?"�":e.frCoPt(n)):i[o||a]||t}))}function k(e){return"\\"+e.charCodeAt(0).toString(16).toLowerCase()+" "}function I(e){return e.replace(p,(function(e){return"-x-"+e}))}function P(t){var i=S(t=e.yufull(C(t)));return i&&v[i.toLowerCase()]?"##"+t:t}return e={frCoPt:function(e){return null==e?"":!isFinite(e=Number(e))||e<=0||e>1114111||e>=1&&e<=8||e>=14&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||11===e||65535==(65535&e)||65534==(65535&e)?"�":b(e)},d:C,yup:function(e){return(e=S(e.replace(o,"")))?C(e,E,null,!0).replace(_,"").toLowerCase():null},y:function(e){return T(e,s,(function(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"===e?"'":"`"}))},ya:function(e){return T(e,r,"&")},yd:function(e){return T(e,t,"<")},yc:function(e){return T(e,l,(function(e){return"\0"===e?"�":"--!"===e||"--"===e||"-"===e||"]"===e?e+" ":e.slice(0,-1)+" >"}))},yavd:function(e){return T(e,i,""")},yavs:function(e){return T(e,n,"'")},yavu:function(e){return T(e,a,(function(e){return"\t"===e?"	":"\n"===e?" ":"\v"===e?"":"\f"===e?"":"\r"===e?" ":" "===e?" ":"="===e?"=":"<"===e?"<":">"===e?">":'"'===e?""":"'"===e?"'":"`"===e?"`":"�"}))},yu:encodeURI,yuc:encodeURIComponent,yubl:function(t){return v[e.yup(t)]?"x-"+t:t},yufull:function(t){return e.yu(t).replace(y,(function(e,t){return"//["+t+"]"}))},yublf:function(t){return e.yubl(e.yufull(t))},yceu:function(e){return e=C(e),h.test(e)?e:";-x:'"+I(e.replace(f,k))+"';-v:"},yced:function(e){return I(C(e).replace(d,k))},yces:function(e){return I(C(e).replace(f,k))},yceuu:function(e){return P(e).replace(g,(function(e){return"'"===e?"\\27 ":"("===e?"%28":"%29"}))},yceud:function(e){return P(e)},yceus:function(e){return P(e).replace(n,"\\27 ")}}};var t=e._privFilters=e._getPrivFilters();function i(e,i,n){return t.yubl(i((n||t.yufull)(e)))}e.inHTMLData=t.yd,e.inHTMLComment=t.yc,e.inSingleQuotedAttr=t.yavs,e.inDoubleQuotedAttr=t.yavd,e.inUnQuotedAttr=t.yavu,e.uriInSingleQuotedAttr=function(e){return i(e,t.yavs)},e.uriInDoubleQuotedAttr=function(e){return i(e,t.yavd)},e.uriInUnQuotedAttr=function(e){return i(e,t.yavu)},e.uriInHTMLData=t.yufull,e.uriInHTMLComment=function(e){return t.yc(t.yufull(e))},e.uriPathInSingleQuotedAttr=function(e){return i(e,t.yavs,t.yu)},e.uriPathInDoubleQuotedAttr=function(e){return i(e,t.yavd,t.yu)},e.uriPathInUnQuotedAttr=function(e){return i(e,t.yavu,t.yu)},e.uriPathInHTMLData=t.yu,e.uriPathInHTMLComment=function(e){return t.yc(t.yu(e))},e.uriQueryInSingleQuotedAttr=e.uriPathInSingleQuotedAttr,e.uriQueryInDoubleQuotedAttr=e.uriPathInDoubleQuotedAttr,e.uriQueryInUnQuotedAttr=e.uriPathInUnQuotedAttr,e.uriQueryInHTMLData=e.uriPathInHTMLData,e.uriQueryInHTMLComment=e.uriPathInHTMLComment,e.uriComponentInSingleQuotedAttr=function(e){return t.yavs(t.yuc(e))},e.uriComponentInDoubleQuotedAttr=function(e){return t.yavd(t.yuc(e))},e.uriComponentInUnQuotedAttr=function(e){return t.yavu(t.yuc(e))},e.uriComponentInHTMLData=t.yuc,e.uriComponentInHTMLComment=function(e){return t.yc(t.yuc(e))},e.uriFragmentInSingleQuotedAttr=function(e){return t.yubl(t.yavs(t.yuc(e)))},e.uriFragmentInDoubleQuotedAttr=function(e){return t.yubl(t.yavd(t.yuc(e)))},e.uriFragmentInUnQuotedAttr=function(e){return t.yubl(t.yavu(t.yuc(e)))},e.uriFragmentInHTMLData=e.uriComponentInHTMLData,e.uriFragmentInHTMLComment=e.uriComponentInHTMLComment}(OB);const LB="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; pointer-events: none; z-index: 9999; font-size: 14px; display: block;",NB={SLOW:.5,MODERATE:1,FAST:2},MB={SLOW:5,MODERATE:3.5,FAST:2},UB={style:{node:LB,wrap:"",img:""},class:{node:"",wrap:"xg-dynamic-watermark",img:""}};function BB(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach((e=>{i.setAttribute(e,t[e])})),i}class FB{constructor(e){this.root=e.root,this.config=e,this.wrap=document.createElement("div"),this.img=document.createElement("img"),this.imgSrc="",this.root&&this.root.appendChild(this.wrap),this.moveTimer=null,this.blinkTimer=null,this.pauseAnimation=!1,this.observer=[]}_getWatermarkDom(){const{content:e="",fontFamily:t}=this.config,i=e,n="string"==typeof this.config.fontSize?`${this.config.fontSize}`:`${this.config.fontSize}px`,r=document.createElement("text");r.style.fontSize=n,r.style.whiteSpace="nowrap",t&&(r.style.fontFamily=t),r.innerHTML=OB.inHTMLData(i),document.body.appendChild(r);const o=BB("svg",{xmlns:"http://www.w3.org/2000/svg",width:r.offsetWidth+2,height:r.offsetHeight}),a=BB("text",c({x:r.offsetWidth/2,y:r.offsetHeight/2,style:`\n fill:${this.config.fontColor};\n text-anchor: middle;\n alignment-baseline:middle;\n opacity: ${this.config.opacity};\n font-size: ${n};\n `},t?{"font-family":t}:{}));return a.innerHTML=OB.inHTMLData(i),document.body.removeChild(r),o.appendChild(a),"data:image/svg+xml;base64, "+xB((new XMLSerializer).serializeToString(o))}_startRender(){switch(this.pauseAnimation=!1,this.config.displayType){case 0:this._fixedRender();break;case 1:this._startMove();break;case 2:this._startBlink()}this.observer[0]=this._attrObserver(this.img,["src","class"],"img"),this.observer[1]=this._attrObserver(this.wrap,["class","style","id"],"node"),this.observer[2]=this._attrObserver(this.root,["class","style"],"wrap"),this.observer[3]=this._domObserver(this.wrap),this.observer[4]=this._domObserver(this.root),this.observer[5]=this._domObserver(this.root.parentElement,!0)}_startMove(){var e;if(!this.img||!(null==(e=this.wrap)?void 0:e.clientWidth))return;const{offsetX:t,offsetY:i}=this._getOffset(),n=NB[this.config.tickerSpeed]||NB.MODERATE;let r=t,o=n,a=i,s=n;clearInterval(this.moveTimer),this.moveTimer=setInterval((()=>{if(this.pauseAnimation)return;const e=this._getOffsetThreshold();r+=o,a+=s,this.wrap.offsetWidth>this.img.offsetWidth&&r>this.wrap.offsetWidth&&(r=this.wrap.offsetWidth-this.img.offsetWidth),this.wrap.offsetHeight>this.img.offsetHeight&&a>this.wrap.offsetHeight&&(a=this.wrap.offsetHeight-this.img.offsetHeight),this.img.setAttribute("style",`position: relative;left:${r}px; top:${a}px`),r>=e.hRight&&(o=-n),r<=e.hLeft&&(o=n),a>=e.vBottom&&(s=-n),a<=e.vTop&&(s=n)}),30)}_startBlink(){const e=MB[this.config.tickerSpeed]||MB.MODERATE;clearInterval(this.blinkTimer),this._blinkRender(e,!0),this.blinkTimer=setInterval((()=>{this.pauseAnimation||this._blinkRender(e)}),1e3*e)}_randomBetween(e,t){const i=t-e+1;return Math.floor(Math.random()*i)+e}_fixedRender(){var e;if(!this.img||!(null==(e=this.wrap)?void 0:e.clientWidth))return;this.img.setAttribute("style","");const{offsetX:t,offsetY:i}=this._getOffset(),n=MB[this.config.tickerSpeed];return n?this.img.setAttribute("style",`opacity: 0.1;transform: translate(${t}px, ${i}px);animation: _xg_animation_blink ${n}s linear infinite;`):this.img.setAttribute("style",`opacity: 1;transform: translate(${t}px, ${i}px);`)}_getOffset(){const{left:e,top:t,right:i,bottom:n}=this.config,{clientWidth:r,clientHeight:o}=this.wrap,{clientWidth:a,clientHeight:s}=this.img;let l=0,c=0;return void 0!==i&&r&&(l=r-a-i),void 0!==e&&r&&(l=e),void 0!==n&&o&&(c=o-s-n),void 0!==t&&o&&(c=t),{offsetX:l,offsetY:c}}_getOffsetThreshold(){const{clientWidth:e,clientHeight:t}=this.wrap,{clientWidth:i,clientHeight:n}=this.img;return{hLeft:e-i>=0?0:e-i,hRight:e-i>=0?e-i:0,vTop:t-n>=0?0:t-n,vBottom:t-n>=0?t-n:0}}_blinkRender(e,t){var i;if(!this.img||!(null==(i=this.wrap)?void 0:i.clientWidth))return;if(this.img.setAttribute("style","opacity: 0.1;"),t){const{offsetX:t,offsetY:i}=this._getOffset();return this.img.setAttribute("style",`opacity: 0.1;transform: translate(${t}px, ${i}px);animation: _xg_animation_blink ${e}s linear 1;`)}const n=this._getOffsetThreshold(),{clientWidth:r,clientHeight:o}=this.wrap,a=r?this._randomBetween(n.hLeft,n.hRight):0,s=o?this._randomBetween(n.vTop,n.vBottom):0;setTimeout((()=>{this.img.setAttribute("style",`opacity: 0.1;transform: translate(${a}px, ${s}px);animation: _xg_animation_blink ${e}s linear 1;`)}),10)}_attrObserver(e,t,i){if(!e||!this.wrap||!window.MutationObserver)return;const n=new window.MutationObserver((t=>{e&&this.wrap&&t.forEach((t=>{if("class"===t.attributeName&&e.getAttribute("class")!=UB.class[i]&&e.setAttribute("class",UB.class[i]),"style"===t.attributeName&&e.getAttribute("style")!=UB.style[i]&&e.setAttribute("style",UB.style[i]),"img"===i&&"src"===t.attributeName){if(((null==e?void 0:e.getAttribute("src"))||"")!==this.imgSrc){const t=this._getWatermarkDom();this.wrap&&t&&(this.imgSrc=t,e.setAttribute("src",t))}}}))}));return n.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:t}),n}_domObserver(e,t){if(!e||!this.wrap)return;const i=new window.MutationObserver((i=>{e&&this.wrap&&i.forEach((i=>{i.removedNodes.forEach((i=>{if(!t)return e.appendChild(i);!e.getElementsByClassName(this.config.rootClassName).length&&e.appendChild(i)}))}))}));return i.observe(e,{childList:!0}),i}update(){const e=this._getWatermarkDom();this.wrap&&this.img&&e&&(this.imgSrc=e,this.img.setAttribute("src",e))}start(){if(!(this.root&&this.wrap&&this.img))return;clearInterval(this.moveTimer),clearInterval(this.blinkTimer),this.observer.forEach((e=>{var t;null==(t=null==e?void 0:e.disconnect)||t.call(e)})),this.wrap.innerHTML="",this.wrap.setAttribute("style",LB);const e=this._getWatermarkDom();e&&(this.img.src=e,this.img.style.opacity="0",this.img.alt="",this.imgSrc=e,this.wrap.appendChild(this.img),setTimeout((()=>this._startRender())))}pause(){this.pauseAnimation=!0}resume(){this.pauseAnimation=!1}resize(){}destroy(){clearInterval(this.moveTimer),clearInterval(this.blinkTimer),this.observer.forEach((e=>{var t;null==(t=null==e?void 0:e.disconnect)||t.call(e)})),this.img=null,this.wrap.innerHTML="",this.wrap=null}}const HB="xg-dynamic-watermark";function jB(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.5 0.199997C8.5 0.0895386 8.5896 0 8.69995 0H9.30005C9.4104 0 9.5 0.0895386 9.5 0.199997V1.8C9.5 1.91046 9.4104 2 9.30005 2H8.69995C8.5896 2 8.5 1.91046 8.5 1.8V0.199997Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.95424C0 1.85173 0.0773926 1.76582 0.179443 1.75529L7.27954 1.02277C7.34546 1.01596 7.40649 1.04182 7.44751 1.08664C7.47998 1.12207 7.5 1.16936 7.5 1.22171V14.7783C7.5 14.8969 7.39746 14.9894 7.27954 14.9773L0.179443 14.2447C0.0773926 14.2342 0 14.1483 0 14.0458V1.95424ZM1.5 12.873V3.12701L6 2.66273V13.3373L1.5 12.873Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M18 1.95424C18 1.85173 17.9226 1.76582 17.8206 1.75529L10.7205 1.02277C10.6025 1.01059 10.5 1.10313 10.5 1.22171V14.7783C10.5 14.8969 10.6025 14.9894 10.7205 14.9773L17.8206 14.2447C17.9226 14.2342 18 14.1483 18 14.0458V1.95424ZM16.5 3.12701L12 2.66273V13.3373L16.5 12.873V3.12701Z" fill="white"/>\n <path d="M8.69995 3C8.5896 3 8.5 3.08954 8.5 3.2V4.8C8.5 4.91046 8.5896 5 8.69995 5H9.30005C9.32642 5 9.35156 4.9949 9.37451 4.98564C9.39111 4.97896 9.40674 4.97011 9.4209 4.95944C9.46899 4.92293 9.5 4.8651 9.5 4.8V3.2C9.5 3.14664 9.47925 3.09818 9.44507 3.06232C9.40869 3.02393 9.35718 3 9.30005 3H8.69995Z" fill="white"/>\n <path d="M8.5 6.2C8.5 6.08954 8.5896 6 8.69995 6H9.30005C9.34277 6 9.38232 6.01344 9.41479 6.03635C9.46631 6.07254 9.5 6.13234 9.5 6.2V7.8C9.5 7.85072 9.48096 7.89703 9.44995 7.9323C9.41821 7.96826 9.37354 7.99272 9.32373 7.99861C9.31592 7.99953 9.30811 8 9.30005 8H8.69995C8.5896 8 8.5 7.91046 8.5 7.8V6.2Z" fill="white"/>\n <path d="M8.53711 9.08395C8.51367 9.11667 8.5 9.15674 8.5 9.20001V10.8C8.5 10.9105 8.5896 11 8.69995 11H9.30005C9.4104 11 9.5 10.9105 9.5 10.8V9.20001C9.5 9.08954 9.4104 9 9.30005 9H8.69995C8.68384 9 8.66821 9.00189 8.65332 9.00546C8.60571 9.01688 8.5647 9.04529 8.53711 9.08395Z" fill="white"/>\n <path d="M8.5 12.2C8.5 12.1371 8.52905 12.081 8.57446 12.0443C8.60864 12.0166 8.65234 12 8.69995 12H9.30005C9.4104 12 9.5 12.0895 9.5 12.2V13.8C9.5 13.8664 9.46753 13.9253 9.41772 13.9616C9.38477 13.9857 9.34399 14 9.30005 14H8.69995C8.5896 14 8.5 13.9105 8.5 13.8V12.2Z" fill="white"/>\n <path d="M8.69995 15C8.5896 15 8.5 15.0895 8.5 15.2V15.8C8.5 15.9105 8.5896 16 8.69995 16H9.30005C9.4104 16 9.5 15.9105 9.5 15.8V15.2C9.5 15.0895 9.4104 15 9.30005 15H8.69995Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}function VB(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.5 0.2C8.5 0.0895431 8.58954 0 8.7 0H9.3C9.41046 0 9.5 0.0895431 9.5 0.2V1.8C9.5 1.91046 9.41046 2 9.3 2H8.7C8.58954 2 8.5 1.91046 8.5 1.8V0.2Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.95424C0 1.85173 0.0775055 1.76582 0.179474 1.7553L7.27947 1.02276C7.39742 1.01059 7.5 1.10313 7.5 1.2217V14.7783C7.5 14.8969 7.39742 14.9894 7.27947 14.9773L0.179474 14.2447C0.0775053 14.2342 0 14.1483 0 14.0458V1.95424ZM1.5 12.873V3.12702L6 2.66273V13.3373L1.5 12.873Z" fill="white"/>\n <path d="M17.8205 1.7553C17.9225 1.76582 18 1.85173 18 1.95424V14.0458C18 14.1483 17.9225 14.2342 17.8205 14.2447L10.7205 14.9773C10.6026 14.9894 10.5 14.8969 10.5 14.7783V1.2217C10.5 1.10313 10.6026 1.01059 10.7205 1.02276L17.8205 1.7553Z" fill="white"/>\n <path d="M8.7 3C8.58954 3 8.5 3.08954 8.5 3.2V4.8C8.5 4.91046 8.58954 5 8.7 5H9.3C9.41046 5 9.5 4.91046 9.5 4.8V3.2C9.5 3.08954 9.41046 3 9.3 3H8.7Z" fill="white"/>\n <path d="M8.5 6.2C8.5 6.08954 8.58954 6 8.7 6H9.3C9.41046 6 9.5 6.08954 9.5 6.2V7.8C9.5 7.91046 9.41046 8 9.3 8H8.7C8.58954 8 8.5 7.91046 8.5 7.8V6.2Z" fill="white"/>\n <path d="M8.7 9C8.58954 9 8.5 9.08954 8.5 9.2V10.8C8.5 10.9105 8.58954 11 8.7 11H9.3C9.41046 11 9.5 10.9105 9.5 10.8V9.2C9.5 9.08954 9.41046 9 9.3 9H8.7Z" fill="white"/>\n <path d="M8.5 12.2C8.5 12.0895 8.58954 12 8.7 12H9.3C9.41046 12 9.5 12.0895 9.5 12.2V13.8C9.5 13.9105 9.41046 14 9.3 14H8.7C8.58954 14 8.5 13.9105 8.5 13.8V12.2Z" fill="white"/>\n <path d="M8.7 15C8.58954 15 8.5 15.0895 8.5 15.2V15.8C8.5 15.9105 8.58954 16 8.7 16H9.3C9.41046 16 9.5 15.9105 9.5 15.8V15.2C9.5 15.0895 9.41046 15 9.3 15H8.7Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:KB}=ba,WB="getMirror",GB="exitMirror";class YB extends ba{constructor(e){super(e),this.memoryId="",this.shouldShowToast=!1,this.saveTimeFun=Mr.checkIsFunction(this.config.saveTime)?this.config.saveTime:this.saveTimeByStorage,this.getTimeFun=Mr.checkIsFunction(this.config.getTime)?this.config.getTime:this.getTimeByStorage,this.startTime=0,this.memoryId=this.config.memoryId,this.showToast=this.showToast.bind(this),this.saveTime=this.saveTime.bind(this),this.visibilitychangeCallback=this.visibilitychangeCallback.bind(this)}static get pluginName(){return"memoryPlay"}static get defaultConfig(){return{getTime:null,saveTime:null,memoryId:"",minStartTime:1,minEndTime:1}}registerLanguageTexts(){return{preText:{jp:"に位置付けられました",en:"Has located for you to ",zh:"已为您定位至","zh-hk":"已為您定位至"}}}children(){return{toast:sO}}afterCreate(){this.once(Jr,this.showToast),this.on(eo,(()=>{this.curTime=this.player.currentTime}))}beforePlayerInit(){return this.memoryId||(this.playerConfig.vid?this.memoryId=this.playerConfig.vid:this.player.url&&(this.memoryId=this.player.url.replace(/\?.*$/,""))),this.setSave(),this.getTime()}getTime(){return new Promise((e=>{const t=(i=this.getTimeFun(this.memoryId))&&i.then?i:new Promise((e=>{e(i)}));var i;t.then((t=>{var i,n,r,o,a,s;const l=function(e,t=0){const i=parseFloat(e);return Number.isNaN(i)?t:i}(t);!isNaN(l)&&l>0?(this.startTime=l,this.shouldShowToast=!0,this.playerConfig.startTime=this.startTime,(null==(r=null==(n=null==(i=this.player.plugins)?void 0:i.hls)?void 0:n.hls)?void 0:r.config)&&(this.player.plugins.hls.hls.config.startTime=this.startTime),(null==(s=null==(a=null==(o=this.player.plugins)?void 0:o.encrypthlsplugin)?void 0:a.hls)?void 0:s.config)&&(this.player.plugins.encrypthlsplugin.hls.config.startTime=this.startTime)):as.warn("the time got is invalid",t),e()})).catch((t=>{as.error("getTime function occur error",t),e()}))}))}saveTime(){var e;if(!this.player)return;const{minStartTime:t=1,minEndTime:i=1}=this.config,{currentTime:n,duration:r}=this.player,o=null!=(e=null!=n?n:this.curTime)?e:0;r&&(o<t||Math.abs(r-o)<i?this.saveTimeFun(this.memoryId,0):this.saveTimeFun(this.memoryId,o))}visibilitychangeCallback(){"hidden"===document.visibilityState&&this.saveTime()}setSave(){this.on(Xr,this.saveTime.bind(this)),this.on(Zr,this.saveTime.bind(this)),document.addEventListener("visibilitychange",this.visibilitychangeCallback.bind(this)),document.addEventListener("pagehide",this.saveTime.bind(this)),window.addEventListener("beforeunload",this.saveTime.bind(this))}showToast(){var e;if(this.shouldShowToast){this.shouldShowToast=!1;const t=null==(e=this.player)?void 0:e.getPlugin("sdkToastPlugin");if(!t)return;if(this.startTime>0){const e=Mr.format(this.startTime);t.add(`${this.langText.preText}${e}`,4e3,!0)}}}saveTimeByStorage(e,t){Cs(e,YB.pluginName,t+"")}getTimeByStorage(e){return ks(e,YB.pluginName)||0}destroy(){this.saveTime(),document.removeEventListener("visibilitychange",this.visibilitychangeCallback),document.removeEventListener("pagehide",this.saveTime),window.removeEventListener("beforeunload",this.saveTime)}}function zB(){return(new DOMParser).parseFromString('<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#filter0_dii_340_912)">\n<path d="M4.00011 7.66678C4.00005 5.82578 5.49245 4.33333 7.33344 4.33333H23.3742H32.6657C34.5066 4.33333 35.999 5.82572 35.999 7.66667V13.5764L35.9998 32.3332C35.9999 34.1742 34.5075 35.6667 32.6665 35.6667H7.33423C5.49332 35.6667 4.00096 34.1743 4.0009 32.3334L4.00011 7.66678Z" fill="url(#paint0_linear_340_912)"/>\n<path d="M4.10011 7.66677C4.10005 5.88101 5.54768 4.43333 7.33344 4.43333H23.3742H32.6657C34.4514 4.43333 35.899 5.88095 35.899 7.66667V13.5764L35.8998 32.3332C35.8999 34.119 34.4523 35.5667 32.6665 35.5667H7.33423C5.54855 35.5667 4.10095 34.1191 4.1009 32.3334L4.10011 7.66677Z" stroke="url(#paint1_linear_340_912)" stroke-width="0.2"/>\n</g>\n<path d="M6.76669 9.66667C6.76669 8.24914 7.91582 7.1 9.33335 7.1H30.6667C32.0842 7.1 33.2334 8.24914 33.2334 9.66667V30.3333C33.2334 31.7509 32.0842 32.9 30.6667 32.9H9.33335C7.91582 32.9 6.76669 31.7509 6.76669 30.3333V9.66667Z" fill="url(#paint2_linear_340_912)" stroke="url(#paint3_linear_340_912)" stroke-width="0.2"/>\n<g filter="url(#filter1_dii_340_912)">\n<path d="M15.4689 18.4428L10.9398 27.4593C10.6614 28.0134 11.0643 28.6667 11.6845 28.6667H27.8647C28.5118 28.6667 28.912 27.9614 28.5801 27.4059L25.3326 21.9703C25.0217 21.4499 24.2769 21.425 23.932 21.9235L21.1839 25.8946C21.1128 25.9973 20.9581 25.9882 20.8996 25.8778L16.9499 18.4266C16.6329 17.8285 15.7728 17.8379 15.4689 18.4428Z" fill="url(#paint4_linear_340_912)"/>\n<path d="M15.4689 18.4428L10.9398 27.4593C10.6614 28.0134 11.0643 28.6667 11.6845 28.6667H27.8647C28.5118 28.6667 28.912 27.9614 28.5801 27.4059L25.3326 21.9703C25.0217 21.4499 24.2769 21.425 23.932 21.9235L21.1839 25.8946C21.1128 25.9973 20.9581 25.9882 20.8996 25.8778L16.9499 18.4266C16.6329 17.8285 15.7728 17.8379 15.4689 18.4428Z" stroke="url(#paint5_linear_340_912)" stroke-width="0.166667"/>\n</g>\n<g filter="url(#filter2_dii_340_912)">\n<circle cx="23.6667" cy="14.6667" r="2" fill="url(#paint6_linear_340_912)"/>\n<circle cx="23.6667" cy="14.6667" r="2" stroke="url(#paint7_linear_340_912)" stroke-width="0.166667"/>\n</g>\n<defs>\n<filter id="filter0_dii_340_912" x="3.8431" y="4.17631" width="32.6278" height="32.1184" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.157018" dy="0.314036"/>\n<feGaussianBlur stdDeviation="0.157018"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.0684375 0 0 0 0 0.0704062 0 0 0 0 0.075 0 0 0 0.5 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_340_912"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_340_912" result="shape"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.471054" dy="0.471054"/>\n<feGaussianBlur stdDeviation="0.157018"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.355764 0 0 0 0 0.368819 0 0 0 0 0.391667 0 0 0 1 0"/>\n<feBlend mode="normal" in2="shape" result="effect2_innerShadow_340_912"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="-0.471054" dy="-0.471054"/>\n<feGaussianBlur stdDeviation="0.0785089"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.191389 0 0 0 0 0.197708 0 0 0 0 0.216667 0 0 0 1 0"/>\n<feBlend mode="normal" in2="effect2_innerShadow_340_912" result="effect3_innerShadow_340_912"/>\n</filter>\n<filter id="filter1_dii_340_912" x="10.4333" y="17.5669" width="18.6828" height="11.6831" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dy="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.0823529 0 0 0 0 0.0901961 0 0 0 0 0.105882 0 0 0 1 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_340_912"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_340_912" result="shape"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.930313 0 0 0 0 0.935083 0 0 0 0 0.954167 0 0 0 1 0"/>\n<feBlend mode="normal" in2="shape" result="effect2_innerShadow_340_912"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="-0.166667" dy="-0.333333"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.409097 0 0 0 0 0.443509 0 0 0 0 0.570833 0 0 0 1 0"/>\n<feBlend mode="normal" in2="effect2_innerShadow_340_912" result="effect3_innerShadow_340_912"/>\n</filter>\n<filter id="filter2_dii_340_912" x="21.25" y="12.25" width="4.83329" height="5.00001" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dy="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.0823529 0 0 0 0 0.0901961 0 0 0 0 0.105882 0 0 0 1 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_340_912"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_340_912" result="shape"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.930313 0 0 0 0 0.935083 0 0 0 0 0.954167 0 0 0 1 0"/>\n<feBlend mode="normal" in2="shape" result="effect2_innerShadow_340_912"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="-0.166667" dy="-0.333333"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.364583 0 0 0 0 0.397828 0 0 0 0 0.520833 0 0 0 1 0"/>\n<feBlend mode="normal" in2="effect2_innerShadow_340_912" result="effect3_innerShadow_340_912"/>\n</filter>\n<linearGradient id="paint0_linear_340_912" x1="30.2254" y1="8.17498" x2="11.4982" y2="41.5657" gradientUnits="userSpaceOnUse">\n<stop stop-color="#434548"/>\n<stop offset="0.855332" stop-color="#3E3F42"/>\n</linearGradient>\n<linearGradient id="paint1_linear_340_912" x1="7.52649" y1="1.8673" x2="25.0283" y2="33.3887" gradientUnits="userSpaceOnUse">\n<stop stop-color="#383838"/>\n<stop offset="0.192009" stop-color="#45484D"/>\n<stop offset="0.703503" stop-color="#37393D"/>\n<stop offset="0.962692" stop-color="#1B1C1E"/>\n</linearGradient>\n<linearGradient id="paint2_linear_340_912" x1="28.5212" y1="10.1877" x2="13.0162" y2="37.9513" gradientUnits="userSpaceOnUse">\n<stop stop-color="#2E2F32"/>\n<stop offset="0.855332" stop-color="#242528"/>\n</linearGradient>\n<linearGradient id="paint3_linear_340_912" x1="9.60543" y1="4.95372" x2="24.0954" y2="31.1622" gradientUnits="userSpaceOnUse">\n<stop stop-color="#1F2124"/>\n<stop offset="0.192009" stop-color="#282B30"/>\n<stop offset="0.703503" stop-color="#27292F"/>\n<stop offset="0.962692" stop-color="#1D1F23"/>\n</linearGradient>\n<linearGradient id="paint4_linear_340_912" x1="16.969" y1="16.5412" x2="22.5457" y2="28.6249" gradientUnits="userSpaceOnUse">\n<stop stop-color="#C7CCE2"/>\n<stop offset="1" stop-color="#8B95BC"/>\n</linearGradient>\n<linearGradient id="paint5_linear_340_912" x1="17.5125" y1="20.3581" x2="20.121" y2="28.4669" gradientUnits="userSpaceOnUse">\n<stop offset="0.181113" stop-color="#B1B7D3"/>\n<stop offset="1" stop-color="#535C80"/>\n</linearGradient>\n<linearGradient id="paint6_linear_340_912" x1="23.0637" y1="12.5093" x2="25.4773" y2="15.7207" gradientUnits="userSpaceOnUse">\n<stop stop-color="#B8BED6"/>\n<stop offset="1" stop-color="#7E88AD"/>\n</linearGradient>\n<linearGradient id="paint7_linear_340_912" x1="23.1781" y1="13.818" x2="24.4392" y2="16.2252" gradientUnits="userSpaceOnUse">\n<stop offset="0.181113" stop-color="#B1B7D3"/>\n<stop offset="1" stop-color="#495274"/>\n</linearGradient>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}class $B{constructor(e){this.config=e.config,this.parent=e.root,this.root=Mr.createDom("ul","",{},`xg-play-list xg-list-slide-scroll ${this.config.className}`);const t="mobile"===Vr.device?"touchend":"click";this.modal=Mr.createDom("div","",{},"xg-play-list-modal"),this.modal.appendChild(this.root),e.root.appendChild(this.modal),this._delegates=ba.delegate.call(this,this.modal,".xg-play-list-modal",t,this.modalClick.bind(this));const{maxHeight:i}=this.config;i&&this.setStyle({maxHeight:i}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList(),this._delegates.concat(ba.delegate.call(this,this.root,"li",t,this.onItemClick))}renderItemList(e){const{config:t,root:i}=this;e?t.data=e:e=t.data,t.style&&Object.keys(t.style).map((e=>{i.style[e]=t[e]})),e.length>0&&(this.attrKeys=Object.keys(e[0])),this.root.innerHTML="",e.map(((e,t)=>{const i=e.selected?"xg-play-list-item selected":"xg-play-list-item";e["data-index"]=t;const n=e.duration?Mr.format(e.duration):"",r=`\n <div style="${e.poster?`background-image: url('${e.poster}')`:""}" class="xg-play-list-poster ${e.selected?"is-active":""} ${e.poster?"":"no-poster"}" >\n <div class="bg"></div>\n <div class="icon"></div>\n <div class="duration">${n}</div>\n <duv class="playing">\n <div class="icon-wrap">\n <div class="icon-line"></div>\n <div class="icon-line"></div>\n <div class="icon-line"></div>\n <div class="icon-line"></div>\n </div>\n </duv>\n </div>\n <div class="xg-play-list-title">\n <div class="xg-play-list-title-text">${e.title}</div>\n </div>\n `,o=Mr.createDom("li",r,e,i),a=Mr.findDom(o,".bg"),s=null==zB?void 0:zB();!e.poster&&s&&a.appendChild(s),this.root.appendChild(o)}));const n=e.findIndex((e=>e.selected));if(n>=0){const t=Mr.findDom(this.root,".xg-play-list-item.selected");if(!t)return;const{height:i}=t.getBoundingClientRect(),{height:r}=this.root.getBoundingClientRect(),o=(e.length-n)*i,a=i*e.length;this.root.scrollTop=o<r?a-r:n*i}}onItemClick(e){e.delegateTarget||(e.delegateTarget=e.target);const t=e.delegateTarget;if(t&&Mr.hasClass(t,"selected"))return!1;const i="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");Mr.addClass(t,"selected"),n&&Mr.removeClass(n,"selected"),i&&i(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}getAttrObj(e,t){if(!e||!t)return{};const i={};t.map((t=>{i[t]=e.getAttribute(t)}));const n=e.getAttribute("data-index");return n&&(i.index=Number(n)),i}show(){Mr.removeClass(this.modal,"hide"),Mr.addClass(this.modal,"active"),Mr.removeClass(this.root,"hide"),Mr.addClass(this.root,"active")}hide(){Mr.removeClass(this.modal,"active"),Mr.addClass(this.modal,"hide"),Mr.removeClass(this.root,"active"),Mr.addClass(this.root,"hide")}modalClick(e){e.stopPropagation(),this.hide();const t="function"==typeof this.config.onModalClick?this.config.onModalClick:null;t&&t(e)}setStyle(e){Object.keys(e).forEach((t=>{this.root.style[t]=e[t]}))}destroy(){this._delegates&&(this._delegates.map((e=>{e.destroy&&e.destroy()})),this._delegates=null),this.root.parentNode.removeChild(this.root),this.root.innerHTML=null,this.root=null}}function XB(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M12.8499 8.49494C13.7054 8.98885 14.1331 9.23581 14.2767 9.55822C14.4019 9.83944 14.4019 10.1606 14.2767 10.4418C14.1331 10.7642 13.7054 11.0112 12.8499 11.5051L6.65863 15.0796C5.80315 15.5735 5.37542 15.8205 5.02442 15.7836C4.71827 15.7514 4.44016 15.5909 4.25921 15.3418C4.05177 15.0563 4.05177 14.5624 4.05177 13.5746V6.42547C4.05177 5.43765 4.05177 4.94374 4.25921 4.65822C4.44016 4.40917 4.71827 4.2486 5.02442 4.21642C5.37542 4.17953 5.80315 4.42649 6.65863 4.92039L12.8499 8.49494Z" fill="white"/>\n<rect x="13.8274" y="4.02594" width="2.17238" height="11.9481" rx="0.814644" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}function qB(){return(new DOMParser).parseFromString('<svg width="21" height="22" viewBox="0 0 21 22" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#filter0_d_126_721)">\n<path d="M8.18979 6.3414C8.60304 6.57999 8.80967 6.69928 8.87901 6.85503C8.93949 6.99088 8.93949 7.14601 8.87901 7.28186C8.80967 7.4376 8.60304 7.5569 8.18979 7.79549L5.59253 9.29502C5.17928 9.53361 4.97266 9.6529 4.80311 9.63508C4.65522 9.61954 4.52087 9.54197 4.43346 9.42167C4.33325 9.28374 4.33325 9.04515 4.33325 8.56797V5.56891C4.33325 5.09173 4.33325 4.85314 4.43346 4.71522C4.52087 4.59491 4.65522 4.51735 4.80311 4.5018C4.97266 4.48398 5.17928 4.60328 5.59253 4.84187L8.18979 6.3414Z" fill="white"/>\n</g>\n<path d="M11.5264 7.19745H18" stroke="white" stroke-width="1.61843" stroke-linecap="round"/>\n<path d="M5.05273 12.5922L18.0001 12.5922" stroke="white" stroke-width="1.61843" stroke-linecap="round"/>\n<path d="M5.05273 17.9869L18.0001 17.9869" stroke="white" stroke-width="1.61843" stroke-linecap="round"/>\n<defs>\n<filter id="filter0_d_126_721" x="0.736733" y="0.903543" width="11.7841" height="12.3298" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset/>\n<feGaussianBlur stdDeviation="1.79826"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_126_721"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_126_721" result="shape"/>\n</filter>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}const ZB="playListNext",QB="playListToggle",JB="mobile"===Vr.device;function eF(e=[]){if(!Array.isArray(e))return[];return e.filter((e=>e.url||e.playAuthToken)).map(((e,t)=>{const i=c({},e||{});return i.vid||(i.vid=""+t),i}))}function tF(e=[],t=0){const i=Number(t),n=Number.isNaN(i)?0:i;let r=0;return r=n<=0?0:n<e.length?n:0,r<0?0:r}SA.prototype.setVodPlayListConfig=function(e){if(!(e.plugins||[]).find((e=>e.pluginName===iF.pluginName)))return;const t=Ws(e,"playListPlugin");if(t&&function(e){const t=typeof e;return null!==e&&("object"===t||"function"===t)}(t)){const{list:i=[],defaultIndex:n=0}=t,r=eF(i),o=tF(r,n),a=null==r?void 0:r[o];if(a){const{url:t,poster:i,playAuthToken:n}=a;n?e.getVideoByToken=u(c({},e.getVideoByToken||{}),{playAuthToken:n}):t&&(e.url=t),i&&(e.poster=i)}}};class iF extends ba{constructor(){super(...arguments),this.timer=null,this.onEnter=e=>{e.stopPropagation(),this.emit("icon_mouseenter",{pluginName:this.pluginName}),this.switchActiveState(e)},this.switchActiveState=e=>{e.stopPropagation();const{toggleMode:t}=this.config;"click"===t?this.toggle(!this.isActive):this.toggle(!0)},this.handleNext=e=>{e.stopPropagation(),this.next()},this._onTimeUpdate=()=>{const{player:e}=this;!this.halfPass&&e.currentTime>e.duration/2&&this.confirmOrder()},this._onEnded=()=>{if("order"===this.mode&&this.curIndex+1>=this.list.length)return this.player.pause(),void(this.player.currentTime=0);this.next()},this.onLeave=e=>{e.stopPropagation(),this.emit("icon_mouseleave",{pluginName:this.pluginName}),this.isActive&&this.toggle(!1)}}static get pluginName(){return"playListPlugin"}static get defaultConfig(){return{position:ba.POSITIONS.CONTROLS_LEFT,index:VA,list:[],mode:"order",defaultIndex:0,isItemClickHide:!0,toggleMode:"click"}}beforeCreate(e){Object.values(ba.POSITIONS).includes(e.position)||(e.root=e.player.controls.left,e.config.position=ba.POSITIONS.CONTROLS_LEFT,e.position=ba.POSITIONS.CONTROLS_LEFT)}afterCreate(){const{config:e}=this,{list:t=[],mode:i,defaultIndex:n}=e||{};this.initIcons(),this.halfPass=!1,this.list=eF(t),this.timer=setTimeout((()=>{this.emit(LA.PLAY_LIST_CHANGE,this.list)})),this.disable=!(t.length>0),this.mode=i,this.curIndex=tF(this.list,n),this.curIndex>0?(this.nextIndex=this.curIndex+1<this.list.length?this.curIndex+1:0,this.prevIndex=this.curIndex-1):(this.nextIndex=1,this.prevIndex=this.list.length-1),this.on(eo,this._onTimeUpdate),this.on(Xr,this._onEnded),this.on([Ao,ko],(()=>{this._resizeList()})),this.once(io,(()=>{this.list&&this.list.length>0&&(this.renderItemList(),this.show())})),JB&&this.on(uo,(()=>{this.isActive&&(this.optionsList&&this.optionsList.hide(),this.isActive=!1)})),JB?(e.toggleMode="click",this.activeEvent="touchend"):this.activeEvent="click"===e.toggleMode?"click":"mouseenter",this.bind(".xg-play-next-btn","click",this.handleNext),"click"===e.toggleMode?this.bind(".xg-play-list-btn",this.activeEvent,this.switchActiveState):(this.bind(".xg-play-list-btn",this.activeEvent,this.onEnter),this.bind(".xg-play-list-btn","mouseleave",this.onLeave))}registerLanguageTexts(){return{playNext:{jp:"次に遊ぶ",en:"play next",zh:"播放下一个","zh-hk":"播放下一個"},playList:{jp:"プレイリスト",en:"playList",zh:"播放列表","zh-hk":"播放清單"}}}registerIcons(){return{[ZB]:{icon:XB,class:"xg-play-next-btn"},[QB]:{icon:qB,class:"xg-play-list-btn"}}}initIcons(){const{icons:e}=this;this.appendChild(".xg-play-next-btn",e[ZB]),this.appendChild(".xg-play-list-btn",e[QB])}show(){!this.list||this.list.length<1||Mr.addClass(this.root,"show")}hide(){Mr.removeClass(this.root,"show")}prev(){this.disable||(this.halfPass||(this.halfPass=!0,this._prevCompute()),this.curIndex=this.prevIndex,this.change())}next(){this.disable||(this.halfPass||(this.halfPass=!0,this._nextCompute()),this.curIndex=this.nextIndex,this.change())}changeList(e){this.player.currentTime=0,this.list=eF(e),this.nextIndex=0,this.curIndex=0,this.change(),this.disable=!(this.list.length>0),this.emit(LA.PLAY_LIST_CHANGE,this.list)}setIndex(e){e<0||e>=this.list.length||(this.nextIndex=e+1<this.list.length?e+1:0,this.prevIndex=e-1<0?this.list.length-1:e-1,this.curIndex=e,this.change())}change(){if(this.disable)return;const{player:e,list:t,curIndex:i}=this;this.halfPass=!1;const{url:n,playAuthToken:r,title:o="",vid:a="",poster:s=""}=t[i];this.curInfo={url:n,playAuthToken:r,title:o,vid:a,poster:s};const l=e.sdk||e;r?l.playNext({vid:a,poster:s,autoplay:!0,getVideoByToken:{playAuthToken:r}}):l.playNext({vid:a,poster:s,autoplay:!0,url:n}),this.renderItemList(),e.off("timeupdate",this._emitChange.bind(this)),e.once("timeupdate",this._emitChange.bind(this))}confirmOrder(){this.halfPass=!0,this._nextCompute(),this._prevCompute()}_nextCompute(){this.disable||(this.curIndex+1<this.list.length?this.nextIndex=this.curIndex+1:this.nextIndex=0)}_prevCompute(){this.disable||(this.curIndex-1>=0?this.prevIndex=this.curIndex-1:this.prevIndex=this.list.length-1)}_emitChange(){this.emit(LA.PLAY_LIST_ITEM_CHANGE,this.curInfo)}toggle(e){if(e===this.isActive)return;const{controls:t}=this.player;e?(t.blur(),this.optionsList&&this.optionsList.show()):(t.focus(),this.optionsList&&this.optionsList.hide()),this.isActive=e}onItemClick(e,t){e.stopPropagation(),this.curIndex=t.to.index,this.change(),this.toggle(!1)}renderItemList(e){const{list:t,config:i,optionsList:n,player:r}=this;"number"==typeof e&&(this.curIndex=e,this.curInfo=t[e]);const o=t.map(((t,i)=>{const n=u(c({},t),{selected:!1});return i===this.curIndex&&(n.selected=!0,e=i),n}));if(n)return void n.renderItemList(o);const a={config:{data:o,className:"xg-side-play-list",onItemClick:(e,t)=>{this.onItemClick(e,t)},onModalClick:()=>{this.toggle(!1)}},root:r.innerContainer||r.root},{height:s}=this.player.root.getBoundingClientRect(),l=s;l&&i.heightLimit&&(a.config.maxHeight=`${l}px`),this.optionsList=new $B(a),this.show(),this._resizeList()}_resizeList(){if(!this.config.heightLimit)return;const{height:e}=this.player.root.getBoundingClientRect(),t=e;this.optionsList&&this.optionsList.setStyle({maxHeight:`${t}px`})}destroy(){const{config:e}=this;"click"===e.toggleMode?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null),this.timer&&(clearTimeout(this.timer),this.timer=null)}set disable(e){this._disable=e,e?(this.hide(),this.optionsList&&this.optionsList.hide()):this.show()}get disable(){return this._disable}render(){if(!this.disable)return`<xg-icon class="xg-options-icon xg-play-list-btn-container ${this.config.className||""}">\n <div class="xgplayer-icon xg-play-next-btn">\n <div class="xg-tips" lang-key="playNext">${this.langText.playNext}</div>\n </div>\n <div class="xgplayer-icon xg-play-list-btn">\n <div class="xg-tips" lang-key="playList">${this.langText.playList}</div>\n </div>\n </xg-icon>`}}return Object.assign(pB,{Events:UA,Event:MA,DefinitionDemotePlugin:class extends ba{constructor(e){super(e),this.waitings=[],this.longWaitingEmitTime=0,this.waitingStartTime=0,this.playerData=null,this.playerData=this.playerConfig.playerData}static get pluginName(){return"DefinitionDemotePlugin"}static get defaultConfig(){return{isNeedAutoDemote:!0,toastShowTime:3e3,demotePriority:[],isNeedShowTips:!0,oftenWaitingCount:3,oftenWaitingTime:5e3,longWaitingTime:5e3}}registerLanguageTexts(){return{definition_demote_txt:{jp:"現在のネットワークは不安定です。に切り替えることをお勧めします",en:"The current network is unstable, it is recommended to switch to ",zh:"当前网络不稳定,建议切换到","zh-hk":"當前網絡不穩定,建議切換到"}}}afterCreate(){this.bindCtx(),this.bindEvents()}bindCtx(){this._count=this._count.bind(this),this._time=this._time.bind(this),this._waiting=this._waiting.bind(this),this._clearTime=this._clearTime.bind(this),this.demote=this.demote.bind(this)}bindEvents(){this.on(to,this._waiting),this.on(qr,this._clearTime),this.on(zr,this._clearTime),this.on(Do,this._clearTime),this.on(LA.PlAY_URL_CHANGE,this._clearTime),this.config.isNeedAutoDemote&&this.player.on(LA.LONG_WAITING,this.demote)}_waiting(){this._count(),this._time()}_count(){const e=Date.now();this.waitings.push(e);const{oftenWaitingCount:t,oftenWaitingTime:i}=this.config;if(this.waitings.length>=t){const n=this.waitings.shift();n&&e-n<=i&&(as.warn(`stuttering occurred at least ${t} times within ${i}ms`),this.player.emit(LA.OFTEN_WAITING)),this.clearState()}}_time(){if(this.timer)return void as.log("The stuttering was triggered continuously, and the interval since the last stuttering was ",Date.now()-this.waitingStartTime+"ms");this.waitingStartTime=Date.now();const e=this.player.currentTime;this.timer=setTimeout((()=>{this.player&&this.player.currentTime<=e+.1&&(as.warn(`stuttering last more than ${this.config.longWaitingTime}ms`),this.player.emit(LA.LONG_WAITING),this.timer&&(clearTimeout(this.timer),this.timer=null),this.waitingStartTime&&(this.waitingStartTime=0))}),this.config.longWaitingTime)}_clearTime(){this.waitingStartTime&&as.log("stuttering last for ",Date.now()-this.waitingStartTime+"ms"),this.clearState()}clearState(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.waitings.length>0&&(this.waitings=[]),this.waitingStartTime&&(this.waitingStartTime=0)}demote(){if(!this.player.checkBuffer(this.player.currentTime,{endDiff:.5,startDiff:.5})&&!this.player.isSeeking&&this.player.state===La.RUNNING&&this.player.currentTime>1){if(!this.playerData)return;const e=this.playerData.getNextDefinition(!0,this.config.demotePriority),t=null==e?void 0:e[0];if(!t||!t.url)return;const i=t.definition;if(!i)return;const{current:{definition:n}}=this.playerData;if(this.player.emit(LA.DEFINITION_DEMOTE,{currentDef:n,willChangeDef:i,next:t}),"auto"===n){const e=t.url;as.log(`auto demote definition to ${t.definition}`),this.changeUrl(e)}else i!==n&&this.showToast(t)}else as.log("stuttering but not need demote definition")}changeUrl(e){this.player&&e&&(this.player.config.url=e,this.player.switchURL(e,{seamless:!this.player.config.isLive}).then((()=>{as.log(`auto demote definition switch url(${e}) success`)})),this.player.emit(LA.PlAY_URL_CHANGE,{url:e,from:"definition_demote"}))}showToast(e){var t;const i=null==(t=this.player)?void 0:t.getPlugin("sdkToastPlugin");if(!i)return;if(this.toastId&&(i.remove(this.toastId),this.toastId=null),!this.config.isNeedShowTips)return;const n=this.i18n[e.definitionTextKey]||e.definitionTextKey||e.definition,r=Mr.createDom("div",this.langText.definition_demote_txt,void 0,"toast-txt"),o=Mr.createDom("span",n,void 0,"toast-txt-bt");r.appendChild(o),this.toastId=i.add(r,this.config.toastShowTime,!0),o.addEventListener("click",(()=>{this.playerData&&(this.playerData.current.definition=e.definition,i.remove(this.toastId),this.toastId=null,as.log(`user handle demote definition to ${e.definition}`))}))}destroy(){this.clearState()}},MirrorPlugin:class extends ba{constructor(e){super(e),this.isEnableMirror=!0,this.isEnableMirror=this.config.defaultEnable}static get pluginName(){return"mirrorPlugin"}static get defaultConfig(){return{position:KB.CONTROLS_RIGHT,index:HA,disable:!1,defaultEnable:!1}}afterCreate(){this.config.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.updateMirrorState(this.isEnableMirror))}registerIcons(){return{[WB]:{icon:jB,class:"xg-get-mirror"},[GB]:{icon:VB,class:"xg-exit-mirror"}}}initIcons(){const{icons:e}=this,t=this.find(".xgplayer-icon");t.appendChild(e[WB]),t.appendChild(e[GB])}registerLanguageTexts(){return{getMirror:{jp:"ミラーを開く",en:"Turn on mirroring",zh:"开启镜像","zh-hk":"開啟鏡像"},exitMirror:{jp:"ミラーを閉じる",en:"Turn off mirroring",zh:"关闭镜像","zh-hk":"關閉鏡像"}}}btnClick(e){e.preventDefault(),e.stopPropagation(),this.isEnableMirror?this.action(!1):this.action(!0)}action(e){this.isEnableMirror=e,this.updateMirrorState(this.isEnableMirror),this.player.emit(LA.MIRROR_CHANGE,this.isEnableMirror)}updateMirrorState(e){const t=this.player;e?t.addClass("xgplayer-mirror"):t.removeClass("xgplayer-mirror"),this.animate(e)}animate(e){this.root&&(e?this.setAttr("data-state","enable"):this.setAttr("data-state","normal"),this.switchTips(e))}switchTips(e){this.changeLangTextKey(this.find(".xg-tips"),e?GB:WB)}destroy(){this.unbind(["click","touchend"],this.btnClick)}render(){if(!this.config.disable)return`<xg-icon class='xgplayer-mirror-icon'>\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="mirror">${this.langText[WB]}</div>\n </xg-icon>`}},MemoryPlay:YB,Subtitle:aO,DynamicWatermarkPlugin:class extends ba{constructor(e){super(e),this.wm=null}static get pluginName(){return"DynamicWatermark"}static get defaultConfig(){return{position:ba.POSITIONS.ROOT,displayType:1,tickerSpeed:void 0,fontSize:12,fontColor:"#ffffff",opacity:.3,enable:!1,top:void 0,left:void 0,right:void 0,bottom:void 0,content:""}}afterCreate(){this.config.enable&&(this._initWatermark(),this.once(eo,(()=>{this.start()})),this.on(Ao,(()=>{this.resize()})))}start(){var e,t;null==(t=null==(e=this.wm)?void 0:e.start)||t.call(e)}pause(){var e,t;null==(t=null==(e=this.wm)?void 0:e.pause)||t.call(e)}resume(){var e,t;null==(t=null==(e=this.wm)?void 0:e.resume)||t.call(e)}resize(){var e,t;null==(t=null==(e=this.wm)?void 0:e.resize)||t.call(e)}_initWatermark(){this.wm=new FB(u(c({},this.config),{root:this.root,rootClassName:HB}))}destroy(){var e,t;null==(t=null==(e=this.wm)?void 0:e.destroy)||t.call(e),this.offAll()}render(){return`\n <xg-dynamic-watermark class=${HB} />\n `}},PlayListPlugin:iF,getI18N:function(){return Oa},BasePlugin:ca,Plugin:ba,Sniffer:Vr,Util:Mr,STATE_CLASS:Ia,I18N:Oa,STATES:La})}));
|
|
1
|
+
// @byteplus/veplayer@1.19.0-rc.1 Built @9/3/2026, 9:33:56 PM
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VePlayerLite=t()}(this,(function(){var e,t=Object.defineProperty,i=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=Math.pow,l=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,u=(e,t)=>{for(var i in t||(t={}))o.call(t,i)&&l(e,i,t[i]);if(r)for(var i of r(t))s.call(t,i)&&l(e,i,t[i]);return e},c=(e,t)=>i(e,n(t)),h=(e,t)=>{var i={};for(var n in e)o.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&r)for(var n of r(e))t.indexOf(n)<0&&s.call(e,n)&&(i[n]=e[n]);return i},d=(e,t,i)=>new Promise(((n,r)=>{var o=e=>{try{a(i.next(e))}catch(t){r(t)}},s=e=>{try{a(i.throw(e))}catch(t){r(t)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((i=i.apply(e,t)).next())}));function p(e,t){return e===t||e!=e&&t!=t}function f(e,t){for(var i=e.length;i--;)if(p(e[i][0],t))return i;return-1}var g=Array.prototype.splice;function y(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}y.prototype.clear=function(){this.__data__=[],this.size=0},y.prototype.delete=function(e){var t=this.__data__,i=f(t,e);return!(i<0)&&(i==t.length-1?t.pop():g.call(t,i,1),--this.size,!0)},y.prototype.get=function(e){var t=this.__data__,i=f(t,e);return i<0?void 0:t[i][1]},y.prototype.has=function(e){return f(this.__data__,e)>-1},y.prototype.set=function(e,t){var i=this.__data__,n=f(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};const v="object"==typeof global&&global&&global.Object===Object&&global;var m="object"==typeof self&&self&&self.Object===Object&&self;const _=v||m||Function("return this")();const E=_.Symbol;var T=Object.prototype,S=T.hasOwnProperty,b=T.toString,k=E?E.toStringTag:void 0;var C=Object.prototype.toString;var I="[object Null]",A="[object Undefined]",P=E?E.toStringTag:void 0;function w(e){return null==e?void 0===e?A:I:P&&P in Object(e)?function(e){var t=S.call(e,k),i=e[k];try{e[k]=void 0;var n=!0}catch(o){}var r=b.call(e);return n&&(t?e[k]=i:delete e[k]),r}(e):function(e){return C.call(e)}(e)}function D(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var L="[object AsyncFunction]",R="[object Function]",x="[object GeneratorFunction]",O="[object Proxy]";function N(e){if(!D(e))return!1;var t=w(e);return t==R||t==x||t==L||t==O}const M=_["__core-js_shared__"];var U,B=(U=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"";var H=Function.prototype.toString;function F(e){if(null!=e){try{return H.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var j=/^\[object .+?Constructor\]$/,V=Function.prototype,K=Object.prototype,G=V.toString,W=K.hasOwnProperty,Y=RegExp("^"+G.call(W).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z(e){return!(!D(e)||(t=e,B&&B in t))&&(N(e)?Y:j).test(F(e));var t}function $(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return z(i)?i:void 0}const X=$(_,"Map");const q=$(Object,"create");var Q=Object.prototype.hasOwnProperty;var Z=Object.prototype.hasOwnProperty;function J(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}function ee(e,t){var i,n,r=e.__data__;return("string"==(n=typeof(i=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?r["string"==typeof t?"string":"hash"]:r.map}function te(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}J.prototype.clear=function(){this.__data__=q?q(null):{},this.size=0},J.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},J.prototype.get=function(e){var t=this.__data__;if(q){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return Q.call(t,e)?t[e]:void 0},J.prototype.has=function(e){var t=this.__data__;return q?void 0!==t[e]:Z.call(t,e)},J.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=q&&void 0===t?"__lodash_hash_undefined__":t,this},te.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(X||y),string:new J}},te.prototype.delete=function(e){var t=ee(this,e).delete(e);return this.size-=t?1:0,t},te.prototype.get=function(e){return ee(this,e).get(e)},te.prototype.has=function(e){return ee(this,e).has(e)},te.prototype.set=function(e,t){var i=ee(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function ie(e){var t=this.__data__=new y(e);this.size=t.size}ie.prototype.clear=function(){this.__data__=new y,this.size=0},ie.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},ie.prototype.get=function(e){return this.__data__.get(e)},ie.prototype.has=function(e){return this.__data__.has(e)},ie.prototype.set=function(e,t){var i=this.__data__;if(i instanceof y){var n=i.__data__;if(!X||n.length<199)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new te(n)}return i.set(e,t),this.size=i.size,this};var ne=function(){try{var e=$(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();const re=ne;function oe(e,t,i){"__proto__"==t&&re?re(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var se=Object.prototype.hasOwnProperty;function ae(e,t,i){var n=e[t];se.call(e,t)&&p(n,i)&&(void 0!==i||t in e)||oe(e,t,i)}function le(e,t,i,n){var r=!i;i||(i={});for(var o=-1,s=t.length;++o<s;){var a=t[o],l=n?n(i[a],e[a],a,i,e):void 0;void 0===l&&(l=e[a]),r?oe(i,a,l):ae(i,a,l)}return i}function ue(e){return null!=e&&"object"==typeof e}function ce(e){return ue(e)&&"[object Arguments]"==w(e)}var he=Object.prototype,de=he.hasOwnProperty,pe=he.propertyIsEnumerable,fe=ce(function(){return arguments}())?ce:function(e){return ue(e)&&de.call(e,"callee")&&!pe.call(e,"callee")};const ge=fe;const ye=Array.isArray;var ve="object"==typeof exports&&exports&&!exports.nodeType&&exports,me=ve&&"object"==typeof module&&module&&!module.nodeType&&module,_e=me&&me.exports===ve?_.Buffer:void 0;const Ee=(_e?_e.isBuffer:void 0)||function(){return!1};var Te=9007199254740991,Se=/^(?:0|[1-9]\d*)$/;function be(e,t){var i=typeof e;return!!(t=null==t?Te:t)&&("number"==i||"symbol"!=i&&Se.test(e))&&e>-1&&e%1==0&&e<t}var ke=9007199254740991;function Ce(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ke}var Ie={};function Ae(e){return function(t){return e(t)}}Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Arguments]"]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object Boolean]"]=Ie["[object DataView]"]=Ie["[object Date]"]=Ie["[object Error]"]=Ie["[object Function]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie["[object Object]"]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object WeakMap]"]=!1;var Pe="object"==typeof exports&&exports&&!exports.nodeType&&exports,we=Pe&&"object"==typeof module&&module&&!module.nodeType&&module,De=we&&we.exports===Pe&&v.process;const Le=function(){try{var e=we&&we.require&&we.require("util").types;return e||De&&De.binding&&De.binding("util")}catch(t){}}();var Re=Le&&Le.isTypedArray;const xe=Re?Ae(Re):function(e){return ue(e)&&Ce(e.length)&&!!Ie[w(e)]};var Oe=Object.prototype.hasOwnProperty;function Ne(e,t){var i=ye(e),n=!i&&ge(e),r=!i&&!n&&Ee(e),o=!i&&!n&&!r&&xe(e),s=i||n||r||o,a=s?function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}(e.length,String):[],l=a.length;for(var u in e)!t&&!Oe.call(e,u)||s&&("length"==u||r&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||be(u,l))||a.push(u);return a}var Me=Object.prototype;function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Me)}function Be(e,t){return function(i){return e(t(i))}}const He=Be(Object.keys,Object);var Fe=Object.prototype.hasOwnProperty;function je(e){return null!=e&&Ce(e.length)&&!N(e)}function Ve(e){return je(e)?Ne(e):function(e){if(!Ue(e))return He(e);var t=[];for(var i in Object(e))Fe.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var Ke=Object.prototype.hasOwnProperty;function Ge(e){if(!D(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=Ue(e),i=[];for(var n in e)("constructor"!=n||!t&&Ke.call(e,n))&&i.push(n);return i}function We(e){return je(e)?Ne(e,!0):Ge(e)}var Ye="object"==typeof exports&&exports&&!exports.nodeType&&exports,ze=Ye&&"object"==typeof module&&module&&!module.nodeType&&module,$e=ze&&ze.exports===Ye?_.Buffer:void 0,Xe=$e?$e.allocUnsafe:void 0;function qe(e,t){if(t)return e.slice();var i=e.length,n=Xe?Xe(i):new e.constructor(i);return e.copy(n),n}function Qe(e,t){var i=-1,n=e.length;for(t||(t=Array(n));++i<n;)t[i]=e[i];return t}function Ze(){return[]}var Je=Object.prototype.propertyIsEnumerable,et=Object.getOwnPropertySymbols;const tt=et?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,n=null==e?0:e.length,r=0,o=[];++i<n;){var s=e[i];t(s,i,e)&&(o[r++]=s)}return o}(et(e),(function(t){return Je.call(e,t)})))}:Ze;function it(e,t){for(var i=-1,n=t.length,r=e.length;++i<n;)e[r+i]=t[i];return e}const nt=Be(Object.getPrototypeOf,Object);const rt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)it(t,tt(e)),e=nt(e);return t}:Ze;function ot(e,t,i){var n=t(e);return ye(e)?n:it(n,i(e))}function st(e){return ot(e,Ve,tt)}function at(e){return ot(e,We,rt)}const lt=$(_,"DataView");const ut=$(_,"Promise");const ct=$(_,"Set");const ht=$(_,"WeakMap");var dt="[object Map]",pt="[object Promise]",ft="[object Set]",gt="[object WeakMap]",yt="[object DataView]",vt=F(lt),mt=F(X),_t=F(ut),Et=F(ct),Tt=F(ht),St=w;(lt&&St(new lt(new ArrayBuffer(1)))!=yt||X&&St(new X)!=dt||ut&&St(ut.resolve())!=pt||ct&&St(new ct)!=ft||ht&&St(new ht)!=gt)&&(St=function(e){var t=w(e),i="[object Object]"==t?e.constructor:void 0,n=i?F(i):"";if(n)switch(n){case vt:return yt;case mt:return dt;case _t:return pt;case Et:return ft;case Tt:return gt}return t});const bt=St;var kt=Object.prototype.hasOwnProperty;const Ct=_.Uint8Array;function It(e){var t=new e.constructor(e.byteLength);return new Ct(t).set(new Ct(e)),t}var At=/\w*$/;var Pt=E?E.prototype:void 0,wt=Pt?Pt.valueOf:void 0;function Dt(e,t){var i=t?It(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}var Lt="[object Boolean]",Rt="[object Date]",xt="[object Map]",Ot="[object Number]",Nt="[object RegExp]",Mt="[object Set]",Ut="[object String]",Bt="[object Symbol]",Ht="[object ArrayBuffer]",Ft="[object DataView]",jt="[object Float32Array]",Vt="[object Float64Array]",Kt="[object Int8Array]",Gt="[object Int16Array]",Wt="[object Int32Array]",Yt="[object Uint8Array]",zt="[object Uint8ClampedArray]",$t="[object Uint16Array]",Xt="[object Uint32Array]";function qt(e,t,i){var n,r,o,s=e.constructor;switch(t){case Ht:return It(e);case Lt:case Rt:return new s(+e);case Ft:return function(e,t){var i=t?It(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,i);case jt:case Vt:case Kt:case Gt:case Wt:case Yt:case zt:case $t:case Xt:return Dt(e,i);case xt:return new s;case Ot:case Ut:return new s(e);case Nt:return(o=new(r=e).constructor(r.source,At.exec(r))).lastIndex=r.lastIndex,o;case Mt:return new s;case Bt:return n=e,wt?Object(wt.call(n)):{}}}var Qt=Object.create;const Zt=function(){function e(){}return function(t){if(!D(t))return{};if(Qt)return Qt(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();function Jt(e){return"function"!=typeof e.constructor||Ue(e)?{}:Zt(nt(e))}var ei=Le&&Le.isMap;const ti=ei?Ae(ei):function(e){return ue(e)&&"[object Map]"==bt(e)};var ii=Le&&Le.isSet;const ni=ii?Ae(ii):function(e){return ue(e)&&"[object Set]"==bt(e)};var ri=1,oi=2,si=4,ai="[object Arguments]",li="[object Function]",ui="[object GeneratorFunction]",ci="[object Object]",hi={};function di(e,t,i,n,r,o){var s,a=t&ri,l=t&oi,u=t&si;if(i&&(s=r?i(e,n,r,o):i(e)),void 0!==s)return s;if(!D(e))return e;var c=ye(e);if(c){if(s=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&kt.call(e,"index")&&(i.index=e.index,i.input=e.input),i}(e),!a)return Qe(e,s)}else{var h=bt(e),d=h==li||h==ui;if(Ee(e))return qe(e,a);if(h==ci||h==ai||d&&!r){if(s=l||d?{}:Jt(e),!a)return l?function(e,t){return le(e,rt(e),t)}(e,function(e,t){return e&&le(t,We(t),e)}(s,e)):function(e,t){return le(e,tt(e),t)}(e,function(e,t){return e&&le(t,Ve(t),e)}(s,e))}else{if(!hi[h])return r?e:{};s=qt(e,h,a)}}o||(o=new ie);var p=o.get(e);if(p)return p;o.set(e,s),ni(e)?e.forEach((function(n){s.add(di(n,t,i,n,e,o))})):ti(e)&&e.forEach((function(n,r){s.set(r,di(n,t,i,r,e,o))}));var f=c?void 0:(u?l?at:st:l?We:Ve)(e);return function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n&&!1!==t(e[i],i,e););}(f||e,(function(n,r){f&&(n=e[r=n]),ae(s,r,di(n,t,i,r,e,o))})),s}hi[ai]=hi["[object Array]"]=hi["[object ArrayBuffer]"]=hi["[object DataView]"]=hi["[object Boolean]"]=hi["[object Date]"]=hi["[object Float32Array]"]=hi["[object Float64Array]"]=hi["[object Int8Array]"]=hi["[object Int16Array]"]=hi["[object Int32Array]"]=hi["[object Map]"]=hi["[object Number]"]=hi[ci]=hi["[object RegExp]"]=hi["[object Set]"]=hi["[object String]"]=hi["[object Symbol]"]=hi["[object Uint8Array]"]=hi["[object Uint8ClampedArray]"]=hi["[object Uint16Array]"]=hi["[object Uint32Array]"]=!0,hi["[object Error]"]=hi[li]=hi["[object WeakMap]"]=!1;var pi;function fi(e){return di(e,5)}function gi(e,t,i){(void 0!==i&&!p(e[t],i)||void 0===i&&!(t in e))&&oe(e,t,i)}const yi=function(e,t,i){for(var n=-1,r=Object(e),o=i(e),s=o.length;s--;){var a=o[pi?s:++n];if(!1===t(r[a],a,r))break}return e};var vi="[object Object]",mi=Function.prototype,_i=Object.prototype,Ei=mi.toString,Ti=_i.hasOwnProperty,Si=Ei.call(Object);function bi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ki(e,t,i,n,r,o,s){var a=bi(e,i),l=bi(t,i),u=s.get(l);if(u)gi(e,i,u);else{var c,h=o?o(a,l,i+"",e,t,s):void 0,d=void 0===h;if(d){var p=ye(l),f=!p&&Ee(l),g=!p&&!f&&xe(l);h=l,p||f||g?ye(a)?h=a:ue(c=a)&&je(c)?h=Qe(a):f?(d=!1,h=qe(l,!0)):g?(d=!1,h=Dt(l,!0)):h=[]:function(e){if(!ue(e)||w(e)!=vi)return!1;var t=nt(e);if(null===t)return!0;var i=Ti.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Ei.call(i)==Si}(l)||ge(l)?(h=a,ge(a)?h=function(e){return le(e,We(e))}(a):D(a)&&!N(a)||(h=Jt(l))):d=!1}d&&(s.set(l,h),r(h,l,n,o,s),s.delete(l)),gi(e,i,h)}}function Ci(e,t,i,n,r){e!==t&&yi(t,(function(o,s){if(r||(r=new ie),D(o))ki(e,t,s,i,Ci,n,r);else{var a=n?n(bi(e,s),o,s+"",e,t,r):void 0;void 0===a&&(a=o),gi(e,s,a)}}),We)}function Ii(e){return e}var Ai=Math.max;var Pi=re?function(e,t){return re(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:Ii;const wi=Pi;var Di=Date.now;var Li,Ri,xi,Oi=(Li=wi,Ri=0,xi=0,function(){var e=Di(),t=16-(e-xi);if(xi=e,t>0){if(++Ri>=800)return arguments[0]}else Ri=0;return Li.apply(void 0,arguments)});const Ni=Oi;function Mi(e,t){return Ni(function(e,t,i){return t=Ai(void 0===t?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=Ai(n.length-t,0),s=Array(o);++r<o;)s[r]=n[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=n[r];return a[t]=i(s),function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}(e,this,a)}}(e,t,Ii),e+"")}function Ui(e){return Mi((function(t,i){var n=-1,r=i.length,o=r>1?i[r-1]:void 0,s=r>2?i[2]:void 0;for(o=e.length>3&&"function"==typeof o?(r--,o):void 0,s&&function(e,t,i){if(!D(i))return!1;var n=typeof t;return!!("number"==n?je(i)&&be(t,i.length):"string"==n&&t in i)&&p(i[t],e)}(i[0],i[1],s)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var a=i[n];a&&e(t,a,n,o)}return t}))}const Bi=Ui((function(e,t,i,n){Ci(e,t,i,n)}));function Hi(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new te;++t<i;)this.add(e[t])}function Fi(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1}function ji(e,t){return e.has(t)}Hi.prototype.add=Hi.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Hi.prototype.has=function(e){return this.__data__.has(e)};var Vi=1,Ki=2;function Gi(e,t,i,n,r,o){var s=i&Vi,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var h=-1,d=!0,p=i&Ki?new Hi:void 0;for(o.set(e,t),o.set(t,e);++h<a;){var f=e[h],g=t[h];if(n)var y=s?n(g,f,h,t,e,o):n(f,g,h,e,t,o);if(void 0!==y){if(y)continue;d=!1;break}if(p){if(!Fi(t,(function(e,t){if(!ji(p,t)&&(f===e||r(f,e,i,n,o)))return p.push(t)}))){d=!1;break}}else if(f!==g&&!r(f,g,i,n,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function Wi(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i}function Yi(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var zi=1,$i=2,Xi="[object Boolean]",qi="[object Date]",Qi="[object Error]",Zi="[object Map]",Ji="[object Number]",en="[object RegExp]",tn="[object Set]",nn="[object String]",rn="[object Symbol]",on="[object ArrayBuffer]",sn="[object DataView]",an=E?E.prototype:void 0,ln=an?an.valueOf:void 0;var un=1,cn=Object.prototype.hasOwnProperty;var hn=1,dn="[object Arguments]",pn="[object Array]",fn="[object Object]",gn=Object.prototype.hasOwnProperty;function yn(e,t,i,n,r,o){var s=ye(e),a=ye(t),l=s?pn:bt(e),u=a?pn:bt(t),c=(l=l==dn?fn:l)==fn,h=(u=u==dn?fn:u)==fn,d=l==u;if(d&&Ee(e)){if(!Ee(t))return!1;s=!0,c=!1}if(d&&!c)return o||(o=new ie),s||xe(e)?Gi(e,t,i,n,r,o):function(e,t,i,n,r,o,s){switch(i){case sn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case on:return!(e.byteLength!=t.byteLength||!o(new Ct(e),new Ct(t)));case Xi:case qi:case Ji:return p(+e,+t);case Qi:return e.name==t.name&&e.message==t.message;case en:case nn:return e==t+"";case Zi:var a=Wi;case tn:var l=n&zi;if(a||(a=Yi),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;n|=$i,s.set(e,t);var c=Gi(a(e),a(t),n,r,o,s);return s.delete(e),c;case rn:if(ln)return ln.call(e)==ln.call(t)}return!1}(e,t,l,i,n,r,o);if(!(i&hn)){var f=c&&gn.call(e,"__wrapped__"),g=h&&gn.call(t,"__wrapped__");if(f||g){var y=f?e.value():e,v=g?t.value():t;return o||(o=new ie),r(y,v,i,n,o)}}return!!d&&(o||(o=new ie),function(e,t,i,n,r,o){var s=i&un,a=st(e),l=a.length;if(l!=st(t).length&&!s)return!1;for(var u=l;u--;){var c=a[u];if(!(s?c in t:cn.call(t,c)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=s;++u<l;){var g=e[c=a[u]],y=t[c];if(n)var v=s?n(y,g,c,t,e,o):n(g,y,c,e,t,o);if(!(void 0===v?g===y||r(g,y,i,n,o):v)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var m=e.constructor,_=t.constructor;m==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(e),o.delete(t),p}(e,t,i,n,r,o))}function vn(e,t,i,n,r){return e===t||(null==e||null==t||!ue(e)&&!ue(t)?e!=e&&t!=t:yn(e,t,i,n,vn,r))}var mn=1,_n=2;function En(e){return e==e&&!D(e)}function Tn(e,t){return function(i){return null!=i&&(i[e]===t&&(void 0!==t||e in Object(i)))}}function Sn(e){var t=function(e){for(var t=Ve(e),i=t.length;i--;){var n=t[i],r=e[n];t[i]=[n,r,En(r)]}return t}(e);return 1==t.length&&t[0][2]?Tn(t[0][0],t[0][1]):function(i){return i===e||function(e,t,i,n){var r=i.length,o=r,s=!n;if(null==e)return!o;for(e=Object(e);r--;){var a=i[r];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++r<o;){var l=(a=i[r])[0],u=e[l],c=a[1];if(s&&a[2]){if(void 0===u&&!(l in e))return!1}else{var h=new ie;if(n)var d=n(u,c,l,e,t,h);if(!(void 0===d?vn(c,u,mn|_n,n,h):d))return!1}}return!0}(i,e,t)}}var bn="[object Symbol]";function kn(e){return"symbol"==typeof e||ue(e)&&w(e)==bn}var Cn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,In=/^\w*$/;function An(e,t){if(ye(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!kn(e))||(In.test(e)||!Cn.test(e)||null!=t&&e in Object(t))}var Pn="Expected a function";function wn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Pn);var i=function(){var n=arguments,r=t?t.apply(this,n):n[0],o=i.cache;if(o.has(r))return o.get(r);var s=e.apply(this,n);return i.cache=o.set(r,s)||o,s};return i.cache=new(wn.Cache||te),i}wn.Cache=te;var Dn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ln=/\\(\\)?/g,Rn=function(e){var t=wn(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Dn,(function(e,i,n,r){t.push(n?r.replace(Ln,"$1"):i||e)})),t}));const xn=Rn;var On=1/0,Nn=E?E.prototype:void 0,Mn=Nn?Nn.toString:void 0;function Un(e){if("string"==typeof e)return e;if(ye(e))return function(e,t){for(var i=-1,n=null==e?0:e.length,r=Array(n);++i<n;)r[i]=t(e[i],i,e);return r}(e,Un)+"";if(kn(e))return Mn?Mn.call(e):"";var t=e+"";return"0"==t&&1/e==-On?"-0":t}function Bn(e,t){return ye(e)?e:An(e,t)?[e]:xn(function(e){return null==e?"":Un(e)}(e))}var Hn=1/0;function Fn(e){if("string"==typeof e||kn(e))return e;var t=e+"";return"0"==t&&1/e==-Hn?"-0":t}function jn(e,t){for(var i=0,n=(t=Bn(t,e)).length;null!=e&&i<n;)e=e[Fn(t[i++])];return i&&i==n?e:void 0}function Vn(e,t,i){var n=null==e?void 0:jn(e,t);return void 0===n?i:n}function Kn(e,t){return null!=e&&t in Object(e)}function Gn(e,t){return null!=e&&function(e,t,i){for(var n=-1,r=(t=Bn(t,e)).length,o=!1;++n<r;){var s=Fn(t[n]);if(!(o=null!=e&&i(e,s)))break;e=e[s]}return o||++n!=r?o:!!(r=null==e?0:e.length)&&Ce(r)&&be(s,r)&&(ye(e)||ge(e))}(e,t,Kn)}var Wn=1,Yn=2;function zn(e){return An(e)?(t=Fn(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return jn(t,e)}}(e);var t}function $n(e){return"function"==typeof e?e:null==e?Ii:"object"==typeof e?ye(e)?(t=e[0],i=e[1],An(t)&&En(i)?Tn(Fn(t),i):function(e){var n=Vn(e,t);return void 0===n&&n===i?Gn(e,t):vn(i,n,Wn|Yn)}):Sn(e):zn(e);var t,i}function Xn(e){return e!=e}function qn(e,t){return!!(null==e?0:e.length)&&function(e,t,i){return t==t?function(e,t,i){for(var n=i-1,r=e.length;++n<r;)if(e[n]===t)return n;return-1}(e,t,i):function(e,t,i,n){for(var r=e.length,o=i+(n?1:-1);n?o--:++o<r;)if(t(e[o],o,e))return o;return-1}(e,Xn,i)}(e,t,0)>-1}function Qn(e,t,i){for(var n=-1,r=null==e?0:e.length;++n<r;)if(i(t,e[n]))return!0;return!1}const Zn=ct&&1/Yi(new ct([,-0]))[1]==1/0?function(e){return new ct(e)}:function(){};var Jn=200;function er(e,t){return e&&e.length?function(e,t,i){var n=-1,r=qn,o=e.length,s=!0,a=[],l=a;if(i)s=!1,r=Qn;else if(o>=Jn){var u=t?null:Zn(e);if(u)return Yi(u);s=!1,r=ji,l=new Hi}else l=t?[]:a;e:for(;++n<o;){var c=e[n],h=t?t(c):c;if(c=i||0!==c?c:0,s&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue e;t&&l.push(h),a.push(c)}else r(l,h,i)||(l!==a&&l.push(h),a.push(c))}return a}(e,$n(t)):[]}const tr={H264:"h264",H265:"h265",H266:"h266",AAC:"aac",MP3:"mp3",OPUS:"opus",UNKNOWN:"unknown"},ir={[tr.H265]:'video/mp4; codecs="hev1.1.6.L120.90"',[tr.H264]:'video/mp4; codecs="avc1.42c01e"'};var nr=(e=>(e.MP4="mp4",e.DASH="dash",e.HLS="hls",e))(nr||{}),rr=(e=>(e.M4A="m4a",e.MP4="mp4",e.MP3="mp3",e.DASH="dash",e.HLS="hls",e.OGG="ogg",e))(rr||{}),or=(e=>(e.DRM_ENCRYPT="drm_encrypt",e.PRIVATE_ENCRYPT="private_encrypt",e.PRIVATE_ENCRYPT_UPGRADE="private_encrypt_upgrade",e.STANDARD_ENCRYPT="standard_encrypt",e))(or||{});class sr extends Error{constructor(e,t){super(t),this.name="HlsControlError",this.code=e,Object.setPrototypeOf(this,sr.prototype)}}var ar="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ur=function(){let e,t=null;function i(e){return!!e&&("object"==typeof e||"function"==typeof e)}function n(e){if(null!==e&&!i(e))throw new TypeError("Object prototype may only be an Object or null: "+e)}const r=Object,o=Boolean(r.create)||!({__proto__:null}instanceof r),s=r.create||(o?function(e){return n(e),{__proto__:e}}:function(e){if(n(e),null===e)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var t=function(){};return t.prototype=e,new t}),a=function(){return null},l=r.getPrototypeOf||([].__proto__===Array.prototype?function(e){const t=e.__proto__;return i(t)?t:null}:a);return e=function(u,c){if(void 0===(this&&this instanceof e?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!i(u)||!i(c))throw new TypeError("Cannot create proxy with a non-object as target or handler");let h=function(){};t=function(){u=null,h=function(e){throw new TypeError(`Cannot perform '${e}' on a proxy that has been revoked`)}},setTimeout((function(){t=null}),0);const d=c;c={get:null,set:null,apply:null,construct:null};for(let e in d){if(!(e in c))throw new TypeError(`Proxy polyfill does not support trap '${e}'`);c[e]=d[e]}"function"==typeof d&&(c.apply=d.apply.bind(d));const p=l(u);let f,g=!1,y=!1;"function"==typeof u?(f=function(){const e=this&&this.constructor===f,t=Array.prototype.slice.call(arguments);if(h(e?"construct":"apply"),e&&c.construct)return c.construct.call(this,u,t);if(!e&&c.apply)return c.apply(u,this,t);if(e){t.unshift(u);return new(u.bind.apply(u,t))}return u.apply(this,t)},g=!0):u instanceof Array?(f=[],y=!0):f=o||null!==p?s(p):{};const v=c.get?function(e){return h("get"),c.get(this,e,f)}:function(e){return h("get"),this[e]},m=c.set?function(e,t){h("set"),c.set(this,e,t,f)}:function(e,t){h("set"),this[e]=t},_=r.getOwnPropertyNames(u),E={};_.forEach((function(e){if((g||y)&&e in f)return;const t=r.getOwnPropertyDescriptor(u,e),i={enumerable:Boolean(t.enumerable),get:v.bind(u,e),set:m.bind(u,e)};r.defineProperty(f,e,i),E[e]=!0}));let T=!0;if(g||y){const e=r.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return n(t),e.__proto__=t,e}:a);p&&e(f,p)||(T=!1)}if(c.get||!T)for(let e in u)E[e]||r.defineProperty(f,e,{get:v.bind(u,e)});return r.seal(u),r.seal(f),f},e.revocable=function(i,n){return{proxy:new e(i,n),revoke:t}},e};const cr=lr(ur)();const hr=new class{constructor(){this.subscribeId=0,this.watcherMap=new Map}observe(e){const t=new cr(e,{set:(e,i,n)=>{const r=Reflect.get(e,i);Reflect.set(e,i,n);const o=this.watcherMap.get(t);return o&&(this.flushCallback(o),this.flushPropertyCallback(o,i,r,n)),!0}});return this.watcherMap.set(t,{pending:!1,queue:[],property:{}}),t}subscribe(e,t){const i=this.watcherMap.get(e);if(!i)return;this.subscribeId++;return i.queue.push({id:this.subscribeId,callback:t}),this.subscribeId}unsubscribe(e,t){const i=this.watcherMap.get(e);if(!i)return;const n=i.queue,r=n.findIndex((e=>e.id===t));void 0!==r&&r>-1&&n.splice(r,1)}subscribeProperty(e,t,i){const n=this.watcherMap.get(e);if(n){this.subscribeId++,n.property[t]||(n.property[t]={pending:!1,timer:0,pre:null,queue:[]});return n.property[t].queue.push({id:this.subscribeId,callback:i}),this.subscribeId}}unsubscribeProperty(e,t,i){const n=this.watcherMap.get(e);if(n){const e=n.property[t];if(e){const t=e.queue,n=t.findIndex((e=>e.id===i));void 0!==n&&n>-1&&t.splice(n,1)}}}flushCallback(e){e.pending||(e.pending=!0,setTimeout((()=>{e.queue.forEach((e=>e.callback())),e.pending=!1}),0))}flushPropertyCallback(e,t,i,n){const r=e.property[t];r&&(clearTimeout(r.timer),!1===r.pending&&(r.pending=!0,r.pre=i),r.timer=setTimeout((()=>{r.queue.forEach((e=>e.callback(r.pre,n))),r.pending=!1}),0))}};function dr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function pr(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?dr(Object(i),!0).forEach((function(t){mr(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):dr(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function fr(e){return(fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yr(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Pr(n.key),n)}}function vr(e,t,i){return t&&yr(e.prototype,t),i&&yr(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function mr(e,t,i){return(t=Pr(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tr(e,t)}function Er(e){return(Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tr(e,t){return(Tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Sr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function br(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Sr(e)}function kr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=Er(e);if(t){var r=Er(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return br(this,i)}}function Cr(){return Cr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Er(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}},Cr.apply(this,arguments)}function Ir(e){return function(e){if(Array.isArray(e))return Ar(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ar(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Ar(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ar(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function Pr(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var wr={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,o||e,s),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,s=new Array(o);r<o;r++)s[r]=n[r].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,r,o,s){var a=i?i+e:e;if(!this._events[a])return!1;var l,u,c=this._events[a],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,o),!0;case 6:return c.fn.call(c.context,t,n,r,o,s),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},a.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,n,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||s(this,o);else{for(var l=0,u=[],c=a.length;l<c;l++)(a[l].fn!==t||r&&!a[l].once||n&&a[l].context!==n)&&u.push(a[l]);u.length?this._events[o]=1===u.length?u[0]:u:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}(wr);var Dr=wr.exports;const Lr=lr(Dr);var Rr="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,xr={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Or="%c[xgplayer]",Nr={config:{debug:Rr?3:0},logInfo:function(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];this.config.debug>=3&&(t=console).log.apply(t,[Or,xr.info,e].concat(n))},logWarn:function(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];this.config.debug>=1&&(t=console).warn.apply(t,[Or,xr.warn,e].concat(n))},logError:function(e){var t;if(!(this.config.debug<1)){for(var i=this.config.debug>=2?"trace":"error",n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console)[i].apply(t,[Or,xr.error,e].concat(r))}}};var Mr=function(){function e(t){gr(this,e),this.bufferedList=t}return vr(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}(),Ur={};function Br(e){var t=fr(e);return null!==e&&("object"===t||"function"===t)}function Hr(e,t,i){var n,r,o,s,a,l,u=0,c=!1,h=!1,d=!0,p=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var i=n,o=r;return n=r=void 0,u=t,s=e.apply(o,i)}function g(e,t){return p?(window.cancelAnimationFrame(a),window.requestAnimationFrame(e)):setTimeout(e,t)}function y(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-u>=o}function v(){var e=Date.now();if(y(e))return m(e);a=g(v,function(e){var i=e-u,n=t-(e-l);return h?Math.min(n,o-i):n}(e))}function m(e){return a=void 0,d&&n?f(e):(n=r=void 0,s)}function _(){for(var e=Date.now(),i=y(e),o=arguments.length,d=new Array(o),p=0;p<o;p++)d[p]=arguments[p];if(n=d,r=this,l=e,i){if(void 0===a)return function(e){return u=e,a=g(v,t),c?f(e):s}(l);if(h)return a=g(v,t),f(l)}return void 0===a&&(a=g(v,t)),s}return t=+t||0,Br(i)&&(c=!!i.leading,o=(h="maxWait"in i)?Math.max(+i.maxWait||0,t):o,d="trailing"in i?!!i.trailing:d),_.cancel=function(){void 0!==a&&function(e){if(p)return window.cancelAnimationFrame(e);clearTimeout(e)}(a),u=0,n=l=r=a=void 0},_.flush=function(){return void 0===a?s:m(Date.now())},_.pending=function(){return void 0!==a},_}Ur.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(e);return r.className=n,r.innerHTML=t,Object.keys(i).forEach((function(t){var n=t,o=i[t];"video"===e||"audio"===e||"live-video"===e?o&&r.setAttribute(n,o):r.setAttribute(n,o)})),r},Ur.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var r=n.children;return n=null,r.length>0?(r=r[0],i&&Ur.addClass(r,i),t&&Object.keys(t).forEach((function(e){r.setAttribute(e,t[e])})),r):null}catch(o){return Nr.logError("util.createDomFromHtml",o),null}},Ur.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(n){var i=e.className&&"object"===fr(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},Ur.addClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)}))}catch(i){Ur.hasClass(e,t)||(e.className&&"object"===fr(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},Ur.removeClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.remove(t)}))}catch(i){Ur.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===fr(e.className)?e.setAttribute("class",e.getAttribute("class").replace(i," ")):e.className=e.className.replace(i," ")}))}},Ur.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){Ur.hasClass(e,t)?Ur.removeClass(e,t):Ur.addClass(e,t)}))},Ur.classNames=function(){for(var e=arguments,t=[],i=function(i){"String"===Ur.typeOf(e[i])?t.push(e[i]):"Object"===Ur.typeOf(e[i])&&Object.keys(e[i]).map((function(n){e[i][n]&&t.push(n)}))},n=0;n<arguments.length;n++)i(n);return t.join(" ")},Ur.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,i=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(i)}catch(n){Nr.logError("util.findDom",n),0===i.indexOf("#")&&(e=t.getElementById(i.slice(1)))}return e},Ur.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},Ur.padStart=function(e,t,i){for(var n=String(i),r=t>>0,o=Math.ceil(r/n.length),s=[],a=String(e);o--;)s.push(n);return s.join("").substring(0,r-a.length)+a},Ur.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=Ur.padStart(Math.floor(e/3600),2,0),i=Ur.padStart(Math.floor((e-3600*t)/60),2,0),n=Ur.padStart(Math.floor(e-3600*t-60*i),2,0);return("00"===t?[i,n]:[t,i,n]).join(":")},Ur.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},Ur.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Ur.deepCopy=function(e,t){if("Object"===Ur.typeOf(t)&&"Object"===Ur.typeOf(e))return Object.keys(t).forEach((function(i){"Object"!==Ur.typeOf(t[i])||t[i]instanceof Node?"Array"===Ur.typeOf(t[i])?e[i]="Array"===Ur.typeOf(e[i])?e[i].concat(t[i]):t[i]:e[i]=t[i]:void 0===e[i]||void 0===e[i]?e[i]=t[i]:Ur.deepCopy(e[i],t[i])})),e},Ur.deepMerge=function(e,t){return Object.keys(t).map((function(i){var n;"Array"===Ur.typeOf(t[i])&&"Array"===Ur.typeOf(e[i])?"Array"===Ur.typeOf(e[i])&&(n=e[i]).push.apply(n,Ir(t[i])):Ur.typeOf(e[i])!==Ur.typeOf(t[i])||null===e[i]||"Object"!==Ur.typeOf(e[i])||t[i]instanceof window.Node?null!==t[i]&&(e[i]=t[i]):Ur.deepMerge(e[i],t[i])})),e},Ur.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var i=document.createElement("a");return i.href=t.replace(/url\("|"\)/g,""),i.href},Ur.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},Ur.setInterval=function(e,t,i,n){e._interval[t]||(e._interval[t]=window.setInterval(i.bind(e),n))},Ur.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},Ur.setTimeout=function(e,t,i){e._timers||(e._timers=[]);var n=setTimeout((function(){t(),Ur.clearTimeout(e,n)}),i);return e._timers.push(n),n},Ur.clearTimeout=function(e,t){var i=e._timers;if("Array"===Ur.typeOf(i)){for(var n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),clearTimeout(t);break}}else clearTimeout(t)},Ur.clearAllTimers=function(e){var t=e._timers;"Array"===Ur.typeOf(t)&&(t.map((function(e){clearTimeout(e)})),e._timerIds=[])},Ur.createImgBtn=function(e,t,i,n){var r,o,s,a=Ur.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(a.style.backgroundImage='url("'.concat(t,'")'),i&&n)&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){return!(i.indexOf(e)>-1&&n.indexOf(e)>-1)||(r=parseFloat(i.slice(0,i.indexOf(e)).trim()),o=parseFloat(n.slice(0,n.indexOf(e)).trim()),s=e,!1)})),a.style.width="".concat(r).concat(s),a.style.height="".concat(o).concat(s),a.style.backgroundSize="".concat(r).concat(s," ").concat(o).concat(s),a.style.margin="start"===e?"-".concat(o/2).concat(s," auto auto -").concat(r/2).concat(s):"auto 5px auto 5px");return a},Ur.Hex2RGBA=function(e,t){var i=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var n="#";e.replace(/[0-9A-F]/gi,(function(e){n+=e+e})),e=n}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){i.push(parseInt(e,16))})),"rgba(".concat(i.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},Ur.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},Ur.checkIsFunction=function(e){return e&&"function"==typeof e},Ur.checkIsObject=function(e){return null!==e&&"object"===fr(e)},Ur.hide=function(e){e.style.display="none"},Ur.show=function(e,t){e.style.display=t||"block"},Ur.isUndefined=function(e){if(null==e)return!0},Ur.isNotNull=function(e){return!(null==e)},Ur.setStyleFromCsstext=function(e,t){t&&("String"===Ur.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var i=t.split(":");i.length>1&&(e.style[i[0]]=i[1])}})):Object.keys(t).map((function(i){e.style[i]=t[i]})))},Ur.filterStyleFromText=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],i=e.style.cssText;if(!i)return{};var n=i.replace(/\s+/g,"").split(";"),r={},o={};return n.map((function(e){if(e){var i=e.split(":");i.length>1&&(!function(e,t){for(var i=0,n=t.length;i<n;i++)if(e.indexOf(t[i])>-1)return!0;return!1}(i[0],t)?o[i[0]]=i[1]:r[i[0]]=i[1])}})),e.setAttribute("style",""),Object.keys(o).map((function(t){e.style[t]=o[t]})),r},Ur.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var i=t.replace(/\s+/g,"").split(";"),n={};return i.map((function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},Ur.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var n=new window.Image;n.onload=function(e){n=null,t&&t(e)},n.onerror=function(e){n=null,i&&i(e)},n.src=e}},Ur.stopPropagation=function(e){e&&e.stopPropagation()},Ur.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Ur.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},Ur.checkTouchSupport=function(){return"ontouchstart"in window},Ur.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=[],n=0;n<e.length;n++)i.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});i.sort((function(e,t){var i=e.start-t.start;return i||t.end-e.end}));var r=[];if(t)for(var o=0;o<i.length;o++){var s=r.length;if(s){var a=r[s-1].end;i[o].start-a<t?i[o].end>a&&(r[s-1].end=i[o].end):r.push(i[o])}else r.push(i[o])}else r=i;return new Mr(r)},Ur.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},Ur.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},Ur.getHostFromUrl=function(e){if("String"!==Ur.typeOf(e))return"";var t=e.split("/"),i="";return t.length>3&&t[2]&&(i=t[2]),i},Ur.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},Ur.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},Ur.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},Ur.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch(i){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)}))},Ur.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},Ur.adjustTimeByDuration=function(e,t,i){return t&&e&&(e>t||i&&e<t)?t:e},Ur.createPositionBar=function(e,t){var i=Ur.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(i),i},Ur.getTransformStyle=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(i).forEach((function(e){var n=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),r="".concat(e,"(").concat(i[e],")");n.test(t)?(n.lastIndex=-1,t=t.replace(n,r)):t+="".concat(r," ")})),t},Ur.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},Ur.getIndexByTime=function(e,t){var i=t.length,n=-1;if(i<1)return n;if(e<=t[0].end||i<2)n=0;else if(e>t[i-1].end)n=i-1;else for(var r=1;r<i;r++)if(e>t[r-1].end&&e<=t[r].end){n=r;break}return n},Ur.getOffsetCurrentTime=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=i>=0&&i<t.length?i:Ur.getIndexByTime(e,t))<0)return-1;var r=t.length,o=t[n],s=o.start,a=o.end,l=o.cTime,u=o.offset;return e<s?l:e>=s&&e<=a?e-u:e>a&&n>=r-1?a:-1},Ur.getCurrentTimeByOffset=function(e,t){var i=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){i=n;break}if(-1!==i){var r=t[i].start;return i-1<0?r+e:r+(e-t[i-1].duration)}return e};var Fr=/(Android)\s([\d.]+)/,jr=/(Version)\/([\d.]+)/,Vr=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],Kr={get device(){return Kr.os.isPc?"pc":"mobile"},get browser(){if("undefined"==typeof navigator)return"";var e=navigator.userAgent.toLowerCase(),t={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(t).filter((function(i){return t[i].test(e)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),i=/(?:SymbianOS)/.test(e)||t,n=/(?:Tizen)/gi.test(e),r=/(?:Web0S)/gi.test(e),o=/(?:Android)/.test(e),s=/(?:Firefox)/.test(e),a=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,l=a||o&&!/(?:Mobile)/.test(e)||s&&/(?:Tablet)/.test(e),u=/(?:iPhone)/.test(e)&&!l;return{isTablet:l,isPhone:u,isIpad:a,isIos:u||a,isAndroid:o,isPc:!(u||o||i||l),isSymbian:i,isWindowsPhone:t,isFireFox:s,isTizen:n,isWebOS:r}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",i=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?jr:Fr)?t.exec(e):[];if(i&&i.length>=3){var n=i[2].split(".");return n.length>0?parseInt(n[0]):0}return 0},get isWeixin(){if("undefined"==typeof navigator)return!1;return!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&Vr.map((function(i){"probably"===t.canPlayType('video/mp4; codecs="'.concat(i,'"'))&&(e.isSupport=!0,e.mime+="||".concat(i))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var i=e.video||{},n=e.audio||{};try{var r=MediaSource.isTypeSupported(i.contentType),o=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:r&&o,smooth:!1,powerEfficient:!1})}catch(s){return Promise.resolve(t)}}},Gr="3.0.23-rc.3",Wr={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},Yr={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},zr=vr((function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};gr(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var r=i.mediaError?i.mediaError:t.media.error||{},o=t.duration,s=t.currentTime,a=t.ended,l=t.src,u=t.currentSrc,c=t.media,h=c.readyState,d=c.networkState,p=i.errorCode||r.code;Yr[p]&&(p=Yr[p]);var f={playerVersion:Gr,currentTime:s,duration:o,ended:a,readyState:h,networkState:d,src:l||u,errorType:i.errorType,errorCode:p,message:i.errorMessage||r.message,mediaError:r,originError:i.originError?i.originError.stack:"",host:Ur.getHostFromUrl(l||u)};return i.ext&&Object.keys(i.ext).map((function(e){f[e]=i.ext[e]})),f}if(arguments.length>1){for(var g={playerVersion:Gr,domain:document.domain},y=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v<arguments.length;v++)g[y[v]]=arguments[v];return g.ex=n?(n[arguments[0]]||{}).msg:"",g}})),$r="play",Xr="playing",qr="ended",Qr="pause",Zr="error",Jr="seeking",eo="seeked",to="timeupdate",io="waiting",no="canplay",ro="durationchange",oo="volumechange",so="loadeddata",ao="ratechange",lo="progress",uo="loadstart",co="emptied",ho="focus",po="blur",fo="ready",go="urlNull",yo="autoplay_started",vo="autoplay_was_prevented",mo="complete",_o="replay",Eo="destroy",To="urlchange",So="download_speed_change",bo="leaveplayer",ko="enterplayer",Co="loading",Io="fullscreen_change",Ao="cssFullscreen_change",Po="mini_state_change",wo="definition_change",Do="after_definition_change",Lo="video_resize",Ro="pip_change",xo="rotate",Oo="screenShot",No="playnext",Mo="shortcut",Uo="xglog",Bo="user_action",Ho="reset",Fo="source_error",jo="source_success",Vo=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],Ko={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},Go="fps_stuck";const Wo=Object.freeze(Object.defineProperty({__proto__:null,ABORT:"abort",AFTER_DEFINITION_CHANGE:Do,AUTOPLAY_PREVENTED:vo,AUTOPLAY_STARTED:yo,BEFORE_DEFINITION_CHANGE:"before_definition_change",BUFFER_CHANGE:"bufferedChange",CANPLAY:no,CANPLAY_THROUGH:"canplaythrough",COMPLETE:mo,CSS_FULLSCREEN_CHANGE:Ao,DEFINITION_CHANGE:wo,DESTROY:Eo,DOWNLOAD_SPEED_CHANGE:So,DURATION_CHANGE:ro,EMPTIED:co,ENDED:qr,ENTER_PLAYER:ko,ERROR:Zr,FPS_STUCK:Go,FULLSCREEN_CHANGE:Io,LEAVE_PLAYER:bo,LOADED_DATA:so,LOADED_METADATA:"loadedmetadata",LOADING:Co,LOAD_START:uo,MINI_STATE_CHANGE:Po,PAUSE:Qr,PIP_CHANGE:Ro,PLAY:$r,PLAYER_BLUR:po,PLAYER_FOCUS:ho,PLAYING:Xr,PLAYNEXT:No,PROGRESS:lo,RATE_CHANGE:ao,READY:fo,REPLAY:_o,RESET:Ho,RETRY:"retry",ROTATE:xo,SCREEN_SHOT:Oo,SEEKED:eo,SEEKING:Jr,SEI_PARSED:"SEI_PARSED",SHORTCUT:Mo,SOURCE_ERROR:Fo,SOURCE_SUCCESS:jo,STALLED:"stalled",STATS_EVENTS:Ko,SUSPEND:"suspend",SWITCH_SUBTITLE:"switch_subtitle",TIME_UPDATE:to,URL_CHANGE:To,URL_NULL:go,USER_ACTION:Bo,VIDEO_EVENTS:Vo,VIDEO_RESIZE:Lo,VOLUME_CHANGE:oo,WAITING:io,XGLOG:Uo},Symbol.toStringTag,{value:"Module"}));function Yo(e,t){this&&this.emit&&("error"===e?this.errorHandler(e,t.error):this.emit(e,t))}var zo=function(e){_r(i,e);var t=kr(i);function i(e){var n;gr(this,i),(n=t.call(this,e))._hasStart=!1,n._currentTime=0,n._duration=0,n._internalOp={},n._lastMuted=!1,n.vtype="MP4",n._rate=-1,n.mediaConfig=Object.assign({},{controls:!1,autoplay:e.autoplay,playsinline:e.playsinline,"x5-playsinline":e.playsinline,"webkit-playsinline":e.playsinline,"x5-video-player-fullscreen":e["x5-video-player-fullscreen"]||e.x5VideoPlayerFullscreen,"x5-video-orientation":e["x5-video-orientation"]||e.x5VideoOrientation,airplay:e.airplay,"webkit-airplay":e.airplay,tabindex:0|e.tabindex,mediaType:e.mediaType||"video","data-index":-1},e.videoConfig,e.videoAttributes);var r=e["x5-video-player-type"]||e.x5VideoPlayerType;return Kr.isWeixin&&Kr.os.isAndroid&&r&&(n.mediaConfig["x5-video-player-type"]=r,delete n.mediaConfig.playsinline,delete n.mediaConfig["webkit-playsinline"],delete n.mediaConfig["x5-playsinline"]),e.loop&&(n.mediaConfig.loop="loop"),e.autoplayMuted&&!Object.prototype.hasOwnProperty.call(n.mediaConfig,"muted")&&(n.mediaConfig.muted=!0),n.media=e.mediaEl instanceof HTMLMediaElement?e.mediaEl:"function"==typeof e.mediaEl?e.mediaEl(n.mediaConfig):Ur.createDom(n.mediaConfig.mediaType,"",n.mediaConfig,""),e.defaultPlaybackRate&&(n.media.defaultPlaybackRate=n.media.playbackRate=e.defaultPlaybackRate),"Number"===Ur.typeOf(e.volume)&&(n.volume=e.volume),e.autoplayMuted&&(n.media.muted=!0,n._lastMuted=!0),e.autoplay&&(n.media.autoplay=!0),e.playsinline&&(n.media.playsinline=!0),n._interval={},n.mediaEventMiddleware={},n.attachVideoEvents(),n}return vr(i,[{key:"setEventsMiddleware",value:function(e){var t=this;Object.keys(e).map((function(i){t.mediaEventMiddleware[i]=e[i]}))}},{key:"removeEventsMiddleware",value:function(e){var t=this;Object.keys(e).map((function(e){delete t.mediaEventMiddleware[e]}))}},{key:"attachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=Vo.map((function(t){var i="on".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));return"function"==typeof e[i]&&e.on(t,e[i]),mr({},t,function(e,t){return function(i,n){var r={player:t,eventName:e,originalEvent:i,detail:i.detail||{},timeStamp:i.timeStamp,currentTime:t.currentTime,duration:t.duration,paused:t.paused,ended:t.ended,isInternalOp:!!t._internalOp[i.type],muted:t.muted,volume:t.volume,host:Ur.getHostFromUrl(t.currentSrc),vtype:t.vtype};if(t.removeInnerOP(i.type),"timeupdate"===e&&(t._currentTime=t.media&&t.media.currentTime),"ratechange"===e){var o=t.media?t.media.playbackRate:0;if(o&&t._rate===o)return;t._rate=t.media&&t.media.playbackRate}if("durationchange"===e&&(t._duration=t.media.duration),"volumechange"===e&&(r.isMutedChange=t._lastMuted!==t.muted,t._lastMuted=t.muted),"error"===e&&(r.error=n||t.video.error),t.mediaEventMiddleware[e]){var s=Yo.bind(t,e,r);try{t.mediaEventMiddleware[e].call(t,r,s)}catch(a){throw Yo.call(t,e,r),a}}else Yo.call(t,e,r)}}(t,e))}))),this._evHandlers.forEach((function(e){var i=Object.keys(e)[0];t.addEventListener(i,e[i],!1)}))}},{key:"detachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers.forEach((function(e){var i=Object.keys(e)[0];t.removeEventListener(i,e[i],!1)})),this._evHandlers.forEach((function(t){var i=Object.keys(t)[0],n="on".concat(i.charAt(0).toUpperCase()).concat(i.slice(1));"function"==typeof e[n]&&e.off(i,e[n])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var i=this;e.removeAttribute("src"),e.load(),t.forEach((function(e,t){i.media.appendChild(Ur.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}));var n=e.children;if(n){this._videoSourceCount=n.length,this._videoSourceIndex=n.length,this._vLoadeddata=function(e){i.emit(jo,{src:e.target.currentSrc,host:Ur.getHostFromUrl(e.target.currentSrc)})};for(var r=null,o=0;o<this._evHandlers.length;o++)if("error"===Object.keys(this._evHandlers[o])[0]){r=this._evHandlers[o];break}!this._sourceError&&(this._sourceError=function(e){var t=parseInt(e.target.getAttribute("data-index"),10);if(i._videoSourceIndex--,0===i._videoSourceIndex||t>=i._videoSourceCount){var n={code:4,message:"sources_load_error"};r?r.error(e,n):i.errorHandler("error",n)}var o=Wr[4];i.emit(Fo,new zr(i,{errorType:o,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var s=0;s<n.length;s++)n[s].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var t=e.children;if(t&&0!==t.length&&this._sourceError){for(var i=0;i<t.length;i++)t[i].removeEventListener("error",this._sourceError);for(;t.length>0;)e.removeChild(t[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.media&&(this.media.error||t)){var i=this.media.error||t,n=i.code?Wr[i.code]:"other";i.message;this.media.currentSrc||this.media.srcObject||(i={code:6,message:"empty_src"}),this.emit(e,new zr(this,{errorType:n,errorCode:i.code,errorMessage:i.message||"",mediaError:i}))}}},{key:"destroy",value:function(){for(var e in this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){return this.media?this.media.play():null}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return!!this.media&&this.media.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0];if(!this.media)return t;e||(e=this.media.buffered);var i=this.media.currentTime;if(e)for(var n=0,r=e.length;n<r&&(t[0]=e.start(n),t[1]=e.end(n),!(t[0]<=i&&i<=t[1]));n++);return t[0]-i<=0&&i-t[1]<=0?t:[0,0]}},{key:"autoplay",get:function(){return!!this.media&&this.media.autoplay},set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?Ur.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var t=this.media.buffered;if(!t||0===t.length)return e;for(var i=0;i<t.length;i++)if((t.start(i)<=this.currentTime||t.start(i)<.1)&&t.end(i)>=this.currentTime)return{start:t.start(i),end:t.end(i)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){if(!this.media.error)return"";return["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit(To,e),this.emit(io),this._currentTime=0,this._duration=0,Ur.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===Ur.typeOf(e)?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()))}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e!==1/0&&this.media&&(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=Cr(Er(i.prototype),"emit",this)).call.apply(n,[this,e,t].concat(o))}},{key:"on",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=Cr(Er(i.prototype),"on",this)).call.apply(n,[this,e,t].concat(o))}},{key:"once",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=Cr(Er(i.prototype),"once",this)).call.apply(n,[this,e,t].concat(o))}},{key:"off",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=Cr(Er(i.prototype),"off",this)).call.apply(n,[this,e,t].concat(o))}},{key:"offAll",value:function(){Cr(Er(i.prototype),"removeAllListeners",this).call(this)}}]),i}(Lr),$o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};gr(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}return vr(e,[{key:"openDB",value:function(e){var t=this,i=this,n=this.myDB.version||1,r=i.indexedDB.open(i.myDB.name,n);r.onerror=function(e){},r.onsuccess=function(n){t.myDB.db=n.target.result,e.call(i)},r.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(i.myDB.ojstore.name)||t.createObjectStore(i.myDB.ojstore.name,{keyPath:i.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.add(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.put(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(e,t,i){var n=this,r=this.myDB.db.transaction(e,"readwrite").objectStore(e).get(t);r.onerror=function(){i.call(n,null)},r.onsuccess=function(e){var t=e.target.result;i.call(n,t)}}},{key:"deleteData",value:function(e,t){this.myDB.db.transaction(e,"readwrite").objectStore(e).delete(t)}},{key:"clearData",value:function(e){this.myDB.db.transaction(e,"readwrite").objectStore(e).clear()}}]),e}(),Xo=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],qo=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],Qo=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],Zo="data-xgplayerid";function Jo(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];var s=t.call.apply(t,[e].concat(r));i&&"function"==typeof i&&(s&&s.then?s.then((function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];i.call.apply(i,[e].concat(n))})):i.call.apply(i,[e].concat(r)))}function es(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var n=arguments,r=this;if(i.pre)try{var o;(o=i.pre).call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}catch(a){throw a.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(a.message),a}if(this.__hooks&&this.__hooks[e])try{var s=ls.apply(void 0,[this,e,t].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then((function(e){!1!==e&&Jo.apply(void 0,[r,t,i.next].concat(Ir(n)))})).catch((function(e){throw e})):Jo.apply(void 0,[this,t,i.next].concat(Array.prototype.slice.call(arguments))):void 0===s&&Jo.apply(void 0,[this,t,i.next].concat(Array.prototype.slice.call(arguments)))}catch(a){throw a.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(a.message),a}else Jo.apply(void 0,[this,t,i.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function ts(e,t){var i=this.__hooks;if(!i||!Array.isArray(i[e]))return-1;for(var n=i[e],r=0;r<n.length;r++)if(n[r]===t)return r;return-1}function is(e,t){var i=this.__hooks;if(i)return i.hasOwnProperty(e)?(Array.isArray(i[e])||(i[e]=[]),-1===ts.call(this,e,t)&&i[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function ns(e,t){var i=this.__hooks;if(i)if(Array.isArray(i[e])){var n=i[e],r=ts.call(this,e,t);-1!==r&&n.splice(r,1)}else i[e]&&(i[e]=null)}function rs(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var t=this.plugins[e.toLowerCase()],i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.useHooks&&t.useHooks.apply(t,n)}}function os(e){if(this.plugins&&this.plugins[e.toLowerCase()]){var t=this.plugins[e.toLowerCase()];if(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.removeHooks&&t.removeHooks.apply(t,n)}}}function ss(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&t.map((function(t){e.__hooks[t]=null})),Object.defineProperty(e,"hooks",{get:function(){return e.__hooks&&Object.keys(e.__hooks).map((function(t){if(e.__hooks[t])return t}))}})}function as(e){e.__hooks=null}function ls(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];if(e.__hooks&&Array.isArray(e.__hooks[t])){var s=e.__hooks[t],a=-1;return function e(t,i,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),l=3;l<r;l++)o[l-3]=arguments[l];if(a++,0===s.length||a===s.length)return n.call.apply(n,[t,t].concat(o));var u=s[a],c=u.call.apply(u,[t,t].concat(o));return c&&c.then?c.then((function(r){return!1===r?null:e.apply(void 0,[t,i,n].concat(o))})).catch((function(e){console.warn("[runHooks]".concat(i," reject"),e.message)})):!1!==c?e.apply(void 0,[t,i,n].concat(o)):void 0}.apply(void 0,[e,t,i].concat(r))}return i.call.apply(i,[e,e].concat(r))}function us(e,t){Nr.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var cs=function(){function e(t){gr(this,e),Ur.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),ss(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return vr(e,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=Ur.checkTouchSupport()?"touch":"mouse";return!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType||(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){i.__events[e]=t,i.player.on(e,t)})):us(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(n){i.__onceEvents[n]=t,i.player.once(e,t)})):us(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(n){delete i.__events[e],i.player.off(n,t)})):us(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(i){e[t][i]&&e.off(i,e[t][i]),i&&delete e[t][i]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];(t=this.player).emit.apply(t,[e].concat(n))}}},{key:"emitUserAction",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=pr(pr({},i),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){return es.call.apply(es,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return is.call.apply(is,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return ns.call.apply(ns,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return i&&(t.pluginName=i),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e=this,t=this.player,i=this.pluginName;this.offAll(),Ur.clearAllTimers(this),Ur.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(i),as(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(e,i,t[i])}},{key:"defineMethod",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&"function"==typeof t[i]&&Object.defineProperty(e,i,{configurable:!0,value:t[i]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();if("undefined"!=typeof Element&&!Element.prototype.matches){var hs=Element.prototype;hs.matches=hs.matchesSelector||hs.mozMatchesSelector||hs.msMatchesSelector||hs.oMatchesSelector||hs.webkitMatchesSelector}var ds=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}};function ps(e,t,i,n,r){var o=fs.apply(this,arguments);return e.addEventListener(i,o,r),{destroy:function(){e.removeEventListener(i,o,r)}}}function fs(e,t,i,n){return function(i){i.delegateTarget=ds(i.target,t),i.delegateTarget&&n.call(e,i)}}var gs=function(e,t,i,n,r){return"function"==typeof e.addEventListener?ps.apply(null,arguments):"function"==typeof i?ps.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return ps(e,t,i,n,r)})))};const ys=lr(gs);var vs={CONTROLS:"controls",ROOT:"root"},ms={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},_s="xg-icon-disable";function Es(e){return!!e&&(e.indexOf&&/^(?:http|data:|\/)/.test(e))}function Ts(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=null;if(e instanceof window.Element)return Ur.addClass(e,i),Object.keys(n).map((function(t){e.setAttribute(t,n[t])})),e;if(Es(e)||Es(e.url))return n.src=Es(e)?e:e.url||"",o=Ur.createDom(e.tag||"img","",n,"xg-img ".concat(i));if("function"==typeof e)try{return(o=e())instanceof window.Element?(Ur.addClass(o,i),Object.keys(n).map((function(e){o.setAttribute(e,n[e])})),o):(Nr.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(r,"] is a function mast return an Element Object")),null)}catch(s){return Nr.logError("Plugin named [".concat(r,"]:createIcon"),s),null}return"string"==typeof e?Ur.createDomFromHtml(e,n,i):(Nr.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(r,"] is invalid")),null)}function Ss(e,t){var i=t.config.icons||t.playerConfig.icons;Object.keys(e).map((function(n){var r=e[n],o=r&&r.class?r.class:"",s=r&&r.attr?r.attr:{},a=null;i&&i[n]&&(o=function(e,t){return"object"===fr(e)&&e.class&&"string"==typeof e.class?"".concat(t," ").concat(e.class):t}(i[n],o),s=function(e,t){return"object"===fr(e)&&e.attr&&"object"===fr(e.attr)&&Object.keys(e.attr).map((function(i){t[i]=e.attr[i]})),t}(i[n],s),a=Ts(i[n],n,o,s,t.pluginName)),!a&&r&&(a=Ts(r.icon?r.icon:r,s,o,{},t.pluginName)),t.icons[n]=a}))}var bs=function(e){_r(i,e);var t=kr(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return gr(this,i),(e=t.call(this,n)).__delegates=[],e}return vr(i,[{key:"__init",value:function(e){if(Cr(Er(i.prototype),"__init",this).call(this,e),e.root){var t=e.root,n=null;this.icons={},this.root=null,this.parent=null,this.extraEls=[],Ss(this.registerIcons()||{},this),this.langText={};var r,o,s=this.registerLanguageTexts()||{};r=s,o=this,Object.keys(r).map((function(e){Object.defineProperty(o.langText,e,{get:function(){var t=o.lang,i=o.i18n;return i[e]?i[e]:r[e]&&r[e][t]||""}})}));var a="";try{a=this.render()}catch(c){throw Nr.logError("Plugin:".concat(this.pluginName,":render"),c),new Error("Plugin:".concat(this.pluginName,":render:").concat(c.message))}if(a)(n=i.insert(a,t,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(n=Ur.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),t.appendChild(n)}this.root=n,this.parent=t;var l=this.config.attr||{},u=this.config.style||{};this.setAttr(l),this.setStyle(u),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var t=this.children();t&&"object"===fr(t)&&Object.keys(t).length>0&&Object.keys(t).map((function(i){var n,r,o=i,s=t[o],a={root:e.root};"function"==typeof s?(n=e.config[o]||{},r=s):"object"===fr(s)&&"function"==typeof s.plugin&&(n=s.options?Ur.deepCopy(e.config[o]||{},s.options):e.config[o]||{},r=s.plugin),a.config=n,void 0!==n.index&&(a.index=n.index),n.root&&(a.root=n.root),e.registerPlugin(r,a,o)}))}}},{key:"updateLang",value:function(e){e||(e=this.lang);var t=this.root,i=this.i18n,n=this.langText;t&&function e(t,i){for(var n=0;n<t.children.length;n++)t.children[n].children.length>0?e(t.children[n],i):i(t.children[n])}(t,(function(t){var r=t.getAttribute&&t.getAttribute("lang-key");if(r){var o=i[r.toUpperCase()]||n[r];o&&(t.innerHTML="function"==typeof o?o(e):o)}}))}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=this.i18n||{},n=this.langText;e.setAttribute&&e.setAttribute("lang-key",t);var r=i[t]||n[t]||"";r&&(e.innerHTML=r)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,Ur.addClass(this.find(".xgplayer-icon"),_s)}},{key:"enable",value:function(){this.config.disable=!1,Ur.removeClass(this.find(".xgplayer-icon"),_s)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.root=t.root||this.root;var r=Cr(Er(i.prototype),"registerPlugin",this).call(this,e,t,n);return this._children.push(r),r}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,t,n){var r=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){r.bindEL(e,t)})):this.bindEL(e,t);else{var o=i.delegate.call(this,this.root,e,t,n);this.__delegates=this.__delegates.concat(o)}}},{key:"unbind",value:function(e,t){var i=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){i.unbindEL(e,t)})):this.unbindEL(e,t);else for(var n="".concat(e,"_").concat(t),r=0;r<this.__delegates.length;r++)if(this.__delegates[r].key===n){this.__delegates[r].destroy(),this.__delegates.splice(r,1);break}}},{key:"setStyle",value:function(e,t){var i=this;if(this.root)return"String"===Ur.typeOf(e)?this.root.style[e]=t:void("Object"===Ur.typeOf(e)&&Object.keys(e).map((function(t){i.root.style[t]=e[t]})))}},{key:"setAttr",value:function(e,t){var i=this;if(this.root)return"String"===Ur.typeOf(e)?this.root.setAttribute(e,t):void("Object"===Ur.typeOf(e)&&Object.keys(e).map((function(t){i.root.setAttribute(t,e[t])})))}},{key:"setHtml",value:function(e,t){this.root&&(this.root.innerHTML=e,"function"==typeof t&&t())}},{key:"bindEL",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,i)}},{key:"unbindEL",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.removeEventListener(e,t,i)}},{key:"show",value:function(e){if(this.root)return this.root.style.display=void 0!==e?e:"block","none"===window.getComputedStyle(this.root,null).getPropertyValue("display")?this.root.style.display="block":void 0}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,t){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!(t&&t instanceof window.Element))return null;try{return"string"==typeof e?this.find(e).appendChild(t):e.appendChild(t)}catch(i){return Nr.logError("Plugin:appendChild",i),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,t=this.player;this.__delegates.map((function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array&&(this._children.map((function(e){t.unRegisterPlugin(e.pluginName)})),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),Cr(Er(i.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map((function(t){e[t]=null})),this.extraEls=[]}}],[{key:"insert",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=t.children.length,r=Number(i),o=e instanceof window.Node;if(n){for(var s=0,a=null,l="";s<n;s++){a=t.children[s];var u=Number(a.getAttribute("data-index"));if(u>=r){l="beforebegin";break}u<r&&(l="afterend")}return o?"afterend"===l?t.appendChild(e):t.insertBefore(e,a):a.insertAdjacentHTML(l,e),"afterend"===l?t.children[t.children.length-1]:t.children[s]}return o?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.children[t.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,t,i,n){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=[];if(e instanceof window.Node&&"function"==typeof n)if(Array.isArray(i))i.forEach((function(i){var s=ys(e,t,i,n,r);s.key="".concat(t,"_").concat(i),o.push(s)}));else{var s=ys(e,t,i,n,r);s.key="".concat(t,"_").concat(i),o.push(s)}return o}},{key:"ROOT_TYPES",get:function(){return vs}},{key:"POSITIONS",get:function(){return ms}}]),i}(cs),ks=function(){function e(){var t=this;if(gr(this,e),mr(this,"__trigger",(function(e){var i=(new Date).getTime();t.timeStamp=i;for(var n=0;n<e.length;n++)t.__runHandler(e[n].target)})),this.__handlers=[],this.timeStamp=0,this.observer=null,window.ResizeObserver)try{this.observer=new window.ResizeObserver(function(e,t,i){var n=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Br(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),Hr(e,t,{leading:n,trailing:r,maxWait:t})}(this.__trigger,100,{trailing:!0})),this.timeStamp=(new Date).getTime()}catch(i){console.error(i)}}return vr(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer.observe(e);for(var i=e.getAttribute(Zo),n=this.__handlers,r=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(r=o);r>-1?this.__handlers[r].handler=t:this.__handlers.push({target:e,handler:t,playerId:i})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(i,n){e===i.target&&(t=n)}));try{var i;null===(i=this.observer)||void 0===i||i.unobserve(e)}catch(n){}t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,i=0;i<t.length;i++)if(t[i]&&e===t[i].target){try{t[i].handler(e)}catch(n){console.error(n)}return!0}return!1}}]),e}(),Cs=null;var Is={pluginGroup:{},init:function(e){var t,i,n=e._pluginInfoId;n||(n=(new Date).getTime(),e._pluginInfoId=n),!e.config.closeResizeObserver&&(t=e.root,i=function(){e.resize()},Cs||(Cs=new ks),Cs.addObserver(t,i)),this.pluginGroup[n]={_originalOptions:e.config||{},_plugins:{}}},formatPluginInfo:function(e,t){var i=null,n=null;return e.plugin&&"function"==typeof e.plugin?(i=e.plugin,n=e.options):(i=e,n={}),t&&(n.config=t||{}),{PLUFGIN:i,options:n}},checkPluginIfExits:function(e,t){for(var i=0;i<t.length;i++)if(e.toLowerCase()===t[i].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(e,t){for(var i=Object.keys(t),n=null,r=0;r<i.length;r++)if(e.toLowerCase()===i[r].toLowerCase()){n=t[i[r]];break}return"Object"===Ur.typeOf(n)?{root:n.root,position:n.position}:{}},lazyRegister:function(e,t){var i=this,n=t.timeout||1500;return Promise.race([t.loader().then((function(t){var n;n=t&&t.__esModule?t.default:t,i.register(e,n,t.options)})),new Promise((function(e,t){setTimeout((function(){t(new Error("timeout"))}),n)}))])},register:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var n=e._pluginInfoId;if(n&&this.pluginGroup[n]){this.pluginGroup[n]._plugins||(this.pluginGroup[n]._plugins={});var r=this.pluginGroup[n]._plugins,o=this.pluginGroup[n]._originalOptions;i.player=e;var s=i.pluginName||t.pluginName;if(!s)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){i.config||(i.config={});for(var a=Object.keys(o),l=0;l<a.length;l++)if(s.toLowerCase()===a[l].toLowerCase()){var u=o[a[l]];"Object"===Ur.typeOf(u)?i.config=Object.assign({},i.config,o[a[l]]):"Boolean"===Ur.typeOf(u)&&(i.config.disable=!u);break}t.defaultConfig&&Object.keys(t.defaultConfig).forEach((function(e){void 0===i.config[e]&&(i.config[e]=t.defaultConfig[e])})),i.root?"string"==typeof i.root&&(i.root=e[i.root]):i.root=e.root,i.index=i.config.index||0;try{r[s.toLowerCase()]&&(this.unRegister(n,s.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(s,"] exist, destroy the old instance")));var c=new t(i);return r[s.toLowerCase()]=c,r[s.toLowerCase()].func=t,c&&"function"==typeof c.afterCreate&&c.afterCreate(),c}catch(h){throw console.error(h),h}}else console.warn("not supported plugin [".concat(s,"]"))}}},unRegister:function(e,t){e._pluginInfoId&&(e=e._pluginInfoId),t=t.toLowerCase();try{var i=this.pluginGroup[e]._plugins[t];i&&(i.pluginName&&i.__destroy(),delete this.pluginGroup[e]._plugins[t])}catch(n){console.error("[unRegister:".concat(t,"] cgid:[").concat(e,"] error"),n)}},deletePlugin:function(e,t){var i=e._pluginInfoId;i&&this.pluginGroup[i]&&this.pluginGroup[i]._plugins&&delete this.pluginGroup[i]._plugins[t]},getPlugins:function(e){var t=e._pluginInfoId;return t&&this.pluginGroup[t]?this.pluginGroup[t]._plugins:{}},findPlugin:function(e,t){var i=e._pluginInfoId;if(!i||!this.pluginGroup[i])return null;var n=t.toLowerCase();return this.pluginGroup[i]._plugins[n]},beforeInit:function(e){var t=this;function i(e){return e&&e.then?e:new Promise((function(e){e()}))}return new Promise((function(n){if(t.pluginGroup)return(e._loadingPlugins&&e._loadingPlugins.length?Promise.all(e._loadingPlugins):Promise.resolve()).then((function(){var r=e._pluginInfoId;if(t.pluginGroup[r]){var o=t.pluginGroup[r]._plugins,s=[];Object.keys(o).forEach((function(e){if(o[e]&&o[e].beforePlayerInit)try{var t=o[e].beforePlayerInit();s.push(i(t))}catch(n){throw s.push(i(null)),n}})),Promise.all([].concat(s)).then((function(){n()})).catch((function(e){console.error(e),n()}))}else n()}))}))},afterInit:function(e){var t=e._pluginInfoId;if(t&&this.pluginGroup[t]){var i=this.pluginGroup[t]._plugins;Object.keys(i).forEach((function(e){i[e]&&i[e].afterPlayerInit&&i[e].afterPlayerInit()}))}},setLang:function(e,t){var i=t._pluginInfoId;if(i&&this.pluginGroup[i]){var n=this.pluginGroup[i]._plugins;Object.keys(n).forEach((function(t){if(n[t].updateLang)n[t].updateLang(e);else try{n[t].lang=e}catch(i){console.warn("".concat(t," setLang"))}}))}},reRender:function(e){var t=this,i=e._pluginInfoId;if(i&&this.pluginGroup[i]){var n=[],r=this.pluginGroup[i]._plugins;Object.keys(r).forEach((function(e){"controls"!==e&&r[e]&&(n.push({plugin:r[e].func,options:r[e].__args}),t.unRegister(i,e))})),n.forEach((function(i){t.register(e,i.plugin,i.options)}))}},onPluginsReady:function(e){var t=e._pluginInfoId;if(t&&this.pluginGroup[t]){var i=this.pluginGroup[t]._plugins||{};Object.keys(i).forEach((function(e){i[e].onPluginsReady&&"function"==typeof i[e].onPluginsReady&&i[e].onPluginsReady()}))}},destroy:function(e){var t=e._pluginInfoId;if(this.pluginGroup[t]){var i,n,r;i=e.root,null===(r=Cs)||void 0===r||r.unObserver(i,n);for(var o=this.pluginGroup[t]._plugins,s=0,a=Object.keys(o);s<a.length;s++){var l=a[s];this.unRegister(t,l)}delete this.pluginGroup[t],delete e._pluginInfoId}}},As={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function Ps(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:(e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase(),"zh-cn"===e&&(e="zh"),e),controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}};var e}var ws=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onMouseEnter",(function(t){var i=Sr(e),n=i.player;i.playerConfig.closeControlsBlur&&n.focus({autoHide:!1})})),mr(Sr(e),"onMouseLeave",(function(t){Sr(e).player.focus()})),e}return vr(i,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==Kr.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,t=this.config,i=t.disable,n=t.height,r=t.mode;if(!i){"flex"===r&&this.player.addClass(As.FLEX_CONTROLS);var o={height:"".concat(n,"px")};Object.keys(o).map((function(t){e.root.style[t]=o[t]})),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-controls"),this.on(Po,(function(t){t?Ur.addClass(e.root,"mini-controls"):Ur.removeClass(e.root,"mini-controls")}));var s=this.playerConfig.isMobileSimulateMode;"mobile"!==Kr.device&&"mobile"!==s&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave))}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&Ur.addClass(this.root,As.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){Ur.removeClass(this.root,As.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var r=e.defaultConfig||{};if(!t.root){switch(t.position?t.position:t.config&&t.config.position?t.config.position:r.position){case ms.CONTROLS_LEFT:t.root=this.left;break;case ms.CONTROLS_RIGHT:t.root=this.right;break;case ms.CONTROLS_CENTER:t.root=this.center;break;case ms.CONTROLS:t.root=this.root;break;default:t.root=this.left}return Cr(Er(i.prototype),"registerPlugin",this).call(this,e,t,n)}}}},{key:"destroy",value:function(){"mobile"!==Kr.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.left=null,this.center=null,this.right=null,this.innerRoot=null}},{key:"render",value:function(){var e=this.config,t=e.mode,i=e.autoHide,n=e.initShow;if(!e.disable){var r=Ur.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},mr({},As.CONTROLS_AUTOHIDE,i),{"xgplayer-controls-initshow":n||!i});return'<xg-controls class="'.concat(r,'" unselectable="on">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),i}(bs),Ds={lang:{},langKeys:[],textKeys:[]};function Ls(e,t){return Object.keys(t).forEach((function(i){var n,r=Ur.typeOf(t[i]),o=Ur.typeOf(e[i]);"Array"===r?("Array"!==o&&(e[i]=[]),(n=e[i]).push.apply(n,Ir(t[i]))):"Object"===r?("Object"!==o&&(e[i]={}),Ls(e[i],t[i])):e[i]=t[i]})),e}function Rs(){Object.keys(Ds.lang.en).map((function(e){Ds.textKeys[e]=e}))}function xs(e,t){var i=e.LANG;if(t||(t=Ds),t.lang){var n=e.TEXT||{};"zh"===i&&(i="zh-cn"),t.lang[i]?Ls(t.lang[i],n):(t.langKeys.push(i),t.lang[i]=n),Rs()}}xs({LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}});var Os={get textKeys(){return Ds.textKeys},get langKeys(){return Ds.langKeys},get lang(){var e={};return Ds.langKeys.map((function(t){e[t]=Ds.lang[t]})),Ds.lang["zh-cn"]&&(e.zh=Ds.lang["zh-cn"]||{}),e},extend:function(e,t){var i=[];if(t||(t=Ds),t.lang){i="Array"!==Ur.typeOf(e)?Object.keys(e).map((function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}})):e;var n=t.lang;i.map((function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),n[e.LANG]?Ls(n[e.LANG]||{},e.TEXT||{}):xs(e,t)})),Rs()}},use:xs,init:function(e){var t,i={lang:{},langKeys:[],textKeys:{},pId:e};return Ls(i.lang,Ds.lang),(t=i.langKeys).push.apply(t,Ir(Ds.langKeys)),Ls(i.textKeys,Ds.textKeys),i}},Ns={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},Ms=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],Us={},Bs=null,Hs=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"add",value:function(e){e&&(Us[e.playerId]=e,1===Object.keys(Us).length&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete Us[e.playerId])}},{key:"_iterate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var i in Us)if(Object.prototype.hasOwnProperty.call(Us,i)){var n=Us[i];if(t){if(e(n))break}else e(n)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(i){var n=e(i);return n&&(t=i),n}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(i){e(i)&&t.push(i)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Us[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):Us[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(Us),t=0;t<e.length;t++){var i=Us[e[t]];if(i&&i.isUserActive)return e[t]}return null}},{key:"setNext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Us[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):Us[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return Bs||(Bs=new i),Bs}}]),i}(Dr.EventEmitter);var Fs=["play","pause","replay","retry"],js=0,Vs=0,Ks=null,Gs=function(e){_r(i,e);var t=kr(i);function i(e){var n;gr(this,i);var r,o=Ur.deepMerge(Ps(),e);mr(Sr(n=t.call(this,o)),"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,i=e.defaultPlaybackRate;Nr.logInfo("player","canPlayFunc, startTime",n.__startTime),n._seekToStartTime(),n.playbackRate=i,(t||n._useAutoplay)&&n.mediaPlay(),n.off(no,n.canPlayFunc),n.removeClass(As.ENTER)}})),mr(Sr(n),"onFullscreenChange",(function(e,t){var i=function(){Ur.setTimeout(Sr(n),(function(){n.resize()}),100)},r=Ur.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(Bo,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var o=function(e,t,i){if(e){var n=e.getAttribute(i);return!(!n||n!==t||"VIDEO"!==e.tagName&&"AUDIO"!==e.tagName)}}(r,n.playerId,Zo);if(t||r&&(r===n._fullscreenEl||o))i(),!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!0,n.changeFullStyle(n.root,r,As.FULLSCREEN),n.emit(Io,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){i();var s=Sr(n),a=s._fullScreenOffset;if(s.config.needFullscreenScroll?(window.scrollTo(a.left,a.top),Ur.setTimeout(Sr(n),(function(){n.fullscreen=!1,n._fullScreenOffset=null}),100)):(!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!1,n._fullScreenOffset=null),n.cssfullscreen)n.removeClass(As.FULLSCREEN);else{var l=n._fullscreenEl;l||!n.root.contains(e.target)&&e.target!==n.root||(l=e.target),n.recoverFullStyle(n.root,l,As.FULLSCREEN)}n._fullscreenEl=null,n.emit(Io,!1)}})),mr(Sr(n),"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),mr(Sr(n),"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),ss(Sr(n),Fs),n.config=o,n._pluginInfoId=Ur.generateSessionId(),(r=Sr(n)).logInfo=Nr.logInfo.bind(r),r.logWarn=Nr.logWarn.bind(r),r.logError=Nr.logError.bind(r);var s=n.constructor.defaultPreset;if(n.config.presets.length){var a=n.config.presets.indexOf("default");a>=0&&s&&(n.config.presets[a]=s)}else s&&n.config.presets.push(s);if(n.userTimer=null,n.waitTimer=null,n.handleSource=!0,n._state=Ns.INITIAL,n.isAd=!1,n.isError=!1,n._hasStart=!1,n.isSeeking=!1,n.isCanplay=!1,n._useAutoplay=!1,n.__startTime=-1,n.rotateDeg=0,n.isActive=!1,n.fullscreen=!1,n.cssfullscreen=!1,n.isRotateFullscreen=!1,n._fullscreenEl=null,n.timeSegments=[],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._offsetInfo={currentTime:-1,duration:0},n.innerContainer=null,n.controls=null,n.topBar=null,n.root=null,n.__i18n=Os.init(n._pluginInfoId),Kr.os.isAndroid&&Kr.osVersion>0&&Kr.osVersion<6&&(n.config.autoplay=!1),n.database=new $o,n.isUserActive=!1,n._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=Ks,!n._initDOM())return console.error(new Error("can't find the dom which id is ".concat(n.config.id," or this.config.el does not exist"))),br(n);var l=n.config,u=l.definition,c=void 0===u?{}:u;if(!l.url&&c.list&&c.list.length>0){var h=c.list.find((function(e){return e.definition&&e.definition===c.defaultDefinition}));h||(c.defaultDefinition=c.list[0].definition,h=c.list[0]),n.config.url=h.url,n.curDefinition=h}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),Is.onPluginsReady(Sr(n)),n.getInitDefinition(),n.setState(Ns.READY),Ur.setTimeout(Sr(n),(function(){n.emit(fo)}),0),n.onReady&&n.onReady(),(n.config.videoInit||n.config.autoplay)&&(!n.hasStart||n.state<Ns.ATTACHED)&&n.start(),n}return vr(i,[{key:"_initDOM",value:function(){var e,t=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var i=this.config.el;if(!i||1!==i.nodeType)return this.emit(Zr,new zr("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1;this.root=i}var n=function(e){for(var t=Object.keys(Us),i=0;i<t.length;i++){var n=Us[t[i]];if(n.root===e)return n}return null}(this.root);if(n&&(Nr.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),n.destroy()),this.root.setAttribute(Zo,this.playerId),this.media.setAttribute(Zo,this.playerId),null===(e=Ks)||void 0===e||e.add(this),Is.init(this),this._initBaseDoms(),this.config.controls){var r=this.config.controls.root||null,o=Is.register(this,ws,{root:r});this.controls=o}var s="mobile"===this.config.isMobileSimulateMode?"mobile":Kr.device;if(this.addClass("".concat(As.DEFAULT," ").concat(As.INACTIVE," xgplayer-").concat(s," ").concat(this.config.controls?"":As.NO_CONTROLS)),this.config.autoplay?this.addClass(As.ENTER):this.addClass(As.NO_START),this.config.fluid){var a=this.config,l=a.width,u=a.height;"number"==typeof l&&"number"==typeof u||(l=600,u=337.5);var c={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(100*u/l,"%")};Object.keys(c).forEach((function(e){t.root.style[e]=c[e]}))}else["width","height"].forEach((function(e){t.config[e]&&("number"!=typeof t.config[e]?t.root.style[e]=t.config[e]:t.root.style[e]="".concat(t.config[e],"px"))}));var h=this.root.getBoundingClientRect(),d=h.width,p=h.height,f=h.left,g=h.top;return this.sizeInfo.width=d,this.sizeInfo.height=p,this.sizeInfo.left=f,this.sizeInfo.top=g,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=Ur.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach((function(t){e.on(t,e["on"+t.charAt(0).toUpperCase()+t.slice(1)])})),Xo.forEach((function(t){document&&document.addEventListener(t,e.onFullscreenChange)})),Kr.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(so,this.resize),this.playFunc=function(){e.config.closeFocusVideoFocus||e.media.focus()},this.once($r,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),Xo.forEach((function(t){document.removeEventListener(t,e.onFullscreenChange)})),this.playFunc&&this.off($r,this.playFunc),this.off(no,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_clearUserTimer",value:function(){this.userTimer&&(Ur.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.media&&(e&&""!==e&&("Array"!==Ur.typeOf(e)||0!==e.length)||(e="",this.emit(go),Nr.logWarn("config.url is null, please get url and run player._startInit(url)"),!this.config.nullUrlStart))){Ur.isNotNull(i.playSessionId)&&(this._playSessionId=i.playSessionId),this.handleSource&&(this._detachSourceEvents(this.media),"Array"===Ur.typeOf(e)&&e.length>0?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e),"Number"===Ur.typeOf(this.config.volume)&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var r=this.media.readyState;Nr.logInfo("_startInit readyState",r),this.config.autoplay&&(!Ur.isMSE(this.media)&&this.load(),(Kr.os.isIpad||Kr.os.isPhone)&&this.mediaPlay());var o=this.config.startTime;this.__startTime=o>0?o:-1,this.config.startTime=0,r>=2&&this.duration>0?this.canPlayFunc():this.on(no,this.canPlayFunc),(!this.hasStart||this.state<Ns.ATTACHED)&&Is.afterInit(this),this.hasStart=!0,this.setState(Ns.ATTACHED),Ur.setTimeout(this,(function(){t.emit(mo)}),0)}}},{key:"_registerPlugins",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._loadingPlugins=[];var i=this.config.ignores||[],n=this.config.plugins||[],r=this.config.i18n||[];t&&Os.extend(r,this.__i18n);var o=i.join("||").toLowerCase().split("||"),s=this.plugins;n.forEach((function(i){try{var n=i.plugin?i.plugin.pluginName:i.pluginName;if(n&&o.indexOf(n.toLowerCase())>-1)return null;if(!t&&s[n.toLowerCase()])return;if(i.lazy&&i.loader){var r=Is.lazyRegister(e,i);return void(i.forceBeforeInit&&(r.then((function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(r),1)})).catch((function(t){Nr.logError("_registerPlugins:loadingPlugin",t),e._loadingPlugins.splice(e._loadingPlugins.indexOf(r),1)})),e._loadingPlugins.push(r)))}return e.registerPlugin(i)}catch(a){Nr.logError("_registerPlugins:",a)}}))}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach((function(t){!function(e,t){var i,n,r=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),o=r.plugins,s=void 0===o?[]:o,a=r.ignores,l=void 0===a?[]:a,u=r.icons,c=void 0===u?{}:u,h=r.i18n,d=void 0===h?[]:h;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(i=e.config.plugins).push.apply(i,Ir(s)),(n=e.config.ignores).push.apply(n,Ir(l)),Object.keys(c).map((function(t){e.config.icons[t]||(e.config.icons[t]=c[t])}));var p=e.config.i18n||[];d.push.apply(d,Ir(p)),e.config.i18n=d}(e,t)}))}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case ms.ROOT_RIGHT:this.rightBar||(this.rightBar=Ur.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case ms.ROOT_LEFT:this.leftBar||(this.leftBar=Ur.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case ms.ROOT_TOP:this.topBar||(this.topBar=Ur.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&Ur.addClass(this.topBar,As.TOP_BAR_AUTOHIDE)),t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var i=Is.formatPluginInfo(e,t),n=i.PLUFGIN,r=i.options,o=this.config.plugins;!Is.checkPluginIfExits(n.pluginName,o)&&o.push(n);var s=Is.getRootByConfig(n.pluginName,this.config);s.root&&(r.root=s.root),s.position&&(r.position=s.position);var a,l=r.position?r.position:r.config&&r.config.position||n.defaultConfig&&n.defaultConfig.position;return!r.root&&"string"==typeof l&&l.indexOf("controls")>-1?null===(a=this.controls)||void 0===a?void 0:a.registerPlugin(n,r,n.pluginName):(r.root||(r.root=this._getRootByPosition(l)),Is.register(this,n,r))}},{key:"deregister",value:function(e){"string"==typeof e?Is.unRegister(this,e):e instanceof cs&&Is.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.deregister(e),t&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var t;if("string"==typeof e?t=e:e instanceof cs&&(t=e.pluginName),t)for(var i=this.config.plugins.length-1;i>-1;i--){if(this.config.plugins[i].pluginName.toLowerCase()===t.toLowerCase()){this.config.plugins.splice(i,1);break}}}},{key:"plugins",get:function(){return Is.getPlugins(this)}},{key:"getPlugin",value:function(e){var t=Is.findPlugin(this,e);return t&&t.pluginName?t:null}},{key:"addClass",value:function(e){this.root&&(Ur.hasClass(this.root,e)||Ur.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&Ur.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return Ur.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,t){this.root&&this.root.setAttribute(e,t)}},{key:"removeAttribute",value:function(e,t){this.root&&this.root.removeAttribute(e,t)}},{key:"start",value:function(e){var t=this;if(!(this.state>Ns.ATTACHING)){var i=this._playSessionId;return Ur.isNotNull(i)&&(this._playSessionId=void 0),e||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(Ns.ATTACHING),this._registerPlugins(!1),Is.beforeInit(this).then((function(){if(t.config){e||(e=t.url||t.config.url);var n=t.preProcessUrl(e);return t._startInit(n.url,{playSessionId:i})}})).catch((function(e){throw e.fileName="player",e.lineNumber="236",Nr.logError("start:beforeInit:",e),e}))}}},{key:"switchURL",value:function(e,t){var i=this,n=e;"Object"===Ur.typeOf(e)&&(n=e.url),n=this.preProcessUrl(n).url;var r=this.currentTime;this.__startTime=r;var o=this.paused&&!this.isError;return this.src=n,new Promise((function(e,t){var r=function(e){i.off("timeupdate",s),i.off("canplay",s),t(e)},s=function(){i._seekToStartTime(),o&&i.pause(),i.off("error",r),e(!0)};i.once("error",r),n?(Kr.os.isAndroid?i.once("timeupdate",s):i.once("canplay",s),i.play()):i.errorHandler("error",{code:6,message:"empty_src"})}))}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<Ns.ATTACHED)return this.removeClass(As.NO_START),this.addClass(As.ENTER),this.start(),void(this._useAutoplay=!0);this.state<Ns.RUNNING&&(this.removeClass(As.NO_START),!this.isCanplay&&this.addClass(As.ENTER));var t=Cr(Er(i.prototype),"play",this).call(this);return void 0!==t&&t&&t.then?t.then((function(){e.removeClass(As.NOT_ALLOW_AUTOPLAY),e.addClass(As.PLAYING),e.state<Ns.RUNNING&&(Nr.logInfo(">>>>playPromise.then"),e.setState(Ns.RUNNING),e.emit(yo))})).catch((function(t){if(Nr.logWarn(">>>>playPromise.catch",t.name),e.media&&e.media.error)return e.onError(),void e.removeClass(As.ENTER);"NotAllowedError"===t.name&&(e._errorTimer=Ur.setTimeout(e,(function(){e._errorTimer=null,e.emit(vo),e.addClass(As.NOT_ALLOW_AUTOPLAY),e.removeClass(As.ENTER),e.pause(),e.setState(Ns.NOTALLOW)}),0))})):(Nr.logWarn("video.play not return promise"),this.state<Ns.RUNNING&&(this.setState(Ns.RUNNING),this.removeClass(As.NOT_ALLOW_AUTOPLAY),this.removeClass(As.NO_START),this.removeClass(As.ENTER),this.addClass(As.PLAYING),this.emit(yo))),t}},{key:"mediaPause",value:function(){Cr(Er(i.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){Cr(Er(i.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(As.PAUSED),ls(this,"play",(function(){return e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;ls(this,"pause",(function(){Cr(Er(i.prototype),"pause",e).call(e)}))}},{key:"seek",value:function(e,t){var i=this;if(this.media&&!Number.isNaN(Number(e))&&this.hasStart){var n=this.config,r=n.isSeekedPlay,o=n.seekedStatus,s=t||(r?"play":o);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(eo,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(i.removeClass(As.ENTER),i.isSeeking=!1,s){case"play":i.play();break;case"pause":i.pause();break;default:i._isPauseBeforeSeek>1||i.paused?i.pause():i.play()}i._isPauseBeforeSeek=0,i._onceSeekCanplay=null},this.once(eo,this._onceSeekCanplay),this.state<Ns.RUNNING?(this.removeClass(As.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,t=this.config,i=t.definition;!t.url&&i&&i.list&&i.list.length>0&&i.defaultDefinition&&i.list.map((function(t){t.definition===i.defaultDefinition&&(e.config.url=t.url,e.curDefinition=t)}))}},{key:"changeDefinition",value:function(e,t){var i=this,n=this.config.definition;if(Array.isArray(null==n?void 0:n.list)&&n.list.forEach((function(t){(null==e?void 0:e.definition)===t.definition&&(i.curDefinition=t)})),null!=e&&e.bitrate&&"number"!=typeof e.bitrate&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(wo,{from:t,to:e}),this.hasStart){var r=this.switchURL(e.url,pr({seamless:!1!==n.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},e));r&&r.then?r.then((function(){i.emit(Do,{from:t,to:e})})):this.emit(Do,{from:t,to:e})}else this.config.url=e.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(so,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,t=[As.NOT_ALLOW_AUTOPLAY,As.PLAYING,As.NO_START,As.PAUSED,As.REPLAY,As.ENTER,As.ENDED,As.ERROR,As.LOADING];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,t.forEach((function(t){e.removeClass(t)})),this.addClass(As.NO_START),this.emit(Ho)}},{key:"reset",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0;if(this.resetState(),this.plugins&&(t.map((function(t){e.deregister(t)})),i)){var n=Ps();Object.keys(this.config).keys((function(t){"undefined"===e.config[t]||"plugins"!==t&&"presets"!==t&&"el"!==t&&"id"!==t||(e.config[t]=n[t])}))}}},{key:"destroy",value:function(){var e,t=this,n=this.innerContainer,r=this.root,o=this.media;if(r&&o){if(this.hasStart=!1,this._useAutoplay=!1,r.removeAttribute(Zo),o.removeAttribute(Zo),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),Ur.clearAllTimers(this),this.emit(Eo),null===(e=Ks)||void 0===e||e.remove(this),Is.destroy(this),as(this),Cr(Er(i.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),n)for(var s=n.children,a=0;a<s.length;a++)n.removeChild(s[a]);!n&&o instanceof window.Node&&r.contains(o)&&!this.config.remainMediaAfterDestroy&&r.removeChild(o),["topBar","leftBar","rightBar","innerContainer"].map((function(e){t[e]&&r.removeChild(t[e]),t[e]=null}));var l=r.className.split(" ");l.length>0?r.className=l.filter((function(e){return e.indexOf("xgplayer")<0})).join(" "):r.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach((function(e){t[e]=!1}))}}},{key:"replay",value:function(){var e=this;this.removeClass(As.ENDED),this.currentTime=0,this.isSeeking=!1,ls(this,"replay",(function(){e.once(eo,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),e.emit(_o),e.onPlay()}))}},{key:"retry",value:function(){var e=this;this.removeClass(As.ERROR),this.addClass(As.LOADING),ls(this,"retry",(function(){var t=e.currentTime,i=e.config.url,n=Ur.isMSE(e.media)?{url:i}:e.preProcessUrl(i);e.src=n.url,!e.config.isLive&&(e.currentTime=t),e.once(no,(function(){e.mediaPlay()}))}))}},{key:"changeFullStyle",value:function(e,t,i,n){e&&(n||(n=As.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=Ur.filterStyleFromText(e)),Ur.addClass(e,i),t&&t!==e&&!this._orgPCss&&(this._orgPCss=Ur.filterStyleFromText(t),Ur.addClass(t,n),t.setAttribute(Zo,this.playerId)))}},{key:"recoverFullStyle",value:function(e,t,i,n){n||(n=As.PARENT_FULLSCREEN),this._orgCss&&(Ur.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),Ur.removeClass(e,i),t&&t!==e&&this._orgPCss&&(Ur.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",Ur.removeClass(t,n),t.removeAttribute(Zo))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,i=this.media;if("video"!==e&&"media"!==e||(e=this[e]),e||(e=t),this._fullScreenOffset={top:Ur.scrollTop(),left:Ur.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",Ur.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var n=0;n<qo.length;n++){var r=qo[n];if(e[r]){var o="webkitRequestFullscreen"===r?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[r]();return o&&o.then?o:Promise.resolve()}}return i.fullscreenEnabled||i.webkitSupportsFullscreen?(i.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch(s){return Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),this._fullscreenEl||Ur.getFullScreenEl()){this.root;var t=this.media;this._fullActionFrom="exit";try{for(var i=0;i<Qo.length;i++){var n=Qo[i];if(document[n]){var r=document[n]();return r&&r.then?r:Promise.resolve()}}return t&&t.webkitSupportsFullscreen?(t.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch(o){return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var t=e?"".concat(As.INNER_FULLSCREEN," ").concat(As.CSS_FULLSCREEN):As.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,t);var i=this.config.fullscreen,n=void 0===i?{}:i;(!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen())&&(this.fullscreen=!0,this.emit(Io,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(Ao,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(As.INNER_FULLSCREEN," ").concat(As.CSS_FULLSCREEN):As.CSS_FULLSCREEN;if(this.fullscreen){var t=this.config.fullscreen,i=void 0===t?{}:t;!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(Io,!1)):this.removeClass(e)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,e);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(Ao,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var t=e?"".concat(As.INNER_FULLSCREEN," ").concat(As.ROTATE_FULLSCREEN):As.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,t,As.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style");var i=90===Math.abs(window.orientation)||90===Math.abs(screen.orientation.angle);this.root.style.width="".concat(i?window.innerWidth:window.innerHeight,"px"),this.emit(Io,!0)}},{key:"exitRotateFullscreen",value:function(e){var t=this._fullscreenEl!==this.root?"".concat(As.INNER_FULLSCREEN," ").concat(As.ROTATE_FULLSCREEN):As.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,t,As.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(Io,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){90===window.orientation||-90===window.orientation?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};this.isActive?this.onFocus(e):this.emit(ho,pr({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};this.isActive?(this._clearUserTimer(),this.emit(po,pr({paused:this.paused,ended:this.ended},e))):this.onBlur(e)}},{key:"onFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!0,delay:3e3},i=this.innerStates;if(this.isActive=!0,this.removeClass(As.INACTIVE),this._clearUserTimer(),void 0!==t.isLock&&(i.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||i.isActiveLocked)this._clearUserTimer();else{var n=t&&t.delay?t.delay:this.config.inactive;this.userTimer=Ur.setTimeout(this,(function(){e.userTimer=null,e.blur()}),n)}}},{key:"onBlur",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).ignorePaused,t=void 0!==e&&e;if(!this.innerStates.isActiveLocked){var i=this.config.closePauseVideoFocus;this.isActive=!1,(t||i||!this.paused&&!this.ended)&&this.addClass(As.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(As.ENTER),this.removeClass(As.ERROR),this.removeClass(As.LOADING),this.isCanplay=!0,this.waitTimer&&Ur.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){var e=this;this.isError=!1,this.isSeeking=!1,this.__startTime>0&&(this.duration>0?this._seekToStartTime():this.once(ro,(function(){e._seekToStartTime()})))}},{key:"onLoadstart",value:function(){this.removeClass(As.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===Ns.ENDED&&this.setState(Ns.RUNNING),this.removeClass(As.PAUSED),this.ended&&this.removeClass(As.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(As.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(As.ENDED),this.setState(Ns.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(As.NOT_ALLOW_AUTOPLAY),this.removeClass(As.NO_START),this.removeClass(As.ENTER),this.removeClass(As.LOADING),this.addClass(As.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(As.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&Ur.clearTimeout(this,this.waitTimer),this.removeClass(As.LOADING),this.removeClass(As.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&Ur.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=Ur.setTimeout(this,(function(){e.addClass(As.LOADING),e.emit(Co),Ur.clearTimeout(e,e.waitTimer),e.waitTimer=null}),this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1,[As.NO_START,As.PAUSED,As.ENDED,As.ERROR,As.REPLAY,As.LOADING].forEach((function(t){e.removeClass(t)})),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(As.LOADING))&&this.media.readyState>2&&(this.removeClass(As.LOADING),Ur.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===Ns.NOTALLOW&&this.duration&&(this.setState(Ns.RUNNING),this.emit(yo)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===Ur.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,i){if(this.media&&t&&e){var n="String"===Ur.typeOf(e)?e:e.type||"";i.props&&"Array"!==Ur.typeOf(i.props)&&(i.props=[i.props]),this.emit(Bo,pr({eventType:n,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},i))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var t=(new Date).getTime()-this._accPlayed.t;this._accPlayed.acc+=t,this._accPlayed.t=0,("ended"===e||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{startDiff:0,endDiff:0})||{},i=t.startDiff,n=void 0===i?0:i,r=t.endDiff,o=void 0===r?0:r,s=this.media.buffered;if(!s||0===s.length||!this.duration)return!0;for(var a=e||this.media.currentTime||.2,l=s.length,u=0;u<l;u++)if(s.start(u)+n<=a&&s.end(u)-o>a)return!0;return!1}},{key:"resizePosition",value:function(){var e=this,t=this.videoPos,i=t.vy,n=t.vx,r=t.h,o=t.w,s=this.videoPos.rotate;if(!(s<0&&r<0&&o<0)){var a=this.videoPos._pi;if(!a&&this.media.videoHeight&&(a=this.media.videoWidth/this.media.videoHeight*100),a){this.videoPos.pi=a;var l={rotate:s=s<0?0:s},u=0,c=0,h=1,d=Math.abs(s/90),p=this.root,f=this.innerContainer,g=p.offsetWidth,y=f?f.offsetHeight:p.offsetHeight,v={},m=y,_=g;if(d%2==0)h=r>0?100/r:o>0?100/o:1,l.scale=h,u=i>0?(100-r)/2-i:0,l.y=2===d?0-u:u,c=n>0?(100-o)/2-n:0,l.x=2===d?0-c:c,v.width="".concat(_,"px"),v.height="".concat(m,"px"),v.maxWidth="",v.maxHeight="";else if(d%2==1){m=g;var E=y-g;c=-E/2/(_=y)*100,l.x=3===d?c+i/2:c-i/2,u=E/2/m*100,l.y=3===d?u+n/2:u-n/2,l.scale=h,v.width="".concat(_,"px"),v.maxWidth="".concat(_,"px"),v.height="".concat(m,"px"),v.maxHeight="".concat(m,"px")}var T=Ur.getTransformStyle(l,this.media.style.transform||this.media.style.webkitTransform);v.transform=T,v.webkitTransform=T,Object.keys(v).map((function(t){e.media.style[t]=v[t]}))}}}},{key:"position",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};if(this.media&&e&&e.h){var t=this.videoPos;t.h=100*e.h||0,t.w=100*e.w||0,t.vx=100*e.x||0,t.vy=100*e.y||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(i){if("plugins"!==i){t.config[i]=e[i];var n=t.plugins[i.toLowerCase()];n&&"Function"===Ur.typeOf(n.setConfig)&&n.setConfig(e[i])}}))}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,ls(this,"playnext",(function(){t.start(),t.emit(No,e)}))}},{key:"resize",value:function(){var e=this;if(this.media&&this.root){var t=this.root.getBoundingClientRect();this.sizeInfo.width=t.width,this.sizeInfo.height=t.height,this.sizeInfo.left=t.left,this.sizeInfo.top=t.top;var i=this.media,n=i.videoWidth,r=i.videoHeight,o=this.config,s=o.fitVideoSize,a=o.videoFillMode;if("fill"!==a&&"cover"!==a&&"contain"!==a||this.setAttribute("data-xgfill",a),r&&n){this._videoHeight=r,this._videoWidth=n;var l=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,u=t.width,c=t.height-l,h=parseInt(n/r*1e3,10),d=parseInt(u/c*1e3,10),p=u,f=c,g={};"auto"===s&&d>h||"fixWidth"===s?(f=u/h*1e3,this.config.fluid?g.paddingTop="".concat(100*f/p,"%"):g.height="".concat(f+l,"px")):("auto"===s&&d<h||"fixHeight"===s)&&(p=h*c/1e3,g.width="".concat(p,"px")),this.fullscreen||this.cssfullscreen||Object.keys(g).forEach((function(t){e.root.style[t]=g[t]})),("fillHeight"===a&&d<h||"fillWidth"===a&&d>h)&&this.setAttribute("data-xgfill","cover");var y={videoScale:h,vWidth:p,vHeight:f,cWidth:p,cHeight:f+l};this.resizePosition(),this.emit(Lo,y)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(e,t):this.media.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%")}},{key:"setState",value:function(e){Nr.logInfo("setState","state from:".concat(Ms[this.state]," to:").concat(Ms[e])),this._state=e}},{key:"preProcessUrl",value:function(e,t){var i=this.config,n=i.preProcessUrl,r=i.preProcessUrlOptions,o=Object.assign({},r,t);return Ur.isBlob(e)||"function"!=typeof n?{url:e}:n(e,o)}},{key:"_seekToStartTime",value:function(){this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime>this.duration?this.duration:this.__startTime,this.__startTime=-1)}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"==typeof e&&(this._hasStart=e,!1===e&&this.setState(Ns.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===Ns.RUNNING||this._state===Ns.ENDED},set:function(e){e?this.setState(Ns.RUNNING):this._state>=Ns.RUNNING&&this.setState(Ns.ATTACHED)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var t=this,i=this.config.definition,n=null,r=null;i.list=e,this.emit("resourceReady",e),e.forEach((function(e){var o;(null===(o=t.curDefinition)||void 0===o?void 0:o.definition)===e.definition&&(n=e),i.defaultDefinition===e.definition&&(r=e)})),!r&&e.length>0&&(r=e[0]),n?this.changeDefinition(n):r&&this.changeDefinition(r)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var t=this.media.getVideoPlaybackQuality();return e.dropped=t.droppedVideoFrames||0,e.total=t.totalVideoFrames||0,e.corrupted=t.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){0!==Os.langKeys.filter((function(t){return t===e})).length||"zh"===e?(this.config.lang=e,Is.setLang(e,this)):console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(Os.langKeys.join(),"] "))}},{key:"i18n",get:function(){var e=this.config.lang;return"zh"===e&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return Gr}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return Cr(Er(i.prototype),"readyState",this)}},{key:"error",get:function(){var e=Cr(Er(i.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return Cr(Er(i.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,i=e.t;return i?(new Date).getTime()-i+t:t}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){(e=Ur.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return Vs},set:function(e){Vs=e}},{key:"realTimeSpeed",get:function(){return js},set:function(e){js=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,t){return es.call.apply(es,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){return is.call.apply(is,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){return ns.call.apply(ns,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];return rs.call.apply(rs,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),o=3;o<n;o++)r[o-3]=arguments[o];return os.call.apply(os,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,t){var i;"boolean"==typeof t&&t!==this.muted&&(this.addInnerOP("volumechange"),Ur.typeOf(t)===Boolean&&(this.muted=t)),null===(i=Ks)||void 0===i||i.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return Nr.config.debug},set:function(e){Nr.config.debug=e}},{key:"instManager",get:function(){return Ks},set:function(e){Ks=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return null===(e=Ks)||void 0===e?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,t){var i;null===(i=Ks)||void 0===i||i.setActive(e,t)}},{key:"isHevcSupported",value:function(){return Kr.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return Kr.probeConfigSupported(e)}},{key:"install",value:function(e,t){i.plugins||(i.plugins={}),i.plugins[e]||(i.plugins[e]=t)}},{key:"use",value:function(e,t){i.plugins||(i.plugins={}),i.plugins[e]=t}}]),i}(zo);mr(Gs,"defaultPreset",null),mr(Gs,"XgVideoProxy",null),Gs.instManager=Hs.getInstance();const Ws=Object.assign(Gs,{BasePlugin:cs,Errors:zr,Events:Wo,InstManager:Hs,Sniffer:Kr,Util:Ur}),Ys={origin:{index:1,next:"uhd",prev:null},uhd:{index:2,next:"hd",prev:"origin"},hd:{index:3,next:"sd",prev:"uhd"},sd:{index:4,next:"ld",prev:"hd"},ld:{index:5,next:"ao",prev:"sd"},ao:{index:6,next:null,prev:"ld"}},zs=["zh","en","jp","zh-hk"],$s={NORMAL:0,INNER:1,FULLSCREEN:2};var Xs=(e=>(e[e.VALID=10]="VALID",e[e.TRANSCODING=30]="TRANSCODING",e[e.NO_SET_AUDIT=1e3]="NO_SET_AUDIT",e[e.OFFLINE=1002]="OFFLINE",e[e.NO_AUTH=2001]="NO_AUTH",e[e.UN_AUTH=2002]="UN_AUTH",e))(Xs||{});const qs=5e9,Qs={jp:"キャンセル",en:"Cancel",zh:"取消","zh-hk":"取消"};var Zs=(e=>(e.WIDEVINE="widevine",e.FAIRPLAY="fairplay",e.PLAYREADY="playready",e))(Zs||{}),Js={LANG:"jp",TEXT:{ERROR_TYPES:{network:{code:1,msg:"ビデオダウンロードエラー"},mse:{code:2,msg:"ストリーム追加エラー"},parse:{code:3,msg:"解析エラー"},format:{code:4,msg:"間違ったフォーマット"},decoder:{code:5,msg:"デコードエラー"},runtime:{code:6,msg:"文法エラー"},timeout:{code:7,msg:"再生タイムアウト"},other:{code:8,msg:"その他のエラー"}},HAVE_NOTHING:"オーディオ/ビデオが準備できているか情報がありません",HAVE_METADATA:"オーディオ/ビデオのメタデータは準備できています",HAVE_CURRENT_DATA:"現在の再生位置に関するデータは利用可能ですが、次のフレーム/ミリ秒を再生するのに十分なデータがありません",HAVE_FUTURE_DATA:"現在、少なくとも次のフレームのデータが利用可能です",HAVE_ENOUGH_DATA:"利用可能なデータは再生を開始するのに十分です",NETWORK_EMPTY:"オーディオ/ビデオが初期化されていません",NETWORK_IDLE:"オーディオ/ビデオはアクティブでリソースが選択されていますが、ネットワークが使用されていません",NETWORK_LOADING:"ブラウザーはデータをダウンロードしています",NETWORK_NO_SOURCE:"オーディオ/ビデオ のソースが見つかりません",MEDIA_ERR_ABORTED:"ユーザーによってフェッチプロセスが中止されました",MEDIA_ERR_NETWORK:"ダウンロード中にエラーが発生しました",MEDIA_ERR_DECODE:"デコード中にエラーが発生しました",MEDIA_ERR_SRC_NOT_SUPPORTED:"オーディオ/ビデオ の形式がサポートされていません",REPLAY:"リプレイ",ERROR:"ネットワークの接続に問題が発生しました",PLAY_TIPS:"プレイ",PAUSE_TIPS:"一時停止",PLAYNEXT_TIPS:"次をプレイ",DOWNLOAD_TIPS:"ダウンロード",ROTATE_TIPS:"回転",RELOAD_TIPS:"再読み込み",FULLSCREEN_TIPS:"フルスクリーン",EXITFULLSCREEN_TIPS:"フルスクリーンを終了",CSSFULLSCREEN_TIPS:"シアターモード",EXITCSSFULLSCREEN_TIPS:"シアターモードを終了",TEXTTRACK:"字幕",PIP:"ミニプレーヤー",SCREENSHOT:"スクリーンショット",LIVE:"生放送",OFF:"オフ",OPEN:"開いた",MINI_DRAG:"ボタンを押して働画をドラッグする",MINISCREEN:"小さな画面",REFRESH:"リフレッシュ",REFRESH_TIPS:"してみてください",FORWARD:"早送り",LIVE_TIP:"生放送"}},ea={LANG:"zh-hk",TEXT:{ERROR_TYPES:{network:{code:1,msg:"視頻下載錯誤"},mse:{code:2,msg:"流追加錯誤"},parse:{code:3,msg:"解析錯誤"},format:{code:4,msg:"格式錯誤"},decoder:{code:5,msg:"解碼錯誤"},runtime:{code:6,msg:"語法錯誤"},timeout:{code:7,msg:"播放超時"},other:{code:8,msg:"其他錯誤"}},HAVE_NOTHING:"沒有關於音頻/視頻是否就緒的信息",HAVE_METADATA:"音頻/視頻的元數據已就緒",HAVE_CURRENT_DATA:"關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒",HAVE_FUTURE_DATA:"當前及至少下壹幀的數據是可用的",HAVE_ENOUGH_DATA:"可用數據足以開始播放",NETWORK_EMPTY:"音頻/視頻尚未初始化",NETWORK_IDLE:"音頻/視頻是活動的且已選取資源,但並未使用網絡",NETWORK_LOADING:"瀏覽器正在下載數據",NETWORK_NO_SOURCE:"未找到音頻/視頻來源",MEDIA_ERR_ABORTED:"取回過程被用戶中止",MEDIA_ERR_NETWORK:"下載錯誤",MEDIA_ERR_DECODE:"解碼錯誤",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音頻/視頻格式",REPLAY:"重播",ERROR:"網絡連接似乎出現了問題",PLAY_TIPS:"播放",PAUSE_TIPS:"暫停",PLAYNEXT_TIPS:"下壹集",DOWNLOAD_TIPS:"下載",ROTATE_TIPS:"旋轉",RELOAD_TIPS:"重新載入",FULLSCREEN_TIPS:"進入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"進入樣式全屏",EXITCSSFULLSCREEN_TIPS:"退出樣式全屏",TEXTTRACK:"字幕",PIP:"畫中畫",SCREENSHOT:"截圖",LIVE:"正在直播",OFF:"關閉",OPEN:"開啟",MINI_DRAG:"點擊按住可拖動視頻",MINISCREEN:"小屏幕",REFRESH_TIPS:"請試試",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}};const ta="undefined"!=typeof window&&window.location&&window.location.href.indexOf("veplayerdebugger=1")>-1,ia="color: #fff; background-color: #5f5f5f;",na="color: #fff; background-color: #f53f3f;",ra="color: #fff; background-color: #ff7d00;",oa="color: #fff; background: #4281ff",sa="%c VePlayer %c 1.19.0-rc.1 ",aa={config:{debug:ta?3:1},log:function(e,...t){this.config.debug>=3&&console.log(sa,ia,oa,e,...t)},warn:function(e,...t){this.config.debug>=1&&console.warn(sa,ra,oa,e,...t)},error:function(e,...t){if(this.config.debug<1)return;const i=this.config.debug>=2?"trace":"error";console[i](sa,na,oa,e,...t)}};localStorage.getItem("velog")&&(aa.config.debug=3);var la={exports:{}};la.exports=function(){var e=1e3,t=6e4,i=36e5,n="millisecond",r="second",o="minute",s="hour",a="day",l="week",u="month",c="quarter",h="year",d="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],i=e%100;return"["+e+(t[(i-20)%10]||t[i]||t[0])+"]"}},v=function(e,t,i){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(i)+e},m={s:v,z:function(e){var t=-e.utcOffset(),i=Math.abs(t),n=Math.floor(i/60),r=i%60;return(t<=0?"+":"-")+v(n,2,"0")+":"+v(r,2,"0")},m:function e(t,i){if(t.date()<i.date())return-e(i,t);var n=12*(i.year()-t.year())+(i.month()-t.month()),r=t.clone().add(n,u),o=i-r<0,s=t.clone().add(n+(o?-1:1),u);return+(-(n+(i-r)/(o?r-s:s-r))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:u,y:h,w:l,d:a,D:d,h:s,m:o,s:r,ms:n,Q:c}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},_="en",E={};E[_]=y;var T=function(e){return e instanceof C},S=function e(t,i,n){var r;if(!t)return _;if("string"==typeof t){var o=t.toLowerCase();E[o]&&(r=o),i&&(E[o]=i,r=o);var s=t.split("-");if(!r&&s.length>1)return e(s[0])}else{var a=t.name;E[a]=t,r=a}return!n&&r&&(_=r),r||!n&&_},b=function(e,t){if(T(e))return e.clone();var i="object"==typeof t?t:{};return i.date=e,i.args=arguments,new C(i)},k=m;k.l=S,k.i=T,k.w=function(e,t){return b(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function y(e){this.$L=S(e.locale,null,!0),this.parse(e)}var v=y.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,i=e.utc;if(null===t)return new Date(NaN);if(k.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(f);if(n){var r=n[2]-1||0,o=(n[7]||"0").substring(0,3);return i?new Date(Date.UTC(n[1],r,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],r,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return k},v.isValid=function(){return!(this.$d.toString()===p)},v.isSame=function(e,t){var i=b(e);return this.startOf(t)<=i&&i<=this.endOf(t)},v.isAfter=function(e,t){return b(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<b(e)},v.$g=function(e,t,i){return k.u(e)?this[t]:this.set(i,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var i=this,n=!!k.u(t)||t,c=k.p(e),p=function(e,t){var r=k.w(i.$u?Date.UTC(i.$y,t,e):new Date(i.$y,t,e),i);return n?r:r.endOf(a)},f=function(e,t){return k.w(i.toDate()[e].apply(i.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),i)},g=this.$W,y=this.$M,v=this.$D,m="set"+(this.$u?"UTC":"");switch(c){case h:return n?p(1,0):p(31,11);case u:return n?p(1,y):p(0,y+1);case l:var _=this.$locale().weekStart||0,E=(g<_?g+7:g)-_;return p(n?v-E:v+(6-E),y);case a:case d:return f(m+"Hours",0);case s:return f(m+"Minutes",1);case o:return f(m+"Seconds",2);case r:return f(m+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var i,l=k.p(e),c="set"+(this.$u?"UTC":""),p=(i={},i[a]=c+"Date",i[d]=c+"Date",i[u]=c+"Month",i[h]=c+"FullYear",i[s]=c+"Hours",i[o]=c+"Minutes",i[r]=c+"Seconds",i[n]=c+"Milliseconds",i)[l],f=l===a?this.$D+(t-this.$W):t;if(l===u||l===h){var g=this.clone().set(d,1);g.$d[p](f),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[k.p(e)]()},v.add=function(n,c){var d,p=this;n=Number(n);var f=k.p(c),g=function(e){var t=b(p);return k.w(t.date(t.date()+Math.round(e*n)),p)};if(f===u)return this.set(u,this.$M+n);if(f===h)return this.set(h,this.$y+n);if(f===a)return g(1);if(f===l)return g(7);var y=(d={},d[o]=t,d[s]=i,d[r]=e,d)[f]||1,v=this.$d.getTime()+n*y;return k.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,i=this.$locale();if(!this.isValid())return i.invalidDate||p;var n=e||"YYYY-MM-DDTHH:mm:ssZ",r=k.z(this),o=this.$H,s=this.$m,a=this.$M,l=i.weekdays,u=i.months,c=function(e,i,r,o){return e&&(e[i]||e(t,n))||r[i].slice(0,o)},h=function(e){return k.s(o%12||12,e,"0")},d=i.meridiem||function(e,t,i){var n=e<12?"AM":"PM";return i?n.toLowerCase():n},f={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:k.s(a+1,2,"0"),MMM:c(i.monthsShort,a,u,3),MMMM:c(u,a),D:this.$D,DD:k.s(this.$D,2,"0"),d:String(this.$W),dd:c(i.weekdaysMin,this.$W,l,2),ddd:c(i.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(o),HH:k.s(o,2,"0"),h:h(1),hh:h(2),a:d(o,s,!0),A:d(o,s,!1),m:String(s),mm:k.s(s,2,"0"),s:String(this.$s),ss:k.s(this.$s,2,"0"),SSS:k.s(this.$ms,3,"0"),Z:r};return n.replace(g,(function(e,t){return t||f[e]||r.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(n,d,p){var f,g=k.p(d),y=b(n),v=(y.utcOffset()-this.utcOffset())*t,m=this-y,_=k.m(this,y);return _=(f={},f[h]=_/12,f[u]=_,f[c]=_/3,f[l]=(m-v)/6048e5,f[a]=(m-v)/864e5,f[s]=m/i,f[o]=m/t,f[r]=m/e,f)[g]||m,p?_:k.a(_)},v.daysInMonth=function(){return this.endOf(u).$D},v.$locale=function(){return E[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var i=this.clone(),n=S(e,t,!0);return n&&(i.$L=n),i},v.clone=function(){return k.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},y}(),I=C.prototype;return b.prototype=I,[["$ms",n],["$s",r],["$m",o],["$H",s],["$W",a],["$M",u],["$y",h],["$D",d]].forEach((function(e){I[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),b.extend=function(e,t){return e.$i||(e(t,C,b),e.$i=!0),b},b.locale=S,b.isDayjs=T,b.unix=function(e){return b(1e3*e)},b.en=E[_],b.Ls=E,b.p={},b}();const ua=lr(la.exports);var ca={exports:{}};!function(e,t){var i,n,r;e.exports=(i="minute",n=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g,function(e,t,o){var s=t.prototype;o.utc=function(e){return new t({date:e,utc:!0,args:arguments})},s.utc=function(e){var t=o(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),i):t},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),a.call(this,e)};var l=s.init;s.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else l.call(this)};var u=s.utcOffset;s.utcOffset=function(e,t){var o=this.$utils().u;if(o(e))return this.$u?0:o(this.$offset)?u.call(this):this.$offset;if("string"==typeof e&&null===(e=function(e){void 0===e&&(e="");var t=e.match(n);if(!t)return null;var i=(""+t[0]).match(r)||["-",0,0],o=i[0],s=60*+i[1]+ +i[2];return 0===s?0:"+"===o?s:-s}(e)))return this;var s=Math.abs(e)<=16?60*e:e,a=this;if(t)return a.$offset=s,a.$u=0===e,a;if(0!==e){var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(s+l,i)).$offset=s,a.$x.$localOffset=l}else a=this.utc();return a};var c=s.format;s.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,t)},s.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var h=s.toDate;s.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var d=s.diff;s.diff=function(e,t,i){if(e&&this.$u===e.$u)return d.call(this,e,t,i);var n=this.local(),r=o(e).local();return d.call(n,r,t,i)}})}(ca);const ha=lr(ca.exports);var da=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=22)}([function(e,t,i){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,i){var n=i(12)("wks"),r=i(13),o=i(0).Symbol,s="function"==typeof o;(e.exports=function(e){return n[e]||(n[e]=s&&o[e]||(s?o:r)("Symbol."+e))}).store=n},function(e,t,i){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,i){var n=i(4);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,i){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(e){return"object"===(void 0===e?"undefined":n(e))?null!==e:"function"==typeof e}},function(e,t,i){var n=i(6);e.exports=function(e,t,i){if(n(e),void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,n){return e.call(t,i,n)};case 3:return function(i,n,r){return e.call(t,i,n,r)}}return function(){return e.apply(t,arguments)}}},function(e,t,i){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,i){e.exports=!i(15)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,i){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,i){var n=i(3),r=i(26),o=i(27),s=Object.defineProperty;t.f=i(7)?Object.defineProperty:function(e,t,i){if(n(e),t=o(t,!0),n(i),r)try{return s(e,t,i)}catch(a){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(e[t]=i.value),e}},function(e,t,i){e.exports=!1},function(e,t,i){var n=i(8),r=i(1)("toStringTag"),o="Arguments"==n(function(){return arguments}());e.exports=function(e){var t,i,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=Object(e),r))?i:o?n(t):"Object"==(s=n(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,i){var n=i(2),r=i(0),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:i(10)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,i){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,i){var n=i(9),r=i(28);e.exports=i(7)?function(e,t,i){return n.f(e,t,r(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,i){var n=i(4),r=i(0).document,o=n(r)&&n(r.createElement);e.exports=function(e){return o?r.createElement(e):{}}},function(e,t,i){var n=i(0),r=i(14),o=i(18),s=i(13)("src"),a=i(29),l=(""+a).split("toString");i(2).inspectSource=function(e){return a.call(e)},(e.exports=function(e,t,i,a){var u="function"==typeof i;u&&(o(i,"name")||r(i,"name",t)),e[t]!==i&&(u&&(o(i,s)||r(i,s,e[t]?""+e[t]:l.join(String(t)))),e===n?e[t]=i:a?e[t]?e[t]=i:r(e,t,i):(delete e[t],r(e,t,i)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[s]||a.call(this)}))},function(e,t,i){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,i){e.exports={}},function(e,t,i){var n,r,o,s=i(5),a=i(38),l=i(39),u=i(16),c=i(0),h=c.process,d=c.setImmediate,p=c.clearImmediate,f=c.MessageChannel,g=c.Dispatch,y=0,v={},m=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},_=function(e){m.call(e.data)};d&&p||(d=function(e){for(var t=[],i=1;arguments.length>i;)t.push(arguments[i++]);return v[++y]=function(){a("function"==typeof e?e:Function(e),t)},n(y),y},p=function(e){delete v[e]},"process"==i(8)(h)?n=function(e){h.nextTick(s(m,e,1))}:g&&g.now?n=function(e){g.now(s(m,e,1))}:f?(o=(r=new f).port2,r.port1.onmessage=_,n=s(o.postMessage,o,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(e){c.postMessage(e+"","*")},c.addEventListener("message",_,!1)):n="onreadystatechange"in u("script")?function(e){l.appendChild(u("script")).onreadystatechange=function(){l.removeChild(this),m.call(e)}}:function(e){setTimeout(s(m,e,1),0)}),e.exports={set:d,clear:p}},function(e,t,i){var n=i(6);function r(e){var t,i;this.promise=new e((function(e,n){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=n})),this.resolve=n(t),this.reject=n(i)}e.exports.f=function(e){return new r(e)}},function(e,t,i){e.exports=i(23)},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),i(24);var n,r=(n=i(48))&&n.__esModule?n:{default:n};t.default={url:r.default},e.exports=t.default},function(e,t,i){var n,r,o,s,a=i(10),l=i(0),u=i(5),c=i(11),h=i(25),d=i(4),p=i(6),f=i(30),g=i(31),y=i(37),v=i(20).set,m=i(40)(),_=i(21),E=i(41),T=i(42),S=i(43),b=l.TypeError,k=l.process,C=k&&k.versions,I=C&&C.v8||"",A=l.Promise,P="process"==c(k),w=function(){},D=r=_.f,L=!!function(){try{var e=A.resolve(1),t=(e.constructor={})[i(1)("species")]=function(e){e(w,w)};return(P||"function"==typeof PromiseRejectionEvent)&&e.then(w)instanceof t&&0!==I.indexOf("6.6")&&-1===T.indexOf("Chrome/66")}catch(n){}}(),R=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},x=function(e,t){if(!e._n){e._n=!0;var i=e._c;m((function(){for(var n=e._v,r=1==e._s,o=0,s=function(t){var i,o,s,a=r?t.ok:t.fail,l=t.resolve,u=t.reject,c=t.domain;try{a?(r||(2==e._h&&M(e),e._h=1),!0===a?i=n:(c&&c.enter(),i=a(n),c&&(c.exit(),s=!0)),i===t.promise?u(b("Promise-chain cycle")):(o=R(i))?o.call(i,l,u):l(i)):u(n)}catch(h){c&&!s&&c.exit(),u(h)}};i.length>o;)s(i[o++]);e._c=[],e._n=!1,t&&!e._h&&O(e)}))}},O=function(e){v.call(l,(function(){var t,i,n,r=e._v,o=N(e);if(o&&(t=E((function(){P?k.emit("unhandledRejection",r,e):(i=l.onunhandledrejection)?i({promise:e,reason:r}):(n=l.console)&&n.error&&n.error("Unhandled promise rejection",r)})),e._h=P||N(e)?2:1),e._a=void 0,o&&t.e)throw t.v}))},N=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){v.call(l,(function(){var t;P?k.emit("rejectionHandled",e):(t=l.onrejectionhandled)&&t({promise:e,reason:e._v})}))},U=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),x(t,!0))},B=function e(t){var i,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw b("Promise can't be resolved itself");(i=R(t))?m((function(){var r={_w:n,_d:!1};try{i.call(t,u(e,r,1),u(U,r,1))}catch(o){U.call(r,o)}})):(n._v=t,n._s=1,x(n,!1))}catch(r){U.call({_w:n,_d:!1},r)}}};L||(A=function(e){f(this,A,"Promise","_h"),p(e),n.call(this);try{e(u(B,this,1),u(U,this,1))}catch(t){U.call(this,t)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=i(44)(A.prototype,{then:function(e,t){var i=D(y(this,A));return i.ok="function"!=typeof e||e,i.fail="function"==typeof t&&t,i.domain=P?k.domain:void 0,this._c.push(i),this._a&&this._a.push(i),this._s&&x(this,!1),i.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new n;this.promise=e,this.resolve=u(B,e,1),this.reject=u(U,e,1)},_.f=D=function(e){return e===A||e===s?new o(e):r(e)}),h(h.G+h.W+h.F*!L,{Promise:A}),i(45)(A,"Promise"),i(46)("Promise"),s=i(2).Promise,h(h.S+h.F*!L,"Promise",{reject:function(e){var t=D(this);return(0,t.reject)(e),t.promise}}),h(h.S+h.F*(a||!L),"Promise",{resolve:function(e){return S(a&&this===s?A:this,e)}}),h(h.S+h.F*!(L&&i(47)((function(e){A.all(e).catch(w)}))),"Promise",{all:function(e){var t=this,i=D(t),n=i.resolve,r=i.reject,o=E((function(){var i=[],o=0,s=1;g(e,!1,(function(e){var a=o++,l=!1;i.push(void 0),s++,t.resolve(e).then((function(e){l||(l=!0,i[a]=e,--s||n(i))}),r)})),--s||n(i)}));return o.e&&r(o.v),i.promise},race:function(e){var t=this,i=D(t),n=i.reject,r=E((function(){g(e,!1,(function(e){t.resolve(e).then(i.resolve,n)}))}));return r.e&&n(r.v),i.promise}})},function(e,t,i){var n=i(0),r=i(2),o=i(14),s=i(17),a=i(5),l=function e(t,i,l){var u,c,h,d,p=t&e.F,f=t&e.G,g=t&e.P,y=t&e.B,v=f?n:t&e.S?n[i]||(n[i]={}):(n[i]||{}).prototype,m=f?r:r[i]||(r[i]={}),_=m.prototype||(m.prototype={});for(u in f&&(l=i),l)h=((c=!p&&v&&void 0!==v[u])?v:l)[u],d=y&&c?a(h,n):g&&"function"==typeof h?a(Function.call,h):h,v&&s(v,u,h,t&e.U),m[u]!=h&&o(m,u,d),g&&_[u]!=h&&(_[u]=h)};n.core=r,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,i){e.exports=!i(7)&&!i(15)((function(){return 7!=Object.defineProperty(i(16)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,i){var n=i(4);e.exports=function(e,t){if(!n(e))return e;var i,r;if(t&&"function"==typeof(i=e.toString)&&!n(r=i.call(e)))return r;if("function"==typeof(i=e.valueOf)&&!n(r=i.call(e)))return r;if(!t&&"function"==typeof(i=e.toString)&&!n(r=i.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t,i){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,i){e.exports=i(12)("native-function-to-string",Function.toString)},function(e,t,i){e.exports=function(e,t,i,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(i+": incorrect invocation!");return e}},function(e,t,i){var n=i(5),r=i(32),o=i(33),s=i(3),a=i(34),l=i(36),u={},c={},h=e.exports=function(e,t,i,h,d){var p,f,g,y,v=d?function(){return e}:l(e),m=n(i,h,t?2:1),_=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(o(v)){for(p=a(e.length);p>_;_++)if((y=t?m(s(f=e[_])[0],f[1]):m(e[_]))===u||y===c)return y}else for(g=v.call(e);!(f=g.next()).done;)if((y=r(g,m,f.value,t))===u||y===c)return y};h.BREAK=u,h.RETURN=c},function(e,t,i){var n=i(3);e.exports=function(e,t,i,r){try{return r?t(n(i)[0],i[1]):t(i)}catch(s){var o=e.return;throw void 0!==o&&n(o.call(e)),s}}},function(e,t,i){var n=i(19),r=i(1)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||o[r]===e)}},function(e,t,i){var n=i(35),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},function(e,t,i){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,i){var n=i(11),r=i(1)("iterator"),o=i(19);e.exports=i(2).getIteratorMethod=function(e){if(null!=e)return e[r]||e["@@iterator"]||o[n(e)]}},function(e,t,i){var n=i(3),r=i(6),o=i(1)("species");e.exports=function(e,t){var i,s=n(e).constructor;return void 0===s||null==(i=n(s)[o])?t:r(i)}},function(e,t,i){e.exports=function(e,t,i){var n=void 0===i;switch(t.length){case 0:return n?e():e.call(i);case 1:return n?e(t[0]):e.call(i,t[0]);case 2:return n?e(t[0],t[1]):e.call(i,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(i,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(i,t[0],t[1],t[2],t[3])}return e.apply(i,t)}},function(e,t,i){var n=i(0).document;e.exports=n&&n.documentElement},function(e,t,i){var n=i(0),r=i(20).set,o=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,l="process"==i(8)(s);e.exports=function(){var e,t,i,u=function(){var n,r;for(l&&(n=s.domain)&&n.exit();e;){r=e.fn,e=e.next;try{r()}catch(o){throw e?i():t=void 0,o}}t=void 0,n&&n.enter()};if(l)i=function(){s.nextTick(u)};else if(!o||n.navigator&&n.navigator.standalone)if(a&&a.resolve){var c=a.resolve(void 0);i=function(){c.then(u)}}else i=function(){r.call(n,u)};else{var h=!0,d=document.createTextNode("");new o(u).observe(d,{characterData:!0}),i=function(){d.data=h=!h}}return function(n){var r={fn:n,next:void 0};t&&(t.next=r),e||(e=r,i()),t=r}}},function(e,t,i){e.exports=function(e){try{return{e:!1,v:e()}}catch(t){return{e:!0,v:t}}}},function(e,t,i){var n=i(0).navigator;e.exports=n&&n.userAgent||""},function(e,t,i){var n=i(3),r=i(4),o=i(21);e.exports=function(e,t){if(n(e),r(t)&&t.constructor===e)return t;var i=o.f(e);return(0,i.resolve)(t),i.promise}},function(e,t,i){var n=i(17);e.exports=function(e,t,i){for(var r in t)n(e,r,t[r],i);return e}},function(e,t,i){var n=i(9).f,r=i(18),o=i(1)("toStringTag");e.exports=function(e,t,i){e&&!r(e=i?e:e.prototype,o)&&n(e,o,{configurable:!0,value:t})}},function(e,t,i){var n=i(0),r=i(9),o=i(7),s=i(1)("species");e.exports=function(e){var t=n[e];o&&t&&!t[s]&&r.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,i){var n=i(1)("iterator"),r=!1;try{var o=[7][n]();o.return=function(){r=!0},Array.from(o,(function(){throw 2}))}catch(s){}e.exports=function(e,t){if(!t&&!r)return!1;var i=!1;try{var o=[7],s=o[n]();s.next=function(){return{done:i=!0}},o[n]=function(){return s},e(o)}catch(a){}return i}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e||!t)return Promise.reject("vid, host and token can't be empty");var a=void 0;try{a=(0,o.getUri)(e,t,i,r)}catch(l){return Promise.reject(l.message)}return new s.default({type:"json",method:"GET",url:a}).then((function(e){var t=void 0;if(e&&e.response)switch(n(e.response)){case"string":t=JSON.parse(e.response).Result;break;case"object":t=e.response.Result;break;default:t=e.response}else t=e;return t}))};var r,o=i(49),s=(r=i(51))&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.getUri=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments[3];try{e=JSON.parse((0,n.decode)(e))}catch(a){throw new Error("base64 decode error: "+a.message)}!1===o.jointSsl||r(i,"ssl")||r(i,"Ssl")||(i.Ssl=1);var s=(/^http/.test(t)?t:"//"+t)+"?"+e.GetPlayInfoToken+function(e){var t=[];for(var i in e)r(e,i)&&t.push(i+"="+e[i]);return t.length>0?"&"+t.join("&"):""}(i);return s};var n=i(50),r=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){var t=void 0,i=void 0,n=void 0,r=void 0,o=void 0,s=void 0,a=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],l=e.length;for(o=0,s="";o<l;){do{t=a[255&e.charCodeAt(o++)]}while(o<l&&-1===t);if(-1===t)break;do{i=a[255&e.charCodeAt(o++)]}while(o<l&&-1===i);if(-1===i)break;s+=String.fromCharCode(t<<2|(48&i)>>4);do{if(61==(n=255&e.charCodeAt(o++)))return s;n=a[n]}while(o<l&&-1===n);if(-1===n)break;s+=String.fromCharCode((15&i)<<4|(60&n)>>2);do{if(61==(r=255&e.charCodeAt(o++)))return s;r=a[r]}while(o<l&&-1===r);if(-1===r)break;s+=String.fromCharCode((3&n)<<6|r)}return s}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i=t.url,n=t.method,r=void 0===n?"GET":n,o=t.data,s=void 0===o?{}:o,a=t.headers,l=void 0===a?{}:a;return new Promise((function(e,t){var n=new window.XMLHttpRequest,o=r.toUpperCase(),a=[];if("GET"!==o)throw new Error("xhr "+o+" is not supported");for(var u in s)a.push(u+"="+s[u]);for(var c in n.open(o,""+i,!0),n.responseType="",l)Object.prototype.hasOwnProperty.call(l,c)&&n.setRequestHeader(c,""+l[c]);n.onload=function(){200===n.status||206===n.status?e(n):t(n)},n.onerror=n.ontimeout=function(){return t(n)},n.send()}))},e.exports=t.default}]);const pa=lr(da);ua.extend(ha);var fa=(e=>(e.VIDEO="video",e.EVIDEO="evideo",e.DRM_EVIDEO="drm_evideo",e))(fa||{});function ga(e){try{return JSON.parse(e)}catch(t){return aa.warn(`[utils/json] decode fail: ${e}`,t),null}}function ya(e,t="GetPlayInfoToken"){if(!e)return;const i={},n=ga(window.atob(e));if(n&&"string"==typeof n[t]){n[t].split("&").map((e=>{const t=e.split("=");t[0]&&t[1]&&(i[t[0]]=t[1])}))}return i}function va(e){const t={};return decodeURIComponent(e).split("&").map((e=>{const i=e.split("=");i[0]&&i[1]&&(t[decodeURIComponent(i[0])]=decodeURIComponent(i[1]))})),t}const ma=e=>{var t,i,n;if(!(null==e?void 0:e.playAuthToken))return;const r=ya(null==e?void 0:e.playAuthToken),o=null!=(i=null==(t=null==r?void 0:r.FileType)?void 0:t.toLowerCase())?i:"video",s=null==(n=null==r?void 0:r.Format)?void 0:n.toLowerCase();return s||(Object.values(fa).includes(o)?nr.MP4:rr.M4A)},_a=function(e){if(!e["X-Expires"]||!e["X-Date"])return!1;const t=parseInt(e["X-Expires"]);if(isNaN(t))return!1;const i=e["X-Date"].replace(/T/g," ").replace(/Z/g,""),n=ua.utc(i,"YYYYMMDD hhmmss");if(!n.isValid())return!1;return n.add(t,"seconds").isBefore(ua())};function Ea(e,t){const i=["240p","360p","480p","540p","720p","1080p","2k","4k","od","oe"],n=e.Definition,r=t.Definition;if(i.includes(n)&&i.includes(r)){const e=i.findIndex((e=>e.toLocaleLowerCase()===n.toLocaleLowerCase()));return i.findIndex((e=>e.toLocaleLowerCase()===r.toLocaleLowerCase()))-e}return t.Bitrate&&e.Bitrate?t.Bitrate-e.Bitrate:-1}function Ta(e){const{playAuthToken:t,playDomain:i,reqParams:n={},definitionMap:r,needThumbs:o=!1,needBarrageMask:s=!1,autoDemoteDefinition:a,autoDemoteDefinitionTextKey:l,urlQueryParams:h}=e;if(t){const e=c(u({},n),{NeedThumbs:o?1:0,NeedBarrageMask:s?1:0});return new Promise(((n,o)=>{pa.url(t,i,e).then((e=>{var t;const{Status:i,PlayInfoList:o=[],PosterUrl:s,Vid:d,Duration:p,BarrageMaskUrl:f,ThumbInfoList:g=[],EnableAdaptive:y,AdaptiveBitrateStreamingInfo:v}=e.Data||e;if(i===Xs.VALID&&o.length){const i=o.map((e=>{var t;const i=h?Ga(e.MainPlayUrl,h):e.MainPlayUrl,n=h?Ga(e.BackupPlayUrl,h):e.BackupPlayUrl;return u(u({vid:d,url:i,_mainURL:i,_backupURL:n,streamType:e.Format,backupUrl:n,backUrlList:[n],fileType:e.FileType,format:e.Format,bitrate:e.Bitrate,size:e.Size,kid:e.PlayAuthId,playAuthId:e.PlayAuthId,playAuth:e.PlayAuth,secretKey:e.PlayAuth,vwidth:e.Width,vheight:e.Height,vtype:null==(t=e.Format)?void 0:t.toLocaleUpperCase(),codec:e.Codec,urlExpireTimestamp:nl(e.MainUrlExpire,10,qs),drmType:e.DrmType},e),Ua(e,{definitionMap:r,autoDemoteDefinition:a,autoDemoteDefinitionTextKey:l}))})).sort(Ea);n({playList:i,type:null==(t=i[0])?void 0:t.Format,poster:s,vid:d,duration:p,dashOpts:e.Data?e:{Data:c(u({},e),{VideoID:d})},thumbs:g,barrageMaskUrl:f,enableAdaptive:y,adaptiveBitrateStreamingInfo:v})}else n({playList:[],poster:s,vid:d,duration:p,dashOpts:e.Data?e:{Data:e},thumbs:g,barrageMaskUrl:f,enableAdaptive:y,adaptiveBitrateStreamingInfo:v}),aa.error("HAS NO VIDEO INFORMATION CORRECTLY, PLEASE CHECK THE TOKEN.")})).catch((e=>{aa.log("err",e),o(e)}))}))}return Promise.resolve(void 0)}function Sa(e,t,i,n){return d(this,null,(function*(){try{return yield e()}catch(r){if(--t&&i(r))return Sa(e,t,i,n);if(n&&"function"==typeof n)return yield n(r);throw r}}))}function ba(e,t,i,n){return i+"/?"+n+"&"+tl({ThirdPartyDrmType:e,Kid:t})}const ka="__veplayer_";function Ca(e,t="",i){if(!e)return;const n=ka+t+"_"+e;localStorage.setItem(n,i+"")}function Ia(e,t=""){if(!e)return;const i=ka+t+"_"+e;return localStorage.getItem(i)}function Aa(){var e,t;try{const i=null==(t=null==(e=globalThis.crypto)?void 0:e.randomUUID)?void 0:t.call(e);if("string"==typeof i&&i.length>0)return i}catch(i){}return`ve_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,14)}`}function Pa(e){if(!e)return Aa();const t=`line_user_${encodeURIComponent(e)}`;try{const e=Ia(t,"ttdrama");if(e)return e;const i=Aa();return Ca(t,"ttdrama",i),i}catch(i){return Aa()}}function wa(){try{return Math.round(window.performance.now())}catch(e){return(new Date).getTime()}}var Da=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.ERROR=-1]="ERROR",e[e.TIMEOUT=-2]="TIMEOUT",e))(Da||{});function La(e,t){return new Promise(((i,n)=>{try{e||n(new Error("url is undefined"));let r=wa();const o=r,s=new window.XMLHttpRequest,a={status:0,statusText:"",connectTime:0,raw:s};s.open("get",e),s.onreadystatechange=()=>{2===s.readyState&&(a.headers=function(e){const t={};if(e instanceof window.XMLHttpRequest)try{e.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((function(e){const i=e.split(": "),n=i.shift();t[n]=i.join(": ")}))}catch(i){return t}return t}(s),a.connectTime=wa()-o,a.status=s.status,a.statusText=s.statusText,r=wa())},s.onload=()=>{a.response=s.response,i(a)},s.onprogress=e=>{const t=wa()-r;let i=0;i=parseInt(""+e.loaded/1e3/(t/1e3),10),a.speed=0|i,a.costTime=t},s.onerror=()=>{a.status||(a.status=-1,a.costTime=wa()-r),n(a)},s.ontimeout=()=>{a.status||(a.status=-2,a.costTime=wa()-r),i(a)},s.onabort=()=>{i(a)},(null==t?void 0:t.type)&&(s.responseType=t.type),s.timeout=(null==t?void 0:t.timeout)||1e4,s.setRequestHeader("Range",`bytes=${(null==t?void 0:t.range)||"0-1048576"}`),s.send()}catch(r){n(r)}}))}function Ra(e){var t,i,n;if(e.url)return(null==(i=null==(t=null==e?void 0:e.plugins)?void 0:t.encrypthlsplugin)?void 0:i.hls)||(null==(n=null==e?void 0:e.plugins)?void 0:n.mp4encryptplayer)?1:+Ur.isMSE(e.media)}function xa(e){return Number.isFinite(e)?Math.max(0,Math.round(e)):0}class Oa{constructor(){this.timings=[],this.timingMap={},this.now=function(){const e=globalThis.performance;return(null==e?void 0:e.now)&&"function"==typeof e.now?()=>e.now():()=>Date.now()}(),this.startAt=this.now()}markDuration(e,t){const i=xa(t);this.timings.push({name:e,duration:i}),this.timingMap[e]=i}measure(e,t){const i=this.now();try{return t()}finally{this.markDuration(e,this.now()-i)}}measureAsync(e,t){return d(this,null,(function*(){const i=this.now();try{return yield t()}finally{this.markDuration(e,this.now()-i)}}))}finish(){return{totalDuration:xa(this.now()-this.startAt),timings:[...this.timings],timingMap:u({},this.timingMap)}}}let Na;const Ma=()=>Na,Ua=function(e,t){var i;const{definitionMap:n,autoDemoteDefinition:r,autoDemoteDefinitionTextKey:o}=t||{};if(!e)return{definition:"240P"};const s=e,a=s.Definition||s.Quality||s.definition||s.quality;if(!a)return{definition:"240P"};if(n){let e={definition:a};const t=n[a];return e=t?"string"==typeof t?{definition:t}:u({definition:a},t||{}):{definition:a},r&&r.toLocaleLowerCase()===(null==(i=null==e?void 0:e.definition)?void 0:i.toLocaleLowerCase())&&(e={definition:"auto",definitionTextKey:o,mapDefinition:e.definition}),e}return{definition:a}};const Ba=class{constructor(){this.timeID=null,this.func=null}repeat(e,t){this.timeID=1,this.repeatInterval(e,t)}repeatInterval(e,t){this.timeID&&(null===this.func&&(this.func=e),this.func===e&&(this.timeID&&clearTimeout(this.timeID),this.timeID=null,this.timeID=setTimeout((()=>{e(),this.repeatInterval(e,t)}),t)))}clear(){clearTimeout(this.timeID),this.timeID=null}},Ha='video/mp4; codecs="avc1.42E01E,mp4a.40.2"',Fa=['video/mp4;codecs="hev1.1.6.L120.90"','video/mp4;codecs="hev1.2.4.L120.90"','video/mp4;codecs="hev1.3.E.L120.90"','video/mp4;codecs="hev1.4.10.L120.90"'],ja={mp4:["video/mp4","audio/mp4"],hls:["application/vnd.apple.mpegurl","application/x-mpegurl","audio/mpegurl"],webm:["audio/webm","video/webm"],mov:["video/quicktime"]};function Va(e){var t;let i;if(Array.isArray(e)&&e.length){if(e[0].type){let e="";for(const t of Object.entries(ja)){const[i,n]=t;if(n.includes(i)){e=i;break}}if(e)return e}i=null==(t=e[0])?void 0:t.src}else i="string"==typeof e?e:"";return function(e){return e&&0<e.toLowerCase().indexOf(".m3u8")}(i)?"hls":function(e){return e&&0<e.toLowerCase().indexOf(".flv")}(i)?"flv":function(e){return e&&0<e.toLowerCase().indexOf(".mp4")}(i)?"mp4":function(e){return e&&0<e.toLowerCase().indexOf(".mpd")}(i)?"dash":"mp4"}function Ka(e){return e&&e.then?e:Promise.resolve(e)}const Ga=(e,t)=>t?e+=(-1===e.indexOf("?")?"?":"&")+tl(t):e,Wa=(e,t)=>{if(!t||!e)return;let i;return Object.keys(e).map((n=>{n.toLowerCase()===t.toLowerCase()&&(i=e[n])})),i};function Ya(){let e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return"zh-cn"!==e&&"cn"!==e||(e="zh"),e}function za(e,t=200,i=""){let n=setTimeout((()=>{i&&aa.warn(i),n=null}),t);return e.then?e.then((()=>clearTimeout(n))):(clearTimeout(n),n=null),e}function $a(e,t=1,i=0){return new Promise(((n,r)=>{e().then(n).catch((o=>{setTimeout((()=>{1!==t?$a(e,t-1,i).then(n,r):r(o)}),i)}))}))}function Xa(e='video/mp4; codecs="avc1.42E01E,mp4a.40.2"'){if(!window.MediaSource)return!1;try{return window.MediaSource.isTypeSupported(e)}catch(t){return aa.error("mse error",t),!1}}function qa(e="h264"){return void 0!==window.ManagedMediaSource&&("h264"===e?window.ManagedMediaSource.isTypeSupported(Ha):"h265"===e?Fa.some((e=>window.ManagedMediaSource.isTypeSupported(e))):window.ManagedMediaSource.isTypeSupported(e))}const Qa="undefined"!=typeof window,Za=Qa&&navigator.userAgent.toLocaleLowerCase(),Ja=Qa&&/^((?!chrome|android).)*safari/.test(Za);function el(e,t){const i={sg:{__LOG_TEA_ID__:323254,__LOG_CHANNEL__:"sg",__LOG_CUSTOM_REGION__:"byteplus",__LOG_CHANNEL_DOMAIN__:"https://mcs-nontt.byteintlapi.com",__UMD_PRE_PATH__:"https://sf-unpkg.bytepluscdn.com/obj/byteplusfe-sg/sdk/@byteplus/veplayer/1.19.0-rc.1/plugin"}},n=t||"sg";return e&&i[e]||i[n]}function tl(e){return Object.entries(e).map((([e,t])=>Array.isArray(t)?t.map((t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&"):`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&")}function il(e){var t;return"string"==typeof e?e:null==(t=null==e?void 0:e[0])?void 0:t.src}function nl(e,t=10,i=0){const n=parseInt(e,t);return Number.isNaN(n)?i:n}function rl(e){var t,i,n,r,o,s,a;const l=e.getPlugin("drm"),u=e.getPlugin("EncryptHlsPlugin"),c=e.getPlugin("Mp4EncryptPlayer"),h=e.getPlugin("DASHPlugin"),d=(null==(t=null==u?void 0:u.config)?void 0:t.drmKeyToken)||(null==(i=null==c?void 0:c.config)?void 0:i.drmKeyToken)||(null==(n=null==h?void 0:h.config)?void 0:n.drmKeyToken),p=((null==(r=null==u?void 0:u.config)?void 0:r.drmType)||(null==(o=null==c?void 0:c.config)?void 0:o.drmType)||(null==(s=null==h?void 0:h.config)?void 0:s.drmType))===or.PRIVATE_ENCRYPT_UPGRADE,f=null==(a=null==u?void 0:u.config)?void 0:a.keyToken;return l?or.DRM_ENCRYPT:d?or.PRIVATE_ENCRYPT:f?or.STANDARD_ENCRYPT:p?or.PRIVATE_ENCRYPT_UPGRADE:void 0}function ol(e){var t,i,n,r;const o=null==(i=null==(t=null==e?void 0:e.plugins)?void 0:t.encrypthlsplugin)?void 0:i._playOriginalUrl,s=null==(n=null==e?void 0:e.curDefinition)?void 0:n.main_url;return o||s||(null==(r=e.curDefinition)?void 0:r.url)||e.config.url}const sl=/["'&<>]/;function al(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function ll(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?al(Object(i),!0).forEach((function(t){pl(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):al(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function ul(e){return(ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hl(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,gl(n.key),n)}}function dl(e,t,i){return t&&hl(e.prototype,t),i&&hl(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function pl(e,t,i){return(t=gl(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function fl(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)i=o[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)i=o[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function gl(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var yl=function(e){return e&&e.Math==Math&&e},vl=yl("object"==typeof globalThis&&globalThis)||yl("object"==typeof window&&window)||yl("object"==typeof self&&self)||yl("object"==typeof ar&&ar)||function(){return this}()||Function("return this")(),ml={},_l=function(e){try{return!!e()}catch(t){return!0}},El=!_l((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Tl=!_l((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Sl=Tl,bl=Function.prototype.call,kl=Sl?bl.bind(bl):function(){return bl.apply(bl,arguments)},Cl={},Il={}.propertyIsEnumerable,Al=Object.getOwnPropertyDescriptor,Pl=Al&&!Il.call({1:2},1);Cl.f=Pl?function(e){var t=Al(this,e);return!!t&&t.enumerable}:Il;var wl,Dl,Ll=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Rl=Tl,xl=Function.prototype,Ol=xl.call,Nl=Rl&&xl.bind.bind(Ol,Ol),Ml=Rl?Nl:function(e){return function(){return Ol.apply(e,arguments)}},Ul=Ml,Bl=Ul({}.toString),Hl=Ul("".slice),Fl=function(e){return Hl(Bl(e),8,-1)},jl=_l,Vl=Fl,Kl=Object,Gl=Ml("".split),Wl=jl((function(){return!Kl("z").propertyIsEnumerable(0)}))?function(e){return"String"==Vl(e)?Gl(e,""):Kl(e)}:Kl,Yl=function(e){return null==e},zl=Yl,$l=TypeError,Xl=function(e){if(zl(e))throw $l("Can't call method on "+e);return e},ql=Wl,Ql=Xl,Zl=function(e){return ql(Ql(e))},Jl="object"==typeof document&&document.all,eu={all:Jl,IS_HTMLDDA:void 0===Jl&&void 0!==Jl},tu=eu.all,iu=eu.IS_HTMLDDA?function(e){return"function"==typeof e||e===tu}:function(e){return"function"==typeof e},nu=iu,ru=eu.all,ou=eu.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:nu(e)||e===ru}:function(e){return"object"==typeof e?null!==e:nu(e)},su=vl,au=iu,lu=function(e,t){return arguments.length<2?(i=su[e],au(i)?i:void 0):su[e]&&su[e][t];var i},uu=Ml({}.isPrototypeOf),cu=lu("navigator","userAgent")||"",hu=vl,du=cu,pu=hu.process,fu=hu.Deno,gu=pu&&pu.versions||fu&&fu.version,yu=gu&&gu.v8;yu&&(Dl=(wl=yu.split("."))[0]>0&&wl[0]<4?1:+(wl[0]+wl[1])),!Dl&&du&&(!(wl=du.match(/Edge\/(\d+)/))||wl[1]>=74)&&(wl=du.match(/Chrome\/(\d+)/))&&(Dl=+wl[1]);var vu=Dl,mu=vu,_u=_l,Eu=!!Object.getOwnPropertySymbols&&!_u((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&mu&&mu<41})),Tu=Eu&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Su=lu,bu=iu,ku=uu,Cu=Object,Iu=Tu?function(e){return"symbol"==typeof e}:function(e){var t=Su("Symbol");return bu(t)&&ku(t.prototype,Cu(e))},Au=String,Pu=function(e){try{return Au(e)}catch(t){return"Object"}},wu=iu,Du=Pu,Lu=TypeError,Ru=function(e){if(wu(e))return e;throw Lu(Du(e)+" is not a function")},xu=Ru,Ou=Yl,Nu=function(e,t){var i=e[t];return Ou(i)?void 0:xu(i)},Mu=kl,Uu=iu,Bu=ou,Hu=TypeError,Fu={exports:{}},ju=vl,Vu=Object.defineProperty,Ku=function(e,t){try{Vu(ju,e,{value:t,configurable:!0,writable:!0})}catch(i){ju[e]=t}return t},Gu=Ku,Wu="__core-js_shared__",Yu=vl[Wu]||Gu(Wu,{}),zu=Yu;(Fu.exports=function(e,t){return zu[e]||(zu[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var $u=Fu.exports,Xu=Xl,qu=Object,Qu=function(e){return qu(Xu(e))},Zu=Qu,Ju=Ml({}.hasOwnProperty),ec=Object.hasOwn||function(e,t){return Ju(Zu(e),t)},tc=Ml,ic=0,nc=Math.random(),rc=tc(1..toString),oc=function(e){return"Symbol("+(void 0===e?"":e)+")_"+rc(++ic+nc,36)},sc=vl,ac=ec,lc=oc,uc=Eu,cc=Tu,hc=$u("wks"),dc=sc.Symbol,pc=dc&&dc.for,fc=cc?dc:dc&&dc.withoutSetter||lc,gc=function(e){if(!ac(hc,e)||!uc&&"string"!=typeof hc[e]){var t="Symbol."+e;uc&&ac(dc,e)?hc[e]=dc[e]:hc[e]=cc&&pc?pc(t):fc(t)}return hc[e]},yc=kl,vc=ou,mc=Iu,_c=Nu,Ec=function(e,t){var i,n;if("string"===t&&Uu(i=e.toString)&&!Bu(n=Mu(i,e)))return n;if(Uu(i=e.valueOf)&&!Bu(n=Mu(i,e)))return n;if("string"!==t&&Uu(i=e.toString)&&!Bu(n=Mu(i,e)))return n;throw Hu("Can't convert object to primitive value")},Tc=TypeError,Sc=gc("toPrimitive"),bc=function(e,t){if(!vc(e)||mc(e))return e;var i,n=_c(e,Sc);if(n){if(void 0===t&&(t="default"),i=yc(n,e,t),!vc(i)||mc(i))return i;throw Tc("Can't convert object to primitive value")}return void 0===t&&(t="number"),Ec(e,t)},kc=bc,Cc=Iu,Ic=function(e){var t=kc(e,"string");return Cc(t)?t:t+""},Ac=ou,Pc=vl.document,wc=Ac(Pc)&&Ac(Pc.createElement),Dc=function(e){return wc?Pc.createElement(e):{}},Lc=Dc,Rc=!El&&!_l((function(){return 7!=Object.defineProperty(Lc("div"),"a",{get:function(){return 7}}).a})),xc=El,Oc=kl,Nc=Cl,Mc=Ll,Uc=Zl,Bc=Ic,Hc=ec,Fc=Rc,jc=Object.getOwnPropertyDescriptor;ml.f=xc?jc:function(e,t){if(e=Uc(e),t=Bc(t),Fc)try{return jc(e,t)}catch(i){}if(Hc(e,t))return Mc(!Oc(Nc.f,e,t),e[t])};var Vc={},Kc=El&&_l((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Gc=ou,Wc=String,Yc=TypeError,zc=function(e){if(Gc(e))return e;throw Yc(Wc(e)+" is not an object")},$c=El,Xc=Rc,qc=Kc,Qc=zc,Zc=Ic,Jc=TypeError,eh=Object.defineProperty,th=Object.getOwnPropertyDescriptor,ih="enumerable",nh="configurable",rh="writable";Vc.f=$c?qc?function(e,t,i){if(Qc(e),t=Zc(t),Qc(i),"function"==typeof e&&"prototype"===t&&"value"in i&&rh in i&&!i[rh]){var n=th(e,t);n&&n[rh]&&(e[t]=i.value,i={configurable:nh in i?i[nh]:n[nh],enumerable:ih in i?i[ih]:n[ih],writable:!1})}return eh(e,t,i)}:eh:function(e,t,i){if(Qc(e),t=Zc(t),Qc(i),Xc)try{return eh(e,t,i)}catch(n){}if("get"in i||"set"in i)throw Jc("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var oh=Vc,sh=Ll,ah=El?function(e,t,i){return oh.f(e,t,sh(1,i))}:function(e,t,i){return e[t]=i,e},lh={exports:{}},uh=El,ch=ec,hh=Function.prototype,dh=uh&&Object.getOwnPropertyDescriptor,ph=ch(hh,"name"),fh={EXISTS:ph,PROPER:ph&&"something"===function(){}.name,CONFIGURABLE:ph&&(!uh||uh&&dh(hh,"name").configurable)},gh=iu,yh=Yu,vh=Ml(Function.toString);gh(yh.inspectSource)||(yh.inspectSource=function(e){return vh(e)});var mh,_h,Eh,Th=yh.inspectSource,Sh=iu,bh=vl.WeakMap,kh=Sh(bh)&&/native code/.test(String(bh)),Ch=oc,Ih=$u("keys"),Ah=function(e){return Ih[e]||(Ih[e]=Ch(e))},Ph={},wh=kh,Dh=vl,Lh=ou,Rh=ah,xh=ec,Oh=Yu,Nh=Ah,Mh=Ph,Uh="Object already initialized",Bh=Dh.TypeError,Hh=Dh.WeakMap;if(wh||Oh.state){var Fh=Oh.state||(Oh.state=new Hh);Fh.get=Fh.get,Fh.has=Fh.has,Fh.set=Fh.set,mh=function(e,t){if(Fh.has(e))throw Bh(Uh);return t.facade=e,Fh.set(e,t),t},_h=function(e){return Fh.get(e)||{}},Eh=function(e){return Fh.has(e)}}else{var jh=Nh("state");Mh[jh]=!0,mh=function(e,t){if(xh(e,jh))throw Bh(Uh);return t.facade=e,Rh(e,jh,t),t},_h=function(e){return xh(e,jh)?e[jh]:{}},Eh=function(e){return xh(e,jh)}}var Vh={set:mh,get:_h,has:Eh,enforce:function(e){return Eh(e)?_h(e):mh(e,{})},getterFor:function(e){return function(t){var i;if(!Lh(t)||(i=_h(t)).type!==e)throw Bh("Incompatible receiver, "+e+" required");return i}}},Kh=_l,Gh=iu,Wh=ec,Yh=El,zh=fh.CONFIGURABLE,$h=Th,Xh=Vh.enforce,qh=Vh.get,Qh=Object.defineProperty,Zh=Yh&&!Kh((function(){return 8!==Qh((function(){}),"length",{value:8}).length})),Jh=String(String).split("String"),ed=lh.exports=function(e,t,i){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Wh(e,"name")||zh&&e.name!==t)&&(Yh?Qh(e,"name",{value:t,configurable:!0}):e.name=t),Zh&&i&&Wh(i,"arity")&&e.length!==i.arity&&Qh(e,"length",{value:i.arity});try{i&&Wh(i,"constructor")&&i.constructor?Yh&&Qh(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(r){}var n=Xh(e);return Wh(n,"source")||(n.source=Jh.join("string"==typeof t?t:"")),e};Function.prototype.toString=ed((function(){return Gh(this)&&qh(this).source||$h(this)}),"toString");var td=lh.exports,id=iu,nd=Vc,rd=td,od=Ku,sd=function(e,t,i,n){n||(n={});var r=n.enumerable,o=void 0!==n.name?n.name:t;if(id(i)&&rd(i,o,n),n.global)r?e[t]=i:od(t,i);else{try{n.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:nd.f(e,t,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},ad={},ld=Math.ceil,ud=Math.floor,cd=Math.trunc||function(e){var t=+e;return(t>0?ud:ld)(t)},hd=function(e){var t=+e;return t!=t||0===t?0:cd(t)},dd=hd,pd=Math.max,fd=Math.min,gd=function(e,t){var i=dd(e);return i<0?pd(i+t,0):fd(i,t)},yd=hd,vd=Math.min,md=function(e){return e>0?vd(yd(e),9007199254740991):0},_d=md,Ed=function(e){return _d(e.length)},Td=Zl,Sd=gd,bd=Ed,kd=function(e){return function(t,i,n){var r,o=Td(t),s=bd(o),a=Sd(n,s);if(e&&i!=i){for(;s>a;)if((r=o[a++])!=r)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===i)return e||a||0;return!e&&-1}},Cd={includes:kd(!0),indexOf:kd(!1)},Id=ec,Ad=Zl,Pd=Cd.indexOf,wd=Ph,Dd=Ml([].push),Ld=function(e,t){var i,n=Ad(e),r=0,o=[];for(i in n)!Id(wd,i)&&Id(n,i)&&Dd(o,i);for(;t.length>r;)Id(n,i=t[r++])&&(~Pd(o,i)||Dd(o,i));return o},Rd=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xd=Ld,Od=Rd.concat("length","prototype");ad.f=Object.getOwnPropertyNames||function(e){return xd(e,Od)};var Nd={};Nd.f=Object.getOwnPropertySymbols;var Md=lu,Ud=ad,Bd=Nd,Hd=zc,Fd=Ml([].concat),jd=Md("Reflect","ownKeys")||function(e){var t=Ud.f(Hd(e)),i=Bd.f;return i?Fd(t,i(e)):t},Vd=ec,Kd=jd,Gd=ml,Wd=Vc,Yd=function(e,t,i){for(var n=Kd(t),r=Wd.f,o=Gd.f,s=0;s<n.length;s++){var a=n[s];Vd(e,a)||i&&Vd(i,a)||r(e,a,o(t,a))}},zd=_l,$d=iu,Xd=/#|\.prototype\./,qd=function(e,t){var i=Zd[Qd(e)];return i==ep||i!=Jd&&($d(t)?zd(t):!!t)},Qd=qd.normalize=function(e){return String(e).replace(Xd,".").toLowerCase()},Zd=qd.data={},Jd=qd.NATIVE="N",ep=qd.POLYFILL="P",tp=qd,ip=vl,np=ml.f,rp=ah,op=sd,sp=Ku,ap=Yd,lp=tp,up=function(e,t){var i,n,r,o,s,a=e.target,l=e.global,u=e.stat;if(i=l?ip:u?ip[a]||sp(a,{}):(ip[a]||{}).prototype)for(n in t){if(o=t[n],r=e.dontCallGetSet?(s=np(i,n))&&s.value:i[n],!lp(l?n:a+(u?".":"#")+n,e.forced)&&void 0!==r){if(typeof o==typeof r)continue;ap(o,r)}(e.sham||r&&r.sham)&&rp(o,"sham",!0),op(i,n,o,e)}},cp=Fl,hp=Array.isArray||function(e){return"Array"==cp(e)},dp=TypeError,pp=function(e){if(e>9007199254740991)throw dp("Maximum allowed index exceeded");return e},fp=Ic,gp=Vc,yp=Ll,vp=function(e,t,i){var n=fp(t);n in e?gp.f(e,n,yp(0,i)):e[n]=i},mp={};mp[gc("toStringTag")]="z";var _p="[object z]"===String(mp),Ep=_p,Tp=iu,Sp=Fl,bp=gc("toStringTag"),kp=Object,Cp="Arguments"==Sp(function(){return arguments}()),Ip=Ep?Sp:function(e){var t,i,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=kp(e),bp))?i:Cp?Sp(t):"Object"==(n=Sp(t))&&Tp(t.callee)?"Arguments":n},Ap=Ml,Pp=_l,wp=iu,Dp=Ip,Lp=Th,Rp=function(){},xp=[],Op=lu("Reflect","construct"),Np=/^\s*(?:class|function)\b/,Mp=Ap(Np.exec),Up=!Np.exec(Rp),Bp=function(e){if(!wp(e))return!1;try{return Op(Rp,xp,e),!0}catch(t){return!1}},Hp=function(e){if(!wp(e))return!1;switch(Dp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Up||!!Mp(Np,Lp(e))}catch(t){return!0}};Hp.sham=!0;var Fp=!Op||Pp((function(){var e;return Bp(Bp.call)||!Bp(Object)||!Bp((function(){e=!0}))||e}))?Hp:Bp,jp=hp,Vp=Fp,Kp=ou,Gp=gc("species"),Wp=Array,Yp=function(e){var t;return jp(e)&&(t=e.constructor,(Vp(t)&&(t===Wp||jp(t.prototype))||Kp(t)&&null===(t=t[Gp]))&&(t=void 0)),void 0===t?Wp:t},zp=function(e,t){return new(Yp(e))(0===t?0:t)},$p=_l,Xp=vu,qp=gc("species"),Qp=function(e){return Xp>=51||!$p((function(){var t=[];return(t.constructor={})[qp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Zp=up,Jp=_l,ef=hp,tf=ou,nf=Qu,rf=Ed,of=pp,sf=vp,af=zp,lf=Qp,uf=vu,cf=gc("isConcatSpreadable"),hf=uf>=51||!Jp((function(){var e=[];return e[cf]=!1,e.concat()[0]!==e})),df=lf("concat"),pf=function(e){if(!tf(e))return!1;var t=e[cf];return void 0!==t?!!t:ef(e)};Zp({target:"Array",proto:!0,arity:1,forced:!hf||!df},{concat:function(e){var t,i,n,r,o,s=nf(this),a=af(s,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(pf(o=-1===t?s:arguments[t]))for(r=rf(o),of(l+r),i=0;i<r;i++,l++)i in o&&sf(a,l,o[i]);else of(l+1),sf(a,l++,o);return a.length=l,a}});var ff=Fl,gf=Ml,yf=function(e){if("Function"===ff(e))return gf(e)},vf=Ru,mf=Tl,_f=yf(yf.bind),Ef=function(e,t){return vf(e),void 0===t?e:mf?_f(e,t):function(){return e.apply(t,arguments)}},Tf=Ef,Sf=Wl,bf=Qu,kf=Ed,Cf=zp,If=Ml([].push),Af=function(e){var t=1==e,i=2==e,n=3==e,r=4==e,o=6==e,s=7==e,a=5==e||o;return function(l,u,c,h){for(var d,p,f=bf(l),g=Sf(f),y=Tf(u,c),v=kf(g),m=0,_=h||Cf,E=t?_(l,v):i||s?_(l,0):void 0;v>m;m++)if((a||m in g)&&(p=y(d=g[m],m,f),e))if(t)E[m]=p;else if(p)switch(e){case 3:return!0;case 5:return d;case 6:return m;case 2:If(E,d)}else switch(e){case 4:return!1;case 7:If(E,d)}return o?-1:n||r?r:E}},Pf={forEach:Af(0),map:Af(1),filter:Af(2),some:Af(3),every:Af(4),find:Af(5),findIndex:Af(6),filterReject:Af(7)},wf=Pf.map;up({target:"Array",proto:!0,forced:!Qp("map")},{map:function(e){return wf(this,e,arguments.length>1?arguments[1]:void 0)}});var Df=Ld,Lf=Rd,Rf=Object.keys||function(e){return Df(e,Lf)},xf=Qu,Of=Rf;up({target:"Object",stat:!0,forced:_l((function(){Of(1)}))},{keys:function(e){return Of(xf(e))}});var Nf=Ip,Mf=String,Uf=function(e){if("Symbol"===Nf(e))throw TypeError("Cannot convert a Symbol value to a string");return Mf(e)},Bf=Ml,Hf=hd,Ff=Uf,jf=Xl,Vf=Bf("".charAt),Kf=Bf("".charCodeAt),Gf=Bf("".slice),Wf=function(e){return function(t,i){var n,r,o=Ff(jf(t)),s=Hf(i),a=o.length;return s<0||s>=a?e?"":void 0:(n=Kf(o,s))<55296||n>56319||s+1===a||(r=Kf(o,s+1))<56320||r>57343?e?Vf(o,s):n:e?Gf(o,s,s+2):r-56320+(n-55296<<10)+65536}},Yf={codeAt:Wf(!1),charAt:Wf(!0)},zf=Yf.charAt,$f=Xl,Xf=hd,qf=Uf;up({target:"String",proto:!0,forced:!0},{at:function(e){var t=qf($f(this)),i=t.length,n=Xf(e),r=n>=0?n:i+n;return r<0||r>=i?void 0:zf(t,r)}});var Qf=Ip,Zf=_p?{}.toString:function(){return"[object "+Qf(this)+"]"};_p||sd(Object.prototype,"toString",Zf,{unsafe:!0});var Jf=zc,eg=function(){var e=Jf(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},tg=kl,ig=ec,ng=uu,rg=eg,og=RegExp.prototype,sg=function(e){var t=e.flags;return void 0!==t||"flags"in og||ig(e,"flags")||!ng(og,e)?t:tg(rg,e)},ag=fh.PROPER,lg=sd,ug=zc,cg=Uf,hg=_l,dg=sg,pg="toString",fg=RegExp.prototype[pg],gg=hg((function(){return"/a/b"!=fg.call({source:"a",flags:"b"})})),yg=ag&&fg.name!=pg;(gg||yg)&&lg(RegExp.prototype,pg,(function(){var e=ug(this);return"/"+cg(e.source)+"/"+cg(dg(e))}),{unsafe:!0});var vg=Dc("span").classList,mg=vg&&vg.constructor&&vg.constructor.prototype,_g=mg===Object.prototype?void 0:mg,Eg=_l,Tg=function(e,t){var i=[][e];return!!i&&Eg((function(){i.call(null,t||function(){return 1},1)}))},Sg=Pf.forEach,bg=Tg("forEach")?[].forEach:function(e){return Sg(this,e,arguments.length>1?arguments[1]:void 0)},kg=vl,Cg={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Ig=_g,Ag=bg,Pg=ah,wg=function(e){if(e&&e.forEach!==Ag)try{Pg(e,"forEach",Ag)}catch(t){e.forEach=Ag}};for(var Dg in Cg)Cg[Dg]&&wg(kg[Dg]&&kg[Dg].prototype);wg(Ig);var Lg=iu,Rg=String,xg=TypeError,Og=Ml,Ng=zc,Mg=function(e){if("object"==typeof e||Lg(e))return e;throw xg("Can't set "+Rg(e)+" as a prototype")},Ug=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Og(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(n){}return function(i,n){return Ng(i),Mg(n),t?e(i,n):i.__proto__=n,i}}():void 0),Bg=iu,Hg=ou,Fg=Ug,jg=function(e,t,i){var n,r;return Fg&&Bg(n=t.constructor)&&n!==i&&Hg(r=n.prototype)&&r!==i.prototype&&Fg(e,r),e},Vg=Ml(1..valueOf),Kg="\t\n\v\f\r \u2028\u2029\ufeff",Gg=Xl,Wg=Uf,Yg=Kg,zg=Ml("".replace),$g="["+Yg+"]",Xg=RegExp("^"+$g+$g+"*"),qg=RegExp($g+$g+"*$"),Qg=function(e){return function(t){var i=Wg(Gg(t));return 1&e&&(i=zg(i,Xg,"")),2&e&&(i=zg(i,qg,"")),i}},Zg={start:Qg(1),end:Qg(2),trim:Qg(3)},Jg=El,ey=vl,ty=Ml,iy=tp,ny=sd,ry=ec,oy=jg,sy=uu,ay=Iu,ly=bc,uy=_l,cy=ad.f,hy=ml.f,dy=Vc.f,py=Vg,fy=Zg.trim,gy="Number",yy=ey[gy],vy=yy.prototype,my=ey.TypeError,_y=ty("".slice),Ey=ty("".charCodeAt),Ty=function(e){var t,i,n,r,o,s,a,l,u=ly(e,"number");if(ay(u))throw my("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=fy(u),43===(t=Ey(u,0))||45===t){if(88===(i=Ey(u,2))||120===i)return NaN}else if(48===t){switch(Ey(u,1)){case 66:case 98:n=2,r=49;break;case 79:case 111:n=8,r=55;break;default:return+u}for(s=(o=_y(u,2)).length,a=0;a<s;a++)if((l=Ey(o,a))<48||l>r)return NaN;return parseInt(o,n)}return+u};if(iy(gy,!yy(" 0o1")||!yy("0b1")||yy("+0x1"))){for(var Sy,by=function(e){var t=arguments.length<1?0:yy(function(e){var t=ly(e,"number");return"bigint"==typeof t?t:Ty(t)}(e)),i=this;return sy(vy,i)&&uy((function(){py(i)}))?oy(Object(t),i,by):t},ky=Jg?cy(yy):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),Cy=0;ky.length>Cy;Cy++)ry(yy,Sy=ky[Cy])&&!ry(by,Sy)&&dy(by,Sy,hy(yy,Sy));by.prototype=vy,vy.constructor=by,ny(ey,gy,by,{constructor:!0})}var Iy=El,Ay=fh.EXISTS,Py=Ml,wy=Vc.f,Dy=Function.prototype,Ly=Py(Dy.toString),Ry=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,xy=Py(Ry.exec);Iy&&!Ay&&wy(Dy,"name",{configurable:!0,get:function(){try{return xy(Ry,Ly(this))[1]}catch(e){return""}}});var Oy=up,Ny=Wl,My=Zl,Uy=Tg,By=Ml([].join),Hy=Ny!=Object,Fy=Uy("join",",");Oy({target:"Array",proto:!0,forced:Hy||!Fy},{join:function(e){return By(My(this),void 0===e?",":e)}});var jy,Vy,Ky,Gy,Wy="process"==Fl(vl.process),Yy=Vc.f,zy=ec,$y=gc("toStringTag"),Xy=function(e,t,i){e&&!i&&(e=e.prototype),e&&!zy(e,$y)&&Yy(e,$y,{configurable:!0,value:t})},qy=lu,Qy=Vc,Zy=El,Jy=gc("species"),ev=function(e){var t=qy(e),i=Qy.f;Zy&&t&&!t[Jy]&&i(t,Jy,{configurable:!0,get:function(){return this}})},tv=uu,iv=TypeError,nv=Fp,rv=Pu,ov=TypeError,sv=zc,av=function(e){if(nv(e))return e;throw ov(rv(e)+" is not a constructor")},lv=Yl,uv=gc("species"),cv=function(e,t){var i,n=sv(e).constructor;return void 0===n||lv(i=sv(n)[uv])?t:av(i)},hv=Tl,dv=Function.prototype,pv=dv.apply,fv=dv.call,gv="object"==typeof Reflect&&Reflect.apply||(hv?fv.bind(pv):function(){return fv.apply(pv,arguments)}),yv=lu("document","documentElement"),vv=Ml([].slice),mv=TypeError,_v=/(?:ipad|iphone|ipod).*applewebkit/i.test(cu),Ev=vl,Tv=gv,Sv=Ef,bv=iu,kv=ec,Cv=_l,Iv=yv,Av=vv,Pv=Dc,wv=function(e,t){if(e<t)throw mv("Not enough arguments");return e},Dv=_v,Lv=Wy,Rv=Ev.setImmediate,xv=Ev.clearImmediate,Ov=Ev.process,Nv=Ev.Dispatch,Mv=Ev.Function,Uv=Ev.MessageChannel,Bv=Ev.String,Hv=0,Fv={},jv="onreadystatechange";try{jy=Ev.location}catch(oF){}var Vv=function(e){if(kv(Fv,e)){var t=Fv[e];delete Fv[e],t()}},Kv=function(e){return function(){Vv(e)}},Gv=function(e){Vv(e.data)},Wv=function(e){Ev.postMessage(Bv(e),jy.protocol+"//"+jy.host)};Rv&&xv||(Rv=function(e){wv(arguments.length,1);var t=bv(e)?e:Mv(e),i=Av(arguments,1);return Fv[++Hv]=function(){Tv(t,void 0,i)},Vy(Hv),Hv},xv=function(e){delete Fv[e]},Lv?Vy=function(e){Ov.nextTick(Kv(e))}:Nv&&Nv.now?Vy=function(e){Nv.now(Kv(e))}:Uv&&!Dv?(Gy=(Ky=new Uv).port2,Ky.port1.onmessage=Gv,Vy=Sv(Gy.postMessage,Gy)):Ev.addEventListener&&bv(Ev.postMessage)&&!Ev.importScripts&&jy&&"file:"!==jy.protocol&&!Cv(Wv)?(Vy=Wv,Ev.addEventListener("message",Gv,!1)):Vy=jv in Pv("script")?function(e){Iv.appendChild(Pv("script"))[jv]=function(){Iv.removeChild(this),Vv(e)}}:function(e){setTimeout(Kv(e),0)});var Yv,zv,$v,Xv,qv,Qv,Zv,Jv,em={set:Rv,clear:xv},tm=vl,im=/ipad|iphone|ipod/i.test(cu)&&void 0!==tm.Pebble,nm=/web0s(?!.*chrome)/i.test(cu),rm=vl,om=Ef,sm=ml.f,am=em.set,lm=_v,um=im,cm=nm,hm=Wy,dm=rm.MutationObserver||rm.WebKitMutationObserver,pm=rm.document,fm=rm.process,gm=rm.Promise,ym=sm(rm,"queueMicrotask"),vm=ym&&ym.value;vm||(Yv=function(){var e,t;for(hm&&(e=fm.domain)&&e.exit();zv;){t=zv.fn,zv=zv.next;try{t()}catch(oF){throw zv?Xv():$v=void 0,oF}}$v=void 0,e&&e.enter()},lm||hm||cm||!dm||!pm?!um&&gm&&gm.resolve?((Zv=gm.resolve(void 0)).constructor=gm,Jv=om(Zv.then,Zv),Xv=function(){Jv(Yv)}):hm?Xv=function(){fm.nextTick(Yv)}:(am=om(am,rm),Xv=function(){am(Yv)}):(qv=!0,Qv=pm.createTextNode(""),new dm(Yv).observe(Qv,{characterData:!0}),Xv=function(){Qv.data=qv=!qv}));var mm=vm||function(e){var t={fn:e,next:void 0};$v&&($v.next=t),zv||(zv=t,Xv()),$v=t},_m=vl,Em=function(e){try{return{error:!1,value:e()}}catch(oF){return{error:!0,value:oF}}},Tm=function(){this.head=null,this.tail=null};Tm.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Sm=Tm,bm=vl.Promise,km="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Cm=!km&&!Wy&&"object"==typeof window&&"object"==typeof document,Im=vl,Am=bm,Pm=iu,wm=tp,Dm=Th,Lm=gc,Rm=Cm,xm=km,Om=vu;Am&&Am.prototype;var Nm=Lm("species"),Mm=!1,Um=Pm(Im.PromiseRejectionEvent),Bm={CONSTRUCTOR:wm("Promise",(function(){var e=Dm(Am),t=e!==String(Am);if(!t&&66===Om)return!0;if(!Om||Om<51||!/native code/.test(e)){var i=new Am((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((i.constructor={})[Nm]=n,!(Mm=i.then((function(){}))instanceof n))return!0}return!t&&(Rm||xm)&&!Um})),REJECTION_EVENT:Um,SUBCLASSING:Mm},Hm={},Fm=Ru,jm=TypeError,Vm=function(e){var t,i;this.promise=new e((function(e,n){if(void 0!==t||void 0!==i)throw jm("Bad Promise constructor");t=e,i=n})),this.resolve=Fm(t),this.reject=Fm(i)};Hm.f=function(e){return new Vm(e)};var Km,Gm,Wm,Ym=up,zm=Wy,$m=vl,Xm=kl,qm=sd,Qm=Ug,Zm=Xy,Jm=ev,e_=Ru,t_=iu,i_=ou,n_=function(e,t){if(tv(t,e))return e;throw iv("Incorrect invocation")},r_=cv,o_=em.set,s_=mm,a_=function(e,t){var i=_m.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},l_=Em,u_=Sm,c_=Vh,h_=bm,d_=Hm,p_="Promise",f_=Bm.CONSTRUCTOR,g_=Bm.REJECTION_EVENT,y_=Bm.SUBCLASSING,v_=c_.getterFor(p_),m_=c_.set,__=h_&&h_.prototype,E_=h_,T_=__,S_=$m.TypeError,b_=$m.document,k_=$m.process,C_=d_.f,I_=C_,A_=!!(b_&&b_.createEvent&&$m.dispatchEvent),P_="unhandledrejection",w_=function(e){var t;return!(!i_(e)||!t_(t=e.then))&&t},D_=function(e,t){var i,n,r,o=t.value,s=1==t.state,a=s?e.ok:e.fail,l=e.resolve,u=e.reject,c=e.domain;try{a?(s||(2===t.rejection&&N_(t),t.rejection=1),!0===a?i=o:(c&&c.enter(),i=a(o),c&&(c.exit(),r=!0)),i===e.promise?u(S_("Promise-chain cycle")):(n=w_(i))?Xm(n,i,l,u):l(i)):u(o)}catch(oF){c&&!r&&c.exit(),u(oF)}},L_=function(e,t){e.notified||(e.notified=!0,s_((function(){for(var i,n=e.reactions;i=n.get();)D_(i,e);e.notified=!1,t&&!e.rejection&&x_(e)})))},R_=function(e,t,i){var n,r;A_?((n=b_.createEvent("Event")).promise=t,n.reason=i,n.initEvent(e,!1,!0),$m.dispatchEvent(n)):n={promise:t,reason:i},!g_&&(r=$m["on"+e])?r(n):e===P_&&a_("Unhandled promise rejection",i)},x_=function(e){Xm(o_,$m,(function(){var t,i=e.facade,n=e.value;if(O_(e)&&(t=l_((function(){zm?k_.emit("unhandledRejection",n,i):R_(P_,i,n)})),e.rejection=zm||O_(e)?2:1,t.error))throw t.value}))},O_=function(e){return 1!==e.rejection&&!e.parent},N_=function(e){Xm(o_,$m,(function(){var t=e.facade;zm?k_.emit("rejectionHandled",t):R_("rejectionhandled",t,e.value)}))},M_=function(e,t,i){return function(n){e(t,n,i)}},U_=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,L_(e,!0))},B_=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw S_("Promise can't be resolved itself");var n=w_(t);n?s_((function(){var i={done:!1};try{Xm(n,t,M_(B_,i,e),M_(U_,i,e))}catch(oF){U_(i,oF,e)}})):(e.value=t,e.state=1,L_(e,!1))}catch(oF){U_({done:!1},oF,e)}}};if(f_&&(T_=(E_=function(e){n_(this,T_),e_(e),Xm(Km,this);var t=v_(this);try{e(M_(B_,t),M_(U_,t))}catch(oF){U_(t,oF)}}).prototype,(Km=function(e){m_(this,{type:p_,done:!1,notified:!1,parent:!1,reactions:new u_,rejection:!1,state:0,value:void 0})}).prototype=qm(T_,"then",(function(e,t){var i=v_(this),n=C_(r_(this,E_));return i.parent=!0,n.ok=!t_(e)||e,n.fail=t_(t)&&t,n.domain=zm?k_.domain:void 0,0==i.state?i.reactions.add(n):s_((function(){D_(n,i)})),n.promise})),Gm=function(){var e=new Km,t=v_(e);this.promise=e,this.resolve=M_(B_,t),this.reject=M_(U_,t)},d_.f=C_=function(e){return e===E_||undefined===e?new Gm(e):I_(e)},t_(h_)&&__!==Object.prototype)){Wm=__.then,y_||qm(__,"then",(function(e,t){var i=this;return new E_((function(e,t){Xm(Wm,i,e,t)})).then(e,t)}),{unsafe:!0});try{delete __.constructor}catch(oF){}Qm&&Qm(__,T_)}Ym({global:!0,constructor:!0,wrap:!0,forced:f_},{Promise:E_}),Zm(E_,p_,!1),Jm(p_);var H_={},F_=H_,j_=gc("iterator"),V_=Array.prototype,K_=Ip,G_=Nu,W_=Yl,Y_=H_,z_=gc("iterator"),$_=function(e){if(!W_(e))return G_(e,z_)||G_(e,"@@iterator")||Y_[K_(e)]},X_=kl,q_=Ru,Q_=zc,Z_=Pu,J_=$_,eE=TypeError,tE=kl,iE=zc,nE=Nu,rE=Ef,oE=kl,sE=zc,aE=Pu,lE=function(e){return void 0!==e&&(F_.Array===e||V_[j_]===e)},uE=Ed,cE=uu,hE=function(e,t){var i=arguments.length<2?J_(e):t;if(q_(i))return Q_(X_(i,e));throw eE(Z_(e)+" is not iterable")},dE=$_,pE=function(e,t,i){var n,r;iE(e);try{if(!(n=nE(e,"return"))){if("throw"===t)throw i;return i}n=tE(n,e)}catch(oF){r=!0,n=oF}if("throw"===t)throw i;if(r)throw n;return iE(n),i},fE=TypeError,gE=function(e,t){this.stopped=e,this.result=t},yE=gE.prototype,vE=function(e,t,i){var n,r,o,s,a,l,u,c=i&&i.that,h=!(!i||!i.AS_ENTRIES),d=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),g=rE(t,c),y=function(e){return n&&pE(n,"normal",e),new gE(!0,e)},v=function(e){return h?(sE(e),f?g(e[0],e[1],y):g(e[0],e[1])):f?g(e,y):g(e)};if(d)n=e.iterator;else if(p)n=e;else{if(!(r=dE(e)))throw fE(aE(e)+" is not iterable");if(lE(r)){for(o=0,s=uE(e);s>o;o++)if((a=v(e[o]))&&cE(yE,a))return a;return new gE(!1)}n=hE(e,r)}for(l=d?e.next:n.next;!(u=oE(l,n)).done;){try{a=v(u.value)}catch(oF){pE(n,"throw",oF)}if("object"==typeof a&&a&&cE(yE,a))return a}return new gE(!1)},mE=gc("iterator"),_E=!1;try{var EE=0,TE={next:function(){return{done:!!EE++}},return:function(){_E=!0}};TE[mE]=function(){return this},Array.from(TE,(function(){throw 2}))}catch(oF){}var SE=bm,bE=Bm.CONSTRUCTOR||!function(e,t){if(!t&&!_E)return!1;var i=!1;try{var n={};n[mE]=function(){return{next:function(){return{done:i=!0}}}},e(n)}catch(oF){}return i}((function(e){SE.all(e).then(void 0,(function(){}))})),kE=kl,CE=Ru,IE=Hm,AE=Em,PE=vE;up({target:"Promise",stat:!0,forced:bE},{all:function(e){var t=this,i=IE.f(t),n=i.resolve,r=i.reject,o=AE((function(){var i=CE(t.resolve),o=[],s=0,a=1;PE(e,(function(e){var l=s++,u=!1;a++,kE(i,t,e).then((function(e){u||(u=!0,o[l]=e,--a||n(o))}),r)})),--a||n(o)}));return o.error&&r(o.value),i.promise}});var wE=up,DE=Bm.CONSTRUCTOR,LE=bm,RE=lu,xE=iu,OE=sd,NE=LE&&LE.prototype;if(wE({target:"Promise",proto:!0,forced:DE,real:!0},{catch:function(e){return this.then(void 0,e)}}),xE(LE)){var ME=RE("Promise").prototype.catch;NE.catch!==ME&&OE(NE,"catch",ME,{unsafe:!0})}var UE=kl,BE=Ru,HE=Hm,FE=Em,jE=vE;up({target:"Promise",stat:!0,forced:bE},{race:function(e){var t=this,i=HE.f(t),n=i.reject,r=FE((function(){var r=BE(t.resolve);jE(e,(function(e){UE(r,t,e).then(i.resolve,n)}))}));return r.error&&n(r.value),i.promise}});var VE=kl,KE=Hm;up({target:"Promise",stat:!0,forced:Bm.CONSTRUCTOR},{reject:function(e){var t=KE.f(this);return VE(t.reject,void 0,e),t.promise}});var GE=zc,WE=ou,YE=Hm,zE=function(e,t){if(GE(e),WE(t)&&t.constructor===e)return t;var i=YE.f(e);return(0,i.resolve)(t),i.promise},$E=up,XE=Bm.CONSTRUCTOR,qE=zE;lu("Promise"),$E({target:"Promise",stat:!0,forced:XE},{resolve:function(e){return qE(this,e)}});var QE=up,ZE=bm,JE=_l,eT=lu,tT=iu,iT=cv,nT=zE,rT=sd,oT=ZE&&ZE.prototype;if(QE({target:"Promise",proto:!0,real:!0,forced:!!ZE&&JE((function(){oT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=iT(this,eT("Promise")),i=tT(e);return this.then(i?function(i){return nT(t,e()).then((function(){return i}))}:e,i?function(i){return nT(t,e()).then((function(){throw i}))}:e)}}),tT(ZE)){var sT=eT("Promise").prototype.finally;oT.finally!==sT&&rT(oT,"finally",sT,{unsafe:!0})}var aT=El,lT=hp,uT=TypeError,cT=Object.getOwnPropertyDescriptor,hT=aT&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(oF){return oF instanceof TypeError}}(),dT=Pu,pT=TypeError,fT=up,gT=Qu,yT=gd,vT=hd,mT=Ed,_T=hT?function(e,t){if(lT(e)&&!cT(e,"length").writable)throw uT("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ET=pp,TT=zp,ST=vp,bT=function(e,t){if(!delete e[t])throw pT("Cannot delete property "+dT(t)+" of "+dT(e))},kT=Qp("splice"),CT=Math.max,IT=Math.min;fT({target:"Array",proto:!0,forced:!kT},{splice:function(e,t){var i,n,r,o,s,a,l=gT(this),u=mT(l),c=yT(e,u),h=arguments.length;for(0===h?i=n=0:1===h?(i=0,n=u-c):(i=h-2,n=IT(CT(vT(t),0),u-c)),ET(u+i-n),r=TT(l,n),o=0;o<n;o++)(s=c+o)in l&&ST(r,o,l[s]);if(r.length=n,i<n){for(o=c;o<u-n;o++)a=o+i,(s=o+n)in l?l[a]=l[s]:bT(l,a);for(o=u;o>u-n+i;o--)bT(l,o-1)}else if(i>n)for(o=u-n;o>c;o--)a=o+i-1,(s=o+n-1)in l?l[a]=l[s]:bT(l,a);for(o=0;o<i;o++)l[o+c]=arguments[o+2];return _T(l,u-n+i),r}});var AT=hd,PT=Uf,wT=Xl,DT=RangeError,LT=up,RT=Ml,xT=hd,OT=Vg,NT=function(e){var t=PT(wT(this)),i="",n=AT(e);if(n<0||n==1/0)throw DT("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(i+=t);return i},MT=_l,UT=RangeError,BT=String,HT=Math.floor,FT=RT(NT),jT=RT("".slice),VT=RT(1..toFixed),KT=function(e,t,i){return 0===t?i:t%2==1?KT(e,t-1,i*e):KT(e*e,t/2,i)},GT=function(e,t,i){for(var n=-1,r=i;++n<6;)r+=t*e[n],e[n]=r%1e7,r=HT(r/1e7)},WT=function(e,t){for(var i=6,n=0;--i>=0;)n+=e[i],e[i]=HT(n/t),n=n%t*1e7},YT=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var n=BT(e[t]);i=""===i?n:i+FT("0",7-n.length)+n}return i};LT({target:"Number",proto:!0,forced:MT((function(){return"0.000"!==VT(8e-5,3)||"1"!==VT(.9,0)||"1.25"!==VT(1.255,2)||"1000000000000000128"!==VT(0xde0b6b3a7640080,0)}))||!MT((function(){VT({})}))},{toFixed:function(e){var t,i,n,r,o=OT(this),s=xT(e),a=[0,0,0,0,0,0],l="",u="0";if(s<0||s>20)throw UT("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return BT(o);if(o<0&&(l="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*KT(2,69,1))-69)<0?o*KT(2,-t,1):o/KT(2,t,1),i*=4503599627370496,(t=52-t)>0){for(GT(a,0,i),n=s;n>=7;)GT(a,1e7,0),n-=7;for(GT(a,KT(10,n,1),0),n=t-1;n>=23;)WT(a,1<<23),n-=23;WT(a,1<<n),GT(a,1,1),WT(a,2),u=YT(a)}else GT(a,0,i),GT(a,1<<-t,0),u=YT(a)+FT("0",s);return u=s>0?l+((r=u.length)<=s?"0."+FT("0",s-r)+u:jT(u,0,r-s)+"."+jT(u,r-s)):l+u}}),up({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var zT=_l,$T=vl.RegExp,XT=zT((function(){var e=$T("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),qT=XT||zT((function(){return!$T("a","y").sticky})),QT={BROKEN_CARET:XT||zT((function(){var e=$T("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:qT,UNSUPPORTED_Y:XT},ZT={},JT=El,eS=Kc,tS=Vc,iS=zc,nS=Zl,rS=Rf;ZT.f=JT&&!eS?Object.defineProperties:function(e,t){iS(e);for(var i,n=nS(t),r=rS(t),o=r.length,s=0;o>s;)tS.f(e,i=r[s++],n[i]);return e};var oS,sS=zc,aS=ZT,lS=Rd,uS=Ph,cS=yv,hS=Dc,dS="prototype",pS="script",fS=Ah("IE_PROTO"),gS=function(){},yS=function(e){return"<"+pS+">"+e+"</"+pS+">"},vS=function(e){e.write(yS("")),e.close();var t=e.parentWindow.Object;return e=null,t},mS=function(){try{oS=new ActiveXObject("htmlfile")}catch(oF){}var e,t,i;mS="undefined"!=typeof document?document.domain&&oS?vS(oS):(t=hS("iframe"),i="java"+pS+":",t.style.display="none",cS.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(yS("document.F=Object")),e.close(),e.F):vS(oS);for(var n=lS.length;n--;)delete mS[dS][lS[n]];return mS()};uS[fS]=!0;var _S,ES,TS=Object.create||function(e,t){var i;return null!==e?(gS[dS]=sS(e),i=new gS,gS[dS]=null,i[fS]=e):i=mS(),void 0===t?i:aS.f(i,t)},SS=_l,bS=vl.RegExp,kS=SS((function(){var e=bS(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),CS=_l,IS=vl.RegExp,AS=CS((function(){var e=IS("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),PS=kl,wS=Ml,DS=Uf,LS=eg,RS=QT,xS=TS,OS=Vh.get,NS=kS,MS=AS,US=$u("native-string-replace",String.prototype.replace),BS=RegExp.prototype.exec,HS=BS,FS=wS("".charAt),jS=wS("".indexOf),VS=wS("".replace),KS=wS("".slice),GS=(ES=/b*/g,PS(BS,_S=/a/,"a"),PS(BS,ES,"a"),0!==_S.lastIndex||0!==ES.lastIndex),WS=RS.BROKEN_CARET,YS=void 0!==/()??/.exec("")[1];(GS||YS||WS||NS||MS)&&(HS=function(e){var t,i,n,r,o,s,a,l=this,u=OS(l),c=DS(e),h=u.raw;if(h)return h.lastIndex=l.lastIndex,t=PS(HS,h,c),l.lastIndex=h.lastIndex,t;var d=u.groups,p=WS&&l.sticky,f=PS(LS,l),g=l.source,y=0,v=c;if(p&&(f=VS(f,"y",""),-1===jS(f,"g")&&(f+="g"),v=KS(c,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==FS(c,l.lastIndex-1))&&(g="(?: "+g+")",v=" "+v,y++),i=new RegExp("^(?:"+g+")",f)),YS&&(i=new RegExp("^"+g+"$(?!\\s)",f)),GS&&(n=l.lastIndex),r=PS(BS,p?i:l,v),p?r?(r.input=KS(r.input,y),r[0]=KS(r[0],y),r.index=l.lastIndex,l.lastIndex+=r[0].length):l.lastIndex=0:GS&&r&&(l.lastIndex=l.global?r.index+r[0].length:n),YS&&r&&r.length>1&&PS(US,r[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r&&d)for(r.groups=s=xS(null),o=0;o<d.length;o++)s[(a=d[o])[0]]=r[a[1]];return r});var zS=HS;up({target:"RegExp",proto:!0,forced:/./.exec!==zS},{exec:zS});var $S=yf,XS=sd,qS=zS,QS=_l,ZS=gc,JS=ah,eb=ZS("species"),tb=RegExp.prototype,ib=function(e,t,i,n){var r=ZS(e),o=!QS((function(){var t={};return t[r]=function(){return 7},7!=""[e](t)})),s=o&&!QS((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[eb]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!o||!s||i){var a=$S(/./[r]),l=t(r,""[e],(function(e,t,i,n,r){var s=$S(e),l=t.exec;return l===qS||l===tb.exec?o&&!r?{done:!0,value:a(t,i,n)}:{done:!0,value:s(i,t,n)}:{done:!1}}));XS(String.prototype,e,l[0]),XS(tb,r,l[1])}n&&JS(tb[r],"sham",!0)},nb=Yf.charAt,rb=function(e,t,i){return t+(i?nb(e,t).length:1)},ob=Ml,sb=Qu,ab=Math.floor,lb=ob("".charAt),ub=ob("".replace),cb=ob("".slice),hb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,db=/\$([$&'`]|\d{1,2})/g,pb=kl,fb=zc,gb=iu,yb=Fl,vb=zS,mb=TypeError,_b=function(e,t){var i=e.exec;if(gb(i)){var n=pb(i,e,t);return null!==n&&fb(n),n}if("RegExp"===yb(e))return pb(vb,e,t);throw mb("RegExp#exec called on incompatible receiver")},Eb=gv,Tb=kl,Sb=Ml,bb=ib,kb=_l,Cb=zc,Ib=iu,Ab=Yl,Pb=hd,wb=md,Db=Uf,Lb=Xl,Rb=rb,xb=Nu,Ob=function(e,t,i,n,r,o){var s=i+e.length,a=n.length,l=db;return void 0!==r&&(r=sb(r),l=hb),ub(o,l,(function(o,l){var u;switch(lb(l,0)){case"$":return"$";case"&":return e;case"`":return cb(t,0,i);case"'":return cb(t,s);case"<":u=r[cb(l,1,-1)];break;default:var c=+l;if(0===c)return o;if(c>a){var h=ab(c/10);return 0===h?o:h<=a?void 0===n[h-1]?lb(l,1):n[h-1]+lb(l,1):o}u=n[c-1]}return void 0===u?"":u}))},Nb=_b,Mb=gc("replace"),Ub=Math.max,Bb=Math.min,Hb=Sb([].concat),Fb=Sb([].push),jb=Sb("".indexOf),Vb=Sb("".slice),Kb="$0"==="a".replace(/./,"$0"),Gb=!!/./[Mb]&&""===/./[Mb]("a","$0");bb("replace",(function(e,t,i){var n=Gb?"$":"$0";return[function(e,i){var n=Lb(this),r=Ab(e)?void 0:xb(e,Mb);return r?Tb(r,e,n,i):Tb(t,Db(n),e,i)},function(e,r){var o=Cb(this),s=Db(e);if("string"==typeof r&&-1===jb(r,n)&&-1===jb(r,"$<")){var a=i(t,o,s,r);if(a.done)return a.value}var l=Ib(r);l||(r=Db(r));var u=o.global;if(u){var c=o.unicode;o.lastIndex=0}for(var h=[];;){var d=Nb(o,s);if(null===d)break;if(Fb(h,d),!u)break;""===Db(d[0])&&(o.lastIndex=Rb(s,wb(o.lastIndex),c))}for(var p,f="",g=0,y=0;y<h.length;y++){for(var v=Db((d=h[y])[0]),m=Ub(Bb(Pb(d.index),s.length),0),_=[],E=1;E<d.length;E++)Fb(_,void 0===(p=d[E])?p:String(p));var T=d.groups;if(l){var S=Hb([v],_,m,s);void 0!==T&&Fb(S,T);var b=Db(Eb(r,void 0,S))}else b=Ob(v,s,m,_,T,r);m>=g&&(f+=Vb(s,g,m)+b,g=m+v.length)}return f+Vb(s,g)}]}),!!kb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Kb||Gb);var Wb=ou,Yb=Fl,zb=gc("match"),$b=function(e){var t;return Wb(e)&&(void 0!==(t=e[zb])?!!t:"RegExp"==Yb(e))},Xb=gd,qb=Ed,Qb=vp,Zb=Array,Jb=Math.max,ek=function(e,t,i){for(var n=qb(e),r=Xb(t,n),o=Xb(void 0===i?n:i,n),s=Zb(Jb(o-r,0)),a=0;r<o;r++,a++)Qb(s,a,e[r]);return s.length=a,s},tk=gv,ik=kl,nk=Ml,rk=ib,ok=zc,sk=Yl,ak=$b,lk=Xl,uk=cv,ck=rb,hk=md,dk=Uf,pk=Nu,fk=ek,gk=_b,yk=zS,vk=_l,mk=QT.UNSUPPORTED_Y,_k=4294967295,Ek=Math.min,Tk=[].push,Sk=nk(/./.exec),bk=nk(Tk),kk=nk("".slice),Ck=!vk((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}));rk("split",(function(e,t,i){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var n=dk(lk(this)),r=void 0===i?_k:i>>>0;if(0===r)return[];if(void 0===e)return[n];if(!ak(e))return ik(t,n,e,r);for(var o,s,a,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,h=new RegExp(e.source,u+"g");(o=ik(yk,h,n))&&!((s=h.lastIndex)>c&&(bk(l,kk(n,c,o.index)),o.length>1&&o.index<n.length&&tk(Tk,l,fk(o,1)),a=o[0].length,c=s,l.length>=r));)h.lastIndex===o.index&&h.lastIndex++;return c===n.length?!a&&Sk(h,"")||bk(l,""):bk(l,kk(n,c)),l.length>r?fk(l,0,r):l}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:ik(t,this,e,i)}:t,[function(t,i){var r=lk(this),o=sk(t)?void 0:pk(t,e);return o?ik(o,t,r,i):ik(n,dk(r),t,i)},function(e,r){var o=ok(this),s=dk(e),a=i(n,o,s,r,n!==t);if(a.done)return a.value;var l=uk(o,RegExp),u=o.unicode,c=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(mk?"g":"y"),h=new l(mk?"^(?:"+o.source+")":o,c),d=void 0===r?_k:r>>>0;if(0===d)return[];if(0===s.length)return null===gk(h,s)?[s]:[];for(var p=0,f=0,g=[];f<s.length;){h.lastIndex=mk?0:f;var y,v=gk(h,mk?kk(s,f):s);if(null===v||(y=Ek(hk(h.lastIndex+(mk?f:0)),s.length))===p)f=ck(s,f,u);else{if(bk(g,kk(s,p,f)),g.length===d)return g;for(var m=1;m<=v.length-1;m++)if(bk(g,v[m]),g.length===d)return g;f=p=y}}return bk(g,kk(s,p)),g}]}),!Ck,mk);var Ik=fh.PROPER,Ak=_l,Pk=Kg,wk=Zg.trim;up({target:"String",proto:!0,forced:function(e){return Ak((function(){return!!Pk[e]()||"
"!=="
"[e]()||Ik&&Pk[e].name!==e}))}("trim")},{trim:function(){return wk(this)}});var Dk=Pf.filter;up({target:"Array",proto:!0,forced:!Qp("filter")},{filter:function(e){return Dk(this,e,arguments.length>1?arguments[1]:void 0)}});var Lk=kl,Rk=zc,xk=Yl,Ok=md,Nk=Uf,Mk=Xl,Uk=Nu,Bk=rb,Hk=_b;ib("match",(function(e,t,i){return[function(t){var i=Mk(this),n=xk(t)?void 0:Uk(t,e);return n?Lk(n,t,i):new RegExp(t)[e](Nk(i))},function(e){var n=Rk(this),r=Nk(e),o=i(t,n,r);if(o.done)return o.value;if(!n.global)return Hk(n,r);var s=n.unicode;n.lastIndex=0;for(var a,l=[],u=0;null!==(a=Hk(n,r));){var c=Nk(a[0]);l[u]=c,""===c&&(n.lastIndex=Bk(r,Ok(n.lastIndex),s)),u++}return 0===u?null:l}]}));var Fk=Vc.f,jk=El,Vk=vl,Kk=Ml,Gk=tp,Wk=jg,Yk=ah,zk=ad.f,$k=uu,Xk=$b,qk=Uf,Qk=sg,Zk=QT,Jk=function(e,t,i){i in e||Fk(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})},eC=sd,tC=_l,iC=ec,nC=Vh.enforce,rC=ev,oC=kS,sC=AS,aC=gc("match"),lC=Vk.RegExp,uC=lC.prototype,cC=Vk.SyntaxError,hC=Kk(uC.exec),dC=Kk("".charAt),pC=Kk("".replace),fC=Kk("".indexOf),gC=Kk("".slice),yC=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,vC=/a/g,mC=/a/g,_C=new lC(vC)!==vC,EC=Zk.MISSED_STICKY,TC=Zk.UNSUPPORTED_Y,SC=jk&&(!_C||EC||oC||sC||tC((function(){return mC[aC]=!1,lC(vC)!=vC||lC(mC)==mC||"/a/i"!=lC(vC,"i")})));if(Gk("RegExp",SC)){for(var bC=function(e,t){var i,n,r,o,s,a,l=$k(uC,this),u=Xk(e),c=void 0===t,h=[],d=e;if(!l&&u&&c&&e.constructor===bC)return e;if((u||$k(uC,e))&&(e=e.source,c&&(t=Qk(d))),e=void 0===e?"":qk(e),t=void 0===t?"":qk(t),d=e,oC&&"dotAll"in vC&&(n=!!t&&fC(t,"s")>-1)&&(t=pC(t,/s/g,"")),i=t,EC&&"sticky"in vC&&(r=!!t&&fC(t,"y")>-1)&&TC&&(t=pC(t,/y/g,"")),sC&&(o=function(e){for(var t,i=e.length,n=0,r="",o=[],s={},a=!1,l=!1,u=0,c="";n<=i;n++){if("\\"===(t=dC(e,n)))t+=dC(e,++n);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:hC(yC,gC(e,n+1))&&(n+=2,l=!0),r+=t,u++;continue;case">"===t&&l:if(""===c||iC(s,c))throw new cC("Invalid capture group name");s[c]=!0,o[o.length]=[c,u],l=!1,c="";continue}l?c+=t:r+=t}return[r,o]}(e),e=o[0],h=o[1]),s=Wk(lC(e,t),l?this:uC,bC),(n||r||h.length)&&(a=nC(s),n&&(a.dotAll=!0,a.raw=bC(function(e){for(var t,i=e.length,n=0,r="",o=!1;n<=i;n++)"\\"!==(t=dC(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),r+=t):r+="[\\s\\S]":r+=t+dC(e,++n);return r}(e),i)),r&&(a.sticky=!0),h.length&&(a.groups=h)),e!==d)try{Yk(s,"source",""===d?"(?:)":d)}catch(oF){}return s},kC=zk(lC),CC=0;kC.length>CC;)Jk(bC,lC,kC[CC++]);uC.constructor=bC,bC.prototype=uC,eC(Vk,"RegExp",bC,{constructor:!0})}rC("RegExp");var IC="undefined"!=typeof window&&window.location.href.indexOf("loggerdebug")>-1;function AC(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0,i=0;i<e.length;i++){var n=e[i].end,r=e[i].begin;Number.isNaN(Number(n))||Number.isNaN(Number(r))||r<0||n<0||n<r||(t+=e[i].end-e[i].begin)}return t=parseInt(1e3*t,10)}function PC(e){if(null==e||""===e||"string"!=typeof e)return"";var t=e.split("/"),i="";return t.length>3&&t[2]&&(i=t[2]),i}function wC(e){var t={};if(e instanceof window.XMLHttpRequest)try{e.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((function(e){var i=e.split(": "),n=i.shift(),r=i.join(": ");t[n]=r}))}catch(oF){return t}return t}function DC(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];IC&&(t=console).log.apply(t,["[logger]",e].concat(n))}function LC(){try{return Math.round(window.performance.now())}catch(oF){return(new Date).getTime()}}function RC(){return(new Date).getTime()}function xC(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,n){try{e||n(new Error("url is undefined"));var r=LC(),o=r,s={},a=new window.XMLHttpRequest;a.open("get",e),a.onreadystatechange=function(){2===a.readyState&&(s.headers=wC(a),s.connectTime=LC()-o,s.status=a.status,s.statusText=a.statusText,r=LC())},a.onload=function(){i(s)},a.onprogress=function(e){var t,i=LC()-r;t=parseInt(e.loaded/1e3/(i/1e3),10),s.speed=0|t,s.costTime=i},a.onerror=function(){s.status||(s.status=-1,s.costTime=LC()-r),n(s)},a.ontimeout=function(){s.status||(s.status=-2,s.costTime=LC()-r),i(s)},a.onabort=function(){i(s)},a.responseType="arraybuffer",a.timeout=t.timeout||1e4,a.setRequestHeader("Range","bytes=".concat(t.range||"0-1048576")),a.send()}catch(l){n(l)}}))}function OC(e){return!e||window.location.href.indexOf(e)>-1}function NC(e){return!!e&&/^blob:/.test(e)}var MC={x_response_sinfo:"x-response-sinfo",x_response_cache:"x-response-cache",x_response_cinfo:"x-response-cinfo"};function UC(e){if(!e)return{};var t={};return Object.keys(MC).map((function(i){if(e[i]||"string"!=typeof MC[i]){if(!e[i]&&MC[i]instanceof Array){var n=MC[i].filter((function(t){return void 0!==e[t]}));n.length>0?t[i]=e[n[0]]:t[i]=""}}else t[i]=e[MC[i]]||""})),t}function BC(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function HC(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(n){var i=e.className&&"object"===ul(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)".concat(t,"(\\s|$)")))}}function FC(e){return"String"===BC(e)?e.replace("P","p"):e?"Number"===BC(e)?"".concat(e):void 0:""}function jC(e){try{return JSON.stringify(e)}catch(t){return""}}var VC=0,KC=1,GC=2;function WC(e,t){return Math.round(t/e*1e3*100)}var YC=[];"undefined"!=typeof window&&function(){try{new window.PerformanceObserver((function(e){var t=e.getEntriesByType("resource");YC.length>30&&YC.splice(0,YC.length-30);for(var i=0;i<t.length;i++)YC.push(t[i])})).observe({entryTypes:["resource"]})}catch(e){console.warn("PerformanceObserver not support",e)}}();var zC="videoplayer_oneplay",$C="videoplayer_oneopera",XC="videoplayer_oneerror",qC="videoplayer_oneevent",QC="videoplayer_onetemp",ZC={data:1e3,runtime:1002,parse:1004,network:1003,no_error_handler:9997,custom_error:9998,other:9999,notSupport:1005},JC={1:-499991,2:-499992,3:-499993,4:-499994,5:-499995},eI=0,tI=1,iI=2,nI=3,rI=4,oI=0,sI=1,aI=2,lI=3,uI=1,cI=2,hI=3,dI=4,pI=5,fI=6,gI=7,yI="error_retry",vI="oneerror",mI="oneevent",_I="onetemp",EI=0,TI=1,SI=864e5,bI=36e5,kI=["tag","subtag","device_type"],CI={NO_FULLSCREEN:0,FULLSCREEN:1,CSS:2};var II=function(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e){return!1}}()&&!function(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(t){return!0}}()?window.localStorage:{},AI="__xgplayerlogkey",PI={set:function(e){try{var t=this.get();t.push(e),II.setItem(AI,JSON.stringify(t))}catch(oF){}},get:function(){try{var e=II.getItem(AI);return e=e?JSON.parse(e):[]}catch(oF){return[]}},remove:function(){try{II.removeItem(AI)}catch(oF){}},clear:function(){try{II.clear()}catch(oF){}}},wI={},DI=Fl,LI=Zl,RI=ad.f,xI=ek,OI="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];wI.f=function(e){return OI&&"Window"==DI(e)?function(e){try{return RI(e)}catch(oF){return xI(OI)}}(e):RI(LI(e))};var NI={},MI=gc;NI.f=MI;var UI=vl,BI=ec,HI=NI,FI=Vc.f,jI=kl,VI=lu,KI=gc,GI=sd,WI=up,YI=vl,zI=kl,$I=Ml,XI=El,qI=Eu,QI=_l,ZI=ec,JI=uu,eA=zc,tA=Zl,iA=Ic,nA=Uf,rA=Ll,oA=TS,sA=Rf,aA=ad,lA=wI,uA=Nd,cA=ml,hA=Vc,dA=ZT,pA=Cl,fA=sd,gA=$u,yA=Ph,vA=oc,mA=gc,_A=NI,EA=function(e){var t=UI.Symbol||(UI.Symbol={});BI(t,e)||FI(t,e,{value:HI.f(e)})},TA=function(){var e=VI("Symbol"),t=e&&e.prototype,i=t&&t.valueOf,n=KI("toPrimitive");t&&!t[n]&&GI(t,n,(function(e){return jI(i,this)}),{arity:1})},SA=Xy,bA=Vh,kA=Pf.forEach,CA=Ah("hidden"),IA="Symbol",AA="prototype",PA=bA.set,wA=bA.getterFor(IA),DA=Object[AA],LA=YI.Symbol,RA=LA&&LA[AA],xA=YI.TypeError,OA=YI.QObject,NA=cA.f,MA=hA.f,UA=lA.f,BA=pA.f,HA=$I([].push),FA=gA("symbols"),jA=gA("op-symbols"),VA=gA("wks"),KA=!OA||!OA[AA]||!OA[AA].findChild,GA=XI&&QI((function(){return 7!=oA(MA({},"a",{get:function(){return MA(this,"a",{value:7}).a}})).a}))?function(e,t,i){var n=NA(DA,t);n&&delete DA[t],MA(e,t,i),n&&e!==DA&&MA(DA,t,n)}:MA,WA=function(e,t){var i=FA[e]=oA(RA);return PA(i,{type:IA,tag:e,description:t}),XI||(i.description=t),i},YA=function(e,t,i){e===DA&&YA(jA,t,i),eA(e);var n=iA(t);return eA(i),ZI(FA,n)?(i.enumerable?(ZI(e,CA)&&e[CA][n]&&(e[CA][n]=!1),i=oA(i,{enumerable:rA(0,!1)})):(ZI(e,CA)||MA(e,CA,rA(1,{})),e[CA][n]=!0),GA(e,n,i)):MA(e,n,i)},zA=function(e,t){eA(e);var i=tA(t),n=sA(i).concat(QA(i));return kA(n,(function(t){XI&&!zI($A,i,t)||YA(e,t,i[t])})),e},$A=function(e){var t=iA(e),i=zI(BA,this,t);return!(this===DA&&ZI(FA,t)&&!ZI(jA,t))&&(!(i||!ZI(this,t)||!ZI(FA,t)||ZI(this,CA)&&this[CA][t])||i)},XA=function(e,t){var i=tA(e),n=iA(t);if(i!==DA||!ZI(FA,n)||ZI(jA,n)){var r=NA(i,n);return!r||!ZI(FA,n)||ZI(i,CA)&&i[CA][n]||(r.enumerable=!0),r}},qA=function(e){var t=UA(tA(e)),i=[];return kA(t,(function(e){ZI(FA,e)||ZI(yA,e)||HA(i,e)})),i},QA=function(e){var t=e===DA,i=UA(t?jA:tA(e)),n=[];return kA(i,(function(e){!ZI(FA,e)||t&&!ZI(DA,e)||HA(n,FA[e])})),n};qI||(LA=function(){if(JI(RA,this))throw xA("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?nA(arguments[0]):void 0,t=vA(e),i=function(e){this===DA&&zI(i,jA,e),ZI(this,CA)&&ZI(this[CA],t)&&(this[CA][t]=!1),GA(this,t,rA(1,e))};return XI&&KA&&GA(DA,t,{configurable:!0,set:i}),WA(t,e)},fA(RA=LA[AA],"toString",(function(){return wA(this).tag})),fA(LA,"withoutSetter",(function(e){return WA(vA(e),e)})),pA.f=$A,hA.f=YA,dA.f=zA,cA.f=XA,aA.f=lA.f=qA,uA.f=QA,_A.f=function(e){return WA(mA(e),e)},XI&&(MA(RA,"description",{configurable:!0,get:function(){return wA(this).description}}),fA(DA,"propertyIsEnumerable",$A,{unsafe:!0}))),WI({global:!0,constructor:!0,wrap:!0,forced:!qI,sham:!qI},{Symbol:LA}),kA(sA(VA),(function(e){EA(e)})),WI({target:IA,stat:!0,forced:!qI},{useSetter:function(){KA=!0},useSimple:function(){KA=!1}}),WI({target:"Object",stat:!0,forced:!qI,sham:!XI},{create:function(e,t){return void 0===t?oA(e):zA(oA(e),t)},defineProperty:YA,defineProperties:zA,getOwnPropertyDescriptor:XA}),WI({target:"Object",stat:!0,forced:!qI},{getOwnPropertyNames:qA}),TA(),SA(LA,IA),yA[CA]=!0;var ZA=Eu&&!!Symbol.for&&!!Symbol.keyFor,JA=up,eP=lu,tP=ec,iP=Uf,nP=$u,rP=ZA,oP=nP("string-to-symbol-registry"),sP=nP("symbol-to-string-registry");JA({target:"Symbol",stat:!0,forced:!rP},{for:function(e){var t=iP(e);if(tP(oP,t))return oP[t];var i=eP("Symbol")(t);return oP[t]=i,sP[i]=t,i}});var aP=up,lP=ec,uP=Iu,cP=Pu,hP=ZA,dP=$u("symbol-to-string-registry");aP({target:"Symbol",stat:!0,forced:!hP},{keyFor:function(e){if(!uP(e))throw TypeError(cP(e)+" is not a symbol");if(lP(dP,e))return dP[e]}});var pP=up,fP=lu,gP=gv,yP=kl,vP=Ml,mP=_l,_P=hp,EP=iu,TP=ou,SP=Iu,bP=vv,kP=Eu,CP=fP("JSON","stringify"),IP=vP(/./.exec),AP=vP("".charAt),PP=vP("".charCodeAt),wP=vP("".replace),DP=vP(1..toString),LP=/[\uD800-\uDFFF]/g,RP=/^[\uD800-\uDBFF]$/,xP=/^[\uDC00-\uDFFF]$/,OP=!kP||mP((function(){var e=fP("Symbol")();return"[null]"!=CP([e])||"{}"!=CP({a:e})||"{}"!=CP(Object(e))})),NP=mP((function(){return'"\\udf06\\ud834"'!==CP("\udf06\ud834")||'"\\udead"'!==CP("\udead")})),MP=function(e,t){var i=bP(arguments),n=t;if((TP(t)||void 0!==e)&&!SP(e))return _P(t)||(t=function(e,t){if(EP(n)&&(t=yP(n,this,e,t)),!SP(t))return t}),i[1]=t,gP(CP,null,i)},UP=function(e,t,i){var n=AP(i,t-1),r=AP(i,t+1);return IP(RP,e)&&!IP(xP,r)||IP(xP,e)&&!IP(RP,n)?"\\u"+DP(PP(e,0),16):e};CP&&pP({target:"JSON",stat:!0,arity:3,forced:OP||NP},{stringify:function(e,t,i){var n=bP(arguments),r=gP(OP?MP:CP,null,n);return NP&&"string"==typeof r?wP(r,LP,UP):r}});var BP=Nd,HP=Qu;up({target:"Object",stat:!0,forced:!Eu||_l((function(){BP.f(1)}))},{getOwnPropertySymbols:function(e){var t=BP.f;return t?t(HP(e)):[]}});var FP=up,jP=El,VP=vl,KP=Ml,GP=ec,WP=iu,YP=uu,zP=Uf,$P=Vc.f,XP=Yd,qP=VP.Symbol,QP=qP&&qP.prototype;if(jP&&WP(qP)&&(!("description"in QP)||void 0!==qP().description)){var ZP={},JP=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:zP(arguments[0]),t=YP(QP,this)?new qP(e):void 0===e?qP():qP(e);return""===e&&(ZP[t]=!0),t};XP(JP,qP),JP.prototype=QP,QP.constructor=JP;var ew="Symbol(test)"==String(qP("test")),tw=KP(QP.valueOf),iw=KP(QP.toString),nw=/^Symbol\((.*)\)[^)]+$/,rw=KP("".replace),ow=KP("".slice);$P(QP,"description",{configurable:!0,get:function(){var e=tw(this);if(GP(ZP,e))return"";var t=iw(e),i=ew?ow(t,7,-1):rw(t,nw,"$1");return""===i?void 0:i}}),FP({global:!0,constructor:!0,forced:!0},{Symbol:JP})}var sw=[{key:"QQBrowser",reg:/(qqbrowser)\/([\d.]+)/},{key:"QIHU360EE",reg:/qihu 360ee/},{key:"QIHU360SE",reg:/qihu 360se/},{key:"2345Explorer",reg:/(2345explorer)\/([\d.]+)/},{key:"Sogou",reg:/(metasr)/},{key:"Wexin",reg:/(micromessenger)\/([\d.]+)/},{key:"Openlanguage",reg:/(openlanguage)\/([\d.]+)/},{key:"NewsArticle",reg:/(newsarticle)\/([\d.]+)/},{key:"VideoArticle",reg:/(videoarticle)\/([\d.]+)/},{key:"Hotsoon",reg:/(live_stream)_([\d.]+)/},{key:"Aweme",reg:/(aweme)_([\d.]+)/},{key:"Lark",reg:/(lark)\/([\d.]+)/},{key:"PlayStation",reg:/(playstation)/},{key:"BingPreview",reg:/(bingpreview)\/([\d.]+)/},{key:"Baiduspider",reg:/(baiduspider-render)\/([\d.]+)/},{key:"YandexBot",reg:/(yandexbot)\/([\d.]+)/},{key:"Chrome",reg:/(chrome)\/([\d.]+)/},{key:"Safari",reg:/(version)\/([\d.]+)\s*(safari)/}],aw=[{key:"Trident",reg:/(rv:)([\d.]+)/},{key:"Trident",reg:/(msie)\s*([\d.]+)/}],lw=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"];var uw=["Baiduspider","YandexBot"],cw=["Baiduspider","googlebot","360Spider","haosouspider","YoudaoBot","Sogou News Spider","Yisouspider","Googlebot","Headless","Applebot","Bingbot","PetalBot"];var hw="undefined"!=typeof navigator&&function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e=e.toLocaleLowerCase();var t=/(iphone)/.test(e)||/(ipad)/.test(e),i=/(android)/.test(e),n=/(windows phone)/.test(e),r=t||i||n,o={isIOS:t,isAndroid:i,isMobile:r,isPC:!r,isPad:/(ipad)/.test(e)},s=function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;var t=document.createElement("video");return"function"==typeof t.canPlayType?(lw.map((function(i){"probably"===t.canPlayType('video/mp4; codecs="'.concat(i,'"'))&&(e.isSupport=!0,e.mime+="||".concat(i))})),e):(t=null,e)}();o.isSupportMP4=s.isSupport,o.mime=s.mime;var a="",l=0,u=[],c=sw;/trident/.test(e)&&(c=aw);for(var h=0;h<c.length;h++)if(u=c[h].reg.exec(e)){a=c[h].key,l=u.length>2?u[2]:"";break}if(a)o["is".concat(a)]=!0,o.name=a,o.appVersion=l;else{var d=function(){var e=navigator.mimeTypes;if(e){for(var t=0;t<e.length;t++){if(e[t].type&&e[t].type.indexOf("360")>-1)return!0;if(e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1)return!0;if(e[t].description&&e[t].description.indexOf("360")>-1)return!0}return!1}}();d&&(o.name="360EE")}return o.name&&"Trident"!==o.name&&/(trident)/.exec(e)&&(o.name=o.name?"".concat(o.name,"_Trident"):"Trident"),o.isSpider=function(e,t){var i=!1;uw.map((function(t){t===e&&(i=!0)}));for(var n=0;n<cw.length;n++){var r=cw[n];if(-1!==t.indexOf(r)){i=!0;break}}return i}(o.name,e),o}(navigator.userAgent);function dw(){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"'))}var pw=[1,1,1,1,1];function fw(){return parseInt(pw.join(""),10)}pw[0]=hw.isSupportMP4?pw[1]+1:pw[1],pw[1]=dw()?pw[1]+1:pw[1],function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var i=e.video||{},n=e.audio||{};try{var r=MediaSource.isTypeSupported(i.contentType),o=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:r&&o,smooth:!1,powerEfficient:!1})}catch(s){return Promise.resolve(t)}}({type:"file",video:{contentType:'video/mp4;codecs="hev1.1.6.L120.90"',width:1920,height:1080,bitrate:1e4,framerate:30}}).then((function(e){e&&e.supported?pw[2]=pw[2]+1:pw[2]=1})).catch((function(){pw[2]=pw[2]-1}));var gw={range:"0-1048576",timer:6e4,timeout:15e3},yw=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};cl(this,e),Object.keys(gw).map((function(e){void 0!==t[e]&&null!==t[e]||(t[e]=gw[e])})),this.options=t,this._headers={},this.intervalId=null,this.ishangUp=!1,this._data={contentLength:0,statusText:"",status:-1,speed:0,costTime:0,connectTime:0,contentType:""},this.url=[]}return dl(e,[{key:"setData",value:function(e){var t=this;if(Object.keys(e).map((function(i){"headers"!==i&&(t._data[i]=e[i])})),e.headers&&Object.keys(e.headers).length>0){this._headers=UC(e.headers),e.headers["content-type"]&&(this._data.contentType=e.headers["content-type"]);var i=(e.headers["content-range"]||"").split("/");i&&i.length>1&&(this._data.contentLength=parseInt(i[1]))}}},{key:"contentLength",get:function(){return this._data.length||0}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"start",n=this.options;this.url=e,!this.url||"start"!==i&&(this.ishangUp||this.intervalId)?DC("task>>cant`t trigger url",this.ishangUp,this.intervalId):(DC("task>>trigger url ",e),this.ishangUp=!0,this.intervalId&&this.clear(),this.intervalId=setTimeout((function(){t.clear()}),"start"===i?500:n.timer),xC(this.url,{range:"start"===i?"0-1024":n.range,timeout:n.timeout}).then((function(e){DC("getXhr>>check result ",e),t.setData(e||{}),t.ishangUp=!1})).catch((function(e){DC("getXhr>>error ",e),t.ishangUp=!1,t._data.status=-1})))}},{key:"url",get:function(){return this.options.url},set:function(e){e&&(this.options.url=e)}},{key:"serverIp",get:function(){return this._headers.x_response_sinfo||""}},{key:"headers",get:function(){return this._headers||{}}},{key:"status",get:function(){return this._data.status||-1}},{key:"speed",get:function(){return this._data.speed}},{key:"clear",value:function(){clearTimeout(this.intervalId),this.intervalId=null}}]),e}(),vw="ProgressInfo";var mw=function(){function e(){cl(this,e),this._init()}return dl(e,[{key:"_init",value:function(){this.played=[],this.playedSize=0,this.cachedSize=0,this.pcdnCached=0,this.cachedVideoSize=0,this.pcdnVideoCached=0,this.file={audio:0,video:0},this.lastBitrate=null,this.curBitrate={vBitrate:0,aBitrate:0,cdnSize:0,pcdnSize:0,definition:"",fileid:""},this.nextBitrate={start:-1},this.currentTime=0,this.buffered=[],this.cachedTime=0,this.duration=0}},{key:"reset",value:function(){this._init()}},{key:"getFileSize",value:function(e){var t=this.curBitrate,i=t.vBitrate,n=t.aBitrate;return{audio:Math.round(e*n/8),video:Math.round(e*i/8),total:Math.round(e*(i+n)/8)}}},{key:"updatePlayed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.played,n=i.length;if(0===t||n<1){var r=n>0?i[n-1]:null,o=this.curBitrate,s=o.vBitrate,a=o.aBitrate;r&&(r.end<0||r.end-r.start<1)?(r.end<0?r.start=e:r.end=e,r.vBitrate=s,r.aBitrate=a):i.push({start:e,end:-1,vBitrate:s,aBitrate:a})}else i[n-1].end=e}},{key:"calculatePlaySize",value:function(){var e=this.played,t=this.curBitrate,i=function(e){for(var t=0,i=0;i<e.length;i++){var n=e[i];n.end<0||(t+=n.end-n.start)}return t}(e),n=Math.round((t.aBitrate+t.vBitrate)*i/8);return this.playedSize+=n,DC(vw,"calculatePlaySize","duration: ".concat(i," playedSize:").concat(this.playedSize),this.played),this.played=[],this.playedSize}},{key:"copyBitrateInfo",value:function(e,t){return["aBitrate","vBitrate","definition","fileid","cdnSize","pcdnSize"].forEach((function(i){e[i]&&(t[i]=e[i])})),t.cdnSize=e.cdnSize,t.pcdnSize=e.pcdnSize,t}},{key:"checkNextBitrate",value:function(e){var t=this.nextBitrate;if(t.start>-1&&e>=t.start){var i=this.curBitrate;this.calculatePlaySize(),DC(vw,"checkNextBitrate",e,t.start,this.cachedSize),this.copyBitrateInfo(t,i),this.updatePlayed(e,0),t.start=-1,t.fileid="",["vBitrate","aBitrate","cdnSize","pcdnSize"].forEach((function(e){t[e]=0}))}}},{key:"updateLastDefInfo",value:function(){var e=this.curBitrate;if(e.vBitrate>0){var t={};this.copyBitrateInfo(e,t),this.lastBitrate=t}}},{key:"updateDefInfo",value:function(e,t){DC(vw,"updateDefInfo",t,this.curBitrate.vBitrate,e);var i=e.mediaType,n=e.start,r=e.bitrate,o=e.definition,s=e.fileid,a={cdnSize:0,pcdnSize:0};"audio"===i?a.aBitrate=r:(a.vBitrate=r,a.definition=o,a.fileid=s,this.updateLastDefInfo()),a.start=n,this.nextBitrate=a,this.checkNextBitrate(t)}},{key:"upDateDownload",value:function(e){var t=e.cdn_size,i=e.pcdn_size,n=e.mediaType,r=this.curBitrate,o=this.nextBitrate,s=0,a=0;i?(s=1,a=i):t&&(a=t),this.cachedSize+=a,"video"===n&&(this.cachedVideoSize+=a,s>0&&(this.pcdnVideoCached+=a)),s>0&&(this.pcdnCached+=a);var l=o.start>=0?o:r;l.cdnSize+=a,s>0&&(l.pcdnSize+=a)}},{key:"updateBuffered",value:function(e){var t=function(e){var t=[];if(!e||e.length<1)return t;for(var i=0;i<e.length;i++){var n=parseInt(1e3*e.start(i),10)/1e3,r=parseInt(1e3*e.end(i),10)/1e3;t.push({start:n,end:r})}return t}(e),i=0;t.forEach((function(e){var t,n;i+=(t=e.end,n=e.start,parseInt(1e3*t-1e3*n,10)/1e3)})),this.buffered=t,this.cachedTime=i}},{key:"isDefInfoFirstChange",value:function(){return!(this.curBitrate&&this.curBitrate.vBitrate>0)}}]),e}();const _w="0.12.10";var Ew=["try_req_num","req_node_succ","conn_req_num","has_ret_node","conn_fail_num","conn_jump_num"];DC("xgVodLogger version is ".concat(_w));var Tw,Sw=(Tw="Object",function(e){return Object.prototype.toString.call(e)==="[object ".concat(Tw,"]")}),bw=1300,kw="__tea_cache_tokens_".concat(bw),Cw="",Iw=null,Aw=function(){function e(t,i){var n=this;if(cl(this,e),pl(this,"initializeUrlLog",(function(e){var t=e&&e.url?e.url:"String"===BC(e)?e:"";"String"!==BC(t)&&(t=""),n.urlLog={initial_url:t,initial_host:PC(t),initial_ip:""}})),pl(this,"onXgLogCache",(function(){var e,t=n._getLogCache();t&&(n._templog={vtype:null===(e=n.player)||void 0===e?void 0:e.vtype,log:t},n.onOneTemp())})),pl(this,"onPrfDataSize",(function(e){n._progressInfo.upDateDownload(e)})),pl(this,"onDegrade",(function(e){e&&(e.local_time=(new Date).getTime(),n.onOneEvent({end_type:"degrade"},e))})),pl(this,"onMediaFormatError",(function(e){n.onOneEvent({end_type:"".concat(e.error_type||"","Error")})})),pl(this,"onReplayBtnClick",(function(){n.resetLoggerParams()})),pl(this,"onBeforeDefinitionChange",(function(){n.resLogs.ldst=LC(),n._endType="switch"})),pl(this,"onDefinitionChangeDetail",(function(e){var t=n._progressInfo;t.updateDefInfo(e,n.player.currentTime),t.lastBitrate&&"video"===e.mediaType&&n.sendSwitchOpera("changedetail")})),pl(this,"onDefinitionChange",(function(e){var t=e.from,i=e.to;n.changeResolution({from:t,to:i,startTime:n.resLogs.ldst,operaType:"switch"}),DC("onDefinitionChange from:".concat(t,", to:").concat(i))})),pl(this,"onDefiChangeSuccess",(function(){DC("onDefinitionChangeSuccess"),n.updateVideoSize(),n.triggerTask("start")})),pl(this,"onAbrChange",(function(e){var t=e.prev,i=e.cur,r=e.abrInfo;if(n.player.abrInstance){var o=n.player.abrInstance.eventInfo;DC("abrChange",o),o.last_definition=t,o.now_definition=i,n.abrInfo.abr_event_info.video_switch.push(o),n.changeResolution({from:t,to:i,startTime:LC(),operaType:"abr_switch",abrInfo:r})}})),pl(this,"onTimeUpdate",(function(){var e=n.playlogs,t=n.resLogs,i=n.player;if(n.errorLog.try_err_c=0,e.vt||1!==n.startStep||(e.vt=RC(),DC("onTimeUpdate: first frame inited","currentTime11:".concat(i.currentTime," vt-pt:").concat(e.vt-e.pt," vt-nt:").concat(e.vt-e.nt," vt-rt:").concat(e.vt-e.rt)),n.startStep=2),!t.initial_resolution){var r=i.currentDefitionFromPlayer&&i.currentDefitionFromPlayer.definition?i.currentDefitionFromPlayer.definition:i.config.defaultDefinition||"".concat(i.video.videoHeight,"p")||"";r=FC(r),t.initial_resolution=r}t.final_resolution||(t.final_resolution=t.initial_resolution);var o=e.played.length;o<1?e.played.push({begin:i.currentTime,end:-1}):e.played[o-1].end=i.currentTime,n._progressInfo.updatePlayed(i.currentTime),n._progressInfo.checkNextBitrate(i.currentTime);var s=t.played.length;s<1?t.played.push({begin:i.currentTime,end:-1}):t.played[s-1].end=i.currentTime,n.lastVideoTime=i.currentTime||0})),pl(this,"onVideoProgress",(function(){n.updateBuffers(),n._progressInfo.updateBuffered(n.player.buffered)})),pl(this,"onCanplay",(function(){DC("onCanplay","this.startStep:".concat(n.startStep," ").concat(RC())),n.setVt()})),pl(this,"onLoadeddata",(function(){DC("onLoadeddata","this.startStep:".concat(n.startStep," ").concat(RC())),n.setVt(),n.updateVideoSize()})),pl(this,"onLoadStart",(function(){n.commonParams.web_url=location.href;var e=OC(n.player.currentSrc);n.triggerTask("start"),DC("onLoadStart","this.startStep:".concat(n.startStep," ").concat(RC()," isSrcEmpty:").concat(e," player.src:").concat(n.player.src)),0!==n.startStep||e||"visible"!==document.visibilityState||n.setPt()})),pl(this,"onBufferedChange",(function(){var e=n.player.video&&n.player.video.buffered;if(e){var t=e.length;t>0&&e.end(t-1)+1>n.player.duration&&(n.bft=RC())}})),pl(this,"onPlayerInited",(function(){DC("player init"),n._playerCreatedTime=RC(),n.playlogs.rt=RC()})),pl(this,"onNotAutoPlay",(function(){DC("onNotAutoPlay","autoplay:".concat(n.isAutoplay)),0===n.isAutoplay?n.isAutoplay=2:1===n.isAutoplay&&(n.isAutoplay=3)})),pl(this,"onPlayerError",(function(e){e=e||{};var t=n.errorLog,i=n.player;if(DC("onPlayerError","this.player.type:".concat(n.player.type," this.player.replayRunning:").concat(n.player.replayRunning," isSupportMP4:").concat(hw.isSupportMP4," isPC:").concat(hw.isPC)),DC("onPlayerError",e),n.load_state=lI,n._endType="error",n.suspendWaitingStatus("onPlayerError"),n._progressInfo.calculatePlaySize(),"dash"!==i.type||!i.replayRunning){if(e.url||(e.url=n.player.currentSrc),hw.isPC&&!hw.isSupportMP4||hw.isSpider)return t.errc=JC[5],t.errt=ZC.notSupport,n.onOneError({errorType:t.errt,code:t.errc,url:e.url,headers:e.headers||{},message:e.message||""},0),void(n._isOnePlayReport=!0);t.errt=e.errorTypeCode||(e.errorType&&ZC[e.errorType]?ZC[e.errorType]:9999),t.message=e.message||"",e.errorCode?t.errc=e.errorCode>0&&JC[e.errorCode]?JC[e.errorCode]:e.errorCode:e.code&&(t.errc=e.code>0&&JC[e.code]?JC[e.code]:e.code),t.last_errors.push(t.errc),0===t.fir_errc&&(t.fir_errc=t.errc),n.sendSwitchOpera(uI),n.onOnePlay(uI),n.onOneTemp(uI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade);var r=!1,o=e.mediaError;o&&n._options.needXhrCheck&&(4===o.code||2===o)&&(r=!0),n.onOneError({endState:gI,errorType:t.errt,code:t.errc,url:e.url,headers:e.headers||{},message:e.message||""},0,r),n.sendEventsQueue()}})),pl(this,"onPlayInterfaceInfo",(function(e){DC("onPlayInterfaceInfo",e);var t=n.errorLog,i=n.apiLog,r=n.playlogs;if(e&&Object.keys(e).map((function(t){"code"===t?i.vsc=e[t]:"message"===t?i.vsc_message=e.message||"success,视频可正常播放":i[t]=e[t]})),r.at=e.timestamep||(new Date).getTime(),(!e.error||-9988!==e.error.errc)&&(i.vsc=e.code||10,i.vsc_message=e.message||"success,视频可正常播放",e.error)){var o=e.error;t.errt=1e3,t.errc=o.errc||-9998,t.last_errors.push(o.errc||-9998),0===t.fir_errc&&(t.fir_errc=o.errc||-9998),t.accu_errc++,1===t.accu_errc&&(t.fir_errt=LC()),n.onOneError({errorType:1e3,code:o.errc||-9998,url:"",headers:{}})}})),pl(this,"onProgressEvent",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.netLog;if(e.speed){var i=e.speed>1e6?Math.floor(e.speed/1e3):e.speed;t.downloadSpeed=i,t.totalSpeed+=i,t.rqCount++}"oversize"!==e.type&&t.requestCount++,e.connectTime&&(t.connectCost=e.connectTime);var r=t.rqCount<7?100:e.costTime>=5e3?20:10;if(!("success"===e.type&&parseInt(100*Math.random(),10)<=r)){var o=function(e){var t={};try{e=e.replace(/^http:|^https:/,"");for(var i=YC||[],n=function(n){if(i[n].name.replace(/^http:|^https:/,"")===e)return["domainLookupEnd","domainLookupStart","startTime","requestStart","responseEnd","responseStart","connectStart","connectEnd","fetchStart"].map((function(e){t[e]=Math.round(i[n][e])})),t.url=i[n].name,t.duration=Math.round(i[n].duration),t.domainDuration=t.domainLookupEnd-t.domainLookupStart,t.connectDuration=t.connectEnd-t.connectStart,"break"},r=i.length-1;r>=0&&"break"!==n(r);r--);return t}catch(o){return t}}(e.cdnUrl),s=e.xhr||{},a=e.type?"progress_".concat(e.type):"progress",l=e.headers;l||(l=wC(s));var u=ll(ll({},l=UC(l)),{},{download_speed:t.downloadSpeed,connect_cost:t.connectCost,c_dur:o.connectDuration||0,d_dur:o.domainDuration||0,r_dur:o.duration||0,rqtt:(new Date).getTime(),x_cache:l.x_response_cache||"",server_ip:l.x_response_sinfo});e.status?t.status=e.status:s&&s instanceof window.XMLHttpRequest&&(t.status=s.status||0),u.status=t.status;var c=e.cdnUrl||e.url;"error"===e.type&&n.merror.cdn.push(ll(ll({costTime:e.costTime,cur_play_pos:e.pos,cdn_url:c,cdn_host:PC(c)},u),l)),n.onOneEvent({costTime:e.costTime,vid:e.vid,end_type:a,cur_play_pos:e.pos,cdn_url:c,cdn_host:PC(c)},u,"error"===e.type?0:2)}})),pl(this,"onNext",(function(){if(DC("onNext:startStep:",n.startStep),n.startStep>0){if(n._reportInvalidVV(cI))return;n.sendSwitchOpera(cI),n.onOnePlay(cI),n.onOneTemp(cI),n.sendEventsQueue()}n.vtype=null,n.playlogs.lc=0,n.resetLoggerParams()})),pl(this,"onNextEnded",(function(){var e=n.player,t=n.resLogs,i=FC(e.config.defaultDefinition||"");t.initial_resolution=i,t.final_resolution=i})),pl(this,"onXgLogWaiting",(function(e){var t=n.playlogs,i=n.resLogs,r=n.stall;if(n._options.checkByInnerLog&&0===e.type){DC("onXgLogWaiting",e);var o=e.endType,s=e.costTime,a=e.start,l={download_speed:n.realSpeed,avg_speed:n.avgSpeed,mse_op:n.mp4MseOpLength,mp4_load_range:n.mp4LoadSegmentTimeRange,bitrate:n.curBitrate};if("waitingStart"===e.eventType)return n.onOneEvent({costTime:s,end_type:"waitstart"},l,2),void n.appendStallInfo("start",a);if("waitingEnd"===e.eventType){var u=LC();DC("onXgLogWaiting>>".concat(o,"|costTime:").concat(s," vt:").concat(t.vt)),n.appendStallInfo("end",u,o),t.bc++,n.checkInBuffer(n.player.currentTime)?(t.de_bu_acu_t+=s,t.dbc++):(t.nbc++,t.n_bu_acu_t+=s),i.bc++,t.bu_acu_t+=s,i.bu_acu_t+=s,r.end=n.cur_play_pos,r.cost=s,r.acc+=r.cost,1===r.sc&&(r.endf=n.cur_play_pos),n.onOneEvent({costTime:s,end_type:"waitend"},l,2)}}})),pl(this,"onSeeking",(function(){if(!OC(n.player.src)){var e=n.resLogs,t=n.playlogs,i=n.player,r=n.seekLog;DC("onSeeking","currentTime:".concat(i.currentTime)),0===n.startStep&&n.setPt(),n.suspendWaitingStatus("seek"),n.isSeeking&&n.suspendSeekStatus("seek",!1),n.isSeeking=!0,t.played.push({begin:i.currentTime,end:-1}),e.played.push({begin:i.currentTime,end:-1}),n._progressInfo.updatePlayed(i.currentTime,0),r.lastSeekStartTime=LC(),r.seekBefore=n.lastVideoTime.toString(),r.buf_include=n.checkInBuffer(n.player.currentTime)?1:0,r.intervalId=setTimeout((function(){n.isSeeking&&n.suspendSeekStatus("seekTimeout",!0)}),6e4)}})),pl(this,"onSeeked",(function(){OC(n.player.src)||n.isSeeking&&n.suspendSeekStatus("seeked",!0)})),pl(this,"onPlaying",(function(){n.suspendWaitingStatus("play"),n.load_state=sI;var e=LC();n.pauseLog.isPausing&&(n.pauseLog.isPausing=!1,n.pauseLog.pause_acu_t+=e-n.pauseLog.pause_start)})),pl(this,"onPlayCatch",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorTypeCode:0,errorCode:0,url:"",headers:{},status:0};if(DC("onPlayCatch",e,t),e){switch(e){case"mp42dash":n.vtype="DASH_2";break;case"dash2mp4":n.vtype="MP4_2";break;case"dash1mp4":n.vtype="MP4_1";break;default:n.vtype=e}var i=n.errorLog,r=n.playlogs;n.merror.playCatch.push(ll({errc:t.errorCode,errt:t.errorType},t.headers)),n.setBr("playcatch"),i.accu_errc++,i.try_err_c++,i.fir_errc=t.errorCode,t.errorCode&&i.last_errors.push(t.errorCode),n.suspendWaitingStatus("playcatch"),n.suspendSeekStatus("playcatch"),n.sendDegradeLog("playCatch",r.degrade,{cdn_url:t.url}),r.degrade=e,n.onOneError({errorType:t.errorTypeCode,code:t.errorCode,url:t.url||"",status:t.httpCode||t.status,headers:t.headers||{},vid:t.vid||n.vid,preload_hit:t.preloadHit||0,preload_cached:t.preloadCached||0,endState:fI,costTime:t.costTime,message:t.errorMessage||t.message,interval_time:t.timerStep||0},0)}})),pl(this,"onMediaExpied",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{errorType:"",errorTypeCode:0,errorCode:0,url:"",headers:{},status:0},t=n.errorLog,i=n.playlogs;DC("onMediaExpied",e),n.suspendWaitingStatus("expied"),n.setBr("expied"),t.accu_errc++,t.try_err_c++,t.last_errors.push(e.errorCode),i.at=(new Date).getTime(),n.merror.expied.push(ll({errorType:e.errorTypeCode||e.errorType,code:e.errorCode,url:e.url||"",status:e.status},UC(e.headers||{}))),n.onOneError({errorType:e.errorTypeCode||e.errorType,code:e.errorCode,url:e.url||"",status:e.status,headers:e.headers||{}},0)})),pl(this,"onLog",(function(e){DC("onLog",e);var t=e.type;if(delete e.type,t)switch(t){case yI:break;case _I:n._templog||(n._templog={}),n._templog=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return Object.keys(t).map((function(n){var r,o;e[n]="append"===i?(r=e[n],o=t[n],!r||"string"!=typeof o&&"number"!=typeof o?o:"".concat(r," ").concat(o)):t[n]})),e}(n._templog,e.data,e.action),n._templog.preload_hit&&(n._cacheFile=TI);break;case vI:var i=n.errorLog;i.accu_errc++,i.try_err_c++,n.setBr("mp4error"),i.last_errors.push(e.code),n.onOneError(e,0);break;case mI:var r=function(e,t){var i={ext:e.ext||{},data:{}};return Object.keys(e).map((function(n){t[n]?i.data[t[n]]=e[n]:"ext"!==n&&(i.ext[n]=e[n])})),i}(e,{costTime:"costTime",vid:"vid",end_type:"end_type",pos:"cur_play_pos",cdnUrl:"cdn_url"});r.ext&&["start","end"].map((function(e){r.ext[e]&&(r.ext["ext_".concat(e)]=r.ext[e],delete r.ext[e])})),n.onOneEvent(r.data,r.ext,2)}})),pl(this,"onPlay",(function(){DC("onPlay","this.startStep :".concat(n.startStep," this.isEnded:").concat(n.isEnded)),n.isEnded&&(n.resetLoggerParams(),n.setPt())})),pl(this,"onPause",(function(){DC("onPause");var e=n.pauseLog;e.isPausing=!0,e.pause_start=LC()})),pl(this,"onWaiting",(function(){var e=n._options;n.updateCurBuffer("onWaiting"),e.checkByInnerLog||(DC("onWaiting>","isSeeking:".concat(n.isSeeking," startStep:").concat(n.startStep," intervalId:").concat(n.stallIntervalId)),n.wait_buf_include=n.checkInBuffer(n.player.currentTime,-1e3)?1:0,n.isSeeking||0===n.playlogs.vt||n.inWaitingStart>0||(n.stallIntervalId&&(window.clearTimeout(n.stallIntervalId),n.stallIntervalId=null),n.inWaitingStart=LC(),n.waitStartTime=n.cur_play_pos,n.stallIntervalId=window.setTimeout((function(){var e=n.stall;DC("this.stallIntervalId>>".concat(n.stallIntervalId," cost: ").concat(LC()-n.inWaitingStart)),n._endType="wait",n.load_state=aI,n.vtype.indexOf("MP4")>-1&&n.player.currentTime>10&&n.task&&(n.triggerTask("waiting",n.initial_url),n.requestCount++),e.start=n.waitStartTime,e.bc++,1===e.bc&&(e.startf=n.waitStartTime),window.clearTimeout(n.stallIntervalId),n.stallIntervalId=null,n.startWaitingStatus(n.inWaitingStart,LC()-n.inWaitingStart),n.stallIntervalId=setTimeout((function(){n.inWaitingStart>0&&n.suspendWaitingStatus("timeout")}),6e4)}),200)))})),pl(this,"onEnded",(function(){if(n.initial_url){DC("onEnded","watchDur:".concat(n.watchDur," vt:").concat(n.vt," pt:").concat(n.pt)),n.isEnded=!0;var e=n.resLogs.df,t=n._progressInfo;t.calculatePlaySize(),t.cachedSize<1?n.changeResolution({from:e,to:e,startTime:LC(),operaType:"leave_switch",endType:"ended"}):n.sendSwitchOpera(hI),n.onOnePlay(hI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade),n.onOneTemp(hI),n.sendEventsQueue(),n.playlogs.lc++}})),pl(this,"onUnload",(function(){0!==n.startStep&&n.initial_url&&(n.onOneTemp(dI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade),n._reportInvalidVV(dI)||(n.sendSwitchOpera(dI),n.onOnePlay(dI,!0)))})),pl(this,"onVisibilitychange",(function(){var e=n.playlogs.vt;"visible"===document.visibilityState&&(e||n.setPt())})),pl(this,"onDestroy",(function(){DC("onDestroy:this.startStep:".concat(n.startStep," initial_url:").concat(n.initial_url," ").concat(!!n.initial_url)),n.onOnePlay(pI),n.startStep>0&&n.initial_url&&(n.onOneTemp(pI),n.sendDegradeLog("playCatch_end",n.playlogs.degrade));var e=n.resLogs.df;n._progressInfo.cachedSize<1?n.changeResolution({from:e,to:e,startTime:LC(),operaType:"leave_switch",endType:"destroy"}):n.sendSwitchOpera(hI),n.sendEventsQueue(),hw.isPC?window.removeEventListener("beforeunload",n.onUnload):(hw.isMobile||hw.isPad)&&window.removeEventListener("pagehide",n.onUnload),document.removeEventListener("visibilitychange",n.onVisibilitychange),n.listeners.forEach((function(e){n.player.off(e.evt,e.handler)})),n.clearTimers(),n.player.off("destroy",n.onDestroy),n.task&&n.task.clear()})),pl(this,"onOnePlay",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(DC("onOnePlay _isOnePlayReport:".concat(n._isOnePlayReport," isLeave: ").concat(t," endState:").concat(e)),!n._isOnePlayReport){var i=n.errorLog,r=n.playlogs,o=n.abrInfo,s=n.resLogs,a=n.player,l=n.apiLog,u=n.pauseLog,c=n.stall,h=n.netLog,d=n.watchDur;n._isOnePlayReport=!0;var p=RC();n.getBufferTime(a);var f=n.getFrameInfo(),g=n.getPerformance(),y=i.errc,v=n._progressInfo,m=v.playedSize,_=v.cachedSize,E=v.pcdnCached,T=v.cachedVideoSize,S=v.pcdnVideoCached,b=n._progressInfo.getFileSize(a.duration),k=n.seekLog,C=k.sc,I=k.sat,A={bc:WC(d,n.bc),bu_acu_t:WC(d,n.bu_acu_t),sc:WC(d,C),sat:WC(d,I)};n.setExt();var P=n._getCompatibilityInfo();n.setNovv(null,e);var w=ll(ll(ll(ll({local_time:(new Date).getTime(),log_type:"video_playq",plugin_exception:0,player_create_exception:"",v:n.vid,initial_url:n.initial_url,initial_host:n.initial_host,initial_ip:n.curHeaders.x_response_sinfo||0,initial_type:n.initial_type},n.curHeaders),{},{initial_resolution:s.initial_resolution,final_resolution:s.final_resolution,pt:n.pt,prepare_start_time:r.nt,prepare_end_time:r.rt||RC(),vt:n.vt,lt:n.lt,lpt:n.lpt,fvt:n.fvt,nvt:n.nvt,bft:n.bft,sc:C,sat:I,bc:n.bc,dbc:r.dbc||0,nbc:r.nbc||0,video_net_s:n.videoNetworkState,status:n.curStatus,first_buf_startt:c.startf,first_buf_endt:c.endf,lc:r.lc,bu_acu_t:n.bu_acu_t,de_bu_acu_t:r.de_bu_acu_t||0,n_bu_acu_t:r.n_bu_acu_t||0,pause_acu_t:u.pause_acu_t,cur_play_pos:n.cur_play_pos,load_state:n.load_state,play_speed:n.playbackRate,playback_state:n.playback_state,end_state:e,watch_dur:d,switch_resolution_c:n.switchResolutionCount,is_start_play_automatically:n.isAutoplay,start_time:n.start_time,finish:n.finish,errt:i.errt,errc:y,vsc:l.vsc,vsc_message:i.message||l.vsc_message,api_str:l.api_str,auth:l.auth||l.logid,width:n.videoWidth,height:n.videoHeight,vd:n.vd,video_length:b.video,audio_length:b.audio,df:n.resolution,lf:s.lf,play_c:0,player_created_t:n.player_created_t,fir_errt:i.fir_errt,fir_errc:i.fir_errc,lv_method:0,ldst:s.ldst,ldet:s.ldet,is_disable_short_seek:0,mute:n.mute,volume:n.volume,download_speed:n.realSpeed?n.realSpeed:n.task&&n.task.speed?n.task.speed:h.downloadSpeed,avg_speed:n.avgSpeed?n.avgSpeed:h.rqCount>0?parseInt(h.totalSpeed/h.rqCount,10):0,bitrate:n.curBitrate,preload_state:n.preloadState,preload_hit:n.preLoadData.hit||0,preload_cached:n.preLoadData.duration||n.preLoadData.byteLength||0,mdl_req_num:h.requestCount,watingcost:n.watingCost,br:r.br,fbrt:r.fbrt,try_err_c:i.try_err_c,accu_errc:i.accu_errc,merror:jC(n.merror),ex:jC(n.exInfo),perf:jC(g),bufs:jC(n.buffers.allBuffer),vds:_,pvds:E,vps:m,vvds:T,pvvds:S,pcdn:jC(n.getPCDNStat())},n.buffers.curBuffer),{},{degrade:r.degrade,cache_file:n._cacheFile},f),{},{fullScreen:n._getFullScreenType(),encryptedInfo:jC(n.encryptedInfo),per100_info:jC(A)},P);0!==n.vt&&(w.et=p);var D=n._logstrcache||n._getLogCache();0===w.fvt&&D&&(w.log=D,n._logstrcache=null),null!=a&&a.softDecoder&&(w.soft_decoder=a.softDecoder),a&&a.dashState&&(w.dash_state=a.dashState),null!=a&&a.softDecoder&&(w.soft_decoder=a.softDecoder),o.abr_init_opts=a.config.autoBitrateOpts||{},w.abr_info=jC(n.abrInfo);var L=P.is_support_mp4&&P.is_support_mse_mp4;if(P.is_spider||hw.isPC&&!L&&0===n.fvt)DC("is_spider",P.is_spider,"is_support_mp4",P.is_support_mp4);else if(t){var R=!n._options.disableLocalCache;n.reportLog(zC,w,R?1:0)}else n.reportLog(zC,w)}})),pl(this,"onOneEvent",(function(e){var t=e.costTime,i=e.vid,r=e.end_type,o=e.cur_play_pos,s=e.cdn_url,a=e.cdn_host,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=arguments.length>2?arguments[2]:void 0;DC("onOneEvent",r);var c=n.buffers,h=c.curBuffer,d=c.allBuffer,p=n.getFrameInfo(),f=ll(ll({local_time:(new Date).getTime(),v:i||n.vid,cost_time:t,end_type:r||n.end_type,cdn_url:s||n.url,cdn_host:a||"",initial_type:n.initial_type,resolution:n.resolution,play_speed:n.playbackRate,first_frame_interval:LC()-n.pt,last_switch_interval:n.getLastInterval("lastSwitchStartTime",n.resLogs,!1),last_seek_interval:n.updateSeekPt(!1),last_event_interval:n.getLastInterval("lastEventTime"),cur_play_pos:o||n.cur_play_pos,video_ready_s:n.videoReadyState,video_seeking:n.videoSeeking,video_paused:n.videoPaused,bufs:jC(d),retry_count:n._retryCount,at:n.playlogs.at,bc:n.stall.bc,stay_seconds:parseInt(((new Date).getTime()-n.playlogs.at)/1e3,10),preload_state:n.preloadState,preload_hit:n.preLoadData.hit,preload_cached:n.preLoadData.duration||n.preLoadData.byteLength},h),p);r.indexOf("waitend")>=0&&t>3e3&&(f.log=n._getLogCache());var g=n.player,y=g.currentTime,v=g.duration-y;if(r.indexOf("waitstart")>=0&&v<=1){var m=f.local_time,_=f.v,E=f.cost_time,T=f.cdn_url,S=f.first_frame_interval,b=f.cur_play_pos,k=f.video_ready_s,C=f.video_seeking,I=f.video_paused,A=f.bufs,P=f.bc,w=f.preload_hit;n.reportLog(qC,ll({end_type:"longwait",local_time:m,v:_,cost_time:E,cdn_url:T,first_frame_interval:S,cur_play_pos:b,video_ready_s:k,video_seeking:C,video_paused:I,bufs:A,bc:P,preload_hit:w},h),u)}if("waitstart"===r&&"function"==typeof n._options.getPageFPS){var D=n._options.getPageFPS();f.cur_fps=D.curFPS||0,f.avg_fps=D.avgFPS||0}r.indexOf("wait")>-1&&(f.buf_include=n.wait_buf_include),r.indexOf("timeout")>-1&&f.cost_time>bI&&(f.cost_time=bI);var L=n.player;L&&L.dashState&&(f.dash_state=n.player.dashState),Object.keys(l).forEach((function(e){f[e]=l[e]})),f.ex=jC(n.getPlayerExt()),n.addIfExist("drm_type",n._options,f),n.reportLog(qC,f,u)})),pl(this,"onOneTemp",(function(){if(DC("onOneTemp>>",!n._templog),n._templog){var e=n.player,t=n.playlogs,i=n.pauseLog,r=n.errorLog,o=n.resLogs,s=n.watchDur,a=ll(ll(ll({local_time:(new Date).getTime()},n._templog),{},{v:n.vid,initial_type:n.initial_type,pt:n.pt,vt:n.vt,lt:n.lt,fvt:n.fvt,bc:n.bc,bu_acu_t:n.bu_acu_t>SI?0:n.bu_acu_t,pause_acu_t:i.pause_acu_t,cur_play_pos:n.cur_play_pos,watch_dur:s>SI?0:s,finish:n.finish,errt:r.errt,errc:r.errc,vd:n.vd,df:n.resolution,lf:o.lf,br:t.br,fbrt:t.fbrt,try_err_c:r.try_err_c,accu_errc:r.accu_errc,dash_break:2===e.dashBufferBreak?1:0,bufs:jC(n.buffers.allBuffer),vs:o.vs,vds:o.vds,vps:o.vps},n.buffers.curBuffer),{},{degrade:t.degrade});0!==n.vt&&(a.et=RC()),["drm_type","dynamic_type"].forEach((function(e){n.addIfExist(e,n._options,a)})),n.reportLog(QC,a,0),n._templog=null}})),this.player=t,void 0===this.player||null===this.player)throw new Error("player is ".concat(this.player));if(i&&i.line_app_id){i.isTask&&(this.task=new yw),this.eventQueue=[],this._instanceCreateTime=(new Date).getTime(),i.codec_type=i.codec_type||"h264",this._envInfo=i.envInfo||{},this._options=i,!this._options.maxQueueCount&&(this._options.maxQueueCount=5),this.line_app_id=parseInt(i.line_app_id,10)||0,this.line_user_id=(i.line_user_id||"").toString(),this.playerCoreVersion=t.version,this.playerVersion=i.playerVersion,this.closeSeekLog=i.closeSeekLog||!1,this.start_time=1e3*(i.start_time||0),this._initial_resolution="",this.__vtype=null,this.__dt="",this._progressInfo=new mw,this.resetLoggerParams();try{this.initializeTracker(),this.sendLocalLog(),this.bindEvt(),DC("logger constructor:".concat(this.player.video))}catch(r){console.error(r)}}else console.warn("player.config.vodLogOpts.line_app_id is necessary for plugin xgVodLogger")}return dl(e,[{key:"resetLoggerParams",value:function(){DC("resetLoggerParams");var e=this.playlogs?this.playlogs.lc:0;this.playlogs={nt:RC(),vt:0,rt:this.isEnded?RC():0,at:0,pt:0,bu_acu_t:0,bc:0,br:0,fbrt:"",dbc:0,de_bu_acu_t:0,nbc:0,n_bu_acu_t:0,played:[{begin:0,end:-1}],degrade:"none",lc:e},this.degradeLog={bu_acu_t:0,bc:0,watch_dur:0,hasSendEnd:!1},this.buffers={allBuffer:[],curBuffer:{buf_diff:0,buf_s_pos:0,buf_e_pos:0,buf_include:0}},this.netLog={downloadSpeed:0,requestCount:0,connectCost:0,totalSpeed:0,rqCount:0,status:0},this.merror={cdn:[],player:[],playCatch:[],expied:[]},this.exInfo={stall:[]},this._templog=null,this._isOnePlayReport=!1,this.startStep=0,this.bft=0,this._progressInfo.reset(),this._novv={log_pt:RC()},this.initializeLogDatas(),this.initializeUrlLog()}},{key:"setNovv",value:function(e,t){!this._novv||this.fvt>0||(e&&(this._novv.errc=e.code,this._novv.errt=e.errorType,this._novv.errorMessage=e.message),this._novv.end_state=t,this._novv.novv_pt||(this._novv.novv_pt=RC(),this._novv.novv_lpt=RC()-this._novv.log_pt),this.player&&(this._novv.vtype=this.player.vtype,this.player.novv=this._novv))}},{key:"initializeLogDatas",value:function(){this.startStep=0,this.inWaitingStart=0,this.waitStartTime=0,this.lastVideoTime=0,this._endType="",this._retryCount=0,this.lastOperaTime=-1,this.lastEventTime=-1,this.stallIntervalId=null,this.seekLog={intervalId:0,lastSeekStartTime:LC(),seekBefore:0,sat:0,sc:0,buf_include:0},this.resLogs={lastSwitchStartTime:-1,switch_count:0,abr_switch_count:0,initial_resolution:"",final_resolution:"",ldst:0,ldet:0,df:"",lf:"",played:[],bc:0,bu_acu_t:0,sc:0,sat:0,buf:0,lbuf:0,lplayed:0,vs:0,vds:0,vps:0,vis:0,bitrate:0},this.apiLog={code:0,message:"",logid:"",api:"",auth:"",error:{}},this.errorLog={accu_errc:0,try_err_c:0,errt:0,errc:0,fir_errt:0,fir_errc:hw.isSupportMP4?0:1005,last_errors:[],message:""},this.pauseLog={pause_acu_t:0,isPausing:!1,pause_start:0},this.stall={sc:0,startf:0,endf:0,start:0,end:0,cost:0,acc:0},this._playerCreatedTime=0,this.load_state=oI,this.lv_method=6,this.isSeeking=!1,this.isEnded=!1,this.startStep=0,this.isAutoplay=this.player.config&&this.player.config.autoplay?1:0,this.abrInfo={abr_general_info:{},abr_event_info:{video_switch:[],video_stall:[],video_exit:{}},abr_play_info:{start_play_time_ms:0,is_hint:0,playback_info:{internet_speed_record:[],play_bitrate_record:[],buffer_length_record:[],play_speed_record:[]}},abr_user_info:{cancel_abr:0},abr_init_opts:this.player.config.autoBitrateOpts||{}},this._cacheFile=EI}},{key:"initSessionId",value:function(){var e="0";try{e=window.localStorage.getItem(kw).web_id||"0"}catch(oF){e="0"}this._sessionId=function(e){var t=(new Date).getTime();try{e=parseInt(e)}catch(i){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=window.performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)}))}(e),DC("sessionId ".concat(this._sessionId))}},{key:"initializeTracker",value:function(){var e=this,t=this._options;if(window.__xgplayer_vod_log__)this.tracker=window.__xgplayer_vod_log__;else{this.tracker=window.__xgplayer_vod_log__=new Iw("tracker");var i=t.channel||"cn",n={app_id:"cn"===(i="va"===i||"sg"===i?i:"cn")?bw:1300===bw?323254:bw,channel:i,log:!1,disable_sdk_monitor:!0,disable_heartbeat:!0};t.channelDomain&&(n.channel_domain=t.channelDomain),n.enable_ab_test=!!t.enableAbTest,this.tracker.init(n)}this.initSessionId();var r=navigator?navigator.hardwareConcurrency:0,o=navigator?navigator.deviceMemory:0;this.commonParams={play_type:0,source_type:"vid",sdk_version:_w,pc:this.playerCoreVersion,pv:this.playerVersion,line_app_id:this.line_app_id,line_user_id:this.line_user_id,app_version:t.appVersion||"",platform:hw.isPad?"pad":hw.isMobile?"mobile":"pc",cpu_core:Number(r)||0,memory_size:Number(o)||0,support:fw(),webdriver:navigator&&navigator.webdriver?1:0,player_sessionid:this.sessionId,web_url:window.location.href,user_agent:navigator.userAgent};var s=t.trackerConfig||{};DC("commonParams ",this.commonParams,s);var a=ll({evtParams:this.commonParams,disable_auto_pv:!0},s);!hw.name||hw.isChrome||hw.isSafari||(a.browser=hw.name,hw.appVersion&&(a.browser_version=hw.appVersion)),this.line_user_id&&(a.user_unique_id=this.line_user_id,!t.enableTeaWebId&&(a.web_id=this.line_user_id)),t.referrer&&(a.referrer=t.referrer,a.referrer_host=PC(t.referrer)),t.ext&&Object.keys(t.ext).map((function(i){e.exInfo[i]=t.ext[i]})),DC("trackConfig",a),this.tracker.config(a),this.tracker.start()}},{key:"resetDefiInfo",value:function(){var e=this.resLogs;e.played=[],e.bc=0,e.bu_acu_t=0,e.sc=0,e.sat=0}},{key:"sendLocalLog",value:function(){var e=this,t=PI.get();PI.remove(),t.map((function(t){Object.keys(t).map((function(i){if(DC("sendLocalLog",i,t[i]),e.player){e.player.emit("abLog",i,t[i]);var n=e._options.sendLocalCallback;n&&"function"==typeof n&&n(i,t[i])}e._track(i,t[i])}))}))}},{key:"_track",value:function(e,t){"function"==typeof this.tracker?this.tracker(e,t):this._options.enableBeacon&&e===zC?this.tracker.beaconEvent(e,t):this.tracker.event(e,t)}},{key:"bindEvt",value:function(){var e=this;this.listeners=[{evt:"play",handler:this.onPlay},{evt:"playing",handler:this.onPlaying},{evt:"pause",handler:this.onPause},{evt:"waiting",handler:this.onWaiting},{evt:"playInterfaceInfo",handler:this.onPlayInterfaceInfo},{evt:"ended",handler:this.onEnded},{evt:"loadeddata",handler:this.onLoadeddata},{evt:"loadstart",handler:this.onLoadStart},{evt:"canplay",handler:this.onCanplay},{evt:"progress",handler:this.onVideoProgress},{evt:"autoplay_was_prevented",handler:this.onNotAutoPlay},{evt:"seeking",handler:this.onSeeking},{evt:"seeked",handler:this.onSeeked},{evt:"complete",handler:this.onPlayerInited},{evt:"timeupdate",handler:this.onTimeUpdate},{evt:"bufferedChange",handler:this.onBufferedChange},{evt:"beforeDefinitionChange",handler:this.onBeforeDefinitionChange},{evt:"definitionChange",handler:this.onDefinitionChange},{evt:"definitionChangeSuccess",handler:this.onDefiChangeSuccess},{evt:"replayBtnClick",handler:this.onReplayBtnClick},{evt:"initialUrl",handler:this.initializeUrlLog},{evt:"ABR_CHANGE",handler:this.onAbrChange},{evt:"playCatch",handler:this.onPlayCatch},{evt:"log",handler:this.onLog},{evt:"progress_event",handler:this.onProgressEvent},{evt:"logger_next",handler:this.onNext},{evt:"playnext",handler:this.onNext},{evt:"nextEnded",handler:this.onNextEnded},{evt:"media_format_error",handler:this.onMediaFormatError},{evt:"xglog",handler:this.onXgLogWaiting},{evt:"xglog_cache",handler:this.onXgLogCache},{evt:"degrade",handler:this.onDegrade},{evt:"definitionChangeDetail",handler:this.onDefinitionChangeDetail},{evt:"prf_data_size",handler:this.onPrfDataSize}];var t=this.player.config.errorKey;DC(">>>errorKey",t);var i={evt:"error",handler:this.onPlayerError};t&&(i.evt=t),this.listeners.push(i),this.listeners.forEach((function(t){e.player.on(t.evt,t.handler)})),this.bindUnload()}},{key:"_getLogCache",value:function(){var e,t;return(null===(e=this.player)||void 0===e?void 0:e.logCache)||(null===(t=this.player)||void 0===t?void 0:t.getLogCache)}},{key:"addIfExist",value:function(e,t,i){if(Sw(t)){var n=t[e];!(null==n)&&(i[e]=n)}}},{key:"sendSwitchOpera",value:function(e){var t=this._progressInfo,i=t.lastBitrate,n=t.curBitrate,r=t.nextBitrate,o={costTime:0,operaType:"detail_switch",stateBefore:"",stateAfter:"",endType:e},s=null;if("changedetail"===e){if(!i)return;s=i,o.stateBefore=i.definition,o.stateAfter=r.definition}else s=n,o.stateBefore=n.definition,o.stateAfter="";var a={vds:s.cdnSize,pvds:s.pcdnSize,fileid:s.fileid};this.onOneOperator(o,a)}},{key:"changeResolution",value:function(e){var t=e.from,i=e.to,n=e.startTime,r=e.operaType,o=e.abrInfo,s=e.endType,a=void 0===s?"":s,l=this.resLogs;t=FC(t),i=FC(i),l.ldet=LC(),l.df=i,l.lf=t,l.final_resolution=i,l.switch_count++;var u=l.ldet-n,c={bc:l.bc,bu_acu_t:l.bu_acu_t,sc:l.sc,sat:l.sat,watch_dur:AC(l.played)};o&&(c.abrInfo=o),this.updateVds(),this.resetDefiInfo(),this._options.closeResolutionLog||this.onOneOperator({costTime:u,operaType:r,endType:a,stateBefore:t,stateAfter:i},c,0)}},{key:"getLastInterval",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=t[e],r=LC(),o=-1===n?-1:r-n;return i&&(t[e]=r),o}},{key:"updateSeekPt",value:function(e){return this.getLastInterval("lastSeekStartTime",this.seekLog,e)}},{key:"_reportInvalidVV",value:function(e){return!!this._isInvaidVV()&&(this.onOneError({endState:e,errorType:9998,code:-1,url:this.player.currentSrc,headers:{}},0),this._isOnePlayReport=!0,!0)}},{key:"_isInvaidVV",value:function(){return 0===this.vt&&-1===this.curStatus}},{key:"bindUnload",value:function(){hw.isPC?window.addEventListener("beforeunload",this.onUnload):(hw.isMobile||hw.isPad)&&window.addEventListener("pagehide",this.onUnload),document.addEventListener("visibilitychange",this.onVisibilitychange),this.player.once("destroy",this.onDestroy)}},{key:"clearTimers",value:function(){var e=this.seekLog;e.intervalId&&window.clearTimeout(e.intervalId),this.stallIntervalId&&window.clearTimeout(this.stallIntervalId)}},{key:"sendDegradeLog",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"playCatch",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};DC("sendDegradeLog",e,t,i);var n=this.degradeLog;if(!(n.hasSendEnd||"playCatch_end"===e&&"none"===t)){"playCatch_end"===e&&(n.hasSendEnd=!0);var r=this.bu_acu_t-n.bu_acu_t;this.onOneEvent({costTime:this.vd,vid:this.vid,end_type:e,cur_play_pos:this.player.currentTime,cdn_url:i.url},ll({degrade:t,vt:this.vt,pt:this.pt,fvt:this.fvt,bc:this.bc-n.bc,bu_acu_t:r>SI?0:r,watch_dur:this.watchDur-n.watch_dur},i),0)}}},{key:"_getFullScreenType",value:function(){return this.player.isFullscreen?CI.FULLSCREEN_TYPE:this.player.isCssfullScreen?CI.CSS:CI.NO_FULLSCREEN}},{key:"getBufferTime",value:function(e){var t=0,i=0,n=e.video&&e.video.buffered;if(n){for(var r=n.length,o=0,s=0;s<r;s++)o+=n.end(s)-n.start(s);t=i=1e3*o}return{video:t,audio:i}}},{key:"updateAbrInfo",value:function(e,t,i){e.abr_general_info=t.generalInfo,e.abr_event_info.video_exit={local_time_ms:(new Date).getTime(),buffer_length:t.bufferLength,internet_speed:t.downloadSpeed,now_bitrate:t.nowBitrate,play_speed:i},t.getAbrPlayInfo&&(e.abr_play_info=t.getAbrPlayInfo())}},{key:"getPerformance",value:function(){return this.player.performance||{}}},{key:"setExt",value:function(){var e=this,t=this.player.ext||{};t.performance&&delete t.performance,Object.keys(t).map((function(i){"performance"!==i&&(e.exInfo[i]=t[i])}))}},{key:"onOneOperator",value:function(e){var t=e.costTime,i=e.operaType,n=e.stateBefore,r=e.stateAfter,o=e.endType,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,l=this.getLastInterval("lastOperaTime"),u={local_time:(new Date).getTime(),v:this.vid,opera_type:i,state_before:n,state_after:r,cost_time:t,end_type:o||this.end_type,cdn_url:this.url,resolution:this.resolution,last_interval:l,bufs:jC(this.buffers.allBuffer),cur_play_pos:this.cur_play_pos,retry_count:this._retryCount};"seek"===i&&(u.buf_include=this.seekLog.buf_include,this.seekLog.buf_include=0);var c=this.player;c&&c.dashState&&(u.dash_state=this.player.dashState),Object.keys(s).forEach((function(e){u[e]=s[e]})),this.addIfExist("drm_type",this._options,u),this.reportLog($C,u,a)}},{key:"onOneError",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{errorType:0,code:0,url:"",headers:{},costTime:0,vid:"",message:"",preload_hit:0,preload_cached:0,interval_time:0},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];DC("onOneError",t);var r=this.errorLog,o=this.apiLog,s=this.resLogs,a=this.player,l=this.playlogs,u=UC(t.headers||{}),c=this.getPerformance(),h=t.code>0?0-t.code:t.code;this.setExt();var d=this._getCompatibilityInfo();this.setNovv(t,t.endState||uI);var p=ll(ll(ll({v:t.vid||this.vid,video_pos:this.cur_play_pos,local_time:(new Date).getTime(),cost_time:t&&t.costTime?t.costTime:0,errt:t.errorType,errc:h,es:this.es,cdn_url:t.url||this.url,bufs:jC(this.buffers.allBuffer),resolution:s.final_resolution,last_errors:r.last_errors.join(";"),vsc:o.vsc,vsc_message:t.message||o.vsc_message,server_ip:u.x_response_sinfo||0,initial_url:this.initial_url,initial_host:this.initial_host},u),{},{cur_play_pos:this.cur_play_pos},this.buffers.curBuffer),{},{degrade:l.degrade,end_state:t.endState||uI,preload_hit:t.preload_hit||0,preload_cached:t.preload_cached||0,ex:jC(this.exInfo),pref:jC(c),video_ready_s:this.videoReadyState,interval_time:t.interval_time||0},d);a&&a.dashState&&(p.dash_state=a.dashState);var f=this.player.currentSrc,g=NC(f)?NC(t.url)?this.initial_url:t.url:f,y={connectTime:0,status:0,statusText:"",isexpired:0,isBlob:NC(f)?1:0};if(n&&"String"===BC(g)){var v={};xC(g,{range:"0-8",timeout:2e3}).then((function(e){DC("getXhr>>check result ",e);var t=UC(e.headers||{});p.server_ip=t.x_response_sinfo,v=ll(ll({},y),{},{statusText:e.statusText||"",status:e.status||0,connectTime:0|e.connectTime,sinfo:t.x_response_sinfo||"",cinfo:t.x_response_cinfo||""})})).catch((function(e){v=ll(ll({},y),{},{statusText:-2===e.status?"timeout":"error",status:e.status})})).finally((function(){var t=function(e){if(!e||"String"!==BC(e))return 0;var t=0;try{var i=new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),n=e.match(i);if(null!==n)t=parseInt(n[2],10);else{var r=e.split("/");r.length>5&&8===r[4].length&&(t=parseInt(r[4],16))}return t>0?t<parseInt((new Date).getTime()/1e3,10)?KC:GC:VC}catch(o){return VC}}(g);v.isexpired=t,p.net=jC(v),e.reportLog(XC,p,i)}))}else p.net=jC(y),this.reportLog(XC,p,i)}},{key:"_getCompatibilityInfo",value:function(){var e=function(){if("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)return{support:!1,message:"MediaSource API not support"};for(var e=!1,t="",i=0;i<lw.length;i++){var n='video/mp4; codecs="'.concat(lw[i],'"'),r=MediaSource.isTypeSupported(n);t+="".concat(n," is ").concat(r," "),r&&(e=!0)}return{support:e,message:t}}();return{is_spider:hw.isSpider?1:0,is_support_mp4:hw.isSupportMP4?1:0,is_support_hevc:dw()?1:0,is_support_mse_mp4:e.support?1:0,support_mse_mp4:e.message}}},{key:"reportLog",value:function(t,i,n){var r=this,o=this._options,s=this.player.ABTestTag,a=this.commonParams;i.dynamic_type=this.dynamicType;var l="Array"===BC(o.absdkVersion)?o.absdkVersion.join(","):o.absdkVersion;i.absdkVersion=l||e.AB_SDK_VERSION,null!=s&&(i.abtest_tag=s);var u=this._options;i.codec_type=this.codecType,Sw(u)&&(kI.forEach((function(e){r.addIfExist(e,u,i)})),Object.keys(a).forEach((function(e){r.addIfExist(e,a,i)})),i.vtype=this.vtype),i.env_info=jC(this._envInfo||{}),i.support=fw(),i.visible="undefined"==typeof document?0:"visible"===document.visibilityState?1:0;var c=function(){if(1===n){var e={};return e[t]=i,void PI.set(e)}2!==n?(r.player&&r.player.emit("abLog",t,i),r._track(t,i)):r.addEventsQueue(t,i)};if("function"==typeof o.onReportLog){var h=o.onReportLog(t,i);null!=h&&h.then?h.finally((function(){return c()})):c()}else c()}},{key:"addEventsQueue",value:function(e,t){this.eventQueue.push({event:e,params:t}),this.eventQueue.length>=this._options.maxQueueCount&&this.sendEventsQueue()}},{key:"sendEventsQueue",value:function(){for(;this.eventQueue.length>0;){var e=this.eventQueue.pop();this._track(e.event,e.params)}}},{key:"startWaitingStatus",value:function(e,t){this.appendStallInfo("start",e),this.updateCurBuffer("startWaitingStatus"),this.onOneEvent({costTime:t,end_type:"waitstart"},{},2)}},{key:"triggerTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start",t=arguments.length>1?arguments[1]:void 0;DC("triggerTask>>",e),!OC(t=t||this.player.src)&&this.vtype.indexOf("MP4")>-1&&this.task&&this.task.trigger(t,e)}},{key:"appendStallInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start",t=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;this.exInfo.stall||(this.exInfo.stall=[]);var n=this.exInfo.stall;if("start"===e){n.length>6&&n.splice(0,n.length-6);var r=this.buffers.curBuffer;n.push({start:t,end:-1,endType:"waitstart",cost:0,cur:this.cur_play_pos,buf_s:r.buf_s_pos,buf_e:r.buf_e_pos,buf_i:r.buf_include})}else if("end"===e){var o=n.length-1;if(o<0)return;n[o].end<0&&(n[o].end=t,n[o].endType=i,n[o].cost=t-n[o].start)}DC("appendStallInfo",n)}},{key:"suspendWaitingStatus",value:function(e){var t=LC(),i=this.playlogs,n=this.resLogs,r=this.stall,o=this.inWaitingStart;if(!(o<=0||this.isSeeking||i.vt<=0)){if(DC("suspendWaitingStatus>>".concat(e,"|costTime:").concat(t-o," isSeeking:").concat(this.isSeeking)),this.appendStallInfo("end",t,e),t-o>200){var s=t-this.inWaitingStart;if(i.bc++,this.checkInBuffer(this.player.currentTime)?(i.de_bu_acu_t+=s,i.dbc++):(i.nbc++,i.n_bu_acu_t+=s),n.bc++,i.bu_acu_t+=s,n.bu_acu_t+=s,r.end=this.cur_play_pos,r.cost=s,r.acc+=r.cost,1===r.sc&&(r.endf=this.cur_play_pos),this.player.abrInstance&&!this.isSeeking&&this.playlogs.vt){var a=this.player.abrInstance;this.abrInfo.abr_event_info.video_stall.push({local_time_ms:(new Date).getTime(),stall_duration:parseFloat((s/1e3).toFixed(2)),buffer_length:a.bufferLength,internet_speed:a.downloadSpeed,now_bitrate:a.nowBitrate,play_speed:this.player.playbackRate,is_abr:a.isCurrentInAbr?1:0})}this.onOneEvent({costTime:s,end_type:"waitend_".concat(e)||"waitend"},{},2)}this._endType="",this.load_state=sI,this.inWaitingStart=0,this.waitStartTime=0,window.clearTimeout(this.stallIntervalId),this.stallIntervalId=null}}},{key:"suspendSeekStatus",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isSeeking){var i=this.seekLog,n=this.resLogs,r=this.player,o=LC()-i.lastSeekStartTime;DC("suspendSeekStatus>>","".concat(e," currentTime:").concat(r.currentTime," costTime:").concat(o," sat:").concat(i.sat," resLogs.sat:").concat(n.sat)),i.intervalId&&window.clearTimeout(i.intervalId),i.intervalId=null,this.isSeeking=!1;var s=this._endType="seek",a=i.seekBefore,l=(r.currentTime||0).toString();i.sc++,i.sat+=o>bI?0:o,n.sc++,n.sat+=o>bI?0:o,o>bI&&(o=bI),this.updateSeekPt(!0),!this.closeSeekLog&&t&&this.onOneOperator({costTime:o,operaType:s,stateBefore:a,stateAfter:l,endType:e})}}},{key:"setPt",value:function(){var e=this.playlogs;this.startStep=1,!e.pt&&this.player.currentTime&&(this.isSeeking=!0),e.pt||(e.pt=RC(),DC("setPt","init pt :".concat(e.pt,", document.visibilityState:").concat(document.visibilityState)))}},{key:"setVt",value:function(){var e=this.playlogs;1===this.startStep&&(e.vt||(e.vt=RC(),DC("setVt: first frame inited","vt-pt:".concat(e.vt-e.pt," vt-nt:").concat(e.vt-e.nt))),this.startStep=2)}},{key:"setBr",value:function(e){var t=this.playlogs;t.vt>0&&(0===t.br&&(t.fbrt=e||""),t.br++)}},{key:"codecType",get:function(){var e=this.player;return e&&e.config&&e.config.codecType?e.config.codecType:this._options.codec_type||"h264"}},{key:"url",get:function(){var e=this.player;return e&&e.config?e.config.url:""}},{key:"vid",get:function(){var e=this.player;return e&&e.config?e.config.vid:""}},{key:"bc",get:function(){return this.playlogs.bc}},{key:"bu_acu_t",get:function(){var e=this.playlogs.bu_acu_t;return e>SI?0:e}},{key:"pt",get:function(){return this.playlogs.pt||RC()}},{key:"vt",get:function(){var e=this.playlogs,t=e.vt;return e.pt>0?t:0}},{key:"fvt",get:function(){var e=this.playlogs,t=e.vt,i=e.pt,n=0;return t>0&&i>0&&(n=parseInt(t-i,10)),n>6e4?6e4:n}},{key:"nvt",get:function(){var e=this.playlogs,t=e.vt,i=e.nt;return t>0&&i>0?parseInt(t-i,10):0}},{key:"getFrameInfo",value:function(){if(this.player&&this.player.videoFrameInfo){var e=this.player.videoFrameInfo,t=e.dropped,i=e.corrupted,n=e.droppedRate;return{f_total:e.total,drop_count:t,drop_rate:n,corrupted:i}}return{f_total:0,drop_count:0,drop_rate:0,corrupted:0}}},{key:"vd",get:function(){var e=this.player;return e.duration&&"number"==typeof e.duration&&e.duration>0?parseInt(1e3*e.duration,10):e.config.duration&&"number"==typeof e.config.duration?parseInt(1e3*e.config.duration,10):0}},{key:"cur_play_pos",get:function(){return parseInt(1e3*this.player.currentTime,10)}},{key:"volume",get:function(){return this.player.volume}},{key:"buffer_time",get:function(){var e=0;try{var t=this.player.getBufferedRange();e=t[1]-t[0]}catch(i){e=0}return e}},{key:"player_created_t",get:function(){return this._playerCreatedTime}},{key:"playbackRate",get:function(){return this.player.playbackRate}},{key:"mute",get:function(){return this.player.muted?0:1}},{key:"videoWidth",get:function(){var e=this.player;return e&&e.video?e.video.videoWidth:0}},{key:"videoHeight",get:function(){var e=this.player;return e&&e.video?e.video.videoHeight:0}},{key:"preload",get:function(){var e=this.player;return!(!e||!e.video)&&e.video.preload}},{key:"initial_url",get:function(){var e=this.player.currentSrc;return e.indexOf("blob:")>-1&&this.urlLog.initial_url?this.urlLog.initial_url:OC(e)?"":e}},{key:"initial_host",get:function(){var e=this.player.currentSrc;return e.indexOf("blob:")>-1&&this.urlLog.initial_host?this.urlLog.initial_host:PC(OC(e)?"":e)}},{key:"curHeaders",get:function(){var e=this.player,t=this.task;return e&&e.__dash__&&e.__dash__.curReqVideoSegInfo?UC(e.__dash__.curReqVideoSegInfo.headers||{}):t?t.headers:{}}},{key:"curStatus",get:function(){var e=this.task,t=this.vtype,i=this.netLog;return t.indexOf("MP4")>-1?e?e.status:0:i.status}},{key:"play_type",get:function(){return 0}},{key:"resolution",get:function(){var e=this.player.curDefinition;return e?"".concat(e.definition):this.resLogs.df}},{key:"sessionId",get:function(){return this._sessionId}},{key:"finish",get:function(){return this.isEnded?1:0}},{key:"end_type",get:function(){return this._endType}},{key:"avgSpeed",get:function(){return this.player&&this.player.avgSpeed?this.player.avgSpeed:0}},{key:"realSpeed",get:function(){return this.player&&this.player.realTimeSpeed?this.player.realTimeSpeed:0}},{key:"mp4MseOpLength",get:function(){if(!this.player||!this.player.plugins)return-1;var e=this.player.plugins.mp4encryptplayer;return e?e.opQueueLen||0:-1}},{key:"mp4LoadSegmentTimeRange",get:function(){if(!this.player||!this.player.plugins)return"";var e=this.player.plugins.mp4encryptplayer;return e?e.loadSegmentTimeRange.join(","):""}},{key:"preLoadData",get:function(){if(!this.player||!this.player.plugins)return[];var e=this.player.plugins.mp4encryptplayer;if(e&&e.preLoadData)return{hit:1,duration:e.preLoadData.duration,length:e.preLoadData.byteLength};var t=this.player.stat||{};if(t.preLoadData){var i=t.preLoadData.length;return{hit:i>0,length:i}}return{hit:0,duration:0,length:0}}},{key:"preloadState",get:function(){if(!this.player||!this.player.plugins)return 0;if(void 0!==this.player.preloadState)return this.player.preloadState||0;var e=this.player.plugins.mp4encryptplayer;return e&&e.preloadState?e.preloadState:0}},{key:"curBitrate",get:function(){var e=this.player,t=e.config,i=e.curDefinition;return i&&i.bitrate?i.bitrate:t.defaultBitrate?t.defaultBitrate:0}},{key:"videoReadyState",get:function(){var e=this.player;return e&&e.video?e.video.readyState:-1}},{key:"videoSeeking",get:function(){var e=this.player;return e&&e.video&&e.video.seeking?1:0}},{key:"videoPaused",get:function(){var e=this.player;return e&&e.video&&e.video.paused?1:0}},{key:"switchResolutionCount",get:function(){return this.resLogs.switch_count}},{key:"isError",get:function(){return this.player._isError||this.player.video.error}},{key:"isPlaying",get:function(){return HC(this.player.root,"xgplayer-playing")}},{key:"isStop",get:function(){return HC(this.player.root,"xgplayer-ended")||HC(this.player.root,"xgplayer-nostart")}},{key:"isPause",get:function(){return HC(this.player.root,"xgplayer-pause")}},{key:"isLoading",get:function(){return HC(this.player.root,"xgplayer-isloading")}},{key:"es",get:function(){return this.isPlaying?"playing":"beforePlay"}},{key:"lt",get:function(){var e=0;return 0===this.vt&&(DC("lt init",this.playlogs.lt),e=RC()),e}},{key:"lpt",get:function(){return this.lt?this.lt-this.pt:0}},{key:"playback_state",get:function(){return this.isError?nI:this.isStop?eI:this.isPause?iI:this.isLoading?rI:tI}},{key:"is_start_play_automatically",get:function(){return"".concat(this.isAutoplay)}},{key:"watchDur",get:function(){var e=this.player,t=this.playlogs,i=e.cumulateTime?e.cumulateTime:AC(t.played);return i>=0?i>SI?SI:i:0}},{key:"vtype",get:function(){if(this.__vtype)return this.__vtype;var e=this.player?this.player.vtype||this.player.config.vtype:"";return e||(this.player.dash?"DASH":this._options.vtype||"MP4")},set:function(e){this.__vtype=e}},{key:"envInfo",get:function(){return this._envInfo},set:function(e){e&&(this._envInfo=e)}},{key:"getPlayerExt",value:function(){var e=this.player.ext;if(e)return e}},{key:"watingCost",get:function(){if(this.inWaitingStart>0){var e=LC()-this.inWaitingStart;return e>bI?0:e}return 0}},{key:"videoNetworkState",get:function(){var e=this.player;return e&&e.video?e.video.networkState:-1}},{key:"eagleid",get:function(){var e=this.player;return e&&e.__dash__&&e.__dash__.curReqVideoSegInfo?(e.__dash__.curReqVideoSegInfo.headers||{}).eagleid:""}},{key:"initial_type",get:function(){var e=this.player.config||{};return e&&e.vodLogOpts&&void 0!==e.vodLogOpts.currentDashType?parseInt(e.vodLogOpts.currentDashType,10):-1}},{key:"dynamicType",get:function(){var e=this.player;return this.__dt?this.__dt:e&&e.__dash__&&e.__dash__.dash&&e.__dash__.dash.mpd?(this.__dt=e.__dash__.dash.mpd.dashType,this.__dt):""}},{key:"updateBuffers",value:function(){var e=this.player.buffered,t=[];if(!e||e.length<1)this.buffers.allBuffer=[];else{for(var i=0;i<e.length;i++){var n=parseInt(1e3*e.start(i),10),r=parseInt(1e3*e.end(i),10);t.push({s:n,e:r})}this.buffers.allBuffer=t}}},{key:"updateCurBuffer",value:function(e){var t=this.player,i=t.buffered,n=t.currentTime,r={buf_s_pos:0,buf_e_pos:0,buf_include:0,buf_diff:0};if(!i||i.length<1)return r;for(var o=-1,s=-1,a=parseInt(1e3*n,10),l=i.length-1;l>-1;l--){var u=parseInt(1e3*i.start(l),10),c=parseInt(1e3*i.end(l),10);if(a>=u&&a<=c){r.buf_include=1,r.buf_s_pos=u,r.buf_e_pos=c,r.buf_diff=c-a;break}a<u&&(o<0||u-a<o)?(o=u-a,s=l):a>c&&(o<0||a-c<o)&&(o=a-c,s=l)}1!==r.buf_include&&(s<0&&(s=i.length-1),r.buf_s_pos=parseInt(1e3*i.start(s),10),r.buf_e_pos=parseInt(1e3*i.end(s),10)),this.buffers.curBuffer=r}},{key:"checkInBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.player.buffered;if(!i)return!1;e=parseInt(1e3*e,10);for(var n=0;n<i.length;n++){var r=parseInt(1e3*i.start(n),10),o=parseInt(1e3*i.end(n),10)+t;if(e>r&&e<o)return!0}return!1}},{key:"getPCDNStat",value:function(){if(this.player&&this.player.pcdnVVStat){var e=this.player.pcdnVVStat,t=e.try_req_num,i=e.req_node_succ,n=e.conn_req_num;return ll({try_req:t,req_succ:i,has_ret:e.has_ret_node,conn_req:n,conn_fail:e.conn_fail_num,conn_jump:e.conn_jump_num},fl(e,Ew))}return{}}},{key:"updateVideoSize",value:function(){var e=this._options,t=this.player,i=this.resLogs,n=0,r=0;if(t.__dash__&&t.__dash__.dash&&t.__dash__.dash.mpd.mediaList){var o=t.__dash__.dash.mpd.mediaList.video,s=o[o.selectedIdx];DC("updateVideoSize》》videoItem",s),r=s?s.bitrate||s.bandwidth:0,n=s?s.size:0}else{var a=this.player.curDefinition;a?(r=a.bitrate||t.config.bitrate||0,n=parseInt(a.bitrate*t.duration/8,10)):(n=e.videoSize||t.config.videoSize||0,r=e.bitrate||t.config.bitrate||0)}DC("updateVideoSize","bitrate:".concat(r,", vs:").concat(n)),n&&(i.vs=n,i.vis=parseInt(n/t.duration,10),i.bitrate=r||i.vis)}},{key:"updateVds",value:function(){var e=this.resLogs,t=this.playlogs,i=this.player;if(0!==e.vis){for(var n=parseInt(AC(t.played)/1e3,10),r=i.buffered,o=0,s=0;s<r.length;s++)o+=parseInt(r.end(s)-r.start(s),10);DC("updateVds","pdur:".concat(n," bdur:").concat(o," \n lbuf:").concat(e.lbuf," lplayed:").concat(e.lplayed," bitrate: ").concat(e.bitrate," vis:").concat(e.vis," vs:").concat(e.vs)),e.lplayed=n,e.lbuf=o}else DC("updateVds","vis:".concat(e.vis))}},{key:"encryptedInfo",get:function(){return this.player.encryptedInfo||{encryptedType:0}}}],[{key:"TEA_ID",get:function(){return bw},set:function(e){kw="__tea_cache_tokens_".concat(bw=e)}},{key:"AB_SDK_VERSION",get:function(){return Cw},set:function(e){Cw="Array"===BC(e)?e.join(","):e}},{key:"Collector",set:function(e){Iw=e}},{key:"defaultConfig",value:function(){return{line_app_id:"",line_user_id:"",isTask:!1,codec_type:"",playerCoreVersion:"",playerVersion:"",start_time:0,maxQueueCount:5,channel:"cn",channelDomain:"",absdkVersion:"",checkByInnerLog:!0,drm_type:0,vtype:"MP4",tag:"普通视频",subtag:"",dynamic_type:"",sendLocalCallback:function(){},disableLocalCache:!1,closeResolutionLog:!1,closeSeekLog:!1,needXhrCheck:!1,trackerConfig:{},envInfo:{},enableTeaWebId:!1,enableBeacon:!1}}}]),e}();const Pw=null==(e=el())?void 0:e.__LOG_TEA_ID__;function ww(e){let t={};const i=(i,n)=>{const r=(e=>Object.assign({},t,null!=e?e:{}))(n);aa.log("veplayer sendLog",i,r),e(i,r)};function n(e,t){i(e,t)}return n.init=e=>{},n.config=e=>{const i=null==e?void 0:e.evtParams;i&&"object"==typeof i&&(t=u({},i))},n.start=()=>{},n.event=(e,t)=>{i(e,t)},n.beaconEvent=(e,t)=>{i(e,t)},n}function Dw(){var e;const t=null==(e=yH.ttDramaEnv)?void 0:e.sendLog;return"function"==typeof t?t:void 0}Aw.TEA_ID=Pw,Aw.Collector=function(e){const t=Dw();if(t)return ww(t);const i=Ma();return i?new i(e):void 0};const Lw="beforePlayerCreate.authtoken.getVideoInfo.getVideos",Rw=`${Lw}.getDramaInfoViaJSB.perfInfo`,xw={prepareCost:`${Rw}.prepareCost`,requestCost:`${Rw}.requestCost`,parseCost:`${Rw}.parseCost`,totalCost:`${Rw}.totalCost`};function Ow(e,t){var i;const n=null==(i=null==e?void 0:e.timingMap)?void 0:i[t];return Number.isFinite(n)?n:0}const Nw=function(e){if(e&&e.player){const t=(t,i)=>d(this,null,(function*(){var n,r,o;const s=e.player;i.player_sum_num=function(e){var t,i;let n=0;return null==(i=null==(t=null==e?void 0:e.instManager)?void 0:t.forEach)||i.call(t,(()=>(n++,!0))),n}(s),i.is_mse=Ra(s),i.drm_encrypt_type=rl(s)||"",i.initial_url=Ur.isBlob(i.initial_url)&&s.config.url||i.initial_url,i.album_id=s.config.albumId||"",i.episode_id=s.config.episodeId||"",i.client_key=(null==(n=yH.ttDramaEnv)?void 0:n.clientKey)||"";const a=function(e){var t,i;return null==(i=null==(t=null==e?void 0:e.sdk)?void 0:t.getCreatePlayerPerfReport)?void 0:i.call(t)}(s),l=Ow(a,Lw);const u=function(e){const t=null==e?void 0:e.totalDuration;return Number.isFinite(t)?t:0}(a);if(i.server_fetch_duration=l,Object.assign(i,function(e){return{server_fetch_prepare_cost:Ow(e,xw.prepareCost),server_fetch_request_cost:Ow(e,xw.requestCost),server_fetch_parse_cost:Ow(e,xw.parseCost),server_fetch_total_cost:Ow(e,xw.totalCost)}}(a)),i.create_player_total_duration=u,i.prepare_play=u-l,i.is_preload_enabled=2===yH.preloaderStatus,t===zC||t===XC){const e=null==s?void 0:s.veError;0!==i.errc&&e?(i.ve_error_code=(null==e?void 0:e.veErrorCode)||0,i.ve_error_type=(null==e?void 0:e.veErrorType)||"",i.ve_error_message=(null==e?void 0:e.veErrorMessage)||"",i.ve_error_ext=JSON.stringify((null==e?void 0:e.ext)||"")):(i.ve_error_code=0,i.ve_error_type="",i.ve_error_message="",i.ve_error_ext=""),i.licenseStatus=(null==(r=null==s?void 0:s.licenseLogInfo)?void 0:r.licenseStatus)||"",i.licenseType=(null==(o=null==s?void 0:s.licenseLogInfo)?void 0:o.licenseType)||""}})),i=Object.assign({onReportLog:t},e.player.config.vodLogOpts||{});e.player.vodLogger=new Aw(e.player,i),e.player.plugins.xgVodLogger=e.player.vodLogger}else this.vodLogger=new Aw(this,this.config.vodLogOpts||{})};Nw.pluginName="__xgVodLogger",Nw.playerConfig={},Nw.Collector=Aw.Collector,Nw.setABSdkVersion=e=>{Aw.AB_SDK_VERSION=e};const Mw=Ui((function(e,t,i){Ci(e,t,i)}));class Uw{constructor(e){this.isLive=e.configs.isLive,this.playerData=e.playerData,this.streamType=e.streamType}}const Bw={"@byted/streamprobe":"1.0.2","@byted/volcengine-vestrategy":"1.1.0-rc.71","@byted/volcengine-vestrategy-adapt-range":"1.1.0-rc.0","@byted/volcengine-vestrategy-h265":"1.1.0-rc.0","@byted/volcengine-vestrategy-preload":"1.1.0-rc.3","@byted/xgplayer-encrypt":"3.5.29-rc.1","@byted/xgplayer-encrypt-hls":"4.2.0","@byted/xgplayer-encrypt-mp4":"3.0.31-alpha.1","@byted/xgplayer-vod-abralgo":"1.0.5","@byted/xgplayer-vod-preload":"1.0.9-rc.3","@byted/xgplayer-xgvideo":"0.2.5-rc.3","xgplayer-flv":"3.0.23-rc.6","xgplayer-hls":"3.0.24-rc.18"};var Hw=(e=>(e.HLS="hls",e.HLSJS="hlsjs",e.FLV="flv",e.XGVideo="XGVideo",e.HLSEncrypt="hlsEncrypt",e.DASH="dash",e.MP4Encrypt="mp4Encrypt",e.DanmuJS="danmujs",e.DanmuMask="danmuMask",e.StreamProbe="streamprobe",e.VeStrategy="vestrategy",e.VeStrategyH265="vestrategy_h265",e.VeStrategyPreload="vestrategy_preload",e.VeStrategyAdaptRange="vestrategy_adapt_range",e.DashAbralgo="DashAbralgo",e.Preloader="preloader",e.HLSjsPro="hlsjsPro",e))(Hw||{});const Fw={[Hw.HLS]:{name:"HlsPlayer",pluginName:"hls",packageName:"xgplayer-hls",devPath:`xgplayer-hls@${Bw["xgplayer-hls"]}/dist/index.min.js`},[Hw.FLV]:{name:"FlvPlayer",pluginName:"flv",packageName:"xgplayer-flv",devPath:`xgplayer-flv@${Bw["xgplayer-flv"]}/dist/index.min.js`},[Hw.XGVideo]:{name:"XGVideo",packageName:"@byted/xgplayer-xgvideo",devPath:`@byted/xgplayer-xgvideo@${Bw["@byted/xgplayer-xgvideo"]}/dist/index.min.js`},[Hw.HLSEncrypt]:{name:"EncryptHlsPlugin",pluginName:"EncryptHlsPlugin",packageName:"@byted/xgplayer-encrypt-hls",devPath:`@byted/xgplayer-encrypt-hls@${Bw["@byted/xgplayer-encrypt-hls"]}/dist/index.min.js`},[Hw.DASH]:{name:"DashPlugin",pluginName:"DASHPlugin",packageName:"@byted/xgplayer-encrypt",devPath:`@byted/xgplayer-encrypt@${Bw["@byted/xgplayer-encrypt"]}/dist/index.min.js`},[Hw.MP4Encrypt]:{name:"Mp4EncryptPlayer",pluginName:"Mp4EncryptPlayer",packageName:"@byted/xgplayer-encrypt-mp4",devPath:`@byted/xgplayer-encrypt-mp4@${Bw["@byted/xgplayer-encrypt-mp4"]}/dist/index.min.js`},[Hw.StreamProbe]:{name:"StreamProbe",pluginName:"streamprobe",packageName:"@byted/streamprobe",devPath:`@byted/streamprobe@${Bw["@byted/streamprobe"]}/dist/index.min.js`},[Hw.VeStrategyH265]:{name:"__VESTRATEGY_STRATEGY_H265__",packageName:"@byted/volcengine-vestrategy-h265",devPath:`@byted/volcengine-vestrategy-h265@${Bw["@byted/volcengine-vestrategy-h265"]}/umd/vestrategy.strategy.h265.production.js`},[Hw.VeStrategy]:{name:"VeStrategy",packageName:"@byted/volcengine-vestrategy",devPath:`@byted/volcengine-vestrategy@${Bw["@byted/volcengine-vestrategy"]}/umd/vestrategy.production.js`},[Hw.VeStrategyPreload]:{name:"__VESTRATEGY_STRATEGY_PRELOAD__",packageName:"@byted/volcengine-vestrategy-preload",devPath:`@byted/volcengine-vestrategy-preload@${Bw["@byted/volcengine-vestrategy-preload"]}/umd/vestrategy.strategy.preload.production.js`},[Hw.VeStrategyAdaptRange]:{name:"__VESTRATEGY_STRATEGY_ADAPT_RANGE__",packageName:"@byted/volcengine-vestrategy-adapt-range",devPath:`@byted/volcengine-vestrategy-adapt-range@${Bw["@byted/volcengine-vestrategy-adapt-range"]}/umd/vestrategy.strategy.adapt-range.production.js`},[Hw.DashAbralgo]:{name:"DashAbralgo",packageName:"@byted/xgplayer-vod-abralgo",devPath:`@byted/xgplayer-vod-abralgo@${Bw["@byted/xgplayer-vod-abralgo"]}/dist/index.min.js`},[Hw.Preloader]:{name:"XGPlayerPreload",packageName:"@byted/xgplayer-vod-preload",devPath:`@byted/xgplayer-vod-preload@${Bw["@byted/xgplayer-vod-preload"]}/dist/index.min.js`},[Hw.HLSjsPro]:{name:"EncryptHlsjsPlugin",packageName:"@byted/xgplayer-encrypt-hls",devPath:`@byted/xgplayer-encrypt-hls@${Bw["@byted/xgplayer-encrypt-hls"]}/dist/hlsjs.min.js`}},jw={h265:Hw.VeStrategyH265,preload:Hw.VeStrategyPreload,adaptRange:Hw.VeStrategyAdaptRange},Vw={setImportedPlugins(e,t){e.importedPlugins=t},prepareStrategyLoad(e){"undefined"!=typeof window&&window.VeStrategy&&(window.__VESTRATEGY_BASE__||(window.__VESTRATEGY_BASE__=window.VeStrategy),window.__VESTRATEGY_STRATEGY_PRELOAD__||e.clearPluginCache(Hw.VeStrategyPreload))},loadVeStrategy(e){return d(this,null,(function*(){return e.loadPlugins(Hw.VeStrategy)}))},loadStrategy(e,t){return d(this,null,(function*(){return e.loadPlugins(jw[t])}))},loadPreloader(e){return d(this,null,(function*(){return e.loadPlugins(Hw.Preloader)}))},loadMp4Encrypt(e){return d(this,null,(function*(){return e.loadPlugins(Hw.MP4Encrypt)}))},loadHlsjsPro(e){return d(this,null,(function*(){return e.loadPlugins(Hw.HLSjsPro)}))}};let Kw=!1;class Gw extends Uw{constructor(e){super(e)}applyAbrPluginConfig(e,t){e.Mp4EncryptPlayer=c(u({},e.Mp4EncryptPlayer),{autoBitrateOpts:t})}prepareAbrModule(e,t){return d(this,null,(function*(){var i;const n=null==(i=e.configs)?void 0:i.autoBitrateOpts;e.isOpenABR()&&!(null==n?void 0:n.module)&&e.updateConfigs({autoBitrateOpts:c(u({},n),{module:yield t.loadPlugins(Hw.DashAbralgo)})})}))}needAbrAutoDefinition(){return!1}setAbrDefaultDefiWithAuto(){return!1}generatePlaylistFromServer(e){Kw=!0;const{playList:t=[]}=e||{};return[...t||[]]}useNativeAbr(){return!1}canOpenAbr(e){var t;if(this.playerData.isVidPlay()&&e){const{playList:t=[]}=e;if(!(t.length>1))return Kw&&aa.warn("The obtained media information does not meet the ABR requirements. Please check whether the parameters for generating playAuthToken are correct and whether there are more than 1 video."),Kw=!1,!1}return!((null==(t=Kr.os)?void 0:t.isIos)&&!qa())}canAdaptRangeEnable(){var e;return!((null==(e=Kr.os)?void 0:e.isIos)&&!qa())}adaptRangeDefaultOptions(){return{maxTargetCacheDur:30,minTargetCacheDur:12,rangeMaxDuration:15,rangeMinDuration:5,cacheSafeFactor:2,estPTcontrol:!0,estPlayTime:12,minBandwidth:1e6,minDangerThreshold:3,rangeControl:!0,rangeMinSize:409600,safeFactor:.1,targetCacheControl:!0}}applyAdaptRangePluginConfig(e,t){e.Mp4EncryptPlayer=c(u({},e.Mp4EncryptPlayer),{adaptRange:t})}applyAdaptRangeStrategy(e,t){var i,n;e.Mp4EncryptPlayer=c(u({},e.Mp4EncryptPlayer),{adaptRange:u(u(u({},this.adaptRangeDefaultOptions()),null!=(n=null==(i=e.Mp4EncryptPlayer)?void 0:i.adaptRange)?n:{}),t)})}getPlugins(e){return d(this,null,(function*(){var t;const{configs:i,openSoftDecoding:n,isVidEncrypt:r,drmType:o}=this.playerData,s=[or.PRIVATE_ENCRYPT_UPGRADE,or.PRIVATE_ENCRYPT].includes(o);if(i.enableMp4MSE||r||(null==(t=null==i?void 0:i.autoBitrateOpts)?void 0:t.enable)||n||s){return[yield Vw.loadMp4Encrypt(e)]}return[]}))}setPluginConfigInVid(e,t){var i;const{vid:n,defaultDefinitionData:r}=e,{config:o,privateDrmAuthToken:s,sessionId:a,useUnionInfoDRM:l}=t,c=!!r.kid,{autoBitrateOpts:h,Mp4EncryptPlayer:d,enableMp4MSE:p}=this.playerData.configs,f=this.playerData.drmType===or.PRIVATE_ENCRYPT_UPGRADE;if(c||(null==h?void 0:h.enable)||d||p){const{kid:e,secretKey:t}=r,h=null==(i=this.playerData.configs)?void 0:i.Mp4EncryptPlayer,d="object"==typeof h?h:{};if(c){if(f)this.playerData.options.Mp4EncryptPlayer=u({vid:n,kid:e,isEncrypt:!0,rangeMaxDuration:10,keyTokenExpiredDuration:9999999,retryCount:3,useUnionInfoDRM:!0,sessionId:this.playerData.encryptSessionId,drmType:or.PRIVATE_ENCRYPT_UPGRADE,preferMMS:!0,secretKey:t},d);else if(s&&a){const t=va(s),i=parseInt(""+t["X-Expires"]),r=isNaN(i)?30:i;this.playerData.options.Mp4EncryptPlayer=u({vid:n,kid:e,isEncrypt:!0,rangeMaxDuration:10,retryCount:3,drmKeyToken:s,useUnionInfoDRM:l,keyTokenExpiredDuration:r,preferMMS:!0,sessionId:a,playDomain:o.playDomain||this.playerData.playDomain},d)}}else this.playerData.options.Mp4EncryptPlayer=u({vid:n,retryCount:3,preferMMS:!0},d)}}}let Ww=!1;class Yw extends Uw{applyAbrPluginConfig(e,t){e.DASHPlugin=c(u({},e.DASHPlugin),{autoBitrateOpts:t})}prepareAbrModule(e,t){return d(this,null,(function*(){var i;const n=null==(i=e.configs)?void 0:i.autoBitrateOpts;e.isOpenABR()&&!(null==n?void 0:n.module)&&e.updateConfigs({autoBitrateOpts:c(u({},n),{module:yield t.loadPlugins(Hw.DashAbralgo)})})}))}needAbrAutoDefinition(){return!1}setAbrDefaultDefiWithAuto(){return!1}useNativeAbr(){return!1}canOpenAbr(e){if(this.playerData.isVidPlay()&&e){const{enableAdaptive:t,adaptiveBitrateStreamingInfo:i,playList:n=[]}=e;if(!(n.length>2&&t&&i))return Ww&&aa.warn("The obtained media information does not meet the ABR requirements. Please check whether the parameters for generating playAuthToken are correct and whether the video contains ABR transcoding products."),Ww=!1,!1}return!0}canAdaptRangeEnable(){var e;return!(null==(e=Kr.os)?void 0:e.isIos)}generatePlaylistFromServer(e){Ww=!0;const{playList:t=[]}=e||{};return t.filter((e=>e.FileType===fa.VIDEO))}adaptRangeDefaultOptions(){return{maxTargetCacheDur:60,minTargetCacheDur:50,rangeMaxDuration:15,rangeMinDuration:5,cacheSafeFactor:2,estPTcontrol:!0,estPlayTime:12,minBandwidth:1e6,minDangerThreshold:3,rangeControl:!0,rangeMinSize:409600,safeFactor:.1,targetCacheControl:!0}}applyAdaptRangePluginConfig(e,t){var i;e.DASHPlugin=c(u({},null!=(i=e.DASHPlugin)?i:{}),{adaptRange:t})}applyAdaptRangeStrategy(e,t){var i,n;e.DASHPlugin=c(u({},e.DASHPlugin),{adaptRange:u(u(u({},this.adaptRangeDefaultOptions()),null!=(n=null==(i=e.DASHPlugin)?void 0:i.adaptRange)?n:{}),t)})}getPlugins(e){return d(this,null,(function*(){var t,i;const n=yield e.loadPlugins(Hw.DASH);return(null==(i=null==(t=null==n?void 0:n.encryptUtils)?void 0:t.isSupported)?void 0:i.call(t))?[n]:(aa.warn("current browser is not supported DASHPlugin"),[])}))}setPluginConfigInVid(e,t){var i;const{vid:n,playList:r=[],dashOpts:o,defaultDefinitionData:s}=e||{},{config:a,privateDrmAuthToken:l,sessionId:c,useUnionInfoDRM:h}=t,d=u({},(null==(i=this.playerData.configs)?void 0:i.DASHPlugin)||{}),{kid:p,secretKey:f}=s,g=this.playerData.drmType===or.PRIVATE_ENCRYPT_UPGRADE,y=o.Data.PlayInfoList.reduce(((e,t)=>{const i=t.Definition||t.Quality;let n="";const o=r.find((e=>e.Definition===i||e.Quality===i));return o&&(n=o.definition),e[i]=n,e}),{});if(this.playerData.dashOpts=o,g)this.playerData.options.DASHPlugin=u({playInfoType:"TOP",useEME:!0,keyTokenExpiredDuration:9999999,useUnionInfoDRM:!0,defaultFormat:"dash",replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3,vid:n,definitionText:y,defaultDefinition:s.definition,kid:p,dashOpts:o,drmType:or.PRIVATE_ENCRYPT_UPGRADE,secretKey:f,sessionId:this.playerData.encryptSessionId,playDomain:a.playDomain||this.playerData.playDomain},d);else if(l&&c&&this.playerData.drmType!==or.DRM_ENCRYPT){const e=va(l),t=parseInt(""+e["X-Expires"]),i=isNaN(t)?30:t;this.playerData.options.DASHPlugin=u({playInfoType:"TOP",vid:n,dashOpts:o,defaultFormat:"dash",definitionText:y,defaultDefinition:s.definition,useUnionInfoDRM:h,kid:p,keyTokenExpiredDuration:i,sessionId:c,drmKeyToken:l,playDomain:a.playDomain||this.playerData.playDomain,replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3},d)}else this.playerData.options.DASHPlugin=u({vid:n,dashOpts:o,playInfoType:"TOP",defaultFormat:"dash",definitionText:y,defaultDefinition:s.definition,replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3},d)}}var zw=/\s/;var $w=/^\s+/;function Xw(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&zw.test(e.charAt(t)););return t}(e)+1).replace($w,""):e}var qw=NaN,Qw=/^[-+]0x[0-9a-f]+$/i,Zw=/^0b[01]+$/i,Jw=/^0o[0-7]+$/i,eD=parseInt;function tD(e){if("number"==typeof e)return e;if(kn(e))return qw;if(D(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=D(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Xw(e);var i=Zw.test(e);return i||Jw.test(e)?eD(e.slice(2),i?2:8):Qw.test(e)?qw:+e}const iD=function(){return _.Date.now()};var nD="Expected a function",rD=Math.max,oD=Math.min;function sD(e,t,i){var n,r,o,s,a,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(nD);function p(t){var i=n,o=r;return n=r=void 0,u=t,s=e.apply(o,i)}function f(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-u>=o}function g(){var e=iD();if(f(e))return y(e);a=setTimeout(g,function(e){var i=t-(e-l);return h?oD(i,o-(e-u)):i}(e))}function y(e){return a=void 0,d&&n?p(e):(n=r=void 0,s)}function v(){var e=iD(),i=f(e);if(n=arguments,r=this,l=e,i){if(void 0===a)return function(e){return u=e,a=setTimeout(g,t),c?p(e):s}(l);if(h)return clearTimeout(a),a=setTimeout(g,t),p(l)}return void 0===a&&(a=setTimeout(g,t)),s}return t=tD(t)||0,D(i)&&(c=!!i.leading,o=(h="maxWait"in i)?rD(tD(i.maxWait)||0,t):o,d="trailing"in i?!!i.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),u=0,n=l=r=a=void 0},v.flush=function(){return void 0===a?s:y(iD())},v}const aD=class{static registerModules(e){for(const[t,i]of Object.entries(e)){if(!Object.values(Hw).includes(t))throw new Error(`Unknown UMD key: ${t}`);if(void 0===i)throw new Error(`Registered UMD module ${t} must not be undefined`)}Object.assign(aD.registeredModules,e)}clearPluginCache(e){const t=`${this.pluginPublicPath}_${e}_load`;delete aD.jsLoadMap[t],delete aD.jsLoadPromiseMap[t]}constructor(){this.umdMap=Fw,this.backupUmdUrlMap={},this.region={}.__DEFAULT_REGION__,this.customPluginPublicPath=""}get pluginPublicPath(){var e;return this.customPluginPublicPath||(null==(e=el(this.userRegion,this.region))?void 0:e.__UMD_PRE_PATH__)}updateBackupMap(e){this.backupUmdUrlMap=e}loadExtraCdn(e,t=!0){return new Promise(((i,n)=>{const r=t?document.createElement("script"):document.createElement("link");t?r.src=e:(r.rel="stylesheet",r.type="text/css",r.href=e),r.onerror=()=>{n(`url: ${e}`)},r.onload=r.onreadystatechange=function(){(null==this?void 0:this.readyState)&&"loaded"!==(null==this?void 0:this.readyState)&&"complete"!==(null==this?void 0:this.readyState)||(r.onload=r.onreadystatechange=null,i())},document.body.appendChild(r)}))}loadPlugins(e,t){return new Promise((i=>{var n;const r=`${this.pluginPublicPath}_${e}_load`;if(Object.prototype.hasOwnProperty.call(aD.registeredModules,e))return this.triggerSuccessCallback(t),i(aD.registeredModules[e]);if(Reflect.get(aD.jsLoadMap,r))return i(aD.jsLoadMap[r]);const o=this.umdMap[e];if((null==(n=this.importedPlugins)?void 0:n.length)>0&&o.pluginName){const e=this.importedPlugins.find((e=>e.pluginName===o.pluginName));if(e)return i(e)}if(!o)return aa.error(`${e} umd info not exit`),this.handleLoadError(e,void 0,i);const{name:s,devPath:a}=o,l=s?Vn(window,s):null;if(l)return aD.jsLoadMap[r]=l,this.triggerSuccessCallback(t),i(l);const u=`${this.pluginPublicPath}/${e+".js"}`;let c=aD.jsLoadPromiseMap[r];aa.log(`umdLoader cache hit ${r}=${!!c}`),c||(c=$a((()=>this.loadExtraCdn(u,!0)),2),aD.jsLoadPromiseMap[r]=c),c.then((()=>this.handleLoadSuccess(r,s,t,i))).catch((n=>this.handleLoadCatch(n,e,r,s,t,i)))}))}handleLoadSuccess(e,t,i,n){const r=t?Vn(window,t):null;aD.jsLoadMap[e]=null==r||r,this.triggerSuccessCallback(i),null==n||n(r)}handleLoadError(e,t,i){this.failCallback&&"function"==typeof this.failCallback&&this.failCallback(e,t),i(null)}handleLoadCatch(e,t,i,n,r,o){const s=this.backupUmdUrlMap[t];s?this.loadBackupUrl(s,t,i,n,r,o):(aa.error(`load ${t} error, ${e}`),this.handleLoadError(t,e,o))}loadBackupUrl(e,t,i,n,r,o){if(!((s=e)&&s.indexOf&&/^(?:http|data:|\/)/.test(s)))return aa.error(`umdMap.${t} isn't a valid url`),this.handleLoadError(t,void 0,o);var s;this.loadExtraCdn(e).then((()=>this.handleLoadSuccess(i,n,r,o))).catch((e=>{aa.error(`load ${t} error, ${e}`),this.handleLoadError(t,void 0,o)}))}triggerSuccessCallback(e){e&&e()}};let lD=aD;lD.jsLoadMap={},lD.jsLoadPromiseMap={},lD.registeredModules={};const uD=new lD;var cD=(e=>(e.H265="h265",e.PRELOAD="preload",e.ADAPT_RANGE="adaptRange",e))(cD||{});function hD(e){if(!e||"boolean"==typeof e)return{config:{}};const t=e,{Strategy:i,disabled:n,config:r}=t,o=h(t,["Strategy","disabled","config"]);return c(u({},e),{config:u(u({},o),null!=r?r:{})})}var dD=(e=>(e[e.DISABLED=0]="DISABLED",e[e.INITIALIZING=1]="INITIALIZING",e[e.READY=2]="READY",e[e.FAILED=3]="FAILED",e))(dD||{});class pD{constructor(e){this.strategyKey=cD.PRELOAD,this.preloaderStatus=1,this.preloadCacheConfig={},this.preloadCacheList=[],this._strategyManager=e,this.sdkUmdLoader=new lD}init(e){return d(this,null,(function*(){var t,i,n,r,o,s,a,l,h;const p=null==(t=null==e?void 0:e.strategies)?void 0:t[cD.PRELOAD],f="boolean"==typeof p;if(!p||!f&&(null==p?void 0:p.disabled))return this.preloaderStatus=0,!1;const g=null==(i=hD(p))?void 0:i.config,y=null==(s=null==(o=null==(r=null==(n=this._strategyManager.config)?void 0:n.strategies)?void 0:r[cD.PRELOAD])?void 0:o.Strategy)?void 0:s.preloader;if(!(null==y?void 0:y.register))return this.preloaderStatus=3,!1;y.init((()=>d(this,null,(function*(){aa.log("preloader init");const[e,t]=yield Promise.all([Vw.loadPreloader(this.sdkUmdLoader),f||"hls"!==(null==p?void 0:p.format)?Vw.loadMp4Encrypt(this.sdkUmdLoader):Vw.loadHlsjsPro(this.sdkUmdLoader)]);if(!(null==e?void 0:e.PreloaderManager)||!t)return this.preloaderStatus=3,void aa.error("preloader init error");const i=(null==t?void 0:t.Mp4Preloader)||(null==t?void 0:t.HlsPreloader);return c(u({},g),{PreloaderModule:e.PreloaderManager,loaders:[i].filter((e=>!!e)),playPlugins:[t]})}))));const v=yield y.prepare();if(!v)return this.preloaderStatus=3,void aa.warn("preloader prepare fail",v);this.preloaderStatus=2,null==(h=null==(l=null==(a=y.inst)?void 0:a.call(y))?void 0:l.on)||h.call(l,"prf_data_size",(e=>{var t,i;null==(i=null==(t=this._strategyManager.tea)?void 0:t.event)||i.call(t,"veplayer_preload_prf_data_size",u({},e))})),this.preloader=y,this.initPreloaderConfig()}))}addPreloadList(e){if(1===this.preloaderStatus)return this.preloadCacheList=this.preloadCacheList.concat(null!=e?e:[]),void aa.log("preloader add preload cache list",e);2!==this.preloaderStatus?this.preloadCacheList=[]:this.preloader.addPreloadList(e)}setPreloadList(e){return d(this,null,(function*(){if(1===this.preloaderStatus)return this.preloadCacheList=null!=e?e:[],void aa.log("preloader set preload cache list",e);2!==this.preloaderStatus?this.preloadCacheList=[]:this.preloader.setPreloadList(null!=e?e:[])}))}setPreloadScene(e,t){if([1,0].includes(e))return 1===this.preloaderStatus?(this.preloadCacheScene!==e&&(this.preloadCacheList=[],aa.log("preloader reset preload cache list")),this.preloadCacheScene=e,this.preloadCacheConfig=u(u({},this.preloadCacheConfig),null!=t?t:{}),void aa.log("preloader set preload cache config",this.preloadCacheScene,this.preloadCacheConfig)):void(2!==this.preloaderStatus||this.preloader.setPreloadScene(e,t))}initPreloaderConfig(){var e,t,i,n;"undefined"!==this.preloadCacheScene&&this.preloader.setPreloadScene(this.preloadCacheScene,null!=(e=this.preloadCacheConfig)?e:{}),(null==(t=this.preloadCacheList)?void 0:t.length)&&(this.preloader.setPreloadList(this.preloadCacheList),null==(n=(i=this.preloader).checkPreloadData)||n.call(i),this.preloadCacheList=[])}}class fD{constructor(e){this.strategyKey=cD.H265,this._strategyManager=e}init(){return d(this,null,(function*(){return!0}))}isHevcRecommended(){var e,t;return!!(null==(t=null==(e=this._strategyManager.getStrategyRecommendations().result)?void 0:e[cD.H265])?void 0:t.enableH265Hardware)}}const gD=new class{constructor(){var e,t;this.teaId=null==(e=el())?void 0:e.__LOG_TEA_ID__,this.teaChannel=null==(t=el())?void 0:t.__LOG_CHANNEL__,this.status=0,this.initUmdLoader()}get preloader(){var e;return null==(e=this.preloadWrapper)?void 0:e.preloader}get preloaderStatus(){var e,t;return null!=(t=null==(e=this.preloadWrapper)?void 0:e.preloaderStatus)?t:dD.INITIALIZING}initUmdLoader(){this.sdkUmdLoader=new lD}fetchWebId(){return d(this,null,(function*(){var e,t;return(null==(e=this.config)?void 0:e.deviceId)?Promise.resolve(null==(t=this.config)?void 0:t.deviceId):new Promise((e=>{var t;return(null==(t=this.tea)?void 0:t.getToken)?this.tea.getToken((t=>e(null==t?void 0:t.web_id))):e("default_web_id")})).then((e=>(this.config=c(u({},this.config),{deviceId:e}),this.webId)))}))}initTea(e){var t,i;const n=this.collector;n&&(e&&(this.teaId=null==(t=el(e))?void 0:t.__LOG_TEA_ID__,this.teaChannel=null==(i=el(e))?void 0:i.__LOG_CHANNEL__),this.tea=new n(`${this.teaId}_vestrategy_tracker`),this.tea.init({app_id:this.teaId,channel:this.teaChannel}),this.tea.start())}fetchVeStrategy(){return d(this,null,(function*(){if(this.config.Module)return;const e=yield Vw.loadVeStrategy(this.sdkUmdLoader);e&&(this.config=c(u({},this.config),{Module:e}))}))}fetchStrategies(){return d(this,null,(function*(){const e={};return Vw.prepareStrategyLoad(this.sdkUmdLoader),yield Promise.all(Object.keys(this.config.strategies).map((t=>d(this,null,(function*(){if(!this.config.strategies[t])return;!0===this.config.strategies[t]&&(this.config.strategies[t]={});const{Strategy:i}=this.config.strategies[t];if(i)e[t]=this.config.strategies[t];else{const i=t;if(!["h265","preload","adaptRange"].includes(i))return;const n=yield Vw.loadStrategy(this.sdkUmdLoader,i);n&&(e[t]=c(u({},this.config.strategies[t]),{Strategy:n}))}e[t]=hD(e[t])}))))),this.config.strategies=e,e}))}initOnce(e){return d(this,null,(function*(){if(!e||!e.appId)return;this.collector=Ma(),this.initTea(e.region),this.status=1,this.config=e;try{yield Promise.all([this.fetchWebId(),this.fetchVeStrategy()]),yield this.fetchStrategies()}catch(r){}const{appId:t,deviceId:i,Module:n}=this.config;if(t&&i&&n){this.Module=n;const e=this.collector;yield n.bootstrap(c(u(c(u({},this.config),{strategies:this.config.strategies}),e?{tracker:{Collector:e,enableABVersion:!1}}:{}),{log:{logger:aa}})),this.status=2,this.preloadWrapper=new pD(this),this.h265Wrapper=new fD(this)}else this.status=3;return this.isReady()}))}init(e){return d(this,null,(function*(){var t,i;const n=e;return this.initPromise?(null==(i=this.config)?void 0:i.serviceConfigMode)&&(null==n?void 0:n.serviceConfigMode)&&this.config.serviceConfigMode!==n.serviceConfigMode&&aa.warn("[VeStrategy] Ignoring conflicting serviceConfigMode after initialization has started."):((null==(t=null==e?void 0:e.plugins)?void 0:t.length)&&Vw.setImportedPlugins(this.sdkUmdLoader,e.plugins),this.initPromise=this.initOnce(n).then((t=>d(this,null,(function*(){var i,n;return t&&(yield Promise.all([null==(i=this.preloadWrapper)?void 0:i.init(e),null==(n=this.h265Wrapper)?void 0:n.init()])),t}))))),this.initPromise}))}addPreloadList(e){this.preloadWrapper&&this.preloadWrapper.addPreloadList(e)}setPreloadList(e){return d(this,null,(function*(){if(this.preloadWrapper)return this.preloadWrapper.setPreloadList(e)}))}setPreloadScene(e,t){this.preloadWrapper&&this.preloadWrapper.setPreloadScene(e,t)}prepare(){return this.initPromise||Promise.resolve(this.isReady())}getDeviceId(){var e;return null==(e=this.config)?void 0:e.deviceId}isReady(){return 2===this.status}getStrategyRecommendations(e=void 0,t=void 0){if(!this.isReady())return{plugins:[],pluginConfiguration:{}};const i=this.config.Module.rec(e,t)||{};return aa.log("strategy recommendations:",i),i}getStrategyRecommendationsAsync(e=void 0,t=void 0){return d(this,null,(function*(){if(!this.isReady())return{plugins:[],pluginConfiguration:{}};const i=yield this.config.Module.recAsync(e,t);return aa.log("strategy recommendations:",i),i}))}isHevcRecommended(){var e,t;return this.h265Wrapper?this.h265Wrapper.isHevcRecommended():!!(null==(t=null==(e=this.getStrategyRecommendations().result)?void 0:e[cD.H265])?void 0:t.enableH265Hardware)}};let yD=!1;class vD extends Uw{constructor(e){super(e)}applyAbrPluginConfig(e,t){var i;e.EncryptHlsPlugin=c(u({},e.EncryptHlsPlugin),{autoBitrateOpts:t,maxBufferLength:(null==(i=e.EncryptHlsPlugin)?void 0:i.maxBufferLength)||40})}prepareAbrModule(e,t){return d(this,null,(function*(){var i;const n=null==(i=e.configs)?void 0:i.autoBitrateOpts;!e.isOpenVePlayerABR()||(null==n?void 0:n.module)||this.useNativeAbr()||e.updateConfigs({autoBitrateOpts:c(u({},n),{module:yield t.loadPlugins(Hw.DashAbralgo)})})}))}needAbrAutoDefinition(){return!0}setAbrDefaultDefiWithAuto(){return!this.useNativeAbr()}generatePlaylistFromServer(e,t){var i,n,r;yD=!0;const{vid:o,playList:s=[],enableAdaptive:a,adaptiveBitrateStreamingInfo:l}=e||{};if(t&&(null==l?void 0:l.MainPlayUrl))return[{vid:o,url:null==l?void 0:l.MainPlayUrl,_mainURL:l.MainPlayUrl,_backupURL:l.BackupPlayUrl,streamType:l.AbrFormat,backupUrl:l.BackupPlayUrl,backUrlList:[l.BackupPlayUrl],isMasterM3u8:!0}];const u=[...s||[]];if(this.useNativeAbr()&&(null==(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.autoBitrateOpts)?void 0:r.enable)&&a&&l&&u.length){const e={url:l.MainPlayUrl,definition:"auto",streamType:"hls",format:"hls",backupUrl:l.BackupPlayUrl,backUrlList:[l.BackupPlayUrl],vid:o};u.push(e)}return u}useNativeAbr(){return Kr.os.isIos||"safari"===Kr.browser&&this.playerData.drmType===or.DRM_ENCRYPT}canOpenAbr(e){if(this.playerData.isVidPlay()&&e){const{enableAdaptive:t,adaptiveBitrateStreamingInfo:i,playList:n=[]}=e;if(!(n.length>1&&t&&i))return yD&&aa.warn("The obtained media information does not meet the ABR requirements. Please check whether the parameters for generating playAuthToken are correct and whether the video contains ABR transcoding products."),yD=!1,!1}return!0}canAdaptRangeEnable(){return!1}adaptRangeDefaultOptions(){}applyAdaptRangePluginConfig(e,t){}applyAdaptRangeStrategy(e,t){}getPlugins(e){return d(this,null,(function*(){var t,i,n;if(null==(i=null==(t=gD.config)?void 0:t.strategies)?void 0:i[cD.PRELOAD]){return[yield e.loadPlugins(Hw.HLSjsPro)]}const{configs:r,options:o,useHlsPluginForSafari:s,enableHlsJs:a,isVidEncrypt:l,isLive:u,openSoftDecoding:c,isMobile:h,drmType:d}=this.playerData,p=d===or.DRM_ENCRYPT,f=[or.PRIVATE_ENCRYPT_UPGRADE,or.PRIVATE_ENCRYPT].includes(d),g=Wa(r,"EncryptHlsPlugin");if(!!(null==g?void 0:g.keyToken)||l&&!p||f||this.playerData.isOpenVePlayerABR()&&!(null==(n=null==this?void 0:this.useNativeAbr)?void 0:n.call(this))){return[yield e.loadPlugins(Hw.HLSEncrypt)]}{const t=Wa(o,"Subtitle"),i=u&&t,n=(Xa()||window.WebAssembly)&&c,l=r.enableHlsMSE,d=Kr.os.isIos?qa():Xa()||qa(),f=r.enableMobileHlsPlugin&&d,g=p&&Kr.os.isAndroid,y=p&&Ja,v=h&&!document.createElement("video").canPlayType("application/vnd.apple.mpegurl");if(h&&(n||i||l||f||g||v)||!(h||Ja&&!s||y)){return[yield e.loadPlugins(a?Hw.HLSjsPro:Hw.HLS)]}}}))}setPluginConfigInVid(e,t){var i;const{vid:n,defaultDefinitionData:r}=e,{config:o,privateDrmAuthToken:s,sessionId:a,useUnionInfoDRM:l}=t,{playDomain:c,keyToken:h,getKeyType:d}=o,p=!!r.kid,f=this.playerData.drmType===or.DRM_ENCRYPT,g=this.playerData.drmType===or.PRIVATE_ENCRYPT_UPGRADE;if(p&&!f){const e=null==(i=this.playerData.configs)?void 0:i.EncryptHlsPlugin,t="object"==typeof e?e:{},{kid:o,secretKey:p}=r;if(h)this.playerData.options.EncryptHlsPlugin=u({keyToken:h,playDomain:c||this.playerData.playDomain,getKeyType:d||"TOP",preferMMS:!0,preferMMSStreaming:!0},t);else if(g)this.playerData.options.EncryptHlsPlugin=u({vid:n,kid:o,useUnionInfoDRM:!0,sessionId:this.playerData.encryptSessionId,drmType:or.PRIVATE_ENCRYPT_UPGRADE,keyTokenExpiredDuration:9999999,secretKey:p,preferMMS:!0,preferMMSStreaming:!0},t);else if(s&&a){const e=va(s),i=parseInt(""+e["X-Expires"]),r=isNaN(i)?30:i;this.playerData.options.EncryptHlsPlugin=u({vid:n,kid:o,keyTokenExpiredDuration:r,drmKeyToken:s,useUnionInfoDRM:l,sessionId:a,playDomain:c||this.playerData.playDomain,preferMMS:!0,preferMMSStreaming:!0},t)}}}}class mD extends Uw{applyAbrPluginConfig(e,t){}needAbrAutoDefinition(){return!1}prepareAbrModule(e,t){}setAbrDefaultDefiWithAuto(){return!1}generatePlaylistFromServer(e,...t){const{playList:i=[]}=e||{};return[...i||[]]}useNativeAbr(){return!1}canOpenAbr(){return!1}canAdaptRangeEnable(){return!1}adaptRangeDefaultOptions(){}applyAdaptRangePluginConfig(e,t){}applyAdaptRangeStrategy(e,t){}getPlugins(){return Promise.resolve([])}setPluginConfigInVid(){}}var _D=(e=>(e.EDITION_STANDARD="standard_edition",e.EDITION_PREMIUM="premium_edition",e.EDITION_NONE="none_edition",e))(_D||{}),ED=(e=>(e.SDK_VOD_PLAY="web_vod_play",e.SDK_LIVE_PULL="web_live_pull",e))(ED||{}),TD=(e=>(e.H265="h265",e.PRELOAD="preload",e.ADAPT_RANGE="adaptRange",e.ABR="abr",e))(TD||{}),SD=(e=>(e[e.LICENSE_STATUS_INVALID=0]="LICENSE_STATUS_INVALID",e[e.LICENSE_STATUS_OK=1]="LICENSE_STATUS_OK",e[e.LICENSE_STATUS_EXPIRED=2]="LICENSE_STATUS_EXPIRED",e[e.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH=401]="LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH",e))(SD||{});const bD={setLicenseConfig:e=>d(this,null,(function*(){})),checkLicense:()=>d(this,null,(function*(){return"premium_edition"})),checkModuleList:()=>d(this,null,(function*(){return Object.values(TD)})),checkLicenseStatus:()=>d(this,null,(function*(){return 1})),checkLicenseModuleAuth:(e,t)=>d(this,null,(function*(){return!0})),renderLogo:e=>{}},kD={levelList:!1,manualLevelSwitch:!1,restoreAuto:!1,levelCap:!1,bitrateCap:!1,definitionCap:!1},CD=(e=kD)=>u({},e),ID=e=>"string"==typeof e?e.trim().toLowerCase():"";function AD(e,t){const i=ID(t);if(void 0!==(null==e?void 0:e.engine)&&""!==i&&"hls"!==i)throw new TypeError("autoBitrateOpts.engine only applies to HLS.")}function PD(e){var t;return!0!==(null==e?void 0:e.enable)?null:null!=(t=e.engine)?t:"veplayer"}class wD{constructor(e,t){var i,n;this.id="",this.type="",this.isLive=!1,this.options=null,this.isMobile=!1,this.playList=[],this.plugins=[],this.openSoftDecoding=!1,this.current={lineId:0,language:"",definition:"",streamType:"",codec:tr.UNKNOWN,kid:"",secretKey:"",drmType:void 0},this.strategiesPlugins=[],this.strategiesPluginConfigs={},this.urlCheckData={enableUrlExpireCheck:!1,urlExpireTimestamp:qs,urlExpireDiff:60,urlCheckExpireInterval:400},this.isAutoBitrateEnable=!1,this.isVidEncrypt=!1,this.drmType=void 0;const r=e,{options:o,type:s,isLive:a,id:l,root:u,plugins:c=[],defaultConfig:d,languages:p,codec:f,isMobile:g=!1,enableH265Degrade:y=!1,onMediaExpired:v,onTokenExpired:m,unionId:_,isMusic:E=!1,sdkPlugins:T=[],useHlsPluginForSafari:S=!0,enableHlsJs:b=!0,enableMenu:k=!1,region:C={}.__DEFAULT_REGION__,userRegion:I,debug:A=!1,licensSupportModuleList:P=Object.values(TD),encryptSessionId:w}=r,D=h(r,["options","type","isLive","id","root","plugins","defaultConfig","languages","codec","isMobile","enableH265Degrade","onMediaExpired","onTokenExpired","unionId","isMusic","sdkPlugins","useHlsPluginForSafari","enableHlsJs","enableMenu","region","userRegion","debug","licensSupportModuleList","encryptSessionId"]);this.configs=e,this.sdk=t,A&&(aa.config.debug=3),this.options=Object.assign({},o,D),this.options.poster="string"==typeof this.options.poster?function(e){const t=""+e,i=sl.exec(t);if(!i)return t;let n,r,o="",s=0;for(r=i.index;r<t.length;r++){switch(t.charCodeAt(r)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}s!==r&&(o+=t.substring(s,r)),s=r+1,o+=n}return s!==r?o+t.substring(s,r):o}(this.options.poster):this.options.poster,this.options.icons=(e=>{const t={};return e&&Object.entries(e).forEach((([e,i])=>{i&&"string"!=typeof i&&(t[e]=i)})),t})(this.options.icons),this.id=l,this.root=u,this.type=s,this.isLive=!!(null!=a?a:"live"===s),this.defaultConfig=d,this.languageData=this.initI18nData(p),this.isMobile=g||"mobile"===Kr.device,this.openSoftDecoding=null==(i=this.configs)?void 0:i.useSoftDecoding,this.enableH265Degrade=y,this.codec=f||tr.UNKNOWN,this.onMediaExpired=v,this.onTokenExpired=m,null==(n=this.setVodPlayListConfig)||n.call(this,this.configs),this.current=hr.observe(this.current),this.plugins=[...c],this.isMusic=E,this.unionId=_,this.sdkPlugins=T,this.useHlsPluginForSafari=S,this.enableHlsJs=b,this.enableMenu=k,k&&(this.options.enableContextmenu=!0,this.options.closeVideoStopPropagation=!0),this.region=C,this.userRegion=I,this.setVodTeaId(),this.playDomainDegrade=!1,this.dashOpts=null,this.encryptSessionId=w,this.initPlayData(this.configs),hr.subscribeProperty(this.current,"definition",this.updateCheckExpireData.bind(this))}initPlayData(e){const t=this.initPlaylistAndGetCurrent(e);this.initCurrent(t)}initPlaylistAndGetCurrent(e){var t,i;const{url:n,playList:r=[],streamType:o="",definitionText:s,definitionTextKey:a,urlExpireTimestamp:l,playAuth:h,playAuthId:d}=e,p=e.defaultDefinition||this.configs.defaultDefinition,f=e.codec||tr.UNKNOWN;(null==e?void 0:e.autoBitrateOpts)&&this.updateConfigs({autoBitrateOpts:u(u({},null!=(t=this.configs.autoBitrateOpts)?t:{}),e.autoBitrateOpts)});let g=null;const y=fi([...r].filter((e=>e.url)).map(((e,t)=>c(u({},e),{bitrate:e.bitrate||e.Bitrate||1e3*(t+1),secretKey:e.playAuth,kid:e.playAuthId}))));if(n)if(0===y.length){const e=u(c(u({},this.current),{url:n,streamType:o,definitionTextKey:a,codec:f,secretKey:h,kid:d,urlExpireTimestamp:l}),a||s?{definition:s}:{definition:"HD"});this.playList=[e],this.defaultDefinition=e.definition}else{this.playList=y;const e=this.getUrlList({url:n});e.length>0?g=e[0]:aa.warn("default url is not match Playlist")}else this.playList=y;e.drmType&&this.setDrmType(e.drmType);let v=this.getCurrentByDefaultConfig();v?this.defaultDefinition=v.definition:(v=g||(p&&(null==(i=this.getUrlList({definition:p}))?void 0:i[0])||this.playList[0]),this.defaultDefinition=null==v?void 0:v.definition);const m=this.getTargetStreamType(v);if(AD(this.configs.autoBitrateOpts,m),this.adapter=function(e,t){const i=c(u({},t),{streamType:e});switch(null==e?void 0:e.toLowerCase()){case"mp4":case"m4a":return new Gw(i);case"dash":return new Yw(i);case"hls":return new vD(i);default:return aa.log(`no adapter match ${e}, use others adapter by default`),new mD(i)}}(m,{configs:this.configs,playerData:this}),this.isAutoBitrateEnable=this.checkAutoBitratePlayList(),this.isOpenABR()){const e=this.getABRStreamInfo(m,v);v=e.defaultStream,this.playList=e.playList,this.defaultDefinition=e.defaultDefinition}return this.playList.forEach((e=>{(null==e?void 0:e.streamType)&&(e.vtype=e.streamType.toUpperCase()),(null==e?void 0:e.codec)&&(e.codecType=e.codec)})),v}checkAutoBitratePlayList(){var e,t;return!(Kr.os.isIos&&this.adapter.needAbrAutoDefinition()&&!(null==(t=null==(e=this.playList)?void 0:e.find((e=>this.isAutoDefinition(null==e?void 0:e.definition))))?void 0:t.url))}getABRStreamInfo(e,t){var i,n,r,o,s;let a=this.defaultDefinition;const l=(null==(n=null==(i=this.playList)?void 0:i.concat)?void 0:n.call(i))||[];let u=t;const c=l.findIndex((e=>this.isAutoDefinition(null==e?void 0:e.definition))),h=-1!==c?l.splice(c,1)[0]:void 0,d={definition:null!=(r=null==h?void 0:h.definition)?r:"auto",bitrate:void 0,definitionTextKey:(null==h?void 0:h.definitionTextKey)||(null==(s=null==(o=this.configs)?void 0:o.autoBitrateOpts)?void 0:s.definitionTextKey)||"DEFINITION_AUTO",url:(null==h?void 0:h.url)||"__auto__",name:"auto",streamType:e||this.configs.streamType};return this.isAutoDefinition(this.configs.defaultDefinition)||(d.bitrate=null==u?void 0:u.bitrate,a=null==u?void 0:u.definition),this.isPlayAutoDefinition()&&(u=d,this.adapter.setAbrDefaultDefiWithAuto()&&(a=d.definition)),l.push(d),{defaultDefinition:a,defaultStream:u,playList:l}}isCurrentH265(){if(this.codec){return this.codec.replace(".","").toLowerCase()===tr.H265}return!1}setDrmType(e){this.drmType=e}getCurrentByDefaultConfig(){if(!this.defaultConfig)return;const{type:e,isLive:t,lineId:i="",definition:n=""}=this.defaultConfig;if((null!=t?t:"live"===e)!==this.isLive)return;if(!i&&!n)return aa.warn("默认配置未设置默认线路或默认清晰度"),void(this.isHitDefault=!1);const r=this.getUrlList({lineId:i,definition:n});return r.length>0?(this.isHitDefault=!0,r[0]):(aa.warn("playlist中没有满足默认配置的流"),void(this.isHitDefault=!1))}initCurrent(e){var t,i,n;Object.keys(this.current).forEach((t=>{this.current[t]=null==e?void 0:e[t]}));const r=null==e?void 0:e.codec;this.codec=r&&Object.values(tr).includes(r)?r:tr.UNKNOWN,(null==(t=this.current)?void 0:t.drmType)&&this.setDrmType(null==(i=this.current)?void 0:i.drmType),this.isVidEncrypt=!!(null==(n=this.current)?void 0:n.kid),this.initCheckExpireData()}initCheckExpireData(){const{enableUrlExpireCheck:e,urlExpireDiff:t,urlCheckExpireInterval:i}=this.configs;Mw(this.urlCheckData,{enableUrlExpireCheck:e,urlExpireDiff:t,urlCheckExpireInterval:i}),this.updateCheckExpireData()}updateCheckExpireData(){var e;const t=null==(e=this.getCurrentStreams())?void 0:e[0];if(t){const{url:e,urlExpireTimestamp:i}=t;if(!e)return;const n=nl(""+(i||this.configs.urlExpireTimestamp));n?this.urlCheckData.urlExpireTimestamp=n:this.urlCheckData.enableUrlExpireCheck&&(this.urlCheckData.urlExpireTimestamp=qs,aa.warn("not provide urlExpireTimestamp, url expire check will not work")),aa.log("update urlCheckData to:",this.urlCheckData)}}initI18nData(e){const t=[Js,ea],i=e&&Object.entries(e).reduce(((e,[i,n])=>(zs.includes(i)?e.push({LANG:"zh"===i?"zh-cn":i,TEXT:n}):t.push({LANG:i,TEXT:n}),e)),[]);return{extraLangList:t,extendLangList:i}}getCurrentUrl(){var e;return null==(e=this.getCurrentStreams()[0])?void 0:e.url}getTargetStreamType(e){var t;return e?e.streamType||this.configs.streamType||Va(e.url):this.configs.streamType||ma(null==(t=this.configs)?void 0:t.getVideoByToken)}getCurrentStreamType(){const e=this.getCurrentStreams();if(e.length){const{url:t,streamType:i}=e[0];return i||this.configs.streamType||Va(t)||"mp4"}return this.configs.streamType||"mp4"}getStreamType(){var e;return this.getCurrentStreamType()||ma(null==(e=this.configs)?void 0:e.getVideoByToken)}getConfiguredHlsAbrEngine(){var e;return PD(null==(e=this.configs)?void 0:e.autoBitrateOpts)}isOpenVePlayerABR(){var e,t,i;if("veplayer"!==this.getConfiguredHlsAbrEngine()||!this.isAutoBitrateEnable||!(null==(e=this.configs)?void 0:e.isLive)&&!(null==(i=null==(t=this.configs)?void 0:t.licensSupportModuleList)?void 0:i.includes(TD.ABR)))return!1;const n=this.sdk.getSdkPlugin("AuthToken");return this.adapter.canOpenAbr(null==n?void 0:n.playInfo)}isOpenABR(){return this.isOpenVePlayerABR()}showRealDefinition(){var e,t;return!!(null==(t=null==(e=this.configs)?void 0:e.autoBitrateOpts)?void 0:t.showRealDefinition)}isAutoDefinition(e){return["auto","自动"].includes(e)}isPlayAutoDefinition(e=""){var t;return this.isAutoDefinition(e||this.defaultDefinition)||(null==(t=this.configs.autoBitrateOpts)?void 0:t.startWithAuto)}isDefinitionMatch(e,t){return!(!this.isAutoDefinition(e)||!this.isAutoDefinition(t))||e===t}getCurrentStreams(){const e=this.current;return this.getUrlList(e)}getLineList(){return fi(er(this.playList,"lineId"))}getLineListByLineId(e){return this.playList.filter((t=>{var i;return(null==e?void 0:e.toString())===(null==(i=t.lineId)?void 0:i.toString())}))}getDefinitionListByLineId(e){return fi(er(this.getLineListByLineId(e),"definition"))}getUrlList(e){return this.playList.filter((t=>Object.keys(e).every((i=>{var n,r;if("url"===i){const i=null==e?void 0:e.url,n=null==t?void 0:t.url;return"string"==typeof i?i===(null==n?void 0:n.toString()):!(!Array.isArray(i)||!Array.isArray(n))&&i.map((e=>e.src)).join("")===n.map((e=>e.src)).join("")}{const o=(null==(n=e[i])?void 0:n.toString())===(null==(r=t[i])?void 0:r.toString()),s=!e[i];return o||s}}))))}getNextDefinition(e=!0,t){var i,n,r;const o=e?"next":"prev",{definition:s,lineId:a}=this.current;if(!s)return;const l=null==(i=this.getCurrentStreams())?void 0:i[0],u="auto"===s?l.mapDefinition:s,c=(e=>(null==e?void 0:e.length)&&e.reduce(((t,i,n)=>(t[i]={next:n+1>=e.length?null:e[n+1],pre:0===n?null:e[n-1]},t)),{}))(t)||Ys;if(!Object.keys(c).includes(u))return;let h=null==(n=c[u])?void 0:n[o];const d=this.getDefinitionListByLineId(a);for(;0===d.filter((e=>e.definition===h)).length&&h;)h=null==(r=c[h])?void 0:r[o];if(h)return"auto"===s&&h&&(l.mapDefinition=h),this.getUrlList({lineId:a,definition:h});aa.log("已经降至最低级")}get apiMap(){var e;const t="sg",i=null==(e=yH.ttDramaEnv)?void 0:e.channel,n={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}},r={cn:{__PLAY_DOMAIN__:"https://vod.volcengineapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.volcengineapi.com"},mya:{__PLAY_DOMAIN__:"https://vod.ap-southeast-1.volcengineapi.com"}};let o,s=t;"byteplus"===i&&n?(o=n,s="sg"):"volcengine"===i&&r?(o=r,s=o[t]?t:"cn"):o={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}};const a=o[this.region]||o[s];return{playDomain:a.__PLAY_DOMAIN__,backupPlayDomain:null==a?void 0:a.__BACKUP_PLAY_DOMAIN__}}get playDomain(){var e;return this.playDomainDegrade&&null!=(e=this.apiMap.backupPlayDomain)?e:this.apiMap.playDomain}setVodTeaId(){const e=el(this.userRegion,this.region);!function(e){Aw.TEA_ID=e}(this.configs.logTeaAppId||e.__LOG_TEA_ID__||4951)}getMergedConfigs(e){const t=fi(this.configs);return Bi(t,fi(e),((e,t)=>{if(ye(e))return t})),t}updateConfigs(e){Bi(this.configs,fi(e),((e,t)=>{if(ye(e))return t}))}updatePlayList(){const{url:e,playList:t=[],urlExpireTimestamp:i}=this.configs,n=[...t].filter((e=>e.url));if(e&&!n.length){const t=c(u({},this.current),{url:e,urlExpireTimestamp:i});this.playList=[t]}else this.playList=n}isVidPlay(){var e,t;return!!(null==(t=null==(e=this.configs)?void 0:e.getVideoByToken)?void 0:t.playAuthToken)}}class DD{}DD.isSupported=()=>!1,DD.isSupportedH264=e=>!1;var LD=function(){function e(t){gr(this,e),this.config=t.config,this.parent=t.root,this.root=Ur.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),t.root.appendChild(this.root);var i=this.config.maxHeight;i&&this.setStyle({maxHeight:i}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var n="touch"===this.config.domEventType?"touchend":"click";this._delegates=bs.delegate.call(this,this.root,"li",n,this.onItemClick)}return vr(e,[{key:"renderItemList",value:function(e){var t=this,i=this.config,n=this.root;e?i.data=e:e=i.data,i.style&&Object.keys(i.style).map((function(e){n.style[e]=i[e]})),e.length>0&&(this.attrKeys=Object.keys(e[0])),this.root.innerHTML="",e.map((function(e,i){var n=e.selected?"option-item selected":"option-item";e["data-index"]=i,t.root.appendChild(Ur.createDom("li","<span>".concat(e.showText,"</span>"),e,n))}))}},{key:"onItemClick",value:function(e){e.delegateTarget||(e.delegateTarget=e.target);var t=e.delegateTarget;if(t&&Ur.hasClass(t,"selected"))return!1;var i="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");Ur.addClass(t,"selected"),n&&Ur.removeClass(n,"selected"),i(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(e,t){if(!e||!t)return{};var i={};t.map((function(t){i[t]=e.getAttribute(t)}));var n=e.getAttribute("data-index");return n&&(i.index=Number(n)),i}},{key:"show",value:function(){Ur.removeClass(this.root,"hide"),Ur.addClass(this.root,"active")}},{key:"hide",value:function(){Ur.removeClass(this.root,"active"),Ur.addClass(this.root,"hide")}},{key:"setStyle",value:function(e){var t=this;Object.keys(e).forEach((function(i){t.root.style[i]=e[i]}))}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map((function(e){e.destroy&&e.destroy()})),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),e}(),RD="side",xD="middle",OD="default",ND="click",MD="hover";var UD="mobile"===Kr.device,BD=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"onEnter",(function(e){e.stopPropagation(),n.emit("icon_mouseenter",{pluginName:n.pluginName}),n.switchActiveState(e)})),mr(Sr(n),"switchActiveState",(function(e){e.stopPropagation(),n.config.toggleMode===ND?n.toggle(!n.isActive):n.toggle(!0)})),mr(Sr(n),"onLeave",(function(e){e.stopPropagation(),n.emit("icon_mouseleave",{pluginName:n.pluginName}),n.config.listType!==RD&&n.isActive&&n.toggle(!1)})),mr(Sr(n),"onListEnter",(function(e){n.enterType=2})),mr(Sr(n),"onListLeave",(function(e){n.enterType=0,n.isActive&&n.toggle(!1)})),n.isIcons=!1,n.isActive=!1,n.curValue=null,n.curIndex=0,n}return vr(i,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;this.initIcons(),(UD=UD||"touch"===this.domEventType)&&"mobile"===Kr.device&&t.listType===OD&&(t.listType=RD),t.hidePortrait&&Ur.addClass(this.root,"portrait"),this.on([Lo,Io],(function(){e._resizeList()})),this.once(no,(function(){t.list&&t.list.length>0&&(e.renderItemList(t.list),e.show())})),UD&&this.on(ho,(function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)})),UD?(t.toggleMode=ND,this.activeEvent="touchend"):this.activeEvent=t.toggleMode===ND?"click":"mouseenter",t.toggleMode===ND?this.bind(this.activeEvent,this.switchActiveState):(this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,t=this.icons,i=Object.keys(t),n=!1;i.length>0&&(i.forEach((function(i){e.appendChild(".xgplayer-icon",t[i]),!n&&(n=t[i])})),this.isIcons=n),n||(this.appendChild(".xgplayer-icon",Ur.createDom("span","",{},"icon-text")),Ur.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||Ur.addClass(this.root,"show")}},{key:"hide",value:function(){Ur.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,t,i){if(void 0===e)return"";var n=this.config.list;!i&&(i=this.player.lang),t=!t||Ur.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]);try{return"object"===fr(e[t])?e[t][i]||e[t].en:e[t]}catch(r){return console.warn(r),""}}},{key:"toggle",value:function(e){if(e!==this.isActive&&!this.config.disable){var t=this.player.controls,i=this.config.listType;e?(i===RD?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):(i===RD?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,t){e.stopPropagation();var i=this.config,n=i.listType,r=i.list;this.curIndex=t.to.index,this.curItem=r[this.curIndex],this.changeCurrentText(),(this.config.isItemClickHide||UD||n===RD)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0];t&&(this.find(".icon-text").innerHTML=this.getTextByLang(t,"iconText"))}}},{key:"renderItemList",value:function(e,t){var i=this,n=this.config,r=this.optionsList,o=this.player;if("number"==typeof t&&(this.curIndex=t,this.curItem=n.list[t]),r)return r.renderItemList(e),void this.changeCurrentText();var s,a,l={config:{data:e||[],className:(s=n.listType,a=n.position,s===RD?a===ms.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""),onItemClick:function(e,t){i.onItemClick(e,t)},domEventType:UD?"touch":"mouse"},root:n.listType===RD?o.innerContainer||o.root:this.root};if(this.config.isShowIcon){var u=this.player.root.getBoundingClientRect().height,c=n.listType===xD?u-50:u;c&&n.heightLimit&&(l.config.maxHeight="".concat(c,"px")),this.optionsList=new LD(l),this.changeCurrentText(),this.show()}this._resizeList()}},{key:"_resizeList",value:function(){if(this.config.heightLimit){var e=this.player.root.getBoundingClientRect().height,t=this.config.listType===xD?e-50:e;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(t,"px")})}}},{key:"destroy",value:function(){this.config.toggleMode===ND?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.isIcons&&this.unbind("click",this.onIconClick),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>')}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:MD,heightLimit:!0}}}]),i}(bs);const HD={READY:"ready",COMPLETE:"complete",URL_CHANGE:"urlchange",PLAYER_FOCUS:"focus",PLAYER_BLUR:"blur",FULLSCREEN_CHANGE:"fullscreen_change",CSS_FULLSCREEN_CHANGE:"cssFullscreen_change",MINI_STATE_CHANGE:"mini_state_change",DESTROY:"destroy",REPLAY:"replay",RETRY:"retry",DEFINITION_CHANGE:"definition_change",Before_DEFINITION_CHANGE:"before_definition_change",AFTER_DEFINITION_CHANGE:"after_definition_change",VIDEO_RESIZE:"video_resize",PIP_CHANGE:"pip_change",ROTATE:"rotate",SHORTCUT:"shortcut",SEI_PARSED:"SEI_PARSED",USER_ACTION:"user_action",AUTOPLAY_STARTED:"autoplay_started",AUTOPLAY_PREVENTED:"autoplay_was_prevented",READY_CREATE_PLAYER:"ready_create_player",PLAYER_CREATED_FINISH:"player_create_finish",CREATE_PLAYER_PERF:"create_player_perf",PLAYER_REBUILD:"player_rebuild",NOT_SUPPORT_HARDWARE_DECODER:"not_support_hardware_decoder",NOT_SUPPORT_SOFT_DECODER:"not_support_soft_decoder",TOKEN_EXPIRED:"playAuthToken_expired",UMD_LOAD_FAIL:"umd_load_fail",PLAYNEXT:"playnext",URL_NULL:"urlNull",LEAVE_PLAYER:"leaveplayer",ENTER_PLAYER:"enterplayer",RESET:"reset",SOURCE_ERROR:"source_error",SOURCE_SUCCESS:"source_success",LICENSE_STATUS_WARNING:"license_status_warning",AUDIO_TRACKS_UPDATED:"audio_tracks_updated",AUDIO_TRACK_CHANGE:"audio_track_change",HLS_LEVELS_UPDATED:"hls_levels_updated",HLS_LEVEL_SWITCHING:"hls_level_switching",HLS_LEVEL_SWITCHED:"hls_level_switched",HLS_ABR_ENGINE_RESOLVED:"hls_abr_engine_resolved",HLS_ABR_STATE_CHANGE:"hls_abr_state_change",HLS_ABR_LIMIT_CHANGE:"hls_abr_limit_change",HLS_SUBTITLE_TRACKS_UPDATED:"hls_subtitle_tracks_updated",HLS_SUBTITLE_TRACK_SWITCHING:"hls_subtitle_track_switching",HLS_SUBTITLE_TRACK_SWITCHED:"hls_subtitle_track_switched"},FD=c(u({DANMU_CHANGE:"danmu_change",TIME_SHIFT_CHANGE:"time_shift_change",AI_SUBTITLE_LANG_CHANGE:"ai_subtitle_lang_change",AI_SUBTITLE_MATCH:"ai_subtitle_match",CANCEL_UNMUTE:"cancel_unmute",REFRESH_CLICK:"refresh_click",PLAY_BACKUP_CHANGE:"play_backup_change",PLAY_BACKUP_CHANGE_FINISH:"play_backup_change_finish",PLAY_ERROR_BUTTON_CLICK:"play_error_button_click",PlAY_URL_CHANGE:"play_url_change",SHOW_PLAY_ERROR:"show_play_error",PLAYER_EXTEND_BUTTON:"player_extend_button",LONG_WAITING:"long_waiting",OFTEN_WAITING:"often_waiting",DEFINITION_DEMOTE:"definition_demote",LARKWINDOW_CHANGE:"larkWindow_change",PANEL_MODE_CHANGE:"panel_mode_change",INNER_DEFINITION_CHANGE:"inner_definition_change",LINE_CHANGE:"line_change",GET_PLAY_URL_ERR:"get_play_url_err",MEDIA_EXPIRED:"MEDIA_EXPIRED",MIRROR_CHANGE:"mirror_change"},{}),{AUTOPLAY_SUCCESS:"autoplay_success",AUTOPLAY_FAILED:"autoplay_failed",MENU_LOG:"MENU_LOG",MENU_REPORT:"MENU_REPORT",PLAY_LIST_CHANGE:"play_list_change",PLAY_LIST_ITEM_CHANGE:"play_list_item_change",PLAY_NEXT_START:"play_next_start",PLAY_NEXT_END:"play_next_end",ABR_AUTO_DESC_CHANGE:"ABR_AUTO_DESC_CHANGE",CORE_EVENT:"core_event",PRELOAD_INFO:"PRELOAD_INFO"}),jD=u(u(u({},{ABORT:"abort",CANPLAY:"canplay",CANPLAY_THROUGH:"canplaythrough",DURATION_CHANGE:"durationchange",EMPITED:"empited",EMPTIED:"emptied",ENDED:"ended",ERROR:"error",LOADED_DATA:"loadeddata",LOADED_META_DATA:"loadedmetadata",LOAD_START:"loadstart",PAUSE:"pause",PLAY:"play",PLAYING:"playing",PROGRESS:"progress",RATE_CHANGE:"ratechange",SEEKED:"seeked",SEEKING:"seeking",STALLED:"stalled",SUSPEND:"suspend",TIME_UPDATE:"timeupdate",VOLUME_CHANGE:"volumechange",WAITING:"waiting"}),HD),FD),VD={SDKEvents:HD,PluginEvents:FD},KD=jD,GD=70,WD=30,YD=50,zD=60,$D=20,XD=e=>"string"==typeof e&&e.trim()?e.trim():void 0,qD=e=>{if(e>=1e6){return`${Math.round(e/1e6*10)/10} Mbps`}return`${Math.round(e/1e3)} Kbps`},QD=e=>{const t=null==e?void 0:e.trim().toLowerCase();if(t)return/^(avc1|avc|h264)/.test(t)?"H.264":/^(hev1|hvc1|hevc|h265)/.test(t)?"H.265":/^(vvc1|vvi1|vvc|h266)/.test(t)?"H.266":/^(av01|av1)/.test(t)?"AV1":null==e?void 0:e.trim()},ZD=e=>{const t=null==e?void 0:e.trim().toLowerCase();if(t)return["pq","hlg","hdr","hdr10","hdr10+"].includes(t)?"HDR":"sdr"===t?"SDR":null==e?void 0:e.trim().toUpperCase()},JD=e=>{var t,i;const n=[e.width,e.height].filter((e=>"number"==typeof e&&e>0));return n.length>0?`${Math.round(Math.min(...n))}p`:(null==(t=e.name)?void 0:t.trim())?e.name.trim():qD(null!=(i=e.averageBitrate)?i:e.bitrate)};const eL=(e,t,i)=>e.flatMap((e=>{var n,r;const o=XD(e.definition);if(!o)return[];const s=`definition:${encodeURIComponent(o)}`;return[{id:s,label:null!=(r=null!=(n=XD(e.text))?n:XD(e.definitionTextKey))?r:o,source:"definition",definition:o,selected:o===t,pending:i===s}]})),tL=(e,t,i)=>({id:"auto",label:e,source:"abr-auto",selected:t,pending:"auto"===i});function iL(e){var t,i,n;const r=e.abrState,o=e.levelState,s=null!=(t=e.definitions)?t:[],a=(null==(i=e.autoLabel)?void 0:i.trim())||"Auto",l="hls-levels"===(null==r?void 0:r.decisionSource)&&r.playbackSessionId===(null==o?void 0:o.playbackSessionId)&&o.ready;if(l&&o.levels.length<=1)return[];if(l&&o){const t=function(e){const t=e.map(JD),i=new Map;return t.forEach((e=>{var t;return i.set(e,(null!=(t=i.get(e))?t:0)+1)})),e.map(((n,r)=>{var o,s;const a=t[r];if((null!=(o=i.get(a))?o:0)<2)return a;const l=e.filter(((e,i)=>t[i]===a)),u=[a,qD(null!=(s=n.averageBitrate)?s:n.bitrate)],c=l.map((e=>e.width)).filter(Boolean);new Set(c).size>1&&n.width&&n.height&&u.push(`${Math.round(n.width)}×${Math.round(n.height)}`);const h=l.map((e=>QD(e.videoCodec)));if(new Set(h).size>1){const e=QD(n.videoCodec);e&&u.push(e)}const d=l.map((e=>ZD(e.videoRange)));if(new Set(d).size>1){const e=ZD(n.videoRange);e&&u.push(e)}const p=l.map((e=>e.frameRate));return new Set(p).size>1&&n.frameRate&&u.push(`${Math.round(n.frameRate)} fps`),u.join(" · ")}))}(o.levels),i=(null==(n=e.pendingId)?void 0:n.startsWith("level:"))?e.pendingId:null,s=o.levels.findIndex((e=>e.index===o.currentLevel)),l=t[s],u=e.showRealDefinition&&"auto"===(null==r?void 0:r.mode)&&l?`${a}(${l})`:a;return[tL(u,"auto"===(null==r?void 0:r.mode)&&!i,e.pendingId),...o.levels.map(((n,s)=>{const a=`level:${n.index}`;return{id:a,label:t[s],source:"hls-level",levelIndex:n.index,selected:i?i===a:"manual"===(null==r?void 0:r.mode)&&o.currentLevel===n.index,pending:e.pendingId===a}}))]}if("definition-list"===(null==r?void 0:r.decisionSource)&&r.available){const t=s.filter((e=>{const t=XD(e.definition);return!!t&&!(e=>["auto","自动"].includes(e.trim().toLowerCase()))(t)}));return[tL(a,"auto"===r.mode,e.pendingId),...eL(t,e.currentDefinition,e.pendingId).map((e=>c(u({},e),{selected:"manual"===r.mode&&e.selected})))]}return eL(s,e.currentDefinition,e.pendingId)}const nL=e=>class extends e{constructor(e){super(e),this._playTimer=null,this._qualityPendingId=null,this._qualitySessionCleared=!1,this._qualityExpiredSessionId=null,this.handleHlsQualityStateUpdate=e=>{var t,i,n,r;this.isCurrentHlsQualitySession(e)&&(this._qualitySessionCleared=!1,this._qualityExpiredSessionId=null,"auto"===this._qualityPendingId&&"auto"===(null==(r=null==(n=null==(i=null==(t=this.player)?void 0:t.sdk)?void 0:i.getHlsAbrState)?void 0:n.call(i))?void 0:r.mode)&&(this._qualityPendingId=null),this.refreshQualityMenu())},this.handleHlsLevelSwitched=e=>{var t;this.isCurrentHlsQualitySession(e)&&(!(null==(t=this._qualityPendingId)?void 0:t.startsWith("level:"))||void 0!==(null==e?void 0:e.to)&&this._qualityPendingId!==`level:${e.to}`||(this._qualityPendingId=null),this.refreshQualityMenu())},this.handleABRDescChange=(...e)=>{this._autoRealDefinition=e[1]||void 0,this.refreshDefinitionList()},this.handleResourceReady=(e=[])=>{var t,i;const{list:n}=this.getCurrentDefinitionInfo(this.player),r=n.filter((t=>{var i;const n=t&&e.find((e=>this.playerData.isDefinitionMatch(e.definition,t.definition)));return n&&"dash"===(null==(i=this.playerData.getStreamType())?void 0:i.toLowerCase())&&(t.url=n.url),n})),o=e.find((e=>null==e?void 0:e.selected))||this.playerData.current,s=r.find((e=>this.playerData.isDefinitionMatch(e.definition,null==o?void 0:o.definition)));this.playerData.playList=r,(null==s?void 0:s.definition)&&(null==(t=this.playerData.current)?void 0:t.definition)!==s.definition&&(this.playerData.current.definition=null==s?void 0:s.definition),null==(i=this.refreshDefinitionList)||i.call(this)},this.getAutoDefRealLevel=()=>{var e;if(this.playerData.isAutoDefinition(null==(e=this.playerData.current)?void 0:e.definition)){const{videoWidth:e,videoHeight:t}=this.player.media;if(e&&t){const{list:i=[]}=this.getCurrentDefinitionInfo(this.player),n=i.find((i=>{const n=i.vwidth||i.width,r=i.vheight||i.height;return n&&r&&n===e&&r===t}));(null==n?void 0:n.definition)&&this._autoRealDefinition!==n.definition&&(this._autoRealDefinition=n.definition,this.refreshDefinitionList(),"mobile"===Kr.device&&(null==this||this.updatePanel()))}}},this.clientType=e.clientType,this.playerData=e.player.config.playerData,this.toastInfo={},this.dataMonitoring()}afterCreate(){var e,t,i,n,r;super.afterCreate(),this._autoRealDefinition=void 0,null==(e=this.refreshDefinitionList)||e.call(this),(this.playerData.isOpenABR()||"dash"===(null==(t=this.playerData.getStreamType())?void 0:t.toLowerCase()))&&this.on("resourceReady",this.handleResourceReady),this.playerData.isOpenABR()&&(this.on("ABR_AUTO_DESC_CHANGE",this.handleABRDescChange),((null==(r=null==(n=null==(i=this.playerData)?void 0:i.adapter)?void 0:n.useNativeAbr)?void 0:r.call(n))||this.player.plugins.dashplugin||this.player.plugins.mp4encryptplayer)&&(this.autoDefDetectTimer=new Ba,this.autoDefDetectTimer.repeat(this.getAutoDefRealLevel,1e3))),this.on(HD.HLS_ABR_ENGINE_RESOLVED,this.handleHlsQualityStateUpdate),this.on(HD.HLS_ABR_STATE_CHANGE,this.handleHlsQualityStateUpdate),this.on(HD.HLS_LEVELS_UPDATED,this.handleHlsQualityStateUpdate),this.on(HD.HLS_LEVEL_SWITCHED,this.handleHlsLevelSwitched),this.on(FD.PLAY_NEXT_START,(()=>{this.handleHlsQualityPlayNextStart(),this.definitionSubscribeId&&hr.unsubscribeProperty(this.playerData.current,"definition",this.definitionSubscribeId),this.playListSubscribeId&&hr.unsubscribeProperty(this.playerData,"playList",this.playListSubscribeId)})),this.on(FD.PLAY_NEXT_END,(()=>{var e,t;null==(e=this.dataMonitoring)||e.call(this),null==(t=this.refreshDefinitionList)||t.call(this)}))}getQualityMenuItems(){var e,t,i,n,r,o,s;if(this._qualitySessionCleared)return[];const a=null==(e=this.player)?void 0:e.sdk,{list:l}=this.getCurrentDefinitionInfo(this.player);return iL({abrState:null==(t=null==a?void 0:a.getHlsAbrState)?void 0:t.call(a),levelState:null==(i=null==a?void 0:a.getHlsLevelState)?void 0:i.call(a),definitions:l,currentDefinition:null==(n=this.playerData.current)?void 0:n.definition,pendingId:this._qualityPendingId,showRealDefinition:this.playerData.showRealDefinition(),autoLabel:(null==(o=null==(r=this.playerData.configs)?void 0:r.autoBitrateOpts)?void 0:o.autoDefinitionText)||(null==(s=this.i18n)?void 0:s.DEFINITION_AUTO)||"Auto"})}selectQualityMenuItem(e){var t,i,n,r,o;if(!e||e.selected||e.pending)return;const s=null==(t=this.player)?void 0:t.sdk;if(!s)return;const a=function(e){if("abr-auto"===e.source)return{type:"restore-auto"};if("definition"===e.source&&e.definition)return{type:"change-definition",definition:e.definition};if("hls-level"===e.source&&void 0!==e.levelIndex)return{type:"set-hls-level",levelIndex:e.levelIndex};throw new TypeError(`Invalid quality menu item: ${e.id}`)}(e);try{if("restore-auto"===a.type)return this._qualityPendingId=e.id,this.refreshQualityMenu(),void s.setHlsAbrMode("auto");if("set-hls-level"===a.type){const t=s.getHlsLevelState().playbackSessionId,n=null==(i=this.playerData.configs)?void 0:i.hlsLevelSwitchMode;return this._qualityPendingId=e.id,this.refreshQualityMenu(),void s.setHlsLevel(a.levelIndex,c(u({},n?{mode:n}:{}),{playbackSessionId:t}))}s.changeDefinition(a.definition)}catch(oF){this._qualityPendingId=null,this.refreshQualityMenu(),null==(o=null==(r=null==(n=this.player)?void 0:n.logger)?void 0:r.error)||o.call(r,"quality menu action failed",oF)}}refreshQualityMenu(){var e,t;null==(e=this.refreshDefinitionList)||e.call(this),"MOBILE"===this.clientType&&(null==(t=this.updatePanel)||t.call(this))}isCurrentHlsQualitySession(e){var t,i,n,r,o;const s=null==e?void 0:e.playbackSessionId;if(!s||s===this._qualityExpiredSessionId)return!1;const a=null==(t=this.player)?void 0:t.sdk;return[null==(n=null==(i=null==a?void 0:a.getHlsAbrState)?void 0:i.call(a))?void 0:n.playbackSessionId,null==(o=null==(r=null==a?void 0:a.getHlsLevelState)?void 0:r.call(a))?void 0:o.playbackSessionId].includes(s)}handleHlsQualityPlayNextStart(){var e,t,i,n,r;const o=null==(e=this.player)?void 0:e.sdk;this._qualityExpiredSessionId=(null==(i=null==(t=null==o?void 0:o.getHlsAbrState)?void 0:t.call(o))?void 0:i.playbackSessionId)||(null==(r=null==(n=null==o?void 0:o.getHlsLevelState)?void 0:n.call(o))?void 0:r.playbackSessionId)||null,this._qualityPendingId=null,this._qualitySessionCleared=!0,this.refreshQualityMenu()}getShowText(e={},t,i){var n,r;if(t)return this.playerData.isOpenABR()&&this.playerData.isAutoDefinition(t.definition)?(null==(r=null==(n=this.playerData.configs)?void 0:n.autoBitrateOpts)?void 0:r.autoDefinitionText)||e[t.definitionTextKey]||t.definition:e[t.definitionTextKey]||t.definition||t.definitionTextKey||i||"HD"}getCurrentDefinitionInfo(e){const t={list:[],defaultDefinition:""},i=e.config.playerData,{current:{lineId:n,definition:r}}=i,o=i.getDefinitionListByLineId(n);return Array.isArray(o)&&o.length>0&&(t.list=o.map((t=>(t.text||(t.text=this.getShowText(e.i18n,t,t.definition)),t)))),t.defaultDefinition=r,t}showToast(e,t){var i,n;const r=null==(i=this.player)?void 0:i.getPlugin("sdkToastPlugin");if(!r)return;const o=this.getShowText(this.i18n,e,t);this.toastInfo&&(clearTimeout(this.toastInfo.timer),null==(n=null==r?void 0:r.remove)||n.call(r,this.toastInfo.id),this.player.off(Do,this.toastInfo.remove),this.player.off(Zr,this.toastInfo.remove)),this.toastInfo={id:r.add(`${this.langText.switching} ${o}...`,0,!0),showTime:Date.now(),delayClose:!1},this.toastInfo.timer=setTimeout((()=>{r.remove(this.toastInfo.id),clearTimeout(this.toastInfo.timer)}),2e3),this.toastInfo.remove=()=>{if(!this.toastInfo.id)return;Date.now()-this.toastInfo.showTime>2e3?r.remove(this.toastInfo.id):this.toastInfo.delayClose=!0},this.player.once(Do,this.toastInfo.remove),this.player.once(Zr,this.toastInfo.remove)}selectDefinition(e){var t,i,n;const r=null==(n=null==(i=null==(t=this.renderList)?void 0:t.find)?void 0:i.call(t,(t=>this.playerData.isDefinitionMatch(t.definition,e.definition))))?void 0:n.definitionTextKey;this.config.showToastOnManualClick&&this.showToast(c(u({},e),{definitionTextKey:r}),e.definition),this.playerData.current.definition=e.definition,this.playerData.isAutoDefinition(e.definition)||(this._autoRealDefinition=void 0)}showRealDefinition(e){return e.selected&&this.playerData.isAutoDefinition(e.definition)&&this.playerData.showRealDefinition()&&this._autoRealDefinition&&!this.playerData.isAutoDefinition(this._autoRealDefinition)}dataMonitoring(){this.playerData&&(this.definitionSubscribeId=hr.subscribeProperty(this.playerData.current,"definition",((e,t)=>{if(e&&t&&e!==t&&this.player){const{list:i}=this.getCurrentDefinitionInfo(this.player),n=i.find((e=>e.definition===t));n&&n.url&&(this.player.changeDefinition(c(u({kid:n.playAuthId},n),{secretKey:n.secretKey,definition:t,url:n.url})),"MOBILE"===this.clientType&&this.updatePanel(),this.player.emit(FD.INNER_DEFINITION_CHANGE,{from:e,to:t,url:n.url}),this.player.emit(FD.PlAY_URL_CHANGE,{url:n.url,from:FD.INNER_DEFINITION_CHANGE}),"PC"===this.clientType&&this.renderItemList(t),this.player.config.isLive&&(this._playTimer=setTimeout((()=>{this.player.ended?this.player.replay():this.player.paused&&this.player.play()}),1e3)))}})),this.playListSubscribeId=hr.subscribeProperty(this.playerData,"playList",(()=>{this.refreshDefinitionList()})))}onItemClick(...e){super.onItemClick(...e)}destroy(){clearTimeout(this.toastInfo.timer),clearTimeout(this._playTimer),this.autoDefDetectTimer&&(this.autoDefDetectTimer.clear(),this.autoDefDetectTimer=null,this.getAutoDefRealLevel=null),this.off("resourceReady",this.handleResourceReady),this.off("ABR_AUTO_DESC_CHANGE",this.handleABRDescChange),this.off(HD.HLS_ABR_ENGINE_RESOLVED,this.handleHlsQualityStateUpdate),this.off(HD.HLS_ABR_STATE_CHANGE,this.handleHlsQualityStateUpdate),this.off(HD.HLS_LEVELS_UPDATED,this.handleHlsQualityStateUpdate),this.off(HD.HLS_LEVEL_SWITCHED,this.handleHlsLevelSwitched)}};class rL extends(nL(BD)){constructor(e){const t=e.config.className;super(c(u({},e),{config:u(u({},e.config),t?{className:`${t} xgplayer-definition-plugin-pc`}:{}),clientType:"PC"})),this.onItemClick=function(e,t,i){var n=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return D(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),sD(e,t,{leading:n,maxWait:t,trailing:r})}(this.onItemClick.bind(this),1e3,{trailing:!0})}static get pluginName(){return"sdkDefinitionPlugin"}static get defaultConfig(){return{position:bs.POSITIONS.CONTROLS_RIGHT,index:WD,list:[],defaultDefinition:"",hidePortrait:!1,disable:!1,showToastOnManualClick:!0,className:"xgplayer-definition xgplayer-definition-plugin-pc",isShowIcon:!0,isNeedAuto:!0,allowedSize:null,alwaysShowDefinition:!1}}registerLanguageTexts(){return{switching:{jp:"に切り替える",en:"Switching to",zh:"正在切换至","zh-hk":"正在切換至"}}}afterCreate(){super.afterCreate()}refreshDefinitionList(){var e;(null==(e=this.player.config)?void 0:e.alwaysShowDefinition)&&(this.config.alwaysShowDefinition=!0);const{defaultDefinition:t,list:i}=this.getCurrentDefinitionInfo(this.player);this.config.defaultDefinition=t,this.config.list=i.map(((e,t)=>c(u({},e),{itemIndex:t})));const n=this.getQualityMenuItems();n.length>1||this.config.alwaysShowDefinition?(this.renderItemList(void 0,n),this.show()):(this.qualityRenderList=[],this.hide())}show(){!this.qualityRenderList||this.qualityRenderList.length<2&&!this.config.alwaysShowDefinition||Ur.addClass(this.root,"show")}afterPlayerInit(){}changeCurrentText(){var e,t,i;const n=(null==(e=this.qualityRenderList)?void 0:e.find((e=>e.selected)))||(null==(t=this.qualityRenderList)?void 0:t[this.curIndex])||(null==(i=this.qualityRenderList)?void 0:i[0]);if(!n)return void super.changeCurrentText();if(this.isIcons)return;const r=this.find(".icon-text");r&&(r.textContent=n.showText)}renderItemList(e,t=this.getQualityMenuItems()){if(Array.isArray(e))return;const{list:i,defaultDefinition:n}=this.config,r=i.map((t=>{var i;const r={url:t.url,definition:t.definition||"",definitionTextKey:t.definitionTextKey,showText:this.getShowText(this.i18n,t,t.definition),isCurrent:!1,selected:!1,isDefinitionAuto:!1},o="string"==typeof e?t.definition===e:void 0===e&&t.definition===n;if(!Ur.isUndefined(t.definition)&&o&&(r.isCurrent=!0,r.selected=!0),this.showRealDefinition(r)){const e=null==(i=this.renderList)?void 0:i.find((e=>this.playerData.isDefinitionMatch(null==e?void 0:e.definition,this._autoRealDefinition))),t=this.getShowText(this.i18n,e,null==e?void 0:e.definition);r.showText=t?`${r.showText}(${t})`:r.showText}return r.isDefinitionAuto=this.playerData.isAutoDefinition(t.definition),r}));this.renderList=r;let o=0;const s=t.some((e=>"definition"===e.source)),a=t.map(((e,t)=>{e.selected&&(o=t);const i="definition"===e.source?r.find((t=>this.playerData.isDefinitionMatch(t.definition,e.definition))):void 0;let n=e.label;if(s&&"abr-auto"===e.source&&this.showRealDefinition(c(u({},e),{definition:"auto"}))){const e=r.find((e=>this.playerData.isDefinitionMatch(e.definition,this._autoRealDefinition))),t=this.getShowText(this.i18n,e,null==e?void 0:e.definition);t&&(n=`${n}(${t})`)}return u(c(u({},e),{qualityItem:e,showText:n,isCurrent:e.selected,isDefinitionAuto:"abr-auto"===e.source}),(null==i?void 0:i.url)?{url:i.url}:{})}));this.qualityRenderList=a,super.renderItemList(a,o)}onItemClick(e,t){var i,n;const r=null==(n=null==(i=this.qualityRenderList)?void 0:i.find((e=>{var i;return e.id===(null==(i=null==t?void 0:t.to)?void 0:i.id)})))?void 0:n.qualityItem;r&&!r.selected&&(this.emitUserAction(e,"change_definition",{source:r.source,id:r.id,label:r.label}),this.selectQualityMenuItem(r))}selectDef(e){this.selectDefinition(e),"ontouchstart"in window&&this.optionsList.hide()}changeDefinition(e){const t=this.renderList.find((t=>this.playerData.isDefinitionMatch(t.definition,e)));t&&this.selectDef(t)}destroy(){super.destroy()}}function oL(e){const t={};for(const i of["lang","name"]){const n=e[i];void 0!==n&&(t[i]=n)}return t}function sL(e,t){if(!(t<0||t>=e.length))for(let i=0;i<e.length;i++)e[i].enabled=i===t}function aL(e,t){const i=e;if("function"==typeof i.setAudioOption)i.setAudioOption(oL(t));else{const{id:i,lang:n,name:r}=t,o=e.audioTracks.find((e=>e.id===i&&((void 0===n||e.lang===n)&&(void 0===r||e.name===r))));if(!o||e.audioTrack===o.id)return;e.audioTrack=o.id}}const lL={zh:"中文","zh-cn":"普通话","zh-hk":"粤語","zh-tw":"繁體中文","zh-sg":"普通话",en:"English",ja:"日本語",ko:"한국어",th:"ภาษาไทย",vi:"Tiếng Việt",id:"Bahasa Indonesia",ms:"Bahasa Melayu",fil:"Filipino",tl:"Filipino",my:"မြန်မာဘာသာ",km:"ភាសាខ្មែរ",lo:"ພາສາລາວ",hi:"हिन्दी",bn:"বাংলা",ta:"தமிழ்",te:"తెలుగు",mr:"मराठी",ur:"اردو",fr:"Français",de:"Deutsch",es:"Español","es-419":"Español (Latinoamérica)",it:"Italiano",pt:"Português","pt-br":"Português (Brasil)","pt-pt":"Português (Portugal)",nl:"Nederlands",sv:"Svenska",da:"Dansk",no:"Norsk",fi:"Suomi",ca:"Català",ru:"Русский",pl:"Polski",uk:"Українська",cs:"Čeština",sk:"Slovenčina",ro:"Română",hu:"Magyar",bg:"Български",hr:"Hrvatski",sr:"Српски",sl:"Slovenščina",el:"Ελληνικά",ar:"العربية",fa:"فارسی",he:"עברית",tr:"Türkçe",az:"Azərbaycan",kk:"Қазақша",mn:"Монгол",sw:"Kiswahili"};function uL(e){var t;return null!=(t=lL[e.toLowerCase()])?t:e.toUpperCase()}function cL(e,t){var i;const n=null!=(i=e.name)?i:"",r=e.lang?uL(e.lang):"";return[r||n||`Track ${e.id+1}`,!1!==(null==t?void 0:t.showNameSuffix)&&r&&n?`(${n})`:""].filter(Boolean).join(" ")}function hL(e,t,i){var n;const r=null!=(n=e.label)?n:"",o=e.language?uL(e.language):"";return[o||r||`Track ${t+1}`,!1!==(null==i?void 0:i.showNameSuffix)&&o&&r?`(${r})`:""].filter(Boolean).join(" ")}class dL extends BD{constructor(){super(...arguments),this._nativeMode=!1,this._nativeAddTrackHandler=null,this._nativeChangeHandler=null,this._nativeRemoveTrackHandler=null,this._nativeChangeRaf=null}static get pluginName(){return"AudioTrack"}static get defaultConfig(){return c(u({},BD.defaultConfig),{position:bs.POSITIONS.CONTROLS_RIGHT,index:GD,list:[],className:"xgplayer-audio-track",hidePortrait:!1,isShowIcon:!0,showNameSuffix:!0})}registerIcons(){return{}}afterPlayerInit(){var e;super.afterPlayerInit(),this.on("hlsAudioTracksUpdated",(e=>{this._onAudioTracksUpdated(e.audioTracks)})),this.on("hlsAudioTrackSwitched",(e=>{this._updateSelection(e.id)}));const t=this._getHls();(null==(e=null==t?void 0:t.audioTracks)?void 0:e.length)>1?this._onAudioTracksUpdated(t.audioTracks):t?this.hide():this._initNativeAudioTracks()}onItemClick(e,t){if(super.onItemClick(e,t),this._nativeMode){const e=this._getNativeTrackList();if(!e)return;sL(e,t.to.id)}else{const e=this._getHls();if(!e)return;aL(e,t.to)}}destroy(){var e;null!==this._nativeChangeRaf&&cancelAnimationFrame(this._nativeChangeRaf),this._unbindNativeAudioTracks(),null==(e=super.destroy)||e.call(this)}_getHls(){var e,t;const i=this.player.plugins;return(null==(e=null==i?void 0:i.encrypthlsplugin)?void 0:e.hls)||(null==(t=null==i?void 0:i.hls)?void 0:t.hls)}_getNativeTrackList(){var e,t;return null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks}_initNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeMode=!0,this._nativeAddTrackHandler=()=>this._onNativeTracksChanged(),this._nativeChangeHandler=()=>{null===this._nativeChangeRaf&&(this._nativeChangeRaf=requestAnimationFrame((()=>{this._nativeChangeRaf=null,this._onNativeTrackEnabled()})))},this._nativeRemoveTrackHandler=()=>this._onNativeTracksChanged(),e.addEventListener("addtrack",this._nativeAddTrackHandler),e.addEventListener("change",this._nativeChangeHandler),e.addEventListener("removetrack",this._nativeRemoveTrackHandler),e.length>1?this._onNativeTracksChanged():this.hide())}_unbindNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeAddTrackHandler&&e.removeEventListener("addtrack",this._nativeAddTrackHandler),this._nativeChangeHandler&&e.removeEventListener("change",this._nativeChangeHandler),this._nativeRemoveTrackHandler&&e.removeEventListener("removetrack",this._nativeRemoveTrackHandler))}_onNativeTracksChanged(){const e=this._getNativeTrackList();!e||e.length<=1?this.hide():(this._renderNativeTracks(e),this.show())}_onNativeTrackEnabled(){const e=this._getNativeTrackList();e&&this._renderNativeTracks(e)}_renderNativeTracks(e){const t={showNameSuffix:!1!==this.config.showNameSuffix},i=[];for(let r=0;r<e.length;r++){const n=e[r],o=hL(n,r,t);i.push({id:r,name:o,showText:o,iconText:o,selected:n.enabled,default:n.enabled})}const n=i.findIndex((e=>e.selected));this.config.list=i,super.renderItemList(i,n>-1?n:0)}_onAudioTracksUpdated(e){!e||e.length<=1?this.hide():(this._renderTracks(e),this.show())}_updateSelection(e){const t=this._getHls();t&&this._renderTracks(t.audioTracks,e)}_renderTracks(e,t){var i;const n=this._getHls(),r=null!=(i=null!=t?t:null==n?void 0:n.audioTrack)?i:-1,o={showNameSuffix:!1!==this.config.showNameSuffix},s=e.find((e=>e.default)),a=e.map((e=>c(u({},e),{showText:cL(e,o),iconText:cL(e,o),selected:e.id===r})));if(-1===r&&s){const e=a.findIndex((e=>e.id===s.id));e>-1&&(a[e].selected=!0)}const l=a.findIndex((e=>e.selected));this.config.list=a,super.renderItemList(a,l>-1?l:0)}}function pL(){return(new DOMParser).parseFromString('<svg width="19" height="16" viewBox="0 0 19 15" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_18_7532)" filter="url(#filter0_d_18_7532)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.33333 3.19115C9.33333 2.79702 8.91856 2.54067 8.56604 2.71694L4.66668 4.66662C4.66667 4.66662 4.66667 4.66663 4.66667 4.66663C4.66667 4.66664 4.66666 4.66665 4.66665 4.66665H3.19685C2.90404 4.66665 2.66666 4.90402 2.66666 5.19684V9.4698C2.66666 9.76261 2.90404 9.99998 3.19685 9.99998H4.55791C4.62971 9.99998 4.70076 10.0146 4.76676 10.0429L8.5943 11.6832C8.94415 11.8332 9.33333 11.5765 9.33333 11.1959V3.19115Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13 6.87773L14.8934 4.7138C14.9485 4.6509 15.0377 4.6509 15.0927 4.7138L15.2921 4.94158C15.3471 5.00448 15.3471 5.10646 15.2921 5.16936L13.3986 7.33329L15.2921 9.49722C15.3471 9.56012 15.3471 9.6621 15.2921 9.725L15.0927 9.95278C15.0377 10.0157 14.9485 10.0157 14.8934 9.95278L13 7.78886L11.1066 9.95278C11.0515 10.0157 10.9623 10.0157 10.9073 9.95278L10.7079 9.725C10.6529 9.6621 10.6529 9.56012 10.7079 9.49722L12.6014 7.33329L10.7079 5.16936C10.6529 5.10646 10.6529 5.00448 10.7079 4.94158L10.9073 4.7138C10.9623 4.6509 11.0515 4.6509 11.1066 4.7138L13 6.87773Z" fill="white" stroke="white" stroke-width="0.530187"/>\n </g>\n <defs>\n <filter id="filter0_d_18_7532" x="-0.666667" y="0" width="19.3333" height="19.3333" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n <feOffset dy="2.66667"/>\n <feGaussianBlur stdDeviation="1.33333"/>\n <feComposite in2="hardAlpha" operator="out"/>\n <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>\n <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_18_7532"/>\n <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_18_7532" result="shape"/>\n </filter>\n <clipPath id="clip0_18_7532">\n <rect width="14" height="14" fill="white" transform="translate(2)"/>\n </clipPath>\n </defs>\n</svg>\n\n',"image/svg+xml").firstChild}const{isWeixin:fL,os:gL,device:yL}=Kr,vL=gL.isAndroid,mL=gL.isIos,_L="mobile"===yL;let EL=0,TL=!1;class SL extends bs{constructor(e){super(e),this.state={mode:0,showUnmuteBt:!1},this.wxCanPlayFn=()=>{window.WeixinJSBridge&&window.WeixinJSBridge.invoke("getNetworkType",{},(()=>{this.wxTimer=setTimeout((()=>{this.wxTimer&&clearTimeout(this.wxTimer);const e=this.player.play();e&&e.then?e.then((()=>{aa.log("wechat autoplay success")})).catch((e=>{aa.warn("wechat autoplay fail:",e),this.state.showUnmuteBt=!1,this.renderUnmuteBt()})):aa.warn("wechat browser no play promise")}))}))},this.wxPlay=()=>{this.player.readyState>=2?this.wxCanPlayFn():vL?this.player.once(no,this.wxCanPlayFn):mL&&this.player.once(mo,this.wxCanPlayFn)},this.userClickPlay=()=>{if(TL)return;const e=this.player.play();e&&e.then?e.then((()=>{aa.log("user action autoplay success"),TL=!0})).catch((e=>{aa.warn("user action autoplay fail:",e)})):(aa.warn("no play promise"),TL=!0)},this.handleAutoplayPrevented=()=>0===this.state.mode?(aa.warn("unmute autoplay fail"),this.player.emit(FD.AUTOPLAY_FAILED,{mode:"unmute"}),vL&&fL?void(this.state.mode=2):void(this.config.enableDegradeMuteAutoplay&&this.changeMuteMode())):1===this.state.mode?(aa.warn("mute autoplay fail"),this.player.emit(FD.AUTOPLAY_FAILED,{mode:"mute"}),void(this.state.mode=2)):2===this.state.mode?(this.player.emit(FD.AUTOPLAY_FAILED,{mode:"noSupport"}),void aa.warn("not support autoplay")):void 0,this.handleAutoplayStart=()=>{if(0!==this.state.mode)return 1===this.state.mode?(this.player.emit(FD.AUTOPLAY_SUCCESS,{mode:"mute"}),this.state.showUnmuteBt=!0,void this.renderUnmuteBt()):2===this.state.mode?(this.player.emit(FD.AUTOPLAY_SUCCESS,{mode:"click"}),this.player.muted=!1,this.state.showUnmuteBt=!1,void this.renderUnmuteBt()):void 0;this.player.emit(FD.AUTOPLAY_SUCCESS,{mode:"unmute"})},this.handleVolumechange=()=>{this.state.showUnmuteBt&&(this.state.showUnmuteBt=!1,this.renderUnmuteBt(),this.player.paused&&this.player.readyState>=1&&this.player.play())},this.cancelUnmute=e=>{const t=Date.now();t-EL>200&&(EL=t,this.player.muted=!1,this.state.showUnmuteBt=!1,this.renderUnmuteBt(),this.emitUserAction(e,"cancel_mute"))}}static get pluginName(){return"AutoplayPlugin"}static get defaultConfig(){return{position:bs.POSITIONS.ROOT,enableDegradeMuteAutoplay:!1,enableWxJsBridgeAutoplay:!1,userActionDom:window.document.body,enableUserActionAutoplay:!1,showUnmuteBtn:!0}}afterCreate(){this.initState(),this.initEvents(),this.setWXAutoPlay()}registerLanguageTexts(){return{unmute:{jp:"ミュートを解除する",en:"Click to unmute",zh:"点击取消静音","zh-hk":"點擊取消靜音"},muted:{jp:"ミュート",en:"muted",zh:"已静音","zh-hk":"已靜音"}}}registerIcons(){return{muted:{icon:pL,class:"xgplayer-muted-svg"}}}updateLang(){this.renderUnmuteBt()}initState(){const{enableDegradeMuteAutoplay:e,enableWxJsBridgeAutoplay:t,enableUserActionAutoplay:i}=this.player.config;e&&(this.config.enableDegradeMuteAutoplay=!0),t&&(this.config.enableWxJsBridgeAutoplay=!0),i&&(this.config.enableUserActionAutoplay=!0),this.state.mode=this.player.muted?1:0}initEvents(){this.player.on(vo,this.handleAutoplayPrevented),this.player.on(yo,this.handleAutoplayStart),this.player.on(oo,this.handleVolumechange),this.setUserActionAutoPlay()}setWXAutoPlay(){fL&&this.player.config.autoplay&&this.config.enableWxJsBridgeAutoplay&&(window.WeixinJSBridge?this.wxPlay():document.addEventListener("WeixinJSBridgeReady",this.wxPlay,!1))}setUserActionAutoPlay(){var e;(null==(e=this.config)?void 0:e.enableUserActionAutoplay)&&this.player.once(FD.AUTOPLAY_FAILED,(()=>{this.hasSetUserAutoplay=!0;(this.config.userActionDom instanceof window.Node?this.config.userActionDom:window.document.body).addEventListener("click",this.userClickPlay,!1)}))}changeMuteMode(){this.player.muted=!0,this.state.showUnmuteBt=!0,this.state.mode=1,this.renderUnmuteBt(),this.timer=setTimeout((()=>{this.timer&&clearTimeout(this.timer);const e=this.player.play();e&&e.then?e.then((()=>{aa.log("degrade mute autoplay success")})).catch((e=>{aa.warn("degrade mute autoplay fail:",e),this.player.muted=!1,this.state.showUnmuteBt=!1,this.renderUnmuteBt()})):aa.warn("no play promise")}))}renderUnmuteBt(){var e,t,i;const n=this.root;if(n&&(n.innerHTML="",this.state.showUnmuteBt&&this.config.showUnmuteBtn)){const r=this.langText.unmute||(null==(i=null==(t=null==(e=this.registerLanguageTexts)?void 0:e.call(this))?void 0:t.unmute)?void 0:i.en),o=Ur.createDom("div",r,void 0,"xgplayer-unmute-bt");n.appendChild(o),this.bind(".xgplayer-unmute-bt","click",this.cancelUnmute),this.bind(".xgplayer-unmute-bt","touchend",this.cancelUnmute)}}destroy(){if(this.player.off(vo,this.handleAutoplayPrevented),this.player.off(yo,this.handleAutoplayStart),this.player.off(oo,this.handleVolumechange),this.timer&&window.clearTimeout(this.timer),this.wxTimer&&window.clearTimeout(this.wxTimer),document.removeEventListener("WeixinJSBridgeReady",this.wxPlay,!1),this.hasSetUserAutoplay){const e=_L?"touch":"click";(this.config.userActionDom instanceof window.Node?this.config.userActionDom:window.document.body).removeEventListener(e,this.userClickPlay,!1)}}render(){return'<div class="xgplayer-unmute"></div>'}}const bL=void 0;function kL(){return(new DOMParser).parseFromString('<svg width="18" height="18" viewBox="0 0 23 22" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M5.75 11C5.75 11.9665 4.9665 12.75 4 12.75C3.0335 12.75 2.25 11.9665 2.25 11C2.25 10.0335 3.0335 9.25 4 9.25C4.9665 9.25 5.75 10.0335 5.75 11ZM13.25 11C13.25 11.9665 12.4665 12.75 11.5 12.75C10.5335 12.75 9.75 11.9665 9.75 11C9.75 10.0335 10.5335 9.25 11.5 9.25C12.4665 9.25 13.25 10.0335 13.25 11ZM19 12.75C19.9665 12.75 20.75 11.9665 20.75 11C20.75 10.0335 19.9665 9.25 19 9.25C18.0335 9.25 17.25 10.0335 17.25 11C17.25 11.9665 18.0335 12.75 19 12.75Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}class CL extends bs{constructor(e){super(e),this.panel=null,this.panelContainer=null}static get pluginName(){return"MoreButtonPlugin"}static get defaultConfig(){return{position:bs.POSITIONS.ROOT_TOP,iconPlugins:[],maxShowNum:2}}beforePlayerInit(){}afterPlayerInit(){}afterCreate(){this.renderMoreIcon()}updateLang(e){if(!this.panelContainer)return;const t=this.panelContainer.querySelectorAll(".panel-icon-bt-text"),i=this.getAndSplitList().extraList;t.forEach((t=>{var n,r;const o=Number(t.getAttribute("plugin-index"));(null==(r=null==(n=i[o])?void 0:n.textTips)?void 0:r[e])&&(t.innerHTML=i[o].textTips[e])}))}registerIcons(){return{more:{icon:kL,class:"xgplayer-more-svg"}}}getAndSplitList(){var e;let t,i;const n=(null!=(e=this.player.config.ignores)?e:[]).map((e=>e.toLowerCase())),r=this.config.iconPlugins.filter((e=>!n.includes(e.pluginName.toLowerCase())));return r.length>this.config.maxShowNum+1?(t=r.slice(0,this.config.maxShowNum),i=r.slice(-(r.length-this.config.maxShowNum))):t=[...r],{list:null!=t?t:[],extraList:null!=i?i:[]}}children(){const e=this.getAndSplitList().list,t={};return e.forEach((e=>{t[e.pluginName]={plugin:e,options:{root:this.root}}})),t}renderMoreIcon(){const e=this.getAndSplitList().extraList;if(0===e.length)return;const t=this.root,i=Ur.createDom("div","",{},"xgplayer-icon");i.appendChild(this.icons.more),i.addEventListener("click",(()=>{this.renderPanel(e)}));const n=Ur.createDom("xg-icon","",{"data-index":0},"xgplayer-more");n.appendChild(i),t.appendChild(n)}renderPanel(e){this.panelContainer||(this.panelContainer=Ur.createDom("div","",{},"panel-content"),e.forEach(((e,t)=>{var i,n;const r=Ur.createDom("div","",{},"panel-icon-bt"),o=Ur.createDom("div","",{},"panel-icon-svg");r.appendChild(o),this.registerExtraPlugin(e,o);const s="zh-cn"===this.player.lang?"zh":this.player.lang,a=null!=(n=null==(i=e.textTips)?void 0:i[s])?n:e.pluginName;r.appendChild(Ur.createDom("span",a,{"plugin-index":t},"panel-icon-bt-text")),this.panelContainer.appendChild(r)}))),this.player.panel.showPanel(this.panelContainer)}registerExtraPlugin(e,t){this.player.registerPlugin({plugin:e,options:{root:t}})}destroy(){}render(){return'<div class="xgplayer-rightTop-iconList"></div>'}}function IL(){return(new DOMParser).parseFromString('<svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M68 40C68 55.464 55.464 68 40 68C24.536 68 12 55.464 12 40C12 24.536 24.536 12 40 12C55.464 12 68 24.536 68 40ZM34.75 34.05C34.75 35.7897 33.5747 37.2 32.125 37.2C30.6753 37.2 29.5 35.7897 29.5 34.05C29.5 32.3103 30.6753 30.9 32.125 30.9C33.5747 30.9 34.75 32.3103 34.75 34.05ZM40.2276 43.7334C36.2145 43.7334 32.6052 45.4732 30.1709 48.2331C29.5316 48.9579 29.6009 50.0638 30.3258 50.7031C31.0506 51.3424 32.1565 51.2731 32.7958 50.5483C34.5802 48.5252 37.2407 47.2334 40.2276 47.2334C43.2213 47.2334 45.8871 48.531 47.6715 50.562C48.3094 51.288 49.4152 51.3594 50.1412 50.7215C50.8673 50.0836 50.9387 48.9778 50.3008 48.2518C47.8663 45.481 44.2498 43.7334 40.2276 43.7334ZM47.8352 37.2C49.2849 37.2 50.4602 35.7897 50.4602 34.05C50.4602 32.3103 49.2849 30.9 47.8352 30.9C46.3854 30.9 45.2102 32.3103 45.2102 34.05C45.2102 35.7897 46.3854 37.2 47.8352 37.2Z" fill="#ffffff" fill-opacity="0.15"/>\n</svg>\n',"image/svg+xml").firstChild}var AL=(e=>(e.NETWORK="NETWORK",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_FORBIDDEN="NETWORK_FORBIDDEN",e.NETWORK_NOTFOUND="NETWORK_NOTFOUND",e.NETWORK_RANGE_NOT_SATISFIABLE="NETWORK_RANGE_NOT_SATISFIABLE",e.NETWORK_PROTOCOL="NETWORK_PROTOCOL",e.NETWORK_URL_EXPIRE="NETWORK_URL_EXPIRE",e.NETWORK_URL_SIGN="NETWORK_URL_SIGN",e.NETWORK_ENCRYPT_HLS_ERR="NETWORK_ENCRYPT_HLS_ERR",e.MEDIA_ERR="MEDIA_ERR",e.MEDIA_ERR_ABORTED="MEDIA_ERR_ABORTED",e.MEDIA_ERR_NETWORK="MEDIA_ERR_NETWORK",e.MEDIA_ERR_DECODE="MEDIA_ERR_DECODE",e.MEDIA_ERR_SRC_NOT_SUPPORTED="MEDIA_ERR_SRC_NOT_SUPPORTED",e.MEDIA_ERR_NOT_SUPPORTED="MEDIA_ERR_NOT_SUPPORTED",e.MEDIA_ERR_URL_EMPTY="MEDIA_ERR_URL_EMPTY",e.MEDIA_ERR_FILE_NOT_SUPPORTED="MEDIA_ERR_FILE_NOT_SUPPORTED",e.MEDIA_ERR_PLAY_ERR="MEDIA_ERR_PLAY_ERR",e.MEDIA_SOURCE_CANNOT_PLAY_TYPE="MEDIA_SOURCE_CANNOT_PLAY_TYPE",e.BUSINESS_DRM_NOT_SUPPORT="BUSINESS_DRM_NOT_SUPPORT",e.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD="BUSINESS_DRM_NOT_SUPPORT_UN_RECORD",e.BUSINESS_DRM_LACK_MEDIA_KEY="BUSINESS_DRM_LACK_MEDIA_KEY",e.BUSINESS_DRM_LACK_KEY_SESSION="BUSINESS_DRM_LACK_KEY_SESSION",e.BUSINESS_DRM_GENERATE_REQUEST_FAIL="BUSINESS_DRM_GENERATE_REQUEST_FAIL",e.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH="BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH",e.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH="BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH",e.BUSINESS_DRM_LICENSE_FAIL="BUSINESS_DRM_LICENSE_FAIL",e.BUSINESS_DRM_KEY_ERROR="BUSINESS_DRM_KEY_ERROR",e.BUSINESS_DRM_CERT_FAIL="BUSINESS_DRM_CERT_FAIL",e.PRIVATE_DRM_KEY_GET_FAILED="PRIVATE_DRM_KEY_GET_FAILED",e.PRIVATE_DRM_CRYPTO_NOT_SUPPORT="PRIVATE_DRM_CRYPTO_NOT_SUPPORT",e.PRIVATE_DRM_RSA_FAIL="PRIVATE_DRM_RSA_FAIL",e.OTHER="OTHER",e.VOD_LOG_NOT_CONFIGURED="VOD_LOG_NOT_CONFIGURED",e.PLAY_AUTH_TOKEN_EXPIRED="PLAY_AUTH_TOKEN_EXPIRED",e.HLS_KEY_TOKEN_EXPIRED="HLS_KEY_TOKEN_EXPIRED",e.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED="THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED",e.GET_PLAY_INFO_ERR="GET_PLAY_INFO_ERR",e.GET_HLS_DECRYPTION_KEY_ERR="GET_HLS_DECRYPTION_KEY_ERR",e.LICENSE_VALIDATE_FAIL="LICENSE_VALIDATE_FAIL",e.DEFINITION_AUTO="DEFINITION_AUTO",e.LICENSE_STATUS_INVALID="LICENSE_STATUS_INVALID",e.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH="LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH",e.BASE_LICENSE_NOT_SUPPORT_265="BASE_LICENSE_NOT_SUPPORT_265",e.BASE_LICENSE_NOT_SUPPORT_ABR="BASE_LICENSE_NOT_SUPPORT_ABR",e.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER="BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER",e.BASE_LICENSE_NOT_SUPPORT_PRELOAD="BASE_LICENSE_NOT_SUPPORT_PRELOAD",e.EXPIRED_LICENSE_NOT_SUPPORT_265="EXPIRED_LICENSE_NOT_SUPPORT_265",e.EXPIRED_LICENSE_NOT_SUPPORT_ABR="EXPIRED_LICENSE_NOT_SUPPORT_ABR",e.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER="EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER",e.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD="EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD",e.DRAMA_INVALID_PARAM="DRAMA_INVALID_PARAM",e.DRAMA_NO_INFO_FOUND="DRAMA_NO_INFO_FOUND",e.DRAMA_NOT_SUBMITTED="DRAMA_NOT_SUBMITTED",e.DRAMA_UNDER_REVIEW="DRAMA_UNDER_REVIEW",e.DRAMA_FAILED_REVIEW="DRAMA_FAILED_REVIEW",e.DRAMA_WITHDRAWN_REVIEW="DRAMA_WITHDRAWN_REVIEW",e.DRAMA_FAILED_TO_QUERY="DRAMA_FAILED_TO_QUERY",e.DRAMA_INVALID_TTOP_TOKEN="DRAMA_INVALID_TTOP_TOKEN",e.DRAMA_NOT_ON_SHELF="DRAMA_NOT_ON_SHELF",e.DRAMA_FAILED_GET_EPISODE_INFO="DRAMA_FAILED_GET_EPISODE_INFO",e))(AL||{});const PL={NETWORK:{code:2100,message:"Network error",textKey:AL.NETWORK},NETWORK_TIMEOUT:{code:2101,message:"Network timeout",textKey:AL.NETWORK_TIMEOUT},NETWORK_FORBIDDEN:{code:2103,message:"Block access to this media",textKey:AL.NETWORK_FORBIDDEN},NETWORK_NOTFOUND:{code:2104,message:"Media not found",textKey:AL.NETWORK_NOTFOUND},NETWORK_RANGE_NOT_SATISFIABLE:{code:2116,message:"Media fetch range not satisfiable",textKey:AL.NETWORK_RANGE_NOT_SATISFIABLE},NETWORK_PROTOCOL:{code:2190,message:"The current page protocol is https, but video url protocol is http",textKey:AL.NETWORK_PROTOCOL},NETWORK_URL_EXPIRE:{code:2191,message:"Media url has expired",textKey:AL.NETWORK_URL_EXPIRE},NETWORK_URL_SIGN:{code:2192,message:"Media url signature parameter error",textKey:AL.NETWORK_URL_SIGN},NETWORK_ENCRYPT_HLS_ERR:{code:2193,message:"Get m3u8 file or encrypt key fail",textKey:AL.NETWORK_ENCRYPT_HLS_ERR},MEDIA_ERR_ABORTED:{code:5101,message:"User or browser abort the media",textKey:AL.NETWORK_URL_SIGN},MEDIA_ERR_NETWORK:{code:5102,message:"Network error",textKey:AL.MEDIA_ERR_NETWORK},MEDIA_ERR_DECODE:{code:5103,message:"Media decode error",textKey:AL.MEDIA_ERR_DECODE},MEDIA_ERR_SRC_NOT_SUPPORTED:{code:5104,message:"Media is not supported or url is not available",textKey:AL.MEDIA_ERR_SRC_NOT_SUPPORTED},MEDIA_ERR_NOT_SUPPORTED:{code:5105,message:"Media not support play",textKey:AL.MEDIA_ERR_NOT_SUPPORTED},MEDIA_ERR_URL_EMPTY:{code:5106,message:"Media url empty",textKey:AL.MEDIA_ERR_URL_EMPTY},MEDIA_ERR_FILE_NOT_SUPPORTED:{code:5901,message:"Media file not supported",textKey:AL.MEDIA_ERR_FILE_NOT_SUPPORTED},MEDIA_ERR_PLAY_ERR:{code:5902,message:"Media play error",textKey:AL.MEDIA_ERR_PLAY_ERR},BUSINESS_DRM_NOT_SUPPORT:{code:7101,message:"DRM encrypted playback is not supported",textKey:AL.BUSINESS_DRM_NOT_SUPPORT},BUSINESS_DRM_NOT_SUPPORT_UN_RECORD:{code:7102,message:"Anti-screen recording is not supported",textKey:AL.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD},BUSINESS_DRM_LACK_MEDIA_KEY:{code:7103,message:"The video data lacks the corresponding MediaKey",textKey:AL.BUSINESS_DRM_LACK_MEDIA_KEY},BUSINESS_DRM_LACK_KEY_SESSION:{code:7104,message:"The browser does not support the corresponding DRM KeySession",textKey:AL.BUSINESS_DRM_LACK_KEY_SESSION},BUSINESS_DRM_GENERATE_REQUEST_FAIL:{code:7105,message:"Decryption playback error",textKey:AL.BUSINESS_DRM_GENERATE_REQUEST_FAIL},BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH:{code:7106,message:"Missing DRM certificate request link",textKey:AL.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH},BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH:{code:7107,message:"Missing DRM License request link",textKey:AL.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH},BUSINESS_DRM_LICENSE_FAIL:{code:7108,message:"Failed to request or update a license",textKey:AL.BUSINESS_DRM_LICENSE_FAIL},BUSINESS_DRM_KEY_ERROR:{code:7109,message:"Decryption Error",textKey:AL.BUSINESS_DRM_KEY_ERROR},BUSINESS_DRM_CERT_FAIL:{code:7110,message:"Failed to request DRM certificate",textKey:AL.BUSINESS_DRM_CERT_FAIL},PRIVATE_DRM_GET_KEY_FAILED:{code:7200,message:"Private DRM key get failed",textKey:AL.PRIVATE_DRM_KEY_GET_FAILED},PRIVATE_DRM_CRYPTO_NOT_SUPPORT:{code:7201,message:"Web cryptography API is not supported",textKey:AL.PRIVATE_DRM_CRYPTO_NOT_SUPPORT},PRIVATE_DRM_RSA_FAIL:{code:7202,message:"Decryption by RSA-OAEP failed",textKey:AL.PRIVATE_DRM_RSA_FAIL},OTHER:{code:8e3,message:"Other error",textKey:AL.OTHER},VOD_LOG_NOT_CONFIGURED:{code:8999,message:"Log options not configured correctly",textKey:AL.VOD_LOG_NOT_CONFIGURED},PLAY_AUTH_TOKEN_EXPIRED:{code:10001,message:"playAuthToken has expired",textKey:AL.PLAY_AUTH_TOKEN_EXPIRED},HLS_KEY_TOKEN_EXPIRED:{code:10003,message:"keyToken has expired",textKey:AL.HLS_KEY_TOKEN_EXPIRED},THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED:{code:10003,message:"thirdPartyDrmAuthToken has expired",textKey:AL.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED},GET_PLAY_INFO_ERR:{code:11001,message:"Failed to get play info",textKey:AL.GET_PLAY_INFO_ERR},GET_HLS_DECRYPTION_KEY_ERR:{code:11002,message:"Failed to get the HLS decryption key",textKey:AL.GET_HLS_DECRYPTION_KEY_ERR},LICENSE_STATUS_INVALID:{code:12001,message:"License validation is invalid",textKey:AL.LICENSE_STATUS_INVALID},LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH:{code:12002,message:"License domain name does not match",textKey:AL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH}},wL={BASE_LICENSE_NOT_SUPPORT_265:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12111,message:"The basic license does not support H265",textKey:AL.BASE_LICENSE_NOT_SUPPORT_265},BASE_LICENSE_NOT_SUPPORT_ABR:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12112,message:"The basic license does not support ABR",textKey:AL.BASE_LICENSE_NOT_SUPPORT_ABR},BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12113,message:"The basic license does not support dynamic buffer",textKey:AL.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER},BASE_LICENSE_NOT_SUPPORT_PRELOAD:{type:"ERROR_LICENSE_EDITION_NEED_UPLOAD",code:12114,message:"The basic license does not support preload",textKey:AL.BASE_LICENSE_NOT_SUPPORT_PRELOAD},EXPIRED_LICENSE_NOT_SUPPORT_265:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12211,message:"Expired license does not support H265",textKey:AL.EXPIRED_LICENSE_NOT_SUPPORT_265},EXPIRED_LICENSE_NOT_SUPPORT_ABR:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12212,message:"Expired license does not support ABR",textKey:AL.EXPIRED_LICENSE_NOT_SUPPORT_ABR},EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12213,message:"The expired license does not support dynamic buffer",textKey:AL.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER},EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD:{type:"ERROR_LICENSE_HAS_EXPIRED",code:12214,message:"Expired license does not support preloading",textKey:AL.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD}};var DL=(e=>(e[e.manifest=1]="manifest",e[e.network=2]="network",e[e.demux=3]="demux",e[e.remux=4]="remux",e[e.media=5]="media",e[e.decoder=6]="decoder",e[e.drm=7]="drm",e[e.other=8]="other",e[e.runtime=9]="runtime",e[e.token=10]="token",e[e.serve=11]="serve",e[e.license=12]="license",e[e.ad=13]="ad",e))(DL||{});const LL={INVALID_PARAM:{code:9301,message:"Invalid parameter in short drama environment",textKey:AL.DRAMA_INVALID_PARAM},NO_INFO_FOUND:{code:9302,message:"No information found for this Episode",textKey:AL.DRAMA_NO_INFO_FOUND},NOT_SUBMITTED:{code:9303,message:"Episode not submitted for review",textKey:AL.DRAMA_NOT_SUBMITTED},UNDER_REVIEW:{code:9304,message:"Episode under for review",textKey:AL.DRAMA_UNDER_REVIEW},FAILED_REVIEW:{code:9305,message:"Episode failed review",textKey:AL.DRAMA_FAILED_REVIEW},WITHDRAWN_REVIEW:{code:9306,message:"Episode withdrawn from review",textKey:AL.DRAMA_WITHDRAWN_REVIEW},FAILED_TO_QUERY:{code:9307,message:"Failed to query video playback information",textKey:AL.DRAMA_FAILED_TO_QUERY},INVALID_TTOP_TOKEN:{code:9308,message:"Invalid playAuthToken or failed to verify TTOP token",textKey:AL.DRAMA_INVALID_TTOP_TOKEN},NOT_ON_SHELF:{code:9310,message:"Video is not on shelf",textKey:AL.DRAMA_NOT_ON_SHELF},FAILED_GET_EPISODE_INFO:{code:9399,message:"Failed get episode info",textKey:AL.DRAMA_FAILED_GET_EPISODE_INFO}};const RL={SUCCESS:0,NOT_SUBMITTED:1,UNDER_REVIEW:2,FAILED_REVIEW:3,WITHDRAWN:4,NOT_ON_SHELF:5},xL=1002305;class OL{constructor(){this.actions={}}addMiddleware(e,t){this.actions[e]?this.actions[e].push(t):this.actions[e]=[t]}removeMiddleware(e,t){const i=this.actions[e]||[],n=i.findIndex((e=>e===t));n>-1&&(i.splice(n,1),this.actions[e]=i)}removeAllMiddlewareByKey(e){this.actions[e]=[]}removeAllMiddleware(){this.actions={}}applyMiddleware(e){const t=this;return function(i,n){return d(this,null,(function*(){const{eventName:r}=i,o=t.actions[e]||[],s=[];o.forEach((e=>{try{const t=e(i);s.push(Ka(t))}catch(t){throw s.push(Ka(null)),t}})),Promise.all([...s]).then((e=>{e.every((e=>!e))&&n(r,i)})).catch((e=>{aa.error(e),n(r,e)}))}))}}}const NL="xgplayer-error-analysing",ML="xgplayer-error-retrying",UL="ve_error",BL={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},HL={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},FL="http:",jL="https:";let VL=null;function KL(e){var t;const i=null==(t=null==window?void 0:window.location)?void 0:t.protocol;if(e.startsWith(FL)&&i===jL){if(new URL(e).protocol===FL)return GL.getVeErrorInfo(PL.NETWORK_PROTOCOL)}}class GL{constructor(e,t){this.retryTimestamps=[],this.totalRetryCount=0,this.retrying=!1,this.retryTimer=null,this.userInvokedPlay=!1,this._playIntentHook=()=>{this.userInvokedPlay=!0},this._onError=e=>d(this,null,(function*(){var t;this.player.addClass(NL);const i=yield this.transformToVeError(e);this.player.veError=i,aa.error("error: ",i),this.player.removeClass(NL),(null==(t=this.config.ignoreErrorCodes)?void 0:t.includes(null==i?void 0:i.veErrorCode))?aa.log("ignore errorCode",null==i?void 0:i.veErrorCode):this.player.emit(UL,i)})),this.player=e,this.config={},t&&Object.keys(GL.defaultConfig).forEach((e=>{void 0===t[e]?this.config[e]=GL.defaultConfig[e]:this.config[e]=t[e]})),this.init()}static get defaultConfig(){return{oriErrRetryCount:3,oriErrRetryCycle:1e4,oriErrRetryBaseDelay:500,oriErrMaxTotalRetry:0,enableOriErrRetry:!0,needSyncAnalyzeError:!0,analyzeTimeout:3e3,ignoreErrorCodes:[],clientKey:void 0}}createVeError(e={}){var t,i;const{errorType:n,errorCode:r=0,errorMessage:o="",originError:s="",ext:a={},mediaError:l=null}=e,h=(null==(i=null==(t=this.player)?void 0:t.i18n)?void 0:i.ERROR_TYPES)||{},d=this.player.media;if(d){const t=l||d.error||{},{duration:i,currentTime:h,ended:p,src:f,currentSrc:g}=this.player,{readyState:y,networkState:v}=d;let m=r||t.code;BL[m]&&(m=BL[m]);const{code:_,message:E,textKey:T}=e.veError||{},S=o||t.message,b=_||m,k=GL.getErrorType(e),C=E||S,I=T||(e=>{for(const[t,{code:i,textKey:n}]of Object.entries(PL))if(i===e)return n})(b)||function(e){for(const t of Object.values(LL))if(t.code===e)return t.textKey}(b),A=this.player.i18n[I]||C||this.player.i18n[AL.MEDIA_ERR]||"unknown error",P=this.player.config,w=this.config.clientKey?{clientKey:this.config.clientKey}:{},D=this.config.clientKey?{albumId:P.albumId||P.album_id,episodeId:P.episodeId||P.episode_id||P.episodeID}:{};return c(u({playerVersion:"1.19.0-rc.1",currentTime:h,duration:i,ended:p,readyState:y,networkState:v,src:f||g,errorType:n,errorCode:m,httpCode:e.httpCode,message:S,mediaError:t,originError:s?s.stack:"",host:Ur.getHostFromUrl(f||g),veErrorCode:b,veErrorType:k,veErrorMessage:C,displayMessage:A},w),{videoInfo:u({isMSE:Ra(this.player),vtype:this.player.url?this.player.vtype:"",drmEncryptType:rl(this.player)||"",vid:P.vid},D),ext:a})}if(arguments.length>1){const e={playerVersion:"1.19.0-rc.1",domain:document.domain,ex:null},t=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"];for(let i=0;i<arguments.length;i++)e[t[i]]=arguments[i];return e.ex=h?(h[arguments[0]]||{}).msg:"",e}}static getErrorType(e){const{veError:t,mediaError:i}=e||{},n=t||(null==i?void 0:i.veError);if(null==n?void 0:n.code){const e=n.code+"";return n.code>=1e4?DL[e.slice(0,2)]:DL[e.slice(0,1)]}if(null==i?void 0:i.code)return HL[i.code]||"other"}static getVeErrorInfo(e,t){const{code:i,message:n,textKey:r}=e;return{code:i,message:t||n,textKey:r}}init(){var e,t;VL||(VL=this.player.errorHandler),function(e,t){for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&"function"==typeof t[i]&&Object.defineProperty(e,i,{configurable:!0,value:t[i]})}(this.player,(e=this.player,t=this,{errorHandler(i,n){var r;aa.log("errorHandler, err: ",n);const o=e;if(o.media&&(o.media.error||n)){let e=o.media.error||n;const s=e.code?Wr[e.code]:"other";let a=e.message;"xg-video"===(null==(r=null==o?void 0:o.config)?void 0:r.mediaType)||o.media.currentSrc||o.media.srcObject||(a="empty_src",e={code:6,message:a}),o.emit(i,t.createVeError({errorType:s,errorCode:e.code,errorMessage:e.message||"",mediaError:e,veError:n.veError,originError:n}))}}})),this.setErrorEventMiddleWare(),this.player.on(Zr,this._onError),this.player.useHooks("play",this._playIntentHook)}destroy(){this.player.off(Zr,this._onError),this.player.removeHooks("play",this._playIntentHook),this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null,this.retrying=!1,this.player.removeClass(ML))}shouldOriRetryReloadOnly(){var e;if(this.userInvokedPlay)return!1;const t=this.player.config;if(!t||t.autoplay||t.autoplayMuted)return!1;const i=this.player.media;return!!i&&0===(null==(e=i.played)?void 0:e.length)}setErrorEventMiddleWare(){this.eventMiddleware=new OL,this.eventMiddleware.addMiddleware(Zr,this.defaultErrorMiddleWare.bind(this)),this.player.setEventsMiddleware({error:this.eventMiddleware.applyMiddleware(Zr)})}defaultErrorMiddleWare(e){return d(this,null,(function*(){var t,i;if(!Ur.isMSE(this.player.media)){const{error:n}=e||{};if(!n)return aa.error("invalid media error: ",e),!1;const{code:r}=n||{};if((2===r||3===r||4===r)&&(null==(i=null==(t=this.player)?void 0:t.config)?void 0:i.url)){const t=Date.now();this.retryTimestamps=this.retryTimestamps.filter((e=>t-e<=this.config.oriErrRetryCycle));const{oriErrRetryCount:i,oriErrMaxTotalRetry:n}=this.config,o=n>0&&this.totalRetryCount>=n,s=this.retryTimestamps.length>=i,a=!1!==this.config.enableOriErrRetry;if(a&&!o&&!s)return this.oriVideoRetry(!this.shouldOriRetryReloadOnly());if(a&&(o?aa.warn(`max total retry count ${n} reached, stop retrying`):aa.warn(`retry count in window ${this.config.oriErrRetryCycle}ms reached ${i}, stop retrying`)),3===r)this.config.needSyncAnalyzeError&&(yield this.analyseStream());else{const t=il(ol(this.player));if(t){const i=KL(t);if(i)return e.error.veError=i,!1;this.config.needSyncAnalyzeError&&(e.error.veError=yield this.analyseNet(t,e.error,this.config.analyzeTimeout))}}}}return!1}))}oriVideoRetry(e=!0){if(this.retrying)return!0;this.retrying=!0;const t=this.config.oriErrRetryBaseDelay*Math.pow(2,this.retryTimestamps.length);return aa.warn(`origin video play error, retry in ${t}ms (window: ${this.retryTimestamps.length+1}/${this.config.oriErrRetryCount}, total: ${this.totalRetryCount+1})`),this.player.addClass(ML),clearTimeout(this.retryTimer),this.retryTimer=setTimeout((()=>{this.retryTimestamps.push(Date.now()),this.totalRetryCount++,e?this.player.retry():this.oriVideoReloadWithoutPlay(),this.player.removeClass(ML),this.retrying=!1}),t),!0}oriVideoReloadWithoutPlay(){const e=this.player;e.removeClass("xgplayer-is-error"),e.addClass("xgplayer-isloading"),e.runHooks("retry",(()=>{const t=e.currentTime,i="string"==typeof e.config.url?e.config.url:"",n=Ur.isMSE(e.media)?{url:i}:e.preProcessUrl(i);e.src=n.url,e.config.isLive||(e.currentTime=t)}))}analyseNet(e,t,i){return d(this,null,(function*(){const n=t.code||t.errorCode,r=t.message||t.errorMessage||t.msg;try{const t=yield La(e,{range:"0-8",timeout:i});aa.log("xhr result",t);const{status:o,response:s}=t;if(403===o){if("string"==typeof s){if(s.includes("expire"))return GL.getVeErrorInfo(PL.NETWORK_URL_EXPIRE);if(s.includes("sign"))return GL.getVeErrorInfo(PL.NETWORK_URL_SIGN)}return GL.getVeErrorInfo(PL.NETWORK_FORBIDDEN)}if(416===o)return GL.getVeErrorInfo(PL.NETWORK_RANGE_NOT_SATISFIABLE);if(404===o)return GL.getVeErrorInfo(PL.NETWORK_NOTFOUND);if(o===Da.TIMEOUT)return GL.getVeErrorInfo(PL.NETWORK_TIMEOUT);if(o===Da.ERROR)return GL.getVeErrorInfo(PL.NETWORK,r);if(200===o||206===o){if(4===n)return r?GL.getVeErrorInfo(PL.MEDIA_ERR_PLAY_ERR,r):GL.getVeErrorInfo(PL.MEDIA_ERR_FILE_NOT_SUPPORTED);if(3===n)return GL.getVeErrorInfo(PL.MEDIA_ERR_DECODE,r);if(2===n)return GL.getVeErrorInfo(PL.MEDIA_ERR_NETWORK,r);if(1===n)return GL.getVeErrorInfo(PL.MEDIA_ERR_ABORTED,r);if(-9996===n){return rl(this.player)===or.PRIVATE_ENCRYPT_UPGRADE?GL.getVeErrorInfo(PL.PRIVATE_DRM_GET_KEY_FAILED):GL.getVeErrorInfo(PL.GET_HLS_DECRYPTION_KEY_ERR)}}return}catch(o){return aa.warn("Failed to analyze the network. If the domain of the video address has been configured with CORS, it means that the playback error is caused by the failure of the video request. If the domain of the video address is not configured with CORS, the real reason for the playback error cannot be determined because the video request cannot be analyzed."),GL.getVeErrorInfo(PL.NETWORK)}}))}analyseStream(){return d(this,null,(function*(){}))}handle2100Error(e){return d(this,arguments,(function*({error:e,errorCode:t,httpCode:i,response:n,finalMessage:r}){const o={errorType:DL.network,errorCode:t,httpCode:i,errorMessage:r,originError:e};if(i){if(404===i)o.veError=GL.getVeErrorInfo(PL.NETWORK_NOTFOUND);else if(416===i)o.veError=GL.getVeErrorInfo(PL.NETWORK_RANGE_NOT_SATISFIABLE);else if(403===i){try{const e=yield function(e){return(t=e)&&"object"==typeof t&&"responseText"in t&&"status"in t&&"statusText"in t?e.responseText:function(e){return!(!e||"object"!=typeof e)&&"json"in e&&"text"in e&&"status"in e}(e)?e.text():e;var t}(n);if("string"==typeof e)return e.includes("expire")?o.veError=GL.getVeErrorInfo(PL.NETWORK_URL_EXPIRE):e.includes("sign")?o.veError=GL.getVeErrorInfo(PL.NETWORK_URL_SIGN):o.veError=GL.getVeErrorInfo(PL.NETWORK_FORBIDDEN),this.createVeError(o)}catch(s){aa.warn("get response text error")}return o.veError=GL.getVeErrorInfo(PL.NETWORK_FORBIDDEN),this.createVeError(o)}}else{const e=il(ol(this.player));if(e){const t=KL(e);t&&(o.veError=t)}}return this.createVeError(o)}))}handle9991Error({error:e,errorCode:t,httpCode:i,finalMessage:n}){return this.createVeError({errorType:DL.serve,errorCode:t||PL.OTHER.code,httpCode:i,errorMessage:n,originError:e,veError:GL.getVeErrorInfo(PL.GET_HLS_DECRYPTION_KEY_ERR)})}handleNetError(e){return d(this,arguments,(function*({error:e,errorCode:t,httpCode:i,finalMessage:n}){try{const r=il(ol(this.player)),o=yield this.analyseNet(r,e,3e3);return o?this.createVeError({errorType:DL.network,errorCode:t||PL.OTHER.code,httpCode:i,errorMessage:n,originError:e,veError:o}):this.createVeError({errorCode:t||PL.NETWORK_ENCRYPT_HLS_ERR.code,httpCode:i,errorMessage:n,originError:e,veError:GL.getVeErrorInfo(PL.NETWORK_ENCRYPT_HLS_ERR)})}catch(r){return aa.warn("analyse fail of the net error of encrypt hls m3u8 file"),this.createVeError({errorCode:t||PL.NETWORK_ENCRYPT_HLS_ERR.code,httpCode:i,errorMessage:n,originError:e,veError:GL.getVeErrorInfo(PL.NETWORK_ENCRYPT_HLS_ERR)})}}))}handleStuckError({error:e,errorCode:t,httpCode:i,finalMessage:n}){const r={errorType:DL.network,errorCode:t,httpCode:i,errorMessage:n,originError:e},{currentTime:o,duration:s,buffered:a}=this.player,l=!a||0===a.length||!s,u=this.player.checkBuffer(o,{startDiff:0,endDiff:.1});if(l||!u)return r.veError=GL.getVeErrorInfo(PL.NETWORK),this.createVeError(r);this.createVeError(r)}transformToVeError(e){return d(this,null,(function*(){if((null==e?void 0:e.veErrorCode)&&!this.player.getPlugin("Mp4EncryptPlayer"))return e;const{httpCode:t,errorMessage:i,message:n,msg:r,response:o}=e||{},s=(null==e?void 0:e.code)||(null==e?void 0:e.errorCode),a=i||n||("string"==typeof r?r:"other error");if(2100===s)return this.handle2100Error({error:e,errorCode:s,httpCode:t,response:o,finalMessage:a});if(-9991===s)this.handle9991Error({error:e,errorCode:s,httpCode:t,finalMessage:a});else{if([2103,5104,5102].includes(s)&&this.player.getPlugin("Mp4EncryptPlayer")||-9996===s&&this.player.getPlugin("EncryptHlsPlugin"))return this.handleNetError({error:e,errorCode:s,httpCode:t,finalMessage:a});if([9002,9003].includes(s))return this.handleStuckError({error:e,errorCode:s,httpCode:t,finalMessage:a})}return this.createVeError(u({errorCode:s||PL.OTHER.code,httpCode:t,errorMessage:a,originError:e},e||{}))}))}}const WL=new Set(Object.values(LL).map((e=>e.code)));let YL=class extends bs{constructor(e){super(e),this._errDetailList=[],this._errorDomMode=null,this.state={showError:!1,retryTimes:0,idx:0},this.handleError=e=>d(this,null,(function*(){this.isVodLogConError=(null==e?void 0:e.errorCode)===PL.VOD_LOG_NOT_CONFIGURED.code,this.player&&this.player.pause(),this.config.isNeedDemoteBack?(this.state.showError=!1,this.changeMainOrBackup()):this.state.showError=!0,this.renderError(e)})),this.handleEnd=()=>{},this.handleRefreshClick=()=>{var e,t;null==(e=this.player)||e.emit(FD.PLAY_ERROR_BUTTON_CLICK),this.player.removeClass(As.PAUSED),this.closeError(),null==(t=this.player)||t.retry()},this.closeError=()=>{this.state.showError&&(this.state.showError=!1,this.renderError())},this.playerData=e.player.config.playerData}static get pluginName(){return"sdkErrorPlugin"}static get defaultConfig(){return{showError:!0,errorImg:!0,errorTips:!0,isNeedRefreshButton:!0,isNeedCopyButton:!0,isNeedDemoteBack:!1,retryLoopNum:1,errorTipsText:null,position:bs.POSITIONS.ROOT}}afterCreate(){var e,t,i;this.initEvents();const n=Object.values(PL).reduce(((e,t)=>{const{code:i,textKey:n}=t;return e[i]=this.i18n[n],e}),{});this.errNoteMap=u({other:null!=(i=null==(t=null==(e=this.i18n.ERROR_TYPES)?void 0:e.other)?void 0:t.msg)?i:"error",1:this.i18n.MEDIA_ERR_ABORTED,2:this.i18n.MEDIA_ERR_NETWORK,3:this.i18n.MEDIA_ERR_DECODE},n)}registerLanguageTexts(){return{clickButton:{jp:"リフレッシュ",en:"Refresh",zh:"刷新","zh-hk":"刷新"},errorTips:{jp:"再生中にエラーが発生しました。[更新]をクリックして試してください",en:"An error occurred while playing, click refresh to try",zh:"播放发生错误,点击刷新试试吧","zh-hk":"播放發生錯誤,點擊刷新試試吧"},errorCode:{jp:"コード",en:"code",zh:"错误码","zh-hk":"錯誤碼"},did:{jp:"デバイスID",en:"deviceID",zh:"设备 ID","zh-hk":"設備 ID"},playTime:{jp:"遊び時間",en:"playTime",zh:"播放时间","zh-hk":"播放時間"},copyError:{jp:"コピーエラー",en:"Copy error",zh:"复制错误信息","zh-hk":"複製錯誤訊息"},copySuccess:{jp:"コピー成功",en:"Copy success",zh:"复制成功","zh-hk":"複製成功"}}}registerIcons(){return{errorImg:{icon:IL,class:"xgplayer-error-svg"}}}updateLang(){var e,t;if(!this.$errorDom)return;const i=this.$errorDom.querySelector(".xgplayer-error-tips");if(i){const n=null!=(t=null==(e=this.config.errorTipsText)?void 0:e[this.lang])?t:this.langText.errorTips;i.innerHTML=n}const n=this.$errorDom.querySelector(".xgplayer-error-button");n&&(n.innerHTML=this.langText.clickButton)}initEvents(){this.player.on(UL,this.handleError),this.on(no,this.closeError),this.on(Xr,this.closeError)}getRetryList(){var e;const t=this.playerData.getCurrentStreams()[0];return[null==t?void 0:t.url,...null!=(e=null==t?void 0:t.backUrlList)?e:[]]}changeMainOrBackup(){this.player.addClass(As.ENTER);const e=this.getRetryList(),t=this.config.retryLoopNum*e.length,i=(e.indexOf(this.player.config.url)+1)%e.length;this.state.idx=i;const n=e[i];if(!n||this.state.retryTimes===t)return this.player.removeClass(As.ENTER),this.state.retryTimes===t&&this.player.emit(FD.PLAY_BACKUP_CHANGE_FINISH),this.state.showError=!0,this.renderError(),void this.resetTimes();this.player.once("canplay",(()=>{this.state.retryTimes=0})),aa.log(`retry times: ${this.state.retryTimes}`,n),this.player.emit(FD.PLAY_BACKUP_CHANGE,{currentUrl:this.player.config.url,nextUrl:n,retryTimes:this.state.retryTimes}),this.changeUrl(n),this.state.retryTimes=this.state.retryTimes+1}changeUrl(e){this.player.config.url=e,this.player.switchURL(e,!1),this.player.emit(FD.PlAY_URL_CHANGE,{url:e,from:FD.PLAY_BACKUP_CHANGE})}resetTimes(){this.state.retryTimes=0,this.state.idx=0}renderError(e){if(!this.config.showError)return;const t=this.root;t&&(t.innerHTML="",t.style.display="none",(this.state.showError||this.isVodLogConError)&&(this.player.emit(FD.SHOW_PLAY_ERROR),t.style.display="block",t.appendChild(this.getErrorDom(e))),this.isVodLogConError&&(this.player.blur(),this.player.pause()))}addErrDetail(e){Array.isArray(e)?this._errDetailList=[...this._errDetailList,...e]:this._errDetailList.push(e)}getErrorInfo(e){var t,i,n,r,o;const s=e.veErrorCode||e.errorCode,a=null==(t=this.player)?void 0:t.vodLogger,l=(null==(o=null==(r=null==(n=null==(i=null==a?void 0:a.tracker)?void 0:i.getConfig)?void 0:n.call(i))?void 0:r.user)?void 0:o.user_unique_id)||(null==a?void 0:a.line_user_id);return{code:s,appId:null==a?void 0:a.line_app_id,did:l||"unknown",playTime:ua().format("YYYY-MM-DD HH:mm:ss")}}getErrorInfoDom(e){const{code:t,did:i,playTime:n}=this.getErrorInfo(e),r=Ur.createDom("div","",void 0,"xgplayer-error-info-wrap"),o=`<p class="xgplayer-error-info-p">\n <span class="xgplayer-error-info-title">${this.langText.errorCode||"code"}</span>\n <span class="xgplayer-error-info-content">${t}</span>\n </p>`;r.appendChild(Ur.createDomFromHtml(o));const s=`<p class="xgplayer-error-info-p">\n <span class="xgplayer-error-info-title">${this.langText.did||"deviceID"}</span>\n <span class="xgplayer-error-info-content">${i}</span>\n </p>`;r.appendChild(Ur.createDomFromHtml(s));const a=`<p class="xgplayer-error-info-p">\n <span class="xgplayer-error-info-title">${this.langText.playTime||"playTime"}</span>\n <span class="xgplayer-error-info-content">${n}</span>\n </p>`;return r.appendChild(Ur.createDomFromHtml(a)),r}handleCopyBtnClick(e){const{did:t,playTime:i,appId:n}=this.getErrorInfo(e);try{const r=JSON.stringify(c(u({},e),{playTime:i,deviceID:t,appId:n}));navigator.clipboard.writeText(r).then((()=>{!function(e,t=1e3){const i=document.createElement("div");i.className="veplayer-toast",i.textContent=e,document.body.appendChild(i),setTimeout((()=>i.classList.add("show")),10),setTimeout((()=>{i.classList.remove("show"),setTimeout((()=>null==i?void 0:i.remove()),300)}),t)}(this.langText.copySuccess||"copySuccess")}))}catch(r){aa.error("copy error info err ",r)}}getActionDom(e){const t=e.errorType,i=Ur.createDomFromHtml('<div class="xgplayer-error-action-wrap"></div>'),n=!(t&&[DL[10],DL[11],DL[12]].includes(t));if(this.config.isNeedRefreshButton&&n){const e=Ur.createDom("div",this.langText.clickButton||"Refresh",void 0,"xgplayer-error-button refresh-button");this.bind(".refresh-button","click",this.handleRefreshClick),i.appendChild(e)}if(this.config.isNeedCopyButton){const t=Ur.createDom("div",this.langText.copyError||"CopyError",void 0,"xgplayer-error-button copy-button");this.bind(".copy-button","click",this.handleCopyBtnClick.bind(this,e)),i.appendChild(t)}return i}getErrorDom(e){var t,i,n,r,o,s;const{errorCode:a,message:l,displayMessage:u}=e,c=null!=(t=null==e?void 0:e.veErrorCode)?t:null==e?void 0:e.errorCode,h=!!yH.ttDramaEnv,d="number"==typeof c&&WL.has(c);if("drama"===(h&&d?"drama":"normal")){if(!this.$errorDom){this.$errorDom=Ur.createDom("div","",void 0,"xgplayer-error-cover xgplayer-drama-error-cover");const e=Ur.createDom("div","Video isn't available",void 0,"xgplayer-drama-error-toast");this.$errorDom.appendChild(e),this.emit("sdkerrorplugin_render",this.$errorDom)}return this.$errorDom}if(!this.$errorDom){if(this.$errorDom=Ur.createDom("div","",void 0,"xgplayer-error-cover"),this.config.errorImg){const e=Ur.createDom("div","",void 0,"xgplayer-error-img");e.appendChild(this.icons.errorImg),this.$errorDom.appendChild(e)}if(this.config.errorTips){let t="";t=(null==(n=null==(i=this.config)?void 0:i.errorTipsText)?void 0:n[this.lang])?null==(r=this.config.errorTipsText)?void 0:r[this.lang]:e?u||this.errNoteMap[a]||this.player.errorNote&&this.i18n[this.player.errorNote]||l||this.errNoteMap.other||"error":this.langText.errorTips;const o=Ur.createDom("div",t,void 0,"xgplayer-error-tips");this.$errorDom.appendChild(o)}this.$errorDom.appendChild(this.getErrorInfoDom(e)),this.$errorDom.appendChild(this.getActionDom(e)),(null==(o=this._errDetailList)?void 0:o.length)&&(null==(s=this._errDetailList)||s.forEach((e=>{const t="function"==typeof e?e():e;if(t){const e=Ur.createDom("div",`${t.label}: ${t.value}`,void 0,"xgplayer-error-detail-info");this.$errorDom.appendChild(e)}}))),this.emit("sdkerrorplugin_render",this.$errorDom)}return this.$errorDom}destroy(){this.player.off(Zr,this.handleError)}render(){return this.config.showError?'<xgplayer-error class="xgplayer-error"></xgplayer-error>':""}};function zL(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function $L(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?zL(Object(i),!0).forEach((function(t){JL(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):zL(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function XL(e){return(XL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QL(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dR(n.key),n)}}function ZL(e,t,i){return t&&QL(e.prototype,t),i&&QL(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function JL(e,t,i){return(t=dR(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function eR(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&iR(e,t)}function tR(e){return(tR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function iR(e,t){return(iR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function nR(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function rR(e,t,i){return(rR=nR()?Reflect.construct.bind():function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&iR(r,i.prototype),r}).apply(null,arguments)}function oR(e){var t="function"==typeof Map?new Map:void 0;return oR=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return rR(e,arguments,tR(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),iR(n,e)},oR(e)}function sR(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aR(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return sR(e)}function lR(e){var t=nR();return function(){var i,n=tR(e);if(t){var r=tR(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return aR(this,i)}}function uR(){return uR="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=tR(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}},uR.apply(this,arguments)}function cR(e){return function(e){if(Array.isArray(e))return hR(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return hR(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return hR(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hR(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function dR(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var pR=["b","i","u","span","c","ruby","rt","v","lang"],fR=["br"];var gR=/^WEBVTT/i,yR=/^\d+\r?\n\d{2}:\d{2}:\d{2},\d{3}\s*-->/m,vR=/^STYLE+$/,mR=/^\:\:cue/,_R=/^}+$/,ER=/^\[Script Info\].*/,TR=[/[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,3}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/,/[0-9]{1,3}:[0-9]{2}:[0-9]{2},[0-9]{1,3}\s*-->\s*[0-9]{1,3}:[0-9]{2}:[0-9]{2},[0-9]{1,3}/],SR=/^Format:\s/,bR=/^Style:\s/,kR=/^Dialogue:\s/,CR=/^([0-5]?\d)[.,](\d{1,3})$/;function IR(e){var t=CR.exec(e);return t?(1e3*Number(t[1])+Number(t[2]))/1e3:0}function AR(e){var t=e.length;return 3===t?60*(60*Number(e[0])+Number(e[1]))+IR(e[2]):2===t?60*Number(e[0])+IR(e[1]):IR(e[0])}function PR(e){return/^(\-|\+)?\d+(\.\d+)?$/.test(e)}function wR(e){return null==e?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function DR(e,t){return e>=0&&e<t.length?t[e]:""}function LR(e){return t=function(e){return String(e||"").trim().split(/[\s.]/)[0].toLowerCase()}(e),pR.includes(t)||fR.includes(t);var t}var RR=function(){function e(){qL(this,e)}return ZL(e,null,[{key:"parseJson",value:function(e){for(var t=[],i=0,n=0;n<e.length;n++){if(i>=50&&(i=0),0===i){var r={start:e[n].start,list:[e[n]],end:e[n].end};t.push(r)}else t[t.length-1].list.push(e[n]),t[t.length-1].end=e[n].end;i++}return t}},{key:"parse",value:function(t,i){var n=e.checkFormat(t);try{var r;i({format:n,list:(r="ass"===n?e.parseASS(t):e.parseVTT(t)).list,styles:r.styles})}catch(oF){console.error(oF),i({format:n},oF)}}},{key:"parseASSItem",value:function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(","),i={},n="";try{var r=t.length-e.length;return n=wR(n=(n=r>0?t.splice(e.length-1,r+1).join(",")+"":t[t.length-1]+"").replace(/\\n+/g,"")),t[e.length-1]=n,e.map((function(e,n){"end"===e||"start"===e?i[e]=AR(t[n].split(":")):"text"===e?i[e]=[t[n]]:"layer"===e?(i[e]=[t[n]],i.textTag=[t[n]]):i[e]="style"===e?[t[n]]:Number(t[n])?Number(t[n]):t[n]})),i}catch(oF){return console.error(oF),{}}}},{key:"parseASS",value:function(t){for(var i=t.split("\n"),n=[],r=0,o=0,s=[],a=[],l=null;r<i.length;){if(SR.test(i[r]))a=(a=i[r].replace(SR,"").replace(/\s+/g,"").split(",")).map((function(e){return e.toLocaleLowerCase()}));else if(bR.test(i[r]))s.push(i[r].replace(bR,"").replace(/\s+/g,""));else if(kR.test(i[r])){var u=e.parseASSItem(i[r].replace(kR,""),a);if(l&&u.start===l.start&&u.end===l.end)try{var c=l,h=c.text,d=c.textTag,p=c.style;h.push(u.text[0]),d.push(u.textTag[0]),p.push(u.style[0])}catch(oF){console.error(oF)}else{l=u;var f=null;o%50==0?((f={start:l.start,end:l.end,list:[]}).list.push(l),n.push(f)):((f=n[n.length-1]).end=l.end,f.list.push(l)),o++}}r++}return{list:n,styles:[]}}},{key:"parseVTTStyle",value:function(e,t){var i=e.split(":");if(i.length>1){var n=i[0].trim().split("-"),r="";n.length>1?n.map((function(e,t){r+=0===t?e:e.charAt(0).toUpperCase()+e.slice(1)})):r=n[0],t[r]=i[1].trim().replace(/;$/,"")}return t}},{key:"parseVTT",value:function(e){for(var t=(e=e.replace(gR,"")).split("\n"),i=[],n=0,r=0,o=null,s=!1,a=!1,l=null,u=null,c=[];n<t.length;){var h=DR(n,t).trim();if(!h||s&&PR(h))s=!h;else if(mR.test(h)&&vR.test(DR(n-1,t).trim())){a=!0;var d=/\((.+?)\)/g.exec(h);u=d?d[1]:"",l=""}else if(a)_R.test(h)?(c.push({key:u||"",style:l||""}),l=null,u=null,a=!1):l+=h;else if(h){s=!1;var p=this.checkIsTime(t[n]);if(p){var f=this.parseVttTime(p);if(!o||f.start!==o.start||f.end!==o.end){(o=f).text=[],o.textTag=[];var g=null;r%50==0?((g={start:o.start,end:o.end,list:[]}).list.push(o),i.push(g)):((g=i[i.length-1]).end=o.end,g.list.push(o)),r++}}else if(o){var y=o,v=y.text,m=y.textTag,_=this.parseVttText(t[n]);v.push(_.text),m.push(_.tag)}s=!1}n++}return{list:i,styles:c}}},{key:"checkIsTime",value:function(e){e=e.replace(/\s+/g,"");for(var t=0,i=null;t<TR.length&&!(i=TR[t].exec(e));)t++;return i?i[0]:null}},{key:"parseVttText",value:function(e){var t=/^(<?.+?>)/g.exec(e),i="",n="default";if(t){if(LR(n=t[0].replace(/\<|\>|\&/g,"")))return{tag:"default",text:wR(e.replace(/\\n+/g,"<br/>"))};var r=RegExp("^<".concat(n,">(([\\s\\S])*?)</").concat(n,">$")).exec(e);r?i=r[1]:(i=e,n="")}else i=e;for(var o=/<(\w+)\.(\w+)>/g,s=o.exec(i);s&&s.length>2;)i=i.replace(s[0],"<".concat(s[1],' class="').concat(s[2],'">')),s=o.exec(i);return{tag:n,text:wR(i.replace(/\\n+/g,"<br/>"))}}},{key:"parseVttTime",value:function(e){var t=e.split("--\x3e"),i=0,n=0;if(2===t.length){var r=t[0].split(":"),o=t[1].split(":");i=AR(r),n=AR(o)}return{start:i,end:n,time:e}}},{key:"isVTT",value:function(e){return gR.test(e)}},{key:"isASS",value:function(e){return ER.test(e)}},{key:"checkFormat",value:function(e){return e?gR.test(e)?"vtt":ER.test(e)?"ass":yR.test(e)?"srt":"":""}}]),e}(),xR=[{code:0,msg:"SUCCESS"},{code:1,msg:"LOAD_ERROR"},{code:2,msg:"PARSER_ERROR"},{code:3,msg:"FORMAT_NOT_SUPPORTED"},{code:4,msg:"ID_OR_LANGUAGE_NOT_EXIST"},{code:5,msg:"PARAMETERS_ERROR"},{code:6,msg:"ABORT"},{code:7,msg:"UNKNOWN"},{code:8,msg:"DATA_ERROR:subtitle.url is null"},{code:9,msg:"DATA_ERROR:subtitle.url length is 0"}],OR=function(e){eR(i,e);var t=lR(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:7,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return qL(this,i),e||(e=xR[r||7].msg),(n=t.call(this,e)).code=r||7,n.message=e,n.type=xR[r||7].msg,n.orgError=o||null,n.data=s||null,n}return ZL(i)}(oR(Error));function NR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n={code:xR[e].code,msg:xR[e].msg,message:xR[e].msg,id:i&&i.id||"",language:i&&i.language||""};return Object.keys(t).map((function(e){n[e]=t[e]})),n}var MR=ZL((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.url,n=t.method,r=void 0===n?"GET":n,o=t.type,s=void 0===o?"arraybuffer":o,a=t.timeout,l=void 0===a?1e4:a,u=t.data,c=void 0===u?{}:u,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return qL(this,e),new Promise((function(e,t){var n=new window.XMLHttpRequest,o=r.toUpperCase(),a=[];if(s&&(n.responseType=s),l&&(n.timeout=l),Object.keys(c).forEach((function(e){a.push("k=".concat(c[e]))})),n.onload=function(){200===n.status||206===n.status?e({context:h,res:n}):t(new Error({context:h,res:n,type:"error"}))},n.onerror=function(e){t(new Error({context:h,res:n,type:"error"}))},n.ontimeout=function(e){t(new Error({context:h,res:n,type:"error"}))},n.onabort=function(){t(new Error({context:h,res:n,type:"error"}))},"GET"===o)n.open(o,"".concat(i)),n.send();else{if("post"!==o)throw new Error("xhr ".concat(o," is not supported"));n.open(o,i),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.send(a.join("&"))}}))})),UR=function(){function e(){var t,i;qL(this,e);var n=new Promise((function(e,n){t=e,i=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){i(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}return ZL(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}();function BR(e,t){if(!e)return!1;if(e.classList)return Array.prototype.some.call(e.classList,(function(e){return e===t}));var i=e.className&&"object"===XL(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function HR(e,t){e&&(e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):BR(e,t)||(e.className&&"object"===XL(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t))}function FR(e,t,i){var n=t.length;if(n<1)return-1;if(t[i=i<0?0:i>=n?n-1:i].start<=e&&e<t[i].end)return i;for(var r=t[i].end<=e?i+1:0;r<n;r++){if(t[r].start<=e&&e<t[r].end)return r;if(e>t[r].end&&r+1<n&&e<t[r+1].start)return-1;if(e>t[r].end&&r+1>=n)return-1}return-1}function jR(e,t,i){var n=t.length;if(n<1)return[];var r=[];if((i=i<0?0:i>=n?n-1:i)<n)for(var o=t[i].end<=e?i:0;o<n&&(t[o].start<=e&&e<t[o].end&&r.push(o),!(e<t[o].start));o++);return r}function VR(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function KR(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(e);return r.className=n,r.innerHTML=t,Object.keys(i).forEach((function(t){var n=t,o=i[t];"video"===e||"audio"===e||"live-video"===e?o&&r.setAttribute(n,o):r.setAttribute(n,o)})),r}function GR(e){return e&&e instanceof window.HTMLMediaElement}function WR(e,t,i){if(i||(i=new UR),"json"===t){var n=RR.parseJson(e);i.resolve({list:n,format:"json"})}else"string"===t&&RR.parse(e,(function(e,t){if(t){var n=NR(2,t);i.reject(n,{format:e.format})}else if(e.format||e.list&&0!==e.list.length)i.resolve({styles:e.styles,list:e.list,format:e.format});else{var r=NR(3);i.reject(r)}}));return i}function YR(e,t){t||(t=new UR);var i=[];"String"===VR(e.url)?i=[e.url]:"Array"===VR(e.url)&&(i=cR(e.url));return function n(){var r=i.shift();if(r)new MR({url:r,type:"text"}).then((function(i){WR(i.res.response,"string").then((function(i){t.resolve($L($L({},i),e))})).catch((function(e){t.reject(e)}))})).catch((function(o){if(i.length>0)n();else{var s=NR(1,$L({statusText:o.statusText,status:o.status,type:o.type,message:"http load error",url:r},e));t.reject(s)}}));else{var o=NR(1,$L({message:"http load error",url:e.url},e));t.reject(o)}}(),t}function zR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("number"==typeof e)return Number.isFinite(e)?Math.trunc(e):t;if("string"==typeof e){var i=e.trim();if(!i)return t;var n=parseInt(i,10);return Number.isNaN(n)?t:n}return t}function $R(e,t){return!(!e||!t)&&!!(e.id&&t.id&&e.id===t.id||e.language&&t.language&&e.language===t.language)}function XR(e){return null!==e&&""!==e.trim()&&/^[a-zA-Z]+$/.test(e)}function qR(e){return!!/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(e)}var QR=function(){function e(){var t=this;qL(this,e),this.__handlers=[],window.ResizeObserver&&(this.observer=new window.ResizeObserver((function(e){t.__trigger(e)})))}return ZL(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var i=this.__handlers,n=-1,r=0;r<i.length;r++)i[r]&&e===i[r].target&&(n=r);n>-1?this.__handlers[n].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(i,n){e===i.target&&(t=n)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e,t){for(var i=this.__handlers,n=0;n<i.length;n++)if(i[n]&&e===i[n].target){i[n].handler&&i[n].handler.forEach((function(i){try{i(e,t)}catch(oF){console.error(oF)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){var i=e.contentRect;t.__runHandler(e.target,i)}))}}]),e}(),ZR=null;var JR="resize",ex="change",tx="off",ix="update",nx="error",rx=/^[A-Za-z0-9_-]+$/,ox=/^[A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*$/;function sx(e,t){t&&String(t).split(/(?:\\[nN]|\r\n|\r|\n)+/).forEach((function(t,i){i>0&&e.appendChild(document.createElement("br")),t&&e.appendChild(document.createTextNode(t))}))}function ax(e){var t=e.slice(1,-1).trim();if(!t||"!"===t[0]||"?"===t[0])return null;if("/"===t[0]){var i=/^\/\s*([A-Za-z][\w:-]*)/.exec(t),n=i&&i[1].toLowerCase();return n&&pR.includes(n)?{closing:!0,tagName:n}:null}var r=/\/\s*$/.test(t),o=t.replace(/\/\s*$/,""),s=/^([A-Za-z][\w:-]*(?:\.[^\s/>.]+)*)([\s\S]*)$/.exec(o);if(!s)return null;var a=s[1].split("."),l=a.shift().toLowerCase();if(!pR.includes(l)&&!fR.includes(l))return null;var u,c=function(e){var t=e.trim(),i={};if(!t||!/(?:^|\s)[^\s=]+\s*=/.test(t))return{attrs:i,annotation:t};for(var n=/([^\s=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,r=n.exec(t);r;)i[r[1].toLowerCase()]=r[2]||r[3]||r[4]||"",r=n.exec(t);return{attrs:i,annotation:""}}(s[2]),h=c.attrs;return{attrs:h,annotation:c.annotation,closing:!1,className:(u="".concat(a.join(" ")," ").concat(h.class||""),String(u||"").split(/\s+/).filter((function(e){return rx.test(e)})).join(" ")),selfClosing:r,tagName:l}}function lx(e){var t="c"===e.tagName||"v"===e.tagName||"lang"===e.tagName?"span":e.tagName,i=document.createElement(t);e.className&&(i.className=e.className);var n=function(e){var t=String(e||"").trim();return ox.test(t)?t:""}(e.attrs.lang||("lang"===e.tagName?e.annotation:""));return n&&i.setAttribute("lang",n),"v"===e.tagName&&e.annotation&&i.setAttribute("data-voice",e.annotation),i}function ux(e,t){for(var i=function(e){return null==e?"":String(e).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'|'/g,"'").replace(/&/g,"&")}(t),n=[{dom:e,tagName:""}],r=/<[^>]*>/g,o=0,s=r.exec(i);s;){sx(n[n.length-1].dom,i.slice(o,s.index));var a=s[0],l=ax(a);if(l)if(l.closing){var u=n.map((function(e){return e.tagName})).lastIndexOf(l.tagName);u>0?n.length=u:sx(n[n.length-1].dom,a)}else if("br"===l.tagName)n[n.length-1].dom.appendChild(document.createElement("br"));else{var c=lx(l);n[n.length-1].dom.appendChild(c),l.selfClosing||n.push({dom:c,tagName:l.tagName})}else sx(n[n.length-1].dom,a);o=r.lastIndex,s=r.exec(i)}sx(n[n.length-1].dom,i.slice(o))}function cx(e){var t=[];if(e&&"String"===VR(e))t.push({url:[e],index:0,start:-1,end:-1});else if("Array"===VR(e)){if(0===e.length)return t;"String"===VR(e[0])?t.push({url:cR(e),index:0,start:-1,end:-1}):e.forEach((function(e,i){t.push({url:e.url||e.src||"",index:i,start:e.start||-1,end:e.end||-1})}))}return t}var hx=!1,dx=function(e){eR(i,e);var t=lR(i);function i(e){var n,r,o,s,a,l,u;return qL(this,i),JL(sR(n=t.call(this)),"_onPause",(function(){n.stopRender()})),JL(sR(n),"_onPlay",(function(){n._curRenderTask.length>0&&n.startRender(-1)})),JL(sR(n),"_onTimeupdate",(function(){if(n._isOpen){if(n.config.domRender){var e=n.player.media?n.player.media:n.player,t=e.videoWidth,i=e.videoHeight;!n._videoMeta.scale&&t&&i&&n._onResize(n.player.root)}var r=n._getPlayerCurrentTime();Math.round(Math.abs(1e3*r-n._ctime))<200||(n._ctime=1e3*r,n.currentText&&n.currentText.list&&("live"===n.config.updateMode?n._liveUpdate(r):n._update(r)))}})),JL(sR(n),"_onResize",(function(e){var t=sR(n),i=t._videoMeta;if(t.config.domRender){if(e&&e instanceof window.Element||(e=n.player.root),n._iId&&(clearTimeout(n._iId),n._iId=null),!i.scale){if(!n.player.video)return;var r=n.player.video,o=r.videoWidth,s=r.videoHeight;if(!o||!s)return;i.videoWidth=o,i.videoHeight=s,i.scale=zR(s/o*100)}n.__startResize(e)}})),JL(sR(n),"_onCoreEvents",(function(e){try{switch(e.eventName){case"core.subtitlesegments":n._onSubtitleSegment(e.list||[]);break;case"core.subtitleplaylist":n._onSubtitlePlaylist(e.list||[]);break;case"core.seipayloadtime":n._onCoreSeiintime(e)}}catch(t){console.error(t)}})),JL(sR(n),"startRender",(function(e){if(e>0&&n._renderIntervalId&&(window.cancelAnimationFrame(n._renderIntervalId),n._renderIntervalId=-1),n.textTrack){var t=sR(n)._curRenderTask;n._lastTimeStamp=(new Date).getTime();var i=[];t.forEach((function(t,r){var o=t.lastTime,s=t.wordList,a=t.interval,l=t.dom,u=t.ids;if(e<0||n._lastTimeStamp<0||n._lastTimeStamp-o>=a){var c=s.shift();c&&l.appendData(c),t.lastTime=n._lastTimeStamp}s.length<1&&i.push({index:r,ids:u})})),n._log(">>>>_renderByWords emptyArr",i.length,t.length),i.forEach((function(e){t.splice(e.index,1),n._log(">>>_renderByWords remove emptyArr",e.index,t.length)})),t.length>0&&(n._renderIntervalId=window.requestAnimationFrame(n.startRender))}})),JL(sR(n),"destroy",(function(){n.detachPlayer(),n.removeAllListeners(),n.player=null,n.textTrack=null,n._curRenderTask=[],n.stopRender()})),r=navigator.userAgent,o=/(?:Windows Phone)/.test(r),s=/(?:SymbianOS)/.test(r)||o,a=/(?:Android)/.test(r),l=/(?:Firefox)/.test(r),u=/(?:iPad|PlayBook)/.test(r)||a&&!/(?:Mobile)/.test(r)||l&&/(?:Tablet)/.test(r),hx=/(?:iPhone)/.test(r)&&!u||a||s||u,n.currentText=null,n.currentExtText=null,n.textTrack=[],n._cid=-1,n._gid=-1,n._cids=[],n._iId=null,n._iC=0,n.player=null,n.root=null,n.config={line:"double",bottom:0,mode:"stroke",defaultOpen:!1,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,fitVideo:!0,offsetBottom:2,fontColor:"#fff",domRender:!0,updateMode:"vod",renderMode:"",debugger:!1},n._ctime=0,n._loadingTrack={},n.seiTime=0,n.lastSeiTime=0,n._curTexts=[],n._curRenderTask=[],n._renderIntervalId=-1,n._lastTimeStamp=-1,Object.keys(n.config).map((function(t){void 0!==e[t]&&null!==e[t]&&(n.config[t]=e[t])})),n._isOpen=n.config.defaultOpen||!1,n._videoMeta={scale:0,videoHeight:0,videoWidth:0,lwidth:0,lheight:0,vWidth:0,vHeight:0,vBottom:0,vLeft:0,marginBottom:0},e.subTitles&&"Array"===VR(e.subTitles)?(e.player&&n.attachPlayer(e.player),n.setSubTitles(e.subTitles,n.config.defaultOpen),n):aR(n)}return ZL(i,[{key:"version",get:function(){return"3.0.25-rc.11"}},{key:"setSubTitles",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this._isOpen||i;n&&this.innerRoot&&this.switchOff(),!t||t.length<1?this.switchOff():(this.currentText=null,this.textTrack=[],t.forEach((function(t){var i={};Object.keys(t).map((function(e){i[e]=t[e]})),i.url=cx(i.url),i.isDefault&&(e.currentText=i),e.textTrack.push(i)})),this._log("setSubTitles",r),r&&(this.currentText||(this.currentText=this.textTrack[0]),this.switch().catch((function(t){e.emitError(t),e._log("[switch]",t)}))),this.currentText&&this._loadTrack(this.currentText).then((function(t){e.addStyles(t)})).catch((function(t){e.emitError(t),e._log("[_loadTrack] error",t)})),this.emit("reset",{type:"reset",list:this.textTrack,isOpen:r}))}},{key:"updateSubTitle",value:function(e){for(var t=this,i=-1,n=0;n<this.textTrack.length;n++)if($R(e,this.textTrack[n])){i=n;break}if(this._log("updateSubTitle",i,e),i>-1){var r=$R(this.currentText,this.textTrack[i]);if(this._log("updateSubTitle","_isCurrent",r,"this.isOpen",this.isOpen,this.currentText),!r)return;var o=cx(e.url);this.isOpen?(o.forEach((function(e){t.textTrack[i].url.push(e)})),this._log("updateSubTitle _loadTrackUrls",this.textTrack[i]),this._loadTrackUrls(this.currentText,2)):this.textTrack[i].url=o}}},{key:"addStyles",value:function(e){var t=e.styles,i=e.format;t&&"vtt"===i&&(t.map((function(e){e.key||(e.key="xg-text-track-span")})),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="";e.map((function(e){i+=" ".concat(t," ").concat(e.key," {").concat(e.style,"}")}));var n=document.head||document.getElementsByTagName("head")[0],r="xg-text-track-style",o=document.getElementById(r);if(o||((o=document.createElement("style")).type="text/css",o.id=r,n.appendChild(o)),o.styleSheet){var s=function(){try{o.styleSheet.cssText=(o.styleSheet.cssText||"")+i}catch(e){}};o.styleSheet.disabled?setTimeout(s,10):s()}else{var a=document.createTextNode(i);o.appendChild(a)}}(t,".xg-text-track"))}},{key:"attachPlayer",value:function(e){var t=this;if(this._log("attachPlayer"),e&&e!==this.player){this.player&&this.detachPlayer();var i,n,r=this.config,o=r.fontColor,s=r.mode,a=r.fitVideo,l=r.domRender;if(this.player=e,l&&(this.root=document.createElement("xg-text-track"),this.root.className="xg-text-track",!this._isOpen&&HR(this.root,"text-track-hide"),!a&&HR(this.root,"text-track-no-fitvideo"),s&&HR(this.root,"text-track-".concat(s)),this.innerRoot=document.createElement("xg-text-track-inner"),this.root.appendChild(this.innerRoot),o&&(this.root.style.color=o),this.currentText&&["language","id","label"].map((function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")})),this.player.root&&this.player.root.appendChild(this.root),this.player.root&&(i=e.root,n=this._onResize,ZR||(ZR=new QR),ZR.addObserver(i,n))),GR(this.player))this.player.addEventListener("timeupdate",this._onTimeupdate),this.player.addEventListener("pause",this._onPause),this.player.addEventListener("play",this._onPlay);else{if("function"!=typeof this.player.on)return;this.player.on("destroy",this.destroy),this.player.on("timeupdate",this._onTimeupdate),this.player.on("pause",this._onPause),this.player.on("play",this._onPlay),this.player.on("core_event",this._onCoreEvents)}this._isOpen&&this.switch().catch((function(e){t._log("[switch]",e)}))}}},{key:"detachPlayer",value:function(){var e,t,i=this.player,n=this.config;i&&(GR(i)?(i.removeEventListener("timeupdate",this._onTimeupdate),i.removeEventListener("pause",this._onPause),i.removeEventListener("play",this._onPlay)):"function"==typeof i.off&&(i.off("destroy",this.destroy),i.off("timeupdate",this._onTimeupdate),i.off("pause",this._onPause),i.off("play",this._onPlay),i.off("core_event",this._onCoreEvents)),n.domRender&&(i.root&&(e=i.root,ZR&&ZR.unObserver(e,t),this.root&&i.root.contains(this.root)&&i.root.removeChild(this.root)),this.innerRoot=null,this.root=null),this.player=null)}},{key:"switch",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return this._log("switch",t),this._loadingTrack=t,new Promise((function(i,n){if(!t.id&&!t.language){if(e.currentText)return e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn(),void i({message:"switch default subtitle success",code:0});var r=new OR("no default subtitle",5);return e.emitError(r),void n(r)}if(e.currentText&&$R(t,e.currentText))e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn(),i(NR(0));else{var o=null;e.__removeByTime(e._curTexts,0);for(var s=0;s<e.textTrack.length;s++)if($R(t,e.textTrack[s])){o=e.textTrack[s];break}if(e._log("nextSubtitle",o),o)e._emitPlayerSwitch(e.currentText,o),o.list?(e._loadingTrack={},e._updateCurrent(o),e.switchOn(),i(NR(0))):(e._log("this._loadTrack",o),e._updateCurrent(o),e._loadTrack(o).then((function(r){if(e.addStyles(r),e._loadingTrack.id===o.id||e._loadingTrack.language===r.language)e._loadingTrack={},e._updateCurrent(r),e.switchOn(),i(NR(0));else{var s=new OR("check _loadingTrack fail id: ".concat(e._loadingTrack.id," nextSubtitle:").concat(r.id),6,null,t);e.emitError(s),n(s)}})).catch((function(t){e.emitError(t),n(t)})));else{var a=new OR("The is no subtitle with id:[{".concat(t.id,"}] or language:[").concat(t.language,"]"),4,null,t);e.emitError(a),n(a)}}}))}},{key:"switchExt",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return new Promise((function(i,n){if(t.id||t.language){for(var r=null,o=0;o<e.textTrack.length;o++)if($R(t,e.textTrack[o])){r=e.textTrack[o];break}r&&!$R(r,e.currentText)&&e._loadTrack(r).then((function(t){e.currentExtText=t,i(NR(0))})).catch((function(t){e.emitError(t)}))}else e.currentExtText=null,i(NR(0))}))}},{key:"emitError",value:function(e){this.emit(nx,{type:nx,error:e})}},{key:"switchOn",value:function(){this._log("switchOn"),this._isOpen=!0,this.show();var e=this.currentText||{},t=e.id,i=e.language;this.emit(ex,{type:ex,isOpen:!0,id:t,language:i,texts:[]})}},{key:"switchOff",value:function(){if(this._isOpen=!1,this.hide(),this.currentText){var e=this.currentText,t=e.id,i=e.language;this.emit(tx,{type:tx,id:t,language:i,texts:[],isOpen:!1})}}},{key:"isOpen",get:function(){return this._isOpen}},{key:"_log",value:function(){if(this.config.debugger){for(var e,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];(e=console).log.apply(e,["[xgSubtitle]"].concat(i))}}},{key:"_loadTrack",value:function(e){var t=this;this._log("_loadTrack",e.language,e);var i=new UR,n="",r="";if(e.json?(n="json",r=e.json):!e.stringContent||e.url&&0!==e.url.length||(n="string",r=e.stringContent),r)return WR(r,n).then((function(t){e.format=t.format,e.styles=t.styles,e.list=t.list,i.resolve(e)})).catch((function(e){t.emitError(e),i.reject(e)})),i;var o=e.url;return 0===o.length?(i.resolve(e),i):(YR(o.splice(0,1)[0]).then((function(n){e.format=n.format,e.styles=n.styles,e.list||(e.list=[]),t._pushList(e.list,n.list),o.length>0&&t._loadTrackUrls(e,2),i.resolve(e)})).catch((function(e){t.emitError(e),i.reject(e)})),i)}},{key:"_emitPlayerSwitch",value:function(e,t){e&&"live"===this.config.updateMode&&(e.list=[],e.url=[]);var i=$L({lang:t.language},t);this._log("emit subtile_switch ",t,i),this.player&&"function"==typeof this.player.emit&&this.player.emit("switch_subtitle",i)}},{key:"_loadTrackUrls",value:function(e,t,i){var n=this,r=e.url.length,o=r>t?e.url.splice(0,t):e.url.splice(0,r),s=o.length;this._log("_loadTrackUrls",e.language,r,o.length,s),o.forEach((function(t,r){YR($L($L({},t),{},{index:r})).then((function(t){e.format=t.format,e.styles=t.styles,e.list||(e.list=[]),n._pushList(e.list,t.list),s--})).catch((function(e){s--})).finally((function(t){0===s&&(i&&i.resolve(e),n._loadTrackUrls(e,2))}))}))}},{key:"_freshUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{url:""},i=-1;e.url.forEach((function(e,n){e.url===t.url&&(i=n)})),i>-1&&e.url.splice(i,1)}},{key:"_pushList",value:function(e,t){if(!t||0===t.length)return e;var i=t[0].start,n=t[t.length-1].end;if(0===e.length||i>=e[e.length-1].end)t.forEach((function(t){e.push(t)}));else{for(var r=-1,o=0;o<e.length;o++)if(e[o].start>n){r=o;break}r>-1&&t.forEach((function(t,i){e.splice(r+i,0,t)}))}return e}},{key:"_updateCurrent",value:function(e){var t=this;this.currentText=e,this.config.domRender&&this.root&&(["language","id","label"].map((function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")})),this.__remove(this._cids)),this._cids=[],this._gid=-1,this._cid=-1,this._curTexts=[];var i=this._getPlayerCurrentTime();i&&("live"===this.config.updateMode?this._liveUpdate(i):this._update(i))}},{key:"__loadAll",value:function(){var e=this;this.textTrack.forEach((function(t){e._loadTrack(t)}))}},{key:"getDelCid",value:function(e,t){for(var i=[],n=0;n<e.length;n++)t.includes(e[n])||i.push(e[n]);return i}},{key:"getNewCid",value:function(e,t){for(var i=[],n=0;n<t.length;n++)e.includes(t[n])||i.push(t[n]);return i}},{key:"_liveUpdate",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var i=[],n=FR(e,this.currentText.list,this._gid);if(n>-1&&(i=jR(e,this.currentText.list[n].list,this._cid)),this.__removeByTime(this._curTexts,e),this._log("_liveUpdate",e,n,i,this.currentText.list[0].list[0].start,this.currentText.list[0].list[0].end),i.length>0){var r=function(e,t,i){if(0===e.length||t<0||t>e.length-1)return[];var n=e[t].list;if(0===i.length)return[];var r=n.splice(i[0],i.length);return t>0&&e.splice(0,t),0===n.length&&e.splice(0,1),r}(this.currentText.list,n,i),o=this._curTexts.length,s=o>0?this._curTexts[o-1].index:0;r.forEach((function(e,i){e.index=i+s,t._curTexts.push(e)})),this.__render(r)}this.emit(ix,this.getUpdateData(this._curTexts,0,this.currentText))}}},{key:"_update",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var i=FR(e,this.currentText.list,this._gid),n=[];if(i>-1&&(n=jR(e,this.currentText.list[i].list,this._cid)),n.length<1)return this._cids.length>0&&this.config.domRender&&this.__remove(this._cids),this._cids=[],this._curTexts.length>0&&this.emit(ix,this.getUpdateData([],e,this.currentText)),void(this._curTexts=[]);if(this._cids.join("")!==n.join("")||i!==this._gid){this._gid=i,this._cid=n[0];var r=this.getDelCid(this._cids,n),o=this.getNewCid(this._cids,n);this._cids=n,this.config.domRender&&this.__remove(r);var s=[];o.map((function(e){var n=t.currentText.list[i].list[e];n.index=e,s.push(n)})),this.currentExtText&&o.map((function(e){var n=t.currentText.list[i].list[e];n.index=e,s.push(n)})),this._log("update",s,e),this._curTexts=s,this.emit(ix,this.getUpdateData(s,e,this.currentText)),this.__render(s,e)}}}},{key:"getUpdateData",value:function(e,t,i){var n=i.id,r=i.language;return{type:ix,currentTime:0|t,id:n,language:r,texts:e,isOpen:this._isOpen}}},{key:"_getPlayerCurrentTime",value:function(){if(!this.player)return 0;var e=this.player.currentTime;return zR(1e3*(void 0===e?0:e)+1e3*this.seiTime-1e3*this.lastSeiTime)/1e3}},{key:"_onSubtitlePlaylist",value:function(e){this._log("_onSubtitlePlaylist",e);var t=e.map((function(e){return{label:e.name,language:e.lang,id:e.id,isDefault:e.default,url:[],mUrl:e.url}}));this.setSubTitles(t)}},{key:"_onSubtitleSegment",value:function(e){if(this._log("_onSubtitleSegment",e.length,e[0].lang,e[0].sn,e[e.length-1].sn,e[0].start,e[e.length-1].end),e&&0!==e.length){var t={language:e[0].lang,url:e.map((function(e){return{id:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end}}))};$R(t,this.currentText)&&this.updateSubTitle(t)}}},{key:"_onCoreSeiintime",value:function(e){try{var t=e.time/1e3;this._log("_onCoreSeiintime sei",t,this.seiTime,this.lastSeiTime),this.seiTime=t,this.lastSeiTime=this.player?this.player.currentTime:0}catch(i){}}},{key:"resize",value:function(e,t){var i,n=this,r=this.config,o=r.baseSizeX,s=r.baseSizeY,a=r.minMobileSize,l=r.minSize,u=r.fitVideo,c=r.offsetBottom,h=this._videoMeta.scale;this._videoMeta.lwidth=e,this._videoMeta.lheight=t;var d=0;t/e*100>=h?(d=zR(h*e)/100,i=e):(d=t,i=zR(t/h*100)),this._videoMeta.vWidth=i,this._videoMeta.vHeight=d;var p=0,f=0;f=zR(h>120?(p=s)*d/1080:(p=o)*i/1920);var g=hx?a:l,y={fontSize:f=f<g?g:f>p?p:f},v=zR((t-d)/2),m=zR((e-i)/2),_=zR(d*c)/100;this._videoMeta.vBottom=v,this._videoMeta.vLeft=m,this._videoMeta.marginBottom=_,u&&(y.bottom=v+_,y.left=y.right=m),Object.keys(y).map((function(e){n.root.style[e]="".concat(y[e],"px")})),this.emit(JR,{vLeft:m,vBottom:v,marginBottom:_,vWidth:i,vHeight:d,fontSize:f,scale:h})}},{key:"__startResize",value:function(e){var t=this,i=e.getBoundingClientRect(),n=this._videoMeta,r=i.width,o=i.height;if(this._iId&&(clearTimeout(this._iId),this._iId=null),r>0&&o>0&&(r!==n.lwidth||o!==n.lheight))this._iC=0,this.resize(r,o);else{if(this._iC>=5)return void(this._iC=0);this._iC++,this._iId=setTimeout((function(){t.__startResize(e)}),50)}}},{key:"__removeByTime",value:function(e,t){for(var i=[],n=0;n<e.length;n++)(!t||e[n].end<t)&&i.push(n);0!==i.length&&(e.splice(i[0],i.length),this.config.domRender&&this.__remove(i))}},{key:"__remove",value:function(e){var t=this;if(e&&!(e.length<1)){this._log(">>>>_renderByWords__remove",e);for(var i=this.innerRoot.children,n=[],r=0;r<i.length;r++){var o=Number(i[r].getAttribute("data-index"));e.includes(o)&&n.push(i[r])}n.map((function(e){t.innerRoot.removeChild(e)}))}}},{key:"__render",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._log("__render",t.length,this.config.domRender);var i=this.config,n=i.renderMode,r=i.domRender;t.length>0&&r&&t.forEach((function(t){var i="text-track-".concat(e.config.line);t.text.forEach((function(r,o){o>0&&(i+=" text-track-deputy");var s={"data-start":t.start,"data-end":t.end,"data-index":t.index},a=KR("xg-text-track-span","",s,i);if(e.innerRoot.appendChild(a),"step"===n){var l=KR("xg-text-track-span","",s,"".concat(i," text-track-space"));e.innerRoot.appendChild(l),ux(l,r),setTimeout((function(){e._renderByWords(a,o,t.start,t.end,r)}),600)}else ux(a,r)}))}))}},{key:"_renderByWords",value:function(e,t,i,n,r){var o=document.createTextNode("");e.appendChild(o);var s,a,l=function(e){for(var t=e.split(""),i=[],n=!1,r=0;r<t.length;r++){var o=t[r];if(XR(o))if(n){var s=i.length-1;i[s]="".concat(i[s]).concat(o)}else i.push(o),n=!0;else if(o.match(/^[ ]*$/)||qR(o)||/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(o)){n=!1;var a=i.length-1;a>=0?i[a]="".concat(i[a]).concat(o):i.push(o)}else n=!1,i.push(o)}return i}((s=r,ux(a=document.createElement("span"),s),a.textContent||"")),u=this._getPlayerCurrentTime(),c=zR(1e3*(n-u));if(!(u>=n)){i>=u&&(u=i),c>300&&(c-=50);var h={dom:o,ids:t,wordList:l,interval:c/l.length,start:u,end:n,duration:c,lastTime:0};this._log(">>>>_renderByWords",c,h);for(var d=this._curRenderTask,p=-1,f=0;f<d.length;f++)if(d[f].ids===t){p=f;break}p>-1&&d.slice(p,1),d.push(h),this.startRender(-1)}}},{key:"stopRender",value:function(){this._renderIntervalId&&window.cancelAnimationFrame(this._renderIntervalId)}},{key:"show",value:function(){var e,t;this.config.domRender&&(e=this.root,t="text-track-hide",e&&(e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):BR(e,t)&&t.split(/\s+/g).forEach((function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===XL(e.className)?e.setAttribute("class",e.getAttribute("class").replace(i," ")):e.className=e.className.replace(i," ")}))))}},{key:"hide",value:function(){this.config.domRender&&(HR(this.root,"text-track-hide"),this.innerRoot&&(this.innerRoot.innerHTML=""))}},{key:"emit",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=uR(tR(i.prototype),"emit",this)).call.apply(n,[this,e,t].concat(o))}},{key:"on",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=uR(tR(i.prototype),"on",this)).call.apply(n,[this,e,t].concat(o))}},{key:"once",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=uR(tR(i.prototype),"once",this)).call.apply(n,[this,e,t].concat(o))}},{key:"off",value:function(e,t){for(var n,r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];(n=uR(tR(i.prototype),"off",this)).call.apply(n,[this,e,t].concat(o))}},{key:"offAll",value:function(){uR(tR(i.prototype),"removeAllListeners",this).call(this)}},{key:"marginBottom",get:function(){var e=this._videoMeta,t=e.vBottom,i=e.marginBottom;return this.config.fitVideo?t+i:i}}]),i}(Lr);class px{constructor(e,t={}){var i,n;this.root=document.createElement("div"),this.root.className="veplayer-native-subtitle-dom",this.root.style.position="absolute",this.root.style.left="0",this.root.style.right="0",this.root.style.bottom=`${null!=(i=t.offsetBottom)?i:4}%`,this.root.style.color=null!=(n=t.fontColor)?n:"#fff",this.root.style.textAlign="center",this.root.style.pointerEvents="none",this.root.style.zIndex="12",e.appendChild(this.root)}render(e){this.root.replaceChildren(...e.map((e=>{const t=document.createElement("span");return t.className="veplayer-native-subtitle-cue",t.style.display="block",t.textContent=e.text,t})))}clear(){this.render([])}destroy(){this.clear(),this.root.remove()}}const fx=()=>`native-subtitle-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,gx=e=>u({},e);class yx extends Lr{constructor(e){var t;super(),this.options=e,this.mappings=[],this.ids=new WeakMap,this.selectedId=null,this.hiddenSelectionId=null,this.cueTrack=null,this.nativeFullscreen=!1,this.pictureInPicture=!1,this.remotePlayback=!1,this.destroyed=!1,this.refreshTracks=()=>{var e;if(this.destroyed)return;const t=this.options.media.textTracks,i=[];for(let o=0;o<(null!=(e=null==t?void 0:t.length)?e:0);o++){const e=t[o];if(!e||!["subtitles","captions"].includes(e.kind))continue;let n=this.ids.get(e);n||(n=this.createOpaqueId(),this.ids.set(e,n));const r=this.mappings.find((t=>t.track===e));i.push({track:e,item:c(u({id:n},e.language?{language:e.language}:{}),{text:e.label||e.language||"Subtitle",isDefault:"showing"===e.mode||!0===(null==r?void 0:r.item.isDefault),source:"hls",forced:!1})})}this.mappings=i;let n=this.findById(this.selectedId);if(n||null===this.selectedId||(this.selectedId=null,this.detachCueTrack(),this.options.renderer.clear(),this.emit("off")),!n){const e=this.mappings.find((e=>"showing"===e.track.mode));e&&(this.selectedId=e.item.id,this.hiddenSelectionId=this.selectedId,this.applySelectedTrack(e),n=e)}const r=this.getTracks();this.emit("reset",{list:r,isOpen:!!n}),this.options.emit(HD.HLS_SUBTITLE_TRACKS_UPDATED,{playbackSessionId:this.playbackSessionId,playbackEngine:"native",tracks:r})},this.onCueChange=()=>{this.renderActiveCues()},this.onNativeFullscreenStart=()=>{this.nativeFullscreen=!0,this.applyPresentationMode()},this.onNativeFullscreenEnd=()=>{this.nativeFullscreen=!1,this.applyPresentationMode()},this.onPictureInPictureStart=()=>{this.pictureInPicture=!0,this.applyPresentationMode()},this.onPictureInPictureEnd=()=>{this.pictureInPicture=!1,this.applyPresentationMode()},this.onPresentationModeChanged=()=>{const e=this.options.media.webkitPresentationMode;this.pictureInPicture="picture-in-picture"===e,this.nativeFullscreen="fullscreen"===e,this.applyPresentationMode()},this.onRemoteStart=()=>{this.remotePlayback=!0,this.applyPresentationMode()},this.onRemoteEnd=()=>{this.remotePlayback=!1,this.applyPresentationMode()},this.createOpaqueId=null!=(t=e.createOpaqueId)?t:fx,this.playbackSessionId=e.playbackSessionId,this.bind(),this.refreshTracks()}getTracks(){return this.mappings.map((e=>gx(e.item)))}refresh(){this.refreshTracks()}setPlaybackSessionId(e){this.playbackSessionId=e}switch(e){let t;try{t=this.resolveTarget(e)}catch(oF){return Promise.reject(oF)}const i=this.selectedId,n=t.item.id,r=gx(t.item);return this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHING,{playbackSessionId:this.playbackSessionId,playbackEngine:"native",from:i,to:n,track:r}),this.selectedId=n,this.hiddenSelectionId=n,this.applySelectedTrack(t),this.emit("change",r),this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHED,{playbackSessionId:this.playbackSessionId,playbackEngine:"native",from:i,to:n,track:gx(r)}),Promise.resolve({code:0})}switchOff(){const e=this.selectedId;null!==e&&(this.hiddenSelectionId=e),this.selectedId=null,this.detachCueTrack(),this.mappings.forEach((e=>{e.track.mode="disabled"})),this.options.renderer.clear(),this.emit("off"),this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHED,{playbackSessionId:this.playbackSessionId,playbackEngine:"native",from:e,to:null})}show(){var e,t;const i=null!=(t=null!=(e=this.findById(this.hiddenSelectionId))?e:this.mappings.find((e=>e.item.isDefault)))?t:this.mappings[0];return i?this.switch({id:i.item.id}):Promise.resolve({code:0})}destroy(){this.destroyed||(this.destroyed=!0,this.unbind(),this.detachCueTrack(),this.mappings.forEach((e=>{e.track.mode="disabled"})),this.mappings=[],this.selectedId=null,this.hiddenSelectionId=null,this.options.renderer.destroy(),this.removeAllListeners())}resolveTarget(e){if(void 0!==e.id&&null!==e.id&&""!==e.id){const t=this.findById(e.id);if(t)return t;throw new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The native HLS subtitle track was not found.")}if(void 0!==e.language&&null!==e.language&&""!==e.language){const t=this.mappings.filter((t=>String(t.item.language)===String(e.language)));if(1===t.length)return t[0];if(t.length>1)throw new sr("HLS_SUBTITLE_TRACK_AMBIGUOUS","More than one native HLS subtitle track uses the requested language.")}throw new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The native HLS subtitle track was not found.")}findById(e){if(null!=e&&""!==e)return this.mappings.find((t=>String(t.item.id)===String(e)))}applySelectedTrack(e){if(this.detachCueTrack(),this.mappings.forEach((t=>{t!==e&&(t.track.mode="disabled")})),this.canUseDomMode(e.track)&&(e.track.mode="hidden","hidden"===e.track.mode))return this.cueTrack=e.track,e.track.addEventListener("cuechange",this.onCueChange),void this.renderActiveCues();e.track.mode="showing",this.options.renderer.clear()}canUseDomMode(e){var t,i;const n=this.options.media,r=!!n.playsInline||!0===(null==(t=n.hasAttribute)?void 0:t.call(n,"playsinline")),o=null==(i=n.remote)?void 0:i.state,s=this.nativeFullscreen||!!n.webkitDisplayingFullscreen,a=this.pictureInPicture||document.pictureInPictureElement===n,l=this.remotePlayback||"connecting"===o||"connected"===o;if(!r||s||a||l)return!1;try{return e.activeCues,"function"==typeof e.addEventListener}catch(u){return!1}}renderActiveCues(){var e;if(!this.cueTrack)return void this.options.renderer.clear();let t=[];try{t=Array.from(null!=(e=this.cueTrack.activeCues)?e:[]).flatMap((e=>{const t=e.text;return"string"==typeof t?[{text:t}]:[]}))}catch(i){t=[]}this.options.renderer.render(t)}detachCueTrack(){var e,t;null==(t=null==(e=this.cueTrack)?void 0:e.removeEventListener)||t.call(e,"cuechange",this.onCueChange),this.cueTrack=null}applyPresentationMode(){const e=this.findById(this.selectedId);e&&this.applySelectedTrack(e)}bind(){var e,t,i,n,r,o,s,a,l;const u=this.options.media;null==(t=null==(e=u.textTracks)?void 0:e.addEventListener)||t.call(e,"addtrack",this.refreshTracks),null==(n=null==(i=u.textTracks)?void 0:i.addEventListener)||n.call(i,"removetrack",this.refreshTracks),null==(o=null==(r=u.textTracks)?void 0:r.addEventListener)||o.call(r,"change",this.refreshTracks),u.addEventListener("webkitbeginfullscreen",this.onNativeFullscreenStart),u.addEventListener("webkitendfullscreen",this.onNativeFullscreenEnd),u.addEventListener("enterpictureinpicture",this.onPictureInPictureStart),u.addEventListener("leavepictureinpicture",this.onPictureInPictureEnd),u.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChanged);const c=u.remote;null==(s=null==c?void 0:c.addEventListener)||s.call(c,"connecting",this.onRemoteStart),null==(a=null==c?void 0:c.addEventListener)||a.call(c,"connect",this.onRemoteStart),null==(l=null==c?void 0:c.addEventListener)||l.call(c,"disconnect",this.onRemoteEnd)}unbind(){var e,t,i,n,r,o,s,a,l;const u=this.options.media;null==(t=null==(e=u.textTracks)?void 0:e.removeEventListener)||t.call(e,"addtrack",this.refreshTracks),null==(n=null==(i=u.textTracks)?void 0:i.removeEventListener)||n.call(i,"removetrack",this.refreshTracks),null==(o=null==(r=u.textTracks)?void 0:r.removeEventListener)||o.call(r,"change",this.refreshTracks),u.removeEventListener("webkitbeginfullscreen",this.onNativeFullscreenStart),u.removeEventListener("webkitendfullscreen",this.onNativeFullscreenEnd),u.removeEventListener("enterpictureinpicture",this.onPictureInPictureStart),u.removeEventListener("leavepictureinpicture",this.onPictureInPictureEnd),u.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChanged);const c=u.remote;null==(s=null==c?void 0:c.removeEventListener)||s.call(c,"connecting",this.onRemoteStart),null==(a=null==c?void 0:c.removeEventListener)||a.call(c,"connect",this.onRemoteStart),null==(l=null==c?void 0:c.removeEventListener)||l.call(c,"disconnect",this.onRemoteEnd)}}class vx extends Lr{constructor(e,t={}){var i,n;if(super(),this._onChange=e=>{const t=this._media.textTracks;if(!t||0===t.length)return;const i=[],n=[];let r=-1;for(let o=0;o<t.length;o++){const e=t[o];"subtitles"===e.kind&&(i.push({id:e.id||e.language,language:e.language,text:e.label,isDefault:"showing"===e.mode}),-1===r&&"showing"===e.mode&&(r=o),n.push(e.language))}n.join("|")!==this._languages?(this._languages=n.join("|"),this.emit("reset",{list:i,isOpen:r>-1})):-1===r?this.emit("off"):this.curIndex!==r&&this.emit("change",i[r]),this.curIndex=r},this._media=e,this._list=[],this._languages="",this.curIndex=-1,"dom"===t.nativeRenderMode&&t.container){const r=new px(t.container,t.style);this._domAdapter=new yx({media:e,playbackSessionId:null!=(i=t.playbackSessionId)?i:"",renderer:r,emit:null!=(n=t.emit)?n:()=>{},createOpaqueId:t.createOpaqueId}),this._domAdapter.on("off",(()=>this.emit("off"))),this._domAdapter.on("change",(e=>this.emit("change",e))),this._domAdapter.on("reset",(e=>this.emit("reset",e)))}this._init()}_init(){if(this._domAdapter)return;const e=this._media.textTracks;e?(e.addEventListener("change",this._onChange),e.addEventListener("addtrack",this._onChange)):aa.warn("current browser not support native subtitle")}switch(e){return this._domAdapter?this._domAdapter.switch(e):new Promise(((t,i)=>{if(!e)return i({code:1,message:"no subtitle data"});const n=this._media.textTracks;for(let r=0;r<n.length;r++){const t=n[r];t.language===e.language?t.mode="showing":"showing"===t.mode&&(t.mode="disabled")}return t({code:0})}))}switchOff(){if(this._domAdapter)return void this._domAdapter.switchOff();const e=this._media.textTracks;for(let t=0;t<e.length;t++)e[t].mode="disabled";this.curIndex=-1}destroy(){if(this._domAdapter)return this._domAdapter.destroy(),this._domAdapter=void 0,this._media=null,this._list=[],this._languages="",void(this.curIndex=-1);this._media.textTracks.removeEventListener("change",this._onChange),this._media=null,this._list=[],this._languages="",this.curIndex=-1}refresh(){this._domAdapter?this._domAdapter.refresh():this._onChange(null)}setPlaybackSessionId(e){var t;null==(t=this._domAdapter)||t.setPlaybackSessionId(e)}}function mx(){return(new DOMParser).parseFromString('<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0.5C0.895431 0.5 0 1.39543 0 2.5V13.5C0 14.6046 0.89543 15.5 2 15.5H16C17.1046 15.5 18 14.6046 18 13.5V2.5C18 1.39543 17.1046 0.5 16 0.5H2ZM7.49634 11.0454C8.00741 10.606 8.29061 10.0037 8.34595 9.23877H6.8811C6.84855 9.67171 6.71997 9.99235 6.49536 10.2007C6.27401 10.4058 5.93709 10.5083 5.48462 10.5083C4.98332 10.5083 4.61548 10.3309 4.3811 9.97607C4.14998 9.62126 4.03442 9.05973 4.03442 8.2915V7.75439C4.04093 7.01872 4.16463 6.47673 4.40552 6.12842C4.64966 5.77686 5.01587 5.60107 5.50415 5.60107C5.95337 5.60107 6.28703 5.70524 6.50513 5.91357C6.72648 6.11865 6.85506 6.45068 6.89087 6.90967H8.35571C8.27759 6.1154 7.98787 5.49854 7.48657 5.05908C6.98527 4.61963 6.32446 4.3999 5.50415 4.3999C4.9117 4.3999 4.39087 4.53988 3.94165 4.81982C3.49569 5.09652 3.15226 5.49528 2.91138 6.01611C2.67049 6.53695 2.55005 7.13916 2.55005 7.82275V8.25732C2.55005 9.32829 2.81047 10.1714 3.3313 10.7866C3.85539 11.3986 4.57316 11.7046 5.48462 11.7046C6.31795 11.7046 6.98853 11.4849 7.49634 11.0454ZM14.5393 11.0454C15.0504 10.606 15.3336 10.0037 15.3889 9.23877H13.9241C13.8915 9.67171 13.7629 9.99235 13.5383 10.2007C13.317 10.4058 12.9801 10.5083 12.5276 10.5083C12.0263 10.5083 11.6584 10.3309 11.4241 9.97607C11.193 9.62126 11.0774 9.05973 11.0774 8.2915V7.75439C11.0839 7.01872 11.2076 6.47673 11.4485 6.12842C11.6926 5.77686 12.0588 5.60107 12.5471 5.60107C12.9963 5.60107 13.33 5.70524 13.5481 5.91357C13.7695 6.11865 13.898 6.45068 13.9338 6.90967H15.3987C15.3206 6.1154 15.0308 5.49854 14.5295 5.05908C14.0282 4.61963 13.3674 4.3999 12.5471 4.3999C11.9547 4.3999 11.4338 4.53988 10.9846 4.81982C10.5387 5.09652 10.1952 5.49528 9.95435 6.01611C9.71346 6.53695 9.59302 7.13916 9.59302 7.82275V8.25732C9.59302 9.32829 9.85343 10.1714 10.3743 10.7866C10.8984 11.3986 11.6161 11.7046 12.5276 11.7046C13.3609 11.7046 14.0315 11.4849 14.5393 11.0454Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}function _x(){return(new DOMParser).parseFromString('<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49609 11.0454C8.00716 10.606 8.29037 10.0037 8.3457 9.23877H6.88086C6.84831 9.67171 6.71973 9.99235 6.49512 10.2007C6.27376 10.4058 5.93685 10.5083 5.48438 10.5083C4.98307 10.5083 4.61523 10.3309 4.38086 9.97607C4.14974 9.62126 4.03418 9.05973 4.03418 8.2915V7.75439C4.04069 7.01872 4.16439 6.47673 4.40527 6.12842C4.64941 5.77686 5.01562 5.60107 5.50391 5.60107C5.95312 5.60107 6.28678 5.70524 6.50488 5.91357C6.72624 6.11865 6.85482 6.45068 6.89062 6.90967H8.35547C8.27734 6.1154 7.98763 5.49854 7.48633 5.05908C6.98503 4.61963 6.32422 4.3999 5.50391 4.3999C4.91146 4.3999 4.39062 4.53988 3.94141 4.81982C3.49544 5.09652 3.15202 5.49528 2.91113 6.01611C2.67025 6.53695 2.5498 7.13916 2.5498 7.82275V8.25732C2.5498 9.32829 2.81022 10.1714 3.33105 10.7866C3.85514 11.3986 4.57292 11.7046 5.48438 11.7046C6.31771 11.7046 6.98828 11.4849 7.49609 11.0454Z" fill="white"/>\n<path d="M14.5391 11.0454C15.0501 10.606 15.3333 10.0037 15.3887 9.23877H13.9238C13.8913 9.67171 13.7627 9.99235 13.5381 10.2007C13.3167 10.4058 12.9798 10.5083 12.5273 10.5083C12.026 10.5083 11.6582 10.3309 11.4238 9.97607C11.1927 9.62126 11.0771 9.05973 11.0771 8.2915V7.75439C11.0837 7.01872 11.2074 6.47673 11.4482 6.12842C11.6924 5.77686 12.0586 5.60107 12.5469 5.60107C12.9961 5.60107 13.3298 5.70524 13.5479 5.91357C13.7692 6.11865 13.8978 6.45068 13.9336 6.90967H15.3984C15.3203 6.1154 15.0306 5.49854 14.5293 5.05908C14.028 4.61963 13.3672 4.3999 12.5469 4.3999C11.9544 4.3999 11.4336 4.53988 10.9844 4.81982C10.5384 5.09652 10.195 5.49528 9.9541 6.01611C9.71322 6.53695 9.59277 7.13916 9.59277 7.82275V8.25732C9.59277 9.32829 9.85319 10.1714 10.374 10.7866C10.8981 11.3986 11.6159 11.7046 12.5273 11.7046C13.3607 11.7046 14.0312 11.4849 14.5391 11.0454Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.5C0 1.39543 0.895431 0.5 2 0.5H16C17.1046 0.5 18 1.39543 18 2.5V13.5C18 14.6046 17.1046 15.5 16 15.5H2C0.89543 15.5 0 14.6046 0 13.5V2.5ZM2 2.3H16C16.1105 2.3 16.2 2.38954 16.2 2.5V13.5C16.2 13.6105 16.1105 13.7 16 13.7H2C1.88954 13.7 1.8 13.6105 1.8 13.5V2.5C1.8 2.38954 1.88954 2.3 2 2.3Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:Ex}=bs,Tx="mobile"===Kr.device,Sx="text-close",bx=new WeakSet;class kx extends LD{renderItemList(e){var t;const i=this;e&&(i.config.data=e);const n=null!=(t=null!=e?e:i.config.data)?t:[];n.length>0&&(i.attrKeys=Object.keys(n[0])),i.root.replaceChildren(),n.forEach(((e,t)=>{var n;const r=e.selected?"option-item selected":"option-item";e["data-index"]=t;const o=Ur.createDom("li","",e,r),s=document.createElement("span");s.textContent=String(null!=(n=e.showText)?n:""),o.appendChild(s),i.root.appendChild(o)}))}}function Cx(e=[]){let t=-1;return e.map(((e,i)=>{!e.source&&(e.source="config"),e.id||e.language||(e.id=""+i),!e.url&&(e.url=e.src),!e.text&&(e.text=e.label),!e.language&&(e.language=e.srclang),void 0===e.isDefault&&(e.isDefault=e.default),(e.isDefault||e.default)&&(t<0?t=i:e.isDefault=e.default=!1)})),t}class Ix extends bs{constructor(e){super(e),this.isOpenState=!0,this.optionList=null,this.currentLang="",this._hideListTimer=null,this._runtimeSubtitleSource="config",this._onOff=()=>{"hls"!==this._runtimeSubtitleSource&&this.noShowSubtitle()},this._onChange=e=>{if("hls"===this._runtimeSubtitleSource)return;const t=this.getSubTitleIndex(this.config.list,e);t<0||this.updateCurItem(t,e)},this._onListReset=e=>{"hls"!==this._runtimeSubtitleSource&&this.updateList(e)},this.handleButtonChange=e=>{e.preventDefault(),e.stopPropagation(),e.delegateTarget||(Tx?this.showMobilePanel():this.isOpenState?this.switchOffSubtitle():this.runUiSubtitleAction(this.openSubtitle().then((()=>this.showList()))))},this.onEnter=e=>{e.stopPropagation(),this.emit("icon_mouseenter",{pluginName:this.pluginName}),this.clearPendingListHide(),this.showList()},this.onLeave=e=>{e.stopPropagation(),this.emit("icon_mouseleave",{pluginName:this.pluginName}),this.scheduleListHide()},this.handlerClickSwitch=(e,t)=>{e.stopPropagation(),e.preventDefault(),this.subTitles&&(t.type===Sx?this.switchOffSubtitle():this.runUiSubtitleAction(this.switchSubTitle({language:t.language,id:t.id})))},this.onPlayerFocus=e=>{this.subTitles&&this.config.style.follow&&this.rePosition()},this.onPlayerBlur=e=>{this.subTitles&&this.config.style.follow&&!this.playerConfig.marginControls&&this.subTitles.root&&(this.subTitles.root.style.transform="translate(0, 0)")};const{player:t,config:i}=e;t.config.isLive&&(e.config.updateMode="live",Kr.os.isIos&&(e.config.mode="native"))}static get pluginName(){return"Subtitle"}static get defaultConfig(){return{position:Ex.CONTROLS_RIGHT,index:zD,list:[],isDefaultOpen:!0,style:{follow:!0,mode:"stroke",followBottom:50,fitVideo:!0,offsetBottom:4,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,line:"double",fontColor:"#fff"},isShowIcon:!0,mode:"external",nativeRenderMode:"system",updateMode:"vod"}}afterCreate(){const{list:e=[]}=this.config;this.curIndex=-1,this.curItem=null;const t=Cx(e);super.afterCreate(),"native"===this.config.mode?this._initNativeSubtitle(t):this._initExtSubTitle(t),e.length||this.hide()}_initNativeSubtitle(e){var t,i,n,r,o,s,a,l,u,c,h,d,p;const{player:f}=this;if(!f._subTitles){const e=String(null!=(i=null==(t=f.config)?void 0:t.streamType)?i:"").toLowerCase(),d=null==(n=f.config)?void 0:n.url,p="hls"===e||"string"==typeof d&&d.split(/[?#]/,1)[0].toLowerCase().endsWith(".m3u8"),g=!(!(null==(o=null==(r=f.plugins)?void 0:r.hls)?void 0:o.hls)&&!(null==(a=null==(s=f.plugins)?void 0:s.encrypthlsplugin)?void 0:a.hls)),y="dom"===this.config.nativeRenderMode&&Kr.os.isIos&&p&&!g?"dom":"system";f._subTitles=new vx(f.video,{nativeRenderMode:y,container:f.root,style:this.config.style,playbackSessionId:null!=(h=null==(c=null==(u=null==(l=f.sdk)?void 0:l.getHlsLevelState)?void 0:u.call(l))?void 0:c.playbackSessionId)?h:"",emit:(e,t)=>{var i,n;return null==(n=null==(i=f.sdk)?void 0:i.emit)?void 0:n.call(i,e,t)}})}this.subTitles=f._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("reset",this._onListReset),null==(p=(d=this.subTitles).refresh)||p.call(d),this._renderList(e)}_initExtSubTitle(e){const{list:t=[],style:i,isDefaultOpen:n,updateMode:r,renderMode:o}=this.config,s={subTitles:t,defaultOpen:n,debugger:!1,renderMode:o,updateMode:r};this.isOpenState=n,Object.keys(i).map((e=>{s[e]=i[e]}));!this.playerConfig.marginControls&&this.player.controls.root&&(this.on(ho,this.onPlayerFocus),this.on(po,this.onPlayerBlur));const{player:a}=this;if(a._subTitles)a._subTitles._isOpen&&(e=this.getSubTitleIndex(this.config.list,a._subTitles.currentText));else{const e=new dx(s);this.protectExtSubtitleCoreEvents(e),a._subTitles=e,e.attachPlayer(this.player),this.changeTipText()}this.subTitles=a._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("reset",this._onListReset),i.follow&&this.subTitles.root&&Ur.addClass(this.subTitles.root,"follow-control"),this._renderList(e)}protectExtSubtitleCoreEvents(e){const t=e;if(bx.has(t)||"function"!=typeof t._onCoreEvents)return;const i=t._onCoreEvents;t._onCoreEvents=e=>{if("core.subtitlesegments"===(null==e?void 0:e.eventName)&&(!Array.isArray(e.list)||0===e.list.length))return;if("core.subtitlesegments"!==(null==e?void 0:e.eventName))return void i.call(t,e);const n=e.list.map((e=>{var i,n;if(!e||e.lang||e.language)return e;const r=Number(e.level),o=null==(n=null==(i=t.textTrack)?void 0:i[r])?void 0:n.language;return o?c(u({},e),{url:e.url,lang:o}):e}));i.call(t,c(u({},e),{list:n}))},bx.add(t)}_renderList(e){const{list:t=[],isDefaultOpen:i}=this.config;t.length&&(e<0?(t[0].isDefault=!0,this.curIndex=0,this.curItem=t[0]):(this.curIndex=e,this.curItem=t[e])),this.appendChild(".xgplayer-icon",this.icons.vttSubOpen),this.appendChild(".xgplayer-icon",this.icons.vttSubClose),this.creatOptionList(),this.initEvents(),this.isOpenState?Ur.addClass(this.root,"isOpen"):Ur.addClass(this.root,"isClose"),!1===this.config.isShowIcon&&this.hide()}updateCurItem(e,t){this.curIndex=e,this.curItem=this.config.list[e],this.renderItemList(),this.emit("subtitle_change",u({off:!1,isListUpdate:!1,list:[]},t))}initEvents(){this.bind(["click"],this.handleButtonChange),this.bind(["mouseenter"],this.onEnter),this.bind(["mouseleave"],this.onLeave),this._delegates=[]}runUiSubtitleAction(e){e.catch((()=>{aa.error("subtitle UI action failed")}))}clearPendingListHide(){null!==this._hideListTimer&&void 0!==this._hideListTimer&&(clearTimeout(this._hideListTimer),this._hideListTimer=null)}scheduleListHide(){this.clearPendingListHide(),this._hideListTimer=setTimeout((()=>{var e,t,i,n,r,o,s;this._hideListTimer=null;const a=null!=(i=null==(t=null==(e=this.root)?void 0:e.matches)?void 0:t.call(e,":hover"))&&i,l=null!=(s=null==(o=null==(r=null==(n=this.optionList)?void 0:n.root)?void 0:r.matches)?void 0:o.call(r,":hover"))&&s;a||l||this.hideList()}),150)}bindOptionListHoverEvents(){var e;const t=null==(e=this.optionList)?void 0:e.root;t&&(this._optionListEnterHandler=e=>{e.stopPropagation(),this.clearPendingListHide()},this._optionListLeaveHandler=e=>{e.stopPropagation(),this.scheduleListHide()},t.addEventListener("mouseenter",this._optionListEnterHandler),t.addEventListener("mouseleave",this._optionListLeaveHandler))}unbindOptionListHoverEvents(){var e;const t=null==(e=this.optionList)?void 0:e.root;t&&this._optionListEnterHandler&&t.removeEventListener("mouseenter",this._optionListEnterHandler),t&&this._optionListLeaveHandler&&t.removeEventListener("mouseleave",this._optionListLeaveHandler),this._optionListEnterHandler=void 0,this._optionListLeaveHandler=void 0}showList(){var e;!Tx&&this.isOpenState&&(null==(e=this.optionList)||e.show())}hideList(){var e;!Tx&&this.isOpenState&&(null==(e=this.optionList)||e.hide())}openSubtitle(){return this.curIndex<0&&(this.curIndex=0,this.curItem=this.config.list[0]),this.curIndex>-1&&this.curItem?this.switchSubTitle(this.curItem):Promise.resolve(void 0)}getSubTitleIndex(e,t={id:"",language:""}){if(!t||!t.id&&!t.language)return-1;if(void 0!==t.id&&null!==t.id&&""!==t.id)return e.findIndex((e=>String(e.id)===String(t.id)));const i=e.reduce(((e,i,n)=>(String(i.language)===String(t.language)&&e.push(n),e)),[]);return 1===i.length?i[0]:i.length>1?-2:-1}setRuntimeSubtitleSource(e){this._runtimeSubtitleSource=e}setRuntimeSubtitleBridge(e){this._runtimeSubtitleBridge=e}replaceRuntimeSubtitleList(e,t){this.setRuntimeSubtitleSource("hls"),this.updateList({list:e.map((e=>c(u({},e),{source:"hls"}))),isOpen:t})}confirmRuntimeSubtitleSelection(e){if(!e)return void this.noShowSubtitle();const t=this.getSubTitleIndex(this.config.list,{id:e.id});t<0||(this.isOpenState=!0,Ur.removeClass(this.root,"isClose"),Ur.addClass(this.root,"isOpen"),this.updateCurItem(t,e),this.changeTipText())}syncRuntimeSubtitleRenderer(e){var t,i;try{const n=this.subTitles,r=null==(t=null==n?void 0:n.textTrack)?void 0:t[e];if(!r||"function"!=typeof(null==n?void 0:n._updateCurrent))return;n._loadingTrack={},n._updateCurrent(r),null==(i=n.switchOn)||i.call(n),Array.isArray(r.url)&&r.url.length>0&&"function"==typeof n._loadTrack&&Promise.resolve(n._loadTrack(r)).then((e=>{var t;n.currentText===r&&(null==(t=n.addStyles)||t.call(n,e),n._updateCurrent(e))})).catch((()=>{aa.error("load queued HLS subtitle segments failed")}))}catch(n){aa.error("sync HLS subtitle renderer failed")}}clearRuntimeSubtitleView(){var e,t;null==(t=null==(e=this.subTitles)?void 0:e.switchOff)||t.call(e)}registerIcons(){return{vttSubOpen:{icon:mx,class:"xgplayer-vttsub-open-svg"},vttSubClose:{icon:_x,class:"xgplayer-vttsub-close-svg"}}}registerLanguageTexts(){return{sub:{jp:"字幕",en:"Subtitles",zh:"字幕","zh-hk":"字幕"},subOpen:{jp:"字幕をオンにする",en:"Show subtitles",zh:"开启字幕","zh-hk":"開啟字幕"},subClose:{jp:"クローズドキャプション",en:"Hide subtitles",zh:"关闭字幕","zh-hk":"關閉字幕"}}}creatOptionList(){if(Tx)return;const e={config:{data:this.getList(),className:"",onItemClick:(e,t)=>{this.handlerClickSwitch(e,null==t?void 0:t.to)}},root:this.root};this.optionList=new kx(e),this.bindOptionListHoverEvents()}getList(){return this.config.list.map(((e,t)=>(t===this.curIndex&&this.isOpenState?(e.isCurrent=!0,e.selected=!0):(e.isCurrent=!1,e.selected=!1),e.showText=this.getTextByLang(e),e)))}renderOptionList(){this.optionList.renderItemList(this.getList())}switchSubTitle(e={id:"",language:""}){if(!e||!e.id&&!e.language)return Promise.reject(new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The subtitle track was not found."));const t=this.getSubTitleIndex(this.config.list,e);if(-2===t)return Promise.reject(new sr("HLS_SUBTITLE_TRACK_AMBIGUOUS","More than one subtitle track uses the requested language."));if(t<0)return Promise.reject(new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The subtitle track was not found."));if(this.isOpenState&&t===this.curIndex)return Promise.resolve(void 0);const i=this.config.list[t];if("hls"===this._runtimeSubtitleSource){if(!this._runtimeSubtitleBridge)return Promise.reject(new sr("HLS_SUBTITLE_SWITCH_FAILED","The HLS subtitle bridge is unavailable."));const e=i.id?{id:i.id}:{language:i.language};return this._runtimeSubtitleBridge.switchSubtitle(e)}return this.subTitles.switch(i).then((n=>{0===n.code&&(e.off=!1,e.isListUpdate=!1,e.list=[],this.curIndex=t,this.curItem=i,this.isOpenState=!0,Ur.removeClass(this.root,"isClose"),Ur.addClass(this.root,"isOpen"),this.renderItemList(),this.changeTipText(),this.emit("subtitle_change",e))})).catch((e=>{throw aa.error("switch subtitle failed"),e}))}switchOffSubtitle(){"hls"===this._runtimeSubtitleSource&&this._runtimeSubtitleBridge?this._runtimeSubtitleBridge.hide():(this.subTitles.switchOff(),this.noShowSubtitle())}noShowSubtitle(){var e;this.emit("subtitle_change",{off:!0,isListUpdate:!1,list:[]}),this.isOpenState=!1,Ur.addClass(this.root,"isClose"),Ur.removeClass(this.root,"isOpen"),this.renderItemList(),this.changeTipText(),null==(e=this.optionList)||e.hide()}renderItemList(){Tx?this.updatePanel():this.renderOptionList()}updateSubtitles(e=[],t=!0){if(!e)return;this.setRuntimeSubtitleSource("config");const i=e.map((e=>c(u({},e),{source:"config"}))),n=this.curIndex>-1||this.config.isDefaultOpen;this.updateList({list:i,isOpen:n}),this.subTitles&&this.subTitles.setSubTitles(this.config.list,n,t)}updateList(e={}){var t,i,n,r,o,s,a;if(!e.list)return;const l=!(Tx||!e.isOpen||!(null==(n=null==(i=null==(t=this.optionList)?void 0:t.root)?void 0:i.classList)?void 0:n.contains("active")));e.list.length>0&&!1!==this.config.isShowIcon&&this.show();const u=[];e.list.map((e=>{u.push(e)}));const c=Cx(u);e.isOpen?(this.isOpenState=!0,this.curIndex=c,this.curItem=c>-1?u[c]:null,Ur.removeClass(this.root,"isClose"),Ur.addClass(this.root,"isOpen")):(this.isOpenState=!1,this.curIndex=-1,this.curItem=null,Ur.removeClass(this.root,"isOpen"),Ur.addClass(this.root,"isClose"),this.changeTipText(),null==(r=this.optionList)||r.hide()),this.config.list=u,u.length>0?Tx||l||null==(o=this.optionList)||o.hide():(this.switchOffSubtitle(),Tx?this.showMobilePanel():null==(s=this.optionList)||s.show(),Tx||null==(a=this.optionList)||a.hide(),this.hide()),this.renderItemList()}changeTipText(){this.isOpenState?this.find(".xg-tips").innerHTML=this.langText.subClose:this.find(".xg-tips").innerHTML=this.langText.subOpen}showMobilePanel(){var e;const t=this.renderPanel();null==(e=this.player.panel)||e.showPanel(t,this.langText.sub,!0)}updatePanel(){var e;const t=this.renderPanel();null==(e=this.player.panel)||e.updatePanel(t)}renderPanel(){const e=[...this.config.list],t=Ur.createDom("div","",{},"ai-panel-content");e.map(((e,i)=>{const n=u({language:e.language||e.srclang,"data-id":e.id,selected:this.isOpenState&&this.curIndex===i,showText:this.getTextByLang(e)},e),r=this.renderPanelItem(n);t.appendChild(r)}));const i={showText:this.langText.subClose,"data-type":Sx,selected:!this.isOpenState};return t.appendChild(this.renderPanelItem(i)),t}renderPanelItem(e){const{showText:t,selected:i}=e,n=Ur.createDom("div","",{language:e.language,"data-id":e["data-id"],"data-type":e["data-type"]},"panel-Item "+(i?"select-in":""));n.textContent=t;const r=Tx?"touchend":"click",o=bs.delegate(n,".panel-Item",r,(t=>{e["data-type"]===Sx?(t.stopPropagation(),t.preventDefault(),this.switchOffSubtitle()):this.handlerClickSwitch(t,e)}));return this._delegates.push(o),n}getTextByLang(e,t,i){if(void 0===e)return"";const{list:n}=this.config;return!i&&(i=this.player.lang),t=!t||Ur.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]),"object"==typeof e[t]?e[t][i]||e[t].zh:e[t]||""}rePosition(){const{fitVideo:e}=this.config.style,t=0-this.player.controls.root.getBoundingClientRect().height;if(!e)return void(this.subTitles.root.style.transform=`translate(0, ${t}px)`);const{video:i,root:n}=this.player,{height:r,width:o}=n.getBoundingClientRect(),{videoHeight:s,videoWidth:a}=i;let l=parseInt(s/a*100,10)*o/100;l>r&&(l=r);const u=(r-l)/2-t;u<0&&(this.subTitles.root.style.transform=`translate(0, ${u}px)`)}destroy(){var e;this.subTitles&&(this.subTitles.destroy(),this.subTitles=null),this.unbind(["click"],this.handleButtonChange),this.unbind(["mouseenter"],this.onEnter),this.unbind(["mouseleave"],this.onLeave),this.clearPendingListHide(),this.unbindOptionListHoverEvents(),null==(e=this.optionList)||e.destroy(),this._delegates&&this._delegates.length>0&&(this._delegates.map((e=>{Array.isArray(e)&&e.map((e=>{e.destroy&&e.destroy()})),e.destroy&&e.destroy()})),this._delegates=null),super.destroy()}render(){var e;return`\n <xg-icon class="xgplayer-vttsub"${!1===this.config.isShowIcon||!(null==(e=this.config.list)?void 0:e.length)?' style="display: none;"':""}>\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="vttSubOpen">${this.langText.subOpen}</div>\n </xg-icon>\n `}}const Ax=class extends bs{constructor(e){super(e),this.toastNumber=0,this.toastMaps={}}static get pluginName(){return"sdkToastPlugin"}static get defaultConfig(){return{index:5}}beforePlayerInit(){}afterPlayerInit(){}afterCreate(){}destroy(){}add(e,t=2e3,i=!1){const n=this.toastNumber+1;this.toastNumber=n;const r=this.renderToast(e,i,n);return this.root.appendChild(r),this.toastMaps[n]=r,t&&setTimeout((()=>{this.remove(n)}),t),n}remove(e){const t=this.toastMaps[e];t&&(this.root.contains(t)&&this.root.removeChild(t),delete this.toastMaps[e])}renderToast(e,t,i){const n=Ur.createDom("div","",void 0,"toast-container"),r=Ur.checkIsObject(e)?e:Ur.createDom("div",e,void 0,"toast-txt");if(n.appendChild(r),t){const e=Ur.createDom("span","×",void 0,"toast-close-bt");e.addEventListener("click",(()=>{this.remove(i)})),n.appendChild(e)}return n}render(){return'<xg-sdk-toast class="xgplayer-sdk-toast"></xg-sdk-toast>'}};function Px(){return(new Date).getTime()}var wx="loadstart",Dx="loadeddata",Lx="firstFrame",Rx="waitingStart",xx="waitingEnd",Ox="seekStart",Nx="seekEnd",Mx=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"_onTimeupdate",(function(){e._state.isTimeUpdate=!0,e._state.autoplayStart&&(Nr.logInfo("[xgLogger]".concat(e.player.playerId," _onTimeupdate")),e._sendFF("onTimeupdate"))})),mr(Sr(e),"_onAutoplayStart",(function(){Nr.logInfo("[xgLogger]".concat(e.player.playerId," _onAutoplayStart")),e._state.autoplayStart=!0,e.vt&&e._sendFF("onAutoplayStart")})),mr(Sr(e),"_onReset",(function(){e._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},e.vt=0,e.pt=0,e.fvt=0,e.newPointTime=Px(),e.loadedCostTime=0,e.startCostTime=0,e._isSeeking=!1,e.seekingStart=0,e.waitingStart=0,e.fixedWaitingStart=0,e._isWaiting=!1,e._waitTimer&&Ur.clearTimeout(Sr(e),e._waitTimer),e._waittTimer&&Ur.clearTimeout(Sr(e),e._waittTimer),e._waitTimer=null,e._waittTimer=null,e._waitType=0})),mr(Sr(e),"_onSeeking",(function(){e.seekingStart||(e.suspendWaitingStatus("seek"),e.seekingStart=Px(),e.emitLog(Ox,{start:Px()}))})),mr(Sr(e),"_onSeeked",(function(){e.suspendSeekingStatus("seeked")})),mr(Sr(e),"_onWaitingLoadStart",(function(){e._isWaiting||e.vt||(e._isWaiting=!0,e.waitingStart=Px(),e.fixedWaitingStart=Px(),e._waitType=1,e.emitLog(Rx,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:1,endType:"loadstart"}))})),mr(Sr(e),"_onWaiting",(function(){!e._isWaiting&&e.vt&&(e._isWaiting=!0,e.vt?e.seekingStart?e._waitType=2:e._waitType=0:e._waitType=1,e.fixedWaitingStart=Px(),e._waitTimer=Ur.setTimeout(Sr(e),(function(){e._isWaiting&&(e.waitingStart=Px(),Ur.clearTimeout(Sr(e),e._waitTimer),e._waitTimer=null,e._startWaitTimeout(),e.emitLog(Rx,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:e._waitType,endType:2===e._waitType?"seek":"playing"}))}),200))})),mr(Sr(e),"_onError",(function(){e.suspendSeekingStatus("error"),e.suspendWaitingStatus("error")})),mr(Sr(e),"_onPlaying",(function(){e._isWaiting&&e.suspendWaitingStatus("playing")})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=Px(),this.loadedCostTime=0,this.startCostTime=0,this.on(uo,(function(){var t=e._state,i=t.autoplayStart,n=t.isFFSend;e.startCostTime=Px()-e.newPointTime,Nr.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),"autoplayStart:".concat(i," isFFSend:").concat(n," startCostTime:").concat(e.startCostTime," newPointTime").concat(e.newPointTime)),n||(!t.isLs&&e.emitLog(wx,{}),t.isLs=!0,t.isTimeUpdate=!1,t.isFFLoading=!0,e.pt=Px(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())})),this.on(so,(function(){e.vt=Px(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var t=e._state,i=t.isTimeUpdate,n=t.isFFSend,r=t.autoplayStart;Nr.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),"fvt:".concat(e.fvt," isTimeUpdate:").concat(e._state.isTimeUpdate," loadedCostTime:").concat(e.loadedCostTime)),(i||r)&&e._sendFF("loadedData"),n||e.emitLog(Dx,{}),e.suspendWaitingStatus("loadeddata")})),this.on(Jr,this._onSeeking),this.on(eo,this._onSeeked),this.on(Eo,(function(){e.endState("destroy")})),this.on(To,(function(){e.endState("urlChange"),Nr.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()})),this.on([Xr,no],this._onPlaying),this.on(io,this._onWaiting),this.on(Zr,this._onError),this.on(Ho,(function(){Nr.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()}))}},{key:"_initOnceEvents",value:function(){this.off(yo,this._onAutoplayStart),this.off(to,this._onTimeupdate),this.once(yo,this._onAutoplayStart),this.once(to,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=Px();var t=this._state,i=t.isFFLoading,n=t.isFFSend;Nr.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(i," !isFFSend:").concat(!n)),this.vt>0&&i&&!n&&(Nr.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(Lx,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&Ur.clearTimeout(this,this._waittTimer),this._waittTimer=Ur.setTimeout(this,(function(){e.suspendWaitingStatus("timeout"),Ur.clearTimeout(e,e._waittTimer),e._waittTimer=null}),this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var t=Px(),i=t-this.seekingStart;this.seekingStart=0,this.emitLog(Nx,{end:t,costTime:i,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(Ur.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(Ur.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,this.waitingStart){var t=Px(),i=t-this.waitingStart,n=t-this.fixedWaitingStart,r=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(xx,{fixedCostTime:n>r?r:n,costTime:i>r?r:i,type:"loadeddata"===e?1:this._waitType,endType:2===this._waitType?"seek":e})}}},{key:"emitLog",value:function(e,t){var i=this.player;this.emit(Uo,pr({t:Px(),host:Ur.getHostFromUrl(i.currentSrc),vtype:i.vtype,eventType:e,currentTime:this.player.currentTime,readyState:i.video.readyState,networkState:i.video.networkState},t))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),i}(bs);function Ux(){return(new DOMParser).parseFromString('<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">\n <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var Bx=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"registerIcons",value:function(){return{replay:Ux}}},{key:"afterCreate",value:function(){var e=this;bs.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",(function(){e.player.replay()}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(qr,(function(){if(e.playerConfig.loop||Ur.addClass(e.player.root,"replay"),!e.config.disable){e.show();var t=e.root.querySelector("path");if(t){var i=window.getComputedStyle(t).getPropertyValue("transform");if("string"==typeof i&&i.indexOf("none")>-1)return null;t.setAttribute("transform",i)}}})),this.on($r,(function(){e.hide()}))}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),Ur.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return'<xg-replay class="xgplayer-replay">\n <xg-replay-txt class="xgplayer-replay-txt" lang-key="'.concat(this.i18nKeys.REPLAY,'">').concat(this.i18n.REPLAY,"</xg-replay-txt>\n </xg-replay>")}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),i}(bs);function Hx(){return(new DOMParser).parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n',"image/svg+xml").firstChild}function Fx(){return(new DOMParser).parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n',"image/svg+xml").firstChild}var jx={};function Vx(e){e?window.clearTimeout(e):Object.keys(jx).map((function(e){window.clearTimeout(jx[e].id),delete jx[e]}))}var Kx=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"onPlayerReset",(function(){n.autoPlayStart=!1;var e="auto"===n.config.mode?"auto-hide":"hide";n.setAttr("data-state","play"),Ur.removeClass(n.root,e),n.show()})),mr(Sr(n),"onAutoplayStart",(function(){if(!n.autoPlayStart){var e="auto"===n.config.mode?"auto-hide":"hide";Ur.addClass(n.root,e),n.autoPlayStart=!0,n.toggleTo("play")}})),n.autoPlayStart=!1,n}return vr(i,[{key:"afterCreate",value:function(){var e=this.playerConfig;this.initIcons(),this.listenEvents(),this.bindClickEvents(),e.autoplay||this.show()}},{key:"listenEvents",value:function(){var e=this,t=this.player,i=this.playerConfig;this.once(fo,(function(){i&&(i.lang&&"en"===i.lang?Ur.addClass(t.root,"lang-is-en"):"jp"===i.lang&&Ur.addClass(t.root,"lang-is-jp"))})),this.on(yo,this.onAutoplayStart),this.on(vo,(function(){var t="auto"===e.config.mode?"auto-hide":"hide";e.setAttr("data-state","play"),Ur.removeClass(e.root,t),e.show()})),this.on($r,(function(){e.toggleTo("play")})),this.on(Qr,(function(){e.toggleTo("pause")})),this.on(Ho,(function(){e.onPlayerReset()}))}},{key:"bindClickEvents",value:function(){var e=this;this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(t){t.cancelable&&t.preventDefault(),t.stopPropagation();var i=e.player.paused;e.emitUserAction(t,"switch_play_pause",{props:"paused",from:i,to:!i})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:Hx,class:"xg-icon-play"},startPause:{icon:Fx,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){Ur.addClass(this.root,"hide")}},{key:"show",value:function(e){Ur.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){Ur.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){Ur.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var t=this;this._animateId=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{start:null,end:null};return jx[e]&&window.clearTimeout(jx[e].id),jx[e]={},i.start&&i.start(),jx[e].id=window.setTimeout((function(){i.end&&i.end(),window.clearTimeout(jx[e].id),delete jx[e]}),t),jx[e].id}("pauseplay",400,{start:function(){Ur.addClass(t.root,"interact"),t.show(),t.switchStatus(!0)},end:function(){Ur.removeClass(t.root,"interact"),!e&&t.hide(),t._animateId=null}})}},{key:"endAnimate",value:function(){Ur.removeClass(this.root,"interact"),Vx(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var t=this.player;(e.cancelable&&e.preventDefault(),e.stopPropagation(),t.state<Ns.READY)||(this.player.paused||t.state!==Ns.RUNNING?t.play():t.pause())}},{key:"onPlayPause",value:function(e){this.toggleTo(e)}},{key:"toggleTo",value:function(e){var t=this.config,i=this.player;if(i&&!(i.state<Ns.RUNNING)&&this.autoPlayStart){if("show"===t.mode)return this.switchStatus(),void this.show();if("auto"!==t.mode){if(t.isShowPause&&i.paused&&!i.ended||t.isShowEnd&&i.ended)return this.switchStatus(),this.show(),void this.endAnimate();if(t.disableAnimate)return this.switchStatus(),void this.hide();if("play"===e)this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||i.ended)return;this.animate()}}else this.switchStatus()}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),Vx(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?"auto"===this.config.mode?"auto-hide":"hide":"";return'\n <xg-start class="xgplayer-start '.concat(e,'">\n <xg-start-inner></xg-start-inner>\n </xg-start>')}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),i}(bs),Gx=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"render",value:function(){var e=this.config.innerHtml,t=Ur.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)t.appendChild(e);else if(e&&"string"==typeof e)t.innerHTML=e;else{for(var i="",n=1;n<=12;n++)i+='<div class="xgplayer-enter-bar'.concat(n,'"></div>');t.innerHTML='<div class="xgplayer-enter-spinner">'.concat(i,"</div>")}return t}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),i}(bs);function Wx(e,t,i){try{return' <div class="xg-tips '.concat(i?"hide":" ",'" lang-key="').concat(e.i18nKeys[t],'">\n ').concat(e.i18n[t],"\n </div>")}catch(n){return'<div class="xg-tips hide"></div>'}}var Yx=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"afterCreate",value:function(){this.getMini=this.getMini.bind(this),this.exitMini=this.exitMini.bind(this),this.bind("click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e="MINISCREEN";return'\n <xg-icon class="xgplayer-miniicon">\n <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[e],'">').concat(this.i18n[e],"</span></div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:10}}}]),i}(bs);function zx(e){var t=parseFloat(e);return-1===e.indexOf("%")&&!Number.isNaN(t)&&t}var $x=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],Xx=$x.length;function qx(e){if("string"==typeof e&&(e=document.querySelector(e)),e&&"object"===fr(e)&&e.nodeType){var t=function(e){return window.getComputedStyle(e)}(e);if("none"===t.display)return function(){for(var e={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},t=0;t<Xx;t++)e[$x[t]]=0;return e}();var i={};i.width=e.offsetWidth,i.height=e.offsetHeight;for(var n=i.isBorderBox="border-box"===t.boxSizing,r=0;r<Xx;r++){var o=$x[r],s=t[o],a=parseFloat(s);i[o]=Number.isNaN(a)?0:a}var l=i.paddingLeft+i.paddingRight,u=i.paddingTop+i.paddingBottom,c=i.marginLeft+i.marginRight,h=i.marginTop+i.marginBottom,d=i.borderLeftWidth+i.borderRightWidth,p=i.borderTopWidth+i.borderBottomWidth,f=n,g=zx(t.width);!1!==g&&(i.width=g+(f?0:l+d));var y=zx(t.height);return!1!==y&&(i.height=y+(f?0:u+p)),i.innerWidth=i.width-(l+d),i.innerHeight=i.height-(u+p),i.outerWidth=i.width+c,i.outerHeight=i.height+h,i}}function Qx(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n.identifier===t)return n}}var Zx="dragStart",Jx="dragMove",eO="dragEnded",tO={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},iO=function(e){_r(i,e);var t=kr(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gr(this,i),(n=t.call(this)).isEnabled=!0,n.isDragging=!1,n.isDown=!1,n.position={},n.downPoint={},n.dragPoint={x:0,y:0},n.startPos={x:0,y:0},n._root=e instanceof Element?e:document.querySelector(e),n._handlerDom=r.handle instanceof Element?r.handle:document.querySelector(r.handle),n._root&&n._handlerDom?(n._bindStartEvent(),n):br(n)}return vr(i,[{key:"_bindStartEvent",value:function(){var e=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),tO[this._startKey].map((function(t){e["on".concat(t)]=e["on".concat(t)].bind(e)}))}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var t=this;if(e){var i=tO[this._startKey];i.map((function(e){window.addEventListener(e,t["on".concat(e)])})),this._boundPointerEvents=i}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map((function(t){window.removeEventListener(t,e["on".concat(t)])})),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame((function(){e.animate()})))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var t=e.changedTouches[0];this.dragStart(e,t),this.touchIdentifier=void 0!==t.pointerId?t.pointerId:t.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var t=Qx(e.changedTouches,this.touchIdentifier);t&&this.dragMove(e,t)}},{key:"ontouchend",value:function(e){var t=Qx(e.changedTouches,this.touchIdentifier);t&&this.dragEnd(e,t),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var t=Qx(e.changedTouches,this.touchIdentifier);t&&this.dragCancel(e,t)}},{key:"dragStart",value:function(e,t){if(this._root&&!this.isDown&&this.isEnabled){this.downPoint=t,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var i=qx(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-i.height,this.startPos.maxX=window.innerWidth-i.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,t){this.isDragging=!0,this.animate(),this.emit(Zx,this.startPos)}},{key:"dragEnd",value:function(e,t){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(eO)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,t){var i={x:t.pageX-this.downPoint.pageX,y:t.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(i)&&this.dragRealStart(e,t),i}},{key:"dragMove",value:function(e,t){if(e=e||window.event,this.isDown){var i=this.startPos,n=i.x,r=i.y,o=this._dragPointerMove(e,t),s=o.x,a=o.y;s=this.checkContain("x",s,n),a=this.checkContain("y",a,r),this.position.x=n+s,this.position.y=r+a,this.dragPoint.x=s,this.dragPoint.y=a,this.emit(Jx,this.position)}}},{key:"dragCancel",value:function(e,t){this.dragEnd(e,t)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,t,i){return t+i<0?0-i:"x"===e&&t+i>this.startPos.maxX?this.startPos.maxX-i:"y"===e&&t+i>this.startPos.maxY?this.startPos.maxY-i:t}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),t=this._getPositionCoord(e.left,"width"),i=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(t)?0:t,this.position.y=Number.isNaN(i)?0:i,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var t=e.transform;if(0===t.indexOf("matrix")){var i=t.split(","),n=0===t.indexOf("matrix3d")?12:4,r=parseInt(i[n],10),o=parseInt(i[n+1],10);this.position.x+=r,this.position.y+=o}}},{key:"_getPositionCoord",value:function(e,t){if(-1!==e.indexOf("%")){var i=qx(this._root.parentNode);return i?parseFloat(e)/100*i[t]:0}return parseInt(e,10)}}]),i}(Lr),nO=function(e){_r(i,e);var t=kr(i);function i(e){var n;gr(this,i),mr(Sr(n=t.call(this,e)),"onCancelClick",(function(e){n.exitMini(),n.isClose=!0})),mr(Sr(n),"onCenterClick",(function(e){var t=Sr(n).player;t.paused?t.play():t.pause()})),mr(Sr(n),"onScroll",(function(e){if(!(!window.scrollY&&0!==window.scrollY||Math.abs(window.scrollY-n.pos.scrollY)<50)){var t=parseInt(Ur.getCss(n.player.root,"height"));t+=n.config.scrollTop,n.pos.scrollY=window.scrollY,window.scrollY>t+5?!n.isMini&&!n.isClose&&n.getMini():window.scrollY<=t&&(n.isMini&&n.exitMini(),n.isClose=!1)}})),n.isMini=!1,n.isClose=!1;var r=Sr(n).config;return n.pos={left:r.left<0?window.innerWidth-r.width-20:r.left,top:r.top<0?window.innerHeight-r.height-20:r.top,height:n.config.height,width:n.config.width,scrollY:window.scrollY||0},n.lastStyle=null,n}return vr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.mini&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(Qr,(function(){e.setAttr("data-state","pause")})),this.on($r,(function(){e.setAttr("data-state","play")}))}},{key:"onPluginsReady",value:function(){var e=this,t=this.player;if(!this.config.disable){if(this.config.isShowIcon){var i={config:{onClick:function(){e.getMini()}}};t.controls.registerPlugin(Yx,i,Yx.pluginName)}var n=Ur.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",n,this.onCancelClick),this.bind(".play-icon",n,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new iO(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:Hx,class:"xg-icon-play"},pause:{icon:Fx,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e=this;if(!this.isMini){var t=this.player,i=this.playerConfig,n=this.config.target||this.player.root;this.lastStyle={},Ur.addClass(t.root,"xgplayer-mini"),["width","height","top","left"].map((function(t){e.lastStyle[t]=n.style[t],n.style[t]="".concat(e.pos[t],"px")})),i.fluid&&(n.style["padding-top"]=""),this.emit(Po,!0),t.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var t=this.player,i=this.playerConfig,n=this.config.target||this.player.root;Ur.removeClass(t.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map((function(t){n.style[t]=e.lastStyle[t]})),this.lastStyle=null,i.fluid&&(t.root.style.width="100%",t.root.style.height="0",t.root.style["padding-top"]="".concat(100*i.height/i.width,"%")),this.emit(Po,!1),this.isMini=t.isMini=!1}},{key:"updatePos",value:function(e){this.pos=Object.assign(this.pos,e),this.isMini&&(this.player.root.style.left="".concat(this.pos.left,"px"),this.player.root.style.top="".concat(this.pos.top,"px"),this.player.root.style.width="".concat(this.pos.width,"px"),this.player.root.style.height="".concat(this.pos.height,"px"))}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=Ur.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-mini-layer class="xg-mini-layer">\n <xg-mini-header class="xgplayer-mini-header">\n '.concat(Wx(this,"MINI_DRAG",this.playerConfig.isHideTips),'\n </xg-mini-header>\n <div class="mini-cancel-btn">\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">\n <path fill="#fff" fill-rule="evenodd" d="M3.99 3.49a1 1 0 0 1 1.414 0L10 8.085l4.596-4.595a1 1 0 1 1 1.414 1.414L11.414 9.5l4.596 4.596a1 1 0 0 1 .084 1.32l-.084.094a1 1 0 0 1-1.414 0L10 10.914 5.404 15.51a1 1 0 0 1-1.414-1.414L8.585 9.5 3.99 4.904a1 1 0 0 1-.084-1.32z"></path>\n </svg>\n </div>\n <div class="play-icon">\n </div>\n </xg-mini-layer>')}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),i}(bs),rO={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},oO=["videoClick","videoDbClick"],sO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onMouseMove",(function(t){var i=Sr(e),n=i.player,r=i.playerConfig;n.isActive||(n.focus({autoHide:!r.closeDelayBlur}),!r.closeFocusVideoFocus&&n.media.focus())})),mr(Sr(e),"onMouseEnter",(function(t){var i=Sr(e),n=i.playerConfig,r=i.player;!n.closeFocusVideoFocus&&r.media.focus(),n.closeDelayBlur?r.focus({autoHide:!1}):r.focus(),e.emit(ko)})),mr(Sr(e),"onMouseLeave",(function(t){var i=e.playerConfig,n=i.closePlayerBlur,r=i.leavePlayerTime,o=i.closeDelayBlur;n||o||(r?e.player.focus({autoHide:!0,delay:r}):e.player.blur({ignorePaused:!0})),e.emit(bo)})),mr(Sr(e),"onVideoClick",(function(t){var i=Sr(e),n=i.player,r=i.playerConfig;t.target&&r.closeVideoClick||t.target!==n.root&&t.target!==n.media&&t.target!==n.innerContainer&&t.target!==n.media.__canvas||(t.preventDefault(),r.closeVideoStopPropagation||t.stopPropagation(),e._clickCount++,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),e.clickTimer=setTimeout((function(){e._clickCount&&(e._clickCount--,ls(Sr(e),oO[0],(function(t,i){e.switchPlayPause(i.e)}),{e:t,paused:n.paused}),clearTimeout(e.clickTimer),e.clickTimer=null)}),300))})),mr(Sr(e),"onVideoDblClick",(function(t){var i=Sr(e),n=i.player,r=i.playerConfig;r.closeVideoDblclick||!t.target||t.target!==n.media&&t.target!==n.media.__canvas||(!r.closeVideoClick&&e._clickCount<2?e._clickCount=0:(e._clickCount=0,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),t.preventDefault(),t.stopPropagation(),ls(Sr(e),oO[1],(function(t,i){e.emitUserAction(i.e,"switch_fullscreen",{props:"fullscreen",from:n.fullscreen,to:!n.fullscreen}),n.fullscreen?n.exitFullscreen():n.getFullscreen()}),{e:t,fullscreen:n.fullscreen})))})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,oO.map((function(t){e.__hooks[t]=null})),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===Kr.device&&!Kr.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,t=this.player,i=t.media,n=t.root,r=this.playerConfig.enableContextmenu;n&&n.addEventListener("click",this.onVideoClick,!1),n&&n.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(rO).map((function(t){n.addEventListener(t,e[rO[t]],!1)})),!r&&i&&i.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var t=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:t.paused,to:!t.paused}),t.ended?t.duration!==1/0&&t.duration>0&&t.replay():t.paused?t.play():t.pause()}},{key:"onContextmenu",value:function(e){(e=e||window.event).preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,t=this.player,i=t.video,n=t.root;this.clickTimer&&clearTimeout(this.clickTimer),n.removeEventListener("click",this.onVideoClick,!1),n.removeEventListener("dblclick",this.onVideoDblClick,!1),i.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(rO).map((function(t){n.removeEventListener(t,e[rO[t]],!1)}))}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),i}(cs),aO="press",lO="pressend",uO="doubleclick",cO="click",hO="touchmove",dO="touchstart",pO="touchend",fO={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},gO={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function yO(e){return e&&e.length>0?e[e.length-1]:null}var vO=function(){function e(t){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};gr(this,e),mr(this,"onTouchStart",(function(e){var t=i._pos,n=i.root,r=yO(e.touches);t.x=r?parseInt(r.pageX,10):e.pageX,t.y=r?parseInt(r.pageX,10):e.pageX,t.start=!0,i.__setPress(e),n.addEventListener(i.events.end,i.onTouchEnd),n.addEventListener(i.events.cancel,i.onTouchCancel),n.addEventListener(i.events.move,i.onTouchMove),i.trigger(dO,e)})),mr(this,"onTouchCancel",(function(e){i.onTouchEnd(e)})),mr(this,"onTouchEnd",(function(e){var t=i._pos,n=i.root;i.__clearPress(),n.removeEventListener(i.events.cancel,i.onTouchCancel),n.removeEventListener(i.events.end,i.onTouchEnd),n.removeEventListener(i.events.move,i.onTouchMove),e.moving=t.moving,e.press=t.press,t.press&&i.trigger(lO,e),i.trigger(pO,e),!t.press&&!t.moving&&i.__setDb(e),t.press=!1,t.start=!1,t.moving=!1})),mr(this,"onTouchMove",(function(e){var t=i._pos,n=i.config,r=yO(e.touches),o=r?parseInt(r.pageX,10):e.pageX,s=r?parseInt(r.pageY,10):e.pageX,a=o-t.x,l=s-t.y;Math.abs(l)<n.miniStep&&Math.abs(a)<n.miniStep||(i.__clearPress(),t.press&&i.trigger(lO,e),t.press=!1,t.moving=!0,i.trigger(hO,e))})),this._pos={moving:!1,start:!1,x:0,y:0},this.config={pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0},Object.keys(n).map((function(e){i.config[e]=n[e]})),this.root=t,this.events="mouse"===n.eventType?gO:fO,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return vr(e,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(e){var t=this,i=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout((function(){t.trigger(aO,e),t._pos.press=!0,t.__clearPress()}),i.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(e){var t=this,i=this.config;if(this.dbIntrvalId)return this.__clearDb(),void this.trigger(uO,e);this.dbIntrvalId=setTimeout((function(){t.__clearDb(),t._pos.start||t._pos.press||t._pos.moving||t.trigger(cO,e)}),i.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(e,t){this.__handlers[e]||(this.__handlers[e]=[]),this.__handlers[e].push(t)}},{key:"off",value:function(e,t){if(this.__handlers[e]){for(var i=this.__handlers[e],n=-1,r=0;r<i.length;r++)if(i[r]===t){n=r;break}n>=0&&this.__handlers[e].splice(n,1)}}},{key:"trigger",value:function(e,t){this.__handlers[e]&&this.__handlers[e].map((function(i){try{i(t)}catch(oF){console.error("trigger>>:".concat(e),oF)}}))}},{key:"destroy",value:function(){var e=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).forEach((function(i){e.root.removeEventListener(i,e[t[i]])}))}}]),e}();function mO(){return(new DOMParser).parseFromString('<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <path opacity="0.54"\n d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"\n fill="white" />\n <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}var _O="auto",EO="seeking",TO="playbackrate",SO=["videoClick","videoDbClick"],bO=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"onTouchStart",(function(e){var t=Sr(n),i=t.player,r=t.config,o=t.pos,s=t.playerConfig,a=n.getTouche(e);if(a&&!r.disableGesture&&n.duration>0&&!i.ended){o.isStart=!0,n.timer&&clearTimeout(n.timer),Ur.checkIsFunction(s.disableSwipeHandler)&&s.disableSwipeHandler(),n.find(".xg-dur").innerHTML=Ur.format(n.duration);var l=n.root.getBoundingClientRect();90===i.rotateDeg?(o.top=l.left,o.left=l.top,o.width=l.height,o.height=l.width):(o.top=l.top,o.left=l.left,o.width=l.width,o.height=l.height);var u=parseInt(a.pageX-o.left,10),c=parseInt(a.pageY-o.top,10);o.x=90===i.rotateDeg?c:u,o.y=90===i.rotateDeg?u:c,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}})),mr(Sr(n),"onTouchMove",(function(e){var t=n.getTouche(e),i=Sr(n),r=i.pos,o=i.config,s=i.player;if(t&&!o.disableGesture&&n.duration&&r.isStart){var a=o.miniMoveStep,l=o.hideControlsActive,u=parseInt(t.pageX-r.left,10),c=parseInt(t.pageY-r.top,10),h=90===s.rotateDeg?c:u,d=90===s.rotateDeg?u:c;if(Math.abs(h-r.x)>a||Math.abs(d-r.y)>a){var p=h-r.x,f=d-r.y,g=r.scope;if(-1===g&&(0===(g=n.checkScope(h,d,p,f,r))&&(l?s.blur():s.focus({autoHide:!1}),!r.time&&(r.time=parseInt(1e3*s.currentTime,10)+1e3*n.timeOffset)),r.scope=g),-1===g||g>0&&!o.gestureY||0===g&&!o.gestureX)return;n.executeMove(p,f,g,r.width,r.height),r.x=h,r.y=d}}})),mr(Sr(n),"onTouchEnd",(function(e){var t=Sr(n),i=t.player,r=t.pos,o=t.playerConfig;if(setTimeout((function(){i.getPlugin("progress")&&i.getPlugin("progress").resetSeekState()}),10),r.isStart){r.scope>-1&&e.cancelable&&e.preventDefault();var s=n.config,a=s.disableGesture,l=s.gestureX;!a&&l?n.endLastMove(r.scope):r.time=0,r.scope=-1,n.resetPos(),Ur.checkIsFunction(o.enableSwipeHandler)&&o.enableSwipeHandler(),n.changeAction(_O)}})),mr(Sr(n),"onRootTouchMove",(function(e){!n.config.disableGesture&&n.config.gestureX&&n.checkIsRootTarget(e)&&(e.stopPropagation(),n.pos.isStart?n.onTouchMove(e):n.onTouchStart(e))})),mr(Sr(n),"onRootTouchEnd",(function(e){n.pos.scope>-1&&n.onTouchEnd(e)})),n.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},n.timer=null,n}return vr(i,[{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:mO,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this;SO.map((function(t){e.__hooks[t]=null}));var t=this.playerConfig,i=this.config,n=this.player;!0===t.closeVideoDblclick&&(i.closedbClick=!0),this.resetPos(),Ur.isUndefined(t.disableGesture)||(i.disableGesture=!!t.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=Ur.createDom("xg-mask","",{},"xgmask"),n.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var r="mouse"===this.domEventType?"mouse":"touch";this.touch=new vO(this.root,{eventType:r,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",(function(e){e.preventDefault()})),n.root.addEventListener("touchmove",this.onRootTouchMove,!0),n.root.addEventListener("touchend",this.onRootTouchEnd,!0),n.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var o=this.player.controls;o&&o.center&&(o.center.addEventListener("touchmove",this.onRootTouchMove,!0),o.center.addEventListener("touchend",this.onRootTouchEnd,!0),o.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(ro,(function(){var t=e.player,i=e.config;t.duration>0&&1e3*t.duration<i.moveDuration&&(i.moveDuration=1e3*t.duration)})),this.on([no,qr],(function(){var t=e.pos,i=t.time;!t.isStart&&i>0&&(e.pos.time=0)}));var s={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(s).map((function(t){e.touch.on(t,(function(i){e[s[t]](i)}))})),!i.disableActive){var a=n.plugins.progress;a&&(a.addCallBack("dragmove",(function(t){e.activeSeekNote(t.currentTime,t.forward)})),["dragend","click"].forEach((function(t){a.addCallBack(t,(function(){e.changeAction(_O)}))})))}}},{key:"registerThumbnail",value:function(){var e=this.player.plugins.thumbnail;if(e&&e.usable){this.thumbnail=e.createThumbnail(null,"mobile-thumbnail");var t=this.find(".time-preview");t.insertBefore(this.thumbnail,t.children[0])}}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle,t=e.playedColor,i=e.progressColor,n=e.timePreviewStyle,r=e.curTimeColor,o=e.durationColor;if(t&&(this.find(".xg-curbar").style.backgroundColor=t),i&&(this.find(".xg-bar").style.backgroundColor=i),n){var s=this.find(".time-preview");Object.keys(n).forEach((function(e){s.style[e]=n[e]}))}var a=r||t,l=o;a&&(this.find(".xg-cur").style.color=a),l&&(this.find(".xg-dur").style.color=l),this.config.disableTimeProgress&&Ur.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map((function(t){e.pos[t]=0}))):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var t=this.player;this.root.setAttribute("data-xg-action",e);var i=t.plugins.start;i&&i.recover()}},{key:"getTouche",value:function(e){this.player.rotateDeg;var t=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return{pageX:t.pageX,pageY:t.pageY}}},{key:"checkScope",value:function(e,t,i,n,r){var o=r.width,s=-1;if(e<0||e>o)return s;var a=0===n?Math.abs(i):Math.abs(i/n);return Math.abs(i)>0&&a>=1.73&&e>r.scopeM1&&e<r.scopeM2?s=0:(0===Math.abs(i)||a<=.57)&&(s=e<r.scopeL?1:e>r.scopeR?2:3),s}},{key:"executeMove",value:function(e,t,i,n,r){switch(i){case 0:this.updateTime(e/n*this.config.scopeM);break;case 1:this.updateBrightness(t/r);break;case 2:Kr.os.isIos||this.updateVolume(t/r)}}},{key:"endLastMove",value:function(e){var t=this,i=this.pos,n=this.player,r=this.config,o=(i.time-this.timeOffset)/1e3;if(0===e)n.seek(Number(o).toFixed(1)),r.hideControlsEnd?n.blur():n.focus(),this.timer=setTimeout((function(){t.pos.time=0}),500);this.changeAction(_O)}},{key:"checkIsRootTarget",value:function(e){var t=this.player.plugins||{};return(!t.progress||!t.progress.root.contains(e.target))&&(t.start&&t.start.root.contains(e.target)||t.controls&&t.controls.root.contains(e.target))}},{key:"sendUseAction",value:function(e){var t=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t,to:!t})}},{key:"clickHandler",value:function(e){var t=this.player,i=this.config,n=this.playerConfig;t.state<Ns.RUNNING?n.closeVideoClick||(this.sendUseAction(Ur.createEvent("click")),t.play()):!i.closedbClick||n.closeVideoClick?t.isActive?t.blur():t.focus():n.closeVideoClick||((t.isActive||i.focusVideoClick)&&(this.sendUseAction(Ur.createEvent("click")),this.switchPlayPause()),t.focus())}},{key:"dbClickHandler",value:function(e){var t=this.config,i=this.player;!t.closedbClick&&i.state>=Ns.RUNNING&&(this.sendUseAction(Ur.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var t=this,i=this.player;ls(this,SO[0],(function(e,i){t.clickHandler(i.e)}),{e:e,paused:i.paused})}},{key:"onDbClick",value:function(e){var t=this,i=this.player;ls(this,SO[1],(function(e,i){t.dbClickHandler(i.e)}),{e:e,paused:i.paused})}},{key:"onPress",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(t.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:n.playbackRate,to:i.pressRate}),n.playbackRate=i.pressRate,this.changeAction(TO))}},{key:"onPressEnd",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:n.playbackRate,to:t.rate}),n.playbackRate=t.rate,t.rate=1,this.changeAction(_O))}},{key:"updateTime",value:function(e){var t=this.player,i=this.config,n=this.player.duration;e=Number(e.toFixed(4));var r=parseInt(e*i.moveDuration,10)+this.timeOffset;r=(r+=this.pos.time)<0?0:r>1e3*n?1e3*n-200:r,t.getPlugin("time")&&t.getPlugin("time").updateTime(r/1e3),t.getPlugin("progress")&&t.getPlugin("progress").updatePercent(r/1e3/this.duration,!0),this.activeSeekNote(r/1e3,e>0),i.isTouchingSeek&&t.seek(Number((r-this.timeOffset)/1e3).toFixed(1)),this.pos.time=r}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.player,i=this.pos;if(e=parseInt(100*e,10),i.volume+=e,!(Math.abs(i.volume)<10)){var n=parseInt(10*t.volume,10)-parseInt(i.volume/10,10);n=n>10?10:n<1?0:n,t.volume=n/10,i.volume=0}}},{key:"updateBrightness",value:function(e){var t=this.pos,i=this.config,n=this.xgMask;if(i.darkness){this.player.rotateDeg&&(e=-e);var r=t.light+.8*e;r=r>i.maxDarkness?i.maxDarkness:r<0?0:r,n&&(n.style.backgroundColor="rgba(0,0,0,".concat(r,")")),t.light=r}}},{key:"activeSeekNote",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.player,n=this.config,r=!(this.duration!==1/0&&this.duration>0);if(e&&"number"==typeof e&&!r&&!n.disableActive){e<0?e=0:e>i.duration&&(e=i.duration-.2),this.changeAction(EO);var o=i.plugins.start;o&&o.focusHide(),this.find(".xg-dur").innerHTML=Ur.format(this.duration),this.find(".xg-cur").innerHTML=Ur.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),t?Ur.removeClass(this.find(".xg-seek-show"),"xg-back"):Ur.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var t=this.player.plugins.thumbnail;t&&t.usable&&this.thumbnail&&t.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<Ns.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!0}},{key:"enableGesture",value:function(){this.config.disableGesture=!1}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var t=this.player.controls;t&&t.center&&(t.center.removeEventListener("touchmove",this.onRootTouchMove,!0),t.center.removeEventListener("touchend",this.onRootTouchEnd,!0),t.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";return'\n <xg-trigger class="trigger">\n <div class="'.concat(e,'"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon?" hide-seek-icon":"",'">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span class="xg-separator">/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate,"X</i>").concat(this.i18n.FORWARD,"</span>\n </div>\n </xg-trigger>\n ")}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:36e4,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),i}(bs);function kO(e){var t=e.tagName;return!("INPUT"!==t&&"TEXTAREA"!==t&&!e.isContentEditable)}var CO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onBodyKeyDown",(function(t){if(e.player){var i=t||window.event,n=i.keyCode,r=Sr(e),o=r._keyState,s=r.player,a=e.config,l=a.disable,u=a.disableBodyTrigger,c=a.isIgnoreUserActive;l||u||!s.isUserActive&&!c||kO(i.target)||!e.checkIsVisible()||i.metaKey||i.altKey||i.ctrlKey?o.isBodyKeyDown=!1:(t.repeat||o.isKeyDown||((i.target===document.body||e.config.isGlobalTrigger&&!kO(i.target))&&e.checkCode(n,!0)&&(o.isBodyKeyDown=!0),document.addEventListener("keyup",e.onBodyKeyUp)),o.isBodyKeyDown&&e.handleKeyDown(i))}})),mr(Sr(e),"onBodyKeyUp",(function(t){e.player&&(document.removeEventListener("keyup",e.onBodyKeyUp),e.handleKeyUp(t))})),mr(Sr(e),"onKeydown",(function(t){if(e.player){var i=t||window.event,n=Sr(e)._keyState;if(!i.repeat){if(e.config.disable||e.config.disableRootTrigger||i.metaKey||i.altKey||i.ctrlKey)return;!i||37!==i.keyCode&&!e.checkCode(i.keyCode)||i.target!==e.player.root&&i.target!==e.player.video&&i.target!==e.player.controls.el||(n.isKeyDown=!0),e.player.root.addEventListener("keyup",e.onKeyup)}n.isKeyDown&&e.handleKeyDown(i)}})),mr(Sr(e),"onKeyup",(function(t){e.player&&(e.player.root.removeEventListener("keyup",e.onKeyup),e.handleKeyUp(t))})),e}return vr(i,[{key:"mergekeyCodeMap",value:function(){var e=this,t=this.config.keyCodeMap;t&&Object.keys(t).map((function(i){e.keyCodeMap[i]?["keyCode","action","disable","pressAction","disablePress","isBodyTarget"].map((function(n){t[i][n]&&(e.keyCodeMap[i][n]=t[i][n])})):e.keyCodeMap[i]=t[i]}))}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e="function"==typeof this.config.seekStep?this.config.seekStep(this.player):this.config.seekStep;e&&"number"==typeof e&&(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"setConfig",value:function(e){var t=this;Object.keys(e).forEach((function(i){t.config[i]=e[i]}))}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),t=e.height,i=e.top,n=e.bottom,r=window.innerHeight;return!(i<0&&i<0-.9*t||n>0&&n-r>.9*t)}},{key:"checkCode",value:function(e,t){var i=this,n=!1;return Object.keys(this.keyCodeMap).map((function(r){i.keyCodeMap[r]&&e===i.keyCodeMap[r].keyCode&&!i.keyCodeMap[r].disable&&(n=!t||t&&!i.keyCodeMap[r].noBodyTarget)})),n}},{key:"downVolume",value:function(e){var t=this.player;if(!(t.volume<=0)){var i=parseFloat((t.volume-.1).toFixed(1)),n={volume:{from:t.volume,to:i}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=i>=0?i:0}}},{key:"upVolume",value:function(e){var t=this.player;if(!(t.volume>=1)){var i=parseFloat((t.volume+.1).toFixed(1)),n={volume:{from:t.volume,to:i}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=i<=1?i:1}}},{key:"seek",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.duration,o=t.offsetDuration,s=t.timeSegments,a=n>-1?n:i,l=o||r,u=e.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;a+u<=l?a+=u:a=l;var c=Ur.getCurrentTimeByOffset(a,s),h={currentTime:{from:i,to:c}};this.emitUserAction(e,"seek",{props:h}),this.player.currentTime=c}},{key:"seekBack",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.timeSegments,o=(n>-1?n:i)-(e.repeat?parseInt(this.seekStep/2,10):this.seekStep);o<0&&(o=0);var s={currentTime:{from:i,to:o=Ur.getCurrentTimeByOffset(o,r)}};this.emitUserAction(e,"seek",{props:s}),this.player.currentTime=o}},{key:"changePlaybackRate",value:function(e){var t=this._keyState,i=this.config,n=this.player;0===t.playbackRate&&(t.playbackRate=n.playbackRate,n.playbackRate=i.playbackRate)}},{key:"playPause",value:function(e){var t=this.player;t&&(this.emitUserAction(e,"switch_play_pause"),t.paused?t.play():t.pause())}},{key:"exitFullscreen",value:function(e){var t=this.player,i=t.fullscreen,n=t.cssfullscreen;i&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:i,to:!i}),t.exitFullscreen()),n&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:n,to:!n}),t.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var t=this._keyState;if(e.repeat){t.isPress=!0;var i=Date.now();if(i-t.tt<200)return;t.tt=i}this.handleKeyCode(e.keyCode,e,t.isPress)}},{key:"handleKeyUp",value:function(e){var t=this._keyState;t.playbackRate>0&&(this.player.playbackRate=t.playbackRate,t.playbackRate=0),t.isKeyDown=!1,t.isPress=!1,t.tt=0}},{key:"handleKeyCode",value:function(e,t,i){for(var n,r=Object.keys(this.keyCodeMap),o=0;o<r.length;o++){var s=this.keyCodeMap[r[o]],a=s.action,l=s.keyCode,u=s.disable,c=s.pressAction,h=s.disablePress;if(l===e){if(!(u||i&&h)){var d=i&&c||a;"function"==typeof d?a(t,this.player,i):"string"==typeof d&&"function"==typeof this[d]&&this[d](t,this.player,i),this.emit(Mo,pr({key:r[o],target:t.target,isPress:i},this.keyCodeMap[r[o]]))}(n=t).preventDefault(),n.returnValue=!1,t.stopPropagation();break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),i}(cs);function IO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">\n <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>\n</svg>\n',"image/svg+xml").firstChild}var AO=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"registerIcons",value:function(){return{loadingIcon:IO}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return'\n <xg-loading class="xgplayer-loading">\n <xg-loading-inner></xg-loading-inner>\n </xg-loading>'}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:ms.ROOT}}}]),i}(bs),PO=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],wO=function(){function e(t){gr(this,e),this.fragments=t.fragments||[],0===this.fragments.length&&this.fragments.push({percent:1}),this._callBack=t.actionCallback,this.fragConfig={fragFocusClass:t.fragFocusClass||"inner-focus-point",fragAutoFocus:!!t.fragAutoFocus,fragClass:t.fragClass||""},this.style=t.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return vr(e,[{key:"updateDuration",value:function(e){var t=this;this.duration=e;var i=0,n=this.fragments;this.fragments=n.map((function(e){return e.start=parseInt(i,10),e.end=parseInt(i+e.percent*t.duration,10),e.duration=parseInt(e.percent*t.duration,10),i+=e.percent*t.duration,e}))}},{key:"updateProgress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"played",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},i=this.progressList,n=this.fragments;if(!(i.length<1)){var r=t.newIndex,o=t.curIndex,s=t.millisecond;r!==o&&i.map((function(t,i){i<r?t[e].style.width="100%":i>r&&(t[e].style.width=0)}));var a=n[r],l=0===s?0:(s-a.start)/a.duration;i[r][e].style.width=l<0?0:"".concat(100*l,"%")}}},{key:"updateFocus",value:function(e){if(this.fragConfig.fragAutoFocus&&!(this.fragments.length<2))if(e){var t=this.findIndex(1e3*e.currentTime,this.focusIndex);if(t>=0&&t!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(t);var i={index:t,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=t,this._callBack&&this._callBack(i)}}else if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var n={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(n),this.focusIndex=-1}}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(1e3*t,10)!==this.duration){if(!t&&0!==t)return;this.updateDuration(parseInt(1e3*t,10))}var i=this.playedIndex,n=this.cachedIndex;if("Undefined"!==Ur.typeOf(e.played)){var r=this.findIndex(1e3*e.played,i);if(r<0)return;this.updateProgress("played",{newIndex:r,curIndex:i,millisecond:parseInt(1e3*e.played,10)}),this.playedIndex=r}if("Undefined"!==Ur.typeOf(e.cached)){var o=this.findIndex(1e3*e.cached,n);if(o<0)return;this.updateProgress("cached",{newIndex:o,curIndex:n,millisecond:parseInt(1e3*e.cached,10)}),this.cachedIndex=o}}},{key:"findIndex",value:function(e,t){var i=this.fragments;if(!i||0===i.length)return-1;if(1===i.length)return 0;if(t>-1&&t<i.length&&e>i[t].start&&e<i[t].end)return t;if(e>i[i.length-1].start)return i.length-1;for(var n=0;n<i.length;n++)if(e>i[n].start&&e<=i[n].end){t=n;break}return t}},{key:"findHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)if(Ur.hasClass(e[t],this.fragConfig.fragFocusClass))return{dom:e[t],pos:e[t].getBoundingClientRect()}}},{key:"findFragment",value:function(e){var t=this.root.children;return e<0||e>=t.length?null:{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)Ur.removeClass(e[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(e){var t=this.root.children;if(e<t.length)return Ur.addClass(t[e],this.fragConfig.fragFocusClass),{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(e){var t=this;if(Object.keys(this.fragConfig).forEach((function(i){void 0!==e[i]&&(t.fragConfig[i]=e[i])})),e.fragments){if(this.fragments=0===e.fragments.length?[{percent:1}]:e.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var i=this.root.children;i.length>0;)this.root.removeChild(i[0]);this.render()}}},{key:"render",value:function(){var e=this,t=this.style.progressColor;if(this.root||(this.root=Ur.createDom("xg-inners","",{},"progress-list")),this.fragments){var i=this.fragConfig,n=i.fragClass,r=i.fragFocusClass;this.progressList=this.fragments.map((function(i){var o=Ur.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(i.percent):"flex: ".concat(i.percent)},"".concat(i.isFocus?r:""," xgplayer-progress-inner ").concat(n));return e.root.appendChild(o),PO.forEach((function(t){o.appendChild(Ur.createDom(t.tag,"",{style:t.styleKey?"background: ".concat(e.style[t.styleKey],"; width:0;"):"width:0;"},t.className))})),{cached:o.children[0],played:o.children[1]}}))}return this.root}}]),e}(),DO={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},LO=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"onMoveOnly",(function(e,t){var i=Sr(n),r=i.pos,o=i.config,s=i.player,a=t;if(e){Ur.event(e);var l=Ur.getEventPos(e,s.zoom),u=90===s.rotateDeg?l.clientY:l.clientX;if(r.moving&&Math.abs(r.x-u)<o.miniMoveStep)return;r.moving=!0,r.x=u,a=n.computeTime(e,u)}n.triggerCallbacks("dragmove",a,e),n._updateInnerFocus(a)})),mr(Sr(n),"onBodyClick",(function(e){n.pos.isLocked&&(n.pos.isLocked=!1,e.preventDefault(),e.stopPropagation())})),mr(Sr(n),"_mouseDownHandler",(function(e,t){n._state.time=t.currentTime,n.updateWidth(t.currentTime,t.seekTime,t.percent,0),n._updateInnerFocus(t)})),mr(Sr(n),"_mouseUpHandler",(function(e,t){Sr(n).pos.moving&&n.updateWidth(t.currentTime,t.seekTime,t.percent,2)})),mr(Sr(n),"_mouseMoveHandler",(function(e,t){var i=Sr(n),r=i._state,o=i.pos,s=i.config,a=i.player;r.time<t.currentTime?t.forward=!0:t.forward=!1,r.time=t.currentTime,o.isDown&&!o.moving&&(o.moving=!0,s.isPauseMoving&&a.pause(),n.triggerCallbacks("dragstart",t,e),n.emitUserAction("drag","dragstart",t)),n.updateWidth(t.currentTime,t.seekTime,t.percent,1),n.triggerCallbacks("dragmove",t,e),n._updateInnerFocus(t)})),mr(Sr(n),"onMouseDown",(function(e){var t=Sr(n),i=t._state,r=t.player,o=t.pos,s=t.config,a=t.playerConfig,l=Ur.getEventPos(e,r.zoom),u=90===r.rotateDeg?l.clientY:l.clientX;if(!(r.isMini||s.closeMoveSeek||!a.allowSeekAfterEnded&&r.ended)){if(r.duration||r.isPlaying){e.stopPropagation(),n.focus(),Ur.checkIsFunction(a.disableSwipeHandler)&&a.disableSwipeHandler(),Ur.checkIsFunction(s.onMoveStart)&&s.onMoveStart(),Ur.event(e),o.x=u,o.isDown=!0,o.moving=!1,i.prePlayTime=r.currentTime,r.focus({autoHide:!1}),n.isProgressMoving=!0,Ur.addClass(n.progressBtn,"active");var c=n.computeTime(e,u);return c.prePlayTime=i.prePlayTime,n._mouseDownHandlerHook(e,c),"touchstart"===e.type?(n.root.addEventListener("touchmove",n.onMouseMove),n.root.addEventListener("touchend",n.onMouseUp),n.root.addEventListener("touchcancel",n.onMouseUp)):(n.unbind("mousemove",n.onMoveOnly),document.addEventListener("mousemove",n.onMouseMove,!1),document.addEventListener("mouseup",n.onMouseUp,!1)),!0}r.play()}})),mr(Sr(n),"onMouseUp",(function(e){var t=Sr(n),i=t.player,r=t.config,o=t.pos,s=t.playerConfig,a=t._state;if(o){e.stopPropagation(),e.preventDefault(),Ur.checkIsFunction(s.enableSwipeHandler)&&s.enableSwipeHandler(),Ur.checkIsFunction(r.onMoveEnd)&&r.onMoveEnd(),Ur.event(e),Ur.removeClass(n.progressBtn,"active");var l=n.computeTime(e,o.x);l.prePlayTime=a.prePlayTime,o.moving?(n.triggerCallbacks("dragend",l,e),n.emitUserAction("drag","dragend",l)):(n.triggerCallbacks("click",l,e),n.emitUserAction("click","click",l)),n._mouseUpHandlerHook(e,l),o.moving=!1,o.isDown=!1,o.x=0,o.y=0,o.isLocked=!0,a.prePlayTime=0,a.time=0;var u=e.type;"touchend"===u||"touchcancel"===u?(n.root.removeEventListener("touchmove",n.onMouseMove),n.root.removeEventListener("touchend",n.onMouseUp),n.root.removeEventListener("touchcancel",n.onMouseUp),n.blur()):(document.removeEventListener("mousemove",n.onMouseMove,!1),document.removeEventListener("mouseup",n.onMouseUp,!1),o.isEnter?"mobile"!==s.isMobileSimulateMode&&n.bind("mousemove",n.onMoveOnly):n.onMouseLeave(e)),Ur.setTimeout(Sr(n),(function(){n.resetSeekState()}),1),i.focus()}})),mr(Sr(n),"onMouseMove",(function(e){var t=Sr(n),i=t._state,r=t.pos,o=t.player,s=t.config;Ur.checkTouchSupport()&&e.preventDefault(),Ur.event(e);var a=Ur.getEventPos(e,o.zoom),l=90===o.rotateDeg?a.clientY:a.clientX,u=Math.abs(r.x-l);if(!(r.moving&&u<s.miniMoveStep||!r.moving&&u<s.miniStartStep)){r.x=l;var c=n.computeTime(e,l);c.prePlayTime=i.prePlayTime,n._mouseMoveHandlerHook(e,c)}})),mr(Sr(n),"onMouseOut",(function(e){n.triggerCallbacks("mouseout",null,e)})),mr(Sr(n),"onMouseOver",(function(e){n.triggerCallbacks("mouseover",null,e)})),mr(Sr(n),"onMouseEnter",(function(e){var t=Sr(n),i=t.player,r=t.pos;if(!(r.isDown||r.isEnter||i.isMini||!i.config.allowSeekAfterEnded&&i.ended)){r.isEnter=!0,n.bind("mousemove",n.onMoveOnly),n.bind("mouseleave",n.onMouseLeave),Ur.event(e);var o=Ur.getEventPos(e,i.zoom),s=90===i.rotateDeg?o.clientY:o.clientX,a=n.computeTime(e,s);n.triggerCallbacks("mouseenter",a,e),n.focus()}})),mr(Sr(n),"onMouseLeave",(function(e){n.triggerCallbacks("mouseleave",null,e),n.unlock(),n._updateInnerFocus(null)})),mr(Sr(n),"onVideoResize",(function(){var e=n.pos,t=e.x,i=e.isDown;if(e.isEnter&&!i){var r=n.computeTime(null,t);n.onMoveOnly(null,r)}})),n.useable=!1,n.isProgressMoving=!1,n.__dragCallBacks=[],n._state={now:-1,direc:0,time:0,prePlayTime:-1},n._disableBlur=!1,"boolean"==typeof n.config.isDragingSeek&&(console.warn("[XGPLAYER] 'isDragingSeek' is deprecated, please use 'isDraggingSeek' instead"),n.config.isDraggingSeek=n.config.isDragingSeek),n}return vr(i,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i+this.timeOffset}},{key:"changeState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t&&0!==t.length||(t=[{percent:1}]);var n=pr(pr({fragments:t},i),{},{actionCallback:function(t){e.emitUserAction("fragment_focus","fragment_focus",t)}});this.innerList?this.innerList.reset(n):(this.innerList=new wO(n),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map((function(t){e[t]=e.innerList[t].bind(e.innerList)})))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer");var e=this.config,t=e.fragFocusClass,i=e.fragAutoFocus,n=e.fragClass;this._initInner(this.config.fragments,{fragFocusClass:t,fragAutoFocus:i,fragClass:n,style:this.playerConfig.commonStyle||{}}),"mobile"===Kr.device&&(this.config.isDraggingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.listenEvents(),this.bindDomEvents(),this.initCustomStyle()}}},{key:"listenEvents",value:function(){var e=this;this.on(ro,(function(){e.onMouseLeave()})),this.on(to,(function(){e.onTimeupdate()})),this.on(eo,(function(){e.onTimeupdate(),e.onCacheUpdate()})),this.on(lo,(function(){e.onCacheUpdate()})),this.on(qr,(function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0})),this.on(co,(function(){e.onReset()})),this.on(Lo,(function(){e.onVideoResize()}))}},{key:"setConfig",value:function(e){var t=this,i=null;Object.keys(e).forEach((function(n){t.config[n]=e[n],"fragments"===n&&(i=e[n])})),i&&this._initInner(i,e)}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle.sliderBtnStyle,t=this.progressBtn;e&&("string"==typeof e?t.style.boxShadow=e:"object"===fr(e)&&Object.keys(e).map((function(i){t.style[i]=e[i]})))}},{key:"triggerCallbacks",value:function(e,t,i){this.__dragCallBacks.length>0&&this.__dragCallBacks.map((function(n){if(n&&n.handler&&n.type===e)try{n.handler(t,i)}catch(oF){console.error("[XGPLAYER][triggerCallbacks] ".concat(n," error"),oF)}}))}},{key:"addCallBack",value:function(e,t){t&&"function"==typeof t&&this.__dragCallBacks.push({type:e,handler:t})}},{key:"removeCallBack",value:function(e,t){var i=this.__dragCallBacks,n=-1;i.map((function(i,r){i&&i.type===e&&i.handler===t&&(n=r)})),n>-1&&i.splice(n,1)}},{key:"unlock",value:function(){var e=this.player,t=this.pos;t.isEnter=!1,t.isLocked=!1,e.isMini||(this.unbind("mousemove",this.onMoveOnly),t.isDown?this.unbind("mouseleave",this.onMouseLeave):this.blur())}},{key:"bindDomEvents",value:function(){var e=this.player.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),"mouse"!==this.domEventType&&"compatible"!==this.domEventType||(this.bind("mousedown",this.onMouseDown),"mobile"!==e.isMobileSimulateMode&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),Ur.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),Ur.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,t,i,n){var r=this.config,o=this.player;if(!r.isCloseClickSeek||0!==n){var s=t=t>=o.duration?o.duration-r.endedDiff:Number(t).toFixed(1);this.updatePercent(i),this.updateTime(e),(1!==n||r.isDraggingSeek&&"audio"!==o.config.mediaType)&&(this._state.now=s,this._state.direc=s>o.currentTime?0:1,o.seek(s))}}},{key:"computeTime",value:function(e,t){var i,n,r=this.player,o=this.root.getBoundingClientRect(),s=o.width,a=o.height,l=o.top,u=o.left,c=t;90===r.rotateDeg?(i=a,n=l):(i=s,n=u);var h=c-n,d=(h=h>i?i:h<0?0:h)/i;d=d<0?0:d>1?1:d,Number.isNaN(d)&&(d=this.player.currentTime/this.offsetDuration);var p=parseInt(d*this.offsetDuration*1e3,10)/1e3;return{percent:d,currentTime:p,seekTime:Ur.getCurrentTimeByOffset(p,r.timeSegments),offset:h,width:i,left:n,e:e}}},{key:"updateTime",value:function(e){var t=this.player,i=this.duration;e>i?e=i:e<0&&(e=0);var n=t.plugins.time;n&&n.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,t){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(100*e,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var i=this.player.plugins.miniprogress;i&&i.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var t=this.player,i=this._state,n=this.offsetDuration;if(!(t.isSeeking&&t.media.seeking||this.isProgressMoving)&&t.hasStart){if(i.now>-1){var r=parseInt(1e3*i.now,10)-parseInt(1e3*t.currentTime,10);if(0===i.direc&&r>300||1===i.direc&&r>-300)return void(i.now=-1);i.now=-1}var o=this.currentTime;o=Ur.adjustTimeByDuration(o,n,e),this.innerList.update({played:o},n),this.progressBtn.style.left="".concat(o/n*100,"%")}}},{key:"onCacheUpdate",value:function(e){var t=this.player,i=this.duration;if(t){var n=t.bufferedPoint.end;n=Ur.adjustTimeByDuration(n,i,e),this.innerList.update({cached:n},i)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var t=this.domEventType;"touch"!==t&&"compatible"!==t||(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),"mouse"!==t&&"compatible"!==t||(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){var e=this.player.controls?this.player.controls.config.mode:"";return'\n <xg-progress class="xgplayer-progress '.concat("bottom"===e?"xgplayer-progress-bottom":"",'">\n <xg-outer class="xgplayer-progress-outer">\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n </xg-outer>\n </xg-progress>\n ')}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_CENTER,index:0,disable:!1,isDraggingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:DO.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return DO}}]),i}(bs),RO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"_onMouseenter",(function(t){e.emit("icon_mouseenter",{pluginName:e.pluginName})})),mr(Sr(e),"_onMouseLeave",(function(t){e.emit("icon_mouseleave",{pluginName:e.pluginName})})),e}return vr(i,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),i}(bs),xO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"btnClick",(function(t){t.preventDefault(),t.stopPropagation();var i=Sr(e).player;return e.emitUserAction(t,"switch_play_pause",{prop:"paused",from:i.paused,to:!i.paused}),i.ended?i.replay():i.paused?(i.play(),e.animate(!1)):(i.pause(),e.animate(!0)),!1})),e}return vr(i,[{key:"afterCreate",value:function(){Cr(Er(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.initIcons(),this.bind(["touchend","click"],this.btnClick),this.listenEvents(),this.animate(!0))}},{key:"listenEvents",value:function(){var e=this,t=this.player;this.on([$r,Qr,Zr,co],(function(){e.animate(t.paused)}))}},{key:"registerIcons",value:function(){return{play:{icon:Hx,class:"xg-icon-play"},pause:{icon:Fx,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){if(this.player){var t=this.i18nKeys,i=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),i&&this.changeLangTextKey(i,t.PLAY_TIPS)):(this.setAttr("data-state","play"),i&&this.changeLangTextKey(i,t.PAUSE_TIPS))}}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-play">\n <div class="xgplayer-icon">\n </div>\n '.concat(Wx(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_LEFT,index:0,disable:!1}}}]),i}(RO);function OO(){return(new DOMParser).parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n </g>\n</svg>',"image/svg+xml").firstChild}var NO=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(t){t.preventDefault(),t.stopPropagation(),e.config.onClick(t)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:OO,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){Ur.addClass(this.root,"show")}},{key:"hide",value:function(){Ur.removeClass(this.root,"show")}},{key:"render",value:function(){return'<xg-icon class="xgplayer-back">\n </xg-icon>'}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:ms.ROOT_TOP,index:0}}}]),i}(bs);function MO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n',"image/svg+xml").firstChild}function UO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n',"image/svg+xml").firstChild}var BO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"_onOrientationChange",(function(t){e.player.fullscreen&&e.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?e.player.setRotateDeg(0):e.player.setRotateDeg(90))})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this;Cr(Er(i.prototype),"afterCreate",this).call(this);var t=this.config,n=this.playerConfig;if(!t.disable){t.target&&(this.playerConfig.fullscreenTarget=this.config.target);var r=Ur.getFullScreenEl();n.fullscreenTarget===r&&this.player.getFullscreen().catch((function(e){})),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(t){var i=e.player.fullscreen;e.emitUserAction(t,"switch_fullscreen",{prop:"fullscreen",from:i,to:!i})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(Io,(function(t){var i=e.find(".xg-tips");i&&e.changeLangTextKey(i,t?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(t)})),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:NO,options:{config:{onClick:function(t){e.handleFullscreen(t)}}}})),"mobile"===Kr.device&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:MO,class:"xg-get-fullscreen"},exitFullscreen:{icon:UO,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===Kr.device?"touchend":"click",this.handleFullscreen),"mobile"===Kr.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e instanceof Event&&(e.preventDefault(),e.stopPropagation());var t=this.player,i=this.config;!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen()?(t.fullscreen?t.exitCssFullscreen():t.getCssFullscreen(),this.animate(t.fullscreen)):i.rotateFullscreen?(t.fullscreen?t.exitRotateFullscreen():t.getRotateFullscreen(),this.animate(t.fullscreen)):i.switchCallback&&"function"==typeof i.switchCallback?i.switchCallback(t.fullscreen):t.fullscreen?(t.exitFullscreen(),i.useScreenOrientation&&this.unlockScreen()):(t.getFullscreen().catch((function(e){})),i.useScreenOrientation&&t.aspectRatio>1&&this.lockScreen(i.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){return'<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(Wx(this,"FULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch((function(e){}))}catch(t){}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch((function(e){}))}catch(e){}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),i}(RO),HO=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),(n=t.call(this,e)).isActiving=!1,n}return vr(i,[{key:"duration",get:function(){var e=this.player,t=e.offsetDuration,i=e.duration;return this.playerConfig.customDuration||t||i}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this.player.controls.config.mode;this.mode="flex"===e?"flex":"normal",this.config.disable||("flex"===this.mode&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.listenEvents())}},{key:"listenEvents",value:function(){var e=this;this.on([ro,eo,to],(function(t){"durationchange"===t.eventName&&(e.isActiving=!1),e.onTimeUpdate()})),this.on(qr,(function(){e.onTimeUpdate(!0)})),this.on(co,(function(){e.onReset()}))}},{key:"show",value:function(e){if("flex"===this.mode)return this.centerCurDom&&(this.centerCurDom.style.display="block"),void(this.centerDurDom&&(this.centerDurDom.style.display="block"));this.root.style.display="block"}},{key:"hide",value:function(){if("flex"===this.mode)return this.centerCurDom&&(this.centerCurDom.style.display="none"),void(this.centerDurDom&&(this.centerDurDom.style.display="none"));this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var t=this.player,i=this.config,n=this.duration;if(!i.disable&&!this.isActiving&&t.hasStart){var r=this.currentTime+this.timeOffset;r=Ur.adjustTimeByDuration(r,n,e),"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(Ur.format(r)),n!==1/0&&n>0&&(this.centerDurDom.innerHTML=Ur.format(n))):(this.timeDom.innerHTML=this.minWidthTime(Ur.format(r)),n!==1/0&&n>0&&(this.durationDom.innerHTML=Ur.format(n)))}}},{key:"onReset",value:function(){"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(Ur.format(0)),this.centerDurDom.innerHTML=Ur.format(0)):(this.timeDom.innerHTML=this.minWidthTime(Ur.format(0)),this.durationDom.innerHTML=Ur.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(e.controls&&e.controls.center){var t=e.controls.center;this.centerCurDom=Ur.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=Ur.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),t.children.length>0?t.insertBefore(this.centerCurDom,t.children[0]):t.appendChild(this.centerCurDom),t.appendChild(this.centerDurDom),this.extraEls=[this.centerCurDom,this.centerDurDom]}}},{key:"afterPlayerInit",value:function(){var e=this.config;this.duration===1/0||this.playerConfig.isLive?(Ur.hide(this.durationDom),Ur.hide(this.timeDom),Ur.hide(this.find(".time-separator")),Ur.show(this.find(".time-live-tag"))):Ur.hide(this.find(".time-live-tag")),e.hide?this.hide():this.show()}},{key:"changeLiveState",value:function(e){e?(Ur.hide(this.durationDom),Ur.hide(this.timeDom),Ur.hide(this.find(".time-separator")),Ur.show(this.find(".time-live-tag"))):(Ur.hide(this.find(".time-live-tag")),Ur.show(this.find(".time-separator")),Ur.show(this.durationDom),Ur.show(this.timeDom))}},{key:"updateTime",value:function(e){this.isActiving=!0,!e&&0!==e||e>this.duration||("flex"!==this.mode?this.timeDom.innerHTML=this.minWidthTime(Ur.format(e)):this.centerCurDom.innerHTML=this.minWidthTime(Ur.format(e)))}},{key:"minWidthTime",value:function(e){return e.split(":").map((function(e){return'<span class="time-min-width">'.concat(e,"</span>")})).join(":")}},{key:"resetActive",value:function(){var e=this,t=this.player,i=function(){e.isActiving=!1};this.off(eo,i),t.isSeeking&&t.media.seeking?this.once(eo,i):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-time">\n <span class="time-current">00:00</span>\n <span class="time-separator">/</span>\n <span class="time-duration">00:00</span>\n <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP,"</span>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_LEFT,index:2,disable:!1}}}]),i}(bs),FO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"_onDurationChange",(function(){e.updateSegments();var t=e.player,i=t.currentTime,n=t.timeSegments;if(e._checkIfEnabled(n)){var r=Ur.getIndexByTime(i,n),o=Ur.getOffsetCurrentTime(i,n,r);e.player.offsetCurrentTime=o,e.changeIndex(r,n)}})),mr(Sr(e),"_onLoadedData",(function(){var t=e.player.timeSegments;if(e._checkIfEnabled(t)){var i=Ur.getOffsetCurrentTime(0,t);e.player.offsetCurrentTime=i,e.changeIndex(0,t),e.curPos.start>0&&(e.player.currentTime=e.curPos.start)}})),mr(Sr(e),"_onTimeupdate",(function(){var t=e.player,i=t.currentTime,n=t.timeSegments;if(e._checkIfEnabled(n)){var r=n.length;e.lastCurrentTime=i;var o=Ur.getIndexByTime(i,n);o!==e.curIndex&&e.changeIndex(o,n);var s=Ur.getOffsetCurrentTime(i,n,o);if(e.player.offsetCurrentTime=s,e.curPos){var a=e.curPos,l=a.start,u=a.end;i<l?e.player.currentTime=l:i>u&&o>=r-1&&e.player.pause()}}})),mr(Sr(e),"_onSeeking",(function(){var t=e.player,i=t.currentTime,n=t.timeSegments;if(e._checkIfEnabled(n))if(i<n[0].start)e.player.currentTime=n[0].start;else if(i>n[n.length-1].end)e.player.currentTime=n[n.length-1].end;else{var r=Ur.getIndexByTime(i,n);if(r>=0){var o=e.getSeekTime(i,e.lastCurrentTime,r,n);o>=0&&(e.player.currentTime=o)}}})),mr(Sr(e),"_onPlay",(function(){var t=e.player,i=t.currentTime,n=t.timeSegments;e._checkIfEnabled(n)&&i>=n[n.length-1].end&&(e.player.currentTime=n[0].start)})),e}return vr(i,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(ro,this._onDurationChange),this.on(so,this._onLoadedData),this.on(to,this._onTimeupdate),this.on(Jr,this._onSeeking),this.on($r,this._onPlay)}},{key:"setConfig",value:function(e){var t=this;if(e){var i=Object.keys(e);i.length<1||(i.forEach((function(i){t.config[i]=e[i]})),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,t=e.disable,i=e.segments,n=this.player;if(t||!i||0===i.length)n.timeSegments=[],n.offsetDuration=0,n.offsetCurrentTime=-1;else{var r=this.formatTimeSegments(i,n.duration);n.timeSegments=r,n.offsetDuration=r.length>0?r[r.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,t){var i=[];return e?(e.sort((function(e,t){return e.start-t.start})),e.forEach((function(e,n){var r={};if(r.start=e.start<0?0:e.start,r.end=t>0&&e.end>t?t:e.end,!(t>0&&r.start>t)){i.push(r);var o=r.end-r.start;if(0===n)r.offset=e.start,r.cTime=0,r.segDuration=o,r.duration=o;else{var s=i[n-1];r.offset=s.offset+(r.start-s.end),r.cTime=s.duration+s.cTime,r.segDuration=o,r.duration=s.duration+o}}})),i):[]}},{key:"getSeekTime",value:function(e,t,i,n){var r=-1,o=n[i],s=o.start,a=o.end;if(e>=s&&e<=a)return r;var l=e-t;if(l<0&&e<s){var u=t>s?t-s:0;return r=i-1>=0?n[i-1].end+l+u:0}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,t){this.curIndex=e,e>=0&&t.length>0?this.curPos=t[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),i}(cs);function jO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function VO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function KO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>\n</svg>\n',"image/svg+xml").firstChild}var GO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onBarMousedown",(function(t){var i=Sr(e).player,n=e.find(".xgplayer-bar");Ur.event(t);var r=n.getBoundingClientRect(),o=Ur.getEventPos(t,i.zoom),s=r.height-(o.clientY-r.top);if(o.h=s,o.barH=r.height,e.pos=o,!(s<-2))return e.updateVolumePos(s,t),document.addEventListener("mouseup",e.onBarMouseUp),e._d.isStart=!0,!1})),mr(Sr(e),"onBarMouseMove",(function(t){var i=Sr(e)._d;if(i.isStart){var n=Sr(e),r=n.pos,o=n.player;t.preventDefault(),t.stopPropagation(),Ur.event(t);var s=Ur.getEventPos(t,o.zoom);i.isMoving=!0;var a=r.h-s.clientY+r.clientY;a>r.barH||e.updateVolumePos(a,t)}})),mr(Sr(e),"onBarMouseUp",(function(t){Ur.event(t),document.removeEventListener("mouseup",e.onBarMouseUp);var i=Sr(e)._d;i.isStart=!1,i.isMoving=!1})),mr(Sr(e),"onMouseenter",(function(t){e._d.isActive=!0,e.focus(),e.emit("icon_mouseenter",{pluginName:e.pluginName})})),mr(Sr(e),"onMouseleave",(function(t){e._d.isActive=!1,e.unFocus(100,!1,t),e.emit("icon_mouseleave",{pluginName:e.pluginName})})),mr(Sr(e),"onVolumeChange",(function(t){if(e.player){var i=e.player,n=i.muted,r=i.volume;e._d.isMoving||(e.find(".xgplayer-drag").style.height=n||0===r?"4px":"".concat(100*r,"%"),e.config.showValueLabel&&e.updateVolumeValue()),e.animate(n,r)}})),e}return vr(i,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:VO,class:"xg-volume-small"},volumeLarge:{icon:jO,class:"xg-volume"},volumeMuted:{icon:KO,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var t=this.playerConfig,i=t.commonStyle,n=t.volume;i.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=i.volumeColor),this.changeMutedHandler=this.hook("mutedChange",(function(t){e.changeMuted(t)}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),"mobile"!==Kr.device&&"mobile"!==this.playerConfig.isMobileSimulateMode&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(oo,this.onVolumeChange),this.once(so,this.onVolumeChange),"Number"!==Ur.typeOf(n)&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,t){var i=this.player,n=this.find(".xgplayer-drag"),r=this.find(".xgplayer-bar");if(r&&n){var o=parseInt(e/r.getBoundingClientRect().height*1e3,10);n.style.height="".concat(e,"px");var s=Math.max(Math.min(o/1e3,1),0),a={volume:{from:i.volume,to:s}};i.muted&&(a.muted={from:!0,to:!1}),this.emitUserAction(t,"change_volume",{muted:i.muted,volume:i.volume,props:a}),i.volume=Math.max(Math.min(o/1e3,1),0),i.muted&&(i.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,t=e.volume,i=e.muted,n=this.find(".xgplayer-value-label"),r=Math.max(Math.min(t,1),0);n.innerText=i?0:Math.round(100*r)}},{key:"focus",value:function(){this.player.focus({autoHide:!1}),this._timerId&&(Ur.clearTimeout(this,this._timerId),this._timerId=null),Ur.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=this._d,o=this.player;r.isActive||(this._timerId&&(Ur.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=Ur.setTimeout(this,(function(){r.isActive||(i?o.blur():o.focus(),Ur.removeClass(e.root,"slide-show"),r.isStart&&e.onBarMouseUp(n)),e._timerId=null}),t))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var t=this.player;this._d.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:t.muted,volume:t.volume,props:{muted:{from:t.muted,to:!t.muted}}}),t.volume>0&&(t.muted=!t.muted),t.volume<.01&&(t.volume=this.config.miniVolume)}},{key:"animate",value:function(e,t){e||0===t?this.setAttr("data-state","mute"):t<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(Ur.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon","mobile"===Kr.device?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,t=this.config.showValueLabel;return'\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(t?'<div class="xgplayer-value-label">'.concat(100*e,"</div>"):"",'\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ').concat(100*e,'%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>')}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),i}(bs);function WO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">\n <g>\n <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>\n <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>\n </g>\n <defs>\n <clipPath>\n <rect width="40" height="40" fill="white"/>\n </clipPath>\n </defs>\n</svg>\n',"image/svg+xml").firstChild}var YO=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),(n=t.call(this,e)).rotateDeg=n.config.rotateDeg||0,n}return vr(i,[{key:"afterCreate",value:function(){var e=this;if(!this.config.disable){Cr(Er(i.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(Lo,(function(){e.rotateDeg&&e.config.innerRotate&&Ur.setTimeout(e,(function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)}),100)}));var t=this.player.root;this.rootWidth=t.style.width||t.offsetWidth||t.clientWidth,this.rootHeight=t.style.height||t.offsetHeight||t.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,t){if(e||(e=0),t)this.player.videoRotateDeg=e;else{var i=this.player,n=this.rootWidth,r=this.rootHeight,o=i.root,s=i.innerContainer,a=i.media,l=o.offsetWidth,u=s&&t?s.offsetHeight:o.offsetHeight,c=n,h=r,d=0,p=0;.75!==e&&.25!==e||(c="".concat(u,"px"),h="".concat(l,"px"),d=-(u-l)/2,p=-(l-u)/2);var f="translate(".concat(d,"px,").concat(p,"px) rotate(").concat(e,"turn)"),g={transformOrigin:"center center",transform:f,webKitTransform:f,height:h,width:c},y=t?a:o,v=t?i.getPlugin("poster"):null;Object.keys(g).map((function(e){y.style[e]=g[e],v&&v.root&&(v.root.style[e]=g[e])}))}}},{key:"rotate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.player;this.rotateDeg||(this.rotateDeg=0);var r=e?1:-1;this.rotateDeg=(this.rotateDeg+1+.25*r*i)%1,this.updateRotateDeg(this.rotateDeg,t),n.emit(xo,360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:WO}}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-icon class="xgplayer-rotate">\n <div class="xgplayer-icon">\n </div>\n '.concat(Wx(this,"ROTATE_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),i}(RO);function zO(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}function $O(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}var XO="picture-in-picture",qO="inline",QO="fullscreen",ZO=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"switchPIP",(function(t){if(!e.isPIPAvailable())return!1;t.stopPropagation&&t.stopPropagation(),e.isPip?(e.exitPIP(),e.emitUserAction(t,"change_pip",{props:"pip",from:!0,to:!1}),e.setAttr("data-state","normal")):4===e.player.media.readyState&&(e.requestPIP(),e.emitUserAction(t,"change_pip",{props:"pip",from:!1,to:!0}),e.setAttr("data-state","pip"))})),e}return vr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.pip&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(Cr(Er(i.prototype),"afterCreate",this).call(this),this.pMode=qO,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(mo,(function(){e.config.showIcon&&(Ur.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))})))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:zO,class:"xg-get-pip"},pipIconExit:{icon:$O,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var e=this,t=this.player;this.leavePIPCallback=function(){var i=t.paused;Ur.setTimeout(e,(function(){!i&&t.mediaPlay()}),0),!i&&t.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,t.emit(Ro,!1)},this.enterPIPCallback=function(i){t.emit(Ro,!0),null!=i&&i.pictureInPictureWindow&&(e.pipWindow=i.pictureInPictureWindow),e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(i){var n=t.media.webkitPresentationMode;e.pMode===QO&&n!==QO&&t.onFullscreenChange(null,!1),e.pMode=n,n===XO?e.enterPIPCallback(i):n===qO&&e.leavePIPCallback(i)},t.media&&(t.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),t.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),i.checkWebkitSetPresentationMode(t.media)&&t.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"copyStyleIntoPiPWindow",value:function(e){var t=Ir(document.styleSheets).map((function(t){try{return Ir(t.cssRules).map((function(e){return e.cssText})).join("")}catch(n){var i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media,i.href=t.href,e.document.head.appendChild(i)}return""})).filter(Boolean).join("\n"),i=document.createElement("style");i.textContent=t,e.document.head.appendChild(i)}},{key:"requestPIP",value:function(){var e=this,t=this.player,n=this.playerConfig,r=this.config;if(this.isPIPAvailable()&&!this.isPip)try{var o=n.poster;if(o&&(t.media.poster="String"===Ur.typeOf(o)?o:o.poster),r.preferDocument&&this.isDocPIPAvailable()){var s={};if(r.width&&r.height)s.width=r.width,s.height=r.height;else{var a=t.root.getBoundingClientRect();s.width=a.width,s.height=a.height}documentPictureInPicture.requestWindow(s).then((function(i){var n=r.docPiPNode,o=r.docPiPStyle;e.enterPIPCallback();var s=n||t.root,a=s.parentElement,l=s.previousSibling,u=s.nextSibling;e.copyStyleIntoPiPWindow(i);var c=document.createElement("style");if(c.append("body{padding:0; margin:0;}"),o){var h="";"string"==typeof o?h=o:"function"==typeof o&&(h=o.call(r)),h&&c.append(h)}else s===t.root&&c.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");i.document.head.append(c),i.document.body.append(s),i.addEventListener("pagehide",(function(t){a&&(u?a.insertBefore(s,u):l?a.insertBefore(s,l.nextSibling):a.appendChild(s)),e.leavePIPCallback()}),{once:!0})}))}else i.checkWebkitSetPresentationMode(t.media)?t.media.webkitSetPresentationMode("picture-in-picture"):t.media.requestPictureInPicture();return!0}catch(l){return console.error("requestPiP",l),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{var t;if(this.isPIPAvailable()&&this.isPip)this.isDocPIPAvailable()&&null!==(t=documentPictureInPicture)&&void 0!==t&&t.window?documentPictureInPicture.window.close():i.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture();return!0}catch(n){return console.error("exitPIP",n),!1}}},{key:"isPip",get:function(){var e,t=this.player;return!(!this.isDocPIPAvailable()||null===(e=documentPictureInPicture)||void 0===e||!e.window)||document.pictureInPictureElement&&document.pictureInPictureElement===t.media||t.media.webkitPresentationMode===XO}},{key:"isPIPAvailable",value:function(){var e=this.player.media;return"Boolean"===Ur.typeOf(document.pictureInPictureEnabled)&&document.pictureInPictureEnabled&&("Boolean"===Ur.typeOf(e.disablePictureInPicture)&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&"Function"===Ur.typeOf(e.webkitSetPresentationMode))||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return"documentPictureInPicture"in window&&/^(https|file)/.test(location.protocol)}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this);var e=this.player;e.media.removeEventListener("enterpictureinpicture",this.enterPIPCallback),e.media.removeEventListener("leavepictureinpicture",this.leavePIPCallback),i.checkWebkitSetPresentationMode(e.media)&&e.media.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.exitPIP(),this.unbind("click",this.btnClick)}},{key:"render",value:function(){if(this.config.showIcon&&this.isPIPAvailable())return'<xg-icon class="xgplayer-pip">\n <div class="xgplayer-icon xg-icon-disable">\n </div>\n '.concat(Wx(this,"PIP",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return"function"==typeof e.webkitSetPresentationMode}}]),i}(RO);function JO(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">\n <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>\n</svg>\n',"image/svg+xml").firstChild}var eN=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"playNext",(function(e){var t=Sr(n).player;e.preventDefault(),e.stopPropagation(),n.idx+1<n.config.urlList.length?(n.idx++,n.nextHandler(n.config.urlList[n.idx],n.idx),t.emit(No,n.idx+1)):(n.nextHandler(),t.emit(No))})),n.idx=-1,n}return vr(i,[{key:"afterCreate",value:function(){this.config.urlList&&0!==this.config.urlList.length&&(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:JO}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e="mobile"===Kr.device?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var t=this.player;e&&(t.pause(),t.currentTime=0,t.switchURL?t.switchURL(e):t.src=e,t.config.url=e,t.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(this.config.urlList&&0!==this.config.urlList.length)return'\n <xg-icon class="xgplayer-playnext">\n <div class="xgplayer-icon">\n </div>\n '.concat(Wx(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),i}(bs),tN={exports:{}};!function(e,t){e.exports=function e(t,i,n){var r,o,s=window,a="application/octet-stream",l=n||a,u=t,c=!i&&!n&&u,h=document.createElement("a"),d=function(e){return String(e)},p=s.Blob||s.MozBlob||s.WebKitBlob||d,f=i||"download";if(p=p.call?p.bind(s):Blob,"true"===String(this)&&(l=(u=[u,l])[0],u=u[1]),c&&c.length<2048&&(f=c.split("/").pop().split("?")[0],h.href=c,-1!==h.href.indexOf(c))){var g=new XMLHttpRequest;return g.open("GET",c,!0),g.responseType="blob",g.onload=function(t){e(t.target.response,f,a)},setTimeout((function(){g.send()}),0),g}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(u)){if(!(u.length>2096103.424&&p!==d))return navigator.msSaveBlob?navigator.msSaveBlob(_(u),f):E(u);l=(u=_(u)).type||a}else if(/([\x80-\xff])/.test(u)){for(var y=0,v=new Uint8Array(u.length),m=v.length;y<m;++y)v[y]=u.charCodeAt(y);u=new p([v],{type:l})}function _(e){for(var t=e.split(/[:;,]/),i=t[1],n=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=n.length,o=0,s=new Uint8Array(r);o<r;++o)s[o]=n.charCodeAt(o);return new p([s],{type:i})}function E(e,t){if("download"in h)return h.href=e,h.setAttribute("download",f),h.className="download-js-link",h.innerHTML="downloading...",h.style.display="none",document.body.appendChild(h),setTimeout((function(){h.click(),document.body.removeChild(h),!0===t&&setTimeout((function(){s.URL.revokeObjectURL(h.href)}),250)}),66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,a)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var i=document.createElement("iframe");document.body.appendChild(i),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,a)),i.src=e,setTimeout((function(){document.body.removeChild(i)}),333)}if(r=u instanceof p?u:new p([u],{type:l}),navigator.msSaveBlob)return navigator.msSaveBlob(r,f);if(s.URL)E(s.URL.createObjectURL(r),!0);else{if("string"==typeof r||r.constructor===d)try{return E("data:"+l+";base64,"+s.btoa(r))}catch(T){return E("data:"+l+","+encodeURIComponent(r))}(o=new FileReader).onload=function(e){E(this.result)},o.readAsDataURL(r)}return!0}}(tN);const iN=lr(tN.exports);function nN(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">\n <g id="Group-2">\n <g id="volme_big-copy" transform="translate(488.000000, 340.000000)">\n <rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>\n <rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>\n <rect id="Rectangle-2" transform="translate(4.000000, 17.500000) rotate(90.000000) translate(-4.000000, -17.500000) " x="1.5" y="16.5" width="5" height="2" rx="1"></rect><rect id="Rectangle-2-Copy-3" transform="translate(20.000000, 17.500000) rotate(90.000000) translate(-20.000000, -17.500000) " x="17.5" y="16.5" width="5" height="2" rx="1"></rect>\n <path d="M9.48791171,8.26502656 L9.48791171,14.2650266 C9.48791171,14.8173113 9.04019646,15.2650266 8.48791171,15.2650266 C7.93562696,15.2650266 7.48791171,14.8173113 7.48791171,14.2650266 L7.48791171,7.26502656 C7.48791171,6.71274181 7.93562696,6.26502656 8.48791171,6.26502656 L15.4879117,6.26502656 C16.0401965,6.26502656 16.4879117,6.71274181 16.4879117,7.26502656 C16.4879117,7.81731131 16.0401965,8.26502656 15.4879117,8.26502656 L9.48791171,8.26502656 Z" id="Combined-Shape" transform="translate(11.987912, 10.765027) scale(1, -1) rotate(45.000000) translate(-11.987912, -10.765027) "></path>\n </g>\n </g>\n </g>\n </g>\n</svg>\n',"image/svg+xml").firstChild}var rN=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"download",(function(e){if(!n.isLock){n.emitUserAction(e,"download");var t=n.playerConfig.url,i="";"String"===Ur.typeOf(t)?i=t:"Array"===Ur.typeOf(t)&&t.length>0&&(i=t[0].src);var r=n.getAbsoluteURL(i);iN(r),n.isLock=!0,n.timer=window.setTimeout((function(){n.isLock=!1,window.clearTimeout(n.timer),n.timer=null}),300)}})),n.timer=null,n.isLock=!1,n}return vr(i,[{key:"afterCreate",value:function(){Cr(Er(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:nN}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var t=document.createElement("div");t.innerHTML='<a href="'.concat(e,'">x</a>'),e=t.firstChild.href}return e}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n <div class="xgplayer-icon">\n </div>\n '.concat(Wx(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:3,disable:!0}}}]),i}(RO),oN=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.screenShot&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){Cr(Er(i.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(t){e.fitVideo&&(e.width=t.vWidth,e.height=t.vHeight)},this.once(Lo,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,t){var i,n=document.createElement("a");n.href=e,n.download=t;try{"undefined"!=typeof MouseEvent?i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(i=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}catch(r){console.error("MouseEvent unsupported",r)}i&&n.dispatchEvent(i)}},{key:"createCanvas",value:function(e,t){var i=document.createElement("canvas"),n=i.getContext("2d");this.canvasCtx=n,this.canvas=i,i.width=e||this.config.width,i.height=t||this.config.height,n.imageSmoothingEnabled=!0,n.imageSmoothingEnabled&&(n.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var t=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var i=this.config;this.shot(i.width,i.height).then((function(e){t.emit(Oo,e),i.saveImg&&t.saveScreenShot(e,i.name+i.format)}))}},{key:"shot",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{quality:.92,type:"image/png"},r=this.config,o=this.player,s=n.quality||r.quality,a=n.type||r.type;return new Promise((function(n,l){var u,c=null;if(o.media.canvas)c=o.media.canvas;else{i.canvas?(i.canvas.width=e||r.width,i.canvas.height=t||r.height):i.createCanvas(e,t),c=i.canvas,u=i.canvasCtx;var h,d,p,f,g=o.media.videoWidth/o.media.videoHeight,y=c.width/c.height,v=o.media.videoWidth,m=o.media.videoHeight;g>y?(p=c.width,f=c.width/g,h=0,d=Math.round((c.height-f)/2)):g===y?(p=c.width,f=c.height,h=0,d=0):g<y&&(p=c.height*g,f=c.height,h=Math.round((c.width-p)/2),d=0),u.drawImage(o.media,0,0,v,m,h,d,p,f)}var _=c.toDataURL(a,s).replace(a,"image/octet-stream");n(_=_.replace(/^data:image\/[^;]+/,"data:application/octet-stream"))}))}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(Lo,this.initSize)}},{key:"render",value:function(){if(!this.config.disable){var e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",t="SCREENSHOT";return'\n <xg-icon class="xgplayer-shot">\n <div class="'.concat(e,'">\n ').concat(this.icons.screenshotIcon?"":'<span lang-key="'.concat(this.i18nKeys[t],'">').concat(this.i18n[t],"</span>"),"\n </div>\n </xg-icon>")}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),i}(RO),sN=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),(n=t.call(this,e)).curTime=0,n.isPaused=!0,n}return vr(i,[{key:"beforeCreate",value:function(e){var t=e.config.list;Array.isArray(t)&&t.length>0&&(e.config.list=t.map((function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})))}},{key:"afterCreate",value:function(){var e=this;Cr(Er(i.prototype),"afterCreate",this).call(this),this.on("resourceReady",(function(t){e.changeDefinitionList(t)})),this.on(wo,(function(t){e.renderItemList(e.config.list,t.to)})),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||Ur.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,t=e.list,i=e.defaultDefinition;if(t.length>0){var n=null;t.map((function(e){e.definition===i&&(n=e)})),n||(n=t[0]),this.changeDefinition(n)}}},{key:"renderItemList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,r=n&&n.definition?n.definition:this.config.defaultDefinition;n&&t.forEach((function(e){e.selected=!1}));var o=0,s=t.map((function(t,i){var n=pr(pr({},t),{},{showText:e.getTextByLang(t)||t.definition,selected:!1});return(t.selected||t.definition&&t.definition==r)&&(n.selected=!0,o=i),n}));Cr(Er(i.prototype),"renderItemList",this).call(this,s,o)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map((function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,t){this.player.changeDefinition(e,t)}},{key:"onItemClick",value:function(e,t){var n=this.player.definitionList;Cr(Er(i.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:t.from,to:t.to});for(var r=0;r<n.length;r++)t.to&&n[r].definition===t.to.definition&&(t.to.url=n[r].url),t.from&&n[r].definition===t.from.definition&&(t.from.url=n[r].url);this.player.changeDefinition(t.to,t.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return pr(pr({},BD.defaultConfig),{},{position:ms.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),i}(BD),aN=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),(n=t.call(this,e)).curRate=1,n}return vr(i,[{key:"beforeCreate",value:function(e){var t=e.player.config.playbackRate,i=t?Array.isArray(t)?t:e.config.list:[];Array.isArray(i)&&(e.config.list=i.map((function(e){return"number"==typeof e?e={rate:e,text:"".concat(e,"x")}:!e.text&&e.rate&&(e.text="".concat(e.rate,"x")),e})))}},{key:"afterCreate",value:function(){var e=this;Cr(Er(i.prototype),"afterCreate",this).call(this),this.on(ao,(function(){e.curValue!==e.player.playbackRate&&e.renderItemList()})),this.renderItemList()}},{key:"show",value:function(e){this.config.list&&0!==this.config.list.length&&Cr(Er(i.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,t){Cr(Er(i.prototype),"onItemClick",this).call(this,e,t);var n=e.delegateTarget,r=Number(n.getAttribute("rate"));if(!r||r===this.curValue)return!1;var o={playbackRate:{from:this.player.playbackRate,to:r}};this.emitUserAction(e,"change_rate",{props:o}),this.curValue=r,this.player.playbackRate=r}},{key:"renderItemList",value:function(){var e=this,t=this.player.playbackRate||1;this.curValue=t;var n=-1,r=this.config.list.map((function(i,r){var o={rate:i.rate};return o.rate===t&&(o.selected=!0,n=r),o.showText=e.getTextByLang(i),o}));Cr(Er(i.prototype),"renderItemList",this).call(this,r,n)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0],i="";i=!t||this.curIndex<0?"".concat(this.player.playbackRate,"x"):this.getTextByLang(t,"iconText"),this.find(".icon-text").innerHTML=i}}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return pr(pr({},BD.defaultConfig),{},{position:ms.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),i}(BD);function lN(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" class=\'path_full\' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}function uN(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var cN=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.cssFullscreen&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;Cr(Er(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(Ao,(function(t){e.animate(t)})),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,t=this.find(".xgplayer-icon");t.appendChild(e.cssFullscreen),t.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:t}),t?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var t=this.i18nKeys,i=this.find(".xg-tips");i&&this.changeLangTextKey(i,e?t.EXITCSSFULLSCREEN_TIPS:t.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:lN,class:"xg-get-cssfull"},exitCssFullscreen:{icon:uN,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){Cr(Er(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return"<xg-icon class='xgplayer-cssfullscreen'>\n <div class=\"xgplayer-icon\">\n </div>\n ".concat(Wx(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:ms.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),i}(RO),hN=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(Zr,(function(t){e.onError(t)}))}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.player,i=e.errorType,n=t.errorNote?this.i18n[t.errorNote]:"";if(!n)switch(i){case"decoder":n=this.i18n.MEDIA_ERR_DECODE;break;case"network":n=this.i18n.MEDIA_ERR_NETWORK;break;default:n=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=n,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return'<xg-error class="xgplayer-error">\n <div class="xgplayer-errornote">\n <span class="xgplayer-error-text"></span>\n <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n </div>\n </xg-error>'}}],[{key:"pluginName",get:function(){return"error"}}]),i}(bs),dN=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],(function(t){(e.config.onClick||e.customOnClick)&&(t.preventDefault(),t.stopPropagation(),e.customOnClick?e.customOnClick(t):e.config.onClick(t))})),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var t=this;Object.keys(e).map((function(i){t.root.style[i]=e[i]}))}},{key:"showPrompt",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){this.customOnClick=n;var r=this.config.interval;if(this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),Ur.addClass(this.root,"show"),"arrow"===i.mode&&Ur.addClass(this.root,"arrow"),this.find(".xgplayer-prompt-detail").innerHTML="string"==typeof e?e:"".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),i.style&&this.setStyle(i.style),"boolean"==typeof i.autoHide?i.autoHide:this.config.autoHide){var o=i.interval||r;this.intervalId=setTimeout((function(){t.hide()}),o)}}}},{key:"hide",value:function(){Ur.removeClass(this.root,"show"),Ur.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(As.CONTROLS_FOLLOW,'">\n <span class="xgplayer-prompt-detail"></span>\n </xg-prompt>')}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),i}(bs),pN={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function fN(e){Object.keys(pN).map((function(t){void 0===e[t]&&(e[t]=pN[t])}))}var gN={_updateDotDom:function(e,t){if(t){var i=this.calcuPosition(e.time,e.duration),n=e.style||{};n.left="".concat(i.left,"%"),n.width="".concat(i.width,"%"),t.setAttribute("data-text",e.text),t.setAttribute("data-time",e.time),i.isMini?Ur.addClass(t,"mini"):Ur.removeClass(t,"mini"),Object.keys(n).map((function(e){t.style[e]=n[e]}))}},initDots:function(){var e=this;this._ispots.map((function(t){e.createDot(t,!1)})),this.ispotsInit=!0},createDot:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.player.plugins.progress;if(i&&(t&&(fN(e),this._ispots.push(e)),this.ispotsInit||!t)){var n=this.calcuPosition(e.time,e.duration),r=e.style||{};r.left="".concat(n.left,"%"),r.width="".concat(n.width,"%");var o="xgspot_".concat(e.id," xgplayer-spot");n.isMini&&(o+=" mini");var s=e.template?'<div class="xgplayer-spot-pop">'.concat(e.template,"</div>"):"",a=Ur.createDom("xg-spot",s,{"data-text":e.text,"data-time":e.time,"data-id":e.id},o);Object.keys(r).map((function(e){a.style[e]=r[e]})),i.outer&&i.outer.appendChild(a),this.positionDot(a,e.id)}},findDot:function(e){if(this.player.plugins.progress){var t=this._ispots.filter((function(t,i){return t.id===e}));return t.length>0?t[0]:null}},updateDot:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.player.plugins.progress;if(i){var n=this.findDot(e.id);if(n&&Object.keys(e).map((function(t){n[t]=e[t]})),this.ispotsInit){var r=i.find('xg-spot[data-id="'.concat(e.id,'"]'));r&&(this._updateDotDom(e,r),t&&this.showDot(e.id))}}},deleteDot:function(e){var t=this._ispots,i=this.player.plugins.progress;if(i){for(var n=[],r=0;r<t.length;r++)t[r].id===e&&n.push(r);for(var o=n.length-1;o>=0;o--)if(t.splice(n[o],1),this.ispotsInit){var s=i.find('xg-spot[data-id="'.concat(e,'"]'));s&&s.parentElement.removeChild(s)}}},deleteAllDots:function(){var e=this.player.plugins.progress;if(e)if(this.ispotsInit){for(var t=e.root.getElementsByTagName("xg-spot"),i=t.length-1;i>=0;i--)e.outer.removeChild(t[i]);this._ispots=[]}else this._ispots=[]},updateAllDots:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=this.player.plugins.progress;if(i)if(this.ispotsInit){this._ispots=[];var n=i.root.getElementsByTagName("xg-spot"),r=n.length;if(r>t.length)for(var o=r-1;o>t.length-1;o--)i.outer.removeChild(n[o]);t.forEach((function(t,i){i<r?(n[i].setAttribute("data-id","".concat(t.id)),e._ispots.push(t),e.updateDot(t)):e.createDot(t)}))}else this._ispots=t},positionDots:function(){var e=this,t=this._ispots,i=this.playerSize,n=this.player.sizeInfo,r=this.player.plugins.progress;r&&n.width!==i.width&&(i.width=n.width,i.left=n.left,t.forEach((function(t){var i=r.find('xg-spot[data-id="'.concat(t.id,'"]'));i&&e.positionDot(i,t.id)})))},positionDot:function(e,t){var i=Ur.findDom(e,".xgplayer-spot-pop");if(i){var n=this.playerSize,r=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=r.left-n.left,a=n.width-s-r.width/2;if(s<o.width/2||n.width<o.width){var l=o.width/2-s;i.style.left="".concat(l,"px")}else if(a<o.width/2){var u=a-o.width/2+r.width/2;i.style.left="".concat(u,"px")}else i.style.left="50%"}},updateDuration:function(){var e=this,t=this.player.plugins.progress;t&&this._ispots.forEach((function(i){var n=t.find('xg-spot[data-id="'.concat(i.id,'"]'));e._updateDotDom(i,n)}))},getAllDotsDom:function(){var e=this.player.plugins.progress;return e?e.root.getElementsByTagName("xg-spot"):[]},getDotDom:function(e){var t=this.player.plugins.progress;if(t)return t.find('xg-spot[data-id="'.concat(e,'"]'))}};var yN={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},vN=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),mr(Sr(n=t.call(this,e)),"onMousemove",(function(e){n.config.disable||(Ur.hasClass(e.target,"xg-spot-content")&&n.config.isHideThumbnailHover?n.player.plugins.progress.onMouseLeave(e):(n._state.f||Ur.hasClass(e.target,"xg-spot-content"))&&(Ur.event(e),e.stopPropagation()))})),mr(Sr(n),"onMousedown",(function(e){n.config.disable||(n._state.f||Ur.hasClass(e.target,"xg-spot-content"))&&(Ur.event(e),e.stopPropagation())})),mr(Sr(n),"onMouseup",(function(e){if(n.isDrag){var t=n.player.plugins.progress;t&&t.pos&&(t.onMouseUp(e),!t.pos.isEnter&&t.onMouseLeave(e))}})),mr(Sr(n),"onDotMouseLeave",(function(e){if(!n.config.disable){n._curDot.removeEventListener("mouseleave",n.onDotMouseLeave),n.blurDot(e.target),n._curDot=null;var t=n.player.plugins.progress;t&&t.enableBlur(),n.show()}})),mr(Sr(n),"onProgressMouseOver",(function(e,t){if(!n.config.disable&&Ur.hasClass(t.target,"xgplayer-spot")&&!n._curDot){n._curDot=t.target,n.focusDot(t.target),n._curDot.children.length>0&&n.hide();var i=n.player.plugins.progress;i&&i.disableBlur(),n._curDot.addEventListener("mouseleave",n.onDotMouseLeave)}})),n._ispots=[],n.videoPreview=null,n.videothumbnail=null,n.thumbnail=null,n.timeStr="",n._state={now:0,f:!1},n}return vr(i,[{key:"beforeCreate",value:function(e){var t=e.player.plugins.progress;t&&(e.root=t.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",(function(t,i){i.seekTime&&e.player.seek(i.seekTime)})),this.transformTimeHook=this.hook("transformTime",(function(t){e.setTimeContent(Ur.format(t))})),function(e){var t=e.config,i=e.player;Object.keys(gN).map((function(t){e[t]=gN[t].bind(e)}));var n=i.config.progressDot||t.ispots||[];e._ispots=n.map((function(e){return fN(e),e})),e.ispotsInit=!1,e.playerSize={left:i.sizeInfo.left,width:i.sizeInfo.width},e.on(ro,(function(){e.ispotsInit?e.updateDuration():e.initDots()})),e.on(Lo,(function(){e.positionDots()}))}(this),this.on(ro,(function(){e.show()})),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(i){t.config[i]=e[i]}))}},{key:"onPluginsReady",value:function(){this.player.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e=this,t=this.player.plugins.progress;if(t&&(Object.keys(yN).map((function(i){e[yN[i]]=e[yN[i]].bind(e),t.addCallBack(i,e[yN[i]])})),"mobile"!==Kr.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 i=this.hook("previewClick",(function(){}));this.handlerPreviewClick=function(n){n.stopPropagation(),i(parseInt(1e3*e._state.now,10)/1e3,n),t&&t.onMouseUp(n)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,t){!this.config.disable&&this.player.duration&&this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!0,this.videoPreview&&Ur.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!1,this.videoPreview&&Ur.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,t){this.config.disable||Ur.hasClass(t.target,"xgplayer-spot")&&(t.stopPropagation(),t.preventDefault(),["time","id","text"].map((function(i){e[i]=t.target.getAttribute("data-".concat(i))})),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(t,e))}},{key:"updateLinePos",value:function(e,t){var i=this.root,n=this.previewLine,r=this.player,o=this.config,s="flex"===r.controls.mode,a=i.getBoundingClientRect().width;if(a||!this._hasThumnail){var l,u=e-(a=this._hasThumnail&&a<o.width?o.width:a)/2;u<0&&!s?(u=0,l=e-a/2):u>t-a&&!s?(l=u-(t-a),u=t-a):l=0,void 0!==l&&(n.style.transform="translateX(".concat(l.toFixed(2),"px)")),i.style.transform="translateX(".concat(u.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var t=this.timeText,i=this.timePoint;t.innerHTML=e,!this.thumbnail&&(i.innerHTML=e)}},{key:"updatePosition",value:function(e,t,i,n){var r=this.root,o=this.config,s=this._state;if(r){s.now=i,this.transformTimeHook(i);var a=this.timeStr;n&&n.target&&Ur.hasClass(n.target,"xgplayer-spot")?(this.showTips(n.target.getAttribute("data-text"),!1,a),this.focusDot(n.target),s.f=!0,o.isFocusDots&&s.f&&(s.now=parseInt(n.target.getAttribute("data-time"),10))):o.defaultText?(s.f=!1,this.showTips(o.defaultText,!0,a)):(s.f=!1,this.hideTips("")),this.updateTimeText(a),this.updateThumbnails(s.now),this.updateLinePos(e,t)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var t=this.player,i=this.videoPreview,n=this.config,r=t.plugins.thumbnail;if(r&&r.usable){this.thumbnail&&r.update(this.thumbnail,e,n.width,n.height);var o=i&&i.getBoundingClientRect();this.videothumbnail&&r.update(this.videothumbnail,e,o.width,o.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("mobile"!==Kr.device){var t=this.player,i=this.config,n=t.getPlugin("thumbnail");if(n&&n.setConfig(e),n&&n.usable&&i.isShowThumbnail){Ur.removeClass(this.root,"short-line no-thumbnail"),"short"===i.mode&&Ur.addClass(this.root,"short-line"),this._hasThumnail=!0;var r=this.find(".xg-spot-thumbnail");this.thumbnail=n.createThumbnail(r,"progress-thumbnail"),i.isShowCoverPreview&&(this.videoPreview=Ur.createDom("xg-video-preview","",{},"xgvideo-preview"),t.root.appendChild(this.videoPreview),this.videothumbnail=n.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}else Ur.addClass(this.root,"short-line no-thumbnail")}}},{key:"calcuPosition",value:function(e,t){var i=this.player.plugins.progress,n=this.player,r=i.root.getBoundingClientRect().width,o=n.duration/r*6;return e+t>n.duration&&(t=n.duration-e),n.duration,n.duration,{left:e/n.duration*100,width:t/n.duration*100,isMini:t<o}}},{key:"showDot",value:function(e){var t=this.findDot(e);if(t){var i=this.root.getBoundingClientRect().width,n=t.time/this.player.duration*i;this.updatePosition(n,i,t.time)}}},{key:"focusDot",value:function(e,t){e&&(t||(t=e.getAttribute("data-id")),Ur.addClass(e,"active"),this._activeDotId=t)}},{key:"blurDot",value:function(e){if(!e){var t=this._activeDotId;e=this.getDotDom(t)}e&&(Ur.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";Ur.addClass(this.root,"no-timepoint"),e&&(Ur.addClass(this.find(".xg-spot-content"),"show-text"),t&&"production"===this.config.mode?(Ur.addClass(this.root,"product"),this.tipText.textContent=e):(Ur.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(i," ").concat(e)))}},{key:"hideTips",value:function(){Ur.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",Ur.removeClass(this.find(".xg-spot-content"),"show-text"),Ur.removeClass(this.root,"product")}},{key:"hide",value:function(){Ur.addClass(this.root,"hide")}},{key:"show",value:function(e){Ur.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,t=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(t.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,t=this.player.plugins.progress;t&&Object.keys(yN).map((function(i){t.removeCallBack(i,e[yN[i]])})),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"===Kr.device||"mobile"===this.playerConfig.isMobileSimulateMode?"":'<div class="xg-spot-info hide '.concat("short"===this.config.mode?"short-line":"",'">\n <div class="xg-spot-content">\n <div class="xg-spot-thumbnail">\n <span class="xg-spot-time"></span>\n </div>\n <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n </div>\n <div class="xgplayer-progress-point">00:00</div>\n <div class="xg-spot-ext-text"></div>\n <div class="xg-spot-line"></div>\n </div>')}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),i}(bs),mN=function(e){_r(i,e);var t=kr(i);function i(e){var n;return gr(this,i),(n=t.call(this,e)).ratio=1,n.interval=null,n._preloadMark={},n}return vr(i,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([ro],(function(){var t=e.config,i=t.pic_num,n=t.interval;e.usable&&(e.interval=n>0?n:Math.round(1e3*e.player.duration/i)/1e3)}))}},{key:"setConfig",value:function(e){var t=this;if(e){var i=Object.keys(e);i.length<1||(i.forEach((function(i){t.config[i]=e[i]})),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,t=e.urls,i=e.pic_num;return t&&t.length>0&&i>0}},{key:"initThumbnail",value:function(){var e=this.config,t=e.width,i=e.height,n=e.pic_num,r=e.interval;this.ratio=t/i*100,this.interval=r||Math.round(this.player.duration/n),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var t=this;if(!this._preloadMark[e]){var i=this.config.urls,n=i.length,r=[];e>0&&r.push(e-1),r.push(e),e>0&&e<n-1&&r.push(e+1),r.map((function(e){!t._preloadMark[e]&&e>=0&&e<n&&(t._preloadMark[e]=1,Ur.preloadImg(i[e],(function(){t._preloadMark[e]=2})))}))}}},{key:"getPosition",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.config,r=n.pic_num,o=n.row,s=n.col,a=n.width,l=n.height;this.interval=Math.round(this.player.duration/r);var u=Math.ceil(e/this.interval),c=(u=u>r?r:u)<o*s?0:Math.ceil(u/(o*s))-1,h=u-c*(s*o),d=h>0?Math.ceil(h/s)-1:0,p=h>0?h-d*s-1:0,f=0,g=0;t&&i?t/i<a/l?f=(g=i)*(a/l):g=(f=t)/(a/l):i?t||(f=(g=i||l)*(a/l)):g=(f=t||a)/(a/l);var y=this.getUrlByIndex(c);return{urlIndex:c,rowIndex:d,colIndex:p,url:y,height:g,width:f,style:{backgroundImage:"url(".concat(y,")"),backgroundSize:"".concat(f*s,"px auto"),backgroundPosition:"-".concat(p*f,"px -").concat(d*g,"px"),width:"".concat(f,"px"),height:"".concat(g,"px")}}}},{key:"update",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=this.config,s=o.pic_num,a=o.urls;if(!(s<=0)&&a&&0!==a.length){var l=this.getPosition(t,i,n);this.preload(l.urlIndex),Object.keys(l.style).map((function(t){e.style[t]=l.style[t]})),Object.keys(r).map((function(t){e.style[t]=r[t]}))}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,t){var i=Ur.createDom("xg-thumbnail","",{},"thumbnail ".concat(t));return e&&e.appendChild(i),i}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),i}(bs);function _N(e){return e?"background:".concat(e,";"):""}var EN=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onTimeupdate",(function(){var t=e.player.ended,i=Sr(e).offsetDuration,n=e.currentTime;n=Ur.adjustTimeByDuration(n,i,t),e.update({played:n},i)})),e}return vr(i,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(to,this.onTimeupdate),this.on(co,(function(){e.reset()})))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;t&&this.root&&(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/t*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/t*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,t=e.commonStyle;if(e.miniprogress){var i=this.config,n=i.mode,r=i.height,o={cached:_N(t.cachedColor),played:_N(t.playedColor),progress:_N(t.progressColor),height:r>0&&2!==r?"height: ".concat(r,"px;"):""};return'<xg-mini-progress class="xg-mini-progress '.concat("show"===n?"xg-mini-progress-show":"",'" style="').concat(o.progress," ").concat(o.height,'">\n <xg-mini-progress-cache class="xg-mini-progress-cache" style="').concat(o.cached,'"></xg-mini-progress-cache>\n <xg-mini-progress-played class="xg-mini-progress-played" style="').concat(o.played,'"></xg-mini-progress-played>\n </xg-mini-progress>')}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),i}(bs),TN="realtime",SN="firstframe",bN="poster";var kN=null,CN=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onLoadedData",(function(t){e.player&&(e._frameCount=e.config.startFrameCount,e.stop(),e.renderOnTimeupdate(t),e.off(to,e.renderOnTimeupdate),e.on(to,e.renderOnTimeupdate))})),mr(Sr(e),"onVisibilitychange",(function(t){"visible"===document.visibilityState?e._checkIfCanStart()&&e.start():"hidden"===document.visibilityState&&e.stop()})),mr(Sr(e),"renderOnTimeupdate",(function(t){if(e._frameCount>0)e.renderOnce(),e._frameCount--;else{e._isLoaded=!0,e.off(to,e.renderOnTimeupdate);var i=e.config.startInterval;!e.player.paused&&e._checkIfCanStart()&&e.start(0,i)}})),mr(Sr(e),"start",(function(t,i){var n=e.player.video,r=function(){try{return parseInt(window.performance.now(),10)}catch(e){return(new Date).getTime()}}(),o=e.checkVideoIsSupport(n);o&&e.canvasCtx&&(i||(i=e.interval),e.stop(),n.videoWidth&&n.videoHeight&&(e.videoPI=n.videoHeight>0?parseInt(n.videoWidth/n.videoHeight*100,10):0,(e.config.mode===TN||r-e.preTime>=i)&&(n&&n.videoWidth&&e.update(o,e.videoPI),e.preTime=r)),e.frameId="timer"===e._loopType?Ur.setTimeout(Sr(e),e.start,i):Ur.requestAnimationFrame(e.start))})),mr(Sr(e),"stop",(function(){e.frameId&&("timer"===e._loopType?Ur.clearTimeout(Sr(e),e.frameId):Ur.cancelAnimationFrame(e.frameId),e.frameId=null)})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this;!0===this.playerConfig.dynamicBg&&(this.config.disable=!1),i.isSupport||(this.config.disable=!0);var t=this.config,n=t.disable,r=t.mode,o=t.frameRate;n||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=parseInt(1e3/o,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==TN&&this.interval>=1e3?"timer":"animation",this.once(mo,(function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())})),r!==bN&&(r!==SN&&(this.on(co,(function(){e.stop()})),this.on($r,(function(){var t=e.config.startInterval;e._checkIfCanStart()&&e.start(0,t)})),this.on(Qr,(function(){e.stop()}))),this.on(so,this.onLoadedData),this.on(uo,(function(){e._isLoaded=!1,e.stop()})),document.addEventListener("visibilitychange",this.onVisibilitychange)))}},{key:"setConfig",value:function(e){var t=this;Object.keys(e).forEach((function(i){"root"===i&&e[i]!==t.config[i]?t.reRender(e[i]):"frameRate"===i?t.interval=parseInt(1e3/e[i],10):"disable"===i&&e[i]&&t.stop(),t.config[i]=e[i]}))}},{key:"init",value:function(e){var t=this.player,n=this.config;this.canvasFilter=i.supportCanvasFilter();try{var r=e||n.root;r||(r=n.isInnerRender&&t.innerContainer||t.root),r.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,'"><canvas>\n </canvas><xgmask></xgmask></div>')),this.root=r.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(o){Nr.logError("plugin:DynamicBg",o)}}},{key:"reRender",value:function(e){if(this.config.disable||this.root){this.stop();var t=this.root?this.root.parentElement:null;if(t!==e&&t.removeChild(this.root),e){this.init(e),this.renderOnce();var i=this.config.startInterval;this._checkIfCanStart()&&this.start(0,i)}else this.root=null}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var t=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(t&&("safari"!==Kr.browser||!Ur.isMSE(t)))return t;var i=t?t.tagName.toLowerCase():"";return"canvas"===i||"img"===i?t:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var t="String"===Ur.typeOf(e)?e:"String"===Ur.typeOf(e.poster)?e.poster:null;this.updateImg(t)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==SN&&e!==bN}},{key:"renderOnce",value:function(){var e=this.player.video;if(e.videoWidth&&e.videoHeight){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var t=this.checkVideoIsSupport(e);t&&this.update(t,this.videoPI)}}},{key:"updateImg",value:function(e){var t=this;if(e){var i=this.canvas.getBoundingClientRect(),n=i.width,r=i.height,o=new window.Image;o.onload=function(){if(t.canvas&&!t.frameId&&!t.isStart){t.canvas.height=r,t.canvas.width=n;var e=parseInt(n/r*100,10);t.update(o,e),o=null}},o.src=e}}},{key:"update",value:function(e,t){if(this.canvas&&this.canvasCtx&&t)try{var i=this._pos,n=this.config,r=this.canvas.getBoundingClientRect(),o=r.width,s=r.height;if(o!==i.width||s!==i.height||i.pi!==t){var a=parseInt(o/s*100,10);i.pi=t,i.width!==o&&(i.width=this.canvas.width=o),i.height!==s&&(i.height=this.canvas.height=s);var l=s,u=o;a<t?u=parseInt(s*t/100,10):a>t&&(l=parseInt(100*o/t,10)),i.rwidth=u*n.multiple,i.rheight=l*n.multiple,i.x=(o-i.rwidth)/2,i.y=(s-i.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=n.filter),this.canvasCtx.drawImage(e,i.x,i.y,i.rwidth,i.rheight)}catch(c){Nr.logError("plugin:DynamicBg",c)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return"boolean"==typeof kN?kN:kN=function(){try{return!!document.createElement("canvas").getContext}catch(e){return!1}}()}},{key:"supportCanvasFilter",value:function(){return!("safari"===Kr.browser||"firefox"===Kr.browser)}}]),i}(bs),IN="info",AN=Ko,PN=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"_recordUserActions",(function(t){var i=e._getTime(),n=Object.assign({},t,{msg:t.msg||t.action});e._stats[IN].push(pr(pr({type:"userAction"},i),{},{payload:n}))})),mr(Sr(e),"_onReset",(function(){e.reset()})),mr(Sr(e),"_recordInfo",(function(t){e.info(t)})),mr(Sr(e),"_downloadStats",(function(){var t=e.getStats(),i=new Blob([JSON.stringify(t)],{type:"application/json"}),n=window.URL.createObjectURL(i),r=document.createElement("a");r.style.display="none",r.href=n,r.download="player.txt",r.disabled=!1,r.click()})),e}return vr(i,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:(new Date).toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(Bo,this._recordUserActions),this.on(AN.STATS_INFO,this._recordInfo),this.on(AN.STATS_DOWNLOAD,this._downloadStats),this.on(AN.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var t=this._getTime();this._stats[IN].push(pr(pr({},t),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var t=pr({cat:"function",dur:Date.now()-e.startMs,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(t)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(mr(e={},IN,[]),mr(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player.media,t=[],i=0;i<e.buffered.length;i++)t.push({start:e.buffered.start(i),end:e.buffered.end(i)});var n={currentTime:e.currentTime,readyState:e.readyState,buffered:t,paused:e.paused,ended:e.ended};return this._stats.media=n,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){return this._stats[IN].map((function(e){var t=e.payload.data,i="";try{t instanceof Error?i=t.msg:void 0!==t&&(i=JSON.stringify(t))}catch(oF){console.log("err",oF)}return"[".concat(e.timeFormat,"] : ").concat(e.payload.msg," ").concat(i," ")}))}},{key:"_getProfile",value:function(){var e={traceEvents:[]};return this._stats[IN].forEach((function(t){t.payload.profile&&e.traceEvents.push(t.payload)})),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),i}(cs),wN=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onGapJump",(function(){var t=Sr(e),n=t.player,r=t.config;if(n.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(n.media.seeking){if(!e.seekingEventReceived)return}else e.seekingEventReceived=!1;if(!n.media.paused||0===n.media.currentTime||!e.hasPlayed){var o=n.media.buffered,s=r.smallGapLimit||.5,a=r.gapDetectionThreshold||.3,l=n.media.currentTime,u=e._getIndex(o,l,a);if(null!==u&&0!==u){console.log("GapJump bufferRange ",o.start(u),o.end(u));var c=o.start(u)+.1;if(!(c>n.media.duration)){var h=c-l,d=h<=s;h<i.BROWSER_GAP_TOLERANCE||d&&(!1!==r.useGapJump&&(n.media.currentTime=e.isSafari?c+.1:c),e.player&&e.player.emit("detectGap"),console.log("gapJump gapIndex",u," isGapSamll:",d," currentTime:",n.media.currentTime," jumpSize:",l-n.media.currentTime),.08!==c&&n&&n.emit("log",{type:"oneevent",end_type:"gap",vid:n.config.vid,ext:{video_postion:Math.floor(1e3*c)}}))}}}}})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this;!1!==this.config.useGapJump&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(io,this.onGapJump),this.on($r,(function(){e.hasPlayed=!0})),this.on(Jr,(function(){e.seekingEventReceived=!0})))}},{key:"_getIndex",value:function(e,t,i){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var n=this._getBuffered(e),r=null,o=0;o<n.length;o++){if(n[o].start>t&&(0===o||n[o-1].end-t<=i)){r=o;break}}return r}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),i}(bs);wN.BROWSER_GAP_TOLERANCE=.001;var DN=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"onWaiting",(function(){var t=Sr(e).config;e.jumpCnt>t.jumpCntMax||e.timer||!1===t.useWaitingTimeoutJump||(e.timer=setTimeout(e.onJump,1e3*t.waitingTime))})),mr(Sr(e),"onJump",(function(){var t=Sr(e),i=t.player,n=t.config;if(clearTimeout(e.timer),e.timer=null,!(e.jumpCnt>n.jumpCntMax||!1===n.useWaitingTimeoutJump||i.media.paused&&0!==i.media.currentTime&&e.hasPlayed)){e.jumpSize=n.jumpSize*(e.jumpCnt+1),e.jumpCnt===n.jumpSize&&e.jumpSize<6&&(e.jumpSize=6);var r=i.currentTime+e.jumpSize;r>i.media.duration||(e.jumpCnt++,i.currentTime=r)}})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this,t=this.config,i=t.useWaitingTimeoutJump,n=t.jumpSize;!1!==i&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=n,this.on(io,this.onWaiting),this.on([Xr,no],(function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize})),this.on($r,(function(){e.hasPlayed=!0})))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),i}(bs),LN="cdn",RN=["cdn"],xN=function(e){_r(i,e);var t=kr(i);function i(){var e;gr(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return mr(Sr(e=t.call.apply(t,[this].concat(r))),"getSpeed",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:LN;if(!e.speedListCache||!e.speedListCache[t])return 0;if(e.speedListCache[t].length<=0)return 0;var i=0;return e.speedListCache[t].map((function(e){i+=e})),Math.floor(i/e.speedListCache[t].length)})),mr(Sr(e),"startTimer",(function(){Ur.isMSE(e.player.video)||(e.initSpeedList(),e.cnt=0,e.timer=setTimeout(e.testSpeed,e.config.testTimeStep))})),mr(Sr(e),"initSpeedList",(function(){e.speedListCache={},RN.forEach((function(t){e.speedListCache[t]=[]}))})),mr(Sr(e),"_onRealSpeedChange",(function(t){t.speed&&e.appendList(t.speed,t.type||LN)})),mr(Sr(e),"testSpeed",(function(){if(clearTimeout(e.timer),e.timer=null,e.player&&e.config.openSpeed){var t=e.config,i=t.url,n=t.loadSize,r=t.testCnt,o=t.testTimeStep,s=i+(i.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(e.cnt>=r)){e.cnt++;try{var a=(new Date).getTime(),l=null,u=new XMLHttpRequest;e.xhr=u,u.open("GET",s);var c={},h=Math.floor(10*Math.random());c.Range="bytes="+h+"-"+(n+h),c&&Object.keys(c).forEach((function(e){u.setRequestHeader(e,c[e])})),u.onreadystatechange=function(){if(4===u.readyState){e.xhr=null,l=(new Date).getTime();var t=u.getResponseHeader("Content-Length")/1024*8,i=Math.round(1e3*t/(l-a));e.appendList(i),e.timer=setTimeout(e.testSpeed,o)}},u.send()}catch(d){console.error(d)}}}})),mr(Sr(e),"appendList",(function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:LN;if(e.speedListCache&&e.speedListCache[i]){var n=e.config.saveSpeedMax;e.speedListCache[i].length>=n&&e.speedListCache[i].shift(),e.speedListCache[i].push(t);var r=Sr(e).player;r&&(i===LN?r.realTimeSpeed=t:r[e.getSpeedName("realTime",i)]=t),e.updateSpeed(i)}})),mr(Sr(e),"updateSpeed",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:LN,i=e.getSpeed(t),n=Sr(e).player;if(n)if(t===LN)n.avgSpeed&&i===n.avgSpeed||(n.avgSpeed=i,n.emit(So,{speed:i,realTimeSpeed:n.realTimeSpeed}));else{var r=e.getSpeedName("avg",t);n[r]&&i===n[r]||(n[r]=i,n.emit(So,{speed:i,realTimeSpeed:n.realTimeSpeed}))}})),e}return vr(i,[{key:"afterCreate",value:function(){var e=this.config,t=e.openSpeed,i=e.addSpeedTypeList;(null==i?void 0:i.length)>0&&RN.push.apply(RN,Ir(i)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,t&&this.on([so,_o],this.startTimer)}},{key:"getSpeedName",value:function(e,t){return e+"Speed"+t.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer)return clearTimeout(this.timer),void(this.timer=null);if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([so,_o],this.startTimer),RN.forEach((function(t){e.speedListCache&&e.speedListCache[t]&&(e.speedListCache[t]=[])})),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&4!==this.xhr.readyState&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:204800,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),i}(bs),ON=function(e){_r(i,e);var t=kr(i);function i(){return gr(this,i),t.apply(this,arguments)}return vr(i,[{key:"afterCreate",value:function(){var e=this,t=this.player,i=this.config,n=t.media||t.video;(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],i.disabled)||n.getVideoPlaybackQuality&&(this.on($r,(function(){e._startTick()})),this.on(Qr,(function(){e._stopTick()})),this.on(qr,(function(){e._stopTick()})),this.on(co,(function(){e._stopTick()})))}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout((function(){e._checkDecodeFPS(),e._startTick()}),this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkBuffer",value:function(e,t){for(var i=!1,n=[],r=0;r<t.length;r++){var o=t.start(r),s=t.end(r);if(n.push({start:o,end:s}),o<=e&&e<=s-1){i=!0;break}}return{enoughBuffer:i,buffers:n}}},{key:"_checkStuck",value:function(e,t,i,n){var r=this.player.media||this.player.video,o=document.hidden,s=r.paused,a=r.readyState,l=r.currentTime,u=r.buffered;if(!(o||s||a<4)){var c=this._checkBuffer(l,u),h=c.enoughBuffer,d=c.buffers;h&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:l,buffers:d,curDecodedFrames:e,totalVideoFrames:t,droppedVideoFrames:i,checkInterval:n}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(Go,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var t=e.getVideoPlaybackQuality(),i=t.totalVideoFrames,n=t.droppedVideoFrames,r=performance.now();if(i&&this._lastCheckPoint){var o=i-this._lastDecodedFrames,s=r-this._lastCheckPoint;this._checkStuck(o,i,n,s)}this._lastDecodedFrames=i,this._lastCheckPoint=r}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),i}(bs);const NN=class extends bs{static get pluginName(){return"poster"}static get defaultConfig(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}set isEndedShow(e){this.config.isEndedShow=e}get isEndedShow(){return this.config.isEndedShow}hide(){Ur.addClass(this.root,"hide")}show(){return Ur.removeClass(this.root,"hide"),""}beforeCreate(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}afterCreate(){this.on(qr,(()=>{this.isEndedShow&&Ur.removeClass(this.root,"hide")})),this.config.hideCanplay?(this.once(to,(()=>{this.onTimeUpdate()})),this.on(To,(()=>{Ur.removeClass(this.root,"hide"),Ur.addClass(this.root,"xg-showplay"),this.once(to,(()=>{this.onTimeUpdate()}))}))):this.on($r,(()=>{Ur.addClass(this.root,"hide")}))}onTimeUpdate(){this.player.currentTime?Ur.removeClass(this.root,"xg-showplay"):this.once(to,(()=>{this.onTimeUpdate()}))}update(e){e&&(this.config.poster=e,this.root.style.backgroundImage=`url(${e})`)}setConfig(e){"string"==typeof e?this.config.poster=e:"object"==typeof e&&Object.keys(this.config).forEach((t=>{Object.keys(e).includes(t)&&(this.config[t]=e[t])})),this.update(this.config.poster)}getBgSize(e){let t="";switch(e){case"cover":t="cover";break;case"contain":t="contain";break;case"fixHeight":t="auto 100%";break;case"fixWidth":t="100% auto";break;default:t=""}return t?`background-size: ${t};`:""}render(){const{poster:e,hideCanplay:t,fillMode:i,notHidden:n}=this.config,r=this.getBgSize(i);return`<xg-poster class="xgplayer-poster ${n?"xg-not-hidden":t?"xg-showplay":""} ${e?"active":""}" style="${e?`background-image:url(${e});${r}`:r}">\n </xg-poster>`}};Os.use({LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}});class MN{constructor(e,t){const i=t&&"mobile"===t.isMobileSimulateMode,{isLive:n}=t,r=[...n?[]:[FO,LO,EN,vN,HO],xO,BO,YO,eN,sN,aN,rN,oN,GO,ZO],o=[Bx,NN,Kx,AO,Gx,hN,dN,mN,nO];this.plugins=[PN,Mx,...r,...o,wN,DN];const s=i?"mobile":Kr.device;switch(s){case"pc":this.plugins.push(CO,sO,cN,xN,ON);break;case"mobile":this.plugins.push(bO);break;default:this.plugins.push(CO,sO,cN)}(Kr.os.isIpad||"pc"===s)&&this.plugins.push(CN),this.ignores=[],this.i18n=[]}}function UN(e,t){return d(this,arguments,(function*({isLive:e=!1,streamType:t,isMobile:i=!1,getSoftOptionTask:n,playerData:r},o){const s=[MN,BN()],{openSoftDecoding:a,isMusic:l}=r,u=[],c=[];if(i?s.push(function({isLive:e,playerData:t}){const i=["error","playbackRate"],n=t.configs,r=Wa(n,"EncryptHlsPlugin");(null==r?void 0:r.playAuthToken)||i.push("definition");const o=[CL];return class{constructor(){this.plugins=o,this.ignores=[...i]}}}({isLive:e,playerData:o.playerData})):s.push(function({isLive:e,playerData:t}){const i=["cssfullscreen"],n=[dL],r=t.configs,o=Wa(r,"EncryptHlsPlugin");(null==o?void 0:o.playAuthToken)||(i.push("definition"),n.push(rL));return class{constructor(){this.plugins=n,this.ignores=[...i]}}}({isLive:e,playerData:o.playerData})),"flv"===t)c.push((()=>d(this,null,(function*(){if(i){if(Xa()||qa()||a){const e=yield o.sdkUmdLoader.loadPlugins(Hw.FLV);u.push(e)}}else{const e=yield o.sdkUmdLoader.loadPlugins(Hw.FLV);u.push(e)}})))());Wa(o.playerData.options,"Subtitle")&&o.playerData.plugins.every((e=>"subtitle"!==e.pluginName.toLowerCase()))&&u.push(Ix);const[h,p]=yield Promise.all([n(),HN({playerData:o.playerData},o),...c]);return{presets:s,softDecodingOption:h,plugins:[...u,...p].filter(Boolean)}}))}function BN(e){const t=[YL,Ax,SL];return class{constructor(){this.plugins=t,this.ignores=["error"]}}}function HN(e,t){return d(this,arguments,(function*({playerData:e},t){var i,n,r;const o=[];e.options,e.drmType,or.DRM_ENCRYPT;const s=(yield null==(r=null==(n=null==(i=t.playerData)?void 0:i.adapter)?void 0:n.getPlugins)?void 0:r.call(n,t.sdkUmdLoader))||[];return o.push(...s),Boolean(Dw()||Ma())&&o.push(Nw),e.enableMenu&&o.push(bL),o}))}function FN(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"/>\n',"image/svg+xml").firstChild}function jN(){return(new DOMParser).parseFromString('<svg width="72" height="72" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><g fill="#FFF" fill-rule="evenodd"><circle fill-opacity=".3" cx="36" cy="36" r="36"/><path d="M40.167 32.667a.833.833 0 01-.834-.834v-1.666c0-.46.373-.834.834-.834h5.409a11.653 11.653 0 00-9.576-5c-6.443 0-11.667 5.224-11.667 11.667S29.557 47.667 36 47.667c5.285 0 9.749-3.514 11.183-8.333h3.445C49.112 46.014 43.138 51 36 51c-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15 4.713 0 8.918 2.173 11.668 5.572l-.001-4.739c0-.46.373-.833.833-.833h1.667c.46 0 .833.373.833.833V31c0 .879-.68 1.598-1.542 1.662l-.125.005h-9.166z"/></g></svg>',"image/svg+xml").firstChild}function VN(){return(new DOMParser).parseFromString('<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#000" fill-opacity=".4"/><path d="M40.243 28.3a2 2 0 010 3.401L24.06 41.712c-1.332.825-3.052-.134-3.052-1.7V19.988c0-1.566 1.72-2.525 3.052-1.7l16.184 10.01z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function KN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.867 2.5h.55c.44 0 .799.34.83.771l.003.062v13.334c0 .44-.34.799-.771.83l-.062.003h-.55a.833.833 0 01-.444-.128l-.064-.045-4.867-3.744a.831.831 0 01-.322-.59l-.003-.07V7.077c0-.235.099-.458.271-.615l.054-.045L9.36 2.673a.832.832 0 01.43-.17l.078-.003h.55-.55zm6.767 2.278A7.474 7.474 0 0118.75 10a7.477 7.477 0 01-2.128 5.234.4.4 0 01-.57-.004l-.587-.586a.442.442 0 01.005-.617A5.812 5.812 0 0017.083 10c0-1.557-.61-2.97-1.603-4.017a.442.442 0 01-.003-.615l.586-.586a.4.4 0 01.57-.004zM2.5 6.667c.23 0 .417.186.417.416v5.834c0 .23-.187.416-.417.416h-.833a.417.417 0 01-.417-.416V7.083c0-.23.187-.416.417-.416H2.5zm11.768.46A4.153 4.153 0 0115.417 10c0 1.12-.442 2.137-1.162 2.886a.388.388 0 01-.555-.007l-.577-.578c-.176-.176-.156-.467.009-.655A2.49 2.49 0 0013.75 10a2.49 2.49 0 00-.61-1.636c-.163-.188-.182-.477-.006-.653l.578-.578a.388.388 0 01.556-.006z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function GN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.045 2.5h.55c.44 0 .8.34.831.771l.003.062v13.334c0 .44-.34.799-.771.83l-.063.003h-.55a.833.833 0 01-.443-.128l-.065-.045-4.866-3.744a.831.831 0 01-.323-.59l-.003-.07V7.077c0-.235.1-.458.272-.615l.054-.045 4.866-3.744a.832.832 0 01.43-.17l.078-.003h.55-.55zM2.68 6.667c.23 0 .416.186.416.416v5.834c0 .23-.186.416-.416.416h-.834a.417.417 0 01-.416-.416V7.083c0-.23.186-.416.416-.416h.834zm10.467.294a.417.417 0 01.59 0l1.767 1.768L17.27 6.96a.417.417 0 01.589 0l.59.59a.417.417 0 010 .589L16.68 9.908l1.768 1.767c.15.15.162.387.035.55l-.035.04-.589.589a.417.417 0 01-.59 0l-1.767-1.768-1.768 1.768a.417.417 0 01-.59 0l-.588-.59a.417.417 0 010-.589l1.767-1.768-1.767-1.767a.417.417 0 01-.035-.55l.035-.04.589-.589z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function WN(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.867 2.5h.55c.44 0 .799.34.83.771l.003.062v13.334c0 .44-.34.799-.771.83l-.062.003h-.55a.833.833 0 01-.444-.128l-.064-.045-4.867-3.744a.831.831 0 01-.322-.59l-.003-.07V7.077c0-.235.099-.458.271-.615l.054-.045L9.36 2.673a.832.832 0 01.43-.17l.078-.003h.55-.55zM2.5 6.667c.23 0 .417.186.417.416v5.834c0 .23-.187.416-.417.416h-.833a.417.417 0 01-.417-.416V7.083c0-.23.187-.416.417-.416H2.5zm11.768.46A4.153 4.153 0 0115.417 10c0 1.12-.442 2.137-1.162 2.886a.388.388 0 01-.555-.007l-.577-.578c-.176-.176-.156-.467.009-.655A2.49 2.49 0 0013.75 10a2.49 2.49 0 00-.61-1.636c-.163-.188-.182-.477-.006-.653l.578-.578a.388.388 0 01.556-.006z" fill="#fff"/></svg>',"image/svg+xml").firstChild}const YN=c(u({startPlay:VN,play:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.121 8.299a2 2 0 010 3.402l-7.94 4.91c-1.332.825-3.051-.133-3.051-1.7V5.09c0-1.567 1.72-2.525 3.052-1.701l7.939 4.911z" fill="#fff"/></svg>',"image/svg+xml").firstChild},pause:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="5.313" y="3.75" width="3.125" height="12.5" rx=".625" fill="#fff"/><rect x="11.563" y="3.75" width="3.125" height="12.5" rx=".625" fill="#fff"/></svg>',"image/svg+xml").firstChild},fullscreen:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.778 2h4.444v1.778H3.778v4.444H2V3.778C2 2.796 2.796 2 3.778 2zM2 11.778v4.444C2 17.204 2.796 18 3.778 18h4.444v-1.778H4.823l2.313-2.313a.9.9 0 00-1.272-1.273l-2.086 2.086v-2.944H2zm14.222 0v4.444h-4.444V18h4.444c.982 0 1.778-.796 1.778-1.778v-4.444h-1.778zM18 8.222V3.778C18 2.796 17.204 2 16.222 2h-4.444v1.778h2.945l-2.587 2.586a.9.9 0 101.273 1.273l2.813-2.813v3.398H18z" fill="#fff"/></svg>',"image/svg+xml").firstChild},exitFullscreen:function(){return(new DOMParser).parseFromString('<svg width="21" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.892 2h4.445v1.778H3.892v4.444H2.114V3.778C2.114 2.796 2.91 2 3.892 2zm4.445 16v-4.444c0-.982-.796-1.778-1.778-1.778H2.114v1.778h2.944L2.264 16.35a.9.9 0 001.272 1.273l2.988-2.987a.918.918 0 00.035-.037V18h1.778zm8-6.222v4.444h-4.445V18h4.445c.981 0 1.777-.796 1.777-1.778v-4.444h-1.777zM11.892 2v4.445c0 .981.796 1.777 1.778 1.777h4.444V6.445H15.17l2.568-2.568a.9.9 0 10-1.273-1.273L13.67 5.4V2h-1.778z" fill="#fff"/></svg>',"image/svg+xml").firstChild},playNext:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.03 8.312a2 2 0 010 3.376l-7.642 4.858c-1.332.847-3.073-.11-3.073-1.687V5.14c0-1.577 1.741-2.534 3.073-1.687l7.642 4.858z" fill="#fff"/><path d="M13 3.5a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v13a.5.5 0 01-.5.5h-1a.5.5 0 01-.5-.5v-13z" fill="#fff"/></svg>',"image/svg+xml").firstChild},replay:jN,refresh:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 2.488a7.48 7.48 0 00-4.154 1.253.908.908 0 101.005 1.512 5.695 5.695 0 018.844 4.746h-.908a.33.33 0 00-.264.528l1.816 2.422a.33.33 0 00.529 0l1.815-2.422A.33.33 0 0018.42 10h-.908A7.511 7.511 0 0010 2.49zM2.489 10a7.511 7.511 0 0011.665 6.26.908.908 0 00-1.005-1.513A5.695 5.695 0 014.305 10h.908a.33.33 0 00.264-.528L3.66 7.05a.33.33 0 00-.528 0L1.317 9.47a.33.33 0 00.264.53h.908z" fill="#fff"/></svg>',"image/svg+xml").firstChild}},{}),{volumeLarge:KN,volumeMuted:GN,volumeSmall:WN}),zN={whitelist:[""],widescreen:!0,width:"100%",height:"100%",lang:Ya(),fitVideoSize:!1,inactive:2e3,playsinline:!0,keyShortcut:"off",closeVideoClick:!0,closeVideoDblclick:!0,closePlayerBlur:!1,closeControlsBlur:!1,closePlayVideoFocus:!0,leavePlayerTime:0,mini:!1,pip:{position:"controlsRight",index:2.5,showIcon:!0},volume:{index:2.6},miniscreen:{left:window.innerWidth-360,top:window.innerHeight-450},time:{index:3},icons:u({},YN),flv:{retryCount:0,preferMMS:!0,preferMMSStreaming:!0},hls:{retryCount:3,allowedStreamTrackChange:!1,preferMMS:!0,preferMMSStreaming:!0},Mp4EncryptPlayer:{retryCount:3},DASHPlugin:{disableBufferBreakCheck:!1},gapJump:{smallGapLimit:1},EncryptHlsPlugin:{preferMMS:!0,preferMMSStreaming:!0}},$N={isLive:!0,closeVideoClick:!0,autoplay:!0,autoplayMuted:!0,preloadTime:8,start:{isShowPause:!1,isShowEnd:!1,mode:"hide",disableAnimate:!0},retry:{count:0}},XN={isLive:!1,closeVideoClick:!1,defaultPlaybackRate:1,closeVideoStopPropagation:!0,autoplay:!1,autoplayMuted:!1,playbackRate:[2,1.5,1.25,{rate:1,iconText:{zh:"倍速",en:"Speed",jp:"Speed"}},.75,.5],start:{isShowPause:!0,isShowEnd:!1,mode:"hide",disableAnimate:!0},progresspreview:{isShowCoverPreview:!0},progress:{isPauseMoving:!0}};const qN=c(u({startPlay:VN,play:function(){return(new DOMParser).parseFromString('<svg style="\n height: 18px;\n width: 18px;\n" width="28" height="28" fill="none" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="M19.77 11.619c1.768 1.094 1.768 3.668 0 4.762L8.653 23.257c-1.865 1.154-4.273-.188-4.273-2.381V7.125c0-2.194 2.408-3.536 4.273-2.382L19.77 11.62z" fill="#fff"/></svg>',"image/svg+xml").firstChild},pause:function(){return(new DOMParser).parseFromString('<svg style="\n height: 18px;\n width: 18px;\n" width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.438" y="5.25" width="4.375" height="17.5" rx=".875" fill="#fff"/><rect x="16.188" y="5.25" width="4.375" height="17.5" rx=".875" fill="#fff"/></svg>',"image/svg+xml").firstChild},fullscreen:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.125 3a.375.375 0 00-.375.375v.75c0 .207.168.375.375.375H15.5v3.375c0 .207.168.375.375.375h.75A.375.375 0 0017 7.875v-4.5A.375.375 0 0016.625 3h-4.5zm0 12.5a.375.375 0 00-.375.375v.75c0 .207.168.375.375.375h4.5a.375.375 0 00.375-.375v-4.5a.375.375 0 00-.375-.375h-.75a.375.375 0 00-.375.375V15.5h-3.375zM3 3.375C3 3.168 3.168 3 3.375 3h4.5c.207 0 .375.168.375.375v.75a.375.375 0 01-.375.375H4.5v3.375a.375.375 0 01-.375.375h-.75A.375.375 0 013 7.875v-4.5zM7.875 15.5H4.5v-3.375a.375.375 0 00-.375-.375h-.75a.375.375 0 00-.375.375v4.5c0 .207.168.375.375.375h4.5a.375.375 0 00.375-.375v-.75a.375.375 0 00-.375-.375z" fill="#fff"/></svg>\n',"image/svg+xml").firstChild},exitFullscreen:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.333h-4.167c-.92 0-1.666-.746-1.666-1.666V2.5h1.666v4.167H17.5v1.666zM2.5 6.667v1.666h4.167c.92 0 1.666-.746 1.666-1.666V2.5H6.667v4.167H2.5zM2.5 13.333h4.167V17.5h1.666v-4.167c0-.92-.746-1.666-1.666-1.666H2.5v1.666zM13.333 17.5v-4.167H17.5v-1.666h-4.167c-.92 0-1.666.746-1.666 1.666V17.5h1.666z" fill="#fff"/></svg>\n',"image/svg+xml").firstChild},playNext:function(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4.77 4.124l8.358 5.07c.38.23.486.704.238 1.056a.807.807 0 01-.238.22L4.77 15.543c-.38.231-.889.132-1.137-.221a.723.723 0 01-.134-.417V4.762c0-.421.368-.762.822-.762.159 0 .316.042.449.124z" stroke="#fff" stroke-width="1.5"/><path d="M15.5 4.5A.5.5 0 0116 4h.5a.5.5 0 01.5.5v11a.5.5 0 01-.5.5H16a.5.5 0 01-.5-.5v-11z" fill="#fff"/></svg>',"image/svg+xml").firstChild},replay:jN,refresh:function(){return(new DOMParser).parseFromString('<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M0 0h18v18H0z"/><path d="M10.875 7.5a.375.375 0 01-.375-.375v-.75c0-.207.168-.375.375-.375h2.434a5.25 5.25 0 10.723 4.5h1.55a6.75 6.75 0 11-1.332-5.743V2.626c0-.207.168-.375.375-.375h.75c.207 0 .375.168.375.375V6.75a.75.75 0 01-.694.748L15 7.5h-4.125z" fill="#FFF"/></g></svg>',"image/svg+xml").firstChild}},{}),{volumeLarge:KN,volumeMuted:GN,volumeSmall:WN}),QN=c(u({width:"100%",height:"100%",lang:Ya(),playsinline:!0,closeVideoClick:!0,closeVideoTouch:!0,whitelist:[""],"x5-video-player-type":"h5-page","x5-video-player-fullscreen":!1,"x5-video-orientation":"landscape|portrait",enterTips:{background:"linear-gradient(90deg,#000,#49e6d3,#49e6d3,#138afc,#000)"},retainPlay:!0,start:{isShowPause:!0,isShowEnd:!0,disableAnimate:!1},fullscreen:{useCssFullscreen:!1},plugins:[],time:{mode:"pc",index:2.5},controls:{mode:"flex"}},{}),{cusPlaybackRatePlugin:{needCheck:!0,needPanel:!1},icons:u({},qN),flv:{innerDegrade:1,retryCount:0,preferMMS:!0,preferMMSStreaming:!0},hls:{innerDegrade:1,retryCount:3,allowedStreamTrackChange:!1,preferMMS:!0,preferMMSStreaming:!0},Mp4EncryptPlayer:{retryCount:3},DASHPlugin:{disableBufferBreakCheck:!1},gapJump:{smallGapLimit:1},EncryptHlsPlugin:{preferMMS:!0,preferMMSStreaming:!0}}),ZN={isLive:!0,closeVideoClick:!0,autoplay:!0,autoplayMuted:!0,start:{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"},retry:{count:0},longwaiting:{duration:3e4},mobile:{gestureY:!1,gestureX:!1,disableActive:!0}},JN={isLive:!1,closeVideoClick:!1,autoplay:!1,autoplayMuted:!1,playbackRate:[2,1.5,1.25,{rate:1,iconText:"倍速",en:"speed",jp:"speed"},.75,.5],defaultPlaybackRate:1,closeVideoStopPropagation:!0,mobile:{gestureY:!1},start:{isShowPause:!0,isShowEnd:!1,disableAnimate:!1,mode:"hide"}};const{POSITIONS:eM}=bs,tM=e=>{const t="mobile"===Kr.device,{pluginName:i=`ExtendPlugin${Math.random().toString().slice(-5)}`,type:n=(t?"inner":"normal"),position:r=eM.CONTROLS_LEFT,icon:o=FN,index:s=1,hideAtFullScreen:a=!0,tips:l={jp:"custom",en:"custom",zh:"自定义","zh-hk":"自定义"}}=e;return class extends bs{static get isExtendPlugin(){return!0}static get type(){return n}static get textTips(){return l}static get pluginName(){return i}static get defaultConfig(){return{position:r,index:s}}afterCreate(){var e;this.appendChild(".xgplayer-icon",this.icons[i]),this.initEvents(),a&&(null==(e=this.player)?void 0:e.fullscreen)&&this.handleFullScreenChange()}registerIcons(){return{[i]:{icon:o,class:"xgplayer-extendicon-svg"}}}updateIcons(e){const t=this.find(".xgplayer-icon");t&&(t.innerHTML=e)}registerLanguageTexts(){return{[i]:l}}initEvents(){var e;this.handleCallback=sD(this.handleCallback.bind(this),200);const t="mobile"===Kr.device?"touchend":"click";this.bind(t,this.handleCallback),this.show(),a&&(null==(e=this.player)||e.on(Io,this.handleFullScreenChange.bind(this)))}handleFullScreenChange(){var e;const t=this.player;null==(e=this.player)||e.changePluginsIcon(i,!(null==t?void 0:t.fullscreen))}handleCallback(e){const{player:t}=this;t&&(e.preventDefault(),e.stopPropagation(),t.emit(FD.PLAYER_EXTEND_BUTTON,i))}destroy(){var e;this.unbind(["touchend","click"],this.handleCallback),a&&(null==(e=this.player)||e.off(Io,this.handleFullScreenChange.bind(this)))}render(){return`\n <xg-icon class="xgplayer-extend-icon">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="${i}">${this.langText[i]}</div>\n </xg-icon>\n `}}};class iM{constructor(e){var t,i,n;const{config:r,root:o,player:s}=e;this.config=r,this.parent=o,this.player=s;let a=null!=(t=null==r?void 0:r.mode)?t:$s.INNER;Object.values($s).includes(a)||(a=$s.INNER),this.mode=a,this.isAutoChange=null!=(i=null==r?void 0:r.isAutoChange)&&i,this.isShow=!1,this.showCancelBtn=null!=(n=null==r?void 0:r.showCancelBtn)&&n,this.initEvents(),this.renderPanel()}initEvents(){var e;this.isAutoChange&&(window.addEventListener("orientationchange",this.handleOrientationChange.bind(this)),null==(e=this.player)||e.on(Io,this.handleOrientationChange.bind(this)))}handleOrientationChange(){var e,t,i;const n=[90,-90,"90","-90"].includes(window.orientation);(null==(e=this.player)?void 0:e.fullscreen)&&n?this.changeMode($s.FULLSCREEN):this.changeMode(null!=(i=null==(t=this.config)?void 0:t.mode)?i:$s.INNER)}changeConfig(e){this.config=e}changeMode(e){this.mode=e,this.player.emit(FD.PANEL_MODE_CHANGE,{mode:e}),this.destroy(),this.renderPanel()}renderPanel(){const e=`xg-mobile-panel panel-${["normal","inner","fullscreen"][this.mode]}`;switch(this.root=Ur.createDom("div","",{},e),this.parent&&(this.parent.appendChild(this.root),this.hide()),this.bind("click",this.handleHide.bind(this)),this.mode){case $s.NORMAL:{const e=Ur.createDom("div","",{},"xg-mobile-panel-content "+(this.showCancelBtn?"xg-mobile-panel-cancel-mode":""));if(this.root.appendChild(e),this.showCancelBtn){const e="zh-cn"===this.player.lang?"zh":this.player.lang,t=Ur.createDom("div",Qs[e],{},"xg-mobile-panel-cancel");this.root.appendChild(t)}this.container=e,e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()}));break}case $s.INNER:this.container=this.root;break;case $s.FULLSCREEN:{const e=Ur.createDom("div","",{},"xg-mobile-panel-content");this.root.appendChild(e),this.container=e,e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()}));break}}}showPanel(e,t="",i=!1){return d(this,null,(function*(){if(i&&Ur.addClass(e,"item-list-panel-content"),this.setTitle(t),this.children)return yield this.hide(),void setTimeout((()=>{this.children=e,this.container&&(this.title&&this.container.appendChild(this.title),this.container.appendChild(e)),this.show()}));this.children=e,this.container&&(this.title&&this.container.appendChild(this.title),this.container.appendChild(e)),this.show()}))}updatePanel(e){this.children&&Ur.hasClass(this.children,"item-list-panel-content")&&Ur.addClass(e,"item-list-panel-content"),this.children=e,this.container&&(this.container.innerHTML="",this.title&&this.container.appendChild(this.title),this.container.appendChild(e))}setTitle(e){e&&this.mode!==$s.INNER?this.title?this.title.innerHTML=e:this.title=this.renderTitle(e):this.title=void 0}renderTitle(e){return Ur.createDom("div",e,{},"xg-mobile-panel-title")}show(){this.isShow=!0,Ur.removeClass(this.root,"hide"),Ur.addClass(this.root,"active")}hide(){this.isShow=!1,Ur.removeClass(this.root,"active"),Ur.addClass(this.root,"hide"),this.container&&(this.container.innerHTML="")}handleHide(e){e.stopPropagation(),e.preventDefault(),this.hide()}bind(e,t,i=!1){this.root&&`on${e}`in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,i)}destroy(){var e;this.parent&&this.root&&this.parent.contains(this.root)&&(this.parent.removeChild(this.root),this.root=null),window.removeEventListener("orientationchange",this.handleOrientationChange.bind(this)),null==(e=this.player)||e.off(Io,this.handleOrientationChange.bind(this))}}function nM(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M16 3.8001H4C3.55817 3.8001 3.2 4.15827 3.2 4.6001V12.6001C3.2 13.0419 3.55817 13.4001 4 13.4001H16C16.4418 13.4001 16.8 13.0419 16.8 12.6001V4.6001C16.8 4.15827 16.4418 3.8001 16 3.8001ZM4 2.6001C2.89543 2.6001 2 3.49553 2 4.6001V12.6001C2 13.7047 2.89543 14.6001 4 14.6001H16C17.1046 14.6001 18 13.7047 18 12.6001V4.6001C18 3.49553 17.1046 2.6001 16 2.6001H4ZM5.0249 6.24509V11.6001H5.9024V9.23009H8.6174V11.6001H9.4949V6.24509H8.6174V8.48009H5.9024V6.24509H5.0249ZM10.5474 6.24509V11.6001H12.5049C13.3749 11.6001 14.0274 11.3601 14.4774 10.8801C14.9049 10.4226 15.1224 9.77009 15.1224 8.92259C15.1224 8.06759 14.9049 7.41509 14.4774 6.96509C14.0274 6.48509 13.3749 6.24509 12.5049 6.24509H10.5474ZM11.4249 6.99509H12.3399C13.0074 6.99509 13.4949 7.14509 13.8024 7.45259C14.1024 7.75259 14.2524 8.24759 14.2524 8.92259C14.2524 9.58259 14.1024 10.0701 13.8024 10.3851C13.4949 10.6926 13.0074 10.8501 12.3399 10.8501H11.4249V6.99509ZM4.15 16.1001C3.79101 16.1001 3.5 16.3911 3.5 16.7501C3.5 17.1091 3.79101 17.4001 4.15 17.4001H15.85C16.209 17.4001 16.5 17.1091 16.5 16.7501C16.5 16.3911 16.209 16.1001 15.85 16.1001H4.15Z" fill="#ffffff"/>\n</svg>',"image/svg+xml").firstChild}const{POSITIONS:rM}=bs;class oM extends(nL(bs)){constructor(e){super(c(u({},e),{clientType:"MOBILE"})),this.handleButtonChange=()=>{const e=this.renderItemList();this.renderPanel(e)}}static get pluginName(){return"DefinitionMobilePlugin"}static get textTips(){return{jp:"明快さ",en:"Definition",zh:"清晰度","zh-hk":"清晰度"}}static get defaultConfig(){return{position:rM.CONTROLS_RIGHT,index:3,showToastOnManualClick:!0,alwaysShowDefinition:!1}}afterCreate(){super.afterCreate()}refreshDefinitionList(){var e;(null==(e=this.player.config)?void 0:e.alwaysShowDefinition)&&(this.config.alwaysShowDefinition=!0);const t=this.getQualityMenuItems();t.length>1||this.config.alwaysShowDefinition?(this.appendChild(".xgplayer-icon",this.icons.definition),this.initEvents(),this.renderItemList(t),this.show()):(this.qualityRenderList=[],this.hide())}registerIcons(){return{definition:{icon:nM,class:"xgplayer-definition-svg"}}}registerLanguageTexts(){return{definition:{jp:"明快さ",en:"Definition",zh:"清晰度","zh-hk":"清晰度"},definitionSelect:{jp:"クラリティセレクション",en:"Definition Choose",zh:"清晰度选择","zh-hk":"清晰度選擇"},switching:{jp:"に切り替える",en:"Switching to",zh:"正在切换至","zh-hk":"正在切換至"}}}afterPlayerInit(){}initEvents(){this.unbind(["click"],this.handleButtonChange),this.bind(["click"],this.handleButtonChange)}renderItemList(e=this.getQualityMenuItems()){const{list:t}=this.getCurrentDefinitionInfo(this.player),i=Ur.createDom("div","",{},"definition-panel-content");return this.qualityRenderList=e,this.renderList=t,e.forEach((e=>{const t=this.renderItem(e);i.appendChild(t)})),i}renderItem(e){var t,i;const n=Ur.createDom("div","",{},`panel-Item ${e.selected?"select-in":""} ${e.pending?"pending":""}`);let r=e.label;if("abr-auto"===e.source&&(null==(t=this.qualityRenderList)?void 0:t.some((e=>"definition"===e.source)))&&this.showRealDefinition(c(u({},e),{definition:"auto"}))){const e=null==(i=this.renderList)?void 0:i.find((e=>this.playerData.isDefinitionMatch(null==e?void 0:e.definition,this._autoRealDefinition))),t=this.getShowText(this.i18n,e,null==e?void 0:e.definition);r=t?`${r}(${t})`:r}return n.textContent=r,n.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault(),e.selected||(this.emitUserAction(t,"change_definition",{source:e.source,id:e.id,label:e.label}),this.selectQualityMenuItem(e))})),n}selectDef(e){this.selectDefinition(e)}changeDefinition(e){const t=this.renderList.find((t=>this.playerData.isDefinitionMatch(t.definition,e)));t&&this.selectDef(t)}renderPanel(e){var t,i;null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(e,this.langText.definitionSelect,!0)}updatePanel(){var e,t,i,n,r,o,s;if((null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&(null==(r=null==(n=null==(i=this.player)?void 0:i.panel)?void 0:n.title)?void 0:r.innerHTML)!==this.langText.definitionSelect)return;const a=this.renderItemList();null==(s=null==(o=this.player)?void 0:o.panel)||s.updatePanel(a)}destroy(){super.destroy(),this.unbind(["click"],this.handleButtonChange)}render(){return'\n <xg-icon class="xgplayer-mobile-definition">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}function sM(){return(new DOMParser).parseFromString('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12.7123 1C11.85 1 11.1173 1.55472 10.8516 2.32675L4.94973 2.32675C3.16413 2.32675 1.71662 3.77427 1.71662 5.55987C1.71662 7.34547 3.16413 8.79298 4.94973 8.79298L11.0483 8.79298L11.1134 8.79418C11.9936 8.82748 12.697 9.55166 12.697 10.44C12.697 11.3497 11.9596 12.0871 11.05 12.0871H5.01323C4.67882 11.4781 4.03143 11.0654 3.28763 11.0654C2.20111 11.0654 1.32031 11.9462 1.32031 13.0327C1.32031 14.1192 2.20111 15 3.28763 15C4.14992 15 4.88264 14.4452 5.14834 13.6732H11.05C12.8356 13.6732 14.2831 12.2256 14.2831 10.44C14.2831 8.65444 12.8356 7.20693 11.05 7.20693L4.94973 7.20693C4.04009 7.20693 3.30267 6.46951 3.30267 5.55987C3.30267 4.65022 4.04009 3.91281 4.94973 3.91281L10.9866 3.91281C11.321 4.52183 11.9685 4.93464 12.7123 4.93464C13.7988 4.93464 14.6796 4.05384 14.6796 2.96732C14.6796 1.8808 13.7988 1 12.7123 1ZM12.7123 2.18954C12.2827 2.18954 11.9345 2.53777 11.9345 2.96732C11.9345 3.39688 12.2827 3.7451 12.7123 3.7451C13.1418 3.7451 13.4901 3.39688 13.4901 2.96732C13.4901 2.53777 13.1418 2.18954 12.7123 2.18954ZM2.50986 13.0327C2.50986 12.6031 2.85808 12.2549 3.28763 12.2549C3.71719 12.2549 4.06541 12.6031 4.06541 13.0327C4.06541 13.4622 3.71719 13.8105 3.28763 13.8105C2.85808 13.8105 2.50986 13.4622 2.50986 13.0327Z" fill="#FFFFFF"/>\n</svg>',"image/svg+xml").firstChild}const{POSITIONS:aM}=bs;class lM extends bs{constructor(e){super(e),this.playerData=e.player.config.playerData,this.dataMonitoring()}static get pluginName(){return"LineMobilePlugin"}static get textTips(){return{jp:"ライン",en:"Line",zh:"线路","zh-hk":"線路"}}static get defaultConfig(){return{position:aM.CONTROLS_RIGHT,index:4}}dataMonitoring(){this.playerData&&hr.subscribeProperty(this.playerData.current,"definition",((e,t)=>{if(e!==t&&this.player){const e=this.playerData.getCurrentUrl();this.player.changeDefinition({definition:t,url:e}),this.updatePanel(),setTimeout((()=>{this.player.paused&&this.player.play()}),1e3)}}))}registerIcons(){return{line:{icon:sM,class:"xgplayer-line-svg"}}}registerLanguageTexts(){return{line:{jp:"ライン",en:"Line",zh:"线路","zh-hk":"線路"},lineSelect:{jp:"ライン選ぶ",en:"Line Choose",zh:"线路选择","zh-hk":"線路選擇"}}}afterCreate(){this.appendChild(".xgplayer-icon",this.icons.line),this.initEvents()}afterPlayerInit(){}initEvents(){this.bind(["click"],this.handleButtonChange.bind(this))}handleButtonChange(){const e=this.renderItemList();this.renderPanel(e)}renderItemList(){const e=this.playerData.getLineList(),t=Ur.createDom("div","",{},"line-panel-content");return e.forEach((e=>{const i=this.renderItem(e);t.appendChild(i)})),t}renderItem(e){const{current:{lineId:t}}=this.playerData,i=Ur.createDom("div","",{},"panel-Item "+(t===e.lineId?"select-in":""));return i.innerHTML=this.i18n[e.lineTextKey]||e.lineTextKey,i.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault(),this.player.emit(FD.LINE_CHANGE,{from:this.playerData.current.lineId,to:e.lineId}),this.playerData.current.lineId=e.lineId,this.player.emit(HD.PLAYER_REBUILD)})),i}renderPanel(e){var t,i;null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(e,this.langText.lineSelect,!0)}updatePanel(){var e;const t=this.renderItemList();null==(e=this.player)||e.panel.updatePanel(t)}destroy(){this.unbind(["click"],this.handleButtonChange.bind(this))}render(){return'\n <xg-icon class="xgplayer-mobile-line">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}function uM(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M14.6879 3.64579C14.7387 3.60575 14.7387 3.52868 14.6879 3.48864L13.3089 2.40296C13.2433 2.35132 13.147 2.39805 13.147 2.48153V4.6529C13.147 4.73639 13.2433 4.78312 13.3089 4.73147L14.6879 3.64579ZM4 2.61914H11.3001V3.91914H4C3.6134 3.91914 3.3 4.23254 3.3 4.61914V15.6191C3.3 16.0057 3.6134 16.3191 4 16.3191H16C16.3866 16.3191 16.7 16.0057 16.7 15.6191V6.75253H18V15.6191C18 16.7237 17.1046 17.6191 16 17.6191H4C2.89543 17.6191 2 16.7237 2 15.6191V4.61914C2 3.51457 2.89543 2.61914 4 2.61914ZM17.7879 3.48864C17.8388 3.52868 17.8388 3.60575 17.7879 3.64579L16.4089 4.73147C16.3433 4.78312 16.2471 4.73639 16.2471 4.6529V2.48153C16.2471 2.39805 16.3433 2.35132 16.4089 2.40296L17.7879 3.48864Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:cM}=bs;class hM extends bs{constructor(e){super(e),this.state={currentRate:1,isSupport:!0},this.playerData=e.player.config.playerData}static get pluginName(){return"PlaybackRateMobilePlugin"}static get textTips(){return{jp:"倍速",en:"PlaybackRate",zh:"倍速","zh-hk":"倍速"}}static get defaultConfig(){return{position:cM.CONTROLS_RIGHT,index:5,list:[2,1.5,1.25,1,.75,.5],default:1}}registerIcons(){return{playbackRate:{icon:uM,class:"xgplayer-rate-svg"}}}registerLanguageTexts(){return{rate:{jp:"倍速",en:"PlaybackRate",zh:"倍速","zh-hk":"倍速"},rateSelect:{jp:"倍速選ぶ",en:"PlaybackRate",zh:"倍速选择","zh-hk":"倍速選擇"}}}afterCreate(){this.appendChild(".xgplayer-icon",this.icons.playbackRate),this.initEvents(),this.state.currentRate=this.player.playbackRate||1,this.changeIconText()}afterPlayerInit(){}initEvents(){this.bind(["click"],this.renderList.bind(this)),this.on(ao,(()=>{var e,t;this.state.currentRate!==this.player.playbackRate&&(this.state.currentRate=this.player.playbackRate,(null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&this.updatePanel(),this.changeIconText())}))}renderList(){const e=this.renderItemList();this.renderPanel(e)}renderItemList(){const e=Ur.createDom("div","",{},"playbackRate-panel-content");return this.config.list.forEach((t=>{const i=this.renderItem(t);e.appendChild(i)})),e}renderItem(e){const t=D(e)?e:{textKey:e+"X",value:e},i=Ur.createDom("div","",{},"panel-Item "+(this.state.currentRate===t.value?"select-in":""));return i.innerHTML=this.i18n[t.textKey]||t.textKey,i.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault();const i={playbackRate:{from:this.player.playbackRate,to:t.value}};this.emitUserAction(e,"change_rate",{props:i}),this.state.currentRate=t.value,this.player.playbackRate=t.value,this.updatePanel(),this.changeIconText()})),i}renderPanel(e){var t,i;null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(e,this.langText.rateSelect,!0)}updatePanel(){var e;const t=this.renderItemList();null==(e=this.player)||e.panel.updatePanel(t)}changeIconText(){let e;const t=this.state.currentRate,i=t%1==0?t.toFixed(1):t+"";switch(i.length){case 1:case 2:case 3:default:e=.7;break;case 4:e=.5}const n=this.find(".icon-text");n.style.transform=`scale(${e})`,n.innerHTML=i}destroy(){this.unbind(["click"],this.renderList.bind(this))}render(){return'\n <xg-icon class="xgplayer-mobile-playBackRate">\n <div class="xgplayer-icon">\n <div class="icon-text"></div>\n </div>\n </xg-icon>\n '}}function dM(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M16.8881 11.8208C16.812 11.6153 16.5213 11.6153 16.4452 11.8208L16.0985 12.7579C15.8115 13.5334 15.2001 14.1448 14.4246 14.4318L13.4875 14.7786C13.2819 14.8546 13.2819 15.1454 13.4875 15.2214L14.4246 15.5682C15.2001 15.8551 15.8115 16.4666 16.0985 17.2421L16.4452 18.1792C16.5213 18.3847 16.812 18.3847 16.8881 18.1792L17.2348 17.2421C17.5218 16.4666 18.1332 15.8551 18.9087 15.5682L19.8458 15.2214C20.0514 15.1454 20.0514 14.8546 19.8458 14.7786L18.9087 14.4318C18.1332 14.1448 17.5218 13.5334 17.2348 12.7579L16.8881 11.8208Z" fill="white"/>\n<rect x="9.5" y="2" width="1.5" height="16" rx="0.75" fill="white"/>\n<rect x="5.75" y="5" width="1.5" height="10" rx="0.75" fill="white"/>\n<rect x="2" y="7" width="1.5" height="6" rx="0.75" fill="white"/>\n<path d="M16.5 7.75C16.5 7.33579 16.8358 7 17.25 7C17.6642 7 18 7.33579 18 7.75V9.18934C18 9.85752 17.1921 10.1921 16.7197 9.71967C16.579 9.57902 16.5 9.38825 16.5 9.18934V7.75Z" fill="white"/>\n<path d="M12.75 5.75C12.75 5.33579 13.0858 5 13.5 5C13.9142 5 14.25 5.33579 14.25 5.75V11.3229C14.25 11.4394 14.2229 11.5542 14.1708 11.6584C13.8169 12.3662 12.75 12.1144 12.75 11.3229V5.75Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:pM}=bs;class fM extends bs{constructor(){super(...arguments),this._nativeMode=!1,this._nativeAddTrackHandler=null,this._nativeChangeHandler=null,this._nativeRemoveTrackHandler=null,this._clickHandler=null,this._nativePanelUpdateRaf=null}static get pluginName(){return"AudioTrackMobile"}static get textTips(){return{en:"Audio",zh:"音频","zh-hk":"音頻",jp:"オーディオ"}}static get defaultConfig(){return{position:pM.CONTROLS_RIGHT,index:2.6,isShowIcon:!0,showNameSuffix:!0}}registerIcons(){return{audiotrack:{icon:dM,class:"xgplayer-audiotrack-svg"}}}afterPlayerInit(){var e;this.on("hlsAudioTracksUpdated",(e=>{this._onAudioTracksUpdated(e.audioTracks)})),this.on("hlsAudioTrackSwitched",(e=>{var t,i;(null==(i=null==(t=this.player)?void 0:t.panel)?void 0:i.isShow)&&this._updateHlsPanel(e.id)}));const t=this._getHls();(null==(e=null==t?void 0:t.audioTracks)?void 0:e.length)>1?this._onAudioTracksUpdated(t.audioTracks):t||this._initNativeAudioTracks()}destroy(){this._clickHandler&&this.unbind(["click"],this._clickHandler),null!==this._nativePanelUpdateRaf&&cancelAnimationFrame(this._nativePanelUpdateRaf),this._unbindNativeAudioTracks()}render(){return this.config.isShowIcon?'\n <xg-icon class="xgplayer-mobile-audiotrack">\n <div class="xgplayer-icon"></div>\n </xg-icon>\n ':""}_getHls(){var e,t;const i=this.player.plugins;return(null==(e=null==i?void 0:i.encrypthlsplugin)?void 0:e.hls)||(null==(t=null==i?void 0:i.hls)?void 0:t.hls)}_getNativeTrackList(){var e,t;return null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks}_onAudioTracksUpdated(e){!e||e.length<=1||this._bindClickOnce()}_renderList(){this._nativeMode?this._renderNativePanel():this._renderHlsPanel()}_getLabelOpts(){return{showNameSuffix:!1!==this.config.showNameSuffix}}_renderHlsPanel(){var e,t,i;const n=this._getHls();if(!n)return;const r=n.audioTracks;if(!(null==r?void 0:r.length))return;const o=null!=(e=n.audioTrack)?e:-1,s=r.find((e=>e.default)),a=this._getLabelOpts(),l=Ur.createDom("div","",{},"audiotrack-panel-content");r.forEach((e=>{let t=e.id===o;t||-1!==o||(null==s?void 0:s.id)!==e.id||(t=!0);const i=Ur.createDom("div","",{},"panel-Item "+(t?"select-in":""));i.innerHTML=cL(e,a),i.addEventListener("click",(t=>{t.stopPropagation(),t.preventDefault(),this._switchHlsTrack(n,e)})),l.appendChild(i)})),null==(i=null==(t=this.player)?void 0:t.panel)||i.showPanel(l,this._panelTitle(),!0)}_updateHlsPanel(e){var t,i;const n=this._getHls();if(!n)return;const r=n.audioTracks;if(!(null==r?void 0:r.length))return;const o=this._getLabelOpts(),s=Ur.createDom("div","",{},"audiotrack-panel-content");r.forEach((t=>{const i=Ur.createDom("div","",{},"panel-Item "+(t.id===e?"select-in":""));i.innerHTML=cL(t,o),i.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),this._switchHlsTrack(n,t)})),s.appendChild(i)})),null==(i=null==(t=this.player)?void 0:t.panel)||i.updatePanel(s)}_switchHlsTrack(e,t){aL(e,t)}_initNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeMode=!0,this._nativeAddTrackHandler=()=>this._onNativeTracksChanged(),this._nativeChangeHandler=()=>{var e,t;(null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&null===this._nativePanelUpdateRaf&&(this._nativePanelUpdateRaf=requestAnimationFrame((()=>{var e,t;this._nativePanelUpdateRaf=null,(null==(t=null==(e=this.player)?void 0:e.panel)?void 0:t.isShow)&&this._renderNativePanel(!0)})))},this._nativeRemoveTrackHandler=()=>this._onNativeTracksChanged(),e.addEventListener("addtrack",this._nativeAddTrackHandler),e.addEventListener("change",this._nativeChangeHandler),e.addEventListener("removetrack",this._nativeRemoveTrackHandler),e.length>1&&this._onNativeTracksChanged())}_unbindNativeAudioTracks(){const e=this._getNativeTrackList();e&&(this._nativeAddTrackHandler&&e.removeEventListener("addtrack",this._nativeAddTrackHandler),this._nativeChangeHandler&&e.removeEventListener("change",this._nativeChangeHandler),this._nativeRemoveTrackHandler&&e.removeEventListener("removetrack",this._nativeRemoveTrackHandler))}_bindClickOnce(){this._clickHandler||(this.appendChild(".xgplayer-icon",this.icons.audiotrack),this._clickHandler=this._renderList.bind(this),this.bind(["click"],this._clickHandler))}_onNativeTracksChanged(){const e=this._getNativeTrackList();!e||e.length<=1||this._bindClickOnce()}_renderNativePanel(e=!1){var t;const i=this._getNativeTrackList();if(!i)return;const n=this._getLabelOpts(),r=Ur.createDom("div","",{},"audiotrack-panel-content");for(let s=0;s<i.length;s++){const e=i[s],t=hL(e,s,n),o=Ur.createDom("div","",{},"panel-Item "+(e.enabled?"select-in":""));o.innerHTML=t,o.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault();const t=this._getNativeTrackList();t&&sL(t,s)})),r.appendChild(o)}const o=null==(t=this.player)?void 0:t.panel;e?null==o||o.updatePanel(r):null==o||o.showPanel(r,this._panelTitle(),!0)}_panelTitle(){var e;return null!=(e=fM.textTips[this.player.lang||"en"])?e:fM.textTips.en}}class gM{constructor(e){this.__args=null,this.sdk=null,this.playerData=null,this.player=null,this._emitter=null,this.beforeCreate&&"function"==typeof this.beforeCreate&&this.beforeCreate(),this.__args=e,this.pluginName="",this.__init(e)}static defineGetterOrSetter(e,t){for(const i in t)Object.defineProperty(e,i,t[i])}static get pluginName(){return"pluginName"}beforeCreate(){}afterCreate(){}beforePlayerCreate(){}afterPlayerCreate(){}destroy(){}__init(e){gM.defineGetterOrSetter(this,{sdk:{get:()=>e.sdk,configurable:!0},player:{get:()=>e.sdk.getPlayerInstance(),configurable:!0},playerData:{get:()=>e.sdk.playerData,configurable:!0},pluginName:{get:()=>e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),configurable:!0},_emitter:{get:()=>e.sdk._emitter,configurable:!0}})}__destroy(){const e=this.sdk,t=this.pluginName;this.destroy&&"function"==typeof this.destroy&&this.destroy(),["sdk","player","playerData","pluginName","_emitter"].map((e=>{Object.defineProperty(this,e,{writable:!0})})),Object.keys(this).map((e=>{this[e]=null,delete this[e]})),Object.setPrototypeOf&&Object.setPrototypeOf(this,null),delete e._sdkPlugins[t]}}const yM=18e5,vM=1e3,mM="media_info",_M="ttdrama_media_info",EM="[mediaInfoCache]";let TM=u({},{enable:!1,expireTime:yM,cacheType:"memory",maxEntries:100});const SM=new Map,bM=new Map;function kM(e,t={}){aa.log(`${EM} ${e}`,t)}function CM(e){var t;return{vid:null==e?void 0:e.vid,playListLength:(null==(t=null==e?void 0:e.playList)?void 0:t.length)||0,hasValidPlayUrl:wM(e)}}function IM(){return u({},TM)}function AM(){const e=SM.size,t=bM.size;SM.clear(),bM.clear();kM("clear success",{memoryCacheCount:e,prefetchedCacheCount:t,localStorageCacheCount:function(){const e=NM();if(!e)return 0;const t=[`${ka}${mM}_`,`${ka}${_M}_`],i=[];for(let n=0;n<e.length;n++){const r=e.key(n);r&&t.some((e=>r.startsWith(e)))&&i.push(r)}return i.forEach((t=>e.removeItem(t))),i.length}()})}function PM(e){return"string"==typeof e?e.trim():""}function wM(e){var t;return!!(null==(t=null==e?void 0:e.playList)?void 0:t.some((e=>!!(null==e?void 0:e.url))))}function DM(e){let t=5381;for(let i=0;i<e.length;i++)t=33*t^e.charCodeAt(i);return(t>>>0).toString(36)}function LM(e){const t=RM(e);return t.playAuthTokenHash?DM(JSON.stringify(t)):""}function RM(e){const t=PM(e.playAuthToken);return{playAuthTokenHash:t?DM(t):"",reqParams:xM(e.reqParams),urlQueryParams:e.urlQueryParams,needThumbs:e.needThumbs,needBarrageMask:e.needBarrageMask}}function xM(e){if(!e)return;const t=u({},e);return delete t.Vid,delete t.vid,Object.keys(t).length?t:void 0}const OM={getItem:e=>SM.get(e)||null,setItem(e,t){SM.delete(e),SM.set(e,t)},removeItem(e){SM.delete(e)}};function NM(){try{return"undefined"!=typeof localStorage?localStorage:null==window?void 0:window.localStorage}catch(e){return}}function MM(e){return e.startsWith(`${ka}${mM}_`)||e.startsWith(`${ka}${_M}_`)}function UM(){if("memory"===TM.cacheType)return Array.from(SM.keys()).filter(MM);const e=NM();return e?function(e){const t=[];for(let i=0;i<e.length;i++){const n=e.key(i);n&&MM(n)&&t.push(n)}return t}(e):[]}function BM(){return"memory"===TM.cacheType?OM:NM()}function HM(e){try{return JSON.parse(e)}catch(t){return}}function FM(e){const t=PM(e.moduleName),i=PM(e.cacheKey);return t&&i?`${ka}${t}_${i}`:""}function jM(e){const t=(e.playList||[]).map((e=>function(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t>a(10,12)?t:1e3*t}(e.urlExpireTimestamp||e.MainUrlExpire||e.mainUrlExpire||e.main_url_expire))).filter((e=>!!e));if(t.length)return Math.min(...t)}function VM(e,t){const i=Date.now()+t,n=jM(e);return n?Math.min(i,n-vM):i}function KM(e){const t=PM(e.moduleName),i=PM(e.cacheKey);return t&&i?`${t}:${i}`:""}function GM(e){const t=KM(e),i=t?bM.get(t):void 0;if(i){if(!(Date.now()>=i.expireAt))return i.lastAccessedAt=Date.now(),i.mediaInfo;bM.delete(t)}}function WM(e,t){const i=KM(e);if(!i||!wM(t))return;const n=VM(t,TM.expireTime);n<=Date.now()||(bM.set(i,{mediaInfo:t,expireAt:n,lastAccessedAt:Date.now()}),function(){const e=bM.size-TM.maxEntries;e<=0||[...bM.entries()].sort((([,e],[,t])=>e.lastAccessedAt-t.lastAccessedAt)).slice(0,e).forEach((([e])=>bM.delete(e)))}())}function YM(e){return{moduleName:PM(e.moduleName),cacheKey:PM(e.cacheKey),cacheKeyInfo:e.cacheKeyInfo,cacheType:TM.cacheType}}function zM(e){const t=BM(),i=FM(e),n=YM(e);if(!t)return void kM("get skip no storage",n);if(!i)return void kM("get skip empty storage key",n);const r=t.getItem(i)||"";if(!r)return void kM("get miss empty cache",n);const o=HM(r);if(!o)return void kM("get miss parse failed",n);const s=null==o?void 0:o.mediaInfo;if(s&&o.expireAt)return Date.now()>=o.expireAt?(t.removeItem(i),void kM("get miss expired and removed",c(u({},n),{expireAt:o.expireAt,now:Date.now()}))):(kM("get hit",u(c(u({},n),{cacheKeyInfo:o.cacheKeyInfo,expireAt:o.expireAt,ttl:o.expireAt-Date.now()}),CM(s))),function(e,t,i,n){try{e.setItem(t,JSON.stringify(c(u({},i),{lastAccessedAt:Date.now()})))}catch(oF){kM("touch failed",c(u({},n),{error:oF}))}}(t,i,o,n),s);kM("get miss invalid cache payload",n)}function $M(e,t,i=yM){const n=BM(),r=FM(e),o=YM(e);if(!n)return void kM("set skip no storage",u(u({},o),CM(t)));if(!r)return void kM("set skip empty storage key",u(u({},o),CM(t)));if(!wM(t))return void kM("set skip invalid media info",u(u({},o),CM(t)));const s=VM(t,i);if(s<=Date.now())return void kM("set skip expired media info",u(c(u({},o),{expireTime:i,expireAt:s}),CM(t)));const a={createdAt:Date.now(),expireAt:s,lastAccessedAt:Date.now(),cacheKeyInfo:e.cacheKeyInfo,mediaInfo:t};try{n.setItem(r,JSON.stringify(a)),function(e){const t=UM(),i=TM.maxEntries;if(t.length<=i)return;const n=t.map((t=>{const i=HM(e.getItem(t)||"");return{key:t,lastAccessedAt:(null==i?void 0:i.lastAccessedAt)||(null==i?void 0:i.createdAt)||0}})).sort(((e,t)=>e.lastAccessedAt-t.lastAccessedAt)),r=t.length-i;n.slice(0,r).forEach((t=>e.removeItem(t.key))),kM("prune success",{removeCount:r,maxEntries:i,cacheType:TM.cacheType})}(n),kM("set success",u(c(u({},o),{cacheKeyInfo:a.cacheKeyInfo,expireTime:i,expireAt:s}),CM(t)))}catch(oF){kM("set failed",u(c(u({},o),{error:oF}),CM(t)))}}function XM(e){if(TM.enable)return function(e){return zM({moduleName:mM,cacheKey:LM(e),cacheKeyInfo:RM(e)})}(e)}function qM(e){return GM({moduleName:mM,cacheKey:LM(e),cacheKeyInfo:RM(e)})||XM(e)}function QM(e,t){TM.enable&&function(e,t,i=yM){$M({moduleName:mM,cacheKey:LM(e),cacheKeyInfo:RM(e)},t,i)}(e,t,TM.expireTime)}const ZM=[["format","format"],["codec","codec"],["definition","definition"],["fileType","file_type"],["needThumbs","need_thumbs"],["needBarrageMask","need_barrage_mask"],["unionInfo","union_info"],["quality","quality"],["drmKek","drm_kek"],["jsPlayer","js_player"]];function JM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function eU(e){if(!e)return;const t={};return ZM.forEach((([i,n])=>{const r=e[i];"string"==typeof r&&(t[n]=r)})),t}function tU(e){return DM(JSON.stringify(eU(e)||{}))}function iU(e){return!0===(null==e?void 0:e.canIUseGetDramaInfoTranscodeParam)}function nU(e){switch(e){case RL.NOT_SUBMITTED:return"NOT_SUBMITTED";case RL.UNDER_REVIEW:return"UNDER_REVIEW";case RL.FAILED_REVIEW:return"FAILED_REVIEW";case RL.WITHDRAWN:return"WITHDRAWN_REVIEW";case RL.NOT_ON_SHELF:return"NOT_ON_SHELF";default:return"FAILED_GET_EPISODE_INFO"}}function rU(e,t){return void 0!==t?nU(t):(null==e?void 0:e.includes("not found"))||(null==e?void 0:e.includes("未查询"))?"NO_INFO_FOUND":(null==e?void 0:e.includes("query"))||(null==e?void 0:e.includes("查询"))?"FAILED_TO_QUERY":"FAILED_GET_EPISODE_INFO"}function oU(e,t){return e&&t?`${e}${-1===e.indexOf("?")?"?":"&"}${i=t,Object.entries(i).map((([e,t])=>Array.isArray(t)?t.map((t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&"):`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&")}`:e;var i}function sU(e,t=10,i=0){const n=parseInt(`${e}`,t);return Number.isNaN(n)?i:n}function aU(e){var t;return PM(e.defaultDefinition||(null==(t=e.getVideoByToken)?void 0:t.defaultDefinition))}function lU(e){var t,i;const n="sg",r={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}},o={cn:{__PLAY_DOMAIN__:"https://vod.volcengineapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.volcengineapi.com"},mya:{__PLAY_DOMAIN__:"https://vod.ap-southeast-1.volcengineapi.com"}};let s={sg:{__PLAY_DOMAIN__:"https://vod.byteplusapi.com",__BACKUP_PLAY_DOMAIN__:"https://open.byteplusapi.com"}},a=n;return"byteplus"===e&&r?(s=r,a="sg"):"volcengine"===e&&o&&(s=o,a=s[n]?n:"cn"),(null==(t=null==s?void 0:s[n])?void 0:t.__PLAY_DOMAIN__)||(null==(i=null==s?void 0:s[a])?void 0:i.__PLAY_DOMAIN__)||""}function uU(e){return PM(e.albumId||e.album_id)}function cU(e){return PM(e.episodeId||e.episode_id||e.episodeID)}function hU(e,t){const i={episodeId:cU(e)};return!JM(e,"transcodeParam")||t&&!iU(t)||(i.transcodeParam=e.transcodeParam),i}function dU(e){const t=PM(e.episodeId);return t?JM(e,"transcodeParam")?`${t}_${tU(e.transcodeParam||{})}`:t:""}function pU(e){const t={episodeId:PM(e.episodeId)};return JM(e,"transcodeParam")&&(t.transcodeParamHash=tU(e.transcodeParam||{})),t}function fU(e){const t={moduleName:_M,cacheKey:dU(e),cacheKeyInfo:pU(e)};return GM(t)||function(e){if(TM.enable)return zM(e);kM("get skip disabled",c(u({},YM(e)),{config:IM()}))}(t)}function gU(e,t){!function(e,t){TM.enable?$M(e,t,TM.expireTime):kM("set skip disabled",u(c(u({},YM(e)),{config:IM()}),CM(t)))}({moduleName:_M,cacheKey:dU(e),cacheKeyInfo:pU(e)},t)}function yU(e){return qM(vU(e))}function vU(e){const t=e.getVideoByToken||{};return c(u({},t),{defaultDefinition:aU(e),reqParams:u({},t.reqParams||{}),urlQueryParams:t.urlQueryParams||e.urlQueryParams})}function mU(e,t){const i=vU(e);return c(u({},i),{playDomain:i.playDomain||lU(null==t?void 0:t.channel)})}function _U(e,t={}){var i,n,r;const o=(e,t,i)=>{for(const n of t)if(e&&void 0!==e[n])return e[n];return i},s=o(e,["PlayInfoList","playInfoList","play_info_list"],[]),a=o(e,["PosterUrl","posterUrl","poster_url"],""),l=o(e,["Vid","vid"],""),h=o(e,["Duration","duration"],0),d=o(e,["BarrageMaskUrl","barrageMaskUrl","barrage_mask_url"],""),p=o(e,["ThumbInfoList","thumbInfoList","thumb_info_list"],[]),f=o(e,["EnableAdaptive","enableAdaptive","enable_adaptive"],void 0),g=o(e,["AdaptiveBitrateStreamingInfo","adaptiveBitrateStreamingInfo","adaptive_bitrate_streaming_info"],void 0),y=null==t?void 0:t.urlQueryParams,{definitionMap:v,autoDemoteDefinition:m,autoDemoteDefinitionTextKey:_}=t||{},E=s.map((e=>{const t=(t,i)=>o(e,t,i),i=t(["MainPlayUrl","mainPlayUrl","main_play_url"],""),n=t(["BackupPlayUrl","backupPlayUrl","backup_play_url"],""),r=oU(i,y),s=oU(n,y),a=t(["Format","format"],"");return u(u({vid:l,url:r,_mainURL:r,_backupURL:s,streamType:a,backupUrl:s,backUrlList:[s],fileType:t(["FileType","fileType","file_type"]),format:a,bitrate:t(["Bitrate","bitrate"]),size:t(["Size","size"]),kid:t(["PlayAuthId","playAuthId","play_auth_id"]),playAuthId:t(["PlayAuthId","playAuthId","play_auth_id"]),playAuth:t(["PlayAuth","playAuth","play_auth"]),secretKey:t(["PlayAuth","playAuth","play_auth"]),vwidth:t(["Width","width"]),vheight:t(["Height","height"]),vtype:null==a?void 0:a.toLocaleUpperCase(),codec:t(["Codec","codec"]),urlExpireTimestamp:sU(t(["MainUrlExpire","mainUrlExpire","main_url_expire"]),10,qs),drmType:t(["DrmType","drmType","drm_type"])},e),Ua(e,{definitionMap:v,autoDemoteDefinition:m,autoDemoteDefinitionTextKey:_}))})).sort(Ea);return{playList:E,type:(null==(i=E[0])?void 0:i.Format)||(null==(n=E[0])?void 0:n.format)||(null==(r=E[0])?void 0:r.streamType),poster:a||"",vid:l,duration:h||0,dashOpts:{Data:c(u({},e),{VideoID:l})},thumbs:p||[],barrageMaskUrl:d||"",enableAdaptive:f,adaptiveBitrateStreamingInfo:g}}function EU(e){var t;return"string"==typeof e?e:(null==(t=null==e?void 0:e[0])?void 0:t.src)||""}function TU(e,t){var i,n;const r=aU(t),o=function(e,t){const i=e.playList||[];return t&&i.find((e=>{var i;const n=e.mapDefinition||e.definition||e.Definition;return(null==(i=null==n?void 0:n.toLocaleLowerCase)?void 0:i.call(n))===t.toLocaleLowerCase()}))||i[0]}(e,r),s=EU(null==o?void 0:o.url);if(!o||!s)return;const a=o.mapDefinition||o.definition||o.Definition||r,l=o.streamType||o.format||o.Format||e.type||"",u=(o.codec||(null==(n=null==(i=o.Codec)?void 0:i.toLowerCase)?void 0:n.call(i))||tr.H264).toLowerCase();return{vid:e.vid||o.vid||t.vid||"",url:s,definition:a,streamType:l,codec:u,bitrate:sU(o.bitrate||o.Bitrate),duration:sU(o.duration||o.Duration||e.duration),size:sU(o.size||o.Size)}}let SU=!1;const bU=["url","src","_mainURL","_backupURL","backupUrl","MainPlayUrl","mainPlayUrl","main_play_url","BackupPlayUrl","backupPlayUrl","backup_play_url"];function kU(e,t){if(!e)return e;const i=e.indexOf("#"),n=-1===i?"":e.slice(i),r=-1===i?e:e.slice(0,i),o=r.indexOf("?"),s=-1===o?r:r.slice(0,o),a=-1===o?"":r.slice(o+1),l=a?a.split("&").filter((e=>{const t=e.split("=")[0];try{return"t"!==decodeURIComponent(t||"")}catch(i){return"t"!==t}})):[];return l.push(`t=${encodeURIComponent(t)}`),`${s}?${l.join("&")}${n}`}function CU(e,t){return"string"==typeof e?kU(e,t):Array.isArray(e)?e.map((e=>"string"==typeof e?kU(e,t):e&&"object"==typeof e&&"string"==typeof e.src?c(u({},e),{src:kU(e.src,t)}):e)):e}function IU(e,t=Date.now()){if(!SU||!e)return e;const i=u({},e);return bU.forEach((e=>{i[e]&&(i[e]=CU(i[e],t))})),Array.isArray(i.backUrlList)&&(i.backUrlList=i.backUrlList.map((e=>CU(e,t)))),i}function AU(e,t=Date.now()){return SU&&e?c(u({},e),{playList:(e.playList||[]).map((e=>IU(e,t)))}):e}const PU=[{id:1,tag:"cmn-Hans-CN",label:"简体中文"},{id:2,tag:"eng-US",label:"English"},{id:3,tag:"jpn-JP",label:"日本語"},{id:4,tag:"kor-KR",label:"한국어"},{id:5,tag:"cmn-Hans-CN|eng-US",label:"中英双语"},{id:6,tag:"rus-RU",label:"Русский"},{id:7,tag:"fra-FR",label:"Français"},{id:8,tag:"por-PT",label:"Português"},{id:9,tag:"spa-ES",label:"Español"},{id:10,tag:"vie-VN",label:"Tiếng Việt"},{id:11,tag:"afr-ZA",label:"Afrikaans"},{id:12,tag:"ben-BD",label:"বাংলা"},{id:13,tag:"bul-BG",label:"Български"},{id:14,tag:"mya-MM",label:"မြန်မာဘာသာ"},{id:15,tag:"ces-CZ",label:"Čeština"},{id:16,tag:"dan-DK",label:"Dansk"},{id:17,tag:"hrv-HR",label:"Hrvatski"},{id:18,tag:"nld-NL",label:"Nederlands"},{id:19,tag:"fin-FI",label:"Suomi"},{id:20,tag:"deu-DE",label:"Deutsch"},{id:21,tag:"ell-GR",label:"Ελληνικά"},{id:22,tag:"hun-HU",label:"Magyar"},{id:23,tag:"ind-ID",label:"Bahasa Indonesia"},{id:24,tag:"gle-IE",label:"Gaeilge"},{id:25,tag:"isl-IS",label:"Íslenska"},{id:26,tag:"ita-IT",label:"Italiano"},{id:27,tag:"nor-NO",label:"Norsk"},{id:28,tag:"pol-PL",label:"Polski"},{id:29,tag:"swe-SE",label:"Svenska"},{id:30,tag:"tha-TH",label:"ภาษาไทย"},{id:31,tag:"tur-TR",label:"Türkçe"},{id:32,tag:"ukr-UA",label:"Українська"},{id:33,tag:"urd-PK",label:"اردو"},{id:34,tag:"ara-SA",label:"العربية"},{id:35,tag:"fra-CA",label:"Français (Canada)"},{id:36,tag:"cmn-Hant-CN",label:"繁體中文"},{id:37,tag:"msa-MY",label:"Bahasa Melayu"},{id:38,tag:"heb-IL",label:"עברית"},{id:39,tag:"jva-ID",label:"Basa Jawa"},{id:40,tag:"ron-RO",label:"Română"},{id:41,tag:"fil-PH",label:"Filipino"},{id:42,tag:"hin-IN",label:"हिन्दी"},{id:43,tag:"ben-IN",label:"বাংলা (ভারত)"},{id:44,tag:"khm-KH",label:"ភាសាខ្មែរ"},{id:45,tag:"bos-PH",label:"Bosanski"},{id:46,tag:"est-EE",label:"Eesti"},{id:47,tag:"lav-LV",label:"Latviešu"},{id:48,tag:"slk-SK",label:"Slovenčina"},{id:49,tag:"lit-LT",label:"Lietuvių"},{id:50,tag:"uyg-CN",label:"ئۇيغۇرچە"}],wU=new Map,DU=new Map;for(const sF of PU)wU.set(sF.id,sF.label),DU.set(sF.tag.toLowerCase(),sF.label);function LU(...e){for(const t of e){if("string"!=typeof t)continue;const e=t.trim();if(e)return e}return null}function RU(e){return{albumId:LU(null==e?void 0:e.album_id,null==e?void 0:e.albumId),episodeId:LU(null==e?void 0:e.episode_id,null==e?void 0:e.episodeId,null==e?void 0:e.episodeID)}}const xU=GL.getVeErrorInfo,OU={playAuthToken:"",needDefinitionList:!0},NU=(e,t,i,n=!1)=>{for(const r of t){const t=null==e?void 0:e[r];if(void 0!==t&&(!n||""!==t))return t}return i},MU=(e,t="")=>null==e?t:`${e}`;class UU extends gM{constructor(e){super(e),this.isPlayByToken=!1,this.isEncrypt=!1,this.config=null,this.useUnionInfoDRM=!0,this.retryCount=1,this.init()}static get pluginName(){return"AuthToken"}beforePlayerCreate(){return d(this,null,(function*(){if(this.isPlayByToken){const e=yield this.getVideoInfo();e&&this.playerData.initPlayData(e)}}))}getVideoInfo(e){return d(this,null,(function*(){var t;const i=null==(t=this.sdk)?void 0:t._createPlayerPerf,n=()=>d(this,null,(function*(){var t,n,r,o,s,a,l,u,c,h,p,f,g;try{const y=this.isMinisDramaMode&&(null==(t=null==yH?void 0:yH.ttDramaEnv)?void 0:t.canIUseGetDramaInfo);if(!y&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.checkPlayAuthTokenValid",(()=>this.checkPlayAuthTokenValid())):this.checkPlayAuthTokenValid()))return;if(!!this.keyTokenInfo&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.checkKeyTokenValid",(()=>this.checkKeyTokenValid())):this.checkKeyTokenValid()))return;if(!!this.thirdPartyDrmAuthTokenInfo&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.checkDrmAuthTokenValid",(()=>this.checkDrmAuthTokenValid())):this.checkDrmAuthTokenValid()))return;const v=((null==i?void 0:i.measureAsync)?yield i.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getVideos",(()=>d(this,null,(function*(){return yield this.getVideos(e)})))):yield this.getVideos(e))||{};if(!(null==(n=null==v?void 0:v.playList)?void 0:n.length))return void aa.error("get no media info");aa.log("getVideo res: ",v);const{type:m,poster:_,vid:E,dashOpts:T,thumbs:S,barrageMaskUrl:b}=v||{},k=v.playList||[];null==(o=null==(r=this.sdk)?void 0:r.assertLiteConfig)||o.call(r,{type:m,playList:k,rtm:v.rtm}),this.playInfo=v,this.setSubtitleConfig(v);const C=m||ma(this.config);this.getPrivateDrmInfo&&((null==i?void 0:i.measureAsync)?yield i.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo",(()=>d(this,null,(function*(){return yield this.getPrivateDrmInfo(k,E,C)})))):yield this.getPrivateDrmInfo(k,E,C)),this.playerData.options.vid=E;if(_&&(this.config.needPoster||this.isMinisDramaMode)&&("string"==typeof this.playerData.options.poster?this.playerData.options.poster=_:"object"==typeof this.playerData.options.poster?this.playerData.options.poster.poster=_:this.playerData.options.poster=_),this.config.needThumbs&&S.length>0&&((null==i?void 0:i.measure)?i.measure("beforePlayerCreate.authtoken.getVideoInfo.getThumbnailConfig",(()=>this.getThumbnailConfig(S))):this.getThumbnailConfig(S)),k.length>0){(null==(s=k[0])?void 0:s.drmType)&&this.playerData.setDrmType(k[0].drmType);const t=(null==(l=null==(a=this.playerData)?void 0:a.adapter)?void 0:l.generatePlaylistFromServer(v,this.config.useMasterM3u8))||[...k],n=this.config.defaultDefinition||(null==e?void 0:e.defaultDefinition)||this.playerData.configs.defaultDefinition;let r=t[0];if(n){const e=t.find((e=>(e.mapDefinition||e.definition||e.Definition).toLocaleLowerCase()===n.toLocaleLowerCase()));e&&(r=e)}const o=this.config.needDefinitionList?t:[r];this.isEncrypt=!!(null==o?void 0:o[0].kid);const d=(null==(u=k[0])?void 0:u.codec)||(null==(h=null==(c=k[0])?void 0:c.Codec)?void 0:h.toLowerCase())||(null==(f=null==(p=this.tokenInfo)?void 0:p.Codec)?void 0:f.toLowerCase())||tr.H264,y={vid:E,dashOpts:T,codec:d,playList:o,defaultDefinitionData:r};return(null==i?void 0:i.measure)?(i.measure("beforePlayerCreate.authtoken.getVideoInfo.getDrmConfig",(()=>this.getDrmConfig(y))),i.measure("beforePlayerCreate.authtoken.getVideoInfo.setPluginConfigInVid",(()=>{var e;return null==(e=this.playerData.adapter)?void 0:e.setPluginConfigInVid(y,this)}))):(this.getDrmConfig(y),null==(g=this.playerData.adapter)||g.setPluginConfigInVid(y,this)),{vid:E,playList:o,codec:d,defaultDefinition:r.definition}}aa.error("get no media info")}catch(y){if(aa.error(y),"VEPLAYER_LITE_UNSUPPORTED_FEATURE"===(null==y?void 0:y.code))throw y}}));return(null==i?void 0:i.measureAsync)?yield i.measureAsync("beforePlayerCreate.authtoken.getVideoInfo",n):yield n()}))}getDramaInfoViaJSB(e){return d(this,null,(function*(){var t,i;const n=yH.ttDramaEnv,r=e||(null==(t=this.playerData)?void 0:t.configs)||{},{albumId:o,episodeId:s}=RU(r),a=r.vid||"";if((null==n?void 0:n.getDramaInfo)&&o&&s)return new Promise((e=>{const t={clientKey:n.clientKey,albumId:o,episodeId:s,vid:a};!0===n.canIUseGetDramaInfoTranscodeParam&&Object.prototype.hasOwnProperty.call(r,"transcodeParam")&&(t.transcodeParam=eU(r.transcodeParam)||{});const i=t=>{var i;aa.error("getDramaInfo error:",t);const n={errorType:"drama",errorCode:LL.FAILED_GET_EPISODE_INFO.code,veError:xU({code:LL.FAILED_GET_EPISODE_INFO.code,message:LL.FAILED_GET_EPISODE_INFO.message,textKey:LL.FAILED_GET_EPISODE_INFO.textKey}),errorMessage:LL.FAILED_GET_EPISODE_INFO.message,ext:{originError:t},originError:t};null==(i=this.sdk)||i.delayError.push(n),e(void 0)};try{n.getDramaInfo((t=>{var n,r,l,u;try{if(aa.log("getDramaInfoViaJSB res:",t),this.reportGetDramaInfoPerf(t,{albumId:o,episodeId:s,vid:a}),!(null==t?void 0:t.is_success)){aa.error("getDramaInfoViaJSB invalid response:",t);const i=rU(null==(n=null==t?void 0:t.error)?void 0:n.error_msg,void 0),o=LL[i]||LL.FAILED_GET_EPISODE_INFO,s={errorType:"drama",errorCode:o.code,veError:xU({code:o.code,message:o.message,textKey:o.textKey}),errorMessage:o.message,ext:{jsbError:null==t?void 0:t.error},originError:t};return null==(r=this.sdk)||r.delayError.push(s),void e(void 0)}const{data:i}=t;if((null==i?void 0:i.status)!==RL.SUCCESS){aa.error("getDramaInfoViaJSB invalid response:",t);const n=nU(null==i?void 0:i.status),r=LL[n]||LL.FAILED_GET_EPISODE_INFO,o={errorType:"drama",errorCode:r.code,veError:xU({code:r.code,message:r.message,textKey:r.textKey}),errorMessage:r.message,ext:{status:null==i?void 0:i.status},originError:t};return null==(l=this.sdk)||l.delayError.push(o),void e(void 0)}if(!(null==i?void 0:i.video_info)){aa.error("getDramaInfoViaJSB invalid response:",t);const n={errorType:"drama",errorCode:LL.FAILED_TO_QUERY.code,veError:xU({code:LL.FAILED_TO_QUERY.code,message:LL.FAILED_TO_QUERY.message,textKey:LL.FAILED_TO_QUERY.textKey}),errorMessage:LL.FAILED_TO_QUERY.message,ext:{status:null==i?void 0:i.status},originError:t};return null==(u=this.sdk)||u.delayError.push(n),void e(void 0)}aa.log("videoInfoRes before transformDramaVideoInfoToRes",i.video_info);const c=this.transformDramaVideoInfoToRes(i.video_info,this.config);aa.log("videoInfoRes after transformDramaVideoInfoToRes",c),e(c)}catch(c){i(c)}}),t)}catch(l){i(l)}}));{const e=LL.INVALID_PARAM;null==(i=this.sdk)||i.delayError.push({errorType:DL.network,errorCode:e.code,veError:xU({code:e.code,message:e.message,textKey:e.textKey}),errorMessage:e.message,ext:{},originError:void 0})}}))}mapReviewStatusToErrorCode(e){return nU(e)}mapDramaErrorCode(e,t){return rU(e,t)}transformDramaVideoInfoToRes(e,t){return _U(e,t)}callOnGetMediaInfo(e,t){var i,n,r;if(e)try{null==(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.onGetMediaInfo)||r.call(n,{data:e,fromCache:t})}catch(o){aa.error("onGetMediaInfo callback error:",o)}}reportGetDramaInfoPerf(e,t){var i,n,r,o;const s=null==(i=null==e?void 0:e.data)?void 0:i.perf_info;s&&(null==(o=null==(n=this.sdk)?void 0:n.recordGetDramaInfoPerf)||o.call(n,{perfInfo:s,albumId:t.albumId,episodeId:t.episodeId,vid:t.vid,isSuccess:!!(null==e?void 0:e.is_success),status:null==(r=null==e?void 0:e.data)?void 0:r.status,fromCache:!1,timestamp:Date.now()}))}getVideos(e){return d(this,null,(function*(){var t,i,n,r,o,s;const a=null==(t=this.sdk)?void 0:t._createPlayerPerf;if(aa.log("tt drama info: ",this.isMinisDramaMode,null==yH?void 0:yH.ttDramaEnv),this.isMinisDramaMode&&(null==(i=null==yH?void 0:yH.ttDramaEnv)?void 0:i.canIUseGetDramaInfo)){const t=c(u({},e||(null==(n=this.playerData)?void 0:n.configs)||{}),{defaultDefinition:(null==e?void 0:e.defaultDefinition)||(null==(o=null==(r=this.playerData)?void 0:r.configs)?void 0:o.defaultDefinition)||(null==(s=this.config)?void 0:s.defaultDefinition),getVideoByToken:this.config}),i=fU(hU(t,yH.ttDramaEnv));if(i){const e=AU(i);return this.callOnGetMediaInfo(e,!0),e}const l=e=>{gU(hU(t,yH.ttDramaEnv),e);const i=AU(e);return this.callOnGetMediaInfo(i,!1),i};if(null==a?void 0:a.measureAsync){return l(yield a.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getVideos.getDramaInfoViaJSB",(()=>d(this,null,(function*(){return yield this.getDramaInfoViaJSB(e)})))))}return l(yield this.getDramaInfoViaJSB(e))}const l=e=>{var t,i,n;try{const i=JSON.parse(e.response);if(100006===Vn(i,"ResponseMetadata.Error.CodeN")){aa.error("playAuthToken is invalid or expired, please check or update your playAuthToken");const i={errorType:"token",errorCode:9101,veError:xU(PL.PLAY_AUTH_TOKEN_EXPIRED),errorMessage:"playAuthToken has expired",ext:{serveResponse:"string"==typeof(null==e?void 0:e.response)?null==e?void 0:e.response:"",serveStatus:null==e?void 0:e.status,playAuthToken:this.config.playAuthToken,config:this.config},originError:e};return null==(t=this.sdk)?void 0:t.delayError.push(i)}}catch(o){aa.log(o)}null==(i=this._emitter)||i.emit(FD.GET_PLAY_URL_ERR,e);const r={errorType:"token",errorCode:9100,errorMessage:"get play url error by playAuthToken, please check the playAuthToken",veError:xU(PL.GET_PLAY_INFO_ERR),ext:{serveResponse:"string"==typeof(null==e?void 0:e.response)?null==e?void 0:e.response:"",serveStatus:null==e?void 0:e.status,playAuthToken:this.config.playAuthToken},originError:e};null==(n=this.sdk)||n.delayError.push(r)},h=e=>d(this,null,(function*(){if(!this.config.playDomain&&502===(null==e?void 0:e.status)&&this.playerData.apiMap.backupPlayDomain)return this.playerData.playDomainDegrade=!0,yield Sa((()=>Ta(u({playDomain:this.playerData.playDomain},this.config))),this.retryCount,(e=>502===e.status),l);l(e)})),p=()=>d(this,null,(function*(){var e,t;const i=u({playDomain:this.config.playDomain||this.playerData.playDomain},this.config),n=LM(i),r=qM(i);if(r){aa.log("[mediaInfoCache] authToken use cached media info",{cacheKey:n,vid:r.vid,playListLength:(null==(e=r.playList)?void 0:e.length)||0});const t=AU(r);return this.callOnGetMediaInfo(t,!0),t}aa.log("[mediaInfoCache] authToken request media info",{cacheKey:n,retryCount:this.retryCount,playDomain:i.playDomain});const o=yield Sa((()=>Ta(i)),this.retryCount,(e=>502===e.status),h);QM(i,o);const s=AU(o);return aa.log("[mediaInfoCache] authToken request finished",{cacheKey:n,vid:null==o?void 0:o.vid,playListLength:(null==(t=null==o?void 0:o.playList)?void 0:t.length)||0,mediaInfo:o}),this.callOnGetMediaInfo(s,!1),s}));return(null==a?void 0:a.measureAsync)?yield a.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getVideos.getPlayInfoByAuthToken",p):yield p()}))}getPrivateDrmInfo(e,t,i){return d(this,null,(function*(){var n,r,o,s;const a=null==(n=this.sdk)?void 0:n._createPlayerPerf;if(this.config.getDrmAuthToken&&"function"==typeof this.config.getDrmAuthToken&&this.playerData.unionId){let n;if(this.sessionId=(new Date).getTime().toString(),"hls"===i){const e=(null==a?void 0:a.measureAsync)?yield a.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.loadPlugins.hlsEncrypt",(()=>d(this,null,(function*(){return yield this.sdk.sdkUmdLoader.loadPlugins(Hw.HLSEncrypt)})))):yield this.sdk.sdkUmdLoader.loadPlugins(Hw.HLSEncrypt);n=null==(r=null==e?void 0:e.updateUnionInfo)?void 0:r.call(e,this.playerData.unionId,this.sessionId)}else if("dash"===i){const e=(null==a?void 0:a.measureAsync)?yield a.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.loadPlugins.dash",(()=>d(this,null,(function*(){return yield this.sdk.sdkUmdLoader.loadPlugins(Hw.DASH)})))):yield this.sdk.sdkUmdLoader.loadPlugins(Hw.DASH);n=null==(o=null==e?void 0:e.updateUnionInfo)?void 0:o.call(e,this.playerData.unionId,this.sessionId)}else if(["mp4","m4a"].includes(i)){const e=(null==a?void 0:a.measureAsync)?yield a.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.loadPlugins.mp4Encrypt",(()=>d(this,null,(function*(){return yield Vw.loadMp4Encrypt(this.sdk.sdkUmdLoader)})))):yield Vw.loadMp4Encrypt(this.sdk.sdkUmdLoader);n=null==(s=null==e?void 0:e.updateUnionInfo)?void 0:s.call(e,this.playerData.unionId,this.sessionId)}if(!n)return void aa.error("updateUnionInfo fail");const u=[...new Set(e.map((e=>e.kid)))].join(",");try{const i=(null==a?void 0:a.measureAsync)?yield a.measureAsync("beforePlayerCreate.authtoken.getVideoInfo.getPrivateDrmInfo.getDrmAuthToken",(()=>d(this,null,(function*(){return yield za(Ka(this.config.getDrmAuthToken(u,t,n)),200,"The execution time of obtaining privateDrmAuthToken by getDrmAuthToken function of options has exceeded more than 200ms")})))):yield za(Ka(this.config.getDrmAuthToken(u,t,n)),200,"The execution time of obtaining privateDrmAuthToken by getDrmAuthToken function of options has exceeded more than 200ms");if(i&&"string"==typeof i){this.privateDrmAuthToken=i;const t=va(i);(null==t?void 0:t.DrmType)&&(this.useUnionInfoDRM="webdevice"===(null==t?void 0:t.DrmType)),e.forEach((e=>{e.drmKeyToken=this.privateDrmAuthToken}))}}catch(l){aa.error("get privaterDrmToken fail")}}}))}getThumbnailConfig(e){const t=e[0],i=u({},this.playerData.configs.thumbnail||{});this.playerData.options.thumbnail=u({pic_num:t.CaptureNum,urls:t.StoreUrls,width:t.CellWidth,height:t.CellHeight,col:t.ImgXLen,row:t.ImgYLen},i)}getBarrageMaskUrl(e){var t,i;const n=null==(t=this.playerData.configs)?void 0:t.DanmuPlugin,r="object"==typeof n?n:{},o=u({},(null==r?void 0:r.maskConfig)||{});this.playerData.configs.DanmuPlugin?(this.playerData.options.DanmuPlugin.maskActive=null==(i=r.maskActive)||i,this.playerData.options.DanmuPlugin.maskConfig=u({maskUrl:e},o)):this.playerData.options.DanmuPlugin={active:!0,maskActive:!0,maskConfig:u({maskUrl:e},o)}}setSubtitleConfig(e){var t,i,n,r,o,s,a,l,h;if(!(null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.autoSubtitle)||!e)return;const d=this.getAutoSubtitleList(e),p=null==(n=this.playerData.options)?void 0:n.Subtitle,f=null==(r=this.playerData.configs)?void 0:r.Subtitle,g="object"==typeof p&&p?p:"object"==typeof f&&f?f:{};this.playerData.options.Subtitle=c(u({},g),{list:d}),null==(h=null==(l=null==(a=null==(s=null==(o=this.sdk)?void 0:o.player)?void 0:s.plugins)?void 0:a.subtitle)?void 0:l.updateSubtitles)||h.call(l,d)}getAutoSubtitleList(e){const t=this.getSubtitleSourceData(e),i=NU(t,["SubtitleInfoList","subtitleInfoList","subtitle_info_list"],[]);if(!Array.isArray(i))return[];const n=i.map(((e,t)=>this.getAutoSubtitleItem(e,t))).filter((e=>Boolean(e)));return n.some((e=>void 0!==e._subtitleOrder))&&n.sort(((e,t)=>{var i,n;return(null!=(i=e._subtitleOrder)?i:1/0)-(null!=(n=t._subtitleOrder)?n:1/0)})),n.forEach((e=>{delete e._subtitleOrder})),n}getSubtitleSourceData(e){const t=null==e?void 0:e.dashOpts;return(null==t?void 0:t.Data)||(null==t?void 0:t.data)||e}getAutoSubtitleItem(e,t){const i="string"==typeof e?this.getStringAutoSubtitleItem(e,t):this.getObjectAutoSubtitleItem(e,t);if(i)return this.formatAutoSubtitleItem(i,e,t)}getStringAutoSubtitleItem(e,t){const i=`${t+1}`;return u({id:`${t}`,language:`${t}`,label:i,text:i},!/\n/.test(n=e)&&(/^(https?:)?\/\//.test(n)||/^data:/.test(n)||/\.(vtt|srt)([?#].*)?$/i.test(n))?{url:e}:{stringContent:e});var n}getObjectAutoSubtitleItem(e,t){if(!e||"object"!=typeof e)return;const i=NU(e,["SubtitleUrl","subtitleUrl","subtitle_url","url","src"],"",!0),n=NU(e,["StringContent","stringContent","string_content"],"",!0),r=NU(e,["List","list"]);if(!i&&!n&&!r)return;const o=function(e,t){const i="string"==typeof e?parseInt(e,10):e;if("number"==typeof i&&!isNaN(i)){const e=wU.get(i);if(e)return e}if(t){const e=DU.get(t.toLowerCase());if(e)return e}}(NU(e,["LanguageId","languageId","language_id"],void 0,!0),NU(e,["Language","language"],"",!0)),s=o||MU(NU(e,["Title","title","label","text","Language","language","Tag","tag","LanguageId","languageId","language_id"],`${t+1}`,!0),`${t+1}`),a=MU(NU(e,["SubtitleId","subtitleId","subtitle_id","FileId","fileId","file_id","id"],`${t}`,!0),`${t}`),l=MU(NU(e,["Language","language","LanguageId","languageId","language_id","srclang"],`${t}`,!0),`${t}`);return u(u(u(c(u({},e),{id:a,language:l,label:s,text:s}),i?{url:i}:{}),n?{stringContent:n}:{}),r?{list:r}:{})}formatAutoSubtitleItem(e,t,i){var n,r;const o=null==(r=null==(n=this.playerData)?void 0:n.configs)?void 0:r.formatAutoSubtitleItem;if("function"!=typeof o)return e;const s=o(t,i);if(!1!==s&&null!==s){if(!0===s||void 0===s)return e;if("string"==typeof s||"number"==typeof s){const t=`${s}`;return c(u({},e),{label:t,text:t})}if("object"==typeof s){if(!1===s.show||!1===s.visible)return;const t=Object.prototype.hasOwnProperty.call(s,"order"),i=Object.prototype.hasOwnProperty.call(s,"label")||Object.prototype.hasOwnProperty.call(s,"text")?(()=>{var t;const i=MU(null!=(t=s.label)?t:s.text,"");return c(u({},e),{label:i,text:i})})():e;t&&(i._subtitleOrder=s.order);const n=Object.prototype.hasOwnProperty.call(s,"isDefault"),r=Object.prototype.hasOwnProperty.call(s,"default");return(n||r)&&(i.isDefault=n?Boolean(s.isDefault):Boolean(s.default)),i}return e}}getDrmConfig(e){var t,i,n,r,o,s,a,l;const{thirdPartyDrmAuthToken:c,serverCertificatePath:h}=this.config;if(c)try{const{vid:c,playList:d}=e,{kid:p,codec:f}=null==d?void 0:d[0];if(!p||!c)return void aa.warn("get kid or vid fail");const g=null==(t=this.playerData.configs)?void 0:t.drm,y="object"==typeof g?g:{},{playDomain:v}=this.config,m=v||this.playerData.playDomain,_=function(e,t="GetPlayInfoToken"){const i=ga(window.atob(e));return i?i[t]:""}(this.config.thirdPartyDrmAuthToken,"GetThirdPartyDrmAuthToken"),E=u({ignoreLicenseHeader:!1,unRecord:null!=(i=this.config.unRecord)&&i,contentType:ir[f],initDataType:"cenc",[Zs.FAIRPLAY]:{serverProcessSPCPath:ba(Zs.FAIRPLAY,p,m,_),serverCertificatePath:h},[Zs.WIDEVINE]:{serverProcessSPCPath:ba(Zs.WIDEVINE,p,m,_)},[Zs.PLAYREADY]:{serverProcessSPCPath:ba(Zs.PLAYREADY,p,m,_)}},y);(null==(o=null==(r=null==(n=this.sdk)?void 0:n.player)?void 0:r.plugins)?void 0:o.drm)&&(null==(l=null==(a=null==(s=this.sdk)?void 0:s.player)?void 0:a.plugins)||l.drm.updateConfig(E)),this.playerData.options.drm=E}catch(d){aa.error("generate drm config error:",d)}else this.playerData.options.drm={initDataType:"cenc"}}get isMinisDramaMode(){const e=yH.ttDramaEnv;return!!(null==e?void 0:e.getDramaInfo)}init(){const e=this.playerData.configs,{getVideoByToken:t={}}=e;this.initConfig(t)}initConfig(e,t){var i;const n=t||(null==(i=this.playerData)?void 0:i.configs)||{},{albumId:r,episodeId:o}=RU(n),s=!(!r||!o),a=!!yH.ttDramaEnv;if(this.isPlayByToken=!!e.playAuthToken||a&&s,this.isPlayByToken&&(this.config=Object.assign({},OU,e),Object.prototype.hasOwnProperty.call(n,"definitionMap")&&(this.config.definitionMap=n.definitionMap),e.playAuthToken)){if(this.tokenInfo=ya(e.playAuthToken),e.keyToken){const t=(l=e.keyToken,/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/.test(l)?window.atob(e.keyToken):e.keyToken);this.keyTokenInfo=va(t)}e.thirdPartyDrmAuthToken&&(this.thirdPartyDrmAuthTokenInfo=ya(e.thirdPartyDrmAuthToken,"GetThirdPartyDrmAuthToken")),e.retryCount&&(this.retryCount=e.retryCount)}var l}updateDramaEpisode(e,t){return d(this,null,(function*(){var i,n,r;const o=t||(null==(i=this.playerData)?void 0:i.configs)||{},s=o.getVideoByToken||{},a={config:this.config,isPlayByToken:this.isPlayByToken,tokenInfo:this.tokenInfo,keyTokenInfo:this.keyTokenInfo,thirdPartyDrmAuthTokenInfo:this.thirdPartyDrmAuthTokenInfo,retryCount:this.retryCount};this.initConfig(s,o);const l=yield this.getVideoInfo(o);if(!l)throw this.config=a.config,this.isPlayByToken=a.isPlayByToken,this.tokenInfo=a.tokenInfo,this.keyTokenInfo=a.keyTokenInfo,this.thirdPartyDrmAuthTokenInfo=a.thirdPartyDrmAuthTokenInfo,this.retryCount=a.retryCount,new Error("Failed to get drama media info");if(t&&(this.playerData.configs=t),e)this.playerData.initPlayData(l);else{const e=this.playerData.current.definition,t=(null==(n=l.playList)?void 0:n.find((t=>{var i,n;const r=t.mapDefinition||t.definition||t.Definition;return(null==(i=null==r?void 0:r.toLocaleLowerCase)?void 0:i.call(r))===(null==(n=null==e?void 0:e.toLocaleLowerCase)?void 0:n.call(e))})))||(null==(r=l.playList)?void 0:r[0]),i=(null==t?void 0:t.mapDefinition)||(null==t?void 0:t.definition)||(null==t?void 0:t.Definition);this.playerData.updateConfigs(c(u({},l),{defaultDefinition:i})),this.playerData.updatePlayList(),t&&this.playerData.initCurrent(t),this.playerData.updateCheckExpireData()}}))}updateAuthToken(e,t){return d(this,null,(function*(){const i=Object.assign({},this.config,e);this.initConfig(i);const n=yield this.getVideoInfo();n&&(t?this.playerData.initPlayData(n):(this.playerData.updateConfigs(c(u({},n),{defaultDefinition:this.playerData.current.definition})),this.playerData.updatePlayList(),this.playerData.updateCheckExpireData()))}))}checkPlayAuthTokenValid(){var e,t;if(!this.tokenInfo)return!1;if(_a(this.tokenInfo)){aa.error("playAuthToken is expired, please check or update your playAuthToken"),null==(e=this.sdk)||e.delayEvents.push({name:HD.TOKEN_EXPIRED,payload:{type:"playAuthToken",token:this.tokenInfo}});const i={errorType:"token",errorCode:9101,veError:xU(PL.PLAY_AUTH_TOKEN_EXPIRED),errorMessage:"playAuthToken has expired",ext:{playAuthToken:this.config.playAuthToken,config:this.config},originError:void 0};return null==(t=this.sdk)||t.delayError.push(i),!0}return!1}checkKeyTokenValid(){var e,t;if(_a(this.keyTokenInfo)){aa.error("keyToken is expired, please check or update your keyToken"),null==(e=this.sdk)||e.delayEvents.push({name:HD.TOKEN_EXPIRED,payload:{type:"keyToken",token:this.keyTokenInfo}});const i={errorType:"token",errorCode:9102,veError:xU(PL.HLS_KEY_TOKEN_EXPIRED),errorMessage:"keyToken for hls encrypt play has expired",ext:{keyToken:this.config.keyToken,config:this.config},originError:void 0};return null==(t=this.sdk)||t.delayError.push(i),!0}return!1}checkDrmAuthTokenValid(){var e,t;if(_a(this.thirdPartyDrmAuthTokenInfo)){aa.error("thirdPartyDrmAuthToken is expired, please check or update your thirdPartyDrmAuthToken"),null==(e=this.sdk)||e.delayEvents.push({name:HD.TOKEN_EXPIRED,payload:{type:"thirdPartyDrmAuthToken",token:this.thirdPartyDrmAuthTokenInfo}});const i={errorType:"token",errorCode:9103,errorMessage:"thirdPartyDrmAuthToken for DRM has expired",veError:xU(PL.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED),ext:{thirdPartyDrmAuthToken:this.config.thirdPartyDrmAuthToken,config:this.config},originError:void 0};return null==(t=this.sdk)||t.delayError.push(i),!0}return!1}}class BU extends gM{static get pluginName(){return"Abr"}constructor(e){super(e)}static get defaultConfig(){return{autoDefiText:"",isOpenAutoDefi:!1,interval:1e3,hurryThreshold:.25,lowThreshold:.4,highThreshold:.7,noStallCheckTime:5,isOpenHint:!1,method:31}}beforePlayerCreate(){return d(this,null,(function*(){if(this.playerData.isOpenVePlayerABR())return yield this.prepareAbrModule()}))}prepareAbrModule(){return d(this,null,(function*(){var e,t;return null==(t=null==(e=this.sdk.playerData)?void 0:e.adapter)?void 0:t.prepareAbrModule(this.playerData,this.sdk.sdkUmdLoader)}))}adaptAbrOptions(){var e;const t=null==(e=this.playerData.configs)?void 0:e.autoBitrateOpts;if(t){const e=this.playerData.defaultDefinition;return c(u(u({},BU.defaultConfig),t),{autoDefiText:t.autoDefinitionText||"",isOpenAutoDefi:this.playerData.isOpenABR(),isPlayAutoDefi:this.playerData.isPlayAutoDefinition(e)})}}applyAbrConfig(e){var t,i;const n=this.adaptAbrOptions();n&&(null==(i=null==(t=this.sdk.playerData)?void 0:t.adapter)||i.applyAbrPluginConfig(e,n))}}class HU extends gM{static get pluginName(){return"AdaptRange"}constructor(e){super(e)}adaptRangeOptions(){var e,t,i,n,r,o,s,a;const l=null!=(t=null==(e=this.playerData.configs)?void 0:e.adaptRange)?t:void 0;if(!(null==l?void 0:l.enable)||!(null==(n=null==(i=this.playerData.adapter)?void 0:i.canAdaptRangeEnable)?void 0:n.call(i)))return;const h=this.playerData.adapter.adaptRangeDefaultOptions();return c(u(u({},null!=h?h:{}),l),{minTargetCacheDur:null!=(r=l.minCacheDuration)?r:null==h?void 0:h.minTargetCacheDur,maxTargetCacheDur:null!=(o=l.maxCacheDuration)?o:null==h?void 0:h.maxTargetCacheDur,rangeMinDuration:null!=(s=l.minRangeDuration)?s:null==h?void 0:h.rangeMinDuration,rangeMaxDuration:null!=(a=l.maxRangeDuration)?a:null==h?void 0:h.rangeMaxDuration})}applyRangeConfig(e){const t=this.adaptRangeOptions();t&&e&&this.playerData.adapter.applyAdaptRangePluginConfig(e,t)}}class FU extends gM{static get pluginName(){return"Strategy"}applyFinalStrategy(e){var t,i,n,r;if(gD.isReady()){const o=this.playerData.configs.duration||(null==(i=null==(t=this.playerData.playList)?void 0:t[0])?void 0:i.duration)||-1,s=o>0&&o<=180?"svideo":o>180&&o<=1800?"mvideo":"lvideo",a={vtype:null==(n=this.playerData.adapter)?void 0:n.streamType,duration:o,videoLabel:s},l=gD.getStrategyRecommendations(void 0,a),{result:u}=l;aa.log("VodLogCommon Final StrategyConfig:",u);const c=null==u?void 0:u[cD.ADAPT_RANGE];(null==c?void 0:c.enable)&&(null==c?void 0:c.options)&&(null==(r=this.playerData.adapter)||r.applyAdaptRangeStrategy(e,c.options))}}}const jU={init(e){var t;if(!e)return;const i=e.playerData.sdkPlugins;(null==(t=e.playerData)?void 0:t.isLive)?e.sdkPlugins=[...i]:e.sdkPlugins=[UU,BU,HU,FU,...i],e._sdkPlugins={}},registerPlugin(e,t){if(!e||!t)return;let i=null,n=null;e.plugin&&"function"==typeof e.plugin?(i=e.plugin,n=e.options):(i=e,n={}),n.sdk=t;const r=n.pluginName||i.pluginName;if(!r)throw new Error("The property pluginName is necessary");const o=t._sdkPlugins;try{o[r.toLowerCase()]&&this.unRegister(r);const e=new i(n);return o[r.toLowerCase()]=e,o[r.toLowerCase()].func=i,e&&"function"==typeof e.afterCreate&&e.afterCreate(),e}catch(s){aa.error(s)}},unRegister(e,t){if(e&&t){e=e.toLowerCase();try{const i=t._sdkPlugins[e];i&&(i.pluginName&&i.__destroy(),delete t._sdkPlugins[e])}catch(i){aa.error(i)}}},beforePlayerCreate(e){if(!e)return;e._sdkPlugins||this.init(e);const t=e._sdkPlugins,i=null==e?void 0:e._createPlayerPerf,n=[];for(const o of Object.keys(t))if(t[o]&&t[o].beforePlayerCreate)try{const e=()=>Ka(t[o].beforePlayerCreate());(null==i?void 0:i.measureAsync)?n.push(i.measureAsync(`beforePlayerCreate.${o}`,e)):n.push(e())}catch(r){throw n.push(Ka(null)),r}return new Promise(((e,t)=>{Promise.all([...n]).then((()=>{e(null)})).catch((i=>{aa.error(i),"VEPLAYER_LITE_UNSUPPORTED_FEATURE"!==(null==i?void 0:i.code)?e(null):t(i)}))}))},afterPlayerCreate(e){if(!e)return;const t=e._sdkPlugins;for(const n of Object.keys(t))if(t[n]&&t[n].beforePlayerCreate)try{t[n].afterPlayerCreate()}catch(i){throw i}},destroy(e){if(!e)return;const t=e._sdkPlugins;if(t){for(const i of Object.keys(t))this.unRegister(i,e);delete e._sdkPlugins}}},VU={[AL.NETWORK]:"Network error",[AL.NETWORK_TIMEOUT]:"Network timeout",[AL.NETWORK_FORBIDDEN]:"The video URL is prohibited from access. Please check the domain name access control",[AL.NETWORK_NOTFOUND]:"The video not found, please check whether the URL is correct",[AL.NETWORK_RANGE_NOT_SATISFIABLE]:"The request range is incorrect, please try again later",[AL.NETWORK_PROTOCOL]:"The request protocol is incorrect, please use the https URL to access",[AL.NETWORK_URL_EXPIRE]:"The video URL has expired",[AL.NETWORK_URL_SIGN]:"The video URL signature is incorrect, please check whether the URL is correct",[AL.NETWORK_ENCRYPT_HLS_ERR]:"Get the m3u8 file or encrypt key fail",[AL.MEDIA_ERR]:"Media error",[AL.MEDIA_ERR_ABORTED]:"Playback was canceled by the user or browser",[AL.MEDIA_ERR_NETWORK]:"Network error",[AL.MEDIA_ERR_DECODE]:"Decoding error",[AL.MEDIA_ERR_SRC_NOT_SUPPORTED]:"Audio/Video format not supported or URL unavailable",[AL.MEDIA_ERR_NOT_SUPPORTED]:"Unsupported video format",[AL.MEDIA_ERR_URL_EMPTY]:"Video URL is empty",[AL.MEDIA_ERR_FILE_NOT_SUPPORTED]:"Video file is not supported in the current browser environment",[AL.MEDIA_ERR_PLAY_ERR]:"Video playback error",[AL.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"Unsupported video type",[AL.BUSINESS_DRM_NOT_SUPPORT]:"DRM encrypted playback is not supported",[AL.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"Screen recording protection is not supported",[AL.BUSINESS_DRM_LACK_MEDIA_KEY]:"Video data lacks the corresponding MediaKey",[AL.BUSINESS_DRM_LACK_KEY_SESSION]:"Browser does not support the corresponding DRM KeySession",[AL.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"Decryption playback error",[AL.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"Missing DRM certificate request link",[AL.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"Missing DRM License request link",[AL.BUSINESS_DRM_LICENSE_FAIL]:"Request or update License failed",[AL.BUSINESS_DRM_KEY_ERROR]:"Decryption error",[AL.BUSINESS_DRM_CERT_FAIL]:"Request for DRM certificate failed",[AL.PRIVATE_DRM_KEY_GET_FAILED]:"Private DRM get key failed",[AL.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"Web cryptography API is not supported, please visit page by https",[AL.PRIVATE_DRM_RSA_FAIL]:"Decryption by RSA-OAEP failed, please check playAuthId",[AL.OTHER]:"Other error",[AL.VOD_LOG_NOT_CONFIGURED]:"Log options not configured correctly",[AL.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthToken has expired",[AL.HLS_KEY_TOKEN_EXPIRED]:"keyToken has expired",[AL.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthToken has expired",[AL.GET_PLAY_INFO_ERR]:"Failed to get media information",[AL.GET_HLS_DECRYPTION_KEY_ERR]:"Failed to get HLS key",[AL.LICENSE_VALIDATE_FAIL]:"License validation failed",[AL.DEFINITION_AUTO]:"Auto",[AL.LICENSE_STATUS_INVALID]:"License validation is invalid",[AL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"license domain name does not match",[AL.BASE_LICENSE_NOT_SUPPORT_265]:"The basic license does not support H265",[AL.BASE_LICENSE_NOT_SUPPORT_ABR]:"The basic license does not support ABR",[AL.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"The basic license does not support dynamic buffer",[AL.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"The basic license does not support preload",[AL.EXPIRED_LICENSE_NOT_SUPPORT_265]:"Expired license does not support H265",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"Expired license does not support ABR",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"The expired license does not support dynamic buffer",[AL.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"Expired license does not support preloading",[AL.DRAMA_INVALID_PARAM]:"Invalid parameter",[AL.DRAMA_NO_INFO_FOUND]:"No information found for this episode",[AL.DRAMA_NOT_SUBMITTED]:"Episode has not been submitted for review",[AL.DRAMA_UNDER_REVIEW]:"Episode is under review",[AL.DRAMA_FAILED_REVIEW]:"Episode failed review",[AL.DRAMA_WITHDRAWN_REVIEW]:"Episode review was withdrawn",[AL.DRAMA_FAILED_TO_QUERY]:"Failed to query video playback information",[AL.DRAMA_INVALID_TTOP_TOKEN]:"Invalid playback credential or TTOP signature verification failed",[AL.DRAMA_NOT_ON_SHELF]:"Video is not on shelf",[AL.DRAMA_FAILED_GET_EPISODE_INFO]:"Failed to get episode information"},KU={[AL.NETWORK]:"网络错误",[AL.NETWORK_TIMEOUT]:"网络超时",[AL.NETWORK_FORBIDDEN]:"视频地址禁止访问,请检查域名访问控制",[AL.NETWORK_NOTFOUND]:"视频不存在,请检查视频地址是否正确",[AL.NETWORK_RANGE_NOT_SATISFIABLE]:"请求 range 不正确,请稍后再试",[AL.NETWORK_PROTOCOL]:"请求协议错误,请使用 https 地址访问",[AL.NETWORK_URL_EXPIRE]:"视频地址已过期",[AL.NETWORK_URL_SIGN]:"视频地址签名错误,请检查地址是否正确",[AL.NETWORK_ENCRYPT_HLS_ERR]:"m3u8 文件或密钥获取失败",[AL.MEDIA_ERR]:"播放错误",[AL.MEDIA_ERR_ABORTED]:"播放被用户或浏览器取消",[AL.MEDIA_ERR_NETWORK]:"网络错误",[AL.MEDIA_ERR_DECODE]:"解码错误",[AL.MEDIA_ERR_SRC_NOT_SUPPORTED]:"音/视频格式不支持或地址不可用",[AL.MEDIA_ERR_NOT_SUPPORTED]:"不支持的视频格式",[AL.MEDIA_ERR_URL_EMPTY]:"视频地址为空",[AL.MEDIA_ERR_FILE_NOT_SUPPORTED]:"视频文件当前浏览器环境下不支持",[AL.MEDIA_ERR_PLAY_ERR]:"视频播放错误",[AL.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"不支持的视频类型",[AL.BUSINESS_DRM_NOT_SUPPORT]:"DRM加密播放不支持",[AL.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"不支持防录屏",[AL.BUSINESS_DRM_LACK_MEDIA_KEY]:"视频数据缺少相应 MediaKey",[AL.BUSINESS_DRM_LACK_KEY_SESSION]:"浏览器不支持相应 DRM KeySession",[AL.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"解密播放错误",[AL.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"缺少 DRM 证书请求链接",[AL.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"缺少 DRM License 请求链接",[AL.BUSINESS_DRM_LICENSE_FAIL]:"请求或更新 License 失败",[AL.BUSINESS_DRM_KEY_ERROR]:"解密错误",[AL.BUSINESS_DRM_CERT_FAIL]:"请求DRM证书失败",[AL.PRIVATE_DRM_KEY_GET_FAILED]:"私有加密密钥解析失败",[AL.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"当前浏览器不支持Crypto API,请使用https环境访问",[AL.PRIVATE_DRM_RSA_FAIL]:"解密错误,请检查playAuthId是否正确",[AL.OTHER]:"其他错误",[AL.VOD_LOG_NOT_CONFIGURED]:"未正确配置质量日志参数",[AL.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthToken 已过期",[AL.HLS_KEY_TOKEN_EXPIRED]:"keyToken 已过期",[AL.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthToken 已过期",[AL.GET_PLAY_INFO_ERR]:"获取媒体信息失败",[AL.GET_HLS_DECRYPTION_KEY_ERR]:"获取 HLS 密钥失败",[AL.LICENSE_VALIDATE_FAIL]:"license 校验失败",[AL.DEFINITION_AUTO]:"自动",[AL.LICENSE_STATUS_INVALID]:"license 校验无效",[AL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"license 域名不匹配",[AL.BASE_LICENSE_NOT_SUPPORT_265]:"基础版license 不支持H265",[AL.BASE_LICENSE_NOT_SUPPORT_ABR]:"基础版license 不支持自适应码率",[AL.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"基础版license 不支持动态Buffer",[AL.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"基础版license 不支持预加载",[AL.EXPIRED_LICENSE_NOT_SUPPORT_265]:"已过期版license 不支持H265",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"已过期版license 不支持自适应码率",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"已过期版license 不支持动态Buffer",[AL.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"已过期版license 不支持预加载",[AL.DRAMA_INVALID_PARAM]:"参数错误",[AL.DRAMA_NO_INFO_FOUND]:"未查询到该剧集信息",[AL.DRAMA_NOT_SUBMITTED]:"剧集未送审",[AL.DRAMA_UNDER_REVIEW]:"剧集审核中",[AL.DRAMA_FAILED_REVIEW]:"剧集审核不通过",[AL.DRAMA_WITHDRAWN_REVIEW]:"剧集审核撤回",[AL.DRAMA_FAILED_TO_QUERY]:"查询视频播放信息失败",[AL.DRAMA_INVALID_TTOP_TOKEN]:"播放凭证无效或TTOP签名验证失败",[AL.DRAMA_NOT_ON_SHELF]:"视频未上架",[AL.DRAMA_FAILED_GET_EPISODE_INFO]:"查询剧集信息失败"},GU={[AL.NETWORK]:"ネットワークエラー",[AL.NETWORK_TIMEOUT]:"ネットワークタイムアウト",[AL.NETWORK_FORBIDDEN]:"動画のURLへのアクセスが禁止されています。ドメインアクセス制御を確認してください",[AL.NETWORK_NOTFOUND]:"動画が存在しません。動画アドレスが正しいか確認してください",[AL.NETWORK_RANGE_NOT_SATISFIABLE]:"リクエスト範囲が正しくありません。後でもう一度お試しください",[AL.NETWORK_PROTOCOL]:"リクエストプロトコルエラー。httpsアドレスを使用してアクセスしてください",[AL.NETWORK_URL_EXPIRE]:"動画のURLは期限切れです",[AL.NETWORK_URL_SIGN]:"動画のURL署名エラー。アドレスが正しいか確認してください",[AL.NETWORK_ENCRYPT_HLS_ERR]:"m3u8 ファイルまたはキーの取得に失敗しました",[AL.MEDIA_ERR]:"再生エラー",[AL.MEDIA_ERR_ABORTED]:"再生がユーザーまたはブラウザによってキャンセルされました",[AL.MEDIA_ERR_NETWORK]:"ネットワークエラー",[AL.MEDIA_ERR_DECODE]:"デコードエラー",[AL.MEDIA_ERR_SRC_NOT_SUPPORTED]:"音声/動画フォーマットがサポートされていないか、アドレスが利用できません",[AL.MEDIA_ERR_NOT_SUPPORTED]:"サポートされていない動画フォーマット",[AL.MEDIA_ERR_URL_EMPTY]:"動画のURLが空です",[AL.MEDIA_ERR_FILE_NOT_SUPPORTED]:"動画ファイルは現在のブラウザ環境でサポートされていません",[AL.MEDIA_ERR_PLAY_ERR]:"動画再生エラー",[AL.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"サポートされていない動画の種類",[AL.BUSINESS_DRM_NOT_SUPPORT]:"DRM暗号化再生はサポートされていません",[AL.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"録画防止はサポートされていません",[AL.BUSINESS_DRM_LACK_MEDIA_KEY]:"動画データに対応するMediaKeyが不足しています",[AL.BUSINESS_DRM_LACK_KEY_SESSION]:"ブラウザが対応するDRM KeySessionをサポートしていません",[AL.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"復号再生エラー",[AL.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"DRM証明書リクエストリンクが不足しています",[AL.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"DRMライセンスリクエストリンクが不足しています",[AL.BUSINESS_DRM_LICENSE_FAIL]:"ライセンスのリクエストまたは更新に失敗しました",[AL.BUSINESS_DRM_KEY_ERROR]:"復号エラー",[AL.BUSINESS_DRM_CERT_FAIL]:"DRM証明書のリクエストに失敗しました",[AL.PRIVATE_DRM_KEY_GET_FAILED]:"プライベートDRMキーの取得に失敗しました",[AL.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"現在のブラウザはCrypto APIをサポートしていません。アクセスするにはhttps環境を使用してください",[AL.PRIVATE_DRM_RSA_FAIL]:"復号化エラー。playAuthIdが正しいかどうかを確認してください",[AL.OTHER]:"その他のエラー",[AL.VOD_LOG_NOT_CONFIGURED]:"品質ログパラメータが正しく設定されていません",[AL.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthTokenが期限切れです",[AL.HLS_KEY_TOKEN_EXPIRED]:"keyTokenが期限切れです",[AL.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthTokenが期限切れです",[AL.GET_PLAY_INFO_ERR]:"動画情報の取得に失敗しました",[AL.GET_HLS_DECRYPTION_KEY_ERR]:"HLSキーの取得に失敗しました",[AL.LICENSE_VALIDATE_FAIL]:"ライセンスの検証に失敗しました",[AL.DEFINITION_AUTO]:"自動",[AL.LICENSE_STATUS_INVALID]:"ライセンス検証が無効です",[AL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"ライセンスドメイン名が一致しません",[AL.BASE_LICENSE_NOT_SUPPORT_265]:"基本ライセンスはH265をサポートしていません",[AL.BASE_LICENSE_NOT_SUPPORT_ABR]:"基本ライセンスはアダプティブビットレートをサポートしていません",[AL.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"基本ライセンスはダイナミックバッファをサポートしていません",[AL.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"基本ライセンスはプリロードをサポートしていません",[AL.EXPIRED_LICENSE_NOT_SUPPORT_265]:"期限切れのライセンスはH265をサポートしていません",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"期限切れのライセンスはアダプティブ ビットレートをサポートしていません",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"期限切れのライセンスは動的バッファをサポートしていません",[AL.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"期限切れのライセンスはプリロードをサポートしていません",[AL.DRAMA_INVALID_PARAM]:"パラメータが無効です",[AL.DRAMA_NO_INFO_FOUND]:"このエピソードの情報が見つかりません",[AL.DRAMA_NOT_SUBMITTED]:"エピソードは審査に提出されていません",[AL.DRAMA_UNDER_REVIEW]:"エピソードは審査中です",[AL.DRAMA_FAILED_REVIEW]:"エピソードは審査に不合格でした",[AL.DRAMA_WITHDRAWN_REVIEW]:"エピソードの審査が取り下げられました",[AL.DRAMA_FAILED_TO_QUERY]:"動画再生情報の取得に失敗しました",[AL.DRAMA_INVALID_TTOP_TOKEN]:"再生資格情報が無効か、TTOP署名の検証に失敗しました",[AL.DRAMA_NOT_ON_SHELF]:"動画は未公開です",[AL.DRAMA_FAILED_GET_EPISODE_INFO]:"エピソード情報の取得に失敗しました"},WU=[{LANG:"en",TEXT:VU},{LANG:"zh",TEXT:KU},{LANG:"zh-hk",TEXT:{[AL.NETWORK]:"網路錯誤",[AL.NETWORK_TIMEOUT]:"網路逾時",[AL.NETWORK_FORBIDDEN]:"視頻地址禁止訪問,請檢查域名訪問控制",[AL.NETWORK_NOTFOUND]:"視頻不存在,請檢查視訊地址是否正確",[AL.NETWORK_RANGE_NOT_SATISFIABLE]:"請求範圍不正確,請稍後再試",[AL.NETWORK_PROTOCOL]:"請求協議錯誤,請使用 https 地址訪問",[AL.NETWORK_URL_EXPIRE]:"視頻地址已過期",[AL.NETWORK_URL_SIGN]:"視頻地址簽名錯誤,請檢查地址是否正確",[AL.NETWORK_ENCRYPT_HLS_ERR]:"m3u8 檔案或金鑰取得失敗",[AL.MEDIA_ERR]:"播放錯誤",[AL.MEDIA_ERR_ABORTED]:"播放被用戶或瀏覽器取消",[AL.MEDIA_ERR_NETWORK]:"網路錯誤",[AL.MEDIA_ERR_DECODE]:"解碼錯誤",[AL.MEDIA_ERR_SRC_NOT_SUPPORTED]:"音/視頻格式不支援或地址不可用",[AL.MEDIA_ERR_NOT_SUPPORTED]:"不支援的視頻格式",[AL.MEDIA_ERR_URL_EMPTY]:"視頻地址為空",[AL.MEDIA_ERR_FILE_NOT_SUPPORTED]:"視頻文件在當前瀏覽器環境下不支援",[AL.MEDIA_ERR_PLAY_ERR]:"視頻播放錯誤",[AL.MEDIA_SOURCE_CANNOT_PLAY_TYPE]:"不支援的視頻類型",[AL.BUSINESS_DRM_NOT_SUPPORT]:"不支援 DRM 加密播放",[AL.BUSINESS_DRM_NOT_SUPPORT_UN_RECORD]:"不支援防錄屏",[AL.BUSINESS_DRM_LACK_MEDIA_KEY]:"視頻數據缺少相應 MediaKey",[AL.BUSINESS_DRM_LACK_KEY_SESSION]:"瀏覽器不支援相應 DRM KeySession",[AL.BUSINESS_DRM_GENERATE_REQUEST_FAIL]:"解密播放錯誤",[AL.BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH]:"缺少 DRM 證書請求鏈接",[AL.BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH]:"缺少 DRM License 請求鏈接",[AL.BUSINESS_DRM_LICENSE_FAIL]:"請求或更新 License 失敗",[AL.BUSINESS_DRM_KEY_ERROR]:"解密錯誤",[AL.BUSINESS_DRM_CERT_FAIL]:"請求 DRM 證書失敗",[AL.PRIVATE_DRM_KEY_GET_FAILED]:"私有加密金鑰解析失敗",[AL.PRIVATE_DRM_CRYPTO_NOT_SUPPORT]:"目前瀏覽器不支援Crypto API,請使用https環境訪問",[AL.PRIVATE_DRM_RSA_FAIL]:"解密錯誤,請檢查playAuthId是否正確",[AL.OTHER]:"其他錯誤",[AL.VOD_LOG_NOT_CONFIGURED]:"未正確配置質量日誌參數",[AL.PLAY_AUTH_TOKEN_EXPIRED]:"playAuthToken 已過期",[AL.HLS_KEY_TOKEN_EXPIRED]:"keyToken 已過期",[AL.THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED]:"thirdPartyDrmAuthToken 已過期",[AL.GET_PLAY_INFO_ERR]:"獲取視頻信息失敗",[AL.GET_HLS_DECRYPTION_KEY_ERR]:"獲取 HLS 密鑰失敗",[AL.LICENSE_VALIDATE_FAIL]:"license 校驗失敗",[AL.DEFINITION_AUTO]:"自動",[AL.LICENSE_STATUS_INVALID]:"license 校驗無效",[AL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH]:"license 域名不匹配",[AL.BASE_LICENSE_NOT_SUPPORT_265]:"基礎版license 不支援H265",[AL.BASE_LICENSE_NOT_SUPPORT_ABR]:"基礎版license 不支援自適應碼率",[AL.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"基礎版license 不支援動態Buffer",[AL.BASE_LICENSE_NOT_SUPPORT_PRELOAD]:"基礎版license 不支援預載入",[AL.EXPIRED_LICENSE_NOT_SUPPORT_265]:"已過期版license 不支援H265",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ABR]:"已過期版license 不支援自適應碼率",[AL.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER]:"已過期版license 不支援動態Buffer",[AL.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD]:"已過期版license 不支援預載入",[AL.DRAMA_INVALID_PARAM]:"參數錯誤",[AL.DRAMA_NO_INFO_FOUND]:"未查詢到該劇集資訊",[AL.DRAMA_NOT_SUBMITTED]:"劇集未送審",[AL.DRAMA_UNDER_REVIEW]:"劇集審核中",[AL.DRAMA_FAILED_REVIEW]:"劇集審核不通過",[AL.DRAMA_WITHDRAWN_REVIEW]:"劇集審核撤回",[AL.DRAMA_FAILED_TO_QUERY]:"查詢視頻播放資訊失敗",[AL.DRAMA_INVALID_TTOP_TOKEN]:"播放憑證無效或TTOP簽名驗證失敗",[AL.DRAMA_NOT_ON_SHELF]:"影片未上架",[AL.DRAMA_FAILED_GET_EPISODE_INFO]:"查詢劇集資訊失敗"}},{LANG:"jp",TEXT:GU}],YU="ignoreServicePreloadConfigEnable";class zU extends Error{constructor(e,t){super(t),this.code=e}}const $U=new Map;function XU(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qU(e){return!!(e&&uU(e)&&cU(e))}function QU(e){var t;return!!(null==(t=null==e?void 0:e.getVideoByToken)?void 0:t.playAuthToken)}function ZU(e,t){return e instanceof zU?e:new zU(t.code,t.message)}function JU(e,t,i){const n=`${t.cacheOptions.moduleName}:${t.cacheOptions.cacheKey}`,r=$U.get(n);if(r)return r;const o="ttDrama"===t.kind?function(e,t){const i=uU(t),n=cU(t);if(!(null==e?void 0:e.getDramaInfo)||!i||!n){const e=LL.INVALID_PARAM;return Promise.reject(new zU(e.code,e.message))}const r={clientKey:e.clientKey,albumId:i,episodeId:n,vid:t.vid||""};return iU(e)&&XU(t,"transcodeParam")&&(r.transcodeParam=eU(t.transcodeParam)||{}),new Promise(((i,n)=>{try{e.getDramaInfo((r=>{var o,s,a,l;try{if(!(null==r?void 0:r.is_success)){const e=rU(null==(o=null==r?void 0:r.error)?void 0:o.error_msg,void 0),t=LL[e];return void n(new zU(t.code,t.message))}if((null==(s=r.data)?void 0:s.status)!==RL.SUCCESS){const e=nU(null==(a=r.data)?void 0:a.status),t=LL[e];return void n(new zU(t.code,t.message))}if(!(null==(l=r.data)?void 0:l.video_info)){const e=LL.FAILED_TO_QUERY;return void n(new zU(e.code,e.message))}const u=_U(r.data.video_info,mU(t,e));if(!wM(u)){const e=LL.FAILED_TO_QUERY;return void n(new zU(e.code,e.message))}i(u)}catch(oF){n(ZU(oF,LL.FAILED_GET_EPISODE_INFO))}}),r)}catch(oF){n(ZU(oF,LL.FAILED_GET_EPISODE_INFO))}}))}(i,e):function(e,t){return d(this,null,(function*(){const i=mU(e,t);try{const e=ya(i.playAuthToken);if(_a(e)){const e=PL.PLAY_AUTH_TOKEN_EXPIRED;throw new zU(e.code,e.message)}const t=yield Ta(i);if(!wM(t))throw new zU(PL.GET_PLAY_INFO_ERR.code,PL.GET_PLAY_INFO_ERR.message);return t}catch(oF){throw ZU(oF,PL.GET_PLAY_INFO_ERR)}}))}(e,i);$U.set(n,o);const s=()=>{$U.get(n)===o&&$U.delete(n)};return o.then(s,s),o}function eB(e,t){return d(this,null,(function*(){try{const i=function(e,t){if(qU(e)&&!0===(null==t?void 0:t.canIUseGetDramaInfo)){const i=hU(e,t);return{kind:"ttDrama",cacheOptions:{moduleName:_M,cacheKey:dU(i),cacheKeyInfo:pU(i)}}}if(QU(e)){const t=vU(e);return{kind:"playAuthToken",cacheOptions:{moduleName:mM,cacheKey:LM(t),cacheKeyInfo:RM(t)}}}if(qU(e)){const e=LL.INVALID_PARAM;throw new zU(e.code,e.message)}throw new zU(8e3,"Unsupported media info source")}(e,t),n=function(e,t,i){const n=GM(t.cacheOptions);return n||("ttDrama"===t.kind?fU(hU(e,i)):yU(e))}(e,i,t);if(n)return{status:"fulfilled",source:e,data:n,fromCache:!0};const r=yield JU(e,i,t);return WM(i.cacheOptions,r),{status:"fulfilled",source:e,data:r,fromCache:!1}}catch(oF){const i=ZU(oF,PL.OTHER);return{status:"rejected",source:e,error:{code:i.code,message:i.message}}}}))}function tB(e,t){const i=mU(e,t);return i.playAuthToken?Ta(i).catch((()=>{})):Promise.resolve(void 0)}function iB(e,t){return d(this,null,(function*(){if(t&&!t.canIUseGetDramaInfo)return nB(e,t);const i=function(e,t){const i=fU(hU(e,t));return i?TU(i,e):void 0}(e,t);if(i)return IU(i);if(!(null==t?void 0:t.canIUseGetDramaInfo))return nB(e,t);const n=yield function(e,t){const i=uU(t),n=cU(t);if(!i||!n)return Promise.resolve(void 0);if(!(null==e?void 0:e.canIUseGetDramaInfo))return tB(t,e);if(!e.getDramaInfo)return Promise.resolve(void 0);const r={clientKey:e.clientKey,albumId:i,episodeId:n,vid:t.vid||""};return iU(e)&&XU(t,"transcodeParam")&&(r.transcodeParam=eU(t.transcodeParam)||{}),new Promise((i=>{try{e.getDramaInfo((n=>{try{if(!(null==n?void 0:n.is_success))return aa.error("[ttdrama] getDramaInfo invalid response",n),void i(void 0);const{data:r}=n;if((null==r?void 0:r.status)!==RL.SUCCESS||!(null==r?void 0:r.video_info))return aa.error("[ttdrama] getDramaInfo invalid response",n),void i(void 0);const o=_U(r.video_info,mU(t,e));i(o)}catch(r){aa.error("[ttdrama] getDramaInfo invalid response",n),i(void 0)}}),r)}catch(n){aa.error("[ttdrama] getDramaInfo call failed",n),i(void 0)}}))}(t,e);return n?(gU(hU(e,t),n),IU(TU(n,e))):void 0}))}function nB(e,t){return d(this,null,(function*(){const i=function(e){const t=yU(e);return t?TU(t,e):void 0}(e);if(i)return IU(i);const n=yield tB(e,t);var r;return n?(r=n,QM(vU(e),r),IU(TU(n,e))):void 0}))}function rB(e,t){return d(this,null,(function*(){if(EU(e.url))return e;if(qU(e)){const i=yield iB(e,t);return i||t||QU(e)?i:e}return QU(e)?nB(e,t):e}))}function oB(e,t){return d(this,null,(function*(){if(!(null==e?void 0:e.length))return e||[];let i;if(Kr.os.isAndroid&&!(null==t?void 0:t.canAndroidBatchGetDramaInfo)){i=[];for(const n of e)i.push(yield rB(n,t))}else i=yield Promise.all(e.map((e=>rB(e,t))));return i.filter(Boolean)}))}const sB=["live","rtm","music","danmu","ad"],aB=["configs","options","defaultConfig","current"],lB=["url","src","playUrl","playURL"],uB=["plugins","sdkPlugins","strategiesPlugins","presets"];class cB extends Error{constructor(e){var t;super(`[VEPLAYER_LITE_UNSUPPORTED_FEATURE] ${e} 功能不受精简版支持,请改用 ${function(e){const t=(e||"").toUpperCase();return t.includes("BYTEPLUS")?"@byteplus/veplayer":t.includes("VOLCENGINE")?"@volcengine/veplayer":"@byted-vcloud/veplayer"}("undefined"==typeof process||null==(t=process.env)?void 0:t.LUX_REGION)}。`),this.code="VEPLAYER_LITE_UNSUPPORTED_FEATURE",this.name="VePlayerLiteUnsupportedFeatureError",this.feature=e,Object.setPrototypeOf(this,cB.prototype)}}class hB extends Error{constructor(){super("[VEPLAYER_LITE_UNSUPPORTED_ENVIRONMENT] 当前环境不支持 Lite 版本使用"),this.code="VEPLAYER_LITE_UNSUPPORTED_ENVIRONMENT",this.name="VePlayerLiteUnsupportedEnvironmentError",Object.setPrototypeOf(this,hB.prototype)}}function dB(e){return"object"==typeof e&&null!==e||"function"==typeof e}function pB(e,t){if(dB(e))try{return e[t]}catch(i){return}}function fB(e){try{return Array.isArray(e)}catch(t){return!1}}function gB(e){if(!fB(e))return[];const t=pB(e,"length");if("number"!=typeof t||t<0||t>4294967295||Math.floor(t)!==t)return[];const i=[];for(let n=0;n<t;n+=1)i.push(pB(e,String(n)));return i}function yB(e){return null!=e&&!1!==e}function vB(e){return"string"==typeof e?e.toLowerCase():""}function mB(e){return"string"==typeof e&&e.split(/[?#]/,1)[0].toLowerCase().endsWith(".sdp")}function _B(e){return lB.some((t=>function(e){const t=[e],i=new WeakSet;for(let n=0;n<t.length;n+=1){const e=t[n];if(mB(e))return!0;if(dB(e)&&!i.has(e))if(i.add(e),fB(e))for(const i of gB(e))t.push(i);else for(const i of lB)t.push(pB(e,i))}return!1}(pB(e,t))))}function EB(e){if("string"==typeof e)return[e];if(!dB(e))return[];const t=[],i=pB(e,"pluginName"),n=pB(e,"name");return"string"==typeof i&&t.push(i),"string"==typeof n&&t.push(n),t}function TB(e,t){return uB.some((i=>gB(pB(e,i)).some((e=>function(e){const t=EB(e);return t.push(...EB(pB(e,"plugin"))),t.push(...EB(pB(e,"preset"))),t}(e).some((e=>function(e,t){const{compact:i,parts:n}=function(e){const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().replace(/[\s_]+/g,"-").replace(/-+/g,"-");return{compact:t.replace(/-/g,""),parts:t.split("-")}}(t);switch(e){case"live":return"timeshiftplugin"===i||"liveinfopanel"===i||i.startsWith("livesubtitles");case"rtm":return"rtm"===i||"rtmplugin"===i;case"music":return i.includes("music");case"danmu":return i.includes("danmu");case"ad":return n.some((e=>"ad"===e||"ads"===e))||["ad","ads","adplugin","adsplugin"].includes(i)}}(t,e)))))))}function SB(e,t){switch(t){case"live":return!0===pB(e,"isLive")||"live"===vB(pB(e,"type"))||yB(pB(e,"TimeShiftPlugin"))||yB(pB(e,"LiveInfoPanel"))||yB(pB(e,"LiveSubtitlesPlugin"))||yB(pB(e,"LiveSubtitlesIconPlugin"));case"rtm":return"rtm"===vB(pB(e,"streamType"))||yB(pB(e,"rtm"))||_B(e);case"music":return!0===pB(e,"isMusic")||yB(pB(e,"music"));case"danmu":{const t=pB(e,"getVideoByToken");return yB(pB(e,"DanmuPlugin"))||!0===pB(e,"needBarrageMask")||!0===pB(t,"needBarrageMask")}case"ad":return yB(pB(e,"AdsPlugin"))||yB(pB(e,"AdPlugin"))}}function bB(e){const t=function(e){const t=[],i=[e],n=new WeakSet;for(let r=0;r<i.length;r+=1){const e=i[r];if(dB(e)&&!n.has(e)){n.add(e),t.push(e);for(const t of aB)i.push(pB(e,t));for(const t of gB(pB(e,"playList")))i.push(t)}}return t}(e);for(const i of sB)if(t.some((e=>SB(e,i)||TB(e,i))))throw new cB(i)}const kB=()=>Ur.generateSessionId(),CB=e=>"number"==typeof e&&Number.isFinite(e)&&e>=0?e:0,IB=e=>u({},e),AB=(e,t)=>t.lastEnteredPlayingAt-e.lastEnteredPlayingAt||t.sequence-e.sequence,PB=(e,t)=>t.lastPlaybackAt-e.lastPlaybackAt||t.sequence-e.sequence,wB=(e,t)=>t.createdAt-e.createdAt||t.sequence-e.sequence,DB=(e,t,i="creating")=>({playbackSessionId:t,playbackState:i,isEnded:!1,isPaused:!1,isBeforePlayerCreate:!0,albumId:e.albumId,episodeId:e.episodeId,duration:0,currentTime:0});const LB=new class{constructor(e=Date.now,t=kB){this.now=e,this.createPlaybackSessionId=t,this.sessions=new Map,this.transactionResolvers=new WeakMap,this.historical=null,this.sequence=0}register(e,t){const i=this.now(),n=++this.sequence,r=this.createPlaybackSessionId();this.sessions.set(e,{vePlayer:e,playbackSessionId:r,pendingPlaybackSessionId:null,identity:u({},t),pendingIdentity:null,identitySwitchCore:null,pendingTransaction:null,identitySwitchArmed:!1,identitySwitchIsSameCore:!1,useStableSnapshot:!1,core:null,state:"creating",creationFailed:!1,hasEverPlayed:!1,isBuffering:!1,createdAt:i,lastEnteredPlayingAt:0,lastPlaybackAt:0,sequence:n,lastStableSnapshot:DB(t,r)})}has(e){return this.sessions.has(e)}getPlaybackSessionId(e){var t,i;return null!=(i=null==(t=this.sessions.get(e))?void 0:t.playbackSessionId)?i:null}beginCoreCreate(e,t){const i=this.sessions.get(e);i&&(!this.matchesPendingTransaction(i,t)&&i.pendingTransaction||(i.core=null,i.state="creating",i.creationFailed=!1,i.isBuffering=!1,this.matchesPendingTransaction(i,t)&&(i.identitySwitchCore=null,i.identitySwitchArmed=!1,i.identitySwitchIsSameCore=!1)))}failCoreCreate(e,t){const i=this.sessions.get(e);i&&(!this.matchesPendingTransaction(i,t)&&i.pendingTransaction||(i.core=null,i.state="error",i.creationFailed=!0,i.isBuffering=!1,this.matchesPendingTransaction(i,t)&&this.rollbackIdentitySwitch(e,t)))}attachCore(e,t,i){var n;const r=this.sessions.get(e);if(r&&(this.matchesPendingTransaction(r,i)||!r.pendingTransaction)){r.core=t,r.state="ready",r.creationFailed=!1,r.isBuffering=!1,this.matchesPendingTransaction(r,i)&&(r.identitySwitchCore=t,r.identitySwitchArmed=!0,r.identitySwitchIsSameCore=!1);for(const i of["play","playing","waiting","canplay","timeupdate","pause","ended","error"])null==(n=t.on)||n.call(t,i,(()=>this.handleCoreEvent(e,t,i)))}}handleCoreEvent(e,t,i){const n=this.sessions.get(e);if(n&&n.core===t&&("error"!==i&&"canplay"!==i||!n.pendingTransaction||n.identitySwitchArmed||n.identitySwitchCore!==t)){if("play"===i||"playing"===i){const e="playing"!==n.state,t=this.now();return n.hasEverPlayed=!0,n.isBuffering=!1,n.state="playing",n.lastPlaybackAt=t,void(e&&(n.lastEnteredPlayingAt=t))}if("waiting"!==i){if(n.isBuffering=!1,"canplay"===i)return n.pendingTransaction?n.identitySwitchArmed&&n.identitySwitchCore===t&&this.commitIdentitySwitch(e,n.pendingTransaction):(n.useStableSnapshot=!1,n.lastStableSnapshot=null),void(n.hasEverPlayed||(n.state="ready"));if("timeupdate"!==i)if("pause"!==i){if("ended"===i)return n.hasEverPlayed=!0,n.lastPlaybackAt=this.now(),void(n.state="ended");n.state="error",n.pendingTransaction&&n.identitySwitchArmed&&n.identitySwitchCore===t&&this.rollbackIdentitySwitch(e,n.pendingTransaction)}else n.hasEverPlayed&&(n.lastPlaybackAt=this.now(),n.state="paused");else n.hasEverPlayed&&(n.lastPlaybackAt=this.now(),n.state=t.paused?"paused":"playing")}else n.hasEverPlayed&&(n.isBuffering=!0,n.state="buffering")}}beginIdentitySwitch(e,t,i,n=!1,r){const o=this.sessions.get(e);if(!o)return null;if(!!o.pendingIdentity||!!o.pendingPlaybackSessionId){if(!this.matchesPendingTransaction(o,r))return null}else o.lastStableSnapshot=this.snapshotSession(o,null!=i?i:o.core).snapshot,o.identitySwitchCore=null!=i?i:o.core,o.identitySwitchArmed=!1,o.identitySwitchIsSameCore=!0,o.pendingTransaction=this.createIdentitySwitchTransaction();return o.pendingIdentity=u({},t),n&&!o.pendingPlaybackSessionId&&(o.pendingPlaybackSessionId=this.createPlaybackSessionId()),o.useStableSnapshot=!0,o.pendingTransaction}armIdentitySwitch(e,t,i){const n=this.sessions.get(e);return!(!n||n.core!==i||!this.matchesPendingTransaction(n,t))&&(n.identitySwitchCore=i,n.identitySwitchArmed=!0,n.identitySwitchIsSameCore=!0,!0)}hasActiveIdentitySwitch(e){var t;return!!(null==(t=this.sessions.get(e))?void 0:t.pendingTransaction)}commitIdentitySwitch(e,t){const i=this.sessions.get(e);if(!i||!i.pendingIdentity&&!i.pendingPlaybackSessionId||!this.matchesPendingTransaction(i,t))return;i.pendingIdentity&&(i.identity=i.pendingIdentity),i.pendingPlaybackSessionId&&(i.playbackSessionId=i.pendingPlaybackSessionId),i.pendingIdentity=null,i.pendingPlaybackSessionId=null,i.identitySwitchCore=null,i.identitySwitchArmed=!1,i.identitySwitchIsSameCore=!1;const n=i.pendingTransaction;i.pendingTransaction=null,i.useStableSnapshot=!1,i.lastStableSnapshot=null,this.settleTransaction(n)}rollbackIdentitySwitch(e,t){const i=this.sessions.get(e);if(!i||!this.matchesPendingTransaction(i,t))return;const n=!i.identitySwitchIsSameCore&&!!i.core&&i.core===i.identitySwitchCore,r=i.identitySwitchIsSameCore&&!!i.core&&i.core===i.identitySwitchCore;i.pendingIdentity=null,i.pendingPlaybackSessionId=null,i.identitySwitchCore=null,i.identitySwitchArmed=!1,i.identitySwitchIsSameCore=!1;const o=i.pendingTransaction;i.pendingTransaction=null,i.useStableSnapshot=!r&&!!i.lastStableSnapshot,r&&(i.lastStableSnapshot=null),n&&(i.core=null),this.settleTransaction(o)}destroy(e,t){const i=this.sessions.get(e);if(!i)return;const n=i.useStableSnapshot&&i.lastStableSnapshot?this.rank(i,IB(i.lastStableSnapshot)):this.snapshotSession(i,null!=t?t:i.core);n.snapshot=c(u({},n.snapshot),{playbackState:"destroyed",isBeforePlayerCreate:!1}),n.state="destroyed",this.settleTransaction(i.pendingTransaction),this.sessions.delete(e),n.hasEverPlayed&&(!this.historical||PB(n,this.historical)<0)&&(this.historical=n)}query(e){const t=[];for(const s of this.sessions.values()){if((s.pendingIdentity||s.pendingPlaybackSessionId||s.useStableSnapshot)&&s.lastStableSnapshot){t.push(this.rank(s,IB(s.lastStableSnapshot)));continue}const i=e.find((e=>e===s.core&&e.sdk===s.vePlayer));try{const e=this.snapshotSession(s,null!=i?i:null);s.lastStableSnapshot=IB(e.snapshot),t.push(e)}catch(o){s.lastStableSnapshot&&t.push(this.rank(s,IB(s.lastStableSnapshot)))}}const i=t.filter((e=>"playing"===e.state||"buffering"===e.state)).sort(AB)[0];if(i)return IB(i.snapshot);const n=t.filter((e=>e.hasEverPlayed)).concat(this.historical?[this.historical]:[]).sort(PB)[0];if(n)return IB(n.snapshot);const r=t.sort(wB)[0];return r?IB(r.snapshot):null}resetForTests(){this.sessions.clear(),this.historical=null,this.sequence=0}createIdentitySwitchTransaction(){let e;const t={settled:new Promise((t=>{e=t}))};return this.transactionResolvers.set(t,e),t}settleTransaction(e){if(!e)return;const t=this.transactionResolvers.get(e);t&&(this.transactionResolvers.delete(e),t())}matchesPendingTransaction(e,t){return!!t&&e.pendingTransaction===t}snapshotSession(e,t){if(!t){const t=e.creationFailed?"error":"creating";return this.rank(e,DB(e.identity,e.playbackSessionId,t))}const i=!!t.paused,n=!!t.ended;let r;return r=t.isError||"error"===e.state?"error":n||"ended"===e.state?"ended":e.hasEverPlayed&&i?"paused":e.hasEverPlayed&&e.isBuffering?"buffering":e.hasEverPlayed?"playing":"ready",this.rank(e,{playbackSessionId:e.playbackSessionId,playbackState:r,isEnded:n,isPaused:i,isBeforePlayerCreate:!1,albumId:e.identity.albumId,episodeId:e.identity.episodeId,duration:CB(t.duration),currentTime:CB(t.currentTime)})}rank(e,t){return{snapshot:t,state:t.playbackState,hasEverPlayed:e.hasEverPlayed,createdAt:e.createdAt,lastEnteredPlayingAt:e.lastEnteredPlayingAt,lastPlaybackAt:e.lastPlaybackAt,sequence:e.sequence}}},RB=e=>{if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"!=typeof e||""===e.trim())return;const t=Number(e);return Number.isFinite(t)?t:void 0},xB=e=>"string"==typeof e&&e.trim()?e.trim().toLowerCase():void 0,OB=(...e)=>e.find((e=>null!=e)),NB=e=>({index:e.index,stableId:xB(e.stableId),bitrate:RB(e.bitrate),width:RB(e.width),height:RB(e.height),videoCodec:xB(e.videoCodec),videoRange:xB(e.videoRange),frameRate:RB(e.frameRate)});function MB(e,t){const i=(e=>({stableId:xB(e.stableId),bitrate:RB(OB(e.bitrate,e.Bitrate,e.bandwidth,e.Bandwidth)),width:RB(OB(e.width,e.Width)),height:RB(OB(e.height,e.Height)),videoCodec:xB(OB(e.videoCodec,e.codec,e.Codec)),videoRange:xB(OB(e.videoRange,e.VideoRange)),frameRate:RB(OB(e.frameRate,e.FrameRate))}))(e),n=t.map(NB);if(i.stableId){const e=n.filter((e=>e.stableId===i.stableId));if(1===e.length)return{matched:!0,levelIndex:e[0].index,strategy:"stable-id"};if(e.length>1)return{matched:!1,reason:"AMBIGUOUS_ATTRIBUTES"}}if(void 0===i.bitrate)return{matched:!1,reason:"NO_MATCH"};const r=["width","height","videoCodec","videoRange","frameRate"].filter((e=>void 0!==i[e]));if(r.length>0){const e=n.filter((e=>e.bitrate===i.bitrate&&r.every((t=>e[t]===i[t]))));return 1===e.length?{matched:!0,levelIndex:e[0].index,strategy:"attributes"}:e.length>1?{matched:!1,reason:"AMBIGUOUS_ATTRIBUTES"}:{matched:!1,reason:"NO_MATCH"}}const o=n.filter((e=>e.bitrate===i.bitrate));return 1===o.length?{matched:!0,levelIndex:o[0].index,strategy:"unique-bitrate"}:o.length>1?{matched:!1,reason:"AMBIGUOUS_BITRATE"}:{matched:!1,reason:"NO_MATCH"}}const UB="hlsManifestLoading",BB="hlsManifestParsed",HB="hlsLevelsUpdated",FB="hlsLevelSwitching",jB="hlsLevelSwitched",VB=e=>({playbackSessionId:e,ready:!1,levels:[],currentLevel:-1,loadLevel:-1,nextLevel:-1,manualLevel:-1,autoLevelEnabled:!1,autoLevelCapping:-1}),KB=e=>({playbackSessionId:e,playbackEngine:"none",configuredEngine:null,engine:"none",decisionSource:"none",available:!1,active:!1,mode:"auto",reason:"NOT_HLS",capabilities:{levelList:!1,manualLevelSwitch:!1,restoreAuto:!1,levelCap:!1,bitrateCap:!1,definitionCap:!1}}),GB=e=>c(u({},e),{capabilities:u({},e.capabilities)}),WB=e=>JSON.stringify({playbackSessionId:e.playbackSessionId,playbackEngine:e.playbackEngine,configuredEngine:e.configuredEngine,engine:e.engine,decisionSource:e.decisionSource,available:e.available,active:e.active,mode:e.mode,reason:e.reason,capabilities:e.capabilities}),YB=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0,zB=e=>e.map((e=>u({},e))),$B=(e,t)=>{const i=null!=t?t:e;return i&&"object"==typeof i?i:{}},XB=e=>{var t;return null!=(t=YB(e))?t:-1},qB=e=>e?u({},e):null,QB=e=>"string"==typeof e.definition&&e.definition.trim()?e.definition.trim():void 0,ZB=e=>{var t;return null!=(t=YB(e.bitrate))?t:YB(e.Bitrate)};class JB{constructor(e){this.options=e,this.runtime=null,this.hls=null,this.lastConfirmedLevel=-1,this.pendingManualLevel=null,this.suppressInternalSwitchingLevel=null,this.destroyed=!1,this.resolvedAbrSessionId="",this.lastEmittedAbrStateSignature="",this.abrLimit=null,this.onManifestLoading=()=>{this.ensureCurrentRuntime()&&(this.clearRuntimeAbrLimit(this.runtime),this.resetState(this.currentPlaybackSessionId()),this.emitLevelsUpdated())},this.onLevelsAvailable=(e,t)=>{var i;if(!this.ensureCurrentRuntime())return;const n=$B(e,t),r=Array.isArray(n.levels)?n.levels:null==(i=this.hls)?void 0:i.levels;this.updateLevels(null!=r?r:[]),this.emitLevelsUpdated(),this.refreshAbrState(!0)},this.onLevelSwitching=(e,t)=>{if(!this.ensureCurrentRuntime())return;const i=XB($B(e,t).level);i<0||i===this.suppressInternalSwitchingLevel||i===this.pendingManualLevel||this.emitLevelEvent(HD.HLS_LEVEL_SWITCHING,{playbackSessionId:this.currentPlaybackSessionId(),from:this.lastConfirmedLevel,to:i,reason:"abr",abrEngine:this.resolveAbrEngine(this.runtime),level:this.cloneLevel(i)})},this.onLevelSwitched=(e,t)=>{if(!this.ensureCurrentRuntime())return;const i=XB($B(e,t).level);if(i<0)return;const n=this.lastConfirmedLevel,r=this.pendingManualLevel===i?"manual":"abr";this.lastConfirmedLevel=i,this.syncRuntimeState(),this.state.currentLevel=i,"manual"===r&&(this.pendingManualLevel=null),this.emitLevelEvent(HD.HLS_LEVEL_SWITCHED,{playbackSessionId:this.currentPlaybackSessionId(),from:n,to:i,reason:r,abrEngine:this.resolveAbrEngine(this.runtime),level:this.cloneLevel(i)})};const t=this.currentPlaybackSessionId();this.state=VB(t),this.abrState=KB(t),this.listeners=[[UB,this.onManifestLoading],[BB,this.onLevelsAvailable],[HB,this.onLevelsAvailable],[FB,this.onLevelSwitching],[jB,this.onLevelSwitched]],this.refreshRuntime()}refreshRuntime(){if(this.destroyed)return;const e=this.options.getRuntime(),t=this.currentPlaybackSessionId();if(e.hls!==this.hls)return this.clearRuntimeAbrLimit(this.runtime),this.unbindHls(),this.runtime=e,this.hls="hlsjs"===e.playbackEngine?e.hls:null,this.resetState(t),this.bindHls(),this.hydrateCurrentLevels(),void(this.hls||this.refreshAbrState(!0));this.runtime=e,t!==this.state.playbackSessionId&&(this.clearRuntimeAbrLimit(e),this.resetState(t),this.hydrateCurrentLevels(),this.hls||this.refreshAbrState(!0))}getLevels(){return this.refreshRuntime(),zB(this.state.levels)}getLevelState(){return this.refreshRuntime(),c(u({},this.state),{levels:zB(this.state.levels)})}getAbrState(){return this.refreshRuntime(),GB(this.abrState)}setAbrMode(e){if(this.refreshRuntime(),"auto"!==e&&"manual"!==e)throw new sr("HLS_ABR_UNAVAILABLE","The requested HLS ABR mode is invalid.");if(!this.abrState.available||"native"===this.abrState.engine)throw new sr("HLS_ABR_UNAVAILABLE","HLS ABR mode control is unavailable for this playback session.");if(this.abrState.mode!==e){if("manual"===e)return this.disableCurrentAbrOwner(),this.abrState=c(u({},this.abrState),{mode:"manual",active:!1}),void this.emitAbrStateChange();this.enableResolvedAbrOwner(),this.abrState=c(u({},this.abrState),{mode:"auto",active:!0}),this.emitAbrStateChange()}}getAbrLimit(){return qB(this.abrLimit)}setAbrLimit(e){if(this.refreshRuntime(),!this.abrState.available||"native"===this.abrState.engine)throw new sr("HLS_ABR_UNAVAILABLE","HLS ABR limits are unavailable for this playback session.");const t=qB(e);if("hlsjs"===this.abrState.engine)this.applyHlsJsAbrLimit(t);else{if("veplayer"!==this.abrState.engine)throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","The resolved HLS ABR engine does not support limits.");this.applyVePlayerAbrLimit(t)}this.abrLimit=t,this.abrState.playbackSessionId&&this.options.emit(HD.HLS_ABR_LIMIT_CHANGE,{playbackSessionId:this.abrState.playbackSessionId,engine:this.abrState.engine,limit:qB(this.abrLimit)})}setLevel(e,t={}){var i;this.refreshRuntime();const n=this.runtime,r=this.hls;if(this.destroyed||"hlsjs"!==(null==n?void 0:n.playbackEngine)||!r)throw new sr("HLS_ENGINE_UNSUPPORTED","HLS Level control requires the hls.js playback engine.");const o=this.currentPlaybackSessionId();if(t.playbackSessionId&&t.playbackSessionId!==o)throw new sr("HLS_PLAYBACK_SESSION_EXPIRED","The HLS playback session has expired.");if(!this.state.ready)throw new sr("HLS_MANIFEST_NOT_READY","The HLS Level list is not ready.");if(!Number.isInteger(e)||e<0||e>=this.state.levels.length)throw new sr("HLS_LEVEL_OUT_OF_RANGE","The HLS Level index is out of range.");this.abrState.active&&this.disableCurrentAbrOwner(),("manual"!==this.abrState.mode||this.abrState.active)&&(this.abrState=c(u({},this.abrState),{mode:"manual",active:!1}),this.emitAbrStateChange());const s=this.lastConfirmedLevel;switch(this.pendingManualLevel=e,this.suppressInternalSwitchingLevel=e,null!=(i=t.mode)?i:"next-fragment"){case"immediate":r.currentLevel=e;break;case"smooth":r.loadLevel=e,this.state.loadLevel=e;break;default:r.nextLevel=e,this.state.nextLevel=e}this.suppressInternalSwitchingLevel=null,this.state.manualLevel=e,this.state.autoLevelEnabled=!1,this.emitLevelEvent(HD.HLS_LEVEL_SWITCHING,{playbackSessionId:o,from:s,to:e,reason:"manual",abrEngine:this.resolveAbrEngine(n),level:this.cloneLevel(e)})}destroy(){this.destroyed||(this.destroyed=!0,this.unbindHls(),this.runtime=null,this.hls=null,this.resetState(""))}bindHls(){this.hls&&this.listeners.forEach((([e,t])=>{var i;return null==(i=this.hls)?void 0:i.on(e,t)}))}unbindHls(){this.hls&&this.listeners.forEach((([e,t])=>{var i;return null==(i=this.hls)?void 0:i.off(e,t)}))}ensureCurrentRuntime(){const e=this.hls;return this.refreshRuntime(),!!e&&e===this.hls}resetState(e){this.state=VB(e),this.abrState=KB(e),this.resolvedAbrSessionId="",this.lastEmittedAbrStateSignature="",this.abrLimit=null,this.lastConfirmedLevel=-1,this.pendingManualLevel=null,this.suppressInternalSwitchingLevel=null}syncRuntimeState(){this.hls&&(this.state.currentLevel=XB(this.hls.currentLevel),this.state.loadLevel=XB(this.hls.loadLevel),this.state.nextLevel=XB(this.hls.nextLevel),this.state.manualLevel=XB(this.hls.manualLevel),this.state.autoLevelEnabled=!!this.hls.autoLevelEnabled,this.state.autoLevelCapping=XB(this.hls.autoLevelCapping))}updateLevels(e){this.state.levels=e.map(((e,t)=>((e,t)=>{var i;const n={index:t,bitrate:null!=(i=YB(e.bitrate))?i:0};return["averageBitrate","width","height","frameRate"].forEach((t=>{const i=YB(e[t]);void 0!==i&&(n[t]=i)})),["videoCodec","audioCodec","videoRange","name"].forEach((t=>{const i=(e=>"string"==typeof e?e:void 0)(e[t]);void 0!==i&&(n[t]=i)})),n})(e,t))),this.state.ready=!0,this.syncRuntimeState(),this.lastConfirmedLevel=this.state.currentLevel}hydrateCurrentLevels(){var e,t;(null==(t=null==(e=this.hls)?void 0:e.levels)?void 0:t.length)&&(this.updateLevels(this.hls.levels),this.emitLevelsUpdated(),this.refreshAbrState(!0))}emitLevelsUpdated(){const e=this.currentPlaybackSessionId();e&&this.options.emit(HD.HLS_LEVELS_UPDATED,{playbackSessionId:e,levels:zB(this.state.levels),state:this.getLevelState()})}emitLevelEvent(e,t){t.playbackSessionId&&this.options.emit(e,t)}cloneLevel(e){const t=this.state.levels[e];return t?u({},t):void 0}applyHlsJsAbrLimit(e){if(!this.hls)throw new sr("HLS_ABR_UNAVAILABLE","hls.js is unavailable for this playback session.");if(null===e)return void(this.hls.autoLevelCapping=-1);if("definition"===e.type)throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","hls.js ABR does not support Definition limits.");if("level"===e.type){if(!Number.isInteger(e.maxLevel)||e.maxLevel<0||e.maxLevel>=this.state.levels.length)throw new sr("HLS_LEVEL_OUT_OF_RANGE","The HLS ABR Level cap is out of range.");return void(this.hls.autoLevelCapping=e.maxLevel)}if(!Number.isFinite(e.maxBitrate)||e.maxBitrate<0)throw new sr("HLS_LEVEL_OUT_OF_RANGE","The HLS ABR bitrate cap is out of range.");const t=this.state.levels.filter((t=>{var i;return(null!=(i=t.averageBitrate)?i:t.bitrate)<=e.maxBitrate}));if(0===t.length)throw new sr("HLS_LEVEL_OUT_OF_RANGE","No HLS Level is eligible for the requested bitrate cap.");this.hls.autoLevelCapping=t.reduce(((e,t)=>{var i,n;return(null!=(i=t.averageBitrate)?i:t.bitrate)>(null!=(n=e.averageBitrate)?n:e.bitrate)?t:e})).index}applyVePlayerAbrLimit(e){var t,i,n,r,o;const s=null==(t=this.runtime)?void 0:t.abrBridge;if(!s)throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","The VePlayer ABR limit bridge is unavailable.");if(null===e){if(!s.setDefinitionAbrMaxDefinition(null))throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","The VePlayer ABR limit could not be cleared.");return}const a=null!=(r=null==(n=(i=this.options).getDefinitions)?void 0:n.call(i))?r:[];let l;if("definition"===e.type){if(l=e.maxDefinition.trim(),!l||!a.some((e=>QB(e)===l)))throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","The VePlayer ABR Definition cap is unavailable.")}else if("bitrate"===e.type){if(!Number.isFinite(e.maxBitrate)||e.maxBitrate<0)throw new sr("HLS_LEVEL_OUT_OF_RANGE","The VePlayer ABR bitrate cap is out of range.");const t=a.map((e=>({definition:QB(e),bitrate:ZB(e)}))).filter((t=>void 0!==t.definition&&void 0!==t.bitrate&&t.bitrate<=e.maxBitrate)).sort(((e,t)=>{var i,n;return(null!=(i=t.bitrate)?i:0)-(null!=(n=e.bitrate)?n:0)}));l=null==(o=t[0])?void 0:o.definition}else{if(!Number.isInteger(e.maxLevel)||e.maxLevel<0||e.maxLevel>=this.state.levels.length)throw new sr("HLS_LEVEL_OUT_OF_RANGE","The VePlayer ABR Level cap is out of range.");const t=a.filter((t=>{const i=MB(t,this.state.levels);return i.matched&&i.levelIndex===e.maxLevel}));1===t.length&&(l=QB(t[0]))}if(!l)throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","The requested VePlayer ABR limit cannot be mapped safely.");if(!s.setDefinitionAbrMaxDefinition(l))throw new sr("HLS_ABR_LIMIT_UNSUPPORTED","The VePlayer ABR limit bridge rejected the requested limit.")}refreshAbrState(e){var t,i,n,r,o,s,a,l,h,d,p,f,g,y,v,m;const _=this.runtime;if(!_)return void(this.abrState=KB(this.currentPlaybackSessionId()));const E=this.abrState,T=null!=(n=null==(i=(t=this.options).getDefinitions)?void 0:i.call(t))?n:[],S=function(e){var t,i,n;const r=null!=(t=e.playbackSessionId)?t:"",o=ID(e.streamType);if("hls"!==o)return AD(e.options,o),{playbackSessionId:r,playbackEngine:e.playbackEngine,configuredEngine:null,engine:"none",decisionSource:"none",available:!1,active:!1,mode:"auto",reason:"NOT_HLS",capabilities:CD()};const s=PD(e.options);if("native"===e.playbackEngine)return{playbackSessionId:r,playbackEngine:"native",configuredEngine:s,engine:"native",decisionSource:"native",available:!0,active:!0,mode:"auto",capabilities:CD()};if("hlsjs"===(null!=s?s:"hlsjs")){if("hlsjs"!==e.playbackEngine)return{playbackSessionId:r,playbackEngine:e.playbackEngine,configuredEngine:s,engine:"none",decisionSource:"none",available:!1,active:!1,mode:"auto",reason:"NOT_HLSJS_ENGINE",capabilities:CD()};const t=null!=(i=e.manifestReady)?i:e.levelCount>0,n=t&&e.levelCount>0,o=t?0===e.levelCount?"NO_ABR_VARIANTS":1===e.levelCount?"MULTI_LEVEL_MASTER_REQUIRED":void 0:"MANIFEST_NOT_READY",a=void 0===o;return{playbackSessionId:r,playbackEngine:"hlsjs",configuredEngine:s,engine:"hlsjs",decisionSource:"hls-levels",available:a,active:a,mode:"auto",reason:o,capabilities:{levelList:n,manualLevelSwitch:n,restoreAuto:a,levelCap:a,bitrateCap:a,definitionCap:!1}}}if("hlsjs"!==e.playbackEngine&&"veplayer-hls"!==e.playbackEngine)return{playbackSessionId:r,playbackEngine:e.playbackEngine,configuredEngine:s,engine:"veplayer",decisionSource:"definition-list",available:!1,active:!1,mode:"auto",reason:"NOT_HLSJS_ENGINE",capabilities:CD()};const a=0===e.definitionCount?"DEFINITION_LIST_REQUIRED":1===e.definitionCount?"NO_ABR_VARIANTS":e.abrModuleAvailable?e.licenseAvailable?void 0:"LICENSE_UNAVAILABLE":"ABR_MODULE_UNAVAILABLE",l=void 0===a,u="hlsjs"===e.playbackEngine&&(null!=(n=e.manifestReady)?n:e.levelCount>0)&&e.levelCount>0,c=l&&!0===e.abrLimitBridgeAvailable;return{playbackSessionId:r,playbackEngine:e.playbackEngine,configuredEngine:s,engine:"veplayer",decisionSource:"definition-list",available:l,active:l,mode:"auto",reason:a,capabilities:{levelList:u,manualLevelSwitch:u,restoreAuto:l,levelCap:!1,bitrateCap:c,definitionCap:c}}}({playbackSessionId:this.currentPlaybackSessionId(),streamType:null!=(s=null==(o=(r=this.options).getStreamType)?void 0:o.call(r))?s:"none"===_.playbackEngine?"":"hls",options:null==(l=(a=this.options).getAbrOptions)?void 0:l.call(a),playbackEngine:_.playbackEngine,manifestReady:this.state.ready,levelCount:this.state.levels.length,definitionCount:T.length,abrModuleAvailable:null==(p=null==(d=(h=this.options).isAbrModuleAvailable)?void 0:d.call(h))||p,licenseAvailable:null==(y=null==(g=(f=this.options).isAbrLicenseAvailable)?void 0:g.call(f))||y,abrLimitBridgeAvailable:!!_.abrBridge});"manual"===E.mode&&S.engine===E.engine&&(S.mode="manual",S.active=!1),this.state.currentLevel>=0&&(S.currentLevel=this.state.currentLevel);const b=null==(m=(v=this.options).getCurrentDefinition)?void 0:m.call(v);b&&(S.currentDefinition=b),"veplayer"!==S.engine||_.abrBridge||(S.capabilities.restoreAuto=!1);const k="auto"===S.mode&&S.available&&(E.playbackSessionId!==S.playbackSessionId||E.engine!==S.engine||"auto"!==E.mode||!E.active);this.abrState=S;if(!("hlsjs"!==_.playbackEngine||!0===this.state.ready))return;if(k)try{this.enableResolvedAbrOwner()}catch(oF){if(!(oF instanceof sr)||"HLS_ABR_UNAVAILABLE"!==oF.code)throw oF;this.abrState=c(u({},this.abrState),{available:!1,active:!1,reason:"ABR_RUNTIME_UNAVAILABLE",capabilities:c(u({},this.abrState.capabilities),{restoreAuto:!1,levelCap:!1,bitrateCap:!1,definitionCap:!1})})}const C=this.abrState;e&&C.playbackSessionId&&(this.resolvedAbrSessionId!==C.playbackSessionId&&(this.resolvedAbrSessionId=C.playbackSessionId,this.options.emit(HD.HLS_ABR_ENGINE_RESOLVED,GB(C))),WB(E)!==WB(C)&&this.emitAbrStateChange())}enableResolvedAbrOwner(){var e;const t=this.runtime;if(t){if("hlsjs"===this.abrState.engine)return null==(e=t.abrBridge)||e.setDefinitionAbrEnabled(!1),void(this.hls&&!this.hls.autoLevelEnabled&&(this.hls.currentLevel=-1));if("veplayer"===this.abrState.engine&&(this.keepHlsAsManualExecutor(),t.abrBridge&&!t.abrBridge.setDefinitionAbrEnabled(!0)))throw new sr("HLS_ABR_UNAVAILABLE","VePlayer ABR could not be enabled for this playback session.")}}disableCurrentAbrOwner(){var e,t;const i=this.runtime;if(i)if("veplayer"!==this.abrState.engine){if("hlsjs"===this.abrState.engine&&(null==(e=i.abrBridge)||e.setDefinitionAbrEnabled(!1),null==(t=this.hls)?void 0:t.autoLevelEnabled)){const e=this.selectExecutorLevel();this.hls.nextLevel=e}}else if(!i.abrBridge||!i.abrBridge.setDefinitionAbrEnabled(!1))throw new sr("HLS_ABR_UNAVAILABLE","VePlayer ABR cannot be disabled without the supported runtime bridge.")}keepHlsAsManualExecutor(){this.hls&&this.hls.autoLevelEnabled&&(this.hls.nextLevel=this.selectExecutorLevel())}clearRuntimeAbrLimit(e){var t;this.abrLimit&&e&&("hlsjs"!==this.abrState.engine?"veplayer"===this.abrState.engine&&(null==(t=e.abrBridge)||t.setDefinitionAbrMaxDefinition(null)):e.hls&&(e.hls.autoLevelCapping=-1))}selectExecutorLevel(){var e;if(!this.hls||0===this.state.levels.length)return 0;return null!=(e=[this.state.currentLevel,XB(this.hls.currentLevel),XB(this.hls.loadLevel),XB(this.hls.nextLevel)].find((e=>e>=0&&e<this.state.levels.length)))?e:0}emitAbrStateChange(){const e=WB(this.abrState);this.abrState.playbackSessionId&&e!==this.lastEmittedAbrStateSignature&&(this.lastEmittedAbrStateSignature=e,this.options.emit(HD.HLS_ABR_STATE_CHANGE,GB(this.abrState)))}resolveAbrEngine(e){return e?this.abrState.engine:"none"}currentPlaybackSessionId(){var e;return null!=(e=this.options.getPlaybackSessionId())?e:""}}const eH="hlsSubtitleTracksUpdated",tH="hlsSubtitleTrackSwitch",iH="hlsManifestLoading",nH=(e,t)=>{const i=null!=t?t:e;return i&&"object"==typeof i?i:{}},rH=e=>"string"==typeof e&&e.trim()?e.trim():void 0,oH=e=>!0===e||"string"==typeof e&&"YES"===e.toUpperCase(),sH=e=>u({},e),aH=()=>`hls-subtitle-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;class lH{constructor(e){var t,i;this.options=e,this.runtime=null,this.hls=null,this.playbackSessionId="",this.mappings=[],this.selectedId=null,this.hiddenSelectionId=null,this.pending=null,this.destroyed=!1,this.onManifestLoading=()=>{var e;this.resetSession(null!=(e=this.options.getPlaybackSessionId())?e:"","HLS_PLAYBACK_SESSION_EXPIRED"),this.hls&&(this.hls.subtitleTrack=-1,this.hls.subtitleDisplay=!1),0===this.options.getExplicitSubtitleList().length&&(this.options.updatePluginList([],!1),this.options.clearRenderer())},this.onTracksUpdated=(e,t)=>{var i,n;if(!this.ensureCurrentSession())return;const r=nH(e,t),o=Array.isArray(r.subtitleTracks)?r.subtitleTracks:null!=(n=null==(i=this.hls)?void 0:i.subtitleTracks)?n:[];this.applyTracks(o)},this.onTrackSwitched=(e,t)=>{var i,n;if(!this.ensureCurrentSession())return;const r=nH(e,t),o=Number(null!=(n=null!=(i=r.id)?i:r.subtitleTrack)?n:-1);this.confirmPendingSwitch(o)},this.createOpaqueId=null!=(t=e.createOpaqueId)?t:aH,this.switchTimeoutMs=Math.max(1,null!=(i=e.switchTimeoutMs)?i:8e3),this.listeners=[[eH,this.onTracksUpdated],[tH,this.onTrackSwitched],[iH,this.onManifestLoading]],this.refreshRuntime()}refreshRuntime(){var e,t,i;if(this.destroyed)return;const n=this.options.getRuntime(),r=null!=(e=this.options.getPlaybackSessionId())?e:"",o="hlsjs"===n.playbackEngine?n.hls:null,s=o!==this.hls,a=r!==this.playbackSessionId;s?(this.unbind(),this.runtime=n,this.hls=o,this.resetSession(r,"HLS_PLAYBACK_SESSION_EXPIRED"),this.bind()):(this.runtime=n,a&&this.resetSession(r,"HLS_PLAYBACK_SESSION_EXPIRED")),(null==(i=null==(t=this.hls)?void 0:t.subtitleTracks)?void 0:i.length)&&0===this.mappings.length&&this.applyTracks(this.hls.subtitleTracks)}getTracks(){return this.refreshRuntime(),this.mappings.map((e=>sH(e.track)))}getSelectedTrack(){this.refreshRuntime();const e=this.findById(this.selectedId);return e?sH(e.track):null}switchSubtitle(e){if(this.refreshRuntime(),!this.hls||!this.playbackSessionId)return Promise.reject(new sr("HLS_ENGINE_UNSUPPORTED","HLS subtitle switching requires the hls.js playback engine."));let t;try{t=this.resolveTarget(e)}catch(oF){return Promise.reject(oF)}return String(t.track.id)===String(this.selectedId)?Promise.resolve():this.submitSwitch(t)}hide(){var e,t,i;if(this.refreshRuntime(),!this.hls)return;const n=null!=(i=null!=(t=this.selectedId)?t:null==(e=this.pending)?void 0:e.to)?i:null;this.hiddenSelectionId=n,this.rejectPending(new sr("HLS_SUBTITLE_SWITCH_FAILED","The HLS subtitle switch was interrupted by hiding subtitles.")),null!==n&&this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHING,{playbackSessionId:this.playbackSessionId,playbackEngine:"hlsjs",from:n,to:null}),this.hls.subtitleTrack=-1,this.hls.subtitleDisplay=!1,this.selectedId=null,this.options.confirmPluginSelection(null),this.options.clearRenderer(),null!==n&&this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHED,{playbackSessionId:this.playbackSessionId,playbackEngine:"hlsjs",from:n,to:null})}show(){var e;if(this.refreshRuntime(),!this.hls||0===this.mappings.length)return Promise.resolve();const t=null!=(e=this.findById(this.hiddenSelectionId))?e:this.defaultMapping();return t?this.submitSwitch(t):Promise.resolve()}clearForPlaybackSwitch(){this.destroyed||(this.rejectPending(new sr("HLS_PLAYBACK_SESSION_EXPIRED","The HLS subtitle playback session has expired.")),this.mappings=[],this.selectedId=null,this.hiddenSelectionId=null,this.hls&&(this.hls.subtitleTrack=-1,this.hls.subtitleDisplay=!1),this.options.updatePluginList([],!1),this.options.clearRenderer())}destroy(){this.destroyed||(this.destroyed=!0,this.rejectPending(new sr("HLS_PLAYBACK_SESSION_EXPIRED","The HLS subtitle playback session has ended.")),this.unbind(),this.runtime=null,this.hls=null,this.mappings=[],this.selectedId=null,this.hiddenSelectionId=null,this.options.clearRenderer())}confirmPendingSwitch(e){var t,i;const n=this.pending;if(!n||e!==n.runtimeIndex)return;if(n.sessionId!==this.playbackSessionId)return void this.rejectPending(new sr("HLS_PLAYBACK_SESSION_EXPIRED","The HLS subtitle playback session has expired."));clearTimeout(n.timer),this.pending=null,this.selectedId=n.to,this.hiddenSelectionId=n.to;const r=sH(n.track),o=this.findById(n.to);o&&(null==(i=(t=this.options).syncRendererSelection)||i.call(t,o.runtimeIndex)),this.options.confirmPluginSelection(r),this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHED,{playbackSessionId:n.sessionId,playbackEngine:"hlsjs",from:n.from,to:n.to,track:r}),n.resolve()}applyTracks(e){var t;if(!this.hls)return;if(this.options.getExplicitSubtitleList().length>0)return this.rejectPending(new sr("HLS_SUBTITLE_SWITCH_FAILED","Business-configured subtitles take precedence over Master subtitles.")),this.mappings=[],this.selectedId=null,this.hiddenSelectionId=null,this.hls.subtitleTrack=-1,void(this.hls.subtitleDisplay=!1);const i=this.mappings,n=new Map;this.mappings=e.map(((e,t)=>{var r,o,s,a,l,h,d;const p=e.attrs&&"object"==typeof e.attrs?e.attrs:{},f=((e,t)=>{var i,n,r,o;return JSON.stringify([e.groupId,null!=(i=e.lang)?i:e.language,null!=(n=e.name)?n:e.label,e.type,null!=(r=e.forced)?r:t.FORCED,null!=(o=e.characteristics)?o:t.CHARACTERISTICS])})(e,p),g=null!=(r=n.get(f))?r:0;n.set(f,g+1);const y=`${f}:${g}`,v=i.find((e=>e.runtimeKey===y)),m=null!=(o=rH(e.lang))?o:rH(e.language),_=null!=(l=null!=(a=null!=(s=rH(e.name))?s:rH(e.label))?a:m)?l:"Subtitle",E=null!=(h=rH(e.characteristics))?h:rH(p.CHARACTERISTICS),T=u(c(u({id:null!=(d=null==v?void 0:v.track.id)?d:this.createOpaqueId()},m?{language:m}:{}),{text:_,isDefault:oH(e.default)||oH(p.DEFAULT),source:"hls",forced:oH(e.forced)||oH(p.FORCED)}),E?{characteristics:E}:{});return{runtimeIndex:t,runtimeKey:y,track:T}})),this.pending&&(null==(t=this.findById(this.pending.to))?void 0:t.runtimeIndex)!==this.pending.runtimeIndex&&this.rejectPending(new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The pending HLS subtitle track was removed.")),this.findById(this.selectedId)||(this.selectedId=null),this.findById(this.hiddenSelectionId)||(this.hiddenSelectionId=null);const r=this.options.getSubtitleConfig(),o=!!(null==r?void 0:r.isDefaultOpen)&&this.mappings.length>0,s=this.findById(this.selectedId);if(this.setSubtitleDisplay(o||!!s),this.options.updatePluginList(this.getTracksWithoutRefresh(),!!s),this.options.emit(HD.HLS_SUBTITLE_TRACKS_UPDATED,{playbackSessionId:this.playbackSessionId,playbackEngine:"hlsjs",tracks:this.getTracksWithoutRefresh()}),s&&this.options.confirmPluginSelection(sH(s.track)),!o||this.selectedId||this.pending)o||this.selectedId||(this.hls.subtitleTrack=-1);else{const e=this.defaultMapping();e&&this.submitSwitch(e).catch((()=>{}))}}submitSwitch(e){if(!this.hls)return Promise.reject(new sr("HLS_ENGINE_UNSUPPORTED","HLS subtitle switching requires the hls.js playback engine."));this.pending&&this.rejectPending(new sr("HLS_SUBTITLE_SWITCH_FAILED","The previous HLS subtitle switch was superseded."));const t=this.playbackSessionId,i=this.selectedId,n=e.track.id,r=sH(e.track);return this.options.emit(HD.HLS_SUBTITLE_TRACK_SWITCHING,{playbackSessionId:t,playbackEngine:"hlsjs",from:i,to:n,track:r}),new Promise(((o,s)=>{const a=this.hls.subtitleTrack===e.runtimeIndex,l=setTimeout((()=>{var t;(null==(t=this.pending)?void 0:t.runtimeIndex)===e.runtimeIndex&&(this.pending=null,this.hls&&(this.hls.subtitleTrack=this.runtimeIndexForId(this.selectedId)),s(new sr("HLS_SUBTITLE_SWITCH_TIMEOUT","The HLS subtitle switch was not confirmed in time.")))}),this.switchTimeoutMs);this.pending={sessionId:t,runtimeIndex:e.runtimeIndex,from:i,to:n,track:r,resolve:o,reject:s,timer:l},this.setSubtitleDisplay(!0),this.hls.subtitleTrack=e.runtimeIndex,a&&this.confirmPendingSwitch(e.runtimeIndex)}))}resolveTarget(e){if(void 0!==e.id&&null!==e.id&&""!==e.id){const t=this.findById(e.id);if(t)return t;throw new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The HLS subtitle track was not found.")}if(void 0!==e.language&&null!==e.language&&""!==e.language){const t=this.mappings.filter((t=>String(t.track.language)===String(e.language)));if(1===t.length)return t[0];if(t.length>1)throw new sr("HLS_SUBTITLE_TRACK_AMBIGUOUS","More than one HLS subtitle track uses the requested language.")}throw new sr("HLS_SUBTITLE_TRACK_NOT_FOUND","The HLS subtitle track was not found.")}setSubtitleDisplay(e){var t;this.hls&&(this.hls.subtitleDisplay=e&&"native"===(null==(t=this.options.getSubtitleConfig())?void 0:t.mode))}defaultMapping(){var e;return null!=(e=this.mappings.find((e=>e.track.isDefault)))?e:this.mappings[0]}findById(e){if(null!=e&&""!==e)return this.mappings.find((t=>String(t.track.id)===String(e)))}runtimeIndexForId(e){var t,i;return null!=(i=null==(t=this.findById(e))?void 0:t.runtimeIndex)?i:-1}getTracksWithoutRefresh(){return this.mappings.map((e=>sH(e.track)))}ensureCurrentSession(){var e;if(this.destroyed||!this.hls)return!1;const t=null!=(e=this.options.getPlaybackSessionId())?e:"";return t===this.playbackSessionId||(this.resetSession(t,"HLS_PLAYBACK_SESSION_EXPIRED"),!1)}resetSession(e,t){this.rejectPending(new sr(t,"The HLS subtitle playback session has expired.")),this.playbackSessionId=e,this.mappings=[],this.selectedId=null,this.hiddenSelectionId=null}rejectPending(e){const t=this.pending;t&&(clearTimeout(t.timer),this.pending=null,t.reject(e))}bind(){this.hls&&this.listeners.forEach((([e,t])=>{var i;return null==(i=this.hls)?void 0:i.on(e,t)}))}unbind(){this.hls&&this.listeners.forEach((([e,t])=>{var i;return null==(i=this.hls)?void 0:i.off(e,t)}))}}const uH=e=>"string"==typeof e?e.trim().toLowerCase():"",cH=e=>{try{return uH(null==e?void 0:e())}catch(t){return""}},hH=e=>{if(!e||"object"!=typeof e)return!1;try{const t=e;return Array.isArray(t.levels)&&"number"==typeof t.currentLevel&&"number"==typeof t.loadLevel&&"number"==typeof t.nextLevel&&"number"==typeof t.manualLevel&&"boolean"==typeof t.autoLevelEnabled&&"number"==typeof t.autoLevelCapping&&"function"==typeof t.on&&"function"==typeof t.off}catch(t){return!1}},dH=e=>e&&"function"==typeof e.setDefinitionAbrEnabled&&"function"==typeof e.setDefinitionAbrMaxDefinition&&"function"==typeof e.getDefinitionAbrMaxDefinition?{setDefinitionAbrEnabled:t=>{var i;return!0===(null==(i=e.setDefinitionAbrEnabled)?void 0:i.call(e,t))},setDefinitionAbrMaxDefinition:t=>{var i;return!0===(null==(i=e.setDefinitionAbrMaxDefinition)?void 0:i.call(e,t))},getDefinitionAbrMaxDefinition:()=>{var t,i;return null!=(i=null==(t=e.getDefinitionAbrMaxDefinition)?void 0:t.call(e))?i:null}}:null,pH=(e={},t)=>{var i,n,r,o;const s=null!=(i=e.plugins)?i:{},a=s.encrypthlsplugin,l=s.hls,u=hH(null==a?void 0:a.hls)?a:hH(null==l?void 0:l.hls)?l:null;if(u)return{playbackEngine:"hlsjs",hls:u.hls,abrService:null!=(n=u.abrService)?n:null,abrBridge:dH(u)};const c="hls"===((e,t)=>{var i,n,r,o,s,a,l;const u=null!=t?t:null==(i=e.sdk)?void 0:i.playerData;return cH(null==(n=null==u?void 0:u.getCurrentStreamType)?void 0:n.bind(u))||cH(null==(r=null==u?void 0:u.getStreamType)?void 0:r.bind(u))||uH(null==(o=null==u?void 0:u.adapter)?void 0:o.streamType)||uH(null==(s=null==u?void 0:u.configs)?void 0:s.streamType)||uH(null==(a=e.config)?void 0:a.streamType)||("string"!=typeof(c=null==(l=e.config)?void 0:l.url)?"":c.split(/[?#]/,1)[0].toLowerCase().endsWith(".m3u8")?"hls":"");var c})(e,t);return c&&(null==a?void 0:a.isNativeMode)?{playbackEngine:"native",hls:null,abrService:null,abrBridge:null}:c&&(a||l)?{playbackEngine:"veplayer-hls",hls:null,abrService:null!=(o=null!=(r=null==a?void 0:a.abrService)?r:null==l?void 0:l.abrService)?o:null,abrBridge:dH(null!=a?a:l)}:{playbackEngine:c?"native":"none",hls:null,abrService:null,abrBridge:null}};window.Player||(window.Player=Ws);const fH=class{constructor(e){var t;this.player=null,this.mountingDom=null,this.playerContainer=null,this.mobilePanel=null,this._hlsMasterController=null,this._hlsSubtitleAdapter=null,this._explicitSubtitleListSnapshot=[],this._lastSelectedAudioTrack=null,this._suppressAudioTrackMemory=!1,this._suppressAudioTrackMemoryTimer=null,this._playNextPending=!1,this._isCollectingCreatePlayerPerf=!1,this._getDramaInfoPerfRecords=[],this._isFirstCreated=!0,this.sdkPlugins=[],this._sdkPlugins={},this.delayError=[],this._publicPlayNextOperation=null,this._lifecycleGeneration=0,this._isVolcengine=!1,this._originConfigs={},this.delayEvents=[],this.createPlayer=e=>d(this,null,(function*(){const t=this._lifecycleGeneration||0;LB.beginCoreCreate(this,e);try{const i=yield this._createPlayer(e,t);return this._isStaleLifecycleGeneration(t)?void this._discardStalePlayer(i):i}catch(oF){throw LB.failCoreCreate(this,e),oF}})),this._createPlayer=(e,...t)=>d(this,[e,...t],(function*(e,t=this._lifecycleGeneration||0){var i,n,r,o,s,a,l,p,f,g,y,v;this._createPlayerPerf=new Oa,this._isCollectingCreatePlayerPerf=!0;const m=this._createPlayerPerf;if(yield m.measureAsync("destroyPlayer",(()=>d(this,null,(function*(){yield this._destroyPlayer()})))),this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();if(yield this.beforePlayerCreate(),this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();bB(this.playerData);const{options:_,plugins:E,isMobile:T,openSoftDecoding:S,configs:b,strategiesPlugins:k,strategiesPluginConfigs:C}=this.playerData,I=!1,A=this.playerData.isOpenABR()?void 0:this.playerData.getCurrentUrl(),P=this.playerData.getCurrentStreamType()||ma(null==b?void 0:b.getVideoByToken);Wa(b,"EncryptHlsPlugin")||A&&P||this.playerData.isOpenABR()||(aa.warn(`url is empty or streamType is empty (url:${A}, streamType: ${P})`),this.renderPoster());const w=()=>d(this,null,(function*(){const e=il(A);return yield this.getSoftDecodingOption(S,e,P)})),D=yield m.measureAsync("createSDKPreset",(()=>d(this,null,(function*(){return yield UN({isLive:I,isMobile:T,streamType:P,playerData:this.playerData,getSoftOptionTask:w},this)}))));if(this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();const{presets:L,softDecodingOption:R,plugins:x}=D,O=T?function(e=!1){const t=u({},QN),i=u({},e?ZN:JN);return u(u({},t),i)}(I):function(e=!1){const t=u({},zN),i=u({},e?$N:XN);return u(u({},t),i)}(I),{basicPlugins:N=[],iconPlugins:M=[]}=this._analyzeExtendPlugins(),U=R||{},{plugins:B=[]}=U,H=h(U,["plugins"]),F=this.getDefinitionConfig(),j=Ur.deepMerge(O,_),V=c(u(c(u(u(u({},{errorKey:UL}),j),H||{}),{definition:F,icons:u(u(u({},O.icons),{}),null!=(i=null==_?void 0:_.icons)?i:{}),MoreButtonPlugin:{iconPlugins:[...null!=(r=null==(n=_.MoreButtonPlugin)?void 0:n.iconPlugins)?r:[],...M,hM,oM,fM]}}),C),{playerData:this.playerData});this.playerData.getLineList().length>1&&V.MoreButtonPlugin.iconPlugins.push(lM),this.setDefaultConfigOptions(V);const K=function(e){const t=[];return e.forEach((e=>{t.find((t=>{var i,n;return(null==(i=null==t?void 0:t.pluginName)?void 0:i.toLowerCase())===(null==(n=null==e?void 0:e.pluginName)?void 0:n.toLowerCase())}))||t.push(e)})),t}([...N,...E,...x,...B,...k]),G=(null!=(o=null==V?void 0:V.ignores)?o:[]).some((e=>"sdkunmuteplugin"===(e+"").toLowerCase()));V.ignores=[...null!=(s=null==V?void 0:V.ignores)?s:[],...G?["AutoplayPlugin"]:[]],this._isFirstCreated?this._isFirstCreated=!1:(V.autoplayMuted=!1,V.ignores=[...null!=(a=null==V?void 0:V.ignores)?a:[],"sdkUnmutePlugin"]),this.setPluginConfig(V);const W={},Y=null==(l=fH.ttDramaEnv)?void 0:l.videoSecurityModule;if(null==Y?void 0:Y.generateSignature){const e=yield m.measureAsync("videoSecuritySignature",(()=>d(this,null,(function*(){return yield Y.generateSignature()}))));e&&(W["data-tt-sign"]=e)}if(this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();this._emitter.emit(HD.READY_CREATE_PLAYER);let z,$={};if(fH.shouldCheckLicense()){const e=yield fH.checkLicenseStatus();e!==SD.LICENSE_STATUS_OK&&e!==SD.LICENSE_STATUS_EXPIRED&&($={progress:{closeMoveSeek:!0,isCloseClickSeek:!0},sdkErrorPlugin:{isNeedRefreshButton:!1}})}if(this._isStaleLifecycleGeneration(t))return this._cancelStalePlayerCreation();if(m.measure("instantiatePlayer",(()=>{var e;z=new Ws(c(u(u({el:this.playerContainer,presets:L,url:A,isLive:!1},V),$),{videoAttributes:u(u({},null!=(e=V.videoAttributes)?e:{}),W),plugins:[...K]}))})),this._isStaleLifecycleGeneration(t))return this._discardStalePlayer(z),this._cancelStalePlayerCreation();this.player=z,z.playerData=this.playerData,z.sdk=this,LB.attachCore(this,z,e),null==(g=null==(p=z._subTitles)?void 0:p.setPlaybackSessionId)||g.call(p,null!=(f=LB.getPlaybackSessionId(this))?f:""),null==(v=null==(y=z._subTitles)?void 0:y.refresh)||v.call(y);const X=m.finish();return this._isCollectingCreatePlayerPerf=!1,this._lastCreatePlayerPerfReport=X,this.emit(HD.CREATE_PLAYER_PERF,X),aa.log("createPlayer perf: ",X),this._emitter.emit(HD.PLAYER_CREATED_FINISH),this.afterPlayerCreate(),z})),this._onMp4PreloadInfo=e=>{this.emit(FD.PRELOAD_INFO,e)},this._proxyError=e=>this.emit(KD.ERROR,e),this._onError=e=>{var t;const{errorCode:i,httpCode:n,mediaError:r}=e||{};if(Ur.isMSE(null==(t=this.player)?void 0:t.media))n+""!="403"&&i+""!="9203"||this._emitExpireEvent("error",e);else if(4===(null==r?void 0:r.code)||2===(null==r?void 0:r.code)){const t=il(this.playerData.getCurrentUrl());t&&La(t,{range:"0-8",timeout:2e3}).then((t=>{aa.log("xhr result",t);const{status:i,response:n}=t;403===i&&"string"==typeof n&&n.includes("expire")&&this._emitExpireEvent("error",e)})).catch((e=>{aa.log("xhr error",e)}))}},this._onNativeAddTrack=()=>{var e,t;if(this._getHlsInstance())return;this._playNextPending=!1;const i=null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks;if(!i)return;const n=[];for(let r=0;r<i.length;r++){const e=i[r];n.push({id:e.id,name:e.label||e.language||e.id,lang:e.language,default:e.enabled,selected:e.enabled})}this._applyAudioPreferenceNative(i),this._emitter.emit(HD.AUDIO_TRACKS_UPDATED,{audioTracks:n})},this._onNativeTrackChange=()=>{var e,t;if(this._getHlsInstance())return;const i=null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks;if(i)for(let n=0;n<i.length;n++){const e=i[n];if(e.enabled){const t={id:n,name:e.label||e.language||String(n),lang:e.language,default:e.enabled,selected:!0};this._playNextPending||(this._lastSelectedAudioTrack=t),this._emitter.emit(HD.AUDIO_TRACK_CHANGE,{id:n,audioTrack:t});break}}},function(e){if(!e)throw new hB}(Boolean(fH.ttDramaEnv)),this.assertLiteConfig(e),this._explicitSubtitleListSnapshot=this._cloneExplicitSubtitleList(null==(t=Wa(e,"Subtitle"))?void 0:t.list),LB.register(this,RU(e)),this._init(e)}static getPlayerPlaybackState(){var e,t,i;const n=null!=(i=null==(t=null==(e=Ws.instManager)?void 0:e.findAll)?void 0:t.call(e,(e=>!!(null==e?void 0:e.sdk)&&LB.has(e.sdk))))?i:[];return LB.query(n)}static registerModules(e){lD.registerModules(e)}static setAppendVideoUrlTimestamp(e=!0){!function(e=!0){SU=!!e}(e)}static getAppendVideoUrlTimestamp(){return SU}static setTTDramaEnv(e){var t;aa.log("TTDramaEnv: ",e);fH.ttDramaEnv=c(u({},e),{channel:null!=(t=e.channel)?t:"byteplus"})}static setMediaInfoCacheConfig(e){!function(e){e?("boolean"==typeof e.enable&&(TM.enable=e.enable),e.cacheType&&(TM.cacheType=e.cacheType),"number"==typeof e.expireTime&&Number.isFinite(e.expireTime)&&e.expireTime>0?TM.expireTime=e.expireTime:void 0!==e.expireTime&&kM("config ignore invalid expireTime",{expireTime:e.expireTime,currentExpireTime:TM.expireTime}),"number"==typeof e.maxEntries&&Number.isFinite(e.maxEntries)&&e.maxEntries>0?TM.maxEntries=Math.floor(e.maxEntries):void 0!==e.maxEntries&&kM("config ignore invalid maxEntries",{maxEntries:e.maxEntries,currentMaxEntries:TM.maxEntries}),kM("config updated",IM())):kM("config skip empty config",{currentConfig:IM()})}(e)}static getMediaInfoCacheConfig(){return IM()}static clearMediaInfoCache(){AM()}static prefetchMediaInfo(e){return function(e,t){return d(this,null,(function*(){if(!Array.isArray(e))throw new TypeError("sources must be an array");if(!e.length)return[];if(Kr.os.isAndroid&&!0===(null==t?void 0:t.canIUseGetDramaInfo)&&!t.canAndroidBatchGetDramaInfo){const i=[];for(const n of e)i.push(yield eB(n,t));return i}return Promise.all(e.map((e=>eB(e,t))))}))}(e,fH.ttDramaEnv)}static setDebug(e){!function(e){aa.config.debug=e?3:1}(e)}static setCollector(e){Na=e}static shouldCheckLicense(){return!1}static prepare(e){return d(this,null,(function*(){let t=e;const i=Boolean(fH.ttDramaEnv);!(null==t?void 0:t.appId)&&i&&(t=c(u({},t),{appId:xL}));const n=null==t?void 0:t.serviceConfigMode,r=function(e,t){return"remote"===e||"local-only"===e?e:t?"local-only":"remote"}(n,i);void 0!==n&&"remote"!==n&&"local-only"!==n&&aa.warn("[VePlayer.prepare] Invalid serviceConfigMode; using the environment default.");const o=function(e){var t,i;const n=null==(t=null==e?void 0:e.strategies)?void 0:t.preload,r="boolean"==typeof n;if(!n||!r&&(null==n?void 0:n.disabled))return e;const o=r?{}:n;return c(u({},e),{strategies:c(u({},e.strategies),{preload:c(u({},o),{[YU]:!0,config:c(u({},null!=(i=null==o?void 0:o.config)?i:{}),{[YU]:!0})})})})}(c(u({},t),{serviceConfigMode:r}));if(fH.shouldCheckLicense())try{fH.hasInitVeStrategy=!0;const e=yield fH.checkLicenseStatus(),t=yield fH.checkLicense();if(e===SD.LICENSE_STATUS_INVALID)throw new Error("LICENSE_STATUS_INVALID");if(t===_D.EDITION_STANDARD)throw new Error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}catch(oF){return void aa.error(oF.message)}else fH.hasInitVeStrategy=!0;yield gD.init(o)}))}static setPreloadScene(e,t){return gD.setPreloadScene(e,t)}static get preloader(){return gD.preloader}static get preloaderStatus(){return gD.preloaderStatus}static addPreloadList(e){return oB(e,fH.ttDramaEnv).then((e=>((null==e?void 0:e.length)||aa.warn("[addPreloadList] resolved preloadList is empty"),gD.addPreloadList(e))))}static setPreloadList(e){return oB(e,fH.ttDramaEnv).then((e=>((null==e?void 0:e.length)||aa.warn("[setPreloadList] resolved preloadList is empty"),aa.log("[setPreloadList] resolved preloadList:",JSON.stringify(e)),gD.setPreloadList(e))))}static setLicenseConfig(e){return bD.setLicenseConfig(e)}static checkLicense(){return bD.checkLicense()}static checkModuleList(){return bD.checkModuleList()}static checkLicenseStatus(){return bD.checkLicenseStatus()}static checkLicenseModuleAuth(e,t){return bD.checkLicenseModuleAuth(e,t)}static generateEncryptInfo(e,t){return d(this,null,(function*(){try{const i={hls:Hw.HLSEncrypt,mp4:Hw.MP4Encrypt,dash:Hw.DASH};if(!t||!i[t])return void aa.warn("param of streamType is invalid");const n=(new Date).getTime().toString(),r="mp4"===t?yield Vw.loadMp4Encrypt(uD):yield uD.loadPlugins(i[t]);return null==r?void 0:r.generateEncryptInfo(e,n)}catch(i){aa.error("generate encrypt info error: ",i)}}))}assertLiteConfig(e){bB(e)}_init(e,t){return d(this,null,(function*(){if(fH.ttDramaEnv){!(!e.url&&!e.playList)&&this.delayError.push(this._buildDramaInvalidParamError())}this._emitter=new Lr,this.renderDom({id:null==e?void 0:e.id,root:null==e?void 0:e.root});const i=fH.shouldCheckLicense()&&!(null==e?void 0:e.isLive)?yield fH.checkModuleList():Object.values(TD);this.playerData=hr.observe(new wD(c(u({},e),{licensSupportModuleList:i}),this)),this.adapter=this.playerData.adapter,this.initUmdLoader(e),this.on(HD.TOKEN_EXPIRED,this.onTokenExpiredAction.bind(this)),this.checkVodLogOptions(),this._initSdkPlugins();this.createPlayer(t).catch((e=>{if("VEPLAYER_LITE_UNSUPPORTED_FEATURE"===(null==e?void 0:e.code))return aa.error("createPlayer error:",e),void this.emit(KD.ERROR,e);throw e})),this._initI18N(this.playerData.languageData),this._originConfigs={autoBitrateOpts:(null==e?void 0:e.autoBitrateOpts)?u({},e.autoBitrateOpts):void 0,useSoftDecoding:null==e?void 0:e.useSoftDecoding}}))}_initSdkPlugins(){jU.init(this);[...this.sdkPlugins].map((e=>jU.registerPlugin(e,this)))}_initCheckExpire(){this.checkExpireTimer&&(this.checkExpireTimer.clear(),this.checkExpireTimer=null);const{enableUrlExpireCheck:e,urlCheckExpireInterval:t}=this.playerData.urlCheckData;e&&(this.checkExpireTimer=new Ba,this.checkExpireTimer.repeat(this._onRepeat.bind(this),t)),this.on(FD.MEDIA_EXPIRED,this._onMediaExpiredAction.bind(this))}initUmdLoader(e){this.sdkUmdLoader=new lD,this.updateUmdLoader(this.sdkUmdLoader,e)}updateUmdLoader(e,t){const{umdUrlMap:i,region:n,userRegion:r,pluginPublicPath:o,plugins:s=[]}=t;e.failCallback=(e,t)=>this.umdLoadErr(e,t),i&&"object"==typeof i&&e.updateBackupMap(t.umdUrlMap),e.region=n,e.userRegion=r,o&&"string"==typeof o&&(e.customPluginPublicPath=o),e.importedPlugins=s}checkVodLogOptions(){var e;const{isLive:t,configs:i}=this.playerData,n=Wa(i,"vodLogOpts");if(!t&&!i.disableVodLogOptsCheck){if(null==(e=fH.ttDramaEnv)?void 0:e.clientKey)return;if(!(null==n?void 0:n.line_app_id)){const e={errorType:"log",errorCode:PL.VOD_LOG_NOT_CONFIGURED.code,errorMessage:"vod log options not configured or configured correctly",ext:{},originError:void 0};this.delayError.push(e)}}}umdLoadErr(e,t){this.emit(HD.UMD_LOAD_FAIL,{name:e,error:t})}_onRepeat(){const{urlExpireTimestamp:e,urlExpireDiff:t=60}=this.playerData.urlCheckData;Math.round((new Date).getTime()/1e3)>=e-t&&(this.playerData.urlCheckData.urlExpireTimestamp=qs,this._emitExpireEvent("time"))}_emitExpireEvent(e="error",t){const i=Math.round((new Date).getTime()/1e3),n={errorCode:-499897,errorType:"network",errorMessage:"url expire",url:this.playerData.getCurrentUrl(),httpCode:403,version:"1.19.0-rc.1",ext:this,detectType:e,urlCheckData:this.playerData.urlCheckData,originError:t,from:"veplayer"};this.emitExpireTimestamp?i-this.emitExpireTimestamp>300&&(this.emitExpireTimestamp=i,aa.warn("media is expired, ",n),this.emit(KD.MEDIA_EXPIRED,n)):(this.emitExpireTimestamp=i,aa.warn("media is expired, ",n),this.emit(KD.MEDIA_EXPIRED,n))}on(e,t){this._emitter.on(e,t)}emit(e,t){this._emitter.emit(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}renderDom({id:e,root:t}){const i=document.createElement("div");this.playerContainer=i;const n=t||document.querySelector(`#${e}`);n&&(n.appendChild(i),this.mountingDom=n)}renderPoster(){if(!this.playerContainer)return;const{poster:e="",width:t,height:i}=this.playerData.options;("string"==typeof e?e:null==e?void 0:e.poster)&&(this.playerContainer.style.cssText=`background: url("${e}");\n background-size: cover;\n width:${t?t+"px":"100%"};\n height:${i?i+"px":"100%"};\n `)}getDefinitionConfig(){var e;const{current:{lineId:t},isVidEncrypt:i,configs:n,options:r}=this.playerData,o="hls"===(this.playerData.getCurrentStreamType()||ma(null==n?void 0:n.getVideoByToken))&&i&&!!(null==(e=Wa(r,"EncryptHlsPlugin"))?void 0:e.keyToken);let s=this.playerData.getDefinitionListByLineId(t).map((e=>o?function(e,t){const i=u({},e);return t.forEach((e=>delete i[e])),i}(e,["secretKey","playAuth"]):e)),a=this.playerData.current.definition;return this.playerData.isOpenABR()&&(a=this.playerData.defaultDefinition,s=(null==s?void 0:s.length)&&!this.adapter.needAbrAutoDefinition()?s.filter((e=>!this.playerData.isAutoDefinition(e.definition))):s),{defaultDefinition:a,list:s}}checkLicenseCallback(){return d(this,null,(function*(){var e,t,i,n,r,o,s,a,l,h,d,p,f,g,y,v,m;const _=yield fH.checkLicense(),E=yield fH.checkLicenseStatus();if(this.player.licenseLogInfo={licenseStatus:E,licenseType:_},E===SD.LICENSE_STATUS_EXPIRED)bD.renderLogo(this.playerContainer),!this.playerData.isOpenABR()&&(null==(t=null==(e=null==this?void 0:this._originConfigs)?void 0:e.autoBitrateOpts)?void 0:t.enable)&&"hlsjs"!==(null==(n=null==(i=null==this?void 0:this._originConfigs)?void 0:i.autoBitrateOpts)?void 0:n.engine)&&this.emit(HD.LICENSE_STATUS_WARNING,wL.EXPIRED_LICENSE_NOT_SUPPORT_ABR),(null==(o=null==(r=this.playerData.configs)?void 0:r.adaptRange)?void 0:o.enable)&&this.emit(HD.LICENSE_STATUS_WARNING,wL.EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER),!0===fH.hasInitVeStrategy&&this.emit(HD.LICENSE_STATUS_WARNING,wL.EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD);else if(E!==SD.LICENSE_STATUS_OK){null==(s=this.player.plugins.controls)||s.destroy(),null==(a=this.player.plugins.play)||a.destroy(),null==(l=this.player.plugins.sdkdefinitionplugin)||l.hide(),null==(h=this.player.plugins.definitionmobileplugin)||h.destroy(),null==(d=this.player.media)||d.removeAttribute("src");const e=c(u({errorType:DL.license},E===SD.LICENSE_STATUS_INVALID?{errorCode:PL.LICENSE_STATUS_INVALID.code,errorMessage:PL.LICENSE_STATUS_INVALID.message}:{errorCode:PL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH.code,errorMessage:PL.LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH.message}),{ext:{},originError:void 0});this.delayError.push(e)}else _===_D.EDITION_STANDARD&&(!this.playerData.isOpenABR()&&(null==(f=null==(p=this._originConfigs)?void 0:p.autoBitrateOpts)?void 0:f.enable)&&"hlsjs"!==(null==(y=null==(g=this._originConfigs)?void 0:g.autoBitrateOpts)?void 0:y.engine)&&this.emit(HD.LICENSE_STATUS_WARNING,wL.BASE_LICENSE_NOT_SUPPORT_ABR),(null==(m=null==(v=this.playerData.configs)?void 0:v.adaptRange)?void 0:m.enable)&&this.emit(HD.LICENSE_STATUS_WARNING,wL.BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER),!0===fH.hasInitVeStrategy&&this.emit(HD.LICENSE_STATUS_WARNING,wL.BASE_LICENSE_NOT_SUPPORT_PRELOAD))}))}setPluginConfig(e){var t,i,n,r,o;const{apiMap:s,configs:a,unionInfo:l,playList:h,useHlsPluginForSafari:d,isMobile:p}=this.playerData,f=this.playerData.getCurrentStreamType()||ma(null==a?void 0:a.getVideoByToken),g=Wa(a,"EncryptHlsPlugin"),y=Wa(e,"EncryptHlsPlugin"),v=Wa(a,"Mp4EncryptPlayer"),m=Wa(e,"Mp4EncryptPlayer"),_=Wa(a,"DASHPlugin"),E=Wa(e,"DASHPlugin"),T=Wa(a,"vodLogOpts"),S=(null==(t=fH.ttDramaEnv)?void 0:t.clientKey)?{appVersion:fH.ttDramaEnv.appVersion,clientKey:fH.ttDramaEnv.clientKey,line_app_id:xL,line_user_id:Pa(fH.ttDramaEnv.clientKey)}:{},b=!!(null==(i=null==h?void 0:h[0])?void 0:i.kid)||!!g;g&&(e.EncryptHlsPlugin=u(u(u({playDomain:s.playDomain,getKeyType:"TOP",preferMMS:!0,preferMMSStreaming:!0},p||!Ja||d?{}:{useHls:!1}),y||{}),g)),v&&(e.Mp4EncryptPlayer=u(u({playDomain:s.playDomain,preferMMS:!0,getKeyType:"TOP"},m||{}),v)),_&&(e.DASHPlugin=u(u({playDomain:s.playDomain,getKeyType:"TOP"},E||{}),_));const{vid:k}=a,{encryptSessionId:C,current:I,drmType:A}=this.playerData,{kid:P,secretKey:w}=I;if(A===or.PRIVATE_ENCRYPT_UPGRADE&&C&&w&&("hls"===f?e.EncryptHlsPlugin=u(u({vid:k,kid:P,useUnionInfoDRM:!0,sessionId:C,drmType:or.PRIVATE_ENCRYPT_UPGRADE,keyTokenExpiredDuration:9999999,secretKey:w,preferMMS:!0,preferMMSStreaming:!0},y||{}),g||{}):"dash"===f?e.DASHPlugin=u(u({playInfoType:"TOP",useEME:!0,keyTokenExpiredDuration:9999999,useUnionInfoDRM:!0,defaultFormat:"dash",replayReset:!1,disableBufferBreakCheck:!1,waitingTimeOut:5e3,vid:k,kid:P,drmType:or.PRIVATE_ENCRYPT_UPGRADE,secretKey:w,sessionId:C},E||{}),_||{}):"mp4"===f&&(e.Mp4EncryptPlayer=u(u({vid:k,kid:P,isEncrypt:!0,rangeMaxDuration:10,keyTokenExpiredDuration:9999999,retryCount:3,useUnionInfoDRM:!0,sessionId:C,drmType:or.PRIVATE_ENCRYPT_UPGRADE,secretKey:w,preferMMS:!0},m||{}),v||{}))),a.privateDrmAuthToken&&a.kid&&l&&("hls"===f?e.EncryptHlsPlugin=u(u({kid:a.kid,drmKeyToken:a.privateDrmAuthToken,playDomain:s.playDomain,preferMMS:!0,preferMMSStreaming:!0},y||{}),g||{}):"dash"===f?e.DASHPlugin=u(u({kid:a.kid,drmKeyToken:a.privateDrmAuthToken,playDomain:s.playDomain},E||{}),_||{}):"mp4"===f&&(e.Mp4EncryptPlayer=u(u({kid:a.kid,drmKeyToken:a.privateDrmAuthToken,playDomain:s.playDomain,preferMMS:!0},m||{}),v||{}))),T||S.clientKey){aa.log("codec",this.playerData.codec);const t=el(this.userRegion,this.region),i=null==t?void 0:t.__LOG_CUSTOM_REGION__,n=null==t?void 0:t.__LOG_CHANNEL_DOMAIN__;e.vodLogOpts=u(u(c(u(u({vtype:(f||"mp4").toUpperCase(),codec_type:this.playerData.codec,drm_type:b?1:0,playerVersion:"1.19.0-rc.1",channel:null==t?void 0:t.__LOG_CHANNEL__,needXhrCheck:!0,enableTeaWebId:!0},i?{trackerConfig:{log_from_region:null==t?void 0:t.__LOG_CUSTOM_REGION__}}:{}),n?{channelDomain:n}:{}),{ext:this.vodLogCommon}),S),T||{})}null==(n=this.getSdkPlugin("Abr"))||n.applyAbrConfig(e),null==(r=this.getSdkPlugin("AdaptRange"))||r.applyRangeConfig(e),null==(o=this.getSdkPlugin("Strategy"))||o.applyFinalStrategy(e)}detectCodec(e){return d(this,null,(function*(){var t;try{const{LoadProbe:i}=(yield this.sdkUmdLoader.loadPlugins(Hw.StreamProbe))||{};if(i){const n=yield null==(t=new i)?void 0:t.parseUrl(e),{codec:r}=n||{};"bytevc1"===r?this.playerData.codec=tr.H265:"avc"===r&&(this.playerData.codec=tr.H264)}}catch(i){aa.warn("detect codec error: ",i)}}))}setDefaultConfigOptions(e){if(!this._isFirstCreated)return;const{defaultConfig:t,isHitDefault:i}=this.playerData;if(!t)return;const{volume:n,startTime:r,DanmuPlugin:o,LiveSubtitlesIconPlugin:s}=null!=t?t:{};n&&(e.volume=e.volume?c(u({},e.volume),{default:n}):n),i&&r&&(e.startTime=r)}getCurrentPlayerConfig(){var e,t;const{isLive:i,current:{lineId:n,definition:r}}=this.playerData,o={type:i?"live":"vod",isLive:i,definition:r,lineId:n,volume:null!=(e=this.player.volume)?e:.6};return i||(o.startTime=null!=(t=this.player.currentTime)?t:0),u({},o)}getStreamType(){var e,t;return this.playerData.getCurrentStreamType()||ma(null==(t=null==(e=this.playerData)?void 0:e.configs)?void 0:t.getVideoByToken)}_analyzeExtendPlugins(){var e;const{options:t}=this.playerData,i=t.extendPlugin||[],n=null!=(e=null==t?void 0:t.ignore)?e:[],r=[],o=[];return i.forEach((e=>{const t=tM(e);"inner"!==t.type||n[e.pluginName]?r.push(t):o.push(t)})),{basicPlugins:r,iconPlugins:o}}beforePlayerCreate(){return d(this,null,(function*(){const e=this._createPlayerPerf;e?yield e.measureAsync("beforePlayerCreate",(()=>d(this,null,(function*(){yield Promise.all([e.measureAsync("beforePlayerCreate.sdkPlugins",(()=>d(this,null,(function*(){yield jU.beforePlayerCreate(this)})))),e.measureAsync("beforePlayerCreate.prepareStrategies",(()=>d(this,null,(function*(){yield this.prepareStrategies()}))))]),e.measure("beforePlayerCreate.updateConfigByStrategy",(()=>{this.updateConfigByStrategy()}))})))):(yield Promise.all([jU.beforePlayerCreate(this),this.prepareStrategies()]),this.updateConfigByStrategy())}))}getCreatePlayerPerfReport(){return this._lastCreatePlayerPerfReport}recordGetDramaInfoPerf(e){var t,i,n;if(null==e?void 0:e.perfInfo){this._getDramaInfoPerfRecords=this._getDramaInfoPerfRecords||[],this._getDramaInfoPerfRecords.push(e),this._markGetDramaInfoClientPerf(e);try{null==(n=null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.onGetDramaInfoPerf)||n.call(i,e)}catch(r){aa.error("onGetDramaInfoPerf callback error:",r)}}}getDramaInfoPerfRecords(){return[...this._getDramaInfoPerfRecords||[]]}getLastDramaInfoPerf(){const e=this._getDramaInfoPerfRecords||[];return e[e.length-1]}_markGetDramaInfoClientPerf(e){if(!this._isCollectingCreatePlayerPerf||!this._createPlayerPerf)return;const t=e.perfInfo,i=(e,t)=>{var i;"number"==typeof t&&(null==(i=this._createPlayerPerf)||i.markDuration(`beforePlayerCreate.authtoken.getVideoInfo.getVideos.getDramaInfoViaJSB.perfInfo.${e}`,t))};i("prepareCost",t.prepare_cost),i("requestCost",t.request_cost),i("parseCost",t.parse_cost),i("totalCost",t.total_cost)}prepareStrategies(){return d(this,null,(function*(){if(yield gD.prepare()){const{plugins:e,pluginConfiguration:t}=gD.getStrategyRecommendations();this.playerData.strategiesPlugins=e,this.playerData.strategiesPluginConfigs=t}else this.playerData.strategiesPlugins=[],this.playerData.strategiesPluginConfigs={}}))}updateConfigByStrategy(){if(gD.isReady()){const e=gD.getStrategyRecommendations(),{result:t}=e;if(aa.log("vodLogCommon strategyConfig:",t),this.vodLogCommon={strategyResult:t},null==t?void 0:t[cD.H265]){const{configs:e}=this.playerData;if(!e)return;const{url:i,codec:n}=e,r=this.playerData.playList||[],o=r.filter((e=>!e.codec||e.codec===tr.UNKNOWN)),s=r.filter((e=>e.codec===tr.H264)),a=r.filter((e=>e.codec===tr.H265)),l=t[cD.H265].enableH265Hardware,h=er(l?a.concat(s).concat(o):s.concat(o).concat(a),"definition"),d=!l&&!!i&&n===tr.H265&&h.length>0;this.playerData.initPlayData(c(u({},this.playerData.configs),{url:d?null:i,codec:d?tr.UNKNOWN:n,playList:h})),aa.log("hit h265strategy, current playList: ",this.playerData.playList)}}}afterPlayerCreate(){const{isMobile:e,isLive:t}=this.playerData;fH.shouldCheckLicense()&&!t&&this.checkLicenseCallback(),this._setVeError(),this._mountingPlayerPanel(e),this._mountingExtendMethods(),this._bindSdkEvents(),this._mountHlsMasterController(),this._bindPlayerEvents(),this._setPlayerInfo(),this._initCheckExpire(),jU.afterPlayerCreate(this)}_mountHlsMasterController(){var e,t,i,n;this._hlsMasterRefreshListener&&(null==(t=null==(e=this.player)?void 0:e.off)||t.call(e,no,this._hlsMasterRefreshListener)),null==(i=this._hlsMasterController)||i.destroy(),this._hlsMasterController=new JB({getRuntime:()=>pH(this.player,this.playerData),getPlaybackSessionId:()=>LB.getPlaybackSessionId(this),getAbrOptions:()=>{var e,t;return null==(t=null==(e=this.playerData)?void 0:e.configs)?void 0:t.autoBitrateOpts},getDefinitions:()=>{var e,t;return(null!=(t=null==(e=this.playerData)?void 0:e.playList)?t:[]).filter((e=>!this.playerData.isAutoDefinition(e.definition)))},getCurrentDefinition:()=>{var e,t;return null==(t=null==(e=this.playerData)?void 0:e.current)?void 0:t.definition},getStreamType:()=>{var e;return null==(e=this.playerData)?void 0:e.getCurrentStreamType()},isAbrModuleAvailable:()=>{var e,t,i,n,r;return"veplayer"!==(null==(t=null==(e=this.playerData)?void 0:e.getConfiguredHlsAbrEngine)?void 0:t.call(e))||!!(null==(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.autoBitrateOpts)?void 0:r.module)},isAbrLicenseAvailable:()=>{var e,t,i,n,r;return!!(null==(t=null==(e=this.playerData)?void 0:e.configs)?void 0:t.isLive)||!!(null==(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.licensSupportModuleList)?void 0:r.includes(TD.ABR))},emit:(e,t)=>{var i;return null==(i=this.player)?void 0:i.emit(e,t)}}),null==(n=this.player)||n.on(no,this._getHlsMasterRefreshListener()),this._mountHlsSubtitleAdapter()}_mountHlsSubtitleAdapter(){var e,t,i,n,r;const o=null==(t=null==(e=this.player)?void 0:e.plugins)?void 0:t.subtitle,s=pH(this.player,this.playerData);if(!o||"hlsjs"!==s.playbackEngine||!s.hls)return null==(i=null==o?void 0:o.setRuntimeSubtitleBridge)||i.call(o,void 0),null==(n=this._hlsSubtitleAdapter)||n.destroy(),void(this._hlsSubtitleAdapter=null);this._hlsSubtitleAdapter?this._hlsSubtitleAdapter.refreshRuntime():(this._hlsSubtitleAdapter=new lH({getRuntime:()=>pH(this.player,this.playerData),getPlaybackSessionId:()=>LB.getPlaybackSessionId(this),getExplicitSubtitleList:()=>this._explicitSubtitleListSnapshot,getSubtitleConfig:()=>{var e;return Wa(null==(e=this.playerData)?void 0:e.configs,"Subtitle")},updatePluginList:(e,t)=>{var i;return null==(i=o.replaceRuntimeSubtitleList)?void 0:i.call(o,e,t)},confirmPluginSelection:e=>{var t;return null==(t=o.confirmRuntimeSubtitleSelection)?void 0:t.call(o,e)},syncRendererSelection:e=>{var t;return null==(t=o.syncRuntimeSubtitleRenderer)?void 0:t.call(o,e)},clearRenderer:()=>{var e;return null==(e=o.clearRuntimeSubtitleView)?void 0:e.call(o)},emit:(e,t)=>this.emit(e,t)}),null==(r=o.setRuntimeSubtitleBridge)||r.call(o,{switchSubtitle:e=>{var t,i;return null!=(i=null==(t=this._hlsSubtitleAdapter)?void 0:t.switchSubtitle(e))?i:Promise.reject(new sr("HLS_SUBTITLE_SWITCH_FAILED","The HLS subtitle adapter is unavailable."))},hide:()=>{var e;return null==(e=this._hlsSubtitleAdapter)?void 0:e.hide()},show:()=>{var e,t;return null!=(t=null==(e=this._hlsSubtitleAdapter)?void 0:e.show())?t:Promise.resolve()}}))}_cloneExplicitSubtitleList(e){return Array.isArray(e)?e.map((e=>c(u({},e),{source:"config"}))):[]}_getHlsMasterRefreshListener(){return this._hlsMasterRefreshListener||(this._hlsMasterRefreshListener=()=>{var e;null==(e=this._hlsMasterController)||e.refreshRuntime(),this._mountHlsSubtitleAdapter()}),this._hlsMasterRefreshListener}_setVeError(){var e;const t=this.playerData.configs,i={oriErrRetryCount:t.oriErrRetryCount,oriErrRetryCycle:t.oriErrRetryCycle,oriErrRetryBaseDelay:t.oriErrRetryBaseDelay,oriErrMaxTotalRetry:t.oriErrMaxTotalRetry,enableOriErrRetry:t.enableOriErrRetry,needSyncAnalyzeError:t.needSyncAnalyzeError,analyzeTimeout:t.analyzeTimeout,clientKey:null==(e=fH.ttDramaEnv)?void 0:e.clientKey};this.veErrorIns=new GL(this.player,i)}_emitDelayError(){this.player&&this.delayError.forEach((e=>{this.player.emit(KD.ERROR,e)})),this.delayError=[]}_emitDelayEvent(){this.player&&this.delayEvents.forEach((e=>{const{name:t,payload:i}=e||{};t&&this.emit(t,i)})),this.delayEvents=[]}_setPlayerInfo(){this.player&&(this.player.playerVersion="1.19.0-rc.1",this.player.vtype=this.getVtype())}getVtype(){var e,t,i;const n=this.getStreamType()||ma(null==(t=null==(e=this.playerData)?void 0:e.configs)?void 0:t.getVideoByToken),r=Ur.isMSE(this.player.media);return!this.player.playerType&&(this.player.playerType=n,"hls"===(null==n?void 0:n.toLowerCase())&&(null==(i=this.player)?void 0:i.vodLogger))?r?"HLS_MSE":"HLS":n.toUpperCase()}_mountingPlayerPanel(e){var t;const{options:i,isLive:n}=this.playerData;this.player&&e&&(this.mobilePanel=new iM({config:null!=(t=i.panel)?t:{mode:n?$s.INNER:$s.NORMAL,isAutoChange:!0},root:this.player.root,player:this.player}),this.player.panel=this.mobilePanel)}_onPlayerRebuild(){if(!this._publicPlayNextOperation&&!LB.hasActiveIdentitySwitch(this))return this.createPlayer()}_getPlayerRebuildListener(){return this._playerRebuildListener||(this._playerRebuildListener=()=>this._onPlayerRebuild()),this._playerRebuildListener}_bindPlayerEvents(){var e;if(!this.player)return;this.player.on(HD.PLAYER_REBUILD,this._getPlayerRebuildListener()),this.player.once(KD.READY,this._emitDelayError.bind(this)),this.player.once(KD.READY,this._emitDelayEvent.bind(this)),this.player.on(KD.ERROR,this._onError),this.player.on(UL,this._proxyError);const t=null==(e=this.player.plugins)?void 0:e.mp4encryptplayer;t&&t.on(FD.PRELOAD_INFO,this._onMp4PreloadInfo)}_onMediaExpiredAction(){var e,t;if(this.emitExpireTimestamp=Math.round((new Date).getTime()/1e3),(null==(e=this.playerData)?void 0:e.onMediaExpired)&&"function"==typeof(null==(t=this.playerData)?void 0:t.onMediaExpired)){const e=Ka(this.playerData.onMediaExpired());(null==e?void 0:e.then)&&e.then((e=>this.updateMediaSource(e)))}}updateMediaSource(e){try{this.assertLiteConfig(e)}catch(r){return Promise.reject(r)}const{url:t,playList:i,getVideoByToken:n}=e||{};return t||(null==i?void 0:i.length)?new Promise(((t,n)=>{this.playerData.updateConfigs(e),this.playerData.updatePlayList(),this.playerData.updateCheckExpireData();const r=this.playerData.getCurrentUrl();if(this.player.isError||this.player.state<6&&Kr.isWeixin&&Kr.os.isIos){if(!(null==i?void 0:i.length))return this.playNext(u({},e),!1);{const t=this.playerData.current.definition,n=i.find((e=>e.definition===t));if(n&&n.url)return this.playNext(c(u({},e),{url:n.url}),!1)}}else{this.player.setConfig(c(u({},e),{url:r,definition:this.getDefinitionConfig()}));const i=this.player.switchURL(r,{seamless:!0});i&&i.then?(i.then((()=>t(void 0))),i.catch((()=>n()))):t(void 0)}})):(null==n?void 0:n.playAuthToken)?this.updateAuthToken(n):void 0}onTokenExpiredAction(){var e,t;if((null==(e=this.playerData)?void 0:e.onTokenExpired)&&"function"==typeof(null==(t=this.playerData)?void 0:t.onTokenExpired)){const e=Ka(this.playerData.onTokenExpired());(null==e?void 0:e.then)&&e.then((e=>this.updateAuthToken(e)))}}_bindSdkEvents(){const e=Object.values(Wo).filter((e=>e!==Zr)),t=[...Object.values(FD),...Object.values(HD),...e];[...new Set(t.filter((e=>"string"==typeof e)))].forEach((e=>{"string"==typeof e&&this.player.on(e,((...t)=>{this._emitter.emit(e,...t)}))})),this.player.on("hlsAudioTracksUpdated",(e=>{this._applyAudioPreference(e.audioTracks),this._emitter.emit(HD.AUDIO_TRACKS_UPDATED,e)})),this.player.on("hlsAudioTrackSwitched",(e=>{var t,i,n,r,o;const s=this._getHlsInstance(),a=null==(t=null==s?void 0:s.audioTracks)?void 0:t.find((t=>t.id===e.id));if(this._suppressAudioTrackMemory)this._clearSuppressAudioTrackMemory();else{a&&(this._lastSelectedAudioTrack=a);const e=null!=(r=null==(n=null==(i=this.playerData)?void 0:i.configs)?void 0:n.audioTrackSwitchSeekOffset)?r:.1,t=null==(o=this.player)?void 0:o.media;e>0&&t&&!t.paused&&isFinite(t.currentTime)&&(t.currentTime+=e)}this._emitter.emit(HD.AUDIO_TRACK_CHANGE,c(u({},e),{audioTrack:a}))})),this._bindNativeAudioTrackEvents()}_bindNativeAudioTrackEvents(){var e,t;const i=null==(t=null==(e=this.player)?void 0:e.media)?void 0:t.audioTracks;i&&(i.addEventListener("addtrack",this._onNativeAddTrack),i.addEventListener("change",this._onNativeTrackChange),i.addEventListener("removetrack",this._onNativeAddTrack))}_mountingExtendMethods(){this.player&&(this.player.changePluginsIcon=this.changePluginsIcon.bind(this))}_getHlsInstance(){var e,t,i;const n=null==(e=this.player)?void 0:e.plugins;return(null==(t=null==n?void 0:n.encrypthlsplugin)?void 0:t.hls)||(null==(i=null==n?void 0:n.hls)?void 0:i.hls)}_applyAudioPreference(e){var t,i,n,r;if(!(null==e?void 0:e.length))return;const o=this._getHlsInstance();if(!o)return;const s=null!=(r=null!=(n=this._lastSelectedAudioTrack)?n:null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.audioPreference)?r:{};if(0===Object.keys(s).length)return;this._setSuppressAudioTrackMemory();const a=o;if("function"==typeof a.setAudioOption)a.setAudioOption(oL(s));else{const t=s.lang;if(!t)return void this._clearSuppressAudioTrackMemory();const i=e.findIndex((e=>{var i;return(null==(i=e.lang)?void 0:i.toLowerCase())===t.toLowerCase()}));-1!==i&&o.audioTrack!==i?o.audioTrack=i:this._clearSuppressAudioTrackMemory()}}_setSuppressAudioTrackMemory(){this._suppressAudioTrackMemory=!0,null!==this._suppressAudioTrackMemoryTimer&&clearTimeout(this._suppressAudioTrackMemoryTimer),this._suppressAudioTrackMemoryTimer=setTimeout((()=>{this._suppressAudioTrackMemory=!1,this._suppressAudioTrackMemoryTimer=null}),2e3)}_clearSuppressAudioTrackMemory(){this._suppressAudioTrackMemory=!1,null!==this._suppressAudioTrackMemoryTimer&&(clearTimeout(this._suppressAudioTrackMemoryTimer),this._suppressAudioTrackMemoryTimer=null)}_applyAudioPreferenceNative(e){var t,i,n;if(!(null==e?void 0:e.length))return;const r=[this._lastSelectedAudioTrack,null==(i=null==(t=this.playerData)?void 0:t.configs)?void 0:i.audioPreference];for(const o of r){if(!o)continue;const t=o.id,i=o.lang,r=o.name;if(void 0===t&&!i&&!r)continue;let s=-1;for(let o=0;o<e.length;o++){const a=e[o];if((void 0===t||o===Number(t))&&!(i&&(null==(n=a.language)?void 0:n.toLowerCase())!==i.toLowerCase()||r&&a.label!==r)){s=o;break}}if(-1!==s)return void sL(e,s)}}_offPlayerEvents(){var e;if(!this.player)return;this.player.off(HD.PLAYER_REBUILD,this._getPlayerRebuildListener()),this.player.off(KD.ERROR,this._onError),this.player.off(UL,this._proxyError);const t=null==(e=this.player.plugins)?void 0:e.mp4encryptplayer;null==t||t.off(FD.PRELOAD_INFO,this._onMp4PreloadInfo)}changePluginsIcon(e,t){var i;if(!this.player)return;const n=this.player.getPlugin(e);if(!n||!(null==n?void 0:n.root))return;const r=Ur.hasClass(null==n?void 0:n.parent,"panel-icon-svg")?null==(i=null==n?void 0:n.parent)?void 0:i.parentNode:null==n?void 0:n.root;r&&(t?Ur.show(r,"block"):Ur.hide(r))}getSdkPlugin(e){var t;const i=null==(t=this._sdkPlugins)?void 0:t[e.toLowerCase()];return i&&i.pluginName?i:null}switchAuthToken(e,t=!0){try{this.assertLiteConfig({getVideoByToken:e})}catch(i){return Promise.reject(i)}return this._performAuthTokenSwitch(e,t)}_switchAuthToken(e,t,i){return this._performAuthTokenSwitch(e,t,i).then((()=>{i&&LB.commitIdentitySwitch(this,i)})).catch((e=>{throw i&&LB.rollbackIdentitySwitch(this,i),e}))}_performAuthTokenSwitch(e,t,i){const n=t?0:this.player.currentTime,r=this.getSdkPlugin("AuthToken");return r&&this.player?this._runDestroyableSourceSwitch((o=>r.updateAuthToken(e,t).then((()=>(o(),this._playerPlayNext(n,i)))).then((()=>{})))):(aa.error("current is not playAuthToken play or player not created"),Promise.reject())}updateAuthToken(e){try{this.assertLiteConfig({getVideoByToken:e})}catch(i){return Promise.reject(i)}const t=this.getSdkPlugin("AuthToken");return new Promise(((i,n)=>{t&&this.player?t.updateAuthToken(e,!1).then((()=>{if(this.player.isError)this._playerPlayNext(this.player.currentTime).then((()=>i())).catch((()=>n()));else{const e=this.playerData.getCurrentUrl();this.player.setConfig({url:e,definition:this.getDefinitionConfig()});const t=this.player.switchURL(e,{seamless:!0});t&&t.then?(t.then((()=>i())),t.catch((()=>n()))):i()}})).catch((e=>n(e))):(aa.error("current is not playAuthToken play or player not created"),n())}))}_playerPlayNext(e=0,t){const i=this.player;return new Promise(((n,r)=>{var o,s,a;const l=i.paused&&!i.isError;i.addClass(As.ENTER);const h=this.playerData.isOpenABR()?void 0:this.playerData.getCurrentUrl(),d=c(u(u({},this.playerData.options),this._getDramaConfigPatchForPlayer()),{definition:this.getDefinitionConfig(),startTime:e,autoplay:!0,url:h});d.poster&&i.plugins.poster&&i.plugins.poster.update(d.poster),this.setPluginConfig(d);let p=!t,f=!1,g=()=>{};const y=[],v=(e,t)=>{y.push([e,t]),i.once(e,t)},m=e=>{f||(f=!0,g(),(()=>{for(const[e,t]of y)i.off(e,t);y.length=0})(),e())};g=this._registerSourceSwitchAborter((e=>{m((()=>r(e)))}));const _=(e,t)=>{const i=(...n)=>{p?m((()=>t(...n))):v(e,i)};v(e,i)};_(KD.ERROR,(e=>r(e))),_(KD.CANPLAY,(()=>{l&&i.pause(),n(!0)})),v(KD.EMPTIED,(()=>{!p&&t&&(p=LB.armIdentitySwitch(this,t,i))}));try{if(i.plugins.dashplugin){const e=u(u({},Wa(i.config,"DASHPlugin")),this.playerData.options.DASHPlugin||{});e.dashOpts=this.playerData.dashOpts,e.vid=null==(s=null==(o=this.playerData.dashOpts)?void 0:o.Data)?void 0:s.Vid,i.plugins.drm&&(null==(a=i.plugins.drm)||a.restart()),i.setConfig(d),i.plugins.dashplugin.next(i.currentTime,"NEXT",e)}else i.playNext(d)}catch(oF){m((()=>r(oF)))}}))}get src(){var e,t;return(null==(e=this.player)?void 0:e.currentSrc)||(null==(t=this.player)?void 0:t.src)}set src(e){this.player&&(this.player.src=e)}switchURL(e){try{this.assertLiteConfig({url:e})}catch(n){return Promise.reject(n)}const t=this.player.switchURL(e,!1),i=this.player.currentTime;return t&&t.then?t:new Promise((e=>{const t=this.player.paused&&!this.player.isError,n=()=>{this.player.currentTime=i,t&&this.player.once(KD.CANPLAY,(()=>{this.player.pause()})),e()};Kr.os.isAndroid?this.once(KD.TIME_UPDATE,(()=>{n()})):this.once(KD.CANPLAY,(()=>{n()})),this.player.play()}))}next(e,t=!0){try{this.assertLiteConfig(e)}catch(i){return Promise.reject(i)}return this._publicPlayNextOperation||LB.hasActiveIdentitySwitch(this)?Promise.reject(this._createPlayNextInProgressError()):this._next(e,t)}_next(e,t=!0,i){var n;const r=this._lifecycleGeneration||0,o=t?0:this.player.currentTime,s=this.playerData.configs,a=this._applyIncomingIdentityAliases(u(c(u({},s),{startTime:o,autoplay:!0}),e),e);(null==(n=null==e?void 0:e.getVideoByToken)?void 0:n.playAuthToken)&&(a.streamType=ma(null==e?void 0:e.getVideoByToken)||nr.MP4);const l=LB.beginIdentitySwitch(this,RU(a),this.player,t,i);return l?this._teardown(!0).then((()=>{if(this._isStaleLifecycleGeneration(r))throw this._createDestroyedPlaybackSwitchError();return this._init(a,l)})).catch((e=>{if(LB.rollbackIdentitySwitch(this,l),this._isDestroyedPlaybackSwitchError(e))throw e;if(aa.error("next_error",e),"VEPLAYER_LITE_UNSUPPORTED_FEATURE"===(null==e?void 0:e.code))throw e})):Promise.reject(this._createPlayNextInProgressError())}playNext(e,t=!0){var i;try{this.assertLiteConfig(e)}catch(l){return Promise.reject(l)}if(this._publicPlayNextOperation||LB.hasActiveIdentitySwitch(this))return Promise.reject(this._createPlayNextInProgressError());const n={};this._publicPlayNextOperation=n;const r=this.player;try{r.emit(FD.PLAY_NEXT_START),null==(i=this._hlsSubtitleAdapter)||i.clearForPlaybackSwitch()}catch(l){return this._publicPlayNextOperation===n&&(this._publicPlayNextOperation=null),Promise.reject(l)}let o,s=null;try{const i=this._createDramaPlayNextCandidateConfig(e);if(s=LB.beginIdentitySwitch(this,RU(i),this.player,t),!s)throw this._createPlayNextInProgressError();this._lastSelectedAudioTrack=null,this._clearSuppressAudioTrackMemory(),this._playNextPending=!0,o=this._playNext(e,t,s)}catch(l){s&&LB.rollbackIdentitySwitch(this,s),o=Promise.reject(l)}const a=o.catch((e=>{throw s&&LB.rollbackIdentitySwitch(this,s),e}));return s?s.settled.then((()=>{this._publicPlayNextOperation===n&&(this._publicPlayNextOperation=null)})):a.finally((()=>{this._publicPlayNextOperation===n&&(this._publicPlayNextOperation=null)})).catch((()=>{})),a.finally((()=>{r.emit(FD.PLAY_NEXT_END)})).catch((()=>{})),a}_createPlayNextInProgressError(){return new Error("VePlayer playNext is already in progress")}_registerSourceSwitchAborter(e){this._sourceSwitchAborters||(this._sourceSwitchAborters=new Set);const t=this._sourceSwitchAborters;return t.add(e),()=>{t.delete(e),0===t.size&&this._sourceSwitchAborters===t&&(this._sourceSwitchAborters=void 0)}}_abortSourceSwitches(){const e=this._sourceSwitchAborters;if(this._sourceSwitchAborters=void 0,!e)return;const t=this._createDestroyedPlaybackSwitchError();for(const i of e)i(t)}_runDestroyableSourceSwitch(e){return new Promise(((t,i)=>{let n=!1,r=()=>{};const o=()=>{if(n)throw this._createDestroyedPlaybackSwitchError()},s=e=>{n||(n=!0,r(),e())};r=this._registerSourceSwitchAborter((e=>{s((()=>i(e)))}));try{Promise.resolve(e(o)).then((e=>s((()=>t(e)))),(e=>s((()=>i(e)))))}catch(oF){s((()=>i(oF)))}}))}_createDestroyedPlaybackSwitchError(){return new Error("VePlayer destroyed during playback switch")}_isDestroyedPlaybackSwitchError(e){return e instanceof Error&&"VePlayer destroyed during playback switch"===e.message}_isStaleLifecycleGeneration(e){return e!==(this._lifecycleGeneration||0)}_cancelStalePlayerCreation(){this._isCollectingCreatePlayerPerf=!1}_discardStalePlayer(e){var t;if(e){this.player===e&&(this.player=null);try{const i=null==(t=e.destroy)?void 0:t.call(e);(null==i?void 0:i.catch)&&i.catch((()=>{}))}catch(i){}}}updatePlayNextSubtitleConfig(e,t){var i,n,r,o,s;const a=Wa(e,"Subtitle"),l=Array.isArray(null==a?void 0:a.list);if(!l&&!t)return;const h=l?a.list:[];this._explicitSubtitleListSnapshot=this._cloneExplicitSubtitleList(h);const d=c(u(u(u({},Wa(this.playerData.options,"Subtitle")||{}),Wa(this.playerData.configs,"Subtitle")||{}),a||{}),{list:h});e.Subtitle=d,this.playerData.updateConfigs({Subtitle:d}),this.playerData.options.Subtitle=d,null==(o=null==(r=null==(n=null==(i=this.player)?void 0:i.plugins)?void 0:n.subtitle)?void 0:r.updateSubtitles)||o.call(r,h),null==(s=this._hlsSubtitleAdapter)||s.refreshRuntime()}_playNext(e,t=!0,i){var n,r,o;if(!e)return Promise.reject();const{url:s,playList:a,getVideoByToken:l}=e,h=this.player.paused&&!this.player.isError,d=t?0:this.player.currentTime;if(s||(null==a?void 0:a.length)){this._applyIncomingIdentityAliases(this.playerData.configs,e),this.playerData.updateConfigs(e),this.playerData.initPlayData(e);const n=this.adapter.canOpenAbr()&&this.playerData.isOpenABR()?void 0:this.playerData.getCurrentUrl(),r=this.player,o=r.state,s=this.getDefinitionConfig(),a=c(u({startTime:d},e),{url:n,definition:s});return this.updatePlayNextSubtitleConfig(a,t),this.setPluginConfig(a),new Promise(((e,t)=>{let n=!1,s=!1,l=()=>{};const u=[],c=(e,t)=>{const i=(...i)=>{n||e===KD.EMPTIED?t(...i):c(e,t)};u.push([e,i]),r.once(e,i)},d=e=>{s||(s=!0,l(),(()=>{var e;for(const[t,i]of u)null==(e=r.off)||e.call(r,t,i);u.length=0})(),e())};l=this._registerSourceSwitchAborter((e=>{d((()=>t(e)))})),c(KD.ERROR,(e=>{d((()=>t(e)))})),c(KD.CANPLAY,(()=>{d((()=>{6===o&&h?r.pause():6!==o&&r.config.autoplay&&r.play(),e(void 0)}))}));const p=()=>{n||(n=!i||LB.armIdentitySwitch(this,i,r))};u.push([KD.EMPTIED,p]),r.once(KD.EMPTIED,p);try{r.playNext(a)}catch(f){d((()=>t(f)))}}))}if(fH.ttDramaEnv){if(null==(n=e.getVideoByToken)?void 0:n.playAuthToken){if((this.playerData.getCurrentStreamType()||ma(null==(r=this.playerData.configs)?void 0:r.getVideoByToken))!==(e.streamType||ma(null==e?void 0:e.getVideoByToken)||"mp4"))return this._next(e,t,i)}const o=this._createDramaPlayNextCandidateConfig(e);return i?this.switchDramaEpisode(o,t,i):this.switchDramaEpisode(o,t)}if(null==l?void 0:l.playAuthToken){return(this.playerData.getCurrentStreamType()||ma(null==(o=this.playerData.configs)?void 0:o.getVideoByToken))!==(e.streamType||ma(null==e?void 0:e.getVideoByToken)||"mp4")?this._next(e,t,i):(this.playerData.updateConfigs(e),this._switchAuthToken(l,t,i))}return this._next(e,t,i)}_applyIncomingIdentityAliases(e,t){const i=e,n=t;for(const r of[["albumId","album_id"],["episodeId","episode_id","episodeID"]]){if(r.some((e=>Object.prototype.hasOwnProperty.call(n,e)))){for(const e of r)delete i[e];for(const e of r)Object.prototype.hasOwnProperty.call(n,e)&&(i[e]=n[e])}}return e}_createDramaPlayNextCandidateConfig(e){const t=this._applyIncomingIdentityAliases(this.playerData.getMergedConfigs(e),e);return Object.prototype.hasOwnProperty.call(e,"transcodeParam")&&(t.transcodeParam=e.transcodeParam),t}_getDramaConfigPatchForPlayer(){const e=this.playerData.configs,t=["albumId","album_id","episodeId","episode_id","episodeID"],i={};for(const n of t){const t=e[n];null!=t&&""!==t&&(i[n]=t)}return i}_buildDramaInvalidParamError(){const e=LL.INVALID_PARAM;return{errorType:DL.network,errorCode:e.code,veError:GL.getVeErrorInfo({code:e.code,message:e.message,textKey:e.textKey}),errorMessage:e.message,ext:{},originError:void 0}}_getDramaAlbumIdFromConfig(e){return RU(e).albumId||""}_getDramaEpisodeIdFromConfig(e){return RU(e).episodeId||""}switchDramaEpisode(e,t=!0,i){const n=t?0:this.player.currentTime,r=this.getSdkPlugin("AuthToken"),o=LB.beginIdentitySwitch(this,RU(e),this.player,t,i);return o?r&&this.player?this._runDestroyableSourceSwitch((i=>r.updateDramaEpisode(t,e).then((()=>(i(),this._playerPlayNext(n,o)))).then((()=>{})))).then((()=>{LB.commitIdentitySwitch(this,o)})).catch((e=>{throw LB.rollbackIdentitySwitch(this,o),e})):(LB.rollbackIdentitySwitch(this,o),aa.error("switchDramaEpisode: AuthToken plugin or player not available"),Promise.reject(new Error("AuthToken plugin or player not available"))):Promise.reject(this._createPlayNextInProgressError())}_destroyPlayer(){return d(this,null,(function*(){var e,t,i,n,r,o,s,a,l,u,c;this._hlsMasterRefreshListener&&(null==(t=null==(e=this.player)?void 0:e.off)||t.call(e,no,this._hlsMasterRefreshListener)),null==(i=this._hlsMasterController)||i.destroy(),this._hlsMasterController=null,null==(s=null==(o=null==(r=null==(n=this.player)?void 0:n.plugins)?void 0:r.subtitle)?void 0:o.setRuntimeSubtitleBridge)||s.call(o,void 0),null==(a=this._hlsSubtitleAdapter)||a.destroy(),this._hlsSubtitleAdapter=null,this._offPlayerEvents(),null==(l=this.veErrorIns)||l.destroy(),this.veErrorIns=null,yield null==(u=this.mobilePanel)?void 0:u.destroy(),yield null==(c=this.player)?void 0:c.destroy(),this.player=null}))}getPlayerInstance(){return this.player}getSoftDecodingOption(e,t,i){return d(this,null,(function*(){var n,r;const{enableH265Degrade:o,codec:s,configs:a,isLive:l}=this.playerData,u=function(e){var t,i;if(!(null==e?void 0:e.playAuthToken))return!1;const n=ya(null==e?void 0:e.playAuthToken),r=null!=(i=null==(t=null==n?void 0:n.FileType)?void 0:t.toLowerCase())?i:"video";return!!n&&("evideo"===r||"eaudio"===r)}(null==a?void 0:a.getVideoByToken),c=!!(a.enableMp4MSE||Wa(this.playerData.options,"Mp4EncryptPlayer")||"mp4"===i&&(s===tr.H265||u||(null==(n=null==a?void 0:a.autoBitrateOpts)?void 0:n.enable)));if(fH.shouldCheckLicense()&&(null==(r=this._originConfigs)?void 0:r.useSoftDecoding)&&!l)try{const e=yield fH.checkLicenseStatus();if(!(yield fH.checkLicenseModuleAuth(ED.SDK_VOD_PLAY,TD.H265)))throw this.emit(HD.LICENSE_STATUS_WARNING,e===SD.LICENSE_STATUS_EXPIRED?wL.EXPIRED_LICENSE_NOT_SUPPORT_265:wL.BASE_LICENSE_NOT_SUPPORT_265),new Error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}catch(oF){return void aa.error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}if(e){const e=yield this.sdkUmdLoader.loadPlugins(Hw.XGVideo);if(null==e?void 0:e.isSupported()){if(s&&e.setDecodeCapacity({preloadDecoder:this.playerData.codec,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1}),this.setH265SoftPlayList(),c){const e=yield Vw.loadMp4Encrypt(this.sdkUmdLoader);return{mediaType:this.playerData.isCurrentH265()?"xg-video":"video",innerDegrade:1,codecType:null!=s?s:tr.H264,plugins:[e]}}return{mediaType:"xg-video",innerDegrade:1,codecType:null!=s?s:tr.H264}}{this.emit(HD.NOT_SUPPORT_SOFT_DECODER);const e={errorType:"decoder",errorCode:3,errorMessage:"soft decode is not support by current browser",ext:{},originError:void 0};this.delayError.push(e),aa.error("soft decode is not support by current browser")}}else if(o&&!s&&t&&(yield this.detectCodec(t)),this.playerData.isCurrentH265()&&!function(){const e=window.navigator.userAgent.toLocaleLowerCase(),t=/(iphone)/.test(e)||/(ipad)/.test(e);if(/(VivoBrowser)/.test(e)){const t=e.match(/VivoBrowser\/(\d+)?/);if((null==t?void 0:t[1])>=22)return!0}return!!(t||window.MediaSource&&window.MediaSource.isTypeSupported&&(window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')))}())if(o){if(fH.shouldCheckLicense()&&!l)try{const e=yield fH.checkLicenseStatus();if(!(yield fH.checkLicenseModuleAuth(ED.SDK_VOD_PLAY,TD.H265)))throw this.emit(HD.LICENSE_STATUS_WARNING,e===SD.LICENSE_STATUS_EXPIRED?wL.EXPIRED_LICENSE_NOT_SUPPORT_265:wL.BASE_LICENSE_NOT_SUPPORT_265),new Error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}catch(oF){return void aa.error("ERROR_LICENSE_EDITION_NEED_UPLOAD")}const e=yield this.sdkUmdLoader.loadPlugins(Hw.XGVideo);if(null==e?void 0:e.isSupported()){if(null==e||e.setDecodeCapacity({preloadDecoder:this.playerData.codec,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1}),this.setH265SoftPlayList(),this.playerData.openSoftDecoding=!0,c){const e=yield Vw.loadMp4Encrypt(this.sdkUmdLoader);return{mediaType:this.playerData.isCurrentH265()?"xg-video":"video",innerDegrade:1,codecType:null!=s?s:tr.H264,plugins:[e]}}return{mediaType:"xg-video",innerDegrade:1,codecType:null!=s?s:tr.H264}}{this.emit(HD.NOT_SUPPORT_SOFT_DECODER);const e={errorType:"decoder",errorCode:3,errorMessage:"soft decode is not support by current browser",ext:{},originError:void 0};this.delayError.push(e),aa.error("soft decode is not support by current browser")}}else{this.emit(HD.NOT_SUPPORT_HARDWARE_DECODER);const e={ext:{},originError:void 0,errorType:"decoder",errorCode:3,errorMessage:"h265 hardware decode is not supported by this browser"};this.delayError.push(e),aa.error("h265 hardware decode is not supported by this browser")}return{}}))}setH265SoftPlayList(){if(this.playerData.isCurrentH265()){const e=this.playerData.playList;e.length>1&&(this.playerData.playList=e.filter((e=>{var t;return(null==(t=null==e?void 0:e.codec)?void 0:t.toLowerCase())===tr.H265}))),this.playerData.initCurrent(this.playerData.playList[0])}}changeDefinition(e){var t,i,n,r,o,s;if((null==(t=this.getDefinitionList())?void 0:t.length)<=1)return;const{sdkdefinitionplugin:a,definitionmobileplugin:l}=(null==(i=this.player)?void 0:i.plugins)||{};if(a||l)e!==this.playerData.current.definition&&(a?null==a||a.changeDefinition(e):l&&(null==l||l.changeDefinition(e)));else{let t;const{current:{lineId:i}}=this.playerData;t=this.playerData.getDefinitionListByLineId(i).find((t=>t.definition===e)),t||(t=null==(s=null==(o=null==(r=null==(n=this.player)?void 0:n.config)?void 0:r.definition)?void 0:o.list)?void 0:s.find((t=>(null==t?void 0:t.definition)===e))),t&&(this.player.changeDefinition(t),t.definition!==this.playerData.current.definition&&(this.playerData.current.definition=t.definition))}}getDefinitionList(){var e;const{sdkdefinitionplugin:t,definitionmobileplugin:i}=(null==(e=this.player)?void 0:e.plugins)||{};return t||i?(null==t?void 0:t.renderList)||(null==i?void 0:i.renderList):this.player.definitionList.map((e=>{var t;const i=this.playerData.isDefinitionMatch(e.definition,null==(t=this.player.curDefinition)?void 0:t.definition),n=e.url===this.player.url,r=e.url===this.player.src;return c(u({},e),{isDefinitionAuto:this.playerData.isAutoDefinition(e.definition),selected:i||(this.playerData.isOpenABR()&&Kr.os.isIos?r:n)})}))}getHlsLevels(){var e,t;return null!=(t=null==(e=this._hlsMasterController)?void 0:e.getLevels())?t:[]}getHlsLevelState(){var e,t,i;return null!=(i=null==(e=this._hlsMasterController)?void 0:e.getLevelState())?i:{playbackSessionId:null!=(t=LB.getPlaybackSessionId(this))?t:"",ready:!1,levels:[],currentLevel:-1,loadLevel:-1,nextLevel:-1,manualLevel:-1,autoLevelEnabled:!1,autoLevelCapping:-1}}setHlsLevel(e,t){if(!this._hlsMasterController)throw new sr("HLS_ENGINE_UNSUPPORTED","HLS Level control requires the hls.js playback engine.");this._hlsMasterController.setLevel(e,t)}getHlsAbrState(){var e,t,i;return null!=(i=null==(e=this._hlsMasterController)?void 0:e.getAbrState())?i:{playbackSessionId:null!=(t=LB.getPlaybackSessionId(this))?t:"",playbackEngine:"none",configuredEngine:null,engine:"none",decisionSource:"none",available:!1,active:!1,mode:"auto",reason:"NOT_HLS",capabilities:{levelList:!1,manualLevelSwitch:!1,restoreAuto:!1,levelCap:!1,bitrateCap:!1,definitionCap:!1}}}setHlsAbrMode(e){if(!this._hlsMasterController)throw new sr("HLS_ABR_UNAVAILABLE","HLS ABR mode control is unavailable.");this._hlsMasterController.setAbrMode(e)}getHlsAbrLimit(){var e,t;return null!=(t=null==(e=this._hlsMasterController)?void 0:e.getAbrLimit())?t:null}setHlsAbrLimit(e){if(!this._hlsMasterController)throw new sr("HLS_ABR_UNAVAILABLE","HLS ABR limit control is unavailable.");this._hlsMasterController.setAbrLimit(e)}getAudioTracks(){var e,t,i;const n=this._getHlsInstance();if(null==(e=null==n?void 0:n.audioTracks)?void 0:e.length){const e=n.audioTrack;return n.audioTracks.map((t=>c(u({},t),{selected:t.id===e})))}const r=null==(i=null==(t=this.player)?void 0:t.media)?void 0:i.audioTracks;if(!(null==r?void 0:r.length))return[];const o=[];for(let s=0;s<r.length;s++){const e=r[s];o.push({id:s,name:e.label||e.language||String(s),lang:e.language,default:e.enabled,selected:e.enabled})}return o}getCurrentAudioTrack(){var e,t,i;const n=this._getHlsInstance();if(null==(e=null==n?void 0:n.audioTracks)?void 0:e.length){const e=n.audioTrack,t=n.audioTracks.find((t=>t.id===e));return t?c(u({},t),{selected:!0}):null}const r=null==(i=null==(t=this.player)?void 0:t.media)?void 0:i.audioTracks;if(!r)return null;for(let o=0;o<r.length;o++){const e=r[o];if(e.enabled)return{id:o,name:e.label||e.language||String(o),lang:e.language,default:!0,selected:!0}}return null}switchAudioTrack(e){var t,i;const{id:n}=e,r=this._getHlsInstance();if(r)return void aL(r,e);const o=null==(i=null==(t=this.player)?void 0:t.media)?void 0:i.audioTracks;o&&sL(o,n)}get preLoadData(){var e;if(!this.player||!this.player.plugins)return{hit:0};const t=this.player.plugins.mp4encryptplayer;if(t&&t.preLoadData)return{hit:!0===t.hitpreload?1:0,duration:t.preLoadData.duration,length:t.preLoadData.byteLength};const i=(null==(e=this.player)?void 0:e.stat)||{};if(i.preLoadData){const{length:e,duration:t}=i.preLoadData,n={hit:e>0?1:0,length:e,duration:0};return t>=0&&(n.duration=t),n}return{hit:0,duration:0,length:0}}_initI18N(e){const{extraLangList:t,extendLangList:i}=e;null==t||t.forEach((e=>{Os.use(e)})),Os.extend(WU),i&&Os.extend(i)}get musicMode(){}set musicMode(e){}get musicTimeScale(){}set musicTimeScale(e){}get musicList(){}set musicList(e){}musicAdd(e){}musicRandom(){}musicNext(){}musicPrev(){}musicSetIndex(e){}musicForward(){}musicBackward(){}musicRemove(e){}musicSetAbCycle(e,t,i,n){}musicRemoveAbCycle(){}getLogUserId(){var e,t,i;const n=null==(e=this.player)?void 0:e.vodLogger;if(n){const e=(null==(t=null==n?void 0:n.tracker)?void 0:t.getConfig())||{};return null==(i=null==e?void 0:e.user)?void 0:i.user_unique_id}}get region(){return this.playerData.region}get userRegion(){return this.playerData.userRegion}getPlugin(e){var t;return null==(t=this.player)?void 0:t.getPlugin(e)}getSubtitleList(){var e,t;const i=this.getPlugin("subtitle");return(null!=(t=null==(e=null==i?void 0:i.config)?void 0:e.list)?t:[]).map((e=>u({},e)))}switchSubtitle(e){const t=this.getPlugin("subtitle");return t?t.switchSubTitle(e):Promise.reject(new Error("subtitle plugin is not registered"))}showSubtitle(){var e,t;const i=this.getPlugin("subtitle");if(i)if(i.curIndex>-1&&i.curItem)i.switchSubTitle(i.curItem);else{const n=null!=(t=null==(e=i.config)?void 0:e.list)?t:[];n.length>0&&i.switchSubTitle(n[0])}}hideSubtitle(){var e;const t=this.getPlugin("subtitle");null==(e=null==t?void 0:t.switchOffSubtitle)||e.call(t)}_teardown(e){return d(this,null,(function*(){var t;const i=this.player;e||(this._lifecycleGeneration=(this._lifecycleGeneration||0)+1,this._abortSourceSwitches(),LB.destroy(this,i)),yield this._destroyPlayer(),this.checkExpireTimer&&(this.checkExpireTimer.clear(),this.checkExpireTimer=null,this._onRepeat=null),this.mountingDom&&this.mountingDom.contains(this.playerContainer)&&this.mountingDom.removeChild(this.playerContainer),null==(t=this._emitter)||t.removeAllListeners(),this._emitter=null,jU.destroy(this)}))}destroy(){return d(this,null,(function*(){yield this._teardown(!1)}))}};let gH=fH;gH.isMSESupported=Xa,gH.veStrategy=gD,gH.sdkVersion="1.19.0-rc.1",gH.ttDramaEnv=null,gH.isMMSSupported=qa,gH.isRTMSupported=DD.isSupported,gH.hasInitVeStrategy=!1;const yH=gH;const vH="function"==typeof Buffer,mH=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),_H=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),EH=(e=>{let t={};return e.forEach(((e,i)=>t[e]=i)),t})(_H),TH=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,SH=String.fromCharCode.bind(String),bH=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),kH=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),CH=e=>{let t,i,n,r,o="";const s=e.length%3;for(let a=0;a<e.length;){if((i=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=i<<16|n<<8|r,o+=_H[t>>18&63]+_H[t>>12&63]+_H[t>>6&63]+_H[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},IH="function"==typeof btoa?e=>btoa(e):vH?e=>Buffer.from(e,"binary").toString("base64"):CH,AH=vH?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let i=0,n=e.length;i<n;i+=4096)t.push(SH.apply(null,e.subarray(i,i+4096)));return IH(t.join(""))},PH=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?SH(192|t>>>6)+SH(128|63&t):SH(224|t>>>12&15)+SH(128|t>>>6&63)+SH(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return SH(240|t>>>18&7)+SH(128|t>>>12&63)+SH(128|t>>>6&63)+SH(128|63&t)},wH=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,DH=e=>e.replace(wH,PH),LH=vH?e=>Buffer.from(e,"utf8").toString("base64"):mH?e=>AH(mH.encode(e)):e=>IH(DH(e)),RH=(e,t=!1)=>t?bH(LH(e)):LH(e),xH=e=>{if(e=e.replace(/\s+/g,""),!TH.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,i,n,r="";for(let o=0;o<e.length;)t=EH[e.charAt(o++)]<<18|EH[e.charAt(o++)]<<12|(i=EH[e.charAt(o++)])<<6|(n=EH[e.charAt(o++)]),r+=64===i?SH(t>>16&255):64===n?SH(t>>16&255,t>>8&255):SH(t>>16&255,t>>8&255,255&t);return r},OH=RH;var NH={};!function(e){e._getPrivFilters=function(){var e,t=/</g,i=/"/g,n=/'/g,r=/&/g,o=/\x00/g,s=/(?:^$|[\x00\x09-\x0D "'`=<>])/g,a=/[&<>"'`]/g,l=/(?:\x00|^-*!?>|--!?>|--?!?$|\]>|\]$)/g,u=/&(?:#([xX][0-9A-Fa-f]+|\d+);?|(Tab|NewLine|colon|semi|lpar|rpar|apos|sol|comma|excl|ast|midast|ensp|emsp|thinsp);|(nbsp|amp|AMP|lt|LT|gt|GT|quot|QUOT);?)/g,c={Tab:"\t",NewLine:"\n",colon:":",semi:";",lpar:"(",rpar:")",apos:"'",sol:"/",comma:",",excl:"!",ast:"*",midast:"*",ensp:" ",emsp:" ",thinsp:" ",nbsp:" ",amp:"&",lt:"<",gt:">",quot:'"',QUOT:'"'},h=/^(?:(?!-*expression)#?[-\w]+|[+-]?(?:\d+|\d*\.\d+)(?:r?em|ex|ch|cm|mm|in|px|pt|pc|%|vh|vw|vmin|vmax)?|!important|)$/i,d=/[\x00-\x1F\x7F\[\]{}\\"]/g,p=/[\x00-\x1F\x7F\[\]{}\\']/g,f=/url[\(\u207D\u208D]+/g,g=/['\(\)]/g,y=/\/\/%5[Bb]([A-Fa-f0-9:]+)%5[Dd]/,v={javascript:1,data:1,vbscript:1,mhtml:1,"x-schema":1},m=/(?::|&#[xX]0*3[aA];?|�*58;?|:)/,_=/(?:^[\x00-\x20]+|[\t\n\r\x00]+)/g,E={Tab:"\t",NewLine:"\n"},T=function(e,t,i){return void 0===e?"undefined":null===e?"null":e.toString().replace(t,i)},S=String.fromCodePoint||function(e){return 0===arguments.length?"":e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),e%1024+56320))};function b(e){var t=e.split(m,2);return!t[0]||2!==t.length&&e.length===t[0].length?null:t[0]}function k(t,i,n,r){return i=i||c,n=n||u,void 0===t?"undefined":null===t?"null":t.toString().replace(o,"�").replace(n,(function(t,n,o,s){return n?(n=Number(n[0]<="9"?n:"0"+n),r?S(n):128===n?"€":130===n?"‚":131===n?"ƒ":132===n?"„":133===n?"…":134===n?"†":135===n?"‡":136===n?"ˆ":137===n?"‰":138===n?"Š":139===n?"‹":140===n?"Œ":142===n?"Ž":145===n?"‘":146===n?"’":147===n?"“":148===n?"”":149===n?"•":150===n?"–":151===n?"—":152===n?"˜":153===n?"™":154===n?"š":155===n?"›":156===n?"œ":158===n?"ž":159===n?"Ÿ":n>=55296&&n<=57343||13===n?"�":e.frCoPt(n)):i[o||s]||t}))}function C(e){return"\\"+e.charCodeAt(0).toString(16).toLowerCase()+" "}function I(e){return e.replace(f,(function(e){return"-x-"+e}))}function A(t){var i=b(t=e.yufull(k(t)));return i&&v[i.toLowerCase()]?"##"+t:t}return e={frCoPt:function(e){return null==e?"":!isFinite(e=Number(e))||e<=0||e>1114111||e>=1&&e<=8||e>=14&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||11===e||65535==(65535&e)||65534==(65535&e)?"�":S(e)},d:k,yup:function(e){return(e=b(e.replace(o,"")))?k(e,E,null,!0).replace(_,"").toLowerCase():null},y:function(e){return T(e,a,(function(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"===e?"'":"`"}))},ya:function(e){return T(e,r,"&")},yd:function(e){return T(e,t,"<")},yc:function(e){return T(e,l,(function(e){return"\0"===e?"�":"--!"===e||"--"===e||"-"===e||"]"===e?e+" ":e.slice(0,-1)+" >"}))},yavd:function(e){return T(e,i,""")},yavs:function(e){return T(e,n,"'")},yavu:function(e){return T(e,s,(function(e){return"\t"===e?"	":"\n"===e?" ":"\v"===e?"":"\f"===e?"":"\r"===e?" ":" "===e?" ":"="===e?"=":"<"===e?"<":">"===e?">":'"'===e?""":"'"===e?"'":"`"===e?"`":"�"}))},yu:encodeURI,yuc:encodeURIComponent,yubl:function(t){return v[e.yup(t)]?"x-"+t:t},yufull:function(t){return e.yu(t).replace(y,(function(e,t){return"//["+t+"]"}))},yublf:function(t){return e.yubl(e.yufull(t))},yceu:function(e){return e=k(e),h.test(e)?e:";-x:'"+I(e.replace(p,C))+"';-v:"},yced:function(e){return I(k(e).replace(d,C))},yces:function(e){return I(k(e).replace(p,C))},yceuu:function(e){return A(e).replace(g,(function(e){return"'"===e?"\\27 ":"("===e?"%28":"%29"}))},yceud:function(e){return A(e)},yceus:function(e){return A(e).replace(n,"\\27 ")}}};var t=e._privFilters=e._getPrivFilters();function i(e,i,n){return t.yubl(i((n||t.yufull)(e)))}e.inHTMLData=t.yd,e.inHTMLComment=t.yc,e.inSingleQuotedAttr=t.yavs,e.inDoubleQuotedAttr=t.yavd,e.inUnQuotedAttr=t.yavu,e.uriInSingleQuotedAttr=function(e){return i(e,t.yavs)},e.uriInDoubleQuotedAttr=function(e){return i(e,t.yavd)},e.uriInUnQuotedAttr=function(e){return i(e,t.yavu)},e.uriInHTMLData=t.yufull,e.uriInHTMLComment=function(e){return t.yc(t.yufull(e))},e.uriPathInSingleQuotedAttr=function(e){return i(e,t.yavs,t.yu)},e.uriPathInDoubleQuotedAttr=function(e){return i(e,t.yavd,t.yu)},e.uriPathInUnQuotedAttr=function(e){return i(e,t.yavu,t.yu)},e.uriPathInHTMLData=t.yu,e.uriPathInHTMLComment=function(e){return t.yc(t.yu(e))},e.uriQueryInSingleQuotedAttr=e.uriPathInSingleQuotedAttr,e.uriQueryInDoubleQuotedAttr=e.uriPathInDoubleQuotedAttr,e.uriQueryInUnQuotedAttr=e.uriPathInUnQuotedAttr,e.uriQueryInHTMLData=e.uriPathInHTMLData,e.uriQueryInHTMLComment=e.uriPathInHTMLComment,e.uriComponentInSingleQuotedAttr=function(e){return t.yavs(t.yuc(e))},e.uriComponentInDoubleQuotedAttr=function(e){return t.yavd(t.yuc(e))},e.uriComponentInUnQuotedAttr=function(e){return t.yavu(t.yuc(e))},e.uriComponentInHTMLData=t.yuc,e.uriComponentInHTMLComment=function(e){return t.yc(t.yuc(e))},e.uriFragmentInSingleQuotedAttr=function(e){return t.yubl(t.yavs(t.yuc(e)))},e.uriFragmentInDoubleQuotedAttr=function(e){return t.yubl(t.yavd(t.yuc(e)))},e.uriFragmentInUnQuotedAttr=function(e){return t.yubl(t.yavu(t.yuc(e)))},e.uriFragmentInHTMLData=e.uriComponentInHTMLData,e.uriFragmentInHTMLComment=e.uriComponentInHTMLComment}(NH);const MH="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; pointer-events: none; z-index: 9999; font-size: 14px; display: block;",UH={SLOW:.5,MODERATE:1,FAST:2},BH={SLOW:5,MODERATE:3.5,FAST:2},HH={style:{node:MH,wrap:"",img:""},class:{node:"",wrap:"xg-dynamic-watermark",img:""}};function FH(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach((e=>{i.setAttribute(e,t[e])})),i}class jH{constructor(e){this.root=e.root,this.config=e,this.wrap=document.createElement("div"),this.img=document.createElement("img"),this.imgSrc="",this.root&&this.root.appendChild(this.wrap),this.moveTimer=null,this.blinkTimer=null,this.pauseAnimation=!1,this.observer=[]}_getWatermarkDom(){const{content:e="",fontFamily:t}=this.config,i=e,n="string"==typeof this.config.fontSize?`${this.config.fontSize}`:`${this.config.fontSize}px`,r=document.createElement("text");r.style.fontSize=n,r.style.whiteSpace="nowrap",t&&(r.style.fontFamily=t),r.innerHTML=NH.inHTMLData(i),document.body.appendChild(r);const o=FH("svg",{xmlns:"http://www.w3.org/2000/svg",width:r.offsetWidth+2,height:r.offsetHeight}),s=FH("text",u({x:r.offsetWidth/2,y:r.offsetHeight/2,style:`\n fill:${this.config.fontColor};\n text-anchor: middle;\n alignment-baseline:middle;\n opacity: ${this.config.opacity};\n font-size: ${n};\n `},t?{"font-family":t}:{}));return s.innerHTML=NH.inHTMLData(i),document.body.removeChild(r),o.appendChild(s),"data:image/svg+xml;base64, "+OH((new XMLSerializer).serializeToString(o))}_startRender(){switch(this.pauseAnimation=!1,this.config.displayType){case 0:this._fixedRender();break;case 1:this._startMove();break;case 2:this._startBlink()}this.observer[0]=this._attrObserver(this.img,["src","class"],"img"),this.observer[1]=this._attrObserver(this.wrap,["class","style","id"],"node"),this.observer[2]=this._attrObserver(this.root,["class","style"],"wrap"),this.observer[3]=this._domObserver(this.wrap),this.observer[4]=this._domObserver(this.root),this.observer[5]=this._domObserver(this.root.parentElement,!0)}_startMove(){var e;if(!this.img||!(null==(e=this.wrap)?void 0:e.clientWidth))return;const{offsetX:t,offsetY:i}=this._getOffset(),n=UH[this.config.tickerSpeed]||UH.MODERATE;let r=t,o=n,s=i,a=n;clearInterval(this.moveTimer),this.moveTimer=setInterval((()=>{if(this.pauseAnimation)return;const e=this._getOffsetThreshold();r+=o,s+=a,this.wrap.offsetWidth>this.img.offsetWidth&&r>this.wrap.offsetWidth&&(r=this.wrap.offsetWidth-this.img.offsetWidth),this.wrap.offsetHeight>this.img.offsetHeight&&s>this.wrap.offsetHeight&&(s=this.wrap.offsetHeight-this.img.offsetHeight),this.img.setAttribute("style",`position: relative;left:${r}px; top:${s}px`),r>=e.hRight&&(o=-n),r<=e.hLeft&&(o=n),s>=e.vBottom&&(a=-n),s<=e.vTop&&(a=n)}),30)}_startBlink(){const e=BH[this.config.tickerSpeed]||BH.MODERATE;clearInterval(this.blinkTimer),this._blinkRender(e,!0),this.blinkTimer=setInterval((()=>{this.pauseAnimation||this._blinkRender(e)}),1e3*e)}_randomBetween(e,t){const i=t-e+1;return Math.floor(Math.random()*i)+e}_fixedRender(){var e;if(!this.img||!(null==(e=this.wrap)?void 0:e.clientWidth))return;this.img.setAttribute("style","");const{offsetX:t,offsetY:i}=this._getOffset(),n=BH[this.config.tickerSpeed];return n?this.img.setAttribute("style",`opacity: 0.1;transform: translate(${t}px, ${i}px);animation: _xg_animation_blink ${n}s linear infinite;`):this.img.setAttribute("style",`opacity: 1;transform: translate(${t}px, ${i}px);`)}_getOffset(){const{left:e,top:t,right:i,bottom:n}=this.config,{clientWidth:r,clientHeight:o}=this.wrap,{clientWidth:s,clientHeight:a}=this.img;let l=0,u=0;return void 0!==i&&r&&(l=r-s-i),void 0!==e&&r&&(l=e),void 0!==n&&o&&(u=o-a-n),void 0!==t&&o&&(u=t),{offsetX:l,offsetY:u}}_getOffsetThreshold(){const{clientWidth:e,clientHeight:t}=this.wrap,{clientWidth:i,clientHeight:n}=this.img;return{hLeft:e-i>=0?0:e-i,hRight:e-i>=0?e-i:0,vTop:t-n>=0?0:t-n,vBottom:t-n>=0?t-n:0}}_blinkRender(e,t){var i;if(!this.img||!(null==(i=this.wrap)?void 0:i.clientWidth))return;if(this.img.setAttribute("style","opacity: 0.1;"),t){const{offsetX:t,offsetY:i}=this._getOffset();return this.img.setAttribute("style",`opacity: 0.1;transform: translate(${t}px, ${i}px);animation: _xg_animation_blink ${e}s linear 1;`)}const n=this._getOffsetThreshold(),{clientWidth:r,clientHeight:o}=this.wrap,s=r?this._randomBetween(n.hLeft,n.hRight):0,a=o?this._randomBetween(n.vTop,n.vBottom):0;setTimeout((()=>{this.img.setAttribute("style",`opacity: 0.1;transform: translate(${s}px, ${a}px);animation: _xg_animation_blink ${e}s linear 1;`)}),10)}_attrObserver(e,t,i){if(!e||!this.wrap||!window.MutationObserver)return;const n=new window.MutationObserver((t=>{e&&this.wrap&&t.forEach((t=>{if("class"===t.attributeName&&e.getAttribute("class")!=HH.class[i]&&e.setAttribute("class",HH.class[i]),"style"===t.attributeName&&e.getAttribute("style")!=HH.style[i]&&e.setAttribute("style",HH.style[i]),"img"===i&&"src"===t.attributeName){if(((null==e?void 0:e.getAttribute("src"))||"")!==this.imgSrc){const t=this._getWatermarkDom();this.wrap&&t&&(this.imgSrc=t,e.setAttribute("src",t))}}}))}));return n.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:t}),n}_domObserver(e,t){if(!e||!this.wrap)return;const i=new window.MutationObserver((i=>{e&&this.wrap&&i.forEach((i=>{i.removedNodes.forEach((i=>{if(!t)return e.appendChild(i);!e.getElementsByClassName(this.config.rootClassName).length&&e.appendChild(i)}))}))}));return i.observe(e,{childList:!0}),i}update(){const e=this._getWatermarkDom();this.wrap&&this.img&&e&&(this.imgSrc=e,this.img.setAttribute("src",e))}start(){if(!(this.root&&this.wrap&&this.img))return;clearInterval(this.moveTimer),clearInterval(this.blinkTimer),this.observer.forEach((e=>{var t;null==(t=null==e?void 0:e.disconnect)||t.call(e)})),this.wrap.innerHTML="",this.wrap.setAttribute("style",MH);const e=this._getWatermarkDom();e&&(this.img.src=e,this.img.style.opacity="0",this.img.alt="",this.imgSrc=e,this.wrap.appendChild(this.img),setTimeout((()=>this._startRender())))}pause(){this.pauseAnimation=!0}resume(){this.pauseAnimation=!1}resize(){}destroy(){clearInterval(this.moveTimer),clearInterval(this.blinkTimer),this.observer.forEach((e=>{var t;null==(t=null==e?void 0:e.disconnect)||t.call(e)})),this.img=null,this.wrap.innerHTML="",this.wrap=null}}const VH="xg-dynamic-watermark";function KH(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.5 0.199997C8.5 0.0895386 8.5896 0 8.69995 0H9.30005C9.4104 0 9.5 0.0895386 9.5 0.199997V1.8C9.5 1.91046 9.4104 2 9.30005 2H8.69995C8.5896 2 8.5 1.91046 8.5 1.8V0.199997Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.95424C0 1.85173 0.0773926 1.76582 0.179443 1.75529L7.27954 1.02277C7.34546 1.01596 7.40649 1.04182 7.44751 1.08664C7.47998 1.12207 7.5 1.16936 7.5 1.22171V14.7783C7.5 14.8969 7.39746 14.9894 7.27954 14.9773L0.179443 14.2447C0.0773926 14.2342 0 14.1483 0 14.0458V1.95424ZM1.5 12.873V3.12701L6 2.66273V13.3373L1.5 12.873Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M18 1.95424C18 1.85173 17.9226 1.76582 17.8206 1.75529L10.7205 1.02277C10.6025 1.01059 10.5 1.10313 10.5 1.22171V14.7783C10.5 14.8969 10.6025 14.9894 10.7205 14.9773L17.8206 14.2447C17.9226 14.2342 18 14.1483 18 14.0458V1.95424ZM16.5 3.12701L12 2.66273V13.3373L16.5 12.873V3.12701Z" fill="white"/>\n <path d="M8.69995 3C8.5896 3 8.5 3.08954 8.5 3.2V4.8C8.5 4.91046 8.5896 5 8.69995 5H9.30005C9.32642 5 9.35156 4.9949 9.37451 4.98564C9.39111 4.97896 9.40674 4.97011 9.4209 4.95944C9.46899 4.92293 9.5 4.8651 9.5 4.8V3.2C9.5 3.14664 9.47925 3.09818 9.44507 3.06232C9.40869 3.02393 9.35718 3 9.30005 3H8.69995Z" fill="white"/>\n <path d="M8.5 6.2C8.5 6.08954 8.5896 6 8.69995 6H9.30005C9.34277 6 9.38232 6.01344 9.41479 6.03635C9.46631 6.07254 9.5 6.13234 9.5 6.2V7.8C9.5 7.85072 9.48096 7.89703 9.44995 7.9323C9.41821 7.96826 9.37354 7.99272 9.32373 7.99861C9.31592 7.99953 9.30811 8 9.30005 8H8.69995C8.5896 8 8.5 7.91046 8.5 7.8V6.2Z" fill="white"/>\n <path d="M8.53711 9.08395C8.51367 9.11667 8.5 9.15674 8.5 9.20001V10.8C8.5 10.9105 8.5896 11 8.69995 11H9.30005C9.4104 11 9.5 10.9105 9.5 10.8V9.20001C9.5 9.08954 9.4104 9 9.30005 9H8.69995C8.68384 9 8.66821 9.00189 8.65332 9.00546C8.60571 9.01688 8.5647 9.04529 8.53711 9.08395Z" fill="white"/>\n <path d="M8.5 12.2C8.5 12.1371 8.52905 12.081 8.57446 12.0443C8.60864 12.0166 8.65234 12 8.69995 12H9.30005C9.4104 12 9.5 12.0895 9.5 12.2V13.8C9.5 13.8664 9.46753 13.9253 9.41772 13.9616C9.38477 13.9857 9.34399 14 9.30005 14H8.69995C8.5896 14 8.5 13.9105 8.5 13.8V12.2Z" fill="white"/>\n <path d="M8.69995 15C8.5896 15 8.5 15.0895 8.5 15.2V15.8C8.5 15.9105 8.5896 16 8.69995 16H9.30005C9.4104 16 9.5 15.9105 9.5 15.8V15.2C9.5 15.0895 9.4104 15 9.30005 15H8.69995Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}function GH(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.5 0.2C8.5 0.0895431 8.58954 0 8.7 0H9.3C9.41046 0 9.5 0.0895431 9.5 0.2V1.8C9.5 1.91046 9.41046 2 9.3 2H8.7C8.58954 2 8.5 1.91046 8.5 1.8V0.2Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.95424C0 1.85173 0.0775055 1.76582 0.179474 1.7553L7.27947 1.02276C7.39742 1.01059 7.5 1.10313 7.5 1.2217V14.7783C7.5 14.8969 7.39742 14.9894 7.27947 14.9773L0.179474 14.2447C0.0775053 14.2342 0 14.1483 0 14.0458V1.95424ZM1.5 12.873V3.12702L6 2.66273V13.3373L1.5 12.873Z" fill="white"/>\n <path d="M17.8205 1.7553C17.9225 1.76582 18 1.85173 18 1.95424V14.0458C18 14.1483 17.9225 14.2342 17.8205 14.2447L10.7205 14.9773C10.6026 14.9894 10.5 14.8969 10.5 14.7783V1.2217C10.5 1.10313 10.6026 1.01059 10.7205 1.02276L17.8205 1.7553Z" fill="white"/>\n <path d="M8.7 3C8.58954 3 8.5 3.08954 8.5 3.2V4.8C8.5 4.91046 8.58954 5 8.7 5H9.3C9.41046 5 9.5 4.91046 9.5 4.8V3.2C9.5 3.08954 9.41046 3 9.3 3H8.7Z" fill="white"/>\n <path d="M8.5 6.2C8.5 6.08954 8.58954 6 8.7 6H9.3C9.41046 6 9.5 6.08954 9.5 6.2V7.8C9.5 7.91046 9.41046 8 9.3 8H8.7C8.58954 8 8.5 7.91046 8.5 7.8V6.2Z" fill="white"/>\n <path d="M8.7 9C8.58954 9 8.5 9.08954 8.5 9.2V10.8C8.5 10.9105 8.58954 11 8.7 11H9.3C9.41046 11 9.5 10.9105 9.5 10.8V9.2C9.5 9.08954 9.41046 9 9.3 9H8.7Z" fill="white"/>\n <path d="M8.5 12.2C8.5 12.0895 8.58954 12 8.7 12H9.3C9.41046 12 9.5 12.0895 9.5 12.2V13.8C9.5 13.9105 9.41046 14 9.3 14H8.7C8.58954 14 8.5 13.9105 8.5 13.8V12.2Z" fill="white"/>\n <path d="M8.7 15C8.58954 15 8.5 15.0895 8.5 15.2V15.8C8.5 15.9105 8.58954 16 8.7 16H9.3C9.41046 16 9.5 15.9105 9.5 15.8V15.2C9.5 15.0895 9.41046 15 9.3 15H8.7Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}const{POSITIONS:WH}=bs,YH="getMirror",zH="exitMirror";class $H extends bs{constructor(e){super(e),this.memoryId="",this.shouldShowToast=!1,this.saveTimeFun=Ur.checkIsFunction(this.config.saveTime)?this.config.saveTime:this.saveTimeByStorage,this.getTimeFun=Ur.checkIsFunction(this.config.getTime)?this.config.getTime:this.getTimeByStorage,this.startTime=0,this.memoryId=this.config.memoryId,this.showToast=this.showToast.bind(this),this.saveTime=this.saveTime.bind(this),this.visibilitychangeCallback=this.visibilitychangeCallback.bind(this)}static get pluginName(){return"memoryPlay"}static get defaultConfig(){return{getTime:null,saveTime:null,memoryId:"",minStartTime:1,minEndTime:1}}registerLanguageTexts(){return{preText:{jp:"に位置付けられました",en:"Has located for you to ",zh:"已为您定位至","zh-hk":"已為您定位至"}}}children(){return{toast:Ax}}afterCreate(){this.once(eo,this.showToast),this.on(to,(()=>{this.curTime=this.player.currentTime}))}beforePlayerInit(){return this.memoryId||(this.playerConfig.vid?this.memoryId=this.playerConfig.vid:this.player.url&&(this.memoryId=this.player.url.replace(/\?.*$/,""))),this.setSave(),this.getTime()}getTime(){return new Promise((e=>{const t=(i=this.getTimeFun(this.memoryId))&&i.then?i:new Promise((e=>{e(i)}));var i;t.then((t=>{var i,n,r,o,s,a;const l=function(e,t=0){const i=parseFloat(e);return Number.isNaN(i)?t:i}(t);!isNaN(l)&&l>0?(this.startTime=l,this.shouldShowToast=!0,this.playerConfig.startTime=this.startTime,(null==(r=null==(n=null==(i=this.player.plugins)?void 0:i.hls)?void 0:n.hls)?void 0:r.config)&&(this.player.plugins.hls.hls.config.startTime=this.startTime),(null==(a=null==(s=null==(o=this.player.plugins)?void 0:o.encrypthlsplugin)?void 0:s.hls)?void 0:a.config)&&(this.player.plugins.encrypthlsplugin.hls.config.startTime=this.startTime)):aa.warn("the time got is invalid",t),e()})).catch((t=>{aa.error("getTime function occur error",t),e()}))}))}saveTime(){var e;if(!this.player)return;const{minStartTime:t=1,minEndTime:i=1}=this.config,{currentTime:n,duration:r}=this.player,o=null!=(e=null!=n?n:this.curTime)?e:0;r&&(o<t||Math.abs(r-o)<i?this.saveTimeFun(this.memoryId,0):this.saveTimeFun(this.memoryId,o))}visibilitychangeCallback(){"hidden"===document.visibilityState&&this.saveTime()}setSave(){this.on(qr,this.saveTime.bind(this)),this.on(Zr,this.saveTime.bind(this)),document.addEventListener("visibilitychange",this.visibilitychangeCallback.bind(this)),document.addEventListener("pagehide",this.saveTime.bind(this)),window.addEventListener("beforeunload",this.saveTime.bind(this))}showToast(){var e;if(this.shouldShowToast){this.shouldShowToast=!1;const t=null==(e=this.player)?void 0:e.getPlugin("sdkToastPlugin");if(!t)return;if(this.startTime>0){const e=Ur.format(this.startTime);t.add(`${this.langText.preText}${e}`,4e3,!0)}}}saveTimeByStorage(e,t){Ca(e,$H.pluginName,t+"")}getTimeByStorage(e){return Ia(e,$H.pluginName)||0}destroy(){this.saveTime(),document.removeEventListener("visibilitychange",this.visibilitychangeCallback),document.removeEventListener("pagehide",this.saveTime),window.removeEventListener("beforeunload",this.saveTime)}}function XH(){return(new DOMParser).parseFromString('<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#filter0_dii_340_912)">\n<path d="M4.00011 7.66678C4.00005 5.82578 5.49245 4.33333 7.33344 4.33333H23.3742H32.6657C34.5066 4.33333 35.999 5.82572 35.999 7.66667V13.5764L35.9998 32.3332C35.9999 34.1742 34.5075 35.6667 32.6665 35.6667H7.33423C5.49332 35.6667 4.00096 34.1743 4.0009 32.3334L4.00011 7.66678Z" fill="url(#paint0_linear_340_912)"/>\n<path d="M4.10011 7.66677C4.10005 5.88101 5.54768 4.43333 7.33344 4.43333H23.3742H32.6657C34.4514 4.43333 35.899 5.88095 35.899 7.66667V13.5764L35.8998 32.3332C35.8999 34.119 34.4523 35.5667 32.6665 35.5667H7.33423C5.54855 35.5667 4.10095 34.1191 4.1009 32.3334L4.10011 7.66677Z" stroke="url(#paint1_linear_340_912)" stroke-width="0.2"/>\n</g>\n<path d="M6.76669 9.66667C6.76669 8.24914 7.91582 7.1 9.33335 7.1H30.6667C32.0842 7.1 33.2334 8.24914 33.2334 9.66667V30.3333C33.2334 31.7509 32.0842 32.9 30.6667 32.9H9.33335C7.91582 32.9 6.76669 31.7509 6.76669 30.3333V9.66667Z" fill="url(#paint2_linear_340_912)" stroke="url(#paint3_linear_340_912)" stroke-width="0.2"/>\n<g filter="url(#filter1_dii_340_912)">\n<path d="M15.4689 18.4428L10.9398 27.4593C10.6614 28.0134 11.0643 28.6667 11.6845 28.6667H27.8647C28.5118 28.6667 28.912 27.9614 28.5801 27.4059L25.3326 21.9703C25.0217 21.4499 24.2769 21.425 23.932 21.9235L21.1839 25.8946C21.1128 25.9973 20.9581 25.9882 20.8996 25.8778L16.9499 18.4266C16.6329 17.8285 15.7728 17.8379 15.4689 18.4428Z" fill="url(#paint4_linear_340_912)"/>\n<path d="M15.4689 18.4428L10.9398 27.4593C10.6614 28.0134 11.0643 28.6667 11.6845 28.6667H27.8647C28.5118 28.6667 28.912 27.9614 28.5801 27.4059L25.3326 21.9703C25.0217 21.4499 24.2769 21.425 23.932 21.9235L21.1839 25.8946C21.1128 25.9973 20.9581 25.9882 20.8996 25.8778L16.9499 18.4266C16.6329 17.8285 15.7728 17.8379 15.4689 18.4428Z" stroke="url(#paint5_linear_340_912)" stroke-width="0.166667"/>\n</g>\n<g filter="url(#filter2_dii_340_912)">\n<circle cx="23.6667" cy="14.6667" r="2" fill="url(#paint6_linear_340_912)"/>\n<circle cx="23.6667" cy="14.6667" r="2" stroke="url(#paint7_linear_340_912)" stroke-width="0.166667"/>\n</g>\n<defs>\n<filter id="filter0_dii_340_912" x="3.8431" y="4.17631" width="32.6278" height="32.1184" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.157018" dy="0.314036"/>\n<feGaussianBlur stdDeviation="0.157018"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.0684375 0 0 0 0 0.0704062 0 0 0 0 0.075 0 0 0 0.5 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_340_912"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_340_912" result="shape"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.471054" dy="0.471054"/>\n<feGaussianBlur stdDeviation="0.157018"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.355764 0 0 0 0 0.368819 0 0 0 0 0.391667 0 0 0 1 0"/>\n<feBlend mode="normal" in2="shape" result="effect2_innerShadow_340_912"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="-0.471054" dy="-0.471054"/>\n<feGaussianBlur stdDeviation="0.0785089"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.191389 0 0 0 0 0.197708 0 0 0 0 0.216667 0 0 0 1 0"/>\n<feBlend mode="normal" in2="effect2_innerShadow_340_912" result="effect3_innerShadow_340_912"/>\n</filter>\n<filter id="filter1_dii_340_912" x="10.4333" y="17.5669" width="18.6828" height="11.6831" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dy="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.0823529 0 0 0 0 0.0901961 0 0 0 0 0.105882 0 0 0 1 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_340_912"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_340_912" result="shape"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.930313 0 0 0 0 0.935083 0 0 0 0 0.954167 0 0 0 1 0"/>\n<feBlend mode="normal" in2="shape" result="effect2_innerShadow_340_912"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="-0.166667" dy="-0.333333"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.409097 0 0 0 0 0.443509 0 0 0 0 0.570833 0 0 0 1 0"/>\n<feBlend mode="normal" in2="effect2_innerShadow_340_912" result="effect3_innerShadow_340_912"/>\n</filter>\n<filter id="filter2_dii_340_912" x="21.25" y="12.25" width="4.83329" height="5.00001" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dy="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.0823529 0 0 0 0 0.0901961 0 0 0 0 0.105882 0 0 0 1 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_340_912"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_340_912" result="shape"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="0.166667"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.930313 0 0 0 0 0.935083 0 0 0 0 0.954167 0 0 0 1 0"/>\n<feBlend mode="normal" in2="shape" result="effect2_innerShadow_340_912"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dx="-0.166667" dy="-0.333333"/>\n<feGaussianBlur stdDeviation="0.166667"/>\n<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0.364583 0 0 0 0 0.397828 0 0 0 0 0.520833 0 0 0 1 0"/>\n<feBlend mode="normal" in2="effect2_innerShadow_340_912" result="effect3_innerShadow_340_912"/>\n</filter>\n<linearGradient id="paint0_linear_340_912" x1="30.2254" y1="8.17498" x2="11.4982" y2="41.5657" gradientUnits="userSpaceOnUse">\n<stop stop-color="#434548"/>\n<stop offset="0.855332" stop-color="#3E3F42"/>\n</linearGradient>\n<linearGradient id="paint1_linear_340_912" x1="7.52649" y1="1.8673" x2="25.0283" y2="33.3887" gradientUnits="userSpaceOnUse">\n<stop stop-color="#383838"/>\n<stop offset="0.192009" stop-color="#45484D"/>\n<stop offset="0.703503" stop-color="#37393D"/>\n<stop offset="0.962692" stop-color="#1B1C1E"/>\n</linearGradient>\n<linearGradient id="paint2_linear_340_912" x1="28.5212" y1="10.1877" x2="13.0162" y2="37.9513" gradientUnits="userSpaceOnUse">\n<stop stop-color="#2E2F32"/>\n<stop offset="0.855332" stop-color="#242528"/>\n</linearGradient>\n<linearGradient id="paint3_linear_340_912" x1="9.60543" y1="4.95372" x2="24.0954" y2="31.1622" gradientUnits="userSpaceOnUse">\n<stop stop-color="#1F2124"/>\n<stop offset="0.192009" stop-color="#282B30"/>\n<stop offset="0.703503" stop-color="#27292F"/>\n<stop offset="0.962692" stop-color="#1D1F23"/>\n</linearGradient>\n<linearGradient id="paint4_linear_340_912" x1="16.969" y1="16.5412" x2="22.5457" y2="28.6249" gradientUnits="userSpaceOnUse">\n<stop stop-color="#C7CCE2"/>\n<stop offset="1" stop-color="#8B95BC"/>\n</linearGradient>\n<linearGradient id="paint5_linear_340_912" x1="17.5125" y1="20.3581" x2="20.121" y2="28.4669" gradientUnits="userSpaceOnUse">\n<stop offset="0.181113" stop-color="#B1B7D3"/>\n<stop offset="1" stop-color="#535C80"/>\n</linearGradient>\n<linearGradient id="paint6_linear_340_912" x1="23.0637" y1="12.5093" x2="25.4773" y2="15.7207" gradientUnits="userSpaceOnUse">\n<stop stop-color="#B8BED6"/>\n<stop offset="1" stop-color="#7E88AD"/>\n</linearGradient>\n<linearGradient id="paint7_linear_340_912" x1="23.1781" y1="13.818" x2="24.4392" y2="16.2252" gradientUnits="userSpaceOnUse">\n<stop offset="0.181113" stop-color="#B1B7D3"/>\n<stop offset="1" stop-color="#495274"/>\n</linearGradient>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}class qH{constructor(e){this.config=e.config,this.parent=e.root,this.root=Ur.createDom("ul","",{},`xg-play-list xg-list-slide-scroll ${this.config.className}`);const t="mobile"===Kr.device?"touchend":"click";this.modal=Ur.createDom("div","",{},"xg-play-list-modal"),this.modal.appendChild(this.root),e.root.appendChild(this.modal),this._delegates=bs.delegate.call(this,this.modal,".xg-play-list-modal",t,this.modalClick.bind(this));const{maxHeight:i}=this.config;i&&this.setStyle({maxHeight:i}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList(),this._delegates.concat(bs.delegate.call(this,this.root,"li",t,this.onItemClick))}renderItemList(e){const{config:t,root:i}=this;e?t.data=e:e=t.data,t.style&&Object.keys(t.style).map((e=>{i.style[e]=t[e]})),e.length>0&&(this.attrKeys=Object.keys(e[0])),this.root.innerHTML="",e.map(((e,t)=>{const i=e.selected?"xg-play-list-item selected":"xg-play-list-item";e["data-index"]=t;const n=e.duration?Ur.format(e.duration):"",r=`\n <div style="${e.poster?`background-image: url('${e.poster}')`:""}" class="xg-play-list-poster ${e.selected?"is-active":""} ${e.poster?"":"no-poster"}" >\n <div class="bg"></div>\n <div class="icon"></div>\n <div class="duration">${n}</div>\n <duv class="playing">\n <div class="icon-wrap">\n <div class="icon-line"></div>\n <div class="icon-line"></div>\n <div class="icon-line"></div>\n <div class="icon-line"></div>\n </div>\n </duv>\n </div>\n <div class="xg-play-list-title">\n <div class="xg-play-list-title-text">${e.title}</div>\n </div>\n `,o=Ur.createDom("li",r,e,i),s=Ur.findDom(o,".bg"),a=null==XH?void 0:XH();!e.poster&&a&&s.appendChild(a),this.root.appendChild(o)}));const n=e.findIndex((e=>e.selected));if(n>=0){const t=Ur.findDom(this.root,".xg-play-list-item.selected");if(!t)return;const{height:i}=t.getBoundingClientRect(),{height:r}=this.root.getBoundingClientRect(),o=(e.length-n)*i,s=i*e.length;this.root.scrollTop=o<r?s-r:n*i}}onItemClick(e){e.delegateTarget||(e.delegateTarget=e.target);const t=e.delegateTarget;if(t&&Ur.hasClass(t,"selected"))return!1;const i="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");Ur.addClass(t,"selected"),n&&Ur.removeClass(n,"selected"),i&&i(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}getAttrObj(e,t){if(!e||!t)return{};const i={};t.map((t=>{i[t]=e.getAttribute(t)}));const n=e.getAttribute("data-index");return n&&(i.index=Number(n)),i}show(){Ur.removeClass(this.modal,"hide"),Ur.addClass(this.modal,"active"),Ur.removeClass(this.root,"hide"),Ur.addClass(this.root,"active")}hide(){Ur.removeClass(this.modal,"active"),Ur.addClass(this.modal,"hide"),Ur.removeClass(this.root,"active"),Ur.addClass(this.root,"hide")}modalClick(e){e.stopPropagation(),this.hide();const t="function"==typeof this.config.onModalClick?this.config.onModalClick:null;t&&t(e)}setStyle(e){Object.keys(e).forEach((t=>{this.root.style[t]=e[t]}))}destroy(){this._delegates&&(this._delegates.map((e=>{e.destroy&&e.destroy()})),this._delegates=null),this.root.parentNode.removeChild(this.root),this.root.innerHTML=null,this.root=null}}function QH(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M12.8499 8.49494C13.7054 8.98885 14.1331 9.23581 14.2767 9.55822C14.4019 9.83944 14.4019 10.1606 14.2767 10.4418C14.1331 10.7642 13.7054 11.0112 12.8499 11.5051L6.65863 15.0796C5.80315 15.5735 5.37542 15.8205 5.02442 15.7836C4.71827 15.7514 4.44016 15.5909 4.25921 15.3418C4.05177 15.0563 4.05177 14.5624 4.05177 13.5746V6.42547C4.05177 5.43765 4.05177 4.94374 4.25921 4.65822C4.44016 4.40917 4.71827 4.2486 5.02442 4.21642C5.37542 4.17953 5.80315 4.42649 6.65863 4.92039L12.8499 8.49494Z" fill="white"/>\n<rect x="13.8274" y="4.02594" width="2.17238" height="11.9481" rx="0.814644" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}function ZH(){return(new DOMParser).parseFromString('<svg width="21" height="22" viewBox="0 0 21 22" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#filter0_d_126_721)">\n<path d="M8.18979 6.3414C8.60304 6.57999 8.80967 6.69928 8.87901 6.85503C8.93949 6.99088 8.93949 7.14601 8.87901 7.28186C8.80967 7.4376 8.60304 7.5569 8.18979 7.79549L5.59253 9.29502C5.17928 9.53361 4.97266 9.6529 4.80311 9.63508C4.65522 9.61954 4.52087 9.54197 4.43346 9.42167C4.33325 9.28374 4.33325 9.04515 4.33325 8.56797V5.56891C4.33325 5.09173 4.33325 4.85314 4.43346 4.71522C4.52087 4.59491 4.65522 4.51735 4.80311 4.5018C4.97266 4.48398 5.17928 4.60328 5.59253 4.84187L8.18979 6.3414Z" fill="white"/>\n</g>\n<path d="M11.5264 7.19745H18" stroke="white" stroke-width="1.61843" stroke-linecap="round"/>\n<path d="M5.05273 12.5922L18.0001 12.5922" stroke="white" stroke-width="1.61843" stroke-linecap="round"/>\n<path d="M5.05273 17.9869L18.0001 17.9869" stroke="white" stroke-width="1.61843" stroke-linecap="round"/>\n<defs>\n<filter id="filter0_d_126_721" x="0.736733" y="0.903543" width="11.7841" height="12.3298" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset/>\n<feGaussianBlur stdDeviation="1.79826"/>\n<feComposite in2="hardAlpha" operator="out"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_126_721"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_126_721" result="shape"/>\n</filter>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}const JH="playListNext",eF="playListToggle",tF="mobile"===Kr.device;function iF(e=[]){if(!Array.isArray(e))return[];return e.filter((e=>e.url||e.playAuthToken)).map(((e,t)=>{const i=u({},e||{});return i.vid||(i.vid=""+t),i}))}function nF(e=[],t=0){const i=Number(t),n=Number.isNaN(i)?0:i;let r=0;return r=n<=0?0:n<e.length?n:0,r<0?0:r}wD.prototype.setVodPlayListConfig=function(e){if(!(e.plugins||[]).find((e=>e.pluginName===rF.pluginName)))return;const t=Wa(e,"playListPlugin");if(t&&function(e){const t=typeof e;return null!==e&&("object"===t||"function"===t)}(t)){const{list:i=[],defaultIndex:n=0}=t,r=iF(i),o=nF(r,n),s=null==r?void 0:r[o];if(s){const{url:t,poster:i,playAuthToken:n}=s;n?e.getVideoByToken=c(u({},e.getVideoByToken||{}),{playAuthToken:n}):t&&(e.url=t),i&&(e.poster=i)}}};class rF extends bs{constructor(){super(...arguments),this.timer=null,this.onEnter=e=>{e.stopPropagation(),this.emit("icon_mouseenter",{pluginName:this.pluginName}),this.switchActiveState(e)},this.switchActiveState=e=>{e.stopPropagation();const{toggleMode:t}=this.config;"click"===t?this.toggle(!this.isActive):this.toggle(!0)},this.handleNext=e=>{e.stopPropagation(),this.next()},this._onTimeUpdate=()=>{const{player:e}=this;!this.halfPass&&e.currentTime>e.duration/2&&this.confirmOrder()},this._onEnded=()=>{if("order"===this.mode&&this.curIndex+1>=this.list.length)return this.player.pause(),void(this.player.currentTime=0);this.next()},this.onLeave=e=>{e.stopPropagation(),this.emit("icon_mouseleave",{pluginName:this.pluginName}),this.isActive&&this.toggle(!1)}}static get pluginName(){return"playListPlugin"}static get defaultConfig(){return{position:bs.POSITIONS.CONTROLS_LEFT,index:$D,list:[],mode:"order",defaultIndex:0,isItemClickHide:!0,toggleMode:"click"}}beforeCreate(e){Object.values(bs.POSITIONS).includes(e.position)||(e.root=e.player.controls.left,e.config.position=bs.POSITIONS.CONTROLS_LEFT,e.position=bs.POSITIONS.CONTROLS_LEFT)}afterCreate(){const{config:e}=this,{list:t=[],mode:i,defaultIndex:n}=e||{};this.initIcons(),this.halfPass=!1,this.list=iF(t),this.timer=setTimeout((()=>{this.emit(FD.PLAY_LIST_CHANGE,this.list)})),this.disable=!(t.length>0),this.mode=i,this.curIndex=nF(this.list,n),this.curIndex>0?(this.nextIndex=this.curIndex+1<this.list.length?this.curIndex+1:0,this.prevIndex=this.curIndex-1):(this.nextIndex=1,this.prevIndex=this.list.length-1),this.on(to,this._onTimeUpdate),this.on(qr,this._onEnded),this.on([Lo,Io],(()=>{this._resizeList()})),this.once(no,(()=>{this.list&&this.list.length>0&&(this.renderItemList(),this.show())})),tF&&this.on(ho,(()=>{this.isActive&&(this.optionsList&&this.optionsList.hide(),this.isActive=!1)})),tF?(e.toggleMode="click",this.activeEvent="touchend"):this.activeEvent="click"===e.toggleMode?"click":"mouseenter",this.bind(".xg-play-next-btn","click",this.handleNext),"click"===e.toggleMode?this.bind(".xg-play-list-btn",this.activeEvent,this.switchActiveState):(this.bind(".xg-play-list-btn",this.activeEvent,this.onEnter),this.bind(".xg-play-list-btn","mouseleave",this.onLeave))}registerLanguageTexts(){return{playNext:{jp:"次に遊ぶ",en:"play next",zh:"播放下一个","zh-hk":"播放下一個"},playList:{jp:"プレイリスト",en:"playList",zh:"播放列表","zh-hk":"播放清單"}}}registerIcons(){return{[JH]:{icon:QH,class:"xg-play-next-btn"},[eF]:{icon:ZH,class:"xg-play-list-btn"}}}initIcons(){const{icons:e}=this;this.appendChild(".xg-play-next-btn",e[JH]),this.appendChild(".xg-play-list-btn",e[eF])}show(){!this.list||this.list.length<1||Ur.addClass(this.root,"show")}hide(){Ur.removeClass(this.root,"show")}prev(){this.disable||(this.halfPass||(this.halfPass=!0,this._prevCompute()),this.curIndex=this.prevIndex,this.change())}next(){this.disable||(this.halfPass||(this.halfPass=!0,this._nextCompute()),this.curIndex=this.nextIndex,this.change())}changeList(e){this.player.currentTime=0,this.list=iF(e),this.nextIndex=0,this.curIndex=0,this.change(),this.disable=!(this.list.length>0),this.emit(FD.PLAY_LIST_CHANGE,this.list)}setIndex(e){e<0||e>=this.list.length||(this.nextIndex=e+1<this.list.length?e+1:0,this.prevIndex=e-1<0?this.list.length-1:e-1,this.curIndex=e,this.change())}change(){if(this.disable)return;const{player:e,list:t,curIndex:i}=this;this.halfPass=!1;const{url:n,playAuthToken:r,title:o="",vid:s="",poster:a=""}=t[i];this.curInfo={url:n,playAuthToken:r,title:o,vid:s,poster:a};const l=e.sdk||e;r?l.playNext({vid:s,poster:a,autoplay:!0,getVideoByToken:{playAuthToken:r}}):l.playNext({vid:s,poster:a,autoplay:!0,url:n}),this.renderItemList(),e.off("timeupdate",this._emitChange.bind(this)),e.once("timeupdate",this._emitChange.bind(this))}confirmOrder(){this.halfPass=!0,this._nextCompute(),this._prevCompute()}_nextCompute(){this.disable||(this.curIndex+1<this.list.length?this.nextIndex=this.curIndex+1:this.nextIndex=0)}_prevCompute(){this.disable||(this.curIndex-1>=0?this.prevIndex=this.curIndex-1:this.prevIndex=this.list.length-1)}_emitChange(){this.emit(FD.PLAY_LIST_ITEM_CHANGE,this.curInfo)}toggle(e){if(e===this.isActive)return;const{controls:t}=this.player;e?(t.blur(),this.optionsList&&this.optionsList.show()):(t.focus(),this.optionsList&&this.optionsList.hide()),this.isActive=e}onItemClick(e,t){e.stopPropagation(),this.curIndex=t.to.index,this.change(),this.toggle(!1)}renderItemList(e){const{list:t,config:i,optionsList:n,player:r}=this;"number"==typeof e&&(this.curIndex=e,this.curInfo=t[e]);const o=t.map(((t,i)=>{const n=c(u({},t),{selected:!1});return i===this.curIndex&&(n.selected=!0,e=i),n}));if(n)return void n.renderItemList(o);const s={config:{data:o,className:"xg-side-play-list",onItemClick:(e,t)=>{this.onItemClick(e,t)},onModalClick:()=>{this.toggle(!1)}},root:r.innerContainer||r.root},{height:a}=this.player.root.getBoundingClientRect(),l=a;l&&i.heightLimit&&(s.config.maxHeight=`${l}px`),this.optionsList=new qH(s),this.show(),this._resizeList()}_resizeList(){if(!this.config.heightLimit)return;const{height:e}=this.player.root.getBoundingClientRect(),t=e;this.optionsList&&this.optionsList.setStyle({maxHeight:`${t}px`})}destroy(){const{config:e}=this;"click"===e.toggleMode?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null),this.timer&&(clearTimeout(this.timer),this.timer=null)}set disable(e){this._disable=e,e?(this.hide(),this.optionsList&&this.optionsList.hide()):this.show()}get disable(){return this._disable}render(){if(!this.disable)return`<xg-icon class="xg-options-icon xg-play-list-btn-container ${this.config.className||""}">\n <div class="xgplayer-icon xg-play-next-btn">\n <div class="xg-tips" lang-key="playNext">${this.langText.playNext}</div>\n </div>\n <div class="xgplayer-icon xg-play-list-btn">\n <div class="xg-tips" lang-key="playList">${this.langText.playList}</div>\n </div>\n </xg-icon>`}}return Object.assign(yH,{Events:KD,Event:VD,DefinitionDemotePlugin:class extends bs{constructor(e){super(e),this.waitings=[],this.longWaitingEmitTime=0,this.waitingStartTime=0,this.playerData=null,this.playerData=this.playerConfig.playerData}static get pluginName(){return"DefinitionDemotePlugin"}static get defaultConfig(){return{isNeedAutoDemote:!0,toastShowTime:3e3,demotePriority:[],isNeedShowTips:!0,oftenWaitingCount:3,oftenWaitingTime:5e3,longWaitingTime:5e3}}registerLanguageTexts(){return{definition_demote_txt:{jp:"現在のネットワークは不安定です。に切り替えることをお勧めします",en:"The current network is unstable, it is recommended to switch to ",zh:"当前网络不稳定,建议切换到","zh-hk":"當前網絡不穩定,建議切換到"}}}afterCreate(){this.bindCtx(),this.bindEvents()}bindCtx(){this._count=this._count.bind(this),this._time=this._time.bind(this),this._waiting=this._waiting.bind(this),this._clearTime=this._clearTime.bind(this),this.demote=this.demote.bind(this)}bindEvents(){this.on(io,this._waiting),this.on(Qr,this._clearTime),this.on($r,this._clearTime),this.on(wo,this._clearTime),this.on(FD.PlAY_URL_CHANGE,this._clearTime),this.config.isNeedAutoDemote&&this.player.on(FD.LONG_WAITING,this.demote)}_waiting(){this._count(),this._time()}_count(){const e=Date.now();this.waitings.push(e);const{oftenWaitingCount:t,oftenWaitingTime:i}=this.config;if(this.waitings.length>=t){const n=this.waitings.shift();n&&e-n<=i&&(aa.warn(`stuttering occurred at least ${t} times within ${i}ms`),this.player.emit(FD.OFTEN_WAITING)),this.clearState()}}_time(){if(this.timer)return void aa.log("The stuttering was triggered continuously, and the interval since the last stuttering was ",Date.now()-this.waitingStartTime+"ms");this.waitingStartTime=Date.now();const e=this.player.currentTime;this.timer=setTimeout((()=>{this.player&&this.player.currentTime<=e+.1&&(aa.warn(`stuttering last more than ${this.config.longWaitingTime}ms`),this.player.emit(FD.LONG_WAITING),this.timer&&(clearTimeout(this.timer),this.timer=null),this.waitingStartTime&&(this.waitingStartTime=0))}),this.config.longWaitingTime)}_clearTime(){this.waitingStartTime&&aa.log("stuttering last for ",Date.now()-this.waitingStartTime+"ms"),this.clearState()}clearState(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.waitings.length>0&&(this.waitings=[]),this.waitingStartTime&&(this.waitingStartTime=0)}demote(){if(!this.player.checkBuffer(this.player.currentTime,{endDiff:.5,startDiff:.5})&&!this.player.isSeeking&&this.player.state===Ns.RUNNING&&this.player.currentTime>1){if(!this.playerData)return;const e=this.playerData.getNextDefinition(!0,this.config.demotePriority),t=null==e?void 0:e[0];if(!t||!t.url)return;const i=t.definition;if(!i)return;const{current:{definition:n}}=this.playerData;if(this.player.emit(FD.DEFINITION_DEMOTE,{currentDef:n,willChangeDef:i,next:t}),"auto"===n){const e=t.url;aa.log(`auto demote definition to ${t.definition}`),this.changeUrl(e)}else i!==n&&this.showToast(t)}else aa.log("stuttering but not need demote definition")}changeUrl(e){this.player&&e&&(this.player.config.url=e,this.player.switchURL(e,{seamless:!this.player.config.isLive}).then((()=>{aa.log(`auto demote definition switch url(${e}) success`)})),this.player.emit(FD.PlAY_URL_CHANGE,{url:e,from:"definition_demote"}))}showToast(e){var t;const i=null==(t=this.player)?void 0:t.getPlugin("sdkToastPlugin");if(!i)return;if(this.toastId&&(i.remove(this.toastId),this.toastId=null),!this.config.isNeedShowTips)return;const n=this.i18n[e.definitionTextKey]||e.definitionTextKey||e.definition,r=Ur.createDom("div",this.langText.definition_demote_txt,void 0,"toast-txt"),o=Ur.createDom("span",n,void 0,"toast-txt-bt");r.appendChild(o),this.toastId=i.add(r,this.config.toastShowTime,!0),o.addEventListener("click",(()=>{this.playerData&&(this.playerData.current.definition=e.definition,i.remove(this.toastId),this.toastId=null,aa.log(`user handle demote definition to ${e.definition}`))}))}destroy(){this.clearState()}},MirrorPlugin:class extends bs{constructor(e){super(e),this.isEnableMirror=!0,this.isEnableMirror=this.config.defaultEnable}static get pluginName(){return"mirrorPlugin"}static get defaultConfig(){return{position:WH.CONTROLS_RIGHT,index:YD,disable:!1,defaultEnable:!1}}afterCreate(){this.config.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.updateMirrorState(this.isEnableMirror))}registerIcons(){return{[YH]:{icon:KH,class:"xg-get-mirror"},[zH]:{icon:GH,class:"xg-exit-mirror"}}}initIcons(){const{icons:e}=this,t=this.find(".xgplayer-icon");t.appendChild(e[YH]),t.appendChild(e[zH])}registerLanguageTexts(){return{getMirror:{jp:"ミラーを開く",en:"Turn on mirroring",zh:"开启镜像","zh-hk":"開啟鏡像"},exitMirror:{jp:"ミラーを閉じる",en:"Turn off mirroring",zh:"关闭镜像","zh-hk":"關閉鏡像"}}}btnClick(e){e.preventDefault(),e.stopPropagation(),this.isEnableMirror?this.action(!1):this.action(!0)}action(e){this.isEnableMirror=e,this.updateMirrorState(this.isEnableMirror),this.player.emit(FD.MIRROR_CHANGE,this.isEnableMirror)}updateMirrorState(e){const t=this.player;e?t.addClass("xgplayer-mirror"):t.removeClass("xgplayer-mirror"),this.animate(e)}animate(e){this.root&&(e?this.setAttr("data-state","enable"):this.setAttr("data-state","normal"),this.switchTips(e))}switchTips(e){this.changeLangTextKey(this.find(".xg-tips"),e?zH:YH)}destroy(){this.unbind(["click","touchend"],this.btnClick)}render(){if(!this.config.disable)return`<xg-icon class='xgplayer-mirror-icon'>\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="mirror">${this.langText[YH]}</div>\n </xg-icon>`}},MemoryPlay:$H,Subtitle:Ix,DynamicWatermarkPlugin:class extends bs{constructor(e){super(e),this.wm=null}static get pluginName(){return"DynamicWatermark"}static get defaultConfig(){return{position:bs.POSITIONS.ROOT,displayType:1,tickerSpeed:void 0,fontSize:12,fontColor:"#ffffff",opacity:.3,enable:!1,top:void 0,left:void 0,right:void 0,bottom:void 0,content:""}}afterCreate(){this.config.enable&&(this._initWatermark(),this.once(to,(()=>{this.start()})),this.on(Lo,(()=>{this.resize()})))}start(){var e,t;null==(t=null==(e=this.wm)?void 0:e.start)||t.call(e)}pause(){var e,t;null==(t=null==(e=this.wm)?void 0:e.pause)||t.call(e)}resume(){var e,t;null==(t=null==(e=this.wm)?void 0:e.resume)||t.call(e)}resize(){var e,t;null==(t=null==(e=this.wm)?void 0:e.resize)||t.call(e)}_initWatermark(){this.wm=new jH(c(u({},this.config),{root:this.root,rootClassName:VH}))}destroy(){var e,t;null==(t=null==(e=this.wm)?void 0:e.destroy)||t.call(e),this.offAll()}render(){return`\n <xg-dynamic-watermark class=${VH} />\n `}},PlayListPlugin:rF,getI18N:function(){return Os},BasePlugin:cs,Plugin:bs,Sniffer:Kr,Util:Ur,STATE_CLASS:As,I18N:Os,STATES:Ns})}));
|