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

2 lines
119 KiB
Plaintext

/*! For license information please see player-2.b3c9446a.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,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e,t,n){if(n||2==arguments.length)for(var i,r=0,a=t.length;r<a;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var i=/[^a-zA-Z0-9\\_:.-]/gim,r=/</g,a=/>/g,o=/&#([a-zA-Z0-9]*);?/gim,s=/&quot;/g,u=/&colon;?/gim,c=/&newline;?/gim,l=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,d=/u\s*r\s*l\s*\(.*/gi,f=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,h=/"/g,g=function(e){return e.replace(r,"&lt;").replace(a,"&gt;")},v={indexOf:function(e,t){var n,i;for(n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return -1},forEach:function(e,t,n){var i,r;for(i=0,r=e.length;i<r;i++)t.call(n,e[i],i,e)},some:function(e,t,n){var i,r;for(i=0,r=e.length;i<r;i++)if(t.call(n,e[i],i,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=[],i=0;i<e.length;i++)t[e[i]]||(n.push(e[i]),t[e[i]]=!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,i,r,a,o,s,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",l=0;for(e=function(e){e=e.replace(/rn/g,"n");for(var t="",n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t+=String.fromCharCode(i):i>127&&i<2048?t+=String.fromCharCode(i>>6|192)+String.fromCharCode(63&i|128):t+=String.fromCharCode(i>>12|224)+String.fromCharCode(i>>6&63|128)+String.fromCharCode(63&i|128)}return t}(e);l<e.length;)r=(t=e.charCodeAt(l++))>>2,a=(3&t)<<4|(n=e.charCodeAt(l++))>>4,o=(15&n)<<2|(i=e.charCodeAt(l++))>>6,s=63&i,isNaN(n)?o=s=64:isNaN(i)&&(s=64),c=c+u.charAt(r)+u.charAt(a)+u.charAt(o)+u.charAt(s);return c}function y(e){var t,n,i,r,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|(r=s.indexOf(e.charAt(c++)))>>4,n=(15&r)<<4|(a=s.indexOf(e.charAt(c++)))>>2,i=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(n)),64!==o&&(u+=String.fromCharCode(i));return function(e){for(var t="",n=0,i=0,r=0,a=0;n<e.length;)(i=e.charCodeAt(n))<128?(t+=String.fromCharCode(i),n++):i>191&&i<224?(t+=String.fromCharCode((31&i)<<6|63&(a=e.charCodeAt(n+1))),n+=2):(a=e.charCodeAt(n+1),t+=String.fromCharCode((15&i)<<12|(63&a)<<6|63&(r=e.charCodeAt(n+2))),n+=3);return t}(u)}function I(e,t,n){var i="",r=0,a=!1,o=!1,s=0,u=e.length,c="",l="";e:for(s=0;s<u;s++){var d=e.charAt(s);if(!1===a){if("<"===d){a=s;continue}}else if(!1===o){if("<"===d){i+=n(e.slice(r,s)),a=s,r=s;continue}if(">"===d||s===u-1){i+=n(e.slice(r,a)),c=function(e){var t,n=v.spaceIndex(e);return t=-1===n?e.slice(1,-1):e.slice(1,n+1),"/"===(t=v.trim(t).toLowerCase()).slice(0,1)&&(t=t.slice(1)),"/"===t.slice(-1)&&(t=t.slice(0,-1)),t}(l=e.slice(a,s+1)),i+=t(a,i.length,c,l,"</"===l.slice(0,2)),r=s+1,a=!1;continue}if('"'===d||"'"===d)for(var f=1,h=e.charAt(s-f);""===h.trim()||"="===h;){if("="===h){o=d;continue e}h=e.charAt(s-++f)}}else if(d===o){o=!1;continue}}return r<u&&(i+=n(e.substr(r))),i}function A(e,t){var n=0,r=0,a=[],o=!1,s=e.length;function u(e,n){if(!((e=(e=v.trim(e)).replace(i,"").toLowerCase()).length<1)){var r=t(e,n||"");r&&a.push(r)}}for(var c=0;c<s;c++){var l=e.charAt(c),d=void 0;if(!1!==o||"="!==l){if(!1===o||c!==r){if(/\s|\n|\t/.test(l)){if(e=e.replace(/\s|\n|\t/g," "),!1===o){if(-1===(d=function(e,t){for(;t<e.length;t++){var n=e[t];if(" "!==n)return"="===n?t:-1}return -1}(e,c))){u(v.trim(e.slice(n,c))),o=!1,n=c+1;continue}c=d-1;continue}if(-1===(d=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(v.trim(e.slice(n,c)))),o=!1,n=c+1;continue}}}else{if(-1===(d=e.indexOf(l,c+1)))break;u(o,v.trim(e.slice(r+1,d))),o=!1,n=(c=d)+1}}else o=e.slice(n,c),n=c+1,r='"'===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(v.trim(e.slice(n))))),v.trim(a.join(" "))}function C(e,t,n){if(n=function(e){return e=function(e){for(var t="",n=0,i=e.length;n<i;n++)t+=32>e.charCodeAt(n)?" ":e.charAt(n);return v.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=v.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(l.lastIndex=0,l.test(n))return""}else if("style"===t&&(f.lastIndex=0,f.test(n)||(d.lastIndex=0,d.test(n)&&(l.lastIndex=0,l.test(n)))))return"";return n=function(e){return e=g(e=e.replace(h,"&quot;"))}(n)}var b=function(e){return"string"==typeof e?e.replace(/'/g,'"').replace('=""',"").replace(/\s+/g,"").toLowerCase():""},S=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=g,this.options=Object.assign(t,e)}return e.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t,n,i,r,a,o,s=this.options,u=s.whiteList,c=s.onTag,l=s.onIgnoreTag,d=s.onTagAttr,f=s.onIgnoreTagAttr,h=s.safeAttrValue,g=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 i=e.indexOf("\x3c!--",n);if(-1===i){t+=e.slice(n);break}t+=e.slice(n,i);var r=e.indexOf("--\x3e",i);if(-1===r)break;n=r+3}return t}(e));var p=!1;s.stripIgnoreTagBody&&(n=s.stripIgnoreTagBody,"function"!=typeof(i=l)&&(i=function(){}),r=!Array.isArray(n),a=[],o=!1,l=(p={onIgnoreTag:function(e,t,s){var u;if(u=e,r||-1!==v.indexOf(n,u)){if(s.isClosing){var c="[/removed]",l=s.position+c.length;return a.push([!1!==o?o:s.position,l]),o=!1,c}return o||(o=s.position),"[removed]"}return i(e,t,s)},remove:function(e){var t="",n=0;return v.forEach(a,function(i){t+=e.slice(n,i[0]),n=i[1]}),t+=e.slice(n)}}).onIgnoreTag);var m=I(e,function(e,t,n,i,r){var a={sourcePosition:e,position:t,isClosing:r,isWhite:Object.prototype.hasOwnProperty.call(u,n)},o=c(n,i,a);if(null!=o)return o;if(a.isWhite){if(a.isClosing)return"</".concat(n,">");var s=function(e){var t=v.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var n="/"===(e=v.trim(e.slice(t+1,-1)))[e.length-1];return n&&(e=v.trim(e.slice(0,-1))),{html:e,closing:n}}(i),p=u[n],m=A(s.html,function(e,t){var i=-1!==v.indexOf(p,e),r=d(n,e,t,i);return null==r?i?(t=h(n,e,t,null))?"".concat(e,'="').concat(t,'"'):e:null==(r=f(n,e,t,i))?void 0:r:r});return i="<".concat(n),m&&(i+=" ".concat(m)),s.closing&&(i+=" /"),i+=">"}return null==(o=l(n,i,a))?g(i):o},g);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")(),k=new(function(){function e(){var e=this;this.batchData=[],this.uniqKeys=new Set,this.timeout=2e3,this.lock=!1,this.getSlardarBid=function(){var t,n,i="douyin_web";if(!v.includes(i,"bid"))return i;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 r=(x.slardar.config()||{}).bid;if(r)return r}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 v.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 i={age:Math.floor(Date.now()),type:"xss",url:n,body:e,"user-agent":""};"enforce"===e.disposition&&"SSR"!==n||(i.url=t),"SSR"===n&&(i.url="SSR___".concat(i.url),i.body.ssr=!0),this.push(i)}},e}()),E=function(e){for(var t=0,n=function(n){Array.isArray(e[n])?0===e[n].length?delete e[n]:(e[n]=v.from(v.uniq(e[n])),t+=e[n].length):0===v.keys(e[n]).length?delete e[n]:v.keys(e[n]).forEach(function(i){e[n][i]=v.from(v.uniq(e[n][i])),t+=e[n][i].length})},i=0,r=v.keys(e);i<r.length;i++)n(r[i]);return{count:t,ret:e}};function T(e,t){return k.setConfig(t),new S(t).process(e)}function w(e){var t,n=(t=/\s|\n|\t/.exec(e))?t.index:-1;if(-1===n)return{html:"",closing:"/"===e[e.length-2]};var i="/"===(e=e.slice(n+1,-1).trim())[e.length-1];return i&&(e=e.slice(0,-1).trim()),{html:e,closing:i}}var R=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,i){return String.fromCharCode(t?parseInt(n,16):parseInt(i))}).replace(/(\t|\n|\r)/g,"").toLowerCase()};function L(e,t){if(void 0===e&&(e=""),"string"!=typeof e)return!0;if(e=R(e),v.includes(e,"base64")&&!function(e){if(""===e||""===e.trim())return!0;try{return!v.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(v.some(n,function(t){return -1!==e.indexOf(t)}))return v.forEach(n,function(n){-1!==e.indexOf(n)&&t&&t(n)}),!1;var i=["data:application","data:javascript","data:text/html","data:texthtml"];if(v.some(i,function(t){return -1!==e.indexOf(t)}))return v.forEach(i,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 r=e.slice(11).replace(/\s/g,"").trim();return!!v.some(["void","void(0)","void0","false","undefined",";"],function(e){return e===r})||(t&&t("javascript:"),!1)}return!0}var Z=function(e,t){var n,i,r="<%= isSaveValidUrl =>";if("string"!=typeof e||(i=Number("<%= urlLimit =>"),void 0!==n&&(i=n),"NaN"!==e.toString()&&-1!==i&&e.length>=i)||L(e,t))return e;try{if(!0===(r=JSON.parse(r))||"true"===r){var a=new URL(e);return a.origin+a.pathname}}catch(e){}return"#"};function O(e,t,i){if(void 0===e&&(e=""),void 0===t&&(t=[]),"string"!=typeof e)return!0;if(!L(e=R(e)))return!1;var r,a={url:(r=e.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/)||[])[0],scheme:r[1],slash:r[2],host:r[3],port:r[4],path:r[5],query:r[6],hash:r[7]},o=a.scheme,s=a.host;return i?!!i(e):!(!o||!s)&&(!v.includes(["http","https","file"],o)||("object"==typeof window&&window&&(t=n(n([],t,!0),[location.host],!1)),v.some(t,function(e){return!!(e instanceof RegExp&&e.test(s))||e===s})))}var B={a:["target","title","spellcheck","rel"],canvas:[],abbr:["title"],address:[],area:["shape","coords","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:["dir"],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["alt","title","width","height","decoding"],ins:["datetime"],li:[],mark:[],nav:[],ol:["start"],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],delete:[],form:[],strong:[],mask:["maskunits","x","y","width","height","fill"],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],wbr:[],video:["autoplay","controls","loop","preload","height","width"],svg:["viewBox","version","xmlns","fill","width","height","stroke","stroke-width","style"],path:["d","fill","opacity","stroke","p-id","fill-rule","clip-rule","stroke-width","stroke-linecap","stroke-linejoin","fill-opacity","mask"],rect:["x","y","width","height","fill","stroke","rx"],g:[]},P={collect:null,initCollect:function(){this.collect={whiteList:{},filterProtocol:[]}},removeCollect:function(){var e=E(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,i){return e&&v.indexOf(["href","src"],t)>-1?P.domainWhiteList&&Array.isArray(P.domainWhiteList)&&P.domainWhiteList.length>0&&!O(i,n([],P.domainWhiteList,!0))?"":"".concat(t,'="').concat(Z(i,function(e){var t;null===(t=P.collect)||void 0===t||t.filterProtocol.push(e)}),'"'):e&&(v.indexOf(["style","class","id"],t)>-1||t.indexOf("data-")>-1)?"".concat(t,'="').concat(i,'"'):(P.collect.whiteList[e]=P.collect.whiteList[e]||[],void P.collect.whiteList[e].push(t))},onIgnoreTag:function(e,t){if("style"===e)return t;I(t,function(e,t,n,i){A(w(i).html.replace("/",""),function(e){P.collect.whiteList[n]=P.collect.whiteList[n]||[],P.collect.whiteList[n].push(e)})},g)},whiteList:B,mergeWhiteList:function(e){for(var t,n={},i=0,r=v.keys(B);i<r.length;i++)n[t=r[i]]=v.from(B[t]);for(var a=0,o=v.keys(e);a<o.length;a++)n[t=o[a]]=t in B?B[t].concat(e[t]):v.from(e[t]);return n},setWhiteList:function(e){for(var t=0,n=v.keys(e);t<n.length;t++){var i=n[t];this.whiteList[i]=i in B?B[i].concat(e[i]):v.from(e[i])}}};try{var N={},G="merge";v.includes(G,"override")&&(P.whiteList=N.whiteList),v.includes(G,"merge")&&P.setWhiteList(N.whiteList)}catch(e){}var V=function(e,t){for(var n={},i=0,r=v.keys(e);i<r.length;i++){var a=r[i];Array.isArray(e[a])?n[a]=v.from(e[a]):n[a]=V({},e[a])}for(var o=0,s=v.keys(t);o<s.length;o++)(a=s[o])in e?Array.isArray(e[a])?n[a]=e[a].concat(t[a]):n[a]=V(e[a],t[a]):Array.isArray(t[a])?n[a]=v.from(t[a]):n[a]=V({},t[a]);return n},D={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 M={};M.blackAttrRegExps&&(M.blackAttrRegExps=M.blackAttrRegExps.map(function(e){return new RegExp(e.toString().slice(1,e.toString().length-1))}));var K="merge";v.includes(K,"override")&&(D=M),v.includes(K,"merge")&&(D=V(D,M))}catch(e){}var U={mode:"black",whiteList:{},blackConfig:D,collect:null,initCollect:function(){U.collect={blackList:{},blackTags:[],blackAttrs:[],blackAttrRegExps:[],filterAttrs:[],filterList:{},filterProtocol:[]}},removeCollect:function(){var e=E(U.collect),t=e.count,n=e.ret;return U.collect=null,{collectKey:0===t?null:JSON.stringify(n),collectMode:"black"}},onIgnoreTag:function(e,t){var n;if(!v.includes(D.blackTags,e))return I(t,function(e,t,n,i,r){if(-1!==n.indexOf("/"))return g(i);if(r)return"</".concat(n,">");var a=w(i),o=A(a.html,function(e,t){var i,r=0;if(D.blackList[n]&&v.includes(D.blackList[n],e)&&(U.collect.blackList[n]=U.collect.blackList[n]||[],U.collect.blackList[n].push(e),r++),D.blackAttrRegExps.length&&D.blackAttrRegExps.some(function(t){return t.test(e)})&&v.forEach(D.blackAttrRegExps,function(t){t.test(e)&&(U.collect.blackAttrRegExps.push("".concat(t.toString(),"->").concat(e)),r++)}),D.blackAttrs.length&&v.includes(D.blackAttrs,e)&&(D.blackAttrs.push(e),r++),!r){if(D.filterList&&D.filterList[n]&&v.includes(D.filterList[n],e)){var a=Z(t,function(e){var t;null===(t=U.collect)||void 0===t||t.filterProtocol.push(e)});return a!==t&&(U.collect.filterList[n]=U.collect.filterList[n]||[],U.collect.filterList[n].push(e)),t?"".concat(e,"='").concat(a,"'"):e}return D.filterAttrs&&v.includes(D.filterAttrs,e)?((a=Z(t,function(e){var t;null===(t=U.collect)||void 0===t||t.filterProtocol.push(e)}))!==t&&(null===(i=U.collect)||void 0===i||i.filterAttrs.push(e)),t?"".concat(e,"='").concat(a,"'"):e):t?"".concat(e,"='").concat(t,"'"):e}});return i="<".concat(n),o&&(i+=" ".concat(o)),a.closing&&(i+=" /"),i+=">"},g);null===(n=U.collect)||void 0===n||n.blackTags.push(e)}},j=function(e){var t=e.reportOnly,n=void 0===t||t,i=e.block;return n&&"all"===n?"report":("string"==typeof n&&("true"===n&&(n=!0),"false"===n&&(n=!1)),i?"enforce":n?"report":"enforce")},W=function(e){return function(n,i,r){if(!n||"string"!=typeof n)return n;var a=i;e===T&&(a=P).initCollect();var o=e(n,a);if(b(o)===b(n))return n;if(!r)return o;var s=r.logType,u=j(r),c=a.removeCollect();return k.report(t(t({type:s,disposition:u},c),{sourceText:_(n),filterText:_(o)})),"enforce"===u?o:n}},Y=W(function(e,t){return void 0===t&&(t={}),t&&t.whiteList||(t.whiteList={a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}),new S(t).process(e)}),F=W(T),H=function(e,t,n){var i=[],r=Z(e,function(e){i.push(e)});if(r===e)return e;i=v.from(v.uniq(i));var a=t||n||{};if(!a)return r;var o=a.logType,s=j(n);return k.report({type:o,disposition:s,collectKey:i.join("___"),collectData:JSON.stringify(i),collectMode:"black",sourceText:_(e),filterText:_(r)}),"enforce"===s?r:e},X=x._xssProject||{},J=x.xssNamespace||{},Q="3.0.26",z={FilterXSS:S,version:Q,webpackPluginVersion:"<%= webpackPluginVersion =>",reportOnly:"<%= reportOnly =>",filterXSS:Y,_filterXSS:F,filterUrl:H,Config:P,BlackConfig:U,project:X,setProjectName:function(e){X[e]=this,x._xssProjectName=e}};J.douyin_web=z,x.xssNamespace=J,x.Math&&!x.Math.xssNamespace&&(x.Math.xssNamespace=J),X[Q]=z,x.globalThis=x,x.getFilterXss=function(){return void 0!==this._xssProjectName?this._xssProject[this._xssProjectName]:z},x.xss=z,x.isSafeUrl=O,x.isSafeDomain=O,x.isSafeProtocol=L,x._xssProject=X,x._xssProjectName&&(X[x._xssProjectName]=z);var q=z.setProjectName.bind(z);e.BlackConfig=U,e.Config=P,e.FilterXSS=S,e._filterXSS=F,e.filterUrl=H,e.filterXSS=Y,e.isSafeDomain=O,e.isSafeProtocol=L,e.isSafeUrl=O,e.project=X,e.setProjectName=q,e.setXssNamespace=function(e){var t=e.appId,n=e.bid,i=e.region;J[t]=z;P.bid=n,P.region=i,P.enabled=!0},e.xssNamespace=J,Object.defineProperty(e,"__esModule",{value:!0})}),(self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["13815"],{861504:function(e,t,n){n.d(t,{Ef:function(){return d},Im:function(){return g},Iv:function(){return y},TJ:function(){return h},XZ:function(){return l},Z1:function(){return A},_X:function(){return p},a1:function(){return u},eT:function(){return o},fD:function(){return r},fp:function(){return _},he:function(){return m},kW:function(){return a},of:function(){return s},sW:function(){return v},tE:function(){return c},zK:function(){return f},zb:function(){return I}}),n(232070);var i,r={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET",MEDIA_LIST:"MEDIA_LIST",FIRST_MET_MUX_NOT_CONTINUE:"FIRST_MET_MUX_NOT_CONTINUE"},a="real_time_speed",o="is unsupported",s="buffer_control",u={WAITING:"waiting",PLAYING:"playing"},c={app_id:6383,sid:5,task_type:1},l=10,d=2,f=10;var h=((i=h||{}).GOP="gop",i.SIZE="size",i.UNMUX="un_mux",i.ONLY_SIZE="only_size",i),g={BUFFER_CONTROLS:"buffer_control"},v="timer_update",p=.2,m=5,_={PRELOAD_ERROR:"PRELOAD_ERROR",PRELOAD_CHECK:"PRELOAD_CHECK",PRELOAD_OK:"PRELOAD_OK",PRELOAD_MATCH:"PRELOAD_MATCH",USER_DEFI_CHECK:"USER_DEFI_CHECK"},y={META_READY:"meta_ready",INIT:"init"},I=[{range:[0,1800],time:5e3},{range:[1800,3600],time:1e4},{range:[3600,7200],time:15e3},{range:[7200,18e3],time:2e4},{range:[18e3,Number.MAX_VALUE],time:3e4}],A="progress dataLen not match"},980275:function(e,t,n){function i(e,t){try{if(!t||e.startsWith("blob"))return e;var n=e.indexOf("?"),i=n===e.length-1,r="";Object.keys(t).forEach(function(e){var n=t[e];if(null!=n&&""!==n)r+="".concat(r?"&":"").concat(e,"=").concat(t[e])});return e+=(n<0?"?":i?"":"&")+r}catch(t){return e}}n.d(t,{v:function(){return i}}),n(346984),n(2885),n(248385),n(968336),n(663030)},608215:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(648955);n(346984),n(705574),n(124300),n(9498),n(117232),n(173757),n(2885),n(248385),n(759943),n(414931),n(683656),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 r=n(358506),a=n.n(r),o=n(405762),s=n(874768),u=n(731751),c=n(298757),l=n(521323),d=n(204961),f=n(829594),h=n(516968),g=n(525231);function v(e,t,n,i){return e[t]?i?i(e[t]):e[t]:n}let p=function(){var e;function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;(0,i.PA)(this,t),a()(this),this.url=e,this.options=r,this.dash=o,this.useSeparationMode=null===(n=this.dash.config)||void 0===n?void 0:n.useSeparationMode,this.mediaList={video:[],audio:[]},this.mediaList.audio.selectedIdx=0,this.retryMax=10,this.retry=0,this.type="live",this.isEnd=!1,this.duration=0,this.hasSync=!1,this._readyPromise=new c.XK,this._loadStates={video:this._createLoadingState(),audio:this._createLoadingState()},this.majorCodecType=null}return(0,i.qH)(t,[{key:"_createLoadingState",value:function(){return{currentIndex:0,isLoading:!1}}},{key:"readyPromise",get:function(){return this._readyPromise}},{key:"setLoadingState",value:function(e,t){this._loadStates[e].isLoading=t}},{key:"calcVideoCodeType",value:function(e,t){if(!!e||!!t){var n=null;t?n=t.split(".")[0]:e&&(n=e.split(".")[0]);for(var i=null,r=null,a=Object.keys(d.$V),o=0;o<a.length;o++){var s=a[o],u=d.$V[s];if(u.types.concat(u.visualEntryBox).indexOf(n)>-1){i=s,"hevc"===s?i="h265":"bvc2"===s?i="h266":"avc"===s&&(i="h264"),r=u.codecs;break}}return l.ZP.log("mpd dataType:",e,"codecs:",t,"cal type:",i,"videoCodecs",r),!i&&(i="h264",r=d.$V[d.d0.AVC].codecs),this.dash&&this.dash._pluginInst&&this.dash._pluginInst.setCodeInfo(i),{videoCodecType:i,videoCodecs:r}}}},{key:"fetch",value:(e=(0,i.x)((0,i.l5)().mark(function e(n){var r,a,o,u,c,l,d,f;return(0,i.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,a={TYPE:"LIVE",ENDLIST:""},o=[],e.prev=3,u=new h.mf({}),e.next=7,u.load(n);case 7:if(!(c=e.sent.data)){e.next=21;break}if(l=t.parseMPD(c)){e.next=13;break}throw Error("parse mpd error");case 13:return this._parseMeta(a,l),this._parseSegments(l,n),["video","audio"].forEach(function(e){r.mediaList[e].length>0&&(r.mediaList[e].selectedIdx="video"===e&&r.dash.selectedIdx||0,r.mediaList[e].sort(function(t,n){return"video"===e?n.height-t.height:n.bandwidth-t.bandwidth}))}),0===r.mediaList.video.length&&0===r.mediaList.audio.length&&(null===(d=r.dash)||void 0===d||d.emit("error",new s.Z(g.wb.MANIFEST,g.wb.SUB_TYPES.DASH,{url:n,message:"NO_MEDIALIST fetch"}))),e.abrupt("return",{meta:a,segments:o});case 21:throw r.dash.emit("error",new s.Z(g.wb.MANIFEST,g.wb.SUB_TYPES.DASH,{url:n,message:"mpd parse error"})),Error("MPD_PARSE_ERROR");case 23:e.next=29;break;case 25:throw e.prev=25,e.t0=e.catch(3),r.dash.emit("error",new s.Z(g.wb.RUNTIME,s.Z.MPD_INIT_ERROR,{httpCode:null===(f=e.t0.response)||void 0===f?void 0:f.status,url:n,message:null===e.t0||void 0===e.t0?void 0:e.t0.message})),Error(e.t0);case 29:case"end":return e.stop()}},e,this,[[3,25]])})),function(t){return e.apply(this,arguments)})},{key:"_parseMeta",value:function(e,t){"static"===t.type&&(e.TYPE="VOD"),t.minBufferTime&&(e.minBufferTime=o.Z.durationConvert(t.minBufferTime)),t.maxSegmentDuration&&(e.maxSegmentDuration=o.Z.durationConvert(t.maxSegmentDuration)),t.mediaPresentationDuration&&(this.duration=o.Z.durationConvert(t.mediaPresentationDuration));var n=t.Period[0];!this.duration&&n&&n.duration&&(this.duration=o.Z.durationConvert(n.duration)),e.duration=this.duration}},{key:"_parseST",value:function(e,t,n,i,r){for(var a=parseFloat(e.timescale),s=Math.round(parseFloat(e.duration)/a),u=parseInt(e.startNumber,10),c=u+Math.ceil(this.duration/s)-1,l=u;l<=c;l++){var d=s*(l-u),f=s*(l-u+1);l===c&&(s=this.duration-s*(c-u),f=this.duration),t.push({idx:l,start:Math.round(d),end:Math.round(f),url:i+e.media.replace("$RepresentationID$",n).replace("$Number%04d$",o.Z.preFixInterge(l,4)),downloaded:0,segmentDuration:s,height:r})}}},{key:"_getVideoSegments",value:function(e){var t,n,i,r,a,o=e.bandwidth,s=e.id,u=e.baseURL,c=e.initSegment,l=e.mediaSegments,d=e.mimeType,f=e.codecs,h=e.width,g=e.height,v=e.frameRate,p=e.sar,m=e.startWithSAP,_=e.timescale,y=e.duration,I=e.encrypted,A=!1;if(this.options.dynamic_video&&this.options.dynamic_video.dynamic_video_list)for(var C=0;C<this.options.dynamic_video.dynamic_video_list.length;C++){var b=this.options.dynamic_video.dynamic_video_list[C];if(b.bitrate===o){t=b.size,n=b.definition,i=b.file_id,r=b.audio_file_id,a=b.codecType||b.codec_type,A=b.isExtra||!1;break}}this.mediaList.video.push({id:s,baseURL:u,initSegment:u+c.replace("$RepresentationID$",s),inited:!1,mediaSegments:l,mimeType:d,codecs:f,width:h,height:g,size:t,frameRate:v,sar:p,startWithSAP:m,bandwidth:o,timescale:_,duration:y,encrypted:I,definition:n,fileId:i,audioFileId:r,codecType:a,isExtra:A})}},{key:"_getAudioSegments",value:function(e){var t,n=e.bandwidth,i=e.id,r=e.baseURL,a=e.initSegment,o=e.mediaSegments,s=e.mimeType,u=e.codecs,c=e.startWithSAP,l=e.timescale,d=e.duration,f=e.encrypted;if(this.options.dynamic_video&&this.options.dynamic_video.dynamic_audio_list)for(var h=0;h<this.options.dynamic_video.dynamic_audio_list.length;h++)this.options.dynamic_video.dynamic_audio_list[h].bitrate===n&&(t=this.options.dynamic_video.dynamic_audio_list[h].size);this.mediaList.audio.push({id:i,baseURL:r,initSegment:r+a.replace("$RepresentationID$",i),inited:!1,mediaSegments:o,mimeType:s,codecs:u,startWithSAP:c,bandwidth:n,size:t,timescale:l,duration:d,encrypted:f})}},{key:"_parseSegments",value:function(e,t){var n=this,i=[],r="";e.BaseURL&&(r=e.BaseURL[0]);var a=e.Period[0];a.AdaptationSet&&a.AdaptationSet.length>1&&a.AdaptationSet.forEach(function(e){var a="video/mp4",o="avc1.64001E",s="640",u="360",c="25",l="1:1",d="1",f="588633";e.mimeType&&("video/mp4"===(a=e.mimeType)?(o=e.codecs,s=parseFloat(e.width),u=parseFloat(e.height),c=parseFloat(e.frameRate),l=e.sar,d=e.startWithSAP,f=parseFloat(e.bandwidth),n.calcVideoCodeType(null,o)):"audio/mp4"===a&&(o=e.codecs,d=e.startWithSAP,f=parseFloat(e.bandwidth))),e.Representation.forEach(function(h){i.indexOf(h.id)>-1&&(h.id=(parseInt(i[i.length-1],10)+1).toString()),i.push(h.id);var g,p="",m=[],_=0,y=t.slice(0,t.lastIndexOf("/")+1)+r;"video/mp4"===(a=v(h,"mimeType",a))?(h.codecs&&(o=h.codecs,n.calcVideoCodeType(null,o)),s=v(h,"width",s,parseFloat),u=v(h,"height",u,parseFloat),c=v(h,"frameRate",c,parseFloat),l=v(h,"sar",l)):"audio/mp4"===a&&(o=v(h,"codecs",o)),d=v(h,"startWithSAP",d),f=v(h,"bandwidth",f,parseFloat),h.BaseURL&&h.BaseURL.length>0&&(y+=h.BaseURL[0]),e.SegmentTemplate&&e.SegmentTemplate.length>0&&(g=e.SegmentTemplate[0]),h.SegmentTemplate&&h.SegmentTemplate.length>0&&(g=h.SegmentTemplate[0]);var I=!1;(e.ContentProtection||h.ContentProtection)&&(I=!0),g&&(p=g.initialization,_=parseFloat(g.duration),n._parseST(g,m,h.id,y,u)),f=parseInt(f),"video/mp4"===a?n._getVideoSegments({id:h.id,bandwidth:f,baseURL:y,initSegment:p,mediaSegments:m,mimeType:a,codecs:o,width:s,height:u,frameRate:c,sar:l,startWithSAP:d,timescale:0,duration:_,encrypted:I}):"audio/mp4"===a&&n._getAudioSegments({id:h.id,baseURL:y,bandwidth:f,initSegment:p,mediaSegments:m,mimeType:a,codecs:o,startWithSAP:d,timescale:0,duration:_,encrypted:I})})})}},{key:"getCurrDefition",value:function(){var e=this.mediaList,t=e.video,n=e.audio,r={all:{},videoFileId:t[t.selectedIdx].fileId,audioFileId:n[n.selectedIdx].fileId},a,o=(0,i.sf)(t);try{for(o.s();!(a=o.n()).done;){var s=a.value;r.all[s.fileId]=s}}catch(e){o.e(e)}finally{o.f()}var u,c=(0,i.sf)(n);try{for(c.s();!(u=c.n()).done;){var l=u.value;r.all[l.fileId]=l}}catch(e){c.e(e)}finally{c.f()}return r}},{key:"init",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this;this.mediaList={video:[],audio:[]};var i=n.options;if(i.dynamic_video.dynamic_type&&"segment_template"!==i.dynamic_video.dynamic_type){n.dashType="segment_base",i.duration;var r,a=i.dynamic_video;["dynamic_video_list","dynamic_audio_list"].forEach(function(e){var r="dynamic_audio_list"===e,o=0;a[e].forEach(function(a,s){var u,c,l=parseInt(a.init_range.split("-")[0],10),d=parseInt(a.init_range.split("-")[1],10),f=parseInt(a.index_range.split("-")[0],10),h=parseInt(a.index_range.split("-")[1],10),g=a.first_segment_range,v=g?[parseInt(g.split("-")[0],10),parseInt(g.split("-")[1],10)]:null;if(r)c=n.majorCodecType||a.codec_type;else{var p=n.calcVideoCodeType(a.codec_type);u=null==p?void 0:p.videoCodecs,c=null==p?void 0:p.videoCodecType,!n.majorCodecType&&!a.isExtra&&(n.majorCodecType=c)}var m=a.fileId||a.file_id,_="dynamic_audio_list"===e?"audio":"video",y="video"===_?t&&t.videoFileId:t&&t.audioFileId,I=t&&t.all,A=I&&I[m];m===y&&(n.mediaList[_].selectedIdx=s,A.wrapperData&&(A.wrapperData.newIdx=s),A.mediaSegments&&A.mediaSegments.forEach(function(e){e.selectedIdx=s})),n.mediaList[_].push({id:(o++).toString(),baseURL:a.main_url,initSegment:a.main_url,initSegmentRange:[l,d],backupUrlList:[a.main_url,a.backup_url_1||a.backup_url,a.fallback_url].filter(function(e){return e}),sidxRange:[f,h],firstMoofMdatRange:v,inited:!1,hasSidx:!1,mediaSegments:A?A.mediaSegments:[],mimeType:r?"audio/mp4":"video/mp4",codecs:r?"mp4a.40.2":u,width:a.vwidth,height:a.vheight,bandwidth:parseInt(a.bitrate),avg_bitrate:a.avg_bitrate,size:a.size,timescale:-1,duration:i.duration,encrypted:a.encrypt,kid:a.kid,definition:a.definition,sidxRes:void 0,fileId:a.file_id,audioFileId:a.audio_file_id,fallbackUrl:a.fallback_url,hasFallback:!1,backupUrl:a.backup_url_1,hasBackup:!1,wrapperData:A?A.wrapperData:null,codecType:c,isExtra:a.isExtra||!1})})}),n.type="vod",["video","audio"].forEach(function(e){n.mediaList[e].length>0&&(!t&&(n.mediaList[e].selectedIdx="video"===e&&n.dash.selectedIdx||0),"video"===e&&n.mediaList[e].sort(function(t,n){return"video"===e?n.height-t.height:n.bandwidth-t.bandwidth}))}),0===n.mediaList.video.length&&0===n.mediaList.audio.length&&(l.ZP.log("medaiList is null",JSON.stringify(n.options.dynamic_video)),null===(r=n.dash)||void 0===r||r.emit("error",new s.Z(g.wb.MANIFEST,g.wb.SUB_TYPES.DASH,{message:"NO_MEDIALIST"}))),e&&n.emit("ready"),n._readyPromise.resolve()}else n.dashType="segment_template",n.fetch(i.dynamic_video.main_url).then(function(e){n.type=e.meta.TYPE.toLocaleLowerCase(),n.emit("ready"),n._readyPromise.resolve()},function(){["video","audio"].forEach(function(e){n.mediaList[e]=[]}),n.retry++,n.retry,n.retryMax})}},{key:"getSidx",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"video",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,a=this.mediaList[n][i],o=a.sidxRange[1];try{var u=e instanceof ArrayBuffer?e:e.buffer,c=new Uint8Array(u),d=String.fromCharCode.apply(null,c.subarray(4,8));if("sidx"!==d)throw l.ZP.log("mpd sdix parse err"),Error("topLevel ".concat(d,", index:").concat(i,", res:").concat(e.byteLength,", range:").concat(JSON.stringify(a.sidxRange)));var h=(t=f.I.sidx(f.I.findBox(new Uint8Array(u),[])[0])).timescale,v=[],p=0,m=0,_=o+1,y=_-1,I=a.cancelFirstSegmentReq,A=a.firstMoofMdatRange,C=a.codecType;t.references.forEach(function(e,t){m+=e.subsegment_duration,y+=e.referenced_size,v.push({idx:t+1,url:a.initSegment,start:Math.round(p/h),end:Math.round(m/h),startRaw:p/h,endRaw:m/h,range:[_,y],downloaded:!I&&A&&0===p?1:0,segmentDuration:Math.round(e.subsegment_duration/h),reference_type:e.reference_type,starts_with_SAP:e.starts_with_SAP,SAP_type:e.SAP_type,SAP_delta_time:e.SAP_delta_time,codecType:C,mediaType:n,selectedIdx:i,fileId:a.fileId}),p=m+1,_=y+1}),v[0].startTime_=0,a.mediaDuration=0,v.forEach(function(e,t){a.mediaDuration+=e.segmentDuration,t>0&&(e.startTime_=v[t-1].startTime_+v[t-1].segmentDuration),t===v.length-1&&r&&(e.end=r)}),a.hasSidx=!0,a.mediaSegments=v,a.timescale=h,a.sidxRes=e}catch(e){if(this.sidxHanded)return;throw this.sidxHanded=!0,new s.Z(g.wb.DEMUX,g.wb.SUB_TYPES.SIDX,{line:398,handle:"[MPD] getSidx",message:"mpd segment base Parse getSidx error ".concat(n," err: ").concat(e.message)})}}},{key:"getCodecType",value:function(e){return(!e&&(e=this.majorCodecType),"bvc2"===e)?"h266":"hevc"===e?"h265":e?e:"h264"}},{key:"checkInBuffered",value:function(e,t,n){return 0!==e.length&&this._inBufferd(t,n,e)}},{key:"_inBufferd",value:function(e,t,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=0;r<n.length;r++){var a=n[r].start,o=n[r].end;if(!(t<a)&&!(e>o)){if(a-i<e&&t<o+i)return!0}}return!1}},{key:"getBuffered",value:function(e){return this._getBuffered(e)}},{key:"_getBuffered",value:function(e){var t=this._getMseBuffered(e);if(!t||0===t.length)return[];for(var n=[],i=0;i<t.length;i++)n.push({start:t.start(i),end:t.end(i)});return n}},{key:"_getMseBuffered",value:function(e){var t,n,i,r=this.dash.mse;return r?t="[object Function]"===Object.prototype.toString.call(r.buffered)?this.dash.mse.buffered(e):"video"===e?null===(n=r.timeline)||void 0===n||null===(n=n.videoRender)||void 0===n?void 0:n.buffered:null===(i=r.timeline)||void 0===i||null===(i=i.audioRender)||void 0===i?void 0:i.buffered:[]}},{key:"seek",value:function(e,t,n){return this._getMediaResultsSeparate(e,t,["video","audio"],n)}},{key:"setSegmentIndexByTime",value:function(e){this._setSegmentBySeek(e,"video"),this._setSegmentBySeek(e,"audio")}},{key:"getCurSegment",value:function(){for(var e=["video","audio"],t={},n=0;n<e.length;n++){var i=e[n],r=null===(a=this.mediaList[i][this.mediaList[i].selectedIdx])||void 0===a?void 0:a.mediaSegments;if(r){var a,o,s,u,c=this._loadStates[i].currentIndex;t[i]=r[c],l.ZP.log("getCurSegment",i,null===(o=t[i])||void 0===o?void 0:o.idx,null===(s=t[i])||void 0===s?void 0:s.start,null===(u=t[i])||void 0===u?void 0:u.end,"idx",c,"len",r.length)}}return t}},{key:"getVideoFirstGop",value:function(){var e,t="video",n=null===(e=this.mediaList[t][this.mediaList[t].selectedIdx])||void 0===e?void 0:e.mediaSegments;return null==n?void 0:n[0]}},{key:"checkRemovedSegment",value:function(e){for(var t=["video","audio"],n={},i=0;i<t.length;i++){var r=t[i],a=e[r];if(!!a){var o=this._getBuffered(r);!this.checkInBuffered(o,a.startRaw,a.endRaw)&&(n[r]={remove:!0,start:a.startRaw,end:a.endRaw})}}return n}},{key:"_setSegmentBySeek",value:function(e,t){var n=this._findSegmentIndexByTime(t,e),i=n;n=this._adjustSegIndex(n,t),l.ZP.log("_setSegmentBySeek",t,i,"newSeg",n),this.setNextSegmentIndex(t,n),this.setLoadingState(t,!1)}},{key:"_adjustSegIndex",value:function(e,t){var n,i=null===(n=this.mediaList[t][this.mediaList[t].selectedIdx])||void 0===n?void 0:n.mediaSegments;if(i&&i.length>0){for(var r=this._getBuffered(t),a=e;a<i.length;a++){var o=i[a];if(this._isItemBufferRemoved(t,r,o),(null==o?void 0:o.downloaded)===0){e=a;break}}}return e}},{key:"setNextSegmentIndex",value:function(e,t){this._loadStates[e].currentIndex=t}},{key:"moveNextSegmentIndex",value:function(e,t){if(t-1===this._loadStates[e].currentIndex){var n=this._loadStates[e].currentIndex,i=this._adjustSegIndex(n+1,e);this._loadStates[e].currentIndex=i,n+1!==i&&l.ZP.log("seekResult moveNextSegmentIndex mediaType",e,"segIdx",n+1,"segIdx",i)}}},{key:"_getMediaResultsSeparate",value:function(e,t,n,i){for(var r={},a=0;a<n.length;a++){var o=n[a];r[o]=[];var s=this._getCurBuffered(o),c=this._getBuffered(o),d=this._loadStates[o];if(d.isLoading||e+t<(null==s?void 0:s[1]))continue;var f=null===(m=this.mediaList[o][this.mediaList[o].selectedIdx])||void 0===m?void 0:m.mediaSegments;if(!f||0===f.length||d.currentIndex>=f.length)continue;var h=d.currentIndex,g=f[h];if(!g)continue;var v=g.end-g.start;if((null==s?void 0:s[1])===0||(null==s?void 0:s[1])>0&&g.start-s[1]>v+1){var p=this._findSegmentIndexByTime(o,e);if(p!==h-1||i){var m,_,y,I=p;(null==s?void 0:s[1])>0&&(I=this._adjustSegIndex(p,o),l.ZP.log("getMediaResults adjust1",o,h,"new",p,"adjustIdx",I,"buf",null==s?void 0:s[1])),this.setNextSegmentIndex(o,I),g=f[d.currentIndex],l.ZP.log("getMediaResults",o,h,"new",p,"adjustIdx",I,"buf",null==s?void 0:s[1],"gap",(null===(_=g)||void 0===_?void 0:_.start)-s[1],"mediaBuffers",JSON.stringify(c),"seg downloaded",null===(y=g)||void 0===y?void 0:y.downloaded)}else l.ZP.log("getMediaResults seq",o,"nsegIndex",p)}if(!!g){if(g.start-e>t){l.ZP.log("outof time");continue}var A=this.checkInBuffered(c,g.startRaw,g.endRaw);if((null==s?void 0:s[1])===0&&A&&(l.ZP.log("_getMediaResults buffer gap fix",o),d.currentIndex<f.length-1&&(d.currentIndex++,g=f[d.currentIndex])),(null==s?void 0:s[1])>0&&g.end<e){var C=g.end;this._setSegmentBySeek(s[1],o),g=f[d.currentIndex],l.ZP.log("getMediaResults low",o,"curBuffers",s,"orgEnd",C,"newend",g.end,"currentTime",e)}g&&g.downloaded===u.Kc.NO_START&&r[o].push(g)}}return r}},{key:"_findSegmentIndexByTime",value:function(e,t){var n,i=null===(n=this.mediaList[e][this.mediaList[e].selectedIdx])||void 0===n?void 0:n.mediaSegments;if(i&&i.length>0){for(var r=0;r<i.length;r++){var a=i[r];if(t>=a.start&&t<a.end)return r}var o=i[i.length-1];if(.2>Math.abs(t-(null==o?void 0:o.end)))return i.length-1}return -1}},{key:"_getCurBuffered",value:function(e){var t,n=this._getMseBuffered(e);return Array.isArray(n)?[0,0]:null===(t=this.dash.player)||void 0===t?void 0:t.getBufferedRange(n)}},{key:"_isItemBufferRemoved",value:function(e,t,n){if(n&&n.downloaded===u.Kc.APPEND)return!this.checkInBuffered(t,n.startRaw,n.endRaw)&&(l.ZP.log("".concat(e," start:").concat(n.start," end:").concat(n.end," segment downloaded to set false")),n.downloaded=u.Kc.NO_START,!0);return n&&n.downloaded===u.Kc.NO_START&&this.checkInBuffered(t,n.startRaw,n.endRaw)&&(n.downloaded=u.Kc.APPEND,l.ZP.log("".concat(e," start:").concat(n.start," end:").concat(n.end," segment downloaded to append"))),!1}},{key:"clearBuffer",value:function(e,t,n){if(!(e>t)){l.ZP.log("mpd clearBuffer ".concat(n," start:").concat(e," end:").concat(t));var i=this;"vod"===i.type&&(n?[n]:["video","audio"]).forEach(function(n){if(i.mediaList[n].length>0){var r=i.mediaList[n][i.mediaList[n].selectedIdx],a=[];r.mediaSegments.forEach(function(n,i){!(n.end<e)&&!(n.start>t)&&(n.downloaded=u.Kc.NO_START,n.extRange=void 0,a.push(i))});var o=a.length>0?a[0]:void 0,s=a.length>1?a[a.length-1]:o;l.ZP.log("".concat(n," start:").concat(e," end:").concat(t,",\n startId:").concat(o," , endId:").concat(s,", segment downloaded set false"))}})}}},{key:"isLastSegmentAndAppend",value:function(e,t){if(!this.mediaList[e])return!0;var n,i=t-1,r=this.mediaList[e].selectedIdx,a=null===(n=this.mediaList[e][r])||void 0===n?void 0:n.mediaSegments;return!!a&&(!a[i]||this._isSegmentAppend(a[i])&&a.length-1===i)}},{key:"_isSegmentAppend",value:function(e){return e.downloaded===u.Kc.APPEND}},{key:"isSegmentAppendFromIdx",value:function(e,t){if(!this.mediaList[e])return{res:!0,emptyTrack:!0};var n,i=0,r=this.mediaList[e].selectedIdx,a=(null===(n=this.mediaList[e][r])||void 0===n?void 0:n.mediaSegments)||[];if(0===a.length)return{res:!0,emptySegments:!0};for(var o=0;o<a.length;o++)if(a[o].start<=t&&t<=a[o].end){i=o;break}a&&t>=a[a.length-1].end&&(i=a.length-1);var s=!0;if(a)for(var u=i;i<a.length&&a[u];u++){;if(!this._isSegmentAppend(a[u])){s=!1;break}}else s=!1;return{res:s}}}],[{key:"parseMPD",value:function(e){if("string"==typeof e&&(t=e),e instanceof ArrayBuffer){var t,n=new Uint8Array(e);t=String.fromCharCode.apply(null,n)}if(!t)return null;var i=performance.now();return t=t.replace(/<(\/)?(\w+:)+(\w+)/g,"<$1$3"),l.ZP.log("MPD cost",performance.now()-i),c.v8.parse(t)}}])}()},405762:function(e,t,n){n.d(t,{Z:function(){return d}});var i=n(648955);n(346984),n(124300),n(802824),n(9498),n(117232),n(173757),n(232070),n(104882),n(932651),n(2885),n(248385),n(496423),n(679308),n(88856),n(759943),n(414931),n(240148),n(683656),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 r=n(373974),a=n(372196),o=["bitrate","definition"],s={};function u(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function c(e){var t,n=Object.values(e);if(n.sort(function(e,t){return e.range[0]-t.range[0]}),0===n.length)return{};for(var r=0,o=0,u=new Uint8Array,c=0;c<n.length;c++){var l=n[c],d=l.range[0],f=l.range[1];if(r>0){if(o+1===d)u=(0,a.gJ)(u,new Uint8Array(l.res));else break}else u=(0,a.gJ)(u,new Uint8Array(l.res));r=d,o=f,t=l}var h=t.cacheKey.split("#"),g=(0,i.ZQ)(h,9),v=g[0],p=g[1],m=g[2],_=g[3],y=g[4],I=g[5],A=g[6],C=g[7],b=g[8],S=n[0].range[0],x={vid:v,mediaType:p,codecType:m,vtype:_,definition:y,start:I,end:A,fileId:b,range:[S,o],bitrate:C},k=s.generateRequestUniqueKey(x);return delete t.cacheKey,(0,i._x)({},k,(0,i.Zj)((0,i.Zj)({},t),{},{res:u.buffer,range:[S,o],memory:u.buffer.byteLength}))}function l(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var r=t[i],a=e[r],o=r.split("#"),s=o[1],u=o[4],c=o[7],l="video"===s?u:c;!n[l]&&(n[l]={}),n[l][r]=a}return n}s.ArrayBufferToString=function(e){for(var t="",n=new Uint8Array(e),i=0;i<n.length;i++)t+=String.fromCharCode(n[i]);return t},s.StringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return t},s.Base64ToHex=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=window.atob(e.replace(/-/g,"+").replace(/_/g,"/"));if(t){for(var i=[],r=0;r<n.length;r++)i.push(n.charCodeAt(r));return new Uint8Array(i).buffer}for(var a="",o=0;o<n.length;o++)a+="0".concat(n.charCodeAt(o).toString(16)).substr(-2);return a},s.HexToBase64=function(e){for(var t="",n=0;n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return window.btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},s.padStart=function(e,t,n){for(var i=String(n),r=t>>0,a=Math.ceil(r/i.length),o=[],s=String(e);a--;)o.push(i);return o.join("").substring(0,r-s.length)+s},s.durationConvert=function(e){var t=0,n=0,i=0;return(e=e.slice(e.indexOf("PT")+2)).indexOf("H")>-1&&e.indexOf("M")>-1&&e.indexOf("S")>-1?(t=parseFloat(e.slice(0,e.indexOf("H"))),n=parseFloat(e.slice(e.indexOf("H")+1,e.indexOf("M"))),i=parseFloat(e.slice(e.indexOf("M")+1,e.indexOf("S")))):e.indexOf("H")>-1&&e.indexOf("M")>-1&&0>e.indexOf("S")?(t=parseFloat(e.slice(0,e.indexOf("H"))),n=parseFloat(e.slice(e.indexOf("H")+1,e.indexOf("M")))):0>e.indexOf("H")&&e.indexOf("M")>-1&&e.indexOf("S")>-1?(n=parseFloat(e.slice(0,e.indexOf("M"))),i=parseFloat(e.slice(e.indexOf("M")+1,e.indexOf("S")))):e.indexOf("H")>-1&&0>e.indexOf("M")&&e.indexOf("S")>-1?(t=parseFloat(e.slice(0,e.indexOf("H"))),i=parseFloat(e.slice(e.indexOf("H")+1,e.indexOf("S")))):0>e.indexOf("H")&&0>e.indexOf("M")&&e.indexOf("S")>-1?i=parseFloat(e.slice(0,e.indexOf("S"))):0>e.indexOf("H")&&e.indexOf("M")>-1&&0>e.indexOf("S")&&(n=parseFloat(e.slice(0,e.indexOf("M")))),3600*t+60*n+i},s.preFixInterge=function(e,t){return(Array(t).join(0)+e).slice(-t)},s.toHex=function(){for(var e=[],t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach(function(t){e.push(s.padStart(Number(t).toString(16),2,0))}),e},s.sum=function(){for(var e=0,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach(function(t){e+=t}),e},s.toUTF8=function(e){for(var t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n.buffer},s.fromHex=function(e){for(var t=new Uint8Array(e.length/2),n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substr(n,2),16);return t},s.fromCharCode=function(e){for(var t="",n=0;n<e.length;n+=16e3){var i=e.subarray(n,n+16e3);t+=String.fromCharCode.apply(null,i)}return t},s.toBase64=function(e,t){var n=s.fromCharCode(e);t=void 0===t||t;var i=window.btoa(n).replace(/\+/g,"-").replace(/\//g,"_");return t?i:i.replace(/=*$/,"")},s.str2hex=function(e){if(""===e)return"";for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t},s.bufferToString=function(e){return"0".concat(Number(e).toString(16)).slice(-2).toUpperCase()},s.stringToBuffer=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e[n]+e[n+1],16));return new Uint8Array(t)},s.round=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Number(e.toFixed(t))},s.isEdge=function(){var e=window.navigator.userAgent.toLowerCase();return e.indexOf("edge")>-1||e.indexOf("edg/")>-1},s.offInDestroy=function(e,t,n,i){e.once(i,function r(){e.off(t,n),e.off(i,r)})},s.on=function(e,t,n,i){if(i)e.on(t,n),s.offInDestroy(e,t,n,i);else{var r=function(i){n(i),e.off(t,r)};e.on(t,r)}},s.once=function(e,t,n,i){if(i)e.once(t,n),s.offInDestroy(e,t,n,i);else{var r=function(i){n(i),e.off(t,r)};e.once(t,r)}},s.promisePolyfill=function(){!Promise.prototype.finally&&(Promise.prototype.finally=({finally:function(e){var t=function(t){return Promise.resolve(e()).then(t)};return this.then(function(e){return t(function(){return e})},function(e){return t(function(){return Promise.reject(e)})})}}).finally)},s.transformHeaders=function(e,t){var n=Object.assign({},e);return Object.keys(t).forEach(function(i){var r=t[i];e&&e[i]&&(n[r]=e[i],delete n[i])}),n},s.generateRequestUniqueKey=function(e){var t=e.vid,n=e.start,i=e.end,a=e.mediaType,o=e.definition,s=e.codecType,u=e.vtype,c=e.bitrate,l=e.fileId,d=e.range;if(d&&d.length>0?(n=d[0],i=d[1]):(n=n||0,i=i||0),s="hevc"===s?"h265":s||"h264",u=u||r.l0.DASH,!t||!a)return null;var f=o?"".concat(t,"#").concat(a,"#").concat(s,"#").concat(u,"#").concat(o,"#").concat(n,"#").concat(i,"#").concat(c):"".concat(t,"#").concat(a,"#").concat(s,"#").concat(u,"##").concat(n,"#").concat(i,"#").concat(c);return l?"".concat(f,"#").concat(l):f},s.getDefinition=function(e){if(!e)return null;var t=e.split("#");return t.length>2?t[2]:null},s.exchangeListUrl=function(e){if(!!e&&0!==e.length)for(var t=0;t<e.length;t++)s.exchangeUrl(e[t])},s.exchangeUrl=function(e){if(!!e&&!!e.main_url&&!!e.backup_url_1){var t=e.main_url,n=e.backup_url_1,i=t.split("?");2===i.length&&-1===n.indexOf("?")?(e.main_url="".concat(n,"?").concat(i[1]),e.backup_url_1=i[0]):(e.main_url=n,e.backup_url_1=t)}},s.validateFragment=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!(e instanceof ArrayBuffer))return!1;try{var n=new Uint8Array(e,4,4),i=String.fromCharCode.apply(null,n),r=!0;if(2===t.length){var a=t[1]-t[0]+1;if(!(r=e.byteLength===a))return}if("moof"!==i&&"styp"!==i&&"ftyp"!==i)return!1}catch(e){return!1}return!0},s.validateUrlRange=function(e,t){if((e=e||[]).length>0&&t)for(var n=0;n<e.length;n++){var i=e[n];if(/([0-9.\-A-Za-z]+)/.test(i)&&t.indexOf(i)>-1)return!0}return!1},s.nowTime=function(){try{return parseInt(performance.now(),10)}catch(e){return new Date().getTime()}},s.getBitrateItem=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=s.getSelectorList(e,n);return t.getSuitableBitrate?t.getSuitableBitrate(r,i):t.bitRateAdapter.select(r)},s.getSelectorList=function(e,t){for(var n=e.dynamic_video_list,r=[],a=0;a<n.length;a++){var s=n[a],u=s.bitrate,c=s.definition,l=(0,i.Kd)(s,o);!s.isExtra&&r.push((0,i.Zj)({bitrate:u,definition:c,duration:t,mediaType:"video"},l))}return r},s.typeof=u,s.getHostFromUrl=function(e){if("String"!==u(e)||!e)return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},s.checkValidTopBox=function(e){var t=s.getTopBoxType(e);return("moof"===t||"styp"===t)&&!0},s.getTopBoxType=function(e){if(s.isArrayBuffer(e)){var t=e.subarray(4,8);return String.fromCharCode.apply(null,t)}return null},s.isArrayBuffer=function(e){return!!(e instanceof ArrayBuffer||e instanceof Uint8Array)||!1},s.getBufferData=function(e,t){var n=0,i=0,r=0,a=0,o=0;if(!e||0===e.length)return{beforeBufLen:n,afterBufLen:i,beforeLastBuffEnd:r,afterFirstBuffEnd:a,afterFirstBuffStart:o};a=1/0,o=1/0;for(var s=0,u=e.length;s<u;s++){var c=e.end(s),l=e.start(s),d=c-l;c<t?(n+=d,r=c):l<=t&&t<=c?(n+=t-l,i+=c-t):(o=Math.min(l,o),a=Math.min(c,a),i+=d)}return{beforeBufLen:n,afterBufLen:i,beforeLastBuffEnd:r,afterFirstBuffEnd:a}},s.combinePreloadData=function(e){for(var t=Object.keys(e),n={},i={},r={},a=0;a<t.length;a++){var o,s,u=t[a],d=e[u];d.isInitSegment?r[u]=d:(d.rangeEnd===(null===(o=d.range)||void 0===o?void 0:o[1])&&d.rangeStart===(null===(s=d.range)||void 0===s?void 0:s[0])?r[u]=d:"audio"===d.mediaType?n[u]=d:"video"===d.mediaType&&(i[u]=d),d.cacheKey=u)}for(var f=l(n),h=0,g=Object.keys(f);h<g.length;h++)Object.assign(r,c(f[g[h]]));for(var v=l(i),p=0,m=Object.keys(v);p<m.length;p++)Object.assign(r,c(v[m[p]]));return r};let d=s},236699:function(e,t,n){function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,p(i.key),i)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,{Ac:function(){return a},IP:function(){return d},Lc:function(){return h},PA:function(){return o},U2:function(){return v},WY:function(){return g},XW:function(){return l},Zj:function(){return r},_x:function(){return c},qH:function(){return u}});function h(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e){var t=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}}();return function(){var n,i=d(e);return n=t?Reflect.construct(i,arguments,d(this).constructor):i.apply(this,arguments),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return h(e)}(this,n)}}function v(){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}}).apply(this,arguments)}function p(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}},983711:function(e,t,n){n.d(t,{Ds:function(){return a},IV:function(){return c},P2:function(){return o},QC:function(){return function e(t){var n=!0,i=Object.prototype.toString,r=Function.prototype.toString;if(Array.isArray(t))n=t.reduce(function(t,n){return t&&e(n)},n);else{var a=RegExp("^".concat(String(i).replace(/[.*+?^${}()|[\]\/\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),"$"));n="function"==typeof t&&a.test(r.call(t))}return n}},Qo:function(){return r},cn:function(){return u},pv:function(){return s}});var i=n(236699);function r(){var e,t,n=new Promise(function(n,i){e=n,t=i});return n.resolve=function(){return e.apply(void 0,arguments)},n.reject=function(){return t.apply(void 0,arguments)},n}function a(e,t){var n;return function(){var i=arguments,r=this;clearTimeout(n),n=setTimeout(function(){e.apply(r,i)},t)}}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=0,r=0;return function(){for(var a=arguments.length,o=Array(a),s=0;s<a;s++)o[s]=arguments[s];var u=performance.now();if(n&&n.apply(this),u-i<t){clearTimeout(r),r=setTimeout(function(){i=u,e.apply(void 0,o)},200);return}clearTimeout(r),i=u,e.apply(void 0,o)}}function s(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,function(e){return e===t})}catch(r){var n=e.className&&"object"===(0,i.Ac)(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(RegExp("(\\s|^)"+t+"(\\s|$)"))}}function u(e,t){if(!!e&&!!t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(t){t&&e.classList.add(t)})}catch(n){!s(e,t)&&(e.className&&"object"===(0,i.Ac)(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}}function c(e,t){if(!!e&&!!t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(t){t&&e.classList.remove(t)})}catch(n){s(e,t)&&t.split(/\s+/g).forEach(function(t){var n=RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===(0,i.Ac)(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")})}}},109436:function(e,t,n){n.d(t,{B:function(){return a}}),n(117232);var i=n(78346),r=n(713804);function a(e,t,n){var a=t.playlist_select_bitrate,u=t.playlist_info;if(!u||!u.playlist)return{factor:1,speed:e};var c=u.playlist,l=u.selectorPos;if(!a||!a.enable_playlist_factor||!c||0===c.length)return{factor:1,speed:e};for(var d=1,f=(0,r.uZ)(e,a.min_speed,a.max_speed),h=0,g={},v=0;v<l;v++){var p=c[v],m=p.aweme_id,_=o(p),y=_.playPosMs,I=_.cachedMs,A=_.bitrate,C=s(a,p,y),b=C-Math.max(0,C-I)*A/f;h+=Math.min(a.max_single_video_reserved_duration,b),g[v]={bitrate:A,aweme_id:m,cached_ms:I,video_dur:p.mediaDurationMs,to_play_ms:C,play_pos:y}}for(var S=Math.min(c.length-l-1,a.max_consider_after_media_num),x=l+1;x<=l+S;x++){var k,E=c[x],T=E.definitionList,w=o(E),R=w.playPosMs,L=w.cachedMs,Z=w.bitrate,O=t.bitrateKey,B=(0,i.QS)(T||[],O).sort(function(e,t){return t._xgOrgBitrate-e._xgOrgBitrate}),P=-1===Z?(null===(k=B[B.length-1])||void 0===k?void 0:k._xgOrgBitrate)||-1:Z,N=s(a,E,R),G=Math.max(0,N-L)*P/f,V=N-G;h+=Math.min(a.max_single_video_reserved_duration,V),g[x]={bitrate:P,aweme_id:E.aweme_id,cached_ms:L,video_dur:E.mediaDurationMs,to_play_ms:N,play_pos:R}}var D=o(c[l]).playPosMs,M=s(a,c[l],D);return g[l]={bitrate:-1,aweme_id:c[l].aweme_id,cached_ms:0,video_dur:c[l].mediaDurationMs,to_play_ms:M,play_pos:0},d=1+(h=Math.min(h,a.max_sum_video_reserved_duration))/M,d=(0,r.uZ)(d,a.min_factor,a.max_factor),n&&(n.bitrateselector_playlist_factor=d,n.bitrateselector_index_offset=l,n.playlist=g),{factor:d,speed:d*f}}function o(e){var t,n={playPosMs:0,cachedMs:0,bitrate:-1};if(e.getInfoCallback){;return(null===(t=e.getInfoCallback)||void 0===t?void 0:t.call(e,e.aweme_id))||n}return n}function s(e,t,n){var i=t.mediaDurationMs,a=t.play_time_prob_dist;if("fixed"===e.to_play_type)return Math.min(e.fixed_to_play_ms,i);if("media_duration"===e.to_play_type);else if("weibull"===e.to_play_type){var o=e.default_weibull_param,s=(0,r.eq)(a||"",o||r.XB),u=e.cdf_threshold||.5,c=(0,r.cF)(s,u,i,n);return c=(0,r.uZ)(c,e.min_to_play_ms,e.max_to_play_ms)}return i}},99020:function(e,t,n){n.d(t,{Z:function(){return i}});function i(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}},423263:function(e,t,n){n.d(t,{Z:function(){return d}});var i,r=n(6055);n(346984),n(303846),n(802824),n(9498),n(2885),n(248385),n(496423),n(679308),n(88856),n(759943),n(706056),n(228983),n(663030);var a=n(298757),o=n(832641),s=n(655675),u=n(410733),c={description:"",name:"__PRE_CACHE__",storeName:"keyvaluepairs",version:1},l="__PRE_CACHE__KEYS";let d=(0,r.qH)(function e(t,n){(0,r.PA)(this,e),this._allCachedKeyMap={},this._memory=0,this._cnt=0;var i=n===o.Rr.MEMORY?u.Z:s.Z;this._cacheType=n,this._driver=new i,this._driver._initStorage(c).catch(function(){}),this._hasIdbForbidden=!1,this._maxCache=!t||t<=0?200:t,this.setMaxCache(this._maxCache),this._allCachedKeys={},this._allCachedTimeKeys={},this.getCachedKeysFromLocal(),this._readyPromise=new a.XK,this.init()},[{key:"supportSync",value:function(){return this._cacheType===o.Rr.MEMORY}},{key:"getCachedKeysFromLocal",value:function(){var e=a.Xb.getItem(l);if(e){for(var t=e.split("|"),n=0;n<t.length;n++){var i=t[n],r=this._getCacheKeyInfos(i),o=r.time,s=r.cachedKey;this._allCachedKeys[s]=1,this._allCachedTimeKeys[s]=o}}}},{key:"_getCacheKeyInfos",value:function(e){var t,n=e.split("$");return 2===n.length&&(t=n[0],e=n[1]),{time:t,cachedKey:e}}},{key:"writeCachedKeysToLocal",value:function(e){var t=[];this._allCachedKeys={},this._allCachedTimeKeys={};for(var n=0;n<e.length;n++){var i=e[n].key,r=this._getCacheKeyInfos(i),o=r.time,s=r.cachedKey;this._allCachedKeys[s]=1,this._allCachedTimeKeys[s]=o,t.push(i)}var u=t.join("|");a.Xb.setItem(l,u)}},{key:"init",value:function(){var e=this;this._driver.setItem("test","test").then(function(){}).catch(function(){e._hasIdbForbidden=!0}).finally(function(){e._driver.removeItem("test").catch(function(){}),e._hasIdbForbidden&&(e._driver=new u.Z,e._driver._initStorage(c)),e._getAll(),e._readyPromise.resolve()})}},{key:"_getAll",value:function(){var e=this;this._memory=0,this._cnt=0,this._driver.all().then(function(t){e._cachedLength=t.length;var n=t.length-e._maxCache,i=t;if(n>0){var a=t.slice(0,n);i=t.slice(n);for(var o=0;o<a.length;o++)e.removeItem(a[o].key).then(function(){})}e._cnt=i.length;for(var s=0;s<i.length;s++){var u=i[s];if("object"===(0,r.Ac)(u.value)){Object.values(u.value).forEach(function(t){e._memory+=(null==t?void 0:t.memory)||0});var c=e._getCacheKeyInfos(u.key).cachedKey;e._allCachedKeyMap[c]=Object.keys(u.value)}}e.writeCachedKeysToLocal(i)}).catch(function(){})}},{key:"getAllCachedDataKeys",value:function(){var e=[];return Object.values(this._allCachedKeyMap).forEach(function(t){e.push.apply(e,(0,r.u)(t))}),e}},{key:"getItem",value:(i=(0,r.x)((0,r.l5)().mark(function e(t,n,i){var a,o,s,u;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((a=this.hasItem(t))&&i&&(a=(null==(o=this._allCachedKeyMap[t])?void 0:o.includes(i))||!1),a){e.next=4;break}return e.abrupt("return",Promise.resolve(!1));case 4:return s=this._getTimeKey(t).timeKey,e.next=7,this._driver.getItem(s,n);case 7:if(u=e.sent,!i){e.next=10;break}return e.abrupt("return",u[i]);case 10:return e.abrupt("return",u);case 11:case"end":return e.stop()}},e,this)})),function(e,t,n){return i.apply(this,arguments)})},{key:"getItemSync",value:function(e,t,n){var i=this.hasItem(e);if(i&&n){var r=this._allCachedKeyMap[e];i=(null==r?void 0:r.includes(n))||!1}if(!i)return!1;var a=this._getTimeKey(e).timeKey,o=this._driver.getItemSync(a,t);return o&&n?o[n]:o}},{key:"setItem",value:function(e,t,n){var i=this;this._getTimeKey(e).timeKey&&this.removeItem(e);var r=new Date().getTime();this._allCachedKeys[e]=1,this._allCachedTimeKeys[e]=r;var a=this._genTimeKey(e,r);return n=n?function(){i._getAll(),n()}:function(){i._getAll()},this._driver.setItem(a,t,n)}},{key:"_getTimeKey",value:function(e){var t=this._allCachedTimeKeys[e],n=e;return t&&(n=this._genTimeKey(e,t)),{timeKey:n,time:t}}},{key:"_genTimeKey",value:function(e,t){return"".concat(t).concat("$").concat(e)}},{key:"removeItem",value:function(e,t){var n=this._getTimeKey(e).timeKey,i=this._driver.removeItem(n,t);return delete this._allCachedKeys[e],delete this._allCachedTimeKeys[e],delete this._allCachedKeyMap[e],i}},{key:"hasItem",value:function(e){return!!this._allCachedKeys[e]}},{key:"clear",value:function(e){return this._driver.clear(e)}},{key:"length",value:function(e){return this._driver.length(e)}},{key:"setMaxCache",value:function(e){"number"==typeof e&&e>0&&(this._maxCache=e)}},{key:"getMemoryInfo",value:function(){return{memory:this._memory,cnt:this._cnt}}}])},917343:function(e,t,n){n.d(t,{Z:function(){return s}});var i=n(330124);n(124300),n(171655),n(248385),n(496423),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 r=n(75740),a=["vid","loadType","size","speed","cacheKey","vtype","duration","bitrate"],o=0,s=(0,i.qH)(function e(t){var n=this;(0,i.PA)(this,e),this._preload_bandwith_map=new Map,this._usepreload_info=new Map,this._pcdn_info_map=new Map,this._updateRealTimeSpeed=function(e){o=e.speed,n.emit(r.kW,e)},this._manager=t},[{key:"setPreloadBandwidth",value:function(e,t){this._preload_bandwith_map.set(e,t)}},{key:"getPreloadBandwidth",value:function(e){return this._preload_bandwith_map.get(e)}},{key:"_updateLoadInfo",value:function(e,t,n){var i=this._pcdn_info_map.get(e);i||(i={}),!i[t]&&(i[t]={},i[t].loadLen=0),i[t].loadLen=i[t].loadLen+n,this._pcdn_info_map.set(e,i)}},{key:"getLoadInfoAndDelete",value:function(e){var t=this._pcdn_info_map.get(e);return this._pcdn_info_map.delete(e),t}},{key:"getPreloadUnuseInfo",value:function(){var e={},t,n=(0,i.sf)(this._preload_bandwith_map);try{for(n.s();!(t=n.n()).done;){var r=(0,i.ZQ)(t.value,2),a=r[0],o=r[1];if(this._usepreload_info.get(a))this._preload_bandwith_map.delete(a);else{var s=a.split("#"),u=s.length>0?s[0]:a;e[u]?(e[u].bw+=o.bw||0,e[u].pbw+=o.pbw||0):e[u]={vid:u,bw:o.bw||0,pbw:o.pbw||0,bitrate:o.bitrate||0,duration:o.duration||0}}}}catch(e){n.e(e)}finally{n.f()}return Object.values(e)}},{key:"bwEventEmit",value:function(e){var t=e.vid,n=e.loadType,o=e.size,s=e.speed,u=e.cacheKey,c=e.vtype,l=e.duration,d=e.bitrate,f=(0,i.Kd)(e,a),h=this.getPreloadBandwidth(u)||{bw:0,pbw:0,vid:t,duration:l,bitrate:d};n&&n!==r._R.CDN?(h.pbw=h.pbw+o,this.emit("prf_data_size",(0,i.Zj)({vid:t,task_type:2,pcdn_size:o,pcdn_speed:s,vtype:c,bitrate:d,duration:l},f))):(h.bw=h.bw+o,this.emit("prf_data_size",(0,i.Zj)({vid:t,task_type:2,cdn_size:o,cdn_speed:s,vtype:c,duration:l,bitrate:d},f))),this.setPreloadBandwidth(u,h),this._updateRealTimeSpeed({speed:s,type:n||r._R.CDN}),this._updateLoadInfo(u,n,o)}},{key:"setUsePreloadInfo",value:function(e,t){this._usepreload_info.set(e,t)}},{key:"realTimeSpeed",get:function(){return o}},{key:"emit",value:function(e,t){var n;null===(n=this._manager)||void 0===n||n.emit(e,t)}},{key:"destroy",value:function(){this._preload_bandwith_map=new Map,this._usepreload_info=new Map,this._pcdn_info_map=new Map,this._manager=null}}])},298757:function(e,t,n){n.d(t,{v8:function(){return S},vI:function(){return p},Ds:function(){return r.Z},Xb:function(){return s.Z},E8:function(){return a.Z},zh:function(){return o.Z},XK:function(){return u.Z},Ic:function(){return g}});var i=n("510142"),r=n("929352"),a=n("737742"),o=n("786933"),s=n("428235"),u=n("165436");n("248385"),n("679308");var c=n("382983"),l,d={},f=0;function h(){do 2147483647===f?f=0:f++;while(f in d);return f}if("undefined"!=typeof Worker){var g,v,p,m,_,y=!1,I=!1,A=function(){if(!_){var e=Promise.withResolvers(),t=e.promise,n=e.resolve,i=e.reject;_=t;try{(l=new c.Z).addEventListener("message",function(e){var t=e.data,r=t.event,a=t.data;switch(r){case"error":I=!0,i(a.error);break;case"ready":y=!0,n();break;default:var o=a.fakeId;if(o in d){var s=d[o]||{},u=s.cb,c=s.param,l=s.keepAlive,f=s.type;if("setInterval"!==f&&delete d[o],!l&&document.hidden)return;if("function"==typeof u)try{u.apply(window,c)}catch(e){}}}}),l.addEventListener("error",function(e){I=!0,i(e)})}catch(e){I=!0,i(e)}}return _},C=function(e,t){I?t&&t():y?e():A().then(e,t)};g=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"!=typeof e)throw Error("cb must be a function");for(var i=h(),r=arguments.length,a=Array(r>3?r-3:0),o=3;o<r;o++)a[o-3]=arguments[o];return d[i]={cb:e,param:a,keepAlive:!!n,type:"setInterval"},C(function(){l.postMessage({action:"setInterval",fakeId:i,time:t})},function(){i in d&&(d[i].degradeId=setInterval(e,t))}),i},p=function(e){if("number"==typeof e&&e in d){var t=d[e].degradeId;delete d[e],C(function(){l.postMessage({action:"clearInterval",fakeId:e})},function(){t&&clearInterval(t)})}}}else g=setInterval,p=clearInterval;var b=n("405935");n("346984"),n("759943"),n("497397"),n("802824");var S=function(){function e(){(0,b.PA)(this,e)}return(0,b.qH)(e,null,[{key:"parse",value:function(t){var n=e.parseXmlString(t);return null!==n?e.parseDOMChildren(n):null}},{key:"parseXmlString",value:function(e){if(void 0===e)return null;var t,n=new window.DOMParser;try{(t=n.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}return t}},{key:"parseDOMChildren",value:function(t,n){if(t.nodeType===Node.DOCUMENT_NODE){for(var i={},r=t.childNodes,a=0;a<r.length;a++){var o=r[a];o.nodeType===Node.ELEMENT_NODE&&(i=e.parseDOMChildren(o))}return i}if(t.nodeType===Node.ELEMENT_NODE){var s={};s.__cnt=0;for(var u=[],c=t.childNodes,l=0;l<c.length;l++){var d=c[l],f=e.getNodeLocalName(d);if(d.nodeType!==Node.COMMENT_NODE){var h="".concat(n,".").concat(f);if(s.__cnt++,null==s[f]){var g=e.parseDOMChildren(d,h);if("#text"!==f||/[^\s]/.test(g)){var v={};v[f]=g,u.push(v)}s[f]=g,e.toArrayAccessForm(s,f)}else{null!=s[f]&&!(s[f]instanceof Array)&&(s[f]=[s[f]],e.toArrayAccessForm(s,f,h));var p=e.parseDOMChildren(d,h);if("#text"!==f||/[^\s]/.test(p)){var m={};m[f]=p,u.push(m)}s[f][s[f].length]=p}}}for(var _=0;_<t.attributes.length;_++){var y=t.attributes[_];s.__cnt++;var I=y.value;s[y.name]=I}var A=t.prefix;return null!=A&&""!==A&&(s.__cnt++,s.__prefix=A),null!=s["#text"]&&(s.__text=s["#text"],s.__text instanceof Array&&(s.__text=s.__text.join("\n")),delete s["#text"],delete s["#text_asArray"]),null!=s["#cdata-section"]&&(s.__cdata=s["#cdata-section"],delete s["#cdata-section"],delete s["#cdata-section_asArray"]),1===s.__cnt&&null!=s.__text?s=s.__text:1===s.__cnt&&null!=s.__cdata&&(s=s.__cdata),delete s.__cnt,s}if(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE)return t.nodeValue}},{key:"getNodeLocalName",value:function(e){var t=e.localName;return null==t&&(t=e.baseName),(null==t||""===t)&&(t=e.nodeName),t}},{key:"toArrayAccessForm",value:function(e,t){!(e[t]instanceof Array)&&(e[t]=[e[t]])}}]),e}();(0,i.l)()},548872:function(e,t,n){n.d(t,{Z:function(){return i}});var i=(0,n(227346).p)("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICd1c2Ugc3RyaWN0JzsKCiAgLyogZXNsaW50LWRpc2FibGUgbm8tZXZhbCAqLwogIC8qIGVzbGludC1kaXNhYmxlIG5vLXVuZGVmICovCgogIGZ1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzIChzcmMpIHsKICAgIHJldHVybiBmZXRjaChzcmMpCiAgICAgIC50aGVuKGZ1bmN0aW9uIChyZXMpIHsKICAgICAgICByZXR1cm4gcmVzLnRleHQoKQogICAgICB9KQogICAgICAudGhlbihmdW5jdGlvbiAodGV4dCkgewogICAgICAgIGV2YWwodGV4dCk7CiAgICAgICAgc2VsZi5Nb2R1bGUgPSBNb2R1bGU7CiAgICAgICAgc2VsZi5hZGRPblBvc3RSdW4gPSBhZGRPblBvc3RSdW47CiAgICAgIH0pCiAgfQoKICB2YXIgTUFYX1NUUkVBTV9CVUZGRVJfTEVOR1RIID0gMTAyNCAqIDEwMjQ7CiAgdmFyIGluaXRUcyA9IDA7CgogIHZhciBEZWNvZGVyID0gZnVuY3Rpb24gKHNlbGYpIHsKICAgIHRoaXMuaW5pdGVkID0gZmFsc2U7CiAgICB0aGlzLnNlbGYgPSBzZWxmOwogICAgdGhpcy5tZXRhID0gc2VsZi5tZXRhOwogICAgdGhpcy5pbmZvbGlzdCA9IFtdOwogICAgc2VsZi5wYXJfYnJvYWR3YXlPbkJyb2Fkd2F5SW5pdGVkID0gdGhpcy5icm9hZHdheU9uQnJvYWR3YXlJbml0ZWQuYmluZCh0aGlzKTsKICAgIHNlbGYucGFyX2Jyb2Fkd2F5T25QaWN0dXJlRGVjb2RlZCA9IHRoaXMuYnJvYWR3YXlPblBpY3R1cmVEZWNvZGVkLmJpbmQodGhpcyk7CiAgfTsKCiAgRGVjb2Rlci5wcm90b3R5cGUudG9VOEFycmF5ID0gZnVuY3Rpb24gKHB0ciwgbGVuZ3RoKSB7CiAgICByZXR1cm4gTW9kdWxlLkhFQVBVOC5zdWJhcnJheShwdHIsIHB0ciArIGxlbmd0aCkKICB9OwoKICBEZWNvZGVyLnByb3RvdHlwZS5pbml0ID0gZnVuY3Rpb24gKCkgewogICAgTW9kdWxlLl9icm9hZHdheUluaXQoKTsKICAgIHRoaXMuc3RyZWFtQnVmZmVyID0gdGhpcy50b1U4QXJyYXkoCiAgICAgIE1vZHVsZS5fYnJvYWR3YXlDcmVhdGVTdHJlYW0oTUFYX1NUUkVBTV9CVUZGRVJfTEVOR1RILCAwKSwgLy8gMDog5YWz6ZetIGZmbXBlZyBsb2csCiAgICAgIE1BWF9TVFJFQU1fQlVGRkVSX0xFTkdUSAogICAgKTsKICB9OwoKICBEZWNvZGVyLnByb3RvdHlwZS5icm9hZHdheU9uUGljdHVyZURlY29kZWQgPSBmdW5jdGlvbiAoCiAgICBvZmZzZXQsCiAgICB3aWR0aCwKICAgIGhlaWdodCwKICAgIHlMaW5lc2l6ZSwKICAgIHV2TGluZXNpemUsCiAgICBpbmZvaWQsCiAgICBrZXlGcmFtZQogICkgewogICAgbGV0IGZpcnN0RnJhbWUgPSB0aGlzLmluZm9saXN0WzBdOwogICAgaWYgKGZpcnN0RnJhbWUgJiYgZmlyc3RGcmFtZS5rZXlmcmFtZSAmJiAha2V5RnJhbWUpIHJldHVybgoKICAgIGxldCBpbmZvID0gT2JqZWN0LmFzc2lnbih7fSwgdGhpcy5pbmZvbGlzdC5zaGlmdCgpKTsKICAgIGxldCB5Um93Y291bnQgPSBoZWlnaHQ7CiAgICBsZXQgdXZSb3djb3VudCA9IGhlaWdodCAvIDI7CiAgICBpZiAoCiAgICAgIHRoaXMubWV0YSAmJgogICAgICAodGhpcy5tZXRhLmNocm9tYUZvcm1hdCA9PT0gNDQ0IHx8IHRoaXMubWV0YS5jaHJvbWFGb3JtYXQgPT09IDQyMikKICAgICkgewogICAgICB1dlJvd2NvdW50ID0gaGVpZ2h0OwogICAgfQogICAgdmFyIGRhdGEgPSB0aGlzLnRvVThBcnJheShvZmZzZXQsIHlMaW5lc2l6ZSAqIHlSb3djb3VudCArIDIgKiAodXZMaW5lc2l6ZSAqIHV2Um93Y291bnQpKTsKICAgIHZhciBkYXRldGVtcCA9IG5ldyBVaW50OEFycmF5KGRhdGEubGVuZ3RoKTsKICAgIGRhdGV0ZW1wLnNldChkYXRhKTsKICAgIHZhciBidWZmZXIgPSBkYXRldGVtcC5idWZmZXI7CgogICAgdGhpcy5zZWxmLnBvc3RNZXNzYWdlKAogICAgICB7CiAgICAgICAgbXNnOiAnREVDT0RFRCcsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0LAogICAgICAgIHlMaW5lc2l6ZSwKICAgICAgICB1dkxpbmVzaXplLAogICAgICAgIGluZm8sCiAgICAgICAgYnVmZmVyCiAgICAgIH0sCiAgICAgIFtidWZmZXJdCiAgICApOwogIH07CgogIERlY29kZXIucHJvdG90eXBlLmJyb2Fkd2F5T25Ccm9hZHdheUluaXRlZCA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuaW5pdGVkID0gdHJ1ZTsKICAgIHZhciBjb3N0ID0gMDsKICAgIGlmIChpbml0VHMpIHsKICAgICAgY29zdCA9IHBlcmZvcm1hbmNlLm5vdygpIC0gaW5pdFRzOwogICAgfQogICAgdGhpcy5zZWxmLnBvc3RNZXNzYWdlKHsgbXNnOiAnREVDT0RFUl9SRUFEWScsIGNvc3QgfSk7CiAgfTsKCiAgRGVjb2Rlci5wcm90b3R5cGUuZGVjb2RlID0gZnVuY3Rpb24gKGRhdGEsIGluZm8pIHsKICAgIGlmIChpbmZvKSB7CiAgICAgIHRoaXMuaW5mb2xpc3QucHVzaChpbmZvKTsKICAgIH0KICAgIGlmIChpbmZvICYmIGluZm8ua2V5ZnJhbWUpIHsKICAgICAgdGhpcy5pbmZvbGlzdCA9IFtpbmZvXTsKICAgIH0KICAgIHRoaXMuc3RyZWFtQnVmZmVyLnNldChkYXRhKTsKICAgIE1vZHVsZS5fYnJvYWR3YXlQbGF5U3RyZWFtKGRhdGEubGVuZ3RoLCAwKTsKICB9OwoKICBEZWNvZGVyLnByb3RvdHlwZS5kZXN0cm95ID0gZnVuY3Rpb24gKCkgewogICAgTW9kdWxlLl9icm9hZHdheUV4aXQoKTsKICB9OwoKICBEZWNvZGVyLnByb3RvdHlwZS51cGRhdGVNZXRhID0gZnVuY3Rpb24gKG1ldGEpIHsKICAgIHRoaXMubWV0YSA9IG1ldGE7CiAgfTsKCiAgdmFyIGRlY29kZXI7CgogIGZ1bmN0aW9uIG9uUG9zdFJ1biAoKSB7CiAgICBkZWNvZGVyID0gbmV3IERlY29kZXIodGhpcyk7CiAgICBkZWNvZGVyLmluaXQoKTsKICB9CgogIHZhciBXQVNNX0NETl9QQVRIX1BSRUZJWCA9ICcnOwoKICBmdW5jdGlvbiBpbml0ICh1cmwpIHsKICAgIFdBU01fQ0ROX1BBVEhfUFJFRklYID0gdXJsLnNwbGl0KCcvJykuc2xpY2UoMCwgLTEpLmpvaW4oJy8nKTsKICAgIGluaXRUcyA9IHBlcmZvcm1hbmNlLm5vdygpOwogICAgdmFyIGlzRGVncmFkZSA9IC9hc20vLnRlc3QodXJsKTsKICAgIGlmICghZGVjb2RlcikgewogICAgICB2YXIgdGFzazsKICAgICAgaWYgKCFzZWxmLmltcG9ydFNjcmlwdHMpIHsKICAgICAgICB0YXNrID0gc2hpbUltcG9ydFNjcmlwdHModXJsKTsKICAgICAgfSBlbHNlIHsKICAgICAgICB0YXNrID0gbmV3IFByb21pc2UoZnVuY3Rpb24gKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgaWYgKCFzZWxmLmNvbnNvbGUpIHsKICAgICAgICAgICAgc2VsZi5jb25zb2xlID0gewogICAgICAgICAgICAgIGxvZzogZnVuY3Rpb24gKCkge30sCiAgICAgICAgICAgICAgd2FybjogZnVuY3Rpb24gKCkge30sCiAgICAgICAgICAgICAgaW5mbzogZnVuY3Rpb24gKCkge30sCiAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uICgpIHt9CiAgICAgICAgICAgIH07CiAgICAgICAgICB9CiAgICAgICAgICB0cnkgewogICAgICAgICAgICBzZWxmLmltcG9ydFNjcmlwdHModXJsKTsKICAgICAgICAgICAgcmVzb2x2ZSgpOwogICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICByZWplY3QoZSk7CiAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICAgIH0KCiAgICAgIHRhc2sKICAgICAgICAudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICBpZiAoaXNEZWdyYWRlKSB7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdhdXRvIGluc3RhbmNlIERlY29kZXIhJyk7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7CiAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBvblBvc3RSdW4uY2FsbChzZWxmKTsKICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICByZWplY3QoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0pCiAgICAgICAgICB9CgogICAgICAgICAgcmV0dXJuIHNlbGYKICAgICAgICAgICAgLm0oewogICAgICAgICAgICAgIGluc3RhbnRpYXRlV2FzbTogZnVuY3Rpb24gKGluZm8sIHJlY2VpdmVJbnN0YW5jZSkgewogICAgICAgICAgICAgICAgZmV0Y2goYCR7V0FTTV9DRE5fUEFUSF9QUkVGSVh9L2RlY29kZXIud2FzbS5qc2ApCiAgICAgICAgICAgICAgICAgIC50aGVuKHJlcyA9PiByZXMuYXJyYXlCdWZmZXIoKSkKICAgICAgICAgICAgICAgICAgLnRoZW4oYnVmZmVyID0+IHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2ViQXNzZW1ibHkuaW5zdGFudGlhdGUoYnVmZmVyLCBpbmZvKQogICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlY2VpdmVJbnN0YW5jZShyZXN1bHQuaW5zdGFuY2UpCiAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSkKICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKE1vZCkgewogICAgICAgICAgICAgIHNlbGYuTW9kdWxlID0gTW9kOwogICAgICAgICAgICAgIG9uUG9zdFJ1bi5jYWxsKHNlbGYpOwogICAgICAgICAgICB9KQogICAgICAgIH0pCiAgICAgICAgLmNhdGNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgbXNnOiAnSU5JVF9GQUlMRUQnLAogICAgICAgICAgICBsb2c6IGUubWVzc2FnZQogICAgICAgICAgfSk7CiAgICAgICAgfSk7CiAgICB9CiAgfQoKICBzZWxmLm9ubWVzc2FnZSA9IGZ1bmN0aW9uIChlKSB7CiAgICB2YXIgZGF0YSA9IGUuZGF0YTsKICAgIGlmICgoZGF0YS5tc2cgIT09ICdpbml0JyAmJiBkYXRhLm1zZyAhPT0gJ3ByZWxvYWQnKSAmJiAhZGVjb2RlcikgcmV0dXJuCiAgICBzd2l0Y2ggKGRhdGEubXNnKSB7CiAgICAgIGNhc2UgJ3ByZWxvYWQnOgogICAgICAgIGluaXQoZGF0YS51cmwpOwogICAgICAgIGJyZWFrCiAgICAgIGNhc2UgJ2luaXQnOgogICAgICAgIHNlbGYubWV0YSA9IGRhdGEubWV0YTsKICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsKICAgICAgICAgIG1zZzogJ0xPRycsCiAgICAgICAgICBsb2c6ICd3b3JrZXIgaW5pdGVkJwogICAgICAgIH0pOwogICAgICAgIGluaXQoZGF0YS51cmwpOwogICAgICAgIGJyZWFrCiAgICAgIGNhc2UgJ3VwZGF0ZW1ldGEnOgogICAgICAgIHNlbGYubWV0YSA9IGRhdGEubWV0YTsKICAgICAgICBkZWNvZGVyLnVwZGF0ZU1ldGEoZGF0YS5tZXRhKTsKICAgICAgICBicmVhawogICAgICBjYXNlICdpbml0RGVjb2Rlcic6CiAgICAgICAgZGVjb2Rlci5kZWNvZGUoZGF0YS5kYXRhKTsKICAgICAgICBicmVhawogICAgICBjYXNlICdkZWNvZGUnOgogICAgICAgIGRlY29kZXIuZGVjb2RlKGRhdGEuZGF0YSwgZGF0YS5pbmZvKTsKICAgICAgICBicmVhawogICAgICBjYXNlICdmaW5pc2hfZmxhZyc6CiAgICAgICAgc2VsZi5wb3N0TWVzc2FnZSh7CiAgICAgICAgICBtc2c6ICdCQVRDSF9GSU5JU0hfRkxBRycKICAgICAgICB9KTsKICAgICAgICBicmVhawogICAgICBjYXNlICdkZXN0b3J5JzoKICAgICAgICBkZWNvZGVyLmRlc3Ryb3koKTsKICAgICAgICBicmVhawogICAgfQogIH07Cgp9KCkpOwoK",null,!1)},455792:function(e,t,n){n.d(t,{Z:function(){return A}}),n(149336);var i=n(616376),r=n(315355),a=n(919209),o=n(732905),s=n(64505),u=n(625813),c=n(278997),l=n(508881),d=n(272787),f=n(787070),h=n.n(f);n(346984),n(248385),n(679308),n(9498),n(162093),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);var g=n(597931),v=n(534611),p=n(383943),m=n(683636),_=n(58172),y=n(944693),I={INIT_AUDIO_ERR:"create new AudioContext error"},A=function(e){(0,u.Z)(C,e);var t,n,f,p,A=(t=C,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,i=(0,l.Z)(t);return e=n?Reflect.construct(i,arguments,(0,l.Z)(this).constructor):i.apply(this,arguments),(0,c.Z)(this,e)});function C(e,t){var n;return(0,r.Z)(this,C),n=A.call(this,e,t),(0,d.Z)((0,o.Z)(n),"doPause",n._doPause),n.TAG="AudioRender",n._timeRange=new m.Z((0,o.Z)(n)),n._lastTimeLineTime=0,n._sampleQueue=[],n._source=null,n._audioCanAutoplay=!0,n._lastBuffer=null,n._inDecoding=!1,n._endOfStream=!1,n._delay=0,n._isSourceBufferEnd=-1,n._onSourceBufferEnded=n._onSourceBufferEnded.bind((0,o.Z)(n)),n._initAudioCtx(e.volume||.6),n._bindEvents(),n}return(0,a.Z)(C,[{key:"baseDts",get:function(){return this._timeRange._baseDts}},{key:"currentTime",get:function(){return this._audioCtx?this._lastTimeLineTime+this._audioCtx.currentTime:0}},{key:"preloadTime",get:function(){return this.isLive?1:0}},{key:"timescale",get:function(){return 1e3}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"ctxState",get:function(){return this._audioCtx.state}},{key:"audioCanAutoplay",get:function(){return this._audioCanAutoplay}},{key:"resume",value:function(){if(this._audioCtx&&"suspended"===this._audioCtx.state)return this._audioCtx.resume().catch(function(e){})}},{key:"canSeek",value:function(e){return this._timeRange.canSeek(e)}},{key:"_assembleErr",value:function(e){var t=Error(e);return t.code=3,t}},{key:"_emitTimelineEvents",value:function(e,t,n){var i,r;null===(i=this._parent)||void 0===i||null===(r=i.emit)||void 0===r||r.call(i,e,t,n)}},{key:"_initAudioCtx",value:function(e){var t=this;g.kg.log(this.TAG,"init audioCtx");var n=window.AudioContext||window.webkitAudioContext;if(this._audioCtx=new n,!this._audioCtx){g.kg.warn(this.TAG,"create webaudio error!"),setTimeout(function(){t._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ERROR,t._assembleErr(I.INIT_AUDIO_ERR))});return}return this._gainNode=this._audioCtx.createGain(),this._gainNode.gain.value=e,this._gainNode.connect(this._audioCtx.destination),this._audioCanAutoplay="running"===this._audioCtx.state,g.kg.log(this.TAG,"webAudio state:",this._audioCtx.state),(0,_.ds)(),this._bindAudioCtxEvent(),this._audioCtx.suspend()}},{key:"_bindAudioCtxEvent",value:function(){var e=this;this._onStateChange=function(){e._audioCtx&&"running"===e._audioCtx.state&&e._ready&&e._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.PLAYING)},this._audioCtx.addEventListener("statechange",this._onStateChange)}},{key:"_bindEvents",value:function(){var e=this;(0,s.Z)((0,l.Z)(C.prototype),"_bindEvents",this).call(this),this._parent.on(v.ZP.DECODE_EVENTS.CHASE_AUDIO_FRAME,this._doChaseFrame.bind(this)),this._parent.on(v.ZP.TIMELINE.UPDATE_VOLUME,function(t){e._gainNode&&(e._gainNode.gain.value=isFinite(t)?t:1,e._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.VOLUME_CHANGE))}),this._parent.on(v.ZP.TIMELINE.END_OF_STREAM,function(){var t;e._endOfStream=!0,!e.noAudio&&!(null!==(t=e._timeRange)&&void 0!==t&&t.hasBuffer())&&(null==e||e._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ENDED))})}},{key:"_appendChunk",value:function(e,t){if(!this.noAudio){!this._meta&&(this._meta=t,g.kg.warn(this.TAG,"audio set metadata",this._meta));var n=t.samples;if(n.length){if(this._sampleQueue=this._sampleQueue.concat(n),t.samples=[],"aac"===this._meta.codecType){if(this._inDecoding)return;this._decodeAACWrapper()}else this._decodeG711()}}}},{key:"_resetDts",value:function(e,t){"video"!==t&&this._timeRange.resetDts(e)}},{key:"_doPlay",value:function(){if(!this.noAudio&&!this._parent.seeking){if(!this._source&&this.currentTime){this._startRender();return}this.resume()}}},{key:"_doPause",value:function(){if(!this.noAudio)this._audioCtx.suspend()}},{key:"_reInitAudioCtx",value:function(e){var t=this;if(this._lastTimeLineTime=e,this._lastBuffer=null,this._lastAudioBufferInfo=null,this._delay=0,!(this._ready&&this._audioCtx.currentTime))return Promise.resolve();var n=this._gainNode.gain.value;return this._audioCtx.close().then(function(){return t._audioCtx.removeEventListener("statechange",t._onStateChange),t._audioCtx=null,t._source&&t._source.removeEventListener("ended",t._onSourceBufferEnded),t._source=null,t._initAudioCtx(n)})}},{key:"_doSeek",value:function(e){var t=this;this._reInitAudioCtx(e).then(function(){t._getAudioBuffer(!0)}).catch(function(e){})}},{key:"_doChaseFrame",value:function(e){var t=this,n=e.position,i=this._timeRange.deletePassed(n);i&&(g.kg.log(this.TAG,"_doChaseFrame","startTime:",i.start,"buffeLength:",this.buffered.end(0)-i.start),this._reInitAudioCtx(i.start).then(function(){t._startRender(),t._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.TIMEUPDATE)}).catch(function(e){}))}},{key:"_decodeAACWrapper",value:(f=(0,i.Z)(h().mark(function e(){var t,n,i,r,a,o,s,u,c;return h().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._sampleQueue.length,n=this._sampleQueue[0],!((i=(this._sampleQueue[t-1].dts-n.dts)/this.timescale)<1)){e.next=6;break}return e.abrupt("return");case 6:for(s=0,r=parseInt(i/3-1)||1,a=parseInt(t/r),o=[];s<r;s++)s<r-1?o.push(this._sampleQueue.slice(s*a,(s+1)*a)):o.push(this._sampleQueue.slice(s*a));return this._sampleQueue=[],this._inDecoding=!0,e.prev=12,e.next=15,this._decodeCycle(o);case 15:!this._isLive&&(c=(u=this._timeRange._buffers)[u.length-1])&&this._emitTimelineEvents(v.ZP.TIMELINE.UPDATE_SEGMENT_END,c.end),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(12),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(e.t0&&e.t0.message)));case 21:this._inDecoding=!1;case 22:case"end":return e.stop()}},e,this,[[12,18]])})),function(){return f.apply(this,arguments)})},{key:"_decodeCycle",value:(p=(0,i.Z)(h().mark(function e(t){var n;return h().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.shift()){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this._decodeAAC(n);case 5:return e.next=7,this._decodeCycle(t);case 7:case"end":return e.stop()}},e,this)})),function(e){return p.apply(this,arguments)})},{key:"_decodeAAC",value:function(e){var t=this,n=e[0],i=0;y.Z.checkRefillFrame(e);var r=e.map(function(e){return y.Z.packageAACToAdts(t._meta,e)}),a=y.Z.concatAdts(r,0);return new Promise(function(e,r){var o=t._audioCtx.decodeAudioData(a.buffer,function(r){if(t._timeRange){if(t._lastAudioBufferInfo&&t.isLive){var a=t._lastAudioBufferInfo,o=a.dts+a.duration;(i=n.dts-o)>1&&(t._timeRange._duration+=i/1e3,g.kg.log(t.TAG,"_decodeAAC","audio data dts is not continue, last end dts:",o,",now start Dts:",n.dts,"delay:",i))}t._lastAudioBufferInfo={duration:Math.floor(1e3*r.duration),dts:n.dts};var s=t._timeRange.append(r,r.duration,n.dts,i/1e3);if(!t._ready){var u=.5>Math.abs(s+r.duration-t.currentTime);(t.isLive||!u)&&(t._ready=!0,g.kg.log(t.TAG,"_decodeAAC","set ready true start=",s),t.emit(v.ZP.AUDIO.AUDIO_READY,s))}t._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.PROGRESS),t._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.DURATION_CHANGE),e()}},r);o.catch&&o.catch(r)})}},{key:"_decodeG711",value:function(){var e=this._sampleQueue.length,t=this._sampleQueue[0];if(!((this._sampleQueue[e-1].dts-t.dts)/this.timescale<.5)){var n=new Uint8Array(this._sampleQueue.reduce(function(e,t){return e+=t.data.byteLength},0)),i=0,r=0;this._sampleQueue.forEach(function(e,t){0===t&&(i=e.dts),n.set(e.data,r),r+=e.data.byteLength}),this._sampleQueue=[];try{var a=this._meta,o=a.codecType,s=a.channelCount,u=a.sampleSize,c=a.sampleRate,l=y.Z.decodeG711(n,o),d=y.Z.createAudioBufferFromPcm(this._audioCtx,l.buffer,s,c,u/8),f=d.audioBuffer,h=d.duration,p=this._timeRange.append(f,h,i,0);!this._ready&&(this._ready=!0,g.kg.log(this.TAG,"_decodeG711","set ready true"),this.emit(v.ZP.AUDIO.AUDIO_READY,p)),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.PROGRESS),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.DURATION_CHANGE)}catch(e){this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(e&&e.message)))}}}},{key:"_onSourceBufferEnded",value:function(){this._isSourceBufferEnd=!0,g.kg.long&&g.kg.log(this.TAG,"source play end! currentTime:".concat(this.currentTime," , duration:").concat(this.duration)),this._startRender()}},{key:"_ajustSeekTime",value:function(e){var t=this._timeRange.getBuffer(e,0);t&&(g.kg.log(this.TAG,"ajust seek time to:",t.start),this._lastTimeLineTime=t.start)}},{key:"_getAudioBuffer",value:function(e){var t=this;if(this._timeRange){var n=this._timeRange.getBuffer(this._lastBuffer?this._lastBuffer.end:this.currentTime,0);if(!n){if((this._endOfStream||!this._isLive)&&this.currentTime-this.duration>-.5){this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.TIMEUPDATE),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ENDED);return}this._ready=!1,this._audioCtx.suspend(),this.emit(v.ZP.AUDIO.AUDIO_WAITING),e&&(!this._onAudioReady&&(this._onAudioReady=function(e){t._ajustSeekTime(e)}),this.removeListener(v.ZP.AUDIO.AUDIO_READY,this._onAudioReady),this.once(v.ZP.AUDIO.AUDIO_READY,this._onAudioReady));return}if(e){this._ajustSeekTime(n.start),this.emit(v.ZP.AUDIO.AUDIO_READY);return}return n}}},{key:"_startRender",value:function(e){if(!this.noAudio){if("video"===e&&this.isLive&&this._ready&&!this._isSourceBufferEnd){this._doPlay();return}var t=this._getAudioBuffer();if(t){"suspended"===this._audioCtx.state&&(this._audioCtx.resume().catch(function(e){}),(0,_.fC)()),this._lastBuffer=t,this._source=null;var n=this._audioCtx.createBufferSource();n.buffer=t.source,n.loop=!1,this._source=n,n.addEventListener("ended",this._onSourceBufferEnded),n.connect(this._gainNode),t.delay&&t.delay>.001&&(this._delay+=t.delay),this.startDts=t.startDts;try{this._isSourceBufferEnd=!1,n.start()}catch(e){}t.startDts&&this._emitTimelineEvents(v.ZP.TIMELINE.SYNC_DTS,t.startDts)}}}},{key:"_destroy",value:function(){g.kg.log(this.TAG,"destroy audio..."),this._source&&this._source.removeEventListener("ended",this._onSourceBufferEnded),this._audioCtx&&"closed"!==this.ctxState&&this._audioCtx.close(),this._audioCtx=null,this._sampleQueue=null,this._timeRange=null,this._parent=null,this.removeAllListeners()}}]),C}(p.Z)},368166:function(e,t,n){n.d(t,{C:function(){return r}});var i=n(548814),r=function(){function e(){(0,i.PA)(this,e),(0,i._x)(this,"_data",Object.create(null))}return(0,i.qH)(e,[{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){return this._data[e]}},{key:"clear",value:function(){this._data=Object.create(null)}}]),e}()},279981:function(e,t,n){n.d(t,{Z:function(){return r}});var i=n(548814),r=function(){function e(){(0,i.PA)(this,e),this.frames=[],this.dur=0,this.minPts=Number.MAX_VALUE,this.maxPts=0}return(0,i.qH)(e,[{key:"appendFrame",value:function(e){this.frames.push(e),this.dur+=e.duration}},{key:"calMinMaxPts",value:function(e){e.pts<this.minPts&&(this.minPts=e.pts);var t=e.pts+e.duration;t>this.maxPts&&(this.maxPts=t)}}]),e}()},958281:function(e,t,n){n.d(t,{c:function(){return c}});var i=n(182432),r=n(801700),a=n(587220),o=n(275764),s=n(654175),u=n(942155),c=function(e){(0,i.XW)(n,e);var t=(0,i.WY)(n);function n(){var e;return(0,i.PA)(this,n),e=t.call(this),(0,i._x)((0,i.Lc)(e),"_xhr",null),(0,i._x)((0,i.Lc)(e),"_aborted",!1),(0,i._x)((0,i.Lc)(e),"_timeoutTimer",null),(0,i._x)((0,i.Lc)(e),"_range",null),(0,i._x)((0,i.Lc)(e),"_receivedLength",0),(0,i._x)((0,i.Lc)(e),"_url",null),(0,i._x)((0,i.Lc)(e),"_onProgress",null),(0,i._x)((0,i.Lc)(e),"_index",-1),(0,i._x)((0,i.Lc)(e),"_headers",null),(0,i._x)((0,i.Lc)(e),"_currentChunkSizeKB",384),(0,i._x)((0,i.Lc)(e),"_timeout",null),(0,i._x)((0,i.Lc)(e),"_xhr",null),(0,i._x)((0,i.Lc)(e),"_withCredentials",null),(0,i._x)((0,i.Lc)(e),"_startTime",-1),(0,i._x)((0,i.Lc)(e),"_loadCompleteResolve",null),(0,i._x)((0,i.Lc)(e),"_loadCompleteReject",null),(0,i._x)((0,i.Lc)(e),"_runing",!1),(0,i._x)((0,i.Lc)(e),"_logger",!1),(0,i._x)((0,i.Lc)(e),"_vid",""),(0,i._x)((0,i.Lc)(e),"_responseType",void 0),(0,i._x)((0,i.Lc)(e),"_credentials",void 0),(0,i._x)((0,i.Lc)(e),"_method",void 0),(0,i._x)((0,i.Lc)(e),"_transformResponse",void 0),(0,i._x)((0,i.Lc)(e),"_firstRtt",void 0),(0,i._x)((0,i.Lc)(e),"_onCancel",null),(0,i._x)((0,i.Lc)(e),"_priOptions",null),e}return(0,i.qH)(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=(0,a.G7)(e.url,e.params);var n=Date.now();return new Promise(function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()}).catch(function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof r.C?e:new r.C(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e})}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===o.U.ARRAY_BUFFER&&this._range&&this._range.length>1){if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,i=this._range[1];t<this._range[1]-n&&(i=n+t),e=[n,i],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e)}this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){t._running=!1;var n,i,a,o=new r.C(t._url,t._request,null==e?void 0:null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e?void 0:null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e?void 0:null===(a=e.currentTarget)||void 0===a?void 0:a.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new r.C(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var i=this._headers||{},o=(0,a.Gu)(e);o&&(i.Range=o),i&&Object.keys(i).forEach(function(e){n.setRequestHeader(e,i[e])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||t>299){var n=new r.C(this._url,null,(0,i.Zj)((0,i.Zj)({},e.target.response),{},{status:t}),"bad response,status:"+t);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var u=null,c=!1,l=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0;if(this._responseType===o.U.ARRAY_BUFFER){var d,f,h,g=new Uint8Array(e.target.response);if(f=l+this._receivedLength,g&&g.byteLength>0){this._receivedLength+=g.byteLength;var v=Date.now()-this._startTime,p=(0,a.pl)(this._receivedLength,v);this.emit(s.K.REAL_TIME_SPEED,{speed:p,len:this._receivedLength,time:v,vid:this._vid,index:this._index,range:[f,l+this._receivedLength],priOptions:this._priOptions})}u=g,c=(!((null===(h=this._range)||void 0===h?void 0:h.length)>1)||!this._range[1]||!(this._receivedLength<this._range[1]-this._range[0]))&&!0,this._logger.debug("[xhr load done->], tast :",this._range,", start",f,"end ",l+this._receivedLength,",dataLen,",g?g.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",c)}else c=!0,u=e.target.response;var m={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(m=this._transformResponse(m,this._url)||m),this._onProgress&&this._onProgress(u,c,{index:this._index,vid:this._vid,range:[f,l+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},m),c?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve((0,a.rO)(this._onProgress?null:u,c,m,m.headers["content-length"],m.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted&&(this._aborted=!0,this._runing=!1,(0,i.U2)((0,i.IP)(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr))return this._xhr.abort()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t=e.getAllResponseHeaders().trim().split("\r\n"),n={},r,a=(0,i.sf)(t);try{for(a.s();!(r=a.n()).done;){var o=r.value.split(": ");n[o[0].toLowerCase()]=o.slice(1).join(": ")}}catch(e){a.e(e)}finally{a.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(n.n(u)())},309324:function(e,t,n){n.d(t,{d1:function(){return f}});var i=n(70427),r=n(720357),a=n(908483),o=n(525231),s=n(338726),u=n(699694);function c(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];try{if(!a.j)return null;if(e&&"undefined"!=typeof ManagedMediaSource)return ManagedMediaSource;return window.MediaSource}catch(e){}}function l(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var d={APPEND:"appendBuffer",REMOVE:"removeBuffer",UPDATE_DURATION:"updateDuration"},f=function(){var e,t,n;function a(e,t){var n=this;(0,i.PA)(this,a),(0,i._x)(this,"media",null),(0,i._x)(this,"mediaSource",null),(0,i._x)(this,"_openPromise",(0,u.Qo)()),(0,i._x)(this,"_queue",Object.create(null)),(0,i._x)(this,"_sourceBuffer",Object.create(null)),(0,i._x)(this,"_mseFullFlag",{}),(0,i._x)(this,"_st",0),(0,i._x)(this,"_opst",0),(0,i._x)(this,"_logger",null),(0,i._x)(this,"_config",null),(0,i._x)(this,"_url",null),(0,i._x)(this,"_onStartStreaming",function(){n._logger.debug("startstreaming")}),(0,i._x)(this,"_onEndStreaming",function(){n._logger.debug("endstreaming")}),(0,i._x)(this,"_onSBUpdateEnd",function(e){var t=n._queue[e];if(t){var i=t[0];if((null==i?void 0:i.opName)!==d.UPDATE_DURATION&&t.shift(),i){var r,a,o=(0,u.je)()-n._opst;n._logger.debug("UpdateEnd(".concat(e,"/").concat(i.opName,")"),u.Kp.stringify(function(e){var t=[];if(e instanceof TimeRanges)for(var n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}(null===(r=n._sourceBuffer[e])||void 0===r?void 0:r.buffered)),o,i.context),i.promise.resolve({name:i.opName,context:i.context,costtime:o});var s=null===(a=i.context)||void 0===a?void 0:a.callback;s&&"function"==typeof s&&s(i.context),n._startQueue(e)}}}),(0,i._x)(this,"_onSBUpdateError",function(e,t){var i=n._queue[e];if(i){var r=i[0];r&&(n._logger.error("UpdateError",e,r.opName,r.context),r.promise.reject(new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_APPEND_BUFFER,t)))}}),this._config=Object.assign(a.getDefaultConfig(),t),e&&this.bindMedia(e),this._logger=new s.Y("MSE"),this._config.openLog&&s.Y.enable()}return(0,i.qH)(a,[{key:"isOpened",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)==="open"}},{key:"hasOpTasks",get:function(){var e=this,t=!1;return Object.keys(this._queue).forEach(function(n){var i=e._queue[n];Array.isArray(i)&&(t||(t=i.length>0))}),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!l(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(e){return e?this._mseFullFlag[e]:this._mseFullFlag[a.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,n=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var i=0;if(Object.keys(this._sourceBuffer).forEach(function(e){try{i=Math.max(t.bufferEnd(e)||0,i)}catch(e){}}),e<i)return Promise.resolve()}return this._enqueueBlockingOp(function(){if(t.isEnded){t._logger.debug("setDuration but ended");return}t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("setDuration",e))},d.UPDATE_DURATION,{isReduceDuration:n})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",function n(){var i=(0,u.je)()-e._st;e._logger.debug("sourceopen",i),t.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:i})}),this._openPromise=(0,u.Qo)()}return this._openPromise}},{key:"bindMedia",value:(e=(0,i.x)((0,i.l5)().mark(function e(t){var n,r,a,o,s=this;return(0,i.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.mediaSource||this.media)){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(n=c(this._config.preferMMS),!(!t||!n)){e.next=6;break}throw Error("Param media or MediaSource does not exist");case 6:return this.media=t,a=l(r=this.mediaSource=new n),this._st=(0,u.je)(),o=function e(){var n=(0,u.je)()-s._st;s._logger.debug("sourceopen"),r.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),s._openPromise.resolve({costtime:n})},r.addEventListener("sourceopen",o),a&&(r.addEventListener("startstreaming",this._onStartStreaming),r.addEventListener("endstreaming",this._onEndStreaming)),this._url=URL.createObjectURL(r),t.src=this._url,t.disableRemotePlayback=a,e.abrupt("return",this._openPromise);case 17:case"end":return e.stop()}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"unbindMedia",value:(t=(0,i.x)((0,i.l5)().mark(function e(){var t,n,r,a=this;return(0,i.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._openPromise.used&&this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach(function(e){var t=a._queue[e];t&&t.forEach(function(e){var t,n;return null===(t=e.promise)||void 0===t?void 0:null===(n=t.resolve)||void 0===n?void 0:n.call(t)})}),n=!!this.media&&this.media.readyState>=1,r="open"===t.readyState,n&&r)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach(function(e){try{t.removeSourceBuffer(a._sourceBuffer[e])}catch(e){}}),l(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=(0,u.Qo)(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"createSource",value:function(e,t){var n;if(!this._sourceBuffer[e]&&this.mediaSource){try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_ADD_SB,e)}n.mimeType=t,n.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),n.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var n=this,i=this._sourceBuffer[e];return this.mediaSource&&i&&i.mimeType!==t?"function"!=typeof i.changeType?Promise.reject(new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_CHANGE_TYPE,Error("changeType is not a function"))):this._enqueueOp(e,function(){try{i.changeType(t)}catch(e){throw new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_CHANGE_TYPE,e)}i.mimeType=t,n._onSBUpdateEnd(e)},"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,n){var i=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,function(){var r;i.mediaSource&&!i.media.error&&(i._logger.debug("MSE APPEND START",n),i._opst=(0,u.je)(),null===(r=i._sourceBuffer[e])||void 0===r||r.appendBuffer(t))},d.APPEND,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,i){var r=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,function(){if(r.mediaSource&&!r.media.error){var a=r._sourceBuffer[e];if(t>=n||!a){r._onSBUpdateEnd(e);return}r._opst=(0,u.je)(),r._logger.debug("MSE REMOVE START",e,t,n,i),a.remove(t,n)}},d.REMOVE,i,a)}},{key:"clearBuffer",value:function(e,t){var n,i=this;return Object.keys(this._sourceBuffer).forEach(function(r){n=i.remove(r,e,t)}),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach(function(n){var i=t._sourceBuffer[n];e=t.remove(n,0,r.l.end(r.l.get(i)))}),e}},{key:"clearOpQueues",value:function(e,t){this._logger.debug("MSE clearOpQueue START");var n,i=this._queue[e];if(t&&i){this._queue[e]=[];return}if(i&&i[e]&&!(i.length<5)){var r=[];i.forEach(function(e){e.context&&e.context.isinit&&r.push(e)}),this._queue[e]=i.slice(0,2),r.length>0&&(n=this._queue[e]).push.apply(n,r)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp(function(){var n=t.mediaSource;n&&"open"===n.readyState&&(t._logger.debug("MSE endOfStream START"),e?n.endOfStream(e):n.endOfStream())},"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var n=this.mediaSource;!(e<0)&&!(t<e)&&null!=n&&n.setLiveSeekableRange&&"open"===n.readyState&&n.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return r.l.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return r.l.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return r.l.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,n,i,r){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:(0,u.Qo)(),opName:n,context:i};return r?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened||this.isEnded?1===o.length&&this._startQueue(e):this._openPromise.then(function(){1===o.length&&a._startQueue(e)}),s.promise}},{key:"_enqueueBlockingOp",value:(n=(0,i.x)((0,i.l5)().mark(function e(t,n,r){var a,o,s=this;return(0,i.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((a=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],a.forEach(function(e){var t=s._queue[e],i=(0,u.Qo)();o.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:n,context:r}),1===t.length&&s._startQueue(e)}),e.abrupt("return",Promise.all(o).then(function(){try{return t()}finally{a.forEach(function(e){var t=s._queue[e],n=s._sourceBuffer[e];null==t||t.shift(),(!n||!n.updating)&&s._startQueue(e)})}}));case 8:case"end":return e.stop()}},e,this)})),function(e,t,i){return n.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var n,r,a=t[0];if(a&&!this._mseFullFlag[e])try{a.exec()}catch(s){s&&s.message&&s.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,a.context&&"object"===(0,i.Ac)(a.context)&&(a.context.isFull=!0),this._logger.error("[MSE error], context,",a.context," ,name,",a.opName,",err,SourceBuffer is full"),null==a||null===(n=a.promise)||void 0===n||n.reject(new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_FULL,s))):(this._logger.error(s),null==a||null===(r=a.promise)||void 0===r||r.reject(s.constructor===o.Fc?s:new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_OTHER,s)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,n){var i=this;return this._enqueueOp(e,function(){t<0&&(t+=.001),i._sourceBuffer[e].timestampOffset=t,i._onSBUpdateEnd(e)},"setTimeoffset",n)}},{key:"abort",value:function(e,t){var n=this;return this.isOpened?this._enqueueOp(e,function(){n._sourceBuffer[e].abort(),n._onSBUpdateEnd(e)},"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=c(t);if(!n)return!1;try{return n.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),a}();(0,i._x)(f,"VIDEO","video"),(0,i._x)(f,"AUDIO","audio")},408746:function(e,t,n){n.d(t,{G7:function(){return o},Gu:function(){return r},pl:function(){return u},rO:function(){return s}});var i=n(673747);function r(e){if(!!e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function a(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function o(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map(function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map(function(t){return(0,i.J_)(t)?t=t.toISOString():(0,i.Kn)(t)&&(t=JSON.stringify(t)),"".concat(a(e),"=").concat(a(t))}).join("&")}).filter(Boolean).join("&");if(r){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function s(e,t,n,i,r,a,o,s,u,c,l){return r=null!=r?parseFloat(r):null,Number.isNaN(i=parseInt(i||"0",10))&&(i=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:i,age:r,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:n}}function u(e,t){return Math.round(8e3*e/t/1024)}},364812:function(e,t,n){n.d(t,{l:function(){return r}});var i=n(570783),r=function(){function e(){(0,i.PA)(this,e)}return(0,i.qH)(e,null,[{key:"start",value:function(e){return!e||!e.length||1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&0>e.start(0)?0:e.start(0)}},{key:"end",value:function(e){return!e||!e.length||1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1)}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],i=0,r=e.length;i<r;i++){var a=n.length;if(a&&t){var o=n[a-1],s=o[1];if(e.start(i)-s<=t){var u=e.end(i);u>s&&(o[1]=u)}else n.push([e.start(i),e.end(i)])}else n.push([e.start(i),e.end(i)])}return n}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce(function(e,t){return e+(t[1]-t[0])},0):0}},{key:"info",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var r=0,a=0,o=0,s=0,u=0,c=0,l=0,d=e.buffers(t,i),f=0,h=d.length;f<h;f++){var g=d[f];if(n+i>=g[0]&&n<=g[1])r=g[0],a=g[1],o=f;else if(n+i<g[0]){s=g[0],u=g[1];break}else n+i>g[1]&&(c=g[0],l=g[1])}return{start:r,end:a,index:o,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-r,remaining:a?a-n:0,length:e.totalLength&&e.totalLength(d)}}},{key:"isBuffered",value:function(t,n){if(t){var i=e.get(t);if(null!=i&&i.length){for(var r=0;r<i.length;r++)if(n>=i.start(r)&&n<=i.end(r))return!0}}return!1}}]),e}()},828792:function(e,t,n){n.d(t,{i:function(){return u}});var i=n("697946"),r=n("662439"),a=n("585104"),o=function(){function e(t){if((0,i.PA)(this,e),this._bitsAvailable=0,this._word=0,!t)throw Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return(0,i.qH)(e,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"bitsPos",value:function(){return 8*this._bytesAvailable-this._bitsAvailable}},{key:"bitsLeft",value:function(){return 8*this._data.length-this.bitsPos()}},{key:"byteAligned",value:function(){return 0===this.bitsPos()||this.bitsPos()%8==0}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw Error("No bytes available");var n=new Uint8Array(4);n.set(this._data.subarray(e,e+t)),this._word=new DataView(n.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{var t=Math.floor((e-=this._bitsAvailable)/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),n=this._word>>>32-t;return(this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable)?n<<t|this.readBits(t):n}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if((this._word&2147483648>>>e)!=0)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,n=8,i=0;i<e;i++)0!==n&&(n=(t+this.readEG()+256)%256),t=0===n?t:n}}]),e}();function s(e,t){return t?e.readToUint8(t).slice():new Uint8Array}var u=function(){function e(){(0,i.PA)(this,e)}return(0,i.qH)(e,null,[{key:"getNalType",value:function(e){if(!!e&&!(e.byteLength<=1))return(248&e[1])>>3}},{key:"getNalTypes",value:function(t){return null!=t&&t.length?t.map(function(t){return e.getNalType(t)}).filter(function(e){return"number"==typeof e}):[]}},{key:"getNalInfo",value:function(t){var n=e.getNalTypes(t);if(!!n.length){var i="";return n.includes(7)||n.includes(8)?i="idr":n.includes(9)&&(i="cra"),{nalTypes:n,randomAccessType:i,rasl:n.includes(3)}}}},{key:"buildCodecString",value:function(e,t){var n=e||"vvc1";if(!t)return"".concat(n,".1.L93");var i=t.generalProfileIdc||1,r=t.generalTierFlag?"H":"L",a=t.generalLevelIdc||93;return"".concat(n,".").concat(i,".").concat(r).concat(a)}},{key:"parseVVCDecoderConfigurationRecord",value:function(t,n){return e._parseStandardVvcConfigurationRecord(t,n||"vvc1")}},{key:"_parseStandardVvcConfigurationRecord",value:function(t,n){var i,o,s,u,c,l,d,f=t;f.length>=5&&f[0]<248&&(f=f.subarray(4));var h=a.J.fromUint8(f),g=r.A.fromByte(h,1);g.read(5);var v=g.read(2),p=g.read(1),m=1,_={};if(p){var y=r.A.fromByte(h,2);i=y.read(9),m=y.read(3),o=y.read(2),s=y.read(2);var I=r.A.fromByte(h,1);u=I.read(3),I.read(5),_=e.parseVVCPTLRecord(h,m),c=h.read(2),l=h.read(2),d=h.read(2)}var A=e._parseVVCNalArrays(h);return{data:t,codec:e.buildCodecString(n,_),sampleEntryType:n||"vvc1",nalUnitSize:v+1,ptlPresentFlag:p,olsIdx:i,numSublayers:m,constantFrameRate:o,chromaFormatIdc:s,bitDepthLumaMinus8:u,ptlRecord:_,width:c,height:l,sampleRate:d,numOfArrays:A.numOfArrays,vps:A.vps,sps:A.sps,pps:A.pps,spsParsed:A.spsParsed}}},{key:"_parseVVCNalArrays",value:function(t){for(var n=t.read(1),i=[],a=[],o=[],u=null,c=0;c<n;c++){var l=r.A.fromByte(t,1);l.read(1),l.read(2);var d=l.read(5),f=1;13!==d&&12!==d&&(f=t.read(2));for(var h=0;h<f;h++){var g=t.read(2);switch(d){case 14:i.push(s(t,g));break;case 15:var v=s(t,g);if(!u)try{u=e.parseSPS(e.removeEPB(v))}catch(e){}a.push(v);break;case 16:o.push(s(t,g));break;default:s(t,g)}}}return{numOfArrays:n,vps:i,sps:a,pps:o,spsParsed:u}}},{key:"parseVVCPTLRecord",value:function(e,t){var n=r.A.fromByte(e,2);n.read(2);var i=n.read(6),a=n.read(7),o=n.read(1),s=e.read(1),u=r.A.fromByte(e,1),c=u.read(1),l=u.read(1),d=new Uint8Array(i);if(i){for(var f=0;f<i-1;f++){var h=u.read(6),g=(u=r.A.fromByte(e,1)).read(2);d[f]=h<<2|g}d[i-1]=u.read(6)}else u.read(6);var v=[];if(t>1){for(var p=r.A.fromByte(e,1),m=0,_=t-2;_>=0;--_)m|=p.read(1)<<_;for(var y=t;y<=8&&t>1;++y)p.read(1);for(var I=t-2;I>=0;--I)m&1<<I&&(v[I]=e.read(1))}var A=e.read(1),C=[];if(A)for(var b=0;b<A;b++)C.push(e.readInt(4));return{generalProfileIdc:a,generalTierFlag:o,generalLevelIdc:s,ptlFrameOnlyConstraintFlag:c,ptlMultilayerEnabledFlag:l,generalConstraintInfo:d,subLayerLevelIdc:v,generalSubProfileIdc:C,ptlNumSubProfiles:A,numBytesConstraintInfo:i}}},{key:"getAvccNals",value:function(e){for(var t=[];e.position<e.length-4;){var n=e.dataview.getInt32(e.dataview.position);if(e.length-e.position>=n){var i=e.buffer.slice(e.position,e.position+4);e.skip(4);var r=new Uint8Array(e.buffer.slice(e.position,e.position+n));e.skip(n),t.push({header:i,body:r});continue}break}return t}},{key:"analyseNal",value:function(e){var t=(248&e.body[1])>>3;switch(e.type=t,t){case 23:case 24:break;case 7:case 8:e.key=!0;break;case 14:e.vps=!0;break;case 15:e.sps=!0;break;case 16:e.pps=!0;break;case 17:e.aps=!0}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,n=[],i=1;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(n.push(i+2),i+=2):i++;if(!n.length)return e;var r=t-n.length,a=new Uint8Array(r),o=0;for(i=0;i<r;o++,i++)o===n[0]&&(o++,n.shift()),a[i]=e[o];return a}},{key:"parseVps",value:function(){}},{key:"parseSPS",value:function(t){var n=new o(t);n.readUByte(),n.readUByte(),n.skipBits(4);var i=n.readBits(4),r=n.readBits(3),a=n.readBits(2),s=420;a<=3&&(s=[0,420,422,444][a]),n.readBits(2),n.readBits(1);var u=e._parseProfileTierLevel(n,1,r);n.readBits(1),n.readBits(1)&&n.readBits(1);var c=n.readUEG();return{width:c,height:n.readUEG(),spsMaxSubLayerMinus1:r,spsVideoParameterSetId:i,chromaFormatIdc:a,chromaFormat:s,ptlInfo:u}}},{key:"_parseProfileTierLevel",value:function(t,n,i){var r,a=t.readBits(7),o=t.readBits(1),s=t.readBits(8),u=t.readBits(1),c=t.readBits(1);n&&(r=e._parseGeneralConstraintsInfo(t));for(var l=i-1,d=[],f=[],h=[],g=l;g>=0;--g)d[g]=t.readBits(1);for(;!t.byteAligned();)t.readBits(1);for(var v=l;v>=0;--v)d[v]&&(f[v]=t.readUByte());if(n){for(var p=t.readUByte(),m=0;m<p;m++)h[m]=t.readBits(32)}return{generalProfileIdc:a,generalTierFlag:o,generalLevelIdc:s,ptlFrameOnlyConstraintFlag:u,ptlMultilayerEnabledFlag:c,ptlSublayerLevelPresentFlags:d,ptlSublayerLevelIdcs:f,ptlSubProfileIdcs:h,gciInfo:r}}},{key:"_parseGeneralConstraintsInfo",value:function(e){var t=e.readBits(1);if(t){e.skipBits(71);var n=e.readBits(8);n&&e.skipBits(n)}var i=8-e.bitsPos()%8;return e.skipBits(i),{gciPresentFlag:t}}}]),e}()},740427:function(e,t,n){n.d(t,{W:function(){return a}});var i=n(697946),r=n(745740),a=function(){function e(){(0,i.PA)(this,e),(0,i._x)(this,"id",2),(0,i._x)(this,"type",r.Vc.AUDIO),(0,i._x)(this,"codecType",r.yQ.AAC),(0,i._x)(this,"pid",-1),(0,i._x)(this,"codec",""),(0,i._x)(this,"container",""),(0,i._x)(this,"sequenceNumber",0),(0,i._x)(this,"sampleDuration",0),(0,i._x)(this,"timescale",0),(0,i._x)(this,"formatTimescale",0),(0,i._x)(this,"baseMediaDecodeTime",0),(0,i._x)(this,"duration",0),(0,i._x)(this,"warnings",[]),(0,i._x)(this,"samples",[]),(0,i._x)(this,"baseDts",0),(0,i._x)(this,"sampleSize",16),(0,i._x)(this,"sampleRate",0),(0,i._x)(this,"channelCount",0),(0,i._x)(this,"objectType",0),(0,i._x)(this,"sampleRateIndex",0),(0,i._x)(this,"parsedCodec",null),(0,i._x)(this,"config",[]),(0,i._x)(this,"present",!1),(0,i._x)(this,"isVideoEncryption",!1),(0,i._x)(this,"isAudioEncryption",!1),(0,i._x)(this,"kid",null),(0,i._x)(this,"ext",void 0)}return(0,i.qH)(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&(this.codec||this.container)&&(this.codecType===r.yQ.AAC||this.codecType===r.yQ.G711PCMA||this.codecType===r.yQ.G711PCMU||this.codecType===r.yQ.OPUS||this.codecType===r.yQ.MP3))}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}]),e}()},481784:function(e,t,n){n.d(t,{Dt:function(){return o},vU:function(){return a}});var i="undefined"!=typeof window,r=i&&navigator.userAgent.toLocaleLowerCase();i&&/^((?!chrome|android).)*safari/.test(r);var a=i&&r.includes("firefox"),o=i&&r.includes("android")}}]);