douxiaoyun.js/profiles/douyin-profile/Default/Cache/Cache_Data/f_000373
2026-07-17 22:23:39 +08:00

2 lines
131 KiB
Plaintext

/*! For license information please see player-6.9bffae5c.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,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function n(e,t,n){if(n||2==arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var r=/[^a-zA-Z0-9\\_:.-]/gim,i=/</g,a=/>/g,o=/&#([a-zA-Z0-9]*);?/gim,s=/&quot;/g,u=/&colon;?/gim,c=/&newline;?/gim,d=/((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,l=/u\s*r\s*l\s*\(.*/gi,f=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,h=/"/g,v=function(e){return e.replace(i,"&lt;").replace(a,"&gt;")},g={indexOf:function(e,t){var n,r;for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1},forEach:function(e,t,n){var r,i;for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},some:function(e,t,n){var r,i;for(r=0,i=e.length;r<i;r++)if(t.call(n,e[r],r,e))return!0;return!1},trim:function(e){return e.replace(/(^\s*)|(\s*$)/g,"")},includes:function(e,t){if("string"==typeof e)return -1!==e.indexOf(t);for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1},spaceIndex:function(e){var t=/\s|\n|\t/.exec(e);return t?t.index:-1},uniq:function(e){for(var t={},n=[],r=0;r<e.length;r++)t[e[r]]||(n.push(e[r]),t[e[r]]=!0);return n},from:function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},keys:function(e){var t=[];for(var n in e)t.push(n);return t}};function p(e){return null==e}function m(e){var t;return'"'===(t=e)[0]&&'"'===t[t.length-1]||"'"===t[0]&&"'"===t[t.length-1]?e.substr(1,e.length-2):e}function _(e){var t,n,r,i,a,o,s,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d=0;for(e=function(e){e=e.replace(/rn/g,"n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?t+=String.fromCharCode(r>>6|192)+String.fromCharCode(63&r|128):t+=String.fromCharCode(r>>12|224)+String.fromCharCode(r>>6&63|128)+String.fromCharCode(63&r|128)}return t}(e);d<e.length;)i=(t=e.charCodeAt(d++))>>2,a=(3&t)<<4|(n=e.charCodeAt(d++))>>4,o=(15&n)<<2|(r=e.charCodeAt(d++))>>6,s=63&r,isNaN(n)?o=s=64:isNaN(r)&&(s=64),c=c+u.charAt(i)+u.charAt(a)+u.charAt(o)+u.charAt(s);return c}function y(e){var t,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)t=s.indexOf(e.charAt(c++))<<2|(i=s.indexOf(e.charAt(c++)))>>4,n=(15&i)<<4|(a=s.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(n)),64!==o&&(u+=String.fromCharCode(r));return function(e){for(var t="",n=0,r=0,i=0,a=0;n<e.length;)(r=e.charCodeAt(n))<128?(t+=String.fromCharCode(r),n++):r>191&&r<224?(t+=String.fromCharCode((31&r)<<6|63&(a=e.charCodeAt(n+1))),n+=2):(a=e.charCodeAt(n+1),t+=String.fromCharCode((15&r)<<12|(63&a)<<6|63&(i=e.charCodeAt(n+2))),n+=3);return t}(u)}function b(e,t,n){var r="",i=0,a=!1,o=!1,s=0,u=e.length,c="",d="";e:for(s=0;s<u;s++){var l=e.charAt(s);if(!1===a){if("<"===l){a=s;continue}}else if(!1===o){if("<"===l){r+=n(e.slice(i,s)),a=s,i=s;continue}if(">"===l||s===u-1){r+=n(e.slice(i,a)),c=function(e){var t,n=g.spaceIndex(e);return t=-1===n?e.slice(1,-1):e.slice(1,n+1),"/"===(t=g.trim(t).toLowerCase()).slice(0,1)&&(t=t.slice(1)),"/"===t.slice(-1)&&(t=t.slice(0,-1)),t}(d=e.slice(a,s+1)),r+=t(a,r.length,c,d,"</"===d.slice(0,2)),i=s+1,a=!1;continue}if('"'===l||"'"===l)for(var f=1,h=e.charAt(s-f);""===h.trim()||"="===h;){if("="===h){o=l;continue e}h=e.charAt(s-++f)}}else if(l===o){o=!1;continue}}return i<u&&(r+=n(e.substr(i))),r}function k(e,t){var n=0,i=0,a=[],o=!1,s=e.length;function u(e,n){if(!((e=(e=g.trim(e)).replace(r,"").toLowerCase()).length<1)){var i=t(e,n||"");i&&a.push(i)}}for(var c=0;c<s;c++){var d=e.charAt(c),l=void 0;if(!1!==o||"="!==d){if(!1===o||c!==i){if(/\s|\n|\t/.test(d)){if(e=e.replace(/\s|\n|\t/g," "),!1===o){if(-1===(l=function(e,t){for(;t<e.length;t++){var n=e[t];if(" "!==n)return"="===n?t:-1}return -1}(e,c))){u(g.trim(e.slice(n,c))),o=!1,n=c+1;continue}c=l-1;continue}if(-1===(l=function(e,t){for(;t>0;t--){var n=e[t];if(" "!==n)return"="===n?t:-1}return -1}(e,c-1))){u(o,m(g.trim(e.slice(n,c)))),o=!1,n=c+1;continue}}}else{if(-1===(l=e.indexOf(d,c+1)))break;u(o,g.trim(e.slice(i+1,l))),o=!1,n=(c=l)+1}}else o=e.slice(n,c),n=c+1,i='"'===e.charAt(n)||"'"===e.charAt(n)?n:function(e,t){for(;t<e.length;t++){var n=e[t];if(" "!==n)return"'"===n||'"'===n?t:-1}return -1}(e,c+1)}return n<e.length&&(!1===o?u(e.slice(n)):u(o,m(g.trim(e.slice(n))))),g.trim(a.join(" "))}function C(e,t,n){if(n=function(e){return e=function(e){for(var t="",n=0,r=e.length;n<r;n++)t+=32>e.charCodeAt(n)?" ":e.charAt(n);return g.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," "))}(n),"href"===t||"src"===t){if("#"===(n=g.trim(n)))return"#";if("http://"!==n.substr(0,7)&&"https://"!==n.substr(0,8)&&"mailto:"!==n.substr(0,7)&&"tel:"!==n.substr(0,4)&&"data:image/"!==n.substr(0,11)&&"ftp://"!==n.substr(0,6)&&"./"!==n.substr(0,2)&&"../"!==n.substr(0,3)&&"#"!==n[0]&&"/"!==n[0])return""}else if("background"===t){if(d.lastIndex=0,d.test(n))return""}else if("style"===t&&(f.lastIndex=0,f.test(n)||(l.lastIndex=0,l.test(n)&&(d.lastIndex=0,d.test(n)))))return"";return n=function(e){return e=v(e=e.replace(h,"&quot;"))}(n)}var w=function(e){return"string"==typeof e?e.replace(/'/g,'"').replace('=""',"").replace(/\s+/g,"").toLowerCase():""},T=function(){function e(e){var t=function(e){var t={};for(var n in e)t[n]=e[n];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=C,t.escapeHtml=v,this.options=Object.assign(t,e)}return e.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t,n,r,i,a,o,s=this.options,u=s.whiteList,c=s.onTag,d=s.onIgnoreTag,l=s.onTagAttr,f=s.onIgnoreTagAttr,h=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="",n=0;n<e.length;){var r=e.indexOf("\x3c!--",n);if(-1===r){t+=e.slice(n);break}t+=e.slice(n,r);var i=e.indexOf("--\x3e",r);if(-1===i)break;n=i+3}return t}(e));var p=!1;s.stripIgnoreTagBody&&(n=s.stripIgnoreTagBody,"function"!=typeof(r=d)&&(r=function(){}),i=!Array.isArray(n),a=[],o=!1,d=(p={onIgnoreTag:function(e,t,s){var u;if(u=e,i||-1!==g.indexOf(n,u)){if(s.isClosing){var c="[/removed]",d=s.position+c.length;return a.push([!1!==o?o:s.position,d]),o=!1,c}return o||(o=s.position),"[removed]"}return r(e,t,s)},remove:function(e){var t="",n=0;return g.forEach(a,function(r){t+=e.slice(n,r[0]),n=r[1]}),t+=e.slice(n)}}).onIgnoreTag);var m=b(e,function(e,t,n,r,i){var a={sourcePosition:e,position:t,isClosing:i,isWhite:Object.prototype.hasOwnProperty.call(u,n)},o=c(n,r,a);if(null!=o)return o;if(a.isWhite){if(a.isClosing)return"</".concat(n,">");var s=function(e){var t=g.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var n="/"===(e=g.trim(e.slice(t+1,-1)))[e.length-1];return n&&(e=g.trim(e.slice(0,-1))),{html:e,closing:n}}(r),p=u[n],m=k(s.html,function(e,t){var r=-1!==g.indexOf(p,e),i=l(n,e,t,r);return null==i?r?(t=h(n,e,t,null))?"".concat(e,'="').concat(t,'"'):e:null==(i=f(n,e,t,r))?void 0:i:i});return r="<".concat(n),m&&(r+=" ".concat(m)),s.closing&&(r+=" /"),r+=">"}return null==(o=d(n,r,a))?v(r):o},v);return p&&(m=p.remove(m)),m},e}(),x=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")(),E=new(function(){function e(){var e=this;this.batchData=[],this.uniqKeys=new Set,this.timeout=2e3,this.lock=!1,this.getSlardarBid=function(){var t,n,r="douyin_web";if(!g.includes(r,"bid"))return r;if(e.config&&e.config.bid)return e.config.bid;if(x&&x._xssBid)return x._xssBid;if(x&&x.slardar&&"function"==typeof x.slardar.config){var i=(x.slardar.config()||{}).bid;if(i)return i}if(x&&x.Slardar&&"function"==typeof x.Slardar.config){var a=(x.Slardar.config()||{}).bid;if(a)return a}return(null===(n=null===(t=null==x?void 0:x.Slardar)||void 0===t?void 0:t._baseParams)||void 0===n?void 0:n.bid)||"argus"},this.getConfigRegion=function(){var t;return g.includes("cn","region")?e.config&&e.config.region?e.config.region:((null===(t=null==x?void 0:x.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 n=e.batchData.slice(0,100);e.batchData=e.batchData.slice(100),x.fetch(t,{method:"post",body:JSON.stringify(n),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(x.fetch&&e.collectKey){var n="object"==typeof window?window.location.href:"SSR";e.documentUrl=n;var r={age:Math.floor(Date.now()),type:"xss",url:n,body:e,"user-agent":""};"enforce"===e.disposition&&"SSR"!==n||(r.url=t),"SSR"===n&&(r.url="SSR___".concat(r.url),r.body.ssr=!0),this.push(r)}},e}()),D=function(e){for(var t=0,n=function(n){Array.isArray(e[n])?0===e[n].length?delete e[n]:(e[n]=g.from(g.uniq(e[n])),t+=e[n].length):0===g.keys(e[n]).length?delete e[n]:g.keys(e[n]).forEach(function(r){e[n][r]=g.from(g.uniq(e[n][r])),t+=e[n][r].length})},r=0,i=g.keys(e);r<i.length;r++)n(i[r]);return{count:t,ret:e}};function S(e,t){return E.setConfig(t),new T(t).process(e)}function R(e){var t,n=(t=/\s|\n|\t/.exec(e))?t.index:-1;if(-1===n)return{html:"",closing:"/"===e[e.length-2]};var r="/"===(e=e.slice(n+1,-1).trim())[e.length-1];return r&&(e=e.slice(0,-1).trim()),{html:e,closing:r}}var A=function(e){return -1===(e=(e=(e=(e=e.replace(/&colon;/gi,":")).replace(/&tab;/gi,"")).replace(/&newline;/gi,"")).replace(/(\t|\n|\r)/g,"")).indexOf("&#")?e.trim().toLowerCase():e.trim().replace(/&#(?:(x)([0-9a-f]+)|([0-9]+));?/gi,function(e,t,n,r){return String.fromCharCode(t?parseInt(n,16):parseInt(r))}).replace(/(\t|\n|\r)/g,"").toLowerCase()};function I(e,t){if(void 0===e&&(e=""),"string"!=typeof e)return!0;if(e=A(e),g.includes(e,"base64")&&!function(e){if(""===e||""===e.trim())return!0;try{return!g.includes(e,"data:text/html;base64")}catch(e){return!0}}(e))return t&&t("data:text/html;base64"),!1;var n=["expression(","behavior:","view-source:"];if(g.some(n,function(t){return -1!==e.indexOf(t)}))return g.forEach(n,function(n){-1!==e.indexOf(n)&&t&&t(n)}),!1;var r=["data:application","data:javascript","data:text/html","data:texthtml"];if(g.some(r,function(t){return -1!==e.indexOf(t)}))return g.forEach(r,function(n){-1!==e.indexOf(n)&&t&&t(n)}),!1;if(e.indexOf("javascript:")>0)return t&&t("javascript:"),!1;if(/^javascript:/i.test(e)){var i=e.slice(11).replace(/\s/g,"").trim();return!!g.some(["void","void(0)","void0","false","undefined",";"],function(e){return e===i})||(t&&t("javascript:"),!1)}return!0}var L=function(e,t){var n,r,i="<%= isSaveValidUrl =>";if("string"!=typeof e||(r=Number("<%= urlLimit =>"),void 0!==n&&(r=n),"NaN"!==e.toString()&&-1!==r&&e.length>=r)||I(e,t))return e;try{if(!0===(i=JSON.parse(i))||"true"===i){var a=new URL(e);return a.origin+a.pathname}}catch(e){}return"#"};function B(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=[]),"string"!=typeof e)return!0;if(!I(e=A(e)))return!1;var i,a={url:(i=e.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/)||[])[0],scheme:i[1],slash:i[2],host:i[3],port:i[4],path:i[5],query:i[6],hash:i[7]},o=a.scheme,s=a.host;return r?!!r(e):!(!o||!s)&&(!g.includes(["http","https","file"],o)||("object"==typeof window&&window&&(t=n(n([],t,!0),[location.host],!1)),g.some(t,function(e){return!!(e instanceof RegExp&&e.test(s))||e===s})))}var P={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:[]},N={collect:null,initCollect:function(){this.collect={whiteList:{},filterProtocol:[]}},removeCollect:function(){var e=D(this.collect),t=e.count,n=e.ret;return this.collect=null,{collectKey:0===t?null:JSON.stringify(n),collectMode:"white"}},onIgnoreTagAttr:function(e,t,r){return e&&g.indexOf(["href","src"],t)>-1?N.domainWhiteList&&Array.isArray(N.domainWhiteList)&&N.domainWhiteList.length>0&&!B(r,n([],N.domainWhiteList,!0))?"":"".concat(t,'="').concat(L(r,function(e){var t;null===(t=N.collect)||void 0===t||t.filterProtocol.push(e)}),'"'):e&&(g.indexOf(["style","class","id"],t)>-1||t.indexOf("data-")>-1)?"".concat(t,'="').concat(r,'"'):(N.collect.whiteList[e]=N.collect.whiteList[e]||[],void N.collect.whiteList[e].push(t))},onIgnoreTag:function(e,t){if("style"===e)return t;b(t,function(e,t,n,r){k(R(r).html.replace("/",""),function(e){N.collect.whiteList[n]=N.collect.whiteList[n]||[],N.collect.whiteList[n].push(e)})},v)},whiteList:P,mergeWhiteList:function(e){for(var t,n={},r=0,i=g.keys(P);r<i.length;r++)n[t=i[r]]=g.from(P[t]);for(var a=0,o=g.keys(e);a<o.length;a++)n[t=o[a]]=t in P?P[t].concat(e[t]):g.from(e[t]);return n},setWhiteList:function(e){for(var t=0,n=g.keys(e);t<n.length;t++){var r=n[t];this.whiteList[r]=r in P?P[r].concat(e[r]):g.from(e[r])}}};try{var O={},M="merge";g.includes(M,"override")&&(N.whiteList=O.whiteList),g.includes(M,"merge")&&N.setWhiteList(O.whiteList)}catch(e){}var Z=function(e,t){for(var n={},r=0,i=g.keys(e);r<i.length;r++){var a=i[r];Array.isArray(e[a])?n[a]=g.from(e[a]):n[a]=Z({},e[a])}for(var o=0,s=g.keys(t);o<s.length;o++)(a=s[o])in e?Array.isArray(e[a])?n[a]=e[a].concat(t[a]):n[a]=Z(e[a],t[a]):Array.isArray(t[a])?n[a]=g.from(t[a]):n[a]=Z({},t[a]);return n},W={blackList:{a:["folder"],meta:["content"],iframe:["srcdoc"],input:["pattern"],vmlframe:["xmlns"]},blackTags:["script","xml","embed","isindex","object","base","set","handler","animate","payload","import"],blackAttrs:["charset","ns","namespace","formaction","xlink:href","xmlns:xlink","handler","repeat","repeat-start","repeat-end"],blackAttrRegExps:[/^on/],filterList:{param:["value"],video:["poster"],form:["action"]},filterAttrs:["href","src","background","style","dynsrc","lowsrc","content"]};try{var F={};F.blackAttrRegExps&&(F.blackAttrRegExps=F.blackAttrRegExps.map(function(e){return new RegExp(e.toString().slice(1,e.toString().length-1))}));var V="merge";g.includes(V,"override")&&(W=F),g.includes(V,"merge")&&(W=Z(W,F))}catch(e){}var z={mode:"black",whiteList:{},blackConfig:W,collect:null,initCollect:function(){z.collect={blackList:{},blackTags:[],blackAttrs:[],blackAttrRegExps:[],filterAttrs:[],filterList:{},filterProtocol:[]}},removeCollect:function(){var e=D(z.collect),t=e.count,n=e.ret;return z.collect=null,{collectKey:0===t?null:JSON.stringify(n),collectMode:"black"}},onIgnoreTag:function(e,t){var n;if(!g.includes(W.blackTags,e))return b(t,function(e,t,n,r,i){if(-1!==n.indexOf("/"))return v(r);if(i)return"</".concat(n,">");var a=R(r),o=k(a.html,function(e,t){var r,i=0;if(W.blackList[n]&&g.includes(W.blackList[n],e)&&(z.collect.blackList[n]=z.collect.blackList[n]||[],z.collect.blackList[n].push(e),i++),W.blackAttrRegExps.length&&W.blackAttrRegExps.some(function(t){return t.test(e)})&&g.forEach(W.blackAttrRegExps,function(t){t.test(e)&&(z.collect.blackAttrRegExps.push("".concat(t.toString(),"->").concat(e)),i++)}),W.blackAttrs.length&&g.includes(W.blackAttrs,e)&&(W.blackAttrs.push(e),i++),!i){if(W.filterList&&W.filterList[n]&&g.includes(W.filterList[n],e)){var a=L(t,function(e){var t;null===(t=z.collect)||void 0===t||t.filterProtocol.push(e)});return a!==t&&(z.collect.filterList[n]=z.collect.filterList[n]||[],z.collect.filterList[n].push(e)),t?"".concat(e,"='").concat(a,"'"):e}return W.filterAttrs&&g.includes(W.filterAttrs,e)?((a=L(t,function(e){var t;null===(t=z.collect)||void 0===t||t.filterProtocol.push(e)}))!==t&&(null===(r=z.collect)||void 0===r||r.filterAttrs.push(e)),t?"".concat(e,"='").concat(a,"'"):e):t?"".concat(e,"='").concat(t,"'"):e}});return r="<".concat(n),o&&(r+=" ".concat(o)),a.closing&&(r+=" /"),r+=">"},v);null===(n=z.collect)||void 0===n||n.blackTags.push(e)}},U=function(e){var t=e.reportOnly,n=void 0===t||t,r=e.block;return n&&"all"===n?"report":("string"==typeof n&&("true"===n&&(n=!0),"false"===n&&(n=!1)),r?"enforce":n?"report":"enforce")},j=function(e){return function(n,r,i){if(!n||"string"!=typeof n)return n;var a=r;e===S&&(a=N).initCollect();var o=e(n,a);if(w(o)===w(n))return n;if(!i)return o;var s=i.logType,u=U(i),c=a.removeCollect();return E.report(t(t({type:s,disposition:u},c),{sourceText:_(n),filterText:_(o)})),"enforce"===u?o:n}},G=j(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 T(t).process(e)}),H=j(S),Y=function(e,t,n){var r=[],i=L(e,function(e){r.push(e)});if(i===e)return e;r=g.from(g.uniq(r));var a=t||n||{};if(!a)return i;var o=a.logType,s=U(n);return E.report({type:o,disposition:s,collectKey:r.join("___"),collectData:JSON.stringify(r),collectMode:"black",sourceText:_(e),filterText:_(i)}),"enforce"===s?i:e},J=x._xssProject||{},q=x.xssNamespace||{},X="3.0.26",Q={FilterXSS:T,version:X,webpackPluginVersion:"<%= webpackPluginVersion =>",reportOnly:"<%= reportOnly =>",filterXSS:G,_filterXSS:H,filterUrl:Y,Config:N,BlackConfig:z,project:J,setProjectName:function(e){J[e]=this,x._xssProjectName=e}};q.douyin_web=Q,x.xssNamespace=q,x.Math&&!x.Math.xssNamespace&&(x.Math.xssNamespace=q),J[X]=Q,x.globalThis=x,x.getFilterXss=function(){return void 0!==this._xssProjectName?this._xssProject[this._xssProjectName]:Q},x.xss=Q,x.isSafeUrl=B,x.isSafeDomain=B,x.isSafeProtocol=I,x._xssProject=J,x._xssProjectName&&(J[x._xssProjectName]=Q);var K=Q.setProjectName.bind(Q);e.BlackConfig=z,e.Config=N,e.FilterXSS=T,e._filterXSS=H,e.filterUrl=Y,e.filterXSS=G,e.isSafeDomain=B,e.isSafeProtocol=I,e.isSafeUrl=B,e.project=J,e.setProjectName=K,e.setXssNamespace=function(e){var t=e.appId,n=e.bid,r=e.region;q[t]=Q;N.bid=n,N.region=r,N.enabled=!0},e.xssNamespace=q,Object.defineProperty(e,"__esModule",{value:!0})}),(self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["67316"],{861962:function(e,t,n){n.d(t,{Z:function(){return r}});let r="0.12.13-rc.7"},631144:function(e,t,n){n.d(t,{g:function(){return a}});var r=n(403826),i=n(861504),a={onlyInit:!1,useWaterLevel:!1,maxBufferLength:10,minBufferLength:5,tickInSeconds:.2,getLicenseUrl:"",xhrSetup:{},retryCount:1,retryDelay:1e3,timeout:3e3,processMaxGapTime:1/0,preloadCacheType:1,needPreloadRangeList:!1,isOpenPreload:!0,needPreloadCheck:!1,preloadTime:0,preloadMaxCacheCount:0,needAutoBitrate:!0,keyValue:null,drm:null,switchBitRateWay:!1,enableWorker:!1,bufferThreshold:10,removeBufferLen:60,removeBufferAtSeek:!0,resumePlayWaterLevel:2,waitJampBufferMaxCnt:3,waitingInBufferTimeOut:5e3,waitingTimeOut:1e4,notDegradeErrorList:["timeout",403,404],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:r._.LOG,logMaxSize:204800},noPreloadAddBufferLen:0,enableFPSStuckHandle:!1,loadRangeType:i.TJ.SIZE,timerInWorker:!1,waitingRetrySeekTimes:null,waitingRetryDuration:null,disableInactiveWaitingCheck:!1,alwaysStreamingLoad:!0,enableCusExpiryCheck:!1,enableCheckTrackGap:!1,trackGap:1,reqParams:{},isAddRange:!1,disableRepeatRange:!1,audioGroupingStrategy:2,reuseSecretKey:!1,bindSrcTiming:i.Iv.META_READY,enableMsePatches:!1,enableFixPreloadRepatLoad:!1,enablePreloadCache:!1}},937049:function(e,t,n){n.d(t,{O1:function(){return o},iR:function(){return s},oO:function(){return u},zO:function(){return c}});var r=n(61072),i=n(674495),a=n(144144),o={416:i.WE[i.wb.NETWROK_RANGE_NOT_SATISFIABLE],403:i.WE[i.wb.NETWORK_FORBIDDEN],404:i.WE[i.wb.NETWORK_NOTFOUND],timeout:i.WE[i.wb.NETWORK_TIMEOUT],networkError:i.WE[i.wb.NETWORK],lenNotMatch:2130,mse:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_OTHER],mseOpen:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_ADD_SB],mseAppend:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_APPEND_BUFFER],mse_hijack:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_HIJACK],eme_hijack:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.EME_HIJACK],metaError:i.WE[i.wb.DEMUX][i.wb.SUB_TYPES.MP4],muxError:i.WE[i.wb.REMUX][i.wb.SUB_TYPES.FMP4],other:i.WE[i.wb.OTHER],waitTimeout:i.WE[i.wb.RUNTIME][i.wb.SUB_TYPES.BUFFERBREAK_ERROR],waitTimeoutWithHidden:i.WE[i.wb.RUNTIME][i.wb.SUB_TYPES.WAITING_TIMEOUT_ERROR],drm:i.WE[i.wb.DRM][i.wb.SUB_TYPES.LICENSE],custom_drm:i.WE[i.wb.DRM][i.wb.SUB_TYPES.CUSTOM_LICENSE]},s=i.wb,u=(0,r.qH)(function e(t,n,i){(0,r.PA)(this,e);var s,u=0,c=0;null!=i&&i.range&&i.range.length>1&&(u=i.range[0],c=i.range[1]);var d=o[s=n]||s;this.headers=(null==i?void 0:i.headers)||null,this.errorCode=d,this.errorType=t,this.errorMessage=(null==i?void 0:i.httpText)||(null==i?void 0:i.message),this.url=null==i?void 0:i.url,this.httpCode=n,this.version=a.i,this.rangeStart=u,this.rangeEnd=c,this.ext=i,this.mediaError={code:d,message:(null==i?void 0:i.httpText)||(null==i?void 0:i.message)}}),c=(0,r.qH)(function e(t,n,i){(0,r.PA)(this,e),this.version=a.i,this.errorCode=n,this.errorType=t,this.errorMessage=i.msg,this.ext=i,this.mediaError={code:n,message:i.msg}})},588984:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(61072);n(346984),n(941533),n(451236),n(162093),n(503e3),n(232070),n(248385);var i=n(403826),a=n(861504),o=n(107093),s=function(e){function t(e,n,i,o,s){var u;return(0,r.PA)(this,t),(u=(0,r.$w)(this,t,[e,n,i,o,s])).logTag="".concat(s,"_").concat(a.TJ.SIZE)||"",u.fillGopDataInfo=null,u}return(0,r.XW)(t,e),(0,r.qH)(t,[{key:"updateAdaptTimeRange",value:function(e,t){this.lastTargetDur=t,!this.adaptTimeRange&&(this.adaptTimeRange=[]);var n=this.adaptTimeRange,r=this.timeRange;if(null!==e&&e>=0){var a=this.getAdaptIdxBySrcIdx(e,!0);if(null!==a&&a>=0)return this.log(i._.LOG," adaptTimeRange find range of timeRange,timeRangeIdx,",e,JSON.stringify(r[e])," ,addaptIdx,",a,JSON.stringify(n[a])),a}this.fillAdadptTimeRange(e,t);var o=this.createAdaptTimeRange(t);return o&&(n.push(o),this.log(i._.LOG,"update adaptTimeRange,startIdx",this.adaptTimeRange.length-1,JSON.stringify(o))),this.adaptTimeRange.length-1}},{key:"fillAdadptTimeRange",value:function(e,t){var n=this.adaptTimeRange,r=this.timeRange;if(null!==e&&e>=0){!(null!==(u=r[e])&&void 0!==u&&u.range)&&(r[e].range=this.calculateRange(e),this.log(i._.LOG,"adaptTimeRange update timeRange.range ,fragmentIdx",e,JSON.stringify(r[e])));for(var a=null===(c=n[n.length-1])||void 0===c?void 0:c.range,o=(null==a?void 0:a[1])||0;o<(null===(d=r[e])||void 0===d?void 0:d.range[0]);){var s=this.createAdaptTimeRange(t);if(s){if((null==s?void 0:s.range[1])>=(null===(l=r[e])||void 0===l?void 0:l.range[0])){this.log(i._.LOG,"gap adaptTimeRange ignore,adaptTimeRangeIdx",JSON.stringify(s));break}n.push(s);var u,c,d,l,f=n.length;n[f-1].isLoading=!0,n[f-1].downloaded=!0,o=n[n.length-1].range[1],this.log(i._.LOG,"gap adaptTimeRange,adaptTimeRangeIdx",this.adaptTimeRange.length-1,JSON.stringify(s))}}}}},{key:"calculateSize",value:function(e,t){var n,r,i,a,o=this.adaptTimeRange,s=this.timeRange,u=this.videoTrak,c=this.audioTrak;!(null!==(p=s[0])&&void 0!==p&&p.range)&&(s[0].range=this.calculateRange(0));var d=(null==o?void 0:o.length)||0,l=d>0&&o[d-1].range?o[d-1].range[1]:s[0].range[0],f=null;u&&u.length>0&&(f=this.getEndFrame("video",e));var h=null===(m=f)||void 0===m?void 0:m.endFrame,v=null;c&&c.length>0&&(v=this.getEndFrame("audio",e));var g=null===(_=v)||void 0===_?void 0:_.endFrame;if(h&&g){var p,m,_,y,b,k,C=h.offset+h.size,w=g.offset+g.size;C>w?(y=this.getFrameByPos("audio",null===(b=v)||void 0===b?void 0:b.newSegmentIdx,g.index,C))&&(g=y):(y=this.getFrameByPos("video",null===(k=f)||void 0===k?void 0:k.newSegmentIdx,h.index,w))&&(h=y)}if(h&&g)return{endAudioFrame:g,endVideoFrame:h,segmentIdx:Math.min(null===(n=f)||void 0===n?void 0:n.newSegmentIdx,null===(r=v)||void 0===r?void 0:r.newSegmentIdx),size:Math.max(h.offset+h.size,g.offset+g.size)-l};if(h)return{segmentIdx:null===(i=f)||void 0===i?void 0:i.newSegmentIdx,size:h.offset+h.size-l,endVideoFrame:h};if(g)return{segmentIdx:null===(a=v)||void 0===a?void 0:a.newSegmentIdx,endAudioFrame:g,size:g.offset+g.size-l}}},{key:"getFrameByPos",value:function(e,t,n,r){var i="video"===e?this.videoTrak:this.audioTrak;if(!(null!=i&&i.length))return null;for(var a=!1,o=n+1,s=t;s<i.length;s++){for(var u,c,d,l,f,h=(null===(f=u=(null===(l=i[s])||void 0===l?void 0:l.frames)||[])||void 0===f||null===(f=f[0])||void 0===f?void 0:f.index)||0;o<=u[u.length-1].index;o++)if((c=u[o-h]).offset+c.size<=r)d=c;else{a=!0;break}if(a)break}return d}},{key:"getEndFrame",value:function(e,t){if("video"===e?(o=this.videoTrak,s=t*this.meta.videoTimescale):(o=this.audioTrak,s=t*this.meta.audioTimescale),!(null!==(n=o)&&void 0!==n&&n.length))return null;for(var n,r,a,o,s,u=this.adaptTimeRange,c=null,d=-1,l=(null==u?void 0:u.length)>0?u[u.length-1]:null,f=(null===(r="video"===e?null==l?void 0:l.endVideoFrame:null==l?void 0:l.endAudioFrame)||void 0===r?void 0:r.index)||0,h=(null==l?void 0:l.segmentIdx)||0,v=Math.round(s/o[0].frames[0].duration),g=h;g<o.length;g++){var p=o[g].frames;if((null==p?void 0:p.length)>0&&(p[p.length-1].index-f>=v||g===o.length-1)){var m=o[o.length-1].frames,_=Math.min(m[m.length-1].index,f+v)-p[0].index;c=p[_],d=d<0?g:Math.min(d,g);break}}return this.log(i._.LOG,"calculateSize, type: ".concat(e,", frameNum: ").concat(v,", idx: ").concat(f,"-").concat(null===(a=c)||void 0===a?void 0:a.index)),{newSegmentIdx:d,endFrame:c}}},{key:"createAdaptTimeRange",value:function(e,t){var n,r,a,o=this.calculateSize(e,t),s=o.size-1;if(this.log(i._.LOG,"createAdaptTimeRange, mergeDuration: ".concat(e,", adaptIdx:").concat(t,", loadSize:").concat(s)),0===s)return null;var u=this.adaptTimeRange,c=!t||t<=0?u.length-1:t-1,d=c>=0?u[c]:null,l=(null==d||null===(n=d.range)||void 0===n?void 0:n[1])+1||this.timeRange[0].range[0];if(l>=this.fileSize)return null;var f=Math.min(l+s-1,this.fileSize-1),h=(null==d?void 0:d.endTime)||this.timeRange[0].startTime,v=Math.min(null!=o&&null!==(r=o.endVideoFrame)&&void 0!==r&&r.pts?o.endVideoFrame.pts/this.meta.videoTimescale:Number.MAX_VALUE,null!=o&&null!==(a=o.endAudioFrame)&&void 0!==a&&a.pts?o.endAudioFrame.pts/this.meta.audioTimescale:Number.MAX_VALUE),g=o.endAudioFrame,p=o.endVideoFrame;return{startTime:h,endTime:v,range:[l,f],duration:e,downloaded:!1,isLoading:!1,endAudioFrame:g,endVideoFrame:p,segmentIdx:o.segmentIdx}}},{key:"getCurLoadSize",value:function(e){return(!e||e<=0)&&(e=5),Math.ceil(e*Math.floor(this._bitRate/8||this.fileSize/this.meta.duration))}},{key:"getFragRange",value:function(e){var t,n=this.adaptTimeRange;if(e<n.length&&null!==(t=n[e])&&void 0!==t&&t.range)return this.log(i._.LOG,"getFragRange exist",e,JSON.stringify(n[e].range)),n[e].range;var r=this.updateAdaptTimeRange(null,n[e].duration);return this.adaptTimeRange[r].range}},{key:"getSamplesRange",value:function(e,t){var n=[0,0],r="video"===t?this.videoTrak:this.audioTrak;if(!!(null!=r&&r.length)){var i=this.lastDemuxSampleIdxRange[t],a=this.adaptTimeRange[e],o=("video"===t?a.endVideoFrame:a.endAudioFrame).index;return n[0]=i+1,n[1]=o,n}}},{key:"getAdaptIdxBySrcIdx",value:function(e,t){var n=this.adaptTimeRange,r=this.timeRange;if(!(null!=n&&n.length)||!(null!=r&&r.length))return -1;var a=n.length;if(t)return this.getAdaptIdx(e);var o=this.getAdaptIdx(e);if(o>=0)return this.log(i._.LOG,",getAdaptIdxBySrcIdx, fragIndex, ",e,",adaptIdx,",o),o;if(n[a-1].range[1]<this.fileSize-1)for(;(null===(s=r[e].range)||void 0===s?void 0:s[1])>=(null===(u=n[n.length-1].range)||void 0===u?void 0:u[1]);){this.updateAdaptTimeRange(e,this.lastTargetDur||5);var s,u,c=this.getAdaptIdx(e);if(c>0)return this.log(i._.LOG,"new make, getAdaptIdxBySrcIdx, fragIndex: ",e,",adaptIdx: ",o),c}return this.adaptTimeRange.length-1}},{key:"getAdaptIdx",value:function(e){var t,n=this.adaptTimeRange,r=this.timeRange,a=null===(t=r[e])||void 0===t?void 0:t.range;!a&&(a=o.Z.getFragRange(e,this.videoTrak,this.audioTrak),r[e].range=a,this.log(i._.LOG,",updateTimeRange.range, fragIndex: ",e,JSON.stringify(r[e])));var s=n.findIndex(function(e){var t,n;return(null==e?void 0:e.range[0])<=(null===(t=a)||void 0===t?void 0:t[0])&&(null==e?void 0:e.range[1])>=(null===(n=a)||void 0===n?void 0:n[0])});return this.log(i._.LOG,",getAdaptIdx, srcIdx: ",e,JSON.stringify(r[e]),", adaptIdx: ",JSON.stringify(n[s])),s}},{key:"resetFragmentLoadState",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.log(i._.LOG,", resetFragmentLoadState, fragIndex: ",e,",changeBitrate: ",n),n){var r=this.adaptTimeRange.length;this.adaptTimeRange.splice(e+1,r-e-1),t=this.adaptTimeRange.map(function(e){return e.duration}),this.adaptTimeRange=[]}else t=this.adaptTimeRange;for(var a=this.adaptTimeRange,o=0;o<t.length;o++)if(a[o]&&(o<e?(a[o].downloaded=!0,a[o].isLoading=!0):(a[o].downloaded=!1,a[o].isLoading=!1)),n){var s=this.createAdaptTimeRange(t[o],o);s&&(o<e&&(s.downloaded=!0,s.isLoading=!0),this.adaptTimeRange.push(s))}}},{key:"getSubRange",value:function(e,t,n){var r,a,o=this.adaptTimeRange,s=this.timeRange,u=null===(r=o[e])||void 0===r?void 0:r.range,c=this.getFragmentIdx(t);!(null!==(a=s[c])&&void 0!==a&&a.range)&&(s[c].range=this.calculateRange(c));var d=[s[c].range[0],u[1]];return this.log(i._.LOG,">>>>>getSubRange finalRange ",JSON.stringify(d),",oldRange,",JSON.stringify(n),",adaptIdx,",e,",srcFragIndex,",c,JSON.stringify(s[c])),d}},{key:"calculateRange",value:function(e){return o.Z.getFragRange(e,this.videoTrak,this.audioTrak)}},{key:"fillGopData",value:function(e){var t=-1,n=-1,r=-1;if(this.videoTrak.length){var a=this.getEndFrameByTime("video",e);t=(null==a?void 0:a.index)||-1,r=a.offset+a.size;var o=this.getEndFrameByTime("audio",e);n=(null==o?void 0:o.index)||-1,r=Math.max(r,o.offset+o.size)}else{var s=this.getEndFrameByTime("audio",e);n=(null==s?void 0:s.index)||-1,r=s.offset+s.size}this.fillGopDataInfo={endVFrameIdx:t,endAFrameIdx:n,endRange:r},this.log(i._.LOG,"fillGopDataInfo: ".concat(t,", ").concat(n,", ").concat(r))}},{key:"getEndFrameByTime",value:function(e,t){var n="video"===e?this.videoTrak:this.audioTrak;if(n){var r=n.find(function(e){return e.startTime<=t&&e.endTime>t});if(r)return r.frames[r.frames.length-1]}}}])}(n(614184).Yx)},858985:function(e,t,n){n.d(t,{F5:function(){return d},Pj:function(){return o},Ru:function(){return i},Vh:function(){return l},Wp:function(){return c},f4:function(){return a},mH:function(){return u},pl:function(){return s}}),n(232070),n(759943);var r=n(718828),i={playBtnClick:function(e,t,n,r){!e.paused&&e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),r.call(e,t,n)}},a={waiting:function(e,t){var n=e.player,r=e.eventName;n.waitingMoreBuffer=!0,t(r,e)},play:function(e,t){var n=e.player,r=e.eventName;!n.waitingMoreBuffer&&t(r,e)},pause:function(e,t){var n=e.player,r=e.eventName;!n.waitingMoreBuffer&&t(r,e)},seeking:function(e,t){var n=e.player,r=e.eventName;n.isSeekingStart=!0,t(r,e)},progress:function(e,t){(0,r.cM)(">>>>progress");var n=e.player,i=e.eventName;if(n.waitingMoreBuffer){var a=n.getBufferedRange(n.buffered2);0===a[0]&&0===a[1]||(void 0===n.inWaitingStart||n.isSeekingStart?((0,r.cM)("progress startplay or seek ended"),a[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||a[1]>n.duration-1?((0,r.cM)("progress out bufferWaterLevel"),n.play()):((0,r.cM)("progress not out bufferWaterLevel"),n.emit("waiting"))):((0,r.cM)("progress video waiting end"),a[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||a[1]>n.duration-1?((0,r.cM)("progress out bufferWaterLevel"),n.play()):((0,r.cM)("progress not out bufferWaterLevel"),n.emit("waiting"))))}t(i,e)},playing:function(e,t){var n=e.player,i=e.eventName;(0,r.cM)("playing");var a=n.getBufferedRange(n.buffered2);if(0===a[0]&&0===a[1]){(0,r.cM)("playing currentTime no buffer, not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e);return}void 0===n.inWaitingStart||n.isSeekingStart?((0,r.cM)("playing startplay or seek ended"),a[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||a[1]>n.duration-1?((0,r.cM)("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,n.isSeekingStart=!1,t(i,e)):((0,r.cM)("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e))):((0,r.cM)("playing video waiting ended"),a[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||a[1]>n.duration-1?((0,r.cM)("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,t(i,e)):((0,r.cM)("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e)))}};function o(e){return/^http(s)?:\/\/.+/.test(e)}function s(e,t){return Math.round(8e3*e/t/1024)}function u(e){var t,n;return!((null==e||null===(t=e.message)||void 0===t?void 0:t.indexOf("Failed to fetch"))>=0)&&(null==e||!e.isTimeout)&&(null==e||!e.response||!((null===(n=e.response)||void 0===n?void 0:n.status)>=400)||!(e.response.status<=599))&&!0}function c(e){var t,n;return!((null==e||null===(t=e.message)||void 0===t?void 0:t.indexOf("Failed to fetch"))>=0)&&(null==e||!e.response||!((null===(n=e.response)||void 0===n?void 0:n.status)>=400)||!(e.response.status<=599))&&!0}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.preLoadMeta||t}function l(e,t){for(var n=e.vtype,r=e.codecType,i=e.definition,a=e.bitrate,o=null,s,u=0;s=t[u];u++){var c=s.vtype===n;if(c&&(c=s.codecType===r),c&&(c=s.definition===i||s.definition===Number(i)),c&&(c=!s.bitrate||!a||Number(s.bitrate)===Number(a)),c){o=s;break}}return o}},235154:function(e,t,n){n.d(t,{E0:function(){return h},G9:function(){return f},Gb:function(){return d},Hs:function(){return c},KI:function(){return s},pU:function(){return l},qK:function(){return u},u8:function(){return o},yx:function(){return a}});var r=n(61072);n(936553),n(313036),n(124300),n(173757),n(2885),n(248385),n(759943),n(240148),n(832674),n(905442),n(446336),n(808483),n(840938),n(118438),n(325598),n(92999),n(611067),n(273723),n(724016),n(803903),n(214604),n(901250),n(318922),n(755006),n(437048),n(488336),n(825666),n(177162),n(286633),n(943281),n(810658),n(82726),n(224727);function i(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),n=e.indexOf("Trident/");return t>0||n>0}function a(){return/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}function o(){var e=window.chrome,t=window.navigator,n=t.vendor,r=void 0!==window.opr,i=t.userAgent.indexOf("Edge")>-1;return t.userAgent.match("CriOS")||null!=e&&"Google Inc."===n&&!1===r&&!1===i}function s(){var e,t,n,r,o,s,u,c,d;return!!navigator.requestMediaKeySystemAccess&&(e=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/);if(e&&e[1]){var t=parseInt(e[1],10);if(t>0)return t}return null}(),t=a(),n=i(),u=(r=navigator.mimeTypes,o=navigator.userAgent,s=!1,r&&o.indexOf("Chrome")>1&&(s=Object.keys(r).some(function(e){return!!(r[e].type&&r[e].type.indexOf("360")>-1||r[e].type&&r[e].type.indexOf("application/vnd.chromium.remoting-viewer")>-1||r[e].description&&r[e].description.indexOf("360")>-1)||!1})),s&&(null===e||e<=100)),c=navigator.userAgent.indexOf("Firefox")>0,d=navigator.userAgent.indexOf("Edge")>0,!t&&!n&&!u&&!c&&!d)}function u(){try{if(("undefined"==typeof WebAssembly?"undefined":(0,r.Ac)(WebAssembly))==="object"&&"function"==typeof WebAssembly.instantiate){var 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){}return!1}function c(){if("undefined"==typeof self)return!1;var e=function(){if("undefined"!=typeof self)return self.MediaSource||self.WebKitMediaSource}(),t=!!e&&"function"==typeof e.isTypeSupported;return t&&void 0===self.MediaSource&&(self.MediaSource=e),t}function d(){return c()&&u()&&!i()}function l(){return u()&&!i()}function f(){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"'))}function h(){return"undefined"!=typeof MediaSource&&!!MediaSource.isTypeSupported&&MediaSource.isTypeSupported("video/mp4;codecs=bvc2.1.6.L93.B0")}},441226:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(61072);n(248385),n(679308);var i=(0,r.qH)(function e(){(0,r.PA)(this,e);var t,n,i=new Promise(function(e,r){t=e,n=r});return i.resolve=function(e){t(e),i.state="fulfilled"},i.reject=function(e){n(e),i.state="rejected",i.isBreak="DESTROYED"===e},i.state="pending",i},[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}])},358452:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(648955);n(918016);var i=n(340343),a=(0,r.qH)(function e(t,n,a,o){(0,r.PA)(this,e),this.adaptRangeRes=[],o&&(this.adaptRange=new i.Q(t,n,a,o))},[{key:"push",value:function(e){var t;null===(t=this.adaptRangeRes)||void 0===t||t.push(e)}},{key:"pop",value:function(){var e;return null===(e=this.adaptRangeRes)||void 0===e?void 0:e.shift()}},{key:"updateBitrate",value:function(e){var t;null===(t=this.adaptRange)||void 0===t||t.updateBitrate(e)}},{key:"getAdaptCacheBuffer",value:function(e){var t,n=null===(t=this.adaptRange)||void 0===t?void 0:t.getAdaptCacheBuffer();return(Number.isNaN(n)||!n)&&(n=e),n}},{key:"destroy",value:function(){this.adaptRange=null,this.adaptRangeRes=[]}}])},655675:function(e,t,n){n.d(t,{Z:function(){return y}});var r=n(6055);n(346984),n(124300),n(9498),n(497397),n(248385),n(679308),n(591111),n(490629);var i=n(867348),a=n(832567),o=n(99020),s=n(494742),u=n(129966),c={},d="readonly",l="readwrite";function f(e){var t=c[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 h(e,t){return new Promise(function(n,r){if(c[e.name]=c[e.name]||_(),e.db){if(!t)return n(e.db);f(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=null===a.Z||void 0===a.Z?void 0:a.Z.open.apply(a.Z,i);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName)}catch(e){if("ConstraintError"===e.name);else throw e}}),o.onerror=function(e){e.preventDefault(),r(o.error)},o.onsuccess=function(){n(o.result),!function(e){var t=c[e.name].deferredOperations.pop();if(t)t.resolve(),t.promise}(e)}})}function v(e){return h(e,!1)}function g(e){return h(e,!0)}function p(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(e.version,e.version=e.db.version),i||n){if(n){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function m(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(r>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return Promise.resolve().then(function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),h(e,!0)}).then(function(){return(function(e){f(e);for(var t=c[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,h(e,!1).then(function(t){if(e.db=t,p(e))return h(e,!0);return t}).then(function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r}).catch(function(t){throw!function(e,t){var n=c[e.name].deferredOperations.pop();if(n)n.reject(t),n.promise}(e,t),t})})(e).then(function(){m(e,t,n,r-1)})}).catch(n);n(i)}}function _(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}let y=(0,r.qH)(function e(){(0,r.PA)(this,e)},[{key:"ready",value:function(){return this._ready}},{key:"_initStorage",value:function(e){var t=this;t._defaultConfig=e;var n={db:null,name:"",version:""};if(e)for(var r in e)n[r]=e[r];var i=c[n.name];!i&&(i=_(),c[n.name]=i),i.forages.push(t),!t._initReady&&(t._initReady=t.ready,t._ready=t._fullyReady);var a=[];function o(){return Promise.resolve()}for(var s=0;s<i.forages.length;s++){var u=i.forages[s];u!==t&&a.push(u._initReady().catch(o))}var d=i.forages.slice(0);return t._ready=Promise.all(a).then(function(){return n.db=i.db,h(n,!1)}).then(function(e){if(n.db=e,p(n,t._defaultConfig.version))return h(n,!0);return e}).then(function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<d.length;r++){var a=d[r];a!==t&&(a._dbInfo.db=n.db,a._dbInfo.version=n.version)}}),t._ready}},{key:"probeSupport",get:function(){return(0,i.Z)()}},{key:"getItem",value:function(e,t){var n=this;e=(0,u.Z)(e);var r=new Promise(function(t,r){n.ready().then(function(){m(n._dbInfo,d,function(i,a){if(i)return r(i);try{var o=a.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),t(e)},o.onerror=function(){r(o.error)}}catch(e){r(e)}})}).catch(r)});return(0,o.Z)(r,t),r}},{key:"setItem",value:function(e,t,n){var r=this;e=(0,u.Z)(e);var i=new Promise(function(n,i){r.ready().then(function(){return r._dbInfo,t}).then(function(t){m(r._dbInfo,l,function(a,o){if(a)return i(a);try{var s=o.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var u=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=u.error?u.error:u.transaction.error;i(e)}}catch(e){i(e)}})}).catch(i)});return(0,o.Z)(i,n),i}},{key:"removeItem",value:function(e,t){var n=this;e=(0,u.Z)(e);var r=new Promise(function(t,r){n.ready().then(function(){m(n._dbInfo,l,function(i,a){if(i)return r(i);try{var o=a.objectStore(n._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){r(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}})}).catch(r)});return(0,o.Z)(r,t),r}},{key:"clear",value:function(e){var t=this,n=new Promise(function(e,n){t.ready().then(function(){m(t._dbInfo,l,function(r,i){if(r)return n(r);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;n(e)}}catch(e){n(e)}})}).catch(n)});return(0,o.Z)(n,e),n}},{key:"length",value:function(e){var t=this,n=new Promise(function(e,n){t.ready().then(function(){m(t._dbInfo,d,function(r,i){if(r)return n(r);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return(0,o.Z)(n,e),n}},{key:"all",value:function(e){var t=this,n=new Promise(function(e,n){t.ready().then(function(){m(t._dbInfo,d,function(r,i){if(r)return n(r);try{var a=i.objectStore(t._dbInfo.storeName).openCursor(),o=[];a.onsuccess=function(){var t=a.result;if(!t){e(o);return}o.push({key:t.key,value:t.value}),t.continue()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return(0,o.Z)(n,e),n}},{key:"_fullyReady",value:function(e){var t=this,n=t._initReady().then(function(){var e=c[t._dbInfo.name];if(null!=e&&e.dbReady)return e.dbReady});return(0,s.Z)(n,e,e),n}},{key:"getItemSync",value:function(){throw Error("NotSupported")}}])},782938:function(e,t,n){n.d(t,{Z:function(){return r}});function r(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}},365791:function(e,t,n){n.d(t,{Q:function(){return a}});var r=n(730210);n(162093),n(2885),n(248385);var i=n(713804),a=(0,r.qH)(function e(t,n,i,a){var o=this;(0,r.PA)(this,e),this.config=e.getDefaultConfig(),this.bitrate=0,this.lastAdaptCacheBuffer=0,a&&Object.keys(a).map(function(e){void 0!==a[e]&&null!==a[e]&&(o.config[e]=a[e])}),this.duration=i,this.player=t,this.updateBitrate(n)},[{key:"updateBitrate",value:function(e){this.bitrate=e,!this.bitrate&&(this.bitrate=this.config.minBandwidth)}},{key:"getAdaptLoadDuration",value:function(){var e=this.player,t=this.config;if(!t.rangeControl)return -1;var n=(null==e?void 0:e.bufferedPoint)||null,r=e&&null!=n&&n.end?n.end-e.currentTime:0;if(t.use_weibull){var a=this.calcToPlayDurationMs(t.cdf_for_playing_media_low)/1e3;a>this.lastAdaptCacheBuffer&&(a=this.lastAdaptCacheBuffer);var o=0;return r<a?o=a-r:r<this.lastAdaptCacheBuffer&&(o=this.lastAdaptCacheBuffer-r),e&&o+r>e.duration&&(o=e.duration-r),(0,i.uZ)(o,t.rangeMinDuration,t.rangeMaxDuration)}return Math.max(t.rangeMaxDuration-r,t.rangeMinDuration)}},{key:"getAdaptCacheBuffer",value:function(){var e=this.player,t=this.config,n=this.bitrate;if(!t.targetCacheControl)return this.lastAdaptCacheBuffer=-1,-1;var r=t.estPlayTime,i=(null==e?void 0:e.currentTime)||0,a=r;t.use_weibull?a=this.calcToPlayDurationMs(t.cdf_for_playing_media_buffer)/1e3:t.estPTcontrol&&(a=Math.min(r,(this.duration||(null==e?void 0:e.duration)||0)-i));var o=t.playbackRateControl&&e?e.playbackRate:1,s=e&&1024*e.avgSpeed/o||0,u=Math.max(t.safeFactor*s,t.minBandwidth);null!=e&&e.avgSpeed&&(u=t.safeFactor*s);var c=n>0?Math.floor((1-u/n)*a):0;return c=t.minDangerThreshold+Math.max(c,0),this.lastAdaptCacheBuffer=Math.min(Math.max(t.cacheSafeFactor*c,t.minTargetCacheDur),t.maxTargetCacheDur),this.lastAdaptCacheBuffer}},{key:"calcToPlayDurationMs",value:function(e){var t,n=this.player,r=this.config,a=null==n||null===(t=n.config)||void 0===t||null===(t=t.mediaInfo)||void 0===t?void 0:t.play_time_prob_dist,o=(0,i.eq)(a,r.default_weibull_param||i.XB),s=1e3*(this.duration||(null==n?void 0:n.duration)||0),u=1e3*((null==n?void 0:n.currentTime)||0),c=(0,i.cF)(o,e,s,u)-u;return c=(0,i.uZ)(c,r.min_to_play_ms,r.max_to_play_ms)}}],[{key:"getDefaultConfig",value:function(){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,playbackRateControl:!1,use_weibull:!1,default_weibull_param:i.XB,cdf_for_playing_media_buffer:.5,cdf_for_playing_media_low:.25,min_to_play_ms:1e3,max_to_play_ms:5e3}}}])},804870:function(e,t,n){n.d(t,{e:function(){return c}});var r=n("137263");n("346984"),n("705574"),n("124300"),n("162093"),n("171655"),n("932651"),n("2885"),n("248385"),n("591111"),n("437545"),n("630361"),n("497736"),n("954018"),n("506442"),n("795434"),n("664089"),n("863063"),n("478782"),n("866124"),n("378508"),n("70698"),n("669689"),n("490629");var i=n("55743"),a=n("479248"),o=n("275764"),s=(0,r.qH)(function e(t,n,i,a){var o=this;(0,r.PA)(this,e),this.config=e.getDefaultConfig(),Object.keys(a).map(function(e){void 0!==a[e]&&null!==a[e]&&(o.config[e]=a[e])}),this.duration=i,this.player=t,this.updateBitrate(n),this.curPCDNInBuffer=this.config.maxPCDNInBuffer,this.curPCDNOutBuffer=this.config.maxPCDNOutBuffer,this.PCDNChangeCnt=0},[{key:"updateBitrate",value:function(e){this.bitrate=e,!this.bitrate&&(this.bitrate=this.config.minBandwidth)}},{key:"getPCDNInBuffer",value:function(){var e=this.config,t=this.player,n=this.bitrate;if(!e.PCDNBufferControl)return null;var r=e.estPlayTime,i=r;e.estPTcontrol&&(i=Math.min(r,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));var a=e.safePCDNInFactor,o=e.minBandwidth,s=e.maxPCDNInBuffer,u=e.minPCDNInBuffer,c=a*Math.max((null==t?void 0:t.avgSpeedPCDN)*1024||0,o),d=n>0?(1-c/n)*i:0;return this.curPCDNInBuffer=Math.min(s,Math.max(u,d)),this.curPCDNInBuffer}},{key:"getPCDNOutBuffer",value:function(){var e=this.config,t=this.player,n=this.bitrate;if(!e.PCDNBufferControl)return null;var r=e.estPlayTime,i=r;e.estPTcontrol&&(i=Math.min(r,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));var a=e.safePCDNOutFactor,o=e.minBandwidth,s=e.maxPCDNOutBuffer,u=e.minPCDNOutBuffer,c=a*Math.max((null==t?void 0:t.avgSpeedPCDN)*1024||0,o),d=n>0?(1-c/n)*i:0;return this.curPCDNOutBuffer=Math.min(s,Math.max(u,d)),this.curPCDNOutBuffer}},{key:"getPCDNChangeCnt",value:function(){var e=this.config,t=e.PCDNCntControl,n=e.alpha,r=this.curPCDNInBuffer,i=this.player,a=(null==i?void 0:i.bufferedPoint)||null,o=a&&a.end?a.end-i.currentTime:0;return t?o>r+(this.PCDNChangeCnt-1)*n&&this.PCDNChangeCnt++:o>=r&&this.PCDNChangeCnt<2&&this.PCDNChangeCnt++,this.PCDNChangeCnt}}],[{key:"getDefaultConfig",value:function(){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}}}]),u=new Map,c=function(){var e,t;function n(e,t,a,o){var u,c=this;(0,r.PA)(this,n),this.options=n.getDefaultConfig(),Object.keys(e).map(function(t){void 0!==e[t]&&null!==e[t]&&(c.options[t]=e[t])}),!this.options.productConfig||this.options.productConfig.app_id,this.loader=new i.mf(this.options),this.resetTrackeArgs(),this._lastFileInfo=null,this.lastfetchNodeTime=-1,this._lastRetFileKey=null,this._minUpdateNodeStep=this.options.ErrorTimeStep,null!==(u=this.options)&&void 0!==u&&null!==(u=u.adaptPCDNConfig)&&void 0!==u&&u.PCDNBufferControl&&(this.pcdnAdapt=new s(t,a,o,this.options.adaptPCDNConfig))}return(0,r.qH)(n,[{key:"isOpenAdaptPCDN",get:function(){return!!this.pcdnAdapt}},{key:"curPCDNInBuffer",get:function(){return this.pcdnAdapt.curPCDNInBuffer}},{key:"getPCDNInBuffer",value:function(){var e;return null===(e=this.pcdnAdapt)||void 0===e?void 0:e.getPCDNInBuffer()}},{key:"curPCDNOutBuffer",get:function(){return this.pcdnAdapt.curPCDNOutBuffer}},{key:"getPCDNOutBuffer",value:function(){var e;return null===(e=this.pcdnAdapt)||void 0===e?void 0:e.getPCDNOutBuffer()}},{key:"curPCDNChangeCnt",get:function(){return this.pcdnAdapt.PCDNChangeCnt}},{key:"getPCDNChangeCnt",value:function(){var e;return null===(e=this.pcdnAdapt)||void 0===e?void 0:e.getPCDNChangeCnt()}},{key:"updatePCDNBitrate",value:function(e){var t;return null===(t=this.pcdnAdapt)||void 0===t?void 0:t.updateBitrate(e)}},{key:"resetTrackeArgs",value:function(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}}},{key:"getPCDNNode",value:function(e,t,n){var r,i=l(t),o=u.get(d(e,i)),s=new a.Q;return!(null!=o&&o.nodes)||(null==o||null===(r=o.nodes)||void 0===r?void 0:r.length)<1?this.fetchPCDNNode(null,null,n).then(function(e){s.resolve(e)}).catch(function(e){s.reject(e)}):(o.fromCache=!0,s.resolve(o)),s}},{key:"removePCDNNode",value:function(e,t,n){var r=l(t),i=u.get(d(e,r)),a=null==i?void 0:i.nodes;a&&(n?i.nodes=a.filter(function(e){return e&&0>n.indexOf(e.url)}):a.shift(),u.set(d(e,r),i)),(!a||!a.length)&&this.fetchPCDNNode().then().catch(function(){})}},{key:"fetchPCDNNode",value:(e=(0,r.x)((0,r.l5)().mark(function e(t,o,s){var c,f,h,v,g,p,m,_,y,b,k,C,w,T,x,E;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c=new a.Q,o){e.next=5;break}o=this._lastFileInfo,e.next=15;break;case 5:if(o.byterate=l(o.bitrate),this.options.trackerOptions&&Object.assign(o,this.options.trackerOptions),this._lastFileInfo=Object.assign({},o,{byterate:o.byterate}),!((null==(h=u.get(d(o.vid,o.byterate)))||null===(f=h.nodes)||void 0===f?void 0:f.length)>0)){e.next=13;break}return h.fromCache=!0,c.resolve(h),e.abrupt("return",c);case 13:delete o.bitrate,this._lastFileInfo=o;case 15:if(o){e.next=18;break}return c.resolve(null),e.abrupt("return",c);case 18:if(v=!1,g=d(o.vid,o.byterate),this._lastRetFileKey!==g&&(this.resetTrackeArgs(),v=!0),!(Date.now()-this.lastfetchNodeTime<this._minUpdateNodeStep&&!v)){e.next=24;break}return c.resolve(null),e.abrupt("return",c);case 24:if(this.lastfetchNodeTime=Date.now(),this._lastRetFileKey=g,o.sfid?o.version=1:o.vid&&(o.version=2),this.options.withReferer&&(o.with_referer=this.options.withReferer),p=JSON.stringify(Object.assign(this.options.productConfig,{file_info:o},this.trackeArgs,{req_id:s})),!(this.trackeArgs.req_times>=this.options.maxCnt)){e.next=33;break}return c.resolve(null),e.abrupt("return",c);case 33:return!this.loader&&(this.loader=new i.mf(this.options)),this.trackeArgs.req_times+=1,e.prev=35,n.pcdn_tracker_request_cnt++,e.next=39,this.loader.load(t||this.options.trackerUrl,{body:p});case 39:m=e.sent,_=null,m&&(this.trackeArgs.resp_times+=1,b=8*o.byterate,m.done&&null!==(y=m.data)&&void 0!==y&&y.Result?((_=(k=m.data.Result).nodes)&&_.length>0?n.pcdn_tracker_success_cnt++:this._minUpdateNodeStep=this.options.NULLNodeTimeStep,_.map(function(e){e.vid=o.vid,e.bitrate=b}),C=k.fid,w=k.trace_id,T=k.req_id,x={nodes:_,fid:C,vid:o.vid,trace_id:w,req_id:T,bitrate:b},E=d(o.vid,o.byterate),u.set(E,x),this.trackeArgs.fid=k.fid,this.trackeArgs.trace_id=k.trace_id,this.trackeArgs.token=k.token,c.resolve(x)):(this._minUpdateNodeStep=this.options.ErrorTimeStep,c.reject(m))),e.next=49;break;case 44:e.prev=44,e.t0=e.catch(35),this._minUpdateNodeStep=this.options.ErrorTimeStep,c.reject(e.t0);case 49:return e.abrupt("return",c);case 50:case"end":return e.stop()}},e,this,[[35,44]])})),function(t,n,r){return e.apply(this,arguments)})}],[{key:"pluginName",get:function(){return"PCDN"}},{key:"pcdnReqCnt",get:function(){var e=n.pcdn_tracker_request_cnt,t=n.pcdn_tracker_success_cnt;return n.pcdn_tracker_request_cnt=0,n.pcdn_tracker_success_cnt=0,{pcdn_tracker_request_cnt:e,pcdn_tracker_failed_cnt:e-t}}},{key:"getDefaultConfig",value:function(){return{trackerUrl:"",loaderType:o.t.FETCH,responseType:o.U.JSON,mode:"cors",method:"POST",retry:0,retryDelay:3e3,timeout:5e3,node_num:5,client_info:null,maxCnt:30,withReferer:0,NULLNodeTimeStep:6e4,ErrorTimeStep:15e3}}},{key:"gainPCDNNode",value:(t=(0,r.x)((0,r.l5)().mark(function e(t,o,s,u){var c,d,f,h,v,g;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=n.getDefaultConfig(),Object.keys(o).map(function(e){void 0!==o[e]&&null!==o[e]&&(c[e]=o[e])}),!u||u.app_id,d=new a.Q,s?(s.byterate=l(s.bitrate),this.options.trackerOptions&&Object.assign(s,this.options.trackerOptions),delete s.bitrate):d.reject("video fileInfo need set"),f=JSON.stringify(Object.assign(u,{file_info:s},{node_num:(null==o?void 0:o.node_num)||3})),h=new i.mf(c),e.prev=8,n.pcdn_tracker_request_cnt++,e.next=12,h.load(t,{body:f});case 12:(g=e.sent).done&&(null===(v=g.data)||void 0===v||null===(v=v.Result)||void 0===v||null===(v=v.nodes)||void 0===v?void 0:v.length)>0&&n.pcdn_tracker_success_cnt++,d.resolve(g),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(8),d.reject((null===e.t0||void 0===e.t0?void 0:e.t0.message)||"get pcdnNode error");case 20:return e.abrupt("return",d);case 21:case"end":return e.stop()}},e,this,[[8,17]])})),function(e,n,r,i){return t.apply(this,arguments)})}])}();function d(e,t){return"".concat(e,"-").concat(t)}function l(e){return Math.floor(e/8)}(0,r._x)(c,"pcdn_tracker_request_cnt",0),(0,r._x)(c,"pcdn_tracker_success_cnt",0)},382983:function(e,t,n){n.d(t,{Z:function(){return a}}),n(124300),n(248385),n(591111),n(490629),n(656562),n(992871);var r="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlPXt9LHQ9T2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eTtmdW5jdGlvbiBhKHQscyl7ZVt0XT1zZXRUaW1lb3V0KChmdW5jdGlvbigpe3Bvc3RNZXNzYWdlKHtkYXRhOntmYWtlSWQ6dH19KSxhKHQscyl9KSxzKX1wb3N0TWVzc2FnZSh7ZXZlbnQ6InJlYWR5In0pLGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLChmdW5jdGlvbihzKXt0cnl7dmFyIHI9cy5kYXRhLG89dm9pZCAwPT09cj97fTpyLGM9by5hY3Rpb24sbj1vLmZha2VJZCxpPW8udGltZTtzd2l0Y2goYyl7Y2FzZSJzZXRJbnRlcnZhbCI6YShuLGkpO2JyZWFrO2Nhc2UiY2xlYXJJbnRlcnZhbCI6Y2FzZSJjbGVhclRpbWVvdXQiOnQuY2FsbChlLG4pJiYoY2xlYXJUaW1lb3V0KGVbbl0pLGRlbGV0ZSBlW25dKTticmVhaztjYXNlInNldFRpbWVvdXQiOmVbbl09c2V0VGltZW91dCgoZnVuY3Rpb24oKXtwb3N0TWVzc2FnZSh7ZGF0YTp7ZmFrZUlkOm59fSksdC5jYWxsKGUsbikmJmRlbGV0ZSBlW25dfSksaSl9fWNhdGNoKGQpe3Bvc3RNZXNzYWdlKHtldmVudDoiZXJyb3IiLGRhdGE6e2Vycm9yOmR9fSl9fSkpfSgpOwo=",i="undefined"!=typeof window&&window.Blob&&new Blob([atob(r)],{type:"text/javascript;charset=utf-8"});function a(){var e;try{if(!(e=i&&(window.URL||window.webkitURL).createObjectURL(i)))throw"";return new Worker(e)}catch(e){return new Worker("data:application/javascript;base64,"+r)}finally{!("undefined"!=typeof window&&navigator.userAgent.indexOf("Trident/")>0)&&e&&(window.URL||window.webkitlRL).revokeObjectURL(e)}}},874668:function(e,t,n){n.d(t,{Bo:function(){return v},HX:function(){return c},MP:function(){return m},P_:function(){return f},lF:function(){return p},mv:function(){return u},rM:function(){return d},tT:function(){return l},yJ:function(){return h}}),n(124300),n(248385),n(832674),n(905442),n(446336),n(808483),n(840938),n(118438),n(325598),n(92999),n(611067),n(273723),n(724016),n(803903),n(214604),n(901250),n(755006),n(437048),n(488336),n(825666),n(177162),n(286633),n(943281),n(810658),n(82726),n(224727),n(932651);var r,i,a="xg-video",o=!1;try{o=WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}catch(e){}var s={preloadDecoder:!1,reuseWasmDecoder:!0,reuseMseForAudio:!1,preciseSeekLimit:120,h264WithWebcodec:!0,lowDecodeThreshold:75,lowDecodeFpsDelta:10,tempDisabledThreshold:40,wasmFallbackToAsm:!1,audioWithMse:!0,canUseThreadMode:!1,offscreenCanvas:!1,disabledDuration:43200,longDisabledDuration:432e3,evaluateVVCount:0,disabledByLowdecodePrecent:.5,maxDecodeOnceWasm:o?6:8,maxDecodeOnceFirstTime:8,maxDecodeOnceWebcodec:20};function u(){return a}function c(e){a=e}function d(e){s=Object.assign({},s,e,{offscreenCanvas:e.offscreenCanvas&&!!window.OffscreenCanvas})}function l(){return s}function f(){var e="undefined"!=typeof customElements&&customElements.get(a);return e?{H264_DECODER_URL:e.h264Url,ASM_H264_DECODER_URL:e.h264AsmUrl,H265_DECODER_URL:e.h265Url,H265_THREAD_DECODER_URL:e.h265ThreadUrl,H265_SIMD_DECODER_URL:e.h265SimdUrl,ASM_H265_DECODER_URL:e.h265AsmUrl}:{}}function h(){if("undefined"==typeof customElements)return!1;var e=customElements.get(a);return o&&!!(null!=e&&e.h265SimdUrl)}function v(){if("undefined"==typeof customElements)return!1;var e=customElements.get(a);return!!window.SharedArrayBuffer&&!!(null!=e&&e.h265ThreadUrl)}var g=!1;try{g=(null===(r=localStorage)||void 0===r?void 0:null===(i=r.getItem)||void 0===i?void 0:i.call(r,"_sds"))==="y"}catch(e){}function p(){if("undefined"==typeof customElements)return!1;if(g)return!0;var e=!1,t=!1;try{var n=new(window.AudioContext||window.webkitAudioContext);n.close(),n=null,e=!0}catch(e){}try{for(var r=document.createElement("canvas"),i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=0;a<i.length;a++){var o=r.getContext(i[a]);if(o){var s=o.getExtension("WEBGL_debug_renderer_info"),u=o.getParameter(s.UNMASKED_RENDERER_WEBGL);u&&-1===u.indexOf("SwiftShader")&&-1===u.indexOf("Intel(R) HD")&&(t=!0),o=null,r=null;break}}g=e&&t&&!!WebAssembly,localStorage.setItem("_sds",g?"y":"n")}catch(e){}return g}function m(){return{simd:o,thread:v(),nbCpu:navigator.hardwareConcurrency}}},683636:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(315355),i=n(919209);n(346984),n(705574),n(117232),n(9498);var a=n(597931),o=function(){function e(t){(0,r.Z)(this,e),this.TAG="AudioTimeRange",this._parent=t,this._buffers=[],this._duration=0,this._baseDts=0,this._lastBuffer=null}return(0,i.Z)(e,[{key:"isLive",get:function(){return this._parent.isLive}},{key:"duration",get:function(){return this._duration},set:function(e){this._duration=e}},{key:"buffered",get:function(){var e=this;if(this.isLive)return{length:this._duration?1:0,start:function(){return 0},end:function(){return e._duration}};var t=this._mergeBufferRanges();return{length:t.length,start:function(e){var n=t[e];return n?n.start:0},end:function(e){var n=t[e];return n?n.end:1/0}}}},{key:"resetDts",value:function(e){this._baseDts=e}},{key:"_transitionSamples",value:function(e){for(var t=e.numberOfChannels,n=e.length,r=0;r<t;r++){for(var i=e.getChannelData(r),a=0;a<512;a++)i[a]=i[a]*a/512;for(var o=n-512;o<n;o++)i[o]=i[o]*(n-o)/512}}},{key:"append",value:function(e,t,n,r){-1===this._baseDts&&(this._baseDts=n),this._transitionSamples(e);var i=(n-this._baseDts)/1e3,o=i+t,s={start:i,end:o,startDts:n,source:e,duration:t,delay:r};return(a.kg.log(this.TAG,"add new buffer range, startDts:".concat(n,", [").concat(s.start," , ").concat(s.end,"]")),this._buffers.filter(function(e){return e.start===i}).length)?void 0:(this._buffers.push(s),this.isLive&&(this._duration=o),s.start)}},{key:"deletePassed",value:function(e){return this._buffers=this._buffers.filter(function(t){return t.start>=e}),this._buffers[0]}},{key:"canSeek",value:function(e){var t=this._buffers[this._buffers.length-1];return!!t&&!(t.start<e)&&!0}},{key:"_mergeBufferRanges",value:function(){var e=this._buffers.slice().sort(function(e,t){return e.start>t.start?1:-1}),t=e.length,n=[];if(!t)return n;for(var r={start:e[0].start,end:e[0].end},i=1;i<t;i++){var a=e[i];.5>Math.abs(r.end-a.start)?r.end=a.end:(n.push(r),r={start:a.start,end:a.end})}return n.push(r),n}},{key:"getBuffer",value:function(e){if(this.isLive)return this._buffers.shift();var t=this._buffers.filter(function(t){return t.start<e+.5&&t.end>e+.5})[0];return(a.kg.log(this.TAG,"get audio buffer , currentTime:".concat(e," ,buffer:[").concat(t&&t.start," , ").concat(t&&t.end,"]")),0!==e||t)?t:this._buffers[0]}},{key:"hasBuffer",value:function(){var e;return!!(null!==(e=this._buffers)&&void 0!==e&&e.length)}}]),e}()},651668:function(e,t,n){n.d(t,{Z:function(){return R}}),n("149336");var r=n("315355"),i=n("919209"),a=n("732905"),o=n("64505"),s=n("625813"),u=n("278997"),c=n("508881"),d=n("272787");n("346984"),n("932651");var l=n("597931");n("104882");var f=n("383943"),h=n("906918"),v=n("685290"),g=n("534611"),p=n("874668"),m=function(){function e(t){(0,r.Z)(this,e),this.TAG="DecodeEstimate",this._lowDecodeThreshold=(0,p.tT)().lowDecodeThreshold/5,this._lowDecodeFpsDelta=(0,p.tT)().lowDecodeFpsDelta,this._needEstimate=!0,this._parent=t,this._lastDecodeDot=0,this._lastDecodeCost=0,this._lastFrameDts=0,this._dtsDeltas=[],this._decodeCosts=[],this._lowDecodeQueue=[],this._fps=0,this._decodeFps=0,this._gopLength=0,this._webcodec=!1}return(0,i.Z)(e,[{key:"fps",get:function(){return this._fps}},{key:"decodeFps",get:function(){return this._decodeFps}},{key:"decodeCost",get:function(){return this._lastDecodeCost}},{key:"gopLength",get:function(){return this._gopLength}},{key:"webcodec",set:function(e){this._webcodec=e}},{key:"updateGopCount",value:function(){this._gopLength++}},{key:"needEstimateFps",value:function(){this._needEstimate=!0}},{key:"addDecodeInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{dts:0};this._estimateDecodeFps(e),this._estimateFps(e)}},{key:"resetDecodeDot",value:function(e){this._lastDecodeDot=e||0}},{key:"reset",value:function(){this._decodeCosts=[],this._lowDecodeQueue=[]}},{key:"_estimateFps",value:function(e){if(!this._needEstimate)return;if(!this._lastFrameDts){this._lastFrameDts=e.dts;return}var t=e.dts-this._lastFrameDts;if(this._lastFrameDts=e.dts,!(Math.abs(t)>200)){this._dtsDeltas.push(t);var n=this._dtsDeltas.length;!(n<5)&&(this._fps=Math.ceil(1e3/this._avg(this._dtsDeltas,n)),l.kg.log(this.TAG,"estimate fps:",this._fps),this._needEstimate=!1)}}},{key:"_estimateDecodeFps",value:function(e){if(!this._lastDecodeDot){this._lastDecodeDot=performance.now();return}var t=performance.now(),n=t-this._lastDecodeDot;this._lastDecodeDot=t,e.cost=n,this._lastDecodeCost=n,this._decodeCosts.push(n);var r=this._decodeCosts.length;if(!(r<5)){var i=this._avg(this._decodeCosts,r);this._decodeFps=Math.floor(1e3/i),this._decodeCosts=[],this._lowDecodeDetect()}}},{key:"_avg",value:function(e,t){return Math.floor(e.reduce(function(e,t){return e+=t},0)/t)||1}},{key:"_lowDecodeDetect",value:function(){if(!this._decodeFps){this._parent.emit(g.ZP.VIDEO.DECODE_LOW_FPS,0);return}this._decodeFps<this._fps*this._parent.playbackRate+(this.webcodec?0:this._lowDecodeFpsDelta)?this._lowDecodeQueue.push(this._decodeFps):this._lowDecodeQueue.pop(),this._lowDecodeQueue.length>this._lowDecodeThreshold&&(this._lowDecodeQueue=[],l.kg.log(this.TAG,"解码效率过低,应该降级"),this._parent.emit(g.ZP.VIDEO.DECODE_LOW_FPS,this._decodeFps))}},{key:"destroy",value:function(){this._parent=null}}]),e}(),_=n("830361"),y=function(e){(0,s.Z)(f,e);var t,n,d=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,r=(0,c.Z)(t);return e=n?Reflect.construct(r,arguments,(0,c.Z)(this).constructor):r.apply(this,arguments),(0,u.Z)(this,e)});function f(e,t){var n;return(0,r.Z)(this,f),(n=d.call(this,e,t))._timeRange=new h.Z((0,a.Z)(n)),n._decodeEstimate=new m((0,a.Z)(n)),n._frameQueue=new v.Z((0,a.Z)(n)),n._lastTimeupdate=0,n._renderCost=0,n._canAutoPlay=!0,n._videoDecode=!1,n._inSeeking=!1,n._frameRender=null,n._configuration=null,n._canvasLayoutDone=!1,n._render=n._render.bind((0,a.Z)(n)),n._renderWorker=new _.Z(n._render,e,(0,a.Z)(n)),n._canvas=n._renderWorker.canvas,n._bindEvents(),n}return(0,i.Z)(f,[{key:"canAutoPlay",get:function(){return this._canAutoPlay}},{key:"canvas",get:function(){return this._canvas}},{key:"timescale",get:function(){return 1e3}},{key:"fps",get:function(){return this._decodeEstimate.fps||this._meta&&this._meta.fpsNum/this._meta.fpsDen||24}},{key:"decodeFps",get:function(){return this._decodeEstimate.decodeFps}},{key:"decodeCost",get:function(){return this._decodeEstimate.decodeCost}},{key:"renderCost",get:function(){return this._renderCost}},{key:"totalSize",get:function(){return this._timeRange.totalSize}},{key:"bitrate",get:function(){return this._timeRange.bitrate},set:function(e){this._timeRange.bitrate=e}},{key:"gopLength",get:function(){return this._decodeEstimate.gopLength}},{key:"is540p",get:function(){return this._canvas.height<720}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"inSeeking",get:function(){return this._inSeeking}},{key:"interval",get:function(){return Math.floor(1e3/this.fps/this.playbackRate)}},{key:"playbackRate",get:function(){return this._playbackRate||1}},{key:"baseDts",get:function(){return this._timeRange.baseDts}},{key:"currentTime",get:function(){return this._timeRange.getCurrentTime(this.preciseVideoDts)}},{key:"timelinePosition",get:function(){return this._parent.timelinePosition}},{key:"lastTimelinePosition",get:function(){return this._lastTimelinePosition||0},set:function(e){this._lastTimelinePosition=e}},{key:"audioSyncDts",get:function(){return this._audioDts||this.baseDts},set:function(e){this._audioDts=e}},{key:"preciseVideoDts",get:function(){return this.audioSyncDts+Math.floor((this.timelinePosition-this.lastTimelinePosition)*1e3)}},{key:"readyState",get:function(){var e=this._frameQueue.length||(this.currentTime?1:0);return e?e>=8?4:e>=4?3:e>=2?2:1:0}},{key:"isHevc",get:function(){return!("hev1.1.6.L93.B0"!==(this._meta||{}).codec)}},{key:"videoDecode",get:function(){return this._videoDecode}},{key:"decoderMode",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.decoderMode}},{key:"configuration",get:function(){var e,t;return this._configuration?this._configuration:(this._configuration=this._meta.configuration||(0,l.Mv)(null===(e=this._meta)||void 0===e?void 0:e.sps[0],null===(t=this._meta)||void 0===t?void 0:t.pps[0]),this._configuration)},set:function(e){this._configuration=e.configuration||(0,l.Mv)(e.sps[0],e.pps[0])}},{key:"setSeekingStatus",value:function(e){this._inSeeking=e}},{key:"getDtsOfTime",value:function(e){return this._timeRange.getDtsOfTime(e)}},{key:"updateReady",value:function(){this._whenReady()}},{key:"forceRender",value:function(){this._render(!0)}},{key:"getSeekStartPosition",value:function(e,t){return this._timeRange.getSeekStartPosition(e,t)}},{key:"getSeekStartPositionBehind",value:function(e,t){return this._timeRange.getSeekStartPositionBehind(e,t)}},{key:"canSeek",value:function(){throw Error("need override by children")}},{key:"emitResizeEvent",value:function(){this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.RESIZE)}},{key:"_assembleErr",value:function(e,t){var n=Error(e);return n.code=3,n.subCode=t,n}},{key:"_emitError",value:function(e,t){this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.ERROR,this._assembleErr(e,t))}},{key:"_emitTimelineEvents",value:function(e,t,n){var r;null===(r=this._parent)||void 0===r||r.emit(e,t,n)}},{key:"_bindEvents",value:function(){var e=this;(0,o.Z)((0,c.Z)(f.prototype),"_bindEvents",this).call(this);var t=function(t){var n=t.width,r=t.height,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e._canvas,s=o.width,u=o.height,c=r*s/u,d=n*u/s,f=n-c,h=r-d,v=f*i+"px",g=h*a+"px";e._canvas.style.left=v,e._canvas.style.top=g,l.kg.warn(e.TAG,"cvsWidth=".concat(s,", cvsHeight=").concat(u,", scaleCvsWidth=").concat(c,", scaleCvsHeight=").concat(d)),l.kg.warn(e.TAG,"cover position: deltaX=".concat(f,", deltaY=").concat(h,", width=").concat(n,", height=").concat(r,", pX=").concat(v,", pY=").concat(g))};this._parent.on(g.ZP.VIDEO.UPDATE_VIDEO_FILLTYPE,function(n,r){var i=r.width,a=r.height,o=e._canvas,s=o.width,u=o.height,c=!i||i/a>s/u;if(l.kg.warn(e.TAG,"UPDATE_VIDEO_FILLTYPE isGapX =",c,"type =",n,s,u,i,a),e._canvas.style.maxWidth="initial",e._canvas.style.maxHeight="initial","cover"===n){if(c){e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.height="auto",e._canvas.style.width="100%",t({width:i,height:a},0,.5);return}e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.width="auto",e._canvas.style.height="100%",t({width:i,height:a},.5,0);return}if("fill"===n){e._canvas.style.width="100%",e._canvas.style.height="100%";return}e._canvas.style.top=0,e._canvas.style.bottom=0,e._canvas.style.left=0,e._canvas.style.right=0,e._canvas.style.maxWidth="100%",e._canvas.style.maxHeight="100%",e._canvas.style.width="initial",e._canvas.style.height="initial",s<i&&u<a&&(s/i>u/a?e._canvas.style.width="100%":e._canvas.style.height="100%")}),this._parent.on(g.ZP.VIDEO.UPDATE_VIDEO_COVER_POSITION,t),this._parent.on(g.ZP.TIMELINE.SYNC_DTS,function(t){var n,r=e._frameQueue.nextFrame(),i=r&&r.info&&r.info.dts;if(e.lastTimelinePosition=e.timelinePosition,e.noAudio){var a=e._timeRange.nextFrame();t=t||i||a&&a.dts||0}if(e.audioSyncDts=t,i&&i-t>500&&e._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.LARGE_AV_GAP,{aDts:t,vDts:i,frameLength:e._frameQueue.length,currentTime:e._parent.currentTime,duration:e._parent.duration}),l.kg.log(e.TAG,"audio current buffer play finish, next buffer dts=",t,"currentTime:",e._parent.currentTime,"preciseVideoDts:",e.preciseVideoDts,"next video frame dts:",i,"frame length:",e._frameQueue.length),!e._isLive&&!(null!==(n=e._parent)&&void 0!==n&&n.seeking)){var o=e._timeRange.nextFrame();if(o){var s=(o.dts-o.baseDts)/1e3;e._parent.currentTime-s>1&&(l.kg.warn(e.TAG,"丢帧!"),e.ajustSeekTime(e._parent.currentTime))}}}),this._parent.on(g.ZP.TIMELINE.UPDATE_GL_OPTIONS,function(t){e._config.glCtxOptions=t}),this._parent.on(g.ZP.TIMELINE.UPDATE_SEGMENT_END,this._updateSegmentEnd.bind(this)),this.on(g.ZP.VIDEO.AUTO_RUN,this._startRender.bind(this)),this._parent.on(g.ZP.TIMELINE.SET_PLAYBACKRATE,function(t){e._playbackRate=t,e._startRender()})}},{key:"ajustSeekTime",value:function(){throw Error("need override by children")}},{key:"_resetDts",value:function(e,t){"audio"!==t&&this._timeRange.resetDts(e)}},{key:"_setMetadata",value:function(e,t){if("audio"!==e){l.kg.warn(this.TAG,"video set metadata"),this._meta=t;var n=t&&t.frameRate&&t.frameRate.fps;n?l.kg.log(this.TAG,"detect fps:",n):l.kg.warn(this.TAG,"no detect fps,start estimate"),this._initDecoder()}}},{key:"_initDecoder",value:function(){throw Error("need override by children")}},{key:"_whenDecoderReady",value:function(){throw Error("need override by children")}},{key:"_appendChunk",value:function(){throw Error("need override by children")}},{key:"_startDecode",value:function(){throw Error("need override by children")}},{key:"_receiveFrame",value:function(e,t){if(!!this._parent&&!!this._timeRange){var n=e.info||{};if(this._decodeEstimate.addDecodeInfo(n),this._checkCanvasLayout(e),!this._isLive&&((n.output||n.keyframe)&&(this.setSeekingStatus(!1),l.kg.warn(this.TAG,"set seeking status=",!1)),this.inSeeking)){l.kg.log(this.TAG,"drop frame"),(0,v.s)(e);return}this._isLive?this._frameQueue.append(e):this._frameQueue.appendVodFrame(e),t&&t(),!this._ready&&this.readyState>=1&&this._whenReady()}}},{key:"_checkCanvasLayout",value:function(e){!this._canvasLayoutDone&&e.width===this._canvas.width&&(e.width/e.height).toFixed(2)===(this._canvas.width/this._canvas.height).toFixed(2)&&(this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.CANVAS_LAYOUT),this._canvasLayoutDone=!0)}},{key:"_startRender",value:function(){l.kg.log(this.TAG,"start render"),this._renderWorker.startLoop(this.interval)}},{key:"_render",value:function(){throw Error("need override by children")}},{key:"_updateSegmentEnd",value:function(){throw Error("need override by children")}},{key:"_whenReady",value:function(){this._ready=!0,this.emit(g.ZP.VIDEO.VIDEO_READY),this.noAudio&&this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.PLAYING)}},{key:"_doPlay",value:function(){this._renderWorker.startLoop()}},{key:"_doPause",value:function(){this._renderWorker.stopLoop()}},{key:"_doSeek",value:function(){this._ready=!1,this._frameQueue.destroy()}},{key:"_doChaseFrame",value:function(){throw Error("need override by children")}},{key:"destroy",value:function(e){var t,n,r,i,a,o;null===(t=this._renderWorker)||void 0===t||t.destroy(e),null===(n=this._timeRange)||void 0===n||n.destroy(),null===(r=this._frameQueue)||void 0===r||r.destroy(),null===(i=this._frameRender)||void 0===i||null===(a=i.destroy)||void 0===a||a.call(i),null===(o=this._decodeEstimate)||void 0===o||o.destroy(),this._renderWorker=null,this._canvas=null,this._timeRange=null,this._frameQueue=null,this._frameRender=null,this._decodeEstimate=null,this._parent=null,this.removeAllListeners()}}]),f}(f.Z),b=n("845905");n("705574"),n("124300"),n("248385"),n("832674"),n("905442"),n("446336"),n("808483"),n("840938"),n("118438"),n("325598"),n("92999"),n("611067"),n("273723"),n("724016"),n("803903"),n("214604"),n("901250"),n("755006"),n("437048"),n("488336"),n("825666"),n("177162"),n("286633"),n("943281"),n("810658"),n("82726"),n("224727"),n("663030");var k=n("636692"),C=n("126980"),w=n("30222"),T=n("548872"),x=n("856894"),E=(0,p.tT)().maxDecodeOnceWasm,D=function(e){(0,s.Z)(f,e);var t,n,o=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,r=(0,c.Z)(t);return e=n?Reflect.construct(r,arguments,(0,c.Z)(this).constructor):r.apply(this,arguments),(0,u.Z)(this,e)});function f(){var e;(0,r.Z)(this,f);for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=o.call.apply(o,[this].concat(n)),(0,d.Z)((0,a.Z)(e),"TAG","WasmController"),(0,d.Z)((0,a.Z)(e),"_avccpushed",!1),(0,d.Z)((0,a.Z)(e),"_maxDecodeOnce",E),(0,d.Z)((0,a.Z)(e),"_continueDecodeThreshold",E/2),(0,d.Z)((0,a.Z)(e),"_wasmInitCost",0),(0,d.Z)((0,a.Z)(e),"_threadSupported",(0,p.Bo)()&&(0,p.tT)().canUseThreadMode),(0,d.Z)((0,a.Z)(e),"_simdSuppported",(0,p.yJ)()),(0,d.Z)((0,a.Z)(e),"_decoderMode","undefined"!=typeof window&&window.WebAssembly?3:4),e}return(0,i.Z)(f,[{key:"wasmInitCost",get:function(){var e;return null===(e=this._decoderWorker)||void 0===e?void 0:e._wasmInitCost}},{key:"isHevc",get:function(){var e;return null===(e=this._parent)||void 0===e?void 0:e.isHevc}},{key:"_selectDecodeWorker",value:function(){this.analyse.addWasmInit();var e,t=(0,p.P_)(),n=t.H264_DECODER_URL,r=t.H265_DECODER_URL,i=t.H265_THREAD_DECODER_URL,a=t.H265_SIMD_DECODER_URL,o=t.ASM_H264_DECODER_URL,s=t.ASM_H265_DECODER_URL;if(l.kg.log(this.TAG,"start init wasm worker:",performance.now(),"hevc:",this.isHevc,"decoderMode:",this._decoderMode),this.isHevc){if(!(e=1===this._decoderMode?i:2===this._decoderMode?a:3===this._decoderMode?r:s)){this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode));return}return{decoder:1===this._decoderMode?new w.Z:new C.Z,url:e}}if(!(e=4===this._decoderMode?o:n)){this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode));return}return{decoder:new T.Z,url:e}}},{key:"_initWorker",value:function(){this.isHevc&&(this._threadSupported&&(this._decoderMode=1),this._simdSuppported&&(this._decoderMode=2)),this._initDecodeWorkerInternal()}},{key:"_initDecodeWorkerInternal",value:function(){var e=x.Z.getCachedDecoder(this.isHevc);if(e){l.kg.warn(this.TAG,"select decoder from cache"),this.analyse.addWasmInit(),this._avccpushed=!1,this._bindWorkerEvent(e),this._decoderWorker=e,e.ready&&(this._decoderReady=!0,this._initDecoderWithConfiguration(e,this.meta),this._workerMessageCallback({type:"DECODER_READY",data:e}),l.kg.log(this.TAG,"decoder ready!"));return}var t=this._selectDecodeWorker()||{},n=t.decoder,r=t.url;n&&(this._avccpushed=!1,this._bindWorkerEvent(n),n.isHevc=this.isHevc,n.postMessage({msg:"init",meta:this.meta,batchDecodeCount:E,url:r}),this._decoderWorker=n)}},{key:"_bindWorkerEvent",value:function(e){var t=this,n=function(n,r){l.kg.log(t.TAG,"worker failed: ",n,r),t._terminateWorker(e),t._decoderWorker=null,!1===(0,p.tT)().wasmFallbackToAsm||4===t._decoderMode?t._workerErrorCallback(n):(t._decoderMode=1===t._decoderMode||2===t._decoderMode?3:4,t._initDecodeWorkerInternal())};e._onMessage=function(r){var i,a;switch(r.data.msg){case"DECODER_READY":if(l.kg.log(t.TAG,"wasm worker ready!","cost:",r.data.cost),t._decoderReady=!0,e._wasmInitCost=parseInt(r.data.cost),!t.meta)return;!t._avccpushed&&t._initDecoderWithConfiguration(e,t.meta),t.emit(g.ZP.VIDEO.VIDEO_DECODER_INIT,e),t._workerMessageCallback({type:"DECODER_READY",data:e});break;case"DECODED":if(t._inDecoding=!0,(null===(i=r.data)||void 0===i?void 0:null===(a=i.info)||void 0===a?void 0:a.id)!==t._id)return;t._workerMessageCallback({type:"RECEIVE_FRAME",data:r.data});break;case"BATCH_FINISH_FLAG":if(t._inDecoding=!1,!t._workerMessageCallback)return;t._workerMessageCallback({type:"BATCH_FINISH"});break;case"INIT_FAILED":n(r.data.log,1)}},e._onError=function(e){n(e.message,2)},e.addEventListener("message",e._onMessage),e.addEventListener("error",e._onError)}},{key:"_initDecoderWithConfiguration",value:function(e,t){l.kg.log(this.TAG,"init decoder with configuration"),this._avccpushed=!0,e.postMessage({msg:"updatemeta",meta:t});var n=[t.rawVps||t.vps[0],t.rawSps||t.sps[0],t.rawPps||t.pps[0]].filter(Boolean),r=new Uint8Array(n.reduce(function(e,t){return e+(t.byteLength+4)},0)),i=0;n.forEach(function(e){r.set([0,0,0,1],i),i+=4,r.set(e,i),i+=e.byteLength}),e.postMessage({msg:"initDecoder",data:r})}},{key:"destroy",value:function(){if(this._decoderWorker){if((0,p.tT)().reuseWasmDecoder){this._offWorkerBind(this._decoderWorker),x.Z.cacheDecoder(this._decoderWorker),this._decoderWorker=null;return}this._terminateWorker(this._decoderWorker),this._decoderWorker=null}}},{key:"_offWorkerBind",value:function(e){e.removeEventListener("message",e._onMessage),e.removeEventListener("error",e._onError),e.postMessage({msg:"flush"}),e._onMessage=null,e._onError=null,l.kg.log(this.TAG,"flush decoder and unbind worker event")}},{key:"_terminateWorker",value:function(e){this._offWorkerBind(e),e.postMessage({msg:"destroy"}),e.terminate(),l.kg.log(this.TAG,"destroy decoder worker")}}]),f}(k.Z),S=n("395239"),R=function(e){(0,s.Z)(h,e);var t,n,f=(t=h,n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,r=(0,c.Z)(t);return e=n?Reflect.construct(r,arguments,(0,c.Z)(this).constructor):r.apply(this,arguments),(0,u.Z)(this,e)});function h(){var e;(0,r.Z)(this,h);for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=f.call.apply(f,[this].concat(n)),(0,d.Z)((0,a.Z)(e),"TAG","VideoRenderWithDecoder"),(0,d.Z)((0,a.Z)(e),"_hideRenderFlag",0),(0,d.Z)((0,a.Z)(e),"_recentMeta",null),(0,d.Z)((0,a.Z)(e),"_inChaseFrame",!1),(0,d.Z)((0,a.Z)(e),"_decoderErrorCallback",function(t){e._emitError(t,1)}),(0,d.Z)((0,a.Z)(e),"_decoderMessageCallback",function(t){var n,r,i,o=t.type,s=t.data;switch(o){case"DECODER_READY":e.analyse.addWasmReady(),e._startDecode();break;case"RECEIVE_FRAME":if(e._inChaseFrame&&!(null!==(n=e._decodeController)&&void 0!==n&&n.webcodec))return;e._receiveFrame(s);break;case"BATCH_FINISH":null===(r=(0,a.Z)(e))||void 0===r||r._decodeEstimate.resetDecodeDot(),e._inChaseFrame&&(e._inChaseFrame=!1,e._frameQueue.empty()),!e._ready&&!e.inSeeking&&null!==(i=e._decodeController)&&void 0!==i&&i.decoderReady&&e._startDecode()}}),e}return(0,i.Z)(h,[{key:"wasmInitCost",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.wasmInitCost}},{key:"hevcThread",get:function(){return 1===this.decodeMode}},{key:"lowlatency",get:function(){return this._parent.lowlatency}},{key:"nextFrameTime",get:function(){var e=this._frameQueue.nextFrame();return(e&&e.info&&e.info.dts||0)/1e3}},{key:"offscreenUsed",get:function(){return(0,p.tT)().offscreenCanvas}},{key:"ajustSeekTime",value:function(e,t){var n;l.kg.warn(this.TAG,"ajust seek time[preciseSeek:".concat(!!t,"]: "),e),this._frameQueue.empty(),null===(n=this._decodeController)||void 0===n||n.flushDecoder(),this._switchVideoBuffer(e,t)}},{key:"canSeek",value:function(){return!0}},{key:"_appendChunk",value:function(e){if(!this.noVideo&&!!this._timeRange){if(this._meta){if(this._recentMeta.width!==e.width||this._recentMeta.height!==e.height){l.kg.warn(this.TAG,"metadata changed! width: ".concat(this._recentMeta.width," -> ").concat(e.width,", height: ").concat(this._recentMeta.height," -> ").concat(e.height));var t=e.samples[0];t&&(this._recentMeta=t.meta=Object.assign({},e,{samples:null}))}}else{this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.LOADEDMETADATA),this._recentMeta=this._meta=Object.assign({},e,{samples:null}),l.kg.warn(this.TAG,"video set metadata",this._meta,"configuration:",this.configuration);var n,r,i=e.fpsNum/e.fpsDen;i?l.kg.log(this.TAG,"detect fps:",i):l.kg.warn(this.TAG,"no detect fps,start estimate"),this._selectDecoder(),this._initDecoder(),this._initFrameRender()}this._timeRange.append(e.samples,this._isLive&&this.noAudio,!this.videoDecode),e.samples=[],!this.inSeeking&&(!this.isLive&&!this._timeRange.frameLength&&this._switchVideoBuffer(this._parent.currentTime),!this._ready&&null!==(n=this._decodeController)&&void 0!==n&&n.decoderReady&&(this.noAudio||!(null!==(r=this._decodeController)&&void 0!==r&&r.inDecoding))&&this._startDecode(),this.noAudio&&this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.DURATION_CHANGE))}}},{key:"_selectDecoder",value:function(){if(!this.isHevc&&b.Z.isSupported()){this._decodeController=new b.Z(this),this._decodeEstimate.webcodec=!0;return}this._decodeController=new D(this)}},{key:"_initDecoder",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.init(this._decoderMessageCallback,this._decoderErrorCallback)}},{key:"_initFrameRender",value:function(){try{if(this.offscreenUsed){this._renderWorker.initRenderContext({meta:this._meta,type:this._decodeController.webcodec?"2d":""}),this._frameRender=function(){};return}var e=Object.assign(this._config,{meta:this._meta,canvas:this._canvas,type:this._decodeController.webcodec?"2d":""});this._frameRender=new S.S(e,this),l.kg.log(this.TAG,"create frameRender with config",e)}catch(e){this._emitError(e&&e.message,2)}}},{key:"_startDecode",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.doDecode()}},{key:"_switchVideoBuffer",value:function(e,t){var n,r=this._timeRange.switchBuffer(e);if(r){if(this.noAudio&&this._parent.emit(g.ZP.TIMELINE.SYNC_DTS,this.getDtsOfTime(r.start)),t){null===(n=this._decodeController)||void 0===n||n.preciseSeek(e);return}this._startDecode(t)}}},{key:"_checkToDecode",value:function(){var e;!this.inSeeking&&(null===(e=this._decodeController)||void 0===e||e.checkToDecode(this._frameQueue.length))}},{key:"_render",value:function(e){if(!this.noVideo){var t,n,r,i=this._frameQueue&&this._frameQueue.nextFrame();if(!i){if(l.kg.log(this.TAG,"lack frame, ","inDecoding:",null===(n=this._decodeController)||void 0===n?void 0:n.inDecoding),this._checkToDecode(),this.noAudio){if(!this.isLive&&.5>Math.abs(this.currentTime-this.duration)){this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.TIMEUPDATE),this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.ENDED),null===(r=this._timeRange)||void 0===r||r.clean();return}!this._timeRange.frameLength&&(this._ready=!1,this.emit(g.ZP.VIDEO.VIDEO_WAITING))}return}var a=i.info;if(!a){this._frameQueue.shift();return}this._renderDts=a.dts;var o=a.dts-this.preciseVideoDts;if(!!e||!(o>0)||!(o<6e4)){this._frameQueue.shift(this.preciseVideoDts),Math.abs(this._lastTimeupdate-a.dts)>250&&(this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.TIMEUPDATE,{pts:a.originPts/90}),this._lastTimeupdate=a.dts),l.kg.long&&l.kg.log(this.TAG,"render delay:".concat(o," , timelinePosition:").concat(this.preciseVideoDts," , dts:").concat(a.dts," , cost:").concat(a.cost," , gopID:").concat(a.gopId," , rest:").concat(this._frameQueue.length,", buffer frame:").concat(this._timeRange.frameLength));var s=performance.now();this._hideRenderFlag++,"visible"===document.visibilityState?this.offscreenUsed?this._renderWorker.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize):this._frameRender.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize):this._hideRenderFlag%15&&(this.offscreenUsed?this._renderWorker.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize):this._frameRender.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize)),null!==(t=this._decodeController)&&void 0!==t&&t.webcodec&&i.buffer.close(),this._renderCost=performance.now()-s,this._checkToDecode()}}}},{key:"_updateSegmentEnd",value:function(e){var t;null===(t=this._timeRange)||void 0===t||t.updateSegmentEnd(e)}},{key:"_doChaseFrame",value:function(e){var t=e.frame;this._inChaseFrame=!0,this._timeRange.deletePassed(t.dts),this._frameQueue.empty(),this.noAudio&&this._parent.emit(g.ZP.TIMELINE.SYNC_DTS,t.dts)}},{key:"_destroy",value:function(e){var t;l.kg.log(this.TAG,"destroy video render"),(0,o.Z)((0,c.Z)(h.prototype),"destroy",this).call(this,e),null===(t=this._decodeController)||void 0===t||t.destroy(),this._decodeController=null}}]),h}(y)},656775:function(e,t,n){n.d(t,{i:function(){return d}});var r=n(182432),i=n(210359),a=n(958281),o=n(275764),s=n(479248),u=n(918532),c=["retry","retryDelay","onRetryError","transformError"],d=function(){var e;function t(e,n){(0,r.PA)(this,t),this.promise=(0,s.Q)(),this.alive=!!n.onProgress,n.logger||(n.logger=new u.Y("Loader")),this._loaderType=e,this._loader=e===o.t.FETCH&&"undefined"!=typeof fetch?new i.j:new a.c,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}return(0,r.qH)(t,[{key:"exec",value:function(){var e,t=this,n=this._config,i=n.retry,a=n.retryDelay,o=n.onRetryError,s=n.transformError,u=(0,r.Kd)(n,c);var d=(e=(0,r.x)((0,r.l5)().mark(function e(){var n,c,l;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._loader.load(u);case 3:n=e.sent,t.promise.resolve(n),e.next=27;break;case 7:if(e.prev=7,e.t0=e.catch(0),t._loader.running=!1,t._logger.debug("[task request catch err]",e.t0),!t._canceled){e.next=13;break}return e.abrupt("return");case 13:if(e.t0.loaderType=t._loaderType,e.t0.retryCount=t._retryCount,c=e.t0,s&&(c=s(c)||c),o&&t._retryCount>0&&o(c,t._retryCount,{index:u.index,vid:u.vid,range:u.range,priOptions:u.priOptions}),t._retryCount++,l=!0,t._retryCheckFunc&&(l=t._retryCheckFunc(e.t0)),!(l&&t._retryCount<=i)){e.next=26;break}return clearTimeout(t._retryTimer),t._logger.debug("[task request setTimeout],retry",t._retryCount,",retry range,",u.range),t._retryTimer=setTimeout(d,a),e.abrupt("return");case 26:t.promise.reject(c);case 27:case"end":return e.stop()}},e,null,[[0,7]])})),function(){return e.apply(this,arguments)});return d(),this.promise}},{key:"cancel",value:(e=(0,r.x)((0,r.l5)().mark(function e(){return(0,r.l5)().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}}]),t}()},521488:function(e,t,n){n.d(t,{wN:function(){return o}});var r=n(70427),i=["algorithm","type"];function a(e,t,n){return"number"!=typeof e||Number.isNaN(e)?t:Math.min(n,Math.max(t,e))}function o(e){if(!!e){if(e&&"object"===(0,r.Ac)(e)){e.algorithm;var t=e.type,n=(0,r.Kd)(e,i);return 1===t?new s(n):new u(n)}}}var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.PA)(this,e);var n=t.alpha,i=t.minTimeout,a=t.maxTimeout,o=t.initialTimeout;this._alpha=void 0===n?.8:n,this._min=void 0===i?0:i,this._max=void 0===a?1/0:a,this._initial=o,this._ewma=void 0}return(0,r.qH)(e,[{key:"getTimeout",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return a(Math.round(null!==(e=null!==(t=this._ewma)&&void 0!==t?t:this._initial)&&void 0!==e?e:n),this._min,this._max)}},{key:"update",value:function(e){if("number"!=typeof e||Number.isNaN(e)||e<0)return this.getTimeout();var t=this._ewma||3e3;return this._ewma=this._alpha*e+(1-this._alpha)*t,this.getTimeout()}},{key:"reset",value:function(){this._ewma=void 0}}]),e}(),u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.PA)(this,e);var n=t.alpha,i=t.beta,a=t.k,o=t.minTimeout,s=t.maxTimeout,u=t.initialTimeout;this._alpha=void 0===n?.125:n,this._beta=void 0===i?.25:i,this._k=void 0===a?4:a,this._min=void 0===o?0:o,this._max=void 0===s?1/0:s,this._initial=u||1e3,this._srtt=void 0,this._rttvar=void 0}return(0,r.qH)(e,[{key:"getTimeout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return a(Math.round(void 0!==this._srtt&&void 0!==this._rttvar?this._srtt+this._k*this._rttvar:null!=e?e:this._initial),this._min,this._max)}},{key:"update",value:function(e){if("number"!=typeof e||Number.isNaN(e)||e<0)return this.getTimeout();if(void 0===this._srtt||void 0===this._rttvar)return this._srtt=e,this._rttvar=e/2,this.getTimeout();var t=this._srtt;return this._srtt=t+this._alpha*(e-t),this._rttvar=this._rttvar+this._beta*(Math.abs(e-t)-this._rttvar),this.getTimeout()}},{key:"reset",value:function(){this._srtt=void 0,this._rttvar=void 0}}]),e}()},261237:function(e,t,n){n.d(t,{j:function(){return d}});var r=n(70427),i=n(430517),a=n(408746),o=n(265614),s=n(982143),u=n(942155),c=n.n(u),d=function(e){(0,r.XW)(u,e);var t,n=(0,r.WY)(u);function u(){var e;return(0,r.PA)(this,u),e=n.call(this),(0,r._x)((0,r.Lc)(e),"_abortController",null),(0,r._x)((0,r.Lc)(e),"_timeoutTimer",null),(0,r._x)((0,r.Lc)(e),"_reader",null),(0,r._x)((0,r.Lc)(e),"_response",null),(0,r._x)((0,r.Lc)(e),"_aborted",!1),(0,r._x)((0,r.Lc)(e),"_index",-1),(0,r._x)((0,r.Lc)(e),"_range",null),(0,r._x)((0,r.Lc)(e),"_receivedLength",0),(0,r._x)((0,r.Lc)(e),"_running",!1),(0,r._x)((0,r.Lc)(e),"_logger",null),(0,r._x)((0,r.Lc)(e),"_vid",""),(0,r._x)((0,r.Lc)(e),"_firtstByte",0),(0,r._x)((0,r.Lc)(e),"_onProcessMinLen",0),(0,r._x)((0,r.Lc)(e),"_onCancel",null),(0,r._x)((0,r.Lc)(e),"_priOptions",null),e}return(0,r.qH)(u,[{key:"load",value:function(e){var t,n=this,u=e.url,c=e.vid,d=e.timeout,l=e.dynamicTimeoutIns,f=e.responseType,h=e.onProgress,v=e.index,g=e.onTimeout,p=e.onCancel,m=e.range,_=e.transformResponse,y=e.request,b=e.params,k=e.logger,C=e.method,w=e.headers,T=e.body,x=e.mode,E=e.credentials,D=e.cache,S=e.redirect,R=e.referrer,A=e.referrerPolicy,I=e.onProcessMinLen,L=e.priOptions,B=e.streamRes,P=e.firstMaxChunkSize;this._logger=k,this._aborted=!1,this._onProcessMinLen=I,this._onCancel=p,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=v,this._range=m||[0,0],this._vid=c||u,this._priOptions=L||{},this._firstMaxChunkSize=P;var N={method:C,headers:w,body:T,mode:x,credentials:E,cache:D,redirect:S,referrer:R,referrerPolicy:A,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},O=!1;clearTimeout(this._timeoutTimer),u=(0,a.G7)(u,b);var M=(0,a.Gu)(m);M&&(w=y?y.headers:N.headers=N.headers||(Headers?new Headers:{}),Headers&&w instanceof Headers?w.append("Range",M):w.Range=M);var Z=l&&"function"==typeof l.getTimeout?l.getTimeout(d):d;Z&&(this._timeoutTimer=setTimeout(function(){if(O=!0,l&&"function"==typeof l.update&&(n._logger.debug("[dytimeout], fetch timeout update rtt,",5*Z),l.update(5*Z)),n.cancel(),g){var e=new i.C(u,N,null,"timeout");e.isTimeout=!0,g(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}},Z));var W=Date.now();return this._logger.debug("[fetch load start], index,",v,",range,",m,",[dytimeout]",Z),new Promise(function(e,t){var c;(B?new Promise(function(e){e(B)}):fetch(y||u,y?void 0:N)).then((c=(0,r.x)((0,r.l5)().mark(function c(d){var g,p,y,b;return(0,r.l5)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=d,!(n._aborted||!n._running)){r.next=4;break}return r.abrupt("return");case 4:if(_&&(d=_(d,u)||d),d.ok){r.next=7;break}throw new i.C(u,N,d,"bad network response");case 7:if(g=Date.now(),n._priOptions.rtt=g-W,l&&"function"==typeof l.update&&(n._logger.debug("[dytimeout] fetch update rtt,",n._priOptions.rtt),l.update(n._priOptions.rtt)),f!==o.U.TEXT){r.next=17;break}return r.next=13,d.text();case 13:case 20:p=r.sent,n._running=!1,r.next=39;break;case 17:if(f!==o.U.JSON){r.next=24;break}return r.next=20,d.json();case 24:if(!h){r.next=31;break}return n.resolve=e,n.reject=t,n._loadChunk(d,h,W,g),r.abrupt("return");case 31:return r.next=33,d.arrayBuffer();case 33:p=new Uint8Array(p=r.sent),n._running=!1,y=Date.now()-W,b=(0,a.pl)(p.byteLength,y),n.emit(s.K.REAL_TIME_SPEED,{speed:b,len:p.byteLength,time:y,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 39:n._logger.debug("[fetch load end], index,",v,",range,",m),e((0,a.rO)(p,!0,d,d.headers.get("Content-Length"),d.headers.get("age"),W,g,v,m,n._vid,n._priOptions));case 41:case"end":return r.stop()}},c)})),function(e){return c.apply(this,arguments)})).catch(function(e){var r;clearTimeout(n._timeoutTimer),n._running=!1,(!n._aborted||O)&&((e=e instanceof i.C?e:new i.C(u,N,null,null===(r=e)||void 0===r?void 0:r.message)).startTime=W,e.endTime=Date.now(),e.isTimeout=O,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))})})}},{key:"cancel",value:(t=(0,r.x)((0,r.l5)().mark(function e(){return(0,r.l5)().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 t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,o){var u,c,d,l,f=this;if(!e.body||!e.body.getReader){this._running=!1;var h=new i.C(e.url,"",e,"onProgress of bad response.body.getReader");h.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(h);return}this._onProcessMinLen>0&&(this._cache=new Uint8Array(2097152),this._writeIdx=0);var v=this._reader=e.body.getReader();var g=(u=(0,r.x)((0,r.l5)().mark(function i(){var u,h,p,m,_,y,b,k,C,w;return(0,r.l5)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return d=Date.now(),r.prev=1,r.next=4,v.read();case 4:c=r.sent,l=Date.now(),r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(1),l=Date.now(),!f._aborted&&(f._running=!1,r.t0.options={index:f._index,range:f._range,vid:f._vid,priOptions:f._priOptions},f.reject(r.t0)),r.abrupt("return");case 13:if(p=(h=(null===(u=f._range)||void 0===u?void 0:u.length)>0?f._range[0]:0)+f._receivedLength,!f._aborted){r.next=19;break}return f._running=!1,t(void 0,!1,{range:[p,p],vid:f._vid,index:f._index,startTime:d,endTime:l,st:n,firstByteTime:o,priOptions:f._priOptions},e),r.abrupt("return");case 19:m=c.value?c.value.byteLength:0,f._receivedLength+=m,f._logger.debug("【fetchLoader,onProgress call】,task,",f._range,", start,",p,", end,",h+f._receivedLength,", done,",c.done),f._onProcessMinLen>0?f._writeIdx+m>=f._onProcessMinLen||c.done?((_=new Uint8Array(f._writeIdx+m)).set(f._cache.slice(0,f._writeIdx),0),m>0&&_.set(c.value,f._writeIdx),f._writeIdx=0,f._logger.debug("【fetchLoader,onProgress enough】,done,",c.done,",len,",_.byteLength,", writeIdx,",f._writeIdx)):m>0&&f._writeIdx+m<2097152?(f._cache.set(c.value,f._writeIdx),f._writeIdx+=m,f._logger.debug("【fetchLoader,onProgress cache】,len,",m,", writeIdx,",f._writeIdx)):m>0&&(y=new Uint8Array(f._writeIdx+m+2048),f._logger.debug("【fetchLoader,onProgress extra start】,size,",f._writeIdx+m+2048,", datalen,",m,", writeIdx,",f._writeIdx),y.set(f._cache.slice(0,f._writeIdx),0),m>0&&y.set(c.value,f._writeIdx),f._writeIdx+=m,delete f._cache,f._cache=y,f._logger.debug("【fetchLoader,onProgress extra end】,len,",m,", writeIdx,",f._writeIdx)):_=c.value,(_&&_.byteLength>0||c.done)&&(f._firstMaxChunkSize&&(f._firtstByte?f._cacheData&&((k=new Uint8Array(f._cacheData.byteLength+_.byteLength)).set(f._cacheData,0),k.set(_,f._cacheData.byteLength),_=k,f._cacheData=null):(f._firtstByte++,b=_.slice(0,f._firstMaxChunkSize),f._cacheData=_.slice(f._firstMaxChunkSize),_=b)),t(_,c.done,{range:[f._range[0]+f._receivedLength-(_?_.byteLength:0),f._range[0]+f._receivedLength],vid:f._vid,index:f._index,startTime:d,endTime:l,st:n,firstByteTime:o,priOptions:f._priOptions},e)),c.done?(C=Date.now()-n,w=(0,a.pl)(f._receivedLength,C),f.emit(s.K.REAL_TIME_SPEED,{speed:w,len:f._receivedLength,time:C,vid:f._vid,index:f._index,range:f._range,priOptions:f._priOptions}),f._running=!1,f._logger.debug("[fetchLoader onProgress end],task,",f._range,",done,",c.done),f.resolve((0,a.rO)(c,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,o,f._index,f._range,f._vid,f._priOptions))):f._firstMaxChunkSize?setTimeout(function(){g()},0):g();case 25:case"end":return r.stop()}},i,null,[[1,8]])})),function(){return u.apply(this,arguments)});g()}},{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}}]),u}(c())},924515:function(e,t,n){function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=new Uint8Array((t=t.filter(Boolean)).reduce(function(e,t){return e+t.byteLength},0)),i=0;return t.forEach(function(e){r.set(e,i),i+=e.byteLength}),r}n.d(t,{gJ:function(){return r}}),n(705574),n(248385),n(124300),n(832674),n(905442),n(446336),n(808483),n(840938),n(118438),n(325598),n(92999),n(611067),n(273723),n(724016),n(803903),n(214604),n(901250),n(755006),n(437048),n(488336),n(825666),n(177162),n(286633),n(943281),n(810658),n(82726),n(224727),n(663030),n(414931)},317024:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(324219),i=n(291804),a=n(646278),o=n(458714),s=n(755135),u=n(578548),c=n(532096),d={decryptWordArray:function(e,t,n){var c=r.pU.parse(t),l=r.pU.parse((0,u.mw)(n)),f=r.Ic.create(new Uint8Array(e)),h=a.e.decrypt(i.Qt.create({ciphertext:f}),c,{iv:l,mode:o.M,padding:s.g});return d.wordArrayToUint8Array(h)},wordArrayToUint8Array:function(e){for(var t=e.sigBytes,n=e.words,r=new Uint8Array(t),i=0,a=0;i!==t;){;var o=n[a++];if(r[i++]=(4278190080&o)>>>24,i===t)break;if(r[i++]=(16711680&o)>>>16,i===t)break;if(r[i++]=(65280&o)>>>8,i===t)break;r[i++]=255&o}return r},decoderAESCTRData:function(e,t,n){if(e.videoSenc){var r=e.kidValue,i=e.videoSenc;e.samples.forEach(function(t,a){var o=i[a],s=t.data,u=[],l=[],f=o.InitializationVector;if(o.subsamples&&o.subsamples.length)o.subsamples.forEach(function(e){var t=e.BytesOfClearData+e.BytesOfProtectedData,n=s.slice(0,t);u.push(n.slice(0,e.BytesOfClearData)),l.push(n.slice(e.BytesOfClearData)),s=s.slice(t)});else{var h=t.size;u.push(s.slice(0,0)),l.push(s.slice(0,h)),s=s.slice(h)}var v=new c.Z;v.write.apply(v,l);var g=n?n(v.buffer,r,f):d.decryptWordArray(v.buffer,r,f),p=new c.Z;u.forEach(function(e,t){var n=l[t].length,r=g.slice(0,n);p.write(e),p.write(r),g=g.slice(n)}),e.samples[a].data=p.buffer})}if(t.audioSenc){var a=t.kidValue,o=t.audioSenc;t.samples.forEach(function(e,r){var i=o[r],s=n?n(e.data,a,i.InitializationVector):d.decryptWordArray(e.data,a,i.InitializationVector);t.samples[r].data=s})}}}},500395:function(e,t,n){n.d(t,{I:function(){return l}});var r=n(697946),i=n(269497),a=n(578548),o=n(662439),s=n(585104),u=n(461449),c=n(745740);function d(e){return(e||[]).filter(Boolean)}var l=function(){function e(){(0,r.PA)(this,e)}return(0,r.qH)(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="",u=0;t.length>7;){if(o=(0,a.Bh)(t),s=String.fromCharCode.apply(null,t.subarray(4,8)),u=8,1===o?(o=(0,a.h9)(t,8),u+=8):!o&&(o=t.length),!n[0]||s===n[0]){var c=t.subarray(0,o);if(!(n.length<2))return e.findBox(c.subarray(u),n.slice(1),r+u);i.push({start:r,size:o,headerSize:u,type:s,data:c})}r+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return g(e,!0,function(e,t){e.trackId=(0,a.Bh)(t);var n=4,r=1&e.flags,i=2&e.flags,o=8&e.flags,s=16&e.flags,u=32&e.flags;r&&(n+=4,e.baseDataOffset=(0,a.Bh)(t,n),n+=4),i&&(e.sampleDescriptionIndex=(0,a.Bh)(t,n),n+=4),o&&(e.defaultSampleDuration=(0,a.Bh)(t,n),n+=4),s&&(e.defaultSampleSize=(0,a.Bh)(t,n),n+=4),u&&(e.defaultSampleFlags=(0,a.Bh)(t,n))})}},{key:"sidx",value:function(e){return g(e,!0,function(e,t){var n=0;e.reference_ID=(0,a.Bh)(t,n),n+=4,e.timescale=(0,a.Bh)(t,n),n+=4,0===e.version?(e.earliest_presentation_time=(0,a.Bh)(t,n),n+=4,e.first_offset=(0,a.Bh)(t,n),n+=4):(e.earliest_presentation_time=(0,a.h9)(t,n),n+=8,e.first_offset=(0,a.h9)(t,n),n+=8),n+=2,e.references=[];var r=(0,a.i4)(t,n);n+=2;for(var i=0;i<r;i++){var o={};e.references.push(o);var s=(0,a.Bh)(t,n);n+=4,o.reference_type=s>>31&1,o.referenced_size=2147483647&s,o.subsegment_duration=(0,a.Bh)(t,n),n+=4,s=(0,a.Bh)(t,n),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 g(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 g(e,!0,function(e,t){var n=0;1===e.version?(e.timescale=(0,a.Bh)(t,16),e.duration=(0,a.h9)(t,20),n+=28):(e.timescale=(0,a.Bh)(t,8),e.duration=(0,a.Bh)(t,12),n+=16),e.nextTrackId=(0,a.Bh)(t,n+76)})}},{key:"trak",value:function(t){return g(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 g(e,!0,function(e,t){var n=s.J.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,u=0;u<3;u++)i.push((0,a.Wp)(n.readInt(2),n.readInt(2))),i.push((0,a.Wp)(n.readInt(2),n.readInt(2))),o=n.readInt(4),i.push((0,a.Wp)(o>>30,1073741823&o));e.rotation=(0,a.Dc)(i),e.width=n.read(4),e.height=n.read(4)})}},{key:"mdia",value:function(t){return g(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 g(t,!1,function(t,n,r){t.elst=e.elst(e.findBox(n,["elst"],r)[0])})}},{key:"elst",value:function(e){return g(e,!0,function(e,t,n){e.entries=[],e.entriesData=t;var r=0,i=(0,a.Bh)(t,r);r+=4;for(var o=0;o<i;o++){var s={};e.entries.push(s),1===e.version?(s.segment_duration=(0,a.h9)(t,r),r+=8,s.media_time=(0,a._b)(t,r),r+=8):(s.segment_duration=(0,a.Bh)(t,r),r+=4,s.media_time=(0,a.e2)(t,r),r+=4),s.media_rate_integer=(0,a.i4)(t,r),r+=2,s.media_rate_fraction=(0,a.i4)(t,n),r+=2}})}},{key:"mdhd",value:function(e){return g(e,!0,function(e,t){var n=0;1===e.version?(e.timescale=(0,a.Bh)(t,16),e.duration=(0,a.h9)(t,20),n+=28):(e.timescale=(0,a.Bh)(t,8),e.duration=(0,a.Bh)(t,12),n+=16);var r=(0,a.i4)(t,n);e.language=String.fromCharCode((r>>10&31)+96,(r>>5&31)+96,(31&r)+96)})}},{key:"hdlr",value:function(e){return g(e,!0,function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))})}},{key:"minf",value:function(t){return g(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 g(e,!0,function(e,t){e.graphicsmode=(0,a.i4)(t),e.opcolor=[(0,a.i4)(t,2),(0,a.i4)(t,4),(0,a.i4)(t,6)]})}},{key:"smhd",value:function(e){return g(e,!0,function(e,t){e.balance=(0,a.i4)(t)})}},{key:"stbl",value:function(t){return g(t,!1,function(t,n,r){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 i,a,o,s=null===(i=t.stsd.entries[0])||void 0===i?void 0:null===(a=i.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(n,["stss"],r)[0]),t.senc=e.senc(e.findBox(n,["senc"],r)[0],s)})}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return g(e,!0,function(e,n){var r=0,i=(0,a.Bh)(n,r);r+=4,e.samples=[];for(var o=0;o<i;o++){var s={};s.InitializationVector=[];for(var u=0;u<t;u++)s.InitializationVector[u]=n[r+u];if(r+=t,2&e.flags){s.subsamples=[];var c=(0,a.i4)(n,r);r+=2;for(var d=0;d<c;d++){var l={};l.BytesOfClearData=(0,a.i4)(n,r),r+=2,l.BytesOfProtectedData=(0,a.Bh)(n,r),r+=4,s.subsamples.push(l)}}e.samples.push(s)}})}},{key:"pssh",value:function(e){return g(e,!0,function(e,t){for(var n=[],r=[],i=0,o=0;o<16;o++)r.push(m(t[i+o]));if(i+=16,e.version>0){var s=(0,a.Bh)(t,i);i+=4;for(var u=0;u<(""+s).length;u++)for(var c=0;c<16;c++){var d=t[i];i+=1,n.push(m(d))}}var l=(0,a.Bh)(t,i);e.data_size=l,i+=4,e.kid=n,e.system_id=r,e.buffer=t})}},{key:"vvc1",value:function(t){return e.videoSampleEntry(t)}},{key:"vvcC",value:function(t,n){return e.videoConfigBox(t,n||"vvc1")}},{key:"videoConfigBox",value:function(t,n){if(!!t){var r=(0,u.YW)({configBox:t.type});if(null!=r&&r.parseConfigBox)return g(t,!1,function(i,a){var o=r.parseConfigBox({data:a,box:t,sampleEntryType:n,parser:e});for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])})}}},{key:"videoSampleEntry",value:function(t){var n=(0,u.YW)({sampleEntry:null==t?void 0:t.type});if(n)return g(t,!1,function(t,r,i){var a=h(t,r),o=r.subarray(a);i+=a,d(n.configBoxes).some(function(r){var a=e.findBox(o,[r],i)[0],s=e.videoConfigBox(a,t.type);return!!s&&(t[n.trackConfigKey||r]=s,!0)}),t.pasp=e.pasp(e.findBox(o,["pasp"],i)[0])})}},{key:"stsd",value:function(t){return g(t,!0,function(t,n,r){t.entryCount=(0,a.Bh)(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"vvc1":case"vvi1":return e.vvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return g(t,!1,function(t,n,r){t.channelCount=(0,a.i4)(n,16),t.samplesize=(0,a.i4)(n,18),t.sampleRate=(0,a.Bh)(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 g(t,!1,function(t,n,r){t.width=(0,a.i4)(n,24),t.height=(0,a.i4)(n,26),t.horizresolution=(0,a.Bh)(n,28),t.vertresolution=(0,a.Bh)(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]);var i,o,s=null===(i=t.sinf)||void 0===i?void 0:null===(o=i.frma)||void 0===o?void 0:o.data_format,c=(0,u.YW)({sampleEntry:s});(c?[c]:u.mA.list()).some(function(i){return d(i.configBoxes).some(function(a){var o=e.videoConfigBox(e.findBox(n,[a],r)[0],s);return!!o&&(t[i.trackConfigKey||a]=o,!0)})}),t.pasp=e.pasp(e.findBox(n,["pasp"],r)[0])});default:if((0,u.YW)({sampleEntry:t.type}))return e.videoSampleEntry(t)}}).filter(Boolean)})}},{key:"tenc",value:function(e){return g(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(m(t[n])),n+=1})}},{key:"schi",value:function(t){return g(t,!1,function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])})}},{key:"sinf",value:function(t){return g(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 g(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 g(e,!1,function(t,n){var r=s.J.fromUint8(n);t.data=e.data,t.colorType=r.readString(4),"nclx"===t.colorType||"nclc"===t.colorType?(t.colorPrimaries=r.read(2),t.transferCharacteristics=r.read(2),t.matrixCoefficients=r.read(2),"nclx"===t.colorType&&(t.fullRangeFlag=r.read(1)>>7)):("rICC"===t.colorType||"prof"===t.colorType)&&(t.iccProfile=r.readToUint8())})}},{key:"av01",value:function(t){return g(t,!1,function(t,n,r){var i=h(t,n),a=n.subarray(i);r+=i,t.av1C=e.av1C(e.findBox(a,["av1C"],r)[0]),t.colr=e.colr(e.findBox(a,["colr"],r)[0])})}},{key:"av1C",value:function(e){return g(e,!1,function(t,n){t.data=e.data;var r,i=s.J.fromUint8(n),a=o.A.fromByte(i,4);t.marker=a.read(1),t.version=a.read(7),t.seqProfile=a.read(3),t.seqLevelIdx0=a.read(5),t.seqTier0=a.read(1),t.highBitdepth=a.read(1),t.twelveBit=a.read(1),t.monochrome=a.read(1),t.chromaSubsamplingX=a.read(1),t.chromaSubsamplingY=a.read(1),t.chromaSamplePosition=a.read(2),t.reserved=a.read(3),t.initialPresentationDelayPresent=a.read(1),t.initialPresentationDelayPresent?t.initialPresentationDelayMinusOne=a.read(4):t.initialPresentationDelayMinusOne=0,t.configOBUs=i.readToUint8(),2===t.seqProfile&&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 g(t,!1,function(t,n,r){var i=h(t,n),a=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])})}},{key:"avcC",value:function(e){return g(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=(0,a.dB)([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<t.spsLength;i++){var o=(0,a.i4)(n,r);r+=2,t.sps.push(n.subarray(r,r+o)),r+=o}t.ppsLength=n[r],r+=1,t.pps=[];for(var s=0;s<t.ppsLength;s++){var u=(0,a.i4)(n,r);r+=2,t.pps.push(n.subarray(r,r+=u)),r+=u}})}},{key:"hvc1",value:function(t){return g(t,!1,function(t,n,r){var i=h(t,n),a=n.subarray(i);r+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])})}},{key:"hvcC",value:function(e){return g(e,!1,function(t,n){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=n[0];var r=n[1];t.generalProfileSpace=r>>6,t.generalTierFlag=(32&r)>>5,t.generalProfileIdc=31&r,t.generalProfileCompatibility=(0,a.Bh)(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=(0,a.i4)(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,s=0,u=0,c=0;c<t.numOfArrays;c++){o=63&n[i],s=(0,a.i4)(n,i+1),i+=3;for(var d,l,f,h=[],v=0;v<s;v++)u=(0,a.i4)(n,i),i+=2,h.push(n.subarray(i,i+u)),i+=u;32===o?(d=t.vps).push.apply(d,h):33===o?(l=t.sps).push.apply(l,h):34===o&&(f=t.pps).push.apply(f,h)}})}},{key:"pasp",value:function(e){return g(e,!1,function(e,t){e.hSpacing=(0,a.Bh)(t),e.vSpacing=(0,a.Bh)(t,4)})}},{key:"mp4a",value:function(t){return g(t,!1,function(t,n,r){var i=v(t,n);t.esds=e.esds(e.findBox(n.subarray(i),["esds"],r+i)[0])})}},{key:"esds",value:function(e){return g(e,!0,function(e,t){e.codec="mp4a.";for(var n=0,r=0,a=0,o=0;t.length;){for(o=t[n=0],r=t[n+1],n+=2;128&r;)a=(127&r)<<7,r=t[n],n+=1;if(a+=127&r,3===o)t=t.subarray(n+3);else if(4===o)e.codec+=(t[n].toString(16)+".").padStart(3,"0"),t=t.subarray(n+13);else if(5===o){var s=e.config=t.subarray(n,n+a),u=(248&s[0])>>3;if(31===u&&s.length>=2&&(u=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=u,e.codec+=u.toString(16),/^mp4a/ig.test(e.codec)&&s.length>=2){var c=(7&s[0])<<1|(128&s[1])>>7;e.samplingFrequencyIndex=c,c<i.W.FREQ.length&&(e.sampleRate=i.W.FREQ[c])}"."===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 g(e,!1,function(e,t){v(e,t)})}},{key:"stts",value:function(e){return g(e,!0,function(e,t){for(var n=(0,a.Bh)(t),r=[],i=4,o=0;o<n;o++)r.push({count:(0,a.Bh)(t,i),delta:(0,a.Bh)(t,i+4)}),i+=8;e.entryCount=n,e.entries=r})}},{key:"ctts",value:function(e){return g(e,!0,function(e,t){var n=(0,a.Bh)(t),r=[],i=4;if(1===e.version)for(var o=0;o<n;o++)r.push({count:(0,a.Bh)(t,i),offset:(0,a.Bh)(t,i+4)}),i+=8;else for(var s=0;s<n;s++)r.push({count:(0,a.Bh)(t,i),offset:-(~(0,a.Bh)(t,i+4)+1)}),i+=8;e.entryCount=n,e.entries=r})}},{key:"stsc",value:function(e){return g(e,!0,function(e,t){for(var n=(0,a.Bh)(t),r=Array(n),i=4,o=0;o<n;o++)r[o]={firstChunk:(0,a.Bh)(t,i),samplesPerChunk:(0,a.Bh)(t,i+4),sampleDescriptionIndex:(0,a.Bh)(t,i+8)},i+=12;e.entryCount=n,e.entries=r})}},{key:"stsz",value:function(e){return g(e,!0,function(e,t){var n=(0,a.Bh)(t),r=(0,a.Bh)(t,4),i=Array(r);if(!n){for(var o=8,s=0;s<r;s++)i[s]=(0,a.Bh)(t,o),o+=4}e.sampleSize=n,e.sampleCount=r,e.entrySizes=i})}},{key:"stco",value:function(e){return g(e,!0,function(e,t){for(var n=(0,a.Bh)(t),r=Array(n),i=4,o=0;o<n;o++)r[o]=(0,a.Bh)(t,i),i+=4;e.entryCount=n,e.entries=r})}},{key:"co64",value:function(e){return g(e,!0,function(e,t){for(var n=(0,a.Bh)(t),r=Array(n),i=4,o=0;o<n;o++)r[o]=(0,a.h9)(t,i),i+=8;e.entryCount=n,e.entries=r})}},{key:"stss",value:function(e){return g(e,!0,function(e,t){for(var n=(0,a.Bh)(t),r=Array(n),i=4,o=0;o<n;o++)r[o]=(0,a.Bh)(t,i),i+=4;e.entryCount=n,e.entries=r})}},{key:"moof",value:function(t){return g(t,!1,function(t,n,r){t.mfhd=e.mfhd(e.findBox(n,["mfhd"],r)[0]),t.traf=e.findBox(n,["traf"],r).map(function(t){return e.traf(t)})})}},{key:"mfhd",value:function(e){return g(e,!0,function(e,t){e.sequenceNumber=(0,a.Bh)(t)})}},{key:"traf",value:function(t){return g(t,!1,function(t,n,r){t.tfhd=e.tfhd(e.findBox(n,["tfhd"],r)[0]),t.tfdt=e.tfdt(e.findBox(n,["tfdt"],r)[0]),t.trun=e.trun(e.findBox(n,["trun"],r)[0])})}},{key:"trun",value:function(e){return g(e,!0,function(e,t){var n=e.version,r=e.flags,i=t.length,o=e.sampleCount=(0,a.Bh)(t),s=4;if(i>4&&1&r&&(e.dataOffset=-(~(0,a.Bh)(t,s)+1),s+=4),i>s&&4&r&&(e.firstSampleFlags=(0,a.Bh)(t,s),s+=4),i>s){e.samples=Array(o);for(var u,c=0;c<o;c++)u={},256&r&&(u.duration=(0,a.Bh)(t,s),s+=4),512&r&&(u.size=(0,a.Bh)(t,s),s+=4),1024&r&&(u.flags=(0,a.Bh)(t,s),s+=4),2048&r&&(n?u.cts=-(~(0,a.Bh)(t,s+4)+1):u.cts=(0,a.Bh)(t,s),s+=4),e.samples[c]=u}})}},{key:"tfdt",value:function(e){return g(e,!0,function(e,t){1===e.version?e.baseMediaDecodeTime=(0,a.h9)(t):e.baseMediaDecodeTime=(0,a.Bh)(t)})}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>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(t,n,r){var a=t.trak;if(a&&a.length){var o=a.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="vide"}),s=a.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="soun"});if(o&&n){var d=null===(E=o.tkhd)||void 0===E?void 0:E.trackId;null!=d&&(n.id=o.tkhd.trackId),n.tkhdDuration=o.tkhd.duration,n.mvhdDurtion=t.mvhd.duration,n.mvhdTimecale=t.mvhd.timescale,n.timescale=n.formatTimescale=o.mdia.mdhd.timescale,n.duration=o.mdia.mdhd.duration||n.mvhdDurtion/n.mvhdTimecale*n.timescale,n.rotation=o.tkhd.rotation,n.matrix=o.tkhd.matrix,null!==(D=o.edts)&&void 0!==D&&D.elst&&(n.editList=o.edts.elst,n.editListApplied=o.editListApplied);var l=o.mdia.minf.stbl.stsd.entries[0];if(!l)throw Error("unknown video stsd entry");if(n.width=l.width,n.height=l.height,l.pasp&&(n.sarRatio=[l.pasp.hSpacing,l.pasp.vSpacing]),l.av1C)n.codecType=c._e.AV1,n.codec=l.av1C.codec,n.av1C=l.av1C.data,l.colr&&(n.colr=l.colr.data);else if(l.hvcC)n.codecType=c._e.HEVC,n.codec=l.hvcC.codec,n.vps=l.hvcC.vps,n.sps=l.hvcC.sps,n.pps=l.hvcC.pps,n.hvcC=l.hvcC.data;else if(l.avcC)n.codec=l.avcC.codec,n.sps=l.avcC.sps,n.pps=l.avcC.pps;else if(l.vvcC){var f,h,v,g,p,m,_,y,b,k,C,w,T,x,E,D,S,R,A,I,L,B,P,N,O="encv"===l.type?null===(P=l.sinf)||void 0===P?void 0:null===(N=P.frma)||void 0===N?void 0:N.data_format:l.type,M=(0,u.YW)({sampleEntry:O})||(0,u.YW)({configBox:"vvcC"});if(!(null!=M&&M.applyTrackConfig))throw Error("video codec parser is not registered: ".concat(O||"vvcC"));M.applyTrackConfig({track:n,entry:l,config:l.vvcC,parser:e})}else throw Error("unknown video stsd entry");n.present=!0,n.ext={},n.ext.stss=null===(S=o.mdia)||void 0===S?void 0:null===(R=S.minf)||void 0===R?void 0:null===(A=R.stbl)||void 0===A?void 0:A.stss,n.ext.ctts=null===(I=o.mdia)||void 0===I?void 0:null===(L=I.minf)||void 0===L?void 0:null===(B=L.stbl)||void 0===B?void 0:B.ctts,l&&"encv"===l.type&&(n.isVideoEncryption=!0,l.default_KID=null===(v=l.sinf)||void 0===v?void 0:null===(g=v.schi)||void 0===g?void 0:g.tenc.default_KID,l.default_IsEncrypted=null===(p=l.sinf)||void 0===p?void 0:null===(m=p.schi)||void 0===m?void 0:m.tenc.default_IsEncrypted,l.default_IV_size=null===(_=l.sinf)||void 0===_?void 0:null===(y=_.schi)||void 0===y?void 0:y.tenc.default_IV_size,n.videoSenc=null===(b=o.mdia)||void 0===b?void 0:null===(k=b.minf)||void 0===k?void 0:null===(C=k.stbl)||void 0===C?void 0:null===(w=C.senc)||void 0===w?void 0:w.samples,l.data_format=null===(T=l.sinf)||void 0===T?void 0:null===(x=T.frma)||void 0===x?void 0:x.data_format,n.useEME=t.useEME,n.kidValue=t.kidValue,n.pssh=t.pssh,n.encv=l)}if(s&&r){var Z,W,F,V,z,U,j,G,H,Y,J,q,X,Q,K,$,ee,et,en=null===(Z=s.tkhd)||void 0===Z?void 0:Z.trackId;null!=en&&(r.id=s.tkhd.trackId),r.tkhdDuration=s.tkhd.duration,r.mvhdDurtion=t.mvhd.duration,r.mvhdTimecale=t.mvhd.timescale,r.timescale=r.formatTimescale=s.mdia.mdhd.timescale,r.duration=s.mdia.mdhd.duration||r.mvhdDurtion/r.mvhdTimecale*r.timescale,null!==(W=s.edts)&&void 0!==W&&W.elst&&(r.editList=s.edts.elst,r.editListApplied=s.editListApplied);var er=s.mdia.minf.stbl.stsd.entries[0];switch(r.sampleSize=er.sampleSize,r.sampleRate=function(e){var t,n=0;return(n="mp4a"===e.type?e.sampleRate>0?e.sampleRate:null===(t=e.esds)||void 0===t?void 0:t.sampleRate:e.sampleRate)||0}(er),r.channelCount=er.channelCount,r.present=!0,er.type){case"alaw":r.codecType=r.codec=c.yQ.G711PCMA,r.sampleRate=8e3;break;case"ulaw":r.codecType=r.codec=c.yQ.G711PCMU,r.sampleRate=8e3;break;default:r.sampleDuration=i.W.getFrameDuration(r.sampleRate,r.timescale),r.sampleRateIndex=i.W.getRateIndexByRate(r.sampleRate),r.objectType=(null===(f=er.esds)||void 0===f?void 0:f.objectType)||2,er.esds&&(r.config=Array.from(er.esds.config)),r.codec=(null===(h=er.esds)||void 0===h?void 0:h.codec)||"mp4a.40.2"}r.sampleDuration=i.W.getFrameDuration(r.sampleRate,r.timescale),r.objectType=(null===(F=er.esds)||void 0===F?void 0:F.objectType)||2,er.esds&&er.esds.config&&(r.config=Array.from(er.esds.config)),r.codec=(null===(V=er.esds)||void 0===V?void 0:V.codec)||"mp4a.40.2",r.sampleRateIndex=i.W.getRateIndexByRate(r.sampleRate),r.ext={},r.ext.stss=null===(z=s.mdia)||void 0===z?void 0:null===(U=z.minf)||void 0===U?void 0:null===(j=U.stbl)||void 0===j?void 0:j.stss,r.ext.ctts=null===(G=s.mdia)||void 0===G?void 0:null===(H=G.minf)||void 0===H?void 0:null===(Y=H.stbl)||void 0===Y?void 0:Y.ctts,r.present=!0,er&&"enca"===er.type&&(r.isAudioEncryption=!0,er.data_format=null===(J=er.sinf)||void 0===J?void 0:null===(q=J.frma)||void 0===q?void 0:q.data_format,er.default_KID=null===(X=er.sinf)||void 0===X?void 0:null===(Q=X.schi)||void 0===Q?void 0:Q.tenc.default_KID,er.default_IsEncrypted=null===(K=er.sinf)||void 0===K?void 0:null===($=K.schi)||void 0===$?void 0:$.tenc.default_IsEncrypted,er.default_IV_size=null===(ee=er.sinf)||void 0===ee?void 0:null===(et=ee.schi)||void 0===et?void 0:et.tenc.default_IV_size,r.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,r.useEME=t.useEME,r.kidValue=t.kidValue,r.enca=er)}if(r&&(r.isVideoEncryption=!!n&&n.isVideoEncryption),n&&(n.isAudioEncryption=!!r&&r.isAudioEncryption),null!=n&&n.encv||null!=r&&r.enca){var ei,ea,eo=null==n?void 0:null===(ei=n.encv)||void 0===ei?void 0:ei.default_KID,es=null==r?void 0:null===(ea=r.enca)||void 0===ea?void 0:ea.default_KID,eu=eo||es?(eo||es).join(""):null;n&&(n.kid=eu),r&&(r.kid=eu)}return n&&(n.flags=3841),r&&(r.flags=1793),{videoTrack:n,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,n){var r,i=null==t?void 0: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 a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime),r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(n,r,s.samples.length||s.sampleCount),d=s.dataOffset||0,l=0,f=-1;if(!s.samples.length&&s.sampleCount){i[a.trackId]=Array(s.sampleCount);for(var h=0;h<s.sampleCount;h++)i[a.trackId][h]={offset:d,dts:l,duration:c,size:u},l+=c,d+=u}else i[a.trackId]=s.samples.map(function(e,t){return(e={offset:d,dts:l,pts:l+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:f,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(f++,e.gopId=f),l+=e.duration,d+=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(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="vide"}),r=t.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="soun"});if(n||r){if(n){var i,a,o,s,u=null===(o=n.mdia)||void 0===o?void 0:null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,d=u.stsc,l=u.stsz,h=u.stco,v=u.stss,g=u.ctts;if(!c||!d||!l||!h||!v)return;i=f(c,d,l,h,g,v)}if(r){var p,m,_,y=null===(p=r.mdia)||void 0===p?void 0:null===(m=p.minf)||void 0===m?void 0:m.stbl;if(!y)return;var b=null===(_=r.mdia.mdhd)||void 0===_?void 0:_.timescale,k=y.stts,C=y.stsc,w=y.stsz,T=y.stco;if(!b||!k||!C||!w||!T)return;a=f(k,C,w,T)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function f(e,t,n,r,i,a){var o,s,u,c=[],d=null==i?void 0:i.entries,l=t.entries,f=r.entries,h=n.entrySizes,v=null==a?void 0:a.entries;v&&(o={},v.forEach(function(e){o[e-1]=!0})),d&&(s=[],d.forEach(function(e){for(var t=e.count,n=e.offset,r=0;r<t;r++)s.push(n)}));var g=-1,p=0,m=0,_=0,y=0,b=0,k=l[0].samplesPerChunk,C=l[1]?l[1].firstChunk-1:1/0;return e.entries.forEach(function(e){for(var t=e.count,r=e.delta,i=0;i<t;i++)u={dts:p,duration:r,size:h[m]||n.sampleSize,offset:f[_]+b,index:m},v&&(u.keyframe=o[m],u.keyframe&&g++,u.gopId=g),s&&m<s.length&&(u.pts=u.dts+s[m]),c.push(u),p+=r,++m<k?b+=u.size:(_++,b=0,_>=C&&(C=l[++y+1]?l[y+1].firstChunk-1:1/0),k+=l[y].samplesPerChunk)}),c}function h(e,t){return e.dataReferenceIndex=(0,a.i4)(t,6),e.width=(0,a.i4)(t,24),e.height=(0,a.i4)(t,26),e.horizresolution=(0,a.Bh)(t,28),e.vertresolution=(0,a.Bh)(t,32),e.frameCount=(0,a.i4)(t,40),e.depth=(0,a.i4)(t,74),78}function v(e,t){return e.dataReferenceIndex=(0,a.i4)(t,6),e.channelCount=(0,a.i4)(t,16),e.sampleSize=(0,a.i4)(t,18),e.sampleRate=(0,a.Bh)(t,24)/65536,28}function g(e,t,n){if(e){if(e.size!==e.data.length)throw 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=(0,a.sV)(e.data,e.headerSize+1),r.headerSize+=4),n(r,e.data.subarray(r.headerSize),r.start+r.headerSize),r}}var p=function(e,t,n){for(var r=String(n),i=t>>0,a=Math.ceil(i/r.length),o=[],s=String(e);a--;)o.push(r);return o.join("").substring(0,i-s.length)+s},m=function(){for(var e=[],t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(t){e.push(p(Number(t).toString(16),2,0))}),e[0]}},662439:function(e,t,n){n.d(t,{A:function(){return i}});var r=n(697946),i=function(){function e(t,n){(0,r.PA)(this,e),this.offset=0,this.val=t,this.size=n}return(0,r.qH)(e,[{key:"skip",value:function(e){this.offset+=e}},{key:"read",value:function(e){var t=this.size-this.offset-e;if(t>=0){var n=0,r=0;if(this.offset+=e,this.size>31){for(;r<e;r++)n+=Math.pow(2,r);return this.val/Math.pow(2,t)&n}for(;r<e;r++)n+=1<<r;return this.val>>>t&n}throw 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)}}]),e}()},578548:function(e,t,n){function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=new Uint8Array((t=t.filter(Boolean)).reduce(function(e,t){return e+t.byteLength},0)),i=0;return t.forEach(function(e){r.set(e,i),i+=e.byteLength}),r}n.d(t,{Bh:function(){return o},Dc:function(){return v},Qc:function(){return f},Wp:function(){return h},_b:function(){return c},dB:function(){return d},e2:function(){return s},gJ:function(){return r},h9:function(){return u},i4:function(){return i},mw:function(){return l},sV:function(){return a}});function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function a(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)}function o(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 s(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 u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return 4294967296*o(e,t)+o(e,t+4)}function c(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 d(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}function l(e){var t="";if(e.forEach(function(e){t+=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()}(e)}),t.length<=32){for(var n=32-t.length,r=0;r<n;r++)t+="0"}return t}function f(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r<e.length;r++)r%2&&(n=e[r-1]+e[r],t.push(parseInt(n,16)),n="");return t}return e.map(function(e){return parseInt(e,16)})}function h(e,t){return Number(e+"."+t)}function v(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}},258413:function(e,t,n){n.d(t,{Vc:function(){return r},_e:function(){return i},yQ:function(){return a}});var r={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},i={AVC:"avc",HEVC:"hevc",VVCC:"vvcC"},a={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m"}}}]);