/*! For license information please see npm-d801507b.3e925c57aad30c4b2c66.js.LICENSE.txt */ (self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[6534],{26456:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>x,wA:()=>R});var r=n(22523),i=n(2303),o=n(4408),s=n.n(o),a=n(64821),l=n.n(a),u=n(12969),c=n.n(u),h=n(7569);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t2&&void 0!==arguments[2]&&arguments[2];return e<12?n?"am":"AM":n?"pm":"PM"}}),g="second",m="zero",v="one",y="few",_="many",T="other",b=[{relativeTimeKey:"y",num:11,unit:"month"},{relativeTimeKey:"M",num:3.5,unit:"week"},{relativeTimeKey:"w",num:6.5,unit:"day"},{relativeTimeKey:"d",num:22,unit:"hour"},{relativeTimeKey:"h",num:45,unit:"minute"},{relativeTimeKey:"m",num:45,unit:g},{relativeTimeKey:"s",num:0,unit:g}],S=new Set(["af","ar","az","bg","bn","ca","ceb","cs","da","de","el","en-GB","en","es-419","es","et","fi","fil","fr-CA","fr","ga","gu","he","hi","hr","hu","id","is","it","ja","jv","kk","km","kn","ko","lt","lv","ml","mr","ms","my","nb","nl","or","pa","pl","pt-BR","pt-PT","pt","ro","ru","sk","sl","sq","sv","sw","ta","te","th","tr","uk","ur","uz","vi","zh-Hans","zh-Hant"]),k=p.formats,P=function(e,t){switch(t){case"ar":return 0===e?m:1===e?v:2===e?"two":e%100>=3&&e%100<=10?y:e%100>10?_:T;case"bn":case"nl":case"en":case"fil":case"fi":case"de":case"el":case"hu":case"it":case"pt":case"es":case"sv":case"ta":case"tr":case"et":case"af":case"bg":case"ml":case"mr":case"or":case"sw":case"te":case"ur":case"uz":case"da":case"nb":return 1===e?v:T;case"ceb":return e%10==4||e%10==6||e%10==9?v:T;case"cs":return 1===e?v:e%10>=2&&e%10<=4?y:Number.isInteger(e)?T:_;case"fr":case"gu":case"hi":case"pa":case"kn":return 0===e||1===e?v:T;case"he":return 1===e?v:2===e?"two":0!==e&&e%10==0?_:T;case"pl":case"ru":case"uk":return 1===e?v:e%10>=2&&e%10<=4?y:Number.isInteger(e)?_:T;case"ro":return 1===e?v:0===e||e%100>=2&&e%100<=19?y:T;case"hr":return e%10==1?v:e%10==2||e%10==3||e%10==4?y:T;case"lt":return e%10==1?v:e%10==0?T:Number.isInteger(e)?y:_;case"lv":return e%10==0?m:e%10==1?v:T;case"sk":return e%10==1?v:e%10==2||e%10==3||e%10==4?y:Number.isInteger(e)?T:_;default:return T}},M=function(e,t,n){var r=t.prototype,i=e.justNowThreshold;r.getTimeExpression=function(e,t){var r=n(e),o=n(t),s=o.$locale(),a=s.justNow,l=s.today,u=s.tomorrow,c=s.yesterday;return Math.abs(r.diff(o,"ms",!0))<=i?a:r.isSame(o,"day")?l:r.add(1,"day").isSame(o,"day")?u:r.subtract(1,"day").isSame(o,"day")?c:""}};function R(e){var t,n=e.toLowerCase();if(S.forEach((function(e){e.toLowerCase()===n&&(t=e)})),t)return t;var r=n.split("-")[0];return S.has(r)?r:"en"}M.$i=!1,s().extend(c()),s().extend(l()),s().extend((function(e,t,n){var r=t.prototype,i=r.format;n.Ls.en.formats=k,r.format=function(){var e,t,n=(e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"YYYY-MM-DDTHH:mm:ssZ",t=this.$locale().formats,e.replace(/(\[[^\]]+])|(LTS?|lts?|L{2,4}\-Y|l{1,4}\-Y|LL\-D|l{1,4}|L{1,4})/g,(function(e,n,r){return n||t[r]||k[r]})));return i.call(this,n)}})),s().extend((function(e,t,n){t.prototype.to=function(t){return function(t,r,i){for(var o=r.$locale(),s=e.thresholds,a=e.rounding,l="",u=0;u=d){var g=a(Math.abs(n(t).diff(r,h,!0))),m=P(g,r.$locale().name),v=p>0?"future":"past";l=((i?o.abbr[h]:o[v][h])[m]||"").replace("%s","".concat(g));break}}return l}(t,this,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}}),{thresholds:b,rounding:Math.round}),s().extend(M,{justNowThreshold:1e3}),s().locale(p.name,p);var w=function(){function e(){(0,r.A)(this,e),this.currentLocale=p.name}return(0,i.A)(e,[{key:"currentLocaleConfig",get:function(){return this.protectMultiThreadedRender(),s()().$locale()}},{key:"format",value:function(e,t){this.protectMultiThreadedRender();var n=this.getDate(e);return s()(n).format(t)}},{key:"setLocale",value:function(e){this.currentLocale=R(e),s().locale(R(e))}},{key:"setLocaleConfig",value:function(e){return this.currentLocale=R(e.name),s().locale(e.name,e),this}},{key:"utcFormat",value:function(e,t){this.protectMultiThreadedRender();var n=this.getDate(e);return s()(n).utc().format(t)}},{key:"getRelativeTime",value:function(e,t){return this.protectMultiThreadedRender(),s()(s()(e).utc()).to(s()(t).utc())}},{key:"getRelativeTimeAbbr",value:function(e,t){return this.protectMultiThreadedRender(),s()(s()(e).utc()).to(s()(t).utc(),!0)}},{key:"configureTimeExpression",value:function(e){this.protectMultiThreadedRender(),M.$i=!1,s().extend(M,e)}},{key:"getTimeExpression",value:function(e,t){return this.protectMultiThreadedRender(),s().prototype.getTimeExpression(e,t)}},{key:"getDate",value:function(e){return"number"==typeof e?new Date(e):e}},{key:"protectMultiThreadedRender",value:function(){var e=s().locale();this.currentLocale!==e&&this.setLocale(this.currentLocale)}}]),e}(),x=new w},94810:(e,t,n)=>{"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(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 o(e,t){var n;if(e)return"string"==typeof e?s(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n:;\{\}?,。·!¥……()+{}【】、|《》]|(?!\s)'\s+|\s+'(?!\s))/gi,"").trim().replace(/(\s+)-(\s+)/gi," ").replace(/\s+|・/gi,"-"):""}function d(){function e(e){return h.test(e)}function t(){var e=0:;\{\}?,。·!¥……()+{}【】、|《》]|(?!\s)'\s+|\s+'(?!\s))/gi,u=/^(.*)\s?-\s?(.*)?/,c=/^(.*)\((.*)?\)/,h=/^(.*)(ft\.|feat\.)(.*)/;return s=a,(c.test(s)?i(o(a,c)):(s=a,u.test(s)?i(o(a,u)):e(a)?i(o(a)):[t(a)])).join("-")}n.d(t,{A:()=>f,h:()=>p});var f=Object.freeze({__proto__:null,isPureNumber:a,hasIllegalText:l,isRealUniqueId:u,getPureUniqueId:c,purifyPlainText:h,purifyMusicName:d}),p=Object.freeze({__proto__:null,getPureUserPath:function(e){var t=e.uniqueId,n=e.secUid,r=1e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;--r){var i=this.tryEntries[r],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=o.call(i,"catchLoc"),l=o.call(i,"finallyLoc");if(a&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var r=n(12);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var r=n(12);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";n.r(t),n.d(t,"StreamPlayer",(function(){return jt})),n.d(t,"BasicPlayer",(function(){return Xt})),n.d(t,"storage",(function(){return Ht}));var r=n(9),i=n.n(r),o=n(2),s=n.n(o),a=n(3),l=n.n(a),u=n(1),c=n.n(u),h=n(4),d=n.n(h),f=n(5),p=n.n(f),g=n(0),m=n.n(g),v=n(8),y=n.n(v),_=n(10),T=n.n(_),b={autoplay:!1,loop:!1,muted:!1,metaChunkSize:209715.2,dataChunkSize:1048576,bufferEnoughTime:.5,bufferMaxTime:3,bufferCheckingInterval:100,preload:"auto"},S={defaultBufferSize:10485760},k=n(7),P=n.n(k),M=n(6),R=n.n(M),w=function(){function e(){s()(this,e),this._events=[],this._callbacks={}}return l()(e,[{key:"register",value:function(e){this._events.includes[e]||this._events.push(e)}},{key:"on",value:function(e,t){return!!this._events.includes(e)&&(this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),!0)}},{key:"off",value:function(e,t){if(!this._events.includes(e))return!1;var n=this._callbacks[e].indexOf(t);return this._callbacks[e].splice(n,1),!0}},{key:"trigger",value:function(e,t){if(!this._callbacks[e]||!this._callbacks[e].length)return!1;var n=null;return this._callbacks[e].forEach((function(e,r){0==r?n=e(t):e(t)})),n}},{key:"events",get:function(){return this._events},set:function(e){var t=this;e.forEach((function(e){t.register(e)}))}}]),e}();var x=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e){var r;return s()(this,n),r=t.call(this),R()(P()(r),"_initTextTrack",(function(){r.textTrack=document.createElement("track"),r.textTrack.default=!0,r.textTrack.kind="captions",r.textTrack.label="English",r.textTrack.srclang="en",r.textTrack.oncuechange=function(e){var t,n,i=null===(t=e.target)||void 0===t||null===(n=t.track)||void 0===n?void 0:n.activeCues;i&&i.length&&(i[0].track.mode="hidden",r.trigger("SUBTITLE_CHANGED",i[0].text))}})),R()(P()(r),"load",(function(e){return fetch(e).then((function(e){return e.text()})).then((function(e){var t=new Blob([e],{type:"text/vtt"});r.textTrack&&(r.textTrack.src=URL.createObjectURL(t),r.el.appendChild(r.textTrack))}))})),R()(P()(r),"reset",(function(){r.textTrack&&(r.textTrack.src&&URL.revokeObjectURL(r.textTrack.src),r.textTrack.parentNode&&r.textTrack.parentNode.removeChild(r.textTrack),r.textTrack=null)})),r.el=e,r.textTrack=null,r._initTextTrack(),r.events=["SUBTITLE_CHANGED"],r}return l()(n)}(w);var E=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){var i;return s()(this,n),(i=t.call(this)).el=e,i.events=r,i.proxyEvents=[],i}return l()(n,[{key:"bind",value:function(e,t){c()(m()(n.prototype),"on",this).call(this,e,t)||this.el.addEventListener(e,t)}},{key:"remove",value:function(e,t){c()(m()(n.prototype),"off",this).call(this,e,t)||this.el.removeEventListener(e,t)}},{key:"proxy",value:function(e,t){var r=this;this.register(e),this.proxyEvents.push(e),c()(m()(n.prototype),"on",this).call(this,e,t),this.el.addEventListener(e,(function(t){c()(m()(n.prototype),"trigger",r).call(r,e,t)}))}}]),n}(w),D=[],I=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;s()(this,e),this.type=t,this.config=n,this.el=document.createElement("video"),this.config.container&&this.config.container.appendChild(this.el),this.eventManager=new E(this.el,[].concat(T()(D),T()(r))),this.subtitle=null,this.isReady=!1,this._initAttributes()}var t;return l()(e,[{key:"_initAttributes",value:function(){this.el.autoplay=this.config.autoplay||b.autoplay,this.el.loop=this.config.loop||b.loop,this.el.muted=this.config.muted||b.muted,this.el.controls=!1,this.el.playsInline=!0,this.el.preload=this.config.preload||b.preload}},{key:"_initEvents",value:function(){var e=this;this.eventManager.proxy("canplay",(function(){e.isReady=!0}))}},{key:"load",value:function(e){this.el.src!==e&&(this.el.src=e)}},{key:"play",value:function(){return this.el.play()}},{key:"pause",value:function(){this.el.pause()}},{key:"seek",value:function(e){this.el.currentTime=e}},{key:"mute",value:function(e){this.el.muted=e}},{key:"addSubtitle",value:function(e,t){return this.subtitle&&(this.subtitle.reset(),this.subtitle=null),this.subtitle=new x(this.el),this.subtitle.on("SUBTITLE_CHANGED",t),this.subtitle.load(e)}},{key:"access",value:function(){var e=this;return this.el.play().then((function(){e.el.pause()}))}},{key:"reset",value:function(){this.pause(),this.el.src=""}},{key:"on",value:function(e,t){this.eventManager.bind(e,t)}},{key:"off",value:function(e,t){this.eventManager.remove(e,t)}},{key:"replay",value:(t=i()(y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.seek(0),e.prev=1,e.next=4,this.play();case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,this,[[1,6]])}))),function(){return t.apply(this,arguments)})},{key:"currentTime",get:function(){return this.el.currentTime}},{key:"playing",get:function(){return!this.el.paused}},{key:"duration",get:function(){return this.el.duration}},{key:"bufferRanges",get:function(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:{};return s()(this,n),e=t.call(this),R()(P()(e),"_downloadChunk",(function(){if(!(e.loading||e._totalSize&&e._chunkOffset>=e._totalSize)){var t=function(){var e=performance.now();return function(){return(performance.now()-e)/1e3}}(),n=e._chunkSize,r=e._chunkOffset,i=e.url,o=new XMLHttpRequest;e.xhr=o,o.open("GET",i,!0),o.withCredentials=!!e.config.withCredentials,o.responseType="arraybuffer",o.start=e._chunkOffset,o.setRequestHeader("Range","bytes="+e._chunkOffset+"-"+(e._chunkOffset+n-1)),o.onerror=function(t){0!==t.target.status&&void 0!==t.target.status||e.trigger("ERROR",{name:"CORS_ERROR",url:i})},o.onreadystatechange=function(s){if(403===o.status&&e.trigger("ERROR",{name:"FORBIDDEN_ERROR",url:i,code:403}),4==o.readyState&&(e.loading=!1,200==o.status||206==o.status||304==o.status||416==o.status)){if(416==o.status)return void e.trigger("ERROR",{url:i,name:"RANGE_ERROR",code:416,range:"bytes="+r+"-"+(r+n-1)});if(i!=e.url)return;var a=null;if(o.getAllResponseHeaders().toLocaleLowerCase().indexOf("content-range")>=0&&(a=o.getResponseHeader("content-range")),!e._totalSize&&a){var l=a.split("/");2==l.length&&(e._totalSize=parseInt(l[1]),e.trigger("FILE_SIZE",e._totalSize))}e.eof=o.response.byteLength!=n||o.response.byteLength==e._totalSize,e.lastChunkNetworkTime=t(),e.trigger("CHUNK_READY",{data:o.response,eof:e.eof,chunkOffset:r,chunkSize:n,totalSize:e._totalSize,networkDuration:e.lastChunkNetworkTime}),e.eof||e.paused?e.eof&&e.trigger("EOF",null):e.timeoutId=setTimeout((function(){e._chunkOffset+=n,e._downloadChunk()}),0)}},e.loading=!0,o.send()}})),R()(P()(e),"load",(function(t){e.url=t})),R()(P()(e),"start",(function(){e.url&&(e.eof=!1,e.paused=!1,e.chunkOffset=0,e.switchToInitSize(),e._downloadChunk())})),R()(P()(e),"pause",(function(){e.paused=!0})),R()(P()(e),"resume",(function(t){!e.paused||e.loading||e.eof||(e.paused=!1,null!=t?e._chunkOffset=t:e._chunkOffset+=e._chunkSize,e._downloadChunk())})),R()(P()(e),"release",(function(){e.xhr&&(e.xhr.abort(),e.xhr=null,e.loading=!1),e.eof=!0,e.paused=!0,e.timeoutId&&clearTimeout(e.timeoutId),e.switchToInitSize(),e._chunkOffset=0,e._totalSize=0,e.url=""})),e.config=r,e._chunkSize=0,e._chunkOffset=0,e._totalSize=0,e.url="",e._initChunkSize=-1,e._commonChunkSize=-1,e.lastChunkNetworkTime=0,e.eof=!0,e.paused=!0,e.loading=!1,e.timeoutId=null,e.xhr=null,e.events=["CHUNK_READY","FILE_SIZE","EOF","ERROR"],e}return l()(n,[{key:"chunkSize",set:function(e){!e||e<0||(this._chunkSize=Math.ceil(e))}},{key:"initChunkSize",set:function(e){!e||e<0||(this._initChunkSize=Math.ceil(e))}},{key:"commonChunkSize",set:function(e){!e||e<0||(this._commonChunkSize=Math.ceil(e))}},{key:"switchToCommonSize",value:function(){this._commonChunkSize<=0||(this.chunkSize=this._commonChunkSize)}},{key:"switchToInitSize",value:function(){this._initChunkSize<=0||(this.chunkSize=this._initChunkSize)}},{key:"chunkOffset",set:function(e){this._chunkOffset=e}}]),n}(w),O=new(l()((function e(){var t=this;s()(this,e),R()(this,"create",(function(e,n,r){return new t.defs[e](n,r)})),R()(this,"define",(function(e,n){t.defs[e]=n})),R()(this,"isSupported",(function(e){return t.defs[e]})),this.defs={}}))),A=Math.pow(2,32),G=function(e,t,n,r,i){var o=new Uint8Array(e,t,i),s=new Uint8Array(n,r,i);o.set(s)},$=function(e,t){return e+t},B=function(e,t){return{value:e.getUint8(t),position:t+1}},N=function(e,t){return{value:e.getUint16(t),position:t+2}},F=function(e,t,n){return{value:e.getUint32(t,!n),position:t+4}},U=function(e,t,n){return e.setUint8(t,n),t+1},H=function(e,t,n){return e.setUint16(t,n),t+2},V=function(e,t,n){return e.setInt32(t,n),t+4},j=function(e,t,n){return e.setUint32(t,n),t+4},z=G,X=$,K=B,Q=N,W=function(e,t){return{value:e.getInt16(t),position:t+2}},q=function(e,t){var n=N(e,t),r=n.value<<16;return t=n.position,{value:r|(n=B(e,t)).value,position:t=n.position}},Y=F,J=function(e,t,n){return{value:e.getInt32(t,!n),position:t+4}},Z=function(e,t,n){var r=F(e,t,n),i=r.value;t=r.position;var o=(r=F(e,t,n)).value;return t=r.position,{value:n?i*A+o:o*A+i,position:t}},ee=function(e,t,n){return{value:null,position:$(t,8)}},te=function(e,t,n){for(var r=[],i=t;i>16),t=U(e,t,(65280&n)>>8),U(e,t,255&n)},ae=V,le=j,ue=function(e,t,n){var r=Math.floor(n/A);return t=j(e,t,r),j(e,t,4294967295&n)},ce=function(e,t,n,r){var i=Math.min(n.length,r),o=0;for(o=0;o=4;){var s=te(e,t,4);this.compatibleBrands.push(s.value),t=s.position,i-=4}}return t}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);if(t=r.position,this.data)t=he(e,t,this.data);else{t=ce(e,t,this.majorBrand,4),t=le(e,t,this.minorVersion);for(var i=0;i=0?(this[n.type]||(this[n.type]=[]),this[n.type].push(n.box)):this[n.type]=n.box,this.boxes.push(n.type)}if(t==this.lastPosition)break}}},{key:"write",value:function(e,t){var r=this,i=c()(m()(n.prototype),"write",this).call(this,e,t);return{position:t=i.position,writeSize:function(e){return i.writeSize(e)},writeSubBoxes:function(e,t){for(var n=0;n=0)for(var o=0;o>8,t=o.position,o=function(e,t,n){var r=new Uint32Array(n);return G(r.buffer,0,e.buffer,t,n*r.BYTES_PER_ELEMENT),{value:r,position:t+r.byteLength}}(e,t=X(t,10),9),this.matrix=o.value,t=o.position,t=X(t,24),o=Y(e,t,!0),this.nextTrackId=o.value,o.position}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,this.data?t=he(e,t,this.data):(t=le(e,t,this.creationTime),t=le(e,t,this.modificationTime),t=le(e,t,this.timescale),t=le(e,t,this.duration),t=le(e,t,this.rate),t=oe(e,t,this.volume<<8),t=X(t,10),t=de(e,t,this.matrix),t=X(t,24),t=le(e,t,this.nextTrackId)),r.writeSize(t),t}}]),n}(_e);Te.type="mvhd",Te.skippable=!0,O.define(Te.type,Te);var be=function(){function e(t,n){s()(this,e),this.index=t,this.trackId=n,this.dts=0,this.timescale=1,this.size=0,this.read=!1}return l()(e,[{key:"timestamp",get:function(){return this.dts/this.timescale}}]),e}();var Se=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){var i;return s()(this,n),i=t.call(this,"trak",e,r),R()(P()(i),"buildSamples",(function(){if(i.sampleIndex=0,i.samples=[],i.samplesDuration=0,i.samplesSize=0,i.mdia&&i.mdia.minf&&i.mdia.minf.stbl){var e=i.mdia.minf.stbl.stco,t=i.mdia.minf.stbl.stsc,n=i.mdia.minf.stbl.stsz,r=i.mdia.minf.stbl.stts,o=i.mdia.minf.stbl.ctts,s=i.mdia.minf.stbl.stss,a=i.mdia.minf.stbl.stsd;if(n&&n.sampleSizes&&n.sampleSizes.length)for(var l=0,u=-1,c=-1,h=-1,d=-1,f=0,p=-1,g=-1,m=-1,v=-1,y=0;yu&&(c++,u<0&&(u=0),u+=r.sampleCounts[c]),y>0?(i.samples[y-1].duration=r.sampleDeltas[c],i.samplesDuration+=i.samples[y-1].duration,_.dts=i.samples[y-1].dts+i.samples[y-1].duration,y==n.sampleSizes.length-1&&(_.duration=r.sampleDeltas[c],i.samplesDuration+=_.duration)):_.dts=0,o?(y>=h&&(d++,h<0&&(h=0),h+=o.sampleCounts[d]),_.cts=i.samples[y].dts+o.sampleOffsets[d]):_.cts=_.dts,s?y==s.sampleNumbers[f]-1?(_.iFrame=!0,f++):_.iFrame=!1:_.iFrame=!0}}})),R()(P()(i),"resetForFMP4",(function(){if(i.tkhd&&(i.tkhd.duration=0),i.mdia&&(i.mdia.mdhd&&(i.mdia.mdhd.duration=0),i.mdia&&i.mdia.minf&&i.mdia.minf.stbl)){var e=i.mdia.minf.stbl;if(e.stco&&(e.stco.chunkOffsets=[]),e.stsc){var t=e.stsc;t.firstChunk=[],t.samplesPerChunk=[],t.sampleDescriptionIndex=[]}if(e.stsz&&(e.stsz.sampleSizes=[]),e.stts){var n=e.stts;n.sampleCounts=[],n.sampleDeltas=[]}if(e.ctts){var r=e.ctts;r.sampleCounts=[],r.sampleOffsets=[]}}})),i}return l()(n,[{key:"parse",value:function(e,t){c()(m()(n.prototype),"parse",this).call(this,e,t)}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,t=r.writeSubBoxes(e,t),r.writeSize(t),t}},{key:"getSampleOffsetWithTime",value:function(e){if(!this.samples.length)return 0;for(var t=-1,n=-1,r=(this.samples[0].timescale,0);re*i.timescale){t=Math.max(0,r-1);break}i.iFrame&&(n=r)}if(t=n)return 0;for(e=this.samples[t].cts,this.sampleIndex=t;this.samples[t].read&&t!=this.samples.length-1;)t++;return this.samples[t].offset}},{key:"id",get:function(){return this.tkhd?this.tkhd.trackId:0}},{key:"idString",get:function(){return"trak_"+this.id}},{key:"name",get:function(){return this.mdia&&this.mdia.hdlr?this.mdia.hdlr.handler:""}},{key:"isAudio",get:function(){return"soun"==this.name}},{key:"isVideo",get:function(){return"vide"==this.name}},{key:"duration",get:function(){return this.mdia&&this.mdia.mdhd?this.mdia.mdhd.duration:0}},{key:"calculatedDuration",get:function(){if(!this.samples.length)return 0;var e=this.samples[this.samples.length-1];return(e.cts+e.duration)/e.timescale}},{key:"timescale",get:function(){return this.mdia&&this.mdia.mdhd?this.mdia.mdhd.timescale:1}},{key:"sampleDesc",get:function(){return this.mdia&&this.mdia.minf&&this.mdia.minf.stbl&&this.mdia.minf.stbl.stsd&&this.mdia.minf.stbl.stsd.entries.length?this.mdia.minf.stbl.stsd.entries[0]:null}},{key:"codec",get:function(){return this.sampleDesc?this.sampleDesc.getCodec():""}},{key:"sampleDuration",get:function(){return this.samples&&this.samples.length?this.samples[0].duration:0}}]),n}(ve);Se.type="trak",O.define(Se.type,Se);var ke=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){var i;return s()(this,n),(i=t.call(this,"tkhd",e,r)).data=null,i.creationTime=null,i.modificationTime=null,i.trackId=null,i.duration=null,i.layer=null,i.alternateGroup=null,i.volume=null,i.matrix=null,i.width=null,i.height=null,i}return l()(n,[{key:"parse",value:function(e,t){if(n.skippable){var r=t;t=c()(m()(n.prototype),"parse",this).call(this,e,t);var i=ne(e,t,this.size-8-(t-r));return this.data=i.value,r=i.position,1==this.version?(t=X(t,16),i=Y(e,t,!0),this.trackId=i.value,t=i.position,t=X(t,4),i=Z(e,t,!0),this.duration=i.value,t=i.position):(t=X(t,8),i=Y(e,t,!0),this.trackId=i.value,t=i.position,t=X(t,4),i=Y(e,t,!0),this.duration=i.value,t=i.position),t=X(t,52),i=Y(e,t,!0),this.width=i.value,t=i.position,i=Y(e,t,!0),this.height=i.value,t=i.position,r}if(t=c()(m()(n.prototype),"parse",this).call(this,e,t),1==this.version){var o=Z(e,t,!0);this.creationTime=o.value,t=o.position,o=Z(e,t,!0),this.modificationTime=o.value,t=o.position,o=Y(e,t,!0),this.trackId=o.value,t=o.position,t=(o=Y(e,t,!0)).position,o=Z(e,t,!0),this.duration=o.value,t=o.position}else{var s=Y(e,t,!0);this.creationTime=s.value,t=s.position,s=Y(e,t,!0),this.modificationTime=s.value,t=s.position,s=Y(e,t,!0),this.trackId=s.value,t=s.position,t=X(t,4),s=Y(e,t,!0),this.duration=s.value,t=s.position}t=X(t,8);var a=W(e,t);return this.layer=a.value,t=a.position,a=W(e,t),this.alternateGroup=a.value,t=a.position,a=W(e,t),this.volume=a.value>>8,t=a.position,a=function(e,t,n){var r=new Int32Array(n);return G(r.buffer,0,e.buffer,t,n*r.BYTES_PER_ELEMENT),{value:r,position:t+r.byteLength}}(e,t=X(t,2),9),this.matrix=a.value,t=a.position,a=Y(e,t,!0),this.width=a.value,t=a.position,a=Y(e,t,!0),this.height=a.value,a.position}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,this.data?t=he(e,t,this.data):(t=le(e,t,this.creationTime),t=le(e,t,this.modificationTime),t=le(e,t,this.trackId),t=X(t,4),t=le(e,t,this.duration),t=X(t,8),t=ie(e,t,this.layer),t=ie(e,t,this.alternateGroup),t=ie(e,t,this.volume<<8),t=function(e,t,n){if(n instanceof Int32Array)G(e.buffer,t,n.buffer,0,n.byteLength),t+=n.byteLength;else for(var r=0;r>10&31,l[1]=this.language>>5&31,l[2]=31&this.language,this.languageString=String.fromCharCode(l[0]+96,l[1]+96,l[2]+96),X(t,2)}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,this.data?t=he(e,t,this.data):(t=le(e,t,this.creationTime),t=le(e,t,this.modificationTime),t=le(e,t,this.timescale),t=le(e,t,this.duration),t=oe(e,t,this.language),t=X(t,2)),r.writeSize(t),t}}]),n}(_e);we.type="mdhd",we.skippable=!0,O.define(we.type,we);var xe=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){var i;return s()(this,n),(i=t.call(this,"hdlr",e,r)).name="",i.handler="",i}return l()(n,[{key:"parse",value:function(e,t){if(t=c()(m()(n.prototype),"parse",this).call(this,e,t),0===this.version){t=X(t,4);var r=te(e,t,4);this.handler=r.value,t=r.position,t=X(t,12),r=te(e,t,12),this.name=r.value,t=r.position}return t}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,t=X(t,4),t=ce(e,t,this.handler,4),t=X(t,12),t=ce(e,t,this.name,this.name.length+1),r.writeSize(t),t}}]),n}(_e);xe.type="hdlr",xe.skippable=!0,O.define(xe.type,xe);var Ee=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){return s()(this,n),t.call(this,"minf",e,r)}return l()(n,[{key:"parse",value:function(e,t){c()(m()(n.prototype),"parse",this).call(this,e,t)}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,t=r.writeSubBoxes(e,t),r.writeSize(t),t}}]),n}(ve);Ee.type="minf",O.define(Ee.type,Ee);var De=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){return s()(this,n),t.call(this,"vmhd",e,r)}return l()(n,[{key:"parse",value:function(e,t){if(n.skippable){var r=t;t=c()(m()(n.prototype),"parse",this).call(this,e,t);var i=ne(e,t,this.size-8-(t-r));return this.data=i.value,i.position}t=c()(m()(n.prototype),"parse",this).call(this,e,t);var o=Q(e,t);return this.graphicsMode=o.value,o=function(e,t,n){var r=new Uint16Array(n);return G(r.buffer,0,e.buffer,t,n*r.BYTES_PER_ELEMENT),{value:r,position:t+r.byteLength}}(e,t=o.position,3),this.opcolor=o.value,o.position}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,this.data?t=he(e,t,this.data):t=function(e,t,n){if(n instanceof Uint16Array)G(e.buffer,t,n.buffer,0,n.byteLength),t+=n.byteLength;else for(var r=0;r0){var h=ne(e,t,s);this.ext=h.value,t=h.position}return t}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);if(t=r.position,this.data)t=he(e,t,this.data);else{t=re(e,t,this.configurationVersion),t=re(e,t,this.AVCProfileIndication),t=re(e,t,this.profileCompatibility),t=re(e,t,this.AVCLevelIndication),t=re(e,t,this.lengthSizeMinusOne+252),t=re(e,t,this.SPS.length+224);for(var i=0;i0)for(var i=0;i+1Math.pow(2,32)-1?1:0;var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,t=1===this.version?ue(e,t,this.baseMediaDecodeTime):le(e,t,this.baseMediaDecodeTime),r.writeSize(t),t}}]),n}(_e);st.type="tfdt",O.define(st.type,st);var at=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){var i;return s()(this,n),(i=t.call(this,"trun",e,r)).flags=0,i}return l()(n,[{key:"parse",value:function(e,t){}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);t=r.position,t=le(e,t,this.sampleCount),1&this.flags&&(this.dataOffsetPosition=t,t=ae(e,t,this.dataOffset)),4&this.flags&&(t=le(e,t,this.firstSampleFlags));for(var i=0;i>3)&&t.data.length>=2&&(r=32+((7&t.data[0])<<3)+((224&t.data[1])>>5)),function(e,t){var n=Number(e).toString(16);for(t=null==t?t=2:t;n.length>=1;e+=pe(r,0),e+=".",0===this.hvcC.generalTierFlag?e+="L":e+="H",e+=this.hvcC.generalLevelIdc;for(var o=!1,s="",a=5;a>=0;a--)(this.hvcC.generalConstraintIndicator[a]||o)&&(s="."+pe(this.hvcC.generalConstraintIndicator[a],0)+s,o=!0);e+=s}return e}}]),n}($e);bt.type="hvc1",O.define(bt.type,bt);var St=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){return s()(this,n),t.call(this,"hvcC",e,r)}return l()(n,[{key:"parse",value:function(e,t){if(n.skippable){var r,i=ne(e,t,this.size-8);this.data=i.value,r=i.position,t=X(t,1);var o=(i=K(e,t)).value;return t=i.position,this.generalProfileSpace=o>>6,this.generalTierFlag=(32&o)>>5,this.generalProfileIdc=31&o,i=Y(e,t,!0),this.generalProfileCompatibility=i.value,t=i.position,i=ne(e,t,6),this.generalConstraintIndicator=i.value,t=i.position,i=K(e,t),this.generalLevelIdc=i.value,t=i.position,r}var s=K(e,t);this.configurationVersion=s.value,t=s.position;var a=(s=K(e,t)).value;t=s.position,this.generalProfileSpace=a>>6,this.generalTierFlag=(32&a)>>5,this.generalProfileIdc=31&a,s=Y(e,t,!0),this.generalProfileCompatibility=s.value,t=s.position,s=ne(e,t,6),this.generalConstraintIndicator=s.value,t=s.position,s=K(e,t),this.generalLevelIdc=s.value,t=s.position,s=Q(e,t),this.minSpatialSegmentationIdc=4095&s.value,t=s.position,s=K(e,t),this.parallelismType=3&s.value,t=s.position,s=K(e,t),this.chromaFormatIdc=3&s.value,t=s.position,s=K(e,t),this.bitDepthLumaMinus8=7&s.value,t=s.position,s=K(e,t),this.bitDepthChromaMinus8=7&s.value,t=s.position,s=Q(e,t),this.avgFrameRate=s.value,t=s.position,a=(s=K(e,t)).value,t=s.position,this.constantFrameRate=a>>6,this.numTemporalLayers=1&a,this.temporalIdNested=1&a,this.lengthSizeMinusOne=3&a,this.naluArrays=[];var l=(s=K(e,t)).value;t=s.position;for(var u=0;u>7,c.naluType=63&a;var h=(s=Q(e,t)).value;t=s.position;for(var d=0;d>7}else"rICC"!==this.colourType&&"prof"!==this.colourType||(n=ne(this.size-4),this.ICCProfile=n.value,t=n.position)}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,r.writeSize(t),t}}]),n}(ge);kt.type="colr",kt.keepData=!1,O.define(kt.type,kt);var Pt=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e,r){return s()(this,n),t.call(this,"fiel",e,r)}return l()(n,[{key:"parse",value:function(e,t){var n=K(e,t);this.fieldCount=n.value,t=n.position,n=K(e,t),this.fieldOrdering=n.value,t=n.position}},{key:"write",value:function(e,t){var r=c()(m()(n.prototype),"write",this).call(this,e,t);return t=r.position,t=re(e,t,this.fieldCount),t=re(e,t,this.fieldOrdering),r.writeSize(t),t}}]),n}(ge);Pt.type="fiel",Pt.keepData=!1,O.define(Pt.type,Pt);var Mt=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(){var e;return s()(this,n),e=t.call(this),R()(P()(e),"setPosition",(function(t){e.position=t})),R()(P()(e),"setEndPosition",(function(t){e.endPosition=t})),R()(P()(e),"_isEnoughForSize",(function(){return e.endPosition-e.position>=4})),R()(P()(e),"_isEnoughForType",(function(){return e.endPosition-e.position>=4})),R()(P()(e),"_isEnoughForBox",(function(t){return e.endPosition-e.position>=t})),R()(P()(e),"start",(function(){for(e.paused=!1;e.positioni?null:(z(n.data.buffer,0,r.memory.buffer,n.offset-r.memory.startPosition,n.size),r.readLength+=n.size,e.samples[t].read=!0,n)})),R()(P()(r),"createMoof",(function(e){var t=O.create("moof",0,0),n=O.create("mfhd",0,0);t.addSubBox("mfhd",n),n.sequenceNumber=r.nextMoofIndex,r.nextMoofIndex++;var i=O.create("traf",0,0);t.addSubBox("traf",i);var o=O.create("tfhd",0,0);i.addSubBox("tfhd",o),o.trackId=e.trackId,o.flags=131072;var s=O.create("tfdt",0,0);i.addSubBox("tfdt",s),s.baseMediaDecodeTime=e.dts-0;var a=O.create("trun",0,0);return i.addSubBox("trun",a),a.flags=3841,a.dataOffset=0,a.firstSampleFlags=0,a.sampleCount=1,a.sampleDuration=[e.duration],a.sampleSize=[e.size],a.sampleFlags=[e.iFrame?1<<25:65536],a.sampleCompositionTimeOffset=[e.cts-e.dts],t})),R()(P()(r),"createFragment",(function(e,t,n,i){var o=r.getSample(e,t);if(!o)return i;var s=r.createMoof(o);i=s.write(n,i),r.moofSize=s.size,s.adjustDataOffset(n);var a=O.create("mdat",0,0);return a.data=o.data,a.write(n,i)})),R()(P()(r),"createFMP4",(function(e){for(var t=e.idString,n=e.name,i=0,o=r.memory.createBuffer(r.fragmentBufferSize),s=new DataView(o),a=!1,l=e.sampleIndex;e.sampleIndex=r.fragmentBufferSize){0==i&&(r.fragmentBufferSize=u),a=!0;break}var c=r.createFragment(e,e.sampleIndex,s,i);if((e.isVideo?r.videoPaused:r.audioPaused)||c==i){e.isVideo?r.videoPaused=!0:r.audioPaused=!0,r.trigger("PAUSED",{trackId:t,trackName:n,index:e.sampleIndex,timestamp:e.samples[e.sampleIndex].timestamp,offset:e.samples[e.sampleIndex].offset});break}i=c,e.sampleIndex++}if(0!=i&&!r.paused){var h=fe(s.buffer,i);r.trigger("DATA_READY",{trackId:t,startSampleIndex:l,stopSampleIndex:e.sampleIndex,buffer:h,eos:e.sampleIndex==e.samples.length})}a&&r.createFMP4(e)})),R()(P()(r),"createVideoFMP4",(function(){return new Promise((function(e,t){var n=r.conf.getVideoTrack();setTimeout((function(){r.createFMP4(n),e()}))}))})),R()(P()(r),"createAudioFMP4",(function(){return new Promise((function(e,t){var n=r.conf.getAudioTrack();setTimeout((function(){r.createFMP4(n),e()}))}))})),R()(P()(r),"start",(function(){if(r.ready){var e=[];return r.paused=!1,r.videoPaused&&(r.videoPaused=!1,e.push(r.createVideoFMP4())),r.audioPaused&&(r.audioPaused=!1,e.push(r.createAudioFMP4())),Promise.all(e)}})),R()(P()(r),"pause",(function(){r.videoPaused=!0,r.audioPaused=!0,r.paused=!0})),R()(P()(r),"release",(function(){r.ready=!1,r.readLength=0,r.nextMoofIndex=0,r.moofSize=0,r.paused=!0,r.shouldStart=!1,r.videoPaused=!0,r.audioPaused=!0})),r.ready=!1,r.readLength=0,r.nextMoofIndex=0,r.paused=!0,r.shouldStart=!1,r.fragmentBufferSize=1048576,r.memory=e,r.moofSize=0,r.mdatHeaderSize=8,r.videoPaused=!0,r.audioPaused=!0,r.events=["META_READY","DATA_READY","PAUSED"],r}return l()(n)}(w);var xt=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e){var r;return s()(this,n),r=t.call(this),R()(P()(r),"_initMediaSource",(function(){r.mediaSource=new MediaSource,r.el.src=window.URL.createObjectURL(r.mediaSource);var e=function(){window.URL.revokeObjectURL(r.el.src),r.shouldEos=!1,r.ready=!0,r.initSourceBuffer(),r.trigger("OPENED",null)};return r.mediaSource.addEventListener("sourceopen",e),r.mediaSource.addEventListener("sourceended",(function e(){r.ready=!1,r.trigger("ENDED",null),r.mediaSource.removeEventListener("sourceended",e)})),r.mediaSource.addEventListener("sourceclose",(function e(){r.ready=!1,r.trigger("CLOSED",null),r.mediaSource.removeEventListener("sourceclose",e)})),function(){r.el.pause(),r.checkSourceBufferReady()?r.mediaSource.endOfStream():r.shouldEos=!0,r.mediaSource.removeEventListener("sourceopen",e)}})),R()(P()(r),"init",(function(e){e&&(r.conf=e,r.initSourceBuffer())})),R()(P()(r),"initSourceBuffer",(function(){r.conf&&r.ready&&(r.mediaSource.duration=r.conf.duration,r.conf.getTracks().forEach((function(e,t){var n='video/mp4; codecs="'+e.codec+'"',i=e.idString;if(MediaSource.isTypeSupported(n)){var o=r.mediaSource.addSourceBuffer(n);o.addEventListener("abort",(function(e){})),o.addEventListener("update",(function(e){})),o.addEventListener("updatestart",(function(e){})),o.addEventListener("error",(function(e){})),o.addEventListener("updateend",(function(e){r.feedBuffer(i),r.trigger("UPDATED",{trackId:i}),o.bufferCompleteCount++,o.eosBufferIndex>=0&&o.eosBufferIndex==o.bufferCompleteCount&&(o.eos=!0,r.checkEndOfStream(i)),r.shouldEos&&r.checkSourceBufferReady()&&(r.mediaSource.endOfStream(),r.shouldEos=!1)})),o.bufferInputCount=0,o.bufferCompleteCount=0,o.eosBufferIndex=-1,o.eos=!1,r.sourceBuffers[i]=o,r.inputBuffers[i]||(r.inputBuffers[i]=[]),r.feedBuffer(i)}})))})),R()(P()(r),"checkEndOfStream",(function(){var e=!0;for(var t in r.sourceBuffers)e=e&&r.sourceBuffers[t].eos;e&&r.checkSourceBufferReady()&&r.mediaSource.endOfStream()})),R()(P()(r),"feedBuffer",(function(e){if(r.checkSourceBufferReady(e)&&r.hasPendingBuffer(e)){var t=r.inputBuffers[e].shift();r.sourceBuffers[e].appendBuffer(t.buffer),r.sourceBuffers[e].bufferInputCount++,t.eos&&(r.sourceBuffers[e].eosBufferIndex=r.sourceBuffers[e].bufferInputCount)}})),R()(P()(r),"hasPendingBuffer",(function(e){return!!r.inputBuffers[e]&&0!=r.inputBuffers[e].length})),R()(P()(r),"clearPendingBuffers",(function(){for(var e in r.inputBuffers)r.inputBuffers[e]=[]})),R()(P()(r),"checkSourceBufferReady",(function(e){var t=!0;if(e)t=!!r.sourceBuffers[e]&&!r.sourceBuffers[e].updating;else for(var n in r.sourceBuffers)t=t&&!r.sourceBuffers[n].updating;return r.msAvailable&&t})),R()(P()(r),"inputBuffer",(function(e,t){r.inputBuffers[e]||(r.inputBuffers[e]=[]),r.inputBuffers[e].push(t),r.feedBuffer(e)})),R()(P()(r),"start",(function(){return r.el.play()})),R()(P()(r),"stop",(function(){r.el.pause()})),R()(P()(r),"release",(function(){r._releaseMediaSource&&r._releaseMediaSource(),r._releaseMediaSource=r._initMediaSource(),r.conf=null,r.ready=!1,r.sourceBuffers={},r.inputBuffers={},r.bufferInputCount=0,r.bufferCompleteCount=0,r.eosBufferIndex=-1})),r.el=e,r.conf=null,r.ready=!1,r.sourceBuffers={},r.inputBuffers={},r.bufferInputCount=0,r.bufferCompleteCount=0,r.eosBufferIndex=-1,r.shouldEos=!1,r._releaseMediaSource=r._initMediaSource(),r.events=["OPENED","CLOSED","UPDATED"],r}return l()(n,[{key:"msAvailable",get:function(){return this.mediaSource&&"open"===this.mediaSource.readyState}}]),n}(w);var Et=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(){var e;return s()(this,n),e=t.call(this),R()(P()(e),"inputFTYP",(function(t){t&&t.box&&(e.ftyp=t.box)})),R()(P()(e),"inputMOOV",(function(t){t&&t.box&&(e.moov=t.box,e.getTracks().forEach((function(e){e.buildSamples()})),e.moov.timescale&&(e.duration=e.moov.duration/e.moov.timescale),e.fileSize&&e.duration&&(e.durationPerUnitSize=e.duration/(e.fileSize-e.metadataSize)),e.trigger("CONF_READY",P()(e)))})),R()(P()(e),"getTracks",(function(){return e.moov.trak})),R()(P()(e),"getTrack",(function(t){var n=e.moov.trak.filter((function(e){return e.name==t}));return n.length?n[0]:null})),R()(P()(e),"getVideoTrack",(function(){return e.getTrack("vide")})),R()(P()(e),"getAudioTrack",(function(){return e.getTrack("soun")})),R()(P()(e),"getISamples",(function(e){return e.samples.filter((function(e){return e.iFrame}))})),R()(P()(e),"getVideoISamples",(function(){var t=e.getVideoTrack();return e.getISamples(t)})),R()(P()(e),"getAudioISamples",(function(){var t=e.getAudioTrack();return e.getISamples(t)})),R()(P()(e),"getGopSize",(function(){var t=e.getGopOffsets();return t.length>=2?t[1]-t[0]:0})),R()(P()(e),"getGopOffsets",(function(){e.iVideoSamples.length||(e.iVideoSamples=e.getVideoISamples());for(var t=e.getAudioISamples(),n=e.iVideoSamples.map((function(e){return e.offset})),r=-1,i=[],o=1;o=0&&i.push(t[c].offset)),(f.dts+f.duration)/f.timescale<=u&&(h=d)}h>=0&&(i.push(t[h].offset),r=h)}return n.map((function(e,t){return 0==t?Math.min(e,i[t]):Math.max(e,i[t])}))})),R()(P()(e),"getDataOffsetWithTime",(function(t){for(var n=e.getTracks(),r=1/0,i=0;io.calculatedDuration)){var s=o.getSampleOffsetWithTime(t);ss[t]+s[n]?r.push(o):o[t]+o[n]>s[t]+s[n]&&(s[n]+=o[t]+o[n]-(s[t]+s[n]))}return r}(e.chunkInfo,"offset","size"),e.trigger("UPDATED",e.buffer)})),R()(P()(e),"createBuffer",(function(e){return e=e||S.defaultBufferSize,new ArrayBuffer(e)})),R()(P()(e),"findNextBufferEndPos",(function(t){for(var n=0;n=t)return r.offset+r.size}return t})),R()(P()(e),"release",(function(){e.buffer=null,e.chunkInfo=[],e.offset=0})),e.buffer=null,e.offset=0,e.chunkInfo=[],e.events=["UPDATED"],e}return l()(n,[{key:"startPosition",get:function(){return this.buffer?this.offset:0}},{key:"endPosition",get:function(){return this.buffer?this.offset+this.buffer.byteLength:0}}]),n}(w);var It,Ct=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e){var r;return s()(this,n),r=t.call(this),R()(P()(r),"_stopBufferChecking",(function(){r.timeoutId&&(window.clearTimeout(r.timeoutId),r.timeoutId=null)})),R()(P()(r),"_startBufferChecking",(function(){r._eof||r.paused?r._stopBufferChecking():(r.isEnough?r.trigger("BUFFER_ENOUGH",null):r.trigger("BUFFER_UNENOUGH",null),r.timeoutId=window.setTimeout((function(){r._startBufferChecking()}),r._checkingInterval))})),r.el=e,r.timeoutId=null,r.paused=!0,r._eof=!1,r.rebufferCount=0,r._initEnoughTime=b.bufferEnoughTime,r._enoughTime=b.bufferEnoughTime,r._maxTime=b.bufferMaxTime,r._checkingInterval=b.bufferCheckingInterval,r.events=["BUFFER_ENOUGH","BUFFER_UNENOUGH"],r}return l()(n,[{key:"start",value:function(){this.paused=!1,this._startBufferChecking()}},{key:"stop",value:function(){this.paused=!0}},{key:"release",value:function(){this.stop(),this._stopBufferChecking(),this._eof=!1,this._enoughTime=this._initEnoughTime,this.rebufferCount=0}},{key:"countRebuffer",value:function(){this.rebufferCount++,this._enoughTime=r&&e<=i)return{requestTime:t?e:i,isEnough:t}}return{requestTime:e,isEnough:!1}}},{key:"enoughTime",set:function(e){e&&(this._initEnoughTime=e,this._enoughTime=e)}},{key:"maxTime",set:function(e){e&&(this._maxTime=e)}},{key:"checkingInterval",set:function(e){e&&(this._checkingInterval=e)}},{key:"eof",set:function(e){this._eof=e,e&&this._stopBufferChecking()}},{key:"ranges",get:function(){for(var e=[],t=0;t=n&&this.el.currentTime=this._enoughTime}}]),n}(w),Lt=["loadstart","downloaderError","downloaderChunkReady","memoryCompleted"],Ot=new Uint8Array(16);function At(){if(!It&&!(It="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return It(Ot)}for(var Gt=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,$t=[],Bt=0;Bt<256;++Bt)$t.push((Bt+256).toString(16).substr(1));var Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=($t[e[t+0]]+$t[e[t+1]]+$t[e[t+2]]+$t[e[t+3]]+"-"+$t[e[t+4]]+$t[e[t+5]]+"-"+$t[e[t+6]]+$t[e[t+7]]+"-"+$t[e[t+8]]+$t[e[t+9]]+"-"+$t[e[t+10]]+$t[e[t+11]]+$t[e[t+12]]+$t[e[t+13]]+$t[e[t+14]]+$t[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&Gt.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},Ft=function(e,t,n){var r=(e=e||{}).random||(e.rng||At)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return Nt(r)};var Ut=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(){var e,r,i,o,a,l;return s()(this,n),(l=t.call(this)).indexedDB="undefined"==typeof window?null:(null===(e=window)||void 0===e?void 0:e.indexedDB)||(null===(r=window)||void 0===r?void 0:r.webkitIndexedDB)||(null===(i=window)||void 0===i?void 0:i.mozIndexedDB)||(null===(o=window)||void 0===o?void 0:o.OIndexedDB)||(null===(a=window)||void 0===a?void 0:a.msIndexedDB),l.request=null,l.db=null,l.store=null,l}return l()(n,[{key:"init",value:function(){var e=this;return this.indexedDB?new Promise((function(t,n){var r=e.indexedDB.open(e.dbName,e.dbVersion);r.onsuccess=function(n){e.db=n.target.result,t()},r.onerror=function(e){n()},r.onupgradeneeded=function(t){e.store=t.currentTarget.result.createObjectStore(e.dbStoreName)}})):null}},{key:"setData",value:function(e,t){var n=this;return new Promise((function(r,i){n.db||i();var o=n.db.transaction(n.dbStoreName,"readwrite").objectStore(n.dbStoreName).put(t,e);o.onsuccess=function(){r()},o.onerror=function(){i()}}))}},{key:"getData",value:function(e){var t=this;return new Promise((function(n,r){t.db||r();var i=t.db.transaction(t.dbStoreName,"readonly").objectStore(t.dbStoreName).get(e);i.onsuccess=function(e){var t=e.target.result;n(t)},i.onerror=function(){r()}}))}},{key:"hasData",value:function(e){var t=this;return new Promise((function(n,r){t.db||r();var i=t.db.transaction(t.dbStoreName,"readonly").objectStore(t.dbStoreName).getKey(e);i.onsuccess=function(e){var t=e.target.result;n(t)},i.onerror=function(){r()}}))}},{key:"clearData",value:function(){var e=this;return new Promise((function(t,n){e.db||n();var r=e.db.transaction(e.dbStoreName,"readwrite").objectStore(e.dbStoreName).clear();r.onsuccess=function(e){t()},r.onerror=function(){n()}}))}}]),n}(function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(){var e;return s()(this,n),(e=t.call(this)).dbName="tiktok",e.dbVersion=1,e.dbStoreName="playback",e}return l()(n,[{key:"init",value:function(){}},{key:"setData",value:function(e,t){}},{key:"getData",value:function(e){}},{key:"clearData",value:function(){}}]),n}(w));var Ht=new(function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(){var e;return s()(this,n),(e=t.call(this)).impl=new Ut,e.readyPromise=e.impl.init(),e}return l()(n,[{key:"save",value:function(e,t){var n=this;if(this.readyPromise)return this.readyPromise.then((function(){return n.impl.setData(e,t)}))}},{key:"export",value:function(e){var t=this;if(this.readyPromise)return this.readyPromise.then((function(){return t.impl.getData(e)}))}},{key:"check",value:function(e){var t=this;if(this.readyPromise)return this.readyPromise.then((function(){return t.impl.hasData(e)}))}},{key:"clear",value:function(){var e=this;if(this.readyPromise)return this.readyPromise.then((function(){return e.impl.clearData()}))}}]),n}(w));var Vt=function(e){d()(u,e);var t,n,r,o,a=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(u);function u(e){var t;return s()(this,u),(t=a.call(this,"Stream",e,Lt)).id=Ft(),t._initMemory(),t._initEvents(),t._initConf(),t._initDownloader(),t._initDemuxer(),t._initRemuxer(),t._initBuffer(),t._initMSE(),t}return l()(u,[{key:"_initMemory",value:function(){var e=this;this.memory=new Dt,this.memory.on("UPDATED",function(){var t=i()(y.a.mark((function t(n){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.downloader.eof&&e.eventManager.trigger("MEMORY_COMPLETED",n);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"_initEvents",value:function(){var e=this;c()(m()(u.prototype),"_initEvents",this).call(this),this.eventManager.proxy("canplay",(function(e){})),this.eventManager.proxy("waiting",(function(t){e.buffer.countRebuffer(),e.downloader.loading||e.downloader.eof||e.downloader.resume()})),this.eventManager.proxy("play",(function(t){e.buffer.start()})),this.eventManager.proxy("pause",(function(t){e.buffer.stop()})),this.eventManager.proxy("seeking",(function(e){}))}},{key:"_initMSE",value:function(){var e=this;this.mse=new xt(this.el),this.mse.on("OPENED",(function(){})),this.mse.on("CLOSED",(function(){})),this.mse.on("UPDATED",(function(t){e.buffer.isEnough&&e.downloader.pause()}))}},{key:"_initConf",value:function(){var e=this;this.conf=new Et,this.conf.on("CONF_READY",(function(t){e.mse.init(t),e.remuxer.initFromConf(t)}))}},{key:"_initBuffer",value:function(){var e=this;this.buffer=new Ct(this.el),this.config.bufferEnoughTime&&(this.bufferEnoughTime=this.config.bufferEnoughTime),this.config.bufferMaxTime&&(this.buffer.maxTime=this.config.bufferMaxTime),this.config.bufferCheckingInterval&&(this.buffer.checkingInterval=this.config.bufferCheckingInterval),this.buffer.on("BUFFER_UNENOUGH",(function(){e.el.playbackRate=.9,e.downloader.resume()})),this.buffer.on("BUFFER_ENOUGH",(function(){e.el.playbackRate=1,e.downloader.pause()}))}},{key:"_initDemuxer",value:function(){var e=this;this.demuxer=new Rt(this.memory),this.demuxer.on("FTYP_READY",(function(t){e.conf.inputFTYP(t)})),this.demuxer.on("MOOV_READY",(function(t){e.conf.inputMOOV(t),e.downloader.switchToCommonSize()}))}},{key:"_initRemuxer",value:function(){var e=this;this.remuxer=new wt(this.memory),this.remuxer.on("META_READY",(function(t){e.mse.inputBuffer(t.trackId,t),e.remuxer.start()})),this.remuxer.on("DATA_READY",(function(t){e.mse.inputBuffer(t.trackId,t)})),this.remuxer.on("PAUSED",(function(e){}))}},{key:"_initDownloader",value:function(){var e=this;this.downloader=new L({withCredentials:this.config.withCredentials}),this.metaChunkSize=Math.ceil(this.config.metaChunkSize||b.metaChunkSize),this.dataChunkSize=Math.ceil(this.config.dataChunkSize||b.dataChunkSize),this.downloader.on("FILE_SIZE",(function(t){e.conf.fileSize=t})),this.downloader.on("CHUNK_READY",(function(t){e.demuxer.inputBuffer(t),e.remuxer.start(),e.eventManager.trigger("downloaderChunkReady",{chunkSize:t.chunkSize,networkDuration:t.networkDuration,speed:t.networkDuration?8*t.chunkSize/1024/t.networkDuration:0})})),this.downloader.on("EOF",(function(){e.buffer.eof=!0})),this.downloader.on("ERROR",(function(t){e.eventManager.trigger("downloaderError",t)}))}},{key:"loadFromLocal",value:(o=i()(y.a.mark((function e(t){var n,r;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ht.check(t);case 2:if(!(n=e.sent)){e.next=8;break}return e.next=6,Ht.export(t);case 6:r=e.sent,this.loadFromBuffer(r);case 8:return e.abrupt("return",!!n);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"loadFromBuffer",value:function(e){this.release(),this.demuxer.inputBuffer({chunkOffset:0,data:e}),this.remuxer.start(),this.eventManager.trigger("loadstart",{target:this.el,type:"loadstart"})}},{key:"saveToLocal",value:(r=i()(y.a.mark((function e(t,n){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ht.save(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})},{key:"exportFromLocal",value:(n=i()(y.a.mark((function e(t){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ht.export(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})},{key:"load",value:(t=i()(y.a.mark((function e(t){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.downloader){e.next=2;break}return e.abrupt("return");case 2:if(this.downloader.url!=t){e.next=4;break}return e.abrupt("return");case 4:this.release(),this.downloader.url=t,this.eventManager.trigger("loadstart",{target:this.el,type:"loadstart"}),this.downloader.start();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"pause",value:function(){this.mse.stop()}},{key:"seek",value:function(e){if(this.demuxer.moovReady){this.element.currentTime=e,this.remuxer.pause();var t=this.buffer.checkAvailable(e);if(!t.isEnough){e=t.requestTime,this.pause(),this.downloader.pause(),this.mse.clearPendingBuffers();var n=this.conf.getDataOffsetWithTime(e);n=this.memory.findNextBufferEndPos(n),this.downloader.resume(n)}}}},{key:"release",value:function(){c()(m()(u.prototype),"release",this).call(this),this.downloader.release(),this.demuxer.release(),this.remuxer.release(),this.mse.release(),this.conf.release(),this.memory.release(),this.buffer.release()}},{key:"metaChunkSize",set:function(e){this.downloader.initChunkSize=e}},{key:"dataChunkSize",set:function(e){this.downloader.commonChunkSize=e}},{key:"bufferEnoughTime",set:function(e){this.buffer.enoughTime=e}},{key:"element",get:function(){return this.el}},{key:"data",get:function(){return this.memory.buffer}}]),u}(C);Vt.storage=Ht;var jt=Vt,zt=[];var Xt=function(e){d()(n,e);var t=function(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 n,r=m()(e);if(t){var i=m()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}(n);function n(e){var r;return s()(this,n),(r=t.call(this,"Basic",e,zt))._initEvents(),r}return l()(n,[{key:"_initEvents",value:function(){c()(m()(n.prototype),"_initEvents",this).call(this)}}]),n}(C)}])},21704:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nh,GM:()=>g,Og:()=>y,T1:()=>p,hz:()=>v,j6:()=>a,n8:()=>l,qW:()=>i,uk:()=>T,xs:()=>o})},2651:(e,t,n)=>{"use strict";n.d(t,{A2:()=>C,AB:()=>D,BY:()=>h,C2:()=>G,CM:()=>$,DH:()=>A,Dx:()=>R,F4:()=>I,F5:()=>M,Gd:()=>p,KH:()=>_,N8:()=>k,OC:()=>f,Rj:()=>g,Ut:()=>O,W5:()=>u,Wr:()=>S,Wu:()=>c,Wz:()=>b,dQ:()=>w,eo:()=>d,ff:()=>i,h9:()=>P,mQ:()=>o,m_:()=>m,nQ:()=>l,pi:()=>x,q_:()=>T,tr:()=>r,uE:()=>a,uv:()=>y,vB:()=>L,vN:()=>E,yE:()=>v,yK:()=>s});var r="play",i="error",o="seeked",s="timeupdate",a="waiting",l="canplay",u="durationchange",c="volumechange",h="loadeddata",d="loadedmetadata",f="ratechange",p="progress",g="focus",m="blur",v="ready",y="urlNull",_="autoplay_started",T="autoplay_was_prevented",b="complete",S="replay",k="destroy",P="urlchange",M="loading",R="fullscreen_change",w="cssFullscreen_change",x="mini_state_change",E="definition_change",D="after_definition_change",I="video_resize",C="playnext",L="user_action",O="reset",A="source_error",G="source_success",$=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"]},90102:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>ce});var r=n(21704),i=n(42990),o=n.n(i),s=n(16027),a=/(Android)\s([\d.]+)/,l=/(Version)\/([\d.]+)/,u=["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"],c={get device(){return c.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(n){return t[n].test(e)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,r=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,s=o||r&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!s;return{isTablet:s,isPhone:a,isIpad:o,isIos:a||o,isAndroid:r,isPc:!(a||r||n||s),isSymbian:n,isWindowsPhone:t,isFireFox:i}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",n=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?l:a)?t.exec(e):[];if(n&&n.length>=3){var r=n[2].split(".");return r.length>0?parseInt(r[0]):0}return 0},get isWeixin(){return"undefined"!=typeof navigator&&!!/(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&&u.map((function(n){"probably"===t.canPlayType('video/mp4; codecs="'.concat(n,'"'))&&(e.isSupport=!0,e.mime+="||".concat(n))})),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 n=e.video||{},r=e.audio||{};try{var i=MediaSource.isTypeSupported(n.contentType),o=MediaSource.isTypeSupported(r.contentType);return Promise.resolve({supported:i&&o,smooth:!1,powerEfficient:!1})}catch(e){return Promise.resolve(t)}}},h="3.0.21",d={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},f={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},p=(0,r.j6)((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};(0,r.xs)(this,e);var i=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var o=n.mediaError?n.mediaError:t.media.error||{},a=t.duration,l=t.currentTime,u=t.ended,c=t.src,d=t.currentSrc,p=t.media,g=p.readyState,m=p.networkState,v=n.errorCode||o.code;f[v]&&(v=f[v]);var y={playerVersion:h,currentTime:l,duration:a,ended:u,readyState:g,networkState:m,src:c||d,errorType:n.errorType,errorCode:v,message:n.errorMessage||o.message,mediaError:o,originError:n.originError?n.originError.stack:"",host:s.Ay.getHostFromUrl(c||d)};return n.ext&&Object.keys(n.ext).map((function(e){y[e]=n.ext[e]})),y}if(arguments.length>1){for(var _={playerVersion:h,domain:document.domain},T=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],b=0;b0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=g.CM.map((function(t){var n="on".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));return"function"==typeof e[n]&&e.on(t,e[n]),(0,r.n8)({},t,function(e,t){return function(n,r){var i={player:t,eventName:e,originalEvent:n,detail:n.detail||{},timeStamp:n.timeStamp,currentTime:t.currentTime,duration:t.duration,paused:t.paused,ended:t.ended,isInternalOp:!!t._internalOp[n.type],muted:t.muted,volume:t.volume,host:s.Ay.getHostFromUrl(t.currentSrc),vtype:t.vtype};if(t.removeInnerOP(n.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&&(i.isMutedChange=t._lastMuted!==t.muted,t._lastMuted=t.muted),"error"===e&&(i.error=r||t.video.error),t.mediaEventMiddleware[e]){var a=m.bind(t,e,i);try{t.mediaEventMiddleware[e].call(t,i,a)}catch(n){throw m.call(t,e,i),n}}else m.call(t,e,i)}}(t,e))}))),this._evHandlers.forEach((function(e){var n=Object.keys(e)[0];t.addEventListener(n,e[n],!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 n=Object.keys(e)[0];t.removeEventListener(n,e[n],!1)})),this._evHandlers.forEach((function(t){var n=Object.keys(t)[0],r="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1));"function"==typeof e[r]&&e.off(n,e[r])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var n=this;e.removeAttribute("src"),e.load(),t.forEach((function(e,t){n.media.appendChild(s.Ay.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}));var r=e.children;if(r){this._videoSourceCount=r.length,this._videoSourceIndex=r.length,this._vLoadeddata=function(e){n.emit(g.C2,{src:e.target.currentSrc,host:s.Ay.getHostFromUrl(e.target.currentSrc)})};for(var i=null,o=0;o=n._videoSourceCount){var r={code:4,message:"sources_load_error"};i?i.error(e,r):n.errorHandler("error",r)}var o=d[4];n.emit(g.DH,new p(n,{errorType:o,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var a=0;a0;)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 n=this.media.error||t,r=n.code?d[n.code]:"other";n.message,this.media.currentSrc||(n={code:6,message:"empty_src"}),this.emit(e,new p(this,{errorType:r,errorCode:n.code,errorMessage:n.message||"",mediaError:n}))}}},{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 n=this.media.currentTime;if(e)for(var r=0,i=e.length;r=this.currentTime)return{start:t.start(n),end:t.end(n)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){return this.media.error?["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]:""}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit(g.h9,e),this.emit(g.uE),this._currentTime=0,this._duration=0,s.Ay.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===s.Ay.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,n){for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s2?i-2:0),s=2;s2?i-2:0),s=2;s2?i-2:0),s=2;s0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};(0,r.xs)(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}),[{key:"openDB",value:function(e){var t=this,n=this,r=this.myDB.version||1,i=n.indexedDB.open(n.myDB.name,r);i.onerror=function(e){},i.onsuccess=function(r){t.myDB.db=r.target.result,e.call(n)},i.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(n.myDB.ojstore.name)||t.createObjectStore(n.myDB.ojstore.name,{keyPath:n.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var n,r=this.myDB.db.transaction(e,"readwrite").objectStore(e),i=0;i-1?this.__handlers[i].handler=t:this.__handlers.push({target:e,handler:t,playerId:n})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(n,r){e===n.target&&(t=r)}));try{this.observer&&this.observer.unobserve(e)}catch(e){}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){for(var t=this.__handlers,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var r=e._pluginInfoId;if(r&&this.pluginGroup[r]){this.pluginGroup[r]._plugins||(this.pluginGroup[r]._plugins={});var i=this.pluginGroup[r]._plugins,o=this.pluginGroup[r]._originalOptions;n.player=e;var a=n.pluginName||t.pluginName;if(!a)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){n.config||(n.config={});for(var l=Object.keys(o),u=0;u1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(this.root){var o=e.defaultConfig||{};if(!n.root){switch(n.position?n.position:n.config&&n.config.position?n.config.position:o.position){case k.lP.CONTROLS_LEFT:n.root=this.left;break;case k.lP.CONTROLS_RIGHT:n.root=this.right;break;case k.lP.CONTROLS_CENTER:n.root=this.center;break;case k.lP.CONTROLS:n.root=this.root;break;default:n.root=this.left}return(0,r.hz)(t,"registerPlugin",this,3)([e,n,i])}}}},{key:"destroy",value:function(){"mobile"!==c.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{key:"render",value:function(){var e=this.config,t=e.mode,n=e.autoHide,i=e.initShow;if(!e.disable){var o=s.Ay.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},(0,r.n8)({},V,n),{"xgplayer-controls-initshow":i||!n});return'\n \n \n \n \n \n \n \n ')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}])}(k.Ay),q=n(53005),Y={lang:{},langKeys:[],textKeys:[]};function J(e,t){return Object.keys(t).forEach((function(n){var i,o=s.Ay.typeOf(t[n]),a=s.Ay.typeOf(e[n]);"Array"===o?("Array"!==a&&(e[n]=[]),(i=e[n]).push.apply(i,(0,r.Og)(t[n]))):"Object"===o?("Object"!==a&&(e[n]={}),J(e[n],t[n])):e[n]=t[n]})),e}function Z(){Object.keys(Y.lang.en).map((function(e){Y.textKeys[e]=e}))}function ee(e,t){var n=e.LANG;if(t||(t=Y),t.lang){var r=e.TEXT||{};"zh"===n&&(n="zh-cn"),t.lang[n]?J(t.lang[n],r):(t.langKeys.push(n),t.lang[n]=r),Z()}}ee({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 te={get textKeys(){return Y.textKeys},get langKeys(){return Y.langKeys},get lang(){var e={};return Y.langKeys.map((function(t){e[t]=Y.lang[t]})),Y.lang["zh-cn"]&&(e.zh=Y.lang["zh-cn"]||{}),e},extend:function(e,t){var n=[];if(t||(t=Y),t.lang){n="Array"!==s.Ay.typeOf(e)?Object.keys(e).map((function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}})):e;var r=t.lang;n.map((function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),r[e.LANG]?J(r[e.LANG]||{},e.TEXT||{}):ee(e,t)})),Z()}},use:ee,init:function(e){var t,n={lang:{},langKeys:[],textKeys:{},pId:e};return J(n.lang,Y.lang),(t=n.langKeys).push.apply(t,(0,r.Og)(Y.langKeys)),J(n.textKeys,Y.textKeys),n}},ne=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],re={},ie=null,oe=function(e){function t(){return(0,r.xs)(this,t),(0,r.qW)(this,t,arguments)}return(0,r.B)(t,e),(0,r.j6)(t,[{key:"add",value:function(e){e&&(re[e.playerId]=e,1===Object.keys(re).length&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete re[e.playerId])}},{key:"_iterate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var n in re)if(Object.prototype.hasOwnProperty.call(re,n)){var r=re[n];if(t){if(e(r))break}else e(r)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(n){var r=e(n);return r&&(t=n),r}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(n){e(n)&&t.push(n)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(re[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):re[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(re),t=0;t1&&void 0!==arguments[1])||arguments[1];if(re[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):re[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return ie||(ie=new t),ie}}])}(i.EventEmitter),se=["play","pause","replay","retry"],ae=0,le=0,ue=null,ce=function(e){function t(e){var n;(0,r.xs)(this,t);var i=s.Ay.deepMerge(K(),e);n=(0,r.qW)(this,t,[i]),(0,r.n8)(n,"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,r=e.defaultPlaybackRate;q.A.logInfo("player","canPlayFunc, startTime",n.__startTime),n._seekToStartTime(),n.playbackRate=r,(t||n._useAutoplay)&&n.mediaPlay(),n.off(g.nQ,n.canPlayFunc),n.removeClass(x)}})),(0,r.n8)(n,"onFullscreenChange",(function(e,t){var r=function(){s.Ay.setTimeout(n,(function(){n.resize()}),100)},i=s.Ay.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(g.vB,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var o=(0,s.Dq)(i,n.playerId,S);if(t||i&&(i===n._fullscreenEl||o))r(),!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!0,n.changeFullStyle(n.root,i,$),n.emit(g.Dx,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){r();var a=n,l=a._fullScreenOffset;if(a.config.needFullscreenScroll?(window.scrollTo(l.left,l.top),s.Ay.setTimeout(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($);else{var u=n._fullscreenEl;u||!n.root.contains(e.target)&&e.target!==n.root||(u=e.target),n.recoverFullStyle(n.root,u,$)}n._fullscreenEl=null,n.emit(g.Dx,!1)}})),(0,r.n8)(n,"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),(0,r.n8)(n,"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),(0,Q.Ay)(n,se),n.config=i,n._pluginInfoId=s.Ay.generateSessionId(),(0,q.P)(n);var o=n.constructor.defaultPreset,a=n.config.presets;if(a.length){var l=a.indexOf("default");l>=0&&o&&(a[l]=o)}else o&&a.push(o);n.userTimer=null,n.waitTimer=null,n.handleSource=!0,n._state=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=te.init(n._pluginInfoId),c.os.isAndroid&&c.osVersion>0&&c.osVersion<6&&(n.config.autoplay=!1),n.database=new y,n.isUserActive=!1,n._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=ue,n._initMedia();var u=n.config.isNoRoot,h=!u&&n._initDOM();if(!u&&!h)return console.error(new Error("can't find the dom which id is ".concat(n.config.id," or this.config.el does not exist"))),(0,r.GM)(n);w.init(n);var d=n.config,f=d.definition,p=void 0===f?{}:f;if(!d.url&&p.list&&p.list.length>0){var m=p.list.find((function(e){return e.definition&&e.definition===p.defaultDefinition}));m||(p.defaultDefinition=p.list[0].definition,m=p.list[0]),n.config.url=m.url,n.curDefinition=m}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),w.onPluginsReady(n),n.getInitDefinition(),n.setState(2),s.Ay.setTimeout(n,(function(){n.emit(g.yE)}),0),n.onReady&&n.onReady(),(n.config.videoInit||n.config.autoplay)&&(!n.hasStart||n.state<4)&&n.start(),n}return(0,r.B)(t,e),(0,r.j6)(t,[{key:"_initMedia",value:function(){var e=this.constructor.XgVideoProxy;if(e&&this.mediaConfig.mediaType===e.mediaType){var t=this.innerContainer||this.root;this.detachVideoEvents(this.media);var n=new e(t,this.config,this.mediaConfig);this.attachVideoEvents(n),this.media=n}this.media.setAttribute(S,this.playerId)}},{key:"_initDOM",value:function(){var e,t=this,n=this.config,r=n.id,i=n.el,o=n.isCustomRoot,a=n.controls,l=n.autoplay,u=n.isMobileSimulateMode;if(this.root=r?document.getElementById(r):null,!this.root)if(i&&1===i.nodeType)this.root=i;else{if(o)return this.emit(g.ff,new p("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=s.Ay.createDom("div","",{id:r,class:X})}var h=function(e){for(var t=Object.keys(re),n=0;n0?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e),"Number"===s.Ay.typeOf(this.config.volume)&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;n&&this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var r=this.media.readyState;q.A.logInfo("_startInit readyState",r),this.config.autoplay&&(!s.Ay.isMSE(this.media)&&this.load(),(c.os.isIpad||c.os.isPhone)&&this.mediaPlay());var i=this.config.startTime;this.__startTime=i>0?i:-1,this.config.startTime=0,r>=2&&this.duration>0?this.canPlayFunc():this.on(g.nQ,this.canPlayFunc),(!this.hasStart||this.state<4)&&w.afterInit(this),this.hasStart=!0,this.setState(4),s.Ay.setTimeout(this,(function(){t.emit(g.Wz)}),0)}}},{key:"_registerPlugins",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._loadingPlugins=[];var n=this.config.ignores||[],r=this.config.plugins||[],i=this.config.i18n||[];t&&te.extend(i,this.__i18n);var o=n.join("||").toLowerCase().split("||"),s=this.plugins;r.forEach((function(n){try{var r=n.plugin?n.plugin.pluginName:n.pluginName;if(r&&o.indexOf(r.toLowerCase())>-1)return null;if(!t&&s[r.toLowerCase()])return;if(n.lazy&&n.loader){var i=w.lazyRegister(e,n);return void(n.forceBeforeInit&&(i.then((function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(i),1)})).catch((function(t){q.A.logError("_registerPlugins:loadingPlugin",t),e._loadingPlugins.splice(e._loadingPlugins.indexOf(i),1)})),e._loadingPlugins.push(i)))}return e.registerPlugin(n)}catch(e){q.A.logError("_registerPlugins:",e)}}))}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach((function(t){!function(e,t){var n,i,o=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),s=o.plugins,a=void 0===s?[]:s,l=o.ignores,u=void 0===l?[]:l,c=o.icons,h=void 0===c?{}:c,d=o.i18n,f=void 0===d?[]:d;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(n=e.config.plugins).push.apply(n,(0,r.Og)(a)),(i=e.config.ignores).push.apply(i,(0,r.Og)(u)),Object.keys(h).map((function(t){e.config.icons[t]||(e.config.icons[t]=h[t])}));var p=e.config.i18n||[];f.push.apply(f,(0,r.Og)(p)),e.config.i18n=f}(e,t)}))}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case k.lP.ROOT_RIGHT:this.rightBar||(this.rightBar=s.Ay.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case k.lP.ROOT_LEFT:this.leftBar||(this.leftBar=s.Ay.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case k.lP.ROOT_TOP:this.topBar||(this.topBar=s.Ay.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&s.Ay.addClass(this.topBar,"top-bar-autohide")),t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var n=w.formatPluginInfo(e,t),r=n.PLUFGIN,i=n.options,o=this.config.plugins;!w.checkPluginIfExits(r.pluginName,o)&&o.push(r);var s=w.getRootByConfig(r.pluginName,this.config);s.root&&(i.root=s.root),s.position&&(i.position=s.position);var a=i.position?i.position:i.config&&i.config.position||r.defaultConfig&&r.defaultConfig.position;return!i.root&&"string"==typeof a&&a.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(r,i,r.pluginName):(i.root||(i.root="controls"===r.pluginName?this.root:this._getRootByPosition(a)),w.register(this,r,i))}},{key:"deregister",value:function(e){"string"==typeof e?w.unRegister(this,e):e instanceof P.Ay&&w.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 P.Ay&&(t=e.pluginName),t)for(var n=this.config.plugins.length-1;n>-1;n--)if(this.config.plugins[n].pluginName.toLowerCase()===t.toLowerCase()){this.config.plugins.splice(n,1);break}}},{key:"plugins",get:function(){return w.getPlugins(this)}},{key:"getPlugin",value:function(e){var t=w.findPlugin(this,e);return t&&t.pluginName?t:null}},{key:"addClass",value:function(e){this.root&&(s.Ay.hasClass(this.root,e)||s.Ay.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&s.Ay.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return s.Ay.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>3))return e||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(3),this._registerPlugins(!1),w.beforeInit(this).then((function(){if(t.config){e||(e=t.url||t.config.url);var n=t._preProcessUrl(e);return t._startInit(n.url)}})).catch((function(e){throw e.fileName="player",e.lineNumber="236",q.A.logError("start:beforeInit:",e),e}))}},{key:"switchURL",value:function(e,t){var n=this,r=e;"Object"===s.Ay.typeOf(e)&&(r=e.url),r=this._preProcessUrl(r).url;var i=this.currentTime;this.__startTime=i;var o=this.paused&&!this.isError;return this.src=r,new Promise((function(e,t){var i=function(e){n.off("timeupdate",s),n.off("canplay",s),t(e)},s=function(){n._seekToStartTime(),o&&n.pause(),n.off("error",i),e(!0)};n.once("error",i),r?(c.os.isAndroid?n.once("timeupdate",s):n.once("canplay",s),n.play()):n.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<4)return this.removeClass(A),this.addClass(x),this.start(),void(this._useAutoplay=!0);this.state<6&&(this.removeClass(A),!this.isCanplay&&this.addClass(x));var n=(0,r.hz)(t,"play",this,3)([]);return void 0!==n&&n&&n.then?n.then((function(){e.removeClass(j),e.addClass(D),e.state<6&&(q.A.logInfo(">>>>playPromise.then"),e.setState(6),e.emit(g.KH))})).catch((function(t){if(q.A.logWarn(">>>>playPromise.catch",t.name),e.media&&e.media.error)return e.onError(),void e.removeClass(x);"NotAllowedError"===t.name&&(e._errorTimer=s.Ay.setTimeout(e,(function(){e._errorTimer=null,e.emit(g.q_),e.addClass(j),e.removeClass(x),e.pause(),e.setState(5)}),0))})):(q.A.logWarn("video.play not return promise"),this.state<6&&(this.setState(6),this.removeClass(j),this.removeClass(A),this.removeClass(x),this.addClass(D),this.emit(g.KH))),n}},{key:"mediaPause",value:function(){(0,r.hz)(t,"pause",this,3)([])}},{key:"videoPause",value:function(){(0,r.hz)(t,"pause",this,3)([])}},{key:"play",value:function(){var e=this;return this.removeClass(E),(0,Q.Eu)(this,"play",(function(){return e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;(0,Q.Eu)(this,"pause",(function(){(0,r.hz)(t,"pause",e,3)([])}))}},{key:"seek",value:function(e,t){var n=this;if(this.media&&!Number.isNaN(Number(e))&&this.hasStart){var r=this.config,i=r.isSeekedPlay,o=r.seekedStatus,s=t||(i?"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(g.mQ,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(n.removeClass(x),n.isSeeking=!1,s){case"play":n.play();break;case"pause":n.pause();break;default:n._isPauseBeforeSeek>1||n.paused?n.pause():n.play()}n._isPauseBeforeSeek=0,n._onceSeekCanplay=null},this.once(g.mQ,this._onceSeekCanplay),this.state<6?(this.removeClass(A),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,t=this.config,n=t.definition;!t.url&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&n.list.map((function(t){t.definition===n.defaultDefinition&&(e.config.url=t.url,e.curDefinition=t)}))}},{key:"changeDefinition",value:function(e,t){var n=this,i=this.config.definition;if(Array.isArray(null==i?void 0:i.list)&&i.list.forEach((function(t){(null==e?void 0:e.definition)===t.definition&&(n.curDefinition=t)})),null!=e&&e.bitrate&&"number"!=typeof e.bitrate&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(g.vN,{from:t,to:e}),this.hasStart){var o=this.switchURL(e.url,(0,r.T1)({seamless:!1!==i.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},e));o&&o.then?o.then((function(){n.emit(g.AB,{from:t,to:e})})):this.emit(g.AB,{from:t,to:e})}else this.config.url=e.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(g.BY,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,t=[j,D,A,E,O,x,I,L,C];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(A),this.emit(g.Ut)}},{key:"reset",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(this.resetState(),this.plugins&&(t.map((function(t){e.deregister(t)})),n)){var r=K();Object.keys(this.config).keys((function(t){"undefined"===e.config[t]||"plugins"!==t&&"presets"!==t&&"el"!==t&&"id"!==t||(e.config[t]=r[t])}))}}},{key:"destroy",value:function(){var e,n=this,i=this.innerContainer,o=this.root,a=this.media;if(a){if(this.hasStart=!1,this._useAutoplay=!1,o&&o.removeAttribute(S),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),s.Ay.clearAllTimers(this),this.emit(g.N8),null===(e=ue)||void 0===e||e.remove(this),w.destroy(this),(0,Q.Vj)(this),(0,r.hz)(t,"destroy",this,3)([]),this.fullscreen&&this._fullscreenEl===o&&this.exitFullscreen(),i)for(var l=i.children,u=0;u0?o.className=c.filter((function(e){return e.indexOf("xgplayer")<0})).join(" "):o&&(o.className=""),this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach((function(e){n[e]=!1})),h&&this.root.parentNode&&this.root.parentNode.removeChild(this.root)}}},{key:"replay",value:function(){var e=this;this.removeClass(I),this.currentTime=0,this.isSeeking=!1,(0,Q.Eu)(this,"replay",(function(){e.once(g.mQ,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),e.emit(g.Wr),e.onPlay()}))}},{key:"retry",value:function(){var e=this;this.removeClass(L),this.addClass(C),(0,Q.Eu)(this,"retry",(function(){var t=e.currentTime,n=e.config.url,r=s.Ay.isMSE(e.media)?{url:n}:e._preProcessUrl(n);e.src=r.url,!e.config.isLive&&(e.currentTime=t),e.once(g.nQ,(function(){e.mediaPlay()}))}))}},{key:"changeFullStyle",value:function(e,t,n,r){e&&(r||(r=U),this._orgCss||(this._orgCss=s.Ay.filterStyleFromText(e)),s.Ay.addClass(e,n),t&&t!==e&&!this._orgPCss&&(this._orgPCss=s.Ay.filterStyleFromText(t),s.Ay.addClass(t,r),t.setAttribute(S,this.playerId)))}},{key:"recoverFullStyle",value:function(e,t,n,r){r||(r=U),this._orgCss&&(s.Ay.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),s.Ay.removeClass(e,n),t&&t!==e&&this._orgPCss&&(s.Ay.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",s.Ay.removeClass(t,r),t.removeAttribute(S))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,n=this.media;if("video"!==e&&"media"!==e||(e=this[e]),e||(e=t),this._fullScreenOffset={top:s.Ay.scrollTop(),left:s.Ay.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",s.Ay.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var t=e?"".concat(H," ").concat(B):B;this.changeFullStyle(this.root,e,t);var n=this.config.fullscreen,r=void 0===n?{}:n;(!0===r.useCssFullscreen||"function"==typeof r.useCssFullscreen&&r.useCssFullscreen())&&(this.fullscreen=!0,this.emit(g.Dx,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(g.dQ,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(H," ").concat(B):B;if(this.fullscreen){var t=this.config.fullscreen,n=void 0===t?{}:t;!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(g.Dx,!1)):this.removeClass(e)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,e);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(g.dQ,!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(H," ").concat(N):N;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,t,F),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(g.Dx,!0)}},{key:"exitRotateFullscreen",value:function(e){var t=this._fullscreenEl!==this.root?"".concat(H," ").concat(N):N;this.recoverFullStyle(this.root,this._fullscreenEl,t,F),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(g.Dx,!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(g.Rj,(0,r.T1)({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(g.m_,(0,r.T1)({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},n=this.innerStates;if(this.isActive=!0,this.removeClass(G),this._clearUserTimer(),void 0!==t.isLock&&(n.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||n.isActiveLocked)this._clearUserTimer();else{var r=t&&t.delay?t.delay:this.config.inactive;this.userTimer=s.Ay.setTimeout(this,(function(){e.userTimer=null,e.blur()}),r)}}},{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 n=this.config.closePauseVideoFocus;this.isActive=!1,(t||n||!this.paused&&!this.ended)&&this.addClass(G)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(x),this.removeClass(L),this.removeClass(C),this.isCanplay=!0,this.waitTimer&&s.Ay.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(g.W5,(function(){e._seekToStartTime()})))}},{key:"onLoadstart",value:function(){this.removeClass(L),this.isCanplay=!1}},{key:"onPlay",value:function(){7===this.state&&this.setState(6),this.removeClass(E),this.ended&&this.removeClass(I),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(E),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(I),this.setState(7)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(j),this.removeClass(A),this.removeClass(x),this.removeClass(C),this.addClass(L)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(z)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&s.Ay.clearTimeout(this,this.waitTimer),this.removeClass(C),this.removeClass(z)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&s.Ay.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=s.Ay.setTimeout(this,(function(){e.addClass(C),e.emit(g.F5),s.Ay.clearTimeout(e,e.waitTimer),e.waitTimer=null}),this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1,[A,E,I,L,O,C].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(C))&&this.media.readyState>2&&(this.removeClass(C),s.Ay.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&5===this.state&&this.duration&&(this.setState(6),this.emit(g.KH)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===s.Ay.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,n){if(this.media&&t&&e){var i="String"===s.Ay.typeOf(e)?e:e.type||"";n.props&&"Array"!==s.Ay.typeOf(n.props)&&(n.props=[n.props]),this.emit(g.vB,(0,r.T1)({eventType:i,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},n))}}},{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})||{},n=t.startDiff,r=void 0===n?0:n,i=t.endDiff,o=void 0===i?0:i,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;ua)return!0;return!1}},{key:"resizePosition",value:function(){var e=this.videoPos,t=e.vy,n=e.vx,r=e.h,i=e.w,o=this.videoPos.rotate;if(!(o<0&&r<0&&i<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:o=o<0?0:o},u=0,c=0,h=1,d=Math.abs(o/90),f=this.root,p=this.innerContainer,g=f.offsetWidth,m=p?p.offsetHeight:f.offsetHeight,v=m,y=g;if(d%2==0)h=r>0?100/r:i>0?100/i:1,l.scale=h,u=t>0?(100-r)/2-t:0,l.y=2===d?0-u:u,c=n>0?(100-i)/2-n:0,l.x=2===d?0-c:c,this.media.style.width="".concat(y,"px"),this.media.style.height="".concat(v,"px");else if(d%2==1){v=g;var _=m-g;c=-_/2/(y=m)*100,l.x=3===d?c+t/2:c-t/2,u=_/2/v*100,l.y=3===d?u+n/2:u-n/2,l.scale=h,this.media.style.width="".concat(y,"px"),this.media.style.height="".concat(v,"px")}var T=s.Ay.getTransformStyle(l,this.media.style.transform||this.media.style.webkitTransform);this.media.style.transform=T,this.media.style.webkitTransform=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(n){if("plugins"!==n){t.config[n]=e[n];var r=t.plugins[n.toLowerCase()];r&&"Function"===s.Ay.typeOf(r.setConfig)&&r.setConfig(e[n])}}))}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,(0,Q.Eu)(this,"playnext",(function(){t.start(),t.emit(g.A2,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 n=this.media,r=n.videoWidth,i=n.videoHeight,o=this.config,s=o.fitVideoSize,a=o.videoFillMode;if("fill"!==a&&"cover"!==a&&"contain"!==a||this.setAttribute("data-xgfill",a),i&&r){this._videoHeight=i,this._videoWidth=r;var l=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,u=t.width,c=t.height-l,h=parseInt(r/i*1e3,10),d=parseInt(u/c*1e3,10),f=u,p=c,m={};"auto"===s&&d>h||"fixWidth"===s?(p=u/h*1e3,this.config.fluid?m.paddingTop="".concat(100*p/f,"%"):m.height="".concat(p+l,"px")):("auto"===s&&dh)&&this.setAttribute("data-xgfill","cover");var v={videoScale:h,vWidth:f,vHeight:p,cWidth:f,cHeight:p+l};this.resizePosition(),this.emit(g.F4,v)}}}},{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){q.A.logInfo("setState","state from:".concat(ne[this.state]," to:").concat(ne[e])),this._state=e}},{key:"_preProcessUrl",value:function(e,t){var n=this.config,r=n.preProcessUrl,i=n.preProcessUrlOptions,o=Object.assign({},i,t);return s.Ay.isBlob(e)||"function"!=typeof r?{url:e}:r(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(2),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return 6===this._state||7===this._state},set:function(e){e?this.setState(6):this._state>=6&&this.setState(4)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var t=this,n=this.config.definition,r=null,i=null;n.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&&(r=e),n.defaultDefinition===e.definition&&(i=e)})),!i&&e.length>0&&(i=e[0]),r?this.changeDefinition(r):i&&this.changeDefinition(i)}},{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!==te.langKeys.filter((function(t){return t===e})).length||"zh"===e?(this.config.lang=e,w.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(te.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 h}},{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(0,r.hz)(t,"readyState",this,1)}},{key:"error",get:function(){var e=(0,r.hz)(t,"error",this,1);return this.i18n[e]||e}},{key:"networkState",get:function(){return(0,r.hz)(t,"networkState",this,1)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,n=e.t;return n?(new Date).getTime()-n+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=s.Ay.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return le},set:function(e){le=e}},{key:"realTimeSpeed",get:function(){return ae},set:function(e){ae=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 Q.A_.call.apply(Q.A_,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){return Q.uQ.call.apply(Q.uQ,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){return Q.j.call.apply(Q.j,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),o=3;o3?r-3:0),o=3;o{"use strict";n.d(t,{Ay:()=>l});var r=n(21704),i=n(16027),o=n(53005),s=n(14163);function a(e,t){o.A.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var l=function(){return(0,r.j6)((function e(t){(0,r.xs)(this,e),i.Ay.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),(0,s.Ay)(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}),[{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=i.Ay.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 n=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){n.__events[e]=t,n.player.on(e,t)})):a(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(r){n.__onceEvents[r]=t,n.player.once(e,t)})):a(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(r){delete n.__events[e],n.player.off(r,t)})):a(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(n){e[t][n]&&e.off(n,e[t][n]),n&&delete e[t][n]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var i=(0,r.T1)((0,r.T1)({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,i)}}},{key:"hook",value:function(e,t){return s.A_.call.apply(s.A_,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i2?n-2:0),i=2;i1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return n&&(t.pluginName=n),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,n=this.pluginName;this.offAll(),i.Ay.clearAllTimers(this),i.Ay.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(n),(0,s.Vj)(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(e,n,t[n])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}])}()},14163:(e,t,n)=>{"use strict";n.d(t,{A_:()=>o,Ay:()=>c,Eu:()=>d,Vj:()=>h,j:()=>a,oq:()=>u,tC:()=>l,uQ:()=>s});var r=n(21704);function i(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),o=3;o2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var o=arguments,s=this;if(n.pre)try{var a;(a=n.pre).call.apply(a,[this].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(t.message),t}if(this.__hooks&&this.__hooks[e])try{var l,u=(l=this.__hooks[e]).call.apply(l,[this,this].concat(Array.prototype.slice.call(arguments)));u?u.then?u.then((function(e){!1!==e&&i.apply(void 0,[s,t,n.next].concat((0,r.Og)(o)))})).catch((function(e){throw e})):i.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments))):void 0===u&&i.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(t.message),t}else i.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function s(e,t){var n=this.__hooks;if(n)return n.hasOwnProperty(e)?(n&&(n[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function a(e,t){var n=this.__hooks;n&&delete n[e]}function l(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var t=this.plugins[e.toLowerCase()],n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1?n-1:0),i=1;i1&&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 h(e){e.__hooks=null}function d(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),o=3;o{"use strict";n.d(t,{Ay:()=>p,lP:()=>c});var r=n(21704),i=n(7790),o=n(36922),s=n.n(o),a=n(53005),l=n(16027),u={CONTROLS:"controls",ROOT:"root"},c={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"},h="xg-icon-disable";function d(e){return!!e&&e.indexOf&&/^(?:http|data:|\/)/.test(e)}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=null;if(e instanceof window.Element)return l.Ay.addClass(e,n),Object.keys(r).map((function(t){e.setAttribute(t,r[t])})),e;if(d(e)||d(e.url))return r.src=d(e)?e:e.url||"",o=l.Ay.createDom(e.tag||"img","",r,"xg-img ".concat(n));if("function"==typeof e)try{return(o=e())instanceof window.Element?(l.Ay.addClass(o,n),Object.keys(r).map((function(e){o.setAttribute(e,r[e])})),o):(a.A.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(i,"] is a function mast return an Element Object")),null)}catch(e){return a.A.logError("Plugin named [".concat(i,"]:createIcon"),e),null}return"string"==typeof e?l.Ay.createDomFromHtml(e,r,n):(a.A.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(i,"] is invalid")),null)}var p=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.xs)(this,t),(e=(0,r.qW)(this,t,[n])).__delegates=[],e}return(0,r.B)(t,e),(0,r.j6)(t,[{key:"__init",value:function(e){(0,r.hz)(t,"__init",this,3)([e]);var n=e.root,i=null;if(this.icons={},this.root=null,this.parent=null,e.root){(function(e,t){var n=t.config.icons||t.playerConfig.icons;Object.keys(e).map((function(i){var o=e[i],s=o&&o.class?o.class:"",a=o&&o.attr?o.attr:{},l=null;n&&n[i]&&(s=function(e,t){return"object"===(0,r.uk)(e)&&e.class&&"string"==typeof e.class?"".concat(t," ").concat(e.class):t}(n[i],s),a=function(e,t){return"object"===(0,r.uk)(e)&&e.attr&&"object"===(0,r.uk)(e.attr)&&Object.keys(e.attr).map((function(n){t[n]=e.attr[n]})),t}(n[i],a),l=f(n[i],i,s,a,t.pluginName)),!l&&o&&(l=f(o.icon?o.icon:o,a,s,{},t.pluginName)),t.icons[i]=l}))})(this.registerIcons()||{},this),this.langText={};var o,s,u=this.registerLanguageTexts()||{};o=u,s=this,Object.keys(o).map((function(e){Object.defineProperty(s.langText,e,{get:function(){var t=s.lang,n=s.i18n;return n[e]?n[e]:o[e]&&o[e][t]||""}})}));var c="";try{c=this.render()}catch(e){throw a.A.logError("Plugin:".concat(this.pluginName,":render"),e),new Error("Plugin:".concat(this.pluginName,":render:").concat(e.message))}if(c)(i=t.insert(c,n,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(i=l.Ay.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),n.appendChild(i)}this.root=i,this.parent=n;var h=this.config.attr||{},d=this.config.style||{};this.setAttr(h),this.setStyle(d),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"===(0,r.uk)(t)&&Object.keys(t).length>0&&Object.keys(t).map((function(n){var i,o,s=n,a=t[s],u={root:e.root};"function"==typeof a?(i=e.config[s]||{},o=a):"object"===(0,r.uk)(a)&&"function"==typeof a.plugin&&(i=a.options?l.Ay.deepCopy(e.config[s]||{},a.options):e.config[s]||{},o=a.plugin),u.config=i,void 0!==i.index&&(u.index=i.index),i.root&&(u.root=i.root),e.registerPlugin(o,u,s)}))}}},{key:"updateLang",value:function(e){e||(e=this.lang);var t=this.root,n=this.i18n,r=this.langText;t&&function e(t,n){for(var r=0;r0?e(t.children[r],n):n(t.children[r])}(t,(function(t){var i=t.getAttribute&&t.getAttribute("lang-key");if(i){var o=n[i.toUpperCase()]||r[i];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]:"",n=this.i18n||{},r=this.langText;e.setAttribute&&e.setAttribute("lang-key",t);var i=n[t]||r[t]||"";i&&(e.innerHTML=i)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,l.Ay.addClass(this.find(".xgplayer-icon"),h)}},{key:"enable",value:function(){this.config.disable=!1,l.Ay.removeClass(this.find(".xgplayer-icon"),h)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";n.root=n.root||this.root;var o=(0,r.hz)(t,"registerPlugin",this,3)([e,n,i]);return this._children.push(o),o}},{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,n,r){var i=this;if(arguments.length<3&&"function"==typeof n)Array.isArray(e)?e.forEach((function(e){i.bindEL(e,n)})):this.bindEL(e,n);else{var o=t.delegate.call(this,this.root,e,n,r);this.__delegates=this.__delegates.concat(o)}}},{key:"unbind",value:function(e,t){var n=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){n.unbindEL(e,t)})):this.unbindEL(e,t);else for(var r="".concat(e,"_").concat(t),i=0;i2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,n)}},{key:"unbindEL",value:function(e,t){var n=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,n)}},{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(e){return a.A.logError("Plugin:appendChild",e),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,n=this.player;this.__delegates.map((function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array&&(this._children.map((function(e){n.unRegisterPlugin(e.pluginName)})),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),(0,r.hz)(t,"__destroy",this,3)([]),this.icons={},["root","parent"].map((function(t){e[t]=null}))}}],[{key:"insert",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.children.length,i=Number(n),o=e instanceof window.Node;if(r){for(var s=0,a=null,l="";s=i){l="beforebegin";break}u4&&void 0!==arguments[4]&&arguments[4],o=[];if(e instanceof window.Node&&"function"==typeof r)if(Array.isArray(n))n.forEach((function(n){var a=s()(e,t,n,r,i);a.key="".concat(t,"_").concat(n),o.push(a)}));else{var a=s()(e,t,n,r,i);a.key="".concat(t,"_").concat(n),o.push(a)}return o}},{key:"ROOT_TYPES",get:function(){return u}},{key:"POSITIONS",get:function(){return c}}])}(i.Ay)},53005:(e,t,n)=>{"use strict";n.d(t,{A:()=>s,P:()=>a});var r="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,i={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},o="%c[xgplayer]",s={config:{debug:r?3:0},logInfo:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s=3&&(t=console).log.apply(t,[o,i.info,e].concat(r))},logWarn:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s=1&&(t=console).warn.apply(t,[o,i.warn,e].concat(r))},logError:function(e){var t;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",r=arguments.length,s=new Array(r>1?r-1:0),a=1;a{"use strict";n.d(t,{Dq:()=>c,Ay:()=>s,Xo:()=>u,nF:()=>l});var r=n(21704),i=n(53005),o=function(){return(0,r.j6)((function e(t){(0,r.xs)(this,e),this.bufferedList=t}),[{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}}])}(),s={};function a(e){var t=(0,r.uk)(e);return null!==e&&("object"===t||"function"===t)}function l(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return a(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),function(e,t,n){var r,i,o,s,l,u,c=0,h=!1,d=!1,f=!0,p=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=r,o=i;return r=i=void 0,c=t,s=e.apply(o,n)}function m(e,t){return p?(window.cancelAnimationFrame(l),window.requestAnimationFrame(e)):setTimeout(e,t)}function v(e){var n=e-u;return void 0===u||n>=t||n<0||d&&e-c>=o}function y(){var e=Date.now();if(v(e))return _(e);l=m(y,function(e){var n=e-c,r=t-(e-u);return d?Math.min(r,o-n):r}(e))}function _(e){return l=void 0,f&&r?g(e):(r=i=void 0,s)}function T(){for(var e=Date.now(),n=v(e),o=arguments.length,a=new Array(o),f=0;f0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(e);return i.className=r,i.innerHTML=t,Object.keys(n).forEach((function(t){var r=t,o=n[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(r,o):i.setAttribute(r,o)})),i},s.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var r=document.createElement("div");r.innerHTML=e;var o=r.children;return r=null,o.length>0?(o=o[0],n&&s.addClass(o,n),t&&Object.keys(t).forEach((function(e){o.setAttribute(e,t[e])})),o):null}catch(e){return i.A.logError("util.createDomFromHtml",e),null}},s.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(i){var n=e.className&&"object"===(0,r.uk)(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},s.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(n){s.hasClass(e,t)||(e.className&&"object"===(0,r.uk)(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},s.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(n){s.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===(0,r.uk)(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")}))}},s.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){s.hasClass(e,t)?s.removeClass(e,t):s.addClass(e,t)}))},s.classNames=function(){for(var e=arguments,t=[],n=function(n){"String"===s.typeOf(e[n])?t.push(e[n]):"Object"===s.typeOf(e[n])&&Object.keys(e[n]).map((function(r){e[n][r]&&t.push(r)}))},r=0;r0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(n)}catch(r){i.A.logError("util.findDom",r),0===n.indexOf("#")&&(e=t.getElementById(n.slice(1)))}return e},s.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},s.padStart=function(e,t,n){for(var r=String(n),i=0|t,o=Math.ceil(i/r.length),s=[],a=String(e);o--;)s.push(r);return s.join("").substring(0,i-a.length)+a},s.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=s.padStart(Math.floor(e/3600),2,0),n=s.padStart(Math.floor((e-3600*t)/60),2,0),r=s.padStart(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,r]:[t,n,r]).join(":")},s.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},s.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},s.deepCopy=function(e,t){if("Object"===s.typeOf(t)&&"Object"===s.typeOf(e))return Object.keys(t).forEach((function(n){"Object"!==s.typeOf(t[n])||t[n]instanceof Node?"Array"===s.typeOf(t[n])?e[n]="Array"===s.typeOf(e[n])?e[n].concat(t[n]):t[n]:e[n]=t[n]:void 0===e[n]||void 0===e[n]?e[n]=t[n]:s.deepCopy(e[n],t[n])})),e},s.deepMerge=function(e,t){return Object.keys(t).map((function(n){var i;"Array"===s.typeOf(t[n])&&"Array"===s.typeOf(e[n])?"Array"===s.typeOf(e[n])&&(i=e[n]).push.apply(i,(0,r.Og)(t[n])):s.typeOf(e[n])!==s.typeOf(t[n])||null===e[n]||"Object"!==s.typeOf(e[n])||t[n]instanceof window.Node?null!==t[n]&&(e[n]=t[n]):s.deepMerge(e[n],t[n])})),e},s.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var n=document.createElement("a");return n.href=t.replace(/url\("|"\)/g,""),n.href},s.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""},s.setInterval=function(e,t,n,r){e._interval[t]||(e._interval[t]=window.setInterval(n.bind(e),r))},s.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},s.setTimeout=function(e,t,n){e._timers||(e._timers=[]);var r=setTimeout((function(){t(),s.clearTimeout(e,r)}),n);return e._timers.push(r),r},s.clearTimeout=function(e,t){var n=e._timers;if("Array"===s.typeOf(n)){for(var r=0;r-1&&r.indexOf(e)>-1&&(i=parseFloat(n.slice(0,n.indexOf(e)).trim()),o=parseFloat(r.slice(0,r.indexOf(e)).trim()),a=e,1))})),l.style.width="".concat(i).concat(a),l.style.height="".concat(o).concat(a),l.style.backgroundSize="".concat(i).concat(a," ").concat(o).concat(a),l.style.margin="start"===e?"-".concat(o/2).concat(a," auto auto -").concat(i/2).concat(a):"auto 5px auto 5px"),l},s.Hex2RGBA=function(e,t){var n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var r="#";e.replace(/[0-9A-F]/gi,(function(e){r+=e+e})),e=r}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(parseInt(e,16))})),"rgba(".concat(n.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},s.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},s.checkIsFunction=function(e){return e&&"function"==typeof e},s.checkIsObject=function(e){return null!==e&&"object"===(0,r.uk)(e)},s.hide=function(e){e.style.display="none"},s.show=function(e,t){e.style.display=t||"block"},s.isUndefined=function(e){if(null==e)return!0},s.isNotNull=function(e){return!(null==e)},s.setStyleFromCsstext=function(e,t){t&&("String"===s.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var n=t.split(":");n.length>1&&(e.style[n[0]]=n[1])}})):Object.keys(t).map((function(n){e.style[n]=t[n]})))},s.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"],n=e.style.cssText;if(!n)return{};var r=n.replace(/\s+/g,"").split(";"),i={},o={};return r.map((function(e){if(e){var n=e.split(":");n.length>1&&(function(e,t){for(var n=0,r=t.length;n-1)return!0;return!1}(n[0],t)?i[n[0]]=n[1]:o[n[0]]=n[1])}})),e.setAttribute("style",""),Object.keys(o).map((function(t){e.style[t]=o[t]})),i},s.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var n=t.replace(/\s+/g,"").split(";"),r={};return n.map((function(e){if(e){var t=e.split(":");t.length>1&&(r[t[0]]=t[1])}})),r},s.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var r=new window.Image;r.onload=function(e){r=null,t&&t(e)},r.onerror=function(e){r=null,n&&n(e)},r.src=e}},s.stopPropagation=function(e){e&&e.stopPropagation()},s.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},s.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},s.checkTouchSupport=function(){return"ontouchstart"in window},s.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],r=0;rl&&(i[a-1].end=n[s].end):i.push(n[s])}else i.push(n[s])}else i=n;return new o(i)},s.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}},s.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},s.getHostFromUrl=function(e){if("String"!==s.typeOf(e))return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},s.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},s.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},s.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},s.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch(t){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 n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},s.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},s.adjustTimeByDuration=function(e,t,n){return t&&e&&(e>t||n&&e0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(n).forEach((function(e){var r=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),i="".concat(e,"(").concat(n[e],")");r.test(t)?(r.lastIndex=-1,t=t.replace(r,i)):t+="".concat(i," ")})),t},s.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},s.getIndexByTime=function(e,t){var n=t.length,r=-1;if(n<1)return r;if(e<=t[0].end||n<2)r=0;else if(e>t[n-1].end)r=n-1;else for(var i=1;it[i-1].end&&e<=t[i].end){r=i;break}return r},s.getOffsetCurrentTime=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if((n=r>=0&&r=a&&e<=l?e-c:e>l&&n>=i-1?l:-1},s.getCurrentTimeByOffset=function(e,t){var n=-1;if(!t||t.length<0)return e;for(var r=0;r{"use strict";n.d(t,{A:()=>R});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=300||!s)return function(e,t,n,r){var i=(r||{}).message||"";i=i?", reason is: ".concat(i):"",t(new P("Request failed with status code "+e.status+i,n,null,e,{data:{}},!0))}(i,r,e,o),void(i=null);var a={data:s,status:i.status,statusText:i.statusText,request:i};t(a),i=null}},i.onerror=function(){r(new P("Network Error",e,null,i,{data:{}},!0)),i=null},i.timeout=n,i.ontimeout=function(){r(new P("timeout of "+n+"ms exceeded",e,"ECONNABORTED",i,{data:{}},!0)),i=null},i.send()}))}var R=function(e){function t(t){return t.store||(t.store=k),t.request||(t.request=M),e.call(this,t)||this}return i(t,e),t}(S)},17283:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=class{constructor(e){this.type="afterLoad",this.condition={},this.tccUrl=e.tccUrl,this.condition=e.condition,this.tccKey=e.tccKey||"text_custom_config",this.expiredTime=e.expiredTime||1e4}createRequest(e,t){const{timeout:n}=t,r=this.tccKey;return new Promise((function(t,i){e||i("[@ies/starling_client_text_replace_plugin]: tccUrl is required");const o=new XMLHttpRequest;o.open("GET",e),o.withCredentials=!1,o.onreadystatechange=function(){if(!o||4!==o.readyState)return;let e=[];try{const t=JSON.parse(o.responseText);e=JSON.parse(t.data[r])}catch(e){i(e)}o.status<200||o.status>=300?i("server error"):t({data:e})},o.onerror=function(e){i(e)},o.timeout=n,o.ontimeout=function(e){i(e)},o.send()}))}async getWithCache(e){const t=`starling_tcc_${e}`,n=(e=>{try{return JSON.parse(localStorage.getItem(e)||"")}catch(e){return{}}})(t);try{if(n&&n.data&&n.expiredTime&&Date.now()-+n.expiredTime{try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.log(e)}})(t,{data:e.data,expiredTime:Date.now()}),e.data}catch(e){return n&&n.data?n.data:(console.error(e),[])}}validate(e){return Array.isArray(e)?!(!this.condition||"object"!=typeof this.condition||!Object.keys(this.condition).length)||(console.warn("condition should be an object"),!1):(console.warn("tcc error: tcc config should be an array"),!1)}createRule(e){return e.reduce(((e,t)=>{if(!Array.isArray(t.condition))return e;const n=t.condition.reduce(((e,t)=>e||this.condition[t.type]==t.value),!1),r=Object.assign({},e.replace,t.rule.replace||{}),i=e.whitelist.concat(t.rule.whitelist||[]);return n?{replace:r,whitelist:i}:e}),{replace:{},whitelist:[]})}replaceByRule(e,t){let n="";if(Object.keys(e).forEach((e=>{RegExp(e,"i").test(t)&&(n=e.length>n.length?e:n)})),n){const r=RegExp(n,"ig");t=t.replace(r,e[n])}return t}async process(e,t){const n=await this.getWithCache(t.apiKey||"");if(!this.validate(n))return e;const{replace:r,whitelist:i}=this.createRule(n);return Object.keys(e).reduce(((t,n)=>{let o=e[n];return i.includes(n)||(o=this.replaceByRule(r,o)),t[n]=o,t}),{})}processSync(e,t,n){if(!this.validate(t))return e;const{replace:r,whitelist:i}=this.createRule(t);return i.includes(n)||(e=this.replaceByRule(r,e)),e}}},77966:(e,t,n)=>{"use strict";n.d(t,{F2:()=>Ee,OV:()=>xe,Ay:()=>De});var r=n(30878),i=n(451),o=n(22523),s=n(2303),a=n(17480),l=n(69236),u=n(76439),c=n(28803),h={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},d=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,o.A)(this,e),this.init(t,n)}return(0,s.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||h,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function v(e,t,n){var r=m(e,t,Object);r.obj[r.k]=n}function y(e,t){var n=m(e,t),r=n.obj,i=n.k;if(r)return r[i]}function _(e,t,n){var r=y(e,n);return void 0!==r?r:y(t,n)}function T(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):T(e[r],t[r],n):e[r]=t[r]);return e}function b(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var S={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function k(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return S[e]})):e}var P="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,M=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return(0,o.A)(this,t),n=(0,a.A)(this,(0,l.A)(t).call(this)),P&&f.call((0,u.A)(n)),n.data=e||{},n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n}return(0,c.A)(t,e),(0,s.A)(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=[e,t];return n&&"string"!=typeof n&&(o=o.concat(n)),n&&"string"==typeof n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split(".")),y(this.data,o)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(s=e.split("."))[1]),this.addNamespaces(t),v(this.data,s,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var l=y(this.data,a)||{};r?T(l,n,o):l=(0,i.A)({},l,n),v(this.data,a,l),s.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?(0,i.A)({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(f),R={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}},w={},x=function(e){function t(e){var n,r,i,s,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,o.A)(this,t),n=(0,a.A)(this,(0,l.A)(t).call(this)),P&&f.call((0,u.A)(n)),r=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],i=e,s=(0,u.A)(n),r.forEach((function(e){i[e]&&(s[e]=i[e])})),n.options=c,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=d.create("translator"),n}return(0,c.A)(t,e),(0,s.A)(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS;if(n&&e.indexOf(n)>-1){var o=e.match(this.interpolator.nestingRegexp);if(o&&o.length>0)return{key:e,namespaces:i};var s=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(s[0])>-1)&&(i=s.shift()),e=s.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,n,o){var s=this;if("object"!==(0,r.A)(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),n||(n={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var a=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,l=this.extractFromKey(e[e.length-1],n),u=l.key,c=l.namespaces,h=c[c.length-1],d=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var p=n.nsSeparator||this.options.nsSeparator;return h+p+u}return u}var g=this.resolve(e,n),m=g&&g.res,v=g&&g.usedKey||u,y=g&&g.exactUsedKey||u,_=Object.prototype.toString.apply(m),T=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject;if(b&&m&&"string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(_)<0&&("string"!=typeof T||"[object Array]"!==_)){if(!n.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,m,n):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");if(a){var S="[object Array]"===_,k=S?[]:{},P=S?y:v;for(var M in m)if(Object.prototype.hasOwnProperty.call(m,M)){var R="".concat(P).concat(a).concat(M);k[M]=this.translate(R,(0,i.A)({},n,{joinArrays:!1,ns:c})),k[M]===R&&(k[M]=m[M])}m=k}}else if(b&&"string"==typeof T&&"[object Array]"===_)(m=m.join(T))&&(m=this.extendTranslation(m,e,n,o));else{var w=!1,x=!1,E=void 0!==n.count&&"string"!=typeof n.count,D=t.hasDefaultValue(n),I=E?this.pluralResolver.getSuffix(d,n.count):"",C=n["defaultValue".concat(I)]||n.defaultValue;!this.isValidLookup(m)&&D&&(w=!0,m=C),this.isValidLookup(m)||(x=!0,m=u);var L=D&&C!==m&&this.options.updateMissing;if(x||w||L){if(this.logger.log(L?"updateKey":"missingKey",d,h,u,L?C:m),a){var O=this.resolve(u,(0,i.A)({},n,{keySeparator:!1}));O&&O.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var A=[],G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&G&&G[0])for(var $=0;$1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var l=s.extractFromKey(e,a),u=l.key;n=u;var c=l.namespaces;s.options.fallbackNS&&(c=c.concat(s.options.fallbackNS));var h=void 0!==a.count&&"string"!=typeof a.count,d=void 0!==a.context&&"string"==typeof a.context&&""!==a.context,f=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);c.forEach((function(e){s.isValidLookup(t)||(o=e,!w["".concat(f[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(w["".concat(f[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(f.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach((function(n){if(!s.isValidLookup(t)){i=n;var o,l,c=u,f=[c];for(s.i18nFormat&&s.i18nFormat.addLookupKeys?s.i18nFormat.addLookupKeys(f,u,n,e,a):(h&&(o=s.pluralResolver.getSuffix(n,a.count)),h&&d&&f.push(c+o),d&&f.push(c+="".concat(s.options.contextSeparator).concat(a.context)),h&&f.push(c+=o));l=f.pop();)s.isValidLookup(t)||(r=l,t=s.getResource(n,e,l,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),t}(f);function E(e){return e.charAt(0).toUpperCase()+e.slice(1)}var D=function(){function e(t){(0,o.A)(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=d.create("languageUtils")}return(0,s.A)(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=E(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=E(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=E(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),I=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],C={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},L=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,o.A)(this,e),this.languageUtils=t,this.options=r,this.logger=d.create("pluralResolver"),this.rules=(n={},I.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:C[e.fc]}}))})),n)}return(0,s.A)(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,n=this.getRule(e);return n?n.numbers.map((function(n){return t.getSuffix(e,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=this,r=this.getRule(e);if(r){var i=r.noAbs?r.plurals(t):r.plurals(Math.abs(t)),o=r.numbers[i];this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]?s():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),O=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o.A)(this,e),this.logger=d.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return(0,s.A)(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:k,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?b(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?b(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?b(t.nestingPrefix):t.nestingPrefixEscaped||b("$t("),this.nestingSuffix=t.nestingSuffix?b(t.nestingSuffix):t.nestingSuffixEscaped||b(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(a.formatSeparator)<0){var i=_(t,l,e);return a.alwaysFormat?a.format(i,void 0,n):i}var o=e.split(a.formatSeparator),s=o.shift().trim(),u=o.join(a.formatSeparator).trim();return a.format(_(t,l,s),u,n,r)};this.resetRegExp();var h=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,d=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?u(a.escape(e)):u(e)}}].forEach((function(t){for(s=0;i=t.regex.exec(e);){if(void 0===(o=c(i[1].trim())))if("function"==typeof h){var n=h(e,i,r);o="string"==typeof n?n:""}else{if(d){o=i[0];continue}a.logger.warn("missed to pass in variable ".concat(i[1]," for interpolating ").concat(e)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=g(o));if(e=e.replace(i[0],t.safeValue(o)),t.regex.lastIndex=0,++s>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,o=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=(0,i.A)({},s);function l(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0],o=(o=this.interpolate(o,a)).replace(/'/g,'"');try{a=JSON.parse(o),t&&(a=(0,i.A)({},t,a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;n=this.nestingRegexp.exec(e);){var u=[],c=!1;if(n[0].includes(this.formatSeparator)&&!/{.*}/.test(n[1])){var h=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=h.shift(),u=h,c=!0}if((r=t(l.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=g(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=u.reduce((function(e,t){return o.format(e,t,s.lng,s)}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}(),A=function(e){function t(e,n,r){var i,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,o.A)(this,t),i=(0,a.A)(this,(0,l.A)(t).call(this)),P&&f.call((0,u.A)(i)),i.backend=e,i.store=n,i.services=r,i.languageUtils=r.languageUtils,i.options=s,i.logger=d.create("backendConnector"),i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(r,s.backend,s),i}return(0,c.A)(t,e),(0,s.A)(t,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o=[],s=[],a=[],l=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?s.indexOf(a)<0&&s.push(a):(i.state[a]=1,r=!1,s.indexOf(a)<0&&s.push(a),o.indexOf(a)<0&&o.push(a),l.indexOf(t)<0&&l.push(t)))})),r||a.push(e)})),(o.length||s.length)&&this.queue.push({pending:s,loaded:{},errors:[],callback:r}),{toLoad:o,pending:s,toLoadLanguages:a,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){var r,a,l,u,c;r=n.loaded,a=o,(u=(l=m(r,[i],Object)).obj)[c=l.k]=u[c]||[],u[c].push(a),function(e,t){for(var n=e.indexOf(t);-1!==n;)e.splice(n,1),n=e.indexOf(t)}(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]=[]),n.loaded[e].length&&n.loaded[e].forEach((function(t){s[e].indexOf(t)<0&&s[e].push(t)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,s=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[n](e,t,(function(a,l){a&&l&&i<5?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,s)}),o):s(a,l)})):s(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,s){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),s),t.loaded(e,r,s)}))}},{key:"saveMissing",value:function(e,t,n,r,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,(0,i.A)({},s,{isUpdate:o})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),t}(f);function G(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $(){}const B=new(function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if((0,o.A)(this,t),e=(0,a.A)(this,(0,l.A)(t).call(this)),P&&f.call((0,u.A)(e)),e.options=G(n),e.services={},e.logger=d,e.modules={external:[]},r&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,r),(0,a.A)(e,(0,u.A)(e));setTimeout((function(){e.init(n,r)}),0)}return e}return(0,c.A)(t,e),(0,s.A)(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;function o(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(n=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=(0,i.A)({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===(0,r.A)(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===(0,r.A)(e[2])||"object"===(0,r.A)(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,G(t)),this.format=this.options.interpolation.format,n||(n=$),!this.options.isClone){this.modules.logger?d.init(o(this.modules.logger),this.options):d.init(null,this.options);var s=new D(this.options);this.store=new M(this.options.resources,this.options);var a=this.services;a.logger=d,a.resourceStore=this.store,a.languageUtils=s,a.pluralResolver=new L(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),a.interpolator=new O(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new A(o(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1?n-1:0),i=1;i0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var u=p(),c=function(){var t=function(t,r){e.isInitialized&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$,r="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return n();var i=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return o(e)})),this.options.preload&&this.options.preload.forEach((function(e){return o(e)})),this.services.backendConnector.load(i,this.options.ns,n)}else n(null)}},{key:"reloadResources",value:function(e,t,n){var r=p();return e||(e=this.languages),t||(t=this.options.ns),n||(n=$),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&R.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=p();this.emit("languageChanging",e);var i=function(e){var i="string"==typeof e?e:n.services.languageUtils.getBestMatchFromCodes(e);i&&(n.language||(n.language=i,n.languages=n.services.languageUtils.toResolveHierarchy(i)),n.translator.language||n.translator.changeLanguage(i),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(i)),n.loadResources(i,(function(e){!function(e,i){i?(n.language=i,n.languages=n.services.languageUtils.toResolveHierarchy(i),n.translator.changeLanguage(i),n.isLanguageChangingTo=void 0,n.emit("languageChanged",i),n.logger.log("languageChanged",i)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,i)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t){var n=this,o=function e(t,o){var s;if("object"!==(0,r.A)(o)){for(var a=arguments.length,l=new Array(a>2?a-2:0),u=2;u1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var s=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var a=n.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||!(!s(r,e)||i&&!s(o,e))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=p();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=p();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),e?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr":"rtl"}},{key:"createInstance",value:function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$,o=(0,i.A)({},this.options,n,{isClone:!0}),s=new t(o);return["store","services","language"].forEach((function(t){s[t]=e[t]})),s.services=(0,i.A)({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s.translator=new x(s.services,s.options),s.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}void 0===n&&(n=null);for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=e[s]}return i()?{}:{obj:e,k:r(o.shift())}}!function(e){e.keepRaw="keepRaw",e.replaceAnyway="replaceAnyway"}(J||(J={})),J.replaceAnyway;var te={memoize:!1,memoizeFallback:!1,bindI18n:!1,bindI18nStore:!1,onParseError:J.replaceAnyway},ne=function(){function e(){this.mem={}}return e.staticInit=function(t){e._i18nextInstance=t},e.prototype.init=function(t,n){var r=this;void 0===t&&(t=e._i18nextInstance);var i={};if((null==t?void 0:t.options)&&(t.options.i18nFormat&&(i=t.options.i18nFormat),i.onParseError=t.options.onParseError,i.missingInterpolationHandler=t.options.missingInterpolationHandler,i.icuConfig=t.options.icuConfig,i.ignoreWarning=!!t.options.ignoreWarning),this.options=Object.assign(te,n,i),this.formats=this.options.formats,t){var o=this.options,s=o.bindI18n,a=o.bindI18nStore,l=o.memoize;t.IntlMessageFormat=Y,this.IntlMessageFormat=Y,t.ICU=this,l&&(s&&t.on(s,(function(){return r.clearCache()})),a&&t.store.on(a,(function(){return r.clearCache()})))}this.options.localeData&&("[object Array]"===Object.prototype.toString.apply(this.options.localeData)?this.options.localeData.forEach((function(e){return r.addLocaleData(e)})):this.addLocaleData(this.options.localeData))},e.prototype.addLocaleData=function(e){("[object Array]"===Object.prototype.toString.apply(e)?e:[e]).forEach((function(e){e&&e.locale&&Y.__addLocaleData(e)}))},e.prototype.addUserDefinedFormats=function(e){this.formats=this.formats?Z(Z({},this.formats),e):e},e.prototype.checkMissingInterpolation=function(e,t,n,r,i){if(!1===(this.options.icuConfig||{}).strict)return n;for(var o={},s=0,a=e;s-1?(window.__STARLING_INCONTEXT_GLOBAL__HOOK__.payload[t][s].default=e,o=s):o=window.__STARLING_INCONTEXT_GLOBAL__HOOK__.payload[t].push({options:n,default:e})-1}else window.__STARLING_INCONTEXT_GLOBAL__HOOK__.payload[t]=[{options:n,default:e}],o=0;return"[[__starling_"+o+"_"+t+"__]]"}return e}};function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw i}}}}(e._waitingToAddResourceBundle);try{for(s.s();!(o=s.n()).done;){var a,l=o.value;(a=e.instance).addResourceBundle.apply(a,ue(l))}}catch(r){s.e(r)}finally{s.f()}e._waitingToAddResourceBundle=[]}catch(r){}r||(e._updateLanguages(),t({t:i,err:r})),e.init=!0,n({t:i,err:r})}))}))}},{key:"_updateLanguages",value:function(){this.languages=this.instance?Array.from(new Set([this.instance.language].concat(ue(this.instance.languages)))):null}},{key:"getLanguages",value:function(){return this.languages}},{key:"changeLanguage",value:function(e,t){var n=this;this.config.lng=e,this.instance.changeLanguage(e,(function(e,r){e||n._updateLanguages(),t&&t(e,r)}))}},{key:"changeLanguageWithPromise",value:function(e){var t=this;return new Promise((function(n,r){t.config.lng=e,t.instance.changeLanguage(e,(function(e,i){e&&r({err:e,t:i}),t._updateLanguages(),n({err:e,t:i})}))}))}},{key:"getDir",value:function(e){return this.instance.dir(e)}},{key:"addResourceBundle",value:function(e,t,n,r,i){return this.instance.isInitialized?this.instance.addResourceBundle(e,t,n,r,i):(this._waitingToAddResourceBundle.push([e,t,n,!!r,!!i]),this.instance)}}]),e}(),ke="Starling_intl:",Pe=function(){for(var e,t="".concat(ke," [ERROR]"),n=arguments.length,r=new Array(n),i=0;i{"use strict";n.d(t,{A:()=>V});var r=n(55371),i=n(95689),o=n(57923),s=n(78647),a=n(51611),l=n(16960),u=n(14444),c=n(40099),h=n(18499);function d(e){var t=[];return c.Children.forEach(e,(function(e){t.push(e)})),t}function f(e,t){var n=null;return e&&e.forEach((function(e){n||e&&e.key===t&&(n=e)})),n}function p(e,t,n){var r=null;return e&&e.forEach((function(e){if(e&&e.key===t&&e.props[n]){if(r)throw new Error("two child with same key for children");r=e}})),r}var g=n(33726);const m=function(e){return e.transitionName&&e.transitionAppear||e.animation.appear},v=function(e){return e.transitionName&&e.transitionEnter||e.animation.enter},y=function(e){return e.transitionName&&e.transitionLeave||e.animation.leave},_=function(e){return e.transitionAppear||e.animation.appear},T=function(e){return e.transitionEnter||e.animation.enter},b=function(e){return e.transitionLeave||e.animation.leave};var S=function(){function e(e,t){for(var n=0;n children");return c.createElement(P,{key:n.key,ref:function(t){e.childrenRefs[n.key]=t},animation:t.animation,transitionName:t.transitionName,transitionEnter:t.transitionEnter,transitionAppear:t.transitionAppear,transitionLeave:t.transitionLeave},n)})));var i=t.component;if(i){var o=t;return"string"==typeof i&&(o=M({className:t.className,style:t.style},t.componentProps)),c.createElement(i,o,r)}return r[0]||null}}]),t}(c.Component);D.isAnimate=!0,D.defaultProps={animation:{},component:"span",componentProps:{},transitionEnter:!0,transitionLeave:!0,transitionAppear:!1,onEnd:E,onEnter:E,onLeave:E,onAppear:E};var I=function(){var e=this;this.performEnter=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillEnter(e.handleDoneAdding.bind(e,t,"enter")))},this.performAppear=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillAppear(e.handleDoneAdding.bind(e,t,"appear")))},this.handleDoneAdding=function(t,n){var r=e.props;if(delete e.currentlyAnimatingKeys[t],!r.exclusive||r===e.nextProps){var i=d(x(r));e.isValidChildByKey(i,t)?"appear"===n?_(r)&&(r.onAppear(t),r.onEnd(t,!0)):T(r)&&(r.onEnter(t),r.onEnd(t,!0)):e.performLeave(t)}},this.performLeave=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillLeave(e.handleDoneLeaving.bind(e,t)))},this.handleDoneLeaving=function(t){var n=e.props;if(delete e.currentlyAnimatingKeys[t],!n.exclusive||n===e.nextProps){var r,i,o,s,a=d(x(n));if(e.isValidChildByKey(a,t))e.performEnter(t);else{var l=function(){b(n)&&(n.onLeave(t),n.onEnd(t,!1))};r=e.state.children,i=a,o=n.showProp,(s=r.length===i.length)&&r.forEach((function(e,t){var n=i[t];e&&n&&(e&&!n||!e&&n||e.key!==n.key||o&&e.props[o]!==n.props[o])&&(s=!1)})),s?l():e.setState({children:a},l)}}}};const C=function(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");return"function"!=typeof t.componentWillReceiveProps?e:c.Profiler?(t.UNSAFE_componentWillReceiveProps=t.componentWillReceiveProps,delete t.componentWillReceiveProps,e):e}(D);var L=n(61978),O=n.n(L);var A=function(e){(0,a.A)(d,e);var t,n,r=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=(0,u.A)(t);if(n){var i=(0,u.A)(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return(0,l.A)(this,e)});function d(){var e;return(0,o.A)(this,d),(e=r.apply(this,arguments)).closeTimer=null,e.close=function(t){t&&t.stopPropagation(),e.clearCloseTimer();var n=e.props.onClose;n&&n()},e.startCloseTimer=function(){e.props.duration&&(e.closeTimer=window.setTimeout((function(){e.close()}),1e3*e.props.duration))},e.clearCloseTimer=function(){e.closeTimer&&(clearTimeout(e.closeTimer),e.closeTimer=null)},e}return(0,s.A)(d,[{key:"componentDidMount",value:function(){this.startCloseTimer()}},{key:"componentDidUpdate",value:function(e){(this.props.duration!==e.duration||this.props.update)&&this.restartCloseTimer()}},{key:"componentWillUnmount",value:function(){this.clearCloseTimer()}},{key:"restartCloseTimer",value:function(){this.clearCloseTimer(),this.startCloseTimer()}},{key:"render",value:function(){var e=this,t=this.props,n=t.prefixCls,r=t.className,o=t.closable,s=t.closeIcon,a=t.style,l=t.onClick,u=t.children,d=t.holder,f="".concat(n,"-notice"),p=Object.keys(this.props).reduce((function(t,n){return"data-"!==n.substr(0,5)&&"aria-"!==n.substr(0,5)&&"role"!==n||(t[n]=e.props[n]),t}),{}),g=c.createElement("div",Object.assign({className:O()(f,r,(0,i.A)({},"".concat(f,"-closable"),o)),style:a,onMouseEnter:this.clearCloseTimer,onMouseLeave:this.startCloseTimer,onClick:l},p),c.createElement("div",{className:"".concat(f,"-content")},u),o?c.createElement("a",{tabIndex:0,onClick:this.close,className:"".concat(f,"-close")},s||c.createElement("span",{className:"".concat(f,"-close-x")})):null);return d?h.createPortal(g,d):g}}]),d}(c.Component);A.defaultProps={onClose:function(){},duration:1.5,style:{right:"50%"}};var G=n(83100),$=n(54042);function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t=o&&(t.updateKey=a[0].notice.updateKey||a[0].notice.key,a.shift()),a.push({notice:t,holderCallback:n})),{notices:a}}))},e.remove=function(t){e.setState((function(e){return{notices:e.notices.filter((function(e){return e.notice.key!==t}))}}))},e}return(0,s.A)(i,[{key:"getTransitionName",value:function(){var e=this.props,t=e.prefixCls,n=e.animation,r=this.props.transitionName;return!r&&n&&(r="".concat(t,"-").concat(n)),r}},{key:"render",value:function(){var e=this,t=this.state.notices,n=this.props,r=n.prefixCls,i=n.className,o=n.closeIcon,s=n.style,a=t.map((function(n,i){var s=n.notice,a=n.holderCallback,l=Boolean(i===t.length-1&&s.updateKey),u=s.updateKey?s.updateKey:s.key,h=function(){var e=[].slice.call(arguments,0);return 1===e.length?e[0]:function(){for(var t=0;t{"use strict";function r(e){return"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)}function i(){const e=arguments.length;let t=arguments[0];r(t)||(t={});for(let n=1;no,a:()=>s,d:()=>i});const o="g_ven",s="g_exp"},6607:(e,t,n)=>{"use strict";n.d(t,{V:()=>d,_:()=>y,a:()=>_,b:()=>v,g:()=>m,p:()=>p});var r=n(94982);const i=/ANGLE\s+\((?:[^,]+,\s+)?(?:[^:]*:)?([^,/]+)?(?:[^,]*)(?:[,\s]+)(Direct\S+|OpenGL[\d.\s]+|Unspecified)/,o=/ANGLE\s+\((?:[^,]+,\s+)?([^,]+)?(?:[,\s]+)(Direct\S+|OpenGL[\d.\s]+)/,s=/ANGLE\s+\((?:[^,]+,\s+)?(?:[^:]+:\s+)?([^,]+)?(?:[,\s]+)(Direct\S+|OpenGL[\d.\s]+)?/,a="OpenGL Engine",l="Unknow",u=4318,c=32902,h=4098;var d=(e=>(e.CpuDeriver="CpuDeriver",e.Intel="Intel",e.Nvidia="NVIDIA",e.Amd="AMD",e.Apple="Apple",e.Adreno="Adreno",e[e.Unknow=l]="Unknow",e))(d||{});function f(e){return"NVIDIA"===e?u:"AMD"===e?h:"Intel"===e?c:0}function p(e){const t=function(e){const t=/(SwiftShader|Intel|NVIDIA|AMD|Radeon|Apple|Adreno)/.exec(e);return t?"Radeon"===t[0]?"AMD":"SwiftShader"===t[0]?"CpuDeriver":t[0]:d.Unknow}(e);return t===d.Unknow||"CpuDeriver"===t?{vendor:t,vendorId:0,model:e,backupModel:e,api:l,origin:e}:/^ANGLE/.test(e)?function(e,t){let n,r=l,u=l,c=l;return("Intel"===e||"NVIDIA"===e)&&(n=i.exec(t)),("AMD"===e||"Adreno"===e)&&(n=o.exec(t)),"Apple"===e&&(n=s.exec(t)),null!=n&&n[1]&&(r=n[1].replace(/(AMD|NVIDIA)/,"").trim()),null!=n&&n[2]&&(c=n[2].trim()),r=r.split("(0x00")[0].trim(),u="Intel"===e?r=r.split(a)[0].trim():r.split(a)[0].trim(),{vendor:e,vendorId:f(e),model:r,backupModel:u,api:c,origin:t}}(t,e):"Intel"===t?{vendor:t,vendorId:f(t),model:e.split(a)[0].trim(),backupModel:e.split(a)[0].trim(),api:l,origin:e}:{vendor:t,vendorId:f(t),model:e.replace(/(AMD|NVIDIA)/,"").trim(),backupModel:e.split(a)[0].replace(/(AMD|NVIDIA)/,"").trim(),api:l,origin:e}}let g="";function m(e){if(g)return g;g=localStorage.getItem(r.C)||"";const t=Number(localStorage.getItem(r.a));if(g){const n=t?Date.now()-t:0;if(null==e||!e.expiration||ne.expiration&&(localStorage.removeItem(r.C),localStorage.removeItem(r.a))}return g=function(){try{let e,t;const n=document.createElement("canvas").getContext("webgl");if(n)return t=n.getExtension("WEBGL_debug_renderer_info"),e=t?n.getParameter(t.UNMASKED_RENDERER_WEBGL):"",e}catch{}return""}(),localStorage.setItem(r.C,g),localStorage.setItem(r.a,""+Date.now()),g}function v(e,t){let n=[];switch(t){case d.Intel:n=e.split("\n").map((e=>`Intel(R) ${e}`.replace("#","Graphics").replace("*","HD")));break;case d.Amd:n=e.split("\n").map((e=>e.replace("@","Radeon").replace("*","HD").replace("^","RX")));break;case d.Nvidia:n=e.split("\n").map((e=>e.replace("$","GeForce").replace("%","RTX").replace("&","GTX")))}return n.map((e=>e.split("|")))}function y(e,t){let n=e.filter((e=>e[0]===t.model));n.length||(n=e.filter((e=>e[0]===t.backupModel))),!n.length&&t.vendor===d.Intel&&!/^Intel(R)/.test(t.model)&&(n=e.filter((e=>e[0]==="Intel(R) "+t.model)));let r="-1";if(n.length){const e=n[0][1];r="-1"===e?"0":e}return parseInt(r)}function _(e){return 0===e?0:-1===e?-1:parseFloat(Math.log2(e).toFixed(2))}},8267:(e,t,n)=>{"use strict";n.d(t,{y5:()=>Ro,Ay:()=>bs});var r=Object.defineProperty,i=(e,t,n)=>((e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class o{static getDefaultConfig(){return{rangeMaxDuration:15,rangeMinDuration:5,rangeMinSize:409600,safeFactor:.1,cacheSafeFactor:3,minDangerThreshold:5,estPlayTime:12,minBandwidth:1e6,estPTcontrol:!1,minTargetCacheDur:30,maxTargetCacheDur:60,targetCacheControl:!1,rangeControl:!1}}constructor(e,t,n,r){this.config=o.getDefaultConfig(),Object.keys(r).map((e=>{void 0!==r[e]&&null!==r[e]&&(this.config[e]=r[e])})),this.duration=n,this.player=e,this.updateBitrate(t)}updateBitrate(e){this.bitrate=e,this.bitrate||(this.bitrate=this.config.minBandwidth)}getAdaptLoadDuration(){const{player:e,config:t}=this;if(!t.rangeControl)return-1;const n=(null==e?void 0:e.bufferedPoint)||null,r=n&&n.end?n.end-e.currentTime:0;return Math.max(t.rangeMaxDuration-r,t.rangeMinDuration)}getAdaptCacheBuffer(){const{player:e,config:t,bitrate:n}=this;if(!t.targetCacheControl)return-1;const{estPlayTime:r}=t;let i=r;t.estPTcontrol&&(i=Math.min(r,this.duration-((null==e?void 0:e.currentTime)||0)));const o=1024*(null==e?void 0:e.avgSpeed)||0;let s=Math.max(t.safeFactor*o,t.minBandwidth);e&&e.avgSpeed&&(s=t.safeFactor*o);let a=n>0?Math.floor((1-s/n)*i):0;return a=t.minDangerThreshold+Math.max(a,0),Math.min(Math.max(t.cacheSafeFactor*a,t.minTargetCacheDur),t.maxTargetCacheDur)}}class s{static getDefaultConfig(){return{rangeControl:!1,rangeMaxDuration:20,rangeMinDuration:5,rangeMinSize:409600,rangeFloatSize:10240,safeFactor:.1,cacheSafeFactor:3,minDangerThreshold:5,estPlayTime:12,minBandwidth:1e6,estPTcontrol:!1,minTargetCacheDur:30,maxTargetCacheDur:60,targetCacheControl:!1}}constructor(e,t,n,r){this.config=s.getDefaultConfig(),Object.keys(r).map((e=>{void 0!==r[e]&&null!==r[e]&&(this.config[e]=r[e])})),this.duration=n,this.player=e,this.updateBitrate(t)}updateBitrate(e){this.bitrate=e,this.bitrate||(this.bitrate=this.config.minBandwidth)}getBuffer(){const{player:e}=this,t=(null==e?void 0:e.bufferedPoint)||null;return t&&t.end?t.end-e.currentTime:0}getAdaptLoadDuration(){const{config:e,duration:t}=this;if(!e.rangeControl)return-1;const n=this.getBuffer(),r=t-n,i=Math.min(r,e.rangeMaxDuration-n);return Math.max(i,e.rangeMinDuration)}getAdaptRangeSize(e){const{config:t,bitrate:n,duration:r}=this;if(!t.rangeControl)return-1;e||(e=this.getAdaptLoadDuration());const i=r-this.getBuffer();let o=Math.max(t.rangeMinSize,e*n/8);const s=i*n/8;return o+t.rangeFloatSize>=s&&(o=s),Math.ceil(o)}getAdaptCacheBuffer(){const{player:e,config:t,bitrate:n}=this;if(!t.targetCacheControl)return-1;const{estPlayTime:r}=t;let i=r;t.estPTcontrol&&(i=Math.min(r,this.duration-((null==e?void 0:e.currentTime)||0)));const o=1024*(null==e?void 0:e.avgSpeed)||0;let s=Math.max(t.safeFactor*o,t.minBandwidth);e&&e.avgSpeed&&(s=t.safeFactor*o);let a=n>0?Math.floor((1-s/n)*i):0;a=t.minDangerThreshold+Math.max(a,0);const l=Math.max(t.cacheSafeFactor*a,t.minTargetCacheDur);return Math.min(l,t.maxTargetCacheDur)}}var a=(e=>(e.CHANGE_FLYING_PLUGIN_CONFIG="CHANGE_FLYING_PLUGIN_CONFIG",e))(a||{});function l(e,t,n){return t=c(t),function(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,h()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];for(var n in y)if(Object.prototype.hasOwnProperty.call(y,n)){var r=y[n];if(t){if(e(r))break}else e(r)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(n){var r=e(n);return r&&(t=n),r}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(n){e(n)&&t.push(n)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(y[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):y[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(y),t=0;t1&&void 0!==arguments[1])||arguments[1];if(y[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):y[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return _||(_=new t),_}}])}(m.EventEmitter);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S(e){for(var t=1;t=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function P(e){return(P="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 M(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,i)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){M(o,r,i,s,a,"next",e)}function a(e){M(o,r,i,s,a,"throw",e)}s(void 0)}))}}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x(e,t){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch{return!1}}function A(e,t,n){return A=O()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&L(i,n.prototype),i},A.apply(null,arguments)}function G(e){var t="function"==typeof Map?new Map:void 0;return G=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return A(e,arguments,C(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),L(n,e)},G(e)}function $(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){var t=O();return function(){var n,r=C(e);if(t){var i=C(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 $(e)}(this,n)}}function N(){return N=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=C(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},N.apply(this,arguments)}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),i=1;i=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var s=this.logTextArray.shift();this.logSize-=s.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function z(){return(new Date).toLocaleString()}function X(e){if("object"!==P(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function K(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==P(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!V.includes(i))return i;if(!(n>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n===t?r[o]=X(e[o]):"object"===P(e[o])?r[o]=K(e[o],t,n+1):r[o]=e[o]);return r}}function Q(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.used=!1,n.resolve=function(){return n.used=!0,e.apply(void 0,arguments)},n.reject=function(){return n.used=!0,t.apply(void 0,arguments)},n}D(j,"disabled",!0);var W="fetch",q="arraybuffer",Y="text",J="json",Z=function(e){I(n,e);var t=B(n);function n(e,r,i,o){var s;return w(this,n),D($(s=t.call(this,o)),"retryCount",0),D($(s),"isTimeout",!1),D($(s),"loaderType",W),D($(s),"startTime",0),D($(s),"endTime",0),D($(s),"options",{}),s.url=e,s.request=r,s.response=i,s}return E(n)}(G(Error)),ee=Object.prototype.toString;function te(e){if("[object Object]"!==ee.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function ne(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ie(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){return function(e){return"[object Date]"===ee.call(e)}(t)?t=t.toISOString():function(e){return null!==e&&"object"===P(e)}(t)&&(t=JSON.stringify(t)),"".concat(re(e),"=").concat(re(t))})).join("&")})).filter(Boolean).join("&");if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function oe(e,t,n,r,i,o,s,a,l,u,c){return i=null!=i?parseFloat(i):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0),{data:e,done:t,options:{range:l,vid:u,index:a,contentLength:r,age:i,startTime:o,firstByteTime:s,endTime:Date.now(),priOptions:c},response:n}}function se(e,t){return Math.round(8*e*1e3/t/1024)}var ae="real_time_speed",le=2097152,ue=function(e){I(r,e);var t,n=B(r);function r(){var e;return w(this,r),D($(e=n.call(this)),"_abortController",null),D($(e),"_timeoutTimer",null),D($(e),"_reader",null),D($(e),"_response",null),D($(e),"_aborted",!1),D($(e),"_index",-1),D($(e),"_range",null),D($(e),"_receivedLength",0),D($(e),"_running",!1),D($(e),"_logger",null),D($(e),"_vid",""),D($(e),"_onProcessMinLen",0),D($(e),"_onCancel",null),D($(e),"_priOptions",null),e}return E(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,o=e.timeout,s=e.responseType,a=e.onProgress,l=e.index,u=e.onTimeout,c=e.onCancel,h=e.range,d=e.transformResponse,f=e.request,p=e.params,g=e.logger,m=e.method,v=e.headers,y=e.body,_=e.mode,T=e.credentials,b=e.cache,S=e.redirect,P=e.referrer,M=e.referrerPolicy,w=e.onProcessMinLen,x=e.priOptions;this._logger=g,this._aborted=!1,this._onProcessMinLen=w,this._onCancel=c,this._abortController=typeof AbortController<"u"&&new AbortController,this._running=!0,this._index=l,this._range=h||[0,0],this._vid=i||r,this._priOptions=x||{};var E={method:m,headers:v,body:y,mode:_,credentials:T,cache:b,redirect:S,referrer:P,referrerPolicy:M,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},D=!1;clearTimeout(this._timeoutTimer),r=ie(r,p);var I=ne(h);I&&(v=f?f.headers:E.headers=E.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",I):v.Range=I),o&&(this._timeoutTimer=setTimeout((function(){if(D=!0,n.cancel(),u){var e=new Z(r,E,null,"timeout");e.isTimeout=!0,u(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),o));var C=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",h),new Promise((function(e,t){fetch(f||r,f?void 0:E).then(function(){var i=R(k().mark((function i(o){var u,c,f,p;return k().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=o,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(d&&(o=d(o,r)||o),o.ok){i.next=7;break}throw new Z(r,E,o,"bad network response");case 7:if(u=Date.now(),s!==Y){i.next=15;break}return i.next=11,o.text();case 11:c=i.sent,n._running=!1,i.next=37;break;case 15:if(s!==J){i.next=22;break}return i.next=18,o.json();case 18:c=i.sent,n._running=!1,i.next=37;break;case 22:if(!a){i.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(o,a,C,u),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:c=i.sent,c=new Uint8Array(c),n._running=!1,f=Date.now()-C,p=se(c.byteLength,f),n.emit(ae,{speed:p,len:c.byteLength,time:f,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",l,",range,",h),e(oe(c,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),C,u,l,h,n._vid,n._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(n._timeoutTimer),n._running=!1,(!n._aborted||D)&&((e=e instanceof Z?e:new Z(r,E,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=C,e.endTime=Date.now(),e.isTimeout=D,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=R(k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch{}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,r){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new Z(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(le),this._writeIdx=0);var s,a,l,u=this._reader=e.body.getReader(),c=function(){var o=R(k().mark((function o(){var h,d,f,p,g,m,v,y;return k().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a=Date.now(),o.prev=1,o.next=4,u.read();case 4:s=o.sent,l=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),l=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(d=(null===(h=i._range)||void 0===h?void 0:h.length)>0?i._range[0]:0,f=d+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[f,f],vid:i._vid,index:i._index,startTime:a,endTime:l,st:n,firstByteTime:r,priOptions:i._priOptions},e),o.abrupt("return");case 19:p=s.value?s.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",d+i._receivedLength,", done,",s.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||s.done?((g=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&g.set(s.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",s.done,",len,",g.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p0&&(m=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),m.set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(s.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=m,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):g=s.value,(g&&g.byteLength>0||s.done)&&t(g,s.done,{range:[i._range[0]+i._receivedLength-(g?g.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:a,endTime:l,st:n,firstByteTime:r,priOptions:i._priOptions},e),s.done?(v=Date.now()-n,y=se(i._receivedLength,v),i.emit(ae,{speed:y,len:i._receivedLength,time:v,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",s.done),i.resolve(oe(s,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,r,i._index,i._range,i._vid,i._priOptions))):c();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();c()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return typeof fetch<"u"}}]),r}(v),ce=function(e){I(n,e);var t=B(n);function n(){var e;return w(this,n),D($(e=t.call(this)),"_xhr",null),D($(e),"_aborted",!1),D($(e),"_timeoutTimer",null),D($(e),"_range",null),D($(e),"_receivedLength",0),D($(e),"_url",null),D($(e),"_onProgress",null),D($(e),"_index",-1),D($(e),"_headers",null),D($(e),"_currentChunkSizeKB",384),D($(e),"_timeout",null),D($(e),"_xhr",null),D($(e),"_withCredentials",null),D($(e),"_startTime",-1),D($(e),"_loadCompleteResolve",null),D($(e),"_loadCompleteReject",null),D($(e),"_runing",!1),D($(e),"_logger",!1),D($(e),"_vid",""),D($(e),"_responseType",void 0),D($(e),"_credentials",void 0),D($(e),"_method",void 0),D($(e),"_transformResponse",void 0),D($(e),"_firstRtt",void 0),D($(e),"_onCancel",null),D($(e),"_priOptions",null),e}return E(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=ie(e.url,e.params);var n=Date.now();return new Promise((function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Z?e:new Z(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===q&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,r=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){var n,r,i;t._running=!1;var o=new Z(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new Z(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var r=this._headers||{},i=ne(e);i&&(r.Range=i),r&&Object.keys(r).forEach((function(e){n.setRequestHeader(e,r[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,n=e.target.status;if(n<200||n>299){var r=new Z(this._url,null,S(S({},e.target.response),{},{status:n}),"bad response,status:"+n);return r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)}var i,o=null,s=!1,a=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===q){var l,u=new Uint8Array(e.target.response);if(i=a+this._receivedLength,u&&u.byteLength>0){this._receivedLength+=u.byteLength;var c=Date.now()-this._startTime,h=se(this._receivedLength,c);this.emit(ae,{speed:h,len:this._receivedLength,time:c,vid:this._vid,index:this._index,range:[i,a+this._receivedLength],priOptions:this._priOptions})}o=u,s=!((null===(l=this._range)||void 0===l?void 0:l.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",i,"end ",a+this._receivedLength,",dataLen,",u?u.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",s)}else s=!0,o=e.target.response;var d={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(d=this._transformResponse(d,this._url)||d),this._onProgress&&this._onProgress(o,s,{index:this._index,vid:this._vid,range:[i,a+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},d),s?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(oe(this._onProgress?null:o,s,d,d.headers["content-length"],d.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted&&(this._aborted=!0,this._runing=!1,N(C(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr))return this._xhr.abort()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},r=function(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{!s&&null!=n.return&&n.return()}finally{if(a)throw o}}}}(e.getAllResponseHeaders().trim().split("\r\n"));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(": ");n[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){r.e(e)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return typeof XMLHttpRequest<"u"}}]),n}(v),he=["retry","retryDelay","onRetryError","transformError"],de=function(){function e(t,n){w(this,e),this.promise=Q(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new j("Loader")),this._loaderType=t,this._loader=t===W&&typeof fetch<"u"?new ue:new ce,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}return E(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,o=t.transformError,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0)&&(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,he),a=function(){var t=R(k().mark((function t(){var l,u,c;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(s);case 3:l=t.sent,e.promise.resolve(l),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,u=t.t0,o&&(u=o(u)||u),i&&e._retryCount>0&&i(u,e._retryCount,{index:s.index,vid:s.vid,range:s.range,priOptions:s.priOptions}),e._retryCount++,c=!0,e._retryCheckFunc&&(c=e._retryCheckFunc(t.t0)),!(c&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",s.range),e._retryTimer=setTimeout(a,r),t.abrupt("return");case 26:e.promise.reject(u);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return a(),this.promise}},{key:"cancel",value:(t=R(k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e;var t}();function fe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var pe=function(e){I(r,e);var t,n=B(r);function r(e){var t;return w(this,r),D($(t=n.call(this,e)),"type",W),D($(t),"_queue",[]),D($(t),"_alive",[]),D($(t),"_currentTask",null),D($(t),"_finnalUrl",""),D($(t),"_config",void 0),t._config=function(e){return S({loaderType:W,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:Y,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),("xhr"===t._config.loaderType||!ue.isSupported())&&(t.type="xhr"),t.log=e.logger,t}return E(r,[{key:"isFetch",value:function(){return this.type===W}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&te(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&te(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new de(this.type,n);return r.loader.on(ae,(function(e){t.emit(ae,e)})),this._queue.push(r),1===this._queue.length&&(!this._currentTask||!this._currentTask.running)&&this._processTask(),r.promise}},{key:"cancel",value:(t=R(k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,fe();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return ue.isSupported()}}]),r}(v);class ge{static getDefaultConfig(){return{PCDNBufferControl:!1,PCDNCntControl:!1,estPTcontrol:!1,minPCDNInBuffer:8,maxPCDNInBuffer:12,minPCDNOutBuffer:3,maxPCDNOutBuffer:6,safePCDNInFactor:.1,safePCDNOutFactor:.4,alpha:.5,estPlayTime:12,minBandwidth:1e6}}constructor(e,t,n,r){this.config=ge.getDefaultConfig(),Object.keys(r).map((e=>{void 0!==r[e]&&null!==r[e]&&(this.config[e]=r[e])})),this.duration=n,this.player=e,this.updateBitrate(t),this.curPCDNInBuffer=this.config.maxPCDNInBuffer,this.curPCDNOutBuffer=this.config.maxPCDNOutBuffer,this.PCDNChangeCnt=0}updateBitrate(e){this.bitrate=e,this.bitrate||(this.bitrate=this.config.minBandwidth)}getPCDNInBuffer(){const{config:e,player:t,bitrate:n}=this;if(!e.PCDNBufferControl)return null;const{estPlayTime:r}=e;let i=r;e.estPTcontrol&&(i=Math.min(r,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));const{safePCDNInFactor:o,minBandwidth:s,maxPCDNInBuffer:a,minPCDNInBuffer:l}=e,u=o*Math.max(1024*(null==t?void 0:t.avgSpeedPCDN)||0,s),c=n>0?(1-u/n)*i:0;return this.curPCDNInBuffer=Math.min(a,Math.max(l,c)),this.curPCDNInBuffer}getPCDNOutBuffer(){const{config:e,player:t,bitrate:n}=this;if(!e.PCDNBufferControl)return null;const{estPlayTime:r}=e;let i=r;e.estPTcontrol&&(i=Math.min(r,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));const{safePCDNOutFactor:o,minBandwidth:s,maxPCDNOutBuffer:a,minPCDNOutBuffer:l}=e,u=o*Math.max(1024*(null==t?void 0:t.avgSpeedPCDN)||0,s),c=n>0?(1-u/n)*i:0;return this.curPCDNOutBuffer=Math.min(a,Math.max(l,c)),this.curPCDNOutBuffer}getPCDNChangeCnt(){const{PCDNCntControl:e,alpha:t}=this.config,{curPCDNInBuffer:n,player:r}=this,i=(null==r?void 0:r.bufferedPoint)||null,o=i&&i.end?i.end-r.currentTime:0;return e?o>n+(this.PCDNChangeCnt-1)*t&&this.PCDNChangeCnt++:o>=n&&this.PCDNChangeCnt<2&&this.PCDNChangeCnt++,this.PCDNChangeCnt}}const me=new Map,ve=class e{static get pluginName(){return"PCDN"}static get pcdnReqCnt(){const{pcdn_tracker_request_cnt:t,pcdn_tracker_success_cnt:n}=e;return e.pcdn_tracker_request_cnt=0,e.pcdn_tracker_success_cnt=0,{pcdn_tracker_request_cnt:t,pcdn_tracker_failed_cnt:t-n}}static getDefaultConfig(){return{trackerUrl:"",loaderType:W,responseType:J,mode:"cors",method:"POST",retry:0,retryDelay:3e3,timeout:5e3,node_num:5,client_info:null,maxCnt:30,withReferer:0,NULLNodeTimeStep:6e4,ErrorTimeStep:15e3}}constructor(t,n,r,i){var o,s;this.options=e.getDefaultConfig(),Object.keys(t).map((e=>{void 0!==t[e]&&null!==t[e]&&(this.options[e]=t[e])})),(!this.options.productConfig||!this.options.productConfig.app_id)&&console.error("productConfig must has"),this.loader=new pe(this.options),this.resetTrackeArgs(),this._lastFileInfo=null,this.lastfetchNodeTime=-1,this._lastRetFileKey=null,this._minUpdateNodeStep=this.options.ErrorTimeStep,null!=(s=null==(o=this.options)?void 0:o.adaptPCDNConfig)&&s.PCDNBufferControl&&(this.pcdnAdapt=new ge(n,r,i,this.options.adaptPCDNConfig))}get isOpenAdaptPCDN(){return!!this.pcdnAdapt}get curPCDNInBuffer(){return this.pcdnAdapt.curPCDNInBuffer}getPCDNInBuffer(){var e;return null==(e=this.pcdnAdapt)?void 0:e.getPCDNInBuffer()}get curPCDNOutBuffer(){return this.pcdnAdapt.curPCDNOutBuffer}getPCDNOutBuffer(){var e;return null==(e=this.pcdnAdapt)?void 0:e.getPCDNOutBuffer()}get curPCDNChangeCnt(){return this.pcdnAdapt.PCDNChangeCnt}getPCDNChangeCnt(){var e;return null==(e=this.pcdnAdapt)?void 0:e.getPCDNChangeCnt()}resetTrackeArgs(e){this.trackeArgs={fid:null,trace_id:null,req_times:(null==e?void 0:e.req_times)||0,resp_times:(null==e?void 0:e.resp_times)||0,token:null,node_num:this.options.node_num,client_info:this.options.client_info}}static async gainPCDNNode(t,n,r,i){var o,s,a;const l=e.getDefaultConfig();Object.keys(n).map((e=>{void 0!==n[e]&&null!==n[e]&&(l[e]=n[e])})),(!i||!i.app_id)&&console.error("productConfig must has");const u=new Q;r?(r.byterate=_e(r.bitrate),delete r.bitrate):u.reject("video fileInfo need set");const c=Object.assign(i,{file_info:r},{node_num:(null==n?void 0:n.node_num)||3}),h=JSON.stringify(c),d=new pe(l);try{e.pcdn_tracker_request_cnt++;const n=await d.load(t,{body:h});n.done&&(null==(a=null==(s=null==(o=n.data)?void 0:o.Result)?void 0:s.nodes)?void 0:a.length)>0&&e.pcdn_tracker_success_cnt++,u.resolve(n)}catch(e){u.reject((null==e?void 0:e.message)||"get pcdnNode error")}return u}getPCDNNode(e,t,n){var r;const i=_e(t),o=me.get(ye(e,i)),s=new Q;return null==o||!o.nodes||(null==(r=null==o?void 0:o.nodes)?void 0:r.length)<1?this.fetchPCDNNode(null,null,n).then((e=>{s.resolve(e)})).catch((e=>{s.reject(e)})):(o.fromCache=!0,s.resolve(o)),s}removePCDNNode(e,t,n){const r=_e(t),i=me.get(ye(e,r)),o=null==i?void 0:i.nodes;o&&(n?i.nodes=o.filter((e=>e&&n.indexOf(e.url)<0)):o.shift(),me.set(ye(e,r),i)),(!o||!o.length)&&this.fetchPCDNNode().then().catch((()=>{}))}async fetchPCDNNode(t,n,r){var i,o;const s=new Q;if(n){n.byterate=_e(n.bitrate);const e=me.get(ye(n.vid,n.byterate));if((null==(i=null==e?void 0:e.nodes)?void 0:i.length)>0)return e.fromCache=!0,s.resolve(e),s;delete n.bitrate,this._lastFileInfo=n}else n=this._lastFileInfo;if(!n)return s.resolve(null),s;let a=!1;const l=ye(n.vid,n.byterate);if(this._lastRetFileKey!==l&&(this.resetTrackeArgs(),a=!0),Date.now()-this.lastfetchNodeTime=this.options.maxCnt)return s.resolve(null),s;this.loader||(this.loader=new pe(this.options)),this.trackeArgs.req_times+=1;try{e.pcdn_tracker_request_cnt++;const r=await this.loader.load(t||this.options.trackerUrl,{body:c});let i=null;if(r){this.trackeArgs.resp_times+=1;const t=8*n.byterate;if(r.done&&null!=(o=r.data)&&o.Result){const o=r.data.Result;i=o.nodes,i&&i.length>0?e.pcdn_tracker_success_cnt++:this._minUpdateNodeStep=this.options.NULLNodeTimeStep,i.map((e=>{e.vid=n.vid,e.bitrate=t}));const{fid:a,trace_id:l,req_id:u}=o,c={nodes:i,fid:a,vid:n.vid,trace_id:l,req_id:u,bitrate:t},h=ye(n.vid,n.byterate);me.set(h,c),this.trackeArgs.fid=o.fid,this.trackeArgs.trace_id=o.trace_id,this.trackeArgs.token=o.token,s.resolve(c)}else this._minUpdateNodeStep=this.options.ErrorTimeStep,s.reject(r)}}catch(e){this._minUpdateNodeStep=this.options.ErrorTimeStep,console.warn("tracker catch ERR,",e),s.reject(e)}return s}};function ye(e,t){return`${e}-${t}`}function _e(e){return Math.floor(e/8)}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(l&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Ae(e,t){return(Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ge(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function $e(e){return($e="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 Be(e){var t="function"==typeof Map?new Map:void 0;return Be=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;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 function(e,t,n){if(Ie())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&Ae(i,n.prototype),i}(e,arguments,Ee(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ae(n,e)},Be(e)}i(ve,"pcdn_tracker_request_cnt",0),i(ve,"pcdn_tracker_success_cnt",0);var Ne={DEBUG:1,LOG:2,WARN:3,ERROR:4},Fe=["Boolean","Number","String","Undefined","Null","Date","Object"],Ue=function(){function e(t,n){Pe(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==n?void 0:n.logCacheLevel)||3,this.logMaxSize=(null==n?void 0:n.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return Re(e,[{key:"debug",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i1?n-1:0),i=1;i=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var s=this.logTextArray.shift();this.logSize-=s.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}])}();function He(){return(new Date).toLocaleString()}function Ve(e){if("object"!==$e(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function je(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==$e(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!Fe.includes(i))return i;if(!(n>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n===t?r[o]=Ve(e[o]):"object"===$e(e[o])?r[o]=je(e[o],t,n+1):r[o]=e[o]);return r}}we(Ue,"disabled",!0);var ze,Xe=function(){function e(){Pe(this,e)}return Re(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],r=0,i=e.length;ra&&(s[1]=l)}else n.push([e.start(r),e.end(r)])}else n.push([e.start(r),e.end(r)])}return n}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,s=0,a=0,l=0,u=0,c=0,h=e.buffers(t,r),d=0,f=h.length;d=p[0]&&n<=p[1])i=p[0],o=p[1],s=d;else{if(n+rp[1]&&(u=p[0],c=p[1])}}return{start:i,end:o,index:s,buffers:h,nextStart:a,nextEnd:l,prevStart:u,prevEnd:c,currentTime:n,behind:n-i,remaining:o?o-n:0,length:e.totalLength&&e.totalLength(h)}}},{key:"isBuffered",value:function(t,n){if(t){var r=e.get(t);if(null!=r&&r.length)for(var i=0;i=r.start(i)&&n<=r.end(i))return!0}return!1}}])}(),Ke="undefined"!=typeof window,Qe={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",MSE_CHANGE_TYPE:"MSE_CHANGE_TYPE",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},We=(we(we(we(we(we(we(we(we(we(we(ze={},Qe.MANIFEST,{HLS:1100,DASH:1200}),Qe.NETWORK,2100),Qe.NETWORK_TIMEOUT,2101),Qe.NETWORK_FORBIDDEN,2103),Qe.NETWORK_NOTFOUND,2104),Qe.NETWROK_RANGE_NOT_SATISFIABLE,2116),Qe.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),Qe.REMUX,{FMP4:4100,MP4:4200}),Qe.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,MSE_CHANGE_TYPE:5205,EME_HIJACK:5301}),Qe.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),we(we(ze,Qe.OTHER,8e3),Qe.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003})),qe=function(e){function t(e,n,r,i,o){var s;return Pe(this,t),(s=ke(this,t,[o||(null==r?void 0:r.message)])).errorType=e===Qe.NETWORK_TIMEOUT?Qe.NETWORK:e,s.originError=r,s.ext=i,s.errorCode=We[e][n]||We[e],s.errorMessage=s.message,s.errorCode||(s.errorType=Qe.OTHER,s.errorCode=We[s.errorType]),s}return De(t,e),Re(t,null,[{key:"create",value:function(e,n,r,i,o){return e instanceof t?e:(e instanceof Error&&(r=e,e=""),e||(e=Qe.OTHER),new t(e,n,r,i,o))}},{key:"network",value:function(e){var n;return new t(null!=e&&e.isTimeout?Qe.NETWORK_TIMEOUT:Qe.NETWORK,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(n=e.response)||void 0===n?void 0:n.status})}}])}(Be(Error));function Ye(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.used=!1,n.resolve=function(){return n.used=!0,e.apply(void 0,arguments)},n.reject=function(){return n.used=!0,t.apply(void 0,arguments)},n}function Je(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}function Ze(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];try{return Ke?e&&"undefined"!=typeof ManagedMediaSource?ManagedMediaSource:window.MediaSource:null}catch(e){}}function et(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var tt="updateDuration",nt=function(){function e(t,n){var r=this;Pe(this,e),we(this,"media",null),we(this,"mediaSource",null),we(this,"_openPromise",Ye()),we(this,"_queue",Object.create(null)),we(this,"_sourceBuffer",Object.create(null)),we(this,"_mseFullFlag",{}),we(this,"_st",0),we(this,"_opst",0),we(this,"_logger",null),we(this,"_config",null),we(this,"_url",null),we(this,"_onStartStreaming",(function(){r._logger.debug("startstreaming")})),we(this,"_onEndStreaming",(function(){r._logger.debug("endstreaming")})),we(this,"_onSBUpdateEnd",(function(e){var t=r._queue[e];if(t){var n=t[0];if((null==n?void 0:n.opName)!==tt&&t.shift(),n){var i,o,s=Je()-r._opst;r._logger.debug("UpdateEnd(".concat(e,"/").concat(n.opName,")"),function(e){try{return JSON.stringify(e)}catch(e){return""}}(function(e){var t=[];if(e instanceof TimeRanges)for(var n=0;n0))})),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!et(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,n=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var r=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{r=Math.max(t.bufferEnd(e)||0,r)}catch(e){}})),e=1,r="open"===t.readyState,n&&r)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(e){}})),et(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=Ye(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var n;try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new qe(Qe.MEDIA,Qe.SUB_TYPES.MSE_ADD_SB,e)}n.mimeType=t,n.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),n.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var n=this,r=this._sourceBuffer[e];return this.mediaSource&&r&&r.mimeType!==t?"function"!=typeof r.changeType?Promise.reject(new qe(Qe.MEDIA,Qe.SUB_TYPES.MSE_CHANGE_TYPE,new Error("changeType is not a function"))):this._enqueueOp(e,(function(){try{r.changeType(t)}catch(e){throw new qe(Qe.MEDIA,Qe.SUB_TYPES.MSE_CHANGE_TYPE,e)}r.mimeType=t,n._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,n){var r=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;r.mediaSource&&!r.media.error&&(r._logger.debug("MSE APPEND START",n),r._opst=Je(),null===(i=r._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),"appendBuffer",n):Promise.resolve()}},{key:"remove",value:function(e,t,n,r){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var o=i._sourceBuffer[e];t>=n||!o?i._onSBUpdateEnd(e):(i._opst=Je(),i._logger.debug("MSE REMOVE START",e,t,n,r),o.remove(t,n))}}),"removeBuffer",r,o)}},{key:"clearBuffer",value:function(e,t){var n,r=this;return Object.keys(this._sourceBuffer).forEach((function(i){n=r.remove(i,e,t)})),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(n){var r=t._sourceBuffer[n];e=t.remove(n,0,Xe.end(Xe.get(r)))})),e}},{key:"clearOpQueues",value:function(e,t){var n;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(t&&r)this._queue[e]=[];else if(r&&r[e]&&!(r.length<5)){var i=[];r.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=r.slice(0,2),i.length>0&&(n=this._queue[e]).push.apply(n,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var n=t.mediaSource;n&&"open"===n.readyState&&(t._logger.debug("MSE endOfStream START"),e?n.endOfStream(e):n.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var n=this.mediaSource;e<0||t=0?(this._mseFullFlag[e]=!0,n.context&&"object"===$e(n.context)&&(n.context.isFull=!0),this._logger.error("[MSE error], context,",n.context," ,name,",n.opName,",err,SourceBuffer is full"),n.promise.reject(new qe(Qe.MEDIA,Qe.SUB_TYPES.MSE_FULL,r))):(this._logger.error(r),n.promise.reject(r.constructor===qe?r:new qe(Qe.MEDIA,Qe.SUB_TYPES.MSE_OTHER,r)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,n){var r=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),r._sourceBuffer[e].timestampOffset=t,r._onSBUpdateEnd(e)}),"setTimeoffset",n)}},{key:"abort",value:function(e,t){var n=this;return this.isOpened?this._enqueueOp(e,(function(){n._sourceBuffer[e].abort(),n._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=Ze();if(!t)return!1;try{return t.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]);var t,n,r}();we(nt,"VIDEO","video"),we(nt,"AUDIO","audio");var rt=n(42990),it=n.n(rt);const ot=function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}&&!function(){const e="_localstorage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}();ot&&localStorage.length;class st{constructor(){let e,t;const n=new Promise(((n,r)=>{e=n,t=r}));return n.resolve=e,n.reject=t,n}resolve(e){}reject(e){}}const at="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHQ9e30se2hhc093blByb3BlcnR5OmN9PU9iamVjdC5wcm90b3R5cGU7cG9zdE1lc3NhZ2Uoe2V2ZW50OiJyZWFkeSJ9KTtmdW5jdGlvbiBvKHMsYSl7dFtzXT1zZXRUaW1lb3V0KCgpPT57cG9zdE1lc3NhZ2Uoe2RhdGE6e2Zha2VJZDpzfX0pLG8ocyxhKX0sYSl9YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24ocyl7dHJ5e2NvbnN0e2RhdGE6YT17fX09cyx7YWN0aW9uOm4sZmFrZUlkOmUsdGltZTpyfT1hO3N3aXRjaChuKXtjYXNlInNldEludGVydmFsIjpvKGUscik7YnJlYWs7Y2FzZSJjbGVhckludGVydmFsIjpjLmNhbGwodCxlKSYmKGNsZWFyVGltZW91dCh0W2VdKSxkZWxldGUgdFtlXSk7YnJlYWs7Y2FzZSJzZXRUaW1lb3V0Ijp0W2VdPXNldFRpbWVvdXQoZnVuY3Rpb24oKXtwb3N0TWVzc2FnZSh7ZGF0YTp7ZmFrZUlkOmV9fSksYy5jYWxsKHQsZSkmJmRlbGV0ZSB0W2VdfSxyKTticmVhaztjYXNlImNsZWFyVGltZW91dCI6Yy5jYWxsKHQsZSkmJihjbGVhclRpbWVvdXQodFtlXSksZGVsZXRlIHRbZV0pO2JyZWFrO2RlZmF1bHQ6YnJlYWt9fWNhdGNoKGEpe3Bvc3RNZXNzYWdlKHtldmVudDoiZXJyb3IiLGRhdGE6e2Vycm9yOmF9fSl9fSl9KSgpOwo=",lt=typeof self<"u"&&self.Blob&&new Blob([(ut=at,Uint8Array.from(atob(ut),(e=>e.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});var ut;function ct(e){let t;try{if(t=lt&&(self.URL||self.webkitURL).createObjectURL(lt),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),n}catch{return new Worker("data:text/javascript;base64,"+at,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}let ht,dt,ft,pt,gt,mt={},vt=0;function yt(){do{2147483647===vt?vt=0:vt++}while(vt in mt);return vt}if(typeof Worker<"u"){let e,t=!1,n=!1;const r=()=>{if(!e){const{promise:r,resolve:i,reject:o}=Promise.withResolvers();e=r;try{ht=new ct,ht.addEventListener("message",(e=>{const{event:r,data:s}=e.data;switch(r){case"error":n=!0,o(s.error);break;case"ready":t=!0,i();break;default:{const{fakeId:e}=s;if(e in mt){const{cb:t,param:n,keepAlive:r,type:i}=mt[e]||{};if("setInterval"!==i&&delete mt[e],!r&&document.hidden)return;if("function"==typeof t)try{t.apply(window,n)}catch(e){console.error("Error when parse callback function, code %s",e)}}}}})),ht.addEventListener("error",(function(e){console.error(e),n=!0,o(e)}))}catch(e){n=!0,o(e)}}return e},i=(e,i)=>{n?i&&i():t?e():r().then(e,i)};dt=function(e,t,n=!1,...r){if("function"!=typeof e)throw new Error("cb must be a function");const o=yt();return mt[o]={cb:e,param:r,keepAlive:!!n,type:"setInterval"},i((()=>{ht.postMessage({action:"setInterval",fakeId:o,time:t})}),(()=>{o in mt&&(mt[o].degradeId=setInterval(e,t))})),o},pt=function(e){if("number"==typeof e&&e in mt){const{degradeId:t}=mt[e];delete mt[e],i((()=>{ht.postMessage({action:"clearInterval",fakeId:e})}),(()=>{t&&clearInterval(t)}))}},ft=function(e,t,n=!0,...r){if("function"!=typeof e)throw new Error("cb must be a function");const o=yt();return mt[o]={cb:e,param:r,keepAlive:!!n,type:"setTimeout"},i((()=>{ht.postMessage({action:"setTimeout",fakeId:o,time:t})}),(()=>{o in mt&&(mt[o].degradeId=setTimeout(e,t))})),o},gt=function(e){if("number"==typeof e&&e in mt){const{degradeId:t}=mt[e];delete mt[e],i((()=>{ht.postMessage({action:"clearTimeout",fakeId:e})}),(()=>{t&&clearTimeout(t)}))}}}else dt=setInterval,ft=setTimeout,pt=clearInterval,gt=clearTimeout,console.error("the browser not support web worker, fallback to unWarp function!");Promise.withResolvers||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e});const _t="PRELOAD_NEXT",Tt="PRELOAD_SEG_DONE",bt={PREPARE:"PREPARE",IDLE:"IDLE",PRELOADING:"PRELOADING",FINISH:"FINISH"},St="ONE_STEP_DONE",kt={INDEXDB:0,MEMORY:1},Pt={FAIL:-1,SUCCESS:0,DOWNLOADING:1},Mt={MP4:"MP4",DASH:"DASH",HLS:"HLS"},Rt=Object.freeze(Object.defineProperty({__proto__:null,CACHE_TYPES:kt,DOWN_STATES:Pt,MEDIA_FORMAT:{DASH:0,MP4:1},MEDIA_TYPES:{VIDEO:0,AUDIO:1,MIXED:2},ONE_STEP_DONE:St,PRELOAD_NEXT:_t,PRELOAD_SEG_DONE:Tt,PRELOAD_TYPES:{DURATION:0,SIZE:1},STATES:bt,VTYPES:Mt},Symbol.toStringTag,{value:"Module"}));class wt extends rt{constructor(e,t,n,r,i){super(),this.state=bt.PREPARE,this.options=e||{},this.logger=e.logger||function(){},this._preloadManager=t,this.player=t.player;const{handlers:o,predictInst:s,readyPromise:a}=n;this._predictInst=s,this._handlers=o,this._predictInstReadyPromise=a,this._toLoadList=[],this.retryCount=0,this._cachedHandler=r,this._cachedDataHandler=i,this.cnt=0}start(){const e=new st;return this._handlers.start(this.options).then((t=>{t.onObtain().then((n=>{this._predictInstReadyPromise.then((()=>{this._predictInst.updateMediaInfos(n);const r=this._predictInst.preloadPredict(this.options),{cachedData:i}=this._predictInst;this._cachedDataHandler(Object.assign({vid:this.options.vid},{data:i}));const o=Object.assign(r,this.options);t.onTransform(o).then((t=>{this._toLoadList=t,e.resolve(t)}))}))}))})).catch((()=>{e.reject(new Error("preload unit start error"))})),e}preloadSeg(){if(0===this._toLoadList.length)return this.state=bt.FINISH,void this.emit(Tt,!0);this.state="PRELOADING";const e=this._toLoadList.shift();this._handlers.onRequest(e,(t=>{const n=Object.assign({},e.extData,t);this._cachedHandler(n)})).then((()=>{this.state=bt.IDLE,this.emit(Tt)})).catch((()=>{this.requestError(),this.emit(Tt,!1)}))}requestError(){this.retryCount++,this.state=bt.IDLE,this.retryCount>=10&&(this.state=bt.FINISH),this.emit(St),this.logger("preload request error")}cancelLoading(){this._toLoadList=[]}destroy(){this.removeAllListeners()}}const xt=function(){try{if(typeof indexedDB<"u")return indexedDB}catch{}}();function Et(e,t){t||(t=()=>{}),t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function Dt(e){return"string"!=typeof e&&(console.warn(`${e} used as a key, but it is not a string.`),e=String(e)),e}const It={},Ct="readonly",Lt="readwrite";function Ot(e){const t=It[e.name],n={};n.promise=new Promise((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function At(e,t){return new Promise((function(n,r){if(It[e.name]=It[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);Ot(e),e.db.close()}const i=[e.name];t&&i.push(e.version);const o=null==xt?void 0:xt.open.apply(xt,i);t&&(o.onupgradeneeded=function(t){const n=o.result;try{n.createObjectStore(e.storeName)}catch(t){const n=t;if("ConstraintError"!==n.name)throw t;{const{oldVersion:t,newVersion:r}=n;console.warn(`The database "${e.name}" has been upgraded from version ${t} to\n version ${r}, but the storage "${e.storeName}" already exists.`)}}}),o.onerror=function(e){e.preventDefault(),r(o.error)},o.onsuccess=function(){n(o.result),function(e){const t=It[e.name].deferredOperations.pop();t&&(t.resolve(),t.promise)}(e)}}))}function Gt(e){return At(e,!1)}function $t(e){return At(e,!0)}function Bt(e,t){if(!e.db)return!0;const n=!e.db.objectStoreNames.contains(e.storeName),r=e.versione.db.version;if(r&&(e.version!==t&&console.warn(`The database "${e.name}" can't be downgraded from version ${e.db.version} to\n version ${e.version}.`),e.version=e.db.version),i||n){if(n){const t=e.db.version+1;t>e.version&&(e.version=t)}return!0}return!1}function Nt(e,t,n,r){var i;void 0===r&&(r=1);try{const r=null==(i=e.db)?void 0:i.transaction(e.storeName,t);n(null,r)}catch(i){const o=i;if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return Promise.resolve().then((()=>{if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),$t(e)})).then((()=>function(e){Ot(e);const t=It[e.name],{forages:n}=t;for(let e=0;e(e.db=t,Bt(e)?$t(e):t))).then((r=>{e.db=t.db=r;for(let e=0;e{throw function(e,t){const n=It[e.name].deferredOperations.pop();n&&(n.reject(t),n.promise)}(e,t),t}))}(e).then((()=>{Nt(e,t,n,r-1)})))).catch(n);n(o)}}class Ft{ready(){return this._ready}_initStorage(e){const t=this;t._defaultConfig=e;const n={db:null,name:"",version:"",storeName:""};if(e)for(const t in e)n[t]=e[t];let r=It[n.name];r||(r={forages:[],db:null,dbReady:null,deferredOperations:[]},It[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t._ready=t._fullyReady);const i=[];function o(){return Promise.resolve()}for(let e=0;e{})),this._hasIdbForbidden=!1,this._maxCache=!e||e<=0?200:e,this.setMaxCache(this._maxCache),this._allCachedKeys={},this._allCachedTimeKeys={},this.getCachedKeysFromLocal(),this._readyPromise=new st,this.init()}getCachedKeysFromLocal(){const e=(e=>{try{return localStorage.getItem(e)}catch{return null}})(Vt);if(e){const t=e.split("|");for(let e=0;e{try{localStorage.setItem(e,t)}catch{}})(Vt,n)}init(){this._driver.setItem("test","test").then((()=>{})).catch((()=>{this._hasIdbForbidden=!0})).finally((()=>{this._driver.removeItem("test").catch((()=>{})),this._hasIdbForbidden&&(this._driver=new Ut,this._driver._initStorage(Ht)),this._getAll(),this._readyPromise.resolve()}))}_getAll(){this._driver.all().then((e=>{const t=e.length-this._maxCache;let n=e;if(t>0){const r=e.slice(0,t);n=e.slice(t);for(let e=0;e{}))}this.writeCachedKeysToLocal(n)})).catch((()=>{}))}getItem(e,t){if(!this.hasItem(e))return Promise.resolve(!1);const{timeKey:n}=this._getTimeKey(e);return this._driver.getItem(n,t)}setItem(e,t,n){const{timeKey:r}=this._getTimeKey(e);r&&this.removeItem(e);const i=(new Date).getTime();this._allCachedKeys[e]=1,this._allCachedTimeKeys[e]=i;const o=this._genTimeKey(e,i);return n=n?()=>{this._getAll(),n()}:()=>{this._getAll()},this._driver.setItem(o,t,n)}_getTimeKey(e){const t=this._allCachedTimeKeys[e];let n=e;return t&&(n=this._genTimeKey(e,t)),{timeKey:n,time:t}}_genTimeKey(e,t){return`${t}$${e}`}removeItem(e,t){const{timeKey:n}=this._getTimeKey(e),r=this._driver.removeItem(n,t);return delete this._allCachedKeys[e],delete this._allCachedTimeKeys[e],r}hasItem(e){return!!this._allCachedKeys[e]}clear(e){return this._driver.clear(e)}length(e){return this._driver.length(e)}setMaxCache(e){"number"==typeof e&&e>0&&(this._maxCache=e)}}const zt=class e extends rt{constructor(e,t,n=null){super(),this._preloadDataList=[],this._currentPreloadInst=null,this.autoPreload=e.autoPreload||!1,this._autoCheck=e.autoCheck||{enable:!1,interval:1e3},this._onPreloadNext=this.onPreloadNextReady.bind(this),this.on(_t,this._onPreloadNext),this._preloaderConfigs={},this.update(e,t,n),this._cacheInst=new jt(e.preloadMaxCacheCount,e.preloadCacheType||0),this._preloadCacheProgress={},this._ptag_=!0,this._cachedDatas={},this._taskIntervalId=null}setMaxCache(e){var t;null==(t=this._cacheInst)||t.setMaxCache(e)}startCheckTask(){const{_autoCheck:e,_preloadDataList:t}=this;this._taskIntervalId&&(window.clearTimeout(this._taskIntervalId),this._taskIntervalId=null),0!==t.length&&(this._checkIfCanPreload()&&this.onPreloadNext(),this._taskIntervalId=window.setTimeout((()=>{this.startCheckTask()}),e.interval||1e3))}stopCheckTask(){this._taskIntervalId&&(window.clearTimeout(this._taskIntervalId),this._taskIntervalId=null)}_checkIfCanPreload(){if(null==this._currentPreloadInst&&this._preloadDataList.length>0){const e=this._preloadDataList[0].data;if(e.payload){const t=this._getPreloaderKey(e),n=this._preloaderConfigs[t];if(null!=n&&n.handlers){const{checkIfCanPreload:t}=n.handlers;return t?t(e):(this.stopCheckTask(),!1)}return console.warn("need to set vtype, no preloader",e),this.stopCheckTask(),!1}}return!1}_getPreloaderKey(e){return e.vtype?e.vtype:"DEFAULT"}update(e,t,n){if(!n)throw new Error("PreloaderManager predictInst is null");const r=this._getPreloaderKey(e);this._preloaderConfigs[r]={predictInst:n,readyPromise:n.init(e),handlers:t}}get cachedDatas(){return this._cachedDatas}onCacheSegment(e){const{vid:t,format:n,cacheKey:r,total:i,loaded:o,isInitSegment:s,mediaType:a}=e,l=this.getProgressCacheKey(t,n,a);let u=this._preloadCacheProgress[l];u||(u=this._preloadCacheProgress[l]={}),u[r]={total:i,loaded:o,isInitSegment:s}}onCachePredict(e){const{vid:t,data:n}=e;t&&n&&(this._cachedDatas[t]=n)}getProgressCacheKey(e,t,n){return`${e}-${t}-${n}`}onPreloadNextReady(){this.onPreloadNext()}onPreloadSegDone(){this.autoPreload&&this.emit(_t)}onPreloadNext(){if(null==this._currentPreloadInst&&this._preloadDataList.length>0){if(this._preloadDataList.length>0){const e=this._preloadDataList.shift(),t=null==e?void 0:e.data;if(null!=t&&t.payload){const e=this._getPreloaderKey(t),n=this._preloaderConfigs[e];if(!n)return void console.warn("need to set vtype, no preloader",t);this._currentPreloadInst=new wt(t,this,n,(e=>{this.onCacheSegment(e)}),(e=>{this.onCachePredict(e)})),this._currentPreloadInst.on(Tt,this.onPreloadSegDone.bind(this)),this._currentPreloadInst.start().then((()=>{this._currentPreloadInst.preloadSeg()})).catch((()=>{this._currentPreloadInst=null}))}}}else null!=this._currentPreloadInst&&(this._currentPreloadInst.state===bt.IDLE?this._currentPreloadInst.preloadSeg():this._currentPreloadInst.state===bt.FINISH?(this._currentPreloadInst.destroy(),this._currentPreloadInst=null):this._currentPreloadInst.state===bt.PREPARE&&(this._currentPreloadInst.cnt++,this._currentPreloadInst.cnt>2&&(this._currentPreloadInst.destroy(),this._currentPreloadInst=null)))}addDashPreloader(e){e.data&&(this._preloadDataList.push(e),this.sort(this._preloadDataList),this.autoPreload&&this.emit(_t),this._autoCheck.enable&&!this._taskIntervalId&&this.startCheckTask())}_addDashPreloader(e){e.data&&this._preloadDataList.push(e)}addDashPreloaderList(e=[]){this.sort(e);for(let t=0;tvoid 0===e.order&&void 0===e.order||"number"==typeof e.order&&"number"==typeof t.order&&e.orderPromise.resolve(e()).then(t);return this.then((e=>t((()=>e))),(e=>t((()=>Promise.reject(e)))))}}.finally)}before(){throw new Error("need")}check(){if(!this.handlers)throw new Error("handlers null");if(!this.handlers.start||!this.handlers.onRequest)throw new Error("handlers callback null");if(!this.predictInst)throw new Error("predictInst null");if(!this.predictInst.__p__)throw new Error("predictInst need extends predictbase")}preloadNext(){this._preloadManager.emit(_t)}get preloadManager(){return this._preloadManager}start(){throw new Error("start need implment, return Promise")}cancelLoading(){for(let e=0;e{for(let t=this.loadingTasks.length-1;t>-1;t--)if(this.loadingTasks[t]===e){this.loadingTasks.splice(t,1);break}}))}addDashPreloader(e){this._preloadManager.addDashPreloader(e)}addDashPreloaderList(e=[]){this._preloadManager.addDashPreloaderList(e)}}class Qt{constructor(){this.bandwidth2item={},this._mediaInfos=void 0,this.__p__=!0}init(){throw new Error("init func not implement, return promise")}preloadPredict(e){throw new Error(`preloadPredict error: ${e}`)}updateMediaInfos(e){if(this._mediaInfos=e,this.bandwidth2item={},this.dynamic_video=e.dynamic_video_list,this.dynamic_video.length>0)for(let e=0;e{e.definition===t&&(n=r)})),n}get cachedData(){return null}}const Wt=Mt;var qt=n(23722);function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(l&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function dn(e,t){return(dn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function fn(e){return function(e){if(Array.isArray(e))return Yt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||gn(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 pn(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function gn(e,t){if(e){if("string"==typeof e)return Yt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yt(e,t):void 0}}var mn="fetch",vn="arraybuffer",yn="text",_n=function(e){function t(e,n,r,i){var o;return Pe(this,t),we(o=ke(this,t,[i]),"retryCount",0),we(o,"isTimeout",!1),we(o,"loaderType",mn),we(o,"startTime",0),we(o,"endTime",0),we(o,"options",{}),o.url=e,o.request=n,o.response=r,o}return De(t,e),Re(t)}(Be(Error)),Tn=Object.prototype.toString;function bn(e){if("[object Object]"!==Tn.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Sn(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function kn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Pn(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){var n;return n=t,"[object Date]"===Tn.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===$e(e)}(t)&&(t=JSON.stringify(t)),"".concat(kn(e),"=").concat(kn(t))})).join("&")})).filter(Boolean).join("&");if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function Mn(e,t,n,r,i,o,s,a,l,u,c){return i=null!=i?parseFloat(i):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0),{data:e,done:t,options:{range:l,vid:u,index:a,contentLength:r,age:i,startTime:o,firstByteTime:s,endTime:Date.now(),priOptions:c},response:n}}function Rn(e,t){return Math.round(8*e*1e3/t/1024)}var wn="real_time_speed",xn=2097152,En=function(e){function t(){var e;return Pe(this,t),we(e=ke(this,t),"_abortController",null),we(e,"_timeoutTimer",null),we(e,"_reader",null),we(e,"_response",null),we(e,"_aborted",!1),we(e,"_index",-1),we(e,"_range",null),we(e,"_receivedLength",0),we(e,"_running",!1),we(e,"_logger",null),we(e,"_vid",""),we(e,"_onProcessMinLen",0),we(e,"_onCancel",null),we(e,"_priOptions",null),we(e,"_processMaxGapTime",1/0),e}return De(t,e),Re(t,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,o=e.timeout,s=e.responseType,a=e.onProgress,l=e.index,u=e.onTimeout,c=e.onCancel,h=e.range,d=e.transformResponse,f=e.request,p=e.params,g=e.logger,m=e.method,v=e.headers,y=e.body,_=e.mode,T=e.credentials,b=e.cache,S=e.redirect,k=e.referrer,P=e.referrerPolicy,M=e.onProcessMinLen,R=e.processMaxGapTime,w=e.priOptions;this._logger=g,this._aborted=!1,this._onProcessMinLen=M,this._onCancel=c,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._receivedLength=0,this._index=l,this._range=h||[0,0],this._vid=i||r,this._priOptions=w||{},this._processMaxGapTime=R;var x={method:m,headers:v,body:y,mode:_,credentials:T,cache:b,redirect:S,referrer:k,referrerPolicy:P,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},E=!1;clearTimeout(this._timeoutTimer),r=Pn(r,p);var D=Sn(h);D&&(v=f?f.headers:x.headers=x.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",D):v.Range=D),o&&(this._timeoutTimer=setTimeout(Se(Oe().mark((function e(){var t;return Oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return E=!0,e.next=3,n.cancel();case 3:u&&((t=new _n(r,x,null,"timeout")).isTimeout=!0,u(t,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions}));case 4:case"end":return e.stop()}}),e)}))),o));var I=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",h),new Promise((function(e,t){fetch(f||r,f?void 0:x).then(function(){var i=Se(Oe().mark((function i(o){var u,c,f,p;return Oe().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=o,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(d&&(o=d(o,r)||o),o.ok){i.next=7;break}throw new _n(r,x,o,"bad network response");case 7:if(u=Date.now(),s!==yn){i.next=15;break}return i.next=11,o.text();case 11:c=i.sent,n._running=!1,i.next=37;break;case 15:if("json"!==s){i.next=22;break}return i.next=18,o.json();case 18:c=i.sent,n._running=!1,i.next=37;break;case 22:if(!a){i.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(o,a,I,u),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:c=i.sent,c=new Uint8Array(c),n._running=!1,f=Date.now()-I,p=Rn(c.byteLength,f),n.emit(wn,{speed:p,len:c.byteLength,time:f,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",l,",range,",h),e(Mn(c,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),I,u,l,h,n._vid,n._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!E||((e=e instanceof _n?e:new _n(r,x,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=I,e.endTime=Date.now(),e.isTimeout=E,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(n=Se(Oe().mark((function e(){return Oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return n.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,r){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new _n(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(xn),this._writeIdx=0);var s,a,l,u=this._reader=e.body.getReader(),c=Date.now(),h=function(){var o=Se(Oe().mark((function o(){var d,f,p,g,m,v,y,_,T;return Oe().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a=Date.now(),o.prev=1,o.next=4,u.read();case 4:s=o.sent,l=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),l=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(f=(null===(d=i._range)||void 0===d?void 0:d.length)>0?i._range[0]:0,p=f+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[p,p],vid:i._vid,index:i._index,startTime:a,endTime:l,st:n,firstByteTime:r,priOptions:i._priOptions},e),o.abrupt("return");case 19:if(g=s.value?s.value.byteLength:0,i._receivedLength+=g,i._onProcessMinLen>0?i._writeIdx+g>=i._onProcessMinLen||s.done?((m=new Uint8Array(i._writeIdx+g)).set(i._cache.subarray(0,i._writeIdx),0),g>0&&m.set(s.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",s.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):g>0&&i._writeIdx+g0&&(v=new Uint8Array(i._writeIdx+g+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+g+2048,", datalen,",g,", writeIdx,",i._writeIdx),v.set(i._cache.subarray(0,i._writeIdx),0),g>0&&v.set(s.value,i._writeIdx),i._writeIdx+=g,delete i._cache,i._cache=v,i._logger.debug("【fetchLoader,onProgress extra end】,len,",g,", writeIdx,",i._writeIdx)):m=s.value,!(m&&m.byteLength>0||s.done)){o.next=28;break}i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",p,", end,",f+i._receivedLength,", done,",s.done,n),t(m,s.done,{range:[i._range[0]+i._receivedLength-(m?m.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:a,endTime:l,st:n,firstByteTime:r,priOptions:i._priOptions},e),c=Date.now(),o.next=37;break;case 28:if(!(Date.now()-c>=i._processMaxGapTime)){o.next=37;break}return i._logger.debug("[onProgress timeout],task: ".concat(JSON.stringify(i._range)," done: ").concat(s.done," processMaxGapTime: ").concat(i._processMaxGapTime)),(y=new _n(e.url,null,e,"process timeout")).options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.running=!1,o.next=35,i.cancel();case 35:return i.reject(y),o.abrupt("return");case 37:s.done?(_=Date.now()-n,T=Rn(i._receivedLength,_),i.emit(wn,{speed:T,len:i._receivedLength,time:_,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",s.done),i.resolve(Mn(s,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,r,i._index,i._range,i._vid,i._priOptions))):h();case 38:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();h()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]);var n}(it()),Dn=function(e){function t(){var e;return Pe(this,t),we(e=ke(this,t),"_xhr",null),we(e,"_aborted",!1),we(e,"_timeoutTimer",null),we(e,"_range",null),we(e,"_receivedLength",0),we(e,"_url",null),we(e,"_onProgress",null),we(e,"_index",-1),we(e,"_headers",null),we(e,"_currentChunkSizeKB",384),we(e,"_timeout",null),we(e,"_xhr",null),we(e,"_withCredentials",null),we(e,"_startTime",-1),we(e,"_loadCompleteResolve",null),we(e,"_loadCompleteReject",null),we(e,"_runing",!1),we(e,"_logger",!1),we(e,"_vid",""),we(e,"_responseType",void 0),we(e,"_credentials",void 0),we(e,"_method",void 0),we(e,"_transformResponse",void 0),we(e,"_firstRtt",void 0),we(e,"_onCancel",null),we(e,"_priOptions",null),e}return De(t,e),Re(t,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=Pn(e.url,e.params);var n=Date.now();return new Promise((function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof _n?e:new _n(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===vn&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,r=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){var n,r,i;t._running=!1;var o=new _n(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new _n(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var r=this._headers||{},i=Sn(e);i&&(r.Range=i),r&&Object.keys(r).forEach((function(e){n.setRequestHeader(e,r[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,n=e.target.status;if(n<200||n>299){var r=new _n(this._url,null,Le(Le({},e.target.response),{},{status:n}),"bad response,status:"+n);return r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)}var i,o=null,s=!1,a=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===vn){var l,u=new Uint8Array(e.target.response);if(i=a+this._receivedLength,u&&u.byteLength>0){this._receivedLength+=u.byteLength;var c=Date.now()-this._startTime,h=Rn(this._receivedLength,c);this.emit(wn,{speed:h,len:this._receivedLength,time:c,vid:this._vid,index:this._index,range:[i,a+this._receivedLength],priOptions:this._priOptions})}o=u,s=!((null===(l=this._range)||void 0===l?void 0:l.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",i,"end ",a+this._receivedLength,",dataLen,",u?u.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",s)}else s=!0,o=e.target.response;var d={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(d=this._transformResponse(d,this._url)||d),this._onProgress&&this._onProgress(o,s,{index:this._index,vid:this._vid,range:[i,a+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},d),s?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Mn(this._onProgress?null:o,s,d,d.headers["content-length"],d.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,function(e,t,n){var r=xe(Ee(e.prototype),"removeAllListeners",n);return"function"==typeof r?function(e){return r.apply(n,e)}:r}(t,0,this)([]),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Te(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e.getAllResponseHeaders().trim().split("\r\n"));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(": ");n[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){r.e(e)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}])}(it()),In=["retry","retryDelay","onRetryError","transformError"],Cn=function(){return Re((function e(t,n){Pe(this,e),this.promise=Ye(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new Ue("Loader")),this._loaderType=t,this._loader=t===mn&&"undefined"!=typeof fetch?new En:new Dn,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}),[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,o=t.transformError,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r0&&i(u,e._retryCount,{index:s.index,vid:s.vid,range:s.range,priOptions:s.priOptions}),e._retryCount++,c=!0,e._retryCheckFunc&&(c=e._retryCheckFunc(t.t0)),!(c&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",s.range),e._retryTimer=setTimeout(a,r),t.abrupt("return");case 26:e.promise.reject(u);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return a(),this.promise}},{key:"cancel",value:(e=Se(Oe().mark((function e(){return Oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]);var e}(),Ln=10;function On(){for(var e=arguments.length,t=new Array(e),n=0;n0)break;n++}catch(e){if(!(n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var $n=function(e){function t(e){var n;return Pe(this,t),we(n=ke(this,t,[e]),"type",mn),we(n,"_queue",[]),we(n,"_alive",[]),we(n,"_currentTask",null),we(n,"_finnalUrl",""),we(n,"_config",void 0),n._config=function(e){return Le({loaderType:mn,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:yn,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,processMaxGapTime:1/0},e)}(e),"xhr"!==n._config.loaderType&&En.isSupported()||(n.type="xhr"),n.log=e.logger,n}return De(t,e),Re(t,[{key:"isFetch",value:function(){return this.type===mn}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&bn(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&bn(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new Cn(this.type,n);return r.loader.on(wn,(function(e){t.emit(wn,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(n=Se(Oe().mark((function e(){var t;return Oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,Gn();case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return En.isSupported()}}]);var n}(it());function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function Wn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function qn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(t)}function Yn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Wn(e,t)*Kn+Wn(e,t+4)}function Jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getUint32(t)<<32|n.getUint32(t+4)}function Zn(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r=r)){var o=i,s=[],a=(60&t[i+2])>>>2,l=e.FREQ[a];if(!l)throw new Error("Invalid sampling index: ".concat(a));for(var u,c,h=1+((192&t[i+2])>>>6),d=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(a,d,h),p=f.config,g=f.codec,m=0,v=e.getFrameDuration(l);i+7>5)||r-i=r?void 0:t.subarray(i),frames:s,samplingFrequencyIndex:a,sampleRate:l,objectType:h,channelCount:d,codec:g,config:p,originCodec:"mp4a.40.".concat(h)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var n=t[0]>>>3,r=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[r];if(o){var s=e._getConfig(r,i,n),a=s.config,l=s.codec;return t.length>=4&&695==(t[2]<<3|(224&t[3])>>5)&&(128&t[4])>>7&&(n=31&t[3]),{samplingFrequencyIndex:r,sampleRate:o,objectType:n,channelCount:i,config:a,codec:l,originCodec:"mp4a.40.".concat(n)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,n){var r,i,o=[];return rr?e>=6?(r=5,i=e-3):(r=2,i=e):ir?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),o[0]=r<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===r&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(r)}}},{key:"getSilentFrame",value:function(e,t,n){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if("mp4a.40.5"===e&&2===t&&22050===n)return new Uint8Array([33,17,69,0,20,80,1,70,173,200,65,117,0,0,0,28,96,24,13,230,66,20,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,188]);if("mp40.40.5"===e&&2===t&&24e3===n)return new Uint8Array([33,17,69,0,20,80,1,70,173,200,65,117,0,0,0,28,96,24,13,229,98,20,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,188]);if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}])}();Hn(or,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var sr=function(){return Un((function e(t){if(Nn(this,e),Hn(this,"_bytesAvailable",void 0),Hn(this,"_bitsAvailable",0),Hn(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}),[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var n=new Uint8Array(4);n.set(this._data.subarray(e,e+t)),this._word=new DataView(n.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"bitsPos",value:function(){return 8*this._bytesAvailable-this._bitsAvailable}},{key:"bitsLeft",value:function(){return 8*this._data.length-this.bitsPos()}},{key:"byteAligned",value:function(){return 0===this.bitsPos()||this.bitsPos()%8==0}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),n=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?n<>>e)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,n=8,r=0;r>this._numHeldBits-e&(1<1){e.streamRead1Bytes();for(var f=0,p=t-2;p>=0;--p)f|=e.extractBits(1)<1;++g)e.extractBits(1);for(var m=t-2;m>=0;--m)f&1<=n))break;var r=e.buffer.slice(e.position,e.position+4);e.skip(4);var i=new Uint8Array(e.buffer.slice(e.position,e.position+n));e.skip(n),t.push({header:r,body:i})}return t}},{key:"analyseNal",value:function(e){var t=(248&e.body[1])>>3;switch(e.type=t,t){case 23:case 24:break;case 7:case 8:e.key=!0;break;case 14:e.vps=!0;break;case 15:e.sps=!0;break;case 16:e.pps=!0;break;case 17:e.aps=!0}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,n=[],r=1;r=0;--p)h[p]=t.readBits(1);for(;!t.byteAligned();)t.readBits(1);for(var g=c;g>=0;--g)h[g]&&(d[g]=t.readUByte());if(n)for(var m=t.readUByte(),v=0;v>>16),this.dv.setUint16(n+1,65535&t);case 4:return this.dv.setUint32(n,t);default:throw new Error("write ".concat(e,"-byte integers is not supported"))}}},{key:"readToBuffer",value:function(e){var t;return t=this.offset||e?this.dv.buffer.slice(this.offset,e?this.offset+e:this.end):this.dv.buffer,this.offset+=t.byteLength,t}},{key:"readToUint8",value:function(e){var t=new Uint8Array(this.dv.buffer,this.offset,e||this.unreadLength);return this.offset+=t.byteLength,t}},{key:"readString",value:function(e){for(var t=0,n="";t=0){var n=0,r=0;if(this.offset+=e,this.size>31){for(;r>>t&n}throw new Error("the number of the read operation exceeds the total length limit of bits")}}],[{key:"fromByte",value:function(t,n){return new e(t.read(n),n<<3)}}])}(),pr=function(){function e(){Nn(this,e)}return Un(e,null,[{key:"findBox",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,s="",a=0;t.length>7;){if(o=Wn(t),s=String.fromCharCode.apply(null,t.subarray(4,8)),a=8,1===o?(o=Yn(t,8),a+=8):o||(o=t.length),!n[0]||s===n[0]){var l=t.subarray(0,o);if(!(n.length<2))return e.findBox(l.subarray(a),n.slice(1),r+a);i.push({start:r,size:o,headerSize:a,type:s,data:l})}r+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return yr(e,!0,(function(e,t){e.trackId=Wn(t);var n=4,r=1&e.flags,i=2&e.flags,o=8&e.flags,s=16&e.flags,a=32&e.flags;r&&(n+=4,e.baseDataOffset=Wn(t,n),n+=4),i&&(e.sampleDescriptionIndex=Wn(t,n),n+=4),o&&(e.defaultSampleDuration=Wn(t,n),n+=4),s&&(e.defaultSampleSize=Wn(t,n),n+=4),a&&(e.defaultSampleFlags=Wn(t,n))}))}},{key:"sidx",value:function(e){return yr(e,!0,(function(e,t){var n=0;e.reference_ID=Wn(t,n),n+=4,e.timescale=Wn(t,n),n+=4,0===e.version?(e.earliest_presentation_time=Wn(t,n),n+=4,e.first_offset=Wn(t,n),n+=4):(e.earliest_presentation_time=Yn(t,n),n+=8,e.first_offset=Yn(t,n),n+=8),n+=2,e.references=[];var r=Qn(t,n);n+=2;for(var i=0;i>31&1,o.referenced_size=2147483647&s,o.subsegment_duration=Wn(t,n),s=Wn(t,n+=4),n+=4,o.starts_with_SAP=s>>31&1,o.SAP_type=s>>28&7,o.SAP_delta_time=268435455&s}}))}},{key:"moov",value:function(t){return yr(t,!1,(function(t,n,r){t.mvhd=e.mvhd(e.findBox(n,["mvhd"],r)[0]),t.trak=e.findBox(n,["trak"],r).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(n,["pssh"],r)[0])}))}},{key:"mvhd",value:function(e){return yr(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=Wn(t,16),e.duration=Yn(t,20),n+=28):(e.timescale=Wn(t,8),e.duration=Wn(t,12),n+=16),e.nextTrackId=Wn(t,n+76)}))}},{key:"trak",value:function(t){return yr(t,!1,(function(t,n,r){t.tkhd=e.tkhd(e.findBox(n,["tkhd"],r)[0]),t.mdia=e.mdia(e.findBox(n,["mdia"],r)[0]),t.edts=e.edts(e.findBox(n,["edts"],r)[0])}))}},{key:"tkhd",value:function(e){return yr(e,!0,(function(e,t){var n=dr.fromUint8(t);1===e.version?(n.read(8),n.read(8),e.trackId=n.read(4),n.read(4),e.duration=n.read(8)):(n.read(4),n.read(4),e.trackId=n.read(4),n.read(4),e.duration=n.read(4)),n.skip(16),e.matrix=[];for(var r=0;r<36;r++)e.matrix.push(n.read(1));n.back(36);for(var i,o=[],s=0;s<3;s++)o.push(er(n.readInt(2),n.readInt(2))),o.push(er(n.readInt(2),n.readInt(2))),i=n.readInt(4),o.push(er(i>>30,1073741823&i));e.rotation=function(e){if(e.length<5)return 0;var t=Math.hypot(e[0],e[3]),n=Math.hypot(e[1],e[4]);return 0===t||0===n?0:180*Math.atan2(e[1]/n,e[0]/t)/Math.PI}(o),e.width=n.read(4),e.height=n.read(4)}))}},{key:"mdia",value:function(t){return yr(t,!1,(function(t,n,r){t.mdhd=e.mdhd(e.findBox(n,["mdhd"],r)[0]),t.hdlr=e.hdlr(e.findBox(n,["hdlr"],r)[0]),t.minf=e.minf(e.findBox(n,["minf"],r)[0])}))}},{key:"edts",value:function(t){return yr(t,!1,(function(t,n,r){t.elst=e.elst(e.findBox(n,["elst"],r)[0])}))}},{key:"elst",value:function(e){return yr(e,!0,(function(e,t,n){e.entries=[],e.entriesData=t;var r=0,i=Wn(t,r);r+=4;for(var o=0;o>10&31),96+(r>>5&31),96+(31&r))}))}},{key:"hdlr",value:function(e){return yr(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return yr(t,!1,(function(t,n,r){t.vmhd=e.vmhd(e.findBox(n,["vmhd"],r)[0]),t.smhd=e.smhd(e.findBox(n,["smhd"],r)[0]),t.stbl=e.stbl(e.findBox(n,["stbl"],r)[0])}))}},{key:"vmhd",value:function(e){return yr(e,!0,(function(e,t){e.graphicsmode=Qn(t),e.opcolor=[Qn(t,2),Qn(t,4),Qn(t,6)]}))}},{key:"smhd",value:function(e){return yr(e,!0,(function(e,t){e.balance=Qn(t)}))}},{key:"stbl",value:function(t){return yr(t,!1,(function(t,n,r){var i,o,s;t.stsd=e.stsd(e.findBox(n,["stsd"],r)[0]),t.stts=e.stts(e.findBox(n,["stts"],r)[0]),t.ctts=e.ctts(e.findBox(n,["ctts"],r)[0]),t.stsc=e.stsc(e.findBox(n,["stsc"],r)[0]),t.stsz=e.stsz(e.findBox(n,["stsz"],r)[0]),t.stco=e.stco(e.findBox(n,["stco"],r)[0]),t.stco||(t.co64=e.co64(e.findBox(n,["co64"],r)[0]),t.stco=t.co64);var a=null===(i=t.stsd.entries[0])||void 0===i||null===(o=i.sinf)||void 0===o||null===(s=o.schi)||void 0===s?void 0:s.tenc.default_IV_size;t.stss=e.stss(e.findBox(n,["stss"],r)[0]),t.senc=e.senc(e.findBox(n,["senc"],r)[0],a)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return yr(e,!0,(function(e,n){var r=0,i=Wn(n,r);r+=4,e.samples=[];for(var o=0;o0){var s=Wn(t,i);i+=4;for(var a=0;a<(""+s).length;a++)for(var l=0;l<16;l++){var u=t[i];i+=1,n.push(_r(u))}}var c=Wn(t,i);e.data_size=c,i+=4,e.kid=n,e.system_id=r,e.buffer=t}))}},{key:"bvc2",value:function(t){return yr(t,!1,(function(t,n,r){var i=mr(t,n),o=n.subarray(i);r+=i,t.vvcC=e.bv2C(e.findBox(o,["bv2C"],r)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],r)[0])}))}},{key:"bv2C",value:function(e){return yr(e,!1,(function(e,t,n){var r=lr.parseVVCDecoderConfigurationRecord(t);for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}))}},{key:"stsd",value:function(t){return yr(t,!0,(function(t,n,r){t.entryCount=Wn(n),t.entries=e.findBox(n.subarray(4),[],r+4).map((function(t){switch(t.type){case"av01":return e.av01(t);case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"bvc2":return e.bvc2(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return yr(t,!1,(function(t,n,r){t.channelCount=Qn(n,16),t.samplesize=Qn(n,18),t.sampleRate=Wn(n,24)/65536,n=n.subarray(28),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.esds=e.esds(e.findBox(n,["esds"],r)[0])}));case"encv":return yr(t,!1,(function(t,n,r){t.width=Qn(n,24),t.height=Qn(n,26),t.horizresolution=Wn(n,28),t.vertresolution=Wn(n,32),n=n.subarray(78),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.avcC=e.avcC(e.findBox(n,["avcC"],r)[0]),t.hvcC=e.hvcC(e.findBox(n,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(n,["pasp"],r)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return yr(e,!1,(function(e,t){var n=6;e.default_IsEncrypted=t[n],n+=1,e.default_IV_size=t[n],n+=1,e.default_KID=[];for(var r=0;r<16;r++)e.default_KID.push(_r(t[n])),n+=1}))}},{key:"schi",value:function(t){return yr(t,!1,(function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])}))}},{key:"sinf",value:function(t){return yr(t,!1,(function(t,n,r){t.schi=e.schi(e.findBox(n,["schi"],r)[0]),t.frma=e.frma(e.findBox(n,["frma"],r)[0])}))}},{key:"frma",value:function(e){return yr(e,!1,(function(e,t){e.data_format="";for(var n=0;n<4;n++)e.data_format+=String.fromCharCode(t[n])}))}},{key:"colr",value:function(e){return yr(e,!1,(function(t,n){var r=dr.fromUint8(n);t.data=e.data,t.colorType=r.readString(4),"nclx"===t.colorType?(t.colorPrimaries=r.read(2),t.transferCharacteristics=r.read(2),t.matrixCoefficients=r.read(2),t.fullRangeFlag=r.read(1)>>7):"rICC"!==t.colorType&&"prof"!==t.colorType||(t.iccProfile=n.readToUint8())}))}},{key:"av01",value:function(t){return yr(t,!1,(function(t,n,r){var i=mr(t,n),o=n.subarray(i);r+=i,t.av1C=e.av1C(e.findBox(o,["av1C"],r)[0]),t.colr=e.colr(e.findBox(o,["colr"],r)[0])}))}},{key:"av1C",value:function(e){return yr(e,!1,(function(t,n){t.data=e.data;var r,i=dr.fromUint8(n),o=fr.fromByte(i,4);t.marker=o.read(1),t.version=o.read(7),t.seqProfile=o.read(3),t.seqLevelIdx0=o.read(5),t.seqTier0=o.read(1),t.highBitdepth=o.read(1),t.twelveBit=o.read(1),t.monochrome=o.read(1),t.chromaSubsamplingX=o.read(1),t.chromaSubsamplingY=o.read(1),t.chromaSamplePosition=o.read(2),t.reserved=o.read(3),t.initialPresentationDelayPresent=o.read(1),t.initialPresentationDelayPresent?t.initialPresentationDelayMinusOne=o.read(4):t.initialPresentationDelayMinusOne=0,t.configOBUs=i.readToUint8(),2===t.seqLevelIdx0&&1===t.highBitdepth?r=1===t.twelveBit?"12":"10":t.seqProfile<=2&&(r=1===t.highBitdepth?"10":"08"),t.codec=["av01",t.seqProfile,(t.seqLevelIdx0<10?"0"+t.seqLevelIdx0:t.seqLevelIdx0)+(t.seqTier0?"H":"M"),r].join(".")}))}},{key:"avc1",value:function(t){return yr(t,!1,(function(t,n,r){var i=mr(t,n),o=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(o,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],r)[0])}))}},{key:"avcC",value:function(e){return yr(e,!1,(function(t,n){t.data=e.data,t.configurationVersion=n[0],t.AVCProfileIndication=n[1],t.profileCompatibility=n[2],t.AVCLevelIndication=n[3],t.codec=function(e){for(var t,n="avc1.",r=0;r<3;r++)(t=e[r].toString(16)).length<2&&(t="0".concat(t)),n+=t;return n}([n[1],n[2],n[3]]),t.lengthSizeMinusOne=3&n[4],t.spsLength=31&n[5],t.sps=[];for(var r=6,i=0;i>6,t.generalTierFlag=(32&r)>>5,t.generalProfileIdc=31&r,t.generalProfileCompatibility=Wn(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=Qn(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,s=0,a=0,l=0;l>3;return 31===a&&s.length>=2&&(a=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=a,e.codec+=a.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[n].toString(16)+".").padStart(3,"0"),t=t.subarray(n+13)}}}))}},{key:"alaw",value:function(e){return yr(e,!1,(function(e,t){vr(e,t)}))}},{key:"stts",value:function(e){return yr(e,!0,(function(e,t){for(var n=Wn(t),r=[],i=4,o=0;os&&1&r&&(e.dataOffset=-(1+~Wn(t,s)),s+=4),i>s&&4&r&&(e.firstSampleFlags=Wn(t,s),s+=4),i>s){var a;e.samples=new Array(o);for(var l=0;l>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,n){var r,i,o=e.trak;if(o&&o.length){var s=o.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),a=o.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(s&&t){var l,u,c,h,d,f,p,g,m=t;null!=(null===(l=s.tkhd)||void 0===l?void 0:l.trackId)&&(m.id=s.tkhd.trackId),m.tkhdDuration=s.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=s.mdia.mdhd.timescale,m.duration=s.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale,m.rotation=s.tkhd.rotation,m.matrix=s.tkhd.matrix,null!==(u=s.edts)&&void 0!==u&&u.elst&&(m.editList=s.edts.elst,m.editListApplied=s.editListApplied);var v,y,_,T,b,S,k,P,M=s.mdia.minf.stbl.stsd.entries[0];if(m.width=M.width,m.height=M.height,M.pasp&&(m.sarRatio=[M.pasp.hSpacing,M.pasp.vSpacing]),M.av1C)m.codecType="av1",m.codec=M.av1C.codec,m.av1C=M.av1C.data,m.colr=M.colr.data;else if(M.hvcC)m.codecType=cr,m.codec=M.hvcC.codec,m.vps=M.hvcC.vps,m.sps=M.hvcC.sps,m.pps=M.hvcC.pps,m.hvcC=M.hvcC.data;else if(M.avcC)m.codec=M.avcC.codec,m.sps=M.avcC.sps,m.pps=M.avcC.pps;else{if(!M.vvcC)throw new Error("unknown video stsd entry");m.codecType=hr,m.codec=M.vvcC.codec,m.sps=M.vvcC.sps,m.pps=M.vvcC.pps,m.vps=M.vvcC.vps,m.vvcC=M.vvcC.data}m.present=!0,m.ext={},m.ext.stss=null===(c=s.mdia)||void 0===c||null===(h=c.minf)||void 0===h||null===(d=h.stbl)||void 0===d?void 0:d.stss,m.ext.ctts=null===(f=s.mdia)||void 0===f||null===(p=f.minf)||void 0===p||null===(g=p.stbl)||void 0===g?void 0:g.ctts,M&&"encv"===M.type&&(m.isVideoEncryption=!0,M.default_KID=null===(v=M.sinf)||void 0===v||null===(y=v.schi)||void 0===y?void 0:y.tenc.default_KID,M.default_IsEncrypted=null===(_=M.sinf)||void 0===_||null===(T=_.schi)||void 0===T?void 0:T.tenc.default_IsEncrypted,M.default_IV_size=null===(b=M.sinf)||void 0===b||null===(S=b.schi)||void 0===S?void 0:S.tenc.default_IV_size,m.videoSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,M.data_format=null===(k=M.sinf)||void 0===k||null===(P=k.frma)||void 0===P?void 0:P.data_format,m.useEME=e.useEME,m.kidValue=e.kidValue,m.pssh=e.pssh,m.encv=M)}if(a&&n){var R,w,x,E,D,I,C,L,O,A,G=n;null!=(null===(R=a.tkhd)||void 0===R?void 0:R.trackId)&&(G.id=a.tkhd.trackId),G.tkhdDuration=a.tkhd.duration,G.mvhdDurtion=e.mvhd.duration,G.mvhdTimecale=e.mvhd.timescale,G.timescale=G.formatTimescale=a.mdia.mdhd.timescale,G.duration=a.mdia.mdhd.duration||G.mvhdDurtion/G.mvhdTimecale*G.timescale,null!==(w=a.edts)&&void 0!==w&&w.elst&&(G.editList=a.edts.elst,G.editListApplied=a.editListApplied);var $,B,N,F,U,H,V,j,z=a.mdia.minf.stbl.stsd.entries[0];switch(G.sampleSize=z.sampleSize,G.sampleRate=z.sampleRate,G.channelCount=z.channelCount,G.present=!0,z.type){case"alaw":G.codecType=G.codec="g7110a",G.sampleRate=8e3;break;case"ulaw":G.codecType=G.codec="g7110m",G.sampleRate=8e3;break;default:G.sampleDuration=or.getFrameDuration(G.sampleRate,G.timescale),G.sampleRateIndex=or.getRateIndexByRate(G.sampleRate),G.objectType=(null===(r=z.esds)||void 0===r?void 0:r.objectType)||2,z.esds&&(G.config=Array.from(z.esds.config)),G.codec=(null===(i=z.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}G.sampleDuration=or.getFrameDuration(G.sampleRate,G.timescale),G.objectType=(null===(x=z.esds)||void 0===x?void 0:x.objectType)||2,z.esds&&(z.esds.config?G.config=Array.from(z.esds.config):console.warn("esds config is null")),G.codec=(null===(E=z.esds)||void 0===E?void 0:E.codec)||"mp4a.40.2",G.sampleRateIndex=or.getRateIndexByRate(G.sampleRate),G.ext={},G.ext.stss=null===(D=a.mdia)||void 0===D||null===(I=D.minf)||void 0===I||null===(C=I.stbl)||void 0===C?void 0:C.stss,G.ext.ctts=null===(L=a.mdia)||void 0===L||null===(O=L.minf)||void 0===O||null===(A=O.stbl)||void 0===A?void 0:A.ctts,G.present=!0,z&&"enca"===z.type&&(G.isAudioEncryption=!0,z.data_format=null===($=z.sinf)||void 0===$||null===(B=$.frma)||void 0===B?void 0:B.data_format,z.default_KID=null===(N=z.sinf)||void 0===N||null===(F=N.schi)||void 0===F?void 0:F.tenc.default_KID,z.default_IsEncrypted=null===(U=z.sinf)||void 0===U||null===(H=U.schi)||void 0===H?void 0:H.tenc.default_IsEncrypted,z.default_IV_size=null===(V=z.sinf)||void 0===V||null===(j=V.schi)||void 0===j?void 0:j.tenc.default_IV_size,G.audioSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,G.useEME=e.useEME,G.kidValue=e.kidValue,G.enca=z)}if(n&&(n.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!n&&n.isAudioEncryption),null!=t&&t.encv||null!=n&&n.enca){var X,K,Q=null==t||null===(X=t.encv)||void 0===X?void 0:X.default_KID,W=null==n||null===(K=n.enca)||void 0===K?void 0:K.default_KID,q=Q||W?(Q||W).join(""):null;t&&(t.kid=q),n&&(n.kid=q)}return t&&(t.flags=3841),n&&(n.flags=1793),{videoTrack:t,audioTrack:n}}}},{key:"evaluateDefaultDuration",value:function(e,t,n){var r,i=null==t||null===(r=t.samples)||void 0===r?void 0:r.length;return i?1024*i/t.timescale*e.timescale/n:1024}},{key:"moofToSamples",value:function(t,n,r){var i={};return t.mfhd&&(n&&(n.sequenceNumber=t.mfhd.sequenceNumber),r&&(r.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var o=t.tfhd,s=t.tfdt,a=t.trun;if(o&&a){s&&(n&&n.id===o.trackId&&(n.baseMediaDecodeTime=s.baseMediaDecodeTime),r&&r.id===o.trackId&&(r.baseMediaDecodeTime=s.baseMediaDecodeTime));var l=o.defaultSampleSize||0,u=o.defaultSampleDuration||e.evaluateDefaultDuration(n,r,a.samples.length||a.sampleCount),c=a.dataOffset||0,h=0,d=-1;if(!a.samples.length&&a.sampleCount){i[o.trackId]=new Array(a.sampleCount);for(var f=0;f>>0!=65536}).keyframe&&(d++,e.gopId=d),h+=e.duration,c+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var n=t.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),r=t.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(n||r){var i,o;if(n){var s,a,l=null===(s=n.mdia)||void 0===s||null===(a=s.minf)||void 0===a?void 0:a.stbl;if(!l)return;var u=l.stts,c=l.stsc,h=l.stsz,d=l.stco,f=l.stss,p=l.ctts;if(!(u&&c&&h&&d&&f))return;i=gr(u,c,h,d,p,f)}if(r){var g,m,v,y=null===(g=r.mdia)||void 0===g||null===(m=g.minf)||void 0===m?void 0:m.stbl;if(!y)return;var _=null===(v=r.mdia.mdhd)||void 0===v?void 0:v.timescale,T=y.stts,b=y.stsc,S=y.stsz,k=y.stco;if(!(_&&T&&b&&S&&k))return;o=gr(T,b,S,k)}return{videoSamples:i,audioSamples:o}}}}}])}();function gr(e,t,n,r,i,o){var s,a,l,u=[],c=null==i?void 0:i.entries,h=t.entries,d=r.entries,f=n.entrySizes,p=null==o?void 0:o.entries;p&&(s={},p.forEach((function(e){s[e-1]=!0}))),c&&(a=[],c.forEach((function(e){for(var t=e.count,n=e.offset,r=0;r=S&&(_++,S=h[_+1]?h[_+1].firstChunk-1:1/0),b+=h[_].samplesPerChunk)})),u}function mr(e,t){return e.dataReferenceIndex=Qn(t,6),e.width=Qn(t,24),e.height=Qn(t,26),e.horizresolution=Wn(t,28),e.vertresolution=Wn(t,32),e.frameCount=Qn(t,40),e.depth=Qn(t,74),78}function vr(e,t){return e.dataReferenceIndex=Qn(t,6),e.channelCount=Qn(t,16),e.sampleSize=Qn(t,18),e.sampleRate=Wn(t,24)/65536,28}function yr(e,t,n){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var r={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(r.version=e.data[e.headerSize],r.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),r.headerSize+=4),n(r,e.data.subarray(r.headerSize),r.start+r.headerSize),r}}var _r=function(){for(var e=[],t=arguments.length,n=new Array(t),r=0;rthis.maxPts&&(this.maxPts=t)}}])}();function kr(e,t){var n=e.trak;if(n&&n.length){var r=n.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),i=n.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(r||i){var o=[],s=[];if(t){var a=[],l=0,u=t.start+t.size;t.references.forEach((function(e,n){a.push({index:n,startTime:l,endTime:l+e.subsegment_duration/t.timescale,duration:e.subsegment_duration/t.timescale,range:[u,u+e.referenced_size],frames:[]}),l+=e.subsegment_duration/t.timescale,u+=e.referenced_size})),o=a,s=a}else{var c,h,d=function(t){return t?[{index:0,startTime:0,endTime:t.duration/t.timescale,duration:t.duration/t.timescale,range:[e.start+e.size,""],frames:[]}]:[]};s=d(e.mvhd.duration?e.mvhd:null===(c=r.mdia)||void 0===c?void 0:c.mdhd),o=d(e.mvhd.duration?e.mvhd:null===(h=i.mdia)||void 0===h?void 0:h.mdhd)}return{videoSegments:s,audioSegments:o}}}}function Pr(e,t){var n=t.segmentDuration,r=e.trak;if(r&&r.length){var i=r.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),o=r.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(i||o){var s,a=[],l=[];return i&&(s=(a=Mr("video",i,n,t)).map((function(e){return e.duration}))),o&&(l=Mr("audio",o,n,t,s,a)),{videoSegments:a,audioSegments:l}}}}function Mr(e,t,n,r){var i,o,s,a,l,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],c=arguments.length>5?arguments[5]:void 0,h=r.fixEditListOffset,d=r.fixEditListOffsetThreshold,f=r.audioGroupingStrategy,p=r.memoryOpt,g=null===(i=t.mdia)||void 0===i||null===(o=i.minf)||void 0===o?void 0:o.stbl;if(!g)return[];var m=null===(s=t.mdia.mdhd)||void 0===s?void 0:s.timescale,v=g.stts,y=g.stsc,_=g.stsz,T=g.stco,b=g.stss,S=g.ctts;if(!(m&&v&&y&&_&&T)||"video"===e&&!b)return[];var k=0,P=null===(a=t.edts)||void 0===a||null===(l=a.elst)||void 0===l?void 0:l.entries;if(h&&function(){var e=!0,t=navigator.userAgent||"";if(/Chrome/gi.test(t)&&!/Edge\//gi.test(t)){var n=t.match(/Chrome\/(\d+)/i),r=n?parseInt(n[1],10):0;e=!!r&&r>=75}return e}()&&Array.isArray(P)&&P.length>0){var M=P[0].media_time;M>0&&M<(d?d*m:5*m)&&(k=M)}var R,w,x=[],E=[],D=[],I=[],C=[],L=y.entries,O=T.entries,A=_.entrySizes,G=null==b?void 0:b.entries,$=null==S?void 0:S.entries,B=[],N={};p||($&&$.forEach((function(e){for(var t=e.count,n=e.offset,r=0;r0?L[0].samplesPerChunk:0,X=L.length>1&&L[1]?L[1].firstChunk-1:1/0,K=0,Q=-1,W=!1,q={};(null==$?void 0:$.length)>0&&k>0&&(K-=k,W=!0),t.editListApplied=W,p&&(F=null==G?void 0:G.shift()),v.entries.forEach((function(e){var t=e.count,n=e.delta;w=n;for(var r=0;r0&&void 0!==C[E.length-1]){var o,s=null===(o=x[C[E.length-1]])||void 0===o?void 0:o.pts;void 0!==s&&R.pts>s&&(C[E.length-1]=R.index)}x[x.length]=R,K+=n,++U=X&&(V++,X=L[V+1]?L[V+1].firstChunk-1:1/0),z+=L[V].samplesPerChunk)}}));var Y=x.length;if(!Y||b&&!x[0].keyframe)return[];var J,Z,ee=[],te=[],ne=0,re=0,ie=0,oe=0,se=function(e,t,n){J=te[te.length-1],p?(ie=(null==E?void 0:E.length)>0?E[t].minPts:te[0].pts,oe=(null==E?void 0:E.length)>0?E[n].maxPts:J.pts+J.duration):(ie=I[t],Z=x[C[n]],oe=Z.pts+Z.duration),0===ee.length&&(e=(oe-ie)/m),ee.push({index:ee.length,startTime:ie/m,endTime:oe/m,duration:e,range:[te[0].offset,J.offset+J.size-1],frames:te}),1!==f&&(ne=0),te=[]},ae=0;if(b)for(var le=n*m,ue=0,ce=E.length;uele)&&(se(ne/m,ae,ue),ne=0,ae=ue+1):(se(ne/m,ae,ue),ne=0,ae=ue+1)}else{p||(I=[],C=[]);var fe=u[0]||n;if(1===f)for(var pe,ge=0;gec[ee.length].endTime:pe-te[0].pts/m>=fe))&&(p||(I.push(te[0].pts),C.push(te[te.length-1].index)),se(_e,ee.length,ee.length),fe=u[ee.length]||n)}else for(var Te,be=0;be=fe)&&(re+=2===f?ne/m-fe:Te-fe,p||(I.push(te[0].pts),C.push(te[te.length-1].index)),se(Me,ee.length,ee.length),fe=u[ee.length]||n)}}return ee}function Rr(e,t,n){n.offset=0;var r=(null==n?void 0:n.beforeFrameNum)||0,i=(null==n?void 0:n.usedCttsIdx)||0;if(!e||(null==e?void 0:e.length)<=0||(null==n?void 0:n.usedCttsIdx)>=e.length)n.offset=0,n.usedCttsIdx=i,n.beforeFrameNum=r;else{var o=e[i];if(t=((null===(t=this.videoSegments[this.videoSegments.length-1])||void 0===t?void 0:t.index)||(null===(n=this.audioSegments[this.audioSegments.length-1])||void 0===n?void 0:n.index)||0)}},{key:"isSegmentLoading",value:function(e){return e===this._currentLoadingSegmentIndex}},{key:"changeUrl",value:(d=Zt(hn().mark((function e(t){var n,r,i,o=arguments;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:t,r=o.length>2?o[2]:void 0,i=o.length>3?o[3]:void 0,e.next=5,this.reset(i);case 5:t&&(this.url=t),n&&(this.vid=n),r&&(this._config.moovEnd=r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"getOrLoadMeta",value:(h=Zt(hn().mark((function e(t){return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(t);case 3:return e.abrupt("return",this.meta);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"newBufferArray",value:function(e,t){var n;if(this.buffer){if(t||(null===(n=this.buffer)||void 0===n?void 0:n.byteLength)3&&void 0!==h[3]?h[3]:{},this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[s,a]),null!==(i=this._config)&&void 0!==i&&i.memoryOpt&&(!this.buffer||null!=l&&l.isExp))try{this.newBufferArray(a-s+1,null==l?void 0:l.isExp)}catch(f){r(null,!0,{},new Tr(null==f?void 0:f.message),{})}return u=function(){var e=Zt(hn().mark((function e(n,i,o,u){var h,d,f,p,g,m,v,y,_,T,b,S,k,P,M,R;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.meta&&null!=o&&o.range&&o.range.length>0&&o.range[1]>=a&&(i=!0,c.logger.debug("[loadMetaProcess],data done,setstate true,[",s,a,"]")),i&&null!=o&&o.range&&o.range.length>0&&o.range[1]0&&r(n,i,o,null,u),!c.meta.moov&&!c._error){e.next=6;break}return e.abrupt("return");case 6:if(!(n&&n.byteLength>0)){e.next=59;break}e.prev=7,null!==(d=c._config)&&void 0!==d&&d.memoryOpt?(c.buffer.set(n,c.bufferDataLen),c.bufferDataLen+=(null==n?void 0:n.byteLength)||0,h=c.buffer.subarray(0,c.bufferDataLen)):(c.buffer=On(c.buffer,n),h=c.buffer),e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(7),r(null,i,o,new Tr(null===e.t0||void 0===e.t0?void 0:e.t0.message),u),e.abrupt("return");case 15:if(f=pr.findBox(h,["moov"])[0]){e.next=30;break}if(p=pr.findBox(h,["mdat"])[0],!i){e.next=30;break}if(p){e.next=25;break}return c._error=!0,r(null,i,o,new Tr("cannot find moov or mdat box"),u),e.abrupt("return");case 25:return g=p.start+p.size,e.next=28,c.loadData([g,""],t,l);case 28:(m=e.sent)&&(f=pr.findBox(m.data,["moov"])[0]);case 30:if(!(f&&i&&f.size>f.data.length)){e.next=34;break}return c.logger.debug("[loadMetaProcess],moov not all, range,",o.range[1],",dataLen,",c.bufferDataLen,", state,",i),e.next=34,c.loadMetaProcess(t,[o.range[1],f.start+f.size-1],r,{isExp:!0});case 34:if(!(f&&f.size<=f.data.length)||c.meta.moov){e.next=59;break}if(y=pr.moov(f)){e.next=40;break}return c._error=!0,r(null,i,o,new Tr("cannot parse moov box"),u),e.abrupt("return");case 40:if(_=Pr(y,c._config),T=function(){var e=Zt(hn().mark((function e(n){var r,i;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=pr.findBox(c.buffer,[n])[0])){e.next=11;break}if(!(r.size>r.data.length)){e.next=10;break}return e.next=5,c.loadData([r.start,r.start+r.size-1],t,l);case 5:if(!(i=e.sent)){e.next=8;break}return e.abrupt("return",pr.findBox(i.data,[n])[0]);case 8:e.next=11;break;case 10:return e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),b=!1,_&&_.videoSegments.length&&_.audioSegments.length){e.next=48;break}return e.next=46,T("sidx");case 46:(S=e.sent)&&(k=pr.sidx(S))&&(kr(y,k),cn("segments"),b=!0);case 48:if(Er(_)){e.next=52;break}return c._error=!0,r(null,i,o,new Tr("cannot parse segments"),u),e.abrupt("return");case 52:c.meta=wr(y,b),M=(P=_).videoSegments,R=P.audioSegments,c.videoSegments=M,c.audioSegments=R,null!==(v=c._config)&&void 0!==v&&v.memoryOpt&&(delete c.buffer,c.bufferDataLen=0),c.logger.debug("[loadMetaProcess] moov ok"),r(void 0,i,{meta:{meta:c.meta,videoSegments:M,audioSegments:R}},null,u);case 59:case"end":return e.stop()}}),e,null,[[7,11]])})));return function(t,n,r,i){return e.apply(this,arguments)}}(),e.next=8,this.loadData([s,a||this._config.moovEnd],t,un({onProgress:u},l));case 8:case"end":return e.stop()}var d,f}),e,this)}))),function(e,t,n){return c.apply(this,arguments)})},{key:"loadMeta",value:(u=Zt(hn().mark((function e(t,n){var r,i,o,s,a,l,u,c,h,d,f,p,g,m,v,y=arguments;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=y.length>2&&void 0!==y[2]?y[2]:{},i=[],this.logger.debug("[loadMeta start]"),e.next=5,this.loadData([0,n||this._config.moovEnd],t,r);case 5:if(o=e.sent){e.next=8;break}return e.abrupt("return");case 8:if(i.push(o),s=pr.findBox(o.data,["moov"])[0]){e.next=24;break}if(a=pr.findBox(o.data,["mdat"])[0]){e.next=14;break}throw new Tr("cannot find moov or mdat box",o.data);case 14:return l=a.start+a.size,e.next=17,this.loadData([l],t,r);case 17:if(o=e.sent){e.next=20;break}return e.abrupt("return");case 20:if(i.push(o),s=pr.findBox(o.data,["moov"],l)[0]){e.next=24;break}throw new Tr("cannot find moov box",o.data);case 24:if(!(s.size>s.data.length)){e.next=32;break}return e.next=27,this.loadData([o.data.length,s.start+s.size-1],t,r);case 27:if(o=e.sent){e.next=30;break}return e.abrupt("return");case 30:i.push(o),s.data=On(s.data,o.data);case 32:if(u=pr.moov(s)){e.next=35;break}throw new Tr("cannot parse moov box",s.data);case 35:if(Er(c=Pr(u,this._config))){e.next=38;break}throw new Tr("cannot parse segments",s.data);case 38:return c.videoSegments.length&&c.audioSegments.length||(d=pr.findBox(this.buffer,["moof"])[0],f=pr.findBox(this.buffer,["sidx"])[0],d&&d.size<=d.data.length&&f&&(p=pr.moof(d),h=pr.sidx(f),p&&h&&(kr(u,h),cn("segments")))),this.meta=wr(u,h),m=(g=c).videoSegments,v=g.audioSegments,this.videoSegments=m,this.audioSegments=v,delete this.buffer,this.bufferDataLen=0,this.logger.debug("[load moov end!!!!!]"),e.abrupt("return",{meta:this.meta,videoSegments:m,audioSegments:v,responses:i});case 47:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"loadCacheMeta",value:function(e,t){var n=Pr(e.moov,this._config),r=n.videoSegments,i=n.audioSegments;this.videoSegments=r,this.audioSegments=i,this._currentSegmentIndex=t,this.meta=e}},{key:"getSegmentByTime",value:function(e){var t,n;return this.videoSegments.length?(t=this.videoSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&(n=this.audioSegments[t.index])):n=this.audioSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),{video:t,audio:n}}},{key:"loadSegmentByTime",value:(l=Zt(hn().mark((function e(t,n){var r,i,o,s,a,l=arguments;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(l.length>2&&void 0!==l[2])||l[2],i=l.length>3&&void 0!==l[3]?l[3]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta(n);case 5:return o=this.getSegmentByTime(t),s=o.video,a=o.audio,e.abrupt("return",this._loadSegment(s,a,n,r,i));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"loadNextSegment",value:(a=Zt(hn().mark((function e(t){var n,r,i,o,s=arguments;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(s.length>1&&void 0!==s[1])||s[1],r=s.length>2&&void 0!==s[2]?s[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return i=this.videoSegments[this._currentSegmentIndex+1],o=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(i,o,t,n,r));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"preload",value:(s=Zt(hn().mark((function e(t){var n,r,i,o,s,a,l,u=this;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(!0);case 3:if(t&&!(t<0)){e.next=5;break}return e.abrupt("return");case 5:if(n=this.getSegmentByTime(t),r=n.video,i=n.audio,o=Math.max((null==r?void 0:r.index)||0,(null==i?void 0:i.index)||0)){e.next=9;break}return e.abrupt("return");case 9:return s=this.videoSegments.slice(0,o),a=this.audioSegments.slice(0,o),l=function(){var e=Zt(hn().mark((function e(t){return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>o)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,u._loadSegment(s[t],a[t],!0,!1);case 4:return e.next=6,l(t+1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=14,l(0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(o=Zt(hn().mark((function e(){var t,n=arguments;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.length>0&&void 0!==n[0]&&n[0]){e.next=5;break}return this.logger.debug("[MP4loader reset func call loader.cancel]"),e.next=5,this._loader.cancel();case 5:this.vid=this.url="",this.meta={},this.downloadInfo=[],this.videoSegments=[],this.audioSegments=[],this._currentSegmentIndex=-1,this._currentLoadingSegmentIndex=-1,null!==(t=this._config)&&void 0!==t&&t.memoryOpt&&(delete this.buffer,this.bufferDataLen=0);case 13:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"destroy",value:(i=Zt(hn().mark((function e(){return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.reset();case 2:this.cache.clear();case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"_loadSegment",value:(r=Zt(hn().mark((function e(t,n,r,i,o){var s,a;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||n){e.next=2;break}return e.abrupt("return");case 2:return s=(null==t?void 0:t.index)||(null==n?void 0:n.index)||0,this._currentLoadingSegmentIndex=s,e.prev=4,e.next=7,this.loadData([Math.min((null==t?void 0:t.range[0])||1/0,(null==n?void 0:n.range[0])||1/0),Math.max((null==t?void 0:t.range[1])||0,(null==n?void 0:n.range[1])||0)],r,o);case 7:a=e.sent;case 8:return e.prev=8,this._currentLoadingSegmentIndex=-1,e.finish(8);case 11:if(a){e.next=13;break}return e.abrupt("return");case 13:return i&&(this._currentSegmentIndex=s),a.video=t,a.audio=n,e.abrupt("return",a);case 17:case"end":return e.stop()}}),e,this,[[4,,8,11]])}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"loadData",value:(n=Zt(hn().mark((function e(t,n){var r,i,o,s,a,l=arguments;return hn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.length>2&&void 0!==l[2]?l[2]:{},i=this._getCacheKey(t),e.next=4,this.cache.get(i);case 4:if(o=e.sent){e.next=12;break}return a=null!=r&&r.url?r.url:this.url,e.next=9,this._loader.load(a,un({range:t,vid:this.vid},r));case 9:s=e.sent,e.next=13;break;case 12:s={data:o,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 13:if(s){e.next=15;break}return e.abrupt("return");case 15:return o||(s.data&&this.downloadInfo.push({startTime:s.startTime,endTime:s.endTime,size:s.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",s);case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"_getCacheKey",value:function(e){return(this.vid||this.url)+":"+e}}]);var n,r,i,o,s,a,l,u,c,h,d}(it()),Cr=function(){return Un((function e(){Nn(this,e),Hn(this,"id",1),Hn(this,"type",ur),Hn(this,"codecType","avc"),Hn(this,"pid",-1),Hn(this,"hvcC",void 0),Hn(this,"codec",""),Hn(this,"timescale",0),Hn(this,"formatTimescale",0),Hn(this,"sequenceNumber",0),Hn(this,"baseMediaDecodeTime",0),Hn(this,"baseDts",0),Hn(this,"duration",0),Hn(this,"warnings",[]),Hn(this,"samples",[]),Hn(this,"pps",[]),Hn(this,"sps",[]),Hn(this,"vps",[]),Hn(this,"fpsNum",0),Hn(this,"fpsDen",0),Hn(this,"sarRatio",[]),Hn(this,"width",0),Hn(this,"height",0),Hn(this,"nalUnitSize",4),Hn(this,"present",!1),Hn(this,"isVideoEncryption",!1),Hn(this,"isAudioEncryption",!1),Hn(this,"isVideo",!0),Hn(this,"kid",null),Hn(this,"pssh",null),Hn(this,"ext",void 0)}),[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}},{key:"exist",value:function(){return!!/av01/.test(this.codec)||!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}])}(),Lr=function(){return Un((function e(){Nn(this,e),Hn(this,"id",2),Hn(this,"type","audio"),Hn(this,"codecType","aac"),Hn(this,"pid",-1),Hn(this,"codec",""),Hn(this,"sequenceNumber",0),Hn(this,"sampleDuration",0),Hn(this,"timescale",0),Hn(this,"formatTimescale",0),Hn(this,"baseMediaDecodeTime",0),Hn(this,"duration",0),Hn(this,"warnings",[]),Hn(this,"samples",[]),Hn(this,"baseDts",0),Hn(this,"sampleSize",16),Hn(this,"sampleRate",0),Hn(this,"channelCount",0),Hn(this,"objectType",0),Hn(this,"sampleRateIndex",0),Hn(this,"config",[]),Hn(this,"present",!1),Hn(this,"isVideoEncryption",!1),Hn(this,"isAudioEncryption",!1),Hn(this,"kid",null),Hn(this,"isHeAACExt",!1),Hn(this,"ext",void 0)}),[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.isHeAACExt=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&"aac"===this.codecType)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}])}(),Or=function(){return Un((function e(t,n,r){Nn(this,e),Hn(this,"flag",{}),Hn(this,"keyframe",!1),Hn(this,"gopId",0),Hn(this,"duration",0),Hn(this,"size",0),Hn(this,"units",[]),Hn(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}),[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}])}(),Ar=Un((function e(t,n,r,i){Nn(this,e),Hn(this,"duration",1024),Hn(this,"flag",{dependsOn:2,isNonSyncSample:0}),Hn(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),Gr=function(){return Un((function e(){Nn(this,e),Hn(this,"id",3),Hn(this,"type","metadata"),Hn(this,"timescale",0),Hn(this,"flvScriptSamples",[]),Hn(this,"seiSamples",[])}),[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}])}(),$r=function(){function e(t,n){Nn(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return Un(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i0){var l=this.videoSegmnents[this.videoSegmnents.length-1].frames;this.videoMaxFrameIdx=l[l.length-1].index}if((null===(s=this.audioSegmnents)||void 0===s?void 0:s.length)>0){var u=this.audioSegmnents[this.audioSegmnents.length-1].frames;this.audioMaxFrameIdx=u[u.length-1].index}}return Un(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");this.videoTrack.codec||this.audioTrack.codec||(pr.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc,this.memoryOpt&&this.clearBoxEntries(e))}},{key:"demux",value:function(e,t,n,r,i){this.parseSamples(i);var o,s,a,l=this.videoTrack,u=this.audioTrack;l.samples=[],u.samples=[];var c={};if(n){var h,d=0;if(this.memoryOpt&&this.videoSegmnents&&!(c=this.getFramePosByIdx("video",n[0])))throw new Error("cannot found video frame #".concat(n[0]));for(var f=c,p=f.frameIdx,g=f.segmentIdx,m=n[0],v=n[1];m<=v;m++){if(!this._videoSamples.length&&this.videoSegmnents){var y=this.getFrameInfo("video",g,p);o=y.sample,g=y.segmentIdx,p=y.frameIdx}else o=this._videoSamples[m];if(!o)throw new Error("cannot found video frame #".concat(m));a=o.offset-t,s=e.subarray(a,a+o.size),(h=new Or("number"==typeof o.pts?o.pts:o.dts,o.dts)).duration=o.duration,h.gopId=o.gopId,o.keyframe&&h.setToKeyframe();for(var _=0,T=s.length-1;_0&&t>this._lastRemainBufferStartPos&&t<=this._lastRemainBufferStartPos+this._lastRemainBuffer.byteLength)for(var l=0;l<20;)try{var u=this._lastRemainBuffer.subarray(0,t-this._lastRemainBufferStartPos),c=new Uint8Array(e.byteLength+u.byteLength);c.set(u,0),c.set(new Uint8Array(e),u.byteLength),e=c,t-=u.byteLength,this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0;break}catch(e){if(!(l<20))throw new Error("new Uint8Array error:,"+e.errorMessage);l++}var h,d,f,p=this.videoTrack,g=this.audioTrack;p.samples=[],g.samples=[],p.videoSenc=null,g.audioSenc=null,(null==n?void 0:n[1])>this.videoMaxFrameIdx&&this.videoMaxFrameIdx>0&&(n[1]=this.videoMaxFrameIdx),(null==r?void 0:r[1])>this.audioMaxFrameIdx&&this.audioMaxFrameIdx>0&&(r[1]=this.audioMaxFrameIdx);var m=0,v=0,y={},_=e.byteLength+t;if(n.length>0){var T;if(this.memoryOpt&&this.videoSegmnents&&!(y=this.getFramePosByIdx("video",n[0])))throw new Error("cannot found video frame #".concat(n[0]));for(var b=y,S=b.frameIdx,k=b.segmentIdx,P=n[0];P<=n[1];P++){if(!this._videoSamples.length&&this.videoSegmnents){var M=this.getFrameInfo("video",k,S);h=M.sample,k=M.segmentIdx,S=M.frameIdx}else h=this._videoSamples[P];if(!h)throw new Error("cannot found video frame #".concat(P));if(this.memoryOpt&&h.offset+h.size>_)break;h.offset>=t&&h.offset+h.size<=_&&(m=(f=h.offset-t)+h.size,d=e.subarray(f,m),(T=new Or("number"==typeof h.pts?h.pts:h.dts,h.dts)).duration=h.duration,T.gopId=h.gopId,T.sampleOffset=h.index,h.keyframe&&T.setToKeyframe(),T.data=d,T.size=h.size,p.samples.push(T))}p.samples.length>0&&(p.gopId=p.samples[0].gopId,p.baseMediaDecodeTime=p.samples[0].dts,p.startPts=p.samples[0].pts/p.timescale,p.endPts=p.samples[p.samples.length-1].pts/p.timescale,p.startDts=p.samples[0].dts/p.timescale,p.endDts=p.samples[p.samples.length-1].dts/p.timescale,this.videoSenc&&(p.videoSenc=this.videoSenc.slice(p.samples[0].sampleOffset,p.samples[0].sampleOffset+p.samples.length),p.kidValue=s))}if(r.length>0){if(this.memoryOpt&&this.audioSegmnents&&!(y=this.getFramePosByIdx("audio",r[0])))throw new Error("cannot found video frame #".concat(r[0]));for(var R=y,w=R.frameIdx,x=R.segmentIdx,E=r[0];E<=r[1];E++){if(!this._audioSamples.length&&this.audioSegmnents){var D=this.getFrameInfo("audio",x,w);h=D.sample,x=D.segmentIdx,w=D.frameIdx}else h=this._audioSamples[E];if(!h)throw new Error("cannot found video frame #".concat(E));if(this.memoryOpt&&h.offset+h.size>_)break;h.offset>=t&&h.offset+h.size<=_&&(v=(f=h.offset-t)+h.size,d=e.subarray(f,v),g.samples.push(new Ar(h.dts,d,h.duration,h.index)))}g.samples.length>0&&(g.gopId=g.samples[0].gopId||p.gopId,g.baseMediaDecodeTime=g.samples[0].dts,g.startPts=g.samples[0].pts/g.timescale,g.endPts=g.samples[g.samples.length-1].pts/g.timescale,this.audioSenc&&(g.audioSenc=this.audioSenc.slice(g.samples[0].sampleOffset,g.samples[0].sampleOffset+g.samples.length),g.kidValue=s))}this.decoderData(p,g,a);for(var I=0,C=0;C0?this._lastRemainBufferStartPos=t+e.byteLength-this._lastRemainBuffer.byteLength:this._lastRemainBufferStartPos=0,{videoTrack:p,audioTrack:g,metadataTrack:this.metadataTrack,lastRemainBufferInfo:{data:this._lastRemainBuffer,pos:this._lastRemainBufferStartPos}}}},{key:"setLastRemainBufferInfo",value:function(e,t){this._lastRemainBuffer=e,this._lastRemainBufferStartPos=t}},{key:"reset",value:function(){this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0,this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}},{key:"decoderData",value:function(t,n,r){if(!t.useEME&&!n.useEME&&(null!=t&&t.videoSenc||null!=n&&n.audioSenc)){if(!e.Crypto)throw new Error("Crypto is not defined");e.Crypto.decoderAESCTRData(t,n,r)}}},{key:"getFramePosByIdx",value:function(e,t){var n="video"===e?this.videoSegmnents:this.audioSegmnents;if(!n||null==n||!n.length)return null;for(var r,i=0,o=0;o1?n-1:0),i=1;i>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}])}(),Vr=Math.pow(2,32)-1,jr=function(){function e(){Nn(this,e)}return Un(e,null,[{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var s=8;return n.forEach((function(e){o.set(e,s),s+=e.byteLength})),o}},{key:"FullBox",value:function(t,n,r){for(var i=arguments.length,o=new Array(i>3?i-3:0),s=3;s>16&255,r>>8&255,255&r])].concat(o))}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===ur&&e.codecType===cr}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return Xn(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var n=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],Zn(t.kid),[0,0,0,0]));return e.box(e.types.pssh,n)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var n=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(Vn(t.map((function(t){return e.trak(t)}))),[n]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(Vn(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,t>>24&255,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,i>>8&255,255&i,0,0]))}},{key:"edts",value:function(t){return e.box(e.types.edts,e.elst(t))}},{key:"elst",value:function(t){t.entries;var n=t.entriesData,r=t.version;return e.FullBox(e.types.elst,r,0,n)}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===ur?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){return t&&t.ext,e.box(e.types.stbl,e.stsd(t),e.STTS,[][0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var n;return n="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):t.av1C?e.av01(t):e.avc1hev1vvc1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),n)}},{key:"enca",value:function(t){var n=t.enca.channelCount,r=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>8&255,255&r,0,0]),o=e.esds(t.config),s=e.sinf(t.enca);return e.box(e.types.enca,i,o,s)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],s=t.width,a=t.height,l=t.sarRatio[0],u=t.sarRatio[1],c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,s>>8&255,255&s,a>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),h=new Uint8Array((n=(r=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(r,Vn(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(n,Vn(o))),d=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([l>>24,l>>16&255,l>>8&255,255&l,u>>24,u>>16&255,u>>8&255,255&u]);return e.box(e.types.encv,c,e.box(e.types.avcC,h),e.box(e.types.btrt,d),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var n=new Uint8Array([]),r=e.tenc(t);return e.box(e.types.schi,n,r)}},{key:"tenc",value:function(t){var n=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(Zn(t.default_KID)));return e.box(e.types.tenc,n)}},{key:"sinf",value:function(t){var n=new Uint8Array([]),r=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),o)}},{key:"av01",value:function(t){return e.box(e.types.av01,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t.av1C,t.colr)}},{key:"avc1hev1vvc1",value:function(t){var n,r;t.codecType===cr?(n=e.hvcC(t),r=e.types.hvc1):t.codecType===hr?(n=e.vvcC(t),r=e.types.bvc2):(n=e.avcC(t),r=e.types.avc1);var i=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n];return t.codecType===cr?i.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&i.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(i))}},{key:"avcC",value:function(t){var n,r,i,o=[],s=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,Vn(e))})),t.pps.forEach((function(e){i=e.byteLength,s.push(i>>>8&255),s.push(255&i),s.push.apply(s,Vn(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(r,o).concat([t.pps.length])).concat.apply(n,s)))}},{key:"vvcC",value:function(t){var n=t.vvcC;return e.box(e.types.bv2C,new Uint8Array(n))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,o=t.sps,s=t.pps;if(n){var a=n.generalProfileCompatibilityFlags,l=n.generalConstraintIndicatorFlags,u=(i.length&&1)+(o.length&&1)+(s.length&&1);r=[1,n.generalProfileSpace<<6|n.generalTierFlag<<5|n.generalProfileIdc,a>>>24,a>>>16,a>>>8,a,l[0],l[1],l[2],l[3],l[4],l[5],n.generalLevelIdc,240,0,252,252|n.chromaFormatIdc,248|n.bitDepthLumaMinus8,248|n.bitDepthChromaMinus8,0,0,n.numTemporalLayers<<3|n.temporalIdNested<<2|3,u];var c=function(e){var t;r.push(e.length>>8,e.length),(t=r).push.apply(t,Vn(e))};i.length&&(r.push(160,0,i.length),i.forEach(c)),o.length&&(r.push(161,0,o.length),o.forEach(c)),s.length&&(r.push(162,0,s.length),s.forEach(c))}else r=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(r))}},{key:"pasp",value:function(t){var n,r,i=(r=2,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(n,r)||zn(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],s=i[1];return e.box(e.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var n=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+n,0,0,0,4,15+n,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([n]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(Vn(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(Vn(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var n=e.tfhd(t.id),r=e.tfdt(t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var o=e.saiz(t),s=e.saio(t),a=e.trun1(t),l=e.senc(t);return e.box(e.types.traf,n,r,o,s,a,l)}if(t.isAudioEncryption){var u=e.sbgp(),c=e.saiz(t),h=e.saio(t),d=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,n,r,u,c,h,d,f)}var p=e.sbgp(),g=e.trun1(t);return e.box(e.types.traf,n,r,p,g)}if(t.isVideo){var m=e.trun1(t);return e.box(e.types.traf,n,r,m)}var v=e.sbgp(),y=e.saiz(t),_=e.saio(t),T=e.senc(t),b=e.trun1(t);return e.box(e.types.traf,n,r,v,y,_,T,b)}var S=e.sdtp(t);return e.box(e.types.traf,n,r,S,e.trun(t.samples,S.byteLength+76))}},{key:"sdtp",value:function(t){var n=new Hr;return t.samples.forEach((function(e){n.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),n.buffer)}},{key:"trun1",value:function(t){var n=new Hr,r=Hr.writeUint32(t.samples.length),i=null;if(t.isVideo){var o=t.videoSencLength;i=Hr.writeUint32(76+16*t.samples.length+o+77),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Hr.writeUint32(76+16*t.samples.length+20))}else{var s=76+12*t.samples.length+52;t.isAudioEncryption&&(s=76+12*t.samples.length+8*t.audioSenc.length+105),i=Hr.writeUint32(s)}return t.samples.forEach((function(e){n.write(Hr.writeUint32(e.duration)),n.write(Hr.writeUint32(e.size)),n.write(Hr.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(Hr.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),r,i,n.buffer)}},{key:"senc",value:function(t){var n=new Hr,r=t.samples.length,i=t.isVideo?16:8,o=t.isVideo?2:0,s=[],a=0;return t.isVideo?(s=t.videoSenc,a=t.videoSencLength):s=t.audioSenc,a=a||i*r,n.write(Hr.writeUint32(16+a),e.types.senc,this.extension(0,o)),n.write(Hr.writeUint32(r)),s.forEach((function(e){for(var t=0;t>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saio,r)}},{key:"saiz",value:function(t){var n=t.samples.length,r=new Uint8Array([0,0,0,0,16,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saiz,r)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t){var n=Math.floor(t/(Vr+1)),r=Math.floor(t%(Vr+1));return e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,r>>24,r>>16&255,r>>8&255,255&r]))}},{key:"trun",value:function(t,n){var r=t.length,i=12+16*r;n+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var s=0;s>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,h.isLeading<<2|(null===h.dependsOn||void 0===h.dependsOn?1:h.dependsOn),h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|(null===h.isNonSyncSample||void 0===h.isNonSyncSample?1:h.isNonSyncSample),61440&h.degradationPriority,15&h.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*s)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(Vn(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===ur?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var n=t.ext,r=[e.stsd(t),e.stts(n.stts),e.stsc(n.stsc),e.stsz(n.stsz),e.stco(n.stco)];return n.stss.length&&r.push(e.stss(n.stss)),n.ctts.length&&r.push(e.ctts(n.ctts)),e.box.apply(e,[e.types.stbl].concat(r))}},{key:"stts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,Xn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsc",value:function(t){var n=t.length,r=new Uint8Array(12*n),i=0;return t.forEach((function(e){var t=e.firstChunk,n=e.samplesPerChunk,o=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,Xn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsz",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,Xn(new Uint8Array([0,0,0,0,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stco",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,Xn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stss",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,Xn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"ctts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,Xn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var n=t.timescale,r=t.samples[0].duration,i=r*t.samples.length,o=t.samples[0].sampleOffset*r,s=8;t.samples.forEach((function(e){s+=e.size}));var a=0;if(t.isVideo){var l,u=0;t.videoSenc&&(l=t.videoSenc),t.isVideo&&l.forEach((function(e){u+=8,e.subsamples&&e.subsamples.length&&(u+=2,u+=6*e.subsamples.length)})),t.videoSencLength=u,a=s+141+16*t.samples.length+u,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(a=s+16*t.samples.length+84)}else a=s+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(a=s+169+12*t.samples.length+8*t.audioSenc.length);var c=new Uint8Array([0,0,0,0,0,0,0,255&t.id,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,a>>16&255,a>>8&255,255&a,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,c)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();Br=jr,Hn(jr,"types",["av01","av1C","avc1","avcC","hvc1","hvcC","dinf","dref","edts","elst","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp","bvc2","bv2C"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),Hn(jr,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),Hn(jr,"FTYPAVC1",Br.box(Br.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Hn(jr,"FTYPHEV1",Br.box(Br.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Hn(jr,"DINF",Br.box(Br.types.dinf,Br.box(Br.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Hn(jr,"VMHD",Br.box(Br.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Hn(jr,"SMHD",Br.box(Br.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Hn(jr,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Hn(jr,"STTS",Br.box(Br.types.stts,Br.StblTable)),Hn(jr,"STSC",Br.box(Br.types.stsc,Br.StblTable)),Hn(jr,"STSZ",Br.box(Br.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Hn(jr,"STCO",Br.box(Br.types.stco,Br.StblTable));var zr=function(){return Un((function e(t,n,r){Nn(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new $r("FMP4Remuxer",!r||!r.openLog||!r.openLog)}),[{key:"remux",value:function(){var e,t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.videoTrack,l=this.audioTrack,u=a.exist(),c=l.exist(),h=[];return o&&(s&&s.initMerge?(u&&h.push(this.videoTrack),c&&h.push(this.audioTrack),n=jr.initSegment(h)):(u&&(e=jr.initSegment([this.videoTrack])),c&&(t=jr.initSegment([this.audioTrack])))),u&&a.hasSample()&&(r=this._remuxVideo()),c&&l.hasSample()&&(i=this._remuxAudio()),a.samples=[],l.samples=[],{initSegment:n,videoInitSegment:e,audioInitSegment:t,videoSegment:r,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,n=/av01/.test(e.codec),r=0;n?t.forEach((function(e){r+=e.data.byteLength})):t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));var i=new Uint8Array(r);if(n)for(var o,s=0,a=t.length,l=0;s((e,t,n)=>t in e?Xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const Qr={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET"},Wr="real_time_speed",qr="is unsupported",Yr="buffer_control",Jr="cdn",Zr="pcdn",ei=new Map,ti=new Map,ni=new Map,ri="gop",ii="size",oi={BUFFER_CONTROLS:"buffer_control"},si="timer_update",ai="h264",li="h265",ui="h266",ci="0.2.6",hi={416:We[Qe.NETWROK_RANGE_NOT_SATISFIABLE],403:We[Qe.NETWORK_FORBIDDEN],404:We[Qe.NETWORK_NOTFOUND],timeout:We[Qe.NETWORK_TIMEOUT],"4xx":`${We[Qe.NETWORK]}4XX`,"5xx":`${We[Qe.NETWORK]}5XX`,networkError:We[Qe.NETWORK],contentError:`${We[Qe.NETWORK]}contentError`,mse:We[Qe.MEDIA][Qe.SUB_TYPES.MSE_OTHER],mseOpen:We[Qe.MEDIA][Qe.SUB_TYPES.MSE_ADD_SB],mseAppend:We[Qe.MEDIA][Qe.SUB_TYPES.MSE_APPEND_BUFFER],mse_hijack:We[Qe.MEDIA][Qe.SUB_TYPES.MSE_HIJACK],eme_hijack:We[Qe.MEDIA][Qe.SUB_TYPES.EME_HIJACK],metaError:We[Qe.DEMUX][Qe.SUB_TYPES.MP4],muxError:We[Qe.REMUX][Qe.SUB_TYPES.FMP4],other:We[Qe.OTHER],waitTimeout:We[Qe.RUNTIME][Qe.SUB_TYPES.BUFFERBREAK_ERROR],waitTimeoutWithHidden:We[Qe.RUNTIME][Qe.SUB_TYPES.WAITING_TIMEOUT_ERROR],drm:We[Qe.DRM][Qe.SUB_TYPES.LICENSE]},di=Qe;class fi{constructor(e,t,n){let r=0,i=0;n&&n.range&&n.range.length>1&&(r=n.range[0],i=n.range[1]);const o=function(e){return hi[e]||e}(t);return{errorCode:o,errorType:e,errorMessage:(null==n?void 0:n.httpText)||(null==n?void 0:n.message),url:null==n?void 0:n.url,httpCode:t,version:ci,rangeStart:r,rangeEnd:i,ext:n,mediaError:{code:o,message:(null==n?void 0:n.httpText)||(null==n?void 0:n.message)}}}}class pi{constructor(e,t,n){return{errorCode:t,errorType:e,version:ci,errorMessage:n.msg,ext:n,mediaError:{code:t,message:n.msg}}}}const gi=[{range:[0,90],size:614400},{range:[90,120],size:819200},{range:[120,Number.MAX_VALUE],size:1024e3}];function mi(e,t,n){let r=n>51200?Math.min(n,t):t;if(!e)return r;for(let i=0;i=gi[i].range[0]&&e0?n:t);break}return r}const vi=function(){try{return typeof localStorage<"u"&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch{return!1}}()&&!function(){const e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch{return!0}}(),yi=bi(),_i=function(){if(vi)try{return!!window.localStorage.getItem("playertestlog")}catch{return!1}return!1}(),Ti={1:"debug",2:"log",3:"warn",4:"error"};function bi(){if(vi)try{return!!window.localStorage.getItem("playerlog")}catch{return!1}return!1}function Si(e,t,n,...r){const i=Ti[t];i&&e&&e[i]&&e[i](n,...r)}function ki(e="div",t="",n={},r=""){const i=document.createElement(e);return i.className=r,i.innerHTML=t,Object.keys(n).forEach((t=>{const r=t,o=n[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(r,o):i.setAttribute(r,o)})),i}function Pi(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function Mi(){try{return parseInt(performance.now(),10)}catch{return(new Date).getTime()}}function Ri(e,t){try{const n=e.indexOf("?");return n<0?Object.keys(t).forEach(((n,r)=>{e+=0===r?`?${n}=${t[n]}`:`&${n}=${t[n]}`})):Object.keys(t).forEach((r=>{n===e.length-1?e+=`${r}=${t[r]}`:e+=`&${r}=${t[r]}`})),e}catch{return e}}function wi(e,t){return Object.keys(t).forEach((n=>{const r=Pi(t[n]),i=Pi(e[n]);"Array"===r?("Array"!==i&&(e[n]=[]),e[n].push(...t[n])):"Object"===r?("Object"!==i&&(e[n]={}),wi(e[n],t[n])):e[n]=t[n]})),e}function xi(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch{return 0}}function Ei(e,t){const n=[];let r=0;e&&n.push(e),t&&n.push(t),n.every((e=>(e&&(r+=e.byteLength),!0)));const i=new Uint8Array(r);let o=0;return n.every((e=>(e&&(i.set(e,o),o+=e.byteLength),!0))),i}function Di(e,t,n){let r=null,i=null;return r=e3&&t[2]&&(n=t[2]),n}function Ci(e){let t,n=0;for(;n<10;)try{if(t=new Uint8Array(e),t&&t.byteLength>0)break;n++}catch{n<10?n++:console.error("repeat data cache new array failed final",10)}return t}const Li={playBtnClick:(e,t,n,r)=>{e.paused||e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),r.call(e,t,n)}},Oi={waiting:(e,t)=>{const{player:n,eventName:r}=e;n.waitingMoreBuffer=!0,t(r,e)},play:(e,t)=>{const{player:n,eventName:r}=e;n.waitingMoreBuffer||t(r,e)},pause:(e,t)=>{const{player:n,eventName:r}=e;n.waitingMoreBuffer||t(r,e)},seeking:(e,t)=>{const{player:n,eventName:r}=e;n.isSeekingStart=!0,t(r,e)},progress:(e,t)=>{Si(">>>>progress");const{player:n,eventName:r}=e;if(n.waitingMoreBuffer){const e=n.getBufferedRange(n.buffered2);0===e[0]&&0===e[1]||(void 0===n.inWaitingStart||n.isSeekingStart?(Si("progress startplay or seek ended"),e[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||e[1]>n.duration-1?(Si("progress out bufferWaterLevel"),n.play()):(Si("progress not out bufferWaterLevel"),n.emit("waiting"))):(Si("progress video waiting end"),e[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||e[1]>n.duration-1?(Si("progress out bufferWaterLevel"),n.play()):(Si("progress not out bufferWaterLevel"),n.emit("waiting"))))}t(r,e)},playing:(e,t)=>{const{player:n,eventName:r}=e;Si("playing");const i=n.getBufferedRange(n.buffered2);if(0===i[0]&&0===i[1])return Si("playing currentTime no buffer, not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),void t.call("waiting",e);void 0===n.inWaitingStart||n.isSeekingStart?(Si("playing startplay or seek ended"),i[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||i[1]>n.duration-1?(Si("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,n.isSeekingStart=!1,t(r,e)):(Si("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e))):(Si("playing video waiting ended"),i[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||i[1]>n.duration-1?(Si("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,t(r,e)):(Si("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e)))}};function Ai(e,t){return Math.round(8*e*1e3/t/1024)}function Gi(e){var t,n;return!((null==(t=null==e?void 0:e.message)?void 0:t.indexOf("Failed to fetch"))>=0||null!=e&&e.response&&(null==(n=e.response)?void 0:n.status)>=400&&e.response.status<=599)}function $i(e,t,n){e.video&&e.video.addEventListener(t,n)}function Bi(e,t,n){e.video&&e.video.removeEventListener(t,n)}function Ni(e){return e&&e.video&&"function"==typeof e.video.getStats?e.video.getStats():null}function Fi(e){const{kid:t,drmKeyToken:n,secretKey:r,keyValue:i,drm:o}=e;return t||n||r||i||o}function Ui(e){const{cachedBufferDur:t,loadTarDuration:n,loadDuration:r,forceSetMin:i}=e,{PCDNInBuffer:o,PCDNOutBuffer:s,loadSize:a}=e;return{buffer_dur:t||-1,load_tar_dur:n||-1,load_dur:r||-1,force_set_min:i,in_buf:o||-1,out_buf:s||-1,load_size:a||-1}}const Hi={"x-cache":"x_cache","x-response-sinfo":"server_ip","x-response-cinfo":"x-response-cinfo","content-range":"content-range","content-length":"content-length","content-type":"content-type"};function Vi(e){const t={};return!e||!e.get||Object.keys(Hi).forEach((n=>{const r=Hi[n];e.get(n)&&(t[r]=e.get(n))})),t}function ji(e){const t=Hi["content-range"];if(e&&e.get&&e.get(t)){const n=e.get(t).split("/");if(2===(null==n?void 0:n.length))return n[1]}return null}const zi="error",Xi="metaReady",Ki="moov_request_Progress",Qi="progress_event",Wi="updateEME",qi="init_MSE",Yi="chaneg_url",Ji="update_load_fragmentIdx",Zi="remove_pcdn_node",eo="load_error",to="cancel_loaded_len",no="load_len_not_match_error",ro="close",io="forbidden",oo={},so=class e extends rt{constructor(t,n,r,i=[],o){var s;super(),Kr(this,"markErrHost",(e=>{e&&(oo[e]=!0,this.log(Ne.WARN,"[mp4loader markErrHost]",e))})),Kr(this,"onprogressDataArrive",(async(e,t,n,r)=>{var i;const o=(null==(i=null==n?void 0:n.priOptions)?void 0:i.type)||Jr,s=this.adaptTimeRange[n.index].range;if(e&&e.byteLength>0?(!this._optionDataLenInfo[o]&&(this._optionDataLenInfo[o]=0),this._optionDataLenInfo[o]+=e.byteLength,this._receiveDataPos=null==n?void 0:n.range[1],s&&n.range[1]>s[1]&&!t&&(t=!0,this.log(Ne.LOG,"[onprogressDataArrive] receive data, check state set true >>> index,",n.index,",range,",JSON.stringify(n.range))),this.cacheRepeatData(this.adaptTimeRange[n.index].repeatRange,n.range,e),this.log(Ne.LOG,"[onprogressDataArrive] receive data, >>> index,",n.index,",range,",JSON.stringify(n.range),", dataLen,",e.byteLength,",loadType,",o,t),this._mux(e,n.range[0],n.index,t)):this.log(Ne.LOG,"[onprogressDataArrive] receive data null, >>> index,",n.index,",range,",JSON.stringify(n.range),", dataLen,",null==e?void 0:e.byteLength,",loadType,",o,t),t){this._optionDataLenInfo[o]=0;const e=Vi(r.headers);this.totalSize||(this.totalSize=function(e){try{const t=Object.keys(e).filter((e=>"content-range"===e));if(t.length>0){const n=e[t[0]].split("/");if(2===(null==n?void 0:n.length))return parseInt(n[1],10)}return 0}catch(e){return console.error(e),0}}(e));const t=s&&s.length>=0?Number(s[1]):0;if((null==s?void 0:s.length)>0&&(!t||t&&((null==n?void 0:n.range[1])===t+1||this.totalSize===t)))this.adaptTimeRange[n.index].downloaded=!0,this.log(Ne.LOG,"[FragLoadDowned],fragmentIdx,",n.index,",rangeEnd,",n.range[1]);else{await this.cancelLoading();const{startTime:t,endTime:i}=this.adaptTimeRange[n.index];this.emit(no,[t,i]);const a=o===Jr?this.url:this._pcdnNodeList[0].url,l=Ii(a);this.emit(eo,{src:a,host:l,errorCode:hi.contentError,message:"progress dataLen not match",range:JSON.stringify(s),headers:e}),this.log(Ne.LOG,"[FragLoadDowned check false, len is not match],fragmentIdx,",n.index,",rangeEnd,",n.range[1],JSON.stringify(s),JSON.stringify(e),a,null==r?void 0:r.url),await this.loadAllFragmentData(this._curLoadSegIdx,this._loadSuccessCallBack)}}})),this.timeRecord={startMuxTime:-1,startLoadTime:-1,newMP4Time:Mi(),startLoadMetaTime:-1},this.updateUrl(t,i||[]),this._bitRate=n||0,this.options=e.getDefaultConfig(),Object.keys(r).map((e=>{void 0!==r[e]&&null!==r[e]&&(this.options[e]=r[e])})),this.logger=r.logger,this.timeRange=[],this.adaptTimeRange=[],this.firstFrameTime=o||{},this.fileSize=null==r?void 0:r.fileSize,this.totalSize=0,this.CHUNK_SIZE=(null==(s=this.options)?void 0:s.firstLoadSize)||mi(r.duration,this.options.chunkSize,this.fileSize),this._firstLoadSize=this.CHUNK_SIZE,this.log(Ne.LOG,"[getFirstLoadSize], firstLoadSize ",this._firstLoadSize,",dur,",r.duration,",chunkSize,",this.CHUNK_SIZE,",fileSize,",this.fileSize),this._repeatInfo={startPos:-1,curDataPos:0,usedPos:0,data:Ci(1048576)},this.meta=null,this.preloadCache=null,this.videoTrak=null,this.audioTrak=null,this._loadSuccessCallBack=null,this._isPending=!1,this.metaLoading=!1,this.MP4Loader=new Ir({url:t,vid:`${r.vid}-${n}`,retry:r.retryCount||2,retryDelay:r.retryDelay||1e3,timeout:r.timeout||3e3,segmentDuration:r.segmentDuration,fixEditListOffset:r.fixEditListOffset,...r.reqOptions,loaderType:r.loaderType,retryCheckFunc:Gi,openLog:yi}),this.MP4Demuxer=null,this.FMP4Remuxer=null,this._needInitSegment=!0,this._bitRateInfoMap=new Map,this._switchBitRate=!1,this._segmentToBitRateMap=new Map,this.useEME=!1,this.secretKey=null,this.decryptKey=null,this.keyValue=null,this.initTransMuxWorker(),this.seekTime=-1,this.changeBitRateTime=-1,this._PCDNState=ro,this._pcdnNodeList=[],this.loadInfo={},this.pcdnTraceInfo=null,this._loadedDataState=!1,this._PCDNSwitchCnt=0,this._isUseCDN=!0,this._curLoadSegIdx=0,this._receiveDataPos=-1,this._optionDataLenInfo={},this._lastPCDNUrl="",this._lastTargetDur=0,this.pcdnVVStat=this.resetPCDNVVStat(),this.pSCCancelCnt=0,this._lastDemuxSampleIdxRange={video:0,audio:0},this._mediaEndTime=-1}static get pcdnDownLoadReqCnt(){const{pcdn_download_request_cnt:t,pcdn_download_failed_cnt:n}=e;return e.pcdn_download_request_cnt=0,e.pcdn_download_failed_cnt=0,{pcdn_download_request_cnt:t,pcdn_download_failed_cnt:n}}static getDefaultConfig(){return{onProcessMinLen:1024,xhrSetup:null,chunkSize:8e5,isCache:!1,playerId:"",vid:"",afterLoadeddataCallBackLen:0,ext:{}}}get size(){return this.fileSize}initTransMuxWorker(){}updateSecretKey(e,t,n,r){var i;this.useEME=e,!e&&t?(this.log(Ne.LOG,"[updateSecretKey] ,force enableWorker"),this.options.enableWorker=!0,this.transmuxerWorkerControl||this.initTransMuxWorker()):!e&&r&&(this.keyValue=r),this.log(Ne.LOG,"[updateSecretKey] ,useEME, ",e,",secretKey,",t,",decryptKey",n),null==(i=this.transmuxerWorkerControl)||i.updateValue({secretKey:t,decryptKey:n})}updateLoadedDataDone(){this._loadedDataState=!0}get PCDNSwitchCnt(){return this._PCDNSwitchCnt}updateLoadInfo(e,t){this.loadInfo||(this.loadInfo={}),this.loadInfo[e]||(this.loadInfo[e]={},this.loadInfo[e].loadLen=0),this.loadInfo[e].loadLen+=t}async updatePCDNState(e){if(this._PCDNState!==io&&this._PCDNState!==e&&this.log(Ne.LOG,"[pcdn state update]",this._PCDNState," - ",e),e===io)this._PCDNState=e;else if(this._PCDNState!==io&&this._PCDNState!==e){if(this._isUseCDN||e!==ro)this._PCDNState=e;else{if(this._PCDNState=e,this.adaptTimeRange[this._curLoadSegIdx].downloaded||this._switchBitRate)return void this.log(Ne.LOG,"[pcdn] switch cdn ",this._curLoadSegIdx,"downloaded",",switchBitRate, ",this._switchBitRate);await this.cancelLoading(),this.pSCCancelCnt++;const t=this._curLoadSegIdx;this.log(Ne.LOG,"[pcdn] cancelLoading ",t,"switch cdn load");const n=this.getFragRange(t);if(this._receiveDataPos&&this._receiveDataPos>=n[0]&&this._receiveDataPos<=n[1]){const e=n[0];n[0]=this._receiveDataPos,this.log(Ne.LOG,"[pcdn] switch cdn, adject range",t,JSON.stringify(n),",oldRange,",`${e} - ${n[1]}`)}this._receiveDataPos=-1,await this.startLoad(n,t)}this.log(Ne.LOG,"[pcdn] openPCDN ",e)}}updateNode(e){if(e&&e.length>0){const t=e.filter((e=>{if(!Object.prototype.hasOwnProperty.call(oo,Ii(null==e?void 0:e.url)))return e}));this._pcdnNodeList=t}}clearPCDNNodeList(){this.log(Ne.LOG,"[pcdn] clearPCDNNodeList"),this._pcdnNodeList=[]}get isUpdateNode(){return!this._pcdnNodeList||!this._pcdnNodeList.length}isUsePCDN(){var e;return"open"===this._PCDNState&&(null==(e=this._pcdnNodeList)?void 0:e.length)>0}async changeBitRate(e){e.bitrate!==this._bitRate&&(this.updateUrl(e._mainURL,e._backupURL),this._bitRate=e.bitrate,this._receiveDataPos=-1,await this.MP4Loader.changeUrl(this.url,`${this.options.vid}-${this._bitRate}`,this.CHUNK_SIZE),this._pcdnNodeList=null,this.emit(Yi,this.url),this._switchBitRate=!0,this._mediaEndTime=-1,this.log(Ne.LOG,"[switchBitrate] changeUrl, bitRate,",this._bitRate,"url",this.url))}_getByPreload(e,t,n,r){try{if(e&&e.byteLength>=t){const i={endTime:(new Date).getTime(),startTime:(new Date).getTime(),index:r,range:[],vid:this.options.vid,from:"local"};if(n<=e.byteLength){const r=e.slice(t,n);return i.range=[t,n],i.state=!0,{buffer:r,context:i,state:!0}}{const n=e.byteLength-1,r=e.slice(t,n);return i.range=[t,n],{context:i,buffer:r,state:!1}}}return null}catch(e){return console.error("[MP4] _getByPreload",t,n,e),null}}log(e,t,...n){const{options:r}=this,i=r&&r.vid?`[MP4]${this._logTag} ${r.vid} ${t}`:`[MP4]${this._logTag} ${t}`;Si(this.logger,e,i,...n)}async errorHandler(e,t,n={}){const{response:r,message:i}=e,o=this.options?this.options.vid:"";let s=null;if(this._isPending=!0,r){const a=Vi(r.headers);if(s=new fi("network",r.status,{httpText:r.httpText,message:i,url:r.url,range:n.range,headers:a}),this.log(Ne.LOG,`[MP4] [${o}] errorHandler error state:[${t}],\n _isPending:[${this._isPending}] `,null==r?void 0:r.status,i),this.backUrl&&this.backUrl.length>0){const r=this.backUrl.shift();if(this.updateUrl(r,this.backUrl),this.log(Ne.LOG,`[${o}] errorHandler start backUpUrl retry`,this.backUrl.length,r),this._isPending=!1,this.MP4Loader&&(await this.MP4Loader.changeUrl(this.url,`${this.url}-${this._bitRate}`,this.CHUNK_SIZE),this.emit(Yi,this.url)),this.emit(Qi,{type:"error",error:e}),"getMetaInfo"===t)return void this.getMetaInfo();if("loadFragment"===t){const{fragIndex:e,range:t}=n;if(null!==e&&e>=0&&t)return this.resetFragmentLoadState(e),void this.loadFragment(e,t)}}s.context=n,s.response=r,this.log(Ne.LOG,`errorHandler end, ${JSON.stringify(n)}`),this.emit(zi,s,t)}else this.log(Ne.LOG,`errorHandler other end, ${t},${null==r?void 0:r.status}, ${i}`),s=e,s.context=n,this.emit(zi,s,t)}async init(e){var t,n,r;this.url&&await this.MP4Loader.changeUrl(this.url,`${this.options.vid}-${this._bitRate}`,this.CHUNK_SIZE),this.emit(Yi,this.url),this.meta=null;const{meta:i,mediaSegList:o,buffer:s,fileSize:a,initSeg:l,bitrate:u,adaptTimeRange:c,repeatData:h}=e;if(i&&i.ext){a&&(this.fileSize=a),this.meta=i,this.videoTrak=i.ext.videoTrak,this.audioTrak=i.ext.audioTrak,this.meta.videoSamplesLen=this.videoTrak.reduce(((e,t)=>e+t.frames.length),0),this.meta.audioSamplesLen=this.audioTrak.reduce(((e,t)=>e+t.frames.length),0),this._bitRate=u,this.timeRange=this.getTimeRange(),this.adaptTimeRange=function(e){const t=[];if(!e||!e.length||0===e.length)return t;for(let n=0;n0&&(null==h?void 0:h.byteLength)>0&&this.cacheRepeatData(this.adaptTimeRange[0].repeatRange,this.adaptTimeRange[0].repeatRange,h)):s&&(null==(n=this.adaptTimeRange)?void 0:n.length)>0&&(null==s?void 0:s.byteLength)>0&&this.cacheRepeatData(this.adaptTimeRange[0].range,this.adaptTimeRange[0].range,s),this.adaptTimeRange.map((e=>{e.downloaded=!1,e.isLoading=!1}));for(let e=0;ee.length)for(let n=e.length;n{var a;if(o){await this.cancelLoading();const e=new pi(di.DEMUX,hi.metaError,{msg:JSON.stringify(o)});return void this.errorHandler(e,"getMetaInfo",{range:[0,this._firstLoadSize]})}!this.fileSize&&s&&(this.fileSize=Number(ji(s.headers)));const l=(null==(a=null==i?void 0:i.priOptions)?void 0:a.type)||Jr;if(n&&(this.cacheRepeatData([0,this._firstLoadSize],i.range,n),!this._optionDataLenInfo[l]&&(this._optionDataLenInfo[l]=0),this._optionDataLenInfo[l]+=n.byteLength),r&&this._optionDataLenInfo[l]&&(this._optionDataLenInfo[l]=0),i.meta&&!this.meta){this.firstFrameTime.metaload=Mi()-t;const n=i.meta;this.videoTrak=n.videoSegments,this.audioTrak=n.audioSegments,this.timeRange=this.getTimeRange();const r=this.videoTrak.reduce(((e,t)=>e+t.frames.length),0),o=this.audioTrak.reduce(((e,t)=>e+t.frames.length),0);this.meta={...n.meta,ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak},videoSamplesLen:r,audioSamplesLen:o,fileSize:this.fileSize},this._bitRateInfoMap.set(this._bitRate,n),this.log(Ne.LOG,"meta reach, bitRate,",this._bitRate,this._repeatInfo.curDataPos),e&&this.emit(Xi,this.meta)}if(this.meta&&r&&(this.log(Ne.LOG,"[getMetaInfo req end]",this._repeatInfo.curDataPos),this.metaLoading=!1),this._loadedDataState){let e=!1;this._repeatInfo.curDataPos-this._repeatInfo.usedPos>=this.options.afterLoadeddataCallBackLen&&(e=!0),this.meta&&(e||r)&&(this.log(Ne.LOG,"emit moov_req_progress loadeddata after",JSON.stringify(i.range)),this.emit(Ki))}else this.meta&&(n||r)&&(this.log(Ne.LOG,"emit moov_req_progress loadeddata before",JSON.stringify(i.range)),this.emit(Ki))},r=this._firstLoadSize-1;await this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,r],n)}catch(e){this.log(Ne.ERROR,"[MP4] trigger errorHandler getMetaInfo",null==(t=null==e?void 0:e.response)?void 0:t.status,null==e?void 0:e.message),this.loadError(e,"getMetaInfo",!1,{url:e.url||this.url,range:[0,this._firstLoadSize]})}}getFragmentIdx(e){let t,n;if(this.videoTrak.length){if(t=this.videoTrak.find((t=>t.startTime<=e&&t.endTime>e)),n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),t&&n)return Math.min(t.index,n.index);if(t||n)return t?t.index:n.index;{let e=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(e=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(e=Math.min(this.audioTrak.length-1,e)),e}}return n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),n?n.index:0}async _checkHasMeta(){var e,t,n,r;let i=this._bitRateInfoMap.get(this._bitRate);if(i)this.log(Ne.LOG,"[switchBitrate], not need load InitSegment, bitRate, ",this._bitRate),this.meta=i.meta;else{this.log(Ne.LOG,"[switchBitrate], need load InitSegment, bitRate, ",this._bitRate),this.metaLoading=!0;const r=await this.MP4Loader.loadMeta(this.MP4Loader.cache,Math.round(this.CHUNK_SIZE/2));this.log(Ne.LOG,"[switchBitrate], loadMeta end, ",this._bitRate),this.metaLoading=!1;const{videoTrak:o,audioTrak:s}=this,a=o.reduce(((e,t)=>e+t.frames.length),0),l=s.reduce(((e,t)=>e+t.frames.length),0),u=Number(ji(null==(n=null==(t=null==(e=null==r?void 0:r.responses)?void 0:e[0])?void 0:t.response)?void 0:n.headers));this.fileSize=u,this.log(Ne.LOG,"[switchBitrate], fileSize set , ",u),this.meta={...r.meta,ext:{videoTrak:r.videoSegments,audioTrak:r.videoSegments},videoSamplesLen:a,audioSamplesLen:l,fileSize:u},i=r,i.fileSize=u,this._bitRateInfoMap.set(this._bitRate,r)}this.videoTrak=i.videoSegments,this.audioTrak=i.audioSegments,this.fileSize=i.fileSize,this.emit(Wi,this.meta),this.emit(qi,this.meta),this.timeRange=this.getTimeRange();for(let e=0;e0){this.resetFragmentLoadState(e,!0),this.resetRepeatInfo();const t=this.getFragmentIdx(this.changeBitRateTime),n=e;if((e=this.getAdaptIdxBySrcIdx(t))<0)return void this.log(Ne.ERROR,"[switchBitrate] start new bitrate fragIndex error");n!==e&&this.resetFragmentLoadState(e),this._curLoadSegIdx=e;const r=this.adaptTimeRange[e];this.log(Ne.LOG,"[switchBitrate], need update load fragIndex",e,",oldFragIndex",n,",stTime,",this.changeBitRateTime,",newBitrateadaptTimeRange,",r.startTime,"-",r.endTime),this.emit(Ji,e),this.seekTime=this.changeBitRateTime,this.changeBitRateTime=-1}this.log(Ne.LOG,"[switchBitrate], reset adaptTimeRange state,",e),this._needInitSegment=!0,this.resetTansmuxer(),t&&(this._switchBitRate=!1)}if(this._switchBitRate&&this.metaLoading)return;const r=this.getFragRange(e);let i=this.getFragmentFromCache(e,r);if(i&&this._needInitSegment&&!i.initSeg&&(i=null,this.log(Ne.LOG,"[mp4.load], segment ,",e,"Data In Cache but not has init, so not use cacheData")),i){const{video:t,audio:n}=i.muxSampleIdxRange;this._lastDemuxSampleIdxRange.video=t,this._lastDemuxSampleIdxRange.audio=n,this.log(Ne.LOG,"[mp4.load], segment ,",e,"Data In Cache",JSON.stringify(r),", needInit,",this._needInitSegment,",muxSampleIdxRange,",JSON.stringify(i.muxSampleIdxRange));const o=this.adaptTimeRange[e];o.downloaded=!0,o.isLoading=!0,this._needInitSegment=!1,this._loadSuccessCallBack&&this._loadSuccessCallBack(i)}else if(this.log(Ne.LOG,"loadFragment,",e,",bitRate,",this._bitRate,",range,",JSON.stringify(r)),this.seekTime>0){const t=this.getSubRange(e,this.seekTime,r);null==(n=this.resetDemuxSampleIdx)||n.call(this,this.seekTime,t),this.loadFragment(e,t),this.seekTime=-1}else this.loadFragment(e,r)}getFragmentFromCache(e,t){const{preloadCache:n}=this;if(!n||!n.segList)return null;let r=-1;const{segList:i,initSeg:o}=n;for(let t=0;t=t[1]){const{startTime:r=0,endTime:i=0}=this.adaptTimeRange[e],s=[r,i];return{buffer:n.buffer,range:t,muxSampleIdxRange:n.muxSampleIdxRange,context:{range:t,fragIndex:e,state:!0,adaptTimeRange:[s[0],s[1]]},state:!0,initSeg:this._needInitSegment?o:void 0}}return null}}cacheRepeatData(e,t,n){var r;if(e&&null!=e&&e.length&&null!=(r=this._repeatInfo.data)&&r.byteLength&&(this._repeatInfo.startPos<0&&t[0]+n.byteLength>=e[0]&&t[0]+n.byteLength<=e[1]+1&&(this._repeatInfo.startPos=e[0]),this._repeatInfo.startPos>=0&&t[0]+n.byteLength>=e[0]&&t[0]+n.byteLength<=e[1]+1)){const r=this._repeatInfo.startPos+this._repeatInfo.curDataPos-t[0];if(r<0)return;const i=n.slice(r);if(this._repeatInfo.curDataPos+i.byteLength0?d[0].sampleOffset:-1,p=(null==d?void 0:d.length)>0?d[d.length-1].sampleOffset:-1,g=null==h?void 0:h.samples,m=(null==g?void 0:g.length)>0?g[0].sampleOffset:-1,v=(null==g?void 0:g.length)>0?g[g.length-1].sampleOffset:-1;let y;this.updateDemuxSampleIdxRange([f,p],[m,v]),this.log(Ne.LOG,"[mux],videoTimeRange,",null==c?void 0:c.startPts,"-",null==c?void 0:c.endPts,",videoSampleIdx",f,"-",p,",audioTimeRange,",null==h?void 0:h.startPts,"-",null==h?void 0:h.endPts,",audioSampleIdx",m,"-",v,n,JSON.stringify(l),r);const _=r||(null==d?void 0:d.length)>0?null==c?void 0:c.startPts:-1,T=r||(null==d?void 0:d.length)>0?null==c?void 0:c.endPts:-1,b=r||(null==g?void 0:g.length)>0?null==h?void 0:h.startPts:-1,S=r||(null==g?void 0:g.length)>0?null==h?void 0:h.endPts:-1,k=[Math.min(_,b),Math.max(T,S)];if(this.FMP4Remuxer){const e=this.FMP4Remuxer.remux(this._needInitSegment,{initMerge:!0,range:l});e.initSegment&&(this._needInitSegment=!1),y={buffer:Ei(e.audioSegment,e.videoSegment),range:l,state:r,context:{range:l,fragIndex:n,timeRange:k},initSeg:e.initSegment}}else y={videoTrack:c,audioTrack:h,buffer:null,range:l,state:r,context:{range:l,fragIndex:n,timeRange:k}};i.firstmux<0&&o.startMuxTime>0&&(i.firstmux=Mi()-o.startMuxTime),this._loadSuccessCallBack&&this._loadSuccessCallBack(y)}catch(r){const i=null==r?void 0:r.message;this.log(Ne.ERROR,"mux err:",i);const o=new pi(di.REMUX,hi.muxError,{msg:i});this.errorHandler(o,"mux",{fragIndex:n,range:[t,t+e.byteLength]})}}updateDemuxSampleIdxRange(e,t){(null==e?void 0:e[1])>=0&&(this._lastDemuxSampleIdxRange.video=e[1]),(null==t?void 0:t[1])>=0&&(this._lastDemuxSampleIdxRange.audio=t[1]),this.log(Ne.LOG,"updateDemuxSampleIdxRange",JSON.stringify(this._lastDemuxSampleIdxRange))}async loadFragment(e,t){this._curLoadSegIdx=e;const n=this.adaptTimeRange[e];if(this._isPending||0===(null==t?void 0:t[1])||!n||n.isLoading||0===(null==t?void 0:t.length))return;this._segmentToBitRateMap.set(e,this._bitRate),this.timeRecord.startLoadTime<0&&(this.timeRecord.startLoadTime=Mi());const{startPos:r,curDataPos:i}=this._repeatInfo,{usedPos:o}=this._repeatInfo;if(t.length>=2&&t[1]&&t[1]>0&&t[0]>=r&&t[1]=2&&t[0]&&t[0]>=r&&t[0]<=r+i){if(!n.isLoading){const s=Math.max(t[0],r+o),a=Math.min(t[1]+1,r+i),l=new Uint8Array(this._repeatInfo.data.slice(s-r,a-r));if(l.byteLength>0){this._repeatInfo.usedPos=a-this._repeatInfo.startPos;const n=this._repeatInfo.usedPos;return this.log(Ne.LOG,"[mp4.loadFragment] has part data: ",s,s+l.byteLength),this.log(Ne.LOG,"[mp4.loadFragment] ",",repeatInfo, startPos,",r,", usedPos,",r+n,",curDataPos, ",r+i),void this._mux(l,s,e,t[1]<=r+n)}if(!this.metaLoading&&!n.isLoading){this.log(Ne.LOG,"[mp4.loadFragment] load part data >>> ",r+i,t[1]),n.isLoading=!0;const s=[r+o,t[1]],a=null==n?void 0:n.repeatRange;if(a&&a[0]r)&&!n.isLoading&&(n.isLoading=!0,this.log(Ne.LOG,"[mp4.loadFragment],ready to load all data ,segmentIdx, ",e,",range >>> ",t),this.resetRepeatInfo(),await this.startLoad(t,e))}resetRepeatInfo(){this.log(Ne.LOG,", resetRepeatInfo"),this._repeatInfo.startPos=-1,this._repeatInfo.curDataPos=0,this._repeatInfo.usedPos=0}setSwitchPCDNCallBack(e){this._switchPCDNCallBack=e}updateChangeBitRateTime(e){this.changeBitRateTime=e}async startLoad(t,n,r=!1){var i,o,s,a;const{firstFrameTime:l}=this;0===n&&(null==l?void 0:l.first_gop_req_cnt)<0?l.first_gop_req_cnt=1:n>0&&(null==l?void 0:l.first_gop_req_cnt)<0&&(l.first_gop_req_cnt=0);const u=this.selectedPCDN(r),c=u||this.url;this.log(Ne.LOG,"[startLoad], ",n,JSON.stringify(t),c);try{await this.MP4Loader.loadData(t,this.MP4Loader.cache,{index:n,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen,url:c,headers:u?{"X-Origin-Server-Host":this._domain}:null,priOptions:{type:u?Zr:Jr}})}catch(r){const l=(null==(o=null==(i=null==r?void 0:r.options)?void 0:i.priOptions)?void 0:o.type)===Zr||!!u;let c=null;const h=r.url||(l?u:this.url);l?(this.pcdnVVStat.conn_fail_num++,e.pcdn_download_failed_cnt++,c=this._pcdnNodeList.shift(),this.emit(Zi,c),this.log(Ne.ERROR,"pcdn load err, retry use cdn,range",t,",fragIndex",n,(null==r?void 0:r.isTimeout)||(null==(s=null==r?void 0:r.response)?void 0:s.status),null==r?void 0:r.message,h),await this.startLoad(t,n,!0)):this.log(Ne.ERROR,"cdn load err,range",JSON.stringify(t),",fragIndex",n,(null==r?void 0:r.isTimeout)||(null==(a=null==r?void 0:r.response)?void 0:a.status),null==r?void 0:r.message,h),this.loadError(r,"loadFragment",l,{range:t,fragIndex:n,url:h})}}loadError(e,t,n,r){var i,o;!e.response&&(e.response={}),e.isTimeout?e.response.status=hi.timeout:null!=(i=null==e?void 0:e.response)&&i.status||(e.response.status=hi.networkError);const s=Ii(null==r?void 0:r.url);this.markErrHost(s),this.emit(eo,{src:null==r?void 0:r.url,host:s,errorCode:null==(o=null==e?void 0:e.response)?void 0:o.status,message:null==e?void 0:e.message,range:(null==r?void 0:r.range)&&JSON.stringify(r.range),headers:null==r?void 0:r.headers}),n||this.errorHandler(e,t,r)}async loadAllFragmentData(t,n,r,i=!1){var o,s,a,l,u,c;if(this.hasDestroyed)return;this.resetRepeatInfo();const h=(null==(o=this.adaptTimeRange[t])?void 0:o.range)||this.getFragRange(t);this._curLoadSegIdx=t;const d=this.selectedPCDN(i),f=Ri(d||this.url,{__rand:(new Date).getTime()});try{this.log(Ne.LOG,",[loadAllFragmentData], index,",t,",rang,",JSON.stringify(h),", use-pcdn,",!!d);const e=await this.MP4Loader.loadData(h,this.MP4Loader.cache,{index:t,url:f,headers:d?{"X-Origin-Server-Host":this._domain}:null,priOptions:{type:d?Zr:Jr}});if(this.log(Ne.LOG,"loadAllFragmentData after",t,JSON.stringify(h)),!e||!e.data){const e=new Error("response null");return void(r?r(e):this.loadError(e,"loadFragment",!!d,{range:h,fragIndex:t,url:d||this.url}))}const{data:i}=e;if((null==i?void 0:i.byteLength)>0&&h&&h.length>=2)this._receiveDataPos=h[0]+(null==i?void 0:i.byteLength),this._loadSuccessCallBack=n,this.adaptTimeRange[t].downloaded=!0,this.cacheRepeatData(this.adaptTimeRange[t].repeatRange,h,i),this._mux(i,h[0],t,!0);else{const n=Vi(null==(s=null==e?void 0:e.response)?void 0:s.headers);this.log(Ne.LOG,"[FragLoadDowned check false, retry load],fragmentIdx,",t,",dataLen,",null==i?void 0:i.byteLength,JSON.stringify(h),JSON.stringify(n),f);const r=new Error("dataLen not match");this.resetRepeatInfo();const o=this.adaptTimeRange[t];this.emit(no,[o.startTime,o.endTime]),this.loadError(r,"loadFragment",!!d,{range:h,fragIndex:t,url:f,headers:n})}}catch(i){const o=(null==(l=null==(a=null==i?void 0:i.options)?void 0:a.priOptions)?void 0:l.type)===Zr||!!d;o?(e.pcdn_download_failed_cnt++,this._pcdnNodeList.shift(),this.log(Ne.ERROR,"[loadAllFragmentData] ,pcdn load err, retry use cdn,fragIndex",t,i.isTimeout||(null==(u=null==i?void 0:i.response)?void 0:u.status),null==i?void 0:i.message),await this.loadAllFragmentData(t,n,r,!0)):this.log(Ne.ERROR,"[MP4] loadAllFragmentData error",{fragIndex:t,range:JSON.stringify(h)},i.isTimeout||(null==(c=null==i?void 0:i.response)?void 0:c.status),null==i?void 0:i.message),this.loadError(i,"loadFragment",o,{range:h,fragIndex:t,url:i.url||(o?d:this.url)})}}currentLoadUseUrl(){var e;return this._isUseCDN?this.url:(null==(e=this._pcdnNodeList)?void 0:e.length)>0?this._pcdnNodeList[0].url:""}getCurSwitchPCDNCnt(){return this._PCDNSwitchCnt}selectedPCDN(t){if(this._PCDNState===io||t)return void(this._isUseCDN=!0);let n;if(this.isUsePCDN()){if(this._isUseCDN){if(this._switchPCDNCallBack){const e=this._switchPCDNCallBack();e>0&&(this.options.switchPCDNMaxCnt=e)}if(this._PCDNSwitchCnt>=this.options.switchPCDNMaxCnt)return this._isUseCDN=!0,this.log(Ne.LOG,"cdn switch pcdn outlimit, curSwitchCnt ,",this._PCDNSwitchCnt,",maxCnt,",this.options.switchPCDNMaxCnt),null;this._PCDNSwitchCnt++,this.log(Ne.LOG,"cdn switch pcdn, curSwitchCnt,",this._PCDNSwitchCnt,",maxCnt,",this.options.switchPCDNMaxCnt)}this._isUseCDN=!1,n=Ri(this._pcdnNodeList[0].url,{__vid:this.options.vid}),this._lastPCDNUrl!==n&&(this.emit(Yi,n),this._lastPCDNUrl=n,this.pcdnVVStat.conn_req_num+=1),e.pcdn_download_request_cnt++}else this._isUseCDN||(this.log(Ne.LOG,"pcdn switch cdn PCDNSwitchCnt,",this._PCDNSwitchCnt,",maxCnt,",this.options.switchPCDNMaxCnt),this.pcdnVVStat.conn_jump_num+=1),this._isUseCDN=!0;return n}async cancelLoading(){this.MP4Loader&&await this.MP4Loader.cancel(),this._optionDataLenInfo[Zr]&&this._optionDataLenInfo[Zr]>0&&(this.emit(to,{load_type:Zr,len:this._optionDataLenInfo[Zr]}),this._optionDataLenInfo[Zr]=0),this._optionDataLenInfo[Jr]&&this._optionDataLenInfo[Jr]>0&&(this.emit(to,{load_type:Jr,len:this._optionDataLenInfo[Jr]}),this._optionDataLenInfo[Jr]=0)}updateUrl(e,t){const n=Ii(e);this._defaultDomain||(this._defaultDomain=n),n.indexOf("www.")<0?this._domain=n:this._domain=this._defaultDomain,this.url=e,this.backUrl=t||[]}getDataBitRate(e){return this._segmentToBitRateMap.get(e)}checkCodecH265(){return this.meta&&(this.meta.videoCodec.indexOf("hvc1")>-1||this.meta.videoCodec.indexOf("hev1")>-1)}checkCodecH266(){return this.meta&&this.meta.videoCodec.indexOf("bvc2")>-1}destroy(){this.hasDestroyed||(this.resetTansmuxer(),this.transmuxerWorkerControl&&this.transmuxerWorkerControl.destroy(),this.fileSize=0,this.totalSize=0,this._isPending=!1,this.metaLoading=!1,this.resetRepeatInfo(),delete this._repeatInfo.data,this._bitRateInfoMap.clear(),this._segmentToBitRateMap.clear(),this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy()),this.removeAllListeners(),this.hasDestroyed=!0,this.pcdnVVStat=this.resetPCDNVVStat())}resetPCDNVVStat(){return{try_req_node:0,req_node_succ:0,has_ret_node:0,conn_req_num:0,conn_fail_num:0,conn_jump_num:0}}resetTansmuxer(){var e;null==(e=this.resetDemuxSampleIdx)||e.call(this),this.MP4Demuxer&&this.MP4Demuxer.reset(),this.MP4Demuxer=null,this.FMP4Remuxer&&this.FMP4Remuxer.reset(),this.FMP4Remuxer=null,this.transmuxerWorkerControl&&this.transmuxerWorkerControl.reset()}getMediaEndTime(){if(this._mediaEndTime>0)return this._mediaEndTime;const{videoTrak:e,audioTrak:t}=this;if((null==e?void 0:e.length)>0){const{endTime:t}=e[e.length-1];this._mediaEndTime=this._mediaEndTime<0?t:Math.min(t,this._mediaEndTime)}if((null==t?void 0:t.length)>0){const{endTime:e}=t[t.length-1];this._mediaEndTime=this._mediaEndTime<0?e:Math.min(e,this._mediaEndTime)}return this._mediaEndTime}};Kr(so,"pcdn_download_request_cnt",0),Kr(so,"pcdn_download_failed_cnt",0);let ao=so;class lo extends ao{constructor(e,t,n,r=[],i,o){super(e,t,n,r,i,o),this._logTag=`${o}_${ri}`}updateAdaptTimeRange(e,t){this._lastTargetDur=t;const n=this.adaptTimeRange;for(let r=0;r=i[0]&&e0?n[n.length-1].timeRangeIdx[1]:0;if(r>=this.timeRange.length)return n.length-1;for(;r=(null==(n=this.adaptTimeRange[r-1])?void 0:n.timeRangeIdx[1])){const t=this._lastTargetDur||5;this.updateAdaptTimeRange(e,t)}for(let t=0;t=n[0]&&et.startTime<=e&&t.endTime>e)),n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),t&&n)return Math.min(t.index,n.index);if(t||n)return t?t.index:n.index;{let e=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(e=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(e=Math.min(this.audioTrak.length-1,e)),e}}return n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),n?n.index:0}resetFragmentLoadState(e,t=!1){this.log(Ne.LOG,", resetFragmentLoadState, fragIndex, ",e,",changeBitrate,",t);for(let n=0;n=this.timeRange.length){this.log(Ne.WARN,"fix adaptTimeRange fragIndex",e," ,timeRangeIdx[0] >= this.timeRange.length, so end",t[0],this.timeRange.length,",endFragment,",n),this.adaptTimeRange=this.adaptTimeRange.slice(0,n);break}t[1]>=this.timeRange.length&&(this.log(Ne.WARN,"fix adaptTimeRange fragIndex",e," ,timeRangeIdx[1],",t[1],">>>>",this.timeRange.length,",endFragment,",n),t[1]=this.timeRange.length,this.adaptTimeRange=this.adaptTimeRange.slice(0,n+1)),this.adaptTimeRange[n].startTime=this.timeRange[t[0]].startTime,this.adaptTimeRange[n].endTime=t[1]>=this.timeRange.length?this.timeRange[this.timeRange.length-1].endTime:this.timeRange[t[1]].endTime,this.adaptTimeRange[n].range=this.getFragRange(n)}}calculateRange(e){let t=null,n=null,r=null,i=null;const o=e1&&r[0]r[0]&&(this.adaptTimeRange[e].repeatRange=[r[0],n[1]])}}return n}getSubRange(e,t,n){const r=this.adaptTimeRange[e].timeRangeIdx;let i=r[0];for(let e=r[0];e=this.timeRange[e].startTime&&t>>>>getSubRange finalRange ",JSON.stringify(o),",oldRange,",JSON.stringify(n)),o}getSrcFragRange(e){let t=null,n=null;this.log(Ne.LOG,"getFragRange, timeRangeIdx, srcFragment,",JSON.stringify(e));const r=this.videoTrak;r&&(t=e0||n>0}function co(){return!!navigator.requestMediaKeySystemAccess&&!function(){const e=/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent),t=uo(),n=function(){const{mimeTypes:e}=navigator,t=navigator.userAgent;let n=!1;return e&&t.indexOf("Chrome")>1&&(n=Object.keys(e).some((t=>!!(e[t].type&&e[t].type.indexOf("360")>-1||e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1||e[t].description&&e[t].description.indexOf("360")>-1)))),n}(),r=navigator.userAgent.indexOf("Firefox")>0,i=navigator.userAgent.indexOf("Edge")>0;return e||t||n||r||i}()}function ho(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){console.log(e)}return!1}function fo(){const e=window.MediaSource=window.MediaSource||window.WebKitMediaSource;return e&&"function"==typeof e.isTypeSupported}class po{constructor(){let e,t;const n=new Promise(((n,r)=>{e=n,t=r}));return n.id=`${(new Date).getTime()}_${parseInt(100*Math.random())}`,n.resolve=function(t){e(t),n.state="fulfilled"},n.reject=function(e){t(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}resolve(e){}reject(e){}}class go extends Qt{init(){return Promise.resolve()}preloadPredict(e){return e}}const mo="h264";function vo(e){let{mediaType:t,definition:n,codecType:r,vtype:i}=e;const{vid:o}=e;return t=t||"video",n=n||"-1",r=r||mo,i=i||Wt.MP4,o?`${o}#${t}#${r}#${i}#${n}`:null}function yo(e,t){return function(e,t){let n=-1;for(let r=0;r=0}function _o(e,t){for(let n=0;n=0}const{PRELOAD_TYPES:bo}=Rt,So="preload_ended";let ko=0,Po=!0,Mo=null;class Ro extends Kt{constructor(e,t){var n;const r=Ro.getDefaultConfig(e);Object.keys(e).forEach((t=>{r[t]=e[t]})),super(r),Kr(this,"_updateRealTimeSpeed",(e=>{ko=e.speed,this.emit(Wr,e)})),this.video=null,this._mp4=null,this._pendingPromise=null,this.playerId=t.playerId||"default",this._nextPreloadCount=0,this.isActive=!0,this.MP4Loader=null,this.playingVids=[],this.playingVids1=[],this.loadingCount=0;const{logCacheLevel:i,logMaxSize:o}=this.options.logCacheConfig;this.logger=new Ue("[Mp4Preloader]",{logCacheLevel:i,logMaxSize:o}),void 0===e.supportHevc&&!(typeof MediaSource>"u"||!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"'))&&(this.options.supportHevc=!0),this.loadRangeType=(null==(n=this.options)?void 0:n.loadRangeType)||ri,Si(Ne.DEBUG,"[Preloader] new preloader, playerId",this.playerId),this.update({preloadMaxCacheCount:this.options.preloadMaxCacheCount})}static get PRELOAD_TYPES(){return bo}static get BitRateAdapter(){return Mo}static set BitRateAdapter(e){Mo=e}static getDefaultConfig(){return{supportHevc:!1,preloadTime:5,preloadSize:0,preloadType:0,segmentMinDuration:5,vtype:"MP4",codecType:"h264",preloadCacheType:1,preloadMaxCacheCount:5,globalKey:null,autoPreload:!1,reqOptions:null,getRequestOptionsCallback:null,minBufferLength:5,timeout:3e3,autoCheck:{enable:!0,interval:1e3},logCacheConfig:{logCacheLevel:2,logMaxSize:204800},pcdnConfig:{openPreloadPCDN:!1,enterMinBuffer:10,outMaxBuffer:5,pcdn_duration:2,pcdn_open:!0,openPCDN:!0,minDuration:25,trackerUrl:""},switchPCDNMaxCnt:2,retryCount:1,retryDelay:1e3,loaderType:"fetch"}}static registerPreloader(e,t){return e.vtype=Wt.MP4,Ro.BitRateAdapter=t,new Ro(e,this)}static getInfoByUniqueKey(e){return function(e){const t=e.split("#"),n=["vid","mediaType","codecType","vtype","definition"],r={};return t.forEach(((e,t)=>{r[n[t]]=e})),r}(e)}static generateUniqueKey(e){return vo(e)}static disable(){Po=!1}static enable(){Po=!0}set codecType(e){this.options.codecType=e}get codecType(){return this.options.codecType}get vtype(){return this.options.vtype}log(e,t,...n){Si(this.logger,e,t,...n)}update(e){Object.keys(e).forEach((t=>{this.options[t]=e[t]})),this.preloadManager.setMaxCache?this.preloadManager.setMaxCache(this.options.preloadMaxCacheCount):this.preloadManager._cacheInst._maxCache=this.options.preloadMaxCacheCount}get currentPreloadInst(){return this.preloadManager._currentPreloadInst}startCheckTask(){this.preloadManager.startCheckTask()}stopCheckTask(){this.preloadManager.stopCheckTask()}getPreloadMetaByVid(e){const{allCachedKeys:t,allCachedTimeKeys:n}=this;return function(e,t,n){const r=[];let i="";Object.keys(t).forEach((t=>{const n=function(e){if(!e)throw new Error(`key ${e} is empty`);const t=e.split("#");if(t.length<5)throw new Error(`key ${e} is not right format`);return{vid:t[0],mediaType:t[1],codecType:t[2],vtype:t[3],definition:t[4],order:-1,timeStamp:0,total:0}}(t);n.vid===e&&(r.push(n),i=t)}));let o=null;if(i){const e=function(e){const t=[];return Object.keys(e).forEach((n=>{t.push(Number(e[n]))})),t.sort(((e,t)=>e-t))}(n),t=Number(n[i]),s=function(e,t){for(let n=0;n0?r[0]:t;e.push({vid:i,bw:(null==n?void 0:n.bw)||0,pbw:(null==n?void 0:n.pbw)||0})}return e}generateUniqueKey(e){return vo(e)}addPlayingItem(e,t){const n=this.checkPlaying("_playerId",e);n>-1?this.playingVids[n].vid=t:this.playingVids.push({vid:t,_playerId:e}),this.log(Ne.LOG,"addPlayingItem",n,e,t,this.playingVids)}delPlayingItem(e){const t=this.checkPlaying("_playerId",e);this.log(Ne.LOG,"delPlayingItem",t,e,this.playingVids),t>-1&&this.playingVids.splice(t,1)}checkPlaying(e,t){const n=this.playingVids;for(let r=0;rthis.checkIfCanPreload(),start:e=>{const t=e.payload||[];if(0===t.length)return Promise.reject(new Error("preload_is_null"));const{vid:n}=e;let r=e.vtype||Wt.MP4,i=e.codecType||mo;const o=this.getUserSelectDefinition(),s=this.checkCacheKey(n,t,o,r,i);if(this.log(Ne.LOG,`${this.playerId} ${n}`,`codecType:${i} vtype:${r} hasCache:${s}`),s||"MP3"===r)return Promise.reject(new Error(`vtype_${r}`));const a=this.getInitDefinition(t,this.options.definition,o);if(this.log(Ne.LOG,` ${this.playerId} ${n} getInitDefinition`,null==a?void 0:a.definition),!a)return Promise.reject(new Error("definition_error"));const{definition:l,orgDefinition:u}=a,c=a.vtype||r,h=a.codecType||i,d=e.preloadTime||this.options.preloadTime,f=e.preloadSize||this.options.preloadSize||Math.pow(25,4)-1,p=this.generateUniqueKey({vid:n,definition:l,vtype:c,codecType:h});this._nextPreloadCount>0&&this._nextPreloadCount--,Si(Ne.LOG,`${n} start duration:${a.duration} preloadTime:${d} cacheKey:${p},playerId:${this.playerId}`);const g={vid:n,definition:l,orgDefinition:u,preloadTime:d,preloadSize:f,cacheKey:p,codecType:h,vtype:c,...a};return e.reqOptions&&(g.reqOptions=e.reqOptions),this.loadingCount++,this.log(Ne.LOG,`start preload,${n} loadingCount:${this.loadingCount},playerId:${this.playerId}`),this.start(g)},onRequest:({url:e,range:t,extData:n},r)=>this.getData(e,t,n,r)},this.loggerConfig={logger:()=>{},openLog:!1},this.predictInst=new go(this.loggerConfig)}start(e){const t={mediaInfos:{dynamic_video_list:[],dynamic_audio_list:[]},onObtain:()=>{const e=new po;return e.resolve(t.mediaInfos),e},onTransform:()=>{const t=new po;this._pendingPromise=t;const{preloadType:n}=this.options;return this.emit("preload_start",{...e,type:n}),n===bo.DURATION?this.loadByPreloadTime(e,t):this.loadByChunkSize(e,t),t}};return Promise.resolve(t)}getInitDefinition(e,t,n=null){let r=null;return Ro.BitRateAdapter?(r=Ro.BitRateAdapter.select(e,this.codecType,this.vtype),this.log(Ne.DEBUG,"Mp4Preloader.BitRateAdapter",null==r?void 0:r.type,null==r?void 0:r.definition,null==r?void 0:r.bitrate)):r=function(e,t){let n=null;if(!e||e.length<1)return n;for(let r=0;r{if(this.log(Ne.DEBUG,"[Preloader] getPreLoadData",!!e.value),e.value){const{mediaSegList:n,meta:r,type:i,buffer:o,preloadTime:s,vid:a,cacheKey:l,definition:u,orgDefinition:c,byteLength:h,duration:d,fileSize:f,from:p,vtype:g,codecType:m,initSeg:v,bitrate:y,adaptTimeRange:_,repeatData:T,memory:b}=e.value,S={vid:a,type:i,vtype:g,codecType:m,definition:u,orgDefinition:c,bitrate:y,cacheKey:l,duration:d||0,byteLength:h,from:p,adaptTimeRange:_,repeatData:T,memory:b,meta:r,preloadTime:s};i===bo.SIZE?(S.buffer=o,S.fileSize=f||0):(S.mediaSegList=n,S.fileSize=f||0,S.initSeg=v),t.resolve(S)}else t.resolve(null)})).catch((e=>{t.reject(e)})),t}async setPreLoadData(e,t){var n,r;const i=new po,{mediaSegList:o,meta:s,vid:a,definition:l,orgDefinition:u,type:c,buffer:h,duration:d,byteLength:f,preloadTime:p,fileSize:g,from:m,vtype:v,codecType:y,initSeg:_,bitrate:T,adaptTimeRange:b,repeatData:S}=t,k={codecType:y,vtype:v,vid:a,definition:l,orgDefinition:u,cacheKey:e,type:c,from:m,meta:s,fileSize:g,adaptTimeRange:b,repeatData:S,bitrate:T,memory:0};if(k.memory+=(null==S?void 0:S.byteLength)||0,c===bo.SIZE)k.buffer=h,k.byteLength=f||0,k.preloadSize=f||0,k.preloadTime=p||0,k.fileSize=g,k.buffer&&k.buffer.byteLength>0&&(k.memory+=(null==h?void 0:h.byteLength)||0,this.setItem(e,k),i.resolve(!0));else if(k.mediaSegList=[],k.duration=d,k.byteLength=f||0,k.preloadTime=p||0,k.initSeg=_,k.memory+=(null==_?void 0:_.byteLength)||0,k.fileSize=g,o.forEach((e=>{var t;k.memory+=(null==(t=null==e?void 0:e.buffer)?void 0:t.byteLength)||0,k.mediaSegList.push(e)})),s&&0===o.length)this.log(Ne.LOG,"[Preloader] meta setPreLoadData1 success",e,null==(n=null==k?void 0:k.mediaSegList)?void 0:n.length),this.setItem(e,k),i.resolve(!0);else{const t=o.every((e=>!!e.buffer&&e.state));this.log(Ne.LOG,"[Preloader] mediaSegList setPreLoadData1 success",e,null==(r=null==k?void 0:k.mediaSegList)?void 0:r.length,t),t||i.resolve(!1),this.setItem(e,k).then((()=>{this.log(Ne.LOG,"[Preloader] setPreLoadData1 success",e)})),i.resolve(!0)}return i}getInitCacheData(e,t){const n={type:e,meta:null,byteLength:0,fileSize:0,bitrate:0,preloadTime:0};return e===bo.DURATION?(n.mediaSegList=[],n.initSeg=null,n.duration=0):n.buffer=null,Object.keys(t).map((e=>{n[e]=t[e]})),n}updatePreCacheData(e,t,n,r,i,o,s,a,l){const{mediaSegList:u,type:c}=e;if(c===bo.SIZE||-1===i)return e.buffer=qt(Uint8Array,e.buffer.buffer||[],new Uint8Array(t)),e;let h=-1;for(let e=0;e-1)t&&(u[h].buffer=qt(Uint8Array,u[h].buffer||[],new Uint8Array(t))),n.length>1&&(u[h].range.length>1?u[h].range[1]=n[1]:u[h].range=n),-1!==s[1]&&(r=u[h].range[1]>=s[1]),u[h].state=r;else{const{video:l,audio:c}=a;e.duration=d[1],u.push({buffer:t,range:n||[],index:i,totalRange:s||[],timeRange:[d[0],d[1]],muxSampleIdxRange:{video:l,audio:c},state:r});const h=`${null==t?void 0:t.byteLength},${JSON.stringify(n)},${i},${JSON.stringify(s)},${JSON.stringify(o)}`;this.log(Ne.DEBUG,`[Preloader] ${e.cacheKey} mediaSegList set, dataLen`,h)}return r&&(e.byteLength+=n[1]-n[0],e.preloadTime+=l),r}checkCacheKey(e,t,n,r=Wt.MP4,i=mo){const o=this.getPreloadMetaByVid(e);if(o)return this.generateUniqueKey(o);if(n){const t=this.generateUniqueKey({vid:e,definition:n,vtype:r,codecType:i});return this.hasItemSameVid(t)?t:null}for(let n=0;n=1||!this.isActive)return e=!1,e;if(this.video){const{minBufferLength:t,startPreloadControl:n,startPreloadMinBuffer:r,startPreloadMinPosTime:i}=this.options;e=function(e,t){if(!e)return!1;const n=function(e,t){const n=[0,0];if(e)for(let r=0,i=e.length;ri){if(e.currentTime>o)return!0;if(e.currentTime>e.duration/2)return!0}else if(e.currentTime+i+1>e.duration&&e.currentTime+t>e.duration-1)return!0}else{const t=e.duration>s+5?s:e.duration/2,r=Math.min(e.currentTime+s,e.duration),i=n[1]-r;if(e.currentTime>t&&(i>0||Math.abs(i)<1))return!0}return!1}(this.video,{startPreloadControl:n,startPreloadMinBuffer:r,startPreloadMinPosTime:i,minBufferLength:t})}else e=this._nextPreloadCount>0;return Si(Ne.DEBUG,"[Preloader] checkIfCanPreload",!!this.video,`nextPreloadCount:${this._nextPreloadCount} ret:${e}`),e}startPreloadNext(e=1){let t=!0;return this._nextPreloadCount=e,(this.loadingCount>=1||!this.isActive)&&(t=!1),t&&this.preloadNext(),t}get realTimeSpeed(){return ko}getRequestOption(e){const{getRequestOptionsCallback:t,reqOptions:n}=this.options;let r=null;return r=e.reqOptions?e.reqOptions:"Function"===Pi(t)?t(e):n,r||{}}loadByPreloadTime(e,t){var n;const{vid:r,cacheKey:i,preloadTime:o,definition:s,orgDefinition:a,duration:l,bitrate:u}=e,{codecType:c,vtype:h,size:d}=e;let f="Array"===Pi(e.url)?e.url[0].src:e.url;if(!f)return void this._endLoadFragments();f=Ri(f,{__vid:r});const{segmentMinDuration:p}=this.options,g=o>=p?p:o,m=this.getRequestOption({...e,url:f});this.log(Ne.DEBUG,"[Preloader] loadByPreloadTime",`${e.cacheKey}, definition:${e.definition},segmentMinDuration:${g}`);const v=d||xi(u,l),y=null==(n=null==e?void 0:e.pktOffsetMap)?void 0:n.find((e=>{var t;return(null==e?void 0:e.time)===((null==(t=this.options)?void 0:t.firstLoadTimePos)||5)})),_=null==y?void 0:y.offset;this._mp4=new lo(f,u,{segmentDuration:g,codecType:this.codecType,chunkSize:this.options.preloadSize,firstLoadSize:_,duration:l,fileSize:v,playerId:this.playerId,vid:r,useUrlRange:!1,retryCount:1,retryDelay:1e3,supportHevc:this.options.supportHevc,retryCheckFunc:Gi,switchPCDNMaxCnt:Number.MAX_VALUE,logger:this.logger,reqOptions:m,fixEditListOffset:this.options.fixEditListOffset},[],this.firstFrameTime,"[Preloader]");const T=this.getInitCacheData(bo.DURATION,{vid:r,definition:s,orgDefinition:a,cacheKey:i,codecType:c,vtype:h,bitrate:u||0});this._mp4.once("metaReady",(async n=>{var o;const s=this._mp4;s&&(this.log(Ne.DEBUG,`[Preloader] ${r} metaReady ${null==(o=null==T?void 0:T.mediaSegList)?void 0:o.length}`),T.meta=n,T.from=2,T.fileSize=s.size,await s.cancelLoading(),!s.hasDestroyed&&(s.metaLoading=!1,this.emit("prf_meta_ready",{...T}),await this.setPreLoadData(i,T),!s.hasDestroyed&&this.startLoadByFragments(T,e,t)))})),this._mp4.on(zi,(e=>{this.log(Ne.ERROR,`[Preloader] ${r} loadByPreloadTime error`),this._endLoadFragments(),this.emit("error",e)})),this._mp4.on(to,(e=>{this.bwEventEmit(r,e.load_type,e.len,null,i)})),this._mp4.MP4Loader.on(Wr,(e=>{var t;if((null==e?void 0:e.len)>0){const n=(null==(t=null==e?void 0:e.priOptions)?void 0:t.type)||Jr,o=Ai(e.len,e.time);this.bwEventEmit(r,n,e.len,o,i)}})),this._mp4.init({})}bwEventEmit(e,t,n,r,i){const o=ti.get(i)||{bw:0,pbw:0};(!t||t===Jr)&&(o.bw=o.bw+n,this.emit("prf_data_size",{vid:e,task_type:2,cdn_size:n,cdn_speed:r})),ti.set(i,o),this._updateRealTimeSpeed({speed:r,type:t||Jr})}async loadByChunkSize(e){var t;const{vid:n,cacheKey:r,definition:i,orgDefinition:o,duration:s,bitrate:a,codecType:l,vtype:u,size:c}=e,{options:h}=this;let d="Array"===Pi(e.url)?e.url[0].src:e.url;if(!d)return void this._endLoadChunk();d=Ri(d,{__vid:n});const f=c||xi(a,s),p=null==(t=null==e?void 0:e.pktOffsetMap)?void 0:t.find((e=>(null==e?void 0:e.time)===((null==h?void 0:h.firstLoadTimePos)||5))),g=null==p?void 0:p.offset,m=mi(s,8e5,f);this.log(Ne.LOG,`${n} loadByChunkSize`,e.cacheKey,e.definition,g||m);const v=this.getInitCacheData(bo.SIZE,{vid:n,definition:i,orgDefinition:o,cacheKey:r,codecType:l,vtype:u,fileSize:c,bitrate:a||0}),y=this.getRequestOption({...e,url:d});this.MP4Loader=new Ir({url:d,vid:`${n}-${a}`,retry:h.retryCount||2,retryDelay:h.retryDelay||1e3,timeout:h.timeout||3e3,...y,loaderType:h.loaderType,retryCheckFunc:Gi,openLog:bi(),fixEditListOffset:h.fixEditListOffset}),this.MP4Loader.on(Wr,(e=>{var t;if((null==e?void 0:e.len)>0){const i=(null==(t=null==e?void 0:e.priOptions)?void 0:t.type)||Jr,o=Ai(e.len,e.time);this.bwEventEmit(n,i,e.len,o,r)}}));try{let e=new Uint8Array(0),t=0,i=null,o=null;const s=async(s,a,l,u,c)=>{var h;if(v.fileSize||(v.fileSize=Number(ji(c.headers))),s&&l.range&&l.range[0]===t&&(e=qt(Uint8Array,e,new Uint8Array(s)),t+=s.byteLength),l.meta){await this.MP4Loader.cancel();const u=(null==(h=null==s?void 0:s.priOptions)?void 0:h.type)||Jr;this.bwEventEmit(n,u,e.byteLength,null,r);const c=l.meta,f=c.videoSegments,p=c.audioSegments;o={...c.meta,ext:{videoTrak:f,audioTrak:p}},v.meta=o,i=Di(0,f,p),v.buffer=e.slice(i[0]),v.byteLength=v.buffer.byteLength;const g=Di(1,f,p);let m=[];g[0]g[0]&&(m=[g[0],i[1]]);const y=(null==f?void 0:f.length)>0?f:p,{startTime:_}=y[0],{endTime:T}=y[0],b={startTime:_,endTime:T,range:[...i],repeatRange:m,duration:T-_,downloaded:!1,isLoading:!1,timeRangeIdx:[0,1]};v.adaptTimeRange=[b],this.log(Ne.LOG,`${n} loadMetaProcess ret`,r,e.byteLength,JSON.stringify(i),v.buffer.byteLength,JSON.stringify(m)),this.setPreLoadData(r,v);const S=[t,i[1]];this.log(Ne.LOG,`${r} loadMetaProcess end, loadOneChunk start`,a,JSON.stringify(S),t,e.byteLength),this._loadOneChunk(v,S,d,b.duration)}};await this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,g||m],s)}catch(e){console.error(`[Preloader] ${r} loadByChunkSize error`,e),this._endLoadChunk()}}async _loadOneChunk(e,t,n,r){if((null==t?void 0:t.length)>0&&t[0]>=t[1])return this._endLoadChunk(),void this.emit(So,e);const i=n,{vid:o,cacheKey:s,buffer:a}=e;try{const n=await this.MP4Loader.loadData(t,this.MP4Loader.cache,{index:0,url:i,priOptions:{}});this.log(Ne.LOG,`${o} _loadOneChunk`,JSON.stringify(t),s);const{response:l,data:u}=n;if(u){if(this._endLoadChunk(),l&&l.headers){const t=xi(l.headers);t&&(e.fileSize=t)}e.buffer=Ei(a,u),e.byteLength=e.buffer.byteLength,e.preloadTime+=r,this.log(Ne.LOG,`${o} _loadOneChunk ret`,s,e.buffer.byteLength,null==u?void 0:u.byteLength),e.from=4,this.setPreLoadData(s,e)}else this._endLoadChunk()}catch(e){this.log(Ne.ERROR,`[Preloader] ${o} loadByChunkSize error`,null==e?void 0:e.message),this._endLoadChunk()}}_endLoadChunk(){this.log(Ne.LOG,`_endLoadChunk loadingCount:${this.loadingCount}`,this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy(),this.MP4Loader=null)}getAdaptRanges(e,t){const{timeRange:n}=e;for(let r=0;r{this.log(Ne.ERROR,`[Preloader] ${r} _failedCallback error`,null==e?void 0:e.message),this.emit("error",e),this._endLoadFragments()},s=async t=>{var n;if(!this._mp4)return;const{buffer:r,context:a,state:l,initSeg:u}=t,{fragIndex:c,range:h,timeRange:d}=a,{_repeatInfo:f,adaptTimeRange:p}=this._mp4,g=p[c],m=null==g?void 0:g.range,v=null==g?void 0:g.duration;!e.initSeg&&u&&(e.initSeg=u,e.adaptTimeRange=p);const y=this._mp4._lastDemuxSampleIdxRange;e.repeatData=(null==(n=f.data)?void 0:n.slice(0,f.curDataPos))||[];const _=this.updatePreCacheData(e,r,h,l,c,d,m,y,v);this.log(Ne.LOG,`[Preloader] ${e.cacheKey} _successCallback`,c,l,_,e),e.from=3,_&&(await this.setPreLoadData(e.cacheKey,e),c>=i.length-1?(this.log(Ne.LOG,`[Preloader] ${e.cacheKey} mp4.load end`,c),this.emit(So,e),this._endLoadFragments()):(this.log(Ne.LOG,`[Preloader] ${e.cacheKey} mp4.load start`,c+1),await this._mp4.loadAllFragmentData(c+1,s,o)))};await this._mp4.loadAllFragmentData(0,s,o)}_endLoadFragments(){this.log(Ne.LOG,`[Preloader] _endLoadFragments loadingCount:${this.loadingCount},${this.playerId}`,this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this._mp4&&(this._mp4.cancelLoading(),this._mp4.destroy(),this._mp4=null)}getFragment(e,t,n,r,i,o={}){const s=new po;return this.getData(e,t,o,!1).then((e=>{r.createFragment(new Uint8Array(e.res),t[0]-r.mdatStart,n,{range:t,context:e.context}).then((e=>{s.resolve(e)}))})),s}getPreloadUrl({url:e,range:t,definition:n,vid:r}){return[{url:e,range:t,extData:{cacheKey:Ro.generateUniqueKey({vid:r,start:t[0],end:t[1],definition:n}),vid:r,format:"mp4"}}]}getRangeList(e){const{allCachedKeys:t}=this,n={timeRange:[],contentRange:[]};for(const r in t)if(t.hasOwnProperty(r)&&r.indexOf(e)>-1){const e=r.split("#");0===e[2].indexOf("pretime")?n.timeRange.push([0,parseFloat(e[2].slice(7))]):n.contentRange.push([parseInt(e[2]),parseInt(e[3])])}return n}hasItemSameVid(e){if(!e)return null;const t=e.split("#"),n=Object.keys(this.allCachedKeys);for(let r=0;r=4&&t.length>=4&&o[0]===t[0]){if(0===o[2].indexOf("pretime")&&0===t[2].indexOf("pretime"))return i;{const e=[parseInt(o[2]),parseInt(o[3])],n=[parseInt(t[2]),parseInt(t[3])];if(n[0]>=e[0]&&n[1]>n[0]&&n[1]<=e[1])return i}}}return null}removeOthers(e=[]){const{allCachedKeys:t}=this;for(const n in t)if(t.hasOwnProperty(n)&&n.split("#").length>=1){const t=n.split("#")[0];e.every((e=>e.split("#").length>=1&&e.split("#")[0]!==t))&&(this.log(Ne.LOG,`remove cache:${n}`),this.cacheInst.removeItem(n))}}removeAll(){const{allCachedKeys:e}=this;for(const t in e)e.hasOwnProperty(t)&&(this.log(Ne.DEBUG,`remove cache:${t}`),this.cacheInst.removeItem(t))}removeAllPreloadTask(){this.preloadManager._preloadDataList=[],this.playingVids=[]}getItemSameVid(e,t){const n=this.hasItemSameVid(e);return this.log(Ne.DEBUG,`getItemSameVid: key:${e} checkResult:${n}`),n?this.cacheInst.getItem(n,t).then((e=>({value:e,key:n}))):Promise.resolve({})}setItem(e,t){return this.cacheInst.setItem(e,t)}removeItem(e,t){return this.cacheInst.removeItem(e,t)}get allCachedKeys(){return this.cacheInst._allCachedKeys||{}}get allCachedTimeKeys(){return this.cacheInst._allCachedTimeKeys||{}}get cacheInst(){return this.preloadManager._cacheInst}get preloadQueueList(){return this.preloadManager._preloadDataList||[]}cancelPreloadByVid(e,t){if(!e)return;const{_preloadDataList:n}=this.preloadManager,r=[];for(let t=0;te.data.vid!==t))}(t,e);this.preloadManager._preloadDataList=n;const r=this.currentPreloadInst,i=r&&r.options?r.options:{};this.log(Ne.LOG,"cancelPreloadByVid",e,e===i.vid,i),i.vid===e&&this.cancelLoading(),To(this.playingVids1,e)||this.playingVids1.push(e)}removePlayingVid(e){const t=_o(this.playingVids1,e);t>=0&&this.playingVids1.splice(t,1)}cancelLoading(){this.log(Ne.LOG,"cancelLoading"),this._endLoadFragments(),this._endLoadChunk()}clearTaskItem(e){const{preloadManager:t}=this;if(t._currentPreloadInst){const{_toLoadList:n}=t._currentPreloadInst,r=[];n.map((t=>(t._playerId!==e&&r.push(t),t))),t._currentPreloadInst._toLoadList=r}const n=[],r=[];this.log(Ne.LOG,"clearTaskItem before",e,t._preloadDataList.length),t._preloadDataList.map((t=>(t._playerId!==e?n.push(t):r.push(t.data.vid),t))),this.log(Ne.LOG,"clearTaskItem",e,r.join(","),t._preloadDataList.length),t._preloadDataList=n}clearTask(){const{preloadManager:e}=this;e._preloadDataList=[]}addPreloader(e){if(!e.data)return;const{_preloadDataList:t}=this.preloadManager,{vid:n}=e.data,r=yo(t||[],n),i=To(this.playingVids1,n);if(this.log(Ne.LOG,"[Preloader] addPreloader checkIfVidInList",n,r),r||i)return;const o=wi({},e);o.vtype||(o.vtype=Wt.MP4),this.addDashPreloader(o)}addPreloaderList(e=[]){const t=[],{_preloadDataList:n}=this.preloadManager;for(let r=0;r((e,t,n)=>t in e?wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function Eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n-1,Fo={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Uo="%c[xgplayer]",Ho={config:{debug:No?3:0},logInfo:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=3&&(t=console).log.apply(t,[Uo,Fo.info,e].concat(r))},logWarn:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=1&&(t=console).warn.apply(t,[Uo,Fo.warn,e].concat(r))},logError:function(e){var t;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",r=arguments.length,i=new Array(r>1?r-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(e);return i.className=r,i.innerHTML=t,Object.keys(n).forEach((function(t){var r=t,o=n[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(r,o):i.setAttribute(r,o)})),i},createDomFromHtml:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var r=document.createElement("div");r.innerHTML=e;var i=r.children;return r=null,i.length>0?(i=i[0],n&&jo.addClass(i,n),t&&Object.keys(t).forEach((function(e){i.setAttribute(e,t[e])})),i):null}catch(e){return Ho.logError("util.createDomFromHtml",e),null}},hasClass:function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch{var n=e.className&&"object"===Bo(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},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{jo.hasClass(e,t)||(e.className&&"object"===Bo(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},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{jo.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===Bo(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")}))}},toggleClass:function(e,t){e&&t.split(/\s+/g).forEach((function(t){jo.hasClass(e,t)?jo.removeClass(e,t):jo.addClass(e,t)}))},classNames:function(){for(var e=arguments,t=[],n=function(n){"String"===jo.typeOf(e[n])?t.push(e[n]):"Object"===jo.typeOf(e[n])&&Object.keys(e[n]).map((function(r){e[n][r]&&t.push(r)}))},r=0;r0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(n)}catch(r){Ho.logError("util.findDom",r),0===n.indexOf("#")&&(e=t.getElementById(n.slice(1)))}return e},getCss:function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},padStart:function(e,t,n){for(var r=String(n),i=0|t,o=Math.ceil(i/r.length),s=[],a=String(e);o--;)s.push(r);return s.join("").substring(0,i-a.length)+a},format:function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=jo.padStart(Math.floor(e/3600),2,0),n=jo.padStart(Math.floor((e-3600*t)/60),2,0),r=jo.padStart(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,r]:[t,n,r]).join(":")},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},typeOf:function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},deepCopy:function(e,t){if("Object"===jo.typeOf(t)&&"Object"===jo.typeOf(e))return Object.keys(t).forEach((function(n){"Object"!==jo.typeOf(t[n])||t[n]instanceof Node?"Array"===jo.typeOf(t[n])?e[n]="Array"===jo.typeOf(e[n])?e[n].concat(t[n]):t[n]:e[n]=t[n]:void 0===e[n]||void 0===e[n]?e[n]=t[n]:jo.deepCopy(e[n],t[n])})),e},deepMerge:function(e,t){return Object.keys(t).map((function(n){var r;"Array"===jo.typeOf(t[n])&&"Array"===jo.typeOf(e[n])?"Array"===jo.typeOf(e[n])&&(r=e[n]).push.apply(r,Go(t[n])):jo.typeOf(e[n])!==jo.typeOf(t[n])||null===e[n]||"Object"!==jo.typeOf(e[n])||t[n]instanceof window.Node?null!==t[n]&&(e[n]=t[n]):jo.deepMerge(e[n],t[n])})),e},getBgImage:function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var n=document.createElement("a");return n.href=t.replace(/url\("|"\)/g,""),n.href},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""},setInterval:function(e,t,n,r){e._interval[t]||(e._interval[t]=window.setInterval(n.bind(e),r))},clearInterval:function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},setTimeout:function(e,t,n){e._timers||(e._timers=[]);var r=setTimeout((function(){t(),jo.clearTimeout(e,r)}),n);return e._timers.push(r),r},clearTimeout:function(e,t){var n=e._timers;if("Array"===jo.typeOf(n)){for(var r=0;r-1&&r.indexOf(e)>-1&&(i=parseFloat(n.slice(0,n.indexOf(e)).trim()),o=parseFloat(r.slice(0,r.indexOf(e)).trim()),s=e,1))})),a.style.width="".concat(i).concat(s),a.style.height="".concat(o).concat(s),a.style.backgroundSize="".concat(i).concat(s," ").concat(o).concat(s),a.style.margin="start"===e?"-".concat(o/2).concat(s," auto auto -").concat(i/2).concat(s):"auto 5px auto 5px"),a},Hex2RGBA:function(e,t){var n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var r="#";e.replace(/[0-9A-F]/gi,(function(e){r+=e+e})),e=r}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(parseInt(e,16))})),"rgba(".concat(n.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},getFullScreenEl:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},checkIsFunction:function(e){return e&&"function"==typeof e},checkIsObject:function(e){return null!==e&&"object"===Bo(e)},hide:function(e){e.style.display="none"},show:function(e,t){e.style.display=t||"block"},isUndefined:function(e){if(typeof e>"u"||null===e)return!0},isNotNull:function(e){return null!=e},setStyleFromCsstext:function(e,t){t&&("String"===jo.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var n=t.split(":");n.length>1&&(e.style[n[0]]=n[1])}})):Object.keys(t).map((function(n){e.style[n]=t[n]})))},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"],n=e.style.cssText;if(!n)return{};var r=n.replace(/\s+/g,"").split(";"),i={},o={};return r.map((function(e){if(e){var n=e.split(":");n.length>1&&(function(e,t){for(var n=0,r=t.length;n-1)return!0;return!1}(n[0],t)?i[n[0]]=n[1]:o[n[0]]=n[1])}})),e.setAttribute("style",""),Object.keys(o).map((function(t){e.style[t]=o[t]})),i},getStyleFromCsstext:function(e){var t=e.style.cssText;if(!t)return{};var n=t.replace(/\s+/g,"").split(";"),r={};return n.map((function(e){if(e){var t=e.split(":");t.length>1&&(r[t[0]]=t[1])}})),r},preloadImg:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var r=new window.Image;r.onload=function(e){r=null,t&&t(e)},r.onerror=function(e){r=null,n&&n(e)},r.src=e}},stopPropagation:function(e){e&&e.stopPropagation()},scrollTop:function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},scrollLeft:function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},checkTouchSupport:function(){return"ontouchstart"in window},getBuffered2:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],r=0;ra&&(i[s-1].end=n[o].end):i.push(n[o])}else i.push(n[o])}else i=n;return new Vo(i)},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}},requestAnimationFrame:function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},getHostFromUrl:function(e){if("String"!==jo.typeOf(e))return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},cancelAnimationFrame:function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},isMSE:function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},isBlob:function(e){return"string"==typeof e&&/^blob/.test(e)},generateSessionId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch{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 n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},createEvent:function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},adjustTimeByDuration:function(e,t,n){return t&&e&&(e>t||n&&e0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(n).forEach((function(e){var r=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),i="".concat(e,"(").concat(n[e],")");r.test(t)?(r.lastIndex=-1,t=t.replace(r,i)):t+="".concat(i," ")})),t},convertDeg:function(e){return Math.abs(e)<=1?360*e:e%360},getIndexByTime:function(e,t){var n=t.length,r=-1;if(n<1)return r;if(e<=t[0].end||n<2)r=0;else if(e>t[n-1].end)r=n-1;else for(var i=1;it[i-1].end&&e<=t[i].end){r=i;break}return r},getOffsetCurrentTime:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if((n=r>=0&&r=s&&e<=a?e-u:e>a&&n>=i-1?a:-1},getCurrentTimeByOffset:function(e,t){var n=-1;if(!t||t.length<0)return e;for(var r=0;r"u")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(n){return t[n].test(e)})))[0]},get os(){if(typeof navigator>"u")return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,r=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,s=o||r&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!s;return{isTablet:s,isPhone:a,isIpad:o,isIos:a||o,isAndroid:r,isPc:!(a||r||n||s),isSymbian:n,isWindowsPhone:t,isFireFox:i}},get osVersion(){if(typeof navigator>"u")return 0;var e=navigator.userAgent,t="",n=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?Xo:zo)?t.exec(e):[];if(n&&n.length>=3){var r=n[2].split(".");return r.length>0?parseInt(r[0]):0}return 0},get isWeixin(){return!(typeof navigator>"u")&&!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if(typeof document>"u")return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&Ko.map((function(n){"probably"===t.canPlayType('video/mp4; codecs="'.concat(n,'"'))&&(e.isSupport=!0,e.mime+="||".concat(n))})),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(typeof MediaSource>"u"||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!(typeof MediaSource>"u"||!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||typeof navigator>"u")return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var n=e.video||{},r=e.audio||{};try{var i=MediaSource.isTypeSupported(n.contentType),o=MediaSource.isTypeSupported(r.contentType);return Promise.resolve({supported:i&&o,smooth:!1,powerEfficient:!1})}catch{return Promise.resolve(t)}}},Wo="3.0.21",qo={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Yo=Co((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};Do(this,e);var r=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i=n.mediaError?n.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,f=n.errorCode||i.code;qo[f]&&(f=qo[f]);var p={playerVersion:Wo,currentTime:s,duration:o,ended:a,readyState:h,networkState:d,src:l||u,errorType:n.errorType,errorCode:f,message:n.errorMessage||i.message,mediaError:i,originError:n.originError?n.originError.stack:"",host:jo.getHostFromUrl(l||u)};return n.ext&&Object.keys(n.ext).map((function(e){p[e]=n.ext[e]})),p}if(arguments.length>1){for(var g={playerVersion:Wo,domain:document.domain},m=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v3?r-3:0),o=3;o2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var r=arguments,i=this;if(n.pre)try{var o;(o=n.pre).call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(t.message),t}if(this.__hooks&&this.__hooks[e])try{var s,a=(s=this.__hooks[e]).call.apply(s,[this,this].concat(Array.prototype.slice.call(arguments)));a?a.then?a.then((function(e){!1!==e&&ns.apply(void 0,[i,t,n.next].concat(Go(r)))})).catch((function(e){throw e})):ns.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments))):void 0===a&&ns.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(t.message),t}else ns.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function is(e,t){var n=this.__hooks;if(n)return n.hasOwnProperty(e)?(n&&(n[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function os(e,t){var n=this.__hooks;n&&delete n[e]}function ss(e,t){Ho.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var as=function(){return Co((function e(t){Do(this,e),jo.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(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}))}})}(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}),[{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=jo.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 n=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){n.__events[e]=t,n.player.on(e,t)})):ss(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(r){n.__onceEvents[r]=t,n.player.once(e,t)})):ss(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(r){delete n.__events[e],n.player.off(r,t)})):ss(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(n){e[t][n]&&e.off(n,e[t][n]),n&&delete e[t][n]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var r=Ao(Ao({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,r)}}},{key:"hook",value:function(e,t){return rs.call.apply(rs,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i2?n-2:0),i=2;i1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return n&&(t.pluginName=n),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,n=this.pluginName;this.offAll(),jo.clearAllTimers(this),jo.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(n),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(e,n,t[n])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}])}();class ls{constructor(e){xo(this,"onTick",(e=>{this&&(this.cancelPending&&this.cancelPending(),this.alive&&(this.onTick_&&this.onTick_(),e&&e()))})),this.onTick_=e,this.timeoutId=null,this.alive=!0}tickAfter(e,t=null){return this.cancelPending?this.cancelPending():this.cancelPending=()=>{clearTimeout(this.timeoutId),this.timeoutId=null},this.alive=!0,this.timeoutId=setTimeout(this.onTick,1e3*e,t),this}tickEvery(e){this.tickAfter(e,(()=>{this.tickEvery(e)}))}stop(){this.alive=!1,this.cancelPending&&(this.cancelPending(),this.cancelPending=null)}}class us extends rt.EventEmitter{constructor(e){super(),this.masterTimer=void 0,this.onVisibleChange=()=>{const e=this.masterTimer||this.workerTimer;this.stop(),e&&this.start()},this.options=e,document.addEventListener("visibilitychange",this.onVisibleChange)}start(){const{frequency:e}=this.options;this.stop(),this.masterTimer=new ls((()=>{try{(this.masterTimer||this.workerTimer)&&this.emit(si)}catch{}})),this.masterTimer.tickEvery(e)}stop(){this.workerTimer&&(this.workerTimer=void 0),this.masterTimer&&(this.masterTimer.stop(),this.masterTimer=void 0)}destroy(){this.removeAllListeners(),document.removeEventListener("visibilitychange",this.onVisibleChange),this.stop()}}const cs="DESTROYED",hs="xglog_cache",ds="degrade",fs="fps_stuck";let ps=null,gs=null,ms=null,vs=null,ys=null,_s=0,Ts=null;class bs extends as{constructor(e){var t,n;super(e),xo(this,"_onChangeConfig",(e=>{if(e){const t=e.nextBufferLength===this.config.minBufferLength;if(this.setConfig(e),e.nextBufferLength&&!t)try{this._onTimeUpdate()}catch{}}})),xo(this,"fpsStuckHandle",(e=>{const{player:t,mse:n}=this;if(this.fpsStuckTime||(this.fpsStuckTime=e.currentTime,this.log(Ne.LOG,"fpsStuckHandle, currentTime,",e.currentTime)),this.fpsStuckTime>0){const e=t.bufferedPoint;n.clearOpQueues(nt.VIDEO),this.log(Ne.LOG,"fpsStuckHandle, remove,",e.start,"-",e.end,",seekTime,",this.fpsStuckTime),null==n||n.remove(nt.VIDEO,e.start,e.end).then((()=>{t.currentTime=this.fpsStuckTime,this.fpsStuckTime=null}))}})),xo(this,"_retryHook",(()=>{const{player:e,playerConfig:t}=this,{paused:n}=e;this.softDecode?e.vtype="MP4_MSE_SOFT":e.vtype="MP4_MSE",this._defInited=!1;const r=e.currentTime||0;return this.log(Ne.LOG,"retryHook ",t.vid,this.codecType,r),this._addMetaDataEvent((()=>{r&&(e.currentTime=r,this.log(Ne.LOG,"retryHook update currentTime",t.vid,this.codecType,r)),n?e.pause():e.play(),this._removeMetaDataEvent()})),this.destroyMSE(),this._reset(),this.playerStartInit(t.url),!1})),xo(this,"_playHook",((e,...t)=>{this._usePaused=!1,this._canceLoading=!1,this.log(Ne.LOG,"playHook"),this._startProgress()})),xo(this,"_pauseHook",((e,...t)=>{var n,r;this._usePaused=!0,this.log(Ne.LOG,"pauseHook",t[0],null==(n=this.player)?void 0:n.currentTime),t.indexOf(null==(r=oi)?void 0:r.BUFFER_CONTROLS)<0&&(clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,this.log(Ne.LOG,"pause hook clear buffer_control state")),this._loadStuckCheck()})),xo(this,"abrSwitchURL",(async e=>{const{playerConfig:t}=this,n=t.definition.list;let r=0;for(let t=0;t{this._requestTimer&&this._onTimeUpdate()})),xo(this,"changeDefineCanPlay",((e,t,n,r)=>{const{player:i}=this;if(i.ended)return void(i.currentTime=0);const{_changeDefState:o}=this;i.currentTime=o?o.currentTime:e,(o?o.paused:t)?i.pause():i.play(),this._changeDefState=null,i.emit(ts,{from:n,to:r})})),xo(this,"changeDefinition",((e,t,n)=>{var r,i;const{player:o,playerConfig:s,mp4:a,config:l}=this;if(t||(t=o.curDefinition),this._MSEError=!1,this._isReceiveEndedEvent=!1,this.useVideoLoad)return"__auto__"===e.url&&(e.url=s.definition.list[0].url),void ms.call(this.player,e,t);const{definitionList:u}=o,c=u.filter((t=>t.definition===e.definition));c.length>0&&(e=c[0]);const h=this._handlerUrl(e.url);if(!h)return;if(l._mainURL=h.main,l._backupURL=h.backup,e._mainURL=l._mainURL,e._backupURL=l._backupURL,l.switchBitRateWay&&!n)return void this.oldChangeDefinition(e,t);const d="自动"===e.definition||"auto"===e.definition;if(n)this.log(Ne.LOG,"[switchBitrate:ABR], ready to switch bitRate, ",e.bitrate,e.definition);else{let n=!1;if(d)this._abrService&&this._abrService.enable(),n=!0;else{this._abrService&&this._abrService.disable();const n=null==(r=s.definition)?void 0:r.list;if(n&&(!e.bitrate||!e.uri||!e.size||!e.duration))for(let r=0;r{this._abrService&&this._abrService.updateAutoDefiDesc(o.curDefinition.definition,!d)})),n&&(e=o.curDefinition),this.log(Ne.LOG,"[switchBitrate:CBS],switch bitRate, ",e.bitrate,e.definition)}if(o.curDefinition=e,this.mp4.clearPCDNNodeList(),this.checkPCDN(),!a)return;["keyValue","kid","secretKey","drm","getLicenseUrl","drmKeyToken","sessionId"].forEach((t=>{l[t]=e[t]}));let f=null;Fi(this.config)?(this._initSecret(),f=this._secretkey.getLicenseSecret()):(f=new po,f.resolve()),f.then((async r=>{var i;null!=r&&r.secretKey&&(!l.keyValue&&(l.secretKey=r.secretKey),l.decryptKey=r.decryptKey),s.url=e.url;let u=0,c=!1;if(this._abrService&&this._abrService.isCurrentInAbr()){const e=o.getBufferedRange(o.buffered2);u=e[1],u0&&p[1]-o.currentTime>5&&(!this._abrService||!g)&&(this.mse.clearOpQueues(nt.VIDEO),this.removeBuffer(nt.VIDEO,o.currentTime+5,p[1])),this.log(Ne.LOG,"switchBitrate: resetFragmentLoadState,",d),a.resetFragmentLoadState(d),this._curLoadSegmentIdx=d,await this.mp4.changeBitRate(e),this._setCurrentDefinition(e.bitrate),this._emitDefinitionChangeDetailEvent(u),this.canDownload=!0,this._onTimeUpdate();const m={width:e.width||e.vwidth,height:e.height||e.vheight};o.emit("RESOLUTION_UPDATE",m)})).catch((t=>{this.log(Ne.ERROR,"switchBitrate: GET_LICENSE_ERROR,",null==t?void 0:t.message);const n=new Yo(this.player,{errorType:di.DRM,errorCode:hi.drm,errorMessage:(null==t?void 0:t.message)||"GET_LICENSE_ERROR",vid:s.vid});t.errorType="GET_LICENSE_ERROR",this.emit("GET_LICENSE_ERROR",n),this.changeState("LICENSE_ERROR",{d:e.definition})}))})),xo(this,"_onVideoError",(e=>{var t,n,r,i;const{player:o}=this;this.changeState("video_error",{code:e.code||(null==(n=null==(t=null==o?void 0:o.video)?void 0:t.error)?void 0:n.code),message:e.message||(null==(i=null==(r=null==o?void 0:o.video)?void 0:r.error)?void 0:i.message),videoType:this.useVideoLoad})})),xo(this,"removeBuffer",((e,t,n,r)=>{var i;const o=this.getBufferDur();null==(i=this.mse)||i.remove(e,t,n).then((()=>{const e=this.getBufferDur(),t=o-e;t>0&&(this.emit("removeBuffer",{removeDur:t}),this.log(Ne.LOG,"removeBuffer dur,",t)),r&&r()}))})),xo(this,"_onPause",(()=>{this._loadStuckCheck()})),xo(this,"_onPlaying",(()=>{var e,t,n;this.changeState("playing",{curtime:this.player.currentTime,buffer:JSON.stringify(null==(t=null==(e=this.player)?void 0:e.buffered2)?void 0:t.bufferedList)}),this._waitAdjustTimeCnt>0&&this._waitInBufferTimer&&(this._waitAdjustTimeCnt-=1,this.changeState("waitInBuffer_resume"),this.log(Ne.WARN,"[waitInBuffer resume play], waitAdjustTimeCnt,",this._waitAdjustTimeCnt)),clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null;const{mp4:r,player:i}=this,{resumePlayWaterLevel:o}=this.config;if(r){if(!(r&&r.meta&&r.meta.duration-i.currentTime<=o)&&(this.waitLevelStartTime<0&&(this.waitLevelStartTime=i.currentTime),this.playFlag||(this.playFlag=!0),o>0&&i.currentTime-this.waitLevelStartTime>=2)){const e=i.getBufferedRange(i.buffered2);e[1]>0&&e[1]-i.currentTime0&&(clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,i.isBufferControlPaused&&(i.isBufferControlPaused=!1),i.paused&&i.play())})),xo(this,"_lowDecoder",(()=>{const e=Ni(this.player);this.log(Ne.WARN,`H265 lowdecode: ${this.playerConfig.vid} `,e,", h265Degrade, ",this.config.h265Degrade),this.config.h265Degrade&&this._onDegrade()})),xo(this,"_onError",(e=>{this._onDegrade(e)})),xo(this,"_onDegrade",(e=>{var t;const{player:n,playerConfig:r,config:i}=this;Bi(n,"lowdecode",this._onDegrade),Bi(n,"error",this._onError),null==(t=this.mp4)||t.destroy();const{currentTime:o}=n;if(this.log(Ne.WARN,"[h265 degrade], vid,",r.vid,",currtime,",o),this.emit(ds,{errc:null==e?void 0:e.errorCode,err_msg:(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message),codec_type:this.codecType,media_type:r.mediaType}),null!=i&&i.H264Config){const{H264Config:e}=i;["drm","getLicenseUrl","kid","keyValue","secretKey","isEncrypt","useEME"].forEach((t=>{i[t]=e[t]||null}))}const s={mp4encryptplayer:i,mediaType:"video",codecType:ai},a=(null==r?void 0:r.H264DefinitionList)||[];if(a.length>0){r.definition.list=a,r.url=a[0].url,r.defaultBitrate=a[0].bitrate,r.defaultDefinition=a[0].definition,this.isH265DegradeH264=!0,n.playNext(s);const e=()=>{n.currentTime=o,this.isH265DegradeH264=!1,this.log(Ne.LOG,"H265DegradeH264 update currentTime",o),this._removeMetaDataEvent()};this._addMetaDataEvent(e)}else n.pause(),this._reset(),this.checkReUseMSE(!1),this.log(Ne.ERROR,"H265 error,degrade h264 but no h264 url"),this.emit("error",e)})),xo(this,"_onMp4MetaReady",(e=>{var t,n;if(!this.mp4)return;yi&&console.log(">>>>_onMp4MetaReady",Mi());const r=this.firstFrameTime;r.metaload=this.mp4.firstFrameTime.metaload,r.bitrate=this.player.curDefinition.bitrate;const i=this._checkMetaInfo(e);if(this.emit(Xi,{...e,error:i,timeRange:(null==(t=this.mp4)?void 0:t.timeRange)||[]}),i)this._errorHandler(i);else{try{this._initEME(this.mp4,e),this.softDecode?(this.log(Ne.LOG,"initH265MseProxy"),this._initH265MseProxy()):this.player.video instanceof HTMLVideoElement&&(this.log(Ne.LOG,"initMse"),this._initMse(e)),null==(n=this._initPromise)||n.resolve()}catch(e){return void this._errorHandler(new Yo(this.player,{errorType:di.MEDIA,errorCode:hi.eme_hijack,errorMessage:(null==e?void 0:e.message)||"eme or mse catch err",vid:this.playerConfig.vid}))}if(this.mp4&&this.mp4.timeRange){const e=[];this.mp4.timeRange.every((t=>(e.push({startTime:t.startTime,endTime:t.endTime}),!0))),this.emit("KEYFRAMETIME",e)}this._loadData()}})),xo(this,"_onMp4Error",(async(e,t)=>{const{vid:n}=this.playerConfig;console.error("[Index] _onMp4Error",n,e),this.changeState("MP4_ERROR",{state:t,errmsg:(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message),errorType:null==e?void 0:e.errorType,code:null==e?void 0:e.errorCode,httpCode:null==e?void 0:e.httpCode}),this._errorHandler(e)})),xo(this,"_onMp4Progress",(e=>{this.emit("progress_event",e)})),xo(this,"_onMp4DataCallBack",(()=>{this._isMseInit&&this._onTimeUpdate()})),xo(this,"_updateDrmConfig",(e=>{const{config:t,mp4:n}=this;n.updateSecretKey(t.useEME,t.secretKey,t.decryptKey,t.keyValue),this._secretkey&&e.kid&&this._secretkey.updateKid(e.kid)})),xo(this,"_updateMSE",(e=>{const{player:t}=this;t.video instanceof HTMLVideoElement&&(this.log(Ne.LOG,"updateMse",e.videoCodec),this._initMse(e))})),xo(this,"_onVideoTimeUpdate",(()=>{var e,t;const{mse:n,player:r}=this;this.waitLevelStartTime<0&&(this.waitLevelStartTime=r.currentTime),this.checkReStartTimer(),this._isEnded(),r.isSeeking&&(r.isSeeking=!1),!this.useVideoLoad&&n&&this._removeBuffeEndTime>0&&r.currentTime>this._removeBuffeEndTime+1&&(this.log(Ne.LOG,"remove old bitrate buffer",this._removeBuffeEndTime),this.removeBuffer(nt.VIDEO,0,this._removeBuffeEndTime-1),this._removeBuffeEndTime=0);const i=this._definitionChangePointInfo;if(i&&r.currentTime>i.changeStartTime){r.emit(ts,i.changeInfo);const n=i.changeInfo||{};this.log(Ne.LOG,ts,", currentTime,",r.currentTime,",from ",null==(e=null==n?void 0:n.from)?void 0:e.definition," to ",null==(t=null==n?void 0:n.to)?void 0:t.definition),this._definitionChangePointInfo=null}!this.useVideoLoad&&null===this._requestTimer&&!this._offineLine&&!this._canceLoading&&this._startProgress()})),xo(this,"_onBufferedReset",(()=>{this.mp4&&this.mp4.videoTrak&&this.mp4.resetFragmentLoadState(0)})),xo(this,"_onOnlineHandler",(()=>{this._offineLine=!1;const{playerConfig:e,player:t}=this,{currentTime:n,paused:r}=t;if(this.log(Ne.LOG,"online useVideoLoad:",this.useVideoLoad,this._hasStartProgressBack),this.useVideoLoad){const i=()=>{n&&(t.currentTime=n),this.log(Ne.LOG,"onOnlineHandler update currentTime",e.vid,this.codecType,this._currentTime),r?t.pause():t.play(),this._removeMetaDataEvent()};this._addMetaDataEvent(i),this._setPlayerSrc(e.url)}else this._hasStartProgressBack&&this._startProgress(),this._hasStartProgressBack=!1})),xo(this,"_onOfflineHandler",(()=>{this._offineLine=!0,this.log(Ne.LOG,"offline, ",this._hasStartProgress),this._hasStartProgress&&(this._stopProgress(),this._hasStartProgressBack=!0)})),xo(this,"_loadDataSuccess",(e=>{var t,n,r;if(this.isDestroy||!this.mse&&!this.mseProxy)return;const i=this.firstFrameTime;if(i.startload_stmux<0){const{startMuxTime:e,firstmux:t}=this.mp4.firstFrameTime;i.startload_stmux=e,i.firstmux=t}i.loadst_loadeddata<0&&(i.loaddata=Mi()-this.loadstart);try{e.initSeg&&(this._appendInitSeg(e.initSeg),(!e.buffer||e.buffer.byteLength<1)&&this._onTimeUpdate());const{buffer:i,state:o,context:s,videoTrack:a,audioTrack:l}=e;this.debugInfo.loadIndx=s?s.fragIndex:-1;const u=null==(r=null==(n=null==(t=this.mp4)?void 0:t.adaptTimeRange[s.fragIndex])?void 0:n.timeRangeIdx)?void 0:r[1];if(this.mse&&o&&(!i||i.byteLength<=0)&&u>=this.mp4.timeRange.length){const{buffered:e}=this.player;e&&(null==e?void 0:e.length)>0&&(this.bufferEndTime=e.end(e.length-1)),this._isEnded(),this.log(Ne.LOG,"loaded ended !!!==>>>",JSON.stringify(s.range),", fragIndex,",s.fragIndex,", bufferEndTime,",this.bufferEndTime,",meta_duration,",this.mp4.meta.duration)}if(i&&this.mse){if(i&&i.byteLength>0){this._appendBuffer(nt.VIDEO,i,s,o);const e=this.getDataBitRate(s.fragIndex);this.player.emit("addVideoBufferEnd",{start:Math.floor(s.startPts),end:s.endPts,bandwidth:e.bitrate})}}else this.mseProxy&&(a&&a.samples.length>0||l&&l.samples.length>0)&&(this.log(Ne.LOG,"[livevideo] append,index,",s.fragIndex,",range,",JSON.stringify(e.context.range),", timeRange,",s.timeRange),this.mseProxy.appendBuffer(a,l))}catch(e){this.changeState("APPEND_DATA_ERROR",{errMsg:null==e?void 0:e.message});const t=new Yo(this.player,{errorType:di.MEDIA,errorCode:hi.mseAppend,vid:this.playerConfig.vid,errorMessage:e.message,mediaError:{code:hi.mseAppend,message:e.message}});this._errorHandler(t)}null!=e&&e.state&&this._onTimeUpdate()})),xo(this,"_onResumePlaying",(()=>{this._resumePlay=!0})),xo(this,"_seekOnce",(e=>{const{player:t}=this;t&&(t.currentTime=e+.1*Math.pow(2,this._currentSeekTimes||0),this._currentSeekTimes++,this.log(Ne.LOG,`当前第${this._currentSeekTimes}次Seek,currentTime=${null==t?void 0:t.currentTime}`))})),xo(this,"_onWaiting",(()=>{var e,t,n;this.checkReStartTimer(),this._isEnded();const r=null==(t=null==(e=this.player)?void 0:e.buffered2)?void 0:t.bufferedList;this.changeState("waiting",{curtime:this.player.currentTime,buffer:JSON.stringify(r)});const{player:i,config:o,playerConfig:s,mp4:a}=this;clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null;const l=i.currentTime;this.log(Ne.LOG,",[onWaiting],curTime, ",l,",buffer,",JSON.stringify(r),",dur,",null==(n=null==a?void 0:a.meta)?void 0:n.duration);const u=i.bufferedPoint;u.end>0&&u.end-l>=2?this._waitAdjustTimeCnt{this._waitAdjustTimeCnt++,this.changeState("waitInBuffer_seek",{waitAdjustTimeCnt:this._waitAdjustTimeCnt,curTime:l}),i.currentTime=i.currentTime+.5}),o.waitingInBufferTimeOut):this._errorHandler(new Yo(this.player,{errorType:di.RUNTIME,errorCode:hi.waitTimeout,errorMessage:"onWaitTimeout_in_buffer",vid:s.vid})):this._loadStuckCheck()})),xo(this,"_onEnded",(()=>{this.log(Ne.LOG,"[player.onEnded], stopProgress"),this._stopProgress()})),xo(this,"_errorHandler",(e=>{const{player:t,playerConfig:n,preLoadData:r}=this;if(!t||this.useVideoLoad)return;if(e.errorCode===hi[403]&&this._emitExpireEvent(e)&&this.config.urlExpireDisableErrorEvent)return this.log(Ne.LOG,"_errorHandler urlExpireDisableErrorEvent",this.config.urlExpireDisableErrorEvent,",errorCode,",e.errorCode),this._stopProgress(),void this.emit(hs);if("object"!=typeof e){const t={};t.err=e,e=t}e.ext||(e.ext={});const i=t.paused;if(e.ext.vid=n.vid,e.ext.preloadHit=this.hitpreload?1:0,e.ext.preloadCached=r?r.duration:0,e.ext.timerStep=Math.max(...this.timerStepList),e.ext.codectype=this.codecType,e.errorMessage=e.message,e=new Yo(t,e),this.log(Ne.ERROR,"_errorHandle",`preState is ${i}`,null==e?void 0:e.errorCode,(null==e?void 0:e.message)||(null==e?void 0:e.errorMessage)),!e.url&&(e.url=t.src),e.errd&&"object"==typeof e.errd&&this.mp4&&(e.errd.url=this.mp4.url,e.url=this.mp4.url),this.player.emit("playCatch",this.player.vtype,e),this.emit("DATA_REPORT",e),this.mp4&&this.mp4.cancelLoading(),this._abrService&&this._abrService.disable(),this.canDownload=!1,this.mp4&&this.mp4.bufferCache&&this.mp4.bufferCache.clear(),this.checkIsDegraded(e))this.player.vtype="MP4_2",this._initPromise&&this.removeAndRejectInitPromise(e),this._startDegradedPlayback(e,i);else{this.log(Ne.ERROR,"final error !!!!, ",n.vid,null==e?void 0:e.errorCode,(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message)),this.player.pause(),this._reset();const{currentTime:r}=t;this.destroyMSE(),t.currentTime=r,this.emit("error",e)}this.emit(hs)})),xo(this,"_onSeeking",(async()=>{var e,t,n;if(this._isReceiveEndedEvent=!1,this.useVideoLoad)return;const{player:r,mp4:i}=this;this.waitLevelStartTime=r.currentTime;const o=r.currentTime;if(this.changeState("seeking",{curTime:o}),this.log(Ne.LOG,"[seeking], curTime,",o,",buffer,",JSON.stringify(r.buffered2.bufferedList)),!i||!i.meta)return;this._startProgress(),this.endofstream=!1,i.bufferUsedPos=0,i.metaLoading=!1,this._definitionChangePointInfo&&(this._definitionChangePointInfo.changeStartTime=o,this.log("[seeking update definitionChangePointInfo.changeStartTime]",o)),i.changeBitRateTime>0&&(i.updateChangeBitRateTime(o),this.log("[seeking update changeBitRateTime]",o));const s=r.bufferedPoint;let a=!1,l=0;if(s.end>0){if(a=!0,i.meta.duration-s.end<.5)return void this.log("[seeking in buffered range], buffer end,",s.end,", duration,",null==(e=null==i?void 0:i.meta)?void 0:e.duration);const t=i.getFragmentIdx(s.end);l=this.getAdaptTimeRangeIdx(t),i.seekTime=s.end,l<0&&(l=this._curLoadSegmentIdx),this.log(Ne.LOG,"[seeking in buffered range], seekTime ",o,",bufferRange,",s.start,"-",s.end,", fragIndex,",l)}if(!a){i.seekTime=o;const e=i.getFragmentIdx(o);l=this.getAdaptTimeRangeIdx(e),this.log(Ne.LOG,"[seekTime out buffer range], srcFragIndex,",e,", fragIndex,",l),l<0&&(l=this._curLoadSegmentIdx),this.log(Ne.LOG,"[seekTime out buffer range], curTime,",o,", srcFragIndex,",e,", adaptIdx,",l);const{mse:t}=this;if(t&&null!=t&&t.isFull()){const e=r.buffered2.bufferedList,t=e[e.length-1];this._checkRemoveSourceBuffer([t.start,t.end],r.currentTime,!0,!0)}}this._curLoadSegmentIdx===l&&null!=(t=i.adaptTimeRange[l])&&t.isLoading?this.log(Ne.LOG,"[seeking in buffered range], seek fragIndex is current load segmentIdx",l):(i.canDownload=!1,await i.cancelLoading(),i.resetFragmentLoadState(l),this.log(Ne.LOG,"[seekTime resetFragmentLoadState],adaptIdx,",l,"mp4.seekTime",i.seekTime,JSON.stringify(i.adaptTimeRange)),null==(n=this.mse)||n.clearOpQueues(nt.VIDEO),this._curLoadSegmentIdx=l,this.canDownload=!0,this._onTimeUpdate(),this._isEnded())})),this.initLog(null==(n=null==(t=this.player.playerId)?void 0:t.toString())?void 0:n.slice(-4)),this._pendingPromises=[],this._allInitPromise=new po,this._isInit=!1,this._isEventInit=!1,this.playerId=this.player.playerId,this.preloader=null,this.log(Ne.LOG,"playerId",this.playerId,this.playerConfig.vid),this._useVideoLoad=!1,this.mse=null,this.mp4=null,this.eme=null,this._isMseInit=!1,this._corePromise=null,this._initPromise=null,this._hasStartProgress=!1,this._hasStartProgressBack=!1,this._curLoadSegmentIdx=0,this._abrService=null,this._checkRemoveBufferLastTime=Mi(),this.playFlag=!1,this.config.resumePlayWaterLevel=Math.min(this.config.minBufferLength,this.config.resumePlayWaterLevel),this.checkResumePlayTimer=null,this._MSEError=!1,this.loadstart=-1,this._loadStartEventTime=-1,this._waitAdjustTimeCnt=0,this._waitInBufferTimer=null,this.codecType=this.playerConfig.codecType?this.playerConfig.codecType.toLowerCase():ai,this.playerConfig.vtype&&(this._vtype=this.playerConfig.vtype.toUpperCase()),this.isActive=!0,this.firstFrameTime={newplayer:Mi(),initmse_sbopen:-1,mseopen:-1,metaload:-1,metaready_initsegend:-1,startload_stmux:-1,firstmux:-1,apcnt:0,aplen:0,data_ap:-1,loaded_data:-1,loadst_loadeddata:-1,new_loadeddata:-1,bitrate:-1,hitpreload:-1,first_gop_req_cnt:-1},this.debugInfo={},this.states=[],this.removeVideoList=[],this._lastCheckTime=Mi(),this._lastCheckLagTime=Mi(),this._changeDefState=null,this._defInited=!1,this._removeBuffeEndTime=0,this._isChangeDefinition=!1,this._lastTimeupdateTime2=0,this.waitLevelStartTime=-1,this.preLoadData=null,this.forPreloadTimeCache=null,this._usePaused=!1,this.endofstream=!1,this.bufferEndTime=-1,this.hitpreload=!1,this.isH265DegradeH264=!1,this.loadstartTimer=null,this.loadeddataTimer=null,this.canplayTimer=null,this.adaptRangeRes=[],this._isReceiveEndedEvent=!1,this._checkEndedTimer=null,this._definitionChangePointInfo=null,ys&&(this.player.preloader=ys),this._lastTimeupdateTime2=0,this.waitLevelStartTime=-1,this.timerStepList=[],window&&window.location.href.indexOf("playerInstance=true")>-1&&(void 0===window.mp4PlayerInstanceList&&(window.mp4PlayerInstanceList=[]),window.mp4PlayerInstanceList.push(void 0)),this._isH265SoftDecoder=!1,this._beforeLoadStartCostTime=0,this._requestTimer=null}static get pluginName(){return"Mp4EncryptPlayer"}static get defaultConfig(){return{onlyInit:!1,useWaterLevel:!1,maxBufferLength:10,minBufferLength:5,tickInSeconds:.2,getLicenseUrl:"",xhrSetup:{},chunkSize:209715,retryCount:1,retryDelay:1e3,timeout:3e3,needPreloadCheck:!1,needAutoBitrate:!0,keyValue:null,drm:null,switchBitRateWay:!1,enableWorker:!1,bufferThreshold:10,removeBufferLen:60,focusUserDefinition:!1,resumePlayWaterLevel:2,waitJampBufferMaxCnt:3,waitingInBufferTimeOut:5e3,waitingTimeOut:1e4,notDegradeErrorList:[],h265Degrade:!1,forceVideoPlay:!1,segmentMinDuration:3,supportHevc:void 0,H264Config:null,reqOptions:{},rangeMaxDuration:15,getRequestOptionsCallback:null,closeDowngrade:!1,loaderType:"fetch",reUseMSE:!1,urlExpireDisableErrorEvent:!1,logCacheConfig:{logCacheLevel:Ne.LOG,logMaxSize:204800},noPreloadAddBufferLen:0,enableFPSStuckHandle:!1,loadRangeType:ri,timerInWorker:!1}}static registerPreloader(e){ys=e}static set ENCRYPT_SECRET(e){Ts=e}static get speed(){return _s}static get realTimeSpeed(){return _s}static get version(){return ci}setConfig(e){this.config=Object.assign(this.config,e)}initLog(e){const{logCacheLevel:t,logMaxSize:n}=this.config.logCacheConfig;this.logger=new Ue(bs.pluginName+e,{logCacheLevel:t,logMaxSize:n}),yi&&Ue.enable()}playerlogger(e){e?Ue.enable():Ue.disable()}afterCreate(){const{playerConfig:e,config:t,player:n}=this;t.width=e.width||0,t.height=e.height||0,e.vid=e.vid||t.vid,nt.isSupported('video/mp4; codecs="avc1.64001f, mp4a.40.5"')&&!uo()&&(void 0===t.supportHevc&&null!=Qo&&Qo.isHevcSupported&&Qo.isHevcSupported()&&this.player.video instanceof HTMLVideoElement&&(t.supportHevc=!0),t.supportVvcc=!(typeof MediaSource>"u"||!MediaSource.isTypeSupported)&&MediaSource.isTypeSupported("video/mp4;codecs=bvc2.1.6.L93.B0"),this.softDecode?n.vtype="MP4_MSE_SOFT":n.vtype="MP4_MSE",(!co()||this.softDecode)&&(t.useEME=!1),t.useEME=!1!==t.useEME,this.checkConfig(),t.onlyInit&&(e.autoplay=!1,e.videoInit=!1,this._hasStartProgress=!1,this._hasStartProgressBack=!1),e.useWaterLevel&&(!e.userGestureEventMiddleware&&(e.userGestureEventMiddleware=Li),!e.videoEventMiddleware&&n.setEventsMiddleware(Oi)),this._proxyPlayer(),n.useHooks("play",this._playHook),n.useHooks("pause",this._pauseHook),n.useHooks("retry",this._retryHook),$i(n,Qr.BUFFERED_RESET,this._onBufferedReset),this._bindNetworkStateChange(),this.on("timeupdate",this._onVideoTimeUpdate),this.on(Jo,(()=>{var e;this.changeState("LOADED_DATA"),this.deleteVideo(),this.mp4&&this.mp4.updateLoadedDataDone(),this._firstFrameTime(),this._onTimeUpdate(),this.firstFrameTime.loaded_data=this._loadStartEventTime>0?Mi()-this._loadStartEventTime:-1,null!=(e=this.config)&&e.enableFPSStuckHandle&&this.on(fs,this.fpsStuckHandle)})),this.on(Zo,(()=>{this.changeState("LOAD_START"),this._loadStartEventTime=Mi(),this._beforeLoadStartCostTime=(new Date).getTime()-this._tm,this.codecType===li&&!this.config.supportHevc&&(this._isMseInit=!0,this._onTimeUpdate())})),this.on("ended",(()=>{this.log(Ne.LOG,"mp4plugin receive player video ended event"),this._onEnded()})),this.on("pause",(()=>{this._usePaused=!0})),this.on("play",(()=>{this._usePaused=!1})),this.on("xglog",(e=>{if("firstFrame"===e.eventType){const t=this.preLoadData&&this.preLoadData.definition?this.preLoadData.definition:-1,{player:n,firstFrameTime:r}=this;yi&&console.log(`[xgplayer-encrypt-mp4]>>>>firstFrame ${this.playerConfig.vid}, ${e.fvt}, codecType: ${this.codecType}`,`hitPreload: ${this.hitpreload}, video: ${this._useVideoLoad}, preloadBitrate: ${t}`,` metaLoad: ${r.metaload}, mseOpen: ${r.mseopen}`,`curDefinition: ${n.curDefinition.definition},appendInit: ${r.metaready_initsegend}`)}})),n.mp4MseFlag=!0)}_startBufferCheck(){const{player:e}=this;if(!e.video)return;const t=[];if(e.video.buffered){for(let n=0,r=e.video.buffered.length;n=t.bufferThreshold&&!this._hasTriggerBufferThreshold&&(this._hasTriggerBufferThreshold=!0,e.emit("BUFFER_THRESHOLD",o-r))}}_startUrlExpiredCheck(){const{definition:e}=this.playerConfig;e&&e.list&&e.list.length>0&&(this.urlExpireTimestamp=e.list[0].url_expire||0,this._handleUrlExpire())}async cancelLoading(){this.mp4&&(this._canceLoading=!0,this.log(Ne.LOG,"player cancelLoading",this.playerConfig.vid),this._stopProgress(),this.cancelPreloadTask(),await this.mp4.cancelLoading())}checkConfig(){const{playerConfig:e,config:t}=this;let n=e.defaultDefinition,r=e.defaultBitrate;if(!n){const{definition:e}=this.playerConfig;n=e&&e.defaultDefinition?e.defaultDefinition:t.definition}!r&&t.bitrate&&(r=t.bitrate),e.defaultDefinition=n,e.defaultBitrate=r}_addMetaDataEvent(e){const{player:t}=this;this.__mHandler=e,$i(t,"loadedmetadata",this.__mHandler)}_removeMetaDataEvent(){if(!this.__mHandler)return;const{player:e}=this;Bi(e,"loadedmetadata",this.__mHandler),this.__mHandler=null}beforePlayerInit(){const{player:e}=this,t=this;this._isInit||(as.defineGetterOrSetter(e,{__url:{get:()=>t.mse?t.mse.url:e.config.url,configurable:!0},downloadSpeed:{get:()=>_s/8,configurable:!0},playerVersion:{get:()=>ci,configurable:!0},menuCodeType:{get:()=>t.mp4&&t.mp4.meta?t.mp4.meta.videoCodec:t.codecType===ai?"avc":"hevc",configurable:!0},playerType:{get:()=>"MP4",configurable:!0},supportMenus:{get:()=>({speed:null==e?void 0:e.mp4MseFlag,cdn:null==e?void 0:e.mp4MseFlag,resolution:null==e?void 0:e.mp4MseFlag}),configurable:!0},preloadActive:{get:()=>this.isActive,set:e=>{this.isActive=e,this.isActive&&this._startProgress()},configurable:!0},performance:{get:()=>this.firstFrameTime,configurable:!0},domain:{get:()=>t.domain,configurable:!0},loadURL:{get:()=>t.loadURL,configurable:!0},abrInstance:{get:()=>t.abrInstance,configurable:!0},pcdnReq:{get:()=>{},configurable:!0},retryInfo:{get:()=>oo,configurable:!0},softDecoder:{get:()=>this._isH265SoftDecoder,configurable:!0},logCache:{get:()=>{if(t.logger)return t.log(Ne.LOG,`,version:${ci},timerStepList,`,JSON.stringify(this.timerStepList)),t.logger.getLogCache()},configurable:!0},pcdnVVStat:{get:()=>{var e;const{mp4:n,pcdn:r}=t;return n?{...n.pcdnVVStat,trace_id:null==(e=n.pcdnTraceInfo)?void 0:e.trace_id,cancelCnt:(null==n?void 0:n.pSCCancelCnt)||0,is_try_open:r?1:0}:null},configurable:!0},beforeLoadStartCostTime:{get:()=>this.useVideoLoad?0:this._beforeLoadStartCostTime,configurable:!0},bandwidth:{get:()=>{const{mp4:e,playerConfig:n}=t;return function(e,t){const n=e?e.loadInfo:null,r=n?n[Jr]:null,i=n?n[Zr]:null;return{vid:t,cdn:{speed:null==r?void 0:r.loadSpeed,size:r?r.loadLen:0},pcdn:{size:i?i.loadLen:0,...null==e?void 0:e.pcdnTraceInfo}}}(e,null==n?void 0:n.vid)},configurable:!0},ext:{get:()=>t?function(e){var t,n;const r=[],{video:i,currentTime:o,duration:s}=e.player,{playerConfig:a,mp4:l,mse:u,debugInfo:c,_curLoadSegmentIdx:h,states:d,_requestTimer:f,timerStepList:p}=e,g=i?i.buffered:[];if(g.length>0)for(let e=0,t=(null==g?void 0:g.length)||0;et.abrInstance&&t.abrInstance.isCurrentInAbr?e._currentDefitionFromPlayer:e.curDefinition,configurable:!0}}),this._isInit=!0)}destroy(){var e,t;const{player:n}=this;n.preloader&&n.preloader.cancel(this.playerId),n.removeHooks("play",this._playHook),n.removeHooks("pause",this._pauseHook),n.removeHooks("retry",this._retryHook),null==(e=this._requestTimer)||e.destroy(),this._requestTimer=null,this._reset(),this.checkReUseMSE(!1),this._secretkey&&Ts.destroySecretKey(this._secretkey,this._errorHandler),this.player.playNext=ps,this.player._startInit=gs,this.player.changeDefinition=ms,this.player.switchURL=vs,this._unbindNetworkStateChange(),this._unbindEvents(),Bi(n,Qr.BUFFERED_RESET,this._onBufferedReset),this._bufferCheckTimer&&clearInterval(this._bufferCheckTimer),this._removeBufferTimer&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),null!=(t=this.logger)&&t.reset&&this.logger.reset(),this._removeMetaDataEvent(),this.timerStepList=[]}_proxyPlayer(){"function"==typeof this.player.playNext&&(ps=this.player.playNext),this.player.playNext=(...e)=>{this.playNext(...e)},gs=this.player._startInit,vs=this.player.switchURL,ms=this.player.changeDefinition,this.player._startInit=this.playerStartInit.bind(this),this.player.switchURL=this.switchURL.bind(this),this.player.changeDefinition=this.changeDefinition.bind(this)}getInitBitrate(){const{player:e,config:t,playerConfig:n}=this;let r=null;const{definitionList:i}=e;if(i&&i.length>0){const{preloader:o}=e;o&&i.forEach((e=>{const t=o.generateUniqueKey({vid:n.vid,definition:e.definition||-1,vtype:n.vtype,codecType:n.codecType});e.cacheKey=t,t&&!r&&o&&o.hasItemSameVid(t)&&(r=e,r.type="preload")}));const{userSelectDefinition:s}=n;r&&s&&t.focusUserDefinition&&n.userSelectDefinition!==r.definition&&(r=null),!r&&this.bitRateAdapter&&(this.bitRateAdapter.speed=ao.speed,r=this.getDefinitonFromAdapter(i,s),r&&(r.type="bitRateAdapter"))}if(!r||!r.url){const{url:e,definition:t,defaultDefinition:o}=n,s=(null==t?void 0:t.defaultDefinition)||o;if("Array"===Pi(e)&&e.length>0||"String"===Pi(e)&&e){const t=this._getDefinitionItem(s),i=n.defaultBitrate||n.bitrate||(null==t?void 0:t.bitrate);r={url:e,definition:(null==t?void 0:t.definition)||s||-1,duration:(null==t?void 0:t.duration)||n.duration||this.config.duration||0,bitrate:i,uri:n.uri||(null==t?void 0:t.uri),file_id:null==t?void 0:t.file_id,size:(null==t?void 0:t.size)||n.size,type:"default"}}else r=i[i.length-1]}return r&&(n.url=r.url,r.networkSpeed=ao.speed),e.curDefinition=r,r}_setPlayerSrc(e){const{player:t}=this;this._removeVideoSource(),"Array"===Pi(e)?(t.video.removeAttribute("src"),!t._detachSourceEvents&&e.forEach((e=>{t.video.appendChild(ki("source","",{src:`${e.src}`,type:`${e.type||""}`}))})),t._attachSourceEvents(t.video,e),t.play()):(t.video.src=e,t.play()),t.mp4MseFlag=!1,t.emit("playertypechange")}_removeVideoSource(e){const{player:t}=this;e=e||t.video;const{children:n}=e;if(n.length>0)for(t._detachSourceEvents(e);n.length>0;)e.removeChild(n[0])}_getDefinitionItem(e){const{definition:t}=this.playerConfig;if(!t||!t.list)return null;for(let n=0;n{if(this.isDestroy)return void n.reject(new Error("destroy"));let i=null;if(e&&e.length>0&&(e.length>1&&(!t.keyValue&&(t.secretKey=e[0].secretKey),t.decryptKey=e[0].decryptKey),i=e[e.length-1].data,this.firstFrameTime&&(this.firstFrameTime.hitpreload=i?1:0)),i||!t.needPreloadCheck||this.codecType===li&&!t.supportHevc)if(this._vtype&&"MP3"===this._vtype)this.useVideoLoad=!0,this.log(Ne.LOG,"vtype_not_MP4"),n.reject(new Error("vtype_not_MP4"));else{const e=t._mainURL;this.player.rawSrc=e,this._initMp4(e,i,{fileSize:r?r.size:0}),this.updateLoadInfo(null==i?void 0:i.cacheKey),this.checkPCDN(),this.initAdaptRange(),this._initAbrService()}else this.useVideoLoad=!0,this.log(Ne.LOG,"no_preload"),n.reject(new Error("no_preload"))})).catch((t=>{this.log(Ne.ERROR,"getLicense or checkPreloader reject",null==t?void 0:t.message);const i=new Yo(this.player,{errorType:di.DRM,errorCode:hi.drm,errorMessage:(null==t?void 0:t.message)||"getLicense or checkPreloader reject",vid:e.vid});this.emit("GET_LICENSE_ERROR",i),this.changeState("LICENSE_ERROR",{d:r?r.definition:0}),n.reject(i)}))}catch(e){n.reject(e)}return n}updateLoadInfo(e){!e||!this.mp4||(this.mp4.loadInfo=ei.get(e),ei.delete(e))}initAdaptRange(){const{config:e,player:t,playerConfig:n}=this,{bitrate:r,duration:i}=t.curDefinition;if(null!=e&&e.adaptRange){let a=null;a=(null==e?void 0:e.loadRangeType)===ii?s:o,this.adaptRange=new a(t,r,i||n.duration,e.adaptRange)}}checkPCDN(){const{config:e,player:t,playerConfig:n}=this;t.curDefinition,this.pcdn=null}isOpenPCDN(e){}_pcdnReqSuccess(e,t){const{playerConfig:n,player:r,mp4:i}=this;if(!i||!e)return;const o=null.getPCDNReqId(r.curDefinition,n.vid);if(e.req_id&&o!==e.req_id)return void this.log(Ne.LOG,`,${t} is not match curDefinition reqId', reqId, ', pcdnRet.req_id`,e.req_id);const s=e.nodes||[];this.log(Ne.LOG,`${n.vid} get peer end,pcdn node update,`,s.length),i.updateNode(s),i.pcdnTraceInfo={uri:e.vid,fid:e.fid,trace_id:e.trace_id},i.pcdnVVStat&&(i.pcdnVVStat.try_req_node+=1,i.pcdnVVStat.req_node_succ+=1,i.pcdnVVStat.has_ret_node+=s.length>0?1:0)}_pcdnReqFail(e,t){const{mp4:n}=this;null!=n&&n.pcdnVVStat&&(n.pcdnVVStat.try_req_node+=1),this.checkURLExpired(e,t)}initTimer(){if(!this._requestTimer){const{timerInWorker:e,tickInSeconds:t}=this.config;this._requestTimer=new us({frequency:t,timerInWorker:e}),this._requestTimer.on(si,this.timerHandle)}}playerStartInit(e){var t;if(this.log(Ne.LOG,"playerStartInit",this.player.hasStart,this.playerId,e),this.isDestroy)return;const{playerConfig:n,player:r}=this;if(this._usePaused=!1,this.isActive&&0!==(null==r?void 0:r.currentTime)&&!this.config.frameFreeze&&(this.log(Ne.LOG,"[playerStartInit] reset current = 0 ,buffer,",JSON.stringify(null==(t=null==r?void 0:r.buffered2)?void 0:t.bufferedList)),this.player.currentTime=0),this._isH265SoftDecoder=this.softDecode,this.config.reUseMSE&&this.mse&&"String"===Pi(e)&&/^blob/.test(e)&&e!==this.mse.url&&(e=n.url,this.destroyMSE()),!e||"__auto__"===e||"anytext"===e){const{definition:e}=n,t=function(e){let t="",n=null;const r=e?e.list:[];if(r&&r.length>0&&e.defaultDefinition&&(r.forEach((r=>{r.definition===e.defaultDefinition&&(t=r.url,n=r)})),!t)){const i=r[0];t=i.url,e.defaultDefinition=i.definition,n=i}return n}(e);t&&(n.url=t.url,e.defaultDefinition=t.definition,r.curDefinition=t)}const i=this._defInited?null:this.getInitBitrate();if(n.nullUrlStart&&!i&&!n.url)return;this.initTimer(),Fi(this.config)?this._initSecret():this._secretkey=null,this._defInited=!0,this.log(Ne.LOG,`[playerStartInit] ${n.vid} curDefinition`,i||this.player.curDefinition);const{config:o}=this,{preloader:s}=this.player;s&&s.addPlayingVid(n.vid);const a=!this.softDecode;if(o.needPreloadCheck&&a&&!this._secretkey){let e,t=!1;const{curDefinition:r}=this.player;if(s&&r&&(e=r.cacheKey?r.cacheKey:s.generateUniqueKey({vid:n.vid,definition:r.definition||-1,vtype:n.vtype,codecType:n.codecType}),t=s.hasItemSameVid(e)),!t){this.useVideoLoad=!0,this.player.vtype="MP4_0",this.log(Ne.LOG,`[playerStartInit] ${n.vid} no_preload`,!!s,e);const t=new Yo(this.player,{errorType:"runtime",errorTypeCode:di.runtime,errorCode:hi.other,vid:this.playerConfig.vid,errorMessage:"no preload"});this.player.emit("playCatch",this.player.vtype,t)}}if(this.useVideoLoad){if(e=this.playerConfig.url,o.closeDowngrade)return;return this._sTime=Mi(),gs.call(this.player,e),void this._startProgress()}if(this.isDestroy)return;if(this.player.mp4MseFlag=!0,this.bufferEndTime=-1,this._tm=(new Date).getTime(),this._initPromise&&"pending"===this._initPromise.state){const e=this._handlerUrl(n.url);if(e&&e.main===o._mainURL)return}this._reset();const{vid:l}=this.playerConfig;this.changeState("PLAYER_START_INIT");const u=this._initMp4Kernel();this._initPromise=u,this._addPendingPromise(this._initPromise),u.then((()=>{this.isDestroy||(this.mse&&(e=this.mse.url),this.changeState("PLAY_INIT_OK"),this._bindEvents(),this._startProgress())})).catch((t=>{let n=!1;if(this._initPromise&&(n=this._initPromise.id!==u.id||this._initPromise.isBreak),this.isDestroy||n||t===cs)return;if(this.log(Ne.LOG,`_initMp4Kernel.catch: ${l} isDestroy:${this.isDestroy},\n errorCode:${(null==t?void 0:t.errorCode)||hi.other},errMsg:${(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message)}`),(null==t?void 0:t.errorCode)===hi[403]&&this._emitExpireEvent(t)&&o.urlExpireDisableErrorEvent)return this._initPromise=null,this.log(Ne.LOG,"initMp4Kernel urlExpireDisableErrorEvent",o.urlExpireDisableErrorEvent,",errorCode,",t.errorCode),this._stopProgress(),void this.emit(hs);let r=t;r.errorCode||(r=new Yo(this.player,{errorType:di.RUNTIME,errorCode:(null==t?void 0:t.errorCode)||hi.other,vid:this.playerConfig.vid,errorMessage:(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message),mediaError:{code:(null==t?void 0:t.httpCode)||hi.other,message:(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message),errorType:null==t?void 0:t.errorType}}),r.url=e),this.changeState("PLAY_INIT_CATCH",{c:r.errorCode,m:(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message),t:null==t?void 0:t.errorType}),this.useVideoLoad=!0,this.player.vtype="MP4_1",this.player.emit("playCatch",this.player.vtype,r);const i=this.checkIsDegraded(r);return this.log(Ne.WARN,"PLAY_INIT_CATCH final error !!!!, ",l,null==r?void 0:r.errorCode,null==r?void 0:r.errorMessage,",degrade:",i),this.emit(hs),i?void 0:(this.player.pause(),this._reset(),this.emit("error",r),void(this._initPromise=null))})).finally((()=>{var t;if(!this._initPromise)return;const{isBreak:n,id:r}=this._initPromise;if(r!==u.id)return;this._removePendingPromise(this._initPromise),this._initPromise=null,this._usePaused&&(this.playerConfig.autoplay=!1),this.softDecode&&"Array"===Pi(e)&&(e=e[0].src),"String"===Pi(e)&&!/^blob/.test(e)&&!this.config.frameFreeze&&this.destroyMSE();const i=(null==(t=this.player)?void 0:t.currentSrc)===e;this.changeState("PLAY_INIT_FINALLY",{isDestroy:this.isDestroy,isBreak:n,reUseSrc:i}),!this.isDestroy&&!n&&gs.call(this.player,e),this.reUseMSEEmitEvents(i),this._abrService&&this._abrService.isCurrentInAbr()&&(this._abrService.enable(),this._abrService.execute())}))}async destroyMSE(){var e;await(null==(e=this.mse)?void 0:e.unbindMedia()),this.mse&&this.log(Ne.LOG,"destroyMSE ",this.playerConfig.vid),this.mse=null}reUseMSEEmitEvents(e){var t;e&&/^blob/.test(null==(t=this.player)?void 0:t.currentSrc)&&(clearTimeout(this.loadstartTimer),clearTimeout(this.loadeddataTimer),clearTimeout(this.canplayTimer),this.loadstartTimer=setTimeout((()=>{clearTimeout(this.loadstartTimer),this.loadstartTimer=null,this.emit(Zo),this.log(Ne.LOG,"reUseMSE add emit loadstart event")}),10),this.loadeddataTimer=setTimeout((()=>{clearTimeout(this.loadeddataTimer),this.loadeddataTimer=null,this.emit(Jo),this.log(Ne.LOG,"reUseMSE add emit loadeddataevent")}),50),this.canplayTimer=setTimeout((()=>{clearTimeout(this.canplayTimer),this.canplayTimer=null,this.emit("canplay"),this.log(Ne.LOG,"reUseMSE add emit canplayevent")}),90))}playNext(e){const{player:t}=this;this._defInited=!1,this._hasTriggerBufferThreshold=!1,t.resetState(),t._currentTime=0,t._duration=0,t.isPlaying=!1,this.preloader&&this.preloader.clearTask(),this._useVideoLoad=!1,this._MSEError=!1;const n=this.softDecode;t.pause(),this._reset(),e.vtype&&(this._vtype=e.vtype.toUpperCase()),t.setConfig(e),this.config.frameFreeze||this.checkReUseMSE(this.config.reUseMSE,!0),this.softDecode?t.vtype="MP4_MSE_SOFT":t.vtype="MP4_MSE";const{codecType:r,mediaType:i}=this.playerConfig;if(this.codecType=r?r.toLowerCase():ai,n!==this.softDecode&&this.h265_h264_switch(i||"video"),this.checkConfig(),this.log(Ne.LOG,"[Index] playNext",e.vtype,e.vid),t.start(),this.config.reUseMSE&&!this.isH265DegradeH264){const e=()=>{this.log(Ne.LOG,"[Index] playNext metadata update currentTime = 0"),0!==t.currentTime&&(t.currentTime=0),this._removeMetaDataEvent()};this._addMetaDataEvent(e)}this.emit("playnext")}h265_h264_switch(e){this.log(Ne.LOG,"[Index],h265_switch_h264",e);const{player:t}=this,{mediaConfig:n}=t,r=ki(e,"",n,`xgplayer-${e}-img`);this.removeVideoList.push(t.video);const{muted:i,volume:o}=t.video;r.muted=i,r.volume=o,t.video=r,t.attachVideoEvents(t.video)}next(e){this.playNext(e)}oldChangeDefinition(e,t){const{config:n,player:r,playerConfig:i}=this;r.emit(es,{from:t,to:e}),r.emit("waiting");const o=r.definitionList,s=o.filter((t=>t.definition===e.definition||t.definition===Number(e.definition))),a=o.filter((e=>e.definition===t.definition||e.definition===Number(t.definition)));if(a.length>0&&(a[0].selected=!1),!(s.length>0))return;(e=s[0]).selected=!0,r.curDefinition=e,this.log(Ne.LOG,"[oldChangeDefinition],currentTime,",r.currentTime,",from,",t,",to,",e);const{currentTime:l,paused:u}=r;this._changeDefState||(this._changeDefState={currentTime:l,paused:u}),n.definition=e.definition,["keyValue","kid","secretKey","drm","getLicenseUrl","drmKeyToken","sessionId"].forEach((t=>{n[t]=e[t]})),i.url=e.url,i.userSelectDefinition=e.definition,i.defaultDefinition=e.definition,n.focusUserDefinition=!0,r.currentTime=0,r.pause(),this._reset(),this.checkReUseMSE(),this._isMseInit=!1,this.eme=null;const c=this._handlerUrl(e.url);n._mainURL=c.main,n._backupURL=c.backup,this._changeDefineCanPlay&&r.off("canplay",this._changeDefineCanPlay),this._changeDefineCanPlay=()=>{this.changeDefineCanPlay(l,u,t,e),this._changeDefineCanPlay=null},r.once("canplay",this._changeDefineCanPlay),this.player.video.load(),this.playerStartInit(i.url)}_emitDefinitionChangeDetailEvent(e){const{bitrate:t,definition:n,file_id:r,width:i,vwidth:o,height:s,vheight:a}=this._currDefinition;this.player.emit("definitionChangeDetail",{start:e,bitrate:t,definition:n,mediaType:"video",url:this.config._mainURL,fileid:r});const l={width:i||o,height:s||a};this.player.emit("RESOLUTION_UPDATE",l)}_setCurrentDefinition(e){const{config:t}=this.player;if(t.definition&&t.definition.list){const n=t.definition.list.filter((t=>t.bitrate===e));this._currDefinition=n&&n[0]}this._currDefinition||(this._currDefinition={bitrate:e}),e&&(this._currDefinition.bitrate=e)}switchURL(e){if(this.useVideoLoad)return void vs.call(this.player,e);const{player:t,playerConfig:n,config:r}=this;n.definition.list=[e],n.url=e.url,n.defaultBitrate=e.bitrate,n.defaultDefinition=e.definition,["keyValue","kid","secretKey","drm","getLicenseUrl","drmKeyToken","sessionId"].forEach((t=>{r[t]=e[t]})),this._addMetaDataEvent((()=>{t.currentTime=0,this._removeMetaDataEvent()})),this.playNext(r)}_handlerUrl(e){const{playerConfig:t}=this;if(!e)return null;let n;const r=[];if("String"===Pi(e))n=e,t.backupURL&&r.push(t.backupURL);else if("Array"===Pi(e)&&e.length>0&&(n=e[0].src,e.length>1))for(let n=1;n{e.gapDegrade&&e.useEME&&(e.useEME=!1,this._replay())})),this.on(a.CHANGE_FLYING_PLUGIN_CONFIG,this._onChangeConfig),t.setEventsMiddleware({error:(e,n)=>{var r;const i=null==e?void 0:e.error,o={errorCode:null==i?void 0:i.code,errorMessage:null==i?void 0:i.message,videoType:this.useVideoLoad};if(this.changeState("video_error.Middleware",o),this.codecType===li&&(null==i?void 0:i.message.indexOf("video decoder initialization failed"))>=0&&this.emit("DECODER_FAILED",{codecType:this.config.codecType,vid:this.playerConfig.vid}),this.log(Ne.ERROR,"error middleware",JSON.stringify(o),", isDegrade,",!this._MSEError&&!this.useVideoLoad,t.currentTime),!this._MSEError&&!this.useVideoLoad)return t.vtype="MP4_2",this._MSEError=!0,null==(r=this.mp4)||r.cancelLoading(),this._startDegradedPlayback(o,t.paused),void this.emit(hs);this.emit(hs),this.useVideoLoad&&n(e.eventName,null==e?void 0:e.error)}})),this._isEventInit=!0}getBufferDur(){var e;if(null==(e=this.player)||!e.buffered)return 0;const{buffered:t}=this.player;let n=0;for(let e=0,r=t.length;e0){for(let e=0;e>>changeState[${e}]`,n,r,JSON.stringify(t)),this.states.push({state:e,t1:n,t2:r,data:t}),this._pTime=Mi()}get softDecode(){var e,t;return"xg-video"===(null==(t=null==(e=this.player)?void 0:e.config)?void 0:t.mediaType)}_initH265MseProxy(){const{player:e}=this;e.video instanceof HTMLVideoElement&&this.h265_h264_switch(this.playerConfig.mediaType);const t=e.video;this.softDecode&&t.setPlayMode&&t.setPlayMode("VOD"),this.mseProxy=t,this.softDecode&&(e.forceDegradeToVideo=()=>{},$i(e,"lowdecode",this._lowDecoder),$i(e,"error",this._onError))}notSupportError(e){return this.log(Ne.LOG,e,qr),new Yo(this.player,{errorType:di.MEDIA,errorCode:hi.mse,errorMessage:`${e} ${qr}`,vid:this.playerConfig.vid})}removeAndRejectInitPromise(e){this._initPromise&&(this._removePendingPromise(this._initPromise),this._initPromise.reject(e))}_initMp4(e,t={},n={}){var r,i,o,s,a,l,u;const{config:c,player:h,playerConfig:d}=this;this.mp4&&(this.mp4.destroy(),this.mp4=null),this.changeState("MP4_NEW",{});let f=0;null!=(r=null==c?void 0:c.pcdnConfig)&&r.openPCDN&&(f=(null==(i=null==c?void 0:c.pcdnConfig)?void 0:i.switchPCDNMaxCnt)||2),null!=(o=null==c?void 0:c.pcdnConfig)&&o.adaptPCDNConfig&&(f=0),this._setCurrentDefinition(h.curDefinition.bitrate);let p=lo;null==c||c.loadRangeType;const g=null==(a=null==(s=h.curDefinition)?void 0:s.pktOffsetMap)?void 0:a.find((e=>(null==e?void 0:e.time)===((null==c?void 0:c.firstLoadTimePos)||5))),m=null==g?void 0:g.offset,v=function(e,t){const{getRequestOptionsCallback:n,reqOptions:r}=e;let i=null;return i=t.reqOptions?t.reqOptions:"Function"===Pi(n)?n(t):r,{...r,...i}}(this.config,{url:e});this.mp4=new p(e,h.curDefinition.bitrate,{segmentDuration:c.segmentMinDuration,enableWorker:c.enableWorker,codecType:this.codecType,chunkSize:c.chunkSize,firstLoadSize:m,duration:d.duration||0,fileSize:n.fileSize||0,playerId:this.playerId,vid:d.vid,useUrlRange:c.useUrlRange,retryCount:c.retryCount,retryDelay:c.retryDelay,timeout:c.timeout,onProcessMinLen:c.onProcessMinLen,supportHevc:c.supportHevc,afterLoadeddataCallBackLen:c.afterLoadeddataCallBackLen,firstLoadBuffer:c.firstLoadBuffer,logger:this.logger,switchPCDNMaxCnt:f,reqOptions:v,fixEditListOffset:c.fixEditListOffset},this.config._backupURL,this.firstFrameTime,""),this.mp4.once(Xi,this._onMp4MetaReady),this.mp4.on(zi,this._onMp4Error),this.mp4.on(Wi,this._updateDrmConfig),this.mp4.on(qi,this._updateMSE),this.mp4.on(Qi,this._onMp4Progress),this.mp4.on(Ki,this._onMp4DataCallBack),this.mp4.on(eo,(e=>{this.player&&this.player.emit("source_error",e)})),this.mp4.on(no,(e=>{var t,n;const{player:r,config:i}=this;this.emit(hs),this.log(Ne.LOG,"not match remove buffer start,buffer,",JSON.stringify(null==(t=null==r?void 0:r.buffered2)?void 0:t.bufferedList),", removeRange,",JSON.stringify(e)),null==(n=this.mse)||n.remove(nt.VIDEO,e[0]+.1,e[1]-.1).then((()=>{var e;this.log(Ne.LOG,"not match remove buffer end,",JSON.stringify(null==(e=null==r?void 0:r.buffered2)?void 0:e.bufferedList));const{currentTime:t}=r;(null==i?void 0:i.loadRangeType)===ii&&(r.currentTime=t,this.log(Ne.LOG,"not match remove buffer end, fix currentTime",r.currentTime))})).catch((()=>{}))})),this.mp4.on(Zi,(e=>{this.pcdn&&e&&this.pcdn.removePCDNNode(e.vid,e.bitrate,e.url)})),this.mp4.on(Yi,(e=>{this.player&&(this.player.rawSrc=e,this.player.emit("initialUrl",{url:e}),this.player.emit("changeHost",Ii(e)))})),this.mp4.on(Ji,(async e=>{var t;await(null==(t=this.mp4)?void 0:t.cancelLoading()),this._curLoadSegmentIdx=e,this.log(Ne.LOG,"[update curLoadSegmentIdx]",e)})),this.mp4.on(to,(e=>{var t,n,r;if(!this.player)return;const{vid:i}=d,o={vid:i,taskType:1,changeCnt:null==(t=this.mp4)?void 0:t.getCurSwitchPCDNCnt(),traceId:null==(r=null==(n=this.mp4)?void 0:n.pcdnTraceInfo)?void 0:r.trace_id},s=function(e,t,n={}){const{vid:r,taskType:i,changeCnt:o,traceId:s}=n,{bitrate:a,definition:l,file_id:u}=t,c={vid:r,task_type:i,change_cnt:o,definition:l,bitrate:a,fileid:u};return((null==e?void 0:e.load_type)||Jr)===Jr?c.cdn_size=e.len:(c.pcdn_size=e.len,c.trace_id=s),c}(e,this._currDefinition,o);this.player.emit("prf_data_size",s);const a=(null==e?void 0:e.load_type)||Jr;this.mp4&&this.mp4.updateLoadInfo(a,e.len),_i&&console.log("prf_data_size emit, vid,",i,",loadType,",a,", task_type, 1",",len,",e.len)})),this.mp4.MP4Loader.on(Wr,(e=>{var t,n,r,i,o,s,a,l,u,c;_s=e.speed,function(e,t){e.speed||(e.speed=[]);const{speed:n}=e;n.push(t),n.length>10&&n.shift()}(this.debugInfo,e.speed);const h=(null==(t=null==e?void 0:e.priOptions)?void 0:t.type)||Jr;this.emit(Wr,{speed:e.speed,type:h});const d=(null==(n=this.playerConfig)?void 0:n.vid)||(null==e?void 0:e.vid);if((null==e?void 0:e.len)>0){if(!this.player)return;const t=(null==(r=null==e?void 0:e.priOptions)?void 0:r.type)||Jr,n=(null==(i=this.adaptRangeRes)?void 0:i.length)>0?this.adaptRangeRes.shift():{},h=null==(o=this.mp4)?void 0:o.getCurSwitchPCDNCnt(),{bitrate:f,definition:p,file_id:g}=this._currDefinition,m={vid:d,task_type:1,change_cnt:h,bitrate:f,definition:p,fileid:g},v=Ui(n),y=function(e,t){const n=Ai(t.len,t.time),r={cdn_size:0,cdn_speed:0,pcdn_size:0,pcdn_speed:0};return e===Jr?(r.cdn_size=t.len,r.cdn_speed=n):(r.pcdn_size=t.len,r.pcdn_speed=n),r}(t,e),_={...m,...v,...y},{idx:T}=n;this.player.emit("prf_data_size",_),_i&&console.log("prf_data_size emit,",T,JSON.stringify(_));const b=e.index?null==(l=null==(a=null==(s=this.mp4)?void 0:s.adaptTimeRange[e.index])?void 0:a.timeRangeIdx)?void 0:l[1]:null;if(b&&b>=this.mp4.timeRange.length-1)for(;(null==(u=this.adaptRangeRes)?void 0:u.length)>0;){const e=this.adaptRangeRes.shift(),t=null==(c=this.mp4)?void 0:c.getCurSwitchPCDNCnt(),n={...m,...y,...Ui(e)};n.change_cnt=t,this.player.emit("prf_data_size",n),_i&&console.log("prf_data_size emit,",T,JSON.stringify(n))}this.mp4&&this.mp4.updateLoadInfo(t,e.len)}})),null!=(l=null==c?void 0:c.pcdnConfig)&&l.adaptPCDNConfig&&(null==(u=this.mp4)||u.setSwitchPCDNCallBack((()=>{const{pcdn:e}=this;if(!e)return-1;const t=e.getPCDNChangeCnt()||-1;return this.log(Ne.LOG,"[updateSwitchPCDNMaxCnt]",t),t}))),this.changeState("MP4_INIT",{}),this.emit("loadstart_mse"),t||(t={}),this.mp4.init(t),this._emitDefinitionChangeDetailEvent(0)}_checkPreloader(){const{playerConfig:e}=this,t=new po,n={method:"checkPreloader",success:0,type:"error",cacheKey:""};this.changeState("CHECK_PRELOAD");const{curDefinition:r,preloader:i}=this.player;if(!i)return this.changeState("PRELOAD_ERROR",{t:2}),n.success=0,n.error=new Error("no_preloader"),t.resolve(n),t;const o=r.cacheKey?r.cacheKey:i.generateUniqueKey({vid:e.vid,definition:r.definition||-1,vtype:e.vtype,codecType:e.codecType});return n.cacheKey=o,o?i.getPreLoadData(o).then((e=>{if(e){const{bitrate:i,orgDefinition:s}=e;if(i&&r.bitrate&&i!==r.bitrate)return this.preLoadData=null,n.success=0,n.error=new Error(`bitrate_not_match_cut_${r.bitrate}_cache_${i}`),this.changeState("PRELOAD_ERROR",{bitrate:i,ck:o}),t.resolve(n),void this.log(Ne.LOG,`>>>check Preloader bitrate_not_match cacheKey${o}\n curDefinition:${r.bitrate} cache:${i}`);r.orgDefinition=s,yi&&console.log(">>>>check Preloader result",o,e),this.preLoadData=e,this.emit("PRELOAD_INFO",this.preLoadData),this.emit("hitCache",e),n.success=1,n.data=e,ni.set(o,!0),this.changeState("PRELOAD_OK",{l:this.preLoadData.byteLength,ck:o}),e.mediaSegList&&e.mediaSegList.length>0||e.buffer&&e.buffer.byteLength>0?this.hitpreload=!0:this.hitpreload=!1,t.resolve(n)}else this.preLoadData=null,this.changeState("PRELOAD_ERROR",{t:0}),n.success=0,n.error=new Error("none_preload"),t.resolve(n)})):(this.changeState("PRELOAD_ERROR",{t:2}),n.success=0,n.error=new Error("none_preload"),t.resolve(n)),t}_initEME(e,t){var n,r;const i=Fi(this.config),{useEME:o}=this.config;if(i&&o&&!Ts.checkEMEValid())return this.log(Ne.ERROR,"checkEMEInValid"),void this._errorHandler(new Yo(this.player,{errorType:di.MEDIA,errorCode:hi.eme_hijack,errorMessage:"checkEMEInValid",vid:this.playerConfig.vid}));const{player:s,config:a}=this;this._updateDrmConfig(t),this.log(Ne.LOG,"useEME: ",a.useEME),null==(n=this._secretkey)||n.setOptions('video/mp4; codecs="avc1.64001E"','audio/mp4; codecs="mp4a.40.2"'),null==(r=this._secretkey)||r.setupEME(s.video)}async _initMse(e,t=!1){var n;const{useEME:r}=this.config;if(Fi(this.config)&&r&&!Ts.checkMSEValid())return this.log(Ne.ERROR,"checkMSEInValid "),void this._errorHandler(new Yo(this.player,{errorType:di.MEDIA,errorCode:hi.mse_hijack,errorMessage:"checkMSEInValid",vid:this.playerConfig.vid}));if(null==(n=this.player)||n.emit("codecsupdate",e.videoCodec),this.config.frameFreeze){if(this.log(Ne.LOG,"release freezed frame"),this.mse){const e=this.mse;this.mse=null,await e.unbindMedia()}this.player&&this.player.src&&(this.player.removeAttribute("src"),this.player.load())}else this.updateMSEDuration();const i=function(e,t){const n=e&&e.checkCodecH265(),r=e&&e.checkCodecH266(),i=!!t.videoCodec,o=!!t.audioCodec;let s;return s=i&&o?n?'video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.5"':r?'video/mp4; codecs="bvc2.1.6.L93.B0, mp4a.40.5"':'video/mp4; codecs="avc1.64001E, mp4a.40.5"':i?n?'video/mp4; codecs="hev1.1.6.L93.B0"':r?'video/mp4; codecs="bvc2.1.6.L93.B0"':'video/mp4; codecs="avc1.64001E"':'video/mp4; codecs="mp4a.40.5"',s}(this.mp4,e),o={[nt.VIDEO]:{mimeType:"video/mp4",codec:i}};let s;this.mse?(this.log(Ne.LOG,"MSE exit"),s=new po,s.resolve()):(this.log(Ne.LOG,"new MSE"),this.mse=new nt,s=this.mse.bindMedia(this.player.video)),s.then((e=>{var n;this.changeState("MSE_OPEN");const{firstFrameTime:r}=this;r.initmse_sbopen=null==e?void 0:e.costtime,this._loadStartEventTime>0&&(r.mseopen=Mi()-this._loadStartEventTime);const i=Object.keys(o);try{for(let e=0;e{this.changeState("MSE_OPEN_DONE"),this._isMseInit=!0,this._onTimeUpdate()})).catch((async e=>{var n;this.config.reUseMSE=!1,this.log(Ne.WARN,"MSE createOrChangeSource catch err: ",null==e?void 0:e.message),await(null==(n=this.mse)?void 0:n.unbindMedia()),this.mse=null,this._isMseInit=!1,t?this.MSEErrorHandle(e):this._initMse(this.mp4.meta,!0)}))}}catch(e){this.MSEErrorHandle(e)}})).catch((e=>this.MSEErrorHandle(e))),this.changeState("MSE_INIT")}MSEErrorHandle(e){const t=new Yo(this.player,{errorType:di.mse,errorCode:hi.mse,vid:this.playerConfig.vid,errorMessage:e.message,mediaError:{code:hi.mse,message:e.message}});this.log(Ne.ERROR,"initMse error: ",null==e?void 0:e.message),this._errorHandler(t)}_appendInitSeg(e){!this.mse||this._MSEError||(this.changeState("MSE_INITSEG"),this.mse.append(nt.VIDEO,e,{vid:this.playerConfig.vid,range:null,dataLen:e.byteLength,isinit:!0}).then((e=>{this.firstFrameTime.metaready_initsegend=null==e?void 0:e.costtime,this.changeState("MSE_INITSEG_OK",{costtime:null==e?void 0:e.costtime})})),this.config.useEME&&this._secretkey&&this._secretkey.encryptHandle())}_checkMetaInfo(e){if(!e)return new Yo(this.player,{errorType:di.DEMUX,errorCode:hi.metaError,errorMessage:"meta is null",vid:this.playerConfig.vid});const t=this.mp4.checkCodecH265(),n=this.mp4.checkCodecH266();return this.changeState("MP4_META_READY",{isH265:t,isH266:n}),!t||(this.codecType!==li&&(this.codecType=li,this.log(Ne.LOG,"codecType fix ",this.codecType)),this.softDecode||this.config.supportHevc)?n&&(this.codecType!==ui&&(this.codecType=ui,this.log(Ne.LOG,"codecType fix ",this.codecType)),!this.config.supportVvcc)?this.notSupportError(this.codecType):null:this.notSupportError(this.codecType)}_stopProgress(){this.log(Ne.LOG,"stopProgress",this._hasStartProgress),this._hasStartProgress=!1,this._requestTimer&&this._requestTimer.stop(),this._bufferBreakTimer&&(clearTimeout(this._bufferBreakTimer),this._bufferBreakTimer=null,this._bufferBreakFlag=void 0),this._seekResumTimer&&(clearTimeout(this._seekResumTimer),this._seekResumTimer=null)}checkReStartTimer(){const e=Mi()-this._lastTimeupdateTime2;e>2*this.config.tickInSeconds*1e3&&!this._offineLine&&(this.log(Ne.LOG,"checkReStartTimer reStart timer",e,Mi()),this._stopProgress(),this._startProgress(),this._lastTimeupdateTime2=Mi())}_bindNetworkStateChange(){window.addEventListener("online",this._onOnlineHandler),window.addEventListener("offline",this._onOfflineHandler)}_unbindNetworkStateChange(){window.removeEventListener("online",this._onOnlineHandler),window.removeEventListener("offline",this._onOfflineHandler)}_onSuperStart(e){const{player:t}=this;Si(`_onSuperStart:${e}`,this.mse),t.video.src=e,this.once("canplay",(()=>{t.play(),this.on("waiting",this._onWaiting)}))}_appendBuffer(e,t,n={},r){const{mse:i,playerConfig:o,player:s}=this,{vid:a}=o;this.log(Ne.LOG,"appendStart",a,n.fragIndex,JSON.stringify(n.range)),this._MSEError?this.log(Ne.ERROR,"_MSEError, not append return"):i.append(e,t,{vid:a,fragIndex:n.fragIndex,range:n.range,dataLen:t.byteLength,state:r}).then((e=>{var t,i,o,a,l,u,c;const h=s.getBufferedRange();this.log(Ne.LOG,"appendEnd ",null==(t=null==e?void 0:e.context)?void 0:t.fragIndex,JSON.stringify(null==(i=null==e?void 0:e.context)?void 0:i.range),null==(o=null==e?void 0:e.context)?void 0:o.dataLen,", costTime,",null==e?void 0:e.costtime,", opt,",null==e?void 0:e.name,",buffer,",JSON.stringify(h),s.currentTime),this.checkBufferArriveEndTime();const d=this.firstFrameTime;if(d.loadst_loadeddata<0){d.apcnt++;const t=(null==(a=null==e?void 0:e.context)?void 0:a.dataLen)||0,n=(null==e?void 0:e.costtime)||0;d.aplen+=t,d.data_ap+=n;let r=!1;for(let e=this.states.length-1;e>=0;e--)if("APPEND_DATA_OK"===this.states[e].state){this.states[e].data.cnt+=1,this.states[e].data.costime+=n,this.states[e].data.dataLen+=t,r=!0;break}r||this.changeState("APPEND_DATA_OK",{costime:n,dataLen:t,cnt:1})}const f=null==(c=null==(u=null==(l=this.mp4)?void 0:l.adaptTimeRange[n.fragIndex])?void 0:u.timeRangeIdx)?void 0:c[1];if(this.mse&&r&&f>=this.mp4.timeRange.length){const{buffered:e}=this.player;e&&(null==e?void 0:e.length)>0&&(this.bufferEndTime=e.end(e.length-1)),this._isEnded(),this.log(Ne.LOG,"loaded ended !!!==>>>",JSON.stringify(n.range),", fragIndex,",n.fragIndex,", bufferEndTime,",this.bufferEndTime,",meta_duration,",this.mp4.meta.duration)}})).catch((e=>{const{player:t,mse:r}=this;if(this._MSEError||!t)return;const i=t.media||t.video;if(e&&null!=r&&r.isFull()){this.log(Ne.WARN,"[MSE is full]");const e=t.getBufferedRange(t.buffered2);this._checkRemoveSourceBuffer(e,t.currentTime,!0)}else{const r=`${null!=i&&i.error?[i.error.code,i.error.message].join("-"):"MEDIA_EMPTY"}`,o=`${(null==e?void 0:e.errorCode)||""}-${(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message)||"MSE_EMPTY"}|${r}`;this._MSEError=!0,this.changeState("_MSEError",{fragIndex:null==n?void 0:n.fragIndex,range:null==n?void 0:n.range}),this.log(Ne.LOG,"MSE append error",null==n?void 0:n.fragIndex,null==n?void 0:n.range);const s=new Yo(t,{errorType:di.MEDIA,errorCode:hi.mseAppend,vid:a,errorMessage:o,mediaError:{code:hi.mseAppend,message:o}});this._errorHandler(s)}}))}async _loadData(){if(this.mp4&&this._isMseInit){this.loadstart<0&&(this.loadstart=Mi());try{await this.mp4.load(this._curLoadSegmentIdx,this._loadDataSuccess)}catch(e){this.log(Ne.ERROR,"[Index] _loadData error",this.playerConfig.vid,null==e?void 0:e.message)}}}getDataBitRate(e){const{mp4:t,playerConfig:n}=this,{definition:r}=n;if(!t||!r||r.list)return 0;const i=t.getDataBitRate(e),{list:o}=r;let s=0;for(let e=0;o&&e.1||!r&&n.paused||r&&this.playFlag&&n.paused)(1===this._bufferBreakFlag||2===this._bufferBreakFlag)&&(this.log(Ne.LOG,"视频没有卡死,重置卡死标记,curtime,",n.currentTime),this._bufferBreakFlag=0,clearTimeout(this._bufferBreakTimer),this._bufferBreakFlag=null);else if(!this._bufferBreakFlag){this._bufferBreakFlag=1;const i=JSON.stringify(null==(e=null==n?void 0:n.buffered2)?void 0:e.bufferedList);this.log(Ne.LOG,`卡死计时开始! ${t.waitingTimeOut}ms后确认卡死,`,n.currentTime,i),this._bufferBreakTimer=setTimeout((()=>{if(!(this.isDestroy||t.disableInactiveWaitingCheck&&(!r||null!=n&&n.paused))){if(1===this._bufferBreakFlag){const e=n.currentTime,t=n.bufferedPoint;if(t.end>0&&t.end-e>=2)return void this.retrySeekResum(e)}this._bufferBreakFlag=2,this.waitTimeoutDegrade()}}),t.waitingTimeOut)}this._lastCurrentTime=n.currentTime}}waitTimeoutDegrade(){var e,t,n;const{player:r}=this;this.changeState("wait_timeout"),this.log(Ne.LOG,"确认卡死!!!,curtime,",r.currentTime,JSON.stringify(null==(e=null==r?void 0:r.buffered2)?void 0:e.bufferedList),",duration,",null==(n=null==(t=this.mp4)?void 0:t.meta)?void 0:n.duration),this.emit("waittimeout");const i=document.hidden||"hidden"===document.visibilityState,o=new Yo(this.player,{errorType:di.RUNTIME,errorCode:i?hi.waitTimeoutWithHidden:hi.waitTimeout,errorMessage:"wait_timeout",vid:this.playerConfig.vid});this._errorHandler(o)}async retrySeekResum(e){const{player:t,config:n}=this;if(this.changeState("retrySeek"),this.log(Ne.LOG,"卡死但有超过2s的buffer,seek下!!!"),clearTimeout(this._seekResumTimer),this._resumePlay=!1,n.waitingRetrySeekTimes>0&&n.waitingRetryDuration){const r=Math.min(n.waitingRetrySeekTimes,3);this._currentSeekTimes=0,this.off("playing",this._onResumePlaying),this.once("playing",this._onResumePlaying);const i=()=>{if(t&&!this._resumePlay&&!t.paused)return this._currentSeekTimes{this._resumePlay=!0})),this._seekResumTimer=setTimeout((()=>{this._resumePlay||this.waitTimeoutDegrade(),this._seekResumTimer=null}),Math.ceil(n.waitingTimeOut/2))}_isInBuffer(e,t=0){let n=!1;const{buffered:r}=this.player.video;for(let i=0;it.currentTime&&t.video&&t.video.buffered))return!0;const{buffered:n}=t.video;return 1===n.length||this._isInBuffer(e,.2)}checkURLExpired(e,t){var n,r,i,o;const s=function(e){if(!e||"String"!==Pi(e))return 0;let t=0;try{const n=new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),r=e.match(n);if(null!==r)t=parseInt(r[2],10);else{const n=e.split("/");n.length>5&&8===n[4].length&&(t=parseInt(n[4],16))}return t>0?t10&&this.timerStepList.shift(),this._lastTimeupdateTime2>0&&this.timerStepList.push(Mi()-this._lastTimeupdateTime2)}_onTimeUpdate(){this.pushTimerStep(),this._lastTimeupdateTime2=Mi();const{mse:e,mp4:t,player:n,config:r}=this;if(!n||this.useVideoLoad||!t)return;this.checkBufferArriveEndTime();const i=n.getBufferedRange();Mi()-this._lastCheckTime>1e3&&(this._lastCheckTime=Mi(),this._loadStuckCheck(),this._startUrlExpiredCheck(),this._checkRemoveSourceBuffer(i,n.currentTime));const{timeRange:o}=t;if(o&&!(o.length<1)&&(e||this.mseProxy)&&this.canDownload){let e=r.maxBufferLength,t=!1;(this.playFlag&&n.paused||!this.isActive)&&(t=!0);const{nextBufferLength:o,minBufferLength:s,adaptRange:a,noPreloadAddBufferLen:l}=r,u=null==a?void 0:a.targetCacheControl;t?e=n.isInstNext&&o>=0?o:s:u&&(e=this.adaptRange.getAdaptCacheBuffer()),!this.preLoadData&&u&&(e+=l);const c=n.currentTime+e;i[1]-c<0&&(this.isOpenPCDN(i[1]),(null==r?void 0:r.loadRangeType)===ii?this.sizeRangeCheckLoad(t,e,i[1]-n.currentTime):this.gopRangeCheckLoad(t,c,e)),this.playFlag&&!this._hasTriggerBufferThreshold&&this._startBufferCheck()}}sizeRangeCheckLoad(e,t,n){var r,i,o;const{player:s,mp4:a}=this,{adaptTimeRange:l}=a,u=l.length;if(!u||(null==(r=l[u-1])?void 0:r.range[1])<(a.size-1||s.curDefinition.size-1)||!l[u-1].downloaded){const r=l.findIndex((e=>!e.isLoading));if(null==l||!l.length||r>=0||l[u-1].downloaded){const{adaptRangeRes:u,loadDuration:c}=this.calculateAdaptRange(e,t),h=null==(i=this.adaptRange)?void 0:i.getAdaptRangeSize(c);h>0&&(u.loadSize=h),u.loadDuration=c,this._curLoadSegmentIdx=r<0?a.updateAdaptTimeRange(null,c,h):r;let d=this._curLoadSegmentIdx;l[d].downloaded||(d=Math.max(d-1,0));const f=l[d];if(n>0&&(null==f?void 0:f.endTime)-s.currentTime>=t)return;const p=l[this._curLoadSegmentIdx];if(this._curLoadSegmentIdx>=0&&this._isInBuffer(p)&&!this._isChangeDefinition&&this._curLoadSegmentIdx>=0&&p.endTime-p.startTime>1){const e=l[this._curLoadSegmentIdx];return e.downloaded=!0,e.isLoading=!0,this.log(Ne.LOG,`onTimeUpdate, ${this._curLoadSegmentIdx} download segment, has buffer`,p.startTime,p.endTime,s.currentTime),void(a.seekTime=p.endTime)}u.idx=this._curLoadSegmentIdx,(!this.adaptRangeRes.length||(null==(o=this.adaptRangeRes[u.length-1])?void 0:o.idx)!==this._curLoadSegmentIdx)&&(this.adaptRangeRes.push(u),this.log(Ne.LOG,"adaptRangeRes>>>>",u)),this.log(Ne.LOG,"[onTimeUpdate],load index==>>>, ",this._curLoadSegmentIdx,JSON.stringify(l[this._curLoadSegmentIdx])),this._loadData()}}}gopRangeCheckLoad(e,t,n){const{timeRange:r,adaptTimeRange:i}=this.mp4,{player:o}=this;r.every(((r,s)=>{var a,l,u,c;if(void 0!==r.adaptTimeRangeIdx&&r.adaptTimeRangeIdx>=0&&i&&i[r.adaptTimeRangeIdx].downloaded)return!0;const h=this.mp4.getAdaptIdxBySrcIdx(s,!0),d=h>=0?i[h]:null,f=h>=0&&this._isInBuffer(d);if(!this._isChangeDefinition&&h>=0&&d.endTime-d.startTime>1&&f)return i[h].downloaded=!0,i[h].isLoading=!0,this.log(Ne.LOG,`onTimeUpdate, ${h} download segment, has buffer`,d.startTime,d.endTime,o.currentTime),!0;if(r.startTime-o.currentTime>>>",t));const d=i[this._curLoadSegmentIdx];if(this._isInBuffer(d))return d.downloaded=!0,d.isLoading=!0,this.log(Ne.LOG,`onTimeUpdate_, ${this._curLoadSegmentIdx} download segment, has buffer`,d.startTime,d.endTime,o.currentTime),!0;this.log(Ne.LOG,"[onTimeUpdate],load index==>>>, ",this._curLoadSegmentIdx,JSON.stringify(this.mp4.adaptTimeRange[this._curLoadSegmentIdx])),this._loadData()}}))}checkBufferArriveEndTime(){const{player:e,mse:t,mp4:n}=this;if(!e||!t||!n)return;const r=e.getBufferedRange(),i=n.getMediaEndTime();i>0&&r[1]>=i&&!t.isEnded&&(this.log(Ne.LOG,"checkBufferArriveEndTime endOfStream, enfTime",i,", bufferRange,",JSON.stringify(r),",currentTime,",e.currentTime),t.endOfStream())}calculateAdaptRange(e,t){var n,r;let i;const o={forceSetMin:e};null!=(n=this.pcdn)&&n.isOpenAdaptPCDN&&(o.PCDNInBuffer=this.pcdn.curPCDNInBuffer,o.PCDNOutBuffer=this.pcdn.curPCDNOutBuffer);const s=null==(r=this.config)?void 0:r.adaptRange;return!this.playFlag||e?i=this.config.minBufferLength:null!=s&&s.rangeControl?(i=this.adaptRange.getAdaptLoadDuration(),o.loadTarDuration=i):i=this.config.rangeMaxDuration,null!=s&&s.targetCacheControl&&(o.cachedBufferDur=t),!this.playFlag&&null!=s&&s.rangeControl&&(o.loadTarDuration=i),{adaptRangeRes:o,loadDuration:i}}checkReUseMSE(e,t){var n;const{mse:r}=this;if(r)if(e||this.config.reUseMSE){r.clearOpQueues(nt.VIDEO,t),r.abort(nt.VIDEO);const e=null==(n=this.player)?void 0:n.buffered;if((null==e?void 0:e.length)>0){const t=e.end(e.length-1);this.log(Ne.LOG,"reUseMSE remove buffer, 0-",t),this._canUpdateDuration=!1,this.removeBuffer(nt.VIDEO,0,t,(()=>{var e,t;this._canUpdateDuration=!0,null!=(t=null==(e=this.mp4)?void 0:e.meta)&&t.duration&&this.updateMSEDuration()}))}}else r.unbindMedia(),this.mse=null,this._unloadVideo()}updateMSEDuration(){var e;const{mse:t,mp4:n}=this,r=null==(e=null==n?void 0:n.meta)?void 0:e.duration;this._canUpdateDuration&&r&&r!==t.duration&&(this.log(Ne.LOG,"updateMSEDuration ",r,",oldDuration,",t.duration),t.updateDuration(r),this._canUpdateDuration=null)}_reset(){this._definitionChangePointInfo=null,this._isReceiveEndedEvent=!1,this.adaptRangeRes=[],this.states=[],this.hitpreload=!1,this._sTime=Mi(),this._isChangeDefinition=!1,this._removeBuffeEndTime=0,this._usePaused=!1,this.useVideoLoad=!1,this._isMseInit=!1,this.endofstream=!1,this._curLoadSegmentIdx=0,this.emitExpireTimestamp=null,this.preLoadData=null,this.forPreloadTimeCache=null,this.playFlag=!1,this.waitLevelStartTime=-1,this._waitAdjustTimeCnt=0,this._initPromise&&"pending"===this._initPromise.state&&this._initPromise.reject(cs),clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,this._stopProgress(),this.mp4&&(this.mp4.destroy(),this.mp4=null),this.mseProxy&&(Bi(this.player,"lowdecode",this._onDegrade),Bi(this.player,this._onError)),this.config.frameFreeze||this._unloadVideo(),this._cancelPendingPromises(),this._abrService&&(this._abrService.destroy(),this._abrService=null);const e=this.firstFrameTime;Object.keys(e).forEach((t=>{e[t]="apcnt"===t||"aplen"===t?0:"newplayer"===t?Mi():-1})),clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null,this.canDownload=!0,this.loadstart=-1,this._loadStartEventTime=-1,this.startLoadData=-1}removeErrorUrls(e,t,n){return e.errorCode===hi[403]&&this._emitExpireEvent(e),n}checkIsDegraded(e){const{notDegradeErrorList:t}=this.config;return!((null==t?void 0:t.length)>0&&(e.errorCode===hi.timeout&&t.indexOf("timeout")>=0||e.errorCode===hi[403]&&(t.indexOf(403)>=0||t.indexOf("403")>=0)||e.errorCode===hi[404]&&(t.indexOf(404)>=0||t.indexOf("404")>=0)))}_startDegradedPlayback(e,t){this.canDownload=!1;const{player:n,playerConfig:r,config:i}=this;this.endofstream=!1,this._currentTime=n.currentTime||0,this.player.pause(),this._reset(),this._replay=null;const{H264DefinitionList:o}=r;if(this.codecType===li&&this.softDecode)this.log(Ne.LOG,"h265 softDecode err,degrade use 264 play",r.vid),this._onDegrade(e);else if(this.codecType===ai||i.supportHevc||i.supportVvcc||(null==o?void 0:o.length)>0){const{drm:s,kid:a,drmKeyToken:l,keyValue:u,secretKey:c}=i;if(s||a||l||u||c)s&&Object.keys(s).map((t=>{s&&(e[t]=s[t])})),this.log(Ne.ERROR,"final error !!!!, ",r.vid,null==e?void 0:e.errorCode,null==e?void 0:e.errorMessage),this.emit("error",e);else{this.log(Ne.LOG,this.codecType,"MSE degrade video,",r.vid,n.currentTime),this.emit(ds,{errc:null==e?void 0:e.errorCode,err_msg:(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message),codec_type:this.codecType,media_type:r.mediaType}),this.useVideoLoad=!0,this.destroyMSE();const i=()=>{this._currentTime&&(n.currentTime=this._currentTime),this.log(Ne.LOG,"DegradedPlayback update currentTime",r.vid,this.codecType,this._currentTime),t?this.player.pause():this.player.play(),this._removeMetaDataEvent()};this._addMetaDataEvent(i);let s=r.url;const a=(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message);if((null==a?void 0:a.indexOf(qr))>=0&&(null==o?void 0:o.length)>0){const e=o.length,t=this.player.curDefinition.definition;let n=t&&o.find((e=>e.definition===t));n||(r.H264DefinitionList.sort(((e,t)=>e.bitrate-t.bitrate)),n=r.H264DefinitionList[Math.floor(e/2)]),n&&(s=n.url,this.playerConfig.codecType=ai,this.codecType=ai)}this._setPlayerSrc(s)}}else this.log(Ne.ERROR,"degrade player failed"),this.emit("error",e)}getAdaptTimeRangeIdx(e){var t,n;const{config:r,adaptRange:i}=this;let o=r.segmentMinDuration;return i&&null!=(t=null==r?void 0:r.adaptRange)&&t.rangeControl&&(o=i.getAdaptLoadDuration()),null==(n=this.mp4)?void 0:n.updateAdaptTimeRange(e,o)}_startProgress(){this.initTimer(),this._requestTimer.start(),this._hasStartProgress=!0}_unloadVideo(){this.log(Ne.LOG,"unloadVideo");const{player:e}=this;try{e.video&&e.video.src&&!/^blob/.test(e.currentSrc)&&!/^blob/.test(e.video.src)&&(this.log(Ne.LOG,"unloadVideo src"),e.video.removeAttribute("src"),e.video.load())}catch(e){this.log(Ne.ERROR,"unloadVideo error",null==e?void 0:e.message)}}_addPendingPromise(e){this._pendingPromises.push(e)}_removePendingPromise(e){this.log(Ne.LOG,"removePendingPromise",null==e?void 0:e.id);const t=this._pendingPromises.indexOf(e);t>-1&&this._pendingPromises.splice(t,1)}_cancelPendingPromises(){this._pendingPromises.length>0&&this._pendingPromises.forEach((e=>{e.reject(cs)})),this._pendingPromises=[]}_onMediaExpired(){this.log(Ne.LOG,"MediaExpired stopProgress"),this._stopProgress(),this.emit(Qr.MEDIA_EXPIRED)}_isEnded(){var e,t;const{player:n,mp4:r}=this,i=n.bufferedPoint,o=i?i.end:0,s=n.currentTime;s>1&&o>s&&(o-s>=2||n.duration-s<1)&&2===n.video.readyState?Mi()-this._lastCheckLagTime>=3e3&&(this.log(Ne.LOG,"[has buffer but waiting,seek 0.2 adjust],curTime,",s,", bufferend,",o,", duration,",null==(e=null==r?void 0:r.meta)?void 0:e.duration),n.currentTime=s+.2,this._lastCheckLagTime=Mi()):this._lastCheckLagTime=Mi();const{seeking:a}=n.video;return!this.endofstream&&this.bufferEndTime>0&&this.mse&&!a&&this.bufferEndTime-s<.5&&(this.log(Ne.LOG,"[isEnded endOfStream],curTime,",n.currentTime,", bufferend,",o,", duration,",null==(t=null==r?void 0:r.meta)?void 0:t.duration),this.endofstream=!0,this.mse.endOfStream().then((()=>{}))),!!(r&&r.meta&&!a&&r.meta.duration-s<.5)&&(this._stopProgress(),this.log(Ne.LOG,"[isEnded],stopProgress and endOfStream,curTime, ",n.currentTime,", bufferend,",o,", duration,",r.meta.duration),this.mse&&this.mse.endOfStream().then((()=>{})),!0)}emitVideoEvent(e){if(this._checkEndedTimer)return;const{player:t,mp4:n}=this;this._checkEndedTimer=setTimeout((()=>{this._checkEndedTimer=null,!this._isReceiveEndedEvent&&n.meta.duration-t.currentTime<.5&&(this.log(Ne.LOG,"[ do emit video ended event],curTime,",t.currentTime,", bufferend,",e,", duration,",n.meta.duration),this.emit("ended"))}),2e3)}_clearMediaKeys(){const{player:e}=this;e.video&&"function"==typeof e.video.setMediaKeys&&e.video.setMediaKeys(null).catch((()=>{}))}_checkRemoveSourceBuffer(e,t,n,r){const{mse:i,mp4:o,player:s}=this;if(i&&o&&s&&(n&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=s.getBufferedRange(s.buffered2)),t||(t=s.currentTime),!(!n&&Mi()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=Mi(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||i.isFull())))){const n=r?e[1]:t-(i.isFull()?0:15),s=o.getFragmentIdx(n);if(s>0&&(r||o.timeRange[s].startTime>>",r,n,t),this.removeBuffer(nt.VIDEO,r,n)):i.isFull()&&!this._removeBufferTimer&&(this._removeBufferTimer=setTimeout((()=>{this._checkRemoveSourceBuffer(null,null,!0)}),1e4))}}}onMediaUpdate(e){const{vid:t,kid:n,url:r}=e,{player:i,config:o,playerConfig:s}=this;if(t===s.vid&&n===o.kid&&r){this.playerConfig.url=r;const e=this._handlerUrl(r);o._mainURL=e.main,o._backupURL=e.backup;const t=o._mainURL;return i.rawSrc=r,this.useVideoLoad?i.src=r:this.mp4&&this.mp4.updateUrl(t),!0}return!1}enableAutoBuffer(e){if(e){if(!this._allInitPromise)return void this.log(Ne.LOG,"player destroyed!!");this._allInitPromise.then((()=>{this.log(Ne.LOG,"enableAutoBuffer true"),this._startProgress()}))}else this._stopProgress(),this.log(Ne.LOG,"enableAutoBuffer false")}get bitRateAdapter(){if(!this.player||!this.player.plugins)return null;if(this.config.needAutoBitrate){const{bitrateselector:e}=this.player.plugins;return e}return null}getDefinitonFromAdapter(e,t){if(!this.bitRateAdapter)return null;const n=this.bitRateAdapter;return n.getSuitableBitrate?n.getSuitableBitrate(e,t):n.bitRateAdapter?n.bitRateAdapter.select(e):null}addPreloader(e={}){e.playerId=this.playerId;const{preloader:t}=this.player;t?t.addPreloader(e,this.playerConfig.vid,this.playerId):this.log(Ne.LOG,"preloader has destroyed")}addPreloaderList(e=[]){const{preloader:t}=this.player;t?t.addPreloaderList(e,this.playerConfig.vid,this.playerId):this.log(Ne.LOG,"preloader has destroyed")}log(e,t,...n){const{vid:r}=this.playerConfig||{},i=r?`[Index]${r} ${t}`:`[Index] ${t}`;Si(this.logger,e,i,...n)}_emitInitFail(e){this.log(Ne.ERROR,"initFail, reason:",e),this.emit(Qr.INIT_FAIL,e)}set useVideoLoad(e){this._useVideoLoad=e}get useVideoLoad(){return this._useVideoLoad}get ready(){return this._allInitPromise}get speed(){return parseInt(ao.speed,10)}get version(){return ci}get realTimeSpeed(){return _s}get opQueueLen(){const e=this.mse&&this.mse._queue?this.mse._queue[nt.VIDEO]:[];return e?e.length:0}get loadSegmentTimeRange(){if(!this.mp4)return[0,0,0,0];const e=this.mp4.adaptTimeRange;if(e&&e.length>0&&this._curLoadSegmentIdx>=0&&this._curLoadSegmentIdx=this.urlExpireTimestamp&&this.urlExpireTimestamp>0&&!n&&e.getServerTime&&(t.serverTimeDiffPromise=t.serverTimeDiffPromise||e.getServerTime().catch((()=>0)),t.serverTimeDiffPromise.then((e=>{if(e&&(t.serverTimeDiff=(new Date).getTime()/1e3-e),(new Date).getTime()/1e3>=this.urlExpireTimestamp+t.serverTimeDiff){this.urlExpireTimestamp=(new Date).getTime()/1e3+86400;const e=new fi("network",hi[403]);this._emitExpireEvent(e)}})))}_emitExpireEvent(e){const{player:t}=this,n=(new Date).getTime()/1e3;return this.emitExpireTimestamp?n-this.emitExpireTimestamp>300&&(this.emitExpireTimestamp=n,t.emit("MEDIA_EXPIRED",e),!0):(this.emitExpireTimestamp=n,t.emit("MEDIA_EXPIRED",e),!0)}reportBugPostPlayerLog(){this.emit(hs)}}bs.isSupported=function(){return fo()&&ho()&&!uo()},bs.isEMESupported=co,bs.isSupportedWithXgmse=function(){return ho()&&!uo()},bs.isMediaSourceSupported=fo,bs.isWebAssemblySupported=ho,bs.CUSTOM_EVENTS=Qr},4629:(e,t,n)=>{"use strict";n.d(t,{lg:()=>h,Zo:()=>c});var r=n(6607),i=Object.defineProperty;let o=[],s=[],a=[];const l=class e{static setConfig(t){e.cfg=t}static getGPUVendor(){return(0,r.g)(e.cfg)}static getGPUParsedVendor(t){return(0,r.p)(t||e.getGPUVendor())}static parseVendorAsync(t){const n=e.getGPUParsedVendor(t);if(!n)return Promise.resolve(null);if(!e.cfg)throw new Error("need specify config, call setConfig() method");return function(e,t){return e?async function(e,t){let n;if(e===r.V.Intel){if(o.length)return o;n=t.intelPath}if(e===r.V.Nvidia){if(s.length)return s;n=t.nvidiaPath}if(e===r.V.Amd){if(a.length)return a;n=t.amdPath}if(!n)return Promise.resolve([]);try{const t=await fetch(n).then((e=>e.text())),i=(0,r.b)(t,e);return e===r.V.Intel&&(o=i),e===r.V.Nvidia&&(s=i),e===r.V.Amd&&(a=i),i}catch{}return[]}(e.vendor,t).then((t=>(0,r._)(t,e))).then(r.a):Promise.resolve(0)}(n,e.cfg).then((e=>({...n||{},score:e}))).catch((()=>null))}};((e,t)=>{t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:null}):e[t]=null})(l,"cfg");let u=l;function c(){let e=!1;if(typeof MediaSource>"u"||!MediaSource.isTypeSupported||function(){if(typeof navigator>"u")return!1;const e=navigator.userAgent.match(/Edg\/(\d+)\./);if(e&&e.length>=2){const t=parseInt(e[1]);return t>=117&&t<=122}return!1}())return e;if(e=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"'),e){const t=u.getGPUParsedVendor();e=!!t&&t.vendor!==r.V.CpuDeriver}return e}async function h(e){const{url:t,minDroppedFramesRate:n,minTotalVideoFrames:r}=Object.assign({url:"",minDroppedFramesRate:0,minTotalVideoFrames:0},e);let i,o,s,a;const l=new Promise((e=>{function l(t=1001,n){e({status:!1,errCode:t,robustErr:2101===t||2001===t||3e3===t,...n||{}})}!t||0===n&&0===r?l(1e3):(o=()=>{let t="";try{if(!i.getVideoPlaybackQuality)return l(2001);const{totalVideoFrames:t,droppedVideoFrames:o}=i.getVideoPlaybackQuality(),s=o/t,a={droppedFrameRate:s,droppedVideoFrames:o,totalVideoFrames:t};return void((n?s<=n:r&&t>r)?e({status:!0,...a}):l(3e3,a))}catch(e){t=(null==e?void 0:e.message)||e||"empty err msg"}l(2200,{errMsg:t})},s=()=>{const e=i.error;l(2e3,{errMsg:`${e.code}-${e.message}`})},a=()=>{const e=i.play();e&&e.then((e=>{})).catch((e=>{const t=e.message;let n=2100;/no supported source/gi.test(t)||/The media resource indicated by the src attribute or assigned media provider object was not suitable/gi.test(t)||/NotSupportedError/gi.test(t)?n=2101:/video-only background media was paused to save power/gi.test(t)?n=2103:(/the user didn't interact with the document first/gi.test(t)||/user denied permission/gi.test(t))&&(n=2102),l(n,{errMsg:t})}))},i=function(e){const t=document.createElement("video");return t.style.cssText="width:50px;height:50px;position:absolute;top:0;left:0;z-index:999999;opacity:.001;pointer-events:none;",t.muted=!0,t.autoplay=!1,t.src=e,t}(t),i.addEventListener("loadedmetadata",a,!1),i.addEventListener("ended",o,!1),i.addEventListener("error",s,!1),i.load(),document.body.append(i))}));return l.finally((()=>{i&&(o&&s&&a&&(i.removeEventListener("loadedmetadata",a,!1),i.removeEventListener("ended",o,!1),i.removeEventListener("error",s,!1),o=null,s=null,a=null),document.body.removeChild(i),i=null)})),await l}},95053:(e,t,n)=>{"use strict";n.d(t,{M:()=>ce,a:()=>re,b:()=>se,m:()=>le});var r=n(74062),i=n(40048),o=n(4629),s=n(23237),a=n(94982),l=Object.defineProperty,u=(e,t,n)=>((e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class c{constructor(e){u(this,"options"),u(this,"nodes"),this.options=e,this.nodes=[],this._init()}_init(){this.options.plugins&&Object.keys(this.options.plugins).forEach((e=>{const t=this.options.plugins&&this.options.plugins[e];if(t&&!t.ignore&&(!t.instance&&t.plugins&&Object.keys(t.plugins).length>0?t.instance=new c(t):t.cls&&(t.instance=new t.cls(t)),t.instance)){const n=typeof t.weight>"u"?1:t.weight;this.nodes.push({key:e,weight:n,instance:t.instance})}}))}getScore(){return new Promise((e=>{const t=[];this.nodes.forEach((e=>{t.push(new Promise((t=>{e.instance.getScore().then((n=>{t({key:e.key,weight:e.weight,val:n})}))})))})),Promise.all(t).then((t=>{const n={};let r=0,i=0;t.forEach((({weight:e,val:t})=>{t.score>0&&(i+=e)})),i=0===i?1:i;for(let e=0;e0&&(r+=o.weight/i*o.val.score),n[o.key]=o.val}n.score=r,e(n)})).catch(console.log)}))}getScoreSync(e){const t={};let n=0,r=0;const{nodes:i}=this;i.forEach((t=>{const{weight:n,instance:i}=t,{score:o}=t.val=i.getScoreSync(e);o>0&&(r+=n)})),r=0===r?1:r;for(let e=0;e0&&(n+=o.weight/r*o.val.score),t[o.key]=o.val}return t.score=n,t}}class h extends c{get version(){return"0.1.11"}constructor(e){super((0,a.d)({},e))}setPlayer(e,t){var n,r,i;null!=(r=null==(n=this.options.plugins)?void 0:n.render)&&r.instance&&(null==(i=this.options.plugins.render)||i.instance.setPlayer(e,t))}scoreAsync(){return this.getScore()}scoreSync(){return this.getScoreSync()}}var d=Object.defineProperty,f=(e,t,n)=>((e,t,n)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class p{constructor(e){f(this,"mappingFn"),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){try{const e=navigator.hardwareConcurrency;let t=0;return this.mappingFn&&(t=this.mappingFn(e)),{score:t,origin:e}}catch{return{score:0,origin:-1}}}}class g{constructor(e){f(this,"mappingFn"),f(this,"score",0),f(this,"origin",-1),f(this,"url"),f(this,"_getScoreCallback",(()=>{})),this.url=e.url,this.mappingFn=e.mapping}getScore(){return new Promise((e=>{if(this.url)try{const t=new Image;t.src=this.url,t.onload=()=>{const n=Date.now();"function"==typeof t.decode?t.decode().then((()=>{const t=1e3/(Date.now()-n);let r=0;this.mappingFn&&(r=this.mappingFn(t)),this.score=r,this.origin=t,e({score:r,origin:t})})):e(this.getScoreSync())},t.onerror=()=>{e(this.getScoreSync())}}catch{e(this.getScoreSync())}else e(this.getScoreSync())}))}getScoreSync(e){let t=0;return this.mappingFn&&(t=this.mappingFn(-1,null==e?void 0:e.ignoreCachedImg)),t>0?{score:t,origin:-1}:{score:this.score,origin:this.origin}}}class m{constructor(e){f(this,"mappingFn"),f(this,"score",0),f(this,"origin",-1),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{const t=performance.now();setTimeout((()=>{const n=performance.now()-t;let r=0;this.mappingFn&&(r=this.mappingFn(n)),this.origin=n,this.score=r,e({score:r,origin:n})}),0)}))}getScoreSync(){let e=0;return this.mappingFn&&(e=this.mappingFn(-1)),e>0?{score:e,origin:-1}:{score:this.score,origin:this.origin}}}var v=n(6607),y=Object.defineProperty;const _="Arc(TM) A770M #|995\nArc(TM) A770 #|980\nArc(TM) A770 #|970\nArc(TM) A580 #|940\nArc(TM) A730M #|820\nArc(TM) A750 #|770\nArc(TM) A750 #|770\nArc(TM) A550M #|660\nArc(TM) A550M #|630\nXe # ReleaseInternal|560\nArc(TM) A770M #|500\nArc(TM) A380 #|470\nArc(TM) A380 #|470\nArc(TM) A370M #|340\nArc(TM) A370M #|340\nXe #|320\nHD # 630 GT2|310\nArc(TM) A350M #|280\nIris(R) Xe MAX #|210\nIris(R) Xe # RI|205\nIris(R) Xe # ReleaseInternal|180\nIris(R) Xe #|180\nGen12 Desktop # Controller|180\nIris(R) Xe #|180\nIris(R) Xe MAX #|170\nCorporation Iris Xe #|170\nCorporation TigerLake-LP GT2 [Iris Xe #]|160\nXe #|160\nArc(TM) A350M #|150\nCorporation TigerLake GT2 [Iris Xe #]|150\nUHD # 770|140\nUHD # ReleaseInternal|140\nIris(R) Pro # P580|140\nIris(R) Plus #|130\nIris Plus #|130\nIris(R) Pro # 580|130\nUHD # 770|125\nUHD # 750|125\nRadeong 0.4 on AMD TONGA (DRM 3.1.0, LLVM 3.9.0)|120\nCorporation Iris Plus # G7|120\nIris(R) Plus #|120\nIris(R) Plus # 940|120\nIris(R) Plus # 650|120\nIris(R) Plus # 655|120\nIris(R) Plus # 655|120\nHD # P4600|120\nIris(TM) Pro # 6200|120\nIris(R) Plus #|120\nIris(R) Plus # 650|120\nIris(R) Plus # 655|115\nIris(R) Pro # 580|110\nCorporation Iris Pro # 580|110\nIris(R) Plus # 645|110\nIris(TM) Pro # 6200|110\nIris(TM) Pro # P580|110\nCorporation Iris Plus # 655|110\nArc(TM) # RI|110\nIris(R) Plus # 655|110\nIris(R) Plus # 655|110\nIris(R) Plus #|110\nUHD #|110\nIris Plus # 655|110\nIris(R) Plus # 650|110\nIris(R) Plus # 650|110\nIris(TM) Pro # 580|110\nIris(TM) Pro # 6200|110\nIris # 6100|110\nIris(TM) Pro # 6200|110\nIris(R) Plus # 645|110\nUHD # 730|110\nIris(TM) Pro # 6200|100\nIris Pro # 580|100\nCorporation Iris Pro # 6200|100\nIris(R) Plus # gfx-driver-user-comp_media-21486 DC ReleaseInternal|100\nIris(R) Pro # 580|100\nIris Plus # 645|100\nUHD # 750|100\nIris(TM) Pro # 580|100\nIris(TM) # 550|100\nIris(TM) Pro # P6300|100\nIris(R) Plus # 650|100\nIris(TM) Pro # 5200|100\nIris(R) # 550|100\nIris(R) Plus #|100\nIris(R) Plus # 650|100\nIris(R) Plus # 655|100\nIris(R) # 550|100\nIris(R) Plus # 645|95\nIris Plus # 650|95\nIris(R) # 550|95\nIris # 550|90\nIris(R) Plus # 650|90\nIris(R) Pro # 580|90\nIris(TM) Plus # 650|90\nIris(TM) # 550|90\nIris(R) Plus # 640|90\nIris(TM) Plus # 650|90\nIris(TM) Pro # P6300|90\nIris(TM) Plus # 650|90\nIris(TM) # 550|90\nUHD # 730|90\nCorporation Iris Plus # 650|90\nIris(TM) Pro # 5200|90\nCorporation CometLake-H GT2 [UHD #]|90\nIris(R) # 540|90\nUHD # P630|90\nUHD # 630|85\nIris(TM) # 540|85\nIris(TM) Plus # 640|80\nIris(TM) # 540|80\nUHD # 630|80\nUHD # 630|80\nUHD # P630|80\nIris(TM) Plus # 640|80\nUHD # 630|80\nUHD # 630|80\nIris Plus # 640|80\nIris(TM) # 540|80\nUHD # 630|80\nUHD # 630|80\nIris(TM) Pro # 5200|80\nUHD # 630|80\nHD # 630|80\nUHD # 630|80\nUHD # 630|80\nUHD # 630|80\nUHD # 630|80\nUHD # 630|80\nIris Pro # 6200|80\nUHD # 630|80\nIris # 540|80\nHD # 630|80\nIris(TM) # 540|80\nIris(TM) Pro # 5200|79\nUHD # 630|79\nUHD # 630|79\nUHD # 630|79\nIris # 540|79\nUHD # 630|79\nUHD #|78\nCorporation Sky Lake Integrated #|78\nIris(TM) Pro # 6200|78\nCorporation WhiskeyLake-U GT2 [UHD # 620]|78\nRadeong 0.4 on AMD BONAIRE (DRM 2.43.0, LLVM 3.8.0)|78\nUHD # 710|78\nUHD # 630|78\nUHD # P630|77\nUHD # 630|77\nUHD # 630 (Desktop 9 Series)|77\nUHD # 630|77\nCoffee Lake UHD #|77\nIris(TM) Pro # 5200|77\nUHD # 630|76\nIris(R) Plus # 640|76\nIris(TM) Pro # 5200|76\nUHD # 630|76\nUHD #|76\nUHD # 630|76\nIris(TM) Pro # 5200|75\nUHD # 630|75\nUHD # P630|75\nHD # P530|75\nHD # 630|75\nIris(TM) Pro # 5200|75\nUHD # 630|75\nIris(TM) Pro # 5200|75\nHD # 620|74\nUHD # 630|74\nHD # 630|74\nHD # 630|74\nCoffee Lake HD #|74\nUHD # 630|74\nIris(TM) # 540|74\nUHD 630|74\nIris(R) # 540|73\nUHD # 620|73\nIris # 6200|73\nCorporation CoffeeLake-H GT2 [UHD # 630]|73\nUHD # 630 (Desktop)|73\nHD # ICL RVP|73\nUHD # 630|73\nHD # 630|72\nIris Pro|72\nKBL Unknown|72\nUHD # 630|72\nIris(TM) Pro # 5200|72\nHD # 530|72\nCorporation UHD # 630 (Desktop 9 Series)|72\nRadeon Pro Vega 16|72\nIris(TM) # 540|72\nIris(R) # 540|72\nUHD # 630|71\nHD # 630|71\nIris(TM) Pro # 5200|71\nUHD # 630|71\nIris Pro|71\nCometLake UHD # 630|71\nHD # 630|71\nUHD #|71\nIris(TM) Plus # 640|71\nUHD #|71\nCorporation UHD #|70\nIris Pro # 6200|70\nIris(R) # 540|70\n#|70\nUHD # 630|70\nHD # ICL RVP BigSur|70\nUHD # ReleaseInternal|70\nHD # 530|70\nUHD # 630|70\nUHD #|70\nUHD # gfx-driver-user-comp_core-23599|70\nUHD # 630|69\nUHD #|69\nIris(TM) Pro # 5200|69\nCorporation Iris Plus # G1 (Ice Lake)|69\nHD # 630|69\nHD # 630|69\nIris(R) Plus #|69\nIris(TM) Pro # 5200|69\nUHD # 620|69\nUHD #|69\nIris(R) Plus # 640|69\nIris Pro # 6200|69\nHD # 630|69\nUHD # 630 (Mobile)|68\nIris(TM) Pro # 5200|68\nCorporation UHD # 630 (Desktop)|68\nHD # 630|68\nUHD # 630|68\nUHD # 620|68\nUHD # 630|68\nIris(TM) Plus # 640|68\nUHD #|67\nIris Pro # 580|67\nIris(TM) # 540|67\nUHD # 620|67\nIris(TM) Pro # 5200|67\nUHD #|66\nHD # P530|66\nCorporation UHD # 630 (Mobile)|66\nIris(R) Plus # 640|66\nUHD # 630|66\nIris(R) Plus # 640|65\nHD # 630|65\nHD 530|65\nUHD # 620|65\nSKL Unknown|65\nHD # 630|64\nIris(TM) # 540|64\nMesa DRI Intel(R) UHD # 620 (Kabylake GT2)|64\nUHD # 630|64\nHD # 530|63\nHD # 530|63\nHD # 530|63\nMesa Intel(R) HD # 530 (SKL GT2)|63\nUHD #|63\nHD # 530|63\nIris # 550|63\nHD # 530|63\nIris Plus # 655|63\nHD # 630|63\nUHD #, Gen11 LP|63\nCorporation 8th Gen Core Processor Gaussian Mixture Model|63\nUHD # 630|63\nIris(TM) # 650|63\nIris(R) Plus # 640|62\nHD # 530|62\nMesa DRI Intel(R) Iris # 540 (Skylake GT3e)|62\nIris(R) Plus #|61\nIris(TM) Pro # 5200|61\nIris Pro|61\nHD # 620|61\nUHD # 620|61\nUHD # 630|61\nUHD #|61\nHD # 530|60\nIris Plus # G1|60\nIris(TM) Pro # 5200|60\nIris Plus # 650|60\nUHD #|60\nHD # 620|60\nUHD # 620|60\nUHD # 630|60\nMesa DRI Intel(R) HD # 630 (Kaby Lake GT2)|60\nUHD # 620|60\nHD # 630|60\nHD # 630|59\nIris # 540|59\nIris Plus # 640|59\nCoffeeLake-H GT2 [UHD # 630]|59\nHD # 630|59\nUHD #|59\nHD # 620|59\nUHD # 620|59\nHD # 630|59\nCorporation UHD # 620 (Whiskey Lake)|59\nIris(R) Plus # 650|59\nUHD # 620|59\nMesa Intel(R) HD # 520 (SKL GT2)|58\nHD # 630|58\nHD # P530|58\nIris(TM) Plus # 640|58\nCorporation HD # 630|58\nUHD # 620|58\nUHD # 630|58\nHD # P630|58\nMesa DRI Intel(R) UHD # 630 (Coffeelake 3x8 GT2)|58\nCorporation CometLake-S GT2 [UHD # 630]|58\nHD # 530|58\nIris # 540|58\nHD # 530|58\nCorporation Device|58\nHD # CFL CRB|57\nHD # 620 macOS Edition|57\nHD # 530|57\nMesa DRI Intel(R) HD # 520 (SKL GT2)|57\nIris Pro #|56\nIris(TM) Pro # 5200|56\nIris(R) Plus # 655|56\nCoffee Lake UHD #|56\nIris(TM) # 640|55\nIris Pro|55\nUHD # 630|55\nUHD # 620|55\nHD # 530|55\nHD # 520|54\nHD # 530|54\nUHD # 620|54\nHD # 530|54\nCorporation UHD # 620|54\nUHD #|54\nIris Plus # G7|54\nCorporation Skylake GT2 [HD # 520]|53\nUHD # 630|53\nHD # 630|53\nCorporation HD # 530|53\nUHD # 617|53\nHD # 520|52\nHD # 620|52\nHD # 620|52\nHD # 620|52\nHD # 620|52\nHD # 630|52\nHD # 630|52\nHD # 5600|51\nHD # 530|51\nHD # 630|51\nUHD # 615|51\nMesa DRI Intel(R) HD # 520 (Skylake GT2)|51\nHD # 630|50\nHD # 620|50\nUHD #|50\nHD # P4600/P4700|50\nHD # 520|50\nHD # 530|50\nHD # 620|50\nHD # 530|50\nCorporation HD # 620|50\nHD # 530|50\nUHD # 620|49\nUHD # 620|49\nHD # 530|49\nIris(TM) # 6100|49\nHD # 4600|49\nHD # 630|49\nUHD # 617|49\nUHD # RI|48\nHD # 520|48\nUHD # 617|48\nHD # 5600|48\nHD # 620|48\nUHD #, Gen11 LP|47\nUHD # 617|47\nMesa DRI Intel(R) HD # 620 (Kaby Lake GT2)|47\nHD # 615|47\nUHD # RI|47\nHD # 630|47\nHD # 4600|46\nHD # 520|46\nCorporation Skylake GT2 [HD # 520]|46\nHD # 520|46\nCorporation Device|46\nHD # 4600|46\nHD # 615|45\nHD # 4600|45\nIris(TM) # 6100|45\nHD # 615|45\nUHD # 615|45\nHD # 630 GT2|45\nHD # 4600|45\nHD # 630|45\nIris(TM) # 6100|45\nHD # 4600|45\nHD # 620|45\nIris(TM) # 6100|45\nHD # 520|45\nHD # 4600|45\nIris(TM) # 540|44\nHD # 530|44\nHD # 4600|44\nIris(TM) # 5100|44\nKabylake HD # ULT GT2|44\nIris # 6100|44\nUHD # 630|44\nHD # 520|44\nHD # KBL CRB|44\nHD # 530 (Skylake GT2)|44\nCorporation HD # 620|44\nHD # 515|44\nUHD #|44\nUHD # 620|44\nIris(TM) Pro # P580|43\nUHD # 615|43\nHD # 4600|43\nHD # 4600|43\nCorporation Skylake Integrated #|43\nHD # 530|43\nUHD # 615|43\nUHD # 630|43\nHD # 615|42\nHD # 620|42\nHD # 4600|42\nHD # 615|42\nHD # 4600|42\nHD # 4600|42\nMesa DRI Intel(R) Kabylake GT2|42\nHD # 620|42\nCorporation HD # 6000|42\nUHD # 615|42\nHD # 4600|41\nCorporation HD # 520|41\nHD # P4600/P4700|41\nCorporation, Series Chipset Iris Plus # 655|41\nHD # 4600|41\nMesa DRI Intel(R) HD # 530 (Skylake GT2)|41\nHD # 4600|41\nIris(TM) # 640|41\nHD # 4600|41\nHD # 630|40\nIris(TM) # 5100|40\nIris(TM) # 6100|40\nUHD # 610|40\nHD # 4600|40\nHD # 4600|40\nUHD # 615|40\nUHD # 610|40\nHD # 530|40\nUHD # 605|40\nHD # 615|40\nHD # 4600|40\nUHD # 615|40\nHD # 505|39\nPHDGD Ivy 4|39\nUnknown|39\nIris(TM) # 5100|39\nIris|39\nCorporation Iris # 6100|39\nHD # 6000|39\nIris(TM) # 5100|39\nHD # 615|39\nHD # 5500|39\nSkylake GT2 [HD # 520]|39\nCorporation Broadwell-U Integrated #|38\nHD # 615|38\nHD # 5500|38\nHD # 4600|38\nMesa DRI Intel(R) HD # P4000 (IVB GT2)|38\nHD # 4600|38\nHD # 615|38\nCorporation HD # 610|38\nHD # 4600|38\nHD # 4600|38\nIris(TM) # 5100|38\nIris # 6100|38\nHD # 515|38\nHD # 6000|38\nUHD #, Gen11 LP|38\nIris(TM) # 5100|38\nHD # 4600|37\nHD # 610|37\nHD # 4600|37\nHD # 515|37\nHD # 4600|37\nHD # 4600|37\nIris # P580|37\nIris(TM) Pro # P6300|37\nHD # 5500|37\nHD # 4600|37\nIris # 6100|37\nUHD # 610|37\nHD # 4600|37\nHD # 4600|37\nUHD # 610|37\nHD # 530|37\nHD # 5500|37\nHD # 515|36\nHD # P4600/P4700|36\nHD # 515|36\nHD # 4600|36\nUHD # 615|36\nIris # 6100|36\nHD # 4600|36\nHD # 4600|36\nHD # 4600|36\nHD # 520|36\nHD # 520|36\nHD # 5500|36\nCorporation HD # 5500|35\nIris|35\nHD5500 # PG7|35\nHD # 515|35\nIris|35\n# gfx-driver-user-feature_dg1_poweron-27723 DCH ReleaseInternal|35\nHD # 615|35\nHD # P630|35\nHD # 510|35\nHD # 6000|35\nHD # 5000|35\nCorporation HD # 5300|35\nHD # 6000|35\nHD # 4600|35\nHD5500 Broadwell PG7|35\n# HD 4600|35\nHD # 6000|35\nHD # 510|34\nHD # 610|34\nHD # 4600|34\nHD # Family (PHDGD Skylake v2.9)|34\nCorporation Device|34\nHD # 610|34\nUHD # 610|34\nHD # 5300|34\nHD # 5000|34\nHD # 4600|34\nUHD # 610|33\nHD # 4600|33\nUHD # 620|33\nCorporation UHD # 615|33\nHD # 5000|33\nKabylake HD # ULX GT2|33\nHD # 620|33\nUHD # 615|33\nHD # 4600|33\nHD # 5500|33\nHD # 515|33\nUHD #|33\nHD # 4600|33\nHD # 520|33\nHD # 6000|33\nHD # 615|33\nHD # KBL CRB|33\nHD # 4600|33\nUHD # 610|33\nIris # 6100|33\nHD # 515|33\nIris|32\nIris|32\nHD # 5000|32\nIris|32\nHD # 5000|32\nIris(TM) # 5100|32\nHD # 4600|32\nHD # 4600|32\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|32\nHD # 5500 (PHDGD Skylake v2.9)|32\nHD # 610|32\nHD # 6000|31\nHD # 5500|31\nIris|31\nHD # 6000|31\nUHD # 610|31\nHD # 510|31\nHD #|31\nHD # 6000|31\nHD # 4400|31\nHD # 5000|31\nHD # 4600|30\nHD # 515|30\nHD # 5600|30\nHD # 4600|30\nHD # 4400|30\nHD # 530|30\nGeForce GTX 960|30\nUHD # 610|30\nGeForce GTX 960|30\nHD # 510|30\nHD # 6000|30\nCorporation HD # 515|30\nHD # 610|29\nHD # 510|29\nHD # 5000|29\nHD # 4600|29\nIris(TM) Pro # 6200|29\nHD # 510|29\nHD # 5000|29\nHD # 6000|29\nIris|29\nHD # 4400|29\nHD # 4400|29\nHD # 4000|29\nHD # 510|29\nHD # 5000|29\nHD # 4400|28\nHD # 610|28\nHD # 5300|28\nHD # 510|28\nHD #|28\nHD # 610|28\nHD # 4400|28\nHD # 610|28\nHD # 4600|28\nHD # 4600|28\nHD # 5000|28\nHD # 4400|28\nHD # 4400|28\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|28\nHD # 4400|28\nHD # 5300|28\nHD # 5000|28\nUHD # 605|28\nHD # 4400|28\nHD # 5500|28\nHD # 4000|28\nHD # 4400|27\nHD # 615|27\nHD # Family(PHDGD Skylake v2.0)|27\nHD # 4400|27\nHD # 4400|27\nHD # 610|27\nCorporation HD # 510|27\nIris|27\nHD # 520|27\nHD # 5000|27\nHD # 5300|27\nHD # 6000|27\nHD # 4000|27\nHD # 610|27\nHD # 5000|27\nHD # 4600|27\nMesa DRI Intel(R) HD # 505 (Broxton)|27\nHD # 5500|27\nHD #|27\nHD # 5000|26\nUHD # 600|26\nHD # 4600|26\nMesa DRI Intel(R) Haswell Mobile|26\nHD # 4000|26\nHD # 5300|26\nIris(TM) # 540|26\nHD # 4000|26\nHD # 4600|26\nHD #|26\nHD # 4400|26\nHD # 4600|26\nHD # 6000|26\nCorporation Celeron N3350/Pentium N4200/Atom E3900 Series Integrated # Controller|26\nHD # 530|26\nHD # 5500|25\nBroxton-P HD #|25\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|25\nHD 4000|25\nHD # 4400|25\nHD # 4600|25\nHD # 5500|25\nHD 4000|25\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|25\nCorporation HD #|25\nHD # 4400|25\nMesa DRI Intel(R) HD # 5500 (Broadwell GT2)|25\nHD # 4400|25\nHD #|25\nUHD # 600|24\nArc(TM) #|24\nHD # 4600|24\nHD # 5300|24\nHD # 4400|24\nHD # 4400|24\nHD # 4400|24\nHD # 4000|24\nUHD # 605|24\nHD # 5000|23\nCorporation Xeon E3-1200 v2/3rd Gen Core processor # Controller|23\nUHD #, LKF|23\nUHD # 605|23\nHD # 4400|23\nHD # 4400|23\nHD # 4000|23\nHD # 4400|23\nMesa DRI Intel(R) Ivybridge Desktop|23\n0x496e74656c2048442047726170686963000732034343|23\nHD # 5300|22\nHD # 615|22\nKabylake HD # ULX GT2|22\nHD # 5300|22\nHD #|22\nHD #|22\nHD # 4000|22\nHD #|22\nHD # 515|22\nHD #|22\nHD # 5300|22\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|22\nHD # 5300|22\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|22\nHD # 4000|21\nUHD # 605|21\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|21\nHD # 4400|21\nHD #|21\nHD # 4400|21\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|21\nHD #|21\nHD # 5300|21\nHD # 4400|21\nHD # 5300|21\nHD # P4600/P4700|21\nHD #|21\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|21\nCorporation UHD # 605|20\nUHD # 600|20\nHD # 4000|20\nHD #|20\nUHD # 600 Universal|20\nHD # 4600|20\nHD # 500|20\nUHD # 600|20\nHD #|20\nHD # 5000|20\nHD # 4400|20\nHD # 5300|19\nHD # 4000|19\nMesa DRI Intel(R) Sandybridge Mobile|19\nHD # 505|19\nHD # 4000|19\nHD # 4400|19\nUHD # 600|19\nHD # 3000|19\nHD # 615|19\nHD #|19\nCorporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Integrated # Controller|19\nHD # 4000|19\nHD #|19\nUHD # 600|19\nHD #|19\nCorporation Haswell-ULT Integrated # Controller|19\nHD # 4400|19\nCorporation GeminiLake [UHD # 600]|19\nHD # 4000|18\nHD #|18\nHD #|18\nHD # 500|18\nHD # 4000|18\nCherryView HD #|17\nCorporation Xeon E3-1200 v2/3rd Gen Core processor # Controller|17\nXeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|17\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|17\nUHD # 600|17\nUHD # 600|17\nCorporation Xeon E3-1200 v2/3rd Gen Core processor # Controller|16\nHD #|16\nUHD # 600|16\nHD #|16\nHD # 5000 (Android)|16\nHD #|16\nUHD # 600|16\nHD #|16\nHD #, Gen10|16\nHD # (PHDGD IvyDrive 3.0)|16\nHD #|15\nUHD # 600|15\nCorporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated # Controller|15\nHD # 500|15\nHD # 505|15\nHD #|15\nCorporation 3rd Gen Core processor # Controller|15\nHD # 4400|15\nHD #|14\nHD #|14\nHD #|14\nHD # 505|14\nHD #|14\nHD #|14\nHD #|14\nHD #|13\nHD # 530|13\nHD # 500|13\nCorporation 3rd Gen Core processor # Controller|13\nHD # 4400|12\nHD # 5500|12\nHD #|12\nHD #|12\nCorporation HD # 500|12\nHD # 500|12\n3rd Gen Core processor # Controller|12\nHD #|11\nCorporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers|11\nCorporation 2nd Gen Core Processor Family Integrated # Controller|11\nHD # 510|11\nHD # 4600 (PHDGD Skylake v2.9)|9\nCorporation Atom Processor Z36xxx/Z37xxx Series # & Display|8\nCorporation Atom Processor Z36xxx/Z37xxx Series # & Display|8\nMesa DRI Intel(R) Bay Trail|8\nUHD #, Gen12 LP ReleaseInternal|5\nCorporation D3D12 (Intel(R) UHD # 630)|3\nHD # 3000|2\n(PE64) Intel(R) 4th Generation Haswell HD # Family|-1\n4 Series Internal Chipset|-1\n7 Series/C216 Chipset Family MEI Controller #1|-1\nB43 Express Chipset|-1\nCometLake-S GT2 [UHD # 630]|-1\nHD # 5500|-1\nHD # 620|-1\nG35 Express Chipset Family|-1\nG41 Express Chipset|-1\nG45/G43 Express Chipset|-1\n# Media Accelerator HD|-1\nHD # (PHDGD Omega 5.0)|-1\nHD # 4400|-1\nHD # P3000|-1\nHD # P3000 (PHDGD Omega 5.0)|-1\nIncrediblE HD # 3000|-1\nIris Pro # 5200|-1\nMesa DRI Intel(R) HD # (CHV)|-1\nMesa DRI Intel(R) Ivybridge Mobile|-1\nMobile Intel(R) 4 Series Express Chipset Family|-1\nMobile Intel(R) 965 Express Chipset Family|-1\nMobile Intel(R) HD #|-1\nPHDGD Quantic C3|-1\nQ45/Q43 Express Chipset|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 2.43.0, LLVM 3.7.0)|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 3.9.0 / 4.9.0-rc1+, LLVM 4.0.0)|-1\nRadeong 0.4 on AMD FIJI (DRM 3.2.0 / 4.7.0-rc5+, LLVM 4.0.0)|-1\nUHD #, Gen12 LP ReleaseInternal|-1",T="\n$ % 4090|1950\n$ % 4090 Laptop GPU|1790\n$ % 4070 Ti|1520\n$ % 3090 Ti|1465\n$ % 4080|1430\n$ % 4060 Laptop GPU|1410\n$ % 3080 Ti Laptop GPU|1390\n$ % 3080|1325\n$ % 3080 Ti|1300\n% A5500 Laptop GPU|1240\n$ % 3090|1235\n$ % 3070 Ti|1230\n$ % 3070|1230\n$ % 3060 Ti|1160\n$ % 3080 Laptop GPU|1140\n% A4000 Laptop GPU|1130\n$ % 2080 Ti|1120\n$ % 3070 Laptop GPU|1080\nTITAN V|1070\n$ % 2080 SUPER|1060\nQuadro % 8000|1050\n% A6000|1050\nTITAN %|1050\n$ % 3070 Ti Laptop GPU|1030\n% A5000 Laptop GPU|1030\n$ % 4090 Laptop GPU|1020\n$ % 3060|1015\nTITAN X (Pascal)|1010\nTITAN Xp|995\n$ & 1080 Ti|990\n$ % 4070 Laptop GPU|990\n$ % 4090|980\n$ % 2070 SUPER|980\n$ % 4080|975\n$ % 3060|970\n$ % 2080|970\n$ % 4080 Laptop GPU|970\n$ % 3060 Laptop GPU|910\n$ % 2060 SUPER|890\n$ % 4060 Laptop GPU|880\n$ % 2070|880\n$ % 2080 Super with Max-Q Design|870\n$ % 2080 with Max-Q Design|870\nQuadro % 5000|870\n$ % 3080 Ti Laptop GPU|860\nQuadro % 5000 with Max-Q Design|840\nAsus $ & 1080|840\n$ & 1080|840\n$ % 2070 Super with Max-Q Design|840\n% A3000 Laptop GPU|835\nQuadro % 4000 with Max-Q Design|830\n$ % 3070 Ti Laptop GPU|830\nQuadro % 4000|820\n% A6000|810\n$ & 1070 Ti|785\n$ % 4070 Ti|784\n$ % 4050 Laptop GPU|784\n% A5500 Laptop GPU|780\nTITAN Xp COLLECTORS EDITION|770\n$ % 2070 with Max-Q Design|765\n$ % 3050|760\n$ % 2060|760\n$ & 980 Ti|755\nQuadro P6000|750\n$ & 1080|750\nQuadro % 6000|744\n$ & 1070|740\n% A4000|740\n$ % 3090|740\n$ % 3080 Ti|730\n$ & 1080 Ti|730\nQuadro P4200|710\n$ & 1080 with Max-Q Design|707\n$ % 3060 Lite Hash Rate|705\nEIZO MED-XN83|700\n$ % 3080 Ti|700\n$ & 1660 SUPER|700\nTITAN Xp|700\nEVGA $ & 1070|700\n$ % 3090 Ti|700\nQuadro GV100|695\nQuadro P4000|695\n$ & 1660 Ti|690\n$ % 3070 Ti|690\n% 6000 Ada Generation|690\n$ % 3070|690\nQuadro % 8000|685\n% A2000 12GB|680\n$ % 2080|680\n$ & TITAN X|680\nQuadro M6000 24GB|680\n$ & 1660 SUPER|670\nTITAN V|670\nQuadro % 3000|670\nGraphics Device|670\n% A5000|670\n$ % 3090|670\nTITAN Xp COLLECTORS EDITION|670\n$ & 1070 A17|670\n$ % 3080 Laptop GPU|667\n% A4500 Embedded GPU|660\n% A5000 Laptop GPU|660\n$ % 3080|660\n$ % 3050 Ti Laptop GPU|650\n$ & 1070 with Max-Q Design|650\n$ % 3060 Ti|650\nQuadro P4200 with Max-Q Design|650\n$ % 3080|650\n$ % 2080 SUPER|650\n$ & 1070 Ti|648\n$ & 1070 with MaxQ Design|642\n% A3000 Laptop GPU|641\n$ % 3070 Laptop GPU|641\n$ & 1070|640\nGA104GL [% A4000]|639\n$ & 980 Ti|637\n$ % 2070 Mobile / Max-Q Refresh|637\n% A4000 Laptop GPU|634\n$ % 3060|633\nMicrosoft Virtual Render Driver|633\n$ % 3050 Laptop GPU|631\n% A2000|629\n$ % 2070 Mobile / Max-Q|626\n$ % 3070|625\nQuadro P5000|625\nQuadro P4000|621\n$ % 3060 Laptop GPU|621\n$ % 2060 with Max-Q Design|618\nGV102|614\n$ % 2070 SUPER|612\n$ & 1660|606\n$ % 2070|604\n$ & 1660 Ti with Max-Q Design|601\n$ & TITAN X|598\n% A2000 8GB Laptop GPU|598\n$ & TITAN Xp|595\n$ & 980|593\n$ % 2080 SUPER|591\n& 1060 HL|589\nTesla T4|589\nGRID P4-1Q|585\n% A4000|581\n$ % 2080 Ti|577\n$ % 2080 Super with Max-Q Design|576\nQuadro % 4000 Mobile / Max-Q|576\nTU102 [TITAN %]|574\n$ & 1060 with Max-Q Design|571\n$ % 2070 SUPER|570\n$ & 1060 6GB|570\n$ % 2080 Mobile|568\n$ % 2060|568\nQuadro P3200|565\nP106-100|564\nGRID V100DX-1Q|564\n% A2000|562\n$ % 2080 Ti Rev. A|561\n$ % 2080 Rev. A|559\nGV100 [TITAN V]|557\n$ % 2080|556\n$ & 1650 SUPER|554\nP106-100 Custom|553\n$ % 2070 Super with Max-Q Design|553\nGV100|553\n$ % 2070 Mobile|550\nGP102 [TITAN X]|548\n% A2000 12GB|546\n$ & 1060 5GB|542\nMSI $ & 1060|542\n$ % 2060 SUPER|542\nGRID T4-1Q|539\nQuadro % 5000 Mobile / Max-Q|538\n$ % 3050|538\n$ & 1060 3GB|538\nQuadro % 5000 with Max-Q Design|537\nQuadro M6000|536\n% A2000 Laptop GPU|536\n$ & 1660 SUPER|533\nA10-2B|530\nTITAN X (Pascal)|530\nQuadro P5000|527\n$ % 2070|526\n$ & 1080|525\n$ % 2060 Mobile|524\nPNY $ & 980|524\n$ & 1080 Mobile|523\n$ % 2060 SUPER|520\n$ & 780 Ti|518\n% A4500|516\n$ % 2060 Rev. A|515\nMSI $ & 980|515\nQuadro P3200 with Max-Q Design|513\n$ % 2070 with Max-Q Design|513\n$ % 3050 Ti Laptop GPU|510\nQuadro % 3000 Mobile / Max-Q|509\n$ & 1660 SUPER|508\nQuadro % 4000|508\n$ & 1060|506\n$ % 2080 with Max-Q Design|505\n$ & 1080 Ti|505\n$ & 1660 Ti Rev. A|504\n$ & 1660 Ti Mobile|504\n$ % 3050 Laptop GPU|503\n$ % 2060|503\nQuadro % 4000 with Max-Q Design|500\nEIZO MED-XN83|499\n$ & 970|499\n$ & 1080|495\n$ & 1070 Ti|492\n$ & 980|491\nA100-PCIE-40GB|489\n$ & 1070|487\n$ & 1660 Ti|487\nQuadro P2200|485\n$ & TITAN Black|484\nTITAN Xp COLLECTORS EDITION|483\nTITAN %|482\nQuadro P5200|482\n$ & 1060 with Max-Q Design|480\n% A1000 Laptop GPU|479\n$ & 1060 6GB|479\nQuadro % 5000|475\nTITAN V|475\nGRID P100-4Q|474\nEVGA $ & 970|472\n$ & 1650 SUPER|471\n$ & 1650 Ti|470\nQuadro % 3000|470\nQuadro M5000|469\nQuadro % 3000 with Max-Q Design|468\n$ & 980 Ti|467\n$ & TITAN|467\nQuadro P4200|466\n$ & 1070 with Max-Q Design|466\nQuadro M5000|466\n$ & 1080 Ti|466\nTesla M60|462\n$ & 1660|457\n$ & 1660|455\n$ % 2050|453\n$ & 1060|453\n$ % 2060 with Max-Q Design|453\nQuadro P3200 with Max-Q Design|452\nQuadro P4000|450\n$ & 1060 3GB|449\n$ & 1070|448\n$ & 1060 6GB Rev. 2|447\nGigabyte $ & 780 Ti|447\nTITAN Xp|444\n$ & 980M|440\nA10-4Q|439\n$ & 1080 with Max-Q Design|437\n$ & 1650 SUPER|435\nQuadro P5000|435\nQuadro P3000|434\n% A6000|434\n$ & 1060 3GB|433\n$ & 1070 Ti|432\n$ & 780|432\n$ & 1060 Mobile|432\nGigabyte $ & 970|431\n$ & TITAN Z|431\nQuadro K6000|429\n$ & 1650|425\n$ & 970|421\nTesla K20m|420\nQuadro GV100|419\nQuadro P4000|419\nQuadro P3200|417\n& 1060 HL|415\n% A2000 Laptop GPU|415\n$ & 780 by St3Phl3|414\nP102-100|412\nT1200 Laptop GPU|412\n$ & 780 Ti|411\n$ & 1060 6GB|408\n$ & 1650 Ti with Max-Q Design|407\nQuadro T2000 with Max-Q Design|407\nQuadro P2000|406\nQuadro P2200|406\n$ % 2060 Max-Q|405\n$ & 1650 Ti Mobile|403\n$ & 1060 Mobile 6GB|403\n$ & 1060 with Max-Q Design|401\n$ & 980|398\n$ % 2070 Rev. A|397\n$ & TITAN X|397\nTesla T4|395\nQuadro P6000|394\n$ & 1060 3GB|394\nQuadro M5000|393\n$ & 1060 with Max-Q Design|392\nPNY $ & 970|392\nQuadro T2000|391\nQuadro T1000 with Max-Q Design|391\nGRID P40-8Q|390\n$ & 780 Rev. 2|389\nQuadro GP100|387\n$ & 980|387\nP104-100|387\n$ & 1650 Ti|386\nGRID P40-4Q|384\n$ & 780 Ti|383\nDevice|383\nTU117M|381\nQuadro P2000|380\nQuadro % 6000|379\n$ & 1070 Mobile|378\nQuadro T1000|377\n$ % 3070 Mobile / Max-Q|376\n$ & 1060|376\nGRID V100-1Q|375\n$ & 780 Rev. 2|372\n$ % 2050|370\n$ & 770|370\n$ & 970|368\n$ & 1650 Ti|368\nGRID T4-2B4|368\nAsus $ & 780|366\nP106-100|365\nQuadro % 8000|365\n$ & TITAN Black|365\nGRID RTX6000-2Q|365\n$ & TITAN Black|363\nQuadro M4000|363\n$ & 1060 6GB|362\nQuadro P5000|361\n$ & 1650|361\nQuadro M5500|361\n$ & 780|360\n$ & 780|360\n$ & 980M|358\n$ & 1650|358\n$ & 1050 Ti|357\nQuadro P3200 Mobile|357\n$ & 1650 with Max-Q Design|356\nTesla T4|356\nQuadro P2000|356\n$ & TITAN|355\n$ & 970|355\n$ & 980 Ti|354\n$ & 1660 Ti with Max-Q Design|354\n$ & 780 Rev. 2|352\nGRID P4-4Q|351\n$ & TITAN X|351\nT1200 Laptop GPU|350\nGRID T4-8Q|350\n$ & 1060|349\n$ & 1050 Ti with Max-Q Design|348\n$ & 970M|346\nT1000 8GB|346\n$ % 3080 Mobile / Max-Q 8GB/16GB|346\n$ & 780 Ti|346\n$ & 680|346\n$ & 1660 Ti|345\n$ & 780|345\nQuadro M6000|344\nGRID T4-16Q|344\n$ % 2080 Ti|344\nGRID T4-1B|343\nQuadro K5200|342\nQuadro P2200|341\nT1000 8GB|341\nTesla K80|341\nQuadro T2000 Mobile / Max-Q|338\nTU107|337\n$ & 780 Mac|336\n$ & TITAN|336\n$ & 980M|335\nGRID P40-2Q|335\nEVGA $ & 780|334\n$ & TITAN Z|334\nTITAN X (Pascal)|332\n$ & 960|331\nTesla P40|331\n$ & 1650 Ti with Max-Q Design|330\nTesla P40|330\n$ & 1060se 3GB|329\n$ & 1650 Mobile / Max-Q|329\nQuadro T2000 with Max-Q Design|328\nT1000|327\n% A5500|326\nA40-8Q|326\n$ % 3060 Mobile / Max-Q|326\n$ & 690|326\nTesla V100-SXM2-16GB|326\nQuadro M5000|325\nA16-2B|323\n$ & 1050 Ti with Max-Q Design|321\n$ & 1050 Ti Mobile|321\n$ & 980M|319\nQuadro M3000M|318\n$ & 1650 with Max-Q Design|318\n$ & 670|316\nQuadro P3000|316\nT600 Laptop GPU|315\nQuadro T1000 with Max-Q Design|313\nTesla K80|312\nTesla K20m|311\n$ & 770|311\nTesla P100-PCIE-16GB|311\nQuadro M5000M|311\nTesla K80|309\nEVGA $ & 1070|309\nQuadro T1000|309\n$ & 1050 Ti|309\n$ & TITAN Z|308\nQuadro T2000|308\nQuadro M6000 24GB|308\n$ & 760 Ti|308\n$ % 2080 SUPER Mobile / Max-Q|308\n$ & 1050 Ti|307\nQuadro P2000|304\nQuadro P6000|304\n$ & 770 Mac Edition|303\nMSi $ & 1050 Ti|303\nA40|303\nT600|303\nP106-090|302\nP106-090|301\nQuadro K5200|300\n$ & 770|299\n$ & 680|299\n$ & TITAN|299\n$ & 680|297\nGRID M60-4Q|296\nQuadro M4000|296\nGRID M60-2Q|295\n$ & 760|294\nGRID V100DX-16Q|293\nQuadro % 6000/8000|293\n$ & 770|293\nGP104|292\n$ & 780 Rev. 2|290\n$ & 1050 Ti|288\n$ & 950|288\nEVGA $ & 1050 Ti|288\n$ & 1650 with Max-Q Design|286\n$ & 880M|285\n%NVIDIA_DEV.13D7.0580.1028%|283\nGP104GL|283\nGigabyte $ & 960|282\nQuadro K5200|281\n$ & 660 Ti|281\n$ & 670|281\nQuadro M4000|280\n$ & 580|280\nMSi $ & 960|280\nTesla M6|278\nPNY $ & 680|278\nT500|277\n$ & 1050|276\n$ & 1050 Ti with Max-Q Design|276\n$ & 690|276\n$ & 680|276\n$ & 670|275\n$ & 760 Ti|274\n$ & 1050 3GB|272\n$ & 880M|272\nTesla M60|272\nAsus $ & 960|271\nQuadro M4000|269\nT600|268\nTesla K20m|268\n$ & 760|268\nGP102 [TITAN Xp]|267\n$ & 960|267\n$ & 670|265\nQuadro T1000 Mobile|265\n$ & 1050|264\nTesla M60|264\nEVGA $ & 1080 Ti|263\n$ & 970M|263\n$ & 780M|262\n$ & 690|262\nAsus $ & 770|261\n$ & 1070 with MaxQ Design|261\nEVGA $ & 960|261\n$ & 960|260\nGRID T4-2Q|259\n$ & 970M|259\n$ & 960|259\nQuadro M3000M|258\n$ & 1060se 3GB|257\nTesla K10|257\nQuadro M3000M|257\nQuadro M2200|256\n$ & 690|255\n$ & 760|254\n$ & 880M|254\nQuadro K4200|253\nQuadro P2000 with Max-Q Design|253\nT550 Laptop GPU|253\nQuadro K5200|252\nMSI $ & 760|250\n$ & 580|249\n$ & 780M Mac Edition|249\n$ & 570|249\nTesla V100-PCIE-16GB|248\n$ GTX880M|248\n$ & 760|247\n$ & 570 Rev. 2|247\nAsus $ & 670|246\n$ & 580|246\n$ & 1050|245\nTesla P4|244\n$ & 680MX|244\n$ & 480|242\n$ & 1050|242\nQuadro 7000|241\nQuadro M4000M|241\n$ & 1050 Mobile|240\n$ & 660|240\n$ & 760 (192-bit)|239\nQuadro K5000|239\n$ & 760 OEM|238\n$ & 660 Ti|238\n$ & 775M Mac Edition|238\n$ & 965M|237\n$ & 870M|236\n$ & 950|236\n$ & 560 Ti 448 Cores|236\n$ & 780M|236\nQuadro P2000 with Max-Q Design|234\nMSI $ & 980 TI|234\nGRID K2|233\n$ & 1060 6GB OpenGL Engine|233\nPNY $ & 1060|233\nEVGA $ & 980|232\nGRID RTX6000P-6Q|232\n$ & 950|232\n$ & 950|232\n$ & 590|231\n$ & 1070 OpenGL Engine|231\nTITAN X (Pascal)|229\n$ & 1050 with Max-Q Design|229\n$ & TITAN Black|228\nQuadro K4200|227\n$ & 660 OEM|227\n$ MX450|225\n$ & 1050 with Max-Q Design|225\nQuadro P1000|225\nGraphics Device|225\nQuadro M2000|222\n$ & 1630|222\nQuadro M4000M|221\nQuadro K5100M|221\nEVGA $ & 760|221\n$ & 1070 Ti|221\n$ & 660 Ti|220\n$ & 570|220\n$ & 660 Ti|219\nQuadro K6000|219\n$ & 570 Rev. 2|219\n$ & 1050 with Max-Q Design|219\nTesla M40|218\n$ & 680M|217\n$ & 780M by Nick[D]vB|217\nAsus $ & 980 TI|217\n$ & 1060 3GB|217\nGraphics Device|217\n$ & 570 Rev. 2|216\n$ & 1060 3GB OpenGL Engine|216\n$ & 660|215\nPoint of View $ & 660 Ti|214\nGigabyte $ & 980|214\nQuadro K5000|213\nQuadro P1000|213\n$ & 480|213\n$ MX450|212\nQuadro K4200|211\nGRID K280Q|211\nAsus $ & 760|210\nQuadro P1000|210\n$ & 680MX|209\n$ & 1060 6GB|209\n$ & 660|209\n$ & 750 Ti|208\n$ & 780M Mac Edition|208\n$ & 775M Mac Edition|208\nGRID K520|208\nQuadro M2200|207\nGRID M60-8Q|207\nGRID K2|207\n$ & 775M Mac Edition|206\n$ & 560 Ti 448 Cores|205\n$ & 760 (192-bit)|205\nQuadro K5000|205\nGigabyte $ & 980 TI|204\n$ & 780M Mac Edition|204\nAsus $ & 660|204\nGRID M60-1B|202\n$ & 650 Ti BOOST|202\n$ & 480|202\n$ & 960M|201\n$ & 660 OEM|201\n$ & 780 Ti|201\nQuadro K5000|201\n$ & 780M Mac Edition|201\n$ & 870M|200\n$ & 680MX|200\n$ & 680MX|199\nQuadro P1000|198\nTesla P100 PCIe 16GB|198\nQuadro K5100M|198\n$ & 470|198\nQuadro P620|197\nAsus $ & 780|197\nQuadro 6000|196\nQuadro M1200|195\nQuadro K2200|195\n$ & 590|195\nQuadro M2000M|194\nQuadro M4000 OpenGL Engine|194\n$ & 870M|194\n$ & 1070|194\nEVGA $ & 750 Ti|194\nZotac $ & 680|193\nQuadro % 3000 with Max-Q Design|193\nT400|193\nQuadro M2200|193\nQuadro K4100M by nikey22|192\nGRID K2|192\n& 865M by iMacGFX|191\nQuadro M2000|191\n$ & 980M|190\n$ & 560 Ti|190\nPalit $ & 660|190\nGRID K260Q|189\nGRID M10-2Q|189\n$ & 660|189\n$ & 965M|189\n$ & 650 Ti BOOST|188\n$ & 675MX Mac Edition|188\nQuadro K5100M by nikey22|187\n$ & 680M|187\nZotac $ & 660|186\n$ & 650 Ti BOOST|186\n$ & 760 (192-bit)|185\nGRID M60-1Q|184\nGigabyte $ & 960|184\nQuadro M2000M Special Edition|184\n$ & 560 Ti|184\nInno3D $ GTX660|183\n$ & 1060|183\n$ & 675MX Mac Edition|182\nQuadro P600|181\n$ & 1080|181\n$ & 675MX Mac Edition|181\nQuadro P620|180\nGK104 Board - 20530501|180\nAshley|180\nQuadro M2000|179\n$ & 860M|179\nMSi $ & 1050 Ti|179\nAsus $ & 750 Ti|178\n$ & 750 Ti|178\n$ & 750 Ti|177\nEVGA $ & 980 TI|177\nAsus $ & 770|177\n$ & 760 OEM|176\n$ & 750|176\nQuadro P2000 Mobile|176\nQuadro K4100M|175\nT400 4GB|174\n$ & 1080 Ti OpenGL Engine|174\nQuadro K5000M|173\n$ & 960A|173\n$ & 560 Ti|172\nTesla M10|172\n$ & 1080 Ti|172\nGRID RTX6000P-6|172\nGK104 Board - 2051b502|172\n$ & 770M|172\n$ & 960M|172\n$ & 970|172\nGRID M10-2Q|171\n$ & 560 Ti OEM|171\nMSi $ & 970|171\nGK104GL [GRID K2]|171\n$ & 470|170\n$ & 560 Ti|170\nTITAN Xp|170\n$ & 870M|170\n$ MX350|169\nMSi $ & 580|169\n$ & 960M|169\nEVGA $ & 760|169\nQuadro K4000M|169\nT400|169\n$ MX350|168\n$ & 470|168\n$ & 560|167\nQuadro 6000|167\n$ & 1050 Ti OpenGL Engine|167\nQuadro M1200|167\nGigabyte $ & 970|166\n$ GT 1030|166\n$ GTX780M by nikey22|166\n$ GTX870M by nikey22|166\nTesla V100-PCIE-32GB|165\nQuadro K2200|165\nQuadro M1000M|165\nQuadro K2200|165\nAsus $ & 970|164\n$ & 750 Ti|164\nQuadro M2000M|164\n$ & 1050|164\n$ & 1050 Ti|163\nQuadro K5000|163\nGraphics Device|162\n$ MX250|162\nT500|161\nEVGA $ & 570|161\nQuadro M2000M|161\nQuadro K1200|159\n$ & 860M|159\n$ & 770M|159\nQuadro M1200|158\n$ & 675MX|158\n$ MX330|158\nQuadro K2200M|157\nQuadro K4000|157\n$ & 690|157\n$ & 860M|157\nMSi $ & 670|156\nQuadro K2200|156\nQuadro K4100M|156\n$ & 770M by Nick[D]vB|155\nTesla V100-SXM2-32GB|155\n$ & 1080 OpenGL Engine|155\nGigabyte $ & 670|155\nEVGA $ & 960|155\n$ & 750|155\n$ Pre-Release TITAN X (Pascal) OpenGL Engine|154\n$ & TITAN Xp|154\nAsus $ & 950|154\nQuadro K4100M|153\n$ & 960|153\n$ & 770M|153\n$ MX330|153\nQuadro M2200 Mobile|153\n$ MX250|153\n$ Pre-Release TITAN Xp OpenGL Engine|153\nQuadro P600|153\nQuadro M620|152\n$ & 1070 Ti OpenGL Engine|152\n$ & 770|152\n$ GT 1030|152\nTesla C2070|152\n$ & 650 Ti|152\nGRID K240Q|151\n$ & 480 OpenGL Engine|151\n$ & 750|151\n$ & TITAN|151\n$ & 760 (192-bit)|151\n$ & 560|151\n$ GT 1030|151\nQuadro K5000M|151\nQuadro P1000 Mobile|151\nZotac $ & 660|151\n$ & 460 v2|150\nGRID & P40-6|150\nMSi $ & 660|149\n$ & 780M|149\nMSI $ & 760|149\nP106-090|149\n$ & 950A|149\n$ MX150|149\nAsus $ & 1060|149\nUnknown|149\n$ & 980 Ti|148\nGRID T4-4Q|148\n$ & 465|147\nColorful $ & 960|147\nGigabyte $ & 750|147\nQuadro M1000M|147\n$ & 780 Mac|147\n$ & 460|146\nMSi $ & 960|146\n$ & 560|146\nQuadro K4000|145\n$ & 970M|145\nQuadro M1000M|145\nUnknown|145\n$ & 980|144\n$ & 950|144\n$ & 675M|144\nZotac $ & 960|144\n$ Pre-Release Graphics Device|144\n$ & 670 OpenGL Engine|143\nQuadro K4000|143\nEVGA $ & 580|143\n$ & 950M|143\n$ & TITAN Black OpenGL Engine|142\n$ & 760|142\nQuadro 5000|142\nMSI $ & 570 HD|142\n$ Pre-Release TITAN Xp COLLECTORS EDITION OpenGL E|142\n$ & 1050 OpenGL Engine|142\n$ & TITAN X|142\n$ & 880M|141\nGV-N660OC-2GD|141\n$ & 750|141\nQuadro M5000M|140\n$ & 970 OpenGL Engine|140\n$ & 675MX|140\nAsus $ & 760|140\nQuadro P5000 OpenGL Engine|139\n$ & 580|139\n$ & 675MX|139\nZotac $ & 750|139\nQuadro K1200|139\n$ MX150|139\n$ & 650 Ti|139\nQuadro K1200|139\n$ & 980 Ti OpenGL Engine|139\n$ & 580M|138\nAsus $ & 580|138\n$ & 770 OpenGL Engine|138\n$ GT 1010|138\n$ & 780 Rev. 2|138\nQuadro P2000 OpenGL Engine|138\n$ MX250|138\nQuadro K4000|137\n$ & 460 v2|137\n$ & 770M|137\nGigabyte $ & 570 HD|136\n$ & 465|136\n$ & 460 v2|136\n$ & 670|136\n$ & 590 OpenGL Engine|136\n$ & 780|135\n$ & TITAN Black|135\n$ & 660 Ti|135\nZotac $ & 560 Ti|134\n$ & 880M OpenGL Engine|134\n$ & 650 Ti|134\n$ & 760 OpenGL Engine|134\nnull Graphics Device|134\nQuadro M620|133\n$ & 780M Mac Edition|133\n$ MX150|132\nAsus $ & 570 HD|132\n$ & 775M OpenGL Engine|132\n$ & 850M|132\nAsus $ & 570|132\nQuadro K6000 OpenGL Engine|131\n$ & 850M|131\n$ & 460|131\n$ & 950A|130\n$ & 780M OpenGL Engine|130\nPoint of View $ & 660 Ti|130\n$ & 775M Mac Edition|130\nEVGA $ & 650 Ti|130\nEVGA $ & 750 Ti|129\n$ & 460|129\nQuadro P520|129\nGainward $ & 570|129\nAsus $ & 750 Ti|129\nQuadro K3100M|128\nQuadro K2200|128\nAsus $ & 560 Ti|127\n$ & 680|127\n$ & 680 OpenGL Engine|127\n$ & 950M|127\nGRID V100-2B|127\nGigabyte $ & 660 Ti|127\nN15E-GT|126\nQuadro K1200|126\n$ & 650 Ti|126\nGigabyte $ & 770|126\n$ & 660|126\nQuadro 5000|125\n$ GT 1030|125\n$ & 950M|125\n$ & 765M|125\nQuadro M5000|125\nGigabyte $ & 560 Ti|125\n$ & 580M|125\nQuadro M2000|124\n$ & 850M|124\n$ & 570 OpenGL Engine|123\nGainward $ & 750 Ti|123\nQuadro K2200M|123\n$ & 780M Mac Edition|123\n$ & 680MX OpenGL Engine|123\nQuadro K4200|123\n$ & 460 OEM|122\n$ & 670MX|122\nMSi $ & 560 Ti|122\n$ & 460 SE|122\nQuadro M4000|122\n$ GTX880M OpenGL Engine|122\nQuadro P620|121\n$ & 560 SE|121\n$ GTX880M by nikey22|121\n$ & 555|121\n$ & 965M OpenGL Engine|121\n$ & 850A|121\nQuadro K5000 OpenGL Engine|120\n$ & 580 OpenGL Engine|120\nQuadro K3100M|120\n$ & 650 Ti BOOST|119\n$ & 570M|119\n$ & 675MX OpenGL Engine|119\n$ & 775M Mac Edition|119\nZotac $ & 1050 Ti|118\n$ & 965M|117\nQuadro M600M|117\n$ & 780M by Nick[D]vB|117\n$ & 460 SE|117\n$ & 555|116\n$ & 670M|116\nQuadro K3000M|116\n$ & 780 Ti OpenGL Engine|116\nQuadro K4000M|115\n$ & 860M|115\nAsus $ & 660|115\nTesla C2075|114\n$ & 675MX Mac Edition|114\nZotac $ & 770|114\nGigabyte $ & 750 Ti|114\n$ MX330|114\n$ GT 1030|113\n$ & TITAN OpenGL Engine|113\n$ & 590|113\nQuadro K620|113\n$ & 780M|112\n$ & 560 Ti|112\nQuadro 6000|112\nEVGA $ & 560 Ti|112\nAsus $ & 960|112\nQuadro K5000|112\nPoint of View $ & 470|111\nPNY $ & 580|111\n$ & 770M|111\n$ GT 120|111\nMSi $ & 660|111\nGigabyte $ & 560|111\n$ & 680MX|110\n$ 945M|110\n$ & 765M|110\n$ & 950 OpenGL Engine|110\n$ Pre-Release Tesla C2075 OpenGL Engine|109\n$ & 550 Ti|109\n$ & 765M|108\nPNY $ & 750|108\n$ & 560 Ti 448 Cores|108\nQuadro P500|108\n$ & 670MX|108\n$ & 680MX|107\n$ & 460 SE|107\n$ & 675MX Mac Edition|107\n$ & 770M OpenGL Engine|107\n$ 945M|107\n$ & 675MX|107\nPNY $ & 570 HD|106\n$ & 745|106\n$ MX230|106\n$ & 670MX|106\n$ 845M|106\nQuadro K3100M OpenGL Engine|105\nQuadro P2000|105\n$ MX570 A|105\n$ & 750 Ti|104\n$ & 660 OEM|104\nQuadro M600M|104\n$ & 750|104\n$ & 645|104\nGP108|104\nQuadro P520|104\nZotac $ & 460|103\nChip Model|103\n$ & 670M|103\nQuadro T1000|103\n$ & 670M|103\n$ & 650|103\nZotac $ & 750|102\n$ & 460 OpenGL Engine|102\n$ & 860M OpenGL Engine|102\nQuadro 4000|102\nAsus $ & 480|102\nZotac $ & 650 Ti|102\n$ GT 755M|101\nGF100 Board - 10220000|101\n$ & 470M|101\n$ & 570 Rev. 2|101\n$ & 775M by iDopt Mac|101\n$ & 765M by Nick[D]vB|101\n$ & 570|101\n$ & 645|101\n$ & 550 Ti|100\n$ & 760M|100\n$ GT 1030 OpenGL Engine|100\n$ & 650|100\nQuadro P400|100\n$ & 480|99\nEVGA $ & 650|99\nEVGA $ & 560|99\n$ MX130|99\n$ MX130|98\nAsus $ & 460|98\nElitegroup $ & 460|98\nTesla V100-SXM2-32GB|98\n$ GT 755M|98\n$ & 760 Ti OpenGL Engine|98\nQuadro P520|97\n$ GT 755M Mac Edition|97\n$ & 1060 5GB|97\nPalit $ & 650 Ti|97\nMSi $ & 460|96\n$ & 650|96\nGigabyte $ & 580|96\nGigabyte $ & 460|96\n$ & 745|96\nEVGA $ & 550 Ti|96\n$ & 465|96\n$ & 460 SE|96\n$ & 765M|96\n$ GT 755M Mac Edition|96\nQuadro M520|95\nQuadro K620|95\nT1000|95\n$ & 745|95\nQuadro K620|95\n$ GT 755M|94\n$ & 660 Ti OpenGL Engine|94\nQuadro K3000M|94\nQuadro K4000|94\nQuadro K4000 OpenGL Engine|94\n$ & 560|94\n$ & 650 Ti OpenGL Engine|94\nZotac $ & 560|94\nAsus $ & 560|93\n$ & 650 Ti|93\n$ GPU|92\n$ & 460|92\nMSi $ & 650 Ti|92\n$ & 645|92\nGigabyte $ & 760|92\n$ & 660M|92\n$ GTS 450|92\n$ & 765M|92\nQuadro K2000D|92\nQuadro K2000|91\n$ GT 740|91\n$ & 650|91\nGRID M6-0B|91\nHP Quadro K620|91\n$ MX130|91\nQuadro K3000M by ST3PHL3|91\nQuadro 4000|90\n$ MX230|90\nQuadro K620|90\nQuadro K2100M by Nick[D]vB|90\nQuadro K3000M by nikey22|89\n$ GT 650M OpenGL Engine|89\nQuadro 4000|89\nQuadro K3000M|88\n$ & 660M|88\nQuadro K6000|87\n$ GT 755M Mac Edition|87\nPalit $ & 650|87\nQuadro P500|87\n$ & 570M|86\nGainward $ & 460|86\n$ & 950M|86\nQuadro K2000D|86\n$ & 650 Ti BOOST|86\nQuadro K2100M|86\n$ & 470|85\nQuadro K2000|85\nQuadro K2000|85\n$ GT 750M Mac Edition|85\n$ & 745|85\nGRID K220Q|85\n$ & 750 OpenGL Engine|85\nQuadro 5000M|84\nQuadro P400|84\n$ GTS 450|84\n$ GT 640 Rev. 2|84\n$ & 660M Mac Edition|84\nQuadro P400|84\nAsus $ & 560 SE|84\nPNY $ & 460|83\n$ GT 640 Rev. 2|83\n$ GTS 450 Rev. 2|83\n$ GTS 450|83\n$ GTS 450 Rev. 2|83\n$ & 645|82\n$ GPU|82\n$ & 560M|82\nQuadro K3000M|82\nQuadro K2100M by nikey22|82\nGigabyte $ & 750|82\n$ GT 740|82\n$ GT 750M Mac Edition|82\n$ & 765M OpenGL Engine|82\n$ & 645 OpenGL Engine|82\nQuadro K620|81\n$ & 550 Ti OpenGL Engine|81\nQuadro 4000M|81\nPNY $ & 550 Ti|81\n$ MX110|80\n$ & 760M|80\nMSi $ & 745|80\nQuadro K2100M OpenGL Engine|80\nQuadro K2000|80\nQuadro 5000|80\nQuadro K620 OpenGL Engine|80\nMSi $ & 745|80\n$ GT 755M OpenGL Engine|80\n$ & 660M|79\nGigabyte $ & 550 Ti|79\nMSi $ & 650|79\n$ & 560M|79\nQuadro P400|78\nQuadro K2100M|78\nQuadro K2100M|78\nZotac $ & 1050 Ti|78\nQuadro 3000M|77\n$ 940A|77\n$ & 460M|77\n$ & 550 Ti|77\n$ GT 545|77\n$ GT 650M Mac Edition|77\n$ 940MX|76\n$ & 650 OEM|76\n$ & 550 Ti|76\n$ GT 755M Mac Edition|76\n$ GT 740 OpenGL Engine|75\nGainward $ & 550 Ti|75\nQuadro K1200|75\n$ GT 650M Mac Edition|75\nEVGA $ & 650|75\n$ GT 750M Mac Edition|74\n$ & 745|73\n$ & 555|73\n$ & 650|73\nGainward $ GTS 450|73\n$ GT 650M|73\n$ GT 755M Mac Edition|73\n$ & 460M|72\n$ 930A|72\n$ 930MX|72\n$ 940MX|72\n$ MX110|72\n$ GT 750M Mac Edition|72\nQuadro 2000|72\n$ 845M|71\nQuadro 2000D|71\n$ GT 640 Rev. 2|71\n$ MX110|71\n$ GT 1010|71\n$ GT 545|71\nQuadro K1200 OpenGL Engine|71\n$ 940MX|71\n$ & 650 OpenGL Engine|71\nEVGA $ & 650 Ti BOOST|71\nQuadro K2100M|70\n$ GT 1010|70\nQuadro M500M|70\n$ GT 650M Mac Edition|70\n$ GT 640 OEM|70\nQuadro K2000D|70\nQuadro K2000 OpenGL Engine|70\n$ GT 750M Mac Edition|70\n$ GT 650M|69\nQuadro K1100M by Nick[D]vB|69\n$ GT 650M|69\n$ 940M|69\n$ GT 650M|69\nQuadro 4000|69\n$ GT 650M Mac Edition|69\n$ GT 745M|69\nGainward $ & 560 Ti|68\n$ 920MX|68\nQuadro M520|68\n$ GT 640|68\n$ 840M|68\n$ 9800 & / 9800 &+|68\n$ & 770M by Nick[D]vB|67\nZotac $ & 650|67\nAsus $ & 550 Ti|67\n$ GT 750M|67\nQuadro K3100M by nikey22|67\n$ GT 750M|67\n$ & 760 (192-bit) OpenGL Engine|67\nHP Quadro 4000|67\nQuadro K2000|67\n$ GTS 450 Rev. 2|67\n$ 930MX|67\n$ & 660M Mac Edition|66\n$ & 570|66\n$ GT 750M|66\n$ GT 650M Mac Edition|66\n$ GT 650M OpenGL Engine|65\n$ & 660M OpenGL Engine|65\n$ 930M|65\nPalit $ & 650|65\n$ & 760M|65\n$ GT 650M Mac Edition|65\n$ 940M|65\n$ GT 750M Mac Edition|64\n$ 940M|64\n$ GT 740|63\n$ 930MX|63\nQuadro 3000M|63\n$ GT 730|63\nQuadro K1100M|63\n$ GT 750M|63\n$ 840M|63\n$ GT 640 OEM|63\n$ 840M|63\n$ GT 640 Rev. 2|62\n$ GTS 450|62\nQuadro 2000|62\n$ GT 745M|62\n$ GT 740|62\n$ GT 640|62\nQuadro 2000|62\n$ & 660M Mac Edition|62\nQuadro K1100M OpenGL Engine|62\nQuadro K2000M|62\n$ & 680MX OpenGL Engine|61\nEVGA $ GT 730|61\nQuadro 2000D|61\n$ 840A|61\nMSi $ & 660 Ti|61\nQuadro K1100M|61\n$ GT 645M|61\n$ & 780M OpenGL Engine|61\nHP $ GT 730|61\nQuadro K5000M OpenGL Engine|61\nEVGA $ GT 640|61\n$ 920MX|60\nQuadro M500M|60\nQuadro K620M|60\n$ 930M|60\n$ 930A|60\n$ GT 640 OEM|60\n$ GT 640|60\nQuadro 2000M|60\n$ GT 640|60\n$ GT 640M Mac Edition|60\n$ GT 640M Mac Edition|60\n$ GT 640M Mac Edition|59\n$ GT 645M|59\n$ 930M|59\nGigabyte $ & 650 Ti|59\n$ GT 640 OEM|59\n$ 830M|59\nAsus $ GT 640|58\nMSI $ & 1070|58\n$ GT 555M|58\nQuadro K2000M|58\nQuadro K1100M|57\n$ GT 650M Mac Edition|57\nQuadro K2000M by Nick[D]vB|57\nEVGA $ & 650 Ti|57\n$ GT 640M|56\n$ GT 650M Mac Edition|56\n$ GT 445M|56\n$ 830A|56\n$ 9800 GT|56\nAsus $ GTS 450|55\n$ 830M|55\n$ 920MX|55\nQuadro 2000|55\nEVGA $ GT 545|54\nQuadro K2000M|54\n$ GT 650M Mac Edition|54\n$ & 280|54\n$ GT 640|53\nQuadro FX 2800M|53\nQuadro 3000M OpenGL Engine|53\n$ GT 740|53\nnull $ 920A|53\n$ GT 640M Mac Edition|52\n$ GT 635|52\nGraphics Device|52\n$ GT 640M|52\n$ & 660M Mac Edition|52\nQuadro 2000M|52\nQuadro 5010M|52\n$ GTS 250|52\n$ GT 445M|51\n$ GT 640M OpenGL Engine|51\n$ GT 640M|50\nEVGA $ GT 740|50\n$ GT 640M Mac Edition|50\n$ 730A|50\n$ 920M|49\nHP Quadro 2000|49\n$ GT 730M|49\nnull $ 920A|49\n$ GT 555M|49\n$ GT 640M LE|49\n$ GT 730M|49\n$ GT 730M|48\n$ GT 640M Mac Edition|48\nQuadro K2000M OpenGL Engine|48\n$ GT 640M LE|48\n$ GT 740M|47\n$ & 460M|47\n$ GT 440|47\n$ GT 440|46\n$ GT 640M Mac Edition|46\nQuadro P400|46\n$ GT 730|46\nDell Quadro 2000M|45\n$ GT 740M|45\n$ GT 740M|45\n$ GTS 450 Rev. 2|45\n$ 920M|45\n$ 920M|45\n$ 910M|44\n$ & 680M|44\n$ GT 730|44\nQuadro 2000M|44\n$ GT 635|43\n$ GT 720 OpenGL Engine|43\n$ GT 635|43\nQuadro K5200 OpenGL Engine|43\nZotac $ & 650|43\n$ GT 440|43\n$ GT 435M|42\n$ GT 735M|42\nGainward $ GT 630|42\nQuadro 1000M|42\n$ 820M|41\n$ & 680M OpenGL Engine|41\nMSI $ GT 635|41\n$ 820A|41\nTesla M10|41\nAsus $ GT 440|40\nAsus $ GT 630|40\n$ GT 820M|40\n$ 910M|40\n$ GT 820M|40\n$ GT 730|40\n$ GT 550M|40\n$ GT 430|40\n$ GT 540M|39\nAsus $ GT 720|39\n$ GT 630|39\n$ GT 530|39\n$ GT 635M|39\n$ GT 620M/630M/635M/640M LE|39\nNVS 5400M|39\nQuadro K600|39\nQuadro K610M|39\nAsus $ GT 730|39\n$ GT 630|39\n$ GT 440|39\n$ GT 630M|38\n$ 820M|38\nQuadro K420|38\nQuadro K610M|38\n$ GT 625M|38\nQuadro K1000M|38\nNVS 5200M|38\nGRID K1|38\nQuadro K600|38\nQuadro K420|38\n$ GT 630|38\nQuadro K600|37\nQuadro 600|37\nHP Quadro 600|37\nQuadro K1000M|37\nQuadro K610M|37\nGRID K180Q|37\nGRID K160Q|37\n$ GT 635M|37\nGigabyte $ GT 440|37\n$ 820M|37\n$ GT 530|37\n$ GT 540M|37\n$ GT 630 OEM|37\nQuadro K610M by Nick[D]vB|37\nNVS 510|37\n$ GT 630M|37\nQuadro 1000M|37\n$ GT 540M|37\n$ GT 530|37\nQuadro K1100M|37\nQuadro K620M|37\nQuadro 1000M|36\n$ GT 730|36\n$ 820M|36\n$ GT 430|36\nGRID K1|36\n$ GT 525M|36\nNVS 5200M|36\nNVS 510|36\nZotac $ GT 430|36\nQuadro K600|36\nAsus $ GT 730|36\nHP Quadro K4000|35\n$ GT 755M Mac Edition|35\n$ GT 630|35\nNVS 5400M|35\nNVS 5400M|35\n$ GT 640 OpenGL Engine|35\n$ GT 625M|35\n$ GT 630|35\n$ GT 430|35\nQuadro K600 OpenGL Engine|35\nQuadro K1000M|35\nZotac $ GT 630|35\nGigabyte $ GT 630|35\nGRID K140Q vGPU|35\n$ GT 710M|35\n$ GT 620M|35\n$ GT 720M|34\n$ 710M|34\nQuadro 1000M,|34\nQuadro K510M|34\n$ 9400 GT|34\nQuadro K1000M|34\n$ GT 635M|34\nQuadro K420|34\nGRID K180Q|34\nAsus $ GT 430|34\nQuadro K4100M|34\nGigabyte $ GT 730|34\n$ GT 620M|34\n$ GT 525M|34\nQuadro K420|34\nDell NVS 5200M|34\n$ 710A|34\n$ GT 425M|33\n$ GT 710B|33\n$ GT 525M|33\nQuadro 600|33\n$ GT 620M|33\nQuadro K600|33\nQuadro 600|33\n$ 610M/710M/810M/820M / GT 620M/625M/630M/720M|33\nMSI $ GT 730|33\n$ GT 710|33\n$ GT 435M|33\nNVS 510|33\nAsus $ GT 710|33\nNVS 510|32\n$ 710M|32\n$ GT 720M|32\n$ GT 730A|32\n$ GT 710M|32\nGIGABYTE $ & 660|31\nEVGA $ GT 710|31\n$ GT 710|31\n$ GT 710|31\n$ GT 425M|31\n$ GT 720|31\nEVGA $ GT 710|31\nQuadro K1000M by Nick[D]vB|31\nAsus $ GT 710|31\n$ GT 720|31\n$ GT 420M|30\n$ GT 710|30\nnull Graphics Device|30\n$ GT 240|30\n$ 810M|29\n$ GT 720M|29\n$ GT 710|29\nQuadro 600|29\n$ 810M|29\n$ GT 420M|28\nQuadro 410|28\n$ & 660M|28\nMSI $ GT 710|28\n$ GT 720|28\n$ GT 735M|27\n$ GT 720|27\n$ GT 720|27\n$ GT 630 OpenGL Engine|27\nQuadro 410|27\n$ GT 330M|26\n$ GT 420M|26\n$ GT 430|26\n$ 615|25\n$ & 760A|25\nToshiba $ GT 525M|25\n$ GT 520MX|25\n$ GT 620|25\n$ GT 625|25\n$ GT 710|24\nQuadro NVS 4200M|24\n$ 840A|24\n$ 610M|24\n$ 800M|24\n$ GT 420|24\n$ 705M|23\n$ GT 705|23\n$ 800M|23\n$ 610M|23\n$ GT 620 OEM|23\n$ GT 625|23\n$ GT 420|23\nQuadro NVS 4200M|23\n$ GT 520M|22\nNVS 4200M|22\n$ GT 620 OEM|22\nNVS 5200M|22\n$ GT 620 OEM|22\n$ GT 620|22\n$ GT 705|21\n$ GT 620|21\n$ GT 630 Rev. 2|21\nQuadro NVS 4200M|21\n$ GT 520M|20\n& 980M SLI|20\n$ GT 620|20\n$ GT 520M|20\n$ GT 520|19\n$ 410M|19\n$ 730A|19\n$ GT 520|19\n$ GT 610|19\nAsus $ GT 610|19\nNVS 310|18\n$ 410M|18\nNVS 315|18\n$ 605|18\n$ GT 610|18\n$ GT 520|17\n$ MX550|17\nNVS 4200M|17\nNVS 315|17\nNVS 310|17\n$ 410M|17\nPalit $ & 660|17\n$ 605|17\nNVS 310|17\n$ GT 415M|17\nZotac $ GT 610|17\n$ & 675M|17\n$ GT 610|16\nQuadro 4000M|16\nPNY $ GT 610|16\n$ GT 610|16\n$ 510|15\nMSi $ GT 610|15\n$ GT 735M|15\n$ GT 520|15\n$ 510|15\n$ GT 320M|14\n$ 9600M GT|14\n$ & 570M|14\nCorporation D3D12 (NVIDIA $ % 3080 Ti)|13\n$ 510|13\nQuadro FX 1800M|12\nAsus $ GT 520|12\n$ GT 705|12\nMSi $ GT 630|11\nQuadro 3000M|10\nGigabyte $ GT 610|10\nPegatron $ GT 420|9\n$ 210|8\n$ 9300 / nForce 730i|7\nNVS 3100M|7\n$ 8600 GT|5\n$ 8400 GS Rev. 3|4\n$ 8400 GS|3\n$ 9600 GT|2\n$ GT 550M|-1\n$ 8600 GTS|-1\n$ GT 520MX|-1\nEVGA $ & 460|-1\nEVGA $ & 970|-1\nGP106|-1\nGRID P4-2B|-1\nGainward $ & 650|-1\n$ 210|-1\n$ 310|-1\n$ 310M|-1\n$ 315|-1\n$ 315M|-1\n$ 320M|-1\n$ 405|-1\n$ 610M|-1\n$ 820A|-1\n$ 8300 GS|-1\n$ 8400 GS|-1\n$ 8400 GS Rev. 2|-1\n$ 8400 GS Rev. 3|-1\n$ 8400M GS|-1\n$ 8400M GT|-1\n$ 8500 GT|-1\n$ 8600 GT|-1\n$ 8600M GS|-1\n$ 8600M GT|-1\n$ 8700M GT|-1\n$ 8800 GT|-1\n$ 8800 GTS|-1\n$ 8800 GTS 512|-1\n$ 8800 &|-1\n$ 8800M &|-1\n$ 9200M GE|-1\n$ 9200M GS|-1\n$ 9300 / nForce 730i|-1\n$ 9300 GE|-1\n$ 9300 GS|-1\n$ 9300M GS|-1\n$ 9400|-1\n$ 9400M|-1\n$ 9500 GT|-1\n$ 9500M GS|-1\n$ 9600 GS|-1\n$ 9600 GSO|-1\n$ 9600 GSO 512|-1\n$ 9600 GT|-1\n$ 9600M GS|-1\n$ 9600M GT|-1\n$ 9600M GT / $ GT 220M|-1\n$ 9800 GT|-1\n$ 9800 &+|-1\n$ 9800 &/9800 &+|-1\n$ 9800M GTS|-1\n$ G 103M|-1\n$ G 105M|-1\n$ G105M|-1\n$ G205M|-1\n$ G210|-1\n$ G210M|-1\n$ GT 120|-1\n$ GT 120M|-1\n$ GT 130|-1\n$ GT 130M|-1\n$ GT 220|-1\n$ GT 220M|-1\n$ GT 230|-1\n$ GT 230M|-1\n$ GT 240|-1\n$ GT 240M|-1\n$ GT 240M|-1\n$ GT 320|-1\n$ GT 320M|-1\n$ GT 325M|-1\n$ GT 330|-1\n$ GT 330M|-1\n$ GT 335M|-1\n$ GT 435M|-1\n$ GT 520M|-1\n$ GT 525M|-1\n$ GT 555M/635M|-1\n$ GTS 240|-1\n$ GTS 250|-1\n$ GTS 360M|-1\n$ & 1180|-1\n$ & 260|-1\n$ & 260M|-1\n$ & 275|-1\n$ & 280|-1\n$ & 285|-1\n$ & 295|-1\n$ & 560 SE|-1\n$ & 750 v2|-1\n$ % T10-16|-1\n$ % T10-8|-1\nGigabyte $ & 1050 Ti|-1\nION|-1\nMSI $ GT 710|-1\nNVS 300|-1\nNVS 3100M|-1\nNVS 4200M|-1\nNVS 5100M|-1\nPalit & 680 JetStream|-1\nQuadro FX 1700|-1\nQuadro FX 1700M|-1\nQuadro FX 1800|-1\nQuadro FX 1800M|-1\nQuadro FX 2700M|-1\nQuadro FX 2800M|-1\nQuadro FX 3600M|-1\nQuadro FX 360M|-1\nQuadro FX 370|-1\nQuadro FX 3700|-1\nQuadro FX 3700M|-1\nQuadro FX 380 LP|-1\nQuadro FX 3800|-1\nQuadro FX 3800M|-1\nQuadro FX 4600|-1\nQuadro FX 4800|-1\nQuadro FX 4800|-1\nQuadro FX 5600|-1\nQuadro FX 570M|-1\nQuadro FX 580|-1\nQuadro FX 770M|-1\nQuadro FX 880M|-1\nQuadro K1100M by Nick[D]vB|-1\nQuadro K2000D|-1\nQuadro K2000M|-1\nQuadro K2100M by Nick[D]vB|-1\nQuadro NVS 135M|-1\nQuadro NVS 140M|-1\nQuadro NVS 160M|-1\nQuadro NVS 290|-1\nQuadro NVS 295|-1\nQuadro NVS 4200M|-1\nQuadro P4000 OpenGL Engine|-1\nSony $ 410M|-1\nZotac $ & 780|-1\n",b="\n@ ^ 7900 XT|2200\n@ ^ 7900 XT|1970\n^ 6800 XT|1960\n@ ^ 6900 XT (XTXH)|1930\n@ ^ 6900XT|1925\n@ PRO W6900X|1890\n^ 6900 XT|1850\n@ ^ 6900|1810\n@ ^ 7900 XTX|1770\nRX6800|1690\nFreddyVGA|1600\n@ PRO W6800|1560\n@ ^ 7900 XTX|1430\n@ ^ 6950 XT|1380\n@ ^ 6800 XT|1360\n@ ^ 6750 XT|1310\n@(TM) ^ 6850M XT|1290\n@ ^ 6700|1290\n@ ^ 6900 XT|1270\nSapphire Nitro+ ^ 6800|1260\n@ PRO W6800X|1250\n@ PRO W6800X Duo|1220\n@ ^ 6700|1210\n@ ^ 6800 XT|1180\nSapphire Nitro @ RX6650XT|1180\n@(TM) ^ 6750 XT|1160\n@ ^ 6800|1160\n@ ^ 6900 XT|1160\nASRock ^ 6650 XT Phantom Gaming|1160\n@ Navi23|1140\n@ ^ 6650 XT|1130\n@ ^ 6950 XT|1130\n@ 6800|1120\n@ ^ 6700 XT|1110\n@ Pro W6600X|1100\n@ ^ 6700M|1080\n@ ^ 6800M|1080\n@ ^ 5700 XT PJM|1060\n@ ^ 6800|1050\n@ ^ 6600 XT|1040\n@ ^ 6600 XT|1030\nASUS ^ 6600XT macOS Edition|1020\n@ ^ 6800M|1020\n@ Pro Vega II Duo|1015\n@ ^ 5700 Series|960\n@ ^ 6800/6800 XT / 6900 XT|960\n@ ^ 6600 XT|960\n@ Pro Vega II|955\n@ ^ 6650 XT|950\nNavi 10 5700 XT|950\n@ Pro Vega II|950\n@ ^ 5700 Series|950\n@ Pro W5700X|930\n@ ^ 6600|930\nASUS @ ^ 5700 XT|930\n@ Pro W5700X|920\n@ Pro 5700 XT|920\n@ ^ 6900 XT|920\n@ ^ 5700 XT|910\n@ Pro W5700|895\n@ ^ 6600/6600 XT/6600M|890\n@ ^ 6750 XT|880\n@ ^ 6600|870\n@ ^ 5700|855\n@ ^ 5700 XT 50th Anniversary|850\n@ VII|850\n@ ^ 5700 XT 50th Anniversary|840\n@ PRO W6800|840\n@ Pro Vega 64|820\n@ Navi10|820\n@ ^ 5600 XT|820\n@ ^ 6600M|800\n@ ^ 6800S|790\n@ Pro 5700 XT|780\n@ ^ Vega 64 8GB|770\n@ Pro 5700|770\n@ Vega Frontier Edition|770\n@ ^ Vega|760\n@ ^ Vega 56/64|760\n@(TM) ^ Vega|760\n@ Pro Vega 64X|740\n@ ^ 5600 XT|740\n@ PRO W6600|740\n@ Vega 64 LC|735\n@ ^ Vega 64.1|730\n@ ^ 6600M|730\n@ Pro 5700|720\n@ Vega Frontier Edition|710\n@ Vega Frontier|700\n@ Vega FE|700\n@ ^ 5700 XT|690\n@ Pro Vega 64|670\n@ Vega 64|670\n@ VII|660\n@ Pro WX9100|660\nSapphire @ ^ Vega 64 8GB|650\n@(TM) PRO W6600M|650\n@ ^ 5700 XT 50th Anniversary|650\n@ ^ 5700|640\n@ Pro W5700|640\n@(TM) Pro WX 9100|635\n@ ^ Vega 56|630\n@ ^ Vega 56|620\n@ Pro 5500 XT|620\n@ ^ 5600 OEM/5600 XT / 5700/5700 XT|620\n@ ^ 5500|620\n@ ^ 5500 XT|620\n@ Vega Frontier Edition|620\n@ ^ 5500M Series|610\n^ xxx|610\n@ Pro Vega 64X|610\n@ ^ Vega 64|610\n@ ^ 5600 XT|610\n@ Pro Vega 64|610\n@ ^ 6500 XT|600\n@ Vega|600\n@ Pro W5500|600\n@ ^ 5600M|600\n@ Pro Vega 56|600\n@ Pro Vega 64|590\n@ Pro 5600M|590\n@ Pro Vega 48|590\n@ Pro Vega II Duo|590\n@ ^ 590 Series|590\n@ ^ Vega 56 8GB|590\n@ Pro 5600M|590\n@ Pro WX 9100|590\n@ Pro 5300|580\n@(TM) R9 Fury Series|580\n@ ^ 6800 XT 16GB|570\n@ Pro 5600M|570\n@ Pro W5500X|560\n@(TM) ^ 5500M|560\n@ * 7870|560\n@ Pro W5500|550\n@ ^ 5500M|550\n@ R9 290X Series|550\n66AF:F0|550\n@ Pro 5500 XT|550\n@ ^ 580 Series|550\n@ ^ 5500XT|550\n@(TM) ^ 580X|540\n@ Pro 5500 XT|540\n@(TM) Pro W5500M|540\n@ Pro W5500X|540\n@ Pro W5500|540\nRadeonT ^ 5300|540\n@(TM) ^ 570 Graphics|520\n@ Pro 5300|520\n@(TM) ^ 6500M|520\n@ ^ Vega M GL|520\nASUS @ ^ 570 Series|520\nASUS @ ^ 580 Series|520\n@(TM) ^ 580|520\n@(TM) Pro V7350x2|520\n@(TM) ^ 480 Graphics|520\n@(TM) ^ 570 Graphics|515\n@ ^ 6400|510\n@ Pro 580X|510\n@(TM) R9 390 Series|500\n@ Pro 5300|500\n@ ^ 580 2048SP|500\n@ PRO W6400|500\n@ ^ 570 Series|500\n@ PRO W6800X Duo|500\n@ Pro 580|500\n@ ^ 5500 XT|500\n@ ^ 6400|490\n@ Pro 580|485\n@(TM) Pro WX 7100 Graphics|485\n@(TM) R9 290X|480\nSapphire @ ^ 580 Pulse|480\n@ ^ 6700/6700 XT / 6800M|470\n@(TM) ^ 580|475\n@ ^ 6700S|475\n@ R9 290X|470\n@(TM) ^ 470 Graphics|470\n@ R9 FURY / NANO Series|470\n@ Embedded E9560|470\nKamen Rider Black ^|460\n@(TM) E9550|460\n@(TM) ^ 580 Graphics|460\n@ ^ Vega 56/64|460\n@(TM) ^ 480|460\n@ ^ 6800 XT|460\n@ ^ 470 Series|460\n@ RX480|455\n66AF:F1|455\n@ Pro 480/575|455\n@ Embedded E9560|450\n@ FURY|450\n@ ^ 5600 OEM/5600 XT / 5700/5700 XT|450\n@ ^ 6600 XT|450\n@ * 6800 Series|445\n@ Pro 570X|440\n@(TM) ^ 470 Graphics|440\n@ Pro 575X|440\n@ ^ 470/480/570/570X/580/580X/590|440\n@ ^ 6600|440\n@ ^ Vega M GH Graphics|440\n^ 580|440\n@ ^ 570|440\n@ Pro 570|440\n@ ^ 590|440\n@(TM) ^ 470 Series|435\n@ ^ 6900 XT|435\n@ FURY X|430\n^ 590|430\n@ Pro 5500M|430\n???|430\n@(TM) ^ 570|430\n@ ^ 580|430\n@ * 8xxx|430\n@ R9 290|425\n@ Pro 5500M|420\n@ Pro 580X|420\n@ ^ 6700 XT|420\n@ ^ 480|420\n@ R9 290/390|420\n@ Pro 580X|420\n@(TM) Pro Duo|415\nEllesmere @ ^ 570|410\n@ R9-290X|410\n@ Pro 580|410\n@ R9 200 Series|400\n@ ^ 570|400\n@ Pro 470/570|400\n@ ^ 6800M|400\n@ ^ 5300M|400\n@ ^ 580 Series (POLARIS10, DRM 3.40.0, 5.11.9-141-tkg-pds, LLVM 11.1.0)|400\n@ Pro 5300M|400\n@ R9 285|400\n@ ^ 470|400\n@ Pro 575|390\n@ Pro 575X|390\n@ Pro WX 7100|390\n@ ^ 6700M|390\n@ ^ 470/480/570/570X/580/580X/590|380\n@ PRO W6600|380\n@ Polaris|370\n@ ^ 6500 XT|370\n@ Pro Vega 20|370\n@ * 7970|370\n@ Pro Vega 16|370\n@ ^ 6800|370\n@ Pro Vega 64 OpenGL Engine|370\n@(TM) R9 380 Series|360\n@ ^ 5700XT|360\nFirePro W8100|360\n@ Pro Vega 64|365\n@ Pro 570|365\n@ Pro 570X|360\n@ Pro Vega 64 OpenGL Engine|360\n@ R9 280x|360\n@ R9 380|360\n@ R9 280x|360\n@ R9 280x|360\n@ Pro Vega 56|360\nR9 280X Dual-X|360\n@ Pro Vega 56 OpenGL Engine|350\n@ * 7970|350\n@ * 7970X/8970/R9 280X|350\n@ R9 285|350\n@ R9 380X|350\n@ ^ 480|350\n@ ^ 5700 XT Series|350\nASUS @ ^ 470 Series|350\n@ Pro Vega 64|350\n@ R9 200 / * 7900 Series|340\nASUS @ ^ 470 Series|340\n@ Vega 56|340\n@ ^ 580 Series (AMD POLARIS10 / DRM 3.15.0 / 4.12.0-1-amd64, LLVM 4.0.1)|340\n@ Pro Vega 20|340\nR9 380|340\n@ * 7970|340\n@ ^ 5700 XT|330\n@ D700|330\nAsus @ R9 280|330\n@ R9 285|330\n@ R9 M395X|330\n@ ^ 5600 XT|330\nPowerColor @ R9 280|330\n@ R9 280|330\nFirePro W7100 Graphics Adapter|330\n@ R9 M295X Mac Edition|330\nASUS @ ^ 5700|330\n@ R9 380|330\n@ Pro Vega 16|325\n@ R9 290X|325\n@ RX5600|320\nASUS @ ^ 5500 XT|320\n@ R9 280|320\n@ * 7950/8950 / R9 280|320\n@ R9 M395|320\n@ ^ 6800/6800 XT / 6900 XT|320\nFirePro D700 (FireGL V)|320\n@ ^ 5500/5500M / Pro 5500M|320\nMSI @ ^ 6600 XT Gaming X|320\nFirePro W8000|315\n@ * 7950|315\n@ Pro W5700|315\nFirePro W7170M|310\n@ PRO W6800|310\n@ ^ 5500|310\n@ ^ 580 Special Edition|310\nRadeonT ^ 5500M|310\n@ R9 M395 (Bootcamp XG edition by bootcampdrivers.com)|310\n@ R9 360|310\n@ Pro WX 7100|310\n@ Pro WX 7100 Mobile|310\n@ ^ 5700 XT 50th Anniversary|310\nR9 xxx|300\n@ ^ 5700XT|300\n@ PRO W6400|300\n@(TM) R9 370 Series|300\n@ ^ 470/480/570/570X/580/580X/590|300\n@(TM) PRO W6600M|300\n@ * 8950|300\n@ R9 M395X|300\n@ R9 M395X|300\n^ Vega 64|300\n@ ^ Vega 11 Graphics|295\n@ Pro 270X|290\n@ ^ 580 2048SP|290\n@ * 7950|290\nVideo Controller (VGA Compatible)|290\n@(TM) R7 370 Series Graphics|290\n@ * 7950|290\nAsus @ R9 270X|290\n@ ^ 580X Series|290\n@(TM) ^ 5500M|285\n@ R9 270X|285\n^ xxx|285\nASUS R7 265 Series|280\n@(TM) R9 270|280\n731F:C1|280\n@ R9 M395X|280\n@(TM) R7 370 Series|280\n@ Pro V520 MxGPU|280\n@ R9 M395|280\nFirePro D700|280\n@ R9 270X|280\n@(TM) R9 200 Series|270\n@ ^ 5700|275\nRadeong 0.4 on AMD POLARIS10 (DRM 3.8.0 / 4.9.11-1-ARCH, LLVM 3.9.1)|270\n@ * 7870 XT|270\n@ R9 390X|270\n@(TM) ^ 570 Graphics|270\n@ * 7870 GHz Edition|270\n@ R9 390|270\nFirePro D700|270\n@ R9 M395|270\n@ R9 270|270\n@ ^ 5700 / 5700 XT|270\nASUS R7 370 Series|270\nFirePro W7000|270\n@(TM) Pro V7350x2|270\n@(TM) ^ 470 Series|270\n@ ^ Vega 64 OpenGL Engine|270\n@ ^ 5500M|265\n@ * 7950/8950 OEM / R9 280|265\n@ Vega Frontier Edition OpenGL Engine|265\n@ 7950 x2|263\n@ R9 270|263\n@ VII|263\n@ * 7xxx|262\nVideo Controller (VGA Compatible)|262\n@(TM) ^ 570|261\n@ ^ 5500 XT|261\n@ R9 M295X|261\nFirePro W7000 (FireGL V) Graphics Adapter|260\n@ R9 M390|260\n@ * 7870 GHz Edition|260\n@ R9 M390 (Bootcamp edition by bootcampdrivers.com)|260\n@ R9 370|259\nMetal|259\n@ * 7870|259\n@ ^ 470/570|258\n@(TM) R9 370|257\n@(TM) ^ 460|257\n@ ^ 560 Series|256\n@ R9 290|255\n@(TM) ^ 560 Series|255\n@ ^ 5300M|254\nFirePro W7000|254\n@ R9 290X|253\n67EF:E7|253\n@ * 7850|253\n@(TM) ^ 460 Graphics|253\nMSI @ ^ 580|251\n@ R9 290/390|250\nFirePro W8100 (FireGL V)|249\n@ Pro WX 9100 OpenGL Engine|248\n@(TM) ^ 560|247\n@(TM) ^ 560 Series|247\n@ Pro Vega II Duo|247\n@ * 7970M|246\n@ R9 290|245\n@ ^ 5600M|245\nFirePro D300|245\n@(TM) ^ 5600M Series|244\n@ ^ 590 Series|244\n@ R7 370 Series|244\n@(TM) ^ 560|243\nFirePro D300|243\n@ R9 390|243\n@ ^ 470/480/570/570X/580/580X|243\nFirePro D300|243\n@(TM) R7 370 Series|242\n@ R9 M390|241\n@ ^ 560X Series|241\nFirePro D300|241\n@ ^ 560|240\n@ R9 M290X|240\nGigabyte Vega 64 macOS Edition|239\n@ Pro 580|238\n@ Pro WX 4100|236\n@ Pro WX 7100 OpenGL Engine|236\n@ * - FirePro D300|235\nFirePro D500|234\n@ Pro 580 OpenGL Engine|234\n@(TM) E9260|234\n@ Pro WX 2100|233\nFirePro D500|232\nFirePro D500|232\n@(TM) ^ 6500 XT|232\n@ Pro 580X|231\n@ * 7850|231\n@ Pro 575|231\n@ Pro Vega 64X|231\nASUS R9 270 Series|230\n@ Pro 450|230\n@(TM) ^ 560 Graphics|230\n@ R9 M290|229\n@ Pro 560X|228\n@ Pro 480/575|228\nPitcairn PRO @ * 7850|228\nASUS @ ^ 5700 XT|227\n@ * 7870|227\n@(TM) Pro WX 5100 Graphics|226\n@ R9 370X|225\n@(TM) ^ 480|224\n@ HD7970M|224\nFirePro S9000 (FireGL V)|223\n@ ^ 550 640SP / ^ 560/560X|222\nMSI / AMD ^ 560 4G|222\n@ ^ 570 OpenGL Engine|222\nMSI RX650|222\n^ 480|221\nMSI / AMD ^ 560|221\nBaffin AMD @ ^ 560|221\nMSI Baffin RX650|220\n@ Pro 5700 XT|220\n@ Pro 570|220\n@ Pro 575 OpenGL Engine|219\nAsus @ R9 270X|219\n@ ^ ^ 560|218\n@ ^ 560 [Baffin]|218\n^ 460|218\n@ R9 370X|218\n@(TM) Pro WX 4100|217\nASUS R9 390 Series|217\n@ Pro 5600M|217\nR9 xxx|217\n@ * 7870 Series|217\n@ Pro ^ 560|216\nR9 280X Dual-X|215\n@ Pro 570 OpenGL Engine|214\n^ 560|213\n@ Pro WX 5100|213\nFirePro D700|213\n@(TM) R9 390 Series|213\n@ ^ 480|212\n@ ^ 560|212\n@ ^ 5500/5500M / Pro 5500M|212\n@ ^ 550 640SP / ^ 560/560X|211\n@ R9 FURY / NANO Series|211\nSapphire @ ^ 560|211\n@ ^ 460|210\n@ RX550/550 Series|210\ninc. @ ^ 480|209\n@(TM) ^ 550|208\n@ R9 M290X|206\n@ Pro 560 (Bootcamp XG edition by bootcampdrivers.com)|206\n@ RX460|206\n@ ^ 550 Series|205\nCustom GPU 0405|204\n@(TM) ^ 460|204\nASUS AMD @ R9-990X|204\n@ Pro 555X|203\n@ ^ 460/560|203\n@ * 7970X/8970/R9 280X|202\nASUS @ ^ 550 Series|201\n@ * 8950|201\nFirePro D500 (FireGL V)|201\n^ 5700XT|200\n@ 550 Series|200\n@ * 8470 + 7660D Dual Graphics|200\n@ * 7990|200\n@ ^ 560X|199\n@ ^ Vega|199\n@ * 7950 Series|198\n@(TM) ^ 540|197\n@ * 6970|197\n@ * 7970/8970 / R9 280X|197\n@ Navi14|197\n@ Pro 560|197\n@ ^ 550|197\n@ R9 285|196\n@ Pro W5500|195\n@ Pro Vega 56|195\n@ Pro 460|195\n@ ^ 470/480|194\n@ PRO Graphics|194\n@(TM) RX550|194\n@ Pro 560X|193\n@ Pro 570X|192\n66AF:F1|192\n@ ^ Vega M GH|190\n@ R9 M280X|190\n@ ^ 460/560D / Pro 450/455/460/555/555X/560/560X|189\n@ R9 280,|188\nCustom GPU 0405|188\n@ * 7790|187\n@(TM) ^ 480 Graphics|187\n@ Pro 455|186\n@ R9 260|186\n@ ^ 580 Series|186\n@ * 7950/8950 OEM / R9 280|186\n@ R9 290X|185\n@ R9 M290X|184\n@(TM) R9 370 Series|184\n@ Pro 555|184\n@ R7 260X|184\n@ * 6950|183\nFirePro W5000|183\n@(TM) R9 390X|182\nR9 270X Devil|182\n@(TM) ^ 470 Graphics (AMD POLARIS10 / DRM 3.23.0 / 4.15.0-1-MANJARO, LLVM 5.0.0)|182\n@ R9 380|182\n@(TM) Pro WX 9100|182\n@(TM) R7 360 Series|181\n@ ^ 570 Series|181\n@(TM) R9 M470X|181\n@(TM) R7 360 Series|181\n@ RX480|180\n@ R7 200 Series|180\n@ Pro WX 4150|180\n@ Pro WX 4100|179\n@ * 8xxx|179\nASUS R9 295X2 Series|179\n@ R9 390X|178\n@ * 5870|176\n@ Pro 560|176\n@ ^ 580 OpenGL Engine|175\n@ * 8950|175\nFirePro V(FireGL V) Graphics Adapter|175\nASUS @ ^ 580 Series|174\n@ Pro WX 4100|174\n@ Pro 460|173\n@ * 2600 XT|173\n@ Pro WX 4100|172\n@ * 8280|172\n@ Pro 575|171\n@ Pro 555X|171\n@ Pro WX 4130/4150|170\n@ ^ Vega M GH Graphics|170\nFirePro W5100|170\n@(TM) PRO WX 8200|169\n@ Vega Frontier Edition|169\n@ Pro 555X|168\nFirePro D700|168\n@ * 6990|167\n@ ^ 470 OpenGL Engine|167\n@ * 7870 XT|167\n@ ^ 580|167\n@ Polaris|167\nFirePro V8800 (FireGL V)|166\n@ ^ 550|165\n@ * 6900 Series|165\nFirePro W9100 (FireGL V)|164\n^ 580|163\n@(TM) ^ 580X|163\n@ ^ 550|163\n@ * 6870|163\n@ R9 M395X OpenGL Engine|163\n@(TM) R9 360|163\n@(TM) * 8490|162\n@ R9 M295X|162\n@ * 7970M|162\n@ R9 M380|161\nFirePro W5100 (FireGL V) Graphics Adapter|161\nASUS HD7850 Series|161\nFirePro M6100 FireGL V|161\n@ Pro 455|160\n@ ^ 460/560D / Pro 450/455/460/555/555X/560/560X|160\n@ R9 M395X|159\n@ ^ 560X|159\n@ Pro 555|158\nRadeonT ^ 560X|158\n@ Pro Vega 48|158\nASUS @ ^ Vega|158\n@ Pro WX 9100|158\n@ Pro Vega 64|157\nPowered By QiongB A9999999999|157\n@(TM) Pro Duo|157\nFirePro D700|157\n@ Pro WX 7100|156\n@ ^ 460|156\n@ * - FirePro D700 OpenGL Engine|156\n@ R9 M290X|156\n@ R9 M395 OpenGL Engine|155\n@ Pro SSG|155\nFirePro D300|155\nASUS R9 380 Series|155\n@(TM) R9 Series|153\n@ ^ 470/480/570/580|153\nFirePro W8000|153\nCezanne|153\n@(TM) Graphics|153\nFirePro D300|153\n@(TM) R9 Fury Series|153\n@ R9 M395|152\n@ ^ 570|152\n@ R9 270X Series|152\n@ Pro 5300M|152\nR9 xxx|152\n@ Pro 555|152\nFirePro D500|151\n@ * 5850|151\nFirePro D300|150\n@(TM) R9 290X|150\n66AF:F0|149\n@(TM) ^ 560|149\n@ R9 M290|148\n@ Instinct MI25 MxGPU|148\nFirePro V7800 (FireGL) Graphics Adapter|148\n@(TM) R9 M470|147\nAdvanced Micro Devices, Inc. [AMD/ATI] Fiji [@ R9 FURY / NANO Series]|147\n@ * 5870 Series|147\n@(TM) E9550|147\n@ * 7850|147\n@ * 7770|147\n@ Pro Vega 20|146\n@ R9 290/390|146\n@ Pro 450|146\n@ ^ 560X Series|146\n@ * 6850|146\n@ R9 270 1024SP|145\nASUS R9 280X Series|145\n@ Pro 450|145\n@(TM) R9 390 Series|145\nFirePro V7900 (FireGL V)|145\n@ R9 370X|145\n@(TM) ^ 560 Series|144\nASUS R7 250X|144\n@ ^ 480 OpenGL Engine|144\n@ R9 290X|144\n@ ^ 550X|144\n@(TM) ^ 580|144\nASUS @(TM) ^ 470 Series|143\nBaffin @ ^ 560|143\n@ R9 M295X (Bootcamp edition by bootcampdrivers.com)|143\n@ R9 M295X Mac Edition|143\n@ R7 Series / * 9000 Series|142\nAdvanced Micro Devices [AMD] nee ATI Device|142\n@(TM) Pro WX 7100 Graphics|142\n@ ^ 640|142\nFirePro D500|141\n@ * 7900 Series|141\n@ R9 290|141\n@ R7 250X|141\n@(TM) ^ Vega|140\n@ 630 Series|140\nFirePro W8100 Graphic Adapter|140\n@ R9 FURY / NANO Series|140\n@ R9 M390|140\n@ Pro WX 3100|140\n@ R9 290|140\n@(TM) R9 370|140\nFirePro V7900|139\n@ * 7970|139\n@ * - FirePro D500 OpenGL Engine|139\n@ * - FirePro D300 OpenGL Engine|139\n@ Pro 580|139\n@ * 7770|139\n@ * - FirePro D500 OpenGL Engine|139\n@ 540/540X/550/550X / ^ 540X/550/550X|138\nFirePro S9050|138\n@(TM) ^ 480 Graphics|138\n@(TM) R9 M390X|137\n@ Vega 64|137\n@(TM) Graphics|137\nTonga PRO GL [FirePro W7100]|136\nHD7950 Martin Ver.|136\n@ * 7990|135\n@ R9 280x|135\n@ RX550/550 Series|135\nHD7950 MARTIN REV.|134\n@ RX560|134\n@ R7 250X Series|134\n@ R9 M390 OpenGL Engine|134\nASUS R7 250X|134\n@ HD6870|134\n@ R9 270X|134\n@ Pro 5500 XT|134\n@(TM) ^ 480|133\n@ R9 270|133\nASUS HD7970 Series|133\n@ ^ 540|133\n@ 500 Series|132\n@ * 5970|132\n@ * 7770 GHz Edition|132\n@ * 5870|132\n@ 540X Series|132\n@ * 6870 Series|132\n@(TM) ^ 470 Graphics|132\n@ * - FirePro D300 OpenGL Engine|132\n@ * 7xxx|131\n@ * 5970|131\nRadeonT 540X|131\n@ R7 Graphics + R7 350 Dual Graphics|131\n@ R9 M295X Mac Edition / R9 380X|131\nFirepro M5100|131\n@(TM) R9 M375X|131\n@ R9 280x|130\n@(TM) ^ 560X|130\n@ * 6990|130\n@ Pro 5500M|130\n@ Pro WX 5100 OpenGL Engine|129\n@ R9 M395X (Bootcamp edition by bootcampdrivers.com)|129\n@ R9 M380|128\nFirePro W5170M|128\n@ R9 280|128\nFirePro W5000 (FireGL V)|128\n@(TM) ^ 5600M Series|128\n@ ^ 560D|128\nFirePro D500 (FireGL V)|128\n@(TM) Pro WX 5100 Graphics|128\n@(TM) ^ Vega 11 Graphics|128\n@ * 7970|127\n@ R9 370|127\n@ * 7770|127\n@ R9 M395X|126\n@ * 7660D|126\n@ * 8970|126\n@ R9 200 Series|126\n@ Pro WX 3200 Series|126\n@ * 7800 Series|125\n@ R9 285/380|125\n@ R9 270X|124\nFirePro W2100|124\nFirePro W7170M|124\n@ * 7870 GHz Edition|123\nRadeong 0.4 on AMD TONGA (DRM 3.1.0, LLVM 3.9.0)|123\n@ ^ 460|123\n@ * 5970 Series|123\n@ R9 M380|122\n@ R9 M395|122\nAsus @ R9 280|122\n@ * 6850 Series|122\n@(TM) ^ 540|122\n@ * 6900 Series|122\nDevice|122\n67DF:C4|121\n@ * 6950|121\nFirePro D300 (FireGL V)|121\n@ ^ 570|121\n@ * 5850 Series|121\n@ * 7870 XT|121\n@ * 7950|121\nFirePro V7800 (FireGL) Graphics Adapter|121\n@ * 6850|121\n@ * 7950|120\n@ * 7870 GHz Edition|120\n@ R7 370 / R9 270X/370X|120\n@ * 6870|120\n@ Pro V340|120\nASUS @ ^ 570 Series|119\n@(TM) R7 370 Series Graphics|119\n@(TM) ^ 580 Graphics|119\n@(TM) ^ 470 Graphics|119\n@ * 5870|119\n@ * 7950/8950 / R9 280|119\n@ * 6790|119\n@(TM) RX580|119\nASUS ARES2|119\n@(TM) R9 380 Series|118\n@ * 7750|118\n@ Pro 560X|118\n@ R7 250E|118\n@ 550 Series|118\n@ ^ 560|118\n@ Pro WX 5100|117\n@ R7 370 / R9 270X/370|117\n@ * 7800 Series|117\nFirePro W5000 (FireGL V) Graphics Adapter|117\n@ * 7750 Series|116\n@ * 5870|116\n@ R7 450|115\nFirePro R5000|115\n@ R7 370 Series|115\nFirePro W9100|114\n@ R7 370 / R9 270/370|114\n@(TM) 540 Graphics|114\n@ * 6510 Series|114\n@(TM) R7 370 Series|113\nSapphire @ HD6870|113\nFirepro M5100|113\n@(TM) ^ 550|113\n@(TM) Pro Duo|113\n@ 540/540X/550/550X / ^ 540X/550/550X|113\n@ Pro 570|112\n@ R9 280|112\nFirePro D700 (FireGL V)|112\n(ATI) FirePro M6000 (FireGL V) Mobility Pro Graphics|112\nRenoir|112\n@ 540X Series (POLARIS12, DRM 3.40.0, 5.10.56-1-MANJARO, LLVM 12.0.1)|112\n@ * 6970|112\n@ * 8770|112\n@ Pro WX3200 Graphics|112\n@(TM) R9 270|111\n@ R9 270X|111\n@ R9 285|111\n@ * 7800M Series|111\n@(TM) R7 370 Series|111\n@ * 7870M Series|111\n@ Pro 450/550|110\n@ * 7000 series|110\n@ * 7870|110\n@ Pro 555X|110\n@ RX590 GME|109\nFirePro S10000|109\n@ * 7870M|109\n@ * 5800 Series|109\n@ * 6970M|108\nASUS HD7770 Series|108\n@(TM) R9 M360|108\n@(TM) ^ 550X|107\n@ R9 285|107\n@ * 6900M Series|107\n@ * 7870 GHz Edition|107\nFirePro S7000|107\n@ R9 M370X|106\n@ Pro WX 4100|106\n@ * 6800 Series|106\n@ * 7750|106\n@ Pro 455 OpenGL Engine|106\nASUS R7 370 Series|106\n@ Pro 560|105\n@ * 6870|105\nFirePro D300 (FireGL V)|105\n@ * 6970M|105\n@ * 7850|105\n@(TM) R9 200 Series|104\nASUS HD7750 Series|104\n@ * 6970M OpenGL Engine|104\nAsus @ R7 250|104\n@ R7 370 / R9 270X/370|104\n@ R9 M395X (Bootcamp XG edition by bootcampdrivers.com)|103\n@(TM) ^ 560|103\n@ ^ Vega|103\n@(TM) Pro W5500M|103\n@ R9 270|103\n@ Pro 560X|103\n@ * 5850|103\nFirePro S7150|103\n@(TM) ^ 580|103\n@(TM) R9 370 Series|103\nASUS @(TM) ^ 480 Series|102\n@ Graphics Processor|102\n@ R9 M370X|102\nFirePro W7100|102\n@ R9 M370X|101\n@ Pro 460 OpenGL Engine|101\n@ ^ 580 Series|101\n@ 500 Series|100\n@ Pro 555|100\n@(TM) Pro WX 4100|100\nAsus @ R7 260X|100\n@(TM) ^ Vega 10 Graphics|100\n@ * 7790|99\n@ Pro 450 OpenGL Engine|99\n@ * 7790/8770 / R7 360 / R9 260/360|99\nFirePro M4000 Mobility Pro Graphics|99\n@ * 7970M|99\n@ R9 M270X|99\n@ ^ 550|98\n@ * 6850|98\n@(TM) ^ 460|98\n@(TM) ^ Vega11 Graphics|98\n@(TM) ^ 460 Graphics|98\n@ Pro 460|97\n@ * 7800 Series|97\nMatrox C680 PCIe x16|97\n@(TM) ^ 550|97\n@ * 5770|96\n@ * 8670D + 7700 Dual Graphics|96\n@ * 7790|96\n@ 630 Series|96\n@ ^ 560 Series|96\nFirepro M6100|95\n@ * 6700 Series|95\n67EF:E7|95\n@(TM) Vega 10 Graphics|95\n@ * 6900M Series|94\n@ Pro 455|94\nFirePro M4000|94\n@ R9 260|94\nFirePro W7000|94\n@ Instinct MI25|93\n@ * 8870M|93\n@(TM) Vega 11 Graphics|93\n@ Pro 450|93\nFirePro W5000|92\n@ * 6770|92\n@(TM) RX560|92\n@(TM) Graphics|91\nASUS @(TM) ^ 460 Series|91\n@(TM) Vega 8 Graphics|91\n@(TM) Graphics|91\nFirePro W5100 Graphics Adapter|90\n@(TM) Pro WX Series|90\nRenoir|90\nSTRATO XT (6646)|89\n@(TM) Pro WX 4150 Graphics|89\n@ E8870MXM|89\n@ * 8970M|89\nFirePro M6100 FireGL V|89\n@ * 7770|89\nFirePro W5100 (FireGL V) Graphics Adapter|89\n@ * 6970M|89\n@ Pro 460|88\n@ ^ Vega 8 Graphics|88\n@ * 7700 Series|88\n@(TM) R9 M360|88\nASUS R7 265 Series|88\n@ ^ Vega M GL Graphics|88\nASUS @ ^ 550 Series|88\n@ R7 360 / R9 360|88\n@ * 6950|86\n@ * 6790|86\n@ Pro WX 2100|86\nASUS @ ^ 560 Series|86\n@ * 5750|86\n@(TM) ^ 640|86\n@ * 8870M|85\n@ R7 260X|85\n@ Pro WX 7100|85\n@(TM) R7 360 Series|85\n@ Infoshock™ ^ 460 Graphics|85\nFirePro W5170M|85\n@ R9 M295X|85\nFirePro W8100|85\n@ * 6750|85\nFirePro W5170M|85\nFirePro V5800 (FireGL) Graphics Adapter|84\nASUS R7 250X|84\n67E8:00|84\n@(TM) ^ 550X|84\n@(TM) R7 350|84\n@(TM) E9260|84\n@ Sky 500|84\n@ R9 M270X|83\n@(TM) R9 350|83\n@(TM) ^ Vega 11 Graphics|83\nFirepro M6100|83\n@ R9 360|82\nFirePro V7900|82\nFirePro V5800 (FireGL V)|82\n@ * 8830M|82\n@ Pro 450|82\n@ * 8950|82\n6980:00|82\nFirePro W5100 (FireGL V)|81\n@ E8870|81\n@ * 7750 Series|81\n@ * 7850 / R7 265 / R9 270 1024SP|81\nFirePro™ W4190M|80\n@ * 5770|80\n@(TM) R7 360 Series|80\nFirePro M5100 FireGL V|80\n@ ^ 470/480/580|80\n@(TM) ^ 460 Graphics|79\n@ * 6700 Series|79\nMobility @ * 5870|79\n@ R9 255|79\n@ 535 Series|79\n@ R9 M380 OpenGL Engine|78\n@(TM) ^ 550|78\n@ R9 M380|78\n@ R7 250X|78\nSaphire @ ^ 580|78\nRadeong 0.4 on AMD BONAIRE (DRM 2.43.0, LLVM 3.8.0)|78\n@ * 5000|78\n@ * 5770|77\n@ ^ 460|77\nFirePro W4300|77\n@ 530 Series|77\n@(TM) 540X|77\n@ R9 M370X OpenGL Engine|77\nFirePro V5900 (FireGL V)|77\n@ Pro WX 4100|77\nSAPPHIRE * 5770|77\n@ Pro WX 3100|76\nFirePro W5100|76\n@(TM) Pro Graphics|76\n@ Pro WX 3100|76\n67FF:C8|76\n@(TM) HD8970M|76\nFirepro M5100|76\n@(TM) R9 M375X|75\n@ 550X Series|75\n@ R9 M390|75\n@(TM) Vega 9 Graphics|75\nFirePro V5900 (FireGL V) Graphics Adapter|74\n@ * 8570|74\n@(TM) ^ 475M|74\n@ * 6770|74\n@ ^ 550 Series|74\n@ ^ 550|74\nFirePro M4000|74\n@ ^ 460/560D / Pro 450/455/460/560|74\n@ Pro 560|74\n@ Vega Series / @ Vega Mobile Series|74\n@ Pro 455|74\n@ * 7870M Series|74\n@(TM) R7 430|74\n@ 620 Series|73\n@ * 7770 GHz Edition|73\n@ * 7770|73\n@(TM) R9 360 Series|73\n@ * 7770/8760 / R7 250X|73\n@(TM) 530|73\n15DD Graphics|73\n@ ^ Vega M GL Graphics|73\n@(TM) R9 380|72\n@(TM) 530 series|72\n@ R7 200 Series|72\nEmbedded @ E9171|72\n@ Pro WX3200 Graphics|71\n@ * 8800M Series|71\n@ R9 M375|70\n@ * 5770|70\n@ Pro 555|70\n@ R7 250E|70\n@ * 7750|70\n@ Pro 555X|70\n@(TM) Vega 8 Mobile Graphics|70\n@(TM) R9 M380|69\n@ R7 260X/360|69\nBarco MXRT 7600 (WDDM)|69\n@(TM) Vega 10 Graphics|69\n@ * 7750|69\n@ R9 M370X|69\n@(TM) R2E Graphics|69\n@ R9™ M370X|68\nFirePro V4900 (FireGL V)|68\n@(TM) ^ Vega11 Graphics|68\n@ * 5770|68\n@(TM) Renoir Graphics D1|68\n@ * 7600 Series|67\n@ R5 340|67\n@(TM) Vega 9 Graphics|67\nFirePro W4100 (FireGL V) Graphics Adapter|67\n694E:C0|67\n694C:C0|67\n@ R7 250|66\n@ * 6750|66\nRAVEN (DRM 3.36.0, 5.6.5-AMD, LLVM 9.0.1)|66\nFirePro W600|66\n@ R9 255|66\n@ ^ 470|66\n@(TM) R7 250|66\nFirePro V5900|65\n@(TM) 530|65\n@ Pro WX Vega M GL Graphics|65\n@ ^ 470/480|65\n@ * 5750|65\n@ R7 260X|65\nFirePro V5900 (FireGL V) Graphics Adapter|65\nFirePro W4100 Graphics Adapter|65\n@ * 6700 Green Edition|65\n@ R9 M370X|65\n@(TM) R7 350X|64\n@(TM) R7 350X|64\n@ * 7670|64\n@ R9 M200X Series|64\n@ R9 M370X|64\n@ * 6670|63\n@(TM) * 8350|63\n@ 530X Series|63\n@(TM) R9 360|63\n@(TM) Pro WX 4150 Graphics|63\n67EF:C5|63\n@ R7 Graphics + R5 340 Dual Graphics|62\n@ * 5670|62\n@ ^ 470/570|62\n@ 530 Series|62\n@ R7 250 Series|62\n@ R7 430|62\n@ * 6750 Graphics|62\n@(TM) R9 M385X|62\n@(TM) Vega 10 Mobile Graphics|62\nFirePro V5900 (FireGL V)|61\nFirePro V5800 (FireGL V)|61\n@(TM) Vega 8 Graphics|61\nFirePro V4800 (FireGL V)|61\n@ * 7600 Series|61\n@(TM) Vega 6 Graphics|61\n@(TM) R9 200 Series|61\n@ * 8850M|61\n@ RX460|61\n@ R7 M460|61\n@ ^ 640 Series|60\n@ 530|60\n@ * 5600/5700|60\n@ * 5750 Series|60\n@ R7 Graphics + R7 200 Dual Graphics|60\n@ R7 450|60\nFirePro V4900|60\nFirepro W6150M|60\nASUS R7 250 Series|60\n@(TM) ^ 560 Graphics|60\n@(TM) R7 M370|59\nFirePro M4000 Mobility Pro Graphics|59\n@ R5 430|59\n@ R9 M275X|59\nFirePro V5800 (FireGL) Graphics Adapter|59\nMobility @ * 5870|59\n@(TM) R9 M385X|58\n@ * 7750M|58\n@ * 5670|58\n@ * 8850M|58\n@ * 7700M Series|58\n@ * 8670D + R7 200 Dual Graphics|58\n@ R7 Series / * 9000 Series|57\n@ * 6730M/6770M|57\n@(TM) 625|57\n@(TM) R9 M385|57\n@ * 5870M|56\n@ 610 Series|56\nFirePro W4100|56\nFirePro M6000 Mobility Pro Graphics|56\n@ ^ 540 Series|56\n@ R7 240|56\n@ * 7560D + * 7700 Dual Graphics|56\n@ R9 M370X (Bootcamp XG edition by bootcampdrivers.com)|56\nFirePro V4900 (ATI FireGL)|55\n@(TM) R7 M350|55\nFirePro M6000 Mobility Pro Graphics|55\n67FF:08|55\n@ * 5750|55\n@ * 7570|55\n@(TM) Vega 11 Graphics|55\n@ R7 M460|55\n@ * 5750 OpenGL Engine|55\n@(TM) R7 M370|55\n@ * 6730M/6770M/7690M XT|55\n@ E8860|55\n@ * 8790M|54\n@ * 6770M|54\n@ R7 M440|54\n@(TM) R7 350|54\n@(TM) R7 350X|54\n@ * 7870 XT|54\n@ * 7800M Series|54\n@ 520|54\n@ R7 M370|53\nFirePro W4150M FireGL V|53\n(ATI) FirePro M4000 (FireGL V) Mobility Pro Graphics|53\n@ R9 M200X Series|53\n@ * 6700M/7700M/7900M Series|53\n@(TM) 620|53\nPicasso|53\n@(TM) ^ Vega 10 Graphics|53\n67EF:CF|53\n@(TM) Vega 3 Graphics|53\n@ R7 250|53\nFirePro W4190M|53\n@(TM) Vega 8 Graphics|53\n694C:C0|52\n@ * 5670 Series|52\n@(TM) ^ Vega 11 Graphics|52\n@ * 6770M OpenGL Engine|52\n@(TM) M535DX|52\nFirePro V4800 (FireGL V)|52\n@ R7 350 Series|52\nBarco MXRT 5600 (WDDM)|51\n@ 630|51\nFirePro V4900 (FireGL V)|51\nFirePro V4900 (FireGL V) Graphics Adapter|51\n@(TM) Vega 3 Mobile Graphics|51\n@ 535 Series|51\n@ R7 Graphics|51\n@ * 5670|51\nFirePro W4170M|50\n@ * 8700M Series|50\n@ * 8670 / R7 250/350|50\nPicasso|50\nFirePro V4800 (FireGL) Graphics Adapter|50\nMobility @ * 5850|49\nOPAL XT/GL (6604)|49\n@ R5 M335|49\nMatrox C900 PCIe x16|49\n@ * 7670|49\n@ * 6750M|49\n@(TM) 535|49\n@ 540X Series|49\n@ R9 M275|49\n@(TM) ^ 640|49\n@ * 5700 Series|48\n@ R5 M230 Series|48\nFirepro M6100|48\n@(TM) R9 M375|48\n@ R5 430|48\n@(TM) R7 250|47\n@ R9 M265X|47\n@ * 6730M/6770M|47\n@ * 8670D|47\n@ R5 340|47\n@ 520|47\n@(TM) 520|47\nFirePro V (FireGL V) Graphics Adapter|47\nFirePro M5100 FireGL V|46\n@ * 6670|46\n@ R7 M260X|46\n@ * 8550|46\nFirePro M4150|46\n@ * 6670|46\n@ * 7700 Series|46\nFirePro M4170|46\n@ * 7570|46\n@ * 8670D + * 6670 Dual Graphics|45\n699F:C1|45\n@ R7 Graphics|45\n@(TM) R7 M340|45\nFirePro W4170M (FireGL V)|45\n@(TM) * 8500M/8700M|45\n@ R7 M340|44\nFirePro M5950|44\n@ * 8570D + R7 240 Dual Graphics|44\n@ * 6770M|44\n@ * 7730M|44\n@ * 8790M|44\n@ * 7750|44\n@ * 8690A|44\nMobility @ * 5730 / 6570M|44\n@ R9 A375|44\n@(TM) R8 M445DX|43\nFirePro V (FireGL V) Graphics Adapter|43\n@ * 7750/8740 / R7 250E|43\nFirePro V3900|43\n@ * 7600A Series|43\n@(TM) R7 200 Series Graphics|43\n@ R7 Graphics|43\n@ * 6770M|43\n@ R7 M260 Series|43\n@ R7 M360|43\n@ * 8970M|43\n@(TM) Vega 6 Graphics|43\n@ * 8570|42\n@ R7 M440|42\n@ * 8670A/8670M/8750M|42\nMobility @ * 5850|42\n@ * 8750M|42\nEmbedded @ E9173|42\n@(TM) R7 M440|42\n@ * 8730M|42\n@ R7 240 + * 8570D Dual Graphics|42\nFirePro V3900|42\n@(TM) 535DX|42\n@(TM) 520|42\n@(TM) Vega 8 Mobile Graphics|42\n@(TM) Vega 8 Graphics|42\n@(TM) Vega 2 Graphics|42\n@(TM) R9 M375|42\n@(TM) R8 M445DX|41\n@ * 6750M|41\nRadeonT 540X|41\n@(TM) 530|41\n@ * 7560D + * 6670 Dual Graphics|41\n@ R7 240|41\n@(TM) R7 M360|41\n@ R9 M280X|41\n@ * 7520G + * 7600M Dual Graphics|41\n@(TM) R7 M445|41\n@ Vega 8 Mobile|40\n@(TM) R9 255|40\n@ R7 M260X|40\n@ R8 M535DX|40\n@ R7 240/340|40\n@(TM) R9 M375|40\n@(TM) R7 Graphics|40\n@(TM) R5 M420|40\n@ * 6750M|40\n@ R9 M265X|40\n@ R7 M340|40\n@ * 6570|40\n@ * 7500/7600 Series|39\n@ R7 430|39\nFirePro W2100|39\n@ * 7730M|39\n@ * 8670D|39\n@ R5 M255|39\n@ * 7560D + * 6570 Dual Graphics|39\n@ ^ Vega|39\n@ R7 240 Series|39\n@(TM) R7 M445|39\n@ * 6800M Series|39\n@ * 8690M|39\n@ * 7660D + * 6570 Dual Graphics|39\n@ R7 M370|39\n@(TM) * 6650M|38\n@ R5 M435|38\n@ * 6500 Series|38\n@ R7 Graphics|38\nFirePro M7820|38\n@(TM) R8 M445DX Graphics|38\n@ * 5570|38\n@ * 8650G + 8750M Dual Graphics|38\n@ * 8670A/8670M/8750M|38\n@ * 6650M|38\n@ R7 M260 Series|38\n@ * 7660G + 7600M Dual Graphics|38\n@ * 7600M Series|38\n@ * 7670M|37\n@. * 7670M|37\n@(TM) R7 M265|37\nMobility @ * 5000|37\n@ * 7500M/7600M Series|37\n@ R5/R6/R7 Graphics|37\n@ R7 M270|37\n@ * 8650G + * 7600M Dual Graphics|37\nFirepro M5100|37\n@ * 7730M|37\n@ * 8570D|37\n@(TM) * 7650A Graphics|37\n@ R7 Graphics|37\n@(TM) ^ Vega 10 Graphics|37\n@ * 7600A Series|36\n@ R7 M270|36\n@ * 7660D + * 6670 Dual Graphics|36\n@ * 7570M/* 7670M Graphics|36\n@ 6600M and 6700M Series|36\n@ R7 Graphics + R7 200 Dual Graphics|36\n@ * 7570 Series|36\n@ * 8750M|36\n@ * 6550D|36\nFirePro M5950|36\n@ * 7660G + 7600M Dual Graphics|36\n@ * 6550D|36\n@ * 7600M/7700M Series|36\n@(TM) Vega 3 Graphics|36\n@(TM) 625|36\nMobility @ * 5570|36\n@ HD8730|36\n@(TM) R9 M380|36\n@(TM) R5 240|36\n@ * 7650M|35\n@ * 7560D|35\n@ * 8690M|35\n@ * 8650G + 8750M Dual Graphics|35\n@ * 8650G + * 8750M Dual Graphics|35\n@ * 8650G + * 8570M Dual Graphics|35\n@ * 6570|35\n@ * 7650M|35\n@ * 6630M/6650M/6750M/7670M/7690M|35\n@ * 6500 Series|35\n@(TM) 520|35\n@ * 8570D|35\n@ * 7600M Series|35\n@ R7 Graphics|35\n@ * 7660G + 8670M Dual Graphics|35\n@ R7 200 Series|35\n@ * 6630M/6650M/6750M/7670M/7690M|35\n@ R7 M265|35\n@ * 8650G + * 8750M Dual Graphics|35\n@ * 8650G + 8670M Dual Graphics|35\n@ R7 Graphics|34\n@ * 6630M Series|34\n@(TM) 520|34\n@ * 7660D|34\nASUS R7 240 Series|34\n@ R9 M280X|34\n@(TM) R5 340|34\n@ * 8550G + 8600/8700M Dual Graphics|34\n@ R7 Graphics|34\n@(TM) * 8500M/8700M|34\n@ * 7660G + * 7600M Dual Graphics|34\n@ * 7670M|34\n@(TM) R5 M430|34\n@ * 8650G + 8500M Dual Graphics|34\n@(TM) R5 340X|34\n@(TM) R5 230 series|34\n@ * 8550|34\nFirePro W2100 (FireGL V)|34\nFirepro M4100 FireGL V|34\n@ * 6550D|34\n@ * 6630M|34\n@(TM) R9 M375|34\n@ * 5670 OpenGL Engine|33\n@ * 5670|33\n@ R7 Graphics|33\n@ * 7660G|33\n@ * 5570|33\n@ * 7550M/7650M Graphics|33\n@ * 7660D|33\n@ * 7560D|33\n@ * 7560D|33\n@ R5 M445 Series|33\n@ R5 M315|33\n@ * 8570D|33\n@ R7 M265|33\n@ * 7640G + * 7500/7600 Dual Graphics|33\n@ R7 Graphics|33\n@ * 8500M Series|33\nMobility @ * 5000|33\n@(TM) R7 M360|33\nFirepro M4100|33\n@(TM) Vega 10 Graphics|32\n@ * 7500M/7600M Series|32\n@ * 8550G + * 8600/8700M Dual Graphics|32\n@ * 7660G|32\n@ * 7350|32\n@ * 8470D + * 6450 Dual Graphics|32\n@ R7 Graphics|32\n@ * 8730M|32\n@ * 7640G + * 7400M Dual Graphics|32\n@ * 8690A|32\n@ * 8650G + 8600/8700M Dual Graphics|32\n@ R7|32\n@(TM) Vega 11 Graphics|32\n@(TM) Vega 8 Graphics|32\n@ R5 M200 Series|32\n@(TM) R5 M335|32\n@(TM) R5 M430|32\n@ * 8550G + * 8570M Dual Graphics|32\n@ * 7650M Series|32\n@ R7 250 Series|32\n@(TM) R7 M460|32\n@ * 6550D|32\n@ * 7660G + * 7600M Dual Graphics|32\n@(TM) Vega 3 Graphics|32\n@ * 8470D|32\n@ R8 M365DX|31\nMadison [Mobility @ * 5650/5750 / 6530M/6550M]|31\n@ * 6630M/6650M/6750M/7670M/7690M|31\n@ R7 Graphics|31\n@ E6760|31\n@ R7 Graphics|31\n@(TM) Vega 8 Graphics|31\n@(TM) R5 M330|31\n@ * 8670A/8670M/8690M|31\n@ R7 A360|31\n@ * 8650G + * 8600M Dual Graphics|31\n@ R5 M200 / * 8500M Series|31\n@(TM) R8 M435DX|30\n@ * 7640G + * 7670M Dual Graphics|30\n@(TM) Vega 10 Mobile Graphics|30\n@ R7 Graphics|30\n@ Pro 450/550|30\n@ * 8800M Series|30\n@ * 8470D|30\n@ * 7660D|30\n@ * 8610G + * 8600M Dual Graphics|30\n@ * 7660G + 7670M Dual Graphics|30\n@(TM) Vega 8 Mobile Graphics|30\n@ 610 Series|30\n@(TM) R5 M330|30\n@ * 7660G|30\n@ * 7640G|30\n@ R8 M365DX|30\n@ * 8550G|29\n@ * 7540D|29\n@ * 7640G|29\n@ * 8650G|29\n@(TM) R7 Graphics|29\n@(TM) ^ Vega 11 Graphics|29\n@ * 6650M|29\n@ * 7660G|29\n@ 6600M and 6700M Series|29\n@ * 7640G + * 7400M Dual Graphics|29\n@(TM) R5 340X|29\n@ R5 435|29\n@ * 6500M/5600/5700 Series|29\nFirepro M4100 FireGL V|29\n@ R7 Graphics|29\n@(TM) 535|29\n@ R7 240 Series|29\n@(TM) R7|29\n@ * 8550G + 8500M Dual Graphics|28\n@(TM) 530|28\n@ * 5650 Series|28\n@ * 7570M|28\n@ * 7570M|28\nASUS R7 240 Series|28\n@ * 6570|28\n@(TM) Vega 8 Graphics|28\n@ E8860|28\n@(TM) 530 series|28\n@(TM) R5 M315|28\n@ * 5500 Series|28\n@ * 8610G + * 8670M Dual Graphics|28\n@(TM) R6|28\n@ R9 M275X|28\n@ * 8550G + R5 M230 Dual Graphics|28\n@ * 8470D|28\n@ * 8670D|28\n@ * 7620G|28\n@(TM) R8 M350DX|28\n@ * 8470D|27\n@(TM) R8 M445DX|27\n@(TM) R7 Graphics|27\n@(TM) R5 Graphics|27\n@(TM) R7 M340|27\n@(TM) R6 Graphics|27\n@ R6 Graphics|27\n@ R5 M230 Series|27\n@ * 8650G|27\n@ * 7480D|27\n@(TM) R8 M445DX Graphics|27\n@(TM) R6 Graphics|27\n@ R7 Graphics|27\n@ R6|27\n@ R5 M255|27\n@(TM) Vega 3 Graphics|27\n@ 550X|27\n@(TM) Vega 3 Graphics|27\n@ * 7500/7600 Series|27\n@ * 8650G|27\n@ * 5500 Series|27\n@ * 7610M|27\n@ Instinct MI25 MxGPU|27\n@(TM) HD8530M|27\n@ R7 M260|27\n@(TM) R8 M445DX|27\n@ R7 Graphics|26\n@ * 8500M|26\n@(TM) R7 M260DX|26\n@ * 8410G|26\n@ * 8670A/8670M/8690M|26\n@(TM) R7 M360|26\n@(TM) R7 M360|26\n@ * 8670D|26\n@ R9 M275|26\n@ * 7640G|26\n@(TM) R7 Graphics|26\nMxGPU|26\n@ * 8370D|26\n@ * 6620G|25\n@ * 7560D|25\n@ * 8570 / R5 430 / R7 240/340 / @ 520|25\n@ R4 Graphics|25\n@ R6 Graphics|25\n@ R7 Graphics|25\n@(TM) 535DX|25\n@(TM) 540 Graphics|25\n@(TM) R5 M330|25\n@ * 6530D|25\n@ R6 Graphics|25\n@ * 8510G|25\n@ * 6620G|25\n@ R7 M360|24\n@(TM) R6 Graphics|24\n@ R7 M260|24\n@ * 8610G + * 8600M Dual Graphics|24\n@(TM) R6 Graphics|24\n@ R5 M200 / * 8500M Series|24\n@ R7 Graphics|24\n@ * 7600G|24\n@ R7 Graphics|24\n@ * 6620G|24\n@ R5 M330|24\n@(TM) R5 240|24\n@(TM) * 6620G|24\nFirePro V3800 (FireGL V)|24\n@ * 6520G|24\n@ R7 Graphics|24\n@ * 7520G|24\n@(TM) R6 Graphics|24\n@(TM) R7 M260|24\n@ ^ 540 Series|24\n@(TM) R5 M320|24\n@ * 8500M|23\n@ R5 M230|23\n@ * 8670M|23\n@ * 8550G + * 8750M Dual Graphics|23\n@ * 8600M Series (HAINAN, DRM 3.40.0, 5.11.13-arch1-1, LLVM 11.1.0)|23\n@ * 8550G|23\n@ R5 M240|23\n@ R5 M240 Series|23\n@ * 7540D|23\n@(TM) R5 M430|23\n@ R5 Graphics|23\n@(TM) R5 M430|23\n@ R6 Graphics|23\n@ * 7520G|23\n@ R7 Graphics|23\n@ * 8610G|22\nFirePro 3800 (FireGL) Graphics Adapter|22\n@ * 7570M/* 7670M Graphics|22\n@ * 7480D|22\n@(TM) R7 Graphics|22\n@ * 8650G + * 8600M Dual Graphics|22\n@(TM) Vega 6 Graphics|22\n@ R7 Graphics|22\n@ R5 Graphics|22\n@ * 7660G + * 8600M Dual Graphics|22\nFirePro M2000|22\n@ R7 Graphics|22\n@ * 7870M|22\n@ R5 M335|22\n@ R5|22\n@ * 8500M Series|22\n@(TM) * 8490|22\n@ * 8670M|22\n@ * 7660G + * 7670M Dual Graphics|22\n@ 7500M/7600M Series|22\n@ R5 Graphics|21\n@(TM) R4 Graphics|21\n@ * 8490|21\n@ * 8490|21\n@ R7 Graphics|21\n@ * 8570M|21\n@(TM) R5 M320|21\n@ R2|21\n@ * 6530D|21\n@(TM) * 6470M|21\nMxGPU|21\n@ * 7000 series|21\n@ * 7470|21\n@(TM) R8 M350DX|21\n@ R7 Graphics|21\n@ * 7520G + * 7400M Dual Graphics|21\n@(TM) R5 M335|21\n@ * 7400G|21\n@ * 7640G + * 8500M Dual Graphics|21\n@ * 7000 series|21\n@(TM) R5 Graphics|20\n@(TM) R7 M520 (R17M-M1-30)|20\n@ * 8470|20\n@ * 7480D|20\n@ * 6400M/7400M Series|20\n@(TM) R3 Graphics|20\n@ R6 M255DX|20\n@ * 8370D|20\n@ R5 Graphics|20\n@ R7 Graphics|20\n@ * 6410D|20\n@(TM) R5 Graphics|20\n@ R5 M330|20\n@ R7 M260DX|20\n@(TM) R5 Graphics|20\n@ * 7480D|20\n@ * 6470M|20\n@ Hybrid (Blocked)|20\n@(TM) R7 Graphics|20\n@(TM) R6 M340DX|20\n@ R5 235|20\n@ * 7520G|19\n@(TM) R6 M255DX|19\n@ R5 M240|19\n@(TM) R3 Graphics|19\n@ R7E Graphics|19\n@ R5 M200 Series|19\n@ * 7470|19\n@ * 7640G + 8500M Dual Graphics|19\n@(TM) R5 M330|19\n@ * 6470M|19\n@ R3 Graphics|19\n@ * 8400E|19\n@ * 7640G + * 8570M Dual Graphics|19\n@ * 8400|19\n@ * 8400 / R3 Series|19\n@ R5 Graphics|19\n@(TM) R7 M265|19\n@ R5 M230|19\n@ R5 Graphics|19\n@ * 7620G|19\n@ R5 Graphics|19\n@(TM) * 6470M|19\n@ * 7480D|18\n@ R7 Graphics|18\n@(TM) R5 Graphics|18\n@ * 8550G|18\n@ * 8370D|18\n@ R5 Graphics|18\n@(TM) * 7450|18\n@ * 6530D|18\n@ * 8570M|18\n@ R6 Graphics|18\n@ * 7650A|18\n@ * 8450G|18\n@ * 8550G + R5 M230 Dual Graphics|18\n@ * 7640G + 7470M Dual Graphics|18\n@ * 8370D|18\n@ * 7400M Series|18\n@ * 8670D + R5 200 Dual Graphics|17\n@ * 7500G|17\n@ * 7790|17\n@ * 7450M|17\n@(TM) * 7450A Graphics|17\n@(TM) R5 Graphics|17\n@(TM) R6 Graphics|17\n@(TM) R4 Graphics|17\n@ * 8650G + * 8500M Dual Graphics|17\n@ * 7400M Series|17\n@ * 8450G|17\n@ * 6520G|17\n@ * 8470D|17\n@(TM) R5 Graphics|17\n@(TM) R4E Graphics|17\n@ * 8330|17\n@ * 8400|17\n@(TM) * 8510G|17\n@(TM) R5 Graphics|17\n@ * 8650G|17\n@ * 6490M|17\n@ R7 Graphics|16\n@ * 6400 Series|16\n@ * 8510G|16\n@ * 7400 Series|16\n@ * 7400 Series|16\n@(TM) * 8510G|16\n@ * 6370D|16\n@ * 7420G|16\n@ * 7520G + * 7600M Dual Graphics|16\n@ R9 260|16\n@ * 7640G + 7600M Dual Graphics|16\n@ * 7470M|16\n@(TM) R2 Graphics|16\nRADEON * 6450|16\n@(TM) R1E Graphics|16\n@ R5 Graphics|16\n@ * 7420G|16\n@(TM) R4 Graphics|16\n@(TM) R4 Graphics|16\n@(TM) R4 Graphics|16\n@ * 7480D|16\n@ * 6490M|15\nRADEON * 6450|15\n@(TM) * 8610G|15\n@(TM) * 8610G|15\n@ * 8610G + 8600M Dual Graphics|15\n@ * 7350|15\n@(TM) * 6480G|15\n@ * 8650G + 8600M Dual Graphics|15\n@ * 8570D|15\n@ * 6370M|15\nMobility @ * 5000 Series|15\n@ R2 Graphics|15\n@ * 8240 / R3 Series|15\n@ * 8650G + R5 M200 Dual Graphics|15\n@ * 8400E|15\n@(TM) R4 Graphics|15\n@ R5 Graphics|15\n@ * 8610G|15\n@ * 8650G + * 8500M Dual Graphics|15\n@(TM) R7 M260|15\nASUS EAH6450 Series|15\n@ R3 Graphics|15\n@(TM) R6 M340DX|15\n@ R6E Graphics|15\n@ R5 Graphics|15\n@ R2 Series|14\n@ * 6450/7450/8450/R5 230|14\n@ * 8200 / R3 Series|14\n@(TM) R3 Graphics|14\n@ R5 230|14\n@(TM) * 8510G|14\n@(TM) R4 Graphics|14\n@ R5 M435|14\n@ * 8240|14\nASUS R5 230 Series|14\nFirePro M2000|14\n@ * 7500G|14\n@ * 7450|14\nRADEON * 6450|14\n@ * 8400E|14\nRADEON * 6350|14\n@ * 6480G|14\n@(TM) R5E Graphics|14\nCARRIZO 9874|14\nMobility @ * 5000 Series|14\n@ * 6630M|14\n@ * 6370M|14\n@ * 8400 / R3 Series|14\n@(TM) R2 Graphics|14\nASUS EAH6450 Series|14\n@ * 7470M|13\nMobility @ * 5470|13\nMobility @ * 5400 Series|13\n@(TM) R5E Graphics|13\n@(TM) R2 Graphics|13\n@ * 6540|13\n@ * 7450|13\n@ * 5450|13\n@ * 8600M Series|13\n@ * 8400 / R3 Series|13\nKaveri|13\n@(TM) * 6480G|13\n@ * 5400 Series|13\n@ * 8330|13\nRADEON * 6350|13\n@ R4/R5 Graphics|13\n@ * 7600G +™ * Dual Graphics|13\n@ R3 Graphics|13\nASUS R5 230 Series|13\n@(TM) R7 Graphics|13\n@ * 7620G|13\n@ * 8250|13\n@(TM) R7 Graphics|12\n@ * 6450/7450/8450 / R5 230|12\n@ * 6480G|12\n@(TM) R7 Graphics|12\n@ * 5450 Series|12\n@ * 8400 / R3 Series|12\n@(TM) * 6400 Series|12\n@(TM) R4 Graphics|12\nRADEON HD5450|12\n@ R5 Graphics|12\n@ R5 Graphics|12\n@(TM) R6 Graphics|12\n@(TM) R4 Graphics|12\n@(TM) R2 Graphics|12\n@ * 8210|12\n@ R5 230|12\n@ R3 Graphics|12\nFirePro 2270|12\n@(TM) R2E Graphics|12\n@ * 8400 / R3 Series|12\n@ * 8350G|12\n@ * 8400|12\n@ R2 Graphics|12\n@ * 8210 Graphics|12\n@ E6460|12\n@(TM) * 8280E|12\n@ R2 Graphics|11\n@ * 8450G + * 8750M Dual Graphics|11\n@ * 8330|11\n@ * 5470|11\n@ * 7600G + 7500M/7600M Dual Graphics|11\n@ R5 220|11\n@ * 8200 / R3 Series|11\n@ * 8240|11\n@ * 8400 / R3 Series|11\n@ * 8200 / R3 Series|11\n@ * 5450|11\n@(TM) 620|11\n@(TM) Vega 8 Mobile Graphics|11\n@ * 6530D|11\n@(TM) * 6520G|11\n@ * 6300M Series|11\nASUS EAH5450|11\n@ R5 220|11\n@ * 8250|11\n@ * 7340|11\n@ * 7340M|11\n@ * 8210|11\n@ * 7700 Series|10\n@ * 6380G|10\n@ * 5400 Series|10\n@ * 8240|10\n@ * 7640G + 7670M Dual Graphics|10\n@(TM) R6 Graphics|10\nASUS EAH5450 Series|10\n@ * 6320|10\n@ * 7340G|10\n@ * 6410D|10\n@ * 7340|10\n@ * 6320|10\n@(TM) R2 Graphics|10\n@ * 8180|9\nMobility @ * 5430|9\n@ R2 Graphics|9\n@ R2 Series|9\n@ * 8210|9\nFirePro 2270|9\n@ R2E Graphics|9\n@ * 7340|9\n@ * 6320|9\n@ * 7310|9\n@ * 6310|9\n@ R7 Graphics|9\n@ * 7310|8\n@ * 8250|8\n@ * 8180|8\n@ * 6630M|8\n@ * 6230|8\n@ * 6320|8\n@ * 6400M Series|8\n@ * 7290 Graphics|7\n@ * 6290|7\n@ * 6310|7\n@ * 8180|7\nASUS EAH5450 Series|7\n@(TM) R2 Graphics|6\n@ * 6310|6\n@ * 7500G|6\n@ * 8240 / R3 Series|6\n@ * 6250|6\n@ * 6380G|6\n@ * 6300M Series|5\n@ * 7310|5\n@ R3 Graphics|5\n@(TM) R6 Graphics|5\n@ * 6250|5\n@ * 6290|5\n@ * 6250|5\n@ * 7290 Graphics|4\n@ * 5000/6000/7350/8350 Series|3\n@ ^ Vega 56 OpenGL Engine|-1\nFirePro V4800 (FireGL) Graphics Adapter|-1\n@ * 7670M|-1\n@ * 8570D|-1\n7340:C5|-1\n@ * 8550G|-1\n@ R5 Graphics|-1\nASUS R7 360 Series|-1\nBonaire [FirePro W5100]|-1\n@ * 6380G|-1\n@ R7 Graphics|-1\nFireGL V8650|-1\nFirePro S7150|-1\nFirePro V3900 (FireGL V)|-1\nFirePro V7800 (FireGL V)|-1\nFirePro W4100 Graphics Adapter|-1\nFirePro W4170M (FireGL V)|-1\nGigabyte @ ^ 580|-1\nMobility FireGL V5700|-1\nMobility @ 4100|-1\nMobility @ * 2400|-1\nMobility @ * 2400 XT|-1\nMobility @ * 2600|-1\nMobility @ * 2600 XT|-1\nMobility @ * 3200|-1\nMobility @ * 3400 Series|-1\nMobility @ * 3430|-1\nMobility @ * 3470|-1\nMobility @ * 3650|-1\nMobility @ * 4200 Series|-1\nMobility @ * 4250|-1\nMobility @ * 4300 Series|-1\nMobility @ * 4500 Series|-1\nMobility @ * 4500/5100 Series|-1\nMobility @ * 4650|-1\nMobility @ * 4670|-1\nMobility @ * 4850|-1\nR9 270X Devil|-1\n^ 560X|-1\n@|-1\n@(TM) HD8530M|-1\n@ 3000|-1\n@ 3100 Graphics|-1\n@ * 2400 PRO|-1\n@ * 2400 XT|-1\n@ * 2600 Pro|-1\n@ * 2600 XT|-1\n@ * 2900 GT|-1\n@ * 3200 Graphics|-1\n@ * 3300|-1\n@ * 3450|-1\n@ * 3470|-1\n@ * 3600 Series|-1\n@ * 3650|-1\n@ * 3850|-1\n@ * 3870|-1\n@ * 3870 X2|-1\n@ * 4200|-1\n@ * 4250|-1\n@ * 4290|-1\n@ * 4300/4500 Series|-1\n@ * 4550|-1\n@ * 4600 Series|-1\n@ * 4650|-1\n@ * 4670|-1\n@ * 4830|-1\n@ * 4850|-1\n@ * 4870|-1\n@ * 4890|-1\n@ * 5670 640SP Edition|-1\n@ * 5800 Series|-1\n@ * 5850|-1\n@ * 6490M|-1\n@ * 6730M/6770M|-1\n@ * 6750|-1\n@ * 6800M Series|-1\n@ * 7540D + * 6670 Dual Graphics|-1\n@ * 7700M Series|-1\n@ * 7800 Series|-1\n@ * 8350|-1\n@ * 8370D|-1\n@ * 8600/8700M|-1\n@ Pro WX Vega M GL Graphics|-1\n@ R5 200 Series|-1\n@ R7 A370|-1\n@ R9 200 Series|-1\n@ R9 290X/390X|-1\n@ R9 380X|-1\n@ ^ 480|-1\n@ ^ 550X|-1\n@ ^ 6650M|-1\n@ RX6600XT|-1\n@(TM) R8 M435DX|-1\n@(TM) R9 290X|-1\n@(TM) RX540|-1\ninc. @ * 7970|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 2.43.0, LLVM 3.7.0)|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 3.9.0 / 4.9.0-rc1+, LLVM 4.0.0)|-1\nRadeong 0.4 on AMD FIJI (DRM 3.2.0 / 4.7.0-rc5+, LLVM 4.0.0)|-1\nRadeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1\n";let S=[],k=[],P=[];function M(e){if(!e)return 0;const t=function(e){if(e===v.V.Intel&&S.length)return S;if(e===v.V.Nvidia&&k.length)return k;if(e===v.V.Amd&&P.length)return P;try{const t=function(e){return e===v.V.Intel?_:e===v.V.Nvidia?T:e===v.V.Amd?b:""}(e),n=(0,v.b)(t,e);return e===v.V.Intel&&(S=n),e===v.V.Nvidia&&(k=n),e===v.V.Amd&&(P=n),n}catch{}return[]}(e.vendor);return(0,v.a)((0,v._)(t,e))}const R=class e{static setConfig(t){e.cfg=t}static getGPUVendor(){return(0,v.g)(e.cfg)}static getGPUParsedVendor(t){return(0,v.p)(t||e.getGPUVendor())}static parseVendor(t){try{const n=e.getGPUParsedVendor(t);return n?{...n,score:M(n)}:null}catch{}return null}};(e=>{"cfg"in e?y(e,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:null}):e.cfg=null})(R);let w=R;var x=Object.defineProperty,E=(e,t,n)=>((e,t,n)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class D{constructor(){E(this,"origin",""),E(this,"score",0)}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){const e=w.parseVendor();return e?(this.score=e.score,this.origin=e.origin,{origin:this.origin,score:this.score,vendorParsedInfo:e}):{origin:this.origin,score:this.score}}}var I=Object.defineProperty;class C{constructor(e){((e,t,n)=>{((e,t,n)=>{t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"mappingFn"),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){try{const e=navigator.deviceMemory;let t=0;return this.mappingFn&&(t=this.mappingFn(e)),{score:t,origin:e}}catch{return{score:0,origin:-1}}}}var L=Object.defineProperty,O=(e,t,n)=>((e,t,n)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class A{constructor(e){O(this,"mappingFn"),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){var e;try{const t=null==(e=null==navigator?void 0:navigator.connection)?void 0:e.downlink;let n=0;return this.mappingFn&&(n=this.mappingFn(t)),{score:n,origin:t}}catch{return{score:0,origin:-1}}}}class G{constructor(e){O(this,"mappingFn"),this.mappingFn=e.mapping}_getBandwidth(){if(!performance.getEntries)return-1;const e=performance.getEntries().filter((({initiatorType:e,decodedBodySize:t,responseEnd:n,responseStart:r})=>("img"===e||"script"===e)&&t>0&&n!==r)),t=e.reduce(((e,{decodedBodySize:t,responseEnd:n,responseStart:r})=>{const i=8e3*t/(n-r)/1024/1024;return e+(i<1e5?i:0)}),0);return e.length?t/e.length:-1}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){try{const e=this._getBandwidth();let t=0;return this.mappingFn&&(t=this.mappingFn(e)),{origin:e,score:t}}catch{return{score:0,origin:-1}}}}const $="xg-decodeimg-scores-map",B=()=>{let e={};try{const t=localStorage.getItem($);t&&(e=JSON.parse(t))}catch{}return e},N=(e,t)=>{let n=[];return t&&e[t]&&(n=e[t]),n},F=e=>{let t=0;return e>0&&(t=e<=1?0:e<4?3*Math.log2(e):e<8?1.6*(Math.log2(e)-2)+6:.523*(Math.log2(e)-3)+7.6),t},U=e=>(t,n)=>{let r=0;if(!e)return r;const i=(e=>{const t=new URL(e);return t.origin+t.pathname})(e);if(t>0){const e=Math.log10(t+1);r=e<=1?6*e:e<=2?1.6*(e-1)+6:2.4*(e-2)+7.6,r=Math.round(100*r)/100,r=((e,t)=>{try{let n=e;const r=B(),i=N(r,t);return i.length>0?(i.push(e),n=i.reduce(((e,t)=>e+t),0)/i.length,i.length>10&&i.shift()):i.push(e),t&&(r[t]=i),(e=>{try{localStorage.setItem($,JSON.stringify(e))}catch{}})(r),n}catch{return e}})(r,i)}else!0!==n&&(r=(e=>{const t=B(),n=N(t,e);let r=0;return n.length>0&&(r=n.reduce(((e,t)=>e+t),0)/n.length),r})(i));return r},H=e=>{let t=0;return e>0&&e<1e6&&(t=e>64?6-1.5*(Math.log2(e)-6):e>8?7.6-.533*(Math.log2(e)-3):7.6+.03*(8-e)),t},V=e=>{let t=0;return e>1&&(t=e<=4?3*Math.log2(e):e<8?2*(Math.log2(e)-2)+6:.65*(Math.log2(e)-3)+8),t},j=e=>{let t=0;return e>0&&e<1e6&&(t=e<=1?0:e<10?6*Math.log10(e):10),t},z=e=>{let t=0;return e>0&&e<1e6&&(t=e<=1?0:e<40?3.745*Math.log10(e):e<100?4.02*(Math.log10(e)-1.602)+6:5.03*(Math.log10(e)-2)+7.6),t};class X extends h{constructor(e){var t;super((t=e.decodeImgUrl,{plugins:{performance:{plugins:{cpu:{plugins:{cpuCoreNumber:{instance:new p({mapping:F})},decodeImg:{instance:new g({url:t,mapping:U(t)})},timer:{instance:new m({mapping:H})}}},memory:{instance:new C({mapping:V})},gpu:{instance:new D}}},net:{plugins:{downlink:{instance:new A({mapping:j})},performanceNet:{instance:new G({mapping:z})}}}}}))}scoreAsync(){return this.getScore()}scoreSync(e){return this.getScoreSync(e)}}function K(){return void 0===typeof window}function Q(e,t=2){return Math.floor(e*Math.pow(10,t))/Math.pow(10,t)}const W="ttplayer_focus_disable_hevc",q="MultiMediaHevcPloy",Y=["video_detail","one_column","browser_mode"],J=["video_detail","homepage_hot","homepage_follow","others_homepage"],Z=["Intel","AMD","NVIDIA","Apple"];function ee(e,t=1,n=[]){return!(!e||"unknown"===e)&&((!n||n.length<1)&&(n=2===t?J:Y),n.filter((t=>e===t)).length>0)}function te(e,t=[]){return!(t.length<1||!e)&&t.filter((t=>e===t)).length>0}function ne(e,t,n,r){const i=ee(e,2,n),o=ee(t,1,r);return i&&o}class re{constructor(){this.dropedRate=0,this.hevcDropedRate=0,this.minDif=10,this.minFrames=60,this.maxDropedRate=10,this.forceNotHevc=!1,this.hevcDisableInfo={hevcMsg:"",hevcCode:0,hevcF:0},this.effectiveConditions={},this.robustnessTestResult=!1,this.configure={url:"",minDroppedFramesRate:.1,minTotalVideoFrames:10},this.hevcRobustnessResult={isSupportBase:!1,supportRobustness:"unknown",status:!1,errCode:0,errMsg:"",robustErr:!1,date:0};const e=this.getLocalDisableInfo();(0,s.l)(q,"localDisableInfo",e),e&&(this.forceNotHevc=e.disable>0,this.hevcDisableInfo={hevcMsg:e.hevcMsg,hevcCode:e.hevcCode,hevcF:2})}getLocalDisableInfo(){try{const e=(0,s.g)(W);if(e){const t=JSON.parse(e);return(new Date).getTime()-t.timestamp>6048e5?((0,s.s)(W,""),null):t}return null}catch{return null}}static getInstance(){return re.instance||(re.instance=new re),re.instance}static setDropRate(e,t,n){(0,s.l)(q,"setDropRate",e,t,n);const r=re.getInstance();if(t<1||nl||o>u)&&(r.forceNotHevc=!0)}static useHevc(e=1){const{forceNotHevc:t,hevcRobustnessResult:n}=re.getInstance(),r=(0,o.Zo)()&&function(){if(K())return!1;const e=window.navigator.userAgent;if(!/iPad|iPhone|iPod/.test(e))return!(null==window||!window.MediaSource)&&((null==window?void 0:window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"'))||(null==window?void 0:window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"'))||(null==window?void 0:window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"'))||(null==window?void 0:window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')));try{const e=document.createElement("video");return[e.canPlayType('video/mp4; codecs="hvc1.1.L0.0"'),e.canPlayType('video/mp4;codecs="hev1.1.6.L120.90"'),e.canPlayType('video/mp4;codecs="hev1.2.4.L120.90"'),e.canPlayType('video/mp4;codecs="hev1.3.E.L120.90"'),e.canPlayType('video/mp4;codecs="hev1.4.10.L120.90"')].some((e=>"probably"===e||"maybe"===e))}catch{return console.error("check hevc error"),!1}}()&&!t;return e<2?r:r&&n.status}static focusDisableHevc(e,t=!0){const n=re.getInstance();!n||n.forceNotHevc||(n.forceNotHevc=!0,n.hevcDisableInfo={...e,hevcF:1},(0,s.l)(q,"focusDisableHevc",t,n.forceNotHevc,e),t&&(0,s.s)(W,JSON.stringify({disable:1,...e,timestamp:(new Date).getTime()})))}static setEffectiveConditions(e){const t=re.getInstance();Object.keys(e).forEach((n=>{t.effectiveConditions[n]=e[n]}))}static getHevcDisableInfo(){const e=re.getInstance();if(!e)return null;const{hevcDisableInfo:t,hevcRobustnessResult:n}=e;return{...t,rcode:n.errCode||0,rmsg:n.errMsg||"",rstatus:n.status?1:0}}static async hevcDeviceDetect(e,t=2){const n=re.getInstance(),{configure:r,hevcRobustnessResult:i}=n;if(i.isSupportBase=(0,o.Zo)(),i.date>0)return i;const s=e?"https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/webapp/main/webapp-desktop/playback1.mp4":"https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/tiktok/webapp/main/webapp-desktop/playback1.mp4";return void 0===typeof window?i:t<2||!s?(i.isSupportBase=(0,o.Zo)(),i):(i.date=(new Date).getTime(),r.url=s,void(0,o.lg)(r).then((e=>(i.status=e.status,i.robustErr=e.robustErr,i))).catch((e=>(i.errCode=e.errCode,i.errMsg=e.errMsg,i.status=e.status,i.robustErr=e.robustErr,i))))}}function ie(e){const{performance:t,net:n}=e;if(!t&&!n)return{score:0};const r={score:0};try{if(n){const{downlink:e={},performanceNet:t={},score:i=0}=n;r.link_s=Q((null==e?void 0:e.score)||0),r.link_o=Q((null==e?void 0:e.origin)||0),r.netper_s=Q((null==t?void 0:t.score)||0),r.netper_o=Q((null==t?void 0:t.origin)||0),r.net_s=Q(i)}if(t){const{cpu:e,memory:n,gpu:i,score:o}=t,s=null==i?void 0:i.vendorParsedInfo;r.memory_s=Q((null==n?void 0:n.score)||0),r.gpu_s=Q((null==i?void 0:i.score)||0),r.gpu=(null==i?void 0:i.origin)||"",r.vendor=(null==s?void 0:s.vendor)||"",r.gpu_m=(null==s?void 0:s.model)||"",r.cpu_s=Q((null==e?void 0:e.score)||0);const{cpuCoreNumber:a,decodeImg:l,timer:u}=e;r.core_s=Q((null==a?void 0:a.score)||0),r.decdeimg_s=Q((null==l?void 0:l.score)||0),r.decdeimg_o=Q((null==l?void 0:l.origin)||0),r.timer_s=Q((null==u?void 0:u.score)||0),r.timer_o=Q((null==u?void 0:u.origin)||0),r.score=Q(o||0)}return r}catch{return r}}function oe(e){var t;const n=null==(t=null==e?void 0:e.performance)?void 0:t.gpu;if(!n)return null;const{vendorParsedInfo:r}=n;return{score:n.score||-2,gpu:n.origin||"",vendor:(null==r?void 0:r.vendor)||""}}class se{constructor(){this._asyncDate=0,this._syncDate=0,this.deviceScore=0,this.score=0,this.netScore=0,this.markData={},this.shortData={},this._mark=null,this.curImgUrl="",this.gpuScoreData={score:-2,vendor:"",gpu:""},!K()&&this.syncMark()}syncMark(){var e;if(0!==this._syncDate)return;this._mark||(this._mark=new X({decodeImgUrl:this.curImgUrl})),this._syncDate=(new Date).getTime(),this.markData=this._mark.scoreSync({ignoreCachedImg:!0});const t=ie(this.markData);this.deviceScore=t.score,this.score=t.score,this.netScore=Q(0|(null==(e=this.markData.net)?void 0:e.score)),this.shortData={...t,d_score:this.deviceScore};const n=oe(this.markData);n&&(this.gpuScoreData=n)}async asyncMark(e){if(0!==this._asyncDate)return;this.curImgUrl=e?"https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/webapp/main/assets/perf_images/performance.jpeg":"https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/tiktok/webapp/main/assets/perf_images/performance.jpeg";const t=new X({decodeImgUrl:this.curImgUrl});this._mark=t,this._asyncDate=(new Date).getTime();const n=await(null==t?void 0:t.scoreAsync());this.markData=n;const r=ie(n);this.shortData={...r,d_score:this.deviceScore},this.score=this.shortData.score;const i=oe(n);i&&(this.gpuScoreData=i)}get markScore(){const{score:e,deviceScore:t,gpuScoreData:n,shortData:r}=this;return{score:e,deviceScore:t,gpuScoreData:n,shortData:r}}static getInstance(){return se.instance||(se.instance=new se),se.instance}static syncMark(){return se.getInstance().syncMark()}static async asyncMark(e){return se.getInstance().asyncMark(e)}static get shortData(){return se.getInstance().shortData}static get gpuScoreData(){return se.getInstance().gpuScoreData}static get markScore(){return se.getInstance().markScore}static markData(){return se.getInstance().markData}}const ae="unknown",le=new i.A,ue=class e{constructor(){this.isTTP=null,this.abTestVersion="",this.hevcAbVersion="",this.logInitInfo={},this.logConfig={},this.dropCount=0,this.totalCount=0,this.deviceMark=se.getInstance(),this.channelInfo={channel:"",domain:"",type:""},this.regionInfo={region:"",uid:"",isLogin:!1},this.hevcTestData={vid:"v0",open:!1,onlySrc:!1,score:-2,playModes:[],pageNames:[],qualityType:20,hevcQualityType:28,closePreload:!1,level:2},this.abTestData={},this.prePlayMode=ae,this.curPlayMode=ae,this.curPageName=ae,this.prePageName=ae}static get version(){return r.v}static set channelInfo(t){e.getInstance().channelInfo=t}static get channelInfo(){return e.getInstance().channelInfo}static set regionInfo(t){e.getInstance().regionInfo=t}static get regionInfo(){return e.getInstance().regionInfo}static set playMode(t){const{instance:n}=e;n.prePlayMode=n.curPlayMode,n.curPlayMode=t}static get playMode(){return e.getInstance().curPlayMode}static get prePlayMode(){return e.getInstance().prePlayMode}static set pageName(t){const n=e.getInstance();t!==n.curPageName&&(n.prePageName=n.curPageName,n.curPageName=t)}static get pageName(){return e.getInstance().curPageName}static get prePageName(){return e.getInstance().prePageName}static getInstance(){return e.instance||(e.instance=new e),e.instance}static checkHevcResult(){const{hevcTestData:t,curPageName:n,curPlayMode:r,deviceMark:i}=e.getInstance(),{gpuScoreData:o,score:s,deviceScore:a}=i,{device:l}=e;return function(e,t){const{curPlayMode:n,curPageName:r}=t,i=t.score||-2,o=t.vendor||"",s=t.dScore||-1,a={qualityType:20,hevcQualityType:28,open:!1,openSrc:!1,closePreload:!1,vid:(null==e?void 0:e.vid)||"v0",data:e};if(!e||"v1"===e.vid||"v0"===e.vid){const e=function(e){const{effectiveConditions:t}=re.getInstance(),n={open:!1,openSrc:!1,hevcQualityType:28},{browser:r,score:i,dScore:o,deviceScore:s,curPageName:a,curPlayMode:l,cpuCore:u,vendor:c}=e,h=t[r],d=re.useHevc((null==h?void 0:h.checkLevel)||2);return n.hevcQualityType=(null==h?void 0:h.hevcQualityType)||28,!d||!h||!u||u0&&h.score&&o>=h.score||s>0&&h.dScore>0&&s>=h.dScore||h.gpuScore>0&&i>=h.gpuScore||i<0&&te(c,Z))&&(n.open=!0,n.openSrc=!0),n}(t);if(e.open)return{...a,...e}}const l=(null==e?void 0:e.level)||2;if(!re.useHevc(l)||!e||!e.open||i<-1||!o)return a;a.closePreload=e.closePreload;const{playModes:u=[],pageNames:c=[],closePreload:h=!1,onlySrc:d=!1}=e;let{qualityType:f,hevcQualityType:p}=e;28===f&&!p&&(f=20,p=28);const g=ne(r,n,c,u);if(!g)return a;const m=function(e,t,n,r){const{score:i=-2,dScore:o=-2,vendor0:s=[],vendor1:a=[]}=r;return t>0&&o>=0?!t||o<=t:e>0?!i||i<=e:te(n,0===e?s:a)}(i,s,o,e)&&g;return{...a,qualityType:f,hevcQualityType:p||28,closePreload:h||!1,open:m&&!d,openSrc:m}}(t,{curPageName:n,curPlayMode:r,score:o.score||-2,vendor:o.vendor||"",dScore:s,deviceScore:a,cpuCore:l.cpu,browser:l.browserType})}static forceDisableHevc(e){var t;t=e,(0,s.l)(q,"forceDisableHevc",t),re.focusDisableHevc(t)}static setHevcTestData(t){const{hevcTestData:n}=e.getInstance();Object.keys(t).forEach((e=>{n[e]=t[e]}))}static getHevcTestData(){const{hevcTestData:t}=e.getInstance();return t}static setABTest(t){const{abTestData:n}=e.getInstance();Object.keys(t).forEach((e=>{n[e]=t[e]}))}static getABTest(){const{abTestData:t}=e.getInstance();return t}static reset(){this.instance.abTestVersion=""}static setHevcAbVersion(t){const n=e.getInstance();n&&(n.hevcAbVersion=t)}static getAbVersions(){const t=e.getInstance();return t?`${t.hevcAbVersion},${t.abTestVersion}`:""}static setHevcEffectiveConditions(e){var t;t=e,re.setEffectiveConditions(t)}static getDeviceScore(){const{deviceMark:t}=e.getInstance();return{dScore:t.deviceScore,score:t.score,netScore:t.netScore}}};ue.device=le;let ce=ue},40048:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(74062),i=n(4629);const o=['video/mp4;codecs="hvc1.1.L0.0"','video/mp4;codecs="hvc1.1.6.L120"','video/mp4;codecs="hev1.1.6.L120.90"','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"'];class s{constructor(e=""){this.rawUA=e,this.platformType=null,this.platformVersion=0,this.browserType=null,this.browserVersion=0,this.isChromium=!1,this.chromiumVersion=0,this.isMobile=!1,this.parseRowUA(this.rawUA)}parseRowPlatform(e=""){if(/Windows NT 10\.0/.test(e))this.platformType="Windows",this.platformVersion=10;else if(/Windows NT 6\.3/.test(e))this.platformType="Windows",this.platformVersion=8.1;else if(/Windows NT 6\.2/.test(e))this.platformType="Windows",this.platformVersion=8;else if(/Windows NT 6\.1/.test(e))this.platformType="Windows",this.platformVersion=7;else if(/Windows NT 6\.0/.test(e))this.platformType="Windows";else if(/Windows NT 5\.1/.test(e))this.platformType="Windows";else if(/Windows NT 5\.0/.test(e))this.platformType="Windows";else if(/Windows Phone/.test(e))this.platformType="Windows",this.isMobile=!0;else if(/Android/.test(e)){this.platformType="Android";const t=e.match(/Android\s([0-9\.]+)/);t&&t.length>1&&(this.platformVersion=parseFloat(t[1])),this.isMobile=!0}else if(/Linux/.test(e))this.platformType="Linux";else if(/CrOS/.test(e)){this.platformType="ChromeOS";const t=e.match(/CrOS ([a-zA-Z0-9_]+) (\d+\.\d+\.\d+\.\d+)/);t&&t.length>2&&(this.platformVersion=parseFloat(t[2]))}else if(/iPad|iPhone|iPod/.test(e)){this.platformType="iOS";const t=e.match(/OS (\d+)_(\d+)_?(\d+)?/);t&&t.length>2&&(this.platformVersion=parseFloat(t[1]+"."+t[2]+"."+(t[3]||"0"))),this.isMobile=!0}else if(/Mac OS X|Macintosh/.test(e)){this.platformType="MacOS";const t=e.match(/Mac OS X (10[._]\d+(?:[._]\d+)?)/);t&&t.length>1&&(this.platformVersion=parseFloat(t[1].replace(/_/g,".")))}}parseTVPlatform(e=""){e.toLowerCase&&(e=e.toLowerCase()),/tizen/.test(e)?this.platformType="Tizen":/webos/.test(e)?this.platformType="WebOS":/vstvb/.test(e)?this.platformType="VSTVB":/fetchtv/.test(e)?this.platformType="FetchTV":/netgemtv/.test(e)?this.platformType="NetGemTV":/vizio/.test(e)?this.platformType="VIZIO":/wpe/.test(e)?this.platformType="WPE":/vodafone/.test(e)?this.platformType="VODAFONE":/philips/.test(e)?this.platformType="Philips":/netrangemmh/.test(e)?this.platformType="NETRANGEMMH":/cva/.test(e)?this.platformType="CVA":/tlc/.test(e)?this.platformType="TLC":/openmw/.test(e)?this.platformType="OpenMW":/totalplay/.test(e)?this.platformType="Totalplay":/vidaa/.test(e)?this.platformType="VIDAA":/megacable/.test(e)?this.platformType="megacable":/lge/.test(e)&&(this.platformType="LGE")}parseRowBrowser(e=""){if(/MSIE|Trident/.test(e))this.browserType="IE";else if(/Edg|Edge/.test(e)){this.browserType="Edge";const t=e.match(/(?:Edg|Edge)\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Opera|OPR/.test(e)){this.browserType="Opera";const t=e.match(/(?:Opera|OPR)\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Firefox/.test(e)){this.browserType="Firefox";const t=e.match(/Firefox\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Safari/.test(e)&&!/Chrome/.test(e)){this.browserType="Safari";const t=e.match(/Version\/(\d+(\.\d+)+).*Safari/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Chrome/.test(e)){this.browserType="Chrome";const t=e.match(/(?:CriOS|Chrome)\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}if(/Chrome/.test(e)){this.isChromium=!0;const t=e.match(/(?:CriOS|Chrome)\/(\d+\.?\d*)/);t&&t.length>1&&(this.chromiumVersion=parseFloat(t[1]))}}parseRowUA(e=""){this.parseRowPlatform(e),this.parseTVPlatform(e),this.parseRowBrowser(e)}}class a extends r.C{constructor(){super(),this._isMSEAvailable=()=>!(typeof window>"u")&&"MediaSource"in window,this._checkUA=()=>{if("Linux"==this.ua.platformType||"ChromeOS"==this.ua.platformType||"Firefox"==this.ua.browserType||"Opera"==this.ua.browserType||"Edge"==this.ua.browserType&&this.ua.browserVersion<107)return!1;if(this.ua.isChromium){if(this.ua.chromiumVersion<107||"Chrome"==this.ua.browserType&&("Android"==this.ua.platformType&&(this.ua.platformVersion<5||this.ua.browserVersion<117)||"Windows"==this.ua.platformType&&this.ua.platformVersion<8))return!1}else if("Safari"==this.ua.browserType&&this.ua.browserVersion<13)return!1;return!0},this._isHEVCAvailable=()=>!(typeof window>"u"||!window.MediaSource)&&o.reduce(((e,t)=>e||window.MediaSource.isTypeSupported(t)),!1),this.checkHEVCWithPlaybackQuality=(e="",t=.2,n)=>{(0,i.lg)({url:e,minDroppedFramesRate:t,minTotalVideoFrames:10}).then((e=>{n(e)}))},this._player=null,this._element=null,this.ua=new s(this.userAgent),this.isMSESupported=this._isMSEAvailable(),this.isHEVCSupported=this._isHEVCAvailable()&&(0,i.Zo)(),this.shouldUseHEVC=this.isHEVCSupported&&this._checkUA()}static get version(){return r.v}get playbackQuality(){var e,t;return this._element?this._element.getVideoPlaybackQuality?this._element.getVideoPlaybackQuality():{corruptedVideoFrames:0,creationTime:performance.now(),droppedVideoFrames:(null==(e=this.el)?void 0:e.webkitDroppedFrameCount)||0,totalVideoFrames:(null==(t=this.el)?void 0:t.webkitDecodedFrameCount)||0}:null}get cpu(){return typeof navigator>"u"||!navigator.hardwareConcurrency?0:navigator.hardwareConcurrency}get memory(){return typeof navigator>"u"||!navigator.deviceMemory?0:navigator.deviceMemory}get userAgent(){return typeof navigator>"u"||!navigator.userAgent?"":navigator.userAgent}get bandwidth(){return typeof navigator>"u"||!navigator.connection?0:navigator.connection.downlink||0}get networkType(){return typeof navigator>"u"||!navigator.connection?"":navigator.connection.effectiveType||""}get platformType(){return this.ua.platformType||""}get platformVersion(){return this.ua.platformVersion}get browserType(){return this.ua.browserType||""}get browserVersion(){return this.ua.browserVersion}get isChromium(){return this.ua.isChromium}get chromiumVersion(){return this.ua.chromiumVersion}set player(e){var t;this._player=e,this._element=(null==(t=this._player)?void 0:t.el)||null}set element(e){this._element=e}}},23237:(e,t,n)=>{"use strict";function r(e){try{return localStorage.getItem(e)}catch{}}function i(e,t){try{localStorage.setItem(e,t)}catch{}}n.d(t,{c:()=>u,g:()=>r,i:()=>a,l:()=>l,s:()=>i});let o=-1,s=-1;function a(){return o>=0?o:o<0?(o="1"===r("ttplayer_focus_src_play")?1:0,o):0}function l(e,...t){s<0&&function(){const e=r("ttplayer_debug");s=parseInt(e||"0")}(),!(s<1)&&console.log(e,...t)}function u(e){return parseInt((1e3*e).toFixed(0),10)}},47620:(e,t,n)=>{"use strict";n.d(t,{M:()=>k,R:()=>b});var r=n(74062),i=n(23237),o=Object.defineProperty,s=(e,t,n)=>((e,t,n)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const a=[new RegExp("(\\?|&)expire=([^&]*)(&|$)"),new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),new RegExp("(\\?|&)x-expires=([^&]*)(&|$)")];function l(e){if(!e||"string"!=typeof e)return 0;let t=0;try{const n=[];if(a.forEach((t=>{const r=e.match(t);r&&n.push(r)})),n.length>0)t=parseInt(n[0][2],10);else{const n=e.split("/");n.length>5&&8===n[4].length&&(t=parseInt(n[4],16))}if(t>0){const e=new Date;return t<=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),0)/1e3?1:2}return 0}catch{return 0}}const u={v360:{width:640,height:360},v480:{width:800,height:480},v540:{width:960,height:540},v720:{width:1280,height:720},v864:{width:1536,height:864},v960:{width:1706,height:960},v1080:{width:1920,height:1080},v2k:{width:2560,height:1440},v4k:{width:3840,height:2160}};class c{constructor(){this.ladder=null,this._mvmaf="",this._vqscore=0,this.width=0,this.height=0,this.playedDuration=0}set mvmaf(e){if(!e)return;this._mvmaf=e;let t=JSON.parse(e);t["v2.0"]&&(this.ladder=t["v2.0"])}get mvmaf(){return this._mvmaf}set vqscore(e){e&&(this._vqscore=e)}get vqscore(){return this._vqscore}_findNearestPlaybackScore(){let e=0;if(!this.ladder)return 0;let t=this.width*this.height,n="v540",r=Number.MAX_VALUE;for(let e in u){const i=u[e];let o=t-i.width*i.height;Math.abs(o)(e.DEFAULT="default",e.ACTIVE="active",e.RETAIN="retain",e.RELEASE="release",e.BACKUP="backup",e))(b||{});const S="MultimediaMetrics";class k extends r.C{constructor(e,t){super(),s(this,"_onPlay",(()=>{this.playEnded.paused&&this.playEnded.stopPauseTimer()})),s(this,"_onPause",(()=>{this.block.started&&this.block.reset(),this.playEnded.startPauseTimer()})),s(this,"_onPlaying",(()=>{if(this.status=1,this.block.started){this.block.stopTimer();const{blockType:e}=this.blockStart;this.trigger(this.block.name,this.block.exportData(this._player,{blockType:e}))}this._player.element&&(this.playEnded.width=this._player.element.videoWidth,this.playEnded.height=this._player.element.videoHeight)})),s(this,"_onTimeupdate",(()=>{!this._player||!this._player.element||(this.playEnded.currentTime=this._player.element.currentTime)})),s(this,"_onEnded",(()=>{this.status=2})),s(this,"_onWaiting",(()=>{!this._player||!this._player.element||1==this._status&&(this._player.element.paused||this._player.state!==b.ACTIVE||(this.blockStart.setBlockType(this._player),this.trigger(this.blockStart.name,this.blockStart.exportData()),this.block.startTimer()))})),s(this,"_onError",(e=>{this.trigger(this.playFailed.name,this.playFailed.exportData(this._player,e,this._status))})),s(this,"_onSourceError",(e=>{const{host:t,errorCode:n,message:r,src:i}=e;this.playFailed.loadStartRetry.push({host:t,code:n,message:r,isExpired:l(i)})})),s(this,"_onLoadstart",(()=>{this.status=1,this.trigger(this.videoRequest.name,this.videoRequest.exportData()),this.playQuality.startTimer(),this.videoRequestResponse.startTimer(),this.firstFrame.startTimer()})),s(this,"_onLoadeddata",(()=>{this.videoRequestResponse.stopTimer(),this._loadedTime=window.performance?window.performance.now():Date.now(),this.playQuality.durationWithLoaded=this._loadedTime-this.playQuality.startTime,this.trigger(this.videoRequestResponse.name,this.videoRequestResponse.exportData())})),s(this,"_onPlayCatch",(()=>{this.xgDowngraded=!0})),s(this,"_onDownloaderChunkReady",(e=>{this.trigger(this.videoDataSize.name,e)})),s(this,"_onProgress",(()=>{if(!this._player||!this.xgDowngraded&&"RAW"!=this._player.type||!this.config||!this.config.bitrate)return;const e=this._player.element.buffered;let t=0;for(let n=0;n{const t=e||this.event;t&&(t.on("play",this._onPlay),t.on("pause",this._onPause),t.on("playing",this._onPlaying),t.on("timeupdate",this._onTimeupdate),t.on("ended",this._onEnded),t.on("waiting",this._onWaiting),t.on("error",this._onError),t.on("source_error",this._onSourceError),t.on("loadstart",this._onLoadstart),t.on("loadeddata",this._onLoadeddata),t.on("playCatch",this._onPlayCatch),t.on("downloaderChunkReady",this._onDownloaderChunkReady),t.on("progress",this._onProgress))})),s(this,"removeEvent",(e=>{const t=e||this.event;t&&(t.off("play",this._onPlay),t.off("pause",this._onPause),t.off("playing",this._onPlaying),t.off("timeupdate",this._onTimeupdate),t.off("ended",this._onEnded),t.off("waiting",this._onWaiting),t.off("error",this._onError),t.off("source_error",this._onSourceError),t.off("loadstart",this._onLoadstart),t.off("loadeddata",this._onLoadeddata),t.off("playCatch",this._onPlayCatch),t.off("downloaderChunkReady",this._onDownloaderChunkReady),t.off("progress",this._onProgress))})),s(this,"stop",(()=>{-1!=this._status&&(this.reset(),this.lastPlayEnded&&(this.trigger(this.lastPlayEnded.name,this.lastPlayEnded.exportData()),this.lastPlayEnded=null))})),s(this,"reset",(()=>{(0,i.l)(S,"reset"),this.playEnded.started&&this.playEnded.stopTimer(),this.lastPlayEnded=new v(this._status),this.lastPlayEnded.copy(this.playEnded),this.status=-1,this.xgDowngraded=!1,this.videoRequest.reset(),this.videoRequestResponse.reset(),this.blockStart.reset(),this.block.reset(),this.playQuality.reset(),this.playEnded.reset(),this.playFailed.reset(),this.firstFrame.reset(),this._loadedTime=0})),this.event=e,this.config=t,this._status=-1,this.initEvent(),this._player=null,this.xgDowngraded=!1,this.videoRequest=new d,this.videoRequestResponse=new f,this.blockStart=new p,this.block=new g,this.playQuality=new m,this.lastPlayEnded=null,this.playEnded=new v(this._status),this.playFailed=new y,this.firstFrame=new _,this.videoDataSize=new T,this.events=[this.videoDataSize.name,this.videoRequest.name,this.videoRequestResponse.name,this.blockStart.name,this.block.name,this.playQuality.name,this.playEnded.name,this.playFailed.name,this.firstFrame.name],this.startInitInfo={},this._loadedTime=0}static get version(){return r.v}getCommonData(e){const{element:t,config:n,type:r,state:i}=e;return{currentTime:(null==t?void 0:t.currentTime)||0,videoDuration:(null==t?void 0:t.duration)||0,codecType:(null==n?void 0:n.codecType)||"h264",vtype:(null==n?void 0:n.vtype)||"MP4",playerType:r||"default",renderState:i||b.ACTIVE}}setConfig(e){e&&e.bitrate&&(this.config.bitrate=e.bitrate)}set player(e){this._player=e,e&&(this._player.mvmaf&&(this.playEnded.mvmaf=this._player.mvmaf),this._player.vqscore&&(this.playEnded.vqscore=this._player.vqscore))}set status(e){if(1==this._status&&1==e){this.playQuality.stopTimer(),this.playEnded.startTimer(),this.firstFrame.stopTimer(),this.playQuality.durationFromLoaded=this.playQuality.endTime-this._loadedTime;const{durationWithLoaded:e,durationFromLoaded:t}=this.playQuality,n={...this.playQuality.exportData(),...this.playFailed.getRetryData(),durationWithLoaded:e,durationFromLoaded:t};this.trigger(this.playQuality.name,n),this.trigger(this.firstFrame.name,n)}this._status=e}setStartInitInfo(e){(0,i.l)(S,"setStartInitInfo",e),this.startInitInfo=e}trigger(e,t){const n=this.getCommonData(this._player);super.trigger(e,{...n,...t,startInfo:this.startInitInfo||{}})}}},72364:(e,t,n)=>{"use strict";n.d(t,{Tz:()=>_e,IH:()=>Se,Vb:()=>Ae,SX:()=>Ve,SN:()=>Be});var r=n(2651),i=n(90102),o=n(21704),s=n(42990),a=Object.defineProperty,l=(e,t,n)=>((e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class u{constructor(){this.__handlers=[],window.ResizeObserver&&(this.observer=new window.ResizeObserver((e=>{this.__trigger(e)})))}addObserver(e,t){if(!this.observer)return;this.observer&&this.observer.observe(e);const{__handlers:n}=this;let r=-1;for(let t=0;t-1?this.__handlers[r].handler.push(t):this.__handlers.push({target:e,handler:[t]})}unObserver(e){let t=-1;this.__handlers.map(((n,r)=>{e===n.target&&(t=r)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}destroyObserver(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=[]}__runHandler(e,t){const{__handlers:n}=this;for(let r=0;r{try{n(e,t)}catch(e){console.error(e)}}));break}}__trigger(e){e.map((e=>{const t=e.contentRect;this.__runHandler(e.target,t)}))}}let c=null;const h="change",d="update",f="error",p=[{code:0,msg:"SUCCESS"},{code:1,msg:"LOAD_ERROR",type:"LOAD_ERROR"},{code:2,msg:"PARSER_ERROR",type:"PARSER_ERROR"},{code:3,msg:"FORMAT_NOT_SUPPORTED",type:"FORMAT_NOT_SUPPORTED"},{code:4,msg:"ID_OR_LANGUAGE_NOT_EXIST",type:"ID_OR_LANGUAGE_NOT_EXIST"},{code:5,msg:"PARAMETERS_ERROR",type:"PARAMETERS_ERROR"},{code:6,msg:"ABORT",type:"ABORT"},{code:7,msg:"UNKNOWN",type:"UNKNOWN"},{code:8,msg:"DATA_ERROR:subtitle.url is null",type:"DATA_ERROR"},{code:9,msg:"DATA_ERROR:subtitle.url length is 0",type:"DATA_ERROR"}];class g extends Error{constructor(e,t,n,r){e||(e=p[t||7].msg),super(e),this.message="",this.code=t||7,this.message=e,this.type=p[t||7].msg,this.orgError=n||null,this.data=r||null}}function m(e,t={},n){const r={code:p[e].code,message:p[e].msg,id:"",language:""};return Object.keys(t).map((e=>{r[e]=t[e]})),r}class v{constructor(){let e,t;const n=new Promise(((n,r)=>{e=n,t=r}));return n.resolve=function(t){e(t),n.state="fulfilled"},n.reject=function(e){t(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}resolve(e){}reject(e){}}function y(e,t){if(!e)return!1;if(e.classList)return Array.prototype.some.call(e.classList,(e=>e===t));{const n=e.className&&"object"==typeof e.className?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}}function _(e,t){e&&(e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((t=>{t&&e.classList.add(t)})):y(e,t)||(e.className&&"object"==typeof e.className?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t))}function T(e){const t=Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g);return t?t[0]:""}function b(e="div",t="",n={},r=""){const i=document.createElement(e);return i.className=r,i.innerHTML=t,Object.keys(n).forEach((t=>{const r=t,o=n[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(r,o):i.setAttribute(r,o)})),i}function S(e){return e&&e instanceof window.HTMLMediaElement}function k(e){const t=[];if(e&&"String"===T(e))t.push({url:[e],index:0,start:-1,end:-1});else if("Array"===T(e)){const n=e;if(0===n.length)return t;"String"===T(n[0])?t.push({url:e,index:0,start:-1,end:-1}):n.forEach(((e,n)=>{const r=e;t.push({url:r.url||r.src||"",index:n,start:r.start||-1,end:r.end||-1})}))}return t}function P(e,t,n){const r=t.length;if(r<1)return-1;if(t[n=n<0?0:n>=r?r-1:n].start<=e&&et[i].end&&i+1t[i].end&&i+1>=r)return-1}return-1}}function M(e,t,n){const r=t.length;if(r<1)return[];const i=[];if((n=n<0?0:n>=r?r-1:n)[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,2}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/],G=/^Format:\s/,$=/^Style:\s/,B=/^Dialogue:\s/;function N(e){const t=e.length;return 3===t?(60*(60*Number(e[0])+Number(e[1]))*1e3+1e3*Number(e[2]))/1e3:2===t?(60*Number(e[0])*1e3+1e3*Number(e[1]))/1e3:Number(e[0])}function F(e,t){return e>=0&&e=50&&(n=0),0===n){const n={start:e[r].start,list:[e[r]],end:e[r].end};t.push(n)}else t[t.length-1].list.push(e[r]),t[t.length-1].end=e[r].end;n++}return t}static parse(e,t){const n=U.checkFormat(e);if(n)try{let r={list:[],styles:[]};"ass"===n?r=U.parseASS(e):"vtt"===n&&(r=U.parseVTT(e)),t({format:n,list:r.list,styles:r.styles})}catch(e){console.error(e),t({format:n},new g(`parse_error_${e.message}`,2,e))}else t({format:"unknown"},new g("unknown_format",3))}static parseASSItem(e="",t=[]){const n=e.split(","),r={};let i="";try{const e=n.length-t.length;return i=e>0?n.splice(t.length-1,e+1).join(",")+"":n[n.length-1]+"",i=i.replace(/\\n+/g,""),n[t.length-1]=i,t.map(((e,t)=>{"end"===e||"start"===e?r[e]=N(n[t].split(":")):"text"===e?r[e]=[n[t]]:"layer"===e?(r[e]=[n[t]],r.textTag=[n[t]]):r[e]="style"===e?[n[t]]:Number(n[t])?Number(n[t]):n[t]})),r}catch(e){return console.error(e),{}}}static parseASS(e){const t=e.split("\n"),n=[];let r=0,i=0;const o=[];let s=[],a=null;for(;re.toLocaleLowerCase()));else if($.test(t[r]))o.push(t[r].replace($,"").replace(/\s+/g,""));else if(B.test(t[r])){const e=U.parseASSItem(t[r].replace(B,""),s);if(a&&e.start===a.start&&e.end===a.end)try{const{text:t=[],textTag:n=[],style:r}=a;e.text.length>0&&t.push(e.text[0]),e.textTag.length>0&&n.push(e.textTag[0]),r&&r.push(e.style[0])}catch(e){console.error(e)}else{a=e;let t=null;i%50==0?(t={start:a.start,end:a.end,list:[]},t.list.push(a),n.push(t)):(t=n[n.length-1],t.end=a.end,t.list.push(a)),i++}}r++}return{list:n,styles:[]}}static parseVTTStyle(e,t){const n=e.split(":");if(n.length>1){const e=n[0].trim().split("-");let r="";e.length>1?e.map(((e,t)=>{r+=0===t?e:e.charAt(0).toUpperCase()+e.slice(1)})):r=e[0],t[r]=n[1].trim().replace(/;$/,"")}return t}static parseVTT(e){const t=(e=e.replace(D,"")).split("\n"),n=[];let r=0,i=0,o=null,s=!1,a=!1,l=null,u=null;const c=[];for(;r)/g.exec(e);let n="",r="default";if(t){r=t[0].replace(/\<|\>|\&/g,"");const i=RegExp(`^<${r}>(([\\s\\S])*?)$`).exec(e);i?n=i[1]:(n=e,r="")}else n=e;const i=/<(\w+).(\w+)>/g;let o=i.exec(n);for(;o&&o.length>2;)n=n.replace(o[0],`<${o[1]} class="${o[2]}">`),o=i.exec(n);return{tag:r,text:n.replace(/\\n+/g,"
")}}static parseVttTime(e){const t=e.split("--\x3e");let n=0,r=0;if(2===t.length){const e=t[0].split(":"),i=t[1].split(":");n=N(e),r=N(i)}return{start:n,end:r,time:e}}static isVTT(e){return D.test(e)}static isASS(e){return O.test(e)}static checkFormat(e){return e?D.test(e)?"vtt":O.test(e)?"ass":"":""}}function H(e,t){const{status:n="",statusText:r=""}=e;return`${t}_${n}_${r}`}function V(e,t,n){const{url:r="",method:i="GET",type:o="arraybuffer",timeout:s=1e4,data:a={}}=e,l=new window.XMLHttpRequest,u=i.toUpperCase(),c=[];if(o&&(l.responseType=o),s&&(l.timeout=s),Object.keys(a).forEach((e=>{c.push(`k=${a[e]}`)})),l.onload=()=>{200===l.status||206===l.status?n({context:t,res:l,type:"success"}):n({context:t,res:l,type:"error",error:new g(H(l,"response_error"),1)})},l.onerror=e=>{n({context:t,res:l,type:"error",error:new g("loaderror",1)})},l.ontimeout=e=>{n({context:t,res:l,type:"error",error:new g("timeout",1)})},l.onabort=()=>{n({context:t,res:l,type:"error",error:new g("abort",1)})},"GET"===u)l.open(u,`${r}`),l.send();else{if("post"!==u)throw n({context:t,res:l,type:"error",error:new g(`xhr ${u} is not supported`,1)}),new g(`xhr ${u} is not supported`,1);l.open(u,r),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.send(c.join("&"))}}function j(e,t,n){"json"===t?n({styles:[],list:U.parseJson(e),format:"json"}):"string"===t&&U.parse(e,n)}function z(e,t,n){let r=[];n||(n=new v),r="String"===T(e)?[e]:[...e];const i=r.shift()||"",o=e=>{const{res:i,error:s}=e;if(s)r.length>0?V({url:r.shift()||"",type:"text"},t,o):n.reject(s);else if(i){const{response:e}=i;j(e,"string",((e,t)=>{t?n.reject(t):n.resolve(e)}))}};return V({url:i,type:"text"},t,o),n}let X=!1;class K extends s{constructor(e){super(),l(this,"_onPause",(()=>{this.stopRender()})),l(this,"_onPlay",(()=>{this._curRenderTask.length>0&&this.startRender(-1)})),l(this,"_onTimeupdate",(()=>{if(!this._isOpen)return;if(this.config.domRender){const e=this.player.video?this.player.video:this.player,{videoWidth:t,videoHeight:n}=e;!this._videoMeta.scale&&t&&n&&this._onResize(this.player.root)}const e=this._getPlayerCurrentTime();Math.round(Math.abs(1e3*e-this._ctime))<200||(this._ctime=1e3*e,this.currentText&&this.currentText.list&&("live"===this.config.updateMode?this._liveUpdate(e):this._update(e)))})),l(this,"_onResize",(e=>{const{_videoMeta:t,config:n}=this;if(n.domRender){if((!e||!(e instanceof window.Element))&&(e=this.player.root),this._iId&&(window.clearTimeout(this._iId),this._iId=null),!t.scale){if(!this.player.video)return;const{videoWidth:e,videoHeight:n}=this.player.video;if(!e||!n)return;t.videoWidth=e,t.videoHeight=n,t.scale=parseInt(n/e*100,10)}this.__startResize(e)}})),l(this,"_onCoreEvents",(e=>{try{switch(e.eventName){case"core.subtitlesegments":this._onSubtitleSegment(e.list||[]);break;case"core.subtitleplaylist":this._onSubtitlePlaylist(e.list||[]);break;case"core.seipayloadtime":this._onCoreSeiintime(e)}}catch(e){console.error(e)}})),l(this,"startRender",(e=>{if(e>0&&this._renderIntervalId&&(window.cancelAnimationFrame(this._renderIntervalId),this._renderIntervalId=-1),!this.textTrack)return;const{_curRenderTask:t}=this;this._lastTimeStamp=(new Date).getTime();const n=[];t.forEach(((t,r)=>{const{lastTime:i,wordList:o,interval:s,dom:a,ids:l}=t;if(e<0||this._lastTimeStamp<0||this._lastTimeStamp-i>=s){const e=o.shift();e&&a.appendData(e),t.lastTime=this._lastTimeStamp}o.length<1&&n.push({index:r,ids:l})})),this._log(">>>>_renderByWords emptyArr",n.length,t.length),n.forEach((e=>{t.splice(e.index,1),this._log(">>>_renderByWords remove emptyArr",e.index,t.length)})),t.length>0&&(this._renderIntervalId=window.requestAnimationFrame(this.startRender))})),l(this,"destroy",(()=>{this.detachPlayer(),this.removeAllListeners(),this.player=null,this.textTrack=null,this._curRenderTask=[],this.stopRender()})),X=function(){const e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,r=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||r&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e);return/(?:iPhone)/.test(e)&&!o||r||n||o}(),this.currentText=null,this.currentExtText=null,this.textTrack=[],this._cid=-1,this._gid=-1,this._cids=[],this._iId=null,this._iC=0,this.player=null,this.root=null,this.config={line:"double",bottom:0,mode:"stroke",defaultOpen:!1,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,fitVideo:!0,offsetBottom:2,fontColor:"#fff",domRender:!1,updateMode:"vod",renderMode:"",debugger:!1},this._ctime=0,this._loadingTrack={},this.seiTime=0,this.lastSeiTime=0,this._curTexts=[],this._curRenderTask=[],this._renderIntervalId=-1,this._lastTimeStamp=-1,Object.keys(this.config).map((t=>{void 0!==e[t]&&null!==e[t]&&(this.config[t]=e[t])})),this._isOpen=this.config.defaultOpen||!1,this._videoMeta={scale:0,videoHeight:0,videoWidth:0,lwidth:0,lheight:0,vWidth:0,vHeight:0,vBottom:0,vLeft:0,marginBottom:0},e.subTitles&&"Array"===T(e.subTitles)&&(e.player&&this.attachPlayer(e.player),this.setSubTitles(e.subTitles,this.config.defaultOpen))}get version(){return"0.2.6"}setSubTitles(e=[],t=!1,n=!0){const r=this._isOpen||t;n&&this.innerRoot&&this.switchOff(),!e||e.length<1?this.switchOff():(this.currentText=null,this.textTrack=[],e.forEach((e=>{const t={};Object.keys(e).map((n=>{t[n]=e[n]})),t.url=k(t.url),t.isDefault&&(this.currentText=t),this.textTrack.push(t)})),this._log("setSubTitles",r,this.textTrack),r&&(this.currentText||(this.currentText=this.textTrack[0]),this.switch().catch((e=>{this.emitError(e),this._log("[switch]",e)}))),this._log(">>>this.currentText",r,this.currentText),this.currentText&&this._loadTrack(this.currentText).then((e=>{this.addStyles(e)})).catch((e=>{this.emitError(e),this._log("[_loadTrack] errorsss",e)})),this.emit("reset",{type:"reset",list:this.textTrack,isOpen:r}))}updateSubTitle(e){let t=-1;for(let n=0;n-1){const n=R(this.currentText,this.textTrack[t]);if(this._log("updateSubTitle","_isCurrent",n,"this.isOpen",this.isOpen,this.currentText),!n)return;const r=k(e.url);this.isOpen?(r.forEach((e=>{this.textTrack[t].url.push(e)})),this._log("updateSubTitle _loadTrackUrls",this.textTrack[t]),this._loadTrackUrls(this.currentText,2)):this.textTrack[t].url=r}}addStyles(e){const{styles:t,format:n}=e;t&&"vtt"===n&&(t.map((e=>{e.key||(e.key="xg-text-track-span")})),function(e,t=""){let n="";e.map((e=>{n+=` ${t} ${e.key} {${e.style}}`}));const r=document.createElement("style"),i=document.head||document.getElementsByTagName("head")[0];if(r.type="text/css",r.id="ssss",r.styleSheet){const e=function(){try{r.styleSheet.cssText=n}catch{}};r.styleSheet.disabled?setTimeout(e,10):e()}else{const e=document.createTextNode(n);r.appendChild(e)}i.appendChild(r)}(t,"xg-text-track"))}attachPlayer(e){if(this._log("attachPlayer"),!e||e===this.player)return;this.player&&this.detachPlayer();const{fontColor:t,mode:n,fitVideo:r,domRender:i}=this.config;var o,s;this.player=e,i&&(this.root=document.createElement("xg-text-track"),this.root.className="xg-text-track",!this._isOpen&&_(this.root,"text-track-hide"),!r&&_(this.root,"text-track-no-fitvideo"),n&&_(this.root,`text-track-${n}`),this.innerRoot=document.createElement("xg-text-track-inner"),this.root.appendChild(this.innerRoot),t&&(this.root.style.color=t),this.currentText&&["language","id","label"].map((e=>{this.root.setAttribute(`data-${e}`,this.currentText[e]||"")})),this.player.root.appendChild(this.root),o=e.root,s=this._onResize,c||(c=new u),c.addObserver(o,s)),S(e)?(e.addEventListener("timeupdate",this._onTimeupdate),e.addEventListener("pause",this._onPause),e.addEventListener("play",this._onPlay)):(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((e=>{this._log("[switch]",e)}))}detachPlayer(){const{player:e,config:t}=this;var n;e&&(S(e)?(e.removeEventListener("timeupdate",this._onTimeupdate),e.removeEventListener("pause",this._onPause),e.removeEventListener("play",this._onPlay)):(this.player.off("destroy",this.destroy),this.player.off("timeupdate",this._onTimeupdate),this.player.off("pause",this._onPause),this.player.off("play",this._onPlay),this.player.off("core_event",this._onCoreEvents)),t.domRender&&(e.root&&(n=e.root,this._onResize,c&&c.unObserver(n),e.root.removeChild(this.root)),this.innerRoot=null,this.root=null),this.player=null)}switch(e={id:"",language:""}){return this._log("switch",e),this._loadingTrack=e,new Promise(((t,n)=>{if(!e.id&&!e.language){if(this.currentText)return this._loadingTrack={},this._updateCurrent(this.currentText),this.switchOn(),void t({message:"switch default subtitle success",code:0});{const e=new g("no default subtitle",5);return this.emitError(e),void n(e)}}if(this.currentText&&R(e,this.currentText))this._loadingTrack={},this._updateCurrent(this.currentText),this.switchOn(),t(m(0));else{let r=null;this.__removeByTime(this._curTexts,0);for(let t=0;t{if(this.addStyles(i),this._loadingTrack.id===r.id||this._loadingTrack.language===i.language)this._loadingTrack={},this._updateCurrent(i),this.switchOn(),t(m(0));else{const t=new g(`check _loadingTrack fail id: ${this._loadingTrack.id} nextSubtitle:${i.id}`,6,null,e);this.emitError(t),n(t)}})).catch((e=>{this.emitError(e),n(e)})));else{const t=new g(`The is no subtitle with id:[{${e.id}}] or language:[${e.language}]`,4,null,e);this.emitError(t),n(t)}}}))}switchExt(e={id:"",language:""}){return new Promise(((t,n)=>{if(e.id||e.language){let n=null;for(let t=0;t{this.currentExtText=e,t(m(0))})).catch((e=>{this.emitError(e)}))}else this.currentExtText=null,t(m(0))}))}emitError(e){this.emit(f,{type:f,error:e})}switchOn(){this._log("switchOn"),this._isOpen=!0,this.show();const{id:e,language:t}=this.currentText;this.emit(h,{type:h,isOpen:!0,id:e,language:t,texts:[]})}switchOff(){if(this._isOpen=!1,this.hide(),!this.currentText)return;const{id:e,language:t}=this.currentText;this.emit("off",{type:"off",id:e,language:t,texts:[],isOpen:!1})}get isOpen(){return this._isOpen}_log(...e){this.config.debugger&&console.log("[xgSubtitle]",...e)}_loadTrack(e){this._log("_loadTrack",e.language,e);const t=new v;let 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 j(r,n,((n,r)=>{r?(this.emitError(r),t.reject(r)):(e.format=n.format,e.styles=n.styles,e.list=n.list,t.resolve(e))})),t;const i=[...e.url];return 0===i.length?(t.resolve(e),t):(z(i.splice(0,1)[0].url,e).then((n=>{e.format=n.format,e.styles=n.styles,e.list||(e.list=[]),this._pushList(e.list,n.list),i.length>1&&this._loadTrackUrls(e,2),t.resolve(e)})).catch((e=>{t.reject(e)})),t)}_emitPlayerSwitch(e,t){e&&"live"===this.config.updateMode&&(e.list=[],e.url=[]);const n={lang:t.language,...t};this._log("emit subtile_switch ",t,n),this.emit(h,{type:h,error:null})}_loadTrackUrls(e,t,n){const r=e.url.length,i=r>t?e.url.splice(0,t):e.url.splice(0,r);let o=i.length;this._log("_loadTrackUrls",e.language,r,i.length,o),i.forEach(((t,r)=>{z({...t,index:r}.url,t).then((t=>{e.format=t.format,e.styles=t.format,e.list||(e.list=[]),this._pushList(e.list,t.list),o--})).catch((e=>{o--})).finally((t=>{0===o&&(n&&n.resolve(e),this._loadTrackUrls(e,2))}))}))}_freshUrl(e,t={url:""}){let n=-1;e.url.forEach(((e,r)=>{e.url===t.url&&(n=r)})),n>-1&&e.url.splice(n,1)}_pushList(e,t){const n=t[0].start,r=t[t.length-1].end;if(0===e.length||n>=e[e.length-1].end)t.forEach((t=>{e.push(t)}));else{let n=-1;for(let t=0;tr){n=t;break}n>-1&&t.forEach(((t,r)=>{e.splice(n+r,0,t)}))}return e}_updateCurrent(e){this.currentText=e,this.config.domRender&&this.root&&(["language","id","label"].map((e=>{this.root.setAttribute(`data-${e}`,this.currentText[e]||"")})),this.__remove(this._cids)),this._cids=[],this._gid=-1,this._cid=-1,this._curTexts=[];const t=this._getPlayerCurrentTime();t&&("live"===this.config.updateMode?this._liveUpdate(t):this._update(t))}__loadAll(){this.textTrack.forEach((e=>{this._loadTrack(e)}))}getDelCid(e,t){const n=[];for(let r=0;r-1&&(t=M(e,this.currentText.list[n].list,this._cid)),this.__removeByTime(this._curTexts,e),this._log("_liveUpdate",e,n,t,this.currentText.list[0].list[0].start,this.currentText.list[0].list[0].end),t.length>0){const e=function(e,t,n){if(0===e.length||t<0||t>e.length-1)return[];const r=e[t].list;if(0===n.length)return[];const i=r.splice(n[0],n.length);return t>0&&e.splice(0,t),0===r.length&&e.splice(0,1),i}(this.currentText.list,n,t),r=this._curTexts.length,i=r>0?this._curTexts[r-1].index:0;e.forEach(((e,t)=>{e.index=t+i,this._curTexts.push(e)})),this.__render(e)}this.emit(d,this.getUpdateData(this._curTexts,0,this.currentText))}_update(e){if(!this.currentText||!this.currentText.list||!this.currentText.list.length)return;const t=P(e,this.currentText.list,this._gid);let n=[];if(t>-1&&(n=M(e,this.currentText.list[t].list,this._cid)),this._log("update1",`currentTime:${e}`,t,this._gid,n,this._cids,this._cids.join(",")===n.join(","),t===this._gid),n.length<1)return this._cids.length>0&&this.config.domRender&&this.__remove(this._cids),this._cids=[],this._curTexts.length>0&&this.emit(d,this.getUpdateData([],e,this.currentText)),void(this._curTexts=[]);if(this._cids.join("")===n.join("")&&t===this._gid)return;this._gid=t,this._cid=n[0];const r=this.getDelCid(this._cids,n),i=this.getNewCid(this._cids,n);this._cids=n,this.config.domRender&&this.__remove(r);const o=[];i.map((e=>{const n=this.currentText.list[t].list[e];n.index=e,o.push(n)})),this.currentExtText&&i.map((e=>{const n=this.currentText.list[t].list[e];n.index=e,o.push(n)})),this._log("update",`currentTime:${e}`,o.length>0?`start:${o[0].start} end:${o[0].end}`:"",`delCids:${r.length} newCids:${i.length}`),this._curTexts=o,this.emit(d,this.getUpdateData(o,e,this.currentText)),this.__render(o,e)}getUpdateData(e,t,n){const{id:r,language:i}=n;return{type:d,currentTime:0|t,id:r,language:i,texts:e,isOpen:this._isOpen}}_getPlayerCurrentTime(){if(!this.player)return 0;const{currentTime:e}=this.player;return parseInt(1e3*e+1e3*this.seiTime-1e3*this.lastSeiTime,10)/1e3}_onSubtitlePlaylist(e){this._log("_onSubtitlePlaylist",e);const t=e.map((e=>({label:e.name,language:e.lang,id:e.id,isDefault:e.default,url:[],mUrl:e.url})));this.setSubTitles(t)}_onSubtitleSegment(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)return;const t={language:e[0].lang,url:e.map((e=>({id:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end})))};R(t,this.currentText)&&this.updateSubTitle(t)}_onCoreSeiintime(e){try{const 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{}}resize(e,t){const{baseSizeX:n,baseSizeY:r,minMobileSize:i,minSize:o,fitVideo:s,offsetBottom:a}=this.config,{scale:l}=this._videoMeta;this._videoMeta.lwidth=e,this._videoMeta.lheight=t;let u,c=0;t/e*100>=l?(c=parseInt(l*e,10)/100,u=e):(c=t,u=parseInt(t/l*100,10)),this._videoMeta.vWidth=u,this._videoMeta.vHeight=c;let h=0,d=0;l>120?(h=r,d=parseInt(h*c/1080,10)):(h=n,d=parseInt(h*u/1920,10));const f=X?i:o;d=dh?h:d;const p={fontSize:d},g=parseInt((t-c)/2,10),m=parseInt((e-u)/2,10),v=parseInt(c*a,10)/100;this._videoMeta.vBottom=g,this._videoMeta.vLeft=m,this._videoMeta.marginBottom=v,s&&(p.bottom=g+v,p.left=p.right=m),Object.keys(p).map((e=>{this.root.style[e]=`${p[e]}px`})),this.emit("resize",{vLeft:m,vBottom:g,marginBottom:v,vWidth:u,vHeight:c,fontSize:d,scale:l})}__startResize(e){const t=e.getBoundingClientRect(),{_videoMeta:n}=this,{width:r,height:i}=t;if(this._iId&&(clearTimeout(this._iId),this._iId=null),r>0&&i>0&&(r!==n.lwidth||i!==n.lheight))this._iC=0,this.resize(r,i);else{if(this._iC>=5)return void(this._iC=0);this._iC++,this._iId=setTimeout((()=>{this.__startResize(e)}),50)}}__removeByTime(e,t){const n=[];for(let r=0;r>>>_renderByWords__remove",e);const t=this.innerRoot.children,n=[];for(let r=0;r{this.innerRoot.removeChild(e)}))}__render(e=[]){const{renderMode:t,domRender:n}=this.config;e.length>0&&n&&e.forEach((e=>{let n=`text-track-${this.config.line}`;e.text.forEach(((r,i)=>{i>0&&(n+=" text-track-deputy");const o={"data-start":e.start,"data-end":e.end,"data-index":e.index},s=b("xg-text-track-span","",o,n);if(this.innerRoot.appendChild(s),"step"===t){const t=b("xg-text-track-span","",o,`${n} text-track-space`);this.innerRoot.appendChild(t),t.innerHTML=r,window.setTimeout((()=>{this._renderByWords(s,i,e.start,e.end,r)}),600)}else s.innerHTML=r}))}))}_renderByWords(e,t,n,r,i){const o=document.createTextNode("");e.appendChild(o);const s=function(e){const t=e.split(""),n=[];let r=!1;for(let e=0;e=r)return;n>=a&&(a=n),l>300&&(l-=50);const u={dom:o,ids:t,wordList:s,interval:l/s.length,start:a,end:r,duration:l,lastTime:0};this._log(">>>>_renderByWords",l,u);const{_curRenderTask:c}=this;let h=-1;for(let e=0;e-1&&c.slice(h,1),c.push(u),this.startRender(-1)}stopRender(){this._renderIntervalId&&window.cancelAnimationFrame(this._renderIntervalId)}show(){var e,t;this.config.domRender&&(t="text-track-hide",(e=this.root)&&(e.classList?t.split(/\s+/g).forEach((t=>{e.classList.remove(t)})):y(e,t)&&t.split(/\s+/g).forEach((t=>{const n=new RegExp("(\\s|^)"+t+"(\\s|$)");if(e.className&&"object"==typeof e.className){const t=e.getAttribute("class")||"";e.setAttribute("class",t.replace(n," "))}else e.className=e.className.replace(n," ")}))))}hide(){this.config.domRender&&(_(this.root,"text-track-hide"),this.innerRoot.innerHTML="")}emit(e,t,...n){super.emit(e,t,...n)}on(e,t,...n){super.on(e,t,...n)}once(e,t,...n){super.once(e,t,...n)}off(e,t,...n){super.off(e,t,...n)}offAll(){super.removeAllListeners()}get marginBottom(){const{bottom:e,marginBottom:t}=this._videoMeta;return this.config.fitVideo?e+t:t}}var Q=n(16027),W=function(e){function t(){var e;(0,o.xs)(this,t);for(var n=arguments.length,r=new Array(n),i=0;i0?e.text[0]:"",textTag:e.textTag}}));e._updateCallback&&e._updateCallback(n[0]),e.emit("subtitle_update",n[0])}})),(0,o.n8)(e,"_onListReset",(function(t){e.updateList(t)})),e}return(0,o.B)(t,e),(0,o.j6)(t,[{key:"afterCreate",value:function(){this._initExtSubTitle(),this._updateCallback=null}},{key:"_initExtSubTitle",value:function(e){var t=this.config,n=t.list,i=t.style,o=t.isDefaultOpen,s=t.updateMode,a=t.renderMode;o&&e<0&&n.length>0&&(e=0,n[0].isDefault=!0);var l={subTitles:n,defaultOpen:o,updateMode:s,renderMode:a,debugger:this.config.debugger,domRender:!1};Object.keys(i).map((function(e){l[e]=i[e]}));var u=this.player.controls;!this.playerConfig.marginControls&&u&&u.root&&(this.on(r.Rj,this.onPlayerFocus),this.on(r.m_,this.onPlayerBlur));var c=this.player;c._subTitles?c._subTitles._isOpen&&(e=this.getSubTitleIndex(this.config.list,c._subTitles.currentText)):(c._subTitles=new K(l),c._subTitles.attachPlayer(this.player)),this.subTitles=c._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("update",this._onUpdate),this.subTitles.on("reset",this._onListReset),i.follow&&this.subTitles.root&&Q.Ay.addClass(this.subTitles.root,"follow-control")}},{key:"show",value:function(e){!this.config.list||this.config.list.length<1||Q.Ay.addClass(this.root,"show")}},{key:"getSubTitleIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{id:"",language:""},n=-1;return t&&(t.id||t.language)?(e.forEach((function(e,r){var i,o,s,a;i=e,o=t,s=Q.Ay.isNotNull(i.id)&&Q.Ay.isNotNull(o.id)&&i.id===o.id,a=Q.Ay.isNotNull(i.language)&&Q.Ay.isNotNull(o.language)&&i.language===o.language,(s||a)&&(n=r)})),n):n}},{key:"updateSubtitles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e&&("String"===Q.Ay.typeOf(e)&&(e=[{id:parseInt(100*Math.random()),isDefault:!0,url:e}]),t&&(this._updateCallback=t),this.updateList({list:e}),this.subTitles&&this.subTitles.setSubTitles(this.config.list,this.curIndex>-1,n))}},{key:"updateList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.list){var t=[];e.list.forEach((function(e){t.push(e)}));var n=function(e){var t=-1;return e.forEach((function(e,n){e.id||e.language||(e.id=n),e.id=String(e.id),!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||!1),(e.isDefault||e.default)&&(t<0?t=n:e.isDefault=e.default=!1)})),t}(t);e.isOpen?(this.curIndex=n,this.curItem=n>-1?t[n]:null):(this.curIndex=-1,this.curItem=null),this.config.list=t,0===t.length&&this.switchOffSubtitle()}}},{key:"switchSubTitle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};this.getSubTitleIndex(this.config.list,e)<0||this.subTitles.switch(e).catch((function(e){}))}},{key:"switchOffSubtitle",value:function(e){this.emit("subtitle_change",{off:!0,isListUpdate:!1,list:[]}),this.lastIndex=this.curIndex,this.curIndex=-1,this.curItem=null,this.switchIconState(!1)}},{key:"switchOnSubtitle",value:function(){var e=this.config.list[this.lastIndex>-1?this.lastIndex:0];this.switchIconState(!0),this.switchSubTitle(e)}},{key:"destroy",value:function(){this.subTitles&&(this.subTitles.destroy(),this.subTitles=null),(0,o.hz)(t,"destroy",this,3)([])}}],[{key:"pluginName",get:function(){return"texttrack"}},{key:"defaultConfig",get:function(){return{index:6,list:[],isDefaultOpen:!0,style:{follow:!0,mode:"stroke",followBottom:50,fitVideo:!0,offsetBottom:2,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,line:"double",fontColor:"#fff"},closeText:{text:"不开启",iconText:"字幕"},needCloseText:!0,className:"xgplayer-texttrack",hidePortrait:!1,isShowIcon:!0,renderMode:"normal",mode:"external",debugger:!1}}}])}(n(77203).Ay),q=n(59066),Y=n(8267),J=n(90170),Z=n(74062),ee=n(40048),te=n(47620),ne=n(23237),re=n(4975),ie=n(95053),oe=Object.defineProperty,se=(e,t,n)=>((e,t,n)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class ae extends Z.C{constructor(){super(),se(this,"_proxyEvent",(e=>"playCatch"==e?(t,n)=>{this.trigger(e,{vtype:t,error:n})}:"prf_data_size"==e?e=>{this.trigger("downloaderChunkReady",{chunkSize:e.cdn_size,speed:e.cdn_speed})}:"PRELOAD_INFO"==e?e=>{this.trigger("preloaderInfoReady",{size:e.byteLength,duration:e.duration,type:e.type,vid:e.vid})}:t=>{this.trigger(e,t)})),this.currentPlayer=null,this.rawEvents=["loadstart","loadeddata","timeupdate","error","canplay","canplaythrough","volumechange","pause","playing","waiting","ended","seeking","seeked","stalled","abort","play","progress","downloaderError","downloaderChunkReady","memoryCompleted","playCatch","prf_data_size","PRELOAD_INFO","preloaderInfoReady","source_error","source_success"],this.extensionEvents=["autoplayPrevented"],this._callbacks=[],this.events=this.rawEvents.concat(this.extensionEvents)}set player(e){this.remove(),this.currentPlayer=e,this.bind()}remove(){this.currentPlayer&&this._callbacks.forEach(((e,t)=>{e()}))}bind(){this.currentPlayer&&(this.rawEvents.forEach(((e,t)=>{const n=this._proxyEvent(e);this.currentPlayer.bindEvent&&this.currentPlayer.bindEvent(e,n),this.currentPlayer.on&&this.currentPlayer.on(e,n),this._callbacks.push((()=>{this.currentPlayer.removeEvent&&this.currentPlayer.removeEvent(e,n),this.currentPlayer.off&&this.currentPlayer.off(e,n)}))})),this.extensionEvents.forEach(((e,t)=>{const n=this._proxyEvent(e);this.currentPlayer.proxyOn&&this.currentPlayer.proxyOn(e,n),this._callbacks.push((()=>{this.currentPlayer.proxyOff&&this.currentPlayer.proxyOff(e,n)}))})))}}class le extends Z.C{constructor(e){super(),this.autoplay=!0,this.muted=!1,this.preload="auto",this.id="",this.codec="",this.resolution="",this.bandwidth=0,this.cpu=0,this.memory=0,this.userAgent="",this.bitrate=0,this.networkType=""}set extraVideoInfo(e){e&&(e.codec&&(this.codec=e.codec),e.resolution&&(this.resolution=e.resolution),e.id&&(this.id=e.id),e.bitrate&&(this.bitrate=e.bitrate))}}class ue{constructor(){se(this,"addChunk",(e=>{this.chunks.push(e),this.chunks.length>=this.limit&&this.chunks.shift()})),se(this,"release",(()=>{this.chunks=[]})),this.chunks=[],this.limit=6,this.lastAverageSpeed=0}get averageSpeed(){let e=0,t=0;for(const n of this.chunks)n.size>0&&n.duration>0&&(e+=n.size,t+=n.duration);return t>0&&(this.lastAverageSpeed=8*e/1024/1024/t),this.lastAverageSpeed}}class ce extends Z.C{constructor(e){super(),this.device=e,this.speedMeasurement=new ue}inputChunkInfo(e,t){this.speedMeasurement.addChunk(e,t)}get averageSpeed(){return this.speedMeasurement.averageSpeed}get baseSpeed(){return this.device?this.device.bandwidth:0}get speed(){return this.averageSpeed?this.averageSpeed:this.baseSpeed}}let he=0;class de extends Z.C{static get UUIDIndex(){return he++,he}static set UUIDIndex(e){he=e}static generateUUID(e){return e+"_Multimedia_"+de.UUIDIndex}constructor(e="RAW",t){super(),this.uuid=de.generateUUID(e),this.type=e,this.element=null,this.player=null,this.forceAutoplay=!1,this.attemptPlayCount=0,this.vqscore=0,this.mvmaf="",this.events=["autoplayPrevented"],this.state=t||te.R.ACTIVE}style(e,t){this.element&&(this.element.style[e]=t)}set volume(e){this.element&&(this.element.volume=e)}set muted(e){this.element&&(this.element.muted=e)}set playbackRate(e){this.element&&(this.element.playbackRate=e)}get currentTime(){return this.element?this.element.currentTime:0}get duration(){return this.element?this.element.duration:0}get width(){return this.element?this.element.videoWidth:0}get height(){return this.element?this.element.videoHeight:0}get error(){return this.element?this.element.error:null}get attributes(){const{element:e}=this;return{error:(null==e?void 0:e.error)||null,src:(null==e?void 0:e.currentSrc)||"",currentTime:(null==e?void 0:e.currentTime)||0,muted:!(null==e||!e.muted),duration:(null==e?void 0:e.duration)||0,readyState:(null==e?void 0:e.readyState)||0,networkState:(null==e?void 0:e.networkState)||0,buffered:null==e?void 0:e.buffered,volume:(null==e?void 0:e.volume)||1,ended:!(null==e||!e.ended),paused:!(null==e||!e.paused),seeking:!(null==e||!e.seeking),currentSrc:(null==e?void 0:e.currentSrc)||""}}get isReady(){return!!this.element&&this.element.readyState>=2}get curDefinition(){return{url:"",definition:"",bitrate:-1,duration:-1,codecType:"h264"}}get playbackQuality(){return this.element?this.element.getVideoPlaybackQuality():null}proxyOn(e,t){return super.on(e,t)}proxyOff(e,t){return super.off(e,t)}updateConfig(e){}on(e,t){this.element&&this.element.addEventListener(e,t)}off(e,t){this.element&&this.element.removeEventListener(e,t)}once(e,t){}mute(e){this.element&&(this.element.muted=e)}access(){if(this.element)return this.play().then((()=>{this.pause()}))}load(e){if(!this.element)return;let t="";t=e instanceof Array?e.length>0?e[0].src:"":e,this.element.src=t}seek(e){this.element&&(this.element.currentTime=e)}play(){return this.element?this.element.play():Promise.resolve()}replay(){return this.seek(0),this.play()}pause(){this.element&&this.element.pause()}buffered(){if(this.element)return this.element.buffered}reset(){}release(e){this.attemptPlayCount=0}addSubtitle(e,t){}async enterFullscreen(e){this.element&&(this.element.requestFullscreen?this.element.requestFullscreen():this.element.mozRequestFullScreen?this.element.mozRequestFullScreen():this.element.webkitRequestFullscreen?this.element.webkitRequestFullscreen():this.element.msRequestFullscreen?this.element.msRequestFullscreen():this.element.webkitEnterFullscreen&&this.element.webkitEnterFullscreen())}async exitFullscreen(e){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.webkitExitFullscreen?window.document.webkitExitFullscreen():window.document.msExitFullscreen?window.document.msExitFullscreen():this.element&&this.element.webkitExitFullScreen&&this.element.webkitExitFullScreen()}tryPlay(e){window.setTimeout((()=>{this.attemptPlayCount>=3||(!e.message.match("request was interrupted by a new load request")&&!e.message.match("The operation was aborted")&&this.trigger("autoplayPrevented",e),(e.message.match("failed because the user didn't interact with the document first.")||e.message.match("The request is not allowed by the user agent or the platform in the current context")||e.message.match("The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."))&&this.mute(!0),this.play(),this.attemptPlayCount+=1)}),0)}initStyle(){this.element&&(this.element.style.width="100%",this.element.style.height="100%",this.element.style.position="absolute",this.element.style.top="0",this.element.style.left="0",this.element.style["::-webkit-media-controls-enclosure"]={display:"none !important"})}initProperty(){this.element&&(this.element.controls=!1,this.element.loop=!1,this.element.muted=!1,this.element.playsInline=!0,this.element.poster="",this.element.preload="auto")}getVideoDesc(){return{videoType:"mp4"}}preloadResources(e){}updatePreloadCodec(e){}updatePreloadConfig(e){}getPreloadMeta(e){return null}changeState(e){this.state=e}}class fe extends de{constructor(e){super("TT"),this._init(e)}_init(e){this.player=new J.StreamPlayer({withCredentials:!0}),this.player.on("DOWNLOADER_ERROR",(e=>{})),this.player.on("DOWNLOADER_CHUNK_READY",(e=>{})),this.element=this.player.element,this.initStyle(),this.initProperty()}_initLoggerBefore(){}play(){return new Promise(((e,t)=>{this.player.play().then((()=>{e()})).catch((e=>{this.forceAutoplay&&this.tryPlay(e)}))}))}pause(){this.player.pause()}load(e){this.player.load(e)}release(e){super.release(e),this.player.release()}reset(){this.pause(),this.seek(0)}on(e,t){this.player.on(e,t)}off(e,t){this.player.off(e,t)}once(e,t){const n=r=>{t(r),this.player.off(e,n)};this.player.on(e,n)}addSubtitle(e,t){this.player.addSubtitle(e,t)}get isReady(){return this.player.isReady}get playbackQuality(){return this.player?this.player.getQualityInfo():super.playbackQuality}}const pe="h264",ge="h265";class me{constructor(e){this.selectorName="base",this.config={}}select(e,t=0,n,r){return null}}function ve(e,t,n){const r=n.filter((n=>{if(e===n.vtype&&n.codecType===t)return n}));return r.sort(((e,t)=>e.bitrate-t.bitrate)),r}class ye extends me{constructor(e){super(e),this.selectorName="default",this.config={...e}}getMP4H264List(e){return ve("MP4",pe,e)}select(e,t=0,n,r){const{quality:i,hevcQuality:o}=n||this.config,{codecType:s,vtype:a}=r||{codecType:pe,vtype:"MP4"},l=ve(a,s,e),u=this.getMP4H264List(e),c=s===ge?o:i;let h=null;return l.length>0?(h=l.find((e=>e.qualityType===c)),h||(h=l[0])):(h=u.find((e=>e.qualityType===i)),h||(h=u.length>0?u[0]:null)),h}}const _e=new class{constructor(){this.defaultSelector="default";this._selectors={default:new ye({quality:20,hevcQuality:28,minBitrate:0,maxBitrate:0,defaultVtype:"MP4",defaultCodecType:"h264"})},this.config={quality:20,hevcQuality:28,minBitrate:0,maxBitrate:0,defaultVtype:"MP4",defaultCodecType:"h264"}}updateConfig(e){const t=this.getSelector(this.defaultSelector);Object.keys(e).forEach((n=>{this.config[n]=e[n],t&&(t.config[n]=e[n])}))}addSelector(e,t,n){this._selectors[e]=new t(n||{})}getSelector(e){let t=this._selectors[e];return t||(t=this._selectors[this.defaultSelector]||this._selectors.defalut),t}select(e,t,n,r={selector:"defalut"}){const{selector:i=this.defaultSelector,config:o}=r,{defaultVtype:s,defaultCodecType:a}=this.config;return this.getSelector(i).select(e,0,o,{codecType:t||a,vtype:n||s})}},Te={preloadTime:10,segmentMinDuration:10,preloadCacheType:1,preloadMaxCacheCount:5,minBufferLength:10},be="[MultiMediaPreloader]",Se=new class{constructor(){this.maxQueueCount=3,typeof window>"u"?this.preloader=null:(this.preloader=Y.y5.registerPreloader({...Te}),Y.y5.BitRateAdapter=_e)}update(e){var t;(0,ne.l)(be,"update",e),null==(t=this.preloader)||t.update(e)}changeCodec(e){if(this.preloader){const t=this.preloader.codecType;if((0,ne.l)(be,"changeCodec",t,e),t===ge&&e===pe){const{allCachedKeys:e}=this.preloader;for(const t in e)t.includes(ge)&&this.preloader.removeItem(t,(e=>{(0,ne.l)("[changeCodec] remove success",t,e)}))}this.preloader.codecType=e}}attachPlayer(e){var t;null==(t=this.preloader)||t.attachPlayer(e)}detachPlayer(){var e;null==(e=this.preloader)||e.detachPlayer()}addPreloadList(e){return this.preloader?this.preloader.addPreloaderList(e):[]}clearTask(){var e;null==(e=this.preloader)||e.clearTask()}getPreloadMeta(e){return this.preloader&&this.preloader.getPreloadMetaByVid(e)||null}addPlayingVid(e){var t;null==(t=this.preloader)||t.addPlayingVid(e)}getPlayingVid(){return this.preloader?this.preloader.playingVids1:[]}removePlayingVid(e){var t;null==(t=this.preloader)||t.removePlayingVid(e)}};function ke(e){const{H264DefinitionList:t,h264DefinitionList:n}=e.config,r=n||t;if(r&&r.length>0){const t=r[0];return e.emit("playCatch","MP4_3",{errorCode:8200,message:"width and height is 0"}),e.setConfig({defaultBitrate:t.bitrate,defaultDefinition:t.definition,url:t.url,codecType:t.codecType}),e.src=t.url,e.play(),!0}return!1}function Pe(){const{regionInfo:e}=ie.M,{shortData:t,deviceScore:n,gpuScoreData:r}=ie.M.getInstance().deviceMark;return{playMode:ie.M.playMode,tag:ie.M.pageName,subtag:ie.M.playMode,preTag:ie.M.prePageName,preSubtag:ie.M.prePlayMode,region:(null==e?void 0:e.region)||"",isLogin:!(null!=e&&e.isLogin),deviceScore:t,d_score:n||0,gpu:r.gpu||"",vendor:r.vendor||""}}function Me(e,t){const{minBuffer:n}=t;if(!e||!n)return!0;if(e&&e.length>0){const t=e.end(e.length-1);if((0,ne.c)(t)>=n)return!0}return!1}function Re(e,t=!0){return!e||e.length<1?-1:t?e.end(e.length-1):e.start(e.length-1)}function we(e){return e&&e.player?e.player.hasStart?1:0:-1}function xe(e){return e&&e.player?e.player.isPlaying?1:0:-1}function Ee(e){if(!e)return null;const t=Re(e.buffered());return{buff:t<0?t:(0,ne.c)(t),state:e.state,hasStart:we(e),playing:xe(e)}}const De="[XGplayer]";class Ie extends de{constructor(e,t){super("XG"),this._onAutoplayPrevent=()=>{var e;(0,ne.l)(De,this.uuid,"_onAutoplayPrevent",this.attemptPlayCount),!(this.attemptPlayCount>=3)&&this.forceAutoplay&&(this.mute(!0),null==(e=this.player)||e.play(),this.attemptPlayCount+=1)},this._onAutoplayStart=()=>{var e;(0,ne.l)(De,this.uuid,"onAutoplayStart"),null==(e=this.player)||e.off(r.q_,this._onAutoplayPrevent)},this._onLoadedData=()=>{const e=this.player;if(!e||!e.media)return;const{videoWidth:t,videoHeight:n}=e.media;0===t&&0===n&&(ie.a.focusDisableHevc({hevcMsg:"width and height is 0",hevcCode:2}),ke(e),this.updatePreloadCodec("h264")),e.off(r.eo,this._onLoadedData)},this.plugins=[],this.metrics=null,this.event=null,this.config={};const n=t||te.R.ACTIVE;this.state=n,this._init(e),this.changeState(n)}checkNeedMSE(e){var t;return!(0,ne.i)()&&Y.Ay.isMediaSourceSupported()&&!(null!=(t=null==e?void 0:e.extra)&&t.closeMSE)}getVideoMiddleware(){return{error:(e,t)=>{const{player:n}=e;if(n)try{const r=ke(n);n.setEventsMiddleware({error:null}),r||t("error",e)}catch{t("error",e)}t("error",e)}}}_getInitBitrate(e,t,n,r){r&&_e.updateConfig(r);const i=this.getPreloadMeta(t),o=function(e,t){return"h265"!==e||t&&"h265"!==t.codecType?"h264":"h265"}(n,i);if(e.length>0){const t=_e.select(e,o);let n=null;return"h265"===(null==t?void 0:t.codecType)&&(n=_e.select(e,"h264")),t?{...t,preloadCodec:(null==i?void 0:i.codecType)||null,preloadDefinition:(null==i?void 0:i.definition)||null,h264birate:n}:null}return null}_init(e){var t,n;const o={};e||(e={}),e.enableSubtitle&&this._initSubtitle(),e.enablePreloader&&e.preloader&&this._initPreloader(e.preloader),e.enableLogger&&e.logger&&this._initLoggerBefore(e.logger);const s=this.checkNeedMSE(e);s?this.plugins.push(Y.Ay):o.preload="auto";const{video:a,logger:l,extra:u}=e,c=void 0===(null==a?void 0:a.autoplay)||a.autoplay,h=void 0!==(null==a?void 0:a.muted)&&a.muted;h&&(o.muted=h),this.vqscore=(null==a?void 0:a.vqscore)||0;const d=(null==l?void 0:l.line_app_id)||0,f=(null==l?void 0:l.vid)||"",{actualUrl:p,url:g}=u||{actualUrl:void 0,url:""},m=(null==u?void 0:u.vid)||"",{bitrateList:v=[]}=e,y=(null==a?void 0:a.codecType)||"h264",{bitrateAdapter:_}=e,T=this._getInitBitrate(v,m,y,_);(0,ne.l)(De,this.uuid,"_init",`[${m}]`,"_getInitBitrate",`initCodec:${y} codecType:${null==T?void 0:T.codecType} preloadCodec:${null==T?void 0:T.preloadCodec} preloadDefinition:${null==T?void 0:T.preloadDefinition} defaultDefinition:${null==a?void 0:a.defaultDefinition} defaultBitrate:${null==a?void 0:a.defaultBitrate} definition:${null==T?void 0:T.definition} bitrate:${null==T?void 0:T.bitrate}`,null==T?void 0:T.url,null==T?void 0:T.h264birate,v);const b=(null==T?void 0:T.codecType)||y,S=(null==T?void 0:T.url)||p||g||"",k=null!=T&&T.h264birate?[null==T?void 0:T.h264birate]:(null==u?void 0:u.h264BitrateList)||[],P=(null==T?void 0:T.bitrate)||(null==a?void 0:a.defaultBitrate)||0,M=(null==T?void 0:T.definition)||(null==a?void 0:a.defaultDefinition)||"";if(this.mvmaf=(null==T?void 0:T.mvmaf)||(null==a?void 0:a.mvmaf)||"",this.config={vid:m,isNoRoot:!0,controls:!1,plugins:this.plugins,autoplay:c,codecType:b,width:"100%",height:"100%",videoConfig:o||{},volume:(null==a?void 0:a.volume)||1,playbackRate:(null==a?void 0:a.playbackRate)||1,H264DefinitionList:k,url:S,nullUrlStart:!S,ignores:(null==u?void 0:u.ignores)||[],defaultDefinition:M,defaultBitrate:P,duration:(null==a?void 0:a.duration)||0,videoInit:void 0===(null==u?void 0:u.videoInit)||u.videoInit,autoplayMuted:h},(0,ne.l)(De,"config",this.uuid,this.state,`videoInit:${this.config.videoInit}`,`addMSEPlugin:${s} closeMSE:${null==(t=e.extra)?void 0:t.closeMSE} needCheck:${null==(n=e.mp4EncryptPlayer)?void 0:n.needCheck}`),e.enableLogger){const{logger:t}=e,{ext:n={}}=t||{},r=ie.a.getHevcDisableInfo()||{},o={...Pe(),codec_type:b,decodeFlag:"h265"===b,defaultBitrate:P,defaultDefinition:M,line_app_id:d,vid:f,vtype:"MP4",...t,playerCoreVersion:Y.Ay.version,pv:i.Ay.version,strategyVersion:Z.v,ext:{...n,...r}};this.config.vodLogOpts=o}e.mp4EncryptPlayer&&(this.config.mp4EncryptPlayer=e.mp4EncryptPlayer),this.player=new i.Ay(this.config),this.player.uuid=this.uuid,(0,ne.l)(De,this.uuid,"PlayerInit",this.config),this.player.on(r.q_,this._onAutoplayPrevent),this.player.on(r.KH,this._onAutoplayStart),this.player.on(r.eo,this._onLoadedData),!s&&this.player.setEventsMiddleware(this.getVideoMiddleware()),this.player.preloader=Se.preloader,this.element=this.player.media,this.initStyle(),this.initProperty(),Se.addPlayingVid(m)}_initSubtitle(){this.plugins.push(W)}_initPreloader(e){q.DS.attachPreloader(Se.preloader),Se.update(e)}_initLoggerBefore(e){q.DS.AB_SDK_VERSION=ie.M.getAbVersions(),q.K.init(re.g,e.channelConfig,{region:e.region,user_unique_id:e.webId,user_is_login:e.isLogin}),this.plugins.push(q.Ay)}set volume(e){this.player&&(this.player.volume=e||1)}set muted(e){this.player&&(this.player.muted=e)}set playbackRate(e){this.player&&(this.player.playbackRate=e)}get currentTime(){var e;return null==(e=this.player)?void 0:e.currentTime}get duration(){var e;return(null==(e=this.player)?void 0:e.duration)||0}get attributes(){const{element:e,player:t}=this,n=(null==t?void 0:t.rawSrc)||(null==e?void 0:e.currentSrc)||(null==e?void 0:e.src)||"";return{error:(null==e?void 0:e.error)||null,src:n,currentTime:(null==e?void 0:e.currentTime)||0,muted:!(null==e||!e.muted),duration:(null==e?void 0:e.duration)||0,readyState:(null==e?void 0:e.readyState)||0,networkState:(null==e?void 0:e.networkState)||0,buffered:null==e?void 0:e.buffered,volume:(null==e?void 0:e.volume)||1,ended:!(null==e||!e.ended),paused:!(null==e||!e.paused),seeking:!(null==e||!e.seeking),currentSrc:n}}get isReady(){var e;return(null==(e=this.player)?void 0:e.isCanplay)||!1}get volume(){var e;return(null==(e=this.player)?void 0:e.volume)||1}get muted(){var e;return(null==(e=this.player)?void 0:e.muted)||!1}get playbackRate(){var e;return(null==(e=this.player)?void 0:e.playbackRate)||1}get curDefinition(){var e;const t=(null==(e=this.player)?void 0:e.curDefinition)||null,{config:n}=this;return{url:(null==t?void 0:t.url)||"",bitrate:(null==t?void 0:t.bitrate)||n.defaultBitrate||-1,definition:(null==t?void 0:t.definition)||n.defaultDefinition,codecType:(null==t?void 0:t.codecType)||n.codecType||-1,duration:this.duration||0}}on(e,t,...n){var r;null==(r=this.player)||r.on(e,t,...n)}off(e,t){var n;null==(n=this.player)||n.off(e,t)}once(e,t){var n;null==(n=this.player)||n.once(e,t)}load(e){var t;null==(t=this.player)||t.playNext({url:e})}seek(e){this.player&&(this.player.currentTime=e)}play(){return(0,ne.l)(De,this.uuid,"play"),new Promise(((e,t)=>{this.player||t();const n=this.player.play();n||e(),n.then((()=>{e()})).catch((()=>{}))}))}pause(){return(0,ne.l)(De,this.uuid,"pause"),this.player.config.autoplay=!1,this.player.pause()}release(e){const{vid:t}=this.config;Se.removePlayingVid(t),super.release(e);const n=this.player;n.off(r.q_,this._onAutoplayPrevent),n.off(r.KH,this._onAutoplayStart),n.off(r.eo,this._onLoadedData),e||n.destroy()}reset(){}replay(){return this.player.replay()}addSubtitle(e,t){const n=this.player;!this.player||!n.plugins||!n.plugins.texttrack||n.plugins.texttrack.updateSubtitles(e,(e=>{t(e.text)}))}getVideoDesc(){return this.player?{videoType:this.player.vtype}:super.getVideoDesc()}preloadResources(e){Se&&(Se.clearTask(),Se.addPreloadList(e))}updatePreloadConfig(e){Se.update(e)}updatePreloadCodec(e){Se.changeCodec(e)}updateConfig(e){this.player.setConfig({mp4encryptplayerConfig:{reqOptions:e}})}changeState(e){if(this.state=e,!this.player)return;const t=this.player,{mp4encryptplayer:n}=t.plugins;e===te.R.ACTIVE?(Se.attachPlayer(t),n&&(n.isActive=!0)):n&&(n.isActive=!1),(0,ne.l)(De,"changeState",this.uuid,e===te.R.ACTIVE,e,t.isUserActive),t.emit("renderStateChange",{state:e})}getPreloadMeta(e){return Se.getPreloadMeta(e)}async enterFullscreen(e){await this.player.getFullscreen(e)}async exitFullscreen(e){await this.player.exitFullscreen(e)}}class Ce extends de{constructor(e){super("RAW"),this._init(e)}_init(e){this.player=new J.BasicPlayer({withCredentials:!0}),this.element=this.player.el,this.initStyle(),this.initProperty(),e&&(e.enablePreloader&&this._initPreloader(e.preloader),e.enableLogger&&this._initLoggerAfter(e),e.video&&(e.video.mvmaf&&(this.mvmaf=e.video.mvmaf),e.video.vqscore&&(this.vqscore=e.video.vqscore))),Se.attachPlayer(this.element),e&&e.extra&&e.extra.url&&this.load(e.extra.url)}_initPreloader(e){const{preloader:t}=Se;q.DS.attachPreloader(t),Se.update(e)}_initLoggerAfter(e){let t=0,n=0,r="",i="",o="",s="h264",a=0,l="",u="",c={},h="",d="",f=!1;e.logger&&(e.logger.line_app_id&&(n=e.logger.line_app_id),e.logger.appId&&(t=e.logger.appId),e.logger.playMode&&(r=e.logger.playMode),e.logger.tag&&(i=e.logger.tag),e.logger.vid&&(o=e.logger.vid),e.logger.abTestVersion&&(u=e.logger.abTestVersion),e.logger.channelConfig&&(c=e.logger.channelConfig),e.logger.region&&(h=e.logger.region),e.logger.webId&&(d=e.logger.webId),e.logger.isLogin&&(f=e.logger.isLogin)),e.video&&(e.video.codecType&&(s=e.video.codecType),e.video.defaultBitrate&&(a=e.video.defaultBitrate),e.video.defaultDefinition&&(l=e.video.defaultDefinition));let p={codec_type:s,decodeFlag:"h265"===s,defaultBitrate:a,defaultDefinition:l,line_app_id:n,playMode:r,playerCoreVersion:Y.Ay.version,pv:"",strategyVersion:Z.v,tag:i,vid:o,vtype:"MP4"};q.K.appId=t,q.DS.AB_SDK_VERSION=u,q.K.init(re.g,c,{region:h,user_unique_id:d,user_is_login:f});const g=new q.DS(p);this.player.logger=g,g.attachPlayer(this.element),Se.addPlayingVid(o)}play(){return new Promise(((e,t)=>{this.player.play().then((()=>{e()})).catch((e=>{this.forceAutoplay&&this.tryPlay(e)}))}))}pause(){this.player.pause()}load(e){this.player.load(e)}release(e){super.release(e),this.player.release()}reset(){this.pause(),this.seek(0)}on(e,t){this.player.on(e,t)}off(e,t){this.player.off(e,t)}once(e,t){const n=r=>{t(r),this.player.off(e,n)};this.player.on(e,n)}addSubtitle(e,t){this.player.addSubtitle(e,t)}preloadResources(e){const{closePreload:t}=this.hevcResult;Se&&!t&&(Se.clearTask(),Se.addPreloadList(e))}updatePreloadConfig(e){Se.update(e)}updatePreloadCodec(e){Se.changeCodec(e)}get isReady(){return this.player.isReady}get playbackQuality(){return this.player?this.player.getQualityInfo():super.playbackQuality}}var Le=(e=>(e.XG="XG",e.TT="TT",e.RAW="RAW",e))(Le||{});class Oe extends Z.C{constructor(e,t){super(),se(this,"onPlayCatch",((e,t)=>{if((0,ne.l)("_onPlayCatch",e,t),!t)return;const{message:n="",errorCode:r}=t;n.includes("is unsupported")&&ie.a.focusDisableHevc({hevcCode:r||1,hevcMsg:n})})),se(this,"onceCanplay",(()=>{const{isTTP:e}=ie.M.getInstance();null!==e&&ie.b.asyncMark(e)})),se(this,"release",((e=!1)=>{this.currentPlayer&&(this.currentPlayer.off("canplay",this.onceCanplay),this.currentPlayer.release(e))})),this.event=e,this.device=t,this.currentPlayer=null}static get version(){return Z.v}static setCustomTracker(e){q.DS.setCustomTracker(e)}usePlayer(e,t,n=!1){return this.release(n),this.currentPlayer&&n||(t?e==Le.XG?(this.currentPlayer=new Ie(t),this.currentPlayer.player.on("playCatch",this.onPlayCatch)):this.device&&this.device.isMSESupported?e==Le.TT?this.currentPlayer=new fe(t):e==Le.RAW&&(this.currentPlayer=new Ce(t)):this.currentPlayer=new Ce(t):this.currentPlayer=new Ce(t),this.event.player=this.currentPlayer,this.currentPlayer.once("canplay",this.onceCanplay)),this.currentPlayer}get attributes(){return this.currentPlayer&&this.currentPlayer.element?{error:this.currentPlayer.element.error,src:this.currentPlayer.element.currentSrc,currentTime:this.currentPlayer.element.currentTime,muted:this.currentPlayer.element.muted,duration:this.currentPlayer.element.duration,readyState:this.currentPlayer.element.readyState,networkState:this.currentPlayer.element.networkState,buffered:this.currentPlayer.element.buffered,volume:this.currentPlayer.element.volume,ended:this.currentPlayer.element.ended,paused:this.currentPlayer.element.paused,seeking:this.currentPlayer.element.seeking}:null}get element(){return this.currentPlayer?this.currentPlayer.element:null}}class Ae extends Z.C{static get version(){return Z.v}constructor(){super(),this.config=new le,this.event=new ae,this.device=new ee.A,this.network=new ce(this.device),this.metrics=new te.M(this.event,this.config),this.pool=new Oe(this.event,this.device)}_initConfig(){this.config=new le}_initEvent(){this.event=new ae}_initDevice(){this.device=new ee.A}_initNetwork(){this.network=new ce(this.device)}_initMetrics(){this.metrics=new te.M(this.event,this.config)}_initPlayerPool(){this.pool=new Oe(this.event,this.device)}set player(e){this.event.player=e,this.metrics.player=e,this.pool.currentPlayer=e}get player(){return this.pool.currentPlayer}get attributes(){return this.pool.attributes}get element(){return this.pool.element}setCustomTracker(e){Oe.setCustomTracker(e)}usePlayer(e,t,n){const r=this.pool.usePlayer(e,t,n);return this.metrics.player=r,r}release(e){this.pool.release(e)}getPreloadMeta(e){return this.player&&this.player.preloader?this.player.getPreloadMeta(e):null}}class Ge{constructor(){this._eventemitter=new s}on(e,t,...n){this._eventemitter.on(e,t,...n)}once(e,t,...n){this._eventemitter.once(e,t,...n)}off(e,t,...n){this._eventemitter.off(e,t,...n)}emit(e,t,...n){this._eventemitter.emit(e,t,...n)}offAll(){this._eventemitter.removeAllListeners()}clear(){this._eventemitter.removeAllListeners()}}const $e="[MultiplePlayerPool]";class Be extends Ge{constructor(e){super(),this._onAutoplayPrevent=()=>{var e;(0,ne.l)($e,null==(e=this.currentPlayer)?void 0:e.uuid,"_onAutoplayPrevent"),this.autoplayPrevent=!0},this._onAutoplayStart=()=>{var e,t,n,r,i;(0,ne.l)($e,null==(e=this.currentPlayer)?void 0:e.uuid,"_onAutoplayStart",null==(t=this.currentPlayer)?void 0:t.muted,null==(r=null==(n=this.currentPlayer)?void 0:n.element)?void 0:r.paused,null==(i=this.currentPlayer)?void 0:i.currentTime,(new Date).getTime()),this.autoplayPrevent=!1},this._onActiveLoadedData=()=>{const{currentPlayer:e,currentProps:t}=this;e&&(t.muted=e.muted,t.volume=e.volume,this.checkLoadBackUpInstance("onActiveLoadedData"))},this._onActiveProgress=()=>{this.checkLoadBackUpInstance("onActiveProgress")},this._onVolumechange=()=>{var e;if((0,ne.l)($e,null==(e=this.currentPlayer)?void 0:e.uuid,"_onVolumechange"),!this.currentPlayer)return;const{currentPlayer:t,currentProps:n}=this;n.muted=t.muted,n.volume=t.volume},this._onRatechange=()=>{var e;if((0,ne.l)($e,null==(e=this.currentPlayer)?void 0:e.uuid,"_onRatechange"),!this.currentPlayer)return;const{currentPlayer:t,currentProps:n}=this;n.playbackRate=t.playbackRate},this._onPlayCatch=(e,t)=>{var n;if((0,ne.l)($e,null==(n=this.currentPlayer)?void 0:n.uuid,"_onPlayCatch",e,t),!t)return;const{message:r="",errorCode:i,errorMessage:o=""}=t;(r||o).includes("is unsupported")&&ie.a.focusDisableHevc({hevcCode:i||1,hevcMsg:r})},this._onceCanplay=()=>{var e,t;const n=null==(e=this.currentPlayer)?void 0:e.buffered();(0,ne.l)($e,null==(t=this.currentPlayer)?void 0:t.uuid,"_onceCanplay",Re(n));const{isTTP:r}=ie.M.getInstance();null!==r&&ie.b.asyncMark(r||!1)},this._playerQueue=[],this.currentPlayer=null,this.prePlayers=[],this.currentProps={playbackRate:1,muted:!1,volume:1},this.autoplayPrevent=!1,this.config={enableReuse:!1,enableMultiple:!1,defaultMSE:!1,minBuffer:100,...e}}setCustomTracker(e){q.DS.setCustomTracker(e)}get device(){return ie.m}get version(){return Z.v}checkLoadBackUpInstance(e){var t,n,r;const i=null==(t=this.currentPlayer)?void 0:t.buffered(),o=Me(i,{minBuffer:this.config.minBuffer});if(o){const t=function(e){var t;for(let n=e.length-1;n>-1;n--)if(e[n].state===te.R.BACKUP&&(null==(t=e[n].player)||!t.hasStart))return e[n];return null}(this._playerQueue);if(t){const s=we(t);(0,ne.l)($e,null==(n=this.currentPlayer)?void 0:n.uuid,"checkLoadBackUpInstance",`${e} ifLoadInit:${o} hasStart:${s} end:${Re(i)}`),s<1&&(null==(r=t.player)||r.start())}}}_bindEvents(e){(0,ne.l)($e,"_bindEvents",e.uuid)}_unbindEvents(e){(0,ne.l)($e,"_unbindEvents",e.uuid)}_bindActiveEvents(e){e.on(r.BY,this._onActiveLoadedData),e.on(r.Gd,this._onActiveProgress),e.on(r.OC,this._onRatechange),e.on(r.Wu,this._onVolumechange),e.once(r.nQ,this._onceCanplay),e.on(r.q_,this._onAutoplayPrevent),e.on(r.KH,this._onAutoplayStart),e.on("playCatch",this._onPlayCatch)}_unbindActiveEvents(e){e.off(r.BY,this._onActiveLoadedData),e.off(r.Gd,this._onActiveProgress),e.off(r.OC,this._onRatechange),e.off(r.Wu,this._onVolumechange),e.off(r.nQ,this._onceCanplay),e.off(r.q_,this._onAutoplayPrevent),e.off(r.KH,this._onAutoplayStart),e.off("playCatch",this._onPlayCatch)}_activePlayer(e){var t;const{state:n}=e;n!==te.R.ACTIVE&&this._bindActiveEvents(e);const{currentProps:r}=this,i=Ee(e);(0,ne.l)($e,e.uuid,"_activePlayer",e.uuid,`preState:${n}`,i,r),e.mute(r.muted),e.volume=r.volume,e.playbackRate=r.playbackRate,e.forceAutoplay=!0,null==(t=e.metrics)||t.setStartInitInfo(i);const o=e.player;o&&(o.config.autoplay=!0),e.changeState(te.R.ACTIVE),e.play(),this.currentPlayer=e}_retainPlayer(e){(0,ne.l)($e,e.uuid,"_retainPlayer");const{state:t}=e;t===te.R.ACTIVE&&this._unbindActiveEvents(e),e.changeState(te.R.RETAIN),e.forceAutoplay=!1,e.pause(),e.seek(0)}getInstance(e,t){var n,r,i,o;let s=function(e,t){for(let n=0;n-1&&!r&&t.splice(n,1)}setConfig(e){Object.keys(e).forEach((t=>{this.config[t]=e[t]}))}mountDom(e,t){if(e&&t)try{if(!e.element)return;t.appendChild(e.element)}catch(e){console.error(e)}}unMountDom(e){var t;if(e)try{const{element:n}=e;if(!n)return;null==(t=null==n?void 0:n.parentElement)||t.removeChild(n)}catch(e){console.error(e)}}usePlayer(e,t){var n,r;const i=this.getInstance(e,t);return t===te.R.ACTIVE&&(null==(n=i.metrics)||n.setStartInitInfo(Ee(i)),this._bindActiveEvents(i),this.currentPlayer=i),(0,ne.l)($e,i.uuid,"usePlayer",i.state,t,null==(r=e.video)?void 0:r.autoplay),i}releasePlayer(e,t=!0){if(!e)return;this.unMountDom(e);const{enableReuse:n}=this.config,{state:r}=e;(0,ne.l)($e,null==e?void 0:e.uuid,"releasePlayer",r,t||!n),r===te.R.ACTIVE&&this._bindActiveEvents(e),e.changeState(te.R.RELEASE);const{metrics:i,event:o}=e;i&&(i.removeEvent(),i.player=null),o&&(o.player=null),this._unbindEvents(e),t||!n?(this.removeInstance(e,this._playerQueue),e.release(!1)):e.release(!0)}updatePlayer(e,t){const{state:n}=e,{enableReuse:r,enableMultiple:i}=this.config;if((0,ne.l)($e,e.uuid,"updatePlayer",n,t),n!==t&&i)switch(t){case te.R.RELEASE:this.releasePlayer(e,!r);break;case te.R.ACTIVE:this._activePlayer(e);break;case te.R.RETAIN:this._retainPlayer(e)}}callPlay(){(0,ne.l)($e,"callPlay",`autoplayPrevent:${this.autoplayPrevent}`),this.autoplayPrevent&&this._playerQueue.forEach((e=>{if(e.state===te.R.BACKUP){(0,ne.l)($e,"callPlay",e.uuid,`isPlaying:${xe(e)} hasStart:${we(e)}`);const t=()=>{var n;(0,ne.l)($e,e.uuid,"onAutoplayStart",e.muted,null==(n=e.element)?void 0:n.paused,e.currentTime,(new Date).getTime()),e.state===te.R.BACKUP&&e.pause(),e.off(r.KH,t)},n=()=>{var t;(0,ne.l)($e,e.uuid,"onTimeupdate",e.muted,null==(t=e.element)?void 0:t.paused,e.currentTime,(new Date).getTime()),e.off(r.yK,n)};e.on(r.KH,t),e.on(r.yK,n),e.play()}}))}getPreloadMeta(e){return Se.getPreloadMeta(e)}preloadResources(e){if(Se){Se.clearTask();const t=Se.addPreloadList(e);(0,ne.l)($e,"preloadResources",t)}}updatePreloadConfig(e){Se.update(e)}updatePreloadCodec(e){Se.changeCodec(e)}}const Ne="change",Fe="update",Ue="reset",He="error";class Ve{constructor(e){this.handlerEvent=e=>{e.type,this.emit("subtitle_event",e)},this.list=[],e.subTitlesList&&e.subTitlesList.forEach((e=>{this.list.push(e)})),this.player=null,this.xgSubtitle=new K({subTitles:this.list,domRender:!1,defaultOpen:e.defaultOpen,updateMode:e.updateMode||"vod",debugger:!!e.debugger,renderMode:"normal"}),this.bindEvent()}bindEvent(){this.on(Ne,this.handlerEvent),this.on("on",this.handlerEvent),this.on(Fe,this.handlerEvent),this.on(Ue,this.handlerEvent),this.on(He,this.handlerEvent)}unBindEvents(){this.off(Ne,this.handlerEvent),this.off(Fe,this.handlerEvent),this.off(Ue,this.handlerEvent),this.off(He,this.handlerEvent),this.off("on",this.handlerEvent)}attach(e){var t,n;null==(t=this.xgSubtitle)||t.detachPlayer(),null==(n=this.xgSubtitle)||n.attachPlayer(e)}detach(){var e;null==(e=this.xgSubtitle)||e.detachPlayer()}destroy(){var e;this.unBindEvents(),null==(e=this.xgSubtitle)||e.destroy(),this.xgSubtitle=null}switch(e){var t,n;if(e)return null==(n=this.xgSubtitle)?void 0:n.switch(e).catch((e=>{console.error("switch error",e)}));null==(t=this.xgSubtitle)||t.switchOff()}switchOff(){var e;return null==(e=this.xgSubtitle)?void 0:e.switchOff()}setSubTitles(e,t=!1){var n;const r=e.map((e=>({...e})));null==(n=this.xgSubtitle)||n.setSubTitles(r,t)}emit(e,t,...n){var r;null==(r=this.xgSubtitle)||r.emit(e,t,...n)}on(e,t,...n){var r;null==(r=this.xgSubtitle)||r.on(e,t,...n)}once(e,t,...n){var r;null==(r=this.xgSubtitle)||r.on(e,t,...n)}off(e,t,...n){var r;null==(r=this.xgSubtitle)||r.off(e,t,...n)}offAll(){var e;this.unBindEvents(),null==(e=this.xgSubtitle)||e.offAll()}}},74062:(e,t,n)=>{"use strict";n.d(t,{C:()=>r,v:()=>i});class r{constructor(){this._events=[],this._callbacks={}}register(e){this._events.includes(e)||this._events.push(e)}on(e,t){return!!this._events.includes(e)&&(this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),!0)}off(e,t){if(!this._events.includes(e))return!1;const n=this._callbacks[e].indexOf(t);return this._callbacks[e].splice(n,1),!0}bind(e,t){if(!this._events.includes(e))return!1;this._callbacks[e]=[],this._callbacks[e].push(t)}clear(e){this._callbacks[e]=[]}trigger(e,t){if(!this._callbacks[e]||!this._callbacks[e].length)return!1;let n=null;return this._callbacks[e].forEach(((e,r)=>{0==r?n=e(t):e(t)})),n}set events(e){e.forEach((e=>{this.register(e)}))}get events(){return this._events}}const i="0.2.6"},59066:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>Ke,DS:()=>Ve,K:()=>Xe});const r=typeof window<"u"&&window.location.href.indexOf("loggerdebug")>-1;function i(e,t,...n){r&&console.log(`[logger>${e}]`,t,...n)}function o(){return(new Date).getTime()}function s(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function a(e,t=2){const n=Math.pow(10,t);return Math.round(e*n)/n}function l(e){return parseInt((1e3*e).toFixed(0),10)}function u(e){return e&&e instanceof window.HTMLMediaElement}function c(e){if(!e||"string"!=typeof e)return"";const t=e.split("/");let n="";return t.length>3&&t[2]&&(n=t[2]),n}function h(e){try{return JSON.stringify(e)}catch{return""}}function d(e){return"string"==typeof e&&/^blob/.test(e)}function f(e){return null!=e&&e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(d(null==e?void 0:e.currentSrc)||d(null==e?void 0:e.src))}function p(e){return null==e}function g(e,t,n){return e>0&&t>0?t-e:0}const m={UN_KNOW:0,EXPIRED:1,NO_EXPIRED:2},v=[new RegExp("(\\?|&)expire=([^&]*)(&|$)"),new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),new RegExp("(\\?|&)x-expires=([^&]*)(&|$)")];function y(e){if(!e||"string"!=typeof e)return m.UN_KNOW;let t=m.UN_KNOW;try{const n=[];if(v.forEach((t=>{const r=e.match(t);r&&n.push(r)})),n.length>0)t=parseInt(n[0][2],10);else{const n=e.split("/");n.length>5&&8===n[4].length&&(t=parseInt(n[4],16))}if(t>0){const e=new Date;return t<=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),0)/1e3?m.EXPIRED:m.NO_EXPIRED}return m.UN_KNOW}catch{return m.UN_KNOW}}function _(e){try{return e.toString()}catch{return""}}function T(e,t){Object.keys(e).forEach((n=>{p(t[n])||(e[n]=t[n])}))}function b(e,t){return t[e]}const S="0.2.6",k=[{key:"QQBrowser",reg:/(qqbrowser)\/([\d.]+)/},{key:"2345Explorer",reg:/(2345explorer)\/([\d.]+)/},{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)/}],P=[{key:"Trident",reg:/(rv:)([\d.]+)/},{key:"Trident",reg:/(msie)\s*([\d.]+)/}],M=["Baiduspider","YandexBot"],R=!(typeof window>"u"),w={isIOS:!1,isAndroid:!1,isMobile:!1,isPC:!1,isPad:!1,isSpider:!1,isSupportMP4:!0,mime:"",name:"",appVersion:"",isChrome:!1,isSafari:!1};typeof navigator<"u"&&function(e){if(typeof navigator>"u")return e;const t=window.navigator.userAgent.toLocaleLowerCase(),n=/(iphone)/.test(t)||/(ipad)/.test(t),r=/(android)/.test(t),i=/(windows phone)/.test(t),o=n||r||i;e.isIOS=n,e.isAndroid=r,e.isPC=!o,e.isPad=/(ipad)/.test(t);const s=function(){const e={isSupport:!1,mime:""};if(typeof document>"u")return e;let t=document.createElement("video");return"function"==typeof t.canPlayType?(["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"].map((n=>{"probably"===(null==t?void 0:t.canPlayType(`video/mp4; codecs="${n}"`))&&(e.isSupport=!0,e.mime+=`||${n}`)})),e):(t=null,e)}();e.isSupportMP4=s.isSupport,e.mime=s.mime;let a="",l="",u=[],c=k;/trident/.test(t)&&(c=P);for(let e=0;e2?u[2]:"";break}a?(e[`is${a}`]=!0,e.name=a,e.appVersion=l):function(){const{mimeTypes:e}=navigator;if(e){for(let t=0;t-1||e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1||e[t].description&&e[t].description.indexOf("360")>-1)return!0;return!1}}()&&(e.name="360EE"),e.name&&"Trident"!==e.name&&/(trident)/.exec(t)&&(e.name=e.name?`${e.name}_Trident`:"Trident"),e.isSpider=function(e,t){let n=!1;return M.map((t=>{t===e&&(n=!0)})),/spider/.test(t)&&(n=!0),n}(e.name,t)}(w);const x=!(typeof navigator>"u"),E={sdk_version:S,pc:"",pv:"",sv:"",line_app_id:0,line_user_id:"",app_version:"",platform:w.isPad?"pad":w.isMobile?"mobile":"pc",cpu_core:0,memory_size:0,support:0,absdkVersion:"",d_score:-1,vendor:"",gpu:"",deviceScore:{},ua:""};let D="",I=0;function C(e){Object.keys(e).forEach((t=>{void 0!==e[t]&&("playerCoreVersion"===t?E.pc=e[t]:"playerVersion"===t?E.pv=e[t]:"appVersion"===t?E.app_version=e[t]:"strategyVersion"===t?E.sv=e[t]:void 0!==E[t]&&(E[t]=e[t]))}))}!function(){if(!x)return;const e=window.navigator,t=e&&e.hardwareConcurrency||0,n=e&&e.deviceMemory||0,r=e&&e.webdriver?1:0,o=e&&e.userAgent||"";E.cpu_core=t,E.memory_size=n,E.webdriver=r,E.ua=o,function(e){let t=w.isSupportMP4?1e4:0;t=typeof MediaSource>"u"||!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"'))?t:t+1e3,function(e){const t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||typeof navigator>"u")return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);{const n=e.video||{contentType:""},r=e.audio||{contentType:""};try{const e=MediaSource.isTypeSupported(n.contentType||""),t=MediaSource.isTypeSupported(r.contentType);return Promise.resolve({supported:e&&t,smooth:!1,powerEfficient:!1})}catch{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((n=>{n&&n.supported?t+=100:t+=10,e(t)})).catch((n=>{t+=1,e(t)}))}((e=>{E.support=e})),i("CommonData",E)}();const L="videoplayer_oneopera",O="videoplayer_oneevent",A="mdl_video_data_size",G="mdl_video_preload",$={videoplayer_oneplay:"play_session_events",mdl_video_preload:"mdl_video_preload"},B="unknown",N=6e4,F="playcatch",U="reset",H="page_unload";var V=(e=>(e.DEFAULT="default",e.ACTIVE="active",e.RETAIN="retain",e.RELEASE="release",e.BACKUP="backup",e))(V||{});function j(e,t){const n={startPos:0,endPos:0,include:0,diff:0,cur:t,start:-1,end:-1},r=e?e.length:0;if(r<1)return n;n.start=l(e.start(0)),n.end=l(e.end(r-1));let i=-1,o=-1;const s=l(t);for(let t=e.length-1;t>-1;t--){const r=l(e.start(t)),a=l(e.end(t));if(s>=r&&s<=a){n.include=1,n.startPos=r,n.endPos=a,n.diff=a-s;break}sa&&(i<0||s-ai&&tK[e])),o=Object.keys(Q).map((e=>Q[e]));(r?i:[...i,...o]).forEach((i=>{const{handler:o,evt:s}=function(e,t){let n;const r=`_on${e.charAt(0).toUpperCase()}${e.slice(1)}`;return n=t[r]?t[r]:t[W[e]],{evt:e,handler:n}}(i,t);if(o)if(r){const t=e;1===n?t.addEventListener(s,o):t.removeEventListener(s,o)}else{const t=e;1===n?t.on(s,o):t.off(s,o)}}))}const Y=[];function J(e,t,n){Y.push({id:e,name:t,handler:n})}function Z(e,t){let n=-1;for(let r=0;r-1&&Y.splice(n,1)}const ee="beforeunload",te="visibilitychange";function ne(e,t,...n){Y.forEach((r=>{const{name:i,handler:o}=r;i===e&&o(t,...n)}))}function re(e){return u(e)?e:(null==e?void 0:e.media)||(null==e?void 0:e.video)||(null==e?void 0:e.core)}function ie(e){return e.rawSrc||e.currentSrc||e.src}function oe(e){return se(e,["readyState","networkState"])}function se(e,t){const n=re(e);if(!n)return{};if(Array.isArray(t)){const e={};return t.forEach((t=>{e[t]=n[t]})),e}return n[t]}function ae(e){var t;return e?(e.vtype?e.vtype:(null==(t=e.config)?void 0:t.vtype)||"")||(e.dash?"DASH":""):""}function le(e){return e&&e.config&&e.config.codecType?e.config.codecType:""}function ue(e,t){let n=0;return e>0&&t>0&&eN?N:n):0}function ce(e,t){const n=Math.min(e,t);return n>0?n>2160?"8K":n>1792?"4K":n>1216?"2K":n>896?"1080P":n>640?"720P":n>512?"540P":n>416?"480P":n>288?"360P":"240P":B}function he(e){let t=0;for(const n of e)n.end<0||n.start>n.end||(t+=1e3*n.end-1e3*n.start);return Math.round(t)/1e3}typeof document<"u"&&(i("GLOBAL_EVENTS","bindGlobalEvents",w.isPC,w.isMobile,w.isPad),!(typeof document>"u")&&(w.isPC?window.addEventListener("beforeunload",(()=>{ne("beforeunload")})):(w.isMobile||w.isPad)&&window.addEventListener("pagehide",(()=>{ne("beforeunload")})),document.addEventListener("visibilitychange",(e=>{ne("visibilitychange",document.visibilityState)}))));const de="Operate";class fe{constructor(e){this.suspendCallback=e,this.init()}reset(){this.init()}init(){this.seekCount=0,this.sat=0,this.ops=[],this.seek=this.getOperaInfo("seeked"),this.latestSeek=null,this.firstSeek=null,this.latestSwitch=this.getOperaInfo("switch"),this.firstSwitch=null,this.pauseLog={start:-1,acuTime:0,totalCount:0}}getOperaInfo(e){return{op:e,stateBefore:-1,stateAfter:-1,start:0,end:0,pos:0,inBuffer:!1,intervalId:0,readyState:-1,networkState:-1}}pushOP(e){const{ops:t}=this;t.length>10&&t.splice(0,t.length-10),t.push(e)}clearTimer(){const{seek:e}=this;e.intervalId&&(clearTimeout(e.intervalId),e.intervalId=0)}startSeekTimeout(){const{seek:e}=this;this.clearTimer(),e.intervalId=setTimeout((()=>{e.start&&this.suspendSeek("timeout","timeout"),this.clearTimer()}),6e4)}startSeek(e,t){const{seek:n}=this;if(i(de,"startSeek",`start1: ${o()-n.start} start:${n.start} currentTime:${e.currentTime} pos:${n.pos}`,t),n.start&&o()-n.start>6e3&&this.suspendSeek("seeking","seeking"),n.start)return;n.start=o();const{readyState:r,networkState:s}=oe(e);n.pos=e.currentTime,n.stateBefore=t,n.inBuffer=X(e.buffered,e.currentTime,1),n.readyState=r,n.networkState=s,i(de,"startSeek",`start: ${o()-n.start} pos:${n.pos} inBuffer:${n.inBuffer}`,z(e.buffered)),this.seekCount++,this.startSeekTimeout()}suspendSeek(e,t){const{seek:n}=this;if(!n.start)return;const r=o()-n.start;i(de,"suspendSeek",`endType:${t} cost: ${r} inBuffer:${n.inBuffer}`);const{latestSeek:s}=this,a={costTime:r,stateBefore:n.stateBefore,stateAfter:e,start:n.start,end:o(),pos:n.pos,inBuffer:n.inBuffer,op:"seek",endType:t,interval:s?n.start-s.start:0,readyState:n.readyState,networkState:n.networkState};this.latestSeek=a,this.firstSeek||(this.firstSeek=a),this.pushOP(a),this.clearTimer(),n.start=0,n.intervalId=0,n.pos=0,n.inBuffer=!1,this.sat+=r,this.suspendCallback&&this.suspendCallback(L,this.latestSeek)}startPause(){const{pauseLog:e}=this;i(de,`endPause>pauseLog.start:${e.start}`),e.start<0&&(e.start=o(),e.totalCount++)}endPause(){const{pauseLog:e}=this;e.start>0&&(e.acuTime+=o()-e.start,e.start=-1,i(de,`endPause>pauseLog.acuTime:${e.acuTime}`))}}class pe{constructor(e){this._last=e,this._current=e,this._initVal=e}set initial(e){this._initVal=e}get current(){return this._current}set current(e){const{_current:t}=this;t!==e&&(this._last=this._current,this._current=e)}get last(){return this._last}reset(){this._current=this._initVal,this._last=this._initVal}}class ge{constructor(){this.reset()}reset(){this.t=0,this.visible=!1,this.fAcc=0,this.bAcc=0,this.acc=0,this.loopAcc=0}update(e,t){if(this.t){const e=o()-this.t;this.acc+=e,this.t=0,this.visible?this.fAcc+=e:this.bAcc+=e,t&&(this.loopAcc=this.acc)}}start(e){this.t||(i("ACC","startACC",e,this.t,this.visible),this.t=o())}getWatchDuration(e=0){switch(e){case 1:return this.fAcc;case 2:return this.bAcc;default:return this.acc}}}function me(){return{networkState:-1,readyState:-1,pos:-1,inBuffer:!1,start:0,end:0,startDiff:-1,endDiff:-1,rate:0,endType:B,costTime:0}}const ve="PlayPerformance";class ye{constructor(){this.switchPlayerTime=0,this._renderState=new pe(V.ACTIVE),this.init()}get isActive(){const{current:e}=this._renderState;return e===V.ACTIVE||e===V.DEFAULT}get renderState(){return this._renderState.current}get preRenderState(){return this._renderState.last}init(){this.isMSE=!1,this.loadState=0,this.playbackState=0,this.seeking=!1,this.ended=!1,this.paused=!1,this.duration=0,this.currentTime=new pe(0),this.playbackRate=new pe(0),this.muted=new pe(!1),this.volume=new pe(1),this.resolution=new pe(""),this.definition=new pe(B),this.bitrate=new pe(0),this.width=0,this.height=0,this.state=new pe(B),this.newTime=o(),this.startLoadTime=0,this.autoplayStart=1,this.playTime=0,this.prepareBeforePlayTime=0,this.loadedTime=0,this.bufferFinishTime=0,this.playCount=0,this.vvTime=0,this.metaTime=0,this.firstUpdateTime=0,this.autoplayTime=0,this.startPlayInfo={bufEnd:0,bufStart:0,vvBuffer:0,startPos:-1,mvt:0,loadedVT:0,updateVT:0,autoPlayVT:0,playVT:0,fplayTime:0,pos:0,loadstartT:0,msestartT:0,activeT:0,loadedT:0,dvt:0,muted:-1},this.leave={time:0,method:""},this.exit={time:0,method:""},this.fvt=0,this.nvt=0,this.lpt=0,this.loadvt=0,this.switchPt=0,this.userFvt=0,this.buffFinishTime=0,this.loopCount=0,this.br={time:0,method:"",count:0,lTime:0,lPos:-1,pos:-1},this.visible="visible"===document.visibilityState,this.initialUrl={url:"",ip:"",host:"",resolution:"",definition:"",bitrate:0,width:0,height:0},this.curUrlInfo={url:"",ip:"",host:"",resolution:"",definition:"",bitrate:0,width:0,height:0},this.accPlayed=new ge,this.accPlayed.visible=this.visible,this.startStep=0,this.buffered={init:0,list:[],cur:{}},this.buffered=null,this.readyState=-1,this.networkState=-1,this.preloadData={size:0,time:0},this.meta={a_codec:"",v_codec:"",f_time:0}}reset(e){i(ve,"reset",e),e?(this.loopCount++,this.startStep=0,this.playTime=0,this.vvTime=0,this.metaTime=0,this.firstUpdateTime=0,this.autoplayTime=0,this.bufferFinishTime=0,this.br={time:0,method:"",count:0,lTime:0,lPos:-1,pos:-1},this.seeking=!1,this.ended=!1,this.accPlayed.reset(),this.autoplayStart=1,this.startPlayInfo={bufEnd:0,bufStart:0,vvBuffer:0,startPos:0,mvt:0,loadedVT:0,updateVT:0,autoPlayVT:0,pos:0,playVT:0,fplayTime:0,loadstartT:0,msestartT:0,loadedT:0,activeT:0,dvt:0,muted:-1}):this.init()}setInitData(e){["playbackRate","volume","currentTime","muted"].forEach((t=>{this.change(t,e[t])}))}setMeta(e){e?T(this.meta,e):this.meta={a_codec:"",v_codec:"",f_time:0}}updateUrl(e){const{initialUrl:t}=this;t.url||(t.url=e.url||"",t.host=c(e.url)),e.definition&&(t.definition=e.definition),e.ip&&(t.ip=e.ip),e.bitrate&&(t.bitrate=e.bitrate)}updatePState(e,t){const{readyState:n,networkState:r}=oe(e);this.readyState=n,this.networkState=r}setLoadStartTime(e){const t=o();e?(this.startLoadTime=t,this.startPlayInfo.msestartT=t,this.switchPt=this.switchPlayerTime?ue(this.switchPlayerTime,this.startLoadTime):0):this.startPlayInfo.loadstartT=t}setPlayStartTime(){const{startPlayInfo:e}=this;e.fplayTime||(e.fplayTime=o(),e.playVT=this.prepareBeforePlayTime>0?o()-this.prepareBeforePlayTime:-1)}setPT(e){this.prepareBeforePlayTime||(this.prepareBeforePlayTime=o()),this.isActive?(i(ve,`setPT>${e} playTime:${this.playTime} renderState:${this.renderState}`),this.startStep=1,this.startLoadTime||this.setLoadStartTime(!0),this.playTime||(this.playTime=o(),i(ve,"setPT",`init pt:${this.playTime}, document.visibilityState:${this.visible}`))):i(ve,`setPT>${e} preparePlayTime:${this.prepareBeforePlayTime} renderState:${this.renderState}`)}setVT(e,t,n){if(this.loadedTime||(this.loadedTime=o(),this.startPlayInfo.loadedVT=ue(this.prepareBeforePlayTime,this.loadedTime),this.loadvt=this.loadedTime-this.startLoadTime),this.isActive){if(1===this.startStep){if(i(ve,`setVT>${e} renderState:${this.renderState}`),!this.vvTime){const e=o();this.vvTime=e,this.fvt=e-this.playTime,this.nvt=e-this.newTime,this.userFvt=this.switchPlayerTime>0?e-this.switchPlayerTime:this.loadvt;const{startPlayInfo:r,muted:s}=this,{start:a,end:u,endPos:c}=j(t,0);r.bufEnd=u,r.vvBuffer=c,r.bufStart=a,r.pos=l(n),r.muted=s.current?1:0;const h=this.resolution.current;h&&(this.initialUrl.resolution=h),i(ve,"setVT: firstframe inited",`vt-pt:${this.fvt} vt-nt:${this.nvt} loadvt:${this.loadvt} start:${a} end:${u} endPos:${c}`,this.startPlayInfo)}this.startStep=2}}else i(ve,`setVT>${e} renderState:${this.renderState} return`)}changeRenderState(e,t){const n=this._renderState.current;this._renderState.current=e;const r="statechange",{startPlayInfo:s}=this;i(ve,"changeRenderState setPV",`preState:${n} state:${e}`),this.isActive&&(this.startPlayInfo.activeT=o(),s.loadstartT&&this.setPT(r),this.loadedTime&&this.setVT(r,t.buffered,t.currentTime),this.startAccTime(r))}setResolution(e){this.resolution.current=e}setMetaDataInfo(e){if(!this.metaTime){this.metaTime=o();const{startPlayInfo:t}=this;t.mvt=ue(t.loadstartT,o()),t.pos=l(e),i(ve,"setMetaTime",`mvt:${t.mvt}`)}}setLoadedData(){const{startPlayInfo:e}=this,t=o();e.loadedT=t,e.dvt=t-e.loadstartT}setBreak(e,t){const{br:n}=this;n.method=e,n.time||(n.time=o(),n.pos=t),n.lTime=o(),n.count++,n.lPos=t}setPreload(e){this.preloadData=e}setFirstPlayInfo(e){const{startPlayInfo:t,state:n}=this;if(this.firstUpdateTime>0||"playing"!==n.current)return;const{start:r,end:s}=j(e.buffered,e.currentTime),a=o();this.firstUpdateTime=a,t.startPos=l(e.currentTime),t.updateVT=ue(this.vvTime,a),t.autoPlayVT=ue(this.autoplayTime,a),t.bufEnd=s,t.bufStart=r,i(ve,"setFirstPlayInfo",`updateVT:${t.updateVT} autoPlayVT:${t.autoPlayVT} mvt:${t.mvt} fvt: ${this.fvt} start:${r} end:${s}`,t)}updateBuffed(e,t){if(this.bufferFinishTime)return;const n=z(e);for(let e=n.length-1;e>=0;e--)if(n[e].end>=this.duration-1){this.bufferFinishTime=o();break}}setExit(e,t){const{leave:n,exit:r}=this,{startPos:s,endPos:a,diff:l}=j(t.buffered,t.currentTime);i(ve,"setExit",`isActive:${this.isActive}`),!this.vvTime&&this.isActive&&(n.method=e,n.time=o(),this.playTime&&(this.lpt=n.time-this.playTime)),r.method=e,r.time=o(),r.bufDiff=l,r.bufStart=s,r.bufEnd=a,r.codec=le(t),r.ismse=f(t)?1:0,r.vtype=ae(t);const u=ie(t);r.url=u,r.host=c(u),i(ve,"setExit",e,r)}updateAcc(e,t=!1){this.accPlayed.update(e,t)}startAccTime(e){this.accPlayed.start(e)}change(e,t){const n=s(e);"string"==typeof e?this[e]&&(this[e].current=t):"Object"===n&&Object.keys(e).forEach((t=>{"undefined"!==this[t]&&(this[t].current=e[t])}))}changeWidthHeight(e,t){if(!e||!t)return;this.width=e,this.height=t;const{current:n}=this.resolution;n||(this.resolution.current=ce(e,t))}getWatchDuration(e=0){return this.accPlayed.getWatchDuration(e)}get ifFirstTimeUpdate(){return this.firstUpdateTime>0}}const _e="WaitData";class Te{constructor(e){this.suspendCallback=e,this.init()}reset(){this.init()}init(){this._startTime=-1,this._realStartTime=-1,this._intervalId=0,this._tIntervalId=0,this._startPos=0,this._inBuffer=!1,this._startDiff=0,this._endDiff=0,this._playRate=-1,this.nbc=0,this.dbc=0,this.dAcuTime=0,this.nAcuTime=0,this.firstWait=me(),this.latestWait=me(),this.waitList=[]}_clearTimer(e){const t=this[e];t&&(clearTimeout(t),this[e]=void 0)}_startTimeout(e){this._clearTimer("_tIntervalId"),this._tIntervalId=setTimeout((()=>{this.suspendWait("timeout",e),this._clearTimer("_tIntervalId")}),6e4)}_realStartWait(e){if(this._startTime>0){this._realStartTime=o();const{buffered:t,currentTime:n,networkState:r,readyState:s}=e,a=X(t,n,1);i(_e,"_realStartWait",`realStartTime:${this._realStartTime-this._startTime}\n startPos:${this._startPos} curPos:${n} isInBuf:${a}`),a?this.dbc++:this.nbc++;const l={networkState:r,readyState:s,pos:this._startPos,inBuffer:this._inBuffer,start:this._startTime,end:0,startDiff:this._startDiff,endDiff:0,rate:this._playRate,endType:B,costTime:0,interval:this.latestWait.end>0?this._startTime-this.latestWait.end:0};this.latestWait=l,this.firstWait.start||(this.firstWait=l)}}startWait(e){if(this._startTime>0)return;this._tIntervalId&&this._clearTimer("_tIntervalId"),this._startTime=o(),this._startPos=e.currentTime;const t=e?j(e.buffered,this._startPos):null;this._inBuffer=1===(null==t?void 0:t.include),this._startDiff=(null==t?void 0:t.diff)||0,this._playRate=e.playbackRate,i(_e,`startWait>inBuffer:${this._inBuffer} startDiff:${this._startDiff} startPos:${this._startPos} seeking:${e.seeking}`),this._intervalId=setTimeout((()=>{this._startTime>0&&(this._realStartWait(e),this._startTimeout(e)),this._clearTimer("_intervalId")}),200)}suspendWait(e,t){if(this._startTime<0)return;this._clearTimer("_intervalId"),this._clearTimer("_tIntervalId");const n=o();let r=n-this._startTime;if(r=r>6e4?6e4:r,this._realStartTime<0)return i(_e,`suspendWait>${e} not realStart cost:${r}`),this._startTime=-1,this._inBuffer=!1,void(this._startDiff=0);const{latestWait:s}=this;this._inBuffer?this.dAcuTime+=r:this.nAcuTime+=r;const a=t?j(t.buffered,s.pos):null;s.endType=e,s.costTime=r,s.endDiff=(null==a?void 0:a.diff)||0,s.end=n,i(_e,`suspendWait>inBuffer:${this._inBuffer} endDiff:${s.endDiff} startDiff:${s.startDiff} startPos:${s.pos} realCost:${r} ${e}`),this._startTime=-1,this._realStartTime=-1,this._inBuffer=!1,this._playRate=-1,this.suspendCallback&&this.suspendCallback(O,s)}}class be{constructor(e){this.pIndex=-1,this.codec_type="unknown",this.vtype="default",this.defaultBitrate=0,this.defaultDefinition="unknown",this.play_type=0,this.source_type="dir_url",this.playMode="unknown",this.vid="",this.tag="default",this.subtag="default",this.preSubtag="unknown",this.preTag="unknown",this.envInfo={},this.ext={},this.bitrateSetHevc=[],this.bitrateSet=[],this.init(e)}init(e){Object.keys(e).forEach((t=>{(function(e,t){return Object.prototype.hasOwnProperty.call(e,t)})(this,t)&&!p(e[t])&&(this[t]=e[t])}))}reset(e){this.init(e)}}function Se(e){return e.map((e=>{if(!e)return"";if("string"==typeof e)return e;const t=[];return e.qualityType&&t.push(e.qualityType),e.definition&&t.push(e.definition),e.gearName&&t.push(e.gearName),t.join("|")}))}const ke={manifest:1e3,network:2e3,demux:3e3,remux:4e3,media:5e3,drm:7e3,other:8e3,runtime:9e3,no_error_handler:9997,custom_error:9998,notSupport:1005},Pe={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106};function Me(e){const t=[];return["errorMessage","message","httpCode"].forEach((n=>{void 0!==e[n]&&t.push(e[n])})),e.response&&t.push(e.response.statusText||""),t.join("_")}function Re(e){const{errorType:t}=e;return b(t,ke)||("number"==typeof t?t:ke.media)}class we{constructor(){this.first=null,this.latest=null,this.errors=[],this.count=0,this.retryCount=0}parseError(e,t){let n=null;if(e)if(u(t)||e.code)n={code:b(e.code,Pe)||e.code,type:ke.media,message:e.message};else{const t=e;n={code:t.errorCode,type:Re(t),message:Me(t)}}else n={code:8101,type:ke.other,message:"error_is_undefined"};n.pos=e.currentTime||t.currentTime;const r=e.url||e.src||se(t,"currentSrc");n.isExpired=y(r);const{readyState:i,networkState:s}=oe(t);return{...n,cdnUrl:r,cdnHost:c(r),time:o(),readyState:i,networkState:s}}setError(e,t){var n;this.count++;const r=this.parseError(e,t);this.first?r.interval=r.time-((null==(n=this.latest)?void 0:n.time)||0):(r.interval=0,this.first=r),i("ERROR","setError",r),(w.isPC&&!w.isSupportMP4||w.isSpider)&&(r.code=Pe[5],r.type=ke.notSupport),r.stage=t.currentTime>0?"playing":"beforePlay",this.latest=r,this.errors.length>=10&&this.errors.splice(0,1),this.errors.push(r)}get errorCodes(){const e=[];return this.errors.forEach((t=>{e.push(t.code)})),e.join(";")}reset(){this.first=null,this.latest=null,this.errors=[],this.count=0}}function xe(e,t,n,r){const{source_type:i,codec_type:s,vtype:a,preTag:c,tag:d,subtag:f,pIndex:p,preSubtag:g,vid:m,play_type:v,envInfo:y,ext:_,playMode:T}=t,{networkState:b,readyState:S,duration:k,currentTime:P,width:M,height:R,isMSE:w}=n,x=l(r.currentTime||P.current),D=ae(r)||a,I=le(r)||s,C=u(r)?v+2:v,L=E.pv?E.pv:r?r.version:"",{deviceScore:O={}}=E;return{local_time:o(),player_sessionid:e,...E,...O,pv:L||B,codec_type:I,play_type:C,source_type:i,v:m,width:M,height:R,vtype:D,tag:d||B,subtag:f||T||B,pre_tag:c,pre_subtag:g,p_index:p,video_net_s:b,video_ready_s:S,vd:l(k),cur_play_pos:x,visible:n.visible?1:0,net:navigator.onLine?"online":"offline",is_mse:w?1:0,env_info:h(y),ext:h(_)}}const Ee={player_sessionid:"play_sess",p_index:"play_order",vd:"vduration"};function De(e){switch(e){case 0:return"duration";case 1:return"size";default:return B}}function Ie(e){let t="";return t="Array"===s(e.url)&&e.url.length>0?e.url[0].src||"":e.url||"",{cdn_url:t||"",cdn_host:c(t)||"",cdn_ip:e.ip||""}}const Ce={preload_start:"onLoadStart",preload_ended:"onLoadEnded",error:"onError",prf_data_size:"onPrfDataSize",prf_meta_ready:"onPrfMetaReady",preloadstart:"onLoadStartNew",preloadend:"onLoadEndedNew",preloadedmetadata:"onLoadMetadataNew"},Le="MDLPreload";const Oe="MDLPlayback";class Ae{constructor(e,t){this.opts=t||{openSizeLog:!0},this.suspendCallback=e,this.init()}getInitBitrate(){return{bitrate:0,aBitrate:0,cdnSize:0,cdnVSize:0,pcdnSize:0,pcdnVSize:0,definition:"",fileid:""}}init(){this.played=[],this.playedSize=0,this.cdnSize=0,this.pcdnSize=0,this.cdnVSize=0,this.pcdnVSize=0,this.lastBitrate=null,this.curBitrate=this.getInitBitrate(),this.nextBitrate=null,this.nextStart=-1,this.accDatas={cdnSize:0,cdnVSize:0,pcdnSize:0,pcdnVSize:0,playedSize:0},this.buffers=[]}reset(){this.init()}updatePlayed(e,t,n){const{played:r,curBitrate:i}=this,o=r.length,{bitrate:s,aBitrate:a}=i;if(0===t||o<1){const t=o>0?r[o-1]:null;t&&t.end<0?(t.start=e,t.bitrate=s,t.aBitrate=a):r.push({start:e,end:-1,bitrate:s,aBitrate:a})}else{const t=r[o-1];t.end=e,t.bitrate||(t.bitrate=s,t.aBitrate=a)}}calculateVideoPlaySize(){return 0}getPlayedDuration(){const{played:e}=this;return he(e)}calculatePlaySize(){const{played:e,curBitrate:t}=this,n=he(e),r=Math.round((t.aBitrate+t.bitrate)*n/8);return this.playedSize+=r,i(Oe,"calculatePlaySize",`duration: ${n} playedSize:${this.playedSize}`),this.played=[],this.playedSize}calculateCacheSize(){const{curBitrate:e,buffers:t}=this,n=function(e){let t=0;return e.forEach((e=>{e.start{e[t]+=this[t],this[t]=0}))}updateBuffed(e){this.buffers=z(e)}breakPlaybackData(e,t){f(re(t))||this.calculateCacheSize(),this.calculatePlaySize();const{cdnSize:n,cdnVSize:r,pcdnSize:o,pcdnVSize:s,accDatas:a}=this;if(i(Oe,"breakPlaybackData",e,n,r,o,s,a),[n,r,o,s].filter((e=>e>0)).length>0){const t={cdnSize:n,cdnVSize:r,pcdnSize:o,pcdnVSize:s};this.sendMDLEvent(e,t),this.updateAccData()}}getFileSize(e){return function(e,t){const{bitrate:n,aBitrate:r}=t;return{audio:Math.round(e*r/8),video:Math.round(e*(n-r)/8),total:Math.round(e*n/8)}}(e,this.curBitrate)}checkNextBitrateStart(e){const{nextBitrate:t,nextStart:n}=this;n>-1&&e>=e&&t&&(this.calculatePlaySize(),i(Oe,"checkNextBitrate",e,e,this.cdnSize),t&&(this.curBitrate={...t}),this.updatePlayed(e,0),this.nextStart=-1,this.nextBitrate=null)}updateDefInfo(e,t){const{mediaType:n,start:r,bitrate:o,definition:s,fileid:a}=e;i(Oe,"updateDefInfo",t,n,e);const l=this.getInitBitrate();"audio"===n?l.aBitrate=o||0:(l.bitrate=o||0,l.definition=s,l.fileid=a,this.updateLastDefInfo(),this.nextStart=p(r)?-1:r,-1===this.nextStart&&(this.curBitrate=l))}updateLastDefInfo(){const{curBitrate:e}=this;e.bitrate>0&&(this.lastBitrate={...e})}updateDownload(e){const{cdn_size:t,pcdn_size:n,mediaType:r,bitrate:o}=e,{curBitrate:s,nextBitrate:a}=this,l=t||0,u=n||0;let c=0,h=0;"audio"!==r&&(c=l,h=u),this.cdnSize+=l,this.pcdnSize+=u,this.cdnVSize+=c,this.pcdnVSize+=h;const d=this.nextStart>0?a:s;i(Oe,"updateDownload",null==d?void 0:d.bitrate,this.played.length>0?`end:${this.played[0].end} bitrate:${this.played[0].bitrate}`:-1),d&&(d.bitrate=o||0,d.cdnSize+=l,d.pcdnSize+=u,d.cdnVSize+=c,d.pcdnVSize+=h)}sendMDLEvent(e,t){const{suspendCallback:n,opts:r}=this;if(!r.openSizeLog||!n)return;const{cdnSize:o,cdnVSize:s,pcdnSize:a,pcdnVSize:l,definition:u}=t,c={vds:o,pvds:a,vvds:s,pvvds:l,df:u,end_type:e};i(Oe,"sendMDLEvent",e,A,c),n(A,c)}}let Ge=0;const $e="Collector";class Be{constructor(e,t){this._onLoadstartMse=()=>{i($e,"onLoadstartMse",this.playPerf.startLoadTime),this.playPerf.setLoadStartTime(!0),this._onLoadstart(this.player,Q.LOADSTART_MSE),this.playPerf.setMeta(null)},this._onMetaReady=e=>{const{audioCodec:t,videoCodec:n,timeRange:r=[]}=e;this.playPerf.setMeta({v_codec:t||"",a_codec:n||"",f_time:r.length>0?l(r[0].endTime||0):0})},this._onLoadstart=(e,t="loadstart")=>{const{playPerf:n,playMDL:r,player:o,vInfo:s}=this,a=ie(o);i($e,"onLoadstart",`renderState:${n.renderState} startStep:${n.startStep}`);const u=t!==Q.LOADSTART_MSE&&(!(c=a)||window.location.href.indexOf(c)>-1);var c;n.setLoadStartTime(t===Q.LOADSTART_MSE);const h=t,d=t===Q.LOADSTART_MSE||f(re(o));if(n.isMSE=d,n.updateBuffed(o.buffered,h),r.updateBuffed(o.buffered),n.change("state",h),n.loadState=1,n.playbackState=1,n.setResolution(s.defaultDefinition),n.seeking=!1,n.updatePState(o,h),function(e){return e&&!!e.coreName}(o)||n.setPreload(function(e){const{plugins:t}=e||{},n={vtype:B,time:0,size:0,f_size:0,bitrate:0,codec:"UNKNOWN"};if(!t||!t.mp4encryptplayer)return n;const{preLoadData:r}=t.mp4encryptplayer;if(r){const{type:e,fileSize:t,vtype:n,codecType:i,bitrate:o,preloadTime:s,byteLength:a,definition:u}=r;return{vtype:n,time:l(s),size:a,f_size:t||0,bitrate:o,definition:u,type:e,codec:i}}return n}(o)),i($e,"onLoadstart",`startStep:${n.startStep} isSrcEmpty:${u}`),n.setInitData(o),!d){const e={url:a,definition:s.defaultDefinition};this.setInitialUrl(e),r.updateDefInfo(function(e,t){const{curDefinition:n,config:r}=e||{};return n&&n.bitrate?n:r&&r.defaultBitrate?{bitrate:r.defaultBitrate||0,definition:r.defaultDefinition||0}:t?{bitrate:t.defaultBitrate||0,definition:t.defaultDefinition||""}:{bitrate:0,definition:""}}(o,this.vInfo),0)}0===n.startStep&&!u&&n.setPT(h)},this._onDurationchange=()=>{const{player:e,playPerf:t}=this;t.duration=e.duration,i($e,"onDurationchange",e.duration)},this._onLoadedmetadata=()=>{const{playPerf:e,player:t,vInfo:n}=this,r=f(re(this.player));e.playbackState=10,e.setMetaDataInfo(t.currentTime),e.isMSE=r,i($e,"onLoadedmetadata");const o={url:ie(t),definition:n.defaultDefinition};this.setInitialUrl(o)},this._onLoadeddata=()=>{const{playPerf:e,playMDL:t,player:n}=this,r=K.LOADED_DATA;i($e,"onLoadeddata");const o=re(n),s=(null==o?void 0:o.videoWidth)||0,a=(null==o?void 0:o.videoHeight)||0;e.changeWidthHeight(s,a),e.playbackState=2,e.change("state",r),e.loadState=9,e.updatePState(n,r),e.updateBuffed(n.buffered,r),t.updateBuffed(n.buffered),e.setLoadedData(),e.setVT(r,n.buffered,n.currentTime)},this._onCanplay=()=>{const{playPerf:e,playMDL:t,player:n}=this;i($e,"onCanplay",`startStep:${e.startStep} vvTime:${e.vvTime} playTime:${e.playTime}`),e.updatePState(n,K.CANPLAY),e.updateBuffed(n.buffered,K.CANPLAY),t.updateBuffed(n.buffered),e.setVT("canplay",n.buffered,n.currentTime)},this._onPause=()=>{const{operate:e,playPerf:t,player:n,playMDL:r}=this;n.error||(i($e,"onPause",t.state.current),t.change({state:K.PAUSE}),t.playbackState=4,t.paused=!1,t.updateAcc(K.PAUSE),r.updatePlayed(n.currentTime,1),e.startPause())},this._onPlaying=()=>{const{operate:e,playPerf:t,wait:n,player:r,playMDL:o}=this;i($e,"onPlaying");const s=K.PLAYING;t.paused=!1,t.change("state",s),t.playbackState=3,t.startAccTime(s),o.updatePlayed(r.currentTime,1),n.suspendWait(s,r),e.endPause()},this._onWaiting=()=>{const{playPerf:e,wait:t,player:n}=this,{ifFirstTimeUpdate:r,vvTime:o}=e,s=K.WAITING;i($e,"onWaiting",r,o,e.renderState),!n.seeking&&r&&o&&(t.startWait(n),e.change("state",s),e.playbackState=7),e.updatePState(n,s),e.updateAcc(K.WAITING)},this._onSeeking=()=>{const{playPerf:e,wait:t,operate:n,player:r,playMDL:o}=this,{ifFirstTimeUpdate:s,state:a,startStep:l,vvTime:u}=e;i($e,"onSeeking",r.currentTime,`curState:${a.current} lasteState:${a.last} vvTime:${u} ended1:${r.ended} ifFirstTimeUpdate:${s}`,r.seeking,a.current!==K.ENDED||u&&s);const c=K.SEEKING;var h;(h=a.current)!==K.ENDED&&h!==K.LOAD_START&&u&&s&&(e.seeking=!0,t.suspendWait(c,r),n.startSeek(r,a.current),e.change("state",c),e.playbackState=8),e.updatePState(r,c),0===l&&e.setPT(c),e.startAccTime(c),o.updatePlayed(r.currentTime,0)},this._onSeeked=()=>{const{player:e,playPerf:t,operate:n}=this;i($e,"onSeeked",e.seeking,e.currentTime),t.updatePState(e,K.SEEKED),t.seeking=!1;const r=e.paused?K.PAUSE:K.PLAYING;t.change("state",r),t.playbackState=e.paused?4:3,n.suspendSeek(t.state.current,K.SEEKED)},this._onTimeupdate=()=>{const{playPerf:e,playMDL:t,player:n}=this;if(n.error)return;const{currentTime:r}=n;e.change({currentTime:r}),t.updatePlayed(r,1),e.firstUpdateTime||(i($e,"onTimeupdate"),e.setFirstPlayInfo(n)),!n.paused&&!n.ended&&e.startAccTime(K.TIMEUPDATE)},this._onProgress=()=>{const{player:e,playMDL:t,playPerf:n}=this;n.updatePState(e,K.PROGRESS),n.updateBuffed(e.buffered,K.PROGRESS),t.updateBuffed(e.buffered)},this._onSuspend=()=>{const{player:e,playPerf:t}=this;i($e,"onSuspend"),t.updatePState(e,K.SUSPEND)},this._onVolumechange=()=>{const{muted:e,volume:t}=this.player;this.playPerf.change({muted:e,volume:t})},this._onRatechange=()=>{this.playPerf.change("playbackRate",this.player.playbackRate)},this._onEmptied=()=>{const{player:e,playPerf:t}=this;t.loadState=0,t.updatePState(e,K.EMPTIED),t.updateBuffed(e.buffered,K.EMPTIED),i($e,"onEmptied")},this._onStalled=()=>{const{player:e,playPerf:t}=this,n=K.STALLED;t.updatePState(e,n),"Safari"===w.name||(t.loadState=11,t.change("state",n)),i($e,"onStalled")},this._onAbort=()=>{const{player:e,playPerf:t}=this,n=K.ABORT;t.updatePState(e,n),t.change("state",n),i($e,"onAbort")},this.options=e||{},this.player=t,Ge||(Ge=function(){try{return parseInt(window.performance.now().toFixed(0),10)}catch{return 0}}()),this.playPerf=new ye,this.operate=new fe(((e,t)=>{this._suspendStateCallback(e,t)})),this.wait=new Te(((e,t)=>{this._suspendStateCallback(e,t)})),this.vInfo=new be({}),this.error=new we,this.extData={};const n={openSizeLog:this.options.openSizeLog},{ext:r,switchPlayerTime:o}=this.options;this.setExtData(r),this.setSwitchTime(o),this.playMDL=new Ae(((e,t)=>this._suspendStateCallback(e,t)),n)}_suspendStateCallback(e,t){i($e,"_suspendStateCallback",e,t)}get performanceNow(){return Ge}resetDataOnEnded(){this.reset(!0)}reset(e){i($e,"reset",`isEnded:${e}`);const{operate:t,playPerf:n,wait:r,error:o,playMDL:s}=this;t.reset(),n.reset(e),r.reset(),o.reset(),s.reset()}setSwitchTime(e){this.playPerf.switchPlayerTime=e||o()}setExtData(e={}){Object.keys(e).forEach((t=>{this.extData[t]=e[t]}))}setPlayLeaveInfo(e,t){const n=e||Q.RESET,r=t||U;i($e,"setPlayLeaveInfo");const{playPerf:o,wait:s,operate:a,player:l}=this;o.setExit(r,l),s.suspendWait(n,l),a.suspendSeek(o.state.current,n)}setInitialUrl(e){const{playPerf:t,vInfo:n}=this;e.definition||(e.definition=n.defaultDefinition),e.bitrate||(e.bitrate=0|n.defaultBitrate),t.updateUrl(e)}_onPlay(){const{playPerf:e,player:t,options:n}=this;t.error||(i($e,"onPlay",`startStep :${e.startStep} this.ended:${e.ended}`,o()),e.state.current===K.PAUSE&&e.playCount++,e.setPlayStartTime(),e.ended&&e.loopCount++,n.ifSendVVEnded&&e.ended&&(this.resetDataOnEnded(),e.ended=!1,e.setPT("play")))}_onEnded(){i($e,"onEnded");const e=K.ENDED,{playPerf:t,wait:n,player:r,options:o}=this;t.ended=!0,t.change("state",e),t.playbackState=6,t.updateAcc(e,!0),n.suspendWait(e,r),o.ifSendVVEnded&&t.setExit("ended",r)}_onError(e){i($e,"onError",e);const t=K.ERROR,{playPerf:n,playMDL:r,wait:o,operate:s,error:a,player:l}=this;e||(e=this.player.error),a.setError(e,l),n.updatePState(l,t),n.updateBuffed(l.buffered,t),r.updateBuffed(l.buffered),n.change("state",t),n.loadState=10,n.playbackState=5,n.setExit("error",l),n.seeking=!1,n.updateAcc(t),o.suspendWait(t,l),r.breakPlaybackData(t,l),s.suspendSeek(n.state.current,t)}_onPlayCatch(e,t){const{playPerf:n,wait:r,operate:i,playMDL:o,player:s}=this,a=Q.PLAY_CATCH;n.updatePState(s,a),n.change("state",a),n.seeking=!1,n.updateAcc(a),n.setBreak(a,n.currentTime.current),r.suspendWait(a,s),o.breakPlaybackData(a,s),i.suspendSeek(n.state.current,a)}_onPlayerDestroy(){const{playPerf:e,playMDL:t,wait:n,operate:r,player:i}=this,o=Q.PLAYER_DESTROY;e.setExit("destroy",i),e.updateAcc(o),n.suspendWait(o,i),t.breakPlaybackData(o,i),r.suspendSeek(e.state.current,o)}_onAutoPlayStart(){i($e,"onAutoPlayStart");const{playPerf:e}=this;e.autoplayTime||(e.autoplayTime=o())}_onAutoPlayPrevented(){i($e,"onAutoPlayPrevented");const{playPerf:e}=this;e.playbackState=9,e.autoplayStart=0}sendEvent(e,t){}}const Ne="Collector";let Fe=null;const Ue=new class{constructor(e){this.onLoadStartNew=e=>{i(Le,"onLoadStartNew",e);const{url:t="",vid:n="",bitrate:r=0,formatType:s="MP4",fileid:a="",definition:l="",codecType:u=""}=e||{},c=Ie({url:t}),h={...e,...c,v:n||"",codec_type:u,vtype:s,bitrate:r,fileid:a||"",df:l,task_type:-1,errc:0,vds:0,pvds:0,vvds:0,pvvds:0};this.vid=n,this.data=h,this.meta={a_codec:"",v_codec:""},this.startTime=o(),this.state="start"},this.onLoadStart=e=>{i(Le,"onPreloadStart",e.cacheKey,e);const{codecType:t,vtype:n,vid:r,width:s,height:a,bitrate:l,file_id:u,definition:c,type:h}=e,{data:d}=this,f=Ie(e);let g=B;g=s&&a?ce(s,a):c;const m={...d,...f,v:r,codec_type:t,vtype:n,bitrate:l,fileid:u||"",df:g,task_type:p(h)?-1:h};this.vid=r,this.data=m,this.meta={a_codec:"",v_codec:"",f_time:0,f_size:0},this.startTime=o(),this.state="start"},this.onLoadEndedNew=e=>{i(Le,"onLoadEndedNew",e);const{stats:t,url:n}=e,r=Ie({url:n}),s=o()-this.startTime,a=t.dataSize,l=t.duration,{data:u}=this;u.cdn_url=r.cdn_url,u.cdn_host=r.cdn_host,u.isexpired=y(r.cdn_url),u.cost_time=s,u.vpls=a,u.vplt=l,this.sendMDLEvent("loadended",u),this.vid="",this.startTime=0,this.data=this.getInitData(),this.state="suspend"},this.onLoadEnded=e=>{if(i(Le,"onPreloadEnded",e.cacheKey,e),this.vid&&this.vid===e.vid){const t=Ie(e),n=o()-this.startTime,r=this.data.vds;this.setMetaFirst(e);const i={...this.data,vplt:a(e.preloadTime,2),vpls:r||e.preloadSize,cost_time:e.costTime||n,bitrate:e.bitrate,fileid:e.file_id||"",isexpired:y(t.cdn_url)};this.sendMDLEvent("loadended",i)}else console.warn(Le,"onLoadEnded","cacheKey_not_match",this.vid,e.cacheKey);this.vid="",this.startTime=0,this.data=this.getInitData(),this.state="suspend"},this.onError=e=>{if(i(Le,"onError",e),this.vid){const{context:t}=e,n=o()-this.startTime,r=Ie(t||{}),i={...this.data,errc:e.errorCode,err_msg:Me(e),cost_time:e.costTime||n,fileid:e.file_id||"",isexpired:y(r.cdn_url),...r};this.sendMDLEvent("loaderror",i)}this.vid="",this.startTime=0,this.data=this.getInitData(),this.state="suspend"},this.onPrfDataSize=e=>{if(this.vid){const{cdn_size:t,pcdn_size:n,mediaType:r}=e,{data:i}=this,o=t||0,s=n||0;let a=0,l=0;"audio"!==r&&(a=o,l=s),i.vds+=o,i.pvds+=s,i.vvds+=a,i.pvvds+=l}this.state="load"},this.onLoadMetadataNew=e=>{i(Le,"onLoadMetadataNew",e);const{tracks:t=[]}=e;t.forEach((e=>{"audio"===e.type?this.meta.a_codec=e.codec:this.meta.v_codec=e.codec}))},this.onPrfMetaReady=e=>{this.setMetaFirst(e)},this.eventCallback=e,this.init()}init(){this.emptyCount=0,this.data=this.getInitData(),this.vid="",this.extData={tag:B,subtag:B,preSubtag:B,preTag:B,pIndex:-1,isMSE:!1},this.meta={a_codec:"",v_codec:"",f_time:0,f_size:0},this.state="init"}getInitData(){return{codec_type:B,v:"",vtype:B,errc:0,err_msg:"",vplt:0,vpls:0,vds:0,pvds:0,vvds:0,pvvds:0,cdn_host:"",cdn_ip:"",cost_time:0,df:B,bitrate:0,fileid:"",task_type:-1,isexpired:0}}setMetaFirst(e){const{mediaSegList:t=[],meta:n}=e||{},r=t.length>0?t[0]:{timeRange:[],totalRange:[]},{timeRange:i=[],totalRange:o=[]}=r;this.meta.f_size=o.length>1?o[1]:0,this.meta.f_time=i.length>1?l(i[1]):0,this.meta.v_codec=(null==n?void 0:n.videoCodec)||"",this.meta.a_codec=(null==n?void 0:n.audioCodec)||""}reset(){this.init()}setExtData(e){e&&T(this.extData,e)}attach(e){this.preload!==e&&(i(Le,"attach"),this.preload&&this.detach(),this.preload=e,Object.keys(Ce).forEach((e=>{this.preload.on(e,this[Ce[e]])})))}detach(){i(Le,"attach "),this.preload&&Object.keys(Ce).forEach((e=>{this.preload.off(e,this[Ce[e]])})),this.reset(),this.preload=null}sendMDLEvent(e,t){const{eventCallback:n,extData:r}=this,o={...E,...t,task_type:De(t.task_type),empty_c:0,tag:r.tag||B,subtag:r.subtag||B,pre_tag:r.preTag||B,pre_subtag:r.preSubtag||B,p_index:r.pIndex,is_mse:r.isMSE?1:0,meta:h(this.meta)};i(Le,"event",e,G,o),n&&n(G,o)}}(((e,t)=>{Fe&&Fe.event(e,t)}));let He=null;class Ve extends Be{constructor(e,t){const n=function(e){const t={line_app_id:0,line_user_id:"",playerCoreVersion:"",playerVersion:"",app_version:"",channel:"cn",channelDomain:"",absdkVersion:"",maxQueueCount:5,ifSendVVEnded:!1,isTask:!1,vtype:"MP4",codec_type:"",tag:"普通视频",playType:0,sourceType:"vid",subtag:"",playMode:"",sendLocalCallback:(e,t)=>{},disableLocalCache:!1,closeResolutionLog:!1,closeSeekLog:!1,needXhrCheck:!1,trackerConfig:{},envInfo:{},ext:{},openSizeLog:!0};return Object.keys(e).forEach((n=>{t[n]=e[n]})),t}(e);super(n,t),this._onPlay=()=>{const{ended:e,state:t,isMSE:n}=this.playPerf;e&&(this.isSendOnePlay=!1),super._onPlay(),Ue.setExtData({isMSE:n}),i(Ne,"onPlay",t.current,t.last)},this._onEnded=()=>{super._onEnded();const{ifSendVVEnded:e}=this.options;e&&this._trackOnePlay("ended")},this._onError=e=>{super._onError(e);const{latest:t}=this.error,{playPerf:n}=this;if(i(Ne,"onError",e,t),"dash"!==this.player.type||!this.player.replayRunning){if(n.playTime||n.setPT("error"),(null==t?void 0:t.code)===Pe[5])return this._trackOneError("error",t),void(this.isSendOnePlay=!0);this._trackOneError("error",t),this._trackOnePlay("error",t)}},this._onSourceError=e=>{i(Ne,"onSourceError",e)},this._onPlayCatch=(e,t)=>{i(Ne,"onPlayCatch",e,t);const n=t?t.message:"";if(!t||"MP4_0"===e&&"no preload"===n)return;super._onPlayCatch(e,t);const{initialUrl:r}=this.playPerf;d(t.url)&&(t.url=r.url);const{error:o}=this;o.setError(t,this.player),this.playMDL.breakPlaybackData(F,this.player),this._trackOneError(F,o.latest)},this._onPlayerDestroy=()=>{super._onPlayerDestroy();const{playTime:e}=this.playPerf;i(Ne,"onPlayerDestroy",this.sessionId,e),this._trackOnePlay("player_destroy"),this.reset(!1),this._unBindEvt()},this._onPlayNext=()=>{var e,t;null!=(t=null==(e=this.player)?void 0:e.getCore)&&t.call(e)&&(i(Ne,"_onPlayNext",this.sessionId),this._onPlayerReset("next"))},this._onPlayerReset=e=>{const{playPerf:t}=this;i(Ne,"onPlayerReset",this.sessionId,`type:${e} playTime:${t.playTime}`),this.playMDL.breakPlaybackData(U,this.player),t.updateAcc("reset"),t.playTime>0&&(this.setPlayLeaveInfo(Q.RESET,U),this._trackOnePlay(e||Q.RESET)),this.reset(!1)},this._onAutoPlayStart=()=>{super._onAutoPlayStart()},this._onAutoPlayPrevented=()=>{super._onAutoPlayPrevented()},this._onVisibilityChange=e=>{i(Ne,"onVisibilityChange",e);const{playPerf:t}=this;t.visible="visible"===e,t.updateAcc("visible",!1)},this._onInitialUrl=e=>{i(Ne,"onInitialUrl",e),this.setInitialUrl(e)},this._onRenderStateChange=e=>{const{playPerf:t,player:n}=this;e.state===t.renderState||e.state===V.RELEASE||(i(Ne,"_onRenderStateChange",o(),n.playerId,t.renderState,e.state),t.renderState===V.ACTIVE&&e.state===V.RETAIN&&(t.setExit("statechange",n),t.updateAcc("statechange"),this._trackOnePlay("statechange"),this.reset(!1)),t.switchPlayerTime=o(),t.changeRenderState(e.state,n))},this._onBeforeDefiChange=e=>{i(Ne,"onBeforeDefinitionChange",e)},this._onDefiChange=e=>{i(Ne,"onDefinitionChange",e)},this._onDefiChangeSuccess=()=>{i(Ne,"onDefiChangeSuccess")},this._onDefiChangeDetail=e=>{i(Ne,"onDefiChangeDetail",e);const{playMDL:t,player:n}=this;t.updateDefInfo(e,n.currentTime);const{lastBitrate:r}=t;r&&e.mediaType},this._onPrfDataSize=e=>{i(Ne,"onPrfDataSize",e),this.playMDL.updateDownload(e)},this._onXgLogCache=()=>{const e=(null==(t=this.player)?void 0:t.logCache)||(null==t?void 0:t.getLogCache);var t;e&&(this.templog={vtype:ae(this.player),log:e})},this._onDegrade=()=>{i(Ne,"onDegrade")},this._onAbrChange=()=>{i(Ne,"onAbrChange")},this._onMediaFormatError=e=>{i(Ne,"onMediaFormatError",e)},this._onPageUnload=()=>{const{playTime:e}=this.playPerf;if(i(Ne,"onPageUnload",this.sessionId,e),e>0){const e=H;this.setPlayLeaveInfo(e,e),this.playMDL.breakPlaybackData(e,this.player),this._trackOnePlay(H)}},this._onHitcache=e=>{if(i(Ne,"_onHitcache",this.sessionId,e),!e||!e.stats)return;const{playPerf:t}=this,{stats:n}=e;t.setPreload({vtype:"MP4",time:n.duration,size:n.dataSize})},e&&e.line_app_id?(this.isSendOnePlay=!1,this.sessionId="",this.init(e),this.player&&this._bindEvt(this.player)):console.warn("player.config.vodLogOpts.line_app_id is necessary for plugin xgVodLogger")}static get version(){return S}static get preloadMDL(){return Ue}static setCustomTracker(e){i(Ne,"setCustomTracker",e),He=e}static set Tracker(e){Fe=e}static get Tracker(){return Fe}static sendEvent(e,t){Fe&&Fe.event(e,t)}static set commonData(e){C(e)}static set TEA_ID(e){I=e,D=`__tea_cache_tokens_${I}`}static get TEA_ID(){return I}static set AB_SDK_VERSION(e){E.absdkVersion=Array.isArray(e)?e.join(","):e}static get AB_SDK_VERSION(){return E.absdkVersion}static attachPreloader(e){Ue.attach(e)}static detachPreloader(){Ue.detach()}static get defaultConfig(){return{line_app_id:0,line_user_id:"",playerCoreVersion:"",playerVersion:"",app_version:"",channel:"cn",channelDomain:"",absdkVersion:"",maxQueueCount:5,ifSendVVEnded:!1,isTask:!1,vtype:"MP4",codec_type:"",tag:"普通视频",playType:0,sourceType:"vid",subtag:"",playMode:"",sendLocalCallback:(e,t)=>{},disableLocalCache:!1,closeResolutionLog:!1,closeSeekLog:!1,needXhrCheck:!1,trackerConfig:{},envInfo:{},ext:{},openSizeLog:!0}}init(e){i(Ne,"init",e);const t=this.options||{};Object.keys(e).forEach((n=>{t[n]=e[n]}));const n={...e.trackConfig};["referrer","channel","channel_domain"].forEach((t=>{void 0!==e[t]&&(n[t]=e[t])})),e.channelDomain&&(n.channel_domain=e.channelDomain),Fe&&Fe.config(n),this.initSessionId(),this.update(e)}update(e){C(e),this.vInfo.init(e);const{ext:t={},switchPlayerTime:n}=e;this.setExtData(t),n&&this.setSwitchTime(n),Ue.setExtData(e)}initSessionId(){if(this.sessionId)return;let e="0";try{e=function(e){if(!window.localStorage)return"";const t=window.localStorage.getItem(e)||"";try{return JSON.parse(t)}catch{return t}}(D).web_id||"0"}catch{e="0"}this.sessionId=function(e){let t="0";try{const n=window.localStorage.getItem(e)||"",r=JSON.parse(n);t=(null==r?void 0:r.web_id)||"0"}catch{t="0"}return function(e){let t=(new Date).getTime(),n=0;try{n=parseInt(e)}catch{n=0}return t+=n,window.performance&&"function"==typeof window.performance.now&&(t+=window.performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))}(t)}(e),i(Ne,`sessionId webId:${e} ${this.sessionId}`)}attachPlayer(e){e!==this.player&&(this.detachPlayer(this.player),this.player=e,this.player.version&&(E.pv=this.player.version),this._bindEvt(e));const t=null==e?void 0:e.preloader;t&&Ue.attach(t);const n=(null==e?void 0:e.version)||"";E.pv=n}detachPlayer(e){e&&this._unBindEvt(),e===this.player&&(this.player=null)}resetConfig(e){i(Ne,"reset",e)}reset(e){super.reset(e),this.isSendOnePlay=!1}destroy(){const{operate:e,playPerf:t,playMDL:n,wait:r,error:o,player:s}=this;i(Ne,"destroy",this.sessionId);const a="log_destroy";t.setExit("log_destroy",s),t.updateAcc(a),n.breakPlaybackData(a,s),this._trackOnePlay(a),e.reset(),t.reset(!1),r.reset(),o.reset(),n.reset(),this.detachPlayer(this.player)}getTokenFromTracker(){return Fe?Fe.getToken():{}}_bindEvt(e){e&&(J(this.sessionId,te,this._onVisibilityChange),J(this.sessionId,ee,this._onPageUnload),function(e,t){q(e,t,1)}(e,this))}_unBindEvt(){const{player:e}=this;e&&(function(e,t){q(e,t,2)}(e,this),Z(this.sessionId,te),Z(this.sessionId,ee))}_suspendStateCallback(e,t){if(e&&t)switch(i(Ne,"_suspendStateCallback",e,t),e){case O:this._trackOneEvent("wait",t);break;case L:this._trackOneOpera(t);break;case A:this._trackMdlVideoSize(t)}}_trackOnePlay(e,t){const{playPerf:n}=this;if(this.isSendOnePlay||!n.playTime)return void i(Ne,`_trackOnePlay_${e} isSendOnePlay:${this.isSendOnePlay} pt:${n.playTime} isActive:${n.isActive}`);const r=function(e,t,n){const{vInfo:r,playPerf:i,playMDL:o,wait:s,operate:u,error:c,player:d,sessionId:f,extData:p,performanceNow:g}=e,m=xe(f,r,i,d),{url:v,host:_,ip:T,bitrate:b}=i.initialUrl,{leave:S,exit:k,playTime:P,vvTime:M,newTime:R,volume:w,muted:x,playbackRate:E,bufferFinishTime:D,preloadData:I,br:C,resolution:L,startLoadTime:O,userFvt:A,width:G,height:$,switchPt:B,meta:N,startPlayInfo:F,autoplayStart:U}=i,{seekCount:H,sat:V,pauseLog:j}=u,{playedSize:z,cdnSize:X,cdnVSize:K,pcdnSize:Q,pcdnVSize:W}=o.accDatas,{firstWait:q}=s,{errors:Y}=c,J=c.first,Z=i.getWatchDuration(),ee=function(e){if(e&&e.pcdnVVStat){const t=e.pcdnVVStat;return{try_req:t.try_req_num,req_succ:t.req_node_succ,has_ret:t.has_ret_node,conn_ret:t.conn_ret_num,conn_fail:t.conn_fail_num,conn_jump:t.conn_jump_num}}return{}}(d),te=function(e){return e&&e.performance||{}}(d),ne=function(e){const t=re(e),n={total:0,dropped:0,drop_rate:0};try{const e=null==t?void 0:t.getVideoPlaybackQuality();return n.dropped=(null==e?void 0:e.droppedVideoFrames)||0,n.total=(null==e?void 0:e.totalVideoFrames)||0,n.total>0&&(n.drop_rate=a(n.dropped/n.total*100)),n}catch{return n}}(d),{bitrateSet:ie,bitrateSetHevc:oe}=r,se=function(e,t){return{h1:e.length,h2:t.length,set1:Se(e),set2:Se(t)}}(ie,oe),ae=b;return{...m,perf_time:g,prepare_start_time:0,prepare_end_time:0,initial_url:v||"",initial_host:_,initial_ip:T,isexpired:y(v),width:G,height:$,initial_resolution:i.initialUrl.resolution,nt:R,pt:P,vt:M,fvt:ue(P,M),svt:ue(O,M),nvt:M>0?M-R:P-R,user_fvt:A,switch_pt:B,player_created_t:R,lt:S.time,lpt:te.lpt,et:k.time,lv_method:k.method,bft:D,volume:a(w.current,2),mute:x.current?1:0,play_speed:E.current,sc:H,sat:V,dbc:s.dbc,nbc:s.nbc,bc:s.dbc+s.nbc,bu_acu_t:s.dAcuTime+s.nAcuTime,de_bu_acu_t:s.dAcuTime,n_bu_acu_t:s.nAcuTime,pause_acu_t:j.acuTime,start_time:l(i.startPlayInfo.startPos||0),finish:i.ended||i.loopCount>0?1:0,lc:i.loopCount,watch_dur:Z,is_start_play_automatically:U,first_buf_startt:q.start,first_buf_endt:q.end,play_c:i.playCount,load_state:i.loadState,playback_state:i.playbackState,pcdn:h(ee),pre_info:h(I),perf:h(te),frame_info:h(ne),br:C.count,fbrt:C.time,df:L.current,lf:L.last,bitrate:ae,errc:n?n.code:0,errt:n?n.type:0,vsc_message:n?n.message:"",fir_errc:J?J.code:0,fir_errt:J?J.type:0,accu_errc:c.count||0,merror:h(Y),end_type:t,vps:z,vds:X,pvds:Q,vvds:K,pvvds:W,vplt:I.time,vpls:I.size,ext:h(p),bitset:h(se),meta:h(N),exit:h(k),start_info:h(F),rstate:i.renderState,pre_rstate:i.preRenderState,prepare_before_play_t:i.prepareBeforePlayTime}}(this,e,t);i(Ne,`_trackOnePlay_${e}`,r),this.isSendOnePlay=!0,this.sendEvent("videoplayer_oneplay",r)}_trackOneEvent(e,t){const n=function(e,t,n){const{vInfo:r,playPerf:i,operate:o,player:s,sessionId:a}=n,u=xe(a,r,i,s),{playbackRate:c,firstUpdateTime:h}=i,{latestSeek:d,latestSwitch:f}=o;return{...u,event_type:e,cost_time:t.costTime,end_type:t.endType,first_frame_interval:g(h,t.start),last_seek_interval:d?g(d.start,t.start):0,last_switch_interval:f?g(f.start,t.start):0,last_event_interval:t.interval,video_pos:l(t.pos),play_speed:c.current,st:t.start,et:t.end,rstate:i.renderState,pre_rstate:i.preRenderState,prepare_before_play_t:i.prepareBeforePlayTime}}(e,t,this);i(Ne,`_trackOneEvent_${e}`,t,n),this.sendEvent(O,n)}_trackOneOpera(e){const t=e.op,n=function(e,t,n){const{vInfo:r,playPerf:i,player:o,sessionId:s}=n;return{...xe(s,r,i,o),opera_type:e,end_type:t.endType,state_before:t.stateBefore,state_after:t.stateAfter,cost_time:t.costTime,is_seek_in_buffer:t.inBuffer?1:0,last_interval:t.interval,video_pos:l(t.pos),cdn_url:"",cdn_ip:"",rstate:i.renderState,pre_rstate:i.preRenderState,prepare_before_play_t:i.prepareBeforePlayTime}}(t,e,this);i(Ne,`_trackOneOpera_${t}`,e,n),this.sendEvent(L,n)}_trackOneError(e,t){if(!t)return;const n=function(e,t,n=""){const{error:r,vInfo:i,playPerf:o,player:s,sessionId:a,extData:l}=t,u=xe(a,i,o,s),{resolution:c}=o.initialUrl,d=r.errorCodes;return{...u,errt:e.type,errc:e.code,err_msg:e.message,cdn_url:e.cdnUrl,cdn_host:e.cdnHost,cdn_ip:e.cdnIp,es:e.stage||"",isexpired:e.isExpired,resolution:_(c),end_type:n,last_errors:d,retry_count:r.retryCount,ext:h(l),rstate:o.renderState,pre_rstate:o.preRenderState,prepare_before_play_t:o.prepareBeforePlayTime}}(t,this,e);i(Ne,`_trackOneError_${e}`,t,n),this.sendEvent("videoplayer_oneerror",n)}_trackMdlVideoSize(e){const t=function(e,t){const{vInfo:n,playPerf:r,player:i,sessionId:o}=e;return{...xe(o,n,r,i),...t,rstate:r.renderState,pre_rstate:r.preRenderState,prepare_before_play_t:r.prepareBeforePlayTime}}(this,e);i(Ne,`_trackMdlVideoSize${e.end_type}`,t),this.sendEvent(A,t)}sendEvent(e,t){if(i(Ne,"sendEvent",`eventName:${e} extNAme:${$[e]}`),Fe&&Fe.event(e,t),He){const n=$[e];n&&He.event(n,function(e){const t={...e};try{return delete t.line_user_id,delete t.deviceScore,delete t.ua,delete t.absdkVersion,Object.keys(Ee).forEach((e=>{t[Ee[e]]=t[e],delete t[e]})),t}catch{return t}}(t))}}getFinalInfo(){var e,t;const{error:n,playPerf:r,vInfo:i,player:o}=this;return{vt:r.vvTime,pt:r.playTime,currentTime:o.currentTime,firstframeDuration:r.fvt,errorCode:(null==(e=n.latest)?void 0:e.code)||0,errorMessage:(null==(t=n.latest)?void 0:t.message)||"",isFinish:r.loopCount>0?1:0,codecType:i.codec_type,resolution:r.resolution.current,url:r.initialUrl.url}}}const je="XGTracker",ze="__xgplayer_vod_log__",Xe={appId:548444,_tt:{user_unique_id:""},_tracker:null,_options:{},init(e,t,n){var r,o,s;if((t.appId||t.app_id)&&(this.appId=t.appId||t.app_id),this._options=t,!R)return;i(je,"init",this.appId,t);const a=window[ze];!a&&e?(this._tracker=new e("xgplayer_tracker"),window[ze]=this._tracker):this._tracker=a;const{channel:l,channel_domain:u}=t,c={app_id:this.appId,log:!1,disable_sdk_monitor:!0,enable_ab_test:!1,disable_auto_pv:!0,...t,channel:l||"cn",channel_domain:u};return null==(r=this._tracker)||r.init(c),null==(o=this._tracker)||o.getToken((e=>{this._tt=e})),this.config(n||{}),null==(s=this._tracker)||s.start(),this._tracker},config(e={}){const t={...e};w&&w.name&&!w.isChrome&&!w.isSafari&&(t.browser=w.name,w.appVersion&&(t.browser_version=w.appVersion));const n=e.user_unique_id||e.line_user_id||"";n&&(t.user_unique_id=n,t.web_id=n,this._tt={user_unique_id:n}),e.referrer&&(t.referrer=e.referrer,t.referrer_host=c(e.referrer)),this._tracker&&this._tracker.config(t)},getToken(){return this._tt},event(e,t){const{appId:n,_tracker:r,_tt:o}=Xe;i(je,`sendEvent_${n}`,!r,e,t),r&&(t.line_user_id||(t.line_user_id=(null==o?void 0:o.user_unique_id)||""),"function"==typeof r?r(e,t):r.event(e,t))}};Ve.Tracker=Xe;const Ke=function(e){if(e&&e.player){const t=e.player.config.vodLogOpts||{};e.player.vodLogger=new Ve(t,e.player),e.player.plugins.xgVodLogger=e.player.vodLogger}else this.vodLogger=new Ve(this.config.vodLogOpts||{},this)};Ke.initTracker=function(e,t={}){Xe.init(e,t)},Ke.configTracker=function(e){Xe.config(e)},Ke.pluginName="__xgVodLogger",Ke.playerConfig={},Ke.setABSdkVersion=e=>{Ve.AB_SDK_VERSION=e}}}]);