/*! For license information please see player-4.2d93ebb7.js.LICENSE.txt */ "use strict";!function(e,t){"object"==typeof module&&"object"==typeof module.exports?t():"function"==typeof define&&define.amd?define([],t):(e="undefined"!=typeof globalThis?globalThis:e||self)&&t()}(this,function(){"use strict";"object"==typeof window&&(window.openRedirect={version:"1.2.20",webpackPluginVersion:"3.4.22",reportOnly:!1})}),!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).xss={})}(this,function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var t,i=1,n=arguments.length;i/g,o=/&#([a-zA-Z0-9]*);?/gim,s=/"/g,u=/:?/gim,c=/&newline;?/gim,l=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,d=/u\s*r\s*l\s*\(.*/gi,h=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,f=/"/g,v=function(e){return e.replace(r,"<").replace(a,">")},_={indexOf:function(e,t){var i,n;for(i=0,n=e.length;i127&&n<2048?t+=String.fromCharCode(n>>6|192)+String.fromCharCode(63&n|128):t+=String.fromCharCode(n>>12|224)+String.fromCharCode(n>>6&63|128)+String.fromCharCode(63&n|128)}return t}(e);l>2,a=(3&t)<<4|(i=e.charCodeAt(l++))>>4,o=(15&i)<<2|(n=e.charCodeAt(l++))>>6,s=63&n,isNaN(i)?o=s=64:isNaN(n)&&(s=64),c=c+u.charAt(r)+u.charAt(a)+u.charAt(o)+u.charAt(s);return c}function y(e){var t,i,n,r,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c>4,i=(15&r)<<4|(a=s.indexOf(e.charAt(c++)))>>2,n=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(i)),64!==o&&(u+=String.fromCharCode(n));return function(e){for(var t="",i=0,n=0,r=0,a=0;i191&&n<224?(t+=String.fromCharCode((31&n)<<6|63&(a=e.charCodeAt(i+1))),i+=2):(a=e.charCodeAt(i+1),t+=String.fromCharCode((15&n)<<12|(63&a)<<6|63&(r=e.charCodeAt(i+2))),i+=3);return t}(u)}function T(e,t,i){var n="",r=0,a=!1,o=!1,s=0,u=e.length,c="",l="";e:for(s=0;s"===d||s===u-1){n+=i(e.slice(r,a)),c=function(e){var t,i=_.spaceIndex(e);return t=-1===i?e.slice(1,-1):e.slice(1,i+1),"/"===(t=_.trim(t).toLowerCase()).slice(0,1)&&(t=t.slice(1)),"/"===t.slice(-1)&&(t=t.slice(0,-1)),t}(l=e.slice(a,s+1)),n+=t(a,n.length,c,l,"0;t--){var i=e[t];if(" "!==i)return"="===i?t:-1}return -1}(e,c-1))){u(o,g(_.trim(e.slice(i,c)))),o=!1,i=c+1;continue}}}else{if(-1===(d=e.indexOf(l,c+1)))break;u(o,_.trim(e.slice(r+1,d))),o=!1,i=(c=d)+1}}else o=e.slice(i,c),i=c+1,r='"'===e.charAt(i)||"'"===e.charAt(i)?i:function(e,t){for(;te.charCodeAt(i)?" ":e.charAt(i);return _.trim(t)}(e=(e=(e=e.replace(s,'"')).replace(o,function(e,t){return"x"===t[0]||"X"===t[0]?String.fromCharCode(parseInt(t.substr(1),16)):String.fromCharCode(parseInt(t,10))})).replace(u,":").replace(c," "))}(i),"href"===t||"src"===t){if("#"===(i=_.trim(i)))return"#";if("http://"!==i.substr(0,7)&&"https://"!==i.substr(0,8)&&"mailto:"!==i.substr(0,7)&&"tel:"!==i.substr(0,4)&&"data:image/"!==i.substr(0,11)&&"ftp://"!==i.substr(0,6)&&"./"!==i.substr(0,2)&&"../"!==i.substr(0,3)&&"#"!==i[0]&&"/"!==i[0])return""}else if("background"===t){if(l.lastIndex=0,l.test(i))return""}else if("style"===t&&(h.lastIndex=0,h.test(i)||(d.lastIndex=0,d.test(i)&&(l.lastIndex=0,l.test(i)))))return"";return i=function(e){return e=v(e=e.replace(f,"""))}(i)}var x=function(e){return"string"==typeof e?e.replace(/'/g,'"').replace('=""',"").replace(/\s+/g,"").toLowerCase():""},R=function(){function e(e){var t=function(e){var t={};for(var i in e)t[i]=e[i];return t}(e||{});t.stripIgnoreTag&&(t.onIgnoreTag,t.onIgnoreTag=function(){return""}),t.whiteList={},t.onTag=function(){},t.onTagAttr=function(){},t.onIgnoreTag=function(){},t.onIgnoreTagAttr=function(){},t.safeAttrValue=E,t.escapeHtml=v,this.options=Object.assign(t,e)}return e.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t,i,n,r,a,o,s=this.options,u=s.whiteList,c=s.onTag,l=s.onIgnoreTag,d=s.onTagAttr,h=s.onIgnoreTagAttr,f=s.safeAttrValue,v=s.escapeHtml;s.stripBlankChar&&(e=(t=(t=e.split("")).filter(function(e){var t=e.charCodeAt(0);return!(127===t||t<=31&&10!==t&&13!==t)})).join("")),s.allowCommentTag||(e=function(e){for(var t="",i=0;i");var s=function(e){var t=_.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var i="/"===(e=_.trim(e.slice(t+1,-1)))[e.length-1];return i&&(e=_.trim(e.slice(0,-1))),{html:e,closing:i}}(n),p=u[i],g=b(s.html,function(e,t){var n=-1!==_.indexOf(p,e),r=d(i,e,t,n);return null==r?n?(t=f(i,e,t,null))?"".concat(e,'="').concat(t,'"'):e:null==(r=h(i,e,t,n))?void 0:r:r});return n="<".concat(i),g&&(n+=" ".concat(g)),s.closing&&(n+=" /"),n+=">"}return null==(o=l(i,n,a))?v(n):o},v);return p&&(g=p.remove(g)),g},e}(),A=Function("\nvar _checkXSS = function (it) {\n return it && it.Math == Math && it;\n};\nreturn _checkXSS(typeof globalThis === 'object' && globalThis) ||\n_checkXSS(typeof window === 'object' && window) ||\n_checkXSS(typeof self === 'object' && self) ||\n_checkXSS(typeof global === 'object' && global) ||\nFunction('return this')();\n")(),k=new(function(){function e(){var e=this;this.batchData=[],this.uniqKeys=new Set,this.timeout=2e3,this.lock=!1,this.getSlardarBid=function(){var t,i,n="douyin_web";if(!_.includes(n,"bid"))return n;if(e.config&&e.config.bid)return e.config.bid;if(A&&A._xssBid)return A._xssBid;if(A&&A.slardar&&"function"==typeof A.slardar.config){var r=(A.slardar.config()||{}).bid;if(r)return r}if(A&&A.Slardar&&"function"==typeof A.Slardar.config){var a=(A.Slardar.config()||{}).bid;if(a)return a}return(null===(i=null===(t=null==A?void 0:A.Slardar)||void 0===t?void 0:t._baseParams)||void 0===i?void 0:i.bid)||"argus"},this.getConfigRegion=function(){var t;return _.includes("cn","region")?e.config&&e.config.region?e.config.region:((null===(t=null==A?void 0:A.gfdatav1)||void 0===t?void 0:t.region)||"cn").toLowerCase():"cn"},this.gerReportUrl=function(){var t={cn:y("aHR0cHM6Ly9tb24uemlqaWVhcGkuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),boe:y("aHR0cHM6Ly9tb24uemlqaWVhcGkuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),ttp:y("aHR0cHM6Ly9tb24udXMudGlrdG9rdi5jb20vbW9uaXRvcl9icm93c2VyL2NvbGxlY3QvYmF0Y2gvc2VjdXJpdHkvP2JpZD0="),va:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),maliva:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),sg:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),boei18n:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9")}[e.getConfigRegion()];if(t)return t+e.getSlardarBid()}}return e.prototype.setConfig=function(e){this.config=e},e.prototype.upload=function(){var e=this,t=this.gerReportUrl();!this.lock&&t&&0!==this.batchData.length&&(this.lock=!0,setTimeout(function(){var i=e.batchData.slice(0,100);e.batchData=e.batchData.slice(100),A.fetch(t,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json"}}).catch(function(e){}),e.lock=!1,e.upload()},this.timeout))},e.prototype.generateKey=function(e){return e.collectKey?[e.collectMode,e.collectKey].join("___"):""},e.prototype.push=function(e){this.batchData.push(e),this.upload()},e.prototype.report=function(e){var t=this.generateKey(e);if(A.fetch&&e.collectKey){var i="object"==typeof window?window.location.href:"SSR";e.documentUrl=i;var n={age:Math.floor(Date.now()),type:"xss",url:i,body:e,"user-agent":""};"enforce"===e.disposition&&"SSR"!==i||(n.url=t),"SSR"===i&&(n.url="SSR___".concat(n.url),n.body.ssr=!0),this.push(n)}},e}()),S=function(e){for(var t=0,i=function(i){Array.isArray(e[i])?0===e[i].length?delete e[i]:(e[i]=_.from(_.uniq(e[i])),t+=e[i].length):0===_.keys(e[i]).length?delete e[i]:_.keys(e[i]).forEach(function(n){e[i][n]=_.from(_.uniq(e[i][n])),t+=e[i][n].length})},n=0,r=_.keys(e);n0)return t&&t("javascript:"),!1;if(/^javascript:/i.test(e)){var r=e.slice(11).replace(/\s/g,"").trim();return!!_.some(["void","void(0)","void0","false","undefined",";"],function(e){return e===r})||(t&&t("javascript:"),!1)}return!0}var w=function(e,t){var i,n,r="<%= isSaveValidUrl =>";if("string"!=typeof e||(n=Number("<%= urlLimit =>"),void 0!==i&&(n=i),"NaN"!==e.toString()&&-1!==n&&e.length>=n)||D(e,t))return e;try{if(!0===(r=JSON.parse(r))||"true"===r){var a=new URL(e);return a.origin+a.pathname}}catch(e){}return"#"};function O(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=[]),"string"!=typeof e)return!0;if(!D(e=L(e)))return!1;var r,a={url:(r=e.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/)||[])[0],scheme:r[1],slash:r[2],host:r[3],port:r[4],path:r[5],query:r[6],hash:r[7]},o=a.scheme,s=a.host;return n?!!n(e):!(!o||!s)&&(!_.includes(["http","https","file"],o)||("object"==typeof window&&window&&(t=i(i([],t,!0),[location.host],!1)),_.some(t,function(e){return!!(e instanceof RegExp&&e.test(s))||e===s})))}var B={a:["target","title","spellcheck","rel"],canvas:[],abbr:["title"],address:[],area:["shape","coords","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:["dir"],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["alt","title","width","height","decoding"],ins:["datetime"],li:[],mark:[],nav:[],ol:["start"],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],delete:[],form:[],strong:[],mask:["maskunits","x","y","width","height","fill"],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],wbr:[],video:["autoplay","controls","loop","preload","height","width"],svg:["viewBox","version","xmlns","fill","width","height","stroke","stroke-width","style"],path:["d","fill","opacity","stroke","p-id","fill-rule","clip-rule","stroke-width","stroke-linecap","stroke-linejoin","fill-opacity","mask"],rect:["x","y","width","height","fill","stroke","rx"],g:[]},P={collect:null,initCollect:function(){this.collect={whiteList:{},filterProtocol:[]}},removeCollect:function(){var e=S(this.collect),t=e.count,i=e.ret;return this.collect=null,{collectKey:0===t?null:JSON.stringify(i),collectMode:"white"}},onIgnoreTagAttr:function(e,t,n){return e&&_.indexOf(["href","src"],t)>-1?P.domainWhiteList&&Array.isArray(P.domainWhiteList)&&P.domainWhiteList.length>0&&!O(n,i([],P.domainWhiteList,!0))?"":"".concat(t,'="').concat(w(n,function(e){var t;null===(t=P.collect)||void 0===t||t.filterProtocol.push(e)}),'"'):e&&(_.indexOf(["style","class","id"],t)>-1||t.indexOf("data-")>-1)?"".concat(t,'="').concat(n,'"'):(P.collect.whiteList[e]=P.collect.whiteList[e]||[],void P.collect.whiteList[e].push(t))},onIgnoreTag:function(e,t){if("style"===e)return t;T(t,function(e,t,i,n){b(I(n).html.replace("/",""),function(e){P.collect.whiteList[i]=P.collect.whiteList[i]||[],P.collect.whiteList[i].push(e)})},v)},whiteList:B,mergeWhiteList:function(e){for(var t,i={},n=0,r=_.keys(B);n");var a=I(n),o=b(a.html,function(e,t){var n,r=0;if(F.blackList[i]&&_.includes(F.blackList[i],e)&&(H.collect.blackList[i]=H.collect.blackList[i]||[],H.collect.blackList[i].push(e),r++),F.blackAttrRegExps.length&&F.blackAttrRegExps.some(function(t){return t.test(e)})&&_.forEach(F.blackAttrRegExps,function(t){t.test(e)&&(H.collect.blackAttrRegExps.push("".concat(t.toString(),"->").concat(e)),r++)}),F.blackAttrs.length&&_.includes(F.blackAttrs,e)&&(F.blackAttrs.push(e),r++),!r){if(F.filterList&&F.filterList[i]&&_.includes(F.filterList[i],e)){var a=w(t,function(e){var t;null===(t=H.collect)||void 0===t||t.filterProtocol.push(e)});return a!==t&&(H.collect.filterList[i]=H.collect.filterList[i]||[],H.collect.filterList[i].push(e)),t?"".concat(e,"='").concat(a,"'"):e}return F.filterAttrs&&_.includes(F.filterAttrs,e)?((a=w(t,function(e){var t;null===(t=H.collect)||void 0===t||t.filterProtocol.push(e)}))!==t&&(null===(n=H.collect)||void 0===n||n.filterAttrs.push(e)),t?"".concat(e,"='").concat(a,"'"):e):t?"".concat(e,"='").concat(t,"'"):e}});return n="<".concat(i),o&&(n+=" ".concat(o)),a.closing&&(n+=" /"),n+=">"},v);null===(i=H.collect)||void 0===i||i.blackTags.push(e)}},V=function(e){var t=e.reportOnly,i=void 0===t||t,n=e.block;return i&&"all"===i?"report":("string"==typeof i&&("true"===i&&(i=!0),"false"===i&&(i=!1)),n?"enforce":i?"report":"enforce")},W=function(e){return function(i,n,r){if(!i||"string"!=typeof i)return i;var a=n;e===C&&(a=P).initCollect();var o=e(i,a);if(x(o)===x(i))return i;if(!r)return o;var s=r.logType,u=V(r),c=a.removeCollect();return k.report(t(t({type:s,disposition:u},c),{sourceText:m(i),filterText:m(o)})),"enforce"===u?o:i}},Z=W(function(e,t){return void 0===t&&(t={}),t&&t.whiteList||(t.whiteList={a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}),new R(t).process(e)}),Y=W(C),G=function(e,t,i){var n=[],r=w(e,function(e){n.push(e)});if(r===e)return e;n=_.from(_.uniq(n));var a=t||i||{};if(!a)return r;var o=a.logType,s=V(i);return k.report({type:o,disposition:s,collectKey:n.join("___"),collectData:JSON.stringify(n),collectMode:"black",sourceText:m(e),filterText:m(r)}),"enforce"===s?r:e},q=A._xssProject||{},z=A.xssNamespace||{},X="3.0.26",J={FilterXSS:R,version:X,webpackPluginVersion:"<%= webpackPluginVersion =>",reportOnly:"<%= reportOnly =>",filterXSS:Z,_filterXSS:Y,filterUrl:G,Config:P,BlackConfig:H,project:q,setProjectName:function(e){q[e]=this,A._xssProjectName=e}};z.douyin_web=J,A.xssNamespace=z,A.Math&&!A.Math.xssNamespace&&(A.Math.xssNamespace=z),q[X]=J,A.globalThis=A,A.getFilterXss=function(){return void 0!==this._xssProjectName?this._xssProject[this._xssProjectName]:J},A.xss=J,A.isSafeUrl=O,A.isSafeDomain=O,A.isSafeProtocol=D,A._xssProject=q,A._xssProjectName&&(q[A._xssProjectName]=J);var Q=J.setProjectName.bind(J);e.BlackConfig=H,e.Config=P,e.FilterXSS=R,e._filterXSS=Y,e.filterUrl=G,e.filterXSS=Z,e.isSafeDomain=O,e.isSafeProtocol=D,e.isSafeUrl=O,e.project=q,e.setProjectName=Q,e.setXssNamespace=function(e){var t=e.appId,i=e.bid,n=e.region;z[t]=J;P.bid=i,P.region=n,P.enabled=!0},e.xssNamespace=z,Object.defineProperty(e,"__esModule",{value:!0})}),(self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["75431"],{144144:function(e,t,i){i.d(t,{i:function(){return n}});let n="3.0.42"},418804:function(e,t,i){i.d(t,{Z:function(){return s}});var n=i(648955);i(173757),i(2885),i(248385),i(679308);var r=i(635957),a=i(358506),o=i.n(a);let s=(0,n.qH)(function e(){(0,n.PA)(this,e),o()(this),this.bodyId=0,this.isSwitchHeader=!1,this.workers={audio:null,video:null},this.init(),this.headerId=0,this.crypto=window.crypto||window.msCrypto},[{key:"init",value:function(){for(var e=this,t=Object.keys(this.workers),i=0;i2)||void 0===arguments[2]||arguments[2],n=this;return this.updateHeaderId(),new Promise(function(r){var a=Math.floor(1e3*Math.random()),o=n.getWorker(t);o&&o.postMessage({method:"decryptHeader",id:a,buf:e,isVideo:t,needRemux:i});var s=function(e){e.id===a&&(n.off("decryptHeader",s),r({data:e.args.data,vid:e.args.vid}))};n.on("decryptHeader",s)})}},{key:"updateValue",value:function(e){for(var t=Object.keys(this.workers),i=0;i2)||void 0===arguments[2]||arguments[2],n=e instanceof ArrayBuffer?e:e.buffer,r=this,a=r.bodyId+1;return r.bodyId=a,new Promise(function(e){var o=function(t){t.id===a&&(r.off("decryptBody",o),e({data:t.args.data,id:a,headerId:r.headerId}))};r.on("decryptBody",o);var s=r.getWorker(t);s&&s.postMessage({method:"decryptBody",id:a,args:{isVideo:t,id:r.workerIndex,aeskey:r.aeskey,buf:n,needRemux:i}},[n])})}}])},874768:function(e,t,i){i.d(t,{Z:function(){return o}});var n=i(648955),r=i(525231),a=(0,n.qH)(function e(t,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,n.PA)(this,e);a.playerVersion="3.5.41-rc.1",this.errorType=t,this.errorCode=("number"==typeof i?i:void 0)||r.WE[t][i]||r.WE[t],this.ext=a});a.DUR_PARSE_ERROR=9201,a.SEG_PARSE_ERROR=9202,a.INIT_SEGMENT_ERROR=9203,a.MPD_INIT_ERROR=9204,a.SEGMENT_CONTENT_ERROR=9205,a.BACK_URL_FAIL=9206,a.MSE_OPEN_TIMEOUT=9207;let o=a},737178:function(e,t,i){i.d(t,{Z:function(){return b},d:function(){return m}});var n=i(648955);i(346984),i(124300),i(162093),i(503e3),i(173757),i(932651),i(2885),i(248385),i(679308),i(591111),i(832674),i(905442),i(446336),i(808483),i(840938),i(118438),i(325598),i(92999),i(611067),i(273723),i(724016),i(803903),i(214604),i(901250),i(755006),i(437048),i(488336),i(825666),i(177162),i(286633),i(943281),i(810658),i(82726),i(224727),i(490629);var r=i(265614),a=i(338726),o=i(516968),s=i(982143),u=i(521323),c=i(298757),l=i(731751),d=i(358506),h=i.n(d),f=i(373974),v=i(405762),_=i(97447),p=["dynamicTimeoutAudioIns"];function g(e){if(window.Headers&&e instanceof Headers){var t,i={},r=(0,n.sf)(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;i[a[0]]=a[1]}}catch(e){r.e(e)}finally{r.f()}return i}return e}var m={loaderCount:1,loaderType:r.t.FETCH,onProcessMinLen:5120,enableDynamicMinLen:!0};function y(e,t){if(e.length>0){for(var i=0,n=!0,r=0;rt){n=!1;break}if((i+=a)/e.length>t&&(n=!1),!n)return!1}}return!0}var T=0,b=function(){var e,t,i,d,b,E;function x(e,t){var i=this,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",c=!(arguments.length>3)||void 0===arguments[3]||arguments[3];(0,n.PA)(this,x),h()(this),this._config=Object.assign({},m,(0,n.Zj)({responseType:"arraybuffer"},e)),this._needPreloadCache=c,this._loaderCount=1,this._config.loaderCount>1,this._loaderType=this._config.loaderType||r.t.FETCH,this._enableDynamicMinLen=this._config.enableDynamicMinLen,this._preloadManager=t,e.openLog&&a.Y.enable(),this._videoLoaders=[],this._audioLoaders=[],this._videoIdx=0,this._audioIdx=0;for(var l=this._config,d=l.dynamicTimeoutAudioIns,f=(0,n.Kd)(l,p),v=0;v0)){e.next=11;break}return e.next=9,this._preloadManager.getItem(t,!0);case 9:(a=e.sent)?(o=Object.assign({},a,this._preloadCacheDatas),o=v.Z.combinePreloadData(o),this._preloadManager.setItem(t,o,!0)):this._preloadManager.setItem(t,this._preloadCacheDatas,!0);case 11:this._preloadCacheDatas={};case 12:case"end":return e.stop()}},e,this)})),function(t,i){return e.apply(this,arguments)})},{key:"isSupportedProgress",value:function(){return 1===this._loaderCount&&"fetch"===this._loaderType}},{key:"_addCost",value:function(e){this._videoReqCosts.push(e),this._videoReqCosts.length>3&&this._videoReqCosts.shift()}},{key:"_addVideoSpeed",value:function(e){this._videoSpeeds.push(e),this._videoSpeeds.length>3&&this._videoSpeeds.shift()}},{key:"checkProgressSatisfied",value:function(e){var t=!1;if(navigator.connection&&navigator.connection.downlink)return t=!0,!(5*e/(1e6*navigator.connection.downlink)>4)&&!0;if(!y(this._videoReqCosts,4))return!1;var i=this._videoSpeeds.map(function(t){return 5e3*t/e});if(!y(i,4))return!1;if(!t&&0===i.length)try{try{var n=parseFloat(c.Xb.getItem(l.OU))||0;if(0===n||5e3*n/e>4)return!1}catch(e){}}catch(e){}return!0}},{key:"_cacheSpeed",value:function(e){var t,i=e.speed;x.historySpeed.length>=20&&x.historySpeed.shift(),x.historySpeed.push(i),this.emit(s.K.REAL_TIME_SPEED,(0,n.Zj)({speed:i,type:(null==e||null===(t=e.priOptions)||void 0===t?void 0:t.type)||l._R.CDN},e))}},{key:"_calCostTime",value:function(e,t){var i=this._reqCost[e?"pcdn":"cdn"];t<3*i.avg&&(i.count++,i.avg=(i.avg*(i.count-1)+t)/i.count)}},{key:"getReqCost",value:function(e){var t=this._reqCost[e];return(null==t?void 0:t.avg)||0}},{key:"load",value:(t=(0,n.x)((0,n.l5)().mark(function e(t,i,r,a){var o,s,c,d,h,p,m,y,T,b,E,x,R,A,k,S,C,I,L,D,w,O,B,P,M,N,U,F,j=arguments;return(0,n.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=j.length>4&&void 0!==j[4]&&j[4],s=j.length>5&&void 0!==j[5]?j[5]:null,c=j.length>6&&void 0!==j[6]?j[6]:null,d=j.length>7&&void 0!==j[7]?j[7]:null,h=j.length>8&&void 0!==j[8]?j[8]:null,a.vtype=f.l0.DASH,a.isPreload=o,a.range=r,p={start:a.start,end:a.end,bandwidth:a.bandwidth||a.bitrate,sequence:a.idx,fps:a.fps,mediaType:t,selectedIdx:a.selectedIdx,definition:a.definition,range:r.concat(),startRaw:a.startRaw,endRaw:a.endRaw},m=this._config.onProcessMinLen,this._enableDynamicMinLen&&p.bandwidth&&s&&(y=0===a.start?.5:1,m=Math.floor(p.bandwidth*y/8)),!(this._preloadManager&&a.checkPreload)){e.next=25;break}if(T=v.Z.nowTime(),b=null,!this._preloadManager.supportSync()){e.next=18;break}b=this._preloadManager.getPreLoadDataSync(a),e.next=21;break;case 18:return e.next=20,this._preloadManager.getPreLoadData(a);case 20:b=e.sent;case 21:if(!(b&&b.res instanceof ArrayBuffer)){e.next=25;break}return u.ZP.log("changeState preload hit cache",b.cacheKey,"cost",v.Z.nowTime()-T,"ms","isPreload",o),s&&s(b.res,!0,{range:r,fromCache:!0},null,a),e.abrupt("return",{res:b.res,headers:b.headers,status:b.status,fromCache:!0,selectedIdx:a.selectedIdx,extData:p,orgDefinition:b.orgDefinition,cacheKey:b.cacheKey,duration:b.duration});case 25:if(E=a.isPCDN,x=a.urlList,R=a.outChangeUrlRetry,A=(!s||this._isSupportUrlRange)&&(this._config.useUrlRange||a.useUrlRange||!1)&&!E,k=i,A&&r&&r.length>1&&(k="".concat(i+(i.split("?")[1]?"&":"?"),"range=").concat(r[0],"-").concat(r[1])),(!r||0===r.length||A)&&(r=void 0),S=performance.now(),u.ZP.log(this._config.vid,"load res start:",JSON.stringify(a),"startTime",S,"userUrlRange",A,"onProgress",!!s,"onProcessMinLen",m),e.prev=33,I=this._getLoader(t,a)){e.next=37;break}return e.abrupt("return");case 37:return L=this._config.headers||{},D=a.reqOptions||{},e.next=41,I.load(k,(0,n.Zj)({urlList:x,outChangeUrlRetry:R,range:r,onProgress:s,selectedIdx:a.selectedIdx,sequence:a.idx,initSegment:a.initSegment,onProcessMinLen:m,onCancel:c,timeout:d,onTimeout:h,headers:E?Object.assign({},L,{"X-Origin-Server-Host":a.cdnHost}):L,priOptions:{type:E?l._R.PCDN:l._R.CDN,extData:a}},D));case 41:if(w=e.sent){e.next=44;break}return e.abrupt("return",null);case 44:return"video"===t&&this._addCost((performance.now()-S)/1e3),O=w.data,B=w.response,P={res:O instanceof Uint8Array?O.buffer:O,headers:g(B.headers),status:B.status,duration:a.end-a.start||0,memory:O.byteLength,vtype:_.Z.vtype,mediaType:t,costTime:0,range:r,isInitSegment:a.initSegment,fileId:a.fileId},M=performance.now()-S,u.ZP.log("load res finish: ",JSON.stringify(a),"cost time",M,"ms","range",null===(C=P.headers)||void 0===C?void 0:C["content-range"]),this._calCostTime(E,M),a.checkPreload&&!O.done&&this._needPreloadCache&&(N=v.Z.generateRequestUniqueKey(a),this._preloadCacheDatas[N]=P),e.abrupt("return",(0,n.Zj)((0,n.Zj)({},P),{},{extData:p,selectedIdx:a.selectedIdx,isPCDN:E,costTime:M,url:i}));case 54:return e.prev=54,e.t0=e.catch(33),u.ZP.log("loader error",{msg:e.t0.message}),e.abrupt("return",{res:"error",status:null===(U=e.t0.response)||void 0===U?void 0:U.status,header:g(null===(F=e.t0.response)||void 0===F?void 0:F.headers),error:e.t0,isPCDN:E,url:k,bitrate:a.bandwidth||p.bandwidth,costTime:-1});case 58:case"end":return e.stop()}},e,this,[[33,54]])})),function(e,i,n,r){return t.apply(this,arguments)})},{key:"_getLoader",value:function(e,t){var i="video"===e;if(t.moof)return i?this._moofVideoLoader:this._moofAudioLoader;if(t.initSegment){var n=i?this._moofVideoLoader:this._moofAudioLoader;if(n&&null!==n._currentTask)return n}if(i){var r=this._videoLoaders[this._videoIdx];return this._videoIdx++,this._videoIdx>=this._videoLoaders.length&&(this._videoIdx=0),r}var a=this._audioLoaders[this._audioIdx];return this._audioIdx++,this._audioIdx>=this._audioLoaders.length&&(this._audioIdx=0),a}},{key:"cancel",value:(i=(0,n.x)((0,n.l5)().mark(function e(t){var i;return(0,n.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=6;break}return i="video"===t?this._videoLoaders:this._audioLoaders,e.next=4,this.cancelLoaders(i);case 4:e.next=10;break;case 6:return e.next=8,this.cancelLoaders(this._audioLoaders);case 8:return e.next=10,this.cancelLoaders(this._videoLoaders);case 10:if(!this._moofVideoLoader){e.next=13;break}return e.next=13,this._moofVideoLoader.cancel();case 13:if(!this._moofAudioLoader){e.next=16;break}return e.next=16,this._moofAudioLoader.cancel();case 16:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"cancelLoaders",value:(d=(0,n.x)((0,n.l5)().mark(function e(t){var i,r,a;return(0,n.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=(0,n.sf)(t),e.prev=1,i.s();case 3:if((r=i.n()).done){e.next=9;break}return a=r.value,e.next=7,a.cancel();case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),i.e(e.t0);case 14:return e.prev=14,i.f(),e.finish(14);case 17:case"end":return e.stop()}},e,null,[[1,11,14,17]])})),function(e){return d.apply(this,arguments)})},{key:"getCurrentTask",value:function(e){var t="video"===e,i=t?this._moofVideoLoader:this._moofAudioLoader,n=t?this._videoLoaders[0]:this._audioLoaders[0];return(null==i?void 0:i._currentTask)||(null==n?void 0:n._currentTask)}},{key:"cancelTasks",value:(b=(0,n.x)((0,n.l5)().mark(function e(t){var i,r,a,o,s=arguments;return(0,n.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a=(r="video"===t)?this._moofVideoLoader:this._moofAudioLoader,o=r?this._videoLoaders[0]:this._audioLoaders[0],!a){e.next=7;break}return e.next=7,this._filterTask(a,i);case 7:if(!o){e.next=10;break}return e.next=10,this._filterTask(o,i);case 10:case"end":return e.stop()}},e,this)})),function(e){return b.apply(this,arguments)})},{key:"_filterTask",value:(E=(0,n.x)((0,n.l5)().mark(function e(t,i){var r,a,o,s,u,c,l,d;return(0,n.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(r=[],a=t._queue,i&&t._currentTask&&r.push(t._currentTask.cancel()),o=a.length-1;o>-1;o--)l=null===(s=(c=a[o]).priOptions)||void 0===s||null===(s=s.extData)||void 0===s?void 0:s.isInitSegment,d=null===(u=c.priOptions)||void 0===u||null===(u=u.extData)||void 0===u?void 0:u.isSlice,!(l||d)&&(r.push(c.cancel()),a.splice(o,1));return e.next=6,Promise.all(r);case 6:case"end":return e.stop()}},e)})),function(e,t){return E.apply(this,arguments)})},{key:"destroy",value:function(){this.cancel();for(var e=0;e1&&i.core>=Number(a[0])&&i.core<=Number(a[1])&&(o=!0);break;case"memory":i.memory&&a.length>1&&i.memory>=Number(a[0])&&i.memory<=Number(a[1])&&(o=!0);break;case"video_screen_mode":;if(a.length>0&&"landscape"===a[0]&&(n=i.videoHeight,r=i.videoWidth,n&&r&&r>n))o=!0;break;case"encoder":a.length>0&&a[0]&&i.codecType&&a[0]===i.codecType&&(o=!0)}return o}},{key:"updateParamsByFactor",value:function(e){for(var t=this,i=this.playerConfig,n=i.codecType,r=i.videoHeight,a=i.videoWidth,o=0|window.navigator.deviceMemory,s=0|window.navigator.hardwareConcurrency,u=null,c={codecType:n,videoHeight:r,videoWidth:a,memory:o,core:s},l=0;l0&&this.updateParamsByFactor(t),this._bindEvent(),this.bitRateAdapter=new s.ZP({config:this.config},this.player),!f&&(f=new s.ZP({config:this.config})),h.setConfig(this.config.detectConfig||{}),h.resetCurrent()}},{key:"beforePlayerInit",value:function(){this.curBitRate=this.getInitBitrate(),this.player.curDefinition=this.curBitRate}},{key:"_bindEvent",value:function(){this.on("xglog",this._onXLog)}},{key:"getInitBitrate",value:function(){if(!this.config.disabled){var e=this.player,t=this.config,i=this.playerConfig;v=i.userSelectDefinition;var n=this.getSuitableBitrate(e.definitionList,i.userSelectDefinition);return n?i.url=n.url:n={url:i.url,definition:i.defaultDefinition||t.definition,bitrate:i.defaultBitrate||i.bitrate,type:s.vK.DEFAULT},n.networkSpeed=n.speed||(0,s.zP)(this.config.speedAlgoType),n}}},{key:"getSuitableBitrate",value:function(e,i){var n=new o.Z;if(this.selectInfo={},e=(0,l.VX)(e,"video"),e=t._applySelectBitrateFactor(e),!!this.bitRateAdapter&&!!e&&!(e.length<1)){var r=this.config,a=this.config.bitrateKey;(0,l.QS)(e,a),this.bitRateAdapter.analysis=n;var u=(0,s.zP)(this.config.speedAlgoType);if(this.bitRateAdapter.speed=u,null!==(y=r.playlist_select_bitrate)&&void 0!==y&&y.enable_playlist_factor){var f=(0,d.B)(u,r,this.selectInfo).factor;this.bitRateAdapter.speed=u*f}this.updateSelectInfo("oriRateCnt",(null===(T=e)||void 0===T?void 0:T.length)||0),this.updateSelectInfo("vid",(null===(b=e[0])||void 0===b?void 0:b.vid)||""),this.updateSelectInfo("type","member"),this.updateSelectInfo("speed",this.bitRateAdapter.speed);var v=e.sort(function(e,t){return t._xgOrgBitrate-e._xgOrgBitrate}),_=this.getAdaptBitrate(v);this.updateSelectInfo("filterRateCnt",(null===(E=_)||void 0===E?void 0:E.filterRateCnt)||0),this.updateSelectInfo("isFilterMaxRateAdapt",(null===(x=_)||void 0===x?void 0:x.isFilterMaxRate)||0),this.updateSelectInfo("bitrateSetSelector",(null===(R=_)||void 0===R?void 0:R.bitrateSetSelector)||[]),this.updateSelectInfo("qualityBitrateSelector",(null===(A=_)||void 0===A?void 0:A.qualityBitrateSelector)||[]);var p=_?_.duration:0,g=(null===(k=_)||void 0===k?void 0:k._targetBitrate)||(null===(S=_)||void 0===S?void 0:S._xgOrgBitrate);this.updateSelectInfo("adaptTarRate",g);var m=this.config.mode;if(this.updateSelectInfo("mode",m),m&&m===s.vP.BANDWIDTH){var y,T,b,E,x,R,A,k,S,C,I,L=0;if(!(null!==(C=this.bitRateAdapter)&&void 0!==C&&C.speed)||this.bitRateAdapter.speed<0||1!==r.mixFactor){var D=Object.assign({},this.config);D.mode=s.vP.BUFFER_INFO;var w=new s.ZP({_config:D},this.player);w.speed=this.bitRateAdapter.speed;var O=null==w?void 0:w.select(e,D.mode,this.bitRateAdapter.speed);this.updateSelectInfo("isFilterMaxRateBuf",O.isFilterMaxRate),L=(null==O?void 0:O._targetBitrate)||(null==O?void 0:O._xgOrgBitrate),this.updateSelectInfo("buffTarRate",L)}I=!this.bitRateAdapter.speed||this.bitRateAdapter.speed<0?L:(null==r?void 0:r.mixFactor)>=0&&r.mixFactor<=1?g*r.mixFactor+L*(1-r.mixFactor):(null==r?void 0:r.mixFactor)>1?Math.max(g,L):Math.min(g,L),this.updateSelectInfo("finalTarRate",I),!(_=(0,l.v2)(e,I,this.config.selectAlgType))&&(_=e[e.length-1]),_._targetBitrate=I}var B=this.bitRateAdapter.getTargetBitrate(p,e,this.bitRateAdapter.speed);if(B&&(h.targetBitRate=B),i){this.updateSelectInfo("mode","userSelect");var P=t.getUserSelectBitrate(v,i);P&&(h.selectBitRate=P._xgOrgBitrate,h.updateBitRateInfo(P._xgOrgBitrate,B),_=P,n.type=o.A.USER_SELECT)}if(!i&&this.config.overscore&&this.config.overscore.isOpen){var M=(0,c.P)(_,v,this.config.overscore);n.type=o.A.SR,_=M}return _&&(_.speed=this.bitRateAdapter.speed,this.updateSelectInfo("isOriMaxRate",(0,s.gH)(v,_)),this.updateSelectInfo("selectRate",_._xgOrgBitrate||-1)),"function"==typeof this.config.selectInfoBack&&this.config.selectInfoBack(this.selectInfo),_&&(_.chosenType=n.type,_.chosenReason=n.reason),_}}},{key:"getAdaptBitrate",value:function(e){if(!this.config.disabled){this.player;var t=null,i=this.config.bitrateKey;return(e=(0,l.QS)(e,i))&&e.length&&this.bitRateAdapter&&(t=this.bitRateAdapter.select(e,null,this.bitRateAdapter.speed)),t&&(t.type=s.vK.BITRATE_ADAPTER),t}}},{key:"getDefinition",value:function(e,t,i){for(var n=-1,r=0;rn+1?e[n+1]:!i&&n-1>=0?e[n-1]:null}},{key:"needChangeDefinition",value:function(){var e=this.player,i=e.curDefinition,n=e.definitionList,r=this.playerConfig,a=r.userSelectDefinition,o=r.extDefinition,s=o&&o.length>0?o:n,u={type:0,message:"DO_NOT_UPDATE",targetDefinition:null};if(!a||s.length<2)return u;var c=i;a&&(c=t.getUserSelectBitrate(s,a));var l=h.checkDefinition();u.type=l;var d=this.getAdaptBitrate(s);if(!d||0===l||!d||!d._xgOrgBitrate||!c||!c._xgOrgBitrate)return u.message="DO_NOT_UPDATE",u;var f=d._xgOrgBitrate>=c._xgOrgBitrate,v=d._xgOrgBitrate=0&&(null===(D=n)||void 0===D?void 0:D.mixFactor)<=1?B*n.mixFactor+P*(1-n.mixFactor):(null===(w=n)||void 0===w?void 0:w.mixFactor)>1?Math.max(B,P):Math.min(B,P),!(y=(0,l.v2)(e,O,n.selectAlgType))&&(y=e[e.length-1]),y._targetBitrate=O,t.updateStaticSelectInfo("finalTarRate",O)}y&&(y.type="bitRateAdapter");var F=y?y.duration:0,j=f?f.getTargetBitrate(F,e):null;if(j&&(h.targetBitRate=j),i){var K=t.getUserSelectBitrate(m,i);K&&(h.selectBitRate=K._xgOrgBitrate,h.updateBitRateInfo(K._xgOrgBitrate,j),y=K,a.type=o.A.USER_SELECT)}if(!i&&n.overscore&&n.overscore.isOpen){var H=(0,c.P)(y,m,n.overscore);a.type=o.A.SR,y=H}return t.updateStaticSelectInfo("isOriMaxRate",(0,s.gH)(m,y)),t.updateStaticSelectInfo("selectRate",(null===(x=y)||void 0===x?void 0:x._xgOrgBitrate)||-1),"function"==typeof n.selectInfoBack&&n.selectInfoBack(t.staticSelectInfo),y&&(y.chosenType=a.type,y.chosenReason=a.reason),y}}},{key:"updateStaticSelectInfo",value:function(e,i){t.staticSelectInfo[e]=i}},{key:"_applySelectBitrateFactor",value:function(e){var t,i=null===(t=e[0])||void 0===t?void 0:t.vid;if(i){var a=r.w.getInstance().findStrategy("vod-live-joint-optimize");if(a){var o=a.getSelectBitrateFactor(i);o.value>0&&(e=e.map(function(e){return(0,n.Zj)((0,n.Zj)({},e),{},{degFactor:o})}))}}return e}},{key:"getUserSelectBitrate",value:function(e,t){if(t&&e&&e.length>0){for(var i=null,n=null,r=0;ri.video.duration&&(i._info.downloadDuration=(Date.now()-i._info.canPlayTime)/1e3)}),(0,n._x)(this,"_onTick",function(){var e=i.video;if(!!e){i._timer=setTimeout(i._onTick,500);var t=e.currentTime;if(e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState){i._prevCurrentTime=t;return}i._prevCurrentTime===t?!i._prevStallTime&&(i._prevStallTime=Date.now()):i._calcStallTime(),i._prevCurrentTime=t}}),this.video=t,this._timer=null,this._prevPauseTime=0,this._prevStallTime=0,this._prevCurrentTime=0,this.resetInfo(),this.enable()},[{key:"isStalling",get:function(){return!!this._prevStallTime}},{key:"enable",value:function(){this.disable();var e=this.video;if(!!e)e.addEventListener("play",this._onPlay),e.addEventListener("pause",this._onPause),e.addEventListener("canplay",this._canPlay),e.addEventListener("progress",this._onProgress),e.addEventListener("ended",this._onEnded),this._timer=setTimeout(this._onTick,500)}},{key:"disable",value:function(){clearTimeout(this._timer),this.resetInfo();var e=this.video;if(!!e)e.removeEventListener("play",this._onPlay),e.removeEventListener("pause",this._onPause),e.removeEventListener("canplay",this._canPlay),e.removeEventListener("progress",this._onProgress),e.removeEventListener("ended",this._onEnded)}},{key:"endPlay",value:function(){if(!!this.video){var e=this.video.buffered;if(e.length)try{this._info.endBufferTime=e.end(e.length-1)}catch(e){}this._info.leaveWithBlock=this.isStalling,this._calcPausedTime(),this._calcStallTime(),!this._info.downloadDuration&&this._info.canPlayTime&&(this._info.downloadDuration=(Date.now()-this._info.canPlayTime)/1e3)}}},{key:"getInfo",value:function(){return this._info}},{key:"resetInfo",value:function(){this._prevPauseTime=0,this._prevStallTime=0,this._prevCurrentTime=0,this._info={pausedTime:0,stalledTime:0,downloadDuration:0,startBufferTime:0,endBufferTime:0,canPlayTime:0,leaveWithBlock:!1}}},{key:"destroy",value:function(){this.disable(),this.video=null}},{key:"_calcStallTime",value:function(){this._prevStallTime&&(this._info.stalledTime+=(Date.now()-this._prevStallTime)/1e3,this._prevStallTime=0)}},{key:"_calcPausedTime",value:function(){this._prevPauseTime&&(this._info.pausedTime+=(Date.now()-this._prevPauseTime)/1e3,this._prevPauseTime=0)}}])},78346:function(e,t,i){function n(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function r(e,t){var i=[];return e.forEach(function(e){(!e.mediaType||e.mediaType===t)&&i.push(e)}),i}i.d(t,{QS:function(){return o},VX:function(){return r},kM:function(){return n},v2:function(){return a}}),i(346984),i(248385),i(759943),i(414931),i(240148),i(663030);function a(e,t,i){return i?1===i?function(e,t){if(!e)return null;for(var i=-1,n=0;n=e[n]._xgOrgBitrate){i=n;break}return i<0?null:e[i]}(e,t):void 0:function(e,t){if(!e)return null;var i,n=1/0;return(e.forEach(function(e){var r=Math.abs(e._xgOrgBitrate-t);n>r&&(i=e,n=r)}),i)?i:null}(e,t)}function o(e,t){return e.forEach(function(e){e[t]?e._xgOrgBitrate=e[t]:e.bitrate&&(e._xgOrgBitrate=e.bitrate)}),e}},943643:function(e,t,i){i.d(t,{Z:function(){return d}});var n,r=i(330124);i(346984),i(303846),i(802824),i(9498),i(2885),i(248385),i(496423),i(679308),i(88856),i(759943),i(706056),i(228983),i(663030);var a=i(298757),o=i(44589),s=i(611344),u=i(770932),c={description:"",name:"__PRE_CACHE__",storeName:"keyvaluepairs",version:1},l="__PRE_CACHE__KEYS";let d=(0,r.qH)(function e(t,i){(0,r.PA)(this,e),this._allCachedKeyMap={},this._memory=0,this._cnt=0;var n=i===o.Rr.MEMORY?u.Z:s.Z;this._cacheType=i,this._driver=new n,this._driver._initStorage(c).catch(function(){}),this._hasIdbForbidden=!1,this._maxCache=!t||t<=0?200:t,this.setMaxCache(this._maxCache),this._allCachedKeys={},this._allCachedTimeKeys={},this.getCachedKeysFromLocal(),this._readyPromise=new a.XK,this.init()},[{key:"supportSync",value:function(){return this._cacheType===o.Rr.MEMORY}},{key:"getCachedKeysFromLocal",value:function(){var e=a.Xb.getItem(l);if(e){for(var t=e.split("|"),i=0;i0){var a=t.slice(0,i);n=t.slice(i);for(var o=0;o0&&(this._maxCache=e)}},{key:"getMemoryInfo",value:function(){return{memory:this._memory,cnt:this._cnt}}}])},4610:function(e,t,i){i.d(t,{XB:function(){return n},cF:function(){return r},eq:function(){return s},uZ:function(){return a}}),i(487689),i(2885);var n={beta:.49,eta:5200,gamma:1100};function r(e,t,i,n){for(var r=1-(1-a(t,0,1))*(1-o(n,e.beta,e.eta,e.gamma)),s=n,u=i;u-s>1;){var c=(s+u)/2;o(c,e.beta,e.eta,e.gamma)0&&i.eta>0&&i.gamma>0)&&(i=t)}catch(e){i=t}return i}},405935:function(e,t,i){function n(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function r(e,t){for(var i=0;i10){var i=t.pop();i&&(this.fps=Math.floor(1e4/(e-i)),this.updateFpsInfo())}!this.isStoped&&(this.rafId=window.requestAnimationFrame(this.step))}},{key:"updateFpsInfo",value:function(){this.fps>this.maxFps&&(this.maxFps=this.fps)}},{key:"start",value:function(){if(void 0!==window.requestAnimationFrame)this.isStoped=!1,this.rafId=window.requestAnimationFrame(this.step)}},{key:"stop",value:function(){window.cancelAnimationFrame(this.rafId),this.isStoped=!0}}],[{key:"install",value:function(){r.Z.install()}}]),e}()},786933:function(e,t,i){i.d(t,{Z:function(){return r}});var n=i(405935);let r=function(){function e(){(0,n.PA)(this,e),this.timeID=null,this.func=null}return(0,n.qH)(e,[{key:"repeat",value:function(e,t){this.timeID=1,this.repeatInterval(e,t)}},{key:"repeatInterval",value:function(e,t){var i=this;if(!this.timeID)return;if(null===this.func&&(this.func=e),this.func===e)this.timeID&&clearTimeout(this.timeID),this.timeID=null,this.timeID=setTimeout(function(){e(),i.repeatInterval(e,t)},t)}},{key:"clear",value:function(){clearTimeout(this.timeID),this.timeID=null}}]),e}()},856894:function(e,t,i){i.d(t,{Z:function(){return d}});var n=i(315355),r=i(919209),a=i(272787);i(248385),i(679308),i(705574),i(451236),i(503e3),i(346984);var o=i(126980),s=i(30222),u=i(548872),c=i(874668),l=i(597931),d=new(function(){function e(){(0,n.Z)(this,e),(0,a.Z)(this,"_queue",[]),(0,a.Z)(this,"_pendingDecoder",null),(0,a.Z)(this,"TAG","DecoderCache")}return(0,r.Z)(e,[{key:"genDecoder",value:function(e){return this._initDecoder(e)}},{key:"_initDecoder",value:function(e){var t,i,n=this,r=(0,c.tT)(),a=r.preloadDecoder,d=r.maxDecodeOnceWasm;e=e||a;var h=(0,c.P_)(),f=h.H264_DECODER_URL,v=h.H265_SIMD_DECODER_URL,_=h.H265_DECODER_URL,p=h.H265_THREAD_DECODER_URL,g=1;if("h265"===e&&((0,c.yJ)()?(t=new o.Z,i=v,g=2):(0,c.Bo)()&&(0,c.tT)().canUseThreadMode?(t=new s.Z,i=p,g=1):(t=new o.Z,i=_,g=3)),"h264"===e&&(t=new u.Z,i=f,g=3),!t)return Promise.resolve();var m=(0,l.Je)();t.postMessage({msg:"preload",batchDecodeCount:d,url:i}),this._pendingDecoder=t,t.id=Date.now()+parseInt(1e3*Math.random()),t.isHevc="h265"===e,t.using=!1,t.ready=!1,l.kg.log(this.TAG,"start init decoder worker, id=",t.id,"hevc=",t.isHevc,"mode=",g);var y=function e(i){n._pendingDecoder=null;var r=i.data.msg;switch(("DECODER_READY"===r||"INIT_FAILED"===r)&&(t.removeEventListener("message",e),t.removeEventListener("error",T)),r){case"DECODER_READY":l.kg.log(n.TAG,"decoder worker inited!, id=",t.id,"cost:",i.data.cost),t.ready=!0,!t.using&&n._queue.push(t),m.resolve();break;case"INIT_FAILED":l.kg.log(n.TAG,"decoder worker init failed!",i.data.log),m.reject(i.data.log)}},T=function e(i){t.removeEventListener("message",y),t.removeEventListener("error",e),m.reject(null==i?void 0:i.message)};return t.addEventListener("message",y),t.addEventListener("error",T),m}},{key:"cacheDecoder",value:function(e){e.using=!1,e.ready=!0,!e.id&&(e.id=Date.now()+parseInt(1e3*Math.random())),this._queue.push(e),l.kg.log(this.TAG,"cache decoder, id=",e.id),"h265"===(0,c.tT)().preloadDecoder&&1===this._queue.filter(function(e){return!e.using&&e.isHevc}).length&&this.genDecoder("h265")}},{key:"getCachedDecoder",value:function(e){var t,i=this._queue.findIndex(function(t){return!t.using&&t.isHevc===e});if(-1!==i&&(t=this._queue.splice(i,1)[0]),!t&&this._pendingDecoder&&(t=this._pendingDecoder,this._pendingDecoder=null),t)return t.using=!0,l.kg.warn(this.TAG,"get cached decoder, id=".concat(t.id,", ready=").concat(t.ready)),t}}]),e}())},534611:function(e,t,i){i.d(t,{NW:function(){return n},R_:function(){return r},ZP:function(){return a}});var n={WAITING:0,CANPLAY:1,PLAY:2,PLAYING:3,PAUSE:4,SEEKING:5,SEEKED:6,LOADEDDATA:7,LOADEDMETADATA:8,TIMEUPDATE:9,DURATION_CHANGE:10,VOLUME_CHANGE:11,PROGRESS:12,ERROR:13,ENDED:14,RESIZE:15,LOADSTART:16,DECODE_FPS:17,LOW_DECODE:18,LARGE_AV_GAP:19,FIRST_FRAME:20,CANVAS_LAYOUT:21},r=["waiting","canplay","play","playing","pause","seeking","seeked","loadeddata","loadedmetadata","timeupdate","durationchange","volumechange","progress","error","ended","resize","loadstart","decodefps","lowdecode","largeavgap","firstframe","canvaslayout"],a={AUDIO:{AUDIO_READY:"audio_ready",AUDIO_NOT_ALLOWED_AUTOPLAY:"audio_not_allowed_autoplay",AUDIO_WAITING:"audio_waiting",AUDIO_SYNC_DTS:"audio_sync_dts"},VIDEO:{VIDEO_DECODER_INIT:"video_decode_init",VIDEO_READY:"video_ready",VIDEO_WAITING:"video_waiting",AUTO_RUN:"auto_run",DECODE_LOW_FPS:"decode_low_fps",UPDATE_VIDEO_FILLTYPE:"update_video_filltype",UPDATE_VIDEO_COVER_POSITION:"update_video_cover_position"},TIMELINE:{PLAY_EVENT:"play_event",SET_METADATA:"set_metadata",APPEND_CHUNKS:"append_chunks",START_RENDER:"start_render",DO_PLAY:"do_play",DO_PAUSE:"do_pause",DO_SEEK:"do_seek",SET_PLAYBACKRATE:"set_playbackrate",SYNC_DTS:"sync_dts",RESET_BASE_DTS:"reset_base_dts",UPDATE_VOLUME:"update_volume",SINGLE_TRACK:"single_track",DESTROY:"destroy",READY:"ready",UPDATE_GL_OPTIONS:"update_gl_options",SET_VIDEO_DURATION:"set_video_duration",SET_PLAY_MODE:"set_play_mode",UPDATE_CAPABILITY_LEVEL:"update_capability_level",INNER_DEGRADE:"inner_degrade",ADJUST_SEEK_TIME:"adjust_seek_time",CHASE_FRAME:"chase_frame",END_OF_STREAM:"end_of_stream",UPDATE_SEGMENT_END:"update_segment_end"},VIDEO_EVENTS:n,DECODE_EVENTS:{INIT:"init",READY:"decoderready",REMUX:"remux",INIT_FAILED:"initfailed",DATAREADY:"dataReady",PLAY_FAILED:"playfailed",FRAGMENT_END:"fragmentEnd",APPEND_VIDEO:"appendVideo",FIRST_FRAME:"firstFrame",DECODED:"decoded",RENDE_END:"rendeEnd",CHASE_VIDEO_FRAME:"chaseVideoFrame",CHASE_VIDEO_FRAME_END:"chaseVideoFrameEnd",CHASE_AUDIO_FRAME:"chaseAudioFrame",INIT_SEGMENT:"initSegment",MEDIA_SEGMENT:"mediaSegment",FRAME_MAX_COUNY:"frameMaxCount",FRAME_MIN_COUNY:"frameMinCount"}}},395239:function(e,t,i){i.d(t,{S:function(){return o}});var n=i(315355),r=i(919209);i(932651),i(802824),i(124300),i(248385),i(911254),i(905442),i(446336),i(808483),i(840938),i(118438),i(325598),i(92999),i(611067),i(273723),i(724016),i(803903),i(214604),i(901250),i(755006),i(437048),i(488336),i(825666),i(177162),i(286633),i(943281),i(810658),i(82726),i(224727),i(832674);var a=i(597931),o=function(){function e(t,i){(0,n.Z)(this,e),this.TAG="FrameRender",this.configs=Object.assign({},t),this.parent=i,this.canvas=this.configs.canvas,this.meta=Object.assign({},this.configs.meta),this._initMeta(),this._initContextGL(),this.contextGL&&(this._initProgram(),this._initBuffers(),this._initTextures())}return(0,r.Z)(e,[{key:"_initMeta",value:function(){this.chroma=this.meta.chromaFormat,this.height=this.meta.height,this.width=this.meta.width,(this.canvas.width!==this.meta.width||this.canvas.height!==this.meta.height)&&(this.canvas.width=this.meta.width,this.canvas.height=this.meta.height,this.parent.emitResizeEvent())}},{key:"_initContextGL",value:function(){if("2d"===this.configs.type){this.ctx=this.canvas.getContext("2d");return}for(var e=this.canvas,t=null,i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],n=0;!t&&n1){if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength,n=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 i=this._xhr=new XMLHttpRequest;i.open(this._method||"GET",this._url,!0),i.responseType=this._responseType;var n=this._dynamicTimeoutIns&&"function"==typeof this._dynamicTimeoutIns.getTimeout?this._dynamicTimeoutIns.getTimeout(this._timeout):this._timeout;n&&(i.timeout=n),this._logger.debug("[dytimeout], xhr set timeout",n),i.withCredentials=this._withCredentials,i.onload=this._onLoad.bind(this),i.onreadystatechange=this._onReadyStatechange.bind(this),i.onerror=function(e){t._running=!1;var i,n,a,o=new r.C(t._url,t._request,null==e?void 0:null===(i=e.currentTarget)||void 0===i?void 0:i.response,"xhr.onerror.status:"+(null==e?void 0:null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e?void 0:null===(a=e.currentTarget)||void 0===a?void 0:a.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},i.ontimeout=function(e){t._dynamicTimeoutIns&&"function"==typeof t._dynamicTimeoutIns.update&&(t._logger.debug("[dytimeout], xhr timeout update rtt,",5*n),t._dynamicTimeoutIns.update(5*i.timeout)),t.cancel();var a=new r.C(t._url,t._request,{status:408},"timeout");t._onTimeout&&(a.isTimeout=!0,t._onTimeout(a,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)};var o=this._headers||{},s=(0,a.Gu)(e);s&&(o.Range=s),o&&Object.keys(o).forEach(function(e){i.setRequestHeader(e,o[e])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e,",[dytimeout],",n),i.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(),this._priOptions.rtt=this._firstRtt-this._startTime),this._dynamicTimeoutIns&&"function"==typeof this._dynamicTimeoutIns.update&&(this._logger.debug("[dytimeout] xhr update rtt,",this._priOptions.rtt),this._dynamicTimeoutIns.update(this._priOptions.rtt)))}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||t>299){var i=new r.C(this._url,null,(0,n.Zj)((0,n.Zj)({},e.target.response),{},{status:t}),"bad response,status:"+t);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var u=null,c=!1,l=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0;if(this._responseType===o.U.ARRAY_BUFFER){var d,h,f,v=new Uint8Array(e.target.response);if(h=l+this._receivedLength,v&&v.byteLength>0){this._receivedLength+=v.byteLength;var _=Date.now()-this._startTime,p=(0,a.pl)(this._receivedLength,_);this.emit(s.K.REAL_TIME_SPEED,{speed:p,len:this._receivedLength,time:_,vid:this._vid,index:this._index,range:[h,l+this._receivedLength],priOptions:this._priOptions})}u=v,c=(!((null===(f=this._range)||void 0===f?void 0:f.length)>1)||!this._range[1]||!(this._receivedLength], tast :",this._range,", start",h,"end ",l+this._receivedLength,",dataLen,",v?v.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",c)}else c=!0,u=e.target.response;var g={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(g=this._transformResponse(g,this._url)||g),this._onProgress&&this._onProgress(u,c,{index:this._index,vid:this._vid,range:[h,l+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},g),c?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve((0,a.rO)(this._onProgress?null:u,c,g,g.headers["content-length"],g.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,(0,n.U2)((0,n.IP)(i.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=e.getAllResponseHeaders().trim().split("\r\n"),i={},r,a=(0,n.sf)(t);try{for(a.s();!(r=a.n()).done;){var o=r.value.split(": ");i[o[0].toLowerCase()]=o.slice(1).join(": ")}}catch(e){a.e(e)}finally{a.f()}return i}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),i}(i.n(u)())},372196:function(e,t,i){function n(){for(var e=arguments.length,t=Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:0;return new Promise(function(t){return setTimeout(t,e)})}i.d(t,{_v:function(){return r},gJ:function(){return n}})},491639:function(e,t,i){i.d(t,{c:function(){return c}});var n=i(570783),r=i(991372),a=i(602929),o=i(65661),s=i(637961),u=i(942155),c=function(e){(0,n.XW)(i,e);var t=(0,n.WY)(i);function i(){var e;return(0,n.PA)(this,i),e=t.call(this),(0,n._x)((0,n.Lc)(e),"_xhr",null),(0,n._x)((0,n.Lc)(e),"_aborted",!1),(0,n._x)((0,n.Lc)(e),"_timeoutTimer",null),(0,n._x)((0,n.Lc)(e),"_range",null),(0,n._x)((0,n.Lc)(e),"_receivedLength",0),(0,n._x)((0,n.Lc)(e),"_url",null),(0,n._x)((0,n.Lc)(e),"_onProgress",null),(0,n._x)((0,n.Lc)(e),"_index",-1),(0,n._x)((0,n.Lc)(e),"_headers",null),(0,n._x)((0,n.Lc)(e),"_currentChunkSizeKB",384),(0,n._x)((0,n.Lc)(e),"_timeout",null),(0,n._x)((0,n.Lc)(e),"_xhr",null),(0,n._x)((0,n.Lc)(e),"_withCredentials",null),(0,n._x)((0,n.Lc)(e),"_startTime",-1),(0,n._x)((0,n.Lc)(e),"_loadCompleteResolve",null),(0,n._x)((0,n.Lc)(e),"_loadCompleteReject",null),(0,n._x)((0,n.Lc)(e),"_runing",!1),(0,n._x)((0,n.Lc)(e),"_logger",!1),(0,n._x)((0,n.Lc)(e),"_vid",""),(0,n._x)((0,n.Lc)(e),"_responseType",void 0),(0,n._x)((0,n.Lc)(e),"_credentials",void 0),(0,n._x)((0,n.Lc)(e),"_method",void 0),(0,n._x)((0,n.Lc)(e),"_transformResponse",void 0),(0,n._x)((0,n.Lc)(e),"_firstRtt",void 0),(0,n._x)((0,n.Lc)(e),"_onCancel",null),(0,n._x)((0,n.Lc)(e),"_priOptions",null),(0,n._x)((0,n.Lc)(e),"_dynamicTimeoutIns",null),e}return(0,n.qH)(i,[{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._dynamicTimeoutIns=e.dynamicTimeoutIns,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._dynamicTimeoutIns=e.dynamicTimeoutIns,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=(0,a.G7)(e.url,e.params);var i=Date.now();return new Promise(function(e,i){t._loadCompleteResolve=e,t._loadCompleteReject=i,t._startLoad()}).catch(function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted||"timeout"===e.message)throw(e=e instanceof r.C?e:new r.C(t._url,t._request)).startTime=i,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===o.U.ARRAY_BUFFER&&this._range&&this._range.length>1){if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength,n=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 i=this._xhr=new XMLHttpRequest;i.open(this._method||"GET",this._url,!0),i.responseType=this._responseType;var n=this._dynamicTimeoutIns&&"function"==typeof this._dynamicTimeoutIns.getTimeout?this._dynamicTimeoutIns.getTimeout(this._timeout):this._timeout;n&&(i.timeout=n,this.curTimeout=n),this._logger.debug("[dytimeout] xhr set timeout",n),i.withCredentials=this._withCredentials,i.onload=this._onLoad.bind(this),i.onreadystatechange=this._onReadyStatechange.bind(this),i.onerror=function(e){t._running=!1;var i,n,a,o=new r.C(t._url,t._request,null==e?void 0:null===(i=e.currentTarget)||void 0===i?void 0:i.response,"xhr.onerror.status:"+(null==e?void 0:null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e?void 0:null===(a=e.currentTarget)||void 0===a?void 0:a.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},i.ontimeout=function(e){t._dynamicTimeoutIns&&"function"==typeof t._dynamicTimeoutIns.update&&(t._logger.debug("[dytimeout] xhr timeout update rtt,",5*i.timeout),t._dynamicTimeoutIns.update(5*i.timeout)),t.cancel();var n=new r.C(t._url,t._request,{status:408},"timeout");n.isTimeout=!0,t._onTimeout&&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 o=this._headers||{},s=(0,a.Gu)(e);s&&(o.Range=s),o&&Object.keys(o).forEach(function(e){i.setRequestHeader(e,o[e])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e,",[dytimeout],",n),i.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(),this._priOptions.rtt=this._firstRtt-this._startTime),this._dynamicTimeoutIns&&"function"==typeof this._dynamicTimeoutIns.update&&(this._logger.debug("[dytimeout] xhr update rtt,",this._priOptions.rtt),this._dynamicTimeoutIns.update(this._priOptions.rtt)))}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||t>299){var i=new r.C(this._url,null,(0,n.Zj)((0,n.Zj)({},e.target.response),{},{status:t}),"bad response,status:"+t);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var u=null,c=!1,l=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0;if(this._responseType===o.U.ARRAY_BUFFER){var d,h,f,v=new Uint8Array(e.target.response);if(h=l+this._receivedLength,v&&v.byteLength>0){this._receivedLength+=v.byteLength;var _=Date.now()-this._startTime,p=(0,a.pl)(this._receivedLength,_);this.emit(s.K.REAL_TIME_SPEED,{speed:p,len:this._receivedLength,time:_,vid:this._vid,index:this._index,range:[h,l+this._receivedLength],priOptions:this._priOptions})}u=v,c=(!((null===(f=this._range)||void 0===f?void 0:f.length)>1)||!this._range[1]||!(this._receivedLength], tast :",this._range,", start",h,"end ",l+this._receivedLength,",dataLen,",v?v.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",c)}else c=!0,u=e.target.response;var g={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(g=this._transformResponse(g,this._url)||g),this._onProgress&&this._onProgress(u,c,{index:this._index,vid:this._vid,range:[h,l+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},g),c?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve((0,a.rO)(this._onProgress?null:u,c,g,g.headers["content-length"],g.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,(0,n.U2)((0,n.IP)(i.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=e.getAllResponseHeaders().trim().split("\r\n"),i={},r,a=(0,n.sf)(t);try{for(a.s();!(r=a.n()).done;){var o=r.value.split(": ");i[o[0].toLowerCase()]=o.slice(1).join(": ")}}catch(e){a.e(e)}finally{a.f()}return i}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),i}(i.n(u)())},745740:function(e,t,i){i.d(t,{Vc:function(){return n},_e:function(){return r},yQ:function(){return a}});var n={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},r={AV1:"av1",AVC:"avc",HEVC:"hevc",VVCC:"vvcC"},a={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m",OPUS:"opus",MP3:"mp3"}},585104:function(e,t,i){i.d(t,{J:function(){return r}});var n=i(697946),r=function(){function e(t,i,r){(0,n.PA)(this,e),this.dv=new DataView(t),this.start=this.offset=i||this.dv.byteOffset,this.end=r?this.start+r:this.start+this.dv.byteLength}return(0,n.qH)(e,[{key:"buffer",get:function(){return this.dv.buffer}},{key:"unreadLength",get:function(){return Math.max(this.end-this.offset,0)}},{key:"size",get:function(){return this.end-this.start}},{key:"readFloat",value:function(e){var t=0;switch(e){case 4:t=this.dv.getFloat32(this.offset);break;case 8:t=this.dv.getFloat64(this.offset);break;default:throw Error("read ".concat(e,"-byte float is not supported"))}return this.offset+=e,t}},{key:"back",value:function(e){this.offset-=e}},{key:"skip",value:function(e){this.offset+=e}},{key:"readInt",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getInt8(t);case 2:return this.dv.getInt16(t);case 4:return this.dv.getInt32(t);default:throw Error("read ".concat(e,"-byte integers is not supported"))}}},{key:"read",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getUint8(t);case 2:return this.dv.getUint16(t);case 3:return(this.dv.getUint16(t)<<8)+this.dv.getUint8(t+2);case 4:return this.dv.getUint32(t);default:return this.back(e-4),this.read(e-4)+this.dv.getUint32(t)*Math.pow(256,e-4)}}},{key:"write",value:function(e,t){var i=this.offset;switch(this.offset+=e,e){case 1:return this.dv.setUint8(i,t);case 2:return this.dv.setUint16(i,t);case 3:return this.dv.setUint8(i,t>>>16),this.dv.setUint16(i+1,65535&t);case 4:return this.dv.setUint32(i,t);default:throw 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,i="";te)this._word<<=e,this._bitsAvailable-=e;else{var t=Math.floor((e-=this._bitsAvailable)/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),i=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)?i<>>e)!=0)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,i=8,n=0;n2&&void 0!==arguments[2]?arguments[2]:0,a=[];if(!t)return a;for(var o=0,s="",u=0;t.length>7;){if(o=(0,r.Bh)(t),s=String.fromCharCode.apply(null,t.subarray(4,8)),u=8,1===o?(o=(0,r.h9)(t,8),u+=8):!o&&(o=t.length),!i[0]||s===i[0]){var c=t.subarray(0,o);if(!(i.length<2))return e.findBox(c.subarray(u),i.slice(1),n+u);a.push({start:n,size:o,headerSize:u,type:s,data:c})}n+=o,t=t.subarray(o)}return a}},{key:"tfhd",value:function(e){return h(e,!0,function(e,t){e.trackId=(0,r.Bh)(t);var i=4,n=1&e.flags,a=2&e.flags,o=8&e.flags,s=16&e.flags,u=32&e.flags;n&&(i+=4,e.baseDataOffset=(0,r.Bh)(t,i),i+=4),a&&(e.sampleDescriptionIndex=(0,r.Bh)(t,i),i+=4),o&&(e.defaultSampleDuration=(0,r.Bh)(t,i),i+=4),s&&(e.defaultSampleSize=(0,r.Bh)(t,i),i+=4),u&&(e.defaultSampleFlags=(0,r.Bh)(t,i))})}},{key:"sidx",value:function(e){return h(e,!0,function(e,t){var i=0;e.reference_ID=(0,r.Bh)(t,i),i+=4,e.timescale=(0,r.Bh)(t,i),i+=4,0===e.version?(e.earliest_presentation_time=(0,r.Bh)(t,i),i+=4,e.first_offset=(0,r.Bh)(t,i),i+=4):(e.earliest_presentation_time=(0,r.h9)(t,i),i+=8,e.first_offset=(0,r.h9)(t,i),i+=8),i+=2,e.references=[];var n=(0,r.i4)(t,i);i+=2;for(var a=0;a>31&1,o.referenced_size=2147483647&s,o.subsegment_duration=(0,r.Bh)(t,i),i+=4,s=(0,r.Bh)(t,i),i+=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 h(t,!1,function(t,i,n){t.mvhd=e.mvhd(e.findBox(i,["mvhd"],n)[0]),t.trak=e.findBox(i,["trak"],n).map(function(t){return e.trak(t)}),t.pssh=e.pssh(e.findBox(i,["pssh"],n)[0])})}},{key:"mvhd",value:function(e){return h(e,!0,function(e,t){var i=0;1===e.version?(e.timescale=(0,r.Bh)(t,16),e.duration=(0,r.h9)(t,20),i+=28):(e.timescale=(0,r.Bh)(t,8),e.duration=(0,r.Bh)(t,12),i+=16),e.nextTrackId=(0,r.Bh)(t,i+76)})}},{key:"trak",value:function(t){return h(t,!1,function(t,i,n){t.tkhd=e.tkhd(e.findBox(i,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(i,["mdia"],n)[0]),t.edts=e.edts(e.findBox(i,["edts"],n)[0])})}},{key:"tkhd",value:function(e){return h(e,!0,function(e,t){var i=0;1===e.version?(e.trackId=(0,r.Bh)(t,16),e.duration=(0,r.h9)(t,24),i+=32):(e.trackId=(0,r.Bh)(t,8),e.duration=(0,r.Bh)(t,16),i+=20),e.width=(0,r.Bh)(t,i+52),e.height=(0,r.Bh)(t,i+56)})}},{key:"mdia",value:function(t){return h(t,!1,function(t,i,n){t.mdhd=e.mdhd(e.findBox(i,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(i,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(i,["minf"],n)[0])})}},{key:"edts",value:function(t){return h(t,!1,function(t,i,n){t.elst=e.elst(e.findBox(i,["elst"],n)[0])})}},{key:"elst",value:function(e){return h(e,!0,function(e,t,i){e.entries=[],e.entriesData=t;var n=0,a=(0,r.Bh)(t,n);n+=4;for(var o=0;o>10&31)+96,(n>>5&31)+96,(31&n)+96)})}},{key:"hdlr",value:function(e){return h(e,!0,function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))})}},{key:"minf",value:function(t){return h(t,!1,function(t,i,n){t.vmhd=e.vmhd(e.findBox(i,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(i,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(i,["stbl"],n)[0])})}},{key:"vmhd",value:function(e){return h(e,!0,function(e,t){e.graphicsmode=(0,r.i4)(t),e.opcolor=[(0,r.i4)(t,2),(0,r.i4)(t,4),(0,r.i4)(t,6)]})}},{key:"smhd",value:function(e){return h(e,!0,function(e,t){e.balance=(0,r.i4)(t)})}},{key:"stbl",value:function(t){return h(t,!1,function(t,i,n){t.stsd=e.stsd(e.findBox(i,["stsd"],n)[0]),t.stts=e.stts(e.findBox(i,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(i,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(i,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(i,["stsz"],n)[0]),t.stco=e.stco(e.findBox(i,["stco"],n)[0]),!t.stco&&(t.co64=e.co64(e.findBox(i,["co64"],n)[0]),t.stco=t.co64);var r,a,o,s=null===(r=t.stsd.entries[0])||void 0===r?void 0:null===(a=r.sinf)||void 0===a?void 0:null===(o=a.schi)||void 0===o?void 0:o.tenc.default_IV_size;t.stss=e.stss(e.findBox(i,["stss"],n)[0]),t.senc=e.senc(e.findBox(i,["senc"],n)[0],s)})}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return h(e,!0,function(e,i){var n=0,a=(0,r.Bh)(i,n);n+=4,e.samples=[];for(var o=0;o0){var s=(0,r.Bh)(t,a);a+=4;for(var u=0;u<(""+s).length;u++)for(var c=0;c<16;c++){var l=t[a];a+=1,i.push(v(l))}}var d=(0,r.Bh)(t,a);e.data_size=d,a+=4,e.kid=i,e.system_id=n,e.buffer=t})}},{key:"bvc2",value:function(t){return h(t,!1,function(t,i,n){var r=l(t,i),a=i.subarray(r);n+=r,t.vvcC=e.bv2C(e.findBox(a,["bv2C"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])})}},{key:"bv2C",value:function(e){return h(e,!1,function(e,t,i){var n=o.i.parseVVCDecoderConfigurationRecord(t);for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])})}},{key:"stsd",value:function(t){return h(t,!0,function(t,i,n){t.entryCount=(0,r.Bh)(i),t.entries=e.findBox(i.subarray(4),[],n+4).map(function(t){switch(t.type){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 h(t,!1,function(t,i,n){t.channelCount=(0,r.i4)(i,16),t.samplesize=(0,r.i4)(i,18),t.sampleRate=(0,r.Bh)(i,24)/65536,i=i.subarray(28),t.sinf=e.sinf(e.findBox(i,["sinf"],n)[0]),t.esds=e.esds(e.findBox(i,["esds"],n)[0])});case"encv":return h(t,!1,function(t,i,n){t.width=(0,r.i4)(i,24),t.height=(0,r.i4)(i,26),t.horizresolution=(0,r.Bh)(i,28),t.vertresolution=(0,r.Bh)(i,32),i=i.subarray(78),t.sinf=e.sinf(e.findBox(i,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(i,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(i,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(i,["pasp"],n)[0])})}}).filter(Boolean)})}},{key:"tenc",value:function(e){return h(e,!1,function(e,t){var i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(v(t[i])),i+=1})}},{key:"schi",value:function(t){return h(t,!1,function(t,i,n){t.tenc=e.tenc(e.findBox(i,["tenc"],n)[0])})}},{key:"sinf",value:function(t){return h(t,!1,function(t,i,n){t.schi=e.schi(e.findBox(i,["schi"],n)[0]),t.frma=e.frma(e.findBox(i,["frma"],n)[0])})}},{key:"frma",value:function(e){return h(e,!1,function(e,t){e.data_format="";for(var i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])})}},{key:"avc1",value:function(t){return h(t,!1,function(t,i,n){var r=l(t,i),a=i.subarray(r);n+=r,t.avcC=e.avcC(e.findBox(a,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])})}},{key:"avcC",value:function(e){return h(e,!1,function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=(0,r.dB)([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var i=6,n=0;n>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=(0,r.Bh)(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=(0,r.i4)(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];for(var a=23,o=0,s=0,u=0,c=0;c>3;31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[1])>>5)),e.objectType=s,e.codec+=s.toString(16),"."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1));return}else{"."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1));return}}})}},{key:"alaw",value:function(e){return h(e,!1,function(e,t){d(e,t)})}},{key:"stts",value:function(e){return h(e,!0,function(e,t){for(var i=(0,r.Bh)(t),n=[],a=4,o=0;o4&&1&n&&(e.dataOffset=-(~(0,r.Bh)(t,s)+1),s+=4),a>s&&4&n&&(e.firstSampleFlags=(0,r.Bh)(t,s),s+=4),a>s){e.samples=Array(o);for(var u,c=0;c>>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,i){var n=e.trak;if(n&&n.length){var r=n.find(function(e){var t,i;return(null===(t=e.mdia)||void 0===t?void 0:null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)==="vide"}),o=n.find(function(e){var t,i;return(null===(t=e.mdia)||void 0===t?void 0:null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)==="soun"});if(r&&t){var u,c,l,d,h,f,v,_,p,g,m,y,T,b,E,x,R,A,k=null===(l=r.tkhd)||void 0===l?void 0:l.trackId;null!=k&&(t.id=r.tkhd.trackId),t.tkhdDuration=r.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=r.mdia.mdhd.timescale,t.duration=r.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale,null!==(d=r.edts)&&void 0!==d&&d.elst&&(t.editList=r.edts.elst,t.editListApplied=r.editListApplied);var S=r.mdia.minf.stbl.stsd.entries[0];if(t.width=S.width,t.height=S.height,S.pasp&&(t.sarRatio=[S.pasp.hSpacing,S.pasp.vSpacing]),S.hvcC)t.codecType=s._e.HEVC,t.codec=S.hvcC.codec,t.vps=S.hvcC.vps,t.sps=S.hvcC.sps,t.pps=S.hvcC.pps,t.hvcC=S.hvcC.data;else if(S.avcC)t.codec=S.avcC.codec,t.sps=S.avcC.sps,t.pps=S.avcC.pps;else if(S.vvcC)t.codecType=s._e.VVCC,t.codec=S.vvcC.codec,t.sps=S.vvcC.sps,t.pps=S.vvcC.pps,t.vps=S.vvcC.vps,t.vvcC=S.vvcC.data;else throw Error("unknown video stsd entry");t.present=!0,t.ext={},t.ext.stss=null===(h=r.mdia)||void 0===h?void 0:null===(f=h.minf)||void 0===f?void 0:null===(v=f.stbl)||void 0===v?void 0:v.stss,t.ext.ctts=null===(_=r.mdia)||void 0===_?void 0:null===(p=_.minf)||void 0===p?void 0:null===(g=p.stbl)||void 0===g?void 0:g.ctts,S&&"encv"===S.type&&(t.isVideoEncryption=!0,S.default_KID=null===(m=S.sinf)||void 0===m?void 0:null===(y=m.schi)||void 0===y?void 0:y.tenc.default_KID,S.default_IsEncrypted=null===(T=S.sinf)||void 0===T?void 0:null===(b=T.schi)||void 0===b?void 0:b.tenc.default_IsEncrypted,S.default_IV_size=null===(E=S.sinf)||void 0===E?void 0:null===(x=E.schi)||void 0===x?void 0:x.tenc.default_IV_size,t.videoSenc=r.mdia.minf.stbl.senc&&r.mdia.minf.stbl.senc.samples,S.data_format=null===(R=S.sinf)||void 0===R?void 0:null===(A=R.frma)||void 0===A?void 0:A.data_format,t.useEME=e.useEME,t.kidValue=e.kidValue,t.pssh=e.pssh,t.encv=S)}if(o&&i){var C,I,L,D,w,O,B,P,M,N,U,F,j,K,H,V,W,Z,Y=null===(C=o.tkhd)||void 0===C?void 0:C.trackId;null!=Y&&(i.id=o.tkhd.trackId),i.tkhdDuration=o.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=o.mdia.mdhd.timescale,i.duration=o.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale,null!==(I=o.edts)&&void 0!==I&&I.elst&&(i.editList=o.edts.elst,i.editListApplied=o.editListApplied);var G=o.mdia.minf.stbl.stsd.entries[0];switch(i.sampleSize=G.sampleSize,i.sampleRate=G.sampleRate,i.channelCount=G.channelCount,i.present=!0,G.type){case"alaw":i.codecType=i.codec=s.yQ.G711PCMA,i.sampleRate=8e3;break;case"ulaw":i.codecType=i.codec=s.yQ.G711PCMU,i.sampleRate=8e3;break;default:i.sampleDuration=a.W.getFrameDuration(i.sampleRate,i.timescale),i.sampleRateIndex=a.W.getRateIndexByRate(i.sampleRate),i.objectType=(null===(u=G.esds)||void 0===u?void 0:u.objectType)||2,G.esds&&(i.config=Array.from(G.esds.config)),i.codec=(null===(c=G.esds)||void 0===c?void 0:c.codec)||"mp4a.40.2"}i.sampleDuration=a.W.getFrameDuration(i.sampleRate,i.timescale),i.objectType=(null===(L=G.esds)||void 0===L?void 0:L.objectType)||2,G.esds&&G.esds.config&&(i.config=Array.from(G.esds.config)),i.codec=(null===(D=G.esds)||void 0===D?void 0:D.codec)||"mp4a.40.2",i.sampleRateIndex=a.W.getRateIndexByRate(i.sampleRate),i.ext={},i.ext.stss=null===(w=o.mdia)||void 0===w?void 0:null===(O=w.minf)||void 0===O?void 0:null===(B=O.stbl)||void 0===B?void 0:B.stss,i.ext.ctts=null===(P=o.mdia)||void 0===P?void 0:null===(M=P.minf)||void 0===M?void 0:null===(N=M.stbl)||void 0===N?void 0:N.ctts,i.present=!0,G&&"enca"===G.type&&(i.isAudioEncryption=!0,G.data_format=null===(U=G.sinf)||void 0===U?void 0:null===(F=U.frma)||void 0===F?void 0:F.data_format,G.default_KID=null===(j=G.sinf)||void 0===j?void 0:null===(K=j.schi)||void 0===K?void 0:K.tenc.default_KID,G.default_IsEncrypted=null===(H=G.sinf)||void 0===H?void 0:null===(V=H.schi)||void 0===V?void 0:V.tenc.default_IsEncrypted,G.default_IV_size=null===(W=G.sinf)||void 0===W?void 0:null===(Z=W.schi)||void 0===Z?void 0:Z.tenc.default_IV_size,i.audioSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,i.useEME=e.useEME,i.kidValue=e.kidValue,i.enca=G)}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var q,z,X=null==t?void 0:null===(q=t.encv)||void 0===q?void 0:q.default_KID,J=null==i?void 0:null===(z=i.enca)||void 0===z?void 0:z.default_KID,Q=X||J?(X||J).join(""):null;t&&(t.kid=Q),i&&(i.kid=Q)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}}},{key:"evaluateDefaultDuration",value:function(e,t,i){var n,r=null==t?void 0:null===(n=t.samples)||void 0===n?void 0:n.length;return r?1024*r/t.timescale*e.timescale/i:1024}},{key:"moofToSamples",value:function(t,i,n){var r={};return t.mfhd&&(i&&(i.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach(function(t){var a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(i&&i.id===a.trackId&&(i.baseMediaDecodeTime=o.baseMediaDecodeTime),n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(i,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,d=0,h=-1;if(!s.samples.length&&s.sampleCount){r[a.trackId]=Array(s.sampleCount);for(var f=0;f>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,l+=e.size,e})}}),r}},{key:"moovToSamples",value:function(e){var t=e.trak;if(!!t&&!!t.length){var i=t.find(function(e){var t,i;return(null===(t=e.mdia)||void 0===t?void 0:null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)==="vide"}),n=t.find(function(e){var t,i;return(null===(t=e.mdia)||void 0===t?void 0:null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)==="soun"});if(i||n){if(i){var r,a,o,s,u=null===(o=i.mdia)||void 0===o?void 0:null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var l=u.stts,d=u.stsc,h=u.stsz,f=u.stco,v=u.stss,_=u.ctts;if(!l||!d||!h||!f||!v)return;r=c(l,d,h,f,_,v)}if(n){var p,g,m,y=null===(p=n.mdia)||void 0===p?void 0:null===(g=p.minf)||void 0===g?void 0:g.stbl;if(!y)return;var T=null===(m=n.mdia.mdhd)||void 0===m?void 0:m.timescale,b=y.stts,E=y.stsc,x=y.stsz,R=y.stco;if(!T||!b||!E||!x||!R)return;a=c(b,E,x,R)}return{videoSamples:r,audioSamples:a}}}}}]),e}();function c(e,t,i,n,r,a){var o,s,u,c=[],l=null==r?void 0:r.entries,d=t.entries,h=n.entries,f=i.entrySizes,v=null==a?void 0:a.entries;v&&(o={},v.forEach(function(e){o[e-1]=!0})),l&&(s=[],l.forEach(function(e){for(var t=e.count,i=e.offset,n=0;n=E&&(E=d[++y+1]?d[y+1].firstChunk-1:1/0),b+=d[y].samplesPerChunk)}),c}function l(e,t){return e.dataReferenceIndex=(0,r.i4)(t,6),e.width=(0,r.i4)(t,24),e.height=(0,r.i4)(t,26),e.horizresolution=(0,r.Bh)(t,28),e.vertresolution=(0,r.Bh)(t,32),e.frameCount=(0,r.i4)(t,40),e.depth=(0,r.i4)(t,74),78}function d(e,t){return e.dataReferenceIndex=(0,r.i4)(t,6),e.channelCount=(0,r.i4)(t,16),e.sampleSize=(0,r.i4)(t,18),e.sampleRate=(0,r.Bh)(t,24)/65536,28}function h(e,t,i){if(e){if(e.size!==e.data.length)throw Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=(0,r.sV)(e.data,e.headerSize+1),n.headerSize+=4),i(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var f=function(e,t,i){for(var n=String(i),r=t>>0,a=Math.ceil(r/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,r-s.length)+s},v=function(){for(var e=[],t=arguments.length,i=Array(t),n=0;n